var CodeMirror=function(){"use strict";function e(r,i){function un(e){if(s.onDragEvent&&s.onDragEvent(ln,I(e)))return;U(e)}function fn(e){return e>=0&&e=n.to||t.liner-400&&rt(Ht.pos,n))i="triple",q(e),setTimeout(Qn,20),wr(n.line);else if(Pt&&Pt.time>r-400&&rt(Pt.pos,n)){i="double",Ht={time:r,pos:n},q(e);var o=br(n);fr(o.from,o.to)}else Pt={time:r,pos:n};var a=n,f;if(s.dragDrop&&K&&!s.readOnly&&!rt(_t.from,_t.to)&&!it(n,_t.from)&&!it(_t.to,n)&&i=="single"){g&&(St.draggable=!0);var l=V(document,"mouseup",hi(u),!0),c=V(St,"drop",hi(u),!0);jt=!0,St.dragDrop&&St.dragDrop();return}q(e),i=="single"&&hr(n.line,n.ch,!0);var d=_t.from,v=_t.to,w=V(document,"mousemove",hi(function(e){clearTimeout(f),q(e),!p&&!W(e)?b(e):y(e)}),!0),l=V(document,"mouseup",hi(b),!0)}function yn(e){for(var t=z(e);t!=xt;t=t.parentNode)if(t.parentNode==yt)return q(e);q(e)}function bn(e){if(s.onDragEvent&&s.onDragEvent(ln,I(e)))return;q(e);var t=Zr(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=dr(t),hi(function(){var e=qn(i.join(""),t,t);fr(t,e)})())},s.readAsText(e)};for(var a=0;a-1&&setTimeout(hi(function(){Sr(_t.to.line,"smart")}),75);if(Tn(e,r))return;Vn()}function Ln(e){if(s.onKeyEvent&&s.onKeyEvent(ln,I(e)))return;X(e,"keyCode")==16&&(Dt=null)}function An(){if(s.readOnly=="nocursor")return;Mt||(s.onFocus&&s.onFocus(ln),Mt=!0,St.className.search(/\bCodeMirror-focused\b/)==-1&&(St.className+=" CodeMirror-focused"),Xt||Kn(!0)),Xn(),ti()}function On(){Mt&&(s.onBlur&&s.onBlur(ln),Mt=!1,Yt&&hi(function(){Yt&&(Yt(),Yt=null)})(),St.className=St.className.replace(" CodeMirror-focused","")),clearInterval(kt),setTimeout(function(){Mt||(Dt=null)},150)}function Mn(e,t,n,r,i){if(It)return;if(on){var o=[];At.iter(e.line,t.line+1,function(e){o.push(e.text)}),on.addChange(e.line,n.length,o);while(on.done.length>s.undoDepth)on.done.shift()}Hn(e,t,n,r,i)}function _n(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;At.iter(s.start,u,function(e){o.push(e.text)}),r.push({start:s.start,added:s.old.length,old:o});var a={line:s.start+s.old.length-1,ch:lt(o[o.length-1],s.old[s.old.length-1])};Hn({line:s.start,ch:0},{line:u-1,ch:cn(u-1).text.length},s.old,a,a)}qt=!0,t.push(r)}function Dn(){_n(on.done,on.undone)}function Pn(){_n(on.undone,on.done)}function Hn(e,t,n,r,i){function x(e){return e<=Math.min(t.line,t.line+g)?e:e+g}if(It)return;var o=!1,u=Zt.text.length;s.lineWrapping||At.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)Vt=!0;var a=t.line-e.line,f=cn(e.line),l=cn(t.line);if(e.ch==0&&t.ch==0&&n[n.length-1]==""){var c=[],h=null;e.line?(h=cn(e.line-1),h.fixMarkEnds(l)):l.fixMarkStarts();for(var p=0,d=n.length-1;p1&&At.remove(e.line+1,a-1,$t),At.insert(e.line+1,c)}if(s.lineWrapping){var v=Math.max(5,St.clientWidth/Qr()-3);At.iter(e.line,e.line+n.length,function(e){if(e.hidden)return;var t=Math.ceil(e.text.length/v)||1;t!=e.height&&hn(e,t)})}else At.iter(e.line,e.line+n.length,function(e){var t=e.text;!e.hidden&&t.length>u&&(Zt=e,u=t.length,tn=!0,o=!1)}),o&&(en=!0);var m=[],g=n.length-a-1;for(var p=0,y=Ot.length;pt.line&&m.push(b+g)}var w=e.line+Math.min(n.length,500);oi(e.line,w),m.push(w),Ot=m,ai(100),Ut.push({from:e.line,to:t.line+1,diff:g});var E={from:e,to:t,text:n};if(zt){for(var S=zt;S.next;S=S.next);S.next=E}else zt=E;lr(dr(r),dr(i),x(_t.from.line),x(_t.to.line))}function Bn(){var e=At.height*$r()+2*Gr();return e-1>St.offsetHeight?e:!1}function jn(e){var t=Bn();R.style.display=t?"block":"none",t?(F.style.height=Et.style.minHeight=t+"px",R.style.height=St.clientHeight+"px",e!=null&&(R.scrollTop=St.scrollTop=e)):Et.style.minHeight="",wt.style.top=Jt*$r()+"px"}function Fn(){var e=ot("div",null,"CodeMirror-scrollbar-inner","height: 200px"),t=ot("div",[e],"CodeMirror-scrollbar","position: absolute; left: -9999px; height: 100px;");document.body.appendChild(t);var n=t.offsetWidth<=1;return document.body.removeChild(t),n}function In(){Zt=cn(0),tn=!0;var e=Zt.text.length;At.iter(1,At.size,function(t){var n=t.text;!t.hidden&&n.length>e&&(e=n.length,Zt=t)}),en=!1}function qn(e,t,n){function r(r){if(it(r,t))return r;if(!it(n,r))return i;var s=r.line+e.length-(n.line-t.line)-1,o=r.ch;return r.line==n.line&&(o+=e[e.length-1].length-(n.ch-(n.line==t.line?t.ch:0))),{line:s,ch:o}}t=dr(t),n?n=dr(n):n=t,e=pt(e);var i;return Un(e,t,n,function(e){return i=e,{from:r(_t.from),to:r(_t.to)}}),i}function Rn(e,t){Un(pt(e),_t.from,_t.to,function(e){return t=="end"?{from:e,to:e}:t=="start"?{from:_t.from,to:_t.from}:{from:_t.from,to:e}})}function Un(e,t,n,r){var i=e.length==1?e[0].length+t.ch:e[e.length-1].length,s=r({line:t.line+e.length-1,ch:i});Mn(t,n,e,s.from,s.to)}function zn(e,t,n){var r=e.line,i=t.line;if(r==i)return cn(r).text.slice(e.ch,t.ch);var s=[cn(r).text.slice(e.ch)];return At.iter(r+1,i,function(e){s.push(e.text)}),s.push(cn(i).text.slice(0,t.ch)),s.join(n||"\n")}function Wn(e){return zn(_t.from,_t.to,e)}function Xn(){if(rn)return;Nt.set(s.pollInterval,function(){fi(),Jn(),Mt&&Xn(),li()})}function Vn(){function t(){fi();var n=Jn();!n&&!e?(e=!0,Nt.set(60,t)):(rn=!1,Xn()),li()}var e=!1;rn=!0,Nt.set(20,t)}function Jn(){if(Xt||!Mt||dt(L)||s.readOnly)return!1;var e=L.value;if(e==$n)return!1;Dt=null;var t=0,n=Math.min($n.length,e.length);while(t1e3?L.value=$n="":$n=e,!0}function Kn(e){rt(_t.from,_t.to)?e&&($n=L.value=""):($n="",L.value=Wn(),nt(L))}function Qn(){s.readOnly!="nocursor"&&L.focus()}function Gn(){var e=Z.getBoundingClientRect();if(p&&e.top==e.bottom)return;var t=window.innerHeight||Math.max(document.body.offsetHeight,document.documentElement.offsetHeight);(e.top<0||e.bottom>t)&&Yn()}function Yn(){var e=Zn();er(e.x,e.y,e.x,e.yBot)}function Zn(){var e=Rr(_t.inverted?_t.from:_t.to),t=s.lineWrapping?Math.min(e.x,gt.offsetWidth):e.x;return{x:t,y:e.y,yBot:e.yBot}}function er(e,t,n,r){var i=tr(e,t,n,r);i.scrollLeft!=null&&(St.scrollLeft=i.scrollLeft),i.scrollTop!=null&&(R.scrollTop=St.scrollTop=i.scrollTop)}function tr(e,t,n,r){var i=Yr(),o=Gr();t+=o,r+=o,e+=i,n+=i;var u=St.clientHeight,a=R.scrollTop,f={},l=Bn()||Infinity,c=tl-10;ta+u&&(f.scrollTop=(h?l:r)-u);var p=St.clientWidth,d=St.scrollLeft,v=s.fixedGutter?bt.clientWidth:0,m=ep+d-3&&(f.scrollLeft=n+10-p),f}function nr(e){var t=$r(),n=(e!=null?e:R.scrollTop)-Gr(),r=Math.max(0,Math.floor(n/t)),i=Math.ceil((n+St.clientHeight)/t);return{from:H(At,r),to:H(At,i)}}function rr(e,t,n){function d(){var e=Q.firstChild,t=!1;return At.iter(Kt,Qt,function(n){if(!e)return;if(!n.hidden){var r=Math.round(e.offsetHeight/c)||1;n.height!=r&&(hn(n,r),Vt=t=!0)}e=e.nextSibling}),t}if(!St.clientWidth){Kt=Qt=Jt=0;return}var r=nr(n);if(e!==!0&&e.length==0&&r.from>Kt&&r.too&&Qt-o<20&&(o=Math.min(At.size,Qt));var u=e===!0?[]:ir([{from:Kt,to:Qt,domStart:0}],e),a=0;for(var f=0;fo&&(l.to=o),l.from>=l.to?u.splice(f--,1):a+=l.to-l.from}if(a==o-i&&i==Kt&&o==Qt){jn(n);return}u.sort(function(e,t){return e.domStart-t.domStart});var c=$r(),h=bt.style.display;Q.style.display="none",sr(i,o,u),Q.style.display=bt.style.display="";var p=i!=Kt||o!=Qt||Gt!=St.clientHeight+c;p&&(Gt=St.clientHeight+c),Kt=i,Qt=o,Jt=B(At,i);if(Q.childNodes.length!=Qt-Kt)throw new Error("BAD PATCH! "+JSON.stringify(u)+" size="+(Qt-Kt)+" nodes="+Q.childNodes.length);if(s.lineWrapping){d();var v=Bn(),m=v?"block":"none";R.style.display!=m&&(R.style.display=m,v&&(F.style.height=v+"px"),d())}return bt.style.display=h,(p||Vt)&&or()&&s.lineWrapping&&d()&&or(),jn(n),ur(),!t&&s.onUpdate&&s.onUpdate(ln),!0}function ir(e,t){for(var n=0,r=t.length||0;n=f.to?s.push(f):(i.from>f.from&&s.push({from:f.from,to:i.from,domStart:f.domStart}),i.toi)s=r(s),i++;for(var f=0,l=a.to-a.from;ff){if(e.hidden)var t=ot("pre");else{var t=e.getElement(Cr);e.className&&(t.className=e.className);if(e.bgClassName){var r=ot("pre","\u00a0",e.bgClassName,"position: absolute; left: 0; right: 0; top: 0; bottom: 0; z-index: -2");t=ot("div",[r,t],null,"position: relative")}}Q.insertBefore(t,s)}else s=s.nextSibling;++f})}function or(){if(!s.gutter&&!s.lineNumbers)return;var e=wt.offsetHeight,t=St.clientHeight;bt.style.height=(e-t<2?t:e)+"px";var n=document.createDocumentFragment(),r=Kt,i;At.iter(Kt,Math.max(Qt,Kt+1),function(e){if(e.hidden)n.appendChild(ot("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(ot("pre",null,t&&t.style));u.innerHTML=o;for(var a=1;a2;return gt.style.marginLeft=bt.offsetWidth+"px",Vt=!1,l}function ur(){var e=rt(_t.from,_t.to),t=Rr(_t.from,!0),n=e?t:Rr(_t.to,!0),r=_t.inverted?t:n,i=$r(),o=et(xt),u=et(Q);O.style.top=Math.max(0,Math.min(St.offsetHeight,r.y+u.top-o.top))+"px",O.style.left=Math.max(0,Math.min(St.offsetWidth,r.x+u.left-o.left))+"px";if(e)Z.style.top=r.y+"px",Z.style.left=(s.lineWrapping?Math.min(r.x,gt.offsetWidth):r.x)+"px",Z.style.display="",Y.style.display="none";else{var a=t.y==n.y,f=document.createDocumentFragment(),l=gt.clientWidth||gt.offsetWidth,c=gt.clientHeight||gt.offsetHeight,h=function(e,t,n,r){var i=m?"width: "+(n?l-n-e:l)+"px":"right: "+n+"px";f.appendChild(ot("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px; top: "+t+"px; "+i+"; height: "+r+"px"))};if(_t.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+(_t.from.ch?i:0)),v=Math.min(n.y,c)-d;v>.2*i&&h(0,d,0,v),(!a||!_t.from.ch)&&n.yn||u>o.text.length)u=o.text.length;return{line:r,ch:u}}r+=t}}var i=cn(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 hr(e,t,n){var r=dr({line:e,ch:t||0});(n?fr:lr)(r,r)}function pr(e){return Math.max(0,Math.min(e,At.size-1))}function dr(e){if(e.line<0)return{line:0,ch:0};if(e.line>=At.size)return{line:At.size-1,ch:cn(At.size-1).text.length};var t=e.ch,n=cn(e.line).text.length;return t==null||t>n?{line:e.line,ch:n}:t<0?{line:e.line,ch:0}:e}function vr(e,t){function o(){for(var t=r+e,n=e<0?-1:At.size;t!=n;t+=e){var i=cn(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=_t.inverted?_t.from:_t.to,r=n.line,i=n.ch,s=cn(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(ht(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 mr(e,t){var n=e<0?_t.from:_t.to;if(Dt||rt(_t.from,_t.to))n=vr(e,t);hr(n.line,n.ch,!0)}function gr(e,t){rt(_t.from,_t.to)?e<0?qn("",vr(e,t),_t.to):qn("",_t.from,vr(e,t)):qn("",_t.from,_t.to),Rt=!0}function yr(e,t){var n=0,r=Rr(_t.inverted?_t.from:_t.to,!0);sn!=null&&(r.x=sn),t=="page"?n=Math.min(St.clientHeight,window.innerHeight||document.documentElement.clientHeight):t=="line"&&(n=$r());var i=Ur(r.x,r.y+n*e+2);t=="page"&&(R.scrollTop+=Rr(i,!0).y-r.y),hr(i.line,i.ch,!0),sn=r.x}function br(e){var t=cn(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=ht(i)?ht:/\s/.test(i)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!ht(e)};while(n>0&&s(t.charAt(n-1)))--n;while(r=e.ch)&&t.push(s.marker||s)}return t}function Dr(e,t,n){return typeof e=="number"&&(e=cn(pr(e))),e.gutterMarker={text:t,style:n},Vt=!0,e}function Pr(e){typeof e=="number"&&(e=cn(pr(e))),e.gutterMarker=null,Vt=!0}function Hr(e,t){var n=e,r=e;return typeof e=="number"?r=cn(pr(e)):n=P(e),n==null?null:t(r,n)?(Ut.push({from:n,to:n+1}),r):null}function Br(e,t,n){return Hr(e,function(e){if(e.className!=t||e.bgClassName!=n)return e.className=t,e.bgClassName=n,!0})}function jr(e,t){return Hr(e,function(e,n){if(e.hidden!=t){e.hidden=t,s.lineWrapping||(t&&e.text.length==Zt.text.length?en=!0:!t&&e.text.length>Zt.text.length&&(Zt=e,en=!1)),hn(e,t?0:1);var r=_t.from.line,i=_t.to.line;if(t&&(r==n||i==n)){var o=r==n?cr({line:r,ch:0},r,0):_t.from,u=i==n?cr({line:i,ch:0},i,0):_t.to;if(!u)return;lr(o,u)}return Vt=!0}})}function Fr(e){if(typeof e=="number"){if(!fn(e))return null;var t=e;e=cn(e);if(!e)return null}else{var t=P(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 Ir(e,t){function i(e){return qr(n,e).left}if(t<=0)return 0;var n=cn(e),r=n.text,s=0,o=0,u=r.length,a,f=Math.min(u,Math.ceil(t/Qr()));for(;;){var l=i(f);if(!(l<=t&&fa)return u;f=Math.floor(u*.8),l=i(f),lt-o?s:u;var c=Math.ceil((s+u)/2),h=i(c);h>t?(u=c,a=h):(s=c,o=h)}}function qr(e,t){if(t==0)return{top:0,left:0};var n=s.lineWrapping&&t=At.size)return{line:At.size-1,ch:cn(At.size-1).text.length};var u=cn(o),a=u.text,f=s.lineWrapping,l=f?i-B(At,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*St.clientWidth*.9)/r));for(;;){var y=h(g);if(!(y<=e&&gm)return{line:o,ch:v};g=Math.floor(v*.8),y=h(g),ye?(v=w,m=E,c&&(m+=1e3)):(p=w,d=E)}}function zr(e){var t=Rr(e,!0),n=et(gt);return{x:n.left+t.x,y:n.top+t.y,yBot:n.top+t.yBot}}function $r(){if(Vr==null){Vr=ot("pre");for(var e=0;e<49;++e)Vr.appendChild(document.createTextNode("x")),Vr.appendChild(ot("br"));Vr.appendChild(document.createTextNode("x"))}var t=Q.clientHeight;return t==Xr?Wr:(Xr=t,at(mt,Vr.cloneNode(!0)),Wr=mt.firstChild.offsetHeight/50||1,ut(mt),Wr)}function Qr(){if(St.clientWidth==Kr)return Jr;Kr=St.clientWidth;var e=ot("span","x"),t=ot("pre",[e]);return at(mt,t),Jr=e.offsetWidth||10}function Gr(){return gt.offsetTop}function Yr(){return gt.offsetLeft}function Zr(e,t){var n=et(St,!0),r,i;try{r=e.clientX,i=e.clientY}catch(e){return null}if(!t&&(r-n.left>St.clientWidth||i-n.top>St.clientHeight))return null;var s=et(gt,!0);return Ur(r-s.left,i-s.top)}function ei(e){function o(){var e=pt(L.value).join("\n");e!=i&&!s.readOnly&&hi(Rn)(e,"end"),O.style.position="relative",L.style.cssText=r,v&&(R.scrollTop=n),Xt=!1,Kn(!0),Xn()}var t=Zr(e),n=R.scrollTop;if(!t||b)return;(rt(_t.from,_t.to)||it(t,_t.from)||!it(t,_t.to))&&hi(hr)(t.line,t.ch);var r=L.style.cssText;O.style.position="absolute",L.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);",Xt=!0;var i=L.value=Wn();Qn(),nt(L);if(h){U(e);var u=V(window,"mouseup",function(){u(),setTimeout(o,20)},!0)}else setTimeout(o,50)}function ti(){clearInterval(kt);var e=!0;Z.style.visibility="",kt=setInterval(function(){Z.style.visibility=(e=!e)?"":"hidden"},650)}function ri(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"==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=_t.inverted?_t.from:_t.to,n=cn(t.line),r=t.ch-1,i=r>=0&&ni[n.text.charAt(r)]||ni[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;li;--r){if(r==0)return 0;var o=cn(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 si(e){var t=ii(e),n=t&&cn(t-1).stateAfter;return n?n=x(Lt,n):n=T(Lt),At.iter(t,e,function(e){e.highlight(Lt,n,s.tabSize),e.stateAfter=x(Lt,n)}),t=At.size)continue;var r=ii(n),i=r&&cn(r-1).stateAfter;i?i=x(Lt,i):i=T(Lt);var o=0,u=Lt.compareStates,a=!1,f=r,l=!1;At.iter(f,At.size,function(t){var r=t.stateAfter;if(+(new Date)>e)return Ot.push(f),ai(s.workDelay),a&&Ut.push({from:n,to:f+1}),l=!0;var c=t.highlight(Lt,i,s.tabSize);c&&(a=!0),t.stateAfter=x(Lt,i);var h=null;if(u){var p=r&&u(r,i);p!=J&&(h=!!p)}h==null&&(c!==!1||!r?o=0:++o>3&&(!Lt.indent||Lt.indent(r,"")==Lt.indent(i,""))&&(h=!0));if(h)return!0;++f});if(l)return;a&&Ut.push({from:n,to:f+1})}t&&s.onHighlightComplete&&s.onHighlightComplete(ln)}function ai(e){if(!Ot.length)return;Ct.set(e,hi(ui))}function fi(){qt=Rt=zt=null,Ut=[],Wt=!1,$t=[]}function li(){en&&In();if(tn&&!s.lineWrapping){var e=ft.offsetWidth,t=qr(Zt,Zt.text.length).left;ft.style.left=t+"px",gt.style.minWidth=t+e+"px",tn=!1}var n,r;if(Wt){var i=Zn();n=tr(i.x,i.y,i.x,i.yBot)}if(Ut.length||n&&n.scrollTop!=null)r=rr(Ut,!0,n&&n.scrollTop);r||(Wt&&ur(),Vt&&or()),n&&Yn(),Wt&&(Gn(),ti()),Mt&&!Xt&&(qt===!0||qt!==!1&&Wt)&&Kn(Rt),Wt&&s.matchBrackets&&setTimeout(hi(function(){Yt&&(Yt(),Yt=null),rt(_t.from,_t.to)&&ri(!1)}),20);var o=Wt,u=$t;zt&&s.onChange&&ln&&s.onChange(ln,zt),o&&s.onCursorActivity&&s.onCursorActivity(ln);for(var a=0;au&&e.y>t.offsetHeight&&(s=e.y-t.offsetHeight),o+t.offsetWidth>a&&(o=a-t.offsetWidth)}t.style.top=s+Gr()+"px",t.style.left=t.style.right="",i=="right"?(o=Et.clientWidth-t.offsetWidth,t.style.right="0px"):(i=="left"?o=0:i=="middle"&&(o=(Et.clientWidth-t.offsetWidth)/2),t.style.left=o+Yr()+"px"),n&&er(o,s,o+t.offsetWidth,s+t.offsetHeight)},lineCount:function(){return At.size},clipPos:dr,getCursor:function(e){return e==null&&(e=_t.inverted),st(e?_t.from:_t.to)},somethingSelected:function(){return!rt(_t.from,_t.to)},setCursor:hi(function(e,t,n){t==null&&typeof e.line=="number"?hr(e.line,e.ch,n):hr(e,t,n)}),setSelection:hi(function(e,t,n){(n?fr:lr)(dr(e),dr(t||e))}),getLine:function(e){if(fn(e))return cn(e).text},getLineHandle:function(e){if(fn(e))return cn(e)},setLine:hi(function(e,t){fn(e)&&qn(t,{line:e,ch:0},{line:e,ch:cn(e).text.length})}),removeLine:hi(function(e){fn(e)&&qn("",{line:e,ch:0},dr({line:e+1,ch:0}))}),replaceRange:hi(qn),getRange:function(e,t,n){return zn(dr(e),dr(t),n)},triggerOnKeyDown:hi(Cn),execCommand:function(e){return u[e](ln)},moveH:hi(mr),deleteH:hi(gr),moveV:hi(yr),toggleOverwrite:function(){Ft?(Ft=!1,Z.className=Z.className.replace(" CodeMirror-overwrite","")):(Ft=!0,Z.className+=" CodeMirror-overwrite")},posFromIndex:function(e){var t=0,n;return At.iter(0,At.size,function(r){var i=r.text.length+1;if(i>e)return n=e,!0;e-=i,++t}),dr({line:t,ch:n})},indexFromPos:function(e){if(e.line<0||e.ch<0)return 0;var t=e.ch;return At.iter(0,e.line,function(e){t+=e.text.length+1}),t},scrollTo:function(e,t){e!=null&&(St.scrollLeft=e),t!=null&&(R.scrollTop=St.scrollTop=t),rr([])},getScrollInfo:function(){return{x:St.scrollLeft,y:R.scrollTop,height:R.scrollHeight,width:St.scrollWidth}},setSize:function(e,t){function n(e){return e=String(e),/^\d+$/.test(e)?e+"px":e}e!=null&&(xt.style.width=n(e)),t!=null&&(St.style.height=n(t)),ln.refresh()},operation:function(e){return hi(e)()},compoundChange:function(e){return pi(e)},refresh:function(){rr(!0,null,Bt),R.scrollHeight>Bt&&(R.scrollTop=Bt)},getInputField:function(){return L},getWrapperElement:function(){return xt},getScrollerElement:function(){return St},getGutterElement:function(){return bt}},Sn,Nn=null,$n="";Ar.prototype.clear=hi(function(){var e=Infinity,t=-Infinity;for(var n=0,r=this.set.length;n",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},ci=0;for(var di in o)o.propertyIsEnumerable(di)&&!ln.propertyIsEnumerable(di)&&(ln[di]=o[di]);return ln}function f(e){return typeof e=="string"?a[e]:e}function l(e,t,n,r,i){function s(t){t=f(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;ue&&r.push(u.slice(e-s,Math.min(u.length,t-s)),n[i+1]),a>=e&&(o=1)):o==1&&(a>t?r.push(u.slice(0,t-s),n[i+1]):r.push(u,n[i+1])),s=a}}function M(e){this.lines=e,this.parent=null;for(var t=0,n=e.length,r=0;t=0&&r>=0;--n,--r)if(e.charAt(n)!=t.charAt(r))break;return r+1}function ct(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0,r=e.length;n2){n.dependencies=[];for(var r=2;r0&&t.ch=this.string.length},sol:function(){return this.pos==0},peek:function(){return this.string.charAt(this.pos)},next:function(){if(this.post},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 Y(this.string,this.start,this.tabSize)},indentation:function(){return Y(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&&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=N,C.prototype={attach:function(e){this.marker.set.push(e)},detach:function(e){var t=ct(this.marker.set,e);t>-1&&this.marker.set.splice(t,1)},split:function(e,t){if(this.to<=e&&this.to!=null)return null;var n=this.fromthis.from&&(r=t&&(this.from=Math.max(r,this.from)+i),n&&(tthis.from||this.from==null)?this.to=null:this.to!=null&&this.to>t&&(this.to=r=this.to},sameSet:function(e){return this.marker==e.marker}},k.prototype={attach:function(e){this.line=e},detach:function(e){this.line==e&&(this.line=null)},split:function(e,t){if(ethis.to},clipTo:function(e,t,n,r,i){(e||tthis.to)?(this.from=0,this.to=-1):this.from>t&&(this.from=this.to=Math.max(r,this.from)+i)},sameSet:function(e){return!1},find:function(){return!this.line||!this.line.parent?null:{line:P(this.line),ch:this.from}},clear:function(){if(this.line){var e=ct(this.line.marked,this);e!=-1&&this.line.marked.splice(e,1),this.line=null}}};var L=" ";h||p&&!d?L="\u200b":b&&(L=""),A.inheritMarks=function(e,t){var n=new A(e),r=t&&t.marked;if(r)for(var i=0;i5e3){i[s++]=this.text.slice(r.pos),i[s++]=null;break}}return i.length!=s&&(i.length=s,o=!0),s&&i[s-2]!=a&&(o=!0),o||(i.length<5&&this.text.length<10?null:!1)},getTokenAt:function(e,t,n){var r=this.text,i=new N(r);while(i.pos=f&&tf&&(u(e,r.slice(0,t-f),i),n&&e.appendChild(ot("wbr"))),e.appendChild(l);var o=t-f;u(l,b?r.slice(o,o+1):r.slice(o),i),b&&u(e,r.slice(o+1),i),t--,f+=s}else f+=s,u(e,r,i),f==t&&f==v?(ft(l,L),e.appendChild(l)):f>t+10&&/\s/.test(r)&&(a=function(){})}}var c=this.styles,h=this.text,d=this.marked,v=h.length;if(!h&&t==null)a(o," ");else if(!d||!d.length)for(var g=0,y=0;yv&&(w=w.slice(0,v-y)),y+=S,a(o,w,m(E))}else{var x=0,g=0,T="",E,N=0,C=d[0].from||0,k=[],A=0,O=function(){var e;while(A_?T.slice(0,_-x):T,P);if(D>=_){T=T.slice(_-x),x=_;break}x=D}T=c[g++],E=m(c[g++])}}}return o},cleanUp:function(){this.parent=null;if(this.marked)for(var e=0,t=this.marked.length;e50){while(s.lines.length>50){var u=s.lines.splice(s.lines.length-25,25),a=new M(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 _(t);if(!e.parent){var r=new _(e.children);r.parent=e,e.children=[r,n],e=r}else{e.size-=n.size,e.height-=n.height;var i=ct(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;r400||!s||this.closed||s.start>e+n.length||s.start+s.added0;--f)s.old.unshift(n[f-1]);for(var f=a;f>0;--f)s.old.push(n[n.length-f]);u&&(s.start=e),s.added+=t-(n.length-u-a)}this.time=r},startCompound:function(){this.compound++||(this.closed=!0)},endCompound:function(){--this.compound||(this.closed=!0)}},e.e_stop=U,e.e_preventDefault=q,e.e_stopPropagation=R,e.connect=V,$.prototype={set:function(e,t){clearTimeout(this.id),this.id=setTimeout(t,e)}};var J=e.Pass={toString:function(){return"CodeMirror.Pass"}},K=function(){if(v)return!1;var e=ot("div");return"draggable"in e||"dragDrop"in e}(),Q=function(){var e=ot("textarea");return e.value="foo\nbar",e.value.indexOf("\r")>-1?"\r\n":"\n"}(),G=/^$/;h?G=/$'/:w?G=/\-[^ \-?]|\?[^ !'\"\),.\-\/:;\?\]\}]/:y&&(G=/\-[^ \-\.?]|\?[^ \-\.?\]\}:;!'\"\),\/]|[\.!\"#&%\)*+,:;=>\]|\}~][\(\{\[<]|\$'/),e.setTextContent=ft;var pt="\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=pt;var dt=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 vt={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=vt,function(){for(var e=0;e<10;e++)vt[e+48]=String(e);for(var e=65;e<=90;e++)vt[e]=String.fromCharCode(e);for(var e=1;e<=12;e++)vt[e+111]=vt[e+63235]="F"+e}(),e}();CodeMirror.defineMode("properties",function(){return{token:function(e,t){var n=e.sol()||t.afterSection,r=e.eol();t.afterSection=!1,n&&(t.nextMultiline?(t.inMultiline=!0,t.nextMultiline=!1):t.position="def"),r&&!t.nextMultiline&&(t.inMultiline=!1,t.position="def");if(n)while(e.eatSpace());var i=e.next();return!n||i!=="#"&&i!=="!"&&i!==";"?n&&i==="["?(t.afterSection=!0,e.skipTo("]"),e.eat("]"),"header"):i==="="||i===":"?(t.position="quote",null):(i==="\\"&&t.position==="quote"&&e.next()!=="u"&&(t.nextMultiline=!0),t.position):(t.position="comment",e.skipToEnd(),"comment")},startState:function(){return{position:"def",nextMultiline:!1,inMultiline:!1,afterSection:!1}}}}),CodeMirror.defineMIME("text/x-properties","properties"),CodeMirror.defineMIME("text/x-ini","properties")