1(function(a,b){typeof exports==="object"&&typeof module!=="undefined"?module.exports=b():typeof define==="function"&&define.amd?define(b):(a=a||self,a.CodeMirror=b())})(this,function(){"use strict";var a=navigator.userAgent;var b=navigator.platform;var c=/gecko\/\d/i.test(a);var d=/MSIE \d/.test(a);var e=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(a);var f=/Edge\/(\d+)/.exec(a);var g=d||e||f;var h=g&&(d?document.documentMode||6:+(f||e)[1]);var i=!f&&/WebKit\//.test(a);var j=i&&/Qt\/\d+\.\d+/.test(a);var k=!f&&/Chrome\//.test(a);var l=/Opera\//.test(a);var m=/Apple Computer/.test(navigator.vendor);var n=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(a);var o=/PhantomJS/.test(a);var p=!f&&/AppleWebKit/.test(a)&&/Mobile\/\w+/.test(a);var q=/Android/.test(a);var r=p||q||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(a);var s=p||/Mac/.test(b);var t=/\bCrOS\b/.test(a);var u=/win/i.test(b);var v=l&&a.match(/Version\/(\d*\.\d*)/);if(v){v=Number(v[1])}if(v&&v>=15){l=false;i=true}var w=s&&(j||l&&(v==null||v<12.11));var x=c||g&&h>=9;function y(a){return new RegExp("(^|\\s)"+a+"(?:$|\\s)\\s*")}var z=function(a,b){var c=a.className;var d=y(b).exec(c);if(d){var e=c.slice(d.index+d[0].length);a.className=c.slice(0,d.index)+(e?d[1]+e:"")}};function A(a){for(var b=a.childNodes.length;b>0;--b){a.removeChild(a.firstChild)}return a}function B(a,b){return A(a).appendChild(b)}function C(a,b,c,d){var e=document.createElement(a);if(c){e.className=c}if(d){e.style.cssText=d}if(typeof b=="string"){e.appendChild(document.createTextNode(b))}else if(b){for(var f=0;f<b.length;++f){e.appendChild(b[f])}}return e}function D(a,b,c,d){var e=C(a,b,c,d);e.setAttribute("role","presentation");return e}var E;if(document.createRange){E=function(a,b,c,d){var e=document.createRange();e.setEnd(d||a,c);e.setStart(a,b);return e}}else{E=function(a,b,c){var d=document.body.createTextRange();try{d.moveToElementText(a.parentNode)}catch(e){return d}d.collapse(true);d.moveEnd("character",c);d.moveStart("character",b);return d}}function F(a,b){if(b.nodeType==3){b=b.parentNode}if(a.contains){return a.contains(b)}do{if(b.nodeType==11){b=b.host}if(b==a){return true}}while(b=b.parentNode)}function G(){var a;try{a=document.activeElement}catch(b){a=document.body||null}while(a&&a.shadowRoot&&a.shadowRoot.activeElement){a=a.shadowRoot.activeElement}return a}function H(a,b){var c=a.className;if(!y(b).test(c)){a.className+=(c?" ":"")+b}}function I(a,b){var c=a.split(" ");for(var d=0;d<c.length;d++){if(c[d]&&!y(c[d]).test(b)){b+=" "+c[d]}}return b}var J=function(a){a.select()};if(p){J=function(a){a.selectionStart=0;a.selectionEnd=a.value.length}}else if(g){J=function(a){try{a.select()}catch(b){}}}function K(a){var b=Array.prototype.slice.call(arguments,1);return function(){return a.apply(null,b)}}function L(a,b,c){if(!b){b={}}for(var d in a){if(a.hasOwnProperty(d)&&(c!==false||!b.hasOwnProperty(d))){b[d]=a[d]}}return b}function M(a,b,c,d,e){if(b==null){b=a.search(/[^\s\u00a0]/);if(b==-1){b=a.length}}for(var f=d||0,g=e||0;;){var h=a.indexOf("\t",f);if(h<0||h>=b){return g+(b-f)}g+=h-f;g+=c-g%c;f=h+1}}var N=function(){this.id=null;this.f=null;this.time=0;this.handler=K(this.onTimeout,this)};N.prototype.onTimeout=function(a){a.id=0;if(a.time<=+new Date){a.f()}else{setTimeout(a.handler,a.time-+new Date)}};N.prototype.set=function(a,b){this.f=b;var c=+new Date+a;if(!this.id||c<this.time){clearTimeout(this.id);this.id=setTimeout(this.handler,a);this.time=c}};function O(a,b){for(var c=0;c<a.length;++c){if(a[c]==b){return c}}return-1}var P=50;var Q={toString:function(){return"CodeMirror.Pass"}};var R={scroll:false},S={origin:"*mouse"},T={origin:"+move"};function U(a,b,c){for(var d=0,e=0;;){var f=a.indexOf("\t",d);if(f==-1){f=a.length}var g=f-d;if(f==a.length||e+g>=b){return d+Math.min(g,b-e)}e+=f-d;e+=c-e%c;d=f+1;if(e>=b){return d}}}var V=[""];function W(a){while(V.length<=a){V.push(X(V)+" ")}return V[a]}function X(a){return a[a.length-1]}function Y(a,b){var c=[];for(var d=0;d<a.length;d++){c[d]=b(a[d],d)}return c}function Z(a,b,c){var d=0,e=c(b);while(d<a.length&&c(a[d])<=e){d++}a.splice(d,0,b)}function $(){}function _(a,b){var c;if(Object.create){c=Object.create(a)}else{$.prototype=a;c=new $}if(b){L(b,c)}return c}var aa=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function ba(a){return/\w/.test(a)||a>""&&(a.toUpperCase()!=a.toLowerCase()||aa.test(a))}function ca(a,b){if(!b){return ba(a)}if(b.source.indexOf("\\w")>-1&&ba(a)){return true}return b.test(a)}function da(a){for(var b in a){if(a.hasOwnProperty(b)&&a[b]){return false}}return true}var ea=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function fa(a){return a.charCodeAt(0)>=768&&ea.test(a)}function ga(a,b,c){while((c<0?b>0:b<a.length)&&fa(a.charAt(b))){b+=c}return b}function ha(a,b,c){var d=b>c?-1:1;for(;;){if(b==c){return b}var e=(b+c)/2,f=d<0?Math.ceil(e):Math.floor(e);if(f==b){return a(f)?b:c}if(a(f)){c=f}else{b=f+d}}}function ia(a,b,c,d){if(!a){return d(b,c,"ltr",0)}var e=false;for(var f=0;f<a.length;++f){var g=a[f];if(g.from<c&&g.to>b||b==c&&g.to==b){d(Math.max(g.from,b),Math.min(g.to,c),g.level==1?"rtl":"ltr",f);e=true}}if(!e){d(b,c,"ltr")}}var ja=null;function ka(a,b,c){var d;ja=null;for(var e=0;e<a.length;++e){var f=a[e];if(f.from<b&&f.to>b){return e}if(f.to==b){if(f.from!=f.to&&c=="before"){d=e}else{ja=e}}if(f.from==b){if(f.from!=f.to&&c!="before"){d=e}else{ja=e}}}return d!=null?d:ja}var la=function(){var a="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN";var b="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function c(c){if(c<=247){return a.charAt(c)}else if(1424<=c&&c<=1524){return"R"}else if(1536<=c&&c<=1785){return b.charAt(c-1536)}else if(1774<=c&&c<=2220){return"r"}else if(8192<=c&&c<=8203){return"w"}else if(c==8204){return"b"}else{return"L"}}var d=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;var e=/[stwN]/,f=/[LRr]/,g=/[Lb1n]/,h=/[1n]/;function i(a,b,c){this.level=a;this.from=b;this.to=c}return function(a,b){var j=b=="ltr"?"L":"R";if(a.length==0||b=="ltr"&&!d.test(a)){return false}var k=a.length,l=[];for(var m=0;m<k;++m){l.push(c(a.charCodeAt(m)))}for(var n=0,o=j;n<k;++n){var p=l[n];if(p=="m"){l[n]=o}else{o=p}}for(var q=0,r=j;q<k;++q){var s=l[q];if(s=="1"&&r=="r"){l[q]="n"}else if(f.test(s)){r=s;if(s=="r"){l[q]="R"}}}for(var t=1,u=l[0];t<k-1;++t){var v=l[t];if(v=="+"&&u=="1"&&l[t+1]=="1"){l[t]="1"}else if(v==","&&u==l[t+1]&&(u=="1"||u=="n")){l[t]=u}u=v}for(var w=0;w<k;++w){var x=l[w];if(x==","){l[w]="N"}else if(x=="%"){var y=void 0;for(y=w+1;y<k&&l[y]=="%";++y){}var z=w&&l[w-1]=="!"||y<k&&l[y]=="1"?"1":"N";for(var A=w;A<y;++A){l[A]=z}w=y-1}}for(var B=0,C=j;B<k;++B){var D=l[B];if(C=="L"&&D=="1"){l[B]="L"}else if(f.test(D)){C=D}}for(var E=0;E<k;++E){if(e.test(l[E])){var F=void 0;for(F=E+1;F<k&&e.test(l[F]);++F){}var G=(E?l[E-1]:j)=="L";var H=(F<k?l[F]:j)=="L";var I=G==H?G?"L":"R":j;for(var J=E;J<F;++J){l[J]=I}E=F-1}}var K=[],L;for(var M=0;M<k;){if(g.test(l[M])){var N=M;for(++M;M<k&&g.test(l[M]);++M){}K.push(new i(0,N,M))}else{var O=M,P=K.length,Q=b=="rtl"?1:0;for(++M;M<k&&l[M]!="L";++M){}for(var R=O;R<M;){if(h.test(l[R])){if(O<R){K.splice(P,0,new i(1,O,R));P+=Q}var S=R;for(++R;R<M&&h.test(l[R]);++R){}K.splice(P,0,new i(2,S,R));P+=Q;O=R}else{++R}}if(O<M){K.splice(P,0,new i(1,O,M))}}}if(b=="ltr"){if(K[0].level==1&&(L=a.match(/^\s+/))){K[0].from=L[0].length;K.unshift(new i(0,0,L[0].length))}if(X(K).level==1&&(L=a.match(/\s+$/))){X(K).to-=L[0].length;K.push(new i(0,k-L[0].length,k))}}return b=="rtl"?K.reverse():K}}();function ma(a,b){var c=a.order;if(c==null){c=a.order=la(a.text,b)}return c}var na=[];var oa=function(a,b,c){if(a.addEventListener){a.addEventListener(b,c,false)}else if(a.attachEvent){a.attachEvent("on"+b,c)}else{var d=a._handlers||(a._handlers={});d[b]=(d[b]||na).concat(c)}};function pa(a,b){return a._handlers&&a._handlers[b]||na}function qa(a,b,c){if(a.removeEventListener){a.removeEventListener(b,c,false)}else if(a.detachEvent){a.detachEvent("on"+b,c)}else{var d=a._handlers,e=d&&d[b];if(e){var f=O(e,c);if(f>-1){d[b]=e.slice(0,f).concat(e.slice(f+1))}}}}function ra(a,b){var c=pa(a,b);if(!c.length){return}var d=Array.prototype.slice.call(arguments,2);for(var e=0;e<c.length;++e){c[e].apply(null,d)}}function sa(a,b,c){if(typeof b=="string"){b={type:b,preventDefault:function(){this.defaultPrevented=true}}}ra(a,c||b.type,a,b);return ya(b)||b.codemirrorIgnore}function ta(a){var b=a._handlers&&a._handlers.cursorActivity;if(!b){return}var c=a.curOp.cursorActivityHandlers||(a.curOp.cursorActivityHandlers=[]);for(var d=0;d<b.length;++d){if(O(c,b[d])==-1){c.push(b[d])}}}function ua(a,b){return pa(a,b).length>0}function va(a){a.prototype.on=function(a,b){oa(this,a,b)};a.prototype.off=function(a,b){qa(this,a,b)}}function wa(a){if(a.preventDefault){a.preventDefault()}else{a.returnValue=false}}function xa(a){if(a.stopPropagation){a.stopPropagation()}else{a.cancelBubble=true}}function ya(a){return a.defaultPrevented!=null?a.defaultPrevented:a.returnValue==false}function za(a){wa(a);xa(a)}function Aa(a){return a.target||a.srcElement}function Ba(a){var b=a.which;if(b==null){if(a.button&1){b=1}else if(a.button&2){b=3}else if(a.button&4){b=2}}if(s&&a.ctrlKey&&b==1){b=3}return b}var Ca=function(){if(g&&h<9){return false}var a=C("div");return"draggable"in a||"dragDrop"in a}();var Da;function Ea(a){if(Da==null){var b=C("span","");B(a,C("span",[b,document.createTextNode("x")]));if(a.firstChild.offsetHeight!=0){Da=b.offsetWidth<=1&&b.offsetHeight>2&&!(g&&h<8)}}var c=Da?C("span",""):C("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");c.setAttribute("cm-text","");return c}var Fa;function Ga(a){if(Fa!=null){return Fa}var b=B(a,document.createTextNode("AخA"));var c=E(b,0,1).getBoundingClientRect();var d=E(b,1,2).getBoundingClientRect();A(a);if(!c||c.left==c.right){return false}return Fa=d.right-c.right<3}var Ha="\n\nb".split(/\n/).length!=3?function(a){var b=0,c=[],d=a.length;while(b<=d){var e=a.indexOf("\n",b);if(e==-1){e=a.length}var f=a.slice(b,a.charAt(e-1)=="\r"?e-1:e);var g=f.indexOf("\r");if(g!=-1){c.push(f.slice(0,g));b+=g+1}else{c.push(f);b=e+1}}return c}:function(a){return a.split(/\r\n?|\n/)};var Ia=window.getSelection?function(a){try{return a.selectionStart!=a.selectionEnd}catch(b){return false}}:function(a){var b;try{b=a.ownerDocument.selection.createRange()}catch(c){}if(!b||b.parentElement()!=a){return false}return b.compareEndPoints("StartToEnd",b)!=0};var Ja=function(){var a=C("div");if("oncopy"in a){return true}a.setAttribute("oncopy","return;");return typeof a.oncopy=="function"}();var Ka=null;function La(a){if(Ka!=null){return Ka}var b=B(a,C("span","x"));var c=b.getBoundingClientRect();var d=E(b,0,1).getBoundingClientRect();return Ka=Math.abs(c.left-d.left)>1}var Ma={},Na={};function Oa(a,b){if(arguments.length>2){b.dependencies=Array.prototype.slice.call(arguments,2)}Ma[a]=b}function Pa(a,b){Na[a]=b}function Qa(a){if(typeof a=="string"&&Na.hasOwnProperty(a)){a=Na[a]}else if(a&&typeof a.name=="string"&&Na.hasOwnProperty(a.name)){var b=Na[a.name];if(typeof b=="string"){b={name:b}}a=_(b,a);a.name=b.name}else if(typeof a=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(a)){return Qa("application/xml")}else if(typeof a=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(a)){return Qa("application/json")}if(typeof a=="string"){return{name:a}}else{return a||{name:"null"}}}function Ra(a,b){b=Qa(b);var c=Ma[b.name];if(!c){return Ra(a,"text/plain")}var d=c(a,b);if(Sa.hasOwnProperty(b.name)){var e=Sa[b.name];for(var f in e){if(!e.hasOwnProperty(f)){continue}if(d.hasOwnProperty(f)){d["_"+f]=d[f]}d[f]=e[f]}}d.name=b.name;if(b.helperType){d.helperType=b.helperType}if(b.modeProps){for(var g in b.modeProps){d[g]=b.modeProps[g]}}return d}var Sa={};function Ta(a,b){var c=Sa.hasOwnProperty(a)?Sa[a]:Sa[a]={};L(b,c)}function Ua(a,b){if(b===true){return b}if(a.copyState){return a.copyState(b)}var c={};for(var d in b){var e=b[d];if(e instanceof Array){e=e.concat([])}c[d]=e}return c}function Va(a,b){var c;while(a.innerMode){c=a.innerMode(b);if(!c||c.mode==a){break}b=c.state;a=c.mode}return c||{mode:a,state:b}}function Wa(a,b,c){return a.startState?a.startState(b,c):true}var Xa=function(a,b,c){this.pos=this.start=0;this.string=a;this.tabSize=b||8;this.lastColumnPos=this.lastColumnValue=0;this.lineStart=0;this.lineOracle=c};Xa.prototype.eol=function(){return this.pos>=this.string.length};Xa.prototype.sol=function(){return this.pos==this.lineStart};Xa.prototype.peek=function(){return this.string.charAt(this.pos)||undefined};Xa.prototype.next=function(){if(this.pos<this.string.length){return this.string.charAt(this.pos++)}};Xa.prototype.eat=function(a){var b=this.string.charAt(this.pos);var c;if(typeof a=="string"){c=b==a}else{c=b&&(a.test?a.test(b):a(b))}if(c){++this.pos;return b}};Xa.prototype.eatWhile=function(a){var b=this.pos;while(this.eat(a)){}return this.pos>b};Xa.prototype.eatSpace=function(){var a=this.pos;while(/[\s\u00a0]/.test(this.string.charAt(this.pos))){++this.pos}return this.pos>a};Xa.prototype.skipToEnd=function(){this.pos=this.string.length};Xa.prototype.skipTo=function(a){var b=this.string.indexOf(a,this.pos);if(b>-1){this.pos=b;return true}};Xa.prototype.backUp=function(a){this.pos-=a};Xa.prototype.column=function(){if(this.lastColumnPos<this.start){this.lastColumnValue=M(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue);this.lastColumnPos=this.start}return this.lastColumnValue-(this.lineStart?M(this.string,this.lineStart,this.tabSize):0)};Xa.prototype.indentation=function(){return M(this.string,null,this.tabSize)-(this.lineStart?M(this.string,this.lineStart,this.tabSize):0)};Xa.prototype.match=function(a,b,c){if(typeof a=="string"){var d=function(a){return c?a.toLowerCase():a};var e=this.string.substr(this.pos,a.length);if(d(e)==d(a)){if(b!==false){this.pos+=a.length}return true}}else{var f=this.string.slice(this.pos).match(a);if(f&&f.index>0){return null}if(f&&b!==false){this.pos+=f[0].length}return f}};Xa.prototype.current=function(){return this.string.slice(this.start,this.pos)};Xa.prototype.hideFirstChars=function(a,b){this.lineStart+=a;try{return b()}finally{this.lineStart-=a}};Xa.prototype.lookAhead=function(a){var b=this.lineOracle;return b&&b.lookAhead(a)};Xa.prototype.baseToken=function(){var a=this.lineOracle;return a&&a.baseToken(this.pos)};function Ya(a,b){b-=a.first;if(b<0||b>=a.size){throw new Error("There is no line "+(b+a.first)+" in the document.")}var c=a;while(!c.lines){for(var d=0;;++d){var e=c.children[d],f=e.chunkSize();if(b<f){c=e;break}b-=f}}return c.lines[b]}function Za(a,b,c){var d=[],e=b.line;a.iter(b.line,c.line+1,function(a){var f=a.text;if(e==c.line){f=f.slice(0,c.ch)}if(e==b.line){f=f.slice(b.ch)}d.push(f);++e});return d}function $a(a,b,c){var d=[];a.iter(b,c,function(a){d.push(a.text)});return d}function _a(a,b){var c=b-a.height;if(c){for(var d=a;d;d=d.parent){d.height+=c}}}function ab(a){if(a.parent==null){return null}var b=a.parent,c=O(b.lines,a);for(var d=b.parent;d;b=d,d=d.parent){for(var e=0;;++e){if(d.children[e]==b){break}c+=d.children[e].chunkSize()}}return c+b.first}function bb(a,b){var c=a.first;a:do{for(var d=0;d<a.children.length;++d){var e=a.children[d],f=e.height;if(b<f){a=e;continue a}b-=f;c+=e.chunkSize()}return c}while(!a.lines);var g=0;for(;g<a.lines.length;++g){var h=a.lines[g],i=h.height;if(b<i){break}b-=i}return c+g}function cb(a,b){return b>=a.first&&b<a.first+a.size}function db(a,b){return String(a.lineNumberFormatter(b+a.firstLineNumber))}function eb(a,b,c){if(c===void 0)c=null;if(!(this instanceof eb)){return new eb(a,b,c)}this.line=a;this.ch=b;this.sticky=c}function fb(a,b){return a.line-b.line||a.ch-b.ch}function gb(a,b){return a.sticky==b.sticky&&fb(a,b)==0}function hb(a){return eb(a.line,a.ch)}function ib(a,b){return fb(a,b)<0?b:a}function jb(a,b){return fb(a,b)<0?a:b}function kb(a,b){return Math.max(a.first,Math.min(b,a.first+a.size-1))}function lb(a,b){if(b.line<a.first){return eb(a.first,0)}var c=a.first+a.size-1;if(b.line>c){return eb(c,Ya(a,c).text.length)}return mb(b,Ya(a,b.line).text.length)}function mb(a,b){var c=a.ch;if(c==null||c>b){return eb(a.line,b)}else if(c<0){return eb(a.line,0)}else{return a}}function nb(a,b){var c=[];for(var d=0;d<b.length;d++){c[d]=lb(a,b[d])}return c}var ob=function(a,b){this.state=a;this.lookAhead=b};var pb=function(a,b,c,d){this.state=b;this.doc=a;this.line=c;this.maxLookAhead=d||0;this.baseTokens=null;this.baseTokenPos=1};pb.prototype.lookAhead=function(a){var b=this.doc.getLine(this.line+a);if(b!=null&&a>this.maxLookAhead){this.maxLookAhead=a}return b};pb.prototype.baseToken=function(a){if(!this.baseTokens){return null}while(this.baseTokens[this.baseTokenPos]<=a){this.baseTokenPos+=2}var b=this.baseTokens[this.baseTokenPos+1];return{type:b&&b.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-a}};pb.prototype.nextLine=function(){this.line++;if(this.maxLookAhead>0){this.maxLookAhead--}};pb.fromSaved=function(a,b,c){if(b instanceof ob){return new pb(a,Ua(a.mode,b.state),c,b.lookAhead)}else{return new pb(a,Ua(a.mode,b),c)}};pb.prototype.save=function(a){var b=a!==false?Ua(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new ob(b,this.maxLookAhead):b};function qb(a,b,c,d){var e=[a.state.modeGen],f={};zb(a,b.text,a.doc.mode,c,function(a,b){return e.push(a,b)},f,d);var g=c.state;var h=function(d){c.baseTokens=e;var h=a.state.overlays[d],i=1,j=0;c.state=true;zb(a,b.text,h.mode,c,function(a,b){var c=i;while(j<a){var d=e[i];if(d>a){e.splice(i,1,a,e[i+1],d)}i+=2;j=Math.min(a,d)}if(!b){return}if(h.opaque){e.splice(c,i-c,a,"overlay "+b);i=c+2}else{for(;c<i;c+=2){var f=e[c+1];e[c+1]=(f?f+" ":"")+"overlay "+b}}},f);c.state=g;c.baseTokens=null;c.baseTokenPos=1};for(var i=0;i<a.state.overlays.length;++i)h(i);return{styles:e,classes:f.bgClass||f.textClass?f:null}}function rb(a,b,c){if(!b.styles||b.styles[0]!=a.state.modeGen){var d=sb(a,ab(b));var e=b.text.length>a.options.maxHighlightLength&&Ua(a.doc.mode,d.state);var f=qb(a,b,d);if(e){d.state=e}b.stateAfter=d.save(!e);b.styles=f.styles;if(f.classes){b.styleClasses=f.classes}else if(b.styleClasses){b.styleClasses=null}if(c===a.doc.highlightFrontier){a.doc.modeFrontier=Math.max(a.doc.modeFrontier,++a.doc.highlightFrontier)}}return b.styles}function sb(a,b,c){var d=a.doc,e=a.display;if(!d.mode.startState){return new pb(d,true,b)}var f=Ab(a,b,c);var g=f>d.first&&Ya(d,f-1).stateAfter;var h=g?pb.fromSaved(d,g,f):new pb(d,Wa(d.mode),f);d.iter(f,b,function(c){tb(a,c.text,h);var d=h.line;c.stateAfter=d==b-1||d%5==0||d>=e.viewFrom&&d<e.viewTo?h.save():null;h.nextLine()});if(c){d.modeFrontier=h.line}return h}function tb(a,b,c,d){var e=a.doc.mode;var f=new Xa(b,a.options.tabSize,c);f.start=f.pos=d||0;if(b==""){ub(e,c.state)}while(!f.eol()){vb(e,f,c.state);f.start=f.pos}}function ub(a,b){if(a.blankLine){return a.blankLine(b)}if(!a.innerMode){return}var c=Va(a,b);if(c.mode.blankLine){return c.mode.blankLine(c.state)}}function vb(a,b,c,d){for(var e=0;e<10;e++){if(d){d[0]=Va(a,c).mode}var f=a.token(b,c);if(b.pos>b.start){return f}}throw new Error("Mode "+a.name+" failed to advance stream.")}var wb=function(a,b,c){this.start=a.start;this.end=a.pos;this.string=a.current();this.type=b||null;this.state=c};function xb(a,b,c,d){var e=a.doc,f=e.mode,g;b=lb(e,b);var h=Ya(e,b.line),i=sb(a,b.line,c);var j=new Xa(h.text,a.options.tabSize,i),k;if(d){k=[]}while((d||j.pos<b.ch)&&!j.eol()){j.start=j.pos;g=vb(f,j,i.state);if(d){k.push(new wb(j,g,Ua(e.mode,i.state)))}}return d?k:new wb(j,g,i.state)}function yb(a,b){if(a){for(;;){var c=a.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!c){break}a=a.slice(0,c.index)+a.slice(c.index+c[0].length);var d=c[1]?"bgClass":"textClass";if(b[d]==null){b[d]=c[2]}else if(!new RegExp("(?:^|\\s)"+c[2]+"(?:$|\\s)").test(b[d])){b[d]+=" "+c[2]}}}return a}function zb(a,b,c,d,e,f,g){var h=c.flattenSpans;if(h==null){h=a.options.flattenSpans}var i=0,j=null;var k=new Xa(b,a.options.tabSize,d),l;var m=a.options.addModeClass&&[null];if(b==""){yb(ub(c,d.state),f)}while(!k.eol()){if(k.pos>a.options.maxHighlightLength){h=false;if(g){tb(a,b,d,k.pos)}k.pos=b.length;l=null}else{l=yb(vb(c,k,d.state,m),f)}if(m){var n=m[0].name;if(n){l="m-"+(l?n+" "+l:n)}}if(!h||j!=l){while(i<k.start){i=Math.min(k.start,i+5e3);e(i,j)}j=l}k.start=k.pos}while(i<k.pos){var o=Math.min(k.pos,i+5e3);e(o,j);i=o}}function Ab(a,b,c){var d,e,f=a.doc;var g=c?-1:b-(a.doc.mode.innerMode?1e3:100);for(var h=b;h>g;--h){if(h<=f.first){return f.first}var i=Ya(f,h-1),j=i.stateAfter;if(j&&(!c||h+(j instanceof ob?j.lookAhead:0)<=f.modeFrontier)){return h}var k=M(i.text,null,a.options.tabSize);if(e==null||d>k){e=h-1;d=k}}return e}function Bb(a,b){a.modeFrontier=Math.min(a.modeFrontier,b);if(a.highlightFrontier<b-10){return}var c=a.first;for(var d=b-1;d>c;d--){var e=Ya(a,d).stateAfter;if(e&&(!(e instanceof ob)||d+e.lookAhead<b)){c=d+1;break}}a.highlightFrontier=Math.min(a.highlightFrontier,c)}var Cb=false,Db=false;function Eb(){Cb=true}function Fb(){Db=true}function Gb(a,b,c){this.marker=a;this.from=b;this.to=c}function Hb(a,b){if(a){for(var c=0;c<a.length;++c){var d=a[c];if(d.marker==b){return d}}}}function Ib(a,b){var c;for(var d=0;d<a.length;++d){if(a[d]!=b){(c||(c=[])).push(a[d])}}return c}function Jb(a,b){a.markedSpans=a.markedSpans?a.markedSpans.concat([b]):[b];b.marker.attachLine(a)}function Kb(a,b,c){var d;if(a){for(var e=0;e<a.length;++e){var f=a[e],g=f.marker;var h=f.from==null||(g.inclusiveLeft?f.from<=b:f.from<b);if(h||f.from==b&&g.type=="bookmark"&&(!c||!f.marker.insertLeft)){var i=f.to==null||(g.inclusiveRight?f.to>=b:f.to>b);(d||(d=[])).push(new Gb(g,f.from,i?null:f.to))}}}return d}function Lb(a,b,c){var d;if(a){for(var e=0;e<a.length;++e){var f=a[e],g=f.marker;var h=f.to==null||(g.inclusiveRight?f.to>=b:f.to>b);if(h||f.from==b&&g.type=="bookmark"&&(!c||f.marker.insertLeft)){var i=f.from==null||(g.inclusiveLeft?f.from<=b:f.from<b);(d||(d=[])).push(new Gb(g,i?null:f.from-b,f.to==null?null:f.to-b))}}}return d}function Mb(a,b){if(b.full){return null}var c=cb(a,b.from.line)&&Ya(a,b.from.line).markedSpans;var d=cb(a,b.to.line)&&Ya(a,b.to.line).markedSpans;if(!c&&!d){return null}var e=b.from.ch,f=b.to.ch,g=fb(b.from,b.to)==0;var h=Kb(c,e,g);var i=Lb(d,f,g);var j=b.text.length==1,k=X(b.text).length+(j?e:0);if(h){for(var l=0;l<h.length;++l){var m=h[l];if(m.to==null){var n=Hb(i,m.marker);if(!n){m.to=e}else if(j){m.to=n.to==null?null:n.to+k}}}}if(i){for(var o=0;o<i.length;++o){var p=i[o];if(p.to!=null){p.to+=k}if(p.from==null){var q=Hb(h,p.marker);if(!q){p.from=k;if(j){(h||(h=[])).push(p)}}}else{p.from+=k;if(j){(h||(h=[])).push(p)}}}}if(h){h=Nb(h)}if(i&&i!=h){i=Nb(i)}var r=[h];if(!j){var s=b.text.length-2,t;if(s>0&&h){for(var u=0;u<h.length;++u){if(h[u].to==null){(t||(t=[])).push(new Gb(h[u].marker,null,null))}}}for(var v=0;v<s;++v){r.push(t)}r.push(i)}return r}function Nb(a){for(var b=0;b<a.length;++b){var c=a[b];if(c.from!=null&&c.from==c.to&&c.marker.clearWhenEmpty!==false){a.splice(b--,1)}}if(!a.length){return null}return a}function Ob(a,b,c){var d=null;a.iter(b.line,c.line+1,function(a){if(a.markedSpans){for(var b=0;b<a.markedSpans.length;++b){var c=a.markedSpans[b].marker;if(c.readOnly&&(!d||O(d,c)==-1)){(d||(d=[])).push(c)}}}});if(!d){return null}var e=[{from:b,to:c}];for(var f=0;f<d.length;++f){var g=d[f],h=g.find(0);for(var i=0;i<e.length;++i){var j=e[i];if(fb(j.to,h.from)<0||fb(j.from,h.to)>0){continue}var k=[i,1],l=fb(j.from,h.from),m=fb(j.to,h.to);if(l<0||!g.inclusiveLeft&&!l){k.push({from:j.from,to:h.from})}if(m>0||!g.inclusiveRight&&!m){k.push({from:h.to,to:j.to})}e.splice.apply(e,k);i+=k.length-3}}return e}function Pb(a){var b=a.markedSpans;if(!b){return}for(var c=0;c<b.length;++c){b[c].marker.detachLine(a)}a.markedSpans=null}function Qb(a,b){if(!b){return}for(var c=0;c<b.length;++c){b[c].marker.attachLine(a)}a.markedSpans=b}function Rb(a){return a.inclusiveLeft?-1:0}function Sb(a){return a.inclusiveRight?1:0}function Tb(a,b){var c=a.lines.length-b.lines.length;if(c!=0){return c}var d=a.find(),e=b.find();var f=fb(d.from,e.from)||Rb(a)-Rb(b);if(f){return-f}var g=fb(d.to,e.to)||Sb(a)-Sb(b);if(g){return g}return b.id-a.id}function Ub(a,b){var c=Db&&a.markedSpans,d;if(c){for(var e=void 0,f=0;f<c.length;++f){e=c[f];if(e.marker.collapsed&&(b?e.from:e.to)==null&&(!d||Tb(d,e.marker)<0)){d=e.marker}}}return d}function Vb(a){return Ub(a,true)}function Wb(a){return Ub(a,false)}function Xb(a,b){var c=Db&&a.markedSpans,d;if(c){for(var e=0;e<c.length;++e){var f=c[e];if(f.marker.collapsed&&(f.from==null||f.from<b)&&(f.to==null||f.to>b)&&(!d||Tb(d,f.marker)<0)){d=f.marker}}}return d}function Yb(a,b,c,d,e){var f=Ya(a,b);var g=Db&&f.markedSpans;if(g){for(var h=0;h<g.length;++h){var i=g[h];if(!i.marker.collapsed){continue}var j=i.marker.find(0);var k=fb(j.from,c)||Rb(i.marker)-Rb(e);var l=fb(j.to,d)||Sb(i.marker)-Sb(e);if(k>=0&&l<=0||k<=0&&l>=0){continue}if(k<=0&&(i.marker.inclusiveRight&&e.inclusiveLeft?fb(j.to,c)>=0:fb(j.to,c)>0)||k>=0&&(i.marker.inclusiveRight&&e.inclusiveLeft?fb(j.from,d)<=0:fb(j.from,d)<0)){return true}}}}function Zb(a){var b;while(b=Vb(a)){a=b.find(-1,true).line}return a}function $b(a){var b;while(b=Wb(a)){a=b.find(1,true).line}return a}function _b(a){var b,c;while(b=Wb(a)){a=b.find(1,true).line;(c||(c=[])).push(a)}return c}function ac(a,b){var c=Ya(a,b),d=Zb(c);if(c==d){return b}return ab(d)}function bc(a,b){if(b>a.lastLine()){return b}var c=Ya(a,b),d;if(!cc(a,c)){return b}while(d=Wb(c)){c=d.find(1,true).line}return ab(c)+1}function cc(a,b){var c=Db&&b.markedSpans;if(c){for(var d=void 0,e=0;e<c.length;++e){d=c[e];if(!d.marker.collapsed){continue}if(d.from==null){return true}if(d.marker.widgetNode){continue}if(d.from==0&&d.marker.inclusiveLeft&&dc(a,b,d)){return true}}}}function dc(a,b,c){if(c.to==null){var d=c.marker.find(1,true);return dc(a,d.line,Hb(d.line.markedSpans,c.marker))}if(c.marker.inclusiveRight&&c.to==b.text.length){return true}for(var e=void 0,f=0;f<b.markedSpans.length;++f){e=b.markedSpans[f];if(e.marker.collapsed&&!e.marker.widgetNode&&e.from==c.to&&(e.to==null||e.to!=c.from)&&(e.marker.inclusiveLeft||c.marker.inclusiveRight)&&dc(a,b,e)){return true}}}function ec(a){a=Zb(a);var b=0,c=a.parent;for(var d=0;d<c.lines.length;++d){var e=c.lines[d];if(e==a){break}else{b+=e.height}}for(var f=c.parent;f;c=f,f=c.parent){for(var g=0;g<f.children.length;++g){var h=f.children[g];if(h==c){break}else{b+=h.height}}}return b}function fc(a){if(a.height==0){return 0}var b=a.text.length,c,d=a;while(c=Vb(d)){var e=c.find(0,true);d=e.from.line;b+=e.from.ch-e.to.ch}d=a;while(c=Wb(d)){var f=c.find(0,true);b-=d.text.length-f.from.ch;d=f.to.line;b+=d.text.length-f.to.ch}return b}function gc(a){var b=a.display,c=a.doc;b.maxLine=Ya(c,c.first);b.maxLineLength=fc(b.maxLine);b.maxLineChanged=true;c.iter(function(a){var c=fc(a);if(c>b.maxLineLength){b.maxLineLength=c;b.maxLine=a}})}var hc=function(a,b,c){this.text=a;Qb(this,b);this.height=c?c(this):1};hc.prototype.lineNo=function(){return ab(this)};va(hc);function ic(a,b,c,d){a.text=b;if(a.stateAfter){a.stateAfter=null}if(a.styles){a.styles=null}if(a.order!=null){a.order=null}Pb(a);Qb(a,c);var e=d?d(a):1;if(e!=a.height){_a(a,e)}}function jc(a){a.parent=null;Pb(a)}var kc={},lc={};function mc(a,b){if(!a||/^\s*$/.test(a)){return null}var c=b.addModeClass?lc:kc;return c[a]||(c[a]=a.replace(/\S+/g,"cm-$&"))}function nc(a,b){var c=D("span",null,null,i?"padding-right: .1px":null);var d={pre:D("pre",[c],"CodeMirror-line"),content:c,col:0,pos:0,cm:a,trailingSpace:false,splitSpaces:a.getOption("lineWrapping")};b.measure={};for(var e=0;e<=(b.rest?b.rest.length:0);e++){var f=e?b.rest[e-1]:b.line,g=void 0;d.pos=0;d.addToken=pc;if(Ga(a.display.measure)&&(g=ma(f,a.doc.direction))){d.addToken=rc(d.addToken,g)}d.map=[];var h=b!=a.display.externalMeasured&&ab(f);tc(f,d,rb(a,f,h));if(f.styleClasses){if(f.styleClasses.bgClass){d.bgClass=I(f.styleClasses.bgClass,d.bgClass||"")}if(f.styleClasses.textClass){d.textClass=I(f.styleClasses.textClass,d.textClass||"")}}if(d.map.length==0){d.map.push(0,0,d.content.appendChild(Ea(a.display.measure)))}if(e==0){b.measure.map=d.map;b.measure.cache={}}else{(b.measure.maps||(b.measure.maps=[])).push(d.map);(b.measure.caches||(b.measure.caches=[])).push({})}}if(i){var j=d.content.lastChild;if(/\bcm-tab\b/.test(j.className)||j.querySelector&&j.querySelector(".cm-tab")){d.content.className="cm-tab-wrap-hack"}}ra(a,"renderLine",a,b.line,d.pre);if(d.pre.className){d.textClass=I(d.pre.className,d.textClass||"")}return d}function oc(a){var b=C("span","•","cm-invalidchar");b.title="\\u"+a.charCodeAt(0).toString(16);b.setAttribute("aria-label",b.title);return b}function pc(a,b,c,d,e,f,i){if(!b){return}var j=a.splitSpaces?qc(b,a.trailingSpace):b;var k=a.cm.state.specialChars,l=false;var m;if(!k.test(b)){a.col+=b.length;m=document.createTextNode(j);a.map.push(a.pos,a.pos+b.length,m);if(g&&h<9){l=true}a.pos+=b.length}else{m=document.createDocumentFragment();var n=0;while(true){k.lastIndex=n;var o=k.exec(b);var p=o?o.index-n:b.length-n;if(p){var q=document.createTextNode(j.slice(n,n+p));if(g&&h<9){m.appendChild(C("span",[q]))}else{m.appendChild(q)}a.map.push(a.pos,a.pos+p,q);a.col+=p;a.pos+=p}if(!o){break}n+=p+1;var r=void 0;if(o[0]=="\t"){var s=a.cm.options.tabSize,t=s-a.col%s;r=m.appendChild(C("span",W(t),"cm-tab"));r.setAttribute("role","presentation");r.setAttribute("cm-text","\t");a.col+=t}else if(o[0]=="\r"||o[0]=="\n"){r=m.appendChild(C("span",o[0]=="\r"?"␍":"","cm-invalidchar"));r.setAttribute("cm-text",o[0]);a.col+=1}else{r=a.cm.options.specialCharPlaceholder(o[0]);r.setAttribute("cm-text",o[0]);if(g&&h<9){m.appendChild(C("span",[r]))}else{m.appendChild(r)}a.col+=1}a.map.push(a.pos,a.pos+1,r);a.pos++}}a.trailingSpace=j.charCodeAt(b.length-1)==32 2;if(c||d||e||l||f){var u=c||"";if(d){u+=d}if(e){u+=e}var v=C("span",[m],u,f);if(i){for(var w in i){if(i.hasOwnProperty(w)&&w!="style"&&w!="class"){v.setAttribute(w,i[w])}}}return a.content.appendChild(v)}a.content.appendChild(m)}function qc(a,b){if(a.length>1&&!/ /.test(a)){return a}var c=b,d="";for(var e=0;e<a.length;e++){var f=a.charAt(e);if(f==" "&&c&&(e==a.length-1||a.charCodeAt(e+1)==32)){f=" "}d+=f;c=f==" "}return d}function rc(a,b){return function(c,d,e,f,g,h,i){e=e?e+" cm-force-border":"cm-force-border";var j=c.pos,k=j+d.length;for(;;){var l=void 0;for(var m=0;m<b.length;m++){l=b[m];if(l.to>j&&l.from<=j){break}}if(l.to>=k){return a(c,d,e,f,g,h,i)}a(c,d.slice(0,l.to-j),e,f,null,h,i);f=null;d=d.slice(l.to-j);j=l.to}}}function sc(a,b,c,d){var e=!d&&c.widgetNode;if(e){a.map.push(a.pos,a.pos+b,e)}if(!d&&a.cm.display.input.needsContentAttribute){if(!e){e=a.content.appendChild(document.createElement("span"))}e.setAttribute("cm-marker",c.id)}if(e){a.cm.display.input.setUneditable(e);a.content.appendChild(e)}a.pos+=b;a.trailingSpace=false}function tc(a,b,c){var d=a.markedSpans,e=a.text,f=0;if(!d){for(var g=1;g<c.length;g+=2){b.addToken(b,e.slice(f,f=c[g]),mc(c[g+1],b.cm.options))}return}var h=e.length,i=0,j=1,k="",l,m;var n=0,o,p,q,r,s;for(;;){if(n==i){o=p=q=m="";s=null;r=null;n=Infinity;var t=[],u=void 0;for(var v=0;v<d.length;++v){var w=d[v],x=w.marker;if(x.type=="bookmark"&&w.from==i&&x.widgetNode){t.push(x)}else if(w.from<=i&&(w.to==null||w.to>i||x.collapsed&&w.to==i&&w.from==i)){if(w.to!=null&&w.to!=i&&n>w.to){n=w.to;p=""}if(x.className){o+=" "+x.className}if(x.css){m=(m?m+";":"")+x.css}if(x.startStyle&&w.from==i){q+=" "+x.startStyle}if(x.endStyle&&w.to==n){(u||(u=[])).push(x.endStyle,w.to)}if(x.title){(s||(s={})).title=x.title}if(x.attributes){for(var y in x.attributes){(s||(s={}))[y]=x.attributes[y]}}if(x.collapsed&&(!r||Tb(r.marker,x)<0)){r=w}}else if(w.from>i&&n>w.from){n=w.from}}if(u){for(var z=0;z<u.length;z+=2){if(u[z+1]==n){p+=" "+u[z]}}}if(!r||r.from==i){for(var A=0;A<t.length;++A){sc(b,0,t[A])}}if(r&&(r.from||0)==i){sc(b,(r.to==null?h+1:r.to)-i,r.marker,r.from==null);if(r.to==null){return}if(r.to==i){r=false}}}if(i>=h){break}var B=Math.min(h,n);while(true){if(k){var C=i+k.length;if(!r){var D=C>B?k.slice(0,B-i):k;b.addToken(b,D,l?l+o:o,q,i+D.length==n?p:"",m,s)}if(C>=B){k=k.slice(B-i);i=B;break}i=C;q=""}k=e.slice(f,f=c[j++]);l=mc(c[j++],b.cm.options)}}}function uc(a,b,c){this.line=b;this.rest=_b(b);this.size=this.rest?ab(X(this.rest))-c+1:1;this.node=this.text=null;this.hidden=cc(a,b)}function vc(a,b,c){var d=[],e;for(var f=b;f<c;f=e){var g=new uc(a.doc,Ya(a.doc,f),f);e=f+g.size;d.push(g)}return d}var wc=null;function xc(a){if(wc){wc.ops.push(a)}else{a.ownsGroup=wc={ops:[a],delayedCallbacks:[]}}}function yc(a){var b=a.delayedCallbacks,c=0;do{for(;c<b.length;c++){b[c].call(null)}for(var d=0;d<a.ops.length;d++){var e=a.ops[d];if(e.cursorActivityHandlers){while(e.cursorActivityCalled<e.cursorActivityHandlers.length){e.cursorActivityHandlers[e.cursorActivityCalled++].call(null,e.cm)}}}}while(c<b.length)}function zc(a,b){var c=a.ownsGroup;if(!c){return}try{yc(c)}finally{wc=null;b(c)}}var Ac=null;function Bc(a,b){var c=pa(a,b);if(!c.length){return}var d=Array.prototype.slice.call(arguments,2),e;if(wc){e=wc.delayedCallbacks}else if(Ac){e=Ac}else{e=Ac=[];setTimeout(Cc,0)}var f=function(a){e.push(function(){return c[a].apply(null,d)})};for(var g=0;g<c.length;++g)f(g)}function Cc(){var a=Ac;Ac=null;for(var b=0;b<a.length;++b){a[b]()}}function Dc(a,b,c,d){for(var e=0;e<b.changes.length;e++){var f=b.changes[e];if(f=="text"){Hc(a,b)}else if(f=="gutter"){Jc(a,b,c,d)}else if(f=="class"){Ic(a,b)}else if(f=="widget"){Kc(a,b,d)}}b.changes=null}function Ec(a){if(a.node==a.text){a.node=C("div",null,null,"position: relative");if(a.text.parentNode){a.text.parentNode.replaceChild(a.node,a.text)}a.node.appendChild(a.text);if(g&&h<8){a.node.style.zIndex=2}}return a.node}function Fc(a,b){var c=b.bgClass?b.bgClass+" "+(b.line.bgClass||""):b.line.bgClass;if(c){c+=" CodeMirror-linebackground"}if(b.background){if(c){b.background.className=c}else{b.background.parentNode.removeChild(b.background);b.background=null}}else if(c){var d=Ec(b);b.background=d.insertBefore(C("div",null,c),d.firstChild);a.display.input.setUneditable(b.background)}}function Gc(a,b){var c=a.display.externalMeasured;if(c&&c.line==b.line){a.display.externalMeasured=null;b.measure=c.measure;return c.built}return nc(a,b)}function Hc(a,b){var c=b.text.className;var d=Gc(a,b);if(b.text==b.node){b.node=d.pre}b.text.parentNode.replaceChild(d.pre,b.text);b.text=d.pre;if(d.bgClass!=b.bgClass||d.textClass!=b.textClass){b.bgClass=d.bgClass;b.textClass=d.textClass;Ic(a,b)}else if(c){b.text.className=c}}function Ic(a,b){Fc(a,b);if(b.line.wrapClass){Ec(b).className=b.line.wrapClass}else if(b.node!=b.text){b.node.className=""}var c=b.textClass?b.textClass+" "+(b.line.textClass||""):b.line.textClass;b.text.className=c||""}function Jc(a,b,c,d){if(b.gutter){b.node.removeChild(b.gutter);b.gutter=null}if(b.gutterBackground){b.node.removeChild(b.gutterBackground);b.gutterBackground=null}if(b.line.gutterClass){var e=Ec(b);b.gutterBackground=C("div",null,"CodeMirror-gutter-background "+b.line.gutterClass,"left: "+(a.options.fixedGutter?d.fixedPos:-d.gutterTotalWidth)+"px; width: "+d.gutterTotalWidth+"px");a.display.input.setUneditable(b.gutterBackground);e.insertBefore(b.gutterBackground,b.text)}var f=b.line.gutterMarkers;if(a.options.lineNumbers||f){var g=Ec(b);var h=b.gutter=C("div",null,"CodeMirror-gutter-wrapper","left: "+(a.options.fixedGutter?d.fixedPos:-d.gutterTotalWidth)+"px");a.display.input.setUneditable(h);g.insertBefore(h,b.text);if(b.line.gutterClass){h.className+=" "+b.line.gutterClass}if(a.options.lineNumbers&&(!f||!f["CodeMirror-linenumbers"])){b.lineNumber=h.appendChild(C("div",db(a.options,c),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+d.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+a.display.lineNumInnerWidth+"px"))}if(f){for(var i=0;i<a.display.gutterSpecs.length;++i){var j=a.display.gutterSpecs[i].className,k=f.hasOwnProperty(j)&&f[j];if(k){h.appendChild(C("div",[k],"CodeMirror-gutter-elt","left: "+d.gutterLeft[j]+"px; width: "+d.gutterWidth[j]+"px"))}}}}}function Kc(a,b,c){if(b.alignable){b.alignable=null}var d=y("CodeMirror-linewidget");for(var e=b.node.firstChild,f=void 0;e;e=f){f=e.nextSibling;if(d.test(e.className)){b.node.removeChild(e)}}Mc(a,b,c)}function Lc(a,b,c,d){var e=Gc(a,b);b.text=b.node=e.pre;if(e.bgClass){b.bgClass=e.bgClass}if(e.textClass){b.textClass=e.textClass}Ic(a,b);Jc(a,b,c,d);Mc(a,b,d);return b.node}function Mc(a,b,c){Nc(a,b.line,b,c,true);if(b.rest){for(var d=0;d<b.rest.length;d++){Nc(a,b.rest[d],b,c,false)}}}function Nc(a,b,c,d,e){if(!b.widgets){return}var f=Ec(c);for(var g=0,h=b.widgets;g<h.length;++g){var i=h[g],j=C("div",[i.node],"CodeMirror-linewidget"+(i.className?" "+i.className:""));if(!i.handleMouseEvents){j.setAttribute("cm-ignore-events","true")}Oc(i,j,c,d);a.display.input.setUneditable(j);if(e&&i.above){f.insertBefore(j,c.gutter||c.text)}else{f.appendChild(j)}Bc(i,"redraw")}}function Oc(a,b,c,d){if(a.noHScroll){(c.alignable||(c.alignable=[])).push(b);var e=d.wrapperWidth;b.style.left=d.fixedPos+"px";if(!a.coverGutter){e-=d.gutterTotalWidth;b.style.paddingLeft=d.gutterTotalWidth+"px"}b.style.width=e+"px"}if(a.coverGutter){b.style.zIndex=5;b.style.position="relative";if(!a.noHScroll){b.style.marginLeft=-d.gutterTotalWidth+"px"}}}function Pc(a){if(a.height!=null){return a.height}var b=a.doc.cm;if(!b){return 0}if(!F(document.body,a.node)){var c="position: relative;";if(a.coverGutter){c+="margin-left: -"+b.display.gutters.offsetWidth+"px;"}if(a.noHScroll){c+="width: "+b.display.wrapper.clientWidth+"px;"}B(b.display.measure,C("div",[a.node],null,c))}return a.height=a.node.parentNode.offsetHeight}function Qc(a,b){for(var c=Aa(b);c!=a.wrapper;c=c.parentNode){if(!c||c.nodeType==1&&c.getAttribute("cm-ignore-events")=="true"||c.parentNode==a.sizer&&c!=a.mover){return true}}}function Rc(a){return a.lineSpace.offsetTop}function Sc(a){return a.mover.offsetHeight-a.lineSpace.offsetHeight}function Tc(a){if(a.cachedPaddingH){return a.cachedPaddingH}var b=B(a.measure,C("pre","x","CodeMirror-line-like"));var c=window.getComputedStyle?window.getComputedStyle(b):b.currentStyle;var d={left:parseInt(c.paddingLeft),right:parseInt(c.paddingRight)};if(!isNaN(d.left)&&!isNaN(d.right)){a.cachedPaddingH=d}return d}function Uc(a){return P-a.display.nativeBarWidth}function Vc(a){return a.display.scroller.clientWidth-Uc(a)-a.display.barWidth}function Wc(a){return a.display.scroller.clientHeight-Uc(a)-a.display.barHeight}function Xc(a,b,c){var d=a.options.lineWrapping;var e=d&&Vc(a);if(!b.measure.heights||d&&b.measure.width!=e){var f=b.measure.heights=[];if(d){b.measure.width=e;var g=b.text.firstChild.getClientRects();for(var h=0;h<g.length-1;h++){var i=g[h],j=g[h+1];if(Math.abs(i.bottom-j.bottom)>2){f.push((i.bottom+j.top)/2-c.top)}}}f.push(c.bottom-c.top)}}function Yc(a,b,c){if(a.line==b){return{map:a.measure.map,cache:a.measure.cache}}for(var d=0;d<a.rest.length;d++){if(a.rest[d]==b){return{map:a.measure.maps[d],cache:a.measure.caches[d]}}}for(var e=0;e<a.rest.length;e++){if(ab(a.rest[e])>c){return{map:a.measure.maps[e],cache:a.measure.caches[e],before:true}}}}function Zc(a,b){b=Zb(b);var c=ab(b);var d=a.display.externalMeasured=new uc(a.doc,b,c);d.lineN=c;var e=d.built=nc(a,d);d.text=e.pre;B(a.display.lineMeasure,e.pre);return d}function $c(a,b,c,d){return bd(a,ad(a,b),c,d)}function _c(a,b){if(b>=a.display.viewFrom&&b<a.display.viewTo){return a.display.view[Id(a,b)]}var c=a.display.externalMeasured;if(c&&b>=c.lineN&&b<c.lineN+c.size){return c}}function ad(a,b){var c=ab(b);var d=_c(a,c);if(d&&!d.text){d=null}else if(d&&d.changes){Dc(a,d,c,Dd(a));a.curOp.forceUpdate=true}if(!d){d=Zc(a,b)}var e=Yc(d,b,c);return{line:b,view:d,rect:null,map:e.map,cache:e.cache,before:e.before,hasHeights:false}}function bd(a,b,c,d,e){if(b.before){c=-1}var f=c+(d||""),g;if(b.cache.hasOwnProperty(f)){g=b.cache[f]}else{if(!b.rect){b.rect=b.view.text.getBoundingClientRect()}if(!b.hasHeights){Xc(a,b.view,b.rect);b.hasHeights=true}g=fd(a,b,c,d);if(!g.bogus){b.cache[f]=g}}return{left:g.left,right:g.right,top:e?g.rtop:g.top,bottom:e?g.rbottom:g.bottom}}var cd={left:0,right:0,top:0,bottom:0};function dd(a,b,c){var d,e,f,g,h,i;for(var j=0;j<a.length;j+=3){h=a[j];i=a[j+1];if(b<h){e=0;f=1;g="left"}else if(b<i){e=b-h;f=e+1}else if(j==a.length-3||b==i&&a[j+3]>b){f=i-h;e=f-1;if(b>=i){g="right"}}if(e!=null){d=a[j+2];if(h==i&&c==(d.insertLeft?"left":"right")){g=c}if(c=="left"&&e==0){while(j&&a[j-2]==a[j-3]&&a[j-1].insertLeft){d=a[(j-=3)+2];g="left"}}if(c=="right"&&e==i-h){while(j<a.length-3&&a[j+3]==a[j+4]&&!a[j+5].insertLeft){d=a[(j+=3)+2];g="right"}}break}}return{node:d,start:e,end:f,collapse:g,coverStart:h,coverEnd:i}}function ed(a,b){var c=cd;if(b=="left"){for(var d=0;d<a.length;d++){if((c=a[d]).left!=c.right){break}}}else{for(var e=a.length-1;e>=0;e--){if((c=a[e]).left!=c.right){break}}}return c}function fd(a,b,c,d){var e=dd(b.map,c,d);var f=e.node,i=e.start,j=e.end,k=e.collapse;var l;if(f.nodeType==3){for(var m=0;m<4;m++){while(i&&fa(b.line.text.charAt(e.coverStart+i))){--i}while(e.coverStart+j<e.coverEnd&&fa(b.line.text.charAt(e.coverStart+j))){++j}if(g&&h<9&&i==0&&j==e.coverEnd-e.coverStart){l=f.parentNode.getBoundingClientRect()}else{l=ed(E(f,i,j).getClientRects(),d)}if(l.left||l.right||i==0){break}j=i;i=i-1;k="right"}if(g&&h<11){l=gd(a.display.measure,l)}}else{if(i>0){k=d="right"}var n;if(a.options.lineWrapping&&(n=f.getClientRects()).length>1){l=n[d=="right"?n.length-1:0]}else{l=f.getBoundingClientRect()}}if(g&&h<9&&!i&&(!l||!l.left&&!l.right)){var o=f.parentNode.getClientRects()[0];if(o){l={left:o.left,right:o.left+Cd(a.display),top:o.top,bottom:o.bottom}}else{l=cd}}var p=l.top-b.rect.top,q=l.bottom-b.rect.top;var r=(p+q)/2;var s=b.view.measure.heights;var t=0;for(;t<s.length-1;t++){if(r<s[t]){break}}var u=t?s[t-1]:0,v=s[t];var w={left:(k=="right"?l.right:l.left)-b.rect.left,right:(k=="left"?l.left:l.right)-b.rect.left,top:u,bottom:v};if(!l.left&&!l.right){w.bogus=true}if(!a.options.singleCursorHeightPerLine){w.rtop=p;w.rbottom=q}return w}function gd(a,b){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!La(a)){return b}var c=screen.logicalXDPI/screen.deviceXDPI;var d=screen.logicalYDPI/screen.deviceYDPI;return{left:b.left*c,right:b.right*c,top:b.top*d,bottom:b.bottom*d}}function hd(a){if(a.measure){a.measure.cache={};a.measure.heights=null;if(a.rest){for(var b=0;b<a.rest.length;b++){a.measure.caches[b]={}}}}}function id(a){a.display.externalMeasure=null;A(a.display.lineMeasure);for(var b=0;b<a.display.view.length;b++){hd(a.display.view[b])}}function jd(a){id(a);a.display.cachedCharWidth=a.display.cachedTextHeight=a.display.cachedPaddingH=null;if(!a.options.lineWrapping){a.display.maxLineChanged=true}a.display.lineNumChars=null}function kd(){if(k&&q){return-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft))}return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function ld(){if(k&&q){return-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop))}return window.pageYOffset||(document.documentElement||document.body).scrollTop}function md(a){var b=0;if(a.widgets){for(var c=0;c<a.widgets.length;++c){if(a.widgets[c].above){b+=Pc(a.widgets[c])}}}return b}function nd(a,b,c,d,e){if(!e){var f=md(b);c.top+=f;c.bottom+=f}if(d=="line"){return c}if(!d){d="local"}var g=ec(b);if(d=="local"){g+=Rc(a.display)}else{g-=a.display.viewOffset}if(d=="page"||d=="window"){var h=a.display.lineSpace.getBoundingClientRect();g+=h.top+(d=="window"?0:ld());var i=h.left+(d=="window"?0:kd());c.left+=i;c.right+=i}c.top+=g;c.bottom+=g;return c}function od(a,b,c){if(c=="div"){return b}var d=b.left,e=b.top;if(c=="page"){d-=kd();e-=ld()}else if(c=="local"||!c){var f=a.display.sizer.getBoundingClientRect();d+=f.left;e+=f.top}var g=a.display.lineSpace.getBoundingClientRect();return{left:d-g.left,top:e-g.top}}function pd(a,b,c,d,e){if(!d){d=Ya(a.doc,b.line)}return nd(a,d,$c(a,d,b.ch,e),c)}function qd(a,b,c,d,e,f){d=d||Ya(a.doc,b.line);if(!e){e=ad(a,d)}function g(b,g){var h=bd(a,e,b,g?"right":"left",f);if(g){h.left=h.right}else{h.right=h.left}return nd(a,d,h,c)}var h=ma(d,a.doc.direction),i=b.ch,j=b.sticky;if(i>=d.text.length){i=d.text.length;j="before"}else if(i<=0){i=0;j="after"}if(!h){return g(j=="before"?i-1:i,j=="before")}function k(a,b,c){var d=h[b],e=d.level==1;return g(c?a-1:a,e!=c)}var l=ka(h,i,j);var m=ja;var n=k(i,l,j=="before");if(m!=null){n.other=k(i,m,j!="before")}return n}function rd(a,b){var c=0;b=lb(a.doc,b);if(!a.options.lineWrapping){c=Cd(a.display)*b.ch}var d=Ya(a.doc,b.line);var e=ec(d)+Rc(a.display);return{left:c,right:c,top:e,bottom:e+d.height}}function sd(a,b,c,d,e){var f=eb(a,b,c);f.xRel=e;if(d){f.outside=d}return f}function td(a,b,c){var d=a.doc;c+=a.display.viewOffset;if(c<0){return sd(d.first,0,null,-1,-1)}var e=bb(d,c),f=d.first+d.size-1;if(e>f){return sd(d.first+d.size-1,Ya(d,f).text.length,null,1,1)}if(b<0){b=0}var g=Ya(d,e);for(;;){var h=xd(a,g,e,b,c);var i=Xb(g,h.ch+(h.xRel>0||h.outside>0?1:0));if(!i){return h}var j=i.find(1);if(j.line==e){return j}g=Ya(d,e=j.line)}}function ud(a,b,c,d){d-=md(b);var e=b.text.length;var f=ha(function(b){return bd(a,c,b-1).bottom<=d},e,0);e=ha(function(b){return bd(a,c,b).top>d},f,e);return{begin:f,end:e}}function vd(a,b,c,d){if(!c){c=ad(a,b)}var e=nd(a,b,bd(a,c,d),"line").top;return ud(a,b,c,e)}function wd(a,b,c,d){return a.bottom<=c?false:a.top>c?true:(d?a.left:a.right)>b}function xd(a,b,c,d,e){e-=ec(b);var f=ad(a,b);var g=md(b);var h=0,i=b.text.length,j=true;var k=ma(b,a.doc.direction);if(k){var l=(a.options.lineWrapping?zd:yd)(a,b,c,f,k,d,e);j=l.level!=1;h=j?l.from:l.to-1;i=j?l.to:l.from-1}var m=null,n=null;var o=ha(function(b){var c=bd(a,f,b);c.top+=g;c.bottom+=g;if(!wd(c,d,e,false)){return false}if(c.top<=e&&c.left<=d){m=b;n=c}return true},h,i);var p,q,r=false;if(n){var s=d-n.left<n.right-d,t=s==j;o=m+(t?0:1);q=t?"after":"before";p=s?n.left:n.right}else{if(!j&&(o==i||o==h)){o++}q=o==0?"after":o==b.text.length?"before":bd(a,f,o-(j?1:0)).bottom+g<=e==j?"after":"before";var u=qd(a,eb(c,o,q),"line",b,f);p=u.left;r=e<u.top?-1:e>=u.bottom?1:0}o=ga(b.text,o,1);return sd(c,o,q,r,d-p)}function yd(a,b,c,d,e,f,g){var h=ha(function(h){var i=e[h],j=i.level!=1;return wd(qd(a,eb(c,j?i.to:i.from,j?"before":"after"),"line",b,d),f,g,true)},0,e.length-1);var i=e[h];if(h>0){var j=i.level!=1;var k=qd(a,eb(c,j?i.from:i.to,j?"after":"before"),"line",b,d);if(wd(k,f,g,true)&&k.top>g){i=e[h-1]}}return i}function zd(a,b,c,d,e,f,g){var h=ud(a,b,d,g);var i=h.begin;var j=h.end;if(/\s/.test(b.text.charAt(j-1))){j--}var k=null,l=null;for(var m=0;m<e.length;m++){var n=e[m];if(n.from>=j||n.to<=i){continue}var o=n.level!=1;var p=bd(a,d,o?Math.min(j,n.to)-1:Math.max(i,n.from)).right;var q=p<f?f-p+1e9:p-f;if(!k||l>q){k=n;l=q}}if(!k){k=e[e.length-1]}if(k.from<i){k={from:i,to:k.to,level:k.level}}if(k.to>j){k={from:k.from,to:j,level:k.level}}return k}var Ad;function Bd(a){if(a.cachedTextHeight!=null){return a.cachedTextHeight}if(Ad==null){Ad=C("pre",null,"CodeMirror-line-like");for(var b=0;b<49;++b){Ad.appendChild(document.createTextNode("x"));Ad.appendChild(C("br"))}Ad.appendChild(document.createTextNode("x"))}B(a.measure,Ad);var c=Ad.offsetHeight/50;if(c>3){a.cachedTextHeight=c}A(a.measure);return c||1}function Cd(a){if(a.cachedCharWidth!=null){return a.cachedCharWidth}var b=C("span","xxxxxxxxxx");var c=C("pre",[b],"CodeMirror-line-like");B(a.measure,c);var d=b.getBoundingClientRect(),e=(d.right-d.left)/10;if(e>2){a.cachedCharWidth=e}return e||10}function Dd(a){var b=a.display,c={},d={};var e=b.gutters.clientLeft;for(var f=b.gutters.firstChild,g=0;f;f=f.nextSibling,++g){var h=a.display.gutterSpecs[g].className;c[h]=f.offsetLeft+f.clientLeft+e;d[h]=f.clientWidth}return{fixedPos:Ed(b),gutterTotalWidth:b.gutters.offsetWidth,gutterLeft:c,gutterWidth:d,wrapperWidth:b.wrapper.clientWidth}}function Ed(a){return a.scroller.getBoundingClientRect().left-a.sizer.getBoundingClientRect().left}function Fd(a){var b=Bd(a.display),c=a.options.lineWrapping;var d=c&&Math.max(5,a.display.scroller.clientWidth/Cd(a.display)-3);return function(e){if(cc(a.doc,e)){return 0}var f=0;if(e.widgets){for(var g=0;g<e.widgets.length;g++){if(e.widgets[g].height){f+=e.widgets[g].height}}}if(c){return f+(Math.ceil(e.text.length/d)||1)*b}else{return f+b}}}function Gd(a){var b=a.doc,c=Fd(a);b.iter(function(a){var b=c(a);if(b!=a.height){_a(a,b)}})}function Hd(a,b,c,d){var e=a.display;if(!c&&Aa(b).getAttribute("cm-not-content")=="true"){return null}var f,g,h=e.lineSpace.getBoundingClientRect();try{f=b.clientX-h.left;g=b.clientY-h.top}catch(l){return null}var i=td(a,f,g),j;if(d&&i.xRel>0&&(j=Ya(a.doc,i.line).text).length==i.ch){var k=M(j,j.length,a.options.tabSize)-j.length;i=eb(i.line,Math.max(0,Math.round((f-Tc(a.display).left)/Cd(a.display))-k))}return i}function Id(a,b){if(b>=a.display.viewTo){return null}b-=a.display.viewFrom;if(b<0){return null}var c=a.display.view;for(var d=0;d<c.length;d++){b-=c[d].size;if(b<0){return d}}}function Jd(a,b,c,d){if(b==null){b=a.doc.first}if(c==null){c=a.doc.first+a.doc.size}if(!d){d=0}var e=a.display;if(d&&c<e.viewTo&&(e.updateLineNumbers==null||e.updateLineNumbers>b)){e.updateLineNumbers=b}a.curOp.viewChanged=true;if(b>=e.viewTo){if(Db&&ac(a.doc,b)<e.viewTo){Ld(a)}}else if(c<=e.viewFrom){if(Db&&bc(a.doc,c+d)>e.viewFrom){Ld(a)}else{e.viewFrom+=d;e.viewTo+=d}}else if(b<=e.viewFrom&&c>=e.viewTo){Ld(a)}else if(b<=e.viewFrom){var f=Md(a,c,c+d,1);if(f){e.view=e.view.slice(f.index);e.viewFrom=f.lineN;e.viewTo+=d}else{Ld(a)}}else if(c>=e.viewTo){var g=Md(a,b,b,-1);if(g){e.view=e.view.slice(0,g.index);e.viewTo=g.lineN}else{Ld(a)}}else{var h=Md(a,b,b,-1);var i=Md(a,c,c+d,1);if(h&&i){e.view=e.view.slice(0,h.index).concat(vc(a,h.lineN,i.lineN)).concat(e.view.slice(i.index));e.viewTo+=d}else{Ld(a)}}var j=e.externalMeasured;if(j){if(c<j.lineN){j.lineN+=d}else if(b<j.lineN+j.size){e.externalMeasured=null}}}function Kd(a,b,c){a.curOp.viewChanged=true;var d=a.display,e=a.display.externalMeasured;if(e&&b>=e.lineN&&b<e.lineN+e.size){d.externalMeasured=null}if(b<d.viewFrom||b>=d.viewTo){return}var f=d.view[Id(a,b)];if(f.node==null){return}var g=f.changes||(f.changes=[]);if(O(g,c)==-1){g.push(c)}}function Ld(a){a.display.viewFrom=a.display.viewTo=a.doc.first;a.display.view=[];a.display.viewOffset=0}function Md(a,b,c,d){var e=Id(a,b),f,g=a.display.view;if(!Db||c==a.doc.first+a.doc.size){return{index:e,lineN:c}}var h=a.display.viewFrom;for(var i=0;i<e;i++){h+=g[i].size}if(h!=b){if(d>0){if(e==g.length-1){return null}f=h+g[e].size-b;e++}else{f=h-b}b+=f;c+=f}while(ac(a.doc,c)!=c){if(e==(d<0?0:g.length-1)){return null}c+=d*g[e-(d<0?1:0)].size;e+=d}return{index:e,lineN:c}}function Nd(a,b,c){var d=a.display,e=d.view;if(e.length==0||b>=d.viewTo||c<=d.viewFrom){d.view=vc(a,b,c);d.viewFrom=b}else{if(d.viewFrom>b){d.view=vc(a,b,d.viewFrom).concat(d.view)}else if(d.viewFrom<b){d.view=d.view.slice(Id(a,b))}d.viewFrom=b;if(d.viewTo<c){d.view=d.view.concat(vc(a,d.viewTo,c))}else if(d.viewTo>c){d.view=d.view.slice(0,Id(a,c))}}d.viewTo=c}function Od(a){var b=a.display.view,c=0;for(var d=0;d<b.length;d++){var e=b[d];if(!e.hidden&&(!e.node||e.changes)){++c}}return c}function Pd(a){a.display.input.showSelection(a.display.input.prepareSelection())}function Qd(a,b){if(b===void 0)b=true;var c=a.doc,d={};var e=d.cursors=document.createDocumentFragment();var f=d.selection=document.createDocumentFragment();for(var g=0;g<c.sel.ranges.length;g++){if(!b&&g==c.sel.primIndex){continue}var h=c.sel.ranges[g];if(h.from().line>=a.display.viewTo||h.to().line<a.display.viewFrom){continue}var i=h.empty();if(i||a.options.showCursorWhenSelecting){Rd(a,h.head,e)}if(!i){Td(a,h,f)}}return d}function Rd(a,b,c){var d=qd(a,b,"div",null,null,!a.options.singleCursorHeightPerLine);var e=c.appendChild(C("div"," ","CodeMirror-cursor"));e.style.left=d.left+"px";e.style.top=d.top+"px";e.style.height=Math.max(0,d.bottom-d.top)*a.options.cursorHeight+"px";if(d.other){var f=c.appendChild(C("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));f.style.display="";f.style.left=d.other.left+"px";f.style.top=d.other.top+"px";f.style.height=(d.other.bottom-d.other.top)*.85+"px"}}function Sd(a,b){return a.top-b.top||a.left-b.left}function Td(a,b,c){var d=a.display,e=a.doc;var f=document.createDocumentFragment();var g=Tc(a.display),h=g.left;var i=Math.max(d.sizerWidth,Vc(a)-d.sizer.offsetLeft)-g.right;var j=e.direction=="ltr";function k(a,b,c,d){if(b<0){b=0}b=Math.round(b);d=Math.round(d);f.appendChild(C("div",null,"CodeMirror-selected","position: absolute; left: "+a+"px;\n top: "+b+"px; width: "+(c==null?i-a:c)+"px;\n height: "+(d-b)+"px"))}function l(b,c,d){var f=Ya(e,b);var g=f.text.length;var l,m;function n(c,d){return pd(a,eb(b,c),"div",f,d)}function o(b,c,d){var e=vd(a,f,null,b);var g=c=="ltr"==(d=="after")?"left":"right";var h=d=="after"?e.begin:e.end-(/\s/.test(f.text.charAt(e.end-1))?2:1);return n(h,g)[g]}var p=ma(f,e.direction);ia(p,c||0,d==null?g:d,function(a,b,e,f){var q=e=="ltr";var r=n(a,q?"left":"right");var s=n(b-1,q?"right":"left");var t=c==null&&a==0,u=d==null&&b==g;var v=f==0,w=!p||f==p.length-1;if(s.top-r.top<=3){var x=(j?t:u)&&v;var y=(j?u:t)&&w;var z=x?h:(q?r:s).left;var A=y?i:(q?s:r).right;k(z,r.top,A-z,r.bottom)}else{var B,C,D,E;if(q){B=j&&t&&v?h:r.left;C=j?i:o(a,e,"before");D=j?h:o(b,e,"after");E=j&&u&&w?i:s.right}else{B=!j?h:o(a,e,"before");C=!j&&t&&v?i:r.right;D=!j&&u&&w?h:s.left;E=!j?i:o(b,e,"after")}k(B,r.top,C-B,r.bottom);if(r.bottom<s.top){k(h,r.bottom,null,s.top)}k(D,s.top,E-D,s.bottom)}if(!l||Sd(r,l)<0){l=r}if(Sd(s,l)<0){l=s}if(!m||Sd(r,m)<0){m=r}if(Sd(s,m)<0){m=s}});return{start:l,end:m}}var m=b.from(),n=b.to();if(m.line==n.line){l(m.line,m.ch,n.ch)}else{var o=Ya(e,m.line),p=Ya(e,n.line);var q=Zb(o)==Zb(p);var r=l(m.line,m.ch,q?o.text.length+1:null).end;var s=l(n.line,q?0:null,n.ch).start;if(q){if(r.top<s.top-2){k(r.right,r.top,null,r.bottom);k(h,s.top,s.left,s.bottom)}else{k(r.right,r.top,s.left-r.right,r.bottom)}}if(r.bottom<s.top){k(h,r.bottom,null,s.top)}}c.appendChild(f)}function Ud(a){if(!a.state.focused){return}var b=a.display;clearInterval(b.blinker);var c=true;b.cursorDiv.style.visibility="";if(a.options.cursorBlinkRate>0){b.blinker=setInterval(function(){return b.cursorDiv.style.visibility=(c=!c)?"":"hidden"},a.options.cursorBlinkRate)}else if(a.options.cursorBlinkRate<0){b.cursorDiv.style.visibility="hidden"}}function Vd(a){if(!a.state.focused){a.display.input.focus();Xd(a)}}function Wd(a){a.state.delayingBlurEvent=true;setTimeout(function(){if(a.state.delayingBlurEvent){a.state.delayingBlurEvent=false;Yd(a)}},100)}function Xd(a,b){if(a.state.delayingBlurEvent){a.state.delayingBlurEvent=false}if(a.options.readOnly=="nocursor"){return}if(!a.state.focused){ra(a,"focus",a,b);a.state.focused=true;H(a.display.wrapper,"CodeMirror-focused");if(!a.curOp&&a.display.selForContextMenu!=a.doc.sel){a.display.input.reset();if(i){setTimeout(function(){return a.display.input.reset(true)},20)}}a.display.input.receivedFocus()}Ud(a)}function Yd(a,b){if(a.state.delayingBlurEvent){return}if(a.state.focused){ra(a,"blur",a,b);a.state.focused=false;z(a.display.wrapper,"CodeMirror-focused")}clearInterval(a.display.blinker);setTimeout(function(){if(!a.state.focused){a.display.shift=false}},150)}function Zd(a){var b=a.display;var c=b.lineDiv.offsetTop;for(var d=0;d<b.view.length;d++){var e=b.view[d],f=a.options.lineWrapping;var i=void 0,j=0;if(e.hidden){continue}if(g&&h<8){var k=e.node.offsetTop+e.node.offsetHeight;i=k-c;c=k}else{var l=e.node.getBoundingClientRect();i=l.bottom-l.top;if(!f&&e.text.firstChild){j=e.text.firstChild.getBoundingClientRect().right-l.left-1}}var m=e.line.height-i;if(m>.005||m<-.005){_a(e.line,i);$d(e.line);if(e.rest){for(var n=0;n<e.rest.length;n++){$d(e.rest[n])}}}if(j>a.display.sizerWidth){var o=Math.ceil(j/Cd(a.display));if(o>a.display.maxLineLength){a.display.maxLineLength=o;a.display.maxLine=e.line;a.display.maxLineChanged=true}}}}function $d(a){if(a.widgets){for(var b=0;b<a.widgets.length;++b){var c=a.widgets[b],d=c.node.parentNode;if(d){c.height=d.offsetHeight}}}}function _d(a,b,c){var d=c&&c.top!=null?Math.max(0,c.top):a.scroller.scrollTop;d=Math.floor(d-Rc(a));var e=c&&c.bottom!=null?c.bottom:d+a.wrapper.clientHeight;var f=bb(b,d),g=bb(b,e);if(c&&c.ensure){var h=c.ensure.from.line,i=c.ensure.to.line;if(h<f){f=h;g=bb(b,ec(Ya(b,h))+a.wrapper.clientHeight)}else if(Math.min(i,b.lastLine())>=g){f=bb(b,ec(Ya(b,i))-a.wrapper.clientHeight);g=i}}return{from:f,to:Math.max(g,f+1)}}function ae(a,b){if(sa(a,"scrollCursorIntoView")){return}var c=a.display,d=c.sizer.getBoundingClientRect(),e=null;if(b.top+d.top<0){e=true}else if(b.bottom+d.top>(window.innerHeight||document.documentElement.clientHeight)){e=false}if(e!=null&&!o){var f=C("div","",null,"position: absolute;\n top: "+(b.top-c.viewOffset-Rc(a.display))+"px;\n height: "+(b.bottom-b.top+Uc(a)+c.barHeight)+"px;\n left: "+b.left+"px; width: "+Math.max(2,b.right-b.left)+"px;");a.display.lineSpace.appendChild(f);f.scrollIntoView(e);a.display.lineSpace.removeChild(f)}}function be(a,b,c,d){if(d==null){d=0}var e;if(!a.options.lineWrapping&&b==c){b=b.ch?eb(b.line,b.sticky=="before"?b.ch-1:b.ch,"after"):b;c=b.sticky=="before"?eb(b.line,b.ch+1,"before"):b}for(var f=0;f<5;f++){var g=false;var h=qd(a,b);var i=!c||c==b?h:qd(a,c);e={left:Math.min(h.left,i.left),top:Math.min(h.top,i.top)-d,right:Math.max(h.left,i.left),bottom:Math.max(h.bottom,i.bottom)+d};var j=de(a,e);var k=a.doc.scrollTop,l=a.doc.scrollLeft;if(j.scrollTop!=null){ke(a,j.scrollTop);if(Math.abs(a.doc.scrollTop-k)>1){g=true}}if(j.scrollLeft!=null){me(a,j.scrollLeft);if(Math.abs(a.doc.scrollLeft-l)>1){g=true}}if(!g){break}}return e}function ce(a,b){var c=de(a,b);if(c.scrollTop!=null){ke(a,c.scrollTop)}if(c.scrollLeft!=null){me(a,c.scrollLeft)}}function de(a,b){var c=a.display,d=Bd(a.display);if(b.top<0){b.top=0}var e=a.curOp&&a.curOp.scrollTop!=null?a.curOp.scrollTop:c.scroller.scrollTop;var f=Wc(a),g={};if(b.bottom-b.top>f){b.bottom=b.top+f}var h=a.doc.height+Sc(c);var i=b.top<d,j=b.bottom>h-d;if(b.top<e){g.scrollTop=i?0:b.top}else if(b.bottom>e+f){var k=Math.min(b.top,(j?h:b.bottom)-f);if(k!=e){g.scrollTop=k}}var l=a.curOp&&a.curOp.scrollLeft!=null?a.curOp.scrollLeft:c.scroller.scrollLeft;var m=Vc(a)-(a.options.fixedGutter?c.gutters.offsetWidth:0);var n=b.right-b.left>m;if(n){b.right=b.left+m}if(b.left<10){g.scrollLeft=0}else if(b.left<l){g.scrollLeft=Math.max(0,b.left-(n?0:10))}else if(b.right>m+l-3){g.scrollLeft=b.right+(n?0:10)-m}return g}function ee(a,b){if(b==null){return}ie(a);a.curOp.scrollTop=(a.curOp.scrollTop==null?a.doc.scrollTop:a.curOp.scrollTop)+b}function fe(a){ie(a);var b=a.getCursor();a.curOp.scrollToPos={from:b,to:b,margin:a.options.cursorScrollMargin}}function ge(a,b,c){if(b!=null||c!=null){ie(a)}if(b!=null){a.curOp.scrollLeft=b}if(c!=null){a.curOp.scrollTop=c}}function he(a,b){ie(a);a.curOp.scrollToPos=b}function ie(a){var b=a.curOp.scrollToPos;if(b){a.curOp.scrollToPos=null;var c=rd(a,b.from),d=rd(a,b.to);je(a,c,d,b.margin)}}function je(a,b,c,d){var e=de(a,{left:Math.min(b.left,c.left),top:Math.min(b.top,c.top)-d,right:Math.max(b.right,c.right),bottom:Math.max(b.bottom,c.bottom)+d});ge(a,e.scrollLeft,e.scrollTop)}function ke(a,b){if(Math.abs(a.doc.scrollTop-b)<2){return}if(!c){Pe(a,{top:b})}le(a,b,true);if(c){Pe(a)}He(a,100)}function le(a,b,c){b=Math.max(0,Math.min(a.display.scroller.scrollHeight-a.display.scroller.clientHeight,b));if(a.display.scroller.scrollTop==b&&!c){return}a.doc.scrollTop=b;a.display.scrollbars.setScrollTop(b);if(a.display.scroller.scrollTop!=b){a.display.scroller.scrollTop=b}}function me(a,b,c,d){b=Math.max(0,Math.min(b,a.display.scroller.scrollWidth-a.display.scroller.clientWidth));if((c?b==a.doc.scrollLeft:Math.abs(a.doc.scrollLeft-b)<2)&&!d){return}a.doc.scrollLeft=b;Te(a);if(a.display.scroller.scrollLeft!=b){a.display.scroller.scrollLeft=b}a.display.scrollbars.setScrollLeft(b)}function ne(a){var b=a.display,c=b.gutters.offsetWidth;var d=Math.round(a.doc.height+Sc(a.display));return{clientHeight:b.scroller.clientHeight,viewHeight:b.wrapper.clientHeight,scrollWidth:b.scroller.scrollWidth,clientWidth:b.scroller.clientWidth,viewWidth:b.wrapper.clientWidth,barLeft:a.options.fixedGutter?c:0,docHeight:d,scrollHeight:d+Uc(a)+b.barHeight,nativeBarWidth:b.nativeBarWidth,gutterWidth:c}}var oe=function(a,b,c){this.cm=c;var d=this.vert=C("div",[C("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar");var e=this.horiz=C("div",[C("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");d.tabIndex=e.tabIndex=-1;a(d);a(e);oa(d,"scroll",function(){if(d.clientHeight){b(d.scrollTop,"vertical")}});oa(e,"scroll",function(){if(e.clientWidth){b(e.scrollLeft,"horizontal")}});this.checkedZeroWidth=false;if(g&&h<8){this.horiz.style.minHeight=this.vert.style.minWidth="18px"}};oe.prototype.update=function(a){var b=a.scrollWidth>a.clientWidth+1;var c=a.scrollHeight>a.clientHeight+1;var d=a.nativeBarWidth;if(c){this.vert.style.display="block";this.vert.style.bottom=b?d+"px":"0";var e=a.viewHeight-(b?d:0);this.vert.firstChild.style.height=Math.max(0,a.scrollHeight-a.clientHeight+e)+"px"}else{this.vert.style.display="";this.vert.firstChild.style.height="0"}if(b){this.horiz.style.display="block";this.horiz.style.right=c?d+"px":"0";this.horiz.style.left=a.barLeft+"px";var f=a.viewWidth-a.barLeft-(c?d:0);this.horiz.firstChild.style.width=Math.max(0,a.scrollWidth-a.clientWidth+f)+"px"}else{this.horiz.style.display="";this.horiz.firstChild.style.width="0"}if(!this.checkedZeroWidth&&a.clientHeight>0){if(d==0){this.zeroWidthHack()}this.checkedZeroWidth=true}return{ 3right:c?d:0,bottom:b?d:0}};oe.prototype.setScrollLeft=function(a){if(this.horiz.scrollLeft!=a){this.horiz.scrollLeft=a}if(this.disableHoriz){this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")}};oe.prototype.setScrollTop=function(a){if(this.vert.scrollTop!=a){this.vert.scrollTop=a}if(this.disableVert){this.enableZeroWidthBar(this.vert,this.disableVert,"vert")}};oe.prototype.zeroWidthHack=function(){var a=s&&!n?"12px":"18px";this.horiz.style.height=this.vert.style.width=a;this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none";this.disableHoriz=new N;this.disableVert=new N};oe.prototype.enableZeroWidthBar=function(a,b,c){a.style.pointerEvents="auto";function d(){var e=a.getBoundingClientRect();var f=c=="vert"?document.elementFromPoint(e.right-1,(e.top+e.bottom)/2):document.elementFromPoint((e.right+e.left)/2,e.bottom-1);if(f!=a){a.style.pointerEvents="none"}else{b.set(1e3,d)}}b.set(1e3,d)};oe.prototype.clear=function(){var a=this.horiz.parentNode;a.removeChild(this.horiz);a.removeChild(this.vert)};var pe=function(){};pe.prototype.update=function(){return{bottom:0,right:0}};pe.prototype.setScrollLeft=function(){};pe.prototype.setScrollTop=function(){};pe.prototype.clear=function(){};function qe(a,b){if(!b){b=ne(a)}var c=a.display.barWidth,d=a.display.barHeight;re(a,b);for(var e=0;e<4&&c!=a.display.barWidth||d!=a.display.barHeight;e++){if(c!=a.display.barWidth&&a.options.lineWrapping){Zd(a)}re(a,ne(a));c=a.display.barWidth;d=a.display.barHeight}}function re(a,b){var c=a.display;var d=c.scrollbars.update(b);c.sizer.style.paddingRight=(c.barWidth=d.right)+"px";c.sizer.style.paddingBottom=(c.barHeight=d.bottom)+"px";c.heightForcer.style.borderBottom=d.bottom+"px solid transparent";if(d.right&&d.bottom){c.scrollbarFiller.style.display="block";c.scrollbarFiller.style.height=d.bottom+"px";c.scrollbarFiller.style.width=d.right+"px"}else{c.scrollbarFiller.style.display=""}if(d.bottom&&a.options.coverGutterNextToScrollbar&&a.options.fixedGutter){c.gutterFiller.style.display="block";c.gutterFiller.style.height=d.bottom+"px";c.gutterFiller.style.width=b.gutterWidth+"px"}else{c.gutterFiller.style.display=""}}var se={"native":oe,"null":pe};function te(a){if(a.display.scrollbars){a.display.scrollbars.clear();if(a.display.scrollbars.addClass){z(a.display.wrapper,a.display.scrollbars.addClass)}}a.display.scrollbars=new se[a.options.scrollbarStyle](function(b){a.display.wrapper.insertBefore(b,a.display.scrollbarFiller);oa(b,"mousedown",function(){if(a.state.focused){setTimeout(function(){return a.display.input.focus()},0)}});b.setAttribute("cm-not-content","true")},function(b,c){if(c=="horizontal"){me(a,b)}else{ke(a,b)}},a);if(a.display.scrollbars.addClass){H(a.display.wrapper,a.display.scrollbars.addClass)}}var ue=0;function ve(a){a.curOp={cm:a,viewChanged:false,startHeight:a.doc.height,forceUpdate:false,updateInput:0,typing:false,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:false,updateMaxLine:false,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:false,id:++ue};xc(a.curOp)}function we(a){var b=a.curOp;if(b){zc(b,function(a){for(var b=0;b<a.ops.length;b++){a.ops[b].cm.curOp=null}xe(a)})}}function xe(a){var b=a.ops;for(var c=0;c<b.length;c++){ye(b[c])}for(var d=0;d<b.length;d++){ze(b[d])}for(var e=0;e<b.length;e++){Ae(b[e])}for(var f=0;f<b.length;f++){Be(b[f])}for(var g=0;g<b.length;g++){Ce(b[g])}}function ye(a){var b=a.cm,c=b.display;Ke(b);if(a.updateMaxLine){gc(b)}a.mustUpdate=a.viewChanged||a.forceUpdate||a.scrollTop!=null||a.scrollToPos&&(a.scrollToPos.from.line<c.viewFrom||a.scrollToPos.to.line>=c.viewTo)||c.maxLineChanged&&b.options.lineWrapping;a.update=a.mustUpdate&&new Je(b,a.mustUpdate&&{top:a.scrollTop,ensure:a.scrollToPos},a.forceUpdate)}function ze(a){a.updatedDisplay=a.mustUpdate&&Ne(a.cm,a.update)}function Ae(a){var b=a.cm,c=b.display;if(a.updatedDisplay){Zd(b)}a.barMeasure=ne(b);if(c.maxLineChanged&&!b.options.lineWrapping){a.adjustWidthTo=$c(b,c.maxLine,c.maxLine.text.length).left+3;b.display.sizerWidth=a.adjustWidthTo;a.barMeasure.scrollWidth=Math.max(c.scroller.clientWidth,c.sizer.offsetLeft+a.adjustWidthTo+Uc(b)+b.display.barWidth);a.maxScrollLeft=Math.max(0,c.sizer.offsetLeft+a.adjustWidthTo-Vc(b))}if(a.updatedDisplay||a.selectionChanged){a.preparedSelection=c.input.prepareSelection()}}function Be(a){var b=a.cm;if(a.adjustWidthTo!=null){b.display.sizer.style.minWidth=a.adjustWidthTo+"px";if(a.maxScrollLeft<b.doc.scrollLeft){me(b,Math.min(b.display.scroller.scrollLeft,a.maxScrollLeft),true)}b.display.maxLineChanged=false}var c=a.focus&&a.focus==G();if(a.preparedSelection){b.display.input.showSelection(a.preparedSelection,c)}if(a.updatedDisplay||a.startHeight!=b.doc.height){qe(b,a.barMeasure)}if(a.updatedDisplay){Se(b,a.barMeasure)}if(a.selectionChanged){Ud(b)}if(b.state.focused&&a.updateInput){b.display.input.reset(a.typing)}if(c){Vd(a.cm)}}function Ce(a){var b=a.cm,c=b.display,d=b.doc;if(a.updatedDisplay){Oe(b,a.update)}if(c.wheelStartX!=null&&(a.scrollTop!=null||a.scrollLeft!=null||a.scrollToPos)){c.wheelStartX=c.wheelStartY=null}if(a.scrollTop!=null){le(b,a.scrollTop,a.forceScroll)}if(a.scrollLeft!=null){me(b,a.scrollLeft,true,true)}if(a.scrollToPos){var e=be(b,lb(d,a.scrollToPos.from),lb(d,a.scrollToPos.to),a.scrollToPos.margin);ae(b,e)}var f=a.maybeHiddenMarkers,g=a.maybeUnhiddenMarkers;if(f){for(var h=0;h<f.length;++h){if(!f[h].lines.length){ra(f[h],"hide")}}}if(g){for(var i=0;i<g.length;++i){if(g[i].lines.length){ra(g[i],"unhide")}}}if(c.wrapper.offsetHeight){d.scrollTop=b.display.scroller.scrollTop}if(a.changeObjs){ra(b,"changes",b,a.changeObjs)}if(a.update){a.update.finish()}}function De(a,b){if(a.curOp){return b()}ve(a);try{return b()}finally{we(a)}}function Ee(a,b){return function(){if(a.curOp){return b.apply(a,arguments)}ve(a);try{return b.apply(a,arguments)}finally{we(a)}}}function Fe(a){return function(){if(this.curOp){return a.apply(this,arguments)}ve(this);try{return a.apply(this,arguments)}finally{we(this)}}}function Ge(a){return function(){var b=this.cm;if(!b||b.curOp){return a.apply(this,arguments)}ve(b);try{return a.apply(this,arguments)}finally{we(b)}}}function He(a,b){if(a.doc.highlightFrontier<a.display.viewTo){a.state.highlight.set(b,K(Ie,a))}}function Ie(a){var b=a.doc;if(b.highlightFrontier>=a.display.viewTo){return}var c=+new Date+a.options.workTime;var d=sb(a,b.highlightFrontier);var e=[];b.iter(d.line,Math.min(b.first+b.size,a.display.viewTo+500),function(f){if(d.line>=a.display.viewFrom){var g=f.styles;var h=f.text.length>a.options.maxHighlightLength?Ua(b.mode,d.state):null;var i=qb(a,f,d,true);if(h){d.state=h}f.styles=i.styles;var j=f.styleClasses,k=i.classes;if(k){f.styleClasses=k}else if(j){f.styleClasses=null}var l=!g||g.length!=f.styles.length||j!=k&&(!j||!k||j.bgClass!=k.bgClass||j.textClass!=k.textClass);for(var m=0;!l&&m<g.length;++m){l=g[m]!=f.styles[m]}if(l){e.push(d.line)}f.stateAfter=d.save();d.nextLine()}else{if(f.text.length<=a.options.maxHighlightLength){tb(a,f.text,d)}f.stateAfter=d.line%5==0?d.save():null;d.nextLine()}if(+new Date>c){He(a,a.options.workDelay);return true}});b.highlightFrontier=d.line;b.modeFrontier=Math.max(b.modeFrontier,d.line);if(e.length){De(a,function(){for(var b=0;b<e.length;b++){Kd(a,e[b],"text")}})}}var Je=function(a,b,c){var d=a.display;this.viewport=b;this.visible=_d(d,a.doc,b);this.editorIsHidden=!d.wrapper.offsetWidth;this.wrapperHeight=d.wrapper.clientHeight;this.wrapperWidth=d.wrapper.clientWidth;this.oldDisplayWidth=Vc(a);this.force=c;this.dims=Dd(a);this.events=[]};Je.prototype.signal=function(a,b){if(ua(a,b)){this.events.push(arguments)}};Je.prototype.finish=function(){for(var a=0;a<this.events.length;a++){ra.apply(null,this.events[a])}};function Ke(a){var b=a.display;if(!b.scrollbarsClipped&&b.scroller.offsetWidth){b.nativeBarWidth=b.scroller.offsetWidth-b.scroller.clientWidth;b.heightForcer.style.height=Uc(a)+"px";b.sizer.style.marginBottom=-b.nativeBarWidth+"px";b.sizer.style.borderRightWidth=Uc(a)+"px";b.scrollbarsClipped=true}}function Le(a){if(a.hasFocus()){return null}var b=G();if(!b||!F(a.display.lineDiv,b)){return null}var c={activeElt:b};if(window.getSelection){var d=window.getSelection();if(d.anchorNode&&d.extend&&F(a.display.lineDiv,d.anchorNode)){c.anchorNode=d.anchorNode;c.anchorOffset=d.anchorOffset;c.focusNode=d.focusNode;c.focusOffset=d.focusOffset}}return c}function Me(a){if(!a||!a.activeElt||a.activeElt==G()){return}a.activeElt.focus();if(!/^(INPUT|TEXTAREA)$/.test(a.activeElt.nodeName)&&a.anchorNode&&F(document.body,a.anchorNode)&&F(document.body,a.focusNode)){var b=window.getSelection(),c=document.createRange();c.setEnd(a.anchorNode,a.anchorOffset);c.collapse(false);b.removeAllRanges();b.addRange(c);b.extend(a.focusNode,a.focusOffset)}}function Ne(a,b){var c=a.display,d=a.doc;if(b.editorIsHidden){Ld(a);return false}if(!b.force&&b.visible.from>=c.viewFrom&&b.visible.to<=c.viewTo&&(c.updateLineNumbers==null||c.updateLineNumbers>=c.viewTo)&&c.renderedView==c.view&&Od(a)==0){return false}if(Ue(a)){Ld(a);b.dims=Dd(a)}var e=d.first+d.size;var f=Math.max(b.visible.from-a.options.viewportMargin,d.first);var g=Math.min(e,b.visible.to+a.options.viewportMargin);if(c.viewFrom<f&&f-c.viewFrom<20){f=Math.max(d.first,c.viewFrom)}if(c.viewTo>g&&c.viewTo-g<20){g=Math.min(e,c.viewTo)}if(Db){f=ac(a.doc,f);g=bc(a.doc,g)}var h=f!=c.viewFrom||g!=c.viewTo||c.lastWrapHeight!=b.wrapperHeight||c.lastWrapWidth!=b.wrapperWidth;Nd(a,f,g);c.viewOffset=ec(Ya(a.doc,c.viewFrom));a.display.mover.style.top=c.viewOffset+"px";var i=Od(a);if(!h&&i==0&&!b.force&&c.renderedView==c.view&&(c.updateLineNumbers==null||c.updateLineNumbers>=c.viewTo)){return false}var j=Le(a);if(i>4){c.lineDiv.style.display="none"}Qe(a,c.updateLineNumbers,b.dims);if(i>4){c.lineDiv.style.display=""}c.renderedView=c.view;Me(j);A(c.cursorDiv);A(c.selectionDiv);c.gutters.style.height=c.sizer.style.minHeight=0;if(h){c.lastWrapHeight=b.wrapperHeight;c.lastWrapWidth=b.wrapperWidth;He(a,400)}c.updateLineNumbers=null;return true}function Oe(a,b){var c=b.viewport;for(var d=true;;d=false){if(!d||!a.options.lineWrapping||b.oldDisplayWidth==Vc(a)){if(c&&c.top!=null){c={top:Math.min(a.doc.height+Sc(a.display)-Wc(a),c.top)}}b.visible=_d(a.display,a.doc,c);if(b.visible.from>=a.display.viewFrom&&b.visible.to<=a.display.viewTo){break}}else if(d){b.visible=_d(a.display,a.doc,c)}if(!Ne(a,b)){break}Zd(a);var e=ne(a);Pd(a);qe(a,e);Se(a,e);b.force=false}b.signal(a,"update",a);if(a.display.viewFrom!=a.display.reportedViewFrom||a.display.viewTo!=a.display.reportedViewTo){b.signal(a,"viewportChange",a,a.display.viewFrom,a.display.viewTo);a.display.reportedViewFrom=a.display.viewFrom;a.display.reportedViewTo=a.display.viewTo}}function Pe(a,b){var c=new Je(a,b);if(Ne(a,c)){Zd(a);Oe(a,c);var d=ne(a);Pd(a);qe(a,d);Se(a,d);c.finish()}}function Qe(a,b,c){var d=a.display,e=a.options.lineNumbers;var f=d.lineDiv,g=f.firstChild;function h(b){var c=b.nextSibling;if(i&&s&&a.display.currentWheelTarget==b){b.style.display="none"}else{b.parentNode.removeChild(b)}return c}var j=d.view,k=d.viewFrom;for(var l=0;l<j.length;l++){var m=j[l];if(m.hidden);else if(!m.node||m.node.parentNode!=f){var n=Lc(a,m,k,c);f.insertBefore(n,g)}else{while(g!=m.node){g=h(g)}var o=e&&b!=null&&b<=k&&m.lineNumber;if(m.changes){if(O(m.changes,"gutter")>-1){o=false}Dc(a,m,k,c)}if(o){A(m.lineNumber);m.lineNumber.appendChild(document.createTextNode(db(a.options,k)))}g=m.node.nextSibling}k+=m.size}while(g){g=h(g)}}function Re(a){var b=a.gutters.offsetWidth;a.sizer.style.marginLeft=b+"px"}function Se(a,b){a.display.sizer.style.minHeight=b.docHeight+"px";a.display.heightForcer.style.top=b.docHeight+"px";a.display.gutters.style.height=b.docHeight+a.display.barHeight+Uc(a)+"px"}function Te(a){var b=a.display,c=b.view;if(!b.alignWidgets&&(!b.gutters.firstChild||!a.options.fixedGutter)){return}var d=Ed(b)-b.scroller.scrollLeft+a.doc.scrollLeft;var e=b.gutters.offsetWidth,f=d+"px";for(var g=0;g<c.length;g++){if(!c[g].hidden){if(a.options.fixedGutter){if(c[g].gutter){c[g].gutter.style.left=f}if(c[g].gutterBackground){c[g].gutterBackground.style.left=f}}var h=c[g].alignable;if(h){for(var i=0;i<h.length;i++){h[i].style.left=f}}}}if(a.options.fixedGutter){b.gutters.style.left=d+e+"px"}}function Ue(a){if(!a.options.lineNumbers){return false}var b=a.doc,c=db(a.options,b.first+b.size-1),d=a.display;if(c.length!=d.lineNumChars){var e=d.measure.appendChild(C("div",[C("div",c)],"CodeMirror-linenumber CodeMirror-gutter-elt"));var f=e.firstChild.offsetWidth,g=e.offsetWidth-f;d.lineGutter.style.width="";d.lineNumInnerWidth=Math.max(f,d.lineGutter.offsetWidth-g)+1;d.lineNumWidth=d.lineNumInnerWidth+g;d.lineNumChars=d.lineNumInnerWidth?c.length:-1;d.lineGutter.style.width=d.lineNumWidth+"px";Re(a.display);return true}return false}function Ve(a,b){var c=[],d=false;for(var e=0;e<a.length;e++){var f=a[e],g=null;if(typeof f!="string"){g=f.style;f=f.className}if(f=="CodeMirror-linenumbers"){if(!b){continue}else{d=true}}c.push({className:f,style:g})}if(b&&!d){c.push({className:"CodeMirror-linenumbers",style:null})}return c}function We(a){var b=a.gutters,c=a.gutterSpecs;A(b);a.lineGutter=null;for(var d=0;d<c.length;++d){var e=c[d];var f=e.className;var g=e.style;var h=b.appendChild(C("div",null,"CodeMirror-gutter "+f));if(g){h.style.cssText=g}if(f=="CodeMirror-linenumbers"){a.lineGutter=h;h.style.width=(a.lineNumWidth||1)+"px"}}b.style.display=c.length?"":"none";Re(a)}function Xe(a){We(a.display);Jd(a);Te(a)}function Ye(a,b,d,e){var f=this;this.input=d;f.scrollbarFiller=C("div",null,"CodeMirror-scrollbar-filler");f.scrollbarFiller.setAttribute("cm-not-content","true");f.gutterFiller=C("div",null,"CodeMirror-gutter-filler");f.gutterFiller.setAttribute("cm-not-content","true");f.lineDiv=D("div",null,"CodeMirror-code");f.selectionDiv=C("div",null,null,"position: relative; z-index: 1");f.cursorDiv=C("div",null,"CodeMirror-cursors");f.measure=C("div",null,"CodeMirror-measure");f.lineMeasure=C("div",null,"CodeMirror-measure");f.lineSpace=D("div",[f.measure,f.lineMeasure,f.selectionDiv,f.cursorDiv,f.lineDiv],null,"position: relative; outline: none");var j=D("div",[f.lineSpace],"CodeMirror-lines");f.mover=C("div",[j],null,"position: relative");f.sizer=C("div",[f.mover],"CodeMirror-sizer");f.sizerWidth=null;f.heightForcer=C("div",null,null,"position: absolute; height: "+P+"px; width: 1px;");f.gutters=C("div",null,"CodeMirror-gutters");f.lineGutter=null;f.scroller=C("div",[f.sizer,f.heightForcer,f.gutters],"CodeMirror-scroll");f.scroller.setAttribute("tabIndex","-1");f.wrapper=C("div",[f.scrollbarFiller,f.gutterFiller,f.scroller],"CodeMirror");if(g&&h<8){f.gutters.style.zIndex=-1;f.scroller.style.paddingRight=0}if(!i&&!(c&&r)){f.scroller.draggable=true}if(a){if(a.appendChild){a.appendChild(f.wrapper)}else{a(f.wrapper)}}f.viewFrom=f.viewTo=b.first;f.reportedViewFrom=f.reportedViewTo=b.first;f.view=[];f.renderedView=null;f.externalMeasured=null;f.viewOffset=0;f.lastWrapHeight=f.lastWrapWidth=0;f.updateLineNumbers=null;f.nativeBarWidth=f.barHeight=f.barWidth=0;f.scrollbarsClipped=false;f.lineNumWidth=f.lineNumInnerWidth=f.lineNumChars=null;f.alignWidgets=false;f.cachedCharWidth=f.cachedTextHeight=f.cachedPaddingH=null;f.maxLine=null;f.maxLineLength=0;f.maxLineChanged=false;f.wheelDX=f.wheelDY=f.wheelStartX=f.wheelStartY=null;f.shift=false;f.selForContextMenu=null;f.activeTouch=null;f.gutterSpecs=Ve(e.gutters,e.lineNumbers);We(f);d.init(f)}var Ze=0,$e=null;if(g){$e=-.53}else if(c){$e=15}else if(k){$e=-.7}else if(m){$e=-1/3}function _e(a){var b=a.wheelDeltaX,c=a.wheelDeltaY;if(b==null&&a.detail&&a.axis==a.HORIZONTAL_AXIS){b=a.detail}if(c==null&&a.detail&&a.axis==a.VERTICAL_AXIS){c=a.detail}else if(c==null){c=a.wheelDelta}return{x:b,y:c}}function af(a){var b=_e(a);b.x*=$e;b.y*=$e;return b}function bf(a,b){var d=_e(b),e=d.x,f=d.y;var g=a.display,h=g.scroller;var j=h.scrollWidth>h.clientWidth;var k=h.scrollHeight>h.clientHeight;if(!(e&&j||f&&k)){return}if(f&&s&&i){a:for(var m=b.target,n=g.view;m!=h;m=m.parentNode){for(var o=0;o<n.length;o++){if(n[o].node==m){a.display.currentWheelTarget=m;break a}}}}if(e&&!c&&!l&&$e!=null){if(f&&k){ke(a,Math.max(0,h.scrollTop+f*$e))}me(a,Math.max(0,h.scrollLeft+e*$e));if(!f||f&&k){wa(b)}g.wheelStartX=null;return}if(f&&$e!=null){var p=f*$e;var q=a.doc.scrollTop,r=q+g.wrapper.clientHeight;if(p<0){q=Math.max(0,q+p-50)}else{r=Math.min(a.doc.height,r+p+50)}Pe(a,{top:q,bottom:r})}if(Ze<20){if(g.wheelStartX==null){g.wheelStartX=h.scrollLeft;g.wheelStartY=h.scrollTop;g.wheelDX=e;g.wheelDY=f;setTimeout(function(){if(g.wheelStartX==null){return}var a=h.scrollLeft-g.wheelStartX;var b=h.scrollTop-g.wheelStartY;var c=b&&g.wheelDY&&b/g.wheelDY||a&&g.wheelDX&&a/g.wheelDX;g.wheelStartX=g.wheelStartY=null;if(!c){return}$e=($e*Ze+c)/(Ze+1);++Ze},200)}else{g.wheelDX+=e;g.wheelDY+=f}}}var cf=function(a,b){this.ranges=a;this.primIndex=b};cf.prototype.primary=function(){return this.ranges[this.primIndex]};cf.prototype.equals=function(a){if(a==this){return true}if(a.primIndex!=this.primIndex||a.ranges.length!=this.ranges.length){return false}for(var b=0;b<this.ranges.length;b++){var c=this.ranges[b],d=a.ranges[b];if(!gb(c.anchor,d.anchor)||!gb(c.head,d.head)){return false}}return true};cf.prototype.deepCopy=function(){var a=[];for(var b=0;b<this.ranges.length;b++){a[b]=new df(hb(this.ranges[b].anchor),hb(this.ranges[b].head))}return new cf(a,this.primIndex)};cf.prototype.somethingSelected=function(){for(var a=0;a<this.ranges.length;a++){if(!this.ranges[a].empty()){return true}}return false};cf.prototype.contains=function(a,b){if(!b){b=a}for(var c=0;c<this.ranges.length;c++){var d=this.ranges[c];if(fb(b,d.from())>=0&&fb(a,d.to())<=0){return c}}return-1};var df=function(a,b){this.anchor=a;this.head=b};df.prototype.from=function(){return jb(this.anchor,this.head)};df.prototype.to=function(){return ib(this.anchor,this.head)};df.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function ef(a,b,c){var d=a&&a.options.selectionsMayTouch;var e=b[c];b.sort(function(a,b){return fb(a.from(),b.from())});c=O(b,e);for(var f=1;f<b.length;f++){var g=b[f],h=b[f-1];var i=fb(h.to(),g.from());if(d&&!g.empty()?i>0:i>=0){var j=jb(h.from(),g.from()),k=ib(h.to(),g.to());var l=h.empty()?g.from()==g.head:h.from()==h.head;if(f<=c){--c}b.splice(--f,2,new df(l?k:j,l?j:k))}}return new cf(b,c)}function ff(a,b){return new cf([new df(a,b||a)],0)}function gf(a){if(!a.text){return a.to}return eb(a.from.line+a.text.length-1,X(a.text).length+(a.text.length==1?a.from.ch:0))}function hf(a,b){if(fb(a,b.from)<0){return a}if(fb(a,b.to)<=0){return gf(b)}var c=a.line+b.text.length-(b.to.line-b.from.line)-1,d=a.ch;if(a.line==b.to.line){d+=gf(b).ch-b.to.ch}return eb(c,d)}function jf(a,b){var c=[];for(var d=0;d<a.sel.ranges.length;d++){var e=a.sel.ranges[d];c.push(new df(hf(e.anchor,b),hf(e.head,b)))}return ef(a.cm,c,a.sel.primIndex)}function kf(a,b,c){if(a.line==b.line){return eb(c.line,a.ch-b.ch+c.ch)}else{return eb(c.line+(a.line-b.line),a.ch)}}function lf(a,b,c){var d=[];var e=eb(a.first,0),f=e;for(var g=0;g<b.length;g++){var h=b[g];var i=kf(h.from,e,f);var j=kf(gf(h),e,f);e=h.to;f=j;if(c=="around"){var k=a.sel.ranges[g],l=fb(k.head,k.anchor)<0;d[g]=new df(l?j:i,l?i:j)}else{d[g]=new df(i,i)}}return new cf(d,a.sel.primIndex)}function mf(a){a.doc.mode=Ra(a.options,a.doc.modeOption);nf(a)}function nf(a){a.doc.iter(function(a){if(a.stateAfter){a.stateAfter=null}if(a.styles){a.styles=null}});a.doc.modeFrontier=a.doc.highlightFrontier=a.doc.first;He(a,100);a.state.modeGen++;if(a.curOp){Jd(a)}}function of(a,b){return b.from.ch==0&&b.to.ch==0&&X(b.text)==""&&(!a.cm||a.cm.options.wholeLineUpdateBefore)}function pf(a,b,c,d){function e(a){return c?c[a]:null}function f(a,c,e){ic(a,c,e,d);Bc(a,"change",a,b)}function g(a,b){var c=[];for(var f=a;f<b;++f){c.push(new hc(j[f],e(f),d))}return c}var h=b.from,i=b.to,j=b.text;var k=Ya(a,h.line),l=Ya(a,i.line);var m=X(j),n=e(j.length-1),o=i.line-h.line;if(b.full){a.insert(0,g(0,j.length));a.remove(j.length,a.size-j.length)}else if(of(a,b)){var p=g(0,j.length-1);f(l,l.text,n);if(o){a.remove(h.line,o)}if(p.length){a.insert(h.line,p)}}else if(k==l){if(j.length==1){f(k,k.text.slice(0,h.ch)+m+k.text.slice(i.ch),n)}else{var q=g(1,j.length-1);q.push(new hc(m+k.text.slice(i.ch),n,d));f(k,k.text.slice(0,h.ch)+j[0],e(0));a.insert(h.line+1,q)}}else if(j.length==1){f(k,k.text.slice(0,h.ch)+j[0]+l.text.slice(i.ch),e(0));a.remove(h.line+1,o)}else{f(k,k.text.slice(0,h.ch)+j[0],e(0));f(l,m+l.text.slice(i.ch),n);var r=g(1,j.length-1);if(o>1){a.remove(h.line+1,o-1)}a.insert(h.line+1,r)}Bc(a,"change",a,b)}function qf(a,b,c){function d(a,e,f){if(a.linked){for(var g=0;g<a.linked.length;++g){var h=a.linked[g];if(h.doc==e){continue}var i=f&&h.sharedHist;if(c&&!i){continue}b(h.doc,i);d(h.doc,a,i)}}}d(a,null,true)}function rf(a,b){if(b.cm){throw new Error("This document is already in use.")}a.doc=b;b.cm=a;Gd(a);mf(a);sf(a);if(!a.options.lineWrapping){gc(a)}a.options.mode=b.modeOption;Jd(a)}function sf(a){(a.doc.direction=="rtl"?H:z)(a.display.lineDiv,"CodeMirror-rtl")}function tf(a){De(a,function(){sf(a);Jd(a)})}function uf(a){this.done=[];this.undone=[];this.undoDepth=Infinity;this.lastModTime=this.lastSelTime=0;this.lastOp=this.lastSelOp=null;this.lastOrigin=this.lastSelOrigin=null;this.generation=this.maxGeneration=a||1}function vf(a,b){var c={from:hb(b.from),to:gf(b),text:Za(a,b.from,b.to)};Cf(a,c,b.from.line,b.to.line+1);qf(a,function(a){return Cf(a,c,b.from.line,b.to.line+1)},true);return c}function wf(a){while(a.length){var b=X(a);if(b.ranges){a.pop()}else{break}}}function xf(a,b){if(b){wf(a.done);return X(a.done)}else if(a.done.length&&!X(a.done).ranges){return X(a.done)}else if(a.done.length>1&&!a.done[a.done.length-2].ranges){a.done.pop();return X(a.done)}}function yf(a,b,c,d){var e=a.history;e.undone.length=0;var f=+new Date,g;var h;if((e.lastOp==d||e.lastOrigin==b.origin&&b.origin&&(b.origin.charAt(0)=="+"&&e.lastModTime>f-(a.cm?a.cm.options.historyEventDelay:500)||b.origin.charAt(0)=="*"))&&(g=xf(e,e.lastOp==d))){h=X(g.changes);if(fb(b.from,b.to)==0&&fb(b.from,h.to)==0){h.to=gf(b)}else{g.changes.push(vf(a,b))}}else{var i=X(e.done);if(!i||!i.ranges){Bf(a.sel,e.done)}g={changes:[vf(a,b)],generation:e.generation};e.done.push(g);while(e.done.length>e.undoDepth){e.done.shift();if(!e.done[0].ranges){e.done.shift()}}}e.done.push(c);e.generation=++e.maxGeneration;e.lastModTime=e.lastSelTime=f;e.lastOp=e.lastSelOp=d;e.lastOrigin=e.lastSelOrigin=b.origin;if(!h){ra(a,"historyAdded")}}function zf(a,b,c,d){var e=b.charAt(0);return e=="*"||e=="+"&&c.ranges.length==d.ranges.length&&c.somethingSelected()==d.somethingSelected()&&new Date-a.history.lastSelTime<=(a.cm?a.cm.options.historyEventDelay:500)}function Af(a,b,c,d){var e=a.history,f=d&&d.origin;if(c==e.lastSelOp||f&&e.lastSelOrigin==f&&(e.lastModTime==e.lastSelTime&&e.lastOrigin==f||zf(a,f,X(e.done),b))){e.done[e.done.length-1]=b}else{Bf(b,e.done)}e.lastSelTime=+new Date;e.lastSelOrigin=f;e.lastSelOp=c;if(d&&d.clearRedo!==false){wf(e.undone)}}function Bf(a,b){var c=X(b);if(!(c&&c.ranges&&c.equals(a))){b.push(a)}}function Cf(a,b,c,d){var e=b["spans_"+a.id],f=0;a.iter(Math.max(a.first,c),Math.min(a.first+a.size,d),function(c){if(c.markedSpans){(e||(e=b["spans_"+a.id]={}))[f]=c.markedSpans}++f})}function Df(a){if(!a){return null}var b;for(var c=0;c<a.length;++c){if(a[c].marker.explicitlyCleared){if(!b){b=a.slice(0,c)}}else if(b){b.push(a[c])}}return!b?a:b.length?b:null}function Ef(a,b){var c=b["spans_"+a.id];if(!c){return null}var d=[];for(var e=0;e<b.text.length;++e){d.push(Df(c[e]))}return d}function Ff(a,b){var c=Ef(a,b);var d=Mb(a,b);if(!c){return d}if(!d){return c}for(var e=0;e<c.length;++e){var f=c[e],g=d[e];if(f&&g){a:for(var h=0;h<g.length;++h){var i=g[h];for(var j=0;j<f.length;++j){if(f[j].marker==i.marker){continue a}}f.push(i)}}else if(g){c[e]=g}}return c}function Gf(a,b,c){var d=[];for(var e=0;e<a.length;++e){var f=a[e];if(f.ranges){d.push(c?cf.prototype.deepCopy.call(f):f);continue}var g=f.changes,h=[];d.push({changes:h});for(var i=0;i<g.length;++i){var j=g[i],k=void 0;h.push({from:j.from,to:j.to,text:j.text});if(b){for(var l in j){if(k=l.match(/^spans_(\d+)$/)){if(O(b,Number(k[1]))>-1){X(h)[l]=j[l];delete j[l]}}}}}}return d}function Hf(a,b,c,d){if(d){var e=a.anchor;if(c){var f=fb(b,e)<0;if(f!=fb(c,e)<0){e=b;b=c}else if(f!=fb(b,c)<0){b=c}}return new df(e,b)}else{return new df(c||b,b)}}function If(a,b,c,d,e){if(e==null){e=a.cm&&(a.cm.display.shift||a.extend)}Of(a,new cf([Hf(a.sel.primary(),b,c,e)],0),d)}function Jf(a,b,c){var d=[];var e=a.cm&&(a.cm.display.shift||a.extend);for(var f=0;f<a.sel.ranges.length;f++){d[f]=Hf(a.sel.ranges[f],b[f],null,e)}var g=ef(a.cm,d,a.sel.primIndex);Of(a,g,c)}function Kf(a,b,c,d){var e=a.sel.ranges.slice(0);e[b]=c;Of(a,ef(a.cm,e,a.sel.primIndex),d)}function Lf(a,b,c,d){Of(a,ff(b,c),d)}function Mf(a,b,c){var d={ranges:b.ranges,update:function(b){this.ranges=[];for(var c=0;c<b.length;c++){this.ranges[c]=new df(lb(a,b[c].anchor),lb(a,b[c].head))}},origin:c&&c.origin};ra(a,"beforeSelectionChange",a,d);if(a.cm){ra(a.cm,"beforeSelectionChange",a.cm,d)}if(d.ranges!=b.ranges){return ef(a.cm,d.ranges,d.ranges.length-1)}else{return b}}function Nf(a,b,c){var d=a.history.done,e=X(d);if(e&&e.ranges){d[d.length-1]=b;Pf(a,b,c)}else{Of(a,b,c)}}function Of(a,b,c){Pf(a,b,c);Af(a,a.sel,a.cm?a.cm.curOp.id:NaN,c)}function Pf(a,b,c){if(ua(a,"beforeSelectionChange")||a.cm&&ua(a.cm,"beforeSelectionChange")){b=Mf(a,b,c)}var d=c&&c.bias||(fb(b.primary().head,a.sel.primary().head)<0?-1:1);Qf(a,Sf(a,b,d,true));if(!(c&&c.scroll===false)&&a.cm){fe(a.cm)}}function Qf(a,b){if(b.equals(a.sel)){return}a.sel=b;if(a.cm){a.cm.curOp.updateInput=1;a.cm.curOp.selectionChanged=true;ta(a.cm)}Bc(a,"cursorActivity",a)}function Rf(a){Qf(a,Sf(a,a.sel,null,false))}function Sf(a,b,c,d){var e;for(var f=0;f<b.ranges.length;f++){var g=b.ranges[f];var h=b.ranges.length==a.sel.ranges.length&&a.sel.ranges[f];var i=Uf(a,g.anchor,h&&h.anchor,c,d);var j=Uf(a,g.head,h&&h.head,c,d);if(e||i!=g.anchor||j!=g.head){if(!e){e=b.ranges.slice(0,f)}e[f]=new df(i,j)}}return e?ef(a.cm,e,b.primIndex):b}function Tf(a,b,c,d,e){var f=Ya(a,b.line);if(f.markedSpans){for(var g=0;g<f.markedSpans.length;++g){var h=f.markedSpans[g],i=h.marker;var j="selectLeft"in i?!i.selectLeft:i.inclusiveLeft;var k="selectRight"in i?!i.selectRight:i.inclusiveRight;if((h.from==null||(j?h.from<=b.ch:h.from<b.ch))&&(h.to==null||(k?h.to>=b.ch:h.to>b.ch))){if(e){ra(i,"beforeCursorEnter");if(i.explicitlyCleared){if(!f.markedSpans){break}else{--g;continue}}}if(!i.atomic){continue}if(c){var l=i.find(d<0?1:-1),m=void 0;if(d<0?k:j){l=Vf(a,l,-d,l&&l.line==b.line?f:null)}if(l&&l.line==b.line&&(m=fb(l,c))&&(d<0?m<0:m>0)){return Tf(a,l,b,d,e)}}var n=i.find(d<0?-1:1);if(d<0?j:k){n=Vf(a,n,d,n.line==b.line?f:null)}return n?Tf(a,n,b,d,e):null}}}return b}function Uf(a,b,c,d,e){var f=d||1;var g=Tf(a,b,c,f,e)||!e&&Tf(a,b,c,f,true)||Tf(a,b,c,-f,e)||!e&&Tf(a,b,c,-f,true);if(!g){a.cantEdit=true;return eb(a.first,0)}return g}function Vf(a,b,c,d){if(c<0&&b.ch==0){if(b.line>a.first){return lb(a,eb(b.line-1))}else{return null}}else if(c>0&&b.ch==(d||Ya(a,b.line)).text.length){if(b.line<a.first+a.size-1){return eb(b.line+1,0)}else{return null}}else{return new eb(b.line,b.ch+c)}}function Wf(a){a.setSelection(eb(a.firstLine(),0),eb(a.lastLine()),R)}function Xf(a,b,c){var d={canceled:false,from:b.from,to:b.to,text:b.text,origin:b.origin,cancel:function(){return d.canceled=true}};if(c){d.update=function(b,c,e,f){if(b){d.from=lb(a,b)}if(c){d.to=lb(a,c)}if(e){d.text=e}if(f!==undefined){d.origin=f}}}ra(a,"beforeChange",a,d);if(a.cm){ra(a.cm,"beforeChange",a.cm,d)}if(d.canceled){if(a.cm){a.cm.curOp.updateInput=2}return null}return{from:d.from,to:d.to,text:d.text,origin:d.origin}}function Yf(a,b,c){if(a.cm){if(!a.cm.curOp){return Ee(a.cm,Yf)(a,b,c)}if(a.cm.state.suppressEdits){return}}if(ua(a,"beforeChange")||a.cm&&ua(a.cm,"beforeChange")){b=Xf(a,b,true);if(!b){return}}var d=Cb&&!c&&Ob(a,b.from,b.to);if(d){for(var e=d.length-1;e>=0;--e){Zf(a,{from:d[e].from,to:d[e].to,text:e?[""]:b.text,origin:b.origin})}}else{Zf(a,b)}}function Zf(a,b){if(b.text.length==1&&b.text[0]==""&&fb(b.from,b.to)==0){return}var c=jf(a,b);yf(a,b,c,a.cm?a.cm.curOp.id:NaN);ag(a,b,c,Mb(a,b));var d=[];qf(a,function(a,c){if(!c&&O(d,a.history)==-1){fg(a.history,b);d.push(a.history)}ag(a,b,null,Mb(a,b))})}function $f(a,b,c){var d=a.cm&&a.cm.state.suppressEdits;if(d&&!c){return}var e=a.history,f,g=a.sel;var h=b=="undo"?e.done:e.undone,i=b=="undo"?e.undone:e.done;var j=0;for(;j<h.length;j++){f=h[j];if(c?f.ranges&&!f.equals(a.sel):!f.ranges){break}}if(j==h.length){return}e.lastOrigin=e.lastSelOrigin=null;for(;;){f=h.pop();if(f.ranges){Bf(f,i);if(c&&!f.equals(a.sel)){Of(a,f,{clearRedo:false});return}g=f}else if(d){h.push(f);return}else{break}}var k=[];Bf(g,i);i.push({changes:k,generation:e.generation});e.generation=f.generation||++e.maxGeneration;var l=ua(a,"beforeChange")||a.cm&&ua(a.cm,"beforeChange");var m=function(c){var d=f.changes[c];d.origin=b;if(l&&!Xf(a,d,false)){h.length=0;return{}}k.push(vf(a,d));var e=c?jf(a,d):X(h);ag(a,d,e,Ff(a,d));if(!c&&a.cm){a.cm.scrollIntoView({from:d.from,to:gf(d)})}var g=[];qf(a,function(a,b){if(!b&&O(g,a.history)==-1){fg(a.history,d);g.push(a.history)}ag(a,d,null,Ff(a,d))})};for(var n=f.changes.length-1;n>=0;--n){var o=m(n);if(o)return o.v}}function _f(a,b){if(b==0){return}a.first+=b;a.sel=new cf(Y(a.sel.ranges,function(a){return new df(eb(a.anchor.line+b,a.anchor.ch),eb(a.head.line+b,a.head.ch))}),a.sel.primIndex);if(a.cm){Jd(a.cm,a.first,a.first-b,b);for(var c=a.cm.display,d=c.viewFrom;d<c.viewTo;d++){Kd(a.cm,d,"gutter")}}}function ag(a,b,c,d){if(a.cm&&!a.cm.curOp){return Ee(a.cm,ag)(a,b,c,d)}if(b.to.line<a.first){_f(a,b.text.length-1-(b.to.line-b.from.line));return}if(b.from.line>a.lastLine()){return}if(b.from.line<a.first){var e=b.text.length-1-(a.first-b.from.line);_f(a,e);b={from:eb(a.first,0),to:eb(b.to.line+e,b.to.ch),text:[X(b.text)],origin:b.origin}}var f=a.lastLine();if(b.to.line>f){b={from:b.from,to:eb(f,Ya(a,f).text.length),text:[b.text[0]],origin:b.origin}}b.removed=Za(a,b.from,b.to);if(!c){c=jf(a,b)}if(a.cm){bg(a.cm,b,d)}else{pf(a,b,d)}Pf(a,c,R);if(a.cantEdit&&Uf(a,eb(a.firstLine(),0))){a.cantEdit=false}}function bg(a,b,c){var d=a.doc,e=a.display,f=b.from,g=b.to;var h=false,i=f.line;if(!a.options.lineWrapping){i=ab(Zb(Ya(d,f.line)));d.iter(i,g.line+1,function(a){if(a==e.maxLine){h=true;return true}})}if(d.sel.contains(b.from,b.to)>-1){ta(a)}pf(d,b,c,Fd(a));if(!a.options.lineWrapping){d.iter(i,f.line+b.text.length,function(a){var b=fc(a);if(b>e.maxLineLength){e.maxLine=a;e.maxLineLength=b;e.maxLineChanged=true;h=false}});if(h){a.curOp.updateMaxLine=true}}Bb(d,f.line);He(a,400);var j=b.text.length-(g.line-f.line)-1;if(b.full){Jd(a)}else if(f.line==g.line&&b.text.length==1&&!of(a.doc,b)){Kd(a,f.line,"text")}else{Jd(a,f.line,g.line+1,j)}var k=ua(a,"changes"),l=ua(a,"change");if(l||k){var m={from:f,to:g,text:b.text,removed:b.removed,origin:b.origin};if(l){Bc(a,"change",a,m)}if(k){(a.curOp.changeObjs||(a.curOp.changeObjs=[])).push(m)}}a.display.selForContextMenu=null}function cg(a,b,c,d,e){var f;if(!d){d=c}if(fb(d,c)<0){f=[d,c],c=f[0],d=f[1]}if(typeof b=="string"){b=a.splitLines(b)}Yf(a,{from:c,to:d,text:b,origin:e})}function dg(a,b,c,d){if(c<a.line){a.line+=d}else if(b<a.line){a.line=b;a.ch=0}}function eg(a,b,c,d){for(var e=0;e<a.length;++e){var f=a[e],g=true;if(f.ranges){if(!f.copied){f=a[e]=f.deepCopy();f.copied=true}for(var h=0;h<f.ranges.length;h++){dg(f.ranges[h].anchor,b,c,d);dg(f.ranges[h].head,b,c,d)}continue}for(var i=0;i<f.changes.length;++i){var j=f.changes[i];if(c<j.from.line){j.from=eb(j.from.line+d,j.from.ch);j.to=eb(j.to.line+d,j.to.ch)}else if(b<=j.to.line){g=false;break}}if(!g){a.splice(0,e+1);e=0}}}function fg(a,b){var c=b.from.line,d=b.to.line,e=b.text.length-(d-c)-1;eg(a.done,c,d,e);eg(a.undone,c,d,e)}function gg(a,b,c,d){var e=b,f=b;if(typeof b=="number"){f=Ya(a,kb(a,b))}else{ 4e=ab(b)}if(e==null){return null}if(d(f,e)&&a.cm){Kd(a.cm,e,c)}return f}function hg(a){this.lines=a;this.parent=null;var b=0;for(var c=0;c<a.length;++c){a[c].parent=this;b+=a[c].height}this.height=b}hg.prototype={chunkSize:function(){return this.lines.length},removeInner:function(a,b){for(var c=a,d=a+b;c<d;++c){var e=this.lines[c];this.height-=e.height;jc(e);Bc(e,"delete")}this.lines.splice(a,b)},collapse:function(a){a.push.apply(a,this.lines)},insertInner:function(a,b,c){this.height+=c;this.lines=this.lines.slice(0,a).concat(b).concat(this.lines.slice(a));for(var d=0;d<b.length;++d){b[d].parent=this}},iterN:function(a,b,c){for(var d=a+b;a<d;++a){if(c(this.lines[a])){return true}}}};function ig(a){this.children=a;var b=0,c=0;for(var d=0;d<a.length;++d){var e=a[d];b+=e.chunkSize();c+=e.height;e.parent=this}this.size=b;this.height=c;this.parent=null}ig.prototype={chunkSize:function(){return this.size},removeInner:function(a,b){this.size-=b;for(var c=0;c<this.children.length;++c){var d=this.children[c],e=d.chunkSize();if(a<e){var f=Math.min(b,e-a),g=d.height;d.removeInner(a,f);this.height-=g-d.height;if(e==f){this.children.splice(c--,1);d.parent=null}if((b-=f)==0){break}a=0}else{a-=e}}if(this.size-b<25&&(this.children.length>1||!(this.children[0]instanceof hg))){var h=[];this.collapse(h);this.children=[new hg(h)];this.children[0].parent=this}},collapse:function(a){for(var b=0;b<this.children.length;++b){this.children[b].collapse(a)}},insertInner:function(a,b,c){this.size+=b.length;this.height+=c;for(var d=0;d<this.children.length;++d){var e=this.children[d],f=e.chunkSize();if(a<=f){e.insertInner(a,b,c);if(e.lines&&e.lines.length>50){var g=e.lines.length%25+25;for(var h=g;h<e.lines.length;){var i=new hg(e.lines.slice(h,h+=25));e.height-=i.height;this.children.splice(++d,0,i);i.parent=this}e.lines=e.lines.slice(0,g);this.maybeSpill()}break}a-=f}},maybeSpill:function(){if(this.children.length<=10){return}var a=this;do{var b=a.children.splice(a.children.length-5,5);var c=new ig(b);if(!a.parent){var d=new ig(a.children);d.parent=a;a.children=[d,c];a=d}else{a.size-=c.size;a.height-=c.height;var e=O(a.parent.children,a);a.parent.children.splice(e+1,0,c)}c.parent=a.parent}while(a.children.length>10);a.parent.maybeSpill()},iterN:function(a,b,c){for(var d=0;d<this.children.length;++d){var e=this.children[d],f=e.chunkSize();if(a<f){var g=Math.min(b,f-a);if(e.iterN(a,g,c)){return true}if((b-=g)==0){break}a=0}else{a-=f}}}};var jg=function(a,b,c){if(c){for(var d in c){if(c.hasOwnProperty(d)){this[d]=c[d]}}}this.doc=a;this.node=b};jg.prototype.clear=function(){var a=this.doc.cm,b=this.line.widgets,c=this.line,d=ab(c);if(d==null||!b){return}for(var e=0;e<b.length;++e){if(b[e]==this){b.splice(e--,1)}}if(!b.length){c.widgets=null}var f=Pc(this);_a(c,Math.max(0,c.height-f));if(a){De(a,function(){kg(a,c,-f);Kd(a,d,"widget")});Bc(a,"lineWidgetCleared",a,this,d)}};jg.prototype.changed=function(){var a=this;var b=this.height,c=this.doc.cm,d=this.line;this.height=null;var e=Pc(this)-b;if(!e){return}if(!cc(this.doc,d)){_a(d,d.height+e)}if(c){De(c,function(){c.curOp.forceUpdate=true;kg(c,d,e);Bc(c,"lineWidgetChanged",c,a,ab(d))})}};va(jg);function kg(a,b,c){if(ec(b)<(a.curOp&&a.curOp.scrollTop||a.doc.scrollTop)){ee(a,c)}}function lg(a,b,c,d){var e=new jg(a,c,d);var f=a.cm;if(f&&e.noHScroll){f.display.alignWidgets=true}gg(a,b,"widget",function(b){var c=b.widgets||(b.widgets=[]);if(e.insertAt==null){c.push(e)}else{c.splice(Math.min(c.length-1,Math.max(0,e.insertAt)),0,e)}e.line=b;if(f&&!cc(a,b)){var d=ec(b)<a.scrollTop;_a(b,b.height+Pc(e));if(d){ee(f,e.height)}f.curOp.forceUpdate=true}return true});if(f){Bc(f,"lineWidgetAdded",f,e,typeof b=="number"?b:ab(b))}return e}var mg=0;var ng=function(a,b){this.lines=[];this.type=b;this.doc=a;this.id=++mg};ng.prototype.clear=function(){if(this.explicitlyCleared){return}var a=this.doc.cm,b=a&&!a.curOp;if(b){ve(a)}if(ua(this,"clear")){var c=this.find();if(c){Bc(this,"clear",c.from,c.to)}}var d=null,e=null;for(var f=0;f<this.lines.length;++f){var g=this.lines[f];var h=Hb(g.markedSpans,this);if(a&&!this.collapsed){Kd(a,ab(g),"text")}else if(a){if(h.to!=null){e=ab(g)}if(h.from!=null){d=ab(g)}}g.markedSpans=Ib(g.markedSpans,h);if(h.from==null&&this.collapsed&&!cc(this.doc,g)&&a){_a(g,Bd(a.display))}}if(a&&this.collapsed&&!a.options.lineWrapping){for(var i=0;i<this.lines.length;++i){var j=Zb(this.lines[i]),k=fc(j);if(k>a.display.maxLineLength){a.display.maxLine=j;a.display.maxLineLength=k;a.display.maxLineChanged=true}}}if(d!=null&&a&&this.collapsed){Jd(a,d,e+1)}this.lines.length=0;this.explicitlyCleared=true;if(this.atomic&&this.doc.cantEdit){this.doc.cantEdit=false;if(a){Rf(a.doc)}}if(a){Bc(a,"markerCleared",a,this,d,e)}if(b){we(a)}if(this.parent){this.parent.clear()}};ng.prototype.find=function(a,b){if(a==null&&this.type=="bookmark"){a=1}var c,d;for(var e=0;e<this.lines.length;++e){var f=this.lines[e];var g=Hb(f.markedSpans,this);if(g.from!=null){c=eb(b?f:ab(f),g.from);if(a==-1){return c}}if(g.to!=null){d=eb(b?f:ab(f),g.to);if(a==1){return d}}}return c&&{from:c,to:d}};ng.prototype.changed=function(){var a=this;var b=this.find(-1,true),c=this,d=this.doc.cm;if(!b||!d){return}De(d,function(){var e=b.line,f=ab(b.line);var g=_c(d,f);if(g){hd(g);d.curOp.selectionChanged=d.curOp.forceUpdate=true}d.curOp.updateMaxLine=true;if(!cc(c.doc,e)&&c.height!=null){var h=c.height;c.height=null;var i=Pc(c)-h;if(i){_a(e,e.height+i)}}Bc(d,"markerChanged",d,a)})};ng.prototype.attachLine=function(a){if(!this.lines.length&&this.doc.cm){var b=this.doc.cm.curOp;if(!b.maybeHiddenMarkers||O(b.maybeHiddenMarkers,this)==-1){(b.maybeUnhiddenMarkers||(b.maybeUnhiddenMarkers=[])).push(this)}}this.lines.push(a)};ng.prototype.detachLine=function(a){this.lines.splice(O(this.lines,a),1);if(!this.lines.length&&this.doc.cm){var b=this.doc.cm.curOp;(b.maybeHiddenMarkers||(b.maybeHiddenMarkers=[])).push(this)}};va(ng);function og(a,b,c,d,e){if(d&&d.shared){return qg(a,b,c,d,e)}if(a.cm&&!a.cm.curOp){return Ee(a.cm,og)(a,b,c,d,e)}var f=new ng(a,e),g=fb(b,c);if(d){L(d,f,false)}if(g>0||g==0&&f.clearWhenEmpty!==false){return f}if(f.replacedWith){f.collapsed=true;f.widgetNode=D("span",[f.replacedWith],"CodeMirror-widget");if(!d.handleMouseEvents){f.widgetNode.setAttribute("cm-ignore-events","true")}if(d.insertLeft){f.widgetNode.insertLeft=true}}if(f.collapsed){if(Yb(a,b.line,b,c,f)||b.line!=c.line&&Yb(a,c.line,b,c,f)){throw new Error("Inserting collapsed marker partially overlapping an existing one")}Fb()}if(f.addToHistory){yf(a,{from:b,to:c,origin:"markText"},a.sel,NaN)}var h=b.line,i=a.cm,j;a.iter(h,c.line+1,function(a){if(i&&f.collapsed&&!i.options.lineWrapping&&Zb(a)==i.display.maxLine){j=true}if(f.collapsed&&h!=b.line){_a(a,0)}Jb(a,new Gb(f,h==b.line?b.ch:null,h==c.line?c.ch:null));++h});if(f.collapsed){a.iter(b.line,c.line+1,function(b){if(cc(a,b)){_a(b,0)}})}if(f.clearOnEnter){oa(f,"beforeCursorEnter",function(){return f.clear()})}if(f.readOnly){Eb();if(a.history.done.length||a.history.undone.length){a.clearHistory()}}if(f.collapsed){f.id=++mg;f.atomic=true}if(i){if(j){i.curOp.updateMaxLine=true}if(f.collapsed){Jd(i,b.line,c.line+1)}else if(f.className||f.startStyle||f.endStyle||f.css||f.attributes||f.title){for(var k=b.line;k<=c.line;k++){Kd(i,k,"text")}}if(f.atomic){Rf(i.doc)}Bc(i,"markerAdded",i,f)}return f}var pg=function(a,b){this.markers=a;this.primary=b;for(var c=0;c<a.length;++c){a[c].parent=this}};pg.prototype.clear=function(){if(this.explicitlyCleared){return}this.explicitlyCleared=true;for(var a=0;a<this.markers.length;++a){this.markers[a].clear()}Bc(this,"clear")};pg.prototype.find=function(a,b){return this.primary.find(a,b)};va(pg);function qg(a,b,c,d,e){d=L(d);d.shared=false;var f=[og(a,b,c,d,e)],g=f[0];var h=d.widgetNode;qf(a,function(a){if(h){d.widgetNode=h.cloneNode(true)}f.push(og(a,lb(a,b),lb(a,c),d,e));for(var i=0;i<a.linked.length;++i){if(a.linked[i].isParent){return}}g=X(f)});return new pg(f,g)}function rg(a){return a.findMarks(eb(a.first,0),a.clipPos(eb(a.lastLine())),function(a){return a.parent})}function sg(a,b){for(var c=0;c<b.length;c++){var d=b[c],e=d.find();var f=a.clipPos(e.from),g=a.clipPos(e.to);if(fb(f,g)){var h=og(a,f,g,d.primary,d.primary.type);d.markers.push(h);h.parent=d}}}function tg(a){var b=function(b){var c=a[b],d=[c.primary.doc];qf(c.primary.doc,function(a){return d.push(a)});for(var e=0;e<c.markers.length;e++){var f=c.markers[e];if(O(d,f.doc)==-1){f.parent=null;c.markers.splice(e--,1)}}};for(var c=0;c<a.length;c++)b(c)}var ug=0;var vg=function(a,b,c,d,e){if(!(this instanceof vg)){return new vg(a,b,c,d,e)}if(c==null){c=0}ig.call(this,[new hg([new hc("",null)])]);this.first=c;this.scrollTop=this.scrollLeft=0;this.cantEdit=false;this.cleanGeneration=1;this.modeFrontier=this.highlightFrontier=c;var f=eb(c,0);this.sel=ff(f);this.history=new uf(null);this.id=++ug;this.modeOption=b;this.lineSep=d;this.direction=e=="rtl"?"rtl":"ltr";this.extend=false;if(typeof a=="string"){a=this.splitLines(a)}pf(this,{from:f,to:f,text:a});Of(this,ff(f),R)};vg.prototype=_(ig.prototype,{constructor:vg,iter:function(a,b,c){if(c){this.iterN(a-this.first,b-a,c)}else{this.iterN(this.first,this.first+this.size,a)}},insert:function(a,b){var c=0;for(var d=0;d<b.length;++d){c+=b[d].height}this.insertInner(a-this.first,b,c)},remove:function(a,b){this.removeInner(a-this.first,b)},getValue:function(a){var b=$a(this,this.first,this.first+this.size);if(a===false){return b}return b.join(a||this.lineSeparator())},setValue:Ge(function(a){var b=eb(this.first,0),c=this.first+this.size-1;Yf(this,{from:b,to:eb(c,Ya(this,c).text.length),text:this.splitLines(a),origin:"setValue",full:true},true);if(this.cm){ge(this.cm,0,0)}Of(this,ff(b),R)}),replaceRange:function(a,b,c,d){b=lb(this,b);c=c?lb(this,c):b;cg(this,a,b,c,d)},getRange:function(a,b,c){var d=Za(this,lb(this,a),lb(this,b));if(c===false){return d}return d.join(c||this.lineSeparator())},getLine:function(a){var b=this.getLineHandle(a);return b&&b.text},getLineHandle:function(a){if(cb(this,a)){return Ya(this,a)}},getLineNumber:function(a){return ab(a)},getLineHandleVisualStart:function(a){if(typeof a=="number"){a=Ya(this,a)}return Zb(a)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(a){return lb(this,a)},getCursor:function(a){var b=this.sel.primary(),c;if(a==null||a=="head"){c=b.head}else if(a=="anchor"){c=b.anchor}else if(a=="end"||a=="to"||a===false){c=b.to()}else{c=b.from()}return c},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Ge(function(a,b,c){Lf(this,lb(this,typeof a=="number"?eb(a,b||0):a),null,c)}),setSelection:Ge(function(a,b,c){Lf(this,lb(this,a),lb(this,b||a),c)}),extendSelection:Ge(function(a,b,c){If(this,lb(this,a),b&&lb(this,b),c)}),extendSelections:Ge(function(a,b){Jf(this,nb(this,a),b)}),extendSelectionsBy:Ge(function(a,b){var c=Y(this.sel.ranges,a);Jf(this,nb(this,c),b)}),setSelections:Ge(function(a,b,c){if(!a.length){return}var d=[];for(var e=0;e<a.length;e++){d[e]=new df(lb(this,a[e].anchor),lb(this,a[e].head))}if(b==null){b=Math.min(a.length-1,this.sel.primIndex)}Of(this,ef(this.cm,d,b),c)}),addSelection:Ge(function(a,b,c){var d=this.sel.ranges.slice(0);d.push(new df(lb(this,a),lb(this,b||a)));Of(this,ef(this.cm,d,d.length-1),c)}),getSelection:function(a){var b=this.sel.ranges,c;for(var d=0;d<b.length;d++){var e=Za(this,b[d].from(),b[d].to());c=c?c.concat(e):e}if(a===false){return c}else{return c.join(a||this.lineSeparator())}},getSelections:function(a){var b=[],c=this.sel.ranges;for(var d=0;d<c.length;d++){var e=Za(this,c[d].from(),c[d].to());if(a!==false){e=e.join(a||this.lineSeparator())}b[d]=e}return b},replaceSelection:function(a,b,c){var d=[];for(var e=0;e<this.sel.ranges.length;e++){d[e]=a}this.replaceSelections(d,b,c||"+input")},replaceSelections:Ge(function(a,b,c){var d=[],e=this.sel;for(var f=0;f<e.ranges.length;f++){var g=e.ranges[f];d[f]={from:g.from(),to:g.to(),text:this.splitLines(a[f]),origin:c}}var h=b&&b!="end"&&lf(this,d,b);for(var i=d.length-1;i>=0;i--){Yf(this,d[i])}if(h){Nf(this,h)}else if(this.cm){fe(this.cm)}}),undo:Ge(function(){$f(this,"undo")}),redo:Ge(function(){$f(this,"redo")}),undoSelection:Ge(function(){$f(this,"undo",true)}),redoSelection:Ge(function(){$f(this,"redo",true)}),setExtending:function(a){this.extend=a},getExtending:function(){return this.extend},historySize:function(){var a=this.history,b=0,c=0;for(var d=0;d<a.done.length;d++){if(!a.done[d].ranges){++b}}for(var e=0;e<a.undone.length;e++){if(!a.undone[e].ranges){++c}}return{undo:b,redo:c}},clearHistory:function(){var a=this;this.history=new uf(this.history.maxGeneration);qf(this,function(b){return b.history=a.history},true)},markClean:function(){this.cleanGeneration=this.changeGeneration(true)},changeGeneration:function(a){if(a){this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null}return this.history.generation},isClean:function(a){return this.history.generation==(a||this.cleanGeneration)},getHistory:function(){return{done:Gf(this.history.done),undone:Gf(this.history.undone)}},setHistory:function(a){var b=this.history=new uf(this.history.maxGeneration);b.done=Gf(a.done.slice(0),null,true);b.undone=Gf(a.undone.slice(0),null,true)},setGutterMarker:Ge(function(a,b,c){return gg(this,a,"gutter",function(a){var d=a.gutterMarkers||(a.gutterMarkers={});d[b]=c;if(!c&&da(d)){a.gutterMarkers=null}return true})}),clearGutter:Ge(function(a){var b=this;this.iter(function(c){if(c.gutterMarkers&&c.gutterMarkers[a]){gg(b,c,"gutter",function(){c.gutterMarkers[a]=null;if(da(c.gutterMarkers)){c.gutterMarkers=null}return true})}})}),lineInfo:function(a){var b;if(typeof a=="number"){if(!cb(this,a)){return null}b=a;a=Ya(this,a);if(!a){return null}}else{b=ab(a);if(b==null){return null}}return{line:b,handle:a,text:a.text,gutterMarkers:a.gutterMarkers,textClass:a.textClass,bgClass:a.bgClass,wrapClass:a.wrapClass,widgets:a.widgets}},addLineClass:Ge(function(a,b,c){return gg(this,a,b=="gutter"?"gutter":"class",function(a){var d=b=="text"?"textClass":b=="background"?"bgClass":b=="gutter"?"gutterClass":"wrapClass";if(!a[d]){a[d]=c}else if(y(c).test(a[d])){return false}else{a[d]+=" "+c}return true})}),removeLineClass:Ge(function(a,b,c){return gg(this,a,b=="gutter"?"gutter":"class",function(a){var d=b=="text"?"textClass":b=="background"?"bgClass":b=="gutter"?"gutterClass":"wrapClass";var e=a[d];if(!e){return false}else if(c==null){a[d]=null}else{var f=e.match(y(c));if(!f){return false}var g=f.index+f[0].length;a[d]=e.slice(0,f.index)+(!f.index||g==e.length?"":" ")+e.slice(g)||null}return true})}),addLineWidget:Ge(function(a,b,c){return lg(this,a,b,c)}),removeLineWidget:function(a){a.clear()},markText:function(a,b,c){return og(this,lb(this,a),lb(this,b),c,c&&c.type||"range")},setBookmark:function(a,b){var c={replacedWith:b&&(b.nodeType==null?b.widget:b),insertLeft:b&&b.insertLeft,clearWhenEmpty:false,shared:b&&b.shared,handleMouseEvents:b&&b.handleMouseEvents};a=lb(this,a);return og(this,a,a,c,"bookmark")},findMarksAt:function(a){a=lb(this,a);var b=[],c=Ya(this,a.line).markedSpans;if(c){for(var d=0;d<c.length;++d){var e=c[d];if((e.from==null||e.from<=a.ch)&&(e.to==null||e.to>=a.ch)){b.push(e.marker.parent||e.marker)}}}return b},findMarks:function(a,b,c){a=lb(this,a);b=lb(this,b);var d=[],e=a.line;this.iter(a.line,b.line+1,function(f){var g=f.markedSpans;if(g){for(var h=0;h<g.length;h++){var i=g[h];if(!(i.to!=null&&e==a.line&&a.ch>=i.to||i.from==null&&e!=a.line||i.from!=null&&e==b.line&&i.from>=b.ch)&&(!c||c(i.marker))){d.push(i.marker.parent||i.marker)}}}++e});return d},getAllMarks:function(){var a=[];this.iter(function(b){var c=b.markedSpans;if(c){for(var d=0;d<c.length;++d){if(c[d].from!=null){a.push(c[d].marker)}}}});return a},posFromIndex:function(a){var b,c=this.first,d=this.lineSeparator().length;this.iter(function(e){var f=e.text.length+d;if(f>a){b=a;return true}a-=f;++c});return lb(this,eb(c,b))},indexFromPos:function(a){a=lb(this,a);var b=a.ch;if(a.line<this.first||a.ch<0){return 0}var c=this.lineSeparator().length;this.iter(this.first,a.line,function(a){b+=a.text.length+c});return b},copy:function(a){var b=new vg($a(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);b.scrollTop=this.scrollTop;b.scrollLeft=this.scrollLeft;b.sel=this.sel;b.extend=false;if(a){b.history.undoDepth=this.history.undoDepth;b.setHistory(this.getHistory())}return b},linkedDoc:function(a){if(!a){a={}}var b=this.first,c=this.first+this.size;if(a.from!=null&&a.from>b){b=a.from}if(a.to!=null&&a.to<c){c=a.to}var d=new vg($a(this,b,c),a.mode||this.modeOption,b,this.lineSep,this.direction);if(a.sharedHist){d.history=this.history}(this.linked||(this.linked=[])).push({doc:d,sharedHist:a.sharedHist});d.linked=[{doc:this,isParent:true,sharedHist:a.sharedHist}];sg(d,rg(this));return d},unlinkDoc:function(a){if(a instanceof Jh){a=a.doc}if(this.linked){for(var b=0;b<this.linked.length;++b){var c=this.linked[b];if(c.doc!=a){continue}this.linked.splice(b,1);a.unlinkDoc(this);tg(rg(this));break}}if(a.history==this.history){var d=[a.id];qf(a,function(a){return d.push(a.id)},true);a.history=new uf(null);a.history.done=Gf(this.history.done,d);a.history.undone=Gf(this.history.undone,d)}},iterLinkedDocs:function(a){qf(this,a)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(a){if(this.lineSep){return a.split(this.lineSep)}return Ha(a)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:Ge(function(a){if(a!="rtl"){a="ltr"}if(a==this.direction){return}this.direction=a;this.iter(function(a){return a.order=null});if(this.cm){tf(this.cm)}})});vg.prototype.eachLine=vg.prototype.iter;var wg=0;function xg(a){var b=this;Ag(b);if(sa(b,a)||Qc(b.display,a)){return}wa(a);if(g){wg=+new Date}var c=Hd(b,a,true),d=a.dataTransfer.files;if(!c||b.isReadOnly()){return}if(d&&d.length&&window.FileReader&&window.File){var e=d.length,f=Array(e),h=0;var i=function(){if(++h==e){Ee(b,function(){c=lb(b.doc,c);var a={from:c,to:c,text:b.doc.splitLines(f.filter(function(a){return a!=null}).join(b.doc.lineSeparator())),origin:"paste"};Yf(b.doc,a);Nf(b.doc,ff(lb(b.doc,c),lb(b.doc,gf(a))))})()}};var j=function(a,c){if(b.options.allowDropFileTypes&&O(b.options.allowDropFileTypes,a.type)==-1){i();return}var d=new FileReader;d.onerror=function(){return i()};d.onload=function(){var a=d.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(a)){i();return}f[c]=a;i()};d.readAsText(a)};for(var k=0;k<d.length;k++){j(d[k],k)}}else{if(b.state.draggingText&&b.doc.sel.contains(c)>-1){b.state.draggingText(a);setTimeout(function(){return b.display.input.focus()},20);return}try{var l=a.dataTransfer.getData("Text");if(l){var m;if(b.state.draggingText&&!b.state.draggingText.copy){m=b.listSelections()}Pf(b.doc,ff(c,c));if(m){for(var n=0;n<m.length;++n){cg(b.doc,"",m[n].anchor,m[n].head,"drag")}}b.replaceSelection(l,"around","paste");b.display.input.focus()}}catch(o){}}}function yg(a,b){if(g&&(!a.state.draggingText||+new Date-wg<100)){za(b);return}if(sa(a,b)||Qc(a.display,b)){return}b.dataTransfer.setData("Text",a.getSelection());b.dataTransfer.effectAllowed="copyMove";if(b.dataTransfer.setDragImage&&!m){var c=C("img",null,null,"position: fixed; left: 0; top: 0;");c.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";if(l){c.width=c.height=1;a.display.wrapper.appendChild(c);c._top=c.offsetTop}b.dataTransfer.setDragImage(c,0,0);if(l){c.parentNode.removeChild(c)}}}function zg(a,b){var c=Hd(a,b);if(!c){return}var d=document.createDocumentFragment();Rd(a,c,d);if(!a.display.dragCursor){a.display.dragCursor=C("div",null,"CodeMirror-cursors CodeMirror-dragcursors");a.display.lineSpace.insertBefore(a.display.dragCursor,a.display.cursorDiv)}B(a.display.dragCursor,d)}function Ag(a){if(a.display.dragCursor){a.display.lineSpace.removeChild(a.display.dragCursor);a.display.dragCursor=null}}function Bg(a){if(!document.getElementsByClassName){return}var b=document.getElementsByClassName("CodeMirror"),c=[];for(var d=0;d<b.length;d++){var e=b[d].CodeMirror;if(e){c.push(e)}}if(c.length){c[0].operation(function(){for(var b=0;b<c.length;b++){a(c[b])}})}}var Cg=false;function Dg(){if(Cg){return}Eg();Cg=true}function Eg(){var a;oa(window,"resize",function(){if(a==null){a=setTimeout(function(){a=null;Bg(Fg)},100)}});oa(window,"blur",function(){return Bg(Yd)})}function Fg(a){var b=a.display;b.cachedCharWidth=b.cachedTextHeight=b.cachedPaddingH=null;b.scrollbarsClipped=false;a.setSize()}var Gg={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"};for(var Hg=0;Hg<10;Hg++){Gg[Hg+48]=Gg[Hg+96]=String(Hg)}for(var Ig=65;Ig<=90;Ig++){Gg[Ig]=String.fromCharCode(Ig)}for(var Jg=1;Jg<=12;Jg++){Gg[Jg+111]=Gg[Jg+63235]="F"+Jg}var Kg={};Kg.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"};Kg.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"};Kg.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"};Kg.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]};Kg["default"]=s?Kg.macDefault:Kg.pcDefault;function Lg(a){var b=a.split(/-(?!$)/);a=b[b.length-1];var c,d,e,f;for(var g=0;g<b.length-1;g++){var h=b[g];if(/^(cmd|meta|m)$/i.test(h)){f=true}else if(/^a(lt)?$/i.test(h)){c=true}else if(/^(c|ctrl|control)$/i.test(h)){d=true}else if(/^s(hift)?$/i.test(h)){e=true}else{throw new Error("Unrecognized modifier name: "+h)}}if(c){a="Alt-"+a}if(d){a="Ctrl-"+a}if(f){a="Cmd-"+a}if(e){a="Shift-"+a}return a}function Mg(a){var b={};for(var c in a){if(a.hasOwnProperty(c)){var d=a[c];if(/^(name|fallthrough|(de|at)tach)$/.test(c)){continue}if(d=="..."){delete a[c];continue}var e=Y(c.split(" "),Lg);for(var f=0;f<e.length;f++){var g=void 0,h=void 0;if(f==e.length-1){h=e.join(" ");g=d}else{h=e.slice(0,f+1).join(" ");g="..."}var i=b[h];if(!i){b[h]=g}else if(i!=g){throw new Error("Inconsistent bindings for "+h)}}delete a[c]}}for(var j in b){a[j]=b[j]}return a}function Ng(a,b,c,d){b=Rg(b);var e=b.call?b.call(a,d):b[a];if(e===false){return"nothing"}if(e==="..."){return"multi"}if(e!=null&&c(e)){return"handled"}if(b.fallthrough){if(Object.prototype.toString.call(b.fallthrough)!="[object Array]"){return Ng(a,b.fallthrough,c,d)}for(var f=0;f<b.fallthrough.length;f++){var g=Ng(a,b.fallthrough[f],c,d);if(g){return g}}}}function Og(a){var b=typeof a=="string"?a:Gg[a.keyCode];return b=="Ctrl"||b=="Alt"||b=="Shift"||b=="Mod"}function Pg(a,b,c){var d=a;if(b.altKey&&d!="Alt"){a="Alt-"+a}if((w?b.metaKey:b.ctrlKey)&&d!="Ctrl"){a="Ctrl-"+a}if((w?b.ctrlKey:b.metaKey)&&d!="Mod"){a="Cmd-"+a}if(!c&&b.shiftKey&&d!="Shift"){a="Shift-"+a}return a}function Qg(a,b){if(l&&a.keyCode==34&&a["char"]){return false}var c=Gg[a.keyCode];if(c==null||a.altGraphKey){return false}if(a.keyCode==3&&a.code){c=a.code}return Pg(c,a,b)}function Rg(a){return typeof a=="string"?Kg[a]:a}function Sg(a,b){var c=a.doc.sel.ranges,d=[];for(var e=0;e<c.length;e++){var f=b(c[e]);while(d.length&&fb(f.from,X(d).to)<=0){var g=d.pop();if(fb(g.from,f.from)<0){f.from=g.from;break}}d.push(f)}De(a,function(){for(var b=d.length-1;b>=0;b--){cg(a.doc,"",d[b].from,d[b].to,"+delete")}fe(a)})}function Tg(a,b,c){var d=ga(a.text,b+c,c);return d<0||d>a.text.length?null:d}function Ug(a,b,c){var d=Tg(a,b.ch,c);return d==null?null:new eb(b.line,d,c<0?"after":"before")}function Vg(a,b,c,d,e){if(a){if(b.doc.direction=="rtl"){e=-e}var f=ma(c,b.doc.direction);if(f){var g=e<0?X(f):f[0];var h=e<0==(g.level==1);var i=h?"after":"before";var j;if(g.level>0||b.doc.direction=="rtl"){var k=ad(b,c);j=e<0?c.text.length-1:0;var l=bd(b,k,j).top;j=ha(function(a){return bd(b,k,a).top==l},e<0==(g.level==1)?g.from:g.to-1,j);if(i=="before"){j=Tg(c,j,1)}}else{j=e<0?g.to:g.from}return new eb(d,j,i)}}return new eb(d,e<0?c.text.length:0,e<0?"before":"after")}function Wg(a,b,c,d){var e=ma(b,a.doc.direction);if(!e){return Ug(b,c,d)}if(c.ch>=b.text.length){c.ch=b.text.length;c.sticky="before"}else if(c.ch<=0){c.ch=0;c.sticky="after"}var f=ka(e,c.ch,c.sticky),g=e[f];if(a.doc.direction=="ltr"&&g.level%2==0&&(d>0?g.to>c.ch:g.from<c.ch)){return Ug(b,c,d)}var h=function(a,c){return Tg(b,a instanceof eb?a.ch:a,c)};var i;var j=function(c){if(!a.options.lineWrapping){return{begin:0,end:b.text.length}}i=i||ad(a,b);return vd(a,b,i,c)};var k=j(c.sticky=="before"?h(c,-1):c.ch);if(a.doc.direction=="rtl"||g.level==1){var l=g.level==1==d<0;var m=h(c,l?1:-1);if(m!=null&&(!l?m>=g.from&&m>=k.begin:m<=g.to&&m<=k.end)){var n=l?"before":"after";return new eb(c.line,m,n)}}var o=function(a,b,d){var f=function(a,b){return b?new eb(c.line,h(a,1),"before"):new eb(c.line,a,"after")};for(;a>=0&&a<e.length;a+=b){var g=e[a];var i=b>0==(g.level!=1);var j=i?d.begin:h(d.end,-1);if(g.from<=j&&j<g.to){return f(j,i)}j=i?g.from:h(g.to,-1);if(d.begin<=j&&j<d.end){return f(j,i)}}};var p=o(f+d,d,k);if(p){return p}var q=d>0?k.end:h(k.begin,-1);if(q!=null&&!(d>0&&q==b.text.length)){p=o(d>0?0:e.length-1,d,j(q));if(p){return p}}return null}var Xg={selectAll:Wf,singleSelection:function(a){return a.setSelection(a.getCursor("anchor"),a.getCursor("head"),R)},killLine:function(a){return Sg(a,function(b){if(b.empty()){var c=Ya(a.doc,b.head.line).text.length;if(b.head.ch==c&&b.head.line<a.lastLine()){return{from:b.head,to:eb(b.head.line+1,0)}}else{return{from:b.head,to:eb(b.head.line,c)}}}else{return{from:b.from(),to:b.to()}}})},deleteLine:function(a){return Sg(a,function(b){return{from:eb(b.from().line,0),to:lb(a.doc,eb(b.to().line+1,0))}})},delLineLeft:function(a){return Sg(a,function(a){return{from:eb(a.from().line,0),to:a.from()}})},delWrappedLineLeft:function(a){return Sg(a,function(b){var c=a.charCoords(b.head,"div").top+5;var d=a.coordsChar({left:0,top:c},"div");return{from:d,to:b.from()}})},delWrappedLineRight:function(a){return Sg(a,function(b){var c=a.charCoords(b.head,"div").top+5;var d=a.coordsChar({left:a.display.lineDiv.offsetWidth+100,top:c},"div");return{from:b.from(),to:d}})},undo:function(a){return a.undo()},redo:function(a){return a.redo()},undoSelection:function(a){return a.undoSelection()},redoSelection:function(a){return a.redoSelection()},goDocStart:function(a){return a.extendSelection(eb(a.firstLine(),0))},goDocEnd:function(a){return a.extendSelection(eb(a.lastLine()))},goLineStart:function(a){return a.extendSelectionsBy(function(b){return Yg(a,b.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(a){return a.extendSelectionsBy(function(b){return $g(a,b.head)},{origin:"+move",bias:1})},goLineEnd:function(a){return a.extendSelectionsBy(function(b){return Zg(a,b.head.line)},{origin:"+move",bias:-1})},goLineRight:function(a){return a.extendSelectionsBy(function(b){var c=a.cursorCoords(b.head,"div").top+5;return a.coordsChar({left:a.display.lineDiv.offsetWidth+100,top:c},"div")},T)},goLineLeft:function(a){return a.extendSelectionsBy(function(b){var c=a.cursorCoords(b.head,"div").top+5;return a.coordsChar({left:0,top:c},"div")},T)},goLineLeftSmart:function(a){return a.extendSelectionsBy(function(b){var c=a.cursorCoords(b.head,"div").top+5;var d=a.coordsChar({left:0,top:c},"div");if(d.ch<a.getLine(d.line).search(/\S/)){return $g(a,b.head)}return d},T)},goLineUp:function(a){return a.moveV(-1,"line")},goLineDown:function(a){return a.moveV(1,"line")},goPageUp:function(a){return a.moveV(-1,"page")},goPageDown:function(a){return a.moveV(1,"page")},goCharLeft:function(a){return a.moveH(-1,"char")},goCharRight:function(a){return a.moveH(1,"char")},goColumnLeft:function(a){return a.moveH(-1,"column")},goColumnRight:function(a){return a.moveH(1,"column")},goWordLeft:function(a){return a.moveH(-1,"word")},goGroupRight:function(a){return a.moveH(1,"group")},goGroupLeft:function(a){return a.moveH(-1,"group")},goWordRight:function(a){return a.moveH(1,"word")},delCharBefore:function(a){return a.deleteH(-1,"char")},delCharAfter:function(a){return a.deleteH(1,"char")},delWordBefore:function(a){return a.deleteH(-1,"word")},delWordAfter:function(a){return a.deleteH(1,"word")},delGroupBefore:function(a){return a.deleteH(-1,"group")},delGroupAfter:function(a){return a.deleteH(1,"group")},indentAuto:function(a){return a.indentSelection("smart")},indentMore:function(a){return a.indentSelection("add")},indentLess:function(a){return a.indentSelection("subtract")},insertTab:function(a){return a.replaceSelection("\t")},insertSoftTab:function(a){var b=[],c=a.listSelections(),d=a.options.tabSize;for(var e=0;e<c.length;e++){var f=c[e].from();var g=M(a.getLine(f.line),f.ch,d);b.push(W(d-g%d))}a.replaceSelections(b)},defaultTab:function(a){if(a.somethingSelected()){a.indentSelection("add")}else{a.execCommand("insertTab")}},transposeChars:function(a){return De(a,function(){var b=a.listSelections(),c=[];for(var d=0;d<b.length;d++){if(!b[d].empty()){continue}var e=b[d].head,f=Ya(a.doc,e.line).text;if(f){if(e.ch==f.length){e=new eb(e.line,e.ch-1)}if(e.ch>0){e=new eb(e.line,e.ch+1);a.replaceRange(f.charAt(e.ch-1)+f.charAt(e.ch-2),eb(e.line,e.ch-2),e,"+transpose")}else if(e.line>a.doc.first){var g=Ya(a.doc,e.line-1).text;if(g){e=new eb(e.line,1);a.replaceRange(f.charAt(0)+a.doc.lineSeparator()+g.charAt(g.length-1),eb(e.line-1,g.length-1),e,"+transpose")}}}c.push(new df(e,e))}a.setSelections(c)})},newlineAndIndent:function(a){return De(a,function(){var b=a.listSelections();for(var c=b.length-1;c>=0;c--){a.replaceRange(a.doc.lineSeparator(),b[c].anchor,b[c].head,"+input")}b=a.listSelections();for(var d=0;d<b.length;d++){a.indentLine(b[d].from().line,null,true)}fe(a)})},openLine:function(a){return a.replaceSelection("\n","start")}, 5toggleOverwrite:function(a){return a.toggleOverwrite()}};function Yg(a,b){var c=Ya(a.doc,b);var d=Zb(c);if(d!=c){b=ab(d)}return Vg(true,a,d,b,1)}function Zg(a,b){var c=Ya(a.doc,b);var d=$b(c);if(d!=c){b=ab(d)}return Vg(true,a,c,b,-1)}function $g(a,b){var c=Yg(a,b.line);var d=Ya(a.doc,c.line);var e=ma(d,a.doc.direction);if(!e||e[0].level==0){var f=Math.max(c.ch,d.text.search(/\S/));var g=b.line==c.line&&b.ch<=f&&b.ch;return eb(c.line,g?0:f,c.sticky)}return c}function _g(a,b,c){if(typeof b=="string"){b=Xg[b];if(!b){return false}}a.display.input.ensurePolled();var d=a.display.shift,e=false;try{if(a.isReadOnly()){a.state.suppressEdits=true}if(c){a.display.shift=false}e=b(a)!=Q}finally{a.display.shift=d;a.state.suppressEdits=false}return e}function ah(a,b,c){for(var d=0;d<a.state.keyMaps.length;d++){var e=Ng(b,a.state.keyMaps[d],c,a);if(e){return e}}return a.options.extraKeys&&Ng(b,a.options.extraKeys,c,a)||Ng(b,a.options.keyMap,c,a)}var bh=new N;function ch(a,b,c,d){var e=a.state.keySeq;if(e){if(Og(b)){return"handled"}if(/\'$/.test(b)){a.state.keySeq=null}else{bh.set(50,function(){if(a.state.keySeq==e){a.state.keySeq=null;a.display.input.reset()}})}if(dh(a,e+" "+b,c,d)){return true}}return dh(a,b,c,d)}function dh(a,b,c,d){var e=ah(a,b,d);if(e=="multi"){a.state.keySeq=b}if(e=="handled"){Bc(a,"keyHandled",a,b,c)}if(e=="handled"||e=="multi"){wa(c);Ud(a)}return!!e}function eh(a,b){var c=Qg(b,true);if(!c){return false}if(b.shiftKey&&!a.state.keySeq){return ch(a,"Shift-"+c,b,function(b){return _g(a,b,true)})||ch(a,c,b,function(b){if(typeof b=="string"?/^go[A-Z]/.test(b):b.motion){return _g(a,b)}})}else{return ch(a,c,b,function(b){return _g(a,b)})}}function fh(a,b,c){return ch(a,"'"+c+"'",b,function(b){return _g(a,b,true)})}var gh=null;function hh(a){var b=this;if(a.target&&a.target!=b.display.input.getField()){return}b.curOp.focus=G();if(sa(b,a)){return}if(g&&h<11&&a.keyCode==27){a.returnValue=false}var d=a.keyCode;b.display.shift=d==16||a.shiftKey;var e=eh(b,a);if(l){gh=e?d:null;if(!e&&d==88&&!Ja&&(s?a.metaKey:a.ctrlKey)){b.replaceSelection("",null,"cut")}}if(c&&!s&&!e&&d==46&&a.shiftKey&&!a.ctrlKey&&document.execCommand){document.execCommand("cut")}if(d==18&&!/\bCodeMirror-crosshair\b/.test(b.display.lineDiv.className)){ih(b)}}function ih(a){var b=a.display.lineDiv;H(b,"CodeMirror-crosshair");function c(a){if(a.keyCode==18||!a.altKey){z(b,"CodeMirror-crosshair");qa(document,"keyup",c);qa(document,"mouseover",c)}}oa(document,"keyup",c);oa(document,"mouseover",c)}function jh(a){if(a.keyCode==16){this.doc.sel.shift=false}sa(this,a)}function kh(a){var b=this;if(a.target&&a.target!=b.display.input.getField()){return}if(Qc(b.display,a)||sa(b,a)||a.ctrlKey&&!a.altKey||s&&a.metaKey){return}var c=a.keyCode,d=a.charCode;if(l&&c==gh){gh=null;wa(a);return}if(l&&(!a.which||a.which<10)&&eh(b,a)){return}var e=String.fromCharCode(d==null?c:d);if(e=="\b"){return}if(fh(b,a,e)){return}b.display.input.onKeyPress(a)}var lh=400;var mh=function(a,b,c){this.time=a;this.pos=b;this.button=c};mh.prototype.compare=function(a,b,c){return this.time+lh>a&&fb(b,this.pos)==0&&c==this.button};var nh,oh;function ph(a,b){var c=+new Date;if(oh&&oh.compare(c,a,b)){nh=oh=null;return"triple"}else if(nh&&nh.compare(c,a,b)){oh=new mh(c,a,b);nh=null;return"double"}else{nh=new mh(c,a,b);oh=null;return"single"}}function qh(a){var b=this,c=b.display;if(sa(b,a)||c.activeTouch&&c.input.supportsTouch()){return}c.input.ensurePolled();c.shift=a.shiftKey;if(Qc(c,a)){if(!i){c.scroller.draggable=false;setTimeout(function(){return c.scroller.draggable=true},100)}return}if(zh(b,a)){return}var d=Hd(b,a),e=Ba(a),f=d?ph(d,e):"single";window.focus();if(e==1&&b.state.selectingText){b.state.selectingText(a)}if(d&&rh(b,e,d,f,a)){return}if(e==1){if(d){th(b,d,f,a)}else if(Aa(a)==c.scroller){wa(a)}}else if(e==2){if(d){If(b.doc,d)}setTimeout(function(){return c.input.focus()},20)}else if(e==3){if(x){b.display.input.onContextMenu(a)}else{Wd(b)}}}function rh(a,b,c,d,e){var f="Click";if(d=="double"){f="Double"+f}else if(d=="triple"){f="Triple"+f}f=(b==1?"Left":b==2?"Middle":"Right")+f;return ch(a,Pg(f,e),e,function(b){if(typeof b=="string"){b=Xg[b]}if(!b){return false}var d=false;try{if(a.isReadOnly()){a.state.suppressEdits=true}d=b(a,c)!=Q}finally{a.state.suppressEdits=false}return d})}function sh(a,b,c){var d=a.getOption("configureMouse");var e=d?d(a,b,c):{};if(e.unit==null){var f=t?c.shiftKey&&c.metaKey:c.altKey;e.unit=f?"rectangle":b=="single"?"char":b=="double"?"word":"line"}if(e.extend==null||a.doc.extend){e.extend=a.doc.extend||c.shiftKey}if(e.addNew==null){e.addNew=s?c.metaKey:c.ctrlKey}if(e.moveOnDrag==null){e.moveOnDrag=!(s?c.altKey:c.ctrlKey)}return e}function th(a,b,c,d){if(g){setTimeout(K(Vd,a),0)}else{a.curOp.focus=G()}var e=sh(a,c,d);var f=a.doc.sel,h;if(a.options.dragDrop&&Ca&&!a.isReadOnly()&&c=="single"&&(h=f.contains(b))>-1&&(fb((h=f.ranges[h]).from(),b)<0||b.xRel>0)&&(fb(h.to(),b)>0||b.xRel<0)){uh(a,d,b,e)}else{wh(a,d,b,e)}}function uh(a,b,c,d){var e=a.display,f=false;var j=Ee(a,function(b){if(i){e.scroller.draggable=false}a.state.draggingText=false;qa(e.wrapper.ownerDocument,"mouseup",j);qa(e.wrapper.ownerDocument,"mousemove",k);qa(e.scroller,"dragstart",l);qa(e.scroller,"drop",j);if(!f){wa(b);if(!d.addNew){If(a.doc,c,null,null,d.extend)}if(i&&!m||g&&h==9){setTimeout(function(){e.wrapper.ownerDocument.body.focus({preventScroll:true});e.input.focus()},20)}else{e.input.focus()}}});var k=function(a){f=f||Math.abs(b.clientX-a.clientX)+Math.abs(b.clientY-a.clientY)>=10};var l=function(){return f=true};if(i){e.scroller.draggable=true}a.state.draggingText=j;j.copy=!d.moveOnDrag;if(e.scroller.dragDrop){e.scroller.dragDrop()}oa(e.wrapper.ownerDocument,"mouseup",j);oa(e.wrapper.ownerDocument,"mousemove",k);oa(e.scroller,"dragstart",l);oa(e.scroller,"drop",j);Wd(a);setTimeout(function(){return e.input.focus()},20)}function vh(a,b,c){if(c=="char"){return new df(b,b)}if(c=="word"){return a.findWordAt(b)}if(c=="line"){return new df(eb(b.line,0),lb(a.doc,eb(b.line+1,0)))}var d=c(a,b);return new df(d.from,d.to)}function wh(a,b,c,d){var e=a.display,f=a.doc;wa(b);var g,h,i=f.sel,j=i.ranges;if(d.addNew&&!d.extend){h=f.sel.contains(c);if(h>-1){g=j[h]}else{g=new df(c,c)}}else{g=f.sel.primary();h=f.sel.primIndex}if(d.unit=="rectangle"){if(!d.addNew){g=new df(c,c)}c=Hd(a,b,true,true);h=-1}else{var k=vh(a,c,d.unit);if(d.extend){g=Hf(g,k.anchor,k.head,d.extend)}else{g=k}}if(!d.addNew){h=0;Of(f,new cf([g],0),S);i=f.sel}else if(h==-1){h=j.length;Of(f,ef(a,j.concat([g]),h),{scroll:false,origin:"*mouse"})}else if(j.length>1&&j[h].empty()&&d.unit=="char"&&!d.extend){Of(f,ef(a,j.slice(0,h).concat(j.slice(h+1)),0),{scroll:false,origin:"*mouse"});i=f.sel}else{Kf(f,h,g,S)}var l=c;function m(b){if(fb(l,b)==0){return}l=b;if(d.unit=="rectangle"){var e=[],j=a.options.tabSize;var k=M(Ya(f,c.line).text,c.ch,j);var m=M(Ya(f,b.line).text,b.ch,j);var n=Math.min(k,m),o=Math.max(k,m);for(var p=Math.min(c.line,b.line),q=Math.min(a.lastLine(),Math.max(c.line,b.line));p<=q;p++){var r=Ya(f,p).text,s=U(r,n,j);if(n==o){e.push(new df(eb(p,s),eb(p,s)))}else if(r.length>s){e.push(new df(eb(p,s),eb(p,U(r,o,j))))}}if(!e.length){e.push(new df(c,c))}Of(f,ef(a,i.ranges.slice(0,h).concat(e),h),{origin:"*mouse",scroll:false});a.scrollIntoView(b)}else{var t=g;var u=vh(a,b,d.unit);var v=t.anchor,w;if(fb(u.anchor,v)>0){w=u.head;v=jb(t.from(),u.anchor)}else{w=u.anchor;v=ib(t.to(),u.head)}var x=i.ranges.slice(0);x[h]=xh(a,new df(lb(f,v),w));Of(f,ef(a,x,h),S)}}var n=e.wrapper.getBoundingClientRect();var o=0;function p(b){var c=++o;var g=Hd(a,b,true,d.unit=="rectangle");if(!g){return}if(fb(g,l)!=0){a.curOp.focus=G();m(g);var h=_d(e,f);if(g.line>=h.to||g.line<h.from){setTimeout(Ee(a,function(){if(o==c){p(b)}}),150)}}else{var i=b.clientY<n.top?-20:b.clientY>n.bottom?20:0;if(i){setTimeout(Ee(a,function(){if(o!=c){return}e.scroller.scrollTop+=i;p(b)}),50)}}}function q(b){a.state.selectingText=false;o=Infinity;if(b){wa(b);e.input.focus()}qa(e.wrapper.ownerDocument,"mousemove",r);qa(e.wrapper.ownerDocument,"mouseup",s);f.history.lastSelOrigin=null}var r=Ee(a,function(a){if(a.buttons===0||!Ba(a)){q(a)}else{p(a)}});var s=Ee(a,q);a.state.selectingText=s;oa(e.wrapper.ownerDocument,"mousemove",r);oa(e.wrapper.ownerDocument,"mouseup",s)}function xh(a,b){var c=b.anchor;var d=b.head;var e=Ya(a.doc,c.line);if(fb(c,d)==0&&c.sticky==d.sticky){return b}var f=ma(e);if(!f){return b}var g=ka(f,c.ch,c.sticky),h=f[g];if(h.from!=c.ch&&h.to!=c.ch){return b}var i=g+(h.from==c.ch==(h.level!=1)?0:1);if(i==0||i==f.length){return b}var j;if(d.line!=c.line){j=(d.line-c.line)*(a.doc.direction=="ltr"?1:-1)>0}else{var k=ka(f,d.ch,d.sticky);var l=k-g||(d.ch-c.ch)*(h.level==1?-1:1);if(k==i-1||k==i){j=l<0}else{j=l>0}}var m=f[i+(j?-1:0)];var n=j==(m.level==1);var o=n?m.from:m.to,p=n?"after":"before";return c.ch==o&&c.sticky==p?b:new df(new eb(c.line,o,p),d)}function yh(a,b,c,d){var e,f;if(b.touches){e=b.touches[0].clientX;f=b.touches[0].clientY}else{try{e=b.clientX;f=b.clientY}catch(m){return false}}if(e>=Math.floor(a.display.gutters.getBoundingClientRect().right)){return false}if(d){wa(b)}var g=a.display;var h=g.lineDiv.getBoundingClientRect();if(f>h.bottom||!ua(a,c)){return ya(b)}f-=h.top-g.viewOffset;for(var i=0;i<a.display.gutterSpecs.length;++i){var j=g.gutters.childNodes[i];if(j&&j.getBoundingClientRect().right>=e){var k=bb(a.doc,f);var l=a.display.gutterSpecs[i];ra(a,c,a,k,l.className,b);return ya(b)}}}function zh(a,b){return yh(a,b,"gutterClick",true)}function Ah(a,b){if(Qc(a.display,b)||Bh(a,b)){return}if(sa(a,b,"contextmenu")){return}if(!x){a.display.input.onContextMenu(b)}}function Bh(a,b){if(!ua(a,"gutterContextMenu")){return false}return yh(a,b,"gutterContextMenu",false)}function Ch(a){a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+a.options.theme.replace(/(^|\s)\s*/g," cm-s-");jd(a)}var Dh={toString:function(){return"CodeMirror.Init"}};var Eh={};var Fh={};function Gh(a){var b=a.optionHandlers;function c(c,d,e,f){a.defaults[c]=d;if(e){b[c]=f?function(a,b,c){if(c!=Dh){e(a,b,c)}}:e}}a.defineOption=c;a.Init=Dh;c("value","",function(a,b){return a.setValue(b)},true);c("mode",null,function(a,b){a.doc.modeOption=b;mf(a)},true);c("indentUnit",2,mf,true);c("indentWithTabs",false);c("smartIndent",true);c("tabSize",4,function(a){nf(a);jd(a);Jd(a)},true);c("lineSeparator",null,function(a,b){a.doc.lineSep=b;if(!b){return}var c=[],d=a.doc.first;a.doc.iter(function(a){for(var e=0;;){var f=a.text.indexOf(b,e);if(f==-1){break}e=f+b.length;c.push(eb(d,f))}d++});for(var e=c.length-1;e>=0;e--){cg(a.doc,b,c[e],eb(c[e].line,c[e].ch+b.length))}});c("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(a,b,c){a.state.specialChars=new RegExp(b.source+(b.test("\t")?"":"|\t"),"g");if(c!=Dh){a.refresh()}});c("specialCharPlaceholder",oc,function(a){return a.refresh()},true);c("electricChars",true);c("inputStyle",r?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},true);c("spellcheck",false,function(a,b){return a.getInputField().spellcheck=b},true);c("autocorrect",false,function(a,b){return a.getInputField().autocorrect=b},true);c("autocapitalize",false,function(a,b){return a.getInputField().autocapitalize=b},true);c("rtlMoveVisually",!u);c("wholeLineUpdateBefore",true);c("theme","default",function(a){Ch(a);Xe(a)},true);c("keyMap","default",function(a,b,c){var d=Rg(b);var e=c!=Dh&&Rg(c);if(e&&e.detach){e.detach(a,d)}if(d.attach){d.attach(a,e||null)}});c("extraKeys",null);c("configureMouse",null);c("lineWrapping",false,Ih,true);c("gutters",[],function(a,b){a.display.gutterSpecs=Ve(b,a.options.lineNumbers);Xe(a)},true);c("fixedGutter",true,function(a,b){a.display.gutters.style.left=b?Ed(a.display)+"px":"0";a.refresh()},true);c("coverGutterNextToScrollbar",false,function(a){return qe(a)},true);c("scrollbarStyle","native",function(a){te(a);qe(a);a.display.scrollbars.setScrollTop(a.doc.scrollTop);a.display.scrollbars.setScrollLeft(a.doc.scrollLeft)},true);c("lineNumbers",false,function(a,b){a.display.gutterSpecs=Ve(a.options.gutters,b);Xe(a)},true);c("firstLineNumber",1,Xe,true);c("lineNumberFormatter",function(a){return a},Xe,true);c("showCursorWhenSelecting",false,Pd,true);c("resetSelectionOnContextMenu",true);c("lineWiseCopyCut",true);c("pasteLinesPerSelection",true);c("selectionsMayTouch",false);c("readOnly",false,function(a,b){if(b=="nocursor"){Yd(a);a.display.input.blur()}a.display.input.readOnlyChanged(b)});c("screenReaderLabel",null,function(a,b){b=b===""?null:b;a.display.input.screenReaderLabelChanged(b)});c("disableInput",false,function(a,b){if(!b){a.display.input.reset()}},true);c("dragDrop",true,Hh);c("allowDropFileTypes",null);c("cursorBlinkRate",530);c("cursorScrollMargin",0);c("cursorHeight",1,Pd,true);c("singleCursorHeightPerLine",true,Pd,true);c("workTime",100);c("workDelay",100);c("flattenSpans",true,nf,true);c("addModeClass",false,nf,true);c("pollInterval",100);c("undoDepth",200,function(a,b){return a.doc.history.undoDepth=b});c("historyEventDelay",1250);c("viewportMargin",10,function(a){return a.refresh()},true);c("maxHighlightLength",1e4,nf,true);c("moveInputWithCursor",true,function(a,b){if(!b){a.display.input.resetPosition()}});c("tabindex",null,function(a,b){return a.display.input.getField().tabIndex=b||""});c("autofocus",null);c("direction","ltr",function(a,b){return a.doc.setDirection(b)},true);c("phrases",null)}function Hh(a,b,c){var d=c&&c!=Dh;if(!b!=!d){var e=a.display.dragFunctions;var f=b?oa:qa;f(a.display.scroller,"dragstart",e.start);f(a.display.scroller,"dragenter",e.enter);f(a.display.scroller,"dragover",e.over);f(a.display.scroller,"dragleave",e.leave);f(a.display.scroller,"drop",e.drop)}}function Ih(a){if(a.options.lineWrapping){H(a.display.wrapper,"CodeMirror-wrap");a.display.sizer.style.minWidth="";a.display.sizerWidth=null}else{z(a.display.wrapper,"CodeMirror-wrap");gc(a)}Gd(a);Jd(a);jd(a);setTimeout(function(){return qe(a)},100)}function Jh(a,b){var c=this;if(!(this instanceof Jh)){return new Jh(a,b)}this.options=b=b?L(b):{};L(Eh,b,false);var d=b.value;if(typeof d=="string"){d=new vg(d,b.mode,null,b.lineSeparator,b.direction)}else if(b.mode){d.modeOption=b.mode}this.doc=d;var e=new Jh.inputStyles[b.inputStyle](this);var f=this.display=new Ye(a,d,e,b);f.wrapper.CodeMirror=this;Ch(this);if(b.lineWrapping){this.display.wrapper.className+=" CodeMirror-wrap"}te(this);this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:false,delayingBlurEvent:false,focused:false,suppressEdits:false,pasteIncoming:-1,cutIncoming:-1,selectingText:false,draggingText:false,highlight:new N,keySeq:null,specialChars:null};if(b.autofocus&&!r){f.input.focus()}if(g&&h<11){setTimeout(function(){return c.display.input.reset(true)},20)}Kh(this);Dg();ve(this);this.curOp.forceUpdate=true;rf(this,d);if(b.autofocus&&!r||this.hasFocus()){setTimeout(K(Xd,this),20)}else{Yd(this)}for(var j in Fh){if(Fh.hasOwnProperty(j)){Fh[j](this,b[j],Dh)}}Ue(this);if(b.finishInit){b.finishInit(this)}for(var k=0;k<Lh.length;++k){Lh[k](this)}we(this);if(i&&b.lineWrapping&&getComputedStyle(f.lineDiv).textRendering=="optimizelegibility"){f.lineDiv.style.textRendering="auto"}}Jh.defaults=Eh;Jh.optionHandlers=Fh;function Kh(a){var b=a.display;oa(b.scroller,"mousedown",Ee(a,qh));if(g&&h<11){oa(b.scroller,"dblclick",Ee(a,function(b){if(sa(a,b)){return}var c=Hd(a,b);if(!c||zh(a,b)||Qc(a.display,b)){return}wa(b);var d=a.findWordAt(c);If(a.doc,d.anchor,d.head)}))}else{oa(b.scroller,"dblclick",function(b){return sa(a,b)||wa(b)})}oa(b.scroller,"contextmenu",function(b){return Ah(a,b)});oa(b.input.getField(),"contextmenu",function(c){if(!b.scroller.contains(c.target)){Ah(a,c)}});var c,d={end:0};function e(){if(b.activeTouch){c=setTimeout(function(){return b.activeTouch=null},1e3);d=b.activeTouch;d.end=+new Date}}function f(a){if(a.touches.length!=1){return false}var b=a.touches[0];return b.radiusX<=1&&b.radiusY<=1}function i(a,b){if(b.left==null){return true}var c=b.left-a.left,d=b.top-a.top;return c*c+d*d>20*20}oa(b.scroller,"touchstart",function(e){if(!sa(a,e)&&!f(e)&&!zh(a,e)){b.input.ensurePolled();clearTimeout(c);var g=+new Date;b.activeTouch={start:g,moved:false,prev:g-d.end<=300?d:null};if(e.touches.length==1){b.activeTouch.left=e.touches[0].pageX;b.activeTouch.top=e.touches[0].pageY}}});oa(b.scroller,"touchmove",function(){if(b.activeTouch){b.activeTouch.moved=true}});oa(b.scroller,"touchend",function(c){var d=b.activeTouch;if(d&&!Qc(b,c)&&d.left!=null&&!d.moved&&new Date-d.start<300){var f=a.coordsChar(b.activeTouch,"page"),g;if(!d.prev||i(d,d.prev)){g=new df(f,f)}else if(!d.prev.prev||i(d,d.prev.prev)){g=a.findWordAt(f)}else{g=new df(eb(f.line,0),lb(a.doc,eb(f.line+1,0)))}a.setSelection(g.anchor,g.head);a.focus();wa(c)}e()});oa(b.scroller,"touchcancel",e);oa(b.scroller,"scroll",function(){if(b.scroller.clientHeight){ke(a,b.scroller.scrollTop);me(a,b.scroller.scrollLeft,true);ra(a,"scroll",a)}});oa(b.scroller,"mousewheel",function(b){return bf(a,b)});oa(b.scroller,"DOMMouseScroll",function(b){return bf(a,b)});oa(b.wrapper,"scroll",function(){return b.wrapper.scrollTop=b.wrapper.scrollLeft=0});b.dragFunctions={enter:function(b){if(!sa(a,b)){za(b)}},over:function(b){if(!sa(a,b)){zg(a,b);za(b)}},start:function(b){return yg(a,b)},drop:Ee(a,xg),leave:function(b){if(!sa(a,b)){Ag(a)}}};var j=b.input.getField();oa(j,"keyup",function(b){return jh.call(a,b)});oa(j,"keydown",Ee(a,hh));oa(j,"keypress",Ee(a,kh));oa(j,"focus",function(b){return Xd(a,b)});oa(j,"blur",function(b){return Yd(a,b)})}var Lh=[];Jh.defineInitHook=function(a){return Lh.push(a)};function Mh(a,b,c,d){var e=a.doc,f;if(c==null){c="add"}if(c=="smart"){if(!e.mode.indent){c="prev"}else{f=sb(a,b).state}}var g=a.options.tabSize;var h=Ya(e,b),i=M(h.text,null,g);if(h.stateAfter){h.stateAfter=null}var j=h.text.match(/^\s*/)[0],k;if(!d&&!/\S/.test(h.text)){k=0;c="not"}else if(c=="smart"){k=e.mode.indent(f,h.text.slice(j.length),h.text);if(k==Q||k>150){if(!d){return}c="prev"}}if(c=="prev"){if(b>e.first){k=M(Ya(e,b-1).text,null,g)}else{k=0}}else if(c=="add"){k=i+a.options.indentUnit}else if(c=="subtract"){k=i-a.options.indentUnit}else if(typeof c=="number"){k=i+c}k=Math.max(0,k);var l="",m=0;if(a.options.indentWithTabs){for(var n=Math.floor(k/g);n;--n){m+=g;l+="\t"}}if(m<k){l+=W(k-m)}if(l!=j){cg(e,l,eb(b,0),eb(b,j.length),"+input");h.stateAfter=null;return true}else{for(var o=0;o<e.sel.ranges.length;o++){var p=e.sel.ranges[o];if(p.head.line==b&&p.head.ch<j.length){var q=eb(b,j.length);Kf(e,o,new df(q,q));break}}}}var Nh=null;function Oh(a){Nh=a}function Ph(a,b,c,d,e){var f=a.doc;a.display.shift=false;if(!d){d=f.sel}var g=+new Date-200;var h=e=="paste"||a.state.pasteIncoming>g;var i=Ha(b),j=null;if(h&&d.ranges.length>1){if(Nh&&Nh.text.join("\n")==b){if(d.ranges.length%Nh.text.length==0){j=[];for(var k=0;k<Nh.text.length;k++){j.push(f.splitLines(Nh.text[k]))}}}else if(i.length==d.ranges.length&&a.options.pasteLinesPerSelection){j=Y(i,function(a){return[a]})}}var l=a.curOp.updateInput;for(var m=d.ranges.length-1;m>=0;m--){var n=d.ranges[m];var o=n.from(),p=n.to();if(n.empty()){if(c&&c>0){o=eb(o.line,o.ch-c)}else if(a.state.overwrite&&!h){p=eb(p.line,Math.min(Ya(f,p.line).text.length,p.ch+X(i).length))}else if(h&&Nh&&Nh.lineWise&&Nh.text.join("\n")==i.join("\n")){o=p=eb(o.line,0)}}var q={from:o,to:p,text:j?j[m%j.length]:i,origin:e||(h?"paste":a.state.cutIncoming>g?"cut":"+input")};Yf(a.doc,q);Bc(a,"inputRead",a,q)}if(b&&!h){Rh(a,b)}fe(a);if(a.curOp.updateInput<2){a.curOp.updateInput=l}a.curOp.typing=true;a.state.pasteIncoming=a.state.cutIncoming=-1}function Qh(a,b){var c=a.clipboardData&&a.clipboardData.getData("Text");if(c){a.preventDefault();if(!b.isReadOnly()&&!b.options.disableInput){De(b,function(){return Ph(b,c,0,null,"paste")})}return true}}function Rh(a,b){if(!a.options.electricChars||!a.options.smartIndent){return}var c=a.doc.sel;for(var d=c.ranges.length-1;d>=0;d--){var e=c.ranges[d];if(e.head.ch>100||d&&c.ranges[d-1].head.line==e.head.line){continue}var f=a.getModeAt(e.head);var g=false;if(f.electricChars){for(var h=0;h<f.electricChars.length;h++){if(b.indexOf(f.electricChars.charAt(h))>-1){g=Mh(a,e.head.line,"smart");break}}}else if(f.electricInput){if(f.electricInput.test(Ya(a.doc,e.head.line).text.slice(0,e.head.ch))){g=Mh(a,e.head.line,"smart")}}if(g){Bc(a,"electricInput",a,e.head.line)}}}function Sh(a){var b=[],c=[];for(var d=0;d<a.doc.sel.ranges.length;d++){var e=a.doc.sel.ranges[d].head.line;var f={anchor:eb(e,0),head:eb(e+1,0)};c.push(f);b.push(a.getRange(f.anchor,f.head))}return{text:b,ranges:c}}function Th(a,b,c,d){a.setAttribute("autocorrect",c?"":"off");a.setAttribute("autocapitalize",d?"":"off");a.setAttribute("spellcheck",!!b)}function Uh(){var a=C("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none");var b=C("div",[a],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");if(i){a.style.width="1000px"}else{a.setAttribute("wrap","off")}if(p){a.style.border="1px solid black"}Th(a);return b}function Vh(a){var b=a.optionHandlers;var c=a.helpers={};a.prototype={constructor:a,focus:function(){window.focus();this.display.input.focus()},setOption:function(a,c){var d=this.options,e=d[a];if(d[a]==c&&a!="mode"){return}d[a]=c;if(b.hasOwnProperty(a)){Ee(this,b[a])(this,c,e)}ra(this,"optionChange",this,a)},getOption:function(a){return this.options[a]},getDoc:function(){return this.doc},addKeyMap:function(a,b){this.state.keyMaps[b?"push":"unshift"](Rg(a))},removeKeyMap:function(a){var b=this.state.keyMaps;for(var c=0;c<b.length;++c){if(b[c]==a||b[c].name==a){b.splice(c,1);return true}}},addOverlay:Fe(function(b,c){var d=b.token?b:a.getMode(this.options,b);if(d.startState){throw new Error("Overlays may not be stateful.")}Z(this.state.overlays,{mode:d,modeSpec:b,opaque:c&&c.opaque,priority:c&&c.priority||0},function(a){return a.priority});this.state.modeGen++;Jd(this)}),removeOverlay:Fe(function(a){var b=this.state.overlays;for(var c=0;c<b.length;++c){var d=b[c].modeSpec;if(d==a||typeof a=="string"&&d.name==a){b.splice(c,1);this.state.modeGen++;Jd(this);return}}}),indentLine:Fe(function(a,b,c){if(typeof b!="string"&&typeof b!="number"){if(b==null){b=this.options.smartIndent?"smart":"prev"}else{b=b?"add":"subtract"}}if(cb(this.doc,a)){Mh(this,a,b,c)}}),indentSelection:Fe(function(a){var b=this.doc.sel.ranges,c=-1;for(var d=0;d<b.length;d++){var e=b[d];if(!e.empty()){var f=e.from(),g=e.to();var h=Math.max(c,f.line);c=Math.min(this.lastLine(),g.line-(g.ch?0:1))+1;for(var i=h;i<c;++i){Mh(this,i,a)}var j=this.doc.sel.ranges;if(f.ch==0&&b.length==j.length&&j[d].from().ch>0){Kf(this.doc,d,new df(f,j[d].to()),R)}}else if(e.head.line>c){Mh(this,e.head.line,a,true);c=e.head.line;if(d==this.doc.sel.primIndex){fe(this)}}}}),getTokenAt:function(a,b){return xb(this,a,b)},getLineTokens:function(a,b){return xb(this,eb(a),b,true)},getTokenTypeAt:function(a){a=lb(this.doc,a);var b=rb(this,Ya(this.doc,a.line));var c=0,d=(b.length-1)/2,e=a.ch;var f;if(e==0){f=b[2]}else{for(;;){var g=c+d>>1;if((g?b[g*2-1]:0)>=e){d=g}else if(b[g*2+1]<e){c=g+1}else{f=b[g*2+2];break}}}var h=f?f.indexOf("overlay "):-1;return h<0?f:h==0?null:f.slice(0,h-1)},getModeAt:function(b){var c=this.doc.mode;if(!c.innerMode){return c}return a.innerMode(c,this.getTokenAt(b).state).mode},getHelper:function(a,b){return this.getHelpers(a,b)[0]},getHelpers:function(a,b){var d=[];if(!c.hasOwnProperty(b)){return d}var e=c[b],f=this.getModeAt(a);if(typeof f[b]=="string"){if(e[f[b]]){d.push(e[f[b]])}}else if(f[b]){for(var g=0;g<f[b].length;g++){var h=e[f[b][g]];if(h){d.push(h)}}}else if(f.helperType&&e[f.helperType]){d.push(e[f.helperType])}else if(e[f.name]){d.push(e[f.name])}for(var i=0;i<e._global.length;i++){var j=e._global[i];if(j.pred(f,this)&&O(d,j.val)==-1){d.push(j.val)}}return d},getStateAfter:function(a,b){var c=this.doc;a=kb(c,a==null?c.first+c.size-1:a);return sb(this,a+1,b).state},cursorCoords:function(a,b){var c,d=this.doc.sel.primary();if(a==null){c=d.head}else if(typeof a=="object"){c=lb(this.doc,a)}else{c=a?d.from():d.to()}return qd(this,c,b||"page")},charCoords:function(a,b){return pd(this,lb(this.doc,a),b||"page")},coordsChar:function(a,b){a=od(this,a,b||"page");return td(this,a.left,a.top)},lineAtHeight:function(a,b){a=od(this,{top:a,left:0},b||"page").top;return bb(this.doc,a+this.display.viewOffset)},heightAtLine:function(a,b,c){var d=false,e;if(typeof a=="number"){var f=this.doc.first+this.doc.size-1;if(a<this.doc.first){a=this.doc.first}else if(a>f){a=f;d=true}e=Ya(this.doc,a)}else{e=a}return nd(this,e,{top:0,left:0},b||"page",c||d).top+(d?this.doc.height-ec(e):0)},defaultTextHeight:function(){return Bd(this.display)},defaultCharWidth:function(){return Cd(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(a,b,c,d,e){var f=this.display;a=qd(this,lb(this.doc,a));var g=a.bottom,h=a.left;b.style.position="absolute";b.setAttribute("cm-ignore-events","true");this.display.input.setUneditable(b);f.sizer.appendChild(b);if(d=="over"){g=a.top}else if(d=="above"||d=="near"){var i=Math.max(f.wrapper.clientHeight,this.doc.height),j=Math.max(f.sizer.clientWidth,f.lineSpace.clientWidth);if((d=="above"||a.bottom+b.offsetHeight>i)&&a.top>b.offsetHeight){g=a.top-b.offsetHeight}else if(a.bottom+b.offsetHeight<=i){g=a.bottom}if(h+b.offsetWidth>j){h=j-b.offsetWidth}}b.style.top=g+"px";b.style.left=b.style.right="";if(e=="right"){h=f.sizer.clientWidth-b.offsetWidth;b.style.right="0px"}else{if(e=="left"){h=0}else if(e=="middle"){h=(f.sizer.clientWidth-b.offsetWidth)/2}b.style.left=h+"px"}if(c){ce(this,{left:h,top:g,right:h+b.offsetWidth,bottom:g+b.offsetHeight})}},triggerOnKeyDown:Fe(hh),triggerOnKeyPress:Fe(kh),triggerOnKeyUp:jh,triggerOnMouseDown:Fe(qh),execCommand:function(a){if(Xg.hasOwnProperty(a)){return Xg[a].call(null,this)}},triggerElectric:Fe(function(a){Rh(this,a)}),findPosH:function(a,b,c,d){var e=1;if(b<0){e=-1;b=-b}var f=lb(this.doc,a);for(var g=0;g<b;++g){f=Wh(this.doc,f,e,c,d);if(f.hitSide){break}}return f},moveH:Fe(function(a,b){var c=this;this.extendSelectionsBy(function(d){if(c.display.shift||c.doc.extend||d.empty()){return Wh(c.doc,d.head,a,b,c.options.rtlMoveVisually)}else{return a<0?d.from():d.to()}},T)}),deleteH:Fe(function(a,b){var c=this.doc.sel,d=this.doc;if(c.somethingSelected()){d.replaceSelection("",null,"+delete")}else{Sg(this,function(c){var e=Wh(d,c.head,a,b,false);return a<0?{from:e,to:c.head}:{from:c.head,to:e}})}}),findPosV:function(a,b,c,d){var e=1,f=d;if(b<0){e=-1;b=-b}var g=lb(this.doc,a);for(var h=0;h<b;++h){var i=qd(this,g,"div");if(f==null){f=i.left}else{i.left=f}g=Xh(this,i,e,c);if(g.hitSide){break}}return g},moveV:Fe(function(a,b){var c=this;var d=this.doc,e=[];var f=!this.display.shift&&!d.extend&&d.sel.somethingSelected();d.extendSelectionsBy(function(g){if(f){return a<0?g.from():g.to()}var h=qd(c,g.head,"div");if(g.goalColumn!=null){h.left=g.goalColumn}e.push(h.left);var i=Xh(c,h,a,b);if(b=="page"&&g==d.sel.primary()){ee(c,pd(c,i,"div").top-h.top)}return i},T);if(e.length){for(var g=0;g<d.sel.ranges.length;g++){d.sel.ranges[g].goalColumn=e[g]}}}),findWordAt:function(a){var b=this.doc,c=Ya(b,a.line).text;var d=a.ch,e=a.ch;if(c){var f=this.getHelper(a,"wordChars");if((a.sticky=="before"||e==c.length)&&d){--d}else{++e}var g=c.charAt(d);var h=ca(g,f)?function(a){return ca(a,f)}:/\s/.test(g)?function(a){return/\s/.test(a)}:function(a){return!/\s/.test(a)&&!ca(a)};while(d>0&&h(c.charAt(d-1))){--d}while(e<c.length&&h(c.charAt(e))){++e}}return new df(eb(a.line,d),eb(a.line,e))},toggleOverwrite:function(a){if(a!=null&&a==this.state.overwrite){return}if(this.state.overwrite=!this.state.overwrite){H(this.display.cursorDiv,"CodeMirror-overwrite")}else{z(this.display.cursorDiv,"CodeMirror-overwrite")}ra(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==G()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Fe(function(a,b){ge(this,a,b)}),getScrollInfo:function(){var a=this.display.scroller;return{left:a.scrollLeft,top:a.scrollTop,height:a.scrollHeight-Uc(this)-this.display.barHeight,width:a.scrollWidth-Uc(this)-this.display.barWidth,clientHeight:Wc(this),clientWidth:Vc(this)}},scrollIntoView:Fe(function(a,b){if(a==null){a={from:this.doc.sel.primary().head,to:null};if(b==null){b=this.options.cursorScrollMargin}}else if(typeof a=="number"){a={from:eb(a,0),to:null}}else if(a.from==null){a={from:a,to:null}}if(!a.to){a.to=a.from}a.margin=b||0;if(a.from.line!=null){he(this,a)}else{je(this,a.from,a.to,a.margin)}}),setSize:Fe(function(a,b){var c=this;var d=function(a){return typeof a=="number"||/^\d+$/.test(String(a))?a+"px":a};if(a!=null){this.display.wrapper.style.width=d(a)}if(b!=null){this.display.wrapper.style.height=d(b)}if(this.options.lineWrapping){id(this)}var e=this.display.viewFrom;this.doc.iter(e,this.display.viewTo,function(a){if(a.widgets){for(var b=0;b<a.widgets.length;b++){if(a.widgets[b].noHScroll){Kd(c,e,"widget");break}}}++e});this.curOp.forceUpdate=true;ra(this,"refresh",this)}),operation:function(a){return De(this,a)},startOperation:function(){return ve(this)},endOperation:function(){return we(this)},refresh:Fe(function(){var a=this.display.cachedTextHeight;Jd(this);this.curOp.forceUpdate=true;jd(this);ge(this,this.doc.scrollLeft,this.doc.scrollTop);Re(this.display);if(a==null||Math.abs(a-Bd(this.display))>.5||this.options.lineWrapping){Gd(this)}ra(this,"refresh",this)}),swapDoc:Fe(function(a){var b=this.doc;b.cm=null;if(this.state.selectingText){this.state.selectingText()}rf(this,a);jd(this);this.display.input.reset();ge(this,a.scrollLeft,a.scrollTop);this.curOp.forceScroll=true;Bc(this,"swapDoc",this,b);return b}),phrase:function(a){var b=this.options.phrases;return b&&Object.prototype.hasOwnProperty.call(b,a)?b[a]:a},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}};va(a);a.registerHelper=function(b,d,e){if(!c.hasOwnProperty(b)){c[b]=a[b]={_global:[]}}c[b][d]=e};a.registerGlobalHelper=function(b,d,e,f){a.registerHelper(b,d,f);c[b]._global.push({pred:e,val:f})}}function Wh(a,b,c,d,e){var f=b;var g=c;var h=Ya(a,b.line);var i=e&&a.direction=="rtl"?-c:c;function j(){var c=b.line+i;if(c<a.first||c>=a.first+a.size){return false}b=new eb(c,b.ch,b.sticky);return h=Ya(a,c)}function k(d){var f;if(e){f=Wg(a.cm,h,b,c)}else{f=Ug(h,b,c)}if(f==null){if(!d&&j()){b=Vg(e,a.cm,h,b.line,i)}else{return false}}else{b=f}return true}if(d=="char"){k()}else if(d=="column"){k(true)}else if(d=="word"||d=="group"){var l=null,m=d=="group";var n=a.cm&&a.cm.getHelper(b,"wordChars");for(var o=true;;o=false){if(c<0&&!k(!o)){break}var p=h.text.charAt(b.ch)||"\n";var q=ca(p,n)?"w":m&&p=="\n"?"n":!m||/\s/.test(p)?null:"p";if(m&&!o&&!q){q="s"}if(l&&l!=q){if(c<0){c=1;k();b.sticky="after"}break}if(q){l=q}if(c>0&&!k(!o)){break}}}var r=Uf(a,b,f,g,true);if(gb(f,r)){r.hitSide=true}return r}function Xh(a,b,c,d){var e=a.doc,f=b.left,g;if(d=="page"){var h=Math.min(a.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);var i=Math.max(h-.5*Bd(a.display),3);g=(c>0?b.bottom:b.top)+c*i}else if(d=="line"){g=c>0?b.bottom+3:b.top-3}var j;for(;;){j=td(a,f,g);if(!j.outside){break}if(c<0?g<=0:g>=e.height){j.hitSide=true;break}g+=c*5}return j}var Yh=function(a){this.cm=a;this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null;this.polling=new N;this.composing=null;this.gracePeriod=false;this.readDOMTimeout=null};Yh.prototype.init=function(a){var b=this;var c=this,d=c.cm;var e=c.div=a.lineDiv;Th(e,d.options.spellcheck,d.options.autocorrect,d.options.autocapitalize);function f(a){for(var b=a.target;b;b=b.parentNode){if(b==e){return true} 6if(/\bCodeMirror-(?:line)?widget\b/.test(b.className)){break}}return false}oa(e,"paste",function(a){if(!f(a)||sa(d,a)||Qh(a,d)){return}if(h<=11){setTimeout(Ee(d,function(){return b.updateFromDOM()}),20)}});oa(e,"compositionstart",function(a){b.composing={data:a.data,done:false}});oa(e,"compositionupdate",function(a){if(!b.composing){b.composing={data:a.data,done:false}}});oa(e,"compositionend",function(a){if(b.composing){if(a.data!=b.composing.data){b.readFromDOMSoon()}b.composing.done=true}});oa(e,"touchstart",function(){return c.forceCompositionEnd()});oa(e,"input",function(){if(!b.composing){b.readFromDOMSoon()}});function g(a){if(!f(a)||sa(d,a)){return}if(d.somethingSelected()){Oh({lineWise:false,text:d.getSelections()});if(a.type=="cut"){d.replaceSelection("",null,"cut")}}else if(!d.options.lineWiseCopyCut){return}else{var b=Sh(d);Oh({lineWise:true,text:b.text});if(a.type=="cut"){d.operation(function(){d.setSelections(b.ranges,0,R);d.replaceSelection("",null,"cut")})}}if(a.clipboardData){a.clipboardData.clearData();var g=Nh.text.join("\n");a.clipboardData.setData("Text",g);if(a.clipboardData.getData("Text")==g){a.preventDefault();return}}var h=Uh(),i=h.firstChild;d.display.lineSpace.insertBefore(h,d.display.lineSpace.firstChild);i.value=Nh.text.join("\n");var j=document.activeElement;J(i);setTimeout(function(){d.display.lineSpace.removeChild(h);j.focus();if(j==e){c.showPrimarySelection()}},50)}oa(e,"copy",g);oa(e,"cut",g)};Yh.prototype.screenReaderLabelChanged=function(a){if(a){this.div.setAttribute("aria-label",a)}else{this.div.removeAttribute("aria-label")}};Yh.prototype.prepareSelection=function(){var a=Qd(this.cm,false);a.focus=document.activeElement==this.div;return a};Yh.prototype.showSelection=function(a,b){if(!a||!this.cm.display.view.length){return}if(a.focus||b){this.showPrimarySelection()}this.showMultipleSelections(a)};Yh.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()};Yh.prototype.showPrimarySelection=function(){var a=this.getSelection(),b=this.cm,d=b.doc.sel.primary();var e=d.from(),f=d.to();if(b.display.viewTo==b.display.viewFrom||e.line>=b.display.viewTo||f.line<b.display.viewFrom){a.removeAllRanges();return}var g=bi(b,a.anchorNode,a.anchorOffset);var h=bi(b,a.focusNode,a.focusOffset);if(g&&!g.bad&&h&&!h.bad&&fb(jb(g,h),e)==0&&fb(ib(g,h),f)==0){return}var i=b.display.view;var j=e.line>=b.display.viewFrom&&Zh(b,e)||{node:i[0].measure.map[2],offset:0};var k=f.line<b.display.viewTo&&Zh(b,f);if(!k){var l=i[i.length-1].measure;var m=l.maps?l.maps[l.maps.length-1]:l.map;k={node:m[m.length-1],offset:m[m.length-2]-m[m.length-3]}}if(!j||!k){a.removeAllRanges();return}var n=a.rangeCount&&a.getRangeAt(0),o;try{o=E(j.node,j.offset,k.offset,k.node)}catch(p){}if(o){if(!c&&b.state.focused){a.collapse(j.node,j.offset);if(!o.collapsed){a.removeAllRanges();a.addRange(o)}}else{a.removeAllRanges();a.addRange(o)}if(n&&a.anchorNode==null){a.addRange(n)}else if(c){this.startGracePeriod()}}this.rememberSelection()};Yh.prototype.startGracePeriod=function(){var a=this;clearTimeout(this.gracePeriod);this.gracePeriod=setTimeout(function(){a.gracePeriod=false;if(a.selectionChanged()){a.cm.operation(function(){return a.cm.curOp.selectionChanged=true})}},20)};Yh.prototype.showMultipleSelections=function(a){B(this.cm.display.cursorDiv,a.cursors);B(this.cm.display.selectionDiv,a.selection)};Yh.prototype.rememberSelection=function(){var a=this.getSelection();this.lastAnchorNode=a.anchorNode;this.lastAnchorOffset=a.anchorOffset;this.lastFocusNode=a.focusNode;this.lastFocusOffset=a.focusOffset};Yh.prototype.selectionInEditor=function(){var a=this.getSelection();if(!a.rangeCount){return false}var b=a.getRangeAt(0).commonAncestorContainer;return F(this.div,b)};Yh.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"){if(!this.selectionInEditor()||document.activeElement!=this.div){this.showSelection(this.prepareSelection(),true)}this.div.focus()}};Yh.prototype.blur=function(){this.div.blur()};Yh.prototype.getField=function(){return this.div};Yh.prototype.supportsTouch=function(){return true};Yh.prototype.receivedFocus=function(){var a=this;if(this.selectionInEditor()){this.pollSelection()}else{De(this.cm,function(){return a.cm.curOp.selectionChanged=true})}function b(){if(a.cm.state.focused){a.pollSelection();a.polling.set(a.cm.options.pollInterval,b)}}this.polling.set(this.cm.options.pollInterval,b)};Yh.prototype.selectionChanged=function(){var a=this.getSelection();return a.anchorNode!=this.lastAnchorNode||a.anchorOffset!=this.lastAnchorOffset||a.focusNode!=this.lastFocusNode||a.focusOffset!=this.lastFocusOffset};Yh.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged()){return}var a=this.getSelection(),b=this.cm;if(q&&k&&this.cm.display.gutterSpecs.length&&$h(a.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs});this.blur();this.focus();return}if(this.composing){return}this.rememberSelection();var c=bi(b,a.anchorNode,a.anchorOffset);var d=bi(b,a.focusNode,a.focusOffset);if(c&&d){De(b,function(){Of(b.doc,ff(c,d),R);if(c.bad||d.bad){b.curOp.selectionChanged=true}})}};Yh.prototype.pollContent=function(){if(this.readDOMTimeout!=null){clearTimeout(this.readDOMTimeout);this.readDOMTimeout=null}var a=this.cm,b=a.display,c=a.doc.sel.primary();var d=c.from(),e=c.to();if(d.ch==0&&d.line>a.firstLine()){d=eb(d.line-1,Ya(a.doc,d.line-1).length)}if(e.ch==Ya(a.doc,e.line).text.length&&e.line<a.lastLine()){e=eb(e.line+1,0)}if(d.line<b.viewFrom||e.line>b.viewTo-1){return false}var f,g,h;if(d.line==b.viewFrom||(f=Id(a,d.line))==0){g=ab(b.view[0].line);h=b.view[0].node}else{g=ab(b.view[f].line);h=b.view[f-1].node.nextSibling}var i=Id(a,e.line);var j,k;if(i==b.view.length-1){j=b.viewTo-1;k=b.lineDiv.lastChild}else{j=ab(b.view[i+1].line)-1;k=b.view[i+1].node.previousSibling}if(!h){return false}var l=a.doc.splitLines(ai(a,h,k,g,j));var m=Za(a.doc,eb(g,0),eb(j,Ya(a.doc,j).text.length));while(l.length>1&&m.length>1){if(X(l)==X(m)){l.pop();m.pop();j--}else if(l[0]==m[0]){l.shift();m.shift();g++}else{break}}var n=0,o=0;var p=l[0],q=m[0],r=Math.min(p.length,q.length);while(n<r&&p.charCodeAt(n)==q.charCodeAt(n)){++n}var s=X(l),t=X(m);var u=Math.min(s.length-(l.length==1?n:0),t.length-(m.length==1?n:0));while(o<u&&s.charCodeAt(s.length-o-1)==t.charCodeAt(t.length-o-1)){++o}if(l.length==1&&m.length==1&&g==d.line){while(n&&n>d.ch&&s.charCodeAt(s.length-o-1)==t.charCodeAt(t.length-o-1)){n--;o++}}l[l.length-1]=s.slice(0,s.length-o).replace(/^\u200b+/,"");l[0]=l[0].slice(n).replace(/\u200b+$/,"");var v=eb(g,n);var w=eb(j,m.length?X(m).length-o:0);if(l.length>1||l[0]||fb(v,w)){cg(a.doc,l,v,w,"+input");return true}};Yh.prototype.ensurePolled=function(){this.forceCompositionEnd()};Yh.prototype.reset=function(){this.forceCompositionEnd()};Yh.prototype.forceCompositionEnd=function(){if(!this.composing){return}clearTimeout(this.readDOMTimeout);this.composing=null;this.updateFromDOM();this.div.blur();this.div.focus()};Yh.prototype.readFromDOMSoon=function(){var a=this;if(this.readDOMTimeout!=null){return}this.readDOMTimeout=setTimeout(function(){a.readDOMTimeout=null;if(a.composing){if(a.composing.done){a.composing=null}else{return}}a.updateFromDOM()},80)};Yh.prototype.updateFromDOM=function(){var a=this;if(this.cm.isReadOnly()||!this.pollContent()){De(this.cm,function(){return Jd(a.cm)})}};Yh.prototype.setUneditable=function(a){a.contentEditable="false"};Yh.prototype.onKeyPress=function(a){if(a.charCode==0||this.composing){return}a.preventDefault();if(!this.cm.isReadOnly()){Ee(this.cm,Ph)(this.cm,String.fromCharCode(a.charCode==null?a.keyCode:a.charCode),0)}};Yh.prototype.readOnlyChanged=function(a){this.div.contentEditable=String(a!="nocursor")};Yh.prototype.onContextMenu=function(){};Yh.prototype.resetPosition=function(){};Yh.prototype.needsContentAttribute=true;function Zh(a,b){var c=_c(a,b.line);if(!c||c.hidden){return null}var d=Ya(a.doc,b.line);var e=Yc(c,d,b.line);var f=ma(d,a.doc.direction),g="left";if(f){var h=ka(f,b.ch);g=h%2?"right":"left"}var i=dd(e.map,b.ch,g);i.offset=i.collapse=="right"?i.end:i.start;return i}function $h(a){for(var b=a;b;b=b.parentNode){if(/CodeMirror-gutter-wrapper/.test(b.className)){return true}}return false}function _h(a,b){if(b){a.bad=true}return a}function ai(a,b,c,d,e){var f="",g=false,h=a.doc.lineSeparator(),i=false;function j(a){return function(b){return b.id==a}}function k(){if(g){f+=h;if(i){f+=h}g=i=false}}function l(a){if(a){k();f+=a}}function m(b){if(b.nodeType==1){var c=b.getAttribute("cm-text");if(c){l(c);return}var f=b.getAttribute("cm-marker"),n;if(f){var o=a.findMarks(eb(d,0),eb(e+1,0),j(+f));if(o.length&&(n=o[0].find(0))){l(Za(a.doc,n.from,n.to).join(h))}return}if(b.getAttribute("contenteditable")=="false"){return}var p=/^(pre|div|p|li|table|br)$/i.test(b.nodeName);if(!/^br$/i.test(b.nodeName)&&b.textContent.length==0){return}if(p){k()}for(var q=0;q<b.childNodes.length;q++){m(b.childNodes[q])}if(/^(pre|p)$/i.test(b.nodeName)){i=true}if(p){g=true}}else if(b.nodeType==3){l(b.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}}for(;;){m(b);if(b==c){break}b=b.nextSibling;i=false}return f}function bi(a,b,c){var d;if(b==a.display.lineDiv){d=a.display.lineDiv.childNodes[c];if(!d){return _h(a.clipPos(eb(a.display.viewTo-1)),true)}b=null;c=0}else{for(d=b;;d=d.parentNode){if(!d||d==a.display.lineDiv){return null}if(d.parentNode&&d.parentNode==a.display.lineDiv){break}}}for(var e=0;e<a.display.view.length;e++){var f=a.display.view[e];if(f.node==d){return ci(f,b,c)}}}function ci(a,b,c){var d=a.text.firstChild,e=false;if(!b||!F(d,b)){return _h(eb(ab(a.line),0),true)}if(b==d){e=true;b=d.childNodes[c];c=0;if(!b){var f=a.rest?X(a.rest):a.line;return _h(eb(ab(f),f.text.length),e)}}var g=b.nodeType==3?b:null,h=b;if(!g&&b.childNodes.length==1&&b.firstChild.nodeType==3){g=b.firstChild;if(c){c=g.nodeValue.length}}while(h.parentNode!=d){h=h.parentNode}var i=a.measure,j=i.maps;function k(b,c,d){for(var e=-1;e<(j?j.length:0);e++){var f=e<0?i.map:j[e];for(var g=0;g<f.length;g+=3){var h=f[g+2];if(h==b||h==c){var k=ab(e<0?a.line:a.rest[e]);var l=f[g]+d;if(d<0||h!=b){l=f[g+(d?1:0)]}return eb(k,l)}}}}var l=k(g,h,c);if(l){return _h(l,e)}for(var m=h.nextSibling,n=g?g.nodeValue.length-c:0;m;m=m.nextSibling){l=k(m,m.firstChild,0);if(l){return _h(eb(l.line,l.ch-n),e)}else{n+=m.textContent.length}}for(var o=h.previousSibling,p=c;o;o=o.previousSibling){l=k(o,o.firstChild,-1);if(l){return _h(eb(l.line,l.ch+p),e)}else{p+=o.textContent.length}}}var di=function(a){this.cm=a;this.prevInput="";this.pollingFast=false;this.polling=new N;this.hasSelection=false;this.composing=null};di.prototype.init=function(a){var b=this;var c=this,d=this.cm;this.createField(a);var e=this.textarea;a.wrapper.insertBefore(this.wrapper,a.wrapper.firstChild);if(p){e.style.width="0px"}oa(e,"input",function(){if(g&&h>=9&&b.hasSelection){b.hasSelection=null}c.poll()});oa(e,"paste",function(a){if(sa(d,a)||Qh(a,d)){return}d.state.pasteIncoming=+new Date;c.fastPoll()});function f(a){if(sa(d,a)){return}if(d.somethingSelected()){Oh({lineWise:false,text:d.getSelections()})}else if(!d.options.lineWiseCopyCut){return}else{var b=Sh(d);Oh({lineWise:true,text:b.text});if(a.type=="cut"){d.setSelections(b.ranges,null,R)}else{c.prevInput="";e.value=b.text.join("\n");J(e)}}if(a.type=="cut"){d.state.cutIncoming=+new Date}}oa(e,"cut",f);oa(e,"copy",f);oa(a.scroller,"paste",function(b){if(Qc(a,b)||sa(d,b)){return}if(!e.dispatchEvent){d.state.pasteIncoming=+new Date;c.focus();return}var f=new Event("paste");f.clipboardData=b.clipboardData;e.dispatchEvent(f)});oa(a.lineSpace,"selectstart",function(b){if(!Qc(a,b)){wa(b)}});oa(e,"compositionstart",function(){var a=d.getCursor("from");if(c.composing){c.composing.range.clear()}c.composing={start:a,range:d.markText(a,d.getCursor("to"),{className:"CodeMirror-composing"})}});oa(e,"compositionend",function(){if(c.composing){c.poll();c.composing.range.clear();c.composing=null}})};di.prototype.createField=function(a){this.wrapper=Uh();this.textarea=this.wrapper.firstChild};di.prototype.screenReaderLabelChanged=function(a){if(a){this.textarea.setAttribute("aria-label",a)}else{this.textarea.removeAttribute("aria-label")}};di.prototype.prepareSelection=function(){var a=this.cm,b=a.display,c=a.doc;var d=Qd(a);if(a.options.moveInputWithCursor){var e=qd(a,c.sel.primary().head,"div");var f=b.wrapper.getBoundingClientRect(),g=b.lineDiv.getBoundingClientRect();d.teTop=Math.max(0,Math.min(b.wrapper.clientHeight-10,e.top+g.top-f.top));d.teLeft=Math.max(0,Math.min(b.wrapper.clientWidth-10,e.left+g.left-f.left))}return d};di.prototype.showSelection=function(a){var b=this.cm,c=b.display;B(c.cursorDiv,a.cursors);B(c.selectionDiv,a.selection);if(a.teTop!=null){this.wrapper.style.top=a.teTop+"px";this.wrapper.style.left=a.teLeft+"px"}};di.prototype.reset=function(a){if(this.contextMenuPending||this.composing){return}var b=this.cm;if(b.somethingSelected()){this.prevInput="";var c=b.getSelection();this.textarea.value=c;if(b.state.focused){J(this.textarea)}if(g&&h>=9){this.hasSelection=c}}else if(!a){this.prevInput=this.textarea.value="";if(g&&h>=9){this.hasSelection=null}}};di.prototype.getField=function(){return this.textarea};di.prototype.supportsTouch=function(){return false};di.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!r||G()!=this.textarea)){try{this.textarea.focus()}catch(a){}}};di.prototype.blur=function(){this.textarea.blur()};di.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0};di.prototype.receivedFocus=function(){this.slowPoll()};di.prototype.slowPoll=function(){var a=this;if(this.pollingFast){return}this.polling.set(this.cm.options.pollInterval,function(){a.poll();if(a.cm.state.focused){a.slowPoll()}})};di.prototype.fastPoll=function(){var a=false,b=this;b.pollingFast=true;function c(){var d=b.poll();if(!d&&!a){a=true;b.polling.set(60,c)}else{b.pollingFast=false;b.slowPoll()}}b.polling.set(20,c)};di.prototype.poll=function(){var a=this;var b=this.cm,c=this.textarea,d=this.prevInput;if(this.contextMenuPending||!b.state.focused||Ia(c)&&!d&&!this.composing||b.isReadOnly()||b.options.disableInput||b.state.keySeq){return false}var e=c.value;if(e==d&&!b.somethingSelected()){return false}if(g&&h>=9&&this.hasSelection===e||s&&/[\uf700-\uf7ff]/.test(e)){b.display.input.reset();return false}if(b.doc.sel==b.display.selForContextMenu){var f=e.charCodeAt(0);if(f==8203&&!d){d=""}if(f==8666){this.reset();return this.cm.execCommand("undo")}}var i=0,j=Math.min(d.length,e.length);while(i<j&&d.charCodeAt(i)==e.charCodeAt(i)){++i}De(b,function(){Ph(b,e.slice(i),d.length-i,null,a.composing?"*compose":null);if(e.length>1e3||e.indexOf("\n")>-1){c.value=a.prevInput=""}else{a.prevInput=e}if(a.composing){a.composing.range.clear();a.composing.range=b.markText(a.composing.start,b.getCursor("to"),{className:"CodeMirror-composing"})}});return true};di.prototype.ensurePolled=function(){if(this.pollingFast&&this.poll()){this.pollingFast=false}};di.prototype.onKeyPress=function(){if(g&&h>=9){this.hasSelection=null}this.fastPoll()};di.prototype.onContextMenu=function(a){var b=this,c=b.cm,d=c.display,e=b.textarea;if(b.contextMenuPending){b.contextMenuPending()}var f=Hd(c,a),j=d.scroller.scrollTop;if(!f||l){return}var k=c.options.resetSelectionOnContextMenu;if(k&&c.doc.sel.contains(f)==-1){Ee(c,Of)(c.doc,ff(f),R)}var m=e.style.cssText,n=b.wrapper.style.cssText;var o=b.wrapper.offsetParent.getBoundingClientRect();b.wrapper.style.cssText="position: static";e.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(a.clientY-o.top-5)+"px; left: "+(a.clientX-o.left-5)+"px;\n z-index: 1000; background: "+(g?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";var p;if(i){p=window.scrollY}d.input.focus();if(i){window.scrollTo(null,p)}d.input.reset();if(!c.somethingSelected()){e.value=b.prevInput=" "}b.contextMenuPending=r;d.selForContextMenu=c.doc.sel;clearTimeout(d.detectingSelectAll);function q(){if(e.selectionStart!=null){var a=c.somethingSelected();var f=""+(a?e.value:"");e.value="⇚";e.value=f;b.prevInput=a?"":"";e.selectionStart=1;e.selectionEnd=f.length;d.selForContextMenu=c.doc.sel}}function r(){if(b.contextMenuPending!=r){return}b.contextMenuPending=false;b.wrapper.style.cssText=n;e.style.cssText=m;if(g&&h<9){d.scrollbars.setScrollTop(d.scroller.scrollTop=j)}if(e.selectionStart!=null){if(!g||g&&h<9){q()}var a=0,f=function(){if(d.selForContextMenu==c.doc.sel&&e.selectionStart==0&&e.selectionEnd>0&&b.prevInput==""){Ee(c,Wf)(c)}else if(a++<10){d.detectingSelectAll=setTimeout(f,500)}else{d.selForContextMenu=null;d.input.reset()}};d.detectingSelectAll=setTimeout(f,200)}}if(g&&h>=9){q()}if(x){za(a);var s=function(){qa(window,"mouseup",s);setTimeout(r,20)};oa(window,"mouseup",s)}else{setTimeout(r,50)}};di.prototype.readOnlyChanged=function(a){if(!a){this.reset()}this.textarea.disabled=a=="nocursor"};di.prototype.setUneditable=function(){};di.prototype.needsContentAttribute=false;function ei(a,b){b=b?L(b):{};b.value=a.value;if(!b.tabindex&&a.tabIndex){b.tabindex=a.tabIndex}if(!b.placeholder&&a.placeholder){b.placeholder=a.placeholder}if(b.autofocus==null){var c=G();b.autofocus=c==a||a.getAttribute("autofocus")!=null&&c==document.body}function d(){a.value=h.getValue()}var e;if(a.form){oa(a.form,"submit",d);if(!b.leaveSubmitMethodAlone){var f=a.form;e=f.submit;try{var g=f.submit=function(){d();f.submit=e;f.submit();f.submit=g}}catch(i){}}}b.finishInit=function(c){c.save=d;c.getTextArea=function(){return a};c.toTextArea=function(){c.toTextArea=isNaN;d();a.parentNode.removeChild(c.getWrapperElement());a.style.display="";if(a.form){qa(a.form,"submit",d);if(!b.leaveSubmitMethodAlone&&typeof a.form.submit=="function"){a.form.submit=e}}}};a.style.display="none";var h=Jh(function(b){return a.parentNode.insertBefore(b,a.nextSibling)},b);return h}function fi(a){a.off=qa;a.on=oa;a.wheelEventPixels=af;a.Doc=vg;a.splitLines=Ha;a.countColumn=M;a.findColumn=U;a.isWordChar=ba;a.Pass=Q;a.signal=ra;a.Line=hc;a.changeEnd=gf;a.scrollbarModel=se;a.Pos=eb;a.cmpPos=fb;a.modes=Ma;a.mimeModes=Na;a.resolveMode=Qa;a.getMode=Ra;a.modeExtensions=Sa;a.extendMode=Ta;a.copyState=Ua;a.startState=Wa;a.innerMode=Va;a.commands=Xg;a.keyMap=Kg;a.keyName=Qg;a.isModifierKey=Og;a.lookupKey=Ng;a.normalizeKeyMap=Mg;a.StringStream=Xa;a.SharedTextMarker=pg;a.TextMarker=ng;a.LineWidget=jg;a.e_preventDefault=wa;a.e_stopPropagation=xa;a.e_stop=za;a.addClass=H;a.contains=F;a.rmClass=z;a.keyNames=Gg}Gh(Jh);Vh(Jh);var gi="iter insert remove copy getEditor constructor".split(" ");for(var hi in vg.prototype){if(vg.prototype.hasOwnProperty(hi)&&O(gi,hi)<0){Jh.prototype[hi]=function(a){return function(){return a.apply(this.doc,arguments)}}(vg.prototype[hi])}}va(vg);Jh.inputStyles={textarea:di,contenteditable:Yh};Jh.defineMode=function(a){if(!Jh.defaults.mode&&a!="null"){Jh.defaults.mode=a}Oa.apply(this,arguments)};Jh.defineMIME=Pa;Jh.defineMode("null",function(){return{token:function(a){return a.skipToEnd()}}});Jh.defineMIME("text/plain","null");Jh.defineExtension=function(a,b){Jh.prototype[a]=b};Jh.defineDocExtension=function(a,b){vg.prototype[a]=b};Jh.fromTextArea=ei;fi(Jh);Jh.version="5.57.0";return Jh});(function(a){if(typeof exports=="object"&&typeof module=="object")a(require("../../lib/codemirror"));else if(typeof define=="function"&&define.amd)define(["../../lib/codemirror"],a);else a(CodeMirror)})(function(a){function b(b,c,d){var e=b.getWrapperElement();var f;f=e.appendChild(document.createElement("div"));if(d)f.className="CodeMirror-dialog CodeMirror-dialog-bottom";else f.className="CodeMirror-dialog CodeMirror-dialog-top";if(typeof c=="string"){f.innerHTML=c}else{f.appendChild(c)}a.addClass(e,"dialog-opened");return f}function c(a,b){if(a.state.currentNotificationClose)a.state.currentNotificationClose();a.state.currentNotificationClose=b}a.defineExtension("openDialog",function(d,e,f){if(!f)f={};c(this,null);var g=b(this,d,f.bottom);var h=false,i=this;function j(b){if(typeof b=="string"){k.value=b}else{if(h)return;h=true;a.rmClass(g.parentNode,"dialog-opened");g.parentNode.removeChild(g);i.focus();if(f.onClose)f.onClose(g)}}var k=g.getElementsByTagName("input")[0],l;if(k){k.focus();if(f.value){k.value=f.value;if(f.selectValueOnOpen!==false){k.select()}}if(f.onInput)a.on(k,"input",function(a){f.onInput(a,k.value,j)});if(f.onKeyUp)a.on(k,"keyup",function(a){f.onKeyUp(a,k.value,j)});a.on(k,"keydown",function(b){if(f&&f.onKeyDown&&f.onKeyDown(b,k.value,j)){return}if(b.keyCode==27||f.closeOnEnter!==false&&b.keyCode==13){k.blur();a.e_stop(b);j()}if(b.keyCode==13)e(k.value,b)});if(f.closeOnBlur!==false)a.on(g,"focusout",function(a){if(a.relatedTarget!==null)j()})}else if(l=g.getElementsByTagName("button")[0]){a.on(l,"click",function(){j();i.focus()});if(f.closeOnBlur!==false)a.on(l,"blur",j);l.focus()}return j});a.defineExtension("openConfirm",function(d,e,f){c(this,null);var g=b(this,d,f&&f.bottom);var h=g.getElementsByTagName("button");var i=false,j=this,k=1;function l(){if(i)return;i=true;a.rmClass(g.parentNode,"dialog-opened");g.parentNode.removeChild(g);j.focus()}h[0].focus();for(var m=0;m<h.length;++m){var n=h[m];(function(b){a.on(n,"click",function(c){a.e_preventDefault(c);l();if(b)b(j)})})(e[m]);a.on(n,"blur",function(){--k;setTimeout(function(){if(k<=0)l()},200)});a.on(n,"focus",function(){++k})}});a.defineExtension("openNotification",function(d,e){c(this,j);var f=b(this,d,e&&e.bottom);var g=false,h;var i=e&&typeof e.duration!=="undefined"?e.duration:5e3;function j(){if(g)return;g=true;clearTimeout(h);a.rmClass(f.parentNode,"dialog-opened");f.parentNode.removeChild(f)}a.on(f,"click",function(b){a.e_preventDefault(b);j()});if(i)h=setTimeout(j,i);return j})});(function(a){if(typeof exports=="object"&&typeof module=="object")a(require("../../lib/codemirror"));else if(typeof define=="function"&&define.amd)define(["../../lib/codemirror"],a);else a(CodeMirror)})(function(a){var b={pairs:"()[]{}''\"\"",closeBefore:")]}'\":;>",triples:"",explode:"[]{}"};var c=a.Pos;a.defineOption("autoCloseBrackets",false,function(b,c,g){if(g&&g!=a.Init){b.removeKeyMap(e);b.state.closeBrackets=null}if(c){f(d(c,"pairs"));b.state.closeBrackets=c;b.addKeyMap(e)}});function d(a,c){if(c=="pairs"&&typeof a=="string")return a;if(typeof a=="object"&&a[c]!=null)return a[c];return b[c]}var e={Backspace:i,Enter:j};function f(a){for(var b=0;b<a.length;b++){var c=a.charAt(b),d="'"+c+"'";if(!e[d])e[d]=g(c)}}f(b.pairs+"`");function g(a){return function(b){return l(b,a)}}function h(a){var b=a.state.closeBrackets;if(!b||b.override)return b;var c=a.getModeAt(a.getCursor());return c.closeBrackets||b}function i(b){var e=h(b);if(!e||b.getOption("disableInput"))return a.Pass;var f=d(e,"pairs");var g=b.listSelections();for(var i=0;i<g.length;i++){if(!g[i].empty())return a.Pass;var j=m(b,g[i].head);if(!j||f.indexOf(j)%2!=0)return a.Pass}for(var i=g.length-1;i>=0;i--){var k=g[i].head;b.replaceRange("",c(k.line,k.ch-1),c(k.line,k.ch+1),"+delete")}}function j(b){var c=h(b);var e=c&&d(c,"explode");if(!e||b.getOption("disableInput"))return a.Pass;var f=b.listSelections();for(var g=0;g<f.length;g++){if(!f[g].empty())return a.Pass;var i=m(b,f[g].head);if(!i||e.indexOf(i)%2!=0)return a.Pass}b.operation(function(){var a=b.lineSeparator()||"\n";b.replaceSelection(a+a,null);b.execCommand("goCharLeft");f=b.listSelections();for(var c=0;c<f.length;c++){var d=f[c].head.line;b.indentLine(d,null,true);b.indentLine(d+1,null,true)}})}function k(b){var d=a.cmpPos(b.anchor,b.head)>0;return{anchor:new c(b.anchor.line,b.anchor.ch+(d?-1:1)),head:new c(b.head.line,b.head.ch+(d?1:-1))}}function l(b,e){var f=h(b);if(!f||b.getOption("disableInput"))return a.Pass;var g=d(f,"pairs");var i=g.indexOf(e);if(i==-1)return a.Pass;var j=d(f,"closeBefore");var l=d(f,"triples");var m=g.charAt(i+1)==e;var o=b.listSelections();var p=i%2==0;var q;for(var r=0;r<o.length;r++){var s=o[r],t=s.head,u;var v=b.getRange(t,c(t.line,t.ch+1));if(p&&!s.empty()){u="surround"}else if((m||!p)&&v==e){if(m&&n(b,t))u="both";else if(l.indexOf(e)>=0&&b.getRange(t,c(t.line,t.ch+3))==e+e+e)u="skipThree";else u="skip"}else if(m&&t.ch>1&&l.indexOf(e)>=0&&b.getRange(c(t.line,t.ch-2),t)==e+e){if(t.ch>2&&/\bstring/.test(b.getTokenTypeAt(c(t.line,t.ch-2))))return a.Pass;u="addFour"}else if(m){var w=t.ch==0?" ":b.getRange(c(t.line,t.ch-1),t);if(!a.isWordChar(v)&&w!=e&&!a.isWordChar(w))u="both";else return a.Pass}else if(p&&(v.length===0||/\s/.test(v)||j.indexOf(v)>-1)){u="both"}else{return a.Pass}if(!q)q=u;else if(q!=u)return a.Pass}var x=i%2?g.charAt(i-1):e;var y=i%2?e:g.charAt(i+1);b.operation(function(){if(q=="skip"){b.execCommand("goCharRight")}else if(q=="skipThree"){for(var a=0;a<3;a++)b.execCommand("goCharRight")}else if(q=="surround"){var c=b.getSelections();for(var a=0;a<c.length;a++)c[a]=x+c[a]+y;b.replaceSelections(c,"around");c=b.listSelections().slice();for(var a=0;a<c.length;a++)c[a]=k(c[a]);b.setSelections(c)}else if(q=="both"){b.replaceSelection(x+y,null);b.triggerElectric(x+y);b.execCommand("goCharLeft")}else if(q=="addFour"){b.replaceSelection(x+x+x+x,"before");b.execCommand("goCharRight")}})}function m(a,b){var d=a.getRange(c(b.line,b.ch-1),c(b.line,b.ch+1));return d.length==2?d:null}function n(a,b){var d=a.getTokenAt(c(b.line,b.ch+1));return/\bstring/.test(d.type)&&d.start==b.ch&&(b.ch==0||!/\bstring/.test(a.getTokenTypeAt(b)))}});(function(a){if(typeof exports=="object"&&typeof module=="object")a(require("../../lib/codemirror"));else if(typeof define=="function"&&define.amd)define(["../../lib/codemirror"],a);else a(CodeMirror)})(function(a){var b=/MSIE \d/.test(navigator.userAgent)&&(document.documentMode==null||document.documentMode<8);var c=a.Pos;var d={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<","<":">>",">":"<<"};function e(a){return a&&a.bracketRegex||/[(){}[\]]/}function f(a,b,f){var h=a.getLineHandle(b.line),i=b.ch-1;var j=f&&f.afterCursor;if(j==null)j=/(^| )cm-fat-cursor($| )/.test(a.getWrapperElement().className);var k=e(f);var l=!j&&i>=0&&k.test(h.text.charAt(i))&&d[h.text.charAt(i)]||k.test(h.text.charAt(i+1))&&d[h.text.charAt(++i)];if(!l)return null;var m=l.charAt(1)==">"?1:-1;if(f&&f.strict&&m>0!=(i==b.ch))return null;var n=a.getTokenTypeAt(c(b.line,i+1));var o=g(a,c(b.line,i+(m>0?1:0)),m,n||null,f);if(o==null)return null;return{from:c(b.line,i),to:o&&o.pos,match:o&&o.ch==l.charAt(0),forward:m>0}}function g(a,b,f,g,h){var i=h&&h.maxScanLineLength||1e4;var j=h&&h.maxScanLines||1e3;var k=[];var l=e(h);var m=f>0?Math.min(b.line+j,a.lastLine()+1):Math.max(a.firstLine()-1,b.line-j);for(var n=b.line;n!=m;n+=f){var o=a.getLine(n);if(!o)continue;var p=f>0?0:o.length-1,q=f>0?o.length:-1;if(o.length>i)continue;if(n==b.line)p=b.ch-(f<0?1:0);for(;p!=q;p+=f){var r=o.charAt(p);if(l.test(r)&&(g===undefined||a.getTokenTypeAt(c(n,p+1))==g)){var s=d[r];if(s&&s.charAt(1)==">"==f>0)k.push(r);else if(!k.length)return{pos:c(n,p),ch:r};else k.pop()}}}return n-f==(f>0?a.lastLine():a.firstLine())?false:null}function h(a,d,e){var g=a.state.matchBrackets.maxHighlightLineLength||1e3;var h=[],i=a.listSelections();for(var j=0;j<i.length;j++){var k=i[j].empty()&&f(a,i[j].head,e);if(k&&a.getLine(k.from.line).length<=g){var l=k.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket";h.push(a.markText(k.from,c(k.from.line,k.from.ch+1),{className:l}));if(k.to&&a.getLine(k.to.line).length<=g)h.push(a.markText(k.to,c(k.to.line,k.to.ch+1),{className:l}))}}if(h.length){if(b&&a.state.focused)a.focus();var m=function(){a.operation(function(){for(var a=0;a<h.length;a++)h[a].clear()})};if(d)setTimeout(m,800);else return m}}function i(a){a.operation(function(){if(a.state.matchBrackets.currentlyHighlighted){a.state.matchBrackets.currentlyHighlighted();a.state.matchBrackets.currentlyHighlighted=null}a.state.matchBrackets.currentlyHighlighted=h(a,false,a.state.matchBrackets)})}a.defineOption("matchBrackets",false,function(b,c,d){function e(a){if(a.state.matchBrackets&&a.state.matchBrackets.currentlyHighlighted){a.state.matchBrackets.currentlyHighlighted();a.state.matchBrackets.currentlyHighlighted=null}}if(d&&d!=a.Init){b.off("cursorActivity",i);b.off("focus",i);b.off("blur",e);e(b)}if(c){b.state.matchBrackets=typeof c=="object"?c:{};b.on("cursorActivity",i);b.on("focus",i);b.on("blur",e)}});a.defineExtension("matchBrackets",function(){h(this,true)});a.defineExtension("findMatchingBracket",function(a,b,c){if(c||typeof b=="boolean"){if(!c){b=b?{strict:true}:null}else{c.strict=b;b=c}}return f(this,a,b)});a.defineExtension("scanForBracket",function(a,b,c,d){return g(this,a,b,c,d)})});(function(a){if(typeof exports=="object"&&typeof module=="object")a(require("../../lib/codemirror"),"cjs");else if(typeof define=="function"&&define.amd)define(["../../lib/codemirror"],function(b){a(b,"amd")});else a(CodeMirror,"plain")})(function(a,b){if(!a.modeURL)a.modeURL="../mode/%N/%N.js";var c={};function d(a,b){var c=b;return function(){if(--c==0)a()}}function e(b,c,e){var f=a.modes[b],g=f&&f.dependencies;if(!g)return c();var h=[];for(var i=0;i<g.length;++i){if(!a.modes.hasOwnProperty(g[i]))h.push(g[i])}if(!h.length)return c();var j=d(c,h.length);for(var i=0;i<h.length;++i)a.requireMode(h[i],j,e)}a.requireMode=function(d,f,g){if(typeof d!="string")d=d.name;if(a.modes.hasOwnProperty(d))return e(d,f,g);if(c.hasOwnProperty(d))return c[d].push(f);var h=g&&g.path?g.path(d):a.modeURL.replace(/%N/g,d);if(g&&g.loadMode){g.loadMode(h,function(){e(d,f,g)})}else if(b=="plain"){var i=document.createElement("script");i.src=h;var j=document.getElementsByTagName("script")[0];var k=c[d]=[f];a.on(i,"load",function(){e(d,function(){for(var a=0;a<k.length;++a)k[a]()},g)});j.parentNode.insertBefore(i,j)}else if(b=="cjs"){require(h);f()}else if(b=="amd"){requirejs([h],f)}};a.autoLoadMode=function(b,c,d){if(!a.modes.hasOwnProperty(c))a.requireMode(c,function(){b.setOption("mode",b.getOption("mode"))},d)}});(function(a){if(typeof exports=="object"&&typeof module=="object")a(require("../../lib/codemirror"));else if(typeof define=="function"&&define.amd)define(["../../lib/codemirror"],a);else a(CodeMirror)})(function(a){"use strict";a.multiplexingMode=function(b){var c=Array.prototype.slice.call(arguments,1);function d(a,b,c,d){if(typeof b=="string"){var e=a.indexOf(b,c);return d&&e>-1?e+b.length:e}var f=b.exec(c?a.slice(c):a);return f?f.index+c+(d?f[0].length:0):-1}return{startState:function(){return{outer:a.startState(b),innerActive:null,inner:null}},copyState:function(c){return{outer:a.copyState(b,c.outer),innerActive:c.innerActive,inner:c.innerActive&&a.copyState(c.innerActive.mode,c.inner)}},token:function(e,f){if(!f.innerActive){var g=Infinity,h=e.string;for(var i=0;i<c.length;++i){var j=c[i];var k=d(h,j.open,e.pos);if(k==e.pos){if(!j.parseDelimiters)e.match(j.open);f.innerActive=j;var l=0;if(b.indent){var m=b.indent(f.outer,"","");if(m!==a.Pass)l=m}f.inner=a.startState(j.mode,l);return j.delimStyle&&j.delimStyle+" "+j.delimStyle+"-open"}else if(k!=-1&&k<g){g=k}}if(g!=Infinity)e.string=h.slice(0,g);var n=b.token(e,f.outer);if(g!=Infinity)e.string=h;return n}else{var o=f.innerActive,h=e.string;if(!o.close&&e.sol()){f.innerActive=f.inner=null;return this.token(e,f)}var k=o.close?d(h,o.close,e.pos,o.parseDelimiters):-1;if(k==e.pos&&!o.parseDelimiters){e.match(o.close);f.innerActive=f.inner=null;return o.delimStyle&&o.delimStyle+" "+o.delimStyle+"-close"}if(k>-1)e.string=h.slice(0,k);var p=o.mode.token(e,f.inner);if(k>-1)e.string=h;if(k==e.pos&&o.parseDelimiters)f.innerActive=f.inner=null;if(o.innerStyle){if(p)p=p+" "+o.innerStyle;else p=o.innerStyle}return p}},indent:function(c,d,e){var f=c.innerActive?c.innerActive.mode:b;if(!f.indent)return a.Pass;return f.indent(c.innerActive?c.inner:c.outer,d,e)},blankLine:function(d){var e=d.innerActive?d.innerActive.mode:b;if(e.blankLine){ 7e.blankLine(d.innerActive?d.inner:d.outer)}if(!d.innerActive){for(var f=0;f<c.length;++f){var g=c[f];if(g.open==="\n"){d.innerActive=g;d.inner=a.startState(g.mode,e.indent?e.indent(d.outer,"",""):0)}}}else if(d.innerActive.close==="\n"){d.innerActive=d.inner=null}},electricChars:b.electricChars,innerMode:function(a){return a.inner?{state:a.inner,mode:a.innerActive.mode}:{state:a.outer,mode:b}}}}});(function(a){if(typeof exports=="object"&&typeof module=="object")a(require("../../lib/codemirror"));else if(typeof define=="function"&&define.amd)define(["../../lib/codemirror"],a);else a(CodeMirror)})(function(a){"use strict";a.overlayMode=function(b,c,d){return{startState:function(){return{base:a.startState(b),overlay:a.startState(c),basePos:0,baseCur:null,overlayPos:0,overlayCur:null,streamSeen:null}},copyState:function(d){return{base:a.copyState(b,d.base),overlay:a.copyState(c,d.overlay),basePos:d.basePos,baseCur:null,overlayPos:d.overlayPos,overlayCur:null}},token:function(a,e){if(a!=e.streamSeen||Math.min(e.basePos,e.overlayPos)<a.start){e.streamSeen=a;e.basePos=e.overlayPos=a.start}if(a.start==e.basePos){e.baseCur=b.token(a,e.base);e.basePos=a.pos}if(a.start==e.overlayPos){a.pos=a.start;e.overlayCur=c.token(a,e.overlay);e.overlayPos=a.pos}a.pos=Math.min(e.basePos,e.overlayPos);if(e.overlayCur==null)return e.baseCur;else if(e.baseCur!=null&&e.overlay.combineTokens||d&&e.overlay.combineTokens==null)return e.baseCur+" "+e.overlayCur;else return e.overlayCur},indent:b.indent&&function(a,c,d){return b.indent(a.base,c,d)},electricChars:b.electricChars,innerMode:function(a){return{state:a.base,mode:b}},blankLine:function(a){var e,f;if(b.blankLine)e=b.blankLine(a.base);if(c.blankLine)f=c.blankLine(a.overlay);return f==null?e:d&&e!=null?e+" "+f:f}}}});(function(a){if(typeof exports=="object"&&typeof module=="object")a(require("../../lib/codemirror"));else if(typeof define=="function"&&define.amd)define(["../../lib/codemirror"],a);else a(CodeMirror)})(function(a){"use strict";a.defineSimpleMode=function(b,c){a.defineMode(b,function(b){return a.simpleMode(b,c)})};a.simpleMode=function(c,d){b(d,"start");var g={},h=d.meta||{},i=false;for(var k in d)if(k!=h&&d.hasOwnProperty(k)){var l=g[k]=[],m=d[k];for(var n=0;n<m.length;n++){var o=m[n];l.push(new e(o,d));if(o.indent||o.dedent)i=true}}var p={startState:function(){return{state:"start",pending:null,local:null,localState:null,indent:i?[]:null}},copyState:function(b){var c={state:b.state,pending:b.pending,local:b.local,localState:null,indent:b.indent&&b.indent.slice(0)};if(b.localState)c.localState=a.copyState(b.local.mode,b.localState);if(b.stack)c.stack=b.stack.slice(0);for(var d=b.persistentStates;d;d=d.next)c.persistentStates={mode:d.mode,spec:d.spec,state:d.state==b.localState?c.localState:a.copyState(d.mode,d.state),next:c.persistentStates};return c},token:f(g,c),innerMode:function(a){return a.local&&{mode:a.local.mode,state:a.localState}},indent:j(g,h)};if(h)for(var q in h)if(h.hasOwnProperty(q))p[q]=h[q];return p};function b(a,b){if(!a.hasOwnProperty(b))throw new Error("Undefined state "+b+" in simple mode")}function c(a,b){if(!a)return/(?:)/;var c="";if(a instanceof RegExp){if(a.ignoreCase)c="i";a=a.source}else{a=String(a)}return new RegExp((b===false?"":"^")+"(?:"+a+")",c)}function d(a){if(!a)return null;if(a.apply)return a;if(typeof a=="string")return a.replace(/\./g," ");var b=[];for(var c=0;c<a.length;c++)b.push(a[c]&&a[c].replace(/\./g," "));return b}function e(a,e){if(a.next||a.push)b(e,a.next||a.push);this.regex=c(a.regex);this.token=d(a.token);this.data=a}function f(a,b){return function(c,d){if(d.pending){var e=d.pending.shift();if(d.pending.length==0)d.pending=null;c.pos+=e.text.length;return e.token}if(d.local){if(d.local.end&&c.match(d.local.end)){var f=d.local.endToken||null;d.local=d.localState=null;return f}else{var f=d.local.mode.token(c,d.localState),g;if(d.local.endScan&&(g=d.local.endScan.exec(c.current())))c.pos=c.start+g.index;return f}}var i=a[d.state];for(var j=0;j<i.length;j++){var k=i[j];var l=(!k.data.sol||c.sol())&&c.match(k.regex);if(l){if(k.data.next){d.state=k.data.next}else if(k.data.push){(d.stack||(d.stack=[])).push(d.state);d.state=k.data.push}else if(k.data.pop&&d.stack&&d.stack.length){d.state=d.stack.pop()}if(k.data.mode)h(b,d,k.data.mode,k.token);if(k.data.indent)d.indent.push(c.indentation()+b.indentUnit);if(k.data.dedent)d.indent.pop();var m=k.token;if(m&&m.apply)m=m(l);if(l.length>2&&k.token&&typeof k.token!="string"){d.pending=[];for(var n=2;n<l.length;n++)if(l[n])d.pending.push({text:l[n],token:k.token[n-1]});c.backUp(l[0].length-(l[1]?l[1].length:0));return m[0]}else if(m&&m.join){return m[0]}else{return m}}}c.next();return null}}function g(a,b){if(a===b)return true;if(!a||typeof a!="object"||!b||typeof b!="object")return false;var c=0;for(var d in a)if(a.hasOwnProperty(d)){if(!b.hasOwnProperty(d)||!g(a[d],b[d]))return false;c++}for(var d in b)if(b.hasOwnProperty(d))c--;return c==0}function h(b,d,e,f){var h;if(e.persistent)for(var i=d.persistentStates;i&&!h;i=i.next)if(e.spec?g(e.spec,i.spec):e.mode==i.mode)h=i;var j=h?h.mode:e.mode||a.getMode(b,e.spec);var k=h?h.state:a.startState(j);if(e.persistent&&!h)d.persistentStates={mode:j,spec:e.spec,state:k,next:d.persistentStates};d.localState=k;d.local={mode:j,end:e.end&&c(e.end),endScan:e.end&&e.forceEnd!==false&&c(e.end,false),endToken:f&&f.join?f[f.length-1]:f}}function i(a,b){for(var c=0;c<b.length;c++)if(b[c]===a)return true}function j(b,c){return function(d,e,f){if(d.local&&d.local.mode.indent)return d.local.mode.indent(d.localState,e,f);if(d.indent==null||d.local||c.dontIndentStates&&i(d.state,c.dontIndentStates)>-1)return a.Pass;var g=d.indent.length-1,h=b[d.state];a:for(;;){for(var j=0;j<h.length;j++){var k=h[j];if(k.data.dedent&&k.data.dedentIfLineStart!==false){var l=k.regex.exec(e);if(l&&l[0]){g--;if(k.next||k.push)h=b[k.next||k.push];e=e.slice(l[0].length);continue a}}}break}return g<0?0:d.indent[g]}}});(function(a){if(typeof exports=="object"&&typeof module=="object")a(require("../../lib/codemirror"));else if(typeof define=="function"&&define.amd)define(["../../lib/codemirror"],a);else a(CodeMirror)})(function(a){"use strict";a.runMode=function(b,c,d,e){var f=a.getMode(a.defaults,c);var g=e&&e.tabSize||a.defaults.tabSize;if(d.appendChild){var h=/MSIE \d/.test(navigator.userAgent);var i=h&&(document.documentMode==null||document.documentMode<9);var j=d,k=0;j.innerHTML="";d=function(a,b){if(a=="\n"){j.appendChild(document.createTextNode(i?"\r":a));k=0;return}var c="";for(var d=0;;){var e=a.indexOf("\t",d);if(e==-1){c+=a.slice(d);k+=a.length-d;break}else{k+=e-d;c+=a.slice(d,e);var f=g-k%g;k+=f;for(var h=0;h<f;++h)c+=" ";d=e+1}}if(b){var l=j.appendChild(document.createElement("span"));l.className="cm-"+b.replace(/ +/g," cm-");l.appendChild(document.createTextNode(c))}else{j.appendChild(document.createTextNode(c))}}}var l=a.splitLines(b),m=e&&e.state||a.startState(f);for(var n=0,o=l.length;n<o;++n){if(n)d("\n");var p=new a.StringStream(l[n],null,{lookAhead:function(a){return l[n+a]},baseToken:function(){}});if(!p.string&&f.blankLine)f.blankLine(m);while(!p.eol()){var q=f.token(p,m);d(p.current(),q,n,p.start,m);p.start=p.pos}}}});(function(a){if(typeof exports=="object"&&typeof module=="object")a(require("../../lib/codemirror"),require("../dialog/dialog"));else if(typeof define=="function"&&define.amd)define(["../../lib/codemirror","../dialog/dialog"],a);else a(CodeMirror)})(function(a){"use strict";function b(a,b,c,d,e){if(a.openDialog)a.openDialog(b,e,{value:d,selectValueOnOpen:true});else e(prompt(c,d))}function c(a){return a.phrase("Jump to line:")+' <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">'+a.phrase("(Use line:column or scroll% syntax)")+"</span>"}function d(a,b){var c=Number(b);if(/^[-+]/.test(b))return a.getCursor().line+c;else return c-1}a.commands.jumpToLine=function(a){var e=a.getCursor();b(a,c(a),a.phrase("Jump to line:"),e.line+1+":"+e.ch,function(b){if(!b)return;var c;if(c=/^\s*([\+\-]?\d+)\s*\:\s*(\d+)\s*$/.exec(b)){a.setCursor(d(a,c[1]),Number(c[2]))}else if(c=/^\s*([\+\-]?\d+(\.\d+)?)\%\s*/.exec(b)){var f=Math.round(a.lineCount()*Number(c[1])/100);if(/^[-+]/.test(c[1]))f=e.line+f+1;a.setCursor(f-1,e.ch)}else if(c=/^\s*\:?\s*([\+\-]?\d+)\s*/.exec(b)){a.setCursor(d(a,c[1]),e.ch)}})};a.keyMap["default"]["Alt-G"]="jumpToLine"});(function(a){if(typeof exports=="object"&&typeof module=="object")a(require("../../lib/codemirror"),require("./searchcursor"),require("../scroll/annotatescrollbar"));else if(typeof define=="function"&&define.amd)define(["../../lib/codemirror","./searchcursor","../scroll/annotatescrollbar"],a);else a(CodeMirror)})(function(a){"use strict";a.defineExtension("showMatchesOnScrollbar",function(a,c,d){if(typeof d=="string")d={className:d};if(!d)d={};return new b(this,a,c,d)});function b(a,b,c,d){this.cm=a;this.options=d;var e={listenForChanges:false};for(var f in d)e[f]=d[f];if(!e.className)e.className="CodeMirror-search-match";this.annotation=a.annotateScrollbar(e);this.query=b;this.caseFold=c;this.gap={from:a.firstLine(),to:a.lastLine()+1};this.matches=[];this.update=null;this.findMatches();this.annotation.update(this.matches);var g=this;a.on("change",this.changeHandler=function(a,b){g.onChange(b)})}var c=1e3;b.prototype.findMatches=function(){if(!this.gap)return;for(var b=0;b<this.matches.length;b++){var d=this.matches[b];if(d.from.line>=this.gap.to)break;if(d.to.line>=this.gap.from)this.matches.splice(b--,1)}var e=this.cm.getSearchCursor(this.query,a.Pos(this.gap.from,0),{caseFold:this.caseFold,multiline:this.options.multiline});var f=this.options&&this.options.maxMatches||c;while(e.findNext()){var d={from:e.from(),to:e.to()};if(d.from.line>=this.gap.to)break;this.matches.splice(b++,0,d);if(this.matches.length>f)break}this.gap=null};function d(a,b,c){if(a<=b)return a;return Math.max(b,a+c)}b.prototype.onChange=function(b){var c=b.from.line;var e=a.changeEnd(b).line;var f=e-b.to.line;if(this.gap){this.gap.from=Math.min(d(this.gap.from,c,f),b.from.line);this.gap.to=Math.max(d(this.gap.to,c,f),b.from.line)}else{this.gap={from:b.from.line,to:e+1}}if(f)for(var g=0;g<this.matches.length;g++){var h=this.matches[g];var i=d(h.from.line,c,f);if(i!=h.from.line)h.from=a.Pos(i,h.from.ch);var j=d(h.to.line,c,f);if(j!=h.to.line)h.to=a.Pos(j,h.to.ch)}clearTimeout(this.update);var k=this;this.update=setTimeout(function(){k.updateAfterChange()},250)};b.prototype.updateAfterChange=function(){this.findMatches();this.annotation.update(this.matches)};b.prototype.clear=function(){this.cm.off("change",this.changeHandler);this.annotation.clear()}});(function(a){if(typeof exports=="object"&&typeof module=="object")a(require("../../lib/codemirror"));else if(typeof define=="function"&&define.amd)define(["../../lib/codemirror"],a);else a(CodeMirror)})(function(a){"use strict";var b=a.Pos;function c(a){var b=a.flags;return b!=null?b:(a.ignoreCase?"i":"")+(a.global?"g":"")+(a.multiline?"m":"")}function d(a,b){var d=c(a),e=d;for(var f=0;f<b.length;f++)if(e.indexOf(b.charAt(f))==-1)e+=b.charAt(f);return d==e?a:new RegExp(a.source,e)}function e(a){return/\\s|\\n|\n|\\W|\\D|\[\^/.test(a.source)}function f(a,c,e){c=d(c,"g");for(var f=e.line,g=e.ch,h=a.lastLine();f<=h;f++,g=0){c.lastIndex=g;var i=a.getLine(f),j=c.exec(i);if(j)return{from:b(f,j.index),to:b(f,j.index+j[0].length),match:j}}}function g(a,c,g){if(!e(c))return f(a,c,g);c=d(c,"gm");var h,i=1;for(var j=g.line,k=a.lastLine();j<=k;){for(var l=0;l<i;l++){if(j>k)break;var m=a.getLine(j++);h=h==null?m:h+"\n"+m}i=i*2;c.lastIndex=g.ch;var n=c.exec(h);if(n){var o=h.slice(0,n.index).split("\n"),p=n[0].split("\n");var q=g.line+o.length-1,r=o[o.length-1].length;return{from:b(q,r),to:b(q+p.length-1,p.length==1?r+p[0].length:p[p.length-1].length),match:n}}}}function h(a,b,c){var d,e=0;while(e<=a.length){b.lastIndex=e;var f=b.exec(a);if(!f)break;var g=f.index+f[0].length;if(g>a.length-c)break;if(!d||g>d.index+d[0].length)d=f;e=f.index+1}return d}function i(a,c,e){c=d(c,"g");for(var f=e.line,g=e.ch,i=a.firstLine();f>=i;f--,g=-1){var j=a.getLine(f);var k=h(j,c,g<0?0:j.length-g);if(k)return{from:b(f,k.index),to:b(f,k.index+k[0].length),match:k}}}function j(a,c,f){if(!e(c))return i(a,c,f);c=d(c,"gm");var g,j=1,k=a.getLine(f.line).length-f.ch;for(var l=f.line,m=a.firstLine();l>=m;){for(var n=0;n<j&&l>=m;n++){var o=a.getLine(l--);g=g==null?o:o+"\n"+g}j*=2;var p=h(g,c,k);if(p){var q=g.slice(0,p.index).split("\n"),r=p[0].split("\n");var s=l+q.length,t=q[q.length-1].length;return{from:b(s,t),to:b(s+r.length-1,r.length==1?t+r[0].length:r[r.length-1].length),match:p}}}}var k,l;if(String.prototype.normalize){k=function(a){return a.normalize("NFD").toLowerCase()};l=function(a){return a.normalize("NFD")}}else{k=function(a){return a.toLowerCase()};l=function(a){return a}}function m(a,b,c,d){if(a.length==b.length)return c;for(var e=0,f=c+Math.max(0,a.length-b.length);;){if(e==f)return e;var g=e+f>>1;var h=d(a.slice(0,g)).length;if(h==c)return g;else if(h>c)f=g;else e=g+1}}function n(a,c,d,e){if(!c.length)return null;var f=e?k:l;var g=f(c).split(/\r|\n\r?/);a:for(var h=d.line,i=d.ch,j=a.lastLine()+1-g.length;h<=j;h++,i=0){var n=a.getLine(h).slice(i),o=f(n);if(g.length==1){var p=o.indexOf(g[0]);if(p==-1)continue a;var d=m(n,o,p,f)+i;return{from:b(h,m(n,o,p,f)+i),to:b(h,m(n,o,p+g[0].length,f)+i)}}else{var q=o.length-g[0].length;if(o.slice(q)!=g[0])continue a;for(var r=1;r<g.length-1;r++)if(f(a.getLine(h+r))!=g[r])continue a;var s=a.getLine(h+g.length-1),t=f(s),u=g[g.length-1];if(t.slice(0,u.length)!=u)continue a;return{from:b(h,m(n,o,q,f)+i),to:b(h+g.length-1,m(s,t,u.length,f))}}}}function o(a,c,d,e){if(!c.length)return null;var f=e?k:l;var g=f(c).split(/\r|\n\r?/);a:for(var h=d.line,i=d.ch,j=a.firstLine()-1+g.length;h>=j;h--,i=-1){var n=a.getLine(h);if(i>-1)n=n.slice(0,i);var o=f(n);if(g.length==1){var p=o.lastIndexOf(g[0]);if(p==-1)continue a;return{from:b(h,m(n,o,p,f)),to:b(h,m(n,o,p+g[0].length,f))}}else{var q=g[g.length-1];if(o.slice(0,q.length)!=q)continue a;for(var r=1,d=h-g.length+1;r<g.length-1;r++)if(f(a.getLine(d+r))!=g[r])continue a;var s=a.getLine(h+1-g.length),t=f(s);if(t.slice(t.length-g[0].length)!=g[0])continue a;return{from:b(h+1-g.length,m(s,t,s.length-g[0].length,f)),to:b(h,m(n,o,q.length,f))}}}}function p(a,c,e,h){this.atOccurrence=false;this.doc=a;e=e?a.clipPos(e):b(0,0);this.pos={from:e,to:e};var k;if(typeof h=="object"){k=h.caseFold}else{k=h;h=null}if(typeof c=="string"){if(k==null)k=false;this.matches=function(b,d){return(b?o:n)(a,c,d,k)}}else{c=d(c,"gm");if(!h||h.multiline!==false)this.matches=function(b,d){return(b?j:g)(a,c,d)};else this.matches=function(b,d){return(b?i:f)(a,c,d)}}}p.prototype={findNext:function(){return this.find(false)},findPrevious:function(){return this.find(true)},find:function(c){var d=this.matches(c,this.doc.clipPos(c?this.pos.from:this.pos.to));while(d&&a.cmpPos(d.from,d.to)==0){if(c){if(d.from.ch)d.from=b(d.from.line,d.from.ch-1);else if(d.from.line==this.doc.firstLine())d=null;else d=this.matches(c,this.doc.clipPos(b(d.from.line-1)))}else{if(d.to.ch<this.doc.getLine(d.to.line).length)d.to=b(d.to.line,d.to.ch+1);else if(d.to.line==this.doc.lastLine())d=null;else d=this.matches(c,b(d.to.line+1,0))}}if(d){this.pos=d;this.atOccurrence=true;return this.pos.match||true}else{var e=b(c?this.doc.firstLine():this.doc.lastLine()+1,0);this.pos={from:e,to:e};return this.atOccurrence=false}},from:function(){if(this.atOccurrence)return this.pos.from},to:function(){if(this.atOccurrence)return this.pos.to},replace:function(c,d){if(!this.atOccurrence)return;var e=a.splitLines(c);this.doc.replaceRange(e,this.pos.from,this.pos.to,d);this.pos.to=b(this.pos.from.line+e.length-1,e[e.length-1].length+(e.length==1?this.pos.from.ch:0))}};a.defineExtension("getSearchCursor",function(a,b,c){return new p(this.doc,a,b,c)});a.defineDocExtension("getSearchCursor",function(a,b,c){return new p(this,a,b,c)});a.defineExtension("selectMatches",function(b,c){var d=[];var e=this.getSearchCursor(b,this.getCursor("from"),c);while(e.findNext()){if(a.cmpPos(e.to(),this.getCursor("to"))>0)break;d.push({anchor:e.from(),head:e.to()})}if(d.length)this.setSelections(d,0)})});(function(a){if(typeof exports=="object"&&typeof module=="object")a(require("../../lib/codemirror"),require("./searchcursor"),require("../dialog/dialog"));else if(typeof define=="function"&&define.amd)define(["../../lib/codemirror","./searchcursor","../dialog/dialog"],a);else a(CodeMirror)})(function(a){"use strict";function b(a,b){if(typeof a=="string")a=new RegExp(a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),b?"gi":"g");else if(!a.global)a=new RegExp(a.source,a.ignoreCase?"gi":"g");return{token:function(b){a.lastIndex=b.pos;var c=a.exec(b.string);if(c&&c.index==b.pos){b.pos+=c[0].length||1;return"searching"}else if(c){b.pos=c.index}else{b.skipToEnd()}}}}function c(){this.posFrom=this.posTo=this.lastQuery=this.query=null;this.overlay=null}function d(a){return a.state.search||(a.state.search=new c)}function e(a){return typeof a=="string"&&a==a.toLowerCase()}function f(a,b,c){return a.getSearchCursor(b,c,{caseFold:e(b),multiline:true})}function g(a,b,c,d,e){a.openDialog(b,d,{value:c,selectValueOnOpen:true,closeOnEnter:false,onClose:function(){o(a)},onKeyDown:e})}function h(a,b,c,d,e){if(a.openDialog)a.openDialog(b,e,{value:d,selectValueOnOpen:true});else e(prompt(c,d))}function i(a,b,c,d){if(a.openConfirm)a.openConfirm(b,d);else if(confirm(c))d[0]()}function j(a){return a.replace(/\\([nrt\\])/g,function(a,b){if(b=="n")return"\n";if(b=="r")return"\r";if(b=="t")return"\t";if(b=="\\")return"\\";return a})}function k(a){var b=a.match(/^\/(.*)\/([a-z]*)$/);if(b){try{a=new RegExp(b[1],b[2].indexOf("i")==-1?"":"i")}catch(c){}}else{a=j(a)}if(typeof a=="string"?a=="":a.test(""))a=/x^/;return a}function l(a,c,d){c.queryText=d;c.query=k(d);a.removeOverlay(c.overlay,e(c.query));c.overlay=b(c.query,e(c.query));a.addOverlay(c.overlay);if(a.showMatchesOnScrollbar){if(c.annotate){c.annotate.clear();c.annotate=null}c.annotate=a.showMatchesOnScrollbar(c.query,e(c.query))}}function m(b,c,e,f){var i=d(b);if(i.query)return n(b,c);var j=b.getSelection()||i.lastQuery;if(j instanceof RegExp&&j.source=="x^")j=null;if(e&&b.openDialog){var k=null;var m=function(c,d){a.e_stop(d);if(!c)return;if(c!=i.queryText){l(b,i,c);i.posFrom=i.posTo=b.getCursor()}if(k)k.style.opacity=1;n(b,d.shiftKey,function(a,c){var d;if(c.line<3&&document.querySelector&&(d=b.display.wrapper.querySelector(".CodeMirror-dialog"))&&d.getBoundingClientRect().bottom-4>b.cursorCoords(c,"window").top)(k=d).style.opacity=.4})};g(b,p(b),j,m,function(c,e){var f=a.keyName(c);var g=b.getOption("extraKeys"),h=g&&g[f]||a.keyMap[b.getOption("keyMap")][f];if(h=="findNext"||h=="findPrev"||h=="findPersistentNext"||h=="findPersistentPrev"){a.e_stop(c);l(b,d(b),e);b.execCommand(h)}else if(h=="find"||h=="findPersistent"){a.e_stop(c);m(e,c)}});if(f&&j){l(b,i,j);n(b,c)}}else{h(b,p(b),"Search for:",j,function(a){if(a&&!i.query)b.operation(function(){l(b,i,a);i.posFrom=i.posTo=b.getCursor();n(b,c)})})}}function n(b,c,e){b.operation(function(){var g=d(b);var h=f(b,g.query,c?g.posFrom:g.posTo);if(!h.find(c)){h=f(b,g.query,c?a.Pos(b.lastLine()):a.Pos(b.firstLine(),0));if(!h.find(c))return}b.setSelection(h.from(),h.to());b.scrollIntoView({from:h.from(),to:h.to()},20);g.posFrom=h.from();g.posTo=h.to();if(e)e(h.from(),h.to())})}function o(a){a.operation(function(){var b=d(a);b.lastQuery=b.query;if(!b.query)return;b.query=b.queryText=null;a.removeOverlay(b.overlay);if(b.annotate){b.annotate.clear();b.annotate=null}})}function p(a){return'<span class="CodeMirror-search-label">'+a.phrase("Search:")+'</span> <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">'+a.phrase("(Use /re/ syntax for regexp search)")+"</span>"}function q(a){return' <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">'+a.phrase("(Use /re/ syntax for regexp search)")+"</span>"}function r(a){return'<span class="CodeMirror-search-label">'+a.phrase("With:")+'</span> <input type="text" style="width: 10em" class="CodeMirror-search-field"/>'}function s(a){return'<span class="CodeMirror-search-label">'+a.phrase("Replace?")+"</span> <button>"+a.phrase("Yes")+"</button> <button>"+a.phrase("No")+"</button> <button>"+a.phrase("All")+"</button> <button>"+a.phrase("Stop")+"</button> "}function t(a,b,c){a.operation(function(){for(var d=f(a,b);d.findNext();){if(typeof b!="string"){var e=a.getRange(d.from(),d.to()).match(b);d.replace(c.replace(/\$(\d)/g,function(a,b){return e[b]}))}else d.replace(c)}})}function u(a,b){if(a.getOption("readOnly"))return;var c=a.getSelection()||d(a).lastQuery;var e='<span class="CodeMirror-search-label">'+(b?a.phrase("Replace all:"):a.phrase("Replace:"))+"</span>";h(a,e+q(a),e,c,function(c){if(!c)return;c=k(c);h(a,r(a),a.phrase("Replace with:"),"",function(d){d=j(d);if(b){t(a,c,d)}else{o(a);var e=f(a,c,a.getCursor("from"));var g=function(){var b=e.from(),j;if(!(j=e.findNext())){e=f(a,c);if(!(j=e.findNext())||b&&e.from().line==b.line&&e.from().ch==b.ch)return}a.setSelection(e.from(),e.to());a.scrollIntoView({from:e.from(),to:e.to()});i(a,s(a),a.phrase("Replace?"),[function(){h(j)},g,function(){t(a,c,d)}])};var h=function(a){e.replace(typeof c=="string"?d:d.replace(/\$(\d)/g,function(b,c){return a[c]}));g()};g()}})})}a.commands.find=function(a){o(a);m(a)};a.commands.findPersistent=function(a){o(a);m(a,false,true)};a.commands.findPersistentNext=function(a){m(a,false,true,true)};a.commands.findPersistentPrev=function(a){m(a,true,true,true)};a.commands.findNext=m;a.commands.findPrev=function(a){m(a,true)};a.commands.clearSearch=o;a.commands.replace=u;a.commands.replaceAll=function(a){u(a,true)}});(function(a){if(typeof exports=="object"&&typeof module=="object")a(require("../../lib/codemirror"));else if(typeof define=="function"&&define.amd)define(["../../lib/codemirror"],a);else a(CodeMirror)})(function(a){"use strict";var b="CodeMirror-activeline";var c="CodeMirror-activeline-background";var d="CodeMirror-activeline-gutter";a.defineOption("styleActiveLine",false,function(b,c,d){var f=d==a.Init?false:d;if(c==f)return;if(f){b.off("beforeSelectionChange",h);e(b);delete b.state.activeLines}if(c){b.state.activeLines=[];g(b,b.listSelections());b.on("beforeSelectionChange",h)}});function e(a){for(var e=0;e<a.state.activeLines.length;e++){a.removeLineClass(a.state.activeLines[e],"wrap",b);a.removeLineClass(a.state.activeLines[e],"background",c);a.removeLineClass(a.state.activeLines[e],"gutter",d)}}function f(a,b){if(a.length!=b.length)return false;for(var c=0;c<a.length;c++)if(a[c]!=b[c])return false;return true}function g(a,g){var h=[];for(var i=0;i<g.length;i++){var j=g[i];var k=a.getOption("styleActiveLine");if(typeof k=="object"&&k.nonEmpty?j.anchor.line!=j.head.line:!j.empty())continue;var l=a.getLineHandleVisualStart(j.head.line);if(h[h.length-1]!=l)h.push(l)}if(f(a.state.activeLines,h))return;a.operation(function(){e(a);for(var f=0;f<h.length;f++){a.addLineClass(h[f],"wrap",b);a.addLineClass(h[f],"background",c);a.addLineClass(h[f],"gutter",d)}a.state.activeLines=h})}function h(a,b){g(a,b.ranges)}});(function(a){if(typeof exports=="object"&&typeof module=="object")a(require("../../lib/codemirror"));else if(typeof define=="function"&&define.amd)define(["../../lib/codemirror"],a);else a(CodeMirror)})(function(a){"use strict";a.defineExtension("annotateScrollbar",function(a){if(typeof a=="string")a={className:a};return new b(this,a)});a.defineOption("scrollButtonHeight",0);function b(a,b){this.cm=a;this.options=b;this.buttonHeight=b.scrollButtonHeight||a.getOption("scrollButtonHeight");this.annotations=[];this.doRedraw=this.doUpdate=null;this.div=a.getWrapperElement().appendChild(document.createElement("div"));this.div.style.cssText="position: absolute; right: 0; top: 0; z-index: 7; pointer-events: none";this.computeScale();function c(a){clearTimeout(d.doRedraw);d.doRedraw=setTimeout(function(){d.redraw()},a)}var d=this;a.on("refresh",this.resizeHandler=function(){clearTimeout(d.doUpdate);d.doUpdate=setTimeout(function(){if(d.computeScale())c(20)},100)});a.on("markerAdded",this.resizeHandler);a.on("markerCleared",this.resizeHandler);if(b.listenForChanges!==false)a.on("changes",this.changeHandler=function(){c(250)})}b.prototype.computeScale=function(){var a=this.cm;var b=(a.getWrapperElement().clientHeight-a.display.barHeight-this.buttonHeight*2)/a.getScrollerElement().scrollHeight;if(b!=this.hScale){this.hScale=b;return true}};b.prototype.update=function(a){this.annotations=a;this.redraw()};b.prototype.redraw=function(a){if(a!==false)this.computeScale();var b=this.cm,c=this.hScale;var d=document.createDocumentFragment(),e=this.annotations;var f=b.getOption("lineWrapping");var g=f&&b.defaultTextHeight()*1.5;var h=null,i=null;function j(a,c){if(h!=a.line){h=a.line;i=b.getLineHandle(a.line);var d=b.getLineHandleVisualStart(i);if(d!=i){h=b.getLineNumber(d);i=d}}if(i.widgets&&i.widgets.length||f&&i.height>g)return b.charCoords(a,"local")[c?"top":"bottom"];var e=b.heightAtLine(i,"local");return e+(c?0:i.height)}var k=b.lastLine();if(b.display.barWidth)for(var l=0,m;l<e.length;l++){var n=e[l];if(n.to.line>k)continue;var o=m||j(n.from,true)*c;var p=j(n.to,false)*c;while(l<e.length-1){if(e[l+1].to.line>k)break;m=j(e[l+1].from,true)*c;if(m>p+.9)break;n=e[++l];p=j(n.to,false)*c}if(p==o)continue;var q=Math.max(p-o,3);var r=d.appendChild(document.createElement("div"));r.style.cssText="position: absolute; right: 0px; width: "+Math.max(b.display.barWidth-1,2)+"px; top: "+(o+this.buttonHeight)+"px; height: "+q+"px";r.className=this.options.className;if(n.id){r.setAttribute("annotation-id",n.id)}}this.div.textContent="";this.div.appendChild(d)};b.prototype.clear=function(){this.cm.off("refresh",this.resizeHandler);this.cm.off("markerAdded",this.resizeHandler);this.cm.off("markerCleared",this.resizeHandler);if(this.changeHandler)this.cm.off("changes",this.changeHandler);this.div.parentNode.removeChild(this.div)}});(function(a){if(typeof exports=="object"&&typeof module=="object")a(require("../../lib/codemirror"));else if(typeof define=="function"&&define.amd)define(["../../lib/codemirror"],a);else a(CodeMirror)})(function(a){"use strict";function b(b,c,d){this.orientation=c;this.scroll=d;this.screen=this.total=this.size=1;this.pos=0;this.node=document.createElement("div");this.node.className=b+"-"+c;this.inner=this.node.appendChild(document.createElement("div"));var e=this;a.on(this.inner,"mousedown",function(b){if(b.which!=1)return;a.e_preventDefault(b);var c=e.orientation=="horizontal"?"pageX":"pageY";var d=b[c],f=e.pos;function g(){a.off(document,"mousemove",h);a.off(document,"mouseup",g)}function h(a){if(a.which!=1)return g();e.moveTo(f+(a[c]-d)*(e.total/e.size))}a.on(document,"mousemove",h);a.on(document,"mouseup",g)});a.on(this.node,"click",function(b){a.e_preventDefault(b);var c=e.inner.getBoundingClientRect(),d;if(e.orientation=="horizontal")d=b.clientX<c.left?-1:b.clientX>c.right?1:0;else d=b.clientY<c.top?-1:b.clientY>c.bottom?1:0;e.moveTo(e.pos+d*e.screen)});function f(b){var c=a.wheelEventPixels(b)[e.orientation=="horizontal"?"x":"y"];var d=e.pos;e.moveTo(e.pos+c);if(e.pos!=d)a.e_preventDefault(b)}a.on(this.node,"mousewheel",f);a.on(this.node,"DOMMouseScroll",f)}b.prototype.setPos=function(a,b){if(a<0)a=0;if(a>this.total-this.screen)a=this.total-this.screen;if(!b&&a==this.pos)return false;this.pos=a;this.inner.style[this.orientation=="horizontal"?"left":"top"]=a*(this.size/this.total)+"px";return true};b.prototype.moveTo=function(a){if(this.setPos(a))this.scroll(a,this.orientation)};var c=10;b.prototype.update=function(a,b,d){var e=this.screen!=b||this.total!=a||this.size!=d;if(e){this.screen=b;this.total=a;this.size=d}var f=this.screen*(this.size/this.total);if(f<c){this.size-=c-f;f=c}this.inner.style[this.orientation=="horizontal"?"width":"height"]=f+"px";this.setPos(this.pos,e)};function d(a,c,d){this.addClass=a;this.horiz=new b(a,"horizontal",d);c(this.horiz.node);this.vert=new b(a,"vertical",d);c(this.vert.node);this.width=null}d.prototype.update=function(a){if(this.width==null){var b=window.getComputedStyle?window.getComputedStyle(this.horiz.node):this.horiz.node.currentStyle;if(b)this.width=parseInt(b.height)}var c=this.width||0;var d=a.scrollWidth>a.clientWidth+1;var e=a.scrollHeight>a.clientHeight+1;this.vert.node.style.display=e?"block":"none";this.horiz.node.style.display=d?"block":"none";if(e){this.vert.update(a.scrollHeight,a.clientHeight,a.viewHeight-(d?c:0));this.vert.node.style.bottom=d?c+"px":"0"}if(d){this.horiz.update(a.scrollWidth,a.clientWidth,a.viewWidth-(e?c:0)-a.barLeft);this.horiz.node.style.right=e?c+"px":"0";this.horiz.node.style.left=a.barLeft+"px"}return{right:e?c:0,bottom:d?c:0}};d.prototype.setScrollTop=function(a){this.vert.setPos(a)};d.prototype.setScrollLeft=function(a){this.horiz.setPos(a)};d.prototype.clear=function(){var a=this.horiz.node.parentNode;a.removeChild(this.horiz.node);a.removeChild(this.vert.node)};a.scrollbarModel.simple=function(a,b){return new d("CodeMirror-simplescroll",a,b)};a.scrollbarModel.overlay=function(a,b){return new d("CodeMirror-overlayscroll",a,b)}});(function(a){"use strict";if(typeof exports==="object"&&typeof module==="object")a(require("../../lib/codemirror"));else if(typeof define==="function"&&define.amd)define(["../../lib/codemirror"],a);else a(CodeMirror)})(function(a){"use strict";a.defineOption("showInvisibles",false,function(d,e,f){var g=0,h=d.getOption("maxInvisibles")||16;if(f===a.Init)f=false;if(f&&!e){d.removeOverlay("invisibles");c()}else if(!f&&e){b(h);d.addOverlay({name:"invisibles",token:function i(a){var b,c=0,d=a.peek()===" ";if(d){while(d&&c<h){++c;a.next();d=a.peek()===" "}b="whitespace whitespace-"+c;if(c===h)b+=" whitespace-rand-"+g++}else{while(!a.eol()&&!d){a.next();d=a.peek()===" "}b="cm-eol"}return b}})}});function b(a){var b,c,f=".CodeMirror .cm-whitespace-",g="",h="",i="·",j=document.createElement("style");j.setAttribute("data-name","js-show-invisibles");for(b=1;b<=a;++b){g+=i;c=f+b+'::before { content: "'+g+'";}\n';h+=c}j.textContent=d()+"\n"+e()+"\n"+h;document.head.appendChild(j)}function c(){var a=document.querySelector('[data-name="js-show-invisibles"]');document.head.removeChild(a)}function d(){var a=[".cm-whitespace::before {","position: absolute;","pointer-events: none;","color: #404F7D;","}"].join("");return a}function e(){var a=[".CodeMirror-code > div > pre > span::after {","pointer-events: none;","color: #404F7D;",'content: "¬"',"}"].join("");return a}});CodeMirror.defineMode("doku",function(a,b){"use strict";var c;var d={blankLine:function(a){if(a.current.patterns){for(var b=0;b<a.current.patterns.length;b+=1){var c=a.current.patterns[b];if(c.sol&&!c.match&&c.exit){a.exit=true;return}}}if(a.innerMode&&a.innerMode.blankLine){return a.innerMode.blankLine(a.innerState)}},copyState:function(a){return{current:a.current,exit:a.exit,codeFilename:a.codeFilename,codeLang:a.codeLang,innerMode:a.innerMode,innerState:a.innerState?CodeMirror.copyState(a.innerMode,a.innerState):null,linkParam:a.linkParam,linkTitle:a.linkTitle,stack:a.stack.slice(0)}},indent:function(a,b){if(a.innerMode&&a.innerMode.indent){return a.innerMode.indent(a.innerState,b)}},innerMode:function(a){return{mode:a.innerMode||d,state:a.innerMode?a.innerState:a}},startState:function(){return{codeFilename:false,codeLang:null,current:c[0],exit:false,innerMode:null,innerState:null,linkParam:null,linkTitle:false,stack:[]}},token:function(a,b){var c;if(b.exit){k(b);b.current=b.stack.pop();b.exit=false}c=n(a,b);if(!a.current()&&!b.exit){if(b.innerMode){c=b.innerMode.token(a,b.innerState)}else{a.next()}}return c}};c=[{name:"base",allowedTypes:["container","baseonly","formatting","substition","protected","disabled"]},{name:"listblock", 8type:"container",allowedTypes:["formatting","substition","disabled","protected"],entries:[{sol:true,match:/^ {2,}[\-\*]/,style:"def"},{sol:true,match:/^\t{1,}[\-\*]/,style:"def"}],patterns:[{sol:true,match:/^ {2,}[\-\*]/,style:"def"},{sol:true,match:/^\t{1,}[\-\*]/,style:"def"},{sol:true,exit:true}]},{name:"preformatted",type:"protected",entries:[{sol:true,match:/^ (?![\*\-])/},{sol:true,match:/^\t(?![\*\-])/}],patterns:[{sol:true,match:" "},{sol:true,match:"\t"},{sol:true,exit:true}],style:"string"},{name:"notoc",type:"substition",entries:[{match:"~~NOTOC~~",exit:true}],style:"meta"},{name:"nocache",type:"substition",entries:[{match:"~~NOCACHE~~",exit:true}],style:"meta"},{name:"header",type:"baseonly",entries:[{match:/^[ \t]*={2}.+={2,}[ \t]*$/,exit:true}],style:"header"},{name:"table",type:"container",allowedTypes:["formatting","substition","disabled","protected"],entries:[{sol:true,match:"^",style:"def"},{sol:true,match:"|",style:"def"}],patterns:[{match:"^",style:"def"},{match:"|",style:"def"},{match:/^[\t ]*:::[\t ]*(?=[\|\^])/,style:"def"},{match:/^[\t ]+/},{sol:true,exit:true}]},{name:"strong",type:"formatting",allowedTypes:["formatting","substition","disabled"],entries:[{match:"**"}],patterns:[{match:"**",exit:true}],style:"strong"},{name:"emphasis",type:"formatting",allowedTypes:["formatting","substition","disabled"],entries:[{match:/^\/\/(?=[^\x00]*[^:])/}],patterns:[{match:"//",exit:true}],style:"em"},{name:"underline",type:"formatting",allowedTypes:["formatting","substition","disabled"],entries:[{match:"__"}],patterns:[{match:"__",exit:true}],style:"underline"},{name:"monospace",type:"formatting",allowedTypes:["formatting","substition","disabled"],entries:[{match:"''"}],patterns:[{match:"''",exit:true}],style:"quote"},{name:"subscript",type:"formatting",allowedTypes:["formatting","substition","disabled"],entries:[{match:"<sub>",style:"tag"}],patterns:[{match:"</sub>",exit:true,style:"tag"}]},{name:"superscript",type:"formatting",allowedTypes:["formatting","substition","disabled"],entries:[{match:"<sup>",style:"tag"}],patterns:[{match:"</sup>",exit:true,style:"tag"}]},{name:"deleted",type:"formatting",allowedTypes:["formatting","substition","disabled"],entries:[{match:"<del>",style:"tag"}],patterns:[{match:"</del>",exit:true,style:"tag"}]},{name:"linebreak",type:"substition",entries:[{match:/^\\\\(?:[ \t]|$)/,exit:true}],style:"tag"},{name:"footnote",type:"formatting",allowedTypes:["container","formatting","substition","protected","disabled"],entries:[{match:"((",style:"tag"}],patterns:[{match:"))",exit:true,style:"tag"}]},{name:"hr",type:"container",entries:[{sol:true,match:/^[ \t]*-{4,}[ \t]*$/,exit:true}],style:"hr"},{name:"unformatted",type:"disabled",entries:[{match:"<nowiki>",style:"tag"}],patterns:[{match:"</nowiki>",exit:true,style:"tag"}]},{name:"unformattedalt",type:"disabled",entries:[{match:"%%"}],patterns:[{match:"%%",exit:true}],style:"string"},{name:"php",type:"protected",entries:[{match:"<php>",style:"tag",lang:"php"}],patterns:[{match:"</php>",exit:true,style:"tag"}]},{name:"phpblock",type:"protected",entries:[{match:"<PHP>",style:"tag",lang:"php"}],patterns:[{match:"</PHP>",exit:true,style:"tag"}]},{name:"html",type:"protected",entries:[{match:"<html>",style:"tag",lang:"html"}],patterns:[{match:"</html>",exit:true,style:"tag"}]},{name:"htmlblock",type:"protected",entries:[{match:"<HTML>",style:"tag",lang:"html"}],patterns:[{match:"</HTML>",exit:true,style:"tag"}]},{name:"code",type:"protected",entries:[{match:/^<code(?=\s|>|$)/,style:"tag"}],patterns:[{match:"</code>",exit:true,style:"tag"}],token:m},{name:"file",type:"protected",entries:[{match:/^<file(?=\s|>|$)/,style:"tag"}],patterns:[{match:"</file>",exit:true,style:"tag"}],token:m},{name:"quote",type:"container",allowedTypess:["formatting","substition","disabled","protected"],entries:[{sol:true,match:/^>{1,}/,style:"def"}],patterns:[{sol:true,match:/^>{1,}/,style:"def"},{sol:true,exit:true}]}];if(b.smileys.length>0){c.push({name:"smiley",type:"substition",entries:[{behind:/\B$/,match:f(b.smileys,"(?=\\W|$)"),exit:true}],style:"keyword"})}if(b.acronyms.length>0){c.push({name:"acronym",type:"substition",entries:[{behind:/\B$/,match:f(b.acronyms,"(?=\\W|$)"),exit:true}],style:"keyword"})}if(b.entities.length>0){c.push({name:"entity",type:"substition",entries:[{match:f(b.entities),exit:true}],style:"keyword"})}c.push({name:"multipluentity",type:"substition",sort:270,entries:[{behind:/\B$/,match:/^(?:[1-9]|\d{2,})(?=[xX]\d+\b)/}],patterns:[{match:/^[xX]/,style:"keyword"},{match:/^\d+\b/,exit:true}]});if(b.camelcase){c.push({name:"camelcaselink",type:"substition",emtry:[{behind:/\B$/,match:/^[A-Z]+[a-z]+[A-Z][A-Za-z]*\b/,exit:true}],style:"link"})}c.push({name:"internallink",type:"substition",entries:[{match:"[["}],token:function(a,b){var c;if(a.match("]]")){b.current=b.stack.pop();b.linkTitle=false}else if(!b.linkTitle&&a.match("|")){b.linkTitle=true}else{a.next();c=b.linkTitle?"string":"link"}return o(b,c)}},{name:"rss",type:"substition",entries:[{match:"{{rss>",style:"tag"}],patterns:[{match:"}}",exit:true,style:"tag"}]},{name:"media",type:"substition",entries:[{match:/^\{\{ */}],token:function(a,b){var c;if(a.match(/^ *\}\}/)){b.current=b.stack.pop();b.linkParam=false;b.linkTitle=false}else if(b.linkTitle){c="string";a.next()}else if(a.match(/^\s*\|/)){b.linkTitle=true}else if(b.linkParam){if(a.match(/^(?:nolink|direct|linkonly)/)){c="keyword"}else if(a.match(/^(?:nocache|recache)/)){c="meta"}else if(a.match(/^\d+(?:[xX]\d+)?/)){c="number"}else if(!a.match(/^\s+/)){a.next();c="error"}}else if(a.match(/^\?(?=[^\?]*$)/)){b.linkParam=true}else{a.next();c="link"}return o(b,c)}},{name:"externallink",type:"substition",entries:[{behind:/\B$/,match:h(b.schemes),exit:true}],style:"link"},{name:"emaillink",type:"substition",entries:[{match:g(),exit:true}],style:"link"},{name:"windowssharelink",type:"substition",entries:[{match:/^\\\\\w+?(?:\\[\w-$]+)+/,exit:true}],style:"link"},{name:"filelink",type:"substition",entries:[{behind:/\B$/,match:i(),exit:true}],style:"link"});p();return d;function e(a){return a.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1")}function f(a,b,c){var d=[];for(var f=0;f<a.length;f+=1){d.push(e(a[f]))}b=b||"";c=c||"";return new RegExp("^(?:"+d.join("|")+")"+b,c)}function g(){var a="[0-9a-zA-Z!#$%&'*+/=?^_`{|}~-]+";var b=a+"(?:\\."+a+")*@"+"(?:[0-9a-z][0-9a-z-]*\\.)+(?:[a-z]{2,4}|museum|travel)";return new RegExp("^<"+b+">","i")}function h(a){var b=".:?\\-;,";var c="\\w"+b;var d="\\w/\\#~:.?+=&%@!\\-\\[\\]"+b;var e=[];for(var f=0;f<a.length;f+=1){e.push(a[f]+"://["+d+"]+?(?=["+b+"]*[^"+d+"]|$)")}e.push("www?\\.["+c+"]+?\\.["+c+"]+?["+d+"]+?(?=["+b+"]*[^"+d+"]|$)");e.push("ftp?\\.["+c+"]+?\\.["+c+"]+?["+d+"]+?(?=["+b+"]*[^"+d+"]|$)");return new RegExp("^(?:"+e.join("|")+")","i")}function i(){var a=".:?\\-;,";var b="\\w/\\#~:.?+=&%@!\\-\\[\\]"+a;return new RegExp("^file://["+b+"]+?(?=["+a+"]*[^"+b+"]|$)","i")}function j(a,c){a.innerMode=b.loadMode(c);if(a.innerMode.startState){a.innerState=a.innerMode.startState()}a.blockCommentStart=a.innerMode.blockCommentStart;a.blockCommentEnd=a.innerMode.blockCommentEnd;a.lineComment=a.innerMode.lineComment;a.electricChars=a.innerMode.electricChars;a.electricInput=a.innerMode.electricInput}function k(a){a.innerMode=null;a.innerState=null;a.blockCommentStart=null;a.blockCommentEnd=null;a.lineComment=null;a.electricChars=null;a.electricInput=null}function l(a,b,c){if(!c){return null}var d=a.string.slice(a.lineStart,a.pos);for(var e=0;e<c.length;e+=1){var f=c[e];if(f.sol&&!a.sol()){continue}if(f.behind&&!f.behind.test(d)){continue}if(f.match&&!a.match(f.match)){continue}return c[e]}return null}function m(a,c){if(c.innerMode){return}if(a.match(">")){j(c,c.codeLang);c.codeLang=null;c.codeFilename=false;return o(c,"tag")}if(a.match(/^\s+/)){return o(c)}if(a.match(/^[^\s>]+/)){var d;if(!c.codeLang){c.codeLang=a.current();if(b.validLang(c.codeLang)){d="keyword"}else{d="error"}}else if(!c.codeFilename){c.codeFilename=true;d="string"}else{d="error"}return o(c,d)}}function n(a,b){var c=b.current.allowedModes;var d,e;for(var f=0;!d&&f<c.length;f+=1){if(c[f]===b.current){if(b.current.token){e=b.current.token(a,b);if(a.current()){return e}}d=l(a,b,c[f].patterns)}else{d=l(a,b,c[f].entries);if(d){b.stack.push(b.current);b.current=c[f];if(d.lang){j(b,d.lang)}}}}if(d){if(d.exit){b.exit=true}return o(b,d.style)}else{return o(b)}}function o(a,b){var c=[];for(var d=0;d<a.stack.length;d+=1){if(a.stack[d].style){c.push(a.stack[d].style)}}if(a.current.style){c.push(a.current.style)}if(b){c.push(b)}return c.join(" ")||null}function p(){for(var a=0;a<c.length;a+=1){var b=c[a];b.allowedModes=[];if(b.allowedTypes){d(b)}else{b.allowedModes.push(b)}}function d(a){for(var b=0;b<c.length;b+=1){var d=c[b];if(a===d||e(a,d.type)){a.allowedModes.push(d)}}}function e(a,b){for(var c=0;c<a.allowedTypes.length;c+=1){if(a.allowedTypes[c]===b){return true}}return false}}});jQuery(function(){"use strict";var a,b;var c={apl:{name:"apl"},asciiarmor:{name:"asciiarmor"},"asn.1":{name:"asn.1",mime:"text/x-ttcn-asn"},asterisk:{name:"asterisk"},aspx:{name:"htmlembedded",mime:"application/x-aspx",deps:["clike"]},bash:{name:"shell"},brainfuck:{name:"brainfuck"},c:{name:"clike",mime:"text/x-csrc"},cassandra:{name:"sql",mime:"text/x-cassandra"},ceylon:{name:"clike",mime:"text/x-ceylon"},clojure:{name:"clojure"},cmake:{name:"cmake"},cobol:{name:"cobol"},coffeescript:{name:"coffeescript"},cpp:{name:"clike",mime:"text/x-c++src"},crystal:{name:"crystal"},csharp:{name:"clike",mime:"text/x-csharp"},css:{name:"css",mime:"text/css"},cypher:{name:"cypher"},cython:{name:"python",mime:"text/x-cython"},diff:{name:"diff"},d:{name:"d",mime:"text/x-d"},dart:{name:"dart"},django:{name:"django",deps:["htmlmixed"]},dockerfile:{name:"dockerfile"},dtd:{name:"dtd"},dylan:{name:"dylan"},ebnf:{name:"ebnf"},ecl:{name:"ecl"},ecmascript:{name:"javascript",mime:"application/ecmascript"},elm:{name:"elm"},erb:{name:"htmlembedded",mime:"application/x-erb",deps:["ruby"]},eiffel:{name:"eiffel"},ejs:{name:"htmlembedded",mime:"application/x-ejs",deps:["javascript"]},erlang:{name:"erlang"},factor:{name:"factor"},fcl:{name:"fcl"},forth:{name:"forth"},fortran:{name:"fortran"},fsharp:{name:"mllike",mime:"text/x-fsharp"},gfm:{name:"gfm"},gherkin:{name:"gherkin"},glsl:{name:"clike",mime:"x-shader/x-vertex"},go:{name:"go"},gql:{name:"sql",mime:"text/x-gql"},groovy:{name:"groovy"},gss:{name:"css",mime:"text/x-gss"},haml:{name:"haml"},handlebars:{name:"handlebars"},haskell:{name:"haskell"},"haskell-literate":{name:"haskell-literate"},haxe:{name:"haxe",mime:"text/x-haxe"},hive:{name:"sql",mime:"text/x-hive"},html:{name:"htmlmixed"},html5:{name:"htmlmixed"},http:{name:"http"},hxml:{name:"haxe",mime:"text/x-hxml"},idl:{name:"idl"},ini:{name:"properties"},jade:{name:"pug",deps:["javascript"]},java5:{name:"clike",mime:"text/x-java"},java:{name:"clike",mime:"text/x-java"},javascript:{name:"javascript",mime:"application/javascript"},jinja2:{name:"jinja2"},json:{name:"javascript",mime:"application/json"},jsonld:{name:"javascript",mime:"application/ld+json"},jsp:{name:"htmlembedded",mime:"application/x-jsp",deps:["clike"]},jsx:{name:"jsx"},julia:{name:"julia"},kotlin:{name:"clike",mime:"text/x-kotlin"},latex:{name:"stex"},less:{name:"css",mime:"text/x-less"},lisp:{name:"commonlisp"},livescript:{name:"livescript"},lua:{name:"lua"},mariadb:{name:"sql",mime:"text/x-mariadb"},markdown:{name:"markdown"},matlab:{name:"octave"},mbox:{name:"mbox"},modelica:{name:"modelica",mime:"text/x-modelica"},mscgen:{name:"mscgen"},mscgenny:{name:"mscgen",mime:"text/x-msgenny"},mssql:{name:"sql",mime:"text/x-mssql"},mumps:{name:"mumps"},mysql:{name:"sql",mime:"text/x-sql"},nginx:{name:"nginx"},nsis:{name:"nsis"},ntriples:{name:"ntriples"},objc:{name:"clike",mime:"text/x-objectivec"},ocaml:{name:"mllike",mime:"text/x-ocaml"},octave:{name:"octave"},oz:{name:"oz"},pascal:{name:"pascal"},pgp:{name:"asciiarmor"},pegjs:{name:"pegjs"},perl:{name:"perl"},pgsql:{name:"sql",mime:"text/x-pgsql"},php:{name:"php",mime:"application/x-httpd-php-open",deps:["htmlmixed"]},pig:{name:"pig",mime:"text/x-pig"},plsql:{name:"sql",mime:"text/x-plsql"},postgresql:{name:"sql",mime:"text/x-pgsql"},powershell:{name:"powershell"},properties:{name:"properties"},protobuf:{name:"protobuf"},python:{name:"python",mime:"text/x-python"},pug:{name:"pug",deps:["javascript"]},puppet:{name:"puppet"},q:{name:"q"},r:{name:"r"},rpmchanges:{name:"rpm",mime:"text/x-rpm-changes"},rpmspec:{name:"rpm",mime:"text/x-rpm-spec"},rst:{name:"rst"},ruby:{name:"ruby"},rust:{name:"rust"},sas:{name:"sas"},sass:{name:"sass"},scala:{name:"clike",mime:"text/x-scala"},scheme:{name:"scheme"},scss:{name:"css",mime:"text/x-scss"},sieve:{name:"sieve"},slim:{name:"slim"},smalltalk:{name:"smalltalk"},smarty:{name:"smarty",options:{version:2}},smarty3:{name:"smarty",options:{version:3}},solr:{name:"solr"},soy:{name:"soy"},sparql:{name:"sparql"},spreadsheet:{name:"spreadsheet"},sql:{name:"sql",mime:"text/x-sql"},squirrel:{name:"clike",mime:"text/x-squirrel"},stylus:{name:"stylus"},swift:{name:"swift"},tcl:{name:"tcl"},text:{name:"doku-null"},textile:{name:"textile"},tiddlywiki:{name:"tiddlywiki"},tiki:{name:"tiki"},toml:{name:"toml"},tornado:{name:"tornado",deps:["htmlmixed"]},troff:{name:"troff"},ttcn:{name:"ttcn",mime:"text/x-ttcn"},"ttcn-cfg":{name:"ttcn-cfg",mime:"text/x-ttcn-cfg"},turtle:{name:"turtle"},twig:{name:"twig"},typescript:{name:"javascript",mime:"application/typescript"},vbnet:{name:"vb"},vbscript:{name:"vbscript"},velocity:{name:"velocity"},verilog:{name:"verilog"},vhdl:{name:"vhdl"},vue:{name:"vue"},webidl:{name:"webidl"},xml:{name:"xml"},xquery:{name:"xquery"},xu:{name:"mscgen",mime:"text/x-xu"},yacas:{name:"yacas"},yaml:{name:"yaml"},"yaml-frontmatter":{name:"yaml-frontmatter",deps:["gfm"]},z80:{name:"z80"}};var d={activeline:{default_:"0",callback:function(b){if(a){a.setOption("styleActiveLine",b==="1")}}},closebrackets:{default_:"0",callback:function(b){if(a){a.setOption("autoCloseBrackets",b==="1")}}},fontsize:{default_:"14",choices:["10","11","12","13","14","16","18","20","24"],callback:function(b){if(a){var c=a.getWrapperElement();jQuery(c).css("font-size",b+"px");a.refresh()}}},keymap:{default_:"default",choices:["default","emacs","sublime","vim"],callback:function(b){if(a){o(b,function(){a.setOption("vimMode",b==="vim");a.setOption("keyMap",b)})}}},linenumbers:{default_:"0",callback:function(b){if(a){a.setOption("lineNumbers",b==="1")}}},matchbrackets:{default_:"1",callback:function(b){if(a){a.setOption("matchBrackets",b==="1")}}},nativeeditor:{default_:JSINFO.plugin_codemirror.nativeeditor.toString(),callback:function(b){if(!a&&b==="0"){h()}else if(a&&b==="1"){g()}}},syntax:{default_:"1",callback:function(c){if(a){a.setOption("mode",c==="1"?b:"null")}}},showinvisibles:{default_:"0",callback:function(b){if(a){a.setOption("showInvisibles",b==="1")}}},theme:{default_:"default",choices:["3024-day","3024-night","abcdef","ambiance","ambiance-mobile","base16-dark","base16-light","bespin","blackboard","cobalt","colorforth","default","dracula","eclipse","elegant","erlang-dark","hopscotch","icecoder","isotope","lesser-dark","liquidbyte","material","mbo","mdn-like","midnight","monokai","neat","neo","night","panda-syntax","paraiso-dark","paraiso-light","pastel-on-dark","railscasts","rubyblue","seti","solarized","the-matrix","tomorrow-night-bright","tomorrow-night-eighties","ttcn","twilight","vibrant-ink","xq-dark","xq-light","yeti","zenburn"],callback:function(b){if(a){a.setOption("theme",b)}}}};var e=jQuery("#wiki__text");CodeMirror.modeURL=q("/dist/modes/%N.min.js");if(e.length){i();j();l();if(m("nativeeditor")==="0"){h()}}if(JSINFO.plugin_codemirror.codesyntax.toString()==="1"){jQuery("#dokuwiki__content pre.code").each(function(a,b){var d=b.className.split(" ");jQuery.each(d,function(a,d){if(!c[d]){return}b.className=b.className+" cm-s-default";var e=c[d];var g=jQuery(b).text();var h=e.options||{};h.name=e.mime||e.name;f(d,{},function(){CodeMirror.runMode(g,h,b)});CodeMirror.runMode(g,h,b)})})}function f(a,b,d){var e=c[a]||{name:"doku-null"};var f=[e.name].concat(e.deps||[]);var g=function(){if(f.length>0){CodeMirror.requireMode(f.pop(),g)}else{d()}};do{var h=f.pop();if(!CodeMirror.modes.hasOwnProperty(h)){CodeMirror.requireMode(h,g);return CodeMirror.getMode(b,{name:"doku-null"})}}while(f.length>0);var i=e.options||{};i.name=e.mime||e.name;return CodeMirror.getMode(b,i)}function g(){var b=window.DWgetSelection(e.get(0));a.toTextArea();a=null;window.DWsetSelection(b);e.focus();if(JSINFO.plugin_codemirror.autoheight.toString()==="1"){jQuery('#size__ctl img[src$="/larger.gif"], '+'#size__ctl img[src$="/smaller.gif"]').show()}}function h(){var b=window.DWgetSelection(e.get(0));a=CodeMirror.fromTextArea(e.get(0),{mode:"null"});a.setOption("lineWrapping",e.prop("wrap")!=="off");a.setOption("readOnly",e.prop("readonly"));a.setOption("tabSize",8);a.setOption("extraKeys",{Enter:function(a){return p(a,"Enter")},Space:function(a){return p(a,"Space")},Backspace:function(a){return p(a,"Backspace")},"Ctrl-Enter":function(){jQuery("#edbtn__save").click()}});a.setOption("scrollbarStyle",JSINFO.plugin_codemirror.usenativescroll.toString()==="1"?"native":"overlay");a.setSize(null,e.css("height"));a.getDoc().on("change",function(){var b=new Date;if(b.getTime()-dw_locktimer.lasttime.getTime()>3e4){e.val(a.getDoc().getValue());dw_locktimer.refresh()}});jQuery.each(d,function(a,b){if(a!=="nativeeditor"){var c=m(a);b.callback(c)}});window.DWsetSelection(b);if(JSINFO.plugin_codemirror.autoheight.toString()==="1"){jQuery("form#dw__editform .CodeMirror").css({height:"auto"});jQuery('#size__ctl img[src$="/larger.gif"], '+'#size__ctl img[src$="/smaller.gif"]').hide();a.setOption("viewportMargin",Infinity)}}function i(){b=JSINFO.plugin_codemirror;b.name="doku";b.loadMode=function(c){var d=function(){a.setOption("mode",b)};return f(c,a.options,d)};b.validLang=function(a){return c[a]!==undefined};CodeMirror.defineMode("doku-null",function(){return{token:function(a){a.next()}}})}function j(){var b={setWrap:dw_editor.setWrap,sizeCtl:dw_editor.sizeCtl,currentHeadlineLevel:window.currentHeadlineLevel,selection_class:window.selection_class,DWgetSelection:window.DWgetSelection||window.getSelection,DWsetSelection:window.DWsetSelection||window.setSelection,pasteText:window.pasteText};dw_editor.setWrap=function(c,d){b.setWrap(c,d);if(a&&e.is(c)){a.setOption("lineWrapping",d!=="off")}};dw_editor.sizeCtl=function(c,d){b.sizeCtl(c,d);if(a&&e.is(c)){a.setSize(null,e.css("height"))}};window.currentHeadlineLevel=function(c){if(a&&e.is("#"+c)){e.val(a.getDoc().getValue())}return b.currentHeadlineLevel(c)};window.selection_class=function(){b.selection_class.apply(this);var c=this.getText;this.geText=function(){if(a&&e.is(this.obj)){var b=a.getDoc();var d=b.indexFromPos(this.start);var f=b.indexFromPos(this.end);return b.getRange(d,f)}else{return c.apply(this)}}};window.DWgetSelection=function(c){if(a&&e.is(c)){var d=a.getDoc();var f=new window.selection_class;f.obj=c;f.start=d.indexFromPos(d.getCursor("from"));f.end=d.indexFromPos(d.getCursor("to"));e.val(d.getValue());return f}else{return b.DWgetSelection(c)}};window.DWsetSelection=function(c){if(a&&e.is(c.obj)){var d=a.getDoc();var f=d.posFromIndex(c.start);var g=d.posFromIndex(c.end);d.setSelection(f,g);a.focus()}else{b.DWsetSelection(c)}};window.pasteText=function(c,d,f){if(a&&e.is(c.obj)){var g=a.getDoc();e.val(g.getValue());var h=g.posFromIndex(c.start);var i=g.posFromIndex(c.end);g.replaceRange(d,h,i);b.pasteText(c,d,f);a.focus()}else{b.pasteText(c,d,f)}}}function k(a){var b=jQuery("<img>").attr("class","cm-settings-button");b.attr("src",JSINFO.plugin_codemirror.iconURL);b.on("click",function(){var b=jQuery(this).offset();var c=jQuery(this).outerWidth();var d=a.outerWidth();var e=a.outerHeight();a.css("top",b.top-e);a.css("left",b.left+c-d);a.toggle();return false});if(jQuery("#size__ctl").length>0){b.appendTo("#size__ctl")}else{b.appendTo("#draft__status")}}function l(){var a=jQuery("<ul>").addClass("cm-settings-menu");var b=["theme","fontsize","keymap","closebrackets","linenumbers","activeline","matchbrackets","syntax","showinvisibles","-","nativeeditor"];jQuery.each(b,function(b,c){var e=d[c];var f=LANG.plugins.codemirror["setting_"+c];if(c==="-"){a.append("<li>-</li>");return}var g=jQuery("<li>");var h=jQuery("<a>").html(f);var i=m(c);var j=m("nativeeditor")==="1";if(e.choices){var k=jQuery("<ul>");jQuery.each(e.choices,function(a,b){var d=jQuery("<li>");d.data("setting",c);d.data("choice",b);var e=jQuery("<a>").html(b);var f=jQuery("<span>").addClass("ui-icon");if(i===b){f.addClass("ui-icon-check")}else{f.addClass("ui-icon-blank")}e.append(f);d.append(e);k.append(d)});g.append(k)}else{g.data("setting",c);var l=jQuery("<span>").addClass("ui-icon");if(i==="1"){l.addClass("ui-icon-check")}else{l.addClass("ui-icon-blank")}h.append(l)}if(j&&c!=="nativeeditor"){g.addClass("ui-state-disabled")}g.append(h);a.append(g)});a.menu({position:{my:"right top",at:"left top"}});jQuery("body").on("click",function(){setTimeout(function(){a.menu("collapseAll",null,true)},200);a.hide()});a.on("menuselect",function(a,b){var c=b.item.data("setting");var d=b.item.data("choice");var e=b.item.find(".ui-icon");if(!c){return false}if(d){var f=b.item.siblings().find(".ui-icon");f.removeClass("ui-icon-check");f.addClass("ui-icon-blank");e.removeClass("ui-icon-blank");e.addClass("ui-icon-check")}else{d=e.hasClass("ui-icon-check")?"0":"1";e.removeClass("ui-icon-blank ui-icon-check");if(d==="1"){e.addClass("ui-icon-check")}else{e.addClass("ui-icon-blank")}}if(c==="nativeeditor"){if(d==="1"){b.item.siblings().addClass("ui-state-disabled")}else{b.item.siblings().removeClass("ui-state-disabled")}}n(c,d)});a.appendTo("body");k(a)}function m(a){var b=DokuCookie.getValue("cm-"+a);var c=d[a];if(c.choices){if(!b||jQuery.inArray(b,c.choices)<0){b=c.default_}}else{if(b!=="0"&&b!=="1"){b=c.default_}}DokuCookie.setValue("cm-"+a,b);return b}function n(a,b){DokuCookie.setValue("cm-"+a,b);d[a].callback(b)}function o(a,b){var c;if(CodeMirror.keyMap[a]){b();return}var d=0;jQuery("<script>").attr("src",q("/dist/keymaps/"+a+".min.js")).appendTo("head");function e(){d+=1;if(d>100){clearInterval(c)}if(CodeMirror.keyMap[a]){clearInterval(c);b()}}c=setInterval(e,200)}function p(a,b){var c=a.getDoc();if(c.somethingSelected()){return CodeMirror.Pass}var d=c.getCursor();if(a.getModeAt(d)!==c.getMode()){return CodeMirror.Pass}var e=c.getLine(d.line);var f=e.slice(0,d.ch);var g=f.match(/^( +)([-*] )?/);if(!g){return CodeMirror.Pass}if(b!=="Enter"&&d.ch>g[0].length){return CodeMirror.Pass}if(b==="Enter"){if(g[2]&&g[0]===e){c.replaceRange("\n",{line:d.line,ch:0},d)}else{c.replaceRange("\n"+g[0],d)}}else if(b==="Space"){c.replaceRange(" "+f,{line:d.line,ch:0},d)}else if(b==="Backspace"){if(g[1].length>=4){f=f.slice(2)}else{f=""}c.replaceRange(f,{line:d.line,ch:0},d)}}function q(a){return JSINFO.plugin_codemirror.baseURL+"/"+a+"?v="+JSINFO.plugin_codemirror.version}}); 9//# sourceMappingURL=scripts.min.js.map