UNPKG

@limetech/lime-elements

Version:
1 lines 287 kB
import{r,c as t,h as e,H as n,a as i}from"./p-DBTJNfo7.js";import{c as o}from"./p-JbKhhoXs.js";import{g as a}from"./p-BFTU3MAI.js";import{t as u}from"./p-DVRaJQvC.js";var l,s={exports:{}};function c(){return l||(l=1,s.exports=function(){var r=navigator.userAgent,t=navigator.platform,e=/gecko\/\d/i.test(r),n=/MSIE \d/.test(r),i=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(r),o=/Edge\/(\d+)/.exec(r),a=n||i||o,u=a&&(n?document.documentMode||6:+(o||i)[1]),l=!o&&/WebKit\//.test(r),s=l&&/Qt\/\d+\.\d+/.test(r),c=!o&&/Chrome\/(\d+)/.exec(r),f=c&&+c[1],d=/Opera\//.test(r),h=/Apple Computer/.test(navigator.vendor),v=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(r),m=/PhantomJS/.test(r),p=h&&(/Mobile\/\w+/.test(r)||navigator.maxTouchPoints>2),g=/Android/.test(r),b=p||g||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(r),w=p||/Mac/.test(t),k=/\bCrOS\b/.test(r),y=/win/i.test(t),x=d&&r.match(/Version\/(\d*\.\d*)/);x&&(x=Number(x[1])),x&&x>=15&&(d=!1,l=!0);var C=w&&(s||d&&(null==x||x<12.11)),M=e||a&&u>=9;function A(r){return new RegExp("(^|\\s)"+r+"(?:$|\\s)\\s*")}var L,S=function(r,t){var e=r.className,n=A(t).exec(e);if(n){var i=e.slice(n.index+n[0].length);r.className=e.slice(0,n.index)+(i?n[1]+i:"")}};function T(r){for(var t=r.childNodes.length;t>0;--t)r.removeChild(r.firstChild);return r}function N(r,t){return T(r).appendChild(t)}function E(r,t,e,n){var i=document.createElement(r);if(e&&(i.className=e),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 D(r,t,e,n){var i=E(r,t,e,n);return i.setAttribute("role","presentation"),i}function z(r,t){if(3==t.nodeType&&(t=t.parentNode),r.contains)return r.contains(t);do{if(11==t.nodeType&&(t=t.host),t==r)return!0}while(t=t.parentNode)}function j(r){var t;try{t=r.activeElement}catch(e){t=r.body||null}for(;t&&t.shadowRoot&&t.shadowRoot.activeElement;)t=t.shadowRoot.activeElement;return t}function B(r,t){var e=r.className;A(t).test(e)||(r.className+=(e?" ":"")+t)}function I(r,t){for(var e=r.split(" "),n=0;n<e.length;n++)e[n]&&!A(e[n]).test(t)&&(t+=" "+e[n]);return t}L=document.createRange?function(r,t,e,n){var i=document.createRange();return i.setEnd(n||r,e),i.setStart(r,t),i}:function(r,t,e){var n=document.body.createTextRange();try{n.moveToElementText(r.parentNode)}catch(r){return n}return n.collapse(!0),n.moveEnd("character",e),n.moveStart("character",t),n};var R=function(r){r.select()};function F(r){return r.display.wrapper.ownerDocument}function O(r){return F(r).defaultView}function U(r){var t=Array.prototype.slice.call(arguments,1);return function(){return r.apply(null,t)}}function _(r,t,e){for(var n in t||(t={}),r)!r.hasOwnProperty(n)||!1===e&&t.hasOwnProperty(n)||(t[n]=r[n]);return t}function P(r,t,e,n,i){null==t&&-1==(t=r.search(/[^\s\u00a0]/))&&(t=r.length);for(var o=n||0,a=i||0;;){var u=r.indexOf("\t",o);if(u<0||u>=t)return a+(t-o);a+=u-o,a+=e-a%e,o=u+1}}p?R=function(r){r.selectionStart=0,r.selectionEnd=r.value.length}:a&&(R=function(r){try{r.select()}catch(r){}});var q=function(){this.id=null,this.f=null,this.time=0,this.handler=U(this.onTimeout,this)};function W(r,t){for(var e=0;e<r.length;++e)if(r[e]==t)return e;return-1}q.prototype.onTimeout=function(r){r.id=0,r.time<=+new Date?r.f():setTimeout(r.handler,r.time-+new Date)},q.prototype.set=function(r,t){this.f=t;var e=+new Date+r;(!this.id||e<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,r),this.time=e)};var $={toString:function(){return"CodeMirror.Pass"}},G={scroll:!1},H={origin:"*mouse"},K={origin:"+move"};function V(r,t,e){for(var n=0,i=0;;){var o=r.indexOf("\t",n);-1==o&&(o=r.length);var a=o-n;if(o==r.length||i+a>=t)return n+Math.min(a,t-i);if(i+=o-n,n=o+1,(i+=e-i%e)>=t)return n}}var Q=[""];function J(r){for(;Q.length<=r;)Q.push(Y(Q)+" ");return Q[r]}function Y(r){return r[r.length-1]}function X(r,t){for(var e=[],n=0;n<r.length;n++)e[n]=t(r[n],n);return e}function Z(){}function rr(r,t){var e;return Object.create?e=Object.create(r):(Z.prototype=r,e=new Z),t&&_(t,e),e}var tr=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function er(r){return/\w/.test(r)||r>"€"&&(r.toUpperCase()!=r.toLowerCase()||tr.test(r))}function nr(r,t){return t?!!(t.source.indexOf("\\w")>-1&&er(r))||t.test(r):er(r)}function ir(r){for(var t in r)if(r.hasOwnProperty(t)&&r[t])return!1;return!0}var or=/[\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 ar(r){return r.charCodeAt(0)>=768&&or.test(r)}function ur(r,t,e){for(;(e<0?t>0:t<r.length)&&ar(r.charAt(t));)t+=e;return t}function lr(r,t,e){for(var n=t>e?-1:1;;){if(t==e)return t;var i=(t+e)/2,o=n<0?Math.ceil(i):Math.floor(i);if(o==t)return r(o)?t:e;r(o)?e=o:t=o+n}}var sr=null;function cr(r,t,e){var n;sr=null;for(var i=0;i<r.length;++i){var o=r[i];if(o.from<t&&o.to>t)return i;o.to==t&&(o.from!=o.to&&"before"==e?n=i:sr=i),o.from==t&&(o.from!=o.to&&"before"!=e?n=i:sr=i)}return null!=n?n:sr}var fr=function(){var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,t=/[stwN]/,e=/[LRr]/,n=/[Lb1n]/,i=/[1n]/;function o(r,t,e){this.level=r,this.from=t,this.to=e}return function(a,u){var l,s="ltr"==u?"L":"R";if(0==a.length||"ltr"==u&&!r.test(a))return!1;for(var c=a.length,f=[],d=0;d<c;++d)f.push((l=a.charCodeAt(d))<=247?"bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN".charAt(l):1424<=l&&l<=1524?"R":1536<=l&&l<=1785?"nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111".charAt(l-1536):1774<=l&&l<=2220?"r":8192<=l&&l<=8203?"w":8204==l?"b":"L");for(var h=0,v=s;h<c;++h){var m=f[h];"m"==m?f[h]=v:v=m}for(var p=0,g=s;p<c;++p){var b=f[p];"1"==b&&"r"==g?f[p]="n":e.test(b)&&(g=b,"r"==b&&(f[p]="R"))}for(var w=1,k=f[0];w<c-1;++w){var y=f[w];"+"==y&&"1"==k&&"1"==f[w+1]?f[w]="1":","!=y||k!=f[w+1]||"1"!=k&&"n"!=k||(f[w]=k),k=y}for(var x=0;x<c;++x){var C=f[x];if(","==C)f[x]="N";else if("%"==C){var M=void 0;for(M=x+1;M<c&&"%"==f[M];++M);for(var A=x&&"!"==f[x-1]||M<c&&"1"==f[M]?"1":"N",L=x;L<M;++L)f[L]=A;x=M-1}}for(var S=0,T=s;S<c;++S){var N=f[S];"L"==T&&"1"==N?f[S]="L":e.test(N)&&(T=N)}for(var E=0;E<c;++E)if(t.test(f[E])){var D=void 0;for(D=E+1;D<c&&t.test(f[D]);++D);for(var z="L"==(E?f[E-1]:s),j=z==("L"==(D<c?f[D]:s))?z?"L":"R":s,B=E;B<D;++B)f[B]=j;E=D-1}for(var I,R=[],F=0;F<c;)if(n.test(f[F])){var O=F;for(++F;F<c&&n.test(f[F]);++F);R.push(new o(0,O,F))}else{var U=F,_=R.length,P="rtl"==u?1:0;for(++F;F<c&&"L"!=f[F];++F);for(var q=U;q<F;)if(i.test(f[q])){U<q&&(R.splice(_,0,new o(1,U,q)),_+=P);var W=q;for(++q;q<F&&i.test(f[q]);++q);R.splice(_,0,new o(2,W,q)),_+=P,U=q}else++q;U<F&&R.splice(_,0,new o(1,U,F))}return"ltr"==u&&(1==R[0].level&&(I=a.match(/^\s+/))&&(R[0].from=I[0].length,R.unshift(new o(0,0,I[0].length))),1==Y(R).level&&(I=a.match(/\s+$/))&&(Y(R).to-=I[0].length,R.push(new o(0,c-I[0].length,c)))),"rtl"==u?R.reverse():R}}();function dr(r,t){var e=r.order;return null==e&&(e=r.order=fr(r.text,t)),e}var hr=[],vr=function(r,t,e){if(r.addEventListener)r.addEventListener(t,e,!1);else if(r.attachEvent)r.attachEvent("on"+t,e);else{var n=r._handlers||(r._handlers={});n[t]=(n[t]||hr).concat(e)}};function mr(r,t){return r._handlers&&r._handlers[t]||hr}function pr(r,t,e){if(r.removeEventListener)r.removeEventListener(t,e,!1);else if(r.detachEvent)r.detachEvent("on"+t,e);else{var n=r._handlers,i=n&&n[t];if(i){var o=W(i,e);o>-1&&(n[t]=i.slice(0,o).concat(i.slice(o+1)))}}}function gr(r,t){var e=mr(r,t);if(e.length)for(var n=Array.prototype.slice.call(arguments,2),i=0;i<e.length;++i)e[i].apply(null,n)}function br(r,t,e){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),gr(r,e||t.type,r,t),Mr(t)||t.codemirrorIgnore}function wr(r){var t=r._handlers&&r._handlers.cursorActivity;if(t)for(var e=r.curOp.cursorActivityHandlers||(r.curOp.cursorActivityHandlers=[]),n=0;n<t.length;++n)-1==W(e,t[n])&&e.push(t[n])}function kr(r,t){return mr(r,t).length>0}function yr(r){r.prototype.on=function(r,t){vr(this,r,t)},r.prototype.off=function(r,t){pr(this,r,t)}}function xr(r){r.preventDefault?r.preventDefault():r.returnValue=!1}function Cr(r){r.stopPropagation?r.stopPropagation():r.cancelBubble=!0}function Mr(r){return null!=r.defaultPrevented?r.defaultPrevented:0==r.returnValue}function Ar(r){xr(r),Cr(r)}function Lr(r){return r.target||r.srcElement}function Sr(r){var t=r.which;return null==t&&(1&r.button?t=1:2&r.button?t=3:4&r.button&&(t=2)),w&&r.ctrlKey&&1==t&&(t=3),t}var Tr,Nr,Er=function(){if(a&&u<9)return!1;var r=E("div");return"draggable"in r||"dragDrop"in r}();function Dr(r){if(null==Tr){var t=E("span","​");N(r,E("span",[t,document.createTextNode("x")])),0!=r.firstChild.offsetHeight&&(Tr=t.offsetWidth<=1&&t.offsetHeight>2&&!(a&&u<8))}var e=Tr?E("span","​"):E("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return e.setAttribute("cm-text",""),e}function zr(r){if(null!=Nr)return Nr;var t=N(r,document.createTextNode("AخA")),e=L(t,0,1).getBoundingClientRect(),n=L(t,1,2).getBoundingClientRect();return T(r),!(!e||e.left==e.right)&&(Nr=n.right-e.right<3)}var jr,Br=3!="\n\nb".split(/\n/).length?function(r){for(var t=0,e=[],n=r.length;t<=n;){var i=r.indexOf("\n",t);-1==i&&(i=r.length);var o=r.slice(t,"\r"==r.charAt(i-1)?i-1:i),a=o.indexOf("\r");-1!=a?(e.push(o.slice(0,a)),t+=a+1):(e.push(o),t=i+1)}return e}:function(r){return r.split(/\r\n?|\n/)},Ir=window.getSelection?function(r){try{return r.selectionStart!=r.selectionEnd}catch(r){return!1}}:function(r){var t;try{t=r.ownerDocument.selection.createRange()}catch(r){}return!(!t||t.parentElement()!=r)&&0!=t.compareEndPoints("StartToEnd",t)},Rr="oncopy"in(jr=E("div"))||(jr.setAttribute("oncopy","return;"),"function"==typeof jr.oncopy),Fr=null;var Or={},Ur={};function _r(r,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Or[r]=t}function Pr(r){if("string"==typeof r&&Ur.hasOwnProperty(r))r=Ur[r];else if(r&&"string"==typeof r.name&&Ur.hasOwnProperty(r.name)){var t=Ur[r.name];"string"==typeof t&&(t={name:t}),(r=rr(t,r)).name=t.name}else{if("string"==typeof r&&/^[\w\-]+\/[\w\-]+\+xml$/.test(r))return Pr("application/xml");if("string"==typeof r&&/^[\w\-]+\/[\w\-]+\+json$/.test(r))return Pr("application/json")}return"string"==typeof r?{name:r}:r||{name:"null"}}function qr(r,t){t=Pr(t);var e=Or[t.name];if(!e)return qr(r,"text/plain");var n=e(r,t);if(Wr.hasOwnProperty(t.name)){var i=Wr[t.name];for(var o in i)i.hasOwnProperty(o)&&(n.hasOwnProperty(o)&&(n["_"+o]=n[o]),n[o]=i[o])}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 Wr={};function $r(r,t){_(t,Wr.hasOwnProperty(r)?Wr[r]:Wr[r]={})}function Gr(r,t){if(!0===t)return t;if(r.copyState)return r.copyState(t);var e={};for(var n in t){var i=t[n];i instanceof Array&&(i=i.concat([])),e[n]=i}return e}function Hr(r,t){for(var e;r.innerMode&&(e=r.innerMode(t))&&e.mode!=r;)t=e.state,r=e.mode;return e||{mode:r,state:t}}function Kr(r,t,e){return!r.startState||r.startState(t,e)}var Vr=function(r,t,e){this.pos=this.start=0,this.string=r,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=e};function Qr(r,t){if((t-=r.first)<0||t>=r.size)throw new Error("There is no line "+(t+r.first)+" in the document.");for(var e=r;!e.lines;)for(var n=0;;++n){var i=e.children[n],o=i.chunkSize();if(t<o){e=i;break}t-=o}return e.lines[t]}function Jr(r,t,e){var n=[],i=t.line;return r.iter(t.line,e.line+1,(function(r){var o=r.text;i==e.line&&(o=o.slice(0,e.ch)),i==t.line&&(o=o.slice(t.ch)),n.push(o),++i})),n}function Yr(r,t,e){var n=[];return r.iter(t,e,(function(r){n.push(r.text)})),n}function Xr(r,t){var e=t-r.height;if(e)for(var n=r;n;n=n.parent)n.height+=e}function Zr(r){if(null==r.parent)return null;for(var t=r.parent,e=W(t.lines,r),n=t.parent;n;t=n,n=n.parent)for(var i=0;n.children[i]!=t;++i)e+=n.children[i].chunkSize();return e+t.first}function rt(r,t){var e=r.first;r:do{for(var n=0;n<r.children.length;++n){var i=r.children[n],o=i.height;if(t<o){r=i;continue r}t-=o,e+=i.chunkSize()}return e}while(!r.lines);for(var a=0;a<r.lines.length;++a){var u=r.lines[a].height;if(t<u)break;t-=u}return e+a}function tt(r,t){return t>=r.first&&t<r.first+r.size}function et(r,t){return String(r.lineNumberFormatter(t+r.firstLineNumber))}function nt(r,t,e){if(void 0===e&&(e=null),!(this instanceof nt))return new nt(r,t,e);this.line=r,this.ch=t,this.sticky=e}function it(r,t){return r.line-t.line||r.ch-t.ch}function ot(r,t){return r.sticky==t.sticky&&0==it(r,t)}function at(r){return nt(r.line,r.ch)}function ut(r,t){return it(r,t)<0?t:r}function lt(r,t){return it(r,t)<0?r:t}function st(r,t){return Math.max(r.first,Math.min(t,r.first+r.size-1))}function ct(r,t){if(t.line<r.first)return nt(r.first,0);var e=r.first+r.size-1;return t.line>e?nt(e,Qr(r,e).text.length):function(r,t){var e=r.ch;return null==e||e>t?nt(r.line,t):e<0?nt(r.line,0):r}(t,Qr(r,t.line).text.length)}function ft(r,t){for(var e=[],n=0;n<t.length;n++)e[n]=ct(r,t[n]);return e}Vr.prototype.eol=function(){return this.pos>=this.string.length},Vr.prototype.sol=function(){return this.pos==this.lineStart},Vr.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Vr.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Vr.prototype.eat=function(r){var t=this.string.charAt(this.pos);if("string"==typeof r?t==r:t&&(r.test?r.test(t):r(t)))return++this.pos,t},Vr.prototype.eatWhile=function(r){for(var t=this.pos;this.eat(r););return this.pos>t},Vr.prototype.eatSpace=function(){for(var r=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>r},Vr.prototype.skipToEnd=function(){this.pos=this.string.length},Vr.prototype.skipTo=function(r){var t=this.string.indexOf(r,this.pos);if(t>-1)return this.pos=t,!0},Vr.prototype.backUp=function(r){this.pos-=r},Vr.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=P(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?P(this.string,this.lineStart,this.tabSize):0)},Vr.prototype.indentation=function(){return P(this.string,null,this.tabSize)-(this.lineStart?P(this.string,this.lineStart,this.tabSize):0)},Vr.prototype.match=function(r,t,e){if("string"!=typeof r){var n=this.string.slice(this.pos).match(r);return n&&n.index>0?null:(n&&!1!==t&&(this.pos+=n[0].length),n)}var i=function(r){return e?r.toLowerCase():r};if(i(this.string.substr(this.pos,r.length))==i(r))return!1!==t&&(this.pos+=r.length),!0},Vr.prototype.current=function(){return this.string.slice(this.start,this.pos)},Vr.prototype.hideFirstChars=function(r,t){this.lineStart+=r;try{return t()}finally{this.lineStart-=r}},Vr.prototype.lookAhead=function(r){var t=this.lineOracle;return t&&t.lookAhead(r)},Vr.prototype.baseToken=function(){var r=this.lineOracle;return r&&r.baseToken(this.pos)};var dt=function(r,t){this.state=r,this.lookAhead=t},ht=function(r,t,e,n){this.state=t,this.doc=r,this.line=e,this.maxLookAhead=n||0,this.baseTokens=null,this.baseTokenPos=1};function vt(r,t,e,n){var i=[r.state.modeGen],o={};Ct(r,t.text,r.doc.mode,e,(function(r,t){return i.push(r,t)}),o,n);for(var a=e.state,u=function(n){e.baseTokens=i;var u=r.state.overlays[n],l=1,s=0;e.state=!0,Ct(r,t.text,u.mode,e,(function(r,t){for(var e=l;s<r;){var n=i[l];n>r&&i.splice(l,1,r,i[l+1],n),l+=2,s=Math.min(r,n)}if(t)if(u.opaque)i.splice(e,l-e,r,"overlay "+t),l=e+2;else for(;e<l;e+=2){var o=i[e+1];i[e+1]=(o?o+" ":"")+"overlay "+t}}),o),e.state=a,e.baseTokens=null,e.baseTokenPos=1},l=0;l<r.state.overlays.length;++l)u(l);return{styles:i,classes:o.bgClass||o.textClass?o:null}}function mt(r,t,e){if(!t.styles||t.styles[0]!=r.state.modeGen){var n=pt(r,Zr(t)),i=t.text.length>r.options.maxHighlightLength&&Gr(r.doc.mode,n.state),o=vt(r,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),e===r.doc.highlightFrontier&&(r.doc.modeFrontier=Math.max(r.doc.modeFrontier,++r.doc.highlightFrontier))}return t.styles}function pt(r,t,e){var n=r.doc,i=r.display;if(!n.mode.startState)return new ht(n,!0,t);var o=function(r,t,e){for(var n,i,o=r.doc,a=e?-1:t-(r.doc.mode.innerMode?1e3:100),u=t;u>a;--u){if(u<=o.first)return o.first;var l=Qr(o,u-1),s=l.stateAfter;if(s&&(!e||u+(s instanceof dt?s.lookAhead:0)<=o.modeFrontier))return u;var c=P(l.text,null,r.options.tabSize);(null==i||n>c)&&(i=u-1,n=c)}return i}(r,t,e),a=o>n.first&&Qr(n,o-1).stateAfter,u=a?ht.fromSaved(n,a,o):new ht(n,Kr(n.mode),o);return n.iter(o,t,(function(e){gt(r,e.text,u);var n=u.line;e.stateAfter=n==t-1||n%5==0||n>=i.viewFrom&&n<i.viewTo?u.save():null,u.nextLine()})),e&&(n.modeFrontier=u.line),u}function gt(r,t,e,n){var i=r.doc.mode,o=new Vr(t,r.options.tabSize,e);for(o.start=o.pos=n||0,""==t&&bt(i,e.state);!o.eol();)wt(i,o,e.state),o.start=o.pos}function bt(r,t){if(r.blankLine)return r.blankLine(t);if(r.innerMode){var e=Hr(r,t);return e.mode.blankLine?e.mode.blankLine(e.state):void 0}}function wt(r,t,e,n){for(var i=0;i<10;i++){n&&(n[0]=Hr(r,e).mode);var o=r.token(t,e);if(t.pos>t.start)return o}throw new Error("Mode "+r.name+" failed to advance stream.")}ht.prototype.lookAhead=function(r){var t=this.doc.getLine(this.line+r);return null!=t&&r>this.maxLookAhead&&(this.maxLookAhead=r),t},ht.prototype.baseToken=function(r){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=r;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-r}},ht.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},ht.fromSaved=function(r,t,e){return t instanceof dt?new ht(r,Gr(r.mode,t.state),e,t.lookAhead):new ht(r,Gr(r.mode,t),e)},ht.prototype.save=function(r){var t=!1!==r?Gr(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new dt(t,this.maxLookAhead):t};var kt=function(r,t,e){this.start=r.start,this.end=r.pos,this.string=r.current(),this.type=t||null,this.state=e};function yt(r,t,e,n){var i,o,a=r.doc,u=a.mode,l=Qr(a,(t=ct(a,t)).line),s=pt(r,t.line,e),c=new Vr(l.text,r.options.tabSize,s);for(n&&(o=[]);(n||c.pos<t.ch)&&!c.eol();)c.start=c.pos,i=wt(u,c,s.state),n&&o.push(new kt(c,i,Gr(a.mode,s.state)));return n?o:new kt(c,i,s.state)}function xt(r,t){if(r)for(;;){var e=r.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!e)break;r=r.slice(0,e.index)+r.slice(e.index+e[0].length);var n=e[1]?"bgClass":"textClass";null==t[n]?t[n]=e[2]:new RegExp("(?:^|\\s)"+e[2]+"(?:$|\\s)").test(t[n])||(t[n]+=" "+e[2])}return r}function Ct(r,t,e,n,i,o,a){var u=e.flattenSpans;null==u&&(u=r.options.flattenSpans);var l,s=0,c=null,f=new Vr(t,r.options.tabSize,n),d=r.options.addModeClass&&[null];for(""==t&&xt(bt(e,n.state),o);!f.eol();){if(f.pos>r.options.maxHighlightLength?(u=!1,a&&gt(r,t,n,f.pos),f.pos=t.length,l=null):l=xt(wt(e,f,n.state,d),o),d){var h=d[0].name;h&&(l="m-"+(l?h+" "+l:h))}if(!u||c!=l){for(;s<f.start;)i(s=Math.min(f.start,s+5e3),c);c=l}f.start=f.pos}for(;s<f.pos;){var v=Math.min(f.pos,s+5e3);i(v,c),s=v}}var Mt=!1,At=!1;function Lt(r,t,e){this.marker=r,this.from=t,this.to=e}function St(r,t){if(r)for(var e=0;e<r.length;++e){var n=r[e];if(n.marker==t)return n}}function Tt(r,t){for(var e,n=0;n<r.length;++n)r[n]!=t&&(e||(e=[])).push(r[n]);return e}function Nt(r,t){if(t.full)return null;var e=tt(r,t.from.line)&&Qr(r,t.from.line).markedSpans,n=tt(r,t.to.line)&&Qr(r,t.to.line).markedSpans;if(!e&&!n)return null;var i=t.from.ch,o=t.to.ch,a=0==it(t.from,t.to),u=function(r,t,e){var n;if(r)for(var i=0;i<r.length;++i){var o=r[i],a=o.marker;null!=o.from&&!(a.inclusiveLeft?o.from<=t:o.from<t)&&(o.from!=t||"bookmark"!=a.type||e&&o.marker.insertLeft)||(n||(n=[])).push(new Lt(a,o.from,null==o.to||(a.inclusiveRight?o.to>=t:o.to>t)?null:o.to))}return n}(e,i,a),l=function(r,t,e){var n;if(r)for(var i=0;i<r.length;++i){var o=r[i],a=o.marker;(null==o.to||(a.inclusiveRight?o.to>=t:o.to>t)||o.from==t&&"bookmark"==a.type&&(!e||o.marker.insertLeft))&&(n||(n=[])).push(new Lt(a,null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t)?null:o.from-t,null==o.to?null:o.to-t))}return n}(n,o,a),s=1==t.text.length,c=Y(t.text).length+(s?i:0);if(u)for(var f=0;f<u.length;++f){var d=u[f];if(null==d.to){var h=St(l,d.marker);h?s&&(d.to=null==h.to?null:h.to+c):d.to=i}}if(l)for(var v=0;v<l.length;++v){var m=l[v];null!=m.to&&(m.to+=c),null==m.from?St(u,m.marker)||(m.from=c,s&&(u||(u=[])).push(m)):(m.from+=c,s&&(u||(u=[])).push(m))}u&&(u=Et(u)),l&&l!=u&&(l=Et(l));var p=[u];if(!s){var g,b=t.text.length-2;if(b>0&&u)for(var w=0;w<u.length;++w)null==u[w].to&&(g||(g=[])).push(new Lt(u[w].marker,null,null));for(var k=0;k<b;++k)p.push(g);p.push(l)}return p}function Et(r){for(var t=0;t<r.length;++t){var e=r[t];null!=e.from&&e.from==e.to&&!1!==e.marker.clearWhenEmpty&&r.splice(t--,1)}return r.length?r:null}function Dt(r){var t=r.markedSpans;if(t){for(var e=0;e<t.length;++e)t[e].marker.detachLine(r);r.markedSpans=null}}function zt(r,t){if(t){for(var e=0;e<t.length;++e)t[e].marker.attachLine(r);r.markedSpans=t}}function jt(r){return r.inclusiveLeft?-1:0}function Bt(r){return r.inclusiveRight?1:0}function It(r,t){var e=r.lines.length-t.lines.length;if(0!=e)return e;var n=r.find(),i=t.find(),o=it(n.from,i.from)||jt(r)-jt(t);return o?-o:it(n.to,i.to)||Bt(r)-Bt(t)||t.id-r.id}function Rt(r,t){var e,n=At&&r.markedSpans;if(n)for(var i=void 0,o=0;o<n.length;++o)(i=n[o]).marker.collapsed&&null==(t?i.from:i.to)&&(!e||It(e,i.marker)<0)&&(e=i.marker);return e}function Ft(r){return Rt(r,!0)}function Ot(r){return Rt(r,!1)}function Ut(r,t){var e,n=At&&r.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)&&(!e||It(e,o.marker)<0)&&(e=o.marker)}return e}function _t(r,t,e,n,i){var o=Qr(r,t),a=At&&o.markedSpans;if(a)for(var u=0;u<a.length;++u){var l=a[u];if(l.marker.collapsed){var s=l.marker.find(0),c=it(s.from,e)||jt(l.marker)-jt(i),f=it(s.to,n)||Bt(l.marker)-Bt(i);if(!(c>=0&&f<=0||c<=0&&f>=0)&&(c<=0&&(l.marker.inclusiveRight&&i.inclusiveLeft?it(s.to,e)>=0:it(s.to,e)>0)||c>=0&&(l.marker.inclusiveRight&&i.inclusiveLeft?it(s.from,n)<=0:it(s.from,n)<0)))return!0}}}function Pt(r){for(var t;t=Ft(r);)r=t.find(-1,!0).line;return r}function qt(r,t){var e=Qr(r,t),n=Pt(e);return e==n?t:Zr(n)}function Wt(r,t){if(t>r.lastLine())return t;var e,n=Qr(r,t);if(!$t(r,n))return t;for(;e=Ot(n);)n=e.find(1,!0).line;return Zr(n)+1}function $t(r,t){var e=At&&t.markedSpans;if(e)for(var n=void 0,i=0;i<e.length;++i)if((n=e[i]).marker.collapsed){if(null==n.from)return!0;if(!n.marker.widgetNode&&0==n.from&&n.marker.inclusiveLeft&&Gt(r,t,n))return!0}}function Gt(r,t,e){if(null==e.to){var n=e.marker.find(1,!0);return Gt(r,n.line,St(n.line.markedSpans,e.marker))}if(e.marker.inclusiveRight&&e.to==t.text.length)return!0;for(var i=void 0,o=0;o<t.markedSpans.length;++o)if((i=t.markedSpans[o]).marker.collapsed&&!i.marker.widgetNode&&i.from==e.to&&(null==i.to||i.to!=e.from)&&(i.marker.inclusiveLeft||e.marker.inclusiveRight)&&Gt(r,t,i))return!0}function Ht(r){for(var t=0,e=(r=Pt(r)).parent,n=0;n<e.lines.length;++n){var i=e.lines[n];if(i==r)break;t+=i.height}for(var o=e.parent;o;o=(e=o).parent)for(var a=0;a<o.children.length;++a){var u=o.children[a];if(u==e)break;t+=u.height}return t}function Kt(r){if(0==r.height)return 0;for(var t,e=r.text.length,n=r;t=Ft(n);){var i=t.find(0,!0);n=i.from.line,e+=i.from.ch-i.to.ch}for(n=r;t=Ot(n);){var o=t.find(0,!0);e-=n.text.length-o.from.ch,e+=(n=o.to.line).text.length-o.to.ch}return e}function Vt(r){var t=r.display,e=r.doc;t.maxLine=Qr(e,e.first),t.maxLineLength=Kt(t.maxLine),t.maxLineChanged=!0,e.iter((function(r){var e=Kt(r);e>t.maxLineLength&&(t.maxLineLength=e,t.maxLine=r)}))}var Qt=function(r,t,e){this.text=r,zt(this,t),this.height=e?e(this):1};function Jt(r){r.parent=null,Dt(r)}Qt.prototype.lineNo=function(){return Zr(this)},yr(Qt);var Yt={},Xt={};function Zt(r,t){if(!r||/^\s*$/.test(r))return null;var e=t.addModeClass?Xt:Yt;return e[r]||(e[r]=r.replace(/\S+/g,"cm-$&"))}function re(r,t){var e=D("span",null,null,l?"padding-right: .1px":null),n={pre:D("pre",[e],"CodeMirror-line"),content:e,col:0,pos:0,cm:r,trailingSpace:!1,splitSpaces:r.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=ee,zr(r.display.measure)&&(a=dr(o,r.doc.direction))&&(n.addToken=ne(n.addToken,a)),n.map=[],oe(o,n,mt(r,o,t!=r.display.externalMeasured&&Zr(o))),o.styleClasses&&(o.styleClasses.bgClass&&(n.bgClass=I(o.styleClasses.bgClass,n.bgClass||"")),o.styleClasses.textClass&&(n.textClass=I(o.styleClasses.textClass,n.textClass||""))),0==n.map.length&&n.map.push(0,0,n.content.appendChild(Dr(r.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({}))}if(l){var u=n.content.lastChild;(/\bcm-tab\b/.test(u.className)||u.querySelector&&u.querySelector(".cm-tab"))&&(n.content.className="cm-tab-wrap-hack")}return gr(r,"renderLine",r,t.line,n.pre),n.pre.className&&(n.textClass=I(n.pre.className,n.textClass||"")),n}function te(r){var t=E("span","•","cm-invalidchar");return t.title="\\u"+r.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function ee(r,t,e,n,i,o,l){if(t){var s,c=r.splitSpaces?function(r,t){if(r.length>1&&!/ /.test(r))return r;for(var e=t,n="",i=0;i<r.length;i++){var o=r.charAt(i);" "!=o||!e||i!=r.length-1&&32!=r.charCodeAt(i+1)||(o=" "),n+=o,e=" "==o}return n}(t,r.trailingSpace):t,f=r.cm.state.specialChars,d=!1;if(f.test(t)){s=document.createDocumentFragment();for(var h=0;;){f.lastIndex=h;var v=f.exec(t),m=v?v.index-h:t.length-h;if(m){var p=document.createTextNode(c.slice(h,h+m));s.appendChild(a&&u<9?E("span",[p]):p),r.map.push(r.pos,r.pos+m,p),r.col+=m,r.pos+=m}if(!v)break;h+=m+1;var g=void 0;if("\t"==v[0]){var b=r.cm.options.tabSize,w=b-r.col%b;(g=s.appendChild(E("span",J(w),"cm-tab"))).setAttribute("role","presentation"),g.setAttribute("cm-text","\t"),r.col+=w}else"\r"==v[0]||"\n"==v[0]?((g=s.appendChild(E("span","\r"==v[0]?"␍":"␤","cm-invalidchar"))).setAttribute("cm-text",v[0]),r.col+=1):((g=r.cm.options.specialCharPlaceholder(v[0])).setAttribute("cm-text",v[0]),s.appendChild(a&&u<9?E("span",[g]):g),r.col+=1);r.map.push(r.pos,r.pos+1,g),r.pos++}}else r.col+=t.length,s=document.createTextNode(c),r.map.push(r.pos,r.pos+t.length,s),a&&u<9&&(d=!0),r.pos+=t.length;if(r.trailingSpace=32==c.charCodeAt(t.length-1),e||n||i||d||o||l){var k=e||"";n&&(k+=n),i&&(k+=i);var y=E("span",[s],k,o);if(l)for(var x in l)l.hasOwnProperty(x)&&"style"!=x&&"class"!=x&&y.setAttribute(x,l[x]);return r.content.appendChild(y)}r.content.appendChild(s)}}function ne(r,t){return function(e,n,i,o,a,u,l){i=i?i+" cm-force-border":"cm-force-border";for(var s=e.pos,c=s+n.length;;){for(var f=void 0,d=0;d<t.length&&!((f=t[d]).to>s&&f.from<=s);d++);if(f.to>=c)return r(e,n,i,o,a,u,l);r(e,n.slice(0,f.to-s),i,o,null,u,l),o=null,n=n.slice(f.to-s),s=f.to}}}function ie(r,t,e,n){var i=!n&&e.widgetNode;i&&r.map.push(r.pos,r.pos+t,i),!n&&r.cm.display.input.needsContentAttribute&&(i||(i=r.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",e.id)),i&&(r.cm.display.input.setUneditable(i),r.content.appendChild(i)),r.pos+=t,r.trailingSpace=!1}function oe(r,t,e){var n=r.markedSpans,i=r.text,o=0;if(n)for(var a,u,l,s,c,f,d,h=i.length,v=0,m=1,p="",g=0;;){if(g==v){l=s=c=u="",d=null,f=null,g=1/0;for(var b=[],w=void 0,k=0;k<n.length;++k){var y=n[k],x=y.marker;if("bookmark"==x.type&&y.from==v&&x.widgetNode)b.push(x);else if(y.from<=v&&(null==y.to||y.to>v||x.collapsed&&y.to==v&&y.from==v)){if(null!=y.to&&y.to!=v&&g>y.to&&(g=y.to,s=""),x.className&&(l+=" "+x.className),x.css&&(u=(u?u+";":"")+x.css),x.startStyle&&y.from==v&&(c+=" "+x.startStyle),x.endStyle&&y.to==g&&(w||(w=[])).push(x.endStyle,y.to),x.title&&((d||(d={})).title=x.title),x.attributes)for(var C in x.attributes)(d||(d={}))[C]=x.attributes[C];x.collapsed&&(!f||It(f.marker,x)<0)&&(f=y)}else y.from>v&&g>y.from&&(g=y.from)}if(w)for(var M=0;M<w.length;M+=2)w[M+1]==g&&(s+=" "+w[M]);if(!f||f.from==v)for(var A=0;A<b.length;++A)ie(t,0,b[A]);if(f&&(f.from||0)==v){if(ie(t,(null==f.to?h+1:f.to)-v,f.marker,null==f.from),null==f.to)return;f.to==v&&(f=!1)}}if(v>=h)break;for(var L=Math.min(h,g);;){if(p){var S=v+p.length;if(!f){var T=S>L?p.slice(0,L-v):p;t.addToken(t,T,a?a+l:l,c,v+T.length==g?s:"",u,d)}if(S>=L){p=p.slice(L-v),v=L;break}v=S,c=""}p=i.slice(o,o=e[m++]),a=Zt(e[m++],t.cm.options)}}else for(var N=1;N<e.length;N+=2)t.addToken(t,i.slice(o,o=e[N]),Zt(e[N+1],t.cm.options))}function ae(r,t,e){this.line=t,this.rest=function(r){for(var t,e;t=Ot(r);)r=t.find(1,!0).line,(e||(e=[])).push(r);return e}(t),this.size=this.rest?Zr(Y(this.rest))-e+1:1,this.node=this.text=null,this.hidden=$t(r,t)}function ue(r,t,e){for(var n,i=[],o=t;o<e;o=n){var a=new ae(r.doc,Qr(r.doc,o),o);n=o+a.size,i.push(a)}return i}var le=null;var se=null;function ce(r,t){var e=mr(r,t);if(e.length){var n,i=Array.prototype.slice.call(arguments,2);le?n=le.delayedCallbacks:se?n=se:(n=se=[],setTimeout(fe,0));for(var o=function(r){n.push((function(){return e[r].apply(null,i)}))},a=0;a<e.length;++a)o(a)}}function fe(){var r=se;se=null;for(var t=0;t<r.length;++t)r[t]()}function de(r,t,e,n){for(var i=0;i<t.changes.length;i++){var o=t.changes[i];"text"==o?me(r,t):"gutter"==o?ge(r,t,e,n):"class"==o?pe(r,t):"widget"==o&&be(r,t,n)}t.changes=null}function he(r){return r.node==r.text&&(r.node=E("div",null,null,"position: relative"),r.text.parentNode&&r.text.parentNode.replaceChild(r.node,r.text),r.node.appendChild(r.text),a&&u<8&&(r.node.style.zIndex=2)),r.node}function ve(r,t){var e=r.display.externalMeasured;return e&&e.line==t.line?(r.display.externalMeasured=null,t.measure=e.measure,e.built):re(r,t)}function me(r,t){var e=t.text.className,n=ve(r,t);t.text==t.node&&(t.node=n.pre),t.text.parentNode.replaceChild(n.pre,t.text),t.text=n.pre,n.bgClass!=t.bgClass||n.textClass!=t.textClass?(t.bgClass=n.bgClass,t.textClass=n.textClass,pe(r,t)):e&&(t.text.className=e)}function pe(r,t){(function(r,t){var e=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(e&&(e+=" CodeMirror-linebackground"),t.background)e?t.background.className=e:(t.background.parentNode.removeChild(t.background),t.background=null);else if(e){var n=he(t);t.background=n.insertBefore(E("div",null,e),n.firstChild),r.display.input.setUneditable(t.background)}})(r,t),t.line.wrapClass?he(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className=""),t.text.className=(t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass)||""}function ge(r,t,e,n){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=he(t);t.gutterBackground=E("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(r.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px; width: "+n.gutterTotalWidth+"px"),r.display.input.setUneditable(t.gutterBackground),i.insertBefore(t.gutterBackground,t.text)}var o=t.line.gutterMarkers;if(r.options.lineNumbers||o){var a=he(t),u=t.gutter=E("div",null,"CodeMirror-gutter-wrapper","left: "+(r.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px");if(u.setAttribute("aria-hidden","true"),r.display.input.setUneditable(u),a.insertBefore(u,t.text),t.line.gutterClass&&(u.className+=" "+t.line.gutterClass),!r.options.lineNumbers||o&&o["CodeMirror-linenumbers"]||(t.lineNumber=u.appendChild(E("div",et(r.options,e),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+n.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+r.display.lineNumInnerWidth+"px"))),o)for(var l=0;l<r.display.gutterSpecs.length;++l){var s=r.display.gutterSpecs[l].className,c=o.hasOwnProperty(s)&&o[s];c&&u.appendChild(E("div",[c],"CodeMirror-gutter-elt","left: "+n.gutterLeft[s]+"px; width: "+n.gutterWidth[s]+"px"))}}}function be(r,t,e){t.alignable&&(t.alignable=null);for(var n=A("CodeMirror-linewidget"),i=t.node.firstChild,o=void 0;i;i=o)o=i.nextSibling,n.test(i.className)&&t.node.removeChild(i);ke(r,t,e)}function we(r,t,e,n){var i=ve(r,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),pe(r,t),ge(r,t,e,n),ke(r,t,n),t.node}function ke(r,t,e){if(ye(r,t.line,t,e,!0),t.rest)for(var n=0;n<t.rest.length;n++)ye(r,t.rest[n],t,e,!1)}function ye(r,t,e,n,i){if(t.widgets)for(var o=he(e),a=0,u=t.widgets;a<u.length;++a){var l=u[a],s=E("div",[l.node],"CodeMirror-linewidget"+(l.className?" "+l.className:""));l.handleMouseEvents||s.setAttribute("cm-ignore-events","true"),xe(l,s,e,n),r.display.input.setUneditable(s),i&&l.above?o.insertBefore(s,e.gutter||e.text):o.appendChild(s),ce(l,"redraw")}}function xe(r,t,e,n){if(r.noHScroll){(e.alignable||(e.alignable=[])).push(t);var i=n.wrapperWidth;t.style.left=n.fixedPos+"px",r.coverGutter||(i-=n.gutterTotalWidth,t.style.paddingLeft=n.gutterTotalWidth+"px"),t.style.width=i+"px"}r.coverGutter&&(t.style.zIndex=5,t.style.position="relative",r.noHScroll||(t.style.marginLeft=-n.gutterTotalWidth+"px"))}function Ce(r){if(null!=r.height)return r.height;var t=r.doc.cm;if(!t)return 0;if(!z(document.body,r.node)){var e="position: relative;";r.coverGutter&&(e+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),r.noHScroll&&(e+="width: "+t.display.wrapper.clientWidth+"px;"),N(t.display.measure,E("div",[r.node],null,e))}return r.height=r.node.parentNode.offsetHeight}function Me(r,t){for(var e=Lr(t);e!=r.wrapper;e=e.parentNode)if(!e||1==e.nodeType&&"true"==e.getAttribute("cm-ignore-events")||e.parentNode==r.sizer&&e!=r.mover)return!0}function Ae(r){return r.lineSpace.offsetTop}function Le(r){return r.mover.offsetHeight-r.lineSpace.offsetHeight}function Se(r){if(r.cachedPaddingH)return r.cachedPaddingH;var t=N(r.measure,E("pre","x","CodeMirror-line-like")),e=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,n={left:parseInt(e.paddingLeft),right:parseInt(e.paddingRight)};return isNaN(n.left)||isNaN(n.right)||(r.cachedPaddingH=n),n}function Te(r){return 50-r.display.nativeBarWidth}function Ne(r){return r.display.scroller.clientWidth-Te(r)-r.display.barWidth}function Ee(r){return r.display.scroller.clientHeight-Te(r)-r.display.barHeight}function De(r,t,e){if(r.line==t)return{map:r.measure.map,cache:r.measure.cache};if(r.rest){for(var n=0;n<r.rest.length;n++)if(r.rest[n]==t)return{map:r.measure.maps[n],cache:r.measure.caches[n]};for(var i=0;i<r.rest.length;i++)if(Zr(r.rest[i])>e)return{map:r.measure.maps[i],cache:r.measure.caches[i],before:!0}}}function ze(r,t,e,n){return Ie(r,Be(r,t),e,n)}function je(r,t){if(t>=r.display.viewFrom&&t<r.display.viewTo)return r.display.view[hn(r,t)];var e=r.display.externalMeasured;return e&&t>=e.lineN&&t<e.lineN+e.size?e:void 0}function Be(r,t){var e=Zr(t),n=je(r,e);n&&!n.text?n=null:n&&n.changes&&(de(r,n,e,ln(r)),r.curOp.forceUpdate=!0),n||(n=function(r,t){var e=Zr(t=Pt(t)),n=r.display.externalMeasured=new ae(r.doc,t,e);n.lineN=e;var i=n.built=re(r,n);return n.text=i.pre,N(r.display.lineMeasure,i.pre),n}(r,t));var i=De(n,t,e);return{line:t,view:n,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Ie(r,t,e,n,i){t.before&&(e=-1);var o,l=e+(n||"");return t.cache.hasOwnProperty(l)?o=t.cache[l]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(function(r,t,e){var n=r.options.lineWrapping,i=n&&Ne(r);if(!t.measure.heights||n&&t.measure.width!=i){var o=t.measure.heights=[];if(n){t.measure.width=i;for(var a=t.text.firstChild.getClientRects(),u=0;u<a.length-1;u++){var l=a[u],s=a[u+1];Math.abs(l.bottom-s.bottom)>2&&o.push((l.bottom+s.top)/2-e.top)}}o.push(e.bottom-e.top)}}(r,t.view,t.rect),t.hasHeights=!0),(o=function(r,t,e,n){var i,o=Oe(t.map,e,n),l=o.node,s=o.start,c=o.end,f=o.collapse;if(3==l.nodeType){for(var d=0;d<4;d++){for(;s&&ar(t.line.text.charAt(o.coverStart+s));)--s;for(;o.coverStart+c<o.coverEnd&&ar(t.line.text.charAt(o.coverStart+c));)++c;if((i=a&&u<9&&0==s&&c==o.coverEnd-o.coverStart?l.parentNode.getBoundingClientRect():Ue(L(l,s,c).getClientRects(),n)).left||i.right||0==s)break;c=s,s-=1,f="right"}a&&u<11&&(i=function(r,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!function(r){if(null!=Fr)return Fr;var t=N(r,E("span","x")),e=t.getBoundingClientRect(),n=L(t,0,1).getBoundingClientRect();return Fr=Math.abs(e.left-n.left)>1}(r))return t;var e=screen.logicalXDPI/screen.deviceXDPI,n=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*e,right:t.right*e,top:t.top*n,bottom:t.bottom*n}}(r.display.measure,i))}else{var h;s>0&&(f=n="right"),i=r.options.lineWrapping&&(h=l.getClientRects()).length>1?h["right"==n?h.length-1:0]:l.getBoundingClientRect()}if(a&&u<9&&!s&&(!i||!i.left&&!i.right)){var v=l.parentNode.getClientRects()[0];i=v?{left:v.left,right:v.left+un(r.display),top:v.top,bottom:v.bottom}:Fe}for(var m=i.top-t.rect.top,p=i.bottom-t.rect.top,g=(m+p)/2,b=t.view.measure.heights,w=0;w<b.length-1&&!(g<b[w]);w++);var k={left:("right"==f?i.right:i.left)-t.rect.left,right:("left"==f?i.left:i.right)-t.rect.left,top:w?b[w-1]:0,bottom:b[w]};return i.left||i.right||(k.bogus=!0),r.options.singleCursorHeightPerLine||(k.rtop=m,k.rbottom=p),k}(r,t,e,n)).bogus||(t.cache[l]=o)),{left:o.left,right:o.right,top:i?o.rtop:o.top,bottom:i?o.rbottom:o.bottom}}var Re,Fe={left:0,right:0,top:0,bottom:0};function Oe(r,t,e){for(var n,i,o,a,u,l,s=0;s<r.length;s+=3)if(l=r[s+1],t<(u=r[s])?(i=0,o=1,a="left"):t<l?o=1+(i=t-u):(s==r.length-3||t==l&&r[s+3]>t)&&(i=(o=l-u)-1,t>=l&&(a="right")),null!=i){if(n=r[s+2],u==l&&e==(n.insertLeft?"left":"right")&&(a=e),"left"==e&&0==i)for(;s&&r[s-2]==r[s-3]&&r[s-1].insertLeft;)n=r[2+(s-=3)],a="left";if("right"==e&&i==l-u)for(;s<r.length-3&&r[s+3]==r[s+4]&&!r[s+5].insertLeft;)n=r[(s+=3)+2],a="right";break}return{node:n,start:i,end:o,collapse:a,coverStart:u,coverEnd:l}}function Ue(r,t){var e=Fe;if("left"==t)for(var n=0;n<r.length&&(e=r[n]).left==e.right;n++);else for(var i=r.length-1;i>=0&&(e=r[i]).left==e.right;i--);return e}function _e(r){if(r.measure&&(r.measure.cache={},r.measure.heights=null,r.rest))for(var t=0;t<r.rest.length;t++)r.measure.caches[t]={}}function Pe(r){r.display.externalMeasure=null,T(r.display.lineMeasure);for(var t=0;t<r.display.view.length;t++)_e(r.display.view[t])}function qe(r){Pe(r),r.display.cachedCharWidth=r.display.cachedTextHeight=r.display.cachedPaddingH=null,r.options.lineWrapping||(r.display.maxLineChanged=!0),r.display.lineNumChars=null}function We(r){return c&&g?-(r.body.getBoundingClientRect().left-parseInt(getComputedStyle(r.body).marginLeft)):r.defaultView.pageXOffset||(r.documentElement||r.body).scrollLeft}function $e(r){return c&&g?-(r.body.getBoundingClientRect().top-parseInt(getComputedStyle(r.body).marginTop)):r.defaultView.pageYOffset||(r.documentElement||r.body).scrollTop}function Ge(r){var t=Pt(r).widgets,e=0;if(t)for(var n=0;n<t.length;++n)t[n].above&&(e+=Ce(t[n]));return e}function He(r,t,e,n,i){if(!i){var o=Ge(t);e.top+=o,e.bottom+=o}if("line"==n)return e;n||(n="local");var a=Ht(t);if("local"==n?a+=Ae(r.display):a-=r.display.viewOffset,"page"==n||"window"==n){var u=r.display.lineSpace.getBoundingClientRect();a+=u.top+("window"==n?0:$e(F(r)));var l=u.left+("window"==n?0:We(F(r)));e.left+=l,e.right+=l}return e.top+=a,e.bottom+=a,e}function Ke(r,t,e){if("div"==e)return t;var n=t.left,i=t.top;if("page"==e)n-=We(F(r)),i-=$e(F(r));else if("local"==e||!e){var o=r.display.sizer.getBoundingClientRect();n+=o.left,i+=o.top}var a=r.display.lineSpace.getBoundingClientRect();return{left:n-a.left,top:i-a.top}}function Ve(r,t,e,n,i){return n||(n=Qr(r.doc,t.line)),He(r,n,ze(r,n,t.ch,i),e)}function Qe(r,t,e,n,i,o){function a(t,a){var u=Ie(r,i,t,a?"right":"left",o);return a?u.left=u.right:u.right=u.left,He(r,n,u,e)}n=n||Qr(r.doc,t.line),i||(i=Be(r,n));var u=dr(n,r.doc.direction),l=t.ch,s=t.sticky;if(l>=n.text.length?(l=n.text.length,s="before"):l<=0&&(l=0,s="after"),!u)return a("before"==s?l-1:l,"before"==s);function c(r,t,e){return a(e?r-1:r,1==u[t].level!=e)}var f=cr(u,l,s),d=sr,h=c(l,f,"before"==s);return null!=d&&(h.other=c(l,d,"before"!=s)),h}function Je(r,t){var e=0;t=ct(r.doc,t),r.options.lineWrapping||(e=un(r.display)*t.ch);var n=Qr(r.doc,t.line),i=Ht(n)+Ae(r.display);return{left:e,right:e,top:i,bottom:i+n.height}}function Ye(r,t,e,n,i){var o=nt(r,t,e);return o.xRel=i,n&&(o.outside=n),o}function Xe(r,t,e){var n=r.doc;if((e+=r.display.viewOffset)<0)return Ye(n.first,0,null,-1,-1);var i=rt(n,e),o=n.first+n.size-1;if(i>o)return Ye(n.first+n.size-1,Qr(n,o).text.length,null,1,1);t<0&&(t=0);for(var a=Qr(n,i);;){var u=en(r,a,i,t,e),l=Ut(a,u.ch+(u.xRel>0||u.outside>0?1:0));if(!l)return u;var s=l.find(1);if(s.line==i)return s;a=Qr(n,i=s.line)}}function Ze(r,t,e,n){n-=Ge(t);var i=t.text.length,o=lr((function(t){return Ie(r,e,t-1).bottom<=n}),i,0);return{begin:o,end:i=lr((function(t){return Ie(r,e,t).top>n}),o,i)}}function rn(r,t,e,n){return e||(e=Be(r,t)),Ze(r,t,e,He(r,t,Ie(r,e,n),"line").top)}function tn(r,t,e,n){return!(r.bottom<=e)&&(r.top>e||(n?r.left:r.right)>t)}function en(r,t,e,n,i){i-=Ht(t);var o=Be(r,t),a=Ge(t),u=0,l=t.text.length,s=!0,c=dr(t,r.doc.direction);if(c){var f=(r.options.lineWrapping?on:nn)(r,t,e,o,c,n,i);u=(s=1!=f.level)?f.from:f.to-1,l=s?f.to:f.from-1}var d,h,v=null,m=null,p=lr((function(t){var e=Ie(r,o,t);return e.top+=a,e.bottom+=a,!!tn(e,n,i,!1)&&(e.top<=i&&e.left<=n&&(v=t,m=e),!0)}),u,l),g=!1;if(m){var b=n-m.left<m.right-n,w=b==s;p=v+(w?0:1),h=w?"after":"before",d=b?m.left:m.right}else{s||p!=l&&p!=u||p++,h=0==p?"after":p==t.text.length?"before":Ie(r,o,p-(s?1:0)).bottom+a<=i==s?"after":"before";var k=Qe(r,nt(e,p,h),"line",t,o);d=k.left,g=i<k.top?-1:i>=k.bottom?1:0}return Ye(e,p=ur(t.text,p,1),h,g,n-d)}function nn(r,t,e,n,i,o,a){var u=lr((function(u){var l=i[u],s=1!=l.level;return tn(Qe(r,nt(e,s?l.to:l.from,s?"before":"after"),"line",t,n),o,a,!0)}),0,i.length-1),l=i[u];if(u>0){var s=1!=l.level,c=Qe(r,nt(e,s?l.from:l.to,s?"after":"before"),"line",t,n);tn(c,o,a,!0)&&c.top>a&&(l=i[u-1])}return l}function on(r,t,e,n,i,o,a){var u=Ze(r,t,n,a),l=u.begin,s=u.end;/\s/.test(t.text.charAt(s-1))&&s--;for(var c=null,f=null,d=0;d<i.length;d++){var h=i[d];if(!(h.from>=s||h.to<=l)){var v=Ie(r,n,1!=h.level?Math.min(s,h.to)-1:Math.max(l,h.from)).right,m=v<o?o-v+1e9:v-o;(!c||f>m)&&(c=h,f=m)}}return 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}),c}function an(r){if(null!=r.cachedTextHeight)return r.cachedTextHeight;if(null==Re){Re=E("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Re.appendChild(document.createTextNode("x")),Re.appendChild(E("br"));Re.appendChild(document.createTextNode("x"))}N(r.measure,Re);var e=Re.offsetHeight/50;return e>3&&(r.cachedTextHeight=e),T(r.measure),e||1}function un(r){if(null!=r.cachedCharWidth)return r.cachedCharWidth;var t=E("span","xxxxxxxxxx"),e=E("pre",[t],"CodeMirror-line-like");N(r.measure,e);var n=t.getBoundingClientRect(),i=(n.right-n.left)/10;return i>2&&(r.cachedCharWidth=i),i||10}function ln(r){for(var t=r.display,e={},n={},i=t.gutters.clientLeft,o=t.gutters.firstChild,a=0;o;o=o.nextSibling,++a){var u=r.display.gutterSpecs[a].className;e[u]=o.offsetLeft+o.clientLeft+i,n[u]=o.clientWidth}return{fixedPos:sn(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:e,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function sn(r){return r.scroller.getBoundingClientRect().left-r.sizer.getBoundingClientRect().left}function cn(r){var t=an(r.display),e=r.options.lineWrapping,n=e&&Math.max(5,r.display.scroller.clientWidth/un(r.display)-3);return function(i){if($t(r.doc,i))return 0;var o=0;if(i.widgets)for(var a=0;a<i.widgets.length;a++)i.widgets[a].height&&(o+=i.widgets[a].height);return e?o+(Math.ceil(i.text.length/n)||1)*t:o+t}}function fn(r){var t=r.doc,e=cn(r);t.iter((function(r){var t=e(r);t!=r.height&&Xr(r,t)}))}function dn(r,t,e,n){var i=r.display;if(!e&&"true"==Lr(t).getAttribute("cm-not-content"))return null;var o,a,u=i.lineSpace.getBoundingClientRect();try{o=t.clientX-u.left,a=t.clientY-u.top}catch(r){return null}var l,s=Xe(r,o,a);if(n&&s.xRel>0&&(l=Qr(r.doc,s.line).text).length==s.ch){var c=P(l,l.length,r.options.tabSize)-l.length;s=nt(s.line,Math.max(0,Math.round((o-Se(r.display).left)/un(r.display))-c))}return s}function hn(r,t){if(t>=r.display.viewTo)return null;if((t-=r.display.viewFrom)<0)return null;for(var e=r.display.view,n=0;n<e.length;n++)if((t-=e[n].size)<0)return n}function vn(r,t,e,n){null==t&&(t=r.doc.first),null==e&&(e=r.doc.first+r.doc.size),n||(n=0);var i=r.display;if(n&&e<i.viewTo&&(null==i.updateLineNumbers||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),r.curOp.viewChanged=!0,t>=i.viewTo)At&&qt(r.doc,t)<i.viewTo&&pn(r);else if(e<=i.viewFrom)At&&Wt(r.doc,e+n)>i.viewFrom?pn(r):(i.viewFrom+=n,i.viewTo+=n);else if(t<=i.viewFrom&&e>=i.viewTo)pn(r);else if(t<=i.viewFrom){var o=gn(r,e,e+n,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=n):pn(r)}else if(e>=i.viewTo){var a=gn(r,t,t,-1);a?(i.view=i.view.slice(0,a.index),i.viewTo=a.lineN):pn(r)}else{var u=gn(r,t,t,-1),l=gn(r,e,e+n,1);u&&l?(i.view=i.view.slice(0,u.index).concat(ue(r,u.lineN,l.lineN)).concat(i.view.slice(l.index)),i.viewTo+=n):pn(r)}var s=i.externalMeasured;s&&(e<s.lineN?s.lineN+=n:t<s.lineN+s.size&&(i.externalMeasured=null))}function mn(r,t,e){r.curOp.viewChanged=!0;var n=r.display,i=r.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(n.externalMeasured=null),!(t<n.viewFrom||t>=n.viewTo)){var o=n.view[hn(r,t)];if(null!=o.node){var a=o.changes||(o.changes=[]);-1==W(a,e)&&a.push(e)}}}function pn(r){r.display.viewFrom=r.display.viewTo=r.doc.first,r.display.view=[],r.display.viewOffset=0}function gn(r,t,e,n){var i,o=hn(r,t),a=r.display.view;if(!At||e==r.doc.first+r.doc.size)return{index:o,lineN:e};for(var u=r.display.viewFrom,l=0;l<o;l++)u+=a[l].size;if(u!=t){if(n>0){if(o==a.length-1)return null;i=u+a[o].size-t,o++}else i=u-t;t+=i,e+=i}for(;qt(r.doc,e)!=e;){if(o==(n<0?0:a.length-1))return null;e+=n*a[o-(n<0?1:0)].size,o+=n}return{index:o,lineN:e}}function bn(r){for(var t=r.display.view,e=0,n=0;n<t.length;n++){var i=t[n];i.hidden||i.node&&!i.changes||++e}return e}function wn(r){r.display.input.showSelection(r.display.input.prepareSelection())}function kn(r,t){void 0===t&&(t=!0);var e=r.doc,n={},i=n.cursors=document.createDocumentFragment(),o=n.selection=document.createDocumentFragment(),a=r.options.$customCursor;a&&(t=!0);for(var u=0;u<e.sel.ranges.length;u++)if(t||u!=e.sel.primIndex){var l=e.sel.ranges[u];if(!(l.from().line>=r.display.viewTo||l.to().line<r.display.viewFrom)){var s=l.empty();if(a){var c=a(r,l);c&&yn(r,c,i)}else(s||r.options.showCursorWhenSelecting)&&yn(r,l.head,i);s||Cn(r,l,o)}}return n}function yn(r,t,e){var n=Qe(r,t,"div",null,null,!r.options.singleCursorHeightPerLine),i=e.appendChild(E("div"," ","CodeMirror-cursor"));if(i.style.left=n.left+"px",i.style.top=n.top+"px",i.style.height=Math.max(0,n.bottom-n.top)*r.options.cursorHeight+"px",/\bcm-fat-cursor\b/.test(r.getWrapperElement().className)){var o=Ve(r,t,"div",null,null),a=o.right-o.left;i.style.width=(a>0?a:r.defaultCharWidth())+"px"}if(n.other){var u=e.appendChild(E("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));u.style.display="",u.style.left=n.other.left+"px",u.style.top=n.other.top+"px",u.style.height=.85*(n.other.bottom-n.other.top)+"px"}}function xn(r,t){return r.top-t.top||r.left-t.left}function Cn(r,t,e){var n=r.display,i=r.doc,o=document.createDocumentFragment(),a=Se(r.display),u=a.left,l=Math.max(n.sizerWidth,Ne(r)-n.sizer.offsetLeft)-a.right,s="ltr"==i.direction;function c(r,t,e,n){t<0&&(t=0),