b785052358211205cd907730bc909311f97d059a
[ckeditor.git] / skins / ckeditor / plugins / codemirror / js / codemirror.min.js
1 window.CodeMirror=(function(){var bB=/gecko\/\d/i.test(navigator.userAgent);var cs=/MSIE \d/.test(navigator.userAgent);var by=cs&&(document.documentMode==null||document.documentMode<8);var bx=cs&&(document.documentMode==null||document.documentMode<9);var dr=/Trident\/([7-9]|\d{2,})\./.test(navigator.userAgent);var b1=/WebKit\//.test(navigator.userAgent);var cv=b1&&/Qt\/\d+\.\d+/.test(navigator.userAgent);var b8=/Chrome\//.test(navigator.userAgent);var dQ=/Opera\//.test(navigator.userAgent);var ad=/Apple Computer/.test(navigator.vendor);var aC=/KHTML\//.test(navigator.userAgent);var bM=/Mac OS X 1\d\D([7-9]|\d\d)\D/.test(navigator.userAgent);var b5=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent);var dN=/PhantomJS/.test(navigator.userAgent);var dm=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent);var cM=dm||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent);var bk=dm||/Mac/.test(navigator.platform);var al=/win/i.test(navigator.platform);var cY=dQ&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);if(cY){cY=Number(cY[1])}if(cY&&cY>=15){dQ=false;b1=true}var ba=bk&&(cv||dQ&&(cY==null||cY<12.11));var bQ=bB||(cs&&!bx);var ef=false,ay=false;function y(el,em){if(!(this instanceof y)){return new y(el,em)}this.options=em=em||{};for(var en in dp){if(!em.hasOwnProperty(en)&&dp.hasOwnProperty(en)){em[en]=dp[en]}}bs(em);var er=typeof em.value=="string"?0:em.value.first;var eq=this.display=f(el,er);eq.wrapper.CodeMirror=this;cI(this);if(em.autofocus&&!cM){c1(this)}this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:false,focused:false,suppressEdits:false,pasteIncoming:false,draggingText:false,highlight:new ek()};bV(this);if(em.lineWrapping){this.display.wrapper.className+=" CodeMirror-wrap"}var ep=em.value;if(typeof ep=="string"){ep=new X(em.value,em.mode)}b2(this,cH)(this,ep);if(cs){setTimeout(bH(dJ,this,true),20)}d3(this);var es;try{es=(document.activeElement==eq.input)}catch(eo){}if(es||(em.autofocus&&!cM)){setTimeout(bH(bL,this),20)}else{aq(this)}b2(this,function(){for(var eu in aF){if(aF.propertyIsEnumerable(eu)){aF[eu](this,em[eu],bq)}}for(var et=0;et<az.length;++et){az[et](this)}})()}function f(el,en){var eo={};var em=eo.input=d8("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none; font-size: 4px;");if(b1){em.style.width="1000px"}else{em.setAttribute("wrap","off")}if(dm){em.style.border="1px solid black"}em.setAttribute("autocorrect","off");em.setAttribute("autocapitalize","off");em.setAttribute("spellcheck","false");eo.inputDiv=d8("div",[em],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");eo.scrollbarH=d8("div",[d8("div",null,null,"height: 1px")],"CodeMirror-hscrollbar");eo.scrollbarV=d8("div",[d8("div",null,null,"width: 1px")],"CodeMirror-vscrollbar");eo.scrollbarFiller=d8("div",null,"CodeMirror-scrollbar-filler");eo.gutterFiller=d8("div",null,"CodeMirror-gutter-filler");eo.lineDiv=d8("div",null,"CodeMirror-code");eo.selectionDiv=d8("div",null,null,"position: relative; z-index: 1");eo.cursor=d8("div","\u00a0","CodeMirror-cursor");eo.otherCursor=d8("div","\u00a0","CodeMirror-cursor CodeMirror-secondarycursor");eo.measure=d8("div",null,"CodeMirror-measure");eo.lineSpace=d8("div",[eo.measure,eo.selectionDiv,eo.lineDiv,eo.cursor,eo.otherCursor],null,"position: relative; outline: none");eo.mover=d8("div",[d8("div",[eo.lineSpace],"CodeMirror-lines")],null,"position: relative");eo.sizer=d8("div",[eo.mover],"CodeMirror-sizer");eo.heightForcer=d8("div",null,null,"position: absolute; height: "+aJ+"px; width: 1px;");eo.gutters=d8("div",null,"CodeMirror-gutters");eo.lineGutter=null;eo.scroller=d8("div",[eo.sizer,eo.heightForcer,eo.gutters],"CodeMirror-scroll");eo.scroller.setAttribute("tabIndex","-1");eo.wrapper=d8("div",[eo.inputDiv,eo.scrollbarH,eo.scrollbarV,eo.scrollbarFiller,eo.gutterFiller,eo.scroller],"CodeMirror");if(by){eo.gutters.style.zIndex=-1;eo.scroller.style.paddingRight=0}if(el.appendChild){el.appendChild(eo.wrapper)}else{el(eo.wrapper)}if(dm){em.style.width="0px"}if(!b1){eo.scroller.draggable=true}if(aC){eo.inputDiv.style.height="1px";eo.inputDiv.style.position="absolute"}else{if(by){eo.scrollbarH.style.minWidth=eo.scrollbarV.style.minWidth="18px"}}eo.viewOffset=eo.lastSizeC=0;eo.showingFrom=eo.showingTo=en;eo.lineNumWidth=eo.lineNumInnerWidth=eo.lineNumChars=null;eo.prevInput="";eo.alignWidgets=false;eo.pollingFast=false;eo.poll=new ek();eo.cachedCharWidth=eo.cachedTextHeight=null;eo.measureLineCache=[];eo.measureLineCachePos=0;eo.inaccurateSelection=false;eo.maxLine=null;eo.maxLineLength=0;eo.maxLineChanged=false;eo.wheelDX=eo.wheelDY=eo.wheelStartX=eo.wheelStartY=null;return eo}function aR(el){el.doc.mode=y.getMode(el.options,el.doc.modeOption);el.doc.iter(function(em){if(em.stateAfter){em.stateAfter=null}if(em.styles){em.styles=null}});el.doc.frontier=el.doc.first;cL(el,100);el.state.modeGen++;if(el.curOp){N(el)}}function c9(el){if(el.options.lineWrapping){el.display.wrapper.className+=" CodeMirror-wrap";el.display.sizer.style.minWidth=""}else{el.display.wrapper.className=el.display.wrapper.className.replace(" CodeMirror-wrap","");eb(el)}I(el);N(el);Q(el);setTimeout(function(){dk(el)},100)}function aE(el){var en=at(el.display),em=el.options.lineWrapping;var eo=em&&Math.max(5,el.display.scroller.clientWidth/cq(el.display)-3);return function(ep){if(dO(el.doc,ep)){return 0}else{if(em){return(Math.ceil(ep.text.length/eo)||1)*en}else{return en}}}}function I(el){var en=el.doc,em=aE(el);en.iter(function(eo){var ep=em(eo);if(ep!=eo.height){ed(eo,ep)}})}function ei(el){var en=du[el.options.keyMap],em=en.style;el.display.wrapper.className=el.display.wrapper.className.replace(/\s*cm-keymap-\S+/g,"")+(em?" cm-keymap-"+em:"");el.state.disableInput=en.disableInput}function bV(el){el.display.wrapper.className=el.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+el.options.theme.replace(/(^|\s)\s*/g," cm-s-");Q(el)}function cl(el){cI(el);N(el);setTimeout(function(){c5(el)},20)}function cI(el){var em=el.display.gutters,eq=el.options.gutters;cB(em);for(var en=0;en<eq.length;++en){var eo=eq[en];var ep=em.appendChild(d8("div",null,"CodeMirror-gutter "+eo));if(eo=="CodeMirror-linenumbers"){el.display.lineGutter=ep;ep.style.width=(el.display.lineNumWidth||1)+"px"}}em.style.display=en?"":"none"}function cQ(ep,en){if(en.height==0){return 0}var em=en.text.length,el,eq=en;while(el=dc(eq)){var eo=el.find();eq=dy(ep,eo.from.line);em+=eo.from.ch-eo.to.ch}eq=en;while(el=cV(eq)){var eo=el.find();em-=eq.text.length-eo.from.ch;eq=dy(ep,eo.to.line);em+=eq.text.length-eo.to.ch}return em}function eb(el){var en=el.display,em=el.doc;en.maxLine=dy(em,em.first);en.maxLineLength=cQ(em,en.maxLine);en.maxLineChanged=true;em.iter(function(ep){var eo=cQ(em,ep);if(eo>en.maxLineLength){en.maxLineLength=eo;en.maxLine=ep}})}function bs(el){var em=cd(el.gutters,"CodeMirror-linenumbers");if(em==-1&&el.lineNumbers){el.gutters=el.gutters.concat(["CodeMirror-linenumbers"])}else{if(em>-1&&!el.lineNumbers){el.gutters=el.gutters.slice(0);el.gutters.splice(em,1)}}}function dk(el){var er=el.display,em=el.doc.height;var eo=em+a3(er);er.sizer.style.minHeight=er.heightForcer.style.top=eo+"px";er.gutters.style.height=Math.max(eo,er.scroller.clientHeight-aJ)+"px";var ep=Math.max(eo,er.scroller.scrollHeight);var eq=er.scroller.scrollWidth>(er.scroller.clientWidth+1);var en=ep>(er.scroller.clientHeight+1);if(en){er.scrollbarV.style.display="block";er.scrollbarV.style.bottom=eq?i(er.measure)+"px":"0";er.scrollbarV.firstChild.style.height=(ep-er.scroller.clientHeight+er.scrollbarV.clientHeight)+"px"}else{er.scrollbarV.style.display="";er.scrollbarV.firstChild.style.height="0"}if(eq){er.scrollbarH.style.display="block";er.scrollbarH.style.right=en?i(er.measure)+"px":"0";er.scrollbarH.firstChild.style.width=(er.scroller.scrollWidth-er.scroller.clientWidth+er.scrollbarH.clientWidth)+"px"}else{er.scrollbarH.style.display="";er.scrollbarH.firstChild.style.width="0"}if(eq&&en){er.scrollbarFiller.style.display="block";er.scrollbarFiller.style.height=er.scrollbarFiller.style.width=i(er.measure)+"px"}else{er.scrollbarFiller.style.display=""}if(eq&&el.options.coverGutterNextToScrollbar&&el.options.fixedGutter){er.gutterFiller.style.display="block";er.gutterFiller.style.height=i(er.measure)+"px";er.gutterFiller.style.width=er.gutters.offsetWidth+"px"}else{er.gutterFiller.style.display=""}if(bM&&i(er.measure)===0){er.scrollbarV.style.minWidth=er.scrollbarH.style.minHeight=b5?"18px":"12px";er.scrollbarV.style.pointerEvents=er.scrollbarH.style.pointerEvents="none"}}function bj(eq,ep,eo){var en=eq.scroller.scrollTop,el=eq.wrapper.clientHeight;if(typeof eo=="number"){en=eo}else{if(eo){en=eo.top;el=eo.bottom-eo.top}}en=Math.floor(en-ds(eq));var em=Math.ceil(en+el);return{from:a1(ep,en),to:a1(ep,em)}}function c5(el){var er=el.display;if(!er.alignWidgets&&(!er.gutters.firstChild||!el.options.fixedGutter)){return}var eo=cA(er)-er.scroller.scrollLeft+el.doc.scrollLeft;var eq=er.gutters.offsetWidth,en=eo+"px";for(var es=er.lineDiv.firstChild;es;es=es.nextSibling){if(es.alignable){for(var ep=0,em=es.alignable;ep<em.length;++ep){em[ep].style.left=en}}}if(el.options.fixedGutter){er.gutters.style.left=(eo+eq)+"px"}}function cD(el){if(!el.options.lineNumbers){return false}var eq=el.doc,em=cT(el.options,eq.first+eq.size-1),ep=el.display;if(em.length!=ep.lineNumChars){var er=ep.measure.appendChild(d8("div",[d8("div",em)],"CodeMirror-linenumber CodeMirror-gutter-elt"));var en=er.firstChild.offsetWidth,eo=er.offsetWidth-en;ep.lineGutter.style.width="";ep.lineNumInnerWidth=Math.max(en,ep.lineGutter.offsetWidth-eo);ep.lineNumWidth=ep.lineNumInnerWidth+eo;ep.lineNumChars=ep.lineNumInnerWidth?em.length:-1;ep.lineGutter.style.width=ep.lineNumWidth+"px";return true}return false}function cT(el,em){return String(el.lineNumberFormatter(em+el.firstLineNumber))}function cA(el){return ak(el.scroller).left-ak(el.sizer).left}function ct(eq,ep,et,eu){var es=eq.display.showingFrom,er=eq.display.showingTo,eo;var el=bj(eq.display,eq.doc,et);for(var en=true;;en=false){var em=eq.display.scroller.clientWidth;if(!cb(eq,ep,el,eu)){break}eo=true;ep=[];aY(eq);dk(eq);if(en&&eq.options.lineWrapping&&em!=eq.display.scroller.clientWidth){eu=true;continue}eu=false;if(et){et=Math.min(eq.display.scroller.scrollHeight-eq.display.scroller.clientHeight,typeof et=="number"?et:et.top)}el=bj(eq.display,eq.doc,et);if(el.from>=eq.display.showingFrom&&el.to<=eq.display.showingTo){break}}if(eo){L(eq,"update",eq);if(eq.display.showingFrom!=es||eq.display.showingTo!=er){L(eq,"viewportChange",eq,eq.display.showingFrom,eq.display.showingTo)}}return eo}function cb(ep,eD,em,eB){var ev=ep.display,eE=ep.doc;if(!ev.wrapper.clientWidth){ev.showingFrom=ev.showingTo=eE.first;ev.viewOffset=0;return}if(!eB&&eD.length==0&&em.from>ev.showingFrom&&em.to<ev.showingTo){return}if(cD(ep)){eD=[{from:eE.first,to:eE.first+eE.size}]}var eA=ev.sizer.style.marginLeft=ev.gutters.offsetWidth+"px";ev.scrollbarH.style.left=ep.options.fixedGutter?eA:"0";var en=Infinity;if(ep.options.lineNumbers){for(var ew=0;ew<eD.length;++ew){if(eD[ew].diff&&eD[ew].from<en){en=eD[ew].from}}}var eo=eE.first+eE.size;var eu=Math.max(em.from-ep.options.viewportMargin,eE.first);var el=Math.min(eo,em.to+ep.options.viewportMargin);if(ev.showingFrom<eu&&eu-ev.showingFrom<20){eu=Math.max(eE.first,ev.showingFrom)}if(ev.showingTo>el&&ev.showingTo-el<20){el=Math.min(eo,ev.showingTo)}if(ay){eu=a8(s(eE,dy(eE,eu)));while(el<eo&&dO(eE,dy(eE,el))){++el}}var ey=[{from:Math.max(ev.showingFrom,eE.first),to:Math.min(ev.showingTo,eo)}];if(ey[0].from>=ey[0].to){ey=[]}else{ey=dI(ey,eD)}if(ay){for(var ew=0;ew<ey.length;++ew){var er=ey[ew],ez;while(ez=cV(dy(eE,er.to-1))){var eC=ez.find().from.line;if(eC>er.from){er.to=eC}else{ey.splice(ew--,1);break}}}}var et=0;for(var ew=0;ew<ey.length;++ew){var er=ey[ew];if(er.from<eu){er.from=eu}if(er.to>el){er.to=el}if(er.from>=er.to){ey.splice(ew--,1)}else{et+=er.to-er.from}}if(!eB&&et==el-eu&&eu==ev.showingFrom&&el==ev.showingTo){h(ep);return}ey.sort(function(eG,eF){return eG.from-eF.from});try{var eq=document.activeElement}catch(ex){}if(et<(el-eu)*0.7){ev.lineDiv.style.display="none"}bz(ep,eu,el,ey,en);ev.lineDiv.style.display="";if(eq&&document.activeElement!=eq&&eq.offsetHeight){eq.focus()}var es=eu!=ev.showingFrom||el!=ev.showingTo||ev.lastSizeC!=ev.wrapper.clientHeight;if(es){ev.lastSizeC=ev.wrapper.clientHeight;cL(ep,400)}ev.showingFrom=eu;ev.showingTo=el;aA(ep);h(ep);return true}function aA(et){var eq=et.display;var em=eq.lineDiv.offsetTop;for(var el=eq.lineDiv.firstChild,eu;el;el=el.nextSibling){if(el.lineObj){if(by){var ep=el.offsetTop+el.offsetHeight;eu=ep-em;em=ep}else{var eo=ak(el);eu=eo.bottom-eo.top}var es=el.lineObj.height-eu;if(eu<2){eu=at(eq)}if(es>0.001||es<-0.001){ed(el.lineObj,eu);var er=el.lineObj.widgets;if(er){for(var en=0;en<er.length;++en){er[en].height=er[en].node.offsetHeight}}}}}}function h(el){var em=el.display.viewOffset=a7(el,dy(el.doc,el.display.showingFrom));el.display.mover.style.top=em+"px"}function dI(eu,es){for(var ep=0,en=es.length||0;ep<en;++ep){var er=es[ep],el=[],et=er.diff||0;for(var eo=0,em=eu.length;eo<em;++eo){var eq=eu[eo];if(er.to<=eq.from&&er.diff){el.push({from:eq.from+et,to:eq.to+et})}else{if(er.to<=eq.from||er.from>=eq.to){el.push(eq)}else{if(er.from>eq.from){el.push({from:eq.from,to:er.from})}if(er.to<eq.to){el.push({from:er.to+et,to:eq.to+et})}}}}eu=el}return eu}function dv(el){var ep=el.display,eo={},en={};for(var eq=ep.gutters.firstChild,em=0;eq;eq=eq.nextSibling,++em){eo[el.options.gutters[em]]=eq.offsetLeft;en[el.options.gutters[em]]=eq.offsetWidth}return{fixedPos:cA(ep),gutterTotalWidth:ep.gutters.offsetWidth,gutterLeft:eo,gutterWidth:en,wrapperWidth:ep.wrapper.clientWidth}}function bz(eu,er,es,ex,em){var et=dv(eu);var eq=eu.display,ew=eu.options.lineNumbers;if(!ex.length&&(!b1||!eu.display.currentWheelTarget)){cB(eq.lineDiv)}var el=eq.lineDiv,ev=el.firstChild;function ep(ez){var ey=ez.nextSibling;if(b1&&bk&&eu.display.currentWheelTarget==ez){ez.style.display="none";ez.lineObj=null}else{ez.parentNode.removeChild(ez)}return ey}var en=ex.shift(),eo=er;eu.doc.iter(er,es,function(eH){if(en&&en.to==eo){en=ex.shift()}if(dO(eu.doc,eH)){if(eH.height!=0){ed(eH,0)}if(eH.widgets&&ev&&ev.previousSibling){for(var eC=0;eC<eH.widgets.length;++eC){var eE=eH.widgets[eC];if(eE.showIfHidden){var eA=ev.previousSibling;if(/pre/i.test(eA.nodeName)){var ez=d8("div",null,null,"position: relative");eA.parentNode.replaceChild(ez,eA);ez.appendChild(eA);eA=ez}var eF=eA.appendChild(d8("div",[eE.node],"CodeMirror-linewidget"));if(!eE.handleMouseEvents){eF.ignoreEvents=true}a0(eE,eF,eA,et)}}}}else{if(en&&en.from<=eo&&en.to>eo){while(ev.lineObj!=eH){ev=ep(ev)}if(ew&&em<=eo&&ev.lineNumber){m(ev.lineNumber,cT(eu.options,eo))}ev=ev.nextSibling}else{if(eH.widgets){for(var eB=0,eG=ev,eD;eG&&eB<20;++eB,eG=eG.nextSibling){if(eG.lineObj==eH&&/div/i.test(eG.nodeName)){eD=eG;break}}}var ey=af(eu,eH,eo,et,eD);if(ey!=eD){el.insertBefore(ey,ev)}else{while(ev!=eD){ev=ep(ev)}ev=ev.nextSibling}ey.lineObj=eH}}++eo});while(ev){ev=ep(ev)}}function af(es,eu,ev,ey,en){var er=de(es,eu),eE=er.pre;var eH=eu.gutterMarkers,eF=es.display,et;var em=er.bgClass?er.bgClass+" "+(eu.bgClass||""):eu.bgClass;if(!es.options.lineNumbers&&!eH&&!em&&!eu.wrapClass&&!eu.widgets){return eE}if(en){en.alignable=null;var eI=true,eq=0,eo=null;for(var eA=en.firstChild,ez;eA;eA=ez){ez=eA.nextSibling;if(!/\bCodeMirror-linewidget\b/.test(eA.className)){en.removeChild(eA)}else{for(var eG=0;eG<eu.widgets.length;++eG){var ep=eu.widgets[eG];if(ep.node==eA.firstChild){if(!ep.above&&!eo){eo=eA}a0(ep,eA,en,ey);++eq;break}}if(eG==eu.widgets.length){eI=false;break}}}en.insertBefore(eE,eo);if(eI&&eq==eu.widgets.length){et=en;en.className=eu.wrapClass||""}}if(!et){et=d8("div",null,eu.wrapClass,"position: relative");et.appendChild(eE)}if(em){et.insertBefore(d8("div",null,em+" CodeMirror-linebackground"),et.firstChild)}if(es.options.lineNumbers||eH){var eC=et.insertBefore(d8("div",null,null,"position: absolute; left: "+(es.options.fixedGutter?ey.fixedPos:-ey.gutterTotalWidth)+"px"),et.firstChild);if(es.options.fixedGutter){(et.alignable||(et.alignable=[])).push(eC)}if(es.options.lineNumbers&&(!eH||!eH["CodeMirror-linenumbers"])){et.lineNumber=eC.appendChild(d8("div",cT(es.options,ev),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+ey.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+eF.lineNumInnerWidth+"px"))}if(eH){for(var eD=0;eD<es.options.gutters.length;++eD){var ex=es.options.gutters[eD],ew=eH.hasOwnProperty(ex)&&eH[ex];if(ew){eC.appendChild(d8("div",[ew],"CodeMirror-gutter-elt","left: "+ey.gutterLeft[ex]+"px; width: "+ey.gutterWidth[ex]+"px"))}}}}if(by){et.style.zIndex=2}if(eu.widgets&&et!=en){for(var eG=0,el=eu.widgets;eG<el.length;++eG){var ep=el[eG],eB=d8("div",[ep.node],"CodeMirror-linewidget");if(!ep.handleMouseEvents){eB.ignoreEvents=true}a0(ep,eB,et,ey);if(ep.above){et.insertBefore(eB,es.options.lineNumbers&&eu.height!=0?eC:eE)}else{et.appendChild(eB)}L(ep,"redraw")}}return et}function a0(eo,en,em,ep){if(eo.noHScroll){(em.alignable||(em.alignable=[])).push(en);var el=ep.wrapperWidth;en.style.left=ep.fixedPos+"px";if(!eo.coverGutter){el-=ep.gutterTotalWidth;en.style.paddingLeft=ep.gutterTotalWidth+"px"}en.style.width=el+"px"}if(eo.coverGutter){en.style.zIndex=5;en.style.position="relative";if(!eo.noHScroll){en.style.marginLeft=-ep.gutterTotalWidth+"px"}}}function aY(el){var eo=el.display;var ep=dX(el.doc.sel.from,el.doc.sel.to);if(ep||el.options.showCursorWhenSelecting){z(el)}else{eo.cursor.style.display=eo.otherCursor.style.display="none"}if(!ep){S(el)}else{eo.selectionDiv.style.display="none"}if(el.options.moveInputWithCursor){var eq=cy(el,el.doc.sel.head,"div");var em=ak(eo.wrapper),en=ak(eo.lineDiv);eo.inputDiv.style.top=Math.max(0,Math.min(eo.wrapper.clientHeight-10,eq.top+en.top-em.top))+"px";eo.inputDiv.style.left=Math.max(0,Math.min(eo.wrapper.clientWidth-10,eq.left+en.left-em.left))+"px"}}function z(el){var em=el.display,en=cy(el,el.doc.sel.head,"div");em.cursor.style.left=en.left+"px";em.cursor.style.top=en.top+"px";em.cursor.style.height=Math.max(0,en.bottom-en.top)*el.options.cursorHeight+"px";em.cursor.style.display="";if(en.other){em.otherCursor.style.display="";em.otherCursor.style.left=en.other.left+"px";em.otherCursor.style.top=en.other.top+"px";em.otherCursor.style.height=(en.other.bottom-en.other.top)*0.85+"px"}else{em.otherCursor.style.display="none"}}function S(ew){var er=ew.display,ev=ew.doc,el=ew.doc.sel;var ep=document.createDocumentFragment();var eu=er.lineSpace.offsetWidth,en=ar(ew.display);function ey(eC,eB,eA,ez){if(eB<0){eB=0}ep.appendChild(d8("div",null,"CodeMirror-selected","position: absolute; left: "+eC+"px; top: "+eB+"px; width: "+(eA==null?eu-eC:eA)+"px; height: "+(ez-eB)+"px"))}function et(eA,eC,eF){var eB=dy(ev,eA);var eD=eB.text.length;var eG,ez;function eE(eI,eH){return bS(ew,H(eA,eI),"div",eB,eH)}cC(a(eB),eC||0,eF==null?eD:eF,function(eO,eN,eH){var eK=eE(eO,"left"),eL,eM,eJ;if(eO==eN){eL=eK;eM=eJ=eK.left}else{eL=eE(eN-1,"right");if(eH=="rtl"){var eI=eK;eK=eL;eL=eI}eM=eK.left;eJ=eL.right}if(eC==null&&eO==0){eM=en}if(eL.top-eK.top>3){ey(eM,eK.top,null,eK.bottom);eM=en;if(eK.bottom<eL.top){ey(eM,eK.bottom,null,eL.top)}}if(eF==null&&eN==eD){eJ=eu}if(!eG||eK.top<eG.top||eK.top==eG.top&&eK.left<eG.left){eG=eK}if(!ez||eL.bottom>ez.bottom||eL.bottom==ez.bottom&&eL.right>ez.right){ez=eL}if(eM<en+1){eM=en}ey(eM,eL.top,eJ-eM,eL.bottom)});return{start:eG,end:ez}}if(el.from.line==el.to.line){et(el.from.line,el.from.ch,el.to.ch)}else{var eo=dy(ev,el.from.line),em=dy(ev,el.to.line);var eq=s(ev,eo)==s(ev,em);var ex=et(el.from.line,el.from.ch,eq?eo.text.length:null).end;var es=et(el.to.line,eq?0:null,el.to.ch).start;if(eq){if(ex.top<es.top-2){ey(ex.right,ex.top,null,ex.bottom);ey(en,es.top,es.left,es.bottom)}else{ey(ex.right,ex.top,es.left-ex.right,ex.bottom)}}if(ex.bottom<es.top){ey(en,ex.bottom,null,es.top)}}bc(er.selectionDiv,ep);er.selectionDiv.style.display=""}function k(el){if(!el.state.focused){return}var en=el.display;clearInterval(en.blinker);var em=true;en.cursor.style.visibility=en.otherCursor.style.visibility="";if(el.options.cursorBlinkRate>0){en.blinker=setInterval(function(){en.cursor.style.visibility=en.otherCursor.style.visibility=(em=!em)?"":"hidden"},el.options.cursorBlinkRate)}}function cL(el,em){if(el.doc.mode.startState&&el.doc.frontier<el.display.showingTo){el.state.highlight.set(em,bH(bW,el))}}function bW(el){var eo=el.doc;if(eo.frontier<eo.first){eo.frontier=eo.first}if(eo.frontier>=el.display.showingTo){return}var em=+new Date+el.options.workTime;var en=bi(eo.mode,co(el,eo.frontier));var eq=[],ep;eo.iter(eo.frontier,Math.min(eo.first+eo.size,el.display.showingTo+500),function(er){if(eo.frontier>=el.display.showingFrom){var et=er.styles;er.styles=dT(el,er,en,true);var eu=!et||et.length!=er.styles.length;for(var es=0;!eu&&es<et.length;++es){eu=et[es]!=er.styles[es]}if(eu){if(ep&&ep.end==eo.frontier){ep.end++}else{eq.push(ep={start:eo.frontier,end:eo.frontier+1})}}er.stateAfter=bi(eo.mode,en)}else{cm(el,er.text,en);er.stateAfter=eo.frontier%5==0?bi(eo.mode,en):null}++eo.frontier;if(+new Date>em){cL(el,el.options.workDelay);return true}});if(eq.length){b2(el,function(){for(var er=0;er<eq.length;++er){N(this,eq[er].start,eq[er].end)}})()}}function bJ(er,el,eo){var em,ep,eq=er.doc;var en=eo?-1:el-(er.doc.mode.innerMode?1000:100);for(var eu=el;eu>en;--eu){if(eu<=eq.first){return eq.first}var et=dy(eq,eu-1);if(et.stateAfter&&(!eo||eu<=eq.frontier)){return eu}var es=bb(et.text,null,er.options.tabSize);if(ep==null||em>es){ep=eu-1;em=es}}return ep}function co(el,er,em){var ep=el.doc,eo=el.display;if(!ep.mode.startState){return true}var eq=bJ(el,er,em),en=eq>ep.first&&dy(ep,eq-1).stateAfter;if(!en){en=bh(ep.mode)}else{en=bi(ep.mode,en)}ep.iter(eq,er,function(es){cm(el,es.text,en);var et=eq==er-1||eq%5==0||eq>=eo.showingFrom&&eq<eo.showingTo;es.stateAfter=et?bi(ep.mode,en):null;++eq});if(em){ep.frontier=eq}return en}function ds(el){return el.lineSpace.offsetTop}function a3(el){return el.mover.offsetHeight-el.lineSpace.offsetHeight}function ar(em){var el=bc(em.measure,d8("pre",null,null,"text-align: left")).appendChild(d8("span","x"));return el.offsetLeft}function cN(es,et,em,ep,eq){var eo=-1;ep=ep||a4(es,et);if(ep.crude){var en=ep.left+em*ep.width;return{left:en,right:en+ep.width,top:ep.top,bottom:ep.bottom}}for(var er=em;;er+=eo){var el=ep[er];if(el){break}if(eo<0&&er==0){eo=1}}eq=er>em?"left":er<em?"right":eq;if(eq=="left"&&el.leftSide){el=el.leftSide}else{if(eq=="right"&&el.rightSide){el=el.rightSide}}return{left:er<em?el.right:el.left,right:er>em?el.left:el.right,top:el.top,bottom:el.bottom}}function dq(el,em){var eo=el.display.measureLineCache;for(var ep=0;ep<eo.length;++ep){var en=eo[ep];if(en.text==em.text&&en.markedSpans==em.markedSpans&&el.display.scroller.clientWidth==en.width&&en.classes==em.textClass+"|"+em.wrapClass){return en}}}function d1(el,em){var en=dq(el,em);if(en){en.text=en.measure=en.markedSpans=null}}function a4(el,em){var eq=dq(el,em);if(eq){return eq.measure}var ep=ca(el,em);var eo=el.display.measureLineCache;var en={text:em.text,width:el.display.scroller.clientWidth,markedSpans:em.markedSpans,measure:ep,classes:em.textClass+"|"+em.wrapClass};if(eo.length==16){eo[++el.display.measureLineCachePos%16]=en}else{eo.push(en)}return ep}function ca(es,eu){if(!es.options.lineWrapping&&eu.text.length>=es.options.crudeMeasuringFrom){return d9(es,eu)}var eA=es.display,eq=R(eu.text.length);var ex=de(es,eu,eq,true).pre;if(cs&&!by&&!es.options.lineWrapping&&ex.childNodes.length>100){var en=document.createDocumentFragment();var ev=10,ey=ex.childNodes.length;for(var eC=0,ew=Math.ceil(ey/ev);eC<ew;++eC){var et=d8("div",null,null,"display: inline-block");for(var eB=0;eB<ev&&ey;++eB){et.appendChild(ex.firstChild);--ey}en.appendChild(et)}ex.appendChild(en)}bc(eA.measure,ex);var em=ak(eA.lineDiv);var el=[],eF=R(eu.text.length),eE=ex.offsetHeight;if(bx&&eA.measure.first!=ex){bc(eA.measure,ex)}function eD(eI){var eK=eI.top-em.top,eM=eI.bottom-em.top;if(eM>eE){eM=eE}if(eK<0){eK=0}for(var eH=el.length-2;eH>=0;eH-=2){var eJ=el[eH],eL=el[eH+1];if(eJ>eM||eL<eK){continue}if(eJ<=eK&&eL>=eM||eK<=eJ&&eM>=eL||Math.min(eM,eL)-Math.max(eK,eJ)>=(eM-eK)>>1){el[eH]=Math.min(eK,eJ);el[eH+1]=Math.max(eM,eL);break}}if(eH<0){eH=el.length;el.push(eK,eM)}return{left:eI.left-em.left,right:eI.right-em.left,top:eH,bottom:null}}function eG(eH){eH.bottom=el[eH.top+1];eH.top=el[eH.top]}for(var eC=0,ep;eC<eq.length;++eC){if(ep=eq[eC]){var ez=ep,eo=null;if(/\bCodeMirror-widget\b/.test(ep.className)&&ep.getClientRects){if(ep.firstChild.nodeType==1){ez=ep.firstChild}var er=ez.getClientRects();if(er.length>1){eo=eF[eC]=eD(er[0]);eo.rightSide=eD(er[er.length-1])}}if(!eo){eo=eF[eC]=eD(ak(ez))}if(ep.measureRight){eo.right=ak(ep.measureRight).left}if(ep.leftSide){eo.leftSide=eD(ak(ep.leftSide))}}}cB(es.display.measure);for(var eC=0,ep;eC<eF.length;++eC){if(ep=eF[eC]){eG(ep);if(ep.leftSide){eG(ep.leftSide)}if(ep.rightSide){eG(ep.rightSide)}}}return eF}function d9(el,em){var eq=new ec(em.text.slice(0,100),null);if(em.textClass){eq.textClass=em.textClass}var eo=ca(el,eq);var ep=cN(el,eq,0,eo,"left");var en=cN(el,eq,99,eo,"right");return{crude:true,top:ep.top,left:ep.left,bottom:ep.bottom,width:(en.right-ep.left)/100}}function c6(el,en){var es=false;if(en.markedSpans){for(var eo=0;eo<en.markedSpans;++eo){var eq=en.markedSpans[eo];if(eq.collapsed&&(eq.to==null||eq.to==en.text.length)){es=true}}}var ep=!es&&dq(el,en);if(ep||en.text.length>=el.options.crudeMeasuringFrom){return cN(el,en,en.text.length,ep&&ep.measure,"right").right}var er=de(el,en,null,true).pre;var em=er.appendChild(aN(el.display.measure));bc(el.display.measure,er);return ak(em).right-ak(el.display.lineDiv).left}function Q(el){el.display.measureLineCache.length=el.display.measureLineCachePos=0;el.display.cachedCharWidth=el.display.cachedTextHeight=null;if(!el.options.lineWrapping){el.display.maxLineChanged=true}el.display.lineNumChars=null}function bG(){return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function bF(){return window.pageYOffset||(document.documentElement||document.body).scrollTop}function dd(er,eo,eq,em){if(eo.widgets){for(var en=0;en<eo.widgets.length;++en){if(eo.widgets[en].above){var et=bZ(eo.widgets[en]);eq.top+=et;eq.bottom+=et}}}if(em=="line"){return eq}if(!em){em="local"}var ep=a7(er,eo);if(em=="local"){ep+=ds(er.display)}else{ep-=er.display.viewOffset}if(em=="page"||em=="window"){var el=ak(er.display.lineSpace);ep+=el.top+(em=="window"?0:bF());var es=el.left+(em=="window"?0:bG());eq.left+=es;eq.right+=es}eq.top+=ep;eq.bottom+=ep;return eq}function eh(em,ep,en){if(en=="div"){return ep}var er=ep.left,eq=ep.top;if(en=="page"){er-=bG();eq-=bF()}else{if(en=="local"||!en){var eo=ak(em.display.sizer);er+=eo.left;eq+=eo.top}}var el=ak(em.display.lineSpace);return{left:er-el.left,top:eq-el.top}}function bS(el,ep,eo,en,em){if(!en){en=dy(el.doc,ep.line)}return dd(el,en,cN(el,en,ep.ch,null,em),eo)}function cy(eu,et,en,es,eq){es=es||dy(eu.doc,et.line);if(!eq){eq=a4(eu,es)}function ep(ey,ex){var ew=cN(eu,es,ey,eq,ex?"right":"left");if(ex){ew.left=ew.right}else{ew.right=ew.left}return dd(eu,es,ew,en)}function ev(ez,ew){var ex=er[ew],ey=ex.level%2;if(ez==cn(ex)&&ew&&ex.level<er[ew-1].level){ex=er[--ew];ez=eg(ex)-(ex.level%2?0:1);ey=true}else{if(ez==eg(ex)&&ew<er.length-1&&ex.level<er[ew+1].level){ex=er[++ew];ez=cn(ex)-ex.level%2;ey=false}}if(ey&&ez==ex.to&&ez>ex.from){return ep(ez-1)}return ep(ez,ey)}var er=a(es),el=et.ch;if(!er){return ep(el)}var em=ag(er,el);var eo=ev(el,em);if(dn!=null){eo.other=ev(el,dn)}return eo}function d7(el,em,en,ep){var eo=new H(el,em);eo.xRel=ep;if(en){eo.outside=true}return eo}function d2(es,ep,eo){var er=es.doc;eo+=es.display.viewOffset;if(eo<0){return d7(er.first,0,true,-1)}var em=a1(er,eo),et=er.first+er.size-1;if(em>et){return d7(er.first+er.size-1,dy(er,et).text.length,true,1)}if(ep<0){ep=0}for(;;){var en=dy(er,em);var eu=b0(es,en,em,ep,eo);var eq=cV(en);var el=eq&&eq.find();if(eq&&(eu.ch>el.from.ch||eu.ch==el.from.ch&&eu.xRel>0)){em=el.to.line}else{return eu}}}function b0(ev,en,ey,ex,ew){var eu=ew-a7(ev,en);var er=false,eE=2*ev.display.wrapper.clientWidth;var eD=a4(ev,en);function eI(eK){var eL=cy(ev,H(ey,eK),"line",en,eD);er=true;if(eu>eL.bottom){return eL.left-eE}else{if(eu<eL.top){return eL.left+eE}else{er=false}}return eL.left}var eA=a(en),eC=en.text.length;var eF=bN(en),eo=bX(en);var eB=eI(eF),el=er,em=eI(eo),eq=er;if(ex>em){return d7(ey,eo,eq,1)}for(;;){if(eA?eo==eF||eo==p(en,eF,1):eo-eF<=1){var ez=ex<eB||ex-eB<=em-ex?eF:eo;var eH=ex-(ez==eF?eB:em);while(dK.test(en.text.charAt(ez))){++ez}var et=d7(ey,ez,ez==eF?el:eq,eH<0?-1:eH?1:0);return et}var es=Math.ceil(eC/2),eJ=eF+es;if(eA){eJ=eF;for(var eG=0;eG<es;++eG){eJ=p(en,eJ,1)}}var ep=eI(eJ);if(ep>ex){eo=eJ;em=ep;if(eq=er){em+=1000}eC=es}else{eF=eJ;eB=ep;el=er;eC-=es}}}var ah;function at(en){if(en.cachedTextHeight!=null){return en.cachedTextHeight}if(ah==null){ah=d8("pre");for(var em=0;em<49;++em){ah.appendChild(document.createTextNode("x"));ah.appendChild(d8("br"))}ah.appendChild(document.createTextNode("x"))}bc(en.measure,ah);var el=ah.offsetHeight/50;if(el>3){en.cachedTextHeight=el}cB(en.measure);return el||1}function cq(eo){if(eo.cachedCharWidth!=null){return eo.cachedCharWidth}var el=d8("span","x");var en=d8("pre",[el]);bc(eo.measure,en);var em=el.offsetWidth;if(em>2){eo.cachedCharWidth=em}return em||10}var cF=0;function bR(el){el.curOp={changes:[],forceUpdate:false,updateInput:null,userSelChange:null,textChanged:null,selectionChanged:false,cursorActivity:false,updateMaxLine:false,updateScrollPos:false,id:++cF};if(!bE++){aO=[]}}function T(ez){var et=ez.curOp,ey=ez.doc,eu=ez.display;ez.curOp=null;if(et.updateMaxLine){eb(ez)}if(eu.maxLineChanged&&!ez.options.lineWrapping&&eu.maxLine){var em=c6(ez,eu.maxLine);eu.sizer.style.minWidth=Math.max(0,em+3+aJ)+"px";eu.maxLineChanged=false;var ew=Math.max(0,eu.sizer.offsetLeft+eu.sizer.offsetWidth-eu.scroller.clientWidth);if(ew<ey.scrollLeft&&!et.updateScrollPos){aZ(ez,Math.min(eu.scroller.scrollLeft,ew),true)}}var en,er;if(et.updateScrollPos){en=et.updateScrollPos}else{if(et.selectionChanged&&eu.scroller.clientHeight){var ex=cy(ez,ey.sel.head);en=x(ez,ex.left,ex.top,ex.left,ex.bottom)}}if(et.changes.length||et.forceUpdate||en&&en.scrollTop!=null){er=ct(ez,et.changes,en&&en.scrollTop,et.forceUpdate);if(ez.display.scroller.offsetHeight){ez.doc.scrollTop=ez.display.scroller.scrollTop}}if(!er&&et.selectionChanged){aY(ez)}if(et.updateScrollPos){var ev=Math.max(0,Math.min(eu.scroller.scrollHeight-eu.scroller.clientHeight,en.scrollTop));var eo=Math.max(0,Math.min(eu.scroller.scrollWidth-eu.scroller.clientWidth,en.scrollLeft));eu.scroller.scrollTop=eu.scrollbarV.scrollTop=ey.scrollTop=ev;eu.scroller.scrollLeft=eu.scrollbarH.scrollLeft=ey.scrollLeft=eo;c5(ez);if(et.scrollToPos){u(ez,dY(ez.doc,et.scrollToPos.from),dY(ez.doc,et.scrollToPos.to),et.scrollToPos.margin)}}else{if(en){ab(ez)}}if(et.selectionChanged){k(ez)}if(ez.state.focused&&et.updateInput){dJ(ez,et.userSelChange)}var es=et.maybeHiddenMarkers,el=et.maybeUnhiddenMarkers;if(es){for(var eq=0;eq<es.length;++eq){if(!es[eq].lines.length){ae(es[eq],"hide")}}}if(el){for(var eq=0;eq<el.length;++eq){if(el[eq].lines.length){ae(el[eq],"unhide")}}}var ep;if(!--bE){ep=aO;aO=null}if(et.textChanged){ae(ez,"change",ez,et.textChanged)}if(et.cursorActivity){ae(ez,"cursorActivity",ez)}if(ep){for(var eq=0;eq<ep.length;++eq){ep[eq]()}}}function b2(el,em){return function(){var eo=el||this,ep=!eo.curOp;if(ep){bR(eo)}try{var en=em.apply(eo,arguments)}finally{if(ep){T(eo)}}return en}}function dS(el){return function(){var en=this.cm&&!this.cm.curOp,em;if(en){bR(this.cm)}try{em=el.apply(this,arguments)}finally{if(en){T(this.cm)}}return em}}function bU(em,eo){var en=!em.curOp,el;if(en){bR(em)}try{el=eo()}finally{if(en){T(em)}}return el}function N(el,eo,en,em){if(eo==null){eo=el.doc.first}if(en==null){en=el.doc.first+el.doc.size}el.curOp.changes.push({from:eo,to:en,diff:em})}function aM(el){if(el.display.pollingFast){return}el.display.poll.set(el.options.pollInterval,function(){bu(el);if(el.state.focused){aM(el)}})}function t(el){var em=false;el.display.pollingFast=true;function en(){var eo=bu(el);if(!eo&&!em){em=true;el.display.poll.set(60,en)}else{el.display.pollingFast=false;aM(el)}}el.display.poll.set(20,en)}function bu(ew){var er=ew.display.input,eo=ew.display.prevInput,ev=ew.doc,el=ev.sel;if(!ew.state.focused||aS(er)||P(ew)||ew.state.disableInput){return false}if(ew.state.pasteIncoming&&ew.state.fakedLastChar){er.value=er.value.substring(0,er.value.length-1);ew.state.fakedLastChar=false}var ex=er.value;if(ex==eo&&dX(el.from,el.to)){return false}if(cs&&!bx&&ew.display.inputHasSelection===ex){dJ(ew,true);return false}var en=!ew.curOp;if(en){bR(ew)}el.shift=false;var eq=0,em=Math.min(eo.length,ex.length);while(eq<em&&eo.charCodeAt(eq)==ex.charCodeAt(eq)){++eq}var eu=el.from,et=el.to;if(eq<eo.length){eu=H(eu.line,eu.ch-(eo.length-eq))}else{if(ew.state.overwrite&&dX(eu,et)&&!ew.state.pasteIncoming){et=H(et.line,Math.min(dy(ev,et.line).text.length,et.ch+(ex.length-eq)))}}var ep=ew.curOp.updateInput;var es={from:eu,to:et,text:av(ex.slice(eq)),origin:ew.state.pasteIncoming?"paste":"+input"};aG(ew.doc,es,"end");ew.curOp.updateInput=ep;L(ew,"inputRead",ew,es);if(ex.length>1000||ex.indexOf("\n")>-1){er.value=ew.display.prevInput=""}else{ew.display.prevInput=ex}if(en){T(ew)}ew.state.pasteIncoming=false;return true}function dJ(el,en){var em,eo,eq=el.doc;if(!dX(eq.sel.from,eq.sel.to)){el.display.prevInput="";em=b7&&(eq.sel.to.line-eq.sel.from.line>100||(eo=el.getSelection()).length>1000);var ep=em?"-":eo||el.getSelection();el.display.input.value=ep;if(el.state.focused){cu(el.display.input)}if(cs&&!bx){el.display.inputHasSelection=ep}}else{if(en){el.display.prevInput=el.display.input.value="";if(cs&&!bx){el.display.inputHasSelection=null}}}el.display.inaccurateSelection=em}function c1(el){if(el.options.readOnly!="nocursor"&&(!cM||document.activeElement!=el.display.input)){el.display.input.focus()}}function P(el){return el.options.readOnly||el.doc.cantEdit}function d3(em){var er=em.display;bf(er.scroller,"mousedown",b2(em,cU));if(cs){bf(er.scroller,"dblclick",b2(em,function(eu){if(ao(em,eu)){return}var ev=bA(em,eu);if(!ev||j(em,eu)||aB(em.display,eu)){return}bO(eu);var et=Y(dy(em.doc,ev.line).text,ev);d5(em.doc,et.from,et.to)}))}else{bf(er.scroller,"dblclick",function(et){ao(em,et)||bO(et)})}bf(er.lineSpace,"selectstart",function(et){if(!aB(er,et)){bO(et)}});if(!bQ){bf(er.scroller,"contextmenu",function(et){aa(em,et)})}bf(er.scroller,"scroll",function(){if(er.scroller.clientHeight){C(em,er.scroller.scrollTop);aZ(em,er.scroller.scrollLeft,true);ae(em,"scroll",em)}});bf(er.scrollbarV,"scroll",function(){if(er.scroller.clientHeight){C(em,er.scrollbarV.scrollTop)}});bf(er.scrollbarH,"scroll",function(){if(er.scroller.clientHeight){aZ(em,er.scrollbarH.scrollLeft)}});bf(er.scroller,"mousewheel",function(et){b(em,et)});bf(er.scroller,"DOMMouseScroll",function(et){b(em,et)});function es(){if(em.state.focused){setTimeout(bH(c1,em),0)}}bf(er.scrollbarH,"mousedown",es);bf(er.scrollbarV,"mousedown",es);bf(er.wrapper,"scroll",function(){er.wrapper.scrollTop=er.wrapper.scrollLeft=0});var el;function ep(){if(el==null){el=setTimeout(function(){el=null;er.cachedCharWidth=er.cachedTextHeight=cW=null;Q(em);bU(em,bH(N,em))},100)}}bf(window,"resize",ep);function eo(){for(var et=er.wrapper.parentNode;et&&et!=document.body;et=et.parentNode){}if(et){setTimeout(eo,5000)}else{cK(window,"resize",ep)}}setTimeout(eo,5000);bf(er.input,"keyup",b2(em,function(et){if(ao(em,et)||em.options.onKeyEvent&&em.options.onKeyEvent(em,V(et))){return}if(et.keyCode==16){em.doc.sel.shift=false}}));bf(er.input,"input",function(){if(cs&&!bx&&em.display.inputHasSelection){em.display.inputHasSelection=null}t(em)});bf(er.input,"keydown",b2(em,l));bf(er.input,"keypress",b2(em,bI));bf(er.input,"focus",bH(bL,em));bf(er.input,"blur",bH(aq,em));function en(et){if(ao(em,et)||em.options.onDragEvent&&em.options.onDragEvent(em,V(et))){return}cS(et)}if(em.options.dragDrop){bf(er.scroller,"dragstart",function(et){F(em,et)});bf(er.scroller,"dragenter",en);bf(er.scroller,"dragover",en);bf(er.scroller,"drop",b2(em,aI))}bf(er.scroller,"paste",function(et){if(aB(er,et)){return}c1(em);t(em)});bf(er.input,"paste",function(){if(b1&&!em.state.fakedLastChar&&!(new Date-em.state.lastMiddleDown<200)){var eu=er.input.selectionStart,et=er.input.selectionEnd;er.input.value+="$";er.input.selectionStart=eu;er.input.selectionEnd=et;em.state.fakedLastChar=true}em.state.pasteIncoming=true;t(em)});function eq(){if(er.inaccurateSelection){er.prevInput="";er.inaccurateSelection=false;er.input.value=em.getSelection();cu(er.input)}}bf(er.input,"cut",eq);bf(er.input,"copy",eq);if(aC){bf(er.sizer,"mouseup",function(){if(document.activeElement==er.input){er.input.blur()}c1(em)})}}function aB(em,el){for(var en=A(el);en!=em.wrapper;en=en.parentNode){if(!en||en.ignoreEvents||en.parentNode==em.sizer&&en!=em.mover){return true}}}function bA(em,er,eo){var eq=em.display;if(!eo){var ep=A(er);if(ep==eq.scrollbarH||ep==eq.scrollbarH.firstChild||ep==eq.scrollbarV||ep==eq.scrollbarV.firstChild||ep==eq.scrollbarFiller||ep==eq.gutterFiller){return null}}var el,es,en=ak(eq.lineSpace);try{el=er.clientX;es=er.clientY}catch(er){return null}return d2(em,el-en.left,es-en.top)}var cf,b9;function cU(eD){if(ao(this,eD)){return}var eo=this,ey=eo.display,eF=eo.doc,ew=eF.sel;ew.shift=eD.shiftKey;if(aB(ey,eD)){if(!b1){ey.scroller.draggable=false;setTimeout(function(){ey.scroller.draggable=true},100)}return}if(j(eo,eD)){return}var en=bA(eo,eD);switch(d0(eD)){case 3:if(bQ){aa.call(eo,eo,eD)}return;case 2:if(b1){eo.state.lastMiddleDown=+new Date}if(en){d5(eo.doc,en)}setTimeout(bH(c1,eo),20);bO(eD);return}if(!en){if(A(eD)==ey.scroller){bO(eD)}return}if(!eo.state.focused){bL(eo)}var el=+new Date,em="single";if(b9&&b9.time>el-400&&dX(b9.pos,en)){em="triple";bO(eD);setTimeout(bH(c1,eo),20);aL(eo,en.line)}else{if(cf&&cf.time>el-400&&dX(cf.pos,en)){em="double";b9={time:el,pos:en};bO(eD);var eA=Y(dy(eF,en.line).text,en);d5(eo.doc,eA.from,eA.to)}else{cf={time:el,pos:en}}}var ep=en;if(eo.options.dragDrop&&db&&!P(eo)&&!dX(ew.from,ew.to)&&!dz(en,ew.from)&&!dz(ew.to,en)&&em=="single"){var ez=b2(eo,function(eG){if(b1){ey.scroller.draggable=false}eo.state.draggingText=false;cK(document,"mouseup",ez);cK(ey.scroller,"drop",ez);if(Math.abs(eD.clientX-eG.clientX)+Math.abs(eD.clientY-eG.clientY)<10){bO(eG);d5(eo.doc,en);c1(eo)}});if(b1){ey.scroller.draggable=true}eo.state.draggingText=ez;if(ey.scroller.dragDrop){ey.scroller.dragDrop()}bf(document,"mouseup",ez);bf(ey.scroller,"drop",ez);return}bO(eD);if(em=="single"){d5(eo.doc,dY(eF,en))}var eE=ew.from,et=ew.to,ex=en;function eB(eH){if(dX(ex,eH)){return}ex=eH;if(em=="single"){d5(eo.doc,dY(eF,en),eH);return}eE=dY(eF,eE);et=dY(eF,et);if(em=="double"){var eG=Y(dy(eF,eH.line).text,eH);if(dz(eH,eE)){d5(eo.doc,eG.from,et)}else{d5(eo.doc,eE,eG.to)}}else{if(em=="triple"){if(dz(eH,eE)){d5(eo.doc,et,dY(eF,H(eH.line,0)))}else{d5(eo.doc,eE,dY(eF,H(eH.line+1,0)))}}}}var eu=ak(ey.wrapper);var eq=0;function eC(eI){var eG=++eq;var eK=bA(eo,eI,true);if(!eK){return}if(!dX(eK,ep)){if(!eo.state.focused){bL(eo)}ep=eK;eB(eK);var eJ=bj(ey,eF);if(eK.line>=eJ.to||eK.line<eJ.from){setTimeout(b2(eo,function(){if(eq==eG){eC(eI)}}),150)}}else{var eH=eI.clientY<eu.top?-20:eI.clientY>eu.bottom?20:0;if(eH){setTimeout(b2(eo,function(){if(eq!=eG){return}ey.scroller.scrollTop+=eH;eC(eI)}),50)}}}function es(eG){eq=Infinity;bO(eG);c1(eo);cK(document,"mousemove",ev);cK(document,"mouseup",er)}var ev=b2(eo,function(eG){if(!cs&&!d0(eG)){es(eG)}else{eC(eG)}});var er=b2(eo,es);bf(document,"mousemove",ev);bf(document,"mouseup",er)}function ej(ew,es,eu,ev,eo){try{var em=es.clientX,el=es.clientY}catch(es){return false}if(em>=Math.floor(ak(ew.display.gutters).right)){return false}if(ev){bO(es)}var et=ew.display;var er=ak(et.lineDiv);if(el>er.bottom||!dE(ew,eu)){return a6(es)}el-=er.top-et.viewOffset;for(var ep=0;ep<ew.options.gutters.length;++ep){var eq=et.gutters.childNodes[ep];if(eq&&ak(eq).right>=em){var ex=a1(ew.doc,el);var en=ew.options.gutters[ep];eo(ew,eu,ew,ex,en,es);return a6(es)}}}function cc(el,em){if(!dE(el,"gutterContextMenu")){return false}return ej(el,em,"gutterContextMenu",false,ae)}function j(el,em){return ej(el,em,"gutterClick",true,L)}var M=0;function aI(er){var et=this;if(ao(et,er)||aB(et.display,er)||(et.options.onDragEvent&&et.options.onDragEvent(et,V(er)))){return}bO(er);if(cs){M=+new Date}var es=bA(et,er,true),el=er.dataTransfer.files;if(!es||P(et)){return}if(el&&el.length&&window.FileReader&&window.File){var en=el.length,ev=Array(en),em=0;var eo=function(ey,ex){var ew=new FileReader;ew.onload=function(){ev[ex]=ew.result;if(++em==en){es=dY(et.doc,es);aG(et.doc,{from:es,to:es,text:av(ev.join("\n")),origin:"paste"},"around")}};ew.readAsText(ey)};for(var ep=0;ep<en;++ep){eo(el[ep],ep)}}else{if(et.state.draggingText&&!(dz(es,et.doc.sel.from)||dz(et.doc.sel.to,es))){et.state.draggingText(er);setTimeout(bH(c1,et),20);return}try{var ev=er.dataTransfer.getData("Text");if(ev){var eu=et.doc.sel.from,eq=et.doc.sel.to;bd(et.doc,es,es);if(et.state.draggingText){aw(et.doc,"",eu,eq,"paste")}et.replaceSelection(ev,null,"paste");c1(et)}}catch(er){}}}function F(em,eo){if(cs&&(!em.state.draggingText||+new Date-M<100)){cS(eo);return}if(ao(em,eo)||aB(em.display,eo)){return}var el=em.getSelection();eo.dataTransfer.setData("Text",el);if(eo.dataTransfer.setDragImage&&!ad){var en=d8("img",null,null,"position: fixed; left: 0; top: 0;");en.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";if(dQ){en.width=en.height=1;em.display.wrapper.appendChild(en);en._top=en.offsetTop}eo.dataTransfer.setDragImage(en,0,0);if(dQ){en.parentNode.removeChild(en)}}}function C(el,em){if(Math.abs(el.doc.scrollTop-em)<2){return}el.doc.scrollTop=em;if(!bB){ct(el,[],em)}if(el.display.scroller.scrollTop!=em){el.display.scroller.scrollTop=em}if(el.display.scrollbarV.scrollTop!=em){el.display.scrollbarV.scrollTop=em}if(bB){ct(el,[])}cL(el,100)}function aZ(el,en,em){if(em?en==el.doc.scrollLeft:Math.abs(el.doc.scrollLeft-en)<2){return}en=Math.min(en,el.display.scroller.scrollWidth-el.display.scroller.clientWidth);el.doc.scrollLeft=en;c5(el);if(el.display.scroller.scrollLeft!=en){el.display.scroller.scrollLeft=en}if(el.display.scrollbarH.scrollLeft!=en){el.display.scrollbarH.scrollLeft=en}}var dF=0,bt=null;if(cs){bt=-0.53}else{if(bB){bt=15}else{if(b8){bt=-0.7}else{if(ad){bt=-1/3}}}}function b(er,em){var eu=em.wheelDeltaX,et=em.wheelDeltaY;if(eu==null&&em.detail&&em.axis==em.HORIZONTAL_AXIS){eu=em.detail}if(et==null&&em.detail&&em.axis==em.VERTICAL_AXIS){et=em.detail}else{if(et==null){et=em.wheelDelta}}var eo=er.display,eq=eo.scroller;if(!(eu&&eq.scrollWidth>eq.clientWidth||et&&eq.scrollHeight>eq.clientHeight)){return}if(et&&bk&&b1){for(var es=em.target;es!=eq;es=es.parentNode){if(es.lineObj){er.display.currentWheelTarget=es;break}}}if(eu&&!bB&&!dQ&&bt!=null){if(et){C(er,Math.max(0,Math.min(eq.scrollTop+et*bt,eq.scrollHeight-eq.clientHeight)))}aZ(er,Math.max(0,Math.min(eq.scrollLeft+eu*bt,eq.scrollWidth-eq.clientWidth)));bO(em);eo.wheelStartX=null;return}if(et&&bt!=null){var el=et*bt;var ep=er.doc.scrollTop,en=ep+eo.wrapper.clientHeight;if(el<0){ep=Math.max(0,ep+el-50)}else{en=Math.min(er.doc.height,en+el+50)}ct(er,[],{top:ep,bottom:en})}if(dF<20){if(eo.wheelStartX==null){eo.wheelStartX=eq.scrollLeft;eo.wheelStartY=eq.scrollTop;eo.wheelDX=eu;eo.wheelDY=et;setTimeout(function(){if(eo.wheelStartX==null){return}var ev=eq.scrollLeft-eo.wheelStartX;var ex=eq.scrollTop-eo.wheelStartY;var ew=(ex&&eo.wheelDY&&ex/eo.wheelDY)||(ev&&eo.wheelDX&&ev/eo.wheelDX);eo.wheelStartX=eo.wheelStartY=null;if(!ew){return}bt=(bt*dF+ew)/(dF+1);++dF},200)}else{eo.wheelDX+=eu;eo.wheelDY+=et}}}function d4(em,ep,el){if(typeof ep=="string"){ep=c3[ep];if(!ep){return false}}if(em.display.pollingFast&&bu(em)){em.display.pollingFast=false}var eq=em.doc,eo=eq.sel.shift,en=false;try{if(P(em)){em.state.suppressEdits=true}if(el){eq.sel.shift=false}en=ep(em)!=bp}finally{eq.sel.shift=eo;em.state.suppressEdits=false}return en}function cj(el){var em=el.state.keyMaps.slice(0);if(el.options.extraKeys){em.push(el.options.extraKeys)}em.push(el.options.keyMap);return em}var W;function dC(el,er){var em=d6(el.options.keyMap),ep=em.auto;clearTimeout(W);if(ep&&!c2(er)){W=setTimeout(function(){if(d6(el.options.keyMap)==em){el.options.keyMap=(ep.call?ep.call(null,el):ep);ei(el)}},50)}var eo=dL(er,true),eq=false;if(!eo){return false}var en=cj(el);if(er.shiftKey){eq=g("Shift-"+eo,en,function(es){return d4(el,es,true)})||g(eo,en,function(es){if(typeof es=="string"?/^go[A-Z]/.test(es):es.motion){return d4(el,es)}})}else{eq=g(eo,en,function(es){return d4(el,es)})}if(eq){bO(er);k(el);if(bx){er.oldKeyCode=er.keyCode;er.keyCode=0}L(el,"keyHandled",el,eo,er)}return eq}function cO(el,eo,em){var en=g("'"+em+"'",cj(el),function(ep){return d4(el,ep,true)});if(en){bO(eo);k(el);L(el,"keyHandled",el,"'"+em+"'",eo)}return en}var ce=null;function l(eo){var el=this;if(!el.state.focused){bL(el)}if(ao(el,eo)||el.options.onKeyEvent&&el.options.onKeyEvent(el,V(eo))){return}if(cs&&eo.keyCode==27){eo.returnValue=false}var em=eo.keyCode;el.doc.sel.shift=em==16||eo.shiftKey;var en=dC(el,eo);if(dQ){ce=en?em:null;if(!en&&em==88&&!b7&&(bk?eo.metaKey:eo.ctrlKey)){el.replaceSelection("")}}}function bI(ep){var el=this;if(ao(el,ep)||el.options.onKeyEvent&&el.options.onKeyEvent(el,V(ep))){return}var eo=ep.keyCode,em=ep.charCode;if(dQ&&eo==ce){ce=null;bO(ep);return}if(((dQ&&(!ep.which||ep.which<10))||aC)&&dC(el,ep)){return}var en=String.fromCharCode(em==null?eo:em);if(this.options.electricChars&&this.doc.mode.electricChars&&this.options.smartIndent&&!P(this)&&this.doc.mode.electricChars.indexOf(en)>-1){setTimeout(b2(el,function(){K(el,el.doc.sel.to.line,"smart")}),75)}if(cO(el,ep,en)){return}if(cs&&!bx){el.display.inputHasSelection=null}t(el)}function bL(el){if(el.options.readOnly=="nocursor"){return}if(!el.state.focused){ae(el,"focus",el);el.state.focused=true;if(el.display.wrapper.className.search(/\bCodeMirror-focused\b/)==-1){el.display.wrapper.className+=" CodeMirror-focused"}if(!el.curOp){dJ(el,true);if(b1){setTimeout(bH(dJ,el,true),0)}}}aM(el);k(el)}function aq(el){if(el.state.focused){ae(el,"blur",el);el.state.focused=false;el.display.wrapper.className=el.display.wrapper.className.replace(" CodeMirror-focused","")}clearInterval(el.display.blinker);setTimeout(function(){if(!el.state.focused){el.doc.sel.shift=false}},150)}var dU;function aa(ev,eq){if(ao(ev,eq,"contextmenu")){return}var es=ev.display,em=ev.doc.sel;if(aB(es,eq)||cc(ev,eq)){return}var eu=bA(ev,eq),el=es.scroller.scrollTop;if(!eu||dQ){return}var ep=ev.options.resetSelectionOnContextMenu;if(ep&&(dX(em.from,em.to)||dz(eu,em.from)||!dz(eu,em.to))){b2(ev,bd)(ev.doc,eu,eu)}var er=es.input.style.cssText;es.inputDiv.style.position="absolute";es.input.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(eq.clientY-5)+"px; left: "+(eq.clientX-5)+"px; z-index: 1000; background: white; outline: none;border-width: 0; outline: none; overflow: hidden; opacity: .05; -ms-opacity: .05; filter: alpha(opacity=5);";c1(ev);dJ(ev,true);if(dX(em.from,em.to)){es.input.value=es.prevInput=" "}function eo(){if(es.input.selectionStart!=null){var ew=es.input.value="\u200b"+(dX(em.from,em.to)?"":es.input.value);es.prevInput="\u200b";es.input.selectionStart=1;es.input.selectionEnd=ew.length}}function et(){es.inputDiv.style.position="relative";es.input.style.cssText=er;if(bx){es.scrollbarV.scrollTop=es.scroller.scrollTop=el}aM(ev);if(es.input.selectionStart!=null){if(!cs||bx){eo()}clearTimeout(dU);var ew=0,ex=function(){if(es.prevInput==" "&&es.input.selectionStart==0){b2(ev,c3.selectAll)(ev)}else{if(ew++<10){dU=setTimeout(ex,500)}else{dJ(ev)}}};dU=setTimeout(ex,200)}}if(cs&&!bx){eo()}if(bQ){cS(eq);var en=function(){cK(window,"mouseup",en);setTimeout(et,20)};bf(window,"mouseup",en)}else{setTimeout(et,50)}}var bY=y.changeEnd=function(el){if(!el.text){return el.to}return H(el.from.line+el.text.length-1,dW(el.text).length+(el.text.length==1?el.from.ch:0))};function c4(ep,er,eq){if(!dz(er.from,eq)){return dY(ep,eq)}var eo=(er.text.length-1)-(er.to.line-er.from.line);if(eq.line>er.to.line+eo){var en=eq.line-eo,em=ep.first+ep.size-1;if(en>em){return H(em,dy(ep,em).text.length)}return dM(eq,dy(ep,en).text.length)}if(eq.line==er.to.line+eo){return dM(eq,dW(er.text).length+(er.text.length==1?er.from.ch:0)+dy(ep,er.to.line).text.length-er.to.ch)}var el=eq.line-er.from.line;return dM(eq,er.text[el].length+(el?0:er.from.ch))}function dD(em,ep,en){if(en&&typeof en=="object"){return{anchor:c4(em,ep,en.anchor),head:c4(em,ep,en.head)}}if(en=="start"){return{anchor:ep.from,head:ep.from}}var el=bY(ep);if(en=="around"){return{anchor:ep.from,head:el}}if(en=="end"){return{anchor:el,head:el}}var eo=function(es){if(dz(es,ep.from)){return es}if(!dz(ep.to,es)){return el}var eq=es.line+ep.text.length-(ep.to.line-ep.from.line)-1,er=es.ch;if(es.line==ep.to.line){er+=el.ch-ep.to.ch}return H(eq,er)};return{anchor:eo(em.sel.anchor),head:eo(em.sel.head)}}function cx(em,eo,en){var el={canceled:false,from:eo.from,to:eo.to,text:eo.text,origin:eo.origin,cancel:function(){this.canceled=true}};if(en){el.update=function(es,er,eq,ep){if(es){this.from=dY(em,es)}if(er){this.to=dY(em,er)}if(eq){this.text=eq}if(ep!==undefined){this.origin=ep}}}ae(em,"beforeChange",em,el);if(em.cm){ae(em.cm,"beforeChange",em.cm,el)}if(el.canceled){return null}return{from:el.from,to:el.to,text:el.text,origin:el.origin}}function aG(eo,eq,ep,en){if(eo.cm){if(!eo.cm.curOp){return b2(eo.cm,aG)(eo,eq,ep,en)}if(eo.cm.state.suppressEdits){return}}if(dE(eo,"beforeChange")||eo.cm&&dE(eo.cm,"beforeChange")){eq=cx(eo,eq,true);if(!eq){return}}var em=ef&&!en&&bP(eo,eq.from,eq.to);if(em){for(var el=em.length-1;el>=1;--el){am(eo,{from:em[el].from,to:em[el].to,text:[""]})}if(em.length){am(eo,{from:em[0].from,to:em[0].to,text:eq.text},ep)}}else{am(eo,eq,ep)}}function am(en,ep,eo){if(ep.text.length==1&&ep.text[0]==""&&dX(ep.from,ep.to)){return}var em=dD(en,ep,eo);c8(en,ep,em,en.cm?en.cm.curOp.id:NaN);cJ(en,ep,em,cP(en,ep));var el=[];cE(en,function(er,eq){if(!eq&&cd(el,er.history)==-1){cr(er.history,ep);el.push(er.history)}cJ(er,ep,null,cP(er,ep))})}function bm(eu,er){if(eu.cm&&eu.cm.state.suppressEdits){return}var eq=eu.history;var em=(er=="undo"?eq.done:eq.undone).pop();if(!em){return}var es={changes:[],anchorBefore:em.anchorAfter,headBefore:em.headAfter,anchorAfter:em.anchorBefore,headAfter:em.headBefore,generation:eq.generation};(er=="undo"?eq.undone:eq.done).push(es);eq.generation=em.generation||++eq.maxGeneration;var en=dE(eu,"beforeChange")||eu.cm&&dE(eu.cm,"beforeChange");for(var eo=em.changes.length-1;eo>=0;--eo){var et=em.changes[eo];et.origin=er;if(en&&!cx(eu,et,false)){(er=="undo"?eq.done:eq.undone).length=0;return}es.changes.push(ck(eu,et));var el=eo?dD(eu,et,null):{anchor:em.anchorBefore,head:em.headBefore};cJ(eu,et,el,cG(eu,et));var ep=[];cE(eu,function(ew,ev){if(!ev&&cd(ep,ew.history)==-1){cr(ew.history,et);ep.push(ew.history)}cJ(ew,et,null,cG(ew,et))})}}function dG(el,en){function em(eo){return H(eo.line+en,eo.ch)}el.first+=en;if(el.cm){N(el.cm,el.first,el.first,en)}el.sel.head=em(el.sel.head);el.sel.anchor=em(el.sel.anchor);el.sel.from=em(el.sel.from);el.sel.to=em(el.sel.to)}function cJ(ep,eq,eo,em){if(ep.cm&&!ep.cm.curOp){return b2(ep.cm,cJ)(ep,eq,eo,em)}if(eq.to.line<ep.first){dG(ep,eq.text.length-1-(eq.to.line-eq.from.line));return}if(eq.from.line>ep.lastLine()){return}if(eq.from.line<ep.first){var el=eq.text.length-1-(ep.first-eq.from.line);dG(ep,el);eq={from:H(ep.first,0),to:H(eq.to.line+el,eq.to.ch),text:[dW(eq.text)],origin:eq.origin}}var en=ep.lastLine();if(eq.to.line>en){eq={from:eq.from,to:H(en,dy(ep,en).text.length),text:[eq.text[0]],origin:eq.origin}}eq.removed=ea(ep,eq.from,eq.to);if(!eo){eo=dD(ep,eq,null)}if(ep.cm){ai(ep.cm,eq,em,eo)}else{dR(ep,eq,em,eo)}}function ai(ev,er,eo,el){var eu=ev.doc,eq=ev.display,es=er.from,et=er.to;var em=false,en=es.line;if(!ev.options.lineWrapping){en=a8(s(eu,dy(eu,es.line)));eu.iter(en,et.line+1,function(ey){if(ey==eq.maxLine){em=true;return true}})}if(!dz(eu.sel.head,er.from)&&!dz(er.to,eu.sel.head)){ev.curOp.cursorActivity=true}dR(eu,er,eo,el,aE(ev));if(!ev.options.lineWrapping){eu.iter(en,es.line+er.text.length,function(ez){var ey=cQ(eu,ez);if(ey>eq.maxLineLength){eq.maxLine=ez;eq.maxLineLength=ey;eq.maxLineChanged=true;em=false}});if(em){ev.curOp.updateMaxLine=true}}eu.frontier=Math.min(eu.frontier,es.line);cL(ev,400);var ex=er.text.length-(et.line-es.line)-1;N(ev,es.line,et.line+1,ex);if(dE(ev,"change")){var ep={from:es,to:et,text:er.text,removed:er.removed,origin:er.origin};if(ev.curOp.textChanged){for(var ew=ev.curOp.textChanged;ew.next;ew=ew.next){}ew.next=ep}else{ev.curOp.textChanged=ep}}}function aw(eo,en,eq,ep,el){if(!ep){ep=eq}if(dz(ep,eq)){var em=ep;ep=eq;eq=em}if(typeof en=="string"){en=av(en)}aG(eo,{from:eq,to:ep,text:en,origin:el},null)}function H(el,em){if(!(this instanceof H)){return new H(el,em)}this.line=el;this.ch=em}y.Pos=H;function dX(em,el){return em.line==el.line&&em.ch==el.ch}function dz(em,el){return em.line<el.line||(em.line==el.line&&em.ch<el.ch)}function bv(el){return H(el.line,el.ch)}function b4(el,em){return Math.max(el.first,Math.min(em,el.first+el.size-1))}function dY(em,en){if(en.line<em.first){return H(em.first,0)}var el=em.first+em.size-1;if(en.line>el){return H(el,dy(em,el).text.length)}return dM(en,dy(em,en.line).text.length)}function dM(en,em){var el=en.ch;if(el==null||el>em){return H(en.line,em)}else{if(el<0){return H(en.line,0)}else{return en}}}function bn(em,el){return el>=em.first&&el<em.first+em.size}function d5(ep,eq,el,em){if(ep.sel.shift||ep.sel.extend){var eo=ep.sel.anchor;if(el){var en=dz(eq,eo);if(en!=dz(el,eo)){eo=eq;eq=el}else{if(en!=dz(eq,el)){eq=el}}}bd(ep,eo,eq,em)}else{bd(ep,eq,el||eq,em)}if(ep.cm){ep.cm.curOp.userSelChange=true}}function c(eo,el,em){var en={anchor:el,head:em};ae(eo,"beforeSelectionChange",eo,en);if(eo.cm){ae(eo.cm,"beforeSelectionChange",eo.cm,en)}en.anchor=dY(eo,en.anchor);en.head=dY(eo,en.head);return en}function bd(es,ep,eq,en,em){if(!em&&dE(es,"beforeSelectionChange")||es.cm&&dE(es.cm,"beforeSelectionChange")){var eo=c(es,ep,eq);eq=eo.head;ep=eo.anchor}var er=es.sel;er.goalColumn=null;if(en==null){en=dz(eq,er.head)?-1:1}if(em||!dX(ep,er.anchor)){ep=be(es,ep,en,em!="push")}if(em||!dX(eq,er.head)){eq=be(es,eq,en,em!="push")}if(dX(er.anchor,ep)&&dX(er.head,eq)){return}er.anchor=ep;er.head=eq;var el=dz(eq,ep);er.from=el?eq:ep;er.to=el?ep:eq;if(es.cm){es.cm.curOp.updateInput=es.cm.curOp.selectionChanged=es.cm.curOp.cursorActivity=true}L(es,"cursorActivity",es)}function cX(el){bd(el.doc,el.doc.sel.from,el.doc.sel.to,null,"push")}function be(eu,et,eq,er){var ev=false,en=et;var eo=eq||1;eu.cantEdit=false;search:for(;;){var ew=dy(eu,en.line);if(ew.markedSpans){for(var ep=0;ep<ew.markedSpans.length;++ep){var el=ew.markedSpans[ep],em=el.marker;if((el.from==null||(em.inclusiveLeft?el.from<=en.ch:el.from<en.ch))&&(el.to==null||(em.inclusiveRight?el.to>=en.ch:el.to>en.ch))){if(er){ae(em,"beforeCursorEnter");if(em.explicitlyCleared){if(!ew.markedSpans){break}else{--ep;continue}}}if(!em.atomic){continue}var es=em.find()[eo<0?"from":"to"];if(dX(es,en)){es.ch+=eo;if(es.ch<0){if(es.line>eu.first){es=dY(eu,H(es.line-1))}else{es=null}}else{if(es.ch>ew.text.length){if(es.line<eu.first+eu.size-1){es=H(es.line+1,0)}else{es=null}}}if(!es){if(ev){if(!er){return be(eu,et,eq,true)}eu.cantEdit=true;return H(eu.first,0)}ev=true;es=et;eo=-eo}}en=es;continue search}}}return en}}function ab(em){var ep=u(em,em.doc.sel.head,null,em.options.cursorScrollMargin);if(!em.state.focused){return}var eq=em.display,en=ak(eq.sizer),el=null;if(ep.top+en.top<0){el=true}else{if(ep.bottom+en.top>(window.innerHeight||document.documentElement.clientHeight)){el=false}}if(el!=null&&!dN){var eo=eq.cursor.style.display=="none";if(eo){eq.cursor.style.display="";eq.cursor.style.left=ep.left+"px";eq.cursor.style.top=(ep.top-eq.viewOffset)+"px"}eq.cursor.scrollIntoView(el);if(eo){eq.cursor.style.display="none"}}}function u(eu,es,ep,eo){if(eo==null){eo=0}for(;;){var eq=false,et=cy(eu,es);var el=!ep||ep==es?et:cy(eu,ep);var en=x(eu,Math.min(et.left,el.left),Math.min(et.top,el.top)-eo,Math.max(et.left,el.left),Math.max(et.bottom,el.bottom)+eo);var er=eu.doc.scrollTop,em=eu.doc.scrollLeft;if(en.scrollTop!=null){C(eu,en.scrollTop);if(Math.abs(eu.doc.scrollTop-er)>1){eq=true}}if(en.scrollLeft!=null){aZ(eu,en.scrollLeft);if(Math.abs(eu.doc.scrollLeft-em)>1){eq=true}}if(!eq){return et}}}function w(el,en,ep,em,eo){var eq=x(el,en,ep,em,eo);if(eq.scrollTop!=null){C(el,eq.scrollTop)}if(eq.scrollLeft!=null){aZ(el,eq.scrollLeft)}}function x(er,ez,eo,ey,en){var ew=er.display,ev=at(er.display);if(eo<0){eo=0}var em=ew.scroller.clientHeight-aJ,eu=ew.scroller.scrollTop,et={};var eB=er.doc.height+a3(ew);var eC=eo<ev,ex=en>eB-ev;if(eo<eu){et.scrollTop=eC?0:eo}else{if(en>eu+em){var es=Math.min(eo,(ex?eB:en)-em);if(es!=eu){et.scrollTop=es}}}var eq=ew.scroller.clientWidth-aJ,el=ew.scroller.scrollLeft;ez+=ew.gutters.offsetWidth;ey+=ew.gutters.offsetWidth;var ep=ew.gutters.offsetWidth;var eA=ez<ep+10;if(ez<el+ep||eA){if(eA){ez=0}et.scrollLeft=Math.max(0,ez-10-ep)}else{if(ey>eq+el-3){et.scrollLeft=ey+10-eq}}return et}function v(el,en,em){el.curOp.updateScrollPos={scrollLeft:en==null?el.doc.scrollLeft:en,scrollTop:em==null?el.doc.scrollTop:em}}function bT(em,eo,en){var ep=em.curOp.updateScrollPos||(em.curOp.updateScrollPos={scrollLeft:em.doc.scrollLeft,scrollTop:em.doc.scrollTop});var el=em.display.scroller;ep.scrollTop=Math.max(0,Math.min(el.scrollHeight-el.clientHeight,ep.scrollTop+en));ep.scrollLeft=Math.max(0,Math.min(el.scrollWidth-el.clientWidth,ep.scrollLeft+eo))}function K(ex,eo,ew,en){var ev=ex.doc;if(ew==null){ew="add"}if(ew=="smart"){if(!ex.doc.mode.indent){ew="prev"}else{var em=co(ex,eo)}}var er=ex.options.tabSize;var ey=dy(ev,eo),eq=bb(ey.text,null,er);var el=ey.text.match(/^\s*/)[0],et;if(ew=="smart"){et=ex.doc.mode.indent(em,ey.text.slice(el.length),ey.text);if(et==bp){if(!en){return}ew="prev"}}if(ew=="prev"){if(eo>ev.first){et=bb(dy(ev,eo-1).text,null,er)}else{et=0}}else{if(ew=="add"){et=eq+ex.options.indentUnit}else{if(ew=="subtract"){et=eq-ex.options.indentUnit}else{if(typeof ew=="number"){et=eq+ew}}}}et=Math.max(0,et);var eu="",es=0;if(ex.options.indentWithTabs){for(var ep=Math.floor(et/er);ep;--ep){es+=er;eu+="\t"}}if(es<et){eu+=bC(et-es)}if(eu!=el){aw(ex.doc,eu,H(eo,0),H(eo,el.length),"+input")}else{if(ev.sel.head.line==eo&&ev.sel.head.ch<el.length){bd(ev,H(eo,el.length),H(eo,el.length),1)}}ey.stateAfter=null}function cZ(el,en,eq){var ep=en,em=en,eo=el.doc;if(typeof en=="number"){em=dy(eo,b4(eo,en))}else{ep=a8(en)}if(ep==null){return null}if(eq(em,ep)){N(el,ep,ep+1)}else{return null}return em}function aU(eC,eo,ew,ev,eq){var et=eo.line,eu=eo.ch,eB=ew;var el=dy(eC,et);var ez=true;function eA(){var eD=et+ew;if(eD<eC.first||eD>=eC.first+eC.size){return(ez=false)}et=eD;return el=dy(eC,eD)}function ey(eE){var eD=(eq?p:O)(el,eu,ew,true);if(eD==null){if(!eE&&eA()){if(eq){eu=(ew<0?bX:bN)(el)}else{eu=ew<0?el.text.length:0}}else{return(ez=false)}}else{eu=eD}return true}if(ev=="char"){ey()}else{if(ev=="column"){ey(true)}else{if(ev=="word"||ev=="group"){var ex=null,er=ev=="group";for(var ep=true;;ep=false){if(ew<0&&!ey(!ep)){break}var em=el.text.charAt(eu)||"\n";var en=bK(em)?"w":!er?null:/\s/.test(em)?null:"p";if(ex&&ex!=en){if(ew<0){ew=1;ey()}break}if(en){ex=en}if(ew>0&&!ey(!ep)){break}}}}}var es=be(eC,H(et,eu),eB,true);if(!ez){es.hitSide=true}return es}function aQ(et,eo,el,es){var er=et.doc,eq=eo.left,ep;if(es=="page"){var en=Math.min(et.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);ep=eo.top+el*(en-(el<0?1.5:0.5)*at(et.display))}else{if(es=="line"){ep=el>0?eo.bottom+3:eo.top-3}}for(;;){var em=d2(et,eq,ep);if(!em.outside){break}if(el<0?ep<=0:ep>=er.height){em.hitSide=true;break}ep+=el*5}return em}function Y(eo,eq){var ep=eq.ch,en=eq.ch;if(eo){if((eq.xRel<0||en==eo.length)&&ep){--ep}else{++en}var em=eo.charAt(ep);var el=bK(em)?bK:/\s/.test(em)?function(er){return/\s/.test(er)}:function(er){return !/\s/.test(er)&&!bK(er)};while(ep>0&&el(eo.charAt(ep-1))){--ep}while(en<eo.length&&el(eo.charAt(en))){++en}}return{from:H(eq.line,ep),to:H(eq.line,en)}}function aL(el,em){d5(el.doc,H(em,0),dY(el.doc,H(em+1,0)))}y.prototype={constructor:y,focus:function(){window.focus();c1(this);t(this)},setOption:function(en,eo){var em=this.options,el=em[en];if(em[en]==eo&&en!="mode"){return}em[en]=eo;if(aF.hasOwnProperty(en)){b2(this,aF[en])(this,eo,el)}},getOption:function(el){return this.options[el]},getDoc:function(){return this.doc},addKeyMap:function(em,el){this.state.keyMaps[el?"push":"unshift"](em)},removeKeyMap:function(em){var en=this.state.keyMaps;for(var el=0;el<en.length;++el){if(en[el]==em||(typeof en[el]!="string"&&en[el].name==em)){en.splice(el,1);return true}}},addOverlay:b2(null,function(el,em){var en=el.token?el:y.getMode(this.options,el);if(en.startState){throw new Error("Overlays may not be stateful.")}this.state.overlays.push({mode:en,modeSpec:el,opaque:em&&em.opaque});this.state.modeGen++;N(this)}),removeOverlay:b2(null,function(el){var en=this.state.overlays;for(var em=0;em<en.length;++em){var eo=en[em].modeSpec;if(eo==el||typeof el=="string"&&eo.name==el){en.splice(em,1);this.state.modeGen++;N(this);return}}}),indentLine:b2(null,function(en,el,em){if(typeof el!="string"&&typeof el!="number"){if(el==null){el=this.options.smartIndent?"smart":"prev"}else{el=el?"add":"subtract"}}if(bn(this.doc,en)){K(this,en,el,em)}}),indentSelection:b2(null,function(em){var en=this.doc.sel;if(dX(en.from,en.to)){return K(this,en.from.line,em)}var eo=en.to.line-(en.to.ch?0:1);for(var el=en.from.line;el<=eo;++el){K(this,el,em)}}),getTokenAt:function(es,em){var ep=this.doc;es=dY(ep,es);var eo=co(this,es.line,em),er=this.doc.mode;var el=dy(ep,es.line);var eq=new dg(el.text,this.options.tabSize);while(eq.pos<es.ch&&!eq.eol()){eq.start=eq.pos;var en=er.token(eq,eo)}return{start:eq.start,end:eq.pos,string:eq.current(),className:en||null,type:en||null,state:eo}},getTokenTypeAt:function(eq){eq=dY(this.doc,eq);var en=b6(this,dy(this.doc,eq.line));var eo=0,ep=(en.length-1)/2,em=eq.ch;if(em==0){return en[2]}for(;;){var el=(eo+ep)>>1;if((el?en[el*2-1]:0)>=em){ep=el}else{if(en[el*2+1]<em){eo=el+1}else{return en[el*2+2]}}}},getModeAt:function(em){var el=this.doc.mode;if(!el.innerMode){return el}return y.innerMode(el,this.getTokenAt(em).state).mode},getHelper:function(eo,em){if(!dH.hasOwnProperty(em)){return}var el=dH[em],en=this.getModeAt(eo);return en[em]&&el[en[em]]||en.helperType&&el[en.helperType]||el[en.name]},getStateAfter:function(em,el){var en=this.doc;em=b4(en,em==null?en.first+en.size-1:em);return co(this,em+1,el)},cursorCoords:function(eo,em){var en,el=this.doc.sel;if(eo==null){en=el.head}else{if(typeof eo=="object"){en=dY(this.doc,eo)}else{en=eo?el.from:el.to}}return cy(this,en,em||"page")},charCoords:function(em,el){return bS(this,dY(this.doc,em),el||"page")},coordsChar:function(el,em){el=eh(this,el,em||"page");return d2(this,el.left,el.top)},lineAtHeight:function(el,em){el=eh(this,{top:el,left:0},em||"page").top;return a1(this.doc,el+this.display.viewOffset)},heightAtLine:function(em,ep){var el=false,eo=this.doc.first+this.doc.size-1;if(em<this.doc.first){em=this.doc.first}else{if(em>eo){em=eo;el=true}}var en=dy(this.doc,em);return dd(this,dy(this.doc,em),{top:0,left:0},ep||"page").top+(el?en.height:0)},defaultTextHeight:function(){return at(this.display)},defaultCharWidth:function(){return cq(this.display)},setGutterMarker:b2(null,function(el,em,en){return cZ(this,el,function(eo){var ep=eo.gutterMarkers||(eo.gutterMarkers={});ep[em]=en;if(!en&&dh(ep)){eo.gutterMarkers=null}return true})}),clearGutter:b2(null,function(en){var el=this,eo=el.doc,em=eo.first;eo.iter(function(ep){if(ep.gutterMarkers&&ep.gutterMarkers[en]){ep.gutterMarkers[en]=null;N(el,em,em+1);if(dh(ep.gutterMarkers)){ep.gutterMarkers=null}}++em})}),addLineClass:b2(null,function(en,em,el){return cZ(this,en,function(eo){var ep=em=="text"?"textClass":em=="background"?"bgClass":"wrapClass";if(!eo[ep]){eo[ep]=el}else{if(new RegExp("(?:^|\\s)"+el+"(?:$|\\s)").test(eo[ep])){return false}else{eo[ep]+=" "+el}}return true})}),removeLineClass:b2(null,function(en,em,el){return cZ(this,en,function(ep){var es=em=="text"?"textClass":em=="background"?"bgClass":"wrapClass";var er=ep[es];if(!er){return false}else{if(el==null){ep[es]=null}else{var eq=er.match(new RegExp("(?:^|\\s+)"+el+"(?:$|\\s+)"));if(!eq){return false}var eo=eq.index+eq[0].length;ep[es]=er.slice(0,eq.index)+(!eq.index||eo==er.length?"":" ")+er.slice(eo)||null}}return true})}),addLineWidget:b2(null,function(en,em,el){return a2(this,en,em,el)}),removeLineWidget:function(el){el.clear()},lineInfo:function(el){if(typeof el=="number"){if(!bn(this.doc,el)){return null}var em=el;el=dy(this.doc,el);if(!el){return null}}else{var em=a8(el);if(em==null){return null}}return{line:em,handle:el,text:el.text,gutterMarkers:el.gutterMarkers,textClass:el.textClass,bgClass:el.bgClass,wrapClass:el.wrapClass,widgets:el.widgets}},getViewport:function(){return{from:this.display.showingFrom,to:this.display.showingTo}},addWidget:function(eq,en,es,eo,eu){var ep=this.display;eq=cy(this,dY(this.doc,eq));var er=eq.bottom,em=eq.left;en.style.position="absolute";ep.sizer.appendChild(en);if(eo=="over"){er=eq.top}else{if(eo=="above"||eo=="near"){var el=Math.max(ep.wrapper.clientHeight,this.doc.height),et=Math.max(ep.sizer.clientWidth,ep.lineSpace.clientWidth);if((eo=="above"||eq.bottom+en.offsetHeight>el)&&eq.top>en.offsetHeight){er=eq.top-en.offsetHeight}else{if(eq.bottom+en.offsetHeight<=el){er=eq.bottom}}if(em+en.offsetWidth>et){em=et-en.offsetWidth}}}en.style.top=er+"px";en.style.left=en.style.right="";if(eu=="right"){em=ep.sizer.clientWidth-en.offsetWidth;en.style.right="0px"}else{if(eu=="left"){em=0}else{if(eu=="middle"){em=(ep.sizer.clientWidth-en.offsetWidth)/2}}en.style.left=em+"px"}if(es){w(this,em,er,em+en.offsetWidth,er+en.offsetHeight)}},triggerOnKeyDown:b2(null,l),execCommand:function(el){return c3[el](this)},findPosH:function(er,eo,ep,em){var el=1;if(eo<0){el=-1;eo=-eo}for(var en=0,eq=dY(this.doc,er);en<eo;++en){eq=aU(this.doc,eq,el,ep,em);if(eq.hitSide){break}}return eq},moveH:b2(null,function(el,em){var en=this.doc.sel,eo;if(en.shift||en.extend||dX(en.from,en.to)){eo=aU(this.doc,en.head,el,em,this.options.rtlMoveVisually)}else{eo=el<0?en.from:en.to}d5(this.doc,eo,eo,el)}),deleteH:b2(null,function(el,em){var en=this.doc.sel;if(!dX(en.from,en.to)){aw(this.doc,"",en.from,en.to,"+delete")}else{aw(this.doc,"",en.from,aU(this.doc,en.head,el,em,false),"+delete")}this.curOp.userSelChange=true}),findPosV:function(eq,en,er,et){var el=1,ep=et;if(en<0){el=-1;en=-en}for(var em=0,es=dY(this.doc,eq);em<en;++em){var eo=cy(this,es,"div");if(ep==null){ep=eo.left}else{eo.left=ep}es=aQ(this,eo,el,er);if(es.hitSide){break}}return es},moveV:b2(null,function(el,em){var en=this.doc.sel;var ep=cy(this,en.head,"div");if(en.goalColumn!=null){ep.left=en.goalColumn}var eo=aQ(this,ep,el,em);if(em=="page"){bT(this,0,bS(this,eo,"div").top-ep.top)}d5(this.doc,eo,eo,el);en.goalColumn=ep.left}),toggleOverwrite:function(el){if(el!=null&&el==this.state.overwrite){return}if(this.state.overwrite=!this.state.overwrite){this.display.cursor.className+=" CodeMirror-overwrite"}else{this.display.cursor.className=this.display.cursor.className.replace(" CodeMirror-overwrite","")}},hasFocus:function(){return this.state.focused},scrollTo:b2(null,function(el,em){v(this,el,em)}),getScrollInfo:function(){var el=this.display.scroller,em=aJ;return{left:el.scrollLeft,top:el.scrollTop,height:el.scrollHeight-em,width:el.scrollWidth-em,clientHeight:el.clientHeight-em,clientWidth:el.clientWidth-em}},scrollIntoView:b2(null,function(em,eo){if(em==null){em={from:this.doc.sel.head,to:null}}else{if(typeof em=="number"){em={from:H(em,0),to:null}}else{if(em.from==null){em={from:em,to:null}}}}if(!em.to){em.to=em.from}if(!eo){eo=0}var en=em;if(em.from.line!=null){this.curOp.scrollToPos={from:em.from,to:em.to,margin:eo};en={from:cy(this,em.from),to:cy(this,em.to)}}var el=x(this,Math.min(en.from.left,en.to.left),Math.min(en.from.top,en.to.top)-eo,Math.max(en.from.right,en.to.right),Math.max(en.from.bottom,en.to.bottom)+eo);v(this,el.scrollLeft,el.scrollTop)}),setSize:b2(null,function(en,el){function em(eo){return typeof eo=="number"||/^\d+$/.test(String(eo))?eo+"px":eo}if(en!=null){this.display.wrapper.style.width=em(en)}if(el!=null){this.display.wrapper.style.height=em(el)}if(this.options.lineWrapping){this.display.measureLineCache.length=this.display.measureLineCachePos=0}this.curOp.forceUpdate=true}),operation:function(el){return bU(this,el)},refresh:b2(null,function(){var el=this.display.cachedTextHeight==null;Q(this);v(this,this.doc.scrollLeft,this.doc.scrollTop);N(this);if(el){I(this)}}),swapDoc:b2(null,function(em){var el=this.doc;el.cm=null;cH(this,em);Q(this);dJ(this,true);v(this,em.scrollLeft,em.scrollTop);L(this,"swapDoc",this,el);return el}),getInputField:function(){return this.display.input},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}};aV(y);var aF=y.optionHandlers={};var dp=y.defaults={};function n(el,eo,en,em){y.defaults[el]=eo;if(en){aF[el]=em?function(ep,er,eq){if(eq!=bq){en(ep,er,eq)}}:en}}var bq=y.Init={toString:function(){return"CodeMirror.Init"}};n("value","",function(el,em){el.setValue(em)},true);n("mode",null,function(el,em){el.doc.modeOption=em;aR(el)},true);n("indentUnit",2,aR,true);n("indentWithTabs",false);n("smartIndent",true);n("tabSize",4,function(el){aR(el);Q(el);N(el)},true);n("specialChars",/[\t\u0000-\u0019\u00ad\u200b\u2028\u2029\ufeff]/g,function(el,em){el.options.specialChars=new RegExp(em.source+(em.test("\t")?"":"|\t"),"g");el.refresh()},true);n("specialCharPlaceholder",dw,function(el){el.refresh()},true);n("electricChars",true);n("rtlMoveVisually",!al);n("wholeLineUpdateBefore",true);n("theme","default",function(el){bV(el);cl(el)},true);n("keyMap","default",ei);n("extraKeys",null);n("onKeyEvent",null);n("onDragEvent",null);n("lineWrapping",false,c9,true);n("gutters",[],function(el){bs(el.options);cl(el)},true);n("fixedGutter",true,function(el,em){el.display.gutters.style.left=em?cA(el.display)+"px":"0";el.refresh()},true);n("coverGutterNextToScrollbar",false,dk,true);n("lineNumbers",false,function(el){bs(el.options);cl(el)},true);n("firstLineNumber",1,cl,true);n("lineNumberFormatter",function(el){return el},cl,true);n("showCursorWhenSelecting",false,aY,true);n("resetSelectionOnContextMenu",true);n("readOnly",false,function(el,em){if(em=="nocursor"){aq(el);el.display.input.blur();el.display.disabled=true}else{el.display.disabled=false;if(!em){dJ(el,true)}}});n("dragDrop",true);n("cursorBlinkRate",530);n("cursorScrollMargin",0);n("cursorHeight",1);n("workTime",100);n("workDelay",100);n("flattenSpans",true);n("pollInterval",100);n("undoDepth",40,function(el,em){el.doc.history.undoDepth=em});n("historyEventDelay",500);n("viewportMargin",10,function(el){el.refresh()},true);n("maxHighlightLength",10000,function(el){aR(el);el.refresh()},true);n("crudeMeasuringFrom",10000);n("moveInputWithCursor",true,function(el,em){if(!em){el.display.inputDiv.style.top=el.display.inputDiv.style.left=0}});n("tabindex",null,function(el,em){el.display.input.tabIndex=em||""});n("autofocus",null);var ci=y.modes={},ap=y.mimeModes={};y.defineMode=function(el,en){if(!y.defaults.mode&&el!="null"){y.defaults.mode=el}if(arguments.length>2){en.dependencies=[];for(var em=2;em<arguments.length;++em){en.dependencies.push(arguments[em])}}ci[el]=en};y.defineMIME=function(em,el){ap[em]=el};y.resolveMode=function(el){if(typeof el=="string"&&ap.hasOwnProperty(el)){el=ap[el]}else{if(el&&typeof el.name=="string"&&ap.hasOwnProperty(el.name)){var em=ap[el.name];el=bw(em,el);el.name=em.name}else{if(typeof el=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(el)){return y.resolveMode("application/xml")}}}if(typeof el=="string"){return{name:el}}else{return el||{name:"null"}}};y.getMode=function(em,el){var el=y.resolveMode(el);var eo=ci[el.name];if(!eo){return y.getMode(em,"text/plain")}var ep=eo(em,el);if(cg.hasOwnProperty(el.name)){var en=cg[el.name];for(var eq in en){if(!en.hasOwnProperty(eq)){continue}if(ep.hasOwnProperty(eq)){ep["_"+eq]=ep[eq]}ep[eq]=en[eq]}}ep.name=el.name;return ep};y.defineMode("null",function(){return{token:function(el){el.skipToEnd()}}});y.defineMIME("text/plain","null");var cg=y.modeExtensions={};y.extendMode=function(en,em){var el=cg.hasOwnProperty(en)?cg[en]:(cg[en]={});aj(em,el)};y.defineExtension=function(el,em){y.prototype[el]=em};y.defineDocExtension=function(el,em){X.prototype[el]=em};y.defineOption=n;var az=[];y.defineInitHook=function(el){az.push(el)};var dH=y.helpers={};y.registerHelper=function(em,el,en){if(!dH.hasOwnProperty(em)){dH[em]=y[em]={}}dH[em][el]=en};y.isWordChar=bK;function bi(eo,el){if(el===true){return el}if(eo.copyState){return eo.copyState(el)}var en={};for(var ep in el){var em=el[ep];if(em instanceof Array){em=em.concat([])}en[ep]=em}return en}y.copyState=bi;function bh(en,em,el){return en.startState?en.startState(em,el):true}y.startState=bh;y.innerMode=function(en,el){while(en.innerMode){var em=en.innerMode(el);if(!em||em.mode==en){break}el=em.state;en=em.mode}return em||{mode:en,state:el}};var c3=y.commands={selectAll:function(el){el.setSelection(H(el.firstLine(),0),H(el.lastLine()))},killLine:function(el){var eo=el.getCursor(true),en=el.getCursor(false),em=!dX(eo,en);if(!em&&el.getLine(eo.line).length==eo.ch){el.replaceRange("",eo,H(eo.line+1,0),"+delete")}else{el.replaceRange("",eo,em?en:H(eo.line),"+delete")}},deleteLine:function(el){var em=el.getCursor().line;el.replaceRange("",H(em,0),H(em),"+delete")},delLineLeft:function(el){var em=el.getCursor();el.replaceRange("",H(em.line,0),em,"+delete")},undo:function(el){el.undo()},redo:function(el){el.redo()},goDocStart:function(el){el.extendSelection(H(el.firstLine(),0))},goDocEnd:function(el){el.extendSelection(H(el.lastLine()))},goLineStart:function(el){el.extendSelection(aT(el,el.getCursor().line))},goLineStartSmart:function(em){var eq=em.getCursor(),er=aT(em,eq.line);var en=em.getLineHandle(er.line);var el=a(en);if(!el||el[0].level==0){var ep=Math.max(0,en.text.search(/\S/));var eo=eq.line==er.line&&eq.ch<=ep&&eq.ch;em.extendSelection(H(er.line,eo?0:ep))}else{em.extendSelection(er)}},goLineEnd:function(el){el.extendSelection(cw(el,el.getCursor().line))},goLineRight:function(el){var em=el.charCoords(el.getCursor(),"div").top+5;el.extendSelection(el.coordsChar({left:el.display.lineDiv.offsetWidth+100,top:em},"div"))},goLineLeft:function(el){var em=el.charCoords(el.getCursor(),"div").top+5;el.extendSelection(el.coordsChar({left:0,top:em},"div"))},goLineUp:function(el){el.moveV(-1,"line")},goLineDown:function(el){el.moveV(1,"line")},goPageUp:function(el){el.moveV(-1,"page")},goPageDown:function(el){el.moveV(1,"page")},goCharLeft:function(el){el.moveH(-1,"char")},goCharRight:function(el){el.moveH(1,"char")},goColumnLeft:function(el){el.moveH(-1,"column")},goColumnRight:function(el){el.moveH(1,"column")},goWordLeft:function(el){el.moveH(-1,"word")},goGroupRight:function(el){el.moveH(1,"group")},goGroupLeft:function(el){el.moveH(-1,"group")},goWordRight:function(el){el.moveH(1,"word")},delCharBefore:function(el){el.deleteH(-1,"char")},delCharAfter:function(el){el.deleteH(1,"char")},delWordBefore:function(el){el.deleteH(-1,"word")},delWordAfter:function(el){el.deleteH(1,"word")},delGroupBefore:function(el){el.deleteH(-1,"group")},delGroupAfter:function(el){el.deleteH(1,"group")},indentAuto:function(el){el.indentSelection("smart")},indentMore:function(el){el.indentSelection("add")},indentLess:function(el){el.indentSelection("subtract")},insertTab:function(el){el.replaceSelection("\t","end","+input")},defaultTab:function(el){if(el.somethingSelected()){el.indentSelection("add")}else{el.replaceSelection("\t","end","+input")}},transposeChars:function(el){var en=el.getCursor(),em=el.getLine(en.line);if(en.ch>0&&en.ch<em.length-1){el.replaceRange(em.charAt(en.ch)+em.charAt(en.ch-1),H(en.line,en.ch-1),H(en.line,en.ch+1))}},newlineAndIndent:function(el){b2(el,function(){el.replaceSelection("\n","end","+input");el.indentLine(el.getCursor().line,null,true)})()},toggleOverwrite:function(el){el.toggleOverwrite()}};var du=y.keyMap={};du.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"};du.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Alt-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",fallthrough:"basic"};du.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",fallthrough:["basic","emacsy"]};du["default"]=bk?du.macDefault:du.pcDefault;du.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"};function d6(el){if(typeof el=="string"){return du[el]}else{return el}}function g(em,eq,eo){function ep(ew){ew=d6(ew);var eu=ew[em];if(eu===false){return"stop"}if(eu!=null&&eo(eu)){return true}if(ew.nofallthrough){return"stop"}var et=ew.fallthrough;if(et==null){return false}if(Object.prototype.toString.call(et)!="[object Array]"){return ep(et)}for(var es=0,ev=et.length;es<ev;++es){var er=ep(et[es]);if(er){return er}}return false}for(var en=0;en<eq.length;++en){var el=ep(eq[en]);if(el){return el!="stop"}}}function c2(em){var el=dA[em.keyCode];return el=="Ctrl"||el=="Alt"||el=="Shift"||el=="Mod"}function dL(em,en){if(dQ&&em.keyCode==34&&em["char"]){return false}var el=dA[em.keyCode];if(el==null||em.altGraphKey){return false}if(em.altKey){el="Alt-"+el}if(ba?em.metaKey:em.ctrlKey){el="Ctrl-"+el}if(ba?em.ctrlKey:em.metaKey){el="Cmd-"+el}if(!en&&em.shiftKey){el="Shift-"+el}return el}y.lookupKey=g;y.isModifierKey=c2;y.keyName=dL;y.fromTextArea=function(es,et){if(!et){et={}}et.value=es.value;if(!et.tabindex&&es.tabindex){et.tabindex=es.tabindex}if(!et.placeholder&&es.placeholder){et.placeholder=es.placeholder}if(et.autofocus==null){var el=document.body;try{el=document.activeElement}catch(en){}et.autofocus=el==es||es.getAttribute("autofocus")!=null&&el==document.body}function ep(){es.value=er.getValue()}if(es.form){bf(es.form,"submit",ep);if(!et.leaveSubmitMethodAlone){var em=es.form,eq=em.submit;try{var eo=em.submit=function(){ep();em.submit=eq;em.submit();em.submit=eo}}catch(en){}}}es.style.display="none";var er=y(function(eu){es.parentNode.insertBefore(eu,es.nextSibling)},et);er.save=ep;er.getTextArea=function(){return es};er.toTextArea=function(){ep();es.parentNode.removeChild(er.getWrapperElement());es.style.display="";if(es.form){cK(es.form,"submit",ep);if(typeof es.form.submit=="function"){es.form.submit=eq}}};return er};function dg(el,em){this.pos=this.start=0;this.string=el;this.tabSize=em||8;this.lastColumnPos=this.lastColumnValue=0}dg.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==0},peek:function(){return this.string.charAt(this.pos)||undefined},next:function(){if(this.pos<this.string.length){return this.string.charAt(this.pos++)}},eat:function(el){var en=this.string.charAt(this.pos);if(typeof el=="string"){var em=en==el}else{var em=en&&(el.test?el.test(en):el(en))}if(em){++this.pos;return en}},eatWhile:function(el){var em=this.pos;while(this.eat(el)){}return this.pos>em},eatSpace:function(){var el=this.pos;while(/[\s\u00a0]/.test(this.string.charAt(this.pos))){++this.pos}return this.pos>el},skipToEnd:function(){this.pos=this.string.length},skipTo:function(el){var em=this.string.indexOf(el,this.pos);if(em>-1){this.pos=em;return true}},backUp:function(el){this.pos-=el},column:function(){if(this.lastColumnPos<this.start){this.lastColumnValue=bb(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue);this.lastColumnPos=this.start}return this.lastColumnValue},indentation:function(){return bb(this.string,null,this.tabSize)},match:function(ep,em,el){if(typeof ep=="string"){var eq=function(er){return el?er.toLowerCase():er};var eo=this.string.substr(this.pos,ep.length);if(eq(eo)==eq(ep)){if(em!==false){this.pos+=ep.length}return true}}else{var en=this.string.slice(this.pos).match(ep);if(en&&en.index>0){return null}if(en&&em!==false){this.pos+=en[0].length}return en}},current:function(){return this.string.slice(this.start,this.pos)}};y.StringStream=dg;function E(em,el){this.lines=[];this.type=el;this.doc=em}y.TextMarker=E;aV(E);E.prototype.clear=function(){if(this.explicitlyCleared){return}var es=this.doc.cm,em=es&&!es.curOp;if(em){bR(es)}if(dE(this,"clear")){var et=this.find();if(et){L(this,"clear",et.from,et.to)}}var en=null,eq=null;for(var eo=0;eo<this.lines.length;++eo){var eu=this.lines[eo];var er=dt(eu.markedSpans,this);if(er.to!=null){eq=a8(eu)}eu.markedSpans=da(eu.markedSpans,er);if(er.from!=null){en=a8(eu)}else{if(this.collapsed&&!dO(this.doc,eu)&&es){ed(eu,at(es.display))}}}if(es&&this.collapsed&&!es.options.lineWrapping){for(var eo=0;eo<this.lines.length;++eo){var el=s(es.doc,this.lines[eo]),ep=cQ(es.doc,el);if(ep>es.display.maxLineLength){es.display.maxLine=el;es.display.maxLineLength=ep;es.display.maxLineChanged=true}}}if(en!=null&&es){N(es,en,eq+1)}this.lines.length=0;this.explicitlyCleared=true;if(this.atomic&&this.doc.cantEdit){this.doc.cantEdit=false;if(es){cX(es)}}if(em){T(es)}};E.prototype.find=function(){var eq,ep;for(var em=0;em<this.lines.length;++em){var el=this.lines[em];var en=dt(el.markedSpans,this);if(en.from!=null||en.to!=null){var eo=a8(el);if(en.from!=null){eq=H(eo,en.from)}if(en.to!=null){ep=H(eo,en.to)}}}if(this.type=="bookmark"){return eq}return eq&&{from:eq,to:ep}};E.prototype.changed=function(){var eo=this.find(),el=this.doc.cm;if(!eo||!el){return}if(this.type!="bookmark"){eo=eo.from}var em=dy(this.doc,eo.line);d1(el,em);if(eo.line>=el.display.showingFrom&&eo.line<el.display.showingTo){for(var en=el.display.lineDiv.firstChild;en;en=en.nextSibling){if(en.lineObj==em){if(en.offsetHeight!=em.height){ed(em,en.offsetHeight)}break}}bU(el,function(){el.curOp.selectionChanged=el.curOp.forceUpdate=el.curOp.updateMaxLine=true})}};E.prototype.attachLine=function(el){if(!this.lines.length&&this.doc.cm){var em=this.doc.cm.curOp;if(!em.maybeHiddenMarkers||cd(em.maybeHiddenMarkers,this)==-1){(em.maybeUnhiddenMarkers||(em.maybeUnhiddenMarkers=[])).push(this)}}this.lines.push(el)};E.prototype.detachLine=function(el){this.lines.splice(cd(this.lines,el),1);if(!this.lines.length&&this.doc.cm){var em=this.doc.cm.curOp;(em.maybeHiddenMarkers||(em.maybeHiddenMarkers=[])).push(this)}};function c7(eu,es,et,ew,eq){if(ew&&ew.shared){return D(eu,es,et,ew,eq)}if(eu.cm&&!eu.cm.curOp){return b2(eu.cm,c7)(eu,es,et,ew,eq)}var ep=new E(eu,eq);if(dz(et,es)||dX(es,et)&&eq=="range"&&!(ew.inclusiveLeft&&ew.inclusiveRight)){return ep}if(ew){aj(ew,ep)}if(ep.replacedWith){ep.collapsed=true;ep.replacedWith=d8("span",[ep.replacedWith],"CodeMirror-widget");if(!ew.handleMouseEvents){ep.replacedWith.ignoreEvents=true}}if(ep.collapsed){ay=true}if(ep.addToHistory){c8(eu,{from:es,to:et,origin:"markText"},{head:eu.sel.head,anchor:eu.sel.anchor},NaN)}var em=es.line,ev=0,eo,en,er=eu.cm,el;eu.iter(em,et.line+1,function(ex){if(er&&ep.collapsed&&!er.options.lineWrapping&&s(eu,ex)==er.display.maxLine){el=true}var ey={from:null,to:null,marker:ep};ev+=ex.text.length;if(em==es.line){ey.from=es.ch;ev-=es.ch}if(em==et.line){ey.to=et.ch;ev-=ex.text.length-et.ch}if(ep.collapsed){if(em==et.line){en=aW(ex,et.ch)}if(em==es.line){eo=aW(ex,es.ch)}else{ed(ex,0)}}br(ex,ey);++em});if(ep.collapsed){eu.iter(es.line,et.line+1,function(ex){if(dO(eu,ex)){ed(ex,0)}})}if(ep.clearOnEnter){bf(ep,"beforeCursorEnter",function(){ep.clear()})}if(ep.readOnly){ef=true;if(eu.history.done.length||eu.history.undone.length){eu.clearHistory()}}if(ep.collapsed){if(eo!=en){throw new Error("Inserting collapsed marker overlapping an existing one")}ep.size=ev;ep.atomic=true}if(er){if(el){er.curOp.updateMaxLine=true}if(ep.className||ep.title||ep.startStyle||ep.endStyle||ep.collapsed){N(er,es.line,et.line+1)}if(ep.atomic){cX(er)}}return ep}function r(eo,em){this.markers=eo;this.primary=em;for(var el=0,en=this;el<eo.length;++el){eo[el].parent=this;bf(eo[el],"clear",function(){en.clear()})}}y.SharedTextMarker=r;aV(r);r.prototype.clear=function(){if(this.explicitlyCleared){return}this.explicitlyCleared=true;for(var el=0;el<this.markers.length;++el){this.markers[el].clear()}L(this,"clear")};r.prototype.find=function(){return this.primary.find()};function D(ep,es,er,el,en){el=aj(el);el.shared=false;var eq=[c7(ep,es,er,el,en)],em=eq[0];var eo=el.replacedWith;cE(ep,function(eu){if(eo){el.replacedWith=eo.cloneNode(true)}eq.push(c7(eu,dY(eu,es),dY(eu,er),el,en));for(var et=0;et<eu.linked.length;++et){if(eu.linked[et].isParent){return}}em=dW(eq)});return new r(eq,em)}function dt(en,el){if(en){for(var em=0;em<en.length;++em){var eo=en[em];if(eo.marker==el){return eo}}}}function da(em,en){for(var eo,el=0;el<em.length;++el){if(em[el]!=en){(eo||(eo=[])).push(em[el])}}return eo}function br(el,em){el.markedSpans=el.markedSpans?el.markedSpans.concat([em]):[em];em.marker.attachLine(el)}function an(em,en,er){if(em){for(var ep=0,es;ep<em.length;++ep){var et=em[ep],eq=et.marker;var el=et.from==null||(eq.inclusiveLeft?et.from<=en:et.from<en);if(el||(eq.inclusiveLeft&&eq.inclusiveRight||eq.type=="bookmark")&&et.from==en&&(!er||!et.marker.insertLeft)){var eo=et.to==null||(eq.inclusiveRight?et.to>=en:et.to>en);(es||(es=[])).push({from:et.from,to:eo?null:et.to,marker:eq})}}}return es}function ac(em,eo,er){if(em){for(var ep=0,es;ep<em.length;++ep){var et=em[ep],eq=et.marker;var en=et.to==null||(eq.inclusiveRight?et.to>=eo:et.to>eo);if(en||eq.type=="bookmark"&&et.from==eo&&(!er||et.marker.insertLeft)){var el=et.from==null||(eq.inclusiveLeft?et.from<=eo:et.from<eo);(es||(es=[])).push({from:el?null:et.from-eo,to:et.to==null?null:et.to-eo,marker:eq})}}}return es}function cP(ex,eu){var et=bn(ex,eu.from.line)&&dy(ex,eu.from.line).markedSpans;var eA=bn(ex,eu.to.line)&&dy(ex,eu.to.line).markedSpans;if(!et&&!eA){return null}var em=eu.from.ch,ep=eu.to.ch,es=dX(eu.from,eu.to);var er=an(et,em,es);var ez=ac(eA,ep,es);var ey=eu.text.length==1,en=dW(eu.text).length+(ey?em:0);if(er){for(var eo=0;eo<er.length;++eo){var ew=er[eo];if(ew.to==null){var eB=dt(ez,ew.marker);if(!eB){ew.to=em}else{if(ey){ew.to=eB.to==null?null:eB.to+en}}}}}if(ez){for(var eo=0;eo<ez.length;++eo){var ew=ez[eo];if(ew.to!=null){ew.to+=en}if(ew.from==null){var eB=dt(er,ew.marker);if(!eB){ew.from=en;if(ey){(er||(er=[])).push(ew)}}}else{ew.from+=en;if(ey){(er||(er=[])).push(ew)}}}}if(ey&&er){for(var eo=0;eo<er.length;++eo){if(er[eo].from!=null&&er[eo].from==er[eo].to&&er[eo].marker.type!="bookmark"){er.splice(eo--,1)}}if(!er.length){er=null}}var eq=[er];if(!ey){var ev=eu.text.length-2,el;if(ev>0&&er){for(var eo=0;eo<er.length;++eo){if(er[eo].to==null){(el||(el=[])).push({from:null,to:null,marker:er[eo].marker})}}}for(var eo=0;eo<ev;++eo){eq.push(el)}eq.push(ez)}return eq}function cG(et,er){var el=bl(et,er);var eu=cP(et,er);if(!el){return eu}if(!eu){return el}for(var eo=0;eo<el.length;++eo){var ep=el[eo],eq=eu[eo];if(ep&&eq){spans:for(var en=0;en<eq.length;++en){var es=eq[en];for(var em=0;em<ep.length;++em){if(ep[em].marker==es.marker){continue spans}}ep.push(es)}}else{if(eq){el[eo]=eq}}}return el}function bP(ev,et,eu){var eo=null;ev.iter(et.line,eu.line+1,function(ew){if(ew.markedSpans){for(var ex=0;ex<ew.markedSpans.length;++ex){var ey=ew.markedSpans[ex].marker;if(ey.readOnly&&(!eo||cd(eo,ey)==-1)){(eo||(eo=[])).push(ey)}}}});if(!eo){return null}var ep=[{from:et,to:eu}];for(var eq=0;eq<eo.length;++eq){var er=eo[eq],em=er.find();for(var en=0;en<ep.length;++en){var el=ep[en];if(dz(el.to,em.from)||dz(em.to,el.from)){continue}var es=[en,1];if(dz(el.from,em.from)||!er.inclusiveLeft&&dX(el.from,em.from)){es.push({from:el.from,to:em.from})}if(dz(em.to,el.to)||!er.inclusiveRight&&dX(el.to,em.to)){es.push({from:em.to,to:el.to})}ep.splice.apply(ep,es);en+=es.length-1}}return ep}function aW(em,eo){var el=ay&&em.markedSpans,eq;if(el){for(var ep,en=0;en<el.length;++en){ep=el[en];if(!ep.marker.collapsed){continue}if((ep.from==null||ep.from<eo)&&(ep.to==null||ep.to>eo)&&(!eq||eq.width<ep.marker.width)){eq=ep.marker}}}return eq}function dc(el){return aW(el,-1)}function cV(el){return aW(el,el.text.length+1)}function s(en,em){var el;while(el=dc(em)){em=dy(en,el.find().from.line)}return em}function dO(ep,em){var el=ay&&em.markedSpans;if(el){for(var eo,en=0;en<el.length;++en){eo=el[en];if(!eo.marker.collapsed){continue}if(eo.from==null){return true}if(eo.marker.replacedWith){continue}if(eo.from==0&&eo.marker.inclusiveLeft&&G(ep,em,eo)){return true}}}}function G(er,em,eo){if(eo.to==null){var el=eo.marker.find().to,ep=dy(er,el.line);return G(er,ep,dt(ep.markedSpans,eo.marker))}if(eo.marker.inclusiveRight&&eo.to==em.text.length){return true}for(var eq,en=0;en<em.markedSpans.length;++en){eq=em.markedSpans[en];if(eq.marker.collapsed&&!eq.marker.replacedWith&&eq.from==eo.to&&(eq.marker.inclusiveLeft||eo.marker.inclusiveRight)&&G(er,em,eq)){return true}}}function ee(el){var en=el.markedSpans;if(!en){return}for(var em=0;em<en.length;++em){en[em].marker.detachLine(el)}el.markedSpans=null}function b3(el,en){if(!en){return}for(var em=0;em<en.length;++em){en[em].marker.attachLine(el)}el.markedSpans=en}var cp=y.LineWidget=function(el,eo,em){if(em){for(var en in em){if(em.hasOwnProperty(en)){this[en]=em[en]}}}this.cm=el;this.node=eo};aV(cp);function B(el){return function(){var en=!this.cm.curOp;if(en){bR(this.cm)}try{var em=el.apply(this,arguments)}finally{if(en){T(this.cm)}}return em}}cp.prototype.clear=B(function(){var em=this.line.widgets,eo=a8(this.line);if(eo==null||!em){return}for(var en=0;en<em.length;++en){if(em[en]==this){em.splice(en--,1)}}if(!em.length){this.line.widgets=null}var el=a7(this.cm,this.line)<this.cm.doc.scrollTop;ed(this.line,Math.max(0,this.line.height-bZ(this)));if(el){bT(this.cm,0,-this.height)}N(this.cm,eo,eo+1)});cp.prototype.changed=B(function(){var el=this.height;this.height=null;var em=bZ(this)-el;if(!em){return}ed(this.line,this.line.height+em);var en=a8(this.line);N(this.cm,en,en+1)});function bZ(el){if(el.height!=null){return el.height}if(!el.node.parentNode||el.node.parentNode.nodeType!=1){bc(el.cm.display.measure,d8("div",[el.node],null,"position: relative"))}return el.height=el.node.offsetHeight}function a2(el,ep,en,em){var eo=new cp(el,en,em);if(eo.noHScroll){el.display.alignWidgets=true}cZ(el,ep,function(er){var es=er.widgets||(er.widgets=[]);if(eo.insertAt==null){es.push(eo)}else{es.splice(Math.min(es.length-1,Math.max(0,eo.insertAt)),0,eo)}eo.line=er;if(!dO(el.doc,er)||eo.showIfHidden){var eq=a7(el,er)<el.doc.scrollTop;ed(er,er.height+bZ(eo));if(eq){bT(el,0,eo.height)}}return true});return eo}var ec=y.Line=function(en,em,el){this.text=en;b3(this,em);this.height=el?el(this):1};aV(ec);ec.prototype.lineNo=function(){return a8(this)};function cR(em,ep,en,el){em.text=ep;if(em.stateAfter){em.stateAfter=null}if(em.styles){em.styles=null}if(em.order!=null){em.order=null}ee(em);b3(em,en);var eo=el?el(em):1;if(eo!=em.height){ed(em,eo)}}function aX(el){el.parent=null;ee(el)}function q(eu,ew,ep,em,eq,eo){var en=ep.flattenSpans;if(en==null){en=eu.options.flattenSpans}var es=0,er=null;var ev=new dg(ew,eu.options.tabSize),el;if(ew==""&&ep.blankLine){ep.blankLine(em)}while(!ev.eol()){if(ev.pos>eu.options.maxHighlightLength){en=false;if(eo){cm(eu,ew,em,ev.pos)}ev.pos=ew.length;el=null}else{el=ep.token(ev,em)}if(!en||er!=el){if(es<ev.start){eq(ev.start,er)}es=ev.start;er=el}ev.start=ev.pos}while(es<ev.pos){var et=Math.min(ev.pos,es+50000);eq(et,er);es=et}}function dT(er,et,el,eo){var es=[er.state.modeGen];q(er,et.text,er.doc.mode,el,function(eu,ev){es.push(eu,ev)},eo);for(var em=0;em<er.state.overlays.length;++em){var ep=er.state.overlays[em],eq=1,en=0;q(er,et.text,ep.mode,true,function(eu,ew){var ey=eq;while(en<eu){var ev=es[eq];if(ev>eu){es.splice(eq,1,eu,es[eq+1],ev)}eq+=2;en=Math.min(eu,ev)}if(!ew){return}if(ep.opaque){es.splice(ey,eq-ey,eu,ew);eq=ey+2}else{for(;ey<eq;ey+=2){var ex=es[ey+1];es[ey+1]=ex?ex+" "+ew:ew}}})}return es}function b6(el,em){if(!em.styles||em.styles[0]!=el.state.modeGen){em.styles=dT(el,em,em.stateAfter=co(el,a8(em)))}return em.styles}function cm(el,eq,en,em){var ep=el.doc.mode;var eo=new dg(eq,el.options.tabSize);eo.start=eo.pos=em||0;if(eq==""&&ep.blankLine){ep.blankLine(en)}while(!eo.eol()&&eo.pos<=el.options.maxHighlightLength){ep.token(eo,en);eo.start=eo.pos}}var cz={};function di(en,em){if(!en){return null}for(;;){var el=en.match(/(?:^|\s)line-(background-)?(\S+)/);if(!el){break}en=en.slice(0,el.index)+en.slice(el.index+el[0].length);var eo=el[1]?"bgClass":"textClass";if(em[eo]==null){em[eo]=el[2]}else{if(!(new RegExp("(?:^|s)"+el[2]+"(?:$|s)")).test(em[eo])){em[eo]+=" "+el[2]}}}return cz[en]||(cz[en]="cm-"+en.replace(/ +/g," cm-"))}function de(eu,ey,el,ex){var ev,ez=ey,eq=true;while(ev=dc(ez)){ez=dy(eu.doc,ev.find().from.line)}var er={pre:d8("pre"),col:0,pos:0,measure:null,measuredSomething:false,cm:eu,copyWidgets:ex};do{if(ez.text){eq=false}er.measure=ez==ey&&el;er.pos=0;er.addToken=er.measure?e:o;if((cs||b1)&&eu.getOption("lineWrapping")){er.addToken=dV(er.addToken)}var ep=aP(ez,er,b6(eu,ez));if(el&&ez==ey&&!er.measuredSomething){el[0]=er.pre.appendChild(aN(eu.display.measure));er.measuredSomething=true}if(ep){ez=dy(eu.doc,ep.to.line)}}while(ep);if(el&&!er.measuredSomething&&!el[0]){el[0]=er.pre.appendChild(eq?d8("span","\u00a0"):aN(eu.display.measure))}if(!er.pre.firstChild&&!dO(eu.doc,ey)){er.pre.appendChild(document.createTextNode("\u00a0"))}var em;if(el&&(cs||dr)&&(em=a(ez))){var eo=em.length-1;if(em[eo].from==em[eo].to){--eo}var ew=em[eo],en=em[eo-1];if(ew.from+1==ew.to&&en&&ew.level<en.level){var et=el[er.pos-1];if(et){et.parentNode.insertBefore(et.measureRight=aN(eu.display.measure),et.nextSibling)}}}var es=er.textClass?er.textClass+" "+(ey.textClass||""):ey.textClass;if(es){er.pre.className=es}ae(eu,"renderLine",eu,ey,er.pre);return er}function dw(em){var el=d8("span","\u2022","cm-invalidchar");el.title="\\u"+em.charCodeAt(0).toString(16);return el}function o(ep,ey,el,eo,ez,ex){if(!ey){return}var et=ep.cm.options.specialChars;if(!et.test(ey)){ep.col+=ey.length;var es=document.createTextNode(ey)}else{var es=document.createDocumentFragment(),ev=0;while(true){et.lastIndex=ev;var em=et.exec(ey);var er=em?em.index-ev:ey.length-ev;if(er){es.appendChild(document.createTextNode(ey.slice(ev,ev+er)));ep.col+=er}if(!em){break}ev+=er+1;if(em[0]=="\t"){var eq=ep.cm.options.tabSize,eu=eq-ep.col%eq;es.appendChild(d8("span",bC(eu),"cm-tab"));ep.col+=eu}else{var en=ep.cm.options.specialCharPlaceholder(em[0]);es.appendChild(en);ep.col+=1}}}if(el||eo||ez||ep.measure){var ew=el||"";if(eo){ew+=eo}if(ez){ew+=ez}var en=d8("span",[es],ew);if(ex){en.title=ex}return ep.pre.appendChild(en)}ep.pre.appendChild(es)}function e(es,eu,em,ep,ev){var er=es.cm.options.lineWrapping;for(var eq=0;eq<eu.length;++eq){var el=eu.charAt(eq),en=eq==0;if(el>="\ud800"&&el<"\udbff"&&eq<eu.length-1){el=eu.slice(eq,eq+2);++eq}else{if(eq&&er&&bo(eu,eq)){es.pre.appendChild(d8("wbr"))}}var eo=es.measure[es.pos];var et=es.measure[es.pos]=o(es,el,em,en&&ep,eq==eu.length-1&&ev);if(eo){et.leftSide=eo.leftSide||eo}if(cs&&er&&el==" "&&eq&&!/\s/.test(eu.charAt(eq-1))&&eq<eu.length-1&&!/\s/.test(eu.charAt(eq+1))){et.style.whiteSpace="normal"}es.pos+=el.length}if(eu.length){es.measuredSomething=true}}function dV(el){function em(en){var eo=" ";for(var ep=0;ep<en.length-2;++ep){eo+=ep%2?" ":"\u00a0"}eo+=" ";return eo}return function(eo,es,ep,en,er,eq){return el(eo,es.replace(/ {3,}/g,em),ep,en,er,eq)}}function J(em,ep,el,eo){var eq=!eo&&el.replacedWith;if(eq){if(em.copyWidgets){eq=eq.cloneNode(true)}em.pre.appendChild(eq);if(em.measure){if(ep){em.measure[em.pos]=eq}else{var en=aN(em.cm.display.measure);if(el.type=="bookmark"&&!el.insertLeft){em.measure[em.pos]=em.pre.appendChild(en)}else{if(em.measure[em.pos]){return}else{em.measure[em.pos]=em.pre.insertBefore(en,eq)}}}em.measuredSomething=true}}em.pos+=ep}function aP(eu,eA,et){var eq=eu.markedSpans,es=eu.text,ey=0;if(!eq){for(var eD=1;eD<et.length;eD+=2){eA.addToken(eA,es.slice(ey,ey=et[eD]),di(et[eD+1],eA))}return}var eE=es.length,ep=0,eD=1,ew="",eF;var eH=0,el,eG,ex,eI,en;for(;;){if(eH==ep){el=eG=ex=eI="";en=null;eH=Infinity;var er=[];for(var eB=0;eB<eq.length;++eB){var eC=eq[eB],ez=eC.marker;if(eC.from<=ep&&(eC.to==null||eC.to>ep)){if(eC.to!=null&&eH>eC.to){eH=eC.to;eG=""}if(ez.className){el+=" "+ez.className}if(ez.startStyle&&eC.from==ep){ex+=" "+ez.startStyle}if(ez.endStyle&&eC.to==eH){eG+=" "+ez.endStyle}if(ez.title&&!eI){eI=ez.title}if(ez.collapsed&&(!en||en.marker.size<ez.size)){en=eC}}else{if(eC.from>ep&&eH>eC.from){eH=eC.from}}if(ez.type=="bookmark"&&eC.from==ep&&ez.replacedWith){er.push(ez)}}if(en&&(en.from||0)==ep){J(eA,(en.to==null?eE:en.to)-ep,en.marker,en.from==null);if(en.to==null){return en.marker.find()}}if(!en&&er.length){for(var eB=0;eB<er.length;++eB){J(eA,0,er[eB])}}}if(ep>=eE){break}var ev=Math.min(eE,eH);while(true){if(ew){var em=ep+ew.length;if(!en){var eo=em>ev?ew.slice(0,ev-ep):ew;eA.addToken(eA,eo,eF?eF+el:el,ex,ep+eo.length==eH?eG:"",eI)}if(em>=ev){ew=ew.slice(ev-ep);ep=ev;break}ep=em;ex=""}ew=es.slice(ey,ey=et[eD++]);eF=di(et[eD++],eA)}}}function dR(eC,et,ep,ex,er){function eo(eD){return ep?ep[eD]:null}function es(eD,eF,eE){cR(eD,eF,eE,er);L(eD,"change",eD,et)}var ey=et.from,em=et.to,ev=et.text;var eu=dy(eC,ey.line),el=dy(eC,em.line);var en=dW(ev),eA=eo(ev.length-1),ew=em.line-ey.line;if(ey.ch==0&&em.ch==0&&en==""&&(!eC.cm||eC.cm.options.wholeLineUpdateBefore)){for(var ez=0,eB=ev.length-1,eq=[];ez<eB;++ez){eq.push(new ec(ev[ez],eo(ez),er))}es(el,el.text,eA);if(ew){eC.remove(ey.line,ew)}if(eq.length){eC.insert(ey.line,eq)}}else{if(eu==el){if(ev.length==1){es(eu,eu.text.slice(0,ey.ch)+en+eu.text.slice(em.ch),eA)}else{for(var eq=[],ez=1,eB=ev.length-1;ez<eB;++ez){eq.push(new ec(ev[ez],eo(ez),er))}eq.push(new ec(en+eu.text.slice(em.ch),eA,er));es(eu,eu.text.slice(0,ey.ch)+ev[0],eo(0));eC.insert(ey.line+1,eq)}}else{if(ev.length==1){es(eu,eu.text.slice(0,ey.ch)+ev[0]+el.text.slice(em.ch),eo(0));eC.remove(ey.line+1,ew)}else{es(eu,eu.text.slice(0,ey.ch)+ev[0],eo(0));es(el,en+el.text.slice(em.ch),eA);for(var ez=1,eB=ev.length-1,eq=[];ez<eB;++ez){eq.push(new ec(ev[ez],eo(ez),er))}if(ew>1){eC.remove(ey.line+1,ew-1)}eC.insert(ey.line+1,eq)}}}L(eC,"change",eC,et);bd(eC,ex.anchor,ex.head,null,true)}function dl(em){this.lines=em;this.parent=null;for(var en=0,eo=em.length,el=0;en<eo;++en){em[en].parent=this;el+=em[en].height}this.height=el}dl.prototype={chunkSize:function(){return this.lines.length},removeInner:function(el,ep){for(var en=el,eo=el+ep;en<eo;++en){var em=this.lines[en];this.height-=em.height;aX(em);L(em,"delete")}this.lines.splice(el,ep)},collapse:function(el){el.splice.apply(el,[el.length,0].concat(this.lines))},insertInner:function(em,en,el){this.height+=el;this.lines=this.lines.slice(0,em).concat(en).concat(this.lines.slice(em));for(var eo=0,ep=en.length;eo<ep;++eo){en[eo].parent=this}},iterN:function(el,eo,en){for(var em=el+eo;el<em;++el){if(en(this.lines[el])){return true}}}};function dP(eo){this.children=eo;var en=0,el=0;for(var em=0,eq=eo.length;em<eq;++em){var ep=eo[em];en+=ep.chunkSize();el+=ep.height;ep.parent=this}this.size=en;this.height=el;this.parent=null}dP.prototype={chunkSize:function(){return this.size},removeInner:function(el,es){this.size-=es;for(var en=0;en<this.children.length;++en){var er=this.children[en],ep=er.chunkSize();if(el<ep){var eo=Math.min(es,ep-el),eq=er.height;er.removeInner(el,eo);this.height-=eq-er.height;if(ep==eo){this.children.splice(en--,1);er.parent=null}if((es-=eo)==0){break}el=0}else{el-=ep}}if(this.size-es<25){var em=[];this.collapse(em);this.children=[new dl(em)];this.children[0].parent=this}},collapse:function(el){for(var em=0,en=this.children.length;em<en;++em){this.children[em].collapse(el)}},insertInner:function(em,et,es){this.size+=et.length;this.height+=es;for(var en=0,ep=this.children.length;en<ep;++en){var el=this.children[en],eq=el.chunkSize();if(em<=eq){el.insertInner(em,et,es);if(el.lines&&el.lines.length>50){while(el.lines.length>50){var eo=el.lines.splice(el.lines.length-25,25);var er=new dl(eo);el.height-=er.height;this.children.splice(en+1,0,er);er.parent=this}this.maybeSpill()}break}em-=eq}},maybeSpill:function(){if(this.children.length<=10){return}var eo=this;do{var em=eo.children.splice(eo.children.length-5,5);var en=new dP(em);if(!eo.parent){var ep=new dP(eo.children);ep.parent=eo;eo.children=[ep,en];eo=ep}else{eo.size-=en.size;eo.height-=en.height;var el=cd(eo.parent.children,eo);eo.parent.children.splice(el+1,0,en)}en.parent=eo.parent}while(eo.children.length>10);eo.parent.maybeSpill()},iterN:function(el,es,er){for(var em=0,ep=this.children.length;em<ep;++em){var eq=this.children[em],eo=eq.chunkSize();if(el<eo){var en=Math.min(es,eo-el);if(eq.iterN(el,en,er)){return true}if((es-=en)==0){break}el=0}else{el-=eo}}}};var bD=0;var X=y.Doc=function(en,em,el){if(!(this instanceof X)){return new X(en,em,el)}if(el==null){el=0}dP.call(this,[new dl([new ec("",null)])]);this.first=el;this.scrollTop=this.scrollLeft=0;this.cantEdit=false;this.history=Z();this.cleanGeneration=1;this.frontier=el;var eo=H(el,0);this.sel={from:eo,to:eo,head:eo,anchor:eo,shift:false,extend:false,goalColumn:null};this.id=++bD;this.modeOption=em;if(typeof en=="string"){en=av(en)}dR(this,{from:eo,to:eo,text:en},null,{head:eo,anchor:eo})};X.prototype=bw(dP.prototype,{constructor:X,iter:function(en,em,el){if(el){this.iterN(en-this.first,em-en,el)}else{this.iterN(this.first,this.first+this.size,en)}},insert:function(em,en){var el=0;for(var eo=0,ep=en.length;eo<ep;++eo){el+=en[eo].height}this.insertInner(em-this.first,en,el)},remove:function(el,em){this.removeInner(el-this.first,em)},getValue:function(em){var el=ax(this,this.first,this.first+this.size);if(em===false){return el}return el.join(em||"\n")},setValue:function(em){var en=H(this.first,0),el=this.first+this.size-1;aG(this,{from:en,to:H(el,dy(this,el).text.length),text:av(em),origin:"setValue"},{head:en,anchor:en},true)},replaceRange:function(em,eo,en,el){eo=dY(this,eo);en=en?dY(this,en):eo;aw(this,em,eo,en,el)},getRange:function(eo,en,em){var el=ea(this,dY(this,eo),dY(this,en));if(em===false){return el}return el.join(em||"\n")},getLine:function(em){var el=this.getLineHandle(em);return el&&el.text},setLine:function(el,em){if(bn(this,el)){aw(this,em,H(el,0),dY(this,H(el)))}},removeLine:function(el){if(el){aw(this,"",dY(this,H(el-1)),dY(this,H(el)))}else{aw(this,"",H(0,0),dY(this,H(1,0)))}},getLineHandle:function(el){if(bn(this,el)){return dy(this,el)}},getLineNumber:function(el){return a8(el)},getLineHandleVisualStart:function(el){if(typeof el=="number"){el=dy(this,el)}return s(this,el)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(el){return dY(this,el)},getCursor:function(en){var el=this.sel,em;if(en==null||en=="head"){em=el.head}else{if(en=="anchor"){em=el.anchor}else{if(en=="end"||en===false){em=el.to}else{em=el.from}}}return bv(em)},somethingSelected:function(){return !dX(this.sel.head,this.sel.anchor)},setCursor:dS(function(el,em,eo){var en=dY(this,typeof el=="number"?H(el,em||0):el);if(eo){d5(this,en)}else{bd(this,en,en)}}),setSelection:dS(function(em,en,el){bd(this,dY(this,em),dY(this,en||em),el)}),extendSelection:dS(function(en,em,el){d5(this,dY(this,en),em&&dY(this,em),el)}),getSelection:function(el){return this.getRange(this.sel.from,this.sel.to,el)},replaceSelection:function(em,en,el){aG(this,{from:this.sel.from,to:this.sel.to,text:av(em),origin:el},en||"around")},undo:dS(function(){bm(this,"undo")}),redo:dS(function(){bm(this,"redo")}),setExtending:function(el){this.sel.extend=el},historySize:function(){var el=this.history;return{undo:el.done.length,redo:el.undone.length}},clearHistory:function(){this.history=Z(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration()},changeGeneration:function(){this.history.lastOp=this.history.lastOrigin=null;return this.history.generation},isClean:function(el){return this.history.generation==(el||this.cleanGeneration)},getHistory:function(){return{done:a9(this.history.done),undone:a9(this.history.undone)}},setHistory:function(em){var el=this.history=Z(this.history.maxGeneration);el.done=em.done.slice(0);el.undone=em.undone.slice(0)},markText:function(en,em,el){return c7(this,dY(this,en),dY(this,em),el,"range")},setBookmark:function(en,el){var em={replacedWith:el&&(el.nodeType==null?el.widget:el),insertLeft:el&&el.insertLeft};en=dY(this,en);return c7(this,en,en,em,"bookmark")},findMarksAt:function(ep){ep=dY(this,ep);var eo=[],em=dy(this,ep.line).markedSpans;if(em){for(var el=0;el<em.length;++el){var en=em[el];if((en.from==null||en.from<=ep.ch)&&(en.to==null||en.to>=ep.ch)){eo.push(en.marker.parent||en.marker)}}}return eo},getAllMarks:function(){var el=[];this.iter(function(en){var em=en.markedSpans;if(em){for(var eo=0;eo<em.length;++eo){if(em[eo].from!=null){el.push(em[eo].marker)}}}});return el},posFromIndex:function(em){var el,en=this.first;this.iter(function(eo){var ep=eo.text.length+1;if(ep>em){el=em;return true}em-=ep;++en});return dY(this,H(en,el))},indexFromPos:function(em){em=dY(this,em);var el=em.ch;if(em.line<this.first||em.ch<0){return 0}this.iter(this.first,em.line,function(en){el+=en.text.length+1});return el},copy:function(el){var em=new X(ax(this,this.first,this.first+this.size),this.modeOption,this.first);em.scrollTop=this.scrollTop;em.scrollLeft=this.scrollLeft;em.sel={from:this.sel.from,to:this.sel.to,head:this.sel.head,anchor:this.sel.anchor,shift:this.sel.shift,extend:false,goalColumn:this.sel.goalColumn};if(el){em.history.undoDepth=this.history.undoDepth;em.setHistory(this.getHistory())}return em},linkedDoc:function(el){if(!el){el={}}var eo=this.first,en=this.first+this.size;if(el.from!=null&&el.from>eo){eo=el.from}if(el.to!=null&&el.to<en){en=el.to}var em=new X(ax(this,eo,en),el.mode||this.modeOption,eo);if(el.sharedHist){em.history=this.history}(this.linked||(this.linked=[])).push({doc:em,sharedHist:el.sharedHist});em.linked=[{doc:this,isParent:true,sharedHist:el.sharedHist}];return em},unlinkDoc:function(em){if(em instanceof y){em=em.doc}if(this.linked){for(var en=0;en<this.linked.length;++en){var eo=this.linked[en];if(eo.doc!=em){continue}this.linked.splice(en,1);em.unlinkDoc(this);break}}if(em.history==this.history){var el=[em.id];cE(em,function(ep){el.push(ep.id)},true);em.history=Z();em.history.done=a9(this.history.done,el);em.history.undone=a9(this.history.undone,el)}},iterLinkedDocs:function(el){cE(this,el)},getMode:function(){return this.mode},getEditor:function(){return this.cm}});X.prototype.eachLine=X.prototype.iter;var d="iter insert remove copy getEditor".split(" ");for(var a5 in X.prototype){if(X.prototype.hasOwnProperty(a5)&&cd(d,a5)<0){y.prototype[a5]=(function(el){return function(){return el.apply(this.doc,arguments)}})(X.prototype[a5])}}aV(X);function cE(eo,en,em){function el(eu,es,eq){if(eu.linked){for(var er=0;er<eu.linked.length;++er){var ep=eu.linked[er];if(ep.doc==es){continue}var et=eq&&ep.sharedHist;if(em&&!et){continue}en(ep.doc,et);el(ep.doc,eu,et)}}}el(eo,null,true)}function cH(el,em){if(em.cm){throw new Error("This document is already in use.")}el.doc=em;em.cm=el;I(el);aR(el);if(!el.options.lineWrapping){eb(el)}el.options.mode=em.modeOption;N(el)}function dy(el,ep){ep-=el.first;while(!el.lines){for(var em=0;;++em){var eo=el.children[em],en=eo.chunkSize();if(ep<en){el=eo;break}ep-=en}}return el.lines[ep]}function ea(en,ep,el){var em=[],eo=ep.line;en.iter(ep.line,el.line+1,function(eq){var er=eq.text;if(eo==el.line){er=er.slice(0,el.ch)}if(eo==ep.line){er=er.slice(ep.ch)}em.push(er);++eo});return em}function ax(em,eo,en){var el=[];em.iter(eo,en,function(ep){el.push(ep.text)});return el}function ed(em,el){var en=el-em.height;for(var eo=em;eo;eo=eo.parent){eo.height+=en}}function a8(el){if(el.parent==null){return null}var ep=el.parent,eo=cd(ep.lines,el);for(var em=ep.parent;em;ep=em,em=em.parent){for(var en=0;;++en){if(em.children[en]==ep){break}eo+=em.children[en].chunkSize()}}return eo+ep.first}function a1(er,ep){var en=er.first;outer:do{for(var eo=0,eq=er.children.length;eo<eq;++eo){var em=er.children[eo],el=em.height;if(ep<el){er=em;continue outer}ep-=el;en+=em.chunkSize()}return en}while(!er.lines);for(var eo=0,eq=er.lines.length;eo<eq;++eo){var et=er.lines[eo],es=et.height;if(ep<es){break}ep-=es}return en+eo}function a7(el,eo){eo=s(el.doc,eo);var eq=0,en=eo.parent;for(var ep=0;ep<en.lines.length;++ep){var em=en.lines[ep];if(em==eo){break}else{eq+=em.height}}for(var er=en.parent;er;en=er,er=en.parent){for(var ep=0;ep<er.children.length;++ep){var es=er.children[ep];if(es==en){break}else{eq+=es.height}}}return eq}function a(em){var el=em.order;if(el==null){el=em.order=aH(em.text)}return el}function Z(el){return{done:[],undone:[],undoDepth:Infinity,lastTime:0,lastOp:null,lastOrigin:null,generation:el||1,maxGeneration:el||1}}function bg(em,eq,ep,eo){var el=eq["spans_"+em.id],en=0;em.iter(Math.max(em.first,ep),Math.min(em.first+em.size,eo),function(er){if(er.markedSpans){(el||(el=eq["spans_"+em.id]={}))[en]=er.markedSpans}++en})}function ck(el,eo){var en={line:eo.from.line,ch:eo.from.ch};var em={from:en,to:bY(eo),text:ea(el,eo.from,eo.to)};bg(el,em,eo.from.line,eo.to.line+1);cE(el,function(ep){bg(ep,em,eo.from.line,eo.to.line+1)},true);return em}function c8(eq,es,ep,el){var eo=eq.history;eo.undone.length=0;var en=+new Date,er=dW(eo.done);if(er&&(eo.lastOp==el||eo.lastOrigin==es.origin&&es.origin&&((es.origin.charAt(0)=="+"&&eq.cm&&eo.lastTime>en-eq.cm.options.historyEventDelay)||es.origin.charAt(0)=="*"))){var em=dW(er.changes);if(dX(es.from,es.to)&&dX(es.from,em.to)){em.to=bY(es)}else{er.changes.push(ck(eq,es))}er.anchorAfter=ep.anchor;er.headAfter=ep.head}else{er={changes:[ck(eq,es)],generation:eo.generation,anchorBefore:eq.sel.anchor,headBefore:eq.sel.head,anchorAfter:ep.anchor,headAfter:ep.head};eo.done.push(er);eo.generation=++eo.maxGeneration;while(eo.done.length>eo.undoDepth){eo.done.shift()}}eo.lastTime=en;eo.lastOp=el;eo.lastOrigin=es.origin}function aK(en){if(!en){return null}for(var em=0,el;em<en.length;++em){if(en[em].marker.explicitlyCleared){if(!el){el=en.slice(0,em)}}else{if(el){el.push(en[em])}}}return !el?en:el.length?el:null}function bl(eo,ep){var en=ep["spans_"+eo.id];if(!en){return null}for(var em=0,el=[];em<ep.text.length;++em){el.push(aK(en[em]))}return el}function a9(ev,eo){for(var er=0,em=[];er<ev.length;++er){var en=ev[er],et=en.changes,eu=[];em.push({changes:eu,anchorBefore:en.anchorBefore,headBefore:en.headBefore,anchorAfter:en.anchorAfter,headAfter:en.headAfter});for(var eq=0;eq<et.length;++eq){var es=et[eq],ep;eu.push({from:es.from,to:es.to,text:es.text});if(eo){for(var el in es){if(ep=el.match(/^spans_(\d+)$/)){if(cd(eo,Number(ep[1]))>-1){dW(eu)[el]=es[el];delete es[el]}}}}}}return em}function dj(eo,en,em,el){if(em<eo.line){eo.line+=el}else{if(en<eo.line){eo.line=en;eo.ch=0}}}function dB(eo,eq,er,es){for(var en=0;en<eo.length;++en){var el=eo[en],ep=true;for(var em=0;em<el.changes.length;++em){var et=el.changes[em];if(!el.copied){et.from=bv(et.from);et.to=bv(et.to)}if(er<et.from.line){et.from.line+=es;et.to.line+=es}else{if(eq<=et.to.line){ep=false;break}}}if(!el.copied){el.anchorBefore=bv(el.anchorBefore);el.headBefore=bv(el.headBefore);el.anchorAfter=bv(el.anchorAfter);el.readAfter=bv(el.headAfter);el.copied=true}if(!ep){eo.splice(0,en+1);en=0}else{dj(el.anchorBefore);dj(el.headBefore);dj(el.anchorAfter);dj(el.headAfter)}}}function cr(em,ep){var eo=ep.from.line,en=ep.to.line,el=ep.text.length-(en-eo)-1;dB(em.done,eo,en,el);dB(em.undone,eo,en,el)}function df(){cS(this)}function V(el){if(!el.stop){el.stop=df}return el}function bO(el){if(el.preventDefault){el.preventDefault()}else{el.returnValue=false}}function ch(el){if(el.stopPropagation){el.stopPropagation()}else{el.cancelBubble=true}}function a6(el){return el.defaultPrevented!=null?el.defaultPrevented:el.returnValue==false}function cS(el){bO(el);ch(el)}y.e_stop=cS;y.e_preventDefault=bO;y.e_stopPropagation=ch;function A(el){return el.target||el.srcElement}function d0(em){var el=em.which;if(el==null){if(em.button&1){el=1}else{if(em.button&2){el=3}else{if(em.button&4){el=2}}}}if(bk&&em.ctrlKey&&el==1){el=3}return el}function bf(eo,em,en){if(eo.addEventListener){eo.addEventListener(em,en,false)}else{if(eo.attachEvent){eo.attachEvent("on"+em,en)}else{var ep=eo._handlers||(eo._handlers={});var el=ep[em]||(ep[em]=[]);el.push(en)}}}function cK(ep,en,eo){if(ep.removeEventListener){ep.removeEventListener(en,eo,false)}else{if(ep.detachEvent){ep.detachEvent("on"+en,eo)}else{var el=ep._handlers&&ep._handlers[en];if(!el){return}for(var em=0;em<el.length;++em){if(el[em]==eo){el.splice(em,1);break}}}}}function ae(ep,eo){var el=ep._handlers&&ep._handlers[eo];if(!el){return}var em=Array.prototype.slice.call(arguments,2);for(var en=0;en<el.length;++en){el[en].apply(null,em)}}var aO,bE=0;function L(eq,ep){var el=eq._handlers&&eq._handlers[ep];if(!el){return}var en=Array.prototype.slice.call(arguments,2);if(!aO){++bE;aO=[];setTimeout(c0,0)}function em(er){return function(){er.apply(null,en)}}for(var eo=0;eo<el.length;++eo){aO.push(em(el[eo]))}}function ao(el,en,em){ae(el,em||en.type,el,en);return a6(en)||en.codemirrorIgnore}function c0(){--bE;var el=aO;aO=null;for(var em=0;em<el.length;++em){el[em]()}}function dE(en,em){var el=en._handlers&&en._handlers[em];return el&&el.length>0}y.on=bf;y.off=cK;y.signal=ae;function aV(el){el.prototype.on=function(em,en){bf(this,em,en)};el.prototype.off=function(em,en){cK(this,em,en)}}var aJ=30;var bp=y.Pass={toString:function(){return"CodeMirror.Pass"}};function ek(){this.id=null}ek.prototype={set:function(el,em){clearTimeout(this.id);this.id=setTimeout(em,el)}};function bb(en,el,ep,eq,em){if(el==null){el=en.search(/[^\s\u00a0]/);if(el==-1){el=en.length}}for(var eo=eq||0,er=em||0;eo<el;++eo){if(en.charAt(eo)=="\t"){er+=ep-(er%ep)}else{++er}}return er}y.countColumn=bb;var au=[""];function bC(el){while(au.length<=el){au.push(dW(au)+" ")}return au[el]}function dW(el){return el[el.length-1]}function cu(em){if(dm){em.selectionStart=0;em.selectionEnd=em.value.length}else{try{em.select()}catch(el){}}}function cd(eo,el){if(eo.indexOf){return eo.indexOf(el)}for(var em=0,en=eo.length;em<en;++em){if(eo[em]==el){return em}}return -1}function bw(eo,em){function el(){}el.prototype=eo;var en=new el();if(em){aj(em,en)}return en}function aj(em,el){if(!el){el={}}for(var en in em){if(em.hasOwnProperty(en)){el[en]=em[en]}}return el}function R(en){for(var el=[],em=0;em<en;++em){el.push(undefined)}return el}function bH(em){var el=Array.prototype.slice.call(arguments,1);return function(){return em.apply(null,el)}}var aD=/[\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function bK(el){return/\w/.test(el)||el>"\x80"&&(el.toUpperCase()!=el.toLowerCase()||aD.test(el))}function dh(el){for(var em in el){if(el.hasOwnProperty(em)&&el[em]){return false}}return true}var dK=/[\u0300-\u036F\u0483-\u0487\u0488-\u0489\u0591-\u05BD\u05BF\u05C1-\u05C2\u05C4-\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7-\u06E8\u06EA-\u06ED\uA66F\u1DC0\u1DFF\u20D0\u20FF\uA670-\uA672\uA674-\uA67D\uA69F\udc00-\udfff\uFE20\uFE2F]/;function d8(el,ep,eo,en){var eq=document.createElement(el);if(eo){eq.className=eo}if(en){eq.style.cssText=en}if(typeof ep=="string"){m(eq,ep)}else{if(ep){for(var em=0;em<ep.length;++em){eq.appendChild(ep[em])}}}return eq}function cB(em){for(var el=em.childNodes.length;el>0;--el){em.removeChild(em.firstChild)}return em}function bc(el,em){return cB(el).appendChild(em)}function m(el,em){if(bx){el.innerHTML="";el.appendChild(document.createTextNode(em))}else{el.textContent=em}}function ak(el){return el.getBoundingClientRect()}y.replaceGetRect=function(el){ak=el};var db=function(){if(bx){return false}var el=d8("div");return"draggable" in el||"dragDrop" in el}();function bo(){return false}if(bB){bo=function(em,el){return em.charCodeAt(el-1)==36&&em.charCodeAt(el)==39}}else{if(ad&&!/Version\/([6-9]|\d\d)\b/.test(navigator.userAgent)){bo=function(em,el){return/\-[^ \-?]|\?[^ !\'\"\),.\-\/:;\?\]\}]/.test(em.slice(el-1,el+1))}}else{if(b1&&/Chrome\/(?:29|[3-9]\d|\d\d\d)\./.test(navigator.userAgent)){bo=function(en,el){var em=en.charCodeAt(el-1);return em>=8208&&em<=8212}}else{if(b1){bo=function(em,el){if(el>1&&em.charCodeAt(el-1)==45){if(/\w/.test(em.charAt(el-2))&&/[^\-?\.]/.test(em.charAt(el))){return true}if(el>2&&/[\d\.,]/.test(em.charAt(el-2))&&/[\d\.,]/.test(em.charAt(el))){return false}}return/[~!#%&*)=+}\]\\|\"\.>,:;][({[<]|-[^\-?\.\u2010-\u201f\u2026]|\?[\w~`@#$%\^&*(_=+{[|><]|…[\w~`@#$%\^&*(_=+{[><]/.test(em.slice(el-1,el+1))}}}}}var cW;function i(el){if(cW!=null){return cW}var em=d8("div",null,null,"width: 50px; height: 50px; overflow-x: scroll");bc(el,em);if(em.offsetWidth){cW=em.offsetHeight-em.clientHeight}return cW||0}var dZ;function aN(el){if(dZ==null){var em=d8("span","\u200b");bc(el,d8("span",[em,document.createTextNode("x")]));if(el.firstChild.offsetHeight!=0){dZ=em.offsetWidth<=1&&em.offsetHeight>2&&!by}}if(dZ){return d8("span","\u200b")}else{return d8("span","\u00a0",null,"display: inline-block; width: 1px; margin-right: -1px")}}var av="\n\nb".split(/\n/).length!=3?function(eq){var er=0,el=[],ep=eq.length;while(er<=ep){var eo=eq.indexOf("\n",er);if(eo==-1){eo=eq.length}var en=eq.slice(er,eq.charAt(eo-1)=="\r"?eo-1:eo);var em=en.indexOf("\r");if(em!=-1){el.push(en.slice(0,em));er+=em+1}else{el.push(en);er=eo+1}}return el}:function(el){return el.split(/\r\n?|\n/)};y.splitLines=av;var aS=window.getSelection?function(em){try{return em.selectionStart!=em.selectionEnd}catch(el){return false}}:function(en){try{var el=en.ownerDocument.selection.createRange()}catch(em){}if(!el||el.parentElement()!=en){return false}return el.compareEndPoints("StartToEnd",el)!=0};var b7=(function(){var el=d8("div");if("oncopy" in el){return true}el.setAttribute("oncopy","return;");return typeof el.oncopy=="function"})();var dA={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",91:"Mod",92:"Mod",93:"Mod",109:"-",107:"=",127:"Delete",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63276:"PageUp",63277:"PageDown",63275:"End",63273:"Home",63234:"Left",63232:"Up",63235:"Right",63233:"Down",63302:"Insert",63272:"Delete"};y.keyNames=dA;(function(){for(var el=0;el<10;el++){dA[el+48]=String(el)}for(var el=65;el<=90;el++){dA[el]=String.fromCharCode(el)}for(var el=1;el<=12;el++){dA[el+111]=dA[el+63235]="F"+el}})();function cC(el,er,eq,ep){if(!el){return ep(er,eq,"ltr")}var eo=false;for(var en=0;en<el.length;++en){var em=el[en];if(em.from<eq&&em.to>er||er==eq&&em.to==er){ep(Math.max(em.from,er),Math.min(em.to,eq),em.level==1?"rtl":"ltr");eo=true}}if(!eo){ep(er,eq,"ltr")}}function cn(el){return el.level%2?el.to:el.from}function eg(el){return el.level%2?el.from:el.to}function bN(em){var el=a(em);return el?cn(el[0]):0}function bX(em){var el=a(em);if(!el){return em.text.length}return eg(dW(el))}function aT(em,ep){var en=dy(em.doc,ep);var eq=s(em.doc,en);if(eq!=en){ep=a8(eq)}var el=a(eq);var eo=!el?0:el[0].level%2?bX(eq):bN(eq);return H(ep,eo)}function cw(en,eq){var em,eo;while(em=cV(eo=dy(en.doc,eq))){eq=em.find().to.line}var el=a(eo);var ep=!el?eo.text.length:el[0].level%2?bN(eo):bX(eo);return H(eq,ep)}function U(em,en,el){var eo=em[0].level;if(en==eo){return true}if(el==eo){return false}return en<el}var dn;function ag(el,ep){for(var em=0,en;em<el.length;++em){var eo=el[em];if(eo.from<ep&&eo.to>ep){dn=null;return em}if(eo.from==ep||eo.to==ep){if(en==null){en=em}else{if(U(el,eo.level,el[en].level)){dn=en;return em}else{dn=em;return en}}}}dn=null;return en}function dx(el,eo,em,en){if(!en){return eo+em}do{eo+=em}while(eo>0&&dK.test(el.text.charAt(eo)));return eo}function p(el,es,en,eo){var ep=a(el);if(!ep){return O(el,es,en,eo)}var er=ag(ep,es),em=ep[er];var eq=dx(el,es,em.level%2?-en:en,eo);for(;;){if(eq>em.from&&eq<em.to){return eq}if(eq==em.from||eq==em.to){if(ag(ep,eq)==er){return eq}em=ep[er+=en];return(en>0)==em.level%2?em.to:em.from}else{em=ep[er+=en];if(!em){return null}if((en>0)==em.level%2){eq=dx(el,em.to,-1,eo)}else{eq=dx(el,em.from,1,eo)}}}}function O(el,ep,em,en){var eo=ep+em;if(en){while(eo>0&&dK.test(el.text.charAt(eo))){eo+=em}}return eo<0||eo>el.text.length?null:eo}var aH=(function(){var er="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLL";var ep="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmmrrrrrrrrrrrrrrrrrr";function eo(eu){if(eu<=255){return er.charAt(eu)}else{if(1424<=eu&&eu<=1524){return"R"}else{if(1536<=eu&&eu<=1791){return ep.charAt(eu-1536)}else{if(1792<=eu&&eu<=2220){return"r"}else{return"L"}}}}}var el=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;var et=/[stwN]/,en=/[LRr]/,em=/[Lb1n]/,eq=/[1n]/;var es="L";return function(eE){if(!el.test(eE)){return false}var eK=eE.length,eA=[];for(var eJ=0,ew;eJ<eK;++eJ){eA.push(ew=eo(eE.charCodeAt(eJ)))}for(var eJ=0,eD=es;eJ<eK;++eJ){var ew=eA[eJ];if(ew=="m"){eA[eJ]=eD}else{eD=ew}}for(var eJ=0,eu=es;eJ<eK;++eJ){var ew=eA[eJ];if(ew=="1"&&eu=="r"){eA[eJ]="n"}else{if(en.test(ew)){eu=ew;if(ew=="r"){eA[eJ]="R"}}}}for(var eJ=1,eD=eA[0];eJ<eK-1;++eJ){var ew=eA[eJ];if(ew=="+"&&eD=="1"&&eA[eJ+1]=="1"){eA[eJ]="1"}else{if(ew==","&&eD==eA[eJ+1]&&(eD=="1"||eD=="n")){eA[eJ]=eD}}eD=ew}for(var eJ=0;eJ<eK;++eJ){var ew=eA[eJ];if(ew==","){eA[eJ]="N"}else{if(ew=="%"){for(var ex=eJ+1;ex<eK&&eA[ex]=="%";++ex){}var eL=(eJ&&eA[eJ-1]=="!")||(ex<eK-1&&eA[ex]=="1")?"1":"N";for(var eH=eJ;eH<ex;++eH){eA[eH]=eL}eJ=ex-1}}}for(var eJ=0,eu=es;eJ<eK;++eJ){var ew=eA[eJ];if(eu=="L"&&ew=="1"){eA[eJ]="L"}else{if(en.test(ew)){eu=ew}}}for(var eJ=0;eJ<eK;++eJ){if(et.test(eA[eJ])){for(var ex=eJ+1;ex<eK&&et.test(eA[ex]);++ex){}var eB=(eJ?eA[eJ-1]:es)=="L";var ev=(ex<eK-1?eA[ex]:es)=="L";var eL=eB||ev?"L":"R";for(var eH=eJ;eH<ex;++eH){eA[eH]=eL}eJ=ex-1}}var eI=[],eF;for(var eJ=0;eJ<eK;){if(em.test(eA[eJ])){var ey=eJ;for(++eJ;eJ<eK&&em.test(eA[eJ]);++eJ){}eI.push({from:ey,to:eJ,level:0})}else{var ez=eJ,eC=eI.length;for(++eJ;eJ<eK&&eA[eJ]!="L";++eJ){}for(var eH=ez;eH<eJ;){if(eq.test(eA[eH])){if(ez<eH){eI.splice(eC,0,{from:ez,to:eH,level:1})}var eG=eH;for(++eH;eH<eJ&&eq.test(eA[eH]);++eH){}eI.splice(eC,0,{from:eG,to:eH,level:2});ez=eH}else{++eH}}if(ez<eJ){eI.splice(eC,0,{from:ez,to:eJ,level:1})}}}if(eI[0].level==1&&(eF=eE.match(/^\s+/))){eI[0].from=eF[0].length;eI.unshift({from:0,to:eF[0].length,level:0})}if(dW(eI).level==1&&(eF=eE.match(/\s+$/))){dW(eI).to-=eF[0].length;eI.push({from:eK-eF[0].length,to:eK,level:0})}if(eI[0].level!=dW(eI).level){eI.push({from:eK,to:eK,level:eI[0].level})}return eI}})();y.version="3.20.0";return y})();