!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).CodeMirror=t()}(this,function(){"use strict";var e=navigator.userAgent,t=navigator.platform,f=/gecko\/\d/i.test(e),r=/MSIE \d/.test(e),n=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(e),i=/Edge\/(\d+)/.exec(e),w=r||n||i,v=w&&(r?document.documentMode||6:+(i||n)[1]),h=!i&&/WebKit\//.test(e),n=h&&/Qt\/\d+\.\d+/.test(e),o=!i&&/Chrome\//.test(e),p=/Opera\//.test(e),u=/Apple Computer/.test(navigator.vendor),a=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(e),c=/PhantomJS/.test(e),l=u&&(/Mobile\/\w+/.test(e)||2<navigator.maxTouchPoints),s=/Android/.test(e),d=l||s||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e),g=l||/Mac/.test(t),m=/\bCrOS\b/.test(e),y=/win/i.test(t),e=p&&e.match(/Version\/(\d*\.\d*)/);(e=e&&Number(e[1]))&&15<=e&&(h=!(p=!1));var b=g&&(n||p&&(null==e||e<12.11)),x=f||w&&9<=v;function k(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var C,S=function(e,t){var r=e.className,n=k(t).exec(r);n&&(t=r.slice(n.index+n[0].length),e.className=r.slice(0,n.index)+(t?n[1]+t:""))};function L(e){for(var t=e.childNodes.length;0<t;--t)e.removeChild(e.firstChild);return e}function T(e,t){return L(e).appendChild(t)}function M(e,t,r,n){var i=document.createElement(e);if(r&&(i.className=r),n&&(i.style.cssText=n),"string"==typeof t)i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o<t.length;++o)i.appendChild(t[o]);return i}function N(e,t,r,n){n=M(e,t,r,n);return n.setAttribute("role","presentation"),n}function O(e,t){if(3==t.nodeType&&(t=t.parentNode),e.contains)return e.contains(t);do{if(11==t.nodeType&&(t=t.host),t==e)return!0}while(t=t.parentNode)}function A(){var t;try{t=document.activeElement}catch(e){t=document.body||null}for(;t&&t.shadowRoot&&t.shadowRoot.activeElement;)t=t.shadowRoot.activeElement;return t}function D(e,t){var r=e.className;k(t).test(r)||(e.className+=(r?" ":"")+t)}function z(e,t){for(var r=e.split(" "),n=0;n<r.length;n++)r[n]&&!k(r[n]).test(t)&&(t+=" "+r[n]);return t}C=document.createRange?function(e,t,r,n){var i=document.createRange();return i.setEnd(n||e,r),i.setStart(e,t),i}:function(e,t,r){var n=document.body.createTextRange();try{n.moveToElementText(e.parentNode)}catch(e){return n}return n.collapse(!0),n.moveEnd("character",r),n.moveStart("character",t),n};var W=function(e){e.select()};function P(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function E(e,t,r){for(var n in t=t||{},e)!e.hasOwnProperty(n)||!1===r&&t.hasOwnProperty(n)||(t[n]=e[n]);return t}function H(e,t,r,n,i){null==t&&-1==(t=e.search(/[^\s\u00a0]/))&&(t=e.length);for(var o=n||0,a=i||0;;){var l=e.indexOf("\t",o);if(l<0||t<=l)return a+(t-o);a+=l-o,a+=r-a%r,o=l+1}}l?W=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:w&&(W=function(e){try{e.select()}catch(e){}});var F=function(){this.id=null,this.f=null,this.time=0,this.handler=P(this.onTimeout,this)};function I(e,t){for(var r=0;r<e.length;++r)if(e[r]==t)return r;return-1}F.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},F.prototype.set=function(e,t){this.f=t;t=+new Date+e;(!this.id||t<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=t)};var R=50,B={toString:function(){return"CodeMirror.Pass"}},j={scroll:!1},q={origin:"*mouse"},K={origin:"+move"};function V(e,t,r){for(var n=0,i=0;;){var o=e.indexOf("\t",n);-1==o&&(o=e.length);var a=o-n;if(o==e.length||t<=i+a)return n+Math.min(a,t-i);if(i+=o-n,n=o+1,t<=(i+=r-i%r))return n}}var U=[""];function G(e){for(;U.length<=e;)U.push($(U)+" ");return U[e]}function $(e){return e[e.length-1]}function _(e,t){for(var r=[],n=0;n<e.length;n++)r[n]=t(e[n],n);return r}function X(){}function Y(e,t){e=Object.create?Object.create(e):(X.prototype=e,new X);return t&&E(t,e),e}var Z=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function Q(e){return/\w/.test(e)||""<e&&(e.toUpperCase()!=e.toLowerCase()||Z.test(e))}function J(e,t){return t?!!(-1<t.source.indexOf("\\w")&&Q(e))||t.test(e):Q(e)}function ee(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return;return 1}var te=/[\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 re(e){return 768<=e.charCodeAt(0)&&te.test(e)}function ne(e,t,r){for(;(r<0?0<t:t<e.length)&&re(e.charAt(t));)t+=r;return t}function ie(e,t,r){for(var n=r<t?-1:1;;){if(t==r)return t;var i=(t+r)/2,i=n<0?Math.ceil(i):Math.floor(i);if(i==t)return e(i)?t:r;e(i)?r=i:t=i+n}}var oe=null;function ae(e,t,r){var n;oe=null;for(var i=0;i<e.length;++i){var o=e[i];if(o.from<t&&o.to>t)return i;o.to==t&&(o.from!=o.to&&"before"==r?n=i:oe=i),o.from==t&&(o.from!=o.to&&"before"!=r?n=i:oe=i)}return null!=n?n:oe}var le,se,ce,ue,de,fe,he,pe=(le="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",se="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111",ce=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,ue=/[stwN]/,de=/[LRr]/,fe=/[Lb1n]/,he=/[1n]/,function(e,t){var r="ltr"==t?"L":"R";if(0==e.length||"ltr"==t&&!ce.test(e))return!1;for(var n,i=e.length,o=[],a=0;a<i;++a)o.push((n=e.charCodeAt(a))<=247?le.charAt(n):1424<=n&&n<=1524?"R":1536<=n&&n<=1785?se.charAt(n-1536):1774<=n&&n<=2220?"r":8192<=n&&n<=8203?"w":8204==n?"b":"L");for(var l=0,s=r;l<i;++l){var c=o[l];"m"==c?o[l]=s:s=c}for(var u=0,d=r;u<i;++u){var f=o[u];"1"==f&&"r"==d?o[u]="n":de.test(f)&&"r"==(d=f)&&(o[u]="R")}for(var h=1,p=o[0];h<i-1;++h){var g=o[h];"+"==g&&"1"==p&&"1"==o[h+1]?o[h]="1":","!=g||p!=o[h+1]||"1"!=p&&"n"!=p||(o[h]=p),p=g}for(var m=0;m<i;++m){var v=o[m];if(","==v)o[m]="N";else if("%"==v){for(var y=void 0,y=m+1;y<i&&"%"==o[y];++y);for(var b=m&&"!"==o[m-1]||y<i&&"1"==o[y]?"1":"N",w=m;w<y;++w)o[w]=b;m=y-1}}for(var x=0,k=r;x<i;++x){var C=o[x];"L"==k&&"1"==C?o[x]="L":de.test(C)&&(k=C)}for(var S=0;S<i;++S)if(ue.test(o[S])){for(var L=void 0,L=S+1;L<i&&ue.test(o[L]);++L);for(var T="L"==(S?o[S-1]:r),M=T==("L"==(L<i?o[L]:r))?T?"L":"R":r,N=S;N<L;++N)o[N]=M;S=L-1}for(var O,A=[],D=0;D<i;)if(fe.test(o[D])){var z=D;for(++D;D<i&&fe.test(o[D]);++D);A.push(new ge(0,z,D))}else{var W=D,P=A.length,E="rtl"==t?1:0;for(++D;D<i&&"L"!=o[D];++D);for(var H=W;H<D;)if(he.test(o[H])){W<H&&(A.splice(P,0,new ge(1,W,H)),P+=E);var F=H;for(++H;H<D&&he.test(o[H]);++H);A.splice(P,0,new ge(2,F,H)),P+=E,W=H}else++H;W<D&&A.splice(P,0,new ge(1,W,D))}return"ltr"==t&&(1==A[0].level&&(O=e.match(/^\s+/))&&(A[0].from=O[0].length,A.unshift(new ge(0,0,O[0].length))),1==$(A).level&&(O=e.match(/\s+$/))&&($(A).to-=O[0].length,A.push(new ge(0,i-O[0].length,i)))),"rtl"==t?A.reverse():A});function ge(e,t,r){this.level=e,this.from=t,this.to=r}function me(e,t){var r=e.order;return null==r&&(r=e.order=pe(e.text,t)),r}var ve=[],ye=function(e,t,r){e.addEventListener?e.addEventListener(t,r,!1):e.attachEvent?e.attachEvent("on"+t,r):(e=e._handlers||(e._handlers={}))[t]=(e[t]||ve).concat(r)};function be(e,t){return e._handlers&&e._handlers[t]||ve}function we(e,t,r){var n;e.removeEventListener?e.removeEventListener(t,r,!1):e.detachEvent?e.detachEvent("on"+t,r):!(e=(n=e._handlers)&&n[t])||-1<(r=I(e,r))&&(n[t]=e.slice(0,r).concat(e.slice(r+1)))}function xe(e,t){var r=be(e,t);if(r.length)for(var n=Array.prototype.slice.call(arguments,2),i=0;i<r.length;++i)r[i].apply(null,n)}function ke(e,t,r){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),xe(e,r||t.type,e,t),Ne(t)||t.codemirrorIgnore}function Ce(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var r=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),n=0;n<t.length;++n)-1==I(r,t[n])&&r.push(t[n])}function Se(e,t){return 0<be(e,t).length}function Le(e){e.prototype.on=function(e,t){ye(this,e,t)},e.prototype.off=function(e,t){we(this,e,t)}}function Te(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Me(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function Ne(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function Oe(e){Te(e),Me(e)}function Ae(e){return e.target||e.srcElement}function De(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),g&&e.ctrlKey&&1==t&&(t=3),t}var ze,We,Pe=function(){if(w&&v<9)return!1;var e=M("div");return"draggable"in e||"dragDrop"in e}();var Ee=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,r=[],n=e.length;t<=n;){var i=e.indexOf("\n",t);-1==i&&(i=e.length);var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),a=o.indexOf("\r");-1!=a?(r.push(o.slice(0,a)),t+=a+1):(r.push(o),t=i+1)}return r}:function(e){return e.split(/\r\n?|\n/)},He=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(e){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(e){}return!(!t||t.parentElement()!=e)&&0!=t.compareEndPoints("StartToEnd",t)},Fe="oncopy"in(n=M("div"))||(n.setAttribute("oncopy","return;"),"function"==typeof n.oncopy),Ie=null;var Re={},Be={};function je(e){if("string"==typeof e&&Be.hasOwnProperty(e))e=Be[e];else if(e&&"string"==typeof e.name&&Be.hasOwnProperty(e.name)){var t=Be[e.name];"string"==typeof t&&(t={name:t}),(e=Y(t,e)).name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return je("application/xml");if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return je("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function qe(e,t){t=je(t);var r=Re[t.name];if(!r)return qe(e,"text/plain");var n=r(e,t);if(Ke.hasOwnProperty(t.name)){var i,o=Ke[t.name];for(i in o)o.hasOwnProperty(i)&&(n.hasOwnProperty(i)&&(n["_"+i]=n[i]),n[i]=o[i])}if(n.name=t.name,t.helperType&&(n.helperType=t.helperType),t.modeProps)for(var a in t.modeProps)n[a]=t.modeProps[a];return n}var Ke={};function Ve(e,t){E(t,Ke.hasOwnProperty(e)?Ke[e]:Ke[e]={})}function Ue(e,t){if(!0===t)return t;if(e.copyState)return e.copyState(t);var r,n={};for(r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function Ge(e,t){for(var r;e.innerMode&&(r=e.innerMode(t))&&r.mode!=e;)t=r.state,e=r.mode;return r||{mode:e,state:t}}function $e(e,t,r){return!e.startState||e.startState(t,r)}var _e=function(e,t,r){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=r};function Xe(e,t){if((t-=e.first)<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var r=e;!r.lines;)for(var n=0;;++n){var i=r.children[n],o=i.chunkSize();if(t<o){r=i;break}t-=o}return r.lines[t]}function Ye(e,t,r){var n=[],i=t.line;return e.iter(t.line,r.line+1,function(e){e=e.text;i==r.line&&(e=e.slice(0,r.ch)),i==t.line&&(e=e.slice(t.ch)),n.push(e),++i}),n}function Ze(e,t,r){var n=[];return e.iter(t,r,function(e){n.push(e.text)}),n}function Qe(e,t){var r=t-e.height;if(r)for(var n=e;n;n=n.parent)n.height+=r}function Je(e){if(null==e.parent)return null;for(var t=e.parent,r=I(t.lines,e),n=t.parent;n;n=(t=n).parent)for(var i=0;n.children[i]!=t;++i)r+=n.children[i].chunkSize();return r+t.first}function et(e,t){var r=e.first;e:do{for(var n=0;n<e.children.length;++n){var i=e.children[n],o=i.height;if(t<o){e=i;continue e}t-=o,r+=i.chunkSize()}return r}while(!e.lines);for(var a=0;a<e.lines.length;++a){var l=e.lines[a].height;if(t<l)break;t-=l}return r+a}function tt(e,t){return t>=e.first&&t<e.first+e.size}function rt(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function nt(e,t,r){if(void 0===r&&(r=null),!(this instanceof nt))return new nt(e,t,r);this.line=e,this.ch=t,this.sticky=r}function it(e,t){return e.line-t.line||e.ch-t.ch}function ot(e,t){return e.sticky==t.sticky&&0==it(e,t)}function at(e){return nt(e.line,e.ch)}function lt(e,t){return it(e,t)<0?t:e}function st(e,t){return it(e,t)<0?e:t}function ct(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function ut(e,t){if(t.line<e.first)return nt(e.first,0);var r=e.first+e.size-1;return t.line>r?nt(r,Xe(e,r).text.length):(e=Xe(e,(r=t).line).text.length,null==(t=r.ch)||e<t?nt(r.line,e):t<0?nt(r.line,0):r)}function dt(e,t){for(var r=[],n=0;n<t.length;n++)r[n]=ut(e,t[n]);return r}_e.prototype.eol=function(){return this.pos>=this.string.length},_e.prototype.sol=function(){return this.pos==this.lineStart},_e.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},_e.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},_e.prototype.eat=function(e){var t=this.string.charAt(this.pos),e="string"==typeof e?t==e:t&&(e.test?e.test(t):e(t));if(e)return++this.pos,t},_e.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},_e.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},_e.prototype.skipToEnd=function(){this.pos=this.string.length},_e.prototype.skipTo=function(e){e=this.string.indexOf(e,this.pos);if(-1<e)return this.pos=e,!0},_e.prototype.backUp=function(e){this.pos-=e},_e.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=H(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?H(this.string,this.lineStart,this.tabSize):0)},_e.prototype.indentation=function(){return H(this.string,null,this.tabSize)-(this.lineStart?H(this.string,this.lineStart,this.tabSize):0)},_e.prototype.match=function(e,t,r){if("string"!=typeof e){var n=this.string.slice(this.pos).match(e);return n&&0<n.index?null:(n&&!1!==t&&(this.pos+=n[0].length),n)}n=function(e){return r?e.toLowerCase():e};if(n(this.string.substr(this.pos,e.length))==n(e))return!1!==t&&(this.pos+=e.length),!0},_e.prototype.current=function(){return this.string.slice(this.start,this.pos)},_e.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},_e.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},_e.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};var ft=function(e,t){this.state=e,this.lookAhead=t},ht=function(e,t,r,n){this.state=t,this.doc=e,this.line=r,this.maxLookAhead=n||0,this.baseTokens=null,this.baseTokenPos=1};function pt(t,r,n,e){var s=[t.state.modeGen],i={};Ct(t,r.text,t.doc.mode,n,function(e,t){return s.push(e,t)},i,e);for(var c=n.state,o=0;o<t.state.overlays.length;++o)!function(e){n.baseTokens=s;var o=t.state.overlays[e],a=1,l=0;n.state=!0,Ct(t,r.text,o.mode,n,function(e,t){for(var r=a;l<e;){var n=s[a];e<n&&s.splice(a,1,e,s[a+1],n),a+=2,l=Math.min(e,n)}if(t)if(o.opaque)s.splice(r,a-r,e,"overlay "+t),a=r+2;else for(;r<a;r+=2){var i=s[r+1];s[r+1]=(i?i+" ":"")+"overlay "+t}},i),n.state=c,n.baseTokens=null,n.baseTokenPos=1}(o);return{styles:s,classes:i.bgClass||i.textClass?i:null}}function gt(e,t,r){var n,i,o;return t.styles&&t.styles[0]==e.state.modeGen||(n=mt(e,Je(t)),i=t.text.length>e.options.maxHighlightLength&&Ue(e.doc.mode,n.state),o=pt(e,t,n),i&&(n.state=i),t.stateAfter=n.save(!i),t.styles=o.styles,o.classes?t.styleClasses=o.classes:t.styleClasses&&(t.styleClasses=null),r===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))),t.styles}function mt(r,n,e){var t=r.doc,i=r.display;if(!t.mode.startState)return new ht(t,!0,n);var o=function(e,t,r){for(var n,i,o=e.doc,a=r?-1:t-(e.doc.mode.innerMode?1e3:100),l=t;a<l;--l){if(l<=o.first)return o.first;var s=Xe(o,l-1),c=s.stateAfter;if(c&&(!r||l+(c instanceof ft?c.lookAhead:0)<=o.modeFrontier))return l;s=H(s.text,null,e.options.tabSize);(null==i||s<n)&&(i=l-1,n=s)}return i}(r,n,e),a=o>t.first&&Xe(t,o-1).stateAfter,l=a?ht.fromSaved(t,a,o):new ht(t,$e(t.mode),o);return t.iter(o,n,function(e){vt(r,e.text,l);var t=l.line;e.stateAfter=t==n-1||t%5==0||t>=i.viewFrom&&t<i.viewTo?l.save():null,l.nextLine()}),e&&(t.modeFrontier=l.line),l}function vt(e,t,r,n){var i=e.doc.mode,o=new _e(t,e.options.tabSize,r);for(o.start=o.pos=n||0,""==t&&yt(i,r.state);!o.eol();)bt(i,o,r.state),o.start=o.pos}function yt(e,t){if(e.blankLine)return e.blankLine(t);if(e.innerMode){t=Ge(e,t);return t.mode.blankLine?t.mode.blankLine(t.state):void 0}}function bt(e,t,r,n){for(var i=0;i<10;i++){n&&(n[0]=Ge(e,r).mode);var o=e.token(t,r);if(t.pos>t.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}ht.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},ht.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},ht.prototype.nextLine=function(){this.line++,0<this.maxLookAhead&&this.maxLookAhead--},ht.fromSaved=function(e,t,r){return t instanceof ft?new ht(e,Ue(e.mode,t.state),r,t.lookAhead):new ht(e,Ue(e.mode,t),r)},ht.prototype.save=function(e){e=!1!==e?Ue(this.doc.mode,this.state):this.state;return 0<this.maxLookAhead?new ft(e,this.maxLookAhead):e};var wt=function(e,t,r){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=r};function xt(e,t,r,n){var i,o,a=e.doc,l=a.mode,s=Xe(a,(t=ut(a,t)).line),c=mt(e,t.line,r),u=new _e(s.text,e.options.tabSize,c);for(n&&(o=[]);(n||u.pos<t.ch)&&!u.eol();)u.start=u.pos,i=bt(l,u,c.state),n&&o.push(new wt(u,i,Ue(a.mode,c.state)));return n?o:new wt(u,i,c.state)}function kt(e,t){if(e)for(;;){var r=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!r)break;e=e.slice(0,r.index)+e.slice(r.index+r[0].length);var n=r[1]?"bgClass":"textClass";null==t[n]?t[n]=r[2]:new RegExp("(?:^|\\s)"+r[2]+"(?:$|\\s)").test(t[n])||(t[n]+=" "+r[2])}return e}function Ct(e,t,r,n,i,o,a){var l=r.flattenSpans;null==l&&(l=e.options.flattenSpans);var s=0,c=null,u=new _e(t,e.options.tabSize,n),d=e.options.addModeClass&&[null];for(""==t&&kt(yt(r,n.state),o);!u.eol();){var f,h=u.pos>e.options.maxHighlightLength?(l=!1,a&&vt(e,t,n,u.pos),u.pos=t.length,null):kt(bt(r,u,n.state,d),o);if(!d||(f=d[0].name)&&(h="m-"+(h?f+" "+h:f)),!l||c!=h){for(;s<u.start;)i(s=Math.min(u.start,s+5e3),c);c=h}u.start=u.pos}for(;s<u.pos;){var p=Math.min(u.pos,s+5e3);i(p,c),s=p}}var St=!1,Lt=!1;function Tt(e,t,r){this.marker=e,this.from=t,this.to=r}function Mt(e,t){if(e)for(var r=0;r<e.length;++r){var n=e[r];if(n.marker==t)return n}}function Nt(e,t){if(t.full)return null;var r=tt(e,t.from.line)&&Xe(e,t.from.line).markedSpans,n=tt(e,t.to.line)&&Xe(e,t.to.line).markedSpans;if(!r&&!n)return null;var i=t.from.ch,o=t.to.ch,e=0==it(t.from,t.to),a=function(e,t,r){var n;if(e)for(var i=0;i<e.length;++i){var o,a=e[i],l=a.marker;!(null==a.from||(l.inclusiveLeft?a.from<=t:a.from<t))&&(a.from!=t||"bookmark"!=l.type||r&&a.marker.insertLeft)||(o=null==a.to||(l.inclusiveRight?a.to>=t:a.to>t),(n=n||[]).push(new Tt(l,a.from,o?null:a.to)))}return n}(r,i,e),l=function(e,t,r){var n;if(e)for(var i=0;i<e.length;++i){var o,a=e[i],l=a.marker;!(null==a.to||(l.inclusiveRight?a.to>=t:a.to>t))&&(a.from!=t||"bookmark"!=l.type||r&&!a.marker.insertLeft)||(o=null==a.from||(l.inclusiveLeft?a.from<=t:a.from<t),(n=n||[]).push(new Tt(l,o?null:a.from-t,null==a.to?null:a.to-t)))}return n}(n,o,e),s=1==t.text.length,c=$(t.text).length+(s?i:0);if(a)for(var u=0;u<a.length;++u){var d,f=a[u];null==f.to&&((d=Mt(l,f.marker))?s&&(f.to=null==d.to?null:d.to+c):f.to=i)}if(l)for(var h=0;h<l.length;++h){var p=l[h];null!=p.to&&(p.to+=c),null==p.from?Mt(a,p.marker)||(p.from=c,s&&(a=a||[]).push(p)):(p.from+=c,s&&(a=a||[]).push(p))}a=a&&Ot(a),l&&l!=a&&(l=Ot(l));var g=[a];if(!s){var m,v=t.text.length-2;if(0<v&&a)for(var y=0;y<a.length;++y)null==a[y].to&&(m=m||[]).push(new Tt(a[y].marker,null,null));for(var b=0;b<v;++b)g.push(m);g.push(l)}return g}function Ot(e){for(var t=0;t<e.length;++t){var r=e[t];null!=r.from&&r.from==r.to&&!1!==r.marker.clearWhenEmpty&&e.splice(t--,1)}return e.length?e:null}function At(e){var t=e.markedSpans;if(t){for(var r=0;r<t.length;++r)t[r].marker.detachLine(e);e.markedSpans=null}}function Dt(e,t){if(t){for(var r=0;r<t.length;++r)t[r].marker.attachLine(e);e.markedSpans=t}}function zt(e){return e.inclusiveLeft?-1:0}function Wt(e){return e.inclusiveRight?1:0}function Pt(e,t){var r=e.lines.length-t.lines.length;if(0!=r)return r;var n=e.find(),i=t.find(),r=it(n.from,i.from)||zt(e)-zt(t);if(r)return-r;i=it(n.to,i.to)||Wt(e)-Wt(t);return i||t.id-e.id}function Et(e,t){var r,n=Lt&&e.markedSpans;if(n)for(var i,o=0;o<n.length;++o)(i=n[o]).marker.collapsed&&null==(t?i.from:i.to)&&(!r||Pt(r,i.marker)<0)&&(r=i.marker);return r}function Ht(e){return Et(e,!0)}function Ft(e){return Et(e,!1)}function It(e,t,r,n,i){var t=Xe(e,t),o=Lt&&t.markedSpans;if(o)for(var a=0;a<o.length;++a){var l=o[a];if(l.marker.collapsed){var s=l.marker.find(0),c=it(s.from,r)||zt(l.marker)-zt(i),u=it(s.to,n)||Wt(l.marker)-Wt(i);if(!(0<=c&&u<=0||c<=0&&0<=u)&&(c<=0&&(l.marker.inclusiveRight&&i.inclusiveLeft?0<=it(s.to,r):0<it(s.to,r))||0<=c&&(l.marker.inclusiveRight&&i.inclusiveLeft?it(s.from,n)<=0:it(s.from,n)<0)))return 1}}}function Rt(e){for(var t;t=Ht(e);)e=t.find(-1,!0).line;return e}function Bt(e,t){var r=Xe(e,t),e=Rt(r);return r==e?t:Je(e)}function jt(e,t){if(t>e.lastLine())return t;var r,n=Xe(e,t);if(!qt(e,n))return t;for(;r=Ft(n);)n=r.find(1,!0).line;return Je(n)+1}function qt(e,t){var r=Lt&&t.markedSpans;if(r)for(var n,i=0;i<r.length;++i)if((n=r[i]).marker.collapsed){if(null==n.from)return!0;if(!n.marker.widgetNode&&0==n.from&&n.marker.inclusiveLeft&&function e(t,r,n){if(null==n.to){var i=n.marker.find(1,!0);return e(t,i.line,Mt(i.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==r.text.length)return!0;for(var o=void 0,a=0;a<r.markedSpans.length;++a)if((o=r.markedSpans[a]).marker.collapsed&&!o.marker.widgetNode&&o.from==n.to&&(null==o.to||o.to!=n.from)&&(o.marker.inclusiveLeft||n.marker.inclusiveRight)&&e(t,r,o))return!0}(e,t,n))return!0}}function Kt(e){for(var t=0,r=(e=Rt(e)).parent,n=0;n<r.lines.length;++n){var i=r.lines[n];if(i==e)break;t+=i.height}for(var o=r.parent;o;o=(r=o).parent)for(var a=0;a<o.children.length;++a){var l=o.children[a];if(l==r)break;t+=l.height}return t}function Vt(e){if(0==e.height)return 0;for(var t,r=e.text.length,n=e;t=Ht(n);){var i=t.find(0,!0),n=i.from.line;r+=i.from.ch-i.to.ch}for(n=e;t=Ft(n);){var o=t.find(0,!0);r-=n.text.length-o.from.ch,r+=(n=o.to.line).text.length-o.to.ch}return r}function Ut(e){var r=e.display,e=e.doc;r.maxLine=Xe(e,e.first),r.maxLineLength=Vt(r.maxLine),r.maxLineChanged=!0,e.iter(function(e){var t=Vt(e);t>r.maxLineLength&&(r.maxLineLength=t,r.maxLine=e)})}var Gt=function(e,t,r){this.text=e,Dt(this,t),this.height=r?r(this):1};Gt.prototype.lineNo=function(){return Je(this)},Le(Gt);var $t={},_t={};function Xt(e,t){if(!e||/^\s*$/.test(e))return null;t=t.addModeClass?_t:$t;return t[e]||(t[e]=e.replace(/\S+/g,"cm-$&"))}function Yt(e,t){var r=N("span",null,null,h?"padding-right: .1px":null),n={pre:N("pre",[r],"CodeMirror-line"),content:r,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o=i?t.rest[i-1]:t.line,a=void 0;n.pos=0,n.addToken=Qt,function(e){if(null!=We)return We;var t=T(e,document.createTextNode("AخA")),r=C(t,0,1).getBoundingClientRect(),t=C(t,1,2).getBoundingClientRect();return L(e),r&&r.left!=r.right&&(We=t.right-r.right<3)}(e.display.measure)&&(a=me(o,e.doc.direction))&&(n.addToken=function(d,f){return function(e,t,r,n,i,o,a){r=r?r+" cm-force-border":"cm-force-border";for(var l=e.pos,s=l+t.length;;){for(var c=void 0,u=0;u<f.length&&!((c=f[u]).to>l&&c.from<=l);u++);if(c.to>=s)return d(e,t,r,n,i,o,a);d(e,t.slice(0,c.to-l),r,n,null,o,a),n=null,t=t.slice(c.to-l),l=c.to}}}(n.addToken,a)),n.map=[],function(e,t,r){var n=e.markedSpans,i=e.text,o=0;if(n)for(var a,l,s,c,u,d,f,h=i.length,p=0,g=1,m="",v=0;;){if(v==p){s=c=u=l="",d=f=null,v=1/0;for(var y=[],b=void 0,w=0;w<n.length;++w){var x=n[w],k=x.marker;if("bookmark"==k.type&&x.from==p&&k.widgetNode)y.push(k);else if(x.from<=p&&(null==x.to||x.to>p||k.collapsed&&x.to==p&&x.from==p)){if(null!=x.to&&x.to!=p&&v>x.to&&(v=x.to,c=""),k.className&&(s+=" "+k.className),k.css&&(l=(l?l+";":"")+k.css),k.startStyle&&x.from==p&&(u+=" "+k.startStyle),k.endStyle&&x.to==v&&(b=b||[]).push(k.endStyle,x.to),k.title&&((f=f||{}).title=k.title),k.attributes)for(var C in k.attributes)(f=f||{})[C]=k.attributes[C];k.collapsed&&(!d||Pt(d.marker,k)<0)&&(d=x)}else x.from>p&&v>x.from&&(v=x.from)}if(b)for(var S=0;S<b.length;S+=2)b[S+1]==v&&(c+=" "+b[S]);if(!d||d.from==p)for(var L=0;L<y.length;++L)Jt(t,0,y[L]);if(d&&(d.from||0)==p){if(Jt(t,(null==d.to?h+1:d.to)-p,d.marker,null==d.from),null==d.to)return;d.to==p&&(d=!1)}}if(h<=p)break;for(var T=Math.min(h,v);;){if(m){var M,N=p+m.length;if(d||(M=T<N?m.slice(0,T-p):m,t.addToken(t,M,a?a+s:s,u,p+M.length==v?c:"",l,f)),T<=N){m=m.slice(T-p),p=T;break}p=N,u=""}m=i.slice(o,o=r[g++]),a=Xt(r[g++],t.cm.options)}}else for(var O=1;O<r.length;O+=2)t.addToken(t,i.slice(o,o=r[O]),Xt(r[O+1],t.cm.options))}(o,n,gt(e,o,t!=e.display.externalMeasured&&Je(o))),o.styleClasses&&(o.styleClasses.bgClass&&(n.bgClass=z(o.styleClasses.bgClass,n.bgClass||"")),o.styleClasses.textClass&&(n.textClass=z(o.styleClasses.textClass,n.textClass||""))),0==n.map.length&&n.map.push(0,0,n.content.appendChild(function(e){null==ze&&(t=M("span",""),T(e,M("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(ze=t.offsetWidth<=1&&2<t.offsetHeight&&!(w&&v<8)));var t=ze?M("span",""):M("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return t.setAttribute("cm-text",""),t}(e.display.measure))),0==i?(t.measure.map=n.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(n.map),(t.measure.caches||(t.measure.caches=[])).push({}))}return h&&(r=n.content.lastChild,(/\bcm-tab\b/.test(r.className)||r.querySelector&&r.querySelector(".cm-tab"))&&(n.content.className="cm-tab-wrap-hack")),xe(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=z(n.pre.className,n.textClass||"")),n}function Zt(e){var t=M("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Qt(e,t,r,n,i,o,a){if(t){var l,s=e.splitSpaces?function(e,t){if(1<e.length&&!/ /.test(e))return e;for(var r=t,n="",i=0;i<e.length;i++){var o=e.charAt(i);" "!=o||!r||i!=e.length-1&&32!=e.charCodeAt(i+1)||(o=" "),n+=o,r=" "==o}return n}(t,e.trailingSpace):t,c=e.cm.state.specialChars,u=!1;if(c.test(t)){l=document.createDocumentFragment();for(var d=0;;){c.lastIndex=d;var f=c.exec(t),h=f?f.index-d:t.length-d;if(h&&(p=document.createTextNode(s.slice(d,d+h)),w&&v<9?l.appendChild(M("span",[p])):l.appendChild(p),e.map.push(e.pos,e.pos+h,p),e.col+=h,e.pos+=h),!f)break;d+=1+h;var p=void 0;"\t"==f[0]?(h=(h=e.cm.options.tabSize)-e.col%h,(p=l.appendChild(M("span",G(h),"cm-tab"))).setAttribute("role","presentation"),p.setAttribute("cm-text","\t"),e.col+=h):("\r"==f[0]||"\n"==f[0]?(p=l.appendChild(M("span","\r"==f[0]?"␍":"","cm-invalidchar"))).setAttribute("cm-text",f[0]):((p=e.cm.options.specialCharPlaceholder(f[0])).setAttribute("cm-text",f[0]),w&&v<9?l.appendChild(M("span",[p])):l.appendChild(p)),e.col+=1),e.map.push(e.pos,e.pos+1,p),e.pos++}}else e.col+=t.length,l=document.createTextNode(s),e.map.push(e.pos,e.pos+t.length,l),w&&v<9&&(u=!0),e.pos+=t.length;if(e.trailingSpace=32==s.charCodeAt(t.length-1),r||n||i||u||o||a){r=r||"";n&&(r+=n),i&&(r+=i);var g=M("span",[l],r,o);if(a)for(var m in a)a.hasOwnProperty(m)&&"style"!=m&&"class"!=m&&g.setAttribute(m,a[m]);return e.content.appendChild(g)}e.content.appendChild(l)}}function Jt(e,t,r,n){var i=!n&&r.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!n&&e.cm.display.input.needsContentAttribute&&(i=i||e.content.appendChild(document.createElement("span"))).setAttribute("cm-marker",r.id),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function er(e,t,r){this.line=t,this.rest=function(e){for(var t,r;t=Ft(e);)e=t.find(1,!0).line,(r=r||[]).push(e);return r}(t),this.size=this.rest?Je($(this.rest))-r+1:1,this.node=this.text=null,this.hidden=qt(e,t)}function tr(e,t,r){for(var n=[],i=t;i<r;i=a){var o=new er(e.doc,Xe(e.doc,i),i),a=i+o.size;n.push(o)}return n}var rr=null;function nr(e,t){var r=e.ownsGroup;if(r)try{!function(e){var t=e.delayedCallbacks,r=0;do{for(;r<t.length;r++)t[r].call(null);for(var n=0;n<e.ops.length;n++){var i=e.ops[n];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(r<t.length)}(r)}finally{rr=null,t(r)}}var ir=null;function or(e,t){var r=be(e,t);if(r.length){var n,i=Array.prototype.slice.call(arguments,2);rr?n=rr.delayedCallbacks:ir?n=ir:(n=ir=[],setTimeout(ar,0));for(var o=0;o<r.length;++o)!function(e){n.push(function(){return r[e].apply(null,i)})}(o)}}function ar(){var e=ir;ir=null;for(var t=0;t<e.length;++t)e[t]()}function lr(e,t,r,n){for(var i,o,a,l,s=0;s<t.changes.length;s++){var c=t.changes[s];"text"==c?(i=e,l=a=void 0,a=(o=t).text.className,l=cr(i,o),o.text==o.node&&(o.node=l.pre),o.text.parentNode.replaceChild(l.pre,o.text),o.text=l.pre,l.bgClass!=o.bgClass||l.textClass!=o.textClass?(o.bgClass=l.bgClass,o.textClass=l.textClass,ur(i,o)):a&&(o.text.className=a)):"gutter"==c?dr(e,t,r,n):"class"==c?ur(e,t):"widget"==c&&function(e,t,r){t.alignable&&(t.alignable=null);for(var n=k("CodeMirror-linewidget"),i=t.node.firstChild,o=void 0;i;i=o)o=i.nextSibling,n.test(i.className)&&t.node.removeChild(i);fr(e,t,r)}(e,t,n)}t.changes=null}function sr(e){return e.node==e.text&&(e.node=M("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),w&&v<8&&(e.node.style.zIndex=2)),e.node}function cr(e,t){var r=e.display.externalMeasured;return r&&r.line==t.line?(e.display.externalMeasured=null,t.measure=r.measure,r.built):Yt(e,t)}function ur(e,t){var r,n;r=e,(n=(i=t).bgClass?i.bgClass+" "+(i.line.bgClass||""):i.line.bgClass)&&(n+=" CodeMirror-linebackground"),i.background?n?i.background.className=n:(i.background.parentNode.removeChild(i.background),i.background=null):n&&(e=sr(i),i.background=e.insertBefore(M("div",null,n),e.firstChild),r.display.input.setUneditable(i.background)),t.line.wrapClass?sr(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var i=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=i||""}function dr(e,t,r,n){t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass&&(o=sr(t),t.gutterBackground=M("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px; width: "+n.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),o.insertBefore(t.gutterBackground,t.text));var i=t.line.gutterMarkers;if(e.options.lineNumbers||i){var o=sr(t),a=t.gutter=M("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px");if(e.display.input.setUneditable(a),o.insertBefore(a,t.text),t.line.gutterClass&&(a.className+=" "+t.line.gutterClass),!e.options.lineNumbers||i&&i["CodeMirror-linenumbers"]||(t.lineNumber=a.appendChild(M("div",rt(e.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+n.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),i)for(var l=0;l<e.display.gutterSpecs.length;++l){var s=e.display.gutterSpecs[l].className,c=i.hasOwnProperty(s)&&i[s];c&&a.appendChild(M("div",[c],"CodeMirror-gutter-elt","left: "+n.gutterLeft[s]+"px; width: "+n.gutterWidth[s]+"px"))}}}function fr(e,t,r){if(hr(e,t.line,t,r,!0),t.rest)for(var n=0;n<t.rest.length;n++)hr(e,t.rest[n],t,r,!1)}function hr(e,t,r,n,i){if(t.widgets)for(var o,a,l,s,c=sr(r),u=0,d=t.widgets;u<d.length;++u){var f=d[u],h=M("div",[f.node],"CodeMirror-linewidget"+(f.className?" "+f.className:""));f.handleMouseEvents||h.setAttribute("cm-ignore-events","true"),a=h,l=r,s=n,(o=f).noHScroll&&((l.alignable||(l.alignable=[])).push(a),l=s.wrapperWidth,a.style.left=s.fixedPos+"px",o.coverGutter||(l-=s.gutterTotalWidth,a.style.paddingLeft=s.gutterTotalWidth+"px"),a.style.width=l+"px"),o.coverGutter&&(a.style.zIndex=5,a.style.position="relative",o.noHScroll||(a.style.marginLeft=-s.gutterTotalWidth+"px")),e.display.input.setUneditable(h),i&&f.above?c.insertBefore(h,r.gutter||r.text):c.appendChild(h),or(f,"redraw")}}function pr(e){if(null!=e.height)return e.height;var t,r=e.doc.cm;return r?(O(document.body,e.node)||(t="position: relative;",e.coverGutter&&(t+="margin-left: -"+r.display.gutters.offsetWidth+"px;"),e.noHScroll&&(t+="width: "+r.display.wrapper.clientWidth+"px;"),T(r.display.measure,M("div",[e.node],null,t))),e.height=e.node.parentNode.offsetHeight):0}function gr(e,t){for(var r=Ae(t);r!=e.wrapper;r=r.parentNode)if(!r||1==r.nodeType&&"true"==r.getAttribute("cm-ignore-events")||r.parentNode==e.sizer&&r!=e.mover)return 1}function mr(e){return e.lineSpace.offsetTop}function vr(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function yr(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=T(e.measure,M("pre","x","CodeMirror-line-like")),t=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,t={left:parseInt(t.paddingLeft),right:parseInt(t.paddingRight)};return isNaN(t.left)||isNaN(t.right)||(e.cachedPaddingH=t),t}function br(e){return R-e.display.nativeBarWidth}function wr(e){return e.display.scroller.clientWidth-br(e)-e.display.barWidth}function xr(e){return e.display.scroller.clientHeight-br(e)-e.display.barHeight}function kr(e,t,r){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var n=0;n<e.rest.length;n++)if(e.rest[n]==t)return{map:e.measure.maps[n],cache:e.measure.caches[n]};for(var i=0;i<e.rest.length;i++)if(Je(e.rest[i])>r)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Cr(e,t,r,n){return Tr(e,Lr(e,t),r,n)}function Sr(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Jr(e,t)];e=e.display.externalMeasured;return e&&t>=e.lineN&&t<e.lineN+e.size?e:void 0}function Lr(e,t){var r,n,i=Je(t),o=Sr(e,i);o&&!o.text?o=null:o&&o.changes&&(lr(e,o,i,_r(e)),e.curOp.forceUpdate=!0),o||(r=e,e=Je(n=Rt(n=t)),(n=r.display.externalMeasured=new er(r.doc,n,e)).lineN=e,e=n.built=Yt(r,n),n.text=e.pre,T(r.display.lineMeasure,e.pre),o=n);i=kr(o,t,i);return{line:t,view:o,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Tr(e,t,r,n,i){t.before&&(r=-1);var o,a=r+(n||"");return t.cache.hasOwnProperty(a)?o=t.cache[a]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(function(e,t,r){var n=e.options.lineWrapping,e=n&&wr(e);if(!t.measure.heights||n&&t.measure.width!=e){var i=t.measure.heights=[];if(n){t.measure.width=e;for(var o=t.text.firstChild.getClientRects(),a=0;a<o.length-1;a++){var l=o[a],s=o[a+1];2<Math.abs(l.bottom-s.bottom)&&i.push((l.bottom+s.top)/2-r.top)}}i.push(r.bottom-r.top)}}(e,t.view,t.rect),t.hasHeights=!0),(o=function(e,t,r,n){var i,o=Or(t.map,r,n),a=o.node,l=o.start,s=o.end,c=o.collapse;if(3==a.nodeType){for(var u=0;u<4;u++){for(;l&&re(t.line.text.charAt(o.coverStart+l));)--l;for(;o.coverStart+s<o.coverEnd&&re(t.line.text.charAt(o.coverStart+s));)++s;if((i=w&&v<9&&0==l&&s==o.coverEnd-o.coverStart?a.parentNode.getBoundingClientRect():function(e,t){var r=Nr;if("left"==t)for(var n=0;n<e.length&&(r=e[n]).left==r.right;n++);else for(var i=e.length-1;0<=i&&(r=e[i]).left==r.right;i--);return r}(C(a,l,s).getClientRects(),n)).left||i.right||0==l)break;s=l,--l,c="right"}w&&v<11&&(i=function(e,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!function(e){if(null!=Ie)return Ie;var e=(t=T(e,M("span","x"))).getBoundingClientRect(),t=C(t,0,1).getBoundingClientRect();return Ie=1<Math.abs(e.left-t.left)}(e))return t;var r=screen.logicalXDPI/screen.deviceXDPI,e=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*r,right:t.right*r,top:t.top*e,bottom:t.bottom*e}}(e.display.measure,i))}else 0<l&&(c=n="right"),i=e.options.lineWrapping&&1<(g=a.getClientRects()).length?g["right"==n?g.length-1:0]:a.getBoundingClientRect();!(w&&v<9)||l||i&&(i.left||i.right)||(m=a.parentNode.getClientRects()[0],i=m?{left:m.left,right:m.left+$r(e.display),top:m.top,bottom:m.bottom}:Nr);for(var d=i.top-t.rect.top,r=i.bottom-t.rect.top,f=(d+r)/2,h=t.view.measure.heights,p=0;p<h.length-1&&!(f<h[p]);p++);var g=p?h[p-1]:0,m=h[p],m={left:("right"==c?i.right:i.left)-t.rect.left,right:("left"==c?i.left:i.right)-t.rect.left,top:g,bottom:m};i.left||i.right||(m.bogus=!0);e.options.singleCursorHeightPerLine||(m.rtop=d,m.rbottom=r);return m}(e,t,r,n)).bogus||(t.cache[a]=o)),{left:o.left,right:o.right,top:i?o.rtop:o.top,bottom:i?o.rbottom:o.bottom}}var Mr,Nr={left:0,right:0,top:0,bottom:0};function Or(e,t,r){for(var n,i,o,a,l,s,c=0;c<e.length;c+=3)if(l=e[c],s=e[c+1],t<l?(i=0,o=1,a="left"):t<s?o=(i=t-l)+1:(c==e.length-3||t==s&&e[c+3]>t)&&(i=(o=s-l)-1,s<=t&&(a="right")),null!=i){if(n=e[c+2],l==s&&r==(n.insertLeft?"left":"right")&&(a=r),"left"==r&&0==i)for(;c&&e[c-2]==e[c-3]&&e[c-1].insertLeft;)n=e[2+(c-=3)],a="left";if("right"==r&&i==s-l)for(;c<e.length-3&&e[c+3]==e[c+4]&&!e[c+5].insertLeft;)n=e[(c+=3)+2],a="right";break}return{node:n,start:i,end:o,collapse:a,coverStart:l,coverEnd:s}}function Ar(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function Dr(e){e.display.externalMeasure=null,L(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)Ar(e.display.view[t])}function zr(e){Dr(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function Wr(){return o&&s?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function Pr(){return o&&s?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function Er(e){var t=0;if(e.widgets)for(var r=0;r<e.widgets.length;++r)e.widgets[r].above&&(t+=pr(e.widgets[r]));return t}function Hr(e,t,r,n,i){if(i||(i=Er(t),r.top+=i,r.bottom+=i),"line"==n)return r;n=n||"local";t=Kt(t);return"local"==n?t+=mr(e.display):t-=e.display.viewOffset,"page"!=n&&"window"!=n||(t+=(e=e.display.lineSpace.getBoundingClientRect()).top+("window"==n?0:Pr()),n=e.left+("window"==n?0:Wr()),r.left+=n,r.right+=n),r.top+=t,r.bottom+=t,r}function Fr(e,t,r){if("div"==r)return t;var n=t.left,t=t.top;"page"==r?(n-=Wr(),t-=Pr()):"local"!=r&&r||(n+=(r=e.display.sizer.getBoundingClientRect()).left,t+=r.top);e=e.display.lineSpace.getBoundingClientRect();return{left:n-e.left,top:t-e.top}}function Ir(e,t,r,n,i){return Hr(e,n=n||Xe(e.doc,t.line),Cr(e,n,t.ch,i),r)}function Rr(r,e,n,i,o,a){function l(e,t){e=Tr(r,o,e,t?"right":"left",a);return t?e.left=e.right:e.right=e.left,Hr(r,i,e,n)}i=i||Xe(r.doc,e.line),o=o||Lr(r,i);var s=me(i,r.doc.direction),t=e.ch,c=e.sticky;if(t>=i.text.length?(t=i.text.length,c="before"):t<=0&&(t=0,c="after"),!s)return l("before"==c?t-1:t,"before"==c);function u(e,t,r){return l(r?e-1:e,1==s[t].level!=r)}var d=ae(s,t,c),e=oe,d=u(t,d,"before"==c);return null!=e&&(d.other=u(t,e,"before"!=c)),d}function Br(e,t){var r=0;t=ut(e.doc,t),e.options.lineWrapping||(r=$r(e.display)*t.ch);t=Xe(e.doc,t.line),e=Kt(t)+mr(e.display);return{left:r,right:r,top:e,bottom:e+t.height}}function jr(e,t,r,n,i){r=nt(e,t,r);return r.xRel=i,n&&(r.outside=n),r}function qr(e,t,r){var n=e.doc;if((r+=e.display.viewOffset)<0)return jr(n.first,0,null,-1,-1);var i=et(n,r),o=n.first+n.size-1;if(o<i)return jr(n.first+n.size-1,Xe(n,o).text.length,null,1,1);t<0&&(t=0);for(var a=Xe(n,i);;){var l=function(r,e,t,n,i){i-=Kt(e);var o=Lr(r,e),a=Er(e),l=0,s=e.text.length,c=!0,u=me(e,r.doc.direction);u&&(h=(r.options.lineWrapping?function(e,t,r,n,i,o,a){var a=Kr(e,t,n,a),l=a.begin,s=a.end;/\s/.test(t.text.charAt(s-1))&&s--;for(var c=null,u=null,d=0;d<i.length;d++){var f,h=i[d];h.from>=s||h.to<=l||(f=1!=h.level,f=Tr(e,n,f?Math.min(s,h.to)-1:Math.max(l,h.from)).right,f=f<o?o-f+1e9:f-o,(!c||f<u)&&(c=h,u=f))}c=c||i[i.length-1];c.from<l&&(c={from:l,to:c.to,level:c.level});c.to>s&&(c={from:c.from,to:s,level:c.level});return c}:function(r,n,i,o,a,l,s){var e=ie(function(e){var t=a[e],e=1!=t.level;return Ur(Rr(r,nt(i,e?t.to:t.from,e?"before":"after"),"line",n,o),l,s,!0)},0,a.length-1),t=a[e];{var c;0<e&&(c=1!=t.level,Ur(c=Rr(r,nt(i,c?t.from:t.to,c?"after":"before"),"line",n,o),l,s,!0)&&c.top>s&&(t=a[e-1]))}return t})(r,e,t,o,u,n,i),c=1!=h.level,l=c?h.from:h.to-1,s=c?h.to:h.from-1);var d=null,f=null,u=ie(function(e){var t=Tr(r,o,e);return t.top+=a,t.bottom+=a,Ur(t,n,i,!1)&&(t.top<=i&&t.left<=n&&(d=e,f=t),1)},l,s),h=!1;{var p,g;f?(p=n-f.left<f.right-n,u=d+((g=p==c)?0:1),g=g?"after":"before",p=p?f.left:f.right):(c||u!=s&&u!=l||u++,g=0==u||u!=e.text.length&&Tr(r,o,u-(c?1:0)).bottom+a<=i==c?"after":"before",c=Rr(r,nt(t,u,g),"line",e,o),p=c.left,h=i<c.top?-1:i>=c.bottom?1:0)}return u=ne(e.text,u,1),jr(t,u,g,h,n-p)}(e,a,i,t,r),s=function(e,t){var r,n=Lt&&e.markedSpans;if(n)for(var i=0;i<n.length;++i){var o=n[i];o.marker.collapsed&&(null==o.from||o.from<t)&&(null==o.to||o.to>t)&&(!r||Pt(r,o.marker)<0)&&(r=o.marker)}return r}(a,l.ch+(0<l.xRel||0<l.outside?1:0));if(!s)return l;s=s.find(1);if(s.line==i)return s;a=Xe(n,i=s.line)}}function Kr(t,e,r,n){n-=Er(e);var i=e.text.length,e=ie(function(e){return Tr(t,r,e-1).bottom<=n},i,0);return{begin:e,end:i=ie(function(e){return Tr(t,r,e).top>n},e,i)}}function Vr(e,t,r,n){return Kr(e,t,r=r||Lr(e,t),Hr(e,t,Tr(e,r,n),"line").top)}function Ur(e,t,r,n){return!(e.bottom<=r)&&(e.top>r||(n?e.left:e.right)>t)}function Gr(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Mr){Mr=M("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Mr.appendChild(document.createTextNode("x")),Mr.appendChild(M("br"));Mr.appendChild(document.createTextNode("x"))}T(e.measure,Mr);var r=Mr.offsetHeight/50;return 3<r&&(e.cachedTextHeight=r),L(e.measure),r||1}function $r(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=M("span","xxxxxxxxxx"),r=M("pre",[t],"CodeMirror-line-like");T(e.measure,r);t=t.getBoundingClientRect(),t=(t.right-t.left)/10;return 2<t&&(e.cachedCharWidth=t),t||10}function _r(e){for(var t=e.display,r={},n={},i=t.gutters.clientLeft,o=t.gutters.firstChild,a=0;o;o=o.nextSibling,++a){var l=e.display.gutterSpecs[a].className;r[l]=o.offsetLeft+o.clientLeft+i,n[l]=o.clientWidth}return{fixedPos:Xr(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function Xr(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function Yr(n){var i=Gr(n.display),o=n.options.lineWrapping,a=o&&Math.max(5,n.display.scroller.clientWidth/$r(n.display)-3);return function(e){if(qt(n.doc,e))return 0;var t=0;if(e.widgets)for(var r=0;r<e.widgets.length;r++)e.widgets[r].height&&(t+=e.widgets[r].height);return o?t+(Math.ceil(e.text.length/a)||1)*i:t+i}}function Zr(e){var t=e.doc,r=Yr(e);t.iter(function(e){var t=r(e);t!=e.height&&Qe(e,t)})}function Qr(e,t,r,n){var i=e.display;if(!r&&"true"==Ae(t).getAttribute("cm-not-content"))return null;var o,a,l=i.lineSpace.getBoundingClientRect();try{o=t.clientX-l.left,a=t.clientY-l.top}catch(e){return null}var s,i=qr(e,o,a);return n&&0<i.xRel&&(s=Xe(e.doc,i.line).text).length==i.ch&&(s=H(s,s.length,e.options.tabSize)-s.length,i=nt(i.line,Math.max(0,Math.round((o-yr(e.display).left)/$r(e.display))-s))),i}function Jr(e,t){if(t>=e.display.viewTo)return null;if((t-=e.display.viewFrom)<0)return null;for(var r=e.display.view,n=0;n<r.length;n++)if((t-=r[n].size)<0)return n}function en(e,t,r,n){null==t&&(t=e.doc.first),null==r&&(r=e.doc.first+e.doc.size),n=n||0;var i,o,a=e.display;n&&r<a.viewTo&&(null==a.updateLineNumbers||a.updateLineNumbers>t)&&(a.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=a.viewTo?Lt&&Bt(e.doc,t)<a.viewTo&&rn(e):r<=a.viewFrom?Lt&&jt(e.doc,r+n)>a.viewFrom?rn(e):(a.viewFrom+=n,a.viewTo+=n):t<=a.viewFrom&&r>=a.viewTo?rn(e):t<=a.viewFrom?(i=nn(e,r,r+n,1))?(a.view=a.view.slice(i.index),a.viewFrom=i.lineN,a.viewTo+=n):rn(e):r>=a.viewTo?(o=nn(e,t,t,-1))?(a.view=a.view.slice(0,o.index),a.viewTo=o.lineN):rn(e):(i=nn(e,t,t,-1),o=nn(e,r,r+n,1),i&&o?(a.view=a.view.slice(0,i.index).concat(tr(e,i.lineN,o.lineN)).concat(a.view.slice(o.index)),a.viewTo+=n):rn(e));e=a.externalMeasured;e&&(r<e.lineN?e.lineN+=n:t<e.lineN+e.size&&(a.externalMeasured=null))}function tn(e,t,r){e.curOp.viewChanged=!0;var n=e.display,i=e.display.externalMeasured;i&&t>=i.lineN&&t<i.lineN+i.size&&(n.externalMeasured=null),t<n.viewFrom||t>=n.viewTo||(null==(t=n.view[Jr(e,t)]).node||-1==I(t=t.changes||(t.changes=[]),r)&&t.push(r))}function rn(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function nn(e,t,r,n){var i,o=Jr(e,t),a=e.display.view;if(!Lt||r==e.doc.first+e.doc.size)return{index:o,lineN:r};for(var l=e.display.viewFrom,s=0;s<o;s++)l+=a[s].size;if(l!=t){if(0<n){if(o==a.length-1)return null;i=l+a[o].size-t,o++}else i=l-t;t+=i,r+=i}for(;Bt(e.doc,r)!=r;){if(o==(n<0?0:a.length-1))return null;r+=n*a[o-(n<0?1:0)].size,o+=n}return{index:o,lineN:r}}function on(e){for(var t=e.display.view,r=0,n=0;n<t.length;n++){var i=t[n];i.hidden||i.node&&!i.changes||++r}return r}function an(e){e.display.input.showSelection(e.display.input.prepareSelection())}function ln(e,t){void 0===t&&(t=!0);for(var r,n,i=e.doc,o={},a=o.cursors=document.createDocumentFragment(),l=o.selection=document.createDocumentFragment(),s=0;s<i.sel.ranges.length;s++)!t&&s==i.sel.primIndex||((r=i.sel.ranges[s]).from().line>=e.display.viewTo||r.to().line<e.display.viewFrom||(((n=r.empty())||e.options.showCursorWhenSelecting)&&sn(e,r.head,a),n||function(i,e,t){var r=i.display,o=i.doc,a=document.createDocumentFragment(),n=yr(i.display),C=n.left,S=Math.max(r.sizerWidth,wr(i)-r.sizer.offsetLeft)-n.right,L="ltr"==o.direction;function T(e,t,r,n){t<0&&(t=0),t=Math.round(t),n=Math.round(n),a.appendChild(M("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px;\n top: "+t+"px; width: "+(null==r?S-e:r)+"px;\n height: "+(n-t)+"px"))}function l(r,g,m){var v,y,n=Xe(o,r),b=n.text.length;function w(e,t){return Ir(i,nt(r,e),"div",n,t)}function x(e,t,r){e=Vr(i,n,null,e),t="ltr"==t==("after"==r)?"left":"right";return w("after"==r?e.begin:e.end-(/\s/.test(n.text.charAt(e.end-1))?2:1),t)[t]}var k=me(n,o.direction);return function(e,t,r,n){if(!e)return n(t,r,"ltr",0);for(var i=!1,o=0;o<e.length;++o){var a=e[o];(a.from<r&&a.to>t||t==r&&a.to==t)&&(n(Math.max(a.from,t),Math.min(a.to,r),1==a.level?"rtl":"ltr",o),i=!0)}i||n(t,r,"ltr")}(k,g||0,null==m?b:m,function(e,t,r,n){var i,o,a,l,s="ltr"==r,c=w(e,s?"left":"right"),u=w(t-1,s?"right":"left"),d=null==g&&0==e,f=null==m&&t==b,h=0==n,p=!k||n==k.length-1;u.top-c.top<=3?(i=(L?f:d)&&p,n=(L?d:f)&&h?C:(s?c:u).left,i=i?S:(s?u:c).right,T(n,c.top,i-n,c.bottom)):(r=s?(o=L&&d&&h?C:c.left,a=L?S:x(e,r,"before"),l=L?C:x(t,r,"after"),L&&f&&p?S:u.right):(o=L?x(e,r,"before"):C,a=!L&&d&&h?S:c.right,l=!L&&f&&p?C:u.left,L?x(t,r,"after"):S),T(o,c.top,a-o,c.bottom),c.bottom<u.top&&T(C,c.bottom,null,u.top),T(l,u.top,r-l,u.bottom)),(!v||cn(c,v)<0)&&(v=c),cn(u,v)<0&&(v=u),(!y||cn(c,y)<0)&&(y=c),cn(u,y)<0&&(y=u)}),{start:v,end:y}}var s=e.from(),r=e.to();s.line==r.line?l(s.line,s.ch,r.ch):(n=Xe(o,s.line),e=Xe(o,r.line),e=Rt(n)==Rt(e),n=l(s.line,s.ch,e?n.text.length+1:null).end,r=l(r.line,e?0:null,r.ch).start,e&&(n.top<r.top-2?(T(n.right,n.top,null,n.bottom),T(C,r.top,r.left,r.bottom)):T(n.right,n.top,r.left-n.right,n.bottom)),n.bottom<r.top&&T(C,n.bottom,null,r.top)),t.appendChild(a)}(e,r,l)));return o}function sn(e,t,r){var n=Rr(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),t=r.appendChild(M("div"," ","CodeMirror-cursor"));t.style.left=n.left+"px",t.style.top=n.top+"px",t.style.height=Math.max(0,n.bottom-n.top)*e.options.cursorHeight+"px",n.other&&((r=r.appendChild(M("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"))).style.display="",r.style.left=n.other.left+"px",r.style.top=n.other.top+"px",r.style.height=.85*(n.other.bottom-n.other.top)+"px")}function cn(e,t){return e.top-t.top||e.left-t.left}function un(e){var t,r;e.state.focused&&(t=e.display,clearInterval(t.blinker),r=!0,t.cursorDiv.style.visibility="",0<e.options.cursorBlinkRate?t.blinker=setInterval(function(){e.hasFocus()||pn(e),t.cursorDiv.style.visibility=(r=!r)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden"))}function dn(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||hn(e))}function fn(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&pn(e))},100)}function hn(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(xe(e,"focus",e,t),e.state.focused=!0,D(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),h&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),un(e))}function pn(e,t){e.state.delayingBlurEvent||(e.state.focused&&(xe(e,"blur",e,t),e.state.focused=!1,S(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function gn(e){for(var t=e.display,r=t.lineDiv.offsetTop,n=0;n<t.view.length;n++){var i,o=t.view[n],a=e.options.lineWrapping,l=void 0,s=0;if(!o.hidden){w&&v<8?(l=(i=o.node.offsetTop+o.node.offsetHeight)-r,r=i):(l=(c=o.node.getBoundingClientRect()).bottom-c.top,!a&&o.text.firstChild&&(s=o.text.firstChild.getBoundingClientRect().right-c.left-1));var c=o.line.height-l;if((.005<c||c<-.005)&&(Qe(o.line,l),mn(o.line),o.rest))for(var u=0;u<o.rest.length;u++)mn(o.rest[u]);s>e.display.sizerWidth&&((s=Math.ceil(s/$r(e.display)))>e.display.maxLineLength&&(e.display.maxLineLength=s,e.display.maxLine=o.line,e.display.maxLineChanged=!0))}}}function mn(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var r=e.widgets[t],n=r.node.parentNode;n&&(r.height=n.offsetHeight)}}function vn(e,t,r){var n=r&&null!=r.top?Math.max(0,r.top):e.scroller.scrollTop,n=Math.floor(n-mr(e)),i=r&&null!=r.bottom?r.bottom:n+e.wrapper.clientHeight,o=et(t,n),n=et(t,i);return r&&r.ensure&&(i=r.ensure.from.line,r=r.ensure.to.line,i<o?n=et(t,Kt(Xe(t,o=i))+e.wrapper.clientHeight):Math.min(r,t.lastLine())>=n&&(o=et(t,Kt(Xe(t,r))-e.wrapper.clientHeight),n=r)),{from:o,to:Math.max(n,o+1)}}function yn(e,t){var r=e.display,n=Gr(e.display);t.top<0&&(t.top=0);var i=(e.curOp&&null!=e.curOp.scrollTop?e.curOp:r.scroller).scrollTop,o=xr(e),a={};t.bottom-t.top>o&&(t.bottom=t.top+o);var l=e.doc.height+vr(r),s=t.top<n,n=t.bottom>l-n;t.top<i?a.scrollTop=s?0:t.top:t.bottom>i+o&&((c=Math.min(t.top,(n?l:t.bottom)-o))!=i&&(a.scrollTop=c));var i=e.options.fixedGutter?0:r.gutters.offsetWidth,c=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:r.scroller.scrollLeft-i,e=wr(e)-r.gutters.offsetWidth,r=t.right-t.left>e;return r&&(t.right=t.left+e),t.left<10?a.scrollLeft=0:t.left<c?a.scrollLeft=Math.max(0,t.left+i-(r?0:10)):t.right>e+c-3&&(a.scrollLeft=t.right+(r?0:10)-e),a}function bn(e,t){null!=t&&(kn(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc:e.curOp).scrollTop+t)}function wn(e){kn(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function xn(e,t,r){null==t&&null==r||kn(e),null!=t&&(e.curOp.scrollLeft=t),null!=r&&(e.curOp.scrollTop=r)}function kn(e){var t=e.curOp.scrollToPos;t&&(e.curOp.scrollToPos=null,Cn(e,Br(e,t.from),Br(e,t.to),t.margin))}function Cn(e,t,r,n){n=yn(e,{left:Math.min(t.left,r.left),top:Math.min(t.top,r.top)-n,right:Math.max(t.right,r.right),bottom:Math.max(t.bottom,r.bottom)+n});xn(e,n.scrollLeft,n.scrollTop)}function Sn(e,t){Math.abs(e.doc.scrollTop-t)<2||(f||Vn(e,{top:t}),Ln(e,t,!0),f&&Vn(e),Rn(e,100))}function Ln(e,t,r){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!r||(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function Tn(e,t,r,n){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(r?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!n||(e.doc.scrollLeft=t,$n(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function Mn(e){var t=e.display,r=t.gutters.offsetWidth,n=Math.round(e.doc.height+vr(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?r:0,docHeight:n,scrollHeight:n+br(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}e=function(e,t,r){this.cm=r;var n=this.vert=M("div",[M("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=M("div",[M("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");n.tabIndex=i.tabIndex=-1,e(n),e(i),ye(n,"scroll",function(){n.clientHeight&&t(n.scrollTop,"vertical")}),ye(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,w&&v<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};e.prototype.update=function(e){var t,r=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,i=e.nativeBarWidth;return n?(this.vert.style.display="block",this.vert.style.bottom=r?i+"px":"0",t=e.viewHeight-(r?i:0),this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+t)+"px"):(this.vert.style.display="",this.vert.firstChild.style.height="0"),r?(this.horiz.style.display="block",this.horiz.style.right=n?i+"px":"0",this.horiz.style.left=e.barLeft+"px",t=e.viewWidth-e.barLeft-(n?i:0),this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+t)+"px"):(this.horiz.style.display="",this.horiz.firstChild.style.width="0"),!this.checkedZeroWidth&&0<e.clientHeight&&(0==i&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?i:0,bottom:r?i:0}},e.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},e.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},e.prototype.zeroWidthHack=function(){var e=g&&!a?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new F,this.disableVert=new F},e.prototype.enableZeroWidthBar=function(r,n,i){r.style.pointerEvents="auto",n.set(1e3,function e(){var t=r.getBoundingClientRect();("vert"==i?document.elementFromPoint(t.right-1,(t.top+t.bottom)/2):document.elementFromPoint((t.right+t.left)/2,t.bottom-1))!=r?r.style.pointerEvents="none":n.set(1e3,e)})},e.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};n=function(){};function Nn(e,t){t=t||Mn(e);var r=e.display.barWidth,n=e.display.barHeight;On(e,t);for(var i=0;i<4&&r!=e.display.barWidth||n!=e.display.barHeight;i++)r!=e.display.barWidth&&e.options.lineWrapping&&gn(e),On(e,Mn(e)),r=e.display.barWidth,n=e.display.barHeight}function On(e,t){var r=e.display,n=r.scrollbars.update(t);r.sizer.style.paddingRight=(r.barWidth=n.right)+"px",r.sizer.style.paddingBottom=(r.barHeight=n.bottom)+"px",r.heightForcer.style.borderBottom=n.bottom+"px solid transparent",n.right&&n.bottom?(r.scrollbarFiller.style.display="block",r.scrollbarFiller.style.height=n.bottom+"px",r.scrollbarFiller.style.width=n.right+"px"):r.scrollbarFiller.style.display="",n.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(r.gutterFiller.style.display="block",r.gutterFiller.style.height=n.bottom+"px",r.gutterFiller.style.width=t.gutterWidth+"px"):r.gutterFiller.style.display=""}n.prototype.update=function(){return{bottom:0,right:0}},n.prototype.setScrollLeft=function(){},n.prototype.setScrollTop=function(){},n.prototype.clear=function(){};var An={native:e,null:n};function Dn(r){r.display.scrollbars&&(r.display.scrollbars.clear(),r.display.scrollbars.addClass&&S(r.display.wrapper,r.display.scrollbars.addClass)),r.display.scrollbars=new An[r.options.scrollbarStyle](function(e){r.display.wrapper.insertBefore(e,r.display.scrollbarFiller),ye(e,"mousedown",function(){r.state.focused&&setTimeout(function(){return r.display.input.focus()},0)}),e.setAttribute("cm-not-content","true")},function(e,t){("horizontal"==t?Tn:Sn)(r,e)},r),r.display.scrollbars.addClass&&D(r.display.wrapper,r.display.scrollbars.addClass)}var zn=0;function Wn(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++zn},e=e.curOp,rr?rr.ops.push(e):e.ownsGroup=rr={ops:[e],delayedCallbacks:[]}}function Pn(e){e=e.curOp;e&&nr(e,function(a){for(var e=0;e<a.ops.length;e++)a.ops[e].cm.curOp=null;!function(){for(var e=a.ops,t=0;t<e.length;t++)!function(e){var t=e.cm,r=t.display;(function(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=br(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=br(e)+"px",t.scrollbarsClipped=!0)})(t),e.updateMaxLine&&Ut(t),e.mustUpdate=e.viewChanged||e.forceUpdate||null!=e.scrollTop||e.scrollToPos&&(e.scrollToPos.from.line<r.viewFrom||e.scrollToPos.to.line>=r.viewTo)||r.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new jn(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}(e[t]);for(var r=0;r<e.length;r++)!function(e){e.updatedDisplay=e.mustUpdate&&qn(e.cm,e.update)}(e[r]);for(var n=0;n<e.length;n++)!function(e){var t=e.cm,r=t.display;e.updatedDisplay&&gn(t),e.barMeasure=Mn(t),r.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Cr(t,r.maxLine,r.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(r.scroller.clientWidth,r.sizer.offsetLeft+e.adjustWidthTo+br(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-wr(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=r.input.prepareSelection())}(e[n]);for(var i=0;i<e.length;i++)!function(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&Tn(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var r=e.focus&&e.focus==A();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,r),!e.updatedDisplay&&e.startHeight==t.doc.height||Nn(t,e.barMeasure),e.updatedDisplay&&Gn(t,e.barMeasure),e.selectionChanged&&un(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),r&&dn(e.cm)}(e[i]);for(var o=0;o<e.length;o++)!function(e){var t,r=e.cm,n=r.display,i=r.doc;e.updatedDisplay&&Kn(r,e.update),null==n.wheelStartX||null==e.scrollTop&&null==e.scrollLeft&&!e.scrollToPos||(n.wheelStartX=n.wheelStartY=null),null!=e.scrollTop&&Ln(r,e.scrollTop,e.forceScroll),null!=e.scrollLeft&&Tn(r,e.scrollLeft,!0,!0),e.scrollToPos&&(t=function(e,t,r,n){null==n&&(n=0),e.options.lineWrapping||t!=r||(r="before"==(t=t.ch?nt(t.line,"before"==t.sticky?t.ch-1:t.ch,"after"):t).sticky?nt(t.line,t.ch+1,"before"):t);for(var i=0;i<5;i++){var o,a=!1,l=Rr(e,t),s=r&&r!=t?Rr(e,r):l,c=yn(e,o={left:Math.min(l.left,s.left),top:Math.min(l.top,s.top)-n,right:Math.max(l.left,s.left),bottom:Math.max(l.bottom,s.bottom)+n}),l=e.doc.scrollTop,s=e.doc.scrollLeft;if(null!=c.scrollTop&&(Sn(e,c.scrollTop),1<Math.abs(e.doc.scrollTop-l)&&(a=!0)),null!=c.scrollLeft&&(Tn(e,c.scrollLeft),1<Math.abs(e.doc.scrollLeft-s)&&(a=!0)),!a)break}return o}(r,ut(i,e.scrollToPos.from),ut(i,e.scrollToPos.to),e.scrollToPos.margin),function(e,t){var r,n,i;ke(e,"scrollCursorIntoView")||(n=(r=e.display).sizer.getBoundingClientRect(),i=null,t.top+n.top<0?i=!0:t.bottom+n.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null==i||c||(t=M("div","",null,"position: absolute;\n top: "+(t.top-r.viewOffset-mr(e.display))+"px;\n height: "+(t.bottom-t.top+br(e)+r.barHeight)+"px;\n left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;"),e.display.lineSpace.appendChild(t),t.scrollIntoView(i),e.display.lineSpace.removeChild(t)))}(r,t));var o=e.maybeHiddenMarkers,a=e.maybeUnhiddenMarkers;if(o)for(var l=0;l<o.length;++l)o[l].lines.length||xe(o[l],"hide");if(a)for(var s=0;s<a.length;++s)a[s].lines.length&&xe(a[s],"unhide");n.wrapper.offsetHeight&&(i.scrollTop=r.display.scroller.scrollTop),e.changeObjs&&xe(r,"changes",r,e.changeObjs),e.update&&e.update.finish()}(e[o])}()})}function En(e,t){if(e.curOp)return t();Wn(e);try{return t()}finally{Pn(e)}}function Hn(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Wn(e);try{return t.apply(e,arguments)}finally{Pn(e)}}}function Fn(e){return function(){if(this.curOp)return e.apply(this,arguments);Wn(this);try{return e.apply(this,arguments)}finally{Pn(this)}}}function In(t){return function(){var e=this.cm;if(!e||e.curOp)return t.apply(this,arguments);Wn(e);try{return t.apply(this,arguments)}finally{Pn(e)}}}function Rn(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,P(Bn,e))}function Bn(a){var l,s,c,u=a.doc;u.highlightFrontier>=a.display.viewTo||(l=+new Date+a.options.workTime,s=mt(a,u.highlightFrontier),c=[],u.iter(s.line,Math.min(u.first+u.size,a.display.viewTo+500),function(e){if(s.line>=a.display.viewFrom){var t=e.styles,r=e.text.length>a.options.maxHighlightLength?Ue(u.mode,s.state):null,n=pt(a,e,s,!0);r&&(s.state=r),e.styles=n.styles;r=e.styleClasses,n=n.classes;n?e.styleClasses=n:r&&(e.styleClasses=null);for(var i=!t||t.length!=e.styles.length||r!=n&&(!r||!n||r.bgClass!=n.bgClass||r.textClass!=n.textClass),o=0;!i&&o<t.length;++o)i=t[o]!=e.styles[o];i&&c.push(s.line),e.stateAfter=s.save(),s.nextLine()}else e.text.length<=a.options.maxHighlightLength&&vt(a,e.text,s),e.stateAfter=s.line%5==0?s.save():null,s.nextLine();if(+new Date>l)return Rn(a,a.options.workDelay),!0}),u.highlightFrontier=s.line,u.modeFrontier=Math.max(u.modeFrontier,s.line),c.length&&En(a,function(){for(var e=0;e<c.length;e++)tn(a,c[e],"text")}))}var jn=function(e,t,r){var n=e.display;this.viewport=t,this.visible=vn(n,e.doc,t),this.editorIsHidden=!n.wrapper.offsetWidth,this.wrapperHeight=n.wrapper.clientHeight,this.wrapperWidth=n.wrapper.clientWidth,this.oldDisplayWidth=wr(e),this.force=r,this.dims=_r(e),this.events=[]};function qn(e,t){var r=e.display,n=e.doc;if(t.editorIsHidden)return rn(e),!1;if(!t.force&&t.visible.from>=r.viewFrom&&t.visible.to<=r.viewTo&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo)&&r.renderedView==r.view&&0==on(e))return!1;_n(e)&&(rn(e),t.dims=_r(e));var i=n.first+n.size,o=Math.max(t.visible.from-e.options.viewportMargin,n.first),a=Math.min(i,t.visible.to+e.options.viewportMargin);r.viewFrom<o&&o-r.viewFrom<20&&(o=Math.max(n.first,r.viewFrom)),r.viewTo>a&&r.viewTo-a<20&&(a=Math.min(i,r.viewTo)),Lt&&(o=Bt(e.doc,o),a=jt(e.doc,a));var l=o!=r.viewFrom||a!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;n=o,i=a,0==(a=(o=e).display).view.length||n>=a.viewTo||i<=a.viewFrom?(a.view=tr(o,n,i),a.viewFrom=n):(a.viewFrom>n?a.view=tr(o,n,a.viewFrom).concat(a.view):a.viewFrom<n&&(a.view=a.view.slice(Jr(o,n))),a.viewFrom=n,a.viewTo<i?a.view=a.view.concat(tr(o,a.viewTo,i)):a.viewTo>i&&(a.view=a.view.slice(0,Jr(o,i)))),a.viewTo=i,r.viewOffset=Kt(Xe(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";o=on(e);if(!l&&0==o&&!t.force&&r.renderedView==r.view&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo))return!1;a=function(e){if(e.hasFocus())return null;var t=A();if(!t||!O(e.display.lineDiv,t))return null;var r={activeElt:t};return!window.getSelection||(t=window.getSelection()).anchorNode&&t.extend&&O(e.display.lineDiv,t.anchorNode)&&(r.anchorNode=t.anchorNode,r.anchorOffset=t.anchorOffset,r.focusNode=t.focusNode,r.focusOffset=t.focusOffset),r}(e);return 4<o&&(r.lineDiv.style.display="none"),function(r,e,t){var n=r.display,i=r.options.lineNumbers,o=n.lineDiv,a=o.firstChild;function l(e){var t=e.nextSibling;return h&&g&&r.display.currentWheelTarget==e?e.style.display="none":e.parentNode.removeChild(e),t}for(var s=n.view,c=n.viewFrom,u=0;u<s.length;u++){var d=s[u];if(!d.hidden)if(d.node&&d.node.parentNode==o){for(;a!=d.node;)a=l(a);var f=i&&null!=e&&e<=c&&d.lineNumber;d.changes&&(-1<I(d.changes,"gutter")&&(f=!1),lr(r,d,c,t)),f&&(L(d.lineNumber),d.lineNumber.appendChild(document.createTextNode(rt(r.options,c)))),a=d.node.nextSibling}else{f=function(e,t,r,n){var i=cr(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),ur(e,t),dr(e,t,r,n),fr(e,t,n),t.node}(r,d,c,t);o.insertBefore(f,a)}c+=d.size}for(;a;)a=l(a)}(e,r.updateLineNumbers,t.dims),4<o&&(r.lineDiv.style.display=""),r.renderedView=r.view,(i=a)&&i.activeElt&&i.activeElt!=A()&&(i.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(i.activeElt.nodeName)&&i.anchorNode&&O(document.body,i.anchorNode)&&O(document.body,i.focusNode)&&(o=window.getSelection(),(a=document.createRange()).setEnd(i.anchorNode,i.anchorOffset),a.collapse(!1),o.removeAllRanges(),o.addRange(a),o.extend(i.focusNode,i.focusOffset))),L(r.cursorDiv),L(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,l&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,Rn(e,400)),!(r.updateLineNumbers=null)}function Kn(e,t){for(var r=t.viewport,n=!0;;n=!1){if(n&&e.options.lineWrapping&&t.oldDisplayWidth!=wr(e))n&&(t.visible=vn(e.display,e.doc,r));else if(r&&null!=r.top&&(r={top:Math.min(e.doc.height+vr(e.display)-xr(e),r.top)}),t.visible=vn(e.display,e.doc,r),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break;if(!qn(e,t))break;gn(e);var i=Mn(e);an(e),Nn(e,i),Gn(e,i),t.force=!1}t.signal(e,"update",e),e.display.viewFrom==e.display.reportedViewFrom&&e.display.viewTo==e.display.reportedViewTo||(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function Vn(e,t){var r=new jn(e,t);qn(e,r)&&(gn(e),Kn(e,r),t=Mn(e),an(e),Nn(e,t),Gn(e,t),r.finish())}function Un(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Gn(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+br(e)+"px"}function $n(e){var t=e.display,r=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var n=Xr(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=n+"px",a=0;a<r.length;a++)if(!r[a].hidden){e.options.fixedGutter&&(r[a].gutter&&(r[a].gutter.style.left=o),r[a].gutterBackground&&(r[a].gutterBackground.style.left=o));var l=r[a].alignable;if(l)for(var s=0;s<l.length;s++)l[s].style.left=o}e.options.fixedGutter&&(t.gutters.style.left=n+i+"px")}}function _n(e){if(e.options.lineNumbers){var t=e.doc,r=rt(e.options,t.first+t.size-1),n=e.display;if(r.length!=n.lineNumChars){var i=n.measure.appendChild(M("div",[M("div",r)],"CodeMirror-linenumber CodeMirror-gutter-elt")),t=i.firstChild.offsetWidth,i=i.offsetWidth-t;return n.lineGutter.style.width="",n.lineNumInnerWidth=Math.max(t,n.lineGutter.offsetWidth-i)+1,n.lineNumWidth=n.lineNumInnerWidth+i,n.lineNumChars=n.lineNumInnerWidth?r.length:-1,n.lineGutter.style.width=n.lineNumWidth+"px",Un(e.display),1}}}function Xn(e,t){for(var r=[],n=!1,i=0;i<e.length;i++){var o=e[i],a=null;if("string"!=typeof o&&(a=o.style,o=o.className),"CodeMirror-linenumbers"==o){if(!t)continue;n=!0}r.push({className:o,style:a})}return t&&!n&&r.push({className:"CodeMirror-linenumbers",style:null}),r}function Yn(e){var t=e.gutters,r=e.gutterSpecs;L(t),e.lineGutter=null;for(var n=0;n<r.length;++n){var i=r[n],o=i.className,a=i.style,i=t.appendChild(M("div",null,"CodeMirror-gutter "+o));a&&(i.style.cssText=a),"CodeMirror-linenumbers"==o&&((e.lineGutter=i).style.width=(e.lineNumWidth||1)+"px")}t.style.display=r.length?"":"none",Un(e)}function Zn(e){Yn(e.display),en(e),$n(e)}function Qn(e,t,r,n){var i=this;this.input=r,i.scrollbarFiller=M("div",null,"CodeMirror-scrollbar-filler"),i.scrollbarFiller.setAttribute("cm-not-content","true"),i.gutterFiller=M("div",null,"CodeMirror-gutter-filler"),i.gutterFiller.setAttribute("cm-not-content","true"),i.lineDiv=N("div",null,"CodeMirror-code"),i.selectionDiv=M("div",null,null,"position: relative; z-index: 1"),i.cursorDiv=M("div",null,"CodeMirror-cursors"),i.measure=M("div",null,"CodeMirror-measure"),i.lineMeasure=M("div",null,"CodeMirror-measure"),i.lineSpace=N("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var o=N("div",[i.lineSpace],"CodeMirror-lines");i.mover=M("div",[o],null,"position: relative"),i.sizer=M("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=M("div",null,null,"position: absolute; height: "+R+"px; width: 1px;"),i.gutters=M("div",null,"CodeMirror-gutters"),i.lineGutter=null,i.scroller=M("div",[i.sizer,i.heightForcer,i.gutters],"CodeMirror-scroll"),i.scroller.setAttribute("tabIndex","-1"),i.wrapper=M("div",[i.scrollbarFiller,i.gutterFiller,i.scroller],"CodeMirror"),w&&v<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),h||f&&d||(i.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(i.wrapper):e(i.wrapper)),i.viewFrom=i.viewTo=t.first,i.reportedViewFrom=i.reportedViewTo=t.first,i.view=[],i.renderedView=null,i.externalMeasured=null,i.viewOffset=0,i.lastWrapHeight=i.lastWrapWidth=0,i.updateLineNumbers=null,i.nativeBarWidth=i.barHeight=i.barWidth=0,i.scrollbarsClipped=!1,i.lineNumWidth=i.lineNumInnerWidth=i.lineNumChars=null,i.alignWidgets=!1,i.cachedCharWidth=i.cachedTextHeight=i.cachedPaddingH=null,i.maxLine=null,i.maxLineLength=0,i.maxLineChanged=!1,i.wheelDX=i.wheelDY=i.wheelStartX=i.wheelStartY=null,i.shift=!1,i.selForContextMenu=null,i.activeTouch=null,i.gutterSpecs=Xn(n.gutters,n.lineNumbers),Yn(i),r.init(i)}jn.prototype.signal=function(e,t){Se(e,t)&&this.events.push(arguments)},jn.prototype.finish=function(){for(var e=0;e<this.events.length;e++)xe.apply(null,this.events[e])};var Jn=0,ei=null;function ti(e){var t=e.wheelDeltaX,r=e.wheelDeltaY;return null==t&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),null==r&&e.detail&&e.axis==e.VERTICAL_AXIS?r=e.detail:null==r&&(r=e.wheelDelta),{x:t,y:r}}function ri(e){e=ti(e);return e.x*=ei,e.y*=ei,e}function ni(e,t){var r=ti(t),n=r.x,i=r.y,o=e.display,a=o.scroller,l=a.scrollWidth>a.clientWidth,s=a.scrollHeight>a.clientHeight;if(n&&l||i&&s){if(i&&g&&h)e:for(var c=t.target,u=o.view;c!=a;c=c.parentNode)for(var d=0;d<u.length;d++)if(u[d].node==c){e.display.currentWheelTarget=c;break e}if(n&&!f&&!p&&null!=ei)return i&&s&&Sn(e,Math.max(0,a.scrollTop+i*ei)),Tn(e,Math.max(0,a.scrollLeft+n*ei)),(!i||i&&s)&&Te(t),void(o.wheelStartX=null);i&&null!=ei&&(r=i*ei,s=(l=e.doc.scrollTop)+o.wrapper.clientHeight,r<0?l=Math.max(0,l+r-50):s=Math.min(e.doc.height,s+r+50),Vn(e,{top:l,bottom:s})),Jn<20&&(null==o.wheelStartX?(o.wheelStartX=a.scrollLeft,o.wheelStartY=a.scrollTop,o.wheelDX=n,o.wheelDY=i,setTimeout(function(){var e,t;null!=o.wheelStartX&&(t=a.scrollLeft-o.wheelStartX,t=(e=a.scrollTop-o.wheelStartY)&&o.wheelDY&&e/o.wheelDY||t&&o.wheelDX&&t/o.wheelDX,o.wheelStartX=o.wheelStartY=null,t&&(ei=(ei*Jn+t)/(Jn+1),++Jn))},200)):(o.wheelDX+=n,o.wheelDY+=i))}}w?ei=-.53:f?ei=15:o?ei=-.7:u&&(ei=-1/3);var ii=function(e,t){this.ranges=e,this.primIndex=t};ii.prototype.primary=function(){return this.ranges[this.primIndex]},ii.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var r=this.ranges[t],n=e.ranges[t];if(!ot(r.anchor,n.anchor)||!ot(r.head,n.head))return!1}return!0},ii.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new oi(at(this.ranges[t].anchor),at(this.ranges[t].head));return new ii(e,this.primIndex)},ii.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},ii.prototype.contains=function(e,t){t=t||e;for(var r=0;r<this.ranges.length;r++){var n=this.ranges[r];if(0<=it(t,n.from())&&it(e,n.to())<=0)return r}return-1};var oi=function(e,t){this.anchor=e,this.head=t};function ai(e,t,r){var n=e&&e.options.selectionsMayTouch,e=t[r];t.sort(function(e,t){return it(e.from(),t.from())}),r=I(t,e);for(var i=1;i<t.length;i++){var o,a=t[i],l=t[i-1],s=it(l.to(),a.from());(n&&!a.empty()?0<s:0<=s)&&(o=st(l.from(),a.from()),s=lt(l.to(),a.to()),l=l.empty()?a.from()==a.head:l.from()==l.head,i<=r&&--r,t.splice(--i,2,new oi(l?s:o,l?o:s)))}return new ii(t,r)}function li(e,t){return new ii([new oi(e,t||e)],0)}function si(e){return e.text?nt(e.from.line+e.text.length-1,$(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function ci(e,t){if(it(e,t.from)<0)return e;if(it(e,t.to)<=0)return si(t);var r=e.line+t.text.length-(t.to.line-t.from.line)-1,n=e.ch;return e.line==t.to.line&&(n+=si(t).ch-t.to.ch),nt(r,n)}function ui(e,t){for(var r=[],n=0;n<e.sel.ranges.length;n++){var i=e.sel.ranges[n];r.push(new oi(ci(i.anchor,t),ci(i.head,t)))}return ai(e.cm,r,e.sel.primIndex)}function di(e,t,r){return e.line==t.line?nt(r.line,e.ch-t.ch+r.ch):nt(r.line+(e.line-t.line),e.ch)}function fi(e){e.doc.mode=qe(e.options,e.doc.modeOption),hi(e)}function hi(e){e.doc.iter(function(e){e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)}),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,Rn(e,100),e.state.modeGen++,e.curOp&&en(e)}function pi(e,t){return 0==t.from.ch&&0==t.to.ch&&""==$(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function gi(e,o,t,a){function i(e){return t?t[e]:null}function r(e,t,r){var n,i;n=t,i=r,t=a,(r=e).text=n,r.stateAfter&&(r.stateAfter=null),r.styles&&(r.styles=null),null!=r.order&&(r.order=null),At(r),Dt(r,i),(t=t?t(r):1)!=r.height&&Qe(r,t),or(e,"change",e,o)}function n(e,t){for(var r=[],n=e;n<t;++n)r.push(new Gt(u[n],i(n),a));return r}var l,s=o.from,c=o.to,u=o.text,d=Xe(e,s.line),f=Xe(e,c.line),h=$(u),p=i(u.length-1),g=c.line-s.line;o.full?(e.insert(0,n(0,u.length)),e.remove(u.length,e.size-u.length)):pi(e,o)?(l=n(0,u.length-1),r(f,f.text,p),g&&e.remove(s.line,g),l.length&&e.insert(s.line,l)):d==f?1==u.length?r(d,d.text.slice(0,s.ch)+h+d.text.slice(c.ch),p):((l=n(1,u.length-1)).push(new Gt(h+d.text.slice(c.ch),p,a)),r(d,d.text.slice(0,s.ch)+u[0],i(0)),e.insert(s.line+1,l)):1==u.length?(r(d,d.text.slice(0,s.ch)+u[0]+f.text.slice(c.ch),i(0)),e.remove(s.line+1,g)):(r(d,d.text.slice(0,s.ch)+u[0],i(0)),r(f,h+f.text.slice(c.ch),p),p=n(1,u.length-1),1<g&&e.remove(s.line+1,g-1),e.insert(s.line+1,p)),or(e,"change",e,o)}function mi(e,l,s){!function e(t,r,n){if(t.linked)for(var i=0;i<t.linked.length;++i){var o,a=t.linked[i];a.doc!=r&&(o=n&&a.sharedHist,s&&!o||(l(a.doc,o),e(a.doc,t,o)))}}(e,null,!0)}function vi(e,t){if(t.cm)throw new Error("This document is already in use.");Zr((e.doc=t).cm=e),fi(e),yi(e),e.options.lineWrapping||Ut(e),e.options.mode=t.modeOption,en(e)}function yi(e){("rtl"==e.doc.direction?D:S)(e.display.lineDiv,"CodeMirror-rtl")}function bi(e){this.done=[],this.undone=[],this.undoDepth=e?e.undoDepth:1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e?e.maxGeneration:1}function wi(e,t){var r={from:at(t.from),to:si(t),text:Ye(e,t.from,t.to)};return Li(e,r,t.from.line,t.to.line+1),mi(e,function(e){return Li(e,r,t.from.line,t.to.line+1),0},!0),r}function xi(e){for(;e.length;){if(!$(e).ranges)break;e.pop()}}function ki(e,t,r,n){var i=e.history;i.undone.length=0;var o,a,l=+new Date;if((i.lastOp==n||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&i.lastModTime>l-(e.cm?e.cm.options.historyEventDelay:500)||"*"==t.origin.charAt(0)))&&(o=(s=i).lastOp==n?(xi(s.done),$(s.done)):s.done.length&&!$(s.done).ranges?$(s.done):1<s.done.length&&!s.done[s.done.length-2].ranges?(s.done.pop(),$(s.done)):void 0))a=$(o.changes),0==it(t.from,t.to)&&0==it(t.from,a.to)?a.to=si(t):o.changes.push(wi(e,t));else{var s=$(i.done);for(s&&s.ranges||Si(e.sel,i.done),o={changes:[wi(e,t)],generation:i.generation},i.done.push(o);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(r),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=l,i.lastOp=i.lastSelOp=n,i.lastOrigin=i.lastSelOrigin=t.origin,a||xe(e,"historyAdded")}function Ci(e,t,r,n){var i,o,a,l=e.history,s=n&&n.origin;r==l.lastSelOp||s&&l.lastSelOrigin==s&&(l.lastModTime==l.lastSelTime&&l.lastOrigin==s||(i=e,o=s,a=$(l.done),e=t,"*"==(o=o.charAt(0))||"+"==o&&a.ranges.length==e.ranges.length&&a.somethingSelected()==e.somethingSelected()&&new Date-i.history.lastSelTime<=(i.cm?i.cm.options.historyEventDelay:500)))?l.done[l.done.length-1]=t:Si(t,l.done),l.lastSelTime=+new Date,l.lastSelOrigin=s,l.lastSelOp=r,n&&!1!==n.clearRedo&&xi(l.undone)}function Si(e,t){var r=$(t);r&&r.ranges&&r.equals(e)||t.push(e)}function Li(t,r,e,n){var i=r["spans_"+t.id],o=0;t.iter(Math.max(t.first,e),Math.min(t.first+t.size,n),function(e){e.markedSpans&&((i=i||(r["spans_"+t.id]={}))[o]=e.markedSpans),++o})}function Ti(e,t){var r=t["spans_"+e.id];if(!r)return null;for(var n=[],i=0;i<t.text.length;++i)n.push(function(e){if(!e)return null;for(var t,r=0;r<e.length;++r)e[r].marker.explicitlyCleared?t=t||e.slice(0,r):t&&t.push(e[r]);return t?t.length?t:null:e}(r[i]));return n}function Mi(e,t){var r=Ti(e,t),n=Nt(e,t);if(!r)return n;if(!n)return r;for(var i=0;i<r.length;++i){var o=r[i],a=n[i];if(o&&a)e:for(var l=0;l<a.length;++l){for(var s=a[l],c=0;c<o.length;++c)if(o[c].marker==s.marker)continue e;o.push(s)}else a&&(r[i]=a)}return r}function Ni(e,t,r){for(var n=[],i=0;i<e.length;++i){var o=e[i];if(o.ranges)n.push(r?ii.prototype.deepCopy.call(o):o);else{var a=o.changes,l=[];n.push({changes:l});for(var s=0;s<a.length;++s){var c,u=a[s];if(l.push({from:u.from,to:u.to,text:u.text}),t)for(var d in u)(c=d.match(/^spans_(\d+)$/))&&-1<I(t,Number(c[1]))&&($(l)[d]=u[d],delete u[d])}}}return n}function Oi(e,t,r,n){if(n){n=e.anchor;return r&&((e=it(t,n)<0)!=it(r,n)<0?(n=t,t=r):e!=it(t,r)<0&&(t=r)),new oi(n,t)}return new oi(r||t,t)}function Ai(e,t,r,n,i){null==i&&(i=e.cm&&(e.cm.display.shift||e.extend)),Ei(e,new ii([Oi(e.sel.primary(),t,r,i)],0),n)}function Di(e,t,r){for(var n=[],i=e.cm&&(e.cm.display.shift||e.extend),o=0;o<e.sel.ranges.length;o++)n[o]=Oi(e.sel.ranges[o],t[o],null,i);Ei(e,ai(e.cm,n,e.sel.primIndex),r)}function zi(e,t,r,n){var i=e.sel.ranges.slice(0);i[t]=r,Ei(e,ai(e.cm,i,e.sel.primIndex),n)}function Wi(e,t,r,n){Ei(e,li(t,r),n)}function Pi(e,t,r){var n=e.history.done,i=$(n);i&&i.ranges?Hi(e,n[n.length-1]=t,r):Ei(e,t,r)}function Ei(e,t,r){Hi(e,t,r),Ci(e,e.sel,e.cm?e.cm.curOp.id:NaN,r)}function Hi(e,t,r){var n,i;(Se(e,"beforeSelectionChange")||e.cm&&Se(e.cm,"beforeSelectionChange"))&&(n=e,i=r,i={ranges:(o=t).ranges,update:function(e){this.ranges=[];for(var t=0;t<e.length;t++)this.ranges[t]=new oi(ut(n,e[t].anchor),ut(n,e[t].head))},origin:i&&i.origin},xe(n,"beforeSelectionChange",n,i),n.cm&&xe(n.cm,"beforeSelectionChange",n.cm,i),t=i.ranges!=o.ranges?ai(n.cm,i.ranges,i.ranges.length-1):o);var o=r&&r.bias||(it(t.primary().head,e.sel.primary().head)<0?-1:1);Fi(e,Ri(e,t,o,!0)),r&&!1===r.scroll||!e.cm||"nocursor"==e.cm.getOption("readOnly")||wn(e.cm)}function Fi(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,Ce(e.cm)),or(e,"cursorActivity",e))}function Ii(e){Fi(e,Ri(e,e.sel,null,!1))}function Ri(e,t,r,n){for(var i,o=0;o<t.ranges.length;o++){var a=t.ranges[o],l=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[o],s=ji(e,a.anchor,l&&l.anchor,r,n),l=ji(e,a.head,l&&l.head,r,n);!i&&s==a.anchor&&l==a.head||((i=i||t.ranges.slice(0,o))[o]=new oi(s,l))}return i?ai(e.cm,i,t.primIndex):t}function Bi(e,t,r,n,i){var o=Xe(e,t.line);if(o.markedSpans)for(var a=0;a<o.markedSpans.length;++a){var l=o.markedSpans[a],s=l.marker,c="selectLeft"in s?!s.selectLeft:s.inclusiveLeft,u="selectRight"in s?!s.selectRight:s.inclusiveRight;if((null==l.from||(c?l.from<=t.ch:l.from<t.ch))&&(null==l.to||(u?l.to>=t.ch:l.to>t.ch))){if(i&&(xe(s,"beforeCursorEnter"),s.explicitlyCleared)){if(o.markedSpans){--a;continue}break}if(s.atomic){if(r){var d=s.find(n<0?1:-1),l=void 0;if((n<0?u:c)&&(d=qi(e,d,-n,d&&d.line==t.line?o:null)),d&&d.line==t.line&&(l=it(d,r))&&(n<0?l<0:0<l))return Bi(e,d,t,n,i)}s=s.find(n<0?-1:1);return(n<0?c:u)&&(s=qi(e,s,n,s.line==t.line?o:null)),s?Bi(e,s,t,n,i):null}}}return t}function ji(e,t,r,n,i){n=n||1,n=Bi(e,t,r,n,i)||!i&&Bi(e,t,r,n,!0)||Bi(e,t,r,-n,i)||!i&&Bi(e,t,r,-n,!0);return n||(e.cantEdit=!0,nt(e.first,0))}function qi(e,t,r,n){return r<0&&0==t.ch?t.line>e.first?ut(e,nt(t.line-1)):null:0<r&&t.ch==(n||Xe(e,t.line)).text.length?t.line<e.first+e.size-1?nt(t.line+1,0):null:new nt(t.line,t.ch+r)}function Ki(e){e.setSelection(nt(e.firstLine(),0),nt(e.lastLine()),j)}function Vi(i,e,t){var o={canceled:!1,from:e.from,to:e.to,text:e.text,origin:e.origin,cancel:function(){return o.canceled=!0}};return t&&(o.update=function(e,t,r,n){e&&(o.from=ut(i,e)),t&&(o.to=ut(i,t)),r&&(o.text=r),void 0!==n&&(o.origin=n)}),xe(i,"beforeChange",i,o),i.cm&&xe(i.cm,"beforeChange",i.cm,o),o.canceled?(i.cm&&(i.cm.curOp.updateInput=2),null):{from:o.from,to:o.to,text:o.text,origin:o.origin}}function Ui(e,t,r){if(e.cm){if(!e.cm.curOp)return Hn(e.cm,Ui)(e,t,r);if(e.cm.state.suppressEdits)return}if(!(Se(e,"beforeChange")||e.cm&&Se(e.cm,"beforeChange"))||(t=Vi(e,t,!0))){var n=St&&!r&&function(e,t,r){var n=null;if(e.iter(t.line,r.line+1,function(e){if(e.markedSpans)for(var t=0;t<e.markedSpans.length;++t){var r=e.markedSpans[t].marker;!r.readOnly||n&&-1!=I(n,r)||(n=n||[]).push(r)}}),!n)return null;for(var i=[{from:t,to:r}],o=0;o<n.length;++o)for(var a=n[o],l=a.find(0),s=0;s<i.length;++s){var c,u,d,f=i[s];it(f.to,l.from)<0||0<it(f.from,l.to)||(c=[s,1],u=it(f.from,l.from),d=it(f.to,l.to),(u<0||!a.inclusiveLeft&&!u)&&c.push({from:f.from,to:l.from}),(0<d||!a.inclusiveRight&&!d)&&c.push({from:l.to,to:f.to}),i.splice.apply(i,c),s+=c.length-3)}return i}(e,t.from,t.to);if(n)for(var i=n.length-1;0<=i;--i)Gi(e,{from:n[i].from,to:n[i].to,text:i?[""]:t.text,origin:t.origin});else Gi(e,t)}}function Gi(e,r){var t,n;1==r.text.length&&""==r.text[0]&&0==it(r.from,r.to)||(t=ui(e,r),ki(e,r,t,e.cm?e.cm.curOp.id:NaN),Xi(e,r,t,Nt(e,r)),n=[],mi(e,function(e,t){t||-1!=I(n,e.history)||(Ji(e.history,r),n.push(e.history)),Xi(e,r,null,Nt(e,r))}))}function $i(i,o,e){var t=i.cm&&i.cm.state.suppressEdits;if(!t||e){for(var a,r=i.history,n=i.sel,l="undo"==o?r.done:r.undone,s="undo"==o?r.undone:r.done,c=0;c<l.length&&(a=l[c],e?!a.ranges||a.equals(i.sel):a.ranges);c++);if(c!=l.length){for(r.lastOrigin=r.lastSelOrigin=null;;){if(!(a=l.pop()).ranges){if(t)return void l.push(a);break}if(Si(a,s),e&&!a.equals(i.sel))return void Ei(i,a,{clearRedo:!1});n=a}var u=[];Si(n,s),s.push({changes:u,generation:r.generation}),r.generation=a.generation||++r.maxGeneration;for(var d=Se(i,"beforeChange")||i.cm&&Se(i.cm,"beforeChange"),f=a.changes.length-1;0<=f;--f){var h=function(e){var r=a.changes[e];if(r.origin=o,d&&!Vi(i,r,!1))return l.length=0,{};u.push(wi(i,r));var t=e?ui(i,r):$(l);Xi(i,r,t,Mi(i,r)),!e&&i.cm&&i.cm.scrollIntoView({from:r.from,to:si(r)});var n=[];mi(i,function(e,t){t||-1!=I(n,e.history)||(Ji(e.history,r),n.push(e.history)),Xi(e,r,null,Mi(e,r))})}(f);if(h)return h.v}}}}function _i(e,t){if(0!=t&&(e.first+=t,e.sel=new ii(_(e.sel.ranges,function(e){return new oi(nt(e.anchor.line+t,e.anchor.ch),nt(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){en(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,n=r.viewFrom;n<r.viewTo;n++)tn(e.cm,n,"gutter")}}function Xi(e,t,r,n){if(e.cm&&!e.cm.curOp)return Hn(e.cm,Xi)(e,t,r,n);var i,o,a,l,s,c,u,d,f;t.to.line<e.first?_i(e,t.text.length-1-(t.to.line-t.from.line)):t.from.line>e.lastLine()||(t.from.line<e.first&&(_i(e,u=t.text.length-1-(e.first-t.from.line)),t={from:nt(e.first,0),to:nt(t.to.line+u,t.to.ch),text:[$(t.text)],origin:t.origin}),f=e.lastLine(),t.to.line>f&&(t={from:t.from,to:nt(f,Xe(e,f).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Ye(e,t.from,t.to),r=r||ui(e,t),e.cm?(i=e.cm,o=t,a=n,l=i.doc,s=i.display,c=o.from,u=o.to,d=!1,f=c.line,i.options.lineWrapping||(f=Je(Rt(Xe(l,c.line))),l.iter(f,u.line+1,function(e){if(e==s.maxLine)return d=!0})),-1<l.sel.contains(o.from,o.to)&&Ce(i),gi(l,o,a,Yr(i)),i.options.lineWrapping||(l.iter(f,c.line+o.text.length,function(e){var t=Vt(e);t>s.maxLineLength&&(s.maxLine=e,s.maxLineLength=t,s.maxLineChanged=!0,d=!1)}),d&&(i.curOp.updateMaxLine=!0)),function(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontier<t-10)){for(var r=e.first,n=t-1;r<n;n--){var i=Xe(e,n).stateAfter;if(i&&(!(i instanceof ft)||n+i.lookAhead<t)){r=n+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,r)}}(l,c.line),Rn(i,400),f=o.text.length-(u.line-c.line)-1,o.full?en(i):c.line!=u.line||1!=o.text.length||pi(i.doc,o)?en(i,c.line,u.line+1,f):tn(i,c.line,"text"),l=Se(i,"changes"),((f=Se(i,"change"))||l)&&(o={from:c,to:u,text:o.text,removed:o.removed,origin:o.origin},f&&or(i,"change",i,o),l&&(i.curOp.changeObjs||(i.curOp.changeObjs=[])).push(o)),i.display.selForContextMenu=null):gi(e,t,n),Hi(e,r,j),e.cantEdit&&ji(e,nt(e.firstLine(),0))&&(e.cantEdit=!1))}function Yi(e,t,r,n,i){var o;it(n=n||r,r)<0&&(r=(o=[n,r])[0],n=o[1]),"string"==typeof t&&(t=e.splitLines(t)),Ui(e,{from:r,to:n,text:t,origin:i})}function Zi(e,t,r,n){r<e.line?e.line+=n:t<e.line&&(e.line=t,e.ch=0)}function Qi(e,t,r,n){for(var i=0;i<e.length;++i){var o=e[i],a=!0;if(o.ranges){o.copied||((o=e[i]=o.deepCopy()).copied=!0);for(var l=0;l<o.ranges.length;l++)Zi(o.ranges[l].anchor,t,r,n),Zi(o.ranges[l].head,t,r,n)}else{for(var s=0;s<o.changes.length;++s){var c=o.changes[s];if(r<c.from.line)c.from=nt(c.from.line+n,c.from.ch),c.to=nt(c.to.line+n,c.to.ch);else if(t<=c.to.line){a=!1;break}}a||(e.splice(0,i+1),i=0)}}}function Ji(e,t){var r=t.from.line,n=t.to.line,t=t.text.length-(n-r)-1;Qi(e.done,r,n,t),Qi(e.undone,r,n,t)}function eo(e,t,r,n){var i=t,o=t;return"number"==typeof t?o=Xe(e,ct(e,t)):i=Je(t),null==i?null:(n(o,i)&&e.cm&&tn(e.cm,i,r),o)}function to(e){this.lines=e,this.parent=null;for(var t=0,r=0;r<e.length;++r)e[r].parent=this,t+=e[r].height;this.height=t}function ro(e){this.children=e;for(var t=0,r=0,n=0;n<e.length;++n){var i=e[n];t+=i.chunkSize(),r+=i.height,i.parent=this}this.size=t,this.height=r,this.parent=null}oi.prototype.from=function(){return st(this.anchor,this.head)},oi.prototype.to=function(){return lt(this.anchor,this.head)},oi.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},to.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var r,n=e,i=e+t;n<i;++n){var o=this.lines[n];this.height-=o.height,(r=o).parent=null,At(r),or(o,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,r){this.height+=r,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var n=0;n<t.length;++n)t[n].parent=this},iterN:function(e,t,r){for(var n=e+t;e<n;++e)if(r(this.lines[e]))return!0}},ro.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var r,n=0;n<this.children.length;++n){var i=this.children[n],o=i.chunkSize();if(e<o){var a=Math.min(t,o-e),l=i.height;if(i.removeInner(e,a),this.height-=l-i.height,o==a&&(this.children.splice(n--,1),i.parent=null),0==(t-=a))break;e=0}else e-=o}this.size-t<25&&(1<this.children.length||!(this.children[0]instanceof to))&&(r=[],this.collapse(r),this.children=[new to(r)],this.children[0].parent=this)},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,r){this.size+=t.length,this.height+=r;for(var n=0;n<this.children.length;++n){var i=this.children[n],o=i.chunkSize();if(e<=o){if(i.insertInner(e,t,r),i.lines&&50<i.lines.length){for(var a=i.lines.length%25+25,l=a;l<i.lines.length;){var s=new to(i.lines.slice(l,l+=25));i.height-=s.height,this.children.splice(++n,0,s),s.parent=this}i.lines=i.lines.slice(0,a),this.maybeSpill()}break}e-=o}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t,r=new ro(e.children.splice(e.children.length-5,5))}while(e.parent?(e.size-=r.size,e.height-=r.height,t=I(e.parent.children,e),e.parent.children.splice(t+1,0,r)):(((t=new ro(e.children)).parent=e).children=[t,r],e=t),r.parent=e.parent,10<e.children.length);e.parent.maybeSpill()}},iterN:function(e,t,r){for(var n=0;n<this.children.length;++n){var i=this.children[n],o=i.chunkSize();if(e<o){var a=Math.min(t,o-e);if(i.iterN(e,a,r))return!0;if(0==(t-=a))break;e=0}else e-=o}}};function no(e,t,r){if(r)for(var n in r)r.hasOwnProperty(n)&&(this[n]=r[n]);this.doc=e,this.node=t}function io(e,t,r){Kt(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&bn(e,r)}no.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,r=this.line,n=Je(r);if(null!=n&&t){for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(r.widgets=null);var o=pr(this);Qe(r,Math.max(0,r.height-o)),e&&(En(e,function(){io(e,r,-o),tn(e,n,"widget")}),or(e,"lineWidgetCleared",e,this,n))}},no.prototype.changed=function(){var e=this,t=this.height,r=this.doc.cm,n=this.line;this.height=null;var i=pr(this)-t;i&&(qt(this.doc,n)||Qe(n,n.height+i),r&&En(r,function(){r.curOp.forceUpdate=!0,io(r,n,i),or(r,"lineWidgetChanged",r,e,Je(n))}))},Le(no);var oo=0,ao=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++oo};function lo(t,r,n,e,i){if(e&&e.shared)return function(e,r,n,i,o){(i=E(i)).shared=!1;var a=[lo(e,r,n,i,o)],l=a[0],s=i.widgetNode;return mi(e,function(e){s&&(i.widgetNode=s.cloneNode(!0)),a.push(lo(e,ut(e,r),ut(e,n),i,o));for(var t=0;t<e.linked.length;++t)if(e.linked[t].isParent)return;l=$(a)}),new so(a,l)}(t,r,n,e,i);if(t.cm&&!t.cm.curOp)return Hn(t.cm,lo)(t,r,n,e,i);var o=new ao(t,i),i=it(r,n);if(e&&E(e,o,!1),0<i||0==i&&!1!==o.clearWhenEmpty)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=N("span",[o.replacedWith],"CodeMirror-widget"),e.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),e.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(It(t,r.line,r,n,o)||r.line!=n.line&&It(t,n.line,r,n,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");Lt=!0}o.addToHistory&&ki(t,{from:r,to:n,origin:"markText"},t.sel,NaN);var a,l=r.line,s=t.cm;if(t.iter(l,n.line+1,function(e){var t;s&&o.collapsed&&!s.options.lineWrapping&&Rt(e)==s.display.maxLine&&(a=!0),o.collapsed&&l!=r.line&&Qe(e,0),t=e,e=new Tt(o,l==r.line?r.ch:null,l==n.line?n.ch:null),t.markedSpans=t.markedSpans?t.markedSpans.concat([e]):[e],e.marker.attachLine(t),++l}),o.collapsed&&t.iter(r.line,n.line+1,function(e){qt(t,e)&&Qe(e,0)}),o.clearOnEnter&&ye(o,"beforeCursorEnter",function(){return o.clear()}),o.readOnly&&(St=!0,(t.history.done.length||t.history.undone.length)&&t.clearHistory()),o.collapsed&&(o.id=++oo,o.atomic=!0),s){if(a&&(s.curOp.updateMaxLine=!0),o.collapsed)en(s,r.line,n.line+1);else if(o.className||o.startStyle||o.endStyle||o.css||o.attributes||o.title)for(var c=r.line;c<=n.line;c++)tn(s,c,"text");o.atomic&&Ii(s.doc),or(s,"markerAdded",s,o)}return o}ao.prototype.clear=function(){if(!this.explicitlyCleared){var e,t=this.doc.cm,r=t&&!t.curOp;r&&Wn(t),!Se(this,"clear")||(e=this.find())&&or(this,"clear",e.from,e.to);for(var n=null,i=null,o=0;o<this.lines.length;++o){var a=this.lines[o],l=Mt(a.markedSpans,this);t&&!this.collapsed?tn(t,Je(a),"text"):t&&(null!=l.to&&(i=Je(a)),null!=l.from&&(n=Je(a))),a.markedSpans=function(e,t){for(var r,n=0;n<e.length;++n)e[n]!=t&&(r=r||[]).push(e[n]);return r}(a.markedSpans,l),null==l.from&&this.collapsed&&!qt(this.doc,a)&&t&&Qe(a,Gr(t.display))}if(t&&this.collapsed&&!t.options.lineWrapping)for(var s=0;s<this.lines.length;++s){var c=Rt(this.lines[s]),u=Vt(c);u>t.display.maxLineLength&&(t.display.maxLine=c,t.display.maxLineLength=u,t.display.maxLineChanged=!0)}null!=n&&t&&this.collapsed&&en(t,n,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,t&&Ii(t.doc)),t&&or(t,"markerCleared",t,this,n,i),r&&Pn(t),this.parent&&this.parent.clear()}},ao.prototype.find=function(e,t){var r,n;null==e&&"bookmark"==this.type&&(e=1);for(var i=0;i<this.lines.length;++i){var o=this.lines[i],a=Mt(o.markedSpans,this);if(null!=a.from&&(r=nt(t?o:Je(o),a.from),-1==e))return r;if(null!=a.to&&(n=nt(t?o:Je(o),a.to),1==e))return n}return r&&{from:r,to:n}},ao.prototype.changed=function(){var r=this,n=this.find(-1,!0),i=this,o=this.doc.cm;n&&o&&En(o,function(){var e=n.line,t=Je(n.line),t=Sr(o,t);t&&(Ar(t),o.curOp.selectionChanged=o.curOp.forceUpdate=!0),o.curOp.updateMaxLine=!0,qt(i.doc,e)||null==i.height||(t=i.height,i.height=null,(t=pr(i)-t)&&Qe(e,e.height+t)),or(o,"markerChanged",o,r)})},ao.prototype.attachLine=function(e){var t;!this.lines.length&&this.doc.cm&&((t=this.doc.cm.curOp).maybeHiddenMarkers&&-1!=I(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)),this.lines.push(e)},ao.prototype.detachLine=function(e){this.lines.splice(I(this.lines,e),1),!this.lines.length&&this.doc.cm&&((e=this.doc.cm.curOp).maybeHiddenMarkers||(e.maybeHiddenMarkers=[])).push(this)},Le(ao);var so=function(e,t){this.markers=e,this.primary=t;for(var r=0;r<e.length;++r)e[r].parent=this};function co(e){return e.findMarks(nt(e.first,0),e.clipPos(nt(e.lastLine())),function(e){return e.parent})}function uo(i){for(var o=0;o<i.length;o++)!function(){var e=i[o],t=[e.primary.doc];mi(e.primary.doc,function(e){return t.push(e)});for(var r=0;r<e.markers.length;r++){var n=e.markers[r];-1==I(t,n.doc)&&(n.parent=null,e.markers.splice(r--,1))}}()}so.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();or(this,"clear")}},so.prototype.find=function(e,t){return this.primary.find(e,t)},Le(so);var fo=0,ho=function(e,t,r,n,i){if(!(this instanceof ho))return new ho(e,t,r,n,i);null==r&&(r=0),ro.call(this,[new to([new Gt("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1;r=nt(this.modeFrontier=this.highlightFrontier=r,0);this.sel=li(r),this.history=new bi(null),this.id=++fo,this.modeOption=t,this.lineSep=n,this.direction="rtl"==i?"rtl":"ltr",this.extend=!1,"string"==typeof e&&(e=this.splitLines(e)),gi(this,{from:r,to:r,text:e}),Ei(this,li(r),j)};ho.prototype=Y(ro.prototype,{constructor:ho,iter:function(e,t,r){r?this.iterN(e-this.first,t-e,r):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var r=0,n=0;n<t.length;++n)r+=t[n].height;this.insertInner(e-this.first,t,r)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=Ze(this,this.first,this.first+this.size);return!1===e?t:t.join(e||this.lineSeparator())},setValue:In(function(e){var t=nt(this.first,0),r=this.first+this.size-1;Ui(this,{from:t,to:nt(r,Xe(this,r).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&xn(this.cm,0,0),Ei(this,li(t),j)}),replaceRange:function(e,t,r,n){Yi(this,e,t=ut(this,t),r=r?ut(this,r):t,n)},getRange:function(e,t,r){t=Ye(this,ut(this,e),ut(this,t));return!1===r?t:t.join(r||this.lineSeparator())},getLine:function(e){e=this.getLineHandle(e);return e&&e.text},getLineHandle:function(e){if(tt(this,e))return Xe(this,e)},getLineNumber:Je,getLineHandleVisualStart:function(e){return"number"==typeof e&&(e=Xe(this,e)),Rt(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return ut(this,e)},getCursor:function(e){var t=this.sel.primary(),t=null==e||"head"==e?t.head:"anchor"==e?t.anchor:"end"==e||"to"==e||!1===e?t.to():t.from();return t},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:In(function(e,t,r){Wi(this,ut(this,"number"==typeof e?nt(e,t||0):e),null,r)}),setSelection:In(function(e,t,r){Wi(this,ut(this,e),ut(this,t||e),r)}),extendSelection:In(function(e,t,r){Ai(this,ut(this,e),t&&ut(this,t),r)}),extendSelections:In(function(e,t){Di(this,dt(this,e),t)}),extendSelectionsBy:In(function(e,t){Di(this,dt(this,_(this.sel.ranges,e)),t)}),setSelections:In(function(e,t,r){if(e.length){for(var n=[],i=0;i<e.length;i++)n[i]=new oi(ut(this,e[i].anchor),ut(this,e[i].head||e[i].anchor));null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),Ei(this,ai(this.cm,n,t),r)}}),addSelection:In(function(e,t,r){var n=this.sel.ranges.slice(0);n.push(new oi(ut(this,e),ut(this,t||e))),Ei(this,ai(this.cm,n,n.length-1),r)}),getSelection:function(e){for(var t=this.sel.ranges,r=0;r<t.length;r++)var n=Ye(this,t[r].from(),t[r].to()),i=i?i.concat(n):n;return!1===e?i:i.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],r=this.sel.ranges,n=0;n<r.length;n++){var i=Ye(this,r[n].from(),r[n].to());!1!==e&&(i=i.join(e||this.lineSeparator())),t[n]=i}return t},replaceSelection:function(e,t,r){for(var n=[],i=0;i<this.sel.ranges.length;i++)n[i]=e;this.replaceSelections(n,t,r||"+input")},replaceSelections:In(function(e,t,r){for(var n=[],i=this.sel,o=0;o<i.ranges.length;o++){var a=i.ranges[o];n[o]={from:a.from(),to:a.to(),text:this.splitLines(e[o]),origin:r}}for(var t=t&&"end"!=t&&function(e,t,r){for(var n=[],i=c=nt(e.first,0),o=0;o<t.length;o++){var a=t[o],l=di(a.from,c,i),s=di(si(a),c,i),c=a.to,i=s;"around"==r?(a=it((a=e.sel.ranges[o]).head,a.anchor)<0,n[o]=new oi(a?s:l,a?l:s)):n[o]=new oi(l,l)}return new ii(n,e.sel.primIndex)}(this,n,t),l=n.length-1;0<=l;l--)Ui(this,n[l]);t?Pi(this,t):this.cm&&wn(this.cm)}),undo:In(function(){$i(this,"undo")}),redo:In(function(){$i(this,"redo")}),undoSelection:In(function(){$i(this,"undo",!0)}),redoSelection:In(function(){$i(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,r=0,n=0;n<e.done.length;n++)e.done[n].ranges||++t;for(var i=0;i<e.undone.length;i++)e.undone[i].ranges||++r;return{undo:t,redo:r}},clearHistory:function(){var t=this;this.history=new bi(this.history),mi(this,function(e){return e.history=t.history},!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:Ni(this.history.done),undone:Ni(this.history.undone)}},setHistory:function(e){var t=this.history=new bi(this.history);t.done=Ni(e.done.slice(0),null,!0),t.undone=Ni(e.undone.slice(0),null,!0)},setGutterMarker:In(function(e,r,n){return eo(this,e,"gutter",function(e){var t=e.gutterMarkers||(e.gutterMarkers={});return!(t[r]=n)&&ee(t)&&(e.gutterMarkers=null),1})}),clearGutter:In(function(t){var r=this;this.iter(function(e){e.gutterMarkers&&e.gutterMarkers[t]&&eo(r,e,"gutter",function(){return e.gutterMarkers[t]=null,ee(e.gutterMarkers)&&(e.gutterMarkers=null),1})})}),lineInfo:function(e){var t;if("number"==typeof e){if(!tt(this,e))return null;if(!(e=Xe(this,t=e)))return null}else if(null==(t=Je(e)))return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:In(function(e,r,n){return eo(this,e,"gutter"==r?"gutter":"class",function(e){var t="text"==r?"textClass":"background"==r?"bgClass":"gutter"==r?"gutterClass":"wrapClass";if(e[t]){if(k(n).test(e[t]))return;e[t]+=" "+n}else e[t]=n;return 1})}),removeLineClass:In(function(e,o,a){return eo(this,e,"gutter"==o?"gutter":"class",function(e){var t="text"==o?"textClass":"background"==o?"bgClass":"gutter"==o?"gutterClass":"wrapClass",r=e[t];if(r){if(null==a)e[t]=null;else{var n=r.match(k(a));if(!n)return;var i=n.index+n[0].length;e[t]=r.slice(0,n.index)+(n.index&&i!=r.length?" ":"")+r.slice(i)||null}return 1}})}),addLineWidget:In(function(e,t,r){return e=e,i=new no(n=this,t,r),(o=n.cm)&&i.noHScroll&&(o.display.alignWidgets=!0),eo(n,e,"widget",function(e){var t=e.widgets||(e.widgets=[]);return null==i.insertAt?t.push(i):t.splice(Math.min(t.length,Math.max(0,i.insertAt)),0,i),i.line=e,o&&!qt(n,e)&&(t=Kt(e)<n.scrollTop,Qe(e,e.height+pr(i)),t&&bn(o,i.height),o.curOp.forceUpdate=!0),1}),o&&or(o,"lineWidgetAdded",o,i,"number"==typeof e?e:Je(e)),i;var n,i,o}),removeLineWidget:function(e){e.clear()},markText:function(e,t,r){return lo(this,ut(this,e),ut(this,t),r,r&&r.type||"range")},setBookmark:function(e,t){t={replacedWith:t&&(null==t.nodeType?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return lo(this,e=ut(this,e),e,t,"bookmark")},findMarksAt:function(e){var t=[],r=Xe(this,(e=ut(this,e)).line).markedSpans;if(r)for(var n=0;n<r.length;++n){var i=r[n];(null==i.from||i.from<=e.ch)&&(null==i.to||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(i,o,a){i=ut(this,i),o=ut(this,o);var l=[],s=i.line;return this.iter(i.line,o.line+1,function(e){var t=e.markedSpans;if(t)for(var r=0;r<t.length;r++){var n=t[r];null!=n.to&&s==i.line&&i.ch>=n.to||null==n.from&&s!=i.line||null!=n.from&&s==o.line&&n.from>=o.ch||a&&!a(n.marker)||l.push(n.marker.parent||n.marker)}++s}),l},getAllMarks:function(){var n=[];return this.iter(function(e){var t=e.markedSpans;if(t)for(var r=0;r<t.length;++r)null!=t[r].from&&n.push(t[r].marker)}),n},posFromIndex:function(t){var r,n=this.first,i=this.lineSeparator().length;return this.iter(function(e){e=e.text.length+i;if(t<e)return r=t,!0;t-=e,++n}),ut(this,nt(n,r))},indexFromPos:function(e){var t=(e=ut(this,e)).ch;if(e.line<this.first||e.ch<0)return 0;var r=this.lineSeparator().length;return this.iter(this.first,e.line,function(e){t+=e.text.length+r}),t},copy:function(e){var t=new ho(Ze(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e=e||{};var t=this.first,r=this.first+this.size;null!=e.from&&e.from>t&&(t=e.from),null!=e.to&&e.to<r&&(r=e.to);t=new ho(Ze(this,t,r),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(t.history=this.history),(this.linked||(this.linked=[])).push({doc:t,sharedHist:e.sharedHist}),t.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r],i=n.find(),o=e.clipPos(i.from),i=e.clipPos(i.to);it(o,i)&&(i=lo(e,o,i,n.primary,n.primary.type),n.markers.push(i),i.parent=n)}}(t,co(this)),t},unlinkDoc:function(e){if(e instanceof ua&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t)if(this.linked[t].doc==e){this.linked.splice(t,1),e.unlinkDoc(this),uo(co(this));break}var r;e.history==this.history&&(r=[e.id],mi(e,function(e){return r.push(e.id)},!0),e.history=new bi(null),e.history.done=Ni(this.history.done,r),e.history.undone=Ni(this.history.undone,r))},iterLinkedDocs:function(e){mi(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):Ee(e)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:In(function(e){var t;"rtl"!=e&&(e="ltr"),e!=this.direction&&(this.direction=e,this.iter(function(e){return e.order=null}),this.cm&&En(t=this.cm,function(){yi(t),en(t)}))})}),ho.prototype.eachLine=ho.prototype.iter;var po=0;function go(e){var n=this;if(mo(n),!ke(n,e)&&!gr(n.display,e)){Te(e),w&&(po=+new Date);var t=Qr(n,e,!0),r=e.dataTransfer.files;if(t&&!n.isReadOnly())if(r&&r.length&&window.FileReader&&window.File)for(var i=r.length,o=Array(i),a=0,l=function(){++a==i&&Hn(n,function(){var e={from:t=ut(n.doc,t),to:t,text:n.doc.splitLines(o.filter(function(e){return null!=e}).join(n.doc.lineSeparator())),origin:"paste"};Ui(n.doc,e),Pi(n.doc,li(ut(n.doc,t),ut(n.doc,si(e))))})()},s=0;s<r.length;s++)!function(e,t){var r;n.options.allowDropFileTypes&&-1==I(n.options.allowDropFileTypes,e.type)?l():((r=new FileReader).onerror=l,r.onload=function(){var e=r.result;/[\x00-\x08\x0e-\x1f]{2}/.test(e)||(o[t]=e),l()},r.readAsText(e))}(r[s],s);else{if(n.state.draggingText&&-1<n.doc.sel.contains(t))return n.state.draggingText(e),void setTimeout(function(){return n.display.input.focus()},20);try{var c,u=e.dataTransfer.getData("Text");if(u){if(n.state.draggingText&&!n.state.draggingText.copy&&(c=n.listSelections()),Hi(n.doc,li(t,t)),c)for(var d=0;d<c.length;++d)Yi(n.doc,"",c[d].anchor,c[d].head,"drag");n.replaceSelection(u,"around","paste"),n.display.input.focus()}}catch(e){}}}}function mo(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function vo(t){if(document.getElementsByClassName){for(var e=document.getElementsByClassName("CodeMirror"),r=[],n=0;n<e.length;n++){var i=e[n].CodeMirror;i&&r.push(i)}r.length&&r[0].operation(function(){for(var e=0;e<r.length;e++)t(r[e])})}}var yo=!1;function bo(){var e;yo||(ye(window,"resize",function(){null==e&&(e=setTimeout(function(){e=null,vo(wo)},100))}),ye(window,"blur",function(){return vo(pn)}),yo=!0)}function wo(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var xo={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"},ko=0;ko<10;ko++)xo[ko+48]=xo[ko+96]=String(ko);for(var Co=65;Co<=90;Co++)xo[Co]=String.fromCharCode(Co);for(var So=1;So<=12;So++)xo[So+111]=xo[So+63235]="F"+So;var Lo={};function To(e){var t,r,n,i,o=e.split(/-(?!$)/);e=o[o.length-1];for(var a=0;a<o.length-1;a++){var l=o[a];if(/^(cmd|meta|m)$/i.test(l))i=!0;else if(/^a(lt)?$/i.test(l))t=!0;else if(/^(c|ctrl|control)$/i.test(l))r=!0;else{if(!/^s(hift)?$/i.test(l))throw new Error("Unrecognized modifier name: "+l);n=!0}}return t&&(e="Alt-"+e),r&&(e="Ctrl-"+e),i&&(e="Cmd-"+e),n&&(e="Shift-"+e),e}function Mo(e){var t,r,n={};for(t in e)if(e.hasOwnProperty(t)){var i=e[t];if(!/^(name|fallthrough|(de|at)tach)$/.test(t))if("..."!=i){for(var o=_(t.split(" "),To),a=0;a<o.length;a++){var l=void 0,s=void 0,l=a==o.length-1?(s=o.join(" "),i):(s=o.slice(0,a+1).join(" "),"..."),c=n[s];if(c){if(c!=l)throw new Error("Inconsistent bindings for "+s)}else n[s]=l}delete e[t]}else delete e[t]}for(r in n)e[r]=n[r];return e}function No(e,t,r,n){var i=(t=zo(t)).call?t.call(e,n):t[e];if(!1===i)return"nothing";if("..."===i)return"multi";if(null!=i&&r(i))return"handled";if(t.fallthrough){if("[object Array]"!=Object.prototype.toString.call(t.fallthrough))return No(e,t.fallthrough,r,n);for(var o=0;o<t.fallthrough.length;o++){var a=No(e,t.fallthrough[o],r,n);if(a)return a}}}function Oo(e){e="string"==typeof e?e:xo[e.keyCode];return"Ctrl"==e||"Alt"==e||"Shift"==e||"Mod"==e}function Ao(e,t,r){var n=e;return t.altKey&&"Alt"!=n&&(e="Alt-"+e),(b?t.metaKey:t.ctrlKey)&&"Ctrl"!=n&&(e="Ctrl-"+e),(b?t.ctrlKey:t.metaKey)&&"Mod"!=n&&(e="Cmd-"+e),!r&&t.shiftKey&&"Shift"!=n&&(e="Shift-"+e),e}function Do(e,t){if(p&&34==e.keyCode&&e.char)return!1;var r=xo[e.keyCode];return null!=r&&!e.altGraphKey&&(3==e.keyCode&&e.code&&(r=e.code),Ao(r,e,t))}function zo(e){return"string"==typeof e?Lo[e]:e}function Wo(t,e){for(var r=t.doc.sel.ranges,n=[],i=0;i<r.length;i++){for(var o=e(r[i]);n.length&&it(o.from,$(n).to)<=0;){var a=n.pop();if(it(a.from,o.from)<0){o.from=a.from;break}}n.push(o)}En(t,function(){for(var e=n.length-1;0<=e;e--)Yi(t.doc,"",n[e].from,n[e].to,"+delete");wn(t)})}function Po(e,t,r){r=ne(e.text,t+r,r);return r<0||r>e.text.length?null:r}function Eo(e,t,r){e=Po(e,t.ch,r);return null==e?null:new nt(t.line,e,r<0?"after":"before")}function Ho(e,t,r,n,i){if(e){"rtl"==t.doc.direction&&(i=-i);var o=me(r,t.doc.direction);if(o){var a,l,s,e=i<0?$(o):o[0],o=i<0==(1==e.level)?"after":"before";return 0<e.level||"rtl"==t.doc.direction?(a=Lr(t,r),l=i<0?r.text.length-1:0,s=Tr(t,a,l).top,l=ie(function(e){return Tr(t,a,e).top==s},i<0==(1==e.level)?e.from:e.to-1,l),"before"==o&&(l=Po(r,l,1))):l=i<0?e.to:e.from,new nt(n,l,o)}}return new nt(n,i<0?r.text.length:0,i<0?"before":"after")}function Fo(t,r,l,e){var s=me(r,t.doc.direction);if(!s)return Eo(r,l,e);l.ch>=r.text.length?(l.ch=r.text.length,l.sticky="before"):l.ch<=0&&(l.ch=0,l.sticky="after");var n=ae(s,l.ch,l.sticky),i=s[n];if("ltr"==t.doc.direction&&i.level%2==0&&(0<e?i.to>l.ch:i.from<l.ch))return Eo(r,l,e);function c(e,t){return Po(r,e instanceof nt?e.ch:e,t)}function o(e){return t.options.lineWrapping?(a=a||Lr(t,r),Vr(t,r,a,e)):{begin:0,end:r.text.length}}var a,u=o("before"==l.sticky?c(l,-1):l.ch);if("rtl"==t.doc.direction||1==i.level){var d=1==i.level==e<0,f=c(l,d?1:-1);if(null!=f&&(d?f<=i.to&&f<=u.end:f>=i.from&&f>=u.begin)){var h=d?"before":"after";return new nt(l.line,f,h)}}h=function(e,t,r){for(var n=function(e,t){return t?new nt(l.line,c(e,1),"before"):new nt(l.line,e,"after")};0<=e&&e<s.length;e+=t){var i=s[e],o=0<t==(1!=i.level),a=o?r.begin:c(r.end,-1);if(i.from<=a&&a<i.to)return n(a,o);if(a=o?i.from:c(i.to,-1),r.begin<=a&&a<r.end)return n(a,o)}},n=h(n+e,e,u);if(n)return n;u=0<e?u.end:c(u.begin,-1);return null==u||0<e&&u==r.text.length||!(n=h(0<e?0:s.length-1,e,o(u)))?null:n}Lo.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"},Lo.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"},Lo.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"},Lo.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"]},Lo.default=g?Lo.macDefault:Lo.pcDefault;var Io={selectAll:Ki,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),j)},killLine:function(r){return Wo(r,function(e){if(e.empty()){var t=Xe(r.doc,e.head.line).text.length;return e.head.ch==t&&e.head.line<r.lastLine()?{from:e.head,to:nt(e.head.line+1,0)}:{from:e.head,to:nt(e.head.line,t)}}return{from:e.from(),to:e.to()}})},deleteLine:function(t){return Wo(t,function(e){return{from:nt(e.from().line,0),to:ut(t.doc,nt(e.to().line+1,0))}})},delLineLeft:function(e){return Wo(e,function(e){return{from:nt(e.from().line,0),to:e.from()}})},delWrappedLineLeft:function(r){return Wo(r,function(e){var t=r.charCoords(e.head,"div").top+5;return{from:r.coordsChar({left:0,top:t},"div"),to:e.from()}})},delWrappedLineRight:function(r){return Wo(r,function(e){var t=r.charCoords(e.head,"div").top+5,t=r.coordsChar({left:r.display.lineDiv.offsetWidth+100,top:t},"div");return{from:e.from(),to:t}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(nt(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(nt(e.lastLine()))},goLineStart:function(t){return t.extendSelectionsBy(function(e){return Ro(t,e.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(t){return t.extendSelectionsBy(function(e){return Bo(t,e.head)},{origin:"+move",bias:1})},goLineEnd:function(t){return t.extendSelectionsBy(function(e){return function(e,t){var r=Xe(e.doc,t),n=function(e){for(var t;t=Ft(e);)e=t.find(1,!0).line;return e}(r);n!=r&&(t=Je(n));return Ho(!0,e,r,t,-1)}(t,e.head.line)},{origin:"+move",bias:-1})},goLineRight:function(t){return t.extendSelectionsBy(function(e){e=t.cursorCoords(e.head,"div").top+5;return t.coordsChar({left:t.display.lineDiv.offsetWidth+100,top:e},"div")},K)},goLineLeft:function(t){return t.extendSelectionsBy(function(e){e=t.cursorCoords(e.head,"div").top+5;return t.coordsChar({left:0,top:e},"div")},K)},goLineLeftSmart:function(r){return r.extendSelectionsBy(function(e){var t=r.cursorCoords(e.head,"div").top+5,t=r.coordsChar({left:0,top:t},"div");return t.ch<r.getLine(t.line).search(/\S/)?Bo(r,e.head):t},K)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection("\t")},insertSoftTab:function(e){for(var t=[],r=e.listSelections(),n=e.options.tabSize,i=0;i<r.length;i++){var o=r[i].from(),o=H(e.getLine(o.line),o.ch,n);t.push(G(n-o%n))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(a){return En(a,function(){for(var e,t,r,n=a.listSelections(),i=[],o=0;o<n.length;o++)n[o].empty()&&(e=n[o].head,(t=Xe(a.doc,e.line).text)&&(e.ch==t.length&&(e=new nt(e.line,e.ch-1)),0<e.ch?(e=new nt(e.line,e.ch+1),a.replaceRange(t.charAt(e.ch-1)+t.charAt(e.ch-2),nt(e.line,e.ch-2),e,"+transpose")):e.line>a.doc.first&&((r=Xe(a.doc,e.line-1).text)&&(e=new nt(e.line,1),a.replaceRange(t.charAt(0)+a.doc.lineSeparator()+r.charAt(r.length-1),nt(e.line-1,r.length-1),e,"+transpose")))),i.push(new oi(e,e)));a.setSelections(i)})},newlineAndIndent:function(n){return En(n,function(){for(var e=n.listSelections(),t=e.length-1;0<=t;t--)n.replaceRange(n.doc.lineSeparator(),e[t].anchor,e[t].head,"+input");e=n.listSelections();for(var r=0;r<e.length;r++)n.indentLine(e[r].from().line,null,!0);wn(n)})},openLine:function(e){return e.replaceSelection("\n","start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function Ro(e,t){var r=Xe(e.doc,t),n=Rt(r);return n!=r&&(t=Je(n)),Ho(!0,e,n,t,1)}function Bo(e,t){var r=Ro(e,t.line),n=Xe(e.doc,r.line),e=me(n,e.doc.direction);if(e&&0!=e[0].level)return r;n=Math.max(r.ch,n.text.search(/\S/)),t=t.line==r.line&&t.ch<=n&&t.ch;return nt(r.line,t?0:n,r.sticky)}function jo(e,t,r){if("string"==typeof t&&!(t=Io[t]))return!1;e.display.input.ensurePolled();var n=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),r&&(e.display.shift=!1),i=t(e)!=B}finally{e.display.shift=n,e.state.suppressEdits=!1}return i}var qo=new F;function Ko(e,t,r,n){var i=e.state.keySeq;if(i){if(Oo(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:qo.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),Vo(e,i+" "+t,r,n))return!0}return Vo(e,t,r,n)}function Vo(e,t,r,n){n=function(e,t,r){for(var n=0;n<e.state.keyMaps.length;n++){var i=No(t,e.state.keyMaps[n],r,e);if(i)return i}return e.options.extraKeys&&No(t,e.options.extraKeys,r,e)||No(t,e.options.keyMap,r,e)}(e,t,n);return"multi"==n&&(e.state.keySeq=t),"handled"==n&&or(e,"keyHandled",e,t,r),"handled"!=n&&"multi"!=n||(Te(r),un(e)),!!n}function Uo(t,e){var r=Do(e,!0);return!!r&&(e.shiftKey&&!t.state.keySeq?Ko(t,"Shift-"+r,e,function(e){return jo(t,e,!0)})||Ko(t,r,e,function(e){if("string"==typeof e?/^go[A-Z]/.test(e):e.motion)return jo(t,e)}):Ko(t,r,e,function(e){return jo(t,e)}))}var Go=null;function $o(e){var t,r,n,i=this;function o(e){18!=e.keyCode&&e.altKey||(S(n,"CodeMirror-crosshair"),we(document,"keyup",o),we(document,"mouseover",o))}e.target&&e.target!=i.display.input.getField()||(i.curOp.focus=A(),ke(i,e)||(w&&v<11&&27==e.keyCode&&(e.returnValue=!1),t=e.keyCode,i.display.shift=16==t||e.shiftKey,r=Uo(i,e),p&&(Go=r?t:null,!r&&88==t&&!Fe&&(g?e.metaKey:e.ctrlKey)&&i.replaceSelection("",null,"cut")),f&&!g&&!r&&46==t&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),18!=t||/\bCodeMirror-crosshair\b/.test(i.display.lineDiv.className)||(D(n=i.display.lineDiv,"CodeMirror-crosshair"),ye(document,"keyup",o),ye(document,"mouseover",o))))}function _o(e){16==e.keyCode&&(this.doc.sel.shift=!1),ke(this,e)}function Xo(e){var t=this;if(!(e.target&&e.target!=t.display.input.getField()||gr(t.display,e)||ke(t,e)||e.ctrlKey&&!e.altKey||g&&e.metaKey)){var r,n=e.keyCode,i=e.charCode;if(p&&n==Go)return Go=null,void Te(e);p&&(!e.which||e.which<10)&&Uo(t,e)||"\b"!=(i=String.fromCharCode(null==i?n:i))&&(Ko(r=t,"'"+i+"'",e,function(e){return jo(r,e,!0)})||t.display.input.onKeyPress(e))}}var Yo,Zo,Qo=function(e,t,r){this.time=e,this.pos=t,this.button=r};function Jo(e){var t,r,n,i,o,a=this,l=a.display;ke(a,e)||l.activeTouch&&l.input.supportsTouch()||(l.input.ensurePolled(),l.shift=e.shiftKey,gr(l,e)?h||(l.scroller.draggable=!1,setTimeout(function(){return l.scroller.draggable=!0},100)):ra(a,e)||(t=Qr(a,e),r=De(e),i=t?(n=t,i=r,o=+new Date,Zo&&Zo.compare(o,n,i)?(Yo=Zo=null,"triple"):Yo&&Yo.compare(o,n,i)?(Zo=new Qo(o,n,i),Yo=null,"double"):(Yo=new Qo(o,n,i),Zo=null,"single")):"single",window.focus(),1==r&&a.state.selectingText&&a.state.selectingText(e),t&&function(r,e,n,t,i){var o="Click";"double"==t?o="Double"+o:"triple"==t&&(o="Triple"+o);return Ko(r,Ao(o=(1==e?"Left":2==e?"Middle":"Right")+o,i),i,function(e){if("string"==typeof e&&(e=Io[e]),!e)return!1;var t=!1;try{r.isReadOnly()&&(r.state.suppressEdits=!0),t=e(r,n)!=B}finally{r.state.suppressEdits=!1}return t})}(a,r,t,i,e)||(1==r?t?function(e,t,r,n){w?setTimeout(P(dn,e),0):e.curOp.focus=A();var i,o=function(e,t,r){var n=e.getOption("configureMouse"),i=n?n(e,t,r):{};null==i.unit&&(n=m?r.shiftKey&&r.metaKey:r.altKey,i.unit=n?"rectangle":"single"==t?"char":"double"==t?"word":"line");null!=i.extend&&!e.doc.extend||(i.extend=e.doc.extend||r.shiftKey);null==i.addNew&&(i.addNew=g?r.metaKey:r.ctrlKey);null==i.moveOnDrag&&(i.moveOnDrag=!(g?r.altKey:r.ctrlKey));return i}(e,r,n),a=e.doc.sel;(e.options.dragDrop&&Pe&&!e.isReadOnly()&&"single"==r&&-1<(i=a.contains(t))&&(it((i=a.ranges[i]).from(),t)<0||0<t.xRel)&&(0<it(i.to(),t)||t.xRel<0)?function(t,r,n,i){var o=t.display,a=!1,l=Hn(t,function(e){h&&(o.scroller.draggable=!1),t.state.draggingText=!1,t.state.delayingBlurEvent&&(t.hasFocus()?t.state.delayingBlurEvent=!1:fn(t)),we(o.wrapper.ownerDocument,"mouseup",l),we(o.wrapper.ownerDocument,"mousemove",s),we(o.scroller,"dragstart",c),we(o.scroller,"drop",l),a||(Te(e),i.addNew||Ai(t.doc,n,null,null,i.extend),h&&!u||w&&9==v?setTimeout(function(){o.wrapper.ownerDocument.body.focus({preventScroll:!0}),o.input.focus()},20):o.input.focus())}),s=function(e){a=a||10<=Math.abs(r.clientX-e.clientX)+Math.abs(r.clientY-e.clientY)},c=function(){return a=!0};h&&(o.scroller.draggable=!0),(t.state.draggingText=l).copy=!i.moveOnDrag,ye(o.wrapper.ownerDocument,"mouseup",l),ye(o.wrapper.ownerDocument,"mousemove",s),ye(o.scroller,"dragstart",c),ye(o.scroller,"drop",l),t.state.delayingBlurEvent=!0,setTimeout(function(){return o.input.focus()},20),o.scroller.dragDrop&&o.scroller.dragDrop()}:function(f,e,h,p){w&&fn(f);var a=f.display,g=f.doc;Te(e);var m,v,y=g.sel,t=y.ranges;p.addNew&&!p.extend?(v=g.sel.contains(h),m=-1<v?t[v]:new oi(h,h)):(m=g.sel.primary(),v=g.sel.primIndex),"rectangle"==p.unit?(p.addNew||(m=new oi(h,h)),h=Qr(f,e,!0,!0),v=-1):(e=ea(f,h,p.unit),m=p.extend?Oi(m,e.anchor,e.head,p.extend):e),p.addNew?-1==v?(v=t.length,Ei(g,ai(f,t.concat([m]),v),{scroll:!1,origin:"*mouse"})):1<t.length&&t[v].empty()&&"char"==p.unit&&!p.extend?(Ei(g,ai(f,t.slice(0,v).concat(t.slice(v+1)),0),{scroll:!1,origin:"*mouse"}),y=g.sel):zi(g,v,m,q):(Ei(g,new ii([m],v=0),q),y=g.sel);var b=h;function l(e){if(0!=it(b,e))if(b=e,"rectangle"==p.unit){for(var t=[],r=f.options.tabSize,n=H(Xe(g,h.line).text,h.ch,r),i=H(Xe(g,e.line).text,e.ch,r),o=Math.min(n,i),a=Math.max(n,i),l=Math.min(h.line,e.line),s=Math.min(f.lastLine(),Math.max(h.line,e.line));l<=s;l++){var c=Xe(g,l).text,u=V(c,o,r);o==a?t.push(new oi(nt(l,u),nt(l,u))):c.length>u&&t.push(new oi(nt(l,u),nt(l,V(c,a,r))))}t.length||t.push(new oi(h,h)),Ei(g,ai(f,y.ranges.slice(0,v).concat(t),v),{origin:"*mouse",scroll:!1}),f.scrollIntoView(e)}else{var d,n=m,i=ea(f,e,p.unit),e=n.anchor,e=0<it(i.anchor,e)?(d=i.head,st(n.from(),i.anchor)):(d=i.anchor,lt(n.to(),i.head)),i=y.ranges.slice(0);i[v]=function(e,t){var r=t.anchor,n=t.head,i=Xe(e.doc,r.line);if(0==it(r,n)&&r.sticky==n.sticky)return t;var o=me(i);if(!o)return t;var a=ae(o,r.ch,r.sticky),l=o[a];if(l.from!=r.ch&&l.to!=r.ch)return t;i=a+(l.from==r.ch==(1!=l.level)?0:1);if(0==i||i==o.length)return t;s=n.line!=r.line?0<(n.line-r.line)*("ltr"==e.doc.direction?1:-1):(e=ae(o,n.ch,n.sticky),s=e-a||(n.ch-r.ch)*(1==l.level?-1:1),e==i-1||e==i?s<0:0<s);var i=o[i+(s?-1:0)],s=s==(1==i.level),i=s?i.from:i.to,s=s?"after":"before";return r.ch==i&&r.sticky==s?t:new oi(new nt(r.line,i,s),n)}(f,new oi(ut(g,e),d)),Ei(g,ai(f,i,v),q)}}var s=a.wrapper.getBoundingClientRect(),c=0;function r(e){f.state.selectingText=!1,c=1/0,e&&(Te(e),a.input.focus()),we(a.wrapper.ownerDocument,"mousemove",n),we(a.wrapper.ownerDocument,"mouseup",i),g.history.lastSelOrigin=null}var n=Hn(f,function(e){(0!==e.buttons&&De(e)?function e(t){var r,n,i=++c,o=Qr(f,t,!0,"rectangle"==p.unit);o&&(0!=it(o,b)?(f.curOp.focus=A(),l(o),r=vn(a,g),(o.line>=r.to||o.line<r.from)&&setTimeout(Hn(f,function(){c==i&&e(t)}),150)):(n=t.clientY<s.top?-20:t.clientY>s.bottom?20:0)&&setTimeout(Hn(f,function(){c==i&&(a.scroller.scrollTop+=n,e(t))}),50))}:r)(e)}),i=Hn(f,r);f.state.selectingText=i,ye(a.wrapper.ownerDocument,"mousemove",n),ye(a.wrapper.ownerDocument,"mouseup",i)})(e,n,t,o)}(a,t,i,e):Ae(e)==l.scroller&&Te(e):2==r?(t&&Ai(a.doc,t),setTimeout(function(){return l.input.focus()},20)):3==r&&(x?a.display.input.onContextMenu(e):fn(a)))))}function ea(e,t,r){if("char"==r)return new oi(t,t);if("word"==r)return e.findWordAt(t);if("line"==r)return new oi(nt(t.line,0),ut(e.doc,nt(t.line+1,0)));t=r(e,t);return new oi(t.from,t.to)}function ta(e,t,r,n){var i,o;if(t.touches)i=t.touches[0].clientX,o=t.touches[0].clientY;else try{i=t.clientX,o=t.clientY}catch(e){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&Te(t);var a=e.display,n=a.lineDiv.getBoundingClientRect();if(o>n.bottom||!Se(e,r))return Ne(t);o-=n.top-a.viewOffset;for(var l=0;l<e.display.gutterSpecs.length;++l){var s=a.gutters.childNodes[l];if(s&&s.getBoundingClientRect().right>=i)return xe(e,r,e,et(e.doc,o),e.display.gutterSpecs[l].className,t),Ne(t)}}function ra(e,t){return ta(e,t,"gutterClick",!0)}function na(e,t){var r,n;gr(e.display,t)||(n=t,Se(r=e,"gutterContextMenu")&&ta(r,n,"gutterContextMenu",!1))||ke(e,t,"contextmenu")||x||e.display.input.onContextMenu(t)}function ia(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),zr(e)}Qo.prototype.compare=function(e,t,r){return this.time+400>e&&0==it(t,this.pos)&&r==this.button};var oa={toString:function(){return"CodeMirror.Init"}},aa={},la={};function sa(e,t,r){!t!=!(r&&r!=oa)&&(r=e.display.dragFunctions,(t=t?ye:we)(e.display.scroller,"dragstart",r.start),t(e.display.scroller,"dragenter",r.enter),t(e.display.scroller,"dragover",r.over),t(e.display.scroller,"dragleave",r.leave),t(e.display.scroller,"drop",r.drop))}function ca(e){e.options.lineWrapping?(D(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(S(e.display.wrapper,"CodeMirror-wrap"),Ut(e)),Zr(e),en(e),zr(e),setTimeout(function(){return Nn(e)},100)}function ua(e,t){var r=this;if(!(this instanceof ua))return new ua(e,t);this.options=t=t?E(t):{},E(aa,t,!1);var n=t.value;"string"==typeof n?n=new ho(n,t.mode,null,t.lineSeparator,t.direction):t.mode&&(n.modeOption=t.mode),this.doc=n;var i,o=new ua.inputStyles[t.inputStyle](this),o=this.display=new Qn(e,n,o,t);for(i in ia(o.wrapper.CodeMirror=this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Dn(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new F,keySeq:null,specialChars:null},t.autofocus&&!d&&o.input.focus(),w&&v<11&&setTimeout(function(){return r.display.input.reset(!0)},20),function(n){var i=n.display;ye(i.scroller,"mousedown",Hn(n,Jo)),ye(i.scroller,"dblclick",w&&v<11?Hn(n,function(e){var t;ke(n,e)||(!(t=Qr(n,e))||ra(n,e)||gr(n.display,e)||(Te(e),t=n.findWordAt(t),Ai(n.doc,t.anchor,t.head)))}):function(e){return ke(n,e)||Te(e)}),ye(i.scroller,"contextmenu",function(e){return na(n,e)}),ye(i.input.getField(),"contextmenu",function(e){i.scroller.contains(e.target)||na(n,e)});var r,o={end:0};function a(){i.activeTouch&&(r=setTimeout(function(){return i.activeTouch=null},1e3),(o=i.activeTouch).end=+new Date)}function l(e,t){if(null==t.left)return 1;var r=t.left-e.left,e=t.top-e.top;return 400<r*r+e*e}ye(i.scroller,"touchstart",function(e){var t;ke(n,e)||function(e){if(1==e.touches.length){e=e.touches[0];return e.radiusX<=1&&e.radiusY<=1}}(e)||ra(n,e)||(i.input.ensurePolled(),clearTimeout(r),t=+new Date,i.activeTouch={start:t,moved:!1,prev:t-o.end<=300?o:null},1==e.touches.length&&(i.activeTouch.left=e.touches[0].pageX,i.activeTouch.top=e.touches[0].pageY))}),ye(i.scroller,"touchmove",function(){i.activeTouch&&(i.activeTouch.moved=!0)}),ye(i.scroller,"touchend",function(e){var t,r=i.activeTouch;r&&!gr(i,e)&&null!=r.left&&!r.moved&&new Date-r.start<300&&(t=n.coordsChar(i.activeTouch,"page"),t=!r.prev||l(r,r.prev)?new oi(t,t):!r.prev.prev||l(r,r.prev.prev)?n.findWordAt(t):new oi(nt(t.line,0),ut(n.doc,nt(t.line+1,0))),n.setSelection(t.anchor,t.head),n.focus(),Te(e)),a()}),ye(i.scroller,"touchcancel",a),ye(i.scroller,"scroll",function(){i.scroller.clientHeight&&(Sn(n,i.scroller.scrollTop),Tn(n,i.scroller.scrollLeft,!0),xe(n,"scroll",n))}),ye(i.scroller,"mousewheel",function(e){return ni(n,e)}),ye(i.scroller,"DOMMouseScroll",function(e){return ni(n,e)}),ye(i.wrapper,"scroll",function(){return i.wrapper.scrollTop=i.wrapper.scrollLeft=0}),i.dragFunctions={enter:function(e){ke(n,e)||Oe(e)},over:function(e){var t,r;ke(n,e)||((r=Qr(t=n,r=e))&&(sn(t,r,r=document.createDocumentFragment()),t.display.dragCursor||(t.display.dragCursor=M("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),t.display.lineSpace.insertBefore(t.display.dragCursor,t.display.cursorDiv)),T(t.display.dragCursor,r)),Oe(e))},start:function(e){return t=n,r=e,void(w&&(!t.state.draggingText||+new Date-po<100)?Oe(r):ke(t,r)||gr(t.display,r)||(r.dataTransfer.setData("Text",t.getSelection()),r.dataTransfer.effectAllowed="copyMove",r.dataTransfer.setDragImage&&!u&&((e=M("img",null,null,"position: fixed; left: 0; top: 0;")).src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",p&&(e.width=e.height=1,t.display.wrapper.appendChild(e),e._top=e.offsetTop),r.dataTransfer.setDragImage(e,0,0),p&&e.parentNode.removeChild(e))));var t,r},drop:Hn(n,go),leave:function(e){ke(n,e)||mo(n)}};var e=i.input.getField();ye(e,"keyup",function(e){return _o.call(n,e)}),ye(e,"keydown",Hn(n,$o)),ye(e,"keypress",Hn(n,Xo)),ye(e,"focus",function(e){return hn(n,e)}),ye(e,"blur",function(e){return pn(n,e)})}(this),bo(),Wn(this),this.curOp.forceUpdate=!0,vi(this,n),t.autofocus&&!d||this.hasFocus()?setTimeout(function(){r.hasFocus()&&!r.state.focused&&hn(r)},20):pn(this),la)la.hasOwnProperty(i)&&la[i](this,t[i],oa);_n(this),t.finishInit&&t.finishInit(this);for(var a=0;a<da.length;++a)da[a](this);Pn(this),h&&t.lineWrapping&&"optimizelegibility"==getComputedStyle(o.lineDiv).textRendering&&(o.lineDiv.style.textRendering="auto")}ua.defaults=aa,ua.optionHandlers=la;var da=[];function fa(e,t,r,n){var i,o=e.doc;null==r&&(r="add"),"smart"==r&&(o.mode.indent?i=mt(e,t).state:r="prev");var a=e.options.tabSize,l=Xe(o,t),s=H(l.text,null,a);l.stateAfter&&(l.stateAfter=null);var c,u=l.text.match(/^\s*/)[0];if(n||/\S/.test(l.text)){if("smart"==r&&((c=o.mode.indent(i,l.text.slice(u.length),l.text))==B||150<c)){if(!n)return;r="prev"}}else c=0,r="not";"prev"==r?c=t>o.first?H(Xe(o,t-1).text,null,a):0:"add"==r?c=s+e.options.indentUnit:"subtract"==r?c=s-e.options.indentUnit:"number"==typeof r&&(c=s+r),c=Math.max(0,c);var d="",f=0;if(e.options.indentWithTabs)for(var h=Math.floor(c/a);h;--h)f+=a,d+="\t";if(f<c&&(d+=G(c-f)),d!=u)return Yi(o,d,nt(t,0),nt(t,u.length),"+input"),!(l.stateAfter=null);for(var p=0;p<o.sel.ranges.length;p++){var g=o.sel.ranges[p];if(g.head.line==t&&g.head.ch<u.length){g=nt(t,u.length);zi(o,p,new oi(g,g));break}}}ua.defineInitHook=function(e){return da.push(e)};var ha=null;function pa(e){ha=e}function ga(e,t,r,n,i){var o=e.doc;e.display.shift=!1,n=n||o.sel;var a=+new Date-200,l="paste"==i||e.state.pasteIncoming>a,s=Ee(t),c=null;if(l&&1<n.ranges.length)if(ha&&ha.text.join("\n")==t){if(n.ranges.length%ha.text.length==0){c=[];for(var u=0;u<ha.text.length;u++)c.push(o.splitLines(ha.text[u]))}}else s.length==n.ranges.length&&e.options.pasteLinesPerSelection&&(c=_(s,function(e){return[e]}));for(var d=e.curOp.updateInput,f=n.ranges.length-1;0<=f;f--){var h=n.ranges[f],p=h.from(),g=h.to();h.empty()&&(r&&0<r?p=nt(p.line,p.ch-r):e.state.overwrite&&!l?g=nt(g.line,Math.min(Xe(o,g.line).text.length,g.ch+$(s).length)):l&&ha&&ha.lineWise&&ha.text.join("\n")==s.join("\n")&&(p=g=nt(p.line,0)));g={from:p,to:g,text:c?c[f%c.length]:s,origin:i||(l?"paste":e.state.cutIncoming>a?"cut":"+input")};Ui(e.doc,g),or(e,"inputRead",e,g)}t&&!l&&va(e,t),wn(e),e.curOp.updateInput<2&&(e.curOp.updateInput=d),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function ma(e,t){var r=e.clipboardData&&e.clipboardData.getData("Text");return r&&(e.preventDefault(),t.isReadOnly()||t.options.disableInput||En(t,function(){return ga(t,r,0,null,"paste")}),1)}function va(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var r=e.doc.sel,n=r.ranges.length-1;0<=n;n--){var i=r.ranges[n];if(!(100<i.head.ch||n&&r.ranges[n-1].head.line==i.head.line)){var o=e.getModeAt(i.head),a=!1;if(o.electricChars){for(var l=0;l<o.electricChars.length;l++)if(-1<t.indexOf(o.electricChars.charAt(l))){a=fa(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(Xe(e.doc,i.head.line).text.slice(0,i.head.ch))&&(a=fa(e,i.head.line,"smart"));a&&or(e,"electricInput",e,i.head.line)}}}function ya(e){for(var t=[],r=[],n=0;n<e.doc.sel.ranges.length;n++){var i=e.doc.sel.ranges[n].head.line,i={anchor:nt(i,0),head:nt(i+1,0)};r.push(i),t.push(e.getRange(i.anchor,i.head))}return{text:t,ranges:r}}function ba(e,t,r,n){e.setAttribute("autocorrect",r?"":"off"),e.setAttribute("autocapitalize",n?"":"off"),e.setAttribute("spellcheck",!!t)}function wa(){var e=M("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=M("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return h?e.style.width="1000px":e.setAttribute("wrap","off"),l&&(e.style.border="1px solid black"),ba(e),t}function xa(i,o,a,l,s){var e=o,t=a,c=Xe(i,o.line),u=s&&"rtl"==i.direction?-a:a;function r(e){var t,r,n;if(null==(r="codepoint"==l?(t=c.text.charCodeAt(o.ch+(0<a?0:-1)),isNaN(t)?null:(r=0<a?55296<=t&&t<56320:56320<=t&&t<57343,new nt(o.line,Math.max(0,Math.min(c.text.length,o.ch+a*(r?2:1))),-a))):s?Fo(i.cm,c,o,a):Eo(c,o,a))){if(e||(n=o.line+u)<i.first||n>=i.first+i.size||(o=new nt(n,o.ch,o.sticky),!(c=Xe(i,n))))return;o=Ho(s,i.cm,c,o.line,u)}else o=r;return 1}if("char"==l||"codepoint"==l)r();else if("column"==l)r(!0);else if("word"==l||"group"==l)for(var n=null,d="group"==l,f=i.cm&&i.cm.getHelper(o,"wordChars"),h=!0;!(a<0)||r(!h);h=!1){var p=c.text.charAt(o.ch)||"\n",p=J(p,f)?"w":d&&"\n"==p?"n":!d||/\s/.test(p)?null:"p";if(!d||h||p||(p="s"),n&&n!=p){a<0&&(a=1,r(),o.sticky="after");break}if(p&&(n=p),0<a&&!r(!h))break}t=ji(i,o,e,t,!0);return ot(e,t)&&(t.hitSide=!0),t}function ka(e,t,r,n){var i,o,a,l=e.doc,s=t.left;for("page"==n?(i=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),i=Math.max(i-.5*Gr(e.display),3),o=(0<r?t.bottom:t.top)+r*i):"line"==n&&(o=0<r?t.bottom+3:t.top-3);(a=qr(e,s,o)).outside;){if(r<0?o<=0:o>=l.height){a.hitSide=!0;break}o+=5*r}return a}e=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new F,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};function Ca(e,t){var r=Sr(e,t.line);if(!r||r.hidden)return null;var n=Xe(e.doc,t.line),r=kr(r,n,t.line),n=me(n,e.doc.direction),e="left";n&&(e=ae(n,t.ch)%2?"right":"left");e=Or(r.map,t.ch,e);return e.offset="right"==e.collapse?e.end:e.start,e}function Sa(e,t){return t&&(e.bad=!0),e}function La(e,t,r){var n;if(t==e.display.lineDiv){if(!(n=e.display.lineDiv.childNodes[r]))return Sa(e.clipPos(nt(e.display.viewTo-1)),!0);t=null,r=0}else for(n=t;;n=n.parentNode){if(!n||n==e.display.lineDiv)return null;if(n.parentNode&&n.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var o=e.display.view[i];if(o.node==n)return function(c,e,t){var r=c.text.firstChild,n=!1;if(!e||!O(r,e))return Sa(nt(Je(c.line),0),!0);if(e==r&&(n=!0,e=r.childNodes[t],t=0,!e)){var i=c.rest?$(c.rest):c.line;return Sa(nt(Je(i),i.text.length),n)}var i=3==e.nodeType?e:null,o=e;i||1!=e.childNodes.length||3!=e.firstChild.nodeType||(i=e.firstChild,t=t&&i.nodeValue.length);for(;o.parentNode!=r;)o=o.parentNode;var u=c.measure,d=u.maps;function a(e,t,r){for(var n=-1;n<(d?d.length:0);n++)for(var i=n<0?u.map:d[n],o=0;o<i.length;o+=3){var a=i[o+2];if(a==e||a==t){var l=Je(n<0?c.line:c.rest[n]),s=i[o]+r;return(r<0||a!=e)&&(s=i[o+(r?1:0)]),nt(l,s)}}}var l=a(i,o,t);if(l)return Sa(l,n);for(var s=o.nextSibling,f=i?i.nodeValue.length-t:0;s;s=s.nextSibling){if(l=a(s,s.firstChild,0))return Sa(nt(l.line,l.ch-f),n);f+=s.textContent.length}for(var h=o.previousSibling,p=t;h;h=h.previousSibling){if(l=a(h,h.firstChild,-1))return Sa(nt(l.line,l.ch+p),n);p+=h.textContent.length}}(o,t,r)}}e.prototype.init=function(e){var t=this,o=this,a=o.cm,l=o.div=e.lineDiv;function s(e){for(var t=e.target;t;t=t.parentNode){if(t==l)return 1;if(/\bCodeMirror-(?:line)?widget\b/.test(t.className))break}}function r(e){if(s(e)&&!ke(a,e)){if(a.somethingSelected())pa({lineWise:!1,text:a.getSelections()}),"cut"==e.type&&a.replaceSelection("",null,"cut");else{if(!a.options.lineWiseCopyCut)return;var t=ya(a);pa({lineWise:!0,text:t.text}),"cut"==e.type&&a.operation(function(){a.setSelections(t.ranges,0,j),a.replaceSelection("",null,"cut")})}if(e.clipboardData){e.clipboardData.clearData();var r=ha.text.join("\n");if(e.clipboardData.setData("Text",r),e.clipboardData.getData("Text")==r)return void e.preventDefault()}var n=wa(),e=n.firstChild;a.display.lineSpace.insertBefore(n,a.display.lineSpace.firstChild),e.value=ha.text.join("\n");var i=document.activeElement;W(e),setTimeout(function(){a.display.lineSpace.removeChild(n),i.focus(),i==l&&o.showPrimarySelection()},50)}}l.contentEditable=!0,ba(l,a.options.spellcheck,a.options.autocorrect,a.options.autocapitalize),ye(l,"paste",function(e){!s(e)||ke(a,e)||ma(e,a)||v<=11&&setTimeout(Hn(a,function(){return t.updateFromDOM()}),20)}),ye(l,"compositionstart",function(e){t.composing={data:e.data,done:!1}}),ye(l,"compositionupdate",function(e){t.composing||(t.composing={data:e.data,done:!1})}),ye(l,"compositionend",function(e){t.composing&&(e.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),ye(l,"touchstart",function(){return o.forceCompositionEnd()}),ye(l,"input",function(){t.composing||t.readFromDOMSoon()}),ye(l,"copy",r),ye(l,"cut",r)},e.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},e.prototype.prepareSelection=function(){var e=ln(this.cm,!1);return e.focus=document.activeElement==this.div,e},e.prototype.showSelection=function(e,t){e&&this.cm.display.view.length&&((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},e.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},e.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,r=t.doc.sel.primary(),n=r.from(),i=r.to();if(t.display.viewTo==t.display.viewFrom||n.line>=t.display.viewTo||i.line<t.display.viewFrom)e.removeAllRanges();else{var o=La(t,e.anchorNode,e.anchorOffset),r=La(t,e.focusNode,e.focusOffset);if(!o||o.bad||!r||r.bad||0!=it(st(o,r),n)||0!=it(lt(o,r),i)){var r=t.display.view,a=n.line>=t.display.viewFrom&&Ca(t,n)||{node:r[0].measure.map[2],offset:0},l=i.line<t.display.viewTo&&Ca(t,i);if(l||(l={node:(c=(c=r[r.length-1].measure).maps?c.maps[c.maps.length-1]:c.map)[c.length-1],offset:c[c.length-2]-c[c.length-3]}),a&&l){var s,c=e.rangeCount&&e.getRangeAt(0);try{s=C(a.node,a.offset,l.offset,l.node)}catch(e){}s&&(!f&&t.state.focused?(e.collapse(a.node,a.offset),s.collapsed||(e.removeAllRanges(),e.addRange(s))):(e.removeAllRanges(),e.addRange(s)),c&&null==e.anchorNode?e.addRange(c):f&&this.startGracePeriod()),this.rememberSelection()}else e.removeAllRanges()}}},e.prototype.startGracePeriod=function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){return e.cm.curOp.selectionChanged=!0})},20)},e.prototype.showMultipleSelections=function(e){T(this.cm.display.cursorDiv,e.cursors),T(this.cm.display.selectionDiv,e.selection)},e.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},e.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;e=e.getRangeAt(0).commonAncestorContainer;return O(this.div,e)},e.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()&&document.activeElement==this.div||this.showSelection(this.prepareSelection(),!0),this.div.focus())},e.prototype.blur=function(){this.div.blur()},e.prototype.getField=function(){return this.div},e.prototype.supportsTouch=function(){return!0},e.prototype.receivedFocus=function(){var t=this;this.selectionInEditor()?this.pollSelection():En(this.cm,function(){return t.cm.curOp.selectionChanged=!0}),this.polling.set(this.cm.options.pollInterval,function e(){t.cm.state.focused&&(t.pollSelection(),t.polling.set(t.cm.options.pollInterval,e))})},e.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},e.prototype.pollSelection=function(){if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var e,t,r=this.getSelection(),n=this.cm;if(s&&o&&this.cm.display.gutterSpecs.length&&function(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}(r.anchorNode))return this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),void this.focus();this.composing||(this.rememberSelection(),e=La(n,r.anchorNode,r.anchorOffset),t=La(n,r.focusNode,r.focusOffset),e&&t&&En(n,function(){Ei(n.doc,li(e,t),j),(e.bad||t.bad)&&(n.curOp.selectionChanged=!0)}))}},e.prototype.pollContent=function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e,t=this.cm,r=t.display,n=t.doc.sel.primary(),i=n.from(),n=n.to();if(0==i.ch&&i.line>t.firstLine()&&(i=nt(i.line-1,Xe(t.doc,i.line-1).length)),n.ch==Xe(t.doc,n.line).text.length&&n.line<t.lastLine()&&(n=nt(n.line+1,0)),i.line<r.viewFrom||n.line>r.viewTo-1)return!1;m=i.line==r.viewFrom||0==(m=Jr(t,i.line))?(e=Je(r.view[0].line),r.view[0].node):(e=Je(r.view[m].line),r.view[m-1].node.nextSibling);var o,n=Jr(t,n.line),n=n==r.view.length-1?(o=r.viewTo-1,r.lineDiv.lastChild):(o=Je(r.view[n+1].line)-1,r.view[n+1].node.previousSibling);if(!m)return!1;for(var a=t.doc.splitLines(function(a,e,t,l,s){var r="",c=!1,u=a.doc.lineSeparator(),d=!1;function f(){c&&(r+=u,d&&(r+=u),c=d=!1)}function h(e){e&&(f(),r+=e)}for(;!function e(t){if(1==t.nodeType){var r=t.getAttribute("cm-text");if(r)h(r);else if(r=t.getAttribute("cm-marker"))(r=a.findMarks(nt(l,0),nt(s+1,0),(o=+r,function(e){return e.id==o}))).length&&(n=r[0].find(0))&&h(Ye(a.doc,n.from,n.to).join(u));else if("false"!=t.getAttribute("contenteditable")){var n=/^(pre|div|p|li|table|br)$/i.test(t.nodeName);if(/^br$/i.test(t.nodeName)||0!=t.textContent.length){n&&f();for(var i=0;i<t.childNodes.length;i++)e(t.childNodes[i]);/^(pre|p)$/i.test(t.nodeName)&&(d=!0),n&&(c=!0)}}}else 3==t.nodeType&&h(t.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "));var o}(e),e!=t;)e=e.nextSibling,d=!1;return r}(t,m,n,e,o)),l=Ye(t.doc,nt(e,0),nt(o,Xe(t.doc,o).text.length));1<a.length&&1<l.length;)if($(a)==$(l))a.pop(),l.pop(),o--;else{if(a[0]!=l[0])break;a.shift(),l.shift(),e++}for(var s=0,c=0,u=a[0],d=l[0],f=Math.min(u.length,d.length);s<f&&u.charCodeAt(s)==d.charCodeAt(s);)++s;for(var h=$(a),p=$(l),g=Math.min(h.length-(1==a.length?s:0),p.length-(1==l.length?s:0));c<g&&h.charCodeAt(h.length-c-1)==p.charCodeAt(p.length-c-1);)++c;if(1==a.length&&1==l.length&&e==i.line)for(;s&&s>i.ch&&h.charCodeAt(h.length-c-1)==p.charCodeAt(p.length-c-1);)s--,c++;a[a.length-1]=h.slice(0,h.length-c).replace(/^\u200b+/,""),a[0]=a[0].slice(s).replace(/\u200b+$/,"");var m=nt(e,s),n=nt(o,l.length?$(l).length-c:0);return 1<a.length||a[0]||it(m,n)?(Yi(t.doc,a,m,n,"+input"),!0):void 0},e.prototype.ensurePolled=function(){this.forceCompositionEnd()},e.prototype.reset=function(){this.forceCompositionEnd()},e.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},e.prototype.readFromDOMSoon=function(){var e=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing){if(!e.composing.done)return;e.composing=null}e.updateFromDOM()},80))},e.prototype.updateFromDOM=function(){var e=this;!this.cm.isReadOnly()&&this.pollContent()||En(this.cm,function(){return en(e.cm)})},e.prototype.setUneditable=function(e){e.contentEditable="false"},e.prototype.onKeyPress=function(e){0==e.charCode||this.composing||(e.preventDefault(),this.cm.isReadOnly()||Hn(this.cm,ga)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},e.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)},e.prototype.onContextMenu=function(){},e.prototype.resetPosition=function(){},e.prototype.needsContentAttribute=!0;var Ta,Ma,Na,Oa,Aa,n=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new F,this.hasSelection=!1,this.composing=null};function Da(e,t,n,r){Ta.defaults[e]=t,n&&(Ma[e]=r?function(e,t,r){r!=oa&&n(e,t,r)}:n)}n.prototype.init=function(r){var e=this,n=this,i=this.cm;this.createField(r);var o=this.textarea;function t(e){if(!ke(i,e)){if(i.somethingSelected())pa({lineWise:!1,text:i.getSelections()});else{if(!i.options.lineWiseCopyCut)return;var t=ya(i);pa({lineWise:!0,text:t.text}),"cut"==e.type?i.setSelections(t.ranges,null,j):(n.prevInput="",o.value=t.text.join("\n"),W(o))}"cut"==e.type&&(i.state.cutIncoming=+new Date)}}r.wrapper.insertBefore(this.wrapper,r.wrapper.firstChild),l&&(o.style.width="0px"),ye(o,"input",function(){w&&9<=v&&e.hasSelection&&(e.hasSelection=null),n.poll()}),ye(o,"paste",function(e){ke(i,e)||ma(e,i)||(i.state.pasteIncoming=+new Date,n.fastPoll())}),ye(o,"cut",t),ye(o,"copy",t),ye(r.scroller,"paste",function(e){if(!gr(r,e)&&!ke(i,e)){if(!o.dispatchEvent)return i.state.pasteIncoming=+new Date,void n.focus();var t=new Event("paste");t.clipboardData=e.clipboardData,o.dispatchEvent(t)}}),ye(r.lineSpace,"selectstart",function(e){gr(r,e)||Te(e)}),ye(o,"compositionstart",function(){var e=i.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:e,range:i.markText(e,i.getCursor("to"),{className:"CodeMirror-composing"})}}),ye(o,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},n.prototype.createField=function(e){this.wrapper=wa(),this.textarea=this.wrapper.firstChild},n.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},n.prototype.prepareSelection=function(){var e,t=this.cm,r=t.display,n=t.doc,i=ln(t);return t.options.moveInputWithCursor&&(e=Rr(t,n.sel.primary().head,"div"),t=r.wrapper.getBoundingClientRect(),n=r.lineDiv.getBoundingClientRect(),i.teTop=Math.max(0,Math.min(r.wrapper.clientHeight-10,e.top+n.top-t.top)),i.teLeft=Math.max(0,Math.min(r.wrapper.clientWidth-10,e.left+n.left-t.left))),i},n.prototype.showSelection=function(e){var t=this.cm.display;T(t.cursorDiv,e.cursors),T(t.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},n.prototype.reset=function(e){var t,r;this.contextMenuPending||this.composing||((t=this.cm).somethingSelected()?(this.prevInput="",r=t.getSelection(),this.textarea.value=r,t.state.focused&&W(this.textarea),w&&9<=v&&(this.hasSelection=r)):e||(this.prevInput=this.textarea.value="",w&&9<=v&&(this.hasSelection=null)))},n.prototype.getField=function(){return this.textarea},n.prototype.supportsTouch=function(){return!1},n.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!d||A()!=this.textarea))try{this.textarea.focus()}catch(e){}},n.prototype.blur=function(){this.textarea.blur()},n.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},n.prototype.receivedFocus=function(){this.slowPoll()},n.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},n.prototype.fastPoll=function(){var t=!1,r=this;r.pollingFast=!0,r.polling.set(20,function e(){r.poll()||t?(r.pollingFast=!1,r.slowPoll()):(t=!0,r.polling.set(60,e))})},n.prototype.poll=function(){var e=this,t=this.cm,r=this.textarea,n=this.prevInput;if(this.contextMenuPending||!t.state.focused||He(r)&&!n&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=r.value;if(i==n&&!t.somethingSelected())return!1;if(w&&9<=v&&this.hasSelection===i||g&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var o=i.charCodeAt(0);if(8203!=o||n||(n=""),8666==o)return this.reset(),this.cm.execCommand("undo")}for(var a=0,l=Math.min(n.length,i.length);a<l&&n.charCodeAt(a)==i.charCodeAt(a);)++a;return En(t,function(){ga(t,i.slice(a),n.length-a,null,e.composing?"*compose":null),1e3<i.length||-1<i.indexOf("\n")?r.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},n.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},n.prototype.onKeyPress=function(){w&&9<=v&&(this.hasSelection=null),this.fastPoll()},n.prototype.onContextMenu=function(e){var r=this,n=r.cm,i=n.display,o=r.textarea;r.contextMenuPending&&r.contextMenuPending();var a,l,t,s,c=Qr(n,e),u=i.scroller.scrollTop;function d(){var e,t;null!=o.selectionStart&&(t=""+((e=n.somethingSelected())?o.value:""),o.value="⇚",o.value=t,r.prevInput=e?"":"",o.selectionStart=1,o.selectionEnd=t.length,i.selForContextMenu=n.doc.sel)}function f(){var e,t;r.contextMenuPending==f&&(r.contextMenuPending=!1,r.wrapper.style.cssText=l,o.style.cssText=a,w&&v<9&&i.scrollbars.setScrollTop(i.scroller.scrollTop=u),null!=o.selectionStart&&((!w||w&&v<9)&&d(),e=0,t=function(){i.selForContextMenu==n.doc.sel&&0==o.selectionStart&&0<o.selectionEnd&&""==r.prevInput?Hn(n,Ki)(n):e++<10?i.detectingSelectAll=setTimeout(t,500):(i.selForContextMenu=null,i.input.reset())},i.detectingSelectAll=setTimeout(t,200)))}c&&!p&&(n.options.resetSelectionOnContextMenu&&-1==n.doc.sel.contains(c)&&Hn(n,Ei)(n.doc,li(c),j),a=o.style.cssText,l=r.wrapper.style.cssText,c=r.wrapper.offsetParent.getBoundingClientRect(),r.wrapper.style.cssText="position: static",o.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(e.clientY-c.top-5)+"px; left: "+(e.clientX-c.left-5)+"px;\n z-index: 1000; background: "+(w?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",h&&(t=window.scrollY),i.input.focus(),h&&window.scrollTo(null,t),i.input.reset(),n.somethingSelected()||(o.value=r.prevInput=" "),r.contextMenuPending=f,i.selForContextMenu=n.doc.sel,clearTimeout(i.detectingSelectAll),w&&9<=v&&d(),x?(Oe(e),s=function(){we(window,"mouseup",s),setTimeout(f,20)},ye(window,"mouseup",s)):setTimeout(f,50))},n.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e,this.textarea.readOnly=!!e},n.prototype.setUneditable=function(){},n.prototype.needsContentAttribute=!1,Ma=(Ta=ua).optionHandlers,Ta.defineOption=Da,Ta.Init=oa,Da("value","",function(e,t){return e.setValue(t)},!0),Da("mode",null,function(e,t){e.doc.modeOption=t,fi(e)},!0),Da("indentUnit",2,fi,!0),Da("indentWithTabs",!1),Da("smartIndent",!0),Da("tabSize",4,function(e){hi(e),zr(e),en(e)},!0),Da("lineSeparator",null,function(e,n){if(e.doc.lineSep=n){var i=[],o=e.doc.first;e.doc.iter(function(e){for(var t=0;;){var r=e.text.indexOf(n,t);if(-1==r)break;t=r+n.length,i.push(nt(o,r))}o++});for(var t=i.length-1;0<=t;t--)Yi(e.doc,n,i[t],nt(i[t].line,i[t].ch+n.length))}}),Da("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(e,t,r){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g"),r!=oa&&e.refresh()}),Da("specialCharPlaceholder",Zt,function(e){return e.refresh()},!0),Da("electricChars",!0),Da("inputStyle",d?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),Da("spellcheck",!1,function(e,t){return e.getInputField().spellcheck=t},!0),Da("autocorrect",!1,function(e,t){return e.getInputField().autocorrect=t},!0),Da("autocapitalize",!1,function(e,t){return e.getInputField().autocapitalize=t},!0),Da("rtlMoveVisually",!y),Da("wholeLineUpdateBefore",!0),Da("theme","default",function(e){ia(e),Zn(e)},!0),Da("keyMap","default",function(e,t,r){t=zo(t),r=r!=oa&&zo(r);r&&r.detach&&r.detach(e,t),t.attach&&t.attach(e,r||null)}),Da("extraKeys",null),Da("configureMouse",null),Da("lineWrapping",!1,ca,!0),Da("gutters",[],function(e,t){e.display.gutterSpecs=Xn(t,e.options.lineNumbers),Zn(e)},!0),Da("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?Xr(e.display)+"px":"0",e.refresh()},!0),Da("coverGutterNextToScrollbar",!1,function(e){return Nn(e)},!0),Da("scrollbarStyle","native",function(e){Dn(e),Nn(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),Da("lineNumbers",!1,function(e,t){e.display.gutterSpecs=Xn(e.options.gutters,t),Zn(e)},!0),Da("firstLineNumber",1,Zn,!0),Da("lineNumberFormatter",function(e){return e},Zn,!0),Da("showCursorWhenSelecting",!1,an,!0),Da("resetSelectionOnContextMenu",!0),Da("lineWiseCopyCut",!0),Da("pasteLinesPerSelection",!0),Da("selectionsMayTouch",!1),Da("readOnly",!1,function(e,t){"nocursor"==t&&(pn(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)}),Da("screenReaderLabel",null,function(e,t){t=""===t?null:t,e.display.input.screenReaderLabelChanged(t)}),Da("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),Da("dragDrop",!0,sa),Da("allowDropFileTypes",null),Da("cursorBlinkRate",530),Da("cursorScrollMargin",0),Da("cursorHeight",1,an,!0),Da("singleCursorHeightPerLine",!0,an,!0),Da("workTime",100),Da("workDelay",100),Da("flattenSpans",!0,hi,!0),Da("addModeClass",!1,hi,!0),Da("pollInterval",100),Da("undoDepth",200,function(e,t){return e.doc.history.undoDepth=t}),Da("historyEventDelay",1250),Da("viewportMargin",10,function(e){return e.refresh()},!0),Da("maxHighlightLength",1e4,hi,!0),Da("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),Da("tabindex",null,function(e,t){return e.display.input.getField().tabIndex=t||""}),Da("autofocus",null),Da("direction","ltr",function(e,t){return e.doc.setDirection(t)},!0),Da("phrases",null),Oa=(Na=ua).optionHandlers,Aa=Na.helpers={},Na.prototype={constructor:Na,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,t){var r=this.options,n=r[e];r[e]==t&&"mode"!=e||(r[e]=t,Oa.hasOwnProperty(e)&&Hn(this,Oa[e])(this,t,n),xe(this,"optionChange",this,e))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](zo(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,r=0;r<t.length;++r)if(t[r]==e||t[r].name==e)return t.splice(r,1),!0},addOverlay:Fn(function(e,t){var r=e.token?e:Na.getMode(this.options,e);if(r.startState)throw new Error("Overlays may not be stateful.");!function(e,t,r){for(var n=0,i=r(t);n<e.length&&r(e[n])<=i;)n++;e.splice(n,0,t)}(this.state.overlays,{mode:r,modeSpec:e,opaque:t&&t.opaque,priority:t&&t.priority||0},function(e){return e.priority}),this.state.modeGen++,en(this)}),removeOverlay:Fn(function(e){for(var t=this.state.overlays,r=0;r<t.length;++r){var n=t[r].modeSpec;if(n==e||"string"==typeof e&&n.name==e)return t.splice(r,1),this.state.modeGen++,void en(this)}}),indentLine:Fn(function(e,t,r){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),tt(this.doc,e)&&fa(this,e,t,r)}),indentSelection:Fn(function(e){for(var t=this.doc.sel.ranges,r=-1,n=0;n<t.length;n++){var i=t[n];if(i.empty())i.head.line>r&&(fa(this,i.head.line,e,!0),r=i.head.line,n==this.doc.sel.primIndex&&wn(this));else{for(var o=i.from(),a=i.to(),i=Math.max(r,o.line),r=Math.min(this.lastLine(),a.line-(a.ch?0:1))+1,l=i;l<r;++l)fa(this,l,e);i=this.doc.sel.ranges;0==o.ch&&t.length==i.length&&0<i[n].from().ch&&zi(this.doc,n,new oi(o,i[n].to()),j)}}}),getTokenAt:function(e,t){return xt(this,e,t)},getLineTokens:function(e,t){return xt(this,nt(e),t,!0)},getTokenTypeAt:function(e){e=ut(this.doc,e);var t,r=gt(this,Xe(this.doc,e.line)),n=0,i=(r.length-1)/2,o=e.ch;if(0==o)t=r[2];else for(;;){var a=n+i>>1;if((a?r[2*a-1]:0)>=o)i=a;else{if(!(r[2*a+1]<o)){t=r[2*a+2];break}n=1+a}}e=t?t.indexOf("overlay "):-1;return e<0?t:0==e?null:t.slice(0,e-1)},getModeAt:function(e){var t=this.doc.mode;return t.innerMode?Na.innerMode(t,this.getTokenAt(e).state).mode:t},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var r=[];if(!Aa.hasOwnProperty(t))return r;var n=Aa[t],i=this.getModeAt(e);if("string"==typeof i[t])n[i[t]]&&r.push(n[i[t]]);else if(i[t])for(var o=0;o<i[t].length;o++){var a=n[i[t][o]];a&&r.push(a)}else i.helperType&&n[i.helperType]?r.push(n[i.helperType]):n[i.name]&&r.push(n[i.name]);for(var l=0;l<n._global.length;l++){var s=n._global[l];s.pred(i,this)&&-1==I(r,s.val)&&r.push(s.val)}return r},getStateAfter:function(e,t){var r=this.doc;return mt(this,(e=ct(r,null==e?r.first+r.size-1:e))+1,t).state},cursorCoords:function(e,t){var r=this.doc.sel.primary(),r=null==e?r.head:"object"==typeof e?ut(this.doc,e):e?r.from():r.to();return Rr(this,r,t||"page")},charCoords:function(e,t){return Ir(this,ut(this.doc,e),t||"page")},coordsChar:function(e,t){return qr(this,(e=Fr(this,e,t||"page")).left,e.top)},lineAtHeight:function(e,t){return e=Fr(this,{top:e,left:0},t||"page").top,et(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t,r){var n,i=!1,e="number"==typeof e?(n=this.doc.first+this.doc.size-1,e<this.doc.first?e=this.doc.first:n<e&&(e=n,i=!0),Xe(this.doc,e)):e;return Hr(this,e,{top:0,left:0},t||"page",r||i).top+(i?this.doc.height-Kt(e):0)},defaultTextHeight:function(){return Gr(this.display)},defaultCharWidth:function(){return $r(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,r,n,i){var o,a,l=this.display,s=(e=Rr(this,ut(this.doc,e))).bottom,c=e.left;t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),l.sizer.appendChild(t),"over"==n?s=e.top:"above"!=n&&"near"!=n||(o=Math.max(l.wrapper.clientHeight,this.doc.height),a=Math.max(l.sizer.clientWidth,l.lineSpace.clientWidth),("above"==n||e.bottom+t.offsetHeight>o)&&e.top>t.offsetHeight?s=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=o&&(s=e.bottom),c+t.offsetWidth>a&&(c=a-t.offsetWidth)),t.style.top=s+"px",t.style.left=t.style.right="","right"==i?(c=l.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?c=0:"middle"==i&&(c=(l.sizer.clientWidth-t.offsetWidth)/2),t.style.left=c+"px"),r&&(r=this,t={left:c,top:s,right:c+t.offsetWidth,bottom:s+t.offsetHeight},null!=(t=yn(r,t)).scrollTop&&Sn(r,t.scrollTop),null!=t.scrollLeft&&Tn(r,t.scrollLeft))},triggerOnKeyDown:Fn($o),triggerOnKeyPress:Fn(Xo),triggerOnKeyUp:_o,triggerOnMouseDown:Fn(Jo),execCommand:function(e){if(Io.hasOwnProperty(e))return Io[e].call(null,this)},triggerElectric:Fn(function(e){va(this,e)}),findPosH:function(e,t,r,n){var i=1;t<0&&(i=-1,t=-t);for(var o=ut(this.doc,e),a=0;a<t&&!(o=xa(this.doc,o,i,r,n)).hitSide;++a);return o},moveH:Fn(function(t,r){var n=this;this.extendSelectionsBy(function(e){return n.display.shift||n.doc.extend||e.empty()?xa(n.doc,e.head,t,r,n.options.rtlMoveVisually):t<0?e.from():e.to()},K)}),deleteH:Fn(function(r,n){var e=this.doc.sel,i=this.doc;e.somethingSelected()?i.replaceSelection("",null,"+delete"):Wo(this,function(e){var t=xa(i,e.head,r,n,!1);return r<0?{from:t,to:e.head}:{from:e.head,to:t}})}),findPosV:function(e,t,r,n){var i=1,o=n;t<0&&(i=-1,t=-t);for(var a=ut(this.doc,e),l=0;l<t;++l){var s=Rr(this,a,"div");if(null==o?o=s.left:s.left=o,(a=ka(this,s,i,r)).hitSide)break}return a},moveV:Fn(function(n,i){var o=this,a=this.doc,l=[],s=!this.display.shift&&!a.extend&&a.sel.somethingSelected();if(a.extendSelectionsBy(function(e){if(s)return n<0?e.from():e.to();var t=Rr(o,e.head,"div");null!=e.goalColumn&&(t.left=e.goalColumn),l.push(t.left);var r=ka(o,t,n,i);return"page"==i&&e==a.sel.primary()&&bn(o,Ir(o,r,"div").top-t.top),r},K),l.length)for(var e=0;e<a.sel.ranges.length;e++)a.sel.ranges[e].goalColumn=l[e]}),findWordAt:function(e){var t=Xe(this.doc,e.line).text,r=e.ch,n=e.ch;if(t){var i=this.getHelper(e,"wordChars");"before"!=e.sticky&&n!=t.length||!r?++n:--r;for(var o=t.charAt(r),a=J(o,i)?function(e){return J(e,i)}:/\s/.test(o)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!J(e)};0<r&&a(t.charAt(r-1));)--r;for(;n<t.length&&a(t.charAt(n));)++n}return new oi(nt(e.line,r),nt(e.line,n))},toggleOverwrite:function(e){null!=e&&e==this.state.overwrite||(((this.state.overwrite=!this.state.overwrite)?D:S)(this.display.cursorDiv,"CodeMirror-overwrite"),xe(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==A()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:Fn(function(e,t){xn(this,e,t)}),getScrollInfo:function(){var e=this.display.scroller;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-br(this)-this.display.barHeight,width:e.scrollWidth-br(this)-this.display.barWidth,clientHeight:xr(this),clientWidth:wr(this)}},scrollIntoView:Fn(function(e,t){var r;null==e?(e={from:this.doc.sel.primary().head,to:null},null==t&&(t=this.options.cursorScrollMargin)):"number"==typeof e?e={from:nt(e,0),to:null}:null==e.from&&(e={from:e,to:null}),e.to||(e.to=e.from),e.margin=t||0,null!=e.from.line?(r=e,kn(t=this),t.curOp.scrollToPos=r):Cn(this,e.from,e.to,e.margin)}),setSize:Fn(function(e,t){function r(e){return"number"==typeof e||/^\d+$/.test(String(e))?e+"px":e}var n=this;null!=e&&(this.display.wrapper.style.width=r(e)),null!=t&&(this.display.wrapper.style.height=r(t)),this.options.lineWrapping&&Dr(this);var i=this.display.viewFrom;this.doc.iter(i,this.display.viewTo,function(e){if(e.widgets)for(var t=0;t<e.widgets.length;t++)if(e.widgets[t].noHScroll){tn(n,i,"widget");break}++i}),this.curOp.forceUpdate=!0,xe(this,"refresh",this)}),operation:function(e){return En(this,e)},startOperation:function(){return Wn(this)},endOperation:function(){return Pn(this)},refresh:Fn(function(){var e=this.display.cachedTextHeight;en(this),this.curOp.forceUpdate=!0,zr(this),xn(this,this.doc.scrollLeft,this.doc.scrollTop),Un(this.display),(null==e||.5<Math.abs(e-Gr(this.display))||this.options.lineWrapping)&&Zr(this),xe(this,"refresh",this)}),swapDoc:Fn(function(e){var t=this.doc;return t.cm=null,this.state.selectingText&&this.state.selectingText(),vi(this,e),zr(this),this.display.input.reset(),xn(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,or(this,"swapDoc",this,t),t}),phrase:function(e){var t=this.options.phrases;return t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:e},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}},Le(Na),Na.registerHelper=function(e,t,r){Aa.hasOwnProperty(e)||(Aa[e]=Na[e]={_global:[]}),Aa[e][t]=r},Na.registerGlobalHelper=function(e,t,r,n){Na.registerHelper(e,t,n),Aa[e]._global.push({pred:r,val:n})};var za,Wa,Pa="iter insert remove copy getEditor constructor".split(" ");for(za in ho.prototype)ho.prototype.hasOwnProperty(za)&&I(Pa,za)<0&&(ua.prototype[za]=function(e){return function(){return e.apply(this.doc,arguments)}}(ho.prototype[za]));return Le(ho),ua.inputStyles={textarea:n,contenteditable:e},ua.defineMode=function(e){ua.defaults.mode||"null"==e||(ua.defaults.mode=e),function(e,t){2<arguments.length&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Re[e]=t}.apply(this,arguments)},ua.defineMIME=function(e,t){Be[e]=t},ua.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),ua.defineMIME("text/plain","null"),ua.defineExtension=function(e,t){ua.prototype[e]=t},ua.defineDocExtension=function(e,t){ho.prototype[e]=t},ua.fromTextArea=function(t,r){var e;function n(){t.value=l.getValue()}if(r=r?E(r):{},r.value=t.value,!r.tabindex&&t.tabIndex&&(r.tabindex=t.tabIndex),!r.placeholder&&t.placeholder&&(r.placeholder=t.placeholder),null==r.autofocus&&(e=A(),r.autofocus=e==t||null!=t.getAttribute("autofocus")&&e==document.body),t.form&&(ye(t.form,"submit",n),!r.leaveSubmitMethodAlone)){var i=t.form,o=i.submit;try{var a=i.submit=function(){n(),i.submit=o,i.submit(),i.submit=a}}catch(e){}}r.finishInit=function(e){e.save=n,e.getTextArea=function(){return t},e.toTextArea=function(){e.toTextArea=isNaN,n(),t.parentNode.removeChild(e.getWrapperElement()),t.style.display="",t.form&&(we(t.form,"submit",n),r.leaveSubmitMethodAlone||"function"!=typeof t.form.submit||(t.form.submit=o))}},t.style.display="none";var l=ua(function(e){return t.parentNode.insertBefore(e,t.nextSibling)},r);return l},(Wa=ua).off=we,Wa.on=ye,Wa.wheelEventPixels=ri,Wa.Doc=ho,Wa.splitLines=Ee,Wa.countColumn=H,Wa.findColumn=V,Wa.isWordChar=Q,Wa.Pass=B,Wa.signal=xe,Wa.Line=Gt,Wa.changeEnd=si,Wa.scrollbarModel=An,Wa.Pos=nt,Wa.cmpPos=it,Wa.modes=Re,Wa.mimeModes=Be,Wa.resolveMode=je,Wa.getMode=qe,Wa.modeExtensions=Ke,Wa.extendMode=Ve,Wa.copyState=Ue,Wa.startState=$e,Wa.innerMode=Ge,Wa.commands=Io,Wa.keyMap=Lo,Wa.keyName=Do,Wa.isModifierKey=Oo,Wa.lookupKey=No,Wa.normalizeKeyMap=Mo,Wa.StringStream=_e,Wa.SharedTextMarker=so,Wa.TextMarker=ao,Wa.LineWidget=no,Wa.e_preventDefault=Te,Wa.e_stopPropagation=Me,Wa.e_stop=Oe,Wa.addClass=D,Wa.contains=O,Wa.rmClass=S,Wa.keyNames=xo,ua.version="5.60.0",ua}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(n){var d=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||document.documentMode<8),m=n.Pos,v={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<","<":">>",">":"<<"};function y(e){return e&&e.bracketRegex||/[(){}[\]]/}function f(e,t,r){var n=e.getLineHandle(t.line),i=t.ch-1,o=r&&r.afterCursor;null==o&&(o=/(^| )cm-fat-cursor($| )/.test(e.getWrapperElement().className));var a=y(r),o=!o&&0<=i&&a.test(n.text.charAt(i))&&v[n.text.charAt(i)]||a.test(n.text.charAt(i+1))&&v[n.text.charAt(++i)];if(!o)return null;a=">"==o.charAt(1)?1:-1;if(r&&r.strict&&0<a!=(i==t.ch))return null;n=e.getTokenTypeAt(m(t.line,i+1)),r=l(e,m(t.line,i+(0<a?1:0)),a,n,r);return null==r?null:{from:m(t.line,i),to:r&&r.pos,match:r&&r.ch==o.charAt(0),forward:0<a}}function l(e,t,r,n,i){for(var o=i&&i.maxScanLineLength||1e4,a=i&&i.maxScanLines||1e3,l=[],s=y(i),c=0<r?Math.min(t.line+a,e.lastLine()+1):Math.max(e.firstLine()-1,t.line-a),u=t.line;u!=c;u+=r){var d=e.getLine(u);if(d){var f=0<r?0:d.length-1,h=0<r?d.length:-1;if(!(d.length>o))for(u==t.line&&(f=t.ch-(r<0?1:0));f!=h;f+=r){var p=d.charAt(f);if(s.test(p)&&(void 0===n||(e.getTokenTypeAt(m(u,f+1))||"")==(n||""))){var g=v[p];if(g&&">"==g.charAt(1)==0<r)l.push(p);else{if(!l.length)return{pos:m(u,f),ch:p};l.pop()}}}}}return u-r!=(0<r?e.lastLine():e.firstLine())&&null}function t(e,t,r){for(var n=e.state.matchBrackets.maxHighlightLineLength||1e3,i=r&&r.highlightNonMatching,o=[],a=e.listSelections(),l=0;l<a.length;l++){var s,c=a[l].empty()&&f(e,a[l].head,r);c&&(c.match||!1!==i)&&e.getLine(c.from.line).length<=n&&(s=c.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket",o.push(e.markText(c.from,m(c.from.line,c.from.ch+1),{className:s})),c.to&&e.getLine(c.to.line).length<=n&&o.push(e.markText(c.to,m(c.to.line,c.to.ch+1),{className:s})))}if(o.length){d&&e.state.focused&&e.focus();function u(){e.operation(function(){for(var e=0;e<o.length;e++)o[e].clear()})}if(!t)return u;setTimeout(u,800)}}function i(e){e.operation(function(){e.state.matchBrackets.currentlyHighlighted&&(e.state.matchBrackets.currentlyHighlighted(),e.state.matchBrackets.currentlyHighlighted=null),e.state.matchBrackets.currentlyHighlighted=t(e,!1,e.state.matchBrackets)})}function o(e){e.state.matchBrackets&&e.state.matchBrackets.currentlyHighlighted&&(e.state.matchBrackets.currentlyHighlighted(),e.state.matchBrackets.currentlyHighlighted=null)}n.defineOption("matchBrackets",!1,function(e,t,r){r&&r!=n.Init&&(e.off("cursorActivity",i),e.off("focus",i),e.off("blur",o),o(e)),t&&(e.state.matchBrackets="object"==typeof t?t:{},e.on("cursorActivity",i),e.on("focus",i),e.on("blur",o))}),n.defineExtension("matchBrackets",function(){t(this,!0)}),n.defineExtension("findMatchingBracket",function(e,t,r){return!r&&"boolean"!=typeof t||(t=r?(r.strict=t,r):t?{strict:!0}:null),f(this,e,t)}),n.defineExtension("scanForBracket",function(e,t,r,n){return l(this,e,t,r,n)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(C){"use strict";var S={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},L={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};C.defineMode("xml",function(e,t){var r,o,a,l=e.indentUnit,s={},n=t.htmlMode?S:L;for(r in n)s[r]=n[r];for(r in t)s[r]=t[r];function c(t,r){function e(e){return(r.tokenize=e)(t,r)}var n=t.next();if("<"==n)return t.eat("!")?t.eat("[")?t.match("CDATA[")?e(i("atom","]]>")):null:t.match("--")?e(i("comment","--\x3e")):t.match("DOCTYPE",!0,!0)?(t.eatWhile(/[\w\._\-]/),e(function n(i){return function(e,t){for(var r;null!=(r=e.next());){if("<"==r)return t.tokenize=n(i+1),t.tokenize(e,t);if(">"==r){if(1!=i)return t.tokenize=n(i-1),t.tokenize(e,t);t.tokenize=c;break}}return"meta"}}(1))):null:t.eat("?")?(t.eatWhile(/[\w\._\-]/),r.tokenize=i("meta","?>"),"meta"):(o=t.eat("/")?"closeTag":"openTag",r.tokenize=u,"tag bracket");if("&"!=n)return t.eatWhile(/[^&<]/),null;n=t.eat("#")?t.eat("x")?t.eatWhile(/[a-fA-F\d]/)&&t.eat(";"):t.eatWhile(/[\d]/)&&t.eat(";"):t.eatWhile(/[\w\.\-:]/)&&t.eat(";");return n?"atom":"error"}function u(e,t){var r=e.next();if(">"==r||"/"==r&&e.eat(">"))return t.tokenize=c,o=">"==r?"endTag":"selfcloseTag","tag bracket";if("="==r)return o="equals",null;if("<"!=r)return/[\'\"]/.test(r)?(t.tokenize=(n=r,i.isInAttribute=!0,i),t.stringStartCol=e.column(),t.tokenize(e,t)):(e.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word");t.tokenize=c,t.state=p,t.tagName=t.tagStart=null;var n,t=t.tokenize(e,t);return t?t+" tag error":"tag error";function i(e,t){for(;!e.eol();)if(e.next()==n){t.tokenize=u;break}return"string"}}function i(r,n){return function(e,t){for(;!e.eol();){if(e.match(n)){t.tokenize=c;break}e.next()}return r}}function d(e,t,r){this.prev=e.context,this.tagName=t||"",this.indent=e.indented,this.startOfLine=r,(s.doNotIndent.hasOwnProperty(t)||e.context&&e.context.noIndent)&&(this.noIndent=!0)}function f(e){e.context&&(e.context=e.context.prev)}function h(e,t){for(var r;;){if(!e.context)return;if(r=e.context.tagName,!s.contextGrabbers.hasOwnProperty(r)||!s.contextGrabbers[r].hasOwnProperty(t))return;f(e)}}function p(e,t,r){return"openTag"==e?(r.tagStart=t.column(),g):"closeTag"==e?m:p}function g(e,t,r){return"word"==e?(r.tagName=t.current(),a="tag",b):s.allowMissingTagName&&"endTag"==e?(a="tag bracket",b(e,0,r)):(a="error",g)}function m(e,t,r){if("word"!=e)return s.allowMissingTagName&&"endTag"==e?(a="tag bracket",v(e,0,r)):(a="error",y);t=t.current();return r.context&&r.context.tagName!=t&&s.implicitlyClosed.hasOwnProperty(r.context.tagName)&&f(r),r.context&&r.context.tagName==t||!1===s.matchClosing?(a="tag",v):(a="tag error",y)}function v(e,t,r){return"endTag"!=e?(a="error",v):(f(r),p)}function y(e,t,r){return a="error",v(e,0,r)}function b(e,t,r){if("word"==e)return a="attribute",w;if("endTag"!=e&&"selfcloseTag"!=e)return a="error",b;var n=r.tagName,i=r.tagStart;return r.tagName=r.tagStart=null,"selfcloseTag"==e||s.autoSelfClosers.hasOwnProperty(n)?h(r,n):(h(r,n),r.context=new d(r,n,i==r.indented)),p}function w(e,t,r){return"equals"==e?x:(s.allowMissing||(a="error"),b(e,0,r))}function x(e,t,r){return"string"==e?k:"word"==e&&s.allowUnquoted?(a="string",b):(a="error",b(e,0,r))}function k(e,t,r){return"string"==e?k:b(e,0,r)}return c.isInText=!0,{startState:function(e){var t={tokenize:c,state:p,indented:e||0,tagName:null,tagStart:null,context:null};return null!=e&&(t.baseIndent=e),t},token:function(e,t){if(!t.tagName&&e.sol()&&(t.indented=e.indentation()),e.eatSpace())return null;o=null;var r=t.tokenize(e,t);return(r||o)&&"comment"!=r&&(a=null,t.state=t.state(o||r,e,t),a&&(r="error"==a?r+" error":a)),r},indent:function(e,t,r){var n=e.context;if(e.tokenize.isInAttribute)return e.tagStart==e.indented?e.stringStartCol+1:e.indented+l;if(n&&n.noIndent)return C.Pass;if(e.tokenize!=u&&e.tokenize!=c)return r?r.match(/^(\s*)/)[0].length:0;if(e.tagName)return!1!==s.multilineTagIndentPastTag?e.tagStart+e.tagName.length+2:e.tagStart+l*(s.multilineTagIndentFactor||1);if(s.alignCDATA&&/<!\[CDATA\[/.test(t))return 0;var i=t&&/^<(\/)?([\w_:\.-]*)/.exec(t);if(i&&i[1])for(;n;){if(n.tagName==i[2]){n=n.prev;break}if(!s.implicitlyClosed.hasOwnProperty(n.tagName))break;n=n.prev}else if(i)for(;n;){var o=s.contextGrabbers[n.tagName];if(!o||!o.hasOwnProperty(i[2]))break;n=n.prev}for(;n&&n.prev&&!n.startOfLine;)n=n.prev;return n?n.indent+l:e.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"\x3c!--",blockCommentEnd:"--\x3e",configuration:s.htmlMode?"html":"xml",helperType:s.htmlMode?"html":"xml",skipAttribute:function(e){e.state==x&&(e.state=b)},xmlCurrentTag:function(e){return e.tagName?{name:e.tagName,close:"closeTag"==e.type}:null},xmlCurrentContext:function(e){for(var t=[],r=e.context;r;r=r.prev)t.push(r.tagName);return t.reverse()}}}),C.defineMIME("text/xml","xml"),C.defineMIME("application/xml","xml"),C.mimeModes.hasOwnProperty("text/html")||C.defineMIME("text/html",{name:"xml",htmlMode:!0})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(et){"use strict";et.defineMode("javascript",function(e,u){var t,r,n,i,d=e.indentUnit,f=u.statementIndent,o=u.jsonld,a=u.json||o,c=u.typescript,h=u.wordCharacters||/[\w$\xa1-\uffff]/,l=(t=s("keyword a"),r=s("keyword b"),n=s("keyword c"),i=s("keyword d"),e=s("operator"),{if:s("if"),while:t,with:t,else:r,do:r,try:r,finally:r,return:i,break:i,continue:i,new:s("new"),delete:n,void:n,throw:n,debugger:s("debugger"),var:s("var"),const:s("var"),let:s("var"),function:s("function"),catch:s("catch"),for:s("for"),switch:s("switch"),case:s("case"),default:s("default"),in:e,typeof:e,instanceof:e,true:e={type:"atom",style:"atom"},false:e,null:e,undefined:e,NaN:e,Infinity:e,this:s("this"),class:s("class"),super:s("atom"),yield:n,export:s("export"),import:s("import"),extends:n,await:n});function s(e){return{type:e,style:"keyword"}}var p,g,m=/[+\-*&%=<>!?|~^@]/,v=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;function y(e,t,r){return p=e,g=r,t}function b(e,t){var i,r=e.next();if('"'==r||"'"==r)return t.tokenize=(i=r,function(e,t){var r,n=!1;if(o&&"@"==e.peek()&&e.match(v))return t.tokenize=b,y("jsonld-keyword","meta");for(;null!=(r=e.next())&&(r!=i||n);)n=!n&&"\\"==r;return n||(t.tokenize=b),y("string","string")}),t.tokenize(e,t);if("."==r&&e.match(/^\d[\d_]*(?:[eE][+\-]?[\d_]+)?/))return y("number","number");if("."==r&&e.match(".."))return y("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(r))return y(r);if("="==r&&e.eat(">"))return y("=>","operator");if("0"==r&&e.match(/^(?:x[\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/))return y("number","number");if(/\d/.test(r))return e.match(/^[\d_]*(?:n|(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?/),y("number","number");if("/"==r)return e.eat("*")?(t.tokenize=w)(e,t):e.eat("/")?(e.skipToEnd(),y("comment","comment")):Je(e,t,1)?(function(e){for(var t,r=!1,n=!1;null!=(t=e.next());){if(!r){if("/"==t&&!n)return;"["==t?n=!0:n&&"]"==t&&(n=!1)}r=!r&&"\\"==t}}(e),e.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/),y("regexp","string-2")):(e.eat("="),y("operator","operator",e.current()));if("`"==r)return(t.tokenize=x)(e,t);if("#"==r&&"!"==e.peek())return e.skipToEnd(),y("meta","meta");if("#"==r&&e.eatWhile(h))return y("variable","property");if("<"==r&&e.match("!--")||"-"==r&&e.match("->")&&!/\S/.test(e.string.slice(0,e.start)))return e.skipToEnd(),y("comment","comment");if(m.test(r))return">"==r&&t.lexical&&">"==t.lexical.type||(e.eat("=")?"!"!=r&&"="!=r||e.eat("="):/[<>*+\-|&?]/.test(r)&&(e.eat(r),">"==r&&e.eat(r))),"?"==r&&e.eat(".")?y("."):y("operator","operator",e.current());if(h.test(r)){e.eatWhile(h);r=e.current();if("."!=t.lastType){if(l.propertyIsEnumerable(r)){t=l[r];return y(t.type,t.style,r)}if("async"==r&&e.match(/^(\s|\/\*([^*]|\*(?!\/))*?\*\/)*[\[\(\w]/,!1))return y("async","keyword",r)}return y("variable","variable",r)}}function w(e,t){for(var r,n=!1;r=e.next();){if("/"==r&&n){t.tokenize=b;break}n="*"==r}return y("comment","comment")}function x(e,t){for(var r,n=!1;null!=(r=e.next());){if(!n&&("`"==r||"$"==r&&e.eat("{"))){t.tokenize=b;break}n=!n&&"\\"==r}return y("quasi","string-2",e.current())}var k="([{}])";function C(e,t){t.fatArrowAt&&(t.fatArrowAt=null);var r,n=e.string.indexOf("=>",e.start);if(!(n<0)){!c||(r=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(e.string.slice(e.start,n)))&&(n=r.index);for(var i=0,o=!1,a=n-1;0<=a;--a){var l=e.string.charAt(a),s=k.indexOf(l);if(0<=s&&s<3){if(!i){++a;break}if(0==--i){"("==l&&(o=!0);break}}else if(3<=s&&s<6)++i;else if(h.test(l))o=!0;else if(/["'\/`]/.test(l))for(;;--a){if(0==a)return;if(e.string.charAt(a-1)==l&&"\\"!=e.string.charAt(a-2)){a--;break}}else if(o&&!i){++a;break}}o&&!i&&(t.fatArrowAt=a)}}var S={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,import:!0,"jsonld-keyword":!0};function L(e,t,r,n,i,o){this.indented=e,this.column=t,this.type=r,this.prev=i,this.info=o,null!=n&&(this.align=n)}function T(e,t,r,n,i){var o=e.cc;for(M.state=e,M.stream=i,M.marked=null,M.cc=o,M.style=t,e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);;)if((o.length?o.pop():a?V:q)(r,n)){for(;o.length&&o[o.length-1].lex;)o.pop()();return M.marked?M.marked:"variable"==r&&function(e,t){for(var r=e.localVars;r;r=r.next)if(r.name==t)return 1;for(var n=e.context;n;n=n.prev)for(r=n.vars;r;r=r.next)if(r.name==t)return 1}(e,n)?"variable-2":t}}var M={state:null,column:null,marked:null,cc:null};function N(){for(var e=arguments.length-1;0<=e;e--)M.cc.push(arguments[e])}function O(){return N.apply(null,arguments),!0}function A(e,t){for(var r=t;r;r=r.next)if(r.name==e)return 1}function D(e){var t=M.state;if(M.marked="def",t.context)if("var"==t.lexical.info&&t.context&&t.context.block){var r=function e(t,r){{if(r){if(r.block){var n=e(t,r.prev);return n?n==r.prev?r:new W(n,r.vars,!0):null}return A(t,r.vars)?r:new W(r.prev,new P(t,r.vars),!1)}return null}}(e,t.context);if(null!=r)return void(t.context=r)}else if(!A(e,t.localVars))return void(t.localVars=new P(e,t.localVars));u.globalVars&&!A(e,t.globalVars)&&(t.globalVars=new P(e,t.globalVars))}function z(e){return"public"==e||"private"==e||"protected"==e||"abstract"==e||"readonly"==e}function W(e,t,r){this.prev=e,this.vars=t,this.block=r}function P(e,t){this.name=e,this.next=t}var E=new P("this",new P("arguments",null));function H(){M.state.context=new W(M.state.context,M.state.localVars,!1),M.state.localVars=E}function F(){M.state.context=new W(M.state.context,M.state.localVars,!0),M.state.localVars=null}function I(){M.state.localVars=M.state.context.vars,M.state.context=M.state.context.prev}function R(n,i){function e(){var e=M.state,t=e.indented;if("stat"==e.lexical.type)t=e.lexical.indented;else for(var r=e.lexical;r&&")"==r.type&&r.align;r=r.prev)t=r.indented;e.lexical=new L(t,M.stream.column(),n,null,e.lexical,i)}return e.lex=!0,e}function B(){var e=M.state;e.lexical.prev&&(")"==e.lexical.type&&(e.indented=e.lexical.indented),e.lexical=e.lexical.prev)}function j(r){return function e(t){return t==r?O():";"==r||"}"==t||")"==t||"]"==t?N():O(e)}}function q(e,t){return"var"==e?O(R("vardef",t),Se,j(";"),B):"keyword a"==e?O(R("form"),G,q,B):"keyword b"==e?O(R("form"),q,B):"keyword d"==e?M.stream.match(/^\s*$/,!1)?O():O(R("stat"),_,j(";"),B):"debugger"==e?O(j(";")):"{"==e?O(R("}"),F,ue,B,I):";"==e?O():"if"==e?("else"==M.state.lexical.info&&M.state.cc[M.state.cc.length-1]==B&&M.state.cc.pop()(),O(R("form"),G,q,B,Ae)):"function"==e?O(Pe):"for"==e?O(R("form"),De,q,B):"class"==e||c&&"interface"==t?(M.marked="keyword",O(R("form","class"==e?e:t),Re,B)):"variable"==e?c&&"declare"==t?(M.marked="keyword",O(q)):c&&("module"==t||"enum"==t||"type"==t)&&M.stream.match(/^\s*\w/,!1)?(M.marked="keyword","enum"==t?O(Ze):"type"==t?O(He,j("operator"),ge,j(";")):O(R("form"),Le,j("{"),R("}"),ue,B,B)):c&&"namespace"==t?(M.marked="keyword",O(R("form"),V,q,B)):c&&"abstract"==t?(M.marked="keyword",O(q)):O(R("stat"),ne):"switch"==e?O(R("form"),G,j("{"),R("}","switch"),F,ue,B,B,I):"case"==e?O(V,j(":")):"default"==e?O(j(":")):"catch"==e?O(R("form"),H,K,q,B,I):"export"==e?O(R("stat"),Ke,B):"import"==e?O(R("stat"),Ue,B):"async"==e?O(q):"@"==t?O(V,q):N(R("stat"),V,j(";"),B)}function K(e){if("("==e)return O(Fe,j(")"))}function V(e,t){return $(e,t,!1)}function U(e,t){return $(e,t,!0)}function G(e){return"("!=e?N():O(R(")"),_,j(")"),B)}function $(e,t,r){if(M.state.fatArrowAt==M.stream.start){var n=r?ee:J;if("("==e)return O(H,R(")"),se(Fe,")"),B,j("=>"),n,I);if("variable"==e)return N(H,Le,j("=>"),n,I)}var i,n=r?Y:X;return S.hasOwnProperty(e)?O(n):"function"==e?O(Pe,n):"class"==e||c&&"interface"==t?(M.marked="keyword",O(R("form"),Ie,B)):"keyword c"==e||"async"==e?O(r?U:V):"("==e?O(R(")"),_,j(")"),B,n):"operator"==e||"spread"==e?O(r?U:V):"["==e?O(R("]"),Ye,B,n):"{"==e?ce(oe,"}",null,n):"quasi"==e?N(Z,n):"new"==e?O((i=r,function(e){return"."==e?O(i?re:te):"variable"==e&&c?O(xe,i?Y:X):N(i?U:V)})):O()}function _(e){return e.match(/[;\}\)\],]/)?N():N(V)}function X(e,t){return","==e?O(_):Y(e,t,!1)}function Y(e,t,r){var n=0==r?X:Y,i=0==r?V:U;return"=>"==e?O(H,r?ee:J,I):"operator"==e?/\+\+|--/.test(t)||c&&"!"==t?O(n):c&&"<"==t&&M.stream.match(/^([^<>]|<[^<>]*>)*>\s*\(/,!1)?O(R(">"),se(ge,">"),B,n):"?"==t?O(V,j(":"),i):O(i):"quasi"==e?N(Z,n):";"!=e?"("==e?ce(U,")","call",n):"."==e?O(ie,n):"["==e?O(R("]"),_,j("]"),B,n):c&&"as"==t?(M.marked="keyword",O(ge,n)):"regexp"==e?(M.state.lastType=M.marked="operator",M.stream.backUp(M.stream.pos-M.stream.start-1),O(i)):void 0:void 0}function Z(e,t){return"quasi"!=e?N():"${"!=t.slice(t.length-2)?O(Z):O(V,Q)}function Q(e){if("}"==e)return M.marked="string-2",M.state.tokenize=x,O(Z)}function J(e){return C(M.stream,M.state),N("{"==e?q:V)}function ee(e){return C(M.stream,M.state),N("{"==e?q:U)}function te(e,t){if("target"==t)return M.marked="keyword",O(X)}function re(e,t){if("target"==t)return M.marked="keyword",O(Y)}function ne(e){return":"==e?O(B,q):N(X,j(";"),B)}function ie(e){if("variable"==e)return M.marked="property",O()}function oe(e,t){return"async"==e?(M.marked="property",O(oe)):"variable"!=e&&"keyword"!=M.style?"number"==e||"string"==e?(M.marked=o?"property":M.style+" property",O(le)):"jsonld-keyword"==e?O(le):c&&z(t)?(M.marked="keyword",O(oe)):"["==e?O(V,de,j("]"),le):"spread"==e?O(U,le):"*"==t?(M.marked="keyword",O(oe)):":"==e?N(le):void 0:(M.marked="property","get"==t||"set"==t?O(ae):(c&&M.state.fatArrowAt==M.stream.start&&(r=M.stream.match(/^\s*:\s*/,!1))&&(M.state.fatArrowAt=M.stream.pos+r[0].length),O(le)));var r}function ae(e){return"variable"!=e?N(le):(M.marked="property",O(Pe))}function le(e){return":"==e?O(U):"("==e?N(Pe):void 0}function se(n,i,o){function a(e,t){if(o?-1<o.indexOf(e):","==e){var r=M.state.lexical;return"call"==r.info&&(r.pos=(r.pos||0)+1),O(function(e,t){return e==i||t==i?N():N(n)},a)}return e==i||t==i?O():o&&-1<o.indexOf(";")?N(n):O(j(i))}return function(e,t){return e==i||t==i?O():N(n,a)}}function ce(e,t,r){for(var n=3;n<arguments.length;n++)M.cc.push(arguments[n]);return O(R(t,r),se(e,t),B)}function ue(e){return"}"==e?O():N(q,ue)}function de(e,t){if(c)return":"==e?O(ge):"?"==t?O(de):void 0}function fe(e,t){if(c&&(":"==e||"in"==t))return O(ge)}function he(e){if(c&&":"==e)return M.stream.match(/^\s*\w+\s+is\b/,!1)?O(V,pe,ge):O(ge)}function pe(e,t){if("is"==t)return M.marked="keyword",O()}function ge(e,t){return"keyof"==t||"typeof"==t||"infer"==t||"readonly"==t?(M.marked="keyword",O("typeof"==t?U:ge)):"variable"==e||"void"==t?(M.marked="type",O(we)):"|"==t||"&"==t?O(ge):"string"==e||"number"==e||"atom"==e?O(we):"["==e?O(R("]"),se(ge,"]",","),B,we):"{"==e?O(R("}"),ve,B,we):"("==e?O(se(be,")"),me,we):"<"==e?O(se(ge,">"),ge):void 0}function me(e){if("=>"==e)return O(ge)}function ve(e){return e.match(/[\}\)\]]/)?O():","==e||";"==e?O(ve):N(ye,ve)}function ye(e,t){return"variable"==e||"keyword"==M.style?(M.marked="property",O(ye)):"?"==t||"number"==e||"string"==e?O(ye):":"==e?O(ge):"["==e?O(j("variable"),fe,j("]"),ye):"("==e?N(Ee,ye):e.match(/[;\}\)\],]/)?void 0:O()}function be(e,t){return"variable"==e&&M.stream.match(/^\s*[?:]/,!1)||"?"==t?O(be):":"==e?O(ge):"spread"==e?O(be):N(ge)}function we(e,t){return"<"==t?O(R(">"),se(ge,">"),B,we):"|"==t||"."==e||"&"==t?O(ge):"["==e?O(ge,j("]"),we):"extends"==t||"implements"==t?(M.marked="keyword",O(ge)):"?"==t?O(ge,j(":"),ge):void 0}function xe(e,t){if("<"==t)return O(R(">"),se(ge,">"),B,we)}function ke(){return N(ge,Ce)}function Ce(e,t){if("="==t)return O(ge)}function Se(e,t){return"enum"==t?(M.marked="keyword",O(Ze)):N(Le,de,Ne,Oe)}function Le(e,t){return c&&z(t)?(M.marked="keyword",O(Le)):"variable"==e?(D(t),O()):"spread"==e?O(Le):"["==e?ce(Me,"]"):"{"==e?ce(Te,"}"):void 0}function Te(e,t){return"variable"!=e||M.stream.match(/^\s*:/,!1)?("variable"==e&&(M.marked="property"),"spread"==e?O(Le):"}"==e?N():"["==e?O(V,j("]"),j(":"),Te):O(j(":"),Le,Ne)):(D(t),O(Ne))}function Me(){return N(Le,Ne)}function Ne(e,t){if("="==t)return O(U)}function Oe(e){if(","==e)return O(Se)}function Ae(e,t){if("keyword b"==e&&"else"==t)return O(R("form","else"),q,B)}function De(e,t){return"await"==t?O(De):"("==e?O(R(")"),ze,B):void 0}function ze(e){return"var"==e?O(Se,We):("variable"==e?O:N)(We)}function We(e,t){return")"==e?O():";"==e?O(We):"in"==t||"of"==t?(M.marked="keyword",O(V,We)):N(V,We)}function Pe(e,t){return"*"==t?(M.marked="keyword",O(Pe)):"variable"==e?(D(t),O(Pe)):"("==e?O(H,R(")"),se(Fe,")"),B,he,q,I):c&&"<"==t?O(R(">"),se(ke,">"),B,Pe):void 0}function Ee(e,t){return"*"==t?(M.marked="keyword",O(Ee)):"variable"==e?(D(t),O(Ee)):"("==e?O(H,R(")"),se(Fe,")"),B,he,I):c&&"<"==t?O(R(">"),se(ke,">"),B,Ee):void 0}function He(e,t){return"keyword"==e||"variable"==e?(M.marked="type",O(He)):"<"==t?O(R(">"),se(ke,">"),B):void 0}function Fe(e,t){return"@"==t&&O(V,Fe),"spread"==e?O(Fe):c&&z(t)?(M.marked="keyword",O(Fe)):c&&"this"==e?O(de,Ne):N(Le,de,Ne)}function Ie(e,t){return("variable"==e?Re:Be)(e,t)}function Re(e,t){if("variable"==e)return D(t),O(Be)}function Be(e,t){return"<"==t?O(R(">"),se(ke,">"),B,Be):"extends"==t||"implements"==t||c&&","==e?("implements"==t&&(M.marked="keyword"),O(c?ge:V,Be)):"{"==e?O(R("}"),je,B):void 0}function je(e,t){return"async"==e||"variable"==e&&("static"==t||"get"==t||"set"==t||c&&z(t))&&M.stream.match(/^\s+[\w$\xa1-\uffff]/,!1)?(M.marked="keyword",O(je)):"variable"==e||"keyword"==M.style?(M.marked="property",O(qe,je)):"number"==e||"string"==e?O(qe,je):"["==e?O(V,de,j("]"),qe,je):"*"==t?(M.marked="keyword",O(je)):c&&"("==e?N(Ee,je):";"==e||","==e?O(je):"}"==e?O():"@"==t?O(V,je):void 0}function qe(e,t){if("?"==t)return O(qe);if(":"==e)return O(ge,Ne);if("="==t)return O(U);t=M.state.lexical.prev;return N(t&&"interface"==t.info?Ee:Pe)}function Ke(e,t){return"*"==t?(M.marked="keyword",O(Xe,j(";"))):"default"==t?(M.marked="keyword",O(V,j(";"))):"{"==e?O(se(Ve,"}"),Xe,j(";")):N(q)}function Ve(e,t){return"as"==t?(M.marked="keyword",O(j("variable"))):"variable"==e?N(U,Ve):void 0}function Ue(e){return"string"==e?O():"("==e?N(V):"."==e?N(X):N(Ge,$e,Xe)}function Ge(e,t){return"{"==e?ce(Ge,"}"):("variable"==e&&D(t),"*"==t&&(M.marked="keyword"),O(_e))}function $e(e){if(","==e)return O(Ge,$e)}function _e(e,t){if("as"==t)return M.marked="keyword",O(Ge)}function Xe(e,t){if("from"==t)return M.marked="keyword",O(V)}function Ye(e){return"]"==e?O():N(se(U,"]"))}function Ze(){return N(R("form"),Le,j("{"),R("}"),se(Qe,"}"),B,B)}function Qe(){return N(Le,Ne)}function Je(e,t,r){return t.tokenize==b&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(t.lastType)||"quasi"==t.lastType&&/\{\s*$/.test(e.string.slice(0,e.pos-(r||0)))}return B.lex=I.lex=!0,{startState:function(e){e={tokenize:b,lastType:"sof",cc:[],lexical:new L((e||0)-d,0,"block",!1),localVars:u.localVars,context:u.localVars&&new W(null,null,!1),indented:e||0};return u.globalVars&&"object"==typeof u.globalVars&&(e.globalVars=u.globalVars),e},token:function(e,t){if(e.sol()&&(t.lexical.hasOwnProperty("align")||(t.lexical.align=!1),t.indented=e.indentation(),C(e,t)),t.tokenize!=w&&e.eatSpace())return null;var r=t.tokenize(e,t);return"comment"==p?r:(t.lastType="operator"!=p||"++"!=g&&"--"!=g?p:"incdec",T(t,r,p,g,e))},indent:function(e,t){if(e.tokenize==w||e.tokenize==x)return et.Pass;if(e.tokenize!=b)return 0;var r,n=t&&t.charAt(0),i=e.lexical;if(!/^\s*else\b/.test(t))for(var o=e.cc.length-1;0<=o;--o){var a=e.cc[o];if(a==B)i=i.prev;else if(a!=Ae)break}for(;("stat"==i.type||"form"==i.type)&&("}"==n||(r=e.cc[e.cc.length-1])&&(r==X||r==Y)&&!/^[,\.=+\-*:?[\(]/.test(t));)i=i.prev;f&&")"==i.type&&"stat"==i.prev.type&&(i=i.prev);var l,s=i.type,c=n==s;return"vardef"==s?i.indented+("operator"==e.lastType||","==e.lastType?i.info.length+1:0):"form"==s&&"{"==n?i.indented:"form"==s?i.indented+d:"stat"==s?i.indented+(l=t,"operator"==(s=e).lastType||","==s.lastType||m.test(l.charAt(0))||/[,.]/.test(l.charAt(0))?f||d:0):"switch"!=i.info||c||0==u.doubleIndentSwitch?i.align?i.column+(c?0:1):i.indented+(c?0:d):i.indented+(/^(?:case|default)\b/.test(t)?d:2*d)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:a?null:"/*",blockCommentEnd:a?null:"*/",blockCommentContinue:a?null:" * ",lineComment:a?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:a?"json":"javascript",jsonldMode:o,jsonMode:a,expressionAllowed:Je,skipExpression:function(e){var t=e.cc[e.cc.length-1];t!=V&&t!=U||e.cc.pop()}}}),et.registerHelper("wordChars","javascript",/[\w$]/),et.defineMIME("text/javascript","javascript"),et.defineMIME("text/ecmascript","javascript"),et.defineMIME("application/javascript","javascript"),et.defineMIME("application/x-javascript","javascript"),et.defineMIME("application/ecmascript","javascript"),et.defineMIME("application/json",{name:"javascript",json:!0}),et.defineMIME("application/x-json",{name:"javascript",json:!0}),et.defineMIME("application/manifest+json",{name:"javascript",json:!0}),et.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),et.defineMIME("text/typescript",{name:"javascript",typescript:!0}),et.defineMIME("application/typescript",{name:"javascript",typescript:!0})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(D){"use strict";function e(e){for(var t={},r=0;r<e.length;++r)t[e[r].toLowerCase()]=!0;return t}D.defineMode("css",function(e,t){var r=t.inline;t.propertyKeywords||(t=D.resolveMode("text/css"));var o,n,i=e.indentUnit,a=t.tokenHooks,l=t.documentTypes||{},s=t.mediaTypes||{},c=t.mediaFeatures||{},u=t.mediaValueKeywords||{},d=t.propertyKeywords||{},f=t.nonStandardPropertyKeywords||{},h=t.fontProperties||{},p=t.counterDescriptors||{},g=t.colorKeywords||{},m=t.valueKeywords||{},v=t.allowNested,y=t.lineComment,b=!0===t.supportsAtComponent,w=!1!==e.highlightNonStandardPropertyKeywords;function x(e,t){return o=t,e}function k(i){return function(e,t){for(var r,n=!1;null!=(r=e.next());){if(r==i&&!n){")"==i&&e.backUp(1);break}n=!n&&"\\"==r}return r!=i&&(n||")"==i)||(t.tokenize=null),o="string"}}function C(e,t){return e.next(),e.match(/^\s*[\"\')]/,!1)?t.tokenize=null:t.tokenize=k(")"),o="(",null}function S(e,t,r){this.type=e,this.indent=t,this.prev=r}function L(e,t,r,n){return e.context=new S(r,t.indentation()+(!1===n?0:i),e.context),r}function T(e){return e.context.prev&&(e.context=e.context.prev),e.context.type}function M(e,t,r){return A[r.context.type](e,t,r)}function N(e,t,r,n){for(var i=n||1;0<i;i--)r.context=r.context.prev;return M(e,t,r)}function O(e){e=e.current().toLowerCase();n=m.hasOwnProperty(e)?"atom":g.hasOwnProperty(e)?"keyword":"variable"}var A={top:function(e,t,r){if("{"==e)return L(r,t,"block");if("}"==e&&r.context.prev)return T(r);if(b&&/@component/i.test(e))return L(r,t,"atComponentBlock");if(/^@(-moz-)?document$/i.test(e))return L(r,t,"documentTypes");if(/^@(media|supports|(-moz-)?document|import)$/i.test(e))return L(r,t,"atBlock");if(/^@(font-face|counter-style)/i.test(e))return r.stateArg=e,"restricted_atBlock_before";if(/^@(-(moz|ms|o|webkit)-)?keyframes$/i.test(e))return"keyframes";if(e&&"@"==e.charAt(0))return L(r,t,"at");if("hash"==e)n="builtin";else if("word"==e)n="tag";else{if("variable-definition"==e)return"maybeprop";if("interpolation"==e)return L(r,t,"interpolation");if(":"==e)return"pseudo";if(v&&"("==e)return L(r,t,"parens")}return r.context.type},block:function(e,t,r){if("word"!=e)return"meta"==e?"block":v||"hash"!=e&&"qualifier"!=e?A.top(e,t,r):(n="error","block");r=t.current().toLowerCase();return d.hasOwnProperty(r)?(n="property","maybeprop"):f.hasOwnProperty(r)?(n=w?"string-2":"property","maybeprop"):v?(n=t.match(/^\s*:(?:\s|$)/,!1)?"property":"tag","block"):(n+=" error","maybeprop")},maybeprop:function(e,t,r){return":"==e?L(r,t,"prop"):M(e,t,r)},prop:function(e,t,r){if(";"==e)return T(r);if("{"==e&&v)return L(r,t,"propBlock");if("}"==e||"{"==e)return N(e,t,r);if("("==e)return L(r,t,"parens");if("hash"!=e||/^#([0-9a-fA-f]{3,4}|[0-9a-fA-f]{6}|[0-9a-fA-f]{8})$/.test(t.current())){if("word"==e)O(t);else if("interpolation"==e)return L(r,t,"interpolation")}else n+=" error";return"prop"},propBlock:function(e,t,r){return"}"==e?T(r):"word"==e?(n="property","maybeprop"):r.context.type},parens:function(e,t,r){return"{"==e||"}"==e?N(e,t,r):")"==e?T(r):"("==e?L(r,t,"parens"):"interpolation"==e?L(r,t,"interpolation"):("word"==e&&O(t),"parens")},pseudo:function(e,t,r){return"meta"==e?"pseudo":"word"==e?(n="variable-3",r.context.type):M(e,t,r)},documentTypes:function(e,t,r){return"word"==e&&l.hasOwnProperty(t.current())?(n="tag",r.context.type):A.atBlock(e,t,r)},atBlock:function(e,t,r){return"("==e?L(r,t,"atBlock_parens"):"}"==e||";"==e?N(e,t,r):"{"==e?T(r)&&L(r,t,v?"block":"top"):"interpolation"==e?L(r,t,"interpolation"):("word"==e&&(t=t.current().toLowerCase(),n="only"==t||"not"==t||"and"==t||"or"==t?"keyword":s.hasOwnProperty(t)?"attribute":c.hasOwnProperty(t)?"property":u.hasOwnProperty(t)?"keyword":d.hasOwnProperty(t)?"property":f.hasOwnProperty(t)?w?"string-2":"property":m.hasOwnProperty(t)?"atom":g.hasOwnProperty(t)?"keyword":"error"),r.context.type)},atComponentBlock:function(e,t,r){return"}"==e?N(e,t,r):"{"==e?T(r)&&L(r,t,v?"block":"top",!1):("word"==e&&(n="error"),r.context.type)},atBlock_parens:function(e,t,r){return")"==e?T(r):"{"==e||"}"==e?N(e,t,r,2):A.atBlock(e,t,r)},restricted_atBlock_before:function(e,t,r){return"{"==e?L(r,t,"restricted_atBlock"):"word"==e&&"@counter-style"==r.stateArg?(n="variable","restricted_atBlock_before"):M(e,t,r)},restricted_atBlock:function(e,t,r){return"}"==e?(r.stateArg=null,T(r)):"word"==e?(n="@font-face"==r.stateArg&&!h.hasOwnProperty(t.current().toLowerCase())||"@counter-style"==r.stateArg&&!p.hasOwnProperty(t.current().toLowerCase())?"error":"property","maybeprop"):"restricted_atBlock"},keyframes:function(e,t,r){return"word"==e?(n="variable","keyframes"):"{"==e?L(r,t,"top"):M(e,t,r)},at:function(e,t,r){return";"==e?T(r):"{"==e||"}"==e?N(e,t,r):("word"==e?n="tag":"hash"==e&&(n="builtin"),"at")},interpolation:function(e,t,r){return"}"==e?T(r):"{"==e||";"==e?N(e,t,r):("word"==e?n="variable":"variable"!=e&&"("!=e&&")"!=e&&(n="error"),"interpolation")}};return{startState:function(e){return{tokenize:null,state:r?"block":"top",stateArg:null,context:new S(r?"block":"top",e||0,null)}},token:function(e,t){if(!t.tokenize&&e.eatSpace())return null;var r=(t.tokenize||function(e,t){var r=e.next();if(a[r]){var n=a[r](e,t);if(!1!==n)return n}return"@"==r?(e.eatWhile(/[\w\\\-]/),x("def",e.current())):"="==r||("~"==r||"|"==r)&&e.eat("=")?(o="compare",null):'"'==r||"'"==r?(t.tokenize=k(r),t.tokenize(e,t)):"#"==r?(e.eatWhile(/[\w\\\-]/),o="hash","atom"):"!"==r?(e.match(/^\s*\w*/),o="important","keyword"):/\d/.test(r)||"."==r&&e.eat(/\d/)?(e.eatWhile(/[\w.%]/),o="unit","number"):"-"===r?/[\d.]/.test(e.peek())?(e.eatWhile(/[\w.%]/),o="unit","number"):e.match(/^-[\w\\\-]*/)?(e.eatWhile(/[\w\\\-]/),o=e.match(/^\s*:/,!1)?"variable-definition":"variable","variable-2"):e.match(/^\w+-/)?o="meta":void 0:/[,+>*\/]/.test(r)?(o="select-op",null):"."==r&&e.match(/^-?[_a-z][_a-z0-9-]*/i)?o="qualifier":/[:;{}\[\]\(\)]/.test(r)?x(null,r):e.match(/^[\w-.]+(?=\()/)?(/^(url(-prefix)?|domain|regexp)$/i.test(e.current())&&(t.tokenize=C),o="variable","variable callee"):/[\w\\\-]/.test(r)?(e.eatWhile(/[\w\\\-]/),o="word","property"):o=null})(e,t);return r&&"object"==typeof r&&(o=r[1],r=r[0]),n=r,"comment"!=o&&(t.state=A[t.state](o,e,t)),n},indent:function(e,t){var r=e.context,e=t&&t.charAt(0),t=r.indent;return"prop"!=r.type||"}"!=e&&")"!=e||(r=r.prev),r.prev&&("}"!=e||"block"!=r.type&&"top"!=r.type&&"interpolation"!=r.type&&"restricted_atBlock"!=r.type?(")"!=e||"parens"!=r.type&&"atBlock_parens"!=r.type)&&("{"!=e||"at"!=r.type&&"atBlock"!=r.type)||(t=Math.max(0,r.indent-i)):t=(r=r.prev).indent),t},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",blockCommentContinue:" * ",lineComment:y,fold:"brace"}});var t=["domain","regexp","url","url-prefix"],r=e(t),n=["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"],i=e(n),o=["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid","orientation","device-pixel-ratio","min-device-pixel-ratio","max-device-pixel-ratio","pointer","any-pointer","hover","any-hover","prefers-color-scheme"],a=e(o),l=["landscape","portrait","none","coarse","fine","on-demand","hover","interlace","progressive","dark","light"],s=e(l),c=["align-content","align-items","align-self","alignment-adjust","alignment-baseline","all","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","binding","bleed","block-size","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","gap","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-gap","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-gap","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","inset","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","left","letter-spacing","line-break","line-height","line-height-step","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","place-content","place-items","place-self","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotate","rotation","rotation-point","row-gap","ruby-align","ruby-overhang","ruby-position","ruby-span","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-type","shape-image-threshold","shape-inside","shape-margin","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-orientation","text-outline","text-overflow","text-rendering","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","touch-action","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-select","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","z-index","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","paint-order","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","text-anchor","writing-mode"],u=e(c),d=["border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","margin-block","margin-block-end","margin-block-start","margin-inline","margin-inline-end","margin-inline-start","padding-block","padding-block-end","padding-block-start","padding-inline","padding-inline-end","padding-inline-start","scroll-snap-stop","scrollbar-3d-light-color","scrollbar-arrow-color","scrollbar-base-color","scrollbar-dark-shadow-color","scrollbar-face-color","scrollbar-highlight-color","scrollbar-shadow-color","scrollbar-track-color","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","shape-inside","zoom"],f=e(d),h=e(["font-display","font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"]),p=e(["additive-symbols","fallback","negative","pad","prefix","range","speak-as","suffix","symbols","system"]),g=["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],m=e(g),v=["above","absolute","activeborder","additive","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","devanagari","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ethiopic-numeric","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","georgian","graytext","grid","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hard-light","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","japanese-formal","japanese-informal","justify","kannada","katakana","katakana-iroha","keep-all","khmer","korean-hangul-formal","korean-hanja-formal","korean-hanja-informal","landscape","lao","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","luminosity","malayalam","manipulation","match","matrix","matrix3d","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","multiple_mask_images","multiply","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","octal","opacity","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","sidama","simp-chinese-formal","simp-chinese-informal","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","somali","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","square-button","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","tamil","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","trad-chinese-formal","trad-chinese-informal","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"],y=e(v),v=t.concat(n).concat(o).concat(l).concat(c).concat(d).concat(g).concat(v);function b(e,t){for(var r,n=!1;null!=(r=e.next());){if(n&&"/"==r){t.tokenize=null;break}n="*"==r}return["comment","comment"]}D.registerHelper("hintWords","css",v),D.defineMIME("text/css",{documentTypes:r,mediaTypes:i,mediaFeatures:a,mediaValueKeywords:s,propertyKeywords:u,nonStandardPropertyKeywords:f,fontProperties:h,counterDescriptors:p,colorKeywords:m,valueKeywords:y,tokenHooks:{"/":function(e,t){return!!e.eat("*")&&(t.tokenize=b)(e,t)}},name:"css"}),D.defineMIME("text/x-scss",{mediaTypes:i,mediaFeatures:a,mediaValueKeywords:s,propertyKeywords:u,nonStandardPropertyKeywords:f,colorKeywords:m,valueKeywords:y,fontProperties:h,allowNested:!0,lineComment:"//",tokenHooks:{"/":function(e,t){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(t.tokenize=b)(e,t):["operator","operator"]},":":function(e){return!!e.match(/^\s*\{/,!1)&&[null,null]},$:function(e){return e.match(/^[\w-]+/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"]},"#":function(e){return!!e.eat("{")&&[null,"interpolation"]}},name:"css",helperType:"scss"}),D.defineMIME("text/x-less",{mediaTypes:i,mediaFeatures:a,mediaValueKeywords:s,propertyKeywords:u,nonStandardPropertyKeywords:f,colorKeywords:m,valueKeywords:y,fontProperties:h,allowNested:!0,lineComment:"//",tokenHooks:{"/":function(e,t){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(t.tokenize=b)(e,t):["operator","operator"]},"@":function(e){return e.eat("{")?[null,"interpolation"]:!e.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/i,!1)&&(e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"])},"&":function(){return["atom","atom"]}},name:"css",helperType:"less"}),D.defineMIME("text/x-gss",{documentTypes:r,mediaTypes:i,mediaFeatures:a,propertyKeywords:u,nonStandardPropertyKeywords:f,fontProperties:h,counterDescriptors:p,colorKeywords:m,valueKeywords:y,supportsAtComponent:!0,tokenHooks:{"/":function(e,t){return!!e.eat("*")&&(t.tokenize=b)(e,t)}},name:"css",helperType:"gss"})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../xml/xml"),require("../javascript/javascript"),require("../css/css")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../xml/xml","../javascript/javascript","../css/css"],e):e(CodeMirror)}(function(d){"use strict";var i={script:[["lang",/(javascript|babel)/i,"javascript"],["type",/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i,"javascript"],["type",/./,"text/plain"],[null,null,"javascript"]],style:[["lang",/^css$/i,"css"],["type",/^(text\/)?(x-)?(stylesheet|css)$/i,"css"],["type",/./,"text/plain"],[null,null,"css"]]};var r={};function f(e,t){t=e.match(r[t=t]||(r[t]=new RegExp("\\s+"+t+"\\s*=\\s*('|\")?([^'\"]+)('|\")?\\s*")));return t?/^\s*(.*?)\s*$/.exec(t[2])[1]:""}function h(e,t){return new RegExp((t?"^":"")+"</s*"+e+"s*>","i")}function o(e,t){for(var r in e)for(var n=t[r]||(t[r]=[]),i=e[r],o=i.length-1;0<=o;o--)n.unshift(i[o])}d.defineMode("htmlmixed",function(l,e){var s=d.getMode(l,{name:"xml",htmlMode:!0,multilineTagIndentFactor:e.multilineTagIndentFactor,multilineTagIndentPastTag:e.multilineTagIndentPastTag,allowMissingTagName:e.allowMissingTagName}),c={},t=e&&e.tags,r=e&&e.scriptTypes;if(o(i,c),t&&o(t,c),r)for(var n=r.length-1;0<=n;n--)c.script.unshift(["type",r[n].matches,r[n].mode]);function u(e,t){var r,o,a,n=s.token(e,t.htmlState),i=/\btag\b/.test(n);return i&&!/[<>\s\/]/.test(e.current())&&(r=t.htmlState.tagName&&t.htmlState.tagName.toLowerCase())&&c.hasOwnProperty(r)?t.inTag=r+" ":t.inTag&&i&&/>$/.test(e.current())?(r=/^([\S]+) (.*)/.exec(t.inTag),t.inTag=null,i=">"==e.current()&&function(e,t){for(var r=0;r<e.length;r++){var n=e[r];if(!n[0]||n[1].test(f(t,n[0])))return n[2]}}(c[r[1]],r[2]),i=d.getMode(l,i),o=h(r[1],!0),a=h(r[1],!1),t.token=function(e,t){return e.match(o,!1)?(t.token=u,t.localState=t.localMode=null):(r=e,n=a,i=t.localMode.token(e,t.localState),e=r.current(),-1<(t=e.search(n))?r.backUp(e.length-t):e.match(/<\/?$/)&&(r.backUp(e.length),r.match(n,!1)||r.match(e)),i);var r,n,i},t.localMode=i,t.localState=d.startState(i,s.indent(t.htmlState,"",""))):t.inTag&&(t.inTag+=e.current(),e.eol()&&(t.inTag+=" ")),n}return{startState:function(){return{token:u,inTag:null,localMode:null,localState:null,htmlState:d.startState(s)}},copyState:function(e){var t;return e.localState&&(t=d.copyState(e.localMode,e.localState)),{token:e.token,inTag:e.inTag,localMode:e.localMode,localState:t,htmlState:d.copyState(s,e.htmlState)}},token:function(e,t){return t.token(e,t)},indent:function(e,t,r){return!e.localMode||/^\s*<\//.test(t)?s.indent(e.htmlState,t,r):e.localMode.indent?e.localMode.indent(e.localState,t,r):d.Pass},innerMode:function(e){return{state:e.localState||e.htmlState,mode:e.localMode||s}}}},"xml","javascript","css"),d.defineMIME("text/html","htmlmixed")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(d){function f(e,t,r){var n=e.getWrapperElement(),e=n.appendChild(document.createElement("div"));return e.className=r?"CodeMirror-dialog CodeMirror-dialog-bottom":"CodeMirror-dialog CodeMirror-dialog-top","string"==typeof t?e.innerHTML=t:e.appendChild(t),d.addClass(n,"dialog-opened"),e}function h(e,t){e.state.currentNotificationClose&&e.state.currentNotificationClose(),e.state.currentNotificationClose=t}d.defineExtension("openDialog",function(e,t,r){r=r||{},h(this,null);var n=f(this,e,r.bottom),i=!1,o=this;function a(e){"string"==typeof e?l.value=e:i||(i=!0,d.rmClass(n.parentNode,"dialog-opened"),n.parentNode.removeChild(n),o.focus(),r.onClose&&r.onClose(n))}var l=n.getElementsByTagName("input")[0];return l?(l.focus(),r.value&&(l.value=r.value,!1!==r.selectValueOnOpen&&l.select()),r.onInput&&d.on(l,"input",function(e){r.onInput(e,l.value,a)}),r.onKeyUp&&d.on(l,"keyup",function(e){r.onKeyUp(e,l.value,a)}),d.on(l,"keydown",function(e){r&&r.onKeyDown&&r.onKeyDown(e,l.value,a)||((27==e.keyCode||!1!==r.closeOnEnter&&13==e.keyCode)&&(l.blur(),d.e_stop(e),a()),13==e.keyCode&&t(l.value,e))}),!1!==r.closeOnBlur&&d.on(n,"focusout",function(e){null!==e.relatedTarget&&a()})):(e=n.getElementsByTagName("button")[0])&&(d.on(e,"click",function(){a(),o.focus()}),!1!==r.closeOnBlur&&d.on(e,"blur",a),e.focus()),a}),d.defineExtension("openConfirm",function(e,t,r){h(this,null);var n=f(this,e,r&&r.bottom),i=n.getElementsByTagName("button"),o=!1,a=this,l=1;function s(){o||(o=!0,d.rmClass(n.parentNode,"dialog-opened"),n.parentNode.removeChild(n),a.focus())}i[0].focus();for(var c=0;c<i.length;++c){var u=i[c];!function(t){d.on(u,"click",function(e){d.e_preventDefault(e),s(),t&&t(a)})}(t[c]),d.on(u,"blur",function(){--l,setTimeout(function(){l<=0&&s()},200)}),d.on(u,"focus",function(){++l})}}),d.defineExtension("openNotification",function(e,t){h(this,o);var r,n=f(this,e,t&&t.bottom),i=!1,t=t&&void 0!==t.duration?t.duration:5e3;function o(){i||(i=!0,clearTimeout(r),d.rmClass(n.parentNode,"dialog-opened"),n.parentNode.removeChild(n))}return d.on(n,"click",function(e){d.e_preventDefault(e),o()}),t&&(r=setTimeout(o,t)),o})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(i){"use strict";var m,v,y=i.Pos;function p(e,t){for(var r,n,r=null!=(n=(r=e).flags)?n:(r.ignoreCase?"i":"")+(r.global?"g":"")+(r.multiline?"m":""),i=r,o=0;o<t.length;o++)-1==i.indexOf(t.charAt(o))&&(i+=t.charAt(o));return r==i?e:new RegExp(e.source,i)}function g(e){return/\\s|\\n|\n|\\W|\\D|\[\^/.test(e.source)}function h(e,t,r){t=p(t,"g");for(var n=r.line,i=r.ch,o=e.lastLine();n<=o;n++,i=0){t.lastIndex=i;var a=e.getLine(n),a=t.exec(a);if(a)return{from:y(n,a.index),to:y(n,a.index+a[0].length),match:a}}}function b(e,t,r){for(var n,i=0;i<=e.length;){t.lastIndex=i;var o=t.exec(e);if(!o)break;var a=o.index+o[0].length;if(a>e.length-r)break;(!n||a>n.index+n[0].length)&&(n=o),i=o.index+1}return n}function w(e,t,r){t=p(t,"g");for(var n=r.line,i=r.ch,o=e.firstLine();o<=n;n--,i=-1){var a=e.getLine(n),a=b(a,t,i<0?0:a.length-i);if(a)return{from:y(n,a.index),to:y(n,a.index+a[0].length),match:a}}}function x(e,t,r,n){if(e.length==t.length)return r;for(var i=0,o=r+Math.max(0,e.length-t.length);;){if(i==o)return i;var a=i+o>>1,l=n(e.slice(0,a)).length;if(l==r)return a;r<l?o=a:i=1+a}}function n(r,n,e,t){var i;this.atOccurrence=!1,this.doc=r,e=e?r.clipPos(e):y(0,0),this.pos={from:e,to:e},"object"==typeof t?i=t.caseFold:(i=t,t=null),"string"==typeof n?(null==i&&(i=!1),this.matches=function(e,t){return(e?function(e,t,r,n){if(!t.length)return null;var i=n?m:v,o=i(t).split(/\r|\n\r?/);e:for(var a=r.line,l=r.ch,s=e.firstLine()-1+o.length;s<=a;a--,l=-1){var c=e.getLine(a);-1<l&&(c=c.slice(0,l));var u=i(c);if(1==o.length){var d=u.lastIndexOf(o[0]);if(-1!=d)return{from:y(a,x(c,u,d,i)),to:y(a,x(c,u,d+o[0].length,i))}}else{var f=o[o.length-1];if(u.slice(0,f.length)==f){for(var h=1,r=a-o.length+1;h<o.length-1;h++)if(i(e.getLine(r+h))!=o[h])continue e;var p=e.getLine(a+1-o.length),d=i(p);if(d.slice(d.length-o[0].length)==o[0])return{from:y(a+1-o.length,x(p,d,p.length-o[0].length,i)),to:y(a,x(c,u,f.length,i))}}}}}:function(e,t,r,n){if(!t.length)return null;var i=n?m:v,o=i(t).split(/\r|\n\r?/);e:for(var a=r.line,l=r.ch,s=e.lastLine()+1-o.length;a<=s;a++,l=0){var c=e.getLine(a).slice(l),u=i(c);if(1==o.length){var d=u.indexOf(o[0]);if(-1!=d){r=x(c,u,d,i)+l;return{from:y(a,x(c,u,d,i)+l),to:y(a,x(c,u,d+o[0].length,i)+l)}}}else{var f=u.length-o[0].length;if(u.slice(f)==o[0]){for(var h=1;h<o.length-1;h++)if(i(e.getLine(a+h))!=o[h])continue e;var p=e.getLine(a+o.length-1),g=i(p),d=o[o.length-1];if(g.slice(0,d.length)==d)return{from:y(a,x(c,u,f,i)+l),to:y(a+o.length-1,x(p,g,d.length,i))}}}}})(r,n,t,i)}):(n=p(n,"gm"),t&&!1===t.multiline?this.matches=function(e,t){return(e?w:h)(r,n,t)}:this.matches=function(e,t){return(e?function(e,t,r){if(!g(t))return w(e,t,r);t=p(t,"gm");for(var n=1,i=e.getLine(r.line).length-r.ch,o=r.line,a=e.firstLine();a<=o;){for(var l=0;l<n&&a<=o;l++)var s=e.getLine(o--),c=null==c?s:s+"\n"+c;n*=2;var u=b(c,t,i);if(u){var d=c.slice(0,u.index).split("\n"),f=u[0].split("\n"),h=o+d.length,d=d[d.length-1].length;return{from:y(h,d),to:y(h+f.length-1,1==f.length?d+f[0].length:f[f.length-1].length),match:u}}}}:function(e,t,r){if(!g(t))return h(e,t,r);t=p(t,"gm");for(var n=1,i=r.line,o=e.lastLine();i<=o;){for(var a=0;a<n&&!(o<i);a++)var l=e.getLine(i++),s=null==s?l:s+"\n"+l;n*=2,t.lastIndex=r.ch;var c=t.exec(s);if(c){var u=s.slice(0,c.index).split("\n"),d=c[0].split("\n"),f=r.line+u.length-1,u=u[u.length-1].length;return{from:y(f,u),to:y(f+d.length-1,1==d.length?u+d[0].length:d[d.length-1].length),match:c}}}})(r,n,t)})}v=String.prototype.normalize?(m=function(e){return e.normalize("NFD").toLowerCase()},function(e){return e.normalize("NFD")}):(m=function(e){return e.toLowerCase()},function(e){return e}),n.prototype={findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(e){for(var t=this.matches(e,this.doc.clipPos(e?this.pos.from:this.pos.to));t&&0==i.cmpPos(t.from,t.to);)e?t.from.ch?t.from=y(t.from.line,t.from.ch-1):t=t.from.line==this.doc.firstLine()?null:this.matches(e,this.doc.clipPos(y(t.from.line-1))):t.to.ch<this.doc.getLine(t.to.line).length?t.to=y(t.to.line,t.to.ch+1):t=t.to.line==this.doc.lastLine()?null:this.matches(e,y(t.to.line+1,0));if(t)return this.pos=t,this.atOccurrence=!0,this.pos.match||!0;var r=y(e?this.doc.firstLine():this.doc.lastLine()+1,0);return this.pos={from:r,to:r},this.atOccurrence=!1},from:function(){if(this.atOccurrence)return this.pos.from},to:function(){if(this.atOccurrence)return this.pos.to},replace:function(e,t){this.atOccurrence&&(e=i.splitLines(e),this.doc.replaceRange(e,this.pos.from,this.pos.to,t),this.pos.to=y(this.pos.from.line+e.length-1,e[e.length-1].length+(1==e.length?this.pos.from.ch:0)))}},i.defineExtension("getSearchCursor",function(e,t,r){return new n(this.doc,e,t,r)}),i.defineDocExtension("getSearchCursor",function(e,t,r){return new n(this,e,t,r)}),i.defineExtension("selectMatches",function(e,t){for(var r=[],n=this.getSearchCursor(e,this.getCursor("from"),t);n.findNext()&&!(0<i.cmpPos(n.to(),this.getCursor("to")));)r.push({anchor:n.from(),head:n.to()});r.length&&this.setSelections(r,0)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("./searchcursor"),require("../dialog/dialog")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./searchcursor","../dialog/dialog"],e):e(CodeMirror)}(function(f){"use strict";function t(){this.posFrom=this.posTo=this.lastQuery=this.query=null,this.overlay=null}function h(e){return e.state.search||(e.state.search=new t)}function i(e){return"string"==typeof e&&e==e.toLowerCase()}function d(e,t,r){return e.getSearchCursor(t,r,{caseFold:i(t),multiline:!0})}function p(e,t,r,n,i){e.openDialog?e.openDialog(t,i,{value:n,selectValueOnOpen:!0,bottom:e.options.search.bottom}):i(prompt(r,n))}function n(e){return e.replace(/\\([nrt\\])/g,function(e,t){return"n"==t?"\n":"r"==t?"\r":"t"==t?"\t":"\\"==t?"\\":e})}function o(e){var t=e.match(/^\/(.*)\/([a-z]*)$/);if(t)try{e=new RegExp(t[1],-1==t[2].indexOf("i")?"":"i")}catch(e){}else e=n(e);return("string"==typeof e?""==e:e.test(""))&&(e=/x^/),e}function g(e,t,r){var n;t.queryText=r,t.query=o(r),e.removeOverlay(t.overlay,i(t.query)),t.overlay=(n=t.query,r=i(t.query),"string"==typeof n?n=new RegExp(n.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),r?"gi":"g"):n.global||(n=new RegExp(n.source,n.ignoreCase?"gi":"g")),{token:function(e){n.lastIndex=e.pos;var t=n.exec(e.string);if(t&&t.index==e.pos)return e.pos+=t[0].length||1,"searching";t?e.pos=t.index:e.skipToEnd()}}),e.addOverlay(t.overlay),e.showMatchesOnScrollbar&&(t.annotate&&(t.annotate.clear(),t.annotate=null),t.annotate=e.showMatchesOnScrollbar(t.query,i(t.query)))}function r(i,t,e,r){var n=h(i);if(n.query)return m(i,t);var o,a,l,s,c,u,d=i.getSelection()||n.lastQuery;d instanceof RegExp&&"x^"==d.source&&(d=null),e&&i.openDialog?(o=null,a=function(e,t){f.e_stop(t),e&&(e!=n.queryText&&(g(i,n,e),n.posFrom=n.posTo=i.getCursor()),o&&(o.style.opacity=1),m(i,t.shiftKey,function(e,t){var r;t.line<3&&document.querySelector&&(r=i.display.wrapper.querySelector(".CodeMirror-dialog"))&&r.getBoundingClientRect().bottom-4>i.cursorCoords(t,"window").top&&((o=r).style.opacity=.4)}))},s=y(l=i),c=d,u=a,e=function(e,t){var r=f.keyName(e),n=i.getOption("extraKeys"),r=n&&n[r]||f.keyMap[i.getOption("keyMap")][r];"findNext"==r||"findPrev"==r||"findPersistentNext"==r||"findPersistentPrev"==r?(f.e_stop(e),g(i,h(i),t),i.execCommand(r)):"find"!=r&&"findPersistent"!=r||(f.e_stop(e),a(t,e))},l.openDialog(s,u,{value:c,selectValueOnOpen:!0,closeOnEnter:!1,onClose:function(){v(l)},onKeyDown:e,bottom:l.options.search.bottom}),r&&d&&(g(i,n,d),m(i,t))):p(i,y(i),"Search for:",d,function(e){e&&!n.query&&i.operation(function(){g(i,n,e),n.posFrom=n.posTo=i.getCursor(),m(i,t)})})}function m(r,n,i){r.operation(function(){var e=h(r),t=d(r,e.query,n?e.posFrom:e.posTo);(t.find(n)||(t=d(r,e.query,n?f.Pos(r.lastLine()):f.Pos(r.firstLine(),0))).find(n))&&(r.setSelection(t.from(),t.to()),r.scrollIntoView({from:t.from(),to:t.to()},20),e.posFrom=t.from(),e.posTo=t.to(),i&&i(t.from(),t.to()))})}function v(t){t.operation(function(){var e=h(t);e.lastQuery=e.query,e.query&&(e.query=e.queryText=null,t.removeOverlay(e.overlay),e.annotate&&(e.annotate.clear(),e.annotate=null))})}function y(e){return'<span class="CodeMirror-search-label">'+e.phrase("Search:")+'</span> <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">'+e.phrase("(Use /re/ syntax for regexp search)")+"</span>"}function b(t,n,i){t.operation(function(){for(var r,e=d(t,n);e.findNext();)"string"!=typeof n?(r=t.getRange(e.from(),e.to()).match(n),e.replace(i.replace(/\$(\d)/g,function(e,t){return r[t]}))):e.replace(i)})}function a(u,e){var t,r;u.getOption("readOnly")||(t=u.getSelection()||h(u).lastQuery,r='<span class="CodeMirror-search-label">'+(e?u.phrase("Replace all:"):u.phrase("Replace:"))+"</span>",p(u,r+' <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">'+u.phrase("(Use /re/ syntax for regexp search)")+"</span>",r,t,function(c){c&&(c=o(c),p(u,'<span class="CodeMirror-search-label">'+u.phrase("With:")+'</span> <input type="text" style="width: 10em" class="CodeMirror-search-field"/>',u.phrase("Replace with:"),"",function(o){var a,l,s;o=n(o),e?b(u,c,o):(v(u),a=d(u,c,u.getCursor("from")),l=function(){var e,t,r,n,i=a.from();!(e=a.findNext())&&(a=d(u,c),!(e=a.findNext())||i&&a.from().line==i.line&&a.from().ch==i.ch)||(u.setSelection(a.from(),a.to()),u.scrollIntoView({from:a.from(),to:a.to()}),r='<span class="CodeMirror-search-label">'+(n=t=u).phrase("Replace?")+"</span> <button>"+n.phrase("Yes")+"</button> <button>"+n.phrase("No")+"</button> <button>"+n.phrase("All")+"</button> <button>"+n.phrase("Stop")+"</button> ",i=u.phrase("Replace?"),n=[function(){s(e)},l,function(){b(u,c,o)}],t.openConfirm?t.openConfirm(r,n):confirm(i)&&n[0]())},s=function(r){a.replace("string"==typeof c?o:o.replace(/\$(\d)/g,function(e,t){return r[t]})),l()},l())}))}))}f.defineOption("search",{bottom:!1}),f.commands.find=function(e){v(e),r(e)},f.commands.findPersistent=function(e){v(e),r(e,!1,!0)},f.commands.findPersistentNext=function(e){r(e,!1,!0,!0)},f.commands.findPersistentPrev=function(e){r(e,!0,!0,!0)},f.commands.findNext=r,f.commands.findPrev=function(e){r(e,!0)},f.commands.clearSearch=v,f.commands.replace=a,f.commands.replaceAll=function(e){a(e,!0)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("./matchesonscrollbar")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./matchesonscrollbar"],e):e(CodeMirror)}(function(n){"use strict";var r={style:"matchhighlight",minChars:2,delay:100,wordsOnly:!1,annotateScrollbar:!1,showToken:!1,trim:!0};function i(e){for(var t in this.options={},r)this.options[t]=(e&&e.hasOwnProperty(t)?e:r)[t];this.overlay=this.timeout=null,this.matchesonscroll=null,this.active=!1}function o(e){var t=e.state.matchHighlighter;(t.active||e.hasFocus())&&l(e,t)}function a(e){var t=e.state.matchHighlighter;t.active||(t.active=!0,l(e,t))}function l(e,t){clearTimeout(t.timeout),t.timeout=setTimeout(function(){s(e)},t.options.delay)}function c(e,t,r,n){var i,o,a,l=e.state.matchHighlighter;e.addOverlay(l.overlay=(i=t,o=r,a=n,{token:function(e){if(e.match(i)&&(!o||(r=o,!((t=e).start&&r.test(t.string.charAt(t.start-1))||t.pos!=t.string.length&&r.test(t.string.charAt(t.pos))))))return a;var t,r;e.next(),e.skipTo(i.charAt(0))||e.skipToEnd()}})),l.options.annotateScrollbar&&e.showMatchesOnScrollbar&&(t=r?new RegExp((/\w/.test(t.charAt(0))?"\\b":"")+t.replace(/[\\\[.+*?(){|^$]/g,"\\$&")+(/\w/.test(t.charAt(t.length-1))?"\\b":"")):t,l.matchesonscroll=e.showMatchesOnScrollbar(t,!1,{className:"CodeMirror-selection-highlight-scrollbar"}))}function u(e){var t=e.state.matchHighlighter;t.overlay&&(e.removeOverlay(t.overlay),t.overlay=null,t.matchesonscroll&&(t.matchesonscroll.clear(),t.matchesonscroll=null))}function s(s){s.operation(function(){var e=s.state.matchHighlighter;if(u(s),s.somethingSelected()||!e.options.showToken){var t=s.getCursor("from"),r=s.getCursor("to");t.line==r.line&&(e.options.wordsOnly&&!function(e,t,r){{if(null===e.getRange(t,r).match(/^\w+$/))return!1;if(0<t.ch){var n={line:t.line,ch:t.ch-1};if(null===e.getRange(n,t).match(/\W/))return!1}if(r.ch<e.getLine(t.line).length){n={line:r.line,ch:r.ch+1};if(null===e.getRange(r,n).match(/\W/))return!1}return!0}}(s,t,r)||(i=s.getRange(t,r),e.options.trim&&(i=i.replace(/^\s+|\s+$/g,"")),i.length>=e.options.minChars&&c(s,i,!1,e.options.style)))}else{for(var n=!0===e.options.showToken?/[\w$]/:e.options.showToken,i=s.getCursor(),o=s.getLine(i.line),a=i.ch,l=a;a&&n.test(o.charAt(a-1));)--a;for(;l<o.length&&n.test(o.charAt(l));)++l;a<l&&c(s,o.slice(a,l),n,e.options.style)}})}n.defineOption("highlightSelectionMatches",!1,function(e,t,r){r&&r!=n.Init&&(u(e),clearTimeout(e.state.matchHighlighter.timeout),e.state.matchHighlighter=null,e.off("cursorActivity",o),e.off("focus",a)),t&&(t=e.state.matchHighlighter=new i(t),e.hasFocus()?(t.active=!0,s(e)):e.on("focus",a),e.on("cursorActivity",o))})});