This repository has been archived by the owner on Nov 9, 2017. It is now read-only.
/
codemirror-compressed-old.js
1 lines (1 loc) · 85.8 KB
/
codemirror-compressed-old.js
1
window.CodeMirror=function(){"use strict";function e(r,i){function ln(e){if(s.onDragEvent&&s.onDragEvent(dn,J(e)))return;G(e)}function pn(e){return e>=0&&e<_t.size}function vn(e){return U(_t,e)}function mn(e,t){Kt=!0;var n=t-e.height;for(var r=e;r;r=r.parent)r.height+=n}function gn(e,t){return e.styles||e.highlight(Mt,e.stateAfter=ui(z(e)),s.tabSize),e.getContent(s.tabSize,t,s.lineWrapping)}function yn(e){var t={line:0,ch:0};Bn(t,{line:_t.size-1,ch:vn(_t.size-1).text.length},Tt(e),t,t),Wt=!0}function bn(e){var t=[];return _t.iter(0,_t.size,function(e){t.push(e.text)}),t.join(e||"\n")}function wn(e){O.scrollTop!=It&&(It=wt.scrollTop=O.scrollTop,or([]))}function En(e){s.fixedGutter&&ot.style.left!=wt.scrollLeft+"px"&&(ot.style.left=wt.scrollLeft+"px"),wt.scrollTop!=It&&(It=wt.scrollTop,O.scrollTop!=It&&(O.scrollTop=It),or([])),s.onScroll&&s.onScroll(dn)}function Sn(e){function u(t){y&&(wt.draggable=!1),qt=!1,l(),c(),Math.abs(e.clientX-t.clientX)+Math.abs(e.clientY-t.clientY)<10&&(K(t),vr(n.line,n.ch,!0),er())}function m(e){if(i=="single")hr(n,e);else if(i=="double"){var t=Sr(e);vt(e,h)?hr(t.from,v):hr(h,t.to)}else i=="triple"&&(vt(e,h)?hr(v,gr({line:e.line,ch:0})):hr(h,gr({line:e.line+1,ch:0})))}function g(e){var t=ei(e,!0);if(t&&!dt(t,a)){Pt||Pn(),a=t,m(t),Wt=!1;var n=sr();if(t.line>=n.to||t.line<n.from)f=setTimeout(pi(function(){g(e)}),150)}}function b(e){clearTimeout(f);var t=ei(e);t&&m(t),K(e),er(),Wt=!0,w(),l()}cr(et(e,"shiftKey"));for(var t=Y(e);t!=kt;t=t.parentNode)if(t.parentNode==lt&&t!=ut)return;for(var t=Y(e);t!=kt;t=t.parentNode)if(t.parentNode==st)return s.onGutterClick&&s.onGutterClick(dn,St(st.childNodes,t)+Yt,e),K(e);var n=ei(e);switch(Z(e)){case 3:p&&ni(e);return;case 2:n&&vr(n.line,n.ch,!0),setTimeout(er,20),K(e);return}if(!n){Y(e)==wt&&K(e);return}Pt||Pn();var r=+(new Date),i="single";if(Ft&&Ft.time>r-400&&dt(Ft.pos,n))i="triple",K(e),setTimeout(er,20),xr(n.line);else if(jt&&jt.time>r-400&&dt(jt.pos,n)){i="double",Ft={time:r,pos:n},K(e);var o=Sr(n);hr(o.from,o.to)}else jt={time:r,pos:n};var a=n,f;if(s.dragDrop&&it&&!s.readOnly&&!dt(Ht.from,Ht.to)&&!vt(n,Ht.from)&&!vt(Ht.to,n)&&i=="single"){y&&(wt.draggable=!0);var l=tt(document,"mouseup",pi(u),!0),c=tt(wt,"drop",pi(u),!0);qt=!0,wt.dragDrop&&wt.dragDrop();return}K(e),i=="single"&&vr(n.line,n.ch,!0);var h=Ht.from,v=Ht.to,w=tt(document,"mousemove",pi(function(e){clearTimeout(f),K(e),!d&&!Z(e)?b(e):g(e)}),!0),l=tt(document,"mouseup",pi(b),!0)}function xn(e){for(var t=Y(e);t!=kt;t=t.parentNode)if(t.parentNode==st)return K(e);K(e)}function Tn(e){if(s.onDragEvent&&s.onDragEvent(dn,J(e)))return;K(e);var t=ei(e,!0),n=e.dataTransfer.files;if(!t||s.readOnly)return;if(n&&n.length&&window.FileReader&&window.File){var r=n.length,i=Array(r),o=0,u=function(e,n){var s=new FileReader;s.onload=function(){i[n]=s.result,++o==r&&(t=gr(t),pi(function(){var e=Wn(i.join(""),t,t);hr(t,e)})())},s.readAsText(e)};for(var a=0;a<r;++a)u(n[a],a)}else{if(qt&&!vt(t,Ht.from)&&!vt(Ht.to,t))return;try{var i=e.dataTransfer.getData("Text");i&&di(function(){var e=Ht.from,n=Ht.to;hr(t,t),qt&&Wn("",e,n),Xn(i),er()})}catch(e){}}}function Nn(e){var t=Jn();e.dataTransfer.setData("Text",t),e.dataTransfer.setDragImage&&e.dataTransfer.setDragImage(gt("img"),0,0)}function Cn(e,t){if(typeof e=="string"){e=a[e];if(!e)return!1}var n=Bt;try{s.readOnly&&(Ut=!0),t&&(Bt=null),e(dn)}catch(r){if(r!=rt)throw r;return!1}finally{Bt=n,Ut=!1}return!0}function Ln(e){function f(){a=!0}var t=l(s.keyMap),r=t.auto;clearTimeout(kn),r&&!h(e)&&(kn=setTimeout(function(){l(s.keyMap)==t&&(s.keyMap=r.call?r.call(null,dn):r)},50));var i=Ct[et(e,"keyCode")],o=!1,u=w&&n;if(i==null||e.altGraphKey)return!1;et(e,"altKey")&&(i="Alt-"+i),et(e,u?"metaKey":"ctrlKey")&&(i="Ctrl-"+i),et(e,u?"ctrlKey":"metaKey")&&(i="Cmd-"+i);var a=!1;return et(e,"shiftKey")?o=c("Shift-"+i,s.extraKeys,s.keyMap,function(e){return Cn(e,!0)},f)||c(i,s.extraKeys,s.keyMap,function(e){if(typeof e=="string"&&/^go[A-Z]/.test(e))return Cn(e)},f):o=c(i,s.extraKeys,s.keyMap,Cn,f),a&&(o=!1),o&&(K(e),ri(),d&&(e.oldKeyCode=e.keyCode,e.keyCode=0)),o}function An(e,t){var n=c("'"+t+"'",s.extraKeys,s.keyMap,function(e){return Cn(e,!0)});return n&&(K(e),ri()),n}function Mn(e){Pt||Pn(),d&&e.keyCode==27&&(e.returnValue=!1),on&&Yn()&&(on=!1);if(s.onKeyEvent&&s.onKeyEvent(dn,J(e)))return;var t=et(e,"keyCode");cr(t==16||et(e,"shiftKey"));var r=Ln(e);w&&(On=r?t:null,!r&&t==88&&et(e,n?"metaKey":"ctrlKey")&&Xn(""))}function _n(e){on&&Yn();if(s.onKeyEvent&&s.onKeyEvent(dn,J(e)))return;var t=et(e,"keyCode"),n=et(e,"charCode");if(w&&t==On){On=null,K(e);return}if((w&&(!e.which||e.which<10)||S)&&Ln(e))return;var r=String.fromCharCode(n==null?t:n);s.electricChars&&Mt.electricChars&&s.smartIndent&&!s.readOnly&&Mt.electricChars.indexOf(r)>-1&&setTimeout(pi(function(){Nr(Ht.to.line,"smart")}),75);if(An(e,r))return;Qn()}function Dn(e){if(s.onKeyEvent&&s.onKeyEvent(dn,J(e)))return;et(e,"keyCode")==16&&(Bt=null)}function Pn(){if(s.readOnly=="nocursor")return;Pt||(s.onFocus&&s.onFocus(dn),Pt=!0,wt.className.search(/\bCodeMirror-focused\b/)==-1&&(wt.className+=" CodeMirror-focused")),Kn(),ri()}function Hn(){Pt&&(s.onBlur&&s.onBlur(dn),Pt=!1,tn&&pi(function(){tn&&(tn(),tn=null)})(),wt.className=wt.className.replace(" CodeMirror-focused","")),clearInterval(Ot),setTimeout(function(){Pt||(Bt=null)},150)}function Bn(e,t,n,r,i){if(Ut)return;var o=[];_t.iter(e.line,t.line+1,function(e){o.push(H(e.text,e.markedSpans))});if(an){an.addChange(e.line,n.length,o);while(an.done.length>s.undoDepth)an.done.shift()}var u=_(P(o[0]),P(ht(o)),e.ch,t.ch,n);qn(e,t,u,r,i)}function jn(e,t){if(!e.length)return;var n=e.pop(),r=[];for(var i=n.length-1;i>=0;i-=1){var s=n[i],o=[],u=s.start+s.added;_t.iter(s.start,u,function(e){o.push(H(e.text,e.markedSpans))}),r.push({start:s.start,added:s.old.length,old:o});var a={line:s.start+s.old.length-1,ch:Et(D(ht(o)),D(ht(s.old)))};qn({line:s.start,ch:0},{line:u-1,ch:vn(u-1).text.length},s.old,a,a)}Wt=!0,t.push(r)}function Fn(){jn(an.done,an.undone)}function In(){jn(an.undone,an.done)}function qn(e,t,n,r,i){function w(e){return e<=Math.min(t.line,t.line+g)?e:e+g}if(Ut)return;var o=!1,u=nn.text.length;s.lineWrapping||_t.iter(e.line,t.line+1,function(e){if(!e.hidden&&e.text.length==u)return o=!0,!0});if(e.line!=t.line||n.length>1)Kt=!0;var a=t.line-e.line,f=vn(e.line),l=vn(t.line),c=ht(n);if(e.ch==0&&t.ch==0&&D(c)==""){var h=[],p=null;for(var d=0,v=n.length-1;d<v;++d)h.push(new I(D(n[d]),P(n[d])));l.update(l.text,P(c)),a&&_t.remove(e.line,a,Qt),h.length&&_t.insert(e.line,h)}else if(f==l)if(n.length==1)f.update(f.text.slice(0,e.ch)+D(n[0])+f.text.slice(t.ch),P(n[0]));else{for(var h=[],d=1,v=n.length-1;d<v;++d)h.push(new I(D(n[d]),P(n[d])));h.push(new I(D(c)+f.text.slice(t.ch),P(c))),f.update(f.text.slice(0,e.ch)+D(n[0]),P(n[0])),_t.insert(e.line+1,h)}else if(n.length==1)f.update(f.text.slice(0,e.ch)+D(n[0])+l.text.slice(t.ch),P(n[0])),_t.remove(e.line+1,a,Qt);else{var h=[];f.update(f.text.slice(0,e.ch)+D(n[0]),P(n[0])),l.update(D(c)+l.text.slice(t.ch),P(c));for(var d=1,v=n.length-1;d<v;++d)h.push(new I(D(n[d]),P(n[d])));a>1&&_t.remove(e.line+1,a-1,Qt),_t.insert(e.line+1,h)}if(s.lineWrapping){var m=Math.max(5,wt.clientWidth/Gr()-3);_t.iter(e.line,e.line+n.length,function(e){if(e.hidden)return;var t=Math.ceil(e.text.length/m)||1;t!=e.height&&mn(e,t)})}else _t.iter(e.line,e.line+n.length,function(e){var t=e.text;!e.hidden&&t.length>u&&(nn=e,u=t.length,sn=!0,o=!1)}),o&&(rn=!0);Dt=Math.min(Dt,e.line),fi(400);var g=n.length-a-1;Vt.push({from:e.line,to:t.line+1,diff:g});if(s.onChange){for(var d=0;d<n.length;++d)typeof n[d]!="string"&&(n[d]=n[d].text);var y={from:e,to:t,text:n};if($t){for(var b=$t;b.next;b=b.next);b.next=y}else $t=y}pr(gr(r),gr(i),w(Ht.from.line),w(Ht.to.line))}function Rn(){var e=_t.height*Jr()+2*Yr();return e*.99>wt.offsetHeight?e:!1}function Un(e){var t=Rn();O.style.display=t?"block":"none",t?(k.style.height=lt.style.minHeight=t+"px",O.style.height=wt.clientHeight+"px",e!=null&&(O.scrollTop=wt.scrollTop=e,y&&setTimeout(function(){if(O.scrollTop!=e)return;O.scrollTop=e+(e?-1:1),O.scrollTop=e},0))):lt.style.minHeight="",ut.style.top=Gt*Jr()+"px"}function zn(){nn=vn(0),sn=!0;var e=nn.text.length;_t.iter(1,_t.size,function(t){var n=t.text;!t.hidden&&n.length>e&&(e=n.length,nn=t)}),rn=!1}function Wn(e,t,n){function r(r){if(vt(r,t))return r;if(!vt(n,r))return i;var s=r.line+e.length-(n.line-t.line)-1,o=r.ch;return r.line==n.line&&(o+=ht(e).length-(n.ch-(n.line==t.line?t.ch:0))),{line:s,ch:o}}t=gr(t),n?n=gr(n):n=t,e=Tt(e);var i;return Vn(e,t,n,function(e){return i=e,{from:r(Ht.from),to:r(Ht.to)}}),i}function Xn(e,t){Vn(Tt(e),Ht.from,Ht.to,function(e){return t=="end"?{from:e,to:e}:t=="start"?{from:Ht.from,to:Ht.from}:{from:Ht.from,to:e}})}function Vn(e,t,n,r){var i=e.length==1?e[0].length+t.ch:ht(e).length,s=r({line:t.line+e.length-1,ch:i});Bn(t,n,e,s.from,s.to)}function $n(e,t,n){var r=e.line,i=t.line;if(r==i)return vn(r).text.slice(e.ch,t.ch);var s=[vn(r).text.slice(e.ch)];return _t.iter(r+1,i,function(e){s.push(e.text)}),s.push(vn(i).text.slice(0,t.ch)),s.join(n||"\n")}function Jn(e){return $n(Ht.from,Ht.to,e)}function Kn(){if(on)return;Lt.set(s.pollInterval,function(){Yn(),Pt&&Kn()})}function Qn(){function t(){var n=Yn();!n&&!e?(e=!0,Lt.set(60,t)):(on=!1,Kn())}var e=!1;on=!0,Lt.set(20,t)}function Yn(){if(!Pt||Nt(E)||s.readOnly)return!1;var e=E.value;if(e==Gn)return!1;hi||li(),Bt=null;var t=0,n=Math.min(Gn.length,e.length);while(t<n&&Gn[t]==e[t])++t;return t<Gn.length?Ht.from={line:Ht.from.line,ch:Ht.from.ch-(Gn.length-t)}:Rt&&dt(Ht.from,Ht.to)&&!zt&&(Ht.to={line:Ht.to.line,ch:Math.min(vn(Ht.to.line).text.length,Ht.to.ch+(e.length-t))}),Xn(e.slice(t),"end"),e.length>1e3?E.value=Gn="":Gn=e,hi||ci(),zt=!1,!0}function Zn(e){dt(Ht.from,Ht.to)?e&&(Gn=E.value=""):(Gn="",E.value=Jn(),Pt&&pt(E))}function er(){s.readOnly!="nocursor"&&E.focus()}function tr(){var e=nr();rr(e.x,e.y,e.x,e.yBot);if(!Pt)return;var t=lt.getBoundingClientRect(),n=null;e.y+t.top<0?n=!0:e.y+t.top+Jr()>(window.innerHeight||document.documentElement.clientHeight)&&(n=!1);if(n!=null){var r=j.style.display=="none";r&&(j.style.display="",j.style.left=e.x+"px",j.style.top=e.y-Gt+"px"),j.scrollIntoView(n),r&&(j.style.display="none")}}function nr(){var e=Ur(Ht.inverted?Ht.from:Ht.to),t=s.lineWrapping?Math.min(e.x,Q.offsetWidth):e.x;return{x:t,y:e.y,yBot:e.yBot}}function rr(e,t,n,r){var i=ir(e,t,n,r);i.scrollLeft!=null&&(wt.scrollLeft=i.scrollLeft),i.scrollTop!=null&&(O.scrollTop=wt.scrollTop=i.scrollTop)}function ir(e,t,n,r){var i=Zr(),o=Yr();t+=o,r+=o,e+=i,n+=i;var u=wt.clientHeight,a=O.scrollTop,f={},l=Rn()||Infinity,c=t<o+10,h=r+o>l-10;t<a?f.scrollTop=c?0:Math.max(0,t):r>a+u&&(f.scrollTop=(h?l:r)-u);var p=wt.clientWidth,d=wt.scrollLeft,v=s.fixedGutter?ot.clientWidth:0,m=e<v+i+10;return e<d+v||m?(m&&(e=0),f.scrollLeft=Math.max(0,e-10-v)):n>p+d-3&&(f.scrollLeft=n+10-p),f}function sr(e){var t=Jr(),n=(e!=null?e:O.scrollTop)-Yr(),r=Math.max(0,Math.floor(n/t)),i=Math.ceil((n+wt.clientHeight)/t);return{from:W(_t,r),to:W(_t,i)}}function or(e,t,n){function d(){var e=M.firstChild,t=!1;return _t.iter(Yt,Zt,function(n){if(!e)return;if(!n.hidden){var r=Math.round(e.offsetHeight/c)||1;n.height!=r&&(mn(n,r),Kt=t=!0)}e=e.nextSibling}),t}if(!wt.clientWidth){Yt=Zt=Gt=0;return}var r=sr(n);if(e!==!0&&e.length==0&&r.from>Yt&&r.to<Zt){Un(n);return}var i=Math.max(r.from-100,0),o=Math.min(_t.size,r.to+100);Yt<i&&i-Yt<20&&(i=Yt),Zt>o&&Zt-o<20&&(o=Math.min(_t.size,Zt));var u=e===!0?[]:ur([{from:Yt,to:Zt,domStart:0}],e),a=0;for(var f=0;f<u.length;++f){var l=u[f];l.from<i&&(l.domStart+=i-l.from,l.from=i),l.to>o&&(l.to=o),l.from>=l.to?u.splice(f--,1):a+=l.to-l.from}if(a==o-i&&i==Yt&&o==Zt){Un(n);return}u.sort(function(e,t){return e.domStart-t.domStart});var c=Jr(),h=ot.style.display;M.style.display="none",ar(i,o,u),M.style.display=ot.style.display="";var p=i!=Yt||o!=Zt||en!=wt.clientHeight+c;p&&(en=wt.clientHeight+c),(i!=Yt||o!=Zt&&s.onViewportChange)&&setTimeout(function(){s.onViewportChange&&s.onViewportChange(dn,i,o)}),Yt=i,Zt=o,Gt=X(_t,i),fi(100);if(M.childNodes.length!=Zt-Yt)throw new Error("BAD PATCH! "+JSON.stringify(u)+" size="+(Zt-Yt)+" nodes="+M.childNodes.length);return s.lineWrapping&&d(),ot.style.display=h,(p||Kt)&&fr()&&s.lineWrapping&&d()&&fr(),Un(n),lr(),!t&&s.onUpdate&&s.onUpdate(dn),!0}function ur(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];i.to<=f.from&&i.diff?s.push({from:f.from+o,to:f.to+o,domStart:f.domStart}):i.to<=f.from||i.from>=f.to?s.push(f):(i.from>f.from&&s.push({from:f.from,to:i.from,domStart:f.domStart}),i.to<f.to&&s.push({from:i.to+o,to:f.to+o,domStart:f.domStart+(i.to-f.from)}))}e=s}return e}function ar(e,t,n){function r(e){var t=e.nextSibling;return e.parentNode.removeChild(e),t}if(!n.length)yt(M);else{var i=0,s=M.firstChild,o;for(var u=0;u<n.length;++u){var a=n[u];while(a.domStart>i)s=r(s),i++;for(var f=0,l=a.to-a.from;f<l;++f)s=s.nextSibling,i++}while(s)s=r(s)}var c=n.shift(),s=M.firstChild,f=e;_t.iter(e,t,function(e){c&&c.to==f&&(c=n.shift());if(!c||c.from>f){if(e.hidden)var t=gt("pre");else{var t=gn(e);e.className&&(t.className=e.className);if(e.bgClassName){var r=gt("pre","\u00a0",e.bgClassName,"position: absolute; left: 0; right: 0; top: 0; bottom: 0; z-index: -2");t=gt("div",[r,t],null,"position: relative")}}M.insertBefore(t,s)}else s=s.nextSibling;++f})}function fr(){if(!s.gutter&&!s.lineNumbers)return;var e=ut.offsetHeight,t=wt.clientHeight;ot.style.height=(e-t<2?t:e)+"px";var n=document.createDocumentFragment(),r=Yt,i;_t.iter(Yt,Math.max(Zt,Yt+1),function(e){if(e.hidden)n.appendChild(gt("pre"));else{var t=e.gutterMarker,o=s.lineNumbers?s.lineNumberFormatter(r+s.firstLineNumber):null;t&&t.text?o=t.text.replace("%N%",o!=null?o:""):o==null&&(o="\u00a0");var u=n.appendChild(gt("pre",null,t&&t.style));u.innerHTML=o;for(var a=1;a<e.height;++a)u.appendChild(gt("br")),u.appendChild(document.createTextNode("\u00a0"));t||(i=r)}++r}),ot.style.display="none",bt(st,n);if(i!=null&&s.lineNumbers){var o=st.childNodes[i-Yt],u=String(_t.size).length,a=ft(o.firstChild),f="";while(a.length+f.length<u)f+="\u00a0";f&&o.insertBefore(document.createTextNode(f),o.firstChild)}ot.style.display="";var l=Math.abs((parseInt(Q.style.marginLeft)||0)-ot.offsetWidth)>2;return Q.style.marginLeft=ot.offsetWidth+"px",Kt=!1,l}function lr(){var e=dt(Ht.from,Ht.to),t=Ur(Ht.from,!0),n=e?t:Ur(Ht.to,!0),r=Ht.inverted?t:n,i=Jr(),o=at(kt),u=at(M);C.style.top=Math.max(0,Math.min(wt.offsetHeight,r.y+u.top-o.top))+"px",C.style.left=Math.max(0,Math.min(wt.offsetWidth,r.x+u.left-o.left))+"px";if(e)j.style.top=r.y+"px",j.style.left=(s.lineWrapping?Math.min(r.x,Q.offsetWidth):r.x)+"px",j.style.display="",B.style.display="none";else{var a=t.y==n.y,f=document.createDocumentFragment(),l=Q.clientWidth||Q.offsetWidth,c=Q.clientHeight||Q.offsetHeight,h=function(e,t,n,r){var i=g?"width: "+(n?l-n-e:l)+"px":"right: "+n+"px";f.appendChild(gt("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px; top: "+t+"px; "+i+"; height: "+r+"px"))};if(Ht.from.ch&&t.y>=0){var p=a?l-n.x:0;h(t.x,t.y,p,i)}var d=Math.max(0,t.y+(Ht.from.ch?i:0)),v=Math.min(n.y,c)-d;v>.2*i&&h(0,d,0,v),(!a||!Ht.from.ch)&&n.y<c-.5*i&&h(0,n.y,l-n.x,i),bt(B,f),j.style.display="none",B.style.display=""}}function cr(e){e?Bt=Bt||(Ht.inverted?Ht.to:Ht.from):Bt=null}function hr(e,t){var n=Bt&&gr(Bt);n&&(vt(n,e)?e=n:vt(t,n)&&(t=n)),pr(e,t),Xt=!0}function pr(e,t,n,r){un=null,n==null&&(n=Ht.from.line,r=Ht.to.line);if(dt(Ht.from,e)&&dt(Ht.to,t))return;if(vt(t,e)){var i=t;t=e,e=i}if(e.line!=n){var o=dr(e,n,Ht.from.ch);o?e=o:Ir(e.line,!1)}t.line!=r&&(t=dr(t,r,Ht.to.ch)),dt(e,t)?Ht.inverted=!1:dt(e,Ht.to)?Ht.inverted=!1:dt(t,Ht.from)&&(Ht.inverted=!0);if(s.autoClearEmptyLines&&dt(Ht.from,Ht.to)){var u=Ht.inverted?e:t;if(u.line!=Ht.from.line&&Ht.from.line<_t.size){var a=vn(Ht.from.line);/^\s+$/.test(a.text)&&setTimeout(pi(function(){if(a.parent&&/^\s+$/.test(a.text)){var e=z(a);Wn("",{line:e,ch:0},{line:e,ch:a.text.length})}},10))}}Ht.from=e,Ht.to=t,Jt=!0}function dr(e,t,n){function r(t){var r=e.line+t,i=t==1?_t.size:-1;while(r!=i){var o=vn(r);if(!o.hidden){var u=e.ch;if(s||u>n||u>o.text.length)u=o.text.length;return{line:r,ch:u}}r+=t}}var i=vn(e.line),s=e.ch==i.text.length&&e.ch!=n;return i.hidden?e.line>=t?r(1)||r(-1):r(-1)||r(1):e}function vr(e,t,n){var r=gr({line:e,ch:t||0});(n?hr:pr)(r,r)}function mr(e){return Math.max(0,Math.min(e,_t.size-1))}function gr(e){if(e.line<0)return{line:0,ch:0};if(e.line>=_t.size)return{line:_t.size-1,ch:vn(_t.size-1).text.length};var t=e.ch,n=vn(e.line).text.length;return t==null||t>n?{line:e.line,ch:n}:t<0?{line:e.line,ch:0}:e}function yr(e,t){function o(){for(var t=r+e,n=e<0?-1:_t.size;t!=n;t+=e){var i=vn(t);if(!i.hidden)return r=t,s=i,!0}}function u(t){if(i==(e<0?0:s.text.length)){if(!!t||!o())return!1;i=e<0?s.text.length:0}else i+=e;return!0}var n=Ht.inverted?Ht.from:Ht.to,r=n.line,i=n.ch,s=vn(r);if(t=="char")u();else if(t=="column")u(!0);else if(t=="word"){var a=!1;for(;;){if(e<0&&!u())break;if(xt(s.text.charAt(i)))a=!0;else if(a){e<0&&(e=1,u());break}if(e>0&&!u())break}}return{line:r,ch:i}}function br(e,t){var n=e<0?Ht.from:Ht.to;if(Bt||dt(Ht.from,Ht.to))n=yr(e,t);vr(n.line,n.ch,!0)}function wr(e,t){dt(Ht.from,Ht.to)?e<0?Wn("",yr(e,t),Ht.to):Wn("",Ht.from,yr(e,t)):Wn("",Ht.from,Ht.to),Xt=!0}function Er(e,t){var n=0,r=Ur(Ht.inverted?Ht.from:Ht.to,!0);un!=null&&(r.x=un);if(t=="page")var i=Math.min(wt.clientHeight,window.innerHeight||document.documentElement.clientHeight),s=zr(r.x,r.y+i*e);else if(t=="line")var o=Jr(),s=zr(r.x,r.y+.5*o+e*o);t=="page"&&(O.scrollTop+=Ur(s,!0).y-r.y),vr(s.line,s.ch,!0),un=r.x}function Sr(e){var t=vn(e.line).text,n=e.ch,r=e.ch;if(t){e.after===!1||r==t.length?--n:++r;var i=t.charAt(n),s=xt(i)?xt:/\s/.test(i)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!xt(e)};while(n>0&&s(t.charAt(n-1)))--n;while(r<t.length&&s(t.charAt(r)))++r}return{from:{line:e.line,ch:n},to:{line:e.line,ch:r}}}function xr(e){hr({line:e,ch:0},gr({line:e+1,ch:0}))}function Tr(e){if(dt(Ht.from,Ht.to))return Nr(Ht.from.line,e);var t=Ht.to.line-(Ht.to.ch?0:1);for(var n=Ht.from.line;n<=t;++n)Nr(n,e)}function Nr(e,t){t||(t="add");if(t=="smart")if(!Mt.indent)t="prev";else var n=ui(e);var r=vn(e),i=r.indentation(s.tabSize),o=r.text.match(/^\s*/)[0],u;t=="smart"&&(u=Mt.indent(n,r.text.slice(o.length),r.text),u==rt&&(t="prev")),t=="prev"?e?u=vn(e-1).indentation(s.tabSize):u=0:t=="add"?u=i+s.indentUnit:t=="subtract"&&(u=i-s.indentUnit),u=Math.max(0,u);var a=u-i,f="",l=0;if(s.indentWithTabs)for(var c=Math.floor(u/s.tabSize);c;--c)l+=s.tabSize,f+=" ";l<u&&(f+=ct(u-l)),f!=o&&Wn(f,{line:e,ch:0},{line:e,ch:o.length}),r.stateAfter=null}function Cr(){Mt=e.getMode(s,s.mode),_t.iter(0,_t.size,function(e){e.stateAfter=null}),Dt=0,fi(100)}function kr(){var e=s.gutter||s.lineNumbers;ot.style.display=e?"":"none",e?Kt=!0:M.parentNode.style.marginLeft=0}function Lr(e,t){if(s.lineWrapping){kt.className+=" CodeMirror-wrap";var n=wt.clientWidth/Gr()-3;_t.iter(0,_t.size,function(e){if(e.hidden)return;var t=Math.ceil(e.text.length/n)||1;t!=1&&mn(e,t)}),Q.style.minWidth=F.style.left=""}else kt.className=kt.className.replace(" CodeMirror-wrap",""),zn(),_t.iter(0,_t.size,function(e){e.height!=1&&!e.hidden&&mn(e,1)});Vt.push({from:0,to:_t.size})}function Ar(){wt.className=wt.className.replace(/\s*cm-s-\S+/g,"")+s.theme.replace(/(^|\s)\s*/g," cm-s-")}function Or(){var e=f[s.keyMap].style;kt.className=kt.className.replace(/\s*cm-keymap-\S+/g,"")+(e?" cm-keymap-"+e:"")}function Mr(e,t){this.lines=[],this.type=e,t&&(this.style=t)}function _r(e,t,n,r){e=gr(e),t=gr(t);var i=new Mr("range",n);if(r)for(var s in r)r.hasOwnProperty(s)&&(i[s]=r[s]);var o=e.line,u=[];return _t.iter(o,t.line+1,function(n){var r={from:o==e.line?e.ch:null,to:o==t.line?t.ch:null,marker:i};u.push(H(n.text,n.markedSpans)),n.markedSpans=(n.markedSpans||[]).concat([r]),i.lines.push(n),++o}),Vt.push({from:e.line,to:t.line+1}),an.addChange(e.line,u.length,u,!0),i}function Dr(e){e=gr(e);var t=new Mr("bookmark"),n=vn(e.line);an.addChange(e.line,1,[H(n.text,n.markedSpans)],!0);var r={from:e.ch,to:e.ch,marker:t};return n.markedSpans=(n.markedSpans||[]).concat([r]),t.lines.push(n),t}function Pr(e){e=gr(e);var t=[],n=vn(e.line).markedSpans;if(n)for(var r=0;r<n.length;++r){var i=n[r];(i.from==null||i.from<=e.ch)&&(i.to==null||i.to>=e.ch)&&t.push(i.marker)}return t}function Hr(e,t,n){return typeof e=="number"&&(e=vn(mr(e))),e.gutterMarker={text:t,style:n},Kt=!0,e}function Br(e){typeof e=="number"&&(e=vn(mr(e))),e.gutterMarker=null,Kt=!0}function jr(e,t){var n=e,r=e;return typeof e=="number"?r=vn(mr(e)):n=z(e),n==null?null:t(r,n)?(Vt.push({from:n,to:n+1}),r):null}function Fr(e,t,n){return jr(e,function(e){if(e.className!=t||e.bgClassName!=n)return e.className=t,e.bgClassName=n,!0})}function Ir(e,t){return jr(e,function(e,n){if(e.hidden!=t){e.hidden=t,s.lineWrapping||(t&&e.text.length==nn.text.length?rn=!0:!t&&e.text.length>nn.text.length&&(nn=e,rn=!1)),mn(e,t?0:1);var r=Ht.from.line,i=Ht.to.line;if(t&&(r==n||i==n)){var o=r==n?dr({line:r,ch:0},r,0):Ht.from,u=i==n?dr({line:i,ch:0},i,0):Ht.to;if(!u)return;pr(o,u)}return Kt=!0}})}function qr(e){if(typeof e=="number"){if(!pn(e))return null;var t=e;e=vn(e);if(!e)return null}else{var t=z(e);if(t==null)return null}var n=e.gutterMarker;return{line:t,handle:e,text:e.text,markerText:n&&n.text,markerClass:n&&n.style,lineClass:e.className,bgClass:e.bgClassName}}function Rr(e,t){if(t==0)return{top:0,left:0};var n=gn(e,t);bt($,n);var r=n.anchor,i=r.offsetTop,s=r.offsetLeft;if(d&&i==0&&s==0){var o=gt("span","x");r.parentNode.insertBefore(o,r.nextSibling),i=o.offsetTop}return{top:i,left:s}}function Ur(e,t){var n,r=Jr(),i=r*(X(_t,e.line)-(t?Gt:0));if(e.ch==0)n=0;else{var o=Rr(vn(e.line),e.ch);n=o.left,s.lineWrapping&&(i+=Math.max(0,o.top))}return{x:n,y:i,yBot:i+r}}function zr(e,t){function h(e){var t=Rr(u,e);if(f){var r=Math.round(t.top/n);return c=r!=l,Math.max(0,t.left+(r-l)*wt.clientWidth)}return t.left}var n=Jr(),r=Gr(),i=Gt+Math.floor(t/n);if(i<0)return{line:0,ch:0};var o=W(_t,i);if(o>=_t.size)return{line:_t.size-1,ch:vn(_t.size-1).text.length};var u=vn(o),a=u.text,f=s.lineWrapping,l=f?i-X(_t,o):0;if(e<=0&&l==0)return{line:o,ch:0};var c=!1,p=0,d=0,v=a.length,m,g=Math.min(v,Math.ceil((e+l*wt.clientWidth*.9)/r));for(;;){var y=h(g);if(!(y<=e&&g<v)){m=y,v=g;break}g=Math.min(v,Math.ceil(g*1.2))}if(e>m)return{line:o,ch:v};g=Math.floor(v*.8),y=h(g),y<e&&(p=g,d=y);for(;;){if(v-p<=1){var b=e-d<m-e;return{line:o,ch:b?p:v,after:b}}var w=Math.ceil((p+v)/2),E=h(w);E>e?(v=w,m=E,c&&(m+=1e3)):(p=w,d=E)}}function Wr(e){var t=Ur(e,!0),n=at(Q);return{x:n.left+t.x,y:n.top+t.y,yBot:n.top+t.yBot}}function Jr(){if($r==null){$r=gt("pre");for(var e=0;e<49;++e)$r.appendChild(document.createTextNode("x")),$r.appendChild(gt("br"));$r.appendChild(document.createTextNode("x"))}var t=M.clientHeight;return t==Vr?Xr:(Vr=t,bt($,$r.cloneNode(!0)),Xr=$.firstChild.offsetHeight/50||1,yt($),Xr)}function Gr(){if(wt.clientWidth==Qr)return Kr;Qr=wt.clientWidth;var e=gt("span","x"),t=gt("pre",[e]);return bt($,t),Kr=e.offsetWidth||10}function Yr(){return Q.offsetTop}function Zr(){return Q.offsetLeft}function ei(e,t){var n=at(wt,!0),r,i;try{r=e.clientX,i=e.clientY}catch(e){return null}if(!t&&(r-n.left>wt.clientWidth||i-n.top>wt.clientHeight))return null;var s=at(Q,!0);return zr(r-s.left,i-s.top)}function ni(e){function i(){C.style.position="relative",E.style.cssText=r,m&&(O.scrollTop=n),Kn();if(E.selectionStart!=null){clearTimeout(ti);var e=E.value=" "+(dt(Ht.from,Ht.to)?"":E.value),t=0;Gn=" ",E.selectionStart=1,E.selectionEnd=e.length,ti=setTimeout(function i(){Gn==" "&&E.selectionStart==0?pi(a.selectAll)(dn):t++<10?ti=setTimeout(i,500):Zn()},200)}}var t=ei(e),n=O.scrollTop;if(!t||w)return;(dt(Ht.from,Ht.to)||vt(t,Ht.from)||!vt(t,Ht.to))&&pi(vr)(t.line,t.ch);var r=E.style.cssText;C.style.position="absolute",E.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(e.clientY-5)+"px; left: "+(e.clientX-5)+"px; z-index: 1000; background: white; "+"border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",er(),Zn(!0),dt(Ht.from,Ht.to)&&(E.value=Gn=" ");if(p){G(e);var s=tt(window,"mouseup",function(){s(),setTimeout(i,20)},!0)}else setTimeout(i,50)}function ri(){clearInterval(Ot);var e=!0;j.style.visibility="",Ot=setInterval(function(){j.style.visibility=(e=!e)?"":"hidden"},s.cursorBlinkRate)}function si(e){function v(e,t,n){if(!e.text)return;var r=e.styles,i=o?0:e.text.length-1,s;for(var a=o?0:r.length-2,f=o?r.length:-2;a!=f;a+=2*u){var l=r[a];if(r[a+1]!=h){i+=u*l.length;continue}for(var c=o?0:l.length-1,v=o?l.length:-1;c!=v;c+=u,i+=u)if(i>=t&&i<n&&d.test(s=l.charAt(c))){var m=ii[s];if(m.charAt(1)==">"==o)p.push(s);else{if(p.pop()!=m.charAt(0))return{pos:i,match:!1};if(!p.length)return{pos:i,match:!0}}}}}var t=Ht.inverted?Ht.from:Ht.to,n=vn(t.line),r=t.ch-1,i=r>=0&&ii[n.text.charAt(r)]||ii[n.text.charAt(++r)];if(!i)return;var s=i.charAt(0),o=i.charAt(1)==">",u=o?1:-1,a=n.styles;for(var f=r+1,l=0,c=a.length;l<c;l+=2)if((f-=a[l].length)<=0){var h=a[l+1];break}var p=[n.text.charAt(r)],d=/[(){}[\]]/;for(var l=t.line,c=o?Math.min(l+100,_t.size):Math.max(-1,l-100);l!=c;l+=u){var n=vn(l),m=l==t.line,g=v(n,m&&o?r+1:0,m&&!o?r:n.text.length);if(g)break}g||(g={pos:null,match:!1});var h=g.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket",y=_r({line:t.line,ch:r},{line:t.line,ch:r+1},h),b=g.pos!=null&&_r({line:l,ch:g.pos},{line:l,ch:g.pos+1},h),w=pi(function(){y.clear(),b&&b.clear()});e?setTimeout(w,800):tn=w}function oi(e){var t,n;for(var r=e,i=e-40;r>i;--r){if(r==0)return 0;var o=vn(r-1);if(o.stateAfter)return r;var u=o.indentation(s.tabSize);if(n==null||t>u)n=r-1,t=u}return n}function ui(e){var t=oi(e),n=t&&vn(t-1).stateAfter;return n?n=T(Mt,n):n=N(Mt),_t.iter(t,e,function(r){r.process(Mt,n,s.tabSize),r.stateAfter=t==e-1||t%5==0?T(Mt,n):null}),n}function ai(){if(Dt>=Zt)return;var e=+(new Date)+s.workTime,t=T(Mt,ui(Dt)),n=Dt;_t.iter(Dt,Zt,function(n){Dt>=Yt?(n.highlight(Mt,t,s.tabSize),n.stateAfter=T(Mt,t)):(n.process(Mt,t,s.tabSize),n.stateAfter=Dt%5==0?T(Mt,t):null),++Dt;if(+(new Date)>e)return fi(s.workDelay),!0}),Zt>n&&Dt>=Yt&&pi(function(){Vt.push({from:n,to:Dt})})()}function fi(e){Dt<Zt&&At.set(e,ai)}function li(){Wt=Xt=$t=null,Vt=[],Jt=!1,Qt=[]}function ci(){rn&&zn();if(sn&&!s.lineWrapping){var e=F.offsetWidth,t=Rr(nn,nn.text.length).left;v||(F.style.left=t+"px",Q.style.minWidth=t+e+"px"),sn=!1}var n,r;if(Jt){var i=nr();n=ir(i.x,i.y,i.x,i.yBot)}if(Vt.length||n&&n.scrollTop!=null)r=or(Vt,!0,n&&n.scrollTop);r||(Jt&&lr(),Kt&&fr()),n&&tr(),Jt&&ri(),Pt&&(Wt===!0||Wt!==!1&&Jt)&&Zn(Xt),Jt&&s.matchBrackets&&setTimeout(pi(function(){tn&&(tn(),tn=null),dt(Ht.from,Ht.to)&&si(!1)}),20);var o=Jt,u=Qt;$t&&s.onChange&&dn&&s.onChange(dn,$t),o&&s.onCursorActivity&&s.onCursorActivity(dn);for(var a=0;a<u.length;++a)u[a](dn);r&&s.onUpdate&&s.onUpdate(dn)}function pi(e){return function(){hi++||li();try{var t=e.apply(this,arguments)}finally{--hi||ci()}return t}}function di(e){an.startCompound();try{return e()}finally{an.endCompound()}}var s={},u=e.defaults;for(var b in u)u.hasOwnProperty(b)&&(s[b]=(i&&i.hasOwnProperty(b)?i:u)[b]);var E=gt("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em");E.setAttribute("wrap","off"),E.setAttribute("autocorrect","off"),E.setAttribute("autocapitalize","off");var C=gt("div",[E],null,"overflow: hidden; position: relative; width: 3px; height: 0px;"),k=gt("div",null,"CodeMirror-scrollbar-inner"),O=gt("div",[k],"CodeMirror-scrollbar"),M=gt("div"),B=gt("div",null,null,"position: relative; z-index: -1"),j=gt("pre","\u00a0","CodeMirror-cursor"),F=gt("pre","\u00a0","CodeMirror-cursor","visibility: hidden"),$=gt("div",null,null,"position: absolute; width: 100%; height: 0px; overflow: hidden; visibility: hidden;"),Q=gt("div",[$,j,F,B,M],null,"position: relative; z-index: 0"),st=gt("div",null,"CodeMirror-gutter-text"),ot=gt("div",[st],"CodeMirror-gutter"),ut=gt("div",[ot,gt("div",[Q],"CodeMirror-lines")],null,"position: relative"),lt=gt("div",[ut],null,"position: relative"),wt=gt("div",[lt],"CodeMirror-scroll");wt.setAttribute("tabIndex","-1");var kt=gt("div",[C,O,wt],"CodeMirror"+(s.lineWrapping?" CodeMirror-wrap":""));r.appendChild?r.appendChild(kt):r(kt),Ar(),Or(),t&&(E.style.width="0px"),y||(wt.draggable=!0),Q.style.outline="none",s.tabindex!=null&&(E.tabIndex=s.tabindex),s.autofocus&&er(),!s.gutter&&!s.lineNumbers&&(ot.style.display="none"),S&&(C.style.height="1px",C.style.position="absolute"),x?(O.style.zIndex=-2,O.style.visibility="hidden"):v&&(O.style.minWidth="18px");var Lt=new nt,At=new nt,Ot,Mt,_t=new R([new q([new I("")])]),Dt=0,Pt;Cr();var Ht={from:{line:0,ch:0},to:{line:0,ch:0},inverted:!1},Bt,jt,Ft,It=0,qt,Rt=!1,Ut=!1,zt=!1,Wt,Xt,Vt,$t,Jt,Kt,Qt,Gt=0,Yt=0,Zt=0,en=0,tn,nn=vn(0),rn=!1,sn=!0,on=!1,un=null;pi(function(){yn(s.value||""),Wt=!1})();var an=new V;tt(wt,"mousedown",pi(Sn)),tt(wt,"dblclick",pi(xn)),tt(Q,"selectstart",K),p||tt(wt,"contextmenu",ni),tt(wt,"scroll",En),tt(O,"scroll",wn),tt(O,"mousedown",function(){Pt&&setTimeout(er,0)});var fn=tt(window,"resize",function(){kt.parentNode?or(!0):fn()},!0);tt(E,"keyup",pi(Dn)),tt(E,"input",Qn),tt(E,"keydown",pi(Mn)),tt(E,"keypress",pi(_n)),tt(E,"focus",Pn),tt(E,"blur",Hn),s.dragDrop&&(tt(wt,"dragstart",Nn),tt(wt,"dragenter",ln),tt(wt,"dragover",ln),tt(wt,"drop",pi(Tn))),tt(wt,"paste",function(){er(),Qn()}),tt(E,"paste",function(){zt=!0,Qn()}),tt(E,"cut",pi(function(){s.readOnly||Xn("")})),S&&tt(lt,"mouseup",function(){document.activeElement==E&&E.blur(),er()});var cn;try{cn=document.activeElement==E}catch(hn){}cn||s.autofocus?setTimeout(Pn,20):Hn();var dn=kt.CodeMirror={getValue:bn,setValue:pi(yn),getSelection:Jn,replaceSelection:pi(Xn),focus:function(){window.focus(),er(),Pn(),Qn()},setOption:function(e,t){var n=s[e];s[e]=t,e=="mode"||e=="indentUnit"?Cr():e=="readOnly"&&t=="nocursor"?(Hn(),E.blur()):e=="readOnly"&&!t?Zn(!0):e=="theme"?Ar():e=="lineWrapping"&&n!=t?pi(Lr)():e=="tabSize"?or(!0):e=="keyMap"?Or():e=="tabindex"&&(E.tabIndex=t);if(e=="lineNumbers"||e=="gutter"||e=="firstLineNumber"||e=="theme"||e=="lineNumberFormatter")kr(),or(!0)},getOption:function(e){return s[e]},getMode:function(){return Mt},undo:pi(Fn),redo:pi(In),indentLine:pi(function(e,t){typeof t!="string"&&(t==null?t=s.smartIndent?"smart":"prev":t=t?"add":"subtract"),pn(e)&&Nr(e,t)}),indentSelection:pi(Tr),historySize:function(){return{undo:an.done.length,redo:an.undone.length}},clearHistory:function(){an=new V},setHistory:function(e){an=new V,an.done=e.done,an.undone=e.undone},getHistory:function(){function e(e){for(var t=0,n=[],r;t<e.length;++t){n.push(r=[]);for(var i=0,s=e[t];i<s.length;++i){var o=[],u=s[i];r.push({start:u.start,added:u.added,old:o});for(var a=0;a<u.old.length;++a)o.push(D(u.old[a]))}}return n}return{done:e(an.done),undone:e(an.undone)}},matchBrackets:pi(function(){si(!0)}),getTokenAt:pi(function(e){return e=gr(e),vn(e.line).getTokenAt(Mt,ui(e.line),s.tabSize,e.ch)}),getStateAfter:function(e){return e=mr(e==null?_t.size-1:e),ui(e+1)},cursorCoords:function(e,t){return e==null&&(e=Ht.inverted),this.charCoords(e?Ht.from:Ht.to,t)},charCoords:function(e,t){return e=gr(e),t=="local"?Ur(e,!1):t=="div"?Ur(e,!0):Wr(e)},coordsChar:function(e){var t=at(Q);return zr(e.x-t.left,e.y-t.top)},markText:pi(_r),setBookmark:Dr,findMarksAt:Pr,setMarker:pi(Hr),clearMarker:pi(Br),setLineClass:pi(Fr),hideLine:pi(function(e){return Ir(e,!0)}),showLine:pi(function(e){return Ir(e,!1)}),onDeleteLine:function(e,t){if(typeof e=="number"){if(!pn(e))return null;e=vn(e)}return(e.handlers||(e.handlers=[])).push(t),e},lineInfo:qr,getViewport:function(){return{from:Yt,to:Zt}},addWidget:function(e,t,n,r,i){e=Ur(gr(e));var s=e.yBot,o=e.x;t.style.position="absolute",lt.appendChild(t);if(r=="over")s=e.y;else if(r=="near"){var u=Math.max(wt.offsetHeight,_t.height*Jr()),a=Math.max(lt.clientWidth,Q.clientWidth)-Zr();e.yBot+t.offsetHeight>u&&e.y>t.offsetHeight&&(s=e.y-t.offsetHeight),o+t.offsetWidth>a&&(o=a-t.offsetWidth)}t.style.top=s+Yr()+"px",t.style.left=t.style.right="",i=="right"?(o=lt.clientWidth-t.offsetWidth,t.style.right="0px"):(i=="left"?o=0:i=="middle"&&(o=(lt.clientWidth-t.offsetWidth)/2),t.style.left=o+Zr()+"px"),n&&rr(o,s,o+t.offsetWidth,s+t.offsetHeight)},lineCount:function(){return _t.size},clipPos:gr,getCursor:function(e){return e==null&&(e=Ht.inverted),mt(e?Ht.from:Ht.to)},somethingSelected:function(){return!dt(Ht.from,Ht.to)},setCursor:pi(function(e,t,n){t==null&&typeof e.line=="number"?vr(e.line,e.ch,n):vr(e,t,n)}),setSelection:pi(function(e,t,n){(n?hr:pr)(gr(e),gr(t||e))}),getLine:function(e){if(pn(e))return vn(e).text},getLineHandle:function(e){if(pn(e))return vn(e)},setLine:pi(function(e,t){pn(e)&&Wn(t,{line:e,ch:0},{line:e,ch:vn(e).text.length})}),removeLine:pi(function(e){pn(e)&&Wn("",{line:e,ch:0},gr({line:e+1,ch:0}))}),replaceRange:pi(Wn),getRange:function(e,t,n){return $n(gr(e),gr(t),n)},triggerOnKeyDown:pi(Mn),execCommand:function(e){return a[e](dn)},moveH:pi(br),deleteH:pi(wr),moveV:pi(Er),toggleOverwrite:function(){Rt?(Rt=!1,j.className=j.className.replace(" CodeMirror-overwrite","")):(Rt=!0,j.className+=" CodeMirror-overwrite")},posFromIndex:function(e){var t=0,n;return _t.iter(0,_t.size,function(r){var i=r.text.length+1;if(i>e)return n=e,!0;e-=i,++t}),gr({line:t,ch:n})},indexFromPos:function(e){if(e.line<0||e.ch<0)return 0;var t=e.ch;return _t.iter(0,e.line,function(e){t+=e.text.length+1}),t},scrollTo:function(e,t){e!=null&&(wt.scrollLeft=e),t!=null&&(O.scrollTop=wt.scrollTop=t),or([])},getScrollInfo:function(){return{x:wt.scrollLeft,y:O.scrollTop,height:O.scrollHeight,width:wt.scrollWidth}},setSize:function(e,t){function n(e){return e=String(e),/^\d+$/.test(e)?e+"px":e}e!=null&&(kt.style.width=n(e)),t!=null&&(wt.style.height=n(t)),dn.refresh()},operation:function(e){return pi(e)()},compoundChange:function(e){return di(e)},refresh:function(){or(!0,null,It),O.scrollHeight>It&&(O.scrollTop=It)},getInputField:function(){return E},getWrapperElement:function(){return kt},getScrollerElement:function(){return wt},getGutterElement:function(){return ot}},kn,On=null,Gn="";Mr.prototype.clear=pi(function(){var e,t,n={};for(var r=0;r<this.lines.length;++r){var i=this.lines[r],s=z(i);n[s]=H(i.text,i.markedSpans);var o=L(i.markedSpans,this);o.from!=null&&(e=s),o.to!=null&&(t=s),i.markedSpans=A(i.markedSpans,o)}if(e!=null){Vt.push({from:e,to:t+1});var u=[];for(var r=e;r<=t;++r)u.push(n[r]);an.addChange(e,u.length,u,!0)}this.lines.length=0}),Mr.prototype.find=function(){var e,t;for(var n=0;n<this.lines.length;++n){var r=this.lines[n],i=L(r.markedSpans,this);if(i.from!=null||i.to!=null){var s=z(r);i.from!=null&&(e={line:s,ch:i.from}),i.to!=null&&(t={line:s,ch:i.to})}}return this.type=="bookmark"?e:e&&{from:e,to:t}};var Xr,Vr,$r,Kr,Qr=0,ti,ii={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},hi=0;for(var vi in o)o.propertyIsEnumerable(vi)&&!dn.propertyIsEnumerable(vi)&&(dn[vi]=o[vi]);return dn}function l(e){return typeof e=="string"?f[e]:e}function c(e,t,n,r,i){function s(t){t=l(t);var n=t[e];if(n===!1)return i&&i(),!0;if(n!=null&&r(n))return!0;if(t.nofallthrough)return i&&i(),!0;var o=t.fallthrough;if(o==null)return!1;if(Object.prototype.toString.call(o)!="[object Array]")return s(o);for(var u=0,a=o.length;u<a;++u)if(s(o[u]))return!0;return!1}return t&&s(t)?!0:s(n)}function h(e){var t=Ct[et(e,"keyCode")];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function T(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function N(e,t,n){return e.startState?e.startState(t,n):!0}function C(e,t){this.pos=this.start=0,this.string=e,this.tabSize=t||8}function k(e,t,n){this.from=e,this.to=t,this.marker=n}function L(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function A(e,t){var n;for(var r=0;r<e.length;++r)e[r]==t&&(n||(n=[])).push(e[r]);return n}function O(e,t,n){if(e)for(var r=0,i;r<e.length;++r){var s=e[r],o=s.marker,u=s.from==null||(o.inclusiveLeft?s.from<=t:s.from<t);if(u||o.type=="bookmark"&&s.from==t&&s.from!=n){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 M(e,t){if(e)for(var n=0,r;n<e.length;++n){var i=e[n],s=i.marker,o=i.to==null||(s.inclusiveRight?i.to>=t:i.to>t);if(o||s.type=="bookmark"&&i.from==t){var u=i.from==null||(s.inclusiveLeft?i.from<=t:i.from<t);(r||(r=[])).push({from:u?null:i.from-t,to:i.to==null?null:i.to-t,marker:s})}}return r}function _(e,t,n,r,i){if(!e&&!t)return i;var s=O(e,n),o=M(t,r),u=i.length==1,a=ht(i).length+(u?n:0);if(s)for(var f=0;f<s.length;++f){var l=s[f];if(l.to==null){var c=L(o,l.marker);c?u&&(l.to=c.to==null?null:c.to+a):l.to=n}}if(o)for(var f=0;f<o.length;++f){var l=o[f];l.to!=null&&(l.to+=a);if(l.from==null){var c=L(s,l.marker);c||(l.from=a,u&&(s||(s=[])).push(l))}else l.from+=a,u&&(s||(s=[])).push(l)}var h=[H(i[0],s)];if(!u){var p=i.length-2,d;if(p>0&&s)for(var f=0;f<s.length;++f)s[f].to==null&&(d||(d=[])).push({from:null,to:null,marker:s[f].marker});for(var f=0;f<p;++f)h.push(H(i[f+1],d));h.push(H(ht(i),o))}return h}function D(e){return typeof e=="string"?e:e.text}function P(e){return typeof e=="string"?null:e.markedSpans}function H(e,t){return t?{text:e,markedSpans:t}:e}function B(e){var t=e.markedSpans;if(!t)return;for(var n=0;n<t.length;++n){var r=t[n].marker.lines,i=St(r,e);r.splice(i,1)}e.markedSpans=null}function j(e,t){if(!t)return;for(var n=0;n<t.length;++n)var r=t[n].marker.lines.push(e);e.markedSpans=t}function I(e,t){this.text=e,this.height=1,j(this,t)}function q(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 R(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 U(e,t){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 z(e){if(e.parent==null)return null;var t=e.parent,n=St(t.lines,e);for(var r=t.parent;r;t=r,r=r.parent)for(var i=0,s=r.children.length;;++i){if(r.children[i]==t)break;n+=r.children[i].chunkSize()}return n}function W(e,t){var n=0;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 X(e,t){var n=0;e:do{for(var r=0,i=e.children.length;r<i;++r){var s=e.children[r],o=s.chunkSize();if(t<o){e=s;continue e}t-=o,n+=s.height}return n}while(!e.lines);for(var r=0;r<t;++r)n+=e.lines[r].height;return n}function V(){this.time=0,this.done=[],this.undone=[],this.compound=0,this.closed=!1}function $(){G(this)}function J(e){return e.stop||(e.stop=$),e}function K(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Q(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function G(e){K(e),Q(e)}function Y(e){return e.target||e.srcElement}function Z(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),n&&e.ctrlKey&&t==1&&(t=3),t}function et(e,t){var n=e.override&&e.override.hasOwnProperty(t);return n?e.override[t]:e[t]}function tt(e,t,n,r){if(typeof e.addEventListener=="function"){e.addEventListener(t,n,!1);if(r)return function(){e.removeEventListener(t,n,!1)}}else{var i=function(e){n(e||window.event)};e.attachEvent("on"+t,i);if(r)return function(){e.detachEvent("on"+t,i)}}}function nt(){this.id=null}function ut(e,t,n){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var r=0,i=0;r<t;++r)e.charAt(r)==" "?i+=n-i%n:++i;return i}function at(e,t){try{var n=e.getBoundingClientRect();n={top:n.top,left:n.left}}catch(r){n={top:0,left:0}}if(!t)if(window.pageYOffset==null){var i=document.documentElement||document.body.parentNode;i.scrollTop==null&&(i=document.body),n.top+=i.scrollTop,n.left+=i.scrollLeft}else n.top+=window.pageYOffset,n.left+=window.pageXOffset;return n}function ft(e){return e.textContent||e.innerText||e.nodeValue||""}function ct(e){while(lt.length<=e)lt.push(ht(lt)+" ");return lt[e]}function ht(e){return e[e.length-1]}function pt(e){t?(e.selectionStart=0,e.selectionEnd=e.value.length):e.select()}function dt(e,t){return e.line==t.line&&e.ch==t.ch}function vt(e,t){return e.line<t.line||e.line==t.line&&e.ch<t.ch}function mt(e){return{line:e.line,ch:e.ch}}function gt(e,t,n,r){var i=document.createElement(e);n&&(i.className=n),r&&(i.style.cssText=r);if(typeof t=="string")wt(i,t);else if(t)for(var s=0;s<t.length;++s)i.appendChild(t[s]);return i}function yt(e){return e.innerHTML="",e}function bt(e,t){yt(e).appendChild(t)}function wt(e,t){m?(e.innerHTML="",e.appendChild(document.createTextNode(t))):e.textContent=t}function Et(e,t){if(!t)return 0;if(!e)return t.length;for(var n=e.length,r=t.length;n>=0&&r>=0;--n,--r)if(e.charAt(n)!=t.charAt(r))break;return r+1}function St(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 xt(e){return/\w/.test(e)||e.toUpperCase()!=e.toLowerCase()}e.defaults={value:"",mode:null,theme:"default",indentUnit:2,indentWithTabs:!1,smartIndent:!0,tabSize:4,keyMap:"default",extraKeys:null,electricChars:!0,autoClearEmptyLines:!1,onKeyEvent:null,onDragEvent:null,lineWrapping:!1,lineNumbers:!1,gutter:!1,fixedGutter:!1,firstLineNumber:1,readOnly:!1,dragDrop:!0,onChange:null,onCursorActivity:null,onViewportChange:null,onGutterClick:null,onUpdate:null,onFocus:null,onBlur:null,onScroll:null,matchBrackets:!1,cursorBlinkRate:530,workTime:100,workDelay:200,pollInterval:100,undoDepth:40,tabindex:null,autofocus:null,lineNumberFormatter:function(e){return e}};var t=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),n=t||/Mac/.test(navigator.platform),r=/Win/.test(navigator.platform),i=e.modes={},s=e.mimeModes={};e.defineMode=function(t,n){!e.defaults.mode&&t!="null"&&(e.defaults.mode=t);if(arguments.length>2){n.dependencies=[];for(var r=2;r<arguments.length;++r)n.dependencies.push(arguments[r])}i[t]=n},e.defineMIME=function(e,t){s[e]=t},e.resolveMode=function(t){if(typeof t=="string"&&s.hasOwnProperty(t))t=s[t];else if(typeof t=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(t))return e.resolveMode("application/xml");return typeof t=="string"?{name:t}:t||{name:"null"}},e.getMode=function(t,n){var n=e.resolveMode(n),r=i[n.name];if(!r)return e.getMode(t,"text/plain");var s=r(t,n);if(u.hasOwnProperty(n.name)){var o=u[n.name];for(var a in o)o.hasOwnProperty(a)&&(s[a]=o[a])}return s.name=n.name,s},e.listModes=function(){var e=[];for(var t in i)i.propertyIsEnumerable(t)&&e.push(t);return e},e.listMIMEs=function(){var e=[];for(var t in s)s.propertyIsEnumerable(t)&&e.push({mime:t,mode:s[t]});return e};var o=e.extensions={};e.defineExtension=function(e,t){o[e]=t};var u=e.modeExtensions={};e.extendMode=function(e,t){var n=u.hasOwnProperty(e)?u[e]:u[e]={};for(var r in t)t.hasOwnProperty(r)&&(n[r]=t[r])};var a=e.commands={selectAll:function(e){e.setSelection({line:0,ch:0},{line:e.lineCount()-1})},killLine:function(e){var t=e.getCursor(!0),n=e.getCursor(!1),r=!dt(t,n);!r&&e.getLine(t.line).length==t.ch?e.replaceRange("",t,{line:t.line+1,ch:0}):e.replaceRange("",t,r?n:{line:t.line})},deleteLine:function(e){var t=e.getCursor().line;e.replaceRange("",{line:t,ch:0},{line:t})},undo:function(e){e.undo()},redo:function(e){e.redo()},goDocStart:function(e){e.setCursor(0,0,!0)},goDocEnd:function(e){e.setSelection({line:e.lineCount()-1},null,!0)},goLineStart:function(e){e.setCursor(e.getCursor().line,0,!0)},goLineStartSmart:function(e){var t=e.getCursor(),n=e.getLine(t.line),r=Math.max(0,n.search(/\S/));e.setCursor(t.line,t.ch<=r&&t.ch?0:r,!0)},goLineEnd:function(e){e.setSelection({line:e.getCursor().line},null,!0)},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")},goWordRight:function(e){e.moveH(1,"word")},delCharLeft:function(e){e.deleteH(-1,"char")},delCharRight:function(e){e.deleteH(1,"char")},delWordLeft:function(e){e.deleteH(-1,"word")},delWordRight:function(e){e.deleteH(1,"word")},indentAuto:function(e){e.indentSelection("smart")},indentMore:function(e){e.indentSelection("add")},indentLess:function(e){e.indentSelection("subtract")},insertTab:function(e){e.replaceSelection(" ","end")},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.replaceSelection(" ","end")},transposeChars:function(e){var t=e.getCursor(),n=e.getLine(t.line);t.ch>0&&t.ch<n.length-1&&e.replaceRange(n.charAt(t.ch)+n.charAt(t.ch-1),{line:t.line,ch:t.ch-1},{line:t.line,ch:t.ch+1})},newlineAndIndent:function(e){e.replaceSelection("\n","end"),e.indentLine(e.getCursor().line)},toggleOverwrite:function(e){e.toggleOverwrite()}},f=e.keyMap={};f.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharRight",Backspace:"delCharLeft",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite"},f.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":"goWordLeft","Ctrl-Right":"goWordRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delWordLeft","Ctrl-Delete":"delWordRight","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"},f.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":"goWordLeft","Alt-Right":"goWordRight","Cmd-Left":"goLineStart","Cmd-Right":"goLineEnd","Alt-Backspace":"delWordLeft","Ctrl-Alt-Backspace":"delWordRight","Alt-Delete":"delWordRight","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"]},f["default"]=n?f.macDefault:f.pcDefault,f.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":"goPageUp","Shift-Ctrl-V":"goPageDown","Ctrl-D":"delCharRight","Ctrl-H":"delCharLeft","Alt-D":"delWordRight","Alt-Backspace":"delWordLeft","Ctrl-K":"killLine","Ctrl-T":"transposeChars"},e.isModifierKey=h,e.fromTextArea=function(t,n){function s(){t.value=a.getValue()}n||(n={}),n.value=t.value,!n.tabindex&&t.tabindex&&(n.tabindex=t.tabindex);if(n.autofocus==null){var r=document.body;try{r=document.activeElement}catch(i){}n.autofocus=r==t||t.getAttribute("autofocus")!=null&&r==document.body}if(t.form){var o=tt(t.form,"submit",s,!0);if(typeof t.form.submit=="function"){var u=t.form.submit;t.form.submit=function f(){s(),t.form.submit=u,t.form.submit(),t.form.submit=f}}}t.style.display="none";var a=e(function(e){t.parentNode.insertBefore(e,t.nextSibling)},n);return a.save=s,a.getTextArea=function(){return t},a.toTextArea=function(){s(),t.parentNode.removeChild(a.getWrapperElement()),t.style.display="",t.form&&(o(),typeof t.form.submit=="function"&&(t.form.submit=u))},a};var p=/gecko\/\d{7}/i.test(navigator.userAgent),d=/MSIE \d/.test(navigator.userAgent),v=/MSIE [1-7]\b/.test(navigator.userAgent),m=/MSIE [1-8]\b/.test(navigator.userAgent),g=d&&document.documentMode==5,y=/WebKit\//.test(navigator.userAgent),b=/Chrome\//.test(navigator.userAgent),w=/Opera\//.test(navigator.userAgent),E=/Apple Computer/.test(navigator.vendor),S=/KHTML\//.test(navigator.userAgent),x=/Mac OS X 10\D([7-9]|\d\d)\D/.test(navigator.userAgent);e.copyState=T,e.startState=N,e.innerMode=function(e,t){while(e.innerMode){var n=e.innerMode(t);t=n.state,e=n.mode}return n||{mode:e,state:t}},C.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)return++this.pos,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)return this.pos=t,!0},backUp:function(e){this.pos-=e},column:function(){return ut(this.string,this.start,this.tabSize)},indentation:function(){return ut(this.string,null,this.tabSize)},match:function(e,t,n){if(typeof e!="string"){var i=this.string.slice(this.pos).match(e);return i&&i.index>0?null:(i&&t!==!1&&(this.pos+=i[0].length),i)}var r=function(e){return n?e.toLowerCase():e};if(r(this.string).indexOf(r(e),this.pos)==this.pos)return t!==!1&&(this.pos+=e.length),!0},current:function(){return this.string.slice(this.start,this.pos)}},e.StringStream=C;var F=" ";p||d&&!v?F="\u200b":w&&(F=""),I.prototype={update:function(e,t){this.text=e,this.stateAfter=this.styles=null,B(this),j(this,t)},highlight:function(e,t,n){var r=new C(this.text,n),i=this.styles||(this.styles=[]),s=i.length=0;this.text==""&&e.blankLine&&e.blankLine(t);while(!r.eol()){var o=e.token(r,t),u=r.current();r.start=r.pos,s&&i[s-1]==o?i[s-2]+=u:u&&(i[s++]=u,i[s++]=o);if(r.pos>5e3){i[s++]=this.text.slice(r.pos),i[s++]=null;break}}},process:function(e,t,n){var r=new C(this.text,n);this.text==""&&e.blankLine&&e.blankLine(t);while(!r.eol()&&r.pos<=5e3)e.token(r,t),r.start=r.pos},getTokenAt:function(e,t,n,r){var i=this.text,s=new C(i,n);while(s.pos<r&&!s.eol()){s.start=s.pos;var o=e.token(s,t)}return{start:s.start,end:s.pos,string:s.current(),className:o||null,state:t}},indentation:function(e){return ut(this.text,null,e)},getContent:function(e,t,n){function u(t,n,o){if(!n)return;r&&d&&n.charAt(0)==" "&&(n="\u00a0"+n.slice(1)),r=!1;if(!s.test(n)){i+=n.length;var u=document.createTextNode(n)}else{var u=document.createDocumentFragment(),a=0;for(;;){s.lastIndex=a;var f=s.exec(n),l=f?f.index-a:n.length-a;l&&(u.appendChild(document.createTextNode(n.slice(a,a+l))),i+=l);if(!f)break;a+=l+1;if(f[0]==" "){var c=e-i%e;u.appendChild(gt("span",ct(c),"cm-tab")),i+=c}else{var h=gt("span","\u2022","cm-invalidchar");h.title="\\u"+f[0].charCodeAt(0).toString(16),u.appendChild(h),i+=1}}}o?t.appendChild(gt("span",[u],o)):t.appendChild(u)}function g(e){return e?"cm-"+e.replace(/ +/g," cm-"):null}var r=!0,i=0,s=/[\t\u0000-\u0019\u200b\u2028\u2029\uFEFF]/g,o=gt("pre"),a=u;if(t!=null){var f=0,l=o.anchor=gt("span");a=function(e,r,i){var s=r.length;if(t>=f&&t<f+s){var o=t-f;if(o){u(e,r.slice(0,o),i);if(n){var c=r.slice(o-1,o+1);ot.test(c)?e.appendChild(gt("wbr")):!v&&/\w\w/.test(c)&&e.appendChild(document.createTextNode("\u200d"))}}e.appendChild(l),u(l,w?r.slice(o,o+1):r.slice(o),i),w&&u(e,r.slice(o+1),i),t--,f+=s}else f+=s,u(e,r,i),f==t&&f==m?(wt(l,F),e.appendChild(l)):f>t+10&&/\s/.test(r)&&(a=function(){})}}var c=this.styles,h=this.text,p=this.markedSpans,m=h.length;if(!h&&t==null)a(o," ");else if(!p||!p.length)for(var y=0,b=0;b<m;y+=2){var E=c[y],S=c[y+1],x=E.length;b+x>m&&(E=E.slice(0,m-b)),b+=x,a(o,E,g(S))}else{p.sort(function(e,t){return e.from-t.from});var T=0,y=0,N="",S,C=0,k=p[0].from||0,L=[],A=0,O=function(){var e;while(A<p.length&&((e=p[A]).from==T||e.from==null))e.marker.type=="range"&&L.push(e),++A;k=A<p.length?p[A].from:Infinity;for(var t=0;t<L.length;++t){var n=L[t].to;n==null&&(n=Infinity),n==T?L.splice(t--,1):k=Math.min(n,k)}},M=0;while(T<m){k==T&&O();var _=Math.min(m,k);for(;;){if(N){var D=T+N.length,P=S;for(var H=0;H<L.length;++H){var B=L[H];P=(P?P+" ":"")+B.marker.style,B.marker.endStyle&&B.to===Math.min(D,_)&&(P+=" "+B.marker.endStyle),B.marker.startStyle&&B.from===T&&(P+=" "+B.marker.startStyle)}a(o,D>_?N.slice(0,_-T):N,P);if(D>=_){N=N.slice(_-T),T=_;break}T=D}N=c[y++],S=g(c[y++])}}}return o},cleanUp:function(){this.parent=null,B(this)}},q.prototype={chunkSize:function(){return this.lines.length},remove:function(e,t,n){for(var r=e,i=e+t;r<i;++r){var s=this.lines[r];this.height-=s.height,s.cleanUp();if(s.handlers)for(var o=0;o<s.handlers.length;++o)n.push(s.handlers[o])}this.lines.splice(e,t)},collapse:function(e){e.splice.apply(e,[e.length,0].concat(this.lines))},insertHeight: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!0}},R.prototype={chunkSize:function(){return this.size},remove:function(e,t,n){this.size-=t;for(var r=0;r<this.children.length;++r){var i=this.children[r],s=i.chunkSize();if(e<s){var o=Math.min(t,s-e),u=i.height;i.remove(e,o,n),this.height-=u-i.height,s==o&&(this.children.splice(r--,1),i.parent=null);if((t-=o)==0)break;e=0}else e-=s}if(this.size-t<25){var a=[];this.collapse(a),this.children=[new q(a)],this.children[0].parent=this}},collapse:function(e){for(var t=0,n=this.children.length;t<n;++t)this.children[t].collapse(e)},insert:function(e,t){var n=0;for(var r=0,i=t.length;r<i;++r)n+=t[r].height;this.insertHeight(e,t,n)},insertHeight: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.insertHeight(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),a=new q(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),n=new R(t);if(!e.parent){var r=new R(e.children);r.parent=e,e.children=[r,n],e=r}else{e.size-=n.size,e.height-=n.height;var i=St(e.parent.children,e);e.parent.children.splice(i+1,0,n)}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iter:function(e,t,n){this.iterN(e,t-e,n)},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!0;if((t-=u)==0)break;e=0}else e-=o}}},V.prototype={addChange:function(e,t,n,r){this.undone.length=0;var i=+(new Date),s=ht(this.done),o=s&&ht(s),u=i-this.time;if(s&&!this.closed&&(this.compound||r))s.push({start:e,added:t,old:n});else if(u>400||!o||this.closed||o.start>e+n.length||o.start+o.added<e)this.done.push([{start:e,added:t,old:n}]),this.closed=!1;else{var a=Math.max(0,o.start-e),f=Math.max(0,e+n.length-(o.start+o.added));for(var l=a;l>0;--l)o.old.unshift(n[l-1]);for(var l=f;l>0;--l)o.old.push(n[n.length-l]);a&&(o.start=e),o.added+=t-(n.length-a-f)}this.time=i},startCompound:function(){this.compound++||(this.closed=!0)},endCompound:function(){--this.compound||(this.closed=!0)}},e.e_stop=G,e.e_preventDefault=K,e.e_stopPropagation=Q,e.connect=tt,nt.prototype={set:function(e,t){clearTimeout(this.id),this.id=setTimeout(t,e)}};var rt=e.Pass={toString:function(){return"CodeMirror.Pass"}},it=function(){if(m)return!1;var e=gt("div");return"draggable"in e||"dragDrop"in e}(),st=function(){var e=gt("textarea");return e.value="foo\nbar",e.value.indexOf("\r")>-1?"\r\n":"\n"}(),ot=/^$/;p?ot=/$'/:E?ot=/\-[^ \-?]|\?[^ !'\"\),.\-\/:;\?\]\}]/:b&&(ot=/\-[^ \-\.?]|\?[^ \-\.?\]\}:;!'\"\),\/]|[\.!\"#&%\)*+,:;=>\]|\}~][\(\{\[<]|\$'/);var lt=[""],Tt="\n\nb".split(/\n/).length!=3?function(e){var t=0,n=[],r=e.length;while(t<=r){var i=e.indexOf("\n",t);i==-1&&(i=e.length);var s=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),o=s.indexOf("\r");o!=-1?(n.push(s.slice(0,o)),t+=o+1):(n.push(s),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)};e.splitLines=Tt;var Nt=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){try{var t=e.ownerDocument.selection.createRange()}catch(n){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0};e.defineMode("null",function(){return{token:function(e){e.skipToEnd()}}}),e.defineMIME("text/plain","null");var Ct={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"};return e.keyNames=Ct,function(){for(var e=0;e<10;e++)Ct[e+48]=String(e);for(var e=65;e<=90;e++)Ct[e]=String.fromCharCode(e);for(var e=1;e<=12;e++)Ct[e+111]=Ct[e+63235]="F"+e}(),e.version="2.34 +",e}(),CodeMirror.defineMode("css",function(e){function a(e){var t={};for(var n=0;n<e.length;++n)t[e[n]]=!0;return t}function f(e,t){return n=t,e}function l(e,t){var r=e.next();if(r=="@")return e.eatWhile(/[\w\\\-]/),f("def",e.current());if(r=="/"&&e.eat("*"))return t.tokenize=c,c(e,t);if(r=="<"&&e.eat("!"))return t.tokenize=h,h(e,t);if(r=="=")f(null,"compare");else{if(!(r!="~"&&r!="|"||!e.eat("=")))return f(null,"compare");if(r=='"'||r=="'")return t.tokenize=p(r),t.tokenize(e,t);if(r=="#")return e.eatWhile(/[\w\\\-]/),f("atom","hash");if(r=="!")return e.match(/^\s*\w*/),f("keyword","important");if(/\d/.test(r))return e.eatWhile(/[\w.%]/),f("number","unit");if(r!=="-")return/[,+>*\/]/.test(r)?f(null,"select-op"):r=="."&&e.match(/^-?[_a-z][_a-z0-9-]*/i)?f("qualifier",n):r==":"?f("operator",r):/[;{}\[\]\(\)]/.test(r)?f(null,r):(e.eatWhile(/[\w\\\-]/),f("property","variable"));if(/\d/.test(e.peek()))return e.eatWhile(/[\w.%]/),f("number","unit");if(e.match(/^[^-]+-/))return f("meta",n)}}function c(e,t){var n=!1,r;while((r=e.next())!=null){if(n&&r=="/"){t.tokenize=l;break}n=r=="*"}return f("comment","comment")}function h(e,t){var n=0,r;while((r=e.next())!=null){if(n>=2&&r==">"){t.tokenize=l;break}n=r=="-"?n+1:0}return f("comment","comment")}function p(e){return function(t,n){var r=!1,i;while((i=t.next())!=null){if(i==e&&!r)break;r=!r&&i=="\\"}return r||(n.tokenize=l),f("string","string")}}var t=e.indentUnit,n,r=a(["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"]),i=a(["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"]),s=a(["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"]),o=a(["black","silver","gray","white","maroon","red","purple","fuchsia","green","lime","olive","yellow","navy","blue","teal","aqua"]),u=a(["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","navy","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","yellow"]);return{startState:function(e){return{tokenize:l,baseIndent:e||0,stack:[]}},token:function(e,t){if(e.eatSpace())return null;var a=t.tokenize(e,t),f=t.stack[t.stack.length-1];return a=="property"?f=="propertyValue"?u[e.current()]?a="string-2":o[e.current()]?a="keyword":a="variable-2":f=="rule"?s[e.current()]||(a+=" error"):!f||f=="@media{"?a="tag":f=="@media"?r[e.current()]?a="attribute":/^(only|not)$/i.test(e.current())?a="keyword":e.current().toLowerCase()=="and"?a="error":i[e.current()]?a="error":a="attribute error":f=="@mediaType"?r[e.current()]?a="attribute":e.current().toLowerCase()=="and"?a="operator":/^(only|not)$/i.test(e.current())?a="error":i[e.current()]?a="error":a="error":f=="@mediaType("?s[e.current()]||(r[e.current()]?a="error":e.current().toLowerCase()=="and"?a="operator":/^(only|not)$/i.test(e.current())?a="error":a+=" error"):a="error":a=="atom"?!f||f=="@media{"?a="builtin":f=="propertyValue"?/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(e.current())||(a+=" error"):a="error":f=="@media"&&n=="{"&&(a="error"),n=="{"?f=="@media"||f=="@mediaType"?(t.stack.pop(),t.stack[t.stack.length-1]="@media{"):t.stack.push("rule"):n=="}"?(t.stack.pop(),f=="propertyValue"&&t.stack.pop()):n=="@media"?t.stack.push("@media"):f=="@media"&&/\b(keyword|attribute)\b/.test(a)?t.stack.push("@mediaType"):f=="@mediaType"&&e.current()==","?t.stack.pop():f=="@mediaType"&&n=="("?t.stack.push("@mediaType("):f=="@mediaType("&&n==")"?t.stack.pop():f=="rule"&&n==":"?t.stack.push("propertyValue"):f=="propertyValue"&&n==";"&&t.stack.pop(),a},indent:function(e,n){var r=e.stack.length;return/^\}/.test(n)&&(r-=e.stack[e.stack.length-1]=="propertyValue"?2:1),e.baseIndent+r*t},electricChars:"}"}}),CodeMirror.defineMIME("text/css","css"),CodeMirror.defineMode("htmlmixed",function(e){function i(e,i){var s=t.token(e,i.htmlState);return s=="tag"&&e.current()==">"&&i.htmlState.context&&(/^script$/i.test(i.htmlState.context.tagName)?(i.token=o,i.localState=n.startState(t.indent(i.htmlState,""))):/^style$/i.test(i.htmlState.context.tagName)&&(i.token=u,i.localState=r.startState(t.indent(i.htmlState,"")))),s}function s(e,t,n){var r=e.current(),i=r.search(t),s;if(i>-1)e.backUp(r.length-i);else if(s=r.match(/<\/?$/))e.backUp(r[0].length),e.match(t,!1)||e.match(r[0]);return n}function o(e,t){return e.match(/^<\/\s*script\s*>/i,!1)?(t.token=i,t.localState=null,i(e,t)):s(e,/<\/\s*script\s*>/,n.token(e,t.localState))}function u(e,t){return e.match(/^<\/\s*style\s*>/i,!1)?(t.token=i,t.localState=null,i(e,t)):s(e,/<\/\s*style\s*>/,r.token(e,t.localState))}var t=CodeMirror.getMode(e,{name:"xml",htmlMode:!0}),n=CodeMirror.getMode(e,"javascript"),r=CodeMirror.getMode(e,"css");return{startState:function(){var e=t.startState();return{token:i,localState:null,mode:"html",htmlState:e}},copyState:function(e){if(e.localState)var i=CodeMirror.copyState(e.token==u?r:n,e.localState);return{token:e.token,localState:i,mode:e.mode,htmlState:CodeMirror.copyState(t,e.htmlState)}},token:function(e,t){return t.token(e,t)},indent:function(e,s){return e.token==i||/^\s*<\//.test(s)?t.indent(e.htmlState,s):e.token==o?n.indent(e.localState,s):r.indent(e.localState,s)},electricChars:"/{}:",innerMode:function(e){var s=e.token==i?t:e.token==o?n:r;return{state:e.localState||e.htmlState,mode:s}}}},"xml","javascript","css"),CodeMirror.defineMIME("text/html","htmlmixed"),CodeMirror.defineMode("javascript",function(e,t){function o(e,t,n){return t.tokenize=n,n(e,t)}function u(e,t){var n=!1,r;while((r=e.next())!=null){if(r==t&&!n)return!1;n=!n&&r=="\\"}return n}function l(e,t,n){return a=e,f=n,t}function c(e,t){var n=e.next();if(n=='"'||n=="'")return o(e,t,h(n));if(/[\[\]{}\(\),;\:\.]/.test(n))return l(n);if(n=="0"&&e.eat(/x/i))return e.eatWhile(/[\da-f]/i),l("number","number");if(/\d/.test(n)||n=="-"&&e.eat(/\d/))return e.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),l("number","number");if(n=="/")return e.eat("*")?o(e,t,p):e.eat("/")?(e.skipToEnd(),l("comment","comment")):t.reAllowed?(u(e,"/"),e.eatWhile(/[gimy]/),l("regexp","string-2")):(e.eatWhile(s),l("operator",null,e.current()));if(n=="#")return e.skipToEnd(),l("error","error");if(s.test(n))return e.eatWhile(s),l("operator",null,e.current());e.eatWhile(/[\w\$_]/);var r=e.current(),a=i.propertyIsEnumerable(r)&&i[r];return a&&t.kwAllowed?l(a.type,a.style,r):l("variable","variable",r)}function h(e){return function(t,n){return u(t,e)||(n.tokenize=c),l("string","string")}}function p(e,t){var n=!1,r;while(r=e.next()){if(r=="/"&&n){t.tokenize=c;break}n=r=="*"}return l("comment","comment")}function v(e,t,n,r,i,s){this.indented=e,this.column=t,this.type=n,this.prev=i,this.info=s,r!=null&&(this.align=r)}function m(e,t){for(var n=e.localVars;n;n=n.next)if(n.name==t)return!0}function g(e,t,n,i,s){var o=e.cc;y.state=e,y.stream=s,y.marked=null,y.cc=o,e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);for(;;){var u=o.length?o.pop():r?A:L;if(u(n,i)){while(o.length&&o[o.length-1].lex)o.pop()();return y.marked?y.marked:n=="variable"&&m(e,i)?"variable-2":t}}}function b(){for(var e=arguments.length-1;e>=0;e--)y.cc.push(arguments[e])}function w(){return b.apply(null,arguments),!0}function E(e){var t=y.state;if(t.context){y.marked="def";for(var n=t.localVars;n;n=n.next)if(n.name==e)return;t.localVars={name:e,next:t.localVars}}}function x(){y.state.context={prev:y.state.context,vars:y.state.localVars},y.state.localVars=S}function T(){y.state.localVars=y.state.context.vars,y.state.context=y.state.context.prev}function N(e,t){var n=function(){var n=y.state;n.lexical=new v(n.indented,y.stream.column(),e,null,n.lexical,t)};return n.lex=!0,n}function C(){var e=y.state;e.lexical.prev&&(e.lexical.type==")"&&(e.indented=e.lexical.indented),e.lexical=e.lexical.prev)}function k(e){return function(n){return n==e?w():e==";"?b():w(arguments.callee)}}function L(e){return e=="var"?w(N("vardef"),j,k(";"),C):e=="keyword a"?w(N("form"),A,L,C):e=="keyword b"?w(N("form"),L,C):e=="{"?w(N("}"),B,C):e==";"?w():e=="function"?w(z):e=="for"?w(N("form"),k("("),N(")"),I,k(")"),C,L,C):e=="variable"?w(N("stat"),_):e=="switch"?w(N("form"),A,N("}","switch"),k("{"),B,C,C):e=="case"?w(A,k(":")):e=="default"?w(k(":")):e=="catch"?w(N("form"),x,k("("),W,k(")"),L,C,T):b(N("stat"),A,k(";"),C)}function A(e){return d.hasOwnProperty(e)?w(M):e=="function"?w(z):e=="keyword c"?w(O):e=="("?w(N(")"),O,k(")"),C,M):e=="operator"?w(A):e=="["?w(N("]"),H(A,"]"),C,M):e=="{"?w(N("}"),H(P,"}"),C,M):w()}function O(e){return e.match(/[;\}\)\],]/)?b():b(A)}function M(e,t){if(e=="operator"&&/\+\+|--/.test(t))return w(M);if(e=="operator"&&t=="?")return w(A,k(":"),A);if(e==";")return;if(e=="(")return w(N(")"),H(A,")"),C,M);if(e==".")return w(D,M);if(e=="[")return w(N("]"),A,k("]"),C,M)}function _(e){return e==":"?w(C,L):b(M,k(";"),C)}function D(e){if(e=="variable")return y.marked="property",w()}function P(e){e=="variable"&&(y.marked="property");if(d.hasOwnProperty(e))return w(k(":"),A)}function H(e,t){function n(r){return r==","?w(e,n):r==t?w():w(k(t))}return function(i){return i==t?w():b(e,n)}}function B(e){return e=="}"?w():b(L,B)}function j(e,t){return e=="variable"?(E(t),w(F)):w()}function F(e,t){if(t=="=")return w(A,F);if(e==",")return w(j)}function I(e){return e=="var"?w(j,k(";"),R):e==";"?w(R):e=="variable"?w(q):w(R)}function q(e,t){return t=="in"?w(A):w(M,R)}function R(e,t){return e==";"?w(U):t=="in"?w(A):w(A,k(";"),U)}function U(e){e!=")"&&w(A)}function z(e,t){if(e=="variable")return E(t),w(z);if(e=="(")return w(N(")"),x,H(W,")"),C,L,T)}function W(e,t){if(e=="variable")return E(t),w()}var n=e.indentUnit,r=t.json,i=function(){function e(e){return{type:e,style:"keyword"}}var t=e("keyword a"),n=e("keyword b"),r=e("keyword c"),i=e("operator"),s={type:"atom",style:"atom"};return{"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":i,"typeof":i,"instanceof":i,"true":s,"false":s,"null":s,"undefined":s,NaN:s,Infinity:s}}(),s=/[+\-*&%=<>!?|]/,a,f,d={atom:!0,number:!0,variable:!0,string:!0,regexp:!0},y={state:null,column:null,marked:null,cc:null},S={name:"this",next:{name:"arguments"}};return C.lex=!0,{startState:function(e){return{tokenize:c,reAllowed:!0,kwAllowed:!0,cc:[],lexical:new v((e||0)-n,0,"block",!1),localVars:t.localVars,context:t.localVars&&{vars:t.localVars},indented:0}},token:function(e,t){e.sol()&&(t.lexical.hasOwnProperty("align")||(t.lexical.align=!1),t.indented=e.indentation());if(e.eatSpace())return null;var n=t.tokenize(e,t);return a=="comment"?n:(t.reAllowed=a=="operator"||a=="keyword c"||!!a.match(/^[\[{}\(,;:]$/),t.kwAllowed=a!=".",g(t,n,a,f,e))},indent:function(e,t){if(e.tokenize==p)return CodeMirror.Pass;if(e.tokenize!=c)return 0;var r=t&&t.charAt(0),i=e.lexical;i.type=="stat"&&r=="}"&&(i=i.prev);var s=i.type,o=r==s;return s=="vardef"?i.indented+4:s=="form"&&r=="{"?i.indented:s=="stat"||s=="form"?i.indented+n:i.info=="switch"&&!o?i.indented+(/^(?:case|default)\b/.test(t)?n:2*n):i.align?i.column+(o?0:1):i.indented+(o?0:n)},electricChars:":{}"}}),CodeMirror.defineMIME("text/javascript","javascript"),CodeMirror.defineMIME("application/json",{name:"javascript",json:!0}),CodeMirror.defineMode("xml",function(e,t){function u(e,t){function n(n){return t.tokenize=n,n(e,t)}var r=e.next();if(r=="<"){if(e.eat("!"))return e.eat("[")?e.match("CDATA[")?n(l("atom","]]>")):null:e.match("--")?n(l("comment","-->")):e.match("DOCTYPE",!0,!0)?(e.eatWhile(/[\w\._\-]/),n(c(1))):null;if(e.eat("?"))return e.eatWhile(/[\w\._\-]/),t.tokenize=l("meta","?>"),"meta";o=e.eat("/")?"closeTag":"openTag",e.eatSpace(),s="";var i;while(i=e.eat(/[^\s\u00a0=<>\"\'\/?]/))s+=i;return t.tokenize=a,"tag"}if(r=="&"){var u;return e.eat("#")?e.eat("x")?u=e.eatWhile(/[a-fA-F\d]/)&&e.eat(";"):u=e.eatWhile(/[\d]/)&&e.eat(";"):u=e.eatWhile(/[\w\.\-:]/)&&e.eat(";"),u?"atom":"error"}return e.eatWhile(/[^&<]/),null}function a(e,t){var n=e.next();return n==">"||n=="/"&&e.eat(">")?(t.tokenize=u,o=n==">"?"endTag":"selfcloseTag","tag"):n=="="?(o="equals",null):/[\'\"]/.test(n)?(t.tokenize=f(n),t.tokenize(e,t)):(e.eatWhile(/[^\s\u00a0=<>\"\'\/?]/),"word")}function f(e){return function(t,n){while(!t.eol())if(t.next()==e){n.tokenize=a;break}return"string"}}function l(e,t){return function(n,r){while(!n.eol()){if(n.match(t)){r.tokenize=u;break}n.next()}return e}}function c(e){return function(t,n){var r;while((r=t.next())!=null){if(r=="<")return n.tokenize=c(e+1),n.tokenize(t,n);if(r==">"){if(e==1){n.tokenize=u;break}return n.tokenize=c(e-1),n.tokenize(t,n)}}return"meta"}}function d(){for(var e=arguments.length-1;e>=0;e--)h.cc.push(arguments[e])}function v(){return d.apply(null,arguments),!0}function m(e,t){var n=r.doNotIndent.hasOwnProperty(e)||h.context&&h.context.noIndent;h.context={prev:h.context,tagName:e,indent:h.indented,startOfLine:t,noIndent:n}}function g(){h.context&&(h.context=h.context.prev)}function y(e){if(e=="openTag")return h.tagName=s,v(S,b(h.startOfLine));if(e=="closeTag"){var t=!1;return h.context?h.context.tagName!=s&&(r.implicitlyClosed.hasOwnProperty(h.context.tagName.toLowerCase())&&g(),t=!h.context||h.context.tagName!=s):t=!0,t&&(p="error"),v(w(t))}return v()}function b(e){return function(t){return t=="selfcloseTag"||t=="endTag"&&r.autoSelfClosers.hasOwnProperty(h.tagName.toLowerCase())?(E(h.tagName.toLowerCase()),v()):t=="endTag"?(E(h.tagName.toLowerCase()),m(h.tagName,e),v()):v()}}function w(e){return function(t){return e&&(p="error"),t=="endTag"?(g(),v()):(p="error",v(arguments.callee))}}function E(e){var t;for(;;){if(!h.context)return;t=h.context.tagName.toLowerCase();if(!r.contextGrabbers.hasOwnProperty(t)||!r.contextGrabbers[t].hasOwnProperty(e))return;g()}}function S(e){return e=="word"?(p="attribute",v(x,S)):e=="endTag"||e=="selfcloseTag"?d():(p="error",v(S))}function x(e){return e=="equals"?v(T,S):(r.allowMissing||(p="error"),e=="endTag"||e=="selfcloseTag"?d():v())}function T(e){return e=="string"?v(N):e=="word"&&r.allowUnquoted?(p="string",v()):(p="error",e=="endTag"||e=="selfCloseTag"?d():v())}function N(e){return e=="string"?v(N):d()}var n=e.indentUnit,r=t.htmlMode?{autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0}:{autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1},i=t.alignCDATA,s,o,h,p;return{startState:function(){return{tokenize:u,cc:[],indented:0,startOfLine:!0,tagName:null,context:null}},token:function(e,t){e.sol()&&(t.startOfLine=!0,t.indented=e.indentation());if(e.eatSpace())return null;p=o=s=null;var n=t.tokenize(e,t);t.type=o;if((n||o)&&n!="comment"){h=t;for(;;){var r=t.cc.pop()||y;if(r(o||n))break}}return t.startOfLine=!1,p||n},indent:function(e,t,r){var s=e.context;if(e.tokenize!=a&&e.tokenize!=u||s&&s.noIndent)return r?r.match(/^(\s*)/)[0].length:0;if(i&&/<!\[CDATA\[/.test(t))return 0;s&&/^<\//.test(t)&&(s=s.prev);while(s&&!s.startOfLine)s=s.prev;return s?s.indent+n:0},electricChars:"/"}}),CodeMirror.defineMIME("text/xml","xml"),CodeMirror.defineMIME("application/xml","xml"),CodeMirror.mimeModes.hasOwnProperty("text/html")||CodeMirror.defineMIME("text/html",{name:"xml",htmlMode:!0}),CodeMirror.overlayMode=CodeMirror.overlayParser=function(e,t,n){return{startState:function(){return{base:CodeMirror.startState(e),overlay:CodeMirror.startState(t),basePos:0,baseCur:null,overlayPos:0,overlayCur:null}},copyState:function(n){return{base:CodeMirror.copyState(e,n.base),overlay:CodeMirror.copyState(t,n.overlay),basePos:n.basePos,baseCur:null,overlayPos:n.overlayPos,overlayCur:null}},token:function(r,i){return r.start==i.basePos&&(i.baseCur=e.token(r,i.base),i.basePos=r.pos),r.start==i.overlayPos&&(r.pos=r.start,i.overlayCur=t.token(r,i.overlay),i.overlayPos=r.pos),r.pos=Math.min(i.basePos,i.overlayPos),r.eol()&&(i.basePos=i.overlayPos=0),i.overlayCur==null?i.baseCur:i.baseCur!=null&&n?i.baseCur+" "+i.overlayCur:i.overlayCur},indent:e.indent&&function(t,n){return e.indent(t.base,n)},electricChars:e.electricChars,innerMode:function(t){return{state:t.base,mode:e}},blankLine:function(n){e.blankLine&&e.blankLine(n.base),t.blankLine&&t.blankLine(n.overlay)}}},CodeMirror.runMode=function(e,t,n,r){function i(e){return e.replace(/[<&]/g,function(e){return e=="<"?"<":"&"})}var s=CodeMirror.getMode(CodeMirror.defaults,t),o=n.nodeType==1,u=r&&r.tabSize||CodeMirror.defaults.tabSize;if(o){var a=n,f=[],l=0;n=function(e,t){if(e=="\n"){f.push("<br>"),l=0;return}var n="";for(var r=0;;){var s=e.indexOf(" ",r);if(s==-1){n+=i(e.slice(r)),l+=e.length-r;break}l+=s-r,n+=i(e.slice(r,s));var o=u-l%u;l+=o;for(var a=0;a<o;++a)n+=" ";r=s+1}t?f.push('<span class="cm-'+i(t)+'">'+n+"</span>"):f.push(n)}}var c=CodeMirror.splitLines(e),h=CodeMirror.startState(s);for(var p=0,d=c.length;p<d;++p){p&&n("\n");var v=new CodeMirror.StringStream(c[p]);while(!v.eol()){var m=s.token(v,h);n(v.current(),m,p,v.start),v.start=v.pos}}o&&(a.innerHTML=f.join(""))},function(){function e(e,t,n,r){this.atOccurrence=!1,this.cm=e,r==null&&typeof t=="string"&&(r=!1),n=n?e.clipPos(n):{line:0,ch:0},this.pos={from:n,to:n};if(typeof t!="string")t.global||(t=new RegExp(t.source,t.ignoreCase?"ig":"g")),this.matches=function(n,r){if(n){t.lastIndex=0;var i=e.getLine(r.line).slice(0,r.ch),s=t.exec(i),o=0;while(s){o+=s.index+1,i=i.slice(o),t.lastIndex=0;var u=t.exec(i);if(!u)break;s=u}o--}else{t.lastIndex=r.ch;var i=e.getLine(r.line),s=t.exec(i),o=s&&s.index}if(s)return{from:{line:r.line,ch:o},to:{line:r.line,ch:o+s[0].length},match:s}};else{r&&(t=t.toLowerCase());var i=r?function(e){return e.toLowerCase()}:function(e){return e},s=t.split("\n");s.length==1?this.matches=function(n,r){var s=i(e.getLine(r.line)),o=t.length,u;if(n?r.ch>=o&&(u=s.lastIndexOf(t,r.ch-o))!=-1:(u=s.indexOf(t,r.ch))!=-1)return{from:{line:r.line,ch:u},to:{line:r.line,ch:u+o}}}:this.matches=function(t,n){var r=n.line,o=t?s.length-1:0,u=s[o],a=i(e.getLine(r)),f=t?a.indexOf(u)+u.length:a.lastIndexOf(u);if(t?f>=n.ch||f!=u.length:f<=n.ch||f!=a.length-u.length)return;for(;;){if(t?!r:r==e.lineCount()-1)return;a=i(e.getLine(r+=t?-1:1)),u=s[t?--o:++o];if(o>0&&o<s.length-1){if(a!=u)return;continue}var l=t?a.lastIndexOf(u):a.indexOf(u)+u.length;if(t?l!=a.length-u.length:l!=u.length)return;var c={line:n.line,ch:f},h={line:r,ch:l};return{from:t?h:c,to:t?c:h}}}}}e.prototype={findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(e){function r(e){var n={line:e,ch:0};return t.pos={from:n,to:n},t.atOccurrence=!1,!1}var t=this,n=this.cm.clipPos(e?this.pos.from:this.pos.to);for(;;){if(this.pos=this.matches(e,n))return this.atOccurrence=!0,this.pos.match||!0;if(e){if(!n.line)return r(0);n={line:n.line-1,ch:this.cm.getLine(n.line-1).length}}else{var i=this.cm.lineCount();if(n.line==i-1)return r(i);n={line:n.line+1,ch:0}}}},from:function(){if(this.atOccurrence)return this.pos.from},to:function(){if(this.atOccurrence)return this.pos.to},replace:function(e){var t=this;this.atOccurrence&&(t.pos.to=this.cm.replaceRange(e,t.pos.from,t.pos.to))}},CodeMirror.defineExtension("getSearchCursor",function(t,n,r){return new e(this,t,n,r)})}(),CodeMirror.defineMode("visibleSpace",function(e,t){var n={token:function(e,t){var n=e.next();return n==" "?"space":null}};return CodeMirror.overlayMode(CodeMirror.getMode(e,t.backdrop||"htmlmixed"),n)})