D7net Mini Sh3LL v1
Current File : /var/www/html/hpsc/../informatica/media/system/../com_akeeba/../mod_languages/../com_finder/../editors/codemirror/lib/codemirror.min.js |
!function(a){if("object"==typeof exports&&"object"==typeof module)module.exports=a();else{if("function"==typeof define&&define.amd)return define([],a);this.CodeMirror=a()}}(function(){"use strict";function a(c,d){if(!(this instanceof a))return new a(c,d);this.options=d=d?Je(d):{},Je(Xf,d,!1),n(d);var e=d.value;"string"==typeof e&&(e=new tg(e,d.mode,null,d.lineSeparator)),this.doc=e;var f=new a.inputStyles[d.inputStyle](this),g=this.display=new b(c,e,f);g.wrapper.CodeMirror=this,j(this),h(this),d.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),d.autofocus&&!zf&&g.input.focus(),r(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 Be,keySeq:null,specialChars:null};var i=this;pf&&11>qf&&setTimeout(function(){i.display.input.reset(!0)},20),Pb(this),Ve(),tb(this),this.curOp.forceUpdate=!0,Wd(this,e),d.autofocus&&!zf||i.hasFocus()?setTimeout(Ke(pc,this),20):qc(this);for(var k in Yf)Yf.hasOwnProperty(k)&&Yf[k](this,d[k],Zf);w(this),d.finishInit&&d.finishInit(this);for(var l=0;l<bg.length;++l)bg[l](this);vb(this),rf&&d.lineWrapping&&"optimizelegibility"==getComputedStyle(g.lineDiv).textRendering&&(g.lineDiv.style.textRendering="auto")}function b(a,b,c){var d=this;this.input=c,d.scrollbarFiller=Oe("div",null,"CodeMirror-scrollbar-filler"),d.scrollbarFiller.setAttribute("cm-not-content","true"),d.gutterFiller=Oe("div",null,"CodeMirror-gutter-filler"),d.gutterFiller.setAttribute("cm-not-content","true"),d.lineDiv=Oe("div",null,"CodeMirror-code"),d.selectionDiv=Oe("div",null,null,"position: relative; z-index: 1"),d.cursorDiv=Oe("div",null,"CodeMirror-cursors"),d.measure=Oe("div",null,"CodeMirror-measure"),d.lineMeasure=Oe("div",null,"CodeMirror-measure"),d.lineSpace=Oe("div",[d.measure,d.lineMeasure,d.selectionDiv,d.cursorDiv,d.lineDiv],null,"position: relative; outline: none"),d.mover=Oe("div",[Oe("div",[d.lineSpace],"CodeMirror-lines")],null,"position: relative"),d.sizer=Oe("div",[d.mover],"CodeMirror-sizer"),d.sizerWidth=null,d.heightForcer=Oe("div",null,null,"position: absolute; height: "+Dg+"px; width: 1px;"),d.gutters=Oe("div",null,"CodeMirror-gutters"),d.lineGutter=null,d.scroller=Oe("div",[d.sizer,d.heightForcer,d.gutters],"CodeMirror-scroll"),d.scroller.setAttribute("tabIndex","-1"),d.wrapper=Oe("div",[d.scrollbarFiller,d.gutterFiller,d.scroller],"CodeMirror"),pf&&8>qf&&(d.gutters.style.zIndex=-1,d.scroller.style.paddingRight=0),rf||mf&&zf||(d.scroller.draggable=!0),a&&(a.appendChild?a.appendChild(d.wrapper):a(d.wrapper)),d.viewFrom=d.viewTo=b.first,d.reportedViewFrom=d.reportedViewTo=b.first,d.view=[],d.renderedView=null,d.externalMeasured=null,d.viewOffset=0,d.lastWrapHeight=d.lastWrapWidth=0,d.updateLineNumbers=null,d.nativeBarWidth=d.barHeight=d.barWidth=0,d.scrollbarsClipped=!1,d.lineNumWidth=d.lineNumInnerWidth=d.lineNumChars=null,d.alignWidgets=!1,d.cachedCharWidth=d.cachedTextHeight=d.cachedPaddingH=null,d.maxLine=null,d.maxLineLength=0,d.maxLineChanged=!1,d.wheelDX=d.wheelDY=d.wheelStartX=d.wheelStartY=null,d.shift=!1,d.selForContextMenu=null,d.activeTouch=null,c.init(d)}function c(b){b.doc.mode=a.getMode(b.options,b.doc.modeOption),d(b)}function d(a){a.doc.iter(function(a){a.stateAfter&&(a.stateAfter=null),a.styles&&(a.styles=null)}),a.doc.frontier=a.doc.first,Ma(a,100),a.state.modeGen++,a.curOp&&Ib(a)}function e(a){a.options.lineWrapping?(Tg(a.display.wrapper,"CodeMirror-wrap"),a.display.sizer.style.minWidth="",a.display.sizerWidth=null):(Sg(a.display.wrapper,"CodeMirror-wrap"),m(a)),g(a),Ib(a),gb(a),setTimeout(function(){s(a)},100)}function f(a){var b=rb(a.display),c=a.options.lineWrapping,d=c&&Math.max(5,a.display.scroller.clientWidth/sb(a.display)-3);return function(e){if(ud(a.doc,e))return 0;var f=0;if(e.widgets)for(var g=0;g<e.widgets.length;g++)e.widgets[g].height&&(f+=e.widgets[g].height);return c?f+(Math.ceil(e.text.length/d)||1)*b:f+b}}function g(a){var b=a.doc,c=f(a);b.iter(function(a){var b=c(a);b!=a.height&&$d(a,b)})}function h(a){a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+a.options.theme.replace(/(^|\s)\s*/g," cm-s-"),gb(a)}function i(a){j(a),Ib(a),setTimeout(function(){v(a)},20)}function j(a){var b=a.display.gutters,c=a.options.gutters;Pe(b);for(var d=0;d<c.length;++d){var e=c[d],f=b.appendChild(Oe("div",null,"CodeMirror-gutter "+e));"CodeMirror-linenumbers"==e&&(a.display.lineGutter=f,f.style.width=(a.display.lineNumWidth||1)+"px")}b.style.display=d?"":"none",k(a)}function k(a){var b=a.display.gutters.offsetWidth;a.display.sizer.style.marginLeft=b+"px"}function l(a){if(0==a.height)return 0;for(var b,c=a.text.length,d=a;b=nd(d);){var e=b.find(0,!0);d=e.from.line,c+=e.from.ch-e.to.ch}for(d=a;b=od(d);){var e=b.find(0,!0);c-=d.text.length-e.from.ch,d=e.to.line,c+=d.text.length-e.to.ch}return c}function m(a){var b=a.display,c=a.doc;b.maxLine=Xd(c,c.first),b.maxLineLength=l(b.maxLine),b.maxLineChanged=!0,c.iter(function(a){var c=l(a);c>b.maxLineLength&&(b.maxLineLength=c,b.maxLine=a)})}function n(a){var b=Fe(a.gutters,"CodeMirror-linenumbers");-1==b&&a.lineNumbers?a.gutters=a.gutters.concat(["CodeMirror-linenumbers"]):b>-1&&!a.lineNumbers&&(a.gutters=a.gutters.slice(0),a.gutters.splice(b,1))}function o(a){var b=a.display,c=b.gutters.offsetWidth,d=Math.round(a.doc.height+Ra(a.display));return{clientHeight:b.scroller.clientHeight,viewHeight:b.wrapper.clientHeight,scrollWidth:b.scroller.scrollWidth,clientWidth:b.scroller.clientWidth,viewWidth:b.wrapper.clientWidth,barLeft:a.options.fixedGutter?c:0,docHeight:d,scrollHeight:d+Ta(a)+b.barHeight,nativeBarWidth:b.nativeBarWidth,gutterWidth:c}}function p(a,b,c){this.cm=c;var d=this.vert=Oe("div",[Oe("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),e=this.horiz=Oe("div",[Oe("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");a(d),a(e),zg(d,"scroll",function(){d.clientHeight&&b(d.scrollTop,"vertical")}),zg(e,"scroll",function(){e.clientWidth&&b(e.scrollLeft,"horizontal")}),this.checkedOverlay=!1,pf&&8>qf&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")}function q(){}function r(b){b.display.scrollbars&&(b.display.scrollbars.clear(),b.display.scrollbars.addClass&&Sg(b.display.wrapper,b.display.scrollbars.addClass)),b.display.scrollbars=new a.scrollbarModel[b.options.scrollbarStyle](function(a){b.display.wrapper.insertBefore(a,b.display.scrollbarFiller),zg(a,"mousedown",function(){b.state.focused&&setTimeout(function(){b.display.input.focus()},0)}),a.setAttribute("cm-not-content","true")},function(a,c){"horizontal"==c?dc(b,a):cc(b,a)},b),b.display.scrollbars.addClass&&Tg(b.display.wrapper,b.display.scrollbars.addClass)}function s(a,b){b||(b=o(a));var c=a.display.barWidth,d=a.display.barHeight;t(a,b);for(var e=0;4>e&&c!=a.display.barWidth||d!=a.display.barHeight;e++)c!=a.display.barWidth&&a.options.lineWrapping&&F(a),t(a,o(a)),c=a.display.barWidth,d=a.display.barHeight}function t(a,b){var c=a.display,d=c.scrollbars.update(b);c.sizer.style.paddingRight=(c.barWidth=d.right)+"px",c.sizer.style.paddingBottom=(c.barHeight=d.bottom)+"px",d.right&&d.bottom?(c.scrollbarFiller.style.display="block",c.scrollbarFiller.style.height=d.bottom+"px",c.scrollbarFiller.style.width=d.right+"px"):c.scrollbarFiller.style.display="",d.bottom&&a.options.coverGutterNextToScrollbar&&a.options.fixedGutter?(c.gutterFiller.style.display="block",c.gutterFiller.style.height=d.bottom+"px",c.gutterFiller.style.width=b.gutterWidth+"px"):c.gutterFiller.style.display=""}function u(a,b,c){var d=c&&null!=c.top?Math.max(0,c.top):a.scroller.scrollTop;d=Math.floor(d-Qa(a));var e=c&&null!=c.bottom?c.bottom:d+a.wrapper.clientHeight,f=ae(b,d),g=ae(b,e);if(c&&c.ensure){var h=c.ensure.from.line,i=c.ensure.to.line;f>h?(f=h,g=ae(b,be(Xd(b,h))+a.wrapper.clientHeight)):Math.min(i,b.lastLine())>=g&&(f=ae(b,be(Xd(b,i))-a.wrapper.clientHeight),g=i)}return{from:f,to:Math.max(g,f+1)}}function v(a){var b=a.display,c=b.view;if(b.alignWidgets||b.gutters.firstChild&&a.options.fixedGutter){for(var d=y(b)-b.scroller.scrollLeft+a.doc.scrollLeft,e=b.gutters.offsetWidth,f=d+"px",g=0;g<c.length;g++)if(!c[g].hidden){a.options.fixedGutter&&c[g].gutter&&(c[g].gutter.style.left=f);var h=c[g].alignable;if(h)for(var i=0;i<h.length;i++)h[i].style.left=f}a.options.fixedGutter&&(b.gutters.style.left=d+e+"px")}}function w(a){if(!a.options.lineNumbers)return!1;var b=a.doc,c=x(a.options,b.first+b.size-1),d=a.display;if(c.length!=d.lineNumChars){var e=d.measure.appendChild(Oe("div",[Oe("div",c)],"CodeMirror-linenumber CodeMirror-gutter-elt")),f=e.firstChild.offsetWidth,g=e.offsetWidth-f;return d.lineGutter.style.width="",d.lineNumInnerWidth=Math.max(f,d.lineGutter.offsetWidth-g)+1,d.lineNumWidth=d.lineNumInnerWidth+g,d.lineNumChars=d.lineNumInnerWidth?c.length:-1,d.lineGutter.style.width=d.lineNumWidth+"px",k(a),!0}return!1}function x(a,b){return String(a.lineNumberFormatter(b+a.firstLineNumber))}function y(a){return a.scroller.getBoundingClientRect().left-a.sizer.getBoundingClientRect().left}function z(a,b,c){var d=a.display;this.viewport=b,this.visible=u(d,a.doc,b),this.editorIsHidden=!d.wrapper.offsetWidth,this.wrapperHeight=d.wrapper.clientHeight,this.wrapperWidth=d.wrapper.clientWidth,this.oldDisplayWidth=Ua(a),this.force=c,this.dims=H(a),this.events=[]}function A(a){var b=a.display;!b.scrollbarsClipped&&b.scroller.offsetWidth&&(b.nativeBarWidth=b.scroller.offsetWidth-b.scroller.clientWidth,b.heightForcer.style.height=Ta(a)+"px",b.sizer.style.marginBottom=-b.nativeBarWidth+"px",b.sizer.style.borderRightWidth=Ta(a)+"px",b.scrollbarsClipped=!0)}function B(a,b){var c=a.display,d=a.doc;if(b.editorIsHidden)return Kb(a),!1;if(!b.force&&b.visible.from>=c.viewFrom&&b.visible.to<=c.viewTo&&(null==c.updateLineNumbers||c.updateLineNumbers>=c.viewTo)&&c.renderedView==c.view&&0==Ob(a))return!1;w(a)&&(Kb(a),b.dims=H(a));var e=d.first+d.size,f=Math.max(b.visible.from-a.options.viewportMargin,d.first),g=Math.min(e,b.visible.to+a.options.viewportMargin);c.viewFrom<f&&f-c.viewFrom<20&&(f=Math.max(d.first,c.viewFrom)),c.viewTo>g&&c.viewTo-g<20&&(g=Math.min(e,c.viewTo)),Gf&&(f=sd(a.doc,f),g=td(a.doc,g));var h=f!=c.viewFrom||g!=c.viewTo||c.lastWrapHeight!=b.wrapperHeight||c.lastWrapWidth!=b.wrapperWidth;Nb(a,f,g),c.viewOffset=be(Xd(a.doc,c.viewFrom)),a.display.mover.style.top=c.viewOffset+"px";var i=Ob(a);if(!h&&0==i&&!b.force&&c.renderedView==c.view&&(null==c.updateLineNumbers||c.updateLineNumbers>=c.viewTo))return!1;var j=Re();return i>4&&(c.lineDiv.style.display="none"),I(a,c.updateLineNumbers,b.dims),i>4&&(c.lineDiv.style.display=""),c.renderedView=c.view,j&&Re()!=j&&j.offsetHeight&&j.focus(),Pe(c.cursorDiv),Pe(c.selectionDiv),c.gutters.style.height=c.sizer.style.minHeight=0,h&&(c.lastWrapHeight=b.wrapperHeight,c.lastWrapWidth=b.wrapperWidth,Ma(a,400)),c.updateLineNumbers=null,!0}function C(a,b){for(var c=b.viewport,d=!0;(d&&a.options.lineWrapping&&b.oldDisplayWidth!=Ua(a)||(c&&null!=c.top&&(c={top:Math.min(a.doc.height+Ra(a.display)-Va(a),c.top)}),b.visible=u(a.display,a.doc,c),!(b.visible.from>=a.display.viewFrom&&b.visible.to<=a.display.viewTo)))&&B(a,b);d=!1){F(a);var e=o(a);Ha(a),E(a,e),s(a,e)}b.signal(a,"update",a),(a.display.viewFrom!=a.display.reportedViewFrom||a.display.viewTo!=a.display.reportedViewTo)&&(b.signal(a,"viewportChange",a,a.display.viewFrom,a.display.viewTo),a.display.reportedViewFrom=a.display.viewFrom,a.display.reportedViewTo=a.display.viewTo)}function D(a,b){var c=new z(a,b);if(B(a,c)){F(a),C(a,c);var d=o(a);Ha(a),E(a,d),s(a,d),c.finish()}}function E(a,b){a.display.sizer.style.minHeight=b.docHeight+"px";var c=b.docHeight+a.display.barHeight;a.display.heightForcer.style.top=c+"px",a.display.gutters.style.height=Math.max(c+Ta(a),b.clientHeight)+"px"}function F(a){for(var b=a.display,c=b.lineDiv.offsetTop,d=0;d<b.view.length;d++){var e,f=b.view[d];if(!f.hidden){if(pf&&8>qf){var g=f.node.offsetTop+f.node.offsetHeight;e=g-c,c=g}else{var h=f.node.getBoundingClientRect();e=h.bottom-h.top}var i=f.line.height-e;if(2>e&&(e=rb(b)),(i>.001||-.001>i)&&($d(f.line,e),G(f.line),f.rest))for(var j=0;j<f.rest.length;j++)G(f.rest[j])}}}function G(a){if(a.widgets)for(var b=0;b<a.widgets.length;++b)a.widgets[b].height=a.widgets[b].node.offsetHeight}function H(a){for(var b=a.display,c={},d={},e=b.gutters.clientLeft,f=b.gutters.firstChild,g=0;f;f=f.nextSibling,++g)c[a.options.gutters[g]]=f.offsetLeft+f.clientLeft+e,d[a.options.gutters[g]]=f.clientWidth;return{fixedPos:y(b),gutterTotalWidth:b.gutters.offsetWidth,gutterLeft:c,gutterWidth:d,wrapperWidth:b.wrapper.clientWidth}}function I(a,b,c){function d(b){var c=b.nextSibling;return rf&&Af&&a.display.currentWheelTarget==b?b.style.display="none":b.parentNode.removeChild(b),c}for(var e=a.display,f=a.options.lineNumbers,g=e.lineDiv,h=g.firstChild,i=e.view,j=e.viewFrom,k=0;k<i.length;k++){var l=i[k];if(l.hidden);else if(l.node&&l.node.parentNode==g){for(;h!=l.node;)h=d(h);var m=f&&null!=b&&j>=b&&l.lineNumber;l.changes&&(Fe(l.changes,"gutter")>-1&&(m=!1),J(a,l,j,c)),m&&(Pe(l.lineNumber),l.lineNumber.appendChild(document.createTextNode(x(a.options,j)))),h=l.node.nextSibling}else{var n=R(a,l,j,c);g.insertBefore(n,h)}j+=l.size}for(;h;)h=d(h)}function J(a,b,c,d){for(var e=0;e<b.changes.length;e++){var f=b.changes[e];"text"==f?N(a,b):"gutter"==f?P(a,b,c,d):"class"==f?O(b):"widget"==f&&Q(a,b,d)}b.changes=null}function K(a){return a.node==a.text&&(a.node=Oe("div",null,null,"position: relative"),a.text.parentNode&&a.text.parentNode.replaceChild(a.node,a.text),a.node.appendChild(a.text),pf&&8>qf&&(a.node.style.zIndex=2)),a.node}function L(a){var b=a.bgClass?a.bgClass+" "+(a.line.bgClass||""):a.line.bgClass;if(b&&(b+=" CodeMirror-linebackground"),a.background)b?a.background.className=b:(a.background.parentNode.removeChild(a.background),a.background=null);else if(b){var c=K(a);a.background=c.insertBefore(Oe("div",null,b),c.firstChild)}}function M(a,b){var c=a.display.externalMeasured;return c&&c.line==b.line?(a.display.externalMeasured=null,b.measure=c.measure,c.built):Kd(a,b)}function N(a,b){var c=b.text.className,d=M(a,b);b.text==b.node&&(b.node=d.pre),b.text.parentNode.replaceChild(d.pre,b.text),b.text=d.pre,d.bgClass!=b.bgClass||d.textClass!=b.textClass?(b.bgClass=d.bgClass,b.textClass=d.textClass,O(b)):c&&(b.text.className=c)}function O(a){L(a),a.line.wrapClass?K(a).className=a.line.wrapClass:a.node!=a.text&&(a.node.className="");var b=a.textClass?a.textClass+" "+(a.line.textClass||""):a.line.textClass;a.text.className=b||""}function P(a,b,c,d){if(b.gutter&&(b.node.removeChild(b.gutter),b.gutter=null),b.gutterBackground&&(b.node.removeChild(b.gutterBackground),b.gutterBackground=null),b.line.gutterClass){var e=K(b);b.gutterBackground=Oe("div",null,"CodeMirror-gutter-background "+b.line.gutterClass,"left: "+(a.options.fixedGutter?d.fixedPos:-d.gutterTotalWidth)+"px; width: "+d.gutterTotalWidth+"px"),e.insertBefore(b.gutterBackground,b.text)}var f=b.line.gutterMarkers;if(a.options.lineNumbers||f){var e=K(b),g=b.gutter=Oe("div",null,"CodeMirror-gutter-wrapper","left: "+(a.options.fixedGutter?d.fixedPos:-d.gutterTotalWidth)+"px");if(a.display.input.setUneditable(g),e.insertBefore(g,b.text),b.line.gutterClass&&(g.className+=" "+b.line.gutterClass),!a.options.lineNumbers||f&&f["CodeMirror-linenumbers"]||(b.lineNumber=g.appendChild(Oe("div",x(a.options,c),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+d.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+a.display.lineNumInnerWidth+"px"))),f)for(var h=0;h<a.options.gutters.length;++h){var i=a.options.gutters[h],j=f.hasOwnProperty(i)&&f[i];j&&g.appendChild(Oe("div",[j],"CodeMirror-gutter-elt","left: "+d.gutterLeft[i]+"px; width: "+d.gutterWidth[i]+"px"))}}}function Q(a,b,c){b.alignable&&(b.alignable=null);for(var d,e=b.node.firstChild;e;e=d){var d=e.nextSibling;"CodeMirror-linewidget"==e.className&&b.node.removeChild(e)}S(a,b,c)}function R(a,b,c,d){var e=M(a,b);return b.text=b.node=e.pre,e.bgClass&&(b.bgClass=e.bgClass),e.textClass&&(b.textClass=e.textClass),O(b),P(a,b,c,d),S(a,b,d),b.node}function S(a,b,c){if(T(a,b.line,b,c,!0),b.rest)for(var d=0;d<b.rest.length;d++)T(a,b.rest[d],b,c,!1)}function T(a,b,c,d,e){if(b.widgets)for(var f=K(c),g=0,h=b.widgets;g<h.length;++g){var i=h[g],j=Oe("div",[i.node],"CodeMirror-linewidget");i.handleMouseEvents||j.setAttribute("cm-ignore-events","true"),U(i,j,c,d),a.display.input.setUneditable(j),e&&i.above?f.insertBefore(j,c.gutter||c.text):f.appendChild(j),ve(i,"redraw")}}function U(a,b,c,d){if(a.noHScroll){(c.alignable||(c.alignable=[])).push(b);var e=d.wrapperWidth;b.style.left=d.fixedPos+"px",a.coverGutter||(e-=d.gutterTotalWidth,b.style.paddingLeft=d.gutterTotalWidth+"px"),b.style.width=e+"px"}a.coverGutter&&(b.style.zIndex=5,b.style.position="relative",a.noHScroll||(b.style.marginLeft=-d.gutterTotalWidth+"px"))}function V(a){return Hf(a.line,a.ch)}function W(a,b){return If(a,b)<0?b:a}function X(a,b){return If(a,b)<0?a:b}function Y(a){a.state.focused||(a.display.input.focus(),pc(a))}function Z(a){return a.options.readOnly||a.doc.cantEdit}function $(a,b,c,d,e){var f=a.doc;a.display.shift=!1,d||(d=f.sel);var g=a.state.pasteIncoming||"paste"==e,h=f.splitLines(b),i=null;if(g&&d.ranges.length>1)if(Jf&&Jf.join("\n")==b){if(d.ranges.length%Jf.length==0){i=[];for(var j=0;j<Jf.length;j++)i.push(f.splitLines(Jf[j]))}}else h.length==d.ranges.length&&(i=Ge(h,function(a){return[a]}));for(var j=d.ranges.length-1;j>=0;j--){var k=d.ranges[j],l=k.from(),m=k.to();k.empty()&&(c&&c>0?l=Hf(l.line,l.ch-c):a.state.overwrite&&!g&&(m=Hf(m.line,Math.min(Xd(f,m.line).text.length,m.ch+Ee(h).length))));var n=a.curOp.updateInput,o={from:l,to:m,text:i?i[j%i.length]:h,origin:e||(g?"paste":a.state.cutIncoming?"cut":"+input")};yc(a.doc,o),ve(a,"inputRead",a,o)}b&&!g&&aa(a,b),Kc(a),a.curOp.updateInput=n,a.curOp.typing=!0,a.state.pasteIncoming=a.state.cutIncoming=!1}function _(a,b){var c=a.clipboardData&&a.clipboardData.getData("text/plain");return c?(a.preventDefault(),Z(b)||b.options.disableInput||Cb(b,function(){$(b,c,0,null,"paste")}),!0):void 0}function aa(a,b){if(a.options.electricChars&&a.options.smartIndent)for(var c=a.doc.sel,d=c.ranges.length-1;d>=0;d--){var e=c.ranges[d];if(!(e.head.ch>100||d&&c.ranges[d-1].head.line==e.head.line)){var f=a.getModeAt(e.head),g=!1;if(f.electricChars){for(var h=0;h<f.electricChars.length;h++)if(b.indexOf(f.electricChars.charAt(h))>-1){g=Mc(a,e.head.line,"smart");break}}else f.electricInput&&f.electricInput.test(Xd(a.doc,e.head.line).text.slice(0,e.head.ch))&&(g=Mc(a,e.head.line,"smart"));g&&ve(a,"electricInput",a,e.head.line)}}}function ba(a){for(var b=[],c=[],d=0;d<a.doc.sel.ranges.length;d++){var e=a.doc.sel.ranges[d].head.line,f={anchor:Hf(e,0),head:Hf(e+1,0)};c.push(f),b.push(a.getRange(f.anchor,f.head))}return{text:b,ranges:c}}function ca(a){a.setAttribute("autocorrect","off"),a.setAttribute("autocapitalize","off"),a.setAttribute("spellcheck","false")}function da(a){this.cm=a,this.prevInput="",this.pollingFast=!1,this.polling=new Be,this.inaccurateSelection=!1,this.hasSelection=!1,this.composing=null}function ea(){var a=Oe("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none"),b=Oe("div",[a],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return rf?a.style.width="1000px":a.setAttribute("wrap","off"),yf&&(a.style.border="1px solid black"),ca(a),b}function fa(a){this.cm=a,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Be,this.gracePeriod=!1}function ga(a,b){var c=$a(a,b.line);if(!c||c.hidden)return null;var d=Xd(a.doc,b.line),e=Xa(c,d,b.line),f=ce(d),g="left";if(f){var h=hf(f,b.ch);g=h%2?"right":"left"}var i=bb(e.map,b.ch,g);return i.offset="right"==i.collapse?i.end:i.start,i}function ha(a,b){return b&&(a.bad=!0),a}function ia(a,b,c){var d;if(b==a.display.lineDiv){if(d=a.display.lineDiv.childNodes[c],!d)return ha(a.clipPos(Hf(a.display.viewTo-1)),!0);b=null,c=0}else for(d=b;;d=d.parentNode){if(!d||d==a.display.lineDiv)return null;if(d.parentNode&&d.parentNode==a.display.lineDiv)break}for(var e=0;e<a.display.view.length;e++){var f=a.display.view[e];if(f.node==d)return ja(f,b,c)}}function ja(a,b,c){function d(b,c,d){for(var e=-1;e<(k?k.length:0);e++)for(var f=0>e?j.map:k[e],g=0;g<f.length;g+=3){var h=f[g+2];if(h==b||h==c){var i=_d(0>e?a.line:a.rest[e]),l=f[g]+d;return(0>d||h!=b)&&(l=f[g+(d?1:0)]),Hf(i,l)}}}var e=a.text.firstChild,f=!1;if(!b||!Pg(e,b))return ha(Hf(_d(a.line),0),!0);if(b==e&&(f=!0,b=e.childNodes[c],c=0,!b)){var g=a.rest?Ee(a.rest):a.line;return ha(Hf(_d(g),g.text.length),f)}var h=3==b.nodeType?b:null,i=b;for(h||1!=b.childNodes.length||3!=b.firstChild.nodeType||(h=b.firstChild,c&&(c=h.nodeValue.length));i.parentNode!=e;)i=i.parentNode;var j=a.measure,k=j.maps,l=d(h,i,c);if(l)return ha(l,f);for(var m=i.nextSibling,n=h?h.nodeValue.length-c:0;m;m=m.nextSibling){if(l=d(m,m.firstChild,0))return ha(Hf(l.line,l.ch-n),f);n+=m.textContent.length}for(var o=i.previousSibling,n=c;o;o=o.previousSibling){if(l=d(o,o.firstChild,-1))return ha(Hf(l.line,l.ch+n),f);n+=m.textContent.length}}function ka(a,b,c,d,e){function f(a){return function(b){return b.id==a}}function g(b){if(1==b.nodeType){var c=b.getAttribute("cm-text");if(null!=c)return""==c&&(c=b.textContent.replace(/\u200b/g,"")),void(h+=c);var k,l=b.getAttribute("cm-marker");if(l){var m=a.findMarks(Hf(d,0),Hf(e+1,0),f(+l));return void(m.length&&(k=m[0].find())&&(h+=Yd(a.doc,k.from,k.to).join(j)))}if("false"==b.getAttribute("contenteditable"))return;for(var n=0;n<b.childNodes.length;n++)g(b.childNodes[n]);/^(pre|div|p)$/i.test(b.nodeName)&&(i=!0)}else if(3==b.nodeType){var o=b.nodeValue;if(!o)return;i&&(h+=j,i=!1),h+=o}}for(var h="",i=!1,j=a.doc.lineSeparator();g(b),b!=c;)b=b.nextSibling;return h}function la(a,b){this.ranges=a,this.primIndex=b}function ma(a,b){this.anchor=a,this.head=b}function na(a,b){var c=a[b];a.sort(function(a,b){return If(a.from(),b.from())}),b=Fe(a,c);for(var d=1;d<a.length;d++){var e=a[d],f=a[d-1];if(If(f.to(),e.from())>=0){var g=X(f.from(),e.from()),h=W(f.to(),e.to()),i=f.empty()?e.from()==e.head:f.from()==f.head;b>=d&&--b,a.splice(--d,2,new ma(i?h:g,i?g:h))}}return new la(a,b)}function oa(a,b){return new la([new ma(a,b||a)],0)}function pa(a,b){return Math.max(a.first,Math.min(b,a.first+a.size-1))}function qa(a,b){if(b.line<a.first)return Hf(a.first,0);var c=a.first+a.size-1;return b.line>c?Hf(c,Xd(a,c).text.length):ra(b,Xd(a,b.line).text.length)}function ra(a,b){var c=a.ch;return null==c||c>b?Hf(a.line,b):0>c?Hf(a.line,0):a}function sa(a,b){return b>=a.first&&b<a.first+a.size}function ta(a,b){for(var c=[],d=0;d<b.length;d++)c[d]=qa(a,b[d]);return c}function ua(a,b,c,d){if(a.cm&&a.cm.display.shift||a.extend){var e=b.anchor;if(d){var f=If(c,e)<0;f!=If(d,e)<0?(e=c,c=d):f!=If(c,d)<0&&(c=d)}return new ma(e,c)}return new ma(d||c,c)}function va(a,b,c,d){Ba(a,new la([ua(a,a.sel.primary(),b,c)],0),d)}function wa(a,b,c){for(var d=[],e=0;e<a.sel.ranges.length;e++)d[e]=ua(a,a.sel.ranges[e],b[e],null);var f=na(d,a.sel.primIndex);Ba(a,f,c)}function xa(a,b,c,d){var e=a.sel.ranges.slice(0);e[b]=c,Ba(a,na(e,a.sel.primIndex),d)}function ya(a,b,c,d){Ba(a,oa(b,c),d)}function za(a,b){var c={ranges:b.ranges,update:function(b){this.ranges=[];for(var c=0;c<b.length;c++)this.ranges[c]=new ma(qa(a,b[c].anchor),qa(a,b[c].head))}};return Bg(a,"beforeSelectionChange",a,c),a.cm&&Bg(a.cm,"beforeSelectionChange",a.cm,c),c.ranges!=b.ranges?na(c.ranges,c.ranges.length-1):b}function Aa(a,b,c){var d=a.history.done,e=Ee(d);e&&e.ranges?(d[d.length-1]=b,Ca(a,b,c)):Ba(a,b,c)}function Ba(a,b,c){Ca(a,b,c),je(a,a.sel,a.cm?a.cm.curOp.id:NaN,c)}function Ca(a,b,c){(ze(a,"beforeSelectionChange")||a.cm&&ze(a.cm,"beforeSelectionChange"))&&(b=za(a,b));var d=c&&c.bias||(If(b.primary().head,a.sel.primary().head)<0?-1:1);Da(a,Fa(a,b,d,!0)),c&&c.scroll===!1||!a.cm||Kc(a.cm)}function Da(a,b){b.equals(a.sel)||(a.sel=b,a.cm&&(a.cm.curOp.updateInput=a.cm.curOp.selectionChanged=!0,ye(a.cm)),ve(a,"cursorActivity",a))}function Ea(a){Da(a,Fa(a,a.sel,null,!1),Fg)}function Fa(a,b,c,d){for(var e,f=0;f<b.ranges.length;f++){var g=b.ranges[f],h=Ga(a,g.anchor,c,d),i=Ga(a,g.head,c,d);(e||h!=g.anchor||i!=g.head)&&(e||(e=b.ranges.slice(0,f)),e[f]=new ma(h,i))}return e?na(e,b.primIndex):b}function Ga(a,b,c,d){var e=!1,f=b,g=c||1;a.cantEdit=!1;a:for(;;){var h=Xd(a,f.line);if(h.markedSpans)for(var i=0;i<h.markedSpans.length;++i){var j=h.markedSpans[i],k=j.marker;if((null==j.from||(k.inclusiveLeft?j.from<=f.ch:j.from<f.ch))&&(null==j.to||(k.inclusiveRight?j.to>=f.ch:j.to>f.ch))){if(d&&(Bg(k,"beforeCursorEnter"),k.explicitlyCleared)){if(h.markedSpans){--i;continue}break}if(!k.atomic)continue;var l=k.find(0>g?-1:1);if(0==If(l,f)&&(l.ch+=g,l.ch<0?l=l.line>a.first?qa(a,Hf(l.line-1)):null:l.ch>h.text.length&&(l=l.line<a.first+a.size-1?Hf(l.line+1,0):null),!l)){if(e)return d?(a.cantEdit=!0,Hf(a.first,0)):Ga(a,b,c,!0);e=!0,l=b,g=-g}f=l;continue a}}return f}}function Ha(a){a.display.input.showSelection(a.display.input.prepareSelection())}function Ia(a,b){for(var c=a.doc,d={},e=d.cursors=document.createDocumentFragment(),f=d.selection=document.createDocumentFragment(),g=0;g<c.sel.ranges.length;g++)if(b!==!1||g!=c.sel.primIndex){var h=c.sel.ranges[g],i=h.empty();(i||a.options.showCursorWhenSelecting)&&Ja(a,h.head,e),i||Ka(a,h,f)}return d}function Ja(a,b,c){var d=mb(a,b,"div",null,null,!a.options.singleCursorHeightPerLine),e=c.appendChild(Oe("div"," ","CodeMirror-cursor"));if(e.style.left=d.left+"px",e.style.top=d.top+"px",e.style.height=Math.max(0,d.bottom-d.top)*a.options.cursorHeight+"px",d.other){var f=c.appendChild(Oe("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));f.style.display="",f.style.left=d.other.left+"px",f.style.top=d.other.top+"px",f.style.height=.85*(d.other.bottom-d.other.top)+"px"}}function Ka(a,b,c){function d(a,b,c,d){0>b&&(b=0),b=Math.round(b),d=Math.round(d),h.appendChild(Oe("div",null,"CodeMirror-selected","position: absolute; left: "+a+"px; top: "+b+"px; width: "+(null==c?k-a:c)+"px; height: "+(d-b)+"px"))}function e(b,c,e){function f(c,d){return lb(a,Hf(b,c),"div",l,d)}var h,i,l=Xd(g,b),m=l.text.length;return $e(ce(l),c||0,null==e?m:e,function(a,b,g){var l,n,o,p=f(a,"left");if(a==b)l=p,n=o=p.left;else{if(l=f(b-1,"right"),"rtl"==g){var q=p;p=l,l=q}n=p.left,o=l.right}null==c&&0==a&&(n=j),l.top-p.top>3&&(d(n,p.top,null,p.bottom),n=j,p.bottom<l.top&&d(n,p.bottom,null,l.top)),null==e&&b==m&&(o=k),(!h||p.top<h.top||p.top==h.top&&p.left<h.left)&&(h=p),(!i||l.bottom>i.bottom||l.bottom==i.bottom&&l.right>i.right)&&(i=l),j+1>n&&(n=j),d(n,l.top,o-n,l.bottom)}),{start:h,end:i}}var f=a.display,g=a.doc,h=document.createDocumentFragment(),i=Sa(a.display),j=i.left,k=Math.max(f.sizerWidth,Ua(a)-f.sizer.offsetLeft)-i.right,l=b.from(),m=b.to();if(l.line==m.line)e(l.line,l.ch,m.ch);else{var n=Xd(g,l.line),o=Xd(g,m.line),p=qd(n)==qd(o),q=e(l.line,l.ch,p?n.text.length+1:null).end,r=e(m.line,p?0:null,m.ch).start;p&&(q.top<r.top-2?(d(q.right,q.top,null,q.bottom),d(j,r.top,r.left,r.bottom)):d(q.right,q.top,r.left-q.right,q.bottom)),q.bottom<r.top&&d(j,q.bottom,null,r.top)}c.appendChild(h)}function La(a){if(a.state.focused){var b=a.display;clearInterval(b.blinker);var c=!0;b.cursorDiv.style.visibility="",a.options.cursorBlinkRate>0?b.blinker=setInterval(function(){b.cursorDiv.style.visibility=(c=!c)?"":"hidden"},a.options.cursorBlinkRate):a.options.cursorBlinkRate<0&&(b.cursorDiv.style.visibility="hidden")}}function Ma(a,b){a.doc.mode.startState&&a.doc.frontier<a.display.viewTo&&a.state.highlight.set(b,Ke(Na,a))}function Na(a){var b=a.doc;if(b.frontier<b.first&&(b.frontier=b.first),!(b.frontier>=a.display.viewTo)){var c=+new Date+a.options.workTime,d=dg(b.mode,Pa(a,b.frontier)),e=[];b.iter(b.frontier,Math.min(b.first+b.size,a.display.viewTo+500),function(f){if(b.frontier>=a.display.viewFrom){var g=f.styles,h=f.text.length>a.options.maxHighlightLength,i=Gd(a,f,h?dg(b.mode,d):d,!0);f.styles=i.styles;var j=f.styleClasses,k=i.classes;k?f.styleClasses=k:j&&(f.styleClasses=null);for(var l=!g||g.length!=f.styles.length||j!=k&&(!j||!k||j.bgClass!=k.bgClass||j.textClass!=k.textClass),m=0;!l&&m<g.length;++m)l=g[m]!=f.styles[m];l&&e.push(b.frontier),f.stateAfter=h?d:dg(b.mode,d)}else f.text.length<=a.options.maxHighlightLength&&Id(a,f.text,d),f.stateAfter=b.frontier%5==0?dg(b.mode,d):null;return++b.frontier,+new Date>c?(Ma(a,a.options.workDelay),!0):void 0}),e.length&&Cb(a,function(){for(var b=0;b<e.length;b++)Jb(a,e[b],"text")})}}function Oa(a,b,c){for(var d,e,f=a.doc,g=c?-1:b-(a.doc.mode.innerMode?1e3:100),h=b;h>g;--h){if(h<=f.first)return f.first;var i=Xd(f,h-1);if(i.stateAfter&&(!c||h<=f.frontier))return h;var j=Ig(i.text,null,a.options.tabSize);(null==e||d>j)&&(e=h-1,d=j)}return e}function Pa(a,b,c){var d=a.doc,e=a.display;if(!d.mode.startState)return!0;var f=Oa(a,b,c),g=f>d.first&&Xd(d,f-1).stateAfter;return g=g?dg(d.mode,g):eg(d.mode),d.iter(f,b,function(c){Id(a,c.text,g);var h=f==b-1||f%5==0||f>=e.viewFrom&&f<e.viewTo;c.stateAfter=h?dg(d.mode,g):null,++f}),c&&(d.frontier=f),g}function Qa(a){return a.lineSpace.offsetTop}function Ra(a){return a.mover.offsetHeight-a.lineSpace.offsetHeight}function Sa(a){if(a.cachedPaddingH)return a.cachedPaddingH;var b=Qe(a.measure,Oe("pre","x")),c=window.getComputedStyle?window.getComputedStyle(b):b.currentStyle,d={left:parseInt(c.paddingLeft),right:parseInt(c.paddingRight)};return isNaN(d.left)||isNaN(d.right)||(a.cachedPaddingH=d),d}function Ta(a){return Dg-a.display.nativeBarWidth}function Ua(a){return a.display.scroller.clientWidth-Ta(a)-a.display.barWidth}function Va(a){return a.display.scroller.clientHeight-Ta(a)-a.display.barHeight}function Wa(a,b,c){var d=a.options.lineWrapping,e=d&&Ua(a);if(!b.measure.heights||d&&b.measure.width!=e){var f=b.measure.heights=[];if(d){b.measure.width=e;for(var g=b.text.firstChild.getClientRects(),h=0;h<g.length-1;h++){var i=g[h],j=g[h+1];Math.abs(i.bottom-j.bottom)>2&&f.push((i.bottom+j.top)/2-c.top)}}f.push(c.bottom-c.top)}}function Xa(a,b,c){if(a.line==b)return{map:a.measure.map,cache:a.measure.cache};for(var d=0;d<a.rest.length;d++)if(a.rest[d]==b)return{map:a.measure.maps[d],cache:a.measure.caches[d]};for(var d=0;d<a.rest.length;d++)if(_d(a.rest[d])>c)return{map:a.measure.maps[d],cache:a.measure.caches[d],before:!0}}function Ya(a,b){b=qd(b);var c=_d(b),d=a.display.externalMeasured=new Gb(a.doc,b,c);d.lineN=c;var e=d.built=Kd(a,d);return d.text=e.pre,Qe(a.display.lineMeasure,e.pre),d}function Za(a,b,c,d){return ab(a,_a(a,b),c,d)}function $a(a,b){if(b>=a.display.viewFrom&&b<a.display.viewTo)return a.display.view[Lb(a,b)];var c=a.display.externalMeasured;return c&&b>=c.lineN&&b<c.lineN+c.size?c:void 0}function _a(a,b){var c=_d(b),d=$a(a,c);d&&!d.text?d=null:d&&d.changes&&(J(a,d,c,H(a)),a.curOp.forceUpdate=!0),d||(d=Ya(a,b));var e=Xa(d,b,c);return{line:b,view:d,rect:null,map:e.map,cache:e.cache,before:e.before,hasHeights:!1}}function ab(a,b,c,d,e){b.before&&(c=-1);var f,g=c+(d||"");return b.cache.hasOwnProperty(g)?f=b.cache[g]:(b.rect||(b.rect=b.view.text.getBoundingClientRect()),b.hasHeights||(Wa(a,b.view,b.rect),b.hasHeights=!0),f=cb(a,b,c,d),f.bogus||(b.cache[g]=f)),{left:f.left,right:f.right,top:e?f.rtop:f.top,bottom:e?f.rbottom:f.bottom}}function bb(a,b,c){for(var d,e,f,g,h=0;h<a.length;h+=3){var i=a[h],j=a[h+1];if(i>b?(e=0,f=1,g="left"):j>b?(e=b-i,f=e+1):(h==a.length-3||b==j&&a[h+3]>b)&&(f=j-i,e=f-1,b>=j&&(g="right")),null!=e){if(d=a[h+2],i==j&&c==(d.insertLeft?"left":"right")&&(g=c),"left"==c&&0==e)for(;h&&a[h-2]==a[h-3]&&a[h-1].insertLeft;)d=a[(h-=3)+2],g="left";if("right"==c&&e==j-i)for(;h<a.length-3&&a[h+3]==a[h+4]&&!a[h+5].insertLeft;)d=a[(h+=3)+2],g="right";break}}return{node:d,start:e,end:f,collapse:g,coverStart:i,coverEnd:j}}function cb(a,b,c,d){var e,f=bb(b.map,c,d),g=f.node,h=f.start,i=f.end,j=f.collapse;if(3==g.nodeType){for(var k=0;4>k;k++){for(;h&&Ne(b.line.text.charAt(f.coverStart+h));)--h;for(;f.coverStart+i<f.coverEnd&&Ne(b.line.text.charAt(f.coverStart+i));)++i;
if(pf&&9>qf&&0==h&&i==f.coverEnd-f.coverStart)e=g.parentNode.getBoundingClientRect();else if(pf&&a.options.lineWrapping){var l=Lg(g,h,i).getClientRects();e=l.length?l["right"==d?l.length-1:0]:Nf}else e=Lg(g,h,i).getBoundingClientRect()||Nf;if(e.left||e.right||0==h)break;i=h,h-=1,j="right"}pf&&11>qf&&(e=db(a.display.measure,e))}else{h>0&&(j=d="right");var l;e=a.options.lineWrapping&&(l=g.getClientRects()).length>1?l["right"==d?l.length-1:0]:g.getBoundingClientRect()}if(pf&&9>qf&&!h&&(!e||!e.left&&!e.right)){var m=g.parentNode.getClientRects()[0];e=m?{left:m.left,right:m.left+sb(a.display),top:m.top,bottom:m.bottom}:Nf}for(var n=e.top-b.rect.top,o=e.bottom-b.rect.top,p=(n+o)/2,q=b.view.measure.heights,k=0;k<q.length-1&&!(p<q[k]);k++);var r=k?q[k-1]:0,s=q[k],t={left:("right"==j?e.right:e.left)-b.rect.left,right:("left"==j?e.left:e.right)-b.rect.left,top:r,bottom:s};return e.left||e.right||(t.bogus=!0),a.options.singleCursorHeightPerLine||(t.rtop=n,t.rbottom=o),t}function db(a,b){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!Ze(a))return b;var c=screen.logicalXDPI/screen.deviceXDPI,d=screen.logicalYDPI/screen.deviceYDPI;return{left:b.left*c,right:b.right*c,top:b.top*d,bottom:b.bottom*d}}function eb(a){if(a.measure&&(a.measure.cache={},a.measure.heights=null,a.rest))for(var b=0;b<a.rest.length;b++)a.measure.caches[b]={}}function fb(a){a.display.externalMeasure=null,Pe(a.display.lineMeasure);for(var b=0;b<a.display.view.length;b++)eb(a.display.view[b])}function gb(a){fb(a),a.display.cachedCharWidth=a.display.cachedTextHeight=a.display.cachedPaddingH=null,a.options.lineWrapping||(a.display.maxLineChanged=!0),a.display.lineNumChars=null}function hb(){return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function ib(){return window.pageYOffset||(document.documentElement||document.body).scrollTop}function jb(a,b,c,d){if(b.widgets)for(var e=0;e<b.widgets.length;++e)if(b.widgets[e].above){var f=xd(b.widgets[e]);c.top+=f,c.bottom+=f}if("line"==d)return c;d||(d="local");var g=be(b);if("local"==d?g+=Qa(a.display):g-=a.display.viewOffset,"page"==d||"window"==d){var h=a.display.lineSpace.getBoundingClientRect();g+=h.top+("window"==d?0:ib());var i=h.left+("window"==d?0:hb());c.left+=i,c.right+=i}return c.top+=g,c.bottom+=g,c}function kb(a,b,c){if("div"==c)return b;var d=b.left,e=b.top;if("page"==c)d-=hb(),e-=ib();else if("local"==c||!c){var f=a.display.sizer.getBoundingClientRect();d+=f.left,e+=f.top}var g=a.display.lineSpace.getBoundingClientRect();return{left:d-g.left,top:e-g.top}}function lb(a,b,c,d,e){return d||(d=Xd(a.doc,b.line)),jb(a,d,Za(a,d,b.ch,e),c)}function mb(a,b,c,d,e,f){function g(b,g){var h=ab(a,e,b,g?"right":"left",f);return g?h.left=h.right:h.right=h.left,jb(a,d,h,c)}function h(a,b){var c=i[b],d=c.level%2;return a==_e(c)&&b&&c.level<i[b-1].level?(c=i[--b],a=af(c)-(c.level%2?0:1),d=!0):a==af(c)&&b<i.length-1&&c.level<i[b+1].level&&(c=i[++b],a=_e(c)-c.level%2,d=!1),d&&a==c.to&&a>c.from?g(a-1):g(a,d)}d=d||Xd(a.doc,b.line),e||(e=_a(a,d));var i=ce(d),j=b.ch;if(!i)return g(j);var k=hf(i,j),l=h(j,k);return null!=_g&&(l.other=h(j,_g)),l}function nb(a,b){var c=0,b=qa(a.doc,b);a.options.lineWrapping||(c=sb(a.display)*b.ch);var d=Xd(a.doc,b.line),e=be(d)+Qa(a.display);return{left:c,right:c,top:e,bottom:e+d.height}}function ob(a,b,c,d){var e=Hf(a,b);return e.xRel=d,c&&(e.outside=!0),e}function pb(a,b,c){var d=a.doc;if(c+=a.display.viewOffset,0>c)return ob(d.first,0,!0,-1);var e=ae(d,c),f=d.first+d.size-1;if(e>f)return ob(d.first+d.size-1,Xd(d,f).text.length,!0,1);0>b&&(b=0);for(var g=Xd(d,e);;){var h=qb(a,g,e,b,c),i=od(g),j=i&&i.find(0,!0);if(!i||!(h.ch>j.from.ch||h.ch==j.from.ch&&h.xRel>0))return h;e=_d(g=j.to.line)}}function qb(a,b,c,d,e){function f(d){var e=mb(a,Hf(c,d),"line",b,j);return h=!0,g>e.bottom?e.left-i:g<e.top?e.left+i:(h=!1,e.left)}var g=e-be(b),h=!1,i=2*a.display.wrapper.clientWidth,j=_a(a,b),k=ce(b),l=b.text.length,m=bf(b),n=cf(b),o=f(m),p=h,q=f(n),r=h;if(d>q)return ob(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);Ne(b.text.charAt(s));)++s;var u=ob(c,s,s==m?p:r,-1>t?-1:t>1?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=f(w);y>d?(n=w,q=y,(r=h)&&(q+=1e3),l=v):(m=w,o=y,p=h,l-=v)}}function rb(a){if(null!=a.cachedTextHeight)return a.cachedTextHeight;if(null==Kf){Kf=Oe("pre");for(var b=0;49>b;++b)Kf.appendChild(document.createTextNode("x")),Kf.appendChild(Oe("br"));Kf.appendChild(document.createTextNode("x"))}Qe(a.measure,Kf);var c=Kf.offsetHeight/50;return c>3&&(a.cachedTextHeight=c),Pe(a.measure),c||1}function sb(a){if(null!=a.cachedCharWidth)return a.cachedCharWidth;var b=Oe("span","xxxxxxxxxx"),c=Oe("pre",[b]);Qe(a.measure,c);var d=b.getBoundingClientRect(),e=(d.right-d.left)/10;return e>2&&(a.cachedCharWidth=e),e||10}function tb(a){a.curOp={cm:a,viewChanged:!1,startHeight:a.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Pf},Of?Of.ops.push(a.curOp):a.curOp.ownsGroup=Of={ops:[a.curOp],delayedCallbacks:[]}}function ub(a){var b=a.delayedCallbacks,c=0;do{for(;c<b.length;c++)b[c].call(null);for(var d=0;d<a.ops.length;d++){var e=a.ops[d];if(e.cursorActivityHandlers)for(;e.cursorActivityCalled<e.cursorActivityHandlers.length;)e.cursorActivityHandlers[e.cursorActivityCalled++].call(null,e.cm)}}while(c<b.length)}function vb(a){var b=a.curOp,c=b.ownsGroup;if(c)try{ub(c)}finally{Of=null;for(var d=0;d<c.ops.length;d++)c.ops[d].cm.curOp=null;wb(c)}}function wb(a){for(var b=a.ops,c=0;c<b.length;c++)xb(b[c]);for(var c=0;c<b.length;c++)yb(b[c]);for(var c=0;c<b.length;c++)zb(b[c]);for(var c=0;c<b.length;c++)Ab(b[c]);for(var c=0;c<b.length;c++)Bb(b[c])}function xb(a){var b=a.cm,c=b.display;A(b),a.updateMaxLine&&m(b),a.mustUpdate=a.viewChanged||a.forceUpdate||null!=a.scrollTop||a.scrollToPos&&(a.scrollToPos.from.line<c.viewFrom||a.scrollToPos.to.line>=c.viewTo)||c.maxLineChanged&&b.options.lineWrapping,a.update=a.mustUpdate&&new z(b,a.mustUpdate&&{top:a.scrollTop,ensure:a.scrollToPos},a.forceUpdate)}function yb(a){a.updatedDisplay=a.mustUpdate&&B(a.cm,a.update)}function zb(a){var b=a.cm,c=b.display;a.updatedDisplay&&F(b),a.barMeasure=o(b),c.maxLineChanged&&!b.options.lineWrapping&&(a.adjustWidthTo=Za(b,c.maxLine,c.maxLine.text.length).left+3,b.display.sizerWidth=a.adjustWidthTo,a.barMeasure.scrollWidth=Math.max(c.scroller.clientWidth,c.sizer.offsetLeft+a.adjustWidthTo+Ta(b)+b.display.barWidth),a.maxScrollLeft=Math.max(0,c.sizer.offsetLeft+a.adjustWidthTo-Ua(b))),(a.updatedDisplay||a.selectionChanged)&&(a.preparedSelection=c.input.prepareSelection())}function Ab(a){var b=a.cm;null!=a.adjustWidthTo&&(b.display.sizer.style.minWidth=a.adjustWidthTo+"px",a.maxScrollLeft<b.doc.scrollLeft&&dc(b,Math.min(b.display.scroller.scrollLeft,a.maxScrollLeft),!0),b.display.maxLineChanged=!1),a.preparedSelection&&b.display.input.showSelection(a.preparedSelection),a.updatedDisplay&&E(b,a.barMeasure),(a.updatedDisplay||a.startHeight!=b.doc.height)&&s(b,a.barMeasure),a.selectionChanged&&La(b),b.state.focused&&a.updateInput&&b.display.input.reset(a.typing),a.focus&&a.focus==Re()&&Y(a.cm)}function Bb(a){var b=a.cm,c=b.display,d=b.doc;if(a.updatedDisplay&&C(b,a.update),null==c.wheelStartX||null==a.scrollTop&&null==a.scrollLeft&&!a.scrollToPos||(c.wheelStartX=c.wheelStartY=null),null==a.scrollTop||c.scroller.scrollTop==a.scrollTop&&!a.forceScroll||(d.scrollTop=Math.max(0,Math.min(c.scroller.scrollHeight-c.scroller.clientHeight,a.scrollTop)),c.scrollbars.setScrollTop(d.scrollTop),c.scroller.scrollTop=d.scrollTop),null==a.scrollLeft||c.scroller.scrollLeft==a.scrollLeft&&!a.forceScroll||(d.scrollLeft=Math.max(0,Math.min(c.scroller.scrollWidth-Ua(b),a.scrollLeft)),c.scrollbars.setScrollLeft(d.scrollLeft),c.scroller.scrollLeft=d.scrollLeft,v(b)),a.scrollToPos){var e=Gc(b,qa(d,a.scrollToPos.from),qa(d,a.scrollToPos.to),a.scrollToPos.margin);a.scrollToPos.isCursor&&b.state.focused&&Fc(b,e)}var f=a.maybeHiddenMarkers,g=a.maybeUnhiddenMarkers;if(f)for(var h=0;h<f.length;++h)f[h].lines.length||Bg(f[h],"hide");if(g)for(var h=0;h<g.length;++h)g[h].lines.length&&Bg(g[h],"unhide");c.wrapper.offsetHeight&&(d.scrollTop=b.display.scroller.scrollTop),a.changeObjs&&Bg(b,"changes",b,a.changeObjs),a.update&&a.update.finish()}function Cb(a,b){if(a.curOp)return b();tb(a);try{return b()}finally{vb(a)}}function Db(a,b){return function(){if(a.curOp)return b.apply(a,arguments);tb(a);try{return b.apply(a,arguments)}finally{vb(a)}}}function Eb(a){return function(){if(this.curOp)return a.apply(this,arguments);tb(this);try{return a.apply(this,arguments)}finally{vb(this)}}}function Fb(a){return function(){var b=this.cm;if(!b||b.curOp)return a.apply(this,arguments);tb(b);try{return a.apply(this,arguments)}finally{vb(b)}}}function Gb(a,b,c){this.line=b,this.rest=rd(b),this.size=this.rest?_d(Ee(this.rest))-c+1:1,this.node=this.text=null,this.hidden=ud(a,b)}function Hb(a,b,c){for(var d,e=[],f=b;c>f;f=d){var g=new Gb(a.doc,Xd(a.doc,f),f);d=f+g.size,e.push(g)}return e}function Ib(a,b,c,d){null==b&&(b=a.doc.first),null==c&&(c=a.doc.first+a.doc.size),d||(d=0);var e=a.display;if(d&&c<e.viewTo&&(null==e.updateLineNumbers||e.updateLineNumbers>b)&&(e.updateLineNumbers=b),a.curOp.viewChanged=!0,b>=e.viewTo)Gf&&sd(a.doc,b)<e.viewTo&&Kb(a);else if(c<=e.viewFrom)Gf&&td(a.doc,c+d)>e.viewFrom?Kb(a):(e.viewFrom+=d,e.viewTo+=d);else if(b<=e.viewFrom&&c>=e.viewTo)Kb(a);else if(b<=e.viewFrom){var f=Mb(a,c,c+d,1);f?(e.view=e.view.slice(f.index),e.viewFrom=f.lineN,e.viewTo+=d):Kb(a)}else if(c>=e.viewTo){var f=Mb(a,b,b,-1);f?(e.view=e.view.slice(0,f.index),e.viewTo=f.lineN):Kb(a)}else{var g=Mb(a,b,b,-1),h=Mb(a,c,c+d,1);g&&h?(e.view=e.view.slice(0,g.index).concat(Hb(a,g.lineN,h.lineN)).concat(e.view.slice(h.index)),e.viewTo+=d):Kb(a)}var i=e.externalMeasured;i&&(c<i.lineN?i.lineN+=d:b<i.lineN+i.size&&(e.externalMeasured=null))}function Jb(a,b,c){a.curOp.viewChanged=!0;var d=a.display,e=a.display.externalMeasured;if(e&&b>=e.lineN&&b<e.lineN+e.size&&(d.externalMeasured=null),!(b<d.viewFrom||b>=d.viewTo)){var f=d.view[Lb(a,b)];if(null!=f.node){var g=f.changes||(f.changes=[]);-1==Fe(g,c)&&g.push(c)}}}function Kb(a){a.display.viewFrom=a.display.viewTo=a.doc.first,a.display.view=[],a.display.viewOffset=0}function Lb(a,b){if(b>=a.display.viewTo)return null;if(b-=a.display.viewFrom,0>b)return null;for(var c=a.display.view,d=0;d<c.length;d++)if(b-=c[d].size,0>b)return d}function Mb(a,b,c,d){var e,f=Lb(a,b),g=a.display.view;if(!Gf||c==a.doc.first+a.doc.size)return{index:f,lineN:c};for(var h=0,i=a.display.viewFrom;f>h;h++)i+=g[h].size;if(i!=b){if(d>0){if(f==g.length-1)return null;e=i+g[f].size-b,f++}else e=i-b;b+=e,c+=e}for(;sd(a.doc,c)!=c;){if(f==(0>d?0:g.length-1))return null;c+=d*g[f-(0>d?1:0)].size,f+=d}return{index:f,lineN:c}}function Nb(a,b,c){var d=a.display,e=d.view;0==e.length||b>=d.viewTo||c<=d.viewFrom?(d.view=Hb(a,b,c),d.viewFrom=b):(d.viewFrom>b?d.view=Hb(a,b,d.viewFrom).concat(d.view):d.viewFrom<b&&(d.view=d.view.slice(Lb(a,b))),d.viewFrom=b,d.viewTo<c?d.view=d.view.concat(Hb(a,d.viewTo,c)):d.viewTo>c&&(d.view=d.view.slice(0,Lb(a,c)))),d.viewTo=c}function Ob(a){for(var b=a.display.view,c=0,d=0;d<b.length;d++){var e=b[d];e.hidden||e.node&&!e.changes||++c}return c}function Pb(a){function b(){e.activeTouch&&(f=setTimeout(function(){e.activeTouch=null},1e3),g=e.activeTouch,g.end=+new Date)}function c(a){if(1!=a.touches.length)return!1;var b=a.touches[0];return b.radiusX<=1&&b.radiusY<=1}function d(a,b){if(null==b.left)return!0;var c=b.left-a.left,d=b.top-a.top;return c*c+d*d>400}var e=a.display;zg(e.scroller,"mousedown",Db(a,Ub)),pf&&11>qf?zg(e.scroller,"dblclick",Db(a,function(b){if(!xe(a,b)){var c=Tb(a,b);if(c&&!Zb(a,b)&&!Sb(a.display,b)){wg(b);var d=a.findWordAt(c);va(a.doc,d.anchor,d.head)}}})):zg(e.scroller,"dblclick",function(b){xe(a,b)||wg(b)}),Ef||zg(e.scroller,"contextmenu",function(b){rc(a,b)});var f,g={end:0};zg(e.scroller,"touchstart",function(a){if(!c(a)){clearTimeout(f);var b=+new Date;e.activeTouch={start:b,moved:!1,prev:b-g.end<=300?g:null},1==a.touches.length&&(e.activeTouch.left=a.touches[0].pageX,e.activeTouch.top=a.touches[0].pageY)}}),zg(e.scroller,"touchmove",function(){e.activeTouch&&(e.activeTouch.moved=!0)}),zg(e.scroller,"touchend",function(c){var f=e.activeTouch;if(f&&!Sb(e,c)&&null!=f.left&&!f.moved&&new Date-f.start<300){var g,h=a.coordsChar(e.activeTouch,"page");g=!f.prev||d(f,f.prev)?new ma(h,h):!f.prev.prev||d(f,f.prev.prev)?a.findWordAt(h):new ma(Hf(h.line,0),qa(a.doc,Hf(h.line+1,0))),a.setSelection(g.anchor,g.head),a.focus(),wg(c)}b()}),zg(e.scroller,"touchcancel",b),zg(e.scroller,"scroll",function(){e.scroller.clientHeight&&(cc(a,e.scroller.scrollTop),dc(a,e.scroller.scrollLeft,!0),Bg(a,"scroll",a))}),zg(e.scroller,"mousewheel",function(b){ec(a,b)}),zg(e.scroller,"DOMMouseScroll",function(b){ec(a,b)}),zg(e.wrapper,"scroll",function(){e.wrapper.scrollTop=e.wrapper.scrollLeft=0}),e.dragFunctions={enter:function(b){xe(a,b)||yg(b)},over:function(b){xe(a,b)||(ac(a,b),yg(b))},start:function(b){_b(a,b)},drop:Db(a,$b),leave:function(){bc(a)}};var h=e.input.getField();zg(h,"keyup",function(b){mc.call(a,b)}),zg(h,"keydown",Db(a,kc)),zg(h,"keypress",Db(a,nc)),zg(h,"focus",Ke(pc,a)),zg(h,"blur",Ke(qc,a))}function Qb(b,c,d){var e=d&&d!=a.Init;if(!c!=!e){var f=b.display.dragFunctions,g=c?zg:Ag;g(b.display.scroller,"dragstart",f.start),g(b.display.scroller,"dragenter",f.enter),g(b.display.scroller,"dragover",f.over),g(b.display.scroller,"dragleave",f.leave),g(b.display.scroller,"drop",f.drop)}}function Rb(a){var b=a.display;(b.lastWrapHeight!=b.wrapper.clientHeight||b.lastWrapWidth!=b.wrapper.clientWidth)&&(b.cachedCharWidth=b.cachedTextHeight=b.cachedPaddingH=null,b.scrollbarsClipped=!1,a.setSize())}function Sb(a,b){for(var c=te(b);c!=a.wrapper;c=c.parentNode)if(!c||1==c.nodeType&&"true"==c.getAttribute("cm-ignore-events")||c.parentNode==a.sizer&&c!=a.mover)return!0}function Tb(a,b,c,d){var e=a.display;if(!c&&"true"==te(b).getAttribute("cm-not-content"))return null;var f,g,h=e.lineSpace.getBoundingClientRect();try{f=b.clientX-h.left,g=b.clientY-h.top}catch(b){return null}var i,j=pb(a,f,g);if(d&&1==j.xRel&&(i=Xd(a.doc,j.line).text).length==j.ch){var k=Ig(i,i.length,a.options.tabSize)-i.length;j=Hf(j.line,Math.max(0,Math.round((f-Sa(a.display).left)/sb(a.display))-k))}return j}function Ub(a){var b=this,c=b.display;if(!(c.activeTouch&&c.input.supportsTouch()||xe(b,a))){if(c.shift=a.shiftKey,Sb(c,a))return void(rf||(c.scroller.draggable=!1,setTimeout(function(){c.scroller.draggable=!0},100)));if(!Zb(b,a)){var d=Tb(b,a);switch(window.focus(),ue(a)){case 1:b.state.selectingText?b.state.selectingText(a):d?Vb(b,a,d):te(a)==c.scroller&&wg(a);break;case 2:rf&&(b.state.lastMiddleDown=+new Date),d&&va(b.doc,d),setTimeout(function(){c.input.focus()},20),wg(a);break;case 3:Ef?rc(b,a):oc(b)}}}}function Vb(a,b,c){pf?setTimeout(Ke(Y,a),0):a.curOp.focus=Re();var d,e=+new Date;Mf&&Mf.time>e-400&&0==If(Mf.pos,c)?d="triple":Lf&&Lf.time>e-400&&0==If(Lf.pos,c)?(d="double",Mf={time:e,pos:c}):(d="single",Lf={time:e,pos:c});var f,g=a.doc.sel,h=Af?b.metaKey:b.ctrlKey;a.options.dragDrop&&Vg&&!Z(a)&&"single"==d&&(f=g.contains(c))>-1&&(If((f=g.ranges[f]).from(),c)<0||c.xRel>0)&&(If(f.to(),c)>0||c.xRel<0)?Wb(a,b,c,h):Xb(a,b,c,d,h)}function Wb(a,b,c,d){var e=a.display,f=+new Date,g=Db(a,function(h){rf&&(e.scroller.draggable=!1),a.state.draggingText=!1,Ag(document,"mouseup",g),Ag(e.scroller,"drop",g),Math.abs(b.clientX-h.clientX)+Math.abs(b.clientY-h.clientY)<10&&(wg(h),!d&&+new Date-200<f&&va(a.doc,c),rf||pf&&9==qf?setTimeout(function(){document.body.focus(),e.input.focus()},20):e.input.focus())});rf&&(e.scroller.draggable=!0),a.state.draggingText=g,e.scroller.dragDrop&&e.scroller.dragDrop(),zg(document,"mouseup",g),zg(e.scroller,"drop",g)}function Xb(a,b,c,d,e){function f(b){if(0!=If(q,b))if(q=b,"rect"==d){for(var e=[],f=a.options.tabSize,g=Ig(Xd(j,c.line).text,c.ch,f),h=Ig(Xd(j,b.line).text,b.ch,f),i=Math.min(g,h),n=Math.max(g,h),o=Math.min(c.line,b.line),p=Math.min(a.lastLine(),Math.max(c.line,b.line));p>=o;o++){var r=Xd(j,o).text,s=Ce(r,i,f);i==n?e.push(new ma(Hf(o,s),Hf(o,s))):r.length>s&&e.push(new ma(Hf(o,s),Hf(o,Ce(r,n,f))))}e.length||e.push(new ma(c,c)),Ba(j,na(m.ranges.slice(0,l).concat(e),l),{origin:"*mouse",scroll:!1}),a.scrollIntoView(b)}else{var t=k,u=t.anchor,v=b;if("single"!=d){if("double"==d)var w=a.findWordAt(b);else var w=new ma(Hf(b.line,0),qa(j,Hf(b.line+1,0)));If(w.anchor,u)>0?(v=w.head,u=X(t.from(),w.anchor)):(v=w.anchor,u=W(t.to(),w.head))}var e=m.ranges.slice(0);e[l]=new ma(qa(j,u),v),Ba(j,na(e,l),Gg)}}function g(b){var c=++s,e=Tb(a,b,!0,"rect"==d);if(e)if(0!=If(e,q)){a.curOp.focus=Re(),f(e);var h=u(i,j);(e.line>=h.to||e.line<h.from)&&setTimeout(Db(a,function(){s==c&&g(b)}),150)}else{var k=b.clientY<r.top?-20:b.clientY>r.bottom?20:0;k&&setTimeout(Db(a,function(){s==c&&(i.scroller.scrollTop+=k,g(b))}),50)}}function h(b){a.state.selectingText=!1,s=1/0,wg(b),i.input.focus(),Ag(document,"mousemove",t),Ag(document,"mouseup",v),j.history.lastSelOrigin=null}var i=a.display,j=a.doc;wg(b);var k,l,m=j.sel,n=m.ranges;if(e&&!b.shiftKey?(l=j.sel.contains(c),k=l>-1?n[l]:new ma(c,c)):(k=j.sel.primary(),l=j.sel.primIndex),b.altKey)d="rect",e||(k=new ma(c,c)),c=Tb(a,b,!0,!0),l=-1;else if("double"==d){var o=a.findWordAt(c);k=a.display.shift||j.extend?ua(j,k,o.anchor,o.head):o}else if("triple"==d){var p=new ma(Hf(c.line,0),qa(j,Hf(c.line+1,0)));k=a.display.shift||j.extend?ua(j,k,p.anchor,p.head):p}else k=ua(j,k,c);e?-1==l?(l=n.length,Ba(j,na(n.concat([k]),l),{scroll:!1,origin:"*mouse"})):n.length>1&&n[l].empty()&&"single"==d&&!b.shiftKey?(Ba(j,na(n.slice(0,l).concat(n.slice(l+1)),0),{scroll:!1,origin:"*mouse"}),m=j.sel):xa(j,l,k,Gg):(l=0,Ba(j,new la([k],0),Gg),m=j.sel);var q=c,r=i.wrapper.getBoundingClientRect(),s=0,t=Db(a,function(a){ue(a)?g(a):h(a)}),v=Db(a,h);a.state.selectingText=v,zg(document,"mousemove",t),zg(document,"mouseup",v)}function Yb(a,b,c,d,e){try{var f=b.clientX,g=b.clientY}catch(b){return!1}if(f>=Math.floor(a.display.gutters.getBoundingClientRect().right))return!1;d&&wg(b);var h=a.display,i=h.lineDiv.getBoundingClientRect();if(g>i.bottom||!ze(a,c))return se(b);g-=i.top-h.viewOffset;for(var j=0;j<a.options.gutters.length;++j){var k=h.gutters.childNodes[j];if(k&&k.getBoundingClientRect().right>=f){var l=ae(a.doc,g),m=a.options.gutters[j];return e(a,c,a,l,m,b),se(b)}}}function Zb(a,b){return Yb(a,b,"gutterClick",!0,ve)}function $b(a){var b=this;if(bc(b),!xe(b,a)&&!Sb(b.display,a)){wg(a),pf&&(Qf=+new Date);var c=Tb(b,a,!0),d=a.dataTransfer.files;if(c&&!Z(b))if(d&&d.length&&window.FileReader&&window.File)for(var e=d.length,f=Array(e),g=0,h=function(a,d){var h=new FileReader;h.onload=Db(b,function(){if(f[d]=h.result,++g==e){c=qa(b.doc,c);var a={from:c,to:c,text:b.doc.splitLines(f.join(b.doc.lineSeparator())),origin:"paste"};yc(b.doc,a),Aa(b.doc,oa(c,Wf(a)))}}),h.readAsText(a)},i=0;e>i;++i)h(d[i],i);else{if(b.state.draggingText&&b.doc.sel.contains(c)>-1)return b.state.draggingText(a),void setTimeout(function(){b.display.input.focus()},20);try{var f=a.dataTransfer.getData("Text");if(f){if(b.state.draggingText&&!(Af?a.altKey:a.ctrlKey))var j=b.listSelections();if(Ca(b.doc,oa(c,c)),j)for(var i=0;i<j.length;++i)Ec(b.doc,"",j[i].anchor,j[i].head,"drag");b.replaceSelection(f,"around","paste"),b.display.input.focus()}}catch(a){}}}}function _b(a,b){if(pf&&(!a.state.draggingText||+new Date-Qf<100))return void yg(b);if(!xe(a,b)&&!Sb(a.display,b)&&(b.dataTransfer.setData("Text",a.getSelection()),b.dataTransfer.setDragImage&&!vf)){var c=Oe("img",null,null,"position: fixed; left: 0; top: 0;");c.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",uf&&(c.width=c.height=1,a.display.wrapper.appendChild(c),c._top=c.offsetTop),b.dataTransfer.setDragImage(c,0,0),uf&&c.parentNode.removeChild(c)}}function ac(a,b){var c=Tb(a,b);if(c){var d=document.createDocumentFragment();Ja(a,c,d),a.display.dragCursor||(a.display.dragCursor=Oe("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),a.display.lineSpace.insertBefore(a.display.dragCursor,a.display.cursorDiv)),Qe(a.display.dragCursor,d)}}function bc(a){a.display.dragCursor&&(a.display.lineSpace.removeChild(a.display.dragCursor),a.display.dragCursor=null)}function cc(a,b){Math.abs(a.doc.scrollTop-b)<2||(a.doc.scrollTop=b,mf||D(a,{top:b}),a.display.scroller.scrollTop!=b&&(a.display.scroller.scrollTop=b),a.display.scrollbars.setScrollTop(b),mf&&D(a),Ma(a,100))}function dc(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,v(a),a.display.scroller.scrollLeft!=b&&(a.display.scroller.scrollLeft=b),a.display.scrollbars.setScrollLeft(b))}function ec(a,b){var c=Tf(b),d=c.x,e=c.y,f=a.display,g=f.scroller;if(d&&g.scrollWidth>g.clientWidth||e&&g.scrollHeight>g.clientHeight){if(e&&Af&&rf)a:for(var h=b.target,i=f.view;h!=g;h=h.parentNode)for(var j=0;j<i.length;j++)if(i[j].node==h){a.display.currentWheelTarget=h;break a}if(d&&!mf&&!uf&&null!=Sf)return e&&cc(a,Math.max(0,Math.min(g.scrollTop+e*Sf,g.scrollHeight-g.clientHeight))),dc(a,Math.max(0,Math.min(g.scrollLeft+d*Sf,g.scrollWidth-g.clientWidth))),wg(b),void(f.wheelStartX=null);if(e&&null!=Sf){var k=e*Sf,l=a.doc.scrollTop,m=l+f.wrapper.clientHeight;0>k?l=Math.max(0,l+k-50):m=Math.min(a.doc.height,m+k+50),D(a,{top:l,bottom:m})}20>Rf&&(null==f.wheelStartX?(f.wheelStartX=g.scrollLeft,f.wheelStartY=g.scrollTop,f.wheelDX=d,f.wheelDY=e,setTimeout(function(){if(null!=f.wheelStartX){var a=g.scrollLeft-f.wheelStartX,b=g.scrollTop-f.wheelStartY,c=b&&f.wheelDY&&b/f.wheelDY||a&&f.wheelDX&&a/f.wheelDX;f.wheelStartX=f.wheelStartY=null,c&&(Sf=(Sf*Rf+c)/(Rf+1),++Rf)}},200)):(f.wheelDX+=d,f.wheelDY+=e))}}function fc(a,b,c){if("string"==typeof b&&(b=fg[b],!b))return!1;a.display.input.ensurePolled();var d=a.display.shift,e=!1;try{Z(a)&&(a.state.suppressEdits=!0),c&&(a.display.shift=!1),e=b(a)!=Eg}finally{a.display.shift=d,a.state.suppressEdits=!1}return e}function gc(a,b,c){for(var d=0;d<a.state.keyMaps.length;d++){var e=hg(b,a.state.keyMaps[d],c,a);if(e)return e}return a.options.extraKeys&&hg(b,a.options.extraKeys,c,a)||hg(b,a.options.keyMap,c,a)}function hc(a,b,c,d){var e=a.state.keySeq;if(e){if(ig(b))return"handled";Uf.set(50,function(){a.state.keySeq==e&&(a.state.keySeq=null,a.display.input.reset())}),b=e+" "+b}var f=gc(a,b,d);return"multi"==f&&(a.state.keySeq=b),"handled"==f&&ve(a,"keyHandled",a,b,c),("handled"==f||"multi"==f)&&(wg(c),La(a)),e&&!f&&/\'$/.test(b)?(wg(c),!0):!!f}function ic(a,b){var c=jg(b,!0);return c?b.shiftKey&&!a.state.keySeq?hc(a,"Shift-"+c,b,function(b){return fc(a,b,!0)})||hc(a,c,b,function(b){return("string"==typeof b?/^go[A-Z]/.test(b):b.motion)?fc(a,b):void 0}):hc(a,c,b,function(b){return fc(a,b)}):!1}function jc(a,b,c){return hc(a,"'"+c+"'",b,function(b){return fc(a,b,!0)})}function kc(a){var b=this;if(b.curOp.focus=Re(),!xe(b,a)){pf&&11>qf&&27==a.keyCode&&(a.returnValue=!1);var c=a.keyCode;b.display.shift=16==c||a.shiftKey;var d=ic(b,a);uf&&(Vf=d?c:null,!d&&88==c&&!Yg&&(Af?a.metaKey:a.ctrlKey)&&b.replaceSelection("",null,"cut")),18!=c||/\bCodeMirror-crosshair\b/.test(b.display.lineDiv.className)||lc(b)}}function lc(a){function b(a){18!=a.keyCode&&a.altKey||(Sg(c,"CodeMirror-crosshair"),Ag(document,"keyup",b),Ag(document,"mouseover",b))}var c=a.display.lineDiv;Tg(c,"CodeMirror-crosshair"),zg(document,"keyup",b),zg(document,"mouseover",b)}function mc(a){16==a.keyCode&&(this.doc.sel.shift=!1),xe(this,a)}function nc(a){var b=this;if(!(Sb(b.display,a)||xe(b,a)||a.ctrlKey&&!a.altKey||Af&&a.metaKey)){var c=a.keyCode,d=a.charCode;if(uf&&c==Vf)return Vf=null,void wg(a);if(!uf||a.which&&!(a.which<10)||!ic(b,a)){var e=String.fromCharCode(null==d?c:d);jc(b,a,e)||b.display.input.onKeyPress(a)}}}function oc(a){a.state.delayingBlurEvent=!0,setTimeout(function(){a.state.delayingBlurEvent&&(a.state.delayingBlurEvent=!1,qc(a))},100)}function pc(a){a.state.delayingBlurEvent&&(a.state.delayingBlurEvent=!1),"nocursor"!=a.options.readOnly&&(a.state.focused||(Bg(a,"focus",a),a.state.focused=!0,Tg(a.display.wrapper,"CodeMirror-focused"),a.curOp||a.display.selForContextMenu==a.doc.sel||(a.display.input.reset(),rf&&setTimeout(function(){a.display.input.reset(!0)},20)),a.display.input.receivedFocus()),La(a))}function qc(a){a.state.delayingBlurEvent||(a.state.focused&&(Bg(a,"blur",a),a.state.focused=!1,Sg(a.display.wrapper,"CodeMirror-focused")),clearInterval(a.display.blinker),setTimeout(function(){a.state.focused||(a.display.shift=!1)},150))}function rc(a,b){Sb(a.display,b)||sc(a,b)||a.display.input.onContextMenu(b)}function sc(a,b){return ze(a,"gutterContextMenu")?Yb(a,b,"gutterContextMenu",!1,Bg):!1}function tc(a,b){if(If(a,b.from)<0)return a;if(If(a,b.to)<=0)return Wf(b);var c=a.line+b.text.length-(b.to.line-b.from.line)-1,d=a.ch;return a.line==b.to.line&&(d+=Wf(b).ch-b.to.ch),Hf(c,d)}function uc(a,b){for(var c=[],d=0;d<a.sel.ranges.length;d++){var e=a.sel.ranges[d];c.push(new ma(tc(e.anchor,b),tc(e.head,b)))}return na(c,a.sel.primIndex)}function vc(a,b,c){return a.line==b.line?Hf(c.line,a.ch-b.ch+c.ch):Hf(c.line+(a.line-b.line),a.ch)}function wc(a,b,c){for(var d=[],e=Hf(a.first,0),f=e,g=0;g<b.length;g++){var h=b[g],i=vc(h.from,e,f),j=vc(Wf(h),e,f);if(e=h.to,f=j,"around"==c){var k=a.sel.ranges[g],l=If(k.head,k.anchor)<0;d[g]=new ma(l?j:i,l?i:j)}else d[g]=new ma(i,i)}return new la(d,a.sel.primIndex)}function xc(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=qa(a,b)),c&&(this.to=qa(a,c)),d&&(this.text=d),void 0!==e&&(this.origin=e)}),Bg(a,"beforeChange",a,d),a.cm&&Bg(a.cm,"beforeChange",a.cm,d),d.canceled?null:{from:d.from,to:d.to,text:d.text,origin:d.origin}}function yc(a,b,c){if(a.cm){if(!a.cm.curOp)return Db(a.cm,yc)(a,b,c);if(a.cm.state.suppressEdits)return}if(!(ze(a,"beforeChange")||a.cm&&ze(a.cm,"beforeChange"))||(b=xc(a,b,!0))){var d=Ff&&!c&&gd(a,b.from,b.to);if(d)for(var e=d.length-1;e>=0;--e)zc(a,{from:d[e].from,to:d[e].to,text:e?[""]:b.text});else zc(a,b)}}function zc(a,b){if(1!=b.text.length||""!=b.text[0]||0!=If(b.from,b.to)){var c=uc(a,b);he(a,b,c,a.cm?a.cm.curOp.id:NaN),Cc(a,b,c,dd(a,b));var d=[];Vd(a,function(a,c){c||-1!=Fe(d,a.history)||(re(a.history,b),d.push(a.history)),Cc(a,b,null,dd(a,b))})}}function Ac(a,b,c){if(!a.cm||!a.cm.state.suppressEdits){for(var d,e=a.history,f=a.sel,g="undo"==b?e.done:e.undone,h="undo"==b?e.undone:e.done,i=0;i<g.length&&(d=g[i],c?!d.ranges||d.equals(a.sel):d.ranges);i++);if(i!=g.length){for(e.lastOrigin=e.lastSelOrigin=null;d=g.pop(),d.ranges;){if(ke(d,h),c&&!d.equals(a.sel))return void Ba(a,d,{clearRedo:!1});f=d}var j=[];ke(f,h),h.push({changes:j,generation:e.generation}),e.generation=d.generation||++e.maxGeneration;for(var k=ze(a,"beforeChange")||a.cm&&ze(a.cm,"beforeChange"),i=d.changes.length-1;i>=0;--i){var l=d.changes[i];if(l.origin=b,k&&!xc(a,l,!1))return void(g.length=0);j.push(ee(a,l));var m=i?uc(a,l):Ee(g);Cc(a,l,m,fd(a,l)),!i&&a.cm&&a.cm.scrollIntoView({from:l.from,to:Wf(l)});var n=[];Vd(a,function(a,b){b||-1!=Fe(n,a.history)||(re(a.history,l),n.push(a.history)),Cc(a,l,null,fd(a,l))})}}}}function Bc(a,b){if(0!=b&&(a.first+=b,a.sel=new la(Ge(a.sel.ranges,function(a){return new ma(Hf(a.anchor.line+b,a.anchor.ch),Hf(a.head.line+b,a.head.ch))}),a.sel.primIndex),a.cm)){Ib(a.cm,a.first,a.first-b,b);for(var c=a.cm.display,d=c.viewFrom;d<c.viewTo;d++)Jb(a.cm,d,"gutter")}}function Cc(a,b,c,d){if(a.cm&&!a.cm.curOp)return Db(a.cm,Cc)(a,b,c,d);if(b.to.line<a.first)return void Bc(a,b.text.length-1-(b.to.line-b.from.line));if(!(b.from.line>a.lastLine())){if(b.from.line<a.first){var e=b.text.length-1-(a.first-b.from.line);Bc(a,e),b={from:Hf(a.first,0),to:Hf(b.to.line+e,b.to.ch),text:[Ee(b.text)],origin:b.origin}}var f=a.lastLine();b.to.line>f&&(b={from:b.from,to:Hf(f,Xd(a,f).text.length),text:[b.text[0]],origin:b.origin}),b.removed=Yd(a,b.from,b.to),c||(c=uc(a,b)),a.cm?Dc(a.cm,b,d):Sd(a,b,d),Ca(a,c,Fg)}}function Dc(a,b,c){var d=a.doc,e=a.display,g=b.from,h=b.to,i=!1,j=g.line;a.options.lineWrapping||(j=_d(qd(Xd(d,g.line))),d.iter(j,h.line+1,function(a){return a==e.maxLine?(i=!0,!0):void 0})),d.sel.contains(b.from,b.to)>-1&&ye(a),Sd(d,b,c,f(a)),a.options.lineWrapping||(d.iter(j,g.line+b.text.length,function(a){var b=l(a);b>e.maxLineLength&&(e.maxLine=a,e.maxLineLength=b,e.maxLineChanged=!0,i=!1)}),i&&(a.curOp.updateMaxLine=!0)),d.frontier=Math.min(d.frontier,g.line),Ma(a,400);var k=b.text.length-(h.line-g.line)-1;b.full?Ib(a):g.line!=h.line||1!=b.text.length||Rd(a.doc,b)?Ib(a,g.line,h.line+1,k):Jb(a,g.line,"text");var m=ze(a,"changes"),n=ze(a,"change");if(n||m){var o={from:g,to:h,text:b.text,removed:b.removed,origin:b.origin};n&&ve(a,"change",a,o),m&&(a.curOp.changeObjs||(a.curOp.changeObjs=[])).push(o)}a.display.selForContextMenu=null}function Ec(a,b,c,d,e){if(d||(d=c),If(d,c)<0){var f=d;d=c,c=f}"string"==typeof b&&(b=a.splitLines(b)),yc(a,{from:c,to:d,text:b,origin:e})}function Fc(a,b){if(!xe(a,"scrollCursorIntoView")){var c=a.display,d=c.sizer.getBoundingClientRect(),e=null;if(b.top+d.top<0?e=!0:b.bottom+d.top>(window.innerHeight||document.documentElement.clientHeight)&&(e=!1),null!=e&&!xf){var f=Oe("div","",null,"position: absolute; top: "+(b.top-c.viewOffset-Qa(a.display))+"px; height: "+(b.bottom-b.top+Ta(a)+c.barHeight)+"px; left: "+b.left+"px; width: 2px;");a.display.lineSpace.appendChild(f),f.scrollIntoView(e),a.display.lineSpace.removeChild(f)}}}function Gc(a,b,c,d){null==d&&(d=0);for(var e=0;5>e;e++){var f=!1,g=mb(a,b),h=c&&c!=b?mb(a,c):g,i=Ic(a,Math.min(g.left,h.left),Math.min(g.top,h.top)-d,Math.max(g.left,h.left),Math.max(g.bottom,h.bottom)+d),j=a.doc.scrollTop,k=a.doc.scrollLeft;if(null!=i.scrollTop&&(cc(a,i.scrollTop),Math.abs(a.doc.scrollTop-j)>1&&(f=!0)),null!=i.scrollLeft&&(dc(a,i.scrollLeft),Math.abs(a.doc.scrollLeft-k)>1&&(f=!0)),!f)break}return g}function Hc(a,b,c,d,e){var f=Ic(a,b,c,d,e);null!=f.scrollTop&&cc(a,f.scrollTop),null!=f.scrollLeft&&dc(a,f.scrollLeft)}function Ic(a,b,c,d,e){var f=a.display,g=rb(a.display);0>c&&(c=0);var h=a.curOp&&null!=a.curOp.scrollTop?a.curOp.scrollTop:f.scroller.scrollTop,i=Va(a),j={};e-c>i&&(e=c+i);var k=a.doc.height+Ra(f),l=g>c,m=e>k-g;if(h>c)j.scrollTop=l?0:c;else if(e>h+i){var n=Math.min(c,(m?k:e)-i);n!=h&&(j.scrollTop=n)}var o=a.curOp&&null!=a.curOp.scrollLeft?a.curOp.scrollLeft:f.scroller.scrollLeft,p=Ua(a)-(a.options.fixedGutter?f.gutters.offsetWidth:0),q=d-b>p;return q&&(d=b+p),10>b?j.scrollLeft=0:o>b?j.scrollLeft=Math.max(0,b-(q?0:10)):d>p+o-3&&(j.scrollLeft=d+(q?0:10)-p),j}function Jc(a,b,c){(null!=b||null!=c)&&Lc(a),null!=b&&(a.curOp.scrollLeft=(null==a.curOp.scrollLeft?a.doc.scrollLeft:a.curOp.scrollLeft)+b),null!=c&&(a.curOp.scrollTop=(null==a.curOp.scrollTop?a.doc.scrollTop:a.curOp.scrollTop)+c)}function Kc(a){Lc(a);var b=a.getCursor(),c=b,d=b;a.options.lineWrapping||(c=b.ch?Hf(b.line,b.ch-1):b,d=Hf(b.line,b.ch+1)),a.curOp.scrollToPos={from:c,to:d,margin:a.options.cursorScrollMargin,isCursor:!0}}function Lc(a){var b=a.curOp.scrollToPos;if(b){a.curOp.scrollToPos=null;var c=nb(a,b.from),d=nb(a,b.to),e=Ic(a,Math.min(c.left,d.left),Math.min(c.top,d.top)-b.margin,Math.max(c.right,d.right),Math.max(c.bottom,d.bottom)+b.margin);a.scrollTo(e.scrollLeft,e.scrollTop)}}function Mc(a,b,c,d){var e,f=a.doc;null==c&&(c="add"),"smart"==c&&(f.mode.indent?e=Pa(a,b):c="prev");var g=a.options.tabSize,h=Xd(f,b),i=Ig(h.text,null,g);h.stateAfter&&(h.stateAfter=null);var j,k=h.text.match(/^\s*/)[0];if(d||/\S/.test(h.text)){if("smart"==c&&(j=f.mode.indent(e,h.text.slice(k.length),h.text),j==Eg||j>150)){if(!d)return;c="prev"}}else j=0,c="not";"prev"==c?j=b>f.first?Ig(Xd(f,b-1).text,null,g):0:"add"==c?j=i+a.options.indentUnit:"subtract"==c?j=i-a.options.indentUnit:"number"==typeof c&&(j=i+c),
j=Math.max(0,j);var l="",m=0;if(a.options.indentWithTabs)for(var n=Math.floor(j/g);n;--n)m+=g,l+=" ";if(j>m&&(l+=De(j-m)),l!=k)return Ec(f,l,Hf(b,0),Hf(b,k.length),"+input"),h.stateAfter=null,!0;for(var n=0;n<f.sel.ranges.length;n++){var o=f.sel.ranges[n];if(o.head.line==b&&o.head.ch<k.length){var m=Hf(b,k.length);xa(f,n,new ma(m,m));break}}}function Nc(a,b,c,d){var e=b,f=b;return"number"==typeof b?f=Xd(a,pa(a,b)):e=_d(b),null==e?null:(d(f,e)&&a.cm&&Jb(a.cm,e,c),f)}function Oc(a,b){for(var c=a.doc.sel.ranges,d=[],e=0;e<c.length;e++){for(var f=b(c[e]);d.length&&If(f.from,Ee(d).to)<=0;){var g=d.pop();if(If(g.from,f.from)<0){f.from=g.from;break}}d.push(f)}Cb(a,function(){for(var b=d.length-1;b>=0;b--)Ec(a.doc,"",d[b].from,d[b].to,"+delete");Kc(a)})}function Pc(a,b,c,d,e){function f(){var b=h+c;return b<a.first||b>=a.first+a.size?l=!1:(h=b,k=Xd(a,b))}function g(a){var b=(e?kf:lf)(k,i,c,!0);if(null==b){if(a||!f())return l=!1;i=e?(0>c?cf:bf)(k):0>c?k.text.length:0}else i=b;return!0}var h=b.line,i=b.ch,j=c,k=Xd(a,h),l=!0;if("char"==d)g();else if("column"==d)g(!0);else if("word"==d||"group"==d)for(var m=null,n="group"==d,o=a.cm&&a.cm.getHelper(b,"wordChars"),p=!0;!(0>c)||g(!p);p=!1){var q=k.text.charAt(i)||"\n",r=Le(q,o)?"w":n&&"\n"==q?"n":!n||/\s/.test(q)?null:"p";if(!n||p||r||(r="s"),m&&m!=r){0>c&&(c=1,g());break}if(r&&(m=r),c>0&&!g(!p))break}var s=Ga(a,Hf(h,i),j,!0);return l||(s.hitSide=!0),s}function Qc(a,b,c,d){var e,f=a.doc,g=b.left;if("page"==d){var h=Math.min(a.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);e=b.top+c*(h-(0>c?1.5:.5)*rb(a.display))}else"line"==d&&(e=c>0?b.bottom+3:b.top-3);for(;;){var i=pb(a,g,e);if(!i.outside)break;if(0>c?0>=e:e>=f.height){i.hitSide=!0;break}e+=5*c}return i}function Rc(b,c,d,e){a.defaults[b]=c,d&&(Yf[b]=e?function(a,b,c){c!=Zf&&d(a,b,c)}:d)}function Sc(a){for(var b,c,d,e,f=a.split(/-(?!$)/),a=f[f.length-1],g=0;g<f.length-1;g++){var h=f[g];if(/^(cmd|meta|m)$/i.test(h))e=!0;else if(/^a(lt)?$/i.test(h))b=!0;else if(/^(c|ctrl|control)$/i.test(h))c=!0;else{if(!/^s(hift)$/i.test(h))throw new Error("Unrecognized modifier name: "+h);d=!0}}return b&&(a="Alt-"+a),c&&(a="Ctrl-"+a),e&&(a="Cmd-"+a),d&&(a="Shift-"+a),a}function Tc(a){return"string"==typeof a?gg[a]:a}function Uc(a,b,c,d,e){if(d&&d.shared)return Vc(a,b,c,d,e);if(a.cm&&!a.cm.curOp)return Db(a.cm,Uc)(a,b,c,d,e);var f=new mg(a,e),g=If(b,c);if(d&&Je(d,f,!1),g>0||0==g&&f.clearWhenEmpty!==!1)return f;if(f.replacedWith&&(f.collapsed=!0,f.widgetNode=Oe("span",[f.replacedWith],"CodeMirror-widget"),d.handleMouseEvents||f.widgetNode.setAttribute("cm-ignore-events","true"),d.insertLeft&&(f.widgetNode.insertLeft=!0)),f.collapsed){if(pd(a,b.line,b,c,f)||b.line!=c.line&&pd(a,c.line,b,c,f))throw new Error("Inserting collapsed marker partially overlapping an existing one");Gf=!0}f.addToHistory&&he(a,{from:b,to:c,origin:"markText"},a.sel,NaN);var h,i=b.line,j=a.cm;if(a.iter(i,c.line+1,function(a){j&&f.collapsed&&!j.options.lineWrapping&&qd(a)==j.display.maxLine&&(h=!0),f.collapsed&&i!=b.line&&$d(a,0),ad(a,new Zc(f,i==b.line?b.ch:null,i==c.line?c.ch:null)),++i}),f.collapsed&&a.iter(b.line,c.line+1,function(b){ud(a,b)&&$d(b,0)}),f.clearOnEnter&&zg(f,"beforeCursorEnter",function(){f.clear()}),f.readOnly&&(Ff=!0,(a.history.done.length||a.history.undone.length)&&a.clearHistory()),f.collapsed&&(f.id=++lg,f.atomic=!0),j){if(h&&(j.curOp.updateMaxLine=!0),f.collapsed)Ib(j,b.line,c.line+1);else if(f.className||f.title||f.startStyle||f.endStyle||f.css)for(var k=b.line;k<=c.line;k++)Jb(j,k,"text");f.atomic&&Ea(j.doc),ve(j,"markerAdded",j,f)}return f}function Vc(a,b,c,d,e){d=Je(d),d.shared=!1;var f=[Uc(a,b,c,d,e)],g=f[0],h=d.widgetNode;return Vd(a,function(a){h&&(d.widgetNode=h.cloneNode(!0)),f.push(Uc(a,qa(a,b),qa(a,c),d,e));for(var i=0;i<a.linked.length;++i)if(a.linked[i].isParent)return;g=Ee(f)}),new ng(f,g)}function Wc(a){return a.findMarks(Hf(a.first,0),a.clipPos(Hf(a.lastLine())),function(a){return a.parent})}function Xc(a,b){for(var c=0;c<b.length;c++){var d=b[c],e=d.find(),f=a.clipPos(e.from),g=a.clipPos(e.to);if(If(f,g)){var h=Uc(a,f,g,d.primary,d.primary.type);d.markers.push(h),h.parent=d}}}function Yc(a){for(var b=0;b<a.length;b++){var c=a[b],d=[c.primary.doc];Vd(c.primary.doc,function(a){d.push(a)});for(var e=0;e<c.markers.length;e++){var f=c.markers[e];-1==Fe(d,f.doc)&&(f.parent=null,c.markers.splice(e--,1))}}}function Zc(a,b,c){this.marker=a,this.from=b,this.to=c}function $c(a,b){if(a)for(var c=0;c<a.length;++c){var d=a[c];if(d.marker==b)return d}}function _c(a,b){for(var c,d=0;d<a.length;++d)a[d]!=b&&(c||(c=[])).push(a[d]);return c}function ad(a,b){a.markedSpans=a.markedSpans?a.markedSpans.concat([b]):[b],b.marker.attachLine(a)}function bd(a,b,c){if(a)for(var d,e=0;e<a.length;++e){var f=a[e],g=f.marker,h=null==f.from||(g.inclusiveLeft?f.from<=b:f.from<b);if(h||f.from==b&&"bookmark"==g.type&&(!c||!f.marker.insertLeft)){var i=null==f.to||(g.inclusiveRight?f.to>=b:f.to>b);(d||(d=[])).push(new Zc(g,f.from,i?null:f.to))}}return d}function cd(a,b,c){if(a)for(var d,e=0;e<a.length;++e){var f=a[e],g=f.marker,h=null==f.to||(g.inclusiveRight?f.to>=b:f.to>b);if(h||f.from==b&&"bookmark"==g.type&&(!c||f.marker.insertLeft)){var i=null==f.from||(g.inclusiveLeft?f.from<=b:f.from<b);(d||(d=[])).push(new Zc(g,i?null:f.from-b,null==f.to?null:f.to-b))}}return d}function dd(a,b){if(b.full)return null;var c=sa(a,b.from.line)&&Xd(a,b.from.line).markedSpans,d=sa(a,b.to.line)&&Xd(a,b.to.line).markedSpans;if(!c&&!d)return null;var e=b.from.ch,f=b.to.ch,g=0==If(b.from,b.to),h=bd(c,e,g),i=cd(d,f,g),j=1==b.text.length,k=Ee(b.text).length+(j?e:0);if(h)for(var l=0;l<h.length;++l){var m=h[l];if(null==m.to){var n=$c(i,m.marker);n?j&&(m.to=null==n.to?null:n.to+k):m.to=e}}if(i)for(var l=0;l<i.length;++l){var m=i[l];if(null!=m.to&&(m.to+=k),null==m.from){var n=$c(h,m.marker);n||(m.from=k,j&&(h||(h=[])).push(m))}else m.from+=k,j&&(h||(h=[])).push(m)}h&&(h=ed(h)),i&&i!=h&&(i=ed(i));var o=[h];if(!j){var p,q=b.text.length-2;if(q>0&&h)for(var l=0;l<h.length;++l)null==h[l].to&&(p||(p=[])).push(new Zc(h[l].marker,null,null));for(var l=0;q>l;++l)o.push(p);o.push(i)}return o}function ed(a){for(var b=0;b<a.length;++b){var c=a[b];null!=c.from&&c.from==c.to&&c.marker.clearWhenEmpty!==!1&&a.splice(b--,1)}return a.length?a:null}function fd(a,b){var c=ne(a,b),d=dd(a,b);if(!c)return d;if(!d)return c;for(var e=0;e<c.length;++e){var f=c[e],g=d[e];if(f&&g)a:for(var h=0;h<g.length;++h){for(var i=g[h],j=0;j<f.length;++j)if(f[j].marker==i.marker)continue a;f.push(i)}else g&&(c[e]=g)}return c}function gd(a,b,c){var d=null;if(a.iter(b.line,c.line+1,function(a){if(a.markedSpans)for(var b=0;b<a.markedSpans.length;++b){var c=a.markedSpans[b].marker;!c.readOnly||d&&-1!=Fe(d,c)||(d||(d=[])).push(c)}}),!d)return null;for(var e=[{from:b,to:c}],f=0;f<d.length;++f)for(var g=d[f],h=g.find(0),i=0;i<e.length;++i){var j=e[i];if(!(If(j.to,h.from)<0||If(j.from,h.to)>0)){var k=[i,1],l=If(j.from,h.from),m=If(j.to,h.to);(0>l||!g.inclusiveLeft&&!l)&&k.push({from:j.from,to:h.from}),(m>0||!g.inclusiveRight&&!m)&&k.push({from:h.to,to:j.to}),e.splice.apply(e,k),i+=k.length-1}}return e}function hd(a){var b=a.markedSpans;if(b){for(var c=0;c<b.length;++c)b[c].marker.detachLine(a);a.markedSpans=null}}function id(a,b){if(b){for(var c=0;c<b.length;++c)b[c].marker.attachLine(a);a.markedSpans=b}}function jd(a){return a.inclusiveLeft?-1:0}function kd(a){return a.inclusiveRight?1:0}function ld(a,b){var c=a.lines.length-b.lines.length;if(0!=c)return c;var d=a.find(),e=b.find(),f=If(d.from,e.from)||jd(a)-jd(b);if(f)return-f;var g=If(d.to,e.to)||kd(a)-kd(b);return g?g:b.id-a.id}function md(a,b){var c,d=Gf&&a.markedSpans;if(d)for(var e,f=0;f<d.length;++f)e=d[f],e.marker.collapsed&&null==(b?e.from:e.to)&&(!c||ld(c,e.marker)<0)&&(c=e.marker);return c}function nd(a){return md(a,!0)}function od(a){return md(a,!1)}function pd(a,b,c,d,e){var f=Xd(a,b),g=Gf&&f.markedSpans;if(g)for(var h=0;h<g.length;++h){var i=g[h];if(i.marker.collapsed){var j=i.marker.find(0),k=If(j.from,c)||jd(i.marker)-jd(e),l=If(j.to,d)||kd(i.marker)-kd(e);if(!(k>=0&&0>=l||0>=k&&l>=0)&&(0>=k&&(If(j.to,c)>0||i.marker.inclusiveRight&&e.inclusiveLeft)||k>=0&&(If(j.from,d)<0||i.marker.inclusiveLeft&&e.inclusiveRight)))return!0}}}function qd(a){for(var b;b=nd(a);)a=b.find(-1,!0).line;return a}function rd(a){for(var b,c;b=od(a);)a=b.find(1,!0).line,(c||(c=[])).push(a);return c}function sd(a,b){var c=Xd(a,b),d=qd(c);return c==d?b:_d(d)}function td(a,b){if(b>a.lastLine())return b;var c,d=Xd(a,b);if(!ud(a,d))return b;for(;c=od(d);)d=c.find(1,!0).line;return _d(d)+1}function ud(a,b){var c=Gf&&b.markedSpans;if(c)for(var d,e=0;e<c.length;++e)if(d=c[e],d.marker.collapsed){if(null==d.from)return!0;if(!d.marker.widgetNode&&0==d.from&&d.marker.inclusiveLeft&&vd(a,b,d))return!0}}function vd(a,b,c){if(null==c.to){var d=c.marker.find(1,!0);return vd(a,d.line,$c(d.line.markedSpans,c.marker))}if(c.marker.inclusiveRight&&c.to==b.text.length)return!0;for(var e,f=0;f<b.markedSpans.length;++f)if(e=b.markedSpans[f],e.marker.collapsed&&!e.marker.widgetNode&&e.from==c.to&&(null==e.to||e.to!=c.from)&&(e.marker.inclusiveLeft||c.marker.inclusiveRight)&&vd(a,b,e))return!0}function wd(a,b,c){be(b)<(a.curOp&&a.curOp.scrollTop||a.doc.scrollTop)&&Jc(a,null,c)}function xd(a){if(null!=a.height)return a.height;var b=a.doc.cm;if(!b)return 0;if(!Pg(document.body,a.node)){var c="position: relative;";a.coverGutter&&(c+="margin-left: -"+b.display.gutters.offsetWidth+"px;"),a.noHScroll&&(c+="width: "+b.display.wrapper.clientWidth+"px;"),Qe(b.display.measure,Oe("div",[a.node],null,c))}return a.height=a.node.offsetHeight}function yd(a,b,c,d){var e=new og(a,c,d),f=a.cm;return f&&e.noHScroll&&(f.display.alignWidgets=!0),Nc(a,b,"widget",function(b){var c=b.widgets||(b.widgets=[]);if(null==e.insertAt?c.push(e):c.splice(Math.min(c.length-1,Math.max(0,e.insertAt)),0,e),e.line=b,f&&!ud(a,b)){var d=be(b)<a.scrollTop;$d(b,b.height+xd(e)),d&&Jc(f,null,e.height),f.curOp.forceUpdate=!0}return!0}),e}function zd(a,b,c,d){a.text=b,a.stateAfter&&(a.stateAfter=null),a.styles&&(a.styles=null),null!=a.order&&(a.order=null),hd(a),id(a,c);var e=d?d(a):1;e!=a.height&&$d(a,e)}function Ad(a){a.parent=null,hd(a)}function Bd(a,b){if(a)for(;;){var c=a.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!c)break;a=a.slice(0,c.index)+a.slice(c.index+c[0].length);var d=c[1]?"bgClass":"textClass";null==b[d]?b[d]=c[2]:new RegExp("(?:^|s)"+c[2]+"(?:$|s)").test(b[d])||(b[d]+=" "+c[2])}return a}function Cd(b,c){if(b.blankLine)return b.blankLine(c);if(b.innerMode){var d=a.innerMode(b,c);return d.mode.blankLine?d.mode.blankLine(d.state):void 0}}function Dd(b,c,d,e){for(var f=0;10>f;f++){e&&(e[0]=a.innerMode(b,d).mode);var g=b.token(c,d);if(c.pos>c.start)return g}throw new Error("Mode "+b.name+" failed to advance stream.")}function Ed(a,b,c,d){function e(a){return{start:l.start,end:l.pos,string:l.current(),type:f||null,state:a?dg(g.mode,k):k}}var f,g=a.doc,h=g.mode;b=qa(g,b);var i,j=Xd(g,b.line),k=Pa(a,b.line,c),l=new kg(j.text,a.options.tabSize);for(d&&(i=[]);(d||l.pos<b.ch)&&!l.eol();)l.start=l.pos,f=Dd(h,l,k),d&&i.push(e(!0));return d?i:e()}function Fd(a,b,c,d,e,f,g){var h=c.flattenSpans;null==h&&(h=a.options.flattenSpans);var i,j=0,k=null,l=new kg(b,a.options.tabSize),m=a.options.addModeClass&&[null];for(""==b&&Bd(Cd(c,d),f);!l.eol();){if(l.pos>a.options.maxHighlightLength?(h=!1,g&&Id(a,b,d,l.pos),l.pos=b.length,i=null):i=Bd(Dd(c,l,d,m),f),m){var n=m[0].name;n&&(i="m-"+(i?n+" "+i:n))}if(!h||k!=i){for(;j<l.start;)j=Math.min(l.start,j+5e4),e(j,k);k=i}l.start=l.pos}for(;j<l.pos;){var o=Math.min(l.pos,j+5e4);e(o,k),j=o}}function Gd(a,b,c,d){var e=[a.state.modeGen],f={};Fd(a,b.text,a.doc.mode,c,function(a,b){e.push(a,b)},f,d);for(var g=0;g<a.state.overlays.length;++g){var h=a.state.overlays[g],i=1,j=0;Fd(a,b.text,h.mode,!0,function(a,b){for(var c=i;a>j;){var d=e[i];d>a&&e.splice(i,1,a,e[i+1],d),i+=2,j=Math.min(a,d)}if(b)if(h.opaque)e.splice(c,i-c,a,"cm-overlay "+b),i=c+2;else for(;i>c;c+=2){var f=e[c+1];e[c+1]=(f?f+" ":"")+"cm-overlay "+b}},f)}return{styles:e,classes:f.bgClass||f.textClass?f:null}}function Hd(a,b,c){if(!b.styles||b.styles[0]!=a.state.modeGen){var d=Pa(a,_d(b)),e=Gd(a,b,b.text.length>a.options.maxHighlightLength?dg(a.doc.mode,d):d);b.stateAfter=d,b.styles=e.styles,e.classes?b.styleClasses=e.classes:b.styleClasses&&(b.styleClasses=null),c===a.doc.frontier&&a.doc.frontier++}return b.styles}function Id(a,b,c,d){var e=a.doc.mode,f=new kg(b,a.options.tabSize);for(f.start=f.pos=d||0,""==b&&Cd(e,c);!f.eol();)Dd(e,f,c),f.start=f.pos}function Jd(a,b){if(!a||/^\s*$/.test(a))return null;var c=b.addModeClass?rg:qg;return c[a]||(c[a]=a.replace(/\S+/g,"cm-$&"))}function Kd(a,b){var c=Oe("span",null,null,rf?"padding-right: .1px":null),d={pre:Oe("pre",[c],"CodeMirror-line"),content:c,col:0,pos:0,cm:a,splitSpaces:(pf||rf)&&a.getOption("lineWrapping")};b.measure={};for(var e=0;e<=(b.rest?b.rest.length:0);e++){var f,g=e?b.rest[e-1]:b.line;d.pos=0,d.addToken=Md,Ye(a.display.measure)&&(f=ce(g))&&(d.addToken=Od(d.addToken,f)),d.map=[];var h=b!=a.display.externalMeasured&&_d(g);Qd(g,d,Hd(a,g,h)),g.styleClasses&&(g.styleClasses.bgClass&&(d.bgClass=Te(g.styleClasses.bgClass,d.bgClass||"")),g.styleClasses.textClass&&(d.textClass=Te(g.styleClasses.textClass,d.textClass||""))),0==d.map.length&&d.map.push(0,0,d.content.appendChild(Xe(a.display.measure))),0==e?(b.measure.map=d.map,b.measure.cache={}):((b.measure.maps||(b.measure.maps=[])).push(d.map),(b.measure.caches||(b.measure.caches=[])).push({}))}return rf&&/\bcm-tab\b/.test(d.content.lastChild.className)&&(d.content.className="cm-tab-wrap-hack"),Bg(a,"renderLine",a,b.line,d.pre),d.pre.className&&(d.textClass=Te(d.pre.className,d.textClass||"")),d}function Ld(a){var b=Oe("span","•","cm-invalidchar");return b.title="\\u"+a.charCodeAt(0).toString(16),b.setAttribute("aria-label",b.title),b}function Md(a,b,c,d,e,f,g){if(b){var h=a.splitSpaces?b.replace(/ {3,}/g,Nd):b,i=a.cm.state.specialChars,j=!1;if(i.test(b))for(var k=document.createDocumentFragment(),l=0;;){i.lastIndex=l;var m=i.exec(b),n=m?m.index-l:b.length-l;if(n){var o=document.createTextNode(h.slice(l,l+n));pf&&9>qf?k.appendChild(Oe("span",[o])):k.appendChild(o),a.map.push(a.pos,a.pos+n,o),a.col+=n,a.pos+=n}if(!m)break;if(l+=n+1," "==m[0]){var p=a.cm.options.tabSize,q=p-a.col%p,o=k.appendChild(Oe("span",De(q),"cm-tab"));o.setAttribute("role","presentation"),o.setAttribute("cm-text"," "),a.col+=q}else if("\r"==m[0]||"\n"==m[0]){var o=k.appendChild(Oe("span","\r"==m[0]?"␍":"","cm-invalidchar"));o.setAttribute("cm-text",m[0]),a.col+=1}else{var o=a.cm.options.specialCharPlaceholder(m[0]);o.setAttribute("cm-text",m[0]),pf&&9>qf?k.appendChild(Oe("span",[o])):k.appendChild(o),a.col+=1}a.map.push(a.pos,a.pos+1,o),a.pos++}else{a.col+=b.length;var k=document.createTextNode(h);a.map.push(a.pos,a.pos+b.length,k),pf&&9>qf&&(j=!0),a.pos+=b.length}if(c||d||e||j||g){var r=c||"";d&&(r+=d),e&&(r+=e);var s=Oe("span",[k],r,g);return f&&(s.title=f),a.content.appendChild(s)}a.content.appendChild(k)}}function Nd(a){for(var b=" ",c=0;c<a.length-2;++c)b+=c%2?" ":" ";return b+=" "}function Od(a,b){return function(c,d,e,f,g,h,i){e=e?e+" cm-force-border":"cm-force-border";for(var j=c.pos,k=j+d.length;;){for(var l=0;l<b.length;l++){var m=b[l];if(m.to>j&&m.from<=j)break}if(m.to>=k)return a(c,d,e,f,g,h,i);a(c,d.slice(0,m.to-j),e,f,null,h,i),f=null,d=d.slice(m.to-j),j=m.to}}}function Pd(a,b,c,d){var e=!d&&c.widgetNode;e&&a.map.push(a.pos,a.pos+b,e),!d&&a.cm.display.input.needsContentAttribute&&(e||(e=a.content.appendChild(document.createElement("span"))),e.setAttribute("cm-marker",c.id)),e&&(a.cm.display.input.setUneditable(e),a.content.appendChild(e)),a.pos+=b}function Qd(a,b,c){var d=a.markedSpans,e=a.text,f=0;if(d)for(var g,h,i,j,k,l,m,n=e.length,o=0,p=1,q="",r=0;;){if(r==o){i=j=k=l=h="",m=null,r=1/0;for(var s=[],t=0;t<d.length;++t){var u=d[t],v=u.marker;"bookmark"==v.type&&u.from==o&&v.widgetNode?s.push(v):u.from<=o&&(null==u.to||u.to>o||v.collapsed&&u.to==o&&u.from==o)?(null!=u.to&&u.to!=o&&r>u.to&&(r=u.to,j=""),v.className&&(i+=" "+v.className),v.css&&(h=v.css),v.startStyle&&u.from==o&&(k+=" "+v.startStyle),v.endStyle&&u.to==r&&(j+=" "+v.endStyle),v.title&&!l&&(l=v.title),v.collapsed&&(!m||ld(m.marker,v)<0)&&(m=u)):u.from>o&&r>u.from&&(r=u.from)}if(m&&(m.from||0)==o){if(Pd(b,(null==m.to?n+1:m.to)-o,m.marker,null==m.from),null==m.to)return;m.to==o&&(m=!1)}if(!m&&s.length)for(var t=0;t<s.length;++t)Pd(b,0,s[t])}if(o>=n)break;for(var w=Math.min(n,r);;){if(q){var x=o+q.length;if(!m){var y=x>w?q.slice(0,w-o):q;b.addToken(b,y,g?g+i:i,k,o+y.length==r?j:"",l,h)}if(x>=w){q=q.slice(w-o),o=w;break}o=x,k=""}q=e.slice(f,f=c[p++]),g=Jd(c[p++],b.cm.options)}}else for(var p=1;p<c.length;p+=2)b.addToken(b,e.slice(f,f=c[p]),Jd(c[p+1],b.cm.options))}function Rd(a,b){return 0==b.from.ch&&0==b.to.ch&&""==Ee(b.text)&&(!a.cm||a.cm.options.wholeLineUpdateBefore)}function Sd(a,b,c,d){function e(a){return c?c[a]:null}function f(a,c,e){zd(a,c,e,d),ve(a,"change",a,b)}function g(a,b){for(var c=a,f=[];b>c;++c)f.push(new pg(j[c],e(c),d));return f}var h=b.from,i=b.to,j=b.text,k=Xd(a,h.line),l=Xd(a,i.line),m=Ee(j),n=e(j.length-1),o=i.line-h.line;if(b.full)a.insert(0,g(0,j.length)),a.remove(j.length,a.size-j.length);else if(Rd(a,b)){var p=g(0,j.length-1);f(l,l.text,n),o&&a.remove(h.line,o),p.length&&a.insert(h.line,p)}else if(k==l)if(1==j.length)f(k,k.text.slice(0,h.ch)+m+k.text.slice(i.ch),n);else{var p=g(1,j.length-1);p.push(new pg(m+k.text.slice(i.ch),n,d)),f(k,k.text.slice(0,h.ch)+j[0],e(0)),a.insert(h.line+1,p)}else if(1==j.length)f(k,k.text.slice(0,h.ch)+j[0]+l.text.slice(i.ch),e(0)),a.remove(h.line+1,o);else{f(k,k.text.slice(0,h.ch)+j[0],e(0)),f(l,m+l.text.slice(i.ch),n);var p=g(1,j.length-1);o>1&&a.remove(h.line+1,o-1),a.insert(h.line+1,p)}ve(a,"change",a,b)}function Td(a){this.lines=a,this.parent=null;for(var b=0,c=0;b<a.length;++b)a[b].parent=this,c+=a[b].height;this.height=c}function Ud(a){this.children=a;for(var b=0,c=0,d=0;d<a.length;++d){var e=a[d];b+=e.chunkSize(),c+=e.height,e.parent=this}this.size=b,this.height=c,this.parent=null}function Vd(a,b,c){function d(a,e,f){if(a.linked)for(var g=0;g<a.linked.length;++g){var h=a.linked[g];if(h.doc!=e){var i=f&&h.sharedHist;(!c||i)&&(b(h.doc,i),d(h.doc,a,i))}}}d(a,null,!0)}function Wd(a,b){if(b.cm)throw new Error("This document is already in use.");a.doc=b,b.cm=a,g(a),c(a),a.options.lineWrapping||m(a),a.options.mode=b.modeOption,Ib(a)}function Xd(a,b){if(b-=a.first,0>b||b>=a.size)throw new Error("There is no line "+(b+a.first)+" in the document.");for(var c=a;!c.lines;)for(var d=0;;++d){var e=c.children[d],f=e.chunkSize();if(f>b){c=e;break}b-=f}return c.lines[b]}function Yd(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 Zd(a,b,c){var d=[];return a.iter(b,c,function(a){d.push(a.text)}),d}function $d(a,b){var c=b-a.height;if(c)for(var d=a;d;d=d.parent)d.height+=c}function _d(a){if(null==a.parent)return null;for(var b=a.parent,c=Fe(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 ae(a,b){var c=a.first;a:do{for(var d=0;d<a.children.length;++d){var e=a.children[d],f=e.height;if(f>b){a=e;continue a}b-=f,c+=e.chunkSize()}return c}while(!a.lines);for(var d=0;d<a.lines.length;++d){var g=a.lines[d],h=g.height;if(h>b)break;b-=h}return c+d}function be(a){a=qd(a);for(var b=0,c=a.parent,d=0;d<c.lines.length;++d){var e=c.lines[d];if(e==a)break;b+=e.height}for(var f=c.parent;f;c=f,f=c.parent)for(var d=0;d<f.children.length;++d){var g=f.children[d];if(g==c)break;b+=g.height}return b}function ce(a){var b=a.order;return null==b&&(b=a.order=ah(a.text)),b}function de(a){this.done=[],this.undone=[],this.undoDepth=1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=a||1}function ee(a,b){var c={from:V(b.from),to:Wf(b),text:Yd(a,b.from,b.to)};return le(a,c,b.from.line,b.to.line+1),Vd(a,function(a){le(a,c,b.from.line,b.to.line+1)},!0),c}function fe(a){for(;a.length;){var b=Ee(a);if(!b.ranges)break;a.pop()}}function ge(a,b){return b?(fe(a.done),Ee(a.done)):a.done.length&&!Ee(a.done).ranges?Ee(a.done):a.done.length>1&&!a.done[a.done.length-2].ranges?(a.done.pop(),Ee(a.done)):void 0}function he(a,b,c,d){var e=a.history;e.undone.length=0;var f,g=+new Date;if((e.lastOp==d||e.lastOrigin==b.origin&&b.origin&&("+"==b.origin.charAt(0)&&a.cm&&e.lastModTime>g-a.cm.options.historyEventDelay||"*"==b.origin.charAt(0)))&&(f=ge(e,e.lastOp==d))){var h=Ee(f.changes);0==If(b.from,b.to)&&0==If(b.from,h.to)?h.to=Wf(b):f.changes.push(ee(a,b))}else{var i=Ee(e.done);for(i&&i.ranges||ke(a.sel,e.done),f={changes:[ee(a,b)],generation:e.generation},e.done.push(f);e.done.length>e.undoDepth;)e.done.shift(),e.done[0].ranges||e.done.shift()}e.done.push(c),e.generation=++e.maxGeneration,e.lastModTime=e.lastSelTime=g,e.lastOp=e.lastSelOp=d,e.lastOrigin=e.lastSelOrigin=b.origin,h||Bg(a,"historyAdded")}function ie(a,b,c,d){var e=b.charAt(0);return"*"==e||"+"==e&&c.ranges.length==d.ranges.length&&c.somethingSelected()==d.somethingSelected()&&new Date-a.history.lastSelTime<=(a.cm?a.cm.options.historyEventDelay:500)}function je(a,b,c,d){var e=a.history,f=d&&d.origin;c==e.lastSelOp||f&&e.lastSelOrigin==f&&(e.lastModTime==e.lastSelTime&&e.lastOrigin==f||ie(a,f,Ee(e.done),b))?e.done[e.done.length-1]=b:ke(b,e.done),e.lastSelTime=+new Date,e.lastSelOrigin=f,e.lastSelOp=c,d&&d.clearRedo!==!1&&fe(e.undone)}function ke(a,b){var c=Ee(b);c&&c.ranges&&c.equals(a)||b.push(a)}function le(a,b,c,d){var e=b["spans_"+a.id],f=0;a.iter(Math.max(a.first,c),Math.min(a.first+a.size,d),function(c){c.markedSpans&&((e||(e=b["spans_"+a.id]={}))[f]=c.markedSpans),++f})}function me(a){if(!a)return null;for(var b,c=0;c<a.length;++c)a[c].marker.explicitlyCleared?b||(b=a.slice(0,c)):b&&b.push(a[c]);return b?b.length?b:null:a}function ne(a,b){var c=b["spans_"+a.id];if(!c)return null;for(var d=0,e=[];d<b.text.length;++d)e.push(me(c[d]));return e}function oe(a,b,c){for(var d=0,e=[];d<a.length;++d){var f=a[d];if(f.ranges)e.push(c?la.prototype.deepCopy.call(f):f);else{var g=f.changes,h=[];e.push({changes:h});for(var i=0;i<g.length;++i){var j,k=g[i];if(h.push({from:k.from,to:k.to,text:k.text}),b)for(var l in k)(j=l.match(/^spans_(\d+)$/))&&Fe(b,Number(j[1]))>-1&&(Ee(h)[l]=k[l],delete k[l])}}}return e}function pe(a,b,c,d){c<a.line?a.line+=d:b<a.line&&(a.line=b,a.ch=0)}function qe(a,b,c,d){for(var e=0;e<a.length;++e){var f=a[e],g=!0;if(f.ranges){f.copied||(f=a[e]=f.deepCopy(),f.copied=!0);for(var h=0;h<f.ranges.length;h++)pe(f.ranges[h].anchor,b,c,d),pe(f.ranges[h].head,b,c,d)}else{for(var h=0;h<f.changes.length;++h){var i=f.changes[h];if(c<i.from.line)i.from=Hf(i.from.line+d,i.from.ch),i.to=Hf(i.to.line+d,i.to.ch);else if(b<=i.to.line){g=!1;break}}g||(a.splice(0,e+1),e=0)}}}function re(a,b){var c=b.from.line,d=b.to.line,e=b.text.length-(d-c)-1;qe(a.done,c,d,e),qe(a.undone,c,d,e)}function se(a){return null!=a.defaultPrevented?a.defaultPrevented:0==a.returnValue}function te(a){return a.target||a.srcElement}function ue(a){var b=a.which;return null==b&&(1&a.button?b=1:2&a.button?b=3:4&a.button&&(b=2)),Af&&a.ctrlKey&&1==b&&(b=3),b}function ve(a,b){function c(a){return function(){a.apply(null,f)}}var d=a._handlers&&a._handlers[b];if(d){var e,f=Array.prototype.slice.call(arguments,2);Of?e=Of.delayedCallbacks:Cg?e=Cg:(e=Cg=[],setTimeout(we,0));for(var g=0;g<d.length;++g)e.push(c(d[g]))}}function we(){var a=Cg;Cg=null;for(var b=0;b<a.length;++b)a[b]()}function xe(a,b,c){return"string"==typeof b&&(b={type:b,preventDefault:function(){this.defaultPrevented=!0}}),Bg(a,c||b.type,a,b),se(b)||b.codemirrorIgnore}function ye(a){var b=a._handlers&&a._handlers.cursorActivity;if(b)for(var c=a.curOp.cursorActivityHandlers||(a.curOp.cursorActivityHandlers=[]),d=0;d<b.length;++d)-1==Fe(c,b[d])&&c.push(b[d])}function ze(a,b){var c=a._handlers&&a._handlers[b];return c&&c.length>0}function Ae(a){a.prototype.on=function(a,b){zg(this,a,b)},a.prototype.off=function(a,b){Ag(this,a,b)}}function Be(){this.id=null}function Ce(a,b,c){for(var d=0,e=0;;){var f=a.indexOf(" ",d);-1==f&&(f=a.length);var g=f-d;if(f==a.length||e+g>=b)return d+Math.min(g,b-e);if(e+=f-d,e+=c-e%c,d=f+1,e>=b)return d}}function De(a){for(;Jg.length<=a;)Jg.push(Ee(Jg)+" ");return Jg[a]}function Ee(a){return a[a.length-1]}function Fe(a,b){for(var c=0;c<a.length;++c)if(a[c]==b)return c;return-1}function Ge(a,b){for(var c=[],d=0;d<a.length;d++)c[d]=b(a[d],d);return c}function He(){}function Ie(a,b){var c;return Object.create?c=Object.create(a):(He.prototype=a,c=new He),b&&Je(b,c),c}function Je(a,b,c){b||(b={});for(var d in a)!a.hasOwnProperty(d)||c===!1&&b.hasOwnProperty(d)||(b[d]=a[d]);return b}function Ke(a){var b=Array.prototype.slice.call(arguments,1);return function(){return a.apply(null,b)}}function Le(a,b){return b?b.source.indexOf("\\w")>-1&&Ng(a)?!0:b.test(a):Ng(a)}function Me(a){for(var b in a)if(a.hasOwnProperty(b)&&a[b])return!1;return!0}function Ne(a){return a.charCodeAt(0)>=768&&Og.test(a)}function Oe(a,b,c,d){var e=document.createElement(a);if(c&&(e.className=c),d&&(e.style.cssText=d),"string"==typeof b)e.appendChild(document.createTextNode(b));else if(b)for(var f=0;f<b.length;++f)e.appendChild(b[f]);return e}function Pe(a){for(var b=a.childNodes.length;b>0;--b)a.removeChild(a.firstChild);return a}function Qe(a,b){return Pe(a).appendChild(b)}function Re(){for(var a=document.activeElement;a&&a.root&&a.root.activeElement;)a=a.root.activeElement;return a}function Se(a){return new RegExp("(^|\\s)"+a+"(?:$|\\s)\\s*")}function Te(a,b){for(var c=a.split(" "),d=0;d<c.length;d++)c[d]&&!Se(c[d]).test(b)&&(b+=" "+c[d]);return b}function Ue(a){if(document.body.getElementsByClassName)for(var b=document.body.getElementsByClassName("CodeMirror"),c=0;c<b.length;c++){var d=b[c].CodeMirror;d&&a(d)}}function Ve(){Ug||(We(),Ug=!0)}function We(){var a;zg(window,"resize",function(){null==a&&(a=setTimeout(function(){a=null,Ue(Rb)},100))}),zg(window,"blur",function(){Ue(qc)})}function Xe(a){if(null==Qg){var b=Oe("span","");Qe(a,Oe("span",[b,document.createTextNode("x")])),0!=a.firstChild.offsetHeight&&(Qg=b.offsetWidth<=1&&b.offsetHeight>2&&!(pf&&8>qf))}var c=Qg?Oe("span",""):Oe("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return c.setAttribute("cm-text",""),c}function Ye(a){if(null!=Rg)return Rg;var b=Qe(a,document.createTextNode("AخA")),c=Lg(b,0,1).getBoundingClientRect();if(!c||c.left==c.right)return!1;var d=Lg(b,1,2).getBoundingClientRect();return Rg=d.right-c.right<3}function Ze(a){if(null!=Zg)return Zg;var b=Qe(a,Oe("span","x")),c=b.getBoundingClientRect(),d=Lg(b,0,1).getBoundingClientRect();return Zg=Math.abs(c.left-d.left)>1}function $e(a,b,c,d){if(!a)return d(b,c,"ltr");for(var e=!1,f=0;f<a.length;++f){var g=a[f];(g.from<c&&g.to>b||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 _e(a){return a.level%2?a.to:a.from}function af(a){return a.level%2?a.from:a.to}function bf(a){var b=ce(a);return b?_e(b[0]):0}function cf(a){var b=ce(a);return b?af(Ee(b)):a.text.length}function df(a,b){var c=Xd(a.doc,b),d=qd(c);d!=c&&(b=_d(d));var e=ce(d),f=e?e[0].level%2?cf(d):bf(d):0;return Hf(b,f)}function ef(a,b){for(var c,d=Xd(a.doc,b);c=od(d);)d=c.find(1,!0).line,b=null;var e=ce(d),f=e?e[0].level%2?bf(d):cf(d):d.text.length;return Hf(null==b?_d(d):b,f)}function ff(a,b){var c=df(a,b.line),d=Xd(a.doc,c.line),e=ce(d);if(!e||0==e[0].level){var f=Math.max(0,d.text.search(/\S/)),g=b.line==c.line&&b.ch<=f&&b.ch;return Hf(c.line,g?0:f)}return c}function gf(a,b,c){var d=a[0].level;return b==d?!0:c==d?!1:c>b}function hf(a,b){_g=null;for(var c,d=0;d<a.length;++d){var e=a[d];if(e.from<b&&e.to>b)return d;if(e.from==b||e.to==b){if(null!=c)return gf(a,e.level,a[c].level)?(e.from!=e.to&&(_g=c),d):(e.from!=e.to&&(_g=d),c);c=d}}return c}function jf(a,b,c,d){if(!d)return b+c;do b+=c;while(b>0&&Ne(a.text.charAt(b)));return b}function kf(a,b,c,d){var e=ce(a);if(!e)return lf(a,b,c,d);for(var f=hf(e,b),g=e[f],h=jf(a,b,g.level%2?-c:c,d);;){if(h>g.from&&h<g.to)return h;if(h==g.from||h==g.to)return hf(e,h)==f?h:(g=e[f+=c],c>0==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&&Ne(a.text.charAt(e));)e+=c;return 0>e||e>a.text.length?null:e}var mf=/gecko\/\d/i.test(navigator.userAgent),nf=/MSIE \d/.test(navigator.userAgent),of=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),pf=nf||of,qf=pf&&(nf?document.documentMode||6:of[1]),rf=/WebKit\//.test(navigator.userAgent),sf=rf&&/Qt\/\d+\.\d+/.test(navigator.userAgent),tf=/Chrome\//.test(navigator.userAgent),uf=/Opera\//.test(navigator.userAgent),vf=/Apple Computer/.test(navigator.vendor),wf=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),xf=/PhantomJS/.test(navigator.userAgent),yf=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),zf=yf||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent),Af=yf||/Mac/.test(navigator.platform),Bf=/win/i.test(navigator.platform),Cf=uf&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);Cf&&(Cf=Number(Cf[1])),Cf&&Cf>=15&&(uf=!1,rf=!0);var Df=Af&&(sf||uf&&(null==Cf||12.11>Cf)),Ef=mf||pf&&qf>=9,Ff=!1,Gf=!1;p.prototype=Je({update:function(a){var b=a.scrollWidth>a.clientWidth+1,c=a.scrollHeight>a.clientHeight+1,d=a.nativeBarWidth;if(c){this.vert.style.display="block",this.vert.style.bottom=b?d+"px":"0";var e=a.viewHeight-(b?d:0);this.vert.firstChild.style.height=Math.max(0,a.scrollHeight-a.clientHeight+e)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(b){this.horiz.style.display="block",this.horiz.style.right=c?d+"px":"0",this.horiz.style.left=a.barLeft+"px";var f=a.viewWidth-a.barLeft-(c?d:0);this.horiz.firstChild.style.width=a.scrollWidth-a.clientWidth+f+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedOverlay&&a.clientHeight>0&&(0==d&&this.overlayHack(),this.checkedOverlay=!0),{right:c?d:0,bottom:b?d:0}},setScrollLeft:function(a){this.horiz.scrollLeft!=a&&(this.horiz.scrollLeft=a)},setScrollTop:function(a){this.vert.scrollTop!=a&&(this.vert.scrollTop=a)},overlayHack:function(){var a=Af&&!wf?"12px":"18px";this.horiz.style.minHeight=this.vert.style.minWidth=a;var b=this,c=function(a){te(a)!=b.vert&&te(a)!=b.horiz&&Db(b.cm,Ub)(a)};zg(this.vert,"mousedown",c),zg(this.horiz,"mousedown",c)},clear:function(){var a=this.horiz.parentNode;a.removeChild(this.horiz),a.removeChild(this.vert)}},p.prototype),q.prototype=Je({update:function(){return{bottom:0,right:0}},setScrollLeft:function(){},setScrollTop:function(){},clear:function(){}},q.prototype),a.scrollbarModel={"native":p,"null":q},z.prototype.signal=function(a,b){ze(a,b)&&this.events.push(arguments)},z.prototype.finish=function(){for(var a=0;a<this.events.length;a++)Bg.apply(null,this.events[a])};var Hf=a.Pos=function(a,b){return this instanceof Hf?(this.line=a,void(this.ch=b)):new Hf(a,b)},If=a.cmpPos=function(a,b){return a.line-b.line||a.ch-b.ch},Jf=null;da.prototype=Je({init:function(a){function b(a){if(d.somethingSelected())Jf=d.getSelections(),c.inaccurateSelection&&(c.prevInput="",c.inaccurateSelection=!1,f.value=Jf.join("\n"),Kg(f));else{if(!d.options.lineWiseCopyCut)return;var b=ba(d);Jf=b.text,"cut"==a.type?d.setSelections(b.ranges,null,Fg):(c.prevInput="",f.value=b.text.join("\n"),Kg(f))}"cut"==a.type&&(d.state.cutIncoming=!0)}var c=this,d=this.cm,e=this.wrapper=ea(),f=this.textarea=e.firstChild;a.wrapper.insertBefore(e,a.wrapper.firstChild),yf&&(f.style.width="0px"),zg(f,"input",function(){pf&&qf>=9&&c.hasSelection&&(c.hasSelection=null),c.poll()}),zg(f,"paste",function(a){return _(a,d)?!0:(d.state.pasteIncoming=!0,void c.fastPoll())}),zg(f,"cut",b),
zg(f,"copy",b),zg(a.scroller,"paste",function(b){Sb(a,b)||(d.state.pasteIncoming=!0,c.focus())}),zg(a.lineSpace,"selectstart",function(b){Sb(a,b)||wg(b)}),zg(f,"compositionstart",function(){var a=d.getCursor("from");c.composing={start:a,range:d.markText(a,d.getCursor("to"),{className:"CodeMirror-composing"})}}),zg(f,"compositionend",function(){c.composing&&(c.poll(),c.composing.range.clear(),c.composing=null)})},prepareSelection:function(){var a=this.cm,b=a.display,c=a.doc,d=Ia(a);if(a.options.moveInputWithCursor){var e=mb(a,c.sel.primary().head,"div"),f=b.wrapper.getBoundingClientRect(),g=b.lineDiv.getBoundingClientRect();d.teTop=Math.max(0,Math.min(b.wrapper.clientHeight-10,e.top+g.top-f.top)),d.teLeft=Math.max(0,Math.min(b.wrapper.clientWidth-10,e.left+g.left-f.left))}return d},showSelection:function(a){var b=this.cm,c=b.display;Qe(c.cursorDiv,a.cursors),Qe(c.selectionDiv,a.selection),null!=a.teTop&&(this.wrapper.style.top=a.teTop+"px",this.wrapper.style.left=a.teLeft+"px")},reset:function(a){if(!this.contextMenuPending){var b,c,d=this.cm,e=d.doc;if(d.somethingSelected()){this.prevInput="";var f=e.sel.primary();b=Yg&&(f.to().line-f.from().line>100||(c=d.getSelection()).length>1e3);var g=b?"-":c||d.getSelection();this.textarea.value=g,d.state.focused&&Kg(this.textarea),pf&&qf>=9&&(this.hasSelection=g)}else a||(this.prevInput=this.textarea.value="",pf&&qf>=9&&(this.hasSelection=null));this.inaccurateSelection=b}},getField:function(){return this.textarea},supportsTouch:function(){return!1},focus:function(){if("nocursor"!=this.cm.options.readOnly&&(!zf||Re()!=this.textarea))try{this.textarea.focus()}catch(a){}},blur:function(){this.textarea.blur()},resetPosition:function(){this.wrapper.style.top=this.wrapper.style.left=0},receivedFocus:function(){this.slowPoll()},slowPoll:function(){var a=this;a.pollingFast||a.polling.set(this.cm.options.pollInterval,function(){a.poll(),a.cm.state.focused&&a.slowPoll()})},fastPoll:function(){function a(){var d=c.poll();d||b?(c.pollingFast=!1,c.slowPoll()):(b=!0,c.polling.set(60,a))}var b=!1,c=this;c.pollingFast=!0,c.polling.set(20,a)},poll:function(){var a=this.cm,b=this.textarea,c=this.prevInput;if(this.contextMenuPending||!a.state.focused||Xg(b)&&!c&&!this.composing||Z(a)||a.options.disableInput||a.state.keySeq)return!1;var d=b.value;if(d==c&&!a.somethingSelected())return!1;if(pf&&qf>=9&&this.hasSelection===d||Af&&/[\uf700-\uf7ff]/.test(d))return a.display.input.reset(),!1;if(a.doc.sel==a.display.selForContextMenu){var e=d.charCodeAt(0);if(8203!=e||c||(c=""),8666==e)return this.reset(),this.cm.execCommand("undo")}for(var f=0,g=Math.min(c.length,d.length);g>f&&c.charCodeAt(f)==d.charCodeAt(f);)++f;var h=this;return Cb(a,function(){$(a,d.slice(f),c.length-f,null,h.composing?"*compose":null),d.length>1e3||d.indexOf("\n")>-1?b.value=h.prevInput="":h.prevInput=d,h.composing&&(h.composing.range.clear(),h.composing.range=a.markText(h.composing.start,a.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},ensurePolled:function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},onKeyPress:function(){pf&&qf>=9&&(this.hasSelection=null),this.fastPoll()},onContextMenu:function(a){function b(){if(null!=g.selectionStart){var a=e.somethingSelected(),b=""+(a?g.value:"");g.value="⇚",g.value=b,d.prevInput=a?"":"",g.selectionStart=1,g.selectionEnd=b.length,f.selForContextMenu=e.doc.sel}}function c(){if(d.contextMenuPending=!1,d.wrapper.style.position="relative",g.style.cssText=k,pf&&9>qf&&f.scrollbars.setScrollTop(f.scroller.scrollTop=i),null!=g.selectionStart){(!pf||pf&&9>qf)&&b();var a=0,c=function(){f.selForContextMenu==e.doc.sel&&0==g.selectionStart&&g.selectionEnd>0&&""==d.prevInput?Db(e,fg.selectAll)(e):a++<10?f.detectingSelectAll=setTimeout(c,500):f.input.reset()};f.detectingSelectAll=setTimeout(c,200)}}var d=this,e=d.cm,f=e.display,g=d.textarea,h=Tb(e,a),i=f.scroller.scrollTop;if(h&&!uf){var j=e.options.resetSelectionOnContextMenu;j&&-1==e.doc.sel.contains(h)&&Db(e,Ba)(e.doc,oa(h),Fg);var k=g.style.cssText;if(d.wrapper.style.position="absolute",g.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(a.clientY-5)+"px; left: "+(a.clientX-5)+"px; z-index: 1000; background: "+(pf?"rgba(255, 255, 255, .05)":"transparent")+"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",rf)var l=window.scrollY;if(f.input.focus(),rf&&window.scrollTo(null,l),f.input.reset(),e.somethingSelected()||(g.value=d.prevInput=" "),d.contextMenuPending=!0,f.selForContextMenu=e.doc.sel,clearTimeout(f.detectingSelectAll),pf&&qf>=9&&b(),Ef){yg(a);var m=function(){Ag(window,"mouseup",m),setTimeout(c,20)};zg(window,"mouseup",m)}else setTimeout(c,50)}},setUneditable:He,needsContentAttribute:!1},da.prototype),fa.prototype=Je({init:function(a){function b(a){if(d.somethingSelected())Jf=d.getSelections(),"cut"==a.type&&d.replaceSelection("",null,"cut");else{if(!d.options.lineWiseCopyCut)return;var b=ba(d);Jf=b.text,"cut"==a.type&&d.operation(function(){d.setSelections(b.ranges,0,Fg),d.replaceSelection("",null,"cut")})}if(a.clipboardData&&!yf)a.preventDefault(),a.clipboardData.clearData(),a.clipboardData.setData("text/plain",Jf.join("\n"));else{var c=ea(),e=c.firstChild;d.display.lineSpace.insertBefore(c,d.display.lineSpace.firstChild),e.value=Jf.join("\n");var f=document.activeElement;Kg(e),setTimeout(function(){d.display.lineSpace.removeChild(c),f.focus()},50)}}var c=this,d=c.cm,e=c.div=a.lineDiv;e.contentEditable="true",ca(e),zg(e,"paste",function(a){_(a,d)}),zg(e,"compositionstart",function(a){var b=a.data;if(c.composing={sel:d.doc.sel,data:b,startData:b},b){var e=d.doc.sel.primary(),f=d.getLine(e.head.line),g=f.indexOf(b,Math.max(0,e.head.ch-b.length));g>-1&&g<=e.head.ch&&(c.composing.sel=oa(Hf(e.head.line,g),Hf(e.head.line,g+b.length)))}}),zg(e,"compositionupdate",function(a){c.composing.data=a.data}),zg(e,"compositionend",function(a){var b=c.composing;b&&(a.data==b.startData||/\u200b/.test(a.data)||(b.data=a.data),setTimeout(function(){b.handled||c.applyComposition(b),c.composing==b&&(c.composing=null)},50))}),zg(e,"touchstart",function(){c.forceCompositionEnd()}),zg(e,"input",function(){c.composing||c.pollContent()||Cb(c.cm,function(){Ib(d)})}),zg(e,"copy",b),zg(e,"cut",b)},prepareSelection:function(){var a=Ia(this.cm,!1);return a.focus=this.cm.state.focused,a},showSelection:function(a){a&&this.cm.display.view.length&&(a.focus&&this.showPrimarySelection(),this.showMultipleSelections(a))},showPrimarySelection:function(){var a=window.getSelection(),b=this.cm.doc.sel.primary(),c=ia(this.cm,a.anchorNode,a.anchorOffset),d=ia(this.cm,a.focusNode,a.focusOffset);if(!c||c.bad||!d||d.bad||0!=If(X(c,d),b.from())||0!=If(W(c,d),b.to())){var e=ga(this.cm,b.from()),f=ga(this.cm,b.to());if(e||f){var g=this.cm.display.view,h=a.rangeCount&&a.getRangeAt(0);if(e){if(!f){var i=g[g.length-1].measure,j=i.maps?i.maps[i.maps.length-1]:i.map;f={node:j[j.length-1],offset:j[j.length-2]-j[j.length-3]}}}else e={node:g[0].measure.map[2],offset:0};try{var k=Lg(e.node,e.offset,f.offset,f.node)}catch(l){}k&&(a.removeAllRanges(),a.addRange(k),h&&null==a.anchorNode?a.addRange(h):mf&&this.startGracePeriod()),this.rememberSelection()}}},startGracePeriod:function(){var a=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){a.gracePeriod=!1,a.selectionChanged()&&a.cm.operation(function(){a.cm.curOp.selectionChanged=!0})},20)},showMultipleSelections:function(a){Qe(this.cm.display.cursorDiv,a.cursors),Qe(this.cm.display.selectionDiv,a.selection)},rememberSelection:function(){var a=window.getSelection();this.lastAnchorNode=a.anchorNode,this.lastAnchorOffset=a.anchorOffset,this.lastFocusNode=a.focusNode,this.lastFocusOffset=a.focusOffset},selectionInEditor:function(){var a=window.getSelection();if(!a.rangeCount)return!1;var b=a.getRangeAt(0).commonAncestorContainer;return Pg(this.div,b)},focus:function(){"nocursor"!=this.cm.options.readOnly&&this.div.focus()},blur:function(){this.div.blur()},getField:function(){return this.div},supportsTouch:function(){return!0},receivedFocus:function(){function a(){b.cm.state.focused&&(b.pollSelection(),b.polling.set(b.cm.options.pollInterval,a))}var b=this;this.selectionInEditor()?this.pollSelection():Cb(this.cm,function(){b.cm.curOp.selectionChanged=!0}),this.polling.set(this.cm.options.pollInterval,a)},selectionChanged:function(){var a=window.getSelection();return a.anchorNode!=this.lastAnchorNode||a.anchorOffset!=this.lastAnchorOffset||a.focusNode!=this.lastFocusNode||a.focusOffset!=this.lastFocusOffset},pollSelection:function(){if(!this.composing&&!this.gracePeriod&&this.selectionChanged()){var a=window.getSelection(),b=this.cm;this.rememberSelection();var c=ia(b,a.anchorNode,a.anchorOffset),d=ia(b,a.focusNode,a.focusOffset);c&&d&&Cb(b,function(){Ba(b.doc,oa(c,d),Fg),(c.bad||d.bad)&&(b.curOp.selectionChanged=!0)})}},pollContent:function(){var a=this.cm,b=a.display,c=a.doc.sel.primary(),d=c.from(),e=c.to();if(d.line<b.viewFrom||e.line>b.viewTo-1)return!1;var f;if(d.line==b.viewFrom||0==(f=Lb(a,d.line)))var g=_d(b.view[0].line),h=b.view[0].node;else var g=_d(b.view[f].line),h=b.view[f-1].node.nextSibling;var i=Lb(a,e.line);if(i==b.view.length-1)var j=b.viewTo-1,k=b.lineDiv.lastChild;else var j=_d(b.view[i+1].line)-1,k=b.view[i+1].node.previousSibling;for(var l=a.doc.splitLines(ka(a,h,k,g,j)),m=Yd(a.doc,Hf(g,0),Hf(j,Xd(a.doc,j).text.length));l.length>1&&m.length>1;)if(Ee(l)==Ee(m))l.pop(),m.pop(),j--;else{if(l[0]!=m[0])break;l.shift(),m.shift(),g++}for(var n=0,o=0,p=l[0],q=m[0],r=Math.min(p.length,q.length);r>n&&p.charCodeAt(n)==q.charCodeAt(n);)++n;for(var s=Ee(l),t=Ee(m),u=Math.min(s.length-(1==l.length?n:0),t.length-(1==m.length?n:0));u>o&&s.charCodeAt(s.length-o-1)==t.charCodeAt(t.length-o-1);)++o;l[l.length-1]=s.slice(0,s.length-o),l[0]=l[0].slice(n);var v=Hf(g,n),w=Hf(j,m.length?Ee(m).length-o:0);return l.length>1||l[0]||If(v,w)?(Ec(a.doc,l,v,w,"+input"),!0):void 0},ensurePolled:function(){this.forceCompositionEnd()},reset:function(){this.forceCompositionEnd()},forceCompositionEnd:function(){this.composing&&!this.composing.handled&&(this.applyComposition(this.composing),this.composing.handled=!0,this.div.blur(),this.div.focus())},applyComposition:function(a){a.data&&a.data!=a.startData&&Db(this.cm,$)(this.cm,a.data,0,a.sel)},setUneditable:function(a){a.setAttribute("contenteditable","false")},onKeyPress:function(a){a.preventDefault(),Db(this.cm,$)(this.cm,String.fromCharCode(null==a.charCode?a.keyCode:a.charCode),0)},onContextMenu:He,resetPosition:He,needsContentAttribute:!0},fa.prototype),a.inputStyles={textarea:da,contenteditable:fa},la.prototype={primary:function(){return this.ranges[this.primIndex]},equals:function(a){if(a==this)return!0;if(a.primIndex!=this.primIndex||a.ranges.length!=this.ranges.length)return!1;for(var b=0;b<this.ranges.length;b++){var c=this.ranges[b],d=a.ranges[b];if(0!=If(c.anchor,d.anchor)||0!=If(c.head,d.head))return!1}return!0},deepCopy:function(){for(var a=[],b=0;b<this.ranges.length;b++)a[b]=new ma(V(this.ranges[b].anchor),V(this.ranges[b].head));return new la(a,this.primIndex)},somethingSelected:function(){for(var a=0;a<this.ranges.length;a++)if(!this.ranges[a].empty())return!0;return!1},contains:function(a,b){b||(b=a);for(var c=0;c<this.ranges.length;c++){var d=this.ranges[c];if(If(b,d.from())>=0&&If(a,d.to())<=0)return c}return-1}},ma.prototype={from:function(){return X(this.anchor,this.head)},to:function(){return W(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}};var Kf,Lf,Mf,Nf={left:0,right:0,top:0,bottom:0},Of=null,Pf=0,Qf=0,Rf=0,Sf=null;pf?Sf=-.53:mf?Sf=15:tf?Sf=-.7:vf&&(Sf=-1/3);var Tf=function(a){var b=a.wheelDeltaX,c=a.wheelDeltaY;return null==b&&a.detail&&a.axis==a.HORIZONTAL_AXIS&&(b=a.detail),null==c&&a.detail&&a.axis==a.VERTICAL_AXIS?c=a.detail:null==c&&(c=a.wheelDelta),{x:b,y:c}};a.wheelEventPixels=function(a){var b=Tf(a);return b.x*=Sf,b.y*=Sf,b};var Uf=new Be,Vf=null,Wf=a.changeEnd=function(a){return a.text?Hf(a.from.line+a.text.length-1,Ee(a.text).length+(1==a.text.length?a.from.ch:0)):a.to};a.prototype={constructor:a,focus:function(){window.focus(),this.display.input.focus()},setOption:function(a,b){var c=this.options,d=c[a];(c[a]!=b||"mode"==a)&&(c[a]=b,Yf.hasOwnProperty(a)&&Db(this,Yf[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"](Tc(a))},removeKeyMap:function(a){for(var b=this.state.keyMaps,c=0;c<b.length;++c)if(b[c]==a||b[c].name==a)return b.splice(c,1),!0},addOverlay:Eb(function(b,c){var d=b.token?b:a.getMode(this.options,b);if(d.startState)throw new Error("Overlays may not be stateful.");this.state.overlays.push({mode:d,modeSpec:b,opaque:c&&c.opaque}),this.state.modeGen++,Ib(this)}),removeOverlay:Eb(function(a){for(var b=this.state.overlays,c=0;c<b.length;++c){var d=b[c].modeSpec;if(d==a||"string"==typeof a&&d.name==a)return b.splice(c,1),this.state.modeGen++,void Ib(this)}}),indentLine:Eb(function(a,b,c){"string"!=typeof b&&"number"!=typeof b&&(b=null==b?this.options.smartIndent?"smart":"prev":b?"add":"subtract"),sa(this.doc,a)&&Mc(this,a,b,c)}),indentSelection:Eb(function(a){for(var b=this.doc.sel.ranges,c=-1,d=0;d<b.length;d++){var e=b[d];if(e.empty())e.head.line>c&&(Mc(this,e.head.line,a,!0),c=e.head.line,d==this.doc.sel.primIndex&&Kc(this));else{var f=e.from(),g=e.to(),h=Math.max(c,f.line);c=Math.min(this.lastLine(),g.line-(g.ch?0:1))+1;for(var i=h;c>i;++i)Mc(this,i,a);var j=this.doc.sel.ranges;0==f.ch&&b.length==j.length&&j[d].from().ch>0&&xa(this.doc,d,new ma(f,j[d].to()),Fg)}}}),getTokenAt:function(a,b){return Ed(this,a,b)},getLineTokens:function(a,b){return Ed(this,Hf(a),b,!0)},getTokenTypeAt:function(a){a=qa(this.doc,a);var b,c=Hd(this,Xd(this.doc,a.line)),d=0,e=(c.length-1)/2,f=a.ch;if(0==f)b=c[2];else for(;;){var g=d+e>>1;if((g?c[2*g-1]:0)>=f)e=g;else{if(!(c[2*g+1]<f)){b=c[2*g+2];break}d=g+1}}var h=b?b.indexOf("cm-overlay "):-1;return 0>h?b:0==h?null:b.slice(0,h-1)},getModeAt:function(b){var c=this.doc.mode;return c.innerMode?a.innerMode(c,this.getTokenAt(b).state).mode:c},getHelper:function(a,b){return this.getHelpers(a,b)[0]},getHelpers:function(a,b){var c=[];if(!cg.hasOwnProperty(b))return c;var d=cg[b],e=this.getModeAt(a);if("string"==typeof e[b])d[e[b]]&&c.push(d[e[b]]);else if(e[b])for(var f=0;f<e[b].length;f++){var g=d[e[b][f]];g&&c.push(g)}else e.helperType&&d[e.helperType]?c.push(d[e.helperType]):d[e.name]&&c.push(d[e.name]);for(var f=0;f<d._global.length;f++){var h=d._global[f];h.pred(e,this)&&-1==Fe(c,h.val)&&c.push(h.val)}return c},getStateAfter:function(a,b){var c=this.doc;return a=pa(c,null==a?c.first+c.size-1:a),Pa(this,a+1,b)},cursorCoords:function(a,b){var c,d=this.doc.sel.primary();return c=null==a?d.head:"object"==typeof a?qa(this.doc,a):a?d.from():d.to(),mb(this,c,b||"page")},charCoords:function(a,b){return lb(this,qa(this.doc,a),b||"page")},coordsChar:function(a,b){return a=kb(this,a,b||"page"),pb(this,a.left,a.top)},lineAtHeight:function(a,b){return a=kb(this,{top:a,left:0},b||"page").top,ae(this.doc,a+this.display.viewOffset)},heightAtLine:function(a,b){var c,d=!1;if("number"==typeof a){var e=this.doc.first+this.doc.size-1;a<this.doc.first?a=this.doc.first:a>e&&(a=e,d=!0),c=Xd(this.doc,a)}else c=a;return jb(this,c,{top:0,left:0},b||"page").top+(d?this.doc.height-be(c):0)},defaultTextHeight:function(){return rb(this.display)},defaultCharWidth:function(){return sb(this.display)},setGutterMarker:Eb(function(a,b,c){return Nc(this.doc,a,"gutter",function(a){var d=a.gutterMarkers||(a.gutterMarkers={});return d[b]=c,!c&&Me(d)&&(a.gutterMarkers=null),!0})}),clearGutter:Eb(function(a){var b=this,c=b.doc,d=c.first;c.iter(function(c){c.gutterMarkers&&c.gutterMarkers[a]&&(c.gutterMarkers[a]=null,Jb(b,d,"gutter"),Me(c.gutterMarkers)&&(c.gutterMarkers=null)),++d})}),lineInfo:function(a){if("number"==typeof a){if(!sa(this.doc,a))return null;var b=a;if(a=Xd(this.doc,a),!a)return null}else{var b=_d(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.viewFrom,to:this.display.viewTo}},addWidget:function(a,b,c,d,e){var f=this.display;a=mb(this,qa(this.doc,a));var g=a.bottom,h=a.left;if(b.style.position="absolute",b.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(b),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&&Hc(this,h,g,h+b.offsetWidth,g+b.offsetHeight)},triggerOnKeyDown:Eb(kc),triggerOnKeyPress:Eb(nc),triggerOnKeyUp:mc,execCommand:function(a){return fg.hasOwnProperty(a)?fg[a].call(null,this):void 0},triggerElectric:Eb(function(a){aa(this,a)}),findPosH:function(a,b,c,d){var e=1;0>b&&(e=-1,b=-b);for(var f=0,g=qa(this.doc,a);b>f&&(g=Pc(this.doc,g,e,c,d),!g.hitSide);++f);return g},moveH:Eb(function(a,b){var c=this;c.extendSelectionsBy(function(d){return c.display.shift||c.doc.extend||d.empty()?Pc(c.doc,d.head,a,b,c.options.rtlMoveVisually):0>a?d.from():d.to()},Hg)}),deleteH:Eb(function(a,b){var c=this.doc.sel,d=this.doc;c.somethingSelected()?d.replaceSelection("",null,"+delete"):Oc(this,function(c){var e=Pc(d,c.head,a,b,!1);return 0>a?{from:e,to:c.head}:{from:c.head,to:e}})}),findPosV:function(a,b,c,d){var e=1,f=d;0>b&&(e=-1,b=-b);for(var g=0,h=qa(this.doc,a);b>g;++g){var i=mb(this,h,"div");if(null==f?f=i.left:i.left=f,h=Qc(this,i,e,c),h.hitSide)break}return h},moveV:Eb(function(a,b){var c=this,d=this.doc,e=[],f=!c.display.shift&&!d.extend&&d.sel.somethingSelected();if(d.extendSelectionsBy(function(g){if(f)return 0>a?g.from():g.to();var h=mb(c,g.head,"div");null!=g.goalColumn&&(h.left=g.goalColumn),e.push(h.left);var i=Qc(c,h,a,b);return"page"==b&&g==d.sel.primary()&&Jc(c,null,lb(c,i,"div").top-h.top),i},Hg),e.length)for(var g=0;g<d.sel.ranges.length;g++)d.sel.ranges[g].goalColumn=e[g]}),findWordAt:function(a){var b=this.doc,c=Xd(b,a.line).text,d=a.ch,e=a.ch;if(c){var f=this.getHelper(a,"wordChars");(a.xRel<0||e==c.length)&&d?--d:++e;for(var g=c.charAt(d),h=Le(g,f)?function(a){return Le(a,f)}:/\s/.test(g)?function(a){return/\s/.test(a)}:function(a){return!/\s/.test(a)&&!Le(a)};d>0&&h(c.charAt(d-1));)--d;for(;e<c.length&&h(c.charAt(e));)++e}return new ma(Hf(a.line,d),Hf(a.line,e))},toggleOverwrite:function(a){(null==a||a!=this.state.overwrite)&&((this.state.overwrite=!this.state.overwrite)?Tg(this.display.cursorDiv,"CodeMirror-overwrite"):Sg(this.display.cursorDiv,"CodeMirror-overwrite"),Bg(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==Re()},scrollTo:Eb(function(a,b){(null!=a||null!=b)&&Lc(this),null!=a&&(this.curOp.scrollLeft=a),null!=b&&(this.curOp.scrollTop=b)}),getScrollInfo:function(){var a=this.display.scroller;return{left:a.scrollLeft,top:a.scrollTop,height:a.scrollHeight-Ta(this)-this.display.barHeight,width:a.scrollWidth-Ta(this)-this.display.barWidth,clientHeight:Va(this),clientWidth:Ua(this)}},scrollIntoView:Eb(function(a,b){if(null==a?(a={from:this.doc.sel.primary().head,to:null},null==b&&(b=this.options.cursorScrollMargin)):"number"==typeof a?a={from:Hf(a,0),to:null}:null==a.from&&(a={from:a,to:null}),a.to||(a.to=a.from),a.margin=b||0,null!=a.from.line)Lc(this),this.curOp.scrollToPos=a;else{var c=Ic(this,Math.min(a.from.left,a.to.left),Math.min(a.from.top,a.to.top)-a.margin,Math.max(a.from.right,a.to.right),Math.max(a.from.bottom,a.to.bottom)+a.margin);this.scrollTo(c.scrollLeft,c.scrollTop)}}),setSize:Eb(function(a,b){function c(a){return"number"==typeof a||/^\d+$/.test(String(a))?a+"px":a}var d=this;null!=a&&(d.display.wrapper.style.width=c(a)),null!=b&&(d.display.wrapper.style.height=c(b)),d.options.lineWrapping&&fb(this);var e=d.display.viewFrom;d.doc.iter(e,d.display.viewTo,function(a){if(a.widgets)for(var b=0;b<a.widgets.length;b++)if(a.widgets[b].noHScroll){Jb(d,e,"widget");break}++e}),d.curOp.forceUpdate=!0,Bg(d,"refresh",this)}),operation:function(a){return Cb(this,a)},refresh:Eb(function(){var a=this.display.cachedTextHeight;Ib(this),this.curOp.forceUpdate=!0,gb(this),this.scrollTo(this.doc.scrollLeft,this.doc.scrollTop),k(this),(null==a||Math.abs(a-rb(this.display))>.5)&&g(this),Bg(this,"refresh",this)}),swapDoc:Eb(function(a){var b=this.doc;return b.cm=null,Wd(this,a),gb(this),this.display.input.reset(),this.scrollTo(a.scrollLeft,a.scrollTop),this.curOp.forceScroll=!0,ve(this,"swapDoc",this,b),b}),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}},Ae(a);var Xf=a.defaults={},Yf=a.optionHandlers={},Zf=a.Init={toString:function(){return"CodeMirror.Init"}};Rc("value","",function(a,b){a.setValue(b)},!0),Rc("mode",null,function(a,b){a.doc.modeOption=b,c(a)},!0),Rc("indentUnit",2,c,!0),Rc("indentWithTabs",!1),Rc("smartIndent",!0),Rc("tabSize",4,function(a){d(a),gb(a),Ib(a)},!0),Rc("lineSeparator",null,function(a,b){if(a.doc.lineSep=b,b){var c=[],d=a.doc.first;a.doc.iter(function(a){for(var e=0;;){var f=a.text.indexOf(b,e);if(-1==f)break;e=f+b.length,c.push(Hf(d,f))}d++});for(var e=c.length-1;e>=0;e--)Ec(a.doc,b,c[e],Hf(c[e].line,c[e].ch+b.length))}}),Rc("specialChars",/[\t\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g,function(b,c,d){b.state.specialChars=new RegExp(c.source+(c.test(" ")?"":"| "),"g"),d!=a.Init&&b.refresh()}),Rc("specialCharPlaceholder",Ld,function(a){a.refresh()},!0),Rc("electricChars",!0),Rc("inputStyle",zf?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),Rc("rtlMoveVisually",!Bf),Rc("wholeLineUpdateBefore",!0),Rc("theme","default",function(a){h(a),i(a)},!0),Rc("keyMap","default",function(b,c,d){var e=Tc(c),f=d!=a.Init&&Tc(d);f&&f.detach&&f.detach(b,e),e.attach&&e.attach(b,f||null)}),Rc("extraKeys",null),Rc("lineWrapping",!1,e,!0),Rc("gutters",[],function(a){n(a.options),i(a)},!0),Rc("fixedGutter",!0,function(a,b){a.display.gutters.style.left=b?y(a.display)+"px":"0",a.refresh()},!0),Rc("coverGutterNextToScrollbar",!1,function(a){s(a)},!0),Rc("scrollbarStyle","native",function(a){r(a),s(a),a.display.scrollbars.setScrollTop(a.doc.scrollTop),a.display.scrollbars.setScrollLeft(a.doc.scrollLeft)},!0),Rc("lineNumbers",!1,function(a){n(a.options),i(a)},!0),Rc("firstLineNumber",1,i,!0),Rc("lineNumberFormatter",function(a){return a},i,!0),Rc("showCursorWhenSelecting",!1,Ha,!0),Rc("resetSelectionOnContextMenu",!0),Rc("lineWiseCopyCut",!0),Rc("readOnly",!1,function(a,b){"nocursor"==b?(qc(a),a.display.input.blur(),a.display.disabled=!0):(a.display.disabled=!1,b||a.display.input.reset())}),Rc("disableInput",!1,function(a,b){b||a.display.input.reset()},!0),Rc("dragDrop",!0,Qb),Rc("cursorBlinkRate",530),Rc("cursorScrollMargin",0),Rc("cursorHeight",1,Ha,!0),Rc("singleCursorHeightPerLine",!0,Ha,!0),Rc("workTime",100),Rc("workDelay",100),Rc("flattenSpans",!0,d,!0),Rc("addModeClass",!1,d,!0),Rc("pollInterval",100),Rc("undoDepth",200,function(a,b){a.doc.history.undoDepth=b}),Rc("historyEventDelay",1250),Rc("viewportMargin",10,function(a){a.refresh()},!0),Rc("maxHighlightLength",1e4,d,!0),Rc("moveInputWithCursor",!0,function(a,b){b||a.display.input.resetPosition()}),Rc("tabindex",null,function(a,b){a.display.input.getField().tabIndex=b||""}),Rc("autofocus",null);var $f=a.modes={},_f=a.mimeModes={};a.defineMode=function(b,c){a.defaults.mode||"null"==b||(a.defaults.mode=b),arguments.length>2&&(c.dependencies=Array.prototype.slice.call(arguments,2)),$f[b]=c},a.defineMIME=function(a,b){_f[a]=b},a.resolveMode=function(b){if("string"==typeof b&&_f.hasOwnProperty(b))b=_f[b];else if(b&&"string"==typeof b.name&&_f.hasOwnProperty(b.name)){var c=_f[b.name];"string"==typeof c&&(c={name:c}),b=Ie(c,b),b.name=c.name}else if("string"==typeof b&&/^[\w\-]+\/[\w\-]+\+xml$/.test(b))return a.resolveMode("application/xml");return"string"==typeof b?{name:b}:b||{name:"null"}},a.getMode=function(b,c){var c=a.resolveMode(c),d=$f[c.name];if(!d)return a.getMode(b,"text/plain");var e=d(b,c);if(ag.hasOwnProperty(c.name)){var f=ag[c.name];for(var g in f)f.hasOwnProperty(g)&&(e.hasOwnProperty(g)&&(e["_"+g]=e[g]),e[g]=f[g])}if(e.name=c.name,c.helperType&&(e.helperType=c.helperType),c.modeProps)for(var g in c.modeProps)e[g]=c.modeProps[g];return e},a.defineMode("null",function(){return{token:function(a){a.skipToEnd()}}}),a.defineMIME("text/plain","null");var ag=a.modeExtensions={};a.extendMode=function(a,b){var c=ag.hasOwnProperty(a)?ag[a]:ag[a]={};Je(b,c)},a.defineExtension=function(b,c){a.prototype[b]=c},a.defineDocExtension=function(a,b){tg.prototype[a]=b},a.defineOption=Rc;var bg=[];a.defineInitHook=function(a){bg.push(a)};var cg=a.helpers={};a.registerHelper=function(b,c,d){cg.hasOwnProperty(b)||(cg[b]=a[b]={_global:[]}),cg[b][c]=d},a.registerGlobalHelper=function(b,c,d,e){a.registerHelper(b,c,e),cg[b]._global.push({pred:d,val:e})};var dg=a.copyState=function(a,b){if(b===!0)return b;if(a.copyState)return a.copyState(b);var c={};for(var d in b){var e=b[d];e instanceof Array&&(e=e.concat([])),c[d]=e}return c},eg=a.startState=function(a,b,c){return a.startState?a.startState(b,c):!0};a.innerMode=function(a,b){for(;a.innerMode;){var c=a.innerMode(b);if(!c||c.mode==a)break;b=c.state,a=c.mode}return c||{mode:a,state:b}};var fg=a.commands={selectAll:function(a){a.setSelection(Hf(a.firstLine(),0),Hf(a.lastLine()),Fg)},singleSelection:function(a){a.setSelection(a.getCursor("anchor"),a.getCursor("head"),Fg)},killLine:function(a){Oc(a,function(b){if(b.empty()){var c=Xd(a.doc,b.head.line).text.length;return b.head.ch==c&&b.head.line<a.lastLine()?{from:b.head,to:Hf(b.head.line+1,0)}:{from:b.head,to:Hf(b.head.line,c)}}return{from:b.from(),to:b.to()}})},deleteLine:function(a){Oc(a,function(b){return{from:Hf(b.from().line,0),to:qa(a.doc,Hf(b.to().line+1,0))}})},delLineLeft:function(a){Oc(a,function(a){return{from:Hf(a.from().line,0),to:a.from()}})},delWrappedLineLeft:function(a){Oc(a,function(b){var c=a.charCoords(b.head,"div").top+5,d=a.coordsChar({left:0,top:c},"div");return{from:d,to:b.from()}})},delWrappedLineRight:function(a){Oc(a,function(b){var c=a.charCoords(b.head,"div").top+5,d=a.coordsChar({left:a.display.lineDiv.offsetWidth+100,top:c},"div");return{from:b.from(),to:d}})},undo:function(a){a.undo()},redo:function(a){a.redo()},undoSelection:function(a){a.undoSelection()},redoSelection:function(a){a.redoSelection()},goDocStart:function(a){a.extendSelection(Hf(a.firstLine(),0))},goDocEnd:function(a){a.extendSelection(Hf(a.lastLine()))},goLineStart:function(a){a.extendSelectionsBy(function(b){return df(a,b.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(a){a.extendSelectionsBy(function(b){return ff(a,b.head)},{origin:"+move",bias:1})},goLineEnd:function(a){a.extendSelectionsBy(function(b){return ef(a,b.head.line)},{origin:"+move",bias:-1})},goLineRight:function(a){a.extendSelectionsBy(function(b){var c=a.charCoords(b.head,"div").top+5;return a.coordsChar({left:a.display.lineDiv.offsetWidth+100,top:c},"div")},Hg)},goLineLeft:function(a){a.extendSelectionsBy(function(b){var c=a.charCoords(b.head,"div").top+5;return a.coordsChar({left:0,top:c},"div")},Hg)},goLineLeftSmart:function(a){a.extendSelectionsBy(function(b){var c=a.charCoords(b.head,"div").top+5,d=a.coordsChar({left:0,top:c},"div");return d.ch<a.getLine(d.line).search(/\S/)?ff(a,b.head):d},Hg)},goLineUp:function(a){a.moveV(-1,"line")},goLineDown:function(a){a.moveV(1,"line")},goPageUp:function(a){a.moveV(-1,"page")},goPageDown:function(a){a.moveV(1,"page")},goCharLeft:function(a){a.moveH(-1,"char")},goCharRight:function(a){a.moveH(1,"char")},goColumnLeft:function(a){a.moveH(-1,"column")},goColumnRight:function(a){a.moveH(1,"column")},goWordLeft:function(a){a.moveH(-1,"word")},goGroupRight:function(a){a.moveH(1,"group")},goGroupLeft:function(a){a.moveH(-1,"group")},goWordRight:function(a){a.moveH(1,"word")},delCharBefore:function(a){a.deleteH(-1,"char")},delCharAfter:function(a){a.deleteH(1,"char")},delWordBefore:function(a){a.deleteH(-1,"word")},delWordAfter:function(a){a.deleteH(1,"word")},delGroupBefore:function(a){a.deleteH(-1,"group")},delGroupAfter:function(a){a.deleteH(1,"group")},indentAuto:function(a){a.indentSelection("smart")},indentMore:function(a){a.indentSelection("add")},indentLess:function(a){a.indentSelection("subtract")},insertTab:function(a){a.replaceSelection(" ")},insertSoftTab:function(a){for(var b=[],c=a.listSelections(),d=a.options.tabSize,e=0;e<c.length;e++){var f=c[e].from(),g=Ig(a.getLine(f.line),f.ch,d);b.push(new Array(d-g%d+1).join(" "))}a.replaceSelections(b)},defaultTab:function(a){a.somethingSelected()?a.indentSelection("add"):a.execCommand("insertTab")},transposeChars:function(a){Cb(a,function(){for(var b=a.listSelections(),c=[],d=0;d<b.length;d++){var e=b[d].head,f=Xd(a.doc,e.line).text;if(f)if(e.ch==f.length&&(e=new Hf(e.line,e.ch-1)),e.ch>0)e=new Hf(e.line,e.ch+1),a.replaceRange(f.charAt(e.ch-1)+f.charAt(e.ch-2),Hf(e.line,e.ch-2),e,"+transpose");else if(e.line>a.doc.first){var g=Xd(a.doc,e.line-1).text;g&&a.replaceRange(f.charAt(0)+a.doc.lineSeparator()+g.charAt(g.length-1),Hf(e.line-1,g.length-1),Hf(e.line,1),"+transpose")}c.push(new ma(e,e))}a.setSelections(c)})},newlineAndIndent:function(a){Cb(a,function(){for(var b=a.listSelections().length,c=0;b>c;c++){var d=a.listSelections()[c];a.replaceRange(a.doc.lineSeparator(),d.anchor,d.head,"+input"),a.indentLine(d.from().line+1,null,!0),Kc(a)}})},toggleOverwrite:function(a){a.toggleOverwrite()}},gg=a.keyMap={};gg.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"},gg.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"},gg.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"},gg.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"]},gg["default"]=Af?gg.macDefault:gg.pcDefault,a.normalizeKeyMap=function(a){var b={};for(var c in a)if(a.hasOwnProperty(c)){var d=a[c];if(/^(name|fallthrough|(de|at)tach)$/.test(c))continue;if("..."==d){delete a[c];continue}for(var e=Ge(c.split(" "),Sc),f=0;f<e.length;f++){var g,h;f==e.length-1?(h=e.join(" "),g=d):(h=e.slice(0,f+1).join(" "),g="...");var i=b[h];if(i){if(i!=g)throw new Error("Inconsistent bindings for "+h)}else b[h]=g}delete a[c]}for(var j in b)a[j]=b[j];return a};var hg=a.lookupKey=function(a,b,c,d){b=Tc(b);var e=b.call?b.call(a,d):b[a];if(e===!1)return"nothing";if("..."===e)return"multi";if(null!=e&&c(e))return"handled";if(b.fallthrough){if("[object Array]"!=Object.prototype.toString.call(b.fallthrough))return hg(a,b.fallthrough,c,d);for(var f=0;f<b.fallthrough.length;f++){var g=hg(a,b.fallthrough[f],c,d);if(g)return g}}},ig=a.isModifierKey=function(a){var b="string"==typeof a?a:$g[a.keyCode];return"Ctrl"==b||"Alt"==b||"Shift"==b||"Mod"==b},jg=a.keyName=function(a,b){if(uf&&34==a.keyCode&&a["char"])return!1;var c=$g[a.keyCode],d=c;return null==d||a.altGraphKey?!1:(a.altKey&&"Alt"!=c&&(d="Alt-"+d),(Df?a.metaKey:a.ctrlKey)&&"Ctrl"!=c&&(d="Ctrl-"+d),(Df?a.ctrlKey:a.metaKey)&&"Cmd"!=c&&(d="Cmd-"+d),!b&&a.shiftKey&&"Shift"!=c&&(d="Shift-"+d),d)};a.fromTextArea=function(b,c){function d(){b.value=j.getValue()}if(c=c?Je(c):{},c.value=b.value,!c.tabindex&&b.tabIndex&&(c.tabindex=b.tabIndex),!c.placeholder&&b.placeholder&&(c.placeholder=b.placeholder),null==c.autofocus){var e=Re();c.autofocus=e==b||null!=b.getAttribute("autofocus")&&e==document.body}if(b.form&&(zg(b.form,"submit",d),!c.leaveSubmitMethodAlone)){var f=b.form,g=f.submit;try{var h=f.submit=function(){d(),f.submit=g,f.submit(),f.submit=h}}catch(i){}}c.finishInit=function(a){a.save=d,a.getTextArea=function(){return b},a.toTextArea=function(){a.toTextArea=isNaN,d(),b.parentNode.removeChild(a.getWrapperElement()),b.style.display="",b.form&&(Ag(b.form,"submit",d),"function"==typeof b.form.submit&&(b.form.submit=g))}},b.style.display="none";var j=a(function(a){b.parentNode.insertBefore(a,b.nextSibling)},c);return j};var kg=a.StringStream=function(a,b){this.pos=this.start=0,this.string=a,this.tabSize=b||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0};kg.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){return this.pos<this.string.length?this.string.charAt(this.pos++):void 0},eat:function(a){var b=this.string.charAt(this.pos);if("string"==typeof a)var c=b==a;else var c=b&&(a.test?a.test(b):a(b));return c?(++this.pos,b):void 0},eatWhile:function(a){for(var b=this.pos;this.eat(a););return this.pos>b},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.lastColumnPos<this.start&&(this.lastColumnValue=Ig(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?Ig(this.string,this.lineStart,this.tabSize):0)},indentation:function(){return Ig(this.string,null,this.tabSize)-(this.lineStart?Ig(this.string,this.lineStart,this.tabSize):0)},match:function(a,b,c){if("string"!=typeof a){var d=this.string.slice(this.pos).match(a);return d&&d.index>0?null:(d&&b!==!1&&(this.pos+=d[0].length),d)}var e=function(a){return c?a.toLowerCase():a},f=this.string.substr(this.pos,a.length);return e(f)==e(a)?(b!==!1&&(this.pos+=a.length),!0):void 0},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(a,b){this.lineStart+=a;try{return b()}finally{this.lineStart-=a}}};var lg=0,mg=a.TextMarker=function(a,b){this.lines=[],this.type=b,this.doc=a,this.id=++lg};Ae(mg),mg.prototype.clear=function(){if(!this.explicitlyCleared){var a=this.doc.cm,b=a&&!a.curOp;if(b&&tb(a),ze(this,"clear")){var c=this.find();c&&ve(this,"clear",c.from,c.to)}for(var d=null,e=null,f=0;f<this.lines.length;++f){var g=this.lines[f],h=$c(g.markedSpans,this);a&&!this.collapsed?Jb(a,_d(g),"text"):a&&(null!=h.to&&(e=_d(g)),null!=h.from&&(d=_d(g))),g.markedSpans=_c(g.markedSpans,h),null==h.from&&this.collapsed&&!ud(this.doc,g)&&a&&$d(g,rb(a.display))}if(a&&this.collapsed&&!a.options.lineWrapping)for(var f=0;f<this.lines.length;++f){var i=qd(this.lines[f]),j=l(i);j>a.display.maxLineLength&&(a.display.maxLine=i,a.display.maxLineLength=j,a.display.maxLineChanged=!0)}null!=d&&a&&this.collapsed&&Ib(a,d,e+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,a&&Ea(a.doc)),a&&ve(a,"markerCleared",a,this),b&&vb(a),this.parent&&this.parent.clear()}},mg.prototype.find=function(a,b){null==a&&"bookmark"==this.type&&(a=1);for(var c,d,e=0;e<this.lines.length;++e){var f=this.lines[e],g=$c(f.markedSpans,this);if(null!=g.from&&(c=Hf(b?f:_d(f),g.from),-1==a))return c;if(null!=g.to&&(d=Hf(b?f:_d(f),g.to),1==a))return d}return c&&{from:c,to:d}},mg.prototype.changed=function(){var a=this.find(-1,!0),b=this,c=this.doc.cm;a&&c&&Cb(c,function(){var d=a.line,e=_d(a.line),f=$a(c,e);if(f&&(eb(f),c.curOp.selectionChanged=c.curOp.forceUpdate=!0),c.curOp.updateMaxLine=!0,!ud(b.doc,d)&&null!=b.height){var g=b.height;b.height=null;var h=xd(b)-g;h&&$d(d,d.height+h)}})},mg.prototype.attachLine=function(a){if(!this.lines.length&&this.doc.cm){var b=this.doc.cm.curOp;b.maybeHiddenMarkers&&-1!=Fe(b.maybeHiddenMarkers,this)||(b.maybeUnhiddenMarkers||(b.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(a)},mg.prototype.detachLine=function(a){if(this.lines.splice(Fe(this.lines,a),1),!this.lines.length&&this.doc.cm){var b=this.doc.cm.curOp;(b.maybeHiddenMarkers||(b.maybeHiddenMarkers=[])).push(this)}};var lg=0,ng=a.SharedTextMarker=function(a,b){this.markers=a,this.primary=b;for(var c=0;c<a.length;++c)a[c].parent=this};Ae(ng),ng.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var a=0;a<this.markers.length;++a)this.markers[a].clear();ve(this,"clear")}},ng.prototype.find=function(a,b){return this.primary.find(a,b)};var og=a.LineWidget=function(a,b,c){if(c)for(var d in c)c.hasOwnProperty(d)&&(this[d]=c[d]);this.doc=a,this.node=b};Ae(og),og.prototype.clear=function(){var a=this.doc.cm,b=this.line.widgets,c=this.line,d=_d(c);if(null!=d&&b){for(var e=0;e<b.length;++e)b[e]==this&&b.splice(e--,1);b.length||(c.widgets=null);var f=xd(this);$d(c,Math.max(0,c.height-f)),a&&Cb(a,function(){wd(a,c,-f),Jb(a,d,"widget")})}},og.prototype.changed=function(){var a=this.height,b=this.doc.cm,c=this.line;this.height=null;var d=xd(this)-a;d&&($d(c,c.height+d),b&&Cb(b,function(){b.curOp.forceUpdate=!0,wd(b,c,d)}))};var pg=a.Line=function(a,b,c){this.text=a,id(this,b),this.height=c?c(this):1};Ae(pg),pg.prototype.lineNo=function(){return _d(this)};var qg={},rg={};Td.prototype={chunkSize:function(){return this.lines.length},removeInner:function(a,b){for(var c=a,d=a+b;d>c;++c){var e=this.lines[c];this.height-=e.height,Ad(e),ve(e,"delete")}this.lines.splice(a,b)},collapse:function(a){a.push.apply(a,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;d<b.length;++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}},Ud.prototype={chunkSize:function(){return this.size},removeInner:function(a,b){this.size-=b;for(var c=0;c<this.children.length;++c){var d=this.children[c],e=d.chunkSize();if(e>a){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&&(this.children.length>1||!(this.children[0]instanceof Td))){var h=[];this.collapse(h),this.children=[new Td(h)],this.children[0].parent=this}},collapse:function(a){for(var b=0;b<this.children.length;++b)this.children[b].collapse(a)},insertInner:function(a,b,c){this.size+=b.length,this.height+=c;for(var d=0;d<this.children.length;++d){var e=this.children[d],f=e.chunkSize();if(f>=a){if(e.insertInner(a,b,c),e.lines&&e.lines.length>50){for(;e.lines.length>50;){var g=e.lines.splice(e.lines.length-25,25),h=new Td(g);e.height-=h.height,this.children.splice(d+1,0,h),h.parent=this}this.maybeSpill()}break}a-=f}},maybeSpill:function(){if(!(this.children.length<=10)){var a=this;do{var b=a.children.splice(a.children.length-5,5),c=new Ud(b);if(a.parent){a.size-=c.size,a.height-=c.height;var d=Fe(a.parent.children,a);a.parent.children.splice(d+1,0,c)}else{var e=new Ud(a.children);e.parent=a,a.children=[e,c],a=e}c.parent=a.parent}while(a.children.length>10);a.parent.maybeSpill()}},iterN:function(a,b,c){for(var d=0;d<this.children.length;++d){var e=this.children[d],f=e.chunkSize();if(f>a){var g=Math.min(b,f-a);if(e.iterN(a,g,c))return!0;if(0==(b-=g))break;a=0}else a-=f}}};var sg=0,tg=a.Doc=function(a,b,c,d){if(!(this instanceof tg))return new tg(a,b,c,d);null==c&&(c=0),Ud.call(this,[new Td([new pg("",null)])]),this.first=c,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.frontier=c;var e=Hf(c,0);this.sel=oa(e),this.history=new de(null),this.id=++sg,this.modeOption=b,this.lineSep=d,"string"==typeof a&&(a=this.splitLines(a)),Sd(this,{from:e,to:e,text:a}),Ba(this,oa(e),Fg)};tg.prototype=Ie(Ud.prototype,{constructor:tg,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;d<b.length;++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=Zd(this,this.first,this.first+this.size);return a===!1?b:b.join(a||this.lineSeparator())},setValue:Fb(function(a){var b=Hf(this.first,0),c=this.first+this.size-1;yc(this,{from:b,to:Hf(c,Xd(this,c).text.length),text:this.splitLines(a),origin:"setValue",full:!0},!0),Ba(this,oa(b))}),replaceRange:function(a,b,c,d){b=qa(this,b),c=c?qa(this,c):b,Ec(this,a,b,c,d)},getRange:function(a,b,c){var d=Yd(this,qa(this,a),qa(this,b));return c===!1?d:d.join(c||this.lineSeparator())},getLine:function(a){var b=this.getLineHandle(a);return b&&b.text},getLineHandle:function(a){return sa(this,a)?Xd(this,a):void 0},getLineNumber:function(a){return _d(a)},getLineHandleVisualStart:function(a){return"number"==typeof a&&(a=Xd(this,a)),qd(a)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(a){return qa(this,a)},getCursor:function(a){var b,c=this.sel.primary();return b=null==a||"head"==a?c.head:"anchor"==a?c.anchor:"end"==a||"to"==a||a===!1?c.to():c.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Fb(function(a,b,c){ya(this,qa(this,"number"==typeof a?Hf(a,b||0):a),null,c)}),setSelection:Fb(function(a,b,c){ya(this,qa(this,a),qa(this,b||a),c)}),extendSelection:Fb(function(a,b,c){va(this,qa(this,a),b&&qa(this,b),c)}),extendSelections:Fb(function(a,b){wa(this,ta(this,a,b))}),extendSelectionsBy:Fb(function(a,b){wa(this,Ge(this.sel.ranges,a),b)}),setSelections:Fb(function(a,b,c){if(a.length){for(var d=0,e=[];d<a.length;d++)e[d]=new ma(qa(this,a[d].anchor),qa(this,a[d].head));null==b&&(b=Math.min(a.length-1,this.sel.primIndex)),Ba(this,na(e,b),c)}}),addSelection:Fb(function(a,b,c){var d=this.sel.ranges.slice(0);d.push(new ma(qa(this,a),qa(this,b||a))),Ba(this,na(d,d.length-1),c)}),getSelection:function(a){for(var b,c=this.sel.ranges,d=0;d<c.length;d++){var e=Yd(this,c[d].from(),c[d].to());b=b?b.concat(e):e}return a===!1?b:b.join(a||this.lineSeparator())},getSelections:function(a){for(var b=[],c=this.sel.ranges,d=0;d<c.length;d++){var e=Yd(this,c[d].from(),c[d].to());a!==!1&&(e=e.join(a||this.lineSeparator())),b[d]=e}return b},replaceSelection:function(a,b,c){for(var d=[],e=0;e<this.sel.ranges.length;e++)d[e]=a;this.replaceSelections(d,b,c||"+input")},replaceSelections:Fb(function(a,b,c){for(var d=[],e=this.sel,f=0;f<e.ranges.length;f++){var g=e.ranges[f];d[f]={from:g.from(),to:g.to(),text:this.splitLines(a[f]),origin:c}}for(var h=b&&"end"!=b&&wc(this,d,b),f=d.length-1;f>=0;f--)yc(this,d[f]);h?Aa(this,h):this.cm&&Kc(this.cm)}),undo:Fb(function(){Ac(this,"undo")}),redo:Fb(function(){Ac(this,"redo")}),undoSelection:Fb(function(){Ac(this,"undo",!0)}),redoSelection:Fb(function(){Ac(this,"redo",!0)}),setExtending:function(a){this.extend=a},getExtending:function(){return this.extend},historySize:function(){for(var a=this.history,b=0,c=0,d=0;d<a.done.length;d++)a.done[d].ranges||++b;for(var d=0;d<a.undone.length;d++)a.undone[d].ranges||++c;return{undo:b,redo:c}},clearHistory:function(){this.history=new de(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(a){return a&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(a){return this.history.generation==(a||this.cleanGeneration)},getHistory:function(){return{done:oe(this.history.done),undone:oe(this.history.undone)}},setHistory:function(a){var b=this.history=new de(this.history.maxGeneration);b.done=oe(a.done.slice(0),null,!0),b.undone=oe(a.undone.slice(0),null,!0)},addLineClass:Fb(function(a,b,c){return Nc(this,a,"gutter"==b?"gutter":"class",function(a){var d="text"==b?"textClass":"background"==b?"bgClass":"gutter"==b?"gutterClass":"wrapClass";if(a[d]){if(Se(c).test(a[d]))return!1;a[d]+=" "+c}else a[d]=c;return!0})}),removeLineClass:Fb(function(a,b,c){return Nc(this,a,"gutter"==b?"gutter":"class",function(a){var d="text"==b?"textClass":"background"==b?"bgClass":"gutter"==b?"gutterClass":"wrapClass",e=a[d];if(!e)return!1;if(null==c)a[d]=null;else{var f=e.match(Se(c));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:Fb(function(a,b,c){return yd(this,a,b,c)}),removeLineWidget:function(a){a.clear()},markText:function(a,b,c){return Uc(this,qa(this,a),qa(this,b),c,"range")},setBookmark:function(a,b){var c={replacedWith:b&&(null==b.nodeType?b.widget:b),insertLeft:b&&b.insertLeft,clearWhenEmpty:!1,shared:b&&b.shared,handleMouseEvents:b&&b.handleMouseEvents};return a=qa(this,a),Uc(this,a,a,c,"bookmark")},findMarksAt:function(a){a=qa(this,a);var b=[],c=Xd(this,a.line).markedSpans;if(c)for(var d=0;d<c.length;++d){var e=c[d];(null==e.from||e.from<=a.ch)&&(null==e.to||e.to>=a.ch)&&b.push(e.marker.parent||e.marker)}return b},findMarks:function(a,b,c){a=qa(this,a),b=qa(this,b);var d=[],e=a.line;return this.iter(a.line,b.line+1,function(f){var g=f.markedSpans;if(g)for(var h=0;h<g.length;h++){var i=g[h];e==a.line&&a.ch>i.to||null==i.from&&e!=a.line||e==b.line&&i.from>b.ch||c&&!c(i.marker)||d.push(i.marker.parent||i.marker)}++e}),d},getAllMarks:function(){var a=[];return this.iter(function(b){var c=b.markedSpans;if(c)for(var d=0;d<c.length;++d)null!=c[d].from&&a.push(c[d].marker)}),a},posFromIndex:function(a){var b,c=this.first;return this.iter(function(d){var e=d.text.length+1;return e>a?(b=a,!0):(a-=e,void++c)}),qa(this,Hf(c,b))},indexFromPos:function(a){a=qa(this,a);var b=a.ch;return a.line<this.first||a.ch<0?0:(this.iter(this.first,a.line,function(a){b+=a.text.length+1}),b)},copy:function(a){var b=new tg(Zd(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep);return b.scrollTop=this.scrollTop,b.scrollLeft=this.scrollLeft,b.sel=this.sel,b.extend=!1,a&&(b.history.undoDepth=this.history.undoDepth,b.setHistory(this.getHistory())),b},linkedDoc:function(a){a||(a={});var b=this.first,c=this.first+this.size;null!=a.from&&a.from>b&&(b=a.from),null!=a.to&&a.to<c&&(c=a.to);var d=new tg(Zd(this,b,c),a.mode||this.modeOption,b,this.lineSep);return a.sharedHist&&(d.history=this.history),(this.linked||(this.linked=[])).push({doc:d,sharedHist:a.sharedHist}),d.linked=[{doc:this,isParent:!0,sharedHist:a.sharedHist}],Xc(d,Wc(this)),d},unlinkDoc:function(b){if(b instanceof a&&(b=b.doc),this.linked)for(var c=0;c<this.linked.length;++c){var d=this.linked[c];if(d.doc==b){this.linked.splice(c,1),b.unlinkDoc(this),Yc(Wc(this));break}}if(b.history==this.history){var e=[b.id];Vd(b,function(a){e.push(a.id)},!0),b.history=new de(null),b.history.done=oe(this.history.done,e),b.history.undone=oe(this.history.undone,e)}},iterLinkedDocs:function(a){Vd(this,a)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(a){return this.lineSep?a.split(this.lineSep):Wg(a)},lineSeparator:function(){return this.lineSep||"\n"}}),tg.prototype.eachLine=tg.prototype.iter;var ug="iter insert remove copy getEditor constructor".split(" ");for(var vg in tg.prototype)tg.prototype.hasOwnProperty(vg)&&Fe(ug,vg)<0&&(a.prototype[vg]=function(a){return function(){return a.apply(this.doc,arguments)}}(tg.prototype[vg]));Ae(tg);var wg=a.e_preventDefault=function(a){a.preventDefault?a.preventDefault():a.returnValue=!1},xg=a.e_stopPropagation=function(a){a.stopPropagation?a.stopPropagation():a.cancelBubble=!0},yg=a.e_stop=function(a){wg(a),xg(a)},zg=a.on=function(a,b,c){if(a.addEventListener)a.addEventListener(b,c,!1);else if(a.attachEvent)a.attachEvent("on"+b,c);else{var d=a._handlers||(a._handlers={}),e=d[b]||(d[b]=[]);e.push(c)}},Ag=a.off=function(a,b,c){if(a.removeEventListener)a.removeEventListener(b,c,!1);else if(a.detachEvent)a.detachEvent("on"+b,c);else{var d=a._handlers&&a._handlers[b];if(!d)return;for(var e=0;e<d.length;++e)if(d[e]==c){d.splice(e,1);break}}},Bg=a.signal=function(a,b){var c=a._handlers&&a._handlers[b];if(c)for(var d=Array.prototype.slice.call(arguments,2),e=0;e<c.length;++e)c[e].apply(null,d)},Cg=null,Dg=30,Eg=a.Pass={toString:function(){return"CodeMirror.Pass"}},Fg={scroll:!1},Gg={origin:"*mouse"},Hg={origin:"+move"};Be.prototype.set=function(a,b){clearTimeout(this.id),this.id=setTimeout(b,a)};var Ig=a.countColumn=function(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;;){var h=a.indexOf(" ",f);if(0>h||h>=b)return g+(b-f);g+=h-f,g+=c-g%c,f=h+1}},Jg=[""],Kg=function(a){a.select()};yf?Kg=function(a){a.selectionStart=0,a.selectionEnd=a.value.length}:pf&&(Kg=function(a){try{a.select()}catch(b){}});var Lg,Mg=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Ng=a.isWordChar=function(a){return/\w/.test(a)||a>""&&(a.toUpperCase()!=a.toLowerCase()||Mg.test(a))},Og=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;Lg=document.createRange?function(a,b,c,d){var e=document.createRange();return e.setEnd(d||a,c),e.setStart(a,b),e}:function(a,b,c){var d=document.body.createTextRange();try{d.moveToElementText(a.parentNode)}catch(e){return d}return d.collapse(!0),d.moveEnd("character",c),d.moveStart("character",b),d};var Pg=a.contains=function(a,b){if(3==b.nodeType&&(b=b.parentNode),a.contains)return a.contains(b);do if(11==b.nodeType&&(b=b.host),b==a)return!0;while(b=b.parentNode)};pf&&11>qf&&(Re=function(){try{return document.activeElement}catch(a){return document.body}});var Qg,Rg,Sg=a.rmClass=function(a,b){var c=a.className,d=Se(b).exec(c);if(d){var e=c.slice(d.index+d[0].length);a.className=c.slice(0,d.index)+(e?d[1]+e:"")}},Tg=a.addClass=function(a,b){var c=a.className;Se(b).test(c)||(a.className+=(c?" ":"")+b)},Ug=!1,Vg=function(){if(pf&&9>qf)return!1;var a=Oe("div");return"draggable"in a||"dragDrop"in a}(),Wg=a.splitLines=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/)},Xg=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},Yg=function(){var a=Oe("div");return"oncopy"in a?!0:(a.setAttribute("oncopy","return;"),"function"==typeof a.oncopy)}(),Zg=null,$g={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:";",61:"=",91:"Mod",92:"Mod",93:"Mod",107:"=",109:"-",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"};a.keyNames=$g,function(){for(var a=0;10>a;a++)$g[a+48]=$g[a+96]=String(a);for(var a=65;90>=a;a++)$g[a]=String.fromCharCode(a);for(var a=1;12>=a;a++)$g[a+111]=$g[a+63235]="F"+a}();var _g,ah=function(){function a(a){return 247>=a?c.charAt(a):a>=1424&&1524>=a?"R":a>=1536&&1773>=a?d.charAt(a-1536):a>=1774&&2220>=a?"r":a>=8192&&8203>=a?"w":8204==a?"b":"L"}function b(a,b,c){this.level=a,this.from=b,this.to=c}var c="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",d="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm",e=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,f=/[stwN]/,g=/[LRr]/,h=/[Lb1n]/,i=/[1n]/,j="L";return function(c){if(!e.test(c))return!1;for(var d,k=c.length,l=[],m=0;k>m;++m)l.push(d=a(c.charCodeAt(m)));for(var m=0,n=j;k>m;++m){var d=l[m];"m"==d?l[m]=n:n=d}for(var m=0,o=j;k>m;++m){var d=l[m];"1"==d&&"r"==o?l[m]="n":g.test(d)&&(o=d,"r"==d&&(l[m]="R"))}for(var m=1,n=l[0];k-1>m;++m){var d=l[m];"+"==d&&"1"==n&&"1"==l[m+1]?l[m]="1":","!=d||n!=l[m+1]||"1"!=n&&"n"!=n||(l[m]=n),n=d}for(var m=0;k>m;++m){var d=l[m];if(","==d)l[m]="N";else if("%"==d){for(var p=m+1;k>p&&"%"==l[p];++p);for(var q=m&&"!"==l[m-1]||k>p&&"1"==l[p]?"1":"N",r=m;p>r;++r)l[r]=q;m=p-1}}for(var m=0,o=j;k>m;++m){var d=l[m];"L"==o&&"1"==d?l[m]="L":g.test(d)&&(o=d)}for(var m=0;k>m;++m)if(f.test(l[m])){for(var p=m+1;k>p&&f.test(l[p]);++p);for(var s="L"==(m?l[m-1]:j),t="L"==(k>p?l[p]:j),q=s||t?"L":"R",r=m;p>r;++r)l[r]=q;m=p-1}for(var u,v=[],m=0;k>m;)if(h.test(l[m])){var w=m;for(++m;k>m&&h.test(l[m]);++m);v.push(new b(0,w,m))}else{var x=m,y=v.length;for(++m;k>m&&"L"!=l[m];++m);for(var r=x;m>r;)if(i.test(l[r])){r>x&&v.splice(y,0,new b(1,x,r));var z=r;for(++r;m>r&&i.test(l[r]);++r);v.splice(y,0,new b(2,z,r)),x=r}else++r;m>x&&v.splice(y,0,new b(1,x,m))}return 1==v[0].level&&(u=c.match(/^\s+/))&&(v[0].from=u[0].length,v.unshift(new b(0,0,u[0].length))),1==Ee(v).level&&(u=c.match(/\s+$/))&&(Ee(v).to-=u[0].length,v.push(new b(0,k-u[0].length,k))),2==v[0].level&&v.unshift(new b(1,v[0].to,v[0].to)),v[0].level!=Ee(v).level&&v.push(new b(v[0].level,k,k)),v}}();return a.version="5.6.0",a});
AnonSec - 2021 | Recode By D7net