/**
 * CodeMirror version 3.11
 *
 * This minified CodeMirror library includes the following component (in this order):
 * 1. CodeMirror base library
 * 2. Active Line addon
 * 3. CSS mode library
 * 4. XML mode library
 * 5. JavaScript mode library
 * 6. HTML Mixed mode library
 */
window.CodeMirror=function(){"use strict";function S(e,n){if(!(this instanceof S))return new S(e,n);this.options=n=n||{};for(var r in Xn)if(!n.hasOwnProperty(r)&&Xn.hasOwnProperty(r))n[r]=Xn[r];P(n);var i=typeof n.value=="string"?0:n.value.first;var s=this.display=x(e,i);s.wrapper.CodeMirror=this;M(this);if(n.autofocus&&!d)Dt(this);this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:false,focused:false,suppressEdits:false,pasteIncoming:false,draggingText:false,highlight:new ji};A(this);if(n.lineWrapping)this.display.wrapper.className+=" CodeMirror-wrap";var o=n.value;if(typeof o=="string")o=new Gr(n.value,n.mode);Nt(this,ti)(this,o);if(t)setTimeout($i(_t,this,true),20);Ht(this);var u;try{u=document.activeElement==s.input}catch(a){}if(u||n.autofocus&&!d)setTimeout($i(rn,this),20);else sn(this);Nt(this,function(){for(var e in Wn)if(Wn.propertyIsEnumerable(e))Wn[e](this,n[e],$n);for(var t=0;t<Gn.length;++t)Gn[t](this)})()}function x(e,t){var r={};var s=r.input=Yi("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none;");if(i)s.style.width="1000px";else s.setAttribute("wrap","off");if(p)s.style.border="1px solid black";s.setAttribute("autocorrect","off");s.setAttribute("autocapitalize","off");r.inputDiv=Yi("div",[s],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");r.scrollbarH=Yi("div",[Yi("div",null,null,"height: 1px")],"CodeMirror-hscrollbar");r.scrollbarV=Yi("div",[Yi("div",null,null,"width: 1px")],"CodeMirror-vscrollbar");r.scrollbarFiller=Yi("div",null,"CodeMirror-scrollbar-filler");r.lineDiv=Yi("div");r.selectionDiv=Yi("div",null,null,"position: relative; z-index: 1");r.cursor=Yi("div"," ","CodeMirror-cursor");r.otherCursor=Yi("div"," ","CodeMirror-cursor CodeMirror-secondarycursor");r.measure=Yi("div",null,"CodeMirror-measure");r.lineSpace=Yi("div",[r.measure,r.selectionDiv,r.lineDiv,r.cursor,r.otherCursor],null,"position: relative; outline: none");r.mover=Yi("div",[Yi("div",[r.lineSpace],"CodeMirror-lines")],null,"position: relative");r.sizer=Yi("div",[r.mover],"CodeMirror-sizer");r.heightForcer=Yi("div",null,null,"position: absolute; height: "+Hi+"px; width: 1px;");r.gutters=Yi("div",null,"CodeMirror-gutters");r.lineGutter=null;var o=Yi("div",[r.sizer,r.heightForcer,r.gutters],null,"position: relative; min-height: 100%");r.scroller=Yi("div",[o],"CodeMirror-scroll");r.scroller.setAttribute("tabIndex","-1");r.wrapper=Yi("div",[r.inputDiv,r.scrollbarH,r.scrollbarV,r.scrollbarFiller,r.scroller],"CodeMirror");if(n){r.gutters.style.zIndex=-1;r.scroller.style.paddingRight=0}if(e.appendChild)e.appendChild(r.wrapper);else e(r.wrapper);if(p)s.style.width="0px";if(!i)r.scroller.draggable=true;if(f){r.inputDiv.style.height="1px";r.inputDiv.style.position="absolute"}else if(n)r.scrollbarH.style.minWidth=r.scrollbarV.style.minWidth="18px";r.viewOffset=r.lastSizeC=0;r.showingFrom=r.showingTo=t;r.lineNumWidth=r.lineNumInnerWidth=r.lineNumChars=null;r.prevInput="";r.alignWidgets=false;r.pollingFast=false;r.poll=new ji;r.draggingText=false;r.cachedCharWidth=r.cachedTextHeight=null;r.measureLineCache=[];r.measureLineCachePos=0;r.inaccurateSelection=false;r.maxLine=null;r.maxLineLength=0;r.maxLineChanged=false;r.wheelDX=r.wheelDY=r.wheelStartX=r.wheelStartY=null;return r}function T(e){e.doc.mode=S.getMode(e.options,e.doc.modeOption);e.doc.iter(function(e){if(e.stateAfter)e.stateAfter=null;if(e.styles)e.styles=null});e.doc.frontier=e.doc.first;Z(e,100);e.state.modeGen++;if(e.curOp)Lt(e)}function N(e){if(e.options.lineWrapping){e.display.wrapper.className+=" CodeMirror-wrap";e.display.sizer.style.minWidth=""}else{e.display.wrapper.className=e.display.wrapper.className.replace(" CodeMirror-wrap","");D(e)}k(e);Lt(e);ct(e);setTimeout(function(){H(e.display,e.doc.height)},100)}function C(e){var t=wt(e.display),n=e.options.lineWrapping;var r=n&&Math.max(5,e.display.scroller.clientWidth/Et(e.display)-3);return function(i){if(xr(e.doc,i))return 0;else if(n)return(Math.ceil(i.text.length/r)||1)*t;else return t}}function k(e){var t=e.doc,n=C(e);t.iter(function(e){var t=n(e);if(t!=e.height)si(e,t)})}function L(e){var t=tr[e.options.keyMap].style;e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-keymap-\S+/g,"")+(t?" cm-keymap-"+t:"")}function A(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-");ct(e)}function O(e){M(e);Lt(e)}function M(e){var t=e.display.gutters,n=e.options.gutters;Zi(t);for(var r=0;r<n.length;++r){var i=n[r];var s=t.appendChild(Yi("div",null,"CodeMirror-gutter "+i));if(i=="CodeMirror-linenumbers"){e.display.lineGutter=s;s.style.width=(e.display.lineNumWidth||1)+"px"}}t.style.display=r?"":"none"}function _(e,t){if(t.height==0)return 0;var n=t.text.length,r,i=t;while(r=wr(i)){var s=r.find();i=ni(e,s.from.line);n+=s.from.ch-s.to.ch}i=t;while(r=Er(i)){var s=r.find();n-=i.text.length-s.from.ch;i=ni(e,s.to.line);n+=i.text.length-s.to.ch}return n}function D(e){var t=e.display,n=e.doc;t.maxLine=ni(n,n.first);t.maxLineLength=_(n,t.maxLine);t.maxLineChanged=true;n.iter(function(e){var r=_(n,e);if(r>t.maxLineLength){t.maxLineLength=r;t.maxLine=e}})}function P(e){var t=false;for(var n=0;n<e.gutters.length;++n){if(e.gutters[n]=="CodeMirror-linenumbers"){if(e.lineNumbers)t=true;else e.gutters.splice(n--,1)}}if(!t&&e.lineNumbers)e.gutters.push("CodeMirror-linenumbers")}function H(e,t){var n=t+it(e);e.sizer.style.minHeight=e.heightForcer.style.top=n+"px";var r=Math.max(n,e.scroller.scrollHeight);var i=e.scroller.scrollWidth>e.scroller.clientWidth;var s=r>e.scroller.clientHeight;if(s){e.scrollbarV.style.display="block";e.scrollbarV.style.bottom=i?os(e.measure)+"px":"0";e.scrollbarV.firstChild.style.height=r-e.scroller.clientHeight+e.scrollbarV.clientHeight+"px"}else e.scrollbarV.style.display="";if(i){e.scrollbarH.style.display="block";e.scrollbarH.style.right=s?os(e.measure)+"px":"0";e.scrollbarH.firstChild.style.width=e.scroller.scrollWidth-e.scroller.clientWidth+e.scrollbarH.clientWidth+"px"}else e.scrollbarH.style.display="";if(i&&s){e.scrollbarFiller.style.display="block";e.scrollbarFiller.style.height=e.scrollbarFiller.style.width=os(e.measure)+"px"}else e.scrollbarFiller.style.display="";if(l&&os(e.measure)===0)e.scrollbarV.style.minWidth=e.scrollbarH.style.minHeight=c?"18px":"12px"}function B(e,t,n){var r=e.scroller.scrollTop,i=e.wrapper.clientHeight;if(typeof n=="number")r=n;else if(n){r=n.top;i=n.bottom-n.top}r=Math.floor(r-rt(e));var s=Math.ceil(r+i);return{from:ui(t,r),to:ui(t,s)}}function j(e){var t=e.display;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;var n=q(t)-t.scroller.scrollLeft+e.doc.scrollLeft;var r=t.gutters.offsetWidth,i=n+"px";for(var s=t.lineDiv.firstChild;s;s=s.nextSibling)if(s.alignable){for(var o=0,u=s.alignable;o<u.length;++o)u[o].style.left=i}if(e.options.fixedGutter)t.gutters.style.left=n+r+"px"}function F(e){if(!e.options.lineNumbers)return false;var t=e.doc,n=I(e.options,t.first+t.size-1),r=e.display;if(n.length!=r.lineNumChars){var i=r.measure.appendChild(Yi("div",[Yi("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt"));var s=i.firstChild.offsetWidth,o=i.offsetWidth-s;r.lineGutter.style.width="";r.lineNumInnerWidth=Math.max(s,r.lineGutter.offsetWidth-o);r.lineNumWidth=r.lineNumInnerWidth+o;r.lineNumChars=r.lineNumInnerWidth?n.length:-1;r.lineGutter.style.width=r.lineNumWidth+"px";return true}return false}function I(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function q(e){return ns(e.scroller).left-ns(e.sizer).left}function R(e,t,n){var r=e.display.showingFrom,i=e.display.showingTo;var s=U(e,t,n);if(s){_i(e,"update",e);if(e.display.showingFrom!=r||e.display.showingTo!=i)_i(e,"viewportChange",e,e.display.showingFrom,e.display.showingTo)}K(e);H(e.display,e.doc.height);return s}function U(e,t,r){var i=e.display,s=e.doc;if(!i.wrapper.clientWidth){i.showingFrom=i.showingTo=s.first;i.viewOffset=0;return}var o=B(i,s,r);if(t.length==0&&o.from>i.showingFrom&&o.to<i.showingTo)return;if(F(e))t=[{from:s.first,to:s.first+s.size}];var u=i.sizer.style.marginLeft=i.gutters.offsetWidth+"px";i.scrollbarH.style.left=e.options.fixedGutter?u:"0";var a=Infinity;if(e.options.lineNumbers)for(var f=0;f<t.length;++f)if(t[f].diff){a=t[f].from;break}var l=s.first+s.size;var c=Math.max(o.from-e.options.viewportMargin,s.first);var h=Math.min(l,o.to+e.options.viewportMargin);if(i.showingFrom<c&&c-i.showingFrom<20)c=Math.max(s.first,i.showingFrom);if(i.showingTo>h&&i.showingTo-h<20)h=Math.min(l,i.showingTo);if(E){c=oi(Sr(s,ni(s,c)));while(h<l&&xr(s,ni(s,h)))++h}var p=[{from:Math.max(i.showingFrom,s.first),to:Math.min(i.showingTo,l)}];if(p[0].from>=p[0].to)p=[];else p=W(p,t);if(E)for(var f=0;f<p.length;++f){var d=p[f],v;while(v=Er(ni(s,d.to-1))){var m=v.find().from.line;if(m>d.from)d.to=m;else{p.splice(f--,1);break}}}var g=0;for(var f=0;f<p.length;++f){var d=p[f];if(d.from<c)d.from=c;if(d.to>h)d.to=h;if(d.from>=d.to)p.splice(f--,1);else g+=d.to-d.from}if(g==h-c&&c==i.showingFrom&&h==i.showingTo){z(e);return}p.sort(function(e,t){return e.from-t.from});var y=document.activeElement;if(g<(h-c)*.7)i.lineDiv.style.display="none";V(e,c,h,p,a);i.lineDiv.style.display="";if(document.activeElement!=y&&y.offsetHeight)y.focus();var b=c!=i.showingFrom||h!=i.showingTo||i.lastSizeC!=i.wrapper.clientHeight;if(b)i.lastSizeC=i.wrapper.clientHeight;i.showingFrom=c;i.showingTo=h;Z(e,100);var w=i.lineDiv.offsetTop;for(var S=i.lineDiv.firstChild,x;S;S=S.nextSibling)if(S.lineObj){if(n){var T=S.offsetTop+S.offsetHeight;x=T-w;w=T}else{var N=ns(S);x=N.bottom-N.top}var C=S.lineObj.height-x;if(x<2)x=wt(i);if(C>.001||C<-.001){si(S.lineObj,x);var k=S.lineObj.widgets;if(k)for(var f=0;f<k.length;++f)k[f].height=k[f].node.offsetHeight}}z(e);if(B(i,s,r).to>h)U(e,[],r);return true}function z(e){var t=e.display.viewOffset=ai(e,ni(e.doc,e.display.showingFrom));e.display.mover.style.top=t+"px"}function W(e,t){for(var n=0,r=t.length||0;n<r;++n){var i=t[n],s=[],o=i.diff||0;for(var u=0,a=e.length;u<a;++u){var f=e[u];if(i.to<=f.from&&i.diff){s.push({from:f.from+o,to:f.to+o})}else if(i.to<=f.from||i.from>=f.to){s.push(f)}else{if(i.from>f.from)s.push({from:f.from,to:i.from});if(i.to<f.to)s.push({from:i.to+o,to:f.to+o})}}e=s}return e}function X(e){var t=e.display,n={},r={};for(var i=t.gutters.firstChild,s=0;i;i=i.nextSibling,++s){n[e.options.gutters[s]]=i.offsetLeft;r[e.options.gutters[s]]=i.offsetWidth}return{fixedPos:q(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function V(e,t,n,r,s){function c(t){var n=t.nextSibling;if(i&&v&&e.display.currentWheelTarget==t){t.style.display="none";t.lineObj=null}else{t.parentNode.removeChild(t)}return n}var o=X(e);var u=e.display,a=e.options.lineNumbers;if(!r.length&&(!i||!e.display.currentWheelTarget))Zi(u.lineDiv);var f=u.lineDiv,l=f.firstChild;var h=r.shift(),p=t;e.doc.iter(t,n,function(t){if(h&&h.to==p)h=r.shift();if(xr(e.doc,t)){if(t.height!=0)si(t,0);if(t.widgets&&l.previousSibling)for(var n=0;n<t.widgets.length;++n)if(t.widgets[n].showIfHidden){var i=l.previousSibling;if(/pre/i.test(i.nodeName)){var u=Yi("div",null,null,"position: relative");i.parentNode.replaceChild(u,i);u.appendChild(i);i=u}var d=i.appendChild(Yi("div",[t.widgets[n].node],"CodeMirror-linewidget"));J(t.widgets[n],d,i,o)}}else if(h&&h.from<=p&&h.to>p){while(l.lineObj!=t)l=c(l);if(a&&s<=p&&l.lineNumber)ts(l.lineNumber,I(e.options,p));l=l.nextSibling}else{if(t.widgets)for(var v=0,m=l,g;m&&v<20;++v,m=m.nextSibling)if(m.lineObj==t&&/div/i.test(m.nodeName)){g=m;break}var y=$(e,t,p,o,g);if(y!=g){f.insertBefore(y,l)}else{while(l!=g)l=c(l);l=l.nextSibling}y.lineObj=t}++p});while(l)l=c(l)}function $(e,t,r,i,s){var o=qr(e,t);var u=t.gutterMarkers,a=e.display,f;if(!e.options.lineNumbers&&!u&&!t.bgClass&&!t.wrapClass&&!t.widgets)return o;if(s){s.alignable=null;var l=true,c=0;for(var h=s.firstChild,p;h;h=p){p=h.nextSibling;if(!/\bCodeMirror-linewidget\b/.test(h.className)){s.removeChild(h)}else{for(var d=0,v=true;d<t.widgets.length;++d){var m=t.widgets[d],g=false;if(!m.above){g=v;v=false}if(m.node==h.firstChild){J(m,h,s,i);++c;if(g)s.insertBefore(o,h);break}}if(d==t.widgets.length){l=false;break}}}if(l&&c==t.widgets.length){f=s;s.className=t.wrapClass||""}}if(!f){f=Yi("div",null,t.wrapClass,"position: relative");f.appendChild(o)}if(t.bgClass)f.insertBefore(Yi("div",null,t.bgClass+" CodeMirror-linebackground"),f.firstChild);if(e.options.lineNumbers||u){var y=f.insertBefore(Yi("div",null,null,"position: absolute; left: "+(e.options.fixedGutter?i.fixedPos:-i.gutterTotalWidth)+"px"),f.firstChild);if(e.options.fixedGutter)(f.alignable||(f.alignable=[])).push(y);if(e.options.lineNumbers&&(!u||!u["CodeMirror-linenumbers"]))f.lineNumber=y.appendChild(Yi("div",I(e.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+i.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+a.lineNumInnerWidth+"px"));if(u)for(var b=0;b<e.options.gutters.length;++b){var w=e.options.gutters[b],E=u.hasOwnProperty(w)&&u[w];if(E)y.appendChild(Yi("div",[E],"CodeMirror-gutter-elt","left: "+i.gutterLeft[w]+"px; width: "+i.gutterWidth[w]+"px"))}}if(n)f.style.zIndex=2;if(t.widgets&&f!=s)for(var d=0,S=t.widgets;d<S.length;++d){var m=S[d],x=Yi("div",[m.node],"CodeMirror-linewidget");J(m,x,f,i);if(m.above)f.insertBefore(x,e.options.lineNumbers&&t.height!=0?y:o);else f.appendChild(x);_i(m,"redraw")}return f}function J(e,t,n,r){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var i=r.wrapperWidth;t.style.left=r.fixedPos+"px";if(!e.coverGutter){i-=r.gutterTotalWidth;t.style.paddingLeft=r.gutterTotalWidth+"px"}t.style.width=i+"px"}if(e.coverGutter){t.style.zIndex=5;t.style.position="relative";if(!e.noHScroll)t.style.marginLeft=-r.gutterTotalWidth+"px"}}function K(e){var t=e.display;var n=wn(e.doc.sel.from,e.doc.sel.to);if(n||e.options.showCursorWhenSelecting)Q(e);else t.cursor.style.display=t.otherCursor.style.display="none";if(!n)G(e);else t.selectionDiv.style.display="none";var r=vt(e,e.doc.sel.head,"div");var i=ns(t.wrapper),s=ns(t.lineDiv);t.inputDiv.style.top=Math.max(0,Math.min(t.wrapper.clientHeight-10,r.top+s.top-i.top))+"px";t.inputDiv.style.left=Math.max(0,Math.min(t.wrapper.clientWidth-10,r.left+s.left-i.left))+"px"}function Q(e){var t=e.display,n=vt(e,e.doc.sel.head,"div");t.cursor.style.left=n.left+"px";t.cursor.style.top=n.top+"px";t.cursor.style.height=Math.max(0,n.bottom-n.top)*e.options.cursorHeight+"px";t.cursor.style.display="";if(n.other){t.otherCursor.style.display="";t.otherCursor.style.left=n.other.left+"px";t.otherCursor.style.top=n.other.top+"px";t.otherCursor.style.height=(n.other.bottom-n.other.top)*.85+"px"}else{t.otherCursor.style.display="none"}}function G(e){function u(e,t,n,r){if(t<0)t=0;i.appendChild(Yi("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px; top: "+t+"px; width: "+(n==null?s-e:n)+"px; height: "+(r-t)+"px"))}function a(t,r,i,a){function h(n){return dt(e,bn(t,n),"div",f)}var f=ni(n,t);var l=f.text.length,c=a?Infinity:-Infinity;ps(fi(f),r||0,i==null?l:i,function(e,t,n){var f=h(n=="rtl"?t-1:e);var p=h(n=="rtl"?e:t-1);var d=f.left,v=p.right;if(p.top-f.top>3){u(d,f.top,null,f.bottom);d=o;if(f.bottom<p.top)u(d,f.bottom,null,p.top)}if(i==null&&t==l)v=s;if(r==null&&e==0)d=o;c=a?Math.min(p.top,c):Math.max(p.bottom,c);if(d<o+1)d=o;u(d,p.top,v-d,p.bottom)});return c}var t=e.display,n=e.doc,r=e.doc.sel;var i=document.createDocumentFragment();var s=t.lineSpace.offsetWidth,o=st(e.display);if(r.from.line==r.to.line){a(r.from.line,r.from.ch,r.to.ch)}else{var f=ni(n,r.from.line);var l=f,c,h=[r.from.line,r.from.ch],p;while(c=Er(l)){var d=c.find();h.push(d.from.ch,d.to.line,d.to.ch);if(d.to.line==r.to.line){h.push(r.to.ch);p=true;break}l=ni(n,d.to.line)}if(p){for(var v=0;v<h.length;v+=3)a(h[v],h[v+1],h[v+2])}else{var m,g,y=ni(n,r.to.line);if(r.from.ch)m=a(r.from.line,r.from.ch,null,false);else m=ai(e,f)-t.viewOffset;if(!r.to.ch)g=ai(e,y)-t.viewOffset;else g=a(r.to.line,wr(y)?null:0,r.to.ch,true);if(m<g)u(o,m,null,g)}}es(t.selectionDiv,i);t.selectionDiv.style.display=""}function Y(e){var t=e.display;clearInterval(t.blinker);var n=true;t.cursor.style.visibility=t.otherCursor.style.visibility="";t.blinker=setInterval(function(){if(!t.cursor.offsetHeight)return;t.cursor.style.visibility=t.otherCursor.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate)}function Z(e,t){if(e.doc.mode.startState&&e.doc.frontier<e.display.showingTo)e.state.highlight.set(t,$i(et,e))}function et(e){var t=e.doc;if(t.frontier<t.first)t.frontier=t.first;if(t.frontier>=e.display.showingTo)return;var n=+(new Date)+e.options.workTime;var r=Yn(t.mode,nt(e,t.frontier));var i=[],s;t.iter(t.frontier,Math.min(t.first+t.size,e.display.showingTo+500),function(o){if(t.frontier>=e.display.showingFrom){var u=o.styles;o.styles=Hr(e,o,r);var a=!u||u.length!=o.styles.length;for(var f=0;!a&&f<u.length;++f)a=u[f]!=o.styles[f];if(a){if(s&&s.end==t.frontier)s.end++;else i.push(s={start:t.frontier,end:t.frontier+1})}o.stateAfter=Yn(t.mode,r)}else{jr(e,o,r);o.stateAfter=t.frontier%5==0?Yn(t.mode,r):null}++t.frontier;if(+(new Date)>n){Z(e,e.options.workDelay);return true}});if(i.length)Nt(e,function(){for(var e=0;e<i.length;++e)Lt(this,i[e].start,i[e].end)})()}function tt(e,t){var n,r,i=e.doc;for(var s=t,o=t-100;s>o;--s){if(s<=i.first)return i.first;var u=ni(i,s-1);if(u.stateAfter)return s;var a=Fi(u.text,null,e.options.tabSize);if(r==null||n>a){r=s-1;n=a}}return r}function nt(e,t){var n=e.doc,r=e.display;if(!n.mode.startState)return true;var i=tt(e,t),s=i>n.first&&ni(n,i-1).stateAfter;if(!s)s=Zn(n.mode);else s=Yn(n.mode,s);n.iter(i,t,function(o){jr(e,o,s);var u=i==t-1||i%5==0||i>=r.showingFrom&&i<r.showingTo;o.stateAfter=u?Yn(n.mode,s):null;++i});return s}function rt(e){return e.lineSpace.offsetTop}function it(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function st(e){var t=es(e.measure,Yi("pre",null,null,"text-align: left")).appendChild(Yi("span","x"));return t.offsetLeft}function ot(e,t,n,r){var i=-1;r=r||at(e,t);for(var s=n;;s+=i){var o=r[s];if(o)break;if(i<0&&s==0)i=1}return{left:s<n?o.right:o.left,right:s>n?o.left:o.right,top:o.top,bottom:o.bottom}}function ut(e,t){var n=e.display.measureLineCache;for(var r=0;r<n.length;++r){var i=n[r];if(i.text==t.text&&i.markedSpans==t.markedSpans&&e.display.scroller.clientWidth==i.width&&i.classes==t.textClass+"|"+t.bgClass+"|"+t.wrapClass)return i.measure}}function at(e,t){var n=ut(e,t);if(!n){n=ft(e,t);var r=e.display.measureLineCache;var i={text:t.text,width:e.display.scroller.clientWidth,markedSpans:t.markedSpans,measure:n,classes:t.textClass+"|"+t.bgClass+"|"+t.wrapClass};if(r.length==16)r[++e.display.measureLineCachePos%16]=i;else r.push(i)}return n}function ft(e,i){var s=e.display,o=Vi(i.text.length);var u=qr(e,i,o);if(t&&!n&&!e.options.lineWrapping&&u.childNodes.length>100){var a=document.createDocumentFragment();var f=10,l=u.childNodes.length;for(var c=0,h=Math.ceil(l/f);c<h;++c){var p=Yi("div",null,null,"display: inline-block");for(var d=0;d<f&&l;++d){p.appendChild(u.firstChild);--l}a.appendChild(p)}u.appendChild(a)}es(s.measure,u);var v=ns(s.lineDiv);var m=[],g=Vi(i.text.length),y=u.offsetHeight;if(r&&s.measure.first!=u)es(s.measure,u);for(var c=0,b;c<o.length;++c)if(b=o[c]){var w=ns(b);var E=Math.max(0,w.top-v.top),S=Math.min(w.bottom-v.top,y);for(var d=0;d<m.length;d+=2){var x=m[d],T=m[d+1];if(x>S||T<E)continue;if(x<=E&&T>=S||E<=x&&S>=T||Math.min(S,T)-Math.max(E,x)>=S-E>>1){m[d]=Math.min(E,x);m[d+1]=Math.max(S,T);break}}if(d==m.length)m.push(E,S);var N=w.right;if(b.measureRight)N=ns(b.measureRight).left;g[c]={left:w.left-v.left,right:N-v.left,top:d}}for(var c=0,b;c<g.length;++c)if(b=g[c]){var C=b.top;b.top=m[C];b.bottom=m[C+1]}return g}function lt(e,t){var n=false;if(t.markedSpans)for(var r=0;r<t.markedSpans;++r){var i=t.markedSpans[r];if(i.collapsed&&(i.to==null||i.to==t.text.length))n=true}var s=!n&&ut(e,t);if(s)return ot(e,t,t.text.length,s).right;var o=qr(e,t);var u=o.appendChild(as(e.display.measure));es(e.display.measure,o);return ns(u).right-ns(e.display.lineDiv).left}function ct(e){e.display.measureLineCache.length=e.display.measureLineCachePos=0;e.display.cachedCharWidth=e.display.cachedTextHeight=null;e.display.maxLineChanged=true;e.display.lineNumChars=null}function ht(e,t,n,r){if(t.widgets)for(var i=0;i<t.widgets.length;++i)if(t.widgets[i].above){var s=Ar(t.widgets[i]);n.top+=s;n.bottom+=s}if(r=="line")return n;if(!r)r="local";var o=ai(e,t);if(r!="local")o-=e.display.viewOffset;if(r=="page"){var u=ns(e.display.lineSpace);o+=u.top+(window.pageYOffset||(document.documentElement||document.body).scrollTop);var a=u.left+(window.pageXOffset||(document.documentElement||document.body).scrollLeft);n.left+=a;n.right+=a}n.top+=o;n.bottom+=o;return n}function pt(e,t,n){if(n=="div")return t;var r=t.left,i=t.top;if(n=="page"){r-=window.pageXOffset||(document.documentElement||document.body).scrollLeft;i-=window.pageYOffset||(document.documentElement||document.body).scrollTop}var s=ns(e.display.lineSpace);r-=s.left;i-=s.top;if(n=="local"||!n){var o=ns(e.display.wrapper);r-=o.left;i-=o.top}return{left:r,top:i}}function dt(e,t,n,r){if(!r)r=ni(e.doc,t.line);return ht(e,r,ot(e,r,t.ch),n)}function vt(e,t,n,r,i){function s(t,s){var o=ot(e,r,t,i);if(s)o.left=o.right;else o.right=o.left;return ht(e,r,o,n)}r=r||ni(e.doc,t.line);if(!i)i=at(e,r);var o=fi(r),u=t.ch;if(!o)return s(u);var a,f,l=o[0].level;for(var c=0;c<o.length;++c){var h=o[c],p=h.level%2,d,v;if(h.from<u&&h.to>u)return s(u,p);var m=p?h.to:h.from,g=p?h.from:h.to;if(m==u){if(c&&h.level<(d=o[c-1]).level)v=s(d.level%2?d.from:d.to-1,true);else v=s(p&&h.from!=h.to?u-1:u);if(p==l)a=v;else f=v}else if(g==u){var d=c<o.length-1&&o[c+1];if(!p&&d&&d.from==d.to)continue;if(d&&h.level<d.level)v=s(d.level%2?d.to-1:d.from);else v=s(p?u:u-1,true);if(p==l)a=v;else f=v}}if(l&&!u)f=s(o[0].to-1);if(!a)return f;if(f)a.other=f;return a}function mt(e,t,n){var r=new bn(e,t);if(n)r.outside=true;return r}function gt(e,t,n){var r=e.doc;n+=e.display.viewOffset;if(n<0)return mt(r.first,0,true);var i=ui(r,n),s=r.first+r.size-1;if(i>s)return mt(r.first+r.size-1,ni(r,s).text.length,true);if(t<0)t=0;for(;;){var o=ni(r,i);var u=yt(e,o,i,t,n);var a=Er(o);var f=a&&a.find();if(a&&u.ch>=f.from.ch)i=f.to.line;else return u}}function yt(e,t,n,r,i){function f(r){var i=vt(e,bn(n,r),"line",t,a);o=true;if(s>i.bottom)return i.left-u;else if(s<i.top)return i.left+u;else o=false;return i.left}var s=i-ai(e,t);var o=false,u=2*e.display.wrapper.clientWidth;var a=at(e,t);var l=fi(t),c=t.text.length;var h=ms(t),p=gs(t);var d=f(h),v=o,m=f(p),g=o;if(r>m)return mt(n,p,g);for(;;){if(l?p==h||p==ws(t,h,1):p-h<=1){var y=r-d<m-r,b=y?h:p;while(Gi.test(t.text.charAt(b)))++b;var w=mt(n,b,y?v:g);w.after=y;return w}var E=Math.ceil(c/2),S=h+E;if(l){S=h;for(var x=0;x<E;++x)S=ws(t,S,1)}var T=f(S);if(T>r){p=S;m=T;if(g=o)m+=1e3;c-=E}else{h=S;d=T;v=o;c=E}}}function wt(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(bt==null){bt=Yi("pre");for(var t=0;t<49;++t){bt.appendChild(document.createTextNode("x"));bt.appendChild(Yi("br"))}bt.appendChild(document.createTextNode("x"))}es(e.measure,bt);var n=bt.offsetHeight/50;if(n>3)e.cachedTextHeight=n;Zi(e.measure);return n||1}function Et(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=Yi("span","x");var n=Yi("pre",[t]);es(e.measure,n);var r=t.offsetWidth;if(r>2)e.cachedCharWidth=r;return r||10}function xt(e){e.curOp={changes:[],updateInput:null,userSelChange:null,textChanged:null,selectionChanged:false,updateMaxLine:false,updateScrollPos:false,id:++St};if(!(Mi++))Oi=[]}function Tt(e){var t=e.curOp,n=e.doc,r=e.display;e.curOp=null;if(t.updateMaxLine)D(e);if(r.maxLineChanged&&!e.options.lineWrapping){var i=lt(e,r.maxLine);r.sizer.style.minWidth=Math.max(0,i+3+Hi)+"px";r.maxLineChanged=false;var s=Math.max(0,r.sizer.offsetLeft+r.sizer.offsetWidth-r.scroller.clientWidth);if(s<n.scrollLeft&&!t.updateScrollPos)Xt(e,Math.min(r.scroller.scrollLeft,s),true)}var o,u;if(t.updateScrollPos){o=t.updateScrollPos}else if(t.selectionChanged&&r.scroller.clientHeight){var a=vt(e,n.sel.head);o=Hn(e,a.left,a.top,a.left,a.bottom)}if(t.changes.length||o&&o.scrollTop!=null){u=R(e,t.changes,o&&o.scrollTop);if(e.display.scroller.offsetHeight)e.doc.scrollTop=e.display.scroller.scrollTop}if(!u&&t.selectionChanged)K(e);if(t.updateScrollPos){r.scroller.scrollTop=r.scrollbarV.scrollTop=n.scrollTop=o.scrollTop;r.scroller.scrollLeft=r.scrollbarH.scrollLeft=n.scrollLeft=o.scrollLeft;j(e)}else if(o){_n(e)}if(t.selectionChanged)Y(e);if(e.state.focused&&t.updateInput)_t(e,t.userSelChange);var f=t.maybeHiddenMarkers,l=t.maybeUnhiddenMarkers;if(f)for(var c=0;c<f.length;++c)if(!f[c].lines.length)Ai(f[c],"hide");if(l)for(var c=0;c<l.length;++c)if(l[c].lines.length)Ai(l[c],"unhide");var h;if(!--Mi){h=Oi;Oi=null}if(t.textChanged)Ai(e,"change",e,t.textChanged);if(t.selectionChanged)Ai(e,"cursorActivity",e);if(h)for(var c=0;c<h.length;++c)h[c]()}function Nt(e,t){return function(){var n=e||this,r=!n.curOp;if(r)xt(n);try{var i=t.apply(n,arguments)}finally{if(r)Tt(n)}return i}}function Ct(e){return function(){var t=this.cm&&!this.cm.curOp,n;if(t)xt(this.cm);try{n=e.apply(this,arguments)}finally{if(t)Tt(this.cm)}return n}}function kt(e,t){var n=!e.curOp,r;if(n)xt(e);try{r=t()}finally{if(n)Tt(e)}return r}function Lt(e,t,n,r){if(t==null)t=e.doc.first;if(n==null)n=e.doc.first+e.doc.size;e.curOp.changes.push({from:t,to:n,diff:r})}function At(e){if(e.display.pollingFast)return;e.display.poll.set(e.options.pollInterval,function(){Mt(e);if(e.state.focused)At(e)})}function Ot(e){function n(){var r=Mt(e);if(!r&&!t){t=true;e.display.poll.set(60,n)}else{e.display.pollingFast=false;At(e)}}var t=false;e.display.pollingFast=true;e.display.poll.set(20,n)}function Mt(e){var n=e.display.input,r=e.display.prevInput,i=e.doc,s=i.sel;if(!e.state.focused||ls(n)||Pt(e))return false;var o=n.value;if(o==r&&wn(s.from,s.to))return false;if(t&&o&&n.selectionStart===0){_t(e,true);return false}var u=!e.curOp;if(u)xt(e);s.shift=false;var a=0,f=Math.min(r.length,o.length);while(a<f&&r[a]==o[a])++a;var l=s.from,c=s.to;if(a<r.length)l=bn(l.line,l.ch-(r.length-a));else if(e.state.overwrite&&wn(l,c)&&!e.state.pasteIncoming)c=bn(c.line,Math.min(ni(i,c.line).text.length,c.ch+(o.length-a)));var h=e.curOp.updateInput;hn(e.doc,{from:l,to:c,text:fs(o.slice(a)),origin:e.state.pasteIncoming?"paste":"+input"},"end");e.curOp.updateInput=h;if(o.length>1e3||o.indexOf("\n")>-1)n.value=e.display.prevInput="";else e.display.prevInput=o;if(u)Tt(e);e.state.pasteIncoming=false;return true}function _t(e,t){var n,r,i=e.doc;if(!wn(i.sel.from,i.sel.to)){e.display.prevInput="";n=cs&&(i.sel.to.line-i.sel.from.line>100||(r=e.getSelection()).length>1e3);if(n)e.display.input.value="-";else e.display.input.value=r||e.getSelection();if(e.state.focused)Ui(e.display.input)}else if(t)e.display.prevInput=e.display.input.value="";e.display.inaccurateSelection=n}function Dt(e){if(e.options.readOnly!="nocursor"&&(!d||document.activeElement!=e.display.input))e.display.input.focus()}function Pt(e){return e.options.readOnly||e.doc.cantEdit}function Ht(e){function n(){if(e.state.focused)setTimeout($i(Dt,e),0)}function r(){t.cachedCharWidth=t.cachedTextHeight=null;ct(e);kt(e,$i(Lt,e))}function i(){for(var e=t.wrapper.parentNode;e&&e!=document.body;e=e.parentNode){}if(e)setTimeout(i,5e3);else Li(window,"resize",r)}function s(t){if(e.options.onDragEvent&&e.options.onDragEvent(e,Ei(t)))return;Ti(t)}function o(){if(t.inaccurateSelection){t.prevInput="";t.inaccurateSelection=false;t.input.value=e.getSelection();Ui(t.input)}}var t=e.display;ki(t.scroller,"mousedown",Nt(e,qt));ki(t.scroller,"dblclick",Nt(e,Si));ki(t.lineSpace,"selectstart",function(e){if(!Bt(t,e))Si(e)});if(!b)ki(t.scroller,"contextmenu",function(t){un(e,t)});ki(t.scroller,"scroll",function(){if(t.scroller.clientHeight){Wt(e,t.scroller.scrollTop);Xt(e,t.scroller.scrollLeft,true);Ai(e,"scroll",e)}});ki(t.scrollbarV,"scroll",function(){if(t.scroller.clientHeight)Wt(e,t.scrollbarV.scrollTop)});ki(t.scrollbarH,"scroll",function(){if(t.scroller.clientHeight)Xt(e,t.scrollbarH.scrollLeft)});ki(t.scroller,"mousewheel",function(t){Jt(e,t)});ki(t.scroller,"DOMMouseScroll",function(t){Jt(e,t)});ki(t.scrollbarH,"mousedown",n);ki(t.scrollbarV,"mousedown",n);ki(t.wrapper,"scroll",function(){t.wrapper.scrollTop=t.wrapper.scrollLeft=0});ki(window,"resize",r);setTimeout(i,5e3);ki(t.input,"keyup",Nt(e,function(t){if(e.options.onKeyEvent&&e.options.onKeyEvent(e,Ei(t)))return;if(t.keyCode==16)e.doc.sel.shift=false}));ki(t.input,"input",$i(Ot,e));ki(t.input,"keydown",Nt(e,tn));ki(t.input,"keypress",Nt(e,nn));ki(t.input,"focus",$i(rn,e));ki(t.input,"blur",$i(sn,e));if(e.options.dragDrop){ki(t.scroller,"dragstart",function(t){zt(e,t)});ki(t.scroller,"dragenter",s);ki(t.scroller,"dragover",s);ki(t.scroller,"drop",Nt(e,Rt))}ki(t.scroller,"paste",function(n){if(Bt(t,n))return;Dt(e);Ot(e)});ki(t.input,"paste",function(){e.state.pasteIncoming=true;Ot(e)});ki(t.input,"cut",o);ki(t.input,"copy",o);if(f)ki(t.sizer,"mouseup",function(){if(document.activeElement==t.input)t.input.blur();Dt(e)})}function Bt(e,t){for(var n=Ni(t);n!=e.wrapper;n=n.parentNode){if(!n)return true;if(/\bCodeMirror-(?:line)?widget\b/.test(n.className)||n.parentNode==e.sizer&&n!=e.mover)return true}}function jt(e,t,n){var r=e.display;if(!n){var i=Ni(t);if(i==r.scrollbarH||i==r.scrollbarH.firstChild||i==r.scrollbarV||i==r.scrollbarV.firstChild||i==r.scrollbarFiller)return null}var s,o,u=ns(r.lineSpace);try{s=t.clientX;o=t.clientY}catch(t){return null}return gt(e,s-u.left,o-u.top)}function qt(e){function v(e){if(f=="single"){kn(n.doc,Tn(s,u),e);return}p=Tn(s,p);d=Tn(s,d);if(f=="double"){var t=Un(ni(s,e.line).text,e);if(En(e,p))kn(n.doc,t.from,d);else kn(n.doc,p,t.to)}else if(f=="triple"){if(En(e,p))kn(n.doc,d,Tn(s,bn(e.line,0)));else kn(n.doc,p,Tn(s,bn(e.line+1,0)))}}function y(e){var t=++g;var i=jt(n,e,true);if(!i)return;if(!wn(i,c)){if(!n.state.focused)rn(n);c=i;v(i);var o=B(r,s);if(i.line>=o.to||i.line<o.from)setTimeout(Nt(n,function(){if(g==t)y(e)}),150)}else{var u=e.clientY<m.top?-20:e.clientY>m.bottom?20:0;if(u)setTimeout(Nt(n,function(){if(g!=t)return;r.scroller.scrollTop+=u;y(e)}),50)}}function w(e){g=Infinity;var t=jt(n,e);if(t)v(t);Si(e);Dt(n);Li(document,"mousemove",E);Li(document,"mouseup",S)}var n=this,r=n.display,s=n.doc,o=s.sel;o.shift=e.shiftKey;if(Bt(r,e)){if(!i){r.scroller.draggable=false;setTimeout(function(){r.scroller.draggable=true},100)}return}if(Ut(n,e))return;var u=jt(n,e);switch(Ci(e)){case 3:if(b)un.call(n,n,e);return;case 2:if(u)kn(n.doc,u);setTimeout($i(Dt,n),20);Si(e);return}if(!u){if(Ni(e)==r.scroller)Si(e);return}if(!n.state.focused)rn(n);var a=+(new Date),f="single";if(It&&It.time>a-400&&wn(It.pos,u)){f="triple";Si(e);setTimeout($i(Dt,n),20);zn(n,u.line)}else if(Ft&&Ft.time>a-400&&wn(Ft.pos,u)){f="double";It={time:a,pos:u};Si(e);var l=Un(ni(s,u.line).text,u);kn(n.doc,l.from,l.to)}else{Ft={time:a,pos:u}}var c=u;if(n.options.dragDrop&&rs&&!Pt(n)&&!wn(o.from,o.to)&&!En(u,o.from)&&!En(o.to,u)&&f=="single"){var h=Nt(n,function(t){if(i)r.scroller.draggable=false;n.state.draggingText=false;Li(document,"mouseup",h);Li(r.scroller,"drop",h);if(Math.abs(e.clientX-t.clientX)+Math.abs(e.clientY-t.clientY)<10){Si(t);kn(n.doc,u);Dt(n)}});if(i)r.scroller.draggable=true;n.state.draggingText=h;if(r.scroller.dragDrop)r.scroller.dragDrop();ki(document,"mouseup",h);ki(r.scroller,"drop",h);return}Si(e);if(f=="single")kn(n.doc,Tn(s,u));var p=o.from,d=o.to;var m=ns(r.wrapper);var g=0;var E=Nt(n,function(e){if(!t&&!Ci(e))w(e);else y(e)});var S=Nt(n,w);ki(document,"mousemove",E);ki(document,"mouseup",S)}function Rt(e){var t=this;if(Bt(t.display,e)||t.options.onDragEvent&&t.options.onDragEvent(t,Ei(e)))return;Si(e);var n=jt(t,e,true),r=e.dataTransfer.files;if(!n||Pt(t))return;if(r&&r.length&&window.FileReader&&window.File){var i=r.length,s=Array(i),o=0;var u=function(e,r){var u=new FileReader;u.onload=function(){s[r]=u.result;if(++o==i){n=Tn(t.doc,n);hn(t.doc,{from:n,to:n,text:fs(s.join("\n")),origin:"paste"},"around")}};u.readAsText(e)};for(var a=0;a<i;++a)u(r[a],a)}else{if(t.state.draggingText&&!(En(n,t.doc.sel.from)||En(t.doc.sel.to,n))){t.state.draggingText(e);setTimeout($i(Dt,t),20);return}try{var s=e.dataTransfer.getData("Text");if(s){var f=t.doc.sel.from,l=t.doc.sel.to;An(t.doc,n,n);if(t.state.draggingText)yn(t.doc,"",f,l,"paste");t.replaceSelection(s,null,"paste");Dt(t);rn(t)}}catch(e){}}}function Ut(e,t){var n=e.display;try{var r=t.clientX,i=t.clientY}catch(t){return false}if(r>=Math.floor(ns(n.gutters).right))return false;Si(t);if(!Pi(e,"gutterClick"))return true;var s=ns(n.lineDiv);if(i>s.bottom)return true;i-=s.top-n.viewOffset;for(var o=0;o<e.options.gutters.length;++o){var u=n.gutters.childNodes[o];if(u&&ns(u).right>=r){var a=ui(e.doc,i);var f=e.options.gutters[o];_i(e,"gutterClick",e,a,f,t);break}}return true}function zt(e,t){if(Bt(e.display,t))return;var n=e.getSelection();t.dataTransfer.setData("Text",n);if(t.dataTransfer.setDragImage){var r=Yi("img",null,null,"position: fixed; left: 0; top: 0;");if(u){r.width=r.height=1;e.display.wrapper.appendChild(r);r._top=r.offsetTop}if(a){if(e.display.dragImg){r=e.display.dragImg}else{e.display.dragImg=r;r.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";e.display.wrapper.appendChild(r)}}t.dataTransfer.setDragImage(r,0,0);if(u)r.parentNode.removeChild(r)}}function Wt(t,n){if(Math.abs(t.doc.scrollTop-n)<2)return;t.doc.scrollTop=n;if(!e)R(t,[],n);if(t.display.scroller.scrollTop!=n)t.display.scroller.scrollTop=n;if(t.display.scrollbarV.scrollTop!=n)t.display.scrollbarV.scrollTop=n;if(e)R(t,[])}function Xt(e,t,n){if(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)return;t=Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth);e.doc.scrollLeft=t;j(e);if(e.display.scroller.scrollLeft!=t)e.display.scroller.scrollLeft=t;if(e.display.scrollbarH.scrollLeft!=t)e.display.scrollbarH.scrollLeft=t}function Jt(t,n){var r=n.wheelDeltaX,s=n.wheelDeltaY;if(r==null&&n.detail&&n.axis==n.HORIZONTAL_AXIS)r=n.detail;if(s==null&&n.detail&&n.axis==n.VERTICAL_AXIS)s=n.detail;else if(s==null)s=n.wheelDelta;if(s&&v&&i){for(var o=n.target;o!=f;o=o.parentNode){if(o.lineObj){t.display.currentWheelTarget=o;break}}}var a=t.display,f=a.scroller;if(r&&!e&&!u&&$t!=null){if(s)Wt(t,Math.max(0,Math.min(f.scrollTop+s*$t,f.scrollHeight-f.clientHeight)));Xt(t,Math.max(0,Math.min(f.scrollLeft+r*$t,f.scrollWidth-f.clientWidth)));Si(n);a.wheelStartX=null;return}if(s&&$t!=null){var l=s*$t;var c=t.doc.scrollTop,h=c+a.wrapper.clientHeight;if(l<0)c=Math.max(0,c+l-50);else h=Math.min(t.doc.height,h+l+50);R(t,[],{top:c,bottom:h})}if(Vt<20){if(a.wheelStartX==null){a.wheelStartX=f.scrollLeft;a.wheelStartY=f.scrollTop;a.wheelDX=r;a.wheelDY=s;setTimeout(function(){if(a.wheelStartX==null)return;var e=f.scrollLeft-a.wheelStartX;var t=f.scrollTop-a.wheelStartY;var n=t&&a.wheelDY&&t/a.wheelDY||e&&a.wheelDX&&e/a.wheelDX;a.wheelStartX=a.wheelStartY=null;if(!n)return;$t=($t*Vt+n)/(Vt+1);++Vt},200)}else{a.wheelDX+=r;a.wheelDY+=s}}}function Kt(e,t,n){if(typeof t=="string"){t=er[t];if(!t)return false}if(e.display.pollingFast&&Mt(e))e.display.pollingFast=false;var r=e.doc,i=r.sel.shift,s=false;try{if(Pt(e))e.state.suppressEdits=true;if(n)r.sel.shift=false;s=t(e)!=Bi}finally{r.sel.shift=i;e.state.suppressEdits=false}return s}function Qt(e){var t=e.state.keyMaps.slice(0);if(e.options.extraKeys)t.push(e.options.extraKeys);t.push(e.options.keyMap);return t}function Yt(e,t){var n=nr(e.options.keyMap),i=n.auto;clearTimeout(Gt);if(i&&!ir(t))Gt=setTimeout(function(){if(nr(e.options.keyMap)==n)e.options.keyMap=i.call?i.call(null,e):i},50);var s=sr(t,true),o=false;if(!s)return false;var u=Qt(e);if(t.shiftKey){o=rr("Shift-"+s,u,function(t){return Kt(e,t,true)})||rr(s,u,function(t){if(typeof t=="string"&&/^go[A-Z]/.test(t))return Kt(e,t)})}else{o=rr(s,u,function(t){return Kt(e,t)})}if(o=="stop")o=false;if(o){Si(t);Y(e);if(r){t.oldKeyCode=t.keyCode;t.keyCode=0}}return o}function Zt(e,t,n){var r=rr("'"+n+"'",Qt(e),function(t){return Kt(e,t,true)});if(r){Si(t);Y(e)}return r}function tn(e){var n=this;if(!n.state.focused)rn(n);if(t&&e.keyCode==27){e.returnValue=false}if(n.options.onKeyEvent&&n.options.onKeyEvent(n,Ei(e)))return;var r=e.keyCode;n.doc.sel.shift=r==16||e.shiftKey;var i=Yt(n,e);if(u){en=i?r:null;if(!i&&r==88&&!cs&&(v?e.metaKey:e.ctrlKey))n.replaceSelection("")}}function nn(e){var t=this;if(t.options.onKeyEvent&&t.options.onKeyEvent(t,Ei(e)))return;var n=e.keyCode,r=e.charCode;if(u&&n==en){en=null;Si(e);return}if((u&&(!e.which||e.which<10)||f)&&Yt(t,e))return;var i=String.fromCharCode(r==null?n:r);if(this.options.electricChars&&this.doc.mode.electricChars&&this.options.smartIndent&&!Pt(this)&&this.doc.mode.electricChars.indexOf(i)>-1)setTimeout(Nt(t,function(){Fn(t,t.doc.sel.to.line,"smart")}),75);if(Zt(t,e,i))return;Ot(t)}function rn(e){if(e.options.readOnly=="nocursor")return;if(!e.state.focused){Ai(e,"focus",e);e.state.focused=true;if(e.display.wrapper.className.search(/\bCodeMirror-focused\b/)==-1)e.display.wrapper.className+=" CodeMirror-focused";_t(e,true)}At(e);Y(e)}function sn(e){if(e.state.focused){Ai(e,"blur",e);e.state.focused=false;e.display.wrapper.className=e.display.wrapper.className.replace(" CodeMirror-focused","")}clearInterval(e.display.blinker);setTimeout(function(){if(!e.state.focused)e.doc.sel.shift=false},150)}function un(e,n){function l(){i.inputDiv.style.position="relative";i.input.style.cssText=f;if(r)i.scrollbarV.scrollTop=i.scroller.scrollTop=a;At(e);if(i.input.selectionStart!=null&&(!t||r)){clearTimeout(on);var n=i.input.value=" "+(wn(s.from,s.to)?"":i.input.value),o=0;i.prevInput=" ";i.input.selectionStart=1;i.input.selectionEnd=n.length;var u=function(){if(i.prevInput==" "&&i.input.selectionStart==0)Nt(e,er.selectAll)(e);else if(o++<10)on=setTimeout(u,500);else _t(e)};on=setTimeout(u,200)}}var i=e.display,s=e.doc.sel;if(Bt(i,n))return;var o=jt(e,n),a=i.scroller.scrollTop;if(!o||u)return;if(wn(s.from,s.to)||En(o,s.from)||!En(o,s.to))Nt(e,An)(e.doc,o,o);var f=i.input.style.cssText;i.inputDiv.style.position="absolute";i.input.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(n.clientY-5)+"px; left: "+(n.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);";Dt(e);_t(e,true);if(wn(s.from,s.to))i.input.value=i.prevInput=" ";if(b){Ti(n);var c=function(){Li(window,"mouseup",c);setTimeout(l,20)};ki(window,"mouseup",c)}else{setTimeout(l,50)}}function an(e){return bn(e.from.line+e.text.length-1,Ri(e.text).length+(e.text.length==1?e.from.ch:0))}function fn(e,t,n){if(!En(t.from,n))return Tn(e,n);var r=t.text.length-1-(t.to.line-t.from.line);if(n.line>t.to.line+r){var i=n.line-r,s=e.first+e.size-1;if(i>s)return bn(s,ni(e,s).text.length);return Nn(n,ni(e,i).text.length)}if(n.line==t.to.line+r)return Nn(n,Ri(t.text).length+(t.text.length==1?t.from.ch:0)+ni(e,t.to.line).text.length-t.to.ch);var o=n.line-t.from.line;return Nn(n,t.text[o].length+(o?0:t.from.ch))}function ln(e,t,n){if(n&&typeof n=="object")return{anchor:fn(e,t,n.anchor),head:fn(e,t,n.head)};if(n=="start")return{anchor:t.from,head:t.from};var r=an(t);if(n=="around")return{anchor:t.from,head:r};if(n=="end")return{anchor:r,head:r};var i=function(e){if(En(e,t.from))return e;if(!En(t.to,e))return r;var n=e.line+t.text.length-(t.to.line-t.from.line)-1,i=e.ch;if(e.line==t.to.line)i+=r.ch-t.to.ch;return bn(n,i)};return{anchor:i(e.sel.anchor),head:i(e.sel.head)}}function cn(e,t){var n={canceled:false,from:t.from,to:t.to,text:t.text,origin:t.origin,update:function(t,n,r,i){if(t)this.from=Tn(e,t);if(n)this.to=Tn(e,n);if(r)this.text=r;if(i!==undefined)this.origin=i},cancel:function(){this.canceled=true}};Ai(e,"beforeChange",e,n);if(e.cm)Ai(e.cm,"beforeChange",e.cm,n);if(n.canceled)return null;return{from:n.from,to:n.to,text:n.text,origin:n.origin}}function hn(e,t,n,r){if(e.cm){if(!e.cm.curOp)return Nt(e.cm,hn)(e,t,n,r);if(e.cm.state.suppressEdits)return}if(Pi(e,"beforeChange")||e.cm&&Pi(e.cm,"beforeChange")){t=cn(e,t);if(!t)return}var i=w&&!r&&yr(e,t.from,t.to);if(i){for(var s=i.length-1;s>=1;--s)pn(e,{from:i[s].from,to:i[s].to,text:[""]});if(i.length)pn(e,{from:i[0].from,to:i[0].to,text:t.text},n)}else{pn(e,t,n)}}function pn(e,t,n){var r=ln(e,t,n);pi(e,t,r,e.cm?e.cm.curOp.id:NaN);mn(e,t,r,mr(e,t));var i=[];ei(e,function(e,n){if(!n&&zi(i,e.history)==-1){bi(e.history,t);i.push(e.history)}mn(e,t,null,mr(e,t))})}function dn(e,t){if(e.cm&&e.cm.state.suppressEdits)return;var n=e.history;var r=(t=="undo"?n.done:n.undone).pop();if(!r)return;n.dirtyCounter+=t=="undo"?-1:1;var i={changes:[],anchorBefore:r.anchorAfter,headBefore:r.headAfter,anchorAfter:r.anchorBefore,headAfter:r.headBefore};(t=="undo"?n.undone:n.done).push(i);for(var s=r.changes.length-1;s>=0;--s){var o=r.changes[s];o.origin=t;i.changes.push(hi(e,o));var u=s?ln(e,o,null):{anchor:r.anchorBefore,head:r.headBefore};mn(e,o,u,gr(e,o));var a=[];ei(e,function(e,t){if(!t&&zi(a,e.history)==-1){bi(e.history,o);a.push(e.history)}mn(e,o,null,gr(e,o))})}}function vn(e,t){function n(e){return bn(e.line+t,e.ch)}e.first+=t;if(e.cm)Lt(e.cm,e.first,e.first,t);e.sel.head=n(e.sel.head);e.sel.anchor=n(e.sel.anchor);e.sel.from=n(e.sel.from);e.sel.to=n(e.sel.to)}function mn(e,t,n,r){if(e.cm&&!e.cm.curOp)return Nt(e.cm,mn)(e,t,n,r);if(t.to.line<e.first){vn(e,t.text.length-1-(t.to.line-t.from.line));return}if(t.from.line>e.lastLine())return;if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);vn(e,i);t={from:bn(e.first,0),to:bn(t.to.line+i,t.to.ch),text:[Ri(t.text)],origin:t.origin}}var s=e.lastLine();if(t.to.line>s){t={from:t.from,to:bn(s,ni(e,s).text.length),text:[t.text[0]],origin:t.origin}}t.removed=ri(e,t.from,t.to);if(!n)n=ln(e,t,null);if(e.cm)gn(e.cm,t,r,n);else $r(e,t,r,n)}function gn(e,t,n,r){var i=e.doc,s=e.display,o=t.from,u=t.to;var a=false,f=o.line;if(!e.options.lineWrapping){f=oi(Sr(i,ni(i,o.line)));i.iter(f,u.line+1,function(e){if(e==s.maxLine){a=true;return true}})}$r(i,t,n,r,C(e));if(!e.options.lineWrapping){i.iter(f,o.line+t.text.length,function(e){var t=_(i,e);if(t>s.maxLineLength){s.maxLine=e;s.maxLineLength=t;s.maxLineChanged=true;a=false}});if(a)e.curOp.updateMaxLine=true}i.frontier=Math.min(i.frontier,o.line);Z(e,400);var l=t.text.length-(u.line-o.line)-1;Lt(e,o.line,u.line+1,l);if(Pi(e,"change")){var c={from:o,to:u,text:t.text,removed:t.removed,origin:t.origin};if(e.curOp.textChanged){for(var h=e.curOp.textChanged;h.next;h=h.next){}h.next=c}else e.curOp.textChanged=c}}function yn(e,t,n,r,i){if(!r)r=n;if(En(r,n)){var s=r;r=n;n=s}if(typeof t=="string")t=fs(t);hn(e,{from:n,to:r,text:t,origin:i},null)}function bn(e,t){if(!(this instanceof bn))return new bn(e,t);this.line=e;this.ch=t}function wn(e,t){return e.line==t.line&&e.ch==t.ch}function En(e,t){return e.line<t.line||e.line==t.line&&e.ch<t.ch}function Sn(e){return bn(e.line,e.ch)}function xn(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function Tn(e,t){if(t.line<e.first)return bn(e.first,0);var n=e.first+e.size-1;if(t.line>n)return bn(n,ni(e,n).text.length);return Nn(t,ni(e,t.line).text.length)}function Nn(e,t){var n=e.ch;if(n==null||n>t)return bn(e.line,t);else if(n<0)return bn(e.line,0);else return e}function Cn(e,t){return t>=e.first&&t<e.first+e.size}function kn(e,t,n,r){if(e.sel.shift||e.sel.extend){var i=e.sel.anchor;if(n){var s=En(t,i);if(s!=En(n,i)){i=t;t=n}else if(s!=En(t,n)){t=n}}An(e,i,t,r)}else{An(e,t,n||t,r)}if(e.cm)e.cm.curOp.userSelChange=true}function Ln(e,t,n){var r={anchor:t,head:n};Ai(e,"beforeSelectionChange",e,r);if(e.cm)Ai(e.cm,"beforeSelectionChange",e.cm,r);r.anchor=Tn(e,r.anchor);r.head=Tn(e,r.head);return r}function An(e,t,n,r,i){if(!i&&Pi(e,"beforeSelectionChange")||e.cm&&Pi(e.cm,"beforeSelectionChange")){var s=Ln(e,t,n);n=s.head;t=s.anchor}var o=e.sel;o.goalColumn=null;if(i||!wn(t,o.anchor))t=Mn(e,t,r,i!="push");if(i||!wn(n,o.head))n=Mn(e,n,r,i!="push");if(wn(o.anchor,t)&&wn(o.head,n))return;o.anchor=t;o.head=n;var u=En(n,t);o.from=u?n:t;o.to=u?t:n;if(e.cm)e.cm.curOp.updateInput=e.cm.curOp.selectionChanged=true;_i(e,"cursorActivity",e)}function On(e){An(e.doc,e.doc.sel.from,e.doc.sel.to,null,"push")}function Mn(e,t,n,r){var i=false,s=t;var o=n||1;e.cantEdit=false;e:for(;;){var u=ni(e,s.line);if(u.markedSpans){for(var a=0;a<u.markedSpans.length;++a){var f=u.markedSpans[a],l=f.marker;if((f.from==null||(l.inclusiveLeft?f.from<=s.ch:f.from<s.ch))&&(f.to==null||(l.inclusiveRight?f.to>=s.ch:f.to>s.ch))){if(r){Ai(l,"beforeCursorEnter");if(l.explicitlyCleared){if(!u.markedSpans)break;else{--a;continue}}}if(!l.atomic)continue;var c=l.find()[o<0?"from":"to"];if(wn(c,s)){c.ch+=o;if(c.ch<0){if(c.line>e.first)c=Tn(e,bn(c.line-1));else c=null}else if(c.ch>u.text.length){if(c.line<e.first+e.size-1)c=bn(c.line+1,0);else c=null}if(!c){if(i){if(!r)return Mn(e,t,n,true);e.cantEdit=true;return bn(e.first,0)}i=true;c=t;o=-o}}s=c;continue e}}}return s}}function _n(e){var t=Dn(e,e.doc.sel.head);if(!e.state.focused)return;var n=e.display,r=ns(n.sizer),i=null,s=rt(e.display);if(t.top+s+r.top<0)i=true;else if(t.bottom+s+r.top>(window.innerHeight||document.documentElement.clientHeight))i=false;if(i!=null&&!h){var o=n.cursor.style.display=="none";if(o){n.cursor.style.display="";n.cursor.style.left=t.left+"px";n.cursor.style.top=t.top-n.viewOffset+"px"}n.cursor.scrollIntoView(i);if(o)n.cursor.style.display="none"}}function Dn(e,t,n){if(n==null)n=0;for(;;){var r=false,i=vt(e,t);var s=Hn(e,i.left,i.top-n,i.left,i.bottom+n);var o=e.doc.scrollTop,u=e.doc.scrollLeft;if(s.scrollTop!=null){Wt(e,s.scrollTop);if(Math.abs(e.doc.scrollTop-o)>1)r=true}if(s.scrollLeft!=null){Xt(e,s.scrollLeft);if(Math.abs(e.doc.scrollLeft-u)>1)r=true}if(!r)return i}}function Pn(e,t,n,r,i){var s=Hn(e,t,n,r,i);if(s.scrollTop!=null)Wt(e,s.scrollTop);if(s.scrollLeft!=null)Xt(e,s.scrollLeft)}function Hn(e,t,n,r,i){var s=e.display,o=rt(s);n+=o;i+=o;var u=s.scroller.clientHeight-Hi,a=s.scroller.scrollTop,f={};var l=e.doc.height+it(s);var c=n<o+10,h=i+o>l-10;if(n<a)f.scrollTop=c?0:Math.max(0,n);else if(i>a+u)f.scrollTop=(h?l:i)-u;var p=s.scroller.clientWidth-Hi,d=s.scroller.scrollLeft;t+=s.gutters.offsetWidth;r+=s.gutters.offsetWidth;var v=s.gutters.offsetWidth;var m=t<v+10;if(t<d+v||m){if(m)t=0;f.scrollLeft=Math.max(0,t-10-v)}else if(r>p+d-3){f.scrollLeft=r+10-p}return f}function Bn(e,t,n){e.curOp.updateScrollPos={scrollLeft:t,scrollTop:n}}function jn(e,t,n){var r=e.curOp.updateScrollPos||(e.curOp.updateScrollPos={scrollLeft:e.doc.scrollLeft,scrollTop:e.doc.scrollTop});var i=e.display.scroller;r.scrollTop=Math.max(0,Math.min(i.scrollHeight-i.clientHeight,r.scrollTop+n));r.scrollLeft=Math.max(0,Math.min(i.scrollWidth-i.clientWidth,r.scrollLeft+t))}function Fn(e,t,n,r){var i=e.doc;if(!n)n="add";if(n=="smart"){if(!e.doc.mode.indent)n="prev";else var s=nt(e,t)}var o=e.options.tabSize;var u=ni(i,t),a=Fi(u.text,null,o);var f=u.text.match(/^\s*/)[0],l;if(n=="smart"){l=e.doc.mode.indent(s,u.text.slice(f.length),u.text);if(l==Bi){if(!r)return;n="prev"}}if(n=="prev"){if(t>i.first)l=Fi(ni(i,t-1).text,null,o);else l=0}else if(n=="add"){l=a+e.options.indentUnit}else if(n=="subtract"){l=a-e.options.indentUnit}l=Math.max(0,l);var c="",h=0;if(e.options.indentWithTabs)for(var p=Math.floor(l/o);p;--p){h+=o;c+="	"}if(h<l)c+=qi(l-h);if(c!=f)yn(e.doc,c,bn(t,0),bn(t,f.length),"+input");u.stateAfter=null}function In(e,t,n){var r=t,i=t,s=e.doc;if(typeof t=="number")i=ni(s,xn(s,t));else r=oi(t);if(r==null)return null;if(n(i,r))Lt(e,r,r+1);else return null;return i}function qn(e,t,n,r,i){function f(){var t=s+n;if(t<e.first||t>=e.first+e.size)return a=false;s=t;return u=ni(e,t)}function l(e){var t=(i?ws:Es)(u,o,n,true);if(t==null){if(!e&&f()){if(i)o=(n<0?gs:ms)(u);else o=n<0?u.text.length:0}else return a=false}else o=t;return true}var s=t.line,o=t.ch;var u=ni(e,s);var a=true;if(r=="char")l();else if(r=="column")l(true);else if(r=="word"||r=="group"){var c=null,h=r=="group";for(var p=true;;p=false){if(n<0&&!l(!p))break;var d=u.text.charAt(o)||"\n";var v=Ki(d)?"w":!h?null:/\s/.test(d)?null:"p";if(c&&c!=v){if(n<0){n=1;l()}break}if(v)c=v;if(n>0&&!l(!p))break}}var m=Mn(e,bn(s,o),n,true);if(!a)m.hitSide=true;return m}function Rn(e,t,n,r){var i=e.doc,s=t.left,o;if(r=="page"){var u=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);o=t.top+n*(u-(n<0?1.5:.5)*wt(e.display))}else if(r=="line"){o=n>0?t.bottom+3:t.top-3}for(;;){var a=gt(e,s,o);if(!a.outside)break;if(n<0?o<=0:o>=i.height){a.hitSide=true;break}o+=n*5}return a}function Un(e,t){var n=t.ch,r=t.ch;if(e){if(t.after===false||r==e.length)--n;else++r;var i=e.charAt(n);var s=Ki(i)?Ki:/\s/.test(i)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!Ki(e)};while(n>0&&s(e.charAt(n-1)))--n;while(r<e.length&&s(e.charAt(r)))++r}return{from:bn(t.line,n),to:bn(t.line,r)}}function zn(e,t){kn(e.doc,bn(t,0),Tn(e.doc,bn(t+1,0)))}function Vn(e,t,n,r){S.defaults[e]=t;if(n)Wn[e]=r?function(e,t,r){if(r!=$n)n(e,t,r)}:n}function Yn(e,t){if(t===true)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];if(i instanceof Array)i=i.concat([]);n[r]=i}return n}function Zn(e,t,n){return e.startState?e.startState(t,n):true}function nr(e){if(typeof e=="string")return tr[e];else return e}function rr(e,t,n){function r(t){t=nr(t);var i=t[e];if(i===false)return"stop";if(i!=null&&n(i))return true;if(t.nofallthrough)return"stop";var s=t.fallthrough;if(s==null)return false;if(Object.prototype.toString.call(s)!="[object Array]")return r(s);for(var o=0,u=s.length;o<u;++o){var a=r(s[o]);if(a)return a}return false}for(var i=0;i<t.length;++i){var s=r(t[i]);if(s)return s}}function ir(e){var t=hs[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function sr(e,t){var n=hs[e.keyCode];if(n==null||e.altGraphKey)return false;if(e.altKey)n="Alt-"+n;if(y?e.metaKey:e.ctrlKey)n="Ctrl-"+n;if(y?e.ctrlKey:e.metaKey)n="Cmd-"+n;if(!t&&e.shiftKey)n="Shift-"+n;return n}function or(e,t){this.pos=this.start=0;this.string=e;this.tabSize=t||8;this.lastColumnPos=this.lastColumnValue=0}function ur(e,t){this.lines=[];this.type=t;this.doc=e}function ar(e,t,n,r,i){if(r&&r.shared)return lr(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return Nt(e.cm,ar)(e,t,n,r,i);var s=new ur(e,i);if(i=="range"&&!En(t,n))return s;if(r)Xi(r,s);if(s.replacedWith){s.collapsed=true;s.replacedWith=Yi("span",[s.replacedWith],"CodeMirror-widget")}if(s.collapsed)E=true;var o=t.line,u=0,a,f,l=e.cm,c;e.iter(o,n.line+1,function(r){if(l&&s.collapsed&&!l.options.lineWrapping&&Sr(e,r)==l.display.maxLine)c=true;var i={from:null,to:null,marker:s};u+=r.text.length;if(o==t.line){i.from=t.ch;u-=t.ch}if(o==n.line){i.to=n.ch;u-=r.text.length-n.ch}if(s.collapsed){if(o==n.line)f=br(r,n.ch);if(o==t.line)a=br(r,t.ch);else si(r,0)}pr(r,i);++o});if(s.collapsed)e.iter(t.line,n.line+1,function(t){if(xr(e,t))si(t,0)});if(s.clearOnEnter)ki(s,"beforeCursorEnter",function(){s.clear()});if(s.readOnly){w=true;if(e.history.done.length||e.history.undone.length)e.clearHistory()}if(s.collapsed){if(a!=f)throw new Error("Inserting collapsed marker overlapping an existing one");s.size=u;s.atomic=true}if(l){if(c)l.curOp.updateMaxLine=true;if(s.className||s.startStyle||s.endStyle||s.collapsed)Lt(l,t.line,n.line+1);if(s.atomic)On(l)}return s}function fr(e,t){this.markers=e;this.primary=t;for(var n=0,r=this;n<e.length;++n){e[n].parent=this;ki(e[n],"clear",function(){r.clear()})}}function lr(e,t,n,r,i){r=Xi(r);r.shared=false;var s=[ar(e,t,n,r,i)],o=s[0];var u=r.replacedWith;ei(e,function(e){if(u)r.replacedWith=u.cloneNode(true);s.push(ar(e,Tn(e,t),Tn(e,n),r,i));for(var a=0;a<e.linked.length;++a)if(e.linked[a].isParent)return;o=Ri(s)});return new fr(s,o)}function cr(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function hr(e,t){for(var n,r=0;r<e.length;++r)if(e[r]!=t)(n||(n=[])).push(e[r]);return n}function pr(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t];t.marker.attachLine(e)}function dr(e,t,n){if(e)for(var r=0,i;r<e.length;++r){var s=e[r],o=s.marker;var u=s.from==null||(o.inclusiveLeft?s.from<=t:s.from<t);if(u||o.type=="bookmark"&&s.from==t&&(!n||!s.marker.insertLeft)){var a=s.to==null||(o.inclusiveRight?s.to>=t:s.to>t);(i||(i=[])).push({from:s.from,to:a?null:s.to,marker:o})}}return i}function vr(e,t,n){if(e)for(var r=0,i;r<e.length;++r){var s=e[r],o=s.marker;var u=s.to==null||(o.inclusiveRight?s.to>=t:s.to>t);if(u||o.type=="bookmark"&&s.from==t&&(!n||s.marker.insertLeft)){var a=s.from==null||(o.inclusiveLeft?s.from<=t:s.from<t);(i||(i=[])).push({from:a?null:s.from-t,to:s.to==null?null:s.to-t,marker:o})}}return i}function mr(e,t){var n=Cn(e,t.from.line)&&ni(e,t.from.line).markedSpans;var r=Cn(e,t.to.line)&&ni(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,s=t.to.ch,o=wn(t.from,t.to);var u=dr(n,i,o);var a=vr(r,s,o);var f=t.text.length==1,l=Ri(t.text).length+(f?i:0);if(u){for(var c=0;c<u.length;++c){var h=u[c];if(h.to==null){var p=cr(a,h.marker);if(!p)h.to=i;else if(f)h.to=p.to==null?null:p.to+l}}}if(a){for(var c=0;c<a.length;++c){var h=a[c];if(h.to!=null)h.to+=l;if(h.from==null){var p=cr(u,h.marker);if(!p){h.from=l;if(f)(u||(u=[])).push(h)}}else{h.from+=l;if(f)(u||(u=[])).push(h)}}}var d=[u];if(!f){var v=t.text.length-2,m;if(v>0&&u)for(var c=0;c<u.length;++c)if(u[c].to==null)(m||(m=[])).push({from:null,to:null,marker:u[c].marker});for(var c=0;c<v;++c)d.push(m);d.push(a)}return d}function gr(e,t){var n=vi(e,t);var r=mr(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var s=n[i],o=r[i];if(s&&o){e:for(var u=0;u<o.length;++u){var a=o[u];for(var f=0;f<s.length;++f)if(s[f].marker==a.marker)continue e;s.push(a)}}else if(o){n[i]=o}}return n}function yr(e,t,n){var r=null;e.iter(t.line,n.line+1,function(e){if(e.markedSpans)for(var t=0;t<e.markedSpans.length;++t){var n=e.markedSpans[t].marker;if(n.readOnly&&(!r||zi(r,n)==-1))(r||(r=[])).push(n)}});if(!r)return null;var i=[{from:t,to:n}];for(var s=0;s<r.length;++s){var o=r[s],u=o.find();for(var a=0;a<i.length;++a){var f=i[a];if(En(f.to,u.from)||En(u.to,f.from))continue;var l=[a,1];if(En(f.from,u.from)||!o.inclusiveLeft&&wn(f.from,u.from))l.push({from:f.from,to:u.from});if(En(u.to,f.to)||!o.inclusiveRight&&wn(f.to,u.to))l.push({from:u.to,to:f.to});i.splice.apply(i,l);a+=l.length-1}}return i}function br(e,t){var n=E&&e.markedSpans,r;if(n)for(var i,s=0;s<n.length;++s){i=n[s];if(!i.marker.collapsed)continue;if((i.from==null||i.from<t)&&(i.to==null||i.to>t)&&(!r||r.width<i.marker.width))r=i.marker}return r}function wr(e){return br(e,-1)}function Er(e){return br(e,e.text.length+1)}function Sr(e,t){var n;while(n=wr(t))t=ni(e,n.find().from.line);return t}function xr(e,t){var n=E&&t.markedSpans;if(n)for(var r,i=0;i<n.length;++i){r=n[i];if(!r.marker.collapsed)continue;if(r.from==null)return true;if(r.from==0&&r.marker.inclusiveLeft&&Tr(e,t,r))return true}}function Tr(e,t,n){if(n.to==null){var r=n.marker.find().to,i=ni(e,r.line);return Tr(e,i,cr(i.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return true;for(var s,o=0;o<t.markedSpans.length;++o){s=t.markedSpans[o];if(s.marker.collapsed&&s.from==n.to&&(s.marker.inclusiveLeft||n.marker.inclusiveRight)&&Tr(e,t,s))return true}}function Nr(e){var t=e.markedSpans;if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}function Cr(e,t){if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}function Lr(e){return function(){var t=!this.cm.curOp;if(t)xt(this.cm);try{var n=e.apply(this,arguments)}finally{if(t)Tt(this.cm)}return n}}function Ar(e){if(e.height!=null)return e.height;if(!e.node.parentNode||e.node.parentNode.nodeType!=1)es(e.cm.display.measure,Yi("div",[e.node],null,"position: relative"));return e.height=e.node.offsetHeight}function Or(e,t,n,r){var i=new kr(e,n,r);if(i.noHScroll)e.display.alignWidgets=true;In(e,t,function(t){(t.widgets||(t.widgets=[])).push(i);i.line=t;if(!xr(e.doc,t)||i.showIfHidden){var n=ai(e,t)<e.display.scroller.scrollTop;si(t,t.height+Ar(i));if(n)jn(e,0,i.height)}return true});return i}function Mr(e,t,n){var r={text:e};Cr(r,t);r.height=n?n(r):1;return r}function _r(e,t,n,r){e.text=t;if(e.stateAfter)e.stateAfter=null;if(e.styles)e.styles=null;if(e.order!=null)e.order=null;Nr(e);Cr(e,n);var i=r?r(e):1;if(i!=e.height)si(e,i)}function Dr(e){e.parent=null;Nr(e)}function Pr(e,t,n,r,i){var s=n.flattenSpans;if(s==null)s=e.options.flattenSpans;var o="",u=null;var a=new or(t,e.options.tabSize);if(t==""&&n.blankLine)n.blankLine(r);while(!a.eol()){var f=n.token(a,r);if(a.pos>5e3){s=false;a.pos=Math.min(t.length,a.start+5e4);f=null}var l=a.current();a.start=a.pos;if(!s||u!=f){if(o)i(o,u);o=l;u=f}else o=o+l}if(o)i(o,u)}function Hr(e,t,n){var r=[e.state.modeGen];Pr(e,t.text,e.doc.mode,n,function(e,t){r.push(e,t)});for(var i=0;i<e.state.overlays.length;++i){var s=e.state.overlays[i],o=1;Pr(e,t.text,s.mode,true,function(e,t){var n=o,i=e.length;while(i){var u=r[o],a=u.length;if(a<=i){i-=a}else{r.splice(o,1,u.slice(0,i),r[o+1],u.slice(i));i=0}o+=2}if(!t)return;if(s.opaque){r.splice(n,o-n,e,t);o=n+2}else{for(;n<o;n+=2){var u=r[n+1];r[n+1]=u?u+" "+t:t}}})}return r}function Br(e,t){if(!t.styles||t.styles[0]!=e.state.modeGen)t.styles=Hr(e,t,t.stateAfter=nt(e,oi(t)));return t.styles}function jr(e,t,n){var r=e.doc.mode;var i=new or(t.text,e.options.tabSize);if(t.text==""&&r.blankLine)r.blankLine(n);while(!i.eol()&&i.pos<=5e3){r.token(i,n);i.start=i.pos}}function Ir(e){if(!e)return null;return Fr[e]||(Fr[e]="cm-"+e.replace(/ +/g," cm-"))}function qr(e,n,r){var s,o=n,u,a,f=true;while(s=wr(o)){f=false;o=ni(e.doc,s.find().from.line);if(!u)u=o}var l={pre:Yi("pre"),col:0,pos:0,display:!r,measure:null,addedOne:false,cm:e};if(o.textClass)l.pre.className=o.textClass;do{l.measure=o==n&&r;l.pos=0;l.addToken=l.measure?zr:Ur;if((t||i)&&e.getOption("lineWrapping"))l.addToken=Wr(l.addToken);if(r&&a&&o!=n&&!l.addedOne){r[0]=l.pre.appendChild(as(e.display.measure));l.addedOne=true}var c=Vr(o,l,Br(e,o));a=o==u;if(c){o=ni(e.doc,c.to.line);f=false}}while(c);if(r&&!l.addedOne)r[0]=l.pre.appendChild(f?Yi("span"," "):as(e.display.measure));if(!l.pre.firstChild&&!xr(e.doc,n))l.pre.appendChild(document.createTextNode(" "));var h;if(r&&t&&(h=fi(o))){var p=h.length-1;if(h[p].from==h[p].to)--p;var d=h[p],v=h[p-1];if(d.from+1==d.to&&v&&d.level<v.level){var m=r[l.pos-1];if(m)m.parentNode.insertBefore(m.measureRight=as(e.display.measure),m.nextSibling)}}Ai(e,"renderLine",e,n,l.pre);return l.pre}function Ur(e,t,n,r,i){if(!t)return;if(!Rr.test(t)){e.col+=t.length;var s=document.createTextNode(t)}else{var s=document.createDocumentFragment(),o=0;while(true){Rr.lastIndex=o;var u=Rr.exec(t);var a=u?u.index-o:t.length-o;if(a){s.appendChild(document.createTextNode(t.slice(o,o+a)));e.col+=a}if(!u)break;o+=a+1;if(u[0]=="	"){var f=e.cm.options.tabSize,l=f-e.col%f;s.appendChild(Yi("span",qi(l),"cm-tab"));e.col+=l}else{var c=Yi("span","•","cm-invalidchar");c.title="\\u"+u[0].charCodeAt(0).toString(16);s.appendChild(c);e.col+=1}}}if(n||r||i||e.measure){var h=n||"";if(r)h+=r;if(i)h+=i;return e.pre.appendChild(Yi("span",[s],h))}e.pre.appendChild(s)}function zr(e,n,r,i,s){var o=e.cm.options.lineWrapping;for(var u=0;u<n.length;++u){var a=n.charAt(u),f=u==0;if(a>="�"&&a<"�"&&u<n.length-1){a=n.slice(u,u+2);++u}else if(u&&o&&is.test(n.slice(u-1,u+1))){e.pre.appendChild(Yi("wbr"))}var l=e.measure[e.pos]=Ur(e,a,r,f&&i,u==n.length-1&&s);if(t&&o&&a==" "&&u&&!/\s/.test(n.charAt(u-1))&&u<n.length-1&&!/\s/.test(n.charAt(u+1)))l.style.whiteSpace="normal";e.pos+=a.length}if(n.length)e.addedOne=true}function Wr(e){function t(e){var t=" ";for(var n=0;n<e.length-2;++n)t+=n%2?" ":" ";t+=" ";return t}return function(n,r,i,s,o){return e(n,r.replace(/ {3,}/,t),i,s,o)}}function Xr(e,t,n){if(n){if(!e.display)n=n.cloneNode(true);e.pre.appendChild(n);if(e.measure&&t){e.measure[e.pos]=n;e.addedOne=true}}e.pos+=t}function Vr(e,t,n){var r=e.markedSpans;if(!r){for(var i=1;i<n.length;i+=2)t.addToken(t,n[i],Ir(n[i+1]));return}var s=e.text,o=s.length;var u=0,i=1,a="",f;var l=0,c,h,p,d;for(;;){if(l==u){c=h=p="";d=null;l=Infinity;var v=null;for(var m=0;m<r.length;++m){var g=r[m],y=g.marker;if(g.from<=u&&(g.to==null||g.to>u)){if(g.to!=null&&l>g.to){l=g.to;h=""}if(y.className)c+=" "+y.className;if(y.startStyle&&g.from==u)p+=" "+y.startStyle;if(y.endStyle&&g.to==l)h+=" "+y.endStyle;if(y.collapsed&&(!d||d.marker.width<y.width))d=g}else if(g.from>u&&l>g.from){l=g.from}if(y.type=="bookmark"&&g.from==u&&y.replacedWith)v=y.replacedWith}if(d&&(d.from||0)==u){Xr(t,(d.to==null?o:d.to)-u,d.from!=null&&d.marker.replacedWith);if(d.to==null)return d.marker.find()}if(v&&!d)Xr(t,0,v)}if(u>=o)break;var b=Math.min(o,l);while(true){if(a){var w=u+a.length;if(!d){var E=w>b?a.slice(0,b-u):a;t.addToken(t,E,f?f+c:c,p,u+E.length==l?h:"")}if(w>=b){a=a.slice(b-u);u=b;break}u=w;p=""}a=n[i++];f=Ir(n[i++])}}}function $r(e,t,n,r,i){function s(e){return n?n[e]:null}function o(e,n,r){_r(e,n,r,i);_i(e,"change",e,t)}var u=t.from,a=t.to,f=t.text;var l=ni(e,u.line),c=ni(e,a.line);var h=Ri(f),p=s(f.length-1),d=a.line-u.line;if(u.ch==0&&a.ch==0&&h==""){for(var v=0,m=f.length-1,g=[];v<m;++v)g.push(Mr(f[v],s(v),i));o(c,c.text,p);if(d)e.remove(u.line,d);if(g.length)e.insert(u.line,g)}else if(l==c){if(f.length==1){o(l,l.text.slice(0,u.ch)+h+l.text.slice(a.ch),p)}else{for(var g=[],v=1,m=f.length-1;v<m;++v)g.push(Mr(f[v],s(v),i));g.push(Mr(h+l.text.slice(a.ch),p,i));o(l,l.text.slice(0,u.ch)+f[0],s(0));e.insert(u.line+1,g)}}else if(f.length==1){o(l,l.text.slice(0,u.ch)+f[0]+c.text.slice(a.ch),s(0));e.remove(u.line+1,d)}else{o(l,l.text.slice(0,u.ch)+f[0],s(0));o(c,h+c.text.slice(a.ch),p);for(var v=1,m=f.length-1,g=[];v<m;++v)g.push(Mr(f[v],s(v),i));if(d>1)e.remove(u.line+1,d-1);e.insert(u.line+1,g)}_i(e,"change",e,t);An(e,r.anchor,r.head,null,true)}function Jr(e){this.lines=e;this.parent=null;for(var t=0,n=e.length,r=0;t<n;++t){e[t].parent=this;r+=e[t].height}this.height=r}function Kr(e){this.children=e;var t=0,n=0;for(var r=0,i=e.length;r<i;++r){var s=e[r];t+=s.chunkSize();n+=s.height;s.parent=this}this.size=t;this.height=n;this.parent=null}function ei(e,t,n){function r(e,i,s){if(e.linked)for(var o=0;o<e.linked.length;++o){var u=e.linked[o];if(u.doc==i)continue;var a=s&&u.sharedHist;if(n&&!a)continue;t(u.doc,a);r(u.doc,e,a)}}r(e,null,true)}function ti(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t;t.cm=e;k(e);T(e);if(!e.options.lineWrapping)D(e);e.options.mode=t.modeOption;Lt(e)}function ni(e,t){t-=e.first;while(!e.lines){for(var n=0;;++n){var r=e.children[n],i=r.chunkSize();if(t<i){e=r;break}t-=i}}return e.lines[t]}function ri(e,t,n){var r=[],i=t.line;e.iter(t.line,n.line+1,function(e){var s=e.text;if(i==n.line)s=s.slice(0,n.ch);if(i==t.line)s=s.slice(t.ch);r.push(s);++i});return r}function ii(e,t,n){var r=[];e.iter(t,n,function(e){r.push(e.text)});return r}function si(e,t){var n=t-e.height;for(var r=e;r;r=r.parent)r.height+=n}function oi(e){if(e.parent==null)return null;var t=e.parent,n=zi(t.lines,e);for(var r=t.parent;r;t=r,r=r.parent){for(var i=0;;++i){if(r.children[i]==t)break;n+=r.children[i].chunkSize()}}return n+t.first}function ui(e,t){var n=e.first;e:do{for(var r=0,i=e.children.length;r<i;++r){var s=e.children[r],o=s.height;if(t<o){e=s;continue e}t-=o;n+=s.chunkSize()}return n}while(!e.lines);for(var r=0,i=e.lines.length;r<i;++r){var u=e.lines[r],a=u.height;if(t<a)break;t-=a}return n+r}function ai(e,t){t=Sr(e.doc,t);var n=0,r=t.parent;for(var i=0;i<r.lines.length;++i){var s=r.lines[i];if(s==t)break;else n+=s.height}for(var o=r.parent;o;r=o,o=r.parent){for(var i=0;i<o.children.length;++i){var u=o.children[i];if(u==r)break;else n+=u.height}}return n}function fi(e){var t=e.order;if(t==null)t=e.order=Ss(e.text);return t}function li(){return{done:[],undone:[],undoDepth:Infinity,lastTime:0,lastOp:null,lastOrigin:null,dirtyCounter:0}}function ci(e,t,n,r){var i=t["spans_"+e.id],s=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(n){if(n.markedSpans)(i||(i=t["spans_"+e.id]={}))[s]=n.markedSpans;++s})}function hi(e,t){var n={from:t.from,to:an(t),text:ri(e,t.from,t.to)};ci(e,n,t.from.line,t.to.line+1);ei(e,function(e){ci(e,n,t.from.line,t.to.line+1)},true);return n}function pi(e,t,n,r){var i=e.history;i.undone.length=0;var s=+(new Date),o=Ri(i.done);if(o&&(i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastTime>s-600||t.origin.charAt(0)=="*"))){var u=Ri(o.changes);if(wn(t.from,t.to)&&wn(t.from,u.to)){u.to=an(t)}else{o.changes.push(hi(e,t))}o.anchorAfter=n.anchor;o.headAfter=n.head}else{o={changes:[hi(e,t)],anchorBefore:e.sel.anchor,headBefore:e.sel.head,anchorAfter:n.anchor,headAfter:n.head};i.done.push(o);while(i.done.length>i.undoDepth)i.done.shift();if(i.dirtyCounter<0)i.dirtyCounter=NaN;else i.dirtyCounter++}i.lastTime=s;i.lastOp=r;i.lastOrigin=t.origin}function di(e){if(!e)return null;for(var t=0,n;t<e.length;++t){if(e[t].marker.explicitlyCleared){if(!n)n=e.slice(0,t)}else if(n)n.push(e[t])}return!n?e:n.length?n:null}function vi(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var r=0,i=[];r<t.text.length;++r)i.push(di(n[r]));return i}function mi(e,t){for(var n=0,r=[];n<e.length;++n){var i=e[n],s=i.changes,o=[];r.push({changes:o,anchorBefore:i.anchorBefore,headBefore:i.headBefore,anchorAfter:i.anchorAfter,headAfter:i.headAfter});for(var u=0;u<s.length;++u){var a=s[u],f;o.push({from:a.from,to:a.to,text:a.text});if(t)for(var l in a)if(f=l.match(/^spans_(\d+)$/)){if(zi(t,Number(f[1]))>-1){Ri(o)[l]=a[l];delete a[l]}}}}return r}function gi(e,t,n,r){if(n<e.line){e.line+=r}else if(t<e.line){e.line=t;e.ch=0}}function yi(e,t,n,r){for(var i=0;i<e.length;++i){var s=e[i],o=true;for(var u=0;u<s.changes.length;++u){var a=s.changes[u];if(!s.copied){a.from=Sn(a.from);a.to=Sn(a.to)}if(n<a.from.line){a.from.line+=r;a.to.line+=r}else if(t<=a.to.line){o=false;break}}if(!s.copied){s.anchorBefore=Sn(s.anchorBefore);s.headBefore=Sn(s.headBefore);s.anchorAfter=Sn(s.anchorAfter);s.readAfter=Sn(s.headAfter);s.copied=true}if(!o){e.splice(0,i+1);i=0}else{gi(s.anchorBefore);gi(s.headBefore);gi(s.anchorAfter);gi(s.headAfter)}}}function bi(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;yi(e.done,n,r,i);yi(e.undone,n,r,i)}function wi(){Ti(this)}function Ei(e){if(!e.stop)e.stop=wi;return e}function Si(e){if(e.preventDefault)e.preventDefault();else e.returnValue=false}function xi(e){if(e.stopPropagation)e.stopPropagation();else e.cancelBubble=true}function Ti(e){Si(e);xi(e)}function Ni(e){return e.target||e.srcElement}function Ci(e){var t=e.which;if(t==null){if(e.button&1)t=1;else if(e.button&2)t=3;else if(e.button&4)t=2}if(v&&e.ctrlKey&&t==1)t=3;return t}function ki(e,t,n){if(e.addEventListener)e.addEventListener(t,n,false);else if(e.attachEvent)e.attachEvent("on"+t,n);else{var r=e._handlers||(e._handlers={});var i=r[t]||(r[t]=[]);i.push(n)}}function Li(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,false);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var r=e._handlers&&e._handlers[t];if(!r)return;for(var i=0;i<r.length;++i)if(r[i]==n){r.splice(i,1);break}}}function Ai(e,t){var n=e._handlers&&e._handlers[t];if(!n)return;var r=Array.prototype.slice.call(arguments,2);for(var i=0;i<n.length;++i)n[i].apply(null,r)}function _i(e,t){function i(e){return function(){e.apply(null,r)}}var n=e._handlers&&e._handlers[t];if(!n)return;var r=Array.prototype.slice.call(arguments,2);if(!Oi){++Mi;Oi=[];setTimeout(Di,0)}for(var s=0;s<n.length;++s)Oi.push(i(n[s]))}function Di(){--Mi;var e=Oi;Oi=null;for(var t=0;t<e.length;++t)e[t]()}function Pi(e,t){var n=e._handlers&&e._handlers[t];return n&&n.length>0}function ji(){this.id=null}function Fi(e,t,n,r,i){if(t==null){t=e.search(/[^\s\u00a0]/);if(t==-1)t=e.length}for(var s=r||0,o=i||0;s<t;++s){if(e.charAt(s)=="	")o+=n-o%n;else++o}return o}function qi(e){while(Ii.length<=e)Ii.push(Ri(Ii)+" ");return Ii[e]}function Ri(e){return e[e.length-1]}function Ui(e){if(p){e.selectionStart=0;e.selectionEnd=e.value.length}else e.select()}function zi(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0,r=e.length;n<r;++n)if(e[n]==t)return n;return-1}function Wi(e,t){function n(){}n.prototype=e;var r=new n;if(t)Xi(t,r);return r}function Xi(e,t){if(!t)t={};for(var n in e)if(e.hasOwnProperty(n))t[n]=e[n];return t}function Vi(e){for(var t=[],n=0;n<e;++n)t.push(undefined);return t}function $i(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function Ki(e){return/\w/.test(e)||e>""&&(e.toUpperCase()!=e.toLowerCase()||Ji.test(e))}function Qi(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return false;return true}function Yi(e,t,n,r){var i=document.createElement(e);if(n)i.className=n;if(r)i.style.cssText=r;if(typeof t=="string")ts(i,t);else if(t)for(var s=0;s<t.length;++s)i.appendChild(t[s]);return i}function Zi(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function es(e,t){return Zi(e).appendChild(t)}function ts(e,t){if(r){e.innerHTML="";e.appendChild(document.createTextNode(t))}else e.textContent=t}function ns(e){return e.getBoundingClientRect()}function os(e){if(ss!=null)return ss;var t=Yi("div",null,null,"width: 50px; height: 50px; overflow-x: scroll");es(e,t);if(t.offsetWidth)ss=t.offsetHeight-t.clientHeight;return ss||0}function as(e){if(us==null){var t=Yi("span","​");es(e,Yi("span",[t,document.createTextNode("x")]));if(e.firstChild.offsetHeight!=0)us=t.offsetWidth<=1&&t.offsetHeight>2&&!n}if(us)return Yi("span","​");else return Yi("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px")}function ps(e,t,n,r){if(!e)return r(t,n,"ltr");for(var i=0;i<e.length;++i){var s=e[i];if(s.from<n&&s.to>t||t==n&&s.to==t)r(Math.max(s.from,t),Math.min(s.to,n),s.level==1?"rtl":"ltr")}}function ds(e){return e.level%2?e.to:e.from}function vs(e){return e.level%2?e.from:e.to}function ms(e){var t=fi(e);return t?ds(t[0]):0}function gs(e){var t=fi(e);if(!t)return e.text.length;return vs(Ri(t))}function ys(e,t){var n=ni(e.doc,t);var r=Sr(e.doc,n);if(r!=n)t=oi(r);var i=fi(r);var s=!i?0:i[0].level%2?gs(r):ms(r);return bn(t,s)}function bs(e,t){var n,r;while(n=Er(r=ni(e.doc,t)))t=n.find().to.line;var i=fi(r);var s=!i?r.text.length:i[0].level%2?ms(r):gs(r);return bn(t,s)}function ws(e,t,n,r){var i=fi(e);if(!i)return Es(e,t,n,r);var s=r?function(t,n){do t+=n;while(t>0&&Gi.test(e.text.charAt(t)));return t}:function(e,t){return e+t};var o=i[0].level;for(var u=0;u<i.length;++u){var a=i[u],f=a.level%2==o;if(a.from<t&&a.to>t||f&&(a.from==t||a.to==t))break}var l=s(t,a.level%2?-n:n);while(l!=null){if(a.level%2==o){if(l<a.from||l>a.to){a=i[u+=n];l=a&&(n>0==a.level%2?s(a.to,-1):s(a.from,1))}else break}else{if(l==ds(a)){a=i[--u];l=a&&vs(a)}else if(l==vs(a)){a=i[++u];l=a&&ds(a)}else break}}return l<0||l>e.text.length?null:l}function Es(e,t,n,r){var i=t+n;if(r)while(i>0&&Gi.test(e.text.charAt(i)))i+=n;return i<0||i>e.text.length?null:i}var e=/gecko\/\d/i.test(navigator.userAgent);var t=/MSIE \d/.test(navigator.userAgent);var n=t&&(document.documentMode==null||document.documentMode<8);var r=t&&(document.documentMode==null||document.documentMode<9);var i=/WebKit\//.test(navigator.userAgent);var s=i&&/Qt\/\d+\.\d+/.test(navigator.userAgent);var o=/Chrome\//.test(navigator.userAgent);var u=/Opera\//.test(navigator.userAgent);var a=/Apple Computer/.test(navigator.vendor);var f=/KHTML\//.test(navigator.userAgent);var l=/Mac OS X 1\d\D([7-9]|\d\d)\D/.test(navigator.userAgent);var c=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent);var h=/PhantomJS/.test(navigator.userAgent);var p=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent);var d=p||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent);var v=p||/Mac/.test(navigator.platform);var m=/windows/i.test(navigator.platform);var g=u&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);if(g)g=Number(g[1]);var y=v&&(s||u&&(g==null||g<12.11));var b=e||t&&!r;var w=false,E=false;var bt;var St=0;var Ft,It;var Vt=0,$t=null;if(t)$t=-.53;else if(e)$t=15;else if(o)$t=-.7;else if(a)$t=-1/3;var Gt;var en=null;var on;S.Pos=bn;S.prototype={focus:function(){window.focus();Dt(this);rn(this);Ot(this)},setOption:function(e,t){var n=this.options,r=n[e];if(n[e]==t&&e!="mode")return;n[e]=t;if(Wn.hasOwnProperty(e))Nt(this,Wn[e])(this,t,r)},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](e)},removeKeyMap:function(e){var t=this.state.keyMaps;for(var n=0;n<t.length;++n)if((typeof e=="string"?t[n].name:t[n])==e){t.splice(n,1);return true}},addOverlay:Nt(null,function(e,t){var n=e.token?e:S.getMode(this.options,e);if(n.startState)throw new Error("Overlays may not be stateful.");this.state.overlays.push({mode:n,modeSpec:e,opaque:t&&t.opaque});this.state.modeGen++;Lt(this)}),removeOverlay:Nt(null,function(e){var t=this.state.overlays;for(var n=0;n<t.length;++n){if(t[n].modeSpec==e){t.splice(n,1);this.state.modeGen++;Lt(this);return}}}),indentLine:Nt(null,function(e,t,n){if(typeof t!="string"){if(t==null)t=this.options.smartIndent?"smart":"prev";else t=t?"add":"subtract"}if(Cn(this.doc,e))Fn(this,e,t,n)}),indentSelection:Nt(null,function(e){var t=this.doc.sel;if(wn(t.from,t.to))return Fn(this,t.from.line,e);var n=t.to.line-(t.to.ch?0:1);for(var r=t.from.line;r<=n;++r)Fn(this,r,e)}),getTokenAt:function(e){var t=this.doc;e=Tn(t,e);var n=nt(this,e.line),r=this.doc.mode;var i=ni(t,e.line);var s=new or(i.text,this.options.tabSize);while(s.pos<e.ch&&!s.eol()){s.start=s.pos;var o=r.token(s,n)}return{start:s.start,end:s.pos,string:s.current(),className:o||null,type:o||null,state:n}},getStateAfter:function(e){var t=this.doc;e=xn(t,e==null?t.first+t.size-1:e);return nt(this,e+1)},cursorCoords:function(e,t){var n,r=this.doc.sel;if(e==null)n=r.head;else if(typeof e=="object")n=Tn(this.doc,e);else n=e?r.from:r.to;return vt(this,n,t||"page")},charCoords:function(e,t){return dt(this,Tn(this.doc,e),t||"page")},coordsChar:function(e,t){e=pt(this,e,t||"page");return gt(this,e.left,e.top)},defaultTextHeight:function(){return wt(this.display)},defaultCharWidth:function(){return Et(this.display)},setGutterMarker:Nt(null,function(e,t,n){return In(this,e,function(e){var r=e.gutterMarkers||(e.gutterMarkers={});r[t]=n;if(!n&&Qi(r))e.gutterMarkers=null;return true})}),clearGutter:Nt(null,function(e){var t=this,n=t.doc,r=n.first;n.iter(function(n){if(n.gutterMarkers&&n.gutterMarkers[e]){n.gutterMarkers[e]=null;Lt(t,r,r+1);if(Qi(n.gutterMarkers))n.gutterMarkers=null}++r})}),addLineClass:Nt(null,function(e,t,n){return In(this,e,function(e){var r=t=="text"?"textClass":t=="background"?"bgClass":"wrapClass";if(!e[r])e[r]=n;else if((new RegExp("\\b"+n+"\\b")).test(e[r]))return false;else e[r]+=" "+n;return true})}),removeLineClass:Nt(null,function(e,t,n){return In(this,e,function(e){var r=t=="text"?"textClass":t=="background"?"bgClass":"wrapClass";var i=e[r];if(!i)return false;else if(n==null)e[r]=null;else{var s=i.replace(new RegExp("^"+n+"\\b\\s*|\\s*\\b"+n+"\\b"),"");if(s==i)return false;e[r]=s||null}return true})}),addLineWidget:Nt(null,function(e,t,n){return Or(this,e,t,n)}),removeLineWidget:function(e){e.clear()},lineInfo:function(e){if(typeof e=="number"){if(!Cn(this.doc,e))return null;var t=e;e=ni(this.doc,e);if(!e)return null}else{var t=oi(e);if(t==null)return null}return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},getViewport:function(){return{from:this.display.showingFrom,to:this.display.showingTo}},addWidget:function(e,t,n,r,i){var s=this.display;e=vt(this,Tn(this.doc,e));var o=e.bottom,u=e.left;t.style.position="absolute";s.sizer.appendChild(t);if(r=="over"){o=e.top}else if(r=="above"||r=="near"){var a=Math.max(s.wrapper.clientHeight,this.doc.height),f=Math.max(s.sizer.clientWidth,s.lineSpace.clientWidth);if((r=="above"||e.bottom+t.offsetHeight>a)&&e.top>t.offsetHeight)o=e.top-t.offsetHeight;else if(e.bottom+t.offsetHeight<=a)o=e.bottom;if(u+t.offsetWidth>f)u=f-t.offsetWidth}t.style.top=o+rt(s)+"px";t.style.left=t.style.right="";if(i=="right"){u=s.sizer.clientWidth-t.offsetWidth;t.style.right="0px"}else{if(i=="left")u=0;else if(i=="middle")u=(s.sizer.clientWidth-t.offsetWidth)/2;t.style.left=u+"px"}if(n)Pn(this,u,o,u+t.offsetWidth,o+t.offsetHeight)},triggerOnKeyDown:Nt(null,tn),execCommand:function(e){return er[e](this)},findPosH:function(e,t,n,r){var i=1;if(t<0){i=-1;t=-t}for(var s=0,o=Tn(this.doc,e);s<t;++s){o=qn(this.doc,o,i,n,r);if(o.hitSide)break}return o},moveH:Nt(null,function(e,t){var n=this.doc.sel,r;if(n.shift||n.extend||wn(n.from,n.to))r=qn(this.doc,n.head,e,t,this.options.rtlMoveVisually);else r=e<0?n.from:n.to;kn(this.doc,r,r,e)}),deleteH:Nt(null,function(e,t){var n=this.doc.sel;if(!wn(n.from,n.to))yn(this.doc,"",n.from,n.to,"+delete");else yn(this.doc,"",n.from,qn(this.doc,n.head,e,t,false),"+delete");this.curOp.userSelChange=true}),findPosV:function(e,t,n,r){var i=1,s=r;if(t<0){i=-1;t=-t}for(var o=0,u=Tn(this.doc,e);o<t;++o){var a=vt(this,u,"div");if(s==null)s=a.left;else a.left=s;u=Rn(this,a,i,n);if(u.hitSide)break}return u},moveV:Nt(null,function(e,t){var n=this.doc.sel;var r=vt(this,n.head,"div");if(n.goalColumn!=null)r.left=n.goalColumn;var i=Rn(this,r,e,t);if(t=="page")jn(this,0,dt(this,i,"div").top-r.top);kn(this.doc,i,i,e);n.goalColumn=r.left}),toggleOverwrite:function(){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:Nt(null,function(e,t){Bn(this,e,t)}),getScrollInfo:function(){var e=this.display.scroller,t=Hi;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-t,width:e.scrollWidth-t,clientHeight:e.clientHeight-t,clientWidth:e.clientWidth-t}},scrollIntoView:function(e,t){if(typeof e=="number")e=bn(e,0);if(!e||e.line!=null){e=e?Tn(this.doc,e):this.doc.sel.head;Dn(this,e,t)}else{Pn(this,e.left,e.top-t,e.right,e.bottom+t)}},setSize:function(e,t){function n(e){return typeof e=="number"||/^\d+$/.test(String(e))?e+"px":e}if(e!=null)this.display.wrapper.style.width=n(e);if(t!=null)this.display.wrapper.style.height=n(t);this.refresh()},on:function(e,t){ki(this,e,t)},off:function(e,t){Li(this,e,t)},operation:function(e){return kt(this,e)},refresh:Nt(null,function(){ct(this);Bn(this,this.doc.scrollLeft,this.doc.scrollTop);Lt(this)}),swapDoc:Nt(null,function(e){var t=this.doc;t.cm=null;ti(this,e);ct(this);Bn(this,e.scrollLeft,e.scrollTop);return t}),getInputField:function(){return this.display.input},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}};var Wn=S.optionHandlers={};var Xn=S.defaults={};var $n=S.Init={toString:function(){return"CodeMirror.Init"}};Vn("value","",function(e,t){e.setValue(t)},true);Vn("mode",null,function(e,t){e.doc.modeOption=t;T(e)},true);Vn("indentUnit",2,T,true);Vn("indentWithTabs",false);Vn("smartIndent",true);Vn("tabSize",4,function(e){T(e);ct(e);Lt(e)},true);Vn("electricChars",true);Vn("rtlMoveVisually",!m);Vn("theme","default",function(e){A(e);O(e)},true);Vn("keyMap","default",L);Vn("extraKeys",null);Vn("onKeyEvent",null);Vn("onDragEvent",null);Vn("lineWrapping",false,N,true);Vn("gutters",[],function(e){P(e.options);O(e)},true);Vn("fixedGutter",true,function(e,t){e.display.gutters.style.left=t?q(e.display)+"px":"0";e.refresh()},true);Vn("lineNumbers",false,function(e){P(e.options);O(e)},true);Vn("firstLineNumber",1,O,true);Vn("lineNumberFormatter",function(e){return e},O,true);Vn("showCursorWhenSelecting",false,K,true);Vn("readOnly",false,function(e,t){if(t=="nocursor"){sn(e);e.display.input.blur()}else if(!t)_t(e,true)});Vn("dragDrop",true);Vn("cursorBlinkRate",530);Vn("cursorHeight",1);Vn("workTime",100);Vn("workDelay",100);Vn("flattenSpans",true);Vn("pollInterval",100);Vn("undoDepth",40,function(e,t){e.doc.history.undoDepth=t});Vn("viewportMargin",10,function(e){e.refresh()},true);Vn("tabindex",null,function(e,t){e.display.input.tabIndex=t||""});Vn("autofocus",null);var Jn=S.modes={},Kn=S.mimeModes={};S.defineMode=function(e,t){if(!S.defaults.mode&&e!="null")S.defaults.mode=e;if(arguments.length>2){t.dependencies=[];for(var n=2;n<arguments.length;++n)t.dependencies.push(arguments[n])}Jn[e]=t};S.defineMIME=function(e,t){Kn[e]=t};S.resolveMode=function(e){if(typeof e=="string"&&Kn.hasOwnProperty(e))e=Kn[e];else if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return S.resolveMode("application/xml");if(typeof e=="string")return{name:e};else return e||{name:"null"}};S.getMode=function(e,t){t=S.resolveMode(t);var n=Jn[t.name];if(!n)return S.getMode(e,"text/plain");var r=n(e,t);if(Qn.hasOwnProperty(t.name)){var i=Qn[t.name];for(var s in i){if(!i.hasOwnProperty(s))continue;if(r.hasOwnProperty(s))r["_"+s]=r[s];r[s]=i[s]}}r.name=t.name;return r};S.defineMode("null",function(){return{token:function(e){e.skipToEnd()}}});S.defineMIME("text/plain","null");var Qn=S.modeExtensions={};S.extendMode=function(e,t){var n=Qn.hasOwnProperty(e)?Qn[e]:Qn[e]={};Xi(t,n)};S.defineExtension=function(e,t){S.prototype[e]=t};S.defineOption=Vn;var Gn=[];S.defineInitHook=function(e){Gn.push(e)};S.copyState=Yn;S.startState=Zn;S.innerMode=function(e,t){while(e.innerMode){var n=e.innerMode(t);t=n.state;e=n.mode}return n||{mode:e,state:t}};var er=S.commands={selectAll:function(e){e.setSelection(bn(e.firstLine(),0),bn(e.lastLine()))},killLine:function(e){var t=e.getCursor(true),n=e.getCursor(false),r=!wn(t,n);if(!r&&e.getLine(t.line).length==t.ch)e.replaceRange("",t,bn(t.line+1,0),"+delete");else e.replaceRange("",t,r?n:bn(t.line),"+delete")},deleteLine:function(e){var t=e.getCursor().line;e.replaceRange("",bn(t,0),bn(t),"+delete")},undo:function(e){e.undo()},redo:function(e){e.redo()},goDocStart:function(e){e.extendSelection(bn(e.firstLine(),0))},goDocEnd:function(e){e.extendSelection(bn(e.lastLine()))},goLineStart:function(e){e.extendSelection(ys(e,e.getCursor().line))},goLineStartSmart:function(e){var t=e.getCursor(),n=ys(e,t.line);var r=e.getLineHandle(n.line);var i=fi(r);if(!i||i[0].level==0){var s=Math.max(0,r.text.search(/\S/));var o=t.line==n.line&&t.ch<=s&&t.ch;e.extendSelection(bn(n.line,o?0:s))}else e.extendSelection(n)},goLineEnd:function(e){e.extendSelection(bs(e,e.getCursor().line))},goLineRight:function(e){var t=e.charCoords(e.getCursor(),"div").top+5;e.extendSelection(e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:t},"div"))},goLineLeft:function(e){var t=e.charCoords(e.getCursor(),"div").top+5;e.extendSelection(e.coordsChar({left:0,top:t},"div"))},goLineUp:function(e){e.moveV(-1,"line")},goLineDown:function(e){e.moveV(1,"line")},goPageUp:function(e){e.moveV(-1,"page")},goPageDown:function(e){e.moveV(1,"page")},goCharLeft:function(e){e.moveH(-1,"char")},goCharRight:function(e){e.moveH(1,"char")},goColumnLeft:function(e){e.moveH(-1,"column")},goColumnRight:function(e){e.moveH(1,"column")},goWordLeft:function(e){e.moveH(-1,"word")},goGroupRight:function(e){e.moveH(1,"group")},goGroupLeft:function(e){e.moveH(-1,"group")},goWordRight:function(e){e.moveH(1,"word")},delCharBefore:function(e){e.deleteH(-1,"char")},delCharAfter:function(e){e.deleteH(1,"char")},delWordBefore:function(e){e.deleteH(-1,"word")},delWordAfter:function(e){e.deleteH(1,"word")},delGroupBefore:function(e){e.deleteH(-1,"group")},delGroupAfter:function(e){e.deleteH(1,"group")},indentAuto:function(e){e.indentSelection("smart")},indentMore:function(e){e.indentSelection("add")},indentLess:function(e){e.indentSelection("subtract")},insertTab:function(e){e.replaceSelection("	","end","+input")},defaultTab:function(e){if(e.somethingSelected())e.indentSelection("add");else e.replaceSelection("	","end","+input")},transposeChars:function(e){var t=e.getCursor(),n=e.getLine(t.line);if(t.ch>0&&t.ch<n.length-1)e.replaceRange(n.charAt(t.ch)+n.charAt(t.ch-1),bn(t.line,t.ch-1),bn(t.line,t.ch+1))},newlineAndIndent:function(e){Nt(e,function(){e.replaceSelection("\n","end","+input");e.indentLine(e.getCursor().line,null,true)})()},toggleOverwrite:function(e){e.toggleOverwrite()}};var tr=S.keyMap={};tr.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite"};tr.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"};tr.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",fallthrough:["basic","emacsy"]};tr["default"]=v?tr.macDefault:tr.pcDefault;tr.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"};S.lookupKey=rr;S.isModifierKey=ir;S.keyName=sr;S.fromTextArea=function(e,t){function i(){e.value=a.getValue()}if(!t)t={};t.value=e.value;if(!t.tabindex&&e.tabindex)t.tabindex=e.tabindex;if(!t.placeholder&&e.placeholder)t.placeholder=e.placeholder;if(t.autofocus==null){var n=document.body;try{n=document.activeElement}catch(r){}t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}if(e.form){ki(e.form,"submit",i);if(!t.leaveSubmitMethodAlone){var s=e.form,o=s.submit;try{var u=s.submit=function(){i();s.submit=o;s.submit();s.submit=u}}catch(r){}}}e.style.display="none";var a=S(function(t){e.parentNode.insertBefore(t,e.nextSibling)},t);a.save=i;a.getTextArea=function(){return e};a.toTextArea=function(){i();e.parentNode.removeChild(a.getWrapperElement());e.style.display="";if(e.form){Li(e.form,"submit",i);if(typeof e.form.submit=="function")e.form.submit=o}};return a};or.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(e){var t=this.string.charAt(this.pos);if(typeof e=="string")var n=t==e;else var n=t&&(e.test?e.test(t):e(t));if(n){++this.pos;return t}},eatWhile:function(e){var t=this.pos;while(this.eat(e)){}return this.pos>t},eatSpace:function(){var e=this.pos;while(/[\s\u00a0]/.test(this.string.charAt(this.pos)))++this.pos;return this.pos>e},skipToEnd:function(){this.pos=this.string.length},skipTo:function(e){var t=this.string.indexOf(e,this.pos);if(t>-1){this.pos=t;return true}},backUp:function(e){this.pos-=e},column:function(){if(this.lastColumnPos<this.start){this.lastColumnValue=Fi(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue);this.lastColumnPos=this.start}return this.lastColumnValue},indentation:function(){return Fi(this.string,null,this.tabSize)},match:function(e,t,n){if(typeof e=="string"){var r=function(e){return n?e.toLowerCase():e};var i=this.string.substr(this.pos,e.length);if(r(i)==r(e)){if(t!==false)this.pos+=e.length;return true}}else{var s=this.string.slice(this.pos).match(e);if(s&&s.index>0)return null;if(s&&t!==false)this.pos+=s[0].length;return s}},current:function(){return this.string.slice(this.start,this.pos)}};S.StringStream=or;S.TextMarker=ur;ur.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t)xt(e);var n=null,r=null;for(var i=0;i<this.lines.length;++i){var s=this.lines[i];var o=cr(s.markedSpans,this);if(o.to!=null)r=oi(s);s.markedSpans=hr(s.markedSpans,o);if(o.from!=null)n=oi(s);else if(this.collapsed&&!xr(this.doc,s)&&e)si(s,wt(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var i=0;i<this.lines.length;++i){var u=Sr(e.doc,this.lines[i]),a=_(e.doc,u);if(a>e.display.maxLineLength){e.display.maxLine=u;e.display.maxLineLength=a;e.display.maxLineChanged=true}}if(n!=null&&e)Lt(e,n,r+1);this.lines.length=0;this.explicitlyCleared=true;if(this.collapsed&&this.doc.cantEdit){this.doc.cantEdit=false;if(e)On(e)}if(t)Tt(e);_i(this,"clear")};ur.prototype.find=function(){var e,t;for(var n=0;n<this.lines.length;++n){var r=this.lines[n];var i=cr(r.markedSpans,this);if(i.from!=null||i.to!=null){var s=oi(r);if(i.from!=null)e=bn(s,i.from);if(i.to!=null)t=bn(s,i.to)}}if(this.type=="bookmark")return e;return e&&{from:e,to:t}};ur.prototype.getOptions=function(e){var t=this.replacedWith;return{className:this.className,inclusiveLeft:this.inclusiveLeft,inclusiveRight:this.inclusiveRight,atomic:this.atomic,collapsed:this.collapsed,replacedWith:e?t&&t.cloneNode(true):t,readOnly:this.readOnly,startStyle:this.startStyle,endStyle:this.endStyle}};ur.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;if(!t.maybeHiddenMarkers||zi(t.maybeHiddenMarkers,this)==-1)(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)};ur.prototype.detachLine=function(e){this.lines.splice(zi(this.lines,e),1);if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}};S.SharedTextMarker=fr;fr.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=true;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();_i(this,"clear")};fr.prototype.find=function(){return this.primary.find()};fr.prototype.getOptions=function(e){var t=this.primary.getOptions(e);t.shared=true;return t};var kr=S.LineWidget=function(e,t,n){for(var r in n)if(n.hasOwnProperty(r))this[r]=n[r];this.cm=e;this.node=t};kr.prototype.clear=Lr(function(){var e=this.line.widgets,t=oi(this.line);if(t==null||!e)return;for(var n=0;n<e.length;++n)if(e[n]==this)e.splice(n--,1);if(!e.length)this.line.widgets=null;si(this.line,Math.max(0,this.line.height-Ar(this)));Lt(this.cm,t,t+1)});kr.prototype.changed=Lr(function(){var e=this.height;this.height=null;var t=Ar(this)-e;if(!t)return;si(this.line,this.line.height+t);var n=oi(this.line);Lt(this.cm,n,n+1)});var Fr={};var Rr=/[\t\u0000-\u0019\u00ad\u200b\u2028\u2029\uFEFF]/g;Jr.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,r=e+t;n<r;++n){var i=this.lines[n];this.height-=i.height;Dr(i);_i(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.splice.apply(e,[e.length,0].concat(this.lines))},insertInner:function(e,t,n){this.height+=n;this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var r=0,i=t.length;r<i;++r)t[r].parent=this},iterN:function(e,t,n){for(var r=e+t;e<r;++e)if(n(this.lines[e]))return true}};Kr.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n=0;n<this.children.length;++n){var r=this.children[n],i=r.chunkSize();if(e<i){var s=Math.min(t,i-e),o=r.height;r.removeInner(e,s);this.height-=o-r.height;if(i==s){this.children.splice(n--,1);r.parent=null}if((t-=s)==0)break;e=0}else e-=i}if(this.size-t<25){var u=[];this.collapse(u);this.children=[new Jr(u)];this.children[0].parent=this}},collapse:function(e){for(var t=0,n=this.children.length;t<n;++t)this.children[t].collapse(e)},insertInner:function(e,t,n){this.size+=t.length;this.height+=n;for(var r=0,i=this.children.length;r<i;++r){var s=this.children[r],o=s.chunkSize();if(e<=o){s.insertInner(e,t,n);if(s.lines&&s.lines.length>50){while(s.lines.length>50){var u=s.lines.splice(s.lines.length-25,25);var a=new Jr(u);s.height-=a.height;this.children.splice(r+1,0,a);a.parent=this}this.maybeSpill()}break}e-=o}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5);var n=new Kr(t);if(!e.parent){var r=new Kr(e.children);r.parent=e;e.children=[r,n];e=r}else{e.size-=n.size;e.height-=n.height;var i=zi(e.parent.children,e);e.parent.children.splice(i+1,0,n)}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,n){for(var r=0,i=this.children.length;r<i;++r){var s=this.children[r],o=s.chunkSize();if(e<o){var u=Math.min(t,o-e);if(s.iterN(e,u,n))return true;if((t-=u)==0)break;e=0}else e-=o}}};var Qr=0;var Gr=S.Doc=function(e,t,n){if(!(this instanceof Gr))return new Gr(e,t,n);if(n==null)n=0;Kr.call(this,[new Jr([Mr("",null)])]);this.first=n;this.scrollTop=this.scrollLeft=0;this.cantEdit=false;this.history=li();this.frontier=n;var r=bn(n,0);this.sel={from:r,to:r,head:r,anchor:r,shift:false,extend:false,goalColumn:null};this.id=++Qr;this.modeOption=t;if(typeof e=="string")e=fs(e);$r(this,{from:r,to:r,text:e},null,{head:r,anchor:r})};Gr.prototype=Wi(Kr.prototype,{iter:function(e,t,n){if(n)this.iterN(e-this.first,t-e,n);else this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){var n=0;for(var r=0,i=t.length;r<i;++r)n+=t[r].height;this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=ii(this,this.first,this.first+this.size);if(e===false)return t;return t.join(e||"\n")},setValue:function(e){var t=bn(this.first,0),n=this.first+this.size-1;hn(this,{from:t,to:bn(n,ni(this,n).text.length),text:fs(e),origin:"setValue"},{head:t,anchor:t},true)},replaceRange:function(e,t,n,r){t=Tn(this,t);n=n?Tn(this,n):t;yn(this,e,t,n,r)},getRange:function(e,t,n){var r=ri(this,Tn(this,e),Tn(this,t));if(n===false)return r;return r.join(n||"\n")},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},setLine:function(e,t){if(Cn(this,e))yn(this,t,bn(e,0),Tn(this,bn(e)))},removeLine:function(e){if(Cn(this,e))yn(this,"",bn(e,0),Tn(this,bn(e+1,0)))},getLineHandle:function(e){if(Cn(this,e))return ni(this,e)},getLineNumber:function(e){return oi(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return Tn(this,e)},getCursor:function(e){var t=this.sel,n;if(e==null||e=="head")n=t.head;else if(e=="anchor")n=t.anchor;else if(e=="end"||e===false)n=t.to;else n=t.from;return Sn(n)},somethingSelected:function(){return!wn(this.sel.head,this.sel.anchor)},setCursor:Ct(function(e,t,n){var r=Tn(this,typeof e=="number"?bn(e,t||0):e);if(n)kn(this,r);else An(this,r,r)}),setSelection:Ct(function(e,t){An(this,Tn(this,e),Tn(this,t||e))}),extendSelection:Ct(function(e,t){kn(this,Tn(this,e),t&&Tn(this,t))}),getSelection:function(e){return this.getRange(this.sel.from,this.sel.to,e)},replaceSelection:function(e,t,n){hn(this,{from:this.sel.from,to:this.sel.to,text:fs(e),origin:n},t||"around")},undo:Ct(function(){dn(this,"undo")}),redo:Ct(function(){dn(this,"redo")}),setExtending:function(e){this.sel.extend=e},historySize:function(){var e=this.history;return{undo:e.done.length,redo:e.undone.length}},clearHistory:function(){this.history=li()},markClean:function(){this.history.dirtyCounter=0;this.history.lastOp=this.history.lastOrigin=null},isClean:function(){return this.history.dirtyCounter==0},getHistory:function(){return{done:mi(this.history.done),undone:mi(this.history.undone)}},setHistory:function(e){var t=this.history=li();t.done=e.done.slice(0);t.undone=e.undone.slice(0)},markText:function(e,t,n){return ar(this,Tn(this,e),Tn(this,t),n,"range")},setBookmark:function(e,t){var n={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft};e=Tn(this,e);return ar(this,e,e,n,"bookmark")},findMarksAt:function(e){e=Tn(this,e);var t=[],n=ni(this,e.line).markedSpans;if(n)for(var r=0;r<n.length;++r){var i=n[r];if((i.from==null||i.from<=e.ch)&&(i.to==null||i.to>=e.ch))t.push(i.marker.parent||i.marker)}return t},getAllMarks:function(){var e=[];this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;r<n.length;++r)if(n[r].from!=null)e.push(n[r].marker)});return e},posFromIndex:function(e){var t,n=this.first;this.iter(function(r){var i=r.text.length+1;if(i>e){t=e;return true}e-=i;++n});return Tn(this,bn(n,t))},indexFromPos:function(e){e=Tn(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;this.iter(this.first,e.line,function(e){t+=e.text.length+1});return t},copy:function(e){var t=new Gr(ii(this,this.first,this.first+this.size),this.modeOption,this.first);t.scrollTop=this.scrollTop;t.scrollLeft=this.scrollLeft;t.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(e){t.history.undoDepth=this.history.undoDepth;t.setHistory(this.getHistory())}return t},linkedDoc:function(e){if(!e)e={};var t=this.first,n=this.first+this.size;if(e.from!=null&&e.from>t)t=e.from;if(e.to!=null&&e.to<n)n=e.to;var r=new Gr(ii(this,t,n),e.mode||this.modeOption,t);if(e.sharedHist)r.history=this.history;(this.linked||(this.linked=[])).push({doc:r,sharedHist:e.sharedHist});r.linked=[{doc:this,isParent:true,sharedHist:e.sharedHist}];return r},unlinkDoc:function(e){if(e instanceof S)e=e.doc;if(this.linked)for(var t=0;t<this.linked.length;++t){var n=this.linked[t];if(n.doc!=e)continue;this.linked.splice(t,1);e.unlinkDoc(this);break}if(e.history==this.history){var r=[e.id];ei(e,function(e){r.push(e.id)},true);e.history=li();e.history.done=mi(this.history.done,r);e.history.undone=mi(this.history.undone,r)}},iterLinkedDocs:function(e){ei(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm}});Gr.prototype.eachLine=Gr.prototype.iter;var Yr="iter insert remove copy getEditor".split(" ");for(var Zr in Gr.prototype)if(Gr.prototype.hasOwnProperty(Zr)&&zi(Yr,Zr)<0)S.prototype[Zr]=function(e){return function(){return e.apply(this.doc,arguments)}}(Gr.prototype[Zr]);S.e_stop=Ti;S.e_preventDefault=Si;S.e_stopPropagation=xi;var Oi,Mi=0;S.on=ki;S.off=Li;S.signal=Ai;var Hi=30;var Bi=S.Pass={toString:function(){return"CodeMirror.Pass"}};ji.prototype={set:function(e,t){clearTimeout(this.id);this.id=setTimeout(t,e)}};S.countColumn=Fi;var Ii=[""];var Ji=/[\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc]/;var Gi=/[\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\uA670-\uA672\uA674-\uA67D\uA69F\udc00-\udfff]/;S.replaceGetRect=function(e){ns=e};var rs=function(){if(r)return false;var e=Yi("div");return"draggable"in e||"dragDrop"in e}();var is=/^$/;if(e)is=/$'/;else if(a&&!/Version\/([6-9]|\d\d)\b/.test(navigator.userAgent))is=/\-[^ \-?]|\?[^ !'\"\),.\-\/:;\?\]\}]/;else if(i)is=/[~!#%&*)=+}\]|\"\.>,:;][({[<]|-[^\-?\.]|\?[\w~`@#$%\^&*(_=+{[|><]/;var ss;var us;var fs="\n\nb".split(/\n/).length!=3?function(e){var t=0,n=[],r=e.length;while(t<=r){var i=e.indexOf("\n",t);if(i==-1)i=e.length;var s=e.slice(t,e.charAt(i-1)=="\r"?i-1:i);var o=s.indexOf("\r");if(o!=-1){n.push(s.slice(0,o));t+=o+1}else{n.push(s);t=i+1}}return n}:function(e){return e.split(/\r\n?|\n/)};S.splitLines=fs;var ls=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return false}}:function(e){try{var t=e.ownerDocument.selection.createRange()}catch(n){}if(!t||t.parentElement()!=e)return false;return t.compareEndPoints("StartToEnd",t)!=0};var cs=function(){var e=Yi("div");if("oncopy"in e)return true;e.setAttribute("oncopy","return;");return typeof e.oncopy=="function"}();var hs={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"};S.keyNames=hs;(function(){for(var e=0;e<10;e++)hs[e+48]=String(e);for(var e=65;e<=90;e++)hs[e]=String.fromCharCode(e);for(var e=1;e<=12;e++)hs[e+111]=hs[e+63235]="F"+e})();var Ss=function(){function n(n){if(n<=255)return e.charAt(n);else if(1424<=n&&n<=1524)return"R";else if(1536<=n&&n<=1791)return t.charAt(n-1536);else if(1792<=n&&n<=2220)return"r";else return"L"}var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLL";var t="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmmrrrrrrrrrrrrrrrrrr";var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;var i=/[stwN]/,s=/[LRr]/,o=/[Lb1n]/,u=/[1n]/;var a="L";return function(e){if(!r.test(e))return false;var t=e.length,f=[];for(var l=0,c;l<t;++l)f.push(c=n(e.charCodeAt(l)));for(var l=0,h=a;l<t;++l){var c=f[l];if(c=="m")f[l]=h;else h=c}for(var l=0,p=a;l<t;++l){var c=f[l];if(c=="1"&&p=="r")f[l]="n";else if(s.test(c)){p=c;if(c=="r")f[l]="R"}}for(var l=1,h=f[0];l<t-1;++l){var c=f[l];if(c=="+"&&h=="1"&&f[l+1]=="1")f[l]="1";else if(c==","&&h==f[l+1]&&(h=="1"||h=="n"))f[l]=h;h=c}for(var l=0;l<t;++l){var c=f[l];if(c==",")f[l]="N";else if(c=="%"){for(var d=l+1;d<t&&f[d]=="%";++d){}var v=l&&f[l-1]=="!"||d<t-1&&f[d]=="1"?"1":"N";for(var m=l;m<d;++m)f[m]=v;l=d-1}}for(var l=0,p=a;l<t;++l){var c=f[l];if(p=="L"&&c=="1")f[l]="L";else if(s.test(c))p=c}for(var l=0;l<t;++l){if(i.test(f[l])){for(var d=l+1;d<t&&i.test(f[d]);++d){}var g=(l?f[l-1]:a)=="L";var y=(d<t-1?f[d]:a)=="L";var v=g||y?"L":"R";for(var m=l;m<d;++m)f[m]=v;l=d-1}}var b=[],w;for(var l=0;l<t;){if(o.test(f[l])){var E=l;for(++l;l<t&&o.test(f[l]);++l){}b.push({from:E,to:l,level:0})}else{var S=l,x=b.length;for(++l;l<t&&f[l]!="L";++l){}for(var m=S;m<l;){if(u.test(f[m])){if(S<m)b.splice(x,0,{from:S,to:m,level:1});var T=m;for(++m;m<l&&u.test(f[m]);++m){}b.splice(x,0,{from:T,to:m,level:2});S=m}else++m}if(S<l)b.splice(x,0,{from:S,to:l,level:1})}}if(b[0].level==1&&(w=e.match(/^\s+/))){b[0].from=w[0].length;b.unshift({from:0,to:w[0].length,level:0})}if(Ri(b).level==1&&(w=e.match(/\s+$/))){Ri(b).to-=w[0].length;b.push({from:t-w[0].length,to:t,level:0})}if(b[0].level!=Ri(b).level)b.push({from:t,to:t,level:b[0].level});return b}}();S.version="3.11";return S}();(function(){"use strict";function n(n){if("_activeLine"in n){n.removeLineClass(n._activeLine,"wrap",e);n.removeLineClass(n._activeLine,"background",t)}}function r(r){var i=r.getLineHandle(r.getCursor().line);if(r._activeLine==i)return;n(r);r.addLineClass(i,"wrap",e);r.addLineClass(i,"background",t);r._activeLine=i}var e="CodeMirror-activeline";var t="CodeMirror-activeline-background";CodeMirror.defineOption("styleActiveLine",false,function(e,t,i){var s=i&&i!=CodeMirror.Init;if(t&&!s){r(e);e.on("cursorActivity",r)}else if(!t&&s){e.off("cursorActivity",r);n(e);delete e._activeLine}})})();CodeMirror.defineMode("css",function(e){return CodeMirror.getMode(e,"text/css")});CodeMirror.defineMode("css-base",function(e,t){"use strict";function c(e,t){l=t;return e}function h(e,t){var n=e.next();if(r[n]){var i=r[n](e,t);if(i!==false)return i}if(n=="@"){e.eatWhile(/[\w\\\-]/);return c("def",e.current())}else if(n=="=")c(null,"compare");else if((n=="~"||n=="|")&&e.eat("="))return c(null,"compare");else if(n=='"'||n=="'"){t.tokenize=p(n);return t.tokenize(e,t)}else if(n=="#"){e.eatWhile(/[\w\\\-]/);return c("atom","hash")}else if(n=="!"){e.match(/^\s*\w*/);return c("keyword","important")}else if(/\d/.test(n)){e.eatWhile(/[\w.%]/);return c("number","unit")}else if(n==="-"){if(/\d/.test(e.peek())){e.eatWhile(/[\w.%]/);return c("number","unit")}else if(e.match(/^[^-]+-/)){return c("meta","meta")}}else if(/[,+>*\/]/.test(n)){return c(null,"select-op")}else if(n=="."&&e.match(/^-?[_a-z][_a-z0-9-]*/i)){return c("qualifier","qualifier")}else if(n==":"){return c("operator",n)}else if(/[;{}\[\]\(\)]/.test(n)){return c(null,n)}else if(n=="u"&&e.match("rl(")){e.backUp(1);t.tokenize=d;return c("property","variable")}else{e.eatWhile(/[\w\\\-]/);return c("property","variable")}}function p(e,t){return function(n,r){var i=false,s;while((s=n.next())!=null){if(s==e&&!i)break;i=!i&&s=="\\"}if(!i){if(t)n.backUp(1);r.tokenize=h}return c("string","string")}}function d(e,t){e.next();if(!e.match(/\s*[\"\']/,false))t.tokenize=p(")",true);else t.tokenize=h;return c(null,"(")}var n=e.indentUnit,r=t.hooks||{},i=t.atMediaTypes||{},s=t.atMediaFeatures||{},o=t.propertyKeywords||{},u=t.colorKeywords||{},a=t.valueKeywords||{},f=!!t.allowNested,l=null;return{startState:function(e){return{tokenize:h,baseIndent:e||0,stack:[]}},token:function(e,t){t.tokenize=t.tokenize||h;if(t.tokenize==h&&e.eatSpace())return null;var n=t.tokenize(e,t);if(n&&typeof n!="string")n=c(n[0],n[1]);var r=t.stack[t.stack.length-1];if(n=="variable"){if(l=="variable-definition")t.stack.push("propertyValue");return"variable-2"}else if(n=="property"){if(r=="propertyValue"){if(a[e.current()]){n="string-2"}else if(u[e.current()]){n="keyword"}else{n="variable-2"}}else if(r=="rule"){if(!o[e.current()]){n+=" error"}}else if(r=="block"){if(o[e.current()]){n="property"}else if(u[e.current()]){n="keyword"}else if(a[e.current()]){n="string-2"}else{n="tag"}}else if(!r||r=="@media{"){n="tag"}else if(r=="@media"){if(i[e.current()]){n="attribute"}else if(/^(only|not)$/i.test(e.current())){n="keyword"}else if(e.current().toLowerCase()=="and"){n="error"}else if(s[e.current()]){n="error"}else{n="attribute error"}}else if(r=="@mediaType"){if(i[e.current()]){n="attribute"}else if(e.current().toLowerCase()=="and"){n="operator"}else if(/^(only|not)$/i.test(e.current())){n="error"}else if(s[e.current()]){n="error"}else{n="error"}}else if(r=="@mediaType("){if(o[e.current()]){}else if(i[e.current()]){n="error"}else if(e.current().toLowerCase()=="and"){n="operator"}else if(/^(only|not)$/i.test(e.current())){n="error"}else{n+=" error"}}else{n="error"}}else if(n=="atom"){if(!r||r=="@media{"||r=="block"){n="builtin"}else if(r=="propertyValue"){if(!/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(e.current())){n+=" error"}}else{n="error"}}else if(r=="@media"&&l=="{"){n="error"}if(l=="{"){if(r=="@media"||r=="@mediaType"){t.stack.pop();t.stack[t.stack.length-1]="@media{"}else{var p=f?"block":"rule";t.stack.push(p)}}else if(l=="}"){var d=t.stack[t.stack.length-1];if(d=="interpolation")n="operator";t.stack.pop();if(r=="propertyValue")t.stack.pop()}else if(l=="interpolation")t.stack.push("interpolation");else if(l=="@media")t.stack.push("@media");else if(r=="@media"&&/\b(keyword|attribute)\b/.test(n))t.stack.push("@mediaType");else if(r=="@mediaType"&&e.current()==",")t.stack.pop();else if(r=="@mediaType"&&l=="(")t.stack.push("@mediaType(");else if(r=="@mediaType("&&l==")")t.stack.pop();else if((r=="rule"||r=="block")&&l==":")t.stack.push("propertyValue");else if(r=="propertyValue"&&l==";")t.stack.pop();return n},indent:function(e,t){var r=e.stack.length;if(/^\}/.test(t))r-=e.stack[e.stack.length-1]=="propertyValue"?2:1;return e.baseIndent+r*n},electricChars:"}"}});(function(){function e(e){var t={};for(var n=0;n<e.length;++n){t[e[n]]=true}return t}function o(e,t){var n=false,r;while((r=e.next())!=null){if(n&&r=="/"){t.tokenize=null;break}n=r=="*"}return["comment","comment"]}var t=e(["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"]);var n=e(["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid"]);var r=e(["align-content","align-items","align-self","alignment-adjust","alignment-baseline","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backface-visibility","background","background-attachment","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","binding","bleed","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","font","font-feature-settings","font-family","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-weight","grid-cell","grid-column","grid-column-align","grid-column-sizing","grid-column-span","grid-columns","grid-flow","grid-row","grid-row-align","grid-row-sizing","grid-row-span","grid-rows","grid-template","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","justify-content","left","letter-spacing","line-break","line-height","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marker-offset","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","max-height","max-width","min-height","min-width","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","play-during","position","presentation-level","punctuation-trim","quotes","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotation","rotation-point","ruby-align","ruby-overhang","ruby-position","ruby-span","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-outline","text-shadow","text-space-collapse","text-transform","text-underline-position","text-wrap","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","word-break","word-spacing","word-wrap","z-index"]);var i=e(["black","silver","gray","white","maroon","red","purple","fuchsia","green","lime","olive","yellow","navy","blue","teal","aqua"]);var s=e(["above","absolute","activeborder","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","auto","avoid","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break-all","break-word","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","compact","condensed","contain","content","content-box","context-menu","continuous","copy","cover","crop","cross","crosshair","currentcolor","cursive","dashed","decimal","decimal-leading-zero","default","default-button","destination-atop","destination-in","destination-out","destination-over","devanagari","disc","discard","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ew-resize","expanded","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","footnotes","forwards","from","geometricPrecision","georgian","graytext","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-table","inset","inside","intrinsic","invert","italic","justify","kannada","katakana","katakana-iroha","khmer","landscape","lao","large","larger","left","level","lighter","line-through","linear","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","malayalam","match","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","nw-resize","nwse-resize","oblique","octal","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","overlay","overline","padding","padding-box","painted","paused","persian","plus-darker","plus-lighter","pointer","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radio","read-only","read-write","read-write-plaintext-only","relative","repeat","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","round","row-resize","rtl","run-in","running","s-resize","sans-serif","scroll","scrollbar","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","semi-condensed","semi-expanded","separate","serif","show","sidama","single","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","solid","somali","source-atop","source-in","source-out","source-over","space","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","transparent","ultra-condensed","ultra-expanded","underline","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","white","wider","window","windowframe","windowtext","x-large","x-small","xor","xx-large","xx-small"]);CodeMirror.defineMIME("text/css",{atMediaTypes:t,atMediaFeatures:n,propertyKeywords:r,colorKeywords:i,valueKeywords:s,hooks:{"<":function(e,t){function n(e,t){var n=0,r;while((r=e.next())!=null){if(n>=2&&r==">"){t.tokenize=null;break}n=r=="-"?n+1:0}return["comment","comment"]}if(e.eat("!")){t.tokenize=n;return n(e,t)}},"/":function(e,t){if(e.eat("*")){t.tokenize=o;return o(e,t)}return false}},name:"css-base"});CodeMirror.defineMIME("text/x-scss",{atMediaTypes:t,atMediaFeatures:n,propertyKeywords:r,colorKeywords:i,valueKeywords:s,allowNested:true,hooks:{$:function(e){e.match(/^[\w-]+/);if(e.peek()==":"){return["variable","variable-definition"]}return["variable","variable"]},"/":function(e,t){if(e.eat("/")){e.skipToEnd();return["comment","comment"]}else if(e.eat("*")){t.tokenize=o;return o(e,t)}else{return["operator","operator"]}},"#":function(e){if(e.eat("{")){return["operator","interpolation"]}else{e.eatWhile(/[\w\\\-]/);return["atom","hash"]}}},name:"css-base"})})();CodeMirror.defineMode("xml",function(e,t){function a(e,t){function n(n){t.tokenize=n;return n(e,t)}var r=e.next();if(r=="<"){if(e.eat("!")){if(e.eat("[")){if(e.match("CDATA["))return n(c("atom","]]>"));else return null}else if(e.match("--"))return n(c("comment","-->"));else if(e.match("DOCTYPE",true,true)){e.eatWhile(/[\w\._\-]/);return n(h(1))}else return null}else if(e.eat("?")){e.eatWhile(/[\w\._\-]/);t.tokenize=c("meta","?>");return"meta"}else{var i=e.eat("/");o="";var s;while(s=e.eat(/[^\s\u00a0=<>\"\'\/?]/))o+=s;if(!o)return"error";u=i?"closeTag":"openTag";t.tokenize=f;return"tag"}}else if(r=="&"){var a;if(e.eat("#")){if(e.eat("x")){a=e.eatWhile(/[a-fA-F\d]/)&&e.eat(";")}else{a=e.eatWhile(/[\d]/)&&e.eat(";")}}else{a=e.eatWhile(/[\w\.\-:]/)&&e.eat(";")}return a?"atom":"error"}else{e.eatWhile(/[^&<]/);return null}}function f(e,t){var n=e.next();if(n==">"||n=="/"&&e.eat(">")){t.tokenize=a;u=n==">"?"endTag":"selfcloseTag";return"tag"}else if(n=="="){u="equals";return null}else if(/[\'\"]/.test(n)){t.tokenize=l(n);return t.tokenize(e,t)}else{e.eatWhile(/[^\s\u00a0=<>\"\']/);return"word"}}function l(e){return function(t,n){while(!t.eol()){if(t.next()==e){n.tokenize=f;break}}return"string"}}function c(e,t){return function(n,r){while(!n.eol()){if(n.match(t)){r.tokenize=a;break}n.next()}return e}}function h(e){return function(t,n){var r;while((r=t.next())!=null){if(r=="<"){n.tokenize=h(e+1);return n.tokenize(t,n)}else if(r==">"){if(e==1){n.tokenize=a;break}else{n.tokenize=h(e-1);return n.tokenize(t,n)}}}return"meta"}}function m(){for(var e=arguments.length-1;e>=0;e--)p.cc.push(arguments[e])}function g(){m.apply(null,arguments);return true}function y(e,t){var n=i.doNotIndent.hasOwnProperty(e)||p.context&&p.context.noIndent;p.context={prev:p.context,tagName:e,indent:p.indented,startOfLine:t,noIndent:n}}function b(){if(p.context)p.context=p.context.prev}function w(e){if(e=="openTag"){p.tagName=o;p.tagStart=d.column();return g(T,E(p.startOfLine))}else if(e=="closeTag"){var t=false;if(p.context){if(p.context.tagName!=o){if(i.implicitlyClosed.hasOwnProperty(p.context.tagName.toLowerCase())){b()}t=!p.context||p.context.tagName!=o}}else{t=true}if(t)v="error";return g(S(t))}return g()}function E(e){return function(t){var n=p.tagName;p.tagName=p.tagStart=null;if(t=="selfcloseTag"||t=="endTag"&&i.autoSelfClosers.hasOwnProperty(n.toLowerCase())){x(n.toLowerCase());return g()}if(t=="endTag"){x(n.toLowerCase());y(n,e);return g()}return g()}}function S(e){return function(t){if(e)v="error";if(t=="endTag"){b();return g()}v="error";return g(arguments.callee)}}function x(e){var t;while(true){if(!p.context){return}t=p.context.tagName.toLowerCase();if(!i.contextGrabbers.hasOwnProperty(t)||!i.contextGrabbers[t].hasOwnProperty(e)){return}b()}}function T(e){if(e=="word"){v="attribute";return g(N,T)}if(e=="endTag"||e=="selfcloseTag")return m();v="error";return g(T)}function N(e){if(e=="equals")return g(C,T);if(!i.allowMissing)v="error";else if(e=="word")v="attribute";return e=="endTag"||e=="selfcloseTag"?m():g()}function C(e){if(e=="string")return g(k);if(e=="word"&&i.allowUnquoted){v="string";return g()}v="error";return e=="endTag"||e=="selfCloseTag"?m():g()}function k(e){if(e=="string")return g(k);else return m()}var n=e.indentUnit;var r=t.multilineTagIndentFactor||1;var i=t.htmlMode?{autoSelfClosers:{area:true,base:true,br:true,col:true,command:true,embed:true,frame:true,hr:true,img:true,input:true,keygen:true,link:true,meta:true,param:true,source:true,track:true,wbr:true},implicitlyClosed:{dd:true,li:true,optgroup:true,option:true,p:true,rp:true,rt:true,tbody:true,td:true,tfoot:true,th:true,tr:true},contextGrabbers:{dd:{dd:true,dt:true},dt:{dd:true,dt:true},li:{li:true},option:{option:true,optgroup:true},optgroup:{optgroup:true},p:{address:true,article:true,aside:true,blockquote:true,dir:true,div:true,dl:true,fieldset:true,footer:true,form:true,h1:true,h2:true,h3:true,h4:true,h5:true,h6:true,header:true,hgroup:true,hr:true,menu:true,nav:true,ol:true,p:true,pre:true,section:true,table:true,ul:true},rp:{rp:true,rt:true},rt:{rp:true,rt:true},tbody:{tbody:true,tfoot:true},td:{td:true,th:true},tfoot:{tbody:true},th:{td:true,th:true},thead:{tbody:true,tfoot:true},tr:{tr:true}},doNotIndent:{pre:true},allowUnquoted:true,allowMissing:true}:{autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:false,allowMissing:false};var s=t.alignCDATA;var o,u;var p,d,v;return{startState:function(){return{tokenize:a,cc:[],indented:0,startOfLine:true,tagName:null,tagStart:null,context:null}},token:function(e,t){if(!t.tagName&&e.sol()){t.startOfLine=true;t.indented=e.indentation()}if(e.eatSpace())return null;v=u=o=null;var n=t.tokenize(e,t);t.type=u;if((n||u)&&n!="comment"){p=t;d=e;while(true){var r=t.cc.pop()||w;if(r(u||n))break}}t.startOfLine=false;return v||n},indent:function(e,t,i){var o=e.context;if(e.tokenize!=f&&e.tokenize!=a||o&&o.noIndent)return i?i.match(/^(\s*)/)[0].length:0;if(e.tagName)return e.tagStart+n*r;if(s&&/<!\[CDATA\[/.test(t))return 0;if(o&&/^<\//.test(t))o=o.prev;while(o&&!o.startOfLine)o=o.prev;if(o)return o.indent+n;else return 0},electricChars:"/",configuration:t.htmlMode?"html":"xml"}});CodeMirror.defineMIME("text/xml","xml");CodeMirror.defineMIME("application/xml","xml");if(!CodeMirror.mimeModes.hasOwnProperty("text/html"))CodeMirror.defineMIME("text/html",{name:"xml",htmlMode:true});CodeMirror.defineMode("javascript",function(e,t){function u(e,t,n){t.tokenize=n;return n(e,t)}function a(e,t){var n=false,r;while((r=e.next())!=null){if(r==t&&!n)return false;n=!n&&r=="\\"}return n}function c(e,t,n){f=e;l=n;return t}function h(e,t){var n=e.next();if(n=='"'||n=="'")return u(e,t,p(n));else if(/[\[\]{}\(\),;\:\.]/.test(n))return c(n);else if(n=="0"&&e.eat(/x/i)){e.eatWhile(/[\da-f]/i);return c("number","number")}else if(/\d/.test(n)||n=="-"&&e.eat(/\d/)){e.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/);return c("number","number")}else if(n=="/"){if(e.eat("*")){return u(e,t,d)}else if(e.eat("/")){e.skipToEnd();return c("comment","comment")}else if(t.lastType=="operator"||t.lastType=="keyword c"||/^[\[{}\(,;:]$/.test(t.lastType)){a(e,"/");e.eatWhile(/[gimy]/);return c("regexp","string-2")}else{e.eatWhile(o);return c("operator",null,e.current())}}else if(n=="#"){e.skipToEnd();return c("error","error")}else if(o.test(n)){e.eatWhile(o);return c("operator",null,e.current())}else{e.eatWhile(/[\w\$_]/);var r=e.current(),i=s.propertyIsEnumerable(r)&&s[r];return i&&t.lastType!="."?c(i.type,i.style,r):c("variable","variable",r)}}function p(e){return function(t,n){if(!a(t,e))n.tokenize=h;return c("string","string")}}function d(e,t){var n=false,r;while(r=e.next()){if(r=="/"&&n){t.tokenize=h;break}n=r=="*"}return c("comment","comment")}function m(e,t,n,r,i,s){this.indented=e;this.column=t;this.type=n;this.prev=i;this.info=s;if(r!=null)this.align=r}function g(e,t){for(var n=e.localVars;n;n=n.next)if(n.name==t)return true}function y(e,t,n,i,s){var o=e.cc;b.state=e;b.stream=s;b.marked=null,b.cc=o;if(!e.lexical.hasOwnProperty("align"))e.lexical.align=true;while(true){var u=o.length?o.pop():r?O:A;if(u(n,i)){while(o.length&&o[o.length-1].lex)o.pop()();if(b.marked)return b.marked;if(n=="variable"&&g(e,i))return"variable-2";return t}}}function w(){for(var e=arguments.length-1;e>=0;e--)b.cc.push(arguments[e])}function E(){w.apply(null,arguments);return true}function S(e){function t(t){for(var n=t;n;n=n.next)if(n.name==e)return true;return false}var n=b.state;if(n.context){b.marked="def";if(t(n.localVars))return;n.localVars={name:e,next:n.localVars}}else{if(t(n.globalVars))return;n.globalVars={name:e,next:n.globalVars}}}function T(){b.state.context={prev:b.state.context,vars:b.state.localVars};b.state.localVars=x}function N(){b.state.localVars=b.state.context.vars;b.state.context=b.state.context.prev}function C(e,t){var n=function(){var n=b.state;n.lexical=new m(n.indented,b.stream.column(),e,null,n.lexical,t)};n.lex=true;return n}function k(){var e=b.state;if(e.lexical.prev){if(e.lexical.type==")")e.indented=e.lexical.indented;e.lexical=e.lexical.prev}}function L(e){return function(t){if(t==e)return E();else if(e==";")return w();else return E(arguments.callee)}}function A(e){if(e=="var")return E(C("vardef"),R,L(";"),k);if(e=="keyword a")return E(C("form"),O,A,k);if(e=="keyword b")return E(C("form"),A,k);if(e=="{")return E(C("}"),F,k);if(e==";")return E();if(e=="function")return E($);if(e=="for")return E(C("form"),L("("),C(")"),z,L(")"),k,A,k);if(e=="variable")return E(C("stat"),D);if(e=="switch")return E(C("form"),O,C("}","switch"),L("{"),F,k,k);if(e=="case")return E(O,L(":"));if(e=="default")return E(L(":"));if(e=="catch")return E(C("form"),T,L("("),J,L(")"),A,k,N);return w(C("stat"),O,L(";"),k)}function O(e){if(v.hasOwnProperty(e))return E(_);if(e=="function")return E($);if(e=="keyword c")return E(M);if(e=="(")return E(C(")"),M,L(")"),k,_);if(e=="operator")return E(O);if(e=="[")return E(C("]"),j(O,"]"),k,_);if(e=="{")return E(C("}"),j(H,"}"),k,_);return E()}function M(e){if(e.match(/[;\}\)\],]/))return w();return w(O)}function _(e,t){if(e=="operator"){if(/\+\+|--/.test(t))return E(_);if(t=="?")return E(O,L(":"),O);return E(O)}if(e==";")return;if(e=="(")return E(C(")"),j(O,")"),k,_);if(e==".")return E(P,_);if(e=="[")return E(C("]"),O,L("]"),k,_)}function D(e){if(e==":")return E(k,A);return w(_,L(";"),k)}function P(e){if(e=="variable"){b.marked="property";return E()}}function H(e,t){if(e=="variable"){b.marked="property";if(t=="get"||t=="set")return E(B)}else if(e=="number"||e=="string"){b.marked=e+" property"}if(v.hasOwnProperty(e))return E(L(":"),O)}function B(e){if(e==":")return E(O);if(e!="variable")return E(L(":"),O);b.marked="property";return E($)}function j(e,t){function n(r){if(r==",")return E(e,n);if(r==t)return E();return E(L(t))}return function(r){if(r==t)return E();else return w(e,n)}}function F(e){if(e=="}")return E();return w(A,F)}function I(e){if(e==":")return E(q);return w()}function q(e){if(e=="variable"){b.marked="variable-3";return E()}return w()}function R(e,t){if(e=="variable"){S(t);return i?E(I,U):E(U)}return w()}function U(e,t){if(t=="=")return E(O,U);if(e==",")return E(R)}function z(e){if(e=="var")return E(R,L(";"),X);if(e==";")return E(X);if(e=="variable")return E(W);return E(X)}function W(e,t){if(t=="in")return E(O);return E(_,X)}function X(e,t){if(e==";")return E(V);if(t=="in")return E(O);return E(O,L(";"),V)}function V(e){if(e!=")")E(O)}function $(e,t){if(e=="variable"){S(t);return E($)}if(e=="(")return E(C(")"),T,j(J,")"),k,A,N)}function J(e,t){if(e=="variable"){S(t);return i?E(I):E()}}var n=e.indentUnit;var r=t.json;var i=t.typescript;var s=function(){function e(e){return{type:e,style:"keyword"}}var t=e("keyword a"),n=e("keyword b"),r=e("keyword c");var s=e("operator"),o={type:"atom",style:"atom"};var u={"if":t,"while":t,"with":t,"else":n,"do":n,"try":n,"finally":n,"return":r,"break":r,"continue":r,"new":r,"delete":r,"throw":r,"var":e("var"),"const":e("var"),let:e("var"),"function":e("function"),"catch":e("catch"),"for":e("for"),"switch":e("switch"),"case":e("case"),"default":e("default"),"in":s,"typeof":s,"instanceof":s,"true":o,"false":o,"null":o,"undefined":o,NaN:o,Infinity:o,"this":e("this")};if(i){var a={type:"variable",style:"variable-3"};var f={"interface":e("interface"),"class":e("class"),"extends":e("extends"),constructor:e("constructor"),"public":e("public"),"private":e("private"),"protected":e("protected"),"static":e("static"),"super":e("super"),string:a,number:a,bool:a,any:a};for(var l in f){u[l]=f[l]}}return u}();var o=/[+\-*&%=<>!?|~^]/;var f,l;var v={atom:true,number:true,variable:true,string:true,regexp:true,"this":true};var b={state:null,column:null,marked:null,cc:null};var x={name:"this",next:{name:"arguments"}};k.lex=true;return{startState:function(e){return{tokenize:h,lastType:null,cc:[],lexical:new m((e||0)-n,0,"block",false),localVars:t.localVars,globalVars:t.globalVars,context:t.localVars&&{vars:t.localVars},indented:0}},token:function(e,t){if(e.sol()){if(!t.lexical.hasOwnProperty("align"))t.lexical.align=false;t.indented=e.indentation()}if(e.eatSpace())return null;var n=t.tokenize(e,t);if(f=="comment")return n;t.lastType=f;return y(t,n,f,l,e)},indent:function(e,t){if(e.tokenize==d)return CodeMirror.Pass;if(e.tokenize!=h)return 0;var r=t&&t.charAt(0),i=e.lexical;if(i.type=="stat"&&r=="}")i=i.prev;var s=i.type,o=r==s;if(s=="vardef")return i.indented+(e.lastType=="operator"||e.lastType==","?4:0);else if(s=="form"&&r=="{")return i.indented;else if(s=="form")return i.indented+n;else if(s=="stat")return i.indented+(e.lastType=="operator"||e.lastType==","?n:0);else if(i.info=="switch"&&!o)return i.indented+(/^(?:case|default)\b/.test(t)?n:2*n);else if(i.align)return i.column+(o?0:1);else return i.indented+(o?0:n)},electricChars:":{}",jsonMode:r}});CodeMirror.defineMIME("text/javascript","javascript");CodeMirror.defineMIME("text/ecmascript","javascript");CodeMirror.defineMIME("application/javascript","javascript");CodeMirror.defineMIME("application/ecmascript","javascript");CodeMirror.defineMIME("application/json",{name:"javascript",json:true});CodeMirror.defineMIME("text/typescript",{name:"javascript",typescript:true});CodeMirror.defineMIME("application/typescript",{name:"javascript",typescript:true});CodeMirror.defineMode("htmlmixed",function(e,t){function a(e,t){var s=t.htmlState.tagName;var o=n.token(e,t.htmlState);if(s=="script"&&/\btag\b/.test(o)&&e.current()==">"){var u=e.string.slice(Math.max(0,e.pos-100),e.pos).match(/\btype\s*=\s*("[^"]+"|'[^']+'|\S+)[^<]*$/i);u=u?u[1]:"";if(u&&/[\"\']/.test(u.charAt(0)))u=u.slice(1,u.length-1);for(var a=0;a<i.length;++a){var f=i[a];if(typeof f.matches=="string"?u==f.matches:f.matches.test(u)){if(f.mode){t.token=l;t.localMode=f.mode;t.localState=f.mode.startState&&f.mode.startState(n.indent(t.htmlState,""))}break}}}else if(s=="style"&&/\btag\b/.test(o)&&e.current()==">"){t.token=c;t.localMode=r;t.localState=r.startState(n.indent(t.htmlState,""))}return o}function f(e,t,n){var r=e.current();var i=r.search(t),s;if(i>-1)e.backUp(r.length-i);else if(s=r.match(/<\/?$/)){e.backUp(r.length);if(!e.match(t,false))e.match(r[0])}return n}function l(e,t){if(e.match(/^<\/\s*script\s*>/i,false)){t.token=a;t.localState=t.localMode=null;return a(e,t)}return f(e,/<\/\s*script\s*>/,t.localMode.token(e,t.localState))}function c(e,t){if(e.match(/^<\/\s*style\s*>/i,false)){t.token=a;t.localState=t.localMode=null;return a(e,t)}return f(e,/<\/\s*style\s*>/,r.token(e,t.localState))}var n=CodeMirror.getMode(e,{name:"xml",htmlMode:true});var r=CodeMirror.getMode(e,"css");var i=[],s=t&&t.scriptTypes;i.push({matches:/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^$/i,mode:CodeMirror.getMode(e,"javascript")});if(s)for(var o=0;o<s.length;++o){var u=s[o];i.push({matches:u.matches,mode:u.mode&&CodeMirror.getMode(e,u.mode)})}i.push({matches:/./,mode:CodeMirror.getMode(e,"text/plain")});return{startState:function(){var e=n.startState();return{token:a,localMode:null,localState:null,htmlState:e}},copyState:function(e){if(e.localState)var t=CodeMirror.copyState(e.localMode,e.localState);return{token:e.token,localMode:e.localMode,localState:t,htmlState:CodeMirror.copyState(n,e.htmlState)}},token:function(e,t){return t.token(e,t)},indent:function(e,t){if(!e.localMode||/^\s*<\//.test(t))return n.indent(e.htmlState,t);else if(e.localMode.indent)return e.localMode.indent(e.localState,t);else return CodeMirror.Pass},electricChars:"/{}:",innerMode:function(e){return{state:e.localState||e.htmlState,mode:e.localMode||n}}}},"xml","javascript","css");CodeMirror.defineMIME("text/html","htmlmixed")