window.CodeMirror=function(){"use strict";function w(a,c){if(!(this instanceof w))return new w(a,c);this.options=c=c||{};for(var d in $c)!c.hasOwnProperty(d)&&$c.hasOwnProperty(d)&&(c[d]=$c[d]);I(c);var e="string"==typeof c.value?0:c.value.first,f=this.display=x(a,e);f.wrapper.CodeMirror=this,F(this),c.autofocus&&!o&&Mb(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,draggingText:!1,highlight:new We},D(this),c.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap");var g=c.value;"string"==typeof g&&(g=new fe(c.value,c.mode)),Eb(this,je)(this,g),b&&setTimeout(ef(Lb,this,!0),20),Ob(this);var h;try{h=document.activeElement==f.input}catch(i){}h||c.autofocus&&!o?setTimeout(ef(lc,this),20):mc(this),Eb(this,function(){for(var a in Zc)Zc.propertyIsEnumerable(a)&&Zc[a](this,c[a],ad);for(var b=0;bb.maxLineLength&&(b.maxLineLength=d,b.maxLine=a)})}function I(a){for(var b=!1,c=0;cb.scroller.clientWidth+1,g=e>b.scroller.clientHeight+1;g?(b.scrollbarV.style.display="block",b.scrollbarV.style.bottom=f?sf(b.measure)+"px":"0",b.scrollbarV.firstChild.style.height=e-b.scroller.clientHeight+b.scrollbarV.clientHeight+"px"):(b.scrollbarV.style.display="",b.scrollbarV.firstChild.style.height="0"),f?(b.scrollbarH.style.display="block",b.scrollbarH.style.right=g?sf(b.measure)+"px":"0",b.scrollbarH.firstChild.style.width=b.scroller.scrollWidth-b.scroller.clientWidth+b.scrollbarH.clientWidth+"px"):(b.scrollbarH.style.display="",b.scrollbarH.firstChild.style.width="0"),f&&g?(b.scrollbarFiller.style.display="block",b.scrollbarFiller.style.height=b.scrollbarFiller.style.width=sf(b.measure)+"px"):b.scrollbarFiller.style.display="",f&&a.options.coverGutterNextToScrollbar&&a.options.fixedGutter?(b.gutterFiller.style.display="block",b.gutterFiller.style.height=sf(b.measure)+"px",b.gutterFiller.style.width=b.gutters.offsetWidth+"px"):b.gutterFiller.style.display="",k&&0===sf(b.measure)&&(b.scrollbarV.style.minWidth=b.scrollbarH.style.minHeight=l?"18px":"12px")}function K(a,b,c){var d=a.scroller.scrollTop,e=a.wrapper.clientHeight;"number"==typeof c?d=c:c&&(d=c.top,e=c.bottom-c.top),d=Math.floor(d-eb(a));var f=Math.ceil(d+e);return{from:pe(b,d),to:pe(b,f)}}function L(a){var b=a.display;if(b.alignWidgets||b.gutters.firstChild&&a.options.fixedGutter){for(var c=O(b)-b.scroller.scrollLeft+a.doc.scrollLeft,d=b.gutters.offsetWidth,e=c+"px",f=b.lineDiv.firstChild;f;f=f.nextSibling)if(f.alignable)for(var g=0,h=f.alignable;g=a.display.showingFrom&&h.to<=a.display.showingTo));)b=[];return g&&(Pe(a,"update",a),(a.display.showingFrom!=e||a.display.showingTo!=f)&&Pe(a,"viewportChange",a,a.display.showingFrom,a.display.showingTo)),g}function Q(a,b,c,d){var e=a.display,f=a.doc;if(!e.wrapper.clientWidth)return e.showingFrom=e.showingTo=f.first,e.viewOffset=0,void 0;if(!(!d&&0==b.length&&c.from>e.showingFrom&&c.tol&&e.showingTo-l<20&&(l=Math.min(j,e.showingTo)),v)for(k=oe(Ed(f,ke(f,k)));j>l&&Fd(f,ke(f,l));)++l;var m=[{from:Math.max(e.showingFrom,f.first),to:Math.min(e.showingTo,j)}];if(m=m[0].from>=m[0].to?[]:T(m,b),v)for(var i=0;in.from)){m.splice(i--,1);break}n.to=p}for(var q=0,i=0;il&&(n.to=l),n.from>=n.to?m.splice(i--,1):q+=n.to-n.from}if(!d&&q==l-k&&k==e.showingFrom&&l==e.showingTo)return S(a),void 0;m.sort(function(a,b){return a.from-b.from});try{var r=document.activeElement}catch(s){}.7*(l-k)>q&&(e.lineDiv.style.display="none"),V(a,k,l,m,h),e.lineDiv.style.display="",r&&document.activeElement!=r&&r.offsetHeight&&r.focus();var t=k!=e.showingFrom||l!=e.showingTo||e.lastSizeC!=e.wrapper.clientHeight;return t&&(e.lastSizeC=e.wrapper.clientHeight,ab(a,400)),e.showingFrom=k,e.showingTo=l,R(a),S(a),!0}}function R(a){for(var f,b=a.display,d=b.lineDiv.offsetTop,e=b.lineDiv.firstChild;e;e=e.nextSibling)if(e.lineObj){if(c){var g=e.offsetTop+e.offsetHeight;f=g-d,d=g}else{var h=of(e);f=h.bottom-h.top}var i=e.lineObj.height-f;if(2>f&&(f=zb(b)),i>.001||-.001>i){ne(e.lineObj,f);var j=e.lineObj.widgets;if(j)for(var k=0;kc;++c){for(var e=b[c],f=[],g=e.diff||0,h=0,i=a.length;i>h;++h){var j=a[h];e.to<=j.from&&e.diff?f.push({from:j.from+g,to:j.to+g}):e.to<=j.from||e.from>=j.to?f.push(j):(e.from>j.from&&f.push({from:j.from,to:e.from}),e.ton){for(;k.lineObj!=b;)k=l(k);i&&n>=f&&k.lineNumber&&nf(k.lineNumber,N(a.options,n)),k=k.nextSibling}else{if(b.widgets)for(var s,q=0,r=k;r&&20>q;++q,r=r.nextSibling)if(r.lineObj==b&&/div/i.test(r.nodeName)){s=r;break}var t=W(a,b,n,g,s);if(t!=s)j.insertBefore(t,k);else{for(;k!=s;)k=l(k);k=k.nextSibling}t.lineObj=b}++n});k;)k=l(k)}function W(a,b,d,e,f){var j,g=Wd(a,b),h=b.gutterMarkers,i=a.display;if(!(a.options.lineNumbers||h||b.bgClass||b.wrapClass||b.widgets))return g;if(f){f.alignable=null;for(var o,k=!0,l=0,m=null,n=f.firstChild;n;n=o)if(o=n.nextSibling,/\bCodeMirror-linewidget\b/.test(n.className)){for(var p=0;pb&&(b=0),e.appendChild(kf("div",null,"CodeMirror-selected","position: absolute; left: "+a+"px; top: "+b+"px; width: "+(null==c?f-a:c)+"px; height: "+(d-b)+"px"))}function i(b,d,e){function m(c,d){return tb(a,Ac(b,c),"div",i,d)}var k,l,i=ke(c,b),j=i.text.length;return zf(re(i),d||0,null==e?j:e,function(a,b,c){var n,o,p,i=m(a,"left");if(a==b)n=i,o=p=i.left;else{if(n=m(b-1,"right"),"rtl"==c){var q=i;i=n,n=q}o=i.left,p=n.right}null==d&&0==a&&(o=g),n.top-i.top>3&&(h(o,i.top,null,i.bottom),o=g,i.bottoml.bottom||n.bottom==l.bottom&&n.right>l.right)&&(l=n),g+1>o&&(o=g),h(o,n.top,p-o,n.bottom)}),{start:k,end:l}}var b=a.display,c=a.doc,d=a.doc.sel,e=document.createDocumentFragment(),f=b.lineSpace.offsetWidth,g=gb(a.display);if(d.from.line==d.to.line)i(d.from.line,d.from.ch,d.to.ch);else{var j=ke(c,d.from.line),k=ke(c,d.to.line),l=Ed(c,j)==Ed(c,k),m=i(d.from.line,d.from.ch,l?j.text.length:null).end,n=i(d.to.line,l?0:null,d.to.ch).start;l&&(m.top0&&(b.blinker=setInterval(function(){b.cursor.style.visibility=b.otherCursor.style.visibility=(c=!c)?"":"hidden"},a.options.cursorBlinkRate))}}function ab(a,b){a.doc.mode.startState&&a.doc.frontier=a.display.showingTo)){var f,c=+new Date+a.options.workTime,d=gd(b.mode,db(a,b.frontier)),e=[];b.iter(b.frontier,Math.min(b.first+b.size,a.display.showingTo+500),function(g){if(b.frontier>=a.display.showingFrom){var h=g.styles;g.styles=Rd(a,g,d);for(var i=!h||h.length!=g.styles.length,j=0;!i&&jc?(ab(a,a.options.workDelay),!0):void 0}),e.length&&Eb(a,function(){for(var a=0;ai;--h){if(h<=f.first)return f.first;var j=ke(f,h-1);if(j.stateAfter&&(!c||h<=f.frontier))return h;var k=Xe(j.text,null,a.options.tabSize);(null==e||d>k)&&(e=h-1,d=k)}return e}function db(a,b,c){var d=a.doc,e=a.display;if(!d.mode.startState)return!0;var f=cb(a,b,c),g=f>d.first&&ke(d,f-1).stateAfter;return g=g?gd(d.mode,g):hd(d.mode),d.iter(f,b,function(c){Td(a,c,g);var h=f==b-1||0==f%5||f>=e.showingFrom&&ff&&0==h&&(f=1)}return e=h>c?"left":c>h?"right":e,"left"==e&&i.leftSide?i=i.leftSide:"right"==e&&i.rightSide&&(i=i.rightSide),{left:c>h?i.right:i.left,right:h>c?i.left:i.right,top:i.top,bottom:i.bottom}}function ib(a,b){for(var c=a.display.measureLineCache,d=0;ds&&(c=s),0>b&&(b=0);for(var d=q.length-2;d>=0;d-=2){var e=q[d],f=q[d+1];if(!(e>c||b>f)&&(b>=e&&f>=c||e>=b&&c>=f||Math.min(c,f)-Math.max(b,e)>=c-b>>1)){q[d]=Math.min(b,e),q[d+1]=Math.max(c,f);break}}return 0>d&&(d=q.length,q.push(b,c)),{left:a.left-p.left,right:a.right-p.left,top:d,bottom:null}}function u(a){a.bottom=q[a.top+1],a.top=q[a.top]}if(!a.options.lineWrapping&&e.text.length>=a.options.crudeMeasuringFrom)return mb(a,e);var f=a.display,g=df(e.text.length),h=Wd(a,e,g,!0);if(b&&!c&&!a.options.lineWrapping&&h.childNodes.length>100){for(var i=document.createDocumentFragment(),j=10,k=h.childNodes.length,l=0,m=Math.ceil(k/j);m>l;++l){for(var n=kf("div",null,null,"display: inline-block"),o=0;j>o&&k;++o)n.appendChild(h.firstChild),--k;i.appendChild(n)}h.appendChild(i)}mf(f.measure,h);var p=of(f.lineDiv),q=[],r=df(e.text.length),s=h.offsetHeight;d&&f.measure.first!=h&&mf(f.measure,h);for(var v,l=0;l1&&(x=r[l]=t(y[0]),x.rightSide=t(y[y.length-1]))}x||(x=r[l]=t(of(w))),v.measureRight&&(x.right=of(v.measureRight).left),v.leftSide&&(x.leftSide=t(of(v.leftSide)))}lf(a.display.measure);for(var v,l=0;l=a.options.crudeMeasuringFrom)return hb(a,b,b.text.length,f&&f.measure,"right").right;var g=Wd(a,b,null,!0),h=g.appendChild(uf(a.display.measure));return mf(a.display.measure,g),of(h).right-of(a.display.lineDiv).left}function ob(a){a.display.measureLineCache.length=a.display.measureLineCachePos=0,a.display.cachedCharWidth=a.display.cachedTextHeight=null,a.options.lineWrapping||(a.display.maxLineChanged=!0),a.display.lineNumChars=null}function pb(){return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function qb(){return window.pageYOffset||(document.documentElement||document.body).scrollTop}function rb(a,b,c,d){if(b.widgets)for(var e=0;ec.from?f(a-1):f(a,d)}d=d||ke(a.doc,b.line),e||(e=kb(a,d));var h=re(d),i=b.ch;if(!h)return f(i);var j=If(h,i),k=g(i,j);return null!=Hf&&(k.other=g(i,Hf)),k}function vb(a,b,c,d){var e=new Ac(a,b);return e.xRel=d,c&&(e.outside=!0),e}function wb(a,b,c){var d=a.doc;if(c+=a.display.viewOffset,0>c)return vb(d.first,0,!0,-1);var e=pe(d,c),f=d.first+d.size-1;if(e>f)return vb(d.first+d.size-1,ke(d,f).text.length,!0,1);for(0>b&&(b=0);;){var g=ke(d,e),h=xb(a,g,e,b,c),i=Dd(g),j=i&&i.find();if(!i||!(h.ch>j.from.ch||h.ch==j.from.ch&&h.xRel>0))return h;e=j.to.line}}function xb(a,b,c,d,e){function j(d){var e=ub(a,Ac(c,d),"line",b,i);return g=!0,f>e.bottom?e.left-h:fq)return vb(c,n,r,1);for(;;){if(k?n==m||n==Kf(b,m,1):1>=n-m){for(var s=o>d||q-d>=d-o?m:n,t=d-(s==m?o:q);jf.test(b.text.charAt(s));)++s;var u=vb(c,s,s==m?p:r,0>t?-1:t?1:0);return u}var v=Math.ceil(l/2),w=m+v;if(k){w=m;for(var x=0;v>x;++x)w=Kf(b,w,1)}var y=j(w);y>d?(n=w,q=y,(r=g)&&(q+=1e3),l=v):(m=w,o=y,p=g,l-=v)}}function zb(a){if(null!=a.cachedTextHeight)return a.cachedTextHeight;if(null==yb){yb=kf("pre");for(var b=0;49>b;++b)yb.appendChild(document.createTextNode("x")),yb.appendChild(kf("br"));yb.appendChild(document.createTextNode("x"))}mf(a.measure,yb);var c=yb.offsetHeight/50;return c>3&&(a.cachedTextHeight=c),lf(a.measure),c||1}function Ab(a){if(null!=a.cachedCharWidth)return a.cachedCharWidth;var b=kf("span","x"),c=kf("pre",[b]);mf(a.measure,c);var d=b.offsetWidth;return d>2&&(a.cachedCharWidth=d),d||10}function Cb(a){a.curOp={changes:[],forceUpdate:!1,updateInput:null,userSelChange:null,textChanged:null,selectionChanged:!1,cursorActivity:!1,updateMaxLine:!1,updateScrollPos:!1,id:++Bb},Oe++||(Ne=[])}function Db(a){var b=a.curOp,c=a.doc,d=a.display;if(a.curOp=null,b.updateMaxLine&&H(a),d.maxLineChanged&&!a.options.lineWrapping&&d.maxLine){var e=nb(a,d.maxLine);d.sizer.style.minWidth=Math.max(0,e+3+Ue)+"px",d.maxLineChanged=!1;var f=Math.max(0,d.sizer.offsetLeft+d.sizer.offsetWidth-d.scroller.clientWidth);fj&&e.charCodeAt(j)==h.charCodeAt(j);)++j;var l=g.from,m=g.to;j1e3||h.indexOf("\n")>-1?c.value=a.display.prevInput="":a.display.prevInput=h,i&&Db(a),a.state.pasteIncoming=!1,!0}function Lb(a,c){var e,f,g=a.doc;if(Bc(g.sel.from,g.sel.to))c&&(a.display.prevInput=a.display.input.value="",b&&!d&&(a.display.inputHasSelection=null));else{a.display.prevInput="",e=xf&&(g.sel.to.line-g.sel.from.line>100||(f=a.getSelection()).length>1e3);var h=e?"-":f||a.getSelection();a.display.input.value=h,a.state.focused&&_e(a.display.input),b&&!d&&(a.display.inputHasSelection=h)}a.display.inaccurateSelection=e}function Mb(a){"nocursor"==a.options.readOnly||o&&document.activeElement==a.display.input||a.display.input.focus()}function Nb(a){return a.options.readOnly||a.doc.cantEdit}function Ob(a){function d(){a.state.focused&&setTimeout(ef(Mb,a),0)}function g(){null==f&&(f=setTimeout(function(){f=null,c.cachedCharWidth=c.cachedTextHeight=rf=null,ob(a),Gb(a,ef(Hb,a))},100))}function h(){for(var a=c.wrapper.parentNode;a&&a!=document.body;a=a.parentNode);a?setTimeout(h,5e3):Le(window,"resize",g)}function i(b){Qe(a,b)||a.options.onDragEvent&&a.options.onDragEvent(a,De(b))||He(b)}function k(){c.inaccurateSelection&&(c.prevInput="",c.inaccurateSelection=!1,c.input.value=a.getSelection(),_e(c.input))}var c=a.display;Ke(c.scroller,"mousedown",Eb(a,Tb)),b?Ke(c.scroller,"dblclick",Eb(a,function(b){if(!Qe(a,b)){var c=Qb(a,b);if(c&&!Wb(a,b)&&!Pb(a.display,b)){Ee(b);var d=Xc(ke(a.doc,c.line).text,c);Ic(a.doc,d.from,d.to)}}})):Ke(c.scroller,"dblclick",function(b){Qe(a,b)||Ee(b)}),Ke(c.lineSpace,"selectstart",function(a){Pb(c,a)||Ee(a)}),t||Ke(c.scroller,"contextmenu",function(b){oc(a,b)}),Ke(c.scroller,"scroll",function(){c.scroller.clientHeight&&($b(a,c.scroller.scrollTop),_b(a,c.scroller.scrollLeft,!0),Me(a,"scroll",a))}),Ke(c.scrollbarV,"scroll",function(){c.scroller.clientHeight&&$b(a,c.scrollbarV.scrollTop)}),Ke(c.scrollbarH,"scroll",function(){c.scroller.clientHeight&&_b(a,c.scrollbarH.scrollLeft)}),Ke(c.scroller,"mousewheel",function(b){cc(a,b)}),Ke(c.scroller,"DOMMouseScroll",function(b){cc(a,b)}),Ke(c.scrollbarH,"mousedown",d),Ke(c.scrollbarV,"mousedown",d),Ke(c.wrapper,"scroll",function(){c.wrapper.scrollTop=c.wrapper.scrollLeft=0});var f;Ke(window,"resize",g),setTimeout(h,5e3),Ke(c.input,"keyup",Eb(a,function(b){Qe(a,b)||a.options.onKeyEvent&&a.options.onKeyEvent(a,De(b))||16==b.keyCode&&(a.doc.sel.shift=!1)})),Ke(c.input,"input",ef(Jb,a)),Ke(c.input,"keydown",Eb(a,jc)),Ke(c.input,"keypress",Eb(a,kc)),Ke(c.input,"focus",ef(lc,a)),Ke(c.input,"blur",ef(mc,a)),a.options.dragDrop&&(Ke(c.scroller,"dragstart",function(b){Zb(a,b)}),Ke(c.scroller,"dragenter",i),Ke(c.scroller,"dragover",i),Ke(c.scroller,"drop",Eb(a,Yb))),Ke(c.scroller,"paste",function(b){Pb(c,b)||(Mb(a),Jb(a))}),Ke(c.input,"paste",function(){if(e&&!a.state.fakedLastChar&&!(new Date-a.state.lastMiddleDown<200)){var b=c.input.selectionStart,d=c.input.selectionEnd;c.input.value+="$",c.input.selectionStart=b,c.input.selectionEnd=d,a.state.fakedLastChar=!0}a.state.pasteIncoming=!0,Jb(a)}),Ke(c.input,"cut",k),Ke(c.input,"copy",k),j&&Ke(c.sizer,"mouseup",function(){document.activeElement==c.input&&c.input.blur(),Mb(a)})}function Pb(a,b){for(var c=Ie(b);c!=a.wrapper;c=c.parentNode)if(!c||c.ignoreEvents||c.parentNode==a.sizer&&c!=a.mover)return!0}function Qb(a,b,c){var d=a.display;if(!c){var e=Ie(b);if(e==d.scrollbarH||e==d.scrollbarH.firstChild||e==d.scrollbarV||e==d.scrollbarV.firstChild||e==d.scrollbarFiller||e==d.gutterFiller)return null}var f,g,h=of(d.lineSpace);try{f=b.clientX,g=b.clientY}catch(b){return null}return wb(a,f-h.left,g-h.top)}function Tb(a){function q(a){if(!Bc(p,a)){if(p=a,"single"==j)return Ic(c.doc,Fc(f,h),a),void 0;if(n=Fc(f,n),o=Fc(f,o),"double"==j){var b=Xc(ke(f,a.line).text,a);Cc(a,n)?Ic(c.doc,b.from,o):Ic(c.doc,n,b.to)}else"triple"==j&&(Cc(a,n)?Ic(c.doc,o,Fc(f,Ac(a.line,0))):Ic(c.doc,n,Fc(f,Ac(a.line+1,0))))}}function u(a){var b=++s,e=Qb(c,a,!0);if(e)if(Bc(e,l)){var h=a.clientYr.bottom?20:0;h&&setTimeout(Eb(c,function(){s==b&&(d.scroller.scrollTop+=h,u(a))}),50)}else{c.state.focused||lc(c),l=e,q(e);var g=K(d,f);(e.line>=g.to||e.linei-400&&Bc(Sb.pos,h))j="triple",Ee(a),setTimeout(ef(Mb,c),20),Yc(c,h.line);else if(Rb&&Rb.time>i-400&&Bc(Rb.pos,h)){j="double",Sb={time:i,pos:h},Ee(a);var k=Xc(ke(f,h.line).text,h);Ic(c.doc,k.from,k.to)}else Rb={time:i,pos:h};var l=h;if(c.options.dragDrop&&pf&&!Nb(c)&&!Bc(g.from,g.to)&&!Cc(h,g.from)&&!Cc(g.to,h)&&"single"==j){var m=Eb(c,function(b){e&&(d.scroller.draggable=!1),c.state.draggingText=!1,Le(document,"mouseup",m),Le(d.scroller,"drop",m),Math.abs(a.clientX-b.clientX)+Math.abs(a.clientY-b.clientY)<10&&(Ee(b),Ic(c.doc,h),Mb(c))});return e&&(d.scroller.draggable=!0),c.state.draggingText=m,d.scroller.dragDrop&&d.scroller.dragDrop(),Ke(document,"mouseup",m),Ke(d.scroller,"drop",m),void 0}Ee(a),"single"==j&&Ic(c.doc,Fc(f,h));var n=g.from,o=g.to,p=h,r=of(d.wrapper),s=0,w=Eb(c,function(a){b||Je(a)?u(a):v(a)}),x=Eb(c,v);Ke(document,"mousemove",w),Ke(document,"mouseup",x)}}}function Ub(a,b,c,d,e){try{var f=b.clientX,g=b.clientY}catch(b){return!1}if(f>=Math.floor(of(a.display.gutters).right))return!1;d&&Ee(b);var h=a.display,i=of(h.lineDiv);if(g>i.bottom||!Se(a,c))return Ge(b);g-=i.top-h.viewOffset;for(var j=0;j=f){var l=pe(a.doc,g),m=a.options.gutters[j];return e(a,c,a,l,m,b),Ge(b)}}}function Vb(a,b){return Se(a,"gutterContextMenu")?Ub(a,b,"gutterContextMenu",!1,Me):!1}function Wb(a,b){return Ub(a,b,"gutterClick",!0,Pe)}function Yb(a){var c=this;if(!(Qe(c,a)||Pb(c.display,a)||c.options.onDragEvent&&c.options.onDragEvent(c,De(a)))){Ee(a),b&&(Xb=+new Date);var d=Qb(c,a,!0),e=a.dataTransfer.files;if(d&&!Nb(c))if(e&&e.length&&window.FileReader&&window.File)for(var f=e.length,g=Array(f),h=0,i=function(a,b){var e=new FileReader;e.onload=function(){g[b]=e.result,++h==f&&(d=Fc(c.doc,d),tc(c.doc,{from:d,to:d,text:vf(g.join("\n")),origin:"paste"},"around"))},e.readAsText(a)},j=0;f>j;++j)i(e[j],j);else{if(c.state.draggingText&&!Cc(d,c.doc.sel.from)&&!Cc(c.doc.sel.to,d))return c.state.draggingText(a),setTimeout(ef(Mb,c),20),void 0;try{var g=a.dataTransfer.getData("Text");if(g){var k=c.doc.sel.from,l=c.doc.sel.to;Kc(c.doc,d,d),c.state.draggingText&&zc(c.doc,"",k,l,"paste"),c.replaceSelection(g,null,"paste"),Mb(c),lc(c)}}catch(a){}}}}function Zb(a,c){if(b&&(!a.state.draggingText||+new Date-Xb<100))return He(c),void 0;if(!Qe(a,c)&&!Pb(a.display,c)){var d=a.getSelection();if(c.dataTransfer.setData("Text",d),c.dataTransfer.setDragImage&&!i){var e=kf("img",null,null,"position: fixed; left: 0; top: 0;");h&&(e.width=e.height=1,a.display.wrapper.appendChild(e),e._top=e.offsetTop),c.dataTransfer.setDragImage(e,0,0),h&&e.parentNode.removeChild(e)}}}function $b(b,c){Math.abs(b.doc.scrollTop-c)<2||(b.doc.scrollTop=c,a||P(b,[],c),b.display.scroller.scrollTop!=c&&(b.display.scroller.scrollTop=c),b.display.scrollbarV.scrollTop!=c&&(b.display.scrollbarV.scrollTop=c),a&&P(b,[]),ab(b,100))}function _b(a,b,c){(c?b==a.doc.scrollLeft:Math.abs(a.doc.scrollLeft-b)<2)||(b=Math.min(b,a.display.scroller.scrollWidth-a.display.scroller.clientWidth),a.doc.scrollLeft=b,L(a),a.display.scroller.scrollLeft!=b&&(a.display.scroller.scrollLeft=b),a.display.scrollbarH.scrollLeft!=b&&(a.display.scrollbarH.scrollLeft=b))}function cc(b,c){var d=c.wheelDeltaX,f=c.wheelDeltaY;null==d&&c.detail&&c.axis==c.HORIZONTAL_AXIS&&(d=c.detail),null==f&&c.detail&&c.axis==c.VERTICAL_AXIS?f=c.detail:null==f&&(f=c.wheelDelta);var g=b.display,i=g.scroller;if(d&&i.scrollWidth>i.clientWidth||f&&i.scrollHeight>i.clientHeight){if(f&&p&&e)for(var j=c.target;j!=i;j=j.parentNode)if(j.lineObj){b.display.currentWheelTarget=j;break}if(d&&!a&&!h&&null!=bc)return f&&$b(b,Math.max(0,Math.min(i.scrollTop+f*bc,i.scrollHeight-i.clientHeight))),_b(b,Math.max(0,Math.min(i.scrollLeft+d*bc,i.scrollWidth-i.clientWidth))),Ee(c),g.wheelStartX=null,void 0;if(f&&null!=bc){var k=f*bc,l=b.doc.scrollTop,m=l+g.wrapper.clientHeight;0>k?l=Math.max(0,l+k-50):m=Math.min(b.doc.height,m+k+50),P(b,[],{top:l,bottom:m})}20>ac&&(null==g.wheelStartX?(g.wheelStartX=i.scrollLeft,g.wheelStartY=i.scrollTop,g.wheelDX=d,g.wheelDY=f,setTimeout(function(){if(null!=g.wheelStartX){var a=i.scrollLeft-g.wheelStartX,b=i.scrollTop-g.wheelStartY,c=b&&g.wheelDY&&b/g.wheelDY||a&&g.wheelDX&&a/g.wheelDX;g.wheelStartX=g.wheelStartY=null,c&&(bc=(bc*ac+c)/(ac+1),++ac)}},200)):(g.wheelDX+=d,g.wheelDY+=f))}}function dc(a,b,c){if("string"==typeof b&&(b=id[b],!b))return!1;a.display.pollingFast&&Kb(a)&&(a.display.pollingFast=!1);var d=a.doc,e=d.sel.shift,f=!1;try{Nb(a)&&(a.state.suppressEdits=!0),c&&(d.sel.shift=!1),f=b(a)!=Ve}finally{d.sel.shift=e,a.state.suppressEdits=!1}return f}function ec(a){var b=a.state.keyMaps.slice(0);return a.options.extraKeys&&b.push(a.options.extraKeys),b.push(a.options.keyMap),b}function gc(a,b){var c=kd(a.options.keyMap),e=c.auto;clearTimeout(fc),e&&!md(b)&&(fc=setTimeout(function(){kd(a.options.keyMap)==c&&(a.options.keyMap=e.call?e.call(null,a):e,C(a))},50));var f=nd(b,!0),g=!1;if(!f)return!1;var h=ec(a);return g=b.shiftKey?ld("Shift-"+f,h,function(b){return dc(a,b,!0)})||ld(f,h,function(b){return("string"==typeof b?/^go[A-Z]/.test(b):b.motion)?dc(a,b):void 0}):ld(f,h,function(b){return dc(a,b)}),g&&(Ee(b),_(a),d&&(b.oldKeyCode=b.keyCode,b.keyCode=0),Pe(a,"keyHandled",a,f,b)),g}function hc(a,b,c){var d=ld("'"+c+"'",ec(a),function(b){return dc(a,b,!0)});return d&&(Ee(b),_(a),Pe(a,"keyHandled",a,"'"+c+"'",b)),d}function jc(a){var c=this;if(c.state.focused||lc(c),!(Qe(c,a)||c.options.onKeyEvent&&c.options.onKeyEvent(c,De(a)))){b&&27==a.keyCode&&(a.returnValue=!1);var d=a.keyCode;c.doc.sel.shift=16==d||a.shiftKey;var e=gc(c,a);h&&(ic=e?d:null,!e&&88==d&&!xf&&(p?a.metaKey:a.ctrlKey)&&c.replaceSelection(""))}}function kc(a){var c=this;if(!(Qe(c,a)||c.options.onKeyEvent&&c.options.onKeyEvent(c,De(a)))){var e=a.keyCode,f=a.charCode;if(h&&e==ic)return ic=null,Ee(a),void 0;if(!(h&&(!a.which||a.which<10)||j)||!gc(c,a)){var g=String.fromCharCode(null==f?e:f);this.options.electricChars&&this.doc.mode.electricChars&&this.options.smartIndent&&!Nb(this)&&this.doc.mode.electricChars.indexOf(g)>-1&&setTimeout(Eb(c,function(){Tc(c,c.doc.sel.to.line,"smart")}),75),hc(c,a,g)||(b&&!d&&(c.display.inputHasSelection=null),Jb(c))}}}function lc(a){"nocursor"!=a.options.readOnly&&(a.state.focused||(Me(a,"focus",a),a.state.focused=!0,-1==a.display.wrapper.className.search(/\bCodeMirror-focused\b/)&&(a.display.wrapper.className+=" CodeMirror-focused"),a.curOp||(Lb(a,!0),e&&setTimeout(ef(Lb,a,!0),0))),Ib(a),_(a))}function mc(a){a.state.focused&&(Me(a,"blur",a),a.state.focused=!1,a.display.wrapper.className=a.display.wrapper.className.replace(" CodeMirror-focused","")),clearInterval(a.display.blinker),setTimeout(function(){a.state.focused||(a.doc.sel.shift=!1)},150)}function oc(a,c){function k(){if(null!=e.input.selectionStart){var a=e.input.value="\u200b"+(Bc(f.from,f.to)?"":e.input.value);e.prevInput="\u200b",e.input.selectionStart=1,e.input.selectionEnd=a.length}}function l(){if(e.inputDiv.style.position="relative",e.input.style.cssText=j,d&&(e.scrollbarV.scrollTop=e.scroller.scrollTop=i),Ib(a),null!=e.input.selectionStart){(!b||d)&&k(),clearTimeout(nc);var c=0,f=function(){" "==e.prevInput&&0==e.input.selectionStart?Eb(a,id.selectAll)(a):c++<10?nc=setTimeout(f,500):Lb(a)};nc=setTimeout(f,200)}}if(!Qe(a,c,"contextmenu")){var e=a.display,f=a.doc.sel;if(!Pb(e,c)&&!Vb(a,c)){var g=Qb(a,c),i=e.scroller.scrollTop;if(g&&!h){(Bc(f.from,f.to)||Cc(g,f.from)||!Cc(g,f.to))&&Eb(a,Kc)(a.doc,g,g);var j=e.input.style.cssText;if(e.inputDiv.style.position="absolute",e.input.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(c.clientY-5)+"px; left: "+(c.clientX-5)+"px; z-index: 1000; background: white; outline: none;"+"border-width: 0; outline: none; overflow: hidden; opacity: .05; -ms-opacity: .05; filter: alpha(opacity=5);",Mb(a),Lb(a,!0),Bc(f.from,f.to)&&(e.input.value=e.prevInput=" "),b&&!d&&k(),t){He(c);var m=function(){Le(window,"mouseup",m),setTimeout(l,20)};Ke(window,"mouseup",m)}else setTimeout(l,50)}}}}function qc(a,b,c){if(!Cc(b.from,c))return Fc(a,c);var d=b.text.length-1-(b.to.line-b.from.line);if(c.line>b.to.line+d){var e=c.line-d,f=a.first+a.size-1;return e>f?Ac(f,ke(a,f).text.length):Gc(c,ke(a,e).text.length)}if(c.line==b.to.line+d)return Gc(c,$e(b.text).length+(1==b.text.length?b.from.ch:0)+ke(a,b.to.line).text.length-b.to.ch);var g=c.line-b.from.line;return Gc(c,b.text[g].length+(g?0:b.from.ch))}function rc(a,b,c){if(c&&"object"==typeof c)return{anchor:qc(a,b,c.anchor),head:qc(a,b,c.head)};if("start"==c)return{anchor:b.from,head:b.from};var d=pc(b);if("around"==c)return{anchor:b.from,head:d};if("end"==c)return{anchor:d,head:d};var e=function(a){if(Cc(a,b.from))return a;if(!Cc(b.to,a))return d;var c=a.line+b.text.length-(b.to.line-b.from.line)-1,e=a.ch;return a.line==b.to.line&&(e+=d.ch-b.to.ch),Ac(c,e)};return{anchor:e(a.sel.anchor),head:e(a.sel.head)}}function sc(a,b,c){var d={canceled:!1,from:b.from,to:b.to,text:b.text,origin:b.origin,cancel:function(){this.canceled=!0}};return c&&(d.update=function(b,c,d,e){b&&(this.from=Fc(a,b)),c&&(this.to=Fc(a,c)),d&&(this.text=d),void 0!==e&&(this.origin=e)}),Me(a,"beforeChange",a,d),a.cm&&Me(a.cm,"beforeChange",a.cm,d),d.canceled?null:{from:d.from,to:d.to,text:d.text,origin:d.origin}}function tc(a,b,c,d){if(a.cm){if(!a.cm.curOp)return Eb(a.cm,tc)(a,b,c,d);if(a.cm.state.suppressEdits)return}if(!(Se(a,"beforeChange")||a.cm&&Se(a.cm,"beforeChange"))||(b=sc(a,b,!0))){var e=u&&!d&&Ad(a,b.from,b.to);if(e){for(var f=e.length-1;f>=1;--f)uc(a,{from:e[f].from,to:e[f].to,text:[""]});e.length&&uc(a,{from:e[0].from,to:e[0].to,text:b.text},c)}else uc(a,b,c)}}function uc(a,b,c){var d=rc(a,b,c);ve(a,b,d,a.cm?a.cm.curOp.id:0/0),xc(a,b,d,yd(a,b));var e=[];ie(a,function(a,c){c||-1!=af(e,a.history)||(Be(a.history,b),e.push(a.history)),xc(a,b,null,yd(a,b))})}function vc(a,b){if(!a.cm||!a.cm.state.suppressEdits){var c=a.history,d=("undo"==b?c.done:c.undone).pop();if(d){var e={changes:[],anchorBefore:d.anchorAfter,headBefore:d.headAfter,anchorAfter:d.anchorBefore,headAfter:d.headBefore,generation:c.generation};("undo"==b?c.undone:c.done).push(e),c.generation=d.generation||++c.maxGeneration;for(var f=Se(a,"beforeChange")||a.cm&&Se(a.cm,"beforeChange"),g=d.changes.length-1;g>=0;--g){var h=d.changes[g];if(h.origin=b,f&&!sc(a,h,!1))return("undo"==b?c.done:c.undone).length=0,void 0;e.changes.push(ue(a,h));var i=g?rc(a,h,null):{anchor:d.anchorBefore,head:d.headBefore};xc(a,h,i,zd(a,h));var j=[];ie(a,function(a,b){b||-1!=af(j,a.history)||(Be(a.history,h),j.push(a.history)),xc(a,h,null,zd(a,h))})}}}}function wc(a,b){function c(a){return Ac(a.line+b,a.ch)}a.first+=b,a.cm&&Hb(a.cm,a.first,a.first,b),a.sel.head=c(a.sel.head),a.sel.anchor=c(a.sel.anchor),a.sel.from=c(a.sel.from),a.sel.to=c(a.sel.to)}function xc(a,b,c,d){if(a.cm&&!a.cm.curOp)return Eb(a.cm,xc)(a,b,c,d);if(b.to.linea.lastLine())){if(b.from.linef&&(b={from:b.from,to:Ac(f,ke(a,f).text.length),text:[b.text[0]],origin:b.origin}),b.removed=le(a,b.from,b.to),c||(c=rc(a,b,null)),a.cm?yc(a.cm,b,d,c):be(a,b,d,c)}}function yc(a,b,c,d){var e=a.doc,f=a.display,g=b.from,h=b.to,i=!1,j=g.line;a.options.lineWrapping||(j=oe(Ed(e,ke(e,g.line))),e.iter(j,h.line+1,function(a){return a==f.maxLine?(i=!0,!0):void 0})),Cc(e.sel.head,b.from)||Cc(b.to,e.sel.head)||(a.curOp.cursorActivity=!0),be(e,b,c,d,A(a)),a.options.lineWrapping||(e.iter(j,g.line+b.text.length,function(a){var b=G(e,a);b>f.maxLineLength&&(f.maxLine=a,f.maxLineLength=b,f.maxLineChanged=!0,i=!1)}),i&&(a.curOp.updateMaxLine=!0)),e.frontier=Math.min(e.frontier,g.line),ab(a,400);var k=b.text.length-(h.line-g.line)-1;if(Hb(a,g.line,h.line+1,k),Se(a,"change")){var l={from:g,to:h,text:b.text,removed:b.removed,origin:b.origin};if(a.curOp.textChanged){for(var m=a.curOp.textChanged;m.next;m=m.next);m.next=l}else a.curOp.textChanged=l}}function zc(a,b,c,d,e){if(d||(d=c),Cc(d,c)){var f=d;d=c,c=f}"string"==typeof b&&(b=vf(b)),tc(a,{from:c,to:d,text:b,origin:e},null)}function Ac(a,b){return this instanceof Ac?(this.line=a,this.ch=b,void 0):new Ac(a,b)}function Bc(a,b){return a.line==b.line&&a.ch==b.ch}function Cc(a,b){return a.linec?Ac(c,ke(a,c).text.length):Gc(b,ke(a,b.line).text.length)}function Gc(a,b){var c=a.ch;return null==c||c>b?Ac(a.line,b):0>c?Ac(a.line,0):a}function Hc(a,b){return b>=a.first&&b=f.ch:j.to>f.ch))){if(d&&(Me(k,"beforeCursorEnter"),k.explicitlyCleared)){if(h.markedSpans){--i;continue}break}if(!k.atomic)continue;var l=k.find()[0>g?"from":"to"];if(Bc(l,f)&&(l.ch+=g,l.ch<0?l=l.line>a.first?Fc(a,Ac(l.line-1)):null:l.ch>h.text.length&&(l=l.line(window.innerHeight||document.documentElement.clientHeight)&&(e=!1),null!=e&&!m){var f="none"==c.cursor.style.display;f&&(c.cursor.style.display="",c.cursor.style.left=b.left+"px",c.cursor.style.top=b.top-c.viewOffset+"px"),c.cursor.scrollIntoView(e),f&&(c.cursor.style.display="none")}}}function Oc(a,b,c){for(null==c&&(c=0);;){var d=!1,e=ub(a,b),f=Qc(a,e.left,e.top-c,e.left,e.bottom+c),g=a.doc.scrollTop,h=a.doc.scrollLeft;if(null!=f.scrollTop&&($b(a,f.scrollTop),Math.abs(a.doc.scrollTop-g)>1&&(d=!0)),null!=f.scrollLeft&&(_b(a,f.scrollLeft),Math.abs(a.doc.scrollLeft-h)>1&&(d=!0)),!d)return e}}function Pc(a,b,c,d,e){var f=Qc(a,b,c,d,e);null!=f.scrollTop&&$b(a,f.scrollTop),null!=f.scrollLeft&&_b(a,f.scrollLeft)}function Qc(a,b,c,d,e){var f=a.display,g=zb(a.display);0>c&&(c=0);var h=f.scroller.clientHeight-Ue,i=f.scroller.scrollTop,j={},k=a.doc.height+fb(f),l=g>c,m=e>k-g;if(i>c)j.scrollTop=l?0:c;else if(e>i+h){var n=Math.min(c,(m?k:e)-h);n!=i&&(j.scrollTop=n)}var o=f.scroller.clientWidth-Ue,p=f.scroller.scrollLeft;b+=f.gutters.offsetWidth,d+=f.gutters.offsetWidth;var q=f.gutters.offsetWidth,r=q+10>b;return p+q>b||r?(r&&(b=0),j.scrollLeft=Math.max(0,b-10-q)):d>o+p-3&&(j.scrollLeft=d+10-o),j}function Rc(a,b,c){a.curOp.updateScrollPos={scrollLeft:null==b?a.doc.scrollLeft:b,scrollTop:null==c?a.doc.scrollTop:c}}function Sc(a,b,c){var d=a.curOp.updateScrollPos||(a.curOp.updateScrollPos={scrollLeft:a.doc.scrollLeft,scrollTop:a.doc.scrollTop}),e=a.display.scroller;d.scrollTop=Math.max(0,Math.min(e.scrollHeight-e.clientHeight,d.scrollTop+c)),d.scrollLeft=Math.max(0,Math.min(e.scrollWidth-e.clientWidth,d.scrollLeft+b))}function Tc(a,b,c,d){var e=a.doc;if(null==c&&(c="add"),"smart"==c)if(a.doc.mode.indent)var f=db(a,b);else c="prev";var k,g=a.options.tabSize,h=ke(e,b),i=Xe(h.text,null,g),j=h.text.match(/^\s*/)[0];if("smart"==c&&(k=a.doc.mode.indent(f,h.text.slice(j.length),h.text),k==Ve)){if(!d)return;c="prev"}"prev"==c?k=b>e.first?Xe(ke(e,b-1).text,null,g):0:"add"==c?k=i+a.options.indentUnit:"subtract"==c?k=i-a.options.indentUnit:"number"==typeof c&&(k=i+c),k=Math.max(0,k);var l="",m=0;if(a.options.indentWithTabs)for(var n=Math.floor(k/g);n;--n)m+=g,l+=" ";k>m&&(l+=Ze(k-m)),l!=j&&zc(a.doc,l,Ac(b,0),Ac(b,j.length),"+input"),h.stateAfter=null}function Uc(a,b,c){var d=b,e=b,f=a.doc;return"number"==typeof b?e=ke(f,Ec(f,b)):d=oe(b),null==d?null:c(e,d)?(Hb(a,d,d+1),e):null}function Vc(a,b,c,d,e){function k(){var b=f+c;return b=a.first+a.size?j=!1:(f=b,i=ke(a,b))}function l(a){var b=(e?Kf:Lf)(i,g,c,!0);if(null==b){if(a||!k())return j=!1;g=e?(0>c?Df:Cf)(i):0>c?i.text.length:0}else g=b;return!0}var f=b.line,g=b.ch,h=c,i=ke(a,f),j=!0;if("char"==d)l();else if("column"==d)l(!0);else if("word"==d||"group"==d)for(var m=null,n="group"==d,o=!0;!(0>c)||l(!o);o=!1){var p=i.text.charAt(g)||"\n",q=gf(p)?"w":n?/\s/.test(p)?null:"p":null;if(m&&m!=q){0>c&&(c=1,l());break}if(q&&(m=q),c>0&&!l(!o))break}var r=Mc(a,Ac(f,g),h,!0);return j||(r.hitSide=!0),r}function Wc(a,b,c,d){var g,e=a.doc,f=b.left;if("page"==d){var h=Math.min(a.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);g=b.top+c*(h-(0>c?1.5:.5)*zb(a.display))}else"line"==d&&(g=c>0?b.bottom+3:b.top-3);for(;;){var i=wb(a,f,g);if(!i.outside)break;if(0>c?0>=g:g>=e.height){i.hitSide=!0;break}g+=5*c}return i}function Xc(a,b){var c=b.ch,d=b.ch;if(a){(b.xRel<0||d==a.length)&&c?--c:++d;for(var e=a.charAt(c),f=gf(e)?gf:/\s/.test(e)?function(a){return/\s/.test(a)}:function(a){return!/\s/.test(a)&&!gf(a)};c>0&&f(a.charAt(c-1));)--c;for(;dg;++g){var i=d(f[g]);if(i)return i}return!1}for(var e=0;e=b:f.to>b);(e||(e=[])).push({from:f.from,to:i?null:f.to,marker:g})}}return e}function xd(a,b,c){if(a)for(var e,d=0;d=b:f.to>b);if(h||"bookmark"==g.type&&f.from==b&&(!c||f.marker.insertLeft)){var i=null==f.from||(g.inclusiveLeft?f.from<=b:f.from0&&h)for(var l=0;ll;++l)o.push(q);o.push(i)}return o}function zd(a,b){var c=xe(a,b),d=yd(a,b);if(!c)return d;if(!d)return c;for(var e=0;eb)&&(!d||d.widtha.options.maxHighlightLength?(f=!1,i.pos=b.length,j=null):j=c.token(i,d),f&&h==j||(gh;){var e=d[g];e>a&&d.splice(g,1,a,d[g+1],e),g+=2,h=Math.min(a,e)}if(b)if(f.opaque)d.splice(c,g-c,a,b),g=c+2;else for(;g>c;c+=2){var i=d[c+1];d[c+1]=i?i+" "+b:b}})}return d}function Sd(a,b){return b.styles&&b.styles[0]==a.state.modeGen||(b.styles=Rd(a,b,b.stateAfter=db(a,oe(b)))),b.styles}function Td(a,b,c){var d=a.doc.mode,e=new od(b.text,a.options.tabSize);for(""==b.text&&d.blankLine&&d.blankLine(c);!e.eol()&&e.pos<=a.options.maxHighlightLength;)d.token(e,c),e.start=e.pos}function Vd(a){return a?Ud[a]||(Ud[a]="cm-"+a.replace(/ +/g," cm-")):null}function Wd(a,c,d,f){for(var g,h=c,i=!0;g=Cd(h);)h=ke(a.doc,g.find().from.line);var j={pre:kf("pre"),col:0,pos:0,measure:null,measuredSomething:!1,cm:a,copyWidgets:f};h.textClass&&(j.pre.className=h.textClass);do{h.text&&(i=!1),j.measure=h==c&&d,j.pos=0,j.addToken=j.measure?Zd:Yd,(b||e)&&a.getOption("lineWrapping")&&(j.addToken=$d(j.addToken));var k=ae(h,j,Sd(a,h));d&&h==c&&!j.measuredSomething&&(d[0]=j.pre.appendChild(uf(a.display.measure)),j.measuredSomething=!0),k&&(h=ke(a.doc,k.to.line))}while(k);!d||j.measuredSomething||d[0]||(d[0]=j.pre.appendChild(i?kf("span","\xa0"):uf(a.display.measure))),j.pre.firstChild||Fd(a.doc,c)||j.pre.appendChild(document.createTextNode("\xa0"));var l;if(d&&b&&(l=re(h))){var m=l.length-1;l[m].from==l[m].to&&--m;var n=l[m],o=l[m-1];if(n.from+1==n.to&&o&&n.level="\ud800"&&"\udbff">i&&hi)?(null!=t.to&&l>t.to&&(l=t.to,n=""),u.className&&(m+=" "+u.className),u.startStyle&&t.from==i&&(o+=" "+u.startStyle),u.endStyle&&t.to==l&&(n+=" "+u.endStyle),u.title&&!p&&(p=u.title),u.collapsed&&(!q||q.marker.sizei&&l>t.from&&(l=t.from),"bookmark"==u.type&&t.from==i&&u.replacedWith&&r.push(u)}if(q&&(q.from||0)==i&&(_d(b,(null==q.to?h:q.to)-i,q.marker,null==q.from),null==q.to))return q.marker.find();if(!q&&r.length)for(var s=0;s=h)break;for(var v=Math.min(h,l);;){if(j){var w=i+j.length;if(!q){var x=w>v?j.slice(0,v-i):j;b.addToken(b,x,k?k+m:m,o,i+x.length==l?n:"",p)}if(w>=v){j=j.slice(v-i),i=v;break}i=w,o=""}j=e.slice(f,f=c[g++]),k=Vd(c[g++])}}else for(var g=1;gp;++p)r.push(new Nd(j[p],f(p),e));g(l,l.text,n),o&&a.remove(h.line,o),r.length&&a.insert(h.line,r)}else if(k==l)if(1==j.length)g(k,k.text.slice(0,h.ch)+m+k.text.slice(i.ch),n);else{for(var r=[],p=1,q=j.length-1;q>p;++p)r.push(new Nd(j[p],f(p),e));r.push(new Nd(m+k.text.slice(i.ch),n,e)),g(k,k.text.slice(0,h.ch)+j[0],f(0)),a.insert(h.line+1,r)}else if(1==j.length)g(k,k.text.slice(0,h.ch)+j[0]+l.text.slice(i.ch),f(0)),a.remove(h.line+1,o);else{g(k,k.text.slice(0,h.ch)+j[0],f(0)),g(l,m+l.text.slice(i.ch),n);for(var p=1,q=j.length-1,r=[];q>p;++p)r.push(new Nd(j[p],f(p),e)); o>1&&a.remove(h.line+1,o-1),a.insert(h.line+1,r)}Pe(a,"change",a,b),Kc(a,d.anchor,d.head,null,!0)}function ce(a){this.lines=a,this.parent=null;for(var b=0,c=a.length,d=0;c>b;++b)a[b].parent=this,d+=a[b].height;this.height=d}function de(a){this.children=a;for(var b=0,c=0,d=0,e=a.length;e>d;++d){var f=a[d];b+=f.chunkSize(),c+=f.height,f.parent=this}this.size=b,this.height=c,this.parent=null}function ie(a,b,c){function d(a,e,f){if(a.linked)for(var g=0;gb){a=d;break}b-=e}return a.lines[b]}function le(a,b,c){var d=[],e=b.line;return a.iter(b.line,c.line+1,function(a){var f=a.text;e==c.line&&(f=f.slice(0,c.ch)),e==b.line&&(f=f.slice(b.ch)),d.push(f),++e}),d}function me(a,b,c){var d=[];return a.iter(b,c,function(a){d.push(a.text)}),d}function ne(a,b){for(var c=b-a.height,d=a;d;d=d.parent)d.height+=c}function oe(a){if(null==a.parent)return null;for(var b=a.parent,c=af(b.lines,a),d=b.parent;d;b=d,d=d.parent)for(var e=0;d.children[e]!=b;++e)c+=d.children[e].chunkSize();return c+b.first}function pe(a,b){var c=a.first;a:do{for(var d=0,e=a.children.length;e>d;++d){var f=a.children[d],g=f.height;if(g>b){a=f;continue a}b-=g,c+=f.chunkSize()}return c}while(!a.lines);for(var d=0,e=a.lines.length;e>d;++d){var h=a.lines[d],i=h.height;if(i>b)break;b-=i}return c+d}function qe(a,b){b=Ed(a.doc,b);for(var c=0,d=b.parent,e=0;ef-a.cm.options.historyEventDelay||"*"==b.origin.charAt(0)))){var h=$e(g.changes);Bc(b.from,b.to)&&Bc(b.from,h.to)?h.to=pc(b):g.changes.push(ue(a,b)),g.anchorAfter=c.anchor,g.headAfter=c.head}else for(g={changes:[ue(a,b)],generation:e.generation,anchorBefore:a.sel.anchor,headBefore:a.sel.head,anchorAfter:c.anchor,headAfter:c.head},e.done.push(g),e.generation=++e.maxGeneration;e.done.length>e.undoDepth;)e.done.shift();e.lastTime=f,e.lastOp=d,e.lastOrigin=b.origin}function we(a){if(!a)return null;for(var c,b=0;b-1&&($e(g)[k]=i[k],delete i[k])}}return d}function ze(a,b,c,d){c0}function Te(a){a.prototype.on=function(a,b){Ke(this,a,b)},a.prototype.off=function(a,b){Le(this,a,b)}}function We(){this.id=null}function Xe(a,b,c,d,e){null==b&&(b=a.search(/[^\s\u00a0]/),-1==b&&(b=a.length));for(var f=d||0,g=e||0;b>f;++f)" "==a.charAt(f)?g+=c-g%c:++g;return g}function Ze(a){for(;Ye.length<=a;)Ye.push($e(Ye)+" ");return Ye[a]}function $e(a){return a[a.length-1]}function _e(a){if(n)a.selectionStart=0,a.selectionEnd=a.value.length;else try{a.select()}catch(b){}}function af(a,b){if(a.indexOf)return a.indexOf(b);for(var c=0,d=a.length;d>c;++c)if(a[c]==b)return c;return-1}function bf(a,b){function c(){}c.prototype=a;var d=new c;return b&&cf(b,d),d}function cf(a,b){b||(b={});for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}function df(a){for(var b=[],c=0;a>c;++c)b.push(void 0);return b}function ef(a){var b=Array.prototype.slice.call(arguments,1);return function(){return a.apply(null,b)}}function gf(a){return/\w/.test(a)||a>"\x80"&&(a.toUpperCase()!=a.toLowerCase()||ff.test(a))}function hf(a){for(var b in a)if(a.hasOwnProperty(b)&&a[b])return!1;return!0}function kf(a,b,c,d){var e=document.createElement(a);if(c&&(e.className=c),d&&(e.style.cssText=d),"string"==typeof b)nf(e,b);else if(b)for(var f=0;f0;--b)a.removeChild(a.firstChild);return a}function mf(a,b){return lf(a).appendChild(b)}function nf(a,b){d?(a.innerHTML="",a.appendChild(document.createTextNode(b))):a.textContent=b}function of(a){return a.getBoundingClientRect()}function qf(){return!1}function sf(a){if(null!=rf)return rf;var b=kf("div",null,null,"width: 50px; height: 50px; overflow-x: scroll");return mf(a,b),b.offsetWidth&&(rf=b.offsetHeight-b.clientHeight),rf||0}function uf(a){if(null==tf){var b=kf("span","\u200b");mf(a,kf("span",[b,document.createTextNode("x")])),0!=a.firstChild.offsetHeight&&(tf=b.offsetWidth<=1&&b.offsetHeight>2&&!c)}return tf?kf("span","\u200b"):kf("span","\xa0",null,"display: inline-block; width: 1px; margin-right: -1px")}function zf(a,b,c,d){if(!a)return d(b,c,"ltr");for(var e=!1,f=0;fb||b==c&&g.to==b)&&(d(Math.max(g.from,b),Math.min(g.to,c),1==g.level?"rtl":"ltr"),e=!0)}e||d(b,c,"ltr")}function Af(a){return a.level%2?a.to:a.from}function Bf(a){return a.level%2?a.from:a.to}function Cf(a){var b=re(a);return b?Af(b[0]):0}function Df(a){var b=re(a);return b?Bf($e(b)):a.text.length}function Ef(a,b){var c=ke(a.doc,b),d=Ed(a.doc,c);d!=c&&(b=oe(d));var e=re(d),f=e?e[0].level%2?Df(d):Cf(d):0;return Ac(b,f)}function Ff(a,b){for(var c,d;c=Dd(d=ke(a.doc,b));)b=c.find().to.line;var e=re(d),f=e?e[0].level%2?Cf(d):Df(d):d.text.length;return Ac(b,f)}function Gf(a,b,c){var d=a[0].level;return b==d?!0:c==d?!1:c>b}function If(a,b){for(var d,c=0;cb)return Hf=null,c;if(e.from==b||e.to==b){if(null!=d)return Gf(a,e.level,a[d].level)?(Hf=d,c):(Hf=c,d);d=c}}return Hf=null,d}function Jf(a,b,c,d){if(!d)return b+c;do b+=c;while(b>0&&jf.test(a.text.charAt(b)));return b}function Kf(a,b,c,d){var e=re(a);if(!e)return Lf(a,b,c,d);for(var f=If(e,b),g=e[f],h=Jf(a,b,g.level%2?-c:c,d);;){if(h>g.from&&h0==g.level%2?g.to:g.from);if(g=e[f+=c],!g)return null;h=c>0==g.level%2?Jf(a,g.to,-1,d):Jf(a,g.from,1,d)}}function Lf(a,b,c,d){var e=b+c;if(d)for(;e>0&&jf.test(a.text.charAt(e));)e+=c;return 0>e||e>a.text.length?null:e}var a=/gecko\/\d/i.test(navigator.userAgent),b=/MSIE \d/.test(navigator.userAgent),c=b&&(null==document.documentMode||document.documentMode<8),d=b&&(null==document.documentMode||document.documentMode<9),e=/WebKit\//.test(navigator.userAgent),f=e&&/Qt\/\d+\.\d+/.test(navigator.userAgent),g=/Chrome\//.test(navigator.userAgent),h=/Opera\//.test(navigator.userAgent),i=/Apple Computer/.test(navigator.vendor),j=/KHTML\//.test(navigator.userAgent),k=/Mac OS X 1\d\D([7-9]|\d\d)\D/.test(navigator.userAgent),l=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),m=/PhantomJS/.test(navigator.userAgent),n=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),o=n||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent),p=n||/Mac/.test(navigator.platform),q=/win/i.test(navigator.platform),r=h&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);r&&(r=Number(r[1])),r&&r>=15&&(h=!1,e=!0);var yb,Rb,Sb,s=p&&(f||h&&(null==r||12.11>r)),t=a||b&&!d,u=!1,v=!1,Bb=0,Xb=0,ac=0,bc=null;b?bc=-.53:a?bc=15:g?bc=-.7:i&&(bc=-1/3);var fc,nc,ic=null,pc=w.changeEnd=function(a){return a.text?Ac(a.from.line+a.text.length-1,$e(a.text).length+(1==a.text.length?a.from.ch:0)):a.to};w.Pos=Ac,w.prototype={constructor:w,focus:function(){window.focus(),Mb(this),lc(this),Jb(this)},setOption:function(a,b){var c=this.options,d=c[a];(c[a]!=b||"mode"==a)&&(c[a]=b,Zc.hasOwnProperty(a)&&Eb(this,Zc[a])(this,b,d))},getOption:function(a){return this.options[a]},getDoc:function(){return this.doc},addKeyMap:function(a,b){this.state.keyMaps[b?"push":"unshift"](a)},removeKeyMap:function(a){for(var b=this.state.keyMaps,c=0;c=d;++d)Tc(this,d,a)}),getTokenAt:function(a,b){var c=this.doc;a=Fc(c,a);for(var d=db(this,a.line,b),e=this.doc.mode,f=ke(c,a.line),g=new od(f.text,this.options.tabSize);g.pos>1;if((f?b[2*f-1]:0)>=e)d=f;else{if(!(b[2*f+1]d&&(a=d,c=!0);var e=ke(this.doc,a);return rb(this,ke(this.doc,a),{top:0,left:0},b||"page").top+(c?e.height:0)},defaultTextHeight:function(){return zb(this.display)},defaultCharWidth:function(){return Ab(this.display)},setGutterMarker:Eb(null,function(a,b,c){return Uc(this,a,function(a){var d=a.gutterMarkers||(a.gutterMarkers={});return d[b]=c,!c&&hf(d)&&(a.gutterMarkers=null),!0})}),clearGutter:Eb(null,function(a){var b=this,c=b.doc,d=c.first;c.iter(function(c){c.gutterMarkers&&c.gutterMarkers[a]&&(c.gutterMarkers[a]=null,Hb(b,d,d+1),hf(c.gutterMarkers)&&(c.gutterMarkers=null)),++d})}),addLineClass:Eb(null,function(a,b,c){return Uc(this,a,function(a){var d="text"==b?"textClass":"background"==b?"bgClass":"wrapClass";if(a[d]){if(new RegExp("(?:^|\\s)"+c+"(?:$|\\s)").test(a[d]))return!1;a[d]+=" "+c}else a[d]=c;return!0})}),removeLineClass:Eb(null,function(a,b,c){return Uc(this,a,function(a){var d="text"==b?"textClass":"background"==b?"bgClass":"wrapClass",e=a[d];if(!e)return!1;if(null==c)a[d]=null;else{var f=e.match(new RegExp("(?:^|\\s+)"+c+"(?:$|\\s+)"));if(!f)return!1;var g=f.index+f[0].length;a[d]=e.slice(0,f.index)+(f.index&&g!=e.length?" ":"")+e.slice(g)||null}return!0})}),addLineWidget:Eb(null,function(a,b,c){return Md(this,a,b,c)}),removeLineWidget:function(a){a.clear()},lineInfo:function(a){if("number"==typeof a){if(!Hc(this.doc,a))return null;var b=a;if(a=ke(this.doc,a),!a)return null}else{var b=oe(a);if(null==b)return null}return{line:b,handle:a,text:a.text,gutterMarkers:a.gutterMarkers,textClass:a.textClass,bgClass:a.bgClass,wrapClass:a.wrapClass,widgets:a.widgets}},getViewport:function(){return{from:this.display.showingFrom,to:this.display.showingTo}},addWidget:function(a,b,c,d,e){var f=this.display;a=ub(this,Fc(this.doc,a));var g=a.bottom,h=a.left;if(b.style.position="absolute",f.sizer.appendChild(b),"over"==d)g=a.top;else if("above"==d||"near"==d){var i=Math.max(f.wrapper.clientHeight,this.doc.height),j=Math.max(f.sizer.clientWidth,f.lineSpace.clientWidth);("above"==d||a.bottom+b.offsetHeight>i)&&a.top>b.offsetHeight?g=a.top-b.offsetHeight:a.bottom+b.offsetHeight<=i&&(g=a.bottom),h+b.offsetWidth>j&&(h=j-b.offsetWidth)}b.style.top=g+"px",b.style.left=b.style.right="","right"==e?(h=f.sizer.clientWidth-b.offsetWidth,b.style.right="0px"):("left"==e?h=0:"middle"==e&&(h=(f.sizer.clientWidth-b.offsetWidth)/2),b.style.left=h+"px"),c&&Pc(this,h,g,h+b.offsetWidth,g+b.offsetHeight)},triggerOnKeyDown:Eb(null,jc),execCommand:function(a){return id[a](this)},findPosH:function(a,b,c,d){var e=1;0>b&&(e=-1,b=-b);for(var f=0,g=Fc(this.doc,a);b>f&&(g=Vc(this.doc,g,e,c,d),!g.hitSide);++f);return g},moveH:Eb(null,function(a,b){var d,c=this.doc.sel;d=c.shift||c.extend||Bc(c.from,c.to)?Vc(this.doc,c.head,a,b,this.options.rtlMoveVisually):0>a?c.from:c.to,Ic(this.doc,d,d,a)}),deleteH:Eb(null,function(a,b){var c=this.doc.sel;Bc(c.from,c.to)?zc(this.doc,"",c.from,Vc(this.doc,c.head,a,b,!1),"+delete"):zc(this.doc,"",c.from,c.to,"+delete"),this.curOp.userSelChange=!0}),findPosV:function(a,b,c,d){var e=1,f=d;0>b&&(e=-1,b=-b);for(var g=0,h=Fc(this.doc,a);b>g;++g){var i=ub(this,h,"div");if(null==f?f=i.left:i.left=f,h=Wc(this,i,e,c),h.hitSide)break}return h},moveV:Eb(null,function(a,b){var c=this.doc.sel,d=ub(this,c.head,"div");null!=c.goalColumn&&(d.left=c.goalColumn);var e=Wc(this,d,a,b);"page"==b&&Sc(this,0,tb(this,e,"div").top-d.top),Ic(this.doc,e,e,a),c.goalColumn=d.left}),toggleOverwrite:function(a){(null==a||a!=this.state.overwrite)&&((this.state.overwrite=!this.state.overwrite)?this.display.cursor.className+=" CodeMirror-overwrite":this.display.cursor.className=this.display.cursor.className.replace(" CodeMirror-overwrite",""))},hasFocus:function(){return this.state.focused},scrollTo:Eb(null,function(a,b){Rc(this,a,b)}),getScrollInfo:function(){var a=this.display.scroller,b=Ue;return{left:a.scrollLeft,top:a.scrollTop,height:a.scrollHeight-b,width:a.scrollWidth-b,clientHeight:a.clientHeight-b,clientWidth:a.clientWidth-b}},scrollIntoView:Eb(null,function(a,b){"number"==typeof a&&(a=Ac(a,0)),b||(b=0);var c=a;a&&null==a.line||(this.curOp.scrollToPos=a?Fc(this.doc,a):this.doc.sel.head,this.curOp.scrollToPosMargin=b,c=ub(this,this.curOp.scrollToPos));var d=Qc(this,c.left,c.top-b,c.right,c.bottom+b);Rc(this,d.scrollLeft,d.scrollTop)}),setSize:Eb(null,function(a,b){function c(a){return"number"==typeof a||/^\d+$/.test(String(a))?a+"px":a}null!=a&&(this.display.wrapper.style.width=c(a)),null!=b&&(this.display.wrapper.style.height=c(b)),this.options.lineWrapping&&(this.display.measureLineCache.length=this.display.measureLineCachePos=0),this.curOp.forceUpdate=!0}),operation:function(a){return Gb(this,a)},refresh:Eb(null,function(){ob(this),Rc(this,this.doc.scrollLeft,this.doc.scrollTop),Hb(this)}),swapDoc:Eb(null,function(a){var b=this.doc;return b.cm=null,je(this,a),ob(this),Lb(this,!0),Rc(this,a.scrollLeft,a.scrollTop),b}),getInputField:function(){return this.display.input},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Te(w);var Zc=w.optionHandlers={},$c=w.defaults={},ad=w.Init={toString:function(){return"CodeMirror.Init"}};_c("value","",function(a,b){a.setValue(b)},!0),_c("mode",null,function(a,b){a.doc.modeOption=b,y(a)},!0),_c("indentUnit",2,y,!0),_c("indentWithTabs",!1),_c("smartIndent",!0),_c("tabSize",4,function(a){y(a),ob(a),Hb(a)},!0),_c("electricChars",!0),_c("rtlMoveVisually",!q),_c("theme","default",function(a){D(a),E(a)},!0),_c("keyMap","default",C),_c("extraKeys",null),_c("onKeyEvent",null),_c("onDragEvent",null),_c("lineWrapping",!1,z,!0),_c("gutters",[],function(a){I(a.options),E(a)},!0),_c("fixedGutter",!0,function(a,b){a.display.gutters.style.left=b?O(a.display)+"px":"0",a.refresh()},!0),_c("coverGutterNextToScrollbar",!1,J,!0),_c("lineNumbers",!1,function(a){I(a.options),E(a)},!0),_c("firstLineNumber",1,E,!0),_c("lineNumberFormatter",function(a){return a},E,!0),_c("showCursorWhenSelecting",!1,Y,!0),_c("readOnly",!1,function(a,b){"nocursor"==b?(mc(a),a.display.input.blur()):b||Lb(a,!0)}),_c("dragDrop",!0),_c("cursorBlinkRate",530),_c("cursorScrollMargin",0),_c("cursorHeight",1),_c("workTime",100),_c("workDelay",100),_c("flattenSpans",!0),_c("pollInterval",100),_c("undoDepth",40,function(a,b){a.doc.history.undoDepth=b}),_c("historyEventDelay",500),_c("viewportMargin",10,function(a){a.refresh()},!0),_c("maxHighlightLength",1e4,function(a){y(a),a.refresh()},!0),_c("crudeMeasuringFrom",1e4),_c("moveInputWithCursor",!0,function(a,b){b||(a.display.inputDiv.style.top=a.display.inputDiv.style.left=0)}),_c("tabindex",null,function(a,b){a.display.input.tabIndex=b||""}),_c("autofocus",null);var bd=w.modes={},cd=w.mimeModes={};w.defineMode=function(a,b){if(w.defaults.mode||"null"==a||(w.defaults.mode=a),arguments.length>2){b.dependencies=[];for(var c=2;c0&&b.ch=this.string.length},sol:function(){return 0==this.pos},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){return this.posb},eatSpace:function(){for(var a=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>a},skipToEnd:function(){this.pos=this.string.length},skipTo:function(a){var b=this.string.indexOf(a,this.pos);return b>-1?(this.pos=b,!0):void 0},backUp:function(a){this.pos-=a},column:function(){return this.lastColumnPos0?null:(f&&b!==!1&&(this.pos+=f[0].length),f)}var d=function(a){return c?a.toLowerCase():a},e=this.string.substr(this.pos,a.length);return d(e)==d(a)?(b!==!1&&(this.pos+=a.length),!0):void 0},current:function(){return this.string.slice(this.start,this.pos)}},w.StringStream=od,w.TextMarker=pd,Te(pd),pd.prototype.clear=function(){if(!this.explicitlyCleared){var a=this.doc.cm,b=a&&!a.curOp;if(b&&Cb(a),Se(this,"clear")){var c=this.find();c&&Pe(this,"clear",c.from,c.to)}for(var d=null,e=null,f=0;fa.display.maxLineLength&&(a.display.maxLine=i,a.display.maxLineLength=j,a.display.maxLineChanged=!0)}null!=d&&a&&Hb(a,d,e+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,a&&Lc(a)),b&&Db(a)}},pd.prototype.find=function(){for(var a,b,c=0;c=b.display.showingFrom&&a.linec;++c){var e=this.lines[c];this.height-=e.height,Pd(e),Pe(e,"delete")}this.lines.splice(a,b)},collapse:function(a){a.splice.apply(a,[a.length,0].concat(this.lines))},insertInner:function(a,b,c){this.height+=c,this.lines=this.lines.slice(0,a).concat(b).concat(this.lines.slice(a));for(var d=0,e=b.length;e>d;++d)b[d].parent=this },iterN:function(a,b,c){for(var d=a+b;d>a;++a)if(c(this.lines[a]))return!0}},de.prototype={chunkSize:function(){return this.size},removeInner:function(a,b){this.size-=b;for(var c=0;ca){var f=Math.min(b,e-a),g=d.height;if(d.removeInner(a,f),this.height-=g-d.height,e==f&&(this.children.splice(c--,1),d.parent=null),0==(b-=f))break;a=0}else a-=e}if(this.size-b<25){var h=[];this.collapse(h),this.children=[new ce(h)],this.children[0].parent=this}},collapse:function(a){for(var b=0,c=this.children.length;c>b;++b)this.children[b].collapse(a)},insertInner:function(a,b,c){this.size+=b.length,this.height+=c;for(var d=0,e=this.children.length;e>d;++d){var f=this.children[d],g=f.chunkSize();if(g>=a){if(f.insertInner(a,b,c),f.lines&&f.lines.length>50){for(;f.lines.length>50;){var h=f.lines.splice(f.lines.length-25,25),i=new ce(h);f.height-=i.height,this.children.splice(d+1,0,i),i.parent=this}this.maybeSpill()}break}a-=g}},maybeSpill:function(){if(!(this.children.length<=10)){var a=this;do{var b=a.children.splice(a.children.length-5,5),c=new de(b);if(a.parent){a.size-=c.size,a.height-=c.height;var e=af(a.parent.children,a);a.parent.children.splice(e+1,0,c)}else{var d=new de(a.children);d.parent=a,a.children=[d,c],a=d}c.parent=a.parent}while(a.children.length>10);a.parent.maybeSpill()}},iterN:function(a,b,c){for(var d=0,e=this.children.length;e>d;++d){var f=this.children[d],g=f.chunkSize();if(g>a){var h=Math.min(b,g-a);if(f.iterN(a,h,c))return!0;if(0==(b-=h))break;a=0}else a-=g}}};var ee=0,fe=w.Doc=function(a,b,c){if(!(this instanceof fe))return new fe(a,b,c);null==c&&(c=0),de.call(this,[new ce([new Nd("",null)])]),this.first=c,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.history=se(),this.cleanGeneration=1,this.frontier=c;var d=Ac(c,0);this.sel={from:d,to:d,head:d,anchor:d,shift:!1,extend:!1,goalColumn:null},this.id=++ee,this.modeOption=b,"string"==typeof a&&(a=vf(a)),be(this,{from:d,to:d,text:a},null,{head:d,anchor:d})};fe.prototype=bf(de.prototype,{constructor:fe,iter:function(a,b,c){c?this.iterN(a-this.first,b-a,c):this.iterN(this.first,this.first+this.size,a)},insert:function(a,b){for(var c=0,d=0,e=b.length;e>d;++d)c+=b[d].height;this.insertInner(a-this.first,b,c)},remove:function(a,b){this.removeInner(a-this.first,b)},getValue:function(a){var b=me(this,this.first,this.first+this.size);return a===!1?b:b.join(a||"\n")},setValue:function(a){var b=Ac(this.first,0),c=this.first+this.size-1;tc(this,{from:b,to:Ac(c,ke(this,c).text.length),text:vf(a),origin:"setValue"},{head:b,anchor:b},!0)},replaceRange:function(a,b,c,d){b=Fc(this,b),c=c?Fc(this,c):b,zc(this,a,b,c,d)},getRange:function(a,b,c){var d=le(this,Fc(this,a),Fc(this,b));return c===!1?d:d.join(c||"\n")},getLine:function(a){var b=this.getLineHandle(a);return b&&b.text},setLine:function(a,b){Hc(this,a)&&zc(this,b,Ac(a,0),Fc(this,Ac(a)))},removeLine:function(a){a?zc(this,"",Fc(this,Ac(a-1)),Fc(this,Ac(a))):zc(this,"",Ac(0,0),Fc(this,Ac(1,0)))},getLineHandle:function(a){return Hc(this,a)?ke(this,a):void 0},getLineNumber:function(a){return oe(a)},getLineHandleVisualStart:function(a){return"number"==typeof a&&(a=ke(this,a)),Ed(this,a)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(a){return Fc(this,a)},getCursor:function(a){var c,b=this.sel;return c=null==a||"head"==a?b.head:"anchor"==a?b.anchor:"end"==a||a===!1?b.to:b.from,Dc(c)},somethingSelected:function(){return!Bc(this.sel.head,this.sel.anchor)},setCursor:Fb(function(a,b,c){var d=Fc(this,"number"==typeof a?Ac(a,b||0):a);c?Ic(this,d):Kc(this,d,d)}),setSelection:Fb(function(a,b,c){Kc(this,Fc(this,a),Fc(this,b||a),c)}),extendSelection:Fb(function(a,b,c){Ic(this,Fc(this,a),b&&Fc(this,b),c)}),getSelection:function(a){return this.getRange(this.sel.from,this.sel.to,a)},replaceSelection:function(a,b,c){tc(this,{from:this.sel.from,to:this.sel.to,text:vf(a),origin:c},b||"around")},undo:Fb(function(){vc(this,"undo")}),redo:Fb(function(){vc(this,"redo")}),setExtending:function(a){this.sel.extend=a},historySize:function(){var a=this.history;return{undo:a.done.length,redo:a.undone.length}},clearHistory:function(){this.history=se(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration()},changeGeneration:function(){return this.history.lastOp=this.history.lastOrigin=null,this.history.generation},isClean:function(a){return this.history.generation==(a||this.cleanGeneration)},getHistory:function(){return{done:ye(this.history.done),undone:ye(this.history.undone)}},setHistory:function(a){var b=this.history=se(this.history.maxGeneration);b.done=a.done.slice(0),b.undone=a.undone.slice(0)},markText:function(a,b,c){return qd(this,Fc(this,a),Fc(this,b),c,"range")},setBookmark:function(a,b){var c={replacedWith:b&&(null==b.nodeType?b.widget:b),insertLeft:b&&b.insertLeft};return a=Fc(this,a),qd(this,a,a,c,"bookmark")},findMarksAt:function(a){a=Fc(this,a);var b=[],c=ke(this,a.line).markedSpans;if(c)for(var d=0;d=a.ch)&&b.push(e.marker.parent||e.marker)}return b},getAllMarks:function(){var a=[];return this.iter(function(b){var c=b.markedSpans;if(c)for(var d=0;da?(b=a,!0):(a-=e,++c,void 0)}),Fc(this,Ac(c,b))},indexFromPos:function(a){a=Fc(this,a);var b=a.ch;return a.lineb&&(b=a.from),null!=a.to&&a.to1&&45==a.charCodeAt(b-1)){if(/\w/.test(a.charAt(b-2))&&/[^\-?\.]/.test(a.charAt(b)))return!0;if(b>2&&/[\d\.,]/.test(a.charAt(b-2))&&/[\d\.,]/.test(a.charAt(b)))return!1}return/[~!#%&*)=+}\]|\"\.>,:;][({[<]|-[^\-?\.\u2010-\u201f\u2026]|\?[\w~`@#$%\^&*(_=+{[|><]|\u2026[\w~`@#$%\^&*(_=+{[><]/.test(a.slice(b-1,b+1))});var rf,tf,vf=3!="\n\nb".split(/\n/).length?function(a){for(var b=0,c=[],d=a.length;d>=b;){var e=a.indexOf("\n",b);-1==e&&(e=a.length);var f=a.slice(b,"\r"==a.charAt(e-1)?e-1:e),g=f.indexOf("\r");-1!=g?(c.push(f.slice(0,g)),b+=g+1):(c.push(f),b=e+1)}return c}:function(a){return a.split(/\r\n?|\n/)};w.splitLines=vf;var wf=window.getSelection?function(a){try{return a.selectionStart!=a.selectionEnd}catch(b){return!1}}:function(a){try{var b=a.ownerDocument.selection.createRange()}catch(c){}return b&&b.parentElement()==a?0!=b.compareEndPoints("StartToEnd",b):!1},xf=function(){var a=kf("div");return"oncopy"in a?!0:(a.setAttribute("oncopy","return;"),"function"==typeof a.oncopy)}(),yf={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",91:"Mod",92:"Mod",93:"Mod",109:"-",107:"=",127:"Delete",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63276:"PageUp",63277:"PageDown",63275:"End",63273:"Home",63234:"Left",63232:"Up",63235:"Right",63233:"Down",63302:"Insert",63272:"Delete"};w.keyNames=yf,function(){for(var a=0;10>a;a++)yf[a+48]=String(a);for(var a=65;90>=a;a++)yf[a]=String.fromCharCode(a);for(var a=1;12>=a;a++)yf[a+111]=yf[a+63235]="F"+a}();var Hf,Mf=function(){function c(c){return 255>=c?a.charAt(c):c>=1424&&1524>=c?"R":c>=1536&&1791>=c?b.charAt(c-1536):c>=1792&&2220>=c?"r":"L"}var a="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLL",b="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmmrrrrrrrrrrrrrrrrrr",d=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,e=/[stwN]/,f=/[LRr]/,g=/[Lb1n]/,h=/[1n]/,i="L";return function(a){if(!d.test(a))return!1;for(var l,b=a.length,j=[],k=0;b>k;++k)j.push(l=c(a.charCodeAt(k)));for(var k=0,m=i;b>k;++k){var l=j[k];"m"==l?j[k]=m:m=l}for(var k=0,n=i;b>k;++k){var l=j[k];"1"==l&&"r"==n?j[k]="n":f.test(l)&&(n=l,"r"==l&&(j[k]="R"))}for(var k=1,m=j[0];b-1>k;++k){var l=j[k];"+"==l&&"1"==m&&"1"==j[k+1]?j[k]="1":","!=l||m!=j[k+1]||"1"!=m&&"n"!=m||(j[k]=m),m=l}for(var k=0;b>k;++k){var l=j[k];if(","==l)j[k]="N";else if("%"==l){for(var o=k+1;b>o&&"%"==j[o];++o);for(var p=k&&"!"==j[k-1]||b-1>o&&"1"==j[o]?"1":"N",q=k;o>q;++q)j[q]=p;k=o-1}}for(var k=0,n=i;b>k;++k){var l=j[k];"L"==n&&"1"==l?j[k]="L":f.test(l)&&(n=l)}for(var k=0;b>k;++k)if(e.test(j[k])){for(var o=k+1;b>o&&e.test(j[o]);++o);for(var r="L"==(k?j[k-1]:i),s="L"==(b-1>o?j[o]:i),p=r||s?"L":"R",q=k;o>q;++q)j[q]=p;k=o-1}for(var u,t=[],k=0;b>k;)if(g.test(j[k])){var v=k;for(++k;b>k&&g.test(j[k]);++k);t.push({from:v,to:k,level:0})}else{var w=k,x=t.length;for(++k;b>k&&"L"!=j[k];++k);for(var q=w;k>q;)if(h.test(j[q])){q>w&&t.splice(x,0,{from:w,to:q,level:1});var y=q;for(++q;k>q&&h.test(j[q]);++q);t.splice(x,0,{from:y,to:q,level:2}),w=q}else++q;k>w&&t.splice(x,0,{from:w,to:k,level:1})}return 1==t[0].level&&(u=a.match(/^\s+/))&&(t[0].from=u[0].length,t.unshift({from:0,to:u[0].length,level:0})),1==$e(t).level&&(u=a.match(/\s+$/))&&($e(t).to-=u[0].length,t.push({from:b-u[0].length,to:b,level:0})),t[0].level!=$e(t).level&&t.push({from:b,to:b,level:t[0].level}),t}}();return w.version="3.16.1",w}(),CodeMirror.defineMode("perl",function(){function d(a,b,c,d,e){return b.chain=null,b.style=null,b.tail=null,b.tokenize=function(a,b){for(var h,g=!1,i=0;h=a.next();){if(h===c[i]&&!g)return void 0!==c[++i]?(b.chain=c[i],b.style=d,b.tail=e):e&&a.eatWhile(e),b.tokenize=f,d;g=!g&&"\\"==h}return d},b.tokenize(a,b)}function e(a,b,c){return b.tokenize=function(a,b){return a.string==c&&(b.tokenize=f),a.skipToEnd(),"string"},b.tokenize(a,b)}function f(f,g){if(f.eatSpace())return null;if(g.chain)return d(f,g,g.chain,g.style,g.tail);if(f.match(/^\-?[\d\.]/,!1)&&f.match(/^(\-?(\d*\.\d+(e[+-]?\d+)?|\d+\.\d*)|0x[\da-fA-F]+|0b[01]+|\d+(e[+-]?\d+)?)/))return"number";if(f.match(/^<<(?=\w)/))return f.eatWhile(/\w/),e(f,g,f.current().substr(2));if(f.sol()&&f.match(/^\=item(?!\w)/))return e(f,g,"=cut");var h=f.next();if('"'==h||"'"==h){if(f.prefix(3)=="<<"+h){var i=f.pos;f.eatWhile(/\w/);var j=f.current().substr(1);if(j&&f.eat(h))return e(f,g,j);f.pos=i}return d(f,g,[h],"string")}if("q"==h){var k=f.look(-2);if(!k||!/\w/.test(k))if(k=f.look(0),"x"==k){if(k=f.look(1),"("==k)return f.eatSuffix(2),d(f,g,[")"],b,c);if("["==k)return f.eatSuffix(2),d(f,g,["]"],b,c);if("{"==k)return f.eatSuffix(2),d(f,g,["}"],b,c);if("<"==k)return f.eatSuffix(2),d(f,g,[">"],b,c);if(/[\^'"!~\/]/.test(k))return f.eatSuffix(1),d(f,g,[f.eat(k)],b,c)}else if("q"==k){if(k=f.look(1),"("==k)return f.eatSuffix(2),d(f,g,[")"],"string");if("["==k)return f.eatSuffix(2),d(f,g,["]"],"string");if("{"==k)return f.eatSuffix(2),d(f,g,["}"],"string");if("<"==k)return f.eatSuffix(2),d(f,g,[">"],"string");if(/[\^'"!~\/]/.test(k))return f.eatSuffix(1),d(f,g,[f.eat(k)],"string")}else if("w"==k){if(k=f.look(1),"("==k)return f.eatSuffix(2),d(f,g,[")"],"bracket");if("["==k)return f.eatSuffix(2),d(f,g,["]"],"bracket");if("{"==k)return f.eatSuffix(2),d(f,g,["}"],"bracket");if("<"==k)return f.eatSuffix(2),d(f,g,[">"],"bracket");if(/[\^'"!~\/]/.test(k))return f.eatSuffix(1),d(f,g,[f.eat(k)],"bracket")}else if("r"==k){if(k=f.look(1),"("==k)return f.eatSuffix(2),d(f,g,[")"],b,c);if("["==k)return f.eatSuffix(2),d(f,g,["]"],b,c);if("{"==k)return f.eatSuffix(2),d(f,g,["}"],b,c);if("<"==k)return f.eatSuffix(2),d(f,g,[">"],b,c);if(/[\^'"!~\/]/.test(k))return f.eatSuffix(1),d(f,g,[f.eat(k)],b,c)}else if(/[\^'"!~\/(\[{<]/.test(k)){if("("==k)return f.eatSuffix(1),d(f,g,[")"],"string");if("["==k)return f.eatSuffix(1),d(f,g,["]"],"string");if("{"==k)return f.eatSuffix(1),d(f,g,["}"],"string");if("<"==k)return f.eatSuffix(1),d(f,g,[">"],"string");if(/[\^'"!~\/]/.test(k))return d(f,g,[f.eat(k)],"string")}}if("m"==h){var k=f.look(-2);if((!k||!/\w/.test(k))&&(k=f.eat(/[(\[{<\^'"!~\/]/))){if(/[\^'"!~\/]/.test(k))return d(f,g,[k],b,c);if("("==k)return d(f,g,[")"],b,c);if("["==k)return d(f,g,["]"],b,c);if("{"==k)return d(f,g,["}"],b,c);if("<"==k)return d(f,g,[">"],b,c)}}if("s"==h){var k=/[\/>\]})\w]/.test(f.look(-2));if(!k&&(k=f.eat(/[(\[{<\^'"!~\/]/)))return"["==k?d(f,g,["]","]"],b,c):"{"==k?d(f,g,["}","}"],b,c):"<"==k?d(f,g,[">",">"],b,c):"("==k?d(f,g,[")",")"],b,c):d(f,g,[k,k],b,c)}if("y"==h){var k=/[\/>\]})\w]/.test(f.look(-2));if(!k&&(k=f.eat(/[(\[{<\^'"!~\/]/)))return"["==k?d(f,g,["]","]"],b,c):"{"==k?d(f,g,["}","}"],b,c):"<"==k?d(f,g,[">",">"],b,c):"("==k?d(f,g,[")",")"],b,c):d(f,g,[k,k],b,c)}if("t"==h){var k=/[\/>\]})\w]/.test(f.look(-2));if(!k&&(k=f.eat("r"),k&&(k=f.eat(/[(\[{<\^'"!~\/]/))))return"["==k?d(f,g,["]","]"],b,c):"{"==k?d(f,g,["}","}"],b,c):"<"==k?d(f,g,[">",">"],b,c):"("==k?d(f,g,[")",")"],b,c):d(f,g,[k,k],b,c)}if("`"==h)return d(f,g,[h],"variable-2");if("/"==h)return/~\s*$/.test(f.prefix())?d(f,g,[h],b,c):"operator";if("$"==h){var i=f.pos;if(f.eatWhile(/\d/)||f.eat("{")&&f.eatWhile(/\d/)&&f.eat("}"))return"variable-2";f.pos=i}if(/[$@%]/.test(h)){var i=f.pos;if(f.eat("^")&&f.eat(/[A-Z]/)||!/[@$%&]/.test(f.look(-2))&&f.eat(/[=|\\\-#?@;:&`~\^!\[\]*'"$+.,\/<>()]/)){var k=f.current();if(a[k])return"variable-2"}f.pos=i}if(/[$@%&]/.test(h)&&(f.eatWhile(/[\w$\[\]]/)||f.eat("{")&&f.eatWhile(/[\w$\[\]]/)&&f.eat("}"))){var k=f.current();return a[k]?"variable-2":"variable"}if("#"==h&&"$"!=f.look(-2))return f.skipToEnd(),"comment";if(/[:+\-\^*$&%@=<>!?|\/~\.]/.test(h)){var i=f.pos;if(f.eatWhile(/[:+\-\^*$&%@=<>!?|\/~\.]/),a[f.current()])return"operator";f.pos=i}if("_"==h&&1==f.pos){if("_END__"==f.suffix(6))return d(f,g,["\0"],"comment");if("_DATA__"==f.suffix(7))return d(f,g,["\0"],"variable-2");if("_C__"==f.suffix(7))return d(f,g,["\0"],"string")}if(/\w/.test(h)){var i=f.pos;if("{"==f.look(-2)&&("}"==f.look(0)||f.eatWhile(/\w/)&&"}"==f.look(0)))return"string";f.pos=i}if(/[A-Z]/.test(h)){var l=f.look(-2),i=f.pos;if(f.eatWhile(/[A-Z_]/),!/[\da-z]/.test(f.look(0))){var k=a[f.current()];return k?(k[1]&&(k=k[0]),":"!=l?1==k?"keyword":2==k?"def":3==k?"atom":4==k?"operator":5==k?"variable-2":"meta":"meta"):"meta"}f.pos=i}if(/[a-zA-Z_]/.test(h)){var l=f.look(-2);f.eatWhile(/\w/);var k=a[f.current()];return k?(k[1]&&(k=k[0]),":"!=l?1==k?"keyword":2==k?"def":3==k?"atom":4==k?"operator":5==k?"variable-2":"meta":"meta"):"meta"}return null}var a={"->":4,"++":4,"--":4,"**":4,"=~":4,"!~":4,"*":4,"/":4,"%":4,x:4,"+":4,"-":4,".":4,"<<":4,">>":4,"<":4,">":4,"<=":4,">=":4,lt:4,gt:4,le:4,ge:4,"==":4,"!=":4,"<=>":4,eq:4,ne:4,cmp:4,"~~":4,"&":4,"|":4,"^":4,"&&":4,"||":4,"//":4,"..":4,"...":4,"?":4,":":4,"=":4,"+=":4,"-=":4,"*=":4,",":4,"=>":4,"::":4,not:4,and:4,or:4,xor:4,BEGIN:[5,1],END:[5,1],PRINT:[5,1],PRINTF:[5,1],GETC:[5,1],READ:[5,1],READLINE:[5,1],DESTROY:[5,1],TIE:[5,1],TIEHANDLE:[5,1],UNTIE:[5,1],STDIN:5,STDIN_TOP:5,STDOUT:5,STDOUT_TOP:5,STDERR:5,STDERR_TOP:5,$ARG:5,$_:5,"@ARG":5,"@_":5,$LIST_SEPARATOR:5,'$"':5,$PROCESS_ID:5,$PID:5,$$:5,$REAL_GROUP_ID:5,$GID:5,"$(":5,$EFFECTIVE_GROUP_ID:5,$EGID:5,"$)":5,$PROGRAM_NAME:5,$0:5,$SUBSCRIPT_SEPARATOR:5,$SUBSEP:5,"$;":5,$REAL_USER_ID:5,$UID:5,"$<":5,$EFFECTIVE_USER_ID:5,$EUID:5,"$>":5,$a:5,$b:5,$COMPILING:5,"$^C":5,$DEBUGGING:5,"$^D":5,"${^ENCODING}":5,$ENV:5,"%ENV":5,$SYSTEM_FD_MAX:5,"$^F":5,"@F":5,"${^GLOBAL_PHASE}":5,"$^H":5,"%^H":5,"@INC":5,"%INC":5,$INPLACE_EDIT:5,"$^I":5,"$^M":5,$OSNAME:5,"$^O":5,"${^OPEN}":5,$PERLDB:5,"$^P":5,$SIG:5,"%SIG":5,$BASETIME:5,"$^T":5,"${^TAINT}":5,"${^UNICODE}":5,"${^UTF8CACHE}":5,"${^UTF8LOCALE}":5,$PERL_VERSION:5,"$^V":5,"${^WIN32_SLOPPY_STAT}":5,$EXECUTABLE_NAME:5,"$^X":5,$1:5,$MATCH:5,"$&":5,"${^MATCH}":5,$PREMATCH:5,"$`":5,"${^PREMATCH}":5,$POSTMATCH:5,"$'":5,"${^POSTMATCH}":5,$LAST_PAREN_MATCH:5,"$+":5,$LAST_SUBMATCH_RESULT:5,"$^N":5,"@LAST_MATCH_END":5,"@+":5,"%LAST_PAREN_MATCH":5,"%+":5,"@LAST_MATCH_START":5,"@-":5,"%LAST_MATCH_START":5,"%-":5,$LAST_REGEXP_CODE_RESULT:5,"$^R":5,"${^RE_DEBUG_FLAGS}":5,"${^RE_TRIE_MAXBUF}":5,$ARGV:5,"@ARGV":5,ARGV:5,ARGVOUT:5,$OUTPUT_FIELD_SEPARATOR:5,$OFS:5,"$,":5,$INPUT_LINE_NUMBER:5,$NR:5,"$.":5,$INPUT_RECORD_SEPARATOR:5,$RS:5,"$/":5,$OUTPUT_RECORD_SEPARATOR:5,$ORS:5,"$\\":5,$OUTPUT_AUTOFLUSH:5,"$|":5,$ACCUMULATOR:5,"$^A":5,$FORMAT_FORMFEED:5,"$^L":5,$FORMAT_PAGE_NUMBER:5,"$%":5,$FORMAT_LINES_LEFT:5,"$-":5,$FORMAT_LINE_BREAK_CHARACTERS:5,"$:":5,$FORMAT_LINES_PER_PAGE:5,"$=":5,$FORMAT_TOP_NAME:5,"$^":5,$FORMAT_NAME:5,"$~":5,"${^CHILD_ERROR_NATIVE}":5,$EXTENDED_OS_ERROR:5,"$^E":5,$EXCEPTIONS_BEING_CAUGHT:5,"$^S":5,$WARNING:5,"$^W":5,"${^WARNING_BITS}":5,$OS_ERROR:5,$ERRNO:5,"$!":5,"%OS_ERROR":5,"%ERRNO":5,"%!":5,$CHILD_ERROR:5,"$?":5,$EVAL_ERROR:5,"$@":5,$OFMT:5,"$#":5,"$*":5,$ARRAY_BASE:5,"$[":5,$OLD_PERL_VERSION:5,"$]":5,"if":[1,1],elsif:[1,1],"else":[1,1],"while":[1,1],unless:[1,1],"for":[1,1],foreach:[1,1],abs:1,accept:1,alarm:1,atan2:1,bind:1,binmode:1,bless:1,bootstrap:1,"break":1,caller:1,chdir:1,chmod:1,chomp:1,chop:1,chown:1,chr:1,chroot:1,close:1,closedir:1,connect:1,"continue":[1,1],cos:1,crypt:1,dbmclose:1,dbmopen:1,"default":1,defined:1,"delete":1,die:1,"do":1,dump:1,each:1,endgrent:1,endhostent:1,endnetent:1,endprotoent:1,endpwent:1,endservent:1,eof:1,eval:1,exec:1,exists:1,exit:1,exp:1,fcntl:1,fileno:1,flock:1,fork:1,format:1,formline:1,getc:1,getgrent:1,getgrgid:1,getgrnam:1,gethostbyaddr:1,gethostbyname:1,gethostent:1,getlogin:1,getnetbyaddr:1,getnetbyname:1,getnetent:1,getpeername:1,getpgrp:1,getppid:1,getpriority:1,getprotobyname:1,getprotobynumber:1,getprotoent:1,getpwent:1,getpwnam:1,getpwuid:1,getservbyname:1,getservbyport:1,getservent:1,getsockname:1,getsockopt:1,given:1,glob:1,gmtime:1,"goto":1,grep:1,hex:1,"import":1,index:1,"int":1,ioctl:1,join:1,keys:1,kill:1,last:1,lc:1,lcfirst:1,length:1,link:1,listen:1,local:2,localtime:1,lock:1,log:1,lstat:1,m:null,map:1,mkdir:1,msgctl:1,msgget:1,msgrcv:1,msgsnd:1,my:2,"new":1,next:1,no:1,oct:1,open:1,opendir:1,ord:1,our:2,pack:1,"package":1,pipe:1,pop:1,pos:1,print:1,printf:1,prototype:1,push:1,q:null,qq:null,qr:null,quotemeta:null,qw:null,qx:null,rand:1,read:1,readdir:1,readline:1,readlink:1,readpipe:1,recv:1,redo:1,ref:1,rename:1,require:1,reset:1,"return":1,reverse:1,rewinddir:1,rindex:1,rmdir:1,s:null,say:1,scalar:1,seek:1,seekdir:1,select:1,semctl:1,semget:1,semop:1,send:1,setgrent:1,sethostent:1,setnetent:1,setpgrp:1,setpriority:1,setprotoent:1,setpwent:1,setservent:1,setsockopt:1,shift:1,shmctl:1,shmget:1,shmread:1,shmwrite:1,shutdown:1,sin:1,sleep:1,socket:1,socketpair:1,sort:1,splice:1,split:1,sprintf:1,sqrt:1,srand:1,stat:1,state:1,study:1,sub:1,substr:1,symlink:1,syscall:1,sysopen:1,sysread:1,sysseek:1,system:1,syswrite:1,tell:1,telldir:1,tie:1,tied:1,time:1,times:1,tr:null,truncate:1,uc:1,ucfirst:1,umask:1,undef:1,unlink:1,unpack:1,unshift:1,untie:1,use:1,utime:1,values:1,vec:1,wait:1,waitpid:1,wantarray:1,warn:1,when:1,write:1,y:null},b="string-2",c=/[goseximacplud]/;return{startState:function(){return{tokenize:f,chain:null,style:null,tail:null}},token:function(a,b){return(b.tokenize||f)(a,b)},electricChars:"{}"}}),CodeMirror.defineMIME("text/x-perl","perl"),CodeMirror.StringStream.prototype.look=function(a){return this.string.charAt(this.pos+(a||0))},CodeMirror.StringStream.prototype.prefix=function(a){if(a){var b=this.pos-a;return this.string.substr(b>=0?b:0,a)}return this.string.substr(0,this.pos-1)},CodeMirror.StringStream.prototype.suffix=function(a){var b=this.string.length,c=b-this.pos+1;return this.string.substr(this.pos,a&&b>a?a:c)},CodeMirror.StringStream.prototype.nsuffix=function(a){var b=this.pos,c=a||this.string.length-this.pos+1;return this.pos+=c,this.string.substr(b,c)},CodeMirror.StringStream.prototype.eatSuffix=function(a){var c,b=this.pos+a;this.pos=0>=b?0:b>=(c=this.string.length-1)?c:b},function(){"use strict";function c(c){"activeLine"in c.state&&(c.removeLineClass(c.state.activeLine,"wrap",a),c.removeLineClass(c.state.activeLine,"background",b))}function d(d){var e=d.getLineHandleVisualStart(d.getCursor().line);d.state.activeLine!=e&&(c(d),d.addLineClass(e,"wrap",a),d.addLineClass(e,"background",b),d.state.activeLine=e)}var a="CodeMirror-activeline",b="CodeMirror-activeline-background";CodeMirror.defineOption("styleActiveLine",!1,function(a,b,e){var f=e&&e!=CodeMirror.Init;b&&!f?(d(a),a.on("cursorActivity",d)):!b&&f&&(a.off("cursorActivity",d),c(a),delete a.state.activeLine)})}(),function(){function d(a,b){var c=a.getRange(CodeMirror.Pos(b.line,b.ch-1),CodeMirror.Pos(b.line,b.ch+1));return 2==c.length?c:null}function e(a){for(var b={name:"autoCloseBrackets",Backspace:function(b){if(b.somethingSelected())return CodeMirror.Pass;var c=b.getCursor(),e=d(b,c);return e&&0==a.indexOf(e)%2?(b.replaceRange("",CodeMirror.Pos(c.line,c.ch-1),CodeMirror.Pos(c.line,c.ch+1)),void 0):CodeMirror.Pass}},e="",f=0;f0?j.charAt(h.ch-1):"";return a==d&&CodeMirror.isWordChar(l)?CodeMirror.Pass:j.length==h.ch||e.indexOf(k)>=0||c.test(k)?(b.replaceSelection(a+d,{head:i,anchor:i}),void 0):CodeMirror.Pass}},a!=d&&(b["'"+d+"'"]=g)}(a.charAt(f),a.charAt(f+1));return b}function f(a){return function(b){var c=b.getCursor(),e=d(b,c);return e&&0==a.indexOf(e)%2?(b.operation(function(){var a=CodeMirror.Pos(c.line+1,0);b.replaceSelection("\n\n",{anchor:a,head:a},"+input"),b.indentLine(c.line+1,null,!0),b.indentLine(c.line+2,null,!0)}),void 0):CodeMirror.Pass}}var a="()[]{}''\"\"",b="[]{}",c=/\s/;CodeMirror.defineOption("autoCloseBrackets",!1,function(c,d,g){if(g!=CodeMirror.Init&&g&&c.removeKeyMap("autoCloseBrackets"),d){var h=a,i=b;"string"==typeof d?h=d:"object"==typeof d&&(null!=d.pairs&&(h=d.pairs),null!=d.explode&&(i=d.explode));var j=e(h);i&&(j.Enter=f(i)),c.addKeyMap(j)}})}();