1!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 z(a,c){if(!(this instanceof z))return new z(a,c);this.options=c=c||{};for(var d in Xc)c.hasOwnProperty(d)||(c[d]=Xc[d]);M(c);var e=c.value;"string"==typeof e&&(e=new pe(e,c.mode)),this.doc=e;var f=this.display=new A(a,e);f.wrapper.CodeMirror=this,J(this),H(this),c.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),c.autofocus&&!r&&Pb(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,draggingText:!1,highlight:new lf},b&&setTimeout(wf(Ob,this,!0),20),Sb(this);var g=this;yb(this,function(){g.curOp.forceUpdate=!0,te(g,e),c.autofocus&&!r||Hf()==f.input?setTimeout(wf(sc,g),20):tc(g);for(var a in Yc)Yc.hasOwnProperty(a)&&Yc[a](g,c[a],$c);for(var b=0;b<cd.length;++b)cd[b](g)})}function A(a,b){var d=this,e=d.input=Cf("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none");h?e.style.width="1000px":e.setAttribute("wrap","off"),q&&(e.style.border="1px solid black"),e.setAttribute("autocorrect","off"),e.setAttribute("autocapitalize","off"),e.setAttribute("spellcheck","false"),d.inputDiv=Cf("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;"),d.scrollbarH=Cf("div",[Cf("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar"),d.scrollbarV=Cf("div",[Cf("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),d.scrollbarFiller=Cf("div",null,"CodeMirror-scrollbar-filler"),d.gutterFiller=Cf("div",null,"CodeMirror-gutter-filler"),d.lineDiv=Cf("div",null,"CodeMirror-code"),d.selectionDiv=Cf("div",null,null,"position: relative; z-index: 1"),d.cursorDiv=Cf("div",null,"CodeMirror-cursors"),d.measure=Cf("div",null,"CodeMirror-measure"),d.lineMeasure=Cf("div",null,"CodeMirror-measure"),d.lineSpace=Cf("div",[d.measure,d.lineMeasure,d.selectionDiv,d.cursorDiv,d.lineDiv],null,"position: relative; outline: none"),d.mover=Cf("div",[Cf("div",[d.lineSpace],"CodeMirror-lines")],null,"position: relative"),d.sizer=Cf("div",[d.mover],"CodeMirror-sizer"),d.heightForcer=Cf("div",null,null,"position: absolute; height: "+ff+"px; width: 1px;"),d.gutters=Cf("div",null,"CodeMirror-gutters"),d.lineGutter=null,d.scroller=Cf("div",[d.sizer,d.heightForcer,d.gutters],"CodeMirror-scroll"),d.scroller.setAttribute("tabIndex","-1"),d.wrapper=Cf("div",[d.inputDiv,d.scrollbarH,d.scrollbarV,d.scrollbarFiller,d.gutterFiller,d.scroller],"CodeMirror"),c&&(d.gutters.style.zIndex=-1,d.scroller.style.paddingRight=0),q&&(e.style.width="0px"),h||(d.scroller.draggable=!0),m&&(d.inputDiv.style.height="1px",d.inputDiv.style.position="absolute"),c&&(d.scrollbarH.style.minHeight=d.scrollbarV.style.minWidth="18px"),a.appendChild?a.appendChild(d.wrapper):a(d.wrapper),d.viewFrom=d.viewTo=b.first,d.view=[],d.externalMeasured=null,d.viewOffset=0,d.lastSizeC=0,d.updateLineNumbers=null,d.lineNumWidth=d.lineNumInnerWidth=d.lineNumChars=null,d.prevInput="",d.alignWidgets=!1,d.pollingFast=!1,d.poll=new lf,d.cachedCharWidth=d.cachedTextHeight=d.cachedPaddingH=null,d.inaccurateSelection=!1,d.maxLine=null,d.maxLineLength=0,d.maxLineChanged=!1,d.wheelDX=d.wheelDY=d.wheelStartX=d.wheelStartY=null,d.shift=!1}function B(a){a.doc.mode=z.getMode(a.options,a.doc.modeOption),C(a)}function C(a){a.doc.iter(function(a){a.stateAfter&&(a.stateAfter=null),a.styles&&(a.styles=null)}),a.doc.frontier=a.doc.first,Ra(a,100),a.state.modeGen++,a.curOp&&Eb(a)}function D(a){a.options.lineWrapping?(a.display.wrapper.className+=" CodeMirror-wrap",a.display.sizer.style.minWidth=""):(a.display.wrapper.className=a.display.wrapper.className.replace(" CodeMirror-wrap",""),L(a)),F(a),Eb(a),hb(a),setTimeout(function(){O(a)},100)}function E(a){var b=tb(a.display),c=a.options.lineWrapping,d=c&&Math.max(5,a.display.scroller.clientWidth/ub(a.display)-3);return function(e){if(Pd(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 F(a){var b=a.doc,c=E(a);b.iter(function(a){var b=c(a);b!=a.height&&xe(a,b)})}function G(a){var b=hd[a.options.keyMap],c=b.style;a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-keymap-\S+/g,"")+(c?" cm-keymap-"+c:"")}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-"),hb(a)}function I(a){J(a),Eb(a),setTimeout(function(){Q(a)},20)}function J(a){var b=a.display.gutters,c=a.options.gutters;Ef(b);for(var d=0;d<c.length;++d){var e=c[d],f=b.appendChild(Cf("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";var g=b.offsetWidth;a.display.sizer.style.marginLeft=g+"px",d&&(a.display.scrollbarH.style.left=a.options.fixedGutter?g+"px":0)}function K(a){if(0==a.height)return 0;for(var c,b=a.text.length,d=a;c=Id(d);){var e=c.find(0,!0);d=e.from.line,b+=e.from.ch-e.to.ch}for(d=a;c=Jd(d);){var e=c.find(0,!0);b-=d.text.length-e.from.ch,d=e.to.line,b+=d.text.length-e.to.ch}return b}function L(a){var b=a.display,c=a.doc;b.maxLine=ue(c,c.first),b.maxLineLength=K(b.maxLine),b.maxLineChanged=!0,c.iter(function(a){var c=K(a);c>b.maxLineLength&&(b.maxLineLength=c,b.maxLine=a)})}function M(a){var b=sf(a.gutters,"CodeMirror-linenumbers");b==-1&&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 N(a){var b=a.display.scroller;return{clientHeight:b.clientHeight,barHeight:a.display.scrollbarV.clientHeight,scrollWidth:b.scrollWidth,clientWidth:b.clientWidth,barWidth:a.display.scrollbarH.clientWidth,docHeight:Math.round(a.doc.height+Wa(a.display))}}function O(a,b){b||(b=N(a));var c=a.display,d=b.docHeight+ff,e=b.scrollWidth>b.clientWidth,f=d>b.clientHeight;if(f?(c.scrollbarV.style.display="block",c.scrollbarV.style.bottom=e?Kf(c.measure)+"px":"0",c.scrollbarV.firstChild.style.height=Math.max(0,d-b.clientHeight+(b.barHeight||c.scrollbarV.clientHeight))+"px"):(c.scrollbarV.style.display="",c.scrollbarV.firstChild.style.height="0"),e?(c.scrollbarH.style.display="block",c.scrollbarH.style.right=f?Kf(c.measure)+"px":"0",c.scrollbarH.firstChild.style.width=b.scrollWidth-b.clientWidth+(b.barWidth||c.scrollbarH.clientWidth)+"px"):(c.scrollbarH.style.display="",c.scrollbarH.firstChild.style.width="0"),e&&f?(c.scrollbarFiller.style.display="block",c.scrollbarFiller.style.height=c.scrollbarFiller.style.width=Kf(c.measure)+"px"):c.scrollbarFiller.style.display="",e&&a.options.coverGutterNextToScrollbar&&a.options.fixedGutter?(c.gutterFiller.style.display="block",c.gutterFiller.style.height=Kf(c.measure)+"px",c.gutterFiller.style.width=c.gutters.offsetWidth+"px"):c.gutterFiller.style.display="",n&&0===Kf(c.measure)){c.scrollbarV.style.minWidth=c.scrollbarH.style.minHeight=o?"18px":"12px";var g=function(b){Ve(b)!=c.scrollbarV&&Ve(b)!=c.scrollbarH&&zb(a,Vb)(b)};Xe(c.scrollbarV,"mousedown",g),Xe(c.scrollbarH,"mousedown",g)}}function P(a,b,c){var d=c&&null!=c.top?c.top:a.scroller.scrollTop;d=Math.floor(d-Va(a));var e=c&&null!=c.bottom?c.bottom:d+a.wrapper.clientHeight,f=ze(b,d),g=ze(b,e);if(c&&c.ensure){var h=c.ensure.from.line,i=c.ensure.to.line;if(h<f)return{from:h,to:ze(b,Ae(ue(b,h))+a.wrapper.clientHeight)};
1if(Math.min(i,b.lastLine())>=g)return{from:ze(b,Ae(ue(b,i))-a.wrapper.clientHeight),to:i}}return{from:f,to:g}}function Q(a){var b=a.display,c=b.view;if(b.alignWidgets||b.gutters.firstChild&&a.options.fixedGutter){for(var d=T(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 R(a){if(!a.options.lineNumbers)return!1;var b=a.doc,c=S(a.options,b.first+b.size-1),d=a.display;if(c.length!=d.lineNumChars){var e=d.measure.appendChild(Cf("div",[Cf("div",c)],"CodeMirror-linenumber CodeMirror-gutter-elt")),f=e.firstChild.offsetWidth,g=e.offsetWidth-f;d.lineGutter.style.width="",d.lineNumInnerWidth=Math.max(f,d.lineGutter.offsetWidth-g),d.lineNumWidth=d.lineNumInnerWidth+g,d.lineNumChars=d.lineNumInnerWidth?c.length:-1,d.lineGutter.style.width=d.lineNumWidth+"px";var h=d.gutters.offsetWidth;return d.scrollbarH.style.left=a.options.fixedGutter?h+"px":0,d.sizer.style.marginLeft=h+"px",!0}return!1}function S(a,b){return String(a.lineNumberFormatter(b+a.firstLineNumber))}function T(a){return a.scroller.getBoundingClientRect().left-a.sizer.getBoundingClientRect().left}function U(a,b,c){for(var f,d=a.display.viewFrom,e=a.display.viewTo,g=P(a.display,a.doc,b),h=!0;;h=!1){var i=a.display.scroller.clientWidth;if(!V(a,g,c))break;f=!0,a.display.maxLineChanged&&!a.options.lineWrapping&&W(a);var j=N(a);if(Na(a),X(a,j),O(a,j),h&&a.options.lineWrapping&&i!=a.display.scroller.clientWidth)c=!0;else if(c=!1,b&&null!=b.top&&(b={top:Math.min(j.docHeight-ff-j.clientHeight,b.top)}),g=P(a.display,a.doc,b),g.from>=a.display.viewFrom&&g.to<=a.display.viewTo)break}return a.display.updateLineNumbers=null,f&&(af(a,"update",a),a.display.viewFrom==d&&a.display.viewTo==e||af(a,"viewportChange",a,a.display.viewFrom,a.display.viewTo)),f}function V(a,b,c){var d=a.display,e=a.doc;
1if(!d.wrapper.offsetWidth)return void Gb(a);if(!(!c&&b.from>=d.viewFrom&&b.to<=d.viewTo&&0==Kb(a))){R(a)&&Gb(a);var f=$(a),g=e.first+e.size,h=Math.max(b.from-a.options.viewportMargin,e.first),i=Math.min(g,b.to+a.options.viewportMargin);d.viewFrom<h&&h-d.viewFrom<20&&(h=Math.max(e.first,d.viewFrom)),d.viewTo>i&&d.viewTo-i<20&&(i=Math.min(g,d.viewTo)),y&&(h=Nd(a.doc,h),i=Od(a.doc,i));var j=h!=d.viewFrom||i!=d.viewTo||d.lastSizeC!=d.wrapper.clientHeight;Jb(a,h,i),d.viewOffset=Ae(ue(a.doc,d.viewFrom)),a.display.mover.style.top=d.viewOffset+"px";var k=Kb(a);if(j||0!=k||c){var l=Hf();return k>4&&(d.lineDiv.style.display="none"),_(a,d.updateLineNumbers,f),k>4&&(d.lineDiv.style.display=""),l&&Hf()!=l&&l.offsetHeight&&l.focus(),Ef(d.cursorDiv),Ef(d.selectionDiv),j&&(d.lastSizeC=d.wrapper.clientHeight,Ra(a,400)),Y(a),!0}}}function W(a){var b=a.display,c=_a(a,b.maxLine,b.maxLine.text.length).left;b.maxLineChanged=!1;var d=Math.max(0,c+3),e=Math.max(0,b.sizer.offsetLeft+d+ff-b.scroller.clientWidth);b.sizer.style.minWidth=d+"px",e<a.doc.scrollLeft&&fc(a,Math.min(b.scroller.scrollLeft,e),!0)}function X(a,b){a.display.sizer.style.minHeight=a.display.heightForcer.style.top=b.docHeight+"px",a.display.gutters.style.height=Math.max(b.docHeight,b.clientHeight-ff)+"px"}function Y(a){for(var b=a.display,d=b.lineDiv.offsetTop,e=0;e<b.view.length;e++){var g,f=b.view[e];if(!f.hidden){if(c){var h=f.node.offsetTop+f.node.offsetHeight;g=h-d,d=h}else{var i=f.node.getBoundingClientRect();g=i.bottom-i.top}var j=f.line.height-g;if(g<2&&(g=tb(b)),(j>.001||j<-.001)&&(xe(f.line,g),Z(f.line),f.rest))for(var k=0;k<f.rest.length;k++)Z(f.rest[k])}}}function Z(a){if(a.widgets)for(var b=0;b<a.widgets.length;++b)a.widgets[b].height=a.widgets[b].node.offsetHeight}function $(a){for(var b=a.display,c={},d={},e=b.gutters.firstChild,f=0;e;e=e.nextSibling,++f)c[a.options.gutters[f]]=e.offsetLeft,d[a.options.gutters[f]]=e.offsetWidth;return{fixedPos:T(b),gutterTotalWidth:b.gutters.offsetWidth,gutterLeft:c,gutterWidth:d,wrapperWidth:b.wrapper.clientWidth}}function _(a,b,c){function i(b){var c=b.nextSibling;return h&&s&&a.display.currentWheelTarget==b?b.style.display="none":b.parentNode.removeChild(b),c}for(var d=a.display,e=a.options.lineNumbers,f=d.lineDiv,g=f.firstChild,j=d.view,k=d.viewFrom,l=0;l<j.length;l++){var m=j[l];if(m.hidden);else if(m.node){for(;g!=m.node;)g=i(g);var o=e&&null!=b&&b<=k&&m.lineNumber;m.changes&&(sf(m.changes,"gutter")>-1&&(o=!1),aa(a,m,k,c)),o&&(Ef(m.lineNumber),m.lineNumber.appendChild(document.createTextNode(S(a.options,k)))),g=m.node.nextSibling}else{var n=ia(a,m,k,c);f.insertBefore(n,g)}k+=m.size}for(;g;)g=i(g)}function aa(a,b,c,d){for(var e=0;e<b.changes.length;e++){var f=b.changes[e];"text"==f?ea(a,b):"gutter"==f?ga(a,b,c,d):"class"==f?fa(b):"widget"==f&&ha(b,d)}b.changes=null}function ba(a){return a.node==a.text&&(a.node=Cf("div",null,null,"position: relative"),a.text.parentNode&&a.text.parentNode.replaceChild(a.node,a.text),a.node.appendChild(a.text),c&&(a.node.style.zIndex=2)),a.node}function ca(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=ba(a);a.background=c.insertBefore(Cf("div",null,b),c.firstChild)}}function da(a,b){var c=a.display.externalMeasured;return c&&c.line==b.line?(a.display.externalMeasured=null,b.measure=c.measure,c.built):de(a,b)}function ea(a,b){var c=b.text.className,d=da(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,fa(b)):c&&(b.text.className=c)}function fa(a){ca(a),a.line.wrapClass?ba(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 ga(a,b,c,d){b.gutter&&(b.node.removeChild(b.gutter),b.gutter=null);var e=b.line.gutterMarkers;if(a.options.lineNumbers||e){var f=ba(b),g=b.gutter=f.insertBefore(Cf("div",null,"CodeMirror-gutter-wrapper","position: absolute; left: "+(a.options.fixedGutter?d.fixedPos:-d.gutterTotalWidth)+"px"),b.text);if(!a.options.lineNumbers||e&&e["CodeMirror-linenumbers"]||(b.lineNumber=g.appendChild(Cf("div",S(a.options,c),"CodeMirror-linenumber C
1odeMirror-gutter-elt","left: "+d.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+a.display.lineNumInnerWidth+"px"))),e)for(var h=0;h<a.options.gutters.length;++h){var i=a.options.gutters[h],j=e.hasOwnProperty(i)&&e[i];j&&g.appendChild(Cf("div",[j],"CodeMirror-gutter-elt","left: "+d.gutterLeft[i]+"px; width: "+d.gutterWidth[i]+"px"))}}}function ha(a,b){a.alignable&&(a.alignable=null);for(var d,c=a.node.firstChild;c;c=d){var d=c.nextSibling;"CodeMirror-linewidget"==c.className&&a.node.removeChild(c)}ja(a,b)}function ia(a,b,c,d){var e=da(a,b);return b.text=b.node=e.pre,e.bgClass&&(b.bgClass=e.bgClass),e.textClass&&(b.textClass=e.textClass),fa(b),ga(a,b,c,d),ja(b,d),b.node}function ja(a,b){if(ka(a.line,a,b,!0),a.rest)for(var c=0;c<a.rest.length;c++)ka(a.rest[c],a,b,!1)}function ka(a,b,c,d){if(a.widgets)for(var e=ba(b),f=0,g=a.widgets;f<g.length;++f){var h=g[f],i=Cf("div",[h.node],"CodeMirror-linewidget");h.handleMouseEvents||(i.ignoreEvents=!0),la(h,i,b,c),d&&h.above?e.insertBefore(i,b.gutter||b.text):e.appendChild(i),af(h,"redraw")}}function la(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 oa(a){return ma(a.line,a.ch)}function pa(a,b){return na(a,b)<0?b:a}function qa(a,b){return na(a,b)<0?a:b}function ra(a,b){this.ranges=a,this.primIndex=b}function sa(a,b){this.anchor=a,this.head=b}function ta(a,b){var c=a[b];a.sort(function(a,b){return na(a.from(),b.from())}),b=sf(a,c);for(var d=1;d<a.length;d++){var e=a[d],f=a[d-1];if(na(f.to(),e.from())>=0){var g=qa(f.from(),e.from()),h=pa(f.to(),e.to()),i=f.empty()?e.from()==e.head:f.from()==f.head;d<=b&&--b,a.splice(--d,2,new sa(i?h:g,i?g:h))}}return new ra(a,b)}function ua(a,b){return new ra([new sa(a,b||a)],0)}function va(a,b){return Math.max(a.first,Math.min(b,a.first+a.size-1))}function wa(a,b){if(b.line<a.first)return ma(a.first,0);var c=a.first+a.size-1;return b.line>c?ma(c,ue(a,c).text.length):xa(b,ue(a,b.line).text.length)}function xa(a,b){var c=a.ch;return null==c||c>b?ma(a.line,b):c<0?ma(a.line,0):a}function ya(a,b){return b>=a.first&&b<a.first+a.size}function za(a,b){for(var c=[],d=0;d<b.length;d++)c[d]=wa(a,b[d]);return c}function Aa(a,b,c,d){if(a.cm&&a.cm.display.shift||a.extend){var e=b.anchor;if(d){var f=na(c,e)<0;f!=na(d,e)<0?(e=c,c=d):f!=na(c,d)<0&&(c=d)}return new sa(e,c)}return new sa(d||c,c)}function Ba(a,b,c,d){Ha(a,new ra([Aa(a,a.sel.primary(),b,c)],0),d)}function Ca(a,b,c){for(var d=[],e=0;e<a.sel.ranges.length;e++)d[e]=Aa(a,a.sel.ranges[e],b[e],null);var f=ta(d,a.sel.primIndex);Ha(a,f,c)}function Da(a,b,c,d){var e=a.sel.ranges.slice(0);e[b]=c,Ha(a,ta(e,a.sel.primIndex),d)}function Ea(a,b,c,d){Ha(a,ua(b,c),d)}function Fa(a,b){var c={ranges:b.ranges,update:function(b){this.ranges=[];for(var c=0;c<b.length;c++)this.ranges[c]=new sa(wa(a,b[c].anchor),wa(a,b[c].head))}};return Ze(a,"beforeSelectionChange",a,c),a.cm&&Ze(a.cm,"beforeSelectionChange",a.cm,c),c.ranges!=b.ranges?ta(c.ranges,c.ranges.length-1):b}function Ga(a,b,c){var d=a.history.done,e=qf(d);e&&e.ranges?(d[d.length-1]=b,Ia(a,b,c)):Ha(a,b,c)}function Ha(a,b,c){Ia(a,b,c),Ie(a,a.sel,a.cm?a.cm.curOp.id:NaN,c)}function Ia(a,b,c){(df(a,"beforeSelectionChange")||a.cm&&df(a.cm,"beforeSelectionChange"))&&(b=Fa(a,b));var d=na(b.primary().head,a.sel.primary().head)<0?-1:1;Ja(a,La(a,b,d,!0)),c&&c.scroll===!1||!a.cm||Pc(a.cm)}function Ja(a,b){b.equals(a.sel)||(a.sel=b,a.cm&&(a.cm.curOp.updateInput=a.cm.curOp.selectionChanged=a.cm.curOp.cursorActivity=!0),af(a,"cursorActivity",a))}function Ka(a){Ja(a,La(a,a.sel,null,!1),hf)}function La(a,b,c,d){for(var e,f=0;f<b.ranges.length;f++){var g=b.ranges[f],h=Ma(a,g.anchor,c,d),i=Ma(a,g.head,c,d);(e||h!=g.anchor||i!=g.head)&&(e||(e=b.ranges.slice(0,f)),e[f]=new sa(h,i))}return e?ta(e,b.primIndex):b}function Ma(a,b,c,d){var e=!1,f=b,g=c||1;a.cantEdit=!1;a:for(;;){var h=ue(a,f.line);if(h.markedSpans)for(var i=0;i<h.markedSpans.length;++i){var j=h.markedSpans[i],k=j.marker;
1if((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&&(Ze(k,"beforeCursorEnter"),k.explicitlyCleared)){if(h.markedSpans){--i;continue}break}if(!k.atomic)continue;var l=k.find(g<0?-1:1);if(0==na(l,f)&&(l.ch+=g,l.ch<0?l=l.line>a.first?wa(a,ma(l.line-1)):null:l.ch>h.text.length&&(l=l.line<a.first+a.size-1?ma(l.line+1,0):null),!l)){if(e)return d?(a.cantEdit=!0,ma(a.first,0)):Ma(a,b,c,!0);e=!0,l=b,g=-g}f=l;continue a}}return f}}function Na(a){for(var b=a.display,c=a.doc,d=document.createDocumentFragment(),e=document.createDocumentFragment(),f=0;f<c.sel.ranges.length;f++){var g=c.sel.ranges[f],h=g.empty();(h||a.options.showCursorWhenSelecting)&&Oa(a,g,d),h||Pa(a,g,e)}if(a.options.moveInputWithCursor){var i=nb(a,c.sel.primary().head,"div"),j=b.wrapper.getBoundingClientRect(),k=b.lineDiv.getBoundingClientRect(),l=Math.max(0,Math.min(b.wrapper.clientHeight-10,i.top+k.top-j.top)),m=Math.max(0,Math.min(b.wrapper.clientWidth-10,i.left+k.left-j.left));b.inputDiv.style.top=l+"px",b.inputDiv.style.left=m+"px"}Ff(b.cursorDiv,d),Ff(b.selectionDiv,e)}function Oa(a,b,c){var d=nb(a,b.head,"div"),e=c.appendChild(Cf("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(Cf("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 Pa(a,b,c){function j(a,b,c,d){b<0&&(b=0),f.appendChild(Cf("div",null,"CodeMirror-selected","position: absolute; left: "+a+"px; top: "+b+"px; width: "+(null==c?i-a:c)+"px; height: "+(d-b)+"px"))}function k(b,c,d){function m(c,d){return mb(a,ma(b,c),"div",f,d)}var k,l,f=ue(e,b),g=f.text.length;return Tf(Be(f),c||0,null==d?g:d,function(a,b,e){var n,o,p,f=m(a,"left");if(a==b)n=f,o=p=f.left;else{if(n=m(b-1,"right"),"rtl"==e){var q=f;f=n,n=q}o=f.left,p=n.right}null==c&&0==a&&(o=h),n.top-f.top>3&&(j(o,f.top,null,f.bottom),o=h,f.bottom<n.top&&j(o,f.bottom,null,n.top)),null==d&&b==g&&(p=i),(!k||f.top<k.top||f.top==k.top&&f.left<k.left)&&(k=f),(!l||n.bottom>l.bottom||n.bottom==l.bottom&&n.right>l.right)&&(l=n),o<h+1&&(o=h),j(o,n.top,p-o,n.bottom)}),{start:k,end:l}}var d=a.display,e=a.doc,f=document.createDocumentFragment(),g=Xa(a.display),h=g.left,i=d.lineSpace.offsetWidth-g.right,l=b.from(),m=b.to();if(l.line==m.line)k(l.line,l.ch,m.ch);else{var n=ue(e,l.line),o=ue(e,m.line),p=Ld(n)==Ld(o),q=k(l.line,l.ch,p?n.text.length+1:null).end,r=k(m.line,p?0:null,m.ch).start;p&&(q.top<r.top-2?(j(q.right,q.top,null,q.bottom),j(h,r.top,r.left,r.bottom)):j(q.right,q.top,r.left-q.right,q.bottom)),q.bottom<r.top&&j(h,q.bottom,null,r.top)}c.appendChild(f)}function Qa(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))}}function Ra(a,b){a.doc.mode.startState&&a.doc.frontier<a.display.viewTo&&a.state.highlight.set(b,wf(Sa,a))}function Sa(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=ed(b.mode,Ua(a,b.frontier));yb(a,function(){b.iter(b.frontier,Math.min(b.first+b.size,a.display.viewTo+500),function(e){if(b.frontier>=a.display.viewFrom){var f=e.styles;e.styles=Zd(a,e,d,!0);for(var g=!f||f.length!=e.styles.length,h=0;!g&&h<f.length;++h)g=f[h]!=e.styles[h];g&&Fb(a,b.frontier,"text"),e.stateAfter=ed(b.mode,d)}else _d(a,e.text,d),e.stateAfter=b.frontier%5==0?ed(b.mode,d):null;if(++b.frontier,+new Date>c)return Ra(a,a.options.workDelay),!0})})}}function Ta(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=ue(f,h-1);if(i.stateAfter&&(!c||h<=f.frontier))return h;var j=mf(i.text,null,a.options.tabSize);(null==e||d>j)&&(e=h-1,d=j)}return e}function Ua(a,b,c){var d=a.doc,e=a.display;if(!d.mode.startState)return!0;var f=Ta(a,b,c),g=f>d.first&&ue(d,f-1).stateAfter;return g=g?ed(d.mode,g):fd(d.mode),d.iter(f,b,function(c){_d(a,c.text,g);var h=f==b-1||f%5==0||f>=e.viewFrom&&f<e.viewTo;c.stateAfter=h?ed(d.mode,g):null,++f}),c&&(d.frontier=f),g}function Va(a){return a.lineSpace.offsetTop}function Wa(a){return a.mover.offsetHeight-a.lineSpace.offsetHeight}function Xa(a){if(a.cachedPaddingH)return a.cachedPaddingH;var b=Ff(a.measure,Cf("pre","x")),c=window.getComputedStyle?window.getComputedStyle(b):b.currentStyle;return a.cachedPaddingH={left:parseInt(c.paddingLeft),right:parseInt(c.paddingRight)}}function Ya(a,b,c){var d=a.options.lineWrapping,e=d&&a.display.scroller.clientWidth;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 Za(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(ye(a.rest[d])>c)return{map:a.measure.maps[d],cache:a.measure.caches[d],before:!0}}function $a(a,b){b=Ld(b);var c=ye(b),d=a.display.externalMeasured=new Cb(a.doc,b,c);d.lineN=c;var e=d.built=de(a,d);return d.text=e.pre,Ff(a.display.lineMeasure,e.pre),d}function _a(a,b,c,d){return cb(a,bb(a,b),c,d)}function ab(a,b){if(b>=a.display.viewFrom&&b<a.display.viewTo)return a.display.view[Hb(a,b)];var c=a.display.externalMeasured;return c&&b>=c.lineN&&b<c.lineN+c.size?c:void 0}function bb(a,b){var c=ye(b),d=ab(a,c);d&&!d.text?d=null:d&&d.changes&&aa(a,d,c,$(a)),d||(d=$a(a,b));var e=Za(d,b,c);return{line:b,view:d,rect:null,map:e.map,cache:e.cache,before:e.before,hasHeights:!1}}function cb(a,b,c,d){b.before&&(c=-1);var f,e=c+(d||"");return b.cache.hasOwnProperty(e)?f=b.cache[e]:(b.rect||(b.rect=b.view.text.getBoundingClientRect()),b.hasHeights||(Ya(a,b.view,b.rect),b.hasHeights=!0),f=eb(a,b,c,d),f.bogus||(b.cache[e]=f)),{left:f.left,right:f.right,top:f.top,bottom:f.bottom}}function eb(a,b,c,e){for(var h,i,j,k,f=b.map,l=0;l<f.length;l+=3){var m=f[l],n=f[l+1];if(c<m?(i=0,j=1,k="left"):c<n?(i=c-m,j=i+1):(l==f.length-3||c==n&&f[l+3]>c)&&(j=n-m,i=j-1,c>=n&&(k="right")),null!=i){if(h=f[l+2],m==n&&e==(h.insertLeft?"left"
1:"right")&&(k=e),"left"==e&&0==i)for(;l&&f[l-2]==f[l-3]&&f[l-1].insertLeft;)h=f[(l-=3)+2],k="left";if("right"==e&&i==n-m)for(;l<f.length-3&&f[l+3]==f[l+4]&&!f[l+5].insertLeft;)h=f[(l+=3)+2],k="right";break}}var o;if(3==h.nodeType){for(;i&&Bf(b.line.text.charAt(m+i));)--i;for(;m+j<n&&Bf(b.line.text.charAt(m+j));)++j;if(d&&0==i&&j==n-m)o=h.parentNode.getBoundingClientRect();else if(g&&a.options.lineWrapping){var p=Df(h,i,j).getClientRects();o=p.length?p["right"==e?p.length-1:0]:db}else o=Df(h,i,j).getBoundingClientRect()}else{i>0&&(k=e="right");var p;o=a.options.lineWrapping&&(p=h.getClientRects()).length>1?p["right"==e?p.length-1:0]:h.getBoundingClientRect()}if(d&&!i&&(!o||!o.left&&!o.right)){var q=h.parentNode.getClientRects()[0];o=q?{left:q.left,right:q.left+ub(a.display),top:q.top,bottom:q.bottom}:db}for(var r,s=(o.bottom+o.top)/2-b.rect.top,t=b.view.measure.heights,l=0;l<t.length-1&&!(s<t[l]);l++);r=l?t[l-1]:0,s=t[l];var u={left:("right"==k?o.right:o.left)-b.rect.left,right:("left"==k?o.left:o.right)-b.rect.left,top:r,bottom:s};return o.left||o.right||(u.bogus=!0),u}function fb(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 gb(a){a.display.externalMeasure=null,Ef(a.display.lineMeasure);for(var b=0;b<a.display.view.length;b++)fb(a.display.view[b])}function hb(a){gb(a),a.display.cachedCharWidth=a.display.cachedTextHeight=a.display.cachedPaddingH=null,a.options.lineWrapping||(a.display.maxLineChanged=!0),a.display.lineNumChars=null}function ib(){return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function jb(){return window.pageYOffset||(document.documentElement||document.body).scrollTop}function kb(a,b,c,d){if(b.widgets)for(var e=0;e<b.widgets.length;++e)if(b.widgets[e].above){var f=Td(b.widgets[e]);c.top+=f,c.bottom+=f}if("line"==d)return c;d||(d="local");var g=Ae(b);if("local"==d?g+=Va(a.display):g-=a.display.viewOffset,"page"==d||"window"==d){var h=a.display.lineSpace.getBoundingClientRect();g+=h.top+("window"==d?0:jb());var i=h.left+("window"==d?0:ib());c.left+=i,c.right+=i}return c.top+=g,c.bottom+=g,c}function lb(a,b,c){if("div"==c)return b;var d=b.left,e=b.top;if("page"==c)d-=ib(),e-=jb();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 mb(a,b,c,d,e){return d||(d=ue(a.doc,b.line)),kb(a,d,_a(a,d,b.ch,e),c)}function nb(a,b,c,d,e){function f(b,f){var g=cb(a,e,b,f?"right":"left");return f?g.left=g.right:g.right=g.left,kb(a,d,g,c)}function g(a,b){var c=h[b],d=c.level%2;return a==Uf(c)&&b&&c.level<h[b-1].level?(c=h[--b],a=Vf(c)-(c.level%2?0:1),d=!0):a==Vf(c)&&b<h.length-1&&c.level<h[b+1].level&&(c=h[++b],a=Uf(c)-c.level%2,d=!1),d&&a==c.to&&a>c.from?f(a-1):f(a,d)}d=d||ue(a.doc,b.line),e||(e=bb(a,d));var h=Be(d),i=b.ch;if(!h)return f(i);var j=ag(h,i),k=g(i,j);return null!=_f&&(k.other=g(i,_f)),k}function ob(a,b){var c=0,b=wa(a.doc,b);a.options.lineWrapping||(c=ub(a.display)*b.ch);var d=ue(a.doc,b.line),e=Ae(d)+Va(a.display);return{left:c,right:c,top:e,bottom:e+d.height}}function pb(a,b,c,d){var e=ma(a,b);return e.xRel=d,c&&(e.outside=!0),e}function qb(a,b,c){var d=a.doc;if(c+=a.display.viewOffset,c<0)return pb(d.first,0,!0,-1);var e=ze(d,c),f=d.first+d.size-1;if(e>f)return pb(d.first+d.size-1,ue(d,f).text.length,!0,1);b<0&&(b=0);for(var g=ue(d,e);;){var h=rb(a,g,e,b,c),i=Jd(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=ye(g=j.to.line)}}function rb(a,b,c,d,e){function j(d){var e=nb(a,ma(c,d),"line",b,i);return g=!0,f>e.bottom?e.left-h:f<e.top?e.left+h:(g=!1,e.left)}var f=e-Ae(b),g=!1,h=2*a.display.wrapper.clientWidth,i=bb(a,b),k=Be(b),l=b.text.length,m=Wf(b),n=Xf(b),o=j(m),p=g,q=j(n),r=g;if(d>q)return pb(c,n,r,1);for(;;){if(k?n==m||n==cg(b,m,1):n-m<=1){for(var s=d<o||d-o<=q-d?m:n,t=d-(s==m?o:q);Bf(b.text.charAt(s));)++s;var u=pb(c,s,s==m?p:r,t<-1?-1:t>1?1:0);return u}var v=Math.ceil(l/2),w=m+v;if(k){w=m;for(var x=0;x<v;++x)w=cg(b,w,1)}var y=j(w);y>d?(n=w,q=y,(r=g)&&(q+=1e3),l=v):(m=w,o=y,p=g,l-=v)}}
1function tb(a){if(null!=a.cachedTextHeight)return a.cachedTextHeight;if(null==sb){sb=Cf("pre");for(var b=0;b<49;++b)sb.appendChild(document.createTextNode("x")),sb.appendChild(Cf("br"));sb.appendChild(document.createTextNode("x"))}Ff(a.measure,sb);var c=sb.offsetHeight/50;return c>3&&(a.cachedTextHeight=c),Ef(a.measure),c||1}function ub(a){if(null!=a.cachedCharWidth)return a.cachedCharWidth;var b=Cf("span","xxxxxxxxxx"),c=Cf("pre",[b]);Ff(a.measure,c);var d=b.getBoundingClientRect(),e=(d.right-d.left)/10;return e>2&&(a.cachedCharWidth=e),e||10}function wb(a){a.curOp={viewChanged:!1,startHeight:a.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivity:!1,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,id:++vb},_e++||($e=[])}function xb(a){var b=a.curOp,c=a.doc,d=a.display;if(a.curOp=null,b.updateMaxLine&&L(a),b.viewChanged||b.forceUpdate||null!=b.scrollTop||b.scrollToPos&&(b.scrollToPos.from.line<d.viewFrom||b.scrollToPos.to.line>=d.viewTo)||d.maxLineChanged&&a.options.lineWrapping){var e=U(a,{top:b.scrollTop,ensure:b.scrollToPos},b.forceUpdate);a.display.scroller.offsetHeight&&(a.doc.scrollTop=a.display.scroller.scrollTop)}if(!e&&b.selectionChanged&&Na(a),e||b.startHeight==a.doc.height||O(a),null!=b.scrollTop&&d.scroller.scrollTop!=b.scrollTop){var f=Math.max(0,Math.min(d.scroller.scrollHeight-d.scroller.clientHeight,b.scrollTop));d.scroller.scrollTop=d.scrollbarV.scrollTop=c.scrollTop=f}if(null!=b.scrollLeft&&d.scroller.scrollLeft!=b.scrollLeft){var g=Math.max(0,Math.min(d.scroller.scrollWidth-d.scroller.clientWidth,b.scrollLeft));d.scroller.scrollLeft=d.scrollbarH.scrollLeft=c.scrollLeft=g,Q(a)}if(b.scrollToPos){var h=Lc(a,wa(a.doc,b.scrollToPos.from),wa(a.doc,b.scrollToPos.to),b.scrollToPos.margin);b.scrollToPos.isCursor&&a.state.focused&&Kc(a,h)}b.selectionChanged&&Qa(a),a.state.focused&&b.updateInput&&Ob(a,b.typing);var i=b.maybeHiddenMarkers,j=b.maybeUnhiddenMarkers;if(i)for(var k=0;k<i.length;++k)i[k].lines.length||Ze(i[k],"hide");if(j)for(var k=0;k<j.length;++k)j[k].lines.length&&Ze(j[k],"unhide");var l;if(--_e||(l=$e,$e=null),b.changeObjs){for(var k=0;k<b.changeObjs.length;k++)Ze(a,"change",a,b.changeObjs[k]);Ze(a,"changes",a,b.changeObjs)}if(b.cursorActivity&&Ze(a,"cursorActivity",a),l)for(var k=0;k<l.length;++k)l[k]()}function yb(a,b){if(a.curOp)return b();wb(a);try{return b()}finally{xb(a)}}function zb(a,b){return function(){if(a.curOp)return b.apply(a,arguments);wb(a);try{return b.apply(a,arguments)}finally{xb(a)}}}function Ab(a){return function(){if(this.curOp)return a.apply(this,arguments);wb(this);try{return a.apply(this,arguments)}finally{xb(this)}}}function Bb(a){return function(){var b=this.cm;if(!b||b.curOp)return a.apply(this,arguments);wb(b);try{return a.apply(this,arguments)}finally{xb(b)}}}function Cb(a,b,c){this.line=b,this.rest=Md(b),this.size=this.rest?ye(qf(this.rest))-c+1:1,this.node=this.text=null,this.hidden=Pd(a,b)}function Db(a,b,c){for(var e,d=[],f=b;f<c;f=e){var g=new Cb(a.doc,ue(a.doc,f),f);e=f+g.size,d.push(g)}return d}function Eb(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), 2a.curOp.viewChanged=!0,b>=e.viewTo)y&&Nd(a.doc,b)<e.viewTo&&Gb(a);else if(c<=e.viewFrom)y&&Od(a.doc,c+d)>e.viewFrom?Gb(a):(e.viewFrom+=d,e.viewTo+=d);else if(b<=e.viewFrom&&c>=e.viewTo)Gb(a);else if(b<=e.viewFrom){var f=Ib(a,c,c+d,1);f?(e.view=e.view.slice(f.index),e.viewFrom=f.lineN,e.viewTo+=d):Gb(a)}else if(c>=e.viewTo){var f=Ib(a,b,b,-1);f?(e.view=e.view.slice(0,f.index),e.viewTo=f.lineN):Gb(a)}else{var g=Ib(a,b,b,-1),h=Ib(a,c,c+d,1);g&&h?(e.view=e.view.slice(0,g.index).concat(Db(a,g.lineN,h.lineN)).concat(e.view.slice(h.index)),e.viewTo+=d):Gb(a)}var i=e.externalMeasured;i&&(c<i.lineN?i.lineN+=d:b<i.lineN+i.size&&(e.externalMeasured=null))}function Fb(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[Hb(a,b)];if(null!=f.node){var g=f.changes||(f.changes=[]);sf(g,c)==-1&&g.push(c)}}}
2function Gb(a){a.display.viewFrom=a.display.viewTo=a.doc.first,a.display.view=[],a.display.viewOffset=0}function Hb(a,b){if(b>=a.display.viewTo)return null;if(b-=a.display.viewFrom,b<0)return null;for(var c=a.display.view,d=0;d<c.length;d++)if(b-=c[d].size,b<0)return d}function Ib(a,b,c,d){var f,e=Hb(a,b),g=a.display.view;if(!y)return{index:e,lineN:c};for(var h=0,i=a.display.viewFrom;h<e;h++)i+=g[h].size;if(i!=b){if(d>0){if(e==g.length-1)return null;f=i+g[e].size-b,e++}else f=i-b;b+=f,c+=f}for(;Nd(a.doc,c)!=c;){if(e==(d<0?0:g.length-1))return null;c+=d*g[e-(d<0?1:0)].size,e+=d}return{index:e,lineN:c}}function Jb(a,b,c){var d=a.display,e=d.view;0==e.length||b>=d.viewTo||c<=d.viewFrom?(d.view=Db(a,b,c),d.viewFrom=b):(d.viewFrom>b?d.view=Db(a,b,d.viewFrom).concat(d.view):d.viewFrom<b&&(d.view=d.view.slice(Hb(a,b))),d.viewFrom=b,d.viewTo<c?d.view=d.view.concat(Db(a,d.viewTo,c)):d.viewTo>c&&(d.view=d.view.slice(0,Hb(a,c)))),d.viewTo=c}function Kb(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 Lb(a){a.display.pollingFast||a.display.poll.set(a.options.pollInterval,function(){Nb(a),a.state.focused&&Lb(a)})}function Mb(a){function c(){var d=Nb(a);d||b?(a.display.pollingFast=!1,Lb(a)):(b=!0,a.display.poll.set(60,c))}var b=!1;a.display.pollingFast=!0,a.display.poll.set(20,c)}function Nb(a){var b=a.display.input,c=a.display.prevInput,e=a.doc;if(!a.state.focused||Qf(b)||Rb(a)||a.options.disableInput)return!1;var f=b.value;if(f==c&&!a.somethingSelected())return!1;if(g&&!d&&a.display.inputHasSelection===f)return Ob(a),!1;var h=!a.curOp;h&&wb(a),a.display.shift=!1;for(var i=0,j=Math.min(c.length,f.length);i<j&&c.charCodeAt(i)==f.charCodeAt(i);)++i;for(var k=f.slice(i),l=Pf(k),m=a.state.pasteIncoming&&l.length>1&&e.sel.ranges.length==l.length,n=e.sel.ranges.length-1;n>=0;n--){var o=e.sel.ranges[n],p=o.from(),q=o.to();i<c.length?p=ma(p.line,p.ch-(c.length-i)):a.state.overwrite&&o.empty()&&!a.state.pasteIncoming&&(q=ma(q.line,Math.min(ue(e,q.line).text.length,q.ch+qf(l).length)));var r=a.curOp.updateInput,s={from:p,to:q,text:m?[l[n]]:l,origin:a.state.pasteIncoming?"paste":a.state.cutIncoming?"cut":"+input"};if(Dc(a.doc,s),af(a,"inputRead",a,s),k&&!a.state.pasteIncoming&&a.options.electricChars&&a.options.smartIndent&&o.head.ch<100&&(!n||e.sel.ranges[n-1].head.line!=o.head.line)){var t=a.getModeAt(o.head).electricChars;if(t)for(var u=0;u<t.length;u++)if(k.indexOf(t.charAt(u))>-1){Rc(a,o.head.line,"smart");break}}}return Pc(a),a.curOp.updateInput=r,a.curOp.typing=!0,f.length>1e3||f.indexOf("\n")>-1?b.value=a.display.prevInput="":a.display.prevInput=f,h&&xb(a),a.state.pasteIncoming=a.state.cutIncoming=!1,!0}function Ob(a,b){var c,e,f=a.doc;if(a.somethingSelected()){a.display.prevInput="";var h=f.sel.primary();c=Rf&&(h.to().line-h.from().line>100||(e=a.getSelection()).length>1e3);var i=c?"-":e||a.getSelection();a.display.input.value=i,a.state.focused&&rf(a.display.input),g&&!d&&(a.display.inputHasSelection=i)}else b||(a.display.prevInput=a.display.input.value="",g&&!d&&(a.display.inputHasSelection=null));a.display.inaccurateSelection=c}function Pb(a){"nocursor"==a.options.readOnly||r&&Hf()==a.display.input||a.display.input.focus()}function Qb(a){a.state.focused||(Pb(a),sc(a))}function Rb(a){return a.options.readOnly||a.doc.cantEdit}function Sb(a){function e(){a.state.focused&&setTimeout(wf(Pb,a),0)}function h(){null==f&&(f=setTimeout(function(){f=null,c.cachedCharWidth=c.cachedTextHeight=c.cachedPaddingH=Jf=null,a.setSize()},100))}function i(){Gf(document.body,c.wrapper)?setTimeout(i,5e3):Ye(window,"resize",h)}function j(b){cf(a,b)||Ue(b)}function k(b){c.inaccurateSelection&&(c.prevInput="",c.inaccurateSelection=!1,c.input.value=a.getSelection(),rf(c.input)),"cut"==b.type&&(a.state.cutIncoming=!0)}var c=a.display;Xe(c.scroller,"mousedown",zb(a,Vb)),b?Xe(c.scroller,"dblclick",zb(a,function(b){if(!cf(a,b)){var c=Ub(a,b);if(c&&!ac(a,b)&&!Tb(a.display,b)){Re(b);var d=Wc(a.doc,c);Ba(a.doc,d.anchor,d.head)}}})):Xe(c.scroller,"dblclick",function(b){cf(a,b)||Re(b)}),Xe(c.lineSpace,"selectstart",function(a){Tb(c,a)||Re(a)}),w||Xe(c.scroller,"contextmenu",function(b){vc(a,b)}),Xe(c.scroller,"scroll",function(){c.scroller.clientHeight&&(ec(a,c.scroller.scrollTop),fc(a,c.scroller.scrollLeft,!0),Ze(a,"scroll",a))}),Xe(c.scrollbarV,"scroll",function(){c.scroller.clientHeight&&ec(a,c.scrollbarV.scrollTop)}),Xe(c.scrollbarH,"scroll",function(){c.scroller.clientHeight&&fc(a,c.scrollbarH.scrollLeft)}),Xe(c.scroller,"mousewheel",function(b){ic(a,b)}),Xe(c.scroller,"DOMMouseScroll",function(b){ic(a,b)}),Xe(c.scrollbarH,"mousedown",e),Xe(c.scrollbarV,"mousedown",e),Xe(c.wrapper,"scroll",function(){c.wrapper.scrollTop=c.wrapper.scrollLeft=0});var f;Xe(window,"resize",h),setTimeout(i,5e3),Xe(c.input,"keyup",zb(a,qc)),Xe(c.input,"input",function(){g&&!d&&a.display.inputHasSelection&&(a.display.inputHasSelection=null),Mb(a)}),Xe(c.input,"keydown",zb(a,pc)),Xe(c.input,"keypress",zb(a,rc)),Xe(c.input,"focus",wf(sc,a)),Xe(c.input,"blur",wf(tc,a)),a.options.dragDrop&&(Xe(c.scroller,"dragstart",function(b){dc(a,b)}
2),Xe(c.scroller,"dragenter",j),Xe(c.scroller,"dragover",j),Xe(c.scroller,"drop",zb(a,cc))),Xe(c.scroller,"paste",function(b){Tb(c,b)||(a.state.pasteIncoming=!0,Pb(a),Mb(a))}),Xe(c.input,"paste",function(){a.state.pasteIncoming=!0,Mb(a)}),Xe(c.input,"cut",k),Xe(c.input,"copy",k),m&&Xe(c.sizer,"mouseup",function(){Hf()==c.input&&c.input.blur(),Pb(a)})}function Tb(a,b){for(var c=Ve(b);c!=a.wrapper;c=c.parentNode)if(!c||c.ignoreEvents||c.parentNode==a.sizer&&c!=a.mover)return!0}function Ub(a,b,c,d){var e=a.display;if(!c){var f=Ve(b);if(f==e.scrollbarH||f==e.scrollbarV||f==e.scrollbarFiller||f==e.gutterFiller)return null}var g,h,i=e.lineSpace.getBoundingClientRect();try{g=b.clientX-i.left,h=b.clientY-i.top}catch(a){return null}var k,j=qb(a,g,h);if(d&&1==j.xRel&&(k=ue(a.doc,j.line).text).length==j.ch){var l=mf(k,k.length,a.options.tabSize)-k.length;j=ma(j.line,Math.round((g-Xa(a.display).left)/ub(a.display))-l)}return j}function Vb(a){if(!cf(this,a)){var b=this,c=b.display;if(c.shift=a.shiftKey,Tb(c,a))return void(h||(c.scroller.draggable=!1,setTimeout(function(){c.scroller.draggable=!0},100)));if(!ac(b,a)){var d=Ub(b,a);switch(window.focus(),We(a)){case 1:d?Yb(b,a,d):Ve(a)==c.scroller&&Re(a);break;case 2:h&&(b.state.lastMiddleDown=+new Date),d&&Ba(b.doc,d),setTimeout(wf(Pb,b),20),Re(a);break;case 3:w&&vc(b,a)}}}}function Yb(a,b,c){setTimeout(wf(Qb,a),0);var e,d=+new Date;Xb&&Xb.time>d-400&&0==na(Xb.pos,c)?e="triple":Wb&&Wb.time>d-400&&0==na(Wb.pos,c)?(e="double",Xb={time:d,pos:c}):(e="single",Wb={time:d,pos:c});var f=a.doc.sel,g=s?b.metaKey:b.ctrlKey;a.options.dragDrop&&If&&!g&&!Rb(a)&&"single"==e&&f.contains(c)>-1&&f.somethingSelected()?Zb(a,b,c):$b(a,b,c,e,g)}function Zb(a,c,e){var f=a.display,g=zb(a,function(i){h&&(f.scroller.draggable=!1),a.state.draggingText=!1,Ye(document,"mouseup",g),Ye(f.scroller,"drop",g),Math.abs(c.clientX-i.clientX)+Math.abs(c.clientY-i.clientY)<10&&(Re(i),Ba(a.doc,e),Pb(a),b&&!d&&setTimeout(function(){document.body.focus(),Pb(a)},20))});h&&(f.scroller.draggable=!0),a.state.draggingText=g,f.scroller.dragDrop&&f.scroller.dragDrop(),Xe(document,"mouseup",g),Xe(f.scroller,"drop",g)}function $b(a,b,c,d,f){function p(b){if(0!=na(o,b))if(o=b,"rect"==d){for(var e=[],f=a.options.tabSize,g=mf(ue(i,c.line).text,c.ch,f),h=mf(ue(i,b.line).text,b.ch,f),m=Math.min(g,h),n=Math.max(g,h),p=Math.min(c.line,b.line),q=Math.min(a.lastLine(),Math.max(c.line,b.line));p<=q;p++){var r=ue(i,p).text,s=nf(r,m,f);m==n?e.push(new sa(ma(p,s),ma(p,s))):r.length>s&&e.push(new sa(ma(p,s),ma(p,nf(r,n,f))))}e.length||e.push(new sa(c,c)),Ha(i,ta(l.ranges.slice(0,k).concat(e),k),jf)}else{var t=j,u=t.anchor,v=b;if("single"!=d){if("double"==d)var w=Wc(i,b);else var w=new sa(ma(b.line,0),wa(i,ma(b.line+1,0)));na(w.anchor,u)>0?(v=w.head,u=qa(t.from(),w.anchor)):(v=w.anchor,u=pa(t.to(),w.head))}var e=l.ranges.slice(0);e[k]=new sa(wa(i,u),v),Ha(i,ta(e,k),jf)}}function s(b){var c=++r,e=Ub(a,b,!0,"rect"==d);if(e)if(0!=na(e,o)){Qb(a),p(e);var f=P(h,i);(e.line>=f.to||e.line<f.from)&&setTimeout(zb(a,function(){r==c&&s(b)}),150)}else{var g=b.clientY<q.top?-20:b.clientY>q.bottom?20:0;g&&setTimeout(zb(a,function(){r==c&&(h.scroller.scrollTop+=g,s(b))}),50)}}function t(b){r=1/0,Re(b),Pb(a),Ye(document,"mousemove",u),Ye(document,"mouseup",v),i.history.lastSelOrigin=null}var h=a.display,i=a.doc;Re(b);var j,k,l=i.sel;if(f?(k=i.sel.contains(c),j=k>-1?i.sel.ranges[k]:new sa(c,c)):j=i.sel.primary(),b.altKey)d="rect",f||(j=new sa(c,c)),c=Ub(a,b,!0,!0),k=-1;else if("double"==d){var m=Wc(i,c);j=a.display.shift||i.extend?Aa(i,j,m.anchor,m.head):m}else if("triple"==d){var n=new sa(ma(c.line,0),wa(i,ma(c.line+1,0)));j=a.display.shift||i.extend?Aa(i,j,n.anchor,n.head):n}else j=Aa(i,j,c);f?k>-1?Da(i,k,j,jf):(k=i.sel.ranges.length,Ha(i,ta(i.sel.ranges.concat([j]),k),{scroll:!1,origin:"*mouse"})):(k=0,Ha(i,new ra([j],0),jf));var o=c,q=h.wrapper.getBoundingClientRect(),r=0,u=zb(a,function(a){(g&&!e?a.buttons:We(a))?s(a):t(a)}),v=zb(a,t);Xe(document,"mousemove",u),Xe(document,"mouseup",v)}function _b(a,b,c,d,e){try{var f=b.clientX,g=b.clientY}catch(a){return!1}if(f>=Math.floor(a.display.gutters.getBoundingClientRect().right))return!1;d&&Re(b);var h=a.display,i=h.lineDiv.getBoundingClientRect();if(g>i.bottom||!df(a,c))return Te(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=ze(a.doc,g),m=a.options.gutters[j];return e(a,c,a,l,m,b),Te(b)}}}function ac(a,b){return _b(a,b,"gutterClick",!0,af)}function cc(a){var c=this;if(!cf(c,a)&&!Tb(c.display,a)){Re(a),b&&(bc=+new Date);var d=Ub(c,a,!0),e=a.dataTransfer.files;if(d&&!Rb(c))if(e&&e.length&&window.FileReader&&window.File)for(var f=e.length,g=Array(f),h=0,i=function(a,b){var e=new FileReader;e.onload=function(){if(g[b]=e.result,++h==f){d=wa(c.doc,d);var a={from:d,to:d,text:Pf(g.join("\n")),origin:"paste"};Dc(c.doc,a),Ga(c.doc,ua(d,xc(a)))}},e.readAsText(a)},j=0;j<f;++j)i(e[j],j);else{if(c.state.draggingText&&c.doc.sel.contains(d)>-1)return c.state.draggingText(a),void setTimeout(wf(Pb,c),20);try{var g=a.dataTransfer.getData("Text");if(g){var k=c.state.draggingText&&c.listSelections();if(Ia(c.doc,ua(d,d)),k)for(var j=0;j<k.length;++j)Jc(c.doc,"",k[j].anchor,k[j].head,"drag");c.replaceSelection(g,"around","paste"),Pb(c)}}catch(a){}}}}function dc(a,c){if(b&&(!a.state.draggingText||+new Date-bc<100))return void Ue(c);if(!cf(a,c)&&!Tb(a.display,c)&&(c.dataTransfer.setData("Text",a.getSelection()),c.dataTransfer.setDragImage&&!l)){var d=Cf("img",null,null,"position: fixed; left: 0; top: 0;");d.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",k&&(d.width=d.height=1,a.display.wrapper.appendChild(d),d._top=d.offsetTop),c.dataTransfer.setDragImage(d,0,0),k&&d.parentNode.removeChild(d)}}function ec(b,c){Math.abs(b.doc.scrollTop-c)<2||(b.doc.scrollTop=c,a||U(b,{top:c}),b.display.scroller.scrollTop!=c&&(b.display.scroller.scrollTop=c),b.display.scrollbarV.scrollTop!=c&&(b.display.scrollbarV.scrollTop=c),a&&U(b),Ra(b,100))}function fc(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,Q(a),a.display.scroller.scrollLeft!=b&&(a.display.scroller.scrollLeft=b),a.display.scrollbarH.scrollLeft!=b&&(a.display.scrollbarH.scrollLeft=b))}function ic(b,c){var d=c.wheelDeltaX,e=c.wheelDeltaY;null==d&&c.detail&&c.axis==c.HORIZONTAL_AXIS&&(d=c.detail),null==e&&c.detail&&c.axis==c.VERTICAL_AXIS?e=c.detail:null==e&&(e=c.wheelDelta);var f=b.display,g=f.scroller;if(d&&g.scrollWidth>g.clientWidth||e&&g.scrollHeight>g.clientHeight){if(e&&s&&h)a:for(var i=c.target,j=f.view;i!=g;i=i.parentNode)for(var l=0;l<j.length;l++)if(j[l].node==i){b.display.currentWheelTarget=i;break a}if(d&&!a&&!k&&null!=hc)return e&&ec(b,Math.max(0,Math.min(g.scrollTop+e*hc,g.scrollHeight-g.clientHeight))),fc(b,Math.max(0,Math.min(g.scrollLeft+d*hc,g.scrollWidth-g.clientWidth))),Re(c),void(f.wheelStartX=null);if(e&&null!=hc){var m=e*hc,n=b.doc.scrollTop,o=n+f.wrapper.clientHeight;m<0?n=Math.max(0,n+m-50):o=Math.min(b.doc.height,o+m+50),U(b,{top:n,bottom:o})}gc<20&&(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&&(hc=(hc*gc+c)/(gc+1),++gc)}},200)):(f.wheelDX+=d,f.wheelDY+=e))}}function jc(a,b,c){if("string"==typeof b&&(b=gd[b],!b))return!1;a.display.pollingFast&&Nb(a)&&(a.display.pollingFast=!1);var d=a.display.shift,e=!1;try{Rb(a)&&(a.state.suppressEdits=!0),c&&(a.display.shift=!1),e=b(a)!=gf}finally{a.display.shift=d,a.state.suppressEdits=!1}return e}function kc(a){var b=a.state.keyMaps.slice(0);return a.options.extraKeys&&b.push(a.options.extraKeys),b.push(a.options.keyMap),b}function mc(a,b){var c=id(a.options.keyMap),d=c.auto;clearTimeout(lc),d&&!kd(b)&&(lc=setTimeout(function(){id(a.options.keyMap)==c&&(a.options.keyMap=d.call?d.call(null,a):d,G(a))},50));var e=ld(b,!0),f=!1;if(!e)return!1;var g=kc(a);return f=b.shiftKey?jd("Shift-"+e,g,function(b){return jc(a,b,!0)})||jd(e,g,function(b){if("string"==typeof b?/^go[A-Z]/.test(b):b.motion)return jc(a,b)}):jd(e,g,function(b){return jc(a,b)}
2),f&&(Re(b),Qa(a),af(a,"keyHandled",a,e,b)),f}function nc(a,b,c){var d=jd("'"+c+"'",kc(a),function(b){return jc(a,b,!0)});return d&&(Re(b),Qa(a),af(a,"keyHandled",a,"'"+c+"'",b)),d}function pc(a){var c=this;if(Qb(c),!cf(c,a)){b&&27==a.keyCode&&(a.returnValue=!1);var d=a.keyCode;c.display.shift=16==d||a.shiftKey;var e=mc(c,a);k&&(oc=e?d:null,!e&&88==d&&!Rf&&(s?a.metaKey:a.ctrlKey)&&c.replaceSelection("",null,"cut"))}}function qc(a){cf(this,a)||16==a.keyCode&&(this.doc.sel.shift=!1)}function rc(a){var b=this;if(!cf(b,a)){var c=a.keyCode,e=a.charCode;if(k&&c==oc)return oc=null,void Re(a);if(!(k&&(!a.which||a.which<10)||m)||!mc(b,a)){var f=String.fromCharCode(null==e?c:e);nc(b,a,f)||(g&&!d&&(b.display.inputHasSelection=null),Mb(b))}}}function sc(a){"nocursor"!=a.options.readOnly&&(a.state.focused||(Ze(a,"focus",a),a.state.focused=!0,a.display.wrapper.className.search(/\bCodeMirror-focused\b/)==-1&&(a.display.wrapper.className+=" CodeMirror-focused"),a.curOp||(Ob(a),h&&setTimeout(wf(Ob,a,!0),0))),Lb(a),Qa(a))}function tc(a){a.state.focused&&(Ze(a,"blur",a),a.state.focused=!1,a.display.wrapper.className=a.display.wrapper.className.replace(" CodeMirror-focused","")),clearInterval(a.display.blinker),setTimeout(function(){a.state.focused||(a.display.shift=!1)},150)}function vc(a,b){function j(){if(null!=c.input.selectionStart){var b=c.input.value="?"+(a.somethingSelected()?c.input.value:"");c.prevInput="?",c.input.selectionStart=1,c.input.selectionEnd=b.length}}function l(){if(c.inputDiv.style.position="relative",c.input.style.cssText=i,d&&(c.scrollbarV.scrollTop=c.scroller.scrollTop=f),Lb(a),null!=c.input.selectionStart){g&&!d||j(),clearTimeout(uc);var b=0,e=function(){"?"==c.prevInput&&0==c.input.selectionStart?zb(a,gd.selectAll)(a):b++<10?uc=setTimeout(e,500):Ob(a)};uc=setTimeout(e,200)}}if(!cf(a,b,"contextmenu")){var c=a.display;if(!Tb(c,b)&&!wc(a,b)){var e=Ub(a,b),f=c.scroller.scrollTop;if(e&&!k){var h=a.options.resetSelectionOnContextMenu;h&&a.doc.sel.contains(e)==-1&&zb(a,Ha)(a.doc,ua(e),hf);var i=c.input.style.cssText;if(c.inputDiv.style.position="absolute",c.input.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(b.clientY-5)+"px; left: "+(b.clientX-5)+"px; z-index: 1000; background: "+(g?"rgba(255, 255, 255, .05)":"transparent")+"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",Pb(a),Ob(a),a.somethingSelected()||(c.input.value=c.prevInput=" "),g&&!d&&j(),w){Ue(b);var m=function(){Ye(window,"mouseup",m),setTimeout(l,20)};Xe(window,"mouseup",m)}else setTimeout(l,50)}}}}function wc(a,b){return!!df(a,"gutterContextMenu")&&_b(a,b,"gutterContextMenu",!1,Ze)}function yc(a,b){if(na(a,b.from)<0)return a;if(na(a,b.to)<=0)return xc(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+=xc(b).ch-b.to.ch),ma(c,d)}function zc(a,b){for(var c=[],d=0;d<a.sel.ranges.length;d++){var e=a.sel.ranges[d];c.push(new sa(yc(e.anchor,b),yc(e.head,b)))}return ta(c,a.sel.primIndex)}function Ac(a,b,c){return a.line==b.line?ma(c.line,a.ch-b.ch+c.ch):ma(c.line+(a.line-b.line),a.ch)}function Bc(a,b,c){for(var d=[],e=ma(a.first,0),f=e,g=0;g<b.length;g++){var h=b[g],i=Ac(h.from,e,f),j=Ac(xc(h),e,f);if(e=h.to,f=j,"around"==c){var k=a.sel.ranges[g],l=na(k.head,k.anchor)<0;d[g]=new sa(l?j:i,l?i:j)}else d[g]=new sa(i,i)}return new ra(d,a.sel.primIndex)}function Cc(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=wa(a,b)),c&&(this.to=wa(a,c)),d&&(this.text=d),void 0!==e&&(this.origin=e)}),Ze(a,"beforeChange",a,d),a.cm&&Ze(a.cm,"beforeChange",a.cm,d),d.canceled?null:{from:d.from,to:d.to,text:d.text,origin:d.origin}}function Dc(a,b,c){if(a.cm){if(!a.cm.curOp)return zb(a.cm,Dc)(a,b,c);if(a.cm.state.suppressEdits)return}if(!(df(a,"beforeChange")||a.cm&&df(a.cm,"beforeChange"))||(b=Cc(a,b,!0))){var d=x&&!c&&Bd(a,b.from,b.to);if(d)for(var e=d.length-1;e>=0;--e)Ec(a,{from:d[e].from,to:d[e].to,text:e?[""]:b.text});else Ec(a,b)}}function Ec(a,b){if(1!=b.text.length||""!=b.text[0]||0!=na(b.from,b.to)){var c=zc(a,b);Ge(a,b,c,a.cm?a.cm.curOp.id:NaN),Hc(a,b,c,yd(a,b));var d=[];se(a,function(a,c){c||sf(d,a.history)!=-1||(Qe(a.history,b),d.push(a.history)),Hc(a,b,null,yd(a,b))})}}function Fc(a,b,c){if(!a.cm||!a.cm.state.suppressEdits){for(var e,d=a.history,f=a.sel,g="undo"==b?d.done:d.undone,h="undo"==b?d.undone:d.done,i=0;i<g.length&&(e=g[i],c?!e.ranges||e.equals(a.sel):e.ranges);i++);if(i!=g.length){for(d.lastOrigin=d.lastSelOrigin=null;e=g.pop(),e.ranges;){if(Je(e,h),c&&!e.equals(a.sel))return void Ha(a,e,{clearRedo:!1});f=e}var j=[];Je(f,h),h.push({changes:j,generation:d.generation}),d.generation=e.generation||++d.maxGeneration;
2for(var k=df(a,"beforeChange")||a.cm&&df(a.cm,"beforeChange"),i=e.changes.length-1;i>=0;--i){var l=e.changes[i];if(l.origin=b,k&&!Cc(a,l,!1))return void(g.length=0);j.push(De(a,l));var m=i?zc(a,l,null):qf(g);Hc(a,l,m,Ad(a,l)),a.cm&&Pc(a.cm);var n=[];se(a,function(a,b){b||sf(n,a.history)!=-1||(Qe(a.history,l),n.push(a.history)),Hc(a,l,null,Ad(a,l))})}}}}function Gc(a,b){a.first+=b,a.sel=new ra(tf(a.sel.ranges,function(a){return new sa(ma(a.anchor.line+b,a.anchor.ch),ma(a.head.line+b,a.head.ch))}),a.sel.primIndex),a.cm&&Eb(a.cm,a.first,a.first-b,b)}function Hc(a,b,c,d){if(a.cm&&!a.cm.curOp)return zb(a.cm,Hc)(a,b,c,d);if(b.to.line<a.first)return void Gc(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);Gc(a,e),b={from:ma(a.first,0),to:ma(b.to.line+e,b.to.ch),text:[qf(b.text)],origin:b.origin}}var f=a.lastLine();b.to.line>f&&(b={from:b.from,to:ma(f,ue(a,f).text.length),text:[b.text[0]],origin:b.origin}),b.removed=ve(a,b.from,b.to),c||(c=zc(a,b,null)),a.cm?Ic(a.cm,b,d):le(a,b,d),Ia(a,c,hf)}}function Ic(a,b,c){var d=a.doc,e=a.display,f=b.from,g=b.to,h=!1,i=f.line;a.options.lineWrapping||(i=ye(Ld(ue(d,f.line))),d.iter(i,g.line+1,function(a){if(a==e.maxLine)return h=!0,!0})),d.sel.contains(b.from,b.to)>-1&&(a.curOp.cursorActivity=!0),le(d,b,c,E(a)),a.options.lineWrapping||(d.iter(i,f.line+b.text.length,function(a){var b=K(a);b>e.maxLineLength&&(e.maxLine=a,e.maxLineLength=b,e.maxLineChanged=!0,h=!1)}),h&&(a.curOp.updateMaxLine=!0)),d.frontier=Math.min(d.frontier,f.line),Ra(a,400);var j=b.text.length-(g.line-f.line)-1;f.line!=g.line||1!=b.text.length||ke(a.doc,b)?Eb(a,f.line,g.line+1,j):Fb(a,f.line,"text"),(df(a,"change")||df(a,"changes"))&&(a.curOp.changeObjs||(a.curOp.changeObjs=[])).push({from:f,to:g,text:b.text,removed:b.removed,origin:b.origin})}function Jc(a,b,c,d,e){if(d||(d=c),na(d,c)<0){var f=d;d=c,c=f}"string"==typeof b&&(b=Pf(b)),Dc(a,{from:c,to:d,text:b,origin:e})}function Kc(a,b){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&&!p){var f=Cf("div","?",null,"position: absolute; top: "+(b.top-c.viewOffset-Va(a.display))+"px; height: "+(b.bottom-b.top+ff)+"px; left: "+b.left+"px; width: 2px;");a.display.lineSpace.appendChild(f),f.scrollIntoView(e),a.display.lineSpace.removeChild(f)}}function Lc(a,b,c,d){for(null==d&&(d=0);;){var e=!1,f=nb(a,b),g=c&&c!=b?nb(a,c):f,h=Nc(a,Math.min(f.left,g.left),Math.min(f.top,g.top)-d,Math.max(f.left,g.left),Math.max(f.bottom,g.bottom)+d),i=a.doc.scrollTop,j=a.doc.scrollLeft;if(null!=h.scrollTop&&(ec(a,h.scrollTop),Math.abs(a.doc.scrollTop-i)>1&&(e=!0)),null!=h.scrollLeft&&(fc(a,h.scrollLeft),Math.abs(a.doc.scrollLeft-j)>1&&(e=!0)),!e)return f}}function Mc(a,b,c,d,e){var f=Nc(a,b,c,d,e);null!=f.scrollTop&&ec(a,f.scrollTop),null!=f.scrollLeft&&fc(a,f.scrollLeft)}function Nc(a,b,c,d,e){var f=a.display,g=tb(a.display);c<0&&(c=0);var h=a.curOp&&null!=a.curOp.scrollTop?a.curOp.scrollTop:f.scroller.scrollTop,i=f.scroller.clientHeight-ff,j={},k=a.doc.height+Wa(f),l=c<g,m=e>k-g;if(c<h)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=f.scroller.clientWidth-ff;b+=f.gutters.offsetWidth,d+=f.gutters.offsetWidth;var q=f.gutters.offsetWidth,r=b<q+10;return b<o+q||r?(r&&(b=0),j.scrollLeft=Math.max(0,b-10-q)):d>p+o-3&&(j.scrollLeft=d+10-p),j}function Oc(a,b,c){null==b&&null==c||Qc(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 Pc(a){Qc(a);var b=a.getCursor(),c=b,d=b;a.options.lineWrapping||(c=b.ch?ma(b.line,b.ch-1):b,d=ma(b.line,b.ch+1)),a.curOp.scrollToPos={from:c,to:d,margin:a.options.cursorScrollMargin,isCursor:!0}}function Qc(a){var b=a.curOp.scrollToPos;if(b){a.curOp.scrollToPos=null;var c=ob(a,b.from),d=ob(a,b.to),e=Nc(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 Rc(a,b,c,d){var f,e=a.doc;null==c&&(c="add"),"smart"==c&&(a.doc.mode.indent?f=Ua(a,b):c="prev");var g=a.options.tabSize,h=ue(e,b),i=mf(h.text,null,g);h.stateAfter&&(h.stateAfter=null);var k,j=h.text.match(/^\s*/)[0];if(d||/\S/.test(h.text)){if("smart"==c&&(k=a.doc.mode.indent(f,h.text.slice(j.length),h.text),k==gf)){if(!d)return;c="prev"}}else k=0,c="not";"prev"==c?k=b>e.first?mf(ue(e,b-1).text,null,g):0:"add"==c?k=i+a.options.indentUnit:"subtract"==c?k=i-a.options.indentUnit:"number"==typeof c&&(k=i+c),k=Math.max(0,k);var l="",m=0;if(a.options.indentWithTabs)for(var n=Math.floor(k/g);n;--n)m+=g,l+="\t";if(m<k&&(l+=pf(k-m)),l!=j)Jc(a.doc,l,ma(b,0),ma(b,j.length),"+input");else for(var n=0;n<e.sel.ranges.length;n++){var o=e.sel.ranges[n];if(o.head.line==b&&o.head.ch<j.length){var m=ma(b,j.length);Da(e,n,new sa(m,m));break}}h.stateAfter=null}function Sc(a,b,c,d){var e=b,f=b,g=a.doc;return"number"==typeof b?f=ue(g,va(g,b)):e=ye(b),null==e?null:d(f,e)?(Fb(a,e,c),f):null}function Tc(a,b){for(var c=a.doc.sel.ranges,d=[],e=0;e<c.length;e++){for(var f=b(c[e]);d.length&&na(f.from,qf(d).to)<=0;){var g=d.pop();if(na(g.from,f.from)<0){f.from=g.from;break}}d.push(f)}yb(a,function(){for(var b=d.length-1;b>=0;b--)Jc(a.doc,"",d[b].from,d[b].to,"+delete");Pc(a)})}function Uc(a,b,c,d,e){function k(){var b=f+c;return b<a.first||b>=a.first+a.size?j=!1:(f=b,i=ue(a,b))}function l(a){var b=(e?cg:dg)(i,g,c,!0);if(null==b){if(a||!k())return j=!1;g=e?(c<0?Xf:Wf)(i):c<0?i.text.length:0}else g=b;return!0}var f=b.line,g=b.ch,h=c,i=ue(a,f),j=!0;if("char"==d)l();else if("column"==d)l(!0);else if("word"==d||"group"==d)for(var m=null,n="group"==d,o=!0;!(c<0)||l(!o);o=!1){var p=i.text.charAt(g)||"\n",q=yf(p)?"w":n&&"\n"==p?"n":!n||/\s/.test(p)?null:"p";if(!n||o||q||(q="s"),m&&m!=q){c<0&&(c=1,l());break}if(q&&(m=q),c>0&&!l(!o))break}var r=Ma(a,ma(f,g),h,!0);return j||(r.hitSide=!0),r}function Vc(a,b,c,d){var g,e=a.doc,f=b.left;if("page"==d){var h=Math.min(a.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);g=b.top+c*(h-(c<0?1.5:.5)*tb(a.display))}else"line"==d&&(g=c>0?b.bottom+3:b.top-3);for(;;){var i=qb(a,f,g);if(!i.outside)break;if(c<0?g<=0:g>=e.height){i.hitSide=!0;break}g+=5*c}return i}function Wc(a,b){var c=ue(a,b.line).text,d=b.ch,e=b.ch;if(c){(b.xRel<0||e==c.length)&&d?--d:++e;for(var f=c.charAt(d),g=yf(f)?yf:/\s/.test(f)?function(a){return/\s/.test(a)}:function(a){return!/\s/.test(a)&&!yf(a)};d>0&&g(c.charAt(d-1));)--d;for(;e<c.length&&g(c.charAt(e));)++e}return new sa(ma(b.line,d),ma(b.line,e))}function Zc(a,b,c,d){z.defaults[a]=b,c&&(Yc[a]=d?function(a,b,d){d!=$c&&c(a,b,d)}:c)}function id(a){return"string"==typeof a?hd[a]:a}function pd(a,b,c,d,e){if(d&&d.shared)return rd(a,b,c,d,e);if(a.cm&&!a.cm.curOp)return zb(a.cm,pd)(a,b,c,d,e);var f=new nd(a,e),g=na(b,c);if(d&&vf(d,f),g>0||0==g&&f.clearWhenEmpty!==!1)return f;if(f.replacedWith&&(f.collapsed=!0,f.widgetNode=Cf("span",[f.replacedWith],"CodeMirror-widget"),d.handleMouseEvents||(f.widgetNode.ignoreEvents=!0),d.insertLeft&&(f.widgetNode.insertLeft=!0)),f.collapsed){if(Kd(a,b.line,b,c,f)||b.line!=c.line&&Kd(a,c.line,b,c,f))throw new Error("Inserting collapsed marker partially overlapping an existing one");y=!0}f.addToHistory&&Ge(a,{from:b,to:c,origin:"markText"},a.sel,NaN);var j,h=b.line,i=a.cm;if(a.iter(h,c.line+1,function(a){i&&f.collapsed&&!i.options.lineWrapping&&Ld(a)==i.display.maxLine&&(j=!0),f.collapsed&&h!=b.line&&xe(a,0),vd(a,new sd(f,h==b.line?b.ch:null,h==c.line?c.ch:null)),++h}),f.collapsed&&a.iter(b.line,c.line+1,function(b){Pd(a,b)&&xe(b,0)}),f.clearOnEnter&&Xe(f,"beforeCursorEnter",function(){f.clear()}),f.readOnly&&(x=!0,(a.history.done.length||a.history.undone.length)&&a.clearHistory()),f.collapsed&&(f.i
vendor: 4,532 bytes, line 2
2d=++od,f.atomic=!0),i){if(j&&(i.curOp.updateMaxLine=!0),f.collapsed)Eb(i,b.line,c.line+1);else if(f.className||f.title||f.startStyle||f.endStyle)for(var k=b.line;k<=c.line;k++)Fb(i,k,"text");f.atomic&&Ka(i.doc),af(i,"markerAdded",i,f)}return f}function rd(a,b,c,d,e){d=vf(d),d.shared=!1;var f=[pd(a,b,c,d,e)],g=f[0],h=d.widgetNode;return se(a,function(a){h&&(d.widgetNode=h.cloneNode(!0)),f.push(pd(a,wa(a,b),wa(a,c),d,e));for(var i=0;i<a.linked.length;++i)if(a.linked[i].isParent)return;g=qf(f)}),new qd(f,g)}function sd(a,b,c){this.marker=a,this.from=b,this.to=c}function td(a,b){if(a)for(var c=0;c<a.length;++c){var d=a[c];if(d.marker==b)return d}}function ud(a,b){for(var c,d=0;d<a.length;++d)a[d]!=b&&(c||(c=[])).push(a[d]);return c}function vd(a,b){a.markedSpans=a.markedSpans?a.markedSpans.concat([b]):[b],b.marker.attachLine(a)}function wd(a,b,c){if(a)for(var e,d=0;d<a.length;++d){var f=a[d],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);(e||(e=[])).push(new sd(g,f.from,i?null:f.to))}}return e}function xd(a,b,c){if(a)for(var e,d=0;d<a.length;++d){var f=a[d],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);(e||(e=[])).push(new sd(g,i?null:f.from-b,null==f.to?null:f.to-b))}}return e}function yd(a,b){var c=ya(a,b.from.line)&&ue(a,b.from.line).markedSpans,d=ya(a,b.to.line)&&ue(a,b.to.line).markedSpans;if(!c&&!d)return null;var e=b.from.ch,f=b.to.ch,g=0==na(b.from,b.to),h=wd(c,e,g),i=xd(d,f,g),j=1==b.text.length,k=qf(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=td(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=td(h,m.marker);n||(m.from=k,j&&(h||(h=[])).push(m))}else m.from+=k,j&&(h||(h=[])).push(m)}h&&(h=zd(h)),i&&i!=h&&(i=zd(i));var o=[h];if(!j){var q,p=b.text.length-2;if(p>0&&h)for(var l=0;l<h.length;++l)null==h[l].to&&(q||(q=[])).push(new sd(h[l].marker,null,null));for(var l=0;l<p;++l)o.push(q);o.push(i)}return o}function zd(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 Ad(a,b){var c=Me(a,b),d=yd(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 Bd(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&&sf(d,c)!=-1||(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(!(na(j.to,h.from)<0||na(j.from,h.to)>0)){var k=[i,1],l=na(j.from,h.from),m=na(j.to,h.to);(l<0||!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 Cd(a){var b=a.markedSpans;if(b){for(var c=0;c<b.length;++c)b[c].marker.detachLine(a);a.markedSpans=null}}function Dd(a,b){if(b){for(var c=0;c<b.length;++c)b[c].marker.attachLine(a);a.markedSpans=b}}function Ed(a){return a.inclusiveLeft?-1:0}function Fd(a){return a.inclusiveRight?1:0}function Gd(a,b){var c=a.lines.length-b.lines.length;if(0!=c)return c;var d=a.find(),e=b.find(),f=na(d.from,e.from)||Ed(a)-Ed(b);if(f)return-f;var g=na(d.to,e.to)||Fd(a)-Fd(b);return g?g:b.id-a.id}function Hd(a,b){var d,c=y&&a.markedSpans;if(c)for(var e,f=0;f<c.length;++f)e=c[f],e.marker.collapsed&&null==(b?e.from:e.to)&&(!d||Gd(d,e.marker)<0)&&(d=e.marker);return d}function Id(a){return Hd(a,!0)}function Jd(a){return Hd(a,!1)}function Kd(a,b,c,d,e){var f=ue(a,b),g=y&&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=na(j.from,c)||Ed(i.marker)-Ed(e),l=na(j.to,d)||Fd(i.marker)-Fd(e);if(!(k>=0&&l<=0||k<=0&&l>=0)&&(k<=0&&(na(j.to,c)||Fd(i.marker)-Ed(e))>0||k>=0&&(na(j.from,d)||Ed(i.marker)-Fd(e))<0))return!0}}}function Ld(a){for(var b;b=Id(a);)a=b.find(-1,!0).line;return a}function Md(a){for(var b,c;b=Jd(a);)a=b.find(1,!0).line,(c||(c=[])).push(a);return c}function Nd(a,b){var c=ue(a,b),d=Ld(c);return c==d?b:ye(d)}function Od(a,b){if(b>
2a.lastLine())return b;var d,c=ue(a,b);if(!Pd(a,c))return b;for(;d=Jd(c);)c=d.find(1,!0).line;return ye(c)+1}function Pd(a,b){var c=y&&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&&Qd(a,b,d))return!0; 3}}function Qd(a,b,c){if(null==c.to){var d=c.marker.find(1,!0);return Qd(a,d.line,td(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)&&Qd(a,b,e))return!0}function Sd(a,b,c){Ae(b)<(a.curOp&&a.curOp.scrollTop||a.doc.scrollTop)&&Oc(a,null,c)}function Td(a){return null!=a.height?a.height:(Gf(document.body,a.node)||Ff(a.cm.display.measure,Cf("div",[a.node],null,"position: relative")),a.height=a.node.offsetHeight)}function Ud(a,b,c,d){var e=new Rd(a,c,d);return e.noHScroll&&(a.display.alignWidgets=!0),Sc(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,!Pd(a.doc,b)){var d=Ae(b)<a.doc.scrollTop;xe(b,b.height+Td(e)),d&&Oc(a,null,e.height),a.curOp.forceUpdate=!0}return!0}),e}function Wd(a,b,c,d){a.text=b,a.stateAfter&&(a.stateAfter=null),a.styles&&(a.styles=null),null!=a.order&&(a.order=null),Cd(a),Dd(a,c);var e=d?d(a):1;e!=a.height&&xe(a,e)}function Xd(a){a.parent=null,Cd(a)}function Yd(a,b,c,d,e,f){var g=c.flattenSpans;null==g&&(g=a.options.flattenSpans);var k,h=0,i=null,j=new md(b,a.options.tabSize);for(""==b&&c.blankLine&&c.blankLine(d);!j.eol();){if(j.pos>a.options.maxHighlightLength?(g=!1,f&&_d(a,b,d,j.pos),j.pos=b.length,k=null):k=c.token(j,d),a.options.addModeClass){var l=z.innerMode(c,d).mode.name;l&&(k="m-"+(k?l+" "+k:l))}g&&i==k||(h<j.start&&e(j.start,i),h=j.start,i=k),j.start=j.pos}for(;h<j.pos;){var m=Math.min(j.pos,h+5e4);e(m,i),h=m}}function Zd(a,b,c,d){var e=[a.state.modeGen];Yd(a,b.text,a.doc.mode,c,function(a,b){e.push(a,b)},d);for(var f=0;f<a.state.overlays.length;++f){var g=a.state.overlays[f],h=1,i=0;Yd(a,b.text,g.mode,!0,function(a,b){for(var c=h;i<a;){var d=e[h];d>a&&e.splice(h,1,a,e[h+1],d),h+=2,i=Math.min(a,d)}if(b)if(g.opaque)e.splice(c,h-c,a,b),h=c+2;else for(;c<h;c+=2){var f=e[c+1];e[c+1]=f?f+" "+b:b}})}return e}function $d(a,b){return b.styles&&b.styles[0]==a.state.modeGen||(b.styles=Zd(a,b,b.stateAfter=Ua(a,ye(b)))),b.styles}function _d(a,b,c,d){var e=a.doc.mode,f=new md(b,a.options.tabSize);for(f.start=f.pos=d||0,""==b&&e.blankLine&&e.blankLine(c);!f.eol()&&f.pos<=a.options.maxHighlightLength;)e.token(f,c),f.start=f.pos}function ce(a,b){if(!a)return null;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])}if(/^\s*$/.test(a))return null;var e=b.cm.options.addModeClass?be:ae;return e[a]||(e[a]=a.replace(/\S+/g,"cm-$&"))}function de(a,b){var c=Cf("span",null,null,h?"padding-right: .1px":null),d={pre:Cf("pre",[c]),content:c,col:0,pos:0,cm:a};b.measure={};for(var e=0;e<=(b.rest?b.rest.length:0);e++){var i,f=e?b.rest[e-1]:b.line;d.pos=0,d.addToken=fe,(g||h)&&a.getOption("lineWrapping")&&(d.addToken=ge(d.addToken)),Of(a.display.measure)&&(i=Be(f))&&(d.addToken=he(d.addToken,i)),d.map=[],je(f,d,$d(a,f)),0==d.map.length&&d.map.push(0,0,d.content.appendChild(Mf(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 Ze(a,"renderLine",a,b.line,d.pre),d}function ee(a){var b=Cf("span","•","cm-invalidchar");return b.title="\\u"+a.charCodeAt(0).toString(16),b}function fe(a,b,c,e,f,g){if(b){var h=a.cm.options.specialChars,i=!1;if(h.test(b))for(var j=document.createDocumentFragment(),k=0;;){h.lastIndex=k;var l=h.exec(b),m=l?l.index-k:b.length-k;if(m){var n=document.createTextNode(b.slice(k,k+m));d?j.appendChild(Cf("span",[n])):j.appendChild(n),a.map.push(a.pos,a.pos+m,n),a.col+=m,a.pos+=m}if(!l)break;
3if(k+=m+1,"\t"==l[0]){var o=a.cm.options.tabSize,p=o-a.col%o,n=j.appendChild(Cf("span",pf(p),"cm-tab"));a.col+=p}else{var n=a.cm.options.specialCharPlaceholder(l[0]);d?j.appendChild(Cf("span",[n])):j.appendChild(n),a.col+=1}a.map.push(a.pos,a.pos+1,n),a.pos++}else{a.col+=b.length;var j=document.createTextNode(b);a.map.push(a.pos,a.pos+b.length,j),d&&(i=!0),a.pos+=b.length}if(c||e||f||i){var q=c||"";e&&(q+=e),f&&(q+=f);var r=Cf("span",[j],q);return g&&(r.title=g),a.content.appendChild(r)}a.content.appendChild(j)}}function ge(a){function b(a){for(var b=" ",c=0;c<a.length-2;++c)b+=c%2?" ":" ";return b+=" "}return function(c,d,e,f,g,h){a(c,d.replace(/ {3,}/g,b),e,f,g,h)}}function he(a,b){return function(c,d,e,f,g,h){e=e?e+" cm-force-border":"cm-force-border";for(var i=c.pos,j=i+d.length;;){for(var k=0;k<b.length;k++){var l=b[k];if(l.to>i&&l.from<=i)break}if(l.to>=j)return a(c,d,e,f,g,h);a(c,d.slice(0,l.to-i),e,f,null,h),f=null,d=d.slice(l.to-i),i=l.to}}}function ie(a,b,c,d){var e=!d&&c.widgetNode;e&&(a.map.push(a.pos,a.pos+b,e),a.content.appendChild(e)),a.pos+=b}function je(a,b,c){var d=a.markedSpans,e=a.text,f=0;if(d)for(var k,m,n,o,p,q,h=e.length,i=0,g=1,j="",l=0;;){if(l==i){m=n=o=p="",q=null,l=1/0;for(var r=[],s=0;s<d.length;++s){var t=d[s],u=t.marker;t.from<=i&&(null==t.to||t.to>i)?(null!=t.to&&l>t.to&&(l=t.to,n=""),u.className&&(m+=" "+u.className),u.startStyle&&t.from==i&&(o+=" "+u.startStyle),u.endStyle&&t.to==l&&(n+=" "+u.endStyle),u.title&&!p&&(p=u.title),u.collapsed&&(!q||Gd(q.marker,u)<0)&&(q=t)):t.from>i&&l>t.from&&(l=t.from),"bookmark"==u.type&&t.from==i&&u.widgetNode&&r.push(u)}if(q&&(q.from||0)==i&&(ie(b,(null==q.to?h+1:q.to)-i,q.marker,null==q.from),null==q.to))return;if(!q&&r.length)for(var s=0;s<r.length;++s)ie(b,0,r[s])}if(i>=h)break;for(var v=Math.min(h,l);;){if(j){var w=i+j.length;if(!q){var x=w>v?j.slice(0,v-i):j;b.addToken(b,x,k?k+m:m,o,i+x.length==l?n:"",p)}if(w>=v){j=j.slice(v-i),i=v;break}i=w,o=""}j=e.slice(f,f=c[g++]),k=ce(c[g++],b)}}else for(var g=1;g<c.length;g+=2)b.addToken(b,e.slice(f,f=c[g]),ce(c[g+1],b))}function ke(a,b){return 0==b.from.ch&&0==b.to.ch&&""==qf(b.text)&&(!a.cm||a.cm.options.wholeLineUpdateBefore)}function le(a,b,c,d){function e(a){return c?c[a]:null}function f(a,c,e){Wd(a,c,e,d),af(a,"change",a,b)}var g=b.from,h=b.to,i=b.text,j=ue(a,g.line),k=ue(a,h.line),l=qf(i),m=e(i.length-1),n=h.line-g.line;if(ke(a,b)){for(var o=0,p=[];o<i.length-1;++o)p.push(new Vd(i[o],e(o),d));f(k,k.text,m),n&&a.remove(g.line,n),p.length&&a.insert(g.line,p)}else if(j==k)if(1==i.length)f(j,j.text.slice(0,g.ch)+l+j.text.slice(h.ch),m);else{for(var p=[],o=1;o<i.length-1;++o)p.push(new Vd(i[o],e(o),d));p.push(new Vd(l+j.text.slice(h.ch),m,d)),f(j,j.text.slice(0,g.ch)+i[0],e(0)),a.insert(g.line+1,p)}else if(1==i.length)f(j,j.text.slice(0,g.ch)+i[0]+k.text.slice(h.ch),e(0)),a.remove(g.line+1,n);else{f(j,j.text.slice(0,g.ch)+i[0],e(0)),f(k,l+k.text.slice(h.ch),m);for(var o=1,p=[];o<i.length-1;++o)p.push(new Vd(i[o],e(o),d));n>1&&a.remove(g.line+1,n-1),a.insert(g.line+1,p)}af(a,"change",a,b)}function me(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 ne(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 se(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 te(a,b){if(b.cm)throw new Error("This document is already in use.");a.doc=b,b.cm=a,F(a),B(a),a.options.lineWrapping||L(a),a.options.mode=b.modeOption,Eb(a)}function ue(a,b){if(b-=a.first,b<0||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(b<f){c=e;break}b-=f}return c.lines[b]}function ve(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 we(a,b,c){var d=[];return a.iter(b,c,function(a){d.push(a.text)}),d}function xe(a,b){var c=b-a.height;if(c)for(var d=a;d;d=d.parent)d.height+=c}function ye(a){if(null==a.parent)return null;for(var b=a.parent,c=sf(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 ze(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(b<f){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(b<h)break;b-=h}return c+d}function Ae(a){a=Ld(a);for(var b=0,c=a.parent,d=0;d<c.lines.length;++d){var e=c.lines[d];if(e==a)break;
vendor: 4,942 bytes, line 3
3b+=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 Be(a){var b=a.order;return null==b&&(b=a.order=eg(a.text)),b}function Ce(a){this.done=[],this.undone=[],this.undoDepth=1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=a||1}function De(a,b){var c={from:oa(b.from),to:xc(b),text:ve(a,b.from,b.to)};return Ke(a,c,b.from.line,b.to.line+1),se(a,function(a){Ke(a,c,b.from.line,b.to.line+1)},!0),c}function Ee(a){for(;a.length;){var b=qf(a);if(!b.ranges)break;a.pop()}}function Fe(a,b){return b?(Ee(a.done),qf(a.done)):a.done.length&&!qf(a.done).ranges?qf(a.done):a.done.length>1&&!a.done[a.done.length-2].ranges?(a.done.pop(),qf(a.done)):void 0}function Ge(a,b,c,d){var e=a.history;e.undone.length=0;var g,f=+new Date;if((e.lastOp==d||e.lastOrigin==b.origin&&b.origin&&("+"==b.origin.charAt(0)&&a.cm&&e.lastModTime>f-a.cm.options.historyEventDelay||"*"==b.origin.charAt(0)))&&(g=Fe(e,e.lastOp==d))){var h=qf(g.changes);0==na(b.from,b.to)&&0==na(b.from,h.to)?h.to=xc(b):g.changes.push(De(a,b))}else{var i=qf(e.done);for(i&&i.ranges||Je(a.sel,e.done),g={changes:[De(a,b)],generation:e.generation},e.done.push(g);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=f,e.lastOp=d,e.lastOrigin=e.lastSelOrigin=b.origin,h||Ze(a,"historyAdded")}function He(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 Ie(a,b,c,d){var e=a.history,f=d&&d.origin;c==e.lastOp||f&&e.lastSelOrigin==f&&(e.lastModTime==e.lastSelTime&&e.lastOrigin==f||He(a,f,qf(e.done),b))?e.done[e.done.length-1]=b:Je(b,e.done),e.lastSelTime=+new Date,e.lastSelOrigin=f,e.lastOp=c,d&&d.clearRedo!==!1&&Ee(e.undone)}function Je(a,b){var c=qf(b);c&&c.ranges&&c.equals(a)||b.push(a)}function Ke(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 Le(a){if(!a)return null;for(var c,b=0;b<a.length;++b)a[b].marker.explicitlyCleared?c||(c=a.slice(0,b)):c&&c.push(a[b]);return c?c.length?c:null:a}function Me(a,b){var c=b["spans_"+a.id];if(!c)return null;for(var d=0,e=[];d<b.text.length;++d)e.push(Le(c[d]));return e}function Ne(a,b,c){for(var d=0,e=[];d<a.length;++d){var f=a[d];if(f.ranges)e.push(c?ra.prototype.deepCopy.call(f):f);else{var g=f.changes,h=[];e.push({changes:h});for(var i=0;i<g.length;++i){var k,j=g[i];if(h.push({from:j.from,to:j.to,text:j.text}),b)for(var l in j)(k=l.match(/^spans_(\d+)$/))&&sf(b,Number(k[1]))>-1&&(qf(h)[l]=j[l],delete j[l])}}}return e}function Oe(a,b,c,d){c<a.line?a.line+=d:b<a.line&&(a.line=b,a.ch=0)}function Pe(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++)Oe(f.ranges[h].anchor,b,c,d),Oe(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=ma(i.from.line+d,i.from.ch),i.to=ma(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 Qe(a,b){var c=b.from.line,d=b.to.line,e=b.text.length-(d-c)-1;Pe(a.done,c,d,e),Pe(a.undone,c,d,e)}function Te(a){return null!=a.defaultPrevented?a.defaultPrevented:0==a.returnValue}function Ve(a){return a.target||a.srcElement}function We(a){var b=a.which;return null==b&&(1&a.button?b=1:2&a.button?b=3:4&a.button&&(b=2)),s&&a.ctrlKey&&1==b&&(b=3),b}function af(a,b){function e(a){return function(){a.apply(null,d)}}var c=a._handlers&&a._handlers[b];if(c){var d=Array.prototype.slice.call(arguments,2);$e||(++_e,$e=[],setTimeout(bf,0));for(var f=0;f<c.length;++f)$e.push(e(c[f]))}}function bf(){--_e;var a=$e;$e=null;for(var b=0;b<a.length;++b)a[b]()}function cf(a,b,c){return Ze(a,c||b.type,a,b),Te(b)||b.codemirrorIgnore}function df(a,b){var c=a._handlers&&a._handlers[b];return c&&c.length>0}function ef(a){a.prototype.on=function(a,b){Xe(this,a,b)},a.prototype.off=function(a,b){Ye(this,a,b)}}function lf(){this.id=null}function nf(a,b,c){for(var d=0,e=0;;){var f=a.indexOf("\t",d);f==-1&&(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 pf(a){for(;of.length<=a;)of.push(qf(of)+" ");return of[a]}function qf(a){return a[a.length-1]}function sf(a,b){for(var c=0;c<a.length;++c)if(a[c]==b)return c;return-1}function tf(a,b){for(var c=[],d=0;d<a.length;d++)c[d]=b(a[d],d);return c}function uf(a,b){var c;if(Object.create)c=Object.create(a);else{var d=function(){};d.prototype=a,c=new d}return b&&vf(b,c),c}function vf(a,b){b||(b={});for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}
3function wf(a){var b=Array.prototype.slice.call(arguments,1);return function(){return a.apply(null,b)}}function zf(a){for(var b in a)if(a.hasOwnProperty(b)&&a[b])return!1;return!0}function Bf(a){return a.charCodeAt(0)>=768&&Af.test(a)}function Cf(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 Ef(a){for(var b=a.childNodes.length;b>0;--b)a.removeChild(a.firstChild);return a}function Ff(a,b){return Ef(a).appendChild(b)}function Gf(a,b){if(a.contains)return a.contains(b);for(;b=b.parentNode;)if(b==a)return!0}function Hf(){return document.activeElement}function Kf(a){if(null!=Jf)return Jf;var b=Cf("div",null,null,"width: 50px; height: 50px; overflow-x: scroll");return Ff(a,b),b.offsetWidth&&(Jf=b.offsetHeight-b.clientHeight),Jf||0}function Mf(a){if(null==Lf){var b=Cf("span","?");Ff(a,Cf("span",[b,document.createTextNode("x")])),0!=a.firstChild.offsetHeight&&(Lf=b.offsetWidth<=1&&b.offsetHeight>2&&!c)}return Lf?Cf("span","?"):Cf("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px")}function Of(a){if(null!=Nf)return Nf;var b=Ff(a,document.createTextNode("A?A")),c=Df(b,0,1).getBoundingClientRect();if(c.left==c.right)return!1;var d=Df(b,1,2).getBoundingClientRect();return Nf=d.right-c.right<3}function Tf(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 Uf(a){return a.level%2?a.to:a.from}function Vf(a){return a.level%2?a.from:a.to}function Wf(a){var b=Be(a);return b?Uf(b[0]):0}function Xf(a){var b=Be(a);return b?Vf(qf(b)):a.text.length}function Yf(a,b){var c=ue(a.doc,b),d=Ld(c);d!=c&&(b=ye(d));var e=Be(d),f=e?e[0].level%2?Xf(d):Wf(d):0;return ma(b,f)}function Zf(a,b){for(var c,d=ue(a.doc,b);c=Jd(d);)d=c.find(1,!0).line,b=null;var e=Be(d),f=e?e[0].level%2?Wf(d):Xf(d):d.text.length;return ma(null==b?ye(d):b,f)}function $f(a,b,c){var d=a[0].level;return b==d||c!=d&&b<c}function ag(a,b){_f=null;for(var d,c=0;c<a.length;++c){var e=a[c];if(e.from<b&&e.to>b)return c;if(e.from==b||e.to==b){if(null!=d)return $f(a,e.level,a[d].level)?(e.from!=e.to&&(_f=d),c):(e.from!=e.to&&(_f=c),d);d=c}}return d}function bg(a,b,c,d){if(!d)return b+c;do b+=c;while(b>0&&Bf(a.text.charAt(b)));return b}function cg(a,b,c,d){var e=Be(a);if(!e)return dg(a,b,c,d);for(var f=ag(e,b),g=e[f],h=bg(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 ag(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?bg(a,g.to,-1,d):bg(a,g.from,1,d)}}function dg(a,b,c,d){var e=b+c;if(d)for(;e>0&&Bf(a.text.charAt(e));)e+=c;return e<0||e>a.text.length?null:e}var a=/gecko\/\d/i.test(navigator.userAgent),b=/MSIE \d/.test(navigator.userAgent),c=b&&(null==document.documentMode||document.documentMode<8),d=b&&(null==document.documentMode||document.documentMode<9),e=b&&(null==document.documentMode||document.documentMode<10),f=/Trident\/([7-9]|\d{2,})\./.test(navigator.userAgent),g=b||f,h=/WebKit\//.test(navigator.userAgent),i=h&&/Qt\/\d+\.\d+/.test(navigator.userAgent),j=/Chrome\//.test(navigator.userAgent),k=/Opera\//.test(navigator.userAgent),l=/Apple Computer/.test(navigator.vendor),m=/KHTML\//.test(navigator.userAgent),n=/Mac OS X 1\d\D([7-9]|\d\d)\D/.test(navigator.userAgent),o=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),p=/PhantomJS/.test(navigator.userAgent),q=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),r=q||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent),s=q||/Mac/.test(navigator.platform),t=/win/i.test(navigator.platform),u=k&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);u&&(u=Number(u[1])),u&&u>=15&&(k=!1,h=!0);var v=s&&(i||k&&(null==u||u<12.11)),w=a||g&&!d,x=!1,y=!1,ma=z.Pos=function(a,b){return this instanceof ma?(this.line=a,void(this.ch=b)):new ma(a,b)},na=z.cmpPos=function(a,b){return a.line-b.line||a.ch-b.ch};ra.prototype={primary:function(){return this.ranges[this.primIndex]}
3,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!=na(c.anchor,d.anchor)||0!=na(c.head,d.head))return!1}return!0},deepCopy:function(){for(var a=[],b=0;b<this.ranges.length;b++)a[b]=new sa(oa(this.ranges[b].anchor),oa(this.ranges[b].head));return new ra(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(na(b,d.from())>=0&&na(a,d.to())<=0)return c}return-1}},sa.prototype={from:function(){return qa(this.anchor,this.head)},to:function(){return pa(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}};var sb,Wb,Xb,db={left:0,right:0,top:0,bottom:0},vb=0,bc=0,gc=0,hc=null;g?hc=-.53:a?hc=15:j?hc=-.7:l&&(hc=-1/3);var lc,uc,oc=null,xc=z.changeEnd=function(a){return a.text?ma(a.from.line+a.text.length-1,qf(a.text).length+(1==a.text.length?a.from.ch:0)):a.to};z.prototype={constructor:z,focus:function(){window.focus(),Pb(this),Mb(this)},setOption:function(a,b){var c=this.options,d=c[a];c[a]==b&&"mode"!=a||(c[a]=b,Yc.hasOwnProperty(a)&&zb(this,Yc[a])(this,b,d))},getOption:function(a){return this.options[a]},getDoc:function(){return this.doc},addKeyMap:function(a,b){this.state.keyMaps[b?"push":"unshift"](a)},removeKeyMap:function(a){for(var b=this.state.keyMaps,c=0;c<b.length;++c)if(b[c]==a||"string"!=typeof b[c]&&b[c].name==a)return b.splice(c,1),!0},addOverlay:Ab(function(a,b){var c=a.token?a:z.getMode(this.options,a);if(c.startState)throw new Error("Overlays may not be stateful.");this.state.overlays.push({mode:c,modeSpec:a,opaque:b&&b.opaque}),this.state.modeGen++,Eb(this)}),removeOverlay:Ab(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 Eb(this)}}),indentLine:Ab(function(a,b,c){"string"!=typeof b&&"number"!=typeof b&&(b=null==b?this.options.smartIndent?"smart":"prev":b?"add":"subtract"),ya(this.doc,a)&&Rc(this,a,b,c)}),indentSelection:Ab(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&&(Rc(this,e.head.line,a,!0),c=e.head.line,d==this.doc.sel.primIndex&&Pc(this));else{var f=Math.max(c,e.from().line),g=e.to();c=Math.min(this.lastLine(),g.line-(g.ch?0:1))+1;for(var h=f;h<c;++h)Rc(this,h,a)}}}),getTokenAt:function(a,b){var c=this.doc;a=wa(c,a);for(var d=Ua(this,a.line,b),e=this.doc.mode,f=ue(c,a.line),g=new md(f.text,this.options.tabSize);g.pos<a.ch&&!g.eol();){g.start=g.pos;var h=e.token(g,d)}return{start:g.start,end:g.pos,string:g.current(),type:h||null,state:d}},getTokenTypeAt:function(a){a=wa(this.doc,a);var b=$d(this,ue(this.doc,a.line)),c=0,d=(b.length-1)/2,e=a.ch;if(0==e)return b[2];for(;;){var f=c+d>>1;if((f?b[2*f-1]:0)>=e)d=f;else{if(!(b[2*f+1]<e))return b[2*f+2];c=f+1}}},getModeAt:function(a){var b=this.doc.mode;return b.innerMode?z.innerMode(b,this.getTokenAt(a).state).mode:b},getHelper:function(a,b){return this.getHelpers(a,b)[0]},getHelpers:function(a,b){var c=[];if(!dd.hasOwnProperty(b))return dd;var d=dd[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)&&sf(c,h.val)==-1&&c.push(h.val)}return c},getStateAfter:function(a,b){var c=this.doc;return a=va(c,null==a?c.first+c.size-1:a),Ua(this,a+1,b)},cursorCoords:function(a,b){var c,d=this.doc.sel.primary();return c=null==a?d.head:"object"==typeof a?wa(this.doc,a):a?d.from():d.to(),nb(this,c,b||"page")},charCoords:function(a,b){return mb(this,wa(this.doc,a),b||"page")},coordsChar:function(a,b){return a=lb(this,a,b||"page"),qb(this,a.left,a.top)},lineAtHeight:function(a,b){return a=lb(this,{top:a,left:0},b||"page").top,ze(this.doc,a+this.display.viewOffset)},heightAtLine:function(a,b){var c=!1,d=this.doc.first+this.doc.size-1;a<this.doc.first?a=this.doc.first:a>d&&(a=d,c=!0);var e=ue(this.doc,a);return kb(this,e,{top:0,left:0},b||"page").top+(c?this.doc.height-Ae(e):0)},defaultTextHeight:function(){return tb(this.display)},defaultCharWidth:function(){return ub(this.display)},setGutterMarker:Ab(function(a,b,c){return Sc(this,a,"gutter",function(a){var d=a.gutterMarkers||(a.gutterMarkers={});return d[b]=c,!c&&zf(d)&&(a.gutterMarkers=null),!0})}),clearGutter:Ab(function(a){var b=this,c=b.doc,d=c.first;c.iter(function(c){c.gutterMarkers&&c.gutterMarkers[a]&&(c.gutterMarkers[a]=null,Fb(b,d,"gutter"),zf(c.gutterMarkers)&&(c.gutterMarkers=null)),++d})}),addLineClass:Ab(function(a,b,c){return Sc(this,a,"class",function(a){var d="text"==b?"textClass":"background"==b?"bgClass":"wrapClass";if(a[d]){if(new RegExp("(?:^|\\s)"+c+"(?:$|\\s)").test(a[d]))return!1;a[d]+=" "+c}else a[d]=c;return!0})}),removeLineClass:Ab(function(a,b,c){return Sc(this,a,"class",function(a){var d="text"==b?"textClass":"background"==b?"bgClass":"wrapClass",e=a[d];if(!e)return!1;if(null==c)a[d]=null;else{var f=e.match(new RegExp("(?:^|\\s+)"+c+"(?:$|\\s+)"));if(!f)return!1;var g=f.index+f[0].length;a[d]=e.slice(0,f.index)+(f.index&&g!=e.length?" ":"")+e.slice(g)||null}return!0})}),addLineWidget:Ab(function(a,b,c){return Ud(this,a,b,c)}),removeLineWidget:function(a){a.clear()}
3,lineInfo:function(a){if("number"==typeof a){if(!ya(this.doc,a))return null;var b=a;if(a=ue(this.doc,a),!a)return null}else{var b=ye(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=nb(this,wa(this.doc,a));var g=a.bottom,h=a.left;if(b.style.position="absolute",f.sizer.appendChild(b),"over"==d)g=a.top;else if("above"==d||"near"==d){var i=Math.max(f.wrapper.clientHeight,this.doc.height),j=Math.max(f.sizer.clientWidth,f.lineSpace.clientWidth);("above"==d||a.bottom+b.offsetHeight>i)&&a.top>b.offsetHeight?g=a.top-b.offsetHeight:a.bottom+b.offsetHeight<=i&&(g=a.bottom),h+b.offsetWidth>j&&(h=j-b.offsetWidth)}b.style.top=g+"px",b.style.left=b.style.right="","right"==e?(h=f.sizer.clientWidth-b.offsetWidth,b.style.right="0px"):("left"==e?h=0:"middle"==e&&(h=(f.sizer.clientWidth-b.offsetWidth)/2),b.style.left=h+"px"),c&&Mc(this,h,g,h+b.offsetWidth,g+b.offsetHeight)},triggerOnKeyDown:Ab(pc),triggerOnKeyPress:Ab(rc),triggerOnKeyUp:Ab(qc),execCommand:function(a){if(gd.hasOwnProperty(a))return gd[a](this)},findPosH:function(a,b,c,d){var e=1;b<0&&(e=-1,b=-b);for(var f=0,g=wa(this.doc,a);f<b&&(g=Uc(this.doc,g,e,c,d),!g.hitSide);++f);return g},moveH:Ab(function(a,b){var c=this;c.extendSelectionsBy(function(d){return c.display.shift||c.doc.extend||d.empty()?Uc(c.doc,d.head,a,b,c.options.rtlMoveVisually):a<0?d.from():d.to()},kf)}),deleteH:Ab(function(a,b){var c=this.doc.sel,d=this.doc;c.somethingSelected()?d.replaceSelection("",null,"+delete"):Tc(this,function(c){var e=Uc(d,c.head,a,b,!1);return a<0?{from:e,to:c.head}:{from:c.head,to:e}})}),findPosV:function(a,b,c,d){var e=1,f=d;b<0&&(e=-1,b=-b);for(var g=0,h=wa(this.doc,a);g<b;++g){var i=nb(this,h,"div");if(null==f?f=i.left:i.left=f,h=Vc(this,i,e,c),h.hitSide)break}return h},moveV:Ab(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 a<0?g.from():g.to();var h=nb(c,g.head,"div");null!=g.goalColumn&&(h.left=g.goalColumn),e.push(h.left);var i=Vc(c,h,a,b);return"page"==b&&g==d.sel.primary()&&Oc(c,null,mb(c,i,"div").top-h.top),i},kf),e.length)for(var g=0;g<d.sel.ranges.length;g++)d.sel.ranges[g].goalColumn=e[g]}),toggleOverwrite:function(a){null!=a&&a==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?this.display.cursorDiv.className+=" CodeMirror-overwrite":this.display.cursorDiv.className=this.display.cursorDiv.className.replace(" CodeMirror-overwrite",""),Ze(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return Hf()==this.display.input},scrollTo:Ab(function(a,b){null==a&&null==b||Qc(this),null!=a&&(this.curOp.scrollLeft=a),null!=b&&(this.curOp.scrollTop=b)}),getScrollInfo:function(){var a=this.display.scroller,b=ff;return{left:a.scrollLeft,top:a.scrollTop,height:a.scrollHeight-b,width:a.scrollWidth-b,clientHeight:a.clientHeight-b,clientWidth:a.clientWidth-b}},scrollIntoView:Ab(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:ma(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)Qc(this),this.curOp.scrollToPos=a;else{var c=Nc(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:Ab(function(a,b){function c(a){return"number"==typeof a||/^\d+$/.test(String(a))?a+"px":a}null!=a&&(this.display.wrapper.style.width=c(a)),null!=b&&(this.display.wrapper.style.height=c(b)),this.options.lineWrapping&&gb(this),this.curOp.forceUpdate=!0,Ze(this,"refresh",this)}),operation:function(a){return yb(this,a)},refresh:Ab(function(){var a=this.display.cachedTextHeight;Eb(this),hb(this),this.scrollTo(this.doc.scrollLeft,this.doc.scrollTop),(null==a||Math.abs(a-tb(this.display))>.5)&&F(this),Ze(this,"refresh",this)}),swapDoc:Ab(function(a){var b=this.doc;return b.cm=null,te(this,a),hb(this),Ob(this),this.scrollTo(a.scrollLeft,a.scrollTop),af(this,"swapDoc",this,b),b}),getInputField:function(){return this.display.input},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},ef(z);var Xc=z.defaults={}
3,Yc=z.optionHandlers={},$c=z.Init={toString:function(){return"CodeMirror.Init"}};Zc("value","",function(a,b){a.setValue(b)},!0),Zc("mode",null,function(a,b){a.doc.modeOption=b,B(a)},!0),Zc("indentUnit",2,B,!0),Zc("indentWithTabs",!1),Zc("smartIndent",!0),Zc("tabSize",4,function(a){C(a),hb(a),Eb(a)},!0),Zc("specialChars",/[\t\u0000-\u0019\u00ad\u200b\u2028\u2029\ufeff]/g,function(a,b){a.options.specialChars=new RegExp(b.source+(b.test("\t")?"":"|\t"),"g"),a.refresh()},!0),Zc("specialCharPlaceholder",ee,function(a){a.refresh()},!0),Zc("electricChars",!0),Zc("rtlMoveVisually",!t),Zc("wholeLineUpdateBefore",!0),Zc("theme","default",function(a){H(a),I(a)},!0),Zc("keyMap","default",G),Zc("extraKeys",null),Zc("lineWrapping",!1,D,!0),Zc("gutters",[],function(a){M(a.options),I(a)},!0),Zc("fixedGutter",!0,function(a,b){a.display.gutters.style.left=b?T(a.display)+"px":"0",a.refresh()},!0),Zc("coverGutterNextToScrollbar",!1,O,!0),Zc("lineNumbers",!1,function(a){M(a.options),I(a)},!0),Zc("firstLineNumber",1,I,!0),Zc("lineNumberFormatter",function(a){return a},I,!0),Zc("showCursorWhenSelecting",!1,Na,!0),Zc("resetSelectionOnContextMenu",!0),Zc("readOnly",!1,function(a,b){"nocursor"==b?(tc(a),a.display.input.blur(),a.display.disabled=!0):(a.display.disabled=!1,b||Ob(a))}),Zc("disableInput",!1,function(a,b){b||Ob(a)},!0),Zc("dragDrop",!0),Zc("cursorBlinkRate",530),Zc("cursorScrollMargin",0),Zc("cursorHeight",1),Zc("workTime",100),Zc("workDelay",100),Zc("flattenSpans",!0,C,!0),Zc("addModeClass",!1,C,!0),Zc("pollInterval",100),Zc("undoDepth",200,function(a,b){a.doc.history.undoDepth=b}),Zc("historyEventDelay",1250),Zc("viewportMargin",10,function(a){a.refresh()},!0),Zc("maxHighlightLength",1e4,C,!0),Zc("moveInputWithCursor",!0,function(a,b){b||(a.display.inputDiv.style.top=a.display.inputDiv.style.left=0)}),Zc("tabindex",null,function(a,b){a.display.input.tabIndex=b||""}),Zc("autofocus",null);var _c=z.modes={},ad=z.mimeModes={};z.defineMode=function(a,b){if(z.defaults.mode||"null"==a||(z.defaults.mode=a),arguments.length>2){b.dependencies=[];for(var c=2;c<arguments.length;++c)b.dependencies.push(arguments[c])}_c[a]=b},z.defineMIME=function(a,b){ad[a]=b},z.resolveMode=function(a){if("string"==typeof a&&ad.hasOwnProperty(a))a=ad[a];else if(a&&"string"==typeof a.name&&ad.hasOwnProperty(a.name)){var b=ad[a.name];"string"==typeof b&&(b={name:b}),a=uf(b,a),a.name=b.name}else if("string"==typeof a&&/^[\w\-]+\/[\w\-]+\+xml$/.test(a))return z.resolveMode("application/xml");return"string"==typeof a?{name:a}:a||{name:"null"}},z.getMode=function(a,b){var b=z.resolveMode(b),c=_c[b.name];if(!c)return z.getMode(a,"text/plain");var d=c(a,b);if(bd.hasOwnProperty(b.name)){var e=bd[b.name];for(var f in e)e.hasOwnProperty(f)&&(d.hasOwnProperty(f)&&(d["_"+f]=d[f]),d[f]=e[f])}if(d.name=b.name,b.helperType&&(d.helperType=b.helperType),b.modeProps)for(var f in b.modeProps)d[f]=b.modeProps[f];return d},z.defineMode("null",function(){return{token:function(a){a.skipToEnd()}}}),z.defineMIME("text/plain","null");var bd=z.modeExtensions={};z.extendMode=function(a,b){var c=bd.hasOwnProperty(a)?bd[a]:bd[a]={};vf(b,c)},z.defineExtension=function(a,b){z.prototype[a]=b},z.defineDocExtension=function(a,b){pe.prototype[a]=b},z.defineOption=Zc;var cd=[];z.defineInitHook=function(a){cd.push(a)};var dd=z.helpers={};z.registerHelper=function(a,b,c){dd.hasOwnProperty(a)||(dd[a]=z[a]={_global:[]}),dd[a][b]=c},z.registerGlobalHelper=function(a,b,c,d){z.registerHelper(a,b,d),dd[a]._global.push({pred:c,val:d})};var ed=z.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},fd=z.startState=function(a,b,c){return!a.startState||a.startState(b,c)};z.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 gd=z.commands={selectAll:function(a){a.setSelection(ma(a.firstLine(),0),ma(a.lastLine()),hf); 4},singleSelection:function(a){a.setSelection(a.getCursor("anchor"),a.getCursor("head"),hf)},killLine:function(a){Tc(a,function(b){if(b.empty()){var c=ue(a.doc,b.head.line).text.length;return b.head.ch==c&&b.head.line<a.lastLine()?{from:b.head,to:ma(b.head.line+1,0)}:{from:b.head,to:ma(b.head.line,c)}}return{from:b.from(),to:b.to()}})},deleteLine:function(a){Tc(a,function(b){return{from:ma(b.from().line,0),to:wa(a.doc,ma(b.to().line+1,0))}})},delLineLeft:function(a){Tc(a,function(a){return{from:ma(a.from().line,0),to:a.from()}})},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(ma(a.firstLine(),0))}
4,goDocEnd:function(a){a.extendSelection(ma(a.lastLine()))},goLineStart:function(a){a.extendSelectionsBy(function(b){return Yf(a,b.head.line)},kf)},goLineStartSmart:function(a){a.extendSelectionsBy(function(b){var c=Yf(a,b.head.line),d=a.getLineHandle(c.line),e=Be(d);if(!e||0==e[0].level){var f=Math.max(0,d.text.search(/\S/)),g=b.head.line==c.line&&b.head.ch<=f&&b.head.ch;return ma(c.line,g?0:f)}return c},kf)},goLineEnd:function(a){a.extendSelectionsBy(function(b){return Zf(a,b.head.line)},kf)},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")},kf)},goLineLeft:function(a){a.extendSelectionsBy(function(b){var c=a.charCoords(b.head,"div").top+5;return a.coordsChar({left:0,top:c},"div")},kf)},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("\t")},defaultTab:function(a){a.somethingSelected()?a.indentSelection("add"):a.execCommand("insertTab")},transposeChars:function(a){yb(a,function(){for(var b=a.listSelections(),c=0;c<b.length;c++){var d=b[c].head,e=ue(a.doc,d.line).text;d.ch>0&&d.ch<e.length-1&&a.replaceRange(e.charAt(d.ch)+e.charAt(d.ch-1),ma(d.line,d.ch-1),ma(d.line,d.ch+1))}})},newlineAndIndent:function(a){yb(a,function(){for(var b=a.listSelections().length,c=0;c<b;c++){var d=a.listSelections()[c];a.replaceRange("\n",d.anchor,d.head,"+input"),a.indentLine(d.from().line+1,null,!0),Pc(a)}})},toggleOverwrite:function(a){a.toggleOverwrite()}},hd=z.keyMap={};hd.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"},hd.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-Up":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Down":"goDocEnd","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"},hd.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineStart","Cmd-Right":"goLineEnd","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":"delLineLeft","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection",fallthrough:["basic","emacsy"]},hd.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"},hd.default=s?hd.macDefault:hd.pcDefault;var jd=z.lookupKey=function(a,b,c){function d(b){b=id(b);var e=b[a];if(e===!1)return"stop";if(null!=e&&c(e))return!0;
4if(b.nofallthrough)return"stop";var f=b.fallthrough;if(null==f)return!1;if("[object Array]"!=Object.prototype.toString.call(f))return d(f);for(var g=0;g<f.length;++g){var h=d(f[g]);if(h)return h}return!1}for(var e=0;e<b.length;++e){var f=d(b[e]);if(f)return"stop"!=f}},kd=z.isModifierKey=function(a){var b=Sf[a.keyCode];return"Ctrl"==b||"Alt"==b||"Shift"==b||"Mod"==b},ld=z.keyName=function(a,b){if(k&&34==a.keyCode&&a.char)return!1;var c=Sf[a.keyCode];return null!=c&&!a.altGraphKey&&(a.altKey&&(c="Alt-"+c),(v?a.metaKey:a.ctrlKey)&&(c="Ctrl-"+c),(v?a.ctrlKey:a.metaKey)&&(c="Cmd-"+c),!b&&a.shiftKey&&(c="Shift-"+c),c)};z.fromTextArea=function(a,b){function d(){a.value=h.getValue()}if(b||(b={}),b.value=a.value,!b.tabindex&&a.tabindex&&(b.tabindex=a.tabindex),!b.placeholder&&a.placeholder&&(b.placeholder=a.placeholder),null==b.autofocus){var c=Hf();b.autofocus=c==a||null!=a.getAttribute("autofocus")&&c==document.body}if(a.form&&(Xe(a.form,"submit",d),!b.leaveSubmitMethodAlone)){var e=a.form,f=e.submit;try{var g=e.submit=function(){d(),e.submit=f,e.submit(),e.submit=g}}catch(a){}}a.style.display="none";var h=z(function(b){a.parentNode.insertBefore(b,a.nextSibling)},b);return h.save=d,h.getTextArea=function(){return a},h.toTextArea=function(){d(),a.parentNode.removeChild(h.getWrapperElement()),a.style.display="",a.form&&(Ye(a.form,"submit",d),"function"==typeof a.form.submit&&(a.form.submit=f))},h};var md=z.StringStream=function(a,b){this.pos=this.start=0,this.string=a,this.tabSize=b||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0};md.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(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},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));if(c)return++this.pos,b},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);if(b>-1)return this.pos=b,!0},backUp:function(a){this.pos-=a},column:function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=mf(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?mf(this.string,this.lineStart,this.tabSize):0)},indentation:function(){return mf(this.string,null,this.tabSize)-(this.lineStart?mf(this.string,this.lineStart,this.tabSize):0)},match:function(a,b,c){if("string"!=typeof a){var f=this.string.slice(this.pos).match(a);return f&&f.index>
40?null:(f&&b!==!1&&(this.pos+=f[0].length),f)}var d=function(a){return c?a.toLowerCase():a},e=this.string.substr(this.pos,a.length);if(d(e)==d(a))return b!==!1&&(this.pos+=a.length),!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 nd=z.TextMarker=function(a,b){this.lines=[],this.type=b,this.doc=a};ef(nd),nd.prototype.clear=function(){if(!this.explicitlyCleared){var a=this.doc.cm,b=a&&!a.curOp;if(b&&wb(a),df(this,"clear")){var c=this.find();c&&af(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=td(g.markedSpans,this);a&&!this.collapsed?Fb(a,ye(g),"text"):a&&(null!=h.to&&(e=ye(g)),null!=h.from&&(d=ye(g))),g.markedSpans=ud(g.markedSpans,h),null==h.from&&this.collapsed&&!Pd(this.doc,g)&&a&&xe(g,tb(a.display))}if(a&&this.collapsed&&!a.options.lineWrapping)for(var f=0;f<this.lines.length;++f){var i=Ld(this.lines[f]),j=K(i);j>a.display.maxLineLength&&(a.display.maxLine=i,a.display.maxLineLength=j,a.display.maxLineChanged=!0)}null!=d&&a&&this.collapsed&&Eb(a,d,e+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,a&&Ka(a.doc)),a&&af(a,"markerCleared",a,this),b&&xb(a)}},nd.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=td(f.markedSpans,this);if(null!=g.from&&(c=ma(b?f:ye(f),g.from),a==-1))return c;if(null!=g.to&&(d=ma(b?f:ye(f),g.to),1==a))return d}return c&&{from:c,to:d}},nd.prototype.changed=function(){var a=this.find(-1,!0),b=this,c=this.doc.cm;a&&c&&yb(c,function(){var d=a.line,e=ye(a.line),f=ab(c,e);if(f&&(fb(f),c.curOp.selectionChanged=c.curOp.forceUpdate=!0),c.curOp.updateMaxLine=!0,!Pd(b.doc,d)&&null!=b.height){var g=b.height;b.height=null;var h=Td(b)-g;h&&xe(d,d.height+h)}})},nd.prototype.attachLine=function(a){if(!this.lines.length&&this.doc.cm){var b=this.doc.cm.curOp;b.maybeHiddenMarkers&&sf(b.maybeHiddenMarkers,this)!=-1||(b.maybeUnhiddenMarkers||(b.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(a)},nd.prototype.detachLine=function(a){if(this.lines.splice(sf(this.lines,a),1),!this.lines.length&&this.doc.cm){var b=this.doc.cm.curOp;(b.maybeHiddenMarkers||(b.maybeHiddenMarkers=[])).push(this)}};var od=0,qd=z.SharedTextMarker=function(a,b){this.markers=a,this.primary=b;for(var c=0,d=this;c<a.length;++c)a[c].parent=this,Xe(a[c],"clear",function(){d.clear()})};ef(qd),qd.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var a=0;a<this.markers.length;++a)this.markers[a].clear();af(this,"clear")}},qd.prototype.find=function(a,b){return this.primary.find(a,b)};var Rd=z.LineWidget=function(a,b,c){if(c)for(var d in c)c.hasOwnProperty(d)&&(this[d]=c[d]);this.cm=a,this.node=b};ef(Rd),Rd.prototype.clear=function(){var a=this.cm,b=this.line.widgets,c=this.line,d=ye(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=Td(this);yb(a,function(){Sd(a,c,-f),Fb(a,d,"widget"),xe(c,Math.max(0,c.height-f))})}},Rd.prototype.changed=function(){var a=this.height,b=this.cm,c=this.line;this.height=null;var d=Td(this)-a;d&&yb(b,function(){b.curOp.forceUpdate=!0,Sd(b,c,d),xe(c,c.height+d)})};var Vd=z.Line=function(a,b,c){this.text=a,Dd(this,b),this.height=c?c(this):1};ef(Vd),Vd.prototype.lineNo=function(){return ye(this)};var ae={},be={};me.prototype={chunkSize:function(){return this.lines.length},removeInner:function(a,b){for(var c=a,d=a+b;c<d;++c){var e=this.lines[c];this.height-=e.height,Xd(e),af(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;a<d;++a)if(c(this.lines[a]))return!0}},ne.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(a<e){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 me))){var h=[];this.collapse(h),this.children=[new me(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(a<=f){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 me(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 ne(b);if(a.parent){a.size-=c.size,a.height-=c.height;
4var e=sf(a.parent.children,a);a.parent.children.splice(e+1,0,c)}else{var d=new ne(a.children);d.parent=a,a.children=[d,c],a=d}c.parent=a.parent}while(a.children.length>10);a.parent.maybeSpill()}},iterN:function(a,b,c){for(var d=0;d<this.children.length;++d){var e=this.children[d],f=e.chunkSize();if(a<f){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 oe=0,pe=z.Doc=function(a,b,c){if(!(this instanceof pe))return new pe(a,b,c);null==c&&(c=0),ne.call(this,[new me([new Vd("",null)])]),this.first=c,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.frontier=c;var d=ma(c,0);this.sel=ua(d),this.history=new Ce(null),this.id=++oe,this.modeOption=b,"string"==typeof a&&(a=Pf(a)),le(this,{from:d,to:d,text:a}),Ha(this,ua(d),hf)};pe.prototype=uf(ne.prototype,{constructor:pe,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=we(this,this.first,this.first+this.size);return a===!1?b:b.join(a||"\n")},setValue:Bb(function(a){var b=ma(this.first,0),c=this.first+this.size-1;Dc(this,{from:b,to:ma(c,ue(this,c).text.length),text:Pf(a),origin:"setValue"},!0),Ha(this,ua(b))}),replaceRange:function(a,b,c,d){b=wa(this,b),c=c?wa(this,c):b,Jc(this,a,b,c,d)},getRange:function(a,b,c){var d=ve(this,wa(this,a),wa(this,b));return c===!1?d:d.join(c||"\n")},getLine:function(a){var b=this.getLineHandle(a);return b&&b.text},getLineHandle:function(a){if(ya(this,a))return ue(this,a)},getLineNumber:function(a){return ye(a)},getLineHandleVisualStart:function(a){return"number"==typeof a&&(a=ue(this,a)),Ld(a)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(a){return wa(this,a)},getCursor:function(a){var c,b=this.sel.primary();return c=null==a||"head"==a?b.head:"anchor"==a?b.anchor:"end"==a||"to"==a||a===!1?b.to():b.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Bb(function(a,b,c){Ea(this,wa(this,"number"==typeof a?ma(a,b||0):a),null,c)}),setSelection:Bb(function(a,b,c){Ea(this,wa(this,a),wa(this,b||a),c)}),extendSelection:Bb(function(a,b,c){Ba(this,wa(this,a),b&&wa(this,b),c)}),extendSelections:Bb(function(a,b){Ca(this,za(this,a,b))}),extendSelectionsBy:Bb(function(a,b){Ca(this,tf(this.sel.ranges,a),b)}),setSelections:Bb(function(a,b,c){if(a.length){for(var d=0,e=[];d<a.length;d++)e[d]=new sa(wa(this,a[d].anchor),wa(this,a[d].head));null==b&&(b=Math.min(a.length-1,this.sel.primIndex)),Ha(this,ta(e,b),c)}}),addSelection:Bb(function(a,b,c){var d=this.sel.ranges.slice(0);d.push(new sa(wa(this,a),wa(this,b||a))),Ha(this,ta(d,d.length-1),c)}),getSelection:function(a){for(var c,b=this.sel.ranges,d=0;d<b.length;d++){var e=ve(this,b[d].from(),b[d].to());c=c?c.concat(e):e}return a===!1?c:c.join(a||"\n")},getSelections:function(a){for(var b=[],c=this.sel.ranges,d=0;d<c.length;d++){var e=ve(this,c[d].from(),c[d].to());a!==!1&&(e=e.join(a||"\n")),b[d]=e}return b},replaceSelection:Bb(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: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:Pf(a[f]),origin:c}}for(var h=b&&"end"!=b&&Bc(this,d,b),f=d.length-1;f>=0;f--)Dc(this,d[f]);h?Ga(this,h):this.cm&&Pc(this.cm)},undo:Bb(function(){Fc(this,"undo")}),redo:Bb(function(){Fc(this,"redo")}),undoSelection:Bb(function(){Fc(this,"undo",!0)}),redoSelection:Bb(function(){Fc(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 Ce(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(a){return a&&(this.history.lastOp=this.history.lastOrigin=null),this.history.generation},isClean:function(a){return this.history.generation==(a||this.cleanGeneration)},getHistory:function(){return{done:Ne(this.history.done),undone:Ne(this.history.undone)}},setHistory:function(a){var b=this.history=new Ce(this.history.maxGeneration);b.done=Ne(a.done.slice(0),null,!0),b.undone=Ne(a.undone.slice(0),null,!0)},markText:function(a,b,c){return pd(this,wa(this,a),wa(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};return a=wa(this,a),pd(this,a,a,c,"bookmark")},findMarksAt:function(a){a=wa(this,a);var b=[],c=ue(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){a=wa(this,a),b=wa(this,b);var c=[],d=a.line;return this.iter(a.line,b.line+1,function(e){var f=e.markedSpans;if(f)for(var g=0;g<f.length;g++){var h=f[g];d==a.line&&a.ch>h.to||null==h.from&&d!=a.line||d==b.line&&h.from>b.ch||c.push(h.marker.parent||h.marker)}++d}),c},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)}),wa(this,ma(c,b))},indexFromPos:function(a){a=wa(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 pe(we(this,this.first,this.first+this.size),this.modeOption,this.first);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 pe(we(this,b,c),a.mode||this.modeOption,b);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}],d}
4,unlinkDoc:function(a){if(a instanceof z&&(a=a.doc),this.linked)for(var b=0;b<this.linked.length;++b){var c=this.linked[b];if(c.doc==a){this.linked.splice(b,1),a.unlinkDoc(this);break}}if(a.history==this.history){var d=[a.id];se(a,function(a){d.push(a.id)},!0),a.history=new Ce(null),a.history.done=Ne(this.history.done,d),a.history.undone=Ne(this.history.undone,d)}},iterLinkedDocs:function(a){se(this,a)},getMode:function(){return this.mode},getEditor:function(){return this.cm}}),pe.prototype.eachLine=pe.prototype.iter;var qe="iter insert remove copy getEditor".split(" ");for(var re in pe.prototype)pe.prototype.hasOwnProperty(re)&&sf(qe,re)<0&&(z.prototype[re]=function(a){return function(){return a.apply(this.doc,arguments)}}(pe.prototype[re]));ef(pe);var $e,Re=z.e_preventDefault=function(a){a.preventDefault?a.preventDefault():a.returnValue=!1},Se=z.e_stopPropagation=function(a){a.stopPropagation?a.stopPropagation():a.cancelBubble=!0},Ue=z.e_stop=function(a){Re(a),Se(a)},Xe=z.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)}},Ye=z.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}}},Ze=z.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)},_e=0,ff=30,gf=z.Pass={toString:function(){return"CodeMirror.Pass"}},hf={scroll:!1},jf={origin:"*mouse"},kf={origin:"+move"};lf.prototype.set=function(a,b){clearTimeout(this.id),this.id=setTimeout(b,a)};var mf=z.countColumn=function(a,b,c,d,e){null==b&&(b=a.search(/[^\s\u00a0]/),b==-1&&(b=a.length));for(var f=d||0,g=e||0;;){var h=a.indexOf("\t",f);if(h<0||h>=b)return g+(b-f);g+=h-f,g+=c-g%c,f=h+1}},of=[""],rf=function(a){a.select()};q?rf=function(a){a.selectionStart=0,a.selectionEnd=a.value.length}:g&&(rf=function(a){try{a.select()}catch(a){}}),[].indexOf&&(sf=function(a,b){return a.indexOf(b)}),[].map&&(tf=function(a,b){return a.map(b)});var Df,xf=/[\u00df\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,yf=z.isWordChar=function(a){return/\w/.test(a)||a>"?"&&(a.toUpperCase()!=a.toLowerCase()||xf.test(a))},Af=/[\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]/;Df=document.createRange?function(a,b,c){var d=document.createRange();return d.setEnd(a,c),d.setStart(a,b),d}:function(a,b,c){var d=document.body.createTextRange();return d.moveToElementText(a.parentNode),d.collapse(!0),d.moveEnd("character",c),d.moveStart("character",b),d},b&&(Hf=function(){try{return document.activeElement}catch(a){return document.body}});var Jf,Lf,Nf,If=function(){if(d)return!1;var a=Cf("div");return"draggable"in a||"dragDrop"in a}(),Pf=z.splitLines=3!="\n\nb".split(/\n/).length?function(a){for(var b=0,c=[],d=a.length;b<=d;){var e=a.indexOf("\n",b);e==-1&&(e=a.length);var f=a.slice(b,"\r"==a.charAt(e-1)?e-1:e),g=f.indexOf("\r");g!=-1?(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/)},Qf=window.getSelection?function(a){try{return a.selectionStart!=a.selectionEnd}catch(a){return!1}}:function(a){try{var b=a.ownerDocument.selection.createRange()}catch(a){}return!(!b||b.parentElement()!=a)&&0!=b.compareEndPoints("StartToEnd",b)},Rf=function(){var a=Cf("div");return"oncopy"in a||(a.setAttribute("oncopy","return;"),"function"==typeof a.oncopy)}(),Sf={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"};z.keyNames=Sf,function(){for(var a=0;a<10;a++)Sf[a+48]=Sf[a+96]=String(a);for(var a=65;a<=90;a++)Sf[a]=String.fromCharCode(a);for(var a=1;a<=12;a++)Sf[a+111]=Sf[a+63235]="F"+a}();var _f,eg=function(){function c(c){return c<=247?a.charAt(c):1424<=c&&c<=1524?"R":1536<=c&&
4c<=1773?b.charAt(c-1536):1774<=c&&c<=2220?"r":8192<=c&&c<=8203?"w":8204==c?"b":"L"}function j(a,b,c){this.level=a,this.from=b,this.to=c}var a="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",b="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm",d=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,e=/[stwN]/,f=/[LRr]/,g=/[Lb1n]/,h=/[1n]/,i="L";return function(a){if(!d.test(a))return!1;for(var m,b=a.length,k=[],l=0;l<b;++l)k.push(m=c(a.charCodeAt(l)));for(var l=0,n=i;l<b;++l){var m=k[l];"m"==m?k[l]=n:n=m}for(var l=0,o=i;l<b;++l){var m=k[l];"1"==m&&"r"==o?k[l]="n":f.test(m)&&(o=m,"r"==m&&(k[l]="R"))}for(var l=1,n=k[0];l<b-1;++l){var m=k[l];"+"==m&&"1"==n&&"1"==k[l+1]?k[l]="1":","!=m||n!=k[l+1]||"1"!=n&&"n"!=n||(k[l]=n),n=m}for(var l=0;l<b;++l){var m=k[l];if(","==m)k[l]="N";else if("%"==m){for(var p=l+1;p<b&&"%"==k[p];++p);for(var q=l&&"!"==k[l-1]||p<b&&"1"==k[p]?"1":"N",r=l;r<p;++r)k[r]=q;l=p-1}}for(var l=0,o=i;l<b;++l){var m=k[l];"L"==o&&"1"==m?k[l]="L":f.test(m)&&(o=m)}for(var l=0;l<b;++l)if(e.test(k[l])){for(var p=l+1;p<b&&e.test(k[p]);++p);for(var s="L"==(l?k[l-1]:i),t="L"==(p<b?k[p]:i),q=s||t?"L":"R",r=l;r<p;++r)k[r]=q;l=p-1}for(var v,u=[],l=0;l<b;)if(g.test(k[l])){var w=l;for(++l;l<b&&g.test(k[l]);++l);u.push(new j(0,w,l))}else{var x=l,y=u.length;for(++l;l<b&&"L"!=k[l];++l);for(var r=x;r<l;)if(h.test(k[r])){x<r&&u.splice(y,0,new j(1,x,r));var z=r;for(++r;r<l&&h.test(k[r]);++r);u.splice(y,0,new j(2,z,r)),x=r}else++r;x<l&&u.splice(y,0,new j(1,x,l))}return 1==u[0].level&&(v=a.match(/^\s+/))&&(u[0].from=v[0].length,u.unshift(new j(0,0,v[0].length))),1==qf(u).level&&(v=a.match(/\s+$/))&&(qf(u).to-=v[0].length,u.push(new j(0,b-v[0].length,b))),u[0].level!=qf(u).level&&u.push(new j(u[0].level,b,b)),u}}();return z.version="4.0.3",z});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.