n)return o;i.to==n&&(i.from!=i.to&&"before"==t?r=o:se=o),i.from==n&&(i.from!=i.to&&"before"!=t?r=o:se=o)}return null!=r?r:se}var ce=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",n="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111",t=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,r=/[stwN]/,o=/[LRr]/,i=/[Lb1n]/,a=/[1n]/;function s(e,n,t){this.level=e,this.from=n,this.to=t}return function(l,c){var u="ltr"==c?"L":"R";if(0==l.length||"ltr"==c&&!t.test(l))return!1;for(var d,p=l.length,h=[],f=0;f-1&&(r[n]=o.slice(0,i).concat(o.slice(i+1)))}}}function me(e,n){var t=he(e,n);if(t.length)for(var r=Array.prototype.slice.call(arguments,2),o=0;o0}function be(e){e.prototype.on=function(e,n){pe(this,e,n)},e.prototype.off=function(e,n){fe(this,e,n)}}function ke(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Te(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function we(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function Ce(e){ke(e),Te(e)}function xe(e){return e.target||e.srcElement}function Se(e){var n=e.which;return null==n&&(1&e.button?n=1:2&e.button?n=3:4&e.button&&(n=2)),y&&e.ctrlKey&&1==n&&(n=3),n}var Le,Oe,Ie=function(){if(a&&s<9)return!1;var e=A("div");return"draggable"in e||"dragDrop"in e}();function Ae(e){if(null==Le){var n=A("span","");I(e,A("span",[n,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(Le=n.offsetWidth<=1&&n.offsetHeight>2&&!(a&&s<8))}var t=Le?A("span",""):A("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return t.setAttribute("cm-text",""),t}function Me(e){if(null!=Oe)return Oe;var n=I(e,document.createTextNode("AخA")),t=S(n,0,1).getBoundingClientRect(),r=S(n,1,2).getBoundingClientRect();return O(e),!(!t||t.left==t.right)&&(Oe=r.right-t.right<3)}var Ne,Ee=3!="\n\nb".split(/\n/).length?function(e){for(var n=0,t=[],r=e.length;n<=r;){var o=e.indexOf("\n",n);-1==o&&(o=e.length);var i=e.slice(n,"\r"==e.charAt(o-1)?o-1:o),a=i.indexOf("\r");-1!=a?(t.push(i.slice(0,a)),n+=a+1):(t.push(i),n=o+1)}return t}:function(e){return e.split(/\r\n?|\n/)},_e=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(e){return!1}}:function(e){var n;try{n=e.ownerDocument.selection.createRange()}catch(e){}return!(!n||n.parentElement()!=e)&&0!=n.compareEndPoints("StartToEnd",n)},Re="oncopy"in(Ne=A("div"))||(Ne.setAttribute("oncopy","return;"),"function"==typeof Ne.oncopy),Pe=null,Be={},He={};function We(e,n){arguments.length>2&&(n.dependencies=Array.prototype.slice.call(arguments,2)),Be[e]=n}function De(e){if("string"==typeof e&&He.hasOwnProperty(e))e=He[e];else if(e&&"string"==typeof e.name&&He.hasOwnProperty(e.name)){var n=He[e.name];"string"==typeof n&&(n={name:n}),(e=J(n,e)).name=n.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return De("application/xml");if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return De("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function Fe(e,n){n=De(n);var t=Be[n.name];if(!t)return Fe(e,"text/plain");var r=t(e,n);if(Ue.hasOwnProperty(n.name)){var o=Ue[n.name];for(var i in o)o.hasOwnProperty(i)&&(r.hasOwnProperty(i)&&(r["_"+i]=r[i]),r[i]=o[i])}if(r.name=n.name,n.helperType&&(r.helperType=n.helperType),n.modeProps)for(var a in n.modeProps)r[a]=n.modeProps[a];return r}var Ue={};function je(e,n){H(n,Ue.hasOwnProperty(e)?Ue[e]:Ue[e]={})}function ze(e,n){if(!0===n)return n;if(e.copyState)return e.copyState(n);var t={};for(var r in n){var o=n[r];o instanceof Array&&(o=o.concat([])),t[r]=o}return t}function Ge(e,n){for(var t;e.innerMode&&(t=e.innerMode(n))&&t.mode!=e;)n=t.state,e=t.mode;return t||{mode:e,state:n}}function qe(e,n,t){return!e.startState||e.startState(n,t)}var Ke=function(e,n,t){this.pos=this.start=0,this.string=e,this.tabSize=n||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=t};function Ve(e,n){if((n-=e.first)<0||n>=e.size)throw new Error("There is no line "+(n+e.first)+" in the document.");for(var t=e;!t.lines;)for(var r=0;;++r){var o=t.children[r],i=o.chunkSize();if(n=e.first&&nt?nn(t,Ve(e,t).text.length):function(e,n){var t=e.ch;return null==t||t>n?nn(e.line,n):t<0?nn(e.line,0):e}(n,Ve(e,n.line).text.length)}function un(e,n){for(var t=[],r=0;r=this.string.length},Ke.prototype.sol=function(){return this.pos==this.lineStart},Ke.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ke.prototype.next=function(){if(this.posn},Ke.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Ke.prototype.skipToEnd=function(){this.pos=this.string.length},Ke.prototype.skipTo=function(e){var n=this.string.indexOf(e,this.pos);if(n>-1)return this.pos=n,!0},Ke.prototype.backUp=function(e){this.pos-=e},Ke.prototype.column=function(){return this.lastColumnPos0?null:(r&&!1!==n&&(this.pos+=r[0].length),r)}var o=function(e){return t?e.toLowerCase():e};if(o(this.string.substr(this.pos,e.length))==o(e))return!1!==n&&(this.pos+=e.length),!0},Ke.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ke.prototype.hideFirstChars=function(e,n){this.lineStart+=e;try{return n()}finally{this.lineStart-=e}},Ke.prototype.lookAhead=function(e){var n=this.lineOracle;return n&&n.lookAhead(e)},Ke.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};var dn=function(e,n){this.state=e,this.lookAhead=n},pn=function(e,n,t,r){this.state=n,this.doc=e,this.line=t,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};function hn(e,n,t,r){var o=[e.state.modeGen],i={};wn(e,n.text,e.doc.mode,t,function(e,n){return o.push(e,n)},i,r);for(var a=t.state,s=function(r){t.baseTokens=o;var s=e.state.overlays[r],l=1,c=0;t.state=!0,wn(e,n.text,s.mode,t,function(e,n){for(var t=l;ce&&o.splice(l,1,e,o[l+1],r),l+=2,c=Math.min(e,r)}if(n)if(s.opaque)o.splice(t,l-t,e,"overlay "+n),l=t+2;else for(;te.options.maxHighlightLength&&ze(e.doc.mode,r.state),i=hn(e,n,r);o&&(r.state=o),n.stateAfter=r.save(!o),n.styles=i.styles,i.classes?n.styleClasses=i.classes:n.styleClasses&&(n.styleClasses=null),t===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return n.styles}function mn(e,n,t){var r=e.doc,o=e.display;if(!r.mode.startState)return new pn(r,!0,n);var i=function(e,n,t){for(var r,o,i=e.doc,a=t?-1:n-(e.doc.mode.innerMode?1e3:100),s=n;s>a;--s){if(s<=i.first)return i.first;var l=Ve(i,s-1),c=l.stateAfter;if(c&&(!t||s+(c instanceof dn?c.lookAhead:0)<=i.modeFrontier))return s;var u=W(l.text,null,e.options.tabSize);(null==o||r>u)&&(o=s-1,r=u)}return o}(e,n,t),a=i>r.first&&Ve(r,i-1).stateAfter,s=a?pn.fromSaved(r,a,i):new pn(r,qe(r.mode),i);return r.iter(i,n,function(t){gn(e,t.text,s);var r=s.line;t.stateAfter=r==n-1||r%5==0||r>=o.viewFrom&&rn.start)return i}throw new Error("Mode "+e.name+" failed to advance stream.")}pn.prototype.lookAhead=function(e){var n=this.doc.getLine(this.line+e);return null!=n&&e>this.maxLookAhead&&(this.maxLookAhead=e),n},pn.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var n=this.baseTokens[this.baseTokenPos+1];return{type:n&&n.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},pn.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},pn.fromSaved=function(e,n,t){return n instanceof dn?new pn(e,ze(e.mode,n.state),t,n.lookAhead):new pn(e,ze(e.mode,n),t)},pn.prototype.save=function(e){var n=!1!==e?ze(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new dn(n,this.maxLookAhead):n};var bn=function(e,n,t){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=n||null,this.state=t};function kn(e,n,t,r){var o,i,a=e.doc,s=a.mode,l=Ve(a,(n=cn(a,n)).line),c=mn(e,n.line,t),u=new Ke(l.text,e.options.tabSize,c);for(r&&(i=[]);(r||u.pose.options.maxHighlightLength?(s=!1,a&&gn(e,n,r,d.pos),d.pos=n.length,l=null):l=Tn(yn(t,d,r.state,p),i),p){var h=p[0].name;h&&(l="m-"+(l?h+" "+l:h))}if(!s||u!=l){for(;c=n:i.to>n);(r||(r=[])).push(new Sn(a,i.from,s?null:i.to))}}return r}(t,o,a),l=function(e,n,t){var r;if(e)for(var o=0;o=n:i.to>n)||i.from==n&&"bookmark"==a.type&&(!t||i.marker.insertLeft)){var s=null==i.from||(a.inclusiveLeft?i.from<=n:i.from0&&s)for(var b=0;bn)&&(!t||Rn(t,i.marker)<0)&&(t=i.marker)}return t}function Dn(e,n,t,r,o){var i=Ve(e,n),a=xn&&i.markedSpans;if(a)for(var s=0;s=0&&d<=0||u<=0&&d>=0)&&(u<=0&&(l.marker.inclusiveRight&&o.inclusiveLeft?tn(c.to,t)>=0:tn(c.to,t)>0)||u>=0&&(l.marker.inclusiveRight&&o.inclusiveLeft?tn(c.from,r)<=0:tn(c.from,r)<0)))return!0}}}function Fn(e){for(var n;n=Bn(e);)e=n.find(-1,!0).line;return e}function Un(e,n){var t=Ve(e,n),r=Fn(t);return t==r?n:$e(r)}function jn(e,n){if(n>e.lastLine())return n;var t,r=Ve(e,n);if(!zn(e,r))return n;for(;t=Hn(r);)r=t.find(1,!0).line;return $e(r)+1}function zn(e,n){var t=xn&&n.markedSpans;if(t)for(var r=void 0,o=0;on.maxLineLength&&(n.maxLineLength=t,n.maxLine=e)})}var Yn=function(e,n,t){this.text=e,Nn(this,n),this.height=t?t(this):1};function Xn(e){e.parent=null,Mn(e)}Yn.prototype.lineNo=function(){return $e(this)},be(Yn);var Qn={},$n={};function Jn(e,n){if(!e||/^\s*$/.test(e))return null;var t=n.addModeClass?$n:Qn;return t[e]||(t[e]=e.replace(/\S+/g,"cm-$&"))}function Zn(e,n){var t=M("span",null,null,l?"padding-right: .1px":null),r={pre:M("pre",[t],"CodeMirror-line"),content:t,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};n.measure={};for(var o=0;o<=(n.rest?n.rest.length:0);o++){var i=o?n.rest[o-1]:n.line,a=void 0;r.pos=0,r.addToken=nt,Me(e.display.measure)&&(a=ue(i,e.doc.direction))&&(r.addToken=tt(r.addToken,a)),r.map=[],ot(i,r,fn(e,i,n!=e.display.externalMeasured&&$e(i))),i.styleClasses&&(i.styleClasses.bgClass&&(r.bgClass=R(i.styleClasses.bgClass,r.bgClass||"")),i.styleClasses.textClass&&(r.textClass=R(i.styleClasses.textClass,r.textClass||""))),0==r.map.length&&r.map.push(0,0,r.content.appendChild(Ae(e.display.measure))),0==o?(n.measure.map=r.map,n.measure.cache={}):((n.measure.maps||(n.measure.maps=[])).push(r.map),(n.measure.caches||(n.measure.caches=[])).push({}))}if(l){var s=r.content.lastChild;(/\bcm-tab\b/.test(s.className)||s.querySelector&&s.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return me(e,"renderLine",e,n.line,r.pre),r.pre.className&&(r.textClass=R(r.pre.className,r.textClass||"")),r}function et(e){var n=A("span","•","cm-invalidchar");return n.title="\\u"+e.charCodeAt(0).toString(16),n.setAttribute("aria-label",n.title),n}function nt(e,n,t,r,o,i,l){if(n){var c,u=e.splitSpaces?function(e,n){if(e.length>1&&!/ /.test(e))return e;for(var t=n,r="",o=0;oc&&d.from<=c);p++);if(d.to>=u)return e(t,r,o,i,a,s,l);e(t,r.slice(0,d.to-c),o,i,null,s,l),i=null,r=r.slice(d.to-c),c=d.to}}}function rt(e,n,t,r){var o=!r&&t.widgetNode;o&&e.map.push(e.pos,e.pos+n,o),!r&&e.cm.display.input.needsContentAttribute&&(o||(o=e.content.appendChild(document.createElement("span"))),o.setAttribute("cm-marker",t.id)),o&&(e.cm.display.input.setUneditable(o),e.content.appendChild(o)),e.pos+=n,e.trailingSpace=!1}function ot(e,n,t){var r=e.markedSpans,o=e.text,i=0;if(r)for(var a,s,l,c,u,d,p,h=o.length,f=0,m=1,g="",v=0;;){if(v==f){l=c=u=s="",p=null,d=null,v=1/0;for(var y=[],b=void 0,k=0;kf||w.collapsed&&T.to==f&&T.from==f)){if(null!=T.to&&T.to!=f&&v>T.to&&(v=T.to,c=""),w.className&&(l+=" "+w.className),w.css&&(s=(s?s+";":"")+w.css),w.startStyle&&T.from==f&&(u+=" "+w.startStyle),w.endStyle&&T.to==v&&(b||(b=[])).push(w.endStyle,T.to),w.title&&((p||(p={})).title=w.title),w.attributes)for(var C in w.attributes)(p||(p={}))[C]=w.attributes[C];w.collapsed&&(!d||Rn(d.marker,w)<0)&&(d=T)}else T.from>f&&v>T.from&&(v=T.from)}if(b)for(var x=0;x=h)break;for(var L=Math.min(h,v);;){if(g){var O=f+g.length;if(!d){var I=O>L?g.slice(0,L-f):g;n.addToken(n,I,a?a+l:l,u,f+I.length==v?c:"",s,p)}if(O>=L){g=g.slice(L-f),f=L;break}f=O,u=""}g=o.slice(i,i=t[m++]),a=Jn(t[m++],n.cm.options)}}else for(var A=1;At)return{map:e.measure.maps[o],cache:e.measure.caches[o],before:!0}}function Nt(e,n,t,r){return Rt(e,_t(e,n),t,r)}function Et(e,n){if(n>=e.display.viewFrom&&n=t.lineN&&n2&&i.push((l.bottom+c.top)/2-t.top)}}i.push(t.bottom-t.top)}}(e,n.view,n.rect),n.hasHeights=!0),(i=function(e,n,t,r){var o,i=Ht(n.map,t,r),l=i.node,c=i.start,u=i.end,d=i.collapse;if(3==l.nodeType){for(var p=0;p<4;p++){for(;c&&oe(n.line.text.charAt(i.coverStart+c));)--c;for(;i.coverStart+u1}(e))return n;var t=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:n.left*t,right:n.right*t,top:n.top*r,bottom:n.bottom*r}}(e.display.measure,o))}else{var h;c>0&&(d=r="right"),o=e.options.lineWrapping&&(h=l.getClientRects()).length>1?h["right"==r?h.length-1:0]:l.getBoundingClientRect()}if(a&&s<9&&!c&&(!o||!o.left&&!o.right)){var f=l.parentNode.getClientRects()[0];o=f?{left:f.left,right:f.left+ir(e.display),top:f.top,bottom:f.bottom}:Bt}for(var m=o.top-n.rect.top,g=o.bottom-n.rect.top,v=(m+g)/2,y=n.view.measure.heights,b=0;bn)&&(o=(i=l-s)-1,n>=l&&(a="right")),null!=o){if(r=e[c+2],s==l&&t==(r.insertLeft?"left":"right")&&(a=t),"left"==t&&0==o)for(;c&&e[c-2]==e[c-3]&&e[c-1].insertLeft;)r=e[2+(c-=3)],a="left";if("right"==t&&o==l-s)for(;c=0&&(t=e[o]).left==t.right;o--);return t}function Dt(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var n=0;n=r.text.length?(l=r.text.length,c="before"):l<=0&&(l=0,c="after"),!s)return a("before"==c?l-1:l,"before"==c);function u(e,n,t){return a(t?e-1:e,1==s[n].level!=t)}var d=le(s,l,c),p=se,h=u(l,d,"before"==c);return null!=p&&(h.other=u(l,p,"before"!=c)),h}function Xt(e,n){var t=0;n=cn(e.doc,n),e.options.lineWrapping||(t=ir(e.display)*n.ch);var r=Ve(e.doc,n.line),o=qn(r)+xt(e.display);return{left:t,right:t,top:o,bottom:o+r.height}}function Qt(e,n,t,r,o){var i=nn(e,n,t);return i.xRel=o,r&&(i.outside=r),i}function $t(e,n,t){var r=e.doc;if((t+=e.display.viewOffset)<0)return Qt(r.first,0,null,-1,-1);var o=Je(r,t),i=r.first+r.size-1;if(o>i)return Qt(r.first+r.size-1,Ve(r,i).text.length,null,1,1);n<0&&(n=0);for(var a=Ve(r,o);;){var s=nr(e,a,o,n,t),l=Wn(a,s.ch+(s.xRel>0||s.outside>0?1:0));if(!l)return s;var c=l.find(1);if(c.line==o)return c;a=Ve(r,o=c.line)}}function Jt(e,n,t,r){r-=Gt(n);var o=n.text.length,i=ae(function(n){return Rt(e,t,n-1).bottom<=r},o,0);return{begin:i,end:o=ae(function(n){return Rt(e,t,n).top>r},i,o)}}function Zt(e,n,t,r){return t||(t=_t(e,n)),Jt(e,n,t,qt(e,n,Rt(e,t,r),"line").top)}function er(e,n,t,r){return!(e.bottom<=t)&&(e.top>t||(r?e.left:e.right)>n)}function nr(e,n,t,r,o){o-=qn(n);var i=_t(e,n),a=Gt(n),s=0,l=n.text.length,c=!0,u=ue(n,e.doc.direction);if(u){var d=(e.options.lineWrapping?rr:tr)(e,n,t,i,u,r,o);s=(c=1!=d.level)?d.from:d.to-1,l=c?d.to:d.from-1}var p,h,f=null,m=null,g=ae(function(n){var t=Rt(e,i,n);return t.top+=a,t.bottom+=a,!!er(t,r,o,!1)&&(t.top<=o&&t.left<=r&&(f=n,m=t),!0)},s,l),v=!1;if(m){var y=r-m.left=k.bottom?1:0}return Qt(t,g=ie(n.text,g,1),h,v,r-p)}function tr(e,n,t,r,o,i,a){var s=ae(function(s){var l=o[s],c=1!=l.level;return er(Yt(e,nn(t,c?l.to:l.from,c?"before":"after"),"line",n,r),i,a,!0)},0,o.length-1),l=o[s];if(s>0){var c=1!=l.level,u=Yt(e,nn(t,c?l.from:l.to,c?"after":"before"),"line",n,r);er(u,i,a,!0)&&u.top>a&&(l=o[s-1])}return l}function rr(e,n,t,r,o,i,a){var s=Jt(e,n,r,a),l=s.begin,c=s.end;/\s/.test(n.text.charAt(c-1))&&c--;for(var u=null,d=null,p=0;p=c||h.to<=l)){var f=Rt(e,r,1!=h.level?Math.min(c,h.to)-1:Math.max(l,h.from)).right,m=fm)&&(u=h,d=m)}}return u||(u=o[o.length-1]),u.fromc&&(u={from:u.from,to:c,level:u.level}),u}function or(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Pt){Pt=A("pre",null,"CodeMirror-line-like");for(var n=0;n<49;++n)Pt.appendChild(document.createTextNode("x")),Pt.appendChild(A("br"));Pt.appendChild(document.createTextNode("x"))}I(e.measure,Pt);var t=Pt.offsetHeight/50;return t>3&&(e.cachedTextHeight=t),O(e.measure),t||1}function ir(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var n=A("span","xxxxxxxxxx"),t=A("pre",[n],"CodeMirror-line-like");I(e.measure,t);var r=n.getBoundingClientRect(),o=(r.right-r.left)/10;return o>2&&(e.cachedCharWidth=o),o||10}function ar(e){for(var n=e.display,t={},r={},o=n.gutters.clientLeft,i=n.gutters.firstChild,a=0;i;i=i.nextSibling,++a){var s=e.display.gutterSpecs[a].className;t[s]=i.offsetLeft+i.clientLeft+o,r[s]=i.clientWidth}return{fixedPos:sr(n),gutterTotalWidth:n.gutters.offsetWidth,gutterLeft:t,gutterWidth:r,wrapperWidth:n.wrapper.clientWidth}}function sr(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function lr(e){var n=or(e.display),t=e.options.lineWrapping,r=t&&Math.max(5,e.display.scroller.clientWidth/ir(e.display)-3);return function(o){if(zn(e.doc,o))return 0;var i=0;if(o.widgets)for(var a=0;a=e.display.viewTo)return null;if((n-=e.display.viewFrom)<0)return null;for(var t=e.display.view,r=0;rn)&&(o.updateLineNumbers=n),e.curOp.viewChanged=!0,n>=o.viewTo)xn&&Un(e.doc,n)o.viewFrom?fr(e):(o.viewFrom+=r,o.viewTo+=r);else if(n<=o.viewFrom&&t>=o.viewTo)fr(e);else if(n<=o.viewFrom){var i=mr(e,t,t+r,1);i?(o.view=o.view.slice(i.index),o.viewFrom=i.lineN,o.viewTo+=r):fr(e)}else if(t>=o.viewTo){var a=mr(e,n,n,-1);a?(o.view=o.view.slice(0,a.index),o.viewTo=a.lineN):fr(e)}else{var s=mr(e,n,n,-1),l=mr(e,t,t+r,1);s&&l?(o.view=o.view.slice(0,s.index).concat(at(e,s.lineN,l.lineN)).concat(o.view.slice(l.index)),o.viewTo+=r):fr(e)}var c=o.externalMeasured;c&&(t=o.lineN&&n=r.viewTo)){var i=r.view[dr(e,n)];if(null!=i.node){var a=i.changes||(i.changes=[]);-1==F(a,t)&&a.push(t)}}}function fr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function mr(e,n,t,r){var o,i=dr(e,n),a=e.display.view;if(!xn||t==e.doc.first+e.doc.size)return{index:i,lineN:t};for(var s=e.display.viewFrom,l=0;l0){if(i==a.length-1)return null;o=s+a[i].size-n,i++}else o=s-n;n+=o,t+=o}for(;Un(e.doc,t)!=t;){if(i==(r<0?0:a.length-1))return null;t+=r*a[i-(r<0?1:0)].size,i+=r}return{index:i,lineN:t}}function gr(e){for(var n=e.display.view,t=0,r=0;r=e.display.viewTo||s.to().linen||n==t&&a.to==n)&&(r(Math.max(a.from,n),Math.min(a.to,t),1==a.level?"rtl":"ltr",i),o=!0)}o||r(n,t,"ltr")}(m,t||0,null==r?p:r,function(e,n,o,d){var g="ltr"==o,v=h(e,g?"left":"right"),y=h(n-1,g?"right":"left"),b=null==t&&0==e,k=null==r&&n==p,T=0==d,w=!m||d==m.length-1;if(y.top-v.top<=3){var C=(c?k:b)&&w,x=(c?b:k)&&T?s:(g?v:y).left,S=C?l:(g?y:v).right;u(x,v.top,S-x,v.bottom)}else{var L,O,I,A;g?(L=c&&b&&T?s:v.left,O=c?l:f(e,o,"before"),I=c?s:f(n,o,"after"),A=c&&k&&w?l:y.right):(L=c?f(e,o,"before"):s,O=!c&&b&&T?l:v.right,I=!c&&k&&w?s:y.left,A=c?f(n,o,"after"):l),u(L,v.top,O-L,v.bottom),v.bottom0?n.blinker=setInterval(function(){return n.cursorDiv.style.visibility=(t=!t)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(n.cursorDiv.style.visibility="hidden")}}function Cr(e){e.state.focused||(e.display.input.focus(),Sr(e))}function xr(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Lr(e))},100)}function Sr(e,n){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(me(e,"focus",e,n),e.state.focused=!0,_(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),l&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),wr(e))}function Lr(e,n){e.state.delayingBlurEvent||(e.state.focused&&(me(e,"blur",e,n),e.state.focused=!1,L(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function Or(e){for(var n=e.display,t=n.lineDiv.offsetTop,r=0;r.005||p<-.005)&&(Qe(o.line,l),Ir(o.line),o.rest))for(var h=0;he.display.sizerWidth){var f=Math.ceil(c/ir(e.display));f>e.display.maxLineLength&&(e.display.maxLineLength=f,e.display.maxLine=o.line,e.display.maxLineChanged=!0)}}}}function Ir(e){if(e.widgets)for(var n=0;n=a&&(i=Je(n,qn(Ve(n,l))-e.wrapper.clientHeight),a=l)}return{from:i,to:Math.max(a,i+1)}}function Mr(e,n){var t=e.display,r=or(e.display);n.top<0&&(n.top=0);var o=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:t.scroller.scrollTop,i=At(e),a={};n.bottom-n.top>i&&(n.bottom=n.top+i);var s=e.doc.height+St(t),l=n.tops-r;if(n.topo+i){var u=Math.min(n.top,(c?s:n.bottom)-i);u!=o&&(a.scrollTop=u)}var d=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:t.scroller.scrollLeft,p=It(e)-(e.options.fixedGutter?t.gutters.offsetWidth:0),h=n.right-n.left>p;return h&&(n.right=n.left+p),n.left<10?a.scrollLeft=0:n.leftp+d-3&&(a.scrollLeft=n.right+(h?0:10)-p),a}function Nr(e,n){null!=n&&(Rr(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+n)}function Er(e){Rr(e);var n=e.getCursor();e.curOp.scrollToPos={from:n,to:n,margin:e.options.cursorScrollMargin}}function _r(e,n,t){null==n&&null==t||Rr(e),null!=n&&(e.curOp.scrollLeft=n),null!=t&&(e.curOp.scrollTop=t)}function Rr(e){var n=e.curOp.scrollToPos;n&&(e.curOp.scrollToPos=null,Pr(e,Xt(e,n.from),Xt(e,n.to),n.margin))}function Pr(e,n,t,r){var o=Mr(e,{left:Math.min(n.left,t.left),top:Math.min(n.top,t.top)-r,right:Math.max(n.right,t.right),bottom:Math.max(n.bottom,t.bottom)+r});_r(e,o.scrollLeft,o.scrollTop)}function Br(e,n){Math.abs(e.doc.scrollTop-n)<2||(t||lo(e,{top:n}),Hr(e,n,!0),t&&lo(e),ro(e,100))}function Hr(e,n,t){n=Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,n),(e.display.scroller.scrollTop!=n||t)&&(e.doc.scrollTop=n,e.display.scrollbars.setScrollTop(n),e.display.scroller.scrollTop!=n&&(e.display.scroller.scrollTop=n))}function Wr(e,n,t,r){n=Math.min(n,e.display.scroller.scrollWidth-e.display.scroller.clientWidth),(t?n==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-n)<2)&&!r||(e.doc.scrollLeft=n,po(e),e.display.scroller.scrollLeft!=n&&(e.display.scroller.scrollLeft=n),e.display.scrollbars.setScrollLeft(n))}function Dr(e){var n=e.display,t=n.gutters.offsetWidth,r=Math.round(e.doc.height+St(e.display));return{clientHeight:n.scroller.clientHeight,viewHeight:n.wrapper.clientHeight,scrollWidth:n.scroller.scrollWidth,clientWidth:n.scroller.clientWidth,viewWidth:n.wrapper.clientWidth,barLeft:e.options.fixedGutter?t:0,docHeight:r,scrollHeight:r+Ot(e)+n.barHeight,nativeBarWidth:n.nativeBarWidth,gutterWidth:t}}var Fr=function(e,n,t){this.cm=t;var r=this.vert=A("div",[A("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),o=this.horiz=A("div",[A("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=o.tabIndex=-1,e(r),e(o),pe(r,"scroll",function(){r.clientHeight&&n(r.scrollTop,"vertical")}),pe(o,"scroll",function(){o.clientWidth&&n(o.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,a&&s<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Fr.prototype.update=function(e){var n=e.scrollWidth>e.clientWidth+1,t=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(t){this.vert.style.display="block",this.vert.style.bottom=n?r+"px":"0";var o=e.viewHeight-(n?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+o)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(n){this.horiz.style.display="block",this.horiz.style.right=t?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var i=e.viewWidth-e.barLeft-(t?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+i)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(0==r&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:t?r:0,bottom:n?r:0}},Fr.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Fr.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Fr.prototype.zeroWidthHack=function(){var e=y&&!h?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new D,this.disableVert=new D},Fr.prototype.enableZeroWidthBar=function(e,n,t){e.style.pointerEvents="auto",n.set(1e3,function r(){var o=e.getBoundingClientRect();("vert"==t?document.elementFromPoint(o.right-1,(o.top+o.bottom)/2):document.elementFromPoint((o.right+o.left)/2,o.bottom-1))!=e?e.style.pointerEvents="none":n.set(1e3,r)})},Fr.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Ur=function(){};function jr(e,n){n||(n=Dr(e));var t=e.display.barWidth,r=e.display.barHeight;zr(e,n);for(var o=0;o<4&&t!=e.display.barWidth||r!=e.display.barHeight;o++)t!=e.display.barWidth&&e.options.lineWrapping&&Or(e),zr(e,Dr(e)),t=e.display.barWidth,r=e.display.barHeight}function zr(e,n){var t=e.display,r=t.scrollbars.update(n);t.sizer.style.paddingRight=(t.barWidth=r.right)+"px",t.sizer.style.paddingBottom=(t.barHeight=r.bottom)+"px",t.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(t.scrollbarFiller.style.display="block",t.scrollbarFiller.style.height=r.bottom+"px",t.scrollbarFiller.style.width=r.right+"px"):t.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(t.gutterFiller.style.display="block",t.gutterFiller.style.height=r.bottom+"px",t.gutterFiller.style.width=n.gutterWidth+"px"):t.gutterFiller.style.display=""}Ur.prototype.update=function(){return{bottom:0,right:0}},Ur.prototype.setScrollLeft=function(){},Ur.prototype.setScrollTop=function(){},Ur.prototype.clear=function(){};var Gr={native:Fr,null:Ur};function qr(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&L(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Gr[e.options.scrollbarStyle](function(n){e.display.wrapper.insertBefore(n,e.display.scrollbarFiller),pe(n,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),n.setAttribute("cm-not-content","true")},function(n,t){"horizontal"==t?Wr(e,n):Br(e,n)},e),e.display.scrollbars.addClass&&_(e.display.wrapper,e.display.scrollbars.addClass)}var Kr=0;function Vr(e){var n;e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Kr},n=e.curOp,st?st.ops.push(n):n.ownsGroup=st={ops:[n],delayedCallbacks:[]}}function Yr(e){var n=e.curOp;n&&function(e,n){var t=e.ownsGroup;if(t)try{!function(e){var n=e.delayedCallbacks,t=0;do{for(;t=t.viewTo)||t.maxLineChanged&&n.options.lineWrapping,e.update=e.mustUpdate&&new io(n,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Qr(e){var n=e.cm,t=n.display;e.updatedDisplay&&Or(n),e.barMeasure=Dr(n),t.maxLineChanged&&!n.options.lineWrapping&&(e.adjustWidthTo=Nt(n,t.maxLine,t.maxLine.text.length).left+3,n.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(t.scroller.clientWidth,t.sizer.offsetLeft+e.adjustWidthTo+Ot(n)+n.display.barWidth),e.maxScrollLeft=Math.max(0,t.sizer.offsetLeft+e.adjustWidthTo-It(n))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=t.input.prepareSelection())}function $r(e){var n=e.cm;null!=e.adjustWidthTo&&(n.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft(window.innerHeight||document.documentElement.clientHeight)&&(o=!1),null!=o&&!f){var i=A("div","",null,"position: absolute;\n top: "+(n.top-t.viewOffset-xt(e.display))+"px;\n height: "+(n.bottom-n.top+Ot(e)+t.barHeight)+"px;\n left: "+n.left+"px; width: "+Math.max(2,n.right-n.left)+"px;");e.display.lineSpace.appendChild(i),i.scrollIntoView(o),e.display.lineSpace.removeChild(i)}}}(n,function(e,n,t,r){var o;null==r&&(r=0),e.options.lineWrapping||n!=t||(t="before"==(n=n.ch?nn(n.line,"before"==n.sticky?n.ch-1:n.ch,"after"):n).sticky?nn(n.line,n.ch+1,"before"):n);for(var i=0;i<5;i++){var a=!1,s=Yt(e,n),l=t&&t!=n?Yt(e,t):s,c=Mr(e,o={left:Math.min(s.left,l.left),top:Math.min(s.top,l.top)-r,right:Math.max(s.left,l.left),bottom:Math.max(s.bottom,l.bottom)+r}),u=e.doc.scrollTop,d=e.doc.scrollLeft;if(null!=c.scrollTop&&(Br(e,c.scrollTop),Math.abs(e.doc.scrollTop-u)>1&&(a=!0)),null!=c.scrollLeft&&(Wr(e,c.scrollLeft),Math.abs(e.doc.scrollLeft-d)>1&&(a=!0)),!a)break}return o}(n,cn(r,e.scrollToPos.from),cn(r,e.scrollToPos.to),e.scrollToPos.margin));var o=e.maybeHiddenMarkers,i=e.maybeUnhiddenMarkers;if(o)for(var a=0;a=e.display.viewTo)){var t=+new Date+e.options.workTime,r=mn(e,n.highlightFrontier),o=[];n.iter(r.line,Math.min(n.first+n.size,e.display.viewTo+500),function(i){if(r.line>=e.display.viewFrom){var a=i.styles,s=i.text.length>e.options.maxHighlightLength?ze(n.mode,r.state):null,l=hn(e,i,r,!0);s&&(r.state=s),i.styles=l.styles;var c=i.styleClasses,u=l.classes;u?i.styleClasses=u:c&&(i.styleClasses=null);for(var d=!a||a.length!=i.styles.length||c!=u&&(!c||!u||c.bgClass!=u.bgClass||c.textClass!=u.textClass),p=0;!d&&pt)return ro(e,e.options.workDelay),!0}),n.highlightFrontier=r.line,n.modeFrontier=Math.max(n.modeFrontier,r.line),o.length&&Zr(e,function(){for(var n=0;n=t.viewFrom&&n.visible.to<=t.viewTo&&(null==t.updateLineNumbers||t.updateLineNumbers>=t.viewTo)&&t.renderedView==t.view&&0==gr(e))return!1;ho(e)&&(fr(e),n.dims=ar(e));var o=r.first+r.size,i=Math.max(n.visible.from-e.options.viewportMargin,r.first),a=Math.min(o,n.visible.to+e.options.viewportMargin);t.viewFroma&&t.viewTo-a<20&&(a=Math.min(o,t.viewTo)),xn&&(i=Un(e.doc,i),a=jn(e.doc,a));var s=i!=t.viewFrom||a!=t.viewTo||t.lastWrapHeight!=n.wrapperHeight||t.lastWrapWidth!=n.wrapperWidth;!function(e,n,t){var r=e.display;0==r.view.length||n>=r.viewTo||t<=r.viewFrom?(r.view=at(e,n,t),r.viewFrom=n):(r.viewFrom>n?r.view=at(e,n,r.viewFrom).concat(r.view):r.viewFromt&&(r.view=r.view.slice(0,dr(e,t)))),r.viewTo=t}(e,i,a),t.viewOffset=qn(Ve(e.doc,t.viewFrom)),e.display.mover.style.top=t.viewOffset+"px";var c=gr(e);if(!s&&0==c&&!n.force&&t.renderedView==t.view&&(null==t.updateLineNumbers||t.updateLineNumbers>=t.viewTo))return!1;var u=function(e){if(e.hasFocus())return null;var n=E();if(!n||!N(e.display.lineDiv,n))return null;var t={activeElt:n};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&N(e.display.lineDiv,r.anchorNode)&&(t.anchorNode=r.anchorNode,t.anchorOffset=r.anchorOffset,t.focusNode=r.focusNode,t.focusOffset=r.focusOffset)}return t}(e);return c>4&&(t.lineDiv.style.display="none"),function(e,n,t){var r=e.display,o=e.options.lineNumbers,i=r.lineDiv,a=i.firstChild;function s(n){var t=n.nextSibling;return l&&y&&e.display.currentWheelTarget==n?n.style.display="none":n.parentNode.removeChild(n),t}for(var c=r.view,u=r.viewFrom,d=0;d-1&&(h=!1),dt(e,p,u,t)),h&&(O(p.lineNumber),p.lineNumber.appendChild(document.createTextNode(en(e.options,u)))),a=p.node.nextSibling}else{var f=yt(e,p,u,t);i.insertBefore(f,a)}u+=p.size}for(;a;)a=s(a)}(e,t.updateLineNumbers,n.dims),c>4&&(t.lineDiv.style.display=""),t.renderedView=t.view,function(e){if(e&&e.activeElt&&e.activeElt!=E()&&(e.activeElt.focus(),e.anchorNode&&N(document.body,e.anchorNode)&&N(document.body,e.focusNode))){var n=window.getSelection(),t=document.createRange();t.setEnd(e.anchorNode,e.anchorOffset),t.collapse(!1),n.removeAllRanges(),n.addRange(t),n.extend(e.focusNode,e.focusOffset)}}(u),O(t.cursorDiv),O(t.selectionDiv),t.gutters.style.height=t.sizer.style.minHeight=0,s&&(t.lastWrapHeight=n.wrapperHeight,t.lastWrapWidth=n.wrapperWidth,ro(e,400)),t.updateLineNumbers=null,!0}function so(e,n){for(var t=n.viewport,r=!0;(r&&e.options.lineWrapping&&n.oldDisplayWidth!=It(e)||(t&&null!=t.top&&(t={top:Math.min(e.doc.height+St(e.display)-At(e),t.top)}),n.visible=Ar(e.display,e.doc,t),!(n.visible.from>=e.display.viewFrom&&n.visible.to<=e.display.viewTo)))&&ao(e,n);r=!1){Or(e);var o=Dr(e);vr(e),jr(e,o),uo(e,o),n.force=!1}n.signal(e,"update",e),e.display.viewFrom==e.display.reportedViewFrom&&e.display.viewTo==e.display.reportedViewTo||(n.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function lo(e,n){var t=new io(e,n);if(ao(e,t)){Or(e),so(e,t);var r=Dr(e);vr(e),jr(e,r),uo(e,r),t.finish()}}function co(e){var n=e.gutters.offsetWidth;e.sizer.style.marginLeft=n+"px"}function uo(e,n){e.display.sizer.style.minHeight=n.docHeight+"px",e.display.heightForcer.style.top=n.docHeight+"px",e.display.gutters.style.height=n.docHeight+e.display.barHeight+Ot(e)+"px"}function po(e){var n=e.display,t=n.view;if(n.alignWidgets||n.gutters.firstChild&&e.options.fixedGutter){for(var r=sr(n)-n.scroller.scrollLeft+e.doc.scrollLeft,o=n.gutters.offsetWidth,i=r+"px",a=0;as.clientWidth,u=s.scrollHeight>s.clientHeight;if(o&&c||i&&u){if(i&&y&&l)e:for(var p=n.target,h=a.view;p!=s;p=p.parentNode)for(var f=0;f=0&&tn(e,r.to())<=0)return t}return-1};var xo=function(e,n){this.anchor=e,this.head=n};function So(e,n,t){var r=e&&e.options.selectionsMayTouch,o=n[t];n.sort(function(e,n){return tn(e.from(),n.from())}),t=F(n,o);for(var i=1;i0:l>=0){var c=sn(s.from(),a.from()),u=an(s.to(),a.to()),d=s.empty()?a.from()==a.head:s.from()==s.head;i<=t&&--t,n.splice(--i,2,new xo(d?u:c,d?c:u))}}return new Co(n,t)}function Lo(e,n){return new Co([new xo(e,n||e)],0)}function Oo(e){return e.text?nn(e.from.line+e.text.length-1,X(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function Io(e,n){if(tn(e,n.from)<0)return e;if(tn(e,n.to)<=0)return Oo(n);var t=e.line+n.text.length-(n.to.line-n.from.line)-1,r=e.ch;return e.line==n.to.line&&(r+=Oo(n).ch-n.to.ch),nn(t,r)}function Ao(e,n){for(var t=[],r=0;r1&&e.remove(s.line+1,f-1),e.insert(s.line+1,v)}ct(e,"change",e,n)}function Po(e,n,t){!function e(r,o,i){if(r.linked)for(var a=0;as-(e.cm?e.cm.options.historyEventDelay:500)||"*"==n.origin.charAt(0)))&&(i=function(e,n){return n?(Fo(e.done),X(e.done)):e.done.length&&!X(e.done).ranges?X(e.done):e.done.length>1&&!e.done[e.done.length-2].ranges?(e.done.pop(),X(e.done)):void 0}(o,o.lastOp==r)))a=X(i.changes),0==tn(n.from,n.to)&&0==tn(n.from,a.to)?a.to=Oo(n):i.changes.push(Do(e,n));else{var l=X(o.done);for(l&&l.ranges||zo(e.sel,o.done),i={changes:[Do(e,n)],generation:o.generation},o.done.push(i);o.done.length>o.undoDepth;)o.done.shift(),o.done[0].ranges||o.done.shift()}o.done.push(t),o.generation=++o.maxGeneration,o.lastModTime=o.lastSelTime=s,o.lastOp=o.lastSelOp=r,o.lastOrigin=o.lastSelOrigin=n.origin,a||me(e,"historyAdded")}function jo(e,n,t,r){var o=e.history,i=r&&r.origin;t==o.lastSelOp||i&&o.lastSelOrigin==i&&(o.lastModTime==o.lastSelTime&&o.lastOrigin==i||function(e,n,t,r){var o=n.charAt(0);return"*"==o||"+"==o&&t.ranges.length==r.ranges.length&&t.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}(e,i,X(o.done),n))?o.done[o.done.length-1]=n:zo(n,o.done),o.lastSelTime=+new Date,o.lastSelOrigin=i,o.lastSelOp=t,r&&!1!==r.clearRedo&&Fo(o.undone)}function zo(e,n){var t=X(n);t&&t.ranges&&t.equals(e)||n.push(e)}function Go(e,n,t,r){var o=n["spans_"+e.id],i=0;e.iter(Math.max(e.first,t),Math.min(e.first+e.size,r),function(t){t.markedSpans&&((o||(o=n["spans_"+e.id]={}))[i]=t.markedSpans),++i})}function qo(e){if(!e)return null;for(var n,t=0;t-1&&(X(s)[d]=c[d],delete c[d])}}}return r}function Yo(e,n,t,r){if(r){var o=e.anchor;if(t){var i=tn(n,o)<0;i!=tn(t,o)<0?(o=n,n=t):i!=tn(n,t)<0&&(n=t)}return new xo(o,n)}return new xo(t||n,n)}function Xo(e,n,t,r,o){null==o&&(o=e.cm&&(e.cm.display.shift||e.extend)),ei(e,new Co([Yo(e.sel.primary(),n,t,o)],0),r)}function Qo(e,n,t){for(var r=[],o=e.cm&&(e.cm.display.shift||e.extend),i=0;i=n.ch:s.to>n.ch))){if(o&&(me(l,"beforeCursorEnter"),l.explicitlyCleared)){if(i.markedSpans){--a;continue}break}if(!l.atomic)continue;if(t){var d=l.find(r<0?1:-1),p=void 0;if((r<0?u:c)&&(d=si(e,d,-r,d&&d.line==n.line?i:null)),d&&d.line==n.line&&(p=tn(d,t))&&(r<0?p<0:p>0))return ii(e,d,n,r,o)}var h=l.find(r<0?-1:1);return(r<0?c:u)&&(h=si(e,h,r,h.line==n.line?i:null)),h?ii(e,h,n,r,o):null}}return n}function ai(e,n,t,r,o){var i=r||1,a=ii(e,n,t,i,o)||!o&&ii(e,n,t,i,!0)||ii(e,n,t,-i,o)||!o&&ii(e,n,t,-i,!0);return a||(e.cantEdit=!0,nn(e.first,0))}function si(e,n,t,r){return t<0&&0==n.ch?n.line>e.first?cn(e,nn(n.line-1)):null:t>0&&n.ch==(r||Ve(e,n.line)).text.length?n.line0)){var u=[l,1],d=tn(c.from,s.from),p=tn(c.to,s.to);(d<0||!a.inclusiveLeft&&!d)&&u.push({from:c.from,to:s.from}),(p>0||!a.inclusiveRight&&!p)&&u.push({from:s.to,to:c.to}),o.splice.apply(o,u),l+=u.length-3}}return o}(e,n.from,n.to);if(r)for(var o=r.length-1;o>=0;--o)di(e,{from:r[o].from,to:r[o].to,text:o?[""]:n.text,origin:n.origin});else di(e,n)}}function di(e,n){if(1!=n.text.length||""!=n.text[0]||0!=tn(n.from,n.to)){var t=Ao(e,n);Uo(e,n,t,e.cm?e.cm.curOp.id:NaN),fi(e,n,t,In(e,n));var r=[];Po(e,function(e,t){t||-1!=F(r,e.history)||(yi(e.history,n),r.push(e.history)),fi(e,n,null,In(e,n))})}}function pi(e,n,t){var r=e.cm&&e.cm.state.suppressEdits;if(!r||t){for(var o,i=e.history,a=e.sel,s="undo"==n?i.done:i.undone,l="undo"==n?i.undone:i.done,c=0;c=0;--h){var f=p(h);if(f)return f.v}}}}function hi(e,n){if(0!=n&&(e.first+=n,e.sel=new Co(Q(e.sel.ranges,function(e){return new xo(nn(e.anchor.line+n,e.anchor.ch),nn(e.head.line+n,e.head.ch))}),e.sel.primIndex),e.cm)){pr(e.cm,e.first,e.first-n,n);for(var t=e.cm.display,r=t.viewFrom;re.lastLine())){if(n.from.linei&&(n={from:n.from,to:nn(i,Ve(e,i).text.length),text:[n.text[0]],origin:n.origin}),n.removed=Ye(e,n.from,n.to),t||(t=Ao(e,n)),e.cm?function(e,n,t){var r=e.doc,o=e.display,i=n.from,a=n.to,s=!1,l=i.line;e.options.lineWrapping||(l=$e(Fn(Ve(r,i.line))),r.iter(l,a.line+1,function(e){if(e==o.maxLine)return s=!0,!0})),r.sel.contains(n.from,n.to)>-1&&ve(e),Ro(r,n,t,lr(e)),e.options.lineWrapping||(r.iter(l,i.line+n.text.length,function(e){var n=Kn(e);n>o.maxLineLength&&(o.maxLine=e,o.maxLineLength=n,o.maxLineChanged=!0,s=!1)}),s&&(e.curOp.updateMaxLine=!0)),function(e,n){if(e.modeFrontier=Math.min(e.modeFrontier,n),!(e.highlightFrontiert;r--){var o=Ve(e,r).stateAfter;if(o&&(!(o instanceof dn)||r+o.lookAhead1||!(this.children[0]instanceof ki))){var s=[];this.collapse(s),this.children=[new ki(s)],this.children[0].parent=this}},collapse:function(e){for(var n=0;n50){for(var a=o.lines.length%25+25,s=a;s10);e.parent.maybeSpill()}},iterN:function(e,n,t){for(var r=0;r0||0==a&&!1!==i.clearWhenEmpty)return i;if(i.replacedWith&&(i.collapsed=!0,i.widgetNode=M("span",[i.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||i.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(i.widgetNode.insertLeft=!0)),i.collapsed){if(Dn(e,n.line,n,t,i)||n.line!=t.line&&Dn(e,t.line,n,t,i))throw new Error("Inserting collapsed marker partially overlapping an existing one");xn=!0}i.addToHistory&&Uo(e,{from:n,to:t,origin:"markText"},e.sel,NaN);var s,l=n.line,c=e.cm;if(e.iter(l,t.line+1,function(e){c&&i.collapsed&&!c.options.lineWrapping&&Fn(e)==c.display.maxLine&&(s=!0),i.collapsed&&l!=n.line&&Qe(e,0),function(e,n){e.markedSpans=e.markedSpans?e.markedSpans.concat([n]):[n],n.marker.attachLine(e)}(e,new Sn(i,l==n.line?n.ch:null,l==t.line?t.ch:null)),++l}),i.collapsed&&e.iter(n.line,t.line+1,function(n){zn(e,n)&&Qe(n,0)}),i.clearOnEnter&&pe(i,"beforeCursorEnter",function(){return i.clear()}),i.readOnly&&(Cn=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),i.collapsed&&(i.id=++xi,i.atomic=!0),c){if(s&&(c.curOp.updateMaxLine=!0),i.collapsed)pr(c,n.line,t.line+1);else if(i.className||i.startStyle||i.endStyle||i.css||i.attributes||i.title)for(var u=n.line;u<=t.line;u++)hr(c,u,"text");i.atomic&&ri(c.doc),ct(c,"markerAdded",c,i)}return i}Si.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,n=e&&!e.curOp;if(n&&Vr(e),ye(this,"clear")){var t=this.find();t&&ct(this,"clear",t.from,t.to)}for(var r=null,o=null,i=0;ie.display.maxLineLength&&(e.display.maxLine=c,e.display.maxLineLength=u,e.display.maxLineChanged=!0)}null!=r&&e&&this.collapsed&&pr(e,r,o+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&ri(e.doc)),e&&ct(e,"markerCleared",e,this,r,o),n&&Yr(e),this.parent&&this.parent.clear()}},Si.prototype.find=function(e,n){var t,r;null==e&&"bookmark"==this.type&&(e=1);for(var o=0;o=0;l--)ui(this,r[l]);s?Zo(this,s):this.cm&&Er(this.cm)}),undo:to(function(){pi(this,"undo")}),redo:to(function(){pi(this,"redo")}),undoSelection:to(function(){pi(this,"undo",!0)}),redoSelection:to(function(){pi(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,n=0,t=0,r=0;r=e.ch)&&n.push(o.marker.parent||o.marker)}return n},findMarks:function(e,n,t){e=cn(this,e),n=cn(this,n);var r=[],o=e.line;return this.iter(e.line,n.line+1,function(i){var a=i.markedSpans;if(a)for(var s=0;s=l.to||null==l.from&&o!=e.line||null!=l.from&&o==n.line&&l.from>=n.ch||t&&!t(l.marker)||r.push(l.marker.parent||l.marker)}++o}),r},getAllMarks:function(){var e=[];return this.iter(function(n){var t=n.markedSpans;if(t)for(var r=0;re)return n=e,!0;e-=i,++t}),cn(this,nn(t,n))},indexFromPos:function(e){var n=(e=cn(this,e)).ch;if(e.linen&&(n=e.from),null!=e.to&&e.to-1)return n.state.draggingText(e),void setTimeout(function(){return n.display.input.focus()},20);try{var u=e.dataTransfer.getData("Text");if(u){var d;if(n.state.draggingText&&!n.state.draggingText.copy&&(d=n.listSelections()),ni(n.doc,Lo(t,t)),d)for(var p=0;p=0;n--)mi(e.doc,"",r[n].from,r[n].to,"+delete");Er(e)})}function Ji(e,n,t){var r=ie(e.text,n+t,t);return r<0||r>e.text.length?null:r}function Zi(e,n,t){var r=Ji(e,n.ch,t);return null==r?null:new nn(n.line,r,t<0?"after":"before")}function ea(e,n,t,r,o){if(e){var i=ue(t,n.doc.direction);if(i){var a,s=o<0?X(i):i[0],l=o<0==(1==s.level)?"after":"before";if(s.level>0||"rtl"==n.doc.direction){var c=_t(n,t);a=o<0?t.text.length-1:0;var u=Rt(n,c,a).top;a=ae(function(e){return Rt(n,c,e).top==u},o<0==(1==s.level)?s.from:s.to-1,a),"before"==l&&(a=Ji(t,a,1))}else a=o<0?s.to:s.from;return new nn(r,a,l)}}return new nn(r,o<0?t.text.length:0,o<0?"before":"after")}zi.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},zi.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},zi.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},zi.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},zi.default=y?zi.macDefault:zi.pcDefault;var na={selectAll:li,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),z)},killLine:function(e){return $i(e,function(n){if(n.empty()){var t=Ve(e.doc,n.head.line).text.length;return n.head.ch==t&&n.head.line0)o=new nn(o.line,o.ch+1),e.replaceRange(i.charAt(o.ch-1)+i.charAt(o.ch-2),nn(o.line,o.ch-2),o,"+transpose");else if(o.line>e.doc.first){var a=Ve(e.doc,o.line-1).text;a&&(o=new nn(o.line,1),e.replaceRange(i.charAt(0)+e.doc.lineSeparator()+a.charAt(a.length-1),nn(o.line-1,a.length-1),o,"+transpose"))}t.push(new xo(o,o))}e.setSelections(t)})},newlineAndIndent:function(e){return Zr(e,function(){for(var n=e.listSelections(),t=n.length-1;t>=0;t--)e.replaceRange(e.doc.lineSeparator(),n[t].anchor,n[t].head,"+input");n=e.listSelections();for(var r=0;r-1&&(tn((o=c.ranges[o]).from(),n)<0||n.xRel>0)&&(tn(o.to(),n)>0||n.xRel<0)?function(e,n,t,r){var o=e.display,i=!1,c=eo(e,function(n){l&&(o.scroller.draggable=!1),e.state.draggingText=!1,fe(o.wrapper.ownerDocument,"mouseup",c),fe(o.wrapper.ownerDocument,"mousemove",u),fe(o.scroller,"dragstart",d),fe(o.scroller,"drop",c),i||(ke(n),r.addNew||Xo(e.doc,t,null,null,r.extend),l||a&&9==s?setTimeout(function(){o.wrapper.ownerDocument.body.focus(),o.input.focus()},20):o.input.focus())}),u=function(e){i=i||Math.abs(n.clientX-e.clientX)+Math.abs(n.clientY-e.clientY)>=10},d=function(){return i=!0};l&&(o.scroller.draggable=!0),e.state.draggingText=c,c.copy=!r.moveOnDrag,o.scroller.dragDrop&&o.scroller.dragDrop(),pe(o.wrapper.ownerDocument,"mouseup",c),pe(o.wrapper.ownerDocument,"mousemove",u),pe(o.scroller,"dragstart",d),pe(o.scroller,"drop",c),xr(e),setTimeout(function(){return o.input.focus()},20)}(e,r,n,i):function(e,n,t,r){var o=e.display,i=e.doc;ke(n);var a,s,l=i.sel,c=l.ranges;if(r.addNew&&!r.extend?(s=i.sel.contains(t),a=s>-1?c[s]:new xo(t,t)):(a=i.sel.primary(),s=i.sel.primIndex),"rectangle"==r.unit)r.addNew||(a=new xo(t,t)),t=ur(e,n,!0,!0),s=-1;else{var u=va(e,t,r.unit);a=r.extend?Yo(a,u.anchor,u.head,r.extend):u}r.addNew?-1==s?(s=c.length,ei(i,So(e,c.concat([a]),s),{scroll:!1,origin:"*mouse"})):c.length>1&&c[s].empty()&&"char"==r.unit&&!r.extend?(ei(i,So(e,c.slice(0,s).concat(c.slice(s+1)),0),{scroll:!1,origin:"*mouse"}),l=i.sel):$o(i,s,a,G):(s=0,ei(i,new Co([a],0),G),l=i.sel);var d=t;function p(n){if(0!=tn(d,n))if(d=n,"rectangle"==r.unit){for(var o=[],c=e.options.tabSize,u=W(Ve(i,t.line).text,t.ch,c),p=W(Ve(i,n.line).text,n.ch,c),h=Math.min(u,p),f=Math.max(u,p),m=Math.min(t.line,n.line),g=Math.min(e.lastLine(),Math.max(t.line,n.line));m<=g;m++){var v=Ve(i,m).text,y=K(v,h,c);h==f?o.push(new xo(nn(m,y),nn(m,y))):v.length>y&&o.push(new xo(nn(m,y),nn(m,K(v,f,c))))}o.length||o.push(new xo(t,t)),ei(i,So(e,l.ranges.slice(0,s).concat(o),s),{origin:"*mouse",scroll:!1}),e.scrollIntoView(n)}else{var b,k=a,T=va(e,n,r.unit),w=k.anchor;tn(T.anchor,w)>0?(b=T.head,w=sn(k.from(),T.anchor)):(b=T.anchor,w=an(k.to(),T.head));var C=l.ranges.slice(0);C[s]=function(e,n){var t=n.anchor,r=n.head,o=Ve(e.doc,t.line);if(0==tn(t,r)&&t.sticky==r.sticky)return n;var i=ue(o);if(!i)return n;var a=le(i,t.ch,t.sticky),s=i[a];if(s.from!=t.ch&&s.to!=t.ch)return n;var l,c=a+(s.from==t.ch==(1!=s.level)?0:1);if(0==c||c==i.length)return n;if(r.line!=t.line)l=(r.line-t.line)*("ltr"==e.doc.direction?1:-1)>0;else{var u=le(i,r.ch,r.sticky),d=u-a||(r.ch-t.ch)*(1==s.level?-1:1);l=u==c-1||u==c?d<0:d>0}var p=i[c+(l?-1:0)],h=l==(1==p.level),f=h?p.from:p.to,m=h?"after":"before";return t.ch==f&&t.sticky==m?n:new xo(new nn(t.line,f,m),r)}(e,new xo(cn(i,w),b)),ei(i,So(e,C,s),G)}}var h=o.wrapper.getBoundingClientRect(),f=0;function m(n){e.state.selectingText=!1,f=1/0,n&&(ke(n),o.input.focus()),fe(o.wrapper.ownerDocument,"mousemove",g),fe(o.wrapper.ownerDocument,"mouseup",v),i.history.lastSelOrigin=null}var g=eo(e,function(n){0!==n.buttons&&Se(n)?function n(t){var a=++f,s=ur(e,t,!0,"rectangle"==r.unit);if(s)if(0!=tn(s,d)){e.curOp.focus=E(),p(s);var l=Ar(o,i);(s.line>=l.to||s.lineh.bottom?20:0;c&&setTimeout(eo(e,function(){f==a&&(o.scroller.scrollTop+=c,n(t))}),50)}}(n):m(n)}),v=eo(e,m);e.state.selectingText=v,pe(o.wrapper.ownerDocument,"mousemove",g),pe(o.wrapper.ownerDocument,"mouseup",v)}(e,r,n,i)}(n,r,i,e):xe(e)==t.scroller&&ke(e):2==o?(r&&Xo(n.doc,r),setTimeout(function(){return t.input.focus()},20)):3==o&&(C?n.display.input.onContextMenu(e):xr(n)))}}function va(e,n,t){if("char"==t)return new xo(n,n);if("word"==t)return e.findWordAt(n);if("line"==t)return new xo(nn(n.line,0),cn(e.doc,nn(n.line+1,0)));var r=t(e,n);return new xo(r.from,r.to)}function ya(e,n,t,r){var o,i;if(n.touches)o=n.touches[0].clientX,i=n.touches[0].clientY;else try{o=n.clientX,i=n.clientY}catch(n){return!1}if(o>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&ke(n);var a=e.display,s=a.lineDiv.getBoundingClientRect();if(i>s.bottom||!ye(e,t))return we(n);i-=s.top-a.viewOffset;for(var l=0;l=o)return me(e,t,e,Je(e.doc,i),e.display.gutterSpecs[l].className,n),we(n)}}function ba(e,n){return ya(e,n,"gutterClick",!0)}function ka(e,n){Ct(e.display,n)||function(e,n){return!!ye(e,"gutterContextMenu")&&ya(e,n,"gutterContextMenu",!1)}(e,n)||ge(e,n,"contextmenu")||C||e.display.input.onContextMenu(n)}function Ta(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Ut(e)}ma.prototype.compare=function(e,n,t){return this.time+400>e&&0==tn(n,this.pos)&&t==this.button};var wa={toString:function(){return"CodeMirror.Init"}},Ca={},xa={};function Sa(e,n,t){if(!n!=!(t&&t!=wa)){var r=e.display.dragFunctions,o=n?pe:fe;o(e.display.scroller,"dragstart",r.start),o(e.display.scroller,"dragenter",r.enter),o(e.display.scroller,"dragover",r.over),o(e.display.scroller,"dragleave",r.leave),o(e.display.scroller,"drop",r.drop)}}function La(e){e.options.lineWrapping?(_(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(L(e.display.wrapper,"CodeMirror-wrap"),Vn(e)),cr(e),pr(e),Ut(e),setTimeout(function(){return jr(e)},100)}function Oa(e,n){var t=this;if(!(this instanceof Oa))return new Oa(e,n);this.options=n=n?H(n):{},H(Ca,n,!1);var r=n.value;"string"==typeof r?r=new Ni(r,n.mode,null,n.lineSeparator,n.direction):n.mode&&(r.modeOption=n.mode),this.doc=r;var o=new Oa.inputStyles[n.inputStyle](this),i=this.display=new vo(e,r,o,n);for(var c in i.wrapper.CodeMirror=this,Ta(this),n.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),qr(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new D,keySeq:null,specialChars:null},n.autofocus&&!v&&i.input.focus(),a&&s<11&&setTimeout(function(){return t.display.input.reset(!0)},20),function(e){var n=e.display;pe(n.scroller,"mousedown",eo(e,ga)),pe(n.scroller,"dblclick",a&&s<11?eo(e,function(n){if(!ge(e,n)){var t=ur(e,n);if(t&&!ba(e,n)&&!Ct(e.display,n)){ke(n);var r=e.findWordAt(t);Xo(e.doc,r.anchor,r.head)}}}):function(n){return ge(e,n)||ke(n)}),pe(n.scroller,"contextmenu",function(n){return ka(e,n)});var t,r={end:0};function o(){n.activeTouch&&(t=setTimeout(function(){return n.activeTouch=null},1e3),(r=n.activeTouch).end=+new Date)}function i(e,n){if(null==n.left)return!0;var t=n.left-e.left,r=n.top-e.top;return t*t+r*r>400}pe(n.scroller,"touchstart",function(o){if(!ge(e,o)&&!function(e){if(1!=e.touches.length)return!1;var n=e.touches[0];return n.radiusX<=1&&n.radiusY<=1}(o)&&!ba(e,o)){n.input.ensurePolled(),clearTimeout(t);var i=+new Date;n.activeTouch={start:i,moved:!1,prev:i-r.end<=300?r:null},1==o.touches.length&&(n.activeTouch.left=o.touches[0].pageX,n.activeTouch.top=o.touches[0].pageY)}}),pe(n.scroller,"touchmove",function(){n.activeTouch&&(n.activeTouch.moved=!0)}),pe(n.scroller,"touchend",function(t){var r=n.activeTouch;if(r&&!Ct(n,t)&&null!=r.left&&!r.moved&&new Date-r.start<300){var a,s=e.coordsChar(n.activeTouch,"page");a=!r.prev||i(r,r.prev)?new xo(s,s):!r.prev.prev||i(r,r.prev.prev)?e.findWordAt(s):new xo(nn(s.line,0),cn(e.doc,nn(s.line+1,0))),e.setSelection(a.anchor,a.head),e.focus(),ke(t)}o()}),pe(n.scroller,"touchcancel",o),pe(n.scroller,"scroll",function(){n.scroller.clientHeight&&(Br(e,n.scroller.scrollTop),Wr(e,n.scroller.scrollLeft,!0),me(e,"scroll",e))}),pe(n.scroller,"mousewheel",function(n){return wo(e,n)}),pe(n.scroller,"DOMMouseScroll",function(n){return wo(e,n)}),pe(n.wrapper,"scroll",function(){return n.wrapper.scrollTop=n.wrapper.scrollLeft=0}),n.dragFunctions={enter:function(n){ge(e,n)||Ce(n)},over:function(n){ge(e,n)||(function(e,n){var t=ur(e,n);if(t){var r=document.createDocumentFragment();br(e,t,r),e.display.dragCursor||(e.display.dragCursor=A("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),I(e.display.dragCursor,r)}}(e,n),Ce(n))},start:function(n){return function(e,n){if(a&&(!e.state.draggingText||+new Date-Ei<100))Ce(n);else if(!ge(e,n)&&!Ct(e.display,n)&&(n.dataTransfer.setData("Text",e.getSelection()),n.dataTransfer.effectAllowed="copyMove",n.dataTransfer.setDragImage&&!p)){var t=A("img",null,null,"position: fixed; left: 0; top: 0;");t.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",d&&(t.width=t.height=1,e.display.wrapper.appendChild(t),t._top=t.offsetTop),n.dataTransfer.setDragImage(t,0,0),d&&t.parentNode.removeChild(t)}}(e,n)},drop:eo(e,_i),leave:function(n){ge(e,n)||Ri(e)}};var l=n.input.getField();pe(l,"keyup",function(n){return da.call(e,n)}),pe(l,"keydown",eo(e,ua)),pe(l,"keypress",eo(e,pa)),pe(l,"focus",function(n){return Sr(e,n)}),pe(l,"blur",function(n){return Lr(e,n)})}(this),Hi(),Vr(this),this.curOp.forceUpdate=!0,Bo(this,r),n.autofocus&&!v||this.hasFocus()?setTimeout(B(Sr,this),20):Lr(this),xa)xa.hasOwnProperty(c)&&xa[c](t,n[c],wa);ho(this),n.finishInit&&n.finishInit(this);for(var u=0;u150)){if(!r)return;t="prev"}}else c=0,t="not";"prev"==t?c=n>i.first?W(Ve(i,n-1).text,null,a):0:"add"==t?c=l+e.options.indentUnit:"subtract"==t?c=l-e.options.indentUnit:"number"==typeof t&&(c=l+t),c=Math.max(0,c);var d="",p=0;if(e.options.indentWithTabs)for(var h=Math.floor(c/a);h;--h)p+=a,d+="\t";if(pa,l=Ee(n),c=null;if(s&&r.ranges.length>1)if(Ma&&Ma.text.join("\n")==n){if(r.ranges.length%Ma.text.length==0){c=[];for(var u=0;u=0;p--){var h=r.ranges[p],f=h.from(),m=h.to();h.empty()&&(t&&t>0?f=nn(f.line,f.ch-t):e.state.overwrite&&!s?m=nn(m.line,Math.min(Ve(i,m.line).text.length,m.ch+X(l).length)):s&&Ma&&Ma.lineWise&&Ma.text.join("\n")==n&&(f=m=nn(f.line,0)));var g={from:f,to:m,text:c?c[p%c.length]:l,origin:o||(s?"paste":e.state.cutIncoming>a?"cut":"+input")};ui(e.doc,g),ct(e,"inputRead",e,g)}n&&!s&&Ra(e,n),Er(e),e.curOp.updateInput<2&&(e.curOp.updateInput=d),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function _a(e,n){var t=e.clipboardData&&e.clipboardData.getData("Text");if(t)return e.preventDefault(),n.isReadOnly()||n.options.disableInput||Zr(n,function(){return Ea(n,t,0,null,"paste")}),!0}function Ra(e,n){if(e.options.electricChars&&e.options.smartIndent)for(var t=e.doc.sel,r=t.ranges.length-1;r>=0;r--){var o=t.ranges[r];if(!(o.head.ch>100||r&&t.ranges[r-1].head.line==o.head.line)){var i=e.getModeAt(o.head),a=!1;if(i.electricChars){for(var s=0;s-1){a=Aa(e,o.head.line,"smart");break}}else i.electricInput&&i.electricInput.test(Ve(e.doc,o.head.line).text.slice(0,o.head.ch))&&(a=Aa(e,o.head.line,"smart"));a&&ct(e,"electricInput",e,o.head.line)}}}function Pa(e){for(var n=[],t=[],r=0;r=n.text.length?(t.ch=n.text.length,t.sticky="before"):t.ch<=0&&(t.ch=0,t.sticky="after");var i=le(o,t.ch,t.sticky),a=o[i];if("ltr"==e.doc.direction&&a.level%2==0&&(r>0?a.to>t.ch:a.from=a.from&&p>=u.begin)){var h=d?"before":"after";return new nn(t.line,p,h)}}var f=function(e,n,r){for(var i=function(e,n){return n?new nn(t.line,l(e,1),"before"):new nn(t.line,e,"after")};e>=0&&e0==(1!=a.level),c=s?r.begin:l(r.end,-1);if(a.from<=c&&c0?u.end:l(u.begin,-1);return null==g||r>0&&g==n.text.length||!(m=f(r>0?0:o.length-1,r,c(g)))?null:m}(e.cm,s,n,t):Zi(s,n,t))){if(r||(a=n.line+t)=e.first+e.size||(n=new nn(a,n.ch,n.sticky),!(s=Ve(e,a))))return!1;n=ea(o,e.cm,s,n.line,t)}else n=i;return!0}if("char"==r)l();else if("column"==r)l(!0);else if("word"==r||"group"==r)for(var c=null,u="group"==r,d=e.cm&&e.cm.getHelper(n,"wordChars"),p=!0;!(t<0)||l(!p);p=!1){var h=s.text.charAt(n.ch)||"\n",f=ne(h,d)?"w":u&&"\n"==h?"n":!u||/\s/.test(h)?null:"p";if(!u||p||f||(f="s"),c&&c!=f){t<0&&(t=1,l(),n.sticky="after");break}if(f&&(c=f),t>0&&!l(!p))break}var m=ai(e,n,i,a,!0);return rn(i,m)&&(m.hitSide=!0),m}function Da(e,n,t,r){var o,i,a=e.doc,s=n.left;if("page"==r){var l=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),c=Math.max(l-.5*or(e.display),3);o=(t>0?n.bottom:n.top)+t*c}else"line"==r&&(o=t>0?n.bottom+3:n.top-3);for(;(i=$t(e,s,o)).outside;){if(t<0?o<=0:o>=a.height){i.hitSide=!0;break}o+=5*t}return i}var Fa=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new D,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};function Ua(e,n){var t=Et(e,n.line);if(!t||t.hidden)return null;var r=Ve(e.doc,n.line),o=Mt(t,r,n.line),i=ue(r,e.doc.direction),a="left";i&&(a=le(i,n.ch)%2?"right":"left");var s=Ht(o.map,n.ch,a);return s.offset="right"==s.collapse?s.end:s.start,s}function ja(e,n){return n&&(e.bad=!0),e}function za(e,n,t){var r;if(n==e.display.lineDiv){if(!(r=e.display.lineDiv.childNodes[t]))return ja(e.clipPos(nn(e.display.viewTo-1)),!0);n=null,t=0}else for(r=n;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var o=0;o=n.display.viewTo||i.line=n.display.viewFrom&&Ua(n,o)||{node:l[0].measure.map[2],offset:0},u=i.liner.firstLine()&&(a=nn(a.line-1,Ve(r.doc,a.line-1).length)),s.ch==Ve(r.doc,s.line).text.length&&s.lineo.viewTo-1)return!1;a.line==o.viewFrom||0==(e=dr(r,a.line))?(n=$e(o.view[0].line),t=o.view[0].node):(n=$e(o.view[e].line),t=o.view[e-1].node.nextSibling);var l,c,u=dr(r,s.line);if(u==o.view.length-1?(l=o.viewTo-1,c=o.lineDiv.lastChild):(l=$e(o.view[u+1].line)-1,c=o.view[u+1].node.previousSibling),!t)return!1;for(var d=r.doc.splitLines(function(e,n,t,r,o){var i="",a=!1,s=e.doc.lineSeparator(),l=!1;function c(){a&&(i+=s,l&&(i+=s),a=l=!1)}function u(e){e&&(c(),i+=e)}function d(n){if(1==n.nodeType){var t=n.getAttribute("cm-text");if(t)return void u(t);var i,p=n.getAttribute("cm-marker");if(p){var h=e.findMarks(nn(r,0),nn(o+1,0),(g=+p,function(e){return e.id==g}));return void(h.length&&(i=h[0].find(0))&&u(Ye(e.doc,i.from,i.to).join(s)))}if("false"==n.getAttribute("contenteditable"))return;var f=/^(pre|div|p|li|table|br)$/i.test(n.nodeName);if(!/^br$/i.test(n.nodeName)&&0==n.textContent.length)return;f&&c();for(var m=0;m1&&p.length>1;)if(X(d)==X(p))d.pop(),p.pop(),l--;else{if(d[0]!=p[0])break;d.shift(),p.shift(),n++}for(var h=0,f=0,m=d[0],g=p[0],v=Math.min(m.length,g.length);ha.ch&&y.charCodeAt(y.length-f-1)==b.charCodeAt(b.length-f-1);)h--,f++;d[d.length-1]=y.slice(0,y.length-f).replace(/^\u200b+/,""),d[0]=d[0].slice(h).replace(/\u200b+$/,"");var T=nn(n,h),w=nn(l,p.length?X(p).length-f:0);return d.length>1||d[0]||tn(T,w)?(mi(r.doc,d,T,w,"+input"),!0):void 0},Fa.prototype.ensurePolled=function(){this.forceCompositionEnd()},Fa.prototype.reset=function(){this.forceCompositionEnd()},Fa.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Fa.prototype.readFromDOMSoon=function(){var e=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing){if(!e.composing.done)return;e.composing=null}e.updateFromDOM()},80))},Fa.prototype.updateFromDOM=function(){var e=this;!this.cm.isReadOnly()&&this.pollContent()||Zr(this.cm,function(){return pr(e.cm)})},Fa.prototype.setUneditable=function(e){e.contentEditable="false"},Fa.prototype.onKeyPress=function(e){0==e.charCode||this.composing||(e.preventDefault(),this.cm.isReadOnly()||eo(this.cm,Ea)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},Fa.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)},Fa.prototype.onContextMenu=function(){},Fa.prototype.resetPosition=function(){},Fa.prototype.needsContentAttribute=!0;var qa=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new D,this.hasSelection=!1,this.composing=null};qa.prototype.init=function(e){var n=this,t=this,r=this.cm;this.createField(e);var o=this.textarea;function i(e){if(!ge(r,e)){if(r.somethingSelected())Na({lineWise:!1,text:r.getSelections()});else{if(!r.options.lineWiseCopyCut)return;var n=Pa(r);Na({lineWise:!0,text:n.text}),"cut"==e.type?r.setSelections(n.ranges,null,z):(t.prevInput="",o.value=n.text.join("\n"),P(o))}"cut"==e.type&&(r.state.cutIncoming=+new Date)}}e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),m&&(o.style.width="0px"),pe(o,"input",function(){a&&s>=9&&n.hasSelection&&(n.hasSelection=null),t.poll()}),pe(o,"paste",function(e){ge(r,e)||_a(e,r)||(r.state.pasteIncoming=+new Date,t.fastPoll())}),pe(o,"cut",i),pe(o,"copy",i),pe(e.scroller,"paste",function(n){if(!Ct(e,n)&&!ge(r,n)){if(!o.dispatchEvent)return r.state.pasteIncoming=+new Date,void t.focus();var i=new Event("paste");i.clipboardData=n.clipboardData,o.dispatchEvent(i)}}),pe(e.lineSpace,"selectstart",function(n){Ct(e,n)||ke(n)}),pe(o,"compositionstart",function(){var e=r.getCursor("from");t.composing&&t.composing.range.clear(),t.composing={start:e,range:r.markText(e,r.getCursor("to"),{className:"CodeMirror-composing"})}}),pe(o,"compositionend",function(){t.composing&&(t.poll(),t.composing.range.clear(),t.composing=null)})},qa.prototype.createField=function(e){this.wrapper=Ha(),this.textarea=this.wrapper.firstChild},qa.prototype.prepareSelection=function(){var e=this.cm,n=e.display,t=e.doc,r=yr(e);if(e.options.moveInputWithCursor){var o=Yt(e,t.sel.primary().head,"div"),i=n.wrapper.getBoundingClientRect(),a=n.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(n.wrapper.clientHeight-10,o.top+a.top-i.top)),r.teLeft=Math.max(0,Math.min(n.wrapper.clientWidth-10,o.left+a.left-i.left))}return r},qa.prototype.showSelection=function(e){var n=this.cm.display;I(n.cursorDiv,e.cursors),I(n.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},qa.prototype.reset=function(e){if(!this.contextMenuPending&&!this.composing){var n=this.cm;if(n.somethingSelected()){this.prevInput="";var t=n.getSelection();this.textarea.value=t,n.state.focused&&P(this.textarea),a&&s>=9&&(this.hasSelection=t)}else e||(this.prevInput=this.textarea.value="",a&&s>=9&&(this.hasSelection=null))}},qa.prototype.getField=function(){return this.textarea},qa.prototype.supportsTouch=function(){return!1},qa.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!v||E()!=this.textarea))try{this.textarea.focus()}catch(e){}},qa.prototype.blur=function(){this.textarea.blur()},qa.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},qa.prototype.receivedFocus=function(){this.slowPoll()},qa.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},qa.prototype.fastPoll=function(){var e=!1,n=this;n.pollingFast=!0,n.polling.set(20,function t(){n.poll()||e?(n.pollingFast=!1,n.slowPoll()):(e=!0,n.polling.set(60,t))})},qa.prototype.poll=function(){var e=this,n=this.cm,t=this.textarea,r=this.prevInput;if(this.contextMenuPending||!n.state.focused||_e(t)&&!r&&!this.composing||n.isReadOnly()||n.options.disableInput||n.state.keySeq)return!1;var o=t.value;if(o==r&&!n.somethingSelected())return!1;if(a&&s>=9&&this.hasSelection===o||y&&/[\uf700-\uf7ff]/.test(o))return n.display.input.reset(),!1;if(n.doc.sel==n.display.selForContextMenu){var i=o.charCodeAt(0);if(8203!=i||r||(r=""),8666==i)return this.reset(),this.cm.execCommand("undo")}for(var l=0,c=Math.min(r.length,o.length);l1e3||o.indexOf("\n")>-1?t.value=e.prevInput="":e.prevInput=o,e.composing&&(e.composing.range.clear(),e.composing.range=n.markText(e.composing.start,n.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},qa.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},qa.prototype.onKeyPress=function(){a&&s>=9&&(this.hasSelection=null),this.fastPoll()},qa.prototype.onContextMenu=function(e){var n=this,t=n.cm,r=t.display,o=n.textarea;n.contextMenuPending&&n.contextMenuPending();var i=ur(t,e),c=r.scroller.scrollTop;if(i&&!d){t.options.resetSelectionOnContextMenu&&-1==t.doc.sel.contains(i)&&eo(t,ei)(t.doc,Lo(i),z);var u,p=o.style.cssText,h=n.wrapper.style.cssText,f=n.wrapper.offsetParent.getBoundingClientRect();if(n.wrapper.style.cssText="position: static",o.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(e.clientY-f.top-5)+"px; left: "+(e.clientX-f.left-5)+"px;\n z-index: 1000; background: "+(a?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",l&&(u=window.scrollY),r.input.focus(),l&&window.scrollTo(null,u),r.input.reset(),t.somethingSelected()||(o.value=n.prevInput=" "),n.contextMenuPending=v,r.selForContextMenu=t.doc.sel,clearTimeout(r.detectingSelectAll),a&&s>=9&&g(),C){Ce(e);var m=function(){fe(window,"mouseup",m),setTimeout(v,20)};pe(window,"mouseup",m)}else setTimeout(v,50)}function g(){if(null!=o.selectionStart){var e=t.somethingSelected(),i=""+(e?o.value:"");o.value="⇚",o.value=i,n.prevInput=e?"":"",o.selectionStart=1,o.selectionEnd=i.length,r.selForContextMenu=t.doc.sel}}function v(){if(n.contextMenuPending==v&&(n.contextMenuPending=!1,n.wrapper.style.cssText=h,o.style.cssText=p,a&&s<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=c),null!=o.selectionStart)){(!a||a&&s<9)&&g();var e=0,i=function(){r.selForContextMenu==t.doc.sel&&0==o.selectionStart&&o.selectionEnd>0&&""==n.prevInput?eo(t,li)(t):e++<10?r.detectingSelectAll=setTimeout(i,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(i,200)}}},qa.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e},qa.prototype.setUneditable=function(){},qa.prototype.needsContentAttribute=!1,function(e){var n=e.optionHandlers;function t(t,r,o,i){e.defaults[t]=r,o&&(n[t]=i?function(e,n,t){t!=wa&&o(e,n,t)}:o)}e.defineOption=t,e.Init=wa,t("value","",function(e,n){return e.setValue(n)},!0),t("mode",null,function(e,n){e.doc.modeOption=n,No(e)},!0),t("indentUnit",2,No,!0),t("indentWithTabs",!1),t("smartIndent",!0),t("tabSize",4,function(e){Eo(e),Ut(e),pr(e)},!0),t("lineSeparator",null,function(e,n){if(e.doc.lineSep=n,n){var t=[],r=e.doc.first;e.doc.iter(function(e){for(var o=0;;){var i=e.text.indexOf(n,o);if(-1==i)break;o=i+n.length,t.push(nn(r,i))}r++});for(var o=t.length-1;o>=0;o--)mi(e.doc,n,t[o],nn(t[o].line,t[o].ch+n.length))}}),t("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(e,n,t){e.state.specialChars=new RegExp(n.source+(n.test("\t")?"":"|\t"),"g"),t!=wa&&e.refresh()}),t("specialCharPlaceholder",et,function(e){return e.refresh()},!0),t("electricChars",!0),t("inputStyle",v?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),t("spellcheck",!1,function(e,n){return e.getInputField().spellcheck=n},!0),t("autocorrect",!1,function(e,n){return e.getInputField().autocorrect=n},!0),t("autocapitalize",!1,function(e,n){return e.getInputField().autocapitalize=n},!0),t("rtlMoveVisually",!k),t("wholeLineUpdateBefore",!0),t("theme","default",function(e){Ta(e),go(e)},!0),t("keyMap","default",function(e,n,t){var r=Qi(n),o=t!=wa&&Qi(t);o&&o.detach&&o.detach(e,r),r.attach&&r.attach(e,o||null)}),t("extraKeys",null),t("configureMouse",null),t("lineWrapping",!1,La,!0),t("gutters",[],function(e,n){e.display.gutterSpecs=fo(n,e.options.lineNumbers),go(e)},!0),t("fixedGutter",!0,function(e,n){e.display.gutters.style.left=n?sr(e.display)+"px":"0",e.refresh()},!0),t("coverGutterNextToScrollbar",!1,function(e){return jr(e)},!0),t("scrollbarStyle","native",function(e){qr(e),jr(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),t("lineNumbers",!1,function(e,n){e.display.gutterSpecs=fo(e.options.gutters,n),go(e)},!0),t("firstLineNumber",1,go,!0),t("lineNumberFormatter",function(e){return e},go,!0),t("showCursorWhenSelecting",!1,vr,!0),t("resetSelectionOnContextMenu",!0),t("lineWiseCopyCut",!0),t("pasteLinesPerSelection",!0),t("selectionsMayTouch",!1),t("readOnly",!1,function(e,n){"nocursor"==n&&(Lr(e),e.display.input.blur()),e.display.input.readOnlyChanged(n)}),t("disableInput",!1,function(e,n){n||e.display.input.reset()},!0),t("dragDrop",!0,Sa),t("allowDropFileTypes",null),t("cursorBlinkRate",530),t("cursorScrollMargin",0),t("cursorHeight",1,vr,!0),t("singleCursorHeightPerLine",!0,vr,!0),t("workTime",100),t("workDelay",100),t("flattenSpans",!0,Eo,!0),t("addModeClass",!1,Eo,!0),t("pollInterval",100),t("undoDepth",200,function(e,n){return e.doc.history.undoDepth=n}),t("historyEventDelay",1250),t("viewportMargin",10,function(e){return e.refresh()},!0),t("maxHighlightLength",1e4,Eo,!0),t("moveInputWithCursor",!0,function(e,n){n||e.display.input.resetPosition()}),t("tabindex",null,function(e,n){return e.display.input.getField().tabIndex=n||""}),t("autofocus",null),t("direction","ltr",function(e,n){return e.doc.setDirection(n)},!0),t("phrases",null)}(Oa),function(e){var n=e.optionHandlers,t=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,t){var r=this.options,o=r[e];r[e]==t&&"mode"!=e||(r[e]=t,n.hasOwnProperty(e)&&eo(this,n[e])(this,t,o),me(this,"optionChange",this,e))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,n){this.state.keyMaps[n?"push":"unshift"](Qi(e))},removeKeyMap:function(e){for(var n=this.state.keyMaps,t=0;tt&&(Aa(this,o.head.line,e,!0),t=o.head.line,r==this.doc.sel.primIndex&&Er(this));else{var i=o.from(),a=o.to(),s=Math.max(t,i.line);t=Math.min(this.lastLine(),a.line-(a.ch?0:1))+1;for(var l=s;l0&&$o(this.doc,r,new xo(i,c[r].to()),z)}}}),getTokenAt:function(e,n){return kn(this,e,n)},getLineTokens:function(e,n){return kn(this,nn(e),n,!0)},getTokenTypeAt:function(e){e=cn(this.doc,e);var n,t=fn(this,Ve(this.doc,e.line)),r=0,o=(t.length-1)/2,i=e.ch;if(0==i)n=t[2];else for(;;){var a=r+o>>1;if((a?t[2*a-1]:0)>=i)o=a;else{if(!(t[2*a+1]i&&(e=i,o=!0),r=Ve(this.doc,e)}else r=e;return qt(this,r,{top:0,left:0},n||"page",t||o).top+(o?this.doc.height-qn(r):0)},defaultTextHeight:function(){return or(this.display)},defaultCharWidth:function(){return ir(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,n,t,r,o){var i,a,s,l=this.display,c=(e=Yt(this,cn(this.doc,e))).bottom,u=e.left;if(n.style.position="absolute",n.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(n),l.sizer.appendChild(n),"over"==r)c=e.top;else if("above"==r||"near"==r){var d=Math.max(l.wrapper.clientHeight,this.doc.height),p=Math.max(l.sizer.clientWidth,l.lineSpace.clientWidth);("above"==r||e.bottom+n.offsetHeight>d)&&e.top>n.offsetHeight?c=e.top-n.offsetHeight:e.bottom+n.offsetHeight<=d&&(c=e.bottom),u+n.offsetWidth>p&&(u=p-n.offsetWidth)}n.style.top=c+"px",n.style.left=n.style.right="","right"==o?(u=l.sizer.clientWidth-n.offsetWidth,n.style.right="0px"):("left"==o?u=0:"middle"==o&&(u=(l.sizer.clientWidth-n.offsetWidth)/2),n.style.left=u+"px"),t&&(i=this,a={left:u,top:c,right:u+n.offsetWidth,bottom:c+n.offsetHeight},null!=(s=Mr(i,a)).scrollTop&&Br(i,s.scrollTop),null!=s.scrollLeft&&Wr(i,s.scrollLeft))},triggerOnKeyDown:no(ua),triggerOnKeyPress:no(pa),triggerOnKeyUp:da,triggerOnMouseDown:no(ga),execCommand:function(e){if(na.hasOwnProperty(e))return na[e].call(null,this)},triggerElectric:no(function(e){Ra(this,e)}),findPosH:function(e,n,t,r){var o=1;n<0&&(o=-1,n=-n);for(var i=cn(this.doc,e),a=0;a0&&a(n.charAt(t-1));)--t;for(;r.5)&&cr(this),me(this,"refresh",this)}),swapDoc:no(function(e){var n=this.doc;return n.cm=null,this.state.selectingText&&this.state.selectingText(),Bo(this,e),Ut(this),this.display.input.reset(),_r(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,ct(this,"swapDoc",this,n),n}),phrase:function(e){var n=this.options.phrases;return n&&Object.prototype.hasOwnProperty.call(n,e)?n[e]:e},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},be(e),e.registerHelper=function(n,r,o){t.hasOwnProperty(n)||(t[n]=e[n]={_global:[]}),t[n][r]=o},e.registerGlobalHelper=function(n,r,o,i){e.registerHelper(n,r,i),t[n]._global.push({pred:o,val:i})}}(Oa);var Ka="iter insert remove copy getEditor constructor".split(" ");for(var Va in Ni.prototype)Ni.prototype.hasOwnProperty(Va)&&F(Ka,Va)<0&&(Oa.prototype[Va]=function(e){return function(){return e.apply(this.doc,arguments)}}(Ni.prototype[Va]));return be(Ni),Oa.inputStyles={textarea:qa,contenteditable:Fa},Oa.defineMode=function(e){Oa.defaults.mode||"null"==e||(Oa.defaults.mode=e),We.apply(this,arguments)},Oa.defineMIME=function(e,n){He[e]=n},Oa.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Oa.defineMIME("text/plain","null"),Oa.defineExtension=function(e,n){Oa.prototype[e]=n},Oa.defineDocExtension=function(e,n){Ni.prototype[e]=n},Oa.fromTextArea=function(e,n){if((n=n?H(n):{}).value=e.value,!n.tabindex&&e.tabIndex&&(n.tabindex=e.tabIndex),!n.placeholder&&e.placeholder&&(n.placeholder=e.placeholder),null==n.autofocus){var t=E();n.autofocus=t==e||null!=e.getAttribute("autofocus")&&t==document.body}function r(){e.value=s.getValue()}var o;if(e.form&&(pe(e.form,"submit",r),!n.leaveSubmitMethodAlone)){var i=e.form;o=i.submit;try{var a=i.submit=function(){r(),i.submit=o,i.submit(),i.submit=a}}catch(e){}}n.finishInit=function(n){n.save=r,n.getTextArea=function(){return e},n.toTextArea=function(){n.toTextArea=isNaN,r(),e.parentNode.removeChild(n.getWrapperElement()),e.style.display="",e.form&&(fe(e.form,"submit",r),"function"==typeof e.form.submit&&(e.form.submit=o))}},e.style.display="none";var s=Oa(function(n){return e.parentNode.insertBefore(n,e.nextSibling)},n);return s},function(e){e.off=fe,e.on=pe,e.wheelEventPixels=To,e.Doc=Ni,e.splitLines=Ee,e.countColumn=W,e.findColumn=K,e.isWordChar=ee,e.Pass=j,e.signal=me,e.Line=Yn,e.changeEnd=Oo,e.scrollbarModel=Gr,e.Pos=nn,e.cmpPos=tn,e.modes=Be,e.mimeModes=He,e.resolveMode=De,e.getMode=Fe,e.modeExtensions=Ue,e.extendMode=je,e.copyState=ze,e.startState=qe,e.innerMode=Ge,e.commands=na,e.keyMap=zi,e.keyName=Xi,e.isModifierKey=Vi,e.lookupKey=Ki,e.normalizeKeyMap=qi,e.StringStream=Ke,e.SharedTextMarker=Oi,e.TextMarker=Si,e.LineWidget=wi,e.e_preventDefault=ke,e.e_stopPropagation=Te,e.e_stop=Ce,e.addClass=_,e.contains=N,e.rmClass=L,e.keyNames=Di}(Oa),Oa.version="5.48.4",Oa}()},function(e,n,t){"use strict";var r=this&&this.__spreadArrays||function(){for(var e=0,n=0,t=arguments.length;n=2,c=l?i:t.length;return{lines:t.slice(0,i).map(function(e){return e.replace(r.INDENTED_PATTERN,"")}),countLinesConsumed:c,hasMultipleTrailingBlankLines:l}}},function(e,n,t){"use strict";var r,o=this&&this.__extends||(r=function(e,n){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])})(e,n)},function(e,n){function t(){this.constructor=e}r(e,n),e.prototype=null===n?Object.create(n):(t.prototype=n.prototype,new t)});Object.defineProperty(n,"__esModule",{value:!0}),n.Document=void 0;var i=t(1),a=t(19),s=t(74),l=t(7),c=t(27),u=function(e){function n(t,r){void 0===r&&(r=new n.TableOfContents);var o=e.call(this,t)||this;return o.tableOfContents=r,o}return o(n,e),n.create=function(e){var t=n.TableOfContents.createThenAssociateSectionLinksWithEntries(e),r=new n(e,t);return s.insertFootnoteBlocksAndAssignFootnoteReferenceNumbers(r),r},n}(l.OutlineSyntaxNodeContainer);n.Document=u,function(e){var n=function(){function e(e){void 0===e&&(e=[]),this.entries=e}return e.createThenAssociateSectionLinksWithEntries=function(n){for(var t=e.getEntries(n),r=0;rt?"desc":"asc"},e.prototype.descendantsToIncludeInTableOfContents=function(){return i.concat(this.items.map(function(e){return e.descendantsToIncludeInTableOfContents()}))},e.prototype.inlineDescendants=function(){return i.concat(this.items.map(function(e){return e.inlineDescendants()}))},e.prototype.render=function(e){return e.numberedList(this)},e}();n.NumberedList=s,function(e){var n=function(e){function n(n,t){var r=e.call(this,n)||this;return r.children=n,r.NUMBERED_LIST_ITEM=void 0,r.ordinal=null==t?void 0:t.ordinal,r}return o(n,e),n}(a.OutlineSyntaxNodeContainer);e.Item=n}(s=n.NumberedList||(n.NumberedList={})),n.NumberedList=s},function(e,n,t){"use strict";var r,o=this&&this.__extends||(r=function(e,n){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])})(e,n)},function(e,n){function t(){this.constructor=e}r(e,n),e.prototype=null===n?Object.create(n):(t.prototype=n.prototype,new t)});Object.defineProperty(n,"__esModule",{value:!0}),n.RevealableBlock=void 0;var i=function(e){function n(){var n=null!==e&&e.apply(this,arguments)||this;return n.REVEALABLE_BLOCK=void 0,n}return o(n,e),n.prototype.render=function(e){return e.revealableBlock(this)},n.prototype.descendantsToIncludeInTableOfContents=function(){return[]},n}(t(26).RichOutlineSyntaxNode);n.RevealableBlock=i},function(e,n,t){"use strict";var r,o=this&&this.__extends||(r=function(e,n){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])})(e,n)},function(e,n){function t(){this.constructor=e}r(e,n),e.prototype=null===n?Object.create(n):(t.prototype=n.prototype,new t)});Object.defineProperty(n,"__esModule",{value:!0}),n.RichOutlineSyntaxNode=void 0;var i=function(e){function n(n,t){var r=e.call(this,n)||this;return r.sourceLineNumber=null==t?void 0:t.sourceLineNumber,r}return o(n,e),n}(t(7).OutlineSyntaxNodeContainer);n.RichOutlineSyntaxNode=i},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.SectionLink=void 0;var r=t(39),o=t(13),i=t(37),a=function(){function e(e,n){this.markupSnippetFromSectionTitle=e,this.entry=n}return e.prototype.referenceMostAppropriateTableOfContentsEntry=function(e){if(this.markupSnippetFromSectionTitle)for(var n=0,t=e.entries;n=this.entireText.length},e.prototype.consume=function(e){var n=e.exec(this._remaining);if(!n)return null;var t=n[0],r=n.slice(1),o=this.entireText[this._index+t.length];return this.advance(t.length),{match:t,charAfterMatch:o,captures:r}},e}();n.TextConsumer=r},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.Token=void 0;var r=function(){function e(e,n){this.role=e,this.value=n}return e.prototype.enclosesContentBetweenItselfAnd=function(e){this.correspondingEnclosingToken=e,e.correspondingEnclosingToken=this},e}();n.Token=r},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.tryToParseBlockquote=void 0;var r=t(0),o=t(5),i=t(59),a=t(8),s=t(3);n.tryToParseBlockquote=function(e){for(var n=new s.LineConsumer(e.markupLines),t=[];;){var r=n.consumeLineIfMatches(l);if(!r)break;t.push(r.line.replace(l,""))}if(!t.length)return null;var o=a.getOutlineSyntaxNodes({markupLines:t,sourceLineNumber:e.sourceLineNumber,headingLeveler:e.headingLeveler,settings:e.settings});return{parsedNodes:[new i.Blockquote(o)],countLinesConsumed:n.countLinesConsumed()}};var l=r.patternStartingWith(o.ANY_OPTIONAL_WHITESPACE+">"+r.optional(" "))},function(e,n,t){"use strict";var r,o=this&&this.__extends||(r=function(e,n){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])})(e,n)},function(e,n){function t(){this.constructor=e}r(e,n),e.prototype=null===n?Object.create(n):(t.prototype=n.prototype,new t)});Object.defineProperty(n,"__esModule",{value:!0}),n.Blockquote=void 0;var i=function(e){function n(){var n=null!==e&&e.apply(this,arguments)||this;return n.BLOCKQUOTE=void 0,n}return o(n,e),n.prototype.render=function(e){return e.blockquote(this)},n}(t(26).RichOutlineSyntaxNode);n.Blockquote=i},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.tryToParseBulletedList=void 0;var r=t(0),o=t(5),i=t(20),a=t(17),s=t(8),l=t(3);n.tryToParseBulletedList=function(e){for(var n=new l.LineConsumer(e.markupLines),t=[];!n.done();){var r=[],o=e.sourceLineNumber+n.countLinesConsumed(),u=n.consumeLineIfMatches(c);if(!u)break;r.push(u.line.replace(c,""));var d=a.getIndentedBlock(n.remaining()),p=!1;if(d&&(r.push.apply(r,d.lines),n.advance(d.countLinesConsumed),p=d.hasMultipleTrailingBlankLines),t.push(new i.BulletedList.Item(s.getOutlineSyntaxNodes({markupLines:r,sourceLineNumber:o,headingLeveler:e.headingLeveler,settings:e.settings}))),p)break}return t.length?{parsedNodes:[new i.BulletedList(t)],countLinesConsumed:n.countLinesConsumed()}:null};var c=r.patternStartingWith(r.optional(" ")+r.anyCharFrom("*","-","•")+o.INLINE_WHITESPACE_CHAR)},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.tryToParseCodeBlock=void 0;var r=t(0),o=t(62),i=t(3);n.tryToParseCodeBlock=function(e){var n=new i.LineConsumer(e.markupLines),t=n.consumeLineIfMatches(a);if(!t)return null;for(var r=t.line.trim(),l=[];!n.done();){var c=n.consumeLineIfMatches(a);if(c){var u=c.line.trim();if(u.length===r.length)break;l.push(u)}else l.push(n.consumeLine())}return{parsedNodes:[new o.CodeBlock(l.join(s))],countLinesConsumed:n.countLinesConsumed()}};var a=r.streakOf("`"),s="\n"},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.CodeBlock=void 0;var r=function(){function e(e,n){this.code=e,this.sourceLineNumber=null==n?void 0:n.sourceLineNumber}return e.prototype.descendantsToIncludeInTableOfContents=function(){return[]},e.prototype.inlineDescendants=function(){return[]},e.prototype.render=function(e){return e.codeBlock(this)},e}();n.CodeBlock=r},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.INTEGER=n.tryToParseNumberedList=void 0;var r=t(0),o=t(5),i=t(2),a=t(24),s=t(17),l=t(8),c=t(3);n.tryToParseNumberedList=function(e){for(var n,t=new c.LineConsumer(e.markupLines),r=[];!t.done();){var o=t.countLinesConsumed(),d=t.consumeLineIfMatches(p,{andIf:function(e){return!i.DIVIDER_STREAK_PATTERN.test(e.line)}});if(!d)break;var m=d.captures[0],g=new u({bullet:m,firstLineOfMarkup:d.line.replace(p,""),sourceLineNumber:e.sourceLineNumber+o}),v=s.getIndentedBlock(t.remaining()),y=!1;if(v&&((n=g.markupLines).push.apply(n,v.lines),t.advance(v.countLinesConsumed),y=v.hasMultipleTrailingBlankLines),r.push(g),y)break}if(!function(e){var n=e.length;return n>0&&(n>1||!h.test(e[0].bullet))}(r))return null;var b=r.map(function(n){var t=l.getOutlineSyntaxNodes({markupLines:n.markupLines,sourceLineNumber:n.sourceLineNumber,headingLeveler:e.headingLeveler,settings:e.settings}),r=function(e){var n=f.exec(e.bullet);return n?parseInt(n[0],10):void 0}(n);return new a.NumberedList.Item(t,{ordinal:r})});return{parsedNodes:[new a.NumberedList(b)],countLinesConsumed:t.countLinesConsumed()}};var u=function(e){this.bullet=e.bullet,this.markupLines=[e.firstLineOfMarkup],this.sourceLineNumber=e.sourceLineNumber};n.INTEGER=r.optional(r.escapeForRegex("-"))+r.oneOrMore(o.DIGIT);var d=r.either("#",r.capture(r.either(n.INTEGER,"#")+r.anyCharFrom(".",")"))),p=r.patternStartingWith(r.optional(" ")+d+o.INLINE_WHITESPACE_CHAR),h=r.patternStartingWith(n.INTEGER+"\\."),f=new RegExp(n.INTEGER)},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.tryToParseThematicBreakStreak=void 0;var r=t(2),o=t(34),i=t(3);n.tryToParseThematicBreakStreak=function(e){var n=new i.LineConsumer(e.markupLines);return n.consumeLineIfMatches(r.DIVIDER_STREAK_PATTERN)?{parsedNodes:e.mostRecentSibling instanceof o.ThematicBreak?[]:[new o.ThematicBreak],countLinesConsumed:n.countLinesConsumed()}:null}},function(e,n,t){"use strict";var r,o=this&&this.__extends||(r=function(e,n){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])})(e,n)},function(e,n){function t(){this.constructor=e}r(e,n),e.prototype=null===n?Object.create(n):(t.prototype=n.prototype,new t)});Object.defineProperty(n,"__esModule",{value:!0}),n.InlineDocument=void 0;var i=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return o(n,e),n.prototype.INLINE_DOCUMENT=function(){},n}(t(6).InlineSyntaxNodeContainer);n.InlineDocument=i},function(e,n,t){"use strict";function r(e,n){return e.replace(n,function(e){return o[e]})}Object.defineProperty(n,"__esModule",{value:!0}),n.escapeHtmlAttrValue=n.escapeHtmlContent=void 0,n.escapeHtmlContent=function(e){return r(e,/[&<]/g)},n.escapeHtmlAttrValue=function(e){return r(String(e),/[&"]/g)};var o={"&":"&","<":"<",'"':"""}},function(e,n){e.exports={parsing:{createSourceMap:!0},rendering:{idPrefix:""}}},function(e,n,t){var r=t(69);"string"==typeof r&&(r=[[e.i,r,""]]);var o={insert:"head",singleton:!1};t(71)(r,o);r.locals&&(e.exports=r.locals)},function(e,n,t){(e.exports=t(70)(!1)).push([e.i,'/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:0.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace, monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace, monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}button,[type="button"],[type="reset"],[type="submit"]{-webkit-appearance:button}button::-moz-focus-inner,[type="button"]::-moz-focus-inner,[type="reset"]::-moz-focus-inner,[type="submit"]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type="button"]:-moz-focusring,[type="reset"]:-moz-focusring,[type="submit"]:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:0.35em 0.75em 0.625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type="checkbox"],[type="radio"]{box-sizing:border-box;padding:0}[type="number"]::-webkit-inner-spin-button,[type="number"]::-webkit-outer-spin-button{height:auto}[type="search"]{-webkit-appearance:textfield;outline-offset:-2px}[type="search"]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}#tab-container{align-items:center;display:flex;height:44px}#documentation-container{margin-left:510px;padding:0 15px}#documentation-container #table-of-contents{display:none}#documentation-container #documentation,#documentation-container #table-of-contents{margin:0 auto;max-width:580px;overflow-x:hidden}@media only screen and (min-width: 981px){#editor-container{border-right:1px solid #aaa;position:fixed;left:0;top:0;width:510px}#editor-container .CodeMirror{height:100vh}}@media only screen and (max-width: 980px){#editor-container{display:none}#documentation-container{margin-left:0}}.CodeMirror{font-size:14px;line-height:1.3;font-family:Menlo,Consolas,monospace !important}.CodeMirror .CodeMirror-scroll{-webkit-overflow-scrolling:touch}#tab-container{display:flex;justify-content:center}#tab-container span[role="tab"]{box-shadow:0 1px 3px rgba(0,0,0,0.12),0 1px 2px rgba(0,0,0,0.24);background-color:#c00;border-radius:3px;color:white;cursor:pointer;display:inline-block;font-size:75%;margin:10px 0;padding:7px 12px 5px 12px;text-transform:uppercase;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}#tab-container span[role="tab"]:hover{background:#b00}#tab-container span[role="tab"]:active{background:#a00}#tab-container span[role="tab"][aria-selected="true"]{display:none}#documentation-container{font:1em/1.6 -apple-system,BlinkMacSystemFont,sans-serif}#documentation-container #table-of-contents{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}#documentation-container #table-of-contents h1,#documentation-container #table-of-contents h2,#documentation-container #table-of-contents h3,#documentation-container #table-of-contents h4,#documentation-container #table-of-contents h5,#documentation-container #table-of-contents h6,#documentation-container #table-of-contents [role="heading"]{font-weight:normal;font-size:100%;margin:0;padding:0}#documentation-container #table-of-contents kbd{border-color:#aaa;box-shadow:0 .25em 0 rgba(13,13,13,0.2),.125em .25em 0 rgba(13,13,13,0.2),-.125em .25em 0 rgba(13,13,13,0.2);color:#444}#documentation-container #table-of-contents code{text-decoration:none}#documentation-container #table-of-contents small{display:none}#documentation-container #table-of-contents h1,#documentation-container #table-of-contents h2{font-weight:bold}#documentation-container #table-of-contents h1 small,#documentation-container #table-of-contents h2 small{display:inline}#documentation-container #table-of-contents a{box-sizing:border-box;color:black;display:inline-block;padding:3px 0 0 270px;text-decoration:none;width:100%}@media only screen and (max-width: 420px){#documentation-container #table-of-contents a{padding-left:180px}}#documentation-container #table-of-contents a:hover{text-decoration:underline}#documentation-container #table-of-contents h1 a{padding-left:0}@media only screen and (max-width: 420px){#documentation-container #table-of-contents h1 a{padding-left:0}}#documentation-container #table-of-contents h2 a{padding-left:0px}@media only screen and (max-width: 420px){#documentation-container #table-of-contents h2 a{padding-left:0px}}#documentation-container #table-of-contents h3 a{padding-left:30px}@media only screen and (max-width: 420px){#documentation-container #table-of-contents h3 a{padding-left:20px}}#documentation-container #table-of-contents h4 a{padding-left:60px}@media only screen and (max-width: 420px){#documentation-container #table-of-contents h4 a{padding-left:40px}}#documentation-container #table-of-contents h5 a{padding-left:90px}@media only screen and (max-width: 420px){#documentation-container #table-of-contents h5 a{padding-left:60px}}#documentation-container #table-of-contents h6 a{padding-left:120px}@media only screen and (max-width: 420px){#documentation-container #table-of-contents h6 a{padding-left:80px}}#documentation-container #table-of-contents [aria-level="7"] a{padding-left:150px}@media only screen and (max-width: 420px){#documentation-container #table-of-contents [aria-level="7"] a{padding-left:100px}}#documentation-container #table-of-contents [aria-level="8"] a{padding-left:180px}@media only screen and (max-width: 420px){#documentation-container #table-of-contents [aria-level="8"] a{padding-left:120px}}#documentation-container #table-of-contents [aria-level="9"] a{padding-left:210px}@media only screen and (max-width: 420px){#documentation-container #table-of-contents [aria-level="9"] a{padding-left:140px}}#documentation-container #table-of-contents [aria-level="10"] a{padding-left:240px}@media only screen and (max-width: 420px){#documentation-container #table-of-contents [aria-level="10"] a{padding-left:160px}}#documentation-container #table-of-contents h1 a{padding-top:25px;padding-bottom:6px}#documentation-container #table-of-contents h2 a{padding-top:10px}#documentation-container blockquote{border-left:20px solid #ddd;background-color:#fcfcfc;margin:15px 0;padding:5px 20px}#documentation-container blockquote blockquote{border-color:#d3d3d3;background-color:#f2f2f2}#documentation-container blockquote blockquote blockquote{border-color:#c9c9c9;background-color:#e8e8e8}#documentation-container blockquote blockquote blockquote blockquote{border-color:#bebebe;background-color:#ddd}#documentation-container pre,#documentation-container code{background:#234;color:white;font-family:Menlo,Consolas,monospace;font-size:87.5%}#documentation-container .up-inline-code{box-shadow:0 1px 3px rgba(0,0,0,0.12),0 1px 2px rgba(0,0,0,0.24);border-radius:.125em;font-weight:normal;margin:0 .0625em;padding:0 .2em;white-space:pre}#documentation-container a code{text-decoration:underline}#documentation-container a:hover code{text-decoration:none}#documentation-container pre{box-shadow:0 3px 6px rgba(0,0,0,0.16),0 3px 6px rgba(0,0,0,0.23);border-radius:.1875em;line-height:1.5;margin:20px 0;overflow-x:auto;padding:7px 9px}@media only screen and (max-width: 420px){#documentation-container pre{font-size:85%;line-height:1.4}}#documentation-container pre>code{box-shadow:none;border-radius:0;padding:0}#documentation-container dl{margin-bottom:25px}#documentation-container dl dl{margin-bottom:0}#documentation-container dl dt{color:#000;font-family:-apple-system,BlinkMacSystemFont,sans-serif;font-weight:bold}#documentation-container dl dd{margin-left:20px}#documentation-container dl+dl{margin-top:45px}#documentation-container i i,#documentation-container i em,#documentation-container em i,#documentation-container em em,#documentation-container caption i,#documentation-container caption em{display:inline-block;transform:skewX(-20deg)}#documentation-container kbd{border-color:#aaa;box-shadow:0 .25em 0 rgba(13,13,13,0.2),.125em .25em 0 rgba(13,13,13,0.2),-.125em .25em 0 rgba(13,13,13,0.2);color:#444;border-radius:.25em;border-style:solid;border-width:.125em;display:inline-block;font-family:-apple-system,BlinkMacSystemFont,sans-serif;font-size:70%;line-height:1.4;margin:0 .1em;padding:.1em .6em;text-shadow:0 .1em 0 white;white-space:nowrap}#documentation-container a kbd{border-color:#579;box-shadow:0 .25em 0 rgba(85,119,153,0.3),.125em .25em 0 rgba(85,119,153,0.3),-.125em .25em 0 rgba(85,119,153,0.3);color:#579}#documentation-container .up-footnote-reference a{font-size:110%;margin-left:.125em;text-decoration:none}#documentation-container .up-footnote-reference a:before{content:\'[\'}#documentation-container .up-footnote-reference a:after{content:\']\'}#documentation-container .up-footnotes{font-size:85%}#documentation-container .up-footnotes dt{font-weight:normal}#documentation-container .up-footnotes dt a:before{content:\'↑\'}#documentation-container img{max-width:100%}#documentation-container h1,#documentation-container h2,#documentation-container h3,#documentation-container h4,#documentation-container h5,#documentation-container h6,#documentation-container [role="heading"]{color:#000;font-family:-apple-system,BlinkMacSystemFont,sans-serif;line-height:1.5;overflow-x:auto;padding-top:10px}#documentation-container h1{font-size:180%;padding-bottom:15px;text-align:center}#documentation-container h2{font-size:140%}#documentation-container h3{font-size:120%}#documentation-container h4{font-size:110%}#documentation-container h5{font-size:100%}#documentation-container h6{font-size:90%}#documentation-container [role="heading"]{font-size:60%;margin:1.5em 0}#documentation-container [aria-level="7"]{font-size:85%}#documentation-container [aria-level="8"]{font-size:80%}#documentation-container [aria-level="9"]{font-size:75%}#documentation-container [aria-level="10"]{font-size:70%}#documentation-container mark{background-color:yellow;padding:.0625em}#documentation-container mark mark{background-color:gold}#documentation-container mark mark mark{background-color:orange}#documentation-container q{margin:0 .0625em;quotes:\'“\' \'”\' "‘" "’"}#documentation-container q:before,#documentation-container q:after{font-family:serif}#documentation-container q:before{content:open-quote}#documentation-container q:after{content:close-quote}#documentation-container .up-lines{text-align:center}#documentation-container .up-lines+.up-lines{margin-top:20px}#documentation-container .up-lines>div{margin-bottom:5px}#documentation-container a{color:#579}#documentation-container a:hover{text-decoration:none}#documentation-container ul+ul{margin-top:40px}#documentation-container ol+ol{margin-top:40px}#documentation-container small{font-size:100%;opacity:.5}#documentation-container .up-square-brackets{font-style:italic}@-webkit-keyframes reveal{0%{opacity:1}30%{opacity:.5}100%{opacity:1}}@keyframes reveal{0%{opacity:1}30%{opacity:.5}100%{opacity:1}}#documentation-container .up-revealable>label{box-shadow:0 1px 3px rgba(0,0,0,0.12),0 1px 2px rgba(0,0,0,0.24);background-color:#c00;border-radius:3px;color:white;cursor:pointer;display:inline-block;font-size:75%;margin:10px 0;padding:7px 12px 5px 12px;text-transform:uppercase;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}#documentation-container .up-revealable>label:hover{background:#b00}#documentation-container .up-revealable>label:active{background:#a00}#documentation-container .up-revealable>input[type="radio"]{display:none}#documentation-container .up-revealable>input[type="radio"] ~ span,#documentation-container .up-revealable>input[type="radio"] ~ div{display:none}#documentation-container .up-revealable>input[type="radio"].up-hide:checked+label{display:none}#documentation-container .up-revealable>input[type="radio"].up-reveal:checked+label{display:none}#documentation-container .up-revealable>input[type="radio"].up-reveal:checked ~ span,#documentation-container .up-revealable>input[type="radio"].up-reveal:checked ~ div{-webkit-animation:1s reveal;animation:1s reveal}#documentation-container .up-revealable>input[type="radio"].up-reveal:checked ~ span{display:inline}#documentation-container .up-revealable>input[type="radio"].up-reveal:checked ~ div{display:block}#documentation-container .up-revealable>div{margin-left:20px}#documentation-container span.up-revealable>label{box-shadow:0 1px 3px rgba(0,0,0,0.12),0 1px 2px rgba(0,0,0,0.24);background-color:#c00;border-radius:3px;color:white;cursor:pointer;display:inline-block;font-size:75%;margin:10px 0;padding:7px 12px 5px 12px;text-transform:uppercase;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;display:inline;font-size:65%;margin:0 5px;padding:4px 12px 3px 12px}#documentation-container span.up-revealable>label:hover{background:#b00}#documentation-container span.up-revealable>label:active{background:#a00}#documentation-container div.up-revealable>label{box-shadow:0 1px 3px rgba(0,0,0,0.12),0 1px 2px rgba(0,0,0,0.24);background-color:#c00;border-radius:3px;color:white;cursor:pointer;display:inline-block;font-size:75%;margin:10px 0;padding:7px 12px 5px 12px;text-transform:uppercase;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}#documentation-container div.up-revealable>label:hover{background:#b00}#documentation-container div.up-revealable>label:active{background:#a00}#documentation-container table{border-collapse:collapse;margin:20px 0}@media only screen and (max-width: 420px){#documentation-container table{font-size:80%}}#documentation-container table caption{font-style:italic}#documentation-container table tbody tr:hover td{background:#ddd}#documentation-container table tbody tr:nth-child(even) td{background-color:#eee}#documentation-container table tbody tr:nth-child(even):hover td{background-color:#ccc}#documentation-container table tbody tr:nth-child(even):hover td{border-color:#999}#documentation-container table td,#documentation-container table th{padding:10px;border:1px solid #bbb}#documentation-container table td.up-numeric,#documentation-container table th.up-numeric{text-align:right}#documentation-container table td[colspan],#documentation-container table th[colspan]{text-align:center}#documentation-container table th{border:0;color:#000;font-family:-apple-system,BlinkMacSystemFont,sans-serif}#documentation-container table th[scope="row"]{text-align:right}#documentation-container hr{border:0;padding-bottom:30px;text-align:center}#documentation-container hr:after{color:#ccc;content:\'☆ ☆ ☆\';font-size:10px}@media speech, braille{#documentation-container hr:after{content:none}}#documentation-container video{max-width:100%}@-webkit-keyframes clean{from{opacity:0.5;transition:0.5s}to{opacity:1}}@keyframes clean{from{opacity:0.5;transition:0.5s}to{opacity:1}}.dirty{opacity:0.5;transition:0.5s}.clean{-webkit-animation:0.2s clean;animation:0.2s clean}.CodeMirror{font-family:monospace;height:300px;color:black}.CodeMirror-lines{padding:4px 0}.CodeMirror pre{padding:0 4px}.CodeMirror-scrollbar-filler,.CodeMirror-gutter-filler{background-color:white}.CodeMirror-gutters{border-right:1px solid #ddd;background-color:#f7f7f7;white-space:nowrap}.CodeMirror-linenumber{padding:0 3px 0 5px;min-width:20px;text-align:right;color:#999;white-space:nowrap}.CodeMirror-guttermarker{color:black}.CodeMirror-guttermarker-subtle{color:#999}.CodeMirror-cursor{border-left:1px solid black;border-right:none;width:0}.CodeMirror div.CodeMirror-secondarycursor{border-left:1px solid silver}.cm-fat-cursor .CodeMirror-cursor{width:auto;border:0 !important;background:#7e7}.cm-fat-cursor div.CodeMirror-cursors{z-index:1}.cm-animate-fat-cursor{width:auto;border:0;-webkit-animation:blink 1.06s steps(1) infinite;animation:blink 1.06s steps(1) infinite;background-color:#7e7}@-webkit-keyframes blink{0%{}50%{background-color:transparent}100%{}}@keyframes blink{0%{}50%{background-color:transparent}100%{}}.cm-tab{display:inline-block;text-decoration:inherit}.CodeMirror-rulers{position:absolute;left:0;right:0;top:-50px;bottom:-20px;overflow:hidden}.CodeMirror-ruler{border-left:1px solid #ccc;top:0;bottom:0;position:absolute}.cm-s-default .cm-header{color:blue}.cm-s-default .cm-quote{color:#090}.cm-negative{color:#d44}.cm-positive{color:#292}.cm-header,.cm-strong{font-weight:bold}.cm-em{font-style:italic}.cm-link{text-decoration:underline}.cm-strikethrough{text-decoration:line-through}.cm-s-default .cm-keyword{color:#708}.cm-s-default .cm-atom{color:#219}.cm-s-default .cm-number{color:#164}.cm-s-default .cm-def{color:#00f}.cm-s-default .cm-variable-2{color:#05a}.cm-s-default .cm-variable-3{color:#085}.cm-s-default .cm-comment{color:#a50}.cm-s-default .cm-string{color:#a11}.cm-s-default .cm-string-2{color:#f50}.cm-s-default .cm-meta{color:#555}.cm-s-default .cm-qualifier{color:#555}.cm-s-default .cm-builtin{color:#30a}.cm-s-default .cm-bracket{color:#997}.cm-s-default .cm-tag{color:#170}.cm-s-default .cm-attribute{color:#00c}.cm-s-default .cm-hr{color:#999}.cm-s-default .cm-link{color:#00c}.cm-s-default .cm-error{color:#f00}.cm-invalidchar{color:#f00}.CodeMirror-composing{border-bottom:2px solid}div.CodeMirror span.CodeMirror-matchingbracket{color:#0f0}div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#f22}.CodeMirror-matchingtag{background:rgba(255,150,0,0.3)}.CodeMirror-activeline-background{background:#e8f2ff}.CodeMirror{position:relative;overflow:hidden;background:white}.CodeMirror-scroll{overflow:scroll !important;margin-bottom:-30px;margin-right:-30px;padding-bottom:30px;height:100%;outline:none;position:relative}.CodeMirror-sizer{position:relative;border-right:30px solid transparent}.CodeMirror-vscrollbar,.CodeMirror-hscrollbar,.CodeMirror-scrollbar-filler,.CodeMirror-gutter-filler{position:absolute;z-index:6;display:none}.CodeMirror-vscrollbar{right:0;top:0;overflow-x:hidden;overflow-y:scroll}.CodeMirror-hscrollbar{bottom:0;left:0;overflow-y:hidden;overflow-x:scroll}.CodeMirror-scrollbar-filler{right:0;bottom:0}.CodeMirror-gutter-filler{left:0;bottom:0}.CodeMirror-gutters{position:absolute;left:0;top:0;min-height:100%;z-index:3}.CodeMirror-gutter{white-space:normal;height:100%;display:inline-block;vertical-align:top;margin-bottom:-30px;*zoom:1;*display:inline}.CodeMirror-gutter-wrapper{position:absolute;z-index:4;background:none !important;border:none !important}.CodeMirror-gutter-background{position:absolute;top:0;bottom:0;z-index:4}.CodeMirror-gutter-elt{position:absolute;cursor:default;z-index:4}.CodeMirror-gutter-wrapper{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.CodeMirror-lines{cursor:text;min-height:1px}.CodeMirror pre{border-radius:0;border-width:0;background:transparent;font-family:inherit;font-size:inherit;margin:0;white-space:pre;word-wrap:normal;line-height:inherit;color:inherit;z-index:2;position:relative;overflow:visible;-webkit-tap-highlight-color:transparent;font-variant-ligatures:none}.CodeMirror-wrap pre{word-wrap:break-word;white-space:pre-wrap;word-break:normal}.CodeMirror-linebackground{position:absolute;left:0;right:0;top:0;bottom:0;z-index:0}.CodeMirror-linewidget{position:relative;z-index:2;overflow:auto}.CodeMirror-code{outline:none}.CodeMirror-scroll,.CodeMirror-sizer,.CodeMirror-gutter,.CodeMirror-gutters,.CodeMirror-linenumber{box-sizing:content-box}.CodeMirror-measure{position:absolute;width:100%;height:0;overflow:hidden;visibility:hidden}.CodeMirror-cursor{position:absolute;pointer-events:none}.CodeMirror-measure pre{position:static}div.CodeMirror-cursors{visibility:hidden;position:relative;z-index:3}div.CodeMirror-dragcursors{visibility:visible}.CodeMirror-focused div.CodeMirror-cursors{visibility:visible}.CodeMirror-selected{background:#d9d9d9}.CodeMirror-focused .CodeMirror-selected{background:#d7d4f0}.CodeMirror-crosshair{cursor:crosshair}.CodeMirror-line::-moz-selection,.CodeMirror-line>span::-moz-selection,.CodeMirror-line>span>span::-moz-selection{background:#d7d4f0}.CodeMirror-line::selection,.CodeMirror-line>span::selection,.CodeMirror-line>span>span::selection{background:#d7d4f0}.CodeMirror-line::-moz-selection,.CodeMirror-line>span::-moz-selection,.CodeMirror-line>span>span::-moz-selection{background:#d7d4f0}.cm-searching{background:#ffa;background:rgba(255,255,0,0.4)}.CodeMirror span{*vertical-align:text-bottom}.cm-force-border{padding-right:.1px}@media print{.CodeMirror div.CodeMirror-cursors{visibility:hidden}}.cm-tab-wrap-hack:after{content:\'\'}span.CodeMirror-selectedtext{background:none}\n',""])},function(e,n,t){"use strict";e.exports=function(e){var n=[];return n.toString=function(){return this.map(function(n){var t=function(e,n){var t=e[1]||"",r=e[3];if(!r)return t;if(n&&"function"==typeof btoa){var o=(a=r,s=btoa(unescape(encodeURIComponent(JSON.stringify(a)))),l="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(s),"/*# ".concat(l," */")),i=r.sources.map(function(e){return"/*# sourceURL=".concat(r.sourceRoot).concat(e," */")});return[t].concat(i).concat([o]).join("\n")}var a,s,l;return[t].join("\n")}(n,e);return n[2]?"@media ".concat(n[2],"{").concat(t,"}"):t}).join("")},n.i=function(e,t){"string"==typeof e&&(e=[[null,e,""]]);for(var r={},o=0;o=3;default:return!1}}})},e.prototype.tokenize=function(){for(;this.bufferContentThatCanNeverServeAsDelimiter(),!this.isDone();){this.tryToEscapeCurrentChar()||this.tryToCloseAnyConvention()||this.performConventionSpecificBehaviorInsteadOfTryingToOpenRegularConventions()||this.tryToOpenAnyConvention()||this.addCurrentCharOrStreakOfWhitespaceToContentBuffer()}},e.prototype.isDone=function(){return this.markupConsumer.done()&&this.tryToResolveOpenConventions()},e.prototype.tryToResolveOpenConventions=function(){for(var e;e=this.openConventions.pop();){var n=e.definition.insteadOfFailingWhenLeftUnclosed;if(!n)return this.backTrackToBefore(e),!1;n()}this.flushNonEmptyBufferToTextToken();for(var t=0,r=this.forgivingConventionHandlers;t=0;e--){var n=this.openConventions[e];if(this.shouldClose(n))return!!this.tryToCloseConventionWhoseEndDelimiterWeAlreadyFound({belongingToConventionAtIndex:e})||(this.backTrackToBefore(n),!1);if(n.definition.failsIfWhitespaceIsEnounteredBeforeClosing&&this.isCurrentCharWhitespace())return this.backTrackToBefore(n),!0;var t=n.definition.insteadOfClosingOuterConventionsWhileOpen;if(t)return t(),!0}return this.tryToCloseAnyForgivingConventions()},e.prototype.shouldClose=function(e){var n=e.definition;return n.isCutShortByWhitespace&&this.isCurrentCharWhitespace()||null!=n.endsWith&&null!=this.markupConsumer.consume(n.endsWith)},e.prototype.tryToCloseConventionWhoseEndDelimiterWeAlreadyFound=function(e){var n,t=e.belongingToConventionAtIndex,r=this.openConventions[t],o=r.definition;return this.closeBareUrlIfOneIsOpen({withinConventionAtIndex:t}),o.beforeClosingItFlushesNonEmptyBufferTo&&this.flushNonEmptyBufferToToken(o.beforeClosingItFlushesNonEmptyBufferTo),o.beforeClosingItAlwaysFlushesBufferTo&&this.flushBufferToToken(o.beforeClosingItAlwaysFlushesBufferTo),null===(n=o.whenClosing)||void 0===n||n.call(o,r),this.openConventions.splice(t,1),o.whenClosingItAlsoClosesInnerConventions&&this.openConventions.splice(t),this.tryToOpenASubsequentRequiredConventionIfThereAreAny(r)},e.prototype.isCurrentCharWhitespace=function(){return s.WHITESPACE_CHAR_PATTERN.test(this.markupConsumer.currentChar())},e.prototype.tryToOpenASubsequentRequiredConventionIfThereAreAny=function(e){var n=this,t=e.definition.mustBeDirectlyFollowedBy;return!t||!!t.some(function(e){return n.tryToOpen(e)})&&(o.last(this.openConventions).tokenizerSnapshotWhenOpening=e.tokenizerSnapshotWhenOpening,!0)},e.prototype.tryToCloseAnyForgivingConventions=function(){var e=this;return!(this.justEnteredAConvention()||!this.isPreviousCharacterNonwhitespace())&&this.forgivingConventionHandlers.some(function(n){var t=e.markupConsumer.index(),r=e.markupConsumer.consume(n.delimiterPattern);if(!r)return!1;var o=r.match;return!!n.tryToCloseAnyOpenStartDelimiters(o.length)||(e.markupConsumer.setIndex(t),!1)})},e.prototype.isPreviousCharacterNonwhitespace=function(){return s.NON_BLANK_PATTERN.test(this.markupConsumer.previousChar())},e.prototype.closeBareUrlIfOneIsOpen=function(e){for(var n=e?e.withinConventionAtIndex+1:0;nt;a--){var s=this.tokens[a];if(!(null!=s.correspondingEnclosingToken&&t>this.tokens.indexOf(s.correspondingEnclosingToken)))break;i-=1}this.insertToken({token:o,atIndex:i})},e.prototype.performConventionSpecificBehaviorInsteadOfTryingToOpenRegularConventions=function(){for(var e=this.openConventions.length-1;e>=0;e--){var n=this.openConventions[e].definition.insteadOfOpeningRegularConventionsWhileOpen;if(n)return n(),!0}return!1},e.prototype.tryToOpenAnyConvention=function(){var e=this;return this.conventionDefinitions.some(function(n){return e.tryToOpen(n)})||this.tryToTokenizeBareUrlSchemeAndHostname()||this.tryToOpenForgivingConventionOrTreatDelimiterAsText()||this.tryToTokenizeInlineCodeOrUnmatchedDelimiter()||this.tryToTokenizeTypographicalConvention()},e.prototype.tryToOpenForgivingConventionOrTreatDelimiterAsText=function(){var e=this,n=this.forgivingConventionHandlers.some(function(n){var t=e.markupConsumer.consume(n.delimiterPattern);if(!t)return!1;var r=t.match;return s.NON_BLANK_PATTERN.test(t.charAfterMatch)?(e.flushNonEmptyBufferToTextToken(),n.addStartDelimiter(r,e.tokens.length),!0):(e.bufferedContent+=r,!1)});return n&&this.indicateWeJustOpenedAConvention(),n},e.prototype.tryToTokenizeInlineCodeOrUnmatchedDelimiter=function(){var e=w.tryToTokenizeInlineCode(this.markupConsumer.remaining());return!!e&&(this.flushNonEmptyBufferToTextToken(),this.appendToken(e.inlineCodeOrTextToken),this.markupConsumer.advance(e.lengthConsumed),!0)},e.prototype.tryToTokenizeTypographicalConvention=function(){return this.tryToTokenizeEnOrEmDash()||this.tryToTokenizePlusMinusSign()||this.tryToTokenizeEllipsis()},e.prototype.tryToTokenizeEnOrEmDash=function(){var e=this.markupConsumer.consume(_);if(!e)return!1;var n=e.match;return this.bufferedContent+=n.length>=3?l.repeat("—",Math.floor(n.length/3)):"–",!0},e.prototype.tryToTokenizePlusMinusSign=function(){return this.tryToTokenizeSimpleTypographicalConvention(R,"±")},e.prototype.tryToTokenizeEllipsis=function(){return this.tryToTokenizeSimpleTypographicalConvention(E,this.settings.fancyEllipsis)},e.prototype.tryToTokenizeSimpleTypographicalConvention=function(e,n){return!!this.markupConsumer.consume(e)&&(this.bufferedContent+=n,!0)},e.prototype.appendToken=function(e){this.tokens.push(e),this.mostRecentToken=e},e.prototype.addCurrentCharOrStreakOfWhitespaceToContentBuffer=function(){s.WHITESPACE_CHAR_PATTERN.test(this.markupConsumer.currentChar())?this.buffer(Y):this.addCurrentCharToContentBuffer()},e.prototype.buffer=function(e){var n=this.markupConsumer.consume(e);n&&(this.bufferedContent+=n.match)},e.prototype.addCurrentCharToContentBuffer=function(){this.bufferedContent+=this.markupConsumer.currentChar(),this.markupConsumer.advance(1)},e.prototype.tryToOpen=function(e){var n=e.startsWith,t=e.flushesBufferToTextTokenBeforeOpening,r=e.whenOpening;if(!this.canTry(e))return!1;var o=this.markupConsumer.index(),i=this.markupConsumer.consume(n);return!!i&&(t&&this.flushNonEmptyBufferToTextToken(),this.openConventions.push(new m.OpenConvention(e,{markupIndex:o,markupIndexThatLastOpenedAConvention:this.markupIndexThatLastOpenedAConvention,tokens:this.tokens.slice(),openConventions:this.openConventions.map(function(e){return e.clone()}),forgivingConventionHandlers:this.forgivingConventionHandlers.map(function(e){return e.clone()}),bufferedContent:this.bufferedContent})),null==r||r.apply(void 0,i.captures),this.indicateWeJustOpenedAConvention(),!0)},e.prototype.canTry=function(e){var n=this,t=this.markupConsumer.index(),r=e.mustBeDirectlyFollowedBy;if(r&&r.some(function(e){return n.backtrackedConventionHelper.hasFailed(e,t)}))return!1;var o=e.canOnlyOpenIfDirectlyFollowing;return!this.backtrackedConventionHelper.hasFailed(e,t)&&(!o||this.isDirectlyFollowing(o))},e.prototype.isDirectlyFollowing=function(e){var n=this;return!this.bufferedContent&&null!=this.mostRecentToken&&e.some(function(e){return n.mostRecentToken.role===e})},e.prototype.backTrackToBefore=function(e){this.backtrackedConventionHelper.registerFailure(e);var n=e.tokenizerSnapshotWhenOpening;this.tokens=n.tokens,this.bufferedContent=n.bufferedContent,this.markupConsumer.setIndex(n.markupIndex),this.markupIndexThatLastOpenedAConvention=n.markupIndexThatLastOpenedAConvention,this.openConventions=n.openConventions,this.forgivingConventionHandlers=n.forgivingConventionHandlers},e.prototype.appendNewToken=function(e,n){this.appendToken(new k.Token(e,n))},e.prototype.appendBufferedUrlPathToCurrentBareUrl=function(){if(this.mostRecentToken.role!==p.TokenRole.BareUrl)throw new Error("Most recent token is not a bare URL token");this.mostRecentToken.value+=this.flushBufferedContent()},e.prototype.flushBufferedContent=function(){var e=this.bufferedContent;return this.bufferedContent="",e},e.prototype.flushNonEmptyBufferToToken=function(e){this.bufferedContent&&this.appendNewToken(e,this.flushBufferedContent())},e.prototype.flushBufferToToken=function(e){this.appendNewToken(e,this.flushBufferedContent())},e.prototype.insertToken=function(e){var n=e.token,t=e.atIndex;this.tokens.splice(t,0,n);for(var r=0,o=this.openConventions;r=0;a--){var c=n[a];if(c.correspondingEnclosingToken.role===o.role){n.splice(a,1);break}i.push(c.correspondingEnclosingToken)}this.closeAndReopenConventionsAroundTokenAtIndex(t,i),t+=2*i.length}}},e.prototype.resolveOverlapping=function(e,n){for(var t=0;t1&&(t.colspan=n.countColumnsSpanned),l.htmlElementWithAlreadyEscapedChildren(e,this.renderEach(n.children),t)},n.prototype.htmlElement=function(e,n,t){return void 0===t&&(t={}),l.htmlElementWithAlreadyEscapedChildren(e,this.renderEach(n),t)},n.prototype.htmlIdOfActualEntryInDocument=function(e){return this.idFor(this.settings.terms.sectionReferencedByTableOfContents,e.ordinalInTableOfContents)},n.prototype.footnoteHtmlId=function(e){return this.idFor(this.settings.terms.footnote,e)},n.prototype.footnoteReferenceHtmlId=function(e){return this.idFor(this.settings.terms.footnoteReference,e)},n.prototype.isUrlAllowed=function(e){return this.settings.renderDangerousContent||!f.test(e)},n.prototype.reset=function(e){this.revealableContentCount=0,this.isInsideLink=!1,this.isInsideTableOfContents=null!=e&&e.isInsideTableOfContents},n}(s.Renderer);function d(e,n){return void 0===n&&(n={}),e.sourceLineNumber&&(n["data-up-source-line"]=e.sourceLineNumber),n}function p(){for(var e=[],n=0;n"}function a(e,t){return"<"+r([e],function(e){return Object.keys(e).sort().map(function(t){return function(e,t){var r=e[t];return r===n.EMPTY_ATTRBUTE_VALUE?t:t+'="'+o.escapeHtmlAttrValue(r)+'"'}(e,t)})}(t)).join(" ")+">"}n.htmlElement=function(e,n,t){return void 0===t&&(t={}),i(e,[o.escapeHtmlContent(n)],t)},n.htmlElementWithAlreadyEscapedChildren=i,n.singleTagHtmlElement=function(e,n){return void 0===n&&(n={}),a(e,n)},n.EMPTY_ATTRBUTE_VALUE=void 0},function(e,n,t){"use strict";t.r(n),n.default='##########\r\nWhat\'s Up?\r\n##########\r\n\r\nUp is a markup language for writing structured documents in plain text.\r\n\r\nFor software developers, Up offers a software library that converts Up markup into HTML. To learn more, please see [topic: using the Up library].\r\n\r\n\r\n\r\n===========\r\nWhy use Up?\r\n===========\r\n\r\nUp isn\'t the only markup language that produces HTML. What makes it special?\r\n\r\n\r\nUp has a flexible, forgiving syntax\r\n===================================\r\n\r\nUp recognizes [topic: numbered lists] that count backwards.\r\n\r\nMarkup\r\n ````\r\n 3) Buy milk\r\n 2) Buy bread\r\n #) Buy happiness\r\n ````\r\n\r\nOutput\r\n 3) Buy milk\r\n 2) Buy bread\r\n #) Buy happiness\r\n\r\nUp usually ignores [topic: excessive delimiter characters].\r\n\r\nFor example, you don\'t need to perfectly balance asterisks when stressing or emphasizing text.\r\n\r\nMarkup\r\n ````\r\n I ***love****** asterisks!\r\n ````\r\n\r\nOutput\r\n I ***love****** asterisks!\r\n\r\nUp isn\'t picky about which brackets you use for [topic: links].\r\n\r\nMarkup\r\n ````\r\n - Buy [milk] (en.wikipedia.org/wiki/Milk)\r\n - Buy (bread) [en.wikipedia.org/wiki/Bread]\r\n - Buy [sugar] [en.wikipedia.org/wiki/Sugar]\r\n - Buy (happiness) (en.wikipedia.org/wiki/Happiness)\r\n ````\r\n\r\nOutput\r\n - Buy [milk] (en.wikipedia.org/wiki/Milk)\r\n - Buy (bread) [en.wikipedia.org/wiki/Bread]\r\n - Buy [sugar] [en.wikipedia.org/wiki/Sugar]\r\n - Buy (happiness) (en.wikipedia.org/wiki/Happiness)\r\n\r\nUp even supports [topic: overlapping]!\r\n\r\nMarkup\r\n ````\r\n John **enjoys ==sleeping** late== whenever he can.\r\n ````\r\n\r\nOutput\r\n John **enjoys ==sleeping** late== whenever he can.\r\n\r\n\r\nUp uses customizable keywords\r\n=============================\r\n\r\nToo many markup languages devolve into a dense soup of symbols and punctuation.\r\n\r\nWhen a keyword would provide more clarity than a symbol, Up takes advantage of that! Several writing conventions, including [topic: tables] and [topic: revealable content], incorporate keywords.\r\n\r\nIf you\'re a software developer using the Up library, you can provide multiple custom variations for each keyword. To learn more, please see [topic: customizing keywords].\r\n\r\n\r\nUp produces fully accessible HTML\r\n=================================\r\n\r\nFrom the table of contents to the last movie-ruining spoiler, Up produces fully accessible HTML. This means people who have trouble viewing a screen or a using mouse can enjoy every document.\r\n\r\n\r\n\r\n=================\r\nWhy *not* use Up?\r\n=================\r\n\r\nYou want a rich ecosystem of tools\r\n==================================\r\n\r\nSo far, there is only one [software library for Up] (npmjs.com/package/up-lang), written and maintained by a [single person] (github.com/start). In contrast, [other markup languages] (duckduckgo.com/?q=markdown) have countless tools and plugins.\r\n\r\n\r\nYou need speed\r\n==============\r\n\r\nUp is not terribly slow, but it\'s not terribly fast, either---at least not yet! If you need instant, real-time parsing and rendering of large documents, Up isn\'t the best markup language for you.\r\n\r\n\r\n\r\n###################\r\nWriting conventions\r\n###################\r\n\r\nDon\'t get lost! The following terms are occasionally used throughout this section.\r\n\r\nWriting convention\r\n Any special annotation or formatting recognized by Up.\r\n\r\nInline writing convention\r\n Any writing convention that can be used within paragraphs. This includes [topic: emphasis] and [topic: highlighting].\r\n\r\nOutline writing convention\r\n Any non-inline writing convention. This includes [topic: paragraphs] and [topic: tables].\r\n\r\n\r\n==========\r\nParagraphs\r\n==========\r\n\r\nParagraphs are the simplest writing convention in Up.\r\n\r\nMarkup\r\n ````\r\n Unlike regular dental floss, you can use floss picks even if you\'re not a trained dental hygienist.\r\n\r\n Floss picks are sold in stylish, resealable plastic bags. You have no excuse not to buy some today.\r\n ````\r\n\r\nOutput\r\n Unlike regular dental floss, you can use floss picks even if you\'re not a trained dental hygienist.\r\n\r\n Floss picks are sold in stylish, resealable plastic bags. You have no excuse not to buy some today.\r\n\r\nTo produce a paragraph, write a line of text. That\'s all there is to it!\r\n\r\nTypically, paragraphs are separated by one or two blank lines. Three or more blank lines between paragraphs indicates a meaningful change of subject. To learn more, see [topic: thematic breaks].\r\n\r\nIn contrast, *consecutive* non-blank lines produce [topic: line blocks], not consecutive paragraphs.\r\n\r\n\r\n===========\r\nLine blocks\r\n===========\r\n\r\nUse the line block convention for addresses, lyrics, or anything consisting of *lines* instead of actual [topic: paragraphs].\r\n\r\nMarkup\r\n ````\r\n Have you read my new poem?\r\n\r\n Roses are red\r\n Violets *aren\'t* blue\r\n Lyrics have lines\r\n And addresses do, too\r\n\r\n Poetry is just too easy.\r\n ````\r\n\r\nOutput\r\n Have you read my new poem?\r\n\r\n Roses are red\r\n Violets *aren\'t* blue\r\n Lyrics have lines\r\n And addresses do, too\r\n\r\n Poetry is just too easy.\r\n\r\nConsecutive non-blank lines produce a line block, unless those lines represent another writing convention, like [topic: numbered lists].\r\n\r\n\r\n========\r\nEmphasis\r\n========\r\n\r\nUse the emphasis convention to emphasize a word or phrase.\r\n\r\nIf the reader should pronounce a word or phrase differently (e.g. to indicate contrast or sarcasm), consider emphasizing it.\r\n\r\nMarkup\r\n ````\r\n Only eat the *green* grapes. The red grapes are for Pikachu.\r\n ````\r\n\r\nOutput\r\n Only eat the *green* grapes. The red grapes are for Pikachu.\r\n\r\nTo emphasize text, enclose it within single asterisks.\r\n\r\nLike most inline writing conventions, emphasis can be nested within itself.\r\n\r\nMarkup\r\n ````\r\n John really, *really, *really** hates Red Delicious apples.\r\n ````\r\n\r\nOutput\r\n John really, *really, *really** hates Red Delicious apples.\r\n\r\n\r\n======\r\nStress\r\n======\r\n\r\nUse the stress convention to indicate a word or phrase is particularly important.\r\n\r\nIf the reader should raise their voice while reading a word or phrase, consider stressing it.\r\n\r\nMarkup\r\n ````\r\n Do **not** step on the dinosaur!\r\n ````\r\n\r\nOutput\r\n Do **not** step on the dinosaur!\r\n\r\nTo stress text, enclose it within double asterisks.\r\n\r\nLike most inline writing conventions, stress can be nested within itself.\r\n\r\nMarkup\r\n ````\r\n John really, **really, **really**** hates Red Delicious apples.\r\n ````\r\n\r\nOutput\r\n John really, **really, **really**** hates Red Delicious apples.\r\n\r\n\r\n=======\r\nItalics\r\n=======\r\n\r\nUse the italic convention to stylistically offset a word or phrase from the surrounding text *without* conveying emphasis. The titles of books and movies should probably be italicized.\r\n\r\nIf you want to emphasize text, see [topic: emphasis].\r\n\r\nMarkup\r\n ````\r\n My favorite video game is _Chrono Cross_.\r\n ````\r\n\r\nOutput\r\n My favorite video game is _Chrono Cross_.\r\n\r\nTo italicize text, enclose it within single underscores.\r\n\r\nLike most inline writing conventions, italicized text can be nested within itself.\r\n\r\nMarkup\r\n ````\r\n My favorite show is _Real Recipes _Redux_: Super Suppers_.\r\n ````\r\n\r\nOutput\r\n My favorite show is _Real Recipes _Redux_: Super Suppers_.\r\n\r\n\r\n====\r\nBold\r\n====\r\n\r\nTypically, people use bold text to convey extra importance---that\'s what the [topic: stress] convention is for!\r\n\r\nTo make a word or phrase bold *without* conveying any extra importance, use the plain old bold convention.\r\n\r\nMarkup\r\n ````\r\n Has anyone actually used __KABOOM__ cleaning products?\r\n ````\r\n\r\nOutput\r\n Has anyone actually used __KABOOM__ cleaning products?\r\n\r\nTo make text bold, enclose it within double underscores.\r\n\r\nLike most inline writing conventions, bold text can be nested within itself.\r\n\r\nMarkup\r\n ````\r\n We\'ve all seen the ads.\r\n\r\n __No hard scrubbing! __KABOOM__... and the stains are gone!__\r\n ````\r\n\r\nOutput\r\n We\'ve all seen the ads.\r\n\r\n __No hard scrubbing! __KABOOM__... and the stains are gone!__\r\n\r\n\r\n============\r\nHighlighting\r\n============\r\n\r\nTo draw attention to text without altering its semantics, using the highlighting convention.\r\n\r\nHighlighting should not be used to emphasize or stress text! If that\'s your purpose, see [topic: emphasis] or [topic: stress].\r\n\r\nMarkup\r\n ````\r\n Our cupcakes are organic, ==gluten-free==, and made using only the most expensive ingredients.\r\n ````\r\n\r\nOutput\r\n Our cupcakes are organic, ==gluten-free==, and made using only the most expensive ingredients.\r\n\r\nTo highlight text, enclose it within two or more equal signs.\r\n\r\nLike most inline writing conventions, highlighting can be nested within itself.\r\n\r\nMarkup\r\n ````\r\n Our cupcakes are ==organic, ==gluten-free==, vegan==, and made using only the most expensive ingredients.\r\n ````\r\n\r\nOutput\r\n Our cupcakes are ==organic, ==gluten-free==, vegan==, and made using only the most expensive ingredients.\r\n\r\n\r\n=====\r\nLinks\r\n=====\r\n\r\nYou already know what a link is!\r\n\r\nMarkup\r\n ````\r\n The [Game Boy] (en.wikipedia.org/wiki/Game_Boy) was my first video game system.\r\n ````\r\n\r\nOutput\r\n The [Game Boy] (en.wikipedia.org/wiki/Game_Boy) was my first video game system.\r\n\r\nA link consists of two parts: content and a URL.\r\n\r\nTo produce a link, simply enclose its content in square brackets or parentheses, then enclose its URL in square brackets or parentheses.\r\n\r\nYou can use mix and match either type of bracket---they\'re totally interchangeable.\r\n\r\nMarkup\r\n ````\r\n - Buy [milk] (en.wikipedia.org/wiki/Milk)\r\n - Buy (bread) [en.wikipedia.org/wiki/Bread]\r\n - Buy [sugar] [en.wikipedia.org/wiki/Sugar]\r\n - Buy (happiness) (en.wikipedia.org/wiki/Happiness)\r\n ````\r\n\r\nOutput\r\n - Buy [milk] (en.wikipedia.org/wiki/Milk)\r\n - Buy (bread) [en.wikipedia.org/wiki/Bread]\r\n - Buy [sugar] [en.wikipedia.org/wiki/Sugar]\r\n - Buy (happiness) (en.wikipedia.org/wiki/Happiness)\r\n\r\nAs demonstrated above, you can omit a link\'s URL scheme. [^ `http://` and `https://` are examples of URL schemes.] If you do, Up uses `https://` for the URL scheme.\r\n\r\nIf you\'re a software developer using the Up library, you can specify a different default URL scheme. To learn more, see [topic: `defaultUrlScheme`].\r\n\r\nOther settings affecting links are:\r\n\r\n- [topic: `baseForUrlsStartingWithSlash`]\r\n- [topic: `baseForUrlsStartingWithHashmark`]\r\n- [topic: `renderDangerousContent`]\r\n\r\n\r\nLinks with URLs containing spaces\r\n=================================\r\n\r\nIf your link URL contains spaces, Up assumes you *aren\'t* actually trying to produce a link. So it avoids producing one!\r\n\r\nMarkup\r\n ````\r\n Warlocked is the best game for GameBoy [sic] (other than Pokémon).\r\n ````\r\n\r\nOutput\r\n Warlocked is the best game for GameBoy [sic] (other than Pokémon).\r\n\r\nIf your link URL really does contain spaces, you can make it clear that you intend to produce a link by omitting the space between your link\'s content and its URL.\r\n\r\nMarkup\r\n ````\r\n I love the [music](duckduckgo.com/?q=chrono cross music) for Chrono Cross.\r\n ````\r\n\r\nOutput\r\n I love the [music](duckduckgo.com/?q=chrono cross music) for Chrono Cross.\r\n\r\nWhen you omit the space between your link\'s content and its URL, Up always produces a link.\r\n\r\nThese rules also apply when [topic: linkifying].\r\n\r\n\r\nBare URLs\r\n=========\r\n\r\nAlternatively, if you include a bare URL in your document, Up will automatically produce a link for you.\r\n\r\nMarkup\r\n ````\r\n https://en.wikipedia.org/wiki/John_Carmack\r\n ````\r\n\r\nOutput\r\n https://en.wikipedia.org/wiki/John_Carmack\r\n\r\n\r\n=============\r\nInline quotes\r\n=============\r\n\r\nUp automatically recognizes quoted text.\r\n\r\nIf you want to quote more a few sentences, considering using [topic: blockquotes].\r\n\r\nMarkup\r\n ````\r\n "Only eat the green grapes," John said.\r\n ````\r\n\r\nOutput\r\n "Only eat the green grapes," John said.\r\n\r\nYou already know how to use quotation marks! Just keep doing what you\'re doing.\r\n\r\nLike most inline writing conventions, inline quotes can be nested within themselves.\r\n\r\nMarkup\r\n ````\r\n Bob replied, "Yesterday, Harvey yelled "I\'ll take the case!", but I doubt he will."\r\n ````\r\n\r\nOutput\r\n Bob replied, "Yesterday, Harvey yelled "I\'ll take the case!", but I doubt he will."\r\n\r\n\r\n==================\r\nParenthetical text\r\n==================\r\n\r\nUp automatically recognizes parenthetical text.\r\n\r\nMarkup\r\n ````\r\n When I was ten years old, I left my home (in Pallet Town) to search for Pokémon.\r\n ````\r\n\r\nOutput\r\n When I was ten years old, I left my home (in Pallet Town) to search for Pokémon.\r\n\r\nUp understands that text enclosed within parentheses or square brackets represents supplemental content.\r\n\r\n\r\n==================\r\nExample user input\r\n==================\r\n\r\nUse the example user input convention to represent user input, including:\r\n\r\n- Keys the user should press\r\n- Buttons the user should click\r\n- Menu items the user should access\r\n\r\nMarkup\r\n ````\r\n Press {esc} to quit.\r\n ````\r\n\r\nOutput\r\n Press {esc} to quit.\r\n\r\nTo indicate that text represents user input, enclose the text within curly brackets.\r\n\r\nUp ignores any spaces separating the curly brackets from the content they enclose.\r\n\r\nMarkup\r\n ````\r\n Press { Start Game } when you are ready.\r\n ````\r\nOutput\r\n Press { Start Game } when you are ready.\r\n\r\nWithin example user input, most writing conventions are ignored. However, [topic: typographical writing conventions] are supported.\r\n\r\n\r\n===========\r\nInline code\r\n===========\r\n\r\nUse the inline code convention to represent a small fragment of computer code.\r\n\r\nWhen you need to represent more than a small fragment of computer code, use [topic: code blocks] instead.\r\n\r\nMarkup\r\n ````\r\n In HTML, you probably shouldn\'t use the `` element.\r\n ````\r\n\r\nOutput\r\n In HTML, you probably shouldn\'t use the `` element.\r\n\r\nTo produce inline code, enclose text within an equal number of backticks on either side. You can use any number of backticks---simply make sure both sides match.\r\n\r\nMarkup\r\n ````\r\n In HTML, you probably shouldn\'t use the ```` element.\r\n ````\r\n\r\nOutput\r\n In HTML, you probably shouldn\'t use the ```` element.\r\n\r\nWithin inline code, other writing conventions are ignored. Characters that normally have special meaning are preserved as plain text.\r\n\r\nMarkup\r\n ````\r\n In Up, surround text with `*asterisks*` to emphasize it.\r\n ````\r\n\r\nOutput\r\n In Up, surround text with `*asterisks*` to emphasize it.\r\n\r\n\r\nIncluding backticks in your code\r\n================================\r\n\r\nTo include backticks within inline code, you can precede each backtick with a backslash.\r\n\r\nMarkup\r\n ````\r\n `let output = \\`score:\\` + 5`\r\n ````\r\n\r\nOutput\r\n `let output = \\`score:\\` + 5`\r\n\r\nFor more information about the behavior of backslashes, see [topic: disabling].\r\n\r\nAlternatively, inline code can contain streaks of backticks that aren\'t exactly as long as the inline code\'s outer delimiters. No backslashes are necessary.\r\n\r\nIn this example, the delimiters are **1** backtick long, so the inline code can contain streaks of **2** backticks:\r\n\r\nMarkup\r\n ````\r\n `let output = ``score:`` + 5`\r\n ````\r\n\r\nOutput\r\n `let output = ``score:`` + 5`\r\n\r\nIn this example, the delimiters are **2** backticks long, so the inline code can contain "streaks" of **1** backtick:\r\n\r\nMarkup\r\n ````\r\n ``let output = `score:` + 5``\r\n ````\r\n\r\nOutput\r\n ``let output = `score:` + 5``\r\n\r\n--------------------------------------\r\nCode starting or ending with backticks\r\n--------------------------------------\r\n\r\nIf your inline code starts or ends with backticks, place a single space between the offending backticks and the outer delimiter. This single space is trimmed away.\r\n\r\nIn this example, the inline code both starts and ends with a backtick:\r\n\r\nMarkup\r\n ````\r\n `` `inline_code` ``\r\n ````\r\n\r\nOutput\r\n `` `inline_code` ``\r\n\r\nAny spaces beyond that single space are preserved---if there are multiple spaces between the delimiter and the starting/ending backticks, only one space is trimmed away.\r\n\r\nMarkup\r\n ````\r\n `` `inline_code` ``\r\n ````\r\n\r\nOutput\r\n `` `inline_code` ``\r\n\r\nFurthermore, that single space is only trimmed away when it\'s necessary to separate a delimiter from backticks in your inline code. If a given "side" of inline code has any non-space characters between the delimiter and the outermost backtick, no spaces are trimmed from that side.\r\n\r\nMarkup\r\n ````\r\n `` (`inline_code`) ``\r\n ````\r\n\r\nOutput\r\n `` (`inline_code`) ``\r\n\r\n\r\n========\r\nHeadings\r\n========\r\n\r\nUse headings to introduce a new section in the document.\r\n\r\nMarkup\r\n ````\r\n Example heading\r\n ===============\r\n ````\r\n\r\nOutput\r\n Example heading\r\n ===============\r\n\r\nIf text is underlined, it\'s treated as a heading. The underline can consist of any combination of the following characters (you can mix and match):\r\n\r\n- Hyphens: `-`\r\n- Number signs: `#`\r\n- Equal signs: `=`\r\n- Plus signs: `+`\r\n- Tildes: `~`\r\n- Colons: `:`\r\n- Asterisks: `*`\r\n- At signs: `@`\r\n\r\nA heading\'s underline must be at least three characters long, but it does *not* need to be the same length as the text of the heading.\r\n\r\nMarkup\r\n ````\r\n Example heading with a short underline\r\n ===\r\n ````\r\n\r\nOutput\r\n Example heading with a short underline\r\n ===\r\n\r\n\r\nHeading levels\r\n==============\r\n\r\nThe first heading in a document is always a top-level heading. All subsequent headings with underlines consisting of the same characters are considered top-level.\r\n\r\nThe first heading with a different combination of underline characters is considered a second-level heading. Unsurprisingly, all subsequent headings with underlines consisting of the same characters are also considered second-level.\r\n\r\nThis process continues _ad infinitum_. Every new combination of heading underline characters introduces a new heading level. There is no limit to the number of heading levels in a document.\r\n\r\n\r\nHeadings with "overlines"\r\n=========================\r\n\r\nA heading can have an optional "overline", but its overline must consist of the same combination of characters as its underline.\r\n\r\nMarkup\r\n ````\r\n --------------------------------\r\n Example heading with an overline\r\n --------------------------------\r\n ````\r\n\r\nOutput\r\n --------------------------------\r\n Example heading with an overline\r\n --------------------------------\r\n\r\nFor the purpose of determining heading levels, a heading with an overline is always considered distinct from a heading without one, even if both headings use the same combination of underline characters.\r\n\r\nTherefore, a heading with an overline will never have the same level as a heading without an overline.\r\n\r\n\r\n=============\r\nSection links\r\n=============\r\n\r\nUse the section link convention to link to another section (heading) in your document.\r\n\r\nMarkup\r\n ````\r\n Up even supports [topic: overlapping]!\r\n ````\r\n\r\nOutput\r\n Up even supports [topic: overlapping]!\r\n\r\nTo link to a heading, choose a unique snippet of markup from that heading\'s content line. [^ Don\'t worry about the heading\'s underline or overline! Section links ignore both.] Enclose that markup snippet within square brackets or parentheses, then insert `topic:` or `section:` directly inside your opening bracket.\r\n\r\nUp automatically matches your snippet to the most appropriate heading, then produces a link for you.\r\n\r\n\r\nMatching the most appropriate heading\r\n=====================================\r\n\r\nInitially, Up tries to match your section link to the first heading whose content line\'s markup *exactly matches* your snippet. [^ Up totally ignores the capitalization of section links\' markup snippets, so a section link and a heading can be an "exact match" without being capitalized the same way.] If there isn\'t an exact match, Up matches your section link to the first heading whose content line markup *contains* your snippet.\r\n\r\n\r\n=========\r\nFootnotes\r\n=========\r\n\r\nUse the footnote convention for asides or citations---anything you want to say without breaking the flow of a paragraph.\r\n\r\nFootnotes are automatically extracted into blocks for you.\r\n\r\nMarkup\r\n ````\r\n Warlocked [^ No relation to Warcraft!] is a real-time strategy game.\r\n ````\r\n\r\nOutput\r\n Warlocked [^ No relation to Warcraft!] is a real-time strategy game.\r\n\r\nTo produce a footnote, enclose its content within parentheses or square brackets. Then, insert a caret `^` directly after your opening bracket.\r\n\r\n\r\n=====\r\nMedia\r\n=====\r\n\r\nUp allows you to embed [topic: images], [topic: video], or [topic: audio] in your document.\r\n\r\n\r\nImages\r\n======\r\n\r\nMarkup\r\n ````\r\n [image: Super Mario Land box art] (i.imgur.com/TxlFlkX.jpg)\r\n ````\r\n\r\nOutput\r\n [image: Super Mario Land box art] (i.imgur.com/TxlFlkX.jpg)\r\n\r\nIf you want to link your image to another page, please see [topic: linkifying].\r\n\r\n\r\nVideo\r\n=====\r\n\r\nMarkup\r\n ````\r\n [video: Professor Leonard] (i.imgur.com/32fBpnh.mp4)\r\n ````\r\n\r\nOutput\r\n [video: Professor Leonard] (i.imgur.com/32fBpnh.mp4)\r\n\r\n\r\nAudio\r\n=====\r\n\r\nMarkup\r\n ````\r\n [audio: Sadness theme from Infinity for Game Boy] (a.clyp.it/ybct5hcl.mp3)\r\n ````\r\n\r\nOutput\r\n [audio: Sadness theme from Infinity for Game Boy] (a.clyp.it/ybct5hcl.mp3)\r\n\r\n\r\nSyntax\r\n======\r\n\r\nTo embed media in your document, simply enclose its description in square brackets or parentheses, then enclose its URL in square brackets or parentheses.\r\n\r\nYou can use mix and match either type of bracket---they\'re totally interchangeable.\r\n\r\n------------------\r\nMedia descriptions\r\n------------------\r\n\r\nMedia descriptions always start with `image:`, `audio:`, or `video:`, depending on the type of media you wish to include.\r\n\r\nWithin media descriptions, most writing conventions are ignored. However, [topic: typographical writing conventions] are supported.\r\n\r\n----------\r\nMedia URLs\r\n----------\r\n\r\nAs demonstrated above, you can omit the URL scheme for media URLs. If you do, Up uses `https://` for the URL scheme.\r\n\r\nIf you\'re a software developer using the Up library, you can specify a different default URL scheme. To learn more, see [topic: `defaultUrlScheme`].\r\n\r\nOther settings affecting media are:\r\n\r\n- [topic: `baseForUrlsStartingWithSlash`]\r\n- [topic: `baseForUrlsStartingWithHashmark`]\r\n- [topic: `renderDangerousContent`]\r\n\r\n\r\n==================\r\nRevealable content\r\n==================\r\n\r\nBoth [topic: inline revealables] and [topic: revealable blocks] recognize any of the following keywords:\r\n\r\n- `spoiler`\r\n- `nsfw`\r\n- `nsfl`\r\n- `revealable`\r\n\r\nLike all keywords in Up, you can capitalize them however you want.\r\n\r\n\r\nInline revealables\r\n==================\r\n\r\nUse the inline revealable convention to hide content within a paragraph.\r\n\r\nWhen you want to hide more than a sentence or two, use [topic: revealable blocks] instead.\r\n\r\nMarkup\r\n ````\r\n At the end of Pokémon Red, [SPOILER: you battle your rival] before the credits roll.\r\n ````\r\n\r\nOutput\r\n At the end of Pokémon Red, [SPOILER: you battle your rival] before the credits roll.\r\n\r\nTo hide content within a paragraph, first enclose that content within square brackets or parentheses.\r\n\r\nThen, directly inside your opening bracket, insert one of the revealable keywords followed by a colon: `spoiler:`, `nsfw:`, `nsfl:`, or `revealable:`.\r\n\r\nInline revealables can contain any inline writing convention.\r\n\r\n\r\nRevealable blocks\r\n==================\r\n\r\nUse revealable block convention to hide a block of content.\r\n\r\nWhen you want to hide content within a paragraph, use [topic: inline revealables] instead.\r\n\r\nMarkup\r\n ````\r\n SPOILER:\r\n After defeating the Elite Four at the end of Pokémon Red, you still have to battle your rival one last time.\r\n\r\n Your rival\'s specific lineup depends on the Pokémon you selected at the beginning of the game. However, his first three Pokémon are always the same:\r\n\r\n 1. Pidgeot\r\n 2. Alakazam\r\n 3. Rhydon\r\n ````\r\n\r\nOutput\r\n SPOILER:\r\n After defeating the Elite Four at the end of Pokémon Red, you still have to battle your rival one last time.\r\n\r\n Your rival\'s specific lineup depends on the Pokémon you selected at the beginning of the game. However, his first three Pokémon are always the same:\r\n\r\n 1. Pidgeot\r\n 2. Alakazam\r\n 3. Rhydon\r\n\r\nTo hide a block of content, first indent it two spaces (or a tab).\r\n\r\nThen, on the line *before* your indented block, put one of the revealable keywords: `spoiler`, `nsfw`, `nsfl`, or `revealable`.\r\n\r\nIn the example above, the chosen revealable keyword (`spoiler`) is followed by a colon. The colon is optional.\r\n\r\n\r\n===========\r\nBlockquotes\r\n===========\r\n\r\nUse the blockquote convention to quote a large section of text.\r\n\r\nFor typical dialog, you should probably use [topic: inline quotes] instead.\r\n\r\nMarkup\r\n ````\r\n > I hate oranges for the following reasons:\r\n >\r\n > 1. They\'re not apples.\r\n > 2. They\'re not bananas.\r\n ````\r\n\r\nOutput\r\n > I hate oranges for the following reasons:\r\n >\r\n > 1. They\'re not apples.\r\n > 2. They\'re not bananas.\r\n\r\nA blockquote consists of consecutive lines starting with `> ` (a greater-than symbol followed by a space).\r\n\r\nBlockquotes can contain any outline writing convention, including other blockquotes.\r\n\r\nMarkup\r\n ````\r\n > Thank you for replying to my blog!\r\n >\r\n > > I hate oranges for the following reasons:\r\n > >\r\n > > 1. They\'re not apples.\r\n > > 2. They\'re not bananas.\r\n >\r\n > I completely understand.\r\n ````\r\n\r\nOutput\r\n > Thank you for replying to my blog!\r\n >\r\n > > I hate oranges for the following reasons:\r\n > >\r\n > > 1. They\'re not apples.\r\n > > 2. They\'re not bananas.\r\n >\r\n > I completely understand.\r\n\r\n\r\n===============\r\nThematic breaks\r\n===============\r\n\r\nUse the thematic break convention to represent a change of subject.\r\n\r\nA thematic break can be represented by 3 or more consecutive blank lines.\r\n\r\nMarkup\r\n ````\r\n I vowed never to eat apples again.\r\n\r\n\r\n\r\n By mid-March, a second flock of birds had moved into my dining room.\r\n ````\r\n\r\nOutput\r\n I vowed never to eat apples again.\r\n\r\n\r\n\r\n By mid-March, a second flock of birds had moved into my dining room.\r\n\r\nA thematic break can *also* be represented by a line consisting of 3 or more of the following characters:\r\n\r\n- Hyphens: `-`\r\n- Number signs: `#`\r\n- Equal signs: `=`\r\n- Plus signs: `+`\r\n- Tildes: `~`\r\n- Colons: `:`\r\n- Asterisks: `*`\r\n- At signs: `@`\r\n\r\nYou can use any combination of those characters!\r\n\r\nMarkup\r\n ````\r\n I vowed never to eat apples again.\r\n\r\n #=*=*=*=*=*=*=*=*=*=#\r\n\r\n By mid-March, a second flock of birds had moved into my dining room.\r\n ````\r\n\r\nOutput\r\n I vowed never to eat apples again.\r\n\r\n #=*=*=*=*=*=*=*=*=*=#\r\n\r\n By mid-March, a second flock of birds had moved into my dining room.\r\n\r\n\r\n==============\r\nBulleted lists\r\n==============\r\n\r\nYou already know what a bulleted list is!\r\n\r\nMarkup\r\n ````\r\n - Buy milk\r\n - Buy bread\r\n - Buy happiness\r\n ````\r\n\r\nOutput\r\n - Buy milk\r\n - Buy bread\r\n - Buy happiness\r\n\r\n\r\nBullets\r\n=======\r\n\r\nIn a bulleted list, each item starts with a bullet character followed by a space. The following characters can serve as a bullet:\r\n\r\n- A hyphen: `-`\r\n- An asterisk: `*`\r\n- An actual bullet character: `•`\r\n\r\n\r\nSpacing between list items\r\n==========================\r\n\r\nEach bulleted list item can be followed by a single blank line.\r\n\r\nMarkup\r\n ````\r\n - Buy milk\r\n\r\n - Buy bread\r\n\r\n - Buy happiness\r\n ````\r\n\r\nOutput\r\n - Buy milk\r\n\r\n - Buy bread\r\n\r\n - Buy happiness\r\n\r\nOn the other hand, if a list item is followed by 2 blank lines, it marks the end of the list.\r\n\r\nMarkup\r\n ````\r\n - Buy milk\r\n - Buy bread\r\n\r\n\r\n - Fix squeaky cabinet\r\n - Fix self-esteem\r\n ````\r\n\r\nOutput\r\n - Buy milk\r\n - Buy bread\r\n\r\n\r\n - Fix squeaky cabinet\r\n - Fix self-esteem\r\n\r\n\r\nList items consisting of multiple lines\r\n=======================================\r\n\r\nList items aren\'t limited to a single line! Bulleted lists can contain any outline writing convention, including other bulleted lists.\r\n\r\nIf your list item contains more than one line, subsequent lines should be indented 2 spaces (or a tab).\r\n\r\nMarkup\r\n ````\r\n - Buy milk.\r\n\r\n If whole milk is on sale, buy that. Otherwise, buy 2%.\r\n\r\n - Buy bread.\r\n\r\n Only buy bread from one of the following brands:\r\n\r\n * Little Northern Bakehouse\r\n * Udi\'s\r\n * Canyon Bakehouse\r\n\r\n - Buy happiness.\r\n\r\n Don\'t spend more than a few cents on this.\r\n ````\r\n\r\nOutput\r\n - Buy milk.\r\n\r\n If whole milk is on sale, buy that. Otherwise, buy 2%.\r\n\r\n - Buy bread.\r\n\r\n Only buy bread from one of the following brands:\r\n\r\n * Little Northern Bakehouse\r\n * Udi\'s\r\n * Canyon Bakehouse\r\n\r\n - Buy happiness.\r\n\r\n Don\'t spend more than a few cents on this. Not worth it.\r\n\r\n\r\n==============\r\nNumbered lists\r\n==============\r\n\r\nYou already know what a numbered list is!\r\n\r\nMarkup\r\n ````\r\n 1. Buy milk\r\n 2. Buy bread\r\n 3. Buy happiness\r\n ````\r\n\r\nOutput\r\n 1. Buy milk\r\n 2. Buy bread\r\n 3. Buy happiness\r\n\r\nNumbered lists are nearly identical to [topic: bulleted lists]---the only difference is that numbered list items have ordinals, not bullets.\r\n\r\nThe ordinal for a numbered list item can be expressed several ways:\r\n\r\n- An integer followed by a period: `1.`\r\n- An integer followed by a closing parenthesis: `1)`\r\n- A number sign: `#`\r\n- A number sign followed by a period: `#.`\r\n- A number sign followed by a closing parenthesis: `#)`\r\n\r\nLike each bullet in a bulleted list, each ordinal in a numbered list must be followed by a space.\r\n\r\n\r\nLists starting at a specific number\r\n===================================\r\n\r\nNumbered lists don\'t have to start at `1`.\r\n\r\nMarkup\r\n ````\r\n 3) March\r\n #) April\r\n #) May\r\n ````\r\n\r\nOutput\r\n 3) March\r\n #) April\r\n #) May\r\n\r\n\r\nLists in descending order\r\n=========================\r\n\r\nUp automatically recognizes when a numbered list is in descending order.\r\n\r\nIf a numbered list has at least two items with *integer* ordinals (as opposed to number signs), and if the first integer is greater than the second, Up considers the list to be in descending order.\r\n\r\nMarkup\r\n ````\r\n 3) Buy milk\r\n 2) Buy bread\r\n #) Buy happiness\r\n ````\r\n\r\nOutput\r\n 3) Buy milk\r\n 2) Buy bread\r\n #) Buy happiness\r\n\r\n\r\nSingle-item numbered lists\r\n==========================\r\n\r\nLike bulleted lists, numbered lists can consist of a single item.\r\n\r\nMarkup\r\n ````\r\n 1) Buy milk\r\n ````\r\n\r\nOutput\r\n 1) Buy milk\r\n\r\nThere\'s a small exception to this rule: If your list item\'s ordinal is expressed as an integer followed by a period (e.g. `1.`), you must have more than one list item. This exception helps prevent "accidental" numbered lists.\r\n\r\nMarkup\r\n ````\r\n 1783. Not a good year for Great Britain.\r\n ````\r\n\r\nOutput\r\n 1783. Not a good year for Great Britain.\r\n\r\n\r\n=================\r\nDescription lists\r\n=================\r\n\r\nUse description lists represent a collection of subjects and their descriptions.\r\n\r\nYou can use description lists for:\r\n\r\n- Terms and definitions\r\n- Questions and answers\r\n- Any collection of subjects and descriptions!\r\n\r\nMarkup\r\n ````\r\n Kirby\'s Dreamland\r\n A video game about a flying marshmallow.\r\n\r\n Super Mario Land\r\n A video game about a jumping plumber.\r\n ````\r\n\r\nOutput\r\n Kirby\'s Dreamland\r\n A video game about a flying marshmallow.\r\n\r\n Super Mario Land\r\n A video game about a jumping plumber.\r\n\r\nEvery item in a description list consists of two parts:\r\n\r\n1. One or more subjects\r\n2. A single description of those subjects\r\n\r\n\r\nSubjects\r\n========\r\n\r\nSubjects can contain any inline writing convention.\r\n\r\nMarkup\r\n ````\r\n ``\r\n An HTML element representing numbered lists.\r\n\r\n `