@grapecity-software/spread-sheets-formula-panel 18.1.4 → 18.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  *
3
- * SpreadJS Library 18.1.4
3
+ * SpreadJS Library 18.2.0
4
4
  *
5
5
  * Copyright(c) GrapeCity Software inc. All rights reserved.
6
6
  *
@@ -9,4 +9,4 @@
9
9
  * https://www.grapecity.com.cn/developer/spreadjs
10
10
  *
11
11
  */
12
- !function(t){"object"==typeof module&&"object"==typeof module.exports?module.exports=t(require("@grapecity-software/spread-sheets")):"function"==typeof define&&define.amd?define(["@grapecity-software/spread-sheets"],t):"object"==typeof exports?exports.Spread=t(require("@grapecity-software/spread-sheets")):t(GC)}(function(n){!function(){"use strict";var i,e,t;function r(t){var n,n,n=e[t];return void 0!==n||(n=e[t]={exports:{}},i[t].call(n.exports,n,n.exports,r)),n.exports}i={"./dist/plugins/formulaPanel/editor/codemirror/index.js":function(T,L){var k,B,_,N,U,H,W,V,$,q,G,h,J,K,Q,X,O,Z,y,Y,tt,b,nt,it,et,rt,ot,ut,st,at,ft,ht,ct,lt,vt,dt,yt,mt,pt,kt,gt,wt,bt,v,Mt,xt,l,St,Ct,C,jt,Pt,Ot,j,Et,At,Dt,Rt,It,Tt,Lt,Bt,_t,Ft,Nt,Ut,Ht,zt,t,n,Wt,Vt,i,$t,qt,Gt,Jt,Kt,Qt,c,Xt,n,t,Zt,e,Yt,tn,nn,en,r,o,u,g,rn,on,un,sn,an,fn,tn,P,m,hn,cn,ln,vn,dn,yn,mn,pn,kn,gn,wn,bn,Mn,xn,Sn,Cn,jn,Pn,On,En,An,d,Dn,Rn,In,Tn,Ln,Bn,_n,Fn,Nn,E,Un,Hn,zn,Wn,Vn,$n,qn,Gn,Jn,Kn,Jn,Qn,Xn,z,Zn,Yn,ti,ni,ii,ei,ri,oi,ui,si,ai,fi,hi,ci,s,li,vi,di,yi,mi,pi,ki,gi,wi,bi,Mi,xi,Si,Ci,p,ji,Pi,Oi,Ei,Ai,Di,Ri,Ii,Ti,Li,Bi,_i,Fi,Ni,Ui,Hi,zi,Wi,Vi,$i,qi,Gi,Ji,Ki,Qi,Xi,w,Zi,Yi,te,ne,e,ie,ee,re,oe,ue,se,ae,fe,he,ce,le,Yt,ve,de,ye,me,pe,ke,ge,we,be,Me,xe,Se,Ce,je,Pe,Oe,Ee,Ae,De,Re,Ie,Te,Le,Be,_e,Fe,Zt,Ne,Ue,He,ze,We,Ve,$e,nn,qe,Ge,Je,Ke,en,Qe,Xe,Ze,Ye,tr,nr,ir,er,rr,or,ur,sr,ar,fr,hr,cr,lr,u,vr,dr,yr,mr,M,pr,kr,n,gr,wr,br,x,Mr,xr,Sr,Cr,jr,Pr,Or,Er,Ar,Dr,Rr,Ir,Tr,Lr,Br,_r,Fr,r,t,e,Yt,Zt,u,nn,o,Nr,Ur,Hr,zr,Wr,Vr,$r,a,Yt,qr,Gr,Jr,t,Kr,Qr,Xr,Zr,Yr,to,no,io,Zt,e,eo,ro,oo,uo,so,nn,ao,fo,ho,co,lo,vo,u,Hr,zr,Wr,o,yo,mo,po,ko,go,wo,bo,Mo,xo,So,Vr,Co,jo,Ur,Po,Oo,Eo,Ao,Do,Ro,Io,To,Lo,Bo,Nr,_o,Fo,No,Uo,Ho,zo,Wo,Vo,$o,qo,$o,Go,Jo,Ko,Qo,Xo,Zo,Yo,tu,nu,iu,eu,r,$r,Yt,ru,ou,uu,su,au,fu,hu,cu,lu,vu,du,yu,mu,pu,ku,gu,wu,bu,Mu,xu,Su,Cu,ju,Pu,Ou,n,Vr,Ur,Eu,Au,Du,Ru,Iu,t,Tu,Lu,Bu,_u,Fu,Nu,Uu,e,Hu,zu,Wu,Vu,$u,Wr,qu,Zt,Nr,nn,zr,u,Gu,Ju,Ku,Qu,Xu,Zu,Yu,o,ts,ns,Hr,jt,r,n,is,es,rs,os,us,ss,as,fs,hs,cs,ls,vs,ds,ys,ms,ps,Yt,e,ks,gs,ws,bs,Ms,xs,Ss,Cs,js,Ps,Os,Es,As,Ds,Rs,Is,Ts,Ls,Bs,_s,Fs,Ns,t,Vr,Us,Hs,zs,Ws,Vs,$s,qs,Gs,Js,Ks,Qs,Xs,Zs,Ys,ta,na,ia,ea,ra,oa,ua,sa,aa,fa,ha,ca,la,va,da,Ur,ya,$r,ma,pa,ka,ga,wa,ba,Ma,xa,Sa,Ca,ja,Pa,Oa,Ea,Aa,Da,Ra,Ia,Ta,La,Ba,zr,_a,u,Fa,Na,Ua,Ha,za,Wa,ma,Va,$a,qa,Ga,Ja,Ka,Qa,Xa,Za,Ya,tf,nf,ef,rf,of,uf,sf,af,ff,$r,hf,cf,lf,vf,df,yf,mf,pf,as,kf,gf,fs,wf,bf,Mf,xf,Sf,Cf,jf,Pf,Xs,Of,Ef,Af,Qs,Df,Rf,If,Tf,Lf,Bf,_f,Ff,ls,Nf,Uf,Hf,o;function zf(t,n,i){return(n=ah(n))in t?Object.defineProperty(t,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[n]=i,t}function Wf(t){return qf(t)||$f(t)||Xf(t)||Vf()}function Vf(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function $f(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function qf(t){if(Array.isArray(t))return Zf(t)}function Gf(t,n){return Qf(t)||Kf(t,n)||Xf(t,n)||Jf()}function Jf(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Kf(t,n){var i,e,r,o,u,s,a,f,i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){s=[],f=!(a=!0);try{if(o=(i=i.call(t)).next,0===n){if(Object(i)!==i)return;a=!1}else for(;!(a=(e=o.call(i)).done)&&(s.push(e.value),s.length!==n);a=!0);}catch(t){f=!0,r=t}finally{try{if(!a&&null!=i.return&&(u=i.return(),Object(u)!==u))return}finally{if(f)throw r}}return s}}function Qf(t){if(Array.isArray(t))return t}function F(n,t){var i,e,t,r,o,u,i="undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(i)return o=!(r=!0),{s:function t(){i=i.call(n)},n:function t(){var n=i.next();return r=n.done,n},e:function t(n){o=!0,u=n},f:function t(){try{r||null==i.return||i.return()}finally{if(o)throw u}}};if(Array.isArray(n)||(i=Xf(n))||t&&n&&"number"==typeof n.length)return i&&(n=i),e=0,{s:t=function t(){},n:function t(){return e>=n.length?{done:!0}:{done:!1,value:n[e++]}},e:function t(n){throw n},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Xf(t,n){var i;if(t)return"string"==typeof t?Zf(t,n):"Map"===(i="Object"===(i=Object.prototype.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:i)||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Zf(t,n):void 0}function Zf(t,n){(null==n||n>t.length)&&(n=t.length);for(var i=0,e=new Array(n);i<n;i++)e[i]=t[i];return e}function Yf(){return(Yf="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function t(n,i,e){var r,r,r=th(n,i);if(r)return(r=Object.getOwnPropertyDescriptor(r,i)).get?r.get.call(arguments.length<3?n:e):r.value}).apply(this,arguments)}function th(t,n){for(;!Object.prototype.hasOwnProperty.call(t,n)&&null!==(t=oh(t)););return t}function f(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),n&&nh(t,n)}function nh(t,n){return(nh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function t(n,i){return n.__proto__=i,n})(t,n)}function S(e){var r=rh();return function t(){var n,i,i,n=oh(e),i=r?(i=oh(this).constructor,Reflect.construct(n,arguments,i)):n.apply(this,arguments);return ih(this,i)}}function ih(t,n){if(n&&("object"===uh(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return eh(t)}function eh(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function rh(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}function oh(t){return(oh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function t(n){return n.__proto__||Object.getPrototypeOf(n)})(t)}function uh(t){return(uh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function A(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function sh(t,n){for(var i,e,i=0;i<n.length;i++)(e=n[i]).enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(t,ah(e.key),e)}function D(t,n,i){return n&&sh(t.prototype,n),i&&sh(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}function ah(t){var t=fh(t,"string");return"symbol"===uh(t)?t:String(t)}function fh(t,n){var i,i;if("object"!==uh(t)||null===t)return t;if(void 0===(i=t[Symbol.toPrimitive]))return("string"===n?String:Number)(t);if("object"!==uh(i=i.call(t,n||"default")))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}function hh(t){var n,i,e,r,n=-1,i=F(t);try{for(i.s();!(e=i.n()).done;)n+=(r=e.value).length+1}catch(t){i.e(t)}finally{i.f()}return n}function ch(t,n,i,e){for(var r,o,u,s,a,f,h,r=2<arguments.length&&void 0!==i?i:0,o=3<arguments.length&&void 0!==e?e:1e9,u=0,s=0,a=!0;s<t.length&&u<=o;s++)r<=(h=u+(f=t[s]).length)&&(o<h&&(f=f.slice(0,o-u)),u<r&&(f=f.slice(r-u)),a?(n[n.length-1]+=f,a=!1):n.push(f)),u=h+1;return n}function lh(t,n,i){return ch(t,[""],n,i)}for(Object.defineProperty(L,"__esModule",{value:!0}),L.basicSetup=L.View=L.State=L.Search=L.Lint=L.Language=L.Commands=L.Autocomplete=void 0,B=function(t){f(a,t);var e=S(a);function a(t){var n,i,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:hh(t);return A(this,a),(n=e.call(this)).text=t,n.length=i,n}return D(a,[{key:"lines",get:function t(){return this.text.length}},{key:"children",get:function t(){return null}},{key:"lineInner",value:function t(n,i,e,r){for(var o,u,s,o=0;;o++){if(s=r+(u=this.text[o]).length,n<=(i?e:s))return new W(r,s,e,u);r=s+1,e++}}},{key:"decompose",value:function t(n,i,e,r){var i,n,r,n,i=n<=0&&i>=this.length?this:new a(lh(this.text,n,i),Math.min(i,this.length)-Math.max(0,n));1&r?(n=e.pop(),(r=ch(i.text,n.text.slice(),0,i.length)).length<=32?e.push(new a(r,n.length+i.length)):(n=r.length>>1,e.push(new a(r.slice(0,n)),new a(r.slice(n))))):e.push(i)}},{key:"replace",value:function t(n,i,e){var r,o;return e instanceof a?(r=ch(this.text,ch(e.text,lh(this.text,0,n)),i),o=this.length+e.length-(i-n),r.length<=32?new a(r,o):_.from(a.split(r,[]),o)):Yf(oh(a.prototype),"replace",this).call(this,n,i,e)}},{key:"sliceString",value:function t(n){for(var i,e,r,o,u,s,a,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:this.length,e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"\n",r="",o=0,u=0;o<=i&&u<this.text.length;u++)n<o&&u&&(r+=e),n<(a=o+(s=this.text[u]).length)&&o<i&&(r+=s.slice(Math.max(0,n-o),i-o)),o=a+1;return r}},{key:"flatten",value:function t(n){var i,e,r,i=F(this.text);try{for(i.s();!(e=i.n()).done;)r=e.value,n.push(r)}catch(t){i.e(t)}finally{i.f()}}},{key:"scanIdentical",value:function t(){return 0}}],[{key:"split",value:function t(n,i){var e,r,o,u,s,e=[],r=-1,o=F(n);try{for(o.s();!(u=o.n()).done;)s=u.value,e.push(s),r+=s.length+1,32==e.length&&(i.push(new a(e,r)),e=[],r=-1)}catch(t){o.e(t)}finally{o.f()}return-1<r&&i.push(new a(e,r)),i}}]),a}(k=function(){function i(){A(this,i)}return D(i,[{key:"lineAt",value:function t(n){if(n<0||n>this.length)throw new RangeError("Invalid position ".concat(n," in document of length ").concat(this.length));return this.lineInner(n,!1,1,0)}},{key:"line",value:function t(n){if(n<1||n>this.lines)throw new RangeError("Invalid line number ".concat(n," in ").concat(this.lines,"-line document"));return this.lineInner(n,!0,1,0)}},{key:"replace",value:function t(n,i,e){var r=[];return this.decompose(0,n,r,2),e.length&&e.decompose(0,e.length,r,3),this.decompose(i,this.length,r,1),_.from(r,this.length-(i-n)+e.length)}},{key:"append",value:function t(n){return this.replace(this.length,this.length,n)}},{key:"slice",value:function t(n){var i,e,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:this.length,e=[];return this.decompose(n,i,e,0),_.from(e,i-n)}},{key:"eq",value:function t(n){var i,e,r,o,u,s;if(n==this)return!0;if(n.length!=this.length||n.lines!=this.lines)return!1;for(i=this.scanIdentical(n,1),e=this.length-this.scanIdentical(n,-1),r=new N(this),o=new N(n),s=u=i;;){if(r.next(u),o.next(u),u=0,r.lineBreak!=o.lineBreak||r.done!=o.done||r.value!=o.value)return!1;if(s+=r.value.length,r.done||e<=s)return!0}}},{key:"iter",value:function t(){var n;return new N(this,0<arguments.length&&void 0!==arguments[0]?arguments[0]:1)}},{key:"iterRange",value:function t(n){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:this.length;return new U(this,n,i)}},{key:"iterLines",value:function t(n,i){var n,n,n=null==n?this.iter():(null==i&&(i=this.lines+1),n=this.line(n).from,this.iterRange(n,Math.max(n,i==this.lines+1?this.length:i<=1?0:this.line(i-1).to)));return new H(n)}},{key:"toString",value:function t(){return this.sliceString(0)}},{key:"toJSON",value:function t(){var n=[];return this.flatten(n),n}}],[{key:"of",value:function t(n){if(0==n.length)throw new RangeError("A document must have at least one line");return 1!=n.length||n[0]?n.length<=32?new B(n):_.from(B.split(n,[])):i.empty}}]),i}()),_=function(t){f(x,t);var u=S(x);function x(t,n){var i,e,r,o;A(this,x),(i=u.call(this)).children=t,i.length=n,i.lines=0,e=F(t);try{for(e.s();!(r=e.n()).done;)o=r.value,i.lines+=o.lines}catch(t){e.e(t)}finally{e.f()}return i}return D(x,[{key:"lineInner",value:function t(n,i,e,r){for(var o,u,s,a,o=0;;o++){if(s=r+(u=this.children[o]).length,a=e+u.lines-1,n<=(i?a:s))return u.lineInner(n,i,e,r);r=s+1,e=1+a}}},{key:"decompose",value:function t(n,i,e,r){for(var o,u,s,a,f,o=0,u=0;u<=i&&o<this.children.length;o++)n<=(a=u+(s=this.children[o]).length)&&u<=i&&(f=r&((u<=n?1:0)|(i<=a?2:0)),n<=u&&a<=i&&!f?e.push(s):s.decompose(n-u,i-u,e,f)),u=a+1}},{key:"replace",value:function t(n,i,e){var r,o,u,s,a,u,u;if(e.lines<this.lines)for(o=r=0;r<this.children.length;r++){if(s=o+(u=this.children[r]).length,o<=n&&i<=s)return a=u.replace(n-o,i-o,e),u=this.lines-u.lines+a.lines,a.lines<u>>4&&a.lines>u>>6?((u=this.children.slice())[r]=a,new x(u,this.length-(i-n)+e.length)):Yf(oh(x.prototype),"replace",this).call(this,o,s,a);o=s+1}return Yf(oh(x.prototype),"replace",this).call(this,n,i,e)}},{key:"sliceString",value:function t(n){for(var i,e,r,o,u,s,a,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:this.length,e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"\n",r="",o=0,u=0;o<this.children.length&&u<=i;o++)n<u&&o&&(r+=e),n<(a=u+(s=this.children[o]).length)&&u<i&&(r+=s.sliceString(n-u,i-u,e)),u=a+1;return r}},{key:"flatten",value:function t(n){var i,e,r,i=F(this.children);try{for(i.s();!(e=i.n()).done;)(r=e.value).flatten(n)}catch(t){i.e(t)}finally{i.f()}}},{key:"scanIdentical",value:function t(n,i){var e,r,o,u,s,a,f,h,c;if(!(n instanceof x))return 0;for(u=(o=Gf(r=(e=0)<i?[0,0,this.children.length,n.children.length]:[this.children.length-1,n.children.length-1,-1,-1],4))[0],s=o[1],a=o[2],f=o[3];;u+=i,s+=i){if(u==a||s==f)return e;if((h=this.children[u])!=(c=n.children[s]))return e+h.scanIdentical(c,i);e+=h.length+1}}}],[{key:"from",value:function t(n){var i,e,r,o,u,s,a,f,h,c,l,v,d,y,m,p,k,g,w,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:n.reduce(function(t,n){return t+n.length+1},-1),e=0,r=F(n);try{for(r.s();!(o=r.n()).done;)e+=(u=o.value).lines}catch(t){r.e(t)}finally{r.f()}if(e<32){s=[],a=F(n);try{for(a.s();!(f=a.n()).done;)(h=f.value).flatten(s)}catch(t){a.e(t)}finally{a.f()}return new B(s,i)}function b(t){var n,i,e,r;if(t.lines>l&&t instanceof x){i=F(t.children);try{for(i.s();!(e=i.n()).done;)b(r=e.value)}catch(t){i.e(t)}finally{i.f()}}else t.lines>v&&(v<y||!y)?(M(),d.push(t)):t instanceof B&&y&&(n=p[p.length-1])instanceof B&&t.lines+n.lines<=32?(y+=t.lines,m+=t.length+1,p[p.length-1]=new B(n.text.concat(t.text),n.length+1+t.length)):(y+t.lines>c&&M(),y+=t.lines,m+=t.length+1,p.push(t))}function M(){0!=y&&(d.push(1==p.length?p[0]:x.from(p,m)),m=-1,y=p.length=0)}c=Math.max(32,e>>5),l=c<<1,v=c>>1,d=[],y=0,m=-1,p=[],k=F(n);try{for(k.s();!(g=k.n()).done;)b(w=g.value)}catch(t){k.e(t)}finally{k.f()}return M(),1==d.length?d[0]:new x(d,i)}}]),x}(k),k.empty=new B([""],0),N=function(){function i(t){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1;A(this,i),this.dir=n,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[t],this.offsets=[0<n?1:(t instanceof B?t.text:t.children).length<<1]}return D(i,[{key:"nextInner",value:function t(n,i){var e,r,o,u,s,s,o;for(this.done=this.lineBreak=!1;;)if(e=this.nodes.length-1,r=this.nodes[e],u=(o=this.offsets[e])>>1,s=(r instanceof B?r.text:r.children).length,u==(0<i?s:0)){if(0==e)return this.done=!0,this.value="",this;0<i&&this.offsets[e-1]++,this.nodes.pop(),this.offsets.pop()}else if((1&o)==(0<i?0:1)){if(this.offsets[e]+=i,0==n)return this.lineBreak=!0,this.value="\n",this;n--}else if(r instanceof B){if(s=r.text[u+(i<0?-1:0)],this.offsets[e]+=i,s.length>Math.max(0,n))return this.value=0==n?s:0<i?s.slice(n):s.slice(0,s.length-n),this;n-=s.length}else n>(o=r.children[u+(i<0?-1:0)]).length?(n-=o.length,this.offsets[e]+=i):(i<0&&this.offsets[e]--,this.nodes.push(o),this.offsets.push(0<i?1:(o instanceof B?o.text:o.children).length<<1))}},{key:"next",value:function t(){var n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0;return n<0&&(this.nextInner(-n,-this.dir),n=this.value.length),this.nextInner(n,this.dir)}}]),i}(),U=function(){function e(t,n,i){A(this,e),this.value="",this.done=!1,this.cursor=new N(t,i<n?-1:1),this.pos=i<n?t.length:0,this.from=Math.min(n,i),this.to=Math.max(n,i)}return D(e,[{key:"nextInner",value:function t(n,i){var e,r,o;return(i<0?this.pos<=this.from:this.pos>=this.to)?(this.value="",this.done=!0):(n+=Math.max(0,i<0?this.pos-this.to:this.from-this.pos),e=i<0?this.pos-this.from:this.to-this.pos,e-=n=e<n?e:n,o=(r=this.cursor.next(n)).value,this.pos+=(o.length+n)*i,this.value=o.length<=e?o:i<0?o.slice(o.length-e):o.slice(0,e),this.done=!this.value),this}},{key:"next",value:function t(){var n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0;return n<0?n=Math.max(n,this.from-this.pos):0<n&&(n=Math.min(n,this.to-this.pos)),this.nextInner(n,this.cursor.dir)}},{key:"lineBreak",get:function t(){return this.cursor.lineBreak&&""!=this.value}}]),e}(),H=function(){function n(t){A(this,n),this.inner=t,this.afterBreak=!0,this.value="",this.done=!1}return D(n,[{key:"next",value:function t(){var n,i,e,r,i,n,i=this.inner.next(0<arguments.length&&void 0!==arguments[0]?arguments[0]:0),e=i.done,r=i.lineBreak,i=i.value;return e?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}},{key:"lineBreak",get:function t(){return!1}}]),n}(),"undefined"!=typeof Symbol&&(k.prototype[Symbol.iterator]=function(){return this.iter()},N.prototype[Symbol.iterator]=U.prototype[Symbol.iterator]=H.prototype[Symbol.iterator]=function(){return this}),W=function(){function r(t,n,i,e){A(this,r),this.from=t,this.to=n,this.number=i,this.text=e}return D(r,[{key:"length",get:function t(){return this.to-this.from}}]),r}(),V="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(function(t){return t?parseInt(t,36):1}),$=1;$<V.length;$++)V[$]+=V[$-1];function vh(t){for(var n=1;n<V.length;n+=2)if(V[n]>t)return V[n-1]<=t}function dh(t){return 127462<=t&&t<=127487}function yh(t,n){var i,e,i,e;return(!(2<arguments.length&&void 0!==arguments[2])||arguments[2]?mh:ph)(t,n,!(3<arguments.length&&void 0!==arguments[3])||arguments[3])}function mh(t,n,i){var e,r,o,u;if(n!=t.length)for(n&&kh(t.charCodeAt(n))&&gh(t.charCodeAt(n-1))&&n--,n+=Mh(e=wh(t,n));n<t.length;)if(r=wh(t,n),e==q||r==q||i&&vh(r))n+=Mh(r),e=r;else{if(!dh(r))break;for(o=0,u=n-2;0<=u&&dh(wh(t,u));)o++,u-=2;if(o%2==0)break;n+=2}return n}function ph(t,n,i){for(;0<n;){var e=mh(t,n-2,i);if(e<n)return e;n--}return 0}function kh(t){return 56320<=t&&t<57344}function gh(t){return 55296<=t&&t<56320}function wh(t,n){var i,t,i=t.charCodeAt(n);return gh(i)&&n+1!=t.length&&kh(t=t.charCodeAt(n+1))?t-56320+(i-55296<<10)+65536:i}function bh(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)))}function Mh(t){return t<65536?1:2}function xh(t,n,i,e){var e,r,e=3<arguments.length&&void 0!==e&&e;0==n&&i<=0||(0<=(r=t.length-2)&&i<=0&&i==t[1+r]?t[r]+=n:0==n&&0==t[r]?t[1+r]+=i:e?(t[r]+=n,t[1+r]+=i):t.push(n,i))}function Sh(t,n,i){if(0!=i.length){var e=n.length-2>>1;if(e<t.length)t[t.length-1]=t[t.length-1].append(i);else{for(;t.length<e;)t.push(k.empty);t.push(i)}}}function Ch(t,n,i){for(var e,r,o,u,s,a,f,h,c,e=t.inserted,r=0,o=0,u=0;u<t.sections.length;)if(s=t.sections[u++],(a=t.sections[u++])<0)r+=s,o+=s;else{for(f=r,h=o,c=k.empty;f+=s,h+=a,a&&e&&(c=c.append(e[u-2>>1])),!(i||u==t.sections.length||t.sections[u+1]<0);)s=t.sections[u++],a=t.sections[u++];n(r,f,o,h,c),r=f,o=h}}function jh(t,n,i,e){for(var r,o,u,s,a,f,h,c,l,v,d,y,r,o=[],u=3<arguments.length&&void 0!==e&&e?[]:null,s=new Q(t),a=new Q(n),f=-1;;)if(-1==s.ins&&-1==a.ins)xh(o,h=Math.min(s.len,a.len),-1),s.forward(h),a.forward(h);else if(0<=a.ins&&(s.ins<0||f==s.i||0==s.off&&(a.len<s.len||a.len==s.len&&!i))){for(c=a.len,xh(o,a.ins,-1);c;)l=Math.min(s.len,c),0<=s.ins&&f<s.i&&s.len<=l&&(xh(o,0,s.ins),u&&Sh(u,o,s.text),f=s.i),s.forward(l),c-=l;a.next()}else{if(!(0<=s.ins)){if(s.done&&a.done)return u?K.createSet(o,u):J.create(o);throw new Error("Mismatched change set lengths")}for(v=0,d=s.len;d;)if(-1==a.ins)v+=y=Math.min(d,a.len),d-=y,a.forward(y);else{if(!(0==a.ins&&a.len<d))break;d-=a.len,a.next()}xh(o,v,f<s.i?s.ins:0),u&&f<s.i&&Sh(u,o,s.text),f=s.i,s.forward(s.len-d)}}function Ph(t,n,i){for(var e,r,o,u,s,a,f,h,c,e,r=[],o=2<arguments.length&&void 0!==i&&i?[]:null,u=new Q(t),s=new Q(n),a=!1;;){if(u.done&&s.done)return o?K.createSet(r,o):J.create(r);if(0==u.ins)xh(r,u.len,0,a),u.next();else if(0!=s.len||s.done){if(u.done||s.done)throw new Error("Mismatched change set lengths");f=Math.min(u.len2,s.len),h=r.length,-1==u.ins?(xh(r,f,c=-1==s.ins?-1:s.off?0:s.ins,a),o&&c&&Sh(o,r,s.text)):-1==s.ins?(xh(r,u.off?0:u.len,f,a),o&&Sh(o,r,u.textBit(f))):(xh(r,u.off?0:u.len,s.off?0:s.ins,a),o&&!s.off&&Sh(o,r,s.text)),a=(u.ins>f||0<=s.ins&&s.len>f)&&(a||h<r.length),u.forward2(f),s.forward(f)}else xh(r,0,s.ins,a),o&&Sh(o,r,s.text),s.next()}}function Oh(t,n){var i,e,r,i=F(t.ranges);try{for(i.s();!(e=i.n()).done;)if((r=e.value).to>n)throw new RangeError("Selection points outside of document")}catch(t){i.e(t)}finally{i.f()}}function Eh(t,i){return t==i||t.length==i.length&&t.every(function(t,n){return t===i[n]})}function Ah(t,n,i){if(t.length==n.length){for(var e=0;e<t.length;e++)if(!i(t[e],n[e]))return;return 1}}function Dh(t,n){var i,e,r,o,i=!1,e=F(n);try{for(e.s();!(r=e.n()).done;)1&Lh(t,o=r.value)&&(i=!0)}catch(t){e.e(t)}finally{e.f()}return i}function Rh(n,s,o){var a,f,r,u;function h(t){for(var n,i,e,r,o,u,n=[],i=0;i<a.length;i++)if(e=Bh(t,a[i]),2==f[i]){r=F(e);try{for(r.s();!(o=r.n()).done;)u=o.value,n.push(u)}catch(t){r.e(t)}finally{r.f()}}else n.push(e);return s.combine(n)}return a=o.map(function(t){return n[t.id]}),f=o.map(function(t){return t.type}),r=a.filter(function(t){return!(1&t)}),u=n[s.id]>>1,{create:function t(n){var i,e,r,i=F(a);try{for(i.s();!(e=i.n()).done;)Lh(n,r=e.value)}catch(t){i.e(t)}finally{i.f()}return n.values[u]=h(n),1},update:function t(n,i){var e;return!Dh(n,r)||(e=h(n),s.compare(e,n.values[u]))?0:(n.values[u]=e,1)},reconfigure:function t(n,i){var e,r,i,e,e=Dh(n,a),r=i.config.facets[s.id],i=i.facet(s);return r&&!e&&Eh(o,r)||(e=h(n),s.compare(e,i))?(n.values[u]=i,0):(n.values[u]=e,1)}}}function Ih(n){return function(t){return new at(t,n)}}function Th(t,s,a){var f,h;function c(t,n){var i,e,r,o,u,i,e,i=h.get(t);if(null!=i){if(i<=n)return;-1<(e=f[i].indexOf(t))&&f[i].splice(e,1),t instanceof ht&&a.delete(t.compartment)}if(h.set(t,n),Array.isArray(t)){r=F(t);try{for(r.s();!(o=r.n()).done;)c(u=o.value,n)}catch(t){r.e(t)}finally{r.f()}}else if(t instanceof ht){if(a.has(t.compartment))throw new RangeError("Duplicate use of compartment in extensions");i=s.get(t.compartment)||t.inner,a.set(t.compartment,i),c(i,n)}else if(t instanceof at)c(t.inner,t.prec);else if(t instanceof b)f[n].push(t),t.provides&&c(t.provides,n);else if(t instanceof Y)f[n].push(t),t.facet.extensions&&c(t.facet.extensions,rt);else{if(!(e=t.extension))throw new Error("Unrecognized extension value in extension set (".concat(t,"). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks."));c(e,n)}}return f=[[],[],[],[],[]],h=new Map,c(t,rt),f.reduce(function(t,n){return t.concat(n)})}function Lh(t,n){var n,i,i;if(1&n)return 2;if(4==(i=t.status[n=n>>1]))throw new Error("Cyclic dependency between fields and/or facets");return 2&i?i:(t.status[n]=4,i=t.computeSlot(t,t.config.dynamicSlots[n]),t.status[n]=2|i)}function Bh(t,n){return(1&n?t.config.staticValues:t.values)[n>>1]}function _h(t,n){for(var i,e,r,o,u,i=[],e=0,r=0;;){if(u=o=void 0,e<t.length&&(r==n.length||n[r]>=t[e]))o=t[e++],u=t[e++];else{if(!(r<n.length))return i;o=n[r++],u=n[r++]}!i.length||i[i.length-1]<o?i.push(o,u):i[i.length-1]<u&&(i[i.length-1]=u)}}function Fh(t,n,i){var i,e,r,i,i=i?(e=n.changes,r=K.empty(n.changes.length),t.changes.compose(n.changes)):(e=n.changes.map(t.changes),r=t.changes.mapDesc(n.changes,!0),t.changes.compose(e));return{changes:i,selection:n.selection?n.selection.map(r):null==(i=t.selection)?void 0:i.map(e),effects:v.mapEffects(t.effects,e).concat(v.mapEffects(n.effects,r)),annotations:t.annotations.length?t.annotations.concat(n.annotations):n.annotations,scrollIntoView:t.scrollIntoView||n.scrollIntoView}}function Nh(t,n,i){var e=n.selection,r=Wh(n.annotations);return n.userEvent&&(r=r.concat(Mt.userEvent.of(n.userEvent))),{changes:n.changes instanceof K?n.changes:K.of(n.changes||[],i,t.facet(dt)),selection:e&&(e instanceof O?e:O.single(e.anchor,e.head)),effects:Wh(n.effects),annotations:r,scrollIntoView:!!n.scrollIntoView}}function Uh(t,n,i){var e,r,o,u,e=Nh(t,n.length?n[0]:{},t.doc.length);for(n.length&&!1===n[0].filter&&(i=!1),r=1;r<n.length;r++)!1===n[r].filter&&(i=!1),o=!!n[r].sequential,e=Fh(e,Nh(t,n[r],o?e.changes.newLength:t.doc.length),o);return u=Mt.create(t,e.changes,e.selection,e.effects,e.annotations,e.scrollIntoView),zh(i?Hh(u):u)}function Hh(t){var n,i,e,r,o,u,s,a,f,h,c,l,n=t.startState,i=!0,e=F(n.facet(yt));try{for(e.s();!(r=e.n()).done;){if(!1===(u=(o=r.value)(t))){i=!1;break}Array.isArray(u)&&(i=!0===i?u:_h(i,u))}}catch(t){e.e(t)}finally{e.f()}for(!0!==i&&(!1===i?(a=t.changes.invertedDesc,s=K.empty(n.doc.length)):(s=(f=t.changes.filter(i)).changes,a=f.filtered.mapDesc(f.changes).invertedDesc),t=Mt.create(n,s,t.selection&&t.selection.map(a),v.mapEffects(t.effects,a),t.annotations,t.scrollIntoView)),c=(h=n.facet(mt)).length-1;0<=c;c--)t=(l=h[c](t))instanceof Mt?l:Array.isArray(l)&&1==l.length&&l[0]instanceof Mt?l[0]:Uh(n,Wh(l),!1);return t}function zh(t){for(var n,i,e,r,o,n=t.startState,i=n.facet(pt),e=t,r=i.length-1;0<=r;r--)(o=i[r](t))&&Object.keys(o).length&&(e=Fh(e,Nh(n,o,t.changes.newLength),!0));return e==t?t:Mt.create(n,t.changes,t.selection,e.effects,e.annotations,e.scrollIntoView)}function Wh(t){return null==t?xt:Array.isArray(t)?t:[t]}q=8205,G=/\r\n?|\n/,h=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(h=h||{}),K=function(t){f(y,t);var i=S(y);function y(t,n){var t;return A(this,y),(t=i.call(this,t)).inserted=n,t}return D(y,[{key:"apply",value:function t(o){if(this.length!=o.length)throw new RangeError("Applying change set to a document with the wrong length");return Ch(this,function(t,n,i,e,r){o=o.replace(i,i+(n-t),r)},!1),o}},{key:"mapDesc",value:function t(n){var i;return jh(this,n,1<arguments.length&&void 0!==arguments[1]&&arguments[1],!0)}},{key:"invert",value:function t(n){for(var i,e,r,o,u,s,a,i=this.sections.slice(),e=[],r=0,o=0;r<i.length;r+=2){if(u=i[r],0<=(s=i[r+1])){for(i[r]=s,i[r+1]=u,a=r>>1;e.length<a;)e.push(k.empty);e.push(u?n.slice(o,o+u):k.empty)}o+=u}return new y(i,e)}},{key:"compose",value:function t(n){return this.empty?n:n.empty?this:Ph(this,n,!0)}},{key:"map",value:function t(n){var i;return n.empty?this:jh(this,n,1<arguments.length&&void 0!==arguments[1]&&arguments[1],!0)}},{key:"iterChanges",value:function t(n){var i;Ch(this,n,1<arguments.length&&void 0!==arguments[1]&&arguments[1])}},{key:"desc",get:function t(){return J.create(this.sections)}},{key:"filter",value:function t(n){var i,e,r,o,u,s,a,f,h,c,l,i=[],e=[],r=[],o=new Q(this);t:for(u=0,s=0;;){for(a=u==n.length?1e9:n[u++];s<a||s==a&&0==o.len;){if(o.done)break t;xh(r,f=Math.min(o.len,a-s),-1),xh(i,f,h=-1==o.ins?-1:0==o.off?o.ins:0),0<h&&Sh(e,i,o.text),o.forward(f),s+=f}for(c=n[u++];s<c;){if(o.done)break t;xh(i,l=Math.min(o.len,c-s),-1),xh(r,l,-1==o.ins?-1:0==o.off?o.ins:0),o.forward(l),s+=l}}return{changes:new y(i,e),filtered:J.create(r)}}},{key:"toJSON",value:function t(){for(var n,i,e,r,n=[],i=0;i<this.sections.length;i+=2)e=this.sections[i],r=this.sections[i+1],n.push(r<0?e:0==r?[e]:[e].concat(this.inserted[i>>1].toJSON()));return n}}],[{key:"of",value:function t(n,s,a){var f,h,c,l;function v(t){var n,t,n;(0<arguments.length&&void 0!==t&&t||f.length)&&(c<s&&xh(f,s-c,-1),t=new y(f,h),l=l?l.compose(t.map(l)):t,f=[],h=[],c=0)}function d(t){var n,i,e,r,o,o,t,t,u;if(Array.isArray(t)){n=F(t);try{for(n.s();!(i=n.n()).done;)d(e=i.value)}catch(t){n.e(t)}finally{n.f()}}else if(t instanceof y){if(t.length!=s)throw new RangeError("Mismatched change set length (got ".concat(t.length,", expected ").concat(s,")"));v(),l=l?l.compose(t.map(l)):t}else{if(r=t.from,o=t.to,t=t.insert,(o=void 0===o?r:o)<r||r<0||s<o)throw new RangeError("Invalid change range ".concat(r," to ").concat(o," (in doc of length ").concat(s,")"));u=(t=t?"string"==typeof t?k.of(t.split(a||G)):t:k.empty).length,r==o&&0==u||(r<c&&v(),c<r&&xh(f,r-c,-1),xh(f,o-r,u),Sh(h,f,t),c=o)}}return f=[],h=[],c=0,l=null,d(n),v(!l),l}},{key:"empty",value:function t(n){return new y(n?[n,-1]:[],[])}},{key:"fromJSON",value:function t(n){var i,e,r,o;if(!Array.isArray(n))throw new RangeError("Invalid JSON representation of ChangeSet");for(i=[],e=[],r=0;r<n.length;r++)if("number"==typeof(o=n[r]))i.push(o,-1);else{if(!Array.isArray(o)||"number"!=typeof o[0]||o.some(function(t,n){return n&&"string"!=typeof t}))throw new RangeError("Invalid JSON representation of ChangeSet");if(1==o.length)i.push(o[0],0);else{for(;e.length<r;)e.push(k.empty);e[r]=k.of(o.slice(1)),i.push(o[0],e[r].length)}}return new y(i,e)}},{key:"createSet",value:function t(n,i){return new y(n,i)}}]),y}(J=function(){function o(t){A(this,o),this.sections=t}return D(o,[{key:"length",get:function t(){for(var n,i,n=0,i=0;i<this.sections.length;i+=2)n+=this.sections[i];return n}},{key:"newLength",get:function t(){for(var n,i,e,n=0,i=0;i<this.sections.length;i+=2)n+=(e=this.sections[i+1])<0?this.sections[i]:e;return n}},{key:"empty",get:function t(){return 0==this.sections.length||2==this.sections.length&&this.sections[1]<0}},{key:"iterGaps",value:function t(n){for(var i,e,r,o,u,i=0,e=0,r=0;i<this.sections.length;)o=this.sections[i++],(u=this.sections[i++])<0?(n(e,r,o),r+=o):r+=u,e+=o}},{key:"iterChangedRanges",value:function t(n){var i;Ch(this,n,1<arguments.length&&void 0!==arguments[1]&&arguments[1])}},{key:"invertedDesc",get:function t(){for(var n,i,e,r,n=[],i=0;i<this.sections.length;)e=this.sections[i++],(r=this.sections[i++])<0?n.push(e,r):n.push(r,e);return new o(n)}},{key:"composeDesc",value:function t(n){return this.empty?n:n.empty?this:Ph(this,n)}},{key:"mapDesc",value:function t(n){var i;return n.empty?this:jh(this,n,1<arguments.length&&void 0!==arguments[1]&&arguments[1])}},{key:"mapPos",value:function t(n){for(var i,e,r,o,u,s,a,f,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:-1,e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:h.Simple,r=0,o=0,u=0;u<this.sections.length;){if(f=r+(s=this.sections[u++]),(a=this.sections[u++])<0){if(n<f)return o+(n-r);o+=s}else{if(e!=h.Simple&&n<=f&&(e==h.TrackDel&&r<n&&n<f||e==h.TrackBefore&&r<n||e==h.TrackAfter&&n<f))return null;if(n<f||f==n&&i<0&&!s)return n==r||i<0?o:o+a;o+=a}r=f}if(r<n)throw new RangeError("Position ".concat(n," is out of range for changeset of length ").concat(r));return o}},{key:"touchesRange",value:function t(n){for(var i,e,r,o,u,s,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:n,e=0,r=0;e<this.sections.length&&r<=i;){if(s=r+(o=this.sections[e++]),0<=(u=this.sections[e++])&&r<=i&&n<=s)return!(r<n&&i<s)||"cover";r=s}return!1}},{key:"toString",value:function t(){for(var n,i,e,r,n="",i=0;i<this.sections.length;)n+=(n?" ":"")+(e=this.sections[i++])+(0<=(r=this.sections[i++])?":"+r:"");return n}},{key:"toJSON",value:function t(){return this.sections}}],[{key:"fromJSON",value:function t(n){if(!Array.isArray(n)||n.length%2||n.some(function(t){return"number"!=typeof t}))throw new RangeError("Invalid JSON representation of ChangeDesc");return new o(n)}},{key:"create",value:function t(n){return new o(n)}}]),o}()),Q=function(){function n(t){A(this,n),this.set=t,this.i=0,this.next()}return D(n,[{key:"next",value:function t(){var n=this.set.sections;this.i<n.length?(this.len=n[this.i++],this.ins=n[this.i++]):(this.len=0,this.ins=-2),this.off=0}},{key:"done",get:function t(){return-2==this.ins}},{key:"len2",get:function t(){return this.ins<0?this.len:this.ins}},{key:"text",get:function t(){var n=this.set.inserted,i=this.i-2>>1;return i>=n.length?k.empty:n[i]}},{key:"textBit",value:function t(n){var i=this.set.inserted,e=this.i-2>>1;return e>=i.length&&!n?k.empty:i[e].slice(this.off,null==n?void 0:this.off+n)}},{key:"forward",value:function t(n){n==this.len?this.next():(this.len-=n,this.off+=n)}},{key:"forward2",value:function t(n){-1==this.ins?this.forward(n):n==this.ins?this.next():(this.ins-=n,this.off+=n)}}]),n}(),X=function(){function o(t,n,i){A(this,o),this.from=t,this.to=n,this.flags=i}return D(o,[{key:"anchor",get:function t(){return 16&this.flags?this.to:this.from}},{key:"head",get:function t(){return 16&this.flags?this.from:this.to}},{key:"empty",get:function t(){return this.from==this.to}},{key:"assoc",get:function t(){return 4&this.flags?-1:8&this.flags?1:0}},{key:"bidiLevel",get:function t(){var n=3&this.flags;return 3==n?null:n}},{key:"goalColumn",get:function t(){var n=this.flags>>5;return 33554431==n?void 0:n}},{key:"map",value:function t(n){var i,e,r,i;return this.empty?e=r=n.mapPos(this.from,1<arguments.length&&void 0!==arguments[1]?arguments[1]:-1):(e=n.mapPos(this.from,1),r=n.mapPos(this.to,-1)),e==this.from&&r==this.to?this:new o(e,r,this.flags)}},{key:"extend",value:function t(n){var i,n,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:n;return n<=this.anchor&&i>=this.anchor?O.range(n,i):(n=Math.abs(n-this.anchor)>Math.abs(i-this.anchor)?n:i,O.range(this.anchor,n))}},{key:"eq",value:function t(n){return this.anchor==n.anchor&&this.head==n.head}},{key:"toJSON",value:function t(){return{anchor:this.anchor,head:this.head}}}],[{key:"fromJSON",value:function t(n){if(n&&"number"==typeof n.anchor&&"number"==typeof n.head)return O.range(n.anchor,n.head);throw new RangeError("Invalid JSON representation for SelectionRange")}},{key:"create",value:function t(n,i,e){return new o(n,i,e)}}]),o}(),O=function(){function a(t,n){A(this,a),this.ranges=t,this.mainIndex=n}return D(a,[{key:"map",value:function t(n){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:-1;return n.empty?this:a.create(this.ranges.map(function(t){return t.map(n,i)}),this.mainIndex)}},{key:"eq",value:function t(n){if(this.ranges.length!=n.ranges.length||this.mainIndex!=n.mainIndex)return!1;for(var i=0;i<this.ranges.length;i++)if(!this.ranges[i].eq(n.ranges[i]))return!1;return!0}},{key:"main",get:function t(){return this.ranges[this.mainIndex]}},{key:"asSingle",value:function t(){return 1==this.ranges.length?this:new a([this.main],0)}},{key:"addRange",value:function t(n){var i=!(1<arguments.length&&void 0!==arguments[1])||arguments[1];return a.create([n].concat(this.ranges),i?0:this.mainIndex+1)}},{key:"replaceRange",value:function t(n){var i,e,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:this.mainIndex,e=this.ranges.slice();return e[i]=n,a.create(e,this.mainIndex)}},{key:"toJSON",value:function t(){return{ranges:this.ranges.map(function(t){return t.toJSON()}),main:this.mainIndex}}}],[{key:"fromJSON",value:function t(n){if(!n||!Array.isArray(n.ranges)||"number"!=typeof n.main||n.main>=n.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new a(n.ranges.map(function(t){return X.fromJSON(t)}),n.main)}},{key:"single",value:function t(n){var i;return new a([a.range(n,1<arguments.length&&void 0!==arguments[1]?arguments[1]:n)],0)}},{key:"create",value:function t(n){var i,e,r,o,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;if(0==n.length)throw new RangeError("A selection needs at least one range");for(r=e=0;r<n.length;r++){if((o=n[r]).empty?o.from<=e:o.from<e)return a.normalized(n.slice(),i);e=o.to}return new a(n,i)}},{key:"cursor",value:function t(n){var i,e,r,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,e=2<arguments.length?arguments[2]:void 0,r=3<arguments.length?arguments[3]:void 0;return X.create(n,n,(0==i?0:i<0?4:8)|(null==e?3:Math.min(2,e))|(null!=r?r:33554431)<<5)}},{key:"range",value:function t(n,i,e,r){var e=(null!=e?e:33554431)<<5|(null==r?3:Math.min(2,r));return i<n?X.create(i,n,24|e):X.create(n,i,(n<i?4:0)|e)}},{key:"normalized",value:function t(n){var i,e,r,o,u,s,u,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,e=n[i];for(n.sort(function(t,n){return t.from-n.from}),i=n.indexOf(e),r=1;r<n.length;r++)o=n[r],u=n[r-1],(o.empty?o.from<=u.to:o.from<u.to)&&(s=u.from,u=Math.max(o.to,u.to),r<=i&&i--,n.splice(--r,2,o.anchor>o.head?a.range(u,s):a.range(s,u)));return new a(n,i)}}]),a}(),Z=0,y=function(){function o(t,n,i,e,r){A(this,o),this.combine=t,this.compareInput=n,this.compare=i,this.isStatic=e,this.id=Z++,this.default=t([]),this.extensions="function"==typeof r?r(this):r}return D(o,[{key:"of",value:function t(n){return new Y([],this,0,n)}},{key:"compute",value:function t(n,i){if(this.isStatic)throw new Error("Can't compute a static facet");return new Y(n,this,1,i)}},{key:"computeN",value:function t(n,i){if(this.isStatic)throw new Error("Can't compute a static facet");return new Y(n,this,2,i)}},{key:"from",value:function t(n,i){return i=i||function t(n){return n},this.compute([n],function(t){return i(t.field(n))})}}],[{key:"define",value:function t(){var n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return new o(n.combine||function(t){return t},n.compareInput||function(t,n){return t===n},n.compare||(n.combine?function(t,n){return t===n}:Eh),!!n.static,n.enables)}}]),o}(),Y=function(){function r(t,n,i,e){A(this,r),this.dependencies=t,this.facet=n,this.type=i,this.value=e,this.id=Z++}return D(r,[{key:"dynamicSlot",value:function t(n){var o,i,u,s,a,f,h,e,r,c,l,v,d,o=this,u=this.value,s=this.facet.compareInput,a=this.id,f=n[a]>>1,h=2==this.type,e=!1,r=!1,c=[],l=F(this.dependencies);try{for(l.s();!(v=l.n()).done;)"doc"==(d=v.value)?e=!0:"selection"==d?r=!0:0==(1&(null!=(i=n[d.id])?i:1))&&c.push(n[d.id])}catch(t){l.e(t)}finally{l.f()}return{create:function t(n){return n.values[f]=u(n),1},update:function t(n,i){if(e&&i.docChanged||r&&(i.docChanged||i.selection)||Dh(n,c)){var i=u(n);if(h?!Ah(i,n.values[f],s):!s(i,n.values[f]))return n.values[f]=i,1}return 0},reconfigure:function t(n,i){var e,r,r,r=i.config.address[a];if(null!=r){if(r=Bh(i,r),o.dependencies.every(function(t){return t instanceof y?i.facet(t)===n.facet(t):!(t instanceof b)||i.field(t,!1)==n.field(t,!1)})||(h?Ah(e=u(n),r,s):s(e=u(n),r)))return n.values[f]=r,0}else e=u(n);return n.values[f]=e,1}}}}]),r}(),tt=y.define({static:!0}),b=function(){function o(t,n,i,e,r){A(this,o),this.id=t,this.createF=n,this.updateF=i,this.compareF=e,this.spec=r,this.provides=void 0}return D(o,[{key:"create",value:function t(n){var i,e,i=this,e=n.facet(tt).find(function(t){return t.field==i});return((null==e?void 0:e.create)||this.createF)(n)}},{key:"slot",value:function t(n){var r,o,r=this,o=n[this.id]>>1;return{create:function t(n){return n.values[o]=r.create(n),1},update:function t(n,i){var e,i,e=n.values[o],i=r.updateF(e,i);return r.compareF(e,i)?0:(n.values[o]=i,1)},reconfigure:function t(n,i){return null!=i.config.address[r.id]?(n.values[o]=i.field(r),0):(n.values[o]=r.create(n),1)}}}},{key:"init",value:function t(n){return[this,tt.of({field:this,create:n})]}},{key:"extension",get:function t(){return this}}],[{key:"define",value:function t(n){var i=new o(Z++,n.create,n.update,n.compare||function(t,n){return t===n},n);return n.provide&&(i.provides=n.provide(i)),i}}]),o}(),st={highest:Ih(ut=0),high:Ih(ot=1),default:Ih(rt=2),low:Ih(et=3),lowest:Ih(it=4)},at=D(function t(n,i){A(this,t),this.inner=n,this.prec=i}),ft=function(){function i(){A(this,i)}return D(i,[{key:"of",value:function t(n){return new ht(this,n)}},{key:"reconfigure",value:function t(n){return i.reconfigure.of({compartment:this,extension:n})}},{key:"get",value:function t(n){return n.config.compartments.get(this)}}]),i}(),ht=D(function t(n,i){A(this,t),this.compartment=n,this.inner=i}),ct=function(){function w(t,n,i,e,r,o){for(A(this,w),this.base=t,this.compartments=n,this.dynamicSlots=i,this.address=e,this.staticValues=r,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<i.length;)this.statusTemplate.push(0)}return D(w,[{key:"staticFacet",value:function t(n){var i=this.address[n.id];return null==i?n.default:this.staticValues[i>>1]}}],[{key:"resolve",value:function t(n,i,s){var e,a,r,o,u,f,h,c,l,v,d,y,m,p,k,g,e=[],a=Object.create(null),r=new Map,o=F(Th(n,i,r));try{for(o.s();!(u=o.n()).done;)((f=u.value)instanceof b?e:a[f.facet.id]||(a[f.facet.id]=[])).push(f)}catch(t){o.e(t)}finally{o.f()}for(h=Object.create(null),c=[],l=[],v=function t(){var n=y[d];h[n.id]=l.length<<1,l.push(function(t){return n.slot(t)})},d=0,y=e;d<y.length;d++)v();for(k in m=null==s?void 0:s.config.facets,p=function t(){var n,i,e,e,r,o,u,n=a[k],i=n[0].facet,e=m&&m[k]||[];if(n.every(function(t){return 0==t.type}))h[i.id]=c.length<<1|1,Eh(e,n)?c.push(s.facet(i)):(e=i.combine(n.map(function(t){return t.value})),c.push(s&&i.compare(e,s.facet(i))?s.facet(i):e));else{r=F(n);try{for(u=function t(){var n=o.value;0==n.type?(h[n.id]=c.length<<1|1,c.push(n.value)):(h[n.id]=l.length<<1,l.push(function(t){return n.dynamicSlot(t)}))},r.s();!(o=r.n()).done;)u()}catch(t){r.e(t)}finally{r.f()}h[i.id]=l.length<<1,l.push(function(t){return Rh(t,i,n)})}},a)p();return new w(n,r,g=l.map(function(t){return t(h)}),h,c,a)}}]),w}(),lt=y.define(),vt=y.define({combine:function t(n){return n.some(function(t){return t})},static:!0}),dt=y.define({combine:function t(n){return n.length?n[0]:void 0},static:!0}),yt=y.define(),mt=y.define(),pt=y.define(),kt=y.define({combine:function t(n){return!!n.length&&n[0]}}),gt=function(){function i(t,n){A(this,i),this.type=t,this.value=n}return D(i,null,[{key:"define",value:function t(){return new wt}}]),i}(),wt=function(){function t(){A(this,t)}return D(t,[{key:"of",value:function t(n){return new gt(this,n)}}]),t}(),bt=function(){function n(t){A(this,n),this.map=t}return D(n,[{key:"of",value:function t(n){return new v(this,n)}}]),n}(),(v=function(){function i(t,n){A(this,i),this.type=t,this.value=n}return D(i,[{key:"map",value:function t(n){var n=this.type.map(this.value,n);return void 0===n?void 0:n==this.value?this:new i(this.type,n)}},{key:"is",value:function t(n){return this.type==n}}],[{key:"define",value:function t(){var n;return new bt((0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}).map||function(t){return t})}},{key:"mapEffects",value:function t(n,i){var e,r,o,u,s;if(!n.length)return n;e=[],r=F(n);try{for(r.s();!(o=r.n()).done;)(s=(u=o.value).map(i))&&e.push(s)}catch(t){r.e(t)}finally{r.f()}return e}}]),i}()).reconfigure=v.define(),v.appendConfig=v.define(),(Mt=function(){function s(t,n,i,e,r,o){A(this,s),this.startState=t,this.changes=n,this.selection=i,this.effects=e,this.annotations=r,this.scrollIntoView=o,this.Qae=null,this.Kh=null,i&&Oh(i,n.newLength),r.some(function(t){return t.type==s.time})||(this.annotations=r.concat(s.time.of(Date.now())))}return D(s,[{key:"newDoc",get:function t(){return this.Qae||(this.Qae=this.changes.apply(this.startState.doc))}},{key:"newSelection",get:function t(){return this.selection||this.startState.selection.map(this.changes)}},{key:"state",get:function t(){return this.Kh||this.startState.applyTransaction(this),this.Kh}},{key:"annotation",value:function t(n){var i,e,r,i=F(this.annotations);try{for(i.s();!(e=i.n()).done;)if((r=e.value).type==n)return r.value}catch(t){i.e(t)}finally{i.f()}}},{key:"docChanged",get:function t(){return!this.changes.empty}},{key:"reconfigured",get:function t(){return this.startState.config!=this.state.config}},{key:"isUserEvent",value:function t(n){var i=this.annotation(s.userEvent);return!(!i||!(i==n||i.length>n.length&&i.slice(0,n.length)==n&&"."==i[n.length]))}}],[{key:"create",value:function t(n,i,e,r,o,u){return new s(n,i,e,r,o,u)}}]),s}()).time=gt.define(),Mt.userEvent=gt.define(),Mt.addToHistory=gt.define(),Mt.remote=gt.define(),xt=[],l=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(l=l||{}),St=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;try{Ct=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(t){}function Vh(t){var n,i;if(Ct)return Ct.test(t);for(n=0;n<t.length;n++)if(i=t[n],/\w/.test(i)||"\x80"<i&&(i.toUpperCase()!=i.toLowerCase()||St.test(i)))return 1}function $h(i){return function(t){if(!/\S/.test(t))return l.Space;if(Vh(t))return l.Word;for(var n=0;n<i.length;n++)if(-1<t.indexOf(i[n]))return l.Word;return l.Other}}function qh(t,n){var i,e,r,o,u,s,a,f,h,c,l,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},e={},r=F(t);try{for(r.s();!(o=r.n()).done;)for(u=o.value,s=0,a=Object.keys(u);s<a.length;s++)if(h=u[f=a[s]],void 0===(c=e[f]))e[f]=h;else if(c!==h&&void 0!==h){if(!Object.hasOwnProperty.call(i,f))throw new Error("Config merge conflict for field "+f);e[f]=i[f](c,h)}}catch(t){r.e(t)}finally{r.f()}for(l in n)void 0===e[l]&&(e[l]=n[l]);return e}function Gh(t,n){return t.from-n.from||t.value.startSide-n.value.startSide}function Jh(t){var n,i,e;if(1<t.length)for(n=t[0],i=1;i<t.length;i++){if(0<Gh(n,e=t[i]))return t.slice().sort(Gh);n=e}return t}function Kh(t,n,i){var e,r,o,u,s,a,f,h,c,l,v,e=new Map,r=F(t);try{for(r.s();!(o=r.n()).done;)for(u=o.value,s=0;s<u.chunk.length;s++)u.chunk[s].maxPoint<=0&&e.set(u.chunk[s],u.chunkPos[s])}catch(t){r.e(t)}finally{r.f()}a=new Set,f=F(n);try{for(f.s();!(h=f.n()).done;)for(c=h.value,l=0;l<c.chunk.length;l++)null==(v=e.get(c.chunk[l]))||(i?i.mapPos(v):v)!=c.chunkPos[l]||null!=i&&i.touchesRange(v,v+c.chunk[l].length)||a.add(c.chunk[l])}catch(t){f.e(t)}finally{f.f()}return a}function Qh(t,n){for(var i,e,r,i=t[n];!((e=1+(n<<1))>=t.length||(r=t[e],e+1<t.length&&0<=r.compare(t[e+1])&&(r=t[e+1],e++),i.compare(r)<0));)t[e]=i,t[n]=r,n=e}function Xh(t,n,i,e,r,o){var u,s,a,f,h,c;for(t.goto(n),i.goto(e),u=e+r,a=(s=e)-n;h=(f=t.to+a-i.to||t.endSide-i.endSide)<0?t.to+a:i.to,c=Math.min(h,u),t.point||i.point?t.point&&i.point&&(t.point==i.point||t.point.eq(i.point))&&Zh(t.activeForPoint(t.to),i.activeForPoint(i.to))||o.comparePoint(s,c,t.point,i.point):s<c&&!Zh(t.active,i.active)&&o.compareRange(s,c,t.active,i.active),!(u<h);)s=h,f<=0&&t.next(),0<=f&&i.next()}function Zh(t,n){if(t.length==n.length){for(var i=0;i<t.length;i++)if(t[i]!=n[i]&&!t[i].eq(n[i]))return;return 1}}function Yh(t,n){for(var i=n,e=t.length-1;i<e;i++)t[i]=t[i+1];t.pop()}function tc(t,n,i){for(var e=t.length-1;n<=e;e--)t[e+1]=t[e];t[n]=i}function nc(t,n){for(var i,e,r,i=-1,e=1e9,r=0;r<n.length;r++)(n[r]-e||t[r].endSide-t[i].endSide)<0&&(e=n[i=r]);return i}function ic(t,n){for(var i,e,r,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:t.length,e=0,r=0;r<i;)9==t.charCodeAt(r)?(e+=n-e%n,r++):(e++,r=yh(t,r));return e}function ec(t,n,i,e){for(var r=0,o=0;;){if(n<=o)return r;if(r==t.length)break;o+=9==t.charCodeAt(r)?i-o%i:1,r=yh(t,r)}return!0===e?-1:t.length}for((C=function(){function c(t,n,i,e,r,o){A(this,c),this.config=t,this.doc=n,this.selection=i,this.values=e,this.status=t.statusTemplate.slice(),this.computeSlot=r,o&&(o.Kh=this);for(var u=0;u<this.config.dynamicSlots.length;u++)Lh(this,u<<1);this.computeSlot=null}return D(c,[{key:"field",value:function t(n){var i,n,i=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],n=this.config.address[n.id];if(null!=n)return Lh(this,n),Bh(this,n);if(i)throw new RangeError("Field is not present in this state")}},{key:"update",value:function t(){for(var n=arguments.length,i=new Array(n),e=0;e<n;e++)i[e]=arguments[e];return Uh(this,i,!0)}},{key:"applyTransaction",value:function t(i){var e,n,r,o,u,s,a,f,r,h,e=this,n=this.config,r=n,o=r.base,u=r.compartments,s=F(i.effects);try{for(s.s();!(a=s.n()).done;)(f=a.value).is(ft.reconfigure)?(n&&(u=new Map,n.compartments.forEach(function(t,n){return u.set(n,t)}),n=null),u.set(f.value.compartment,f.value.extension)):f.is(v.reconfigure)?(n=null,o=f.value):f.is(v.appendConfig)&&(n=null,o=Wh(o).concat(f.value))}catch(t){s.e(t)}finally{s.f()}r=n?i.startState.values.slice():(h=new c(n=ct.resolve(o,u,this),this.doc,this.selection,n.dynamicSlots.map(function(){return null}),function(t,n){return n.reconfigure(t,e)},null)).values,new c(n,i.newDoc,i.newSelection,r,function(t,n){return n.update(t,i)},i)}},{key:"replaceSelection",value:function t(n){return"string"==typeof n&&(n=this.toText(n)),this.changeByRange(function(t){return{changes:{from:t.from,to:t.to,insert:n},range:O.cursor(t.from+n.length)}})}},{key:"changeByRange",value:function t(n){for(var i,e,r,o,u,s,a,f,h,c,f,i=this.selection,e=n(i.ranges[0]),r=this.changes(e.changes),o=[e.range],u=Wh(e.effects),s=1;s<i.ranges.length;s++){for(a=n(i.ranges[s]),h=(f=this.changes(a.changes)).map(r),c=0;c<s;c++)o[c]=o[c].map(h);f=r.mapDesc(f,!0),o.push(a.range.map(f)),r=r.compose(h),u=v.mapEffects(u,h).concat(v.mapEffects(Wh(a.effects),f))}return{changes:r,selection:O.create(o,i.mainIndex),effects:u}}},{key:"changes",value:function t(){var n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[];return n instanceof K?n:K.of(n,this.doc.length,this.facet(c.lineSeparator))}},{key:"toText",value:function t(n){return k.of(n.split(this.facet(c.lineSeparator)||G))}},{key:"sliceDoc",value:function t(){var n,i,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:this.doc.length;return this.doc.sliceString(n,i,this.lineBreak)}},{key:"facet",value:function t(n){var i=this.config.address[n.id];return null==i?n.default:(Lh(this,i),Bh(this,i))}},{key:"toJSON",value:function t(n){var i,e,r,i={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(n)for(e in n)(r=n[e])instanceof b&&null!=this.config.address[r.id]&&(i[e]=r.spec.toJSON(this.field(n[e]),this));return i}},{key:"tabSize",get:function t(){return this.facet(c.tabSize)}},{key:"lineBreak",get:function t(){return this.facet(c.lineSeparator)||"\n"}},{key:"readOnly",get:function t(){return this.facet(kt)}},{key:"phrase",value:function t(n){for(var i,e,r,o,u,s,i=arguments.length,e=new Array(1<i?i-1:0),r=1;r<i;r++)e[r-1]=arguments[r];o=F(this.facet(c.phrases));try{for(o.s();!(u=o.n()).done;)if(s=u.value,Object.prototype.hasOwnProperty.call(s,n)){n=s[n];break}}catch(t){o.e(t)}finally{o.f()}return n=e.length?n.replace(/\$(\$|\d*)/g,function(t,n){var n;return"$"==n?"$":!(n=+(n||1))||n>e.length?t:e[n-1]}):n}},{key:"languageDataAt",value:function t(n,i){var e,r,o,u,s,a,f,h,e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:-1,r=[],o=F(this.facet(lt));try{for(o.s();!(u=o.n()).done;){a=F((s=u.value)(this,i,e));try{for(a.s();!(f=a.n()).done;)h=f.value,Object.prototype.hasOwnProperty.call(h,n)&&r.push(h[n])}catch(t){a.e(t)}finally{a.f()}}}catch(t){o.e(t)}finally{o.f()}return r}},{key:"charCategorizer",value:function t(n){return $h(this.languageDataAt("wordChars",n).join(""))}},{key:"wordAt",value:function t(n){for(var i,e,r,o,u,s,a,f,h,i=this.doc.lineAt(n),e=i.text,r=i.from,o=i.length,u=this.charCategorizer(n),s=n-r,a=n-r;0<s&&(f=yh(e,s,!1),u(e.slice(f,s))==l.Word);)s=f;for(;a<o&&(h=yh(e,a),u(e.slice(a,h))==l.Word);)a=h;return s==a?null:O.range(s+r,a+r)}}],[{key:"fromJSON",value:function t(e){var n,r,o,i,u,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=2<arguments.length?arguments[2]:void 0;if(!e||"string"!=typeof e.doc)throw new RangeError("Invalid JSON representation for EditorState");if(o=[],r)for(u in i=function t(){var n,i;Object.prototype.hasOwnProperty.call(e,u)&&(n=r[u],i=e[u],o.push(n.init(function(t){return n.spec.fromJSON(i,t)})))},r)i();return c.create({doc:e.doc,selection:O.fromJSON(e.selection),extensions:n.extensions?o.concat([n.extensions]):o})}},{key:"create",value:function t(){var n,i,e,n,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},i=ct.resolve(n.extensions||[],new Map),e=n.doc instanceof k?n.doc:k.of((n.doc||"").split(i.staticFacet(c.lineSeparator)||G)),n=n.selection?n.selection instanceof O?n.selection:O.single(n.selection.anchor,n.selection.head):O.single(0);return Oh(n,e.length),i.staticFacet(vt)||(n=n.asSingle()),new c(i,e,n,i.dynamicSlots.map(function(){return null}),function(t,n){return n.create(t)},null)}}]),c}()).allowMultipleSelections=vt,C.tabSize=y.define({combine:function t(n){return n.length?n[0]:4}}),C.lineSeparator=dt,C.readOnly=kt,C.phrases=y.define({compare:function t(n,i){var e=Object.keys(n),r=Object.keys(i);return e.length==r.length&&e.every(function(t){return n[t]==i[t]})}}),C.languageData=lt,C.changeFilter=yt,C.transactionFilter=mt,C.transactionExtender=pt,ft.reconfigure=v.define(),(jt=function(){function t(){A(this,t)}return D(t,[{key:"eq",value:function t(n){return this==n}},{key:"range",value:function t(n){var i;return Pt.create(n,1<arguments.length&&void 0!==arguments[1]?arguments[1]:n,this)}}]),t}()).prototype.startSide=jt.prototype.endSide=0,jt.prototype.point=!1,jt.prototype.mapMode=h.TrackDel,Pt=function(){function r(t,n,i){A(this,r),this.from=t,this.to=n,this.value=i}return D(r,null,[{key:"create",value:function t(n,i,e){return new r(n,i,e)}}]),r}(),Ot=function(){function y(t,n,i,e){A(this,y),this.from=t,this.to=n,this.value=i,this.maxPoint=e}return D(y,[{key:"length",get:function t(){return this.to[this.to.length-1]}},{key:"findIndex",value:function t(n,i,e){for(var r,o,u,s,a,f,r,o=e?this.to:this.from,u=3<arguments.length&&void 0!==arguments[3]?arguments[3]:0,s=o.length;;){if(u==s)return u;if(f=o[a=u+s>>1]-n||(e?this.value[a].endSide:this.value[a].startSide)-i,a==u)return 0<=f?u:s;0<=f?s=a:u=1+a}}},{key:"between",value:function t(n,i,e,r){for(var o=this.findIndex(i,-1e9,!0),u=this.findIndex(e,1e9,!1,o);o<u;o++)if(!1===r(this.from[o]+n,this.to[o]+n,this.value[o]))return!1}},{key:"map",value:function t(n,i){for(var e,r,o,u,s,a,f,h,c,l,v,d,e=[],r=[],o=[],u=-1,s=-1,a=0;a<this.value.length;a++){if(f=this.value[a],v=l=void 0,(h=this.from[a]+n)==(c=this.to[a]+n)){if(null==(d=i.mapPos(h,f.startSide,f.mapMode)))continue;if(l=v=d,f.startSide!=f.endSide&&(v=i.mapPos(h,f.endSide))<l)continue}else if(l=i.mapPos(h,f.startSide),(v=i.mapPos(c,f.endSide))<l||l==v&&0<f.startSide&&f.endSide<=0)continue;(v-l||f.endSide-f.startSide)<0||(u<0&&(u=l),f.point&&(s=Math.max(s,v-l)),e.push(f),r.push(l-u),o.push(v-u))}return{mapped:e.length?new y(r,o,e,s):null,pos:u}}}]),y}(),(j=function(){function d(t,n,i,e){A(this,d),this.chunkPos=t,this.chunk=n,this.nextLayer=i,this.maxPoint=e}return D(d,[{key:"length",get:function t(){var n=this.chunk.length-1;return n<0?0:Math.max(this.chunkEnd(n),this.nextLayer.length)}},{key:"size",get:function t(){var n,i,e,r;if(this.isEmpty)return 0;n=this.nextLayer.size,i=F(this.chunk);try{for(i.s();!(e=i.n()).done;)n+=(r=e.value).value.length}catch(t){i.e(t)}finally{i.f()}return n}},{key:"chunkEnd",value:function t(n){return this.chunkPos[n]+this.chunk[n].length}},{key:"update",value:function t(n){var i,e,i,r,o,u,o,s,a,f,h,c,l,v,i=n.add,e=void 0===i?[]:i,i=n.sort,r,o=n.filterFrom,u=void 0===o?0:o,o=n.filterTo,s=void 0===o?this.length:o,a=n.filter;if(0==e.length&&!a)return this;if(void 0!==i&&i&&(e=e.slice().sort(Gh)),this.isEmpty)return e.length?d.of(e):this;for(f=new At(this,null,-1).goto(0),h=0,c=[],l=new Et;f.value||h<e.length;)h<e.length&&0<=(f.from-e[h].from||f.startSide-e[h].value.startSide)?(v=e[h++],l.addInner(v.from,v.to,v.value)||c.push(v)):1==f.rangeIndex&&f.chunkIndex<this.chunk.length&&(h==e.length||this.chunkEnd(f.chunkIndex)<e[h].from)&&(!a||u>this.chunkEnd(f.chunkIndex)||s<this.chunkPos[f.chunkIndex])&&l.addChunk(this.chunkPos[f.chunkIndex],this.chunk[f.chunkIndex])?f.nextChunk():((!a||u>f.to||s<f.from||a(f.from,f.to,f.value))&&!l.addInner(f.from,f.to,f.value)&&c.push(Pt.create(f.from,f.to,f.value)),f.next());return l.finishInner(this.nextLayer.isEmpty&&!c.length?d.empty:this.nextLayer.update({add:c,filter:a,filterFrom:u,filterTo:s}))}},{key:"map",value:function t(n){var i,e,r,o,u,s,a,a,s,u,f;if(n.empty||this.isEmpty)return this;for(i=[],e=[],r=-1,o=0;o<this.chunk.length;o++)u=this.chunkPos[o],s=this.chunk[o],!1===(a=n.touchesRange(u,u+s.length))?(r=Math.max(r,s.maxPoint),i.push(s),e.push(n.mapPos(u))):!0===a&&(s=(a=s.map(u,n)).mapped,u=a.pos,s)&&(r=Math.max(r,s.maxPoint),i.push(s),e.push(u));return f=this.nextLayer.map(n),0==i.length?f:new d(e,i,f||d.empty,r)}},{key:"between",value:function t(n,i,e){var r,o,u;if(!this.isEmpty){for(r=0;r<this.chunk.length;r++)if(o=this.chunkPos[r],u=this.chunk[r],o<=i&&n<=o+u.length&&!1===u.between(o,n-o,i-o,e))return;this.nextLayer.between(n,i,e)}}},{key:"iter",value:function t(){var n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0;return Dt.from([this]).goto(n)}},{key:"isEmpty",get:function t(){return this.nextLayer==this}}],[{key:"create",value:function t(n,i,e,r){return new d(n,i,e,r)}},{key:"iter",value:function t(n){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;return Dt.from(n).goto(i)}},{key:"compare",value:function t(n,i,e,r){var o,n,i,u,s,a,o=4<arguments.length&&void 0!==arguments[4]?arguments[4]:-1,n=n.filter(function(t){return 0<t.maxPoint||!t.isEmpty&&t.maxPoint>=o}),i=i.filter(function(t){return 0<t.maxPoint||!t.isEmpty&&t.maxPoint>=o}),u=Kh(n,i,e),s=new Rt(n,u,o),a=new Rt(i,u,o);e.iterGaps(function(t,n,i){return Xh(s,t,a,n,i,r)}),e.empty&&0==e.length&&Xh(s,0,a,0,0,r)}},{key:"eq",value:function t(n,i){var e,r,o,u,s,a,f,e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,r=3<arguments.length?arguments[3]:void 0;if(null==r&&(r=1e9-1),o=n.filter(function(t){return!t.isEmpty&&i.indexOf(t)<0}),u=i.filter(function(t){return!t.isEmpty&&n.indexOf(t)<0}),o.length!=u.length)return!1;if(!o.length)return!0;for(s=Kh(o,u),a=new Rt(o,s,0).goto(e),f=new Rt(u,s,0).goto(e);;){if(a.to!=f.to||!Zh(a.active,f.active)||a.point&&(!f.point||!a.point.eq(f.point)))return!1;if(a.to>r)return!0;a.next(),f.next()}}},{key:"spans",value:function t(n,i,e,r){for(var o,u,s,a,f,h,c,o,u=new Rt(n,null,4<arguments.length&&void 0!==arguments[4]?arguments[4]:-1).goto(i),s=i,a=u.openStart;;){if(f=Math.min(u.to,e),u.point?(h=u.activeForPoint(u.to),c=u.pointFrom<i?h.length+1:Math.min(h.length,a),r.point(s,f,u.point,h,c,u.pointRank),a=Math.min(u.openEnd(f),h.length)):s<f&&(r.span(s,f,u.active,a),a=u.openEnd(f)),u.to>e)return a+(u.point&&u.to>e?1:0);s=u.to,u.next()}}},{key:"of",value:function t(n){var i,e,r,o,u,i=1<arguments.length&&void 0!==arguments[1]&&arguments[1],e=new Et,r=F(n instanceof Pt?[n]:i?Jh(n):n);try{for(r.s();!(o=r.n()).done;)u=o.value,e.add(u.from,u.to,u.value)}catch(t){r.e(t)}finally{r.f()}return e.finish()}}]),d}()).empty=new j([],[],null,-1),j.empty.nextLayer=j.empty,Et=function(){function r(){A(this,r),this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}return D(r,[{key:"finishChunk",value:function t(n){this.chunks.push(new Ot(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,n&&(this.from=[],this.to=[],this.value=[])}},{key:"add",value:function t(n,i,e){this.addInner(n,i,e)||(this.nextLayer||(this.nextLayer=new r)).add(n,i,e)}},{key:"addInner",value:function t(n,i,e){var r=n-this.lastTo||e.startSide-this.last.endSide;if(r<=0&&(n-this.lastFrom||e.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return!(r<0||(250==this.from.length&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=n),this.from.push(n-this.chunkStart),this.to.push(i-this.chunkStart),this.last=e,this.lastFrom=n,this.lastTo=i,this.value.push(e),e.point&&(this.maxPoint=Math.max(this.maxPoint,i-n)),0))}},{key:"addChunk",value:function t(n,i){if((n-this.lastTo||i.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,i.maxPoint),this.chunks.push(i),this.chunkPos.push(n);var e=i.value.length-1;return this.last=i.value[e],this.lastFrom=i.from[e]+n,this.lastTo=i.to[e]+n,!0}},{key:"finish",value:function t(){return this.finishInner(j.empty)}},{key:"finishInner",value:function t(n){var n;return this.from.length&&this.finishChunk(!1),0==this.chunks.length||(n=j.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(n):n,this.setMaxPoint),this.from=null),n}}]),r}(),At=function(){function r(t,n,i){var e=3<arguments.length&&void 0!==arguments[3]?arguments[3]:0;A(this,r),this.layer=t,this.skip=n,this.minPoint=i,this.rank=e}return D(r,[{key:"startSide",get:function t(){return this.value?this.value.startSide:0}},{key:"endSide",get:function t(){return this.value?this.value.endSide:0}},{key:"goto",value:function t(n){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:-1e9;return this.chunkIndex=this.rangeIndex=0,this.gotoInner(n,i,!1),this}},{key:"gotoInner",value:function t(n,i,e){for(var r,i;this.chunkIndex<this.layer.chunk.length&&(r=this.layer.chunk[this.chunkIndex],this.skip&&this.skip.has(r)||this.layer.chunkEnd(this.chunkIndex)<n||r.maxPoint<this.minPoint);)this.chunkIndex++,e=!1;this.chunkIndex<this.layer.chunk.length&&(i=this.layer.chunk[this.chunkIndex].findIndex(n-this.layer.chunkPos[this.chunkIndex],i,!0),!e||this.rangeIndex<i)&&this.setRangeIndex(i),this.next()}},{key:"forward",value:function t(n,i){(this.to-n||this.endSide-i)<0&&this.gotoInner(n,i,!0)}},{key:"next",value:function t(){for(var n,i,e;;){if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}if(e=(n=this.layer.chunkPos[this.chunkIndex])+(i=this.layer.chunk[this.chunkIndex]).from[this.rangeIndex],this.from=e,this.to=n+i.to[this.rangeIndex],this.value=i.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}},{key:"setRangeIndex",value:function t(n){if(n==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=n}},{key:"nextChunk",value:function t(){this.chunkIndex++,this.rangeIndex=0,this.next()}},{key:"compare",value:function t(n){return this.from-n.from||this.startSide-n.startSide||this.rank-n.rank||this.to-n.to||this.endSide-n.endSide}}]),r}(),Dt=function(){function s(t){A(this,s),this.heap=t}return D(s,[{key:"startSide",get:function t(){return this.value?this.value.startSide:0}},{key:"goto",value:function t(n){var i,e,r,o,u,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:-1e9,e=F(this.heap);try{for(e.s();!(r=e.n()).done;)(o=r.value).goto(n,i)}catch(t){e.e(t)}finally{e.f()}for(u=this.heap.length>>1;0<=u;u--)Qh(this.heap,u);return this.next(),this}},{key:"forward",value:function t(n,i){var e,r,o,u,e=F(this.heap);try{for(e.s();!(r=e.n()).done;)(o=r.value).forward(n,i)}catch(t){e.e(t)}finally{e.f()}for(u=this.heap.length>>1;0<=u;u--)Qh(this.heap,u);(this.to-n||this.value.endSide-i)<0&&this.next()}},{key:"next",value:function t(){var n;0==this.heap.length?(this.from=this.to=1e9,this.value=null,this.rank=-1):(n=this.heap[0],this.from=n.from,this.to=n.to,this.value=n.value,this.rank=n.rank,n.value&&n.next(),Qh(this.heap,0))}}],[{key:"from",value:function t(n){for(var i,e,r,o,u,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:-1,r=[],o=0;o<n.length;o++)for(u=n[o];!u.isEmpty;u=u.nextLayer)u.maxPoint>=e&&r.push(new At(u,i,e,o));return 1==r.length?r[0]:new s(r)}}]),s}(),Rt=function(){function e(t,n,i){A(this,e),this.minPoint=i,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Dt.from(t,n,i)}return D(e,[{key:"goto",value:function t(n){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:-1e9;return this.cursor.goto(n,i),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=n,this.endSide=i,this.openStart=-1,this.next(),this}},{key:"forward",value:function t(n,i){for(;-1<this.minActive&&(this.activeTo[this.minActive]-n||this.active[this.minActive].endSide-i)<0;)this.removeActive(this.minActive);this.cursor.forward(n,i)}},{key:"removeActive",value:function t(n){Yh(this.active,n),Yh(this.activeTo,n),Yh(this.activeRank,n),this.minActive=nc(this.active,this.activeTo)}},{key:"addActive",value:function t(n){for(var i=0,e=this.cursor,r=e.value,o=e.to,u=e.rank;i<this.activeRank.length&&this.activeRank[i]<=u;)i++;tc(this.active,i,r),tc(this.activeTo,i,o),tc(this.activeRank,i,u),n&&tc(n,i,this.cursor.from),this.minActive=nc(this.active,this.activeTo)}},{key:"next",value:function t(){var n,i,e,r,r,o,n=this.to,i=this.point;for(this.point=null,e=this.openStart<0?[]:null;;)if(-1<(r=this.minActive)&&(this.activeTo[r]-this.cursor.from||this.active[r].endSide-this.cursor.startSide)<0){if(this.activeTo[r]>n){this.to=this.activeTo[r],this.endSide=this.active[r].endSide;break}this.removeActive(r),e&&Yh(e,r)}else{if(!this.cursor.value){this.to=this.endSide=1e9;break}if(this.cursor.from>n){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}if((r=this.cursor.value).point){if(!(i&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)){this.point=r,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=r.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else this.addActive(e);this.cursor.next()}if(e)for(this.openStart=0,o=e.length-1;0<=o&&e[o]<n;o--)this.openStart++}},{key:"activeForPoint",value:function t(n){var i,e;if(!this.active.length)return this.active;for(i=[],e=this.active.length-1;0<=e&&!(this.activeRank[e]<this.pointRank);e--)(this.activeTo[e]>n||this.activeTo[e]==n&&this.active[e].endSide>=this.point.endSide)&&i.push(this.active[e]);return i.reverse()}},{key:"openEnd",value:function t(n){for(var i,e,i=0,e=this.activeTo.length-1;0<=e&&this.activeTo[e]>n;e--)i++;return i}}]),e}(),It=L.State=Object.freeze({__proto__:null,Annotation:gt,AnnotationType:wt,ChangeDesc:J,ChangeSet:K,get CharCategory(){return l},Compartment:ft,EditorSelection:O,EditorState:C,Facet:y,Line:W,get MapMode(){return h},Prec:st,Range:Pt,RangeSet:j,RangeSetBuilder:Et,RangeValue:jt,SelectionRange:X,StateEffect:v,StateEffectType:bt,StateField:b,Text:k,Transaction:Mt,codePointAt:wh,codePointSize:Mh,combineConfig:qh,countColumn:ic,findClusterBreak:yh,findColumn:ec,fromCodePoint:bh}),Tt="\u037c",Lt="undefined"==typeof Symbol?"__\u037c":Symbol.for(Tt),Bt="undefined"==typeof Symbol?"__styleSet"+Math.floor(1e8*Math.random()):Symbol("styleSet"),_t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:{},Ft=function(){function r(t,n){var i,f,e;function h(t){return/^@/.test(t)?[t]:t.split(/,\s*/)}function c(t,n,i,e){var r,o,u,s,a,r=[],o=/^@(\w+)\b/.exec(t[0]),u=o&&"keyframes"==o[1];if(o&&null==n)return i.push(t[0]+";");for(s in n)if(a=n[s],/&/.test(s))c(s.split(/,\s*/).map(function(n){return t.map(function(t){return n.replace(/&/,t)})}).reduce(function(t,n){return t.concat(n)}),a,i);else if(a&&"object"==uh(a)){if(!o)throw new RangeError("The value of a property ("+s+") should be a primitive value.");c(h(s),a,r,u)}else null!=a&&r.push(s.replace(/_.*/,"").replace(/[A-Z]/g,function(t){return"-"+t.toLowerCase()})+": "+a+";");(r.length||u)&&i.push((!f||o||e?t:t.map(f)).join(", ")+" {"+r.join(" ")+"}")}for(e in A(this,r),this.rules=[],f=(i=n||{}).finish,t)c(h(e),t[e],this.rules)}return D(r,[{key:"getRules",value:function t(){return this.rules.join("\n")}}],[{key:"newName",value:function t(){var n=_t[Lt]||1;return _t[Lt]=n+1,Tt+n.toString(36)}},{key:"mount",value:function t(n,i){(n[Bt]||new Ut(n)).mount(Array.isArray(i)?i:[i])}}]),r}(),Nt=new Map,Ut=function(){function r(t){var n,i,e,e;if(A(this,r),i=(n=t.ownerDocument||t).defaultView,!t.head&&t.adoptedStyleSheets&&i.CSSStyleSheet){if(e=Nt.get(n))return t.adoptedStyleSheets=[e.sheet].concat(Wf(t.adoptedStyleSheets)),t[Bt]=e;this.sheet=new i.CSSStyleSheet,t.adoptedStyleSheets=[this.sheet].concat(Wf(t.adoptedStyleSheets)),Nt.set(n,this)}else this.styleTag=n.createElement("style"),(e=t.head||t).insertBefore(this.styleTag,e.firstChild);this.modules=[],t[Bt]=this}return D(r,[{key:"mount",value:function t(n){for(var i,e,r,o,u,s,a,f,h,i=this.sheet,e=0,r=0,o=0;o<n.length;o++)if(u=n[o],(s=this.modules.indexOf(u))<r&&-1<s&&(this.modules.splice(s,1),r--,s=-1),-1==s){if(this.modules.splice(r++,0,u),i)for(a=0;a<u.rules.length;a++)i.insertRule(u.rules[a],e++)}else{for(;r<s;)e+=this.modules[r++].rules.length;e+=u.rules.length,r++}if(!i){for(f="",h=0;h<this.modules.length;h++)f+=this.modules[h].getRules()+"\n";this.styleTag.textContent=f}}}]),r}(),Ht={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},zt={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},t="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent),n="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Wt="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Vt=n||t&&+t[1]<57,i=0;i<10;i++)Ht[48+i]=Ht[96+i]=String(i);for(i=1;i<=24;i++)Ht[i+111]="F"+i;for(i=65;i<=90;i++)Ht[i]=String.fromCharCode(i+32),zt[i]=String.fromCharCode(i);for($t in Ht)zt.hasOwnProperty($t)||(zt[$t]=Ht[$t]);function rc(t){var n,t,n,t=!(Vt&&(t.ctrlKey||t.altKey||t.metaKey)||Wt&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key)&&t.key||(t.shiftKey?zt:Ht)[t.keyCode]||t.key||"Unidentified";return t="Down"==(t="Right"==(t="Up"==(t="Left"==(t="Del"==(t="Esc"==t?"Escape":t)?"Delete":t)?"ArrowLeft":t)?"ArrowUp":t)?"ArrowRight":t)?"ArrowDown":t}function oc(t){var t,t=11!=t.nodeType||t.getSelection?t:t.ownerDocument;return t.getSelection()}function uc(t,n){return!!n&&(t==n||t.contains(1!=n.nodeType?n.parentNode:n))}function sc(t){for(var n=t.activeElement;n&&n.shadowRoot;)n=n.shadowRoot.activeElement;return n}function ac(t,n){if(!n.anchorNode)return!1;try{return uc(t,n.anchorNode)}catch(t){return!1}}function fc(t){return 3==t.nodeType?gc(t,0,t.nodeValue.length).getClientRects():1==t.nodeType?t.getClientRects():[]}function hc(t,n,i,e){return i&&(lc(t,n,i,e,-1)||lc(t,n,i,e,1))}function cc(t){for(var n=0;;n++)if(!(t=t.previousSibling))return n}function lc(t,n,i,e,r){for(;;){if(t==i&&n==e)return!0;if(n==(r<0?0:vc(t))){if("DIV"==t.nodeName)return!1;var o=t.parentNode;if(!o||1!=o.nodeType)return!1;n=cc(t)+(r<0?0:1),t=o}else{if(1!=t.nodeType)return!1;if(1==(t=t.childNodes[n+(r<0?-1:0)]).nodeType&&"false"==t.contentEditable)return!1;n=r<0?vc(t):0}}}function vc(t){return(3==t.nodeType?t.nodeValue:t.childNodes).length}function dc(t,n){var n=n?t.left:t.right;return{left:n,right:n,top:t.top,bottom:t.bottom}}function yc(t){return{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function mc(t,n,i,e,r,o,u,s){for(var a,f,h,c,l,v,v,d,y,m,p,k,y,m,c,c,a=t.ownerDocument,f=a.defaultView||window,h=t;h;)if(1==h.nodeType){if(c=void 0,l=h==a.body)c=yc(f);else{if(h.scrollHeight<=h.clientHeight&&h.scrollWidth<=h.clientWidth){h=h.assignedSlot||h.parentNode;continue}c={left:(v=h.getBoundingClientRect()).left,right:v.left+h.clientWidth,top:v.top,bottom:v.top+h.clientHeight}}if(d=v=0,"nearest"==r?n.top<c.top?(d=-(c.top-n.top+u),0<i&&n.bottom>c.bottom+d&&(d=n.bottom-c.bottom+d+u)):n.bottom>c.bottom&&(d=n.bottom-c.bottom+u,i<0)&&n.top-d<c.top&&(d=-(c.top+d-n.top+u)):(y=n.bottom-n.top,m=c.bottom-c.top,d=(p="center"==r&&y<=m?n.top+y/2-m/2:"start"==r||"center"==r&&i<0?n.top-u:n.bottom-m+u)-c.top),"nearest"==e?n.left<c.left?(v=-(c.left-n.left+o),0<i&&n.right>c.right+v&&(v=n.right-c.right+v+o)):n.right>c.right&&(v=n.right-c.right+o,i<0)&&n.left<c.left+v&&(v=-(c.left+v-n.left+o)):v=(k="center"==e?n.left+(n.right-n.left)/2-(c.right-c.left)/2:"start"==e==s?n.left-o:n.right-(c.right-c.left)+o)-c.left,(v||d)&&(l?f.scrollBy(v,d):(m=y=0,d&&(c=h.scrollTop,h.scrollTop+=d,m=h.scrollTop-c),v&&(c=h.scrollLeft,h.scrollLeft+=v,y=h.scrollLeft-c),n={left:n.left-y,top:n.top-m,right:n.right-y,bottom:n.bottom-m},y&&Math.abs(y-v)<1&&(e="nearest"),m&&Math.abs(m-d)<1&&(r="nearest"))),l)break;h=h.assignedSlot||h.parentNode}else{if(11!=h.nodeType)break;h=h.host}}function pc(t){for(var n,i,n=t.ownerDocument,i=t.parentNode;i&&i!=n.body;)if(1==i.nodeType){if(i.scrollHeight>i.clientHeight||i.scrollWidth>i.clientWidth)return i;i=i.assignedSlot||i.parentNode}else{if(11!=i.nodeType)break;i=i.host}return null}function kc(t){var n,i,e,r,o,u;if(t.setActive)return t.setActive();if(Gt)return t.focus(Gt);for(n=[],i=t;i&&(n.push(i,i.scrollTop,i.scrollLeft),i!=i.ownerDocument);i=i.parentNode);if(t.focus(null==Gt?{get preventScroll(){return Gt={preventScroll:!0},!0}}:void 0),!Gt)for(Gt=!1,e=0;e<n.length;)r=n[e++],o=n[e++],u=n[e++],r.scrollTop!=o&&(r.scrollTop=o),r.scrollLeft!=u&&(r.scrollLeft=u)}function gc(t,n,i){var i,e,i=2<arguments.length&&void 0!==i?i:n,e=Jt=Jt||document.createRange();return e.setEnd(t,i),e.setStart(t,n),e}function wc(t,n,i){var n,i,n,n={key:n,code:n,keyCode:i,which:i,cancelable:!0},i=new KeyboardEvent("keydown",n);return i.synthetic=!0,t.dispatchEvent(i),(n=new KeyboardEvent("keyup",n)).synthetic=!0,t.dispatchEvent(n),i.defaultPrevented||n.defaultPrevented}function bc(t){for(;t;){if(t&&(9==t.nodeType||11==t.nodeType&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}function Mc(t){for(;t.attributes.length;)t.removeAttributeNode(t.attributes[0])}function xc(t,n){var i,e,r,i=n.focusNode,e=n.focusOffset;if(i&&n.anchorNode==i&&n.anchorOffset==e)for(e=Math.min(e,vc(i));;)if(e){if(1!=i.nodeType)return;"false"==(r=i.childNodes[e-1]).contentEditable?e--:e=vc(i=r)}else{if(i==t)return 1;e=cc(i),i=i.parentNode}}function Sc(t){var n=t.nextSibling;return t.parentNode.removeChild(t),n}function Cc(t,n,i,e,r,o,u,s,a){var f,h,c,l,v,f=t.children,h=f.length?f[n]:null,c=o.length?o[o.length-1]:null,l=c?c.breakAfter:u;if(!(n==e&&h&&!u&&!l&&o.length<2&&h.merge(i,r,o.length?c:null,0==i,s,a))){for(e<f.length&&((v=f[e])&&r<v.length?(n==e&&(v=v.split(r),r=0),!l&&c&&v.merge(0,r,c,!0,0,a)?o[o.length-1]=v:(r&&v.merge(0,r,null,!1,0,a),o.push(v))):null!=v&&v.breakAfter&&(c?c.breakAfter=1:u=1),e++),h&&(h.breakAfter=u,0<i)&&(!u&&o.length&&h.merge(i,h.length,o[0],!1,s,0)?h.breakAfter=o.shift().breakAfter:(i<h.length||h.children.length&&0==h.children[h.children.length-1].length)&&h.merge(i,h.length,null,!1,s,0),n++);n<e&&o.length;)if(f[e-1].become(o[o.length-1]))e--,o.pop(),a=o.length?0:s;else{if(!f[n].become(o[0]))break;n++,o.shift(),s=o.length?0:a}!o.length&&n&&e<f.length&&!f[n-1].breakAfter&&f[e].merge(0,0,f[n-1],!1,s,a)&&n--,(n<e||o.length)&&t.replaceChildren(n,e,o)}}function jc(t,n,i,e,r,o){var u,s,a,s,u,f,u,h,c,l,v,u=t.childCursor(),s=u.findPos(i,1),a=s.i,s=s.off,u=u.findPos(n,-1),f=u.i,u=u.off,h=n-i,c=F(e);try{for(c.s();!(l=c.n()).done;)h+=(v=l.value).length}catch(t){c.e(t)}finally{c.f()}t.length+=h,Cc(t,f,u,a,s,e,0,r,o)}function Pc(t,n,i){var e,r,o,u,n,e,e=t.nodeValue.length;return(u=0)==(o=r=n=e<n?e:n)&&i<0||n==e&&0<=i?g.chrome||g.gecko||(n?(r--,u=1):o<e&&(o++,u=-1)):i<0?r--:o<e&&o++,(n=gc(t,r,o).getClientRects()).length?(e=n[(u?u<0:0<=i)?0:n.length-1],g.safari&&!u&&0==e.width&&(e=Array.prototype.find.call(n,function(t){return t.width})||e),u?dc(e,u<0):e||null):null}function Oc(t,n,i,e,r,o,u){var s,a,f,f,h;if(i instanceof un){for(s=i.dom.firstChild;s;s=s.nextSibling)if(a=c.get(s)){if(f=uc(s,e),t<(h=a.length+(f?r:0))||t==h&&a.getSide()<=0)return f?Oc(t,n,a,e,r,o,u):o(a,t,n);t-=h}else{if("number"!=typeof(f=Ec(t,n,s,u)))return f;t=f}return o(i,i.length,-1)}return i.dom==e?u(e,t,n):o(i,t,n)}function Ec(t,n,i,e){var r,o,u;if(3==i.nodeType){if(t<=(r=i.nodeValue.length))return e(i,t,n);t-=r}else if(1==i.nodeType&&"false"!=i.contentEditable)for(o=i.firstChild;o;o=o.nextSibling){if("number"!=typeof(u=Ec(t,n,o,e)))return u;t=u}return t}function Ac(t,n,i,e,r){var o,u,s,a,s;if(i instanceof un)for(o=0,u=i.dom.firstChild;u;u=u.nextSibling)if(s=c.get(u)){if(a=uc(u,e),uc(u,t))return o+(a?Ac(t,n,s,e,r):s.localPosFromDOM(t,n));o+=s.length+(a?r:0)}else{if(null!=(s=Dc(t,n,u)).result)return o+s.result;o+=s.size}else if(i.dom==e)return Math.min(n,e.nodeValue.length);return i.localPosFromDOM(t,n)}function Dc(t,n,i){var e,r,o,u;if(3==i.nodeType)return t==i?{result:n}:{size:i.nodeValue.length};if(1!=i.nodeType||"false"==i.contentEditable)return i.contains(t)?{result:0}:{size:0};for(r=i.firstChild,o=e=0;;r=r.nextSibling,o++){if(t==i&&o==n)return{result:e};if(!r)return{size:e};if(null!=(u=Dc(t,n,r)).result)return{result:n+u.result};e+=u.size}}function Rc(t,n){for(var i,e,r,o,u,s,a,f,h,c,i=t.dom,e=t.children,r=0,o=0;r<e.length;r++)if(!((s=o+(u=e[r]).length)==o&&u.getSide()<=0)){if(o<n&&n<s&&u.dom.parentNode==i)return u.domAtPos(n-o);if(n<=o)break;o=s}for(a=r;0<a;a--)if((f=e[a-1]).dom.parentNode==i)return f.domAtPos(f.length);for(h=r;h<e.length;h++)if((c=e[h]).dom.parentNode==i)return c.domAtPos(0);return new Kt(i,0)}function Ic(t,n,i){var e,r=t.children;0<i&&n instanceof un&&r.length&&(e=r[r.length-1])instanceof un&&e.mark.eq(n.mark)?Ic(e,n.children[0],i-1):(r.push(n),n.setParent(t)),t.length+=n.length}function Tc(t,n,u){var s,a,f,h,n;function c(t,n){for(var i,e,r,o,i=0,e=0;i<t.children.length&&e<=n;i++)n<=(o=e+(r=t.children[i]).length)&&(r.children.length?c(r,n-e):(!f||f.isHidden&&0<u)&&(n<o||e==o&&0<r.getSide())?(f=r,h=n-e):(e<n||e==o&&r.getSide()<0&&!r.isHidden)&&(s=r,a=n-e)),e=o}return f=s=null,h=a=-1,c(t,n),(n=(u<0?s:f)||s||f)?n.coordsAt(Math.max(0,n==s?a:h),u):Lc(t)}function Lc(t){var n,n,n=t.dom.lastChild;return n?(n=fc(n))[n.length-1]||null:t.dom.getBoundingClientRect()}function Bc(t,n){for(var i in t)"class"==i&&n.class?n.class+=" "+t.class:"style"==i&&n.style?n.style+=";"+t.style:n[i]=t[i];return n}function _c(t,n){var i,e,r,o,u;if(t!=n){if(!t||!n)return!1;if(i=Object.keys(t),e=Object.keys(n),i.length!=e.length)return!1;for(r=0,o=i;r<o.length;r++)if(u=o[r],-1==e.indexOf(u)||t[u]!==n[u])return!1}return!0}function Fc(t,n,i){var e,r,o,e=null;if(n)for(r in n)i&&r in i||t.removeAttribute(e=r);if(i)for(o in i)n&&n[o]==i[o]||t.setAttribute(e=o,i[o]);return!!e}function Nc(t,n){var n,i,e,n=1<arguments.length&&void 0!==n&&n,i=t.inclusiveStart,e=t.inclusiveEnd;return{start:null!=(i=null==i?t.inclusive:i)?i:n,end:null!=(e=null==e?t.inclusive:e)?e:n}}function Uc(t,n){return t==n||!!(t&&n&&t.compare(n))}function Hc(t,n,i,e){var r,o,r,o=i.length-1;0<=o&&i[o]+(3<arguments.length&&void 0!==e?e:0)>=t?i[o]=Math.max(i[o],n):i.push(t,n)}function zc(t,n){var i,e,r,i=F(n);try{for(i.s();!(e=i.n()).done;)r=e.value,t=new un(r,[t],t.length)}catch(t){i.e(t)}finally{i.f()}return t}function Wc(t,n,i){var t=t.facet(wn);t.length?t[0](n):window.onerror?window.onerror(String(n),i,void 0,void 0,n):i?console.error(i+":",n):console.error(n)}function Vc(t){var n,i,e,r,o,u,s,a,n=0,i=0,e=0,r=0,o=F(t.state.facet(Bn));try{for(o.s();!(u=o.n()).done;)(a=(s=u.value)(t))&&(null!=a.left&&(n=Math.max(n,a.left)),null!=a.right&&(i=Math.max(i,a.right)),null!=a.top&&(e=Math.max(e,a.top)),null!=a.bottom)&&(r=Math.max(r,a.bottom))}catch(t){o.e(t)}finally{o.f()}return{left:n,right:i,top:e,bottom:r}}function $c(t){for(var n,i,n=[],i=0;i<t.length;i++)n.push(1<<+t[i]);return n}qt=function(){function t(){A(this,t),this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}return D(t,[{key:"eq",value:function t(n){return this.anchorNode==n.anchorNode&&this.anchorOffset==n.anchorOffset&&this.focusNode==n.focusNode&&this.focusOffset==n.focusOffset}},{key:"setRange",value:function t(n){var i=n.anchorNode,e=n.focusNode;this.set(i,Math.min(n.anchorOffset,i?vc(i):0),e,Math.min(n.focusOffset,e?vc(e):0))}},{key:"set",value:function t(n,i,e,r){this.anchorNode=n,this.anchorOffset=i,this.focusNode=e,this.focusOffset=r}}]),t}(),Gt=null,Kt=function(){function e(t,n){var i=!(2<arguments.length&&void 0!==arguments[2])||arguments[2];A(this,e),this.node=t,this.offset=n,this.precise=i}return D(e,null,[{key:"before",value:function t(n,i){return new e(n.parentNode,cc(n),i)}},{key:"after",value:function t(n,i){return new e(n.parentNode,cc(n)+1,i)}}]),e}(),Qt=[],(c=function(){function v(){A(this,v),this.parent=null,this.dom=null,this.dirty=2}return D(v,[{key:"overrideDOMText",get:function t(){return null}},{key:"posAtStart",get:function t(){return this.parent?this.parent.posBefore(this):0}},{key:"posAtEnd",get:function t(){return this.posAtStart+this.length}},{key:"posBefore",value:function t(n){var i,e,r,o,i=this.posAtStart,e=F(this.children);try{for(e.s();!(r=e.n()).done;){if((o=r.value)==n)return i;i+=o.length+o.breakAfter}}catch(t){e.e(t)}finally{e.f()}throw new RangeError("Invalid child in posBefore")}},{key:"posAfter",value:function t(n){return this.posBefore(n)+n.length}},{key:"sync",value:function t(n,i){var e,r,o,u,s,a,f,h,c,l;if(2&this.dirty){e=this.dom,r=null,u=F(this.children);try{for(u.s();!(s=u.n()).done;){if((a=s.value).dirty&&(a.dom||!(o=r?r.nextSibling:e.firstChild)||(f=v.get(o))&&(f.parent||!f.canReuseDOM(a))||a.reuseDOM(o),a.sync(n,i),a.dirty=0),o=r?r.nextSibling:e.firstChild,i&&!i.written&&i.node==e&&o!=a.dom&&(i.written=!0),a.dom.parentNode==e)for(;o&&o!=a.dom;)o=Sc(o);else e.insertBefore(a.dom,o);r=a.dom}}catch(t){u.e(t)}finally{u.f()}for((o=r?r.nextSibling:e.firstChild)&&i&&i.node==e&&(i.written=!0);o;)o=Sc(o)}else if(1&this.dirty){h=F(this.children);try{for(h.s();!(c=h.n()).done;)(l=c.value).dirty&&(l.sync(n,i),l.dirty=0)}catch(t){h.e(t)}finally{h.f()}}}},{key:"reuseDOM",value:function t(n){}},{key:"localPosFromDOM",value:function t(n,i){var e,r,o,u,s,a;if(n==this.dom)e=this.dom.childNodes[i];else{for(r=0==vc(n)?0:0==i?-1:1;(o=n.parentNode)!=this.dom;)0==r&&o.firstChild!=o.lastChild&&(r=n==o.firstChild?-1:1),n=o;e=r<0?n:n.nextSibling}if(e==this.dom.firstChild)return 0;for(;e&&!v.get(e);)e=e.nextSibling;if(!e)return this.length;for(s=u=0;;u++){if((a=this.children[u]).dom==e)return s;s+=a.length+a.breakAfter}}},{key:"domBoundsAround",value:function t(n,i){for(var e,r,o,u,s,a,f,h,c,l,e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,r=-1,o=-1,u=-1,s=-1,a=0,f=e,h=e;a<this.children.length;a++){if(l=f+(c=this.children[a]).length,f<n&&i<l)return c.domBoundsAround(n,i,f);if(n<=l&&-1==r&&(r=a,o=f),i<f&&c.dom.parentNode==this.dom){u=a,s=h;break}f=(h=l)+c.breakAfter}return{from:o,to:s<0?e+this.length:s,startDOM:(r?this.children[r-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:u<this.children.length&&0<=u?this.children[u].dom:null}}},{key:"markDirty",value:function t(){var n=0<arguments.length&&void 0!==arguments[0]&&arguments[0];this.dirty|=2,this.markParentsDirty(n)}},{key:"markParentsDirty",value:function t(n){for(var i=this.parent;i;i=i.parent){if(n&&(i.dirty|=2),1&i.dirty)return;i.dirty|=1,n=!1}}},{key:"setParent",value:function t(n){this.parent!=n&&(this.parent=n,this.dirty)&&this.markParentsDirty(!0)}},{key:"setDOM",value:function t(n){this.dom&&(this.dom.cmView=null),(this.dom=n).cmView=this}},{key:"rootView",get:function t(){for(var n,i,n=this;;){if(!(i=n.parent))return n;n=i}}},{key:"replaceChildren",value:function t(n,i){var e,r,o,u,s,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:Qt;for(this.markDirty(),o=n;o<i;o++)(u=this.children[o]).parent==this&&u.destroy();for((e=this.children).splice.apply(e,[n,i-n].concat(Wf(r))),s=0;s<r.length;s++)r[s].setParent(this)}},{key:"ignoreMutation",value:function t(n){return!1}},{key:"ignoreEvent",value:function t(n){return!1}},{key:"childCursor",value:function t(){var n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this.length;return new Xt(this.children,n,this.children.length)}},{key:"childPos",value:function t(n){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1;return this.childCursor().findPos(n,i)}},{key:"toString",value:function t(){var n=this.constructor.name.replace("View","");return n+(this.children.length?"("+this.children.join()+")":this.length?"["+("Text"==n?this.text:this.length)+"]":"")+(this.breakAfter?"#":"")}},{key:"isEditable",get:function t(){return!0}},{key:"isWidget",get:function t(){return!1}},{key:"isHidden",get:function t(){return!1}},{key:"merge",value:function t(n,i,e,r,o,u){return!1}},{key:"become",value:function t(n){return!1}},{key:"canReuseDOM",value:function t(n){return n.constructor==this.constructor}},{key:"getSide",value:function t(){return 0}},{key:"destroy",value:function t(){this.parent=null}}],[{key:"get",value:function t(n){return n.cmView}}]),v}()).prototype.breakAfter=0,Xt=function(){function e(t,n,i){A(this,e),this.children=t,this.pos=n,this.i=i,this.off=0}return D(e,[{key:"findPos",value:function t(n){for(var i,e,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1;;){if(n>this.pos||n==this.pos&&(0<i||0==this.i||this.children[this.i-1].breakAfter))return this.off=n-this.pos,this;e=this.children[--this.i],this.pos-=e.length+e.breakAfter}}}]),e}(),n="undefined"!=typeof navigator?navigator:{userAgent:"",vendor:"",platform:""},t="undefined"!=typeof document?document:{documentElement:{style:{}}},Zt=/Edge\/(\d+)/.exec(n.userAgent),Yt=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(n.userAgent),nn=!(tn=!!((e=/MSIE \d/.test(n.userAgent))||Yt||Zt))&&/gecko\/(\d+)/i.test(n.userAgent),en=!tn&&/Chrome\/(\d+)/.exec(n.userAgent),r="webkitFontSmoothing"in t.documentElement.style,g={mac:(u=(o=!tn&&/Apple Computer/.test(n.vendor))&&(/Mobile\/\w+/.test(n.userAgent)||2<n.maxTouchPoints))||/Mac/.test(n.platform),windows:/Win/.test(n.platform),linux:/Linux|X11/.test(n.platform),ie:tn,ie_version:e?t.documentMode||6:Yt?+Yt[1]:Zt?+Zt[1]:0,gecko:nn,gecko_version:nn?+(/Firefox\/(\d+)/.exec(n.userAgent)||[0,0])[1]:0,chrome:!!en,chrome_version:en?+en[1]:0,ios:u,android:/Android\b/.test(n.userAgent),webkit:r,safari:o,webkit_version:r?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:null!=t.documentElement.style.tabSize?"tab-size":"-moz-tab-size"},rn=256,on=function(t){f(r,t);var i=S(r);function r(t){var n;return A(this,r),(n=i.call(this)).text=t,n}return D(r,[{key:"length",get:function t(){return this.text.length}},{key:"createDOM",value:function t(n){this.setDOM(n||document.createTextNode(this.text))}},{key:"sync",value:function t(n,i){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(i&&i.node==this.dom&&(i.written=!0),this.dom.nodeValue=this.text)}},{key:"reuseDOM",value:function t(n){3==n.nodeType&&this.createDOM(n)}},{key:"merge",value:function t(n,i,e){return(!e||e instanceof r&&!(this.length-(i-n)+e.length>rn))&&(this.text=this.text.slice(0,n)+(e?e.text:"")+this.text.slice(i),this.markDirty(),!0)}},{key:"split",value:function t(n){var i=new r(this.text.slice(n));return this.text=this.text.slice(0,n),this.markDirty(),i}},{key:"localPosFromDOM",value:function t(n,i){return n==this.dom?i:i?this.text.length:0}},{key:"domAtPos",value:function t(n){return new Kt(this.dom,n)}},{key:"domBoundsAround",value:function t(n,i,e){return{from:e,to:e+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}},{key:"coordsAt",value:function t(n,i){return Pc(this.dom,n,i)}}]),r}(c),un=function(t){f(c,t);var s=S(c);function c(t){var n,i,e,r,o,u,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[],e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0;A(this,c),(n=s.call(this)).mark=t,n.children=i,n.length=e,r=F(i);try{for(r.s();!(o=r.n()).done;)(u=o.value).setParent(eh(n))}catch(t){r.e(t)}finally{r.f()}return n}return D(c,[{key:"setAttrs",value:function t(n){if(Mc(n),this.mark.class&&(n.className=this.mark.class),this.mark.attrs)for(var i in this.mark.attrs)n.setAttribute(i,this.mark.attrs[i]);return n}},{key:"reuseDOM",value:function t(n){n.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(n),this.dirty|=6)}},{key:"sync",value:function t(n,i){this.dom?4&this.dirty&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),Yf(oh(c.prototype),"sync",this).call(this,n,i)}},{key:"merge",value:function t(n,i,e,r,o,u){return!(e&&(!(e instanceof c&&e.mark.eq(this.mark))||n&&o<=0||i<this.length&&u<=0)||(jc(this,n,i,e?e.children:[],o-1,u-1),this.markDirty(),0))}},{key:"split",value:function t(n){var i,e,r,o,u,s,a,f,h,i=[],e=0,r=-1,o=0,u=F(this.children);try{for(u.s();!(s=u.n()).done;)n<(f=e+(a=s.value).length)&&i.push(e<n?a.split(n-e):a),r<0&&n<=e&&(r=o),e=f,o++}catch(t){u.e(t)}finally{u.f()}return h=this.length-n,this.length=n,-1<r&&(this.children.length=r,this.markDirty()),new c(this.mark,i,h)}},{key:"domAtPos",value:function t(n){return Rc(this,n)}},{key:"coordsAt",value:function t(n,i){return Tc(this,n,i)}}]),c}(c),an=function(t){f(i,t);var n=S(i);function i(){return A(this,i),n.apply(this,arguments)}return D(i,[{key:"domAtPos",value:function t(n){var i=this.widget,e=i.topView,i=i.text;return e?Oc(n,0,e,i,this.length-e.length,function(t,n){return t.domAtPos(n)},function(t,n){return new Kt(t,Math.min(n,t.nodeValue.length))}):new Kt(i,Math.min(n,i.nodeValue.length))}},{key:"sync",value:function t(){this.setDOM(this.widget.toDOM())}},{key:"localPosFromDOM",value:function t(n,i){var e=this.widget,r=e.topView,e=e.text;return r?Ac(n,i,r,e,this.length-r.length):Math.min(i,this.length)}},{key:"ignoreMutation",value:function t(){return!1}},{key:"overrideDOMText",get:function t(){return null}},{key:"coordsAt",value:function t(n,i){var e=this.widget,r=e.topView,e=e.text;return r?Oc(n,i,r,e,this.length-r.length,function(t,n,i){return t.coordsAt(n,i)},Pc):Pc(e,n,i)}},{key:"destroy",value:function t(){var n;Yf(oh(i.prototype),"destroy",this).call(this),null!=(n=this.widget.topView)&&n.destroy()}},{key:"isEditable",get:function t(){return!0}},{key:"canReuseDOM",value:function t(){return!0}}]),i}(sn=function(t){f(s,t);var r=S(s);function s(t,n,i){var e;return A(this,s),(e=r.call(this)).widget=t,e.length=n,e.side=i,e.prevWidget=null,e}return D(s,[{key:"split",value:function t(n){var i=s.create(this.widget,this.length-n,this.side);return this.length-=n,i}},{key:"sync",value:function t(n){this.dom&&this.widget.updateDOM(this.dom,n)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(n)),this.dom.contentEditable="false")}},{key:"getSide",value:function t(){return this.side}},{key:"merge",value:function t(n,i,e,r,o,u){return!(e&&(!(e instanceof s&&this.widget.compare(e.widget))||0<n&&o<=0||i<this.length&&u<=0)||(this.length=n+(e?e.length:0)+(this.length-i),0))}},{key:"become",value:function t(n){return n instanceof s&&n.side==this.side&&this.widget.constructor==n.widget.constructor&&(this.widget.compare(n.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=n.widget,this.length=n.length,!0)}},{key:"ignoreMutation",value:function t(){return!0}},{key:"ignoreEvent",value:function t(n){return this.widget.ignoreEvent(n)}},{key:"overrideDOMText",get:function t(){var n,i,e,e,r;if(0==this.length)return k.empty;for(n=this;n.parent;)n=n.parent;return e=(e=n.view)&&e.state.doc,r=this.posAtStart,e?e.slice(r,r+this.length):k.empty}},{key:"domAtPos",value:function t(n){return(this.length?0==n:0<this.side)?Kt.before(this.dom):Kt.after(this.dom,n==this.length)}},{key:"domBoundsAround",value:function t(){return null}},{key:"coordsAt",value:function t(n,i){var i,e,r,o,i=this.widget.coordsAt(this.dom,n,i);if(i)return i;if(r=null,!(e=this.dom.getClientRects()).length)return null;for(o=0<n?e.length-1:0;r=e[o],!(0<n?0==o:o==e.length-1||r.top<r.bottom);o+=0<n?-1:1);return this.length?r:dc(r,0<this.side)}},{key:"isEditable",get:function t(){return!1}},{key:"isWidget",get:function t(){return!0}},{key:"isHidden",get:function t(){return this.widget.isHidden}},{key:"destroy",value:function t(){Yf(oh(s.prototype),"destroy",this).call(this),this.dom&&this.widget.destroy(this.dom)}}],[{key:"create",value:function t(n,i,e){return new(n.customView||s)(n,i,e)}}]),s}(c)),fn=function(t){f(e,t);var i=S(e);function e(t){var n;return A(this,e),(n=i.call(this)).side=t,n}return D(e,[{key:"length",get:function t(){return 0}},{key:"merge",value:function t(){return!1}},{key:"become",value:function t(n){return n instanceof e&&n.side==this.side}},{key:"split",value:function t(){return new e(this.side)}},{key:"sync",value:function t(){var n;this.dom||((n=document.createElement("img")).className="cm-widgetBuffer",n.setAttribute("aria-hidden","true"),this.setDOM(n))}},{key:"getSide",value:function t(){return this.side}},{key:"domAtPos",value:function t(n){return 0<this.side?Kt.before(this.dom):Kt.after(this.dom)}},{key:"localPosFromDOM",value:function t(){return 0}},{key:"domBoundsAround",value:function t(){return null}},{key:"coordsAt",value:function t(n){return this.dom.getBoundingClientRect()}},{key:"overrideDOMText",get:function t(){return k.empty}},{key:"isHidden",get:function t(){return!0}}]),e}(c),on.prototype.children=sn.prototype.children=fn.prototype.children=Qt,tn=function(){function t(){A(this,t)}return D(t,[{key:"eq",value:function t(n){return!1}},{key:"updateDOM",value:function t(n,i){return!1}},{key:"compare",value:function t(n){return this==n||this.constructor==n.constructor&&this.eq(n)}},{key:"estimatedHeight",get:function t(){return-1}},{key:"ignoreEvent",value:function t(n){return!0}},{key:"coordsAt",value:function t(n,i,e){return null}},{key:"customView",get:function t(){return null}},{key:"isHidden",get:function t(){return!1}},{key:"destroy",value:function t(n){}}]),t}(),P=function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t}(P=P||{}),(m=function(t){f(u,t);var o=S(u);function u(t,n,i,e){var r;return A(this,u),(r=o.call(this)).startSide=t,r.endSide=n,r.widget=i,r.spec=e,r}return D(u,[{key:"heightRelevant",get:function t(){return!1}},{key:"hasHeight",value:function t(){return!!this.widget&&-1<this.widget.estimatedHeight}}],[{key:"mark",value:function t(n){return new hn(n)}},{key:"widget",value:function t(n){var i=n.side||0,e=!!n.block;return new ln(n,i+=e?0<i?3e8:-4e8:0<i?1e8:-1e8,i,e,n.widget||null,!1)}},{key:"replace",value:function t(n){var i,e,r,r,o,u,i=!!n.block,r=n.isBlockGap?(e=-5e8,4e8):(e=((o=(r=Nc(n,i)).start)?i?-3e8:-1:5e8)-1,1+((u=r.end)?i?2e8:1:-6e8));return new ln(n,e,r,i,n.widget||null,!0)}},{key:"line",value:function t(n){return new cn(n)}},{key:"set",value:function t(n){var i;return j.of(n,1<arguments.length&&void 0!==arguments[1]&&arguments[1])}}]),u}(jt)).none=j.empty,(hn=function(t){f(r,t);var e=S(r);function r(t){var n,i,n,i;return A(this,r),n=(i=Nc(t)).start,i=i.end,(n=e.call(this,n?-1:5e8,i?1:-6e8,null,t)).tagName=t.tagName||"span",n.class=t.class||"",n.attrs=t.attributes||null,n}return D(r,[{key:"eq",value:function t(n){return this==n||n instanceof r&&this.tagName==n.tagName&&this.class==n.class&&_c(this.attrs,n.attrs)}},{key:"range",value:function t(n){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:n;if(i<=n)throw new RangeError("Mark decorations may not be empty");return Yf(oh(r.prototype),"range",this).call(this,n,i)}}]),r}(m)).prototype.point=!1,(cn=function(t){f(e,t);var n=S(e);function e(t){return A(this,e),n.call(this,-2e8,-2e8,null,t)}return D(e,[{key:"eq",value:function t(n){return n instanceof e&&this.spec.class==n.spec.class&&_c(this.spec.attributes,n.spec.attributes)}},{key:"range",value:function t(n){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:n;if(i!=n)throw new RangeError("Line decoration ranges must be zero-length");return Yf(oh(e.prototype),"range",this).call(this,n,i)}}]),e}(m)).prototype.mapMode=h.TrackBefore,cn.prototype.point=!0,(ln=function(t){f(s,t);var u=S(s);function s(t,n,i,e,r,o){var i;return A(this,s),(i=u.call(this,n,i,r,t)).block=e,i.isReplace=o,i.mapMode=e?n<=0?h.TrackBefore:h.TrackAfter:h.TrackDel,i}return D(s,[{key:"type",get:function t(){return this.startSide<this.endSide?P.WidgetRange:this.startSide<=0?P.WidgetBefore:P.WidgetAfter}},{key:"heightRelevant",get:function t(){return this.block||!!this.widget&&5<=this.widget.estimatedHeight}},{key:"eq",value:function t(n){return n instanceof s&&Uc(this.widget,n.widget)&&this.block==n.block&&this.startSide==n.startSide&&this.endSide==n.endSide}},{key:"range",value:function t(n){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:n;if(this.isReplace&&(i<n||n==i&&0<this.startSide&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(this.isReplace||i==n)return Yf(oh(s.prototype),"range",this).call(this,n,i);throw new RangeError("Widget decorations can only have zero-length ranges")}}]),s}(m)).prototype.point=!0,vn=function(t){f(s,t);var n=S(s);function s(){var t;return A(this,s),(t=n.apply(this,arguments)).children=[],t.length=0,t.prevAttrs=void 0,t.attrs=null,t.breakAfter=0,t}return D(s,[{key:"merge",value:function t(n,i,e,r,o,u){if(e){if(!(e instanceof s))return!1;this.dom||e.transferDOM(this)}return r&&this.setDeco(e?e.attrs:null),jc(this,n,i,e?e.children:[],o,u),!0}},{key:"split",value:function t(n){var i,e,r,e,o,i=new s;if(i.breakAfter=this.breakAfter,0!=this.length){for(r=(e=this.childPos(n)).i,(e=e.off)&&(i.append(this.children[r].split(e),0),this.children[r].merge(e,this.children[r].length,null,!1,0,0),r++),o=r;o<this.children.length;o++)i.append(this.children[o],0);for(;0<r&&0==this.children[r-1].length;)this.children[--r].destroy();this.children.length=r,this.markDirty(),this.length=n}return i}},{key:"transferDOM",value:function t(n){this.dom&&(this.markDirty(),n.setDOM(this.dom),n.prevAttrs=void 0===this.prevAttrs?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}},{key:"setDeco",value:function t(n){_c(this.attrs,n)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=n)}},{key:"append",value:function t(n,i){Ic(this,n,i)}},{key:"addLineDeco",value:function t(n){var i=n.spec.attributes,n=n.spec.class;i&&(this.attrs=Bc(i,this.attrs||{})),n&&(this.attrs=Bc({class:n},this.attrs||{}))}},{key:"domAtPos",value:function t(n){return Rc(this,n)}},{key:"reuseDOM",value:function t(n){"DIV"==n.nodeName&&(this.setDOM(n),this.dirty|=6)}},{key:"sync",value:function t(n,i){var n,e,i;for(this.dom?4&this.dirty&&(Mc(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),void 0!==this.prevAttrs&&(Fc(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),Yf(oh(s.prototype),"sync",this).call(this,n,i),e=this.dom.lastChild;e&&c.get(e)instanceof un;)e=e.lastChild;e&&this.length&&("BR"==e.nodeName||0!=(null==(n=c.get(e))?void 0:n.isEditable)||g.ios&&this.children.some(function(t){return t instanceof on}))||((i=document.createElement("BR")).cmIgnore=!0,this.dom.appendChild(i))}},{key:"measureTextSize",value:function t(){var n,i,e,r,o,u;if(0==this.children.length||20<this.length)return null;n=0,e=F(this.children);try{for(e.s();!(r=e.n()).done;){if(!((o=r.value)instanceof on)||/[^ -~]/.test(o.text))return null;if(1!=(u=fc(o.dom)).length)return null;n+=u[0].width,i=u[0].height}}catch(t){e.e(t)}finally{e.f()}return n?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:n/this.length,textHeight:i}:null}},{key:"coordsAt",value:function t(n,i){var n,i,e,e,n=Tc(this,n,i);return!this.children.length&&n&&this.parent&&(i=this.parent.view.viewState.heightOracle,e=n.bottom-n.top,Math.abs(e-i.lineHeight)<2)&&i.textHeight<e?(e=(e-i.textHeight)/2,{top:n.top+e,bottom:n.bottom-e,left:n.left,right:n.left}):n}},{key:"become",value:function t(n){return!1}},{key:"type",get:function t(){return P.Text}}],[{key:"find",value:function t(n,i){for(var e,r,o,u,e=0,r=0;e<n.children.length;e++){if(i<=(u=r+(o=n.children[e]).length)){if(o instanceof s)return o;if(i<u)break}r=u+o.breakAfter}return null}}]),s}(c),dn=function(t){f(s,t);var r=S(s);function s(t,n,i){var e;return A(this,s),(e=r.call(this)).widget=t,e.length=n,e.type=i,e.breakAfter=0,e.prevWidget=null,e}return D(s,[{key:"merge",value:function t(n,i,e,r,o,u){return!(e&&(!(e instanceof s&&this.widget.compare(e.widget))||0<n&&o<=0||i<this.length&&u<=0)||(this.length=n+(e?e.length:0)+(this.length-i),0))}},{key:"domAtPos",value:function t(n){return 0==n?Kt.before(this.dom):Kt.after(this.dom,n==this.length)}},{key:"split",value:function t(n){var i,n,i=this.length-n;return this.length=n,(n=new s(this.widget,i,this.type)).breakAfter=this.breakAfter,n}},{key:"children",get:function t(){return Qt}},{key:"sync",value:function t(n){this.dom&&this.widget.updateDOM(this.dom,n)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(n)),this.dom.contentEditable="false")}},{key:"overrideDOMText",get:function t(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):k.empty}},{key:"domBoundsAround",value:function t(){return null}},{key:"become",value:function t(n){return n instanceof s&&n.widget.constructor==this.widget.constructor&&(n.widget.compare(this.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=n.widget,this.length=n.length,this.type=n.type,this.breakAfter=n.breakAfter,!0)}},{key:"ignoreMutation",value:function t(){return!0}},{key:"ignoreEvent",value:function t(n){return this.widget.ignoreEvent(n)}},{key:"isEditable",get:function t(){return!1}},{key:"isWidget",get:function t(){return!0}},{key:"coordsAt",value:function t(n,i){return this.widget.coordsAt(this.dom,n,i)}},{key:"destroy",value:function t(){Yf(oh(s.prototype),"destroy",this).call(this),this.dom&&this.widget.destroy(this.dom)}}]),s}(c),yn=function(){function u(t,n,i,e){A(this,u),this.doc=t,this.pos=n,this.end=i,this.disallowBlockEffectsFor=e,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=t.iter(),this.skip=n}return D(u,[{key:"posCovered",value:function t(){var n;return 0==this.content.length?!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos:!((n=this.content[this.content.length-1]).breakAfter||n instanceof dn&&n.type==P.WidgetBefore)}},{key:"getLine",value:function t(){return this.curLine||(this.content.push(this.curLine=new vn),this.atCursorPos=!0),this.curLine}},{key:"flushBuffer",value:function t(){var n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this.bufferMarks;this.pendingBuffer&&(this.curLine.append(zc(new fn(-1),n),n.length),this.pendingBuffer=0)}},{key:"addBlockWidget",value:function t(n){this.flushBuffer(),this.curLine=null,this.content.push(n)}},{key:"finish",value:function t(n){this.pendingBuffer&&n<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,this.posCovered()||this.getLine()}},{key:"buildText",value:function t(n,i,e){for(var r,o,u,r,r;0<n;){if(this.textOff==this.text.length){if(o=(r=this.cursor.next(this.skip)).value,u=r.lineBreak,r=r.done,this.skip=0,r)throw new Error("Ran out of text content when drawing inline views");if(u){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,n--;continue}this.text=o,this.textOff=0}r=Math.min(this.text.length-this.textOff,n,512),this.flushBuffer(i.slice(i.length-e)),this.getLine().append(zc(new on(this.text.slice(this.textOff,this.textOff+r)),i),e),this.atCursorPos=!0,this.textOff+=r,n-=r,e=0}}},{key:"span",value:function t(n,i,e,r){this.buildText(i-n,e,r),this.pos=i,this.openStart<0&&(this.openStart=r)}},{key:"point",value:function t(n,i,e,r,o,u){var u,s,s,a,f,h;if(this.disallowBlockEffectsFor[u]&&e instanceof ln){if(e.block)throw new RangeError("Block decorations may not be specified via plugins");if(i>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}u=i-n,e instanceof ln?e.block?((s=e.type)!=P.WidgetAfter||this.posCovered()||this.getLine(),this.addBlockWidget(new dn(e.widget||new mn("div"),u,s))):(s=sn.create(e.widget||new mn("span"),u,u?0:e.startSide),a=this.atCursorPos&&!s.isEditable&&o<=r.length&&(n<i||0<e.startSide),f=!s.isEditable&&(n<i||o>r.length||e.startSide<=0),h=this.getLine(),2!=this.pendingBuffer||a||s.isEditable||(this.pendingBuffer=0),this.flushBuffer(r),a&&(h.append(zc(new fn(1),r),o),o=r.length+Math.max(0,o-r.length)),h.append(zc(s,r),o),this.atCursorPos=f,this.pendingBuffer=f?n<i||o>r.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=r.slice())):this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(e),u&&(this.textOff+u<=this.text.length?this.textOff+=u:(this.skip+=u-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=i),this.openStart<0&&(this.openStart=o)}}],[{key:"build",value:function t(n,i,e,r,o){var n=new u(n,i,e,o);return n.openEnd=j.spans(r,i,e,n),n.openStart<0&&(n.openStart=n.openEnd),n.finish(n.openEnd),n}}]),u}(),mn=function(t){f(e,t);var i=S(e);function e(t){var n;return A(this,e),(n=i.call(this)).tag=t,n}return D(e,[{key:"eq",value:function t(n){return n.tag==this.tag}},{key:"toDOM",value:function t(){return document.createElement(this.tag)}},{key:"updateDOM",value:function t(n){return n.nodeName.toLowerCase()==this.tag}},{key:"isHidden",get:function t(){return!0}}]),e}(tn),pn=y.define(),kn=y.define(),gn=y.define(),wn=y.define(),bn=y.define(),Mn=y.define(),xn=y.define(),Sn=y.define({combine:function t(n){return n.some(function(t){return t})}}),Cn=y.define({combine:function t(n){return n.some(function(t){return t})}}),jn=function(){function o(t){var n,i,e,r,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"nearest",i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"nearest",e=3<arguments.length&&void 0!==arguments[3]?arguments[3]:5,r=4<arguments.length&&void 0!==arguments[4]?arguments[4]:5;A(this,o),this.range=t,this.y=n,this.x=i,this.yMargin=e,this.xMargin=r}return D(o,[{key:"map",value:function t(n){return n.empty?this:new o(this.range.map(n),this.y,this.x,this.yMargin,this.xMargin)}}]),o}(),Pn=v.define({map:function t(n,i){return n.map(i)}}),On=y.define({combine:function t(n){return!n.length||n[0]}}),En=0,An=y.define(),d=function(){function u(t,n,i,e){A(this,u),this.id=t,this.create=n,this.domEventHandlers=i,this.extension=e(this)}return D(u,null,[{key:"define",value:function t(n,i){var i=i||{},e=i.eventHandlers,r=i.provide,o=i.decorations;return new u(En++,n,e,function(n){var t=[An.of(n)];return o&&t.push(Tn.of(function(t){var t=t.plugin(n);return t?o(t):m.none})),r&&t.push(r(n)),t})}},{key:"fromClass",value:function t(n,i){return u.define(function(t){return new n(t)},i)}}]),u}(),Dn=function(){function n(t){A(this,n),this.spec=t,this.mustUpdate=null,this.value=null}return D(n,[{key:"update",value:function n(i){if(this.value){if(this.mustUpdate){var n=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(n)}catch(t){if(Wc(n.state,t,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch(t){}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(i)}catch(t){Wc(i.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}},{key:"destroy",value:function t(n){var i;if(null!=(i=this.value)&&i.destroy)try{this.value.destroy()}catch(t){Wc(n.state,t,"CodeMirror plugin crashed")}}},{key:"deactivate",value:function t(){this.spec=this.value=null}}]),n}(),Rn=y.define(),In=y.define(),Tn=y.define(),Ln=y.define(),Bn=y.define(),_n=y.define(),Fn=function(){function d(t,n,i,e){A(this,d),this.fromA=t,this.toA=n,this.fromB=i,this.toB=e}return D(d,[{key:"join",value:function t(n){return new d(Math.min(this.fromA,n.fromA),Math.max(this.toA,n.toA),Math.min(this.fromB,n.fromB),Math.max(this.toB,n.toB))}},{key:"addToSet",value:function t(n){for(var i,e,r,i=n.length,e=this;0<i;i--)if(!((r=n[i-1]).fromA>e.toA)){if(r.toA<e.fromA)break;e=e.join(r),n.splice(i-1,1)}return n.splice(i,0,e),n}}],[{key:"extendWithRanges",value:function t(n,i){var e,r,o,u,s,a,f,h,c,l,c,v;if(0==i.length)return n;for(e=[],s=u=o=r=0;;r++){for(f=u-s,h=(a=r==n.length?null:n[r])?a.fromB:1e9;o<i.length&&i[o]<h&&(c=i[o],l=i[o+1],(c=Math.max(s,c))<=(v=Math.min(h,l))&&new d(c+f,v+f,c,v).addToSet(e),!(h<l));)o+=2;if(!a)return e;new d(a.fromA,a.toA,a.fromB,a.toB).addToSet(e),u=a.toA,s=a.toB}}}]),d}(),Nn=function(){function s(t,n,i){var e,r,o,u;A(this,s),this.view=t,this.state=n,this.transactions=i,this.flags=0,this.startState=t.state,this.changes=K.empty(this.startState.doc.length),e=F(i);try{for(e.s();!(r=e.n()).done;)o=r.value,this.changes=this.changes.compose(o.changes)}catch(t){e.e(t)}finally{e.f()}u=[],this.changes.iterChangedRanges(function(t,n,i,e){return u.push(new Fn(t,n,i,e))}),this.changedRanges=u}return D(s,[{key:"viewportChanged",get:function t(){return 0<(4&this.flags)}},{key:"heightChanged",get:function t(){return 0<(2&this.flags)}},{key:"geometryChanged",get:function t(){return this.docChanged||0<(10&this.flags)}},{key:"focusChanged",get:function t(){return 0<(1&this.flags)}},{key:"docChanged",get:function t(){return!this.changes.empty}},{key:"selectionSet",get:function t(){return this.transactions.some(function(t){return t.selection})}},{key:"empty",get:function t(){return 0==this.flags&&0==this.transactions.length}}],[{key:"create",value:function t(n,i,e){return new s(n,i,e)}}]),s}(),E=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(E=E||{}),Un=E.LTR,Hn=E.RTL,zn=$c("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),Wn=$c("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Vn=Object.create(null),$n=[];for(qn=0,Gn=["()","[]","{}"];qn<Gn.length;qn++)Vn[Kn=(Jn=Gn[qn]).charCodeAt(0)]=Jn=Jn.charCodeAt(1),Vn[Jn]=-Kn;function qc(t){return t<=247?zn[t]:1424<=t&&t<=1524?2:1536<=t&&t<=1785?Wn[t-1536]:1774<=t&&t<=2220?4:8192<=t&&t<=8203?256:64336<=t&&t<=65023?4:8204==t?256:1}function Gc(t,n){var i,e,B,r,o,u,s,a,f,h,c,l,v,d,y,m,p,k,g,k,w,b,b,M,x,S,C,j,_,F,N,P,O,E,A,D,R,U,I,T,H,L,i=t.length,e=n==Un?1:2,B=n==Un?2:1;if(!t||1==e&&!Qn.test(t))return Jc(i);for(r=0,u=o=e;r<i;r++)512==(s=qc(t.charCodeAt(r)))?s=o:8==s&&4==u&&(s=16),z[r]=4==s?2:s,7&s&&(u=s),o=s;for(a=0,h=f=e;a<i;a++){if(128==(c=z[a]))a<i-1&&f==z[a+1]&&24&f?c=z[a]=f:z[a]=256;else if(64==c){for(l=a+1;l<i&&64==z[l];)l++;for(v=a&&8==f||l<i&&8==z[l]?1==h?1:8:256,d=a;d<l;d++)z[d]=v;a=l-1}else 8==c&&1==h&&(z[a]=1);7&(f=c)&&(h=c)}for(p=m=y=0;y<i;y++)if(g=Vn[k=t.charCodeAt(y)])if(g<0){for(w=m-3;0<=w;w-=3)if($n[w+1]==-g){(b=2&(b=$n[w+2])?e:4&b?1&b?B:e:0)&&(z[y]=z[$n[w]]=b),m=w;break}}else{if(189==$n.length)break;$n[m++]=y,$n[m++]=k,$n[m++]=p}else if(2==(k=z[y])||1==k)for(p=(M=k==e)?0:1,x=m-3;0<=x&&!(2&(S=$n[x+2]));x-=3)if(M)$n[x+2]|=2;else{if(4&S)break;$n[x+2]|=4}for(C=0;C<i;C++)if(256==z[C]){for(j=C+1;j<i&&256==z[j];)j++;for(N=(_=1==(C?z[C-1]:e))==(F=1==(j<i?z[j]:e))?_?1:2:e,P=C;P<j;P++)z[P]=N;C=j-1}if(O=[],1==e)for(E=0;E<i;){for(A=E,D=1!=z[E++];E<i&&D==(1!=z[E]);)E++;if(D)for(R=E;A<R;){for(U=R,I=2!=z[--R];A<R&&I==(2!=z[R-1]);)R--;O.push(new Xn(R,U,I?2:1))}else O.push(new Xn(A,E,0))}else for(T=0;T<i;){for(H=T,L=2==z[T++];T<i&&L==(2==z[T]);)T++;O.push(new Xn(H,T,L?1:2))}return O}function Jc(t){return[new Xn(0,t,0)]}function Kc(t,n,i,e,r){var o,u,s,o,o,e,a,u,u=e.head-t.from,s=-1;if(0==u){if(!r||!t.length)return null;n[0].level!=i&&(u=n[0].side(!1,i),s=0)}else if(u==t.length){if(r)return null;(o=n[n.length-1]).level!=i&&(u=o.side(!0,i),s=n.length-1)}return u==(o=n[s=s<0?Xn.find(n,u,null!=(o=e.bidiLevel)?o:-1,e.assoc):s]).side(r,i)&&(u=(o=n[s+=r?1:-1]).side(!r,i)),e=r==(o.dir==i),a=yh(t.text,u,e),Zn=t.text.slice(Math.min(u,a),Math.max(u,a)),a!=o.side(r,i)?O.cursor(a+t.from,e?-1:1,o.level):(u=s==(r?n.length-1:0)?null:n[s+(r?1:-1)])||o.level==i?u&&u.level<o.level?O.cursor(u.side(!r,i)+t.from,r?1:-1,u.level):O.cursor(a+t.from,r?-1:1,o.level):O.cursor(r?t.to:t.from,r?-1:1,i)}function Qc(t){return 1==t.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function Xc(t){return 1==t.node.nodeType&&t.node.firstChild&&(0==t.offset||"false"==t.node.childNodes[t.offset-1].contentEditable)&&(t.offset==t.node.childNodes.length||"false"==t.node.childNodes[t.offset].contentEditable)}function Zc(t){var n,n,i,e,r,t,o,u,t,n=t.observer.selectionRange,n=n.focusNode&&tl(n.focusNode,n.focusOffset,0);if(!n)return null;if(!(i=t.docView.nearest(n)))return null;if(i instanceof vn){for(e=n;e.parentNode!=i.dom;)e=e.parentNode;for(r=e.previousSibling;r&&!c.get(r);)r=r.previousSibling;return{from:t=r?c.get(r).posAtEnd:i.posAtStart,to:t,node:e,text:n}}for(;;){if(!(u=i.parent))return null;if(u instanceof vn)break;i=u}return{from:t=i.posAtStart,to:t+i.length,node:i.dom,text:n}}function Yc(t,n){var i,e,r,o,i,e,n,r,t,r,i=Zc(t);if(!i)return m.none;if(e=i.from,r=i.to,o=i.node,i=i.text,e=n.mapPos(e,1),n=Math.max(e,n.mapPos(r,-1)),r=t.state,-1<(t=3==o.nodeType?o.nodeValue:new ti([],r).readRange(o.firstChild,null).text).indexOf(Yn))return m.none;if(n-e<t.length)if(r.doc.sliceString(e,Math.min(r.doc.length,e+t.length))==t)n=e+t.length;else{if(r.doc.sliceString(Math.max(0,n-t.length),n)!=t)return m.none;e=n-t.length}else if(r.doc.sliceString(e,n)!=t)return m.none;return(r=c.get(o))instanceof an?r=r.widget.topView:r&&(r.parent=null),m.set(m.replace({widget:new ri(o,i,r),inclusive:!0}).range(e,n))}function tl(t,n,i){var e,r,o,u;if(i<=0)for(e=t,r=n;;){if(3==e.nodeType)return e;if(!(1==e.nodeType&&0<r))break;r=vc(e=e.childNodes[r-1])}if(0<=i)for(o=t,u=n;;){if(3==o.nodeType)return o;if(!(1==o.nodeType&&u<o.childNodes.length&&0<=i))break;o=o.childNodes[u],u=0}return null}function nl(t,n){return 1!=t.nodeType?0:(n&&"false"==t.childNodes[n-1].contentEditable?1:0)|(n<t.childNodes.length&&"false"==t.childNodes[n].contentEditable?2:0)}function il(t,n,i){var e=new oi;return j.compare(t,n,i,e),e.changes}function el(t,n){for(var i=t;i&&i!=n;i=i.assignedSlot||i.parentNode)if(1==i.nodeType&&"false"==i.contentEditable)return 1}function rl(t,n,i){var i,e,r,t,o,u,s,a,f,i=2<arguments.length&&void 0!==i?i:1,e=t.charCategorizer(n),r=t.doc.lineAt(n),t=n-r.from;if(0==r.length)return O.cursor(n);for(0==t?i=1:t==r.length&&(i=-1),u=o=t,i<0?o=yh(r.text,t,!1):u=yh(r.text,t),s=e(r.text.slice(o,u));0<o&&(a=yh(r.text,o,!1),e(r.text.slice(a,o))==s);)o=a;for(;u<r.length&&(f=yh(r.text,u),e(r.text.slice(u,f))==s);)u=f;return O.range(o+r.from,u+r.from)}function ol(t,n){return n.left>t?n.left-t:Math.max(0,t-n.right)}function ul(t,n){return n.top>t?n.top-t:Math.max(0,t-n.bottom)}function sl(t,n){return t.top<n.bottom-1&&t.bottom>n.top+1}function al(t,n){return n<t.top?{top:n,left:t.left,right:t.right,bottom:t.bottom}:t}function fl(t,n){return n>t.bottom?{top:t.top,left:t.left,right:t.right,bottom:n}:t}function hl(t,n,i){for(var e,r,o,u,s,a,f,h,c,l,v,d,y,m,p,p,k,g,s=!1,l=t.firstChild;l;l=l.nextSibling)for(v=fc(l),d=0;d<v.length;d++){if(y=v[d],m=ol(n,y=r&&sl(r,y)?al(fl(y,r.bottom),r.top):y),p=ul(i,y),0==m&&0==p)return(3==l.nodeType?cl:hl)(l,n,i);(!e||p<u||u==p&&m<o)&&(e=l,r=y,o=m,s=!(p=(u=p)?i<y.top?-1:1:m?n<y.left?-1:1:0)||(0<p?d<v.length-1:0<d)),0==m?i>y.bottom&&(!h||h.bottom<y.bottom)?(a=l,h=y):i<y.top&&(!c||c.top>y.top)&&(f=l,c=y):h&&sl(h,y)?h=fl(h,y.bottom):c&&sl(c,y)&&(c=al(c,y.top))}return h&&h.bottom>=i?(e=a,r=h):c&&c.top<=i&&(e=f,r=c),e?(k=Math.max(r.left,Math.min(r.right,n)),3==e.nodeType?cl(e,k,i):s&&"false"!=e.contentEditable?hl(e,k,i):{node:t,offset:g=Array.prototype.indexOf.call(t.childNodes,e)+(n>=(r.left+r.right)/2?1:0)}):{node:t,offset:0}}function cl(t,n,i){for(var e,r,o,u,s,a,f,h,c,l,v,d,e=t.nodeValue.length,r=-1,o=1e9,u=0,s=0;s<e;s++)for(a=gc(t,s,s+1).getClientRects(),f=0;f<a.length;f++)if((h=a[f]).top!=h.bottom&&(u=u||n-h.left,c=(h.top>i?h.top-i:i-h.bottom)-1,h.left-1<=n)&&h.right+1>=n&&c<o){if(v=l=n>=(h.left+h.right)/2,(g.chrome||g.gecko)&&(d=gc(t,s).getBoundingClientRect()).left==h.right&&(v=!l),c<=0)return{node:t,offset:s+(v?1:0)};r=s+(v?1:0),o=c}return{node:t,offset:-1<r?r:0<u?t.nodeValue.length:0}}function ll(t,n,i,e){var r,o,u,e,u,s,a,f,h,c,l,v,u,d,o,y,m,e,y,o,y,d,o,y,r=3<arguments.length&&void 0!==e?e:-1,e=t.contentDOM.getBoundingClientRect(),u=e.top+t.viewState.paddingTop,a=t.viewState.docHeight,f=n.x,h=n.y,c=h-u;if(c<0)return 0;if(a<c)return t.state.doc.length;for(l=t.defaultLineHeight/2,v=!1;(s=t.elementAtHeight(c)).type!=P.Text;)for(;!(0<=(c=0<r?s.bottom+l:s.top-l)&&c<=a);){if(v)return i?null:0;v=!0,r=-r}if(h=u+c,(u=s.from)<t.viewport.from)return 0==t.viewport.from?0:i?null:vl(t,e,s,f,h);if(u>t.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:i?null:vl(t,e,s,f,h);if(d=t.dom.ownerDocument,(y=(y=(o=t.root.elementFromPoint?t.root:d).elementFromPoint(f,h))&&!t.contentDOM.contains(y)?null:y)||(f=Math.max(e.left+1,Math.min(e.right-1,f)),(y=o.elementFromPoint(f,h))&&!t.contentDOM.contains(y)&&(y=null)),e=-1,y&&0!=(null==(o=t.docView.nearest(y))?void 0:o.isEditable)&&(d.caretPositionFromPoint?(y=d.caretPositionFromPoint(f,h))&&(m=y.offsetNode,e=y.offset):d.caretRangeFromPoint&&(o=d.caretRangeFromPoint(f,h))&&(m=o.startContainer,e=o.startOffset,!t.contentDOM.contains(m)||g.safari&&dl(m,e,f)||g.chrome&&yl(m,e,f))&&(m=void 0)),!m||!t.docView.dom.contains(m)){if(!(y=vn.find(t.docView,u)))return c>s.top+s.height/2?s.to:s.from;m=(d=hl(y.dom,f,h)).node,e=d.offset}return(o=t.docView.nearest(m))?o.isWidget&&1==(null==(u=o.dom)?void 0:u.nodeType)?(y=o.dom.getBoundingClientRect(),n.y<y.top||n.y<=y.bottom&&n.x<=(y.left+y.right)/2?o.posAtStart:o.posAtEnd):o.localPosFromDOM(m,e)+o.posAtStart:null}function vl(t,n,i,e,r){var e,o,n,e=Math.round((e-n.left)*t.defaultCharacterWidth);return t.lineWrapping&&i.height>1.5*t.defaultLineHeight&&(e+=(o=Math.floor((r-i.top)/t.defaultLineHeight))*t.viewState.heightOracle.lineLength),n=t.state.sliceDoc(i.from,i.to),i.from+ec(n,e,t.state.tabSize)}function dl(t,n,i){var n,e;if(3==t.nodeType&&n==(n=t.nodeValue.length)){for(e=t.nextSibling;e;e=e.nextSibling)if(1!=e.nodeType||"BR"!=e.nodeName)return;return gc(t,n-1,n).getBoundingClientRect().left>i}}function yl(t,n,i){var e,r,o;if(0==n){for(e=t;;){if(!(r=e.parentNode)||1!=r.nodeType||r.firstChild!=e)return;if(r.classList.contains("cm-line"))break;e=r}return 5<i-(o=(1==t.nodeType?t:gc(t,0,Math.max(t.nodeValue.length,1))).getBoundingClientRect()).left}}function ml(t,n,i,e){var r,e,o,u,u,o,e,r=t.state.doc.lineAt(n.head),e=e&&t.lineWrapping?t.coordsAtPos(n.assoc<0&&n.head>r.from?n.head-1:n.head):null;return e&&(o=t.dom.getBoundingClientRect(),u=t.textDirectionAt(r.from),null!=(u=t.posAtCoords({x:i==(u==E.LTR)?o.right-1:o.left+1,y:(e.top+e.bottom)/2})))?O.cursor(u,i?-1:1):(e=(o=vn.find(t.docView,n.head))?i?o.posAtEnd:o.posAtStart:i?r.to:r.from,O.cursor(e,i?-1:1))}function pl(t,n,i,e){for(var r,o,u,s,a,f,h,r=t.state.doc.lineAt(n.head),o=t.bidiSpans(r),u=t.textDirectionAt(r.from),s=n,a=null;;){if(f=Kc(r,o,u,s,i),h=Zn,!f){if(r.number==(i?t.state.doc.lines:1))return s;h="\n",r=t.state.doc.line(r.number+(i?1:-1)),o=t.bidiSpans(r),f=O.cursor(i?r.from:r.to)}if(a){if(!a(h))return s}else{if(!e)return f;a=e(h)}s=f}}function kl(t,n,i){var e,r,e=t.state.charCategorizer(n),r=e(i);return function(t){var t=e(t);return(r=r==l.Space?t:r)==t}}function gl(t,n,i,e){var r,o,u,s,a,i,f,i,h,c,l,v,d,r=n.head,o=i?1:-1;if(r==(i?t.state.doc.length:0))return O.cursor(r,n.assoc);for(u=n.goalColumn,a=t.contentDOM.getBoundingClientRect(),i=t.coordsAtPos(r),f=t.documentTop,s=i?(null==u&&(u=i.left-a.left),o<0?i.top:i.bottom):(i=t.viewState.lineBlockAt(r),null==u&&(u=Math.min(a.right-a.left,t.defaultCharacterWidth*(r-i.from))),(o<0?i.top:i.bottom)+f),h=a.left+u,c=null!=e?e:t.defaultLineHeight>>1,l=0;;l+=10)if(d=ll(t,{x:h,y:v=s+(c+l)*o},!1,o),v<a.top||v>a.bottom||(o<0?d<r:r<d))return O.cursor(d,n.assoc,void 0,u)}function wl(o,u,s){for(var t=function t(){var r,n,i,e,r=0,n=F(o);try{for(n.s();!(i=n.n()).done;)(e=i.value).between(u-1,u+1,function(t,n,i){var e;t<u&&u<n&&(u=(e=r||s||(u-t<n-u?-1:1))<0?t:n,r=e)})}catch(t){n.e(t)}finally{n.f()}if(!r)return{v:u}},n;;)if(n=t())return n.v}function bl(n,t,i){var t=wl(n.state.facet(Ln).map(function(t){return t(n)}),i.from,t.head>i.from?-1:1);return t==i.from?i:O.cursor(t,t<i.from?1:-1)}function Ml(t){return.7*Math.max(0,t)+8}function xl(t,n){var t=t.state.facet(pn);return t.length?t[0](n):g.mac?n.metaKey:n.ctrlKey}function Sl(t,n){var t=t.state.facet(kn);return t.length?t[0](n):g.mac?!n.altKey:!n.ctrlKey}function Cl(t,n){var i,i,e,r,o,i=t.state.selection.main;if(!i.empty){if(!(i=oc(t.root))||0==i.rangeCount)return 1;for(e=i.getRangeAt(0).getClientRects(),r=0;r<e.length;r++)if((o=e[r]).left<=n.clientX&&o.right>=n.clientX&&o.top<=n.clientY&&o.bottom>=n.clientY)return 1}}function jl(t,n){if(!n.bubbles)return 1;if(!n.defaultPrevented){for(var i=n.target,e;i!=t.contentDOM;i=i.parentNode)if(!i||11==i.nodeType||(e=c.get(i))&&e.ignoreEvent(n))return;return 1}}function Pl(t){var n,i,n=t.dom.parentNode;n&&((i=n.appendChild(document.createElement("textarea"))).style.cssText="position: fixed; left: -10000px; top: 10px",i.focus(),setTimeout(function(){t.focus(),i.remove(),Ol(t,i.value)},50))}function Ol(t,e){var r,n,o,u,s,i,a,r=t.state,o=1,u=r.toText(e),s=u.lines==r.selection.ranges.length,i,n=null!=wi&&r.selection.ranges.every(function(t){return t.empty})&&wi==u.toString()?(a=-1,r.changeByRange(function(t){var n,i,n=r.doc.lineAt(t.from);return n.from==a?{range:t}:(a=n.from,i=r.toText((s?u.line(o++).text:e)+r.lineBreak),{changes:{from:n.from,insert:i},range:O.cursor(t.from+i.length)})})):s?r.changeByRange(function(t){var n=u.line(o++);return{changes:{from:t.from,to:t.to,insert:n.text},range:O.cursor(t.from+n.length)}}):r.replaceSelection(u);t.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}function El(t,n,i,e){var e,i,n,e;return 1==e?O.cursor(n,i):2==e?rl(t.state,n,i):(e=vn.find(t.docView,n),i=t.state.doc.lineAt(e?e.posAtEnd:n),n=e?e.posAtStart:i.from,(e=e?e.posAtEnd:i.to)<t.state.doc.length&&e==i.to&&e++,O.range(n,e))}function Al(t,n,i,e){var t,n,r,t,t=vn.find(t.docView,n);return t&&0!=(n=n-t.posAtStart)&&(n==t.length||(r=t.coordsAt(n,-1))&&yi(i,e,r)||(!(t=t.coordsAt(n,1))||!yi(i,e,t))&&r&&di(e,r))?-1:1}function Dl(t,n){var i=t.posAtCoords({x:n.clientX,y:n.clientY},!1);return{pos:i,bias:Al(t,i,n.clientX,n.clientY)}}function Rl(t){var n,i;return mi?(n=pi,i=gi,pi=t,gi=Date.now(),ki=!n||i>Date.now()-400&&Math.abs(n.clientX-t.clientX)<2&&Math.abs(n.clientY-t.clientY)<2?(ki+1)%3:1):t.detail}function Il(s,t){var a,f,h,a=Dl(s,t),f=Rl(t),h=s.state.selection;return{update:function t(n){n.docChanged&&(a.pos=n.changes.mapPos(a.pos),h=h.map(n.changes))},get:function t(n,i,e){var n,r,o,r,u,r,n=Dl(s,n),o=El(s,n.pos,n.bias,f);return a.pos==n.pos||i||(r=El(s,a.pos,a.bias,f),u=Math.min(r.from,o.from),r=Math.max(r.to,o.to),o=u<o.from?O.range(u,r):O.range(r,u)),i?h.replaceRange(h.main.extend(o.from,o.to)):e&&1==f&&1<h.ranges.length&&(r=Tl(h,n.pos))?r:e?h.addRange(o):O.create([o])}}}function Tl(t,n){for(var i,e,r,e,i=0;i<t.ranges.length;i++)if(r=(e=t.ranges[i]).from,e=e.to,r<=n&&n<=e)return O.create(t.ranges.slice(0,i).concat(t.ranges.slice(i+1)),t.mainIndex==i?0:t.mainIndex-(t.mainIndex>i?1:0));return null}function Ll(t,n,i,e){var r,n,e,n,i;i&&(r=t.posAtCoords({x:n.clientX,y:n.clientY},!1),n.preventDefault(),n=t.inputState.mouseSelection,e=e&&n&&n.dragging&&n.dragMove?{from:n.dragging.from,to:n.dragging.to}:null,n={from:r,insert:i},i=t.state.changes(e?[e,n]:n),t.focus(),t.dispatch({changes:i,selection:{anchor:i.mapPos(r,-1),head:i.mapPos(r,1)},userEvent:e?"move.drop":"input.drop"}))}function Bl(t,n){var i,e,i=t.dom.parentNode;i&&((e=i.appendChild(document.createElement("textarea"))).style.cssText="position: fixed; left: -10000px; top: 10px",e.value=n,e.focus(),e.selectionEnd=n.length,e.selectionStart=0,setTimeout(function(){e.remove(),t.focus()},50))}function _l(t){var n,i,e,r,o,u,s,a,f,h,c,n=[],i=[],e=!1,r=F(t.selection.ranges);try{for(r.s();!(o=r.n()).done;)(u=o.value).empty||(n.push(t.sliceDoc(u.from,u.to)),i.push(u))}catch(t){r.e(t)}finally{r.f()}if(!n.length){s=-1,a=F(t.selection.ranges);try{for(a.s();!(f=a.n()).done;)h=f.value.from,(c=t.doc.lineAt(h)).number>s&&(n.push(c.text),i.push({from:c.from,to:Math.min(t.doc.length,c.to+1)})),s=c.number}catch(t){a.e(t)}finally{a.f()}e=!0}return{text:n.join(t.lineBreak),ranges:i,linewise:e}}function Fl(t,n){var i,e,r,o,u,i=[],e=F(t.facet(xn));try{for(e.s();!(r=e.n()).done;)(u=(o=r.value)(t,n))&&i.push(u)}catch(t){e.e(t)}finally{e.f()}return i?t.update({effects:i,annotations:bi.of(!0)}):null}function Nl(n){setTimeout(function(){var t,t,t=n.hasFocus;t!=n.inputState.notifiedFocused&&((t=Fl(n.state,t))?n.dispatch(t):n.update([]))},10)}function Ul(t,n){var i,e;null==t[n]&&(i=t[n-1])instanceof Ai&&(e=t[n+1])instanceof Ai&&t.splice(n-1,3,new Ai(i.length+1+e.length))}function Hl(t,n,i){var e=new Ti;return j.compare(t,n,i,e,0),e.changes}function zl(t,n){for(var i,e,r,o,u,s,a,f,h,c,l,i=t.getBoundingClientRect(),e=t.ownerDocument,r=e.defaultView||window,o=Math.max(0,i.left),u=Math.min(r.innerWidth,i.right),s=Math.max(0,i.top),a=Math.min(r.innerHeight,i.bottom),f=t.parentNode;f&&f!=e.body;)if(1==f.nodeType)h=f,c=window.getComputedStyle(h),(h.scrollHeight>h.clientHeight||h.scrollWidth>h.clientWidth)&&"visible"!=c.overflow&&(l=h.getBoundingClientRect(),o=Math.max(o,l.left),u=Math.min(u,l.right),s=Math.max(s,l.top),a=f==t.parentNode?l.bottom:Math.min(a,l.bottom)),f="absolute"==c.position||"fixed"==c.position?h.offsetParent:h.parentNode;else{if(11!=f.nodeType)break;f=f.host}return{left:o-i.left,right:Math.max(o,u)-i.left,top:s-(i.top+n),bottom:Math.max(s,a)-(i.top+n)}}function Wl(t,n){var t=t.getBoundingClientRect();return{left:0,right:t.right-t.left,top:n,bottom:t.bottom-(t.top+n)}}function Vl(t,n,i){var e=[],r=t,o=0;return j.spans(i,t,n,{span:function t(){},point:function t(n,i){r<n&&(e.push({from:r,to:n}),o+=n-r),r=i}},20),r<n&&(e.push({from:r,to:n}),o+=n-r),{total:o,ranges:e}}function $l(t,n){var i,e,r,o,u,s,a,u,i=t.total,e=t.ranges;if(n<=0)return e[0].from;if(1<=n)return e[e.length-1].to;for(r=Math.floor(i*n),o=0;;o++){if(s=(u=e[o]).from,r<=(u=(a=u.to)-s))return s+r;r-=u}}function ql(t,n){var i,e,r,o,u,s,i=0,e=F(t.ranges);try{for(e.s();!(r=e.n()).done;){if(u=(o=r.value).from,n<=(s=o.to)){i+=n-u;break}i+=s-u}}catch(t){e.e(t)}finally{e.f()}return i/t.total}function Gl(t,n){var i,e,r,i=F(t);try{for(i.s();!(e=i.n()).done;)if(n(r=e.value))return r}catch(t){i.e(t)}finally{i.f()}}function Jl(t,n){var i,e;return 1==n.scale?t:(i=n.toDOM(t.top),e=n.toDOM(t.bottom),new Ci(t.from,t.length,i,e-i,t.children&&t.children.map(function(t){return Jl(t,n)}),t.deco))}function Kl(i,t,e){return new Ft(t,{finish:function t(n){return/&/.test(n)?n.replace(/&\w*/,function(t){if("&"==t)return i;if(e&&e[t])return e[t];throw new RangeError("Unsupported selector: ".concat(t))}):i+" "+n}})}function Ql(e,t){var r,n,o,i,u,s,u,a,f,u,h,c,s,a,f,l,v,d,y,m,p,u,t,i,n=t.newSel,o=e.state.selection.main,i=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;return t.bounds?(s=(u=t.bounds).from,u=u.to,a=o.from,f=null,(8===i||g.android&&t.text.length<u-s)&&(a=o.to,f="end"),(u=Xl(e.state.doc.sliceString(s,u,Yn),t.text,a-s,f))&&(g.chrome&&13==i&&u.toB==u.from+2&&"\uffff\uffff"==t.text.slice(u.from,u.toB)&&u.toB--,r={from:s+u.from,to:s+u.toA,insert:k.of(t.text.slice(u.from,u.toB).split(Yn))})):n&&(!e.hasFocus&&e.state.facet(On)||n.main.eq(o))&&(n=null),!(!r&&!n||(!r&&t.typeOver&&!o.empty&&n&&n.main.empty?r={from:o.from,to:o.to,insert:e.state.doc.slice(o.from,o.to)}:r&&r.from>=o.from&&r.to<=o.to&&(r.from!=o.from||r.to!=o.to)&&o.to-o.from-(r.to-r.from)<=4?r={from:o.from,to:o.to,insert:e.state.doc.slice(o.from,r.from).append(r.insert).append(e.state.doc.slice(r.to,o.to))}:(g.mac||g.android)&&r&&r.from==r.to&&r.from==o.head-1&&/^\. ?$/.test(r.insert.toString())&&"off"==e.contentDOM.getAttribute("autocorrect")?(n&&2==r.insert.length&&(n=O.single(n.main.anchor-1,n.main.head-1)),r={from:o.from,to:o.to,insert:k.of([" "])}):g.chrome&&r&&r.from==r.to&&r.from==o.head&&"\n "==r.insert.toString()&&e.lineWrapping&&(n=n&&O.single(n.main.anchor-1,n.main.head-1),r={from:o.from,to:o.to,insert:k.of([" "])}),r?(h=e.state,g.ios&&e.inputState.flushIOSKey(e)||g.android&&(r.from==o.from&&r.to==o.to&&1==r.insert.length&&2==r.insert.lines&&wc(e.contentDOM,"Enter",13)||(r.from==o.from-1&&r.to==o.to&&0==r.insert.length||8==i&&r.insert.length<r.to-r.from)&&wc(e.contentDOM,"Backspace",8)||r.from==o.from&&r.to==o.to+1&&0==r.insert.length&&wc(e.contentDOM,"Delete",46))||(c=r.insert.toString(),e.state.facet(Mn).some(function(t){return t(e,r.from,r.to,c)}))||(0<=e.inputState.composing&&e.inputState.composing++,s=r.from>=o.from&&r.to<=o.to&&r.to-r.from>=(o.to-o.from)/3&&(!n||n.main.empty&&n.main.from==r.from+r.insert.length)&&e.inputState.composing<0?(a=o.from<r.from?h.sliceDoc(o.from,r.from):"",f=o.to>r.to?h.sliceDoc(r.to,o.to):"",h.replaceSelection(e.state.toText(a+r.insert.sliceString(0,void 0,e.state.lineBreak)+f))):(l=h.changes(r),v=n&&n.main.to<=l.newLength?n.main:void 0,1<h.selection.ranges.length&&0<=e.inputState.composing&&r.to<=o.to&&r.to>=o.to-10?(d=e.state.sliceDoc(r.from,r.to),y=Zc(e)||e.state.doc.lineAt(o.head),m=o.to-r.to,p=o.to-o.from,h.changeByRange(function(t){var n,i,i,n;return t.from==o.from&&t.to==o.to?{changes:l,range:v||t.map(l)}:(i=(n=t.to-m)-d.length,t.to-t.from!=p||e.state.sliceDoc(i,n)!=d||y&&t.to>=y.from&&t.from<=y.to?{range:t}:(i=h.changes({from:i,to:n,insert:r.insert}),n=t.to-o.to,{changes:i,range:v?O.range(Math.max(0,v.anchor+n),Math.max(0,v.head+n)):t.map(i)}))})):{changes:l,selection:v&&h.selection.replaceRange(v)}),u="input.type",(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,u+=".compose",e.inputState.compositionFirstChange)&&(u+=".start",e.inputState.compositionFirstChange=!1),e.dispatch(s,{scrollIntoView:!0,userEvent:u})),0):!n||n.main.eq(o)||(t=!1,i="select",e.inputState.lastSelectionTime>Date.now()-50&&("select"==e.inputState.lastSelectionOrigin&&(t=!0),i=e.inputState.lastSelectionOrigin),e.dispatch({selection:n,scrollIntoView:t,userEvent:i}),0)))}function Xl(t,n,i,e){for(var r,o,u,s,a,f,h,r=Math.min(t.length,n.length),o=0;o<r&&t.charCodeAt(o)==n.charCodeAt(o);)o++;if(o==r&&t.length==n.length)return null;for(u=t.length,s=n.length;0<u&&0<s&&t.charCodeAt(u-1)==n.charCodeAt(s-1);)u--,s--;return"end"==e&&(i-=u+(a=Math.max(0,o-Math.min(u,s)))-o),u<o&&t.length<n.length?(s=(o-=f=i<=o&&u<=i?o-i:0)+(s-u),u=o):s<o&&(u=(o-=h=i<=o&&s<=i?o-i:0)+(u-s),s=o),{from:o,toA:u,toB:s}}function Zl(t){var n,t,i,e,r,t,n=[];return t.root.activeElement==t.contentDOM&&(i=(t=t.observer.selectionRange).anchorNode,e=t.anchorOffset,r=t.focusNode,t=t.focusOffset,i)&&(n.push(new ni(i,e)),r==i&&t==e||n.push(new ni(r,t))),n}function Yl(t,n){var i,t;return 0!=t.length&&(i=t[0].pos,t=2==t.length?t[1].pos:i,-1<i)&&-1<t?O.single(i+n,t+n):null}function t0(t,n,i){for(var e,e;n;){if((e=c.get(n))&&e.parent==t)return e;n=(e=n.parentNode)!=t.dom?e:0<i?n.nextSibling:n.previousSibling}return null}function n0(t){var n,i,e,r,o,t,t;function u(t){t.preventDefault(),t.stopImmediatePropagation(),n=t.getTargetRanges()[0]}return n=null,t.contentDOM.addEventListener("beforeinput",u,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",u,!0),n?(i=n.startContainer,e=n.startOffset,r=n.endContainer,o=n.endOffset,hc((t=t.docView.domAtPos(t.state.selection.main.anchor)).node,t.offset,r,o)&&(i=(t=[r,o,i,e])[0],e=t[1],r=t[2],o=t[3]),{anchorNode:i,anchorOffset:e,focusNode:r,focusOffset:o}):null}function i0(t,n,i){for(var e,r,o,o,e=t.state.facet(n),r=e.length-1;0<=r;r--)(o="function"==typeof(o=e[r])?o(t):o)&&Bc(o,i);return i}function e0(t,n){var i,t,e,r,o,u,s,a,i=t.split(/-(?!$)/),t=i[i.length-1];for("Space"==t&&(t=" "),s=0;s<i.length-1;++s)if(a=i[s],/^(cmd|meta|m)$/i.test(a))u=!0;else if(/^a(lt)?$/i.test(a))e=!0;else if(/^(c|ctrl|control)$/i.test(a))r=!0;else if(/^s(hift)?$/i.test(a))o=!0;else{if(!/^mod$/i.test(a))throw new Error("Unrecognized modifier name: "+a);"mac"==n?u=!0:r=!0}return e&&(t="Alt-"+t),r&&(t="Ctrl-"+t),u&&(t="Meta-"+t),t=o?"Shift-"+t:t}function r0(t,n,i){return n.altKey&&(t="Alt-"+t),n.ctrlKey&&(t="Ctrl-"+t),n.metaKey&&(t="Meta-"+t),t=!1!==i&&n.shiftKey?"Shift-"+t:t}function o0(t){var t,n,t=t.facet(ie),n=ee.get(t);return n||ee.set(t,n=s0(t.reduce(function(t,n){return t.concat(n)},[]))),n}function u0(t,n,i){return a0(o0(t.state),n,t,i)}function s0(t,n){var f,h,r,c,i,e,o,u,s,a,l,v,d,y,m,p,k,g,f=1<arguments.length&&void 0!==n?n:ne,h=Object.create(null),r=Object.create(null),c=function t(n,i){var e=r[n];if(null==e)r[n]=i;else if(e!=i)throw new Error("Key binding "+n+" is used both as a regular binding and as a multi-stroke prefix")},i=function t(e,n,i,r){for(var n,n,o,u,s,a,n,n,o=h[e]||(h[e]=Object.create(null)),u=n.split(/ (?!$)/).map(function(t){return e0(t,f)}),s=function t(){var i=u.slice(0,a).join(" ");c(i,!0),o[i]||(o[i]={preventDefault:!0,run:[function(t){var n=re={view:t,prefix:i,scope:e};return setTimeout(function(){re==n&&(re=null)},oe),!0}]})},a=1;a<u.length;a++)s();n=u.join(" "),c(n,!1),n=o[n]||(o[n]={preventDefault:!1,run:(null==(n=null==(n=o.Wde)?void 0:n.run)?void 0:n.slice())||[]}),i&&n.run.push(i),r&&(n.preventDefault=!0)},e=F(t);try{for(e.s();!(o=e.n()).done;){if(s=(u=o.value).scope?u.scope.split(" "):["editor"],u.any){a=F(s);try{for(a.s();!(l=a.n()).done;)for(y in v=l.value,(d=h[v]||(h[v]=Object.create(null))).Wde||(d.Wde={preventDefault:!1,run:[]}),d)d[y].run.push(u.any)}catch(t){a.e(t)}finally{a.f()}}if(m=u[f]||u.key){p=F(s);try{for(p.s();!(k=p.n()).done;)i(g=k.value,m,u.run,u.preventDefault),u.shift&&i(g,"Shift-"+m,u.shift,u.preventDefault)}catch(t){p.e(t)}finally{p.f()}}}}catch(t){e.e(t)}finally{e.f()}return h}function a0(t,o,u,n){var i,e,r,s,a,f,h,t,n,c,i=rc(o),e,r=Mh(wh(i,0))==i.length&&" "!=i,s="",a=!1;if(re&&re.view==u&&re.scope==n&&(s=re.prefix+" ",a=fi.indexOf(o.keyCode)<0)&&(re=null),f=new Set,h=function t(n){var i,e,r;if(n){i=F(n.run);try{for(i.s();!(e=i.n()).done;)if(r=e.value,!f.has(r)&&(f.add(r),r(u,o)))return!0}catch(t){i.e(t)}finally{i.f()}n.preventDefault&&(a=!0)}return!1},t=t[n]){if(h(t[s+r0(i,o,!r)]))return!0;if(r&&(o.altKey||o.metaKey||o.ctrlKey)&&!(g.windows&&o.ctrlKey&&o.altKey)&&(n=Ht[o.keyCode])&&n!=i){if(h(t[s+r0(n,o,!0)]))return!0;if(o.shiftKey&&(c=zt[o.keyCode])!=i&&c!=n&&h(t[s+r0(c,o,!1)]))return!0}else if(r&&o.shiftKey&&h(t[s+r0(i,o,!0)]))return!0;if(h(t.Wde))return!0}return a}function f0(t){var n,i,n=t.scrollDOM.getBoundingClientRect(),i;return{left:(t.textDirection==E.LTR?n.left:n.right-t.scrollDOM.clientWidth)-t.scrollDOM.scrollLeft,top:n.top-t.scrollDOM.scrollTop}}function h0(t,n,i){var n=O.cursor(n);return{from:Math.max(i.from,t.moveToLineBoundary(n,!1,!0).from),to:Math.min(i.to,t.moveToLineBoundary(n,!0,!0).from),type:P.Text}}function c0(t,n){var i,e,r,o,i=t.lineBlockAt(n);if(Array.isArray(i.type)){e=F(i.type);try{for(e.s();!(r=e.n()).done;)if((o=r.value).to>n||o.to==n&&(o.to==i.to||o.type==P.Text))return o}catch(t){e.e(t)}finally{e.f()}}return i}function l0(w,r,t){var n,i,b,e,o,u,e,e,M,x,e,s,a,f,n,i,t;return t.to<=w.viewport.from||t.from>=w.viewport.to?[]:(n=Math.max(t.from,w.viewport.from),i=Math.min(t.to,w.viewport.to),b=w.textDirection==E.LTR,e=w.contentDOM,o=e.getBoundingClientRect(),u=f0(w),e=(e=e.querySelector(".cm-line"))&&window.getComputedStyle(e),M=o.left+(e?parseInt(e.paddingLeft)+Math.min(0,parseInt(e.textIndent)):0),x=o.right-(e?parseInt(e.paddingRight):0),e=c0(w,n),s=c0(w,i),a=e.type==P.Text?e:null,f=s.type==P.Text?s:null,w.lineWrapping&&(a=a&&h0(w,n,a),f=f&&h0(w,i,f)),a&&f&&a.from==f.from?c(l(t.from,t.to,a)):(n=a?l(t.from,null,a):v(e,!1),i=f?l(null,t.to,f):v(s,!0),t=[],(a||e).to<(f||s).from-(a&&f?1:0)?t.push(h(M,n.bottom,x,i.top)):n.bottom<i.top&&w.elementAtHeight((n.bottom+i.top)/2).type==P.Text&&(n.bottom=i.top=(n.bottom+i.top)/2),c(n).concat(t).concat(c(i))));function h(t,n,i,e){return new ue(r,t-u.left,n-u.top-.01,i-t,e-n+.01)}function c(t){for(var n,i,e,r,o,n=t.top,i=t.bottom,e=t.horizontal,r=[],o=0;o<e.length;o+=2)r.push(h(e[o],n,e[o+1],i));return r}function l(t,n,o){var u,s,a,i,e,r,f,h,c,l,v,d,y,m,p,k;function g(t,n,i,e,r){var t,i,t=w.coordsAtPos(t,t==o.to?-2:2),i=w.coordsAtPos(i,i==o.from?2:-2);t&&i&&(u=Math.min(t.top,i.top,u),s=Math.max(t.bottom,i.bottom,s),r==E.LTR?a.push(b&&n?M:t.left,b&&e?x:i.right):a.push(!b&&e?M:i.left,!b&&n?x:t.right))}s=-(u=1e9),a=[],i=null!=t?t:o.from,e=null!=n?n:o.to,r=F(w.visibleRanges);try{for(r.s();!(f=r.n()).done;)if((h=f.value).to>i&&h.from<e)for(c=Math.max(h.from,i),l=Math.min(h.to,e);;){v=w.state.doc.lineAt(c),d=F(w.bidiSpans(v));try{for(d.s();!(y=d.n()).done&&(p=(m=y.value).from+v.from,k=m.to+v.from,!(l<=p));)c<k&&g(Math.max(p,c),null==t&&p<=i,Math.min(k,l),null==n&&e<=k,m.dir)}catch(t){d.e(t)}finally{d.f()}if(l<=(c=v.to+1))break}}catch(t){r.e(t)}finally{r.f()}return 0==a.length&&g(i,null==t,e,null==n,w.textDirection),{top:u,bottom:s,horizontal:a}}function v(t,n){var n=o.top+(n?t.top:t.bottom);return{top:n,bottom:n,horizontal:[]}}}function v0(t,n){return t.constructor==n.constructor&&t.eq(n)}function d0(n){return[d.define(function(t){return new se(t,n)}),ae.of(n)]}function y0(){var t;return[he.of(0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}),ce,le,ve,Cn.of(!0)]}function m0(t){return t.startState.facet(he)!=t.state.facet(he)}function p0(t,n){n.style.animationDuration=t.facet(he).cursorBlinkRate+"ms"}function k0(){return[ye,me]}function g0(t,n,i,e,r){n.lastIndex=0;for(var o=t.iterRange(i,e),u=i,s;!o.next().done;u+=o.value.length)if(!o.lineBreak)for(;s=n.exec(o.value);)r(u+s.index,s)}function w0(t,n){var i,e,r,o,u,s,a,i=t.visibleRanges;if(1==i.length&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;e=[],r=F(i);try{for(r.s();!(o=r.n()).done;)s=(u=o.value).from,a=u.to,s=Math.max(t.state.doc.lineAt(s).from,s-n),a=Math.min(t.state.doc.lineAt(a).to,a+n),e.length&&e[e.length-1].to>=s?e[e.length-1].to=a:e.push({from:s,to:a})}catch(t){r.e(t)}finally{r.f()}return e}function b0(){var t,n;return null==be&&"undefined"!=typeof document&&document.body&&(n=document.body.style,be=null!=(null!=(t=n.tabSize)?t:n.MozTabSize)),be}function M0(){var t;return[Me.of(0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}),x0()]}function x0(){return xe=xe||d.fromClass(function(){function n(t){A(this,n),this.view=t,this.decorations=m.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(Me)),this.decorations=this.decorator.createDeco(t)}return D(n,[{key:"makeDecorator",value:function t(o){var u=this;return new pe({regexp:o.specialChars,decoration:function t(n,i,e){var r,n,r,i,e,r=i.state.doc,n=wh(n[0],0);return 9==n?(r=r.lineAt(e),i=i.state.tabSize,e=ic(r.text,i,e-r.from),m.replace({widget:new je((i-e%i)*u.view.defaultCharacterWidth)})):u.decorationCache[n]||(u.decorationCache[n]=m.replace({widget:new Ce(o,n)}))},boundary:o.replaceTabs?void 0:/[^]/})}},{key:"update",value:function t(n){var i=n.state.facet(Me);n.startState.facet(Me)!=i?(this.decorator=this.makeDecorator(i),this.decorations=this.decorator.createDeco(n.view)):this.decorations=this.decorator.updateDeco(n,this.decorations)}}]),n}(),{decorations:function t(n){return n.decorations}})}function S0(t){return 32<=t?Se:10==t?"\u2424":String.fromCharCode(9216+t)}function C0(){return[Pe,In.of(function(t){var t;return(null==(t=t.plugin(Pe))?void 0:t.attrs)||null})]}function j0(){return Ee}function P0(i){return d.fromClass(function(){function n(t){A(this,n),this.view=t,this.placeholder=m.set([m.widget({widget:new Ae(i),side:1}).range(0)])}return D(n,[{key:"decorations",get:function t(){return this.view.state.doc.length?m.none:this.placeholder}}]),n}(),{decorations:function t(n){return n.decorations}})}function O0(t,n,i){var e,r,o,u,s,a,f,h,c,l,v,d,y,e=Math.min(n.line,i.line),r=Math.max(n.line,i.line),o=[];if(n.off>De||i.off>De||n.col<0||i.col<0)for(u=Math.min(n.off,i.off),s=Math.max(n.off,i.off),a=e;a<=r;a++)(f=t.doc.line(a)).length<=s&&o.push(O.range(f.from+u,f.to+s));else for(h=Math.min(n.col,i.col),c=Math.max(n.col,i.col),l=e;l<=r;l++)(d=ec((v=t.doc.line(l)).text,h,t.tabSize,!0))<0?o.push(O.cursor(v.to)):(y=ec(v.text,c,t.tabSize),o.push(O.range(v.from+d,v.from+y)));return o}function E0(t,n){var i=t.coordsAtPos(t.viewport.from);return i?Math.round(Math.abs((i.left-n)/t.defaultCharacterWidth)):-1}function A0(t,n){var i,e,r,n,i=t.posAtCoords({x:n.clientX,y:n.clientY},!1),e=t.state.doc.lineAt(i),r=i-e.from,n=De<r?-1:r==e.length?E0(t,n.clientX):ic(e.text,t.state.tabSize,i-e.from);return{line:e.number,col:n,off:r}}function D0(r,t){var o=A0(r,t),u=r.state.selection;return o?{update:function t(n){var i,i;n.docChanged&&(i=n.changes.mapPos(n.startState.doc.line(o.line).from),i=n.state.doc.lineAt(i),o={line:i.number,col:o.col,off:Math.min(o.off,i.length)},u=u.map(n.changes))},get:function t(n,i,e){var n,n,n=A0(r,n);return n&&(n=O0(r.state,o,n)).length?e?O.create(n.concat(u.ranges)):O.create(n):u}}:null}function R0(t){var i=(null==t?void 0:t.eventFilter)||function(t){return t.altKey&&0==t.button};return w.mouseSelectionStyle.of(function(t,n){return i(n)?D0(t,n):null})}function I0(){var t,n,i,e,r,t,n=Gf(Re[(0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}).key||"Alt"],2),i=n[0],e=n[1],r=d.fromClass(function(){function n(t){A(this,n),this.view=t,this.isDown=!1}return D(n,[{key:"set",value:function t(n){this.isDown!=n&&(this.isDown=n,this.view.update([]))}}]),n}(),{eventHandlers:{keydown:function t(n){this.set(n.keyCode==i||e(n))},keyup:function t(n){n.keyCode!=i&&e(n)||this.set(!1)},mousemove:function t(n){this.set(e(n))}}});return[r,w.contentAttributes.of(function(t){var t;return null!=(t=t.plugin(r))&&t.isDown?Ie:null})]}function T0(){var t;return Be.of(0<arguments.length&&void 0!==arguments[0]?arguments[0]:{})}function L0(t){var t=t.win;return{top:0,left:0,bottom:t.innerHeight,right:t.innerWidth}}function B0(t){for(var n=t;n;n=n.parentNode)if(1==n.nodeType&&n.classList.contains("cm-tooltip"))return 1}function _0(t,n,i,e,r,o){var u,n,t,s,a,f,h,u=document.createRange(),n=t.domAtPos(n),t=t.domAtPos(i);for(u.setEnd(t.node,t.offset),u.setStart(n.node,n.offset),s=u.getClientRects(),u.detach(),a=0;a<s.length;a++)if(f=s[a],(h=Math.max(f.top-r,r-f.bottom,f.left-e,e-f.right))<=o)return 1}function F0(n){var a,f,i,a=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},f=v.define(),i=b.define({create:function t(){return null},update:function t(n,i){var e,r,o,u,s;if(n&&(a.hideOnChange&&(i.docChanged||i.selection)||a.hideOn&&a.hideOn(i,n)))return null;if(n&&i.docChanged){if(null==(e=i.changes.mapPos(n.pos,-1,h.TrackDel)))return null;(r=Object.assign(Object.create(null),n)).pos=e,null!=n.end&&(r.end=i.changes.mapPos(n.end)),n=r}o=F(i.effects);try{for(o.s();!(u=o.n()).done;)(s=u.value).is(f)&&(n=s.value),s.is($e)&&(n=null)}catch(t){o.e(t)}finally{o.f()}return n},provide:function t(n){return He.from(n)}});return[i,d.define(function(t){return new Ve(t,n,i,f,a.hoverTime||300)}),We]}function N0(t,n){var t,n,t=t.plugin(Fe);return!t||(n=t.manager.tooltips.indexOf(n))<0?null:t.manager.tooltipViews[n]}function U0(t){return t.facet(He).some(function(t){return t})}function H0(t){var t;null!=(t=t.plugin(Fe))&&t.maybeMeasure()}function z0(t){return t?[qe.of(t)]:[]}function W0(t,n){var t,n,t=t.plugin(Ge),n=t?t.specs.indexOf(n):-1;return-1<n?t.panels[n]:null}function V0(t){var n=t.nextSibling;return t.remove(),n}function $0(t){return[q0(),Ze.of(Object.assign(Object.assign({},Xe),t))]}function q0(t){var n=[tr];return t&&!1===t.fixed&&n.push(Ye.of(!0)),n}function G0(t){return Array.isArray(t)?t:[t]}function J0(t,n,i){for(;t.value&&t.from<=i;)t.from==i&&n.push(t.value),t.next()}function K0(t,n){if(t.length==n.length){for(var i=0;i<t.length;i++)if(!t[i].compare(n[i]))return;return 1}}function Q0(t,n){return t.state.facet(or).formatNumber(n,t.state)}function X0(){var t;return[or.of(0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}),q0(),sr]}function Z0(t){for(var n=9;n<t;)n=10*n+9;return n}function Y0(){return fr}function tv(t){var n=hr.get(t);return n||hr.set(t,n=m.mark({attributes:"\t"===t?{class:"cm-highlightTab"}:{class:"cm-highlightSpace","data-display":t.replace(/ /g,"\xb7")}})),n}function nv(i){return d.define(function(t){return{decorations:i.createDeco(t),update:function t(n){this.decorations=i.updateDeco(n,this.decorations)}}},{decorations:function t(n){return n.decorations}})}function iv(){return cr}function ev(){return lr}function rv(t,n,i,e){switch(t){case-2:return i<n;case-1:return n<=e&&i<n;case 0:return i<n&&n<e;case 1:return i<=n&&n<e;case 2:return n<e;case 4:return 1}}function ov(t,n){for(var i,e,i=t.childBefore(n);i&&(e=i.lastChild)&&e.to==i.to;)i=e.type.isError&&e.from==e.to?(t=i,e.prevSibling):e;return t}function uv(t,n,i,e){for(var r,o,u,s,a,f;t.from==t.to||(i<1?t.from>=n:t.from>n)||(-1<i?t.to<=n:t.to<n);){if(!(o=!e&&t instanceof Sr&&t.index<0?null:t.parent))return t;t=o}if(u=e?0:br.IgnoreOverlays,e)for(a=(s=t).parent;a;a=(s=a).parent)s instanceof Sr&&s.index<0&&(null==(r=a.enter(n,i,u))?void 0:r.from)!=s.from&&(t=a);for(;;){if(!(f=t.enter(n,i,u)))return t;t=f}}function sv(t,n,i,e){var r=t.cursor(),o=[];if(!r.firstChild())return o;if(null!=i)for(;!r.type.is(i);)if(!r.nextSibling())return o;for(;;){if(null!=e&&r.type.is(e))return o;if(r.type.is(n)&&o.push(r.node),!r.nextSibling())return null==e?o:[]}}function av(t,n,i){for(var e,r,e=2<arguments.length&&void 0!==i?i:n.length-1,r=t.parent;0<=e;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(n[e]&&n[e]!=r.name)return!1;e--}}return!0}function fv(t){return t.children.some(function(t){return t instanceof xr||!t.type.isAnonymous||fv(t)})}function hv(t){var n,i,S,n,C,n,j,n,P,O,E,A,D,e,r,i;function R(t,n,i,e,r){for(var o,u,s,a,f,h,c,l,v,d,y,m,p,k,g,w,b,M,x,n,o=O.id,u=O.start,s=O.end,a=O.size,f=D;a<0;){if(O.next(),-1==a)return h=j[o],i.push(h),void e.push(u-t);if(-3==a)return void(A=o);if(-4==a)return void(D=o);throw new RangeError("Unrecognized record size: ".concat(a))}if(c=E[o],d=u-t,s-u<=C&&(v=B(O.pos-n,r))){for(y=new Uint16Array(v.size-v.skip),m=O.pos-v.size,p=y.length;O.pos>m;)p=_(v.start,y,p);l=new xr(y,s-v.start,S),d=v.start-t}else{for(k=O.pos-a,O.next(),g=[],w=[],b=P<=o?o:-1,M=0,x=s;O.pos>k;)0<=b&&O.id==b&&0<=O.size?(O.end<=x-C&&(T(g,w,u,M,O.end,x,b,f),M=g.length,x=O.end),O.next()):R(u,k,g,w,b);0<=b&&0<M&&M<g.length&&T(g,w,u,M,u,x,b,f),g.reverse(),w.reverse(),l=-1<b&&0<M?(n=I(c),lv(c,g,w,0,g.length,0,s-u,n,n)):L(c,g,w,s-u,f-s)}i.push(l),e.push(d)}function I(s){return function(t,n,i){var e=0,r=t.length-1,o,u;if(0<=r&&(o=t[r])instanceof x){if(!r&&o.type==s&&o.length==i)return o;(u=o.prop(M.lookAhead))&&(e=n[r]+o.length+u)}return L(s,t,n,i,e)}}function T(t,n,i,e,r,o,u,s){for(var a=[],f=[];t.length>e;)a.push(t.pop()),f.push(n.pop()+i-r);t.push(L(S.types[u],a,f,o-r,s-o)),n.push(r-i)}function L(t,n,i,e,r,o){var r,o,u,u,r=4<arguments.length&&void 0!==r?r:0,o=5<arguments.length?o:void 0;return A&&(u=[M.contextHash,A],o=o?[u].concat(o):[u]),25<r&&(u=[M.lookAhead,r],o=o?[u].concat(o):[u]),new x(t,n,i,e,o)}function B(t,n){var i,e,r,o,u,s,a,f,h,c,l,i=O.fork(),e=0,r=0,o=0,u=i.end-C,s={size:0,start:0,skip:0};t:for(a=i.pos-t;i.pos>a;)if(f=i.size,i.id==n&&0<=f)s.size=e,s.start=r,s.skip=o,o+=4,e+=4,i.next();else{if(h=i.pos-f,f<0||h<a||i.start<u)break;for(c=i.id>=P?4:0,l=i.start,i.next();i.pos>h;){if(i.size<0){if(-3!=i.size)break t;c+=4}else i.id>=P&&(c+=4);i.next()}r=l,e+=f,o+=c}return(n<0||e==t)&&(s.size=e,s.start=r,s.skip=o),4<s.size?s:void 0}function _(t,n,i){var e,r,o,u,s,a,e=O.id,r=O.start,o=O.end,u=O.size;if(O.next(),0<=u&&e<P){if(s=i,4<u)for(a=O.pos-(u-4);O.pos>a;)i=_(t,n,i);n[--i]=s,n[--i]=o-t,n[--i]=r-t,n[--i]=e}else-3==u?A=e:-4==u&&(D=e);return i}for(i=t.buffer,S=t.nodeSet,n=t.maxBufferLength,C=void 0===n?dr:n,n=t.reused,j=void 0===n?[]:n,n=t.minRepeatType,P=void 0===n?S.types.length:n,O=Array.isArray(i)?new Mr(i,i.length):i,E=S.types,D=A=0,e=[],r=[];0<O.pos;)R(t.start||0,t.bufferStart||0,e,r,-1);return i=null!=(n=t.length)?n:e.length?r[0]+e[0].length:0,new x(E[t.topID],e.reverse(),r.reverse(),i)}function cv(t,n){var i,e,r,o;if(!t.isAnonymous||n instanceof xr||n.type!=t)return 1;if(null==(i=Or.get(n))){i=1,e=F(n.children);try{for(e.s();!(r=e.n()).done;){if((o=r.value).type!=t||!(o instanceof x)){i=1;break}i+=cv(t,o)}}catch(t){e.e(t)}finally{e.f()}Or.set(n,i)}return i}function lv(c,t,n,i,e,l,r,o,v){for(var u,s,d,y,m,u=0,s=i;s<e;s++)u+=cv(c,t[s]);function p(t,n,i,e,r){for(var o,u,s,a,f,h,h,o=i;o<e;){for(s=n[u=o],a=cv(c,t[o]),o++;o<e&&(f=cv(c,t[o]),!(d<=a+f));o++)a+=f;if(o==u+1){if(d<a){p((h=t[u]).children,h.positions,0,h.children.length,n[u]+r);continue}y.push(t[u])}else h=n[o-1]+t[o-1].length-s,y.push(lv(c,t,n,u,o,s,h,null,v));m.push(s+r-l)}}return d=Math.ceil(1.5*u/8),y=[],m=[],p(t,n,i,e,0),(o||v)(y,m,r)}function vv(t,i){return t.length==i.length&&t.every(function(t,n){return t==i[n]})}function dv(t){for(var n,i,e,r,n=[[]],i=0;i<t.length;i++)for(e=0,r=n.length;e<r;e++)n.push(n[e].concat(t[i]));return n.sort(function(t,n){return n.length-t.length})}function yv(t){var n,i,e,r,o,u,s,a,f,h,c,l,v,d,y,n=Object.create(null);for(i in t){e=t[i],Array.isArray(e)||(e=[e]),r=F(i.split(" "));try{for(r.s();!(o=r.n()).done;)if(u=o.value){for(s=[],a=2,f=u,h=0;;){if("..."==f&&0<h&&h+3==u.length){a=1;break}if(!(c=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(f)))throw new RangeError("Invalid path: "+u);if(s.push("*"==c[0]?"":'"'==c[0][0]?JSON.parse(c[0]):c[0]),(h+=c[0].length)==u.length)break;if(l=u[h++],h==u.length&&"!"==l){a=0;break}if("/"!=l)throw new RangeError("Invalid path: "+u);f=u.slice(h)}if(!(d=s[v=s.length-1]))throw new RangeError("Invalid path: "+u);y=new _r(e,a,0<v?s.slice(0,v):null),n[d]=y.sort(n[d])}}catch(t){r.e(t)}finally{r.f()}}return Br.add(n)}function mv(t,n){var h,i,e,r,o,u,s,t,n,t,c,h=Object.create(null),i=F(t);try{for(i.s();!(e=i.n()).done;)if(r=e.value,Array.isArray(r.tag)){o=F(r.tag);try{for(o.s();!(u=o.n()).done;)s=u.value,h[s.id]=r.class}catch(t){o.e(t)}finally{o.f()}}else h[r.tag.id]=r.class}catch(t){i.e(t)}finally{i.f()}return n=(t=n||{}).scope,t=t.all,c=void 0===t?null:t,{style:function t(n){var i,e,r,o,u,s,a,f,i=c,e=F(n);try{for(e.s();!(r=e.n()).done;){u=F((o=r.value).set);try{for(u.s();!(s=u.n()).done;)if(a=s.value,f=h[a.id]){i=i?i+" "+f:f;break}}catch(t){u.e(t)}finally{u.f()}}}catch(t){e.e(t)}finally{e.f()}return i},scope:n}}function pv(t,n){var i,e,r,o,u,i=null,e=F(t);try{for(e.s();!(r=e.n()).done;)(u=(o=r.value).style(n))&&(i=i?i+" "+u:u)}catch(t){e.e(t)}finally{e.f()}return i}function kv(t,n,i,e,r){var e,r,n,e=3<arguments.length&&void 0!==e?e:0,r=4<arguments.length&&void 0!==r?r:t.length,n=new Fr(e,Array.isArray(n)?n:[n],i);n.highlightRange(t.cursor(),e,r,"",n.highlighters),n.flush(r)}function gv(t){for(var n=t.type.prop(Br);n&&n.context&&!t.matchContext(n.context);)n=n.next;return n||null}function wv(n){return y.define({combine:n?function(t){return t.concat(n)}:void 0})}function bv(t,n,i){var e,r,o,e=t.facet(io),r=R(t).topNode;if(!e||e.allowsNesting)for(o=r;o;o=o.enter(n,i,br.ExcludeBuffers))o.type.isTop&&(r=o);return r}function R(t){var t=t.field(Jr.state,!1);return t?t.tree:x.empty}function Mv(t,n){var i,t,t,e,i,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:50,t=null==(t=t.field(Jr.state,!1))?void 0:t.context;return t?(e=t.viewport,t.updateViewport({from:0,to:n}),i=t.isDone(n)||t.work(i,n)?t.tree:null,t.updateViewport(e),i):null}function xv(t){var n,t,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:t.doc.length;return(null==(t=t.field(Jr.state,!1))?void 0:t.context.isDone(n))||!1}function Sv(t){var n,i,n,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:t.viewport.to,i,n=Mv(t.state,n,2<arguments.length&&void 0!==arguments[2]?arguments[2]:100);return n!=R(t.state)&&t.dispatch({}),!!n}function Cv(t){var t;return(null==(t=t.plugin(no))?void 0:t.isWorking())||!1}function jv(t,n,i){return Er.applyChanges(t,[{fromA:n,toA:i,fromB:n,toB:i}])}function Pv(t){var n=t.facet(ro);return 9==n.charCodeAt(0)?t.tabSize*n.length:n.length}function Ov(t,n){var i,e,r,o,i="",e=t.tabSize,r=t.facet(ro)[0];if("\t"==r){for(;e<=n;)i+="\t",n-=e;r=" "}for(o=0;o<n;o++)i+=r;return i}function Ev(t,n){var i,e,r,o,u,i=F((t=t instanceof C?new oo(t):t).state.facet(eo));try{for(i.s();!(e=i.n()).done;)if(void 0!==(o=(r=e.value)(t,n)))return o}catch(t){i.e(t)}finally{i.f()}return(u=R(t.state))?Dv(t,u,n):null}function Av(t,n,i){for(var e,r,o,u,s,a,f,h,e=Object.create(null),r=new oo(t,{overrideIndentation:function t(n){var n;return null!=(n=e[n])?n:-1}}),o=[],u=n;u<=i;)u=(s=t.doc.lineAt(u)).to+1,null!=(a=Ev(r,s.from))&&(/\S/.test(s.text)||(a=0),(f=/^\s*/.exec(s.text)[0])!=(h=Ov(t,a)))&&(e[s.from]=a,o.push({from:s.from,to:s.from+f.length,insert:h}));return t.changes(o)}function Dv(t,n,i){return Tv(n.resolveInner(i).enterUnfinishedNodesBefore(i),i,t)}function Rv(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function Iv(t){var n,n,n,i,e,n=t.type.prop(uo);return n||((n=t.firstChild)&&(n=n.type.prop(M.closedBy))?(i=t.lastChild,e=i&&-1<n.indexOf(i.name),function(t){return Nv(t,!0,1,void 0,e&&!Rv(t)?i.from:void 0)}):null==t.parent?Lv:null)}function Tv(t,n,i){for(;t;t=t.parent){var e=Iv(t);if(e)return e(so.create(i,n,t))}return null}function Lv(){return 0}function Bv(t,n){for(var i=n;i;i=i.parent)if(t==i)return 1}function _v(t){var n,i,e,r,t,o,u,s,n=t.node,i=n.childAfter(n.from),e=n.lastChild;if(!i)return null;for(r=t.options.simulateBreak,t=t.state.doc.lineAt(i.from),o=null==r||r<=t.from?t.to:Math.min(t.to,r),u=i.to;;){if(!(s=n.childAfter(u))||s==e)return null;if(!s.type.isSkipped)return s.from<o?i:null;u=s.to}}function Fv(t){var n=t.closing,i=t.align,e=void 0===i||i,i=t.units,r=void 0===i?1:i;return function(t){return Nv(t,e,r,n)}}function Nv(t,n,i,e,r){var o,u,o,e,o=t.textAfter,u=o.match(/^\s*/)[0].length,o=e&&o.slice(u,u+e.length)==e||r==t.pos+u,e=n?_v(t):null;return e?o?t.column(e.from):t.column(e.to):t.baseIndent+(o?0:t.unit*i)}function Uv(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},i=t.except,t=t.units,e=void 0===t?1:t;return function(t){var n=i&&i.test(t.textAfter);return t.baseIndent+(n?0:e*t.unit)}}function Hv(){return C.transactionFilter.of(function(t){var n,i,e,r,o,u,s,a,f,h,c,l,v,d,y;if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;if(!(n=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head)).length)return t;if(i=t.newDoc,(e=t.newSelection.main.head)>(r=i.lineAt(e)).from+ao)return t;if(o=i.sliceString(r.from,e),!n.some(function(t){return t.test(o)}))return t;s=-1,a=[],f=F((u=t.state).selection.ranges);try{for(f.s();!(h=f.n()).done;)c=h.value.head,(l=u.doc.lineAt(c)).from!=s&&(s=l.from,null!=(v=Ev(u,l.from)))&&(d=/^\s*/.exec(l.text)[0])!=(y=Ov(u,v))&&a.push({from:l.from,to:l.from+d.length,insert:y})}catch(t){f.e(t)}finally{f.f()}return a.length?[t,{changes:a,sequential:!0}]:t})}function zv(t){var n=t.firstChild,i=t.lastChild;return n&&n.to<i.from?{from:n.to,to:i.type.isError?t.to:i.from}:null}function Wv(t,n,i){var e,r,o,u,s,s,e=R(t);if(e.length<i)return null;for(o=null,u=r=e.resolveInner(i,1);u;u=u.parent)if(!(u.to<=i||u.from>i)){if(o&&u.from<n)break;(s=u.type.prop(ho))&&(u.to<e.length-50||e.length==t.doc.length||!Vv(u))&&(s=s(u,t))&&s.from<=i&&s.from>=n&&s.to>i&&(o=s)}return o}function Vv(t){var n=t.lastChild;return n&&n.to==t.to&&n.type.isError}function $v(t,n,i){var e,r,o,u,e=F(t.facet(fo));try{for(e.s();!(r=e.n()).done;)if(u=(o=r.value)(t,n,i))return u}catch(t){e.e(t)}finally{e.f()}return Wv(t,n,i)}function qv(t,n){var i=n.mapPos(t.from,1),n=n.mapPos(t.to,-1);return n<=i?void 0:{from:i,to:n}}function Gv(i){var e,n,r,t,e=[],n=F(i.state.selection.ranges);try{for(t=function t(){var n=r.value.head;if(e.some(function(t){return t.from<=n&&t.to>=n}))return 1;e.push(i.lineBlockAt(n))},n.s();!(r=n.n()).done;)t()}catch(t){n.e(t)}finally{n.f()}return e}function Jv(t){return t.field(vo,!1)||j.empty}function Kv(t,n,i){var t,e,e=null;return null!=(t=t.field(vo,!1))&&t.between(n,i,function(t,n){(!e||e.from>t)&&(e={from:t,to:n})}),e}function Qv(t,i,e){var r=!1;return t.between(i,i,function(t,n){t==i&&n==e&&(r=!0)}),r}function Xv(t,n){return t.field(vo,!1)?n:n.concat(v.appendConfig.of(td()))}function Zv(t,n,i){var i,e,n,i=!(2<arguments.length&&void 0!==i)||i,e=t.state.doc.lineAt(n.from).number,n=t.state.doc.lineAt(n.to).number;return w.announce.of("".concat(t.state.phrase(i?"Folded lines":"Unfolded lines")," ").concat(e," ").concat(t.state.phrase("to")," ").concat(n,"."))}function Yv(t,n){for(var i,e,i=n;;){if((e=$v(t.state,i.from,i.to))&&e.to>n.from)return e;if(!i.from)return null;i=t.lineBlockAt(i.from-1)}}function td(t){var n=[vo,bo];return t&&n.push(po.of(t)),n}function nd(){var t,i,s,a,e,r,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},i=Object.assign(Object.assign({},go),t),s=new wo(i,!0),a=new wo(i,!1),e=d.fromClass(function(){function n(t){A(this,n),this.from=t.viewport.from,this.markers=this.buildMarkers(t)}return D(n,[{key:"update",value:function t(n){(n.docChanged||n.viewportChanged||n.startState.facet(io)!=n.state.facet(io)||n.startState.field(vo,!1)!=n.state.field(vo,!1)||R(n.startState)!=R(n.state)||i.foldingChanged(n))&&(this.markers=this.buildMarkers(n.view))}},{key:"buildMarkers",value:function t(n){var i,e,r,o,u,i=new Et,e=F(n.viewportLineBlocks);try{for(e.s();!(r=e.n()).done;)o=r.value,(u=Kv(n.state,o.from,o.to)?a:$v(n.state,o.from,o.to)?s:null)&&i.add(o.from,o.from,u)}catch(t){e.e(t)}finally{e.f()}return i.finish()}}]),n}()),r=i.domEventHandlers;return[e,$0({class:"cm-foldGutter",markers:function t(n){var n;return(null==(n=n.plugin(e))?void 0:n.markers)||j.empty},initialSpacer:function t(){return new wo(i,!1)},domEventHandlers:Object.assign(Object.assign({},r),{click:function t(n,i,e){var e,e;return!((!r.click||!r.click(n,i,e))&&((e=Kv(n.state,i.from,i.to))?(n.dispatch({effects:lo.of(e)}),0):!(e=$v(n.state,i.from,i.to))||(n.dispatch({effects:co.of(e)}),0)))}})}),td()]}function id(t){var n=t.facet(xo);return n.length?n:t.facet(So)}function ed(n,t){var i=[Co],e;return n instanceof Mo&&(n.module&&i.push(w.styleModule.of(n.module)),e=n.themeType),null!=t&&t.fallback?i.push(So.of(n)):i.push(e?xo.computeN([w.darkTheme],function(t){return t.facet(w.darkTheme)==("dark"==e)?[n]:[]}):xo.of(n)),i}function rd(t,n,i){var t,e,r,o,u,s,t=id(t),e=null;if(t){r=F(t);try{for(r.s();!(o=r.n()).done;)(!(u=o.value).scope||i&&u.scope(i))&&(s=u.style(n))&&(e=e?e+" "+s:s)}catch(t){r.e(t)}finally{r.f()}}return e}function od(t){var n,i,n=[],i=t.matched?Ao:Do;return n.push(i.range(t.start.from,t.start.to)),t.end&&n.push(i.range(t.end.from,t.end.to)),n}function ud(){var t;return[Eo.of(0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}),Io]}function sd(t,n,i){var e,e,e=t.prop(n<0?M.openedBy:M.closedBy);return e||(1==t.name.length&&-1<(e=i.indexOf(t.name))&&e%2==(n<0?1:0)?[i[e+n]]:null)}function ad(t){var n=t.type.prop(To);return n?n(t.node):t}function fd(t,n,i){for(var e,r,o,e,u,s,a,f,e=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{},r=e.maxScanDistance||Po,o=e.brackets||Oo,e=R(t),u=e.resolveInner(n,i),s=u;s;s=s.parent)if((a=sd(s.type,i,o))&&s.from<s.to&&(f=ad(s))&&(0<i?n>=f.from&&n<f.to:n>f.from&&n<=f.to))return hd(t,n,i,s,f,a,o);return cd(t,n,i,e,u.type,r,o)}function hd(t,n,i,e,r,o,u){var s,a,f,h,c,c,s=e.parent,a={from:r.from,to:r.to},f=0,h=null==s?void 0:s.cursor();if(h&&(i<0?h.childBefore(e.from):h.childAfter(e.to)))do{if(i<0?h.to<=e.from:h.from>=e.to){if(0==f&&-1<o.indexOf(h.type.name)&&h.from<h.to)return{start:a,end:(c=ad(h))?{from:c.from,to:c.to}:void 0,matched:!0};if(sd(h.type,i,u))f++;else if(sd(h.type,-i,u)){if(0==f)return{start:a,end:(c=ad(h))&&c.from<c.to?{from:c.from,to:c.to}:void 0,matched:!1};f--}}}while(i<0?h.prevSibling():h.nextSibling());return{start:a,matched:!1}}function cd(t,n,i,e,r,o,u){var s,a,f,h,c,l,v,d,y,m,p,s=i<0?t.sliceDoc(n-1,n):t.sliceDoc(n,n+1),a=u.indexOf(s);if(a<0||a%2==0!=0<i)return null;for(f={from:i<0?n-1:n,to:0<i?n+1:n},h=t.doc.iterRange(n,0<i?t.doc.length:0),l=c=0;!h.next().done&&l<=o;){for(v=h.value,i<0&&(l+=v.length),d=n+l*i,y=0<i?0:v.length-1,m=0<i?v.length:-1;y!=m;y+=i)if(!((p=u.indexOf(v[y]))<0||e.resolveInner(d+y,1).type!=r))if(p%2==0==0<i)c++;else{if(1==c)return{start:f,end:{from:d+y,to:d+y+1},matched:p>>1==a>>1};c--}0<i&&(l+=v.length)}return h.done?{start:f,matched:!1}:null}function ld(t,n,i,e,r){var e,r,o,u,e=3<arguments.length&&void 0!==e?e:0,r=4<arguments.length&&void 0!==r?r:0;for(null==n&&-1==(n=t.search(/[^\s\u00a0]/))&&(n=t.length),o=r,u=e;u<n;u++)9==t.charCodeAt(u)?o+=i-o%i:o++;return o}function vd(t){return{name:t.name||"",token:t.token,blankLine:t.blankLine||function(){},startState:t.startState||function(){return!0},copyState:t.copyState||dd,indent:t.indent||function(){return null},languageData:t.languageData||{},tokenTable:t.tokenTable||Fo}}function dd(t){var n,i,e;if("object"!=uh(t))return t;for(i in n={},t)e=t[i],n[i]=e instanceof Array?e.slice():e;return n}function yd(t,n,i,e,r){var o,u,s,a,s,o=e<=i&&i+n.length<=r&&n.prop(t.stateAfter);if(o)return{state:t.streamParser.copyState(o),pos:i+n.length};for(u=n.children.length-1;0<=u;u--)if(s=n.children[u],a=i+n.positions[u],s=s instanceof x&&a<r&&yd(t,s,a,e,r))return s;return null}function md(t,n,i,e,r){var o,u,s,a;if(r&&i<=0&&e>=n.length)return n;for(r||n.type!=t.topNode||(r=!0),o=n.children.length-1;0<=o;o--)if(u=n.positions[o],s=n.children[o],a=void 0,u<e&&s instanceof x){if(a=md(t,s,i-u,e-u,r))return r?new x(n.type,n.children.slice(0,o).concat(a),n.positions.slice(0,o+1),u+a.length):a;break}return null}function pd(t,n,i,e){var r,o,u,s,a,f,h,r=F(n);try{for(r.s();!(o=r.n()).done;)if(s=(u=o.value).from+(u.openStart?25:0),a=u.to-(u.openEnd?25:0),f=s<=i&&i<a&&yd(t,u.tree,0-u.offset,i,a),h=void 0,f&&(h=md(t,u.tree,i+u.offset,f.pos+u.offset,!1)))return{state:f.state,tree:h}}catch(t){r.e(t)}finally{r.f()}return{state:t.streamParser.startState(e?Pv(e):4),tree:x.empty}}function kd(t,n,i){var e,r;for(n.start=n.pos,e=0;e<10;e++)if(r=t(n,i),n.pos>n.start)return r;throw new Error("Stream parser failed to advance stream.")}for(Qn=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/,Xn=function(){function e(t,n,i){A(this,e),this.from=t,this.to=n,this.level=i}return D(e,[{key:"dir",get:function t(){return this.level%2?Hn:Un}},{key:"side",value:function t(n,i){return this.dir==i==n?this.to:this.from}}],[{key:"find",value:function t(n,i,e,r){for(var o,u,s,o=-1,u=0;u<n.length;u++)if((s=n[u]).from<=i&&s.to>=i){if(s.level==e)return u;(o<0||(0!=r?r<0?s.from<i:s.to>i:n[o].level>s.level))&&(o=u)}if(o<0)throw new RangeError("Index out of range");return o}}]),e}(),z=[],Zn="",Yn="\uffff",ti=function(){function i(t,n){A(this,i),this.points=t,this.text="",this.lineSeparator=n.facet(C.lineSeparator)}return D(i,[{key:"append",value:function t(n){this.text+=n}},{key:"lineBreak",value:function t(){this.text+=Yn}},{key:"readRange",value:function t(n,i){var e,r,o,u,s,a;if(n){for(e=n.parentNode,r=n;this.findPointBefore(e,r),o=this.text.length,this.readNode(r),(u=r.nextSibling)!=i;)s=c.get(r),a=c.get(u),(s&&a?s.breakAfter:(s?s.breakAfter:Qc(r))||Qc(u)&&("BR"!=r.nodeName||r.cmIgnore)&&this.text.length>o)&&this.lineBreak(),r=u;this.findPointBefore(e,i)}return this}},{key:"readTextNode",value:function t(n){var i,e,r,o,u,s,a,f,h,c,l,v,i=n.nodeValue,e=F(this.points);try{for(e.s();!(r=e.n()).done;)(o=r.value).node==n&&(o.pos=this.text.length+Math.min(o.offset,i.length))}catch(t){e.e(t)}finally{e.f()}for(u=0,s=this.lineSeparator?null:/\r\n?|\n/g;a=-1,f=1,h=void 0,this.lineSeparator?(a=i.indexOf(this.lineSeparator,u),f=this.lineSeparator.length):(h=s.exec(i))&&(a=h.index,f=h[0].length),this.append(i.slice(u,a<0?i.length:a)),!(a<0);){if(this.lineBreak(),1<f){c=F(this.points);try{for(c.s();!(l=c.n()).done;)(v=l.value).node==n&&v.pos>this.text.length&&(v.pos-=f-1)}catch(t){c.e(t)}finally{c.f()}}u=a+f}}},{key:"readNode",value:function t(n){var i,i,e;if(!n.cmIgnore)if(null!=(i=(i=c.get(n))&&i.overrideDOMText))for(this.findPointInside(n,i.length),e=i.iter();!e.next().done;)e.lineBreak?this.lineBreak():this.append(e.value);else 3==n.nodeType?this.readTextNode(n):"BR"==n.nodeName?n.nextSibling&&this.lineBreak():1==n.nodeType&&this.readRange(n.firstChild,null)}},{key:"findPointBefore",value:function t(n,i){var e,r,o,e=F(this.points);try{for(e.s();!(r=e.n()).done;)(o=r.value).node==n&&n.childNodes[o.offset]==i&&(o.pos=this.text.length)}catch(t){e.e(t)}finally{e.f()}}},{key:"findPointInside",value:function t(n,i){var e,r,o,e=F(this.points);try{for(e.s();!(r=e.n()).done;)o=r.value,(3==n.nodeType?o.node==n:n.contains(o.node))&&(o.pos=this.text.length+Math.min(i,o.offset))}catch(t){e.e(t)}finally{e.f()}}}]),i}(),ni=D(function t(n,i){A(this,t),this.node=n,this.offset=i,this.pos=-1}),ii=function(t){f(e,t);var i=S(e);function e(t){var n;return A(this,e),(n=i.call(this)).view=t,n.compositionDeco=m.none,n.decorations=[],n.dynamicDecorationMap=[],n.minWidth=0,n.minWidthFrom=0,n.minWidthTo=0,n.impreciseAnchor=null,n.impreciseHead=null,n.forceSelection=!1,n.lastUpdate=Date.now(),n.setDOM(t.contentDOM),n.children=[new vn],n.children[0].setParent(eh(n)),n.updateDeco(),n.updateInner([new Fn(0,0,0,t.state.doc.length)],0),n}return D(e,[{key:"length",get:function t(){return this.view.state.doc.length}},{key:"update",value:function t(n){var e,i,r,o,u,e=this,i=n.changedRanges;return 0<this.minWidth&&i.length&&(i.every(function(t){var n=t.fromA,i;return t.toA<e.minWidthFrom||n>e.minWidthTo})?(this.minWidthFrom=n.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=n.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.view.inputState.composing<0?this.compositionDeco=m.none:(n.transactions.length||this.dirty)&&(this.compositionDeco=Yc(this.view,n.changes)),(g.ie||g.chrome)&&!this.compositionDeco.size&&n&&n.state.doc.lines!=n.startState.doc.lines&&(this.forceSelection=!0),u=il(r=this.decorations,o=this.updateDeco(),n.changes),i=Fn.extendWithRanges(i,u),(0!=this.dirty||0!=i.length)&&(this.updateInner(i,n.startState.doc.length),n.transactions.length&&(this.lastUpdate=Date.now()),!0)}},{key:"updateInner",value:function t(n,i){var e,r,o,u,s,a,e=this;if(this.view.viewState.mustMeasureContent=!0,this.updateChildren(n,i),(r=this.view.observer).ignore(function(){e.dom.style.height=e.view.viewState.contentHeight+"px",e.dom.style.flexBasis=e.minWidth?e.minWidth+"px":"";var t=g.chrome||g.ios?{node:r.selectionRange.focusNode,written:!1}:void 0;e.sync(e.view,t),e.dirty=0,t&&(t.written||r.selectionRange.focusNode!=t.node)&&(e.forceSelection=!0),e.dom.style.height=""}),o=[],this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length){u=F(this.children);try{for(u.s();!(s=u.n()).done;)(a=s.value)instanceof dn&&a.widget instanceof ei&&o.push(a.dom)}catch(t){u.e(t)}finally{u.f()}}r.updateGaps(o)}},{key:"updateChildren",value:function t(n,i){for(var e,r,o,u,s,a,o,a,o,f,h,a,s,c,s,u,l,v,e=this.childCursor(i),r=n.length-1;o=0<=r?n[r]:null;r--)u=o.fromA,s=o.toA,a=o.fromB,o=o.toB,o=(a=yn.build(this.view.state.doc,a,o,this.decorations,this.dynamicDecorationMap)).content,f=a.breakAtStart,h=a.openStart,a=a.openEnd,c=(s=e.findPos(s,1)).i,s=s.off,Cc(this,l=(u=e.findPos(u,-1)).i,v=u.off,c,s,o,f,h,a)}},{key:"updateSelection",value:function t(){var e,n,i,r,n,o,n,u,s,a,f,h,e=this,n=0<arguments.length&&void 0!==arguments[0]&&arguments[0],i=1<arguments.length&&void 0!==arguments[1]&&arguments[1];!n&&this.view.observer.selectionRange.focusNode||this.view.observer.readSelectionRange(),n=(r=this.view.root.activeElement)==this.dom,o=!n&&ac(this.dom,this.view.observer.selectionRange)&&!(r&&this.dom.contains(r)),(n||i||o)&&(n=this.forceSelection,this.forceSelection=!1,u=this.view.state.selection.main,s=this.domAtPos(u.anchor),a=u.empty?s:this.domAtPos(u.head),g.gecko&&u.empty&&!this.compositionDeco.size&&Xc(s)&&(f=document.createTextNode(""),this.view.observer.ignore(function(){return s.node.insertBefore(f,s.node.childNodes[s.offset]||null)}),s=a=new Kt(f,0),n=!0),h=this.view.observer.selectionRange,!n&&h.focusNode&&hc(s.node,s.offset,h.anchorNode,h.anchorOffset)&&hc(a.node,a.offset,h.focusNode,h.focusOffset)||(this.view.observer.ignore(function(){var t,n,i,n,i;if(g.android&&g.chrome&&e.dom.contains(h.focusNode)&&el(h.focusNode,e.dom)&&(e.dom.blur(),e.dom.focus({preventScroll:!0})),t=oc(e.view.root))if(u.empty)g.gecko&&(n=nl(s.node,s.offset))&&3!=n&&(i=tl(s.node,s.offset,1==n?1:-1))&&(s=new Kt(i,1==n?0:i.nodeValue.length)),t.collapse(s.node,s.offset),null!=u.bidiLevel&&null!=h.cursorBidiLevel&&(h.cursorBidiLevel=u.bidiLevel);else if(t.extend){t.collapse(s.node,s.offset);try{t.extend(a.node,a.offset)}catch(t){}}else n=document.createRange(),u.anchor>u.head&&(s=(i=[a,s])[0],a=i[1]),n.setEnd(a.node,a.offset),n.setStart(s.node,s.offset),t.removeAllRanges(),t.addRange(n);o&&e.view.root.activeElement==e.dom&&(e.dom.blur(),r)&&r.focus()}),this.view.observer.setSelectionRange(s,a)),this.impreciseAnchor=s.precise?null:new Kt(h.anchorNode,h.anchorOffset),this.impreciseHead=a.precise?null:new Kt(h.focusNode,h.focusOffset))}},{key:"enforceCursorAssoc",value:function t(){var n,i,e,r,o,r,u,s,s,u,s,u;this.compositionDeco.size||(i=(n=this.view).state.selection.main,e=oc(n.root),o=(r=n.observer.selectionRange).anchorNode,r=r.anchorOffset,e&&i.empty&&i.assoc&&e.modify&&(u=vn.find(this,i.head))&&(s=u.posAtStart,i.head==s||i.head==s+u.length||(s=this.coordsAt(i.head,-1),u=this.coordsAt(i.head,1),!s)||!u||s.bottom>u.top||(s=this.domAtPos(i.head+i.assoc),e.collapse(s.node,s.offset),e.modify("move",i.assoc<0?"forward":"backward","lineboundary"),n.observer.readSelectionRange(),u=n.observer.selectionRange,n.docView.posFromDOM(u.anchorNode,u.anchorOffset)!=i.from&&e.collapse(o,r))))}},{key:"nearest",value:function t(n){for(var i,e,i=n;i;){if((e=c.get(i))&&e.rootView==this)return e;i=i.parentNode}return null}},{key:"posFromDOM",value:function t(n,i){var e=this.nearest(n);if(e)return e.localPosFromDOM(n,i)+e.posAtStart;throw new RangeError("Trying to find position for a DOM position outside of the document")}},{key:"domAtPos",value:function t(n){for(var n,i,e,r,n=this.childCursor().findPos(n,-1),i=n.i,e=n.off;i<this.children.length-1&&!(e<(r=this.children[i]).length||r instanceof vn);)i++,e=0;return this.children[i].domAtPos(e)}},{key:"coordsAt",value:function t(n,i){for(var e,r,o,u,e=this.length,r=this.children.length-1;;r--){if((u=e-(o=this.children[r]).breakAfter-o.length)<n||n==u&&o.type!=P.WidgetBefore&&o.type!=P.WidgetAfter&&(!r||2==i||this.children[r-1].breakAfter||this.children[r-1].type==P.WidgetBefore&&-2<i))return o.coordsAt(n-u,i);e=u}}},{key:"measureVisibleLineHeights",value:function t(n){for(var i,e,r,o,u,s,a,f,h,c,l,v,d,d,d,v,i=[],e=n.from,r=n.to,o=this.view.contentDOM.clientWidth,u=o>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,s=-1,a=this.view.textDirection==E.LTR,f=0,h=0;h<this.children.length&&!(r<(l=f+(c=this.children[h]).length));h++)e<=f&&(v=c.dom.getBoundingClientRect(),i.push(v.height),u)&&(d=(d=c.dom.lastChild)?fc(d):[]).length&&(d=d[d.length-1],s<(v=a?d.right-v.left:v.right-d.left))&&(s=v,this.minWidth=o,this.minWidthFrom=f,this.minWidthTo=l),f=l+c.breakAfter;return i}},{key:"textDirectionAt",value:function t(n){var i,n=this.childPos(n,1).i;return"rtl"==getComputedStyle(this.children[n].dom).direction?E.RTL:E.LTR}},{key:"measureTextSize",value:function t(){var n,i,e,r,o,u,s,a,f,n=this,i=F(this.children);try{for(i.s();!(e=i.n()).done;)if((r=e.value)instanceof vn&&(o=r.measureTextSize()))return o}catch(t){i.e(t)}finally{i.f()}return(u=document.createElement("div")).className="cm-line",u.style.width="99999px",u.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(function(){n.dom.appendChild(u);var t=fc(u.firstChild)[0];s=u.getBoundingClientRect().height,a=t?t.width/27:7,f=t?t.height:s,u.remove()}),{lineHeight:s,charWidth:a,textHeight:f}}},{key:"childCursor",value:function t(){var n,i,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this.length,i=this.children.length;return i&&(n-=this.children[--i].length),new Xt(this.children,n,i)}},{key:"computeBlockGapDeco",value:function t(){for(var n,i,e,r,o,u,s,n=[],i=this.view.viewState,e=0,r=0;e<(u=(o=r==i.viewports.length?null:i.viewports[r])?o.from-1:this.length)&&(s=i.lineBlockAt(u).bottom-i.lineBlockAt(e).top,n.push(m.replace({widget:new ei(s),block:!0,inclusive:!0,isBlockGap:!0}).range(e,u))),o;r++)e=o.to+1;return m.set(n)}},{key:"updateDeco",value:function t(){for(var e,n,i,e=this,n=this.view.state.facet(Tn).map(function(t,n){var i;return(e.dynamicDecorationMap[n]="function"==typeof t)?t(e.view):t}),i=n.length;i<n.length+3;i++)this.dynamicDecorationMap[i]=!1;return this.decorations=[].concat(Wf(n),[this.compositionDeco,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco])}},{key:"scrollIntoView",value:function t(n){var i,e,r,r,e,i=n.range,e=this.coordsAt(i.head,i.empty?i.assoc:i.head>i.anchor?-1:1);e&&(!i.empty&&(r=this.coordsAt(i.anchor,i.anchor>i.head?-1:1))&&(e={left:Math.min(e.left,r.left),top:Math.min(e.top,r.top),right:Math.max(e.right,r.right),bottom:Math.max(e.bottom,r.bottom)}),r=Vc(this.view),e={left:e.left-r.left,top:e.top-r.top,right:e.right+r.right,bottom:e.bottom+r.bottom},mc(this.view.scrollDOM,e,i.head<i.anchor?-1:1,n.x,n.y,n.xMargin,n.yMargin,this.view.textDirection==E.LTR))}}]),e}(c),ei=function(t){f(e,t);var i=S(e);function e(t){var n;return A(this,e),(n=i.call(this)).height=t,n}return D(e,[{key:"toDOM",value:function t(){var n=document.createElement("div");return this.updateDOM(n),n}},{key:"eq",value:function t(n){return n.height==this.height}},{key:"updateDOM",value:function t(n){return n.style.height=this.height+"px",!0}},{key:"estimatedHeight",get:function t(){return this.height}}]),e}(tn),ri=function(t){f(o,t);var r=S(o);function o(t,n,i){var e;return A(this,o),(e=r.call(this)).top=t,e.text=n,e.topView=i,e}return D(o,[{key:"eq",value:function t(n){return this.top==n.top&&this.text==n.text}},{key:"toDOM",value:function t(){return this.top}},{key:"ignoreEvent",value:function t(){return!1}},{key:"customView",get:function t(){return an}}]),o}(tn),oi=function(){function t(){A(this,t),this.changes=[]}return D(t,[{key:"compareRange",value:function t(n,i){Hc(n,i,this.changes)}},{key:"comparePoint",value:function t(n,i){Hc(n,i,this.changes)}}]),t}(),ui=function(){function n(e){var r,i,t,o,r=this;for(o in A(this,n),this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.chromeScrollHack=-1,this.pendingIOSKey=void 0,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastEscPress=0,this.lastContextMenu=0,this.scrollHandlers=[],this.registeredEvents=[],this.customHandlers=[],this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null,i=function t(n,i){r.ignoreDuringComposition(i)||"keydown"==i.type&&r.keydown(e,i)||(r.mustFlushObserver(i)&&e.observer.forceFlush(),r.runCustomHandlers(i.type,e,i)?i.preventDefault():n(e,i))},t=function t(){var n=s[o];e.contentDOM.addEventListener(o,function(t){jl(e,t)&&i(n,t)},li[o]),r.registeredEvents.push(o)},s)t();e.scrollDOM.addEventListener("mousedown",function(t){var n;t.target==e.scrollDOM&&t.clientY>e.contentDOM.getBoundingClientRect().bottom&&(i(s.mousedown,t),t.defaultPrevented||2!=t.button||(n=e.contentDOM.style.minHeight,e.contentDOM.style.minHeight="100%",setTimeout(function(){return e.contentDOM.style.minHeight=n},200)))}),e.scrollDOM.addEventListener("drop",function(t){t.target==e.scrollDOM&&t.clientY>e.contentDOM.getBoundingClientRect().bottom&&i(s.drop,t)}),g.chrome&&102==g.chrome_version&&e.scrollDOM.addEventListener("wheel",function(){r.chromeScrollHack<0?e.contentDOM.style.pointerEvents="none":window.clearTimeout(r.chromeScrollHack),r.chromeScrollHack=setTimeout(function(){r.chromeScrollHack=-1,e.contentDOM.style.pointerEvents=""},100)},{passive:!0}),this.notifiedFocused=e.hasFocus,g.safari&&e.contentDOM.addEventListener("input",function(){return null})}return D(n,[{key:"setSelectionOrigin",value:function t(n){this.lastSelectionOrigin=n,this.lastSelectionTime=Date.now()}},{key:"ensureHandlers",value:function t(i,n){var e,r,o,u,s,a,f,h,e=this;this.customHandlers=[],u=F(n);try{for(u.s();!(s=u.n()).done;)if(o=null==(r=(a=s.value).update(i).spec)?void 0:r.domEventHandlers)for(h in this.customHandlers.push({plugin:a.value,handlers:o}),f=function t(n){e.registeredEvents.indexOf(n)<0&&"scroll"!=n&&(e.registeredEvents.push(n),i.contentDOM.addEventListener(n,function(t){jl(i,t)&&e.runCustomHandlers(n,i,t)&&t.preventDefault()}))},o)f(h)}catch(t){u.e(t)}finally{u.f()}}},{key:"runCustomHandlers",value:function t(n,i,e){var r,o,u,s,r=F(this.customHandlers);try{for(r.s();!(o=r.n()).done;)if(s=(u=o.value).handlers[n])try{if(s.call(u.plugin,e,i)||e.defaultPrevented)return!0}catch(t){Wc(i.state,t)}}catch(t){r.e(t)}finally{r.f()}return!1}},{key:"runScrollHandlers",value:function t(n,i){var e,r,o,u;this.lastScrollTop=n.scrollDOM.scrollTop,this.lastScrollLeft=n.scrollDOM.scrollLeft,e=F(this.customHandlers);try{for(e.s();!(r=e.n()).done;)if(u=(o=r.value).handlers.scroll)try{u.call(o.plugin,i,n)}catch(t){Wc(n.state,t)}}catch(t){e.e(t)}finally{e.f()}}},{key:"keydown",value:function t(n,i){var e,r,e=this;return this.lastKeyCode=i.keyCode,this.lastKeyTime=Date.now(),9==i.keyCode&&Date.now()<this.lastEscPress+2e3||(27!=i.keyCode&&fi.indexOf(i.keyCode)<0&&(n.inputState.lastEscPress=0),!g.android||!g.chrome||i.synthetic||13!=i.keyCode&&8!=i.keyCode?!(!g.ios||i.synthetic||i.altKey||i.metaKey||!((r=si.find(function(t){return t.keyCode==i.keyCode}))&&!i.ctrlKey||-1<ai.indexOf(i.key)&&i.ctrlKey&&!i.shiftKey)||(this.pendingIOSKey=r||i,setTimeout(function(){return e.flushIOSKey(n)},250),0)):(n.observer.delayAndroidKey(i.key,i.keyCode),!0))}},{key:"flushIOSKey",value:function t(n){var i=this.pendingIOSKey;return!!i&&(this.pendingIOSKey=void 0,wc(n.contentDOM,i.key,i.keyCode))}},{key:"ignoreDuringComposition",value:function t(n){return!!/^key/.test(n.type)&&(0<this.composing||!!(g.safari&&!g.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100)&&!(this.compositionPendingKey=!1))}},{key:"mustFlushObserver",value:function t(n){return"keydown"==n.type&&229!=n.keyCode}},{key:"startMouseSelection",value:function t(n){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=n}},{key:"update",value:function t(n){this.mouseSelection&&this.mouseSelection.update(n),n.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}},{key:"destroy",value:function t(){this.mouseSelection&&this.mouseSelection.destroy()}}]),n}(),si=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],ai="dthko",fi=[16,17,18,20,91,92,224,225],hi=6,ci=function(){function r(n,t,i,e){A(this,r),this.view=n,this.style=i,this.mustSelect=e,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParent=pc(n.contentDOM),this.atoms=n.state.facet(Ln).map(function(t){return t(n)});var i=n.contentDOM.ownerDocument;i.addEventListener("mousemove",this.move=this.move.bind(this)),i.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=n.state.facet(C.allowMultipleSelections)&&xl(n,t),this.dragMove=Sl(n,t),this.dragging=!(!Cl(n,t)||1!=Rl(t))&&null}return D(r,[{key:"start",value:function t(n){!1===this.dragging&&(n.preventDefault(),this.select(n))}},{key:"move",value:function t(n){var i,e,r,i,o;if(0==n.buttons)return this.destroy();!1===this.dragging&&(this.select(this.lastEvent=n),r=e=0,i=(null==(i=this.scrollParent)?void 0:i.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight},o=Vc(this.view),n.clientX-o.left<=i.left+6?e=-Ml(i.left-n.clientX):n.clientX+o.right>=i.right-6&&(e=Ml(n.clientX-i.right)),n.clientY-o.top<=i.top+6?r=-Ml(i.top-n.clientY):n.clientY+o.bottom>=i.bottom-6&&(r=Ml(n.clientY-i.bottom)),this.setScrollSpeed(e,r))}},{key:"up",value:function t(n){null==this.dragging&&this.select(this.lastEvent),this.dragging||n.preventDefault(),this.destroy()}},{key:"destroy",value:function t(){this.setScrollSpeed(0,0);var n=this.view.contentDOM.ownerDocument;n.removeEventListener("mousemove",this.move),n.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=null}},{key:"setScrollSpeed",value:function t(n,i){var e=this;this.scrollSpeed={x:n,y:i},n||i?this.scrolling<0&&(this.scrolling=setInterval(function(){return e.scroll()},50)):-1<this.scrolling&&(clearInterval(this.scrolling),this.scrolling=-1)}},{key:"scroll",value:function t(){this.scrollParent?(this.scrollParent.scrollLeft+=this.scrollSpeed.x,this.scrollParent.scrollTop+=this.scrollSpeed.y):this.view.win.scrollBy(this.scrollSpeed.x,this.scrollSpeed.y),!1===this.dragging&&this.select(this.lastEvent)}},{key:"skipAtoms",value:function t(n){for(var i,e,r,o,u,u,s,i=null,e=0;e<n.ranges.length;e++)o=null,(r=n.ranges[e]).empty?(u=wl(this.atoms,r.from,0))!=r.from&&(o=O.cursor(u,-1)):(u=wl(this.atoms,r.from,-1),s=wl(this.atoms,r.to,1),u==r.from&&s==r.to||(o=O.range(r.from==r.anchor?u:s,r.from==r.head?u:s))),o&&((i=i||n.ranges.slice())[e]=o);return i?O.create(i,n.mainIndex):n}},{key:"select",value:function t(n){var i=this.view,n=this.skipAtoms(this.style.get(n,this.extend,this.multiple));!this.mustSelect&&n.eq(i.state.selection)&&n.main.assoc==i.state.selection.main.assoc||this.view.dispatch({selection:n,userEvent:"select.pointer"}),this.mustSelect=!1}},{key:"update",value:function t(n){var i=this;n.docChanged&&this.dragging&&(this.dragging=this.dragging.map(n.changes)),this.style.update(n)&&setTimeout(function(){return i.select(i.lastEvent)},20)}}]),r}(),s=Object.create(null),li=Object.create(null),vi=g.ie&&g.ie_version<15||g.ios&&g.webkit_version<604,s.keydown=function(t,n){t.inputState.setSelectionOrigin("select"),27==n.keyCode&&(t.inputState.lastEscPress=Date.now())},s.touchstart=function(t,n){t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")},s.touchmove=function(t){t.inputState.setSelectionOrigin("select.pointer")},li.touchstart=li.touchmove={passive:!0},s.mousedown=function(t,n){var i,e,r,o,u;if(t.observer.flush(),!(t.inputState.lastTouchTime>Date.now()-2e3)){i=null,e=F(t.state.facet(gn));try{for(e.s();!(r=e.n()).done&&!(i=(o=r.value)(t,n)););}catch(t){e.e(t)}finally{e.f()}(i=i||0!=n.button?i:Il(t,n))&&(u=t.root.activeElement!=t.contentDOM,t.inputState.startMouseSelection(new ci(t,n,i,u)),u&&t.observer.ignore(function(){return kc(t.contentDOM)}),t.inputState.mouseSelection)&&t.inputState.mouseSelection.start(n)}},di=function t(n,i){return n>=i.top&&n<=i.bottom},yi=function t(n,i,e){return di(i,e)&&n>=e.left&&n<=e.right},mi=g.ie&&g.ie_version<=11,pi=null,gi=ki=0,s.dragstart=function(t,n){var i,e,i=t.state.selection.main,e=t.inputState.mouseSelection;e&&(e.dragging=i),n.dataTransfer&&(n.dataTransfer.setData("Text",t.state.sliceDoc(i.from,i.to)),n.dataTransfer.effectAllowed="copyMove")},s.drop=function(n,i){var e,r,o,u,t,s;if(i.dataTransfer){if(n.state.readOnly)return i.preventDefault();if((e=i.dataTransfer.files)&&e.length)for(i.preventDefault(),r=Array(e.length),u=function t(){++o==e.length&&Ll(n,i,r.filter(function(t){return null!=t}).join(n.state.lineBreak),!1)},t=function t(n){var i=new FileReader;i.onerror=u,i.onload=function(){/[\x00-\x08\x0e-\x1f]{2}/.test(i.result)||(r[n]=i.result),u()},i.readAsText(e[n])},s=o=0;s<e.length;s++)t(s);else Ll(n,i,i.dataTransfer.getData("Text"),!0)}},s.paste=function(t,n){if(t.state.readOnly)return n.preventDefault();t.observer.flush();var i=vi?null:n.clipboardData;i?(Ol(t,i.getData("text/plain")||i.getData("text/uri-text")),n.preventDefault()):Pl(t)},wi=null,s.copy=s.cut=function(t,n){var i,e,r,i,i,i=_l(t.state),e=i.text,r=i.ranges,i=i.linewise;(e||i)&&(wi=i?e:null,(i=vi?null:n.clipboardData)?(n.preventDefault(),i.clearData(),i.setData("text/plain",e)):Bl(t,e),"cut"!=n.type||t.state.readOnly||t.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"}))},bi=gt.define(),s.focus=function(t){t.inputState.lastFocusTime=Date.now(),t.scrollDOM.scrollTop||!t.inputState.lastScrollTop&&!t.inputState.lastScrollLeft||(t.scrollDOM.scrollTop=t.inputState.lastScrollTop,t.scrollDOM.scrollLeft=t.inputState.lastScrollLeft),Nl(t)},s.blur=function(t){t.observer.clearSelectionRange(),Nl(t)},s.compositionstart=s.compositionupdate=function(t){null==t.inputState.compositionFirstChange&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0)},s.compositionend=function(t){t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionPendingKey=!0,t.inputState.compositionPendingChange=0<t.observer.pendingRecords().length,t.inputState.compositionFirstChange=null,g.chrome&&g.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(function(){return t.observer.flush()}):setTimeout(function(){t.inputState.composing<0&&t.docView.compositionDeco.size&&t.update([])},50)},s.contextmenu=function(t){t.inputState.lastContextMenu=Date.now()},s.beforeinput=function(n,i){var t,t,e;g.chrome&&g.android&&(t=si.find(function(t){return t.inputType==i.inputType}))&&(n.observer.delayAndroidKey(t.key,t.keyCode),"Backspace"!=t.key&&"Delete"!=t.key||(e=(null==(t=window.visualViewport)?void 0:t.height)||0,setTimeout(function(){var t;((null==(t=window.visualViewport)?void 0:t.height)||0)>e+10&&n.hasFocus&&(n.contentDOM.blur(),n.focus())},100)))},Mi=["pre-wrap","normal","pre-line","break-spaces"],xi=function(){function n(t){A(this,n),this.lineWrapping=t,this.doc=k.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30,this.heightChanged=!1}return D(n,[{key:"heightForGap",value:function t(n,i){var e=this.doc.lineAt(i).number-this.doc.lineAt(n).number+1;return this.lineWrapping&&(e+=Math.max(0,Math.ceil((i-n-e*this.lineLength*.5)/this.lineLength))),this.lineHeight*e}},{key:"heightForLine",value:function t(n){var i;return this.lineWrapping?(1+Math.max(0,Math.ceil((n-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}},{key:"setDoc",value:function t(n){return this.doc=n,this}},{key:"mustRefreshForWrapping",value:function t(n){return-1<Mi.indexOf(n)!=this.lineWrapping}},{key:"mustRefreshForHeights",value:function t(n){for(var i,e,r,i=!1,e=0;e<n.length;e++)(r=n[e])<0?e++:this.heightSamples[Math.floor(10*r)]||(i=!0,this.heightSamples[Math.floor(10*r)]=!0);return i}},{key:"refresh",value:function t(n,i,e,r,o,u){var n,s,a,f,n=-1<Mi.indexOf(n),s=Math.round(i)!=Math.round(this.lineHeight)||this.lineWrapping!=n;if(this.lineWrapping=n,this.lineHeight=i,this.charWidth=e,this.textHeight=r,this.lineLength=o,s)for(this.heightSamples={},a=0;a<u.length;a++)(f=u[a])<0?a++:this.heightSamples[Math.floor(10*f)]=!0;return s}}]),n}(),Si=function(){function i(t,n){A(this,i),this.from=t,this.heights=n,this.index=0}return D(i,[{key:"more",get:function t(){return this.index<this.heights.length}}]),i}(),Ci=function(){function u(t,n,i,e,r,o){A(this,u),this.from=t,this.length=n,this.top=i,this.height=e,this.children=r,this.deco=o}return D(u,[{key:"type",get:function t(){var n,n,n;return null!=(n=null!=(n=this.children)?n:null==(n=this.deco)?void 0:n.type)?n:P.Text}},{key:"widget",get:function t(){return this.deco&&this.deco.widget}},{key:"to",get:function t(){return this.from+this.length}},{key:"bottom",get:function t(){return this.top+this.height}},{key:"join",value:function t(n){var i=(this.children||[this]).concat(n.children||[n]);return new u(this.from,this.length+n.length,this.top,this.height+n.height,i,null)}}]),u}(),p=function(t){return t[t.ByPos=0]="ByPos",t[t.ByHeight=1]="ByHeight",t[t.ByPosNoHeight=2]="ByPosNoHeight",t}(p=p||{}),ji=.001,(Pi=function(){function f(t,n){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:2;A(this,f),this.length=t,this.height=n,this.flags=i}return D(f,[{key:"outdated",get:function t(){return 0<(2&this.flags)},set:function t(n){this.flags=(n?2:0)|-3&this.flags}},{key:"setHeight",value:function t(n,i){this.height!=i&&(Math.abs(this.height-i)>ji&&(n.heightChanged=!0),this.height=i)}},{key:"replace",value:function t(n,i,e){return f.of(e)}},{key:"decomposeLeft",value:function t(n,i){i.push(this)}},{key:"decomposeRight",value:function t(n,i){i.push(this)}},{key:"applyChanges",value:function t(n,i,e,r){for(var o,u,s,a,f,h,c,a,l,v,v,o=this,u=e.doc,s=r.length-1;0<=s;s--){for(f=(a=r[s]).fromA,h=a.toA,c=a.fromB,a=a.toB,a+=(v=(l=o.lineAt(f,p.ByPosNoHeight,e.setDoc(i),0,0)).to>=h?l:o.lineAt(h,p.ByPosNoHeight,e,0,0)).to-h,h=v.to;0<s&&l.from<=r[s-1].toA;)f=r[s-1].fromA,c=r[s-1].fromB,s--,f<l.from&&(l=o.lineAt(f,p.ByPosNoHeight,e,0,0));c+=l.from-f,f=l.from,v=Ii.build(e.setDoc(u),n,c,a),o=o.replace(f,h,v)}return o.updateHeight(e,0)}}],[{key:"empty",value:function t(){return new Ei(0,0)}},{key:"of",value:function t(n){var i,e,r,o,u,u,s,s,a;if(1==n.length)return n[0];for(e=n.length,o=r=i=0;;)if(i==e)if(2*o<r)(u=n[i-1]).break?n.splice(--i,1,u.left,null,u.right):n.splice(--i,1,u.left,u.right),e+=1+u.break,r-=u.size;else{if(!(2*r<o))break;(u=n[e]).break?n.splice(e,1,u.left,null,u.right):n.splice(e,1,u.left,u.right),e+=2+u.break,o-=u.size}else r<o?(s=n[i++])&&(r+=s.size):(s=n[--e])&&(o+=s.size);return a=0,null==n[i-1]?(a=1,i--):null==n[i]&&(a=1,e++),new Di(f.of(n.slice(0,i)),a,f.of(n.slice(e)))}}]),f}()).prototype.size=1,Ei=function(t){f(o,t);var i=S(o);function o(t,n){var t;return A(this,o),(t=i.call(this,t,n,null)).collapsed=0,t.widgetHeight=0,t}return D(o,[{key:"replace",value:function t(n,i,e){var r=e[0];return 1==e.length&&(r instanceof o||r instanceof Ai&&4&r.flags)&&Math.abs(this.length-r.length)<10?(r instanceof Ai?r=new o(r.length,this.height):r.height=this.height,this.outdated||(r.outdated=!1),r):Pi.of(e)}},{key:"updateHeight",value:function t(n){var i,e,r,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,e=2<arguments.length&&void 0!==arguments[2]&&arguments[2],r=3<arguments.length?arguments[3]:void 0;return r&&r.from<=i&&r.more?this.setHeight(n,r.heights[r.index++]):(e||this.outdated)&&this.setHeight(n,Math.max(this.widgetHeight,n.heightForLine(this.length-this.collapsed))),this.outdated=!1,this}},{key:"toString",value:function t(){return"line(".concat(this.length).concat(this.collapsed?-this.collapsed:"").concat(this.widgetHeight?":"+this.widgetHeight:"",")")}}]),o}(Oi=function(t){f(r,t);var e=S(r);function r(t,n,i){var t;return A(this,r),(t=e.call(this,t,n)).deco=i,t}return D(r,[{key:"blockAt",value:function t(n,i,e,r){return new Ci(r,this.length,e,this.height,null,this.deco)}},{key:"lineAt",value:function t(n,i,e,r,o){return this.blockAt(0,e,r,o)}},{key:"forEachLine",value:function t(n,i,e,r,o,u){n<=o+this.length&&o<=i&&u(this.blockAt(0,e,r,o))}},{key:"updateHeight",value:function t(n){var i,e,r,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,e=2<arguments.length&&void 0!==arguments[2]&&arguments[2],r=3<arguments.length?arguments[3]:void 0;return r&&r.from<=i&&r.more&&this.setHeight(n,r.heights[r.index++]),this.outdated=!1,this}},{key:"toString",value:function t(){return"block(".concat(this.length,")")}}]),r}(Pi)),Ai=function(t){f(l,t);var n=S(l);function l(t){return A(this,l),n.call(this,t,0)}return D(l,[{key:"heightMetrics",value:function t(n,i){var e,i,r,o,u,n,e=n.doc.lineAt(i).number,i=n.doc.lineAt(i+this.length).number,r=i-e+1,u=0;return n.lineWrapping?(o=(n=Math.min(this.height,n.lineHeight*r))/r,this.length>1+r&&(u=(this.height-n)/(this.length-r-1))):o=this.height/r,{firstLine:e,lastLine:i,perLine:o,perChar:u}}},{key:"blockAt",value:function t(n,i,e,r){var o,u,s,a,o,r,r,o,f,r,f,o,s,o=this.heightMetrics(i,r),u=o.firstLine,s=o.lastLine,a=o.perLine,o=o.perChar;return i.lineWrapping?(r=r+Math.round(Math.max(0,Math.min(1,(n-e)/this.height))*this.length),o=a+(r=i.doc.lineAt(r)).length*o,f=Math.max(e,n-o/2),new Ci(r.from,r.length,f,o,null,null)):(r=Math.max(0,Math.min(s-u,Math.floor((n-e)/a))),o=(f=i.doc.line(u+r)).from,s=f.length,new Ci(o,s,e+a*r,a,null,null))}},{key:"lineAt",value:function t(n,i,e,r,o){var i,u,i,i,u,s,i,e,n,s,u;return i==p.ByHeight?this.blockAt(n,e,r,o):i==p.ByPosNoHeight?(u=(i=e.doc.lineAt(n)).from,i=i.to,new Ci(u,i-u,0,0,null,null)):(u=(i=this.heightMetrics(e,o)).firstLine,s=i.perLine,i=i.perChar,n=s+(e=e.doc.lineAt(n)).length*i,u=r+s*(s=e.number-u)+i*(e.from-o-s),new Ci(e.from,e.length,Math.max(r,Math.min(u,r+this.height-n)),n,null,null))}},{key:"forEachLine",value:function t(n,i,e,r,o,u){var s,a,f,h,c,l,v,d,d;for(n=Math.max(n,o),i=Math.min(i,o+this.length),a=(s=this.heightMetrics(e,o)).firstLine,f=s.perLine,h=s.perChar,c=n,l=r;c<=i;)v=e.doc.lineAt(c),c==n&&(l+=f*(d=v.number-a)+h*(n-o-d)),d=f+h*v.length,u(new Ci(v.from,v.length,l,d,null,null)),l+=d,c=v.to+1}},{key:"replace",value:function t(n,i,e){var i,r,r,i=this.length-i;return 0<i&&((r=e[e.length-1])instanceof l?e[e.length-1]=new l(r.length+i):e.push(null,new l(i-1))),0<n&&((r=e[0])instanceof l?e[0]=new l(n+r.length):e.unshift(new l(n-1),null)),Pi.of(e)}},{key:"decomposeLeft",value:function t(n,i){i.push(new l(n-1),null)}},{key:"decomposeRight",value:function t(n,i){i.push(null,new l(this.length-n-1))}},{key:"updateHeight",value:function t(n){var i,e,r,o,u,s,a,f,h,h,c,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,e=2<arguments.length&&void 0!==arguments[2]&&arguments[2],r=3<arguments.length?arguments[3]:void 0,o=i+this.length;if(r&&r.from<=i+this.length&&r.more){for(u=[],s=Math.max(i,r.from),a=-1,r.from>i&&u.push(new l(r.from-i-1).updateHeight(n,i));s<=o&&r.more;)f=n.doc.lineAt(s).length,u.length&&u.push(null),h=r.heights[r.index++],-1==a?a=h:Math.abs(h-a)>=ji&&(a=-2),(h=new Ei(f,h)).outdated=!1,u.push(h),s+=f+1;return s<=o&&u.push(null,new l(o-s).updateHeight(n,s)),c=Pi.of(u),(a<0||Math.abs(c.height-this.height)>=ji||Math.abs(a-this.heightMetrics(n,i).perLine)>=ji)&&(n.heightChanged=!0),c}return(e||this.outdated)&&(this.setHeight(n,n.heightForGap(i,i+this.length)),this.outdated=!1),this}},{key:"toString",value:function t(){return"gap(".concat(this.length,")")}}]),l}(Pi),Di=function(t){f(r,t);var e=S(r);function r(t,n,i){var n;return A(this,r),(n=e.call(this,t.length+n+i.length,t.height+i.height,n|(t.outdated||i.outdated?2:0))).left=t,n.right=i,n.size=t.size+i.size,n}return D(r,[{key:"break",get:function t(){return 1&this.flags}},{key:"blockAt",value:function t(n,i,e,r){var o=e+this.left.height;return n<o?this.left.blockAt(n,i,e,r):this.right.blockAt(n,i,o,r+this.left.length+this.break)}},{key:"lineAt",value:function t(n,i,e,r,o){var u,s,a,n,i,u=r+this.left.height,s=o+this.left.length+this.break,a=i==p.ByHeight?n<u:n<s,n=a?this.left.lineAt(n,i,e,r,o):this.right.lineAt(n,i,e,u,s);return this.break||(a?n.to<s:n.from>s)?n:(i=i==p.ByPosNoHeight?p.ByPosNoHeight:p.ByPos,a?n.join(this.right.lineAt(s,i,e,u,s)):this.left.lineAt(s,i,e,r,o).join(n))}},{key:"forEachLine",value:function t(n,i,e,r,o,u){var s,a,f,s=r+this.left.height,a=o+this.left.length+this.break;this.break?(n<a&&this.left.forEachLine(n,i,e,r,o,u),a<=i&&this.right.forEachLine(n,i,e,s,a,u)):(n<(f=this.lineAt(a,p.ByPos,e,r,o)).from&&this.left.forEachLine(n,f.from-1,e,r,o,u),f.to>=n&&f.from<=i&&u(f),i>f.to&&this.right.forEachLine(f.to+1,i,e,s,a,u))}},{key:"replace",value:function t(n,i,e){var r,o,r,u,s,a,e,r=this.left.length+this.break;if(i<r)return this.balanced(this.left.replace(n,i,e),this.right);if(n>this.left.length)return this.balanced(this.left,this.right.replace(n-r,i-r,e));o=[],0<n&&this.decomposeLeft(n,o),r=o.length,u=F(e);try{for(u.s();!(s=u.n()).done;)a=s.value,o.push(a)}catch(t){u.e(t)}finally{u.f()}return 0<n&&Ul(o,r-1),i<this.length&&(e=o.length,this.decomposeRight(i,o),Ul(o,e)),Pi.of(o)}},{key:"decomposeLeft",value:function t(n,i){var e=this.left.length;if(n<=e)return this.left.decomposeLeft(n,i);i.push(this.left),this.break&&++e<=n&&i.push(null),e<n&&this.right.decomposeLeft(n-e,i)}},{key:"decomposeRight",value:function t(n,i){var e=this.left.length,r=e+this.break;if(r<=n)return this.right.decomposeRight(n-r,i);n<e&&this.left.decomposeRight(n,i),this.break&&n<r&&i.push(null),i.push(this.right)}},{key:"balanced",value:function t(n,i){return n.size>2*i.size||i.size>2*n.size?Pi.of(this.break?[n,null,i]:[n,i]):(this.left=n,this.right=i,this.height=n.height+i.height,this.outdated=n.outdated||i.outdated,this.size=n.size+i.size,this.length=n.length+this.break+i.length,this)}},{key:"updateHeight",value:function t(n){var i,e,r,o,u,s,a,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,e=2<arguments.length&&void 0!==arguments[2]&&arguments[2],r=3<arguments.length?arguments[3]:void 0,o=this.left,u=this.right,s=i+o.length+this.break,a=null;return r&&r.from<=i+o.length&&r.more?a=o=o.updateHeight(n,i,e,r):o.updateHeight(n,i,e),r&&r.from<=s+u.length&&r.more?a=u=u.updateHeight(n,s,e,r):u.updateHeight(n,s,e),a?this.balanced(o,u):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}},{key:"toString",value:function t(){return this.left+(this.break?" ":"-")+this.right}}]),r}(Pi),Ri=5,Ii=function(){function o(t,n){A(this,o),this.pos=t,this.oracle=n,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=t}return D(o,[{key:"isCovered",get:function t(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}},{key:"span",value:function t(n,i){var e,r;-1<this.lineStart&&(e=Math.min(i,this.lineEnd),(r=this.nodes[this.nodes.length-1])instanceof Ei?r.length+=e-this.pos:(e>this.pos||!this.isCovered)&&this.nodes.push(new Ei(e-this.pos,-1)),(this.writtenTo=e)<i)&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1),this.pos=i}},{key:"point",value:function t(n,i,e){var r,o;n<i||e.heightRelevant?((r=e.widget?e.widget.estimatedHeight:0)<0&&(r=this.oracle.lineHeight),o=i-n,e.block?this.addBlock(new Oi(o,r,e)):(o||5<=r)&&this.addLineDeco(r,o)):n<i&&this.span(n,i),-1<this.lineEnd&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}},{key:"enterLine",value:function t(){var n,i,n;-1<this.lineStart||(i=(n=this.oracle.doc.lineAt(this.pos)).from,n=n.to,this.lineStart=i,this.lineEnd=n,this.writtenTo<i&&((this.writtenTo<i-1||null==this.nodes[this.nodes.length-1])&&this.nodes.push(this.blankContent(this.writtenTo,i-1)),this.nodes.push(null)),this.pos>i&&this.nodes.push(new Ei(this.pos-i,-1)),this.writtenTo=this.pos)}},{key:"blankContent",value:function t(n,i){var e=new Ai(i-n);return this.oracle.doc.lineAt(n).to==i&&(e.flags|=4),e}},{key:"ensureLine",value:function t(){var n,n;return this.enterLine(),(n=this.nodes.length?this.nodes[this.nodes.length-1]:null)instanceof Ei||(n=new Ei(0,-1),this.nodes.push(n)),n}},{key:"addBlock",value:function t(n){var i,i;this.enterLine(),(i=null==(i=n.deco)?void 0:i.type)!=P.WidgetAfter||this.isCovered||this.ensureLine(),this.nodes.push(n),this.writtenTo=this.pos=this.pos+n.length,i!=P.WidgetBefore&&(this.covering=n)}},{key:"addLineDeco",value:function t(n,i){var e=this.ensureLine();e.length+=i,e.collapsed+=i,e.widgetHeight=Math.max(e.widgetHeight,n),this.writtenTo=this.pos=this.pos+i}},{key:"finish",value:function t(n){var i,e,r,o,u,i=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(-1<this.lineStart)||i instanceof Ei||this.isCovered?(this.writtenTo<this.pos||null==i)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos)):this.nodes.push(new Ei(0,-1)),e=n,r=F(this.nodes);try{for(r.s();!(o=r.n()).done;)(u=o.value)instanceof Ei&&u.updateHeight(this.oracle,e),e+=u?u.length:1}catch(t){r.e(t)}finally{r.f()}return this.nodes}}],[{key:"build",value:function t(n,i,e,r){var n=new o(e,n);return j.spans(i,e,r,n,0),n.finish(e)}}]),o}(),Ti=function(){function t(){A(this,t),this.changes=[]}return D(t,[{key:"compareRange",value:function t(){}},{key:"comparePoint",value:function t(n,i,e,r){(n<i||e&&e.heightRelevant||r&&r.heightRelevant)&&Hc(n,i,this.changes,5)}}]),t}(),Li=function(){function e(t,n,i){A(this,e),this.from=t,this.to=n,this.size=i}return D(e,[{key:"draw",value:function t(n){return m.replace({widget:new Bi(this.size,n)}).range(this.from,this.to)}}],[{key:"same",value:function t(n,i){var e,r,o;if(n.length!=i.length)return!1;for(e=0;e<n.length;e++)if(r=n[e],o=i[e],r.from!=o.from||r.to!=o.to||r.size!=o.size)return!1;return!0}}]),e}(),Bi=function(t){f(r,t);var e=S(r);function r(t,n){var i;return A(this,r),(i=e.call(this)).size=t,i.vertical=n,i}return D(r,[{key:"eq",value:function t(n){return n.size==this.size&&n.vertical==this.vertical}},{key:"toDOM",value:function t(){var n=document.createElement("div");return this.vertical?n.style.height=this.size+"px":(n.style.width=this.size+"px",n.style.height="2px",n.style.display="inline-block"),n}},{key:"estimatedHeight",get:function t(){return this.vertical?this.size:-1}}]),r}(tn),_i=function(){function i(t){A(this,i),this.state=t,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scaler=Ni,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=E.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;var n=t.facet(In).some(function(t){return"function"!=typeof t&&"cm-lineWrapping"==t.class});this.heightOracle=new xi(n),this.stateDeco=t.facet(Tn).filter(function(t){return"function"!=typeof t}),this.heightMap=Pi.empty().applyChanges(this.stateDeco,k.empty,this.heightOracle.setDoc(t.doc),[new Fn(0,0,0,t.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=m.set(this.lineGaps.map(function(t){return t.draw(!1)})),this.computeVisibleRanges()}return D(i,[{key:"updateForViewport",value:function t(){for(var r,o,u,n,s,r=this,o=[this.viewport],u=this.state.selection.main,n=function t(){var i,n,e,n,i=s?u.head:u.anchor;o.some(function(t){var n=t.from,t=t.to;return n<=i&&i<=t})||(e=(n=r.lineBlockAt(i)).from,n=n.to,o.push(new Fi(e,n)))},s=0;s<=1;s++)n();this.viewports=o.sort(function(t,n){return t.from-n.from}),this.scaler=this.heightMap.height<=7e6?Ni:new Ui(this.heightOracle,this.heightMap,this.viewports)}},{key:"updateViewportLines",value:function t(){var n=this;this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,function(t){n.viewportLines.push(1==n.scaler.scale?t:Jl(t,n.scaler))})}},{key:"update",value:function t(n){var i,e,r,r,e,e,r,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;this.state=n.state,e=this.stateDeco,this.stateDeco=this.state.facet(Tn).filter(function(t){return"function"!=typeof t}),r=n.changedRanges,r=Fn.extendWithRanges(r,Hl(e,this.stateDeco,n?n.changes:K.empty(this.state.doc.length))),e=this.heightMap.height,this.heightMap=this.heightMap.applyChanges(this.stateDeco,n.startState.doc,this.heightOracle.setDoc(this.state.doc),r),this.heightMap.height!=e&&(n.flags|=2),e=r.length?this.mapViewport(this.viewport,n.changes):this.viewport,(i&&(i.range.head<e.from||i.range.head>e.to)||!this.viewportIsAppropriate(e))&&(e=this.getViewport(0,i)),r=!n.changes.empty||2&n.flags||e.from!=this.viewport.from||e.to!=this.viewport.to,this.viewport=e,this.updateForViewport(),r&&this.updateViewportLines(),(this.lineGaps.length||4e3<this.viewport.to-this.viewport.from)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,n.changes))),n.flags|=this.computeVisibleRanges(),i&&(this.scrollTarget=i),!this.mustEnforceCursorAssoc&&n.selectionSet&&n.view.lineWrapping&&n.state.selection.main.empty&&n.state.selection.main.assoc&&!n.state.facet(Cn)&&(this.mustEnforceCursorAssoc=!0)}},{key:"measure",value:function t(n){var i,e,r,o,u,s,a,f,h,c,e,c,e,i,c,c,l,s,a,v,s,d,y,m,p,o,i=n.contentDOM,e=window.getComputedStyle(i),r=this.heightOracle,o=e.whiteSpace;if(this.defaultTextDirection="rtl"==e.direction?E.RTL:E.LTR,u=this.heightOracle.mustRefreshForWrapping(o),s=i.getBoundingClientRect(),a=u||this.mustMeasureContent||this.contentDOMHeight!=s.height,this.contentDOMHeight=s.height,this.mustMeasureContent=!1,h=f=0,c=parseInt(e.paddingTop)||0,e=parseInt(e.paddingBottom)||0,this.paddingTop==c&&this.paddingBottom==e||(this.paddingTop=c,this.paddingBottom=e,f|=10),this.editorWidth!=n.scrollDOM.clientWidth&&(r.lineWrapping&&(a=!0),this.editorWidth=n.scrollDOM.clientWidth,f|=8),e=(c=(this.printing?Wl:zl)(i,this.paddingTop)).top-this.pixelViewport.top,i=c.bottom-this.pixelViewport.bottom,this.pixelViewport=c,(c=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left)!=this.inView&&(this.inView=c)&&(a=!0),!this.inView&&!this.scrollTarget)return 0;if(c=s.width,this.contentDOMWidth==c&&this.editorHeight==n.scrollDOM.clientHeight||(this.contentDOMWidth=s.width,this.editorHeight=n.scrollDOM.clientHeight,f|=8),a){l=n.docView.measureVisibleLineHeights(this.viewport),((u=r.mustRefreshForHeights(l)?!0:u)||r.lineWrapping&&Math.abs(c-this.contentDOMWidth)>r.charWidth)&&(a=(s=n.docView.measureTextSize()).lineHeight,v=s.charWidth,s=s.textHeight,u=0<a&&r.refresh(o,a,v,s,c/v,l))&&(n.docView.minWidth=0,f|=8),0<e&&0<i?h=Math.max(e,i):e<0&&i<0&&(h=Math.min(e,i)),r.heightChanged=!1,d=F(this.viewports);try{for(d.s();!(y=d.n()).done;)p=(m=y.value).from==this.viewport.from?l:n.docView.measureVisibleLineHeights(m),this.heightMap=(u?Pi.empty().applyChanges(this.stateDeco,k.empty,this.heightOracle,[new Fn(0,0,0,n.state.doc.length)]):this.heightMap).updateHeight(r,0,u,new Si(m.from,p))}catch(t){d.e(t)}finally{d.f()}r.heightChanged&&(f|=2)}return(o=!this.viewportIsAppropriate(this.viewport,h)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to))&&(this.viewport=this.getViewport(h,this.scrollTarget)),this.updateForViewport(),(2&f||o)&&this.updateViewportLines(),(this.lineGaps.length||4e3<this.viewport.to-this.viewport.from)&&this.updateLineGaps(this.ensureLineGaps(u?[]:this.lineGaps,n)),f|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,n.docView.enforceCursorAssoc()),f}},{key:"visibleTop",get:function t(){return this.scaler.fromDOM(this.pixelViewport.top)}},{key:"visibleBottom",get:function t(){return this.scaler.fromDOM(this.pixelViewport.bottom)}},{key:"getViewport",value:function t(n,i){var n,e,r,o,u,o,u,n,s,i,n=.5-Math.max(-.5,Math.min(.5,n/1e3/2)),e=this.heightMap,r=this.heightOracle,o=this.visibleTop,u=this.visibleBottom,o=new Fi(e.lineAt(o-1e3*n,p.ByHeight,r,0,0).from,e.lineAt(u+1e3*(1-n),p.ByHeight,r,0,0).to);return i&&((u=i.range.head)<o.from||u>o.to)&&(n=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),s=e.lineAt(u,p.ByPos,r,0,0),i="center"==i.y?(s.top+s.bottom)/2-n/2:"start"==i.y||"nearest"==i.y&&u<o.from?s.top:s.bottom-n,o=new Fi(e.lineAt(i-500,p.ByHeight,r,0,0).from,e.lineAt(i+n+500,p.ByHeight,r,0,0).to)),o}},{key:"mapViewport",value:function t(n,i){var e=i.mapPos(n.from,-1),i=i.mapPos(n.to,1);return new Fi(this.heightMap.lineAt(e,p.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(i,p.ByPos,this.heightOracle,0,0).to)}},{key:"viewportIsAppropriate",value:function t(n){var i,n,e,r,o,u,s,a,f,i=n.from,n=n.to,e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;return!this.inView||(o=(r=this.heightMap.lineAt(i,p.ByPos,this.heightOracle,0,0)).top,s=(u=this.heightMap.lineAt(n,p.ByPos,this.heightOracle,0,0)).bottom,a=this.visibleTop,f=this.visibleBottom,(0==i||o<=a-Math.max(10,Math.min(-e,250)))&&(n==this.state.doc.length||s>=f+Math.max(10,Math.min(e,250)))&&a-2e3<o&&s<f+2e3)}},{key:"mapLineGaps",value:function t(n,i){var e,r,o,u;if(!n.length||i.empty)return n;e=[],r=F(n);try{for(r.s();!(o=r.n()).done;)u=o.value,i.touchesRange(u.from,u.to)||e.push(new Li(i.mapPos(u.from),i.mapPos(u.to),u.size))}catch(t){r.e(t)}finally{r.f()}return e}},{key:"ensureLineGaps",value:function t(c,l){var v,d,n,y,i,m,e,r,o,u,s,a,f,h,p,k,g,w,b,M,x,S,C,j,P,v=this,d=this.heightOracle.lineWrapping,n=d?1e4:2e3,y=n>>1,i=n<<1;if(this.defaultTextDirection!=E.LTR&&!d)return[];m=[],e=function t(i,e,r,n){var o,u,s,a,f,o,h;if(!(e-i<y)){for(o=v.state.selection.main,u=[o.from],o.empty||u.push(o.to),s=0,a=u;s<a.length;s++)if(i<(f=a[s])&&f<e)return t(i,f-10,r,n),void t(f+10,e,r,n);(o=Gl(c,function(n){return n.from>=r.from&&n.to<=r.to&&Math.abs(n.from-i)<y&&Math.abs(n.to-e)<y&&!u.some(function(t){return n.from<t&&n.to>t})}))||(e<r.to&&l&&d&&l.visibleRanges.some(function(t){return t.from<=e&&t.to>=e})&&(h=l.moveToLineBoundary(O.cursor(e),!1,!0).head,i<h)&&(e=h),o=new Li(i,e,v.gapSize(r,i,e,n))),m.push(o)}},r=F(this.viewportLines);try{for(r.s();!(o=r.n()).done;)(u=o.value).length<i||(s=Vl(u.from,u.to,this.stateDeco)).total<i||(a=this.scrollTarget?this.scrollTarget.range.head:null,h=f=void 0,h=d?(p=n/this.heightOracle.lineLength*this.heightOracle.lineHeight,g=k=void 0,g=null!=a?(k=(w=ql(s,a))-(b=((this.visibleBottom-this.visibleTop)/2+p)/u.height),w+b):(k=(this.visibleTop-u.top-p)/u.height,(this.visibleBottom-u.top+p)/u.height),f=$l(s,k),$l(s,g)):(M=s.total*this.heightOracle.charWidth,x=n*this.heightOracle.charWidth,C=S=void 0,C=null!=a?(S=(j=ql(s,a))-(P=((this.pixelViewport.right-this.pixelViewport.left)/2+x)/M),j+P):(S=(this.pixelViewport.left-x)/M,(this.pixelViewport.right+x)/M),f=$l(s,S),$l(s,C)),f>u.from&&e(u.from,f,u,s),h<u.to&&e(h,u.to,u,s))}catch(t){r.e(t)}finally{r.f()}return m}},{key:"gapSize",value:function t(n,i,e,r){var e=ql(r,e)-ql(r,i);return this.heightOracle.lineWrapping?n.height*e:r.total*this.heightOracle.charWidth*e}},{key:"updateLineGaps",value:function t(n){var i=this;Li.same(n,this.lineGaps)||(this.lineGaps=n,this.lineGapDeco=m.set(n.map(function(t){return t.draw(i.heightOracle.lineWrapping)})))}},{key:"computeVisibleRanges",value:function t(){var n,e,n,n=this.stateDeco;return this.lineGaps.length&&(n=n.concat(this.lineGapDeco)),e=[],j.spans(n,this.viewport.from,this.viewport.to,{span:function t(n,i){e.push({from:n,to:i})},point:function t(){}},20),n=e.length!=this.visibleRanges.length||this.visibleRanges.some(function(t,n){return t.from!=e[n].from||t.to!=e[n].to}),this.visibleRanges=e,n?4:0}},{key:"lineBlockAt",value:function t(n){return n>=this.viewport.from&&n<=this.viewport.to&&this.viewportLines.find(function(t){return t.from<=n&&t.to>=n})||Jl(this.heightMap.lineAt(n,p.ByPos,this.heightOracle,0,0),this.scaler)}},{key:"lineBlockAtHeight",value:function t(n){return Jl(this.heightMap.lineAt(this.scaler.fromDOM(n),p.ByHeight,this.heightOracle,0,0),this.scaler)}},{key:"elementAtHeight",value:function t(n){return Jl(this.heightMap.blockAt(this.scaler.fromDOM(n),this.heightOracle,0,0),this.scaler)}},{key:"docHeight",get:function t(){return this.scaler.toDOM(this.heightMap.height)}},{key:"contentHeight",get:function t(){return this.docHeight+this.paddingTop+this.paddingBottom}}]),i}(),Fi=D(function t(n,i){A(this,t),this.from=n,this.to=i}),Ni={toDOM:function t(n){return n},fromDOM:function t(n){return n},scale:1},Ui=function(){function f(r,o,t){var u,n,i,e,s,a;A(this,f),i=n=u=0,this.viewports=t.map(function(t){var n,t,i,e,n=t.from,t=t.to,i=o.lineAt(n,p.ByPos,r,0,0).top,e=o.lineAt(t,p.ByPos,r,0,0).bottom;return u+=e-i,{from:n,to:t,top:i,bottom:e,domTop:0,domBottom:0}}),this.scale=(7e6-u)/(o.height-u),e=F(this.viewports);try{for(e.s();!(s=e.n()).done;)(a=s.value).domTop=i+(a.top-n)*this.scale,i=a.domBottom=a.domTop+(a.bottom-a.top),n=a.bottom}catch(t){e.e(t)}finally{e.f()}}return D(f,[{key:"toDOM",value:function t(n){for(var i,e,r,o,i=0,e=0,r=0;;i++){if(!(o=i<this.viewports.length?this.viewports[i]:null)||n<o.top)return r+(n-e)*this.scale;if(n<=o.bottom)return o.domTop+(n-o.top);e=o.bottom,r=o.domBottom}}},{key:"fromDOM",value:function t(n){for(var i,e,r,o,i=0,e=0,r=0;;i++){if(!(o=i<this.viewports.length?this.viewports[i]:null)||n<o.domTop)return e+(n-r)/this.scale;if(n<=o.domBottom)return o.top+(n-o.domTop);e=o.bottom,r=o.domBottom}}}]),f}(),Hi=y.define({combine:function t(n){return n.join(" ")}}),zi=y.define({combine:function t(n){return-1<n.indexOf(!0)}}),Gi=Kl("."+(Wi=Ft.newName()),{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",left:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".cm-highlightSpace:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".cm-highlightTab":{backgroundImage:'url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>\')',backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},qi={"&light":"."+(Vi=Ft.newName()),"&dark":"."+($i=Ft.newName())}),Ji=D(function t(n,i,e,r){var r,o,r,i,e,e,i,o;A(this,t),this.typeOver=r,this.bounds=null,this.text="",o=(r=n.docView).impreciseHead,r=r.impreciseAnchor,n.state.readOnly&&-1<i?this.newSel=null:-1<i&&(this.bounds=n.docView.domBoundsAround(i,e,0))?(i=o||r?[]:Zl(n),(e=new ti(i,n.state)).readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=e.text,this.newSel=Yl(i,this.bounds.from)):(e=n.observer.selectionRange,i=o&&o.node==e.focusNode&&o.offset==e.focusOffset||!uc(n.contentDOM,e.focusNode)?n.state.selection.main.head:n.docView.posFromDOM(e.focusNode,e.focusOffset),o=r&&r.node==e.anchorNode&&r.offset==e.anchorOffset||!uc(n.contentDOM,e.anchorNode)?n.state.selection.main.anchor:n.docView.posFromDOM(e.anchorNode,e.anchorOffset),this.newSel=O.single(o,i))}),Ki={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Qi=g.ie&&g.ie_version<=11,Xi=function(){function t(r){var o=this;A(this,t),this.view=r,this.active=!1,this.selectionRange=new qt,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.resizeContent=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.parentCheck=-1,this.dom=r.contentDOM,this.observer=new MutationObserver(function(t){var n,i,e,n=F(t);try{for(n.s();!(i=n.n()).done;)e=i.value,o.queue.push(e)}catch(t){n.e(t)}finally{n.f()}(g.ie&&g.ie_version<=11||g.ios&&r.composing)&&t.some(function(t){return"childList"==t.type&&t.removedNodes.length||"characterData"==t.type&&t.oldValue.length>t.target.nodeValue.length})?o.flushSoon():o.flush()}),Qi&&(this.onCharData=function(t){o.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),o.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),"function"==typeof ResizeObserver&&(this.resizeScroll=new ResizeObserver(function(){var t;(null==(t=o.view.docView)?void 0:t.lastUpdate)<Date.now()-75&&o.onResize()}),this.resizeScroll.observe(r.scrollDOM),this.resizeContent=new ResizeObserver(function(){return o.view.requestMeasure()}),this.resizeContent.observe(r.contentDOM)),this.addWindowListeners(this.win=r.win),this.start(),"function"==typeof IntersectionObserver&&(this.intersection=new IntersectionObserver(function(t){o.parentCheck<0&&(o.parentCheck=setTimeout(o.listenForScroll.bind(o),1e3)),0<t.length&&0<t[t.length-1].intersectionRatio!=o.intersecting&&(o.intersecting=!o.intersecting,o.intersecting!=o.view.inView)&&o.onScrollChanged(document.createEvent("Event"))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(function(t){0<t.length&&0<t[t.length-1].intersectionRatio&&o.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}return D(t,[{key:"onScrollChanged",value:function t(n){this.view.inputState.runScrollHandlers(this.view,n),this.intersecting&&this.view.measure()}},{key:"onScroll",value:function t(n){this.intersecting&&this.flush(!1),this.onScrollChanged(n)}},{key:"onResize",value:function t(){var n=this;this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(function(){n.resizeTimeout=-1,n.view.requestMeasure()},50))}},{key:"onPrint",value:function t(){var n=this;this.view.viewState.printing=!0,this.view.measure(),setTimeout(function(){n.view.viewState.printing=!1,n.view.requestMeasure()},500)}},{key:"updateGaps",value:function t(i){var n,e,r;if(this.gapIntersection&&(i.length!=this.gaps.length||this.gaps.some(function(t,n){return t!=i[n]}))){this.gapIntersection.disconnect(),n=F(i);try{for(n.s();!(e=n.n()).done;)r=e.value,this.gapIntersection.observe(r)}catch(t){n.e(t)}finally{n.f()}this.gaps=i}}},{key:"onSelectionChange",value:function t(n){var i,e,r,o,i=this.selectionChanged;this.readSelectionRange()&&!this.delayedAndroidKey&&(e=this.view,r=this.selectionRange,e.state.facet(On)?e.root.activeElement==this.dom:ac(e.dom,r))&&((o=r.anchorNode&&e.docView.nearest(r.anchorNode))&&o.ignoreEvent(n)?i||(this.selectionChanged=!1):(g.ie&&g.ie_version<=11||g.android&&g.chrome)&&!e.state.selection.main.empty&&r.focusNode&&hc(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1))}},{key:"readSelectionRange",value:function t(){var n,i,e,n=this.view,i=g.safari&&11==n.root.nodeType&&sc(this.dom.ownerDocument)==this.dom&&n0(this.view)||oc(n.root);return!(!i||this.selectionRange.eq(i)||((e=ac(this.dom,i))&&!this.selectionChanged&&n.inputState.lastFocusTime>Date.now()-200&&n.inputState.lastTouchTime<Date.now()-300&&xc(this.dom,i)?(this.view.inputState.lastFocusTime=0,n.docView.updateSelection(),1):(this.selectionRange.setRange(i),e&&(this.selectionChanged=!0),0)))}},{key:"setSelectionRange",value:function t(n,i){this.selectionRange.set(n.node,n.offset,i.node,i.offset),this.selectionChanged=!1}},{key:"clearSelectionRange",value:function t(){this.selectionRange.set(null,0,null,0)}},{key:"listenForScroll",value:function t(){var n,i,e,r,o,u,s,a,f;for(this.parentCheck=-1,n=0,i=null,e=this.dom;e;)if(1==e.nodeType)!i&&n<this.scrollTargets.length&&this.scrollTargets[n]==e?n++:i=i||this.scrollTargets.slice(0,n),i&&i.push(e),e=e.assignedSlot||e.parentNode;else{if(11!=e.nodeType)break;e=e.host}if(i=n<this.scrollTargets.length&&!i?this.scrollTargets.slice(0,n):i){r=F(this.scrollTargets);try{for(r.s();!(o=r.n()).done;)(u=o.value).removeEventListener("scroll",this.onScroll)}catch(t){r.e(t)}finally{r.f()}s=F(this.scrollTargets=i);try{for(s.s();!(a=s.n()).done;)(f=a.value).addEventListener("scroll",this.onScroll)}catch(t){s.e(t)}finally{s.f()}}}},{key:"ignore",value:function t(n){if(!this.active)return n();try{return this.stop(),n()}finally{this.start(),this.clear()}}},{key:"start",value:function t(){this.active||(this.observer.observe(this.dom,Ki),Qi&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}},{key:"stop",value:function t(){this.active&&(this.active=!1,this.observer.disconnect(),Qi)&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData)}},{key:"clear",value:function t(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}},{key:"delayAndroidKey",value:function t(n,i){var e,n,r,e=this;this.delayedAndroidKey||(this.flushingAndroidKey=this.view.win.requestAnimationFrame(r=function t(){var n,i,n=e.delayedAndroidKey;!n||(e.clearDelayedAndroidKey(),e.view.inputState.lastKeyCode=n.keyCode,e.view.inputState.lastKeyTime=Date.now(),i=e.flush())||!n.force||wc(e.dom,n.key,n.keyCode)})),this.delayedAndroidKey&&"Enter"!=n||(this.delayedAndroidKey={key:n,keyCode:i,force:this.lastChange<Date.now()-50||!(null==(n=this.delayedAndroidKey)||!n.force)})}},{key:"clearDelayedAndroidKey",value:function t(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}},{key:"flushSoon",value:function t(){var n=this;this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(function(){n.delayedFlush=-1,n.flush()}))}},{key:"forceFlush",value:function t(){0<=this.delayedFlush&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}},{key:"pendingRecords",value:function t(){var n,i,e,n=F(this.observer.takeRecords());try{for(n.s();!(i=n.n()).done;)e=i.value,this.queue.push(e)}catch(t){n.e(t)}finally{n.f()}return this.queue}},{key:"processRecords",value:function t(){var n,i,e,r,o,u,s,a,n=this.pendingRecords();n.length&&(this.queue=[]),r=!(e=i=-1),o=F(n);try{for(o.s();!(u=o.n()).done;)s=u.value,(a=this.readMutation(s))&&(a.typeOver&&(r=!0),e=-1==i?(i=a.from,a.to):(i=Math.min(a.from,i),Math.max(a.to,e)))}catch(t){o.e(t)}finally{o.f()}return{from:i,to:e,typeOver:r}}},{key:"readChange",value:function t(){var n,i,e,n,r,n=this.processRecords(),i=n.from,e=n.to,n=n.typeOver,r=this.selectionChanged&&ac(this.dom,this.selectionRange);return i<0&&!r?null:(-1<i&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1,new Ji(this.view,i,e,n))}},{key:"flush",value:function t(){var n,i,e,i,n;return!(0<=this.delayedFlush||this.delayedAndroidKey||(0<arguments.length&&void 0!==arguments[0]&&!arguments[0]||this.readSelectionRange(),!(i=this.readChange())))&&(e=this.view.state,i=Ql(this.view,i),this.view.state==e&&this.view.update([]),i)}},{key:"readMutation",value:function t(n){var i,e,r,i=this.view.docView.nearest(n.target);return!i||i.ignoreMutation(n)?null:(i.markDirty("attributes"==n.type),"attributes"==n.type&&(i.dirty|=4),"childList"==n.type?(e=t0(i,n.previousSibling||n.target.previousSibling,-1),r=t0(i,n.nextSibling||n.target.nextSibling,1),{from:e?i.posAfter(e):i.posAtStart,to:r?i.posBefore(r):i.posAtEnd,typeOver:!1}):"characterData"==n.type?{from:i.posAtStart,to:i.posAtEnd,typeOver:n.target.nodeValue==n.oldValue}:null)}},{key:"setWindow",value:function t(n){n!=this.win&&(this.removeWindowListeners(this.win),this.win=n,this.addWindowListeners(this.win))}},{key:"addWindowListeners",value:function t(n){n.addEventListener("resize",this.onResize),n.addEventListener("beforeprint",this.onPrint),n.addEventListener("scroll",this.onScroll),n.document.addEventListener("selectionchange",this.onSelectionChange)}},{key:"removeWindowListeners",value:function t(n){n.removeEventListener("scroll",this.onScroll),n.removeEventListener("resize",this.onResize),n.removeEventListener("beforeprint",this.onPrint),n.document.removeEventListener("selectionchange",this.onSelectionChange)}},{key:"destroy",value:function t(){var n,n,n,n,i,e,r;this.stop(),null!=(n=this.intersection)&&n.disconnect(),null!=(n=this.gapIntersection)&&n.disconnect(),null!=(n=this.resizeScroll)&&n.disconnect(),null!=(n=this.resizeContent)&&n.disconnect(),i=F(this.scrollTargets);try{for(i.s();!(e=i.n()).done;)(r=e.value).removeEventListener("scroll",this.onScroll)}catch(t){i.e(t)}finally{i.f()}this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey)}}]),t}(),(w=function(){function h(){var n,t,i,e,r,n=this,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};A(this,h),this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.style.cssText="position: fixed; top: -10000px",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),this.$de=t.dispatch||function(t){return n.update([t])},this.dispatch=this.dispatch.bind(this),this.Nkt=t.root||bc(t.parent)||document,this.viewState=new _i(t.state||C.create(t)),this.plugins=this.state.facet(An).map(function(t){return new Dn(t)}),i=F(this.plugins);try{for(i.s();!(e=i.n()).done;)(r=e.value).update(this)}catch(t){i.e(t)}finally{i.f()}this.observer=new Xi(this),this.inputState=new ui(this),this.inputState.ensureHandlers(this,this.plugins),this.docView=new ii(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),t.parent&&t.parent.appendChild(this.dom)}return D(h,[{key:"state",get:function t(){return this.viewState.state}},{key:"viewport",get:function t(){return this.viewState.viewport}},{key:"visibleRanges",get:function t(){return this.viewState.visibleRanges}},{key:"inView",get:function t(){return this.viewState.inView}},{key:"composing",get:function t(){return 0<this.inputState.composing}},{key:"compositionStarted",get:function t(){return 0<=this.inputState.composing}},{key:"root",get:function t(){return this.Nkt}},{key:"win",get:function t(){return this.dom.ownerDocument.defaultView||window}},{key:"dispatch",value:function t(){var n,n,n=1==arguments.length&&(arguments.length<=0?void 0:arguments[0])instanceof Mt?arguments.length<=0?void 0:arguments[0]:(n=this.state).update.apply(n,arguments);this.$de(n,this)}},{key:"update",value:function t(n){var i,e,r,t,o,u,s,a,f,h,c,l,v,d,y,m,p,k,g,w,b,M,x,S,i=this;if(0!=this.updateState)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");r=e=!1,o=this.state,u=F(n);try{for(u.s();!(s=u.n()).done;){if((a=s.value).startState!=o)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");o=a.state}}catch(t){u.e(t)}finally{u.f()}if(this.destroyed)this.viewState.state=o;else{if(f=this.hasFocus,h=0,c=null,n.some(function(t){return t.annotation(bi)})?(this.inputState.notifiedFocused=f,h=1):f==this.inputState.notifiedFocused||(this.inputState.notifiedFocused=f,c=Fl(o,f))||(h=1),l=this.observer.delayedAndroidKey,v=null,l?(this.observer.clearDelayedAndroidKey(),(!(v=this.observer.readChange())||this.state.doc.eq(o.doc))&&this.state.selection.eq(o.selection)||(v=null)):this.observer.clear(),o.facet(C.phrases)!=this.state.facet(C.phrases))return this.setState(o);(t=Nn.create(this,o,n)).flags|=h,d=this.viewState.scrollTarget;try{this.updateState=2,y=F(n);try{for(y.s();!(m=y.n()).done;){p=m.value,d=d&&d.map(p.changes),p.scrollIntoView&&(k=p.state.selection.main,d=new jn(k.empty?k:O.cursor(k.head,k.head>k.anchor?-1:1))),g=F(p.effects);try{for(g.s();!(w=g.n()).done;)(b=w.value).is(Pn)&&(d=b.value)}catch(t){g.e(t)}finally{g.f()}}}catch(t){y.e(t)}finally{y.f()}this.viewState.update(t,d),this.bidiCache=te.update(this.bidiCache,t.changes),t.empty||(this.updatePlugins(t),this.inputState.update(t)),e=this.docView.update(t),this.state.facet(_n)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(n),this.docView.updateSelection(e,n.some(function(t){return t.isUserEvent("select.pointer")}))}finally{this.updateState=0}if(t.startState.facet(Hi)!=t.state.facet(Hi)&&(this.viewState.mustMeasureContent=!0),(e||r||d||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!t.empty){M=F(this.state.facet(bn));try{for(M.s();!(x=M.n()).done;)(S=x.value)(t)}catch(t){M.e(t)}finally{M.f()}}(c||v)&&Promise.resolve().then(function(){c&&i.state==c.startState&&i.dispatch(c),v&&!Ql(i,v)&&l.force&&wc(i.contentDOM,l.key,l.keyCode)})}}},{key:"setState",value:function t(n){var i,e,r,o,u,s,a;if(0!=this.updateState)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed)this.viewState.state=n;else{this.updateState=2,i=this.hasFocus;try{e=F(this.plugins);try{for(e.s();!(r=e.n()).done;)(o=r.value).destroy(this)}catch(t){e.e(t)}finally{e.f()}this.viewState=new _i(n),this.plugins=n.facet(An).map(function(t){return new Dn(t)}),this.pluginMap.clear(),u=F(this.plugins);try{for(u.s();!(s=u.n()).done;)(a=s.value).update(this)}catch(t){u.e(t)}finally{u.f()}this.docView=new ii(this),this.inputState.ensureHandlers(this,this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}i&&this.focus(),this.requestMeasure()}}},{key:"updatePlugins",value:function t(n){var i,e,r,o,u,s,a,f,h,c,l,v,d,y,m,i=n.startState.facet(An),e=n.state.facet(An);if(i!=e){r=[],o=F(e);try{for(o.s();!(u=o.n()).done;)s=u.value,(a=i.indexOf(s))<0?r.push(new Dn(s)):((f=this.plugins[a]).mustUpdate=n,r.push(f))}catch(t){o.e(t)}finally{o.f()}h=F(this.plugins);try{for(h.s();!(c=h.n()).done;)(l=c.value).mustUpdate!=n&&l.destroy(this)}catch(t){h.e(t)}finally{h.f()}this.plugins=r,this.pluginMap.clear(),this.inputState.ensureHandlers(this,this.plugins)}else{v=F(this.plugins);try{for(v.s();!(d=v.n()).done;)(y=d.value).mustUpdate=n}catch(t){v.e(t)}finally{v.f()}}for(m=0;m<this.plugins.length;m++)this.plugins[m].update(this)}},{key:"measure",value:function t(){var n,i,e,i,r,o,u,s,a,f,h,c,l,v,d,y,m,p,k,g,w,b,M,x,n=this,i=!(0<arguments.length&&void 0!==arguments[0])||arguments[0];if(!this.destroyed){-1<this.measureScheduled&&this.win.cancelAnimationFrame(this.measureScheduled),this.measureScheduled=0,i&&this.observer.forceFlush(),e=null,r=(i=this.scrollDOM).scrollHeight,o=i.scrollTop,s=r-(u=i.clientHeight)-4<o?r:o;try{for(a=0;this.updateState=1,f=this.viewport,h=this.viewState.lineBlockAtHeight(s),(c=this.viewState.measure(this))||this.measureRequests.length||null!=this.viewState.scrollTarget;a++){if(5<a){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}for(l=[],4&c||(v=[l,this.measureRequests],this.measureRequests=v[0],l=v[1]),d=l.map(function(t){try{return t.read(n)}catch(t){return Wc(n.state,t),Yi}}),y=Nn.create(this,this.state,[]),p=m=!1,y.flags|=c,e?e.flags|=c:e=y,this.updateState=2,y.empty||(this.updatePlugins(y),this.inputState.update(y),this.updateAttrs(),m=this.docView.update(y)),k=0;k<l.length;k++)if(d[k]!=Yi)try{(g=l[k]).write&&g.write(d[k],this)}catch(t){Wc(this.state,t)}if(this.viewState.editorHeight&&(this.viewState.scrollTarget?(this.docView.scrollIntoView(this.viewState.scrollTarget),p=!(this.viewState.scrollTarget=null)):(1<(w=this.viewState.lineBlockAt(h.from).top-h.top)||w<-1)&&(this.scrollDOM.scrollTop+=w,p=!0)),m&&this.docView.updateSelection(!0),this.viewport.from==f.from&&this.viewport.to==f.to&&!p&&0==this.measureRequests.length)break}}finally{this.updateState=0,this.measureScheduled=-1}if(e&&!e.empty){b=F(this.state.facet(bn));try{for(b.s();!(M=b.n()).done;)(x=M.value)(e)}catch(t){b.e(t)}finally{b.f()}}}}},{key:"themeClasses",get:function t(){return Wi+" "+(this.state.facet(zi)?$i:Vi)+" "+this.state.facet(Hi)}},{key:"updateAttrs",value:function t(){var i,e,r,n,i=this,e=i0(this,Rn,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),r={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(On)?"true":"false",class:"cm-content",style:"".concat(g.tabSize,": ").concat(this.state.tabSize),role:"textbox","aria-multiline":"true"};return this.state.readOnly&&(r["aria-readonly"]="true"),i0(this,In,r),n=this.observer.ignore(function(){var t,n,t=Fc(i.contentDOM,i.contentAttrs,r),n=Fc(i.dom,i.editorAttrs,e);return t||n}),this.editorAttrs=e,this.contentAttrs=r,n}},{key:"showAnnouncements",value:function t(n){var i,e,r,o,u,s,a,f,i=!0,e=F(n);try{for(e.s();!(r=e.n()).done;){u=F((o=r.value).effects);try{for(u.s();!(s=u.n()).done;)(a=s.value).is(h.announce)&&(i&&(this.announceDOM.textContent=""),i=!1,(f=this.announceDOM.appendChild(document.createElement("div"))).textContent=a.value)}catch(t){u.e(t)}finally{u.f()}}}catch(t){e.e(t)}finally{e.f()}}},{key:"mountStyles",value:function t(){this.styleModules=this.state.facet(_n),Ft.mount(this.root,this.styleModules.concat(Gi).reverse())}},{key:"readMeasured",value:function t(){if(2==this.updateState)throw new Error("Reading the editor layout isn't allowed during an update");0==this.updateState&&-1<this.measureScheduled&&this.measure(!1)}},{key:"requestMeasure",value:function t(n){var i,e,i=this;if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(function(){return i.measure()})),n&&!(-1<this.measureRequests.indexOf(n))){if(null!=n.key)for(e=0;e<this.measureRequests.length;e++)if(this.measureRequests[e].key===n.key)return void(this.measureRequests[e]=n);this.measureRequests.push(n)}}},{key:"plugin",value:function t(n){var i=this.pluginMap.get(n);return(void 0===i||i&&i.spec!=n)&&this.pluginMap.set(n,i=this.plugins.find(function(t){return t.spec==n})||null),i&&i.update(this).value}},{key:"documentTop",get:function t(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}},{key:"documentPadding",get:function t(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}},{key:"elementAtHeight",value:function t(n){return this.readMeasured(),this.viewState.elementAtHeight(n)}},{key:"lineBlockAtHeight",value:function t(n){return this.readMeasured(),this.viewState.lineBlockAtHeight(n)}},{key:"viewportLineBlocks",get:function t(){return this.viewState.viewportLines}},{key:"lineBlockAt",value:function t(n){return this.viewState.lineBlockAt(n)}},{key:"contentHeight",get:function t(){return this.viewState.contentHeight}},{key:"moveByChar",value:function t(n,i,e){return bl(this,n,pl(this,n,i,e))}},{key:"moveByGroup",value:function t(n,i){var e=this;return bl(this,n,pl(this,n,i,function(t){return kl(e,n.head,t)}))}},{key:"moveToLineBoundary",value:function t(n,i){var e;return ml(this,n,i,!(2<arguments.length&&void 0!==arguments[2])||arguments[2])}},{key:"moveVertically",value:function t(n,i,e){return bl(this,n,gl(this,n,i,e))}},{key:"domAtPos",value:function t(n){return this.docView.domAtPos(n)}},{key:"posAtDOM",value:function t(n){var i;return this.docView.posFromDOM(n,1<arguments.length&&void 0!==arguments[1]?arguments[1]:0)}},{key:"posAtCoords",value:function t(n){var i=!(1<arguments.length&&void 0!==arguments[1])||arguments[1];return this.readMeasured(),ll(this,n,i)}},{key:"coordsAtPos",value:function t(n){var i,e,r,o,u,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1;return this.readMeasured(),(e=this.docView.coordsAt(n,i))&&e.left!=e.right?(r=this.state.doc.lineAt(n),dc(e,(u=(o=this.bidiSpans(r))[Xn.find(o,n-r.from,-1,i)]).dir==E.LTR==0<i)):e}},{key:"defaultCharacterWidth",get:function t(){return this.viewState.heightOracle.charWidth}},{key:"defaultLineHeight",get:function t(){return this.viewState.heightOracle.lineHeight}},{key:"textDirection",get:function t(){return this.viewState.defaultTextDirection}},{key:"textDirectionAt",value:function t(n){var i;return!this.state.facet(Sn)||n<this.viewport.from||n>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(n))}},{key:"lineWrapping",get:function t(){return this.viewState.heightOracle.lineWrapping}},{key:"bidiSpans",value:function t(n){var i,e,r,o,u;if(n.length>Zi)return Jc(n.length);i=this.textDirectionAt(n.from),e=F(this.bidiCache);try{for(e.s();!(r=e.n()).done;)if((o=r.value).from==n.from&&o.dir==i)return o.order}catch(t){e.e(t)}finally{e.f()}return u=Gc(n.text,i),this.bidiCache.push(new te(n.from,n.to,i,u)),u}},{key:"hasFocus",get:function t(){var n;return(this.dom.ownerDocument.hasFocus()||g.safari&&(null==(n=this.inputState)?void 0:n.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}},{key:"focus",value:function t(){var n=this;this.observer.ignore(function(){kc(n.contentDOM),n.docView.updateSelection()})}},{key:"setRoot",value:function t(n){this.Nkt!=n&&(this.Nkt=n,this.observer.setWindow((9==n.nodeType?n:n.ownerDocument).defaultView||window),this.mountStyles())}},{key:"destroy",value:function t(){var n,i,e,n=F(this.plugins);try{for(n.s();!(i=n.n()).done;)(e=i.value).destroy(this)}catch(t){n.e(t)}finally{n.f()}this.plugins=[],this.inputState.destroy(),this.dom.remove(),this.observer.destroy(),-1<this.measureScheduled&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}}],[{key:"scrollIntoView",value:function t(n){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return Pn.of(new jn("number"==typeof n?O.cursor(n):n,i.y,i.x,i.yMargin,i.xMargin))}},{key:"domEventHandlers",value:function t(n){return d.define(function(){return{}},{eventHandlers:n})}},{key:"theme",value:function t(n,i){var e,e,e=Ft.newName(),e=[Hi.of(e),_n.of(Kl(".".concat(e),n))];return i&&i.dark&&e.push(zi.of(!0)),e}},{key:"baseTheme",value:function t(n){return st.lowest(_n.of(Kl("."+Wi,n,qi)))}},{key:"findFromDOM",value:function t(n){var n,i,i,i=n.querySelector(".cm-content"),i=i&&c.get(i)||c.get(n);return(null==(n=null==i?void 0:i.rootView)?void 0:n.view)||null}}]),h}()).styleModule=_n,w.inputHandler=Mn,w.focusChangeEffect=xn,w.perLineTextDirection=Sn,w.exceptionSink=wn,w.updateListener=bn,w.editable=On,w.mouseSelectionStyle=gn,w.dragMovesSelection=kn,w.clickAddsSelectionRange=pn,w.decorations=Tn,w.atomicRanges=Ln,w.scrollMargins=Bn,w.darkTheme=zi,w.contentAttributes=In,w.editorAttributes=Rn,w.lineWrapping=w.contentAttributes.of({class:"cm-lineWrapping"}),w.announce=v.define(),Zi=4096,Yi={},te=function(){function s(t,n,i,e){A(this,s),this.from=t,this.to=n,this.dir=i,this.order=e}return D(s,null,[{key:"update",value:function t(n,i){var e,r,o,u;if(i.empty)return n;for(e=[],r=n.length?n[n.length-1].dir:E.LTR,o=Math.max(0,n.length-10);o<n.length;o++)(u=n[o]).dir!=r||i.touchesRange(u.from,u.to)||e.push(new s(i.mapPos(u.from,1),i.mapPos(u.to,-1),u.dir,u.order));return e}}]),s}(),ne=g.mac?"mac":g.windows?"win":g.linux?"linux":"key",e=st.default(w.domEventHandlers({keydown:function t(n,i){return a0(o0(i.state),n,i,"editor")}})),ie=y.define({enables:e}),ee=new WeakMap,re=null,oe=4e3,ue=function(){function u(t,n,i,e,r){A(this,u),this.className=t,this.left=n,this.top=i,this.width=e,this.height=r}return D(u,[{key:"draw",value:function t(){var n=document.createElement("div");return n.className=this.className,this.adjust(n),n}},{key:"update",value:function t(n,i){return i.className==this.className&&(this.adjust(n),!0)}},{key:"adjust",value:function t(n){n.style.left=this.left+"px",n.style.top=this.top+"px",null!=this.width&&(n.style.width=this.width+"px"),n.style.height=this.height+"px"}},{key:"eq",value:function t(n){return this.left==n.left&&this.top==n.top&&this.width==n.width&&this.height==n.height&&this.className==n.className}}],[{key:"forRange",value:function t(n,i,e){var r,o;return e.empty?(r=n.coordsAtPos(e.head,e.assoc||1))?(o=f0(n),[new u(i,r.left-o.left,r.top-o.top,null,r.bottom-r.top)]):[]:l0(n,i,e)}}]),u}(),se=function(){function i(t,n){A(this,i),this.view=t,this.layer=n,this.drawn=[],this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=t.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),n.above&&this.dom.classList.add("cm-layer-above"),n.class&&this.dom.classList.add(n.class),this.dom.setAttribute("aria-hidden","true"),this.setOrder(t.state),t.requestMeasure(this.measureReq),n.mount&&n.mount(this.dom,t)}return D(i,[{key:"update",value:function t(n){n.startState.facet(ae)!=n.state.facet(ae)&&this.setOrder(n.state),(this.layer.update(n,this.dom)||n.geometryChanged)&&n.view.requestMeasure(this.measureReq)}},{key:"setOrder",value:function t(n){for(var i=0,e=n.facet(ae);i<e.length&&e[i]!=this.layer;)i++;this.dom.style.zIndex=String((this.layer.above?150:-1)-i)}},{key:"measure",value:function t(){return this.layer.markers(this.view)}},{key:"draw",value:function t(n){var i,e,r,o,u,s,a,i=this;if(n.length!=this.drawn.length||n.some(function(t,n){return!v0(t,i.drawn[n])})){e=this.dom.firstChild,r=0,o=F(n);try{for(o.s();!(u=o.n()).done;)(s=u.value).update&&e&&s.constructor&&this.drawn[r].constructor&&s.update(e,this.drawn[r])?(e=e.nextSibling,r++):this.dom.insertBefore(s.draw(),e)}catch(t){o.e(t)}finally{o.f()}for(;e;)a=e.nextSibling,e.remove(),e=a;this.drawn=n}}},{key:"destroy",value:function t(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}]),i}(),ae=y.define(),fe=!g.ios,he=y.define({combine:function t(n){return qh(n,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:function t(n,i){return Math.min(n,i)},drawRangeCursor:function t(n,i){return n||i}})}}),ce=d0({above:!0,markers:function t(n){var i,e,r,o,u,s,a,f,h,c,l,v,i=n.state,e=i.facet(he),r=[],o=F(i.selection.ranges);try{for(o.s();!(u=o.n()).done;)if(a=(s=u.value)==i.selection.main,s.empty?!a||fe:e.drawRangeCursor){f=a?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",h=s.empty?s:O.cursor(s.head,s.head>s.anchor?-1:1),c=F(ue.forRange(n,f,h));try{for(c.s();!(l=c.n()).done;)v=l.value,r.push(v)}catch(t){c.e(t)}finally{c.f()}}}catch(t){o.e(t)}finally{o.f()}return r},update:function t(n,i){n.transactions.some(function(t){return t.selection})&&(i.style.animationName="cm-blink"==i.style.animationName?"cm-blink2":"cm-blink");var e=m0(n);return e&&p0(n.state,i),n.docChanged||n.selectionSet||e},mount:function t(n,i){p0(i.state,n)},class:"cm-cursorLayer"}),le=d0({above:!1,markers:function t(n){return n.state.selection.ranges.map(function(t){return t.empty?[]:ue.forRange(n,"cm-selectionBackground",t)}).reduce(function(t,n){return t.concat(n)})},update:function t(n,i){return n.docChanged||n.selectionSet||n.viewportChanged||m0(n)},class:"cm-selectionLayer"}),Yt={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}},fe&&(Yt[".cm-line"].caretColor="transparent !important"),ve=st.highest(w.theme(Yt)),de=v.define({map:function t(n,i){return null==n?null:i.mapPos(n)}}),ye=b.define({create:function t(){return null},update:function t(n,i){return null!=n&&(n=i.changes.mapPos(n)),i.effects.reduce(function(t,n){return n.is(de)?n.value:t},n)}}),me=d.fromClass(function(){function n(t){A(this,n),this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}return D(n,[{key:"update",value:function t(n){var i,e,e=n.state.field(ye);null==e?null!=this.cursor&&(null!=(i=this.cursor)&&i.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(n.startState.field(ye)!=e||n.docChanged||n.geometryChanged)&&this.view.requestMeasure(this.measureReq))}},{key:"readPos",value:function t(){var n,n,i,n=this.view.state.field(ye),n=null!=n&&this.view.coordsAtPos(n);return n?(i=this.view.scrollDOM.getBoundingClientRect(),{left:n.left-i.left+this.view.scrollDOM.scrollLeft,top:n.top-i.top+this.view.scrollDOM.scrollTop,height:n.bottom-n.top}):null}},{key:"drawCursor",value:function t(n){this.cursor&&(n?(this.cursor.style.left=n.left+"px",this.cursor.style.top=n.top+"px",this.cursor.style.height=n.height+"px"):this.cursor.style.left="-100000px")}},{key:"destroy",value:function t(){this.cursor&&this.cursor.remove()}},{key:"setDropPos",value:function t(n){this.view.state.field(ye)!=n&&this.view.dispatch({effects:de.of(n)})}}]),n}(),{eventHandlers:{dragover:function t(n){this.setDropPos(this.view.posAtCoords({x:n.clientX,y:n.clientY}))},dragleave:function t(n){n.target!=this.view.contentDOM&&this.view.contentDOM.contains(n.relatedTarget)||this.setDropPos(null)},dragend:function t(){this.setDropPos(null)},drop:function t(){this.setDropPos(null)}}}),pe=function(){function e(t){A(this,e);var n=t.regexp,r=t.decoration,o=t.decorate,i=t.boundary,t=t.maxLength,t=void 0===t?1e3:t;if(!n.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=n,o)this.addMatch=function(t,n,i,e){return o(e,i,i+t[0].length,t,n)};else if("function"==typeof r)this.addMatch=function(t,n,i,e){var n=r(t,n,i);n&&e(i,i+t[0].length,n)};else{if(!r)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=function(t,n,i,e){return e(i,i+t[0].length,r)}}this.boundary=i,this.maxLength=t}return D(e,[{key:"createDeco",value:function t(i){var e,n,r,o,u,s,a,f,e=this,n=new Et,r=n.add.bind(n),o=F(w0(i,this.maxLength));try{for(o.s();!(u=o.n()).done;)a=(s=u.value).from,f=s.to,g0(i.state.doc,this.regexp,a,f,function(t,n){e.addMatch(n,i,t,r)})}catch(t){o.e(t)}finally{o.f()}return n.finish()}},{key:"updateDeco",value:function t(r,n){var o=1e9,u=-1;return r.docChanged&&r.changes.iterChanges(function(t,n,i,e){e>r.view.viewport.from&&i<r.view.viewport.to&&(o=Math.min(i,o),u=Math.max(e,u))}),r.viewportChanged||1e3<u-o?this.createDeco(r.view):-1<u?this.updateRange(r.view,n.map(r.changes),o,u):n}},{key:"updateRange",value:function t(c,l,v,d){var y,n,m,i,y=this,n=F(c.visibleRanges);try{for(i=function t(){var n,i,e,r,o,u,s,a,f,h,n=m.value,i=Math.max(n.from,v),e=Math.min(n.to,d);if(i<e){if(o=(r=c.state.doc.lineAt(i)).to<e?c.state.doc.lineAt(e):r,u=Math.max(n.from,r.from),s=Math.min(n.to,o.to),y.boundary){for(;i>r.from;i--)if(y.boundary.test(r.text[i-1-r.from])){u=i;break}for(;e<o.to;e++)if(y.boundary.test(o.text[e-o.from])){s=e;break}}if(a=[],h=function t(n,i,e){return a.push(e.range(n,i))},r==o)for(y.regexp.lastIndex=u-r.from;(f=y.regexp.exec(r.text))&&f.index<s-r.from;)y.addMatch(f,c,f.index+r.from,h);else g0(c.state.doc,y.regexp,u,s,function(t,n){y.addMatch(n,c,t,h)});l=l.update({filterFrom:u,filterTo:s,filter:function t(n,i){return n<u||s<i},add:a})}},n.s();!(m=n.n()).done;)i()}catch(t){n.e(t)}finally{n.f()}return l}}]),e}(),ke=null!=/x/.unicode?"gu":"g",ge=new RegExp("[\0-\b\n-\x1f\x7f-\x9f\xad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]",ke),we={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"},be=null,Me=y.define({combine:function t(n){var n=qh(n,{render:null,specialChars:ge,addSpecialChars:null});return(n.replaceTabs=!b0())&&(n.specialChars=new RegExp("\t|"+n.specialChars.source,ke)),n.addSpecialChars&&(n.specialChars=new RegExp(n.specialChars.source+"|"+n.addSpecialChars.source,ke)),n}}),xe=null,Se="\u2022",Ce=function(t){f(r,t);var e=S(r);function r(t,n){var i;return A(this,r),(i=e.call(this)).options=t,i.code=n,i}return D(r,[{key:"eq",value:function t(n){return n.code==this.code}},{key:"toDOM",value:function t(n){var i,n,e,e,i=S0(this.code),n=n.state.phrase("Control character")+" "+(we[this.code]||"0x"+this.code.toString(16)),e=this.options.render&&this.options.render(this.code,n,i);return e||((e=document.createElement("span")).textContent=i,e.title=n,e.setAttribute("aria-label",n),e.className="cm-specialChar",e)}},{key:"ignoreEvent",value:function t(){return!1}}]),r}(tn),je=function(t){f(e,t);var i=S(e);function e(t){var n;return A(this,e),(n=i.call(this)).width=t,n}return D(e,[{key:"eq",value:function t(n){return n.width==this.width}},{key:"toDOM",value:function t(){var n=document.createElement("span");return n.textContent="\t",n.className="cm-tab",n.style.width=this.width+"px",n}},{key:"ignoreEvent",value:function t(){return!1}}]),e}(tn),Pe=d.fromClass(function(){function t(){A(this,t),this.height=1e3,this.attrs={style:"padding-bottom: 1000px"}}return D(t,[{key:"update",value:function t(n){var n,n,n=n.view,n=n.viewState.editorHeight-n.defaultLineHeight-n.documentPadding.top-.5;n!=this.height&&(this.height=n,this.attrs={style:"padding-bottom: ".concat(n,"px")})}}]),t}()),Oe=m.line({class:"cm-activeLine"}),Ee=d.fromClass(function(){function n(t){A(this,n),this.decorations=this.getDeco(t)}return D(n,[{key:"update",value:function t(n){(n.docChanged||n.selectionSet)&&(this.decorations=this.getDeco(n.view))}},{key:"getDeco",value:function t(n){var i,e,r,o,u,s,i=-1,e=[],r=F(n.state.selection.ranges);try{for(r.s();!(o=r.n()).done;)u=o.value,(s=n.lineBlockAt(u.head)).from>i&&(e.push(Oe.range(s.from)),i=s.from)}catch(t){r.e(t)}finally{r.f()}return m.set(e)}}]),n}(),{decorations:function t(n){return n.decorations}}),Ae=function(t){f(e,t);var i=S(e);function e(t){var n;return A(this,e),(n=i.call(this)).content=t,n}return D(e,[{key:"toDOM",value:function t(){var n=document.createElement("span");return n.className="cm-placeholder",n.style.pointerEvents="none",n.appendChild("string"==typeof this.content?document.createTextNode(this.content):this.content),"string"==typeof this.content?n.setAttribute("aria-label","placeholder "+this.content):n.setAttribute("aria-hidden","true"),n}},{key:"coordsAt",value:function t(n){var i,n,i,n,i=n.firstChild?fc(n.firstChild):[];return i.length?(n=window.getComputedStyle(n.parentNode),i=dc(i[0],"rtl"!=n.direction),n=parseInt(n.lineHeight),i.bottom-i.top>1.5*n?{left:i.left,right:i.right,top:i.top,bottom:i.top+n}:i):null}},{key:"ignoreEvent",value:function t(){return!1}}]),e}(tn),De=2e3,Re={Alt:[18,function(t){return!!t.altKey}],Control:[17,function(t){return!!t.ctrlKey}],Shift:[16,function(t){return!!t.shiftKey}],Meta:[91,function(t){return!!t.metaKey}]},Ie={style:"cursor: crosshair"},Te="-10000px",Le=function(){function e(t,n,i){A(this,e),this.facet=n,this.createTooltipView=i,this.input=t.state.facet(n),this.tooltips=this.input.filter(function(t){return t}),this.tooltipViews=this.tooltips.map(i)}return D(e,[{key:"update",value:function t(n){var i,e,r,o,u,s,a,f,h,c,l,v,d,y,m,p,e=n.state.facet(this.facet),r=e.filter(function(t){return t});if(e===this.input){o=F(this.tooltipViews);try{for(o.s();!(u=o.n()).done;)(s=u.value).update&&s.update(n)}catch(t){o.e(t)}finally{o.f()}return!1}for(a=[],f=0;f<r.length;f++)if(c=-1,h=r[f]){for(l=0;l<this.tooltips.length;l++)(v=this.tooltips[l])&&v.create==h.create&&(c=l);c<0?a[f]=this.createTooltipView(h):(d=a[f]=this.tooltipViews[c]).update&&d.update(n)}y=F(this.tooltipViews);try{for(y.s();!(m=y.n()).done;)p=m.value,a.indexOf(p)<0&&(p.dom.remove(),null!=(i=p.destroy))&&i.call(p)}catch(t){y.e(t)}finally{y.f()}return this.input=e,this.tooltips=r,this.tooltipViews=a,!0}}]),e}(),Be=y.define({combine:function t(n){var i,i,i;return{position:g.ios?"absolute":(null==(i=n.find(function(t){return t.position}))?void 0:i.position)||"fixed",parent:(null==(i=n.find(function(t){return t.parent}))?void 0:i.parent)||null,tooltipSpace:(null==(i=n.find(function(t){return t.tooltipSpace}))?void 0:i.tooltipSpace)||L0}}}),_e=new WeakMap,Fe=d.fromClass(function(){function e(t){var n,i,n=this;A(this,e),this.view=t,this.inView=!0,this.lastTransaction=0,this.measureTimeout=-1,i=t.state.facet(Be),this.position=i.position,this.parent=i.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.manager=new Le(t,Ue,function(t){return n.createTooltip(t)}),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver(function(t){Date.now()>n.lastTransaction-50&&0<t.length&&t[t.length-1].intersectionRatio<1&&n.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}return D(e,[{key:"createContainer",value:function t(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}},{key:"observeIntersection",value:function t(){var n,i,e;if(this.intersectionObserver){this.intersectionObserver.disconnect(),n=F(this.manager.tooltipViews);try{for(n.s();!(i=n.n()).done;)e=i.value,this.intersectionObserver.observe(e.dom)}catch(t){n.e(t)}finally{n.f()}}}},{key:"measureSoon",value:function t(){var n=this;this.measureTimeout<0&&(this.measureTimeout=setTimeout(function(){n.measureTimeout=-1,n.maybeMeasure()},50))}},{key:"update",value:function t(n){var i,i,n,e,r,o,u,s,a;if(n.transactions.length&&(this.lastTransaction=Date.now()),(i=this.manager.update(n))&&this.observeIntersection(),i=i||n.geometryChanged,(n=n.state.facet(Be)).position!=this.position){this.position=n.position,e=F(this.manager.tooltipViews);try{for(e.s();!(r=e.n()).done;)(o=r.value).dom.style.position=this.position}catch(t){e.e(t)}finally{e.f()}i=!0}if(n.parent!=this.parent){this.parent&&this.container.remove(),this.parent=n.parent,this.createContainer(),u=F(this.manager.tooltipViews);try{for(u.s();!(s=u.n()).done;)a=s.value,this.container.appendChild(a.dom)}catch(t){u.e(t)}finally{u.f()}i=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);i&&this.maybeMeasure()}},{key:"createTooltip",value:function t(n){var i,n,i=n.create(this.view);return i.dom.classList.add("cm-tooltip"),n.arrow&&!i.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")&&((n=document.createElement("div")).className="cm-tooltip-arrow",i.dom.appendChild(n)),i.dom.style.position=this.position,i.dom.style.top=Te,this.container.appendChild(i.dom),i.mount&&i.mount(this.view),i}},{key:"destroy",value:function t(){var n,i,e,r,o;this.view.win.removeEventListener("resize",this.measureSoon),e=F(this.manager.tooltipViews);try{for(e.s();!(r=e.n()).done;)(o=r.value).dom.remove(),null!=(n=o.destroy)&&n.call(o)}catch(t){e.e(t)}finally{e.f()}null!=(i=this.intersectionObserver)&&i.disconnect(),clearTimeout(this.measureTimeout)}},{key:"readMeasure",value:function t(){var i,n,i=this,n=this.view.dom.getBoundingClientRect();return{editor:n,parent:this.parent?this.container.getBoundingClientRect():n,pos:this.manager.tooltips.map(function(t,n){var n=i.manager.tooltipViews[n];return n.getCoords?n.getCoords(t.pos):i.view.coordsAtPos(t.pos)}),size:this.manager.tooltipViews.map(function(t){var n;return t.dom.getBoundingClientRect()}),space:this.view.state.facet(Be).tooltipSpace(this.view)}}},{key:"writeMeasure",value:function t(n){for(var i,e,r,o,u,s,a,f,h,c,l,v,d,y,i,m,p,k,s,g,w,b,M,x,e=n.editor,r=n.space,o=[],u=0;u<this.manager.tooltips.length;u++)if(s=this.manager.tooltips[u],f=(a=this.manager.tooltipViews[u]).dom,h=n.pos[u],c=n.size[u],!h||h.bottom<=Math.max(e.top,r.top)||h.top>=Math.min(e.bottom,r.bottom)||h.right<Math.max(e.left,r.left)-.1||h.left>Math.min(e.right,r.right)+.1)f.style.top=Te;else{if(v=(l=s.arrow?a.dom.querySelector(".cm-tooltip-arrow"):null)?7:0,d=c.right-c.left,y=null!=(i=_e.get(a))?i:c.bottom-c.top,i=a.offset||Ne,m=this.view.textDirection==E.LTR,p=c.width>r.right-r.left?m?r.left:r.right-c.width:m?Math.min(h.left-(l?14:0)+i.x,r.right-d):Math.max(r.left,h.left-d+(l?14:0)-i.x),k=!!s.above,(s=((k=!s.strictSide&&(k?h.top-(c.bottom-c.top)-i.y<r.top:h.bottom+(c.bottom-c.top)+i.y>r.bottom)&&k==r.bottom-h.bottom>h.top-r.top?!k:k)?h.top-r.top:r.bottom-h.bottom)-v)<y&&!1!==a.resize){if(s<this.view.defaultLineHeight){f.style.top=Te;continue}_e.set(a,y),f.style.height=(y=s)+"px"}else f.style.height&&(f.style.height="");if(g=k?h.top-y-v-i.y:h.bottom+v+i.y,w=p+d,!0!==a.overlap){b=F(o);try{for(b.s();!(M=b.n()).done;)(x=M.value).left<w&&x.right>p&&x.top<g+y&&x.bottom>g&&(g=k?x.top-y-2-v:x.bottom+v+2)}catch(t){b.e(t)}finally{b.f()}}"absolute"==this.position?(f.style.top=g-n.parent.top+"px",f.style.left=p-n.parent.left+"px"):(f.style.top=g+"px",f.style.left=p+"px"),l&&(l.style.left="".concat(h.left+(m?i.x:-i.x)-(p+14-7),"px")),!0!==a.overlap&&o.push({left:p,top:g,right:w,bottom:g+y}),f.classList.toggle("cm-tooltip-above",k),f.classList.toggle("cm-tooltip-below",!k),a.positioned&&a.positioned(n.space)}}},{key:"maybeMeasure",value:function t(){var n,i,e;if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView)&&(this.inView=this.view.inView,!this.inView)){n=F(this.manager.tooltipViews);try{for(n.s();!(i=n.n()).done;)(e=i.value).dom.style.top=Te}catch(t){n.e(t)}finally{n.f()}}}}]),e}(),{eventHandlers:{scroll:function t(){this.maybeMeasure()}}}),Zt=w.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"".concat(7,"px"),width:"".concat(14,"px"),position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"".concat(7,"px solid transparent"),borderRight:"".concat(7,"px solid transparent")},".cm-tooltip-above &":{bottom:"-".concat(7,"px"),"&:before":{borderTop:"".concat(7,"px solid #bbb")},"&:after":{borderTop:"".concat(7,"px solid #f5f5f5"),bottom:"1px"}},".cm-tooltip-below &":{top:"-".concat(7,"px"),"&:before":{borderBottom:"".concat(7,"px solid #bbb")},"&:after":{borderBottom:"".concat(7,"px solid #f5f5f5"),top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Ne={x:0,y:0},Ue=y.define({enables:[Fe,Zt]}),He=y.define(),ze=function(){function i(t){var n=this;A(this,i),this.view=t,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new Le(t,He,function(t){return n.createHostedView(t)})}return D(i,[{key:"createHostedView",value:function t(n){var n=n.create(this.view);return n.dom.classList.add("cm-tooltip-section"),this.dom.appendChild(n.dom),this.mounted&&n.mount&&n.mount(this.view),n}},{key:"mount",value:function t(n){var i,e,r,i=F(this.manager.tooltipViews);try{for(i.s();!(e=i.n()).done;)(r=e.value).mount&&r.mount(n)}catch(t){i.e(t)}finally{i.f()}this.mounted=!0}},{key:"positioned",value:function t(n){var i,e,r,i=F(this.manager.tooltipViews);try{for(i.s();!(e=i.n()).done;)(r=e.value).positioned&&r.positioned(n)}catch(t){i.e(t)}finally{i.f()}}},{key:"update",value:function t(n){this.manager.update(n)}},{key:"destroy",value:function t(){var n,i,e,r,i=F(this.manager.tooltipViews);try{for(i.s();!(e=i.n()).done;)null!=(n=(r=e.value).destroy)&&n.call(r)}catch(t){i.e(t)}finally{i.f()}}}],[{key:"create",value:function t(n){return new i(n)}}]),i}(),We=Ue.compute([He],function(t){var t=t.facet(He).filter(function(t){return t});return 0===t.length?null:{pos:Math.min.apply(Math,Wf(t.map(function(t){return t.pos}))),end:Math.max.apply(Math,Wf(t.filter(function(t){return null!=t.end}).map(function(t){return t.end}))),create:ze.create,above:t[0].above,arrow:t.some(function(t){return t.arrow})}}),Ve=function(){function o(t,n,i,e,r){A(this,o),this.view=t,this.source=n,this.field=i,this.setHover=e,this.hoverTime=r,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:t.dom,time:0},this.checkHover=this.checkHover.bind(this),t.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),t.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}return D(o,[{key:"update",value:function t(){var n=this;this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(function(){return n.startHover()},20))}},{key:"active",get:function t(){return this.view.state.field(this.field)}},{key:"checkHover",value:function t(){var n;this.hoverTimeout=-1,this.active||((n=Date.now()-this.lastMove.time)<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-n):this.startHover())}},{key:"startHover",value:function t(){var n,i,e,r,o,o,i,u,n=this;clearTimeout(this.restartTimeout),i=this.lastMove,null==(e=this.view.contentDOM.contains(i.target)?this.view.posAtCoords(i):null)||null==(r=this.view.coordsAtPos(e))||i.y<r.top||i.y>r.bottom||i.x<r.left-this.view.defaultCharacterWidth||i.x>r.right+this.view.defaultCharacterWidth||(o=(o=this.view.bidiSpans(this.view.state.doc.lineAt(e)).find(function(t){return t.from<=e&&t.to>=e}))&&o.dir==E.RTL?-1:1,null!=(i=this.source(this.view,e,i.x<r.left?-o:o))&&i.then?(u=this.pending={pos:e},i.then(function(t){n.pending==u&&(n.pending=null,t)&&n.view.dispatch({effects:n.setHover.of(t)})},function(t){return Wc(n.view.state,t,"hover tooltip")})):i&&this.view.dispatch({effects:this.setHover.of(i)}))}},{key:"mousemove",value:function t(n){var i,i,e,r,i;this.lastMove={x:n.clientX,y:n.clientY,target:n.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime)),((i=this.active)&&!B0(this.lastMove.target)||this.pending)&&((r=(e=i||this.pending).pos)==(i=null!=(i=null==i?void 0:i.end)?i:r)?this.view.posAtCoords(this.lastMove)!=r:!_0(this.view,r,i,n.clientX,n.clientY,6))&&(this.view.dispatch({effects:this.setHover.of(null)}),this.pending=null)}},{key:"mouseleave",value:function t(n){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1,this.active&&!B0(n.relatedTarget)&&this.view.dispatch({effects:this.setHover.of(null)})}},{key:"destroy",value:function t(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}]),o}(),nn=($e=v.define()).of(null),qe=y.define({combine:function t(n){var i,e,r,o,u,r=F(n);try{for(r.s();!(o=r.n()).done;)u=o.value,i=i||u.topContainer,e=e||u.bottomContainer}catch(t){r.e(t)}finally{r.f()}return{topContainer:i,bottomContainer:e}}}),Ge=d.fromClass(function(){function o(n){var t,i,e,r;A(this,o),this.input=n.state.facet(Ke),this.specs=this.input.filter(function(t){return t}),this.panels=this.specs.map(function(t){return t(n)}),t=n.state.facet(qe),this.top=new Je(n,!0,t.topContainer),this.bottom=new Je(n,!1,t.bottomContainer),this.top.sync(this.panels.filter(function(t){return t.top})),this.bottom.sync(this.panels.filter(function(t){return!t.top})),i=F(this.panels);try{for(i.s();!(e=i.n()).done;)(r=e.value).dom.classList.add("cm-panel"),r.mount&&r.mount()}catch(t){i.e(t)}finally{i.f()}}return D(o,[{key:"update",value:function t(n){var i,i,i,e,r,o,u,s,a,f,h,c,l,v,d,y,m,p,i=n.state.facet(qe);if(this.top.container!=i.topContainer&&(this.top.sync([]),this.top=new Je(n.view,!0,i.topContainer)),this.bottom.container!=i.bottomContainer&&(this.bottom.sync([]),this.bottom=new Je(n.view,!1,i.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses(),(i=n.state.facet(Ke))!=this.input){e=[],r=[],o=[],u=[],s=F(i=i.filter(function(t){return t}));try{for(s.s();!(a=s.n()).done;)f=a.value,h=this.specs.indexOf(f),c=void 0,h<0?(c=f(n.view),u.push(c)):(c=this.panels[h]).update&&c.update(n),e.push(c),(c.top?r:o).push(c)}catch(t){s.e(t)}finally{s.f()}for(this.specs=i,this.panels=e,this.top.sync(r),this.bottom.sync(o),l=0,v=u;l<v.length;l++)(d=v[l]).dom.classList.add("cm-panel"),d.mount&&d.mount()}else{y=F(this.panels);try{for(y.s();!(m=y.n()).done;)(p=m.value).update&&p.update(n)}catch(t){y.e(t)}finally{y.f()}}}},{key:"destroy",value:function t(){this.top.sync([]),this.bottom.sync([])}}]),o}(),{provide:function t(n){return w.scrollMargins.of(function(t){var t=t.plugin(n);return t&&{top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()}})}}),Je=function(){function e(t,n,i){A(this,e),this.view=t,this.top=n,this.container=i,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}return D(e,[{key:"sync",value:function t(n){var i,e,r,i=F(this.panels);try{for(i.s();!(e=i.n()).done;)(r=e.value).destroy&&n.indexOf(r)<0&&r.destroy()}catch(t){i.e(t)}finally{i.f()}this.panels=n,this.syncDOM()}},{key:"syncDOM",value:function t(){var n,i,e,r,o;if(0==this.panels.length)this.dom&&(this.dom.remove(),this.dom=void 0);else{this.dom||(this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0",(n=this.container||this.view.dom).insertBefore(this.dom,this.top?n.firstChild:null)),i=this.dom.firstChild,e=F(this.panels);try{for(e.s();!(r=e.n()).done;)if((o=r.value).dom.parentNode==this.dom){for(;i!=o.dom;)i=V0(i);i=i.nextSibling}else this.dom.insertBefore(o.dom,i)}catch(t){e.e(t)}finally{e.f()}for(;i;)i=V0(i)}}},{key:"scrollMargin",value:function t(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}},{key:"syncClasses",value:function t(){var n,i,e,r,o,u;if(this.container&&this.classes!=this.view.themeClasses){n=F(this.classes.split(" "));try{for(n.s();!(i=n.n()).done;)(e=i.value)&&this.container.classList.remove(e)}catch(t){n.e(t)}finally{n.f()}r=F((this.classes=this.view.themeClasses).split(" "));try{for(r.s();!(o=r.n()).done;)(u=o.value)&&this.container.classList.add(u)}catch(t){r.e(t)}finally{r.f()}}}}]),e}(),Ke=y.define({enables:Ge}),(en=function(t){f(i,t);var n=S(i);function i(){return A(this,i),n.apply(this,arguments)}return D(i,[{key:"compare",value:function t(n){return this==n||this.constructor==n.constructor&&this.eq(n)}},{key:"eq",value:function t(n){return!1}},{key:"destroy",value:function t(n){}}]),i}(jt)).prototype.elementClass="",en.prototype.toDOM=void 0,en.prototype.mapMode=h.TrackBefore,en.prototype.startSide=en.prototype.endSide=-1,en.prototype.point=!0,Qe=y.define(),Xe={class:"",renderEmptyElements:!1,elementStyle:"",markers:function t(){return j.empty},lineMarker:function t(){return null},widgetMarker:function t(){return null},lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},Ze=y.define(),Ye=y.define({combine:function t(n){return n.some(function(t){return t})}}),tr=d.fromClass(function(){function r(n){var i,t,e;A(this,r),this.view=n,this.prevViewport=n.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight+"px",this.gutters=n.state.facet(Ze).map(function(t){return new ir(n,t)}),i=F(this.gutters);try{for(i.s();!(t=i.n()).done;)e=t.value,this.dom.appendChild(e.dom)}catch(t){i.e(t)}finally{i.f()}this.fixed=!n.state.facet(Ye),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),n.scrollDOM.insertBefore(this.dom,n.contentDOM)}return D(r,[{key:"update",value:function t(n){var i,e,i;this.updateGutters(n)&&(i=this.prevViewport,e=n.view.viewport,i=Math.min(i.to,e.to)-Math.max(i.from,e.from),this.syncGutters(i<.8*(e.to-e.from))),n.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight+"px"),this.view.state.facet(Ye)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=n.view.viewport}},{key:"syncGutters",value:function t(n){var i,e,r,o,u,s,a,f,h,c,l,v,d,y,m,p,k,g,w,b,M,x,S,C,i=this,e=this.dom.nextSibling;n&&this.dom.remove(),r=j.iter(this.view.state.facet(Qe),this.view.viewport.from),o=[],u=this.gutters.map(function(t){return new nr(t,i.view.viewport,-i.view.documentPadding.top)}),s=F(this.view.viewportLineBlocks);try{for(s.s();!(a=s.n()).done;)if(f=a.value,o.length&&(o=[]),Array.isArray(f.type)){h=!0,c=F(f.type);try{for(c.s();!(l=c.n()).done;)if((v=l.value).type==P.Text&&h){J0(r,o,v.from),d=F(u);try{for(d.s();!(y=d.n()).done;)(m=y.value).line(this.view,v,o)}catch(t){d.e(t)}finally{d.f()}h=!1}else if(v.widget){p=F(u);try{for(p.s();!(k=p.n()).done;)(g=k.value).widget(this.view,v)}catch(t){p.e(t)}finally{p.f()}}}catch(t){c.e(t)}finally{c.f()}}else if(f.type==P.Text){J0(r,o,f.from),w=F(u);try{for(w.s();!(b=w.n()).done;)(M=b.value).line(this.view,f,o)}catch(t){w.e(t)}finally{w.f()}}}catch(t){s.e(t)}finally{s.f()}x=F(u);try{for(x.s();!(S=x.n()).done;)(C=S.value).finish()}catch(t){x.e(t)}finally{x.f()}n&&this.view.scrollDOM.insertBefore(this.dom,e)}},{key:"updateGutters",value:function t(n){var i,e,r,o,u,s,a,f,h,c,l,v,d,y,m,p,k,i=n.startState.facet(Ze),e=n.state.facet(Ze),r=n.docChanged||n.heightChanged||n.viewportChanged||!j.eq(n.startState.facet(Qe),n.state.facet(Qe),n.view.viewport.from,n.view.viewport.to);if(i==e){o=F(this.gutters);try{for(o.s();!(u=o.n()).done;)(s=u.value).update(n)&&(r=!0)}catch(t){o.e(t)}finally{o.f()}}else{r=!0,a=[],f=F(e);try{for(f.s();!(h=f.n()).done;)c=h.value,(l=i.indexOf(c))<0?a.push(new ir(this.view,c)):(this.gutters[l].update(n),a.push(this.gutters[l]))}catch(t){f.e(t)}finally{f.f()}v=F(this.gutters);try{for(v.s();!(d=v.n()).done;)(y=d.value).dom.remove(),a.indexOf(y)<0&&y.destroy()}catch(t){v.e(t)}finally{v.f()}for(m=0,p=a;m<p.length;m++)this.dom.appendChild((k=p[m]).dom);this.gutters=a}return r}},{key:"destroy",value:function t(){var n,i,e,n=F(this.gutters);try{for(n.s();!(i=n.n()).done;)(e=i.value).destroy()}catch(t){n.e(t)}finally{n.f()}this.dom.remove()}}]),r}(),{provide:function t(i){return w.scrollMargins.of(function(t){var n=t.plugin(i);return n&&0!=n.gutters.length&&n.fixed?t.textDirection==E.LTR?{left:n.dom.offsetWidth}:{right:n.dom.offsetWidth}:null})}}),nr=function(){function e(t,n,i){A(this,e),this.gutter=t,this.height=i,this.i=0,this.cursor=j.iter(t.markers,n.from)}return D(e,[{key:"addElement",value:function t(n,i,e){var r,o,u,r=this.gutter,o=i.top-this.height;this.i==r.elements.length?(u=new er(n,i.height,o,e),r.elements.push(u),r.dom.appendChild(u.dom)):r.elements[this.i].update(n,i.height,o,e),this.height=i.bottom,this.i++}},{key:"line",value:function t(n,i,e){var r,e,e,r=[];J0(this.cursor,r,i.from),e.length&&(r=r.concat(e)),(e=this.gutter.config.lineMarker(n,i,r))&&r.unshift(e),e=this.gutter,0==r.length&&!e.config.renderEmptyElements||this.addElement(n,i,r)}},{key:"widget",value:function t(n,i){var e=this.gutter.config.widgetMarker(n,i.widget,i);e&&this.addElement(n,i,[e])}},{key:"finish",value:function t(){for(var n,i,n=this.gutter;n.elements.length>this.i;)i=n.elements.pop(),n.dom.removeChild(i.dom),i.destroy()}}]),e}(),ir=function(){function i(r,o){var u,t,n,u=this;for(n in A(this,i),this.view=r,this.config=o,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:""),t=function t(e){u.dom.addEventListener(e,function(t){var n,i,i,i,n=t.target;if(n!=u.dom&&u.dom.contains(n)){for(;n.parentNode!=u.dom;)n=n.parentNode;i=((i=n.getBoundingClientRect()).top+i.bottom)/2}else i=t.clientY;i=r.lineBlockAtHeight(i-r.documentTop),o.domEventHandlers[e](r,i,t)&&t.preventDefault()})},o.domEventHandlers)t(n);this.markers=G0(o.markers(r)),o.initialSpacer&&(this.spacer=new er(r,0,0,[o.initialSpacer(r)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}return D(i,[{key:"update",value:function t(n){var i,e,e,i=this.markers;return this.markers=G0(this.config.markers(n.view)),this.spacer&&this.config.updateSpacer&&(e=this.config.updateSpacer(this.spacer.markers[0],n))!=this.spacer.markers[0]&&this.spacer.update(n.view,0,0,[e]),e=n.view.viewport,!j.eq(this.markers,i,e.from,e.to)||!!this.config.lineMarkerChange&&this.config.lineMarkerChange(n)}},{key:"destroy",value:function t(){var n,i,e,n=F(this.elements);try{for(n.s();!(i=n.n()).done;)(e=i.value).destroy()}catch(t){n.e(t)}finally{n.f()}}}]),i}(),er=function(){function r(t,n,i,e){A(this,r),this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(t,n,i,e)}return D(r,[{key:"update",value:function t(n,i,e,r){this.height!=i&&(this.dom.style.height=(this.height=i)+"px"),this.above!=e&&(this.dom.style.marginTop=(this.above=e)?e+"px":""),K0(this.markers,r)||this.setMarkers(n,r)}},{key:"setMarkers",value:function t(n,i){for(var e,r,o,u,s,a,f,h,c,l,l,e="cm-gutterElement",r=this.dom.firstChild,o=0,u=0;;){if(s=u,f=!1,a=o<i.length?i[o++]:null){for((h=a.elementClass)&&(e+=" "+h),c=u;c<this.markers.length;c++)if(this.markers[c].compare(a)){s=c,f=!0;break}}else s=this.markers.length;for(;u<s;)(l=this.markers[u++]).toDOM&&(l.destroy(r),l=r.nextSibling,r.remove(),r=l);if(!a)break;a.toDOM&&(f?r=r.nextSibling:this.dom.insertBefore(a.toDOM(n),r)),f&&u++}this.dom.className=e,this.markers=i}},{key:"destroy",value:function t(){this.setMarkers(null,[])}}]),r}(),rr=y.define(),or=y.define({combine:function t(n){return qh(n,{formatNumber:String,domEventHandlers:{}},{domEventHandlers:function t(n,i){var o,e,u,o=Object.assign({},n),e=function t(){var e=o[u],r=i[u];o[u]=e?function(t,n,i){return e(t,n,i)||r(t,n,i)}:r};for(u in i)e();return o}})}}),ur=function(t){f(e,t);var i=S(e);function e(t){var n;return A(this,e),(n=i.call(this)).number=t,n}return D(e,[{key:"eq",value:function t(n){return this.number==n.number}},{key:"toDOM",value:function t(){return document.createTextNode(this.number)}}]),e}(en),sr=Ze.compute([or],function(t){return{class:"cm-lineNumbers",renderEmptyElements:!1,markers:function t(n){return n.state.facet(rr)},lineMarker:function t(n,i,e){return e.some(function(t){return t.toDOM})?null:new ur(Q0(n,n.state.doc.lineAt(i.from).number))},widgetMarker:function t(){return null},lineMarkerChange:function t(n){return n.startState.facet(or)!=n.state.facet(or)},initialSpacer:function t(n){return new ur(Q0(n,Z0(n.state.doc.lines)))},updateSpacer:function t(n,i){var i=Q0(i.view,Z0(i.view.state.doc.lines));return i==n.number?n:new ur(i)},domEventHandlers:t.facet(or).domEventHandlers}}),ar=new(function(t){f(i,t);var n=S(i);function i(){var t;return A(this,i),(t=n.apply(this,arguments)).elementClass="cm-activeLineGutter",t}return D(i)}(en)),fr=Qe.compute(["selection"],function(t){var n,i,e,r,o,u,n=[],i=-1,e=F(t.selection.ranges);try{for(e.s();!(r=e.n()).done;)o=r.value,i<(u=t.doc.lineAt(o.head).from)&&(i=u,n.push(ar.range(u)))}catch(t){e.e(t)}finally{e.f()}return j.of(n)}),hr=new Map,cr=nv(new pe({regexp:/\t| +/g,decoration:function t(n){return tv(n[0])},boundary:/\S/})),lr=nv(new pe({regexp:/\s+$/g,decoration:m.mark({class:"cm-trailingSpace"}),boundary:/\S/})),u={HeightMap:Pi,HeightOracle:xi,MeasuredHeights:Si,QueryType:p,ChangedRange:Fn,computeOrder:Gc,moveVisually:Kc},vr=L.View=Object.freeze({__proto__:null,BidiSpan:Xn,BlockInfo:Ci,get BlockType(){return P},Decoration:m,get Direction(){return E},EditorView:w,GutterMarker:en,MatchDecorator:pe,RectangleMarker:ue,ViewPlugin:d,ViewUpdate:Nn,WidgetType:tn,qde:u,closeHoverTooltips:nn,crosshairCursor:I0,drawSelection:y0,dropCursor:k0,getPanel:W0,getTooltip:N0,gutter:$0,gutterLineClass:Qe,gutters:q0,hasHoverTooltips:U0,highlightActiveLine:j0,highlightActiveLineGutter:Y0,highlightSpecialChars:M0,highlightTrailingWhitespace:ev,highlightWhitespace:iv,hoverTooltip:F0,keymap:ie,layer:d0,lineNumberMarkers:rr,lineNumbers:X0,logException:Wc,panels:z0,placeholder:P0,rectangularSelection:R0,repositionTooltips:H0,runScopeHandlers:u0,scrollPastEnd:C0,showPanel:Ke,showTooltip:Ue,tooltips:T0}),dr=1024,yr=0,mr=D(function t(n,i){A(this,t),this.from=n,this.to=i}),(M=function(){function n(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};A(this,n),this.id=yr++,this.perNode=!!t.perNode,this.deserialize=t.deserialize||function(){throw new Error("This node type doesn't define a deserialize function")}}return D(n,[{key:"add",value:function t(n){var i=this;if(this.perNode)throw new RangeError("Can't add per-node props to node types");return"function"!=typeof n&&(n=kr.match(n)),function(t){var t=n(t);return void 0===t?null:[i,t]}}}]),n}()).closedBy=new M({deserialize:function t(n){return n.split(" ")}}),M.openedBy=new M({deserialize:function t(n){return n.split(" ")}}),M.group=new M({deserialize:function t(n){return n.split(" ")}}),M.contextHash=new M({perNode:!0}),M.lookAhead=new M({perNode:!0}),M.mounted=new M({perNode:!0}),pr=Object.create(null),(kr=function(){function a(t,n,i){var e=3<arguments.length&&void 0!==arguments[3]?arguments[3]:0;A(this,a),this.name=t,this.props=n,this.id=i,this.flags=e}return D(a,[{key:"prop",value:function t(n){return this.props[n.id]}},{key:"isTop",get:function t(){return 0<(1&this.flags)}},{key:"isSkipped",get:function t(){return 0<(2&this.flags)}},{key:"isError",get:function t(){return 0<(4&this.flags)}},{key:"isAnonymous",get:function t(){return 0<(8&this.flags)}},{key:"is",value:function t(n){var i;return"string"==typeof n?this.name==n||!!(i=this.prop(M.group))&&-1<i.indexOf(n):this.id==n}}],[{key:"define",value:function t(n){var i,e,r,o,u,s,i=n.props&&n.props.length?Object.create(null):pr,e=(n.top?1:0)|(n.skipped?2:0)|(n.error?4:0)|(null==n.name?8:0),r=new a(n.name||"",i,n.id,e);if(n.props){o=F(n.props);try{for(o.s();!(u=o.n()).done;)if(s=u.value,s=Array.isArray(s)?s:s(r)){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");i[s[0].id]=s[1]}}catch(t){o.e(t)}finally{o.f()}}return r}},{key:"match",value:function t(n){var r,i,e,o,u,r=Object.create(null);for(i in n){e=F(i.split(" "));try{for(e.s();!(o=e.n()).done;)u=o.value,r[u]=n[i]}catch(t){e.e(t)}finally{e.f()}}return function(t){for(var n,i,e,n=t.prop(M.group),i=-1;i<(n?n.length:0);i++)if(e=r[i<0?t.name:n[i]])return e}}}]),a}()).none=new kr("",Object.create(null),0,8),n=function(){function v(t){A(this,v),this.types=t;for(var n=0;n<t.length;n++)if(t[n].id!=n)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}return D(v,[{key:"extend",value:function t(){for(var n,i,e,r,o,u,s,a,f,h,c,l,n=[],i=arguments.length,e=new Array(i),r=0;r<i;r++)e[r]=arguments[r];o=F(this.types);try{for(o.s();!(u=o.n()).done;){s=u.value,a=null,f=F(e);try{for(f.s();!(h=f.n()).done;)(l=(c=h.value)(s))&&((a=a||Object.assign({},s.props))[l[0].id]=l[1])}catch(t){f.e(t)}finally{f.f()}n.push(a?new kr(s.name,a,s.id,s.flags):s)}}catch(t){o.e(t)}finally{o.f()}return new v(n)}}]),v}(),gr=new WeakMap,wr=new WeakMap,(o=br=br||{})[o.ExcludeBuffers=1]="ExcludeBuffers",o[o.IncludeAnonymous=2]="IncludeAnonymous",o[o.IgnoreMounts=4]="IgnoreMounts",o[o.IgnoreOverlays=8]="IgnoreOverlays",(x=function(){function h(t,n,i,e,r){var o,u,s,a,f;if(A(this,h),this.type=t,this.children=n,this.positions=i,this.length=e,this.props=null,r&&r.length){this.props=Object.create(null),o=F(r);try{for(o.s();!(u=o.n()).done;)a=(s=Gf(u.value,2))[0],f=s[1],this.props["number"==typeof a?a:a.id]=f}catch(t){o.e(t)}finally{o.f()}}}return D(h,[{key:"toString",value:function t(){var n,i,e,r,o,u,n=this.prop(M.mounted);if(n&&!n.overlay)return n.tree.toString();i="",e=F(this.children);try{for(e.s();!(r=e.n()).done;)(u=(o=r.value).toString())&&(i&&(i+=","),i+=u)}catch(t){e.e(t)}finally{e.f()}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(i.length?"("+i+")":""):i}},{key:"cursor",value:function t(){var n;return new Pr(this.topNode,0<arguments.length&&void 0!==arguments[0]?arguments[0]:0)}},{key:"cursorAt",value:function t(n){var i,e,r,r,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,r=gr.get(this)||this.topNode,r=new Pr(r);return r.moveTo(n,i),gr.set(this,r.oMi),r}},{key:"topNode",get:function t(){return new Sr(this,0,0,null)}},{key:"resolve",value:function t(n){var i,n,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,n=uv(gr.get(this)||this.topNode,n,i,!1);return gr.set(this,n),n}},{key:"resolveInner",value:function t(n){var i,n,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,n=uv(wr.get(this)||this.topNode,n,i,!0);return wr.set(this,n),n}},{key:"iterate",value:function t(n){for(var i,e,r,o,r,u,r,s,a,f,i=n.enter,e=n.leave,r=n.from,o=void 0===r?0:r,r=n.to,u=void 0===r?this.length:r,r=n.mode||0,s=0<(r&br.IncludeAnonymous),a=this.cursor(r|br.IncludeAnonymous);;){if(f=!1,a.from<=u&&a.to>=o&&(!s&&a.type.isAnonymous||!1!==i(a))){if(a.firstChild())continue;f=!0}for(;f&&e&&(s||!a.type.isAnonymous)&&e(a),!a.nextSibling();){if(!a.parent())return;f=!0}}}},{key:"prop",value:function t(n){return n.perNode?this.props?this.props[n.id]:void 0:this.type.prop(n)}},{key:"propValues",get:function t(){var n,i,n=[];if(this.props)for(i in this.props)n.push([+i,this.props[i]]);return n}},{key:"balance",value:function t(){var e,n,e=this,n;return this.children.length<=8?this:lv(kr.none,this.children,this.positions,0,this.children.length,0,this.length,function(t,n,i){return new h(e.type,t,n,i,e.propValues)},(0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}).makeTree||function(t,n,i){return new h(kr.none,t,n,i)})}}],[{key:"build",value:hv}]),h}()).empty=new x(kr.none,[],[],0),Mr=function(){function i(t,n){A(this,i),this.buffer=t,this.index=n}return D(i,[{key:"id",get:function t(){return this.buffer[this.index-4]}},{key:"start",get:function t(){return this.buffer[this.index-3]}},{key:"end",get:function t(){return this.buffer[this.index-2]}},{key:"size",get:function t(){return this.buffer[this.index-1]}},{key:"pos",get:function t(){return this.index}},{key:"next",value:function t(){this.index-=4}},{key:"fork",value:function t(){return new i(this.buffer,this.index)}}]),i}(),xr=function(){function h(t,n,i){A(this,h),this.buffer=t,this.length=n,this.set=i}return D(h,[{key:"type",get:function t(){return kr.none}},{key:"toString",value:function t(){for(var n,i,n=[],i=0;i<this.buffer.length;)n.push(this.childString(i)),i=this.buffer[i+3];return n.join(",")}},{key:"childString",value:function t(n){var i,e,i,r,o,i=this.buffer[n],e=this.buffer[n+3],i=this.set.types[i],r=i.name;if(/\W/.test(r)&&!i.isError&&(r=JSON.stringify(r)),e==(n+=4))return r;for(o=[];n<e;)o.push(this.childString(n)),n=this.buffer[n+3];return r+"("+o.join(",")+")"}},{key:"findChild",value:function t(n,i,e,r,o){for(var u,s,a,u=this.buffer,s=-1,a=n;a!=i&&!(rv(o,r,u[a+1],u[a+2])&&(s=a,0<e));a=u[a+3]);return s}},{key:"slice",value:function t(n,i,e){for(var r,o,u,s,a,f,r=this.buffer,o=new Uint16Array(i-n),u=0,s=n,a=0;s<i;)o[a++]=r[s++],o[a++]=r[s++]-e,f=o[a++]=r[s++]-e,o[a++]=r[s++]-n,u=Math.max(u,f);return new h(o,u,this.set)}}]),h}(),Sr=function(){function y(t,n,i,e){A(this,y),this.oMi=t,this.from=n,this.index=i,this.sft=e}return D(y,[{key:"type",get:function t(){return this.oMi.type}},{key:"name",get:function t(){return this.oMi.type.name}},{key:"to",get:function t(){return this.from+this.oMi.length}},{key:"nextChild",value:function t(n,i,e,r){for(var o,u,s,a,f,h,c,l,v,v,d,o=4<arguments.length&&void 0!==arguments[4]?arguments[4]:0,u=this;;){for(a=(s=u.oMi).children,f=s.positions,h=0<i?a.length:-1;n!=h;n+=i)if(c=a[n],rv(r,e,l=f[n]+u.from,l+c.length))if(c instanceof xr){if(!(o&br.ExcludeBuffers)&&-1<(v=c.findChild(0,c.buffer.length,i,e-l,r)))return new jr(new Cr(u,c,n,l),null,v)}else if(o&br.IncludeAnonymous||!c.type.isAnonymous||fv(c))return v=void 0,o&br.IgnoreMounts||!c.props||!(v=c.prop(M.mounted))||v.overlay?(d=new y(c,l,n,u),o&br.IncludeAnonymous||!d.type.isAnonymous?d:d.nextChild(i<0?c.children.length-1:0,i,e,r)):new y(v.tree,l,n,u);if(o&br.IncludeAnonymous||!u.type.isAnonymous)return null;if(n=0<=u.index?u.index+i:i<0?-1:u.sft.oMi.children.length,!(u=u.sft))return null}}},{key:"firstChild",get:function t(){return this.nextChild(0,1,0,4)}},{key:"lastChild",get:function t(){return this.nextChild(this.oMi.children.length-1,-1,0,4)}},{key:"childAfter",value:function t(n){return this.nextChild(0,1,n,2)}},{key:"childBefore",value:function t(n){return this.nextChild(this.oMi.children.length-1,-1,n,-2)}},{key:"enter",value:function t(n,i){var e,r,o,u,s,a,f,h,e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0;if(!(e&br.IgnoreOverlays)&&(r=this.oMi.prop(M.mounted))&&r.overlay){o=n-this.from,u=F(r.overlay);try{for(u.s();!(s=u.n()).done;)if(f=(a=s.value).from,h=a.to,(0<i?f<=o:f<o)&&(i<0?o<=h:o<h))return new y(r.tree,r.overlay[0].from+this.from,-1,this)}catch(t){u.e(t)}finally{u.f()}}return this.nextChild(0,1,n,i,e)}},{key:"nextSignificantParent",value:function t(){for(var n=this;n.type.isAnonymous&&n.sft;)n=n.sft;return n}},{key:"parent",get:function t(){return this.sft?this.sft.nextSignificantParent():null}},{key:"nextSibling",get:function t(){return this.sft&&0<=this.index?this.sft.nextChild(this.index+1,1,0,4):null}},{key:"prevSibling",get:function t(){return this.sft&&0<=this.index?this.sft.nextChild(this.index-1,-1,0,4):null}},{key:"cursor",value:function t(){var n;return new Pr(this,0<arguments.length&&void 0!==arguments[0]?arguments[0]:0)}},{key:"tree",get:function t(){return this.oMi}},{key:"toTree",value:function t(){return this.oMi}},{key:"resolve",value:function t(n){var i;return uv(this,n,1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,!1)}},{key:"resolveInner",value:function t(n){var i;return uv(this,n,1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,!0)}},{key:"enterUnfinishedNodesBefore",value:function t(n){return ov(this,n)}},{key:"getChild",value:function t(n){var i,e,n,i,e,n=sv(this,n,1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,2<arguments.length&&void 0!==arguments[2]?arguments[2]:null);return n.length?n[0]:null}},{key:"getChildren",value:function t(n){var i,e,i,e;return sv(this,n,1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,2<arguments.length&&void 0!==arguments[2]?arguments[2]:null)}},{key:"toString",value:function t(){return this.oMi.toString()}},{key:"node",get:function t(){return this}},{key:"matchContext",value:function t(n){return av(this,n)}}]),y}(),Cr=D(function t(n,i,e,r){A(this,t),this.parent=n,this.buffer=i,this.index=e,this.start=r}),jr=function(){function o(t,n,i){A(this,o),this.context=t,this.sft=n,this.index=i,this.type=t.buffer.set.types[t.buffer.buffer[i]]}return D(o,[{key:"name",get:function t(){return this.type.name}},{key:"from",get:function t(){return this.context.start+this.context.buffer.buffer[this.index+1]}},{key:"to",get:function t(){return this.context.start+this.context.buffer.buffer[this.index+2]}},{key:"child",value:function t(n,i,e){var r,r,r=this.context.buffer,r=r.findChild(this.index+4,r.buffer[this.index+3],n,i-this.context.start,e);return r<0?null:new o(this.context,this,r)}},{key:"firstChild",get:function t(){return this.child(1,0,4)}},{key:"lastChild",get:function t(){return this.child(-1,0,4)}},{key:"childAfter",value:function t(n){return this.child(1,n,2)}},{key:"childBefore",value:function t(n){return this.child(-1,n,-2)}},{key:"enter",value:function t(n,i){var e,r,r,e;return(2<arguments.length&&void 0!==arguments[2]?arguments[2]:0)&br.ExcludeBuffers||(r=(r=this.context.buffer).findChild(this.index+4,r.buffer[this.index+3],0<i?1:-1,n-this.context.start,i))<0?null:new o(this.context,this,r)}},{key:"parent",get:function t(){return this.sft||this.context.parent.nextSignificantParent()}},{key:"externalSibling",value:function t(n){return this.sft?null:this.context.parent.nextChild(this.context.index+n,n,0,4)}},{key:"nextSibling",get:function t(){var n,i,n=this.context.buffer,i=n.buffer[this.index+3];return i<(this.sft?n.buffer[this.sft.index+3]:n.buffer.length)?new o(this.context,this.sft,i):this.externalSibling(1)}},{key:"prevSibling",get:function t(){var n,i,n=this.context.buffer,i=this.sft?this.sft.index+4:0;return this.index==i?this.externalSibling(-1):new o(this.context,this.sft,n.findChild(i,this.index,-1,0,4))}},{key:"cursor",value:function t(){var n;return new Pr(this,0<arguments.length&&void 0!==arguments[0]?arguments[0]:0)}},{key:"tree",get:function t(){return null}},{key:"toTree",value:function t(){var n,i,e,r,o,u,n=[],i=[],e=this.context.buffer,r=this.index+4,o=e.buffer[this.index+3];return r<o&&(u=e.buffer[this.index+1],n.push(e.slice(r,o,u)),i.push(0)),new x(this.type,n,i,this.to-this.from)}},{key:"resolve",value:function t(n){var i;return uv(this,n,1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,!1)}},{key:"resolveInner",value:function t(n){var i;return uv(this,n,1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,!0)}},{key:"enterUnfinishedNodesBefore",value:function t(n){return ov(this,n)}},{key:"toString",value:function t(){return this.context.buffer.childString(this.index)}},{key:"getChild",value:function t(n){var i,e,n,i,e,n=sv(this,n,1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,2<arguments.length&&void 0!==arguments[2]?arguments[2]:null);return n.length?n[0]:null}},{key:"getChildren",value:function t(n){var i,e,i,e;return sv(this,n,1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,2<arguments.length&&void 0!==arguments[2]?arguments[2]:null)}},{key:"node",get:function t(){return this}},{key:"matchContext",value:function t(n){return av(this,n)}}]),o}(),Pr=function(){function e(t){var n,i,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;if(A(this,e),this.mode=n,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof Sr)this.yieldNode(t);else{for(this.oMi=t.context.parent,this.buffer=t.context,i=t.sft;i;i=i.sft)this.stack.unshift(i.index);this.bufferNode=t,this.yieldBuf(t.index)}}return D(e,[{key:"name",get:function t(){return this.type.name}},{key:"yieldNode",value:function t(n){return!!n&&(this.oMi=n,this.type=n.type,this.from=n.from,this.to=n.to,!0)}},{key:"yieldBuf",value:function t(n,i){this.index=n;var e=this.buffer,r=e.start,e=e.buffer;return this.type=i||e.set.types[e.buffer[n]],this.from=r+e.buffer[n+1],this.to=r+e.buffer[n+2],!0}},{key:"yield",value:function t(n){return!!n&&(n instanceof Sr?(this.buffer=null,this.yieldNode(n)):(this.buffer=n.context,this.yieldBuf(n.index,n.type)))}},{key:"toString",value:function t(){return this.buffer?this.buffer.buffer.childString(this.index):this.oMi.toString()}},{key:"enterChild",value:function t(n,i,e){var r,r;return this.buffer?!((r=(r=this.buffer.buffer).findChild(this.index+4,r.buffer[this.index+3],n,i-this.buffer.start,e))<0)&&(this.stack.push(this.index),this.yieldBuf(r)):this.yield(this.oMi.nextChild(n<0?this.oMi.oMi.children.length-1:0,n,i,e,this.mode))}},{key:"firstChild",value:function t(){return this.enterChild(1,0,4)}},{key:"lastChild",value:function t(){return this.enterChild(-1,0,4)}},{key:"childAfter",value:function t(n){return this.enterChild(1,n,2)}},{key:"childBefore",value:function t(n){return this.enterChild(-1,n,-2)}},{key:"enter",value:function t(n,i){var e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:this.mode;return this.buffer?!(e&br.ExcludeBuffers)&&this.enterChild(1,n,i):this.yield(this.oMi.enter(n,i,e))}},{key:"parent",value:function t(){var t;return this.buffer?this.stack.length?this.yieldBuf(this.stack.pop()):(t=this.mode&br.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent(),this.buffer=null,this.yieldNode(t)):this.yieldNode(this.mode&br.IncludeAnonymous?this.oMi.sft:this.oMi.parent)}},{key:"sibling",value:function t(n){var i,e,r,r;if(!this.buffer)return!!this.oMi.sft&&this.yield(this.oMi.index<0?null:this.oMi.sft.nextChild(this.oMi.index+n,n,0,4,this.mode));if(i=this.buffer.buffer,e=this.stack.length-1,n<0){if(r=e<0?0:this.stack[e]+4,this.index!=r)return this.yieldBuf(i.findChild(r,this.index,-1,0,4))}else if((r=i.buffer[this.index+3])<(e<0?i.buffer.length:i.buffer[this.stack[e]+3]))return this.yieldBuf(r);return e<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+n,n,0,4,this.mode))}},{key:"nextSibling",value:function t(){return this.sibling(1)}},{key:"prevSibling",value:function t(){return this.sibling(-1)}},{key:"atLastNode",value:function t(n){var i,e,r,o,u,s,a,f,h,r=this.buffer;if(r){if(0<n){if(this.index<r.buffer.buffer.length)return!1}else for(o=0;o<this.index;o++)if(r.buffer.buffer[o+3]<this.index)return!1;i=r.index,e=r.parent}else i=(u=this.oMi).index,e=u.sft;for(;e;i=(s=e).index,e=s.sft)if(-1<i)for(a=i+n,f=n<0?-1:e.oMi.children.length;a!=f;a+=n)if(h=e.oMi.children[a],this.mode&br.IncludeAnonymous||h instanceof xr||!h.type.isAnonymous||fv(h))return!1;return!0}},{key:"move",value:function t(n,i){if(i&&this.enterChild(n,0,4))return!0;for(;;){if(this.sibling(n))return!0;if(this.atLastNode(n)||!this.parent())return!1}}},{key:"next",value:function t(){var n;return this.move(1,!(0<arguments.length&&void 0!==arguments[0])||arguments[0])}},{key:"prev",value:function t(){var n;return this.move(-1,!(0<arguments.length&&void 0!==arguments[0])||arguments[0])}},{key:"moveTo",value:function t(n){for(var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;(this.from==this.to||(i<1?this.from>=n:this.from>n)||(-1<i?this.to<=n:this.to<n))&&this.parent(););for(;this.enterChild(1,n,i););return this}},{key:"node",get:function t(){var n,i,e,r,o,u,s;if(!this.buffer)return this.oMi;if(i=null,e=0,(n=this.bufferNode)&&n.context==this.buffer)t:for(r=this.index,o=this.stack.length;0<=o;){for(u=n;u;u=u.sft)if(u.index==r){if(r==this.index)return u;i=u,e=o+1;break t}r=this.stack[--o]}for(s=e;s<this.stack.length;s++)i=new jr(this.buffer,i,this.stack[s]);return this.bufferNode=new jr(this.buffer,i,this.index)}},{key:"tree",get:function t(){return this.buffer?null:this.oMi.oMi}},{key:"iterate",value:function t(n,i){for(var e,r,e=0;;){if(r=!1,this.type.isAnonymous||!1!==n(this)){if(this.firstChild()){e++;continue}this.type.isAnonymous||(r=!0)}for(;r&&i&&i(this),r=this.type.isAnonymous,!this.nextSibling();){if(!e)return;this.parent(),e--,r=!0}}}},{key:"matchContext",value:function t(n){var i,e,r,o,u;if(!this.buffer)return av(this.node,n);for(e=(i=this.buffer.buffer).set.types,r=n.length-1,o=this.stack.length-1;0<=r;o--){if(o<0)return av(this.node,n,r);if(!(u=e[i.buffer[this.stack[o]]]).isAnonymous){if(n[r]&&n[r]!=u.name)return!1;r--}}return!0}}]),e}(),Or=new WeakMap,Er=function(){function y(t,n,i,e){var r,o,r=4<arguments.length&&void 0!==arguments[4]&&arguments[4],o=5<arguments.length&&void 0!==arguments[5]&&arguments[5];A(this,y),this.from=t,this.to=n,this.tree=i,this.offset=e,this.open=(r?1:0)|(o?2:0)}return D(y,[{key:"openStart",get:function t(){return 0<(1&this.open)}},{key:"openEnd",get:function t(){return 0<(2&this.open)}}],[{key:"addTree",value:function t(n){var i,e,r,o,u,s,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[],e,r=[new y(0,n.length,n,0,!1,2<arguments.length&&void 0!==arguments[2]&&arguments[2])],o=F(i);try{for(o.s();!(u=o.n()).done;)(s=u.value).to>n.length&&r.push(s)}catch(t){o.e(t)}finally{o.f()}return r}},{key:"applyChanges",value:function t(n,i){var e,r,o,u,s,a,f,h,c,l,v,d,e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:128;if(!i.length)return n;for(r=[],o=1,u=n.length?n[0]:null,f=a=s=0;;s++){if(e<=(c=(h=s<i.length?i[s]:null)?h.fromA:1e9)-a)for(;u&&u.from<c&&((a>=(l=u).from||c<=l.to||f)&&(v=Math.max(l.from,a)-f,l=(d=Math.min(l.to,c)-f)<=v?null:new y(v,d,l.tree,l.offset+f,0<s,!!h)),l&&r.push(l),!(u.to>c));)u=o<n.length?n[o++]:null;if(!h)break;a=h.toA,f=h.toA-h.toB}return r}}]),y}(),Ar=function(){function t(){A(this,t)}return D(t,[{key:"startParse",value:function t(n,i,e){return"string"==typeof n&&(n=new Dr(n)),e=e?e.length?e.map(function(t){return new mr(t.from,t.to)}):[new mr(0,0)]:[new mr(0,n.length)],this.createParse(n,i||[],e)}},{key:"parse",value:function t(n,i,e){var t,r;for(t=this.startParse(n,i,e);;)if(r=t.advance())return r}}]),t}(),Dr=function(){function n(t){A(this,n),this.string=t}return D(n,[{key:"length",get:function t(){return this.string.length}},{key:"chunk",value:function t(n){return this.string.slice(n)}},{key:"lineChunks",get:function t(){return!1}},{key:"read",value:function t(n,i){return this.string.slice(n,i)}}]),n}(),new M({perNode:!0}),Rr=0,Ir=function(){function u(t,n,i){A(this,u),this.set=t,this.base=n,this.modified=i,this.id=Rr++}return D(u,null,[{key:"define",value:function t(n){var i,e,r,o;if(null!=n&&n.base)throw new Error("Can not derive from a modified tag");if((i=new u([],null,[])).set.push(i),n){e=F(n.set);try{for(e.s();!(r=e.n()).done;)o=r.value,i.set.push(o)}catch(t){e.e(t)}finally{e.f()}}return i}},{key:"defineModifier",value:function t(){var n=new Lr;return function(t){return-1<t.modified.indexOf(n)?t:Lr.get(t.base||t,t.modified.concat(n).sort(function(t,n){return t.id-n.id}))}}}]),u}(),Tr=0,Lr=function(){function m(){A(this,m),this.instances=[],this.id=Tr++}return D(m,null,[{key:"get",value:function t(n,i){var e,r,o,u,s,a,f,h,c,l,v,d,y;if(!i.length)return n;if(e=i[0].instances.find(function(t){return t.base==n&&vv(i,t.modified)}))return e;o=new Ir(r=[],n,i),u=F(i);try{for(u.s();!(s=u.n()).done;)(a=s.value).instances.push(o)}catch(t){u.e(t)}finally{u.f()}f=dv(i),h=F(n.set);try{for(h.s();!(c=h.n()).done;)if(!(l=c.value).modified.length){v=F(f);try{for(v.s();!(d=v.n()).done;)y=d.value,r.push(m.get(l,y))}catch(t){v.e(t)}finally{v.f()}}}catch(t){h.e(t)}finally{h.f()}return o}}]),m}(),Br=new M,(_r=function(){function r(t,n,i,e){A(this,r),this.tags=t,this.mode=n,this.context=i,this.next=e}return D(r,[{key:"opaque",get:function t(){return 0==this.mode}},{key:"inherit",get:function t(){return 1==this.mode}},{key:"sort",value:function t(n){return!n||n.depth<this.depth?(this.next=n,this):(n.next=this.sort(n.next),n)}},{key:"depth",get:function t(){return this.context?this.context.length:0}}]),r}()).empty=new _r([],2,null),Fr=function(){function e(t,n,i){A(this,e),this.at=t,this.highlighters=n,this.span=i,this.class=""}return D(e,[{key:"startSpan",value:function t(n,i){i!=this.class&&(this.flush(n),n>this.at&&(this.at=n),this.class=i)}},{key:"flush",value:function t(n){n>this.at&&this.class&&this.span(this.at,n,this.class)}},{key:"highlightRange",value:function t(n,i,e,r,o){var u,s,a,f,h,c,l,v,d,y,m,p,k,g,w,b,u=n.type,s=n.from,a=n.to;if(!(e<=s||a<=i||(f=r,(c=pv(o=u.isTop?this.highlighters.filter(function(t){return!t.scope||t.scope(u)}):o,(h=gv(n)||_r.empty).tags))&&(f&&(f+=" "),f+=c,1==h.mode)&&(r+=(r?" ":"")+c),this.startSpan(Math.max(i,s),f),h.opaque)))if((l=n.tree&&n.tree.prop(M.mounted))&&l.overlay){for(v=n.node.enter(l.overlay[0].from+s,1),d=this.highlighters.filter(function(t){return!t.scope||t.scope(l.tree.type)}),y=n.firstChild(),m=0,p=s;;m++){if(g=(k=m<l.overlay.length?l.overlay[m]:null)?k.from+s:a,(w=Math.max(i,p))<(b=Math.min(e,g))&&y)for(;n.from<b&&(this.highlightRange(n,w,b,r,o),this.startSpan(Math.min(b,n.to),f),!(n.to>=g))&&n.nextSibling(););if(!k||e<g)break;i<(p=k.to+s)&&(this.highlightRange(v.cursor(),Math.max(i,k.from+s),Math.min(e,p),"",d),this.startSpan(Math.min(e,p),f))}y&&n.parent()}else if(n.firstChild()){l&&(r="");do{if(!(n.to<=i)){if(n.from>=e)break;this.highlightRange(n,i,e,r,o),this.startSpan(Math.min(e,n.to),f)}}while(n.nextSibling());n.parent()}}}]),e}(),t=(r=Ir.define)(),e=r(),Yt=r(e),Zt=r(e),u=r(),nn=r(u),o=r(u),Nr=r(),Ur=r(Nr),Hr=r(),zr=r(),Wr=r(),Vr=r(Wr),$r=r(),mv([{tag:(a={comment:t,lineComment:r(t),blockComment:r(t),docComment:r(t),name:e,variableName:r(e),typeName:Yt,tagName:r(Yt),propertyName:Zt,attributeName:r(Zt),className:r(e),labelName:r(e),namespace:r(e),macroName:r(e),literal:u,string:nn,docString:r(nn),character:r(nn),attributeValue:r(nn),number:o,integer:r(o),float:r(o),bool:r(u),regexp:r(u),escape:r(u),color:r(u),url:r(u),keyword:Hr,self:r(Hr),null:r(Hr),atom:r(Hr),unit:r(Hr),modifier:r(Hr),operatorKeyword:r(Hr),controlKeyword:r(Hr),definitionKeyword:r(Hr),moduleKeyword:r(Hr),operator:zr,derefOperator:r(zr),arithmeticOperator:r(zr),logicOperator:r(zr),bitwiseOperator:r(zr),compareOperator:r(zr),updateOperator:r(zr),definitionOperator:r(zr),typeOperator:r(zr),controlOperator:r(zr),punctuation:Wr,separator:r(Wr),bracket:Vr,angleBracket:r(Vr),squareBracket:r(Vr),paren:r(Vr),brace:r(Vr),content:Nr,heading:Ur,heading1:r(Ur),heading2:r(Ur),heading3:r(Ur),heading4:r(Ur),heading5:r(Ur),heading6:r(Ur),contentSeparator:r(Nr),list:r(Nr),quote:r(Nr),emphasis:r(Nr),strong:r(Nr),link:r(Nr),monospace:r(Nr),strikethrough:r(Nr),inserted:r(),deleted:r(),changed:r(),invalid:r(),meta:$r,documentMeta:r($r),annotation:r($r),processingInstruction:r($r),definition:Ir.defineModifier(),constant:Ir.defineModifier(),function:Ir.defineModifier(),standard:Ir.defineModifier(),local:Ir.defineModifier(),special:Ir.defineModifier()}).link,class:"tok-link"},{tag:a.heading,class:"tok-heading"},{tag:a.emphasis,class:"tok-emphasis"},{tag:a.strong,class:"tok-strong"},{tag:a.keyword,class:"tok-keyword"},{tag:a.atom,class:"tok-atom"},{tag:a.bool,class:"tok-bool"},{tag:a.url,class:"tok-url"},{tag:a.labelName,class:"tok-labelName"},{tag:a.inserted,class:"tok-inserted"},{tag:a.deleted,class:"tok-deleted"},{tag:a.literal,class:"tok-literal"},{tag:a.string,class:"tok-string"},{tag:a.number,class:"tok-number"},{tag:[a.regexp,a.escape,a.special(a.string)],class:"tok-string2"},{tag:a.variableName,class:"tok-variableName"},{tag:a.local(a.variableName),class:"tok-variableName tok-local"},{tag:a.definition(a.variableName),class:"tok-variableName tok-definition"},{tag:a.special(a.variableName),class:"tok-variableName2"},{tag:a.definition(a.propertyName),class:"tok-propertyName tok-definition"},{tag:a.typeName,class:"tok-typeName"},{tag:a.namespace,class:"tok-namespace"},{tag:a.className,class:"tok-className"},{tag:a.macroName,class:"tok-macroName"},{tag:a.propertyName,class:"tok-propertyName"},{tag:a.operator,class:"tok-operator"},{tag:a.comment,class:"tok-comment"},{tag:a.meta,class:"tok-meta"},{tag:a.invalid,class:"tok-invalid"},{tag:a.punctuation,class:"tok-punctuation"}]),qr=new M,Gr=new M,(Jr=function(){function r(t,n){var i,e,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:[],e=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"";A(this,r),this.data=t,this.name=e,C.prototype.hasOwnProperty("tree")||Object.defineProperty(C.prototype,"tree",{get:function t(){return R(this)}}),this.parser=n,this.extension=[io.of(this),C.languageData.of(function(t,n,i){var e,r,o,r,u,s,a,f,h,e=bv(t,n,i),r=e.type.prop(qr);if(!r)return[];if(o=t.facet(r),r=e.type.prop(Gr)){u=e.resolve(n-e.from,i),s=F(r);try{for(s.s();!(a=s.n()).done;)if((f=a.value).test(u,t))return h=t.facet(f.facet),"replace"==f.type?h:h.concat(o)}catch(t){s.e(t)}finally{s.f()}}return o})].concat(i)}return D(r,[{key:"isActiveAt",value:function t(n,i){var e;return bv(n,i,2<arguments.length&&void 0!==arguments[2]?arguments[2]:-1).type.prop(qr)==this.data}},{key:"findRegions",value:function t(n){var h,i,c,e,h=this,i=n.facet(io);return(null==i?void 0:i.data)==this.data?[{from:0,to:n.doc.length}]:i&&i.allowsNesting?(c=[],(e=function t(n,i){var e,r,o,u,s,a,f;if(n.prop(qr)==h.data)c.push({from:i,to:i+n.length});else{if(e=n.prop(M.mounted)){if(e.tree.prop(qr)==h.data){if(e.overlay){r=F(e.overlay);try{for(r.s();!(o=r.n()).done;)u=o.value,c.push({from:u.from+i,to:u.to+i})}catch(t){r.e(t)}finally{r.f()}}else c.push({from:i,to:i+n.length});return}if(e.overlay&&(s=c.length,t(e.tree,e.overlay[0].from+i),c.length>s))return}for(a=0;a<n.children.length;a++)(f=n.children[a])instanceof x&&t(f,n.positions[a]+i)}})(R(n),0),c):[]}},{key:"allowsNesting",get:function t(){return!0}}]),r}()).setState=v.define(),t=function(t){f(r,t);var e=S(r);function r(t,n,i){var t;return A(this,r),(t=e.call(this,t,n,[],i)).parser=n,t}return D(r,[{key:"configure",value:function t(n,i){return new r(this.data,this.parser.configure(n),i||this.name)}},{key:"allowsNesting",get:function t(){return this.parser.hasWrappers()}}],[{key:"define",value:function t(n){var i=wv(n.languageData);return new r(i,n.parser.configure({props:[qr.add(function(t){return t.isTop?i:void 0})]}),n.name)}}]),r}(Jr),Kr=function(){function n(t){A(this,n),this.doc=t,this.cursorPos=0,this.string="",this.cursor=t.iter()}return D(n,[{key:"length",get:function t(){return this.doc.length}},{key:"syncTo",value:function t(n){return this.string=this.cursor.next(n-this.cursorPos).value,this.cursorPos=n+this.string.length,this.cursorPos-this.string.length}},{key:"chunk",value:function t(n){return this.syncTo(n),this.string}},{key:"lineChunks",get:function t(){return!0}},{key:"read",value:function t(n,i){var e=this.cursorPos-this.string.length;return n<e||i>=this.cursorPos?this.doc.sliceString(n,i):this.string.slice(n-e,i-e)}}]),n}(),Qr=null,Xr=function(){function d(t,n){var i,e,r,o,u,s,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:[],e=3<arguments.length?arguments[3]:void 0,r=4<arguments.length?arguments[4]:void 0,o=5<arguments.length?arguments[5]:void 0,u=6<arguments.length?arguments[6]:void 0,s=7<arguments.length?arguments[7]:void 0;A(this,d),this.parser=t,this.state=n,this.fragments=i,this.tree=e,this.treeLen=r,this.viewport=o,this.skipped=u,this.scheduleOn=s,this.parse=null,this.tempSkipped=[]}return D(d,[{key:"startParse",value:function t(){return this.parser.startParse(new Kr(this.state.doc),this.fragments)}},{key:"work",value:function t(e,r){var o=this;return null!=r&&r>=this.state.doc.length&&(r=void 0),this.tree!=x.empty&&this.isDone(null!=r?r:this.state.doc.length)?(this.takeTree(),!0):this.withContext(function(){var t,n,i;for("number"==typeof e&&(n=Date.now()+e,e=function t(){return Date.now()>n}),o.parse||(o.parse=o.startParse()),null!=r&&(null==o.parse.stoppedAt||o.parse.stoppedAt>r)&&r<o.state.doc.length&&o.parse.stopAt(r);;){if(i=o.parse.advance()){if(o.fragments=o.withoutTempSkipped(Er.addTree(i,o.fragments,null!=o.parse.stoppedAt)),o.treeLen=null!=(t=o.parse.stoppedAt)?t:o.state.doc.length,o.tree=i,o.parse=null,!(o.treeLen<(null!=r?r:o.state.doc.length)))return!0;o.parse=o.startParse()}if(e())return!1}})}},{key:"takeTree",value:function t(){var n,i,e,n=this;this.parse&&(i=this.parse.parsedPos)>=this.treeLen&&((null==this.parse.stoppedAt||this.parse.stoppedAt>i)&&this.parse.stopAt(i),this.withContext(function(){for(;!(e=n.parse.advance()););}),this.treeLen=i,this.tree=e,this.fragments=this.withoutTempSkipped(Er.addTree(this.tree,this.fragments,!0)),this.parse=null)}},{key:"withContext",value:function t(n){var i=Qr;Qr=this;try{return n()}finally{Qr=i}}},{key:"withoutTempSkipped",value:function t(n){for(var i;i=this.tempSkipped.pop();)n=jv(n,i.from,i.to);return n}},{key:"changes",value:function t(n,i){var e,r,o,u,s,a,f,h,c,l,v,e=this.fragments,r=this.tree,o=this.treeLen,u=this.viewport,s=this.skipped;if(this.takeTree(),!n.empty&&(a=[],n.iterChangedRanges(function(t,n,i,e){return a.push({fromA:t,toA:n,fromB:i,toB:e})}),e=Er.applyChanges(e,a),r=x.empty,o=0,u={from:n.mapPos(u.from,-1),to:n.mapPos(u.to,1)},this.skipped.length)){s=[],f=F(this.skipped);try{for(f.s();!(h=f.n()).done;)c=h.value,(l=n.mapPos(c.from,1))<(v=n.mapPos(c.to,-1))&&s.push({from:l,to:v})}catch(t){f.e(t)}finally{f.f()}}return new d(this.parser,i,e,r,o,u,s,this.scheduleOn)}},{key:"updateViewport",value:function t(n){var i,e,r,o,r;if(this.viewport.from==n.from&&this.viewport.to==n.to)return!1;for(this.viewport=n,i=this.skipped.length,e=0;e<this.skipped.length;e++)o=(r=this.skipped[e]).from,r=r.to,o<n.to&&r>n.from&&(this.fragments=jv(this.fragments,o,r),this.skipped.splice(e--,1));return!(this.skipped.length>=i||(this.reset(),0))}},{key:"reset",value:function t(){this.parse&&(this.takeTree(),this.parse=null)}},{key:"skipUntilInView",value:function t(n,i){this.skipped.push({from:n,to:i})}},{key:"isDone",value:function t(n){n=Math.min(n,this.state.doc.length);var i=this.fragments;return this.treeLen>=n&&i.length&&0==i[0].from&&i[0].to>=n}}],[{key:"create",value:function t(n,i,e){return new d(n,i,[],x.empty,0,e,[],null)}},{key:"getSkippingParser",value:function t(a){return new(function(t){f(i,t);var n=S(i);function i(){return A(this,i),n.apply(this,arguments)}return D(i,[{key:"createParse",value:function t(n,i,o){var u,s,e,u=o[0].from,s=o[o.length-1].to,e;return{parsedPos:u,advance:function t(){var n,i,e,r,n=Qr;if(n){i=F(o);try{for(i.s();!(e=i.n()).done;)r=e.value,n.tempSkipped.push(r)}catch(t){i.e(t)}finally{i.f()}a&&(n.scheduleOn=n.scheduleOn?Promise.all([n.scheduleOn,a]):a)}return this.parsedPos=s,new x(kr.none,[],[],s-u)},stoppedAt:null,stopAt:function t(){}}}}]),i}(Ar))}},{key:"get",value:function t(){return Qr}}]),d}(),Zr=function(){function e(t){A(this,e),this.context=t,this.tree=t.tree}return D(e,[{key:"apply",value:function t(n){var i,n;return n.docChanged||this.tree!=this.context.tree?(i=this.context.changes(n.changes,n.state),n=this.context.treeLen==n.startState.doc.length?void 0:Math.max(n.changes.mapPos(this.context.treeLen),i.viewport.to),i.work(20,n)||i.takeTree(),new e(i)):this}}],[{key:"init",value:function t(n){var i,n,i=Math.min(3e3,n.doc.length),n=Xr.create(n.facet(io).parser,n,{from:0,to:i});return n.work(20,i)||n.takeTree(),new e(n)}}]),e}(),Jr.state=b.define({create:Zr.init,update:function t(n,i){var e,r,o,e=F(i.effects);try{for(e.s();!(r=e.n()).done;)if((o=r.value).is(Jr.setState))return o.value}catch(t){e.e(t)}finally{e.f()}return i.startState.facet(io)!=i.state.facet(io)?Zr.init(i.state):n.apply(i)}}),Yr=function t(n){var i=setTimeout(function(){return n()},500);return function(){return clearTimeout(i)}},"undefined"!=typeof requestIdleCallback&&(Yr=function t(n){var i=-1,e=setTimeout(function(){i=requestIdleCallback(n,{timeout:400})},100);return function(){return i<0?clearTimeout(e):cancelIdleCallback(i)}}),to="undefined"!=typeof navigator&&null!=(Yt=navigator.scheduling)&&Yt.isInputPending?function(){return navigator.scheduling.isInputPending()}:null,no=d.fromClass(function(){function n(t){A(this,n),this.view=t,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}return D(n,[{key:"update",value:function t(n){var i=this.view.state.field(Jr.state).context;(i.updateViewport(n.view.viewport)||this.view.viewport.to>i.treeLen)&&this.scheduleWork(),n.docChanged&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(i)}},{key:"scheduleWork",value:function t(){var n,i;this.working||(i=(n=this.view.state).field(Jr.state)).tree==i.context.tree&&i.context.isDone(n.doc.length)||(this.working=Yr(this.work))}},{key:"work",value:function t(n){var i,e,r,e,o,u,n,r;this.working=null,i=Date.now(),this.chunkEnd<i&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=i+3e4,this.chunkBudget=3e3),this.chunkBudget<=0||(r=(e=this.view).state,e=e.viewport.to,(o=r.field(Jr.state)).tree==o.context.tree&&o.context.isDone(e+1e5))||(u=Date.now()+Math.min(this.chunkBudget,100,n&&!to?Math.max(25,n.timeRemaining()-5):1e9),n=o.context.treeLen<e&&r.doc.length>e+1e3,r=o.context.work(function(){return to&&to()||Date.now()>u},e+(n?0:1e5)),this.chunkBudget-=Date.now()-i,(r||this.chunkBudget<=0)&&(o.context.takeTree(),this.view.dispatch({effects:Jr.setState.of(new Zr(o.context))})),0<this.chunkBudget&&(!r||n)&&this.scheduleWork(),this.checkAsyncSchedule(o.context))}},{key:"checkAsyncSchedule",value:function t(n){var i=this;n.scheduleOn&&(this.workScheduled++,n.scheduleOn.then(function(){return i.scheduleWork()}).catch(function(t){return Wc(i.view.state,t)}).then(function(){return i.workScheduled--}),n.scheduleOn=null)}},{key:"destroy",value:function t(){this.working&&this.working()}},{key:"isWorking",value:function t(){return!!(this.working||0<this.workScheduled)}}]),n}(),{eventHandlers:{focus:function t(){this.scheduleWork()}}}),io=y.define({combine:function t(n){return n.length?n[0]:null},enables:function t(n){return[Jr.state,no,w.contentAttributes.compute([n],function(t){var t=t.facet(n);return t&&t.name?{"data-language":t.name}:{}})]}}),Zt=D(function t(n){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[];A(this,t),this.language=n,this.support=i,this.extension=[n,i]}),e=function(){function u(t,n,i,e,r){var o=5<arguments.length&&void 0!==arguments[5]?arguments[5]:void 0;A(this,u),this.name=t,this.alias=n,this.extensions=i,this.filename=e,this.loadFunc=r,this.support=o,this.loading=null}return D(u,[{key:"load",value:function t(){var n=this;return this.loading||(this.loading=this.loadFunc().then(function(t){return n.support=t},function(t){throw n.loading=null,t}))}}],[{key:"of",value:function t(n){var i=n.load,e=n.support;if(!i){if(!e)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");i=function t(){return Promise.resolve(e)}}return new u(n.name,(n.alias||[]).concat(n.name).map(function(t){return t.toLowerCase()}),n.extensions||[],n.filename,i,e)}},{key:"matchFilename",value:function t(n,i){var e,r,o,u,s,a,f,e=F(n);try{for(e.s();!(r=e.n()).done;)if((o=r.value).filename&&o.filename.test(i))return o}catch(t){e.e(t)}finally{e.f()}if(u=/\.([^.]+)$/.exec(i)){s=F(n);try{for(s.s();!(a=s.n()).done;)if(-1<(f=a.value).extensions.indexOf(u[1]))return f}catch(t){s.e(t)}finally{s.f()}}return null}},{key:"matchLanguageName",value:function t(n,i){var e,r,o,u,s,a,f,h,c,l,v,e=!(2<arguments.length&&void 0!==arguments[2])||arguments[2];i=i.toLowerCase(),r=F(n);try{for(r.s();!(o=r.n()).done;)if((u=o.value).alias.some(function(t){return t==i}))return u}catch(t){r.e(t)}finally{r.f()}if(e){s=F(n);try{for(s.s();!(a=s.n()).done;){h=F((f=a.value).alias);try{for(h.s();!(c=h.n()).done;)if(l=c.value,-1<(v=i.indexOf(l))&&(2<l.length||!/\w/.test(i[v-1])&&!/\w/.test(i[v+l.length])))return f}catch(t){h.e(t)}finally{h.f()}}}catch(t){s.e(t)}finally{s.f()}}return null}}]),u}(),eo=y.define(),ro=y.define({combine:function t(n){if(!n.length)return" ";var i=n[0];if(!i||/\S/.test(i)||Array.from(i).some(function(t){return t!=i[0]}))throw new Error("Invalid indent unit: "+JSON.stringify(n[0]));return i}}),uo=new M,so=function(t){f(o,t);var r=S(o);function o(t,n,i){var e;return A(this,o),(e=r.call(this,t.state,t.options)).base=t,e.pos=n,e.node=i,e}return D(o,[{key:"textAfter",get:function t(){return this.textAfterPos(this.pos)}},{key:"baseIndent",get:function t(){for(var n,i,n=this.state.doc.lineAt(this.node.from);;){for(i=this.node.resolve(n.from);i.parent&&i.parent.from==i.from;)i=i.parent;if(Bv(i,this.node))break;n=this.state.doc.lineAt(i.from)}return this.lineIndent(n.from)}},{key:"continue",value:function t(){var n=this.node.parent;return n?Tv(n,this.pos,this.base):0}}],[{key:"create",value:function t(n,i,e){return new o(n,i,e)}}]),o}(oo=function(){function i(t){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};A(this,i),this.state=t,this.options=n,this.unit=Pv(t)}return D(i,[{key:"lineAt",value:function t(n){var i,e,r,o,r,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1,e=this.state.doc.lineAt(n),r=this.options,o=r.simulateBreak,r=r.simulateDoubleBreak;return null!=o&&o>=e.from&&o<=e.to?r&&o==n?{text:"",from:n}:(i<0?o<n:o<=n)?{text:e.text.slice(o-e.from),from:o}:{text:e.text.slice(0,o-e.from),from:e.from}:e}},{key:"textAfterPos",value:function t(n){var i,e,r,e,i;return this.options.simulateDoubleBreak&&n==this.options.simulateBreak?"":(r=(e=this.lineAt(n,1<arguments.length&&void 0!==arguments[1]?arguments[1]:1)).text,e=e.from,r.slice(n-e,Math.min(r.length,n+100-e)))}},{key:"column",value:function t(n){var i,e,r,e,n,e,i,e=this.lineAt(n,1<arguments.length&&void 0!==arguments[1]?arguments[1]:1),r=e.text,e=e.from,n=this.countColumn(r,n-e),e=this.options.overrideIndentation?this.options.overrideIndentation(e):-1;return-1<e&&(n+=e-this.countColumn(r,r.search(/\S|$/))),n}},{key:"countColumn",value:function t(n){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:n.length;return ic(n,this.state.tabSize,i)}},{key:"lineIndent",value:function t(n){var i,n,e,n,r,r,i,n=this.lineAt(n,1<arguments.length&&void 0!==arguments[1]?arguments[1]:1),e=n.text,n=n.from,r=this.options.overrideIndentation;return r&&-1<(r=r(n))?r:this.countColumn(e,e.search(/\S|$/))}},{key:"simulatedBreak",get:function t(){return this.options.simulateBreak||null}}]),i}()),nn=function t(n){return n.baseIndent},ao=200,fo=y.define(),ho=new M,co=v.define({map:qv}),lo=v.define({map:qv}),vo=b.define({create:function t(){return m.none},update:function t(n,i){var e,r,o,u,s;n=n.map(i.changes),e=F(i.effects);try{for(o=function t(){var e=r.value;e.is(co)&&!Qv(n,e.value.from,e.value.to)?n=n.update({add:[ko.range(e.value.from,e.value.to)]}):e.is(lo)&&(n=n.update({filter:function t(n,i){return e.value.from!=n||e.value.to!=i},filterFrom:e.value.from,filterTo:e.value.to}))},e.s();!(r=e.n()).done;)o()}catch(t){e.e(t)}finally{e.f()}return n=i.selection&&(u=!1,s=i.selection.main.head,n.between(s,s,function(t,n){t<s&&s<n&&(u=!0)}),u)?n.update({filterFrom:s,filterTo:s,filter:function t(n,i){return i<=s||s<=n}}):n},provide:function t(n){return w.decorations.from(n)},toJSON:function t(n,i){var e=[];return n.between(0,i.doc.length,function(t,n){e.push(t,n)}),e},fromJSON:function t(n){var i,e,r,o;if(!Array.isArray(n)||n.length%2)throw new RangeError("Invalid JSON for fold state");for(i=[],e=0;e<n.length;){if(r=n[e++],o=n[e++],"number"!=typeof r||"number"!=typeof o)throw new RangeError("Invalid JSON for fold state");i.push(ko.range(r,o))}return m.set(i,!0)}}),o=function t(n){var i,e,r,o,u,s,i=[],e=F(Gv(n));try{for(e.s();!(r=e.n()).done;)o=r.value,(u=Kv(n.state,o.from,o.to))?i.push(lo.of(u),Zv(n,u,!1)):(s=Yv(n,o))&&i.push(co.of(s),Zv(n,s))}catch(t){e.e(t)}finally{e.f()}return 0<i.length&&n.dispatch({effects:Xv(n.state,i)}),!!i.length},yo=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:u=function t(n){var i,e,r,o,i=F(Gv(n));try{for(i.s();!(e=i.n()).done;)if(r=e.value,o=$v(n.state,r.from,r.to))return n.dispatch({effects:Xv(n.state,[co.of(o),Zv(n,o)])}),!0}catch(t){i.e(t)}finally{i.f()}return!1}},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:Hr=function t(n){var i,e,r,o,u;if(!n.state.field(vo,!1))return!1;i=[],e=F(Gv(n));try{for(e.s();!(r=e.n()).done;)o=r.value,(u=Kv(n.state,o.from,o.to))&&i.push(lo.of(u),Zv(n,u,!1))}catch(t){e.e(t)}finally{e.f()}return i.length&&n.dispatch({effects:i}),0<i.length}},{key:"Ctrl-Alt-[",run:zr=function t(n){for(var i,e,r,o,u,i=n.state,e=[],r=0;r<i.doc.length;)(u=$v(i,(o=n.lineBlockAt(r)).from,o.to))&&e.push(co.of(u)),r=(u?n.lineBlockAt(u.to):o).to+1;return e.length&&n.dispatch({effects:Xv(n.state,e)}),!!e.length}},{key:"Ctrl-Alt-]",run:Wr=function t(n){var i,e,i=n.state.field(vo,!1);return!(!i||!i.size||(e=[],i.between(0,n.state.doc.length,function(t,n){e.push(lo.of({from:t,to:n}))}),n.dispatch({effects:e}),0))}}],mo={placeholderDOM:null,placeholderText:"\u2026"},po=y.define({combine:function t(n){return qh(n,mo)}}),ko=m.replace({widget:new(function(t){f(i,t);var n=S(i);function i(){return A(this,i),n.apply(this,arguments)}return D(i,[{key:"toDOM",value:function t(e){var n,i,r,o,n=e.state,i=n.facet(po),r=function t(n){var i,i,i=e.lineBlockAt(e.posAtDOM(n.target)),i=Kv(e.state,i.from,i.to);i&&e.dispatch({effects:lo.of(i)}),n.preventDefault()};return i.placeholderDOM?i.placeholderDOM(e,r):((o=document.createElement("span")).textContent=i.placeholderText,o.setAttribute("aria-label",n.phrase("folded code")),o.title=n.phrase("unfold"),o.className="cm-foldPlaceholder",o.onclick=r,o)}}]),i}(tn))}),go={openText:"\u2304",closedText:"\u203a",markerDOM:null,domEventHandlers:{},foldingChanged:function t(){return!1}},wo=function(t){f(r,t);var e=S(r);function r(t,n){var i;return A(this,r),(i=e.call(this)).config=t,i.open=n,i}return D(r,[{key:"eq",value:function t(n){return this.config==n.config&&this.open==n.open}},{key:"toDOM",value:function t(n){var i;return this.config.markerDOM?this.config.markerDOM(this.open):((i=document.createElement("span")).textContent=this.open?this.config.openText:this.config.closedText,i.title=n.state.phrase(this.open?"Fold line":"Unfold line"),i)}}]),r}(en),bo=w.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}}),Mo=function(){function u(t,n){var i,e,r;function o(t){var n=Ft.newName();return(i=i||Object.create(null))["."+n]=t,n}A(this,u),this.specs=t,e="string"==typeof n.all?n.all:n.all?o(n.all):void 0,r=n.scope,this.scope=r instanceof Jr?function(t){return t.prop(qr)==r.data}:r?function(t){return t==r}:void 0,this.style=mv(t.map(function(t){return{tag:t.tag,class:t.class||o(Object.assign({},t,{tag:null}))}}),{all:e}).style,this.module=i?new Ft(i):null,this.themeType=n.themeType}return D(u,null,[{key:"define",value:function t(n,i){return new u(n,i||{})}}]),u}(),xo=y.define(),So=y.define({combine:function t(n){return n.length?[n[0]]:null}}),Vr=function(){function n(t){A(this,n),this.markCache=Object.create(null),this.tree=R(t.state),this.decorations=this.buildDeco(t,id(t.state))}return D(n,[{key:"update",value:function t(n){var i,e,r,i=R(n.state),e=id(n.state),r=e!=id(n.startState);i.length<n.view.viewport.to&&!r&&i.type==this.tree.type?this.decorations=this.decorations.map(n.changes):(i!=this.tree||n.viewportChanged||r)&&(this.tree=i,this.decorations=this.buildDeco(n.view,e))}},{key:"buildDeco",value:function t(n,i){var e,r,o,u,s,a,f,e=this;if(!i||!this.tree.length)return m.none;r=new Et,o=F(n.visibleRanges);try{for(o.s();!(u=o.n()).done;)a=(s=u.value).from,f=s.to,kv(this.tree,i,function(t,n,i){r.add(t,n,e.markCache[i]||(e.markCache[i]=m.mark({class:i})))},a,f)}catch(t){o.e(t)}finally{o.f()}return r.finish()}}]),n}(),Co=st.high(d.fromClass(Vr,{decorations:function t(n){return n.decorations}})),jo=Mo.define([{tag:a.meta,color:"#404740"},{tag:a.link,textDecoration:"underline"},{tag:a.heading,textDecoration:"underline",fontWeight:"bold"},{tag:a.emphasis,fontStyle:"italic"},{tag:a.strong,fontWeight:"bold"},{tag:a.strikethrough,textDecoration:"line-through"},{tag:a.keyword,color:"#708"},{tag:[a.atom,a.bool,a.url,a.contentSeparator,a.labelName],color:"#219"},{tag:[a.literal,a.inserted],color:"#164"},{tag:[a.string,a.deleted],color:"#a11"},{tag:[a.regexp,a.escape,a.special(a.string)],color:"#e40"},{tag:a.definition(a.variableName),color:"#00f"},{tag:a.local(a.variableName),color:"#30a"},{tag:[a.typeName,a.namespace],color:"#085"},{tag:a.className,color:"#167"},{tag:[a.special(a.variableName),a.macroName],color:"#256"},{tag:a.definition(a.propertyName),color:"#00c"},{tag:a.comment,color:"#940"},{tag:a.invalid,color:"#f00"}]),Ur=w.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Po=1e4,Oo="()[]{}",Eo=y.define({combine:function t(n){return qh(n,{afterCursor:!0,brackets:Oo,maxScanDistance:Po,renderMatch:od})}}),Ao=m.mark({class:"cm-matchingBracket"}),Do=m.mark({class:"cm-nonmatchingBracket"}),Io=[Ro=b.define({create:function t(){return m.none},update:function t(n,i){var e,r,o,u,s,a;if(!i.docChanged&&!i.selection)return n;e=[],r=i.state.facet(Eo),o=F(i.state.selection.ranges);try{for(o.s();!(u=o.n()).done;)(s=u.value).empty&&(a=fd(i.state,s.head,-1,r)||0<s.head&&fd(i.state,s.head-1,1,r)||r.afterCursor&&(fd(i.state,s.head,1,r)||s.head<i.state.doc.length&&fd(i.state,s.head+1,-1,r)))&&(e=e.concat(r.renderMatch(a,i.state)))}catch(t){o.e(t)}finally{o.f()}return m.set(e,!0)},provide:function t(n){return w.decorations.from(n)}}),Ur],To=new M,Lo=function(){function r(t,n,i,e){A(this,r),this.string=t,this.tabSize=n,this.indentUnit=i,this.overrideIndent=e,this.pos=0,this.start=0,this.lastColumnPos=0,this.lastColumnValue=0}return D(r,[{key:"eol",value:function t(){return this.pos>=this.string.length}},{key:"sol",value:function t(){return 0==this.pos}},{key:"peek",value:function t(){return this.string.charAt(this.pos)||void 0}},{key:"next",value:function t(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)}},{key:"eat",value:function t(n){var i,n,i=this.string.charAt(this.pos),n="string"==typeof n?i==n:i&&(n instanceof RegExp?n.test(i):n(i));if(n)return++this.pos,i}},{key:"eatWhile",value:function t(n){for(var i=this.pos;this.eat(n););return this.pos>i}},{key:"eatSpace",value:function t(){for(var n=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>n}},{key:"skipToEnd",value:function t(){this.pos=this.string.length}},{key:"skipTo",value:function t(n){var n=this.string.indexOf(n,this.pos);if(-1<n)return this.pos=n,!0}},{key:"backUp",value:function t(n){this.pos-=n}},{key:"column",value:function t(){return this.lastColumnPos<this.start&&(this.lastColumnValue=ld(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue}},{key:"indentation",value:function t(){var n;return null!=(n=this.overrideIndent)?n:ld(this.string,null,this.tabSize)}},{key:"match",value:function t(n,i,e){var r,o,t;return"string"==typeof n?(r=function t(n){return e?n.toLowerCase():n})(o=this.string.substr(this.pos,n.length))==r(n)?(!1!==i&&(this.pos+=n.length),!0):null:(t=this.string.slice(this.pos).match(n))&&0<t.index?null:(t&&!1!==i&&(this.pos+=t[0].length),t)}},{key:"current",value:function t(){return this.string.slice(this.start,this.pos)}}]),r}(),Bo=new WeakMap,Nr=function(t){f(s,t);var u=S(s);function s(t){var i,n,e,r,o;return A(this,s),n=wv(t.languageData),e=vd(t),o=new(function(t){f(i,t);var n=S(i);function i(){return A(this,i),n.apply(this,arguments)}return D(i,[{key:"createParse",value:function t(n,i,e){return new _o(r,n,i,e)}}]),i}(Ar)),(i=u.call(this,n,o,[eo.of(function(t,n){return i.getIndent(t,n)})],t.name)).topNode=bd(n),r=eh(i),i.streamParser=e,i.stateAfter=new M({perNode:!0}),i.tokenTable=t.tokenTable?new Go(e.tokenTable):Jo,i}return D(s,[{key:"getIndent",value:function t(n,i){for(var e,r,o,u,e,s,a,f,h,c,l,e,e=R(n.state),r=e.resolve(i);r&&r.type!=this.topNode;)r=r.parent;if(!r)return null;if(o=void 0,(u=n.options.overrideIndentation)&&null!=(o=Bo.get(n.state))&&o<i-1e4&&(o=void 0),1e4<i-(s=(e=yd(this,e,0,r.from,null!=o?o:i))?(a=e.state,e.pos+1):(a=this.streamParser.startState(n.unit),0)))return null;for(;s<i;){if(f=n.state.doc.lineAt(s),h=Math.min(i,f.to),f.length)for(c=u?u(f.from):-1,l=new Lo(f.text,n.state.tabSize,n.unit,c<0?void 0:c);l.pos<h-f.from;)kd(this.streamParser.token,l,a);else this.streamParser.blankLine(a,n.unit);if(h==i)break;s=f.to+1}return e=n.lineAt(i),u&&null==o&&Bo.set(n.state,e.from),this.streamParser.indent(a,/^\s*(.*)/.exec(e.text)[1],n)}},{key:"allowsNesting",get:function t(){return!1}}],[{key:"define",value:function t(n){return new s(n)}}]),s}(Jr),_o=function(){function u(t,n,i,e){var n,t,i,e,r,o;for(A(this,u),this.lang=t,this.input=n,this.fragments=i,this.ranges=e,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=e[e.length-1].to,n=Xr.get(),e=(i=pd(t,i,t=e[0].from,null==n?void 0:n.state)).state,r=i.tree,this.state=e,this.parsedPos=this.chunkStart=t+r.length,o=0;o<r.children.length;o++)this.chunks.push(r.children[o]),this.chunkPos.push(r.positions[o]);n&&this.parsedPos<n.viewport.from-1e5&&(this.state=this.lang.streamParser.startState(Pv(n.state)),n.skipUntilInView(this.parsedPos,n.viewport.from),this.parsedPos=n.viewport.from),this.moveRangeIndex()}return D(u,[{key:"advance",value:function t(){var n,i,e,n=Xr.get(),i=null==this.stoppedAt?this.to:Math.min(this.to,this.stoppedAt),e=Math.min(i,this.chunkStart+2048);for(n&&(e=Math.min(e,n.viewport.to));this.parsedPos<e;)this.parseLine(n);return this.chunkStart<this.parsedPos&&this.finishChunk(),this.parsedPos>=i?this.finish():n&&this.parsedPos>=n.viewport.to?(n.skipUntilInView(this.parsedPos,i),this.finish()):null}},{key:"stopAt",value:function t(n){this.stoppedAt=n}},{key:"lineAfter",value:function t(n){var i,e,i=this.input.chunk(n);return this.input.lineChunks?"\n"==i&&(i=""):-1<(e=i.indexOf("\n"))&&(i=i.slice(0,e)),n+i.length<=this.to?i:i.slice(0,this.to-n)}},{key:"nextLine",value:function t(){for(var n,i,e,r,o,o,u,n=this.parsedPos,i=this.lineAfter(n),e=n+i.length,r=this.rangeIndex;!(e<=(o=this.ranges[r].to))&&(i=i.slice(0,o-(e-i.length)),++r!=this.ranges.length);)o=this.ranges[r].from,i+=u=this.lineAfter(o),e=o+u.length;return{line:i,end:e}}},{key:"skipGapsTo",value:function t(n,i,e){for(var r,o,u;r=this.ranges[this.rangeIndex].to,o=n+i,!(0<e?o<r:o<=r);)i+=(u=this.ranges[++this.rangeIndex].from)-r;return i}},{key:"moveRangeIndex",value:function t(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}},{key:"emitToken",value:function t(n,i,e,r,o){var u;return 1<this.ranges.length&&(i+=o=this.skipGapsTo(i,o,1),u=this.chunk.length,e+=o=this.skipGapsTo(e,o,-1),r+=this.chunk.length-u),this.chunk.push(n,i,e,r),o}},{key:"parseLine",value:function t(n){var i,e,i,r,o,u,s,i=this.nextLine(),e=i.line,i=i.end,r=0,o=this.lang.streamParser,u=new Lo(e,n?n.state.tabSize:4,n?Pv(n.state):2);if(u.eol())o.blankLine(this.state,u.indentUnit);else for(;!(u.eol()||((s=kd(o.token,u,this.state))&&(r=this.emitToken(this.lang.tokenTable.resolve(s),this.parsedPos+u.start,this.parsedPos+u.pos,4,r)),1e4<u.start)););this.parsedPos=i,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}},{key:"finishChunk",value:function t(){var n=x.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:Uo,topID:0,maxBufferLength:2048,reused:this.chunkReused}),n=new x(n.type,n.children,n.positions,n.length,[[this.lang.stateAfter,this.lang.streamParser.copyState(this.state)]]);this.chunks.push(n),this.chunkPos.push(this.chunkStart-this.ranges[0].from),this.chunk=[],this.chunkReused=void 0,this.chunkStart=this.parsedPos}},{key:"finish",value:function t(){return new x(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}}]),u}(),Fo=Object.create(null),No=[kr.none],Uo=new n(No),Ho=[],zo=Object.create(null),Wo=0,Vo=[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]];Wo<Vo.length;Wo++)qo=($o=Gf(Vo[Wo],2))[0],$o=$o[1],zo[qo]=wd(Fo,$o);function gd(t,n){-1<Ho.indexOf(t)||(Ho.push(t),console.warn(n))}function wd(t,n){var i,e,r,o,u,n,n,i=null,e=F(n.split("."));try{for(e.s();!(r=e.n()).done;)(u=t[o=r.value]||a[o])?"function"==typeof u?i?i=u(i):gd(o,"Modifier ".concat(o," used at start of tag")):i?gd(o,"Tag ".concat(o," used as modifier")):i=u:gd(o,"Unknown highlighting tag ".concat(o))}catch(t){e.e(t)}finally{e.f()}return i?(n=n.replace(/ /g,"_"),n=kr.define({id:No.length,name:n,props:[yv(zf({},n,i))]}),No.push(n),n.id):0}function bd(t){var n=kr.define({id:No.length,name:"Document",props:[qr.add(function(){return t})]});return No.push(n),n}function Md(t){var t,n,t=Object.keys(t).join(""),n=/\w/.test(t);return n&&(t=t.replace(/\w/g,"")),"[".concat(n?"\\w":"").concat(t.replace(/[^\w\s]/g,"\\$&"),"]")}function xd(t){var n,i,e,r,o,u,t,n=Object.create(null),i=Object.create(null),e=F(t);try{for(e.s();!(r=e.n()).done;)for(n[(o=r.value.label)[0]]=!0,u=1;u<o.length;u++)i[o[u]]=!0}catch(t){e.e(t)}finally{e.f()}return t=Md(n)+Md(i)+"*$",[new RegExp("^"+t),new RegExp(t)]}function Sd(t){var i,n,t,e,r,i=t.map(function(t){return"string"==typeof t?{label:t}:t}),n,t=Gf(i.every(function(t){return/^\w+$/.test(t.label)})?[/\w*$/,/\w+$/]:xd(i),2),e=t[0],r=t[1];return function(t){var n=t.matchBefore(r);return n||t.explicit?{from:n?n.from:t.pos,options:i,validFor:e}:null}}function Cd(i,e){return function(t){for(var n=R(t.state).resolveInner(t.pos,-1);n;n=n.parent){if(-1<i.indexOf(n.name))return e(t);if(n.type.isTop)break}return null}}function jd(i,e){return function(t){for(var n=R(t.state).resolveInner(t.pos,-1);n;n=n.parent){if(-1<i.indexOf(n.name))return null;if(n.type.isTop)break}return e(t)}}function Pd(t){return t.selection.main.from}function Od(t,n){var n,i,n,e,i=t.source,n=n&&"^"!=i[0],e="$"!=i[i.length-1];return n||e?new RegExp("".concat(n?"^":"","(?:").concat(i,")").concat(e?"$":""),null!=(n=t.flags)?n:t.ignoreCase?"i":""):t}function Ed(n,i,e,r){var o=n.selection.main,u=e-o.from,s=r-o.from;return Object.assign(Object.assign({},n.changeByRange(function(t){return t!=o&&e!=r&&n.sliceDoc(t.from+u,t.from+s)!=n.sliceDoc(e,r)?{range:t}:{changes:{from:t.from+u,to:r==o.from?t.to:t.from+s,insert:i},range:O.cursor(t.from+u+i.length)}})),{userEvent:"input.complete"})}function Ad(t){var n;return Array.isArray(t)?((n=Yo.get(t))||Yo.set(t,n=Sd(t)),n):t}function Dd(t,n){return t?n?t+" "+n:t:n}function Rd(t,n,i,e,r){var t,o,u,s,a,f,h,c,l,e,l,t=t.textDirection==E.RTL,o=t,u=!1,s="top",h=n.left-r.left,c=r.right-n.right,l=e.right-e.left,e=e.bottom-e.top;return o&&h<Math.min(l,c)?o=!1:!o&&c<Math.min(l,h)&&(o=!0),l<=(o?h:c)?(a=Math.max(r.top,Math.min(i.top,r.bottom-e))-n.top,f=Math.min(400,o?h:c)):(u=!0,f=Math.min(400,(t?n.right:r.right-n.left)-30),a=e<=(l=r.bottom-n.bottom)||l>n.top?i.bottom-n.top:(s="bottom",n.bottom-i.top)),{style:"".concat(s,": ").concat(a,"px; max-width: ").concat(f,"px"),class:"cm-completionInfo-"+(u?t?"left-narrow":"right-narrow":o?"left":"right")}}function Id(r){var o=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"option";return function(t){var n,i,e,e,n,n=t.state.field(ku,!1);return!(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp<t.state.facet(eu).interactionDelay||(i=1,"page"==o&&(e=N0(t,n.open.tooltip))&&(i=Math.max(2,Math.floor(e.dom.offsetHeight/e.dom.querySelector("li").offsetHeight)-1)),e=n.open.options.length,(n=-1<n.open.selected?n.open.selected+i*(r?1:-1):r?0:e-1)<0?n="page"==o?0:e-1:e<=n&&(n="page"==o?e-1:0),t.dispatch({effects:pu.of(n)}),0))}}function Td(t,n){var i,e,i=n.completion.apply||n.completion.label,e=t.state.field(ku).active.find(function(t){return t.source==n.source});return e instanceof yu&&("string"==typeof i?t.dispatch(Object.assign(Object.assign({},Ed(t.state,i,e.from,e.to)),{annotations:Zo.of(n.completion)})):i(t,n.completion,e.from,e.to),!0)}function Ld(t){var n=t.addToOptions.slice();return t.icons&&n.push({render:function t(n){var i,e,e=document.createElement("div");return e.classList.add("cm-completionIcon"),n.type&&(i=e.classList).add.apply(i,Wf(n.type.split(/\s+/g).map(function(t){return"cm-completionIcon-"+t}))),e.setAttribute("aria-hidden","true"),e},position:20}),n.push({render:function t(n,i,e){var r,o,u,s,a,f,h,r=document.createElement("span");for(r.className="cm-completionLabel",o=n.label,u=0,s=1;s<e.length;)a=e[s++],f=e[s++],u<a&&r.appendChild(document.createTextNode(o.slice(u,a))),(h=r.appendChild(document.createElement("span"))).appendChild(document.createTextNode(o.slice(a,f))),h.className="cm-completionMatchedText",u=f;return u<o.length&&r.appendChild(document.createTextNode(o.slice(u))),r},position:50},{render:function t(n){var i;return n.detail?((i=document.createElement("span")).className="cm-completionDetail",i.textContent=n.detail,i):null},position:80}),n.sort(function(t,n){return t.position-n.position}).map(function(t){return t.render})}function Bd(t,n,i){var e,e;return t<=i?{from:0,to:t}:(n=n<0?0:n)<=t>>1?{from:(e=Math.floor(n/i))*i,to:(e+1)*i}:{from:t-((e=Math.floor((t-n)/i))+1)*i,to:t-e*i}}function _d(n){return function(t){return new fu(t,n)}}function Fd(t,n){var i,n,i=t.getBoundingClientRect(),n=n.getBoundingClientRect();n.top<i.top?t.scrollTop-=i.top-n.top:n.bottom>i.bottom&&(t.scrollTop+=n.bottom-i.bottom)}function Nd(t){return 100*(t.boost||0)+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function Ud(t,n){var e,r,i,o,u,s,a,f,h,c,l,v,d,y,m,p,k,g,w,b,M,B,x,S,C,j,P,O,E,A,D,R,I,T,L,e=[],r=null,i=function t(n){var n,i;e.push(n),(n=n.completion.section)&&(r=r||[],i="string"==typeof n?n:n.name,r.some(function(t){return t.name==i})||r.push("string"==typeof n?{name:i}:n))},o=F(t);try{for(o.s();!(u=o.n()).done;)if((s=u.value).hasResult())if(!1===s.result.filter){a=s.result.getMatch,f=F(s.result.options);try{for(f.s();!(h=f.n()).done;){if(c=h.value,l=[1e9-e.length],a){v=F(a(c));try{for(v.s();!(d=v.n()).done;)y=d.value,l.push(y)}catch(t){v.e(t)}finally{v.f()}}i(new Xo(c,s.source,l,l[0]))}}catch(t){f.e(t)}finally{f.f()}}else{m=new iu(n.sliceDoc(s.from,s.to)),p=void 0,k=F(s.result.options);try{for(k.s();!(g=k.n()).done;)w=g.value,(p=m.match(w.label))&&i(new Xo(w,s.source,p,p[0]+(w.boost||0)))}catch(t){k.e(t)}finally{k.f()}}}catch(t){o.e(t)}finally{o.f()}if(r){b=Object.create(null),M=0,x=F(r.sort(B=function t(n,i){var e,e;return(null!=(e=n.rank)?e:1e9)-(null!=(e=i.rank)?e:1e9)||(n.name<i.name?-1:1)}));try{for(x.s();!(S=x.n()).done;)C=S.value,M-=1e5,b[C.name]=M}catch(t){x.e(t)}finally{x.f()}j=F(e);try{for(j.s();!(P=j.n()).done;)(E=(O=P.value).completion.section)&&(O.score+=b["string"==typeof E?E:E.name])}catch(t){j.e(t)}finally{j.f()}}A=[],D=null,R=n.facet(eu).compareCompletions,I=F(e.sort(function(t,n){return n.score-t.score||R(t.completion,n.completion)}));try{for(I.s();!(T=I.n()).done;)L=T.value,!D||D.label!=L.completion.label||D.detail!=L.completion.detail||null!=D.type&&null!=L.completion.type&&D.type!=L.completion.type||D.apply!=L.completion.apply?A.push(L):Nd(L.completion)>Nd(D)&&(A[A.length-1]=L),D=L.completion}catch(t){I.e(t)}finally{I.f()}return A}function Hd(t,n){var i,e,r,o;if(t==n)return 1;for(e=i=0;;){for(;i<t.length&&!t[i].hasResult;)i++;for(;e<n.length&&!n[e].hasResult;)e++;if(r=i==t.length,o=e==n.length,r||o)return r==o;if(t[i++].result!=n[e++].result)return}}function zd(t,n){var i={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return-1<n&&(i["aria-activedescendant"]=t+"-"+n),i}function Wd(t){return t.isUserEvent("input.type")?"input":t.isUserEvent("delete.backward")?"delete":null}function Vd(t,n,i,e){var r;if(t)return r=n.sliceDoc(i,e),"function"==typeof t?t(r,i,e,n):Od(t,!0).test(r)}function $d(t,n){return O.create(t.filter(function(t){return t.field==n}).map(function(t){return O.range(t.from,t.to)}))}function qd(t){var u=Mu.parse(t);return function(t,n,i,e){var r,o,r,i,e,o,r=u.instantiate(t.state,i),o=r.text,r=r.ranges,i={changes:{from:i,to:e,insert:k.of(o)},scrollIntoView:!0,annotations:n?Zo.of(n):void 0};r.length&&(i.selection=$d(r,0)),1<r.length&&(e=new Cu(r,0),o=i.effects=[ju.of(e)],void 0===t.state.field(Ou,!1))&&o.push(v.appendConfig.of([Ou,Du,Ru,gu])),t.dispatch(t.state.update(i))}}function Gd(o){return function(t){var n,t,i,e,r,n=t.state,t=t.dispatch,i=n.field(Ou,!1);return!(!i||o<0&&0==i.active||(e=i.active+o,r=0<o&&!i.ranges.some(function(t){return t.field==e+o}),t(n.update({selection:$d(i.ranges,e),effects:ju.of(r?null:new Cu(i.ranges,e))})),0))}}function Jd(t){var n=t.field(Ou,!1);return!(!n||!n.ranges.some(function(t){return t.field==n.active+1}))}function Kd(t){var t=t.field(Ou,!1);return!!(t&&0<t.active)}function Qd(t,n){return Object.assign(Object.assign({},n),{apply:qd(t)})}function Xd(n){var n=n.replace(/[\\[.+*?(){|^$]/g,"\\$&");try{return new RegExp("[\\p{Alphabetic}\\p{Number}_".concat(n,"]+"),"ug")}catch(t){return new RegExp("[w".concat(n,"]"),"g")}}function Zd(t,n){return new RegExp(n(t.source),t.unicode?"u":"")}function Yd(t){return Iu[t]||(Iu[t]=new WeakMap)}function t1(t,n,i,e,r){for(var o,u,s,a,o=t.iterLines(),u=0;!o.next().done;){for(s=o.value,a=void 0,n.lastIndex=0;a=n.exec(s);)if(!e[a[0]]&&u+a.index!=r&&(i.push({type:"text",label:a[0]}),e[a[0]]=!0,2e3<=i.length))return;u+=s.length+1}}function n1(t,n,i,e,r){var o,u,s,a,f,h,c,l,v,d,y,o=1e3<=t.length,u=o&&n.get(t);if(u)return u;if(s=[],a=Object.create(null),t.children){f=0,h=F(t.children);try{for(h.s();!(c=h.n()).done;){if(1e3<=(l=c.value).length){v=F(n1(l,n,i,e-f,r-f));try{for(v.s();!(d=v.n()).done;)a[(y=d.value).label]||(a[y.label]=!0,s.push(y))}catch(t){v.e(t)}finally{v.f()}}else t1(l,i,s,a,r-f);f+=l.length+1}}catch(t){h.e(t)}finally{h.f()}}else t1(t,i,s,a,r);return o&&s.length<2e3&&n.set(t,s),s}function i1(){return[Uu,_u]}function e1(t){for(var n=0;n<Fu.length;n+=2)if(Fu.charCodeAt(n)==t)return Fu.charAt(n+1);return bh(t<128?t:t+1)}function r1(t,n){return t.languageDataAt("closeBrackets",n)[0]||Tu}function o1(t,n){var i,e,r,o,u,s,i=r1(t,t.selection.main.head),e=i.brackets||Tu.brackets,r=F(e);try{for(r.s();!(o=r.n()).done;){if(s=e1(wh(u=o.value,0)),n==u)return s==u?c1(t,u,-1<e.indexOf(u+u+u),i):f1(t,u,s,i.before||Tu.before);if(n==s&&u1(t,t.selection.main.from))return h1(t,u,s)}}catch(t){r.e(t)}finally{r.f()}return null}function u1(t,n){var i=!1;return t.field(_u).between(0,t.doc.length,function(t){t==n&&(i=!0)}),i}function s1(t,n){var t=t.sliceString(n,n+2);return t.slice(0,Mh(wh(t,0)))}function a1(t,n){var t=t.sliceString(n-2,n);return Mh(wh(t,0))==t.length?t:t.slice(1)}function f1(i,e,r,o){var u=null,t=i.changeByRange(function(t){var n;return t.empty?!(n=s1(i.doc,t.head))||/\s/.test(n)||-1<o.indexOf(n)?{changes:{insert:e+r,from:t.head},effects:Lu.of(t.head+e.length),range:O.cursor(t.head+e.length)}:{range:u=t}:{changes:[{insert:e,from:t.from},{insert:r,from:t.to}],effects:Lu.of(t.to+e.length),range:O.range(t.anchor+e.length,t.head+e.length)}});return u?null:i.update(t,{scrollIntoView:!0,userEvent:"input.type"})}function h1(n,t,i){var e=null,r=n.changeByRange(function(t){return t.empty&&s1(n.doc,t.head)==i?{changes:{from:t.head,to:t.head+i.length,insert:i},range:O.cursor(t.head+i.length)}:e={range:t}});return e?null:n.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function c1(o,u,s,t){var a,f,t,a=t.stringPrefixes||Tu.stringPrefixes,f=null,t=o.changeByRange(function(t){var n,i,e,r,e;if(!t.empty)return{changes:[{insert:u,from:t.from},{insert:u,from:t.to}],effects:Lu.of(t.to+u.length),range:O.range(t.anchor+u.length,t.head+u.length)};if(n=t.head,(i=s1(o.doc,n))==u){if(l1(o,n))return{changes:{insert:u+u,from:n},effects:Lu.of(n+u.length),range:O.cursor(n+u.length)};if(u1(o,n))return{changes:{from:n,to:n+(e=(r=s&&o.sliceDoc(n,n+3*u.length)==u+u+u)?u+u+u:u).length,insert:e},range:O.cursor(n+e.length)}}else{if(s&&o.sliceDoc(n-2*u.length,n)==u+u&&-1<(e=d1(o,n-2*u.length,a))&&l1(o,e))return{changes:{insert:u+u+u+u,from:n},effects:Lu.of(n+u.length),range:O.cursor(n+u.length)};if(o.charCategorizer(n)(i)!=l.Word&&-1<d1(o,n,a)&&!v1(o,n,u,a))return{changes:{insert:u+u,from:n},effects:Lu.of(n+u.length),range:O.cursor(n+u.length)}}return{range:f=t}});return f?null:o.update(t,{scrollIntoView:!0,userEvent:"input.type"})}function l1(t,n){var t=R(t).resolveInner(n+1);return t.parent&&t.from==n}function v1(t,n,i,e){for(var r,o,u,s,a,f,s,r=R(t).resolveInner(n,-1),o=e.reduce(function(t,n){return Math.max(t,n.length)},0),u=0;u<5;u++){if(!(a=(s=t.sliceDoc(r.from,Math.min(r.to,r.from+i.length+o))).indexOf(i))||-1<a&&-1<e.indexOf(s.slice(0,a))){for(f=r.firstChild;f&&f.from==r.from&&f.to-f.from>i.length+a;){if(t.sliceDoc(f.to-i.length,f.to)==i)return;f=f.firstChild}return 1}if(!(s=r.to==n&&r.parent))break;r=s}}function d1(t,n,i){var e,r,o,u,s,e=t.charCategorizer(n);if(e(t.sliceDoc(n-1,n))!=l.Word)return n;r=F(i);try{for(r.s();!(o=r.n()).done;)if(s=n-(u=o.value).length,t.sliceDoc(s,n)==u&&e(t.sliceDoc(s-1,s))!=l.Word)return s}catch(t){r.e(t)}finally{r.f()}return-1}function y1(){var t;return[ku,eu.of(0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}),au,Wu,gu]}function m1(t){var t=t.field(ku,!1);return t&&t.active.some(function(t){return 1==t.state})?"pending":t&&t.active.some(function(t){return 0!=t.state})?"active":null}function p1(t){var t,t,n,t=null==(t=t.field(ku,!1))?void 0:t.open;return!t||t.disabled?[]:((n=Vu.get(t.options))||Vu.set(t.options,n=t.options.map(function(t){return t.completion})),n)}function k1(t){var t,t,t=null==(t=t.field(ku,!1))?void 0:t.open;return t&&!t.disabled&&0<=t.selected?t.options[t.selected].completion:null}function g1(t){var t,t,t=null==(t=t.field(ku,!1))?void 0:t.open;return t&&!t.disabled&&0<=t.selected?t.selected:null}function w1(t){return pu.of(t)}function b1(e,r){return function(t){var n,t,i,n=t.state,t=t.dispatch;return!n.readOnly&&!!(i=e(r,n))&&(t(n.update(i)),!0)}}function M1(t,n){var t=t.languageDataAt("commentTokens",n);return t.length?t[0]:{}}function x1(t,n,i,e){var r,n,o,u,s,a,f,h,c,o,f,u,r=n.open,n=n.close,o=t.sliceDoc(i-Ju,i),u=t.sliceDoc(e,e+Ju),s=/\s*$/.exec(o)[0].length,a=/^\s*/.exec(u)[0].length,f=o.length-s;return o.slice(f-r.length,f)==r&&u.slice(a,a+n.length)==n?{open:{pos:i-s,margin:s&&1},close:{pos:e+a,margin:a&&1}}:(e-i<=2*Ju?h=c=t.sliceDoc(i,e):(h=t.sliceDoc(i,i+Ju),c=t.sliceDoc(e-Ju,e)),o=/^\s*/.exec(h)[0].length,f=/\s*$/.exec(c)[0].length,u=c.length-f-n.length,h.slice(o,o+r.length)==r&&c.slice(u,u+n.length)==n?{open:{pos:i+o+r.length,margin:/\s/.test(h.charAt(o+r.length))?1:0},close:{pos:e-f-n.length,margin:/\s/.test(c.charAt(u-1))?1:0}}:null)}function S1(t){var n,i,e,r,o,u,s,n=[],i=F(t.selection.ranges);try{for(i.s();!(e=i.n()).done;)r=e.value,o=t.doc.lineAt(r.from),u=r.to<=o.to?o:t.doc.lineAt(r.to),0<=(s=n.length-1)&&n[s].to>o.from?n[s].to=u.to:n.push({from:o.from+/^\s*/.exec(o.text)[0].length,to:u.to})}catch(t){i.e(t)}finally{i.f()}return n}function C1(t,i){var n,e,r,o,u,s,a,f,h,s,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:i.selection.ranges,e=n.map(function(t){return M1(i,t.from).block});if(e.every(function(t){return t})){if(r=n.map(function(t,n){return x1(i,e[n],t.from,t.to)}),2!=t&&!r.every(function(t){return t}))return{changes:i.changes(n.map(function(t,n){return r[n]?[]:[{from:t.from,insert:e[n].open+" "},{from:t.to,insert:" "+e[n].close}]}))};if(1!=t&&r.some(function(t){return t})){for(o=[],u=0;u<r.length;u++)(s=r[u])&&(a=e[u],h=s.open,s=s.close,o.push({from:h.pos-a.open.length,to:h.pos+h.margin},{from:s.pos-s.margin,to:s.pos+a.close.length}));return{changes:o}}}return null}function j1(t,n){var L,i,e,r,o,u,s,a,f,h,c,l,v,d,y,m,p,k,g,w,b,M,x,S,C,B,j,P,O,E,A,D,R,I,_,T,L,i=[],e=-1,r=F(2<arguments.length&&void 0!==arguments[2]?arguments[2]:n.selection.ranges);try{for(r.s();!(o=r.n()).done;)if(s=(u=o.value).from,a=u.to,f=i.length,h=1e9,c=M1(n,s).line){for(l=s;l<=a;)(v=n.doc.lineAt(l)).from>e&&(s==a||a>v.from)&&(e=v.from,y=(d=/^\s*/.exec(v.text)[0].length)==v.length,m=v.text.slice(d,d+c.length)==c?d:-1,d<v.text.length&&d<h&&(h=d),i.push({line:v,comment:m,token:c,indent:d,empty:y,single:!1})),l=v.to+1;if(h<1e9)for(p=f;p<i.length;p++)i[p].indent<i[p].line.text.length&&(i[p].indent=h);i.length==f+1&&(i[f].single=!0)}}catch(t){r.e(t)}finally{r.f()}if(2!=t&&i.some(function(t){return t.comment<0&&(!t.empty||t.single)})){k=[],g=F(i);try{for(g.s();!(w=g.n()).done;)M=(b=w.value).line,x=b.token,S=b.indent,C=b.empty,!(B=b.single)&&C||k.push({from:M.from+S,insert:x+" "})}catch(t){g.e(t)}finally{g.f()}return{changes:j=n.changes(k),selection:n.selection.map(j,1)}}if(1!=t&&i.some(function(t){return 0<=t.comment})){P=[],O=F(i);try{for(O.s();!(E=O.n()).done;)D=(A=E.value).line,R=A.comment,I=A.token,0<=R&&(T=(_=D.from+R)+I.length," "==D.text[T-D.from]&&T++,P.push({from:_,to:T}))}catch(t){O.e(t)}finally{O.f()}return{changes:P}}return null}function P1(t){var i=0;return t.iterChangedRanges(function(t,n){return i=n}),i}function O1(){var t;return[Yu,Zu.of(0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}),w.domEventHandlers({beforeinput:function t(n,i){var e="historyUndo"==n.inputType?ts:"historyRedo"==n.inputType?ns:null;return!!e&&(n.preventDefault(),e(i))}})]}function E1(e,r){return function(t){var n,t,i,i,n=t.state,t=t.dispatch;return!(!r&&n.readOnly||!(i=n.field(Yu,!1))||!(i=i.pop(e,n,r))||(t(i),0))}}function A1(n){return function(t){var t,t,t=t.field(Yu,!1);return t?(t=0==n?t.done:t.undone).length-(t.length&&!t[0].changes?1:0):0}}function D1(t,n,i,e){var r,t,r,t=t.slice(i+20<n+1?n-i-1:0,n);return t.push(e),t}function R1(t,n){var s=[],a=!1;return t.iterChangedRanges(function(t,n){return s.push(t,n)}),n.iterChangedRanges(function(t,n,i,e){for(var r,o,u,r=0;r<s.length;)o=s[r++],u=s[r++],o<=e&&i<=u&&(a=!0)}),a}function I1(t,i){return t.ranges.length==i.ranges.length&&0===t.ranges.filter(function(t,n){return t.empty!=i.ranges[n].empty}).length}function T1(t,n){return t.length?n.length?t.concat(n):t:n}function L1(t,n){var i,e;return t.length?(e=(i=t[t.length-1]).selectionsAfter.slice(Math.max(0,i.selectionsAfter.length-rs))).length&&e[e.length-1].eq(n)?t:(e.push(n),D1(t,t.length-1,1e9,i.setSelAfter(e))):[is.selection([n])]}function B1(t){var n,i,n=t[t.length-1],i=t.slice();return i[t.length-1]=n.setSelAfter(n.selectionsAfter.slice(0,n.selectionsAfter.length-1)),i}function _1(t,n){var i,e,r,o;if(!t.length)return t;for(i=t.length,e=es;i;){if((r=F1(t[i-1],n,e)).changes&&!r.changes.empty||r.effects.length)return(o=t.slice(0,i))[i-1]=r,o;n=r.mapped,i--,e=r.selectionsAfter}return e.length?[is.selection(e)]:es}function F1(t,n,i){var i,e,r,o,i=T1(t.selectionsAfter.length?t.selectionsAfter.map(function(t){return t.map(n)}):es,i);return t.changes?(e=t.changes.map(n),r=n.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(r):r,new is(e,v.mapEffects(t.effects,n),o,t.startSelection.map(r),i)):is.selection(i)}function N1(t,n){return O.create(t.ranges.map(n),t.mainIndex)}function U1(t,n){return t.update({selection:n,scrollIntoView:!0,userEvent:"select"})}function H1(t,n){var i,t,n,i=t.state,t=t.dispatch,n=N1(i.selection,n);return!n.eq(i.selection)&&(t(U1(i,n)),!0)}function z1(t,n){return O.cursor(n?t.to:t.from)}function W1(n,i){return H1(n,function(t){return t.empty?n.moveByChar(t,i):z1(t,i)})}function V1(t){return t.textDirectionAt(t.state.selection.main.head)==E.LTR}function $1(n,i){return H1(n,function(t){return t.empty?n.moveByGroup(t,i):z1(t,i)})}function q1(a,i,f){var h=a.state.charCategorizer(i.from);return a.moveByChar(i,f,function(t){var e,r,o,u,s,n,e=l.Space,r=i.from,o=!1,u=!1,s=!1,n=function t(n){if(o)return!1;r+=f?n.length:-n.length;var i=h(n),i;if(i==l.Word&&n.charCodeAt(0)<128&&/[\W_]/.test(n)&&(i=-1),(e=e==l.Space?i:e)!=i)return!1;if(e==l.Word)if(n.toLowerCase()==n){if(!f&&u)return!1;s=!0}else if(s){if(f)return!1;o=!0}else{if(u&&f&&h(i=a.state.sliceDoc(r,r+1))==l.Word&&i.toLowerCase()==i)return!1;u=!0}return!0};return n(t),n})}function G1(n,i){return H1(n,function(t){return t.empty?q1(n,t,i):z1(t,i)})}function J1(t,n,i){var i;return n.type.prop(i)||(i=n.to-n.from)&&(2<i||/[^\s,.;:]/.test(t.sliceDoc(n.from,n.to)))||n.firstChild}function K1(t,n,i){for(var e,r,o,u,s,n,n,e=R(t).resolveInner(n.head),r=i?M.closedBy:M.openedBy,o=n.head;u=i?e.childAfter(o):e.childBefore(o);)J1(t,u,r)?e=u:o=i?u.to:u.from;return n=(s=e.type.prop(r))&&(n=i?fd(t,e.from,1):fd(t,e.to,-1))&&n.matched?i?n.end.to:n.end.from:i?e.to:e.from,O.cursor(n,i?-1:1)}function Q1(i,e){return H1(i,function(t){var n;return t.empty?(n=i.moveVertically(t,e)).head!=t.head?n:i.moveToLineBoundary(t,e):z1(t,e)})}function X1(t){var n,i,e,r,o,u,s,a,n=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,i=0,e=0;if(n){o=F(t.state.facet(w.scrollMargins));try{for(o.s();!(u=o.n()).done;)null!=(a=(s=u.value)(t))&&a.top&&(i=Math.max(null==a?void 0:a.top,i)),null!=a&&a.bottom&&(e=Math.max(null==a?void 0:a.bottom,e))}catch(t){o.e(t)}finally{o.f()}r=t.scrollDOM.clientHeight-i-e}else r=(t.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:i,marginBottom:e,selfScroll:n,height:Math.max(t.defaultLineHeight,r-5)}}function Z1(n,i){var e,t,r,o,u,s,a,s,e=X1(n),t=n.state,r=N1(t.selection,function(t){return t.empty?n.moveVertically(t,i,e.height):z1(t,i)});return!r.eq(t.selection)&&(e.selfScroll&&(u=n.coordsAtPos(t.selection.main.head),a=(s=n.scrollDOM.getBoundingClientRect()).top+e.marginTop,s=s.bottom-e.marginBottom,u)&&u.top>a&&u.bottom<s&&(o=w.scrollIntoView(r.main.head,{y:"start",yMargin:u.top-a})),n.dispatch(U1(t,r),{effects:o}),!0)}function Y1(t,n,i){var e,r,i,e=t.lineBlockAt(n.head),r=t.moveToLineBoundary(n,i);return r.head==n.head&&r.head!=(i?e.to:e.from)&&(r=t.moveToLineBoundary(n,i,!1)),r=!i&&r.head==e.from&&e.length&&(i=/^\s*/.exec(t.state.sliceDoc(e.from,Math.min(e.from+100,e.to)))[0].length)&&n.head!=e.from+i?O.cursor(e.from+i):r}function ty(i,t,e){var r=!1,n=N1(i.selection,function(t){var n,n,n=fd(i,t.head,-1)||fd(i,t.head,1)||0<t.head&&fd(i,t.head-1,1)||t.head<i.doc.length&&fd(i,t.head+1,-1);return n&&n.end?(r=!0,n=n.start.from==t.head?n.end.to:n.end.from,e?O.range(t.anchor,n):O.cursor(n)):t});return!!r&&(t(U1(i,n)),!0)}function ny(t,i){var n=N1(t.state.selection,function(t){var n=i(t);return O.range(t.anchor,n.head,n.goalColumn,n.bidiLevel||void 0)});return!n.eq(t.state.selection)&&(t.dispatch(U1(t.state,n)),!0)}function iy(n,i){return ny(n,function(t){return n.moveByChar(t,i)})}function ey(n,i){return ny(n,function(t){return n.moveByGroup(t,i)})}function ry(n,i){return ny(n,function(t){return q1(n,t,i)})}function oy(n,i){return ny(n,function(t){return n.moveVertically(t,i)})}function uy(n,i){return ny(n,function(t){return n.moveVertically(t,i,X1(n).height)})}function sy(r,o){var u,t,n;return!r.state.readOnly&&(u="delete.selection",!(n=(t=r.state).changeByRange(function(t){var n,i,e,n=t.from,i=t.to;return i=n==i?((e=o(n))<n?e=ay(r,e,!(u="delete.backward")):n<e&&(u="delete.forward",e=ay(r,e,!0)),n=Math.min(n,e),Math.max(i,e)):(n=ay(r,n,!1),ay(r,i,!0)),n==i?{range:t}:{changes:{from:n,to:i},range:O.cursor(n)}})).changes.empty)&&(r.dispatch(t.update(n,{scrollIntoView:!0,userEvent:u,effects:"delete.selection"==u?w.announce.of(t.phrase("Selection deleted")):void 0})),!0)}function ay(n,i,e){var r,t,o;if(n instanceof w){r=F(n.state.facet(w.atomicRanges).map(function(t){return t(n)}));try{for(r.s();!(t=r.n()).done;)(o=t.value).between(i,i,function(t,n){t<i&&i<n&&(i=e?n:t)})}catch(t){r.e(t)}finally{r.f()}}return i}function fy(t){var n,i,e,r,o,u,s,a,n=[],i=-1,e=F(t.selection.ranges);try{for(e.s();!(r=e.n()).done;)o=r.value,u=t.doc.lineAt(o.from),s=t.doc.lineAt(o.to),o.empty||o.to!=s.from||(s=t.doc.lineAt(o.to-1)),i>=u.number?((a=n[n.length-1]).to=s.to,a.ranges.push(o)):n.push({from:u.from,to:s.to,ranges:[o]}),i=s.number+1}catch(t){e.e(t)}finally{e.f()}return n}function hy(t,n,i){var e,r,o,u,s,a,f,h,c,l,v,d,y;if(t.readOnly)return!1;e=[],r=[],o=F(fy(t));try{for(o.s();!(u=o.n()).done;)if(s=u.value,i?s.to!=t.doc.length:0!=s.from)if(f=(a=t.doc.lineAt(i?s.to+1:s.from-1)).length+1,i){e.push({from:s.to,to:a.to},{from:s.from,insert:a.text+t.lineBreak}),h=F(s.ranges);try{for(h.s();!(c=h.n()).done;)l=c.value,r.push(O.range(Math.min(t.doc.length,l.anchor+f),Math.min(t.doc.length,l.head+f)))}catch(t){h.e(t)}finally{h.f()}}else{e.push({from:a.from,to:s.from},{from:s.to,insert:t.lineBreak+a.text}),v=F(s.ranges);try{for(v.s();!(d=v.n()).done;)y=d.value,r.push(O.range(y.anchor-f,y.head-f))}catch(t){v.e(t)}finally{v.f()}}}catch(t){o.e(t)}finally{o.f()}return!!e.length&&(n(t.update({changes:e,scrollIntoView:!0,selection:O.create(r,t.selection.mainIndex),userEvent:"move.line"})),!0)}function cy(t,n,i){var e,r,o,u;if(t.readOnly)return!1;e=[],r=F(fy(t));try{for(r.s();!(o=r.n()).done;)u=o.value,e.push(i?{from:u.from,insert:t.doc.slice(u.from,u.to)+t.lineBreak}:{from:u.to,insert:t.lineBreak+t.doc.slice(u.from,u.to)})}catch(t){r.e(t)}finally{r.f()}return n(t.update({changes:e,scrollIntoView:!0,userEvent:"input.copyline"})),!0}function ly(t,n){var i,e,i,n;return/\(\)|\[\]|\{\}/.test(t.sliceDoc(n-1,n+1))?{from:n,to:n}:(e=(i=R(t).resolveInner(n)).childBefore(n),i=i.childAfter(n),e&&i&&e.to<=n&&i.from>=n&&(n=e.type.prop(M.closedBy))&&-1<n.indexOf(i.name)&&t.doc.lineAt(e.to).from==t.doc.lineAt(i.from).from?{from:e.to,to:i.from}:null)}function vy(s){return function(t){var u,t,n,u=t.state,t=t.dispatch;return!u.readOnly&&(n=u.changeByRange(function(t){var n,i,e,t,r,o,o,n=t.from,i=t.to,e=u.doc.lineAt(n),t=!s&&n==i&&ly(u,n);for(s&&(n=i=(i<=e.to?e:u.doc.lineAt(i)).to),null==(o=Ev(r=new oo(u,{simulateBreak:n,simulateDoubleBreak:!!t}),n))&&(o=/^\s*/.exec(u.doc.lineAt(n).text)[0].length);i<e.to&&/\s/.test(e.text[i-e.from]);)i++;return t?(n=t.from,i=t.to):n>e.from&&n<e.from+100&&!/\S/.test(e.text.slice(0,n))&&(n=e.from),o=["",Ov(u,o)],t&&o.push(Ov(u,r.lineIndent(e.from,-1))),{changes:{from:n,to:i,insert:k.of(o)},range:O.cursor(n+1+o[1].length)}}),t(u.update(n,{scrollIntoView:!0,userEvent:"input"})),!0)}}function dy(o,u){var s=-1;return o.changeByRange(function(t){for(var n,i,e,r,n=[],i=t.from;i<=t.to;)(e=o.doc.lineAt(i)).number>s&&(t.empty||t.to>e.from)&&(u(e,n,t),s=e.number),i=e.to+1;return r=o.changes(n),{changes:n,range:O.range(r.mapPos(t.anchor,1),r.mapPos(t.head,1))}})}function I(t,n){var i,e,r,o,u,i=t;if("string"==typeof i&&(i=document.createElement(i)),e=1,(r=n)&&"object"==uh(r)&&null==r.nodeType&&!Array.isArray(r)){for(o in r)Object.prototype.hasOwnProperty.call(r,o)&&("string"==typeof(u=r[o])?i.setAttribute(o,u):null!=u&&(i[o]=u));e++}for(;e<arguments.length;e++)yy(i,arguments[e]);return i}function yy(t,n){if("string"==typeof n)t.appendChild(document.createTextNode(n));else if(null!=n)if(null!=n.nodeType)t.appendChild(n);else{if(!Array.isArray(n))throw new RangeError("Unsupported child node: "+n);for(var i=0;i<n.length;i++)yy(t,n[i])}}function my(t,n,i){var e,r,o,e=1<arguments.length&&void 0!==n?n:null,r,o=null;return t.between(2<arguments.length&&void 0!==i?i:0,1e9,function(t,n,i){var i=i.spec;if(!e||i.diagnostic==e)return o=new Aa(t,n,i.diagnostic),!1}),o}function py(t,n){return!(!t.effects.some(function(t){return t.is(Ra)})&&!t.changes.touchesRange(n.pos))}function ky(t,n){return t.field(La,!1)?n:n.concat(v.appendConfig.of(Qa))}function gy(t,n){return{effects:ky(t,[Ra.of(n)])}}function wy(t){var t=t.field(La,!1);return t?t.diagnostics.size:0}function by(n,e,r){var t,i,o,u,s,i,t,i=n.state.field(La).diagnostics,o=[],u=2e8,s=0;return i.between(e-(r<0?1:0),e+(0<r?1:0),function(t,n,i){var i=i.spec;t<=e&&e<=n&&(t==n||(t<e||0<r)&&(e<n||r<0))&&(o.push(i.diagnostic),u=Math.min(t,u),s=Math.max(n,s))}),i=n.state.facet(Ua).tooltipFilter,(o=i?i(o):o).length?{pos:u,end:s,above:n.state.doc.lineAt(u).to<s,create:function t(){return{dom:My(n,o)}}}:null}function My(n,t){return I("ul",{class:"cm-tooltip-lint"},t.map(function(t){return jy(n,t,!1)}))}function xy(t){var n;return[Ua.of({source:t,config:1<arguments.length&&void 0!==arguments[1]?arguments[1]:{}}),Na,Qa]}function Sy(t){var t=t.plugin(Na);t&&t.force()}function Cy(t){var i,n,e,r,o,u,i=[];if(t){n=F(t);try{t:for(n.s();!(e=n.n()).done;){for(r=e.value.name,o=function t(){var n=r[u];if(/[a-zA-Z]/.test(n)&&!i.some(function(t){return t.toLowerCase()==n.toLowerCase()}))return i.push(n),1},u=0;u<r.length;u++)if(o())continue t;i.push("")}}catch(t){n.e(t)}finally{n.f()}}return i}function jy(s,a,t){var t,f,f=t?Cy(a.actions):[];return I("li",{class:"cm-diagnostic cm-diagnostic-"+a.severity},I("span",{class:"cm-diagnosticText"},a.renderMessage?a.renderMessage():a.message),null==(t=a.actions)?void 0:t.map(function(i,t){var e,n,r,o,u,e=!1,n=function t(n){var n;n.preventDefault(),!e&&(e=!0,n=my(s.state.field(La).diagnostics,a))&&i.apply(s,n.from,n.to)},r=i.name,o=f[t]?r.indexOf(f[t]):-1,u=o<0?r:[r.slice(0,o),I("u",r.slice(o,o+1)),r.slice(o+1)];return I("button",{type:"button",class:"cm-diagnosticAction",onclick:n,onmousedown:n,"aria-label":" Action: ".concat(r).concat(o<0?"":' (access key "'.concat(f[t],')"'),".")},u)}),a.source&&I("div",{class:"cm-diagnosticSource"},a.source))}function Py(t,n){var i;return'url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" '.concat(1<arguments.length&&void 0!==n?n:'viewBox="0 0 40 40"',">").concat(encodeURIComponent(t),"</svg>')")}function Oy(t){return Py('<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="'.concat(t,'" fill="none" stroke-width=".7"/>'),'width="6" height="3"')}function Ey(r,o){var t;window.addEventListener("mousemove",function t(n){var i,e,i=o.getBoundingClientRect();if(!(n.clientX>i.left-10&&n.clientX<i.right+10&&n.clientY>i.top-10&&n.clientY<i.bottom+10)){for(e=n.target;e;e=e.parentNode)if(1==e.nodeType&&e.classList.contains("cm-tooltip-lint"))return;window.removeEventListener("mousemove",t),r.state.field(Ja)&&r.dispatch({effects:Ga.of(null)})}})}function Ay(i,e,r){var t,n,o;function u(){var t,n,t=i.elementAtHeight(e.getBoundingClientRect().top+5-i.documentTop),n;i.coordsAtPos(t.from)&&i.dispatch({effects:Ga.of({pos:t.from,above:!1,create:function t(){return{dom:My(i,r),getCoords:function t(){return e.getBoundingClientRect()}}}})}),e.onmouseout=e.onmousemove=null,Ey(i,e)}t=i.state.facet(Xa),n=t.hoverTime,o=setTimeout(u,n),e.onmouseout=function(){clearTimeout(o),e.onmouseout=e.onmousemove=null},e.onmousemove=function(){clearTimeout(o),o=setTimeout(u,n)}}function Dy(t,n){var i,e,r,o,u,s,a,i=Object.create(null),e=F(n);try{for(e.s();!(r=e.n()).done;)o=r.value,(i[(u=t.lineAt(o.from)).from]||(i[u.from]=[])).push(o)}catch(t){e.e(t)}finally{e.f()}for(a in s=[],i)s.push(new Va(i[a]).range(+a));return j.of(s,!0)}function Ry(){var t;return[Xa.of(0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}),qa,$a,Ka,Ja]}function Iy(t,n){var t,i,t=t.field(La,!1);if(t&&t.diagnostics.size)for(i=j.iter([t.diagnostics]);i.value;i.next())n(i.value.spec.diagnostic,i.from,i.to)}function Ty(t){try{return new RegExp(t,ef),!0}catch(t){return!1}}function Ly(t,n){if(!(n>=t.length))for(var i=t.lineAt(n),e;n<i.to&&56320<=(e=i.text.charCodeAt(n-i.from))&&e<57344;)n++;return n}function By(s){var a,t;function i(){var t,n,i,t,e,r,o,t,o,u,t,t,t=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(a.value);t&&(i=(n=s.state).doc.lineAt(n.selection.main.head),e=(t=Gf(t,5))[1],r=t[2],o=t[3],t=t[4],o=o?+o.slice(1):0,u=r?+r:i.number,r&&t?(t=u/100,e&&(t=t*("-"==e?-1:1)+i.number/n.doc.lines),u=Math.round(n.doc.lines*t)):r&&e&&(u=u*("-"==e?-1:1)+i.number),t=n.doc.line(Math.max(1,Math.min(n.doc.lines,u))),s.dispatch({effects:af.of(!1),selection:O.cursor(t.from+Math.max(0,Math.min(o,t.length))),scrollIntoView:!0}),s.focus())}return a=I("input",{class:"cm-textfield",name:"line"}),{dom:t=I("form",{class:"cm-gotoLine",onkeydown:function t(n){27==n.keyCode?(n.preventDefault(),s.dispatch({effects:af.of(!1)}),s.focus()):13==n.keyCode&&(n.preventDefault(),i())},onsubmit:function t(n){n.preventDefault(),i()}},I("label",s.state.phrase("Go to line"),": ",a)," ",I("button",{class:"cm-button",type:"submit"},s.state.phrase("go")))}}function _y(t){var n=[mf,yf];return t&&n.push(lf.of(t)),n}function Fy(t,n,i,e){return!(0!=i&&t(n.sliceDoc(i-1,i))==l.Word||e!=n.doc.length&&t(n.sliceDoc(e,e+1))==l.Word)}function Ny(t,n,i,e){return t(n.sliceDoc(i,i+1))==l.Word&&t(n.sliceDoc(e-1,e))==l.Word}function Uy(r,o){for(var t,n,u,t,s,i,e,a,f,t=r.selection,n=t.main,u=t.ranges,t=r.wordAt(n.head),s=t&&t.from==n.from&&t.to==n.to,i=function t(n,i){if(i.next(),!i.done){if(n&&u.some(function(t){return t.from==i.value.from}))return a=n,f=i,0;if(s){var e=r.wordAt(i.value.from);if(!e||e.from!=i.value.from||e.to!=i.value.to)return a=n,f=i,0}return{v:i.value}}if(n)return{v:null};i=new tf(r.doc,o,0,Math.max(0,u[u.length-1].from-1)),a=n=!0,f=i},a=!1,f=new tf(r.doc,o,u[u.length-1].to);;)if(0!==(e=i(a,f))&&e)return e.v}function Hy(t){return t?[kf.of(t),Nf]:Nf}function zy(t,n,i,e){return new tf(n.doc,t.unquoted,i,e,t.caseSensitive?void 0:function(t){return t.toLowerCase()},t.wholeWord?Wy(n.doc,n.charCategorizer(n.selection.main.head)):void 0)}function Wy(r,o){return function(t,n,i,e){return(t<e||e+i.length<n)&&(e=Math.max(0,t-2),i=r.sliceString(e,Math.min(r.length,n+2))),!(o($y(i,t-e))==l.Word&&o(qy(i,t-e))==l.Word||o(qy(i,n-e))==l.Word&&o($y(i,n-e))==l.Word)}}function Vy(t,n,i,e){return new rf(n.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?Gy(n.charCategorizer(n.selection.main.head)):void 0},i,e)}function $y(t,n){return t.slice(yh(t,n,!1),n)}function qy(t,n){return t.slice(n,yh(t,n))}function Gy(e){return function(t,n,i){return!i[0].length||(e($y(i.input,i.index))!=l.Word||e(qy(i.input,i.index))!=l.Word)&&(e(qy(i.input,i.index+i[0].length))!=l.Word||e($y(i.input,i.index+i[0].length))!=l.Word)}}function Jy(t){var n=t.field(Sf,!1);return n?n.query.spec:Zy(t)}function Ky(t){var t;return null!=(null==(t=t.field(Sf,!1))?void 0:t.panel)}function Qy(i){return function(t){var n=t.state.field(Sf,!1);return n&&n.query.spec.valid?i(t,n):If(t)}}function Xy(t){return t.state.facet(kf).createPanel(t)}function Zy(t,n){var i,i,e,i,e,e,t,e=t.selection.main,e=e.empty||e.to>e.from+100?"":t.sliceDoc(e.from,e.to);return n&&!e?n:(t=t.facet(kf),new gf({search:(null!=(i=null==n?void 0:n.literal)?i:t.literal)?e:e.replace(/\n/g,"\\n"),caseSensitive:null!=(i=null==n?void 0:n.caseSensitive)?i:t.caseSensitive,literal:null!=(e=null==n?void 0:n.literal)?e:t.literal,wholeWord:null!=(i=null==n?void 0:n.wholeWord)?i:t.wholeWord}))}function Yy(t){var t=W0(t,Xy);return t&&t.dom.querySelector("[main-field]")}function tm(t){var n=Yy(t);n&&n==t.root.activeElement&&n.select()}function nm(t,n){return t.state.phrase(n)}function im(t,n){var i,n,e,r,i,n,o,u,s,i=n.from,n=n.to,e=t.state.doc.lineAt(i),r=t.state.doc.lineAt(n).to,i=Math.max(e.from,i-_f),n=Math.min(r,n+_f),o=t.state.sliceDoc(i,n);if(i!=e.from)for(u=0;u<_f;u++)if(!Ff.test(o[u+1])&&Ff.test(o[u])){o=o.slice(u);break}if(n!=r)for(s=o.length-1;s>o.length-_f;s--)if(!Ff.test(o[s-1])&&Ff.test(o[s])){o=o.slice(0,s);break}return w.announce.of("".concat(t.state.phrase("current match"),". ").concat(o," ").concat(t.state.phrase("on line")," ").concat(e.number,"."))}Jo=new(Go=function(){function n(t){A(this,n),this.extra=t,this.table=Object.assign(Object.create(null),zo)}return D(n,[{key:"resolve",value:function t(n){return n?this.table[n]||(this.table[n]=wd(this.extra,n)):0}}]),n}())(Fo),Ko=L.Language=Object.freeze({__proto__:null,DocInput:Kr,HighlightStyle:Mo,IndentContext:oo,LRLanguage:t,Language:Jr,LanguageDescription:e,LanguageSupport:Zt,ParseContext:Xr,StreamLanguage:Nr,StringStream:Lo,TreeIndentContext:so,bracketMatching:ud,bracketMatchingHandle:To,codeFolding:td,continuedIndent:Uv,defaultHighlightStyle:jo,defineLanguageFacet:wv,delimitedIndent:Fv,ensureSyntaxTree:Mv,flatIndent:nn,foldAll:zr,foldCode:u,foldEffect:co,foldGutter:nd,foldInside:zv,foldKeymap:yo,foldNodeProp:ho,foldService:fo,foldState:vo,foldable:$v,foldedRanges:Jv,forceParsing:Sv,getIndentUnit:Pv,getIndentation:Ev,highlightingFor:rd,indentNodeProp:uo,indentOnInput:Hv,indentRange:Av,indentService:eo,indentString:Ov,indentUnit:ro,language:io,languageDataProp:qr,matchBrackets:fd,sublanguageProp:Gr,syntaxHighlighting:ed,syntaxParserRunning:Cv,syntaxTree:R,syntaxTreeAvailable:xv,toggleFold:o,unfoldAll:Wr,unfoldCode:Hr,unfoldEffect:lo}),Qo=function(){function e(t,n,i){A(this,e),this.state=t,this.pos=n,this.explicit=i,this.abortListeners=[]}return D(e,[{key:"tokenBefore",value:function t(n){for(var i=R(this.state).resolveInner(this.pos,-1);i&&n.indexOf(i.name)<0;)i=i.parent;return i?{from:i.from,to:this.pos,text:this.state.sliceDoc(i.from,this.pos),type:i.type}:null}},{key:"matchBefore",value:function t(n){var i,e,i,n,i=this.state.doc.lineAt(this.pos),e=Math.max(i.from,this.pos-250),i=i.text.slice(e-i.from,this.pos-i.from),n=i.search(Od(n,!1));return n<0?null:{from:e+n,to:this.pos,text:i.slice(n)}}},{key:"aborted",get:function t(){return null==this.abortListeners}},{key:"addEventListener",value:function t(n,i){"abort"==n&&this.abortListeners&&this.abortListeners.push(i)}}]),e}(),Xo=D(function t(n,i,e,r){A(this,t),this.completion=n,this.source=i,this.match=e,this.score=r}),Zo=gt.define(),Yo=new WeakMap,tu=v.define(),nu=v.define(),iu=function(){function o(t){var n,i,e,i,r;for(A(this,o),this.pattern=t,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],n=0;n<t.length;)e=Mh(i=wh(t,n)),this.chars.push(i),r=(i=t.slice(n,n+e)).toUpperCase(),this.folded.push(wh(r==i?i.toLowerCase():r,0)),n+=e;this.astral=t.length!=this.chars.length}return D(o,[{key:"match",value:function t(n){var i,e,r,o,u,s,a,f,h,c,l,v,d,y,m,p,k,g,w,b,M,x,S,C,j,P,O,O;if(0==this.pattern.length)return[-100];if(n.length<this.pattern.length)return null;if(i=this.chars,e=this.folded,r=this.any,o=this.precise,u=this.byWord,1==i.length){if(f=(a=Mh(s=wh(n,0)))==n.length?0:-100,s!=i[0]){if(s!=e[0])return null;f+=-200}return[f,0,a]}if(0==(h=n.indexOf(this.pattern)))return[n.length==this.pattern.length?0:-100,0,this.pattern.length];if(c=i.length,h<(l=0)){for(v=0,d=Math.min(n.length,200);v<d&&l<c;)(y=wh(n,v))!=i[l]&&y!=e[l]||(r[l++]=v),v+=Mh(y);if(l<c)return null}for(k=!1,g=p=m=0,b=w=-1,M=/[a-z]/.test(n),x=!0,S=0,C=Math.min(n.length,200),j=0;S<C&&p<c;)P=wh(n,S),h<0&&(m<c&&P==i[m]&&(o[m++]=S),g<c)&&(P==i[g]||P==e[g]?(0==g&&(w=S),b=S+1,g++):g=0),O=void 0,O=P<255?48<=P&&P<=57||97<=P&&P<=122?2:65<=P&&P<=90?1:0:(O=bh(P))!=O.toLowerCase()?1:O!=O.toUpperCase()?2:0,(!S||1==O&&M||0==j&&0!=O)&&(i[p]==P||e[p]==P&&(k=!0)?u[p++]=S:u.length&&(x=!1)),j=O,S+=Mh(P);return p==c&&0==u[0]&&x?this.result((k?-200:0)-100,u,n):g==c&&0==w?[-200-n.length+(b==n.length?0:-100),0,b]:-1<h?[-700-n.length,h,h+this.pattern.length]:g==c?[-900-n.length,w,b]:p==c?this.result((k?-200:0)-100-700+(x?0:-1100),u,n):2==i.length?null:this.result((r[0]?-700:0)-200-1100,r,n)}},{key:"result",value:function t(n,i,e){var t,r,o,u,s,a;t=[n-e.length],r=1,o=F(i);try{for(o.s();!(u=o.n()).done;)a=(s=u.value)+(this.astral?Mh(wh(e,s)):1),1<r&&t[r-1]==s?t[r-1]=a:(t[r++]=s,t[r++]=a)}catch(t){o.e(t)}finally{o.f()}return t}}]),o}(),eu=y.define({combine:function t(n){return qh(n,{activateOnTyping:!0,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:function t(){return""},optionClass:function t(){return""},aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:Rd,compareCompletions:function t(n,i){return n.label.localeCompare(i.label)},interactionDelay:75},{defaultKeymap:function t(n,i){return n&&i},closeOnBlur:function t(n,i){return n&&i},icons:function t(n,i){return n&&i},tooltipClass:function t(n,i){return function(t){return Dd(n(t),i(t))}},optionClass:function t(n,i){return function(t){return Dd(n(t),i(t))}},addToOptions:function t(n,i){return n.concat(i)}})}}),r=function t(n){var i=n.state.field(ku,!1);return!(n.state.readOnly||!i||!i.open||i.open.selected<0||Date.now()-i.open.timestamp<n.state.facet(eu).interactionDelay)&&(!!i.open.disabled||Td(n,i.open.options[i.open.selected]))},$r=function t(n){var i;return!!n.state.field(ku,!1)&&(n.dispatch({effects:tu.of(!0)}),!0)},Yt=function t(n){var i=n.state.field(ku,!1);return!(!i||!i.active.some(function(t){return 0!=t.state})||(n.dispatch({effects:nu.of(null)}),0))},ru=D(function t(n,i){A(this,t),this.active=n,this.context=i,this.time=Date.now(),this.updates=[],this.done=void 0}),uu=ou=50,su=1e3,au=d.fromClass(function(){function r(t){var n,i,e;A(this,r),this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.composing=0,n=F(t.state.field(ku).active);try{for(n.s();!(i=n.n()).done;)1==(e=i.value).state&&this.startQuery(e)}catch(t){n.e(t)}finally{n.f()}}return D(r,[{key:"update",value:function t(n){var i,e,r,o,u,s,a,f,u,h,c,l,i=this,e=n.state.field(ku);if(n.selectionSet||n.docChanged||n.startState.field(ku)!=e){for(r=n.transactions.some(function(t){return(t.selection||t.docChanged)&&!Wd(t)}),o=0;o<this.running.length;o++)if(u=this.running[o],r||50<u.updates.length+n.transactions.length&&Date.now()-u.time>su){s=F(u.context.abortListeners);try{for(s.s();!(a=s.n()).done;){f=a.value;try{f()}catch(t){Wc(this.view.state,t)}}}catch(t){s.e(t)}finally{s.f()}u.context.abortListeners=null,this.running.splice(o--,1)}else(u=u.updates).push.apply(u,Wf(n.transactions));if(-1<this.debounceUpdate&&clearTimeout(this.debounceUpdate),this.debounceUpdate=e.active.some(function(n){return 1==n.state&&!i.running.some(function(t){return t.active.source==n.source})})?setTimeout(function(){return i.startUpdate()},50):-1,0!=this.composing){h=F(n.transactions);try{for(h.s();!(c=h.n()).done;)"input"==Wd(l=c.value)?this.composing=2:2==this.composing&&l.selection&&(this.composing=3)}catch(t){h.e(t)}finally{h.f()}}}}},{key:"startUpdate",value:function t(){var i,n,e,r,o,u,i=this;this.debounceUpdate=-1,r=F((e=(n=this.view.state).field(ku)).active);try{for(u=function t(){var n=o.value;1!=n.state||i.running.some(function(t){return t.active.source==n.source})||i.startQuery(n)},r.s();!(o=r.n()).done;)u()}catch(t){r.e(t)}finally{r.f()}}},{key:"startQuery",value:function t(n){var i,e,r,e,o,i=this,e=this.view.state,r=Pd(e),e=new Qo(e,r,n.explicitPos==r),o=new ru(n,e);this.running.push(o),Promise.resolve(n.source(e)).then(function(t){o.context.aborted||(o.done=t||null,i.scheduleAccept())},function(t){i.view.dispatch({effects:nu.of(null)}),Wc(i.view.state,t)})}},{key:"scheduleAccept",value:function t(){var n=this;this.running.every(function(t){return void 0!==t.done})?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(function(){return n.accept()},50))}},{key:"accept",value:function t(){var l,v,d,y,n,i,m,l=this;for(-1<this.debounceAccept&&clearTimeout(this.debounceAccept),this.debounceAccept=-1,d=[],y=this.view.state.facet(eu),n=function t(n){var i,e,r,o,u,s,a,f,h,c,i=l.running[n];if(void 0===i.done)return m=n,0;if(l.running.splice(n--,1),i.done){e=new yu(i.active.source,i.active.explicitPos,i.done,i.done.from,null!=(v=i.done.to)?v:Pd(i.updates.length?i.updates[0].startState:l.view.state)),r=F(i.updates);try{for(r.s();!(o=r.n()).done;)u=o.value,e=e.update(u,y)}catch(t){r.e(t)}finally{r.f()}if(e.hasResult())return d.push(e),m=n,0}if((s=l.view.state.field(ku).active.find(function(t){return t.source==i.active.source}))&&1==s.state)if(null==i.done){a=new du(i.active.source,0),f=F(i.updates);try{for(f.s();!(h=f.n()).done;)c=h.value,a=a.update(c,y)}catch(t){f.e(t)}finally{f.f()}1!=a.state&&d.push(a)}else l.startQuery(s);m=n},m=0;m<this.running.length;m++)i=n(m);d.length&&this.view.dispatch({effects:mu.of(d)})}}]),r}(),{eventHandlers:{blur:function t(n){var i,i,i=this.view.state.field(ku,!1);i&&i.tooltip&&this.view.state.facet(eu).closeOnBlur&&((i=i.open&&N0(this.view,i.open.tooltip))&&i.dom.contains(n.relatedTarget)||this.view.dispatch({effects:nu.of(null)}))},compositionstart:function t(){this.composing=1},compositionend:function t(){var n=this;3==this.composing&&setTimeout(function(){return n.view.dispatch({effects:tu.of(!1)})},20),this.composing=0}}}),fu=function(){function u(e,t){var r,t,n,o,n,i,r=this;A(this,u),this.view=e,this.stateField=t,this.info=null,this.placeInfoReq={read:function t(){return r.measureInfo()},write:function t(n){return r.placeInfo(n)},key:this},this.space=null,this.currentClass="",n=(t=e.state.field(t)).open,o=n.options,n=n.selected,i=e.state.facet(eu),this.optionContent=Ld(i),this.optionClass=i.optionClass,this.tooltipClass=i.tooltipClass,this.range=Bd(o.length,n,i.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",function(t){for(var n=t.target,i;n&&n!=r.dom;n=n.parentNode)if("LI"==n.nodeName&&(i=/-(\d+)$/.exec(n.id))&&+i[1]<o.length)return Td(e,o[+i[1]]),void t.preventDefault()}),this.dom.addEventListener("focusout",function(t){var n=e.state.field(r.stateField,!1);n&&n.tooltip&&e.state.facet(eu).closeOnBlur&&t.relatedTarget!=e.contentDOM&&e.dispatch({effects:nu.of(null)})}),this.list=this.dom.appendChild(this.createListBox(o,t.id,this.range)),this.list.addEventListener("scroll",function(){r.info&&r.view.requestMeasure(r.placeInfoReq)})}return D(u,[{key:"mount",value:function t(){this.updateSel()}},{key:"update",value:function t(n){var n,n,i,e,i,e=n.state.field(this.stateField),i=n.startState.field(this.stateField);this.updateTooltipClass(n.state),e!=i&&(this.updateSel(),(null==(n=e.open)?void 0:n.disabled)!=(null==(n=i.open)?void 0:n.disabled))&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!(null==(i=e.open)||!i.disabled))}},{key:"updateTooltipClass",value:function t(n){var n,i,e,r,o,u,s,n=this.tooltipClass(n);if(n!=this.currentClass){i=F(this.currentClass.split(" "));try{for(i.s();!(e=i.n()).done;)(r=e.value)&&this.dom.classList.remove(r)}catch(t){i.e(t)}finally{i.f()}o=F(n.split(" "));try{for(o.s();!(u=o.n()).done;)(s=u.value)&&this.dom.classList.add(s)}catch(t){o.e(t)}finally{o.f()}this.currentClass=n}}},{key:"positioned",value:function t(n){this.space=n,this.info&&this.view.requestMeasure(this.placeInfoReq)}},{key:"updateSel",value:function t(){var n,i,e,e,r,r,n=this,i=this.view.state.field(this.stateField),e=i.open;(-1<e.selected&&e.selected<this.range.from||e.selected>=this.range.to)&&(this.range=Bd(e.options.length,e.selected,this.view.state.facet(eu).maxRenderedOptions),this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e.options,i.id,this.range)),this.list.addEventListener("scroll",function(){n.info&&n.view.requestMeasure(n.placeInfoReq)})),this.updateSelectedOption(e.selected)&&(this.info&&(this.info.remove(),this.info=null),r=(e=e.options[e.selected].completion).info)&&(r="string"==typeof r?document.createTextNode(r):r(e))&&("then"in r?r.then(function(t){t&&n.view.state.field(n.stateField,!1)==i&&n.addInfoPane(t)}).catch(function(t){return Wc(n.view.state,t,"completion info")}):this.addInfoPane(r))}},{key:"addInfoPane",value:function t(n){var i=this.info=document.createElement("div");i.className="cm-tooltip cm-completionInfo",i.appendChild(n),this.dom.appendChild(i),this.view.requestMeasure(this.placeInfoReq)}},{key:"updateSelectedOption",value:function t(n){for(var i,e,r,i=null,e=this.list.firstChild,r=this.range.from;e;e=e.nextSibling,r++)"LI"==e.nodeName&&e.id?r==n?e.hasAttribute("aria-selected")||(e.setAttribute("aria-selected","true"),i=e):e.hasAttribute("aria-selected")&&e.removeAttribute("aria-selected"):r--;return i&&Fd(this.list,i),i}},{key:"measureInfo",value:function t(){var n,i,e,n,r,o,n=this.dom.querySelector("[aria-selected]");return!n||!this.info||(i=this.dom.getBoundingClientRect(),e=this.info.getBoundingClientRect(),n=n.getBoundingClientRect(),r=(r=this.space)||{left:0,top:0,right:(o=this.dom.ownerDocument.defaultView||window).innerWidth,bottom:o.innerHeight},n.top>Math.min(r.bottom,i.bottom)-10)||n.bottom<Math.max(r.top,i.top)+10?null:this.view.state.facet(eu).positionInfo(this.view,i,n,e,r)}},{key:"placeInfo",value:function t(n){this.info&&(n?(n.style&&(this.info.style.cssText=n.style),this.info.className="cm-tooltip cm-completionInfo "+(n.class||"")):this.info.style.cssText="top: -1e6px")}},{key:"createListBox",value:function t(n,i,e){var r,o,u,s,a,f,s,h,c,l,s,v,d,y,m,r=document.createElement("ul");for(r.id=i,r.setAttribute("role","listbox"),r.setAttribute("aria-expanded","true"),r.setAttribute("aria-label",this.view.state.phrase("Completions")),o=null,u=e.from;u<e.to;u++){a=(s=n[u]).completion,f=s.match,(s=a.section)&&(h="string"==typeof s?s:s.name)!=o&&(u>e.from||0==e.from)&&(o=h,"string"!=typeof s&&s.header?r.appendChild(s.header(s)):(c=r.appendChild(document.createElement("completion-section"))).textContent=h),(l=r.appendChild(document.createElement("li"))).id=i+"-"+u,l.setAttribute("role","option"),(s=this.optionClass(a))&&(l.className=s),v=F(this.optionContent);try{for(v.s();!(d=v.n()).done;)(m=(y=d.value)(a,this.view.state,f))&&l.appendChild(m)}catch(t){v.e(t)}finally{v.f()}}return e.from&&r.classList.add("cm-completionListIncompleteTop"),e.to<n.length&&r.classList.add("cm-completionListIncompleteBottom"),r}}]),u}(),hu=function(){function h(t,n,i,e,r,o){A(this,h),this.options=t,this.attrs=n,this.tooltip=i,this.timestamp=e,this.selected=r,this.disabled=o}return D(h,[{key:"setSelected",value:function t(n,i){return n==this.selected||n>=this.options.length?this:new h(this.options,zd(i,n),this.tooltip,this.timestamp,n,this.disabled)}},{key:"map",value:function t(n){return new h(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:n.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}],[{key:"build",value:function t(n,i,e,r,o){var u,s,a,f,u=Ud(n,i);if(!u.length)return r&&n.some(function(t){return 1==t.state})?new h(r.options,r.attrs,r.tooltip,r.timestamp,r.selected,!0):null;if(s=i.facet(eu).selectOnOpen?0:-1,r&&r.selected!=s&&-1!=r.selected)for(a=r.options[r.selected].completion,f=0;f<u.length;f++)if(u[f].completion==a){s=f;break}return new h(u,zd(e,s),{pos:n.reduce(function(t,n){return n.hasResult()?Math.min(t,n.from):t},1e8),create:_d(ku),above:o.aboveCursor},r?r.timestamp:Date.now(),s,!1)}}]),h}(),cu=function(){function c(t,n,i){A(this,c),this.active=t,this.id=n,this.open=i}return D(c,[{key:"update",value:function t(i){var e,n,r,o,u,s,a,f,h,e=this,n=i.state,r=n.facet(eu),o,u=(r.override||n.languageDataAt("autocomplete",Pd(n)).map(Ad)).map(function(n){var t;return(e.active.find(function(t){return t.source==n})||new du(n,e.active.some(function(t){return 0!=t.state})?1:0)).update(i,r)});u.length==this.active.length&&u.every(function(t,n){return t==e.active[n]})&&(u=this.active),(s=this.open)&&i.docChanged&&(s=s.map(i.changes)),i.selection||u.some(function(t){return t.hasResult()&&i.changes.touchesRange(t.from,t.to)})||!Hd(u,this.active)?s=hu.build(u,n,this.id,s,r):s&&s.disabled&&!u.some(function(t){return 1==t.state})&&(s=null),!s&&u.every(function(t){return 1!=t.state})&&u.some(function(t){return t.hasResult()})&&(u=u.map(function(t){return t.hasResult()?new du(t.source,0):t})),a=F(i.effects);try{for(a.s();!(f=a.n()).done;)(h=f.value).is(pu)&&(s=s&&s.setSelected(h.value,this.id))}catch(t){a.e(t)}finally{a.f()}return u==this.active&&s==this.open?this:new c(u,this.id,s)}},{key:"tooltip",get:function t(){return this.open?this.open.tooltip:null}},{key:"attrs",get:function t(){return this.open?this.open.attrs:lu}}],[{key:"start",value:function t(){return new c(vu,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}}]),c}(),lu={"aria-autocomplete":"list"},vu=[],yu=function(t){f(s,t);var o=S(s);function s(t,n,i,e,r){var t;return A(this,s),(t=o.call(this,t,2,n)).result=i,t.from=e,t.to=r,t}return D(s,[{key:"hasResult",value:function t(){return!0}},{key:"handleUserEvent",value:function t(n,i,e){var r,r,o,u,i,e,r=n.changes.mapPos(this.from),o=n.changes.mapPos(this.to,1),u=Pd(n.state);return(this.explicitPos<0?u<=r:u<this.from)||o<u||"delete"==i&&Pd(n.startState)==this.from?new du(this.source,"input"==i&&e.activateOnTyping?1:0):(i=this.explicitPos<0?-1:n.changes.mapPos(this.explicitPos),Vd(this.result.validFor,n.state,r,o)?new s(this.source,i,this.result,r,o):this.result.update&&(e=this.result.update(this.result,r,o,new Qo(n.state,u,0<=i)))?new s(this.source,i,e,e.from,null!=(r=e.to)?r:Pd(n.state)):new du(this.source,1,i))}},{key:"handleChange",value:function t(n){return n.changes.touchesRange(this.from,this.to)?new du(this.source,0):this.map(n.changes)}},{key:"map",value:function t(n){return n.empty?this:new s(this.source,this.explicitPos<0?-1:n.mapPos(this.explicitPos),this.result,n.mapPos(this.from),n.mapPos(this.to,1))}}]),s}(du=function(){function c(t,n){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:-1;A(this,c),this.source=t,this.state=n,this.explicitPos=i}return D(c,[{key:"hasResult",value:function t(){return!1}},{key:"update",value:function t(n,i){var e,r,o,u,s,a,f,h,e=Wd(n),r=this;e?r=r.handleUserEvent(n,e,i):n.docChanged?r=r.handleChange(n):n.selection&&0!=r.state&&(r=new c(r.source,0)),o=F(n.effects);try{for(o.s();!(u=o.n()).done;)if((s=u.value).is(tu))r=new c(r.source,1,s.value?Pd(n.state):-1);else if(s.is(nu))r=new c(r.source,0);else if(s.is(mu)){a=F(s.value);try{for(a.s();!(f=a.n()).done;)(h=f.value).source==r.source&&(r=h)}catch(t){a.e(t)}finally{a.f()}}}catch(t){o.e(t)}finally{o.f()}return r}},{key:"handleUserEvent",value:function t(n,i,e){return"delete"!=i&&e.activateOnTyping?new c(this.source,1):this.map(n.changes)}},{key:"handleChange",value:function t(n){return n.changes.touchesRange(Pd(n.startState))?new c(this.source,0):this.map(n.changes)}},{key:"map",value:function t(n){return n.empty||this.explicitPos<0?this:new c(this.source,this.state,n.mapPos(this.explicitPos))}}]),c}()),mu=v.define({map:function t(n,i){return n.map(function(t){return t.map(i)})}}),pu=v.define(),ku=b.define({create:function t(){return cu.start()},update:function t(n,i){return n.update(i)},provide:function t(n){return[Ue.from(n,function(t){return t.tooltip}),w.contentAttributes.from(n,function(t){return t.attrs})]}}),gu=w.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"\xb7\xb7\xb7"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"".concat(400,"px"),boxSizing:"border-box"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"".concat(30,"px")},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"".concat(30,"px")},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'\u0192'"}},".cm-completionIcon-class":{"&:after":{content:"'\u25cb'"}},".cm-completionIcon-interface":{"&:after":{content:"'\u25cc'"}},".cm-completionIcon-variable":{"&:after":{content:"'\ud835\udc65'"}},".cm-completionIcon-constant":{"&:after":{content:"'\ud835\udc36'"}},".cm-completionIcon-type":{"&:after":{content:"'\ud835\udc61'"}},".cm-completionIcon-enum":{"&:after":{content:"'\u222a'"}},".cm-completionIcon-property":{"&:after":{content:"'\u25a1'"}},".cm-completionIcon-keyword":{"&:after":{content:"'\ud83d\udd11\ufe0e'"}},".cm-completionIcon-namespace":{"&:after":{content:"'\u25a2'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),wu=D(function t(n,i,e,r){A(this,t),this.field=n,this.line=i,this.from=e,this.to=r}),bu=function(){function e(t,n,i){A(this,e),this.field=t,this.from=n,this.to=i}return D(e,[{key:"map",value:function t(n){var i,n,i=n.mapPos(this.from,-1,h.TrackDel),n=n.mapPos(this.to,1,h.TrackDel);return null==i||null==n?null:new e(this.field,i,n)}}]),e}(),Mu=function(){function b(t,n){A(this,b),this.lines=t,this.fieldPositions=n}return D(b,[{key:"instantiate",value:function t(n,i){var e,r,o,u,s,a,f,h,c,l,v,e=[],r=[i],o=n.doc.lineAt(i),u=/^\s*/.exec(o.text)[0],s=F(this.lines);try{for(s.s();!(a=s.n()).done;){if(f=a.value,e.length){for(h=u,c=/^\t*/.exec(f)[0].length,l=0;l<c;l++)h+=n.facet(ro);r.push(i+h.length-c),f=h+f.slice(c)}e.push(f),i+=f.length+1}}catch(t){s.e(t)}finally{s.f()}return{text:e,ranges:v=this.fieldPositions.map(function(t){return new bu(t.field,r[t.line]+t.from,r[t.line]+t.to)})}}}],[{key:"parse",value:function t(n){var i,e,r,o,u,s,a,f,h,c,l,v,d,y,m,p,k,g,w,i=[],e=[],r=[],u=F(n.split(/\r\n?|\n/));try{for(u.s();!(s=u.n()).done;){for(a=s.value;o=/[#$]\{(?:(\d+)(?::([^}]*))?|([^}]*))\}/.exec(a);){for(f=o[1]?+o[1]:null,h=o[2]||o[3]||"",c=-1,l=0;l<i.length;l++)(null!=f?i[l].seq==f:h&&i[l].name==h)&&(c=l);if(c<0){for(v=0;v<i.length&&(null==f||null!=i[v].seq&&i[v].seq<f);)v++;i.splice(v,0,{seq:f,name:h}),c=v,d=F(r);try{for(d.s();!(y=d.n()).done;)(m=y.value).field>=c&&m.field++}catch(t){d.e(t)}finally{d.f()}}r.push(new wu(c,e.length,o.index,o.index+h.length)),a=a.slice(0,o.index)+h+a.slice(o.index+o[0].length)}for(;p=/\\([{}])/.exec(a);){a=a.slice(0,p.index)+p[1]+a.slice(p.index+p[0].length),k=F(r);try{for(k.s();!(g=k.n()).done;)(w=g.value).line==e.length&&w.from>p.index&&(w.from--,w.to--)}catch(t){k.e(t)}finally{k.f()}}e.push(a)}}catch(t){u.e(t)}finally{u.f()}return new b(e,r)}}]),b}(),xu=m.widget({widget:new(function(t){f(i,t);var n=S(i);function i(){return A(this,i),n.apply(this,arguments)}return D(i,[{key:"toDOM",value:function t(){var n=document.createElement("span");return n.className="cm-snippetFieldPosition",n}},{key:"ignoreEvent",value:function t(){return!1}}]),i}(tn))}),Su=m.mark({class:"cm-snippetField"}),Cu=function(){function s(t,n){A(this,s),this.ranges=t,this.active=n,this.deco=m.set(t.map(function(t){return(t.from==t.to?xu:Su).range(t.from,t.to)}))}return D(s,[{key:"map",value:function t(n){var i,e,r,o,u,i=[],e=F(this.ranges);try{for(e.s();!(r=e.n()).done;){if(!(u=(o=r.value).map(n)))return null;i.push(u)}}catch(t){e.e(t)}finally{e.f()}return new s(i,this.active)}},{key:"selectionInsideField",value:function t(n){var i=this;return n.ranges.every(function(n){return i.ranges.some(function(t){return t.field==i.active&&t.from<=n.from&&t.to>=n.to})})}}]),s}(),ju=v.define({map:function t(n,i){return n&&n.map(i)}}),Pu=v.define(),Ou=b.define({create:function t(){return null},update:function t(n,i){var e,r,o,e=F(i.effects);try{for(e.s();!(r=e.n()).done;){if((o=r.value).is(ju))return o.value;if(o.is(Pu)&&n)return new Cu(n.ranges,o.value)}}catch(t){e.e(t)}finally{e.f()}return n=(n=n&&i.docChanged?n.map(i.changes):n)&&i.selection&&!n.selectionInsideField(i.selection)?null:n},provide:function t(n){return w.decorations.from(n,function(t){return t?t.deco:m.none})}}),Eu=[{key:"Tab",run:Vr=Gd(1),shift:Ur=Gd(-1)},{key:"Escape",run:n=function t(n){var i,n,e,i=n.state,n=n.dispatch,e;return!!i.field(Ou,!1)&&(n(i.update({effects:ju.of(null)})),!0)}}],Au=y.define({combine:function t(n){return n.length?n[0]:Eu}}),Du=st.highest(ie.compute([Au],function(t){return t.facet(Au)})),Ru=w.domEventHandlers({mousedown:function t(n,i){var e,r,o,e=i.state.field(Ou,!1);return!(!e||null==(r=i.posAtCoords({x:n.clientX,y:n.clientY}))||!(o=e.ranges.find(function(t){return t.from<=r&&t.to>=r}))||o.field==e.active||(i.dispatch({selection:$d(e.ranges,o.field),effects:ju.of(e.ranges.some(function(t){return t.field>o.field})?new Cu(e.ranges,o.field):null)}),0))}}),Iu=Object.create(null),t=function t(n){var i,e,r,r,o,i=n.state.languageDataAt("wordChars",n.pos).join(""),e=Xd(i),r=n.matchBefore(Zd(e,function(t){return t+"$"}));return r||n.explicit?{from:r=r?r.from:n.pos,options:o=n1(n.state.doc,Yd(i),e,5e4,r),validFor:Zd(e,function(t){return"^"+t})}:null},Tu={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Lu=v.define({map:function t(n,i){var i=i.mapPos(n,-1,h.TrackAfter);return null==i?void 0:i}}),(Bu=new(function(t){f(i,t);var n=S(i);function i(){return A(this,i),n.apply(this,arguments)}return D(i)}(jt))).startSide=1,Bu.endSide=-1,_u=b.define({create:function t(){return j.empty},update:function t(n,i){var e,r,o,u,s;n=(n=i.selection&&(e=i.state.doc.lineAt(i.selection.main.head).from,r=i.startState.doc.lineAt(i.startState.selection.main.head).from,e!=i.changes.mapPos(r,-1))?j.empty:n).map(i.changes),o=F(i.effects);try{for(o.s();!(u=o.n()).done;)(s=u.value).is(Lu)&&(n=n.update({add:[Bu.range(s.value,s.value+1)]}))}catch(t){o.e(t)}finally{o.f()}return n}}),Fu="()[]{}<>",Nu="object"==("undefined"==typeof navigator?"undefined":uh(navigator))&&/Android\b/.test(navigator.userAgent),Uu=w.inputHandler.of(function(t,n,i,e){var r,n;return!((Nu?t.composing:t.compositionStarted)||t.state.readOnly||(r=t.state.selection.main,2<e.length)||2==e.length&&1==Mh(wh(e,0))||n!=r.from||i!=r.to||!(n=o1(t.state,e))||(t.dispatch(n),0))}),Hu=[{key:"Backspace",run:e=function t(n){var o,n,i,u,s,i,o=n.state,n=n.dispatch;return!o.readOnly&&(i=r1(o,o.selection.main.head),u=i.brackets||Tu.brackets,s=null,i=o.changeByRange(function(t){var n,i,e,r;if(t.empty){n=a1(o.doc,t.head),i=F(u);try{for(i.s();!(e=i.n()).done;)if((r=e.value)==n&&s1(o.doc,t.head)==e1(wh(r,0)))return{changes:{from:t.head-r.length,to:t.head+r.length},range:O.cursor(t.head-r.length)}}catch(t){i.e(t)}finally{i.f()}}return{range:s=t}}),s||n(o.update(i,{scrollIntoView:!0,userEvent:"delete.backward"})),!s)}}],zu=[{key:"Ctrl-Space",run:$r},{key:"Escape",run:Yt},{key:"ArrowDown",run:Id(!0)},{key:"ArrowUp",run:Id(!1)},{key:"PageDown",run:Id(!0,"page")},{key:"PageUp",run:Id(!1,"page")},{key:"Enter",run:r}],Wu=st.highest(ie.computeN([eu],function(t){return t.facet(eu).defaultKeymap?[zu]:[]})),Vu=new WeakMap,$u=L.Autocomplete=Object.freeze({__proto__:null,CompletionContext:Qo,acceptCompletion:r,autocompletion:y1,clearSnippet:n,closeBrackets:i1,closeBracketsKeymap:Hu,closeCompletion:Yt,completeAnyWord:t,completeFromList:Sd,completionKeymap:zu,completionStatus:m1,currentCompletions:p1,deleteBracketPair:e,hasNextSnippetField:Jd,hasPrevSnippetField:Kd,ifIn:Cd,ifNotIn:jd,insertBracket:o1,insertCompletionText:Ed,moveCompletionSelection:Id,nextSnippetField:Vr,pickedCompletion:Zo,prevSnippetField:Ur,selectedCompletion:k1,selectedCompletionIndex:g1,setSelectedCompletion:w1,snippet:qd,snippetCompletion:Qd,snippetKeymap:Au,startCompletion:$r}),qu=b1(j1,0),Zt=b1(j1,1),Nr=b1(j1,2),nn=b1(C1,0),zr=b1(C1,1),u=b1(C1,2),Gu=b1(function(t,n){return C1(t,n,S1(n))},0),Ju=50,Ku=gt.define(),Qu=gt.define(),Xu=y.define(),Zu=y.define({combine:function t(n){return qh(n,{minDepth:100,newGroupDelay:500,joinToEvent:function t(n,i){return i}},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:function t(i,e){return function(t,n){return i(t,n)||e(t,n)}}})}}),o=Yu=b.define({create:function t(){return us.empty},update:function t(n,i){var e,r,o,o,u,s,o,u,s,r,e=i.state.facet(Zu),r=i.annotation(Ku);return r?(o=i.docChanged?O.single(P1(i.changes)):void 0,o=is.fromTransaction(i,o),s=0==(u=r.side)?n.undone:n.done,s=o?D1(s,s.length,e.minDepth,o):L1(s,i.startState.selection),new us(0==u?r.rest:s,0==u?s:r.rest)):("full"!=(o=i.annotation(Qu))&&"before"!=o||(n=n.isolate()),!1===i.annotation(Mt.addToHistory)?i.changes.empty?n:n.addMapping(i.changes.desc):(u=is.fromTransaction(i),s=i.annotation(Mt.time),r=i.annotation(Mt.userEvent),u?n=n.addChanges(u,s,r,e,i):i.selection&&(n=n.addSelection(i.startState.selection,s,r,e.newGroupDelay)),"full"!=o&&"after"!=o?n:n.isolate()))},toJSON:function t(n){return{done:n.done.map(function(t){return t.toJSON()}),undone:n.undone.map(function(t){return t.toJSON()})}},fromJSON:function t(n){return new us(n.done.map(is.fromJSON),n.undone.map(is.fromJSON))}}),ts=E1(0,!(Wr=function t(n){var i=n.state,i=i.doc.lineAt(i.selection.main.from),i=M1(n.state,i.from);return i.line?qu(n):!!i.block&&Gu(n)})),ns=E1(1,!1),Hr=E1(0,!0),jt=E1(1,!0),r=A1(0),n=A1(1),is=function(){function a(t,n,i,e,r){A(this,a),this.changes=t,this.effects=n,this.mapped=i,this.startSelection=e,this.selectionsAfter=r}return D(a,[{key:"setSelAfter",value:function t(n){return new a(this.changes,this.effects,this.mapped,this.startSelection,n)}},{key:"toJSON",value:function t(){var n,n,n;return{changes:null==(n=this.changes)?void 0:n.toJSON(),mapped:null==(n=this.mapped)?void 0:n.toJSON(),startSelection:null==(n=this.startSelection)?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map(function(t){return t.toJSON()})}}}],[{key:"fromJSON",value:function t(n){return new a(n.changes&&K.fromJSON(n.changes),[],n.mapped&&J.fromJSON(n.mapped),n.startSelection&&O.fromJSON(n.startSelection),n.selectionsAfter.map(O.fromJSON))}},{key:"fromTransaction",value:function t(n,i){var e,r,o,u,s,e=es,r=F(n.startState.facet(Xu));try{for(r.s();!(o=r.n()).done;)(s=(u=o.value)(n)).length&&(e=e.concat(s))}catch(t){r.e(t)}finally{r.f()}return!e.length&&n.changes.empty?null:new a(n.changes.invert(n.startState.doc),e,void 0,i||n.startState.selection,es)}},{key:"selection",value:function t(n){return new a(void 0,es,void 0,void 0,n)}}]),a}(),es=[],rs=200,os=/^(input\.type|delete)($|\.)/,(us=function(){function a(t,n){var i,e,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,e=3<arguments.length&&void 0!==arguments[3]?arguments[3]:void 0;A(this,a),this.done=t,this.undone=n,this.prevTime=i,this.prevUserEvent=e}return D(a,[{key:"isolate",value:function t(){return this.prevTime?new a(this.done,this.undone):this}},{key:"addChanges",value:function t(n,i,e,r,o){var u=this.done,s=u[u.length-1],u;return new a(u=s&&s.changes&&!s.changes.empty&&n.changes&&(!e||os.test(e))&&(!s.selectionsAfter.length&&i-this.prevTime<r.newGroupDelay&&r.joinToEvent(o,R1(s.changes,n.changes))||"input.type.compose"==e)?D1(u,u.length-1,r.minDepth,new is(n.changes.compose(s.changes),T1(n.effects,s.effects),s.mapped,s.startSelection,es)):D1(u,u.length,r.minDepth,n),es,i,e)}},{key:"addSelection",value:function t(n,i,e,r){var o=this.done.length?this.done[this.done.length-1].selectionsAfter:es;return 0<o.length&&i-this.prevTime<r&&e==this.prevUserEvent&&e&&/^select($|\.)/.test(e)&&I1(o[o.length-1],n)?this:new a(L1(this.done,n),this.undone,i,e)}},{key:"addMapping",value:function t(n){return new a(_1(this.done,n),_1(this.undone,n),this.prevTime,this.prevUserEvent)}},{key:"pop",value:function t(n,i,e){var r,o,e,r=0==n?this.done:this.undone;return 0==r.length?null:(o=r[r.length-1],e&&o.selectionsAfter.length?i.update({selection:o.selectionsAfter[o.selectionsAfter.length-1],annotations:Ku.of({side:n,rest:B1(r)}),userEvent:0==n?"select.undo":"select.redo",scrollIntoView:!0}):o.changes?(e=1==r.length?es:r.slice(0,r.length-1),o.mapped&&(e=_1(e,o.mapped)),i.update({changes:o.changes,selection:o.startSelection,effects:o.effects,annotations:Ku.of({side:n,rest:e}),filter:!1,userEvent:0==n?"undo":"redo",scrollIntoView:!0})):null)}}]),a}()).empty=new us(es,es),ss=[{key:"Mod-z",run:ts,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:ns,preventDefault:!0},{linux:"Ctrl-Shift-z",run:ns,preventDefault:!0},{key:"Mod-u",run:Hr,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:jt,preventDefault:!0}],ra=function t(a,f){return sy(a,function(t){var n,i,e,r,o,u,s,n=a.state,i=n.doc.lineAt(t);if(!f&&t>i.from&&t<i.from+200&&!/[^ \t]/.test(e=i.text.slice(0,t-i.from))){if("\t"==e[e.length-1])return t-1;for(u=(o=ic(e,n.tabSize))%Pv(n)||Pv(n),s=0;s<u&&" "==e[e.length-1-s];s++)t--;r=t}else(r=yh(i.text,t-i.from,f,f)+i.from)==t&&i.number!=(f?n.doc.lines:1)&&(r+=f?1:-1);return r})},sa=function t(f,h){return sy(f,function(t){for(var n,i,e,r,o,u,s,a,n=t,i=f.state,e=i.doc.lineAt(n),r=i.charCategorizer(n),o=null;;){if(n==(h?e.to:e.from)){n==t&&e.number!=(h?i.doc.lines:1)&&(n+=h?1:-1);break}if(u=yh(e.text,n-e.from,h)+e.from,a=r(s=e.text.slice(Math.min(n,u)-e.from,Math.max(n,u)-e.from)),null!=o&&a!=o)break;" "==s&&n==t||(o=a),n=u}return n})},Pa=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:Yt=function t(n){return H1(n,function(t){return K1(n.state,t,!V1(n))})},shift:t=function t(n){return ny(n,function(t){return K1(n.state,t,!V1(n))})}},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:e=function t(n){return H1(n,function(t){return K1(n.state,t,V1(n))})},shift:Vr=function t(n){return ny(n,function(t){return K1(n.state,t,V1(n))})}},{key:"Alt-ArrowUp",run:Ur=function t(n){var i,e;return hy(n.state,n.dispatch,!1)}},{key:"Shift-Alt-ArrowUp",run:$r=function t(n){var i,e;return cy(n.state,n.dispatch,!1)}},{key:"Alt-ArrowDown",run:ya=function t(n){var i,e;return hy(n.state,n.dispatch,!0)}},{key:"Shift-Alt-ArrowDown",run:ma=function t(n){var i,e;return cy(n.state,n.dispatch,!0)}},{key:"Escape",run:ea=function t(n){var i,n,e,r,i=n.state,n=n.dispatch,e=i.selection,r=null;return 1<e.ranges.length?r=O.create([e.main]):e.main.empty||(r=O.create([O.cursor(e.main.head)])),!!r&&(n(U1(i,r)),!0)}},{key:"Mod-Enter",run:wa=vy(!0)},{key:"Alt-l",mac:"Ctrl-l",run:na=function t(n){var i,n,e,i=n.state,n=n.dispatch,e=fy(i).map(function(t){var n=t.from,t=t.to;return O.range(n,Math.min(t+1,i.doc.length))});return n(i.update({selection:O.create(e),userEvent:"select"})),!0}},{key:"Mod-i",run:ia=function t(n){var e,n,i,e=n.state,n=n.dispatch,i=N1(e.selection,function(t){for(var n,i,i=R(e).resolveInner(t.head,1);!(i.from<t.from&&i.to>=t.to||i.to>t.to&&i.from<=t.from||null==(n=i.parent))&&n.parent;)i=i.parent;return O.range(i.to,i.from)});return n(U1(e,i)),!0},preventDefault:!0},{key:"Mod-[",run:xa=function t(n){var u=n.state,n=n.dispatch;return!u.readOnly&&(n(u.update(dy(u,function(t,n){var i,e,r,o,i=/^\s*/.exec(t.text)[0];if(i){for(e=ic(i,u.tabSize),r=0,o=Ov(u,Math.max(0,e-Pv(u)));r<i.length&&r<o.length&&i.charCodeAt(r)==o.charCodeAt(r);)r++;n.push({from:t.from+r,to:t.from+i.length,insert:o.slice(r)})}}),{userEvent:"delete.dedent"})),!0)}},{key:"Mod-]",run:Ma=function t(n){var i=n.state,n=n.dispatch;return!i.readOnly&&(n(i.update(dy(i,function(t,n){n.push({from:t.from,insert:i.facet(ro)})}),{userEvent:"input.indent"})),!0)}},{key:"Mod-Alt-\\",run:ba=function t(n){var u,n,s,a,i,u=n.state,n=n.dispatch;return!u.readOnly&&(s=Object.create(null),a=new oo(u,{overrideIndentation:function t(n){var n=s[n];return null==n?-1:n}}),(i=dy(u,function(t,n,i){var e,r,o,e=Ev(a,t.from);null!=e&&(/\S/.test(t.text)||(e=0),(r=/^\s*/.exec(t.text)[0])!=(o=Ov(u,e))||i.from<t.from+r.length)&&(s[t.from]=e,n.push({from:t.from,to:t.from+r.length,insert:o}))})).changes.empty||n(u.update(i,{userEvent:"indent"})),!0)}},{key:"Shift-Mod-k",run:pa=function t(n){var i,e,r;return!n.state.readOnly&&(e=(i=n.state).changes(fy(i).map(function(t){var n=t.from,t=t.to;return 0<n?n--:t<i.doc.length&&t++,{from:n,to:t}})),r=N1(i.selection,function(t){return n.moveVertically(t,!0)}).map(e),n.dispatch({changes:e,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0)}},{key:"Shift-Mod-\\",run:Os=function t(n){var i,e;return ty(n.state,n.dispatch,!1)}},{key:"Mod-/",run:Wr},{key:"Alt-A",run:nn}].concat(ja=[{key:"ArrowLeft",run:as=function t(n){return W1(n,!V1(n))},shift:As=function t(n){return iy(n,!V1(n))},preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:ls=function t(n){return $1(n,!V1(n))},shift:Ts=function t(n){return ey(n,!V1(n))},preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Ss=function t(n){return H1(n,function(t){return Y1(n,t,!V1(n))})},shift:qs=function t(n){return ny(n,function(t){return Y1(n,t,!V1(n))})},preventDefault:!0},{key:"ArrowRight",run:fs=function t(n){return W1(n,V1(n))},shift:Ds=function t(n){return iy(n,V1(n))},preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:vs=function t(n){return $1(n,V1(n))},shift:Ls=function t(n){return ey(n,V1(n))},preventDefault:!0},{mac:"Cmd-ArrowRight",run:Cs=function t(n){return H1(n,function(t){return Y1(n,t,V1(n))})},shift:Gs=function t(n){return ny(n,function(t){return Y1(n,t,V1(n))})},preventDefault:!0},{key:"ArrowUp",run:ks=function t(n){return Q1(n,!1)},shift:Us=function t(n){return oy(n,!1)},preventDefault:!0},{mac:"Cmd-ArrowUp",run:Qs=function t(n){var i=n.state,e;return(0,n.dispatch)(U1(i,{anchor:0})),!0},shift:Zs=function t(n){var i=n.state,e;return(0,n.dispatch)(U1(i,{anchor:i.selection.main.anchor,head:0})),!0}},{mac:"Ctrl-ArrowUp",run:ws=function t(n){return Z1(n,!1)},shift:zs=function t(n){return uy(n,!1)}},{key:"ArrowDown",run:gs=function t(n){return Q1(n,!0)},shift:Hs=function t(n){return oy(n,!0)},preventDefault:!0},{mac:"Cmd-ArrowDown",run:Xs=function t(n){var i=n.state,e;return(0,n.dispatch)(U1(i,{anchor:i.doc.length})),!0},shift:Ys=function t(n){var i=n.state,e;return(0,n.dispatch)(U1(i,{anchor:i.selection.main.anchor,head:i.doc.length})),!0}},{mac:"Ctrl-ArrowDown",run:bs=function t(n){return Z1(n,!0)},shift:Ws=function t(n){return uy(n,!0)}},{key:"PageUp",run:ws,shift:zs},{key:"PageDown",run:bs,shift:Ws},{key:"Home",run:xs=function t(n){return H1(n,function(t){return Y1(n,t,!1)})},shift:$s=function t(n){return ny(n,function(t){return Y1(n,t,!1)})},preventDefault:!0},{key:"Mod-Home",run:Qs,shift:Zs},{key:"End",run:Ms=function t(n){return H1(n,function(t){return Y1(n,t,!0)})},shift:Vs=function t(n){return ny(n,function(t){return Y1(n,t,!0)})},preventDefault:!0},{key:"Mod-End",run:Xs,shift:Ys},{key:"Enter",run:ga=vy(!(ka=function t(n){var i=n.state,e;return(0,n.dispatch)(i.update(i.replaceSelection(i.lineBreak),{scrollIntoView:!0,userEvent:"input"})),!0}))},{key:"Mod-a",run:ta=function t(n){var i=n.state,e;return(0,n.dispatch)(i.update({selection:{anchor:0,head:i.doc.length},userEvent:"select"})),!0}},{key:"Backspace",run:oa=function t(n){return ra(n,!1)},shift:oa},{key:"Delete",run:ua=function t(n){return ra(n,!0)}},{key:"Mod-Backspace",mac:"Alt-Backspace",run:aa=function t(n){return sa(n,!1)}},{key:"Mod-Delete",mac:"Alt-Delete",run:fa=function t(n){return sa(n,!0)}},{mac:"Mod-Backspace",run:ca=function t(i){return sy(i,function(t){var n=i.lineBlockAt(t).from;return n<t?n:Math.max(0,t-1)})}},{mac:"Mod-Delete",run:ha=function t(i){return sy(i,function(t){var n=i.lineBlockAt(t).to;return t<n?n:Math.min(i.state.doc.length,t+1)})}}].concat((Ca=[{key:"Ctrl-b",run:as,shift:As,preventDefault:!0},{key:"Ctrl-f",run:fs,shift:Ds},{key:"Ctrl-p",run:ks,shift:Us},{key:"Ctrl-n",run:gs,shift:Hs},{key:"Ctrl-a",run:js=function t(n){return H1(n,function(t){return O.cursor(n.lineBlockAt(t.head).from,1)})},shift:Js=function t(n){return ny(n,function(t){return O.cursor(n.lineBlockAt(t.head).from)})}},{key:"Ctrl-e",run:Ps=function t(n){return H1(n,function(t){return O.cursor(n.lineBlockAt(t.head).to,-1)})},shift:Ks=function t(n){return ny(n,function(t){return O.cursor(n.lineBlockAt(t.head).to)})}},{key:"Ctrl-d",run:ua},{key:"Ctrl-h",run:oa},{key:"Ctrl-k",run:ha},{key:"Ctrl-Alt-h",run:aa},{key:"Ctrl-o",run:va=function t(n){var i,n,e,i=n.state,n=n.dispatch;return!i.readOnly&&(e=i.changeByRange(function(t){return{changes:{from:t.from,to:t.to,insert:k.of(["",""])},range:O.cursor(t.from)}}),n(i.update(e,{scrollIntoView:!0,userEvent:"input"})),!0)}},{key:"Ctrl-t",run:da=function t(n){var r,n,i,r=n.state,n=n.dispatch;return!r.readOnly&&!(i=r.changeByRange(function(t){var n,i,e,i;return t.empty&&0!=t.from&&t.from!=r.doc.length?{changes:{from:e=(n=t.from)==(i=r.doc.lineAt(n)).from?n-1:yh(i.text,n-i.from,!1)+i.from,to:i=n==i.to?n+1:yh(i.text,n-i.from,!0)+i.from,insert:r.doc.slice(n,i).append(r.doc.slice(e,n))},range:O.cursor(i)}:{range:t}})).changes.empty&&(n(r.update(i,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:bs}]).map(function(t){return{mac:t.key,run:t.run,shift:t.shift}}))),Ea=L.Commands=Object.freeze({__proto__:null,blockComment:zr,blockUncomment:u,copyLineDown:ma,copyLineUp:$r,cursorCharBackward:cs=function t(n){return W1(n,!1)},cursorCharForward:hs=function t(n){return W1(n,!0)},cursorCharLeft:as,cursorCharRight:fs,cursorDocEnd:Xs,cursorDocStart:Qs,cursorGroupBackward:ys=function t(n){return $1(n,!1)},cursorGroupForward:ds=function t(n){return $1(n,!0)},cursorGroupLeft:ls,cursorGroupRight:vs,cursorLineBoundaryBackward:xs,cursorLineBoundaryForward:Ms,cursorLineBoundaryLeft:Ss,cursorLineBoundaryRight:Cs,cursorLineDown:gs,cursorLineEnd:Ps,cursorLineStart:js,cursorLineUp:ks,cursorMatchingBracket:Os,cursorPageDown:bs,cursorPageUp:ws,cursorSubwordBackward:ps=function t(n){return G1(n,!1)},cursorSubwordForward:ms=function t(n){return G1(n,!0)},cursorSyntaxLeft:Yt,cursorSyntaxRight:e,defaultKeymap:Pa,deleteCharBackward:oa,deleteCharForward:ua,deleteGroupBackward:aa,deleteGroupForward:fa,deleteLine:pa,deleteToLineEnd:ha,deleteToLineStart:ca,deleteTrailingWhitespace:la=function t(n){var i,n,e,r,o,u,s,i=n.state,n=n.dispatch;if(i.readOnly)return!1;for(e=[],r=0,o="",u=i.doc.iter();;){if(u.next(),u.lineBreak||u.done){if(-1<(s=o.search(/\s+$/))&&e.push({from:r-(o.length-s),to:r}),u.done)break;o=""}else o=u.value;r+=u.value.length}return!!e.length&&(n(i.update({changes:e,userEvent:"delete"})),!0)},emacsStyleKeymap:Ca,history:O1,historyField:o,historyKeymap:ss,indentLess:xa,indentMore:Ma,indentSelection:ba,indentWithTab:Oa={key:"Tab",run:Ma,shift:xa},insertBlankLine:wa,insertNewline:ka,insertNewlineAndIndent:ga,insertTab:Sa=function t(n){var i=n.state,n=n.dispatch;return i.selection.ranges.some(function(t){return!t.empty})?Ma({state:i,dispatch:n}):(n(i.update(i.replaceSelection("\t"),{scrollIntoView:!0,userEvent:"input"})),!0)},invertedEffects:Xu,isolateHistory:Qu,lineComment:Zt,lineUncomment:Nr,moveLineDown:ya,moveLineUp:Ur,redo:ns,redoDepth:n,redoSelection:jt,selectAll:ta,selectCharBackward:Is=function t(n){return iy(n,!1)},selectCharForward:Rs=function t(n){return iy(n,!0)},selectCharLeft:As,selectCharRight:Ds,selectDocEnd:Ys,selectDocStart:Zs,selectGroupBackward:_s=function t(n){return ey(n,!1)},selectGroupForward:Bs=function t(n){return ey(n,!0)},selectGroupLeft:Ts,selectGroupRight:Ls,selectLine:na,selectLineBoundaryBackward:$s,selectLineBoundaryForward:Vs,selectLineBoundaryLeft:qs,selectLineBoundaryRight:Gs,selectLineDown:Hs,selectLineEnd:Ks,selectLineStart:Js,selectLineUp:Us,selectMatchingBracket:Es=function t(n){var i,e;return ty(n.state,n.dispatch,!0)},selectPageDown:Ws,selectPageUp:zs,selectParentSyntax:ia,selectSubwordBackward:Ns=function t(n){return ry(n,!1)},selectSubwordForward:Fs=function t(n){return ry(n,!0)},selectSyntaxLeft:t,selectSyntaxRight:Vr,simplifySelection:ea,splitLine:va,standardKeymap:ja,toggleBlockComment:nn,toggleBlockCommentByLine:Gu,toggleComment:Wr,toggleLineComment:qu,transposeChars:da,undo:ts,undoDepth:r,undoSelection:Hr}),Aa=D(function t(n,i,e){A(this,t),this.from=n,this.to=i,this.diagnostic=e}),Da=function(){function o(t,n,i){A(this,o),this.diagnostics=t,this.panel=n,this.selected=i}return D(o,null,[{key:"init",value:function t(n,i,e){var n,r,r,n=n,r=e.facet(Ua).markerFilter;return r&&(n=r(n)),new o(r=m.set(n.map(function(t){return t.from==t.to||t.from==t.to-1&&e.doc.lineAt(t.from).to==t.from?m.widget({widget:new Ha(t),diagnostic:t}).range(t.from):m.mark({attributes:{class:"cm-lintRange cm-lintRange-"+t.severity},diagnostic:t}).range(t.from,t.to)}),!0),i,my(r))}}]),o}(),Ra=v.define(),Ia=v.define(),Ta=v.define(),La=b.define({create:function t(){return new Da(m.none,null,null)},update:function t(n,i){var e,r,o,u,s,a;i.docChanged&&(e=n.diagnostics.map(i.changes),r=null,n.selected&&(o=i.changes.mapPos(n.selected.from,1),r=my(e,n.selected.diagnostic,o)||my(e,null,o)),n=new Da(e,n.panel,r)),u=F(i.effects);try{for(u.s();!(s=u.n()).done;)(a=s.value).is(Ra)?n=Da.init(a.value,n.panel,i.state):a.is(Ia)?n=new Da(n.diagnostics,a.value?Wa.open:null,n.selected):a.is(Ta)&&(n=new Da(n.diagnostics,n.panel,a.value))}catch(t){u.e(t)}finally{u.f()}return n},provide:function t(n){return[Ke.from(n,function(t){return t.panel}),w.decorations.from(n,function(t){return t.diagnostics})]}}),Ba=m.mark({class:"cm-lintRange cm-lintRange-active"}),_a=function t(n){var i=n.state.field(La,!1);return!(!i||!i.panel||(n.dispatch({effects:Ia.of(!1)}),0))},Fa=[{key:"Mod-Shift-m",run:zr=function t(n){var i,i,i=n.state.field(La,!1);return i&&i.panel||n.dispatch({effects:ky(n.state,[Ia.of(!0)])}),(i=W0(n,Wa.open))&&i.dom.querySelector(".cm-panel-lint ul").focus(),!0},preventDefault:!0},{key:"F8",run:u=function t(n){var i,e,r,i=n.state.field(La,!1);return!(!i||(e=n.state.selection.main,!(r=i.diagnostics.iter(e.to+1)).value&&(!(r=i.diagnostics.iter(0)).value||r.from==e.from&&r.to==e.to))||(n.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),0))}}],Na=d.fromClass(function(){function i(t){A(this,i),this.view=t,this.timeout=-1,this.set=!0;var n,t=t.state.facet(Ua).delay;this.lintTime=Date.now()+t,this.run=this.run.bind(this),this.timeout=setTimeout(this.run,t)}return D(i,[{key:"run",value:function t(){var n,i,e,r,i,n=this,i=Date.now();i<this.lintTime-10?setTimeout(this.run,this.lintTime-i):(this.set=!1,i=(r=(e=this.view.state).facet(Ua)).sources,Promise.all(i.map(function(t){return Promise.resolve(t(n.view))})).then(function(t){var t=t.reduce(function(t,n){return t.concat(n)});n.view.state.doc==e.doc&&n.view.dispatch(gy(n.view.state,t))},function(t){Wc(n.view.state,t)}))}},{key:"update",value:function t(n){var i=n.state.facet(Ua);(n.docChanged||i!=n.startState.facet(Ua)||i.needsRefresh&&i.needsRefresh(n))&&(this.lintTime=Date.now()+i.delay,this.set||(this.set=!0,this.timeout=setTimeout(this.run,i.delay)))}},{key:"force",value:function t(){this.set&&(this.lintTime=Date.now(),this.run())}},{key:"destroy",value:function t(){clearTimeout(this.timeout)}}]),i}()),Ua=y.define({combine:function t(n){return Object.assign({sources:n.map(function(t){return t.source})},qh(n.map(function(t){return t.config}),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null},{needsRefresh:function t(n,i){return n?i?function(t){return n(t)||i(t)}:n:i}}))}}),Ha=function(t){f(e,t);var i=S(e);function e(t){var n;return A(this,e),(n=i.call(this)).diagnostic=t,n}return D(e,[{key:"eq",value:function t(n){return n.diagnostic==this.diagnostic}},{key:"toDOM",value:function t(){return I("span",{class:"cm-lintPoint cm-lintPoint-"+this.diagnostic.severity})}}]),e}(tn),za=D(function t(n,i){A(this,t),this.diagnostic=i,this.id="item_"+Math.floor(4294967295*Math.random()).toString(16),this.dom=jy(n,i,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}),Wa=function(){function i(u){var s,t,n,s=this;A(this,i),this.view=u,this.items=[],t=function t(n){var i,e,r,o;if(27==n.keyCode)_a(s.view),s.view.focus();else if(38==n.keyCode||33==n.keyCode)s.moveSelection((s.selectedIndex-1+s.items.length)%s.items.length);else if(40==n.keyCode||34==n.keyCode)s.moveSelection((s.selectedIndex+1)%s.items.length);else if(36==n.keyCode)s.moveSelection(0);else if(35==n.keyCode)s.moveSelection(s.items.length-1);else if(13==n.keyCode)s.view.focus();else{if(!(65<=n.keyCode&&n.keyCode<=90&&0<=s.selectedIndex))return;for(e=Cy((i=s.items[s.selectedIndex].diagnostic).actions),r=0;r<e.length;r++)e[r].toUpperCase().charCodeAt(0)==n.keyCode&&(o=my(s.view.state.field(La).diagnostics,i))&&i.actions[r].apply(u,o.from,o.to)}n.preventDefault()},n=function t(n){for(var i=0;i<s.items.length;i++)s.items[i].dom.contains(n.target)&&s.moveSelection(i)},this.list=I("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t,onclick:n}),this.dom=I("div",{class:"cm-panel-lint"},this.list,I("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:function t(){return _a(s.view)}},"\xd7")),this.update()}return D(i,[{key:"selectedIndex",get:function t(){var n,i,n=this.view.state.field(La).selected;if(n)for(i=0;i<this.items.length;i++)if(this.items[i].diagnostic==n.diagnostic)return i;return-1}},{key:"update",value:function t(){var s,n,i,a,f,h,c,s=this,n=this.view.state.field(La),i=n.diagnostics,a=n.selected,f=0,h=!1,c=null;for(i.between(0,this.view.state.doc.length,function(t,n,i){for(var e,r,o,u,e=i.spec,r=-1,u=f;u<s.items.length;u++)if(s.items[u].diagnostic==e.diagnostic){r=u;break}r<0?(o=new za(s.view,e.diagnostic),s.items.splice(f,0,o),h=!0):(o=s.items[r],f<r&&(s.items.splice(f,r-f),h=!0)),a&&o.diagnostic==a.diagnostic?o.dom.hasAttribute("aria-selected")||(o.dom.setAttribute("aria-selected","true"),c=o):o.dom.hasAttribute("aria-selected")&&o.dom.removeAttribute("aria-selected"),f++});f<this.items.length&&!(1==this.items.length&&this.items[0].diagnostic.from<0);)h=!0,this.items.pop();0==this.items.length&&(this.items.push(new za(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),h=!0),c?(this.list.setAttribute("aria-activedescendant",c.id),this.view.requestMeasure({key:this,read:function t(){return{sel:c.dom.getBoundingClientRect(),panel:s.list.getBoundingClientRect()}},write:function t(n){var i=n.sel,n=n.panel;i.top<n.top?s.list.scrollTop-=n.top-i.top:i.bottom>n.bottom&&(s.list.scrollTop+=i.bottom-n.bottom)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),h&&this.sync()}},{key:"sync",value:function t(){var n,i,e,r;function o(){var t=n;n=t.nextSibling,t.remove()}n=this.list.firstChild,i=F(this.items);try{for(i.s();!(e=i.n()).done;)if((r=e.value).dom.parentNode==this.list){for(;n!=r.dom;)o();n=r.dom.nextSibling}else this.list.insertBefore(r.dom,n)}catch(t){i.e(t)}finally{i.f()}for(;n;)o()}},{key:"moveSelection",value:function t(n){var i,n;this.selectedIndex<0||(n=my((i=this.view.state.field(La)).diagnostics,this.items[n].diagnostic))&&this.view.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0,effects:Ta.of(n)})}}],[{key:"open",value:function t(n){return new i(n)}}]),i}(),ma=w.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:Oy("#d11")},".cm-lintRange-warning":{backgroundImage:Oy("orange")},".cm-lintRange-info":{backgroundImage:Oy("#999")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}}),Va=function(t){f(e,t);var i=S(e);function e(t){var n;return A(this,e),(n=i.call(this)).diagnostics=t,n.severity=t.reduce(function(t,n){var n=n.severity;return"error"==n||"warning"==n&&"info"==t?n:t},"info"),n}return D(e,[{key:"toDOM",value:function t(n){var i,e,r,i=document.createElement("div");return i.className="cm-lint-marker cm-lint-marker-"+this.severity,e=this.diagnostics,r=n.state.facet(Xa).tooltipFilter,(e=r?r(e):e).length&&(i.onmouseover=function(){return Ay(n,i,e)}),i}}]),e}(en),$a=$0({class:"cm-gutter-lint",markers:function t(n){return n.state.field(qa)}}),qa=b.define({create:function t(){return j.empty},update:function t(n,i){var e,r,o,u,s;n=n.map(i.changes),e=i.state.facet(Xa).markerFilter,r=F(i.effects);try{for(r.s();!(o=r.n()).done;)(u=o.value).is(Ra)&&(s=u.value,e&&(s=e(s||[])),n=Dy(i.state.doc,s.slice(0)))}catch(t){r.e(t)}finally{r.f()}return n}}),Ga=v.define(),Ja=b.define({create:function t(){return null},update:function t(n,i){return n&&i.docChanged&&(n=py(i,n)?null:Object.assign(Object.assign({},n),{pos:i.changes.mapPos(n.pos)})),i.effects.reduce(function(t,n){return n.is(Ga)?n.value:t},n)},provide:function t(n){return Ue.from(n)}}),Ka=w.baseTheme({".cm-gutter-lint":{width:"1.4em","& .cm-gutterElement":{padding:".2em"}},".cm-lint-marker":{width:"1em",height:"1em"},".cm-lint-marker-info":{content:Py('<path fill="#aaf" stroke="#77e" stroke-width="6" stroke-linejoin="round" d="M5 5L35 5L35 35L5 35Z"/>')},".cm-lint-marker-warning":{content:Py('<path fill="#fe8" stroke="#fd7" stroke-width="6" stroke-linejoin="round" d="M20 6L37 35L3 35Z"/>')},".cm-lint-marker-error":{content:Py('<circle cx="20" cy="20" r="15" fill="#f87" stroke="#f43" stroke-width="6"/>')}}),Qa=[La,w.decorations.compute([La],function(t){var t=t.field(La),n=t.selected,t=t.panel;return n&&t&&n.from!=n.to?m.set([Ba.range(n.from,n.to)]):m.none}),F0(by,{hideOn:py}),ma],Xa=y.define({combine:function t(n){return qh(n,{hoverTime:300,markerFilter:null,tooltipFilter:null})}}),Za=L.Lint=Object.freeze({__proto__:null,closeLintPanel:_a,diagnosticCount:wy,forEachDiagnostic:Iy,forceLinting:Sy,lintGutter:Ry,lintKeymap:Fa,linter:xy,nextDiagnostic:u,openLintPanel:zr,setDiagnostics:gy,setDiagnosticsEffect:Ra}),Ya="function"==typeof String.prototype.normalize?function(t){return t.normalize("NFKD")}:function(t){return t},tf=function(){function u(t,n){var i,e,r,o,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,e=3<arguments.length&&void 0!==arguments[3]?arguments[3]:t.length,r=4<arguments.length?arguments[4]:void 0,o=5<arguments.length?arguments[5]:void 0;A(this,u),this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=t.iterRange(i,e),this.bufferStart=i,this.normalize=r?function(t){return r(Ya(t))}:Ya,this.query=this.normalize(n)}return D(u,[{key:"peek",value:function t(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return wh(this.buffer,this.bufferPos)}},{key:"next",value:function t(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}},{key:"nextOverlapping",value:function t(){for(var n,i,e,r,o,u,s,a;;){if((n=this.peek())<0)return this.done=!0,this;for(i=bh(n),e=this.bufferStart+this.bufferPos,this.bufferPos+=Mh(n),r=this.normalize(i),o=0,u=e;;o++){if(s=r.charCodeAt(o),a=this.match(s,u))return this.value=a,this;if(o==r.length-1)break;u==e&&o<i.length&&i.charCodeAt(o)==s&&u++}}}},{key:"match",value:function t(n,i){var t,e,r,o;for(t=null,e=0;e<this.matches.length;e+=2)r=this.matches[e],o=!1,this.query.charCodeAt(r)==n&&(r==this.query.length-1?t={from:this.matches[e+1],to:i+1}:(this.matches[e]++,o=!0)),o||(this.matches.splice(e,2),e-=2);return this.query.charCodeAt(0)==n&&(1==this.query.length?t={from:i,to:i+1}:this.matches.push(1,i)),t=t&&this.test&&!this.test(t.from,t.to,this.buffer,this.bufferPos)?null:t}}]),u}(),"undefined"!=typeof Symbol&&(tf.prototype[Symbol.iterator]=function(){return this}),nf={from:-1,to:-1,match:/.*/.exec("")},ef="gm"+(null==/x/.unicode?"":"u"),rf=function(){function o(t,n,i){var e,r,r,e=3<arguments.length&&void 0!==arguments[3]?arguments[3]:0,r=4<arguments.length&&void 0!==arguments[4]?arguments[4]:t.length;if(A(this,o),this.text=t,this.to=r,this.curLine="",this.done=!1,this.value=nf,/\\[sWDnr]|\n|\r|\[\^/.test(n))return new sf(t,n,i,e,r);this.re=new RegExp(n,ef+(null!=i&&i.ignoreCase?"i":"")),this.test=null==i?void 0:i.test,this.iter=t.iter(),r=t.lineAt(e),this.curLineStart=r.from,this.matchPos=Ly(t,e),this.getLine(this.curLineStart)}return D(o,[{key:"getLine",value:function t(n){this.iter.next(n),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}},{key:"nextLine",value:function t(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}},{key:"next",value:function t(){for(var n,i,e,r,n=this.matchPos-this.curLineStart;;)if(this.re.lastIndex=n,i=this.matchPos<=this.to&&this.re.exec(this.curLine)){if(r=(e=this.curLineStart+i.index)+i[0].length,this.matchPos=Ly(this.text,r+(e==r?1:0)),e==this.curLineStart+this.curLine.length&&this.nextLine(),(e<r||e>this.value.to)&&(!this.test||this.test(e,r,i)))return this.value={from:e,to:r,match:i},this;n=this.matchPos-this.curLineStart}else{if(!(this.curLineStart+this.curLine.length<this.to))return this.done=!0,this;this.nextLine(),n=0}}}]),o}(),of=new WeakMap,uf=function(){function s(t,n){A(this,s),this.from=t,this.text=n}return D(s,[{key:"to",get:function t(){return this.from+this.text.length}}],[{key:"get",value:function t(n,i,e){var r,o,o,u,r=of.get(n);return!r||r.from>=e||r.to<=i?(o=new s(i,n.sliceString(i,e)),of.set(n,o),o):r.from==i&&r.to==e?r:(o=r.text,i<(u=r.from)&&(o=n.sliceString(i,u)+o,u=i),r.to<e&&(o+=n.sliceString(r.to,e)),of.set(n,new s(u,o)),new s(i,o.slice(i-u,e-u)))}}]),s}(),sf=function(){function o(t,n,i,e,r){A(this,o),this.text=t,this.to=r,this.done=!1,this.value=nf,this.matchPos=Ly(t,e),this.re=new RegExp(n,ef+(null!=i&&i.ignoreCase?"i":"")),this.test=null==i?void 0:i.test,this.flat=uf.get(t,e,this.chunkEnd(e+5e3))}return D(o,[{key:"chunkEnd",value:function t(n){return(n>=this.to?this:this.text.lineAt(n)).to}},{key:"next",value:function t(){for(var n,i,e,r;;){if(n=this.re.lastIndex=this.matchPos-this.flat.from,(i=this.re.exec(this.flat.text))&&!i[0]&&i.index==n&&(this.re.lastIndex=1+n,i=this.re.exec(this.flat.text)),i&&(r=(e=this.flat.from+i.index)+i[0].length,this.flat.to>=this.to||i.index+i[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,r,i)))return this.value={from:e,to:r,match:i},this.matchPos=Ly(this.text,r+(e==r?1:0)),this;if(this.flat.to==this.to)return this.done=!0,this;this.flat=uf.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}]),o}(),"undefined"!=typeof Symbol&&(rf.prototype[Symbol.iterator]=sf.prototype[Symbol.iterator]=function(){return this}),af=v.define(),ff=b.define({create:function t(){return!0},update:function t(n,i){var e,r,o,e=F(i.effects);try{for(e.s();!(r=e.n()).done;)(o=r.value).is(af)&&(n=o.value)}catch(t){e.e(t)}finally{e.f()}return n},provide:function t(n){return Ke.from(n,function(t){return t?By:null})}}),hf=w.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),cf={highlightWordAroundCursor:!($r=function t(n){var i,e,i=W0(n,By);return i||(e=[af.of(!0)],null==n.state.field(ff,!1)&&e.push(v.appendConfig.of([ff,hf])),n.dispatch({effects:e}),i=W0(n,By)),i&&i.dom.querySelector("input").focus(),!0}),minSelectionLength:1,maxMatches:100,wholeWords:!1},lf=y.define({combine:function t(n){return qh(n,cf,{highlightWordAroundCursor:function t(n,i){return n||i},minSelectionLength:Math.min,maxMatches:Math.min})}}),vf=m.mark({class:"cm-selectionMatch"}),df=m.mark({class:"cm-selectionMatch cm-selectionMatch-main"}),yf=d.fromClass(function(){function n(t){A(this,n),this.decorations=this.getDeco(t)}return D(n,[{key:"update",value:function t(n){(n.selectionSet||n.docChanged||n.viewportChanged)&&(this.decorations=this.getDeco(n.view))}},{key:"getDeco",value:function t(n){var i,e,r,o,u,s,r,r,a,f,h,c,l,v,d,y,i=n.state.facet(lf),e=n.state,r=e.selection;if(1<r.ranges.length)return m.none;if(s=null,(o=r.main).empty){if(!i.highlightWordAroundCursor)return m.none;if(!(r=e.wordAt(o.head)))return m.none;s=e.charCategorizer(o.head),u=e.sliceDoc(r.from,r.to)}else{if((r=o.to-o.from)<i.minSelectionLength||200<r)return m.none;if(i.wholeWords){if(u=e.sliceDoc(o.from,o.to),!Fy(s=e.charCategorizer(o.head),e,o.from,o.to)||!Ny(s,e,o.from,o.to))return m.none}else if(!(u=e.sliceDoc(o.from,o.to).trim()))return m.none}a=[],f=F(n.visibleRanges);try{for(f.s();!(h=f.n()).done;)for(c=h.value,l=new tf(e.doc,u,c.from,c.to);!l.next().done;)if(d=(v=l.value).from,y=v.to,(!s||Fy(s,e,d,y))&&(o.empty&&d<=o.from&&y>=o.to?a.push(df.range(d,y)):(d>=o.to||y<=o.from)&&a.push(vf.range(d,y)),a.length>i.maxMatches))return m.none}catch(t){f.e(t)}finally{f.f()}return m.set(a)}}]),n}(),{decorations:function t(n){return n.decorations}}),mf=w.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),pf=function t(n){var i,n,e,r,i=n.state,n=n.dispatch,e=i.selection,r=O.create(e.ranges.map(function(t){return i.wordAt(t.head)||O.cursor(t.head)}),e.mainIndex);return!r.eq(e)&&(n(i.update({selection:r})),!0)},as=function t(n){var i,n,e,r,e,i=n.state,n=n.dispatch,e=i.selection.ranges;return e.some(function(t){return t.from===t.to})?pf({state:i,dispatch:n}):(r=i.sliceDoc(e[0].from,e[0].to),!i.selection.ranges.some(function(t){return i.sliceDoc(t.from,t.to)!=r})&&!!(e=Uy(i,r))&&(n(i.update({selection:i.selection.addRange(O.range(e.from,e.to),!1),effects:w.scrollIntoView(e.to)})),!0))},kf=y.define({combine:function t(n){return qh(n,{top:!1,caseSensitive:!1,literal:!1,wholeWord:!1,createPanel:function t(n){return new Bf(n)},scrollToMatch:function t(n){return w.scrollIntoView(n)}})}}),gf=function(){function n(t){A(this,n),this.search=t.search,this.caseSensitive=!!t.caseSensitive,this.literal=!!t.literal,this.regexp=!!t.regexp,this.replace=t.replace||"",this.valid=!!this.search&&(!this.regexp||Ty(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!t.wholeWord}return D(n,[{key:"unquote",value:function t(n){return this.literal?n:n.replace(/\\([nrt\\])/g,function(t,n){return"n"==n?"\n":"r"==n?"\r":"t"==n?"\t":"\\"})}},{key:"eq",value:function t(n){return this.search==n.search&&this.replace==n.replace&&this.caseSensitive==n.caseSensitive&&this.regexp==n.regexp&&this.wholeWord==n.wholeWord}},{key:"create",value:function t(){return new(this.regexp?bf:wf)(this)}},{key:"getCursor",value:function t(n){var i,e,n,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,e=2<arguments.length?arguments[2]:void 0,n=n.doc?n:C.create({doc:n});return null==e&&(e=n.doc.length),(this.regexp?Vy:zy)(this,n,i,e)}}]),n}(),wf=function(t){f(i,t);var n=S(i);function i(t){return A(this,i),n.call(this,t)}return D(i,[{key:"nextMatch",value:function t(n,i,e){var e=zy(this.spec,n,e,n.doc.length).nextOverlapping();return(e=e.done?zy(this.spec,n,0,i).nextOverlapping():e).done?null:e.value}},{key:"prevMatchInRange",value:function t(n,i,e){for(var r,o,u,s,r=e;;){for(o=Math.max(i,r-1e4-this.spec.unquoted.length),u=zy(this.spec,n,o,r),s=null;!u.nextOverlapping().done;)s=u.value;if(s)return s;if(o==i)return null;r-=1e4}}},{key:"prevMatch",value:function t(n,i,e){return this.prevMatchInRange(n,0,i)||this.prevMatchInRange(n,e,n.doc.length)}},{key:"getReplacement",value:function t(n){return this.spec.unquote(this.spec.replace)}},{key:"matchAll",value:function t(n,i){for(var e=zy(this.spec,n,0,n.doc.length),r=[];!e.next().done;){if(i<=r.length)return null;r.push(e.value)}return r}},{key:"highlight",value:function t(n,i,e,r){for(var o=zy(this.spec,n,Math.max(0,i-this.spec.unquoted.length),Math.min(e+this.spec.unquoted.length,n.doc.length));!o.next().done;)r(o.value.from,o.value.to)}}]),i}(fs=D(function t(n){A(this,t),this.spec=n})),bf=function(t){f(i,t);var n=S(i);function i(){return A(this,i),n.apply(this,arguments)}return D(i,[{key:"nextMatch",value:function t(n,i,e){var e=Vy(this.spec,n,e,n.doc.length).next();return(e=e.done?Vy(this.spec,n,0,i).next():e).done?null:e.value}},{key:"prevMatchInRange",value:function t(n,i,e){for(var r,o,u,s,r=1;;r++){for(o=Math.max(i,e-1e4*r),u=Vy(this.spec,n,o,e),s=null;!u.next().done;)s=u.value;if(s&&(o==i||s.from>o+10))return s;if(o==i)return null}}},{key:"prevMatch",value:function t(n,i,e){return this.prevMatchInRange(n,0,i)||this.prevMatchInRange(n,e,n.doc.length)}},{key:"getReplacement",value:function t(i){return this.spec.unquote(this.spec.replace.replace(/\$([$&\d+])/g,function(t,n){return"$"==n?"$":"&"==n?i.match[0]:"0"!=n&&+n<i.match.length?i.match[n]:t}))}},{key:"matchAll",value:function t(n,i){for(var e=Vy(this.spec,n,0,n.doc.length),r=[];!e.next().done;){if(i<=r.length)return null;r.push(e.value)}return r}},{key:"highlight",value:function t(n,i,e,r){for(var o=Vy(this.spec,n,Math.max(0,i-250),Math.min(e+250,n.doc.length));!o.next().done;)r(o.value.from,o.value.to)}}]),i}(fs),Mf=v.define(),xf=v.define(),Sf=b.define({create:function t(n){return new Cf(Zy(n).create(),null)},update:function t(n,i){var e,r,o,e=F(i.effects);try{for(e.s();!(r=e.n()).done;)(o=r.value).is(Mf)?n=new Cf(o.value.create(),n.panel):o.is(xf)&&(n=new Cf(n.query,o.value?Xy:null))}catch(t){e.e(t)}finally{e.f()}return n},provide:function t(n){return Ke.from(n,function(t){return t.panel})}}),Cf=D(function t(n,i){A(this,t),this.query=n,this.panel=i}),jf=m.mark({class:"cm-searchMatch"}),Pf=m.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Xs=d.fromClass(function(){function n(t){A(this,n),this.view=t,this.decorations=this.highlight(t.state.field(Sf))}return D(n,[{key:"update",value:function t(n){var i=n.state.field(Sf);(i!=n.startState.field(Sf)||n.docChanged||n.selectionSet||n.viewportChanged)&&(this.decorations=this.highlight(i))}},{key:"highlight",value:function t(n){var i,e,r,o,u,s,a,f,h,c,i=n.query,e;if(!n.panel||!i.spec.valid)return m.none;for(r=this.view,o=new Et,u=0,a=(s=r.visibleRanges).length;u<a;u++){for(h=(f=s[u]).from,c=f.to;u<a-1&&c>s[u+1].from-500;)c=s[++u].to;i.highlight(r.state,h,c,function(n,i){var t=r.state.selection.ranges.some(function(t){return t.from==n&&t.to==i});o.add(n,i,t?Pf:jf)})}return o.finish()}}]),n}(),{decorations:function t(n){return n.decorations}}),Af=Qy(function(t,n){var i,n,i,n=n.query.matchAll(t.state,1e3);return!(!n||!n.length||(t.dispatch({selection:O.create(n.map(function(t){return O.range(t.from,t.to)})),userEvent:"select.search.matches"}),0))}),Df=Qy(function(t,n){var n,i,e,r,e,o,u,s,a,f,e,n=n.query,i=t.state,e=i.selection.main,r=e.from,e=e.to;return!i.readOnly&&!!(o=n.nextMatch(i,r,r))&&(u=[],f=[],o.from==r&&o.to==e&&(a=i.toText(n.getReplacement(o)),u.push({from:o.from,to:o.to,insert:a}),o=n.nextMatch(i,o.from,o.to),f.push(w.announce.of(i.phrase("replaced match on line $",i.doc.lineAt(r).number)+"."))),o&&(e=0==u.length||u[0].from>=o.to?0:o.to-o.from-a.length,s=O.single(o.from-e,o.to-e),f.push(im(t,o)),f.push(i.facet(kf).scrollToMatch(s.main,t))),t.dispatch({changes:u,selection:s,effects:f,userEvent:"input.replace"}),!0)}),Rf=Qy(function(t,n){var e,n,i,e=n.query;return!t.state.readOnly&&!!(n=e.matchAll(t.state,1e9).map(function(t){var n,i;return{from:t.from,to:t.to,insert:e.getReplacement(t)}})).length&&(i=t.state.phrase("replaced $ matches",n.length)+".",t.dispatch({changes:n,effects:w.announce.of(i),userEvent:"input.replace.all"}),!0)}),Lf=[{key:"Mod-f",run:If=function t(n){var i,e,r,i=n.state.field(Sf,!1);return i&&i.panel?(e=Yy(n))&&e!=n.root.activeElement&&((r=Zy(n.state,i.query.spec)).valid&&n.dispatch({effects:Mf.of(r)}),e.focus(),e.select()):n.dispatch({effects:[xf.of(!0),i?Mf.of(Zy(n.state,i.query.spec)):v.appendConfig.of(Nf)]}),!0},scope:"editor search-panel"},{key:"F3",run:Of=Qy(function(t,n){var n,i,n,i,e,n=n.query,i=t.state.selection.main.to,n=n.nextMatch(t.state,i,i);return!!n&&(i=O.single(n.from,n.to),e=t.state.facet(kf),t.dispatch({selection:i,effects:[im(t,n),e.scrollToMatch(i.main,t)],userEvent:"select.search"}),tm(t),!0)}),shift:Ef=Qy(function(t,n){var n,i,e,n,i,e,n=n.query,i=t.state,e=i.selection.main.from,n=n.prevMatch(i,e,e);return!!n&&(i=O.single(n.from,n.to),e=t.state.facet(kf),t.dispatch({selection:i,effects:[im(t,n),e.scrollToMatch(i.main,t)],userEvent:"select.search"}),tm(t),!0)}),scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Of,shift:Ef,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Tf=function t(n){var i,i,i=n.state.field(Sf,!1);return!(!i||!i.panel||((i=W0(n,Xy))&&i.dom.contains(n.root.activeElement)&&n.focus(),n.dispatch({effects:xf.of(!1)}),0))},scope:"editor search-panel"},{key:"Mod-Shift-l",run:Qs=function t(n){var i,n,e,e,r,e,o,u,s,i=n.state,n=n.dispatch,e=i.selection;if(1<e.ranges.length||e.main.empty)return!1;for(r=(e=e.main).from,e=e.to,o=[],u=0,s=new tf(i.doc,i.sliceDoc(r,e));!s.next().done;){if(1e3<o.length)return!1;s.value.from==r&&(u=o.length),o.push(O.range(s.value.from,s.value.to))}return n(i.update({selection:O.create(o,u),userEvent:"select.search.matches"})),!0}},{key:"Alt-g",run:$r},{key:"Mod-d",run:as,preventDefault:!0}],Bf=function(){function r(n){var i,t;function e(t,n,i){return I("button",{class:"cm-button",name:t,onclick:n,type:"button"},i)}A(i=this,r),this.view=n,t=this.query=n.state.field(Sf).query.spec,this.commit=this.commit.bind(this),this.searchField=I("input",{value:t.search,placeholder:nm(n,"Find"),"aria-label":nm(n,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=I("input",{value:t.replace,placeholder:nm(n,"Replace"),"aria-label":nm(n,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=I("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=I("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=I("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit}),this.dom=I("div",{onkeydown:function t(n){return i.keydown(n)},class:"cm-search"},[this.searchField,e("next",function(){return Of(n)},[nm(n,"next")]),e("prev",function(){return Ef(n)},[nm(n,"previous")]),e("select",function(){return Af(n)},[nm(n,"all")]),I("label",null,[this.caseField,nm(n,"match case")]),I("label",null,[this.reField,nm(n,"regexp")]),I("label",null,[this.wordField,nm(n,"by word")])].concat(Wf(n.state.readOnly?[]:[I("br"),this.replaceField,e("replace",function(){return Df(n)},[nm(n,"replace")]),e("replaceAll",function(){return Rf(n)},[nm(n,"replace all")])]),[I("button",{name:"close",onclick:function t(){return Tf(n)},"aria-label":nm(n,"close"),type:"button"},["\xd7"])]))}return D(r,[{key:"commit",value:function t(){var n=new gf({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});n.eq(this.query)||(this.query=n,this.view.dispatch({effects:Mf.of(n)}))}},{key:"keydown",value:function t(n){u0(this.view,n,"search-panel")?n.preventDefault():13==n.keyCode&&n.target==this.searchField?(n.preventDefault(),(n.shiftKey?Ef:Of)(this.view)):13==n.keyCode&&n.target==this.replaceField&&(n.preventDefault(),Df(this.view))}},{key:"update",value:function t(n){var i,e,r,o,u,s,i=F(n.transactions);try{for(i.s();!(e=i.n()).done;){o=F((r=e.value).effects);try{for(o.s();!(u=o.n()).done;)(s=u.value).is(Mf)&&!s.value.eq(this.query)&&this.setQuery(s.value)}catch(t){o.e(t)}finally{o.f()}}}catch(t){i.e(t)}finally{i.f()}}},{key:"setQuery",value:function t(n){this.query=n,this.searchField.value=n.search,this.replaceField.value=n.replace,this.caseField.checked=n.caseSensitive,this.reField.checked=n.regexp,this.wordField.checked=n.wholeWord}},{key:"mount",value:function t(){this.searchField.select()}},{key:"pos",get:function t(){return 80}},{key:"top",get:function t(){return this.view.state.facet(kf).top}}]),r}(),_f=30,Ff=/[\s\.,:;?!]/,ls=w.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),Nf=[Sf,st.lowest(Xs),ls],Uf=L.Search=Object.freeze({__proto__:null,RegExpCursor:rf,SearchCursor:tf,SearchQuery:gf,closeSearchPanel:Tf,findNext:Of,findPrevious:Ef,getSearchQuery:Jy,gotoLine:$r,highlightSelectionMatches:_y,openSearchPanel:If,replaceAll:Rf,replaceNext:Df,search:Hy,searchKeymap:Lf,searchPanelOpen:Ky,selectMatches:Af,selectNextOccurrence:as,selectSelectionMatches:Qs,setSearchQuery:Mf}),L.basicSetup=function(){return[X0(),fr,M0(),O1(),nd(),y0(),k0(),C.allowMultipleSelections.of(!0),Hv(),ed(jo,{fallback:!0}),ud(),i1(),y1(),R0(),I0(),Ee,_y(),ie.of([].concat(Hu,Wf(Pa),Lf,ss,yo,zu,Fa))]}()},"./dist/plugins/formulaPanel/editor/common/calcUtil.js":function(B,t,n){var a,u,f,h,c;function i(t,n,i,e,r){var o,u,s,a,f;void 0===r&&(r=!0),o=i.culture,u=i.ignoreError,s=i.Wve,a=i.Jde,i.ignoreError=e,i.culture=!0,i.Wve=r,i.Jde=!0;try{f=n.parse(i,t)}catch(t){}return i.culture=o,i.ignoreError=u,i.Wve=s,i.Jde=a,f}function e(t,n,i){if(t){var e;try{e=n.unparse(i,t)}catch(t){}return e}}function r(t,n,i,e,r){var o,u,o,t,s,o=new a.Parser,u=!0,o=n.Mf?(0,f.Vgt)(o,t,n.Mf,i,e,!0):(o.setParserOption(!0),r.ignoreError=!0,t=t.split(""),s=o.parseToTokens(r,t,!1),s=(0,f.fillBlankToTokens)(s,t),(0,f.getExpressTokenImp)(o,n,r,null,s,t,i,e));return H(o,n)}function l(){return{arrayListSeparator:a.Parser.arrayListSeparator||c.COMMA,arrayGroupSeparator:a.Parser.arrayGroupSeparator||c.SEMICOLON,listSeparator:a.Parser.listSeparator||c.COMMA,numberDecimalSeparator:a.Parser.numberDecimalSeparator||c.FULL_STOP}}function o(t,n){var i,e,r,o,u;for(t=t.filter(function(t){return t.endIndex<n}),i=[],e=[],r="",o=0;o<t.length;o++)g(u=t[o])?r=u.text:w(u)?(i.push(r),e.push(0)):b(u)&&(r="",i.pop(),e.pop()),0<i.length&&k(u)&&e[e.length-1]++;if(0<i.length)return{functionName:i.pop(),activeParameter:e.pop()}}function s(t,n){for(var i,n,e,r,o,u,s,i=n.parameters||[],n=i.length||0,o=0;o<i.length;o++)if(i[o].repeatable)void 0===e&&(e=o);else if(void 0!==e){r=o-1;break}return t=void 0!==e&&(void 0===r&&(r=i.length-1),e<=t)?r+(s=(t-e)%(u=r-e+1))+1<n?r+s+1:e+s:t}function v(t,n){t=s(t,n);var n=n.parameters?n.parameters.length:0;return Math.min(t,n-1)}function d(t,n,i,e){return void 0===i&&(i=!0),void 0===e&&(e=!1),t.find(function(t){return y(t,n,i,e)})}function y(t,n,i,e){return void 0===e&&(e=!1),((i=void 0===i?!0:i)?n>=t.index:n>t.index)&&(e?n<=t.endIndex+1:n<t.endIndex+1)}function m(t,n,i){return n<=t.index&&i>=t.endIndex+1}function p(t,n){var i,e,r,o,u,u,s,a,f;for(t=t.filter(function(t){return t.endIndex<n}),i=[],e=[],r=[],o=0;o<t.length;o++)g(u=t[o])?(i.push(u.text.toUpperCase()),e.push([]),r.push(0)):b(u)?(i.pop(),e.pop(),r.pop()):k(u)&&(u=(0,c.lastItem)(i),s=(0,c.lastItem)(r),a=(0,c.lastItem)(e),f=t[o-1],("LAMBDA"===u||"LET"===u&&s%2==0)&&E(f)&&a.push(f.text),r[r.length-1]=s+1);return e.filter(function(t){return 0<t.length}).reduce(function(t,n){return t.concat(n)},[])}function k(t){return t.type===h.TokenType.FunctionArgumentSeparator}function g(t){return t.type===h.TokenType.FunctionName}function w(t){return t.type===h.TokenType.FunctionCallStart}function b(t){return t.type===h.TokenType.FunctionCallEnd}function M(t){return t.type===h.TokenType.SubExpressionStart}function x(t){return t.type===h.TokenType.SubExpressionEnd}function S(t){return t.type===h.TokenType.FormulaStart}function C(t){return t.type===h.TokenType.Unknown}function j(t){return C(t)&&T(t.text)===c.LEFT_PARENTHESES}function P(t){return C(t)&&T(t.text)===c.RIGHT_PARENTHESES}function O(t){return E(t)||D(t)}function _(t){return t.type===h.TokenType.OperatorInfix}function F(t){return t.type===h.TokenType.OperatorPrefix}function N(t){return t.type===h.TokenType.Whitespace}function E(t){return t.type===h.TokenType.Name}function A(t){return t.type===h.TokenType.OperatorPostfix&&"#"===t.text}function D(t){return t.type===h.TokenType.CellReference}function R(t){return O(t)&&t.ranges&&0<t.ranges.length}function I(t){for(var n,i,n=0,i=0;i<t.length&&t[i]===c.WHITESPACE;i++)n++;return n}function U(t,n,i){var t,e,r,o,u,s;for(void 0===i&&(i=4),t=I(t),e=[],r=function(){return 0===e.length},o=function(){return e[e.length-1]},u=0;u<n.length;u++)w(s=n[u])||M(s)?e.push(s):b(s)?!r()&&w(o())&&e.pop():x(s)&&!r()&&M(o())&&e.pop();return 0<e.length&&(t+=i),t}function T(t){return t.replace(/\s+/g,"")}function H(t,n){for(var i,e,r,o,u,s,a,i=[],e=[],r=l(),o=!1,u=0;u<t.length;u++)(a=z(s=t[u],o,r))===h.TokenType.ArrayConstStart?(e.push(a),o=!0):a===h.TokenType.FunctionCallStart?(e.push(a),o=!1):a!==h.TokenType.FunctionCallEnd&&a!==h.TokenType.ArrayConstEnd||(e.pop(),o=(0,c.lastItem)(e)===h.TokenType.ArrayConstStart),i.push({type:a,index:s.index,endIndex:s.endIndex,text:s.text,ranges:s.ranges,canDrag:s.canDrag,colorIndex:s.colorIndex});return W(V(i),n)}function z(t,n,i){var e,r,o,e=t.type,r=t.subType,o=t.text.trim();return 1===e?1===r?"ARRAY"===o?h.TokenType.ArrayConstStart:"@"===o||o===c.LEFT_PARENTHESES?h.TokenType.FunctionCallStart:h.TokenType.FunctionName:2===r?o!==c.RIGHT_PARENTHESES&&n?h.TokenType.ArrayConstEnd:h.TokenType.FunctionCallEnd:(0,u.Df)(o)?h.TokenType.FormulaStart:void 0:3!==e?4===e?h.TokenType.OperatorPrefix:5===e?h.TokenType.OperatorInfix:6===e?h.TokenType.OperatorPostfix:0===e?5===r?h.TokenType.LogicalConst:4===r?h.TokenType.NumberConst:3===r?h.TokenType.StringConst:6===r?h.TokenType.ErrorConst:7===r||12===r?t.isName?h.TokenType.Name:h.TokenType.CellReference:h.TokenType.StringConst:2===e?1===r?h.TokenType.SubExpressionStart:2===r?h.TokenType.SubExpressionEnd:void 0:7===e?h.TokenType.Whitespace:h.TokenType.Unknown:0===r?n&&o===i.arrayListSeparator?h.TokenType.ArrayConstItemSeparator:n&&o===i.arrayGroupSeparator?h.TokenType.ArrayConstRowSeparator:h.TokenType.FunctionArgumentSeparator:void 0}function W(t,n){for(var i,e,r,o,i=t.length-2;0<i;i--)e=t[i],A(r=t[i+1])&&D(e)&&R(e)&&(o=new a.CalcReference(n,e.ranges).getSpillRef())&&o.$gt&&(e.text+=r.text,e.endIndex=r.endIndex,e.ranges=o.$gt,t.splice(i+1,1));return t}function V(t){for(var n,i,e,r,o,u,s,r,n=[],i=0;i<t.length;i++)$((e=t[i]).type)&&(r=e.text.match(/^(\s*)(\S+)(\s*)$/))&&4===r.length&&(o=r[0],u=r[1],s=r[2],r=r[3],u||r)?(u&&(e.index+=u.length,e.text=e.text.substring(u.length),n.push(L(e.index,u))),n.push(e),r&&(e.endIndex-=r.length,e.text=e.text.substring(0,s.length),n.push(L(e.endIndex+1,r)))):n.push(e);return n}function $(t){return t===h.TokenType.FunctionCallStart||t===h.TokenType.FunctionCallEnd||t===h.TokenType.ArrayConstStart||t===h.TokenType.ArrayConstEnd}function L(t,n){return{type:h.TokenType.Whitespace,index:t,endIndex:t+n.length-1,text:n}}function q(){return a.Functions.findGlobalFunctions()}Object.defineProperty(t,"__esModule",{value:!0}),t.getGlobalFunctions=t.removeWhiteSpace=t.getIndentByPreviousText=t.getLineIndent=t.hasReferenceRanges=t.isReferenceToken=t.isAnchorOperatorToken=t.isNameToken=t.isWhitespaceToken=t.isPrefixOperatorToken=t.isInfixOperatorToken=t.isReferenceOrNameToken=t.isRightParenthesesToken=t.isLeftParenthesesToken=t.isNothingOperandToken=t.isFormulaStartToken=t.isSubExpressionEndToken=t.isSubExpressionStartToken=t.isFunctionCallEndToken=t.isFunctionCallStartToken=t.isFunctionCallToken=t.isFunctionArgumentSeparator=t.getLocalSymbol=t.includeToken=t.isInToken=t.getTokenByPos=t.getActiveParameterInSignatureTip=t.getActiveParameterInParameterResources=t.getSignatureStatus=t.getCultureInfo=t.parseToTokens=t.unparse=t.parse=void 0,a=n("CalcEngine"),u=n("Core"),f=n("SheetsCalc"),h=n("./dist/plugins/formulaPanel/editor/interface.js"),c=n("./dist/plugins/formulaPanel/editor/common/util.js"),t.parse=i,t.unparse=e,t.parseToTokens=r,t.getCultureInfo=l,t.getSignatureStatus=o,t.getActiveParameterInParameterResources=s,t.getActiveParameterInSignatureTip=v,t.getTokenByPos=d,t.isInToken=y,t.includeToken=m,t.getLocalSymbol=p,t.isFunctionArgumentSeparator=k,t.isFunctionCallToken=g,t.isFunctionCallStartToken=w,t.isFunctionCallEndToken=b,t.isSubExpressionStartToken=M,t.isSubExpressionEndToken=x,t.isFormulaStartToken=S,t.isNothingOperandToken=C,t.isLeftParenthesesToken=j,t.isRightParenthesesToken=P,t.isReferenceOrNameToken=O,t.isInfixOperatorToken=_,t.isPrefixOperatorToken=F,t.isWhitespaceToken=N,t.isNameToken=E,t.isAnchorOperatorToken=A,t.isReferenceToken=D,t.hasReferenceRanges=R,t.getLineIndent=I,t.getIndentByPreviousText=U,t.removeWhiteSpace=T,t.getGlobalFunctions=q},"./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js":function(L,t,n){var i,r,e,o,u,s,a,f,h,c;function l(t){return t.field(o.tokenField)}function v(t){return t.doc.toJSON().join("\n")}function d(t){return t.field(o.providerField).getFunctions()}function y(t,n){return(0,u.findFunction)(d(t),n)}function m(t){return d(t).map(u.convertToFunctionResource)}function p(t,n){return(0,u.findFunctionResource)(m(t),n)}function k(t){return t.field(o.customNamesField)}function g(t,n){return n=n.toUpperCase(),k(t).find(function(t){return t.getName().toUpperCase()===n})}function w(t){var n,t,t,n,t=t.field(o.themeField).rules.find(function(t){return t.token===e.SyntaxHighlightingTokenType.reference}),t=t?t.color:"black";return Array.isArray(t)?t:[t]}function b(t,n,i){return t.find(function(t){return(0,s.isInToken)(t,n,!0,!0)&&M(t,i)})}function M(t,n){var t=C(t.text,n);return t&&t.type===r.ExpressionType.reference}function x(t){var n,i,t,n,n=t.field(o.calcServiceField),i=t.field(o.calcSourceField),t=t.field(o.activeCellField),n=n.getParserContext(i);return n.row=t.row,n.column=t.col,n}function S(t,n){var i,e,r,e;return t.field(o.isFormulaField)?(i=t.field(o.calcSourceField),r=(e=t.field(o.activeCellField)).row,e=e.col,(0,s.parseToTokens)(n,i,r,e,x(t))):[]}function C(t,n,i){void 0===i&&(i=!1);var n=x(n);return(0,s.parse)(t,new r.Parser,n,!i)}function j(t,n){var n=x(n);return(0,s.unparse)(t,new r.Parser,n)}function P(t){return t.field(o.optionsField)}function O(t){var t=P(t);return c(t.tabSize)?h.DEFAULT_TAB_SIZE:t.tabSize}function E(t){var t=P(t);return c(t.formatWidthLimit)?h.DEFAULT_FORMAT_WIDTH_LIMIT:t.formatWidthLimit}function A(t){return u.WHITESPACE.repeat(O(t))}function D(t){var t=t.field(o.calcSourceField).Mf;if(t)return(0,a.Kde)(t.parent)||t}function R(t){return t.selection.main}function I(t){return t.field(o.providerField).getStructReferences()}function T(t,n,i){var e,t,n,i;return n===i||!!((0,f.kf)(n)&&(0,f.kf)(i)&&(e=new r.Parser,t=x(t),n=(0,s.unparse)((0,s.parse)(n,e,t,!1,!1),e,t),i=(0,s.unparse)((0,s.parse)(i,e,t,!1,!1),e,t),n)&&i&&n===i)}Object.defineProperty(t,"__esModule",{value:!0}),t.isSameFormula=t.getStructReferencesByState=t.getSelection=t.getActiveSheetByState=t.getOneIndentSpaceByState=t.getFormatWidthLimitByState=t.getTabSizeByState=t.getOptionsByState=t.unparseToText=t.parseToExpressionTree=t.parseToTokens=t.getParseContextByState=t.isValidReferenceToken=t.getValidReferenceTokenByPos=t.getReferenceTokenColors=t.getCustomNameByState=t.getCustomNamesByState=t.getFunctionResourceByState=t.getFunctionResourcesByState=t.getFunctionByState=t.getFunctionsByState=t.getTextByState=t.getTokensByState=void 0,i=n("Common"),r=n("CalcEngine"),e=n("./dist/plugins/formulaPanel/editor/interface.js"),o=n("./dist/plugins/formulaPanel/editor/featureProvider/customField.js"),u=n("./dist/plugins/formulaPanel/editor/common/util.js"),s=n("./dist/plugins/formulaPanel/editor/common/calcUtil.js"),a=n("./dist/plugins/formulaPanel/editor/common/spreadUtil.js"),f=n("Core"),h=n("./dist/plugins/formulaPanel/editor/common/const.js"),c=i.Common.lt.ht,t.getTokensByState=l,t.getTextByState=v,t.getFunctionsByState=d,t.getFunctionByState=y,t.getFunctionResourcesByState=m,t.getFunctionResourceByState=p,t.getCustomNamesByState=k,t.getCustomNameByState=g,t.getReferenceTokenColors=w,t.getValidReferenceTokenByPos=b,t.isValidReferenceToken=M,t.getParseContextByState=x,t.parseToTokens=S,t.parseToExpressionTree=C,t.unparseToText=j,t.getOptionsByState=P,t.getTabSizeByState=O,t.getFormatWidthLimitByState=E,t.getOneIndentSpaceByState=A,t.getActiveSheetByState=D,t.getSelection=R,t.getStructReferencesByState=I,t.isSameFormula=T},"./dist/plugins/formulaPanel/editor/common/const.js":function(t,n,i){var e,r,o,i;function u(){var t=new e.CalcService;return t.addResolver(new r.SheetReferenceResolver),t.addResolver(new r.StructureReferenceResolver),t}Object.defineProperty(n,"__esModule",{value:!0}),n.defaultTheme=n.defaultSyntaxHighlighRules=n.DEFAULT_ACTIVE_CELL_INFO=n.DEFAULT_FORMULA_EDITOR_OPTIONS=n.defaultCalcSource=n.defaultCalcService=n.DEFAULT_PROVIDER=n.DEFAULT_FORMAT_WIDTH_LIMIT=n.DEFAULT_TAB_SIZE=void 0,e=i("CalcEngine"),r=i("SheetsCalc"),o=i("./dist/plugins/formulaPanel/editor/interface.js"),i=i("./dist/plugins/formulaPanel/editor/common/calcUtil.js"),n.DEFAULT_TAB_SIZE=4,n.DEFAULT_FORMAT_WIDTH_LIMIT="auto",n.DEFAULT_PROVIDER={getStructReferences:function(){return[]},getFunctions:i.getGlobalFunctions},n.defaultCalcService=u(),n.defaultCalcSource=new e.CalcSource(n.defaultCalcService),n.DEFAULT_FORMULA_EDITOR_OPTIONS={formatWidthLimit:n.DEFAULT_FORMAT_WIDTH_LIMIT,tabSize:n.DEFAULT_TAB_SIZE},n.DEFAULT_ACTIVE_CELL_INFO={row:0,col:0},n.defaultSyntaxHighlighRules=[{token:o.SyntaxHighlightingTokenType.stringConst,color:"#CC1C1C"},{token:o.SyntaxHighlightingTokenType.errorConst,color:"#CC1C1C"},{token:o.SyntaxHighlightingTokenType.numberConst,color:"#088000"},{token:o.SyntaxHighlightingTokenType.booleanConst,color:"#088000"},{token:o.SyntaxHighlightingTokenType.function,color:"#1C1CFF"},{token:o.SyntaxHighlightingTokenType.argumentSeparator,color:"#FF0000"},{token:o.SyntaxHighlightingTokenType.operatorPrefix,color:"#FF0000"},{token:o.SyntaxHighlightingTokenType.operatorInfix,color:"#FF0000"},{token:o.SyntaxHighlightingTokenType.operatorPostfix,color:"#FF0000"},{token:o.SyntaxHighlightingTokenType.reference,color:["#0000ff","#008000","#9900cc","#800000","#00cc33","#cc6600","#cc0099"]}],n.defaultTheme={rules:n.defaultSyntaxHighlighRules}},"./dist/plugins/formulaPanel/editor/common/formatter.js":function(t,n,i){var r,v,o,d,y,m;function e(t,n){var i,e,t,e,i=new v.Parser,e=n.parseContext,t=(0,o.parse)(t,i,e,!1,!1);if(t)return e=r(r({parser:i,oneIndentTab:d.WHITESPACE.repeat(n.tabSize)},n),(0,o.getCultureInfo)()),d.EQUAL+p(t,0,e,d.EQUAL)}function p(t,n,i,e,r,o){var u,u,s;return void 0===e&&(e=""),void 0===r&&(r=""),void 0===o&&(o=!0),t?(u=h(t,i),S(u=x(n,i,o)+u,i,e,r)&&((s=t.type)===v.ExpressionType.operator?u=a(t,n,i,e,r,o):s===v.ExpressionType.function?u=f(t,n,i,e,r,o):s===v.ExpressionType.parentheses?u=w(t,n,i,o):s===v.ExpressionType.array&&(u=k(t,n,i,o))),u):""}function h(t,n){var i,e;return t?(i=t.type)===v.ExpressionType.operator?u(t,n):i===v.ExpressionType.function?l(t,n):i===v.ExpressionType.parentheses?d.LEFT_PARENTHESES+h(t.value,n)+d.RIGHT_PARENTHESES:(i===v.ExpressionType.array?g:b)(t,n):""}function a(t,n,i,e,r,o){var u,s,u,a,o,f,u=t.operatorType,s=E(u),u=P(u)?x(n,i,o)+s+p(t.value,n,i,e,r,!1):2===u?p(t.value,n,i,e,s+r,o)+s:18===u?c(t,n,i,o):A(u)?(o=e+(a=p(t.value,n,i,e,d.WHITESPACE+s+m+r))+d.WHITESPACE+s,S(f=h(t.value2,i),i,o+d.WHITESPACE,r)?(f=p(t.value2,n+1,i,o+m,r),a+d.WHITESPACE+s+m+f):a+d.WHITESPACE+s+d.WHITESPACE+f):(a=p(t.value,n,i,e,r))+s+(f=p(t.value2,n,i,e+a+s,r,!1));return u}function u(t,n){var i,e,t,r,o,i=t.operatorType,e=E(i),t=P(i)?e+h(t.value,n):2===i?h(t.value,n)+e:(r=h(t.value,n),o=h(t.value2,n),18===i?s(t,n):A(i)?r+d.WHITESPACE+e+d.WHITESPACE+o:r+e+o);return t}function c(t,n,i,e){return x(n,i,e)+b(t,i)}function s(t,n){return b(t,n)}function f(t,n,i,e,r,o){var u,s,a,f,h,c,l,u=x(n,i,o),s=(0,v.isFunction)(t.function)&&t.function.name||t.functionName;if(s===y)return p(t.arguments[0],n,i,e,"#"+r,o)+"#";if("@"===s)return u+"@"+p(t.arguments[0],n,i,e+u+"@",r,!1);if(a=!s&&t.function instanceof v.Expression?p(t.function,n,i,e,r,o)+d.LEFT_PARENTHESES:u+s+d.LEFT_PARENTHESES,0===(h=(f=t.arguments||[]).length))return a+d.RIGHT_PARENTHESES;for(a+=m,c=0;c<h;c++)a+=p(l=f[c],n+1,i),c!==h-1&&(a+=i.listSeparator),a+=m;return a+x(n,i)+d.RIGHT_PARENTHESES}function l(t,n){var i,e,r,o,u,s,i=(0,v.isFunction)(t.function)&&t.function.name||t.functionName;if(i===y)return h(t.arguments[0],n)+"#";if("@"===i)return"@"+h(t.arguments[0],n);for(e=!i&&t.function instanceof v.Expression?h(t.function,n)+d.LEFT_PARENTHESES:D(i)+d.LEFT_PARENTHESES,o=(r=t.arguments||[]).length,u=0;u<o;u++)e+=h(s=r[u],n),u!==o-1&&(e+=n.listSeparator+d.WHITESPACE);return e+d.RIGHT_PARENTHESES}function k(t,n,i,e){for(var r,o,u,t,s,a,f,h,r=t.value,o=r.getRowCount(),u=r.getColumnCount(),t=x(n,i,e),s=x(n+1,i),a=t+d.LEFT_CURLY_BRACKETS+m,f=0;f<o;f++){for(a+=s,h=0;h<u;h++)a+=M(r.getValue(f,h),i),h!==u-1&&(a+=i.arrayListSeparator+d.WHITESPACE);f!==o-1&&(a+=i.arrayGroupSeparator),a+=m}return a+x(n,i)+d.RIGHT_CURLY_BRACKETS}function g(t,n){for(var i,e,r,o,u,s,i=t.value,e=i.getRowCount(),r=i.getColumnCount(),o=d.LEFT_CURLY_BRACKETS,u=0;u<e;u++){for(s=0;s<r;s++)o+=M(i.getValue(u,s),n),s!==r-1&&(o+=n.arrayListSeparator+d.WHITESPACE);u!==e-1&&(o+=n.arrayGroupSeparator+d.WHITESPACE)}return o+d.RIGHT_CURLY_BRACKETS}function w(t,n,i,e){var t,r,t=p(t.value,n+1,i),r;return x(n,i,e)+d.LEFT_PARENTHESES+m+t+m+x(n,i)+d.RIGHT_PARENTHESES}function b(t,n){var i=[];return n.parser.unparse(n.parseContext,t,i),i.join("")}function M(t,n){var i,i;return"string"==typeof t?i=v.ExpressionType.string:"boolean"==typeof t?i=v.ExpressionType.boolean:"number"==typeof t&&(i=v.ExpressionType.number),void 0===i?t.toString():((i=new v.Expression(i)).value=t,b(i,n))}function x(t,n,i){return(i=void 0===i?!0:i)?n.oneIndentTab.repeat(t):""}function S(t,n,i,e){var i;return t.trim().length>n.widthLimit||(i=C(i)+t+j(e),n.measureTextFunc(i)>n.lineWidthLimit)}function C(t){var n=t.lastIndexOf(m);return-1===n?t:t.substring(n+1)}function j(t){var n=t.indexOf(m);return-1===n?t:t.substring(0,n)}function P(t){return 0===t||1===t}function O(t){return 2===t}function E(t){return v.Z9t[t]}function A(t){return 15!==t&&16!==t&&17!==t&&18!==t}function D(t){var n,n,n=(0,v.getMapping)()&&(0,v.getMapping)().builtInFunctionsMapping,n=n&&n[t];return t=n&&n.alias?n.alias:t}r=this&&this.__assign||function(){return(r=Object.assign||function(t){for(var n,i,e,r,i=1,e=arguments.length;i<e;i++)for(r in n=arguments[i])Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t}).apply(this,arguments)},Object.defineProperty(n,"__esModule",{value:!0}),n.format=void 0,v=i("CalcEngine"),o=i("./dist/plugins/formulaPanel/editor/common/calcUtil.js"),d=i("./dist/plugins/formulaPanel/editor/common/util.js"),y="ANCHORARRAY",m="\n",n.format=e},"./dist/plugins/formulaPanel/editor/common/spreadUtil.js":function(t,n,i){var e,r;function o(t){if(t)return(0,e.jf)(t)}function u(t){var i,n,e,i=(0,r.getGlobalFunctions)(),n=function(n){Object.keys(n).forEach(function(t){i.push(n[t])})};return t&&(n(t.Amt),(e=o(t))&&n(e.Amt),t.options.allowDynamicArray||(i=i.filter(function(t){return!t.isDynamicArrayFunction}))),i}Object.defineProperty(n,"__esModule",{value:!0}),n.getFunctionsByWorkbook=n.Kde=void 0,e=i("Core"),r=i("./dist/plugins/formulaPanel/editor/common/calcUtil.js"),n.Kde=o,n.getFunctionsByWorkbook=u},"./dist/plugins/formulaPanel/editor/common/util.js":function(t,n,i){var u,e,i,e,r;function o(t){var n,n=(n=t.description())&&s(n);return{name:t.name,description:null==n?void 0:n.description,parameters:null==n?void 0:n.parameters}}function s(t){for(var n,i,e,r,o,n=[],i=t.parameters||[],e=0;e<i.length;e++)(o=2<(r=u({},i[e])).name.length&&r.name.startsWith("[")&&r.name.endsWith("]"))&&(r.optional=!0,r.name=r.name.substring(1,r.name.length-1)),r.repeatable&&(r.optional=!0),n.push(r);return u(u({},t),{parameters:n})}function a(t,n){return n=n.toUpperCase(),(t||[]).find(function(t){return t.name.toUpperCase()===n})}function f(t,n){return n=n.toUpperCase(),(t||[]).find(function(t){return t.name.toUpperCase()===n})}function h(t){return t&&0!==t.length?t.map(c).join(", "):""}function c(t){var n=t.name;return t.optional&&(n="["+n+"]"),n=t.repeatable?"..."+n:n}function l(t){var n=t.name;return t.repeatable&&(n+=", ..."),n=t.optional?"["+n+"]":n}function v(t){return"".concat(t.name,"(").concat(h(t.parameters),")")}function d(t){return"(".concat(r().FORMULA," ").concat(v(t))}function y(t){return t[t.length-1]}function m(t){return"gc-formula-editor-tooltip-help-function-"+t}function p(t,n){var e,i,r,o,u,s,e=document.createElement("p");for(e.className=m("title"),(i=function(t,n){var i=document.createElement("span");return i.className=n,i.textContent=t,e.appendChild(i),i})(t.name,(r=function(t){return m("title-"+t)})("function-name")),i("(",r("parentheses")),o=t.parameters||[],u=0;u<o.length;u++)s=r("parameter"),void 0!==n&&n===u&&(s+=" "+r("active-parameter")),i(l(o[u]),s),u!==o.length-1&&i(",",r("parameter-separator"));return i(")",r("parentheses")),e}function k(t){var n=document.createElement("p");return n.textContent=t,n.className=m("description"),n}u=this&&this.__assign||function(){return(u=Object.assign||function(t){for(var n,i,e,r,i=1,e=arguments.length;i<e;i++)for(r in n=arguments[i])Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t}).apply(this,arguments)},Object.defineProperty(n,"__esModule",{value:!0}),n.createHelpFunctionDescriptionDom=n.createHelpFunctionTitleDom=n.lastItem=n.getFunctionHoverTitle=n.getFunctionSignatureString=n.getParameterString=n.getParameterListString=n.findFunctionResource=n.findFunction=n.normalizeFunctionDescription=n.convertToFunctionResource=n.END_OF_LINE=n.WHITESPACE=n.RIGHT_CURLY_BRACKETS=n.LEFT_CURLY_BRACKETS=n.RIGHT_PARENTHESES=n.LEFT_PARENTHESES=n.SEMICOLON=n.COMMA=n.FULL_STOP=n.EQUAL=void 0,e=i("Common"),i=i("./dist/plugins/formulaPanel/editor/editor.ns.js"),e=new e.Common.ResourceManager(i.SR,"formulaEditor"),r=e.getResource.bind(e),n.EQUAL="=",n.FULL_STOP=".",n.COMMA=",",n.SEMICOLON=";",n.LEFT_PARENTHESES="(",n.RIGHT_PARENTHESES=")",n.LEFT_CURLY_BRACKETS="{",n.RIGHT_CURLY_BRACKETS="}",n.WHITESPACE=" ",n.END_OF_LINE="\r\n",n.convertToFunctionResource=o,n.normalizeFunctionDescription=s,n.findFunction=a,n.findFunctionResource=f,n.getParameterListString=h,n.getParameterString=c,n.getFunctionSignatureString=v,n.getFunctionHoverTitle=d,n.lastItem=y,n.createHelpFunctionTitleDom=p,n.createHelpFunctionDescriptionDom=k},"./dist/plugins/formulaPanel/editor/editor.ns.js":function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.SR=void 0;var i=i("./dist/plugins/formulaPanel/editor/editor.res.en.js");n.SR={en:i}},"./dist/plugins/formulaPanel/editor/editor.res.en.js":function(t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.FORMULA=n.INVALID_FORMULA=n.INVALID_EXPRESSION=n.DUPLICATE_IDENTIFIER=n.INVALID_IDENTIFIER_ARGUMENT=n.NO_MATCHED_ARGUMENTS=n.UNKNOWN_SHEET=n.UNKNOWN_NAME=n.MISS_LET_FUNCTION_BODY=n.MISS_RIGHT_PARENTHESES=n.NO_MATH_PARENTHESES=void 0,n.NO_MATH_PARENTHESES="No match parentheses",n.MISS_RIGHT_PARENTHESES="')' is expected.",n.MISS_LET_FUNCTION_BODY="Missing body of LET expression.",n.UNKNOWN_NAME="Unknown name",n.UNKNOWN_SHEET='Unknown sheet "$1"',n.NO_MATCHED_ARGUMENTS="Expected $1 arguments, but got $2",n.INVALID_IDENTIFIER_ARGUMENT="This argument must be an identifier to bind.",n.DUPLICATE_IDENTIFIER="Duplicate identifier $1",n.INVALID_EXPRESSION="Invalid EXPRESSION",n.INVALID_FORMULA="Invalid Formula",n.FORMULA="Formula"},"./dist/plugins/formulaPanel/editor/featureProvider/completion.js":function(t,n,i){var h,c,r,o,l,u,s,i;function a(n,t){var i,t,i,t,i=(0,r.getSignatureStatus)((0,o.getTokensByState)(t.state),t.pos);i&&(t=(0,o.getFunctionResourceByState)(t.state,i.functionName))&&(i=(0,r.getActiveParameterInSignatureTip)(i.activeParameter,t),t=t.parameters&&t.parameters[i])&&t.enum&&t.enum.forEach(function(t){n.push({label:t.value,detail:t.description,type:"enum",apply:t.value})})}function f(n,t){var i,t,e,i=t.state,t=t.pos,e;(0,r.getLocalSymbol)((0,o.getTokensByState)(i),t).forEach(function(t){n.push({label:t,type:"variable",apply:t})})}function v(n,t){var i;(0,o.getCustomNamesByState)(t.state).forEach(function(t){n.push({label:t.getName(),detail:t.getComment()||"",type:"constant",apply:t.getName()})})}function d(n,t){var i;(0,o.getFunctionResourcesByState)(t.state).forEach(function(t){t.description&&n.push({label:t.name,detail:t.description,type:"function",apply:e})})}function e(t,n,e,r){var o,u,s,a,f,n,o=t.state,u=o.selection.main,s=e-u.from,a=r-u.from,f=n.label,n=o.changeByRange(function(t){var n,i,n=t.from+s,i=t.from+a;return t!==u&&e!==r&&o.sliceDoc(n,i)!==o.sliceDoc(e,r)?{range:t}:{changes:{from:n,to:r===u.from?t.to:i,insert:f+"()"},range:c.State.EditorSelection.cursor(n+f.length+1)}});t.dispatch(h(h({},n),{userEvent:"input.complete",effects:l.triggerSignatureTooltip.of(null)}))}function y(t){return(0,o.getStructReferencesByState)(t.state).map(p)}function m(t,n){var i,i,e,n,i=t.selection.main.head,i=n.text.substring(0,i-n.index);return i&&"["===i[i.length-1]&&(e=i.substring(0,i.length-1),n=(0,o.getStructReferencesByState)(t).find(function(t){return t.name===e}))?n.getColumns().map(p):[]}function p(t){return{label:t.name,detail:t.description,type:"variable"}}function k(t){var n,t,n=t.state.selection.main.head,t=(0,o.getTokensByState)(t.state);return(0,r.getTokenByPos)(t,n,!1,!0)}function g(t){var n,i,e,r,n;return!t.state.field(u.isFormulaField)||(i=k(t))&&i.type===s.TokenType.StringConst?null:(e=t.matchBefore(/[\w.]*/),(r=[]).push.apply(r,m(t.state,i)),a(r,t),e&&e.from===e.to||(f(r,t),d(r,t),v(r,t),r.push.apply(r,y(t))),{from:e?e.from:t.pos,options:r})}h=this&&this.__assign||function(){return(h=Object.assign||function(t){for(var n,i,e,r,i=1,e=arguments.length;i<e;i++)for(r in n=arguments[i])Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t}).apply(this,arguments)},Object.defineProperty(n,"__esModule",{value:!0}),n.autoCompletionExtensions=void 0,c=i("./dist/plugins/formulaPanel/editor/codemirror/index.js"),r=i("./dist/plugins/formulaPanel/editor/common/calcUtil.js"),o=i("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),l=i("./dist/plugins/formulaPanel/editor/featureProvider/signatureTooltips.js"),u=i("./dist/plugins/formulaPanel/editor/featureProvider/customField.js"),s=i("./dist/plugins/formulaPanel/editor/interface.js"),i=c.Autocomplete.autocompletion,n.autoCompletionExtensions=i({override:[g]})},"./dist/plugins/formulaPanel/editor/featureProvider/customField.js":function(t,n,i){var e,r,o,u,s,a,i;function f(t,o){return a.define({create:t,update:function(t,n){for(var i,e,r,i=0,e=n.effects;i<e.length;i++)if((r=e[i]).is(o))return r.value;return t}})}function h(t){return!!t.docChanged||t.effects.some(function(t){return t.is(n.setCalcServiceField)||t.is(n.setCalcSourceField)||t.is(n.setCustomNamesField)||t.is(n.setProviderField)||t.is(n.setActiveCellField)||t.is(n.rebuildFormulaEffect)})}Object.defineProperty(n,"__esModule",{value:!0}),n.needRebuildToken=n.customFields=n.isFormattedFormulaField=n.isFormulaField=n.themeField=n.setThemeField=n.optionsField=n.setOptionsField=n.tokenField=n.rebuildFormulaEffect=n.providerField=n.setProviderField=n.customNamesField=n.setCustomNamesField=n.activeCellField=n.setActiveCellField=n.calcSourceField=n.setCalcSourceField=n.calcServiceField=n.setCalcServiceField=void 0,e=i("Core"),r=i("./dist/plugins/formulaPanel/editor/codemirror/index.js"),o=i("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),u=i("./dist/plugins/formulaPanel/editor/common/const.js"),s=i("./dist/plugins/formulaPanel/editor/featureProvider/formatter.js"),a=r.State.StateField,i=r.State.StateEffect,n.setCalcServiceField=i.define(),n.calcServiceField=f(function(){return u.defaultCalcService},n.setCalcServiceField),n.setCalcSourceField=i.define(),n.calcSourceField=f(function(){return u.defaultCalcSource},n.setCalcSourceField),n.setActiveCellField=i.define(),n.activeCellField=f(function(){return u.DEFAULT_ACTIVE_CELL_INFO},n.setActiveCellField),n.setCustomNamesField=i.define(),n.customNamesField=f(function(){return[]},n.setCustomNamesField),n.setProviderField=i.define(),n.providerField=f(function(){return u.DEFAULT_PROVIDER},n.setProviderField),n.rebuildFormulaEffect=i.define(),n.tokenField=a.define({create:function(t){return(0,o.parseToTokens)(t,(0,o.getTextByState)(t))},update:function(t,n){return h(n)?(0,o.parseToTokens)(n.state,(0,o.getTextByState)(n.state)):t}}),n.setOptionsField=i.define(),n.optionsField=f(function(){return u.DEFAULT_FORMULA_EDITOR_OPTIONS},n.setOptionsField),n.setThemeField=i.define(),n.themeField=f(function(){return u.defaultTheme},n.setThemeField),n.isFormulaField=a.define({create:function(t){return(0,e.kf)((0,o.getTextByState)(t))},update:function(t,n){return n.docChanged?(0,e.kf)((0,o.getTextByState)(n.state)):t}}),n.isFormattedFormulaField=a.define({create:function(){return!0},update:function(t,n){return n.docChanged?!!n.annotation(s.formatDocumentAnnotation):t}}),n.customFields=[n.optionsField,n.themeField,n.isFormulaField,n.isFormattedFormulaField,n.activeCellField,n.calcServiceField,n.calcSourceField,n.customNamesField,n.providerField,n.tokenField],n.needRebuildToken=h},"./dist/plugins/formulaPanel/editor/featureProvider/dbClickRangeSelector.js":function(t,n,i){var e,o,u,s,a;Object.defineProperty(n,"__esModule",{value:!0}),n.doubleClickSelectRangeExtension=void 0,e=i("./dist/plugins/formulaPanel/editor/codemirror/index.js"),o=i("./dist/plugins/formulaPanel/editor/common/calcUtil.js"),u=i("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),s=i("./dist/plugins/formulaPanel/editor/featureProvider/customField.js"),a=e.State.EditorSelection,n.doubleClickSelectRangeExtension=e.View.EditorView.mouseSelectionStyle.of(function(e,t){var n,i,r,n;return!e.state.field(s.isFormulaField)||2!==t.detail||0!==t.button||null===(i=e.posAtCoords(t))?null:(r=e.state.selection,{get:function(t,n,i){var t,t,t,t=e.posAtCoords(t);return null!==t&&(t=(0,o.getTokenByPos)((0,u.getTokensByState)(e.state),t))?(t=a.range(t.index,t.endIndex+1),i?r.addRange(t):a.create([t])):r},update:function(t){i=t.changes.mapPos(i),r=r.map(t.changes)}})})},"./dist/plugins/formulaPanel/editor/featureProvider/folding.js":function(t,n,i){var e,h;Object.defineProperty(n,"__esModule",{value:!0}),n.foldExtension=void 0,e=i("./dist/plugins/formulaPanel/editor/codemirror/index.js"),h=i("./dist/plugins/formulaPanel/editor/common/calcUtil.js"),n.foldExtension=e.Language.foldService.of(function(t,n,i){for(var e,r,o,n,u,s,a,f,e=t.doc.lineAt(n),r=t.doc.lines,o=(0,h.getLineIndent)(e.text),n=n,u=i,s=e.number+1;s<r&&(a=t.doc.line(s),o<(f=(0,h.getLineIndent)(a.text)));s++)u=a.to;return t.doc.lineAt(n).number===t.doc.lineAt(u).number?null:{from:n=e.to,to:u}})},"./dist/plugins/formulaPanel/editor/featureProvider/formatter.js":function(t,a,n){var i,f,h,c,l,v,e;function d(t,n,i,e){var r,o,u,t,r=s(t),o=s(n),u=n.length,t=function(t,n){var i,e;for(t-=r[t],i=0;i<o.length;i++){if((e=i-o[i])===t&&!n){t=i;break}if(t<e){t=i-1;break}}return t<=u&&0<=t?t:0};return i===e?i=e=t(e,!1):(i=t(i,!0),e=t(e,!1)),[i,e]}function s(t){for(var n,i,e,r,n=function(t){return" "===t||"\n"===t},i=[0],e=1;e<=t.length;e++)r=i[e-1],i.push(r+(n(t[e-1])?1:0));return i}function y(t){var n,i,e,t,t,n,i,e=r(t.scrollDOM.getBoundingClientRect(),t.contentDOM.getBoundingClientRect()),t=t.contentDOM.querySelector(".cm-line");return t&&(t=window.getComputedStyle(t),e-=parseInt(t.paddingLeft,10)+parseInt(t.paddingRight,10)),e}function r(t,n){var i,e,t,i=Math.max(t.left,n.left),e,t=Math.min(t.right,n.right)-i;return 0<=t?t:0}function m(t){var n,t,i,e,n,t=window.getComputedStyle(t.contentDOM).font,i,e=document.createElement("canvas").getContext("2d");return e.font=t,function(t){return e.measureText(t).width}}Object.defineProperty(a,"__esModule",{value:!0}),a.formatDocumentCommand=a.formatDocumentAnnotation=void 0,i=n("./dist/plugins/formulaPanel/editor/codemirror/index.js"),f=n("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),h=n("./dist/plugins/formulaPanel/editor/common/formatter.js"),c=n("./dist/plugins/formulaPanel/editor/featureProvider/customField.js"),l=n("./dist/plugins/formulaPanel/editor/featureProvider/signatureTooltips.js"),v=Number.MAX_SAFE_INTEGER,a.formatDocumentAnnotation=i.State.Annotation.define(),a.formatDocumentCommand=e=function(t){var n,i,e,r,o,u,s,i,e,r,o,n;return!!t.state.field(c.isFormulaField)&&(i=(0,f.getTabSizeByState)(t.state),e=(0,f.getFormatWidthLimitByState)(t.state),r=v,o=function(t){return 0},"auto"===e&&(r=y(t),e=v,o=m(t)),u=t.state.selection.main,i={absoluteReference:!1,parseContext:s=(0,f.getParseContextByState)(t.state),tabSize:i,widthLimit:e,lineWidthLimit:r,measureTextFunc:o},e=(0,f.getTextByState)(t.state),void 0!==(r=(0,h.format)(e,i)))&&(e!==r&&(o=d(e,r,u.from,u.to),t.dispatch({changes:{from:0,to:t.state.doc.length,insert:r},selection:{anchor:o[0],head:o[1]},annotations:[l.notTriggerSignatureTooltip.of(!0),a.formatDocumentAnnotation.of(!0)]})),!0)}},"./dist/plugins/formulaPanel/editor/featureProvider/hoverTooltips.js":function(t,n,i){var e,o,u,s,a;Object.defineProperty(n,"__esModule",{value:!0}),n.hoverTooltipExtension=void 0,e=i("./dist/plugins/formulaPanel/editor/codemirror/index.js"),o=i("./dist/plugins/formulaPanel/editor/common/calcUtil.js"),u=i("./dist/plugins/formulaPanel/editor/common/util.js"),s=i("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),a=i("./dist/plugins/formulaPanel/editor/featureProvider/customField.js"),n.hoverTooltipExtension=e.View.hoverTooltip(function(t,n){var i,e,e,n,r,i;return!t.state.field(a.isFormulaField)||(e=(0,s.getTokensByState)(t.state),!(e=(0,o.getTokenByPos)(e,n)))||(n=[],r=(0,s.getFunctionResourceByState)(t.state,e.text),(0,o.isFunctionCallToken)(e)&&r&&(n.push((0,u.getFunctionHoverTitle)(r)),r.description)&&n.push(r.description),0===n.length)?null:{pos:e.index,end:e.endIndex+1,above:!0,create:function(){var t=document.createElement("div");return t.className="gc-formula-editor-tooltip-help-function",t.appendChild((0,u.createHelpFunctionTitleDom)(r)),r.description&&t.appendChild((0,u.createHelpFunctionDescriptionDom)(r.description)),{dom:t}}}})},"./dist/plugins/formulaPanel/editor/featureProvider/indent.js":function(t,n,i){var e,r,o;Object.defineProperty(n,"__esModule",{value:!0}),n.indentExtension=void 0,e=i("./dist/plugins/formulaPanel/editor/codemirror/index.js"),r=i("./dist/plugins/formulaPanel/editor/common/calcUtil.js"),o=i("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),n.indentExtension=e.Language.indentService.of(function(t,n){var n;return!(n<=0)&&(n=t.lineAt(n-1))&&n.text?(0,r.getIndentByPreviousText)(n.text,(0,o.getTokensByState)(t.state)):0})},"./dist/plugins/formulaPanel/editor/featureProvider/lint.js":function(t,n,i){var e,r,o,s,h,c,a,u,f,i,l;function v(t,n){return l().NO_MATCHED_ARGUMENTS.replace("$1",t+"").replace("$2",n+"")}function d(t){return l().UNKNOWN_SHEET.replace("$1",t)}function y(t){return l().DUPLICATE_IDENTIFIER.replace("$1",t)}function m(t){var n,i,e,r,o,n=[],i;return t.field(f.isFormulaField)?(e=(0,a.getTextByState)(t),P(n,r=(0,a.getTokensByState)(t),t,e),A(n)||((o=(0,a.parseToExpressionTree)(e,t))?w(n,o,t):O(n,r,t,e),(0,a.parseToExpressionTree)(e,t,!0))||A(n)||p(n,0,e.length,l().INVALID_FORMULA),n):[]}function p(t,n,i,e,r){t.push({from:n,to:i,message:e,severity:r=void 0===r?"error":r})}function k(t,n,i,e){p(t,n.index,n.endIndex+1,i,e=void 0===e?"error":e)}function g(t,n,i,e){p(t,n.lit,n.ywt,i,e=void 0===e?"error":e)}function w(t,n,i){if(n){for(;n.type===s.ExpressionType.parentheses;){if(!n.value)return void g(t,n,l().INVALID_EXPRESSION);n=n.value}var e=n.type;e===s.ExpressionType.name?(0,a.getCustomNameByState)(i,n.value)||g(t,n,l().UNKNOWN_NAME,"warning"):e===s.ExpressionType.operator?(n.value&&w(t,n.value,i),n.value2&&w(t,n.value2,i)):e===s.ExpressionType.function?b(t,n,i):e===s.ExpressionType.reference&&j(t,n)}}function b(t,n,i){var e,r,o,u,e=n.functionName;if("LET"===e)M(t,n,i);else if("LAMBDA"===e)x(t,n,i);else for((0,s.isExpression)(n.function)?w(t,n.function,i):(r=(0,a.getFunctionByState)(i,e))?S(t,n,r):(0,a.getCustomNameByState)(i,e)||p(t,n.lit,n.lit+e.length,l().UNKNOWN_NAME,"warning"),o=n.arguments||[],u=0;u<o.length;u++)w(t,o[u],i)}function M(t,n,i){var e,r,o,u,s,e=n.lit,r=n.ywt,o=n.arguments||[];for(o.length<3&&p(t,e,r,v(3,o.length)),3<=o.length&&o.length%2==0&&p(t,e,r,l().MISS_LET_FUNCTION_BODY),u=[],s=0;s<o.length-1;s++)s%2==0?(C(t,o[s],u),u.push(o[s].value)):w(t,o[s],i);w(t,o[o.length-1],i)}function x(t,n,i){var e,r,o,u,s,e=n.lit,r=n.ywt,o=n.arguments||[];for(o.length<1&&p(t,e,r,v(1,o.length)),u=[],s=0;s<o.length-1;s++)C(t,o[s],u),u.push(o[s].value);w(t,o[o.length-1],i)}function S(t,n,i){var e,r,o,i,n,e=n.lit,r=n.ywt,o=i.minArgs||0,i=i.maxArgs!==u?i.maxArgs:Number.MAX_SAFE_INTEGER,n=n.arguments||[];n.length<o?p(t,e,r,v(o,n.length)):n.length>i&&p(t,e,r,v(i,n.length))}function C(t,n,i){var e,r,e=n.lit,r=n.ywt;!n||8!==n.type&&100!==n.type||-1<n.value.indexOf(".")?p(t,e,r,l().INVALID_IDENTIFIER_ARGUMENT):-1!==i.indexOf(n.value)&&p(t,e,r,y(n.value))}function j(t,n){var i,e,i=n.source,e=i&&i.getName();i instanceof s.ErrorSource&&e&&p(t,n.lit,n.lit+e.length,d(e),"warning")}function P(t,n,i,e){for(var r,o,u,s,a,r=[],o=function(t){return(0,h.isFunctionCallStartToken)(t)||(0,h.isSubExpressionStartToken)(t)||(0,h.isLeftParenthesesToken)(t)},u=function(t){return(0,h.isFunctionCallEndToken)(t)||(0,h.isSubExpressionEndToken)(t)||(0,h.isRightParenthesesToken)(t)},s=0;s<n.length;s++)o(a=n[s])?r.push(a):u(a)&&(0<r.length?r.pop():k(t,a,l().NO_MATH_PARENTHESES));0<r.length&&p(t,e.length,e.length,l().MISS_RIGHT_PARENTHESES)}function O(t,n,i,e){for(var r,o,u,s,a,f,f,r=[],o=[],u=[],s=0;s<n.length;s++)a=n[s],(0,h.isFunctionCallToken)(a)?(r.push({token:a}),u.push([])):(0,h.isSubExpressionStartToken)(a)?o.push({token:a}):(0,h.isFunctionCallEndToken)(a)?0===r.length?k(t,a,l().NO_MATH_PARENTHESES):(f=(0,c.lastItem)(r),r.pop(),u.pop(),f.hasError||(f=E(i,e,f.token,a),t.push.apply(t,f),A(f)&&(r.forEach(function(t){t.hasError=!0}),o.forEach(function(t){t.hasError=!0})))):(0,h.isSubExpressionEndToken)(a)?0===o.length?k(t,a,l().NO_MATH_PARENTHESES):o.pop():(0,h.isFunctionArgumentSeparator)(a)?0!==r.length&&(0,c.lastItem)(u).push(a):(0,h.isRightParenthesesToken)(a)&&k(t,a,l().NO_MATH_PARENTHESES);(0<r.length||0<o.length)&&p(t,e.length,e.length,l().MISS_RIGHT_PARENTHESES)}function E(t,n,i,e){var r,o,i,e,n,r=[],o=i.index,i=e.endIndex+1,e=n.substring(o,i),n=(0,a.parseToExpressionTree)(e,t);return n?(b(r,n,t),r.forEach(function(t){t.from+=o,t.to+=o}),(0,a.parseToExpressionTree)(e,t,!0)||A(r)||p(r,o,i,l().INVALID_EXPRESSION)):p(r,o,i,l().INVALID_EXPRESSION),r}function A(t){return t.some(function(t){return"error"===t.severity})}Object.defineProperty(n,"__esModule",{value:!0}),n.getDiagnostic=n.linterExtension=void 0,e=i("./dist/plugins/formulaPanel/editor/codemirror/index.js"),r=i("Common"),o=i("./dist/plugins/formulaPanel/editor/editor.ns.js"),s=i("CalcEngine"),h=i("./dist/plugins/formulaPanel/editor/common/calcUtil.js"),c=i("./dist/plugins/formulaPanel/editor/common/util.js"),a=i("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),u=void 0,f=i("./dist/plugins/formulaPanel/editor/featureProvider/customField.js"),i=new r.Common.ResourceManager(o.SR,"formulaEditor"),l=i.getResource.bind(i),n.linterExtension=e.Lint.linter(function(t){return m(t.state)},{needsRefresh:function(t){return t.transactions.some(f.needRebuildToken)}}),n.getDiagnostic=m},"./dist/plugins/formulaPanel/editor/featureProvider/readOnly.js":function(t,n,i){var e,r;function o(t,n){t.dispatch({effects:r.reconfigure(e.State.EditorState.readOnly.of(n))})}Object.defineProperty(n,"__esModule",{value:!0}),n.reconfigureReadOnly=n.readOnlyExtension=void 0,e=i("./dist/plugins/formulaPanel/editor/codemirror/index.js"),r=new e.State.Compartment,n.readOnlyExtension=r.of(e.State.EditorState.readOnly.of(!1)),n.reconfigureReadOnly=o},"./dist/plugins/formulaPanel/editor/featureProvider/signatureTooltips.js":function(t,s,n){var i,o,u,a,f,n,e,r,h,c,n;function l(t){var n,n,i,t,e,r,n=t.selection.main;return n&&n.from===n.to&&(n=n.from,i=(0,o.getSignatureStatus)((0,u.getTokensByState)(t),n))&&(t=(0,u.getFunctionResourceByState)(t,i.functionName))?(r=(0,o.getActiveParameterInSignatureTip)(i.activeParameter,e=t),[{pos:n,above:!0,arrow:!0,create:function(){var t=document.createElement("div");return t.className="gc-formula-editor-tooltip-help-function",t.appendChild((0,f.createHelpFunctionTitleDom)(e,r)),e.description&&t.appendChild((0,f.createHelpFunctionDescriptionDom)(e.description)),{dom:t,overlap:!0}}}]):[]}Object.defineProperty(s,"__esModule",{value:!0}),s.signatureTooltipsExtensions=s.closeParameterHintsCommand=s.triggerParameterHintsCommand=s.hasParameterHints=s.notTriggerSignatureTooltip=s.closeSignatureTooltip=s.triggerSignatureTooltip=void 0,i=n("./dist/plugins/formulaPanel/editor/codemirror/index.js"),o=n("./dist/plugins/formulaPanel/editor/common/calcUtil.js"),u=n("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),a=n("./dist/plugins/formulaPanel/editor/featureProvider/customField.js"),f=n("./dist/plugins/formulaPanel/editor/common/util.js"),n=i.State.StateField,s.triggerSignatureTooltip=i.State.StateEffect.define(),s.closeSignatureTooltip=i.State.StateEffect.define(),s.notTriggerSignatureTooltip=i.State.Annotation.define(),e=n.define({create:function(){return[]},update:function(t,n){var i,e,r,o,u,i;if(!n.state.field(a.isFormulaField))return[];if(e=t&&0<t.length,n.annotation(s.notTriggerSignatureTooltip)&&!e)return[];for(r=0,o=n.effects;r<o.length;r++){if((u=o[r]).is(s.closeSignatureTooltip))return[];if(u.is(s.triggerSignatureTooltip))return l(n.state)}return n.docChanged?l(n.state):e?n.selection?l(n.state):t:[]},provide:function(n){return i.View.showTooltip.computeN([n],function(t){return t.field(n)})}}),s.hasParameterHints=r=function(t){return 0<t.state.field(e).length},s.triggerParameterHintsCommand=h=function(t){return t.dispatch({effects:s.triggerSignatureTooltip.of(null)}),!0},s.closeParameterHintsCommand=c=function(t){return!!(0,s.hasParameterHints)(t)&&(t.dispatch({effects:s.closeSignatureTooltip.of(null)}),!0)},n=i.View.EditorView.updateListener.of(function(t){t.focusChanged&&!t.view.hasFocus&&(0,s.closeParameterHintsCommand)(t.view)}),s.signatureTooltipsExtensions=[e,n]},"./dist/plugins/formulaPanel/editor/featureProvider/syntaxHighlighting.js":function(t,e,n){var i,r,o,u,s,n,a;function f(t){return"gc-formula-editor-token_"+r.SyntaxHighlightingTokenType[t]}function h(t){var n;return t.field(u.isFormulaField)?a.of(l(t)):a.of([])}function c(t,n){var i={};return isNaN(n)||(i[e.TOKEN_INDEX_ATTRIBUTE_NAME]=n),{class:f(t),attributes:i}}function l(t){var n=(0,o.getTokensByState)(t);return v(n,t),n.map(function(t){var n=m(t);return i.View.Decoration.mark(c(n,t.colorIndex)).range(t.index,t.endIndex+1)})}function v(t,n){var i,e,i=[];t.forEach(function(n){var t;((0,s.isReferenceToken)(n)||(0,s.isNameToken)(n)&&(0,s.hasReferenceRanges)(n))&&(t=i.find(function(t){return d(t,n)}),n.colorIndex=t?t.colorIndex:y(i),i.push(n))}),e=(0,o.getReferenceTokenColors)(n).length,i.forEach(function(t){t.colorIndex=t.colorIndex%e})}function d(t,n){return(0,s.removeWhiteSpace)(t.text).toUpperCase()===(0,s.removeWhiteSpace)(n.text).toUpperCase()}function y(t){return t&&0!==t.length?Math.max.apply(Math,t.map(function(t){return t.colorIndex}))+1:0}function m(t){var n,i,n=t.type,i=r.SyntaxHighlightingTokenType.unknown;return n===r.TokenType.NumberConst?i=r.SyntaxHighlightingTokenType.numberConst:n===r.TokenType.StringConst?i=r.SyntaxHighlightingTokenType.stringConst:n===r.TokenType.LogicalConst?i=r.SyntaxHighlightingTokenType.booleanConst:n===r.TokenType.ErrorConst?i=r.SyntaxHighlightingTokenType.errorConst:n===r.TokenType.CellReference?i=r.SyntaxHighlightingTokenType.reference:n===r.TokenType.Name?i=(0,s.hasReferenceRanges)(t)?r.SyntaxHighlightingTokenType.reference:r.SyntaxHighlightingTokenType.name:n===r.TokenType.OperatorPrefix?i=r.SyntaxHighlightingTokenType.operatorPrefix:n===r.TokenType.OperatorInfix?i=r.SyntaxHighlightingTokenType.operatorInfix:n===r.TokenType.OperatorPostfix?i=r.SyntaxHighlightingTokenType.operatorPostfix:n===r.TokenType.Whitespace?i=r.SyntaxHighlightingTokenType.whitespace:n===r.TokenType.FunctionName||n===r.TokenType.FunctionCallStart||n===r.TokenType.FunctionCallEnd?i=r.SyntaxHighlightingTokenType.function:n===r.TokenType.FunctionArgumentSeparator||n===r.TokenType.ArrayConstRowSeparator||n===r.TokenType.ArrayConstItemSeparator?i=r.SyntaxHighlightingTokenType.argumentSeparator:n!==r.TokenType.SubExpressionStart&&n!==r.TokenType.SubExpressionEnd||(i=r.SyntaxHighlightingTokenType.subExpression),i}Object.defineProperty(e,"__esModule",{value:!0}),e.markReferenceTokenColorIndex=e.syntaxHighlightingTokenClassName=e.syntaxHighlightingField=e.TOKEN_INDEX_ATTRIBUTE_NAME=void 0,i=n("./dist/plugins/formulaPanel/editor/codemirror/index.js"),r=n("./dist/plugins/formulaPanel/editor/interface.js"),o=n("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),u=n("./dist/plugins/formulaPanel/editor/featureProvider/customField.js"),s=n("./dist/plugins/formulaPanel/editor/common/calcUtil.js"),n=i.State.StateField,a=i.State.RangeSet,e.TOKEN_INDEX_ATTRIBUTE_NAME="data-token-index",e.syntaxHighlightingField=n.define({create:h,update:function(t,n){return h(n.state)},provide:function(t){return i.View.EditorView.decorations.from(t)}}),e.syntaxHighlightingTokenClassName=f,e.markReferenceTokenColorIndex=v},"./dist/plugins/formulaPanel/editor/featureProvider/tab.js":function(t,n,i){var e,r;Object.defineProperty(n,"__esModule",{value:!0}),n.insertTab=void 0,e=i("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),n.insertTab=r=function(t){var n;return!t.state.readOnly&&!t.state.selection.ranges.some(function(t){return!t.empty})&&(n=(0,e.getOneIndentSpaceByState)(t.state),t.dispatch(t.state.update(t.state.replaceSelection(n),{scrollIntoView:!0,userEvent:"input"})),!0)}},"./dist/plugins/formulaPanel/editor/featureProvider/theme.js":function(t,n,i){var e,r,o,u,s;function a(t){var n=t.autocompletionStyle,t=t.errorStyle;return u.theme({"& .cm-tooltip-autocomplete":{color:n.color,font:n.font,background:n.backgroundColor,border:n.border,"margin-left":"1em"},"& .cm-tooltip-autocomplete ul li":{padding:"5px"},"& .cm-tooltip-autocomplete ul li .cm-completionIcon-function":{color:n.function_icon.color,font:n.function_icon.font},"& .cm-tooltip-autocomplete ul li .cm-completionLabel":{color:n.function_name.color,font:n.function_name.font},"& .cm-tooltip-autocomplete ul li .cm-completionDetail":{color:n.function_name.color,font:n.function_name.font},"& .cm-tooltip-autocomplete ul li[aria-selected] .cm-completionIcon-function":{color:n.activeItem.color,background:n.activeItem.backgroundColor},"& .cm-tooltip-autocomplete ul li[aria-selected] .cm-completionLabel":{color:n.activeItem.color,background:n.activeItem.backgroundColor},"& .cm-tooltip-autocomplete ul li[aria-selected] .cm-completionDetail":{color:n.activeItem.color,background:n.activeItem.backgroundColor},"& .cm-tooltip-autocomplete ul li[aria-selected]":{color:n.activeItem.color,background:n.activeItem.backgroundColor},"& .cm-tooltip .cm-tooltip-lint .cm-diagnostic ":{color:t.color,font:t.font,background:t.backgroundColor}})}function f(t){var e,r,e={},r=function(t,n,i){var t,i,t=(0,o.syntaxHighlightingTokenClassName)(t),i=isNaN(i)?"":"[".concat(o.TOKEN_INDEX_ATTRIBUTE_NAME,'="').concat(i,'"]');e["& .".concat(t).concat(i)]=n};return t.forEach(function(i){Array.isArray(i.color)?(r(i.token,{color:i.color[0]}),i.color.forEach(function(t,n){r(i.token,{color:t},n)})):r(i.token,{color:i.color})}),u.theme(e)}function h(t,n){return u.theme({"& .cm-scroller":{"background-color":t.backgroundColor,color:t.color,font:t.font},".cm-cursor, .cm-dropCursor":{borderLeftColor:t.caretColor},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:t.selectionBackColor},"& .cm-activeLine":{"background-color":t.activeLineBackColor},"& .cm-gutters":{"background-color":n.backgroundColor,color:n.color,font:n.font,"user-select":"none"},"& .cm-lineNumbers ":{width:"30px"},'& .cm-foldGutter span[title="Fold line"] ':{"padding-bottom":"8px"},"& .cm-gutterElement":{display:"flex","align-items":"center","justify-content":"flex-end"},"& .cm-activeLineGutter":{"background-color":t.activeLineBackColor},"& .cm-tooltip":{border:"none"}})}function c(t){var n,i,t,e,n=t.rules,i=t.editorContentStyle,t=t.editorGuttersStyle,e=[s];return i&&t&&(e=e.concat([h(i,t),a(i)])),e=n?e.concat(f(n)):e}Object.defineProperty(n,"__esModule",{value:!0}),n.themeExtension=n.createThemeExtension=n.themeCompartment=n.createSyntaxHighlightingTheme=void 0,e=i("./dist/plugins/formulaPanel/editor/codemirror/index.js"),r=i("./dist/plugins/formulaPanel/editor/common/const.js"),o=i("./dist/plugins/formulaPanel/editor/featureProvider/syntaxHighlighting.js"),u=e.View.EditorView,s=u.theme({"&":{height:"100%"},"&.cm-editor.cm-focused":{outline:"none"},"& .cm-line":{"line-height":1.35}}),n.createSyntaxHighlightingTheme=f,n.themeCompartment=new e.State.Compartment,n.createThemeExtension=c,n.themeExtension=n.themeCompartment.of(c(r.defaultTheme))},"./dist/plugins/formulaPanel/editor/featureProvider/toggleAbsoluteRelativeReferences.js":function(t,n,i){var u,e,p,r,o;function k(t,n,i,e,r,o){var t=(0,p.parseToExpressionTree)(t,n);return t.isFullColumn||t.isFullRow?(0,u.lmt)(t,i,e,!0,!0):t.hmt()?(0,u.dmt)(t,i,e):(0,u.lmt)(t,i,e,r,o),(0,p.unparseToText)(t,n)}function g(t,n,i){return(0,e.includeToken)(t,n,i)||(0,e.isInToken)(t,n,!0,!0)||(0,e.isInToken)(t,i,!0,!0)}Object.defineProperty(n,"__esModule",{value:!0}),n.toggleAbsoluteRelativeReferencesCommand=void 0,u=i("FormulaTextBox"),e=i("./dist/plugins/formulaPanel/editor/common/calcUtil.js"),p=i("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),r=i("./dist/plugins/formulaPanel/editor/featureProvider/customField.js"),n.toggleAbsoluteRelativeReferencesCommand=o=function(s){var t,a,n,i,f,h,i,c,l,v,d,y,m,e,t;return!!s.state.field(r.isFormulaField)&&(a=s.state,n=(0,p.getTokensByState)(a),i=a.selection.main,f=i.from,h=i.to,i=a.field(r.activeCellField),c=i.row,l=i.col,v=!1,d=0,y=f,m=h,(e=n.filter(function(t){return g(t,f,h)&&(0,p.isValidReferenceToken)(t,a)})).forEach(function(t){var n,i,e,r,o,o,u,n=t.text.indexOf(":"),i=-1!==n,e=!i||f<=t.index+n,r=!i||h>t.index+n,o=k(t.text,a,c,l,e,r);o&&(s.dispatch({changes:{from:t.index+d,to:t.endIndex+1+d,insert:o}}),d+=o.length-t.text.length,o=t.index,u=t.endIndex+1,!i||e&&r||(e?u=t.index+n:r&&(o=t.index+n+1)),y=Math.min(y,o),m=Math.max(m,u),s.dispatch({selection:{anchor:y,head:m+d}}),v=!0)}),v)}},"./dist/plugins/formulaPanel/editor/formulaEditor-action.js":function(t,r,n){var u,o,s,i,e,a,f,h,c,l,v,d,y,m,n,p;function k(t,n){return{canUndo:n=void 0===n?!1:n,execute:t}}function g(n,t){return k(function(t){return n(t.li.getView())},t=void 0===t?!1:t)}function w(t){var n=u.mt.Qf(),i=!n,n=n;t.register(y,r.Commands[y],27),t.register(h,r.Commands[h],32,i,!0,!1,n),t.register(c,r.Commands[c],27),t.register(l,r.Commands[l],115),t.register(v,r.Commands[v],70,!1,!0,!0),t.register(d,r.Commands[d],83,i,!1,!1,n)}Object.defineProperty(r,"__esModule",{value:!0}),r.registerDefaultCommands=r.Commands=r.executeCommitContextToCellCommand=void 0,u=n("Core"),o=n("FormulaTextBox"),s=n("./dist/plugins/formulaPanel/editor/common/spreadUtil.js"),i=n("./dist/plugins/formulaPanel/editor/featureProvider/formatter.js"),e=n("./dist/plugins/formulaPanel/editor/featureProvider/signatureTooltips.js"),a=n("./dist/plugins/formulaPanel/editor/featureProvider/toggleAbsoluteRelativeReferences.js"),f=n("./dist/plugins/formulaPanel/editor/spreadFeatureProvider/formulaReferencedRangesContext.js"),h="showHints",c="closeHints",l="toggleAbsoluteRelativeReferences",v="formatDocument",d="commitContentToActiveCell",y="exitEdit",r.executeCommitContextToCellCommand=m=function(t,n,i,e,r){var e,e,o,o;void 0===r&&(r=u.SheetArea.viewport),e=0<e.length?e:null,e={cmd:"editCell",sheetName:t.name(),row:n,col:i,sheetArea:r,newValue:e},t.dataRanges&&(o=t.dataRanges.getByPosition(n,i))&&(o=o.convertContext({sheet:t,row:n,col:i,sheetArea:r}))&&o.sheet!==t&&(e.sheetName=o.sheet.name(),e.row=o.row,e.col=o.col),t.Qy().execute(e)},n=k(function(t){var n,i,i,t,e,n=(0,s.Kde)(t.Vv);return!!n&&(i=o.Hde.Ude(),(0,f.isFormulaEditorReferencedRangesAcrossSheetContext)(i)?i.zde(n):(i=t.text(),t=n.getActiveRowIndex(),e=n.getActiveColumnIndex(),(0,r.executeCommitContextToCellCommand)(n,t,e,i)),!0)}),p=k(function(t){var n,i,n=t.workbook();return!(!t.Qde()||!n||((i=t.li.getView()).contentDOM.blur(),(0,f.closeFormulaReferencedRanges)(i.state),n.focus(!1),n.focus(),t.Xde(),0))}),r.Commands={},r.Commands[h]=g(e.triggerParameterHintsCommand),r.Commands[c]=g(e.closeParameterHintsCommand),r.Commands[v]=g(i.formatDocumentCommand),r.Commands[l]=g(a.toggleAbsoluteRelativeReferencesCommand),r.Commands[d]=n,r.Commands[y]=p,r.registerDefaultCommands=w},"./dist/plugins/formulaPanel/editor/formulaEditor-spreadjs.js":function(t,n,i){var e,r,s,o,i,u;function a(t){t.Dn.Fde()}function f(t){var t=t.Bde;return!(!(0,o.isFormulaEditorReferencedRangesContext)(t)||!t.zQt.hasFocus)}function h(t,n,i){var e,r,r,o,o,u,e="";if(t)if(r=(r=t.parent)&&r.options,(o=t.getFormulaInformation(n,i,3))&&o.hasFormula&&!s.mt.HRe(n,i,t)){if(e="="+o.formulaWithCulture,o.isDynamicArray)return"";o.isArrayFormula&&(e="{"+e+"}")}else o=t.getActualStyle(n,i),e="string"==typeof(u=t.getValue(n,i))&&(o.quotePrefix||1<u.length&&"="===u[0]&&r&&r.allowUserEditFormula&&!r.allowInvalidFormula)?"'"+u:s.mt.mi(o,u,t,{sheet:t,row:n,col:i,sheetArea:3})||"";return e}Object.defineProperty(n,"__esModule",{value:!0}),n.getEditText=n.paintFormulaReferencedRanges=void 0,e=i("Common"),r=i("./dist/plugins/formulaPanel/editor/editor.ns.js"),s=i("Core"),o=i("./dist/plugins/formulaPanel/editor/spreadFeatureProvider/formulaReferencedRangesContext.js"),n.paintFormulaReferencedRanges=a,i=new e.Common.ResourceManager(r.SR,"formulaEditor"),u=i.getResource.bind(i),s.Worksheet.ch("formulaEditor",{preProcessKeyDown:function(t){f(this)&&(t.r=!0)},processCompositionStart:function(t){f(this)&&(t.r=!0)}}),n.getEditText=h,s.Workbook.ch("formulaEditor",{onCultureChanged:function(){u()}})},"./dist/plugins/formulaPanel/editor/formulaEditor.js":function(t,r,n){var o,u,s,a,f,e,h,c,l,i,v,d,y,m,p,k,n;function g(t,n){var i,e;"string"==typeof t&&(t=document.getElementById(t)),g.et(i=this,"onCreate",e={container:t}),i.Wc=t=e.container,i.li=new s.FormulaEditorCore(t,k),i.e$r(),i.Qy=new o.Commands.CommandManager(i),i.Zde=i.Zde.bind(i),i.spe=i.spe.bind(i),i.Yde=i.Yde.bind(i),i.$ve=i.$ve.bind(i),i.ove=i.ove.bind(i),i.tve=i.tve.bind(i),i.Rve=i.Rve.bind(i),i.hme=i.hme.bind(i),i.qve=i.qve.bind(i),i.yme=i.yme.bind(i),i.kme=i.kme.bind(i),i.LEt=y(a.DEFAULT_FORMULA_EDITOR_OPTIONS,i.kme),i.Zp(n),i.wme(),t.addEventListener("keydown",i.Zde),(0,f.registerDefaultCommands)(i.Qy),(0,u.GC$)(t).data(r.CONST_FORMULA_EDITOR,i)}function w(t,n,i){var n;return!(!M(t,n,i)&&!x(t,n,i)&&b(t,n,i)&&(u.Worksheet.et(t,"formulaPanelCheckIsReadOnly",n={r:d}),!n.r))}function b(t,n,i){var t=t.getActualStyle(n,i);return!t||!1!==t.allowEditInCell}function M(t,n,i){return t.isActualProtected()&&!1!==t.l0(n,i,"locked")}function x(t,n,i){var e,t,e=t.getCellType(n,i);return!(!e||(t={sheet:t,sheetName:t.name(),sheetArea:u.SheetArea.viewport,row:n,col:i},!(t=e.lfe(t,v)).readonly))}Object.defineProperty(r,"__esModule",{value:!0}),r.FormulaEditor=r.CONST_FORMULA_EDITOR=void 0,o=n("Common"),u=n("Core"),s=n("./dist/plugins/formulaPanel/editor/formulaEditorCore.js"),a=n("./dist/plugins/formulaPanel/editor/common/const.js"),f=n("./dist/plugins/formulaPanel/editor/formulaEditor-action.js"),e=n("./dist/plugins/formulaPanel/editor/spreadFeatureProvider/formulaReferencedRangesExtension.js"),h=n("./dist/plugins/formulaPanel/editor/formulaEditor-spreadjs.js"),c=n("./dist/plugins/formulaPanel/editor/common/spreadUtil.js"),l=n("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),i=n("./dist/plugins/formulaPanel/editor/spreadFeatureProvider/structReferences.js"),r.CONST_FORMULA_EDITOR="formula-editor",v=void 0,d=null,y=u.mt.b0,m=u.GC$.extend,p=u.GC$.each,k=[e.formulaReferencedRangesExtension],g.prototype.e$r=function(){var t=this;t.li.initTheme(),g.et(t,"onThemeChange",t.li.getTheme())},Object.defineProperty(g.prototype,"options",{get:function(){return this.LEt},set:function(t){if(t&&"object"==typeof t)for(var n in t)t.hasOwnProperty(n)&&(this.LEt[n]=t[n])},enumerable:!1,configurable:!0}),g.prototype.text=function(t){if(0===arguments.length)return this.li.getText();this.li.setText(t+"")},g.prototype.workbook=function(){return this.Vv},g.prototype.attach=function(t){var n=this;n.Vv!==t&&(n.detach(),n.Vv=t,n._6(),n.Vv.D3(u.Events.EnterCellInternal,n.spe),n.Vv.D3(u.Events.CellChanged,n.Yde),n.Vv.D3(u.Events.RangeChangedInternal,n.$ve),n.Vv.D3(u.Events.RangeFiltered,n.yme),n.Vv.D3(u.Events.RangeFilterCleared,n.yme),n.Vv.D3(u.Events.ActiveSheetChangingInternal,n.ove),n.Vv.D3(u.Events.ActiveSheetChangedInternal,n.tve),n.Vv.D3(u.Events.SheetOptionsChangedInternal,n.Rve),n.Vv.D3(u.Events.WorkbookOptionsChangedInternal,n.hme),n.Vv.D3(u.Events.CustomNameChangedInternal,n.qve))},g.prototype.detach=function(){var t=this,n=t.Vv;n&&(n._3(u.Events.EnterCellInternal,t.spe),n._3(u.Events.CellChanged,t.Yde),n._3(u.Events.RangeChangedInternal,t.$ve),n._3(u.Events.RangeFiltered,t.yme),n._3(u.Events.RangeFilterCleared,t.yme),n._3(u.Events.ActiveSheetChangingInternal,t.ove),n._3(u.Events.ActiveSheetChangedInternal,t.tve),n._3(u.Events.SheetOptionsChangedInternal,t.Rve),n._3(u.Events.WorkbookOptionsChangedInternal,t.hme),n._3(u.Events.CustomNameChangedInternal,t.qve),t.Vv=v,t._6())},g.prototype.format=function(){this.li.format()},g.prototype.commandManager=function(){return this.Qy},g.prototype.destroy=function(){var t=this;g.et(t,"onDestroy"),t.detach(),t.li.destroy(),t.Wc.removeEventListener("keydown",t.Zde),(0,u.GC$)(t.Wc).data(r.CONST_FORMULA_EDITOR,d)},g.prototype.refresh=function(){var t=this;t.e$r(),t._6()},g.prototype.getActiveCellInfo=function(){var t,n,t,i,t=this.li.getActiveCellInfo(),n=t.row,t=t.col,i;return{sheet:this.li.getCalcSource().Mf,row:n,col:t}},g.prototype.isFormattedFormula=function(){return this.li.isFormattedFormula()},g.prototype.Qde=function(){return this.li.getView().hasFocus},g.prototype.Xde=function(){var t,n,i,t,e,r,t=this.getActiveCellInfo(),n=t.sheet,i=t.row,t=t.col;n&&(e=this.li,r=(0,h.getEditText)(n,i,t),n.options.showFormulas&&n.hasFormula(i,t)&&u.mt.HRe(i,t,n)&&(r=""),(0,l.isSameFormula)(e.getView().state,e.getText(),r)||e.setText(r),e.format())},g.prototype.Zp=function(t){var i,t,i=this.LEt,t=t||{};t=m(!0,{},a.DEFAULT_FORMULA_EDITOR_OPTIONS,t),p(t,function(t,n){i.hasOwnProperty(t)&&(i[t]=n)}),this.li.setOptions(i)},g.prototype.wme=function(){var t=this;t.li.setProvider({getStructReferences:function(){return(0,i.getStructReferencesByWorkbook)(t.Vv)},getFunctions:function(){return(0,c.getFunctionsByWorkbook)(t.Vv)}})},g.prototype.Zde=function(t){this.hve(t)},g.prototype.spe=function(){var t=this;t.tpe()?t.ope():(t.Xde(),t.Ove())},g.prototype.Yde=function(t,n){var i=this.getActiveCellInfo(),e=i.sheet,r=i.row,i=i.col;e===n.sheet&&r===n.row&&i===n.col&&("[styleinfo]"===n.propertyName&&this.Ove(),this.Xde())},g.prototype.$ve=function(t,n){var i,e,r,i;n&&(e=(i=this.getActiveCellInfo()).sheet,r=i.row,i=i.col,e===n.sheet)&&new u.Range(n.row,n.col,n.rowCount,n.colCount).contains(r,i)&&this.Xde()},g.prototype.ove=function(t,n){(0,e.ave)(t,n)},g.prototype.tve=function(t,n){var i;(0,e.uve)(t,n)||this._6()},g.prototype.Rve=function(t,n){var n=n.propertyName;"isProtected"===n&&this.Ove(),"showFormulas"===n&&this.Xde()},g.prototype.hme=function(t,n){var i;"allowDynamicArray"===n.propertyName&&this.li.rebuildFormula()},g.prototype.qve=function(){this.sve()},g.prototype.yme=function(t,n){var i,i,n,i=null==(i=this.Vv)?void 0:i.getSheetTab(n.sheetName),n=this.li.getCalcSource().Mf;i&&i.Mf===n&&this.Xde()},g.prototype.kme=function(t,n,i){var e;n!==i&&this.li.setOptions(this.LEt)},g.prototype._6=function(){var t=this;t.eve(),t.rve(),t.sve(),t.ope()},g.prototype.eve=function(){var t,t,t=(null==(t=this.Vv)?void 0:t.getCalcService())||a.defaultCalcService;this.li.setCalcService(t)},g.prototype.rve=function(){var t=(0,c.Kde)(this.Vv);t?this.li.setCalcSource(t.Uw()):this.li.setCalcSource(a.defaultCalcSource),this.epe()},g.prototype.sve=function(){var t,n,n,t=[],n=this.Vv;n&&(t.push.apply(t,n.getCustomNames()),n=(0,c.Kde)(n))&&t.push.apply(t,n.getCustomNames()),this.li.setCustomNames(t)},g.prototype.ope=function(){var t,n,t=this,n=t.rpe();t.li.setActiveCellInfo(n),t.Xde(),t.Ove(),t.li.clearHistory(),t.epe()},g.prototype.Ove=function(){var t=(0,c.Kde)(this.Vv);t?this.li.setReadOnly(w(t,t.getActiveRowIndex(),t.getActiveColumnIndex())):this.li.setReadOnly(!1)},g.prototype.tpe=function(){var t,n,t=this.li.getActiveCellInfo(),n=this.rpe();return t.row!==n.row||t.col!==n.col},g.prototype.rpe=function(){var t,n,i,t=(0,c.Kde)(this.Vv);return t?{row:n=t.getActiveRowIndex(),col:i=t.getActiveColumnIndex()}:a.DEFAULT_ACTIVE_CELL_INFO},g.prototype.epe=function(){this.options.onActiveCellChanged&&this.options.onActiveCellChanged()},g.prototype.hve=function(t){var n,i,e,i,r,o,n=this,i=n.Qy.getShortcutKey(t.keyCode,t.ctrlKey,t.shiftKey,t.altKey,t.metaKey),e=n.Qy.getCommands(i);if(e)for(i={cmds:e,r:d},u.Worksheet.et(this.Vv.getActiveSheet(),"beforeExecuteShortcut",i),e=i.cmds,r=0;r<e.length;r++)if(o=e[r].execute(n,{}))return o.ignoreCancelDefault||u.mt.vi(t),!0},r.FormulaEditor=n=g,(0,u.$e)(n)},"./dist/plugins/formulaPanel/editor/formulaEditorCore.js":function(B,t,n){var i,e,r,o,u,s,a,f,h,c,l,v,d,y,m,p,k,g,w,b,M,x,S,C,_,F,N,U,H,z,W,V,$,q,j,P,G,J,K,O,E,A,D,R,I,T,Q,n,i,X,Z,Y;function tt(){return[e.basicSetup,Z,o.customFields,p.readOnlyExtension,y.themeExtension,h.foldExtension,c.indentExtension,u.syntaxHighlightingField,s.autoCompletionExtensions,a.hoverTooltipExtension,f.signatureTooltipsExtensions,v.doubleClickSelectRangeExtension,d.linterExtension]}function L(t,n){this.ipe=n,this.zQt=new Q({state:this.npe(""),parent:t})}Object.defineProperty(t,"__esModule",{value:!0}),t.FormulaEditorCore=void 0,i=n("Core"),e=n("./dist/plugins/formulaPanel/editor/codemirror/index.js"),r=n("./dist/plugins/formulaPanel/editor/interface.js"),o=n("./dist/plugins/formulaPanel/editor/featureProvider/customField.js"),u=n("./dist/plugins/formulaPanel/editor/featureProvider/syntaxHighlighting.js"),s=n("./dist/plugins/formulaPanel/editor/featureProvider/completion.js"),a=n("./dist/plugins/formulaPanel/editor/featureProvider/hoverTooltips.js"),f=n("./dist/plugins/formulaPanel/editor/featureProvider/signatureTooltips.js"),h=n("./dist/plugins/formulaPanel/editor/featureProvider/folding.js"),c=n("./dist/plugins/formulaPanel/editor/featureProvider/indent.js"),l=n("./dist/plugins/formulaPanel/editor/featureProvider/tab.js"),v=n("./dist/plugins/formulaPanel/editor/featureProvider/dbClickRangeSelector.js"),d=n("./dist/plugins/formulaPanel/editor/featureProvider/lint.js"),y=n("./dist/plugins/formulaPanel/editor/featureProvider/theme.js"),m=n("./dist/plugins/formulaPanel/editor/featureProvider/formatter.js"),p=n("./dist/plugins/formulaPanel/editor/featureProvider/readOnly.js"),k=n("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),g="gc-formula-editor-token-const-string",w="gc-formula-editor-token-const-number",b="gc-formula-editor-token-const-boolean",M="gc-formula-editor-token-const-error",x="gc-formula-editor-token-operator-prefix",S="gc-formula-editor-token-operator-infix",C="gc-formula-editor-token-operator-postfix",_="gc-formula-editor-token-function",F="gc-formula-editor-token-name",N="gc-formula-editor-token-reference-1",U="gc-formula-editor-token-reference-2",H="gc-formula-editor-token-reference-3",z="gc-formula-editor-token-reference-4",W="gc-formula-editor-token-reference-5",V="gc-formula-editor-token-reference-6",$="gc-formula-editor-token-reference-7",q="gc-formula-editor-token-argument-separator",j="gc-formula-editor-content",P="gc-formula-editor-gutters",G="gc-formula-editor-caret",J="gc-formula-editor-active-line",K="gc-formula-editor-selection",O="gc-formula-editor-tooltip-autocompletion-function",E="gc-formula-editor-tooltip-autocompletion-function-active-item",A="gc-formula-editor-tooltip-autocompletion-function-icon",D="gc-formula-editor-tooltip-autocompletion-function-name",R="gc-formula-editor-tooltip-autocompletion-function-description",I="gc-formula-editor-tooltip-error-message",T=i.I.fl,Q=e.View.EditorView,n=e.View.keymap,i=e.Commands.indentWithTab,X=e.Autocomplete.acceptCompletion,Z=n.of([{key:"Tab",run:X},{key:"Tab",run:l.insertTab},i]),L.prototype.getView=function(){return this.zQt},L.prototype.getText=function(){return this.zQt.state.doc.toJSON().join("\n")},L.prototype.setText=function(t){this.zQt.dispatch({changes:{from:0,to:this.zQt.state.doc.length,insert:t}})},L.prototype.getFunctions=function(){return(0,k.getFunctionsByState)(this.zQt.state)},L.prototype.getCustomNames=function(){return this.zQt.state.field(o.customNamesField)},L.prototype.setCustomNames=function(t){this.zQt.dispatch({effects:o.setCustomNamesField.of(t)})},L.prototype.getOptions=function(){return this.zQt.state.field(o.optionsField)},L.prototype.setOptions=function(t){this.zQt.dispatch({effects:o.setOptionsField.of(t)})},L.prototype.getReadOnly=function(){return this.zQt.state.readOnly},L.prototype.setReadOnly=function(t){t!==this.getReadOnly()&&(0,p.reconfigureReadOnly)(this.zQt,t)},L.prototype.getTheme=function(){return this.zQt.state.field(o.themeField)},L.prototype.setTheme=function(t){this.zQt.dispatch({effects:o.setThemeField.of(t)}),this.zQt.dispatch({effects:y.themeCompartment.reconfigure((0,y.createThemeExtension)(t))})},L.prototype.getCalcSource=function(){return this.zQt.state.field(o.calcSourceField)},L.prototype.setCalcSource=function(t){this.zQt.dispatch({effects:o.setCalcSourceField.of(t)})},L.prototype.getCalcService=function(){return this.zQt.state.field(o.calcServiceField)},L.prototype.setCalcService=function(t){this.zQt.dispatch({effects:o.setCalcServiceField.of(t)})},L.prototype.getActiveCellInfo=function(){return this.zQt.state.field(o.activeCellField)},L.prototype.setActiveCellInfo=function(t){this.zQt.dispatch({effects:o.setActiveCellField.of(t)})},L.prototype.getProvider=function(){return this.zQt.state.field(o.providerField)},L.prototype.setProvider=function(t){this.zQt.dispatch({effects:o.setProviderField.of(t)})},L.prototype.format=function(){(0,m.formatDocumentCommand)(this.zQt)},L.prototype.hasFocus=function(){return this.zQt.hasFocus},L.prototype.destroy=function(){this.zQt.destroy()},L.prototype.rebuildFormula=function(){this.zQt.dispatch({effects:o.rebuildFormulaEffect.of(!0)})},L.prototype.clearHistory=function(){var t,n,i,e,r,o,u,s,a,f,n,t=this,n=t.getText(),i=t.getTheme(),e=t.getOptions(),r=t.getCalcService(),o=t.getCalcSource(),u=t.getCustomNames(),s=t.getActiveCellInfo(),a=t.getProvider(),f=t.getReadOnly(),n=t.npe(n);t.zQt.setState(n),t.setTheme(i),t.setOptions(e),t.setCalcService(r),t.setCalcSource(o),t.setActiveCellInfo(s),t.setCustomNames(u),t.setProvider(a),t.setReadOnly(f)},L.prototype.initTheme=function(){var t,n,i,t=[{token:r.SyntaxHighlightingTokenType.stringConst,color:T(g).color},{token:r.SyntaxHighlightingTokenType.numberConst,color:T(w).color},{token:r.SyntaxHighlightingTokenType.booleanConst,color:T(b).color},{token:r.SyntaxHighlightingTokenType.errorConst,color:T(M).color},{token:r.SyntaxHighlightingTokenType.operatorPrefix,color:T(x).color},{token:r.SyntaxHighlightingTokenType.operatorInfix,color:T(S).color},{token:r.SyntaxHighlightingTokenType.operatorPostfix,color:T(C).color},{token:r.SyntaxHighlightingTokenType.function,color:T(_).color},{token:r.SyntaxHighlightingTokenType.name,color:T(F).color},{token:r.SyntaxHighlightingTokenType.argumentSeparator,color:T(q).color},{token:r.SyntaxHighlightingTokenType.reference,color:[T(N).color,T(U).color,T(H).color,T(z).color,T(W).color,T(V).color,T($).color]}],n={backgroundColor:T(j).backgroundColor,font:T(j).font,color:T(j).color,caretColor:T(G).color,selectionBackColor:T(K).backgroundColor,activeLineBackColor:T(J).backgroundColor,autocompletionStyle:{backgroundColor:T(O).backgroundColor,font:T(O).font,color:T(O).color,border:T(O).border,activeItem:{backgroundColor:T(E).backgroundColor,color:T(E).color},function_icon:{color:T(A).color,font:T(A).font},function_name:{color:T(D).color,font:T(D).font},function_description:{color:T(R).color,font:T(R).font}},errorStyle:{backgroundColor:T(I).backgroundColor,font:T(I).font,color:T(I).color}},i={backgroundColor:T(P).backgroundColor,font:T(P).font,color:T(P).color};this.setTheme({rules:t,editorContentStyle:n,editorGuttersStyle:i})},L.prototype.isFormattedFormula=function(){return this.zQt.state.field(o.isFormattedFormulaField)},L.prototype.npe=function(t){var n=tt().concat(this.ipe);return e.State.EditorState.create({extensions:n,doc:t})},t.FormulaEditorCore=L},"./dist/plugins/formulaPanel/editor/interface.js":function(t,n){var i,e,r,r;Object.defineProperty(n,"__esModule",{value:!0}),n.TokenType=n.SyntaxHighlightingTokenType=void 0,(r=i=n.SyntaxHighlightingTokenType||(n.SyntaxHighlightingTokenType={}))[r.subExpression=0]="subExpression",r[r.function=1]="function",r[r.argumentSeparator=2]="argumentSeparator",r[r.operatorPrefix=3]="operatorPrefix",r[r.operatorInfix=4]="operatorInfix",r[r.operatorPostfix=5]="operatorPostfix",r[r.stringConst=6]="stringConst",r[r.errorConst=7]="errorConst",r[r.numberConst=8]="numberConst",r[r.booleanConst=9]="booleanConst",r[r.name=10]="name",r[r.reference=11]="reference",r[r.whitespace=12]="whitespace",r[r.unknown=13]="unknown",(r=e=n.TokenType||(n.TokenType={}))[r.ErrorConst=0]="ErrorConst",r[r.LogicalConst=1]="LogicalConst",r[r.NumberConst=2]="NumberConst",r[r.StringConst=3]="StringConst",r[r.ArrayConstStart=4]="ArrayConstStart",r[r.ArrayConstEnd=5]="ArrayConstEnd",r[r.ArrayConstRowSeparator=6]="ArrayConstRowSeparator",r[r.ArrayConstItemSeparator=7]="ArrayConstItemSeparator",r[r.OperatorPrefix=8]="OperatorPrefix",r[r.OperatorInfix=9]="OperatorInfix",r[r.OperatorPostfix=10]="OperatorPostfix",r[r.FunctionName=11]="FunctionName",r[r.FunctionCallStart=12]="FunctionCallStart",r[r.FunctionCallEnd=13]="FunctionCallEnd",r[r.FunctionArgumentSeparator=14]="FunctionArgumentSeparator",r[r.SubExpressionStart=15]="SubExpressionStart",r[r.SubExpressionEnd=16]="SubExpressionEnd",r[r.CellReference=17]="CellReference",r[r.Name=18]="Name",r[r.FormulaStart=19]="FormulaStart",r[r.Whitespace=20]="Whitespace",r[r.Unknown=21]="Unknown"},"./dist/plugins/formulaPanel/editor/spreadFeatureProvider/formulaReferencedRangesContext.js":function(t,c,n){var i,l,e,r,o,v,u,s,d,a,f,h,y,m;function p(t){this.cmt=!0,this.rl=!1,this.Xvt=l.SelectionUnit.cell,this.Ivt=!1,this.xmt=!0,this.qMi=!1,this.XD=!1,this.umt=-1,this.zQt=t}function k(t){this.lve=t}function g(t){var n,i,i,n=(0,v.getActiveSheetByState)(t);n&&(b(i=e.Hde.Ude())&&(i.zde(n),n=(0,v.getActiveSheetByState)(t)),w(i=n.Bde))&&(i.dispose(),n.Bde=h,M(n.parent,!1))}function w(t){return t instanceof y}function b(t){return t instanceof m}function M(t,n){var i=function(t){t&&(t.rt.X6=n)};t.sheets.forEach(i),t.mp.forEach(function(t){i(t.Mf)})}function x(t,n){t.parent.e3(t,n=void 0===n?!0:n)}Object.defineProperty(c,"__esModule",{value:!0}),c.setWorkbookFocusStatus=c.isFormulaEditorReferencedRangesAcrossSheetContext=c.isFormulaEditorReferencedRangesContext=c.closeFormulaReferencedRanges=c.FormulaEditorReferencedRangesAcrossSheetContext=c.FormulaEditorReferencedRangesContext=c.appendingRangeAnnotation=void 0,i=n("Common"),l=n("Core"),e=n("FormulaTextBox"),r=n("./dist/plugins/formulaPanel/editor/codemirror/index.js"),o=n("./dist/plugins/formulaPanel/editor/common/calcUtil.js"),v=n("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),u=n("./dist/plugins/formulaPanel/editor/common/util.js"),s=n("./dist/plugins/formulaPanel/editor/featureProvider/customField.js"),d=n("./dist/plugins/formulaPanel/editor/featureProvider/signatureTooltips.js"),a=n("./dist/plugins/formulaPanel/editor/featureProvider/syntaxHighlighting.js"),f=n("./dist/plugins/formulaPanel/editor/formulaEditor-action.js"),h=void 0,c.appendingRangeAnnotation=r.State.Annotation.define(),p.prototype.smt=function(){var t,n,i,e,r,t;if(!this.isFormula())return[];for(t=this.zQt.state,n=(0,v.getTokensByState)(t),(0,a.markReferenceTokenColorIndex)(n,t),i=[],e=0;e<n.length;e++)r=n[e],((0,o.isReferenceToken)(r)||(0,o.isNameToken)(r)&&(0,o.hasReferenceRanges)(r))&&i.push({index:i.length,textOffset:r.index,text:r.text,ranges:r.ranges,allowDrag:r.canDrag,sheetArea:l.SheetArea.viewport,tag:{colorIndex:r.colorIndex}});return(t=this.Fvt)&&i.push({textOffset:-1,text:"",ranges:[t],index:i.length,allowDrag:!1,isPivotClickCell:!0,tag:{colorIndex:0}}),i},p.prototype.pmt=function(t){var n,n,t,n=(0,v.getReferenceTokenColors)(this.zQt.state),t=this.smt()[t];return n[(null==(n=null==t?void 0:t.tag)?void 0:n.colorIndex)||0]},p.prototype.ymt=function(t){var n=this.zQt.state.selection.main.head;return t.textOffset<=n&&t.textOffset+t.text.length>=n},p.prototype.bmt=function(t){var n,i;return!!this.XD&&(n=this.zQt.state.selection.main.head,i=this.umt,t.textOffset>=i)&&t.textOffset+t.text.length<=n},p.prototype.Qvt=function(){return l.SheetArea.viewport},p.prototype.Dvt=function(){var t,t,t=this.zQt.state;return!t.readOnly&&(!(!this.XD&&!(0,l.Df)(this.text()))||!!this.isFormula()&&!!(t=(0,o.getTokenByPos)((0,v.getTokensByState)(t),(0,v.getSelection)(t).from-1))&&((0,o.isFormulaStartToken)(t)||(0,o.isFunctionCallStartToken)(t)||(0,o.isSubExpressionStartToken)(t)||(0,o.isFunctionArgumentSeparator)(t)||(0,o.isLeftParenthesesToken)(t)||(0,o.isInfixOperatorToken)(t)||(0,o.isPrefixOperatorToken)(t)||(0,o.isWhitespaceToken)(t)))},p.prototype.text=function(){return(0,v.getTextByState)(this.zQt.state)},p.prototype.caret=function(){return this.zQt.state.selection.main.head},p.prototype.close=function(){},p.prototype.mmt=function(){},p.prototype.Vde=function(t,n){var i,e,t,r,t,o;n&&(i=this.zQt,t=(e=this.smt())[t])&&(t=(r=t.textOffset)+t.text.length,o=r+n.length,i.dispatch({changes:{from:r,to:t,insert:n},selection:{anchor:o,head:o},annotations:d.notTriggerSignatureTooltip.of(!0)}))},p.prototype.Gvt=function(t,n,i,e,r){var r,o,u,s,a,f,f,h;if(void 0===r&&(r=l.SheetArea.viewport),t){if(u=(o=(r=this).zQt).state,!r.XD){if(!r.Dvt())return;r.XD=!(n=!1),r.umt=(0,v.getSelection)(u).from}s=r.umt,a=(0,v.getSelection)(u).to,f=(0,v.getTokensByState)(u),f=(0,v.getValidReferenceTokenByPos)(f,a,u),i?(h=s+t.length,o.dispatch({changes:{from:s,to:a,insert:t},selection:{anchor:h,head:h},annotations:[c.appendingRangeAnnotation.of(!0),d.notTriggerSignatureTooltip.of(!0)]})):n?f&&f.index>=s&&a>=f.index&&(h=f.index+t.length,o.dispatch({changes:{from:f.index,to:a,insert:t},selection:{anchor:h,head:h},annotations:[c.appendingRangeAnnotation.of(!0),d.notTriggerSignatureTooltip.of(!0)]})):(h=a+(t=s<a?r.fgt()+t:t).length,o.dispatch({changes:{from:a,to:a,insert:t},selection:{anchor:h,head:h},annotations:[c.appendingRangeAnnotation.of(!0),d.notTriggerSignatureTooltip.of(!0)]}))}},p.prototype.qD=function(){var t=this;t.XD&&(t.XD=!1,t.umt=-1)},p.prototype.onRangeMoved=function(){},p.prototype.onRangeResized=function(){},p.prototype.onRangeAppend=function(){},p.prototype.fgt=function(){var t=i.Common.CultureManager.Fe().NumberFormat;return t&&t.listSeparator||u.COMMA},p.prototype.cve=function(){return this.zQt.state.field(s.calcSourceField).Mf},p.prototype.fve=function(){return this.zQt.state.field(s.activeCellField)},p.prototype.isFormula=function(){return this.zQt.state.field(s.isFormulaField)},p.prototype.Ak=function(t){t&&(this.Dmt=[t])},p.prototype.Hce=function(){this.Dmt=h},p.prototype.Ymt=function(){return this.Dmt},p.prototype.dispose=function(){this.zQt=h},p.prototype.dve=function(){var t=this.zQt;t&&(g(t.state),t.hasFocus&&t.contentDOM.blur(),this.dispose())},y=p,c.FormulaEditorReferencedRangesContext=y,Object.defineProperty(k.prototype,"Ivt",{get:function(){return this.lve.Ivt},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"Mf",{get:function(){return this.lve.cve()},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"_text",{get:function(){return this.lve.text()},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"bZ",{get:function(){return this.lve.fve().row},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"mvt",{get:function(){return this.lve.fve().col},enumerable:!1,configurable:!0}),k.prototype.zde=function(t){var n,i,e,r,o,n=!1,i=this.Mf,e=this.bZ,r=this.mvt,o=this._text;return i!==t&&(x(i),n=!0),(0,f.executeCommitContextToCellCommand)(i,e,r,o),this.d5(),n},k.prototype.d5=function(){this.lve=h,e.Hde.DJ=h},m=k,c.FormulaEditorReferencedRangesAcrossSheetContext=m,c.closeFormulaReferencedRanges=g,c.isFormulaEditorReferencedRangesContext=w,c.isFormulaEditorReferencedRangesAcrossSheetContext=b,c.setWorkbookFocusStatus=M},"./dist/plugins/formulaPanel/editor/spreadFeatureProvider/formulaReferencedRangesExtension.js":function(t,n,i){var o,e,u,s,a,f,i,e;function h(t,n,i){var e=i.parent;t&&t.zQt===n||(i.Bde=new a.FormulaEditorReferencedRangesContext(n),(0,a.setWorkbookFocusStatus)(e,i.Bde.Dvt()))}function c(t,n,i){var i;(0,a.isFormulaEditorReferencedRangesContext)(t)&&(i=i.parent,r(t,n,i)?(0,a.closeFormulaReferencedRanges)(n.state):document.activeElement!==n.contentDOM&&setTimeout(function(){n.focus()},10))}function r(t,n,i){var e=document.activeElement;return e!==n.contentDOM&&!(e.hasAttribute("data-gc-formula-editor-additional-element")||t.Dvt()&&i&&i.Ti&&i.Ti.contains(e))}function l(t,n){var n,i;v(t.keyCode)&&(i=(n=(0,u.getActiveSheetByState)(n.state))&&n.Bde,(0,a.isFormulaEditorReferencedRangesContext)(i))&&n.rt.yk(t)}function v(t){return 16===t||17===t||18===t}function d(t,n){var i,e,r,i=n.oldSheet,e=n.newSheet;i&&e&&i!==e&&(r=i.Bde,(0,a.isFormulaEditorReferencedRangesContext)(r))&&(r.Dvt()||o.Hde.DJ)&&(n.needTriggerSheetChange=!1,e.Bde=r,i.Bde=f)}function y(t,n){var i,n,i,i,i=n.oldSheet,n=n.newSheet;if(n&&!n.xT&&i!==n&&(i=n.Bde,(0,a.isFormulaEditorReferencedRangesContext)(i))&&(i.Dvt()||o.Hde.DJ))return i.cve()!==n?o.Hde.DJ=new a.FormulaEditorReferencedRangesAcrossSheetContext(i):(i=o.Hde.DJ,(0,a.isFormulaEditorReferencedRangesAcrossSheetContext)(i)&&(i.d5(),o.Hde.DJ=f)),(0,s.paintFormulaReferencedRanges)(n),!0}Object.defineProperty(n,"__esModule",{value:!0}),n.uve=n.ave=n.isMetaKeyForAppendingRange=n.formulaReferencedRangesExtension=void 0,o=i("FormulaTextBox"),e=i("./dist/plugins/formulaPanel/editor/codemirror/index.js"),u=i("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),s=i("./dist/plugins/formulaPanel/editor/formulaEditor-spreadjs.js"),a=i("./dist/plugins/formulaPanel/editor/spreadFeatureProvider/formulaReferencedRangesContext.js"),f=void 0,i=e.View.EditorView.updateListener.of(function(t){var n,i,e,r,n=(0,u.getActiveSheetByState)(t.state);n&&(i=n.parent,e=n.Bde,r=o.Hde.Ude(),!e&&(0,a.isFormulaEditorReferencedRangesAcrossSheetContext)(r)&&(e=r.lve),t.focusChanged?((t.view.hasFocus?h:c)(e,t.view,n),(0,s.paintFormulaReferencedRanges)(n)):(t.selectionSet||t.docChanged)&&e&&(t.transactions.some(function(t){return!t.annotation(a.appendingRangeAnnotation)})&&e.qD(),(0,a.setWorkbookFocusStatus)(i,e.Dvt()),(0,s.paintFormulaReferencedRanges)(n)))}),e=e.View.ViewPlugin.define(function(){return null},{eventHandlers:{keydown:l,keyup:l}}),n.formulaReferencedRangesExtension=[i,e],n.isMetaKeyForAppendingRange=v,n.ave=d,n.uve=y},"./dist/plugins/formulaPanel/editor/spreadFeatureProvider/structReferences.js":function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.getStructReferencesByWorkbook=void 0;var u=i("CalcEngine");function e(t){return t?r(t).concat(s(t)):[]}function r(t){var i=[];return t.sheets.forEach(function(t){var n;(t.tables&&t.tables.all()||[]).forEach(function(t){i.push({name:t.name(),description:(0,u.sR)().Fbx_TableName_Description+t.name(),getColumns:function(){return o(t)}})})}),i}function o(t){for(var i,n,e,r,o,i=[],n=0,e="";null!==e;)e=t.getColumnName(n),n++,null!==e&&i.push({name:e,description:""});return r=(0,u.sR)().d2t,o=(0,u.getMapping)()&&(0,u.getMapping)().tableFunctionsMapping,Object.keys(r).forEach(function(t){var t=r[t],n=t.name,t=t.description,n=o&&o[n]||n;i.push({name:n,description:t})}),i}function s(t){var n=[];return t.mp.forEach(function(t){n.push({name:t.name(),description:(0,u.sR)().Fbx_TableSheetName_Description+t.name(),getColumns:function(){return a(t)}})}),n}function a(t){for(var n,i,e,n=[],i=t.getColumnCount(),e=0;e<i;e++)n.push({name:t.getColumnName(e),description:""});return n}n.getStructReferencesByWorkbook=e},"./dist/plugins/formulaPanel/formulaPanel.entry.js":function(t,n,i){var e,r,o,u,s,a,f,h,c,e=this&&this.__createBinding||(Object.create?function(t,n,i,e){void 0===e&&(e=i);var r=Object.getOwnPropertyDescriptor(n,i);r&&("get"in r?n.__esModule:!r.writable&&!r.configurable)||(r={enumerable:!0,get:function(){return n[i]}}),Object.defineProperty(t,e,r)}:function(t,n,i,e){t[e=void 0===e?i:e]=n[i]}),r=this&&this.__exportStar||function(t,n){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(n,i)||e(n,t,i)};Object.defineProperty(n,"__esModule",{value:!0}),n.findControl=n.vve=n.Commands=n.FormulaEditor=void 0,o=i("Core"),i("./dist/plugins/formulaPanel/editor/formulaEditor-spreadjs.js"),i("./dist/plugins/formulaPanel/editor/formulaEditor-action.js"),u=i("./dist/plugins/formulaPanel/editor/formulaEditor.js"),s=i("./dist/plugins/formulaPanel/editor/featureProvider/lint.js"),a=i("./dist/plugins/formulaPanel/editor/common/formatter.js"),f=i("./dist/plugins/formulaPanel/editor/formulaEditor.js"),Object.defineProperty(n,"FormulaEditor",{enumerable:!0,get:function(){return f.FormulaEditor}}),h=i("./dist/plugins/formulaPanel/editor/formulaEditor-action.js"),Object.defineProperty(n,"Commands",{enumerable:!0,get:function(){return h.Commands}}),n.vve={mve:s.getDiagnostic,I5:a.format},r(i("./dist/plugins/formulaPanel/editor/editor.ns.js"),n),n.findControl=c=function(t){return"string"==typeof t&&(t=document.getElementById(t)),(0,o.GC$)(t).data(u.CONST_FORMULA_EDITOR)}},Common:function(t){t.exports=n.Spread},CalcEngine:function(t){t.exports=n.Spread.CalcEngine},Core:function(t){t.exports=n.Spread.Sheets},SheetsCalc:function(t){t.exports=n.Spread.Sheets.CalcEngine},FormulaTextBox:function(t){t.exports=n.Spread.Sheets.FormulaTextBox}},e={},t=r("./dist/plugins/formulaPanel/formulaPanel.entry.js"),(((n=void 0===n?{}:n).Spread=n.Spread||{}).Sheets=n.Spread.Sheets||{}).FormulaPanel=t}(),n.Spread.Common.CultureManager.reloadResources&&n.Spread.Common.CultureManager.reloadResources("FormulaPanel")});
12
+ !function(t){"object"==typeof module&&"object"==typeof module.exports?module.exports=t(require("@grapecity-software/spread-sheets")):"function"==typeof define&&define.amd?define(["@grapecity-software/spread-sheets"],t):"object"==typeof exports?exports.Spread=t(require("@grapecity-software/spread-sheets")):t(GC)}((function(t){!function(){"use strict";var n,i={"./dist/plugins/formulaPanel/editor/codemirror/index.js":function(t,n){var i,e,r,o,u,s,a,f,h,c,l,v,d,y,m,p,k,g,w,b,M,x,S,C,j,P,O,E,A,D,R,I,T,L,B,_,F,N,U,H,z,W,V,$,q,G,J,K,Q,X,Z,Y,tt,nt,it,et,rt,ot,ut,st,at,ft,ht,ct,lt,vt,dt,yt,mt,pt,kt,gt,wt,bt,Mt,xt,St,Ct,jt,Pt,Ot,Et,At,Dt,Rt,It,Tt,Lt,Bt,_t,Ft,Nt,Ut,Ht,zt,Wt,Vt,$t,qt,Gt,Jt,Kt,Qt,Xt,Zt,Yt,tn,nn,en,rn,on,un,sn,an,fn,hn,cn,ln,vn,dn,yn,mn,pn,kn,gn,wn,bn,Mn,xn,Sn,Cn,jn,Pn,On,En,An,Dn,Rn,In,Tn,Ln,Bn,_n,Fn,Nn,Un,Hn,zn,Wn,Vn,$n,qn,Gn,Jn,Kn,Qn,Xn,Zn,Yn,ti,ni,ii,ei,ri,oi,ui,si,ai,fi,hi,ci,li,vi,di,yi,mi,pi,ki,gi,wi,bi,Mi,xi,Si,Ci,ji,Pi,Oi,Ei,Ai,Di,Ri,Ii,Ti,Li,Bi,_i,Fi,Ni,Ui,Hi,zi,Wi,Vi,$i,qi,Gi,Ji,Ki,Qi,Xi,Zi,Yi,te,ne,ie,ee,re,oe,ue,se,ae,fe,he,ce,le,ve,de,ye,me,pe,ke,ge,we,be,Me,xe,Se,Ce,je,Pe,Oe,Ee,Ae,De,Re,Ie,Te,Le,Be,_e,Fe,Ne,Ue,He,ze,We,Ve,$e,qe,Ge,Je,Ke,Qe,Xe,Ze,Ye,tr,nr,ir,er,rr,or,ur,sr,ar,fr,hr,cr,lr,vr,dr,yr,mr,pr,kr,gr,wr,br,Mr,xr,Sr,Cr,jr,Pr,Or,Er,Ar,Dr,Rr,Ir,Tr,Lr,Br,_r,Fr,Nr,Ur,Hr,zr,Wr,Vr,$r,qr,Gr,Jr,Kr,Qr,Xr,Zr,Yr,to,no,io,eo,ro,oo,uo,so,ao,fo,ho,co,lo,vo,yo,mo,po,ko,go,wo,bo,Mo,xo,So,Co,jo,Po,Oo,Eo,Ao,Do,Ro,Io,To,Lo,Bo,_o,Fo,No,Uo,Ho,zo,Wo,Vo,$o,qo,Go,Jo,Ko,Qo,Xo,Zo,Yo,tu,nu,iu,eu,ru,ou,uu,su,au,fu,hu,cu,lu,vu,du,yu,mu,pu,ku,gu,wu,bu,Mu,xu,Su,Cu,ju,Pu,Ou,Eu,Au,Du,Ru,Iu,Tu,Lu,Bu,_u,Fu,Nu,Uu,Hu,zu,Wu,Vu,$u,qu,Gu,Ju,Ku,Qu,Xu,Zu,Yu,ts,ns,is,es,rs,os,us,ss,as,fs,hs,cs,ls,vs,ds,ys,ms,ps,ks,gs,ws,bs,Ms,xs,Ss,Cs,js,Ps,Os,Es,As,Ds,Rs,Is,Ts,Ls,Bs,_s,Fs,Ns,Us,Hs,zs,Ws,Vs,$s,qs,Gs,Js,Ks,Qs,Xs,Zs,Ys,ta,na,ia,ea,ra,oa,ua,sa,aa,fa,ha,ca,la,va,da,ya,ma,pa,ka,ga,wa,ba,Ma,xa,Sa,Ca,ja,Pa,Oa,Ea,Aa,Da,Ra,Ia,Ta,La,Ba,_a,Fa,Na,Ua,Ha,za,Wa,Va,$a,qa,Ga,Ja,Ka,Qa,Xa,Za,Ya,tf,nf,ef,rf,of,uf,sf,af,ff,hf,cf,lf,vf,df,yf,mf,pf,kf,gf,wf,bf,Mf,xf,Sf,Cf,jf,Pf,Of,Ef,Af,Df,Rf,If,Tf,Lf,Bf,_f,Ff,Nf,Uf,Hf,zf,Wf,Vf,$f,qf,Gf,Jf,Kf,Qf,Xf,Zf,Yf,th,nh,ih,eh,rh,oh,uh,sh,ah,fh,hh,ch,lh,vh,dh,yh,mh,ph,kh,gh,wh,bh,Mh,xh,Sh,Ch,jh,Ph,Oh,Eh,Ah,Dh,Rh,Ih,Th,Lh,Bh,_h,Fh,Nh,Uh,Hh,zh,Wh,Vh,$h,qh;function Gh(t,n,i){return(n=kc(n))in t?Object.defineProperty(t,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[n]=i,t}function Jh(t){return Xh(t)||Qh(t)||ec(t)||Kh()}function Kh(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Qh(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function Xh(t){if(Array.isArray(t))return rc(t)}function Zh(t,n){return nc(t)||tc(t,n)||ec(t,n)||Yh()}function Yh(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function tc(t,n){var i,e,r,o,u,s,a,f=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=f){u=[],s=!0,a=!1;try{if(r=(f=f.call(t)).next,0===n){if(Object(f)!==f)return;s=!1}else for(;!(s=(i=r.call(f)).done)&&(u.push(i.value),u.length!==n);s=!0);}catch(t){a=!0,e=t}finally{try{if(!s&&null!=f.return&&(o=f.return(),Object(o)!==o))return}finally{if(a)throw e}}return u}}function nc(t){if(Array.isArray(t))return t}function ic(t,n){var i,e,r,o,u,s="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!s){if(Array.isArray(t)||(s=ec(t))||n&&t&&"number"==typeof t.length)return s&&(t=s),i=0,{s:e=function t(){},n:function n(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function t(n){throw n},f:e};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return r=!0,o=!1,{s:function n(){s=s.call(t)},n:function t(){var n=s.next();return r=n.done,n},e:function t(n){o=!0,u=n},f:function t(){try{r||null==s.return||s.return()}finally{if(o)throw u}}}}function ec(t,n){if(t){if("string"==typeof t)return rc(t,n);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?rc(t,n):void 0}}function rc(t,n){(null==n||n>t.length)&&(n=t.length);for(var i=0,e=new Array(n);i<n;i++)e[i]=t[i];return e}function oc(){return oc="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function t(n,i,e){var r,o=uc(n,i);if(o)return(r=Object.getOwnPropertyDescriptor(o,i)).get?r.get.call(arguments.length<3?n:e):r.value},oc.apply(this,arguments)}function uc(t,n){for(;!Object.prototype.hasOwnProperty.call(t,n)&&null!==(t=vc(t)););return t}function sc(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),n&&ac(t,n)}function ac(t,n){return ac=Object.setPrototypeOf?Object.setPrototypeOf.bind():function t(n,i){return n.__proto__=i,n},ac(t,n)}function fc(t){var n=lc();return function i(){var e,r,o=vc(t);return n?(r=vc(this).constructor,e=Reflect.construct(o,arguments,r)):e=o.apply(this,arguments),hc(this,e)}}function hc(t,n){if(n&&("object"===dc(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return cc(t)}function cc(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function lc(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function vc(t){return vc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function t(n){return n.__proto__||Object.getPrototypeOf(n)},vc(t)}function dc(t){return dc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},dc(t)}function yc(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function mc(t,n){var i,e;for(i=0;i<n.length;i++)(e=n[i]).enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(t,kc(e.key),e)}function pc(t,n,i){return n&&mc(t.prototype,n),i&&mc(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}function kc(t){var n=gc(t,"string");return"symbol"===dc(n)?n:String(n)}function gc(t,n){var i,e;if("object"!==dc(t)||null===t)return t;if(void 0!==(i=t[Symbol.toPrimitive])){if("object"!==dc(e=i.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(t)}function wc(t){var n,i,e=-1,r=ic(t);try{for(r.s();!(n=r.n()).done;)e+=(i=n.value).length+1}catch(t){r.e(t)}finally{r.f()}return e}function bc(t,n){var i,e,r,o,u,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1e9;for(i=0,e=0,r=!0;e<t.length&&i<=a;e++)(u=i+(o=t[e]).length)>=s&&(u>a&&(o=o.slice(0,a-i)),i<s&&(o=o.slice(s-i)),r?(n[n.length-1]+=o,r=!1):n.push(o)),i=u+1;return n}function Mc(t,n,i){return bc(t,[""],n,i)}for(Object.defineProperty(n,"__esModule",{value:!0}),n.basicSetup=n.View=n.State=n.Search=n.Lint=n.Language=n.Commands=n.Autocomplete=void 0,i=function(){function t(){yc(this,t)}return pc(t,[{key:"lineAt",value:function t(n){if(n<0||n>this.length)throw new RangeError("Invalid position ".concat(n," in document of length ").concat(this.length));return this.lineInner(n,!1,1,0)}},{key:"line",value:function t(n){if(n<1||n>this.lines)throw new RangeError("Invalid line number ".concat(n," in ").concat(this.lines,"-line document"));return this.lineInner(n,!0,1,0)}},{key:"replace",value:function t(n,i,e){var o=[];return this.decompose(0,n,o,2),e.length&&e.decompose(0,e.length,o,3),this.decompose(i,this.length,o,1),r.from(o,this.length-(i-n)+e.length)}},{key:"append",value:function t(n){return this.replace(this.length,this.length,n)}},{key:"slice",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.length,e=[];return this.decompose(n,i,e,0),r.from(e,i-n)}},{key:"eq",value:function t(n){var i,e,r,u,s,a;if(n==this)return!0;if(n.length!=this.length||n.lines!=this.lines)return!1;for(i=this.scanIdentical(n,1),e=this.length-this.scanIdentical(n,-1),r=new o(this),u=new o(n),s=i,a=i;;){if(r.next(s),u.next(s),s=0,r.lineBreak!=u.lineBreak||r.done!=u.done||r.value!=u.value)return!1;if(a+=r.value.length,r.done||a>=e)return!0}}},{key:"iter",value:function t(){var n;return new o(this,arguments.length>0&&void 0!==arguments[0]?arguments[0]:1)}},{key:"iterRange",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.length;return new u(this,n,i)}},{key:"iterLines",value:function t(n,i){var e,r;return null==n?e=this.iter():(null==i&&(i=this.lines+1),r=this.line(n).from,e=this.iterRange(r,Math.max(r,i==this.lines+1?this.length:i<=1?0:this.line(i-1).to))),new s(e)}},{key:"toString",value:function t(){return this.sliceString(0)}},{key:"toJSON",value:function t(){var n=[];return this.flatten(n),n}}],[{key:"of",value:function n(i){if(0==i.length)throw new RangeError("A document must have at least one line");return 1!=i.length||i[0]?i.length<=32?new e(i):r.from(e.split(i,[])):t.empty}}]),t}(),e=function(t){sc(i,t);var n=fc(i);function i(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:wc(t);return yc(this,i),(e=n.call(this)).text=t,e.length=r,e}return pc(i,[{key:"lines",get:function t(){return this.text.length}},{key:"children",get:function t(){return null}},{key:"lineInner",value:function t(n,i,e,r){var o,u,s;for(o=0;;o++){if(s=r+(u=this.text[o]).length,(i?e:s)>=n)return new a(r,s,e,u);r=s+1,e++}}},{key:"decompose",value:function t(n,e,r,o){var u,s,a,f=n<=0&&e>=this.length?this:new i(Mc(this.text,n,e),Math.min(e,this.length)-Math.max(0,n));1&o?(u=r.pop(),(s=bc(f.text,u.text.slice(),0,f.length)).length<=32?r.push(new i(s,u.length+f.length)):(a=s.length>>1,r.push(new i(s.slice(0,a)),new i(s.slice(a))))):r.push(f)}},{key:"replace",value:function t(n,e,o){var u,s;return o instanceof i?(u=bc(this.text,bc(o.text,Mc(this.text,0,n)),e),s=this.length+o.length-(e-n),u.length<=32?new i(u,s):r.from(i.split(u,[]),s)):oc(vc(i.prototype),"replace",this).call(this,n,e,o)}},{key:"sliceString",value:function t(n){var i,e,r,o,u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.length,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"\n",a="";for(i=0,e=0;i<=u&&e<this.text.length;e++)i>n&&e&&(a+=s),n<(o=i+(r=this.text[e]).length)&&u>i&&(a+=r.slice(Math.max(0,n-i),u-i)),i=o+1;return a}},{key:"flatten",value:function t(n){var i,e,r=ic(this.text);try{for(r.s();!(i=r.n()).done;)e=i.value,n.push(e)}catch(t){r.e(t)}finally{r.f()}}},{key:"scanIdentical",value:function t(){return 0}}],[{key:"split",value:function t(n,e){var r,o,u=[],s=-1,a=ic(n);try{for(a.s();!(r=a.n()).done;)o=r.value,u.push(o),s+=o.length+1,32==u.length&&(e.push(new i(u,s)),u=[],s=-1)}catch(t){a.e(t)}finally{a.f()}return s>-1&&e.push(new i(u,s)),e}}]),i}(i),r=function(t){sc(i,t);var n=fc(i);function i(t,e){var r,o,u,s;yc(this,i),(r=n.call(this)).children=t,r.length=e,r.lines=0,o=ic(t);try{for(o.s();!(u=o.n()).done;)s=u.value,r.lines+=s.lines}catch(t){o.e(t)}finally{o.f()}return r}return pc(i,[{key:"lineInner",value:function t(n,i,e,r){var o,u,s,a;for(o=0;;o++){if(s=r+(u=this.children[o]).length,a=e+u.lines-1,(i?a:s)>=n)return u.lineInner(n,i,e,r);r=s+1,e=a+1}}},{key:"decompose",value:function t(n,i,e,r){var o,u,s,a,f;for(o=0,u=0;u<=i&&o<this.children.length;o++)n<=(a=u+(s=this.children[o]).length)&&i>=u&&(f=r&((u<=n?1:0)|(a>=i?2:0)),u>=n&&a<=i&&!f?e.push(s):s.decompose(n-u,i-u,e,f)),u=a+1}},{key:"replace",value:function t(n,e,r){var o,u,s,a,f,h,c;if(r.lines<this.lines)for(o=0,u=0;o<this.children.length;o++){if(a=u+(s=this.children[o]).length,n>=u&&e<=a)return f=s.replace(n-u,e-u,r),h=this.lines-s.lines+f.lines,f.lines<h>>4&&f.lines>h>>6?((c=this.children.slice())[o]=f,new i(c,this.length-(e-n)+r.length)):oc(vc(i.prototype),"replace",this).call(this,u,a,f);u=a+1}return oc(vc(i.prototype),"replace",this).call(this,n,e,r)}},{key:"sliceString",value:function t(n){var i,e,r,o,u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.length,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"\n",a="";for(i=0,e=0;i<this.children.length&&e<=u;i++)e>n&&i&&(a+=s),n<(o=e+(r=this.children[i]).length)&&u>e&&(a+=r.sliceString(n-e,u-e,s)),e=o+1;return a}},{key:"flatten",value:function t(n){var i,e,r=ic(this.children);try{for(r.s();!(i=r.n()).done;)(e=i.value).flatten(n)}catch(t){r.e(t)}finally{r.f()}}},{key:"scanIdentical",value:function t(n,e){var r,o,u,s,a,f,h,c,l;if(!(n instanceof i))return 0;for(r=0,s=(u=Zh(o=e>0?[0,0,this.children.length,n.children.length]:[this.children.length-1,n.children.length-1,-1,-1],4))[0],a=u[1],f=u[2],h=u[3];;s+=e,a+=e){if(s==f||a==h)return r;if((c=this.children[s])!=(l=n.children[a]))return r+c.scanIdentical(l,e);r+=c.length+1}}}],[{key:"from",value:function t(n){var r,o,u,s,a,f,h,c,l,v,d,y,m,p,k,g,w=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.reduce((function(t,n){return t+n.length+1}),-1),b=0,M=ic(n);try{for(M.s();!(r=M.n()).done;)b+=(o=r.value).lines}catch(t){M.e(t)}finally{M.f()}if(b<32){u=[],s=ic(n);try{for(s.s();!(a=s.n()).done;)(f=a.value).flatten(u)}catch(t){s.e(t)}finally{s.f()}return new e(u,w)}function x(t){var n,r,o,u;if(t.lines>c&&t instanceof i){r=ic(t.children);try{for(r.s();!(o=r.n()).done;)x(u=o.value)}catch(t){r.e(t)}finally{r.f()}}else t.lines>l&&(d>l||!d)?(S(),v.push(t)):t instanceof e&&d&&(n=m[m.length-1])instanceof e&&t.lines+n.lines<=32?(d+=t.lines,y+=t.length+1,m[m.length-1]=new e(n.text.concat(t.text),n.length+1+t.length)):(d+t.lines>h&&S(),d+=t.lines,y+=t.length+1,m.push(t))}function S(){0!=d&&(v.push(1==m.length?m[0]:i.from(m,y)),y=-1,d=m.length=0)}h=Math.max(32,b>>5),c=h<<1,l=h>>1,v=[],d=0,y=-1,m=[],p=ic(n);try{for(p.s();!(k=p.n()).done;)x(g=k.value)}catch(t){p.e(t)}finally{p.f()}return S(),1==v.length?v[0]:new i(v,w)}}]),i}(i),i.empty=new e([""],0),o=function(){function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;yc(this,t),this.dir=i,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[n],this.offsets=[i>0?1:(n instanceof e?n.text.length:n.children.length)<<1]}return pc(t,[{key:"nextInner",value:function t(n,i){var r,o,u,s,a,f,h;for(this.done=this.lineBreak=!1;;)if(r=this.nodes.length-1,o=this.nodes[r],s=(u=this.offsets[r])>>1,a=o instanceof e?o.text.length:o.children.length,s==(i>0?a:0)){if(0==r)return this.done=!0,this.value="",this;i>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((1&u)==(i>0?0:1)){if(this.offsets[r]+=i,0==n)return this.lineBreak=!0,this.value="\n",this;n--}else if(o instanceof e){if(f=o.text[s+(i<0?-1:0)],this.offsets[r]+=i,f.length>Math.max(0,n))return this.value=0==n?f:i>0?f.slice(n):f.slice(0,f.length-n),this;n-=f.length}else n>(h=o.children[s+(i<0?-1:0)]).length?(n-=h.length,this.offsets[r]+=i):(i<0&&this.offsets[r]--,this.nodes.push(h),this.offsets.push(i>0?1:(h instanceof e?h.text.length:h.children.length)<<1))}},{key:"next",value:function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return n<0&&(this.nextInner(-n,-this.dir),n=this.value.length),this.nextInner(n,this.dir)}}]),t}(),u=function(){function t(n,i,e){yc(this,t),this.value="",this.done=!1,this.cursor=new o(n,i>e?-1:1),this.pos=i>e?n.length:0,this.from=Math.min(i,e),this.to=Math.max(i,e)}return pc(t,[{key:"nextInner",value:function t(n,i){var e,r,o;return(i<0?this.pos<=this.from:this.pos>=this.to)?(this.value="",this.done=!0,this):((n+=Math.max(0,i<0?this.pos-this.to:this.from-this.pos))>(e=i<0?this.pos-this.from:this.to-this.pos)&&(n=e),e-=n,o=(r=this.cursor.next(n)).value,this.pos+=(o.length+n)*i,this.value=o.length<=e?o:i<0?o.slice(o.length-e):o.slice(0,e),this.done=!this.value,this)}},{key:"next",value:function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return n<0?n=Math.max(n,this.from-this.pos):n>0&&(n=Math.min(n,this.to-this.pos)),this.nextInner(n,this.cursor.dir)}},{key:"lineBreak",get:function t(){return this.cursor.lineBreak&&""!=this.value}}]),t}(),s=function(){function t(n){yc(this,t),this.inner=n,this.afterBreak=!0,this.value="",this.done=!1}return pc(t,[{key:"next",value:function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,i=this.inner.next(n),e=i.done,r=i.lineBreak,o=i.value;return e?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=o,this.afterBreak=!1),this}},{key:"lineBreak",get:function t(){return!1}}]),t}(),"undefined"!=typeof Symbol&&(i.prototype[Symbol.iterator]=function(){return this.iter()},o.prototype[Symbol.iterator]=u.prototype[Symbol.iterator]=s.prototype[Symbol.iterator]=function(){return this}),a=function(){function t(n,i,e,r){yc(this,t),this.from=n,this.to=i,this.number=e,this.text=r}return pc(t,[{key:"length",get:function t(){return this.to-this.from}}]),t}(),f="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map((function(t){return t?parseInt(t,36):1})),h=1;h<f.length;h++)f[h]+=f[h-1];function xc(t){for(var n=1;n<f.length;n+=2)if(f[n]>t)return f[n-1]<=t;return!1}function Sc(t){return t>=127462&&t<=127487}function Cc(t,n){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],e=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];return(i?jc:Pc)(t,n,e)}function jc(t,n,i){var e,r,o,u;if(n==t.length)return n;for(n&&Oc(t.charCodeAt(n))&&Ec(t.charCodeAt(n-1))&&n--,n+=Rc(e=Ac(t,n));n<t.length;)if(r=Ac(t,n),e==c||r==c||i&&xc(r))n+=Rc(r),e=r;else{if(!Sc(r))break;for(o=0,u=n-2;u>=0&&Sc(Ac(t,u));)o++,u-=2;if(o%2==0)break;n+=2}return n}function Pc(t,n,i){for(;n>0;){var e=jc(t,n-2,i);if(e<n)return e;n--}return 0}function Oc(t){return t>=56320&&t<57344}function Ec(t){return t>=55296&&t<56320}function Ac(t,n){var i,e=t.charCodeAt(n);return Ec(e)&&n+1!=t.length&&Oc(i=t.charCodeAt(n+1))?i-56320+(e-55296<<10)+65536:e}function Dc(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)))}function Rc(t){return t<65536?1:2}function Ic(t,n,i){var e,r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];0==n&&i<=0||((e=t.length-2)>=0&&i<=0&&i==t[e+1]?t[e]+=n:0==n&&0==t[e]?t[e+1]+=i:r?(t[e]+=n,t[e+1]+=i):t.push(n,i))}function Tc(t,n,e){if(0!=e.length){var r=n.length-2>>1;if(r<t.length)t[t.length-1]=t[t.length-1].append(e);else{for(;t.length<r;)t.push(i.empty);t.push(e)}}}function Lc(t,n,e){var r,o,u,s,a,f,h,c,l=t.inserted;for(r=0,o=0,u=0;u<t.sections.length;)if(s=t.sections[u++],(a=t.sections[u++])<0)r+=s,o+=s;else{for(f=r,h=o,c=i.empty;f+=s,h+=a,a&&l&&(c=c.append(l[u-2>>1])),!(e||u==t.sections.length||t.sections[u+1]<0);)s=t.sections[u++],a=t.sections[u++];n(r,f,o,h,c),r=f,o=h}}function Bc(t,n,i){var e,r,o,u,s,a,f,h=arguments.length>3&&void 0!==arguments[3]&&arguments[3],c=[],l=h?[]:null,v=new m(t),p=new m(n);for(e=-1;;)if(-1==v.ins&&-1==p.ins)Ic(c,r=Math.min(v.len,p.len),-1),v.forward(r),p.forward(r);else if(p.ins>=0&&(v.ins<0||e==v.i||0==v.off&&(p.len<v.len||p.len==v.len&&!i))){for(o=p.len,Ic(c,p.ins,-1);o;)u=Math.min(v.len,o),v.ins>=0&&e<v.i&&v.len<=u&&(Ic(c,0,v.ins),l&&Tc(l,c,v.text),e=v.i),v.forward(u),o-=u;p.next()}else{if(!(v.ins>=0)){if(v.done&&p.done)return l?y.createSet(c,l):d.create(c);throw new Error("Mismatched change set lengths")}for(s=0,a=v.len;a;)if(-1==p.ins)s+=f=Math.min(a,p.len),a-=f,p.forward(f);else{if(!(0==p.ins&&p.len<a))break;a-=p.len,p.next()}Ic(c,s,e<v.i?v.ins:0),l&&e<v.i&&Tc(l,c,v.text),e=v.i,v.forward(v.len-a)}}function _c(t,n){var i,e,r,o,u=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=[],a=u?[]:null,f=new m(t),h=new m(n);for(i=!1;;){if(f.done&&h.done)return a?y.createSet(s,a):d.create(s);if(0==f.ins)Ic(s,f.len,0,i),f.next();else if(0!=h.len||h.done){if(f.done||h.done)throw new Error("Mismatched change set lengths");e=Math.min(f.len2,h.len),r=s.length,-1==f.ins?(Ic(s,e,o=-1==h.ins?-1:h.off?0:h.ins,i),a&&o&&Tc(a,s,h.text)):-1==h.ins?(Ic(s,f.off?0:f.len,e,i),a&&Tc(a,s,f.textBit(e))):(Ic(s,f.off?0:f.len,h.off?0:h.ins,i),a&&!h.off&&Tc(a,s,h.text)),i=(f.ins>e||h.ins>=0&&h.len>e)&&(i||s.length>r),f.forward2(e),h.forward(e)}else Ic(s,0,h.ins,i),a&&Tc(a,s,h.text),h.next()}}function Fc(t,n){var i,e,r=ic(t.ranges);try{for(r.s();!(i=r.n()).done;)if((e=i.value).to>n)throw new RangeError("Selection points outside of document")}catch(t){r.e(t)}finally{r.f()}}function Nc(t,n){return t==n||t.length==n.length&&t.every((function(t,i){return t===n[i]}))}function Uc(t,n,i){if(t.length!=n.length)return!1;for(var e=0;e<t.length;e++)if(!i(t[e],n[e]))return!1;return!0}function Hc(t,n){var i,e,r=!1,o=ic(n);try{for(o.s();!(i=o.n()).done;)1&$c(t,e=i.value)&&(r=!0)}catch(t){o.e(t)}finally{o.f()}return r}function zc(t,n,i){var e=i.map((function(n){return t[n.id]})),r=i.map((function(t){return t.type})),o=e.filter((function(t){return!(1&t)})),u=t[n.id]>>1;function s(t){var i,o,u,s,a,f=[];for(i=0;i<e.length;i++)if(o=qc(t,e[i]),2==r[i]){u=ic(o);try{for(u.s();!(s=u.n()).done;)a=s.value,f.push(a)}catch(t){u.e(t)}finally{u.f()}}else f.push(o);return n.combine(f)}return{create:function t(n){var i,r,o=ic(e);try{for(o.s();!(i=o.n()).done;)$c(n,r=i.value)}catch(t){o.e(t)}finally{o.f()}return n.values[u]=s(n),1},update:function t(i,e){if(!Hc(i,o))return 0;var r=s(i);return n.compare(r,i.values[u])?0:(i.values[u]=r,1)},reconfigure:function t(r,o){var a,f=Hc(r,e),h=o.config.facets[n.id],c=o.facet(n);return h&&!f&&Nc(i,h)?(r.values[u]=c,0):(a=s(r),n.compare(a,c)?(r.values[u]=c,0):(r.values[u]=a,1))}}}function Wc(t){return function(n){return new A(n,t)}}function Vc(t,n,i){var e=[[],[],[],[],[]],r=new Map;function o(t,u){var s,a,f,h,c,l,v=r.get(t);if(null!=v){if(v<=u)return;(s=e[v].indexOf(t))>-1&&e[v].splice(s,1),t instanceof R&&i.delete(t.compartment)}if(r.set(t,u),Array.isArray(t)){a=ic(t);try{for(a.s();!(f=a.n()).done;)o(h=f.value,u)}catch(t){a.e(t)}finally{a.f()}}else if(t instanceof R){if(i.has(t.compartment))throw new RangeError("Duplicate use of compartment in extensions");c=n.get(t.compartment)||t.inner,i.set(t.compartment,c),o(c,u)}else if(t instanceof A)o(t.inner,t.prec);else if(t instanceof x)e[u].push(t),t.provides&&o(t.provides,u);else if(t instanceof b)e[u].push(t),t.facet.extensions&&o(t.facet.extensions,j);else{if(!(l=t.extension))throw new Error("Unrecognized extension value in extension set (".concat(t,"). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks."));o(l,u)}}return o(t,j),e.reduce((function(t,n){return t.concat(n)}))}function $c(t,n){var i,e,r;if(1&n)return 2;if(i=n>>1,4==(e=t.status[i]))throw new Error("Cyclic dependency between fields and/or facets");return 2&e?e:(t.status[i]=4,r=t.computeSlot(t,t.config.dynamicSlots[i]),t.status[i]=2|r)}function qc(t,n){return 1&n?t.config.staticValues[n>>1]:t.values[n>>1]}function Gc(t,n){var i,e,r,o,u=[];for(i=0,e=0;;){if(r=void 0,o=void 0,i<t.length&&(e==n.length||n[e]>=t[i]))r=t[i++],o=t[i++];else{if(!(e<n.length))return u;r=n[e++],o=n[e++]}!u.length||u[u.length-1]<r?u.push(r,o):u[u.length-1]<o&&(u[u.length-1]=o)}}function Jc(t,n,i){var e,r,o,u;return i?(r=n.changes,o=y.empty(n.changes.length),u=t.changes.compose(n.changes)):(r=n.changes.map(t.changes),o=t.changes.mapDesc(n.changes,!0),u=t.changes.compose(r)),{changes:u,selection:n.selection?n.selection.map(o):null===(e=t.selection)||void 0===e?void 0:e.map(r),effects:V.mapEffects(t.effects,r).concat(V.mapEffects(n.effects,o)),annotations:t.annotations.length?t.annotations.concat(n.annotations):n.annotations,scrollIntoView:t.scrollIntoView||n.scrollIntoView}}function Kc(t,n,i){var e=n.selection,r=Yc(n.annotations);return n.userEvent&&(r=r.concat($.userEvent.of(n.userEvent))),{changes:n.changes instanceof y?n.changes:y.of(n.changes||[],i,t.facet(B)),selection:e&&(e instanceof k?e:k.single(e.anchor,e.head)),effects:Yc(n.effects),annotations:r,scrollIntoView:!!n.scrollIntoView}}function Qc(t,n,i){var e,r,o,u=Kc(t,n.length?n[0]:{},t.doc.length);for(n.length&&!1===n[0].filter&&(i=!1),e=1;e<n.length;e++)!1===n[e].filter&&(i=!1),r=!!n[e].sequential,u=Jc(u,Kc(t,n[e],r?u.changes.newLength:t.doc.length),r);return o=$.create(t,u.changes,u.selection,u.effects,u.annotations,u.scrollIntoView),Zc(i?Xc(o):o)}function Xc(t){var n,i,e,r,o,u,s,a,f,h=t.startState,c=!0,l=ic(h.facet(_));try{for(l.s();!(n=l.n()).done;){if(!1===(e=(i=n.value)(t))){c=!1;break}Array.isArray(e)&&(c=!0===c?e:Gc(c,e))}}catch(t){l.e(t)}finally{l.f()}for(!0!==c&&(!1===c?(o=t.changes.invertedDesc,r=y.empty(h.doc.length)):(r=(u=t.changes.filter(c)).changes,o=u.filtered.mapDesc(u.changes).invertedDesc),t=$.create(h,r,t.selection&&t.selection.map(o),V.mapEffects(t.effects,o),t.annotations,t.scrollIntoView)),a=(s=h.facet(F)).length-1;a>=0;a--)t=(f=s[a](t))instanceof $?f:Array.isArray(f)&&1==f.length&&f[0]instanceof $?f[0]:Qc(h,Yc(f),!1);return t}function Zc(t){var n,i,e=t.startState,r=e.facet(N),o=t;for(n=r.length-1;n>=0;n--)(i=r[n](t))&&Object.keys(i).length&&(o=Jc(o,Kc(e,i,t.changes.newLength),!0));return o==t?t:$.create(e,t.changes,t.selection,o.effects,o.annotations,o.scrollIntoView)}function Yc(t){return null==t?q:Array.isArray(t)?t:[t]}c=8205,l=/\r\n?|\n/,v=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(v||(v={})),d=function(){function t(n){yc(this,t),this.sections=n}return pc(t,[{key:"length",get:function t(){var n,i=0;for(n=0;n<this.sections.length;n+=2)i+=this.sections[n];return i}},{key:"newLength",get:function t(){var n,i,e=0;for(n=0;n<this.sections.length;n+=2)e+=(i=this.sections[n+1])<0?this.sections[n]:i;return e}},{key:"empty",get:function t(){return 0==this.sections.length||2==this.sections.length&&this.sections[1]<0}},{key:"iterGaps",value:function t(n){var i,e,r,o,u;for(i=0,e=0,r=0;i<this.sections.length;)o=this.sections[i++],(u=this.sections[i++])<0?(n(e,r,o),r+=o):r+=u,e+=o}},{key:"iterChangedRanges",value:function t(n){var i;Lc(this,n,arguments.length>1&&void 0!==arguments[1]&&arguments[1])}},{key:"invertedDesc",get:function n(){var i,e,r,o=[];for(i=0;i<this.sections.length;)e=this.sections[i++],(r=this.sections[i++])<0?o.push(e,r):o.push(r,e);return new t(o)}},{key:"composeDesc",value:function t(n){return this.empty?n:n.empty?this:_c(this,n)}},{key:"mapDesc",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return n.empty?this:Bc(this,n,i)}},{key:"mapPos",value:function t(n){var i,e,r,o,u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:v.Simple,a=0,f=0;for(i=0;i<this.sections.length;){if(o=a+(e=this.sections[i++]),(r=this.sections[i++])<0){if(o>n)return f+(n-a);f+=e}else{if(s!=v.Simple&&o>=n&&(s==v.TrackDel&&a<n&&o>n||s==v.TrackBefore&&a<n||s==v.TrackAfter&&o>n))return null;if(o>n||o==n&&u<0&&!e)return n==a||u<0?f:f+r;f+=r}a=o}if(n>a)throw new RangeError("Position ".concat(n," is out of range for changeset of length ").concat(a));return f}},{key:"touchesRange",value:function t(n){var i,e,r,o,u,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;for(i=0,e=0;i<this.sections.length&&e<=s;){if(u=e+(r=this.sections[i++]),(o=this.sections[i++])>=0&&e<=s&&u>=n)return!(e<n&&u>s)||"cover";e=u}return!1}},{key:"toString",value:function t(){var n,i,e,r="";for(n=0;n<this.sections.length;)r+=(r?" ":"")+(i=this.sections[n++])+((e=this.sections[n++])>=0?":"+e:"");return r}},{key:"toJSON",value:function t(){return this.sections}}],[{key:"fromJSON",value:function n(i){if(!Array.isArray(i)||i.length%2||i.some((function(t){return"number"!=typeof t})))throw new RangeError("Invalid JSON representation of ChangeDesc");return new t(i)}},{key:"create",value:function n(i){return new t(i)}}]),t}(),y=function(t){sc(e,t);var n=fc(e);function e(t,i){var r;return yc(this,e),(r=n.call(this,t)).inserted=i,r}return pc(e,[{key:"apply",value:function t(n){if(this.length!=n.length)throw new RangeError("Applying change set to a document with the wrong length");return Lc(this,(function(t,i,e,r,o){return n=n.replace(e,e+(i-t),o)}),!1),n}},{key:"mapDesc",value:function t(n){var i;return Bc(this,n,arguments.length>1&&void 0!==arguments[1]&&arguments[1],!0)}},{key:"invert",value:function t(n){var r,o,u,s,a,f=this.sections.slice(),h=[];for(r=0,o=0;r<f.length;r+=2){if(u=f[r],(s=f[r+1])>=0){for(f[r]=s,f[r+1]=u,a=r>>1;h.length<a;)h.push(i.empty);h.push(u?n.slice(o,o+u):i.empty)}o+=u}return new e(f,h)}},{key:"compose",value:function t(n){return this.empty?n:n.empty?this:_c(this,n,!0)}},{key:"map",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return n.empty?this:Bc(this,n,i,!0)}},{key:"iterChanges",value:function t(n){var i;Lc(this,n,arguments.length>1&&void 0!==arguments[1]&&arguments[1])}},{key:"desc",get:function t(){return d.create(this.sections)}},{key:"filter",value:function t(n){var i,r,o,u,s,a,f,h=[],c=[],l=[],v=new m(this);t:for(i=0,r=0;;){for(o=i==n.length?1e9:n[i++];r<o||r==o&&0==v.len;){if(v.done)break t;Ic(l,u=Math.min(v.len,o-r),-1),Ic(h,u,s=-1==v.ins?-1:0==v.off?v.ins:0),s>0&&Tc(c,h,v.text),v.forward(u),r+=u}for(a=n[i++];r<a;){if(v.done)break t;Ic(h,f=Math.min(v.len,a-r),-1),Ic(l,f,-1==v.ins?-1:0==v.off?v.ins:0),v.forward(f),r+=f}}return{changes:new e(h,c),filtered:d.create(l)}}},{key:"toJSON",value:function t(){var n,i,e,r=[];for(n=0;n<this.sections.length;n+=2)i=this.sections[n],(e=this.sections[n+1])<0?r.push(i):0==e?r.push([i]):r.push([i].concat(this.inserted[n>>1].toJSON()));return r}}],[{key:"of",value:function t(n,r,o){var u=[],s=[],a=0,f=null;function h(){var t,n=arguments.length>0&&void 0!==arguments[0]&&arguments[0];(n||u.length)&&(a<r&&Ic(u,r-a,-1),t=new e(u,s),f=f?f.compose(t.map(f)):t,u=[],s=[],a=0)}function c(t){var n,v,d,y,m,p,k,g,w;if(Array.isArray(t)){n=ic(t);try{for(n.s();!(v=n.n()).done;)c(d=v.value)}catch(t){n.e(t)}finally{n.f()}}else if(t instanceof e){if(t.length!=r)throw new RangeError("Mismatched change set length (got ".concat(t.length,", expected ").concat(r,")"));h(),f=f?f.compose(t.map(f)):t}else{if(y=t.from,p=void 0===(m=t.to)?y:m,k=t.insert,y>p||y<0||p>r)throw new RangeError("Invalid change range ".concat(y," to ").concat(p," (in doc of length ").concat(r,")"));if(w=(g=k?"string"==typeof k?i.of(k.split(o||l)):k:i.empty).length,y==p&&0==w)return;y<a&&h(),y>a&&Ic(u,y-a,-1),Ic(u,p-y,w),Tc(s,u,g),a=p}}return c(n),h(!f),f}},{key:"empty",value:function t(n){return new e(n?[n,-1]:[],[])}},{key:"fromJSON",value:function t(n){var r,o,u,s;if(!Array.isArray(n))throw new RangeError("Invalid JSON representation of ChangeSet");for(r=[],o=[],u=0;u<n.length;u++)if("number"==typeof(s=n[u]))r.push(s,-1);else{if(!Array.isArray(s)||"number"!=typeof s[0]||s.some((function(t,n){return n&&"string"!=typeof t})))throw new RangeError("Invalid JSON representation of ChangeSet");if(1==s.length)r.push(s[0],0);else{for(;o.length<u;)o.push(i.empty);o[u]=i.of(s.slice(1)),r.push(s[0],o[u].length)}}return new e(r,o)}},{key:"createSet",value:function t(n,i){return new e(n,i)}}]),e}(d),m=function(){function t(n){yc(this,t),this.set=n,this.i=0,this.next()}return pc(t,[{key:"next",value:function t(){var n=this.set.sections;this.i<n.length?(this.len=n[this.i++],this.ins=n[this.i++]):(this.len=0,this.ins=-2),this.off=0}},{key:"done",get:function t(){return-2==this.ins}},{key:"len2",get:function t(){return this.ins<0?this.len:this.ins}},{key:"text",get:function t(){var n=this.set.inserted,e=this.i-2>>1;return e>=n.length?i.empty:n[e]}},{key:"textBit",value:function t(n){var e=this.set.inserted,r=this.i-2>>1;return r>=e.length&&!n?i.empty:e[r].slice(this.off,null==n?void 0:this.off+n)}},{key:"forward",value:function t(n){n==this.len?this.next():(this.len-=n,this.off+=n)}},{key:"forward2",value:function t(n){-1==this.ins?this.forward(n):n==this.ins?this.next():(this.ins-=n,this.off+=n)}}]),t}(),p=function(){function t(n,i,e){yc(this,t),this.from=n,this.to=i,this.flags=e}return pc(t,[{key:"anchor",get:function t(){return 16&this.flags?this.to:this.from}},{key:"head",get:function t(){return 16&this.flags?this.from:this.to}},{key:"empty",get:function t(){return this.from==this.to}},{key:"assoc",get:function t(){return 4&this.flags?-1:8&this.flags?1:0}},{key:"bidiLevel",get:function t(){var n=3&this.flags;return 3==n?null:n}},{key:"goalColumn",get:function t(){var n=this.flags>>5;return 33554431==n?void 0:n}},{key:"map",value:function n(i){var e,r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return this.empty?e=r=i.mapPos(this.from,o):(e=i.mapPos(this.from,1),r=i.mapPos(this.to,-1)),e==this.from&&r==this.to?this:new t(e,r,this.flags)}},{key:"extend",value:function t(n){var i,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;return n<=this.anchor&&e>=this.anchor?k.range(n,e):(i=Math.abs(n-this.anchor)>Math.abs(e-this.anchor)?n:e,k.range(this.anchor,i))}},{key:"eq",value:function t(n){return this.anchor==n.anchor&&this.head==n.head}},{key:"toJSON",value:function t(){return{anchor:this.anchor,head:this.head}}}],[{key:"fromJSON",value:function t(n){if(!n||"number"!=typeof n.anchor||"number"!=typeof n.head)throw new RangeError("Invalid JSON representation for SelectionRange");return k.range(n.anchor,n.head)}},{key:"create",value:function n(i,e,r){return new t(i,e,r)}}]),t}(),k=function(){function t(n,i){yc(this,t),this.ranges=n,this.mainIndex=i}return pc(t,[{key:"map",value:function n(i){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return i.empty?this:t.create(this.ranges.map((function(t){return t.map(i,e)})),this.mainIndex)}},{key:"eq",value:function t(n){if(this.ranges.length!=n.ranges.length||this.mainIndex!=n.mainIndex)return!1;for(var i=0;i<this.ranges.length;i++)if(!this.ranges[i].eq(n.ranges[i]))return!1;return!0}},{key:"main",get:function t(){return this.ranges[this.mainIndex]}},{key:"asSingle",value:function n(){return 1==this.ranges.length?this:new t([this.main],0)}},{key:"addRange",value:function n(i){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return t.create([i].concat(this.ranges),e?0:this.mainIndex+1)}},{key:"replaceRange",value:function n(i){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.mainIndex,r=this.ranges.slice();return r[e]=i,t.create(r,this.mainIndex)}},{key:"toJSON",value:function t(){return{ranges:this.ranges.map((function(t){return t.toJSON()})),main:this.mainIndex}}}],[{key:"fromJSON",value:function n(i){if(!i||!Array.isArray(i.ranges)||"number"!=typeof i.main||i.main>=i.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new t(i.ranges.map((function(t){return p.fromJSON(t)})),i.main)}},{key:"single",value:function n(i){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:i;return new t([t.range(i,e)],0)}},{key:"create",value:function n(i){var e,r,o,u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(0==i.length)throw new RangeError("A selection needs at least one range");for(e=0,r=0;r<i.length;r++){if((o=i[r]).empty?o.from<=e:o.from<e)return t.normalized(i.slice(),u);e=o.to}return new t(i,u)}},{key:"cursor",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,e=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;return p.create(n,n,(0==i?0:i<0?4:8)|(null==e?3:Math.min(2,e))|(null!=r?r:33554431)<<5)}},{key:"range",value:function t(n,i,e,r){var o=(null!=e?e:33554431)<<5|(null==r?3:Math.min(2,r));return i<n?p.create(i,n,24|o):p.create(n,i,(i>n?4:0)|o)}},{key:"normalized",value:function n(i){var e,r,o,u,s,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,f=i[a];for(i.sort((function(t,n){return t.from-n.from})),a=i.indexOf(f),e=1;e<i.length;e++)r=i[e],o=i[e-1],(r.empty?r.from<=o.to:r.from<o.to)&&(u=o.from,s=Math.max(r.to,o.to),e<=a&&a--,i.splice(--e,2,r.anchor>r.head?t.range(s,u):t.range(u,s)));return new t(i,a)}}]),t}(),g=0,w=function(){function t(n,i,e,r,o){yc(this,t),this.combine=n,this.compareInput=i,this.compare=e,this.isStatic=r,this.id=g++,this.default=n([]),this.extensions="function"==typeof o?o(this):o}return pc(t,[{key:"of",value:function t(n){return new b([],this,0,n)}},{key:"compute",value:function t(n,i){if(this.isStatic)throw new Error("Can't compute a static facet");return new b(n,this,1,i)}},{key:"computeN",value:function t(n,i){if(this.isStatic)throw new Error("Can't compute a static facet");return new b(n,this,2,i)}},{key:"from",value:function t(n,i){return i||(i=function t(n){return n}),this.compute([n],(function(t){return i(t.field(n))}))}}],[{key:"define",value:function n(){var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new t(i.combine||function(t){return t},i.compareInput||function(t,n){return t===n},i.compare||(i.combine?function(t,n){return t===n}:Nc),!!i.static,i.enables)}}]),t}(),b=function(){function t(n,i,e,r){yc(this,t),this.dependencies=n,this.facet=i,this.type=e,this.value=r,this.id=g++}return pc(t,[{key:"dynamicSlot",value:function t(n){var i,e,r,o=this,u=this.value,s=this.facet.compareInput,a=this.id,f=n[a]>>1,h=2==this.type,c=!1,l=!1,v=[],d=ic(this.dependencies);try{for(d.s();!(e=d.n()).done;)"doc"==(r=e.value)?c=!0:"selection"==r?l=!0:1&(null!==(i=n[r.id])&&void 0!==i?i:1)||v.push(n[r.id])}catch(t){d.e(t)}finally{d.f()}return{create:function t(n){return n.values[f]=u(n),1},update:function t(n,i){if(c&&i.docChanged||l&&(i.docChanged||i.selection)||Hc(n,v)){var e=u(n);if(h?!Uc(e,n.values[f],s):!s(e,n.values[f]))return n.values[f]=e,1}return 0},reconfigure:function t(n,i){var e,r,c=i.config.address[a];if(null!=c){if(r=qc(i,c),o.dependencies.every((function(t){return t instanceof w?i.facet(t)===n.facet(t):!(t instanceof x)||i.field(t,!1)==n.field(t,!1)}))||(h?Uc(e=u(n),r,s):s(e=u(n),r)))return n.values[f]=r,0}else e=u(n);return n.values[f]=e,1}}}}]),t}(),M=w.define({static:!0}),x=function(){function t(n,i,e,r,o){yc(this,t),this.id=n,this.createF=i,this.updateF=e,this.compareF=r,this.spec=o,this.provides=void 0}return pc(t,[{key:"create",value:function t(n){var i=this,e=n.facet(M).find((function(t){return t.field==i}));return((null==e?void 0:e.create)||this.createF)(n)}},{key:"slot",value:function t(n){var i=this,e=n[this.id]>>1;return{create:function t(n){return n.values[e]=i.create(n),1},update:function t(n,r){var o=n.values[e],u=i.updateF(o,r);return i.compareF(o,u)?0:(n.values[e]=u,1)},reconfigure:function t(n,r){return null!=r.config.address[i.id]?(n.values[e]=r.field(i),0):(n.values[e]=i.create(n),1)}}}},{key:"init",value:function t(n){return[this,M.of({field:this,create:n})]}},{key:"extension",get:function t(){return this}}],[{key:"define",value:function n(i){var e=new t(g++,i.create,i.update,i.compare||function(t,n){return t===n},i);return i.provide&&(e.provides=i.provide(e)),e}}]),t}(),S=4,C=3,j=2,P=1,E={highest:Wc(O=0),high:Wc(P),default:Wc(j),low:Wc(C),lowest:Wc(S)},A=pc((function t(n,i){yc(this,t),this.inner=n,this.prec=i})),D=function(){function t(){yc(this,t)}return pc(t,[{key:"of",value:function t(n){return new R(this,n)}},{key:"reconfigure",value:function n(i){return t.reconfigure.of({compartment:this,extension:i})}},{key:"get",value:function t(n){return n.config.compartments.get(this)}}]),t}(),R=pc((function t(n,i){yc(this,t),this.compartment=n,this.inner=i})),I=function(){function t(n,i,e,r,o,u){for(yc(this,t),this.base=n,this.compartments=i,this.dynamicSlots=e,this.address=r,this.staticValues=o,this.facets=u,this.statusTemplate=[];this.statusTemplate.length<e.length;)this.statusTemplate.push(0)}return pc(t,[{key:"staticFacet",value:function t(n){var i=this.address[n.id];return null==i?n.default:this.staticValues[i>>1]}}],[{key:"resolve",value:function n(i,e,r){var o,u,s,a,f,h,c,l,v,d,y,m,p=[],k=Object.create(null),g=new Map,w=ic(Vc(i,e,g));try{for(w.s();!(o=w.n()).done;)(u=o.value)instanceof x?p.push(u):(k[u.facet.id]||(k[u.facet.id]=[])).push(u)}catch(t){w.e(t)}finally{w.f()}for(s=Object.create(null),a=[],f=[],h=function t(){var n=l[c];s[n.id]=f.length<<1,f.push((function(t){return n.slot(t)}))},c=0,l=p;c<l.length;c++)h();for(y in v=null==r?void 0:r.config.facets,d=function t(){var n,i,e,o,u=k[y],h=u[0].facet,c=v&&v[y]||[];if(u.every((function(t){return 0==t.type})))s[h.id]=a.length<<1|1,Nc(c,u)?a.push(r.facet(h)):(n=h.combine(u.map((function(t){return t.value}))),a.push(r&&h.compare(n,r.facet(h))?r.facet(h):n));else{i=ic(u);try{for(o=function t(){var n=e.value;0==n.type?(s[n.id]=a.length<<1|1,a.push(n.value)):(s[n.id]=f.length<<1,f.push((function(t){return n.dynamicSlot(t)})))},i.s();!(e=i.n()).done;)o()}catch(t){i.e(t)}finally{i.f()}s[h.id]=f.length<<1,f.push((function(t){return zc(t,h,u)}))}},k)d();return new t(i,g,m=f.map((function(t){return t(s)})),s,a,k)}}]),t}(),T=w.define(),L=w.define({combine:function t(n){return n.some((function(t){return t}))},static:!0}),B=w.define({combine:function t(n){return n.length?n[0]:void 0},static:!0}),_=w.define(),F=w.define(),N=w.define(),U=w.define({combine:function t(n){return!!n.length&&n[0]}}),H=function(){function t(n,i){yc(this,t),this.type=n,this.value=i}return pc(t,null,[{key:"define",value:function t(){return new z}}]),t}(),z=function(){function t(){yc(this,t)}return pc(t,[{key:"of",value:function t(n){return new H(this,n)}}]),t}(),W=function(){function t(n){yc(this,t),this.map=n}return pc(t,[{key:"of",value:function t(n){return new V(this,n)}}]),t}(),V=function(){function t(n,i){yc(this,t),this.type=n,this.value=i}return pc(t,[{key:"map",value:function n(i){var e=this.type.map(this.value,i);return void 0===e?void 0:e==this.value?this:new t(this.type,e)}},{key:"is",value:function t(n){return this.type==n}}],[{key:"define",value:function t(){var n;return new W((arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).map||function(t){return t})}},{key:"mapEffects",value:function t(n,i){var e,r,o,u,s;if(!n.length)return n;e=[],r=ic(n);try{for(r.s();!(o=r.n()).done;)(s=(u=o.value).map(i))&&e.push(s)}catch(t){r.e(t)}finally{r.f()}return e}}]),t}(),V.reconfigure=V.define(),V.appendConfig=V.define(),$=function(){function t(n,i,e,r,o,u){yc(this,t),this.startState=n,this.changes=i,this.selection=e,this.effects=r,this.annotations=o,this.scrollIntoView=u,this.Qae=null,this.Kh=null,e&&Fc(e,i.newLength),o.some((function(n){return n.type==t.time}))||(this.annotations=o.concat(t.time.of(Date.now())))}return pc(t,[{key:"newDoc",get:function t(){return this.Qae||(this.Qae=this.changes.apply(this.startState.doc))}},{key:"newSelection",get:function t(){return this.selection||this.startState.selection.map(this.changes)}},{key:"state",get:function t(){return this.Kh||this.startState.applyTransaction(this),this.Kh}},{key:"annotation",value:function t(n){var i,e,r=ic(this.annotations);try{for(r.s();!(i=r.n()).done;)if((e=i.value).type==n)return e.value}catch(t){r.e(t)}finally{r.f()}}},{key:"docChanged",get:function t(){return!this.changes.empty}},{key:"reconfigured",get:function t(){return this.startState.config!=this.state.config}},{key:"isUserEvent",value:function n(i){var e=this.annotation(t.userEvent);return!(!e||!(e==i||e.length>i.length&&e.slice(0,i.length)==i&&"."==e[i.length]))}}],[{key:"create",value:function n(i,e,r,o,u,s){return new t(i,e,r,o,u,s)}}]),t}(),$.time=H.define(),$.userEvent=H.define(),$.addToHistory=H.define(),$.remote=H.define(),q=[],G=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(G||(G={})),J=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;try{K=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(t){}function tl(t){var n,i;if(K)return K.test(t);for(n=0;n<t.length;n++)if(i=t[n],/\w/.test(i)||i>"\x80"&&(i.toUpperCase()!=i.toLowerCase()||J.test(i)))return!0;return!1}function nl(t){return function(n){if(!/\S/.test(n))return G.Space;if(tl(n))return G.Word;for(var i=0;i<t.length;i++)if(n.indexOf(t[i])>-1)return G.Word;return G.Other}}function il(t,n){var i,e,r,o,u,s,a,f,h=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},c={},l=ic(t);try{for(l.s();!(i=l.n()).done;)for(e=i.value,r=0,o=Object.keys(e);r<o.length;r++)if(s=e[u=o[r]],void 0===(a=c[u]))c[u]=s;else if(a===s||void 0===s);else{if(!Object.hasOwnProperty.call(h,u))throw new Error("Config merge conflict for field "+u);c[u]=h[u](a,s)}}catch(t){l.e(t)}finally{l.f()}for(f in n)void 0===c[f]&&(c[f]=n[f]);return c}function el(t,n){return t.from-n.from||t.value.startSide-n.value.startSide}function rl(t){var n,i,e;if(t.length>1)for(n=t[0],i=1;i<t.length;i++){if(el(n,e=t[i])>0)return t.slice().sort(el);n=e}return t}function ol(t,n,i){var e,r,o,u,s,a,f,h,c,l=new Map,v=ic(t);try{for(v.s();!(e=v.n()).done;)for(r=e.value,o=0;o<r.chunk.length;o++)r.chunk[o].maxPoint<=0&&l.set(r.chunk[o],r.chunkPos[o])}catch(t){v.e(t)}finally{v.f()}u=new Set,s=ic(n);try{for(s.s();!(a=s.n()).done;)for(f=a.value,h=0;h<f.chunk.length;h++)null==(c=l.get(f.chunk[h]))||(i?i.mapPos(c):c)!=f.chunkPos[h]||(null==i?void 0:i.touchesRange(c,c+f.chunk[h].length))||u.add(f.chunk[h])}catch(t){s.e(t)}finally{s.f()}return u}function ul(t,n){var i,e,r;for(i=t[n];!((e=1+(n<<1))>=t.length)&&(r=t[e],e+1<t.length&&r.compare(t[e+1])>=0&&(r=t[e+1],e++),!(i.compare(r)<0));)t[e]=i,t[n]=r,n=e}function sl(t,n,i,e,r,o){var u,s,a,f,h,c;for(t.goto(n),i.goto(e),u=e+r,s=e,a=e-n;h=(f=t.to+a-i.to||t.endSide-i.endSide)<0?t.to+a:i.to,c=Math.min(h,u),t.point||i.point?t.point&&i.point&&(t.point==i.point||t.point.eq(i.point))&&al(t.activeForPoint(t.to),i.activeForPoint(i.to))||o.comparePoint(s,c,t.point,i.point):c>s&&!al(t.active,i.active)&&o.compareRange(s,c,t.active,i.active),!(h>u);)s=h,f<=0&&t.next(),f>=0&&i.next()}function al(t,n){if(t.length!=n.length)return!1;for(var i=0;i<t.length;i++)if(t[i]!=n[i]&&!t[i].eq(n[i]))return!1;return!0}function fl(t,n){for(var i=n,e=t.length-1;i<e;i++)t[i]=t[i+1];t.pop()}function hl(t,n,i){for(var e=t.length-1;e>=n;e--)t[e+1]=t[e];t[n]=i}function cl(t,n){var i,e=-1,r=1e9;for(i=0;i<n.length;i++)(n[i]-r||t[i].endSide-t[e].endSide)<0&&(e=i,r=n[i]);return e}function ll(t,n){var i,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.length,r=0;for(i=0;i<e;)9==t.charCodeAt(i)?(r+=n-r%n,i++):(r++,i=Cc(t,i));return r}function vl(t,n,i,e){for(var r=0,o=0;;){if(o>=n)return r;if(r==t.length)break;o+=9==t.charCodeAt(r)?i-o%i:1,r=Cc(t,r)}return!0===e?-1:t.length}for(Q=function(){function t(n,i,e,r,o,u){yc(this,t),this.config=n,this.doc=i,this.selection=e,this.values=r,this.status=n.statusTemplate.slice(),this.computeSlot=o,u&&(u.Kh=this);for(var s=0;s<this.config.dynamicSlots.length;s++)$c(this,s<<1);this.computeSlot=null}return pc(t,[{key:"field",value:function t(n){var i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],e=this.config.address[n.id];if(null!=e)return $c(this,e),qc(this,e);if(i)throw new RangeError("Field is not present in this state")}},{key:"update",value:function t(){for(var n=arguments.length,i=new Array(n),e=0;e<n;e++)i[e]=arguments[e];return Qc(this,i,!0)}},{key:"applyTransaction",value:function n(i){var e,r,o,u,s=this,a=this.config,f=a,h=f.base,c=f.compartments,l=ic(i.effects);try{for(l.s();!(e=l.n()).done;)(r=e.value).is(D.reconfigure)?(a&&(c=new Map,a.compartments.forEach((function(t,n){return c.set(n,t)})),a=null),c.set(r.value.compartment,r.value.extension)):r.is(V.reconfigure)?(a=null,h=r.value):r.is(V.appendConfig)&&(a=null,h=Yc(h).concat(r.value))}catch(t){l.e(t)}finally{l.f()}o=a?i.startState.values.slice():(u=new t(a=I.resolve(h,c,this),this.doc,this.selection,a.dynamicSlots.map((function(){return null})),(function(t,n){return n.reconfigure(t,s)}),null)).values,new t(a,i.newDoc,i.newSelection,o,(function(t,n){return n.update(t,i)}),i)}},{key:"replaceSelection",value:function t(n){return"string"==typeof n&&(n=this.toText(n)),this.changeByRange((function(t){return{changes:{from:t.from,to:t.to,insert:n},range:k.cursor(t.from+n.length)}}))}},{key:"changeByRange",value:function t(n){var i,e,r,o,u,s,a=this.selection,f=n(a.ranges[0]),h=this.changes(f.changes),c=[f.range],l=Yc(f.effects);for(i=1;i<a.ranges.length;i++){for(e=n(a.ranges[i]),o=(r=this.changes(e.changes)).map(h),u=0;u<i;u++)c[u]=c[u].map(o);s=h.mapDesc(r,!0),c.push(e.range.map(s)),h=h.compose(o),l=V.mapEffects(l,o).concat(V.mapEffects(Yc(e.effects),s))}return{changes:h,selection:k.create(c,a.mainIndex),effects:l}}},{key:"changes",value:function n(){var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return i instanceof y?i:y.of(i,this.doc.length,this.facet(t.lineSeparator))}},{key:"toText",value:function n(e){return i.of(e.split(this.facet(t.lineSeparator)||l))}},{key:"sliceDoc",value:function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.doc.length;return this.doc.sliceString(n,i,this.lineBreak)}},{key:"facet",value:function t(n){var i=this.config.address[n.id];return null==i?n.default:($c(this,i),qc(this,i))}},{key:"toJSON",value:function t(n){var i,e,r={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(n)for(i in n)(e=n[i])instanceof x&&null!=this.config.address[e.id]&&(r[i]=e.spec.toJSON(this.field(n[i]),this));return r}},{key:"tabSize",get:function n(){return this.facet(t.tabSize)}},{key:"lineBreak",get:function n(){return this.facet(t.lineSeparator)||"\n"}},{key:"readOnly",get:function t(){return this.facet(U)}},{key:"phrase",value:function n(i){var e,r,o,u,s,a;for(e=arguments.length,r=new Array(e>1?e-1:0),o=1;o<e;o++)r[o-1]=arguments[o];u=ic(this.facet(t.phrases));try{for(u.s();!(s=u.n()).done;)if(a=s.value,Object.prototype.hasOwnProperty.call(a,i)){i=a[i];break}}catch(t){u.e(t)}finally{u.f()}return r.length&&(i=i.replace(/\$(\$|\d*)/g,(function(t,n){if("$"==n)return"$";var i=+(n||1);return!i||i>r.length?t:r[i-1]}))),i}},{key:"languageDataAt",value:function t(n,i){var e,r,o,u,s,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,f=[],h=ic(this.facet(T));try{for(h.s();!(e=h.n()).done;){o=ic((r=e.value)(this,i,a));try{for(o.s();!(u=o.n()).done;)s=u.value,Object.prototype.hasOwnProperty.call(s,n)&&f.push(s[n])}catch(t){o.e(t)}finally{o.f()}}}catch(t){h.e(t)}finally{h.f()}return f}},{key:"charCategorizer",value:function t(n){return nl(this.languageDataAt("wordChars",n).join(""))}},{key:"wordAt",value:function t(n){for(var i,e,r=this.doc.lineAt(n),o=r.text,u=r.from,s=r.length,a=this.charCategorizer(n),f=n-u,h=n-u;f>0&&(i=Cc(o,f,!1),a(o.slice(i,f))==G.Word);)f=i;for(;h<s&&(e=Cc(o,h),a(o.slice(h,e))==G.Word);)h=e;return f==h?null:k.range(f+u,h+u)}}],[{key:"fromJSON",value:function n(i){var e,r,o,u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2?arguments[2]:void 0;if(!i||"string"!=typeof i.doc)throw new RangeError("Invalid JSON representation for EditorState");if(e=[],s)for(o in r=function t(){if(Object.prototype.hasOwnProperty.call(i,o)){var n=s[o],r=i[o];e.push(n.init((function(t){return n.spec.fromJSON(r,t)})))}},s)r();return t.create({doc:i.doc,selection:k.fromJSON(i.selection),extensions:u.extensions?e.concat([u.extensions]):e})}},{key:"create",value:function n(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=I.resolve(e.extensions||[],new Map),o=e.doc instanceof i?e.doc:i.of((e.doc||"").split(r.staticFacet(t.lineSeparator)||l)),u=e.selection?e.selection instanceof k?e.selection:k.single(e.selection.anchor,e.selection.head):k.single(0);return Fc(u,o.length),r.staticFacet(L)||(u=u.asSingle()),new t(r,o,u,r.dynamicSlots.map((function(){return null})),(function(t,n){return n.create(t)}),null)}}]),t}(),Q.allowMultipleSelections=L,Q.tabSize=w.define({combine:function t(n){return n.length?n[0]:4}}),Q.lineSeparator=B,Q.readOnly=U,Q.phrases=w.define({compare:function t(n,i){var e=Object.keys(n),r=Object.keys(i);return e.length==r.length&&e.every((function(t){return n[t]==i[t]}))}}),Q.languageData=T,Q.changeFilter=_,Q.transactionFilter=F,Q.transactionExtender=N,D.reconfigure=V.define(),X=function(){function t(){yc(this,t)}return pc(t,[{key:"eq",value:function t(n){return this==n}},{key:"range",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;return Z.create(n,i,this)}}]),t}(),X.prototype.startSide=X.prototype.endSide=0,X.prototype.point=!1,X.prototype.mapMode=v.TrackDel,Z=function(){function t(n,i,e){yc(this,t),this.from=n,this.to=i,this.value=e}return pc(t,null,[{key:"create",value:function n(i,e,r){return new t(i,e,r)}}]),t}(),Y=function(){function t(n,i,e,r){yc(this,t),this.from=n,this.to=i,this.value=e,this.maxPoint=r}return pc(t,[{key:"length",get:function t(){return this.to[this.to.length-1]}},{key:"findIndex",value:function t(n,i,e){var r,o,u,s,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,f=e?this.to:this.from;for(r=a,o=f.length;;){if(r==o)return r;if(s=f[u=r+o>>1]-n||(e?this.value[u].endSide:this.value[u].startSide)-i,u==r)return s>=0?r:o;s>=0?o=u:r=u+1}}},{key:"between",value:function t(n,i,e,r){for(var o=this.findIndex(i,-1e9,!0),u=this.findIndex(e,1e9,!1,o);o<u;o++)if(!1===r(this.from[o]+n,this.to[o]+n,this.value[o]))return!1}},{key:"map",value:function n(i,e){var r,o,u,s,a,f,h,c=[],l=[],v=[],d=-1,y=-1;for(r=0;r<this.value.length;r++){if(o=this.value[r],a=void 0,f=void 0,(u=this.from[r]+i)==(s=this.to[r]+i)){if(null==(h=e.mapPos(u,o.startSide,o.mapMode)))continue;if(a=f=h,o.startSide!=o.endSide&&(f=e.mapPos(u,o.endSide))<a)continue}else if((a=e.mapPos(u,o.startSide))>(f=e.mapPos(s,o.endSide))||a==f&&o.startSide>0&&o.endSide<=0)continue;(f-a||o.endSide-o.startSide)<0||(d<0&&(d=a),o.point&&(y=Math.max(y,f-a)),c.push(o),l.push(a-d),v.push(f-d))}return{mapped:c.length?new t(l,v,c,y):null,pos:d}}}]),t}(),tt=function(){function t(n,i,e,r){yc(this,t),this.chunkPos=n,this.chunk=i,this.nextLayer=e,this.maxPoint=r}return pc(t,[{key:"length",get:function t(){var n=this.chunk.length-1;return n<0?0:Math.max(this.chunkEnd(n),this.nextLayer.length)}},{key:"size",get:function t(){var n,i,e,r;if(this.isEmpty)return 0;n=this.nextLayer.size,i=ic(this.chunk);try{for(i.s();!(e=i.n()).done;)n+=(r=e.value).value.length}catch(t){i.e(t)}finally{i.f()}return n}},{key:"chunkEnd",value:function t(n){return this.chunkPos[n]+this.chunk[n].length}},{key:"update",value:function n(i){var e,r,o,u,s,a=i.add,f=void 0===a?[]:a,h=i.sort,c=void 0!==h&&h,l=i.filterFrom,v=void 0===l?0:l,d=i.filterTo,y=void 0===d?this.length:d,m=i.filter;if(0==f.length&&!m)return this;if(c&&(f=f.slice().sort(el)),this.isEmpty)return f.length?t.of(f):this;for(e=new it(this,null,-1).goto(0),r=0,o=[],u=new nt;e.value||r<f.length;)r<f.length&&(e.from-f[r].from||e.startSide-f[r].value.startSide)>=0?(s=f[r++],u.addInner(s.from,s.to,s.value)||o.push(s)):1==e.rangeIndex&&e.chunkIndex<this.chunk.length&&(r==f.length||this.chunkEnd(e.chunkIndex)<f[r].from)&&(!m||v>this.chunkEnd(e.chunkIndex)||y<this.chunkPos[e.chunkIndex])&&u.addChunk(this.chunkPos[e.chunkIndex],this.chunk[e.chunkIndex])?e.nextChunk():((!m||v>e.to||y<e.from||m(e.from,e.to,e.value))&&(u.addInner(e.from,e.to,e.value)||o.push(Z.create(e.from,e.to,e.value))),e.next());return u.finishInner(this.nextLayer.isEmpty&&!o.length?t.empty:this.nextLayer.update({add:o,filter:m,filterFrom:v,filterTo:y}))}},{key:"map",value:function n(i){var e,r,o,u,s,a,f,h,c,l,v;if(i.empty||this.isEmpty)return this;for(e=[],r=[],o=-1,u=0;u<this.chunk.length;u++)s=this.chunkPos[u],a=this.chunk[u],!1===(f=i.touchesRange(s,s+a.length))?(o=Math.max(o,a.maxPoint),e.push(a),r.push(i.mapPos(s))):!0===f&&(c=(h=a.map(s,i)).mapped,l=h.pos,c&&(o=Math.max(o,c.maxPoint),e.push(c),r.push(l)));return v=this.nextLayer.map(i),0==e.length?v:new t(r,e,v||t.empty,o)}},{key:"between",value:function t(n,i,e){var r,o,u;if(!this.isEmpty){for(r=0;r<this.chunk.length;r++)if(o=this.chunkPos[r],u=this.chunk[r],i>=o&&n<=o+u.length&&!1===u.between(o,n-o,i-o,e))return;this.nextLayer.between(n,i,e)}}},{key:"iter",value:function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return et.from([this]).goto(n)}},{key:"isEmpty",get:function t(){return this.nextLayer==this}}],[{key:"create",value:function n(i,e,r,o){return new t(i,e,r,o)}},{key:"iter",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return et.from(n).goto(i)}},{key:"compare",value:function t(n,i,e,r){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1,u=n.filter((function(t){return t.maxPoint>0||!t.isEmpty&&t.maxPoint>=o})),s=i.filter((function(t){return t.maxPoint>0||!t.isEmpty&&t.maxPoint>=o})),a=ol(u,s,e),f=new rt(u,a,o),h=new rt(s,a,o);e.iterGaps((function(t,n,i){return sl(f,t,h,n,i,r)})),e.empty&&0==e.length&&sl(f,0,h,0,0,r)}},{key:"eq",value:function t(n,i){var e,r,o,u,s,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,f=arguments.length>3?arguments[3]:void 0;if(null==f&&(f=999999999),e=n.filter((function(t){return!t.isEmpty&&i.indexOf(t)<0})),r=i.filter((function(t){return!t.isEmpty&&n.indexOf(t)<0})),e.length!=r.length)return!1;if(!e.length)return!0;for(o=ol(e,r),u=new rt(e,o,0).goto(a),s=new rt(r,o,0).goto(a);;){if(u.to!=s.to||!al(u.active,s.active)||u.point&&(!s.point||!u.point.eq(s.point)))return!1;if(u.to>f)return!0;u.next(),s.next()}}},{key:"spans",value:function t(n,i,e,r){for(var o,u,s,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1,f=new rt(n,null,a).goto(i),h=i,c=f.openStart;;){if(o=Math.min(f.to,e),f.point?(u=f.activeForPoint(f.to),s=f.pointFrom<i?u.length+1:Math.min(u.length,c),r.point(h,o,f.point,u,s,f.pointRank),c=Math.min(f.openEnd(o),u.length)):o>h&&(r.span(h,o,f.active,c),c=f.openEnd(o)),f.to>e)return c+(f.point&&f.to>e?1:0);h=f.to,f.next()}}},{key:"of",value:function t(n){var i,e,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=new nt,u=ic(n instanceof Z?[n]:r?rl(n):n);try{for(u.s();!(i=u.n()).done;)e=i.value,o.add(e.from,e.to,e.value)}catch(t){u.e(t)}finally{u.f()}return o.finish()}}]),t}(),tt.empty=new tt([],[],null,-1),tt.empty.nextLayer=tt.empty,nt=function(){function t(){yc(this,t),this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}return pc(t,[{key:"finishChunk",value:function t(n){this.chunks.push(new Y(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,n&&(this.from=[],this.to=[],this.value=[])}},{key:"add",value:function n(i,e,r){this.addInner(i,e,r)||(this.nextLayer||(this.nextLayer=new t)).add(i,e,r)}},{key:"addInner",value:function t(n,i,e){var r=n-this.lastTo||e.startSide-this.last.endSide;if(r<=0&&(n-this.lastFrom||e.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return!(r<0)&&(250==this.from.length&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=n),this.from.push(n-this.chunkStart),this.to.push(i-this.chunkStart),this.last=e,this.lastFrom=n,this.lastTo=i,this.value.push(e),e.point&&(this.maxPoint=Math.max(this.maxPoint,i-n)),!0)}},{key:"addChunk",value:function t(n,i){if((n-this.lastTo||i.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,i.maxPoint),this.chunks.push(i),this.chunkPos.push(n);var e=i.value.length-1;return this.last=i.value[e],this.lastFrom=i.from[e]+n,this.lastTo=i.to[e]+n,!0}},{key:"finish",value:function t(){return this.finishInner(tt.empty)}},{key:"finishInner",value:function t(n){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return n;var i=tt.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(n):n,this.setMaxPoint);return this.from=null,i}}]),t}(),it=function(){function t(n,i,e){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;yc(this,t),this.layer=n,this.skip=i,this.minPoint=e,this.rank=r}return pc(t,[{key:"startSide",get:function t(){return this.value?this.value.startSide:0}},{key:"endSide",get:function t(){return this.value?this.value.endSide:0}},{key:"goto",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1e9;return this.chunkIndex=this.rangeIndex=0,this.gotoInner(n,i,!1),this}},{key:"gotoInner",value:function t(n,i,e){for(var r,o;this.chunkIndex<this.layer.chunk.length&&(r=this.layer.chunk[this.chunkIndex],this.skip&&this.skip.has(r)||this.layer.chunkEnd(this.chunkIndex)<n||r.maxPoint<this.minPoint);)this.chunkIndex++,e=!1;this.chunkIndex<this.layer.chunk.length&&(o=this.layer.chunk[this.chunkIndex].findIndex(n-this.layer.chunkPos[this.chunkIndex],i,!0),(!e||this.rangeIndex<o)&&this.setRangeIndex(o)),this.next()}},{key:"forward",value:function t(n,i){(this.to-n||this.endSide-i)<0&&this.gotoInner(n,i,!0)}},{key:"next",value:function t(){for(var n,i,e;;){if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}if(e=(n=this.layer.chunkPos[this.chunkIndex])+(i=this.layer.chunk[this.chunkIndex]).from[this.rangeIndex],this.from=e,this.to=n+i.to[this.rangeIndex],this.value=i.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}},{key:"setRangeIndex",value:function t(n){if(n==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=n}},{key:"nextChunk",value:function t(){this.chunkIndex++,this.rangeIndex=0,this.next()}},{key:"compare",value:function t(n){return this.from-n.from||this.startSide-n.startSide||this.rank-n.rank||this.to-n.to||this.endSide-n.endSide}}]),t}(),et=function(){function t(n){yc(this,t),this.heap=n}return pc(t,[{key:"startSide",get:function t(){return this.value?this.value.startSide:0}},{key:"goto",value:function t(n){var i,e,r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1e9,u=ic(this.heap);try{for(u.s();!(i=u.n()).done;)(e=i.value).goto(n,o)}catch(t){u.e(t)}finally{u.f()}for(r=this.heap.length>>1;r>=0;r--)ul(this.heap,r);return this.next(),this}},{key:"forward",value:function t(n,i){var e,r,o,u=ic(this.heap);try{for(u.s();!(e=u.n()).done;)(r=e.value).forward(n,i)}catch(t){u.e(t)}finally{u.f()}for(o=this.heap.length>>1;o>=0;o--)ul(this.heap,o);(this.to-n||this.value.endSide-i)<0&&this.next()}},{key:"next",value:function t(){if(0==this.heap.length)this.from=this.to=1e9,this.value=null,this.rank=-1;else{var n=this.heap[0];this.from=n.from,this.to=n.to,this.value=n.value,this.rank=n.rank,n.value&&n.next(),ul(this.heap,0)}}}],[{key:"from",value:function n(i){var e,r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,s=[];for(e=0;e<i.length;e++)for(r=i[e];!r.isEmpty;r=r.nextLayer)r.maxPoint>=u&&s.push(new it(r,o,u,e));return 1==s.length?s[0]:new t(s)}}]),t}(),rt=function(){function t(n,i,e){yc(this,t),this.minPoint=e,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=et.from(n,i,e)}return pc(t,[{key:"goto",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1e9;return this.cursor.goto(n,i),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=n,this.endSide=i,this.openStart=-1,this.next(),this}},{key:"forward",value:function t(n,i){for(;this.minActive>-1&&(this.activeTo[this.minActive]-n||this.active[this.minActive].endSide-i)<0;)this.removeActive(this.minActive);this.cursor.forward(n,i)}},{key:"removeActive",value:function t(n){fl(this.active,n),fl(this.activeTo,n),fl(this.activeRank,n),this.minActive=cl(this.active,this.activeTo)}},{key:"addActive",value:function t(n){for(var i=0,e=this.cursor,r=e.value,o=e.to,u=e.rank;i<this.activeRank.length&&this.activeRank[i]<=u;)i++;hl(this.active,i,r),hl(this.activeTo,i,o),hl(this.activeRank,i,u),n&&hl(n,i,this.cursor.from),this.minActive=cl(this.active,this.activeTo)}},{key:"next",value:function t(){var n,i,e,r,o=this.to,u=this.point;for(this.point=null,n=this.openStart<0?[]:null;;)if((i=this.minActive)>-1&&(this.activeTo[i]-this.cursor.from||this.active[i].endSide-this.cursor.startSide)<0){if(this.activeTo[i]>o){this.to=this.activeTo[i],this.endSide=this.active[i].endSide;break}this.removeActive(i),n&&fl(n,i)}else{if(!this.cursor.value){this.to=this.endSide=1e9;break}if(this.cursor.from>o){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}if((e=this.cursor.value).point){if(!(u&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)){this.point=e,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=e.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}this.cursor.next()}else this.addActive(n),this.cursor.next()}if(n)for(this.openStart=0,r=n.length-1;r>=0&&n[r]<o;r--)this.openStart++}},{key:"activeForPoint",value:function t(n){var i,e;if(!this.active.length)return this.active;for(i=[],e=this.active.length-1;e>=0&&!(this.activeRank[e]<this.pointRank);e--)(this.activeTo[e]>n||this.activeTo[e]==n&&this.active[e].endSide>=this.point.endSide)&&i.push(this.active[e]);return i.reverse()}},{key:"openEnd",value:function t(n){var i,e=0;for(i=this.activeTo.length-1;i>=0&&this.activeTo[i]>n;i--)e++;return e}}]),t}(),ot=n.State=Object.freeze({__proto__:null,Annotation:H,AnnotationType:z,ChangeDesc:d,ChangeSet:y,get CharCategory(){return G},Compartment:D,EditorSelection:k,EditorState:Q,Facet:w,Line:a,get MapMode(){return v},Prec:E,Range:Z,RangeSet:tt,RangeSetBuilder:nt,RangeValue:X,SelectionRange:p,StateEffect:V,StateEffectType:W,StateField:x,Text:i,Transaction:$,codePointAt:Ac,codePointSize:Rc,combineConfig:il,countColumn:ll,findClusterBreak:Cc,findColumn:vl,fromCodePoint:Dc}),ut="\u037c",st="undefined"==typeof Symbol?"__"+ut:Symbol.for(ut),at="undefined"==typeof Symbol?"__styleSet"+Math.floor(1e8*Math.random()):Symbol("styleSet"),ft="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:{},ht=function(){function t(n,i){var e,r,o;function u(t){return/^@/.test(t)?[t]:t.split(/,\s*/)}function s(t,n,i,e){var o,a,f=[],h=/^@(\w+)\b/.exec(t[0]),c=h&&"keyframes"==h[1];if(h&&null==n)return i.push(t[0]+";");for(o in n)if(a=n[o],/&/.test(o))s(o.split(/,\s*/).map((function(n){return t.map((function(t){return n.replace(/&/,t)}))})).reduce((function(t,n){return t.concat(n)})),a,i);else if(a&&"object"==dc(a)){if(!h)throw new RangeError("The value of a property ("+o+") should be a primitive value.");s(u(o),a,f,c)}else null!=a&&f.push(o.replace(/_.*/,"").replace(/[A-Z]/g,(function(t){return"-"+t.toLowerCase()}))+": "+a+";");(f.length||c)&&i.push((!r||h||e?t:t.map(r)).join(", ")+" {"+f.join(" ")+"}")}for(o in yc(this,t),this.rules=[],r=(e=i||{}).finish,n)s(u(o),n[o],this.rules)}return pc(t,[{key:"getRules",value:function t(){return this.rules.join("\n")}}],[{key:"newName",value:function t(){var n=ft[st]||1;return ft[st]=n+1,ut+n.toString(36)}},{key:"mount",value:function t(n,i){(n[at]||new lt(n)).mount(Array.isArray(i)?i:[i])}}]),t}(),ct=new Map,lt=function(){function t(n){var i,e,r,o;if(yc(this,t),e=(i=n.ownerDocument||n).defaultView,!n.head&&n.adoptedStyleSheets&&e.CSSStyleSheet){if(r=ct.get(i))return n.adoptedStyleSheets=[r.sheet].concat(Jh(n.adoptedStyleSheets)),n[at]=r;this.sheet=new e.CSSStyleSheet,n.adoptedStyleSheets=[this.sheet].concat(Jh(n.adoptedStyleSheets)),ct.set(i,this)}else this.styleTag=i.createElement("style"),(o=n.head||n).insertBefore(this.styleTag,o.firstChild);this.modules=[],n[at]=this}return pc(t,[{key:"mount",value:function t(n){var i,e,r,o,u,s,a=this.sheet,f=0,h=0;for(i=0;i<n.length;i++)if(e=n[i],(r=this.modules.indexOf(e))<h&&r>-1&&(this.modules.splice(r,1),h--,r=-1),-1==r){if(this.modules.splice(h++,0,e),a)for(o=0;o<e.rules.length;o++)a.insertRule(e.rules[o],f++)}else{for(;h<r;)f+=this.modules[h++].rules.length;f+=e.rules.length,h++}if(!a){for(u="",s=0;s<this.modules.length;s++)u+=this.modules[s].getRules()+"\n";this.styleTag.textContent=u}}}]),t}(),vt={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},dt={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},yt="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent),mt="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),pt="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),kt=mt||yt&&+yt[1]<57,gt=0;gt<10;gt++)vt[48+gt]=vt[96+gt]=String(gt);for(gt=1;gt<=24;gt++)vt[gt+111]="F"+gt;for(gt=65;gt<=90;gt++)vt[gt]=String.fromCharCode(gt+32),dt[gt]=String.fromCharCode(gt);for(wt in vt)dt.hasOwnProperty(wt)||(dt[wt]=vt[wt]);function dl(t){var n=kt&&(t.ctrlKey||t.altKey||t.metaKey)||pt&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key,i=!n&&t.key||(t.shiftKey?dt:vt)[t.keyCode]||t.key||"Unidentified";return"Esc"==i&&(i="Escape"),"Del"==i&&(i="Delete"),"Left"==i&&(i="ArrowLeft"),"Up"==i&&(i="ArrowUp"),"Right"==i&&(i="ArrowRight"),"Down"==i&&(i="ArrowDown"),i}function yl(t){var n;return(n=11==t.nodeType?t.getSelection?t:t.ownerDocument:t).getSelection()}function ml(t,n){return!!n&&(t==n||t.contains(1!=n.nodeType?n.parentNode:n))}function pl(t){for(var n=t.activeElement;n&&n.shadowRoot;)n=n.shadowRoot.activeElement;return n}function kl(t,n){if(!n.anchorNode)return!1;try{return ml(t,n.anchorNode)}catch(t){return!1}}function gl(t){return 3==t.nodeType?El(t,0,t.nodeValue.length).getClientRects():1==t.nodeType?t.getClientRects():[]}function wl(t,n,i,e){return!!i&&(Ml(t,n,i,e,-1)||Ml(t,n,i,e,1))}function bl(t){for(var n=0;;n++)if(!(t=t.previousSibling))return n}function Ml(t,n,i,e,r){for(;;){if(t==i&&n==e)return!0;if(n==(r<0?0:xl(t))){if("DIV"==t.nodeName)return!1;var o=t.parentNode;if(!o||1!=o.nodeType)return!1;n=bl(t)+(r<0?0:1),t=o}else{if(1!=t.nodeType)return!1;if(1==(t=t.childNodes[n+(r<0?-1:0)]).nodeType&&"false"==t.contentEditable)return!1;n=r<0?xl(t):0}}}function xl(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function Sl(t,n){var i=n?t.left:t.right;return{left:i,right:i,top:t.top,bottom:t.bottom}}function Cl(t){return{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function jl(t,n,i,e,r,o,u,s){var a,f,h,c,l,v,d,y,m,p,k,g,w,b,M=t.ownerDocument,x=M.defaultView||window;for(a=t;a;)if(1==a.nodeType){if(f=void 0,h=a==M.body)f=Cl(x);else{if(a.scrollHeight<=a.clientHeight&&a.scrollWidth<=a.clientWidth){a=a.assignedSlot||a.parentNode;continue}f={left:(c=a.getBoundingClientRect()).left,right:c.left+a.clientWidth,top:c.top,bottom:c.top+a.clientHeight}}if(l=0,v=0,"nearest"==r?n.top<f.top?(v=-(f.top-n.top+u),i>0&&n.bottom>f.bottom+v&&(v=n.bottom-f.bottom+v+u)):n.bottom>f.bottom&&(v=n.bottom-f.bottom+u,i<0&&n.top-v<f.top&&(v=-(f.top+v-n.top+u))):(d=n.bottom-n.top,y=f.bottom-f.top,v=(m="center"==r&&d<=y?n.top+d/2-y/2:"start"==r||"center"==r&&i<0?n.top-u:n.bottom-y+u)-f.top),"nearest"==e?n.left<f.left?(l=-(f.left-n.left+o),i>0&&n.right>f.right+l&&(l=n.right-f.right+l+o)):n.right>f.right&&(l=n.right-f.right+o,i<0&&n.left<f.left+l&&(l=-(f.left+l-n.left+o))):l=(p="center"==e?n.left+(n.right-n.left)/2-(f.right-f.left)/2:"start"==e==s?n.left-o:n.right-(f.right-f.left)+o)-f.left,(l||v)&&(h?x.scrollBy(l,v):(k=0,g=0,v&&(w=a.scrollTop,a.scrollTop+=v,g=a.scrollTop-w),l&&(b=a.scrollLeft,a.scrollLeft+=l,k=a.scrollLeft-b),n={left:n.left-k,top:n.top-g,right:n.right-k,bottom:n.bottom-g},k&&Math.abs(k-l)<1&&(e="nearest"),g&&Math.abs(g-v)<1&&(r="nearest"))),h)break;a=a.assignedSlot||a.parentNode}else{if(11!=a.nodeType)break;a=a.host}}function Pl(t){var n,i=t.ownerDocument;for(n=t.parentNode;n&&n!=i.body;)if(1==n.nodeType){if(n.scrollHeight>n.clientHeight||n.scrollWidth>n.clientWidth)return n;n=n.assignedSlot||n.parentNode}else{if(11!=n.nodeType)break;n=n.host}return null}function Ol(t){var n,i,e,r,o,u;if(t.setActive)return t.setActive();if(Mt)return t.focus(Mt);for(n=[],i=t;i&&(n.push(i,i.scrollTop,i.scrollLeft),i!=i.ownerDocument);i=i.parentNode);if(t.focus(null==Mt?{get preventScroll(){return Mt={preventScroll:!0},!0}}:void 0),!Mt)for(Mt=!1,e=0;e<n.length;)r=n[e++],o=n[e++],u=n[e++],r.scrollTop!=o&&(r.scrollTop=o),r.scrollLeft!=u&&(r.scrollLeft=u)}function El(t,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:n,e=xt||(xt=document.createRange());return e.setEnd(t,i),e.setStart(t,n),e}function Al(t,n,i){var e,r={key:n,code:n,keyCode:i,which:i,cancelable:!0},o=new KeyboardEvent("keydown",r);return o.synthetic=!0,t.dispatchEvent(o),(e=new KeyboardEvent("keyup",r)).synthetic=!0,t.dispatchEvent(e),o.defaultPrevented||e.defaultPrevented}function Dl(t){for(;t;){if(t&&(9==t.nodeType||11==t.nodeType&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}function Rl(t){for(;t.attributes.length;)t.removeAttributeNode(t.attributes[0])}function Il(t,n){var i,e=n.focusNode,r=n.focusOffset;if(!e||n.anchorNode!=e||n.anchorOffset!=r)return!1;for(r=Math.min(r,xl(e));;)if(r){if(1!=e.nodeType)return!1;"false"==(i=e.childNodes[r-1]).contentEditable?r--:r=xl(e=i)}else{if(e==t)return!0;r=bl(e),e=e.parentNode}}function Tl(t){var n=t.nextSibling;return t.parentNode.removeChild(t),n}function Ll(t,n,i,e,r,o,u,s,a){var f,h=t.children,c=h.length?h[n]:null,l=o.length?o[o.length-1]:null,v=l?l.breakAfter:u;if(!(n==e&&c&&!u&&!v&&o.length<2&&c.merge(i,r,o.length?l:null,0==i,s,a))){for(e<h.length&&((f=h[e])&&r<f.length?(n==e&&(f=f.split(r),r=0),!v&&l&&f.merge(0,r,l,!0,0,a)?o[o.length-1]=f:(r&&f.merge(0,r,null,!1,0,a),o.push(f))):(null==f?void 0:f.breakAfter)&&(l?l.breakAfter=1:u=1),e++),c&&(c.breakAfter=u,i>0&&(!u&&o.length&&c.merge(i,c.length,o[0],!1,s,0)?c.breakAfter=o.shift().breakAfter:(i<c.length||c.children.length&&0==c.children[c.children.length-1].length)&&c.merge(i,c.length,null,!1,s,0),n++));n<e&&o.length;)if(h[e-1].become(o[o.length-1]))e--,o.pop(),a=o.length?0:s;else{if(!h[n].become(o[0]))break;n++,o.shift(),s=o.length?0:a}!o.length&&n&&e<h.length&&!h[n-1].breakAfter&&h[e].merge(0,0,h[n-1],!1,s,a)&&n--,(n<e||o.length)&&t.replaceChildren(n,e,o)}}function Bl(t,n,i,e,r,o){var u,s,a=t.childCursor(),f=a.findPos(i,1),h=f.i,c=f.off,l=a.findPos(n,-1),v=l.i,d=l.off,y=n-i,m=ic(e);try{for(m.s();!(u=m.n()).done;)y+=(s=u.value).length}catch(t){m.e(t)}finally{m.f()}t.length+=y,Ll(t,v,d,h,c,e,0,r,o)}function _l(t,n,i){var e,r,o,u,s,a=t.nodeValue.length;return n>a&&(n=a),e=n,r=n,o=0,0==n&&i<0||n==a&&i>=0?Nt.chrome||Nt.gecko||(n?(e--,o=1):r<a&&(r++,o=-1)):i<0?e--:r<a&&r++,(u=El(t,e,r).getClientRects()).length?(s=u[(o?o<0:i>=0)?0:u.length-1],Nt.safari&&!o&&0==s.width&&(s=Array.prototype.find.call(u,(function(t){return t.width}))||s),o?Sl(s,o<0):s||null):null}function Fl(t,n,i,e,r,o,u){var s,a,f,h,c;if(i instanceof zt){for(s=i.dom.firstChild;s;s=s.nextSibling)if(a=jt.get(s)){if(h=ml(s,e),t<(c=a.length+(h?r:0))||t==c&&a.getSide()<=0)return h?Fl(t,n,a,e,r,o,u):o(a,t,n);t-=c}else{if("number"!=typeof(f=Nl(t,n,s,u)))return f;t=f}return o(i,i.length,-1)}return i.dom==e?u(e,t,n):o(i,t,n)}function Nl(t,n,i,e){var r,o,u;if(3==i.nodeType){if(t<=(r=i.nodeValue.length))return e(i,t,n);t-=r}else if(1==i.nodeType&&"false"!=i.contentEditable)for(o=i.firstChild;o;o=o.nextSibling){if("number"!=typeof(u=Nl(t,n,o,e)))return u;t=u}return t}function Ul(t,n,i,e,r){var o,u,s,a,f;if(i instanceof zt)for(o=0,u=i.dom.firstChild;u;u=u.nextSibling)if(s=jt.get(u)){if(a=ml(u,e),ml(u,t))return o+(a?Ul(t,n,s,e,r):s.localPosFromDOM(t,n));o+=s.length+(a?r:0)}else{if(null!=(f=Hl(t,n,u)).result)return o+f.result;o+=f.size}else if(i.dom==e)return Math.min(n,e.nodeValue.length);return i.localPosFromDOM(t,n)}function Hl(t,n,i){var e,r,o,u;if(3==i.nodeType)return t==i?{result:n}:{size:i.nodeValue.length};if(1!=i.nodeType||"false"==i.contentEditable)return i.contains(t)?{result:0}:{size:0};for(e=0,r=i.firstChild,o=0;;r=r.nextSibling,o++){if(t==i&&o==n)return{result:e};if(!r)return{size:e};if(null!=(u=Hl(t,n,r)).result)return{result:n+u.result};e+=u.size}}function zl(t,n){var i,e,r,o,u,s,a,f=t.dom,h=t.children,c=0;for(i=0;c<h.length;c++)if(!((r=i+(e=h[c]).length)==i&&e.getSide()<=0)){if(n>i&&n<r&&e.dom.parentNode==f)return e.domAtPos(n-i);if(n<=i)break;i=r}for(o=c;o>0;o--)if((u=h[o-1]).dom.parentNode==f)return u.domAtPos(u.length);for(s=c;s<h.length;s++)if((a=h[s]).dom.parentNode==f)return a.domAtPos(0);return new St(f,0)}function Wl(t,n,i){var e,r=t.children;i>0&&n instanceof zt&&r.length&&(e=r[r.length-1])instanceof zt&&e.mark.eq(n.mark)?Wl(e,n.children[0],i-1):(r.push(n),n.setParent(t)),t.length+=n.length}function Vl(t,n,i){var e,r=null,o=-1,u=null,s=-1;function a(t,n){var e,f,h,c;for(e=0,f=0;e<t.children.length&&f<=n;e++)(c=f+(h=t.children[e]).length)>=n&&(h.children.length?a(h,n-f):(!u||u.isHidden&&i>0)&&(c>n||f==c&&h.getSide()>0)?(u=h,s=n-f):(f<n||f==c&&h.getSide()<0&&!h.isHidden)&&(r=h,o=n-f)),f=c}return a(t,n),(e=(i<0?r:u)||r||u)?e.coordsAt(Math.max(0,e==r?o:s),i):$l(t)}function $l(t){var n,i=t.dom.lastChild;return i?(n=gl(i))[n.length-1]||null:t.dom.getBoundingClientRect()}function ql(t,n){for(var i in t)"class"==i&&n.class?n.class+=" "+t.class:"style"==i&&n.style?n.style+=";"+t.style:n[i]=t[i];return n}function Gl(t,n){var i,e,r,o,u;if(t==n)return!0;if(!t||!n)return!1;if(i=Object.keys(t),e=Object.keys(n),i.length!=e.length)return!1;for(r=0,o=i;r<o.length;r++)if(u=o[r],-1==e.indexOf(u)||t[u]!==n[u])return!1;return!0}function Jl(t,n,i){var e,r,o=null;if(n)for(e in n)i&&e in i||t.removeAttribute(o=e);if(i)for(r in i)n&&n[r]==i[r]||t.setAttribute(o=r,i[r]);return!!o}function Kl(t){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=t.inclusiveStart,e=t.inclusiveEnd;return null==i&&(i=t.inclusive),null==e&&(e=t.inclusive),{start:null!=i?i:n,end:null!=e?e:n}}function Ql(t,n){return t==n||!!(t&&n&&t.compare(n))}function Xl(t,n,i){var e=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=i.length-1;r>=0&&i[r]+e>=t?i[r]=Math.max(i[r],n):i.push(t,n)}function Zl(t,n){var i,e,r=ic(n);try{for(r.s();!(i=r.n()).done;)e=i.value,t=new zt(e,[t],t.length)}catch(t){r.e(t)}finally{r.f()}return t}function Yl(t,n,i){var e=t.facet(un);e.length?e[0](n):window.onerror?window.onerror(String(n),i,void 0,void 0,n):i?console.error(i+":",n):console.error(n)}function tv(t){var n,i,e,r=0,o=0,u=0,s=0,a=ic(t.state.facet(xn));try{for(a.s();!(n=a.n()).done;)(e=(i=n.value)(t))&&(null!=e.left&&(r=Math.max(r,e.left)),null!=e.right&&(o=Math.max(o,e.right)),null!=e.top&&(u=Math.max(u,e.top)),null!=e.bottom&&(s=Math.max(s,e.bottom)))}catch(t){a.e(t)}finally{a.f()}return{left:r,right:o,top:u,bottom:s}}function nv(t){var n,i=[];for(n=0;n<t.length;n++)i.push(1<<+t[n]);return i}bt=function(){function t(){yc(this,t),this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}return pc(t,[{key:"eq",value:function t(n){return this.anchorNode==n.anchorNode&&this.anchorOffset==n.anchorOffset&&this.focusNode==n.focusNode&&this.focusOffset==n.focusOffset}},{key:"setRange",value:function t(n){var i=n.anchorNode,e=n.focusNode;this.set(i,Math.min(n.anchorOffset,i?xl(i):0),e,Math.min(n.focusOffset,e?xl(e):0))}},{key:"set",value:function t(n,i,e,r){this.anchorNode=n,this.anchorOffset=i,this.focusNode=e,this.focusOffset=r}}]),t}(),Mt=null,St=function(){function t(n,i){var e=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];yc(this,t),this.node=n,this.offset=i,this.precise=e}return pc(t,null,[{key:"before",value:function n(i,e){return new t(i.parentNode,bl(i),e)}},{key:"after",value:function n(i,e){return new t(i.parentNode,bl(i)+1,e)}}]),t}(),Ct=[],jt=function(){function t(){yc(this,t),this.parent=null,this.dom=null,this.dirty=2}return pc(t,[{key:"overrideDOMText",get:function t(){return null}},{key:"posAtStart",get:function t(){return this.parent?this.parent.posBefore(this):0}},{key:"posAtEnd",get:function t(){return this.posAtStart+this.length}},{key:"posBefore",value:function t(n){var i,e,r=this.posAtStart,o=ic(this.children);try{for(o.s();!(i=o.n()).done;){if((e=i.value)==n)return r;r+=e.length+e.breakAfter}}catch(t){o.e(t)}finally{o.f()}throw new RangeError("Invalid child in posBefore")}},{key:"posAfter",value:function t(n){return this.posBefore(n)+n.length}},{key:"sync",value:function n(i,e){var r,o,u,s,a,f,h,c,l,v;if(2&this.dirty){r=this.dom,o=null,s=ic(this.children);try{for(s.s();!(a=s.n()).done;){if((f=a.value).dirty&&(!f.dom&&(u=o?o.nextSibling:r.firstChild)&&(!(h=t.get(u))||!h.parent&&h.canReuseDOM(f))&&f.reuseDOM(u),f.sync(i,e),f.dirty=0),u=o?o.nextSibling:r.firstChild,e&&!e.written&&e.node==r&&u!=f.dom&&(e.written=!0),f.dom.parentNode==r)for(;u&&u!=f.dom;)u=Tl(u);else r.insertBefore(f.dom,u);o=f.dom}}catch(t){s.e(t)}finally{s.f()}for((u=o?o.nextSibling:r.firstChild)&&e&&e.node==r&&(e.written=!0);u;)u=Tl(u)}else if(1&this.dirty){c=ic(this.children);try{for(c.s();!(l=c.n()).done;)(v=l.value).dirty&&(v.sync(i,e),v.dirty=0)}catch(t){c.e(t)}finally{c.f()}}}},{key:"reuseDOM",value:function t(n){}},{key:"localPosFromDOM",value:function n(i,e){var r,o,u,s,a,f;if(i==this.dom)r=this.dom.childNodes[e];else{for(o=0==xl(i)?0:0==e?-1:1;(u=i.parentNode)!=this.dom;)0==o&&u.firstChild!=u.lastChild&&(o=i==u.firstChild?-1:1),i=u;r=o<0?i:i.nextSibling}if(r==this.dom.firstChild)return 0;for(;r&&!t.get(r);)r=r.nextSibling;if(!r)return this.length;for(s=0,a=0;;s++){if((f=this.children[s]).dom==r)return a;a+=f.length+f.breakAfter}}},{key:"domBoundsAround",value:function t(n,i){var e,r,o,u,s,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,f=-1,h=-1,c=-1,l=-1;for(e=0,r=a,o=a;e<this.children.length;e++){if(s=r+(u=this.children[e]).length,r<n&&s>i)return u.domBoundsAround(n,i,r);if(s>=n&&-1==f&&(f=e,h=r),r>i&&u.dom.parentNode==this.dom){c=e,l=o;break}o=s,r=s+u.breakAfter}return{from:h,to:l<0?a+this.length:l,startDOM:(f?this.children[f-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:c<this.children.length&&c>=0?this.children[c].dom:null}}},{key:"markDirty",value:function t(){var n=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.dirty|=2,this.markParentsDirty(n)}},{key:"markParentsDirty",value:function t(n){for(var i=this.parent;i;i=i.parent){if(n&&(i.dirty|=2),1&i.dirty)return;i.dirty|=1,n=!1}}},{key:"setParent",value:function t(n){this.parent!=n&&(this.parent=n,this.dirty&&this.markParentsDirty(!0))}},{key:"setDOM",value:function t(n){this.dom&&(this.dom.cmView=null),this.dom=n,n.cmView=this}},{key:"rootView",get:function t(){var n,i;for(n=this;;){if(!(i=n.parent))return n;n=i}}},{key:"replaceChildren",value:function t(n,i){var e,r,o,u,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ct;for(this.markDirty(),r=n;r<i;r++)(o=this.children[r]).parent==this&&o.destroy();for((e=this.children).splice.apply(e,[n,i-n].concat(Jh(s))),u=0;u<s.length;u++)s[u].setParent(this)}},{key:"ignoreMutation",value:function t(n){return!1}},{key:"ignoreEvent",value:function t(n){return!1}},{key:"childCursor",value:function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.length;return new Pt(this.children,n,this.children.length)}},{key:"childPos",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this.childCursor().findPos(n,i)}},{key:"toString",value:function t(){var n=this.constructor.name.replace("View","");return n+(this.children.length?"("+this.children.join()+")":this.length?"["+("Text"==n?this.text:this.length)+"]":"")+(this.breakAfter?"#":"")}},{key:"isEditable",get:function t(){return!0}},{key:"isWidget",get:function t(){return!1}},{key:"isHidden",get:function t(){return!1}},{key:"merge",value:function t(n,i,e,r,o,u){return!1}},{key:"become",value:function t(n){return!1}},{key:"canReuseDOM",value:function t(n){return n.constructor==this.constructor}},{key:"getSide",value:function t(){return 0}},{key:"destroy",value:function t(){this.parent=null}}],[{key:"get",value:function t(n){return n.cmView}}]),t}(),jt.prototype.breakAfter=0,Pt=function(){function t(n,i,e){yc(this,t),this.children=n,this.pos=i,this.i=e,this.off=0}return pc(t,[{key:"findPos",value:function t(n){for(var i,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;;){if(n>this.pos||n==this.pos&&(e>0||0==this.i||this.children[this.i-1].breakAfter))return this.off=n-this.pos,this;i=this.children[--this.i],this.pos-=i.length+i.breakAfter}}}]),t}(),Ot="undefined"!=typeof navigator?navigator:{userAgent:"",vendor:"",platform:""},Et="undefined"!=typeof document?document:{documentElement:{style:{}}},At=/Edge\/(\d+)/.exec(Ot.userAgent),Dt=/MSIE \d/.test(Ot.userAgent),Rt=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ot.userAgent),Tt=!(It=!!(Dt||Rt||At))&&/gecko\/(\d+)/i.test(Ot.userAgent),Lt=!It&&/Chrome\/(\d+)/.exec(Ot.userAgent),Bt="webkitFontSmoothing"in Et.documentElement.style,Ft=(_t=!It&&/Apple Computer/.test(Ot.vendor))&&(/Mobile\/\w+/.test(Ot.userAgent)||Ot.maxTouchPoints>2),Nt={mac:Ft||/Mac/.test(Ot.platform),windows:/Win/.test(Ot.platform),linux:/Linux|X11/.test(Ot.platform),ie:It,ie_version:Dt?Et.documentMode||6:Rt?+Rt[1]:At?+At[1]:0,gecko:Tt,gecko_version:Tt?+(/Firefox\/(\d+)/.exec(Ot.userAgent)||[0,0])[1]:0,chrome:!!Lt,chrome_version:Lt?+Lt[1]:0,ios:Ft,android:/Android\b/.test(Ot.userAgent),webkit:Bt,safari:_t,webkit_version:Bt?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:null!=Et.documentElement.style.tabSize?"tab-size":"-moz-tab-size"},Ut=256,Ht=function(t){sc(i,t);var n=fc(i);function i(t){var e;return yc(this,i),(e=n.call(this)).text=t,e}return pc(i,[{key:"length",get:function t(){return this.text.length}},{key:"createDOM",value:function t(n){this.setDOM(n||document.createTextNode(this.text))}},{key:"sync",value:function t(n,i){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(i&&i.node==this.dom&&(i.written=!0),this.dom.nodeValue=this.text)}},{key:"reuseDOM",value:function t(n){3==n.nodeType&&this.createDOM(n)}},{key:"merge",value:function t(n,e,r){return(!r||r instanceof i&&!(this.length-(e-n)+r.length>Ut))&&(this.text=this.text.slice(0,n)+(r?r.text:"")+this.text.slice(e),this.markDirty(),!0)}},{key:"split",value:function t(n){var e=new i(this.text.slice(n));return this.text=this.text.slice(0,n),this.markDirty(),e}},{key:"localPosFromDOM",value:function t(n,i){return n==this.dom?i:i?this.text.length:0}},{key:"domAtPos",value:function t(n){return new St(this.dom,n)}},{key:"domBoundsAround",value:function t(n,i,e){return{from:e,to:e+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}},{key:"coordsAt",value:function t(n,i){return _l(this.dom,n,i)}}]),i}(jt),zt=function(t){sc(i,t);var n=fc(i);function i(t){var e,r,o,u,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;yc(this,i),(e=n.call(this)).mark=t,e.children=s,e.length=a,r=ic(s);try{for(r.s();!(o=r.n()).done;)(u=o.value).setParent(cc(e))}catch(t){r.e(t)}finally{r.f()}return e}return pc(i,[{key:"setAttrs",value:function t(n){if(Rl(n),this.mark.class&&(n.className=this.mark.class),this.mark.attrs)for(var i in this.mark.attrs)n.setAttribute(i,this.mark.attrs[i]);return n}},{key:"reuseDOM",value:function t(n){n.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(n),this.dirty|=6)}},{key:"sync",value:function t(n,e){this.dom?4&this.dirty&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),oc(vc(i.prototype),"sync",this).call(this,n,e)}},{key:"merge",value:function t(n,e,r,o,u,s){return(!r||!(!(r instanceof i&&r.mark.eq(this.mark))||n&&u<=0||e<this.length&&s<=0))&&(Bl(this,n,e,r?r.children:[],u-1,s-1),this.markDirty(),!0)}},{key:"split",value:function t(n){var e,r,o,u,s=[],a=0,f=-1,h=0,c=ic(this.children);try{for(c.s();!(e=c.n()).done;)(o=a+(r=e.value).length)>n&&s.push(a<n?r.split(n-a):r),f<0&&a>=n&&(f=h),a=o,h++}catch(t){c.e(t)}finally{c.f()}return u=this.length-n,this.length=n,f>-1&&(this.children.length=f,this.markDirty()),new i(this.mark,s,u)}},{key:"domAtPos",value:function t(n){return zl(this,n)}},{key:"coordsAt",value:function t(n,i){return Vl(this,n,i)}}]),i}(jt),Wt=function(t){sc(e,t);var n=fc(e);function e(t,i,r){var o;return yc(this,e),(o=n.call(this)).widget=t,o.length=i,o.side=r,o.prevWidget=null,o}return pc(e,[{key:"split",value:function t(n){var i=e.create(this.widget,this.length-n,this.side);return this.length-=n,i}},{key:"sync",value:function t(n){this.dom&&this.widget.updateDOM(this.dom,n)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(n)),this.dom.contentEditable="false")}},{key:"getSide",value:function t(){return this.side}},{key:"merge",value:function t(n,i,r,o,u,s){return!(r&&(!(r instanceof e&&this.widget.compare(r.widget))||n>0&&u<=0||i<this.length&&s<=0))&&(this.length=n+(r?r.length:0)+(this.length-i),!0)}},{key:"become",value:function t(n){return n instanceof e&&n.side==this.side&&this.widget.constructor==n.widget.constructor&&(this.widget.compare(n.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=n.widget,this.length=n.length,!0)}},{key:"ignoreMutation",value:function t(){return!0}},{key:"ignoreEvent",value:function t(n){return this.widget.ignoreEvent(n)}},{key:"overrideDOMText",get:function t(){var n,e,r,o,u;if(0==this.length)return i.empty;for(n=this;n.parent;)n=n.parent;return o=(r=(e=n).view)&&r.state.doc,u=this.posAtStart,o?o.slice(u,u+this.length):i.empty}},{key:"domAtPos",value:function t(n){return(this.length?0==n:this.side>0)?St.before(this.dom):St.after(this.dom,n==this.length)}},{key:"domBoundsAround",value:function t(){return null}},{key:"coordsAt",value:function t(n,i){var e,r,o,u=this.widget.coordsAt(this.dom,n,i);if(u)return u;if(r=null,!(e=this.dom.getClientRects()).length)return null;for(o=n>0?e.length-1:0;r=e[o],!(n>0?0==o:o==e.length-1||r.top<r.bottom);o+=n>0?-1:1);return this.length?r:Sl(r,this.side>0)}},{key:"isEditable",get:function t(){return!1}},{key:"isWidget",get:function t(){return!0}},{key:"isHidden",get:function t(){return this.widget.isHidden}},{key:"destroy",value:function t(){oc(vc(e.prototype),"destroy",this).call(this),this.dom&&this.widget.destroy(this.dom)}}],[{key:"create",value:function t(n,i,r){return new(n.customView||e)(n,i,r)}}]),e}(jt),Vt=function(t){sc(i,t);var n=fc(i);function i(){return yc(this,i),n.apply(this,arguments)}return pc(i,[{key:"domAtPos",value:function t(n){var i=this.widget,e=i.topView,r=i.text;return e?Fl(n,0,e,r,this.length-e.length,(function(t,n){return t.domAtPos(n)}),(function(t,n){return new St(t,Math.min(n,t.nodeValue.length))})):new St(r,Math.min(n,r.nodeValue.length))}},{key:"sync",value:function t(){this.setDOM(this.widget.toDOM())}},{key:"localPosFromDOM",value:function t(n,i){var e=this.widget,r=e.topView,o=e.text;return r?Ul(n,i,r,o,this.length-r.length):Math.min(i,this.length)}},{key:"ignoreMutation",value:function t(){return!1}},{key:"overrideDOMText",get:function t(){return null}},{key:"coordsAt",value:function t(n,i){var e=this.widget,r=e.topView,o=e.text;return r?Fl(n,i,r,o,this.length-r.length,(function(t,n,i){return t.coordsAt(n,i)}),(function(t,n,i){return _l(t,n,i)})):_l(o,n,i)}},{key:"destroy",value:function t(){var n;oc(vc(i.prototype),"destroy",this).call(this),null===(n=this.widget.topView)||void 0===n||n.destroy()}},{key:"isEditable",get:function t(){return!0}},{key:"canReuseDOM",value:function t(){return!0}}]),i}(Wt),$t=function(t){sc(e,t);var n=fc(e);function e(t){var i;return yc(this,e),(i=n.call(this)).side=t,i}return pc(e,[{key:"length",get:function t(){return 0}},{key:"merge",value:function t(){return!1}},{key:"become",value:function t(n){return n instanceof e&&n.side==this.side}},{key:"split",value:function t(){return new e(this.side)}},{key:"sync",value:function t(){if(!this.dom){var n=document.createElement("img");n.className="cm-widgetBuffer",n.setAttribute("aria-hidden","true"),this.setDOM(n)}}},{key:"getSide",value:function t(){return this.side}},{key:"domAtPos",value:function t(n){return this.side>0?St.before(this.dom):St.after(this.dom)}},{key:"localPosFromDOM",value:function t(){return 0}},{key:"domBoundsAround",value:function t(){return null}},{key:"coordsAt",value:function t(n){return this.dom.getBoundingClientRect()}},{key:"overrideDOMText",get:function t(){return i.empty}},{key:"isHidden",get:function t(){return!0}}]),e}(jt),Ht.prototype.children=Wt.prototype.children=$t.prototype.children=Ct,qt=function(){function t(){yc(this,t)}return pc(t,[{key:"eq",value:function t(n){return!1}},{key:"updateDOM",value:function t(n,i){return!1}},{key:"compare",value:function t(n){return this==n||this.constructor==n.constructor&&this.eq(n)}},{key:"estimatedHeight",get:function t(){return-1}},{key:"ignoreEvent",value:function t(n){return!0}},{key:"coordsAt",value:function t(n,i,e){return null}},{key:"customView",get:function t(){return null}},{key:"isHidden",get:function t(){return!1}},{key:"destroy",value:function t(n){}}]),t}(),Gt=function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t}(Gt||(Gt={})),Jt=function(t){sc(i,t);var n=fc(i);function i(t,e,r,o){var u;return yc(this,i),(u=n.call(this)).startSide=t,u.endSide=e,u.widget=r,u.spec=o,u}return pc(i,[{key:"heightRelevant",get:function t(){return!1}},{key:"hasHeight",value:function t(){return!!this.widget&&this.widget.estimatedHeight>-1}}],[{key:"mark",value:function t(n){return new Kt(n)}},{key:"widget",value:function t(n){var i=n.side||0,e=!!n.block;return new Xt(n,i+=e?i>0?3e8:-4e8:i>0?1e8:-1e8,i,e,n.widget||null,!1)}},{key:"replace",value:function t(n){var i,e,r,o,u,s=!!n.block;return n.isBlockGap?(i=-5e8,e=4e8):(i=((o=(r=Kl(n,s)).start)?s?-3e8:-1:5e8)-1,e=1+((u=r.end)?s?2e8:1:-6e8)),new Xt(n,i,e,s,n.widget||null,!0)}},{key:"line",value:function t(n){return new Qt(n)}},{key:"set",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return tt.of(n,i)}}]),i}(X),Jt.none=tt.empty,Kt=function(t){sc(i,t);var n=fc(i);function i(t){var e,r,o,u;return yc(this,i),o=(r=Kl(t)).start,u=r.end,(e=n.call(this,o?-1:5e8,u?1:-6e8,null,t)).tagName=t.tagName||"span",e.class=t.class||"",e.attrs=t.attributes||null,e}return pc(i,[{key:"eq",value:function t(n){return this==n||n instanceof i&&this.tagName==n.tagName&&this.class==n.class&&Gl(this.attrs,n.attrs)}},{key:"range",value:function t(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;if(n>=e)throw new RangeError("Mark decorations may not be empty");return oc(vc(i.prototype),"range",this).call(this,n,e)}}]),i}(Jt),Kt.prototype.point=!1,Qt=function(t){sc(i,t);var n=fc(i);function i(t){return yc(this,i),n.call(this,-2e8,-2e8,null,t)}return pc(i,[{key:"eq",value:function t(n){return n instanceof i&&this.spec.class==n.spec.class&&Gl(this.spec.attributes,n.spec.attributes)}},{key:"range",value:function t(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;if(e!=n)throw new RangeError("Line decoration ranges must be zero-length");return oc(vc(i.prototype),"range",this).call(this,n,e)}}]),i}(Jt),Qt.prototype.mapMode=v.TrackBefore,Qt.prototype.point=!0,Xt=function(t){sc(i,t);var n=fc(i);function i(t,e,r,o,u,s){var a;return yc(this,i),(a=n.call(this,e,r,u,t)).block=o,a.isReplace=s,a.mapMode=o?e<=0?v.TrackBefore:v.TrackAfter:v.TrackDel,a}return pc(i,[{key:"type",get:function t(){return this.startSide<this.endSide?Gt.WidgetRange:this.startSide<=0?Gt.WidgetBefore:Gt.WidgetAfter}},{key:"heightRelevant",get:function t(){return this.block||!!this.widget&&this.widget.estimatedHeight>=5}},{key:"eq",value:function t(n){return n instanceof i&&Ql(this.widget,n.widget)&&this.block==n.block&&this.startSide==n.startSide&&this.endSide==n.endSide}},{key:"range",value:function t(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;if(this.isReplace&&(n>e||n==e&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&e!=n)throw new RangeError("Widget decorations can only have zero-length ranges");return oc(vc(i.prototype),"range",this).call(this,n,e)}}]),i}(Jt),Xt.prototype.point=!0,Zt=function(t){sc(i,t);var n=fc(i);function i(){var t;return yc(this,i),(t=n.apply(this,arguments)).children=[],t.length=0,t.prevAttrs=void 0,t.attrs=null,t.breakAfter=0,t}return pc(i,[{key:"merge",value:function t(n,e,r,o,u,s){if(r){if(!(r instanceof i))return!1;this.dom||r.transferDOM(this)}return o&&this.setDeco(r?r.attrs:null),Bl(this,n,e,r?r.children:[],u,s),!0}},{key:"split",value:function t(n){var e,r,o,u,s=new i;if(s.breakAfter=this.breakAfter,0==this.length)return s;for(r=(e=this.childPos(n)).i,(o=e.off)&&(s.append(this.children[r].split(o),0),this.children[r].merge(o,this.children[r].length,null,!1,0,0),r++),u=r;u<this.children.length;u++)s.append(this.children[u],0);for(;r>0&&0==this.children[r-1].length;)this.children[--r].destroy();return this.children.length=r,this.markDirty(),this.length=n,s}},{key:"transferDOM",value:function t(n){this.dom&&(this.markDirty(),n.setDOM(this.dom),n.prevAttrs=void 0===this.prevAttrs?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}},{key:"setDeco",value:function t(n){Gl(this.attrs,n)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=n)}},{key:"append",value:function t(n,i){Wl(this,n,i)}},{key:"addLineDeco",value:function t(n){var i=n.spec.attributes,e=n.spec.class;i&&(this.attrs=ql(i,this.attrs||{})),e&&(this.attrs=ql({class:e},this.attrs||{}))}},{key:"domAtPos",value:function t(n){return zl(this,n)}},{key:"reuseDOM",value:function t(n){"DIV"==n.nodeName&&(this.setDOM(n),this.dirty|=6)}},{key:"sync",value:function t(n,e){var r,o,u;for(this.dom?4&this.dirty&&(Rl(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),void 0!==this.prevAttrs&&(Jl(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),oc(vc(i.prototype),"sync",this).call(this,n,e),o=this.dom.lastChild;o&&jt.get(o)instanceof zt;)o=o.lastChild;o&&this.length&&("BR"==o.nodeName||0!=(null===(r=jt.get(o))||void 0===r?void 0:r.isEditable)||Nt.ios&&this.children.some((function(t){return t instanceof Ht})))||((u=document.createElement("BR")).cmIgnore=!0,this.dom.appendChild(u))}},{key:"measureTextSize",value:function t(){var n,i,e,r,o,u;if(0==this.children.length||this.length>20)return null;n=0,e=ic(this.children);try{for(e.s();!(r=e.n()).done;){if(!((o=r.value)instanceof Ht)||/[^ -~]/.test(o.text))return null;if(1!=(u=gl(o.dom)).length)return null;n+=u[0].width,i=u[0].height}}catch(t){e.e(t)}finally{e.f()}return n?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:n/this.length,textHeight:i}:null}},{key:"coordsAt",value:function t(n,i){var e,r,o,u=Vl(this,n,i);return!this.children.length&&u&&this.parent&&(e=this.parent.view.viewState.heightOracle,r=u.bottom-u.top,Math.abs(r-e.lineHeight)<2&&e.textHeight<r)?(o=(r-e.textHeight)/2,{top:u.top+o,bottom:u.bottom-o,left:u.left,right:u.left}):u}},{key:"become",value:function t(n){return!1}},{key:"type",get:function t(){return Gt.Text}}],[{key:"find",value:function t(n,e){var r,o,u,s;for(r=0,o=0;r<n.children.length;r++){if((s=o+(u=n.children[r]).length)>=e){if(u instanceof i)return u;if(s>e)break}o=s+u.breakAfter}return null}}]),i}(jt),Yt=function(t){sc(e,t);var n=fc(e);function e(t,i,r){var o;return yc(this,e),(o=n.call(this)).widget=t,o.length=i,o.type=r,o.breakAfter=0,o.prevWidget=null,o}return pc(e,[{key:"merge",value:function t(n,i,r,o,u,s){return!(r&&(!(r instanceof e&&this.widget.compare(r.widget))||n>0&&u<=0||i<this.length&&s<=0))&&(this.length=n+(r?r.length:0)+(this.length-i),!0)}},{key:"domAtPos",value:function t(n){return 0==n?St.before(this.dom):St.after(this.dom,n==this.length)}},{key:"split",value:function t(n){var i,r=this.length-n;return this.length=n,(i=new e(this.widget,r,this.type)).breakAfter=this.breakAfter,i}},{key:"children",get:function t(){return Ct}},{key:"sync",value:function t(n){this.dom&&this.widget.updateDOM(this.dom,n)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(n)),this.dom.contentEditable="false")}},{key:"overrideDOMText",get:function t(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):i.empty}},{key:"domBoundsAround",value:function t(){return null}},{key:"become",value:function t(n){return n instanceof e&&n.widget.constructor==this.widget.constructor&&(n.widget.compare(this.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=n.widget,this.length=n.length,this.type=n.type,this.breakAfter=n.breakAfter,!0)}},{key:"ignoreMutation",value:function t(){return!0}},{key:"ignoreEvent",value:function t(n){return this.widget.ignoreEvent(n)}},{key:"isEditable",get:function t(){return!1}},{key:"isWidget",get:function t(){return!0}},{key:"coordsAt",value:function t(n,i){return this.widget.coordsAt(this.dom,n,i)}},{key:"destroy",value:function t(){oc(vc(e.prototype),"destroy",this).call(this),this.dom&&this.widget.destroy(this.dom)}}]),e}(jt),tn=function(){function t(n,i,e,r){yc(this,t),this.doc=n,this.pos=i,this.end=e,this.disallowBlockEffectsFor=r,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=n.iter(),this.skip=i}return pc(t,[{key:"posCovered",value:function t(){if(0==this.content.length)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;var n=this.content[this.content.length-1];return!(n.breakAfter||n instanceof Yt&&n.type==Gt.WidgetBefore)}},{key:"getLine",value:function t(){return this.curLine||(this.content.push(this.curLine=new Zt),this.atCursorPos=!0),this.curLine}},{key:"flushBuffer",value:function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.bufferMarks;this.pendingBuffer&&(this.curLine.append(Zl(new $t(-1),n),n.length),this.pendingBuffer=0)}},{key:"addBlockWidget",value:function t(n){this.flushBuffer(),this.curLine=null,this.content.push(n)}},{key:"finish",value:function t(n){this.pendingBuffer&&n<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,this.posCovered()||this.getLine()}},{key:"buildText",value:function t(n,i,e){for(var r,o,u,s,a;n>0;){if(this.textOff==this.text.length){if(o=(r=this.cursor.next(this.skip)).value,u=r.lineBreak,s=r.done,this.skip=0,s)throw new Error("Ran out of text content when drawing inline views");if(u){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,n--;continue}this.text=o,this.textOff=0}a=Math.min(this.text.length-this.textOff,n,512),this.flushBuffer(i.slice(i.length-e)),this.getLine().append(Zl(new Ht(this.text.slice(this.textOff,this.textOff+a)),i),e),this.atCursorPos=!0,this.textOff+=a,n-=a,e=0}}},{key:"span",value:function t(n,i,e,r){this.buildText(i-n,e,r),this.pos=i,this.openStart<0&&(this.openStart=r)}},{key:"point",value:function t(n,i,e,r,o,u){var s,a,f,h,c,l;if(this.disallowBlockEffectsFor[u]&&e instanceof Xt){if(e.block)throw new RangeError("Block decorations may not be specified via plugins");if(i>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}s=i-n,e instanceof Xt?e.block?((a=e.type)!=Gt.WidgetAfter||this.posCovered()||this.getLine(),this.addBlockWidget(new Yt(e.widget||new nn("div"),s,a))):(f=Wt.create(e.widget||new nn("span"),s,s?0:e.startSide),h=this.atCursorPos&&!f.isEditable&&o<=r.length&&(n<i||e.startSide>0),c=!f.isEditable&&(n<i||o>r.length||e.startSide<=0),l=this.getLine(),2!=this.pendingBuffer||h||f.isEditable||(this.pendingBuffer=0),this.flushBuffer(r),h&&(l.append(Zl(new $t(1),r),o),o=r.length+Math.max(0,o-r.length)),l.append(Zl(f,r),o),this.atCursorPos=c,this.pendingBuffer=c?n<i||o>r.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=r.slice())):this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(e),s&&(this.textOff+s<=this.text.length?this.textOff+=s:(this.skip+=s-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=i),this.openStart<0&&(this.openStart=o)}}],[{key:"build",value:function n(i,e,r,o,u){var s=new t(i,e,r,u);return s.openEnd=tt.spans(o,e,r,s),s.openStart<0&&(s.openStart=s.openEnd),s.finish(s.openEnd),s}}]),t}(),nn=function(t){sc(i,t);var n=fc(i);function i(t){var e;return yc(this,i),(e=n.call(this)).tag=t,e}return pc(i,[{key:"eq",value:function t(n){return n.tag==this.tag}},{key:"toDOM",value:function t(){return document.createElement(this.tag)}},{key:"updateDOM",value:function t(n){return n.nodeName.toLowerCase()==this.tag}},{key:"isHidden",get:function t(){return!0}}]),i}(qt),en=w.define(),rn=w.define(),on=w.define(),un=w.define(),sn=w.define(),an=w.define(),fn=w.define(),hn=w.define({combine:function t(n){return n.some((function(t){return t}))}}),cn=w.define({combine:function t(n){return n.some((function(t){return t}))}}),ln=function(){function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"nearest",e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"nearest",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:5;yc(this,t),this.range=n,this.y=i,this.x=e,this.yMargin=r,this.xMargin=o}return pc(t,[{key:"map",value:function n(i){return i.empty?this:new t(this.range.map(i),this.y,this.x,this.yMargin,this.xMargin)}}]),t}(),vn=V.define({map:function t(n,i){return n.map(i)}}),dn=w.define({combine:function t(n){return!n.length||n[0]}}),yn=0,mn=w.define(),pn=function(){function t(n,i,e,r){yc(this,t),this.id=n,this.create=i,this.domEventHandlers=e,this.extension=r(this)}return pc(t,null,[{key:"define",value:function n(i,e){var r=e||{},o=r.eventHandlers,u=r.provide,s=r.decorations;return new t(yn++,i,o,(function(t){var n=[mn.of(t)];return s&&n.push(bn.of((function(n){var i=n.plugin(t);return i?s(i):Jt.none}))),u&&n.push(u(t)),n}))}},{key:"fromClass",value:function n(i,e){return t.define((function(t){return new i(t)}),e)}}]),t}(),kn=function(){function t(n){yc(this,t),this.spec=n,this.mustUpdate=null,this.value=null}return pc(t,[{key:"update",value:function t(n){if(this.value){if(this.mustUpdate){var t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(n){if(Yl(t.state,n,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch(t){}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(n)}catch(t){Yl(n.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}},{key:"destroy",value:function t(n){var i;if(null===(i=this.value)||void 0===i?void 0:i.destroy)try{this.value.destroy()}catch(t){Yl(n.state,t,"CodeMirror plugin crashed")}}},{key:"deactivate",value:function t(){this.spec=this.value=null}}]),t}(),gn=w.define(),wn=w.define(),bn=w.define(),Mn=w.define(),xn=w.define(),Sn=w.define(),Cn=function(){function t(n,i,e,r){yc(this,t),this.fromA=n,this.toA=i,this.fromB=e,this.toB=r}return pc(t,[{key:"join",value:function n(i){return new t(Math.min(this.fromA,i.fromA),Math.max(this.toA,i.toA),Math.min(this.fromB,i.fromB),Math.max(this.toB,i.toB))}},{key:"addToSet",value:function t(n){for(var i,e=n.length,r=this;e>0;e--)if(!((i=n[e-1]).fromA>r.toA)){if(i.toA<r.fromA)break;r=r.join(i),n.splice(e-1,1)}return n.splice(e,0,r),n}}],[{key:"extendWithRanges",value:function n(i,e){var r,o,u,s,a,f,h,c,l,v,d,y;if(0==e.length)return i;for(r=[],o=0,u=0,s=0,a=0;;o++){for(h=s-a,c=(f=o==i.length?null:i[o])?f.fromB:1e9;u<e.length&&e[u]<c&&(l=e[u],v=e[u+1],(d=Math.max(a,l))<=(y=Math.min(c,v))&&new t(d+h,y+h,d,y).addToSet(r),!(v>c));)u+=2;if(!f)return r;new t(f.fromA,f.toA,f.fromB,f.toB).addToSet(r),s=f.toA,a=f.toB}}}]),t}(),jn=function(){function t(n,i,e){var r,o,u,s;yc(this,t),this.view=n,this.state=i,this.transactions=e,this.flags=0,this.startState=n.state,this.changes=y.empty(this.startState.doc.length),r=ic(e);try{for(r.s();!(o=r.n()).done;)u=o.value,this.changes=this.changes.compose(u.changes)}catch(t){r.e(t)}finally{r.f()}s=[],this.changes.iterChangedRanges((function(t,n,i,e){return s.push(new Cn(t,n,i,e))})),this.changedRanges=s}return pc(t,[{key:"viewportChanged",get:function t(){return(4&this.flags)>0}},{key:"heightChanged",get:function t(){return(2&this.flags)>0}},{key:"geometryChanged",get:function t(){return this.docChanged||(10&this.flags)>0}},{key:"focusChanged",get:function t(){return(1&this.flags)>0}},{key:"docChanged",get:function t(){return!this.changes.empty}},{key:"selectionSet",get:function t(){return this.transactions.some((function(t){return t.selection}))}},{key:"empty",get:function t(){return 0==this.flags&&0==this.transactions.length}}],[{key:"create",value:function n(i,e,r){return new t(i,e,r)}}]),t}(),Pn=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(Pn||(Pn={})),On=Pn.LTR,En=Pn.RTL,An=nv("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),Dn=nv("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Rn=Object.create(null),In=[];for(Tn=0,Ln=["()","[]","{}"];Tn<Ln.length;Tn++)_n=(Bn=Ln[Tn]).charCodeAt(0),Fn=Bn.charCodeAt(1),Rn[_n]=Fn,Rn[Fn]=-_n;function iv(t){return t<=247?An[t]:1424<=t&&t<=1524?2:1536<=t&&t<=1785?Dn[t-1536]:1774<=t&&t<=2220?4:8192<=t&&t<=8203?256:64336<=t&&t<=65023?4:8204==t?256:1}function ev(t,n){var i,e,r,o,u,s,a,f,h,c,l,v,d,y,m,p,k,g,w,b,M,x,S,C,j,P,O,E,A,D,R,I,T,L,B,_,F,N,U,H=t.length,z=n==On?1:2,W=n==On?2:1;if(!t||1==z&&!Nn.test(t))return rv(H);for(i=0,e=z,r=z;i<H;i++)512==(o=iv(t.charCodeAt(i)))?o=e:8==o&&4==r&&(o=16),Hn[i]=4==o?2:o,7&o&&(r=o),e=o;for(u=0,s=z,a=z;u<H;u++){if(128==(f=Hn[u]))u<H-1&&s==Hn[u+1]&&24&s?f=Hn[u]=s:Hn[u]=256;else if(64==f){for(h=u+1;h<H&&64==Hn[h];)h++;for(c=u&&8==s||h<H&&8==Hn[h]?1==a?1:8:256,l=u;l<h;l++)Hn[l]=c;u=h-1}else 8==f&&1==a&&(Hn[u]=1);s=f,7&f&&(a=f)}for(v=0,d=0,y=0;v<H;v++)if(p=Rn[m=t.charCodeAt(v)])if(p<0){for(g=d-3;g>=0;g-=3)if(In[g+1]==-p){(b=2&(w=In[g+2])?z:4&w?1&w?W:z:0)&&(Hn[v]=Hn[In[g]]=b),d=g;break}}else{if(189==In.length)break;In[d++]=v,In[d++]=m,In[d++]=y}else if(2==(k=Hn[v])||1==k)for(y=(M=k==z)?0:1,x=d-3;x>=0&&!(2&(S=In[x+2]));x-=3)if(M)In[x+2]|=2;else{if(4&S)break;In[x+2]|=4}for(C=0;C<H;C++)if(256==Hn[C]){for(j=C+1;j<H&&256==Hn[j];)j++;for(E=(P=1==(C?Hn[C-1]:z))==(O=1==(j<H?Hn[j]:z))?P?1:2:z,A=C;A<j;A++)Hn[A]=E;C=j-1}if(D=[],1==z)for(R=0;R<H;){for(I=R,T=1!=Hn[R++];R<H&&T==(1!=Hn[R]);)R++;if(T)for(L=R;L>I;){for(B=L,_=2!=Hn[--L];L>I&&_==(2!=Hn[L-1]);)L--;D.push(new Un(L,B,_?2:1))}else D.push(new Un(I,R,0))}else for(F=0;F<H;){for(N=F,U=2==Hn[F++];F<H&&U==(2==Hn[F]);)F++;D.push(new Un(N,F,U?1:2))}return D}function rv(t){return[new Un(0,t,0)]}function ov(t,n,i,e,r){var o,u,s,a,f,h,c=e.head-t.from,l=-1;if(0==c){if(!r||!t.length)return null;n[0].level!=i&&(c=n[0].side(!1,i),l=0)}else if(c==t.length){if(r)return null;(u=n[n.length-1]).level!=i&&(c=u.side(!0,i),l=n.length-1)}return l<0&&(l=Un.find(n,c,null!==(o=e.bidiLevel)&&void 0!==o?o:-1,e.assoc)),c==(s=n[l]).side(r,i)&&(c=(s=n[l+=r?1:-1]).side(!r,i)),a=r==(s.dir==i),f=Cc(t.text,c,a),zn=t.text.slice(Math.min(c,f),Math.max(c,f)),f!=s.side(r,i)?k.cursor(f+t.from,a?-1:1,s.level):(h=l==(r?n.length-1:0)?null:n[l+(r?1:-1)])||s.level==i?h&&h.level<s.level?k.cursor(h.side(!r,i)+t.from,r?1:-1,h.level):k.cursor(f+t.from,r?-1:1,s.level):k.cursor(r?t.to:t.from,r?-1:1,i)}function uv(t){return 1==t.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function sv(t){return 1==t.node.nodeType&&t.node.firstChild&&(0==t.offset||"false"==t.node.childNodes[t.offset-1].contentEditable)&&(t.offset==t.node.childNodes.length||"false"==t.node.childNodes[t.offset].contentEditable)}function av(t){var n,i,e,r,o,u,s,a=t.observer.selectionRange,f=a.focusNode&&hv(a.focusNode,a.focusOffset,0);if(!f)return null;if(!(n=t.docView.nearest(f)))return null;if(n instanceof Zt){for(i=f;i.parentNode!=n.dom;)i=i.parentNode;for(e=i.previousSibling;e&&!jt.get(e);)e=e.previousSibling;return{from:r=e?jt.get(e).posAtEnd:n.posAtStart,to:r,node:i,text:f}}for(;;){if(!(u=(o=n).parent))return null;if(u instanceof Zt)break;n=u}return{from:s=n.posAtStart,to:s+n.length,node:n.dom,text:f}}function fv(t,n){var i,e,r,o,u,s,a,f,h,c=av(t);if(!c)return Jt.none;if(i=c.from,e=c.to,r=c.node,o=c.text,u=n.mapPos(i,1),s=Math.max(u,n.mapPos(e,-1)),a=t.state,(f=3==r.nodeType?r.nodeValue:new Vn([],a).readRange(r.firstChild,null).text).indexOf(Wn)>-1)return Jt.none;if(s-u<f.length)if(a.doc.sliceString(u,Math.min(a.doc.length,u+f.length))==f)s=u+f.length;else{if(a.doc.sliceString(Math.max(0,s-f.length),s)!=f)return Jt.none;u=s-f.length}else if(a.doc.sliceString(u,s)!=f)return Jt.none;return(h=jt.get(r))instanceof Vt?h=h.widget.topView:h&&(h.parent=null),Jt.set(Jt.replace({widget:new Jn(r,o,h),inclusive:!0}).range(u,s))}function hv(t,n,i){var e,r,o,u;if(i<=0)for(e=t,r=n;;){if(3==e.nodeType)return e;if(!(1==e.nodeType&&r>0))break;r=xl(e=e.childNodes[r-1])}if(i>=0)for(o=t,u=n;;){if(3==o.nodeType)return o;if(!(1==o.nodeType&&u<o.childNodes.length&&i>=0))break;o=o.childNodes[u],u=0}return null}function cv(t,n){return 1!=t.nodeType?0:(n&&"false"==t.childNodes[n-1].contentEditable?1:0)|(n<t.childNodes.length&&"false"==t.childNodes[n].contentEditable?2:0)}function lv(t,n,i){var e=new Kn;return tt.compare(t,n,i,e),e.changes}function vv(t,n){for(var i=t;i&&i!=n;i=i.assignedSlot||i.parentNode)if(1==i.nodeType&&"false"==i.contentEditable)return!0;return!1}function dv(t,n){var i,e,r,o,u,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=t.charCategorizer(n),f=t.doc.lineAt(n),h=n-f.from;if(0==f.length)return k.cursor(n);for(0==h?s=1:h==f.length&&(s=-1),i=h,e=h,s<0?i=Cc(f.text,h,!1):e=Cc(f.text,h),r=a(f.text.slice(i,e));i>0&&(o=Cc(f.text,i,!1),a(f.text.slice(o,i))==r);)i=o;for(;e<f.length&&(u=Cc(f.text,e),a(f.text.slice(e,u))==r);)e=u;return k.range(i+f.from,e+f.from)}function yv(t,n){return n.left>t?n.left-t:Math.max(0,t-n.right)}function mv(t,n){return n.top>t?n.top-t:Math.max(0,t-n.bottom)}function pv(t,n){return t.top<n.bottom-1&&t.bottom>n.top+1}function kv(t,n){return n<t.top?{top:n,left:t.left,right:t.right,bottom:t.bottom}:t}function gv(t,n){return n>t.bottom?{top:t.top,left:t.left,right:t.right,bottom:n}:t}function wv(t,n,i){var e,r,o,u,s,a,f,h,c,l,v,d,y,m,p,k,g,w=!1;for(c=t.firstChild;c;c=c.nextSibling)for(l=gl(c),v=0;v<l.length;v++){if(d=l[v],r&&pv(r,d)&&(d=kv(gv(d,r.bottom),r.top)),y=yv(n,d),m=mv(i,d),0==y&&0==m)return 3==c.nodeType?bv(c,n,i):wv(c,n,i);(!e||u>m||u==m&&o>y)&&(e=c,r=d,o=y,u=m,w=!(p=m?i<d.top?-1:1:y?n<d.left?-1:1:0)||(p>0?v<l.length-1:v>0)),0==y?i>d.bottom&&(!f||f.bottom<d.bottom)?(s=c,f=d):i<d.top&&(!h||h.top>d.top)&&(a=c,h=d):f&&pv(f,d)?f=gv(f,d.bottom):h&&pv(h,d)&&(h=kv(h,d.top))}return f&&f.bottom>=i?(e=s,r=f):h&&h.top<=i&&(e=a,r=h),e?(k=Math.max(r.left,Math.min(r.right,n)),3==e.nodeType?bv(e,k,i):w&&"false"!=e.contentEditable?wv(e,k,i):{node:t,offset:g=Array.prototype.indexOf.call(t.childNodes,e)+(n>=(r.left+r.right)/2?1:0)}):{node:t,offset:0}}function bv(t,n,i){var e,r,o,u,s,a,f,h,c=t.nodeValue.length,l=-1,v=1e9,d=0;for(e=0;e<c;e++)for(r=El(t,e,e+1).getClientRects(),o=0;o<r.length;o++)if((u=r[o]).top!=u.bottom&&(d||(d=n-u.left),s=(u.top>i?u.top-i:i-u.bottom)-1,u.left-1<=n&&u.right+1>=n&&s<v)){if(f=a=n>=(u.left+u.right)/2,(Nt.chrome||Nt.gecko)&&(h=El(t,e).getBoundingClientRect()).left==u.right&&(f=!a),s<=0)return{node:t,offset:e+(f?1:0)};l=e+(f?1:0),v=s}return{node:t,offset:l>-1?l:d>0?t.nodeValue.length:0}}function Mv(t,n,i){var e,r,o,u,s,a,f,h,c,l,v,d,y,m,p,k,g,w=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,b=t.contentDOM.getBoundingClientRect(),M=b.top+t.viewState.paddingTop,x=t.viewState.docHeight,S=n.x,C=n.y,j=C-M;if(j<0)return 0;if(j>x)return t.state.doc.length;for(u=t.defaultLineHeight/2,s=!1;(o=t.elementAtHeight(j)).type!=Gt.Text;)for(;!((j=w>0?o.bottom+u:o.top-u)>=0&&j<=x);){if(s)return i?null:0;s=!0,w=-w}if(C=M+j,(a=o.from)<t.viewport.from)return 0==t.viewport.from?0:i?null:xv(t,b,o,S,C);if(a>t.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:i?null:xv(t,b,o,S,C);if(f=t.dom.ownerDocument,(c=(h=t.root.elementFromPoint?t.root:f).elementFromPoint(S,C))&&!t.contentDOM.contains(c)&&(c=null),c||(S=Math.max(b.left+1,Math.min(b.right-1,S)),(c=h.elementFromPoint(S,C))&&!t.contentDOM.contains(c)&&(c=null)),v=-1,c&&0!=(null===(e=t.docView.nearest(c))||void 0===e?void 0:e.isEditable)&&(f.caretPositionFromPoint?(d=f.caretPositionFromPoint(S,C))&&(l=d.offsetNode,v=d.offset):f.caretRangeFromPoint&&(y=f.caretRangeFromPoint(S,C))&&(l=y.startContainer,v=y.startOffset,(!t.contentDOM.contains(l)||Nt.safari&&Sv(l,v,S)||Nt.chrome&&Cv(l,v,S))&&(l=void 0))),!l||!t.docView.dom.contains(l)){if(!(m=Zt.find(t.docView,a)))return j>o.top+o.height/2?o.to:o.from;l=(p=wv(m.dom,S,C)).node,v=p.offset}return(k=t.docView.nearest(l))?k.isWidget&&1==(null===(r=k.dom)||void 0===r?void 0:r.nodeType)?(g=k.dom.getBoundingClientRect(),n.y<g.top||n.y<=g.bottom&&n.x<=(g.left+g.right)/2?k.posAtStart:k.posAtEnd):k.localPosFromDOM(l,v)+k.posAtStart:null}function xv(t,n,i,e,r){var o,u,s=Math.round((e-n.left)*t.defaultCharacterWidth);return t.lineWrapping&&i.height>1.5*t.defaultLineHeight&&(s+=(o=Math.floor((r-i.top)/t.defaultLineHeight))*t.viewState.heightOracle.lineLength),u=t.state.sliceDoc(i.from,i.to),i.from+vl(u,s,t.state.tabSize)}function Sv(t,n,i){var e,r;if(3!=t.nodeType||n!=(e=t.nodeValue.length))return!1;for(r=t.nextSibling;r;r=r.nextSibling)if(1!=r.nodeType||"BR"!=r.nodeName)return!1;return El(t,e-1,e).getBoundingClientRect().left>i}function Cv(t,n,i){var e,r,o;if(0!=n)return!1;for(e=t;;){if(!(r=e.parentNode)||1!=r.nodeType||r.firstChild!=e)return!1;if(r.classList.contains("cm-line"))break;e=r}return i-(o=1==t.nodeType?t.getBoundingClientRect():El(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect()).left>5}function jv(t,n,i,e){var r,o,u,s,a,f=t.state.doc.lineAt(n.head),h=e&&t.lineWrapping?t.coordsAtPos(n.assoc<0&&n.head>f.from?n.head-1:n.head):null;return h&&(r=t.dom.getBoundingClientRect(),o=t.textDirectionAt(f.from),null!=(u=t.posAtCoords({x:i==(o==Pn.LTR)?r.right-1:r.left+1,y:(h.top+h.bottom)/2})))?k.cursor(u,i?-1:1):(a=(s=Zt.find(t.docView,n.head))?i?s.posAtEnd:s.posAtStart:i?f.to:f.from,k.cursor(a,i?-1:1))}function Pv(t,n,i,e){var r,o,u,s,a=t.state.doc.lineAt(n.head),f=t.bidiSpans(a),h=t.textDirectionAt(a.from);for(r=n,o=null;;){if(u=ov(a,f,h,r,i),s=zn,!u){if(a.number==(i?t.state.doc.lines:1))return r;s="\n",a=t.state.doc.line(a.number+(i?1:-1)),f=t.bidiSpans(a),u=k.cursor(i?a.from:a.to)}if(o){if(!o(s))return r}else{if(!e)return u;o=e(s)}r=u}}function Ov(t,n,i){var e=t.state.charCategorizer(n),r=e(i);return function(t){var n=e(t);return r==G.Space&&(r=n),r==n}}function Ev(t,n,i,e){var r,o,u,s,a,f,h,c,l,v,d,y=n.head,m=i?1:-1;if(y==(i?t.state.doc.length:0))return k.cursor(y,n.assoc);for(r=n.goalColumn,u=t.contentDOM.getBoundingClientRect(),s=t.coordsAtPos(y),a=t.documentTop,s?(null==r&&(r=s.left-u.left),o=m<0?s.top:s.bottom):(f=t.viewState.lineBlockAt(y),null==r&&(r=Math.min(u.right-u.left,t.defaultCharacterWidth*(y-f.from))),o=(m<0?f.top:f.bottom)+a),h=u.left+r,c=null!=e?e:t.defaultLineHeight>>1,l=0;;l+=10)if(d=Mv(t,{x:h,y:v=o+(c+l)*m},!1,m),v<u.top||v>u.bottom||(m<0?d<y:d>y))return k.cursor(d,n.assoc,void 0,r)}function Av(t,n,i){for(var e=function e(){var r,o,u=0,s=ic(t);try{for(s.s();!(r=s.n()).done;)(o=r.value).between(n-1,n+1,(function(t,e,r){if(n>t&&n<e){var o=u||i||(n-t<e-n?-1:1);n=o<0?t:e,u=o}}))}catch(t){s.e(t)}finally{s.f()}if(!u)return{v:n}},r;;)if(r=e())return r.v}function Dv(t,n,i){var e=Av(t.state.facet(Mn).map((function(n){return n(t)})),i.from,n.head>i.from?-1:1);return e==i.from?i:k.cursor(e,e<i.from?1:-1)}function Rv(t){return.7*Math.max(0,t)+8}function Iv(t,n){var i=t.state.facet(en);return i.length?i[0](n):Nt.mac?n.metaKey:n.ctrlKey}function Tv(t,n){var i=t.state.facet(rn);return i.length?i[0](n):Nt.mac?!n.altKey:!n.ctrlKey}function Lv(t,n){var i,e,r,o,u=t.state.selection.main;if(u.empty)return!1;if(!(i=yl(t.root))||0==i.rangeCount)return!0;for(e=i.getRangeAt(0).getClientRects(),r=0;r<e.length;r++)if((o=e[r]).left<=n.clientX&&o.right>=n.clientX&&o.top<=n.clientY&&o.bottom>=n.clientY)return!0;return!1}function Bv(t,n){if(!n.bubbles)return!0;if(n.defaultPrevented)return!1;for(var i=n.target,e;i!=t.contentDOM;i=i.parentNode)if(!i||11==i.nodeType||(e=jt.get(i))&&e.ignoreEvent(n))return!1;return!0}function _v(t){var n,i=t.dom.parentNode;i&&((n=i.appendChild(document.createElement("textarea"))).style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout((function(){t.focus(),n.remove(),Fv(t,n.value)}),50))}function Fv(t,n){var i,e,r=t.state,o=1,u=r.toText(n),s=u.lines==r.selection.ranges.length,a=null!=ci&&r.selection.ranges.every((function(t){return t.empty}))&&ci==u.toString();a?(e=-1,i=r.changeByRange((function(t){var i,a=r.doc.lineAt(t.from);return a.from==e?{range:t}:(e=a.from,i=r.toText((s?u.line(o++).text:n)+r.lineBreak),{changes:{from:a.from,insert:i},range:k.cursor(t.from+i.length)})}))):i=s?r.changeByRange((function(t){var n=u.line(o++);return{changes:{from:t.from,to:t.to,insert:n.text},range:k.cursor(t.from+n.length)}})):r.replaceSelection(u),t.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}function Nv(t,n,i,e){var r,o,u,s;return 1==e?k.cursor(n,i):2==e?dv(t.state,n,i):(r=Zt.find(t.docView,n),o=t.state.doc.lineAt(r?r.posAtEnd:n),u=r?r.posAtStart:o.from,(s=r?r.posAtEnd:o.to)<t.state.doc.length&&s==o.to&&s++,k.range(u,s))}function Uv(t,n,i,e){var r,o,u,s=Zt.find(t.docView,n);return s?0==(r=n-s.posAtStart)?1:r==s.length||(o=s.coordsAt(r,-1))&&ui(i,e,o)?-1:(u=s.coordsAt(r,1))&&ui(i,e,u)?1:o&&oi(e,o)?-1:1:1}function Hv(t,n){var i=t.posAtCoords({x:n.clientX,y:n.clientY},!1);return{pos:i,bias:Uv(t,i,n.clientX,n.clientY)}}function zv(t){if(!si)return t.detail;var n=ai,i=hi;return ai=t,hi=Date.now(),fi=!n||i>Date.now()-400&&Math.abs(n.clientX-t.clientX)<2&&Math.abs(n.clientY-t.clientY)<2?(fi+1)%3:1}function Wv(t,n){var i=Hv(t,n),e=zv(n),r=t.state.selection;return{update:function t(n){n.docChanged&&(i.pos=n.changes.mapPos(i.pos),r=r.map(n.changes))},get:function n(o,u,s){var a,f,h,c,l=Hv(t,o),v=Nv(t,l.pos,l.bias,e);return i.pos==l.pos||u||(f=Nv(t,i.pos,i.bias,e),h=Math.min(f.from,v.from),c=Math.max(f.to,v.to),v=h<v.from?k.range(h,c):k.range(c,h)),u?r.replaceRange(r.main.extend(v.from,v.to)):s&&1==e&&r.ranges.length>1&&(a=Vv(r,l.pos))?a:s?r.addRange(v):k.create([v])}}}function Vv(t,n){var i,e,r,o;for(i=0;i<t.ranges.length;i++)if(r=(e=t.ranges[i]).from,o=e.to,r<=n&&o>=n)return k.create(t.ranges.slice(0,i).concat(t.ranges.slice(i+1)),t.mainIndex==i?0:t.mainIndex-(t.mainIndex>i?1:0));return null}function $v(t,n,i,e){var r,o,u,s,a;i&&(r=t.posAtCoords({x:n.clientX,y:n.clientY},!1),n.preventDefault(),o=t.inputState.mouseSelection,u=e&&o&&o.dragging&&o.dragMove?{from:o.dragging.from,to:o.dragging.to}:null,s={from:r,insert:i},a=t.state.changes(u?[u,s]:s),t.focus(),t.dispatch({changes:a,selection:{anchor:a.mapPos(r,-1),head:a.mapPos(r,1)},userEvent:u?"move.drop":"input.drop"}))}function qv(t,n){var i,e=t.dom.parentNode;e&&((i=e.appendChild(document.createElement("textarea"))).style.cssText="position: fixed; left: -10000px; top: 10px",i.value=n,i.focus(),i.selectionEnd=n.length,i.selectionStart=0,setTimeout((function(){i.remove(),t.focus()}),50))}function Gv(t){var n,i,e,r,o,u,s,a=[],f=[],h=!1,c=ic(t.selection.ranges);try{for(c.s();!(n=c.n()).done;)(i=n.value).empty||(a.push(t.sliceDoc(i.from,i.to)),f.push(i))}catch(t){c.e(t)}finally{c.f()}if(!a.length){e=-1,r=ic(t.selection.ranges);try{for(r.s();!(o=r.n()).done;)u=o.value.from,(s=t.doc.lineAt(u)).number>e&&(a.push(s.text),f.push({from:s.from,to:Math.min(t.doc.length,s.to+1)})),e=s.number}catch(t){r.e(t)}finally{r.f()}h=!0}return{text:a.join(t.lineBreak),ranges:f,linewise:h}}function Jv(t,n){var i,e,r,o=[],u=ic(t.facet(fn));try{for(u.s();!(i=u.n()).done;)(r=(e=i.value)(t,n))&&o.push(r)}catch(t){u.e(t)}finally{u.f()}return o?t.update({effects:o,annotations:li.of(!0)}):null}function Kv(t){setTimeout((function(){var n,i=t.hasFocus;i!=t.inputState.notifiedFocused&&((n=Jv(t.state,i))?t.dispatch(n):t.update([]))}),10)}function Qv(t,n){var i,e;null==t[n]&&(i=t[n-1])instanceof Mi&&(e=t[n+1])instanceof Mi&&t.splice(n-1,3,new Mi(i.length+1+e.length))}function Xv(t,n,i){var e=new ji;return tt.compare(t,n,i,e,0),e.changes}function Zv(t,n){var i,e,r,o,u=t.getBoundingClientRect(),s=t.ownerDocument,a=s.defaultView||window,f=Math.max(0,u.left),h=Math.min(a.innerWidth,u.right),c=Math.max(0,u.top),l=Math.min(a.innerHeight,u.bottom);for(i=t.parentNode;i&&i!=s.body;)if(1==i.nodeType)e=i,r=window.getComputedStyle(e),(e.scrollHeight>e.clientHeight||e.scrollWidth>e.clientWidth)&&"visible"!=r.overflow&&(o=e.getBoundingClientRect(),f=Math.max(f,o.left),h=Math.min(h,o.right),c=Math.max(c,o.top),l=i==t.parentNode?o.bottom:Math.min(l,o.bottom)),i="absolute"==r.position||"fixed"==r.position?e.offsetParent:e.parentNode;else{if(11!=i.nodeType)break;i=i.host}return{left:f-u.left,right:Math.max(f,h)-u.left,top:c-(u.top+n),bottom:Math.max(c,l)-(u.top+n)}}function Yv(t,n){var i=t.getBoundingClientRect();return{left:0,right:i.right-i.left,top:n,bottom:i.bottom-(i.top+n)}}function td(t,n,i){var e=[],r=t,o=0;return tt.spans(i,t,n,{span:function t(){},point:function t(n,i){n>r&&(e.push({from:r,to:n}),o+=n-r),r=i}},20),r<n&&(e.push({from:r,to:n}),o+=n-r),{total:o,ranges:e}}function nd(t,n){var i,e,r,o,u,s,a=t.total,f=t.ranges;if(n<=0)return f[0].from;if(n>=1)return f[f.length-1].to;for(i=Math.floor(a*n),e=0;;e++){if(o=(r=f[e]).from,i<=(s=(u=r.to)-o))return o+i;i-=s}}function id(t,n){var i,e,r,o,u=0,s=ic(t.ranges);try{for(s.s();!(i=s.n()).done;){if(r=(e=i.value).from,n<=(o=e.to)){u+=n-r;break}u+=o-r}}catch(t){s.e(t)}finally{s.f()}return u/t.total}function ed(t,n){var i,e,r=ic(t);try{for(r.s();!(i=r.n()).done;)if(n(e=i.value))return e}catch(t){r.e(t)}finally{r.f()}}function rd(t,n){if(1==n.scale)return t;var i=n.toDOM(t.top),e=n.toDOM(t.bottom);return new mi(t.from,t.length,i,e-i,t.children&&t.children.map((function(t){return rd(t,n)})),t.deco)}function od(t,n,i){return new ht(n,{finish:function n(e){return/&/.test(e)?e.replace(/&\w*/,(function(n){if("&"==n)return t;if(!i||!i[n])throw new RangeError("Unsupported selector: ".concat(n));return i[n]})):t+" "+e}})}function ud(t,n){var e,r,o,u,s,a,f,h,c,l,v,d,y,m,p,g,w,b,M,x,S,C=n.newSel,j=t.state.selection.main,P=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;return n.bounds?(o=(r=n.bounds).from,u=r.to,s=j.from,a=null,(8===P||Nt.android&&n.text.length<u-o)&&(s=j.to,a="end"),(f=sd(t.state.doc.sliceString(o,u,Wn),n.text,s-o,a))&&(Nt.chrome&&13==P&&f.toB==f.from+2&&n.text.slice(f.from,f.toB)==Wn+Wn&&f.toB--,e={from:o+f.from,to:o+f.toA,insert:i.of(n.text.slice(f.from,f.toB).split(Wn))})):C&&(!t.hasFocus&&t.state.facet(dn)||C.main.eq(j))&&(C=null),!(!e&&!C)&&(!e&&n.typeOver&&!j.empty&&C&&C.main.empty?e={from:j.from,to:j.to,insert:t.state.doc.slice(j.from,j.to)}:e&&e.from>=j.from&&e.to<=j.to&&(e.from!=j.from||e.to!=j.to)&&j.to-j.from-(e.to-e.from)<=4?e={from:j.from,to:j.to,insert:t.state.doc.slice(j.from,e.from).append(e.insert).append(t.state.doc.slice(e.to,j.to))}:(Nt.mac||Nt.android)&&e&&e.from==e.to&&e.from==j.head-1&&/^\. ?$/.test(e.insert.toString())&&"off"==t.contentDOM.getAttribute("autocorrect")?(C&&2==e.insert.length&&(C=k.single(C.main.anchor-1,C.main.head-1)),e={from:j.from,to:j.to,insert:i.of([" "])}):Nt.chrome&&e&&e.from==e.to&&e.from==j.head&&"\n "==e.insert.toString()&&t.lineWrapping&&(C&&(C=k.single(C.main.anchor-1,C.main.head-1)),e={from:j.from,to:j.to,insert:i.of([" "])}),e?(h=t.state,!(!Nt.ios||!t.inputState.flushIOSKey(t))||(!(!Nt.android||!(e.from==j.from&&e.to==j.to&&1==e.insert.length&&2==e.insert.lines&&Al(t.contentDOM,"Enter",13)||(e.from==j.from-1&&e.to==j.to&&0==e.insert.length||8==P&&e.insert.length<e.to-e.from)&&Al(t.contentDOM,"Backspace",8)||e.from==j.from&&e.to==j.to+1&&0==e.insert.length&&Al(t.contentDOM,"Delete",46)))||(c=e.insert.toString(),t.state.facet(an).some((function(n){return n(t,e.from,e.to,c)}))||(t.inputState.composing>=0&&t.inputState.composing++,e.from>=j.from&&e.to<=j.to&&e.to-e.from>=(j.to-j.from)/3&&(!C||C.main.empty&&C.main.from==e.from+e.insert.length)&&t.inputState.composing<0?(v=j.from<e.from?h.sliceDoc(j.from,e.from):"",d=j.to>e.to?h.sliceDoc(e.to,j.to):"",l=h.replaceSelection(t.state.toText(v+e.insert.sliceString(0,void 0,t.state.lineBreak)+d))):(y=h.changes(e),m=C&&C.main.to<=y.newLength?C.main:void 0,h.selection.ranges.length>1&&t.inputState.composing>=0&&e.to<=j.to&&e.to>=j.to-10?(p=t.state.sliceDoc(e.from,e.to),g=av(t)||t.state.doc.lineAt(j.head),w=j.to-e.to,b=j.to-j.from,l=h.changeByRange((function(n){var i,r,o,u;return n.from==j.from&&n.to==j.to?{changes:y,range:m||n.map(y)}:(r=(i=n.to-w)-p.length,n.to-n.from!=b||t.state.sliceDoc(r,i)!=p||g&&n.to>=g.from&&n.from<=g.to?{range:n}:(o=h.changes({from:r,to:i,insert:e.insert}),u=n.to-j.to,{changes:o,range:m?k.range(Math.max(0,m.anchor+u),Math.max(0,m.head+u)):n.map(o)}))}))):l={changes:y,selection:m&&h.selection.replaceRange(m)}),M="input.type",(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,M+=".compose",t.inputState.compositionFirstChange&&(M+=".start",t.inputState.compositionFirstChange=!1)),t.dispatch(l,{scrollIntoView:!0,userEvent:M})),!0))):!(!C||C.main.eq(j))&&(x=!1,S="select",t.inputState.lastSelectionTime>Date.now()-50&&("select"==t.inputState.lastSelectionOrigin&&(x=!0),S=t.inputState.lastSelectionOrigin),t.dispatch({selection:C,scrollIntoView:x,userEvent:S}),!0))}function sd(t,n,i,e){for(var r,o,u,s,a,f=Math.min(t.length,n.length),h=0;h<f&&t.charCodeAt(h)==n.charCodeAt(h);)h++;if(h==f&&t.length==n.length)return null;for(r=t.length,o=n.length;r>0&&o>0&&t.charCodeAt(r-1)==n.charCodeAt(o-1);)r--,o--;return"end"==e&&(i-=r+(u=Math.max(0,h-Math.min(r,o)))-h),r<h&&t.length<n.length?(o=(h-=s=i<=h&&i>=r?h-i:0)+(o-r),r=h):o<h&&(r=(h-=a=i<=h&&i>=o?h-i:0)+(r-o),o=h),{from:h,toA:r,toB:o}}function ad(t){var n,i,e,r,o,u=[];return t.root.activeElement!=t.contentDOM||(i=(n=t.observer.selectionRange).anchorNode,e=n.anchorOffset,r=n.focusNode,o=n.focusOffset,i&&(u.push(new $n(i,e)),r==i&&o==e||u.push(new $n(r,o)))),u}function fd(t,n){if(0==t.length)return null;var i=t[0].pos,e=2==t.length?t[1].pos:i;return i>-1&&e>-1?k.single(i+n,e+n):null}function hd(t,n,i){for(var e,r;n;){if((e=jt.get(n))&&e.parent==t)return e;n=(r=n.parentNode)!=t.dom?r:i>0?n.nextSibling:n.previousSibling}return null}function cd(t){var n,i,e,r,o,u,s=null;function a(t){t.preventDefault(),t.stopImmediatePropagation(),s=t.getTargetRanges()[0]}return t.contentDOM.addEventListener("beforeinput",a,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",a,!0),s?(n=s.startContainer,i=s.startOffset,e=s.endContainer,r=s.endOffset,wl((o=t.docView.domAtPos(t.state.selection.main.anchor)).node,o.offset,e,r)&&(n=(u=[e,r,n,i])[0],i=u[1],e=u[2],r=u[3]),{anchorNode:n,anchorOffset:i,focusNode:e,focusOffset:r}):null}function ld(t,n,i){var e,r,o,u;for(r=(e=t.state.facet(n)).length-1;r>=0;r--)(u="function"==typeof(o=e[r])?o(t):o)&&ql(u,i);return i}function vd(t,n){var i,e,r,o,u,s,a=t.split(/-(?!$)/),f=a[a.length-1];for("Space"==f&&(f=" "),u=0;u<a.length-1;++u)if(s=a[u],/^(cmd|meta|m)$/i.test(s))o=!0;else if(/^a(lt)?$/i.test(s))i=!0;else if(/^(c|ctrl|control)$/i.test(s))e=!0;else if(/^s(hift)?$/i.test(s))r=!0;else{if(!/^mod$/i.test(s))throw new Error("Unrecognized modifier name: "+s);"mac"==n?o=!0:e=!0}return i&&(f="Alt-"+f),e&&(f="Ctrl-"+f),o&&(f="Meta-"+f),r&&(f="Shift-"+f),f}function dd(t,n,i){return n.altKey&&(t="Alt-"+t),n.ctrlKey&&(t="Ctrl-"+t),n.metaKey&&(t="Meta-"+t),!1!==i&&n.shiftKey&&(t="Shift-"+t),t}function yd(t){var n=t.facet(Qi),i=Xi.get(n);return i||Xi.set(n,i=pd(n.reduce((function(t,n){return t.concat(n)}),[]))),i}function md(t,n,i){return kd(yd(t.state),n,t,i)}function pd(t){var n,i,e,r,o,u,s,a,f,h,c,l,v=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ji,d=Object.create(null),y=Object.create(null),m=function t(n,i){var e=y[n];if(null==e)y[n]=i;else if(e!=i)throw new Error("Key binding "+n+" is used both as a regular binding and as a multi-stroke prefix")},p=function t(n,i,e,r){var o,u,s,a,f,h=d[n]||(d[n]=Object.create(null)),c=i.split(/ (?!$)/).map((function(t){return vd(t,v)})),l=function t(){var i=c.slice(0,s).join(" ");m(i,!0),h[i]||(h[i]={preventDefault:!0,run:[function(t){var e=Zi={view:t,prefix:i,scope:n};return setTimeout((function(){Zi==e&&(Zi=null)}),Yi),!0}]})};for(s=1;s<c.length;s++)l();a=c.join(" "),m(a,!1),f=h[a]||(h[a]={preventDefault:!1,run:(null===(u=null===(o=h.Wde)||void 0===o?void 0:o.run)||void 0===u?void 0:u.slice())||[]}),e&&f.run.push(e),r&&(f.preventDefault=!0)},k=ic(t);try{for(k.s();!(n=k.n()).done;){if(e=(i=n.value).scope?i.scope.split(" "):["editor"],i.any){r=ic(e);try{for(r.s();!(o=r.n()).done;)for(a in u=o.value,(s=d[u]||(d[u]=Object.create(null))).Wde||(s.Wde={preventDefault:!1,run:[]}),s)s[a].run.push(i.any)}catch(t){r.e(t)}finally{r.f()}}if(f=i[v]||i.key){h=ic(e);try{for(h.s();!(c=h.n()).done;)p(l=c.value,f,i.run,i.preventDefault),i.shift&&p(l,"Shift-"+f,i.shift,i.preventDefault)}catch(t){h.e(t)}finally{h.f()}}}}catch(t){k.e(t)}finally{k.f()}return d}function kd(t,n,i,e){var r,o,u,s,a,f=dl(n),h=Ac(f,0),c=Rc(h)==f.length&&" "!=f,l="",v=!1;if(Zi&&Zi.view==i&&Zi.scope==e&&(l=Zi.prefix+" ",(v=Yn.indexOf(n.keyCode)<0)&&(Zi=null)),r=new Set,o=function t(e){var o,u,s;if(e){o=ic(e.run);try{for(o.s();!(u=o.n()).done;)if(s=u.value,!r.has(s)&&(r.add(s),s(i,n)))return!0}catch(t){o.e(t)}finally{o.f()}e.preventDefault&&(v=!0)}return!1},u=t[e]){if(o(u[l+dd(f,n,!c)]))return!0;if(c&&(n.altKey||n.metaKey||n.ctrlKey)&&!(Nt.windows&&n.ctrlKey&&n.altKey)&&(s=vt[n.keyCode])&&s!=f){if(o(u[l+dd(s,n,!0)]))return!0;if(n.shiftKey&&(a=dt[n.keyCode])!=f&&a!=s&&o(u[l+dd(a,n,!1)]))return!0}else if(c&&n.shiftKey&&o(u[l+dd(f,n,!0)]))return!0;if(o(u.Wde))return!0}return v}function gd(t){var n=t.scrollDOM.getBoundingClientRect(),i=t.textDirection==Pn.LTR?n.left:n.right-t.scrollDOM.clientWidth;return{left:i-t.scrollDOM.scrollLeft,top:n.top-t.scrollDOM.scrollTop}}function wd(t,n,i){var e=k.cursor(n);return{from:Math.max(i.from,t.moveToLineBoundary(e,!1,!0).from),to:Math.min(i.to,t.moveToLineBoundary(e,!0,!0).from),type:Gt.Text}}function bd(t,n){var i,e,r,o=t.lineBlockAt(n);if(Array.isArray(o.type)){i=ic(o.type);try{for(i.s();!(e=i.n()).done;)if((r=e.value).to>n||r.to==n&&(r.to==o.to||r.type==Gt.Text))return r}catch(t){i.e(t)}finally{i.f()}}return o}function Md(t,n,i){var e,r,o,u,s,a,f,h,c,l,v,d,y,m,p,k,g;return i.to<=t.viewport.from||i.from>=t.viewport.to?[]:(e=Math.max(i.from,t.viewport.from),r=Math.min(i.to,t.viewport.to),o=t.textDirection==Pn.LTR,u=t.contentDOM,s=u.getBoundingClientRect(),a=gd(t),h=(f=u.querySelector(".cm-line"))&&window.getComputedStyle(f),c=s.left+(h?parseInt(h.paddingLeft)+Math.min(0,parseInt(h.textIndent)):0),l=s.right-(h?parseInt(h.paddingRight):0),v=bd(t,e),d=bd(t,r),y=v.type==Gt.Text?v:null,m=d.type==Gt.Text?d:null,t.lineWrapping&&(y&&(y=wd(t,e,y)),m&&(m=wd(t,r,m))),y&&m&&y.from==m.from?b(M(i.from,i.to,y)):(p=y?M(i.from,null,y):x(v,!1),k=m?M(null,i.to,m):x(d,!0),g=[],(y||v).to<(m||d).from-(y&&m?1:0)?g.push(w(c,p.bottom,l,k.top)):p.bottom<k.top&&t.elementAtHeight((p.bottom+k.top)/2).type==Gt.Text&&(p.bottom=k.top=(p.bottom+k.top)/2),b(p).concat(g).concat(b(k))));function w(t,i,e,r){return new te(n,t-a.left,i-a.top-.01,e-t,r-i+.01)}function b(t){var n,i=t.top,e=t.bottom,r=t.horizontal,o=[];for(n=0;n<r.length;n+=2)o.push(w(r[n],i,r[n+1],e));return o}function M(n,i,e){var r,u,s,a,f,h,v,d,y,m,p,k,g,w=1e9,b=-1e9,M=[];function x(n,i,r,u,s){var a=t.coordsAtPos(n,n==e.to?-2:2),f=t.coordsAtPos(r,r==e.from?2:-2);a&&f&&(w=Math.min(a.top,f.top,w),b=Math.max(a.bottom,f.bottom,b),s==Pn.LTR?M.push(o&&i?c:a.left,o&&u?l:f.right):M.push(!o&&u?c:f.left,!o&&i?l:a.right))}r=null!=n?n:e.from,u=null!=i?i:e.to,s=ic(t.visibleRanges);try{for(s.s();!(a=s.n()).done;)if((f=a.value).to>r&&f.from<u)for(h=Math.max(f.from,r),v=Math.min(f.to,u);;){d=t.state.doc.lineAt(h),y=ic(t.bidiSpans(d));try{for(y.s();!(m=y.n()).done&&(k=(p=m.value).from+d.from,g=p.to+d.from,!(k>=v));)g>h&&x(Math.max(k,h),null==n&&k<=r,Math.min(g,v),null==i&&g>=u,p.dir)}catch(t){y.e(t)}finally{y.f()}if((h=d.to+1)>=v)break}}catch(t){s.e(t)}finally{s.f()}return 0==M.length&&x(r,null==n,u,null==i,t.textDirection),{top:w,bottom:b,horizontal:M}}function x(t,n){var i=s.top+(n?t.top:t.bottom);return{top:i,bottom:i,horizontal:[]}}}function xd(t,n){return t.constructor==n.constructor&&t.eq(n)}function Sd(t){return[pn.define((function(n){return new ne(n,t)})),ie.of(t)]}function Cd(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return[re.of(t),oe,ue,ae,cn.of(!0)]}function jd(t){return t.startState.facet(re)!=t.state.facet(re)}function Pd(t,n){n.style.animationDuration=t.facet(re).cursorBlinkRate+"ms"}function Od(){return[he,ce]}function Ed(t,n,i,e,r){n.lastIndex=0;for(var o=t.iterRange(i,e),u=i,s;!o.next().done;u+=o.value.length)if(!o.lineBreak)for(;s=n.exec(o.value);)r(u+s.index,s)}function Ad(t,n){var i,e,r,o,u,s,a=t.visibleRanges;if(1==a.length&&a[0].from==t.viewport.from&&a[0].to==t.viewport.to)return a;i=[],e=ic(a);try{for(e.s();!(r=e.n()).done;)u=(o=r.value).from,s=o.to,u=Math.max(t.state.doc.lineAt(u).from,u-n),s=Math.min(t.state.doc.lineAt(s).to,s+n),i.length&&i[i.length-1].to>=u?i[i.length-1].to=s:i.push({from:u,to:s})}catch(t){e.e(t)}finally{e.f()}return i}function Dd(){var t,n;return null==me&&"undefined"!=typeof document&&document.body&&(n=document.body.style,me=null!=(null!==(t=n.tabSize)&&void 0!==t?t:n.MozTabSize)),me||!1}function Rd(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return[pe.of(t),Id()]}function Id(){return ke||(ke=pn.fromClass(function(){function t(n){yc(this,t),this.view=n,this.decorations=Jt.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(n.state.facet(pe)),this.decorations=this.decorator.createDeco(n)}return pc(t,[{key:"makeDecorator",value:function t(n){var i=this;return new le({regexp:n.specialChars,decoration:function t(e,r,o){var u,s,a,f=r.state.doc,h=Ac(e[0],0);return 9==h?(u=f.lineAt(o),s=r.state.tabSize,a=ll(u.text,s,o-u.from),Jt.replace({widget:new be((s-a%s)*i.view.defaultCharacterWidth)})):i.decorationCache[h]||(i.decorationCache[h]=Jt.replace({widget:new we(n,h)}))},boundary:n.replaceTabs?void 0:/[^]/})}},{key:"update",value:function t(n){var i=n.state.facet(pe);n.startState.facet(pe)!=i?(this.decorator=this.makeDecorator(i),this.decorations=this.decorator.createDeco(n.view)):this.decorations=this.decorator.updateDeco(n,this.decorations)}}]),t}(),{decorations:function t(n){return n.decorations}}))}function Td(t){return t>=32?ge:10==t?"\u2424":String.fromCharCode(9216+t)}function Ld(){return[Me,wn.of((function(t){var n;return(null===(n=t.plugin(Me))||void 0===n?void 0:n.attrs)||null}))]}function Bd(){return Se}function _d(t){return pn.fromClass(function(){function n(i){yc(this,n),this.view=i,this.placeholder=Jt.set([Jt.widget({widget:new Ce(t),side:1}).range(0)])}return pc(n,[{key:"decorations",get:function t(){return this.view.state.doc.length?Jt.none:this.placeholder}}]),n}(),{decorations:function t(n){return n.decorations}})}function Fd(t,n,i){var e,r,o,u,s,a,f,h,c,l,v=Math.min(n.line,i.line),d=Math.max(n.line,i.line),y=[];if(n.off>je||i.off>je||n.col<0||i.col<0)for(e=Math.min(n.off,i.off),r=Math.max(n.off,i.off),o=v;o<=d;o++)(u=t.doc.line(o)).length<=r&&y.push(k.range(u.from+e,u.to+r));else for(s=Math.min(n.col,i.col),a=Math.max(n.col,i.col),f=v;f<=d;f++)(c=vl((h=t.doc.line(f)).text,s,t.tabSize,!0))<0?y.push(k.cursor(h.to)):(l=vl(h.text,a,t.tabSize),y.push(k.range(h.from+c,h.from+l)));return y}function Nd(t,n){var i=t.coordsAtPos(t.viewport.from);return i?Math.round(Math.abs((i.left-n)/t.defaultCharacterWidth)):-1}function Ud(t,n){var i=t.posAtCoords({x:n.clientX,y:n.clientY},!1),e=t.state.doc.lineAt(i),r=i-e.from,o=r>je?-1:r==e.length?Nd(t,n.clientX):ll(e.text,t.state.tabSize,i-e.from);return{line:e.number,col:o,off:r}}function Hd(t,n){var i=Ud(t,n),e=t.state.selection;return i?{update:function t(n){var r,o;n.docChanged&&(r=n.changes.mapPos(n.startState.doc.line(i.line).from),o=n.state.doc.lineAt(r),i={line:o.number,col:i.col,off:Math.min(i.off,o.length)},e=e.map(n.changes))},get:function n(r,o,u){var s,a=Ud(t,r);return a&&(s=Fd(t.state,i,a)).length?u?k.create(s.concat(e.ranges)):k.create(s):e}}:null}function zd(t){var n=(null==t?void 0:t.eventFilter)||function(t){return t.altKey&&0==t.button};return Vi.mouseSelectionStyle.of((function(t,i){return n(i)?Hd(t,i):null}))}function Wd(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=Zh(Pe[t.key||"Alt"],2),i=n[0],e=n[1],r=pn.fromClass(function(){function t(n){yc(this,t),this.view=n,this.isDown=!1}return pc(t,[{key:"set",value:function t(n){this.isDown!=n&&(this.isDown=n,this.view.update([]))}}]),t}(),{eventHandlers:{keydown:function t(n){this.set(n.keyCode==i||e(n))},keyup:function t(n){n.keyCode!=i&&e(n)||this.set(!1)},mousemove:function t(n){this.set(e(n))}}});return[r,Vi.contentAttributes.of((function(t){var n;return(null===(n=t.plugin(r))||void 0===n?void 0:n.isDown)?Oe:null}))]}function Vd(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return De.of(t)}function $d(t){var n=t.win;return{top:0,left:0,bottom:n.innerHeight,right:n.innerWidth}}function qd(t){for(var n=t;n;n=n.parentNode)if(1==n.nodeType&&n.classList.contains("cm-tooltip"))return!0;return!1}function Gd(t,n,i,e,r,o){var u,s,a,f,h=document.createRange(),c=t.domAtPos(n),l=t.domAtPos(i);for(h.setEnd(l.node,l.offset),h.setStart(c.node,c.offset),u=h.getClientRects(),h.detach(),s=0;s<u.length;s++)if(a=u[s],(f=Math.max(a.top-r,r-a.bottom,a.left-e,e-a.right))<=o)return!0;return!1}function Jd(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=V.define(),e=x.define({create:function t(){return null},update:function t(e,r){var o,u,s,a,f;if(e&&(n.hideOnChange&&(r.docChanged||r.selection)||n.hideOn&&n.hideOn(r,e)))return null;if(e&&r.docChanged){if(null==(o=r.changes.mapPos(e.pos,-1,v.TrackDel)))return null;(u=Object.assign(Object.create(null),e)).pos=o,null!=e.end&&(u.end=r.changes.mapPos(e.end)),e=u}s=ic(r.effects);try{for(s.s();!(a=s.n()).done;)(f=a.value).is(i)&&(e=f.value),f.is(He)&&(e=null)}catch(t){s.e(t)}finally{s.f()}return e},provide:function t(n){return _e.from(n)}});return[e,pn.define((function(r){return new Ue(r,t,e,i,n.hoverTime||300)})),Ne]}function Kd(t,n){var i,e=t.plugin(Ie);return e?(i=e.manager.tooltips.indexOf(n))<0?null:e.manager.tooltipViews[i]:null}function Qd(t){return t.facet(_e).some((function(t){return t}))}function Xd(t){var n;null===(n=t.plugin(Ie))||void 0===n||n.maybeMeasure()}function Zd(t){return t?[We.of(t)]:[]}function Yd(t,n){var i=t.plugin(Ve),e=i?i.specs.indexOf(n):-1;return e>-1?i.panels[e]:null}function ty(t){var n=t.nextSibling;return t.remove(),n}function ny(t){return[iy(),Qe.of(Object.assign(Object.assign({},Ke),t))]}function iy(t){var n=[Ze];return t&&!1===t.fixed&&n.push(Xe.of(!0)),n}function ey(t){return Array.isArray(t)?t:[t]}function ry(t,n,i){for(;t.value&&t.from<=i;)t.from==i&&n.push(t.value),t.next()}function oy(t,n){if(t.length!=n.length)return!1;for(var i=0;i<t.length;i++)if(!t[i].compare(n[i]))return!1;return!0}function uy(t,n){return t.state.facet(er).formatNumber(n,t.state)}function sy(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return[er.of(t),iy(),or]}function ay(t){for(var n=9;n<t;)n=10*n+9;return n}function fy(){return sr}function hy(t){var n=ar.get(t);return n||ar.set(t,n=Jt.mark({attributes:"\t"===t?{class:"cm-highlightTab"}:{class:"cm-highlightSpace","data-display":t.replace(/ /g,"\xb7")}})),n}function cy(t){return pn.define((function(n){return{decorations:t.createDeco(n),update:function n(i){this.decorations=t.updateDeco(i,this.decorations)}}}),{decorations:function t(n){return n.decorations}})}function ly(){return fr}function vy(){return hr}function dy(t,n,i,e){switch(t){case-2:return i<n;case-1:return e>=n&&i<n;case 0:return i<n&&e>n;case 1:return i<=n&&e>n;case 2:return e>n;case 4:return!0}}function yy(t,n){for(var i,e=t.childBefore(n);e&&(i=e.lastChild)&&i.to==e.to;)i.type.isError&&i.from==i.to?(t=e,e=i.prevSibling):e=i;return t}function my(t,n,i,e){for(var r,o,u,s,a,f;t.from==t.to||(i<1?t.from>=n:t.from>n)||(i>-1?t.to<=n:t.to<n);){if(!(o=!e&&t instanceof jr&&t.index<0?null:t.parent))return t;t=o}if(u=e?0:Mr.IgnoreOverlays,e)for(a=(s=t).parent;a;a=(s=a).parent)s instanceof jr&&s.index<0&&(null===(r=a.enter(n,i,u))||void 0===r?void 0:r.from)!=s.from&&(t=a);for(;;){if(!(f=t.enter(n,i,u)))return t;t=f}}function py(t,n,i,e){var r=t.cursor(),o=[];if(!r.firstChild())return o;if(null!=i)for(;!r.type.is(i);)if(!r.nextSibling())return o;for(;;){if(null!=e&&r.type.is(e))return o;if(r.type.is(n)&&o.push(r.node),!r.nextSibling())return null==e?o:[]}}function ky(t,n){var i,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:n.length-1;for(i=t.parent;e>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(n[e]&&n[e]!=i.name)return!1;e--}}return!0}function gy(t){return t.children.some((function(t){return t instanceof Cr||!t.type.isAnonymous||gy(t)}))}function wy(t){var n,i,e,r,o=t.buffer,u=t.nodeSet,s=t.maxBufferLength,a=void 0===s?vr:s,f=t.reused,h=void 0===f?[]:f,c=t.minRepeatType,l=void 0===c?u.types.length:c,v=Array.isArray(o)?new Sr(o,o.length):o,d=u.types,y=0,m=0;function p(t,n,i,e,r){for(var o,s,f,c,x,S,C,j,P,O,E,A,D,R,I,T=v.id,L=v.start,B=v.end,_=v.size,F=m;_<0;){if(v.next(),-1==_)return o=h[T],i.push(o),void e.push(L-t);if(-3==_)return void(y=T);if(-4==_)return void(m=T);throw new RangeError("Unrecognized record size: ".concat(_))}if(s=d[T],x=L-t,B-L<=a&&(c=b(v.pos-n,r))){for(S=new Uint16Array(c.size-c.skip),C=v.pos-c.size,j=S.length;v.pos>C;)j=M(c.start,S,j);f=new Cr(S,B-c.start,u),x=c.start-t}else{for(P=v.pos-_,v.next(),O=[],E=[],A=T>=l?T:-1,D=0,R=B;v.pos>P;)A>=0&&v.id==A&&v.size>=0?(v.end<=R-a&&(g(O,E,L,D,v.end,R,A,F),D=O.length,R=v.end),v.next()):p(L,P,O,E,A);A>=0&&D>0&&D<O.length&&g(O,E,L,D,L,R,A,F),O.reverse(),E.reverse(),A>-1&&D>0?(I=k(s),f=My(s,O,E,0,O.length,0,B-L,I,I)):f=w(s,O,E,B-L,F-B)}i.push(f),e.push(x)}function k(t){return function(n,i,e){var r=0,o=n.length-1,u,s;if(o>=0&&(u=n[o])instanceof xr){if(!o&&u.type==t&&u.length==e)return u;(s=u.prop(mr.lookAhead))&&(r=i[o]+u.length+s)}return w(t,n,i,e,r)}}function g(t,n,i,e,r,o,s,a){for(var f=[],h=[];t.length>e;)f.push(t.pop()),h.push(n.pop()+i-r);t.push(w(u.types[s],f,h,o-r,a-o)),n.push(r-i)}function w(t,n,i,e){var r,o,u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,s=arguments.length>5?arguments[5]:void 0;return y&&(r=[mr.contextHash,y],s=s?[r].concat(s):[r]),u>25&&(o=[mr.lookAhead,u],s=s?[o].concat(s):[o]),new xr(t,n,i,e,s)}function b(t,n){var i,e,r,o,u,s=v.fork(),f=0,h=0,c=0,d=s.end-a,y={size:0,start:0,skip:0};t:for(i=s.pos-t;s.pos>i;)if(e=s.size,s.id==n&&e>=0)y.size=f,y.start=h,y.skip=c,c+=4,f+=4,s.next();else{if(r=s.pos-e,e<0||r<i||s.start<d)break;for(o=s.id>=l?4:0,u=s.start,s.next();s.pos>r;){if(s.size<0){if(-3!=s.size)break t;o+=4}else s.id>=l&&(o+=4);s.next()}h=u,f+=e,c+=o}return(n<0||f==t)&&(y.size=f,y.start=h,y.skip=c),y.size>4?y:void 0}function M(t,n,i){var e,r,o=v.id,u=v.start,s=v.end,a=v.size;if(v.next(),a>=0&&o<l){if(e=i,a>4)for(r=v.pos-(a-4);v.pos>r;)i=M(t,n,i);n[--i]=e,n[--i]=s-t,n[--i]=u-t,n[--i]=o}else-3==a?y=o:-4==a&&(m=o);return i}for(i=[],e=[];v.pos>0;)p(t.start||0,t.bufferStart||0,i,e,-1);return r=null!==(n=t.length)&&void 0!==n?n:i.length?e[0]+i[0].length:0,new xr(d[t.topID],i.reverse(),e.reverse(),r)}function by(t,n){var i,e,r,o;if(!t.isAnonymous||n instanceof Cr||n.type!=t)return 1;if(null==(i=Ar.get(n))){i=1,e=ic(n.children);try{for(e.s();!(r=e.n()).done;){if((o=r.value).type!=t||!(o instanceof xr)){i=1;break}i+=by(t,o)}}catch(t){e.e(t)}finally{e.f()}Ar.set(n,i)}return i}function My(t,n,i,e,r,o,u,s,a){var f,h,c,l,v=0;for(f=e;f<r;f++)v+=by(t,n[f]);function d(n,i,e,r,u){var s,f,v,y,m,p,k;for(s=e;s<r;){for(f=s,v=i[s],y=by(t,n[s]),s++;s<r&&!(y+(m=by(t,n[s]))>=h);s++)y+=m;if(s==f+1){if(y>h){d((p=n[f]).children,p.positions,0,p.children.length,i[f]+u);continue}c.push(n[f])}else k=i[s-1]+n[s-1].length-v,c.push(My(t,n,i,f,s,v,k,null,a));l.push(v+u-o)}}return h=Math.ceil(1.5*v/8),c=[],l=[],d(n,i,e,r,0),(s||a)(c,l,u)}function xy(t,n){return t.length==n.length&&t.every((function(t,i){return t==n[i]}))}function Sy(t){var n,i,e,r=[[]];for(n=0;n<t.length;n++)for(i=0,e=r.length;i<e;i++)r.push(r[i].concat(t[n]));return r.sort((function(t,n){return n.length-t.length}))}function Cy(t){var n,i,e,r,o,u,s,a,f,h,c,l,v,d,y=Object.create(null);for(n in t){i=t[n],Array.isArray(i)||(i=[i]),e=ic(n.split(" "));try{for(e.s();!(r=e.n()).done;)if(o=r.value){for(u=[],s=2,a=o,f=0;;){if("..."==a&&f>0&&f+3==o.length){s=1;break}if(!(h=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a)))throw new RangeError("Invalid path: "+o);if(u.push("*"==h[0]?"":'"'==h[0][0]?JSON.parse(h[0]):h[0]),(f+=h[0].length)==o.length)break;if(c=o[f++],f==o.length&&"!"==c){s=0;break}if("/"!=c)throw new RangeError("Invalid path: "+o);a=o.slice(f)}if(!(v=u[l=u.length-1]))throw new RangeError("Invalid path: "+o);d=new Nr(i,s,l>0?u.slice(0,l):null),y[v]=d.sort(y[v])}}catch(t){e.e(t)}finally{e.f()}}return Fr.add(y)}function jy(t,n){var i,e,r,o,u,s,a,f,h,c=Object.create(null),l=ic(t);try{for(l.s();!(i=l.n()).done;)if(e=i.value,Array.isArray(e.tag)){r=ic(e.tag);try{for(r.s();!(o=r.n()).done;)u=o.value,c[u.id]=e.class}catch(t){r.e(t)}finally{r.f()}}else c[e.tag.id]=e.class}catch(t){l.e(t)}finally{l.f()}return a=(s=n||{}).scope,f=s.all,h=void 0===f?null:f,{style:function t(n){var i,e,r,o,u,s,a=h,f=ic(n);try{for(f.s();!(i=f.n()).done;){r=ic((e=i.value).set);try{for(r.s();!(o=r.n()).done;)if(u=o.value,s=c[u.id]){a=a?a+" "+s:s;break}}catch(t){r.e(t)}finally{r.f()}}}catch(t){f.e(t)}finally{f.f()}return a},scope:a}}function Py(t,n){var i,e,r,o=null,u=ic(t);try{for(u.s();!(i=u.n()).done;)(r=(e=i.value).style(n))&&(o=o?o+" "+r:r)}catch(t){u.e(t)}finally{u.f()}return o}function Oy(t,n,i){var e=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:t.length,o=new Ur(e,Array.isArray(n)?n:[n],i);o.highlightRange(t.cursor(),e,r,"",o.highlighters),o.flush(r)}function Ey(t){for(var n=t.type.prop(Fr);n&&n.context&&!t.matchContext(n.context);)n=n.next;return n||null}function Ay(t){return w.define({combine:t?function(n){return n.concat(t)}:void 0})}function Dy(t,n,i){var e,r=t.facet(mo),o=Ry(t).topNode;if(!r||r.allowsNesting)for(e=o;e;e=e.enter(n,i,Mr.ExcludeBuffers))e.type.isTop&&(o=e);return o}function Ry(t){var n=t.field(uo.state,!1);return n?n.tree:xr.empty}function Iy(t,n){var i,e,r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:50,u=null===(i=t.field(uo.state,!1))||void 0===i?void 0:i.context;return u?(e=u.viewport,u.updateViewport({from:0,to:n}),r=u.isDone(n)||u.work(o,n)?u.tree:null,u.updateViewport(e),r):null}function Ty(t){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.doc.length;return(null===(n=t.field(uo.state,!1))||void 0===n?void 0:n.context.isDone(i))||!1}function Ly(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.viewport.to,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:100,e=Iy(t.state,n,i);return e!=Ry(t.state)&&t.dispatch({}),!!e}function By(t){var n;return(null===(n=t.plugin(yo))||void 0===n?void 0:n.isWorking())||!1}function _y(t,n,i){return Dr.applyChanges(t,[{fromA:n,toA:i,fromB:n,toB:i}])}function Fy(t){var n=t.facet(wo);return 9==n.charCodeAt(0)?t.tabSize*n.length:n.length}function Ny(t,n){var i,e="",r=t.tabSize,o=t.facet(wo)[0];if("\t"==o){for(;n>=r;)e+="\t",n-=r;o=" "}for(i=0;i<n;i++)e+=o;return e}function Uy(t,n){var i,e,r,o,u;t instanceof Q&&(t=new bo(t)),i=ic(t.state.facet(go));try{for(i.s();!(e=i.n()).done;)if(void 0!==(o=(r=e.value)(t,n)))return o}catch(t){i.e(t)}finally{i.f()}return(u=Ry(t.state))?zy(t,u,n):null}function Hy(t,n,i){var e,r,o,u,s,a=Object.create(null),f=new bo(t,{overrideIndentation:function t(n){var i;return null!==(i=a[n])&&void 0!==i?i:-1}}),h=[];for(e=n;e<=i;)e=(r=t.doc.lineAt(e)).to+1,null!=(o=Uy(f,r.from))&&(/\S/.test(r.text)||(o=0),(u=/^\s*/.exec(r.text)[0])!=(s=Ny(t,o))&&(a[r.from]=o,h.push({from:r.from,to:r.from+u.length,insert:s})));return t.changes(h)}function zy(t,n,i){return $y(n.resolveInner(i).enterUnfinishedNodesBefore(i),i,t)}function Wy(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function Vy(t){var n,i,e,r,o=t.type.prop(Mo);return o||((n=t.firstChild)&&(i=n.type.prop(mr.closedBy))?(e=t.lastChild,r=e&&i.indexOf(e.name)>-1,function(t){return Qy(t,!0,1,void 0,r&&!Wy(t)?e.from:void 0)}):null==t.parent?qy:null)}function $y(t,n,i){for(;t;t=t.parent){var e=Vy(t);if(e)return e(xo.create(i,n,t))}return null}function qy(){return 0}function Gy(t,n){for(var i=n;i;i=i.parent)if(t==i)return!0;return!1}function Jy(t){var n,i,e,r,o,u=t.node,s=u.childAfter(u.from),a=u.lastChild;if(!s)return null;for(n=t.options.simulateBreak,i=t.state.doc.lineAt(s.from),e=null==n||n<=i.from?i.to:Math.min(i.to,n),r=s.to;;){if(!(o=u.childAfter(r))||o==a)return null;if(!o.type.isSkipped)return o.from<e?s:null;r=o.to}}function Ky(t){var n=t.closing,i=t.align,e=void 0===i||i,r=t.units,o=void 0===r?1:r;return function(t){return Qy(t,e,o,n)}}function Qy(t,n,i,e,r){var o=t.textAfter,u=o.match(/^\s*/)[0].length,s=e&&o.slice(u,u+e.length)==e||r==t.pos+u,a=n?Jy(t):null;return a?s?t.column(a.from):t.column(a.to):t.baseIndent+(s?0:t.unit*i)}function Xy(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.except,i=t.units,e=void 0===i?1:i;return function(t){var i=n&&n.test(t.textAfter);return t.baseIndent+(i?0:e*t.unit)}}function Zy(){return Q.transactionFilter.of((function(t){var n,i,e,r,o,u,s,a,f,h,c,l,v,d,y;if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;if(!(n=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head)).length)return t;if(i=t.newDoc,(e=t.newSelection.main.head)>(r=i.lineAt(e)).from+Co)return t;if(o=i.sliceString(r.from,e),!n.some((function(t){return t.test(o)})))return t;s=-1,a=[],f=ic((u=t.state).selection.ranges);try{for(f.s();!(h=f.n()).done;)c=h.value.head,(l=u.doc.lineAt(c)).from!=s&&(s=l.from,null!=(v=Uy(u,l.from))&&(d=/^\s*/.exec(l.text)[0])!=(y=Ny(u,v))&&a.push({from:l.from,to:l.from+d.length,insert:y}))}catch(t){f.e(t)}finally{f.f()}return a.length?[t,{changes:a,sequential:!0}]:t}))}function Yy(t){var n=t.firstChild,i=t.lastChild;return n&&n.to<i.from?{from:n.to,to:i.type.isError?t.to:i.from}:null}function tm(t,n,i){var e,r,o,u,s,a=Ry(t);if(a.length<i)return null;for(r=null,o=e=a.resolveInner(i,1);o;o=o.parent)if(!(o.to<=i||o.from>i)){if(r&&o.from<n)break;(u=o.type.prop(Po))&&(o.to<a.length-50||a.length==t.doc.length||!nm(o))&&(s=u(o,t))&&s.from<=i&&s.from>=n&&s.to>i&&(r=s)}return r}function nm(t){var n=t.lastChild;return n&&n.to==t.to&&n.type.isError}function im(t,n,i){var e,r,o,u=ic(t.facet(jo));try{for(u.s();!(e=u.n()).done;)if(o=(r=e.value)(t,n,i))return o}catch(t){u.e(t)}finally{u.f()}return tm(t,n,i)}function em(t,n){var i=n.mapPos(t.from,1),e=n.mapPos(t.to,-1);return i>=e?void 0:{from:i,to:e}}function rm(t){var n,i,e=[],r=ic(t.state.selection.ranges);try{for(i=function i(){var r=n.value.head;if(e.some((function(t){return t.from<=r&&t.to>=r})))return 1;e.push(t.lineBlockAt(r))},r.s();!(n=r.n()).done;)i()}catch(t){r.e(t)}finally{r.f()}return e}function om(t){return t.field(Ao,!1)||tt.empty}function um(t,n,i){var e,r=null;return null===(e=t.field(Ao,!1))||void 0===e||e.between(n,i,(function(t,n){(!r||r.from>t)&&(r={from:t,to:n})})),r}function sm(t,n,i){var e=!1;return t.between(n,n,(function(t,r){t==n&&r==i&&(e=!0)})),e}function am(t,n){return t.field(Ao,!1)?n:n.concat(V.appendConfig.of(cm()))}function fm(t,n){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],e=t.state.doc.lineAt(n.from).number,r=t.state.doc.lineAt(n.to).number;return Vi.announce.of("".concat(t.state.phrase(i?"Folded lines":"Unfolded lines")," ").concat(e," ").concat(t.state.phrase("to")," ").concat(r,"."))}function hm(t,n){var i,e;for(i=n;;){if((e=im(t.state,i.from,i.to))&&e.to>n.from)return e;if(!i.from)return null;i=t.lineBlockAt(i.from-1)}}function cm(t){var n=[Ao,zo];return t&&n.push(Fo.of(t)),n}function lm(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=Object.assign(Object.assign({},Uo),t),i=new Ho(n,!0),e=new Ho(n,!1),r=pn.fromClass(function(){function t(n){yc(this,t),this.from=n.viewport.from,this.markers=this.buildMarkers(n)}return pc(t,[{key:"update",value:function t(i){(i.docChanged||i.viewportChanged||i.startState.facet(mo)!=i.state.facet(mo)||i.startState.field(Ao,!1)!=i.state.field(Ao,!1)||Ry(i.startState)!=Ry(i.state)||n.foldingChanged(i))&&(this.markers=this.buildMarkers(i.view))}},{key:"buildMarkers",value:function t(n){var r,o,u,s=new nt,a=ic(n.viewportLineBlocks);try{for(a.s();!(r=a.n()).done;)o=r.value,(u=um(n.state,o.from,o.to)?e:im(n.state,o.from,o.to)?i:null)&&s.add(o.from,o.from,u)}catch(t){a.e(t)}finally{a.f()}return s.finish()}}]),t}()),o=n.domEventHandlers;return[r,ny({class:"cm-foldGutter",markers:function t(n){var i;return(null===(i=n.plugin(r))||void 0===i?void 0:i.markers)||tt.empty},initialSpacer:function t(){return new Ho(n,!1)},domEventHandlers:Object.assign(Object.assign({},o),{click:function t(n,i,e){var r,u;return!(!o.click||!o.click(n,i,e))||((r=um(n.state,i.from,i.to))?(n.dispatch({effects:Eo.of(r)}),!0):!!(u=im(n.state,i.from,i.to))&&(n.dispatch({effects:Oo.of(u)}),!0))}})}),cm()]}function vm(t){var n=t.facet(Vo);return n.length?n:t.facet($o)}function dm(t,n){var i=[Go],e;return t instanceof Wo&&(t.module&&i.push(Vi.styleModule.of(t.module)),e=t.themeType),(null==n?void 0:n.fallback)?i.push($o.of(t)):e?i.push(Vo.computeN([Vi.darkTheme],(function(n){return n.facet(Vi.darkTheme)==("dark"==e)?[t]:[]}))):i.push(Vo.of(t)),i}function ym(t,n,i){var e,r,o,u,s=vm(t),a=null;if(s){e=ic(s);try{for(e.s();!(r=e.n()).done;)(!(o=r.value).scope||i&&o.scope(i))&&(u=o.style(n))&&(a=a?a+" "+u:u)}catch(t){e.e(t)}finally{e.f()}}return a}function mm(t){var n=[],i=t.matched?Yo:tu;return n.push(i.range(t.start.from,t.start.to)),t.end&&n.push(i.range(t.end.from,t.end.to)),n}function pm(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return[Zo.of(t),iu]}function km(t,n,i){var e,r=t.prop(n<0?mr.openedBy:mr.closedBy);return r||(1==t.name.length&&(e=i.indexOf(t.name))>-1&&e%2==(n<0?1:0)?[i[e+n]]:null)}function gm(t){var n=t.type.prop(eu);return n?n(t.node):t}function wm(t,n,i){var e,r,o,u=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},s=u.maxScanDistance||Qo,a=u.brackets||Xo,f=Ry(t),h=f.resolveInner(n,i);for(e=h;e;e=e.parent)if((r=km(e.type,i,a))&&e.from<e.to&&(o=gm(e))&&(i>0?n>=o.from&&n<o.to:n>o.from&&n<=o.to))return bm(t,n,i,e,o,r,a);return Mm(t,n,i,f,h.type,s,a)}function bm(t,n,i,e,r,o,u){var s,a,f=e.parent,h={from:r.from,to:r.to},c=0,l=null==f?void 0:f.cursor();if(l&&(i<0?l.childBefore(e.from):l.childAfter(e.to)))do{if(i<0?l.to<=e.from:l.from>=e.to){if(0==c&&o.indexOf(l.type.name)>-1&&l.from<l.to)return{start:h,end:(s=gm(l))?{from:s.from,to:s.to}:void 0,matched:!0};if(km(l.type,i,u))c++;else if(km(l.type,-i,u)){if(0==c)return{start:h,end:(a=gm(l))&&a.from<a.to?{from:a.from,to:a.to}:void 0,matched:!1};c--}}}while(i<0?l.prevSibling():l.nextSibling());return{start:h,matched:!1}}function Mm(t,n,i,e,r,o,u){var s,a,f,h,c,l,v,d,y,m=i<0?t.sliceDoc(n-1,n):t.sliceDoc(n,n+1),p=u.indexOf(m);if(p<0||p%2==0!=i>0)return null;for(s={from:i<0?n-1:n,to:i>0?n+1:n},a=t.doc.iterRange(n,i>0?t.doc.length:0),f=0,h=0;!a.next().done&&h<=o;){for(c=a.value,i<0&&(h+=c.length),l=n+h*i,v=i>0?0:c.length-1,d=i>0?c.length:-1;v!=d;v+=i)if(!((y=u.indexOf(c[v]))<0||e.resolveInner(l+v,1).type!=r))if(y%2==0==i>0)f++;else{if(1==f)return{start:s,end:{from:l+v,to:l+v+1},matched:y>>1==p>>1};f--}i>0&&(h+=c.length)}return a.done?{start:s,matched:!1}:null}function xm(t,n,i){var e,r,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;for(null==n&&-1==(n=t.search(/[^\s\u00a0]/))&&(n=t.length),e=u,r=o;r<n;r++)9==t.charCodeAt(r)?e+=i-e%i:e++;return e}function Sm(t){return{name:t.name||"",token:t.token,blankLine:t.blankLine||function(){},startState:t.startState||function(){return!0},copyState:t.copyState||Cm,indent:t.indent||function(){return null},languageData:t.languageData||{},tokenTable:t.tokenTable||au}}function Cm(t){var n,i,e;if("object"!=dc(t))return t;for(i in n={},t)e=t[i],n[i]=e instanceof Array?e.slice():e;return n}function jm(t,n,i,e,r){var o,u,s,a,f=i>=e&&i+n.length<=r&&n.prop(t.stateAfter);if(f)return{state:t.streamParser.copyState(f),pos:i+n.length};for(o=n.children.length-1;o>=0;o--)if(u=n.children[o],s=i+n.positions[o],a=u instanceof xr&&s<r&&jm(t,u,s,e,r))return a;return null}function Pm(t,n,i,e,r){var o,u,s,a;if(r&&i<=0&&e>=n.length)return n;for(r||n.type!=t.topNode||(r=!0),o=n.children.length-1;o>=0;o--)if(u=n.positions[o],s=n.children[o],a=void 0,u<e&&s instanceof xr){if(!(a=Pm(t,s,i-u,e-u,r)))break;return r?new xr(n.type,n.children.slice(0,o).concat(a),n.positions.slice(0,o+1),u+a.length):a}return null}function Om(t,n,i,e){var r,o,u,s,a,f,h=ic(n);try{for(h.s();!(r=h.n()).done;)if(u=(o=r.value).from+(o.openStart?25:0),s=o.to-(o.openEnd?25:0),a=u<=i&&s>i&&jm(t,o.tree,0-o.offset,i,s),f=void 0,a&&(f=Pm(t,o.tree,i+o.offset,a.pos+o.offset,!1)))return{state:a.state,tree:f}}catch(t){h.e(t)}finally{h.f()}return{state:t.streamParser.startState(e?Fy(e):4),tree:xr.empty}}function Em(t,n,i){var e,r;for(n.start=n.pos,e=0;e<10;e++)if(r=t(n,i),n.pos>n.start)return r;throw new Error("Stream parser failed to advance stream.")}for(Nn=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/,Un=function(){function t(n,i,e){yc(this,t),this.from=n,this.to=i,this.level=e}return pc(t,[{key:"dir",get:function t(){return this.level%2?En:On}},{key:"side",value:function t(n,i){return this.dir==i==n?this.to:this.from}}],[{key:"find",value:function t(n,i,e,r){var o,u,s=-1;for(o=0;o<n.length;o++)if((u=n[o]).from<=i&&u.to>=i){if(u.level==e)return o;(s<0||(0!=r?r<0?u.from<i:u.to>i:n[s].level>u.level))&&(s=o)}if(s<0)throw new RangeError("Index out of range");return s}}]),t}(),Hn=[],zn="",Wn="\uffff",Vn=function(){function t(n,i){yc(this,t),this.points=n,this.text="",this.lineSeparator=i.facet(Q.lineSeparator)}return pc(t,[{key:"append",value:function t(n){this.text+=n}},{key:"lineBreak",value:function t(){this.text+=Wn}},{key:"readRange",value:function t(n,i){var e,r,o,u,s,a;if(!n)return this;for(e=n.parentNode,r=n;this.findPointBefore(e,r),o=this.text.length,this.readNode(r),(u=r.nextSibling)!=i;)s=jt.get(r),a=jt.get(u),(s&&a?s.breakAfter:(s?s.breakAfter:uv(r))||uv(u)&&("BR"!=r.nodeName||r.cmIgnore)&&this.text.length>o)&&this.lineBreak(),r=u;return this.findPointBefore(e,i),this}},{key:"readTextNode",value:function t(n){var i,e,r,o,u,s,a,f,h,c,l=n.nodeValue,v=ic(this.points);try{for(v.s();!(i=v.n()).done;)(e=i.value).node==n&&(e.pos=this.text.length+Math.min(e.offset,l.length))}catch(t){v.e(t)}finally{v.f()}for(r=0,o=this.lineSeparator?null:/\r\n?|\n/g;u=-1,s=1,a=void 0,this.lineSeparator?(u=l.indexOf(this.lineSeparator,r),s=this.lineSeparator.length):(a=o.exec(l))&&(u=a.index,s=a[0].length),this.append(l.slice(r,u<0?l.length:u)),!(u<0);){if(this.lineBreak(),s>1){f=ic(this.points);try{for(f.s();!(h=f.n()).done;)(c=h.value).node==n&&c.pos>this.text.length&&(c.pos-=s-1)}catch(t){f.e(t)}finally{f.f()}}r=u+s}}},{key:"readNode",value:function t(n){var i,e,r;if(!n.cmIgnore)if(null!=(e=(i=jt.get(n))&&i.overrideDOMText))for(this.findPointInside(n,e.length),r=e.iter();!r.next().done;)r.lineBreak?this.lineBreak():this.append(r.value);else 3==n.nodeType?this.readTextNode(n):"BR"==n.nodeName?n.nextSibling&&this.lineBreak():1==n.nodeType&&this.readRange(n.firstChild,null)}},{key:"findPointBefore",value:function t(n,i){var e,r,o=ic(this.points);try{for(o.s();!(e=o.n()).done;)(r=e.value).node==n&&n.childNodes[r.offset]==i&&(r.pos=this.text.length)}catch(t){o.e(t)}finally{o.f()}}},{key:"findPointInside",value:function t(n,i){var e,r,o=ic(this.points);try{for(o.s();!(e=o.n()).done;)r=e.value,(3==n.nodeType?r.node==n:n.contains(r.node))&&(r.pos=this.text.length+Math.min(i,r.offset))}catch(t){o.e(t)}finally{o.f()}}}]),t}(),$n=pc((function t(n,i){yc(this,t),this.node=n,this.offset=i,this.pos=-1})),qn=function(t){sc(i,t);var n=fc(i);function i(t){var e;return yc(this,i),(e=n.call(this)).view=t,e.compositionDeco=Jt.none,e.decorations=[],e.dynamicDecorationMap=[],e.minWidth=0,e.minWidthFrom=0,e.minWidthTo=0,e.impreciseAnchor=null,e.impreciseHead=null,e.forceSelection=!1,e.lastUpdate=Date.now(),e.setDOM(t.contentDOM),e.children=[new Zt],e.children[0].setParent(cc(e)),e.updateDeco(),e.updateInner([new Cn(0,0,0,t.state.doc.length)],0),e}return pc(i,[{key:"length",get:function t(){return this.view.state.doc.length}},{key:"update",value:function t(n){var i,e,r,o=this,u=n.changedRanges;return this.minWidth>0&&u.length&&(u.every((function(t){var n=t.fromA,i;return t.toA<o.minWidthFrom||n>o.minWidthTo}))?(this.minWidthFrom=n.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=n.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.view.inputState.composing<0?this.compositionDeco=Jt.none:(n.transactions.length||this.dirty)&&(this.compositionDeco=fv(this.view,n.changes)),(Nt.ie||Nt.chrome)&&!this.compositionDeco.size&&n&&n.state.doc.lines!=n.startState.doc.lines&&(this.forceSelection=!0),r=lv(i=this.decorations,e=this.updateDeco(),n.changes),u=Cn.extendWithRanges(u,r),(0!=this.dirty||0!=u.length)&&(this.updateInner(u,n.startState.doc.length),n.transactions.length&&(this.lastUpdate=Date.now()),!0)}},{key:"updateInner",value:function t(n,i){var e,r,o,u,s,a=this;if(this.view.viewState.mustMeasureContent=!0,this.updateChildren(n,i),(e=this.view.observer).ignore((function(){a.dom.style.height=a.view.viewState.contentHeight+"px",a.dom.style.flexBasis=a.minWidth?a.minWidth+"px":"";var t=Nt.chrome||Nt.ios?{node:e.selectionRange.focusNode,written:!1}:void 0;a.sync(a.view,t),a.dirty=0,t&&(t.written||e.selectionRange.focusNode!=t.node)&&(a.forceSelection=!0),a.dom.style.height=""})),r=[],this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length){o=ic(this.children);try{for(o.s();!(u=o.n()).done;)(s=u.value)instanceof Yt&&s.widget instanceof Gn&&r.push(s.dom)}catch(t){o.e(t)}finally{o.f()}}e.updateGaps(r)}},{key:"updateChildren",value:function t(n,i){var e,r,o,u,s,a,f,h,c,l,v,d,y,m,p,k,g,w=this.childCursor(i);for(e=n.length-1;r=e>=0?n[e]:null;e--)o=r.fromA,u=r.toA,s=r.fromB,a=r.toB,h=(f=tn.build(this.view.state.doc,s,a,this.decorations,this.dynamicDecorationMap)).content,c=f.breakAtStart,l=f.openStart,v=f.openEnd,y=(d=w.findPos(u,1)).i,m=d.off,Ll(this,k=(p=w.findPos(o,-1)).i,g=p.off,y,m,h,c,l,v)}},{key:"updateSelection",value:function t(){var n,i,e,r,o,u,s,a,f,h=this,c=arguments.length>0&&void 0!==arguments[0]&&arguments[0],l=arguments.length>1&&void 0!==arguments[1]&&arguments[1];!c&&this.view.observer.selectionRange.focusNode||this.view.observer.readSelectionRange(),i=(n=this.view.root.activeElement)==this.dom,e=!i&&kl(this.dom,this.view.observer.selectionRange)&&!(n&&this.dom.contains(n)),(i||l||e)&&(r=this.forceSelection,this.forceSelection=!1,o=this.view.state.selection.main,u=this.domAtPos(o.anchor),s=o.empty?u:this.domAtPos(o.head),Nt.gecko&&o.empty&&!this.compositionDeco.size&&sv(u)&&(a=document.createTextNode(""),this.view.observer.ignore((function(){return u.node.insertBefore(a,u.node.childNodes[u.offset]||null)})),u=s=new St(a,0),r=!0),f=this.view.observer.selectionRange,!r&&f.focusNode&&wl(u.node,u.offset,f.anchorNode,f.anchorOffset)&&wl(s.node,s.offset,f.focusNode,f.focusOffset)||(this.view.observer.ignore((function(){var t,i,r,a,c;if(Nt.android&&Nt.chrome&&h.dom.contains(f.focusNode)&&vv(f.focusNode,h.dom)&&(h.dom.blur(),h.dom.focus({preventScroll:!0})),t=yl(h.view.root))if(o.empty)Nt.gecko&&(i=cv(u.node,u.offset))&&3!=i&&(r=hv(u.node,u.offset,1==i?1:-1))&&(u=new St(r,1==i?0:r.nodeValue.length)),t.collapse(u.node,u.offset),null!=o.bidiLevel&&null!=f.cursorBidiLevel&&(f.cursorBidiLevel=o.bidiLevel);else if(t.extend){t.collapse(u.node,u.offset);try{t.extend(s.node,s.offset)}catch(t){}}else a=document.createRange(),o.anchor>o.head&&(u=(c=[s,u])[0],s=c[1]),a.setEnd(s.node,s.offset),a.setStart(u.node,u.offset),t.removeAllRanges(),t.addRange(a);else;e&&h.view.root.activeElement==h.dom&&(h.dom.blur(),n&&n.focus())})),this.view.observer.setSelectionRange(u,s)),this.impreciseAnchor=u.precise?null:new St(f.anchorNode,f.anchorOffset),this.impreciseHead=s.precise?null:new St(f.focusNode,f.focusOffset))}},{key:"enforceCursorAssoc",value:function t(){var n,i,e,r,o,u,s,a,f,h,c,l;this.compositionDeco.size||(i=(n=this.view).state.selection.main,e=yl(n.root),o=(r=n.observer.selectionRange).anchorNode,u=r.anchorOffset,e&&i.empty&&i.assoc&&e.modify&&(s=Zt.find(this,i.head))&&(a=s.posAtStart,i.head!=a&&i.head!=a+s.length&&(f=this.coordsAt(i.head,-1),h=this.coordsAt(i.head,1),!f||!h||f.bottom>h.top||(c=this.domAtPos(i.head+i.assoc),e.collapse(c.node,c.offset),e.modify("move",i.assoc<0?"forward":"backward","lineboundary"),n.observer.readSelectionRange(),l=n.observer.selectionRange,n.docView.posFromDOM(l.anchorNode,l.anchorOffset)!=i.from&&e.collapse(o,u)))))}},{key:"nearest",value:function t(n){var i,e;for(i=n;i;){if((e=jt.get(i))&&e.rootView==this)return e;i=i.parentNode}return null}},{key:"posFromDOM",value:function t(n,i){var e=this.nearest(n);if(!e)throw new RangeError("Trying to find position for a DOM position outside of the document");return e.localPosFromDOM(n,i)+e.posAtStart}},{key:"domAtPos",value:function t(n){for(var i,e=this.childCursor().findPos(n,-1),r=e.i,o=e.off;r<this.children.length-1&&!(o<(i=this.children[r]).length||i instanceof Zt);)r++,o=0;return this.children[r].domAtPos(o)}},{key:"coordsAt",value:function t(n,i){var e,r,o,u;for(e=this.length,r=this.children.length-1;;r--){if(n>(u=e-(o=this.children[r]).breakAfter-o.length)||n==u&&o.type!=Gt.WidgetBefore&&o.type!=Gt.WidgetAfter&&(!r||2==i||this.children[r-1].breakAfter||this.children[r-1].type==Gt.WidgetBefore&&i>-2))return o.coordsAt(n-u,i);e=u}}},{key:"measureVisibleLineHeights",value:function t(n){var i,e,r,o,u,s,a,f,h,c=[],l=n.from,v=n.to,d=this.view.contentDOM.clientWidth,y=d>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,m=-1,p=this.view.textDirection==Pn.LTR;for(i=0,e=0;e<this.children.length&&!((o=i+(r=this.children[e]).length)>v);e++)i>=l&&(u=r.dom.getBoundingClientRect(),c.push(u.height),y&&(a=(s=r.dom.lastChild)?gl(s):[]).length&&(f=a[a.length-1],(h=p?f.right-u.left:u.right-f.left)>m&&(m=h,this.minWidth=d,this.minWidthFrom=i,this.minWidthTo=o))),i=o+r.breakAfter;return c}},{key:"textDirectionAt",value:function t(n){var i,e=this.childPos(n,1).i;return"rtl"==getComputedStyle(this.children[e].dom).direction?Pn.RTL:Pn.LTR}},{key:"measureTextSize",value:function t(){var n,i,e,r,o,u,s,a=this,f=ic(this.children);try{for(f.s();!(n=f.n()).done;)if((i=n.value)instanceof Zt&&(e=i.measureTextSize()))return e}catch(t){f.e(t)}finally{f.f()}return(r=document.createElement("div")).className="cm-line",r.style.width="99999px",r.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore((function(){a.dom.appendChild(r);var t=gl(r.firstChild)[0];o=r.getBoundingClientRect().height,u=t?t.width/27:7,s=t?t.height:o,r.remove()})),{lineHeight:o,charWidth:u,textHeight:s}}},{key:"childCursor",value:function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.length,i=this.children.length;return i&&(n-=this.children[--i].length),new Pt(this.children,n,i)}},{key:"computeBlockGapDeco",value:function t(){var n,i,e,r,o,u=[],s=this.view.viewState;for(n=0,i=0;(r=(e=i==s.viewports.length?null:s.viewports[i])?e.from-1:this.length)>n&&(o=s.lineBlockAt(r).bottom-s.lineBlockAt(n).top,u.push(Jt.replace({widget:new Gn(o),block:!0,inclusive:!0,isBlockGap:!0}).range(n,r))),e;i++)n=e.to+1;return Jt.set(u)}},{key:"updateDeco",value:function t(){var n,i=this,e=this.view.state.facet(bn).map((function(t,n){var e;return(i.dynamicDecorationMap[n]="function"==typeof t)?t(i.view):t}));for(n=e.length;n<e.length+3;n++)this.dynamicDecorationMap[n]=!1;return this.decorations=[].concat(Jh(e),[this.compositionDeco,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco])}},{key:"scrollIntoView",value:function t(n){var i,e,r,o=n.range,u=this.coordsAt(o.head,o.empty?o.assoc:o.head>o.anchor?-1:1);u&&(!o.empty&&(i=this.coordsAt(o.anchor,o.anchor>o.head?-1:1))&&(u={left:Math.min(u.left,i.left),top:Math.min(u.top,i.top),right:Math.max(u.right,i.right),bottom:Math.max(u.bottom,i.bottom)}),e=tv(this.view),r={left:u.left-e.left,top:u.top-e.top,right:u.right+e.right,bottom:u.bottom+e.bottom},jl(this.view.scrollDOM,r,o.head<o.anchor?-1:1,n.x,n.y,n.xMargin,n.yMargin,this.view.textDirection==Pn.LTR))}}]),i}(jt),Gn=function(t){sc(i,t);var n=fc(i);function i(t){var e;return yc(this,i),(e=n.call(this)).height=t,e}return pc(i,[{key:"toDOM",value:function t(){var n=document.createElement("div");return this.updateDOM(n),n}},{key:"eq",value:function t(n){return n.height==this.height}},{key:"updateDOM",value:function t(n){return n.style.height=this.height+"px",!0}},{key:"estimatedHeight",get:function t(){return this.height}}]),i}(qt),Jn=function(t){sc(i,t);var n=fc(i);function i(t,e,r){var o;return yc(this,i),(o=n.call(this)).top=t,o.text=e,o.topView=r,o}return pc(i,[{key:"eq",value:function t(n){return this.top==n.top&&this.text==n.text}},{key:"toDOM",value:function t(){return this.top}},{key:"ignoreEvent",value:function t(){return!1}},{key:"customView",get:function t(){return Vt}}]),i}(qt),Kn=function(){function t(){yc(this,t),this.changes=[]}return pc(t,[{key:"compareRange",value:function t(n,i){Xl(n,i,this.changes)}},{key:"comparePoint",value:function t(n,i){Xl(n,i,this.changes)}}]),t}(),Qn=function(){function t(n){var i,e,r,o=this;for(r in yc(this,t),this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.chromeScrollHack=-1,this.pendingIOSKey=void 0,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastEscPress=0,this.lastContextMenu=0,this.scrollHandlers=[],this.registeredEvents=[],this.customHandlers=[],this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null,i=function t(i,e){o.ignoreDuringComposition(e)||"keydown"==e.type&&o.keydown(n,e)||(o.mustFlushObserver(e)&&n.observer.forceFlush(),o.runCustomHandlers(e.type,n,e)?e.preventDefault():i(n,e))},e=function t(){var e=ii[r];n.contentDOM.addEventListener(r,(function(t){Bv(n,t)&&i(e,t)}),ei[r]),o.registeredEvents.push(r)},ii)e();n.scrollDOM.addEventListener("mousedown",(function(t){if(t.target==n.scrollDOM&&t.clientY>n.contentDOM.getBoundingClientRect().bottom&&(i(ii.mousedown,t),!t.defaultPrevented&&2==t.button)){var e=n.contentDOM.style.minHeight;n.contentDOM.style.minHeight="100%",setTimeout((function(){return n.contentDOM.style.minHeight=e}),200)}})),n.scrollDOM.addEventListener("drop",(function(t){t.target==n.scrollDOM&&t.clientY>n.contentDOM.getBoundingClientRect().bottom&&i(ii.drop,t)})),Nt.chrome&&102==Nt.chrome_version&&n.scrollDOM.addEventListener("wheel",(function(){o.chromeScrollHack<0?n.contentDOM.style.pointerEvents="none":window.clearTimeout(o.chromeScrollHack),o.chromeScrollHack=setTimeout((function(){o.chromeScrollHack=-1,n.contentDOM.style.pointerEvents=""}),100)}),{passive:!0}),this.notifiedFocused=n.hasFocus,Nt.safari&&n.contentDOM.addEventListener("input",(function(){return null}))}return pc(t,[{key:"setSelectionOrigin",value:function t(n){this.lastSelectionOrigin=n,this.lastSelectionTime=Date.now()}},{key:"ensureHandlers",value:function t(n,i){var e,r,o,u,s,a,f,h=this;this.customHandlers=[],o=ic(i);try{for(o.s();!(u=o.n()).done;)if(r=null===(e=(s=u.value).update(n).spec)||void 0===e?void 0:e.domEventHandlers)for(f in this.customHandlers.push({plugin:s.value,handlers:r}),a=function t(i){h.registeredEvents.indexOf(i)<0&&"scroll"!=i&&(h.registeredEvents.push(i),n.contentDOM.addEventListener(i,(function(t){Bv(n,t)&&h.runCustomHandlers(i,n,t)&&t.preventDefault()})))},r)a(f)}catch(t){o.e(t)}finally{o.f()}}},{key:"runCustomHandlers",value:function t(n,i,e){var r,o,u,s=ic(this.customHandlers);try{for(s.s();!(r=s.n()).done;)if(u=(o=r.value).handlers[n])try{if(u.call(o.plugin,e,i)||e.defaultPrevented)return!0}catch(t){Yl(i.state,t)}}catch(t){s.e(t)}finally{s.f()}return!1}},{key:"runScrollHandlers",value:function t(n,i){var e,r,o,u;this.lastScrollTop=n.scrollDOM.scrollTop,this.lastScrollLeft=n.scrollDOM.scrollLeft,e=ic(this.customHandlers);try{for(e.s();!(r=e.n()).done;)if(u=(o=r.value).handlers.scroll)try{u.call(o.plugin,i,n)}catch(t){Yl(n.state,t)}}catch(t){e.e(t)}finally{e.f()}}},{key:"keydown",value:function t(n,i){var e,r=this;return this.lastKeyCode=i.keyCode,this.lastKeyTime=Date.now(),9==i.keyCode&&Date.now()<this.lastEscPress+2e3||(27!=i.keyCode&&Yn.indexOf(i.keyCode)<0&&(n.inputState.lastEscPress=0),!Nt.android||!Nt.chrome||i.synthetic||13!=i.keyCode&&8!=i.keyCode?!(!Nt.ios||i.synthetic||i.altKey||i.metaKey||!((e=Xn.find((function(t){return t.keyCode==i.keyCode})))&&!i.ctrlKey||Zn.indexOf(i.key)>-1&&i.ctrlKey&&!i.shiftKey))&&(this.pendingIOSKey=e||i,setTimeout((function(){return r.flushIOSKey(n)}),250),!0):(n.observer.delayAndroidKey(i.key,i.keyCode),!0))}},{key:"flushIOSKey",value:function t(n){var i=this.pendingIOSKey;return!!i&&(this.pendingIOSKey=void 0,Al(n.contentDOM,i.key,i.keyCode))}},{key:"ignoreDuringComposition",value:function t(n){return!!/^key/.test(n.type)&&(this.composing>0||!!(Nt.safari&&!Nt.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100)&&(this.compositionPendingKey=!1,!0))}},{key:"mustFlushObserver",value:function t(n){return"keydown"==n.type&&229!=n.keyCode}},{key:"startMouseSelection",value:function t(n){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=n}},{key:"update",value:function t(n){this.mouseSelection&&this.mouseSelection.update(n),n.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}},{key:"destroy",value:function t(){this.mouseSelection&&this.mouseSelection.destroy()}}]),t}(),Xn=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Zn="dthko",Yn=[16,17,18,20,91,92,224,225],ti=6,ni=function(){function t(n,i,e,r){yc(this,t),this.view=n,this.style=e,this.mustSelect=r,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=i,this.scrollParent=Pl(n.contentDOM),this.atoms=n.state.facet(Mn).map((function(t){return t(n)}));var o=n.contentDOM.ownerDocument;o.addEventListener("mousemove",this.move=this.move.bind(this)),o.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=i.shiftKey,this.multiple=n.state.facet(Q.allowMultipleSelections)&&Iv(n,i),this.dragMove=Tv(n,i),this.dragging=!(!Lv(n,i)||1!=zv(i))&&null}return pc(t,[{key:"start",value:function t(n){!1===this.dragging&&(n.preventDefault(),this.select(n))}},{key:"move",value:function t(n){var i,e,r,o,u;if(0==n.buttons)return this.destroy();!1===this.dragging&&(this.select(this.lastEvent=n),e=0,r=0,o=(null===(i=this.scrollParent)||void 0===i?void 0:i.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight},u=tv(this.view),n.clientX-u.left<=o.left+ti?e=-Rv(o.left-n.clientX):n.clientX+u.right>=o.right-ti&&(e=Rv(n.clientX-o.right)),n.clientY-u.top<=o.top+ti?r=-Rv(o.top-n.clientY):n.clientY+u.bottom>=o.bottom-ti&&(r=Rv(n.clientY-o.bottom)),this.setScrollSpeed(e,r))}},{key:"up",value:function t(n){null==this.dragging&&this.select(this.lastEvent),this.dragging||n.preventDefault(),this.destroy()}},{key:"destroy",value:function t(){this.setScrollSpeed(0,0);var n=this.view.contentDOM.ownerDocument;n.removeEventListener("mousemove",this.move),n.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=null}},{key:"setScrollSpeed",value:function t(n,i){var e=this;this.scrollSpeed={x:n,y:i},n||i?this.scrolling<0&&(this.scrolling=setInterval((function(){return e.scroll()}),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}},{key:"scroll",value:function t(){this.scrollParent?(this.scrollParent.scrollLeft+=this.scrollSpeed.x,this.scrollParent.scrollTop+=this.scrollSpeed.y):this.view.win.scrollBy(this.scrollSpeed.x,this.scrollSpeed.y),!1===this.dragging&&this.select(this.lastEvent)}},{key:"skipAtoms",value:function t(n){var i,e,r,o,u,s,a=null;for(i=0;i<n.ranges.length;i++)r=null,(e=n.ranges[i]).empty?(o=Av(this.atoms,e.from,0))!=e.from&&(r=k.cursor(o,-1)):(u=Av(this.atoms,e.from,-1),s=Av(this.atoms,e.to,1),u==e.from&&s==e.to||(r=k.range(e.from==e.anchor?u:s,e.from==e.head?u:s))),r&&(a||(a=n.ranges.slice()),a[i]=r);return a?k.create(a,n.mainIndex):n}},{key:"select",value:function t(n){var i=this.view,e=this.skipAtoms(this.style.get(n,this.extend,this.multiple));!this.mustSelect&&e.eq(i.state.selection)&&e.main.assoc==i.state.selection.main.assoc||this.view.dispatch({selection:e,userEvent:"select.pointer"}),this.mustSelect=!1}},{key:"update",value:function t(n){var i=this;n.docChanged&&this.dragging&&(this.dragging=this.dragging.map(n.changes)),this.style.update(n)&&setTimeout((function(){return i.select(i.lastEvent)}),20)}}]),t}(),ii=Object.create(null),ei=Object.create(null),ri=Nt.ie&&Nt.ie_version<15||Nt.ios&&Nt.webkit_version<604,ii.keydown=function(t,n){t.inputState.setSelectionOrigin("select"),27==n.keyCode&&(t.inputState.lastEscPress=Date.now())},ii.touchstart=function(t,n){t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")},ii.touchmove=function(t){t.inputState.setSelectionOrigin("select.pointer")},ei.touchstart=ei.touchmove={passive:!0},ii.mousedown=function(t,n){var i,e,r,o,u;if(t.observer.flush(),!(t.inputState.lastTouchTime>Date.now()-2e3)){i=null,e=ic(t.state.facet(on));try{for(e.s();!(r=e.n()).done&&!(i=(o=r.value)(t,n)););}catch(t){e.e(t)}finally{e.f()}i||0!=n.button||(i=Wv(t,n)),i&&(u=t.root.activeElement!=t.contentDOM,t.inputState.startMouseSelection(new ni(t,n,i,u)),u&&t.observer.ignore((function(){return Ol(t.contentDOM)})),t.inputState.mouseSelection&&t.inputState.mouseSelection.start(n))}},oi=function t(n,i){return n>=i.top&&n<=i.bottom},ui=function t(n,i,e){return oi(i,e)&&n>=e.left&&n<=e.right},si=Nt.ie&&Nt.ie_version<=11,ai=null,fi=0,hi=0,ii.dragstart=function(t,n){var i=t.state.selection.main,e=t.inputState.mouseSelection;e&&(e.dragging=i),n.dataTransfer&&(n.dataTransfer.setData("Text",t.state.sliceDoc(i.from,i.to)),n.dataTransfer.effectAllowed="copyMove")},ii.drop=function(t,n){var i,e,r,o,u,s;if(n.dataTransfer){if(t.state.readOnly)return n.preventDefault();if((i=n.dataTransfer.files)&&i.length)for(n.preventDefault(),e=Array(i.length),r=0,o=function o(){++r==i.length&&$v(t,n,e.filter((function(t){return null!=t})).join(t.state.lineBreak),!1)},u=function t(n){var r=new FileReader;r.onerror=o,r.onload=function(){/[\x00-\x08\x0e-\x1f]{2}/.test(r.result)||(e[n]=r.result),o()},r.readAsText(i[n])},s=0;s<i.length;s++)u(s);else $v(t,n,n.dataTransfer.getData("Text"),!0)}},ii.paste=function(t,n){if(t.state.readOnly)return n.preventDefault();t.observer.flush();var i=ri?null:n.clipboardData;i?(Fv(t,i.getData("text/plain")||i.getData("text/uri-text")),n.preventDefault()):_v(t)},ci=null,ii.copy=ii.cut=function(t,n){var i,e=Gv(t.state),r=e.text,o=e.ranges,u=e.linewise;(r||u)&&(ci=u?r:null,(i=ri?null:n.clipboardData)?(n.preventDefault(),i.clearData(),i.setData("text/plain",r)):qv(t,r),"cut"!=n.type||t.state.readOnly||t.dispatch({changes:o,scrollIntoView:!0,userEvent:"delete.cut"}))},li=H.define(),ii.focus=function(t){t.inputState.lastFocusTime=Date.now(),t.scrollDOM.scrollTop||!t.inputState.lastScrollTop&&!t.inputState.lastScrollLeft||(t.scrollDOM.scrollTop=t.inputState.lastScrollTop,t.scrollDOM.scrollLeft=t.inputState.lastScrollLeft),Kv(t)},ii.blur=function(t){t.observer.clearSelectionRange(),Kv(t)},ii.compositionstart=ii.compositionupdate=function(t){null==t.inputState.compositionFirstChange&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0)},ii.compositionend=function(t){t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionPendingKey=!0,t.inputState.compositionPendingChange=t.observer.pendingRecords().length>0,t.inputState.compositionFirstChange=null,Nt.chrome&&Nt.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then((function(){return t.observer.flush()})):setTimeout((function(){t.inputState.composing<0&&t.docView.compositionDeco.size&&t.update([])}),50)},ii.contextmenu=function(t){t.inputState.lastContextMenu=Date.now()},ii.beforeinput=function(t,n){var i,e,r;Nt.chrome&&Nt.android&&(e=Xn.find((function(t){return t.inputType==n.inputType})))&&(t.observer.delayAndroidKey(e.key,e.keyCode),"Backspace"!=e.key&&"Delete"!=e.key||(r=(null===(i=window.visualViewport)||void 0===i?void 0:i.height)||0,setTimeout((function(){var n;((null===(n=window.visualViewport)||void 0===n?void 0:n.height)||0)>r+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())}),100)))},vi=["pre-wrap","normal","pre-line","break-spaces"],di=function(){function t(n){yc(this,t),this.lineWrapping=n,this.doc=i.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30,this.heightChanged=!1}return pc(t,[{key:"heightForGap",value:function t(n,i){var e=this.doc.lineAt(i).number-this.doc.lineAt(n).number+1;return this.lineWrapping&&(e+=Math.max(0,Math.ceil((i-n-e*this.lineLength*.5)/this.lineLength))),this.lineHeight*e}},{key:"heightForLine",value:function t(n){return this.lineWrapping?(1+Math.max(0,Math.ceil((n-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight;var i}},{key:"setDoc",value:function t(n){return this.doc=n,this}},{key:"mustRefreshForWrapping",value:function t(n){return vi.indexOf(n)>-1!=this.lineWrapping}},{key:"mustRefreshForHeights",value:function t(n){var i,e,r=!1;for(i=0;i<n.length;i++)(e=n[i])<0?i++:this.heightSamples[Math.floor(10*e)]||(r=!0,this.heightSamples[Math.floor(10*e)]=!0);return r}},{key:"refresh",value:function t(n,i,e,r,o,u){var s,a,f=vi.indexOf(n)>-1,h=Math.round(i)!=Math.round(this.lineHeight)||this.lineWrapping!=f;if(this.lineWrapping=f,this.lineHeight=i,this.charWidth=e,this.textHeight=r,this.lineLength=o,h)for(this.heightSamples={},s=0;s<u.length;s++)(a=u[s])<0?s++:this.heightSamples[Math.floor(10*a)]=!0;return h}}]),t}(),yi=function(){function t(n,i){yc(this,t),this.from=n,this.heights=i,this.index=0}return pc(t,[{key:"more",get:function t(){return this.index<this.heights.length}}]),t}(),mi=function(){function t(n,i,e,r,o,u){yc(this,t),this.from=n,this.length=i,this.top=e,this.height=r,this.children=o,this.deco=u}return pc(t,[{key:"type",get:function t(){var n,i,e;return null!==(e=null!==(n=this.children)&&void 0!==n?n:null===(i=this.deco)||void 0===i?void 0:i.type)&&void 0!==e?e:Gt.Text}},{key:"widget",get:function t(){return this.deco&&this.deco.widget}},{key:"to",get:function t(){return this.from+this.length}},{key:"bottom",get:function t(){return this.top+this.height}},{key:"join",value:function n(i){var e=(this.children||[this]).concat(i.children||[i]);return new t(this.from,this.length+i.length,this.top,this.height+i.height,e,null)}}]),t}(),pi=function(t){return t[t.ByPos=0]="ByPos",t[t.ByHeight=1]="ByHeight",t[t.ByPosNoHeight=2]="ByPosNoHeight",t}(pi||(pi={})),ki=.001,gi=function(){function t(n,i){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2;yc(this,t),this.length=n,this.height=i,this.flags=e}return pc(t,[{key:"outdated",get:function t(){return(2&this.flags)>0},set:function t(n){this.flags=(n?2:0)|-3&this.flags}},{key:"setHeight",value:function t(n,i){this.height!=i&&(Math.abs(this.height-i)>ki&&(n.heightChanged=!0),this.height=i)}},{key:"replace",value:function n(i,e,r){return t.of(r)}},{key:"decomposeLeft",value:function t(n,i){i.push(this)}},{key:"decomposeRight",value:function t(n,i){i.push(this)}},{key:"applyChanges",value:function t(n,i,e,r){var o,u,s,a,f,h,c,l,v,d=this,y=e.doc;for(o=r.length-1;o>=0;o--){for(s=(u=r[o]).fromA,a=u.toA,f=u.fromB,h=u.toB,h+=(l=(c=d.lineAt(s,pi.ByPosNoHeight,e.setDoc(i),0,0)).to>=a?c:d.lineAt(a,pi.ByPosNoHeight,e,0,0)).to-a,a=l.to;o>0&&c.from<=r[o-1].toA;)s=r[o-1].fromA,f=r[o-1].fromB,o--,s<c.from&&(c=d.lineAt(s,pi.ByPosNoHeight,e,0,0));f+=c.from-s,s=c.from,v=Ci.build(e.setDoc(y),n,f,h),d=d.replace(s,a,v)}return d.updateHeight(e,0)}}],[{key:"empty",value:function t(){return new bi(0,0)}},{key:"of",value:function n(i){var e,r,o,u,s,a,f,h,c;if(1==i.length)return i[0];for(e=0,r=i.length,o=0,u=0;;)if(e==r)if(o>2*u)(s=i[e-1]).break?i.splice(--e,1,s.left,null,s.right):i.splice(--e,1,s.left,s.right),r+=1+s.break,o-=s.size;else{if(!(u>2*o))break;(a=i[r]).break?i.splice(r,1,a.left,null,a.right):i.splice(r,1,a.left,a.right),r+=2+a.break,u-=a.size}else o<u?(f=i[e++])&&(o+=f.size):(h=i[--r])&&(u+=h.size);return c=0,null==i[e-1]?(c=1,e--):null==i[e]&&(c=1,r++),new xi(t.of(i.slice(0,e)),c,t.of(i.slice(r)))}}]),t}(),gi.prototype.size=1,wi=function(t){sc(i,t);var n=fc(i);function i(t,e,r){var o;return yc(this,i),(o=n.call(this,t,e)).deco=r,o}return pc(i,[{key:"blockAt",value:function t(n,i,e,r){return new mi(r,this.length,e,this.height,null,this.deco)}},{key:"lineAt",value:function t(n,i,e,r,o){return this.blockAt(0,e,r,o)}},{key:"forEachLine",value:function t(n,i,e,r,o,u){n<=o+this.length&&i>=o&&u(this.blockAt(0,e,r,o))}},{key:"updateHeight",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,e=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3?arguments[3]:void 0;return r&&r.from<=i&&r.more&&this.setHeight(n,r.heights[r.index++]),this.outdated=!1,this}},{key:"toString",value:function t(){return"block(".concat(this.length,")")}}]),i}(gi),bi=function(t){sc(i,t);var n=fc(i);function i(t,e){var r;return yc(this,i),(r=n.call(this,t,e,null)).collapsed=0,r.widgetHeight=0,r}return pc(i,[{key:"replace",value:function t(n,e,r){var o=r[0];return 1==r.length&&(o instanceof i||o instanceof Mi&&4&o.flags)&&Math.abs(this.length-o.length)<10?(o instanceof Mi?o=new i(o.length,this.height):o.height=this.height,this.outdated||(o.outdated=!1),o):gi.of(r)}},{key:"updateHeight",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,e=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3?arguments[3]:void 0;return r&&r.from<=i&&r.more?this.setHeight(n,r.heights[r.index++]):(e||this.outdated)&&this.setHeight(n,Math.max(this.widgetHeight,n.heightForLine(this.length-this.collapsed))),this.outdated=!1,this}},{key:"toString",value:function t(){return"line(".concat(this.length).concat(this.collapsed?-this.collapsed:"").concat(this.widgetHeight?":"+this.widgetHeight:"",")")}}]),i}(wi),Mi=function(t){sc(i,t);var n=fc(i);function i(t){return yc(this,i),n.call(this,t,0)}return pc(i,[{key:"heightMetrics",value:function t(n,i){var e,r,o=n.doc.lineAt(i).number,u=n.doc.lineAt(i+this.length).number,s=u-o+1,a=0;return n.lineWrapping?(e=(r=Math.min(this.height,n.lineHeight*s))/s,this.length>s+1&&(a=(this.height-r)/(this.length-s-1))):e=this.height/s,{firstLine:o,lastLine:u,perLine:e,perChar:a}}},{key:"blockAt",value:function t(n,i,e,r){var o,u,s,a,f,h,c,l,v=this.heightMetrics(i,r),d=v.firstLine,y=v.lastLine,m=v.perLine,p=v.perChar;return i.lineWrapping?(o=r+Math.round(Math.max(0,Math.min(1,(n-e)/this.height))*this.length),s=m+(u=i.doc.lineAt(o)).length*p,a=Math.max(e,n-s/2),new mi(u.from,u.length,a,s,null,null)):(f=Math.max(0,Math.min(y-d,Math.floor((n-e)/m))),c=(h=i.doc.line(d+f)).from,l=h.length,new mi(c,l,e+m*f,m,null,null))}},{key:"lineAt",value:function t(n,i,e,r,o){var u,s,a,f,h,c,l,v,d,y,m;return i==pi.ByHeight?this.blockAt(n,e,r,o):i==pi.ByPosNoHeight?(s=(u=e.doc.lineAt(n)).from,a=u.to,new mi(s,a-s,0,0,null,null)):(h=(f=this.heightMetrics(e,o)).firstLine,c=f.perLine,l=f.perChar,d=c+(v=e.doc.lineAt(n)).length*l,m=r+c*(y=v.number-h)+l*(v.from-o-y),new mi(v.from,v.length,Math.max(r,Math.min(m,r+this.height-d)),d,null,null))}},{key:"forEachLine",value:function t(n,i,e,r,o,u){var s,a,f,h,c,l,v,d,y;for(n=Math.max(n,o),i=Math.min(i,o+this.length),a=(s=this.heightMetrics(e,o)).firstLine,f=s.perLine,h=s.perChar,c=n,l=r;c<=i;)v=e.doc.lineAt(c),c==n&&(l+=f*(d=v.number-a)+h*(n-o-d)),y=f+h*v.length,u(new mi(v.from,v.length,l,y,null,null)),l+=y,c=v.to+1}},{key:"replace",value:function t(n,e,r){var o,u,s=this.length-e;return s>0&&((o=r[r.length-1])instanceof i?r[r.length-1]=new i(o.length+s):r.push(null,new i(s-1))),n>0&&((u=r[0])instanceof i?r[0]=new i(n+u.length):r.unshift(new i(n-1),null)),gi.of(r)}},{key:"decomposeLeft",value:function t(n,e){e.push(new i(n-1),null)}},{key:"decomposeRight",value:function t(n,e){e.push(null,new i(this.length-n-1))}},{key:"updateHeight",value:function t(n){var e,r,o,u,s,a,f,h=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,c=arguments.length>2&&void 0!==arguments[2]&&arguments[2],l=arguments.length>3?arguments[3]:void 0,v=h+this.length;if(l&&l.from<=h+this.length&&l.more){for(e=[],r=Math.max(h,l.from),o=-1,l.from>h&&e.push(new i(l.from-h-1).updateHeight(n,h));r<=v&&l.more;)u=n.doc.lineAt(r).length,e.length&&e.push(null),s=l.heights[l.index++],-1==o?o=s:Math.abs(s-o)>=ki&&(o=-2),(a=new bi(u,s)).outdated=!1,e.push(a),r+=u+1;return r<=v&&e.push(null,new i(v-r).updateHeight(n,r)),f=gi.of(e),(o<0||Math.abs(f.height-this.height)>=ki||Math.abs(o-this.heightMetrics(n,h).perLine)>=ki)&&(n.heightChanged=!0),f}return(c||this.outdated)&&(this.setHeight(n,n.heightForGap(h,h+this.length)),this.outdated=!1),this}},{key:"toString",value:function t(){return"gap(".concat(this.length,")")}}]),i}(gi),xi=function(t){sc(i,t);var n=fc(i);function i(t,e,r){var o;return yc(this,i),(o=n.call(this,t.length+e+r.length,t.height+r.height,e|(t.outdated||r.outdated?2:0))).left=t,o.right=r,o.size=t.size+r.size,o}return pc(i,[{key:"break",get:function t(){return 1&this.flags}},{key:"blockAt",value:function t(n,i,e,r){var o=e+this.left.height;return n<o?this.left.blockAt(n,i,e,r):this.right.blockAt(n,i,o,r+this.left.length+this.break)}},{key:"lineAt",value:function t(n,i,e,r,o){var u,s=r+this.left.height,a=o+this.left.length+this.break,f=i==pi.ByHeight?n<s:n<a,h=f?this.left.lineAt(n,i,e,r,o):this.right.lineAt(n,i,e,s,a);return this.break||(f?h.to<a:h.from>a)?h:(u=i==pi.ByPosNoHeight?pi.ByPosNoHeight:pi.ByPos,f?h.join(this.right.lineAt(a,u,e,s,a)):this.left.lineAt(a,u,e,r,o).join(h))}},{key:"forEachLine",value:function t(n,i,e,r,o,u){var s,a=r+this.left.height,f=o+this.left.length+this.break;this.break?(n<f&&this.left.forEachLine(n,i,e,r,o,u),i>=f&&this.right.forEachLine(n,i,e,a,f,u)):(n<(s=this.lineAt(f,pi.ByPos,e,r,o)).from&&this.left.forEachLine(n,s.from-1,e,r,o,u),s.to>=n&&s.from<=i&&u(s),i>s.to&&this.right.forEachLine(s.to+1,i,e,a,f,u))}},{key:"replace",value:function t(n,i,e){var r,o,u,s,a,f,h=this.left.length+this.break;if(i<h)return this.balanced(this.left.replace(n,i,e),this.right);if(n>this.left.length)return this.balanced(this.left,this.right.replace(n-h,i-h,e));r=[],n>0&&this.decomposeLeft(n,r),o=r.length,u=ic(e);try{for(u.s();!(s=u.n()).done;)a=s.value,r.push(a)}catch(t){u.e(t)}finally{u.f()}return n>0&&Qv(r,o-1),i<this.length&&(f=r.length,this.decomposeRight(i,r),Qv(r,f)),gi.of(r)}},{key:"decomposeLeft",value:function t(n,i){var e=this.left.length;if(n<=e)return this.left.decomposeLeft(n,i);i.push(this.left),this.break&&n>=++e&&i.push(null),n>e&&this.right.decomposeLeft(n-e,i)}},{key:"decomposeRight",value:function t(n,i){var e=this.left.length,r=e+this.break;if(n>=r)return this.right.decomposeRight(n-r,i);n<e&&this.left.decomposeRight(n,i),this.break&&n<r&&i.push(null),i.push(this.right)}},{key:"balanced",value:function t(n,i){return n.size>2*i.size||i.size>2*n.size?gi.of(this.break?[n,null,i]:[n,i]):(this.left=n,this.right=i,this.height=n.height+i.height,this.outdated=n.outdated||i.outdated,this.size=n.size+i.size,this.length=n.length+this.break+i.length,this)}},{key:"updateHeight",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,e=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3?arguments[3]:void 0,o=this.left,u=this.right,s=i+o.length+this.break,a=null;return r&&r.from<=i+o.length&&r.more?a=o=o.updateHeight(n,i,e,r):o.updateHeight(n,i,e),r&&r.from<=s+u.length&&r.more?a=u=u.updateHeight(n,s,e,r):u.updateHeight(n,s,e),a?this.balanced(o,u):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}},{key:"toString",value:function t(){return this.left+(this.break?" ":"-")+this.right}}]),i}(gi),Si=5,Ci=function(){function t(n,i){yc(this,t),this.pos=n,this.oracle=i,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=n}return pc(t,[{key:"isCovered",get:function t(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}},{key:"span",value:function t(n,i){if(this.lineStart>-1){var e=Math.min(i,this.lineEnd),r=this.nodes[this.nodes.length-1];r instanceof bi?r.length+=e-this.pos:(e>this.pos||!this.isCovered)&&this.nodes.push(new bi(e-this.pos,-1)),this.writtenTo=e,i>e&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=i}},{key:"point",value:function t(n,i,e){var r,o;n<i||e.heightRelevant?((r=e.widget?e.widget.estimatedHeight:0)<0&&(r=this.oracle.lineHeight),o=i-n,e.block?this.addBlock(new wi(o,r,e)):(o||r>=Si)&&this.addLineDeco(r,o)):i>n&&this.span(n,i),this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}},{key:"enterLine",value:function t(){if(!(this.lineStart>-1)){var n=this.oracle.doc.lineAt(this.pos),i=n.from,e=n.to;this.lineStart=i,this.lineEnd=e,this.writtenTo<i&&((this.writtenTo<i-1||null==this.nodes[this.nodes.length-1])&&this.nodes.push(this.blankContent(this.writtenTo,i-1)),this.nodes.push(null)),this.pos>i&&this.nodes.push(new bi(this.pos-i,-1)),this.writtenTo=this.pos}}},{key:"blankContent",value:function t(n,i){var e=new Mi(i-n);return this.oracle.doc.lineAt(n).to==i&&(e.flags|=4),e}},{key:"ensureLine",value:function t(){var n,i;return this.enterLine(),(n=this.nodes.length?this.nodes[this.nodes.length-1]:null)instanceof bi?n:(i=new bi(0,-1),this.nodes.push(i),i)}},{key:"addBlock",value:function t(n){var i,e;this.enterLine(),(e=null===(i=n.deco)||void 0===i?void 0:i.type)!=Gt.WidgetAfter||this.isCovered||this.ensureLine(),this.nodes.push(n),this.writtenTo=this.pos=this.pos+n.length,e!=Gt.WidgetBefore&&(this.covering=n)}},{key:"addLineDeco",value:function t(n,i){var e=this.ensureLine();e.length+=i,e.collapsed+=i,e.widgetHeight=Math.max(e.widgetHeight,n),this.writtenTo=this.pos=this.pos+i}},{key:"finish",value:function t(n){var i,e,r,o,u=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||u instanceof bi||this.isCovered?(this.writtenTo<this.pos||null==u)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos)):this.nodes.push(new bi(0,-1)),i=n,e=ic(this.nodes);try{for(e.s();!(r=e.n()).done;)(o=r.value)instanceof bi&&o.updateHeight(this.oracle,i),i+=o?o.length:1}catch(t){e.e(t)}finally{e.f()}return this.nodes}}],[{key:"build",value:function n(i,e,r,o){var u=new t(r,i);return tt.spans(e,r,o,u,0),u.finish(r)}}]),t}(),ji=function(){function t(){yc(this,t),this.changes=[]}return pc(t,[{key:"compareRange",value:function t(){}},{key:"comparePoint",value:function t(n,i,e,r){(n<i||e&&e.heightRelevant||r&&r.heightRelevant)&&Xl(n,i,this.changes,5)}}]),t}(),Pi=function(){function t(n,i,e){yc(this,t),this.from=n,this.to=i,this.size=e}return pc(t,[{key:"draw",value:function t(n){return Jt.replace({widget:new Oi(this.size,n)}).range(this.from,this.to)}}],[{key:"same",value:function t(n,i){var e,r,o;if(n.length!=i.length)return!1;for(e=0;e<n.length;e++)if(r=n[e],o=i[e],r.from!=o.from||r.to!=o.to||r.size!=o.size)return!1;return!0}}]),t}(),Oi=function(t){sc(i,t);var n=fc(i);function i(t,e){var r;return yc(this,i),(r=n.call(this)).size=t,r.vertical=e,r}return pc(i,[{key:"eq",value:function t(n){return n.size==this.size&&n.vertical==this.vertical}},{key:"toDOM",value:function t(){var n=document.createElement("div");return this.vertical?n.style.height=this.size+"px":(n.style.width=this.size+"px",n.style.height="2px",n.style.display="inline-block"),n}},{key:"estimatedHeight",get:function t(){return this.vertical?this.size:-1}}]),i}(qt),Ei=function(){function t(n){yc(this,t),this.state=n,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scaler=Di,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Pn.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;var e=n.facet(wn).some((function(t){return"function"!=typeof t&&"cm-lineWrapping"==t.class}));this.heightOracle=new di(e),this.stateDeco=n.facet(bn).filter((function(t){return"function"!=typeof t})),this.heightMap=gi.empty().applyChanges(this.stateDeco,i.empty,this.heightOracle.setDoc(n.doc),[new Cn(0,0,0,n.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Jt.set(this.lineGaps.map((function(t){return t.draw(!1)}))),this.computeVisibleRanges()}return pc(t,[{key:"updateForViewport",value:function t(){var n,i=this,e=[this.viewport],r=this.state.selection.main,o=function t(){var o,u,s,a=n?r.head:r.anchor;e.some((function(t){var n=t.from,i=t.to;return a>=n&&a<=i}))||(u=(o=i.lineBlockAt(a)).from,s=o.to,e.push(new Ai(u,s)))};for(n=0;n<=1;n++)o();this.viewports=e.sort((function(t,n){return t.from-n.from})),this.scaler=this.heightMap.height<=7e6?Di:new Ri(this.heightOracle,this.heightMap,this.viewports)}},{key:"updateViewportLines",value:function t(){var n=this;this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,(function(t){n.viewportLines.push(1==n.scaler.scale?t:rd(t,n.scaler))}))}},{key:"update",value:function t(n){var i,e,r,o,u,s,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.state=n.state,i=this.stateDeco,this.stateDeco=this.state.facet(bn).filter((function(t){return"function"!=typeof t})),e=n.changedRanges,r=Cn.extendWithRanges(e,Xv(i,this.stateDeco,n?n.changes:y.empty(this.state.doc.length))),o=this.heightMap.height,this.heightMap=this.heightMap.applyChanges(this.stateDeco,n.startState.doc,this.heightOracle.setDoc(this.state.doc),r),this.heightMap.height!=o&&(n.flags|=2),u=r.length?this.mapViewport(this.viewport,n.changes):this.viewport,(a&&(a.range.head<u.from||a.range.head>u.to)||!this.viewportIsAppropriate(u))&&(u=this.getViewport(0,a)),s=!n.changes.empty||2&n.flags||u.from!=this.viewport.from||u.to!=this.viewport.to,this.viewport=u,this.updateForViewport(),s&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,n.changes))),n.flags|=this.computeVisibleRanges(),a&&(this.scrollTarget=a),!this.mustEnforceCursorAssoc&&n.selectionSet&&n.view.lineWrapping&&n.state.selection.main.empty&&n.state.selection.main.assoc&&!n.state.facet(cn)&&(this.mustEnforceCursorAssoc=!0)}},{key:"measure",value:function t(n){var e,r,o,u,s,a,f,h,c,l,v,d,y,m,p,k,g,w,b,M,x,S,C=n.contentDOM,j=window.getComputedStyle(C),P=this.heightOracle,O=j.whiteSpace;if(this.defaultTextDirection="rtl"==j.direction?Pn.RTL:Pn.LTR,e=this.heightOracle.mustRefreshForWrapping(O),r=C.getBoundingClientRect(),o=e||this.mustMeasureContent||this.contentDOMHeight!=r.height,this.contentDOMHeight=r.height,this.mustMeasureContent=!1,u=0,s=0,a=parseInt(j.paddingTop)||0,f=parseInt(j.paddingBottom)||0,this.paddingTop==a&&this.paddingBottom==f||(this.paddingTop=a,this.paddingBottom=f,u|=10),this.editorWidth!=n.scrollDOM.clientWidth&&(P.lineWrapping&&(o=!0),this.editorWidth=n.scrollDOM.clientWidth,u|=8),c=(h=(this.printing?Yv:Zv)(C,this.paddingTop)).top-this.pixelViewport.top,l=h.bottom-this.pixelViewport.bottom,this.pixelViewport=h,(v=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left)!=this.inView&&(this.inView=v,v&&(o=!0)),!this.inView&&!this.scrollTarget)return 0;if(d=r.width,this.contentDOMWidth==d&&this.editorHeight==n.scrollDOM.clientHeight||(this.contentDOMWidth=r.width,this.editorHeight=n.scrollDOM.clientHeight,u|=8),o){y=n.docView.measureVisibleLineHeights(this.viewport),P.mustRefreshForHeights(y)&&(e=!0),(e||P.lineWrapping&&Math.abs(d-this.contentDOMWidth)>P.charWidth)&&(p=(m=n.docView.measureTextSize()).lineHeight,k=m.charWidth,g=m.textHeight,(e=p>0&&P.refresh(O,p,k,g,d/k,y))&&(n.docView.minWidth=0,u|=8)),c>0&&l>0?s=Math.max(c,l):c<0&&l<0&&(s=Math.min(c,l)),P.heightChanged=!1,w=ic(this.viewports);try{for(w.s();!(b=w.n()).done;)x=(M=b.value).from==this.viewport.from?y:n.docView.measureVisibleLineHeights(M),this.heightMap=(e?gi.empty().applyChanges(this.stateDeco,i.empty,this.heightOracle,[new Cn(0,0,0,n.state.doc.length)]):this.heightMap).updateHeight(P,0,e,new yi(M.from,x))}catch(t){w.e(t)}finally{w.f()}P.heightChanged&&(u|=2)}return(S=!this.viewportIsAppropriate(this.viewport,s)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to))&&(this.viewport=this.getViewport(s,this.scrollTarget)),this.updateForViewport(),(2&u||S)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(e?[]:this.lineGaps,n)),u|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,n.docView.enforceCursorAssoc()),u}},{key:"visibleTop",get:function t(){return this.scaler.fromDOM(this.pixelViewport.top)}},{key:"visibleBottom",get:function t(){return this.scaler.fromDOM(this.pixelViewport.bottom)}},{key:"getViewport",value:function t(n,i){var e,r,o,u,s=.5-Math.max(-.5,Math.min(.5,n/1e3/2)),a=this.heightMap,f=this.heightOracle,h=this.visibleTop,c=this.visibleBottom,l=new Ai(a.lineAt(h-1e3*s,pi.ByHeight,f,0,0).from,a.lineAt(c+1e3*(1-s),pi.ByHeight,f,0,0).to);return i&&((e=i.range.head)<l.from||e>l.to)&&(r=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),o=a.lineAt(e,pi.ByPos,f,0,0),u="center"==i.y?(o.top+o.bottom)/2-r/2:"start"==i.y||"nearest"==i.y&&e<l.from?o.top:o.bottom-r,l=new Ai(a.lineAt(u-500,pi.ByHeight,f,0,0).from,a.lineAt(u+r+500,pi.ByHeight,f,0,0).to)),l}},{key:"mapViewport",value:function t(n,i){var e=i.mapPos(n.from,-1),r=i.mapPos(n.to,1);return new Ai(this.heightMap.lineAt(e,pi.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(r,pi.ByPos,this.heightOracle,0,0).to)}},{key:"viewportIsAppropriate",value:function t(n){var i,e,r,o,u,s,a=n.from,f=n.to,h=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return!this.inView||(e=(i=this.heightMap.lineAt(a,pi.ByPos,this.heightOracle,0,0)).top,o=(r=this.heightMap.lineAt(f,pi.ByPos,this.heightOracle,0,0)).bottom,u=this.visibleTop,s=this.visibleBottom,(0==a||e<=u-Math.max(10,Math.min(-h,250)))&&(f==this.state.doc.length||o>=s+Math.max(10,Math.min(h,250)))&&e>u-2e3&&o<s+2e3)}},{key:"mapLineGaps",value:function t(n,i){var e,r,o,u;if(!n.length||i.empty)return n;e=[],r=ic(n);try{for(r.s();!(o=r.n()).done;)u=o.value,i.touchesRange(u.from,u.to)||e.push(new Pi(i.mapPos(u.from),i.mapPos(u.to),u.size))}catch(t){r.e(t)}finally{r.f()}return e}},{key:"ensureLineGaps",value:function t(n,i){var e,r,o,u,s,a,f,h,c,l,v,d,y,m,p,g,w,b,M,x,S=this,C=this.heightOracle.lineWrapping,j=C?1e4:2e3,P=j>>1,O=j<<1;if(this.defaultTextDirection!=Pn.LTR&&!C)return[];e=[],r=function t(r,o,u,s){var a,f,h,c,l,v,d;if(!(o-r<P)){for(a=S.state.selection.main,f=[a.from],a.empty||f.push(a.to),h=0,c=f;h<c.length;h++)if((l=c[h])>r&&l<o)return t(r,l-10,u,s),void t(l+10,o,u,s);v=ed(n,(function(t){return t.from>=u.from&&t.to<=u.to&&Math.abs(t.from-r)<P&&Math.abs(t.to-o)<P&&!f.some((function(n){return t.from<n&&t.to>n}))})),v||(o<u.to&&i&&C&&i.visibleRanges.some((function(t){return t.from<=o&&t.to>=o}))&&(d=i.moveToLineBoundary(k.cursor(o),!1,!0).head)>r&&(o=d),v=new Pi(r,o,S.gapSize(u,r,o,s))),e.push(v)}},o=ic(this.viewportLines);try{for(o.s();!(u=o.n()).done;)(s=u.value).length<O||(a=td(s.from,s.to,this.stateDeco)).total<O||(f=this.scrollTarget?this.scrollTarget.range.head:null,h=void 0,c=void 0,C?(l=j/this.heightOracle.lineLength*this.heightOracle.lineHeight,v=void 0,d=void 0,null!=f?(v=(y=id(a,f))-(m=((this.visibleBottom-this.visibleTop)/2+l)/s.height),d=y+m):(v=(this.visibleTop-s.top-l)/s.height,d=(this.visibleBottom-s.top+l)/s.height),h=nd(a,v),c=nd(a,d)):(p=a.total*this.heightOracle.charWidth,g=j*this.heightOracle.charWidth,w=void 0,b=void 0,null!=f?(w=(M=id(a,f))-(x=((this.pixelViewport.right-this.pixelViewport.left)/2+g)/p),b=M+x):(w=(this.pixelViewport.left-g)/p,b=(this.pixelViewport.right+g)/p),h=nd(a,w),c=nd(a,b)),h>s.from&&r(s.from,h,s,a),c<s.to&&r(c,s.to,s,a))}catch(t){o.e(t)}finally{o.f()}return e}},{key:"gapSize",value:function t(n,i,e,r){var o=id(r,e)-id(r,i);return this.heightOracle.lineWrapping?n.height*o:r.total*this.heightOracle.charWidth*o}},{key:"updateLineGaps",value:function t(n){var i=this;Pi.same(n,this.lineGaps)||(this.lineGaps=n,this.lineGapDeco=Jt.set(n.map((function(t){return t.draw(i.heightOracle.lineWrapping)}))))}},{key:"computeVisibleRanges",value:function t(){var n,i,e=this.stateDeco;return this.lineGaps.length&&(e=e.concat(this.lineGapDeco)),n=[],tt.spans(e,this.viewport.from,this.viewport.to,{span:function t(i,e){n.push({from:i,to:e})},point:function t(){}},20),i=n.length!=this.visibleRanges.length||this.visibleRanges.some((function(t,i){return t.from!=n[i].from||t.to!=n[i].to})),this.visibleRanges=n,i?4:0}},{key:"lineBlockAt",value:function t(n){return n>=this.viewport.from&&n<=this.viewport.to&&this.viewportLines.find((function(t){return t.from<=n&&t.to>=n}))||rd(this.heightMap.lineAt(n,pi.ByPos,this.heightOracle,0,0),this.scaler)}},{key:"lineBlockAtHeight",value:function t(n){return rd(this.heightMap.lineAt(this.scaler.fromDOM(n),pi.ByHeight,this.heightOracle,0,0),this.scaler)}},{key:"elementAtHeight",value:function t(n){return rd(this.heightMap.blockAt(this.scaler.fromDOM(n),this.heightOracle,0,0),this.scaler)}},{key:"docHeight",get:function t(){return this.scaler.toDOM(this.heightMap.height)}},{key:"contentHeight",get:function t(){return this.docHeight+this.paddingTop+this.paddingBottom}}]),t}(),Ai=pc((function t(n,i){yc(this,t),this.from=n,this.to=i})),Di={toDOM:function t(n){return n},fromDOM:function t(n){return n},scale:1},Ri=function(){function t(n,i,e){var r,o,u,s,a,f;yc(this,t),r=0,o=0,u=0,this.viewports=e.map((function(t){var e=t.from,o=t.to,u=i.lineAt(e,pi.ByPos,n,0,0).top,s=i.lineAt(o,pi.ByPos,n,0,0).bottom;return r+=s-u,{from:e,to:o,top:u,bottom:s,domTop:0,domBottom:0}})),this.scale=(7e6-r)/(i.height-r),s=ic(this.viewports);try{for(s.s();!(a=s.n()).done;)(f=a.value).domTop=u+(f.top-o)*this.scale,u=f.domBottom=f.domTop+(f.bottom-f.top),o=f.bottom}catch(t){s.e(t)}finally{s.f()}}return pc(t,[{key:"toDOM",value:function t(n){var i,e,r,o;for(i=0,e=0,r=0;;i++){if(!(o=i<this.viewports.length?this.viewports[i]:null)||n<o.top)return r+(n-e)*this.scale;if(n<=o.bottom)return o.domTop+(n-o.top);e=o.bottom,r=o.domBottom}}},{key:"fromDOM",value:function t(n){var i,e,r,o;for(i=0,e=0,r=0;;i++){if(!(o=i<this.viewports.length?this.viewports[i]:null)||n<o.domTop)return e+(n-r)/this.scale;if(n<=o.domBottom)return o.top+(n-o.domTop);e=o.bottom,r=o.domBottom}}}]),t}(),Ii=w.define({combine:function t(n){return n.join(" ")}}),Ti=w.define({combine:function t(n){return n.indexOf(!0)>-1}}),Ni=od("."+(Li=ht.newName()),{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",left:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".cm-highlightSpace:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".cm-highlightTab":{backgroundImage:'url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>\')',backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},Fi={"&light":"."+(Bi=ht.newName()),"&dark":"."+(_i=ht.newName())}),Ui=pc((function t(n,i,e,r){var o,u,s,a,f,h,c,l;yc(this,t),this.typeOver=r,this.bounds=null,this.text="",u=(o=n.docView).impreciseHead,s=o.impreciseAnchor,n.state.readOnly&&i>-1?this.newSel=null:i>-1&&(this.bounds=n.docView.domBoundsAround(i,e,0))?(a=u||s?[]:ad(n),(f=new Vn(a,n.state)).readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=f.text,this.newSel=fd(a,this.bounds.from)):(h=n.observer.selectionRange,c=u&&u.node==h.focusNode&&u.offset==h.focusOffset||!ml(n.contentDOM,h.focusNode)?n.state.selection.main.head:n.docView.posFromDOM(h.focusNode,h.focusOffset),l=s&&s.node==h.anchorNode&&s.offset==h.anchorOffset||!ml(n.contentDOM,h.anchorNode)?n.state.selection.main.anchor:n.docView.posFromDOM(h.anchorNode,h.anchorOffset),this.newSel=k.single(l,c))})),Hi={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},zi=Nt.ie&&Nt.ie_version<=11,Wi=function(){function t(n){var i=this;yc(this,t),this.view=n,this.active=!1,this.selectionRange=new bt,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.resizeContent=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.parentCheck=-1,this.dom=n.contentDOM,this.observer=new MutationObserver((function(t){var e,r,o=ic(t);try{for(o.s();!(e=o.n()).done;)r=e.value,i.queue.push(r)}catch(t){o.e(t)}finally{o.f()}(Nt.ie&&Nt.ie_version<=11||Nt.ios&&n.composing)&&t.some((function(t){return"childList"==t.type&&t.removedNodes.length||"characterData"==t.type&&t.oldValue.length>t.target.nodeValue.length}))?i.flushSoon():i.flush()})),zi&&(this.onCharData=function(t){i.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),i.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),"function"==typeof ResizeObserver&&(this.resizeScroll=new ResizeObserver((function(){var t;(null===(t=i.view.docView)||void 0===t?void 0:t.lastUpdate)<Date.now()-75&&i.onResize()})),this.resizeScroll.observe(n.scrollDOM),this.resizeContent=new ResizeObserver((function(){return i.view.requestMeasure()})),this.resizeContent.observe(n.contentDOM)),this.addWindowListeners(this.win=n.win),this.start(),"function"==typeof IntersectionObserver&&(this.intersection=new IntersectionObserver((function(t){i.parentCheck<0&&(i.parentCheck=setTimeout(i.listenForScroll.bind(i),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=i.intersecting&&(i.intersecting=!i.intersecting,i.intersecting!=i.view.inView&&i.onScrollChanged(document.createEvent("Event")))}),{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver((function(t){t.length>0&&t[t.length-1].intersectionRatio>0&&i.onScrollChanged(document.createEvent("Event"))}),{})),this.listenForScroll(),this.readSelectionRange()}return pc(t,[{key:"onScrollChanged",value:function t(n){this.view.inputState.runScrollHandlers(this.view,n),this.intersecting&&this.view.measure()}},{key:"onScroll",value:function t(n){this.intersecting&&this.flush(!1),this.onScrollChanged(n)}},{key:"onResize",value:function t(){var n=this;this.resizeTimeout<0&&(this.resizeTimeout=setTimeout((function(){n.resizeTimeout=-1,n.view.requestMeasure()}),50))}},{key:"onPrint",value:function t(){var n=this;this.view.viewState.printing=!0,this.view.measure(),setTimeout((function(){n.view.viewState.printing=!1,n.view.requestMeasure()}),500)}},{key:"updateGaps",value:function t(n){var i,e,r;if(this.gapIntersection&&(n.length!=this.gaps.length||this.gaps.some((function(t,i){return t!=n[i]})))){this.gapIntersection.disconnect(),i=ic(n);try{for(i.s();!(e=i.n()).done;)r=e.value,this.gapIntersection.observe(r)}catch(t){i.e(t)}finally{i.f()}this.gaps=n}}},{key:"onSelectionChange",value:function t(n){var i,e,r,o=this.selectionChanged;this.readSelectionRange()&&!this.delayedAndroidKey&&(i=this.view,e=this.selectionRange,(i.state.facet(dn)?i.root.activeElement==this.dom:kl(i.dom,e))&&((r=e.anchorNode&&i.docView.nearest(e.anchorNode))&&r.ignoreEvent(n)?o||(this.selectionChanged=!1):(Nt.ie&&Nt.ie_version<=11||Nt.android&&Nt.chrome)&&!i.state.selection.main.empty&&e.focusNode&&wl(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)?this.flushSoon():this.flush(!1)))}},{key:"readSelectionRange",value:function t(){var n,i=this.view,e=Nt.safari&&11==i.root.nodeType&&pl(this.dom.ownerDocument)==this.dom&&cd(this.view)||yl(i.root);return!(!e||this.selectionRange.eq(e))&&((n=kl(this.dom,e))&&!this.selectionChanged&&i.inputState.lastFocusTime>Date.now()-200&&i.inputState.lastTouchTime<Date.now()-300&&Il(this.dom,e)?(this.view.inputState.lastFocusTime=0,i.docView.updateSelection(),!1):(this.selectionRange.setRange(e),n&&(this.selectionChanged=!0),!0))}},{key:"setSelectionRange",value:function t(n,i){this.selectionRange.set(n.node,n.offset,i.node,i.offset),this.selectionChanged=!1}},{key:"clearSelectionRange",value:function t(){this.selectionRange.set(null,0,null,0)}},{key:"listenForScroll",value:function t(){var n,i,e,r,o,u,s,a,f;for(this.parentCheck=-1,n=0,i=null,e=this.dom;e;)if(1==e.nodeType)!i&&n<this.scrollTargets.length&&this.scrollTargets[n]==e?n++:i||(i=this.scrollTargets.slice(0,n)),i&&i.push(e),e=e.assignedSlot||e.parentNode;else{if(11!=e.nodeType)break;e=e.host}if(n<this.scrollTargets.length&&!i&&(i=this.scrollTargets.slice(0,n)),i){r=ic(this.scrollTargets);try{for(r.s();!(o=r.n()).done;)(u=o.value).removeEventListener("scroll",this.onScroll)}catch(t){r.e(t)}finally{r.f()}s=ic(this.scrollTargets=i);try{for(s.s();!(a=s.n()).done;)(f=a.value).addEventListener("scroll",this.onScroll)}catch(t){s.e(t)}finally{s.f()}}}},{key:"ignore",value:function t(n){if(!this.active)return n();try{return this.stop(),n()}finally{this.start(),this.clear()}}},{key:"start",value:function t(){this.active||(this.observer.observe(this.dom,Hi),zi&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}},{key:"stop",value:function t(){this.active&&(this.active=!1,this.observer.disconnect(),zi&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}},{key:"clear",value:function t(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}},{key:"delayAndroidKey",value:function t(n,i){var e,r,o=this;this.delayedAndroidKey||(r=function t(){var n,i=o.delayedAndroidKey;i&&(o.clearDelayedAndroidKey(),o.view.inputState.lastKeyCode=i.keyCode,o.view.inputState.lastKeyTime=Date.now(),!(n=o.flush())&&i.force&&Al(o.dom,i.key,i.keyCode))},this.flushingAndroidKey=this.view.win.requestAnimationFrame(r)),this.delayedAndroidKey&&"Enter"!=n||(this.delayedAndroidKey={key:n,keyCode:i,force:this.lastChange<Date.now()-50||!!(null===(e=this.delayedAndroidKey)||void 0===e?void 0:e.force)})}},{key:"clearDelayedAndroidKey",value:function t(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}},{key:"flushSoon",value:function t(){var n=this;this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame((function(){n.delayedFlush=-1,n.flush()})))}},{key:"forceFlush",value:function t(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}},{key:"pendingRecords",value:function t(){var n,i,e=ic(this.observer.takeRecords());try{for(e.s();!(n=e.n()).done;)i=n.value,this.queue.push(i)}catch(t){e.e(t)}finally{e.f()}return this.queue}},{key:"processRecords",value:function t(){var n,i,e,r,o,u,s,a=this.pendingRecords();a.length&&(this.queue=[]),n=-1,i=-1,e=!1,r=ic(a);try{for(r.s();!(o=r.n()).done;)u=o.value,(s=this.readMutation(u))&&(s.typeOver&&(e=!0),-1==n?(n=s.from,i=s.to):(n=Math.min(s.from,n),i=Math.max(s.to,i)))}catch(t){r.e(t)}finally{r.f()}return{from:n,to:i,typeOver:e}}},{key:"readChange",value:function t(){var n=this.processRecords(),i=n.from,e=n.to,r=n.typeOver,o=this.selectionChanged&&kl(this.dom,this.selectionRange);return i<0&&!o?null:(i>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1,new Ui(this.view,i,e,r))}},{key:"flush",value:function t(){var n,i,e,r=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return!(this.delayedFlush>=0||this.delayedAndroidKey)&&(r&&this.readSelectionRange(),!!(n=this.readChange())&&(i=this.view.state,e=ud(this.view,n),this.view.state==i&&this.view.update([]),e))}},{key:"readMutation",value:function t(n){var i,e,r=this.view.docView.nearest(n.target);return!r||r.ignoreMutation(n)?null:(r.markDirty("attributes"==n.type),"attributes"==n.type&&(r.dirty|=4),"childList"==n.type?(i=hd(r,n.previousSibling||n.target.previousSibling,-1),e=hd(r,n.nextSibling||n.target.nextSibling,1),{from:i?r.posAfter(i):r.posAtStart,to:e?r.posBefore(e):r.posAtEnd,typeOver:!1}):"characterData"==n.type?{from:r.posAtStart,to:r.posAtEnd,typeOver:n.target.nodeValue==n.oldValue}:null)}},{key:"setWindow",value:function t(n){n!=this.win&&(this.removeWindowListeners(this.win),this.win=n,this.addWindowListeners(this.win))}},{key:"addWindowListeners",value:function t(n){n.addEventListener("resize",this.onResize),n.addEventListener("beforeprint",this.onPrint),n.addEventListener("scroll",this.onScroll),n.document.addEventListener("selectionchange",this.onSelectionChange)}},{key:"removeWindowListeners",value:function t(n){n.removeEventListener("scroll",this.onScroll),n.removeEventListener("resize",this.onResize),n.removeEventListener("beforeprint",this.onPrint),n.document.removeEventListener("selectionchange",this.onSelectionChange)}},{key:"destroy",value:function t(){var n,i,e,r,o,u,s;this.stop(),null===(n=this.intersection)||void 0===n||n.disconnect(),null===(i=this.gapIntersection)||void 0===i||i.disconnect(),null===(e=this.resizeScroll)||void 0===e||e.disconnect(),null===(r=this.resizeContent)||void 0===r||r.disconnect(),o=ic(this.scrollTargets);try{for(o.s();!(u=o.n()).done;)(s=u.value).removeEventListener("scroll",this.onScroll)}catch(t){o.e(t)}finally{o.f()}this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey)}}]),t}(),Vi=function(){function t(){var n,i,e,r=this,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};yc(this,t),this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.style.cssText="position: fixed; top: -10000px",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),this.$de=o.dispatch||function(t){return r.update([t])},this.dispatch=this.dispatch.bind(this),this.Nkt=o.root||Dl(o.parent)||document,this.viewState=new Ei(o.state||Q.create(o)),this.plugins=this.state.facet(mn).map((function(t){return new kn(t)})),n=ic(this.plugins);try{for(n.s();!(i=n.n()).done;)(e=i.value).update(this)}catch(t){n.e(t)}finally{n.f()}this.observer=new Wi(this),this.inputState=new Qn(this),this.inputState.ensureHandlers(this,this.plugins),this.docView=new qn(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),o.parent&&o.parent.appendChild(this.dom)}return pc(t,[{key:"state",get:function t(){return this.viewState.state}},{key:"viewport",get:function t(){return this.viewState.viewport}},{key:"visibleRanges",get:function t(){return this.viewState.visibleRanges}},{key:"inView",get:function t(){return this.viewState.inView}},{key:"composing",get:function t(){return this.inputState.composing>0}},{key:"compositionStarted",get:function t(){return this.inputState.composing>=0}},{key:"root",get:function t(){return this.Nkt}},{key:"win",get:function t(){return this.dom.ownerDocument.defaultView||window}},{key:"dispatch",value:function t(){var n,i=1==arguments.length&&(arguments.length<=0?void 0:arguments[0])instanceof $?arguments.length<=0?void 0:arguments[0]:(n=this.state).update.apply(n,arguments);this.$de(i,this)}},{key:"update",value:function t(n){var i,e,t,r,o,u,s,a,f,h,c,l,v,d,y,m,p,g,w,b,M,x,S,C=this;if(0!=this.updateState)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");i=!1,e=!1,r=this.state,o=ic(n);try{for(o.s();!(u=o.n()).done;){if((s=u.value).startState!=r)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");r=s.state}}catch(t){o.e(t)}finally{o.f()}if(this.destroyed)this.viewState.state=r;else{if(a=this.hasFocus,f=0,h=null,n.some((function(t){return t.annotation(li)}))?(this.inputState.notifiedFocused=a,f=1):a!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=a,(h=Jv(r,a))||(f=1)),c=this.observer.delayedAndroidKey,l=null,c?(this.observer.clearDelayedAndroidKey(),((l=this.observer.readChange())&&!this.state.doc.eq(r.doc)||!this.state.selection.eq(r.selection))&&(l=null)):this.observer.clear(),r.facet(Q.phrases)!=this.state.facet(Q.phrases))return this.setState(r);t=jn.create(this,r,n),t.flags|=f,v=this.viewState.scrollTarget;try{this.updateState=2,d=ic(n);try{for(d.s();!(y=d.n()).done;){m=y.value,v&&(v=v.map(m.changes)),m.scrollIntoView&&(p=m.state.selection.main,v=new ln(p.empty?p:k.cursor(p.head,p.head>p.anchor?-1:1))),g=ic(m.effects);try{for(g.s();!(w=g.n()).done;)(b=w.value).is(vn)&&(v=b.value)}catch(t){g.e(t)}finally{g.f()}}}catch(t){d.e(t)}finally{d.f()}this.viewState.update(t,v),this.bidiCache=Gi.update(this.bidiCache,t.changes),t.empty||(this.updatePlugins(t),this.inputState.update(t)),i=this.docView.update(t),this.state.facet(Sn)!=this.styleModules&&this.mountStyles(),e=this.updateAttrs(),this.showAnnouncements(n),this.docView.updateSelection(i,n.some((function(t){return t.isUserEvent("select.pointer")})))}finally{this.updateState=0}if(t.startState.facet(Ii)!=t.state.facet(Ii)&&(this.viewState.mustMeasureContent=!0),(i||e||v||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!t.empty){M=ic(this.state.facet(sn));try{for(M.s();!(x=M.n()).done;)(S=x.value)(t)}catch(t){M.e(t)}finally{M.f()}}(h||l)&&Promise.resolve().then((function(){h&&C.state==h.startState&&C.dispatch(h),l&&!ud(C,l)&&c.force&&Al(C.contentDOM,c.key,c.keyCode)}))}}},{key:"setState",value:function t(n){var i,e,r,o,u,s,a;if(0!=this.updateState)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed)this.viewState.state=n;else{this.updateState=2,i=this.hasFocus;try{e=ic(this.plugins);try{for(e.s();!(r=e.n()).done;)(o=r.value).destroy(this)}catch(t){e.e(t)}finally{e.f()}this.viewState=new Ei(n),this.plugins=n.facet(mn).map((function(t){return new kn(t)})),this.pluginMap.clear(),u=ic(this.plugins);try{for(u.s();!(s=u.n()).done;)(a=s.value).update(this)}catch(t){u.e(t)}finally{u.f()}this.docView=new qn(this),this.inputState.ensureHandlers(this,this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}i&&this.focus(),this.requestMeasure()}}},{key:"updatePlugins",value:function t(n){var i,e,r,o,u,s,a,f,h,c,l,v,d,y=n.startState.facet(mn),m=n.state.facet(mn);if(y!=m){i=[],e=ic(m);try{for(e.s();!(r=e.n()).done;)o=r.value,(u=y.indexOf(o))<0?i.push(new kn(o)):((s=this.plugins[u]).mustUpdate=n,i.push(s))}catch(t){e.e(t)}finally{e.f()}a=ic(this.plugins);try{for(a.s();!(f=a.n()).done;)(h=f.value).mustUpdate!=n&&h.destroy(this)}catch(t){a.e(t)}finally{a.f()}this.plugins=i,this.pluginMap.clear(),this.inputState.ensureHandlers(this,this.plugins)}else{c=ic(this.plugins);try{for(c.s();!(l=c.n()).done;)(v=l.value).mustUpdate=n}catch(t){c.e(t)}finally{c.f()}}for(d=0;d<this.plugins.length;d++)this.plugins[d].update(this)}},{key:"measure",value:function t(){var n,i,e,r,o,u,s,a,f,h,c,l,v,d,y,m,p,k,g,w,b,M,x=this,S=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(!this.destroyed){this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.measureScheduled=0,S&&this.observer.forceFlush(),n=null,e=(i=this.scrollDOM).scrollHeight,u=(r=i.scrollTop)>e-(o=i.clientHeight)-4?e:r;try{for(s=0;this.updateState=1,a=this.viewport,f=this.viewState.lineBlockAtHeight(u),(h=this.viewState.measure(this))||this.measureRequests.length||null!=this.viewState.scrollTarget;s++){if(s>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}for(c=[],4&h||(l=[c,this.measureRequests],this.measureRequests=l[0],c=l[1]),v=c.map((function(t){try{return t.read(x)}catch(t){return Yl(x.state,t),qi}})),d=jn.create(this,this.state,[]),y=!1,m=!1,d.flags|=h,n?n.flags|=h:n=d,this.updateState=2,d.empty||(this.updatePlugins(d),this.inputState.update(d),this.updateAttrs(),y=this.docView.update(d)),p=0;p<c.length;p++)if(v[p]!=qi)try{(k=c[p]).write&&k.write(v[p],this)}catch(t){Yl(this.state,t)}if(this.viewState.editorHeight&&(this.viewState.scrollTarget?(this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,m=!0):((g=this.viewState.lineBlockAt(f.from).top-f.top)>1||g<-1)&&(this.scrollDOM.scrollTop+=g,m=!0)),y&&this.docView.updateSelection(!0),this.viewport.from==a.from&&this.viewport.to==a.to&&!m&&0==this.measureRequests.length)break}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty){w=ic(this.state.facet(sn));try{for(w.s();!(b=w.n()).done;)(M=b.value)(n)}catch(t){w.e(t)}finally{w.f()}}}}},{key:"themeClasses",get:function t(){return Li+" "+(this.state.facet(Ti)?_i:Bi)+" "+this.state.facet(Ii)}},{key:"updateAttrs",value:function t(){var n,i=this,e=ld(this,gn,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),r={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(dn)?"true":"false",class:"cm-content",style:"".concat(Nt.tabSize,": ").concat(this.state.tabSize),role:"textbox","aria-multiline":"true"};return this.state.readOnly&&(r["aria-readonly"]="true"),ld(this,wn,r),n=this.observer.ignore((function(){var t=Jl(i.contentDOM,i.contentAttrs,r),n=Jl(i.dom,i.editorAttrs,e);return t||n})),this.editorAttrs=e,this.contentAttrs=r,n}},{key:"showAnnouncements",value:function n(i){var e,r,o,u,s,a,f=!0,h=ic(i);try{for(h.s();!(e=h.n()).done;){o=ic((r=e.value).effects);try{for(o.s();!(u=o.n()).done;)(s=u.value).is(t.announce)&&(f&&(this.announceDOM.textContent=""),f=!1,(a=this.announceDOM.appendChild(document.createElement("div"))).textContent=s.value)}catch(t){o.e(t)}finally{o.f()}}}catch(t){h.e(t)}finally{h.f()}}},{key:"mountStyles",value:function t(){this.styleModules=this.state.facet(Sn),ht.mount(this.root,this.styleModules.concat(Ni).reverse())}},{key:"readMeasured",value:function t(){if(2==this.updateState)throw new Error("Reading the editor layout isn't allowed during an update");0==this.updateState&&this.measureScheduled>-1&&this.measure(!1)}},{key:"requestMeasure",value:function t(n){var i,e=this;if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame((function(){return e.measure()}))),n){if(this.measureRequests.indexOf(n)>-1)return;if(null!=n.key)for(i=0;i<this.measureRequests.length;i++)if(this.measureRequests[i].key===n.key)return void(this.measureRequests[i]=n);this.measureRequests.push(n)}}},{key:"plugin",value:function t(n){var i=this.pluginMap.get(n);return(void 0===i||i&&i.spec!=n)&&this.pluginMap.set(n,i=this.plugins.find((function(t){return t.spec==n}))||null),i&&i.update(this).value}},{key:"documentTop",get:function t(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}},{key:"documentPadding",get:function t(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}},{key:"elementAtHeight",value:function t(n){return this.readMeasured(),this.viewState.elementAtHeight(n)}},{key:"lineBlockAtHeight",value:function t(n){return this.readMeasured(),this.viewState.lineBlockAtHeight(n)}},{key:"viewportLineBlocks",get:function t(){return this.viewState.viewportLines}},{key:"lineBlockAt",value:function t(n){return this.viewState.lineBlockAt(n)}},{key:"contentHeight",get:function t(){return this.viewState.contentHeight}},{key:"moveByChar",value:function t(n,i,e){return Dv(this,n,Pv(this,n,i,e))}},{key:"moveByGroup",value:function t(n,i){var e=this;return Dv(this,n,Pv(this,n,i,(function(t){return Ov(e,n.head,t)})))}},{key:"moveToLineBoundary",value:function t(n,i){var e;return jv(this,n,i,!(arguments.length>2&&void 0!==arguments[2])||arguments[2])}},{key:"moveVertically",value:function t(n,i,e){return Dv(this,n,Ev(this,n,i,e))}},{key:"domAtPos",value:function t(n){return this.docView.domAtPos(n)}},{key:"posAtDOM",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.docView.posFromDOM(n,i)}},{key:"posAtCoords",value:function t(n){var i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.readMeasured(),Mv(this,n,i)}},{key:"coordsAtPos",value:function t(n){var i,e,r,o,u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this.readMeasured(),(i=this.docView.coordsAt(n,u))&&i.left!=i.right?(e=this.state.doc.lineAt(n),Sl(i,(o=(r=this.bidiSpans(e))[Un.find(r,n-e.from,-1,u)]).dir==Pn.LTR==u>0)):i}},{key:"defaultCharacterWidth",get:function t(){return this.viewState.heightOracle.charWidth}},{key:"defaultLineHeight",get:function t(){return this.viewState.heightOracle.lineHeight}},{key:"textDirection",get:function t(){return this.viewState.defaultTextDirection}},{key:"textDirectionAt",value:function t(n){var i;return!this.state.facet(hn)||n<this.viewport.from||n>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(n))}},{key:"lineWrapping",get:function t(){return this.viewState.heightOracle.lineWrapping}},{key:"bidiSpans",value:function t(n){var i,e,r,o,u;if(n.length>$i)return rv(n.length);i=this.textDirectionAt(n.from),e=ic(this.bidiCache);try{for(e.s();!(r=e.n()).done;)if((o=r.value).from==n.from&&o.dir==i)return o.order}catch(t){e.e(t)}finally{e.f()}return u=ev(n.text,i),this.bidiCache.push(new Gi(n.from,n.to,i,u)),u}},{key:"hasFocus",get:function t(){var n;return(this.dom.ownerDocument.hasFocus()||Nt.safari&&(null===(n=this.inputState)||void 0===n?void 0:n.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}},{key:"focus",value:function t(){var n=this;this.observer.ignore((function(){Ol(n.contentDOM),n.docView.updateSelection()}))}},{key:"setRoot",value:function t(n){this.Nkt!=n&&(this.Nkt=n,this.observer.setWindow((9==n.nodeType?n:n.ownerDocument).defaultView||window),this.mountStyles())}},{key:"destroy",value:function t(){var n,i,e=ic(this.plugins);try{for(e.s();!(n=e.n()).done;)(i=n.value).destroy(this)}catch(t){e.e(t)}finally{e.f()}this.plugins=[],this.inputState.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}}],[{key:"scrollIntoView",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return vn.of(new ln("number"==typeof n?k.cursor(n):n,i.y,i.x,i.yMargin,i.xMargin))}},{key:"domEventHandlers",value:function t(n){return pn.define((function(){return{}}),{eventHandlers:n})}},{key:"theme",value:function t(n,i){var e=ht.newName(),r=[Ii.of(e),Sn.of(od(".".concat(e),n))];return i&&i.dark&&r.push(Ti.of(!0)),r}},{key:"baseTheme",value:function t(n){return E.lowest(Sn.of(od("."+Li,n,Fi)))}},{key:"findFromDOM",value:function t(n){var i,e=n.querySelector(".cm-content"),r=e&&jt.get(e)||jt.get(n);return(null===(i=null==r?void 0:r.rootView)||void 0===i?void 0:i.view)||null}}]),t}(),Vi.styleModule=Sn,Vi.inputHandler=an,Vi.focusChangeEffect=fn,Vi.perLineTextDirection=hn,Vi.exceptionSink=un,Vi.updateListener=sn,Vi.editable=dn,Vi.mouseSelectionStyle=on,Vi.dragMovesSelection=rn,Vi.clickAddsSelectionRange=en,Vi.decorations=bn,Vi.atomicRanges=Mn,Vi.scrollMargins=xn,Vi.darkTheme=Ti,Vi.contentAttributes=wn,Vi.editorAttributes=gn,Vi.lineWrapping=Vi.contentAttributes.of({class:"cm-lineWrapping"}),Vi.announce=V.define(),$i=4096,qi={},Gi=function(){function t(n,i,e,r){yc(this,t),this.from=n,this.to=i,this.dir=e,this.order=r}return pc(t,null,[{key:"update",value:function n(i,e){var r,o,u,s;if(e.empty)return i;for(r=[],o=i.length?i[i.length-1].dir:Pn.LTR,u=Math.max(0,i.length-10);u<i.length;u++)(s=i[u]).dir!=o||e.touchesRange(s.from,s.to)||r.push(new t(e.mapPos(s.from,1),e.mapPos(s.to,-1),s.dir,s.order));return r}}]),t}(),Ji=Nt.mac?"mac":Nt.windows?"win":Nt.linux?"linux":"key",Ki=E.default(Vi.domEventHandlers({keydown:function t(n,i){return kd(yd(i.state),n,i,"editor")}})),Qi=w.define({enables:Ki}),Xi=new WeakMap,Zi=null,Yi=4e3,te=function(){function t(n,i,e,r,o){yc(this,t),this.className=n,this.left=i,this.top=e,this.width=r,this.height=o}return pc(t,[{key:"draw",value:function t(){var n=document.createElement("div");return n.className=this.className,this.adjust(n),n}},{key:"update",value:function t(n,i){return i.className==this.className&&(this.adjust(n),!0)}},{key:"adjust",value:function t(n){n.style.left=this.left+"px",n.style.top=this.top+"px",null!=this.width&&(n.style.width=this.width+"px"),n.style.height=this.height+"px"}},{key:"eq",value:function t(n){return this.left==n.left&&this.top==n.top&&this.width==n.width&&this.height==n.height&&this.className==n.className}}],[{key:"forRange",value:function n(i,e,r){var o,u;return r.empty?(o=i.coordsAtPos(r.head,r.assoc||1))?(u=gd(i),[new t(e,o.left-u.left,o.top-u.top,null,o.bottom-o.top)]):[]:Md(i,e,r)}}]),t}(),ne=function(){function t(n,i){yc(this,t),this.view=n,this.layer=i,this.drawn=[],this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=n.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),i.above&&this.dom.classList.add("cm-layer-above"),i.class&&this.dom.classList.add(i.class),this.dom.setAttribute("aria-hidden","true"),this.setOrder(n.state),n.requestMeasure(this.measureReq),i.mount&&i.mount(this.dom,n)}return pc(t,[{key:"update",value:function t(n){n.startState.facet(ie)!=n.state.facet(ie)&&this.setOrder(n.state),(this.layer.update(n,this.dom)||n.geometryChanged)&&n.view.requestMeasure(this.measureReq)}},{key:"setOrder",value:function t(n){for(var i=0,e=n.facet(ie);i<e.length&&e[i]!=this.layer;)i++;this.dom.style.zIndex=String((this.layer.above?150:-1)-i)}},{key:"measure",value:function t(){return this.layer.markers(this.view)}},{key:"draw",value:function t(n){var i,e,r,o,u,s,a=this;if(n.length!=this.drawn.length||n.some((function(t,n){return!xd(t,a.drawn[n])}))){i=this.dom.firstChild,e=0,r=ic(n);try{for(r.s();!(o=r.n()).done;)(u=o.value).update&&i&&u.constructor&&this.drawn[e].constructor&&u.update(i,this.drawn[e])?(i=i.nextSibling,e++):this.dom.insertBefore(u.draw(),i)}catch(t){r.e(t)}finally{r.f()}for(;i;)s=i.nextSibling,i.remove(),i=s;this.drawn=n}}},{key:"destroy",value:function t(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}]),t}(),ie=w.define(),ee=!Nt.ios,re=w.define({combine:function t(n){return il(n,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:function t(n,i){return Math.min(n,i)},drawRangeCursor:function t(n,i){return n||i}})}}),oe=Sd({above:!0,markers:function t(n){var i,e,r,o,u,s,a,f,h=n.state,c=h.facet(re),l=[],v=ic(h.selection.ranges);try{for(v.s();!(i=v.n()).done;)if(r=(e=i.value)==h.selection.main,e.empty?!r||ee:c.drawRangeCursor){o=r?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",u=e.empty?e:k.cursor(e.head,e.head>e.anchor?-1:1),s=ic(te.forRange(n,o,u));try{for(s.s();!(a=s.n()).done;)f=a.value,l.push(f)}catch(t){s.e(t)}finally{s.f()}}}catch(t){v.e(t)}finally{v.f()}return l},update:function t(n,i){n.transactions.some((function(t){return t.selection}))&&(i.style.animationName="cm-blink"==i.style.animationName?"cm-blink2":"cm-blink");var e=jd(n);return e&&Pd(n.state,i),n.docChanged||n.selectionSet||e},mount:function t(n,i){Pd(i.state,n)},class:"cm-cursorLayer"}),ue=Sd({above:!1,markers:function t(n){return n.state.selection.ranges.map((function(t){return t.empty?[]:te.forRange(n,"cm-selectionBackground",t)})).reduce((function(t,n){return t.concat(n)}))},update:function t(n,i){return n.docChanged||n.selectionSet||n.viewportChanged||jd(n)},class:"cm-selectionLayer"}),se={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}},ee&&(se[".cm-line"].caretColor="transparent !important"),ae=E.highest(Vi.theme(se)),fe=V.define({map:function t(n,i){return null==n?null:i.mapPos(n)}}),he=x.define({create:function t(){return null},update:function t(n,i){return null!=n&&(n=i.changes.mapPos(n)),i.effects.reduce((function(t,n){return n.is(fe)?n.value:t}),n)}}),ce=pn.fromClass(function(){function t(n){yc(this,t),this.view=n,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}return pc(t,[{key:"update",value:function t(n){var i,e=n.state.field(he);null==e?null!=this.cursor&&(null===(i=this.cursor)||void 0===i||i.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(n.startState.field(he)!=e||n.docChanged||n.geometryChanged)&&this.view.requestMeasure(this.measureReq))}},{key:"readPos",value:function t(){var n,i=this.view.state.field(he),e=null!=i&&this.view.coordsAtPos(i);return e?(n=this.view.scrollDOM.getBoundingClientRect(),{left:e.left-n.left+this.view.scrollDOM.scrollLeft,top:e.top-n.top+this.view.scrollDOM.scrollTop,height:e.bottom-e.top}):null}},{key:"drawCursor",value:function t(n){this.cursor&&(n?(this.cursor.style.left=n.left+"px",this.cursor.style.top=n.top+"px",this.cursor.style.height=n.height+"px"):this.cursor.style.left="-100000px")}},{key:"destroy",value:function t(){this.cursor&&this.cursor.remove()}},{key:"setDropPos",value:function t(n){this.view.state.field(he)!=n&&this.view.dispatch({effects:fe.of(n)})}}]),t}(),{eventHandlers:{dragover:function t(n){this.setDropPos(this.view.posAtCoords({x:n.clientX,y:n.clientY}))},dragleave:function t(n){n.target!=this.view.contentDOM&&this.view.contentDOM.contains(n.relatedTarget)||this.setDropPos(null)},dragend:function t(){this.setDropPos(null)},drop:function t(){this.setDropPos(null)}}}),le=function(){function t(n){yc(this,t);var i=n.regexp,e=n.decoration,r=n.decorate,o=n.boundary,u=n.maxLength,s=void 0===u?1e3:u;if(!i.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=i,r)this.addMatch=function(t,n,i,e){return r(e,i,i+t[0].length,t,n)};else if("function"==typeof e)this.addMatch=function(t,n,i,r){var o=e(t,n,i);o&&r(i,i+t[0].length,o)};else{if(!e)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=function(t,n,i,r){return r(i,i+t[0].length,e)}}this.boundary=o,this.maxLength=s}return pc(t,[{key:"createDeco",value:function t(n){var i,e,r,o,u=this,s=new nt,a=s.add.bind(s),f=ic(Ad(n,this.maxLength));try{for(f.s();!(i=f.n()).done;)r=(e=i.value).from,o=e.to,Ed(n.state.doc,this.regexp,r,o,(function(t,i){return u.addMatch(i,n,t,a)}))}catch(t){f.e(t)}finally{f.f()}return s.finish()}},{key:"updateDeco",value:function t(n,i){var e=1e9,r=-1;return n.docChanged&&n.changes.iterChanges((function(t,i,o,u){u>n.view.viewport.from&&o<n.view.viewport.to&&(e=Math.min(o,e),r=Math.max(u,r))})),n.viewportChanged||r-e>1e3?this.createDeco(n.view):r>-1?this.updateRange(n.view,i.map(n.changes),e,r):i}},{key:"updateRange",value:function t(n,i,e,r){var o,u,s=this,a=ic(n.visibleRanges);try{for(u=function t(){var u,a,f,h,c,l,v,d=o.value,y=Math.max(d.from,e),m=Math.min(d.to,r);if(m>y){if(a=(u=n.state.doc.lineAt(y)).to<m?n.state.doc.lineAt(m):u,f=Math.max(d.from,u.from),h=Math.min(d.to,a.to),s.boundary){for(;y>u.from;y--)if(s.boundary.test(u.text[y-1-u.from])){f=y;break}for(;m<a.to;m++)if(s.boundary.test(a.text[m-a.from])){h=m;break}}if(c=[],v=function t(n,i,e){return c.push(e.range(n,i))},u==a)for(s.regexp.lastIndex=f-u.from;(l=s.regexp.exec(u.text))&&l.index<h-u.from;)s.addMatch(l,n,l.index+u.from,v);else Ed(n.state.doc,s.regexp,f,h,(function(t,i){return s.addMatch(i,n,t,v)}));i=i.update({filterFrom:f,filterTo:h,filter:function t(n,i){return n<f||i>h},add:c})}},a.s();!(o=a.n()).done;)u()}catch(t){a.e(t)}finally{a.f()}return i}}]),t}(),ve=null!=/x/.unicode?"gu":"g",de=new RegExp("[\0-\b\n-\x1f\x7f-\x9f\xad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]",ve),ye={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"},me=null,pe=w.define({combine:function t(n){var i=il(n,{render:null,specialChars:de,addSpecialChars:null});return(i.replaceTabs=!Dd())&&(i.specialChars=new RegExp("\t|"+i.specialChars.source,ve)),i.addSpecialChars&&(i.specialChars=new RegExp(i.specialChars.source+"|"+i.addSpecialChars.source,ve)),i}}),ke=null,ge="\u2022",we=function(t){sc(i,t);var n=fc(i);function i(t,e){var r;return yc(this,i),(r=n.call(this)).options=t,r.code=e,r}return pc(i,[{key:"eq",value:function t(n){return n.code==this.code}},{key:"toDOM",value:function t(n){var i,e=Td(this.code),r=n.state.phrase("Control character")+" "+(ye[this.code]||"0x"+this.code.toString(16)),o=this.options.render&&this.options.render(this.code,r,e);return o||((i=document.createElement("span")).textContent=e,i.title=r,i.setAttribute("aria-label",r),i.className="cm-specialChar",i)}},{key:"ignoreEvent",value:function t(){return!1}}]),i}(qt),be=function(t){sc(i,t);var n=fc(i);function i(t){var e;return yc(this,i),(e=n.call(this)).width=t,e}return pc(i,[{key:"eq",value:function t(n){return n.width==this.width}},{key:"toDOM",value:function t(){var n=document.createElement("span");return n.textContent="\t",n.className="cm-tab",n.style.width=this.width+"px",n}},{key:"ignoreEvent",value:function t(){return!1}}]),i}(qt),Me=pn.fromClass(function(){function t(){yc(this,t),this.height=1e3,this.attrs={style:"padding-bottom: 1000px"}}return pc(t,[{key:"update",value:function t(n){var i=n.view,e=i.viewState.editorHeight-i.defaultLineHeight-i.documentPadding.top-.5;e!=this.height&&(this.height=e,this.attrs={style:"padding-bottom: ".concat(e,"px")})}}]),t}()),xe=Jt.line({class:"cm-activeLine"}),Se=pn.fromClass(function(){function t(n){yc(this,t),this.decorations=this.getDeco(n)}return pc(t,[{key:"update",value:function t(n){(n.docChanged||n.selectionSet)&&(this.decorations=this.getDeco(n.view))}},{key:"getDeco",value:function t(n){var i,e,r,o=-1,u=[],s=ic(n.state.selection.ranges);try{for(s.s();!(i=s.n()).done;)e=i.value,(r=n.lineBlockAt(e.head)).from>o&&(u.push(xe.range(r.from)),o=r.from)}catch(t){s.e(t)}finally{s.f()}return Jt.set(u)}}]),t}(),{decorations:function t(n){return n.decorations}}),Ce=function(t){sc(i,t);var n=fc(i);function i(t){var e;return yc(this,i),(e=n.call(this)).content=t,e}return pc(i,[{key:"toDOM",value:function t(){var n=document.createElement("span");return n.className="cm-placeholder",n.style.pointerEvents="none",n.appendChild("string"==typeof this.content?document.createTextNode(this.content):this.content),"string"==typeof this.content?n.setAttribute("aria-label","placeholder "+this.content):n.setAttribute("aria-hidden","true"),n}},{key:"coordsAt",value:function t(n){var i,e,r,o=n.firstChild?gl(n.firstChild):[];return o.length?(i=window.getComputedStyle(n.parentNode),e=Sl(o[0],"rtl"!=i.direction),r=parseInt(i.lineHeight),e.bottom-e.top>1.5*r?{left:e.left,right:e.right,top:e.top,bottom:e.top+r}:e):null}},{key:"ignoreEvent",value:function t(){return!1}}]),i}(qt),je=2e3,Pe={Alt:[18,function(t){return!!t.altKey}],Control:[17,function(t){return!!t.ctrlKey}],Shift:[16,function(t){return!!t.shiftKey}],Meta:[91,function(t){return!!t.metaKey}]},Oe={style:"cursor: crosshair"},Ee="-10000px",Ae=function(){function t(n,i,e){yc(this,t),this.facet=i,this.createTooltipView=e,this.input=n.state.facet(i),this.tooltips=this.input.filter((function(t){return t})),this.tooltipViews=this.tooltips.map(e)}return pc(t,[{key:"update",value:function t(n){var i,e,r,o,u,s,a,f,h,c,l,v,d,y,m=n.state.facet(this.facet),p=m.filter((function(t){return t}));if(m===this.input){e=ic(this.tooltipViews);try{for(e.s();!(r=e.n()).done;)(o=r.value).update&&o.update(n)}catch(t){e.e(t)}finally{e.f()}return!1}for(u=[],s=0;s<p.length;s++)if(f=-1,a=p[s]){for(h=0;h<this.tooltips.length;h++)(c=this.tooltips[h])&&c.create==a.create&&(f=h);f<0?u[s]=this.createTooltipView(a):(l=u[s]=this.tooltipViews[f]).update&&l.update(n)}v=ic(this.tooltipViews);try{for(v.s();!(d=v.n()).done;)y=d.value,u.indexOf(y)<0&&(y.dom.remove(),null===(i=y.destroy)||void 0===i||i.call(y))}catch(t){v.e(t)}finally{v.f()}return this.input=m,this.tooltips=p,this.tooltipViews=u,!0}}]),t}(),De=w.define({combine:function t(n){var i,e,r;return{position:Nt.ios?"absolute":(null===(i=n.find((function(t){return t.position})))||void 0===i?void 0:i.position)||"fixed",parent:(null===(e=n.find((function(t){return t.parent})))||void 0===e?void 0:e.parent)||null,tooltipSpace:(null===(r=n.find((function(t){return t.tooltipSpace})))||void 0===r?void 0:r.tooltipSpace)||$d}}}),Re=new WeakMap,Ie=pn.fromClass(function(){function t(n){var i,e=this;yc(this,t),this.view=n,this.inView=!0,this.lastTransaction=0,this.measureTimeout=-1,i=n.state.facet(De),this.position=i.position,this.parent=i.parent,this.classes=n.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.manager=new Ae(n,Be,(function(t){return e.createTooltip(t)})),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver((function(t){Date.now()>e.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&e.measureSoon()}),{threshold:[1]}):null,this.observeIntersection(),n.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}return pc(t,[{key:"createContainer",value:function t(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}},{key:"observeIntersection",value:function t(){var n,i,e;if(this.intersectionObserver){this.intersectionObserver.disconnect(),n=ic(this.manager.tooltipViews);try{for(n.s();!(i=n.n()).done;)e=i.value,this.intersectionObserver.observe(e.dom)}catch(t){n.e(t)}finally{n.f()}}}},{key:"measureSoon",value:function t(){var n=this;this.measureTimeout<0&&(this.measureTimeout=setTimeout((function(){n.measureTimeout=-1,n.maybeMeasure()}),50))}},{key:"update",value:function t(n){var i,e,r,o,u,s,a,f,h;if(n.transactions.length&&(this.lastTransaction=Date.now()),(i=this.manager.update(n))&&this.observeIntersection(),e=i||n.geometryChanged,(r=n.state.facet(De)).position!=this.position){this.position=r.position,o=ic(this.manager.tooltipViews);try{for(o.s();!(u=o.n()).done;)(s=u.value).dom.style.position=this.position}catch(t){o.e(t)}finally{o.f()}e=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer(),a=ic(this.manager.tooltipViews);try{for(a.s();!(f=a.n()).done;)h=f.value,this.container.appendChild(h.dom)}catch(t){a.e(t)}finally{a.f()}e=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);e&&this.maybeMeasure()}},{key:"createTooltip",value:function t(n){var i,e=n.create(this.view);return e.dom.classList.add("cm-tooltip"),n.arrow&&!e.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")&&((i=document.createElement("div")).className="cm-tooltip-arrow",e.dom.appendChild(i)),e.dom.style.position=this.position,e.dom.style.top=Ee,this.container.appendChild(e.dom),e.mount&&e.mount(this.view),e}},{key:"destroy",value:function t(){var n,i,e,r,o;this.view.win.removeEventListener("resize",this.measureSoon),e=ic(this.manager.tooltipViews);try{for(e.s();!(r=e.n()).done;)(o=r.value).dom.remove(),null===(n=o.destroy)||void 0===n||n.call(o)}catch(t){e.e(t)}finally{e.f()}null===(i=this.intersectionObserver)||void 0===i||i.disconnect(),clearTimeout(this.measureTimeout)}},{key:"readMeasure",value:function t(){var n=this,i=this.view.dom.getBoundingClientRect();return{editor:i,parent:this.parent?this.container.getBoundingClientRect():i,pos:this.manager.tooltips.map((function(t,i){var e=n.manager.tooltipViews[i];return e.getCoords?e.getCoords(t.pos):n.view.coordsAtPos(t.pos)})),size:this.manager.tooltipViews.map((function(t){var n;return t.dom.getBoundingClientRect()})),space:this.view.state.facet(De).tooltipSpace(this.view)}}},{key:"writeMeasure",value:function t(n){var i,e,r,o,u,s,a,f,h,c,l,v,d,y,m,p,k,g,w,b,M,x=n.editor,S=n.space,C=[];for(e=0;e<this.manager.tooltips.length;e++)if(r=this.manager.tooltips[e],u=(o=this.manager.tooltipViews[e]).dom,s=n.pos[e],a=n.size[e],!s||s.bottom<=Math.max(x.top,S.top)||s.top>=Math.min(x.bottom,S.bottom)||s.right<Math.max(x.left,S.left)-.1||s.left>Math.min(x.right,S.right)+.1)u.style.top=Ee;else{if(h=(f=r.arrow?o.dom.querySelector(".cm-tooltip-arrow"):null)?7:0,c=a.right-a.left,l=null!==(i=Re.get(o))&&void 0!==i?i:a.bottom-a.top,v=o.offset||Le,d=this.view.textDirection==Pn.LTR,y=a.width>S.right-S.left?d?S.left:S.right-a.width:d?Math.min(s.left-(f?14:0)+v.x,S.right-c):Math.max(S.left,s.left-c+(f?14:0)-v.x),m=!!r.above,!r.strictSide&&(m?s.top-(a.bottom-a.top)-v.y<S.top:s.bottom+(a.bottom-a.top)+v.y>S.bottom)&&m==S.bottom-s.bottom>s.top-S.top&&(m=!m),(p=(m?s.top-S.top:S.bottom-s.bottom)-h)<l&&!1!==o.resize){if(p<this.view.defaultLineHeight){u.style.top=Ee;continue}Re.set(o,l),u.style.height=(l=p)+"px"}else u.style.height&&(u.style.height="");if(k=m?s.top-l-h-v.y:s.bottom+h+v.y,g=y+c,!0!==o.overlap){w=ic(C);try{for(w.s();!(b=w.n()).done;)(M=b.value).left<g&&M.right>y&&M.top<k+l&&M.bottom>k&&(k=m?M.top-l-2-h:M.bottom+h+2)}catch(t){w.e(t)}finally{w.f()}}"absolute"==this.position?(u.style.top=k-n.parent.top+"px",u.style.left=y-n.parent.left+"px"):(u.style.top=k+"px",u.style.left=y+"px"),f&&(f.style.left="".concat(s.left+(d?v.x:-v.x)-(y+14-7),"px")),!0!==o.overlap&&C.push({left:y,top:k,right:g,bottom:k+l}),u.classList.toggle("cm-tooltip-above",m),u.classList.toggle("cm-tooltip-below",!m),o.positioned&&o.positioned(n.space)}}},{key:"maybeMeasure",value:function t(){var n,i,e;if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView))){n=ic(this.manager.tooltipViews);try{for(n.s();!(i=n.n()).done;)(e=i.value).dom.style.top=Ee}catch(t){n.e(t)}finally{n.f()}}}}]),t}(),{eventHandlers:{scroll:function t(){this.maybeMeasure()}}}),Te=Vi.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"".concat(7,"px"),width:"".concat(14,"px"),position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"".concat(7,"px solid transparent"),borderRight:"".concat(7,"px solid transparent")},".cm-tooltip-above &":{bottom:"-".concat(7,"px"),"&:before":{borderTop:"".concat(7,"px solid #bbb")},"&:after":{borderTop:"".concat(7,"px solid #f5f5f5"),bottom:"1px"}},".cm-tooltip-below &":{top:"-".concat(7,"px"),"&:before":{borderBottom:"".concat(7,"px solid #bbb")},"&:after":{borderBottom:"".concat(7,"px solid #f5f5f5"),top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Le={x:0,y:0},Be=w.define({enables:[Ie,Te]}),_e=w.define(),Fe=function(){function t(n){var i=this;yc(this,t),this.view=n,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new Ae(n,_e,(function(t){return i.createHostedView(t)}))}return pc(t,[{key:"createHostedView",value:function t(n){var i=n.create(this.view);return i.dom.classList.add("cm-tooltip-section"),this.dom.appendChild(i.dom),this.mounted&&i.mount&&i.mount(this.view),i}},{key:"mount",value:function t(n){var i,e,r=ic(this.manager.tooltipViews);try{for(r.s();!(i=r.n()).done;)(e=i.value).mount&&e.mount(n)}catch(t){r.e(t)}finally{r.f()}this.mounted=!0}},{key:"positioned",value:function t(n){var i,e,r=ic(this.manager.tooltipViews);try{for(r.s();!(i=r.n()).done;)(e=i.value).positioned&&e.positioned(n)}catch(t){r.e(t)}finally{r.f()}}},{key:"update",value:function t(n){this.manager.update(n)}},{key:"destroy",value:function t(){var n,i,e,r=ic(this.manager.tooltipViews);try{for(r.s();!(i=r.n()).done;)null===(n=(e=i.value).destroy)||void 0===n||n.call(e)}catch(t){r.e(t)}finally{r.f()}}}],[{key:"create",value:function n(i){return new t(i)}}]),t}(),Ne=Be.compute([_e],(function(t){var n=t.facet(_e).filter((function(t){return t}));return 0===n.length?null:{pos:Math.min.apply(Math,Jh(n.map((function(t){return t.pos})))),end:Math.max.apply(Math,Jh(n.filter((function(t){return null!=t.end})).map((function(t){return t.end})))),create:Fe.create,above:n[0].above,arrow:n.some((function(t){return t.arrow}))}})),Ue=function(){function t(n,i,e,r,o){yc(this,t),this.view=n,this.source=i,this.field=e,this.setHover=r,this.hoverTime=o,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:n.dom,time:0},this.checkHover=this.checkHover.bind(this),n.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),n.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}return pc(t,[{key:"update",value:function t(){var n=this;this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout((function(){return n.startHover()}),20))}},{key:"active",get:function t(){return this.view.state.field(this.field)}},{key:"checkHover",value:function t(){if(this.hoverTimeout=-1,!this.active){var n=Date.now()-this.lastMove.time;n<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-n):this.startHover()}}},{key:"startHover",value:function t(){var n,i,e,r,o,u,s,a=this;clearTimeout(this.restartTimeout),n=this.lastMove,null!=(i=this.view.contentDOM.contains(n.target)?this.view.posAtCoords(n):null)&&(null==(e=this.view.coordsAtPos(i))||n.y<e.top||n.y>e.bottom||n.x<e.left-this.view.defaultCharacterWidth||n.x>e.right+this.view.defaultCharacterWidth||(o=(r=this.view.bidiSpans(this.view.state.doc.lineAt(i)).find((function(t){return t.from<=i&&t.to>=i})))&&r.dir==Pn.RTL?-1:1,(null==(u=this.source(this.view,i,n.x<e.left?-o:o))?void 0:u.then)?(s=this.pending={pos:i},u.then((function(t){a.pending==s&&(a.pending=null,t&&a.view.dispatch({effects:a.setHover.of(t)}))}),(function(t){return Yl(a.view.state,t,"hover tooltip")}))):u&&this.view.dispatch({effects:this.setHover.of(u)})))}},{key:"mousemove",value:function t(n){var i,e,r,o,u;this.lastMove={x:n.clientX,y:n.clientY,target:n.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime)),((e=this.active)&&!qd(this.lastMove.target)||this.pending)&&(((o=(r=e||this.pending).pos)==(u=null!==(i=null==e?void 0:e.end)&&void 0!==i?i:o)?this.view.posAtCoords(this.lastMove)==o:Gd(this.view,o,u,n.clientX,n.clientY,6))||(this.view.dispatch({effects:this.setHover.of(null)}),this.pending=null))}},{key:"mouseleave",value:function t(n){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1,this.active&&!qd(n.relatedTarget)&&this.view.dispatch({effects:this.setHover.of(null)})}},{key:"destroy",value:function t(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}]),t}(),ze=(He=V.define()).of(null),We=w.define({combine:function t(n){var i,e,r,o,u=ic(n);try{for(u.s();!(r=u.n()).done;)o=r.value,i=i||o.topContainer,e=e||o.bottomContainer}catch(t){u.e(t)}finally{u.f()}return{topContainer:i,bottomContainer:e}}}),Ve=pn.fromClass(function(){function t(n){var i,e,r,o;yc(this,t),this.input=n.state.facet(qe),this.specs=this.input.filter((function(t){return t})),this.panels=this.specs.map((function(t){return t(n)})),i=n.state.facet(We),this.top=new $e(n,!0,i.topContainer),this.bottom=new $e(n,!1,i.bottomContainer),this.top.sync(this.panels.filter((function(t){return t.top}))),this.bottom.sync(this.panels.filter((function(t){return!t.top}))),e=ic(this.panels);try{for(e.s();!(r=e.n()).done;)(o=r.value).dom.classList.add("cm-panel"),o.mount&&o.mount()}catch(t){e.e(t)}finally{e.f()}}return pc(t,[{key:"update",value:function t(n){var i,e,r,o,u,s,a,f,h,c,l,v,d,y,m,p,k,g=n.state.facet(We);if(this.top.container!=g.topContainer&&(this.top.sync([]),this.top=new $e(n.view,!0,g.topContainer)),this.bottom.container!=g.bottomContainer&&(this.bottom.sync([]),this.bottom=new $e(n.view,!1,g.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses(),(i=n.state.facet(qe))!=this.input){r=[],o=[],u=[],s=[],a=ic(e=i.filter((function(t){return t})));try{for(a.s();!(f=a.n()).done;)h=f.value,c=this.specs.indexOf(h),l=void 0,c<0?(l=h(n.view),s.push(l)):(l=this.panels[c]).update&&l.update(n),r.push(l),(l.top?o:u).push(l)}catch(t){a.e(t)}finally{a.f()}for(this.specs=e,this.panels=r,this.top.sync(o),this.bottom.sync(u),v=0,d=s;v<d.length;v++)(y=d[v]).dom.classList.add("cm-panel"),y.mount&&y.mount()}else{m=ic(this.panels);try{for(m.s();!(p=m.n()).done;)(k=p.value).update&&k.update(n)}catch(t){m.e(t)}finally{m.f()}}}},{key:"destroy",value:function t(){this.top.sync([]),this.bottom.sync([])}}]),t}(),{provide:function t(n){return Vi.scrollMargins.of((function(t){var i=t.plugin(n);return i&&{top:i.top.scrollMargin(),bottom:i.bottom.scrollMargin()}}))}}),$e=function(){function t(n,i,e){yc(this,t),this.view=n,this.top=i,this.container=e,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}return pc(t,[{key:"sync",value:function t(n){var i,e,r=ic(this.panels);try{for(r.s();!(i=r.n()).done;)(e=i.value).destroy&&n.indexOf(e)<0&&e.destroy()}catch(t){r.e(t)}finally{r.f()}this.panels=n,this.syncDOM()}},{key:"syncDOM",value:function t(){var n,i,e,r,o;if(0!=this.panels.length){this.dom||(this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0",(n=this.container||this.view.dom).insertBefore(this.dom,this.top?n.firstChild:null)),i=this.dom.firstChild,e=ic(this.panels);try{for(e.s();!(r=e.n()).done;)if((o=r.value).dom.parentNode==this.dom){for(;i!=o.dom;)i=ty(i);i=i.nextSibling}else this.dom.insertBefore(o.dom,i)}catch(t){e.e(t)}finally{e.f()}for(;i;)i=ty(i)}else this.dom&&(this.dom.remove(),this.dom=void 0)}},{key:"scrollMargin",value:function t(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}},{key:"syncClasses",value:function t(){var n,i,e,r,o,u;if(this.container&&this.classes!=this.view.themeClasses){n=ic(this.classes.split(" "));try{for(n.s();!(i=n.n()).done;)(e=i.value)&&this.container.classList.remove(e)}catch(t){n.e(t)}finally{n.f()}r=ic((this.classes=this.view.themeClasses).split(" "));try{for(r.s();!(o=r.n()).done;)(u=o.value)&&this.container.classList.add(u)}catch(t){r.e(t)}finally{r.f()}}}}]),t}(),qe=w.define({enables:Ve}),Ge=function(t){sc(i,t);var n=fc(i);function i(){return yc(this,i),n.apply(this,arguments)}return pc(i,[{key:"compare",value:function t(n){return this==n||this.constructor==n.constructor&&this.eq(n)}},{key:"eq",value:function t(n){return!1}},{key:"destroy",value:function t(n){}}]),i}(X),Ge.prototype.elementClass="",Ge.prototype.toDOM=void 0,Ge.prototype.mapMode=v.TrackBefore,Ge.prototype.startSide=Ge.prototype.endSide=-1,Ge.prototype.point=!0,Je=w.define(),Ke={class:"",renderEmptyElements:!1,elementStyle:"",markers:function t(){return tt.empty},lineMarker:function t(){return null},widgetMarker:function t(){return null},lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},Qe=w.define(),Xe=w.define({combine:function t(n){return n.some((function(t){return t}))}}),Ze=pn.fromClass(function(){function t(n){var i,e,r;yc(this,t),this.view=n,this.prevViewport=n.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight+"px",this.gutters=n.state.facet(Qe).map((function(t){return new tr(n,t)})),i=ic(this.gutters);try{for(i.s();!(e=i.n()).done;)r=e.value,this.dom.appendChild(r.dom)}catch(t){i.e(t)}finally{i.f()}this.fixed=!n.state.facet(Xe),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),n.scrollDOM.insertBefore(this.dom,n.contentDOM)}return pc(t,[{key:"update",value:function t(n){var i,e,r;this.updateGutters(n)&&(i=this.prevViewport,e=n.view.viewport,r=Math.min(i.to,e.to)-Math.max(i.from,e.from),this.syncGutters(r<.8*(e.to-e.from))),n.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight+"px"),this.view.state.facet(Xe)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=n.view.viewport}},{key:"syncGutters",value:function t(n){var i,e,r,o,u,s,a,f,h,c,l,v,d,y,m,p,k,g,w,b,M,x,S=this,C=this.dom.nextSibling;n&&this.dom.remove(),i=tt.iter(this.view.state.facet(Je),this.view.viewport.from),e=[],r=this.gutters.map((function(t){return new Ye(t,S.view.viewport,-S.view.documentPadding.top)})),o=ic(this.view.viewportLineBlocks);try{for(o.s();!(u=o.n()).done;)if(s=u.value,e.length&&(e=[]),Array.isArray(s.type)){a=!0,f=ic(s.type);try{for(f.s();!(h=f.n()).done;)if((c=h.value).type==Gt.Text&&a){ry(i,e,c.from),l=ic(r);try{for(l.s();!(v=l.n()).done;)(d=v.value).line(this.view,c,e)}catch(t){l.e(t)}finally{l.f()}a=!1}else if(c.widget){y=ic(r);try{for(y.s();!(m=y.n()).done;)(p=m.value).widget(this.view,c)}catch(t){y.e(t)}finally{y.f()}}}catch(t){f.e(t)}finally{f.f()}}else if(s.type==Gt.Text){ry(i,e,s.from),k=ic(r);try{for(k.s();!(g=k.n()).done;)(w=g.value).line(this.view,s,e)}catch(t){k.e(t)}finally{k.f()}}}catch(t){o.e(t)}finally{o.f()}b=ic(r);try{for(b.s();!(M=b.n()).done;)(x=M.value).finish()}catch(t){b.e(t)}finally{b.f()}n&&this.view.scrollDOM.insertBefore(this.dom,C)}},{key:"updateGutters",value:function t(n){var i,e,r,o,u,s,a,f,h,c,l,v,d,y,m=n.startState.facet(Qe),p=n.state.facet(Qe),k=n.docChanged||n.heightChanged||n.viewportChanged||!tt.eq(n.startState.facet(Je),n.state.facet(Je),n.view.viewport.from,n.view.viewport.to);if(m==p){i=ic(this.gutters);try{for(i.s();!(e=i.n()).done;)(r=e.value).update(n)&&(k=!0)}catch(t){i.e(t)}finally{i.f()}}else{k=!0,o=[],u=ic(p);try{for(u.s();!(s=u.n()).done;)a=s.value,(f=m.indexOf(a))<0?o.push(new tr(this.view,a)):(this.gutters[f].update(n),o.push(this.gutters[f]))}catch(t){u.e(t)}finally{u.f()}h=ic(this.gutters);try{for(h.s();!(c=h.n()).done;)(l=c.value).dom.remove(),o.indexOf(l)<0&&l.destroy()}catch(t){h.e(t)}finally{h.f()}for(v=0,d=o;v<d.length;v++)y=d[v],this.dom.appendChild(y.dom);this.gutters=o}return k}},{key:"destroy",value:function t(){var n,i,e=ic(this.gutters);try{for(e.s();!(n=e.n()).done;)(i=n.value).destroy()}catch(t){e.e(t)}finally{e.f()}this.dom.remove()}}]),t}(),{provide:function t(n){return Vi.scrollMargins.of((function(t){var i=t.plugin(n);return i&&0!=i.gutters.length&&i.fixed?t.textDirection==Pn.LTR?{left:i.dom.offsetWidth}:{right:i.dom.offsetWidth}:null}))}}),Ye=function(){function t(n,i,e){yc(this,t),this.gutter=n,this.height=e,this.i=0,this.cursor=tt.iter(n.markers,i.from)}return pc(t,[{key:"addElement",value:function t(n,i,e){var r,o=this.gutter,u=i.top-this.height;this.i==o.elements.length?(r=new nr(n,i.height,u,e),o.elements.push(r),o.dom.appendChild(r.dom)):o.elements[this.i].update(n,i.height,u,e),this.height=i.bottom,this.i++}},{key:"line",value:function t(n,i,e){var r,o,u=[];ry(this.cursor,u,i.from),e.length&&(u=u.concat(e)),(r=this.gutter.config.lineMarker(n,i,u))&&u.unshift(r),o=this.gutter,(0!=u.length||o.config.renderEmptyElements)&&this.addElement(n,i,u)}},{key:"widget",value:function t(n,i){var e=this.gutter.config.widgetMarker(n,i.widget,i);e&&this.addElement(n,i,[e])}},{key:"finish",value:function t(){for(var n,i=this.gutter;i.elements.length>this.i;)n=i.elements.pop(),i.dom.removeChild(n.dom),n.destroy()}}]),t}(),tr=function(){function t(n,i){var e,r,o=this;for(r in yc(this,t),this.view=n,this.config=i,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:""),e=function t(e){o.dom.addEventListener(e,(function(t){var r,u,s,a=t.target;if(a!=o.dom&&o.dom.contains(a)){for(;a.parentNode!=o.dom;)a=a.parentNode;r=((u=a.getBoundingClientRect()).top+u.bottom)/2}else r=t.clientY;s=n.lineBlockAtHeight(r-n.documentTop),i.domEventHandlers[e](n,s,t)&&t.preventDefault()}))},i.domEventHandlers)e(r);this.markers=ey(i.markers(n)),i.initialSpacer&&(this.spacer=new nr(n,0,0,[i.initialSpacer(n)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}return pc(t,[{key:"update",value:function t(n){var i,e,r=this.markers;return this.markers=ey(this.config.markers(n.view)),this.spacer&&this.config.updateSpacer&&(i=this.config.updateSpacer(this.spacer.markers[0],n))!=this.spacer.markers[0]&&this.spacer.update(n.view,0,0,[i]),e=n.view.viewport,!tt.eq(this.markers,r,e.from,e.to)||!!this.config.lineMarkerChange&&this.config.lineMarkerChange(n)}},{key:"destroy",value:function t(){var n,i,e=ic(this.elements);try{for(e.s();!(n=e.n()).done;)(i=n.value).destroy()}catch(t){e.e(t)}finally{e.f()}}}]),t}(),nr=function(){function t(n,i,e,r){yc(this,t),this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(n,i,e,r)}return pc(t,[{key:"update",value:function t(n,i,e,r){this.height!=i&&(this.dom.style.height=(this.height=i)+"px"),this.above!=e&&(this.dom.style.marginTop=(this.above=e)?e+"px":""),oy(this.markers,r)||this.setMarkers(n,r)}},{key:"setMarkers",value:function t(n,i){var e,r,o,u,s,a,f,h,c,l="cm-gutterElement",v=this.dom.firstChild;for(e=0,r=0;;){if(o=r,s=!1,u=e<i.length?i[e++]:null){for((a=u.elementClass)&&(l+=" "+a),f=r;f<this.markers.length;f++)if(this.markers[f].compare(u)){o=f,s=!0;break}}else o=this.markers.length;for(;r<o;)(h=this.markers[r++]).toDOM&&(h.destroy(v),c=v.nextSibling,v.remove(),v=c);if(!u)break;u.toDOM&&(s?v=v.nextSibling:this.dom.insertBefore(u.toDOM(n),v)),s&&r++}this.dom.className=l,this.markers=i}},{key:"destroy",value:function t(){this.setMarkers(null,[])}}]),t}(),ir=w.define(),er=w.define({combine:function t(n){return il(n,{formatNumber:String,domEventHandlers:{}},{domEventHandlers:function t(n,i){var e,r=Object.assign({},n),o=function t(){var n=r[e],o=i[e];r[e]=n?function(t,i,e){return n(t,i,e)||o(t,i,e)}:o};for(e in i)o();return r}})}}),rr=function(t){sc(i,t);var n=fc(i);function i(t){var e;return yc(this,i),(e=n.call(this)).number=t,e}return pc(i,[{key:"eq",value:function t(n){return this.number==n.number}},{key:"toDOM",value:function t(){return document.createTextNode(this.number)}}]),i}(Ge),or=Qe.compute([er],(function(t){return{class:"cm-lineNumbers",renderEmptyElements:!1,markers:function t(n){return n.state.facet(ir)},lineMarker:function t(n,i,e){return e.some((function(t){return t.toDOM}))?null:new rr(uy(n,n.state.doc.lineAt(i.from).number))},widgetMarker:function t(){return null},lineMarkerChange:function t(n){return n.startState.facet(er)!=n.state.facet(er)},initialSpacer:function t(n){return new rr(uy(n,ay(n.state.doc.lines)))},updateSpacer:function t(n,i){var e=uy(i.view,ay(i.view.state.doc.lines));return e==n.number?n:new rr(e)},domEventHandlers:t.facet(er).domEventHandlers}})),ur=new(function(t){sc(i,t);var n=fc(i);function i(){var t;return yc(this,i),(t=n.apply(this,arguments)).elementClass="cm-activeLineGutter",t}return pc(i)}(Ge)),sr=Je.compute(["selection"],(function(t){var n,i,e,r=[],o=-1,u=ic(t.selection.ranges);try{for(u.s();!(n=u.n()).done;)i=n.value,(e=t.doc.lineAt(i.head).from)>o&&(o=e,r.push(ur.range(e)))}catch(t){u.e(t)}finally{u.f()}return tt.of(r)})),ar=new Map,fr=cy(new le({regexp:/\t| +/g,decoration:function t(n){return hy(n[0])},boundary:/\S/})),hr=cy(new le({regexp:/\s+$/g,decoration:Jt.mark({class:"cm-trailingSpace"}),boundary:/\S/})),cr={HeightMap:gi,HeightOracle:di,MeasuredHeights:yi,QueryType:pi,ChangedRange:Cn,computeOrder:ev,moveVisually:ov},lr=n.View=Object.freeze({__proto__:null,BidiSpan:Un,BlockInfo:mi,get BlockType(){return Gt},Decoration:Jt,get Direction(){return Pn},EditorView:Vi,GutterMarker:Ge,MatchDecorator:le,RectangleMarker:te,ViewPlugin:pn,ViewUpdate:jn,WidgetType:qt,qde:cr,closeHoverTooltips:ze,crosshairCursor:Wd,drawSelection:Cd,dropCursor:Od,getPanel:Yd,getTooltip:Kd,gutter:ny,gutterLineClass:Je,gutters:iy,hasHoverTooltips:Qd,highlightActiveLine:Bd,highlightActiveLineGutter:fy,highlightSpecialChars:Rd,highlightTrailingWhitespace:vy,highlightWhitespace:ly,hoverTooltip:Jd,keymap:Qi,layer:Sd,lineNumberMarkers:ir,lineNumbers:sy,logException:Yl,panels:Zd,placeholder:_d,rectangularSelection:zd,repositionTooltips:Xd,runScopeHandlers:md,scrollPastEnd:Ld,showPanel:qe,showTooltip:Be,tooltips:Vd}),vr=1024,dr=0,yr=pc((function t(n,i){yc(this,t),this.from=n,this.to=i})),mr=function(){function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};yc(this,t),this.id=dr++,this.perNode=!!n.perNode,this.deserialize=n.deserialize||function(){throw new Error("This node type doesn't define a deserialize function")}}return pc(t,[{key:"add",value:function t(n){var i=this;if(this.perNode)throw new RangeError("Can't add per-node props to node types");return"function"!=typeof n&&(n=kr.match(n)),function(t){var e=n(t);return void 0===e?null:[i,e]}}}]),t}(),mr.closedBy=new mr({deserialize:function t(n){return n.split(" ")}}),mr.openedBy=new mr({deserialize:function t(n){return n.split(" ")}}),mr.group=new mr({deserialize:function t(n){return n.split(" ")}}),mr.contextHash=new mr({perNode:!0}),mr.lookAhead=new mr({perNode:!0}),mr.mounted=new mr({perNode:!0}),pr=Object.create(null),kr=function(){function t(n,i,e){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;yc(this,t),this.name=n,this.props=i,this.id=e,this.flags=r}return pc(t,[{key:"prop",value:function t(n){return this.props[n.id]}},{key:"isTop",get:function t(){return(1&this.flags)>0}},{key:"isSkipped",get:function t(){return(2&this.flags)>0}},{key:"isError",get:function t(){return(4&this.flags)>0}},{key:"isAnonymous",get:function t(){return(8&this.flags)>0}},{key:"is",value:function t(n){if("string"==typeof n){if(this.name==n)return!0;var i=this.prop(mr.group);return!!i&&i.indexOf(n)>-1}return this.id==n}}],[{key:"define",value:function n(i){var e,r,o,u=i.props&&i.props.length?Object.create(null):pr,s=(i.top?1:0)|(i.skipped?2:0)|(i.error?4:0)|(null==i.name?8:0),a=new t(i.name||"",u,i.id,s);if(i.props){e=ic(i.props);try{for(e.s();!(r=e.n()).done;)if(o=r.value,Array.isArray(o)||(o=o(a)),o){if(o[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");u[o[0].id]=o[1]}}catch(t){e.e(t)}finally{e.f()}}return a}},{key:"match",value:function t(n){var i,e,r,o,u=Object.create(null);for(i in n){e=ic(i.split(" "));try{for(e.s();!(r=e.n()).done;)o=r.value,u[o]=n[i]}catch(t){e.e(t)}finally{e.f()}}return function(t){var n,i,e;for(n=t.prop(mr.group),i=-1;i<(n?n.length:0);i++)if(e=u[i<0?t.name:n[i]])return e}}}]),t}(),kr.none=new kr("",Object.create(null),0,8),gr=function(){function t(n){yc(this,t),this.types=n;for(var i=0;i<n.length;i++)if(n[i].id!=i)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}return pc(t,[{key:"extend",value:function n(){var i,e,r,o,u,s,a,f,h,c,l,v=[];for(i=arguments.length,e=new Array(i),r=0;r<i;r++)e[r]=arguments[r];o=ic(this.types);try{for(o.s();!(u=o.n()).done;){s=u.value,a=null,f=ic(e);try{for(f.s();!(h=f.n()).done;)(l=(c=h.value)(s))&&(a||(a=Object.assign({},s.props)),a[l[0].id]=l[1])}catch(t){f.e(t)}finally{f.f()}v.push(a?new kr(s.name,a,s.id,s.flags):s)}}catch(t){o.e(t)}finally{o.f()}return new t(v)}}]),t}(),wr=new WeakMap,br=new WeakMap,function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays"}(Mr||(Mr={})),xr=function(){function t(n,i,e,r,o){var u,s,a,f,h;if(yc(this,t),this.type=n,this.children=i,this.positions=e,this.length=r,this.props=null,o&&o.length){this.props=Object.create(null),u=ic(o);try{for(u.s();!(s=u.n()).done;)f=(a=Zh(s.value,2))[0],h=a[1],this.props["number"==typeof f?f:f.id]=h}catch(t){u.e(t)}finally{u.f()}}}return pc(t,[{key:"toString",value:function t(){var n,i,e,r,o,u=this.prop(mr.mounted);if(u&&!u.overlay)return u.tree.toString();n="",i=ic(this.children);try{for(i.s();!(e=i.n()).done;)(o=(r=e.value).toString())&&(n&&(n+=","),n+=o)}catch(t){i.e(t)}finally{i.f()}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(n.length?"("+n+")":""):n}},{key:"cursor",value:function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return new Er(this.topNode,n)}},{key:"cursorAt",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=wr.get(this)||this.topNode,o=new Er(r);return o.moveTo(n,i),wr.set(this,o.oMi),o}},{key:"topNode",get:function t(){return new jr(this,0,0,null)}},{key:"resolve",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,e=my(wr.get(this)||this.topNode,n,i,!1);return wr.set(this,e),e}},{key:"resolveInner",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,e=my(br.get(this)||this.topNode,n,i,!0);return br.set(this,e),e}},{key:"iterate",value:function t(n){var i,e,r=n.enter,o=n.leave,u=n.from,s=void 0===u?0:u,a=n.to,f=void 0===a?this.length:a,h=n.mode||0,c=(h&Mr.IncludeAnonymous)>0;for(i=this.cursor(h|Mr.IncludeAnonymous);;){if(e=!1,i.from<=f&&i.to>=s&&(!c&&i.type.isAnonymous||!1!==r(i))){if(i.firstChild())continue;e=!0}for(;e&&o&&(c||!i.type.isAnonymous)&&o(i),!i.nextSibling();){if(!i.parent())return;e=!0}}}},{key:"prop",value:function t(n){return n.perNode?this.props?this.props[n.id]:void 0:this.type.prop(n)}},{key:"propValues",get:function t(){var n,i=[];if(this.props)for(n in this.props)i.push([+n,this.props[n]]);return i}},{key:"balance",value:function n(){var i=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.children.length<=8?this:My(kr.none,this.children,this.positions,0,this.children.length,0,this.length,(function(n,e,r){return new t(i.type,n,e,r,i.propValues)}),e.makeTree||function(n,i,e){return new t(kr.none,n,i,e)})}}],[{key:"build",value:function t(n){return wy(n)}}]),t}(),xr.empty=new xr(kr.none,[],[],0),Sr=function(){function t(n,i){yc(this,t),this.buffer=n,this.index=i}return pc(t,[{key:"id",get:function t(){return this.buffer[this.index-4]}},{key:"start",get:function t(){return this.buffer[this.index-3]}},{key:"end",get:function t(){return this.buffer[this.index-2]}},{key:"size",get:function t(){return this.buffer[this.index-1]}},{key:"pos",get:function t(){return this.index}},{key:"next",value:function t(){this.index-=4}},{key:"fork",value:function n(){return new t(this.buffer,this.index)}}]),t}(),Cr=function(){function t(n,i,e){yc(this,t),this.buffer=n,this.length=i,this.set=e}return pc(t,[{key:"type",get:function t(){return kr.none}},{key:"toString",value:function t(){var n,i=[];for(n=0;n<this.buffer.length;)i.push(this.childString(n)),n=this.buffer[n+3];return i.join(",")}},{key:"childString",value:function t(n){var i,e=this.buffer[n],r=this.buffer[n+3],o=this.set.types[e],u=o.name;if(/\W/.test(u)&&!o.isError&&(u=JSON.stringify(u)),r==(n+=4))return u;for(i=[];n<r;)i.push(this.childString(n)),n=this.buffer[n+3];return u+"("+i.join(",")+")"}},{key:"findChild",value:function t(n,i,e,r,o){var u,s=this.buffer,a=-1;for(u=n;u!=i&&!(dy(o,r,s[u+1],s[u+2])&&(a=u,e>0));u=s[u+3]);return a}},{key:"slice",value:function n(i,e,r){var o,u,s,a=this.buffer,f=new Uint16Array(e-i),h=0;for(o=i,u=0;o<e;)f[u++]=a[o++],f[u++]=a[o++]-r,s=f[u++]=a[o++]-r,f[u++]=a[o++]-i,h=Math.max(h,s);return new t(f,h,this.set)}}]),t}(),jr=function(){function t(n,i,e,r){yc(this,t),this.oMi=n,this.from=i,this.index=e,this.sft=r}return pc(t,[{key:"type",get:function t(){return this.oMi.type}},{key:"name",get:function t(){return this.oMi.type.name}},{key:"to",get:function t(){return this.from+this.oMi.length}},{key:"nextChild",value:function n(i,e,r,o){var u,s,a,f,h,c,l,v,d,y,m=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;for(u=this;;){for(a=(s=u.oMi).children,f=s.positions,h=e>0?a.length:-1;i!=h;i+=e)if(c=a[i],dy(o,r,l=f[i]+u.from,l+c.length))if(c instanceof Cr){if(m&Mr.ExcludeBuffers)continue;if((v=c.findChild(0,c.buffer.length,e,r-l,o))>-1)return new Or(new Pr(u,c,i,l),null,v)}else if(m&Mr.IncludeAnonymous||!c.type.isAnonymous||gy(c))return d=void 0,m&Mr.IgnoreMounts||!c.props||!(d=c.prop(mr.mounted))||d.overlay?(y=new t(c,l,i,u),m&Mr.IncludeAnonymous||!y.type.isAnonymous?y:y.nextChild(e<0?c.children.length-1:0,e,r,o)):new t(d.tree,l,i,u);if(m&Mr.IncludeAnonymous||!u.type.isAnonymous)return null;if(i=u.index>=0?u.index+e:e<0?-1:u.sft.oMi.children.length,!(u=u.sft))return null}}},{key:"firstChild",get:function t(){return this.nextChild(0,1,0,4)}},{key:"lastChild",get:function t(){return this.nextChild(this.oMi.children.length-1,-1,0,4)}},{key:"childAfter",value:function t(n){return this.nextChild(0,1,n,2)}},{key:"childBefore",value:function t(n){return this.nextChild(this.oMi.children.length-1,-1,n,-2)}},{key:"enter",value:function n(i,e){var r,o,u,s,a,f,h,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!(c&Mr.IgnoreOverlays)&&(r=this.oMi.prop(mr.mounted))&&r.overlay){o=i-this.from,u=ic(r.overlay);try{for(u.s();!(s=u.n()).done;)if(f=(a=s.value).from,h=a.to,(e>0?f<=o:f<o)&&(e<0?h>=o:h>o))return new t(r.tree,r.overlay[0].from+this.from,-1,this)}catch(t){u.e(t)}finally{u.f()}}return this.nextChild(0,1,i,e,c)}},{key:"nextSignificantParent",value:function t(){for(var n=this;n.type.isAnonymous&&n.sft;)n=n.sft;return n}},{key:"parent",get:function t(){return this.sft?this.sft.nextSignificantParent():null}},{key:"nextSibling",get:function t(){return this.sft&&this.index>=0?this.sft.nextChild(this.index+1,1,0,4):null}},{key:"prevSibling",get:function t(){return this.sft&&this.index>=0?this.sft.nextChild(this.index-1,-1,0,4):null}},{key:"cursor",value:function t(){var n;return new Er(this,arguments.length>0&&void 0!==arguments[0]?arguments[0]:0)}},{key:"tree",get:function t(){return this.oMi}},{key:"toTree",value:function t(){return this.oMi}},{key:"resolve",value:function t(n){var i;return my(this,n,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,!1)}},{key:"resolveInner",value:function t(n){var i;return my(this,n,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,!0)}},{key:"enterUnfinishedNodesBefore",value:function t(n){return yy(this,n)}},{key:"getChild",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=py(this,n,i,e);return r.length?r[0]:null}},{key:"getChildren",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return py(this,n,i,e)}},{key:"toString",value:function t(){return this.oMi.toString()}},{key:"node",get:function t(){return this}},{key:"matchContext",value:function t(n){return ky(this,n)}}]),t}(),Pr=pc((function t(n,i,e,r){yc(this,t),this.parent=n,this.buffer=i,this.index=e,this.start=r})),Or=function(){function t(n,i,e){yc(this,t),this.context=n,this.sft=i,this.index=e,this.type=n.buffer.set.types[n.buffer.buffer[e]]}return pc(t,[{key:"name",get:function t(){return this.type.name}},{key:"from",get:function t(){return this.context.start+this.context.buffer.buffer[this.index+1]}},{key:"to",get:function t(){return this.context.start+this.context.buffer.buffer[this.index+2]}},{key:"child",value:function n(i,e,r){var o=this.context.buffer,u=o.findChild(this.index+4,o.buffer[this.index+3],i,e-this.context.start,r);return u<0?null:new t(this.context,this,u)}},{key:"firstChild",get:function t(){return this.child(1,0,4)}},{key:"lastChild",get:function t(){return this.child(-1,0,4)}},{key:"childAfter",value:function t(n){return this.child(1,n,2)}},{key:"childBefore",value:function t(n){return this.child(-1,n,-2)}},{key:"enter",value:function n(i,e){var r,o,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return u&Mr.ExcludeBuffers||(o=(r=this.context.buffer).findChild(this.index+4,r.buffer[this.index+3],e>0?1:-1,i-this.context.start,e))<0?null:new t(this.context,this,o)}},{key:"parent",get:function t(){return this.sft||this.context.parent.nextSignificantParent()}},{key:"externalSibling",value:function t(n){return this.sft?null:this.context.parent.nextChild(this.context.index+n,n,0,4)}},{key:"nextSibling",get:function n(){var i=this.context.buffer,e=i.buffer[this.index+3];return e<(this.sft?i.buffer[this.sft.index+3]:i.buffer.length)?new t(this.context,this.sft,e):this.externalSibling(1)}},{key:"prevSibling",get:function n(){var i=this.context.buffer,e=this.sft?this.sft.index+4:0;return this.index==e?this.externalSibling(-1):new t(this.context,this.sft,i.findChild(e,this.index,-1,0,4))}},{key:"cursor",value:function t(){var n;return new Er(this,arguments.length>0&&void 0!==arguments[0]?arguments[0]:0)}},{key:"tree",get:function t(){return null}},{key:"toTree",value:function t(){var n,i=[],e=[],r=this.context.buffer,o=this.index+4,u=r.buffer[this.index+3];return u>o&&(n=r.buffer[this.index+1],i.push(r.slice(o,u,n)),e.push(0)),new xr(this.type,i,e,this.to-this.from)}},{key:"resolve",value:function t(n){var i;return my(this,n,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,!1)}},{key:"resolveInner",value:function t(n){var i;return my(this,n,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,!0)}},{key:"enterUnfinishedNodesBefore",value:function t(n){return yy(this,n)}},{key:"toString",value:function t(){return this.context.buffer.childString(this.index)}},{key:"getChild",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=py(this,n,i,e);return r.length?r[0]:null}},{key:"getChildren",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return py(this,n,i,e)}},{key:"node",get:function t(){return this}},{key:"matchContext",value:function t(n){return ky(this,n)}}]),t}(),Er=function(){function t(n){var i,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(yc(this,t),this.mode=e,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,n instanceof jr)this.yieldNode(n);else{for(this.oMi=n.context.parent,this.buffer=n.context,i=n.sft;i;i=i.sft)this.stack.unshift(i.index);this.bufferNode=n,this.yieldBuf(n.index)}}return pc(t,[{key:"name",get:function t(){return this.type.name}},{key:"yieldNode",value:function t(n){return!!n&&(this.oMi=n,this.type=n.type,this.from=n.from,this.to=n.to,!0)}},{key:"yieldBuf",value:function t(n,i){this.index=n;var e=this.buffer,r=e.start,o=e.buffer;return this.type=i||o.set.types[o.buffer[n]],this.from=r+o.buffer[n+1],this.to=r+o.buffer[n+2],!0}},{key:"yield",value:function t(n){return!!n&&(n instanceof jr?(this.buffer=null,this.yieldNode(n)):(this.buffer=n.context,this.yieldBuf(n.index,n.type)))}},{key:"toString",value:function t(){return this.buffer?this.buffer.buffer.childString(this.index):this.oMi.toString()}},{key:"enterChild",value:function t(n,i,e){var r,o;return this.buffer?!((o=(r=this.buffer.buffer).findChild(this.index+4,r.buffer[this.index+3],n,i-this.buffer.start,e))<0)&&(this.stack.push(this.index),this.yieldBuf(o)):this.yield(this.oMi.nextChild(n<0?this.oMi.oMi.children.length-1:0,n,i,e,this.mode))}},{key:"firstChild",value:function t(){return this.enterChild(1,0,4)}},{key:"lastChild",value:function t(){return this.enterChild(-1,0,4)}},{key:"childAfter",value:function t(n){return this.enterChild(1,n,2)}},{key:"childBefore",value:function t(n){return this.enterChild(-1,n,-2)}},{key:"enter",value:function t(n,i){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.mode;return this.buffer?!(e&Mr.ExcludeBuffers)&&this.enterChild(1,n,i):this.yield(this.oMi.enter(n,i,e))}},{key:"parent",value:function t(){if(!this.buffer)return this.yieldNode(this.mode&Mr.IncludeAnonymous?this.oMi.sft:this.oMi.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());var t=this.mode&Mr.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}},{key:"sibling",value:function t(n){var i,e,r,o;if(!this.buffer)return!!this.oMi.sft&&this.yield(this.oMi.index<0?null:this.oMi.sft.nextChild(this.oMi.index+n,n,0,4,this.mode));if(i=this.buffer.buffer,e=this.stack.length-1,n<0){if(r=e<0?0:this.stack[e]+4,this.index!=r)return this.yieldBuf(i.findChild(r,this.index,-1,0,4))}else if((o=i.buffer[this.index+3])<(e<0?i.buffer.length:i.buffer[this.stack[e]+3]))return this.yieldBuf(o);return e<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+n,n,0,4,this.mode))}},{key:"nextSibling",value:function t(){return this.sibling(1)}},{key:"prevSibling",value:function t(){return this.sibling(-1)}},{key:"atLastNode",value:function t(n){var i,e,r,o,u,s,a,f,h=this.buffer;if(h){if(n>0){if(this.index<h.buffer.buffer.length)return!1}else for(r=0;r<this.index;r++)if(h.buffer.buffer[r+3]<this.index)return!1;i=h.index,e=h.parent}else i=(o=this.oMi).index,e=o.sft;for(;e;i=(u=e).index,e=u.sft,u)if(i>-1)for(s=i+n,a=n<0?-1:e.oMi.children.length;s!=a;s+=n)if(f=e.oMi.children[s],this.mode&Mr.IncludeAnonymous||f instanceof Cr||!f.type.isAnonymous||gy(f))return!1;return!0}},{key:"move",value:function t(n,i){if(i&&this.enterChild(n,0,4))return!0;for(;;){if(this.sibling(n))return!0;if(this.atLastNode(n)||!this.parent())return!1}}},{key:"next",value:function t(){var n=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.move(1,n)}},{key:"prev",value:function t(){var n=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.move(-1,n)}},{key:"moveTo",value:function t(n){for(var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;(this.from==this.to||(i<1?this.from>=n:this.from>n)||(i>-1?this.to<=n:this.to<n))&&this.parent(););for(;this.enterChild(1,n,i););return this}},{key:"node",get:function t(){var n,i,e,r,o,u,s;if(!this.buffer)return this.oMi;if(i=null,e=0,(n=this.bufferNode)&&n.context==this.buffer)t:for(r=this.index,o=this.stack.length;o>=0;){for(u=n;u;u=u.sft)if(u.index==r){if(r==this.index)return u;i=u,e=o+1;break t}r=this.stack[--o]}for(s=e;s<this.stack.length;s++)i=new Or(this.buffer,i,this.stack[s]);return this.bufferNode=new Or(this.buffer,i,this.index)}},{key:"tree",get:function t(){return this.buffer?null:this.oMi.oMi}},{key:"iterate",value:function t(n,i){var e,r;for(e=0;;){if(r=!1,this.type.isAnonymous||!1!==n(this)){if(this.firstChild()){e++;continue}this.type.isAnonymous||(r=!0)}for(;r&&i&&i(this),r=this.type.isAnonymous,!this.nextSibling();){if(!e)return;this.parent(),e--,r=!0}}}},{key:"matchContext",value:function t(n){var i,e,r,o,u;if(!this.buffer)return ky(this.node,n);for(e=(i=this.buffer.buffer).set.types,r=n.length-1,o=this.stack.length-1;r>=0;o--){if(o<0)return ky(this.node,n,r);if(!(u=e[i.buffer[this.stack[o]]]).isAnonymous){if(n[r]&&n[r]!=u.name)return!1;r--}}return!0}}]),t}(),Ar=new WeakMap,Dr=function(){function t(n,i,e,r){var o=arguments.length>4&&void 0!==arguments[4]&&arguments[4],u=arguments.length>5&&void 0!==arguments[5]&&arguments[5];yc(this,t),this.from=n,this.to=i,this.tree=e,this.offset=r,this.open=(o?1:0)|(u?2:0)}return pc(t,[{key:"openStart",get:function t(){return(1&this.open)>0}},{key:"openEnd",get:function t(){return(2&this.open)>0}}],[{key:"addTree",value:function n(i){var e,r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],u=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=[new t(0,i.length,i,0,!1,u)],a=ic(o);try{for(a.s();!(e=a.n()).done;)(r=e.value).to>i.length&&s.push(r)}catch(t){a.e(t)}finally{a.f()}return s}},{key:"applyChanges",value:function n(i,e){var r,o,u,s,a,f,h,c,l,v,d,y=arguments.length>2&&void 0!==arguments[2]?arguments[2]:128;if(!e.length)return i;for(r=[],o=1,u=i.length?i[0]:null,s=0,a=0,f=0;;s++){if((c=(h=s<e.length?e[s]:null)?h.fromA:1e9)-a>=y)for(;u&&u.from<c&&((a>=(l=u).from||c<=l.to||f)&&(l=(v=Math.max(l.from,a)-f)>=(d=Math.min(l.to,c)-f)?null:new t(v,d,l.tree,l.offset+f,s>0,!!h)),l&&r.push(l),!(u.to>c));)u=o<i.length?i[o++]:null;if(!h)break;a=h.toA,f=h.toA-h.toB}return r}}]),t}(),Rr=function(){function t(){yc(this,t)}return pc(t,[{key:"startParse",value:function t(n,i,e){return"string"==typeof n&&(n=new Ir(n)),e=e?e.length?e.map((function(t){return new yr(t.from,t.to)})):[new yr(0,0)]:[new yr(0,n.length)],this.createParse(n,i||[],e)}},{key:"parse",value:function t(n,i,e){for(var r,t=this.startParse(n,i,e);;)if(r=t.advance())return r}}]),t}(),Ir=function(){function t(n){yc(this,t),this.string=n}return pc(t,[{key:"length",get:function t(){return this.string.length}},{key:"chunk",value:function t(n){return this.string.slice(n)}},{key:"lineChunks",get:function t(){return!1}},{key:"read",value:function t(n,i){return this.string.slice(n,i)}}]),t}(),new mr({perNode:!0}),Tr=0,Lr=function(){function t(n,i,e){yc(this,t),this.set=n,this.base=i,this.modified=e,this.id=Tr++}return pc(t,null,[{key:"define",value:function n(i){var e,r,o,u;if(null==i?void 0:i.base)throw new Error("Can not derive from a modified tag");if((e=new t([],null,[])).set.push(e),i){r=ic(i.set);try{for(r.s();!(o=r.n()).done;)u=o.value,e.set.push(u)}catch(t){r.e(t)}finally{r.f()}}return e}},{key:"defineModifier",value:function t(){var n=new _r;return function(t){return t.modified.indexOf(n)>-1?t:_r.get(t.base||t,t.modified.concat(n).sort((function(t,n){return t.id-n.id})))}}}]),t}(),Br=0,_r=function(){function t(){yc(this,t),this.instances=[],this.id=Br++}return pc(t,null,[{key:"get",value:function n(i,e){var r,o,u,s,a,f,h,c,l,v,d,y,m;if(!e.length)return i;if(r=e[0].instances.find((function(t){return t.base==i&&xy(e,t.modified)})),r)return r;u=new Lr(o=[],i,e),s=ic(e);try{for(s.s();!(a=s.n()).done;)(f=a.value).instances.push(u)}catch(t){s.e(t)}finally{s.f()}h=Sy(e),c=ic(i.set);try{for(c.s();!(l=c.n()).done;)if(!(v=l.value).modified.length){d=ic(h);try{for(d.s();!(y=d.n()).done;)m=y.value,o.push(t.get(v,m))}catch(t){d.e(t)}finally{d.f()}}}catch(t){c.e(t)}finally{c.f()}return u}}]),t}(),Fr=new mr,Nr=function(){function t(n,i,e,r){yc(this,t),this.tags=n,this.mode=i,this.context=e,this.next=r}return pc(t,[{key:"opaque",get:function t(){return 0==this.mode}},{key:"inherit",get:function t(){return 1==this.mode}},{key:"sort",value:function t(n){return!n||n.depth<this.depth?(this.next=n,this):(n.next=this.sort(n.next),n)}},{key:"depth",get:function t(){return this.context?this.context.length:0}}]),t}(),Nr.empty=new Nr([],2,null),Ur=function(){function t(n,i,e){yc(this,t),this.at=n,this.highlighters=i,this.span=e,this.class=""}return pc(t,[{key:"startSpan",value:function t(n,i){i!=this.class&&(this.flush(n),n>this.at&&(this.at=n),this.class=i)}},{key:"flush",value:function t(n){n>this.at&&this.class&&this.span(this.at,n,this.class)}},{key:"highlightRange",value:function t(n,i,e,r,o){var u,s,a,f,h,c,l,v,d,y,m,p,k,g=n.type,w=n.from,b=n.to;if(!(w>=e||b<=i||(g.isTop&&(o=this.highlighters.filter((function(t){return!t.scope||t.scope(g)}))),u=r,(a=Py(o,(s=Ey(n)||Nr.empty).tags))&&(u&&(u+=" "),u+=a,1==s.mode&&(r+=(r?" ":"")+a)),this.startSpan(Math.max(i,w),u),s.opaque)))if((f=n.tree&&n.tree.prop(mr.mounted))&&f.overlay){for(h=n.node.enter(f.overlay[0].from+w,1),c=this.highlighters.filter((function(t){return!t.scope||t.scope(f.tree.type)})),l=n.firstChild(),v=0,d=w;;v++){if(m=(y=v<f.overlay.length?f.overlay[v]:null)?y.from+w:b,(p=Math.max(i,d))<(k=Math.min(e,m))&&l)for(;n.from<k&&(this.highlightRange(n,p,k,r,o),this.startSpan(Math.min(k,n.to),u),!(n.to>=m)&&n.nextSibling()););if(!y||m>e)break;(d=y.to+w)>i&&(this.highlightRange(h.cursor(),Math.max(i,y.from+w),Math.min(e,d),"",c),this.startSpan(Math.min(e,d),u))}l&&n.parent()}else if(n.firstChild()){f&&(r="");do{if(!(n.to<=i)){if(n.from>=e)break;this.highlightRange(n,i,e,r,o),this.startSpan(Math.min(e,n.to),u)}}while(n.nextSibling());n.parent()}}}]),t}(),zr=(Hr=Lr.define)(),Wr=Hr(),Vr=Hr(Wr),$r=Hr(Wr),qr=Hr(),Gr=Hr(qr),Jr=Hr(qr),Kr=Hr(),Qr=Hr(Kr),Xr=Hr(),Zr=Hr(),Yr=Hr(),to=Hr(Yr),no=Hr(),jy([{tag:(io={comment:zr,lineComment:Hr(zr),blockComment:Hr(zr),docComment:Hr(zr),name:Wr,variableName:Hr(Wr),typeName:Vr,tagName:Hr(Vr),propertyName:$r,attributeName:Hr($r),className:Hr(Wr),labelName:Hr(Wr),namespace:Hr(Wr),macroName:Hr(Wr),literal:qr,string:Gr,docString:Hr(Gr),character:Hr(Gr),attributeValue:Hr(Gr),number:Jr,integer:Hr(Jr),float:Hr(Jr),bool:Hr(qr),regexp:Hr(qr),escape:Hr(qr),color:Hr(qr),url:Hr(qr),keyword:Xr,self:Hr(Xr),null:Hr(Xr),atom:Hr(Xr),unit:Hr(Xr),modifier:Hr(Xr),operatorKeyword:Hr(Xr),controlKeyword:Hr(Xr),definitionKeyword:Hr(Xr),moduleKeyword:Hr(Xr),operator:Zr,derefOperator:Hr(Zr),arithmeticOperator:Hr(Zr),logicOperator:Hr(Zr),bitwiseOperator:Hr(Zr),compareOperator:Hr(Zr),updateOperator:Hr(Zr),definitionOperator:Hr(Zr),typeOperator:Hr(Zr),controlOperator:Hr(Zr),punctuation:Yr,separator:Hr(Yr),bracket:to,angleBracket:Hr(to),squareBracket:Hr(to),paren:Hr(to),brace:Hr(to),content:Kr,heading:Qr,heading1:Hr(Qr),heading2:Hr(Qr),heading3:Hr(Qr),heading4:Hr(Qr),heading5:Hr(Qr),heading6:Hr(Qr),contentSeparator:Hr(Kr),list:Hr(Kr),quote:Hr(Kr),emphasis:Hr(Kr),strong:Hr(Kr),link:Hr(Kr),monospace:Hr(Kr),strikethrough:Hr(Kr),inserted:Hr(),deleted:Hr(),changed:Hr(),invalid:Hr(),meta:no,documentMeta:Hr(no),annotation:Hr(no),processingInstruction:Hr(no),definition:Lr.defineModifier(),constant:Lr.defineModifier(),function:Lr.defineModifier(),standard:Lr.defineModifier(),local:Lr.defineModifier(),special:Lr.defineModifier()}).link,class:"tok-link"},{tag:io.heading,class:"tok-heading"},{tag:io.emphasis,class:"tok-emphasis"},{tag:io.strong,class:"tok-strong"},{tag:io.keyword,class:"tok-keyword"},{tag:io.atom,class:"tok-atom"},{tag:io.bool,class:"tok-bool"},{tag:io.url,class:"tok-url"},{tag:io.labelName,class:"tok-labelName"},{tag:io.inserted,class:"tok-inserted"},{tag:io.deleted,class:"tok-deleted"},{tag:io.literal,class:"tok-literal"},{tag:io.string,class:"tok-string"},{tag:io.number,class:"tok-number"},{tag:[io.regexp,io.escape,io.special(io.string)],class:"tok-string2"},{tag:io.variableName,class:"tok-variableName"},{tag:io.local(io.variableName),class:"tok-variableName tok-local"},{tag:io.definition(io.variableName),class:"tok-variableName tok-definition"},{tag:io.special(io.variableName),class:"tok-variableName2"},{tag:io.definition(io.propertyName),class:"tok-propertyName tok-definition"},{tag:io.typeName,class:"tok-typeName"},{tag:io.namespace,class:"tok-namespace"},{tag:io.className,class:"tok-className"},{tag:io.macroName,class:"tok-macroName"},{tag:io.propertyName,class:"tok-propertyName"},{tag:io.operator,class:"tok-operator"},{tag:io.comment,class:"tok-comment"},{tag:io.meta,class:"tok-meta"},{tag:io.invalid,class:"tok-invalid"},{tag:io.punctuation,class:"tok-punctuation"}]),ro=new mr,oo=new mr,uo=function(){function t(n,i){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";yc(this,t),this.data=n,this.name=r,Q.prototype.hasOwnProperty("tree")||Object.defineProperty(Q.prototype,"tree",{get:function t(){return Ry(this)}}),this.parser=i,this.extension=[mo.of(this),Q.languageData.of((function(t,n,i){var e,r,o,u,s,a,f,h=Dy(t,n,i),c=h.type.prop(ro);if(!c)return[];if(e=t.facet(c),r=h.type.prop(oo)){o=h.resolve(n-h.from,i),u=ic(r);try{for(u.s();!(s=u.n()).done;)if((a=s.value).test(o,t))return f=t.facet(a.facet),"replace"==a.type?f:f.concat(e)}catch(t){u.e(t)}finally{u.f()}}return e}))].concat(e)}return pc(t,[{key:"isActiveAt",value:function t(n,i){var e;return Dy(n,i,arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1).type.prop(ro)==this.data}},{key:"findRegions",value:function t(n){var i,e,r=this,o=n.facet(mo);return(null==o?void 0:o.data)==this.data?[{from:0,to:n.doc.length}]:o&&o.allowsNesting?(i=[],(e=function t(n,e){var o,u,s,a,f,h,c;if(n.prop(ro)!=r.data){if(o=n.prop(mr.mounted)){if(o.tree.prop(ro)==r.data){if(o.overlay){u=ic(o.overlay);try{for(u.s();!(s=u.n()).done;)a=s.value,i.push({from:a.from+e,to:a.to+e})}catch(t){u.e(t)}finally{u.f()}}else i.push({from:e,to:e+n.length});return}if(o.overlay&&(f=i.length,t(o.tree,o.overlay[0].from+e),i.length>f))return}for(h=0;h<n.children.length;h++)(c=n.children[h])instanceof xr&&t(c,n.positions[h]+e)}else i.push({from:e,to:e+n.length})})(Ry(n),0),i):[]}},{key:"allowsNesting",get:function t(){return!0}}]),t}(),uo.setState=V.define(),so=function(t){sc(i,t);var n=fc(i);function i(t,e,r){var o;return yc(this,i),(o=n.call(this,t,e,[],r)).parser=e,o}return pc(i,[{key:"configure",value:function t(n,e){return new i(this.data,this.parser.configure(n),e||this.name)}},{key:"allowsNesting",get:function t(){return this.parser.hasWrappers()}}],[{key:"define",value:function t(n){var e=Ay(n.languageData);return new i(e,n.parser.configure({props:[ro.add((function(t){return t.isTop?e:void 0}))]}),n.name)}}]),i}(uo),ao=function(){function t(n){yc(this,t),this.doc=n,this.cursorPos=0,this.string="",this.cursor=n.iter()}return pc(t,[{key:"length",get:function t(){return this.doc.length}},{key:"syncTo",value:function t(n){return this.string=this.cursor.next(n-this.cursorPos).value,this.cursorPos=n+this.string.length,this.cursorPos-this.string.length}},{key:"chunk",value:function t(n){return this.syncTo(n),this.string}},{key:"lineChunks",get:function t(){return!0}},{key:"read",value:function t(n,i){var e=this.cursorPos-this.string.length;return n<e||i>=this.cursorPos?this.doc.sliceString(n,i):this.string.slice(n-e,i-e)}}]),t}(),fo=null,ho=function(){function t(n,i){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0,u=arguments.length>5?arguments[5]:void 0,s=arguments.length>6?arguments[6]:void 0,a=arguments.length>7?arguments[7]:void 0;yc(this,t),this.parser=n,this.state=i,this.fragments=e,this.tree=r,this.treeLen=o,this.viewport=u,this.skipped=s,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}return pc(t,[{key:"startParse",value:function t(){return this.parser.startParse(new ao(this.state.doc),this.fragments)}},{key:"work",value:function t(n,i){var e=this;return null!=i&&i>=this.state.doc.length&&(i=void 0),this.tree!=xr.empty&&this.isDone(null!=i?i:this.state.doc.length)?(this.takeTree(),!0):this.withContext((function(){var t,r,o;for("number"==typeof n&&(r=Date.now()+n,n=function t(){return Date.now()>r}),e.parse||(e.parse=e.startParse()),null!=i&&(null==e.parse.stoppedAt||e.parse.stoppedAt>i)&&i<e.state.doc.length&&e.parse.stopAt(i);;){if(o=e.parse.advance()){if(e.fragments=e.withoutTempSkipped(Dr.addTree(o,e.fragments,null!=e.parse.stoppedAt)),e.treeLen=null!==(t=e.parse.stoppedAt)&&void 0!==t?t:e.state.doc.length,e.tree=o,e.parse=null,!(e.treeLen<(null!=i?i:e.state.doc.length)))return!0;e.parse=e.startParse()}if(n())return!1}}))}},{key:"takeTree",value:function t(){var n,i,e=this;this.parse&&(n=this.parse.parsedPos)>=this.treeLen&&((null==this.parse.stoppedAt||this.parse.stoppedAt>n)&&this.parse.stopAt(n),this.withContext((function(){for(;!(i=e.parse.advance()););})),this.treeLen=n,this.tree=i,this.fragments=this.withoutTempSkipped(Dr.addTree(this.tree,this.fragments,!0)),this.parse=null)}},{key:"withContext",value:function t(n){var i=fo;fo=this;try{return n()}finally{fo=i}}},{key:"withoutTempSkipped",value:function t(n){for(var i;i=this.tempSkipped.pop();)n=_y(n,i.from,i.to);return n}},{key:"changes",value:function n(i,e){var r,o,u,s,a,f,h=this.fragments,c=this.tree,l=this.treeLen,v=this.viewport,d=this.skipped;if(this.takeTree(),!i.empty&&(r=[],i.iterChangedRanges((function(t,n,i,e){return r.push({fromA:t,toA:n,fromB:i,toB:e})})),h=Dr.applyChanges(h,r),c=xr.empty,l=0,v={from:i.mapPos(v.from,-1),to:i.mapPos(v.to,1)},this.skipped.length)){d=[],o=ic(this.skipped);try{for(o.s();!(u=o.n()).done;)s=u.value,(a=i.mapPos(s.from,1))<(f=i.mapPos(s.to,-1))&&d.push({from:a,to:f})}catch(t){o.e(t)}finally{o.f()}}return new t(this.parser,e,h,c,l,v,d,this.scheduleOn)}},{key:"updateViewport",value:function t(n){var i,e,r,o,u;if(this.viewport.from==n.from&&this.viewport.to==n.to)return!1;for(this.viewport=n,i=this.skipped.length,e=0;e<this.skipped.length;e++)o=(r=this.skipped[e]).from,u=r.to,o<n.to&&u>n.from&&(this.fragments=_y(this.fragments,o,u),this.skipped.splice(e--,1));return!(this.skipped.length>=i)&&(this.reset(),!0)}},{key:"reset",value:function t(){this.parse&&(this.takeTree(),this.parse=null)}},{key:"skipUntilInView",value:function t(n,i){this.skipped.push({from:n,to:i})}},{key:"isDone",value:function t(n){n=Math.min(n,this.state.doc.length);var i=this.fragments;return this.treeLen>=n&&i.length&&0==i[0].from&&i[0].to>=n}}],[{key:"create",value:function n(i,e,r){return new t(i,e,[],xr.empty,0,r,[],null)}},{key:"getSkippingParser",value:function t(n){return new(function(t){sc(e,t);var i=fc(e);function e(){return yc(this,e),i.apply(this,arguments)}return pc(e,[{key:"createParse",value:function t(i,e,r){var o=r[0].from,u=r[r.length-1].to,s={parsedPos:o,advance:function t(){var i,e,s,a=fo;if(a){i=ic(r);try{for(i.s();!(e=i.n()).done;)s=e.value,a.tempSkipped.push(s)}catch(t){i.e(t)}finally{i.f()}n&&(a.scheduleOn=a.scheduleOn?Promise.all([a.scheduleOn,n]):n)}return this.parsedPos=u,new xr(kr.none,[],[],u-o)},stoppedAt:null,stopAt:function t(){}};return s}}]),e}(Rr))}},{key:"get",value:function t(){return fo}}]),t}(),co=function(){function t(n){yc(this,t),this.context=n,this.tree=n.tree}return pc(t,[{key:"apply",value:function n(i){var e,r;return i.docChanged||this.tree!=this.context.tree?(e=this.context.changes(i.changes,i.state),r=this.context.treeLen==i.startState.doc.length?void 0:Math.max(i.changes.mapPos(this.context.treeLen),e.viewport.to),e.work(20,r)||e.takeTree(),new t(e)):this}}],[{key:"init",value:function n(i){var e=Math.min(3e3,i.doc.length),r=ho.create(i.facet(mo).parser,i,{from:0,to:e});return r.work(20,e)||r.takeTree(),new t(r)}}]),t}(),uo.state=x.define({create:co.init,update:function t(n,i){var e,r,o=ic(i.effects);try{for(o.s();!(e=o.n()).done;)if((r=e.value).is(uo.setState))return r.value}catch(t){o.e(t)}finally{o.f()}return i.startState.facet(mo)!=i.state.facet(mo)?co.init(i.state):n.apply(i)}}),lo=function t(n){var i=setTimeout((function(){return n()}),500);return function(){return clearTimeout(i)}},"undefined"!=typeof requestIdleCallback&&(lo=function t(n){var i=-1,e=setTimeout((function(){i=requestIdleCallback(n,{timeout:400})}),100);return function(){return i<0?clearTimeout(e):cancelIdleCallback(i)}}),vo="undefined"!=typeof navigator&&(null===(eo=navigator.scheduling)||void 0===eo?void 0:eo.isInputPending)?function(){return navigator.scheduling.isInputPending()}:null,yo=pn.fromClass(function(){function t(n){yc(this,t),this.view=n,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}return pc(t,[{key:"update",value:function t(n){var i=this.view.state.field(uo.state).context;(i.updateViewport(n.view.viewport)||this.view.viewport.to>i.treeLen)&&this.scheduleWork(),n.docChanged&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(i)}},{key:"scheduleWork",value:function t(){if(!this.working){var n=this.view.state,i=n.field(uo.state);i.tree==i.context.tree&&i.context.isDone(n.doc.length)||(this.working=lo(this.work))}}},{key:"work",value:function t(n){var i,e,r,o,u,s,a,f;this.working=null,i=Date.now(),this.chunkEnd<i&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=i+3e4,this.chunkBudget=3e3),this.chunkBudget<=0||(r=(e=this.view).state,o=e.viewport.to,(u=r.field(uo.state)).tree==u.context.tree&&u.context.isDone(o+1e5)||(s=Date.now()+Math.min(this.chunkBudget,100,n&&!vo?Math.max(25,n.timeRemaining()-5):1e9),a=u.context.treeLen<o&&r.doc.length>o+1e3,f=u.context.work((function(){return vo&&vo()||Date.now()>s}),o+(a?0:1e5)),this.chunkBudget-=Date.now()-i,(f||this.chunkBudget<=0)&&(u.context.takeTree(),this.view.dispatch({effects:uo.setState.of(new co(u.context))})),this.chunkBudget>0&&(!f||a)&&this.scheduleWork(),this.checkAsyncSchedule(u.context)))}},{key:"checkAsyncSchedule",value:function t(n){var i=this;n.scheduleOn&&(this.workScheduled++,n.scheduleOn.then((function(){return i.scheduleWork()})).catch((function(t){return Yl(i.view.state,t)})).then((function(){return i.workScheduled--})),n.scheduleOn=null)}},{key:"destroy",value:function t(){this.working&&this.working()}},{key:"isWorking",value:function t(){return!!(this.working||this.workScheduled>0)}}]),t}(),{eventHandlers:{focus:function t(){this.scheduleWork()}}}),mo=w.define({combine:function t(n){return n.length?n[0]:null},enables:function t(n){return[uo.state,yo,Vi.contentAttributes.compute([n],(function(t){var i=t.facet(n);return i&&i.name?{"data-language":i.name}:{}}))]}}),po=pc((function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];yc(this,t),this.language=n,this.support=i,this.extension=[n,i]})),ko=function(){function t(n,i,e,r,o){var u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:void 0;yc(this,t),this.name=n,this.alias=i,this.extensions=e,this.filename=r,this.loadFunc=o,this.support=u,this.loading=null}return pc(t,[{key:"load",value:function t(){var n=this;return this.loading||(this.loading=this.loadFunc().then((function(t){return n.support=t}),(function(t){throw n.loading=null,t})))}}],[{key:"of",value:function n(i){var e=i.load,r=i.support;if(!e){if(!r)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");e=function t(){return Promise.resolve(r)}}return new t(i.name,(i.alias||[]).concat(i.name).map((function(t){return t.toLowerCase()})),i.extensions||[],i.filename,e,r)}},{key:"matchFilename",value:function t(n,i){var e,r,o,u,s,a,f=ic(n);try{for(f.s();!(e=f.n()).done;)if((r=e.value).filename&&r.filename.test(i))return r}catch(t){f.e(t)}finally{f.f()}if(o=/\.([^.]+)$/.exec(i)){u=ic(n);try{for(u.s();!(s=u.n()).done;)if((a=s.value).extensions.indexOf(o[1])>-1)return a}catch(t){u.e(t)}finally{u.f()}}return null}},{key:"matchLanguageName",value:function t(n,i){var e,r,o,u,s,a,f,h,c,l,v=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];i=i.toLowerCase(),e=ic(n);try{for(e.s();!(r=e.n()).done;)if((o=r.value).alias.some((function(t){return t==i})))return o}catch(t){e.e(t)}finally{e.f()}if(v){u=ic(n);try{for(u.s();!(s=u.n()).done;){f=ic((a=s.value).alias);try{for(f.s();!(h=f.n()).done;)if(c=h.value,(l=i.indexOf(c))>-1&&(c.length>2||!/\w/.test(i[l-1])&&!/\w/.test(i[l+c.length])))return a}catch(t){f.e(t)}finally{f.f()}}}catch(t){u.e(t)}finally{u.f()}}return null}}]),t}(),go=w.define(),wo=w.define({combine:function t(n){if(!n.length)return" ";var i=n[0];if(!i||/\S/.test(i)||Array.from(i).some((function(t){return t!=i[0]})))throw new Error("Invalid indent unit: "+JSON.stringify(n[0]));return i}}),bo=function(){function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};yc(this,t),this.state=n,this.options=i,this.unit=Fy(n)}return pc(t,[{key:"lineAt",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,e=this.state.doc.lineAt(n),r=this.options,o=r.simulateBreak,u=r.simulateDoubleBreak;return null!=o&&o>=e.from&&o<=e.to?u&&o==n?{text:"",from:n}:(i<0?o<n:o<=n)?{text:e.text.slice(o-e.from),from:o}:{text:e.text.slice(0,o-e.from),from:e.from}:e}},{key:"textAfterPos",value:function t(n){var i,e,r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this.options.simulateDoubleBreak&&n==this.options.simulateBreak?"":(e=(i=this.lineAt(n,o)).text,r=i.from,e.slice(n-r,Math.min(e.length,n+100-r)))}},{key:"column",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,e=this.lineAt(n,i),r=e.text,o=e.from,u=this.countColumn(r,n-o),s=this.options.overrideIndentation?this.options.overrideIndentation(o):-1;return s>-1&&(u+=s-this.countColumn(r,r.search(/\S|$/))),u}},{key:"countColumn",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.length;return ll(n,this.state.tabSize,i)}},{key:"lineIndent",value:function t(n){var i,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=this.lineAt(n,e),o=r.text,u=r.from,s=this.options.overrideIndentation;return s&&(i=s(u))>-1?i:this.countColumn(o,o.search(/\S|$/))}},{key:"simulatedBreak",get:function t(){return this.options.simulateBreak||null}}]),t}(),Mo=new mr,xo=function(t){sc(i,t);var n=fc(i);function i(t,e,r){var o;return yc(this,i),(o=n.call(this,t.state,t.options)).base=t,o.pos=e,o.node=r,o}return pc(i,[{key:"textAfter",get:function t(){return this.textAfterPos(this.pos)}},{key:"baseIndent",get:function t(){for(var n,i=this.state.doc.lineAt(this.node.from);;){for(n=this.node.resolve(i.from);n.parent&&n.parent.from==n.from;)n=n.parent;if(Gy(n,this.node))break;i=this.state.doc.lineAt(n.from)}return this.lineIndent(i.from)}},{key:"continue",value:function t(){var n=this.node.parent;return n?$y(n,this.pos,this.base):0}}],[{key:"create",value:function t(n,e,r){return new i(n,e,r)}}]),i}(bo),So=function t(n){return n.baseIndent},Co=200,jo=w.define(),Po=new mr,Oo=V.define({map:em}),Eo=V.define({map:em}),Ao=x.define({create:function t(){return Jt.none},update:function t(n,i){var e,r,o,u,s;n=n.map(i.changes),e=ic(i.effects);try{for(o=function t(){var i=r.value;i.is(Oo)&&!sm(n,i.value.from,i.value.to)?n=n.update({add:[No.range(i.value.from,i.value.to)]}):i.is(Eo)&&(n=n.update({filter:function t(n,e){return i.value.from!=n||i.value.to!=e},filterFrom:i.value.from,filterTo:i.value.to}))},e.s();!(r=e.n()).done;)o()}catch(t){e.e(t)}finally{e.f()}return i.selection&&(u=!1,s=i.selection.main.head,n.between(s,s,(function(t,n){t<s&&n>s&&(u=!0)})),u&&(n=n.update({filterFrom:s,filterTo:s,filter:function t(n,i){return i<=s||n>=s}}))),n},provide:function t(n){return Vi.decorations.from(n)},toJSON:function t(n,i){var e=[];return n.between(0,i.doc.length,(function(t,n){e.push(t,n)})),e},fromJSON:function t(n){var i,e,r,o;if(!Array.isArray(n)||n.length%2)throw new RangeError("Invalid JSON for fold state");for(i=[],e=0;e<n.length;){if(r=n[e++],o=n[e++],"number"!=typeof r||"number"!=typeof o)throw new RangeError("Invalid JSON for fold state");i.push(No.range(r,o))}return Jt.set(i,!0)}}),Lo=function t(n){var i,e,r,o,u=[],s=ic(rm(n));try{for(s.s();!(i=s.n()).done;)e=i.value,(r=um(n.state,e.from,e.to))?u.push(Eo.of(r),fm(n,r,!1)):(o=hm(n,e))&&u.push(Oo.of(o),fm(n,o))}catch(t){s.e(t)}finally{s.f()}return u.length>0&&n.dispatch({effects:am(n.state,u)}),!!u.length},Bo=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:Do=function t(n){var i,e,r,o=ic(rm(n));try{for(o.s();!(i=o.n()).done;)if(e=i.value,r=im(n.state,e.from,e.to))return n.dispatch({effects:am(n.state,[Oo.of(r),fm(n,r)])}),!0}catch(t){o.e(t)}finally{o.f()}return!1}},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:Ro=function t(n){var i,e,r,o,u;if(!n.state.field(Ao,!1))return!1;i=[],e=ic(rm(n));try{for(e.s();!(r=e.n()).done;)o=r.value,(u=um(n.state,o.from,o.to))&&i.push(Eo.of(u),fm(n,u,!1))}catch(t){e.e(t)}finally{e.f()}return i.length&&n.dispatch({effects:i}),i.length>0}},{key:"Ctrl-Alt-[",run:Io=function t(n){var i,e,r,o=n.state,u=[];for(i=0;i<o.doc.length;)(r=im(o,(e=n.lineBlockAt(i)).from,e.to))&&u.push(Oo.of(r)),i=(r?n.lineBlockAt(r.to):e).to+1;return u.length&&n.dispatch({effects:am(n.state,u)}),!!u.length}},{key:"Ctrl-Alt-]",run:To=function t(n){var i,e=n.state.field(Ao,!1);return!(!e||!e.size)&&(i=[],e.between(0,n.state.doc.length,(function(t,n){i.push(Eo.of({from:t,to:n}))})),n.dispatch({effects:i}),!0)}}],_o={placeholderDOM:null,placeholderText:"\u2026"},Fo=w.define({combine:function t(n){return il(n,_o)}}),No=Jt.replace({widget:new(function(t){sc(i,t);var n=fc(i);function i(){return yc(this,i),n.apply(this,arguments)}return pc(i,[{key:"toDOM",value:function t(n){var i,e=n.state,r=e.facet(Fo),o=function t(i){var e=n.lineBlockAt(n.posAtDOM(i.target)),r=um(n.state,e.from,e.to);r&&n.dispatch({effects:Eo.of(r)}),i.preventDefault()};return r.placeholderDOM?r.placeholderDOM(n,o):((i=document.createElement("span")).textContent=r.placeholderText,i.setAttribute("aria-label",e.phrase("folded code")),i.title=e.phrase("unfold"),i.className="cm-foldPlaceholder",i.onclick=o,i)}}]),i}(qt))}),Uo={openText:"\u2304",closedText:"\u203a",markerDOM:null,domEventHandlers:{},foldingChanged:function t(){return!1}},Ho=function(t){sc(i,t);var n=fc(i);function i(t,e){var r;return yc(this,i),(r=n.call(this)).config=t,r.open=e,r}return pc(i,[{key:"eq",value:function t(n){return this.config==n.config&&this.open==n.open}},{key:"toDOM",value:function t(n){if(this.config.markerDOM)return this.config.markerDOM(this.open);var i=document.createElement("span");return i.textContent=this.open?this.config.openText:this.config.closedText,i.title=n.state.phrase(this.open?"Fold line":"Unfold line"),i}}]),i}(Ge),zo=Vi.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}}),Wo=function(){function t(n,i){var e,r,o;function u(t){var n=ht.newName();return(e||(e=Object.create(null)))["."+n]=t,n}yc(this,t),this.specs=n,r="string"==typeof i.all?i.all:i.all?u(i.all):void 0,o=i.scope,this.scope=o instanceof uo?function(t){return t.prop(ro)==o.data}:o?function(t){return t==o}:void 0,this.style=jy(n.map((function(t){return{tag:t.tag,class:t.class||u(Object.assign({},t,{tag:null}))}})),{all:r}).style,this.module=e?new ht(e):null,this.themeType=i.themeType}return pc(t,null,[{key:"define",value:function n(i,e){return new t(i,e||{})}}]),t}(),Vo=w.define(),$o=w.define({combine:function t(n){return n.length?[n[0]]:null}}),qo=function(){function t(n){yc(this,t),this.markCache=Object.create(null),this.tree=Ry(n.state),this.decorations=this.buildDeco(n,vm(n.state))}return pc(t,[{key:"update",value:function t(n){var i=Ry(n.state),e=vm(n.state),r=e!=vm(n.startState);i.length<n.view.viewport.to&&!r&&i.type==this.tree.type?this.decorations=this.decorations.map(n.changes):(i!=this.tree||n.viewportChanged||r)&&(this.tree=i,this.decorations=this.buildDeco(n.view,e))}},{key:"buildDeco",value:function t(n,i){var e,r,o,u,s,a,f=this;if(!i||!this.tree.length)return Jt.none;e=new nt,r=ic(n.visibleRanges);try{for(r.s();!(o=r.n()).done;)s=(u=o.value).from,a=u.to,Oy(this.tree,i,(function(t,n,i){e.add(t,n,f.markCache[i]||(f.markCache[i]=Jt.mark({class:i})))}),s,a)}catch(t){r.e(t)}finally{r.f()}return e.finish()}}]),t}(),Go=E.high(pn.fromClass(qo,{decorations:function t(n){return n.decorations}})),Jo=Wo.define([{tag:io.meta,color:"#404740"},{tag:io.link,textDecoration:"underline"},{tag:io.heading,textDecoration:"underline",fontWeight:"bold"},{tag:io.emphasis,fontStyle:"italic"},{tag:io.strong,fontWeight:"bold"},{tag:io.strikethrough,textDecoration:"line-through"},{tag:io.keyword,color:"#708"},{tag:[io.atom,io.bool,io.url,io.contentSeparator,io.labelName],color:"#219"},{tag:[io.literal,io.inserted],color:"#164"},{tag:[io.string,io.deleted],color:"#a11"},{tag:[io.regexp,io.escape,io.special(io.string)],color:"#e40"},{tag:io.definition(io.variableName),color:"#00f"},{tag:io.local(io.variableName),color:"#30a"},{tag:[io.typeName,io.namespace],color:"#085"},{tag:io.className,color:"#167"},{tag:[io.special(io.variableName),io.macroName],color:"#256"},{tag:io.definition(io.propertyName),color:"#00c"},{tag:io.comment,color:"#940"},{tag:io.invalid,color:"#f00"}]),Ko=Vi.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Qo=1e4,Xo="()[]{}",Zo=w.define({combine:function t(n){return il(n,{afterCursor:!0,brackets:Xo,maxScanDistance:Qo,renderMatch:mm})}}),Yo=Jt.mark({class:"cm-matchingBracket"}),tu=Jt.mark({class:"cm-nonmatchingBracket"}),nu=x.define({create:function t(){return Jt.none},update:function t(n,i){var e,r,o,u,s,a;if(!i.docChanged&&!i.selection)return n;e=[],r=i.state.facet(Zo),o=ic(i.state.selection.ranges);try{for(o.s();!(u=o.n()).done;)(s=u.value).empty&&(a=wm(i.state,s.head,-1,r)||s.head>0&&wm(i.state,s.head-1,1,r)||r.afterCursor&&(wm(i.state,s.head,1,r)||s.head<i.state.doc.length&&wm(i.state,s.head+1,-1,r)))&&(e=e.concat(r.renderMatch(a,i.state)))}catch(t){o.e(t)}finally{o.f()}return Jt.set(e,!0)},provide:function t(n){return Vi.decorations.from(n)}}),iu=[nu,Ko],eu=new mr,ru=function(){function t(n,i,e,r){yc(this,t),this.string=n,this.tabSize=i,this.indentUnit=e,this.overrideIndent=r,this.pos=0,this.start=0,this.lastColumnPos=0,this.lastColumnValue=0}return pc(t,[{key:"eol",value:function t(){return this.pos>=this.string.length}},{key:"sol",value:function t(){return 0==this.pos}},{key:"peek",value:function t(){return this.string.charAt(this.pos)||void 0}},{key:"next",value:function t(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)}},{key:"eat",value:function t(n){var i,e=this.string.charAt(this.pos);if(i="string"==typeof n?e==n:e&&(n instanceof RegExp?n.test(e):n(e)))return++this.pos,e}},{key:"eatWhile",value:function t(n){for(var i=this.pos;this.eat(n););return this.pos>i}},{key:"eatSpace",value:function t(){for(var n=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>n}},{key:"skipToEnd",value:function t(){this.pos=this.string.length}},{key:"skipTo",value:function t(n){var i=this.string.indexOf(n,this.pos);if(i>-1)return this.pos=i,!0}},{key:"backUp",value:function t(n){this.pos-=n}},{key:"column",value:function t(){return this.lastColumnPos<this.start&&(this.lastColumnValue=xm(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue}},{key:"indentation",value:function t(){var n;return null!==(n=this.overrideIndent)&&void 0!==n?n:xm(this.string,null,this.tabSize)}},{key:"match",value:function t(n,i,e){var r,o,t;return"string"==typeof n?(r=function t(n){return e?n.toLowerCase():n})(o=this.string.substr(this.pos,n.length))==r(n)?(!1!==i&&(this.pos+=n.length),!0):null:(t=this.string.slice(this.pos).match(n),t&&t.index>0?null:(t&&!1!==i&&(this.pos+=t[0].length),t))}},{key:"current",value:function t(){return this.string.slice(this.start,this.pos)}}]),t}(),ou=new WeakMap,uu=function(t){sc(i,t);var n=fc(i);function i(t){var e,r,o,u,s;return yc(this,i),r=Ay(t.languageData),o=Sm(t),s=new(function(t){sc(i,t);var n=fc(i);function i(){return yc(this,i),n.apply(this,arguments)}return pc(i,[{key:"createParse",value:function t(n,i,e){return new su(u,n,i,e)}}]),i}(Rr)),(e=n.call(this,r,s,[go.of((function(t,n){return e.getIndent(t,n)}))],t.name)).topNode=Rm(r),u=cc(e),e.streamParser=o,e.stateAfter=new mr({perNode:!0}),e.tokenTable=t.tokenTable?new ku(o.tokenTable):gu,e}return pc(i,[{key:"getIndent",value:function t(n,i){for(var e,r,o,u,s,a,f,h,c,l,v=Ry(n.state),d=v.resolve(i);d&&d.type!=this.topNode;)d=d.parent;if(!d)return null;if(e=void 0,(r=n.options.overrideIndentation)&&null!=(e=ou.get(n.state))&&e<i-1e4&&(e=void 0),(o=jm(this,v,0,d.from,null!=e?e:i))?(s=o.state,u=o.pos+1):(s=this.streamParser.startState(n.unit),u=0),i-u>1e4)return null;for(;u<i;){if(a=n.state.doc.lineAt(u),f=Math.min(i,a.to),a.length)for(h=r?r(a.from):-1,c=new ru(a.text,n.state.tabSize,n.unit,h<0?void 0:h);c.pos<f-a.from;)Em(this.streamParser.token,c,s);else this.streamParser.blankLine(s,n.unit);if(f==i)break;u=a.to+1}return l=n.lineAt(i),r&&null==e&&ou.set(n.state,l.from),this.streamParser.indent(s,/^\s*(.*)/.exec(l.text)[1],n)}},{key:"allowsNesting",get:function t(){return!1}}],[{key:"define",value:function t(n){return new i(n)}}]),i}(uo),su=function(){function t(n,i,e,r){var o,u,s,a,f,h;for(yc(this,t),this.lang=n,this.input=i,this.fragments=e,this.ranges=r,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=r[r.length-1].to,o=ho.get(),a=(s=Om(n,e,u=r[0].from,null==o?void 0:o.state)).state,f=s.tree,this.state=a,this.parsedPos=this.chunkStart=u+f.length,h=0;h<f.children.length;h++)this.chunks.push(f.children[h]),this.chunkPos.push(f.positions[h]);o&&this.parsedPos<o.viewport.from-1e5&&(this.state=this.lang.streamParser.startState(Fy(o.state)),o.skipUntilInView(this.parsedPos,o.viewport.from),this.parsedPos=o.viewport.from),this.moveRangeIndex()}return pc(t,[{key:"advance",value:function t(){var n=ho.get(),i=null==this.stoppedAt?this.to:Math.min(this.to,this.stoppedAt),e=Math.min(i,this.chunkStart+2048);for(n&&(e=Math.min(e,n.viewport.to));this.parsedPos<e;)this.parseLine(n);return this.chunkStart<this.parsedPos&&this.finishChunk(),this.parsedPos>=i?this.finish():n&&this.parsedPos>=n.viewport.to?(n.skipUntilInView(this.parsedPos,i),this.finish()):null}},{key:"stopAt",value:function t(n){this.stoppedAt=n}},{key:"lineAfter",value:function t(n){var i,e=this.input.chunk(n);return this.input.lineChunks?"\n"==e&&(e=""):(i=e.indexOf("\n"))>-1&&(e=e.slice(0,i)),n+e.length<=this.to?e:e.slice(0,this.to-n)}},{key:"nextLine",value:function t(){var n,i,e,r,o=this.parsedPos,u=this.lineAfter(o),s=o+u.length;for(n=this.rangeIndex;!((i=this.ranges[n].to)>=s)&&(u=u.slice(0,i-(s-u.length)),++n!=this.ranges.length);)e=this.ranges[n].from,u+=r=this.lineAfter(e),s=e+r.length;return{line:u,end:s}}},{key:"skipGapsTo",value:function t(n,i,e){for(var r,o,u;r=this.ranges[this.rangeIndex].to,o=n+i,!(e>0?r>o:r>=o);)i+=(u=this.ranges[++this.rangeIndex].from)-r;return i}},{key:"moveRangeIndex",value:function t(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}},{key:"emitToken",value:function t(n,i,e,r,o){if(this.ranges.length>1){i+=o=this.skipGapsTo(i,o,1);var u=this.chunk.length;e+=o=this.skipGapsTo(e,o,-1),r+=this.chunk.length-u}return this.chunk.push(n,i,e,r),o}},{key:"parseLine",value:function t(n){var i,e=this.nextLine(),r=e.line,o=e.end,u=0,s=this.lang.streamParser,a=new ru(r,n?n.state.tabSize:4,n?Fy(n.state):2);if(a.eol())s.blankLine(this.state,a.indentUnit);else for(;!(a.eol()||((i=Em(s.token,a,this.state))&&(u=this.emitToken(this.lang.tokenTable.resolve(i),this.parsedPos+a.start,this.parsedPos+a.pos,4,u)),a.start>1e4)););this.parsedPos=o,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}},{key:"finishChunk",value:function t(){var n=xr.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:hu,topID:0,maxBufferLength:2048,reused:this.chunkReused});n=new xr(n.type,n.children,n.positions,n.length,[[this.lang.stateAfter,this.lang.streamParser.copyState(this.state)]]),this.chunks.push(n),this.chunkPos.push(this.chunkStart-this.ranges[0].from),this.chunk=[],this.chunkReused=void 0,this.chunkStart=this.parsedPos}},{key:"finish",value:function t(){return new xr(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}}]),t}(),au=Object.create(null),fu=[kr.none],hu=new gr(fu),cu=[],lu=Object.create(null),vu=0,du=[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]];vu<du.length;vu++)mu=(yu=Zh(du[vu],2))[0],pu=yu[1],lu[mu]=Dm(au,pu);function Am(t,n){cu.indexOf(t)>-1||(cu.push(t),console.warn(n))}function Dm(t,n){var i,e,r,o,u,s=null,a=ic(n.split("."));try{for(a.s();!(i=a.n()).done;)(r=t[e=i.value]||io[e])?"function"==typeof r?s?s=r(s):Am(e,"Modifier ".concat(e," used at start of tag")):s?Am(e,"Tag ".concat(e," used as modifier")):s=r:Am(e,"Unknown highlighting tag ".concat(e))}catch(t){a.e(t)}finally{a.f()}return s?(o=n.replace(/ /g,"_"),u=kr.define({id:fu.length,name:o,props:[Cy(Gh({},o,s))]}),fu.push(u),u.id):0}function Rm(t){var n=kr.define({id:fu.length,name:"Document",props:[ro.add((function(){return t}))]});return fu.push(n),n}function Im(t){var n=Object.keys(t).join(""),i=/\w/.test(n);return i&&(n=n.replace(/\w/g,"")),"[".concat(i?"\\w":"").concat(n.replace(/[^\w\s]/g,"\\$&"),"]")}function Tm(t){var n,i,e,r,o=Object.create(null),u=Object.create(null),s=ic(t);try{for(s.s();!(n=s.n()).done;)for(o[(i=n.value.label)[0]]=!0,e=1;e<i.length;e++)u[i[e]]=!0}catch(t){s.e(t)}finally{s.f()}return r=Im(o)+Im(u)+"*$",[new RegExp("^"+r),new RegExp(r)]}function Lm(t){var n=t.map((function(t){return"string"==typeof t?{label:t}:t})),i=n.every((function(t){return/^\w+$/.test(t.label)}))?[/\w*$/,/\w+$/]:Tm(n),e=Zh(i,2),r=e[0],o=e[1];return function(t){var i=t.matchBefore(o);return i||t.explicit?{from:i?i.from:t.pos,options:n,validFor:r}:null}}function Bm(t,n){return function(i){for(var e=Ry(i.state).resolveInner(i.pos,-1);e;e=e.parent){if(t.indexOf(e.name)>-1)return n(i);if(e.type.isTop)break}return null}}function _m(t,n){return function(i){for(var e=Ry(i.state).resolveInner(i.pos,-1);e;e=e.parent){if(t.indexOf(e.name)>-1)return null;if(e.type.isTop)break}return n(i)}}function Fm(t){return t.selection.main.from}function Nm(t,n){var i,e=t.source,r=n&&"^"!=e[0],o="$"!=e[e.length-1];return r||o?new RegExp("".concat(r?"^":"","(?:").concat(e,")").concat(o?"$":""),null!==(i=t.flags)&&void 0!==i?i:t.ignoreCase?"i":""):t}function Um(t,n,i,e){var r=t.selection.main,o=i-r.from,u=e-r.from;return Object.assign(Object.assign({},t.changeByRange((function(s){return s!=r&&i!=e&&t.sliceDoc(s.from+o,s.from+u)!=t.sliceDoc(i,e)?{range:s}:{changes:{from:s.from+o,to:e==r.from?s.to:s.from+u,insert:n},range:k.cursor(s.from+o+n.length)}}))),{userEvent:"input.complete"})}function Hm(t){if(!Array.isArray(t))return t;var n=Su.get(t);return n||Su.set(t,n=Lm(t)),n}function zm(t,n){return t?n?t+" "+n:t:n}function Wm(t,n,i,e,r){var o,u,s,a=t.textDirection==Pn.RTL,f=a,h=!1,c="top",l=n.left-r.left,v=r.right-n.right,d=e.right-e.left,y=e.bottom-e.top;return f&&l<Math.min(d,v)?f=!1:!f&&v<Math.min(d,l)&&(f=!0),d<=(f?l:v)?(o=Math.max(r.top,Math.min(i.top,r.bottom-y))-n.top,u=Math.min(400,f?l:v)):(h=!0,u=Math.min(400,(a?n.right:r.right-n.left)-30),(s=r.bottom-n.bottom)>=y||s>n.top?o=i.bottom-n.top:(c="bottom",o=n.bottom-i.top)),{style:"".concat(c,": ").concat(o,"px; max-width: ").concat(u,"px"),class:"cm-completionInfo-"+(h?a?"left-narrow":"right-narrow":f?"left":"right")}}function Vm(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"option";return function(i){var e,r,o,u,s=i.state.field(qu,!1);return!(!s||!s.open||s.open.disabled||Date.now()-s.open.timestamp<i.state.facet(Ou).interactionDelay)&&(e=1,"page"==n&&(r=Kd(i,s.open.tooltip))&&(e=Math.max(2,Math.floor(r.dom.offsetHeight/r.dom.querySelector("li").offsetHeight)-1)),o=s.open.options.length,(u=s.open.selected>-1?s.open.selected+e*(t?1:-1):t?0:o-1)<0?u="page"==n?0:o-1:u>=o&&(u="page"==n?o-1:0),i.dispatch({effects:$u.of(u)}),!0)}}function $m(t,n){var i=n.completion.apply||n.completion.label,e=t.state.field(qu).active.find((function(t){return t.source==n.source}));return e instanceof Wu&&("string"==typeof i?t.dispatch(Object.assign(Object.assign({},Um(t.state,i,e.from,e.to)),{annotations:xu.of(n.completion)})):i(t,n.completion,e.from,e.to),!0)}function qm(t){var n=t.addToOptions.slice();return t.icons&&n.push({render:function t(n){var i,e=document.createElement("div");return e.classList.add("cm-completionIcon"),n.type&&(i=e.classList).add.apply(i,Jh(n.type.split(/\s+/g).map((function(t){return"cm-completionIcon-"+t})))),e.setAttribute("aria-hidden","true"),e},position:20}),n.push({render:function t(n,i,e){var r,o,u,s,a,f,h=document.createElement("span");for(h.className="cm-completionLabel",r=n.label,o=0,u=1;u<e.length;)s=e[u++],a=e[u++],s>o&&h.appendChild(document.createTextNode(r.slice(o,s))),(f=h.appendChild(document.createElement("span"))).appendChild(document.createTextNode(r.slice(s,a))),f.className="cm-completionMatchedText",o=a;return o<r.length&&h.appendChild(document.createTextNode(r.slice(o))),h},position:50},{render:function t(n){if(!n.detail)return null;var i=document.createElement("span");return i.className="cm-completionDetail",i.textContent=n.detail,i},position:80}),n.sort((function(t,n){return t.position-n.position})).map((function(t){return t.render}))}function Gm(t,n,i){var e,r;return t<=i?{from:0,to:t}:(n<0&&(n=0),n<=t>>1?{from:(e=Math.floor(n/i))*i,to:(e+1)*i}:{from:t-((r=Math.floor((t-n)/i))+1)*i,to:t-r*i})}function Jm(t){return function(n){return new _u(n,t)}}function Km(t,n){var i=t.getBoundingClientRect(),e=n.getBoundingClientRect();e.top<i.top?t.scrollTop-=i.top-e.top:e.bottom>i.bottom&&(t.scrollTop+=e.bottom-i.bottom)}function Qm(t){return 100*(t.boost||0)+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function Xm(t,n){var i,e,r,o,u,s,a,f,h,c,l,v,d,y,m,p,k,g,w,b,M,x,S,C,j,P,O,E,A,D,R,I=[],T=null,L=function t(n){var i,e;I.push(n),(i=n.completion.section)&&(T||(T=[]),e="string"==typeof i?i:i.name,T.some((function(t){return t.name==e}))||T.push("string"==typeof i?{name:e}:i))},B=ic(t);try{for(B.s();!(i=B.n()).done;)if((e=i.value).hasResult())if(!1===e.result.filter){r=e.result.getMatch,o=ic(e.result.options);try{for(o.s();!(u=o.n()).done;){if(s=u.value,a=[1e9-I.length],r){f=ic(r(s));try{for(f.s();!(h=f.n()).done;)c=h.value,a.push(c)}catch(t){f.e(t)}finally{f.f()}}L(new Mu(s,e.source,a,a[0]))}}catch(t){o.e(t)}finally{o.f()}}else{l=new Pu(n.sliceDoc(e.from,e.to)),v=void 0,d=ic(e.result.options);try{for(d.s();!(y=d.n()).done;)m=y.value,(v=l.match(m.label))&&L(new Mu(m,e.source,v,v[0]+(m.boost||0)))}catch(t){d.e(t)}finally{d.f()}}}catch(t){B.e(t)}finally{B.f()}if(T){p=Object.create(null),k=0,g=function t(n,i){var e,r;return(null!==(e=n.rank)&&void 0!==e?e:1e9)-(null!==(r=i.rank)&&void 0!==r?r:1e9)||(n.name<i.name?-1:1)},w=ic(T.sort(g));try{for(w.s();!(b=w.n()).done;)M=b.value,k-=1e5,p[M.name]=k}catch(t){w.e(t)}finally{w.f()}x=ic(I);try{for(x.s();!(S=x.n()).done;)(j=(C=S.value).completion.section)&&(C.score+=p["string"==typeof j?j:j.name])}catch(t){x.e(t)}finally{x.f()}}P=[],O=null,E=n.facet(Ou).compareCompletions,A=ic(I.sort((function(t,n){return n.score-t.score||E(t.completion,n.completion)})));try{for(A.s();!(D=A.n()).done;)R=D.value,!O||O.label!=R.completion.label||O.detail!=R.completion.detail||null!=O.type&&null!=R.completion.type&&O.type!=R.completion.type||O.apply!=R.completion.apply?P.push(R):Qm(R.completion)>Qm(O)&&(P[P.length-1]=R),O=R.completion}catch(t){A.e(t)}finally{A.f()}return P}function Zm(t,n){var i,e,r,o;if(t==n)return!0;for(i=0,e=0;;){for(;i<t.length&&!t[i].hasResult;)i++;for(;e<n.length&&!n[e].hasResult;)e++;if(r=i==t.length,o=e==n.length,r||o)return r==o;if(t[i++].result!=n[e++].result)return!1}}function Ym(t,n){var i={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return n>-1&&(i["aria-activedescendant"]=t+"-"+n),i}function tp(t){return t.isUserEvent("input.type")?"input":t.isUserEvent("delete.backward")?"delete":null}function np(t,n,i,e){if(!t)return!1;var r=n.sliceDoc(i,e);return"function"==typeof t?t(r,i,e,n):Nm(t,!0).test(r)}function ip(t,n){return k.create(t.filter((function(t){return t.field==n})).map((function(t){return k.range(t.from,t.to)})))}function ep(t){var n=Qu.parse(t);return function(t,e,r,o){var u,s,a=n.instantiate(t.state,r),f=a.text,h=a.ranges,c={changes:{from:r,to:o,insert:i.of(f)},scrollIntoView:!0,annotations:e?xu.of(e):void 0};h.length&&(c.selection=ip(h,0)),h.length>1&&(u=new Yu(h,0),s=c.effects=[ts.of(u)],void 0===t.state.field(is,!1)&&s.push(V.appendConfig.of([is,as,fs,Gu]))),t.dispatch(t.state.update(c))}}function rp(t){return function(n){var i,e,r=n.state,o=n.dispatch,u=r.field(is,!1);return!(!u||t<0&&0==u.active)&&(i=u.active+t,e=t>0&&!u.ranges.some((function(n){return n.field==i+t})),o(r.update({selection:ip(u.ranges,i),effects:ts.of(e?null:new Yu(u.ranges,i))})),!0)}}function op(t){var n=t.field(is,!1);return!(!n||!n.ranges.some((function(t){return t.field==n.active+1})))}function up(t){var n=t.field(is,!1);return!!(n&&n.active>0)}function sp(t,n){return Object.assign(Object.assign({},n),{apply:ep(t)})}function ap(t){var n=t.replace(/[\\[.+*?(){|^$]/g,"\\$&");try{return new RegExp("[\\p{Alphabetic}\\p{Number}_".concat(n,"]+"),"ug")}catch(t){return new RegExp("[w".concat(n,"]"),"g")}}function fp(t,n){return new RegExp(n(t.source),t.unicode?"u":"")}function hp(t){return hs[t]||(hs[t]=new WeakMap)}function cp(t,n,i,e,r){var o,u,s,a;for(o=t.iterLines(),u=0;!o.next().done;){for(s=o.value,a=void 0,n.lastIndex=0;a=n.exec(s);)if(!e[a[0]]&&u+a.index!=r&&(i.push({type:"text",label:a[0]}),e[a[0]]=!0,i.length>=2e3))return;u+=s.length+1}}function lp(t,n,i,e,r){var o,u,s,a,f,h,c,l,v,d=t.length>=1e3,y=d&&n.get(t);if(y)return y;if(o=[],u=Object.create(null),t.children){s=0,a=ic(t.children);try{for(a.s();!(f=a.n()).done;){if((h=f.value).length>=1e3){c=ic(lp(h,n,i,e-s,r-s));try{for(c.s();!(l=c.n()).done;)u[(v=l.value).label]||(u[v.label]=!0,o.push(v))}catch(t){c.e(t)}finally{c.f()}}else cp(h,i,o,u,r-s);s+=h.length+1}}catch(t){a.e(t)}finally{a.f()}}else cp(t,i,o,u,r);return d&&o.length<2e3&&n.set(t,o),o}function vp(){return[ks,ys]}function dp(t){for(var n=0;n<ms.length;n+=2)if(ms.charCodeAt(n)==t)return ms.charAt(n+1);return Dc(t<128?t:t+1)}function yp(t,n){return t.languageDataAt("closeBrackets",n)[0]||ls}function mp(t,n){var i,e,r,o=yp(t,t.selection.main.head),u=o.brackets||ls.brackets,s=ic(u);try{for(s.s();!(i=s.n()).done;){if(r=dp(Ac(e=i.value,0)),n==e)return r==e?Mp(t,e,u.indexOf(e+e+e)>-1,o):wp(t,e,r,o.before||ls.before);if(n==r&&pp(t,t.selection.main.from))return bp(t,e,r)}}catch(t){s.e(t)}finally{s.f()}return null}function pp(t,n){var i=!1;return t.field(ys).between(0,t.doc.length,(function(t){t==n&&(i=!0)})),i}function kp(t,n){var i=t.sliceString(n,n+2);return i.slice(0,Rc(Ac(i,0)))}function gp(t,n){var i=t.sliceString(n-2,n);return Rc(Ac(i,0))==i.length?i:i.slice(1)}function wp(t,n,i,e){var r=null,o=t.changeByRange((function(o){if(!o.empty)return{changes:[{insert:n,from:o.from},{insert:i,from:o.to}],effects:vs.of(o.to+n.length),range:k.range(o.anchor+n.length,o.head+n.length)};var u=kp(t.doc,o.head);return!u||/\s/.test(u)||e.indexOf(u)>-1?{changes:{insert:n+i,from:o.head},effects:vs.of(o.head+n.length),range:k.cursor(o.head+n.length)}:{range:r=o}}));return r?null:t.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function bp(t,n,i){var e=null,r=t.changeByRange((function(n){return n.empty&&kp(t.doc,n.head)==i?{changes:{from:n.head,to:n.head+i.length,insert:i},range:k.cursor(n.head+i.length)}:e={range:n}}));return e?null:t.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function Mp(t,n,i,e){var r=e.stringPrefixes||ls.stringPrefixes,o=null,u=t.changeByRange((function(e){var u,s,a,f,h;if(!e.empty)return{changes:[{insert:n,from:e.from},{insert:n,from:e.to}],effects:vs.of(e.to+n.length),range:k.range(e.anchor+n.length,e.head+n.length)};if(u=e.head,(s=kp(t.doc,u))==n){if(xp(t,u))return{changes:{insert:n+n,from:u},effects:vs.of(u+n.length),range:k.cursor(u+n.length)};if(pp(t,u))return{changes:{from:u,to:u+(h=(f=i&&t.sliceDoc(u,u+3*n.length)==n+n+n)?n+n+n:n).length,insert:h},range:k.cursor(u+h.length)}}else{if(i&&t.sliceDoc(u-2*n.length,u)==n+n&&(a=Cp(t,u-2*n.length,r))>-1&&xp(t,a))return{changes:{insert:n+n+n+n,from:u},effects:vs.of(u+n.length),range:k.cursor(u+n.length)};if(t.charCategorizer(u)(s)!=G.Word&&Cp(t,u,r)>-1&&!Sp(t,u,n,r))return{changes:{insert:n+n,from:u},effects:vs.of(u+n.length),range:k.cursor(u+n.length)}}return{range:o=e}}));return o?null:t.update(u,{scrollIntoView:!0,userEvent:"input.type"})}function xp(t,n){var i=Ry(t).resolveInner(n+1);return i.parent&&i.from==n}function Sp(t,n,i,e){var r,o,u,s,a,f=Ry(t).resolveInner(n,-1),h=e.reduce((function(t,n){return Math.max(t,n.length)}),0);for(r=0;r<5;r++){if(!(u=(o=t.sliceDoc(f.from,Math.min(f.to,f.from+i.length+h))).indexOf(i))||u>-1&&e.indexOf(o.slice(0,u))>-1){for(s=f.firstChild;s&&s.from==f.from&&s.to-s.from>i.length+u;){if(t.sliceDoc(s.to-i.length,s.to)==i)return!1;s=s.firstChild}return!0}if(!(a=f.to==n&&f.parent))break;f=a}return!1}function Cp(t,n,i){var e,r,o,u,s=t.charCategorizer(n);if(s(t.sliceDoc(n-1,n))!=G.Word)return n;e=ic(i);try{for(e.s();!(r=e.n()).done;)if(u=n-(o=r.value).length,t.sliceDoc(u,n)==o&&s(t.sliceDoc(u-1,u))!=G.Word)return u}catch(t){e.e(t)}finally{e.f()}return-1}function jp(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return[qu,Ou.of(t),Bu,Ms,Gu]}function Pp(t){var n=t.field(qu,!1);return n&&n.active.some((function(t){return 1==t.state}))?"pending":n&&n.active.some((function(t){return 0!=t.state}))?"active":null}function Op(t){var n,i,e=null===(n=t.field(qu,!1))||void 0===n?void 0:n.open;return!e||e.disabled?[]:((i=xs.get(e.options))||xs.set(e.options,i=e.options.map((function(t){return t.completion}))),i)}function Ep(t){var n,i=null===(n=t.field(qu,!1))||void 0===n?void 0:n.open;return i&&!i.disabled&&i.selected>=0?i.options[i.selected].completion:null}function Ap(t){var n,i=null===(n=t.field(qu,!1))||void 0===n?void 0:n.open;return i&&!i.disabled&&i.selected>=0?i.selected:null}function Dp(t){return $u.of(t)}function Rp(t,n){return function(i){var e,r=i.state,o=i.dispatch;return!r.readOnly&&(!!(e=t(n,r))&&(o(r.update(e)),!0))}}function Ip(t,n){var i=t.languageDataAt("commentTokens",n);return i.length?i[0]:{}}function Tp(t,n,i,e){var r,o,u,s,a,f=n.open,h=n.close,c=t.sliceDoc(i-Is,i),l=t.sliceDoc(e,e+Is),v=/\s*$/.exec(c)[0].length,d=/^\s*/.exec(l)[0].length,y=c.length-v;return c.slice(y-f.length,y)==f&&l.slice(d,d+h.length)==h?{open:{pos:i-v,margin:v&&1},close:{pos:e+d,margin:d&&1}}:(e-i<=2*Is?r=o=t.sliceDoc(i,e):(r=t.sliceDoc(i,i+Is),o=t.sliceDoc(e-Is,e)),u=/^\s*/.exec(r)[0].length,s=/\s*$/.exec(o)[0].length,a=o.length-s-h.length,r.slice(u,u+f.length)==f&&o.slice(a,a+h.length)==h?{open:{pos:i+u+f.length,margin:/\s/.test(r.charAt(u+f.length))?1:0},close:{pos:e-s-h.length,margin:/\s/.test(o.charAt(a-1))?1:0}}:null)}function Lp(t){var n,i,e,r,o,u=[],s=ic(t.selection.ranges);try{for(s.s();!(n=s.n()).done;)i=n.value,e=t.doc.lineAt(i.from),r=i.to<=e.to?e:t.doc.lineAt(i.to),(o=u.length-1)>=0&&u[o].to>e.from?u[o].to=r.to:u.push({from:e.from+/^\s*/.exec(e.text)[0].length,to:r.to})}catch(t){s.e(t)}finally{s.f()}return u}function Bp(t,n){var i,e,r,o,u,s,a,f,h=arguments.length>2&&void 0!==arguments[2]?arguments[2]:n.selection.ranges,c=h.map((function(t){return Ip(n,t.from).block}));if(!c.every((function(t){return t})))return null;if(i=h.map((function(t,i){return Tp(n,c[i],t.from,t.to)})),2!=t&&!i.every((function(t){return t})))return{changes:n.changes(h.map((function(t,n){return i[n]?[]:[{from:t.from,insert:c[n].open+" "},{from:t.to,insert:" "+c[n].close}]})))};if(1!=t&&i.some((function(t){return t}))){for(e=[],r=0;r<i.length;r++)(o=i[r])&&(u=c[r],a=(s=o).open,f=s.close,e.push({from:a.pos-u.open.length,to:a.pos+a.margin},{from:f.pos-f.margin,to:f.pos+u.close.length}));return{changes:e}}return null}function _p(t,n){var i,e,r,o,u,s,a,f,h,c,l,v,d,y,m,p,k,g,w,b,M,x,S,C,j,P,O,E,A,D,R,I,T=arguments.length>2&&void 0!==arguments[2]?arguments[2]:n.selection.ranges,L=[],B=-1,_=ic(T);try{for(_.s();!(i=_.n()).done;)if(r=(e=i.value).from,o=e.to,u=L.length,s=1e9,a=Ip(n,r).line){for(f=r;f<=o;)(h=n.doc.lineAt(f)).from>B&&(r==o||o>h.from)&&(B=h.from,l=(c=/^\s*/.exec(h.text)[0].length)==h.length,v=h.text.slice(c,c+a.length)==a?c:-1,c<h.text.length&&c<s&&(s=c),L.push({line:h,comment:v,token:a,indent:c,empty:l,single:!1})),f=h.to+1;if(s<1e9)for(d=u;d<L.length;d++)L[d].indent<L[d].line.text.length&&(L[d].indent=s);L.length==u+1&&(L[u].single=!0)}}catch(t){_.e(t)}finally{_.f()}if(2!=t&&L.some((function(t){return t.comment<0&&(!t.empty||t.single)}))){y=[],m=ic(L);try{for(m.s();!(p=m.n()).done;)g=(k=p.value).line,w=k.token,b=k.indent,M=k.empty,!(x=k.single)&&M||y.push({from:g.from+b,insert:w+" "})}catch(t){m.e(t)}finally{m.f()}return{changes:S=n.changes(y),selection:n.selection.map(S,1)}}if(1!=t&&L.some((function(t){return t.comment>=0}))){C=[],j=ic(L);try{for(j.s();!(P=j.n()).done;)E=(O=P.value).line,A=O.comment,D=O.token,A>=0&&(I=(R=E.from+A)+D.length," "==E.text[I-E.from]&&I++,C.push({from:R,to:I}))}catch(t){j.e(t)}finally{j.f()}return{changes:C}}return null}function Fp(t){var n=0;return t.iterChangedRanges((function(t,i){return n=i})),n}function Np(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return[Fs,_s.of(t),Vi.domEventHandlers({beforeinput:function t(n,i){var e="historyUndo"==n.inputType?Us:"historyRedo"==n.inputType?Hs:null;return!!e&&(n.preventDefault(),e(i))}})]}function Up(t,n){return function(i){var e,r,o=i.state,u=i.dispatch;return!(!n&&o.readOnly)&&(!!(e=o.field(Fs,!1))&&(!!(r=e.pop(t,o,n))&&(u(r),!0)))}}function Hp(t){return function(n){var i,e=n.field(Fs,!1);return e?(i=0==t?e.done:e.undone).length-(i.length&&!i[0].changes?1:0):0}}function zp(t,n,i,e){var r=n+1>i+20?n-i-1:0,o=t.slice(r,n);return o.push(e),o}function Wp(t,n){var i=[],e=!1;return t.iterChangedRanges((function(t,n){return i.push(t,n)})),n.iterChangedRanges((function(t,n,r,o){var u,s,a;for(u=0;u<i.length;)s=i[u++],a=i[u++],o>=s&&r<=a&&(e=!0)})),e}function Vp(t,n){return t.ranges.length==n.ranges.length&&0===t.ranges.filter((function(t,i){return t.empty!=n.ranges[i].empty})).length}function $p(t,n){return t.length?n.length?t.concat(n):t:n}function qp(t,n){var i,e;return t.length?(e=(i=t[t.length-1]).selectionsAfter.slice(Math.max(0,i.selectionsAfter.length-Js))).length&&e[e.length-1].eq(n)?t:(e.push(n),zp(t,t.length-1,1e9,i.setSelAfter(e))):[qs.selection([n])]}function Gp(t){var n=t[t.length-1],i=t.slice();return i[t.length-1]=n.setSelAfter(n.selectionsAfter.slice(0,n.selectionsAfter.length-1)),i}function Jp(t,n){var i,e,r,o;if(!t.length)return t;for(i=t.length,e=Gs;i;){if((r=Kp(t[i-1],n,e)).changes&&!r.changes.empty||r.effects.length)return(o=t.slice(0,i))[i-1]=r,o;n=r.mapped,i--,e=r.selectionsAfter}return e.length?[qs.selection(e)]:Gs}function Kp(t,n,i){var e,r,o,u=$p(t.selectionsAfter.length?t.selectionsAfter.map((function(t){return t.map(n)})):Gs,i);return t.changes?(e=t.changes.map(n),r=n.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(r):r,new qs(e,V.mapEffects(t.effects,n),o,t.startSelection.map(r),u)):qs.selection(u)}function Qp(t,n){return k.create(t.ranges.map(n),t.mainIndex)}function Xp(t,n){return t.update({selection:n,scrollIntoView:!0,userEvent:"select"})}function Zp(t,n){var i=t.state,e=t.dispatch,r=Qp(i.selection,n);return!r.eq(i.selection)&&(e(Xp(i,r)),!0)}function Yp(t,n){return k.cursor(n?t.to:t.from)}function tk(t,n){return Zp(t,(function(i){return i.empty?t.moveByChar(i,n):Yp(i,n)}))}function nk(t){return t.textDirectionAt(t.state.selection.main.head)==Pn.LTR}function ik(t,n){return Zp(t,(function(i){return i.empty?t.moveByGroup(i,n):Yp(i,n)}))}function ek(t,n,i){var e=t.state.charCategorizer(n.from);return t.moveByChar(n,i,(function(r){var o=G.Space,u=n.from,s=!1,a=!1,f=!1,h=function n(r){if(s)return!1;u+=i?r.length:-r.length;var h=e(r),c;if(h==G.Word&&r.charCodeAt(0)<128&&/[\W_]/.test(r)&&(h=-1),o==G.Space&&(o=h),o!=h)return!1;if(o==G.Word)if(r.toLowerCase()==r){if(!i&&a)return!1;f=!0}else if(f){if(i)return!1;s=!0}else{if(a&&i&&e(c=t.state.sliceDoc(u,u+1))==G.Word&&c.toLowerCase()==c)return!1;a=!0}return!0};return h(r),h}))}function rk(t,n){return Zp(t,(function(i){return i.empty?ek(t,i,n):Yp(i,n)}))}function ok(t,n,i){if(n.type.prop(i))return!0;var e=n.to-n.from;return e&&(e>2||/[^\s,.;:]/.test(t.sliceDoc(n.from,n.to)))||n.firstChild}function uk(t,n,i){var e,r,o,u,s,a=Ry(t).resolveInner(n.head),f=i?mr.closedBy:mr.openedBy;for(e=n.head;r=i?a.childAfter(e):a.childBefore(e);)ok(t,r,f)?a=r:e=i?r.to:r.from;return s=(o=a.type.prop(f))&&(u=i?wm(t,a.from,1):wm(t,a.to,-1))&&u.matched?i?u.end.to:u.end.from:i?a.to:a.from,k.cursor(s,i?-1:1)}function sk(t,n){return Zp(t,(function(i){if(!i.empty)return Yp(i,n);var e=t.moveVertically(i,n);return e.head!=i.head?e:t.moveToLineBoundary(i,n)}))}function ak(t){var n,i,e,r,o,u=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,s=0,a=0;if(u){i=ic(t.state.facet(Vi.scrollMargins));try{for(i.s();!(e=i.n()).done;)(null==(o=(r=e.value)(t))?void 0:o.top)&&(s=Math.max(null==o?void 0:o.top,s)),(null==o?void 0:o.bottom)&&(a=Math.max(null==o?void 0:o.bottom,a))}catch(t){i.e(t)}finally{i.f()}n=t.scrollDOM.clientHeight-s-a}else n=(t.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:s,marginBottom:a,selfScroll:u,height:Math.max(t.defaultLineHeight,n-5)}}function fk(t,n){var i,e,r,o,u,s=ak(t),a=t.state,f=Qp(a.selection,(function(i){return i.empty?t.moveVertically(i,n,s.height):Yp(i,n)}));return!f.eq(a.selection)&&(s.selfScroll&&(e=t.coordsAtPos(a.selection.main.head),o=(r=t.scrollDOM.getBoundingClientRect()).top+s.marginTop,u=r.bottom-s.marginBottom,e&&e.top>o&&e.bottom<u&&(i=Vi.scrollIntoView(f.main.head,{y:"start",yMargin:e.top-o}))),t.dispatch(Xp(a,f),{effects:i}),!0)}function hk(t,n,i){var e,r=t.lineBlockAt(n.head),o=t.moveToLineBoundary(n,i);return o.head==n.head&&o.head!=(i?r.to:r.from)&&(o=t.moveToLineBoundary(n,i,!1)),!i&&o.head==r.from&&r.length&&(e=/^\s*/.exec(t.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length)&&n.head!=r.from+e&&(o=k.cursor(r.from+e)),o}function ck(t,n,i){var e=!1,r=Qp(t.selection,(function(n){var r,o=wm(t,n.head,-1)||wm(t,n.head,1)||n.head>0&&wm(t,n.head-1,1)||n.head<t.doc.length&&wm(t,n.head+1,-1);return o&&o.end?(e=!0,r=o.start.from==n.head?o.end.to:o.end.from,i?k.range(n.anchor,r):k.cursor(r)):n}));return!!e&&(n(Xp(t,r)),!0)}function lk(t,n){var i=Qp(t.state.selection,(function(t){var i=n(t);return k.range(t.anchor,i.head,i.goalColumn,i.bidiLevel||void 0)}));return!i.eq(t.state.selection)&&(t.dispatch(Xp(t.state,i)),!0)}function vk(t,n){return lk(t,(function(i){return t.moveByChar(i,n)}))}function dk(t,n){return lk(t,(function(i){return t.moveByGroup(i,n)}))}function yk(t,n){return lk(t,(function(i){return ek(t,i,n)}))}function mk(t,n){return lk(t,(function(i){return t.moveVertically(i,n)}))}function pk(t,n){return lk(t,(function(i){return t.moveVertically(i,n,ak(t).height)}))}function kk(t,n){var i,e,r;return!t.state.readOnly&&(i="delete.selection",!(r=(e=t.state).changeByRange((function(e){var r,o=e.from,u=e.to;return o==u?((r=n(o))<o?(i="delete.backward",r=gk(t,r,!1)):r>o&&(i="delete.forward",r=gk(t,r,!0)),o=Math.min(o,r),u=Math.max(u,r)):(o=gk(t,o,!1),u=gk(t,u,!0)),o==u?{range:e}:{changes:{from:o,to:u},range:k.cursor(o)}}))).changes.empty&&(t.dispatch(e.update(r,{scrollIntoView:!0,userEvent:i,effects:"delete.selection"==i?Vi.announce.of(e.phrase("Selection deleted")):void 0})),!0))}function gk(t,n,i){var e,r,o;if(t instanceof Vi){e=ic(t.state.facet(Vi.atomicRanges).map((function(n){return n(t)})));try{for(e.s();!(r=e.n()).done;)(o=r.value).between(n,n,(function(t,e){t<n&&e>n&&(n=i?e:t)}))}catch(t){e.e(t)}finally{e.f()}}return n}function wk(t){var n,i,e,r,o,u=[],s=-1,a=ic(t.selection.ranges);try{for(a.s();!(n=a.n()).done;)i=n.value,e=t.doc.lineAt(i.from),r=t.doc.lineAt(i.to),i.empty||i.to!=r.from||(r=t.doc.lineAt(i.to-1)),s>=e.number?((o=u[u.length-1]).to=r.to,o.ranges.push(i)):u.push({from:e.from,to:r.to,ranges:[i]}),s=r.number+1}catch(t){a.e(t)}finally{a.f()}return u}function bk(t,n,i){var e,r,o,u,s,a,f,h,c,l,v,d,y;if(t.readOnly)return!1;e=[],r=[],o=ic(wk(t));try{for(o.s();!(u=o.n()).done;)if(s=u.value,i?s.to!=t.doc.length:0!=s.from)if(f=(a=t.doc.lineAt(i?s.to+1:s.from-1)).length+1,i){e.push({from:s.to,to:a.to},{from:s.from,insert:a.text+t.lineBreak}),h=ic(s.ranges);try{for(h.s();!(c=h.n()).done;)l=c.value,r.push(k.range(Math.min(t.doc.length,l.anchor+f),Math.min(t.doc.length,l.head+f)))}catch(t){h.e(t)}finally{h.f()}}else{e.push({from:a.from,to:s.from},{from:s.to,insert:t.lineBreak+a.text}),v=ic(s.ranges);try{for(v.s();!(d=v.n()).done;)y=d.value,r.push(k.range(y.anchor-f,y.head-f))}catch(t){v.e(t)}finally{v.f()}}}catch(t){o.e(t)}finally{o.f()}return!!e.length&&(n(t.update({changes:e,scrollIntoView:!0,selection:k.create(r,t.selection.mainIndex),userEvent:"move.line"})),!0)}function Mk(t,n,i){var e,r,o,u;if(t.readOnly)return!1;e=[],r=ic(wk(t));try{for(r.s();!(o=r.n()).done;)u=o.value,i?e.push({from:u.from,insert:t.doc.slice(u.from,u.to)+t.lineBreak}):e.push({from:u.to,insert:t.lineBreak+t.doc.slice(u.from,u.to)})}catch(t){r.e(t)}finally{r.f()}return n(t.update({changes:e,scrollIntoView:!0,userEvent:"input.copyline"})),!0}function xk(t,n){var i,e,r,o;return/\(\)|\[\]|\{\}/.test(t.sliceDoc(n-1,n+1))?{from:n,to:n}:(e=(i=Ry(t).resolveInner(n)).childBefore(n),r=i.childAfter(n),e&&r&&e.to<=n&&r.from>=n&&(o=e.type.prop(mr.closedBy))&&o.indexOf(r.name)>-1&&t.doc.lineAt(e.to).from==t.doc.lineAt(r.from).from?{from:e.to,to:r.from}:null)}function Sk(t){return function(n){var e,r=n.state,o=n.dispatch;return!r.readOnly&&(e=r.changeByRange((function(n){var e,o,u,s=n.from,a=n.to,f=r.doc.lineAt(s),h=!t&&s==a&&xk(r,s);for(t&&(s=a=(a<=f.to?f:r.doc.lineAt(a)).to),null==(o=Uy(e=new bo(r,{simulateBreak:s,simulateDoubleBreak:!!h}),s))&&(o=/^\s*/.exec(r.doc.lineAt(s).text)[0].length);a<f.to&&/\s/.test(f.text[a-f.from]);)a++;return h?(s=h.from,a=h.to):s>f.from&&s<f.from+100&&!/\S/.test(f.text.slice(0,s))&&(s=f.from),u=["",Ny(r,o)],h&&u.push(Ny(r,e.lineIndent(f.from,-1))),{changes:{from:s,to:a,insert:i.of(u)},range:k.cursor(s+1+u[1].length)}})),o(r.update(e,{scrollIntoView:!0,userEvent:"input"})),!0)}}function Ck(t,n){var i=-1;return t.changeByRange((function(e){var r,o,u,s=[];for(r=e.from;r<=e.to;)(o=t.doc.lineAt(r)).number>i&&(e.empty||e.to>o.from)&&(n(o,s,e),i=o.number),r=o.to+1;return u=t.changes(s),{changes:s,range:k.range(u.mapPos(e.anchor,1),u.mapPos(e.head,1))}}))}function jk(){var t,n,i,e,r=arguments[0];if("string"==typeof r&&(r=document.createElement(r)),t=1,(n=arguments[1])&&"object"==dc(n)&&null==n.nodeType&&!Array.isArray(n)){for(i in n)Object.prototype.hasOwnProperty.call(n,i)&&("string"==typeof(e=n[i])?r.setAttribute(i,e):null!=e&&(r[i]=e));t++}for(;t<arguments.length;t++)Pk(r,arguments[t]);return r}function Pk(t,n){if("string"==typeof n)t.appendChild(document.createTextNode(n));else if(null==n);else if(null!=n.nodeType)t.appendChild(n);else{if(!Array.isArray(n))throw new RangeError("Unsupported child node: "+n);for(var i=0;i<n.length;i++)Pk(t,n[i])}}function Ok(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,e=null;return t.between(i,1e9,(function(t,i,r){var o=r.spec;if(!n||o.diagnostic==n)return e=new Pf(t,i,o.diagnostic),!1})),e}function Ek(t,n){return!(!t.effects.some((function(t){return t.is(Ef)}))&&!t.changes.touchesRange(n.pos))}function Ak(t,n){return t.field(Rf,!1)?n:n.concat(V.appendConfig.of(Qf))}function Dk(t,n){return{effects:Ak(t,[Ef.of(n)])}}function Rk(t){var n=t.field(Rf,!1);return n?n.diagnostics.size:0}function Ik(t,n,i){var e,r=t.state.field(Rf),o=r.diagnostics,u=[],s=2e8,a=0;return o.between(n-(i<0?1:0),n+(i>0?1:0),(function(t,e,r){var o=r.spec;n>=t&&n<=e&&(t==e||(n>t||i>0)&&(n<e||i<0))&&(u.push(o.diagnostic),s=Math.min(t,s),a=Math.max(e,a))})),(e=t.state.facet(Nf).tooltipFilter)&&(u=e(u)),u.length?{pos:s,end:a,above:t.state.doc.lineAt(s).to<a,create:function n(){return{dom:Tk(t,u)}}}:null}function Tk(t,n){return jk("ul",{class:"cm-tooltip-lint"},n.map((function(n){return Fk(t,n,!1)})))}function Lk(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return[Nf.of({source:t,config:n}),Ff,Qf]}function Bk(t){var n=t.plugin(Ff);n&&n.force()}function _k(t){var n,i,e,r,o,u=[];if(t){n=ic(t);try{t:for(n.s();!(i=n.n()).done;){for(e=i.value.name,r=function t(){var n=e[o];if(/[a-zA-Z]/.test(n)&&!u.some((function(t){return t.toLowerCase()==n.toLowerCase()})))return u.push(n),1},o=0;o<e.length;o++)if(r())continue t;u.push("")}}catch(t){n.e(t)}finally{n.f()}}return u}function Fk(t,n,i){var e,r=i?_k(n.actions):[];return jk("li",{class:"cm-diagnostic cm-diagnostic-"+n.severity},jk("span",{class:"cm-diagnosticText"},n.renderMessage?n.renderMessage():n.message),null===(e=n.actions)||void 0===e?void 0:e.map((function(i,e){var o=!1,u=function e(r){if(r.preventDefault(),!o){o=!0;var u=Ok(t.state.field(Rf).diagnostics,n);u&&i.apply(t,u.from,u.to)}},s=i.name,a=r[e]?s.indexOf(r[e]):-1,f=a<0?s:[s.slice(0,a),jk("u",s.slice(a,a+1)),s.slice(a+1)];return jk("button",{type:"button",class:"cm-diagnosticAction",onclick:u,onmousedown:u,"aria-label":" Action: ".concat(s).concat(a<0?"":' (access key "'.concat(r[e],')"'),".")},f)})),n.source&&jk("div",{class:"cm-diagnosticSource"},n.source))}function Nk(t){var n;return'url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" '.concat(arguments.length>1&&void 0!==arguments[1]?arguments[1]:'viewBox="0 0 40 40"',">").concat(encodeURIComponent(t),"</svg>')")}function Uk(t){return Nk('<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="'.concat(t,'" fill="none" stroke-width=".7"/>'),'width="6" height="3"')}function Hk(t,n){var i=function i(e){var r,o=n.getBoundingClientRect();if(!(e.clientX>o.left-10&&e.clientX<o.right+10&&e.clientY>o.top-10&&e.clientY<o.bottom+10)){for(r=e.target;r;r=r.parentNode)if(1==r.nodeType&&r.classList.contains("cm-tooltip-lint"))return;window.removeEventListener("mousemove",i),t.state.field(Jf)&&t.dispatch({effects:Gf.of(null)})}};window.addEventListener("mousemove",i)}function zk(t,n,i){var e,r,o;function u(){var e=t.elementAtHeight(n.getBoundingClientRect().top+5-t.documentTop),r=t.coordsAtPos(e.from);r&&t.dispatch({effects:Gf.of({pos:e.from,above:!1,create:function e(){return{dom:Tk(t,i),getCoords:function t(){return n.getBoundingClientRect()}}}})}),n.onmouseout=n.onmousemove=null,Hk(t,n)}e=t.state.facet(Xf),r=e.hoverTime,o=setTimeout(u,r),n.onmouseout=function(){clearTimeout(o),n.onmouseout=n.onmousemove=null},n.onmousemove=function(){clearTimeout(o),o=setTimeout(u,r)}}function Wk(t,n){var i,e,r,o,u,s=Object.create(null),a=ic(n);try{for(a.s();!(i=a.n()).done;)e=i.value,(s[(r=t.lineAt(e.from)).from]||(s[r.from]=[])).push(e)}catch(t){a.e(t)}finally{a.f()}for(u in o=[],s)o.push(new Vf(s[u]).range(+u));return tt.of(o,!0)}function Vk(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return[Xf.of(t),qf,$f,Kf,Jf]}function $k(t,n){var i,e=t.field(Rf,!1);if(e&&e.diagnostics.size)for(i=tt.iter([e.diagnostics]);i.value;i.next())n(i.value.spec.diagnostic,i.from,i.to)}function qk(t){try{return new RegExp(t,ih),!0}catch(t){return!1}}function Gk(t,n){if(n>=t.length)return n;for(var i=t.lineAt(n),e;n<i.to&&(e=i.text.charCodeAt(n-i.from))>=56320&&e<57344;)n++;return n}function Jk(t){var n=jk("input",{class:"cm-textfield",name:"line"}),i=jk("form",{class:"cm-gotoLine",onkeydown:function n(i){27==i.keyCode?(i.preventDefault(),t.dispatch({effects:sh.of(!1)}),t.focus()):13==i.keyCode&&(i.preventDefault(),e())},onsubmit:function t(n){n.preventDefault(),e()}},jk("label",t.state.phrase("Go to line"),": ",n)," ",jk("button",{class:"cm-button",type:"submit"},t.state.phrase("go")));function e(){var i,e,r,o,u,s,a,f,h,c,l,v=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.value);v&&(e=(i=t.state).doc.lineAt(i.selection.main.head),o=(r=Zh(v,5))[1],u=r[2],s=r[3],a=r[4],f=s?+s.slice(1):0,h=u?+u:e.number,u&&a?(c=h/100,o&&(c=c*("-"==o?-1:1)+e.number/i.doc.lines),h=Math.round(i.doc.lines*c)):u&&o&&(h=h*("-"==o?-1:1)+e.number),l=i.doc.line(Math.max(1,Math.min(i.doc.lines,h))),t.dispatch({effects:sh.of(!1),selection:k.cursor(l.from+Math.max(0,Math.min(f,l.length))),scrollIntoView:!0}),t.focus())}return{dom:i}}function Kk(t){var n=[mh,yh];return t&&n.push(lh.of(t)),n}function Qk(t,n,i,e){return!(0!=i&&t(n.sliceDoc(i-1,i))==G.Word||e!=n.doc.length&&t(n.sliceDoc(e,e+1))==G.Word)}function Xk(t,n,i,e){return t(n.sliceDoc(i,i+1))==G.Word&&t(n.sliceDoc(e-1,e))==G.Word}function Zk(t,n){var i,e,r,o=t.selection,u=o.main,s=o.ranges,a=t.wordAt(u.head),f=a&&a.from==u.from&&a.to==u.to,h=function i(o,u){if(u.next(),!u.done){if(o&&s.some((function(t){return t.from==u.value.from})))return e=o,r=u,0;if(f){var a=t.wordAt(u.value.from);if(!a||a.from!=u.value.from||a.to!=u.value.to)return e=o,r=u,0}return{v:u.value}}if(o)return{v:null};u=new th(t.doc,n,0,Math.max(0,s[s.length-1].from-1)),e=o=!0,r=u};for(e=!1,r=new th(t.doc,n,s[s.length-1].to);;)if(0!==(i=h(e,r))&&i)return i.v}function Yk(t){return t?[gh.of(t),Vh]:Vh}function tg(t,n,i,e){return new th(n.doc,t.unquoted,i,e,t.caseSensitive?void 0:function(t){return t.toLowerCase()},t.wholeWord?ng(n.doc,n.charCategorizer(n.selection.main.head)):void 0)}function ng(t,n){return function(i,e,r,o){return(o>i||o+r.length<e)&&(o=Math.max(0,i-2),r=t.sliceString(o,Math.min(t.length,e+2))),!(n(eg(r,i-o))==G.Word&&n(rg(r,i-o))==G.Word||n(rg(r,e-o))==G.Word&&n(eg(r,e-o))==G.Word)}}function ig(t,n,i,e){return new eh(n.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?og(n.charCategorizer(n.selection.main.head)):void 0},i,e)}function eg(t,n){return t.slice(Cc(t,n,!1),n)}function rg(t,n){return t.slice(n,Cc(t,n))}function og(t){return function(n,i,e){return!e[0].length||(t(eg(e.input,e.index))!=G.Word||t(rg(e.input,e.index))!=G.Word)&&(t(rg(e.input,e.index+e[0].length))!=G.Word||t(eg(e.input,e.index+e[0].length))!=G.Word)}}function ug(t){var n=t.field(jh,!1);return n?n.query.spec:hg(t)}function sg(t){var n;return null!=(null===(n=t.field(jh,!1))||void 0===n?void 0:n.panel)}function ag(t){return function(n){var i=n.state.field(jh,!1);return i&&i.query.spec.valid?t(n,i):_h(n)}}function fg(t){return t.state.facet(gh).createPanel(t)}function hg(t,n){var i,e,r,o,u,s=t.selection.main,a=s.empty||s.to>s.from+100?"":t.sliceDoc(s.from,s.to);return n&&!a?n:(u=t.facet(gh),new wh({search:(null!==(i=null==n?void 0:n.literal)&&void 0!==i?i:u.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:null!==(e=null==n?void 0:n.caseSensitive)&&void 0!==e?e:u.caseSensitive,literal:null!==(r=null==n?void 0:n.literal)&&void 0!==r?r:u.literal,wholeWord:null!==(o=null==n?void 0:n.wholeWord)&&void 0!==o?o:u.wholeWord}))}function cg(t){var n=Yd(t,fg);return n&&n.dom.querySelector("[main-field]")}function lg(t){var n=cg(t);n&&n==t.root.activeElement&&n.select()}function vg(t,n){return t.state.phrase(n)}function dg(t,n){var i,e,r=n.from,o=n.to,u=t.state.doc.lineAt(r),s=t.state.doc.lineAt(o).to,a=Math.max(u.from,r-Hh),f=Math.min(s,o+Hh),h=t.state.sliceDoc(a,f);if(a!=u.from)for(i=0;i<Hh;i++)if(!zh.test(h[i+1])&&zh.test(h[i])){h=h.slice(i);break}if(f!=s)for(e=h.length-1;e>h.length-Hh;e--)if(!zh.test(h[e-1])&&zh.test(h[e])){h=h.slice(0,e);break}return Vi.announce.of("".concat(t.state.phrase("current match"),". ").concat(h," ").concat(t.state.phrase("on line")," ").concat(u.number,"."))}gu=new(ku=function(){function t(n){yc(this,t),this.extra=n,this.table=Object.assign(Object.create(null),lu)}return pc(t,[{key:"resolve",value:function t(n){return n?this.table[n]||(this.table[n]=Dm(this.extra,n)):0}}]),t}())(au),wu=n.Language=Object.freeze({__proto__:null,DocInput:ao,HighlightStyle:Wo,IndentContext:bo,LRLanguage:so,Language:uo,LanguageDescription:ko,LanguageSupport:po,ParseContext:ho,StreamLanguage:uu,StringStream:ru,TreeIndentContext:xo,bracketMatching:pm,bracketMatchingHandle:eu,codeFolding:cm,continuedIndent:Xy,defaultHighlightStyle:Jo,defineLanguageFacet:Ay,delimitedIndent:Ky,ensureSyntaxTree:Iy,flatIndent:So,foldAll:Io,foldCode:Do,foldEffect:Oo,foldGutter:lm,foldInside:Yy,foldKeymap:Bo,foldNodeProp:Po,foldService:jo,foldState:Ao,foldable:im,foldedRanges:om,forceParsing:Ly,getIndentUnit:Fy,getIndentation:Uy,highlightingFor:ym,indentNodeProp:Mo,indentOnInput:Zy,indentRange:Hy,indentService:go,indentString:Ny,indentUnit:wo,language:mo,languageDataProp:ro,matchBrackets:wm,sublanguageProp:oo,syntaxHighlighting:dm,syntaxParserRunning:By,syntaxTree:Ry,syntaxTreeAvailable:Ty,toggleFold:Lo,unfoldAll:To,unfoldCode:Ro,unfoldEffect:Eo}),bu=function(){function t(n,i,e){yc(this,t),this.state=n,this.pos=i,this.explicit=e,this.abortListeners=[]}return pc(t,[{key:"tokenBefore",value:function t(n){for(var i=Ry(this.state).resolveInner(this.pos,-1);i&&n.indexOf(i.name)<0;)i=i.parent;return i?{from:i.from,to:this.pos,text:this.state.sliceDoc(i.from,this.pos),type:i.type}:null}},{key:"matchBefore",value:function t(n){var i=this.state.doc.lineAt(this.pos),e=Math.max(i.from,this.pos-250),r=i.text.slice(e-i.from,this.pos-i.from),o=r.search(Nm(n,!1));return o<0?null:{from:e+o,to:this.pos,text:r.slice(o)}}},{key:"aborted",get:function t(){return null==this.abortListeners}},{key:"addEventListener",value:function t(n,i){"abort"==n&&this.abortListeners&&this.abortListeners.push(i)}}]),t}(),Mu=pc((function t(n,i,e,r){yc(this,t),this.completion=n,this.source=i,this.match=e,this.score=r})),xu=H.define(),Su=new WeakMap,Cu=V.define(),ju=V.define(),Pu=function(){function t(n){var i,e,r,o,u;for(yc(this,t),this.pattern=n,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],i=0;i<n.length;)r=Rc(e=Ac(n,i)),this.chars.push(e),u=(o=n.slice(i,i+r)).toUpperCase(),this.folded.push(Ac(u==o?o.toLowerCase():u,0)),i+=r;this.astral=n.length!=this.chars.length}return pc(t,[{key:"match",value:function t(n){var i,e,r,o,u,s,a,f,h,c,l,v,d,y,m,p,k,g,w,b,M,x,S,C,j,P,O,E;if(0==this.pattern.length)return[-100];if(n.length<this.pattern.length)return null;if(i=this.chars,e=this.folded,r=this.any,o=this.precise,u=this.byWord,1==i.length){if(f=(a=Rc(s=Ac(n,0)))==n.length?0:-100,s==i[0]);else{if(s!=e[0])return null;f+=-200}return[f,0,a]}if(0==(h=n.indexOf(this.pattern)))return[n.length==this.pattern.length?0:-100,0,this.pattern.length];if(c=i.length,l=0,h<0){for(v=0,d=Math.min(n.length,200);v<d&&l<c;)(y=Ac(n,v))!=i[l]&&y!=e[l]||(r[l++]=v),v+=Rc(y);if(l<c)return null}for(m=0,p=0,k=!1,g=0,w=-1,b=-1,M=/[a-z]/.test(n),x=!0,S=0,C=Math.min(n.length,200),j=0;S<C&&p<c;)P=Ac(n,S),h<0&&(m<c&&P==i[m]&&(o[m++]=S),g<c&&(P==i[g]||P==e[g]?(0==g&&(w=S),b=S+1,g++):g=0)),O=void 0,E=P<255?P>=48&&P<=57||P>=97&&P<=122?2:P>=65&&P<=90?1:0:(O=Dc(P))!=O.toLowerCase()?1:O!=O.toUpperCase()?2:0,(!S||1==E&&M||0==j&&0!=E)&&(i[p]==P||e[p]==P&&(k=!0)?u[p++]=S:u.length&&(x=!1)),j=E,S+=Rc(P);return p==c&&0==u[0]&&x?this.result((k?-200:0)-100,u,n):g==c&&0==w?[-200-n.length+(b==n.length?0:-100),0,b]:h>-1?[-700-n.length,h,h+this.pattern.length]:g==c?[-900-n.length,w,b]:p==c?this.result((k?-200:0)-100-700+(x?0:-1100),u,n):2==i.length?null:this.result((r[0]?-700:0)-200-1100,r,n)}},{key:"result",value:function t(n,i,e){var r,o,u,t=[n-e.length],s=1,a=ic(i);try{for(a.s();!(r=a.n()).done;)u=(o=r.value)+(this.astral?Rc(Ac(e,o)):1),s>1&&t[s-1]==o?t[s-1]=u:(t[s++]=o,t[s++]=u)}catch(t){a.e(t)}finally{a.f()}return t}}]),t}(),Ou=w.define({combine:function t(n){return il(n,{activateOnTyping:!0,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:function t(){return""},optionClass:function t(){return""},aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:Wm,compareCompletions:function t(n,i){return n.label.localeCompare(i.label)},interactionDelay:75},{defaultKeymap:function t(n,i){return n&&i},closeOnBlur:function t(n,i){return n&&i},icons:function t(n,i){return n&&i},tooltipClass:function t(n,i){return function(t){return zm(n(t),i(t))}},optionClass:function t(n,i){return function(t){return zm(n(t),i(t))}},addToOptions:function t(n,i){return n.concat(i)}})}}),Eu=function t(n){var i=n.state.field(qu,!1);return!(n.state.readOnly||!i||!i.open||i.open.selected<0||Date.now()-i.open.timestamp<n.state.facet(Ou).interactionDelay)&&(!!i.open.disabled||$m(n,i.open.options[i.open.selected]))},Au=function t(n){var i;return!!n.state.field(qu,!1)&&(n.dispatch({effects:Cu.of(!0)}),!0)},Du=function t(n){var i=n.state.field(qu,!1);return!(!i||!i.active.some((function(t){return 0!=t.state})))&&(n.dispatch({effects:ju.of(null)}),!0)},Ru=pc((function t(n,i){yc(this,t),this.active=n,this.context=i,this.time=Date.now(),this.updates=[],this.done=void 0})),Iu=50,Tu=50,Lu=1e3,Bu=pn.fromClass(function(){function t(n){var i,e,r;yc(this,t),this.view=n,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.composing=0,i=ic(n.state.field(qu).active);try{for(i.s();!(e=i.n()).done;)1==(r=e.value).state&&this.startQuery(r)}catch(t){i.e(t)}finally{i.f()}}return pc(t,[{key:"update",value:function t(n){var i,e,r,o,u,s,a,f,h,c,l=this,v=n.state.field(qu);if(n.selectionSet||n.docChanged||n.startState.field(qu)!=v){for(i=n.transactions.some((function(t){return(t.selection||t.docChanged)&&!tp(t)})),e=0;e<this.running.length;e++)if(r=this.running[e],i||r.updates.length+n.transactions.length>Tu&&Date.now()-r.time>Lu){o=ic(r.context.abortListeners);try{for(o.s();!(u=o.n()).done;){s=u.value;try{s()}catch(t){Yl(this.view.state,t)}}}catch(t){o.e(t)}finally{o.f()}r.context.abortListeners=null,this.running.splice(e--,1)}else(a=r.updates).push.apply(a,Jh(n.transactions));if(this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),this.debounceUpdate=v.active.some((function(t){return 1==t.state&&!l.running.some((function(n){return n.active.source==t.source}))}))?setTimeout((function(){return l.startUpdate()}),Iu):-1,0!=this.composing){f=ic(n.transactions);try{for(f.s();!(h=f.n()).done;)"input"==tp(c=h.value)?this.composing=2:2==this.composing&&c.selection&&(this.composing=3)}catch(t){f.e(t)}finally{f.f()}}}}},{key:"startUpdate",value:function t(){var n,i,e,r,o,u=this;this.debounceUpdate=-1,e=ic((i=(n=this.view.state).field(qu)).active);try{for(o=function t(){var n=r.value;1!=n.state||u.running.some((function(t){return t.active.source==n.source}))||u.startQuery(n)},e.s();!(r=e.n()).done;)o()}catch(t){e.e(t)}finally{e.f()}}},{key:"startQuery",value:function t(n){var i=this,e=this.view.state,r=Fm(e),o=new bu(e,r,n.explicitPos==r),u=new Ru(n,o);this.running.push(u),Promise.resolve(n.source(o)).then((function(t){u.context.aborted||(u.done=t||null,i.scheduleAccept())}),(function(t){i.view.dispatch({effects:ju.of(null)}),Yl(i.view.state,t)}))}},{key:"scheduleAccept",value:function t(){var n=this;this.running.every((function(t){return void 0!==t.done}))?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout((function(){return n.accept()}),Iu))}},{key:"accept",value:function t(){var n,i,e,r,o,u,s=this;for(this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1,i=[],e=this.view.state.facet(Ou),r=function t(r){var o,a,f,h,c,l,v,d,y,m=s.running[r];if(void 0===m.done)return u=r,0;if(s.running.splice(r--,1),m.done){o=new Wu(m.active.source,m.active.explicitPos,m.done,m.done.from,null!==(n=m.done.to)&&void 0!==n?n:Fm(m.updates.length?m.updates[0].startState:s.view.state)),a=ic(m.updates);try{for(a.s();!(f=a.n()).done;)h=f.value,o=o.update(h,e)}catch(t){a.e(t)}finally{a.f()}if(o.hasResult())return i.push(o),u=r,0}if((c=s.view.state.field(qu).active.find((function(t){return t.source==m.active.source})))&&1==c.state)if(null==m.done){l=new zu(m.active.source,0),v=ic(m.updates);try{for(v.s();!(d=v.n()).done;)y=d.value,l=l.update(y,e)}catch(t){v.e(t)}finally{v.f()}1!=l.state&&i.push(l)}else s.startQuery(c);u=r},u=0;u<this.running.length;u++)o=r(u);i.length&&this.view.dispatch({effects:Vu.of(i)})}}]),t}(),{eventHandlers:{blur:function t(n){var i,e=this.view.state.field(qu,!1);e&&e.tooltip&&this.view.state.facet(Ou).closeOnBlur&&((i=e.open&&Kd(this.view,e.open.tooltip))&&i.dom.contains(n.relatedTarget)||this.view.dispatch({effects:ju.of(null)}))},compositionstart:function t(){this.composing=1},compositionend:function t(){var n=this;3==this.composing&&setTimeout((function(){return n.view.dispatch({effects:Cu.of(!1)})}),20),this.composing=0}}}),_u=function(){function t(n,i){var e,r,o,u,s,a=this;yc(this,t),this.view=n,this.stateField=i,this.info=null,this.placeInfoReq={read:function t(){return a.measureInfo()},write:function t(n){return a.placeInfo(n)},key:this},this.space=null,this.currentClass="",r=(e=n.state.field(i)).open,o=r.options,u=r.selected,s=n.state.facet(Ou),this.optionContent=qm(s),this.optionClass=s.optionClass,this.tooltipClass=s.tooltipClass,this.range=Gm(o.length,u,s.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(n.state),this.dom.addEventListener("mousedown",(function(t){for(var i=t.target,e;i&&i!=a.dom;i=i.parentNode)if("LI"==i.nodeName&&(e=/-(\d+)$/.exec(i.id))&&+e[1]<o.length)return $m(n,o[+e[1]]),void t.preventDefault()})),this.dom.addEventListener("focusout",(function(t){var i=n.state.field(a.stateField,!1);i&&i.tooltip&&n.state.facet(Ou).closeOnBlur&&t.relatedTarget!=n.contentDOM&&n.dispatch({effects:ju.of(null)})})),this.list=this.dom.appendChild(this.createListBox(o,e.id,this.range)),this.list.addEventListener("scroll",(function(){a.info&&a.view.requestMeasure(a.placeInfoReq)}))}return pc(t,[{key:"mount",value:function t(){this.updateSel()}},{key:"update",value:function t(n){var i,e,r,o=n.state.field(this.stateField),u=n.startState.field(this.stateField);this.updateTooltipClass(n.state),o!=u&&(this.updateSel(),(null===(i=o.open)||void 0===i?void 0:i.disabled)!=(null===(e=u.open)||void 0===e?void 0:e.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!(null===(r=o.open)||void 0===r?void 0:r.disabled)))}},{key:"updateTooltipClass",value:function t(n){var i,e,r,o,u,s,a=this.tooltipClass(n);if(a!=this.currentClass){i=ic(this.currentClass.split(" "));try{for(i.s();!(e=i.n()).done;)(r=e.value)&&this.dom.classList.remove(r)}catch(t){i.e(t)}finally{i.f()}o=ic(a.split(" "));try{for(o.s();!(u=o.n()).done;)(s=u.value)&&this.dom.classList.add(s)}catch(t){o.e(t)}finally{o.f()}this.currentClass=a}}},{key:"positioned",value:function t(n){this.space=n,this.info&&this.view.requestMeasure(this.placeInfoReq)}},{key:"updateSel",value:function t(){var n,i,e,r=this,o=this.view.state.field(this.stateField),u=o.open;if((u.selected>-1&&u.selected<this.range.from||u.selected>=this.range.to)&&(this.range=Gm(u.options.length,u.selected,this.view.state.facet(Ou).maxRenderedOptions),this.list.remove(),this.list=this.dom.appendChild(this.createListBox(u.options,o.id,this.range)),this.list.addEventListener("scroll",(function(){r.info&&r.view.requestMeasure(r.placeInfoReq)}))),this.updateSelectedOption(u.selected)){if(this.info&&(this.info.remove(),this.info=null),!(i=(n=u.options[u.selected].completion).info))return;if(!(e="string"==typeof i?document.createTextNode(i):i(n)))return;"then"in e?e.then((function(t){t&&r.view.state.field(r.stateField,!1)==o&&r.addInfoPane(t)})).catch((function(t){return Yl(r.view.state,t,"completion info")})):this.addInfoPane(e)}}},{key:"addInfoPane",value:function t(n){var i=this.info=document.createElement("div");i.className="cm-tooltip cm-completionInfo",i.appendChild(n),this.dom.appendChild(i),this.view.requestMeasure(this.placeInfoReq)}},{key:"updateSelectedOption",value:function t(n){var i,e,r=null;for(i=this.list.firstChild,e=this.range.from;i;i=i.nextSibling,e++)"LI"==i.nodeName&&i.id?e==n?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),r=i):i.hasAttribute("aria-selected")&&i.removeAttribute("aria-selected"):e--;return r&&Km(this.list,r),r}},{key:"measureInfo",value:function t(){var n,i,e,r,o,u=this.dom.querySelector("[aria-selected]");return u&&this.info?(n=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),e=u.getBoundingClientRect(),(r=this.space)||(r={left:0,top:0,right:(o=this.dom.ownerDocument.defaultView||window).innerWidth,bottom:o.innerHeight}),e.top>Math.min(r.bottom,n.bottom)-10||e.bottom<Math.max(r.top,n.top)+10?null:this.view.state.facet(Ou).positionInfo(this.view,n,e,i,r)):null}},{key:"placeInfo",value:function t(n){this.info&&(n?(n.style&&(this.info.style.cssText=n.style),this.info.className="cm-tooltip cm-completionInfo "+(n.class||"")):this.info.style.cssText="top: -1e6px")}},{key:"createListBox",value:function t(n,i,e){var r,o,u,s,a,f,h,c,l,v,d,y,m,p,k=document.createElement("ul");for(k.id=i,k.setAttribute("role","listbox"),k.setAttribute("aria-expanded","true"),k.setAttribute("aria-label",this.view.state.phrase("Completions")),r=null,o=e.from;o<e.to;o++){s=(u=n[o]).completion,a=u.match,(f=s.section)&&(h="string"==typeof f?f:f.name)!=r&&(o>e.from||0==e.from)&&(r=h,"string"!=typeof f&&f.header?k.appendChild(f.header(f)):(c=k.appendChild(document.createElement("completion-section"))).textContent=h),(l=k.appendChild(document.createElement("li"))).id=i+"-"+o,l.setAttribute("role","option"),(v=this.optionClass(s))&&(l.className=v),d=ic(this.optionContent);try{for(d.s();!(y=d.n()).done;)(p=(m=y.value)(s,this.view.state,a))&&l.appendChild(p)}catch(t){d.e(t)}finally{d.f()}}return e.from&&k.classList.add("cm-completionListIncompleteTop"),e.to<n.length&&k.classList.add("cm-completionListIncompleteBottom"),k}}]),t}(),Fu=function(){function t(n,i,e,r,o,u){yc(this,t),this.options=n,this.attrs=i,this.tooltip=e,this.timestamp=r,this.selected=o,this.disabled=u}return pc(t,[{key:"setSelected",value:function n(i,e){return i==this.selected||i>=this.options.length?this:new t(this.options,Ym(e,i),this.tooltip,this.timestamp,i,this.disabled)}},{key:"map",value:function n(i){return new t(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:i.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}],[{key:"build",value:function n(i,e,r,o,u){var s,a,f,h=Xm(i,e);if(!h.length)return o&&i.some((function(t){return 1==t.state}))?new t(o.options,o.attrs,o.tooltip,o.timestamp,o.selected,!0):null;if(s=e.facet(Ou).selectOnOpen?0:-1,o&&o.selected!=s&&-1!=o.selected)for(a=o.options[o.selected].completion,f=0;f<h.length;f++)if(h[f].completion==a){s=f;break}return new t(h,Ym(r,s),{pos:i.reduce((function(t,n){return n.hasResult()?Math.min(t,n.from):t}),1e8),create:Jm(qu),above:u.aboveCursor},o?o.timestamp:Date.now(),s,!1)}}]),t}(),Nu=function(){function t(n,i,e){yc(this,t),this.active=n,this.id=i,this.open=e}return pc(t,[{key:"update",value:function n(i){var e,r,o,u,s=this,a=i.state,f=a.facet(Ou),h=f.override||a.languageDataAt("autocomplete",Fm(a)).map(Hm),c=h.map((function(t){var n;return(s.active.find((function(n){return n.source==t}))||new zu(t,s.active.some((function(t){return 0!=t.state}))?1:0)).update(i,f)}));c.length==this.active.length&&c.every((function(t,n){return t==s.active[n]}))&&(c=this.active),(e=this.open)&&i.docChanged&&(e=e.map(i.changes)),i.selection||c.some((function(t){return t.hasResult()&&i.changes.touchesRange(t.from,t.to)}))||!Zm(c,this.active)?e=Fu.build(c,a,this.id,e,f):e&&e.disabled&&!c.some((function(t){return 1==t.state}))&&(e=null),!e&&c.every((function(t){return 1!=t.state}))&&c.some((function(t){return t.hasResult()}))&&(c=c.map((function(t){return t.hasResult()?new zu(t.source,0):t}))),r=ic(i.effects);try{for(r.s();!(o=r.n()).done;)(u=o.value).is($u)&&(e=e&&e.setSelected(u.value,this.id))}catch(t){r.e(t)}finally{r.f()}return c==this.active&&e==this.open?this:new t(c,this.id,e)}},{key:"tooltip",get:function t(){return this.open?this.open.tooltip:null}},{key:"attrs",get:function t(){return this.open?this.open.attrs:Uu}}],[{key:"start",value:function n(){return new t(Hu,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}}]),t}(),Uu={"aria-autocomplete":"list"},Hu=[],zu=function(){function t(n,i){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;yc(this,t),this.source=n,this.state=i,this.explicitPos=e}return pc(t,[{key:"hasResult",value:function t(){return!1}},{key:"update",value:function n(i,e){var r,o,u,s,a,f,h=tp(i),c=this;h?c=c.handleUserEvent(i,h,e):i.docChanged?c=c.handleChange(i):i.selection&&0!=c.state&&(c=new t(c.source,0)),r=ic(i.effects);try{for(r.s();!(o=r.n()).done;)if((u=o.value).is(Cu))c=new t(c.source,1,u.value?Fm(i.state):-1);else if(u.is(ju))c=new t(c.source,0);else if(u.is(Vu)){s=ic(u.value);try{for(s.s();!(a=s.n()).done;)(f=a.value).source==c.source&&(c=f)}catch(t){s.e(t)}finally{s.f()}}}catch(t){r.e(t)}finally{r.f()}return c}},{key:"handleUserEvent",value:function n(i,e,r){return"delete"!=e&&r.activateOnTyping?new t(this.source,1):this.map(i.changes)}},{key:"handleChange",value:function n(i){return i.changes.touchesRange(Fm(i.startState))?new t(this.source,0):this.map(i.changes)}},{key:"map",value:function n(i){return i.empty||this.explicitPos<0?this:new t(this.source,this.state,i.mapPos(this.explicitPos))}}]),t}(),Wu=function(t){sc(i,t);var n=fc(i);function i(t,e,r,o,u){var s;return yc(this,i),(s=n.call(this,t,2,e)).result=r,s.from=o,s.to=u,s}return pc(i,[{key:"hasResult",value:function t(){return!0}},{key:"handleUserEvent",value:function t(n,e,r){var o,u,s,a=n.changes.mapPos(this.from),f=n.changes.mapPos(this.to,1),h=Fm(n.state);return(this.explicitPos<0?h<=a:h<this.from)||h>f||"delete"==e&&Fm(n.startState)==this.from?new zu(this.source,"input"==e&&r.activateOnTyping?1:0):(u=this.explicitPos<0?-1:n.changes.mapPos(this.explicitPos),np(this.result.validFor,n.state,a,f)?new i(this.source,u,this.result,a,f):this.result.update&&(s=this.result.update(this.result,a,f,new bu(n.state,h,u>=0)))?new i(this.source,u,s,s.from,null!==(o=s.to)&&void 0!==o?o:Fm(n.state)):new zu(this.source,1,u))}},{key:"handleChange",value:function t(n){return n.changes.touchesRange(this.from,this.to)?new zu(this.source,0):this.map(n.changes)}},{key:"map",value:function t(n){return n.empty?this:new i(this.source,this.explicitPos<0?-1:n.mapPos(this.explicitPos),this.result,n.mapPos(this.from),n.mapPos(this.to,1))}}]),i}(zu),Vu=V.define({map:function t(n,i){return n.map((function(t){return t.map(i)}))}}),$u=V.define(),qu=x.define({create:function t(){return Nu.start()},update:function t(n,i){return n.update(i)},provide:function t(n){return[Be.from(n,(function(t){return t.tooltip})),Vi.contentAttributes.from(n,(function(t){return t.attrs}))]}}),Gu=Vi.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"\xb7\xb7\xb7"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"".concat(400,"px"),boxSizing:"border-box"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"".concat(30,"px")},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"".concat(30,"px")},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'\u0192'"}},".cm-completionIcon-class":{"&:after":{content:"'\u25cb'"}},".cm-completionIcon-interface":{"&:after":{content:"'\u25cc'"}},".cm-completionIcon-variable":{"&:after":{content:"'\ud835\udc65'"}},".cm-completionIcon-constant":{"&:after":{content:"'\ud835\udc36'"}},".cm-completionIcon-type":{"&:after":{content:"'\ud835\udc61'"}},".cm-completionIcon-enum":{"&:after":{content:"'\u222a'"}},".cm-completionIcon-property":{"&:after":{content:"'\u25a1'"}},".cm-completionIcon-keyword":{"&:after":{content:"'\ud83d\udd11\ufe0e'"}},".cm-completionIcon-namespace":{"&:after":{content:"'\u25a2'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),Ju=pc((function t(n,i,e,r){yc(this,t),this.field=n,this.line=i,this.from=e,this.to=r})),Ku=function(){function t(n,i,e){yc(this,t),this.field=n,this.from=i,this.to=e}return pc(t,[{key:"map",value:function n(i){var e=i.mapPos(this.from,-1,v.TrackDel),r=i.mapPos(this.to,1,v.TrackDel);return null==e||null==r?null:new t(this.field,e,r)}}]),t}(),Qu=function(){function t(n,i){yc(this,t),this.lines=n,this.fieldPositions=i}return pc(t,[{key:"instantiate",value:function t(n,i){var e,r,o,u,s,a,f=[],h=[i],c=n.doc.lineAt(i),l=/^\s*/.exec(c.text)[0],v=ic(this.lines);try{for(v.s();!(e=v.n()).done;){if(r=e.value,f.length){for(o=l,u=/^\t*/.exec(r)[0].length,s=0;s<u;s++)o+=n.facet(wo);h.push(i+o.length-u),r=o+r.slice(u)}f.push(r),i+=r.length+1}}catch(t){v.e(t)}finally{v.f()}return a=this.fieldPositions.map((function(t){return new Ku(t.field,h[t.line]+t.from,h[t.line]+t.to)})),{text:f,ranges:a}}}],[{key:"parse",value:function n(i){var e,r,o,u,s,a,f,h,c,l,v,d,y,m,p,k=[],g=[],w=[],b=ic(i.split(/\r\n?|\n/));try{for(b.s();!(r=b.n()).done;){for(o=r.value;e=/[#$]\{(?:(\d+)(?::([^}]*))?|([^}]*))\}/.exec(o);){for(u=e[1]?+e[1]:null,s=e[2]||e[3]||"",a=-1,f=0;f<k.length;f++)(null!=u?k[f].seq==u:s&&k[f].name==s)&&(a=f);if(a<0){for(h=0;h<k.length&&(null==u||null!=k[h].seq&&k[h].seq<u);)h++;k.splice(h,0,{seq:u,name:s}),a=h,c=ic(w);try{for(c.s();!(l=c.n()).done;)(v=l.value).field>=a&&v.field++}catch(t){c.e(t)}finally{c.f()}}w.push(new Ju(a,g.length,e.index,e.index+s.length)),o=o.slice(0,e.index)+s+o.slice(e.index+e[0].length)}for(;d=/\\([{}])/.exec(o);){o=o.slice(0,d.index)+d[1]+o.slice(d.index+d[0].length),y=ic(w);try{for(y.s();!(m=y.n()).done;)(p=m.value).line==g.length&&p.from>d.index&&(p.from--,p.to--)}catch(t){y.e(t)}finally{y.f()}}g.push(o)}}catch(t){b.e(t)}finally{b.f()}return new t(g,w)}}]),t}(),Xu=Jt.widget({widget:new(function(t){sc(i,t);var n=fc(i);function i(){return yc(this,i),n.apply(this,arguments)}return pc(i,[{key:"toDOM",value:function t(){var n=document.createElement("span");return n.className="cm-snippetFieldPosition",n}},{key:"ignoreEvent",value:function t(){return!1}}]),i}(qt))}),Zu=Jt.mark({class:"cm-snippetField"}),Yu=function(){function t(n,i){yc(this,t),this.ranges=n,this.active=i,this.deco=Jt.set(n.map((function(t){return(t.from==t.to?Xu:Zu).range(t.from,t.to)})))}return pc(t,[{key:"map",value:function n(i){var e,r,o,u=[],s=ic(this.ranges);try{for(s.s();!(e=s.n()).done;){if(!(o=(r=e.value).map(i)))return null;u.push(o)}}catch(t){s.e(t)}finally{s.f()}return new t(u,this.active)}},{key:"selectionInsideField",value:function t(n){var i=this;return n.ranges.every((function(t){return i.ranges.some((function(n){return n.field==i.active&&n.from<=t.from&&n.to>=t.to}))}))}}]),t}(),ts=V.define({map:function t(n,i){return n&&n.map(i)}}),ns=V.define(),is=x.define({create:function t(){return null},update:function t(n,i){var e,r,o=ic(i.effects);try{for(o.s();!(e=o.n()).done;){if((r=e.value).is(ts))return r.value;if(r.is(ns)&&n)return new Yu(n.ranges,r.value)}}catch(t){o.e(t)}finally{o.f()}return n&&i.docChanged&&(n=n.map(i.changes)),n&&i.selection&&!n.selectionInsideField(i.selection)&&(n=null),n},provide:function t(n){return Vi.decorations.from(n,(function(t){return t?t.deco:Jt.none}))}}),es=function t(n){var i=n.state,e=n.dispatch,r=i.field(is,!1);return!!r&&(e(i.update({effects:ts.of(null)})),!0)},us=[{key:"Tab",run:rs=rp(1),shift:os=rp(-1)},{key:"Escape",run:es}],ss=w.define({combine:function t(n){return n.length?n[0]:us}}),as=E.highest(Qi.compute([ss],(function(t){return t.facet(ss)}))),fs=Vi.domEventHandlers({mousedown:function t(n,i){var e,r,o=i.state.field(is,!1);return!(!o||null==(e=i.posAtCoords({x:n.clientX,y:n.clientY})))&&(r=o.ranges.find((function(t){return t.from<=e&&t.to>=e})),!(!r||r.field==o.active)&&(i.dispatch({selection:ip(o.ranges,r.field),effects:ts.of(o.ranges.some((function(t){return t.field>r.field}))?new Yu(o.ranges,r.field):null)}),!0))}}),hs=Object.create(null),cs=function t(n){var i,e,r=n.state.languageDataAt("wordChars",n.pos).join(""),o=ap(r),u=n.matchBefore(fp(o,(function(t){return t+"$"})));return u||n.explicit?{from:i=u?u.from:n.pos,options:e=lp(n.state.doc,hp(r),o,5e4,i),validFor:fp(o,(function(t){return"^"+t}))}:null},ls={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},vs=V.define({map:function t(n,i){var e=i.mapPos(n,-1,v.TrackAfter);return null==e?void 0:e}}),ds=new(function(t){sc(i,t);var n=fc(i);function i(){return yc(this,i),n.apply(this,arguments)}return pc(i)}(X)),ds.startSide=1,ds.endSide=-1,ys=x.define({create:function t(){return tt.empty},update:function t(n,i){var e,r,o,u,s;i.selection&&(e=i.state.doc.lineAt(i.selection.main.head).from,r=i.startState.doc.lineAt(i.startState.selection.main.head).from,e!=i.changes.mapPos(r,-1)&&(n=tt.empty)),n=n.map(i.changes),o=ic(i.effects);try{for(o.s();!(u=o.n()).done;)(s=u.value).is(vs)&&(n=n.update({add:[ds.range(s.value,s.value+1)]}))}catch(t){o.e(t)}finally{o.f()}return n}}),ms="()[]{}<>",ps="object"==("undefined"==typeof navigator?"undefined":dc(navigator))&&/Android\b/.test(navigator.userAgent),ks=Vi.inputHandler.of((function(t,n,i,e){var r,o;return!(ps?t.composing:t.compositionStarted)&&!t.state.readOnly&&(r=t.state.selection.main,!(e.length>2||2==e.length&&1==Rc(Ac(e,0))||n!=r.from||i!=r.to)&&(!!(o=mp(t.state,e))&&(t.dispatch(o),!0)))})),ws=[{key:"Backspace",run:gs=function t(n){var i,e,r,o,u=n.state,s=n.dispatch;return!u.readOnly&&(i=yp(u,u.selection.main.head),e=i.brackets||ls.brackets,r=null,o=u.changeByRange((function(t){var n,i,o,s;if(t.empty){n=gp(u.doc,t.head),i=ic(e);try{for(i.s();!(o=i.n()).done;)if((s=o.value)==n&&kp(u.doc,t.head)==dp(Ac(s,0)))return{changes:{from:t.head-s.length,to:t.head+s.length},range:k.cursor(t.head-s.length)}}catch(t){i.e(t)}finally{i.f()}}return{range:r=t}})),r||s(u.update(o,{scrollIntoView:!0,userEvent:"delete.backward"})),!r)}}],bs=[{key:"Ctrl-Space",run:Au},{key:"Escape",run:Du},{key:"ArrowDown",run:Vm(!0)},{key:"ArrowUp",run:Vm(!1)},{key:"PageDown",run:Vm(!0,"page")},{key:"PageUp",run:Vm(!1,"page")},{key:"Enter",run:Eu}],Ms=E.highest(Qi.computeN([Ou],(function(t){return t.facet(Ou).defaultKeymap?[bs]:[]}))),xs=new WeakMap,Ss=n.Autocomplete=Object.freeze({__proto__:null,CompletionContext:bu,acceptCompletion:Eu,autocompletion:jp,clearSnippet:es,closeBrackets:vp,closeBracketsKeymap:ws,closeCompletion:Du,completeAnyWord:cs,completeFromList:Lm,completionKeymap:bs,completionStatus:Pp,currentCompletions:Op,deleteBracketPair:gs,hasNextSnippetField:op,hasPrevSnippetField:up,ifIn:Bm,ifNotIn:_m,insertBracket:mp,insertCompletionText:Um,moveCompletionSelection:Vm,nextSnippetField:rs,pickedCompletion:xu,prevSnippetField:os,selectedCompletion:Ep,selectedCompletionIndex:Ap,setSelectedCompletion:Dp,snippet:ep,snippetCompletion:sp,snippetKeymap:ss,startCompletion:Au}),Cs=function t(n){var i=n.state,e=i.doc.lineAt(i.selection.main.from),r=Ip(n.state,e.from);return r.line?js(n):!!r.block&&Rs(n)},js=Rp(_p,0),Ps=Rp(_p,1),Os=Rp(_p,2),Es=Rp(Bp,0),As=Rp(Bp,1),Ds=Rp(Bp,2),Rs=Rp((function(t,n){return Bp(t,n,Lp(n))}),0),Is=50,Ts=H.define(),Ls=H.define(),Bs=w.define(),_s=w.define({combine:function t(n){return il(n,{minDepth:100,newGroupDelay:500,joinToEvent:function t(n,i){return i}},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:function t(n,i){return function(t,e){return n(t,e)||i(t,e)}}})}}),Fs=x.define({create:function t(){return Qs.empty},update:function t(n,i){var e,r,o,u,s,a,f,h,c=i.state.facet(_s),l=i.annotation(Ts);return l?(e=i.docChanged?k.single(Fp(i.changes)):void 0,r=qs.fromTransaction(i,e),u=0==(o=l.side)?n.undone:n.done,u=r?zp(u,u.length,c.minDepth,r):qp(u,i.startState.selection),new Qs(0==o?l.rest:u,0==o?u:l.rest)):("full"!=(s=i.annotation(Ls))&&"before"!=s||(n=n.isolate()),!1===i.annotation($.addToHistory)?i.changes.empty?n:n.addMapping(i.changes.desc):(a=qs.fromTransaction(i),f=i.annotation($.time),h=i.annotation($.userEvent),a?n=n.addChanges(a,f,h,c,i):i.selection&&(n=n.addSelection(i.startState.selection,f,h,c.newGroupDelay)),"full"!=s&&"after"!=s||(n=n.isolate()),n))},toJSON:function t(n){return{done:n.done.map((function(t){return t.toJSON()})),undone:n.undone.map((function(t){return t.toJSON()}))}},fromJSON:function t(n){return new Qs(n.done.map(qs.fromJSON),n.undone.map(qs.fromJSON))}}),Ns=Fs,Us=Up(0,!1),Hs=Up(1,!1),zs=Up(0,!0),Ws=Up(1,!0),Vs=Hp(0),$s=Hp(1),qs=function(){function t(n,i,e,r,o){yc(this,t),this.changes=n,this.effects=i,this.mapped=e,this.startSelection=r,this.selectionsAfter=o}return pc(t,[{key:"setSelAfter",value:function n(i){return new t(this.changes,this.effects,this.mapped,this.startSelection,i)}},{key:"toJSON",value:function t(){var n,i,e;return{changes:null===(n=this.changes)||void 0===n?void 0:n.toJSON(),mapped:null===(i=this.mapped)||void 0===i?void 0:i.toJSON(),startSelection:null===(e=this.startSelection)||void 0===e?void 0:e.toJSON(),selectionsAfter:this.selectionsAfter.map((function(t){return t.toJSON()}))}}}],[{key:"fromJSON",value:function n(i){return new t(i.changes&&y.fromJSON(i.changes),[],i.mapped&&d.fromJSON(i.mapped),i.startSelection&&k.fromJSON(i.startSelection),i.selectionsAfter.map(k.fromJSON))}},{key:"fromTransaction",value:function n(i,e){var r,o,u,s=Gs,a=ic(i.startState.facet(Bs));try{for(a.s();!(r=a.n()).done;)(u=(o=r.value)(i)).length&&(s=s.concat(u))}catch(t){a.e(t)}finally{a.f()}return!s.length&&i.changes.empty?null:new t(i.changes.invert(i.startState.doc),s,void 0,e||i.startState.selection,Gs)}},{key:"selection",value:function n(i){return new t(void 0,Gs,void 0,void 0,i)}}]),t}(),Gs=[],Js=200,Ks=/^(input\.type|delete)($|\.)/,Qs=function(){function t(n,i){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0;yc(this,t),this.done=n,this.undone=i,this.prevTime=e,this.prevUserEvent=r}return pc(t,[{key:"isolate",value:function n(){return this.prevTime?new t(this.done,this.undone):this}},{key:"addChanges",value:function n(i,e,r,o,u){var s=this.done,a=s[s.length-1];return new t(s=a&&a.changes&&!a.changes.empty&&i.changes&&(!r||Ks.test(r))&&(!a.selectionsAfter.length&&e-this.prevTime<o.newGroupDelay&&o.joinToEvent(u,Wp(a.changes,i.changes))||"input.type.compose"==r)?zp(s,s.length-1,o.minDepth,new qs(i.changes.compose(a.changes),$p(i.effects,a.effects),a.mapped,a.startSelection,Gs)):zp(s,s.length,o.minDepth,i),Gs,e,r)}},{key:"addSelection",value:function n(i,e,r,o){var u=this.done.length?this.done[this.done.length-1].selectionsAfter:Gs;return u.length>0&&e-this.prevTime<o&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&Vp(u[u.length-1],i)?this:new t(qp(this.done,i),this.undone,e,r)}},{key:"addMapping",value:function n(i){return new t(Jp(this.done,i),Jp(this.undone,i),this.prevTime,this.prevUserEvent)}},{key:"pop",value:function t(n,i,e){var r,o,u=0==n?this.done:this.undone;return 0==u.length?null:(r=u[u.length-1],e&&r.selectionsAfter.length?i.update({selection:r.selectionsAfter[r.selectionsAfter.length-1],annotations:Ts.of({side:n,rest:Gp(u)}),userEvent:0==n?"select.undo":"select.redo",scrollIntoView:!0}):r.changes?(o=1==u.length?Gs:u.slice(0,u.length-1),r.mapped&&(o=Jp(o,r.mapped)),i.update({changes:r.changes,selection:r.startSelection,effects:r.effects,annotations:Ts.of({side:n,rest:o}),filter:!1,userEvent:0==n?"undo":"redo",scrollIntoView:!0})):null)}}]),t}(),Qs.empty=new Qs(Gs,Gs),Xs=[{key:"Mod-z",run:Us,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Hs,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Hs,preventDefault:!0},{key:"Mod-u",run:zs,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Ws,preventDefault:!0}],Zs=function t(n){return tk(n,!nk(n))},Ys=function t(n){return tk(n,nk(n))},ta=function t(n){return tk(n,!0)},na=function t(n){return tk(n,!1)},ia=function t(n){return ik(n,!nk(n))},ea=function t(n){return ik(n,nk(n))},ra=function t(n){return ik(n,!0)},oa=function t(n){return ik(n,!1)},ua=function t(n){return rk(n,!0)},sa=function t(n){return rk(n,!1)},aa=function t(n){return Zp(n,(function(t){return uk(n.state,t,!nk(n))}))},fa=function t(n){return Zp(n,(function(t){return uk(n.state,t,nk(n))}))},ha=function t(n){return sk(n,!1)},ca=function t(n){return sk(n,!0)},la=function t(n){return fk(n,!1)},va=function t(n){return fk(n,!0)},da=function t(n){return Zp(n,(function(t){return hk(n,t,!0)}))},ya=function t(n){return Zp(n,(function(t){return hk(n,t,!1)}))},ma=function t(n){return Zp(n,(function(t){return hk(n,t,!nk(n))}))},pa=function t(n){return Zp(n,(function(t){return hk(n,t,nk(n))}))},ka=function t(n){return Zp(n,(function(t){return k.cursor(n.lineBlockAt(t.head).from,1)}))},ga=function t(n){return Zp(n,(function(t){return k.cursor(n.lineBlockAt(t.head).to,-1)}))},wa=function t(n){var i,e;return ck(n.state,n.dispatch,!1)},ba=function t(n){var i,e;return ck(n.state,n.dispatch,!0)},Ma=function t(n){return vk(n,!nk(n))},xa=function t(n){return vk(n,nk(n))},Sa=function t(n){return vk(n,!0)},Ca=function t(n){return vk(n,!1)},ja=function t(n){return dk(n,!nk(n))},Pa=function t(n){return dk(n,nk(n))},Oa=function t(n){return dk(n,!0)},Ea=function t(n){return dk(n,!1)},Aa=function t(n){return yk(n,!0)},Da=function t(n){return yk(n,!1)},Ra=function t(n){return lk(n,(function(t){return uk(n.state,t,!nk(n))}))},Ia=function t(n){return lk(n,(function(t){return uk(n.state,t,nk(n))}))},Ta=function t(n){return mk(n,!1)},La=function t(n){return mk(n,!0)},Ba=function t(n){return pk(n,!1)},_a=function t(n){return pk(n,!0)},Fa=function t(n){return lk(n,(function(t){return hk(n,t,!0)}))},Na=function t(n){return lk(n,(function(t){return hk(n,t,!1)}))},Ua=function t(n){return lk(n,(function(t){return hk(n,t,!nk(n))}))},Ha=function t(n){return lk(n,(function(t){return hk(n,t,nk(n))}))},za=function t(n){return lk(n,(function(t){return k.cursor(n.lineBlockAt(t.head).from)}))},Wa=function t(n){return lk(n,(function(t){return k.cursor(n.lineBlockAt(t.head).to)}))},Va=function t(n){var i=n.state,e;return(0,n.dispatch)(Xp(i,{anchor:0})),!0},$a=function t(n){var i=n.state,e;return(0,n.dispatch)(Xp(i,{anchor:i.doc.length})),!0},qa=function t(n){var i=n.state,e;return(0,n.dispatch)(Xp(i,{anchor:i.selection.main.anchor,head:0})),!0},Ga=function t(n){var i=n.state,e;return(0,n.dispatch)(Xp(i,{anchor:i.selection.main.anchor,head:i.doc.length})),!0},Ja=function t(n){var i=n.state,e;return(0,n.dispatch)(i.update({selection:{anchor:0,head:i.doc.length},userEvent:"select"})),!0},Ka=function t(n){var i=n.state,e=n.dispatch,r=wk(i).map((function(t){var n=t.from,e=t.to;return k.range(n,Math.min(e+1,i.doc.length))}));return e(i.update({selection:k.create(r),userEvent:"select"})),!0},Qa=function t(n){var i=n.state,e=n.dispatch,r=Qp(i.selection,(function(t){for(var n,e=Ry(i).resolveInner(t.head,1);!(e.from<t.from&&e.to>=t.to||e.to>t.to&&e.from<=t.from)&&(null===(n=e.parent)||void 0===n?void 0:n.parent);)e=e.parent;return k.range(e.to,e.from)}));return e(Xp(i,r)),!0},Xa=function t(n){var i=n.state,e=n.dispatch,r=i.selection,o=null;return r.ranges.length>1?o=k.create([r.main]):r.main.empty||(o=k.create([k.cursor(r.main.head)])),!!o&&(e(Xp(i,o)),!0)},Za=function t(n,i){return kk(n,(function(t){var e,r,o,u,s,a=n.state,f=a.doc.lineAt(t);if(!i&&t>f.from&&t<f.from+200&&!/[^ \t]/.test(e=f.text.slice(0,t-f.from))){if("\t"==e[e.length-1])return t-1;for(u=(o=ll(e,a.tabSize))%Fy(a)||Fy(a),s=0;s<u&&" "==e[e.length-1-s];s++)t--;r=t}else(r=Cc(f.text,t-f.from,i,i)+f.from)==t&&f.number!=(i?a.doc.lines:1)&&(r+=i?1:-1);return r}))},Ya=function t(n){return Za(n,!1)},tf=function t(n){return Za(n,!0)},nf=function t(n,i){return kk(n,(function(t){var e,r,o,u,s=t,a=n.state,f=a.doc.lineAt(s),h=a.charCategorizer(s);for(e=null;;){if(s==(i?f.to:f.from)){s==t&&f.number!=(i?a.doc.lines:1)&&(s+=i?1:-1);break}if(r=Cc(f.text,s-f.from,i)+f.from,u=h(o=f.text.slice(Math.min(s,r)-f.from,Math.max(s,r)-f.from)),null!=e&&u!=e)break;" "==o&&s==t||(e=u),s=r}return s}))},ef=function t(n){return nf(n,!1)},rf=function t(n){return nf(n,!0)},of=function t(n){return kk(n,(function(t){var i=n.lineBlockAt(t).to;return t<i?i:Math.min(n.state.doc.length,t+1)}))},uf=function t(n){return kk(n,(function(t){var i=n.lineBlockAt(t).from;return t>i?i:Math.max(0,t-1)}))},sf=function t(n){var i,e,r,o,u,s=n.state,a=n.dispatch;if(s.readOnly)return!1;for(i=[],e=0,r="",o=s.doc.iter();;){if(o.next(),o.lineBreak||o.done){if((u=r.search(/\s+$/))>-1&&i.push({from:e-(r.length-u),to:e}),o.done)break;r=""}else r=o.value;e+=o.value.length}return!!i.length&&(a(s.update({changes:i,userEvent:"delete"})),!0)},af=function t(n){var e,r=n.state,o=n.dispatch;return!r.readOnly&&(e=r.changeByRange((function(t){return{changes:{from:t.from,to:t.to,insert:i.of(["",""])},range:k.cursor(t.from)}})),o(r.update(e,{scrollIntoView:!0,userEvent:"input"})),!0)},ff=function t(n){var i,e=n.state,r=n.dispatch;return!e.readOnly&&(!(i=e.changeByRange((function(t){var n,i,r,o;return t.empty&&0!=t.from&&t.from!=e.doc.length?{changes:{from:r=(n=t.from)==(i=e.doc.lineAt(n)).from?n-1:Cc(i.text,n-i.from,!1)+i.from,to:o=n==i.to?n+1:Cc(i.text,n-i.from,!0)+i.from,insert:e.doc.slice(n,o).append(e.doc.slice(r,n))},range:k.cursor(o)}:{range:t}}))).changes.empty&&(r(e.update(i,{scrollIntoView:!0,userEvent:"move.character"})),!0))},hf=function t(n){var i,e;return bk(n.state,n.dispatch,!1)},cf=function t(n){var i,e;return bk(n.state,n.dispatch,!0)},lf=function t(n){var i,e;return Mk(n.state,n.dispatch,!1)},vf=function t(n){var i,e;return Mk(n.state,n.dispatch,!0)},df=function t(n){var i,e,r;return!n.state.readOnly&&(e=(i=n.state).changes(wk(i).map((function(t){var n=t.from,e=t.to;return n>0?n--:e<i.doc.length&&e++,{from:n,to:e}}))),r=Qp(i.selection,(function(t){return n.moveVertically(t,!0)})).map(e),n.dispatch({changes:e,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0)},yf=function t(n){var i=n.state,e;return(0,n.dispatch)(i.update(i.replaceSelection(i.lineBreak),{scrollIntoView:!0,userEvent:"input"})),!0},mf=Sk(!1),kf=function t(n){var i,e,r,o=n.state,u=n.dispatch;return!o.readOnly&&(i=Object.create(null),e=new bo(o,{overrideIndentation:function t(n){var e=i[n];return null==e?-1:e}}),r=Ck(o,(function(t,n,r){var u,s,a=Uy(e,t.from);null!=a&&(/\S/.test(t.text)||(a=0),((u=/^\s*/.exec(t.text)[0])!=(s=Ny(o,a))||r.from<t.from+u.length)&&(i[t.from]=a,n.push({from:t.from,to:t.from+u.length,insert:s})))})),r.changes.empty||u(o.update(r,{userEvent:"indent"})),!0)},wf=function t(n){var i=n.state,e=n.dispatch;return!i.readOnly&&(e(i.update(Ck(i,(function(t,n){var e,r,o,u=/^\s*/.exec(t.text)[0];if(u){for(e=ll(u,i.tabSize),r=0,o=Ny(i,Math.max(0,e-Fy(i)));r<u.length&&r<o.length&&u.charCodeAt(r)==o.charCodeAt(r);)r++;n.push({from:t.from+r,to:t.from+u.length,insert:o.slice(r)})}})),{userEvent:"delete.dedent"})),!0)},bf=function t(n){var i=n.state,e=n.dispatch;return i.selection.ranges.some((function(t){return!t.empty}))?gf({state:i,dispatch:e}):(e(i.update(i.replaceSelection("\t"),{scrollIntoView:!0,userEvent:"input"})),!0)},Sf=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:aa,shift:Ra},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:fa,shift:Ia},{key:"Alt-ArrowUp",run:hf},{key:"Shift-Alt-ArrowUp",run:lf},{key:"Alt-ArrowDown",run:cf},{key:"Shift-Alt-ArrowDown",run:vf},{key:"Escape",run:Xa},{key:"Mod-Enter",run:pf=Sk(!0)},{key:"Alt-l",mac:"Ctrl-l",run:Ka},{key:"Mod-i",run:Qa,preventDefault:!0},{key:"Mod-[",run:wf},{key:"Mod-]",run:gf=function t(n){var i=n.state,e=n.dispatch;return!i.readOnly&&(e(i.update(Ck(i,(function(t,n){n.push({from:t.from,insert:i.facet(wo)})})),{userEvent:"input.indent"})),!0)}},{key:"Mod-Alt-\\",run:kf},{key:"Shift-Mod-k",run:df},{key:"Shift-Mod-\\",run:wa},{key:"Mod-/",run:Cs},{key:"Alt-A",run:Es}].concat(xf=[{key:"ArrowLeft",run:Zs,shift:Ma,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:ia,shift:ja,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:ma,shift:Ua,preventDefault:!0},{key:"ArrowRight",run:Ys,shift:xa,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:ea,shift:Pa,preventDefault:!0},{mac:"Cmd-ArrowRight",run:pa,shift:Ha,preventDefault:!0},{key:"ArrowUp",run:ha,shift:Ta,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Va,shift:qa},{mac:"Ctrl-ArrowUp",run:la,shift:Ba},{key:"ArrowDown",run:ca,shift:La,preventDefault:!0},{mac:"Cmd-ArrowDown",run:$a,shift:Ga},{mac:"Ctrl-ArrowDown",run:va,shift:_a},{key:"PageUp",run:la,shift:Ba},{key:"PageDown",run:va,shift:_a},{key:"Home",run:ya,shift:Na,preventDefault:!0},{key:"Mod-Home",run:Va,shift:qa},{key:"End",run:da,shift:Fa,preventDefault:!0},{key:"Mod-End",run:$a,shift:Ga},{key:"Enter",run:mf},{key:"Mod-a",run:Ja},{key:"Backspace",run:Ya,shift:Ya},{key:"Delete",run:tf},{key:"Mod-Backspace",mac:"Alt-Backspace",run:ef},{key:"Mod-Delete",mac:"Alt-Delete",run:rf},{mac:"Mod-Backspace",run:uf},{mac:"Mod-Delete",run:of}].concat((Mf=[{key:"Ctrl-b",run:Zs,shift:Ma,preventDefault:!0},{key:"Ctrl-f",run:Ys,shift:xa},{key:"Ctrl-p",run:ha,shift:Ta},{key:"Ctrl-n",run:ca,shift:La},{key:"Ctrl-a",run:ka,shift:za},{key:"Ctrl-e",run:ga,shift:Wa},{key:"Ctrl-d",run:tf},{key:"Ctrl-h",run:Ya},{key:"Ctrl-k",run:of},{key:"Ctrl-Alt-h",run:ef},{key:"Ctrl-o",run:af},{key:"Ctrl-t",run:ff},{key:"Ctrl-v",run:va}]).map((function(t){return{mac:t.key,run:t.run,shift:t.shift}})))),Cf={key:"Tab",run:gf,shift:wf},jf=n.Commands=Object.freeze({__proto__:null,blockComment:As,blockUncomment:Ds,copyLineDown:vf,copyLineUp:lf,cursorCharBackward:na,cursorCharForward:ta,cursorCharLeft:Zs,cursorCharRight:Ys,cursorDocEnd:$a,cursorDocStart:Va,cursorGroupBackward:oa,cursorGroupForward:ra,cursorGroupLeft:ia,cursorGroupRight:ea,cursorLineBoundaryBackward:ya,cursorLineBoundaryForward:da,cursorLineBoundaryLeft:ma,cursorLineBoundaryRight:pa,cursorLineDown:ca,cursorLineEnd:ga,cursorLineStart:ka,cursorLineUp:ha,cursorMatchingBracket:wa,cursorPageDown:va,cursorPageUp:la,cursorSubwordBackward:sa,cursorSubwordForward:ua,cursorSyntaxLeft:aa,cursorSyntaxRight:fa,defaultKeymap:Sf,deleteCharBackward:Ya,deleteCharForward:tf,deleteGroupBackward:ef,deleteGroupForward:rf,deleteLine:df,deleteToLineEnd:of,deleteToLineStart:uf,deleteTrailingWhitespace:sf,emacsStyleKeymap:Mf,history:Np,historyField:Ns,historyKeymap:Xs,indentLess:wf,indentMore:gf,indentSelection:kf,indentWithTab:Cf,insertBlankLine:pf,insertNewline:yf,insertNewlineAndIndent:mf,insertTab:bf,invertedEffects:Bs,isolateHistory:Ls,lineComment:Ps,lineUncomment:Os,moveLineDown:cf,moveLineUp:hf,redo:Hs,redoDepth:$s,redoSelection:Ws,selectAll:Ja,selectCharBackward:Ca,selectCharForward:Sa,selectCharLeft:Ma,selectCharRight:xa,selectDocEnd:Ga,selectDocStart:qa,selectGroupBackward:Ea,selectGroupForward:Oa,selectGroupLeft:ja,selectGroupRight:Pa,selectLine:Ka,selectLineBoundaryBackward:Na,selectLineBoundaryForward:Fa,selectLineBoundaryLeft:Ua,selectLineBoundaryRight:Ha,selectLineDown:La,selectLineEnd:Wa,selectLineStart:za,selectLineUp:Ta,selectMatchingBracket:ba,selectPageDown:_a,selectPageUp:Ba,selectParentSyntax:Qa,selectSubwordBackward:Da,selectSubwordForward:Aa,selectSyntaxLeft:Ra,selectSyntaxRight:Ia,simplifySelection:Xa,splitLine:af,standardKeymap:xf,toggleBlockComment:Es,toggleBlockCommentByLine:Rs,toggleComment:Cs,toggleLineComment:js,transposeChars:ff,undo:Us,undoDepth:Vs,undoSelection:zs}),Pf=pc((function t(n,i,e){yc(this,t),this.from=n,this.to=i,this.diagnostic=e})),Of=function(){function t(n,i,e){yc(this,t),this.diagnostics=n,this.panel=i,this.selected=e}return pc(t,null,[{key:"init",value:function n(i,e,r){var o,u=i,s=r.facet(Nf).markerFilter;return s&&(u=s(u)),new t(o=Jt.set(u.map((function(t){return t.from==t.to||t.from==t.to-1&&r.doc.lineAt(t.from).to==t.from?Jt.widget({widget:new Uf(t),diagnostic:t}).range(t.from):Jt.mark({attributes:{class:"cm-lintRange cm-lintRange-"+t.severity},diagnostic:t}).range(t.from,t.to)})),!0),e,Ok(o))}}]),t}(),Ef=V.define(),Af=V.define(),Df=V.define(),Rf=x.define({create:function t(){return new Of(Jt.none,null,null)},update:function t(n,i){var e,r,o,u,s,a;i.docChanged&&(e=n.diagnostics.map(i.changes),r=null,n.selected&&(o=i.changes.mapPos(n.selected.from,1),r=Ok(e,n.selected.diagnostic,o)||Ok(e,null,o)),n=new Of(e,n.panel,r)),u=ic(i.effects);try{for(u.s();!(s=u.n()).done;)(a=s.value).is(Ef)?n=Of.init(a.value,n.panel,i.state):a.is(Af)?n=new Of(n.diagnostics,a.value?zf.open:null,n.selected):a.is(Df)&&(n=new Of(n.diagnostics,n.panel,a.value))}catch(t){u.e(t)}finally{u.f()}return n},provide:function t(n){return[qe.from(n,(function(t){return t.panel})),Vi.decorations.from(n,(function(t){return t.diagnostics}))]}}),If=Jt.mark({class:"cm-lintRange cm-lintRange-active"}),Lf=function t(n){var i=n.state.field(Rf,!1);return!(!i||!i.panel)&&(n.dispatch({effects:Af.of(!1)}),!0)},_f=[{key:"Mod-Shift-m",run:Tf=function t(n){var i,e=n.state.field(Rf,!1);return e&&e.panel||n.dispatch({effects:Ak(n.state,[Af.of(!0)])}),(i=Yd(n,zf.open))&&i.dom.querySelector(".cm-panel-lint ul").focus(),!0},preventDefault:!0},{key:"F8",run:Bf=function t(n){var i,e,r=n.state.field(Rf,!1);return!!r&&(i=n.state.selection.main,!(!(e=r.diagnostics.iter(i.to+1)).value&&(!(e=r.diagnostics.iter(0)).value||e.from==i.from&&e.to==i.to))&&(n.dispatch({selection:{anchor:e.from,head:e.to},scrollIntoView:!0}),!0))}}],Ff=pn.fromClass(function(){function t(n){yc(this,t),this.view=n,this.timeout=-1,this.set=!0;var i,e=n.state.facet(Nf).delay;this.lintTime=Date.now()+e,this.run=this.run.bind(this),this.timeout=setTimeout(this.run,e)}return pc(t,[{key:"run",value:function t(){var n,i,e,r=this,o=Date.now();o<this.lintTime-10?setTimeout(this.run,this.lintTime-o):(this.set=!1,e=(i=(n=this.view.state).facet(Nf)).sources,Promise.all(e.map((function(t){return Promise.resolve(t(r.view))}))).then((function(t){var i=t.reduce((function(t,n){return t.concat(n)}));r.view.state.doc==n.doc&&r.view.dispatch(Dk(r.view.state,i))}),(function(t){Yl(r.view.state,t)})))}},{key:"update",value:function t(n){var i=n.state.facet(Nf);(n.docChanged||i!=n.startState.facet(Nf)||i.needsRefresh&&i.needsRefresh(n))&&(this.lintTime=Date.now()+i.delay,this.set||(this.set=!0,this.timeout=setTimeout(this.run,i.delay)))}},{key:"force",value:function t(){this.set&&(this.lintTime=Date.now(),this.run())}},{key:"destroy",value:function t(){clearTimeout(this.timeout)}}]),t}()),Nf=w.define({combine:function t(n){return Object.assign({sources:n.map((function(t){return t.source}))},il(n.map((function(t){return t.config})),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null},{needsRefresh:function t(n,i){return n?i?function(t){return n(t)||i(t)}:n:i}}))}}),Uf=function(t){sc(i,t);var n=fc(i);function i(t){var e;return yc(this,i),(e=n.call(this)).diagnostic=t,e}return pc(i,[{key:"eq",value:function t(n){return n.diagnostic==this.diagnostic}},{key:"toDOM",value:function t(){return jk("span",{class:"cm-lintPoint cm-lintPoint-"+this.diagnostic.severity})}}]),i}(qt),Hf=pc((function t(n,i){yc(this,t),this.diagnostic=i,this.id="item_"+Math.floor(4294967295*Math.random()).toString(16),this.dom=Fk(n,i,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")})),zf=function(){function t(n){var i,e,r=this;yc(this,t),this.view=n,this.items=[],i=function t(i){var e,o,u,s;if(27==i.keyCode)Lf(r.view),r.view.focus();else if(38==i.keyCode||33==i.keyCode)r.moveSelection((r.selectedIndex-1+r.items.length)%r.items.length);else if(40==i.keyCode||34==i.keyCode)r.moveSelection((r.selectedIndex+1)%r.items.length);else if(36==i.keyCode)r.moveSelection(0);else if(35==i.keyCode)r.moveSelection(r.items.length-1);else if(13==i.keyCode)r.view.focus();else{if(!(i.keyCode>=65&&i.keyCode<=90&&r.selectedIndex>=0))return;for(o=_k((e=r.items[r.selectedIndex].diagnostic).actions),u=0;u<o.length;u++)o[u].toUpperCase().charCodeAt(0)==i.keyCode&&(s=Ok(r.view.state.field(Rf).diagnostics,e))&&e.actions[u].apply(n,s.from,s.to)}i.preventDefault()},e=function t(n){for(var i=0;i<r.items.length;i++)r.items[i].dom.contains(n.target)&&r.moveSelection(i)},this.list=jk("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:i,onclick:e}),this.dom=jk("div",{class:"cm-panel-lint"},this.list,jk("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:function t(){return Lf(r.view)}},"\xd7")),this.update()}return pc(t,[{key:"selectedIndex",get:function t(){var n,i=this.view.state.field(Rf).selected;if(!i)return-1;for(n=0;n<this.items.length;n++)if(this.items[n].diagnostic==i.diagnostic)return n;return-1}},{key:"update",value:function t(){var n=this,i=this.view.state.field(Rf),e=i.diagnostics,r=i.selected,o=0,u=!1,s=null;for(e.between(0,this.view.state.doc.length,(function(t,i,e){var a,f,h=e.spec,c=-1;for(f=o;f<n.items.length;f++)if(n.items[f].diagnostic==h.diagnostic){c=f;break}c<0?(a=new Hf(n.view,h.diagnostic),n.items.splice(o,0,a),u=!0):(a=n.items[c],c>o&&(n.items.splice(o,c-o),u=!0)),r&&a.diagnostic==r.diagnostic?a.dom.hasAttribute("aria-selected")||(a.dom.setAttribute("aria-selected","true"),s=a):a.dom.hasAttribute("aria-selected")&&a.dom.removeAttribute("aria-selected"),o++}));o<this.items.length&&!(1==this.items.length&&this.items[0].diagnostic.from<0);)u=!0,this.items.pop();0==this.items.length&&(this.items.push(new Hf(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),u=!0),s?(this.list.setAttribute("aria-activedescendant",s.id),this.view.requestMeasure({key:this,read:function t(){return{sel:s.dom.getBoundingClientRect(),panel:n.list.getBoundingClientRect()}},write:function t(i){var e=i.sel,r=i.panel;e.top<r.top?n.list.scrollTop-=r.top-e.top:e.bottom>r.bottom&&(n.list.scrollTop+=e.bottom-r.bottom)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),u&&this.sync()}},{key:"sync",value:function t(){var n,i,e,r=this.list.firstChild;function o(){var t=r;r=t.nextSibling,t.remove()}n=ic(this.items);try{for(n.s();!(i=n.n()).done;)if((e=i.value).dom.parentNode==this.list){for(;r!=e.dom;)o();r=e.dom.nextSibling}else this.list.insertBefore(e.dom,r)}catch(t){n.e(t)}finally{n.f()}for(;r;)o()}},{key:"moveSelection",value:function t(n){var i,e;this.selectedIndex<0||(e=Ok((i=this.view.state.field(Rf)).diagnostics,this.items[n].diagnostic))&&this.view.dispatch({selection:{anchor:e.from,head:e.to},scrollIntoView:!0,effects:Df.of(e)})}}],[{key:"open",value:function n(i){return new t(i)}}]),t}(),Wf=Vi.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:Uk("#d11")},".cm-lintRange-warning":{backgroundImage:Uk("orange")},".cm-lintRange-info":{backgroundImage:Uk("#999")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}}),Vf=function(t){sc(i,t);var n=fc(i);function i(t){var e;return yc(this,i),(e=n.call(this)).diagnostics=t,e.severity=t.reduce((function(t,n){var i=n.severity;return"error"==i||"warning"==i&&"info"==t?i:t}),"info"),e}return pc(i,[{key:"toDOM",value:function t(n){var i,e,r=document.createElement("div");return r.className="cm-lint-marker cm-lint-marker-"+this.severity,i=this.diagnostics,(e=n.state.facet(Xf).tooltipFilter)&&(i=e(i)),i.length&&(r.onmouseover=function(){return zk(n,r,i)}),r}}]),i}(Ge),$f=ny({class:"cm-gutter-lint",markers:function t(n){return n.state.field(qf)}}),qf=x.define({create:function t(){return tt.empty},update:function t(n,i){var e,r,o,u,s;n=n.map(i.changes),e=i.state.facet(Xf).markerFilter,r=ic(i.effects);try{for(r.s();!(o=r.n()).done;)(u=o.value).is(Ef)&&(s=u.value,e&&(s=e(s||[])),n=Wk(i.state.doc,s.slice(0)))}catch(t){r.e(t)}finally{r.f()}return n}}),Gf=V.define(),Jf=x.define({create:function t(){return null},update:function t(n,i){return n&&i.docChanged&&(n=Ek(i,n)?null:Object.assign(Object.assign({},n),{pos:i.changes.mapPos(n.pos)})),i.effects.reduce((function(t,n){return n.is(Gf)?n.value:t}),n)},provide:function t(n){return Be.from(n)}}),Kf=Vi.baseTheme({".cm-gutter-lint":{width:"1.4em","& .cm-gutterElement":{padding:".2em"}},".cm-lint-marker":{width:"1em",height:"1em"},".cm-lint-marker-info":{content:Nk('<path fill="#aaf" stroke="#77e" stroke-width="6" stroke-linejoin="round" d="M5 5L35 5L35 35L5 35Z"/>')},".cm-lint-marker-warning":{content:Nk('<path fill="#fe8" stroke="#fd7" stroke-width="6" stroke-linejoin="round" d="M20 6L37 35L3 35Z"/>')},".cm-lint-marker-error":{content:Nk('<circle cx="20" cy="20" r="15" fill="#f87" stroke="#f43" stroke-width="6"/>')}}),Qf=[Rf,Vi.decorations.compute([Rf],(function(t){var n=t.field(Rf),i=n.selected,e=n.panel;return i&&e&&i.from!=i.to?Jt.set([If.range(i.from,i.to)]):Jt.none})),Jd(Ik,{hideOn:Ek}),Wf],Xf=w.define({combine:function t(n){return il(n,{hoverTime:300,markerFilter:null,tooltipFilter:null})}}),Zf=n.Lint=Object.freeze({__proto__:null,closeLintPanel:Lf,diagnosticCount:Rk,forEachDiagnostic:$k,forceLinting:Bk,lintGutter:Vk,lintKeymap:_f,linter:Lk,nextDiagnostic:Bf,openLintPanel:Tf,setDiagnostics:Dk,setDiagnosticsEffect:Ef}),Yf="function"==typeof String.prototype.normalize?function(t){return t.normalize("NFKD")}:function(t){return t},th=function(){function t(n,i){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n.length,o=arguments.length>4?arguments[4]:void 0,u=arguments.length>5?arguments[5]:void 0;yc(this,t),this.test=u,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=n.iterRange(e,r),this.bufferStart=e,this.normalize=o?function(t){return o(Yf(t))}:Yf,this.query=this.normalize(i)}return pc(t,[{key:"peek",value:function t(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Ac(this.buffer,this.bufferPos)}},{key:"next",value:function t(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}},{key:"nextOverlapping",value:function t(){for(var n,i,e,r,o,u,s,a;;){if((n=this.peek())<0)return this.done=!0,this;for(i=Dc(n),e=this.bufferStart+this.bufferPos,this.bufferPos+=Rc(n),r=this.normalize(i),o=0,u=e;;o++){if(s=r.charCodeAt(o),a=this.match(s,u))return this.value=a,this;if(o==r.length-1)break;u==e&&o<i.length&&i.charCodeAt(o)==s&&u++}}}},{key:"match",value:function t(n,i){var e,r,o,t=null;for(e=0;e<this.matches.length;e+=2)r=this.matches[e],o=!1,this.query.charCodeAt(r)==n&&(r==this.query.length-1?t={from:this.matches[e+1],to:i+1}:(this.matches[e]++,o=!0)),o||(this.matches.splice(e,2),e-=2);return this.query.charCodeAt(0)==n&&(1==this.query.length?t={from:i,to:i+1}:this.matches.push(1,i)),t&&this.test&&!this.test(t.from,t.to,this.buffer,this.bufferPos)&&(t=null),t}}]),t}(),"undefined"!=typeof Symbol&&(th.prototype[Symbol.iterator]=function(){return this}),nh={from:-1,to:-1,match:/.*/.exec("")},ih="gm"+(null==/x/.unicode?"":"u"),eh=function(){function t(n,i,e){var r,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:n.length;if(yc(this,t),this.text=n,this.to=u,this.curLine="",this.done=!1,this.value=nh,/\\[sWDnr]|\n|\r|\[\^/.test(i))return new uh(n,i,e,o,u);this.re=new RegExp(i,ih+((null==e?void 0:e.ignoreCase)?"i":"")),this.test=null==e?void 0:e.test,this.iter=n.iter(),r=n.lineAt(o),this.curLineStart=r.from,this.matchPos=Gk(n,o),this.getLine(this.curLineStart)}return pc(t,[{key:"getLine",value:function t(n){this.iter.next(n),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}},{key:"nextLine",value:function t(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}},{key:"next",value:function t(){var n,i,e,r;for(n=this.matchPos-this.curLineStart;;)if(this.re.lastIndex=n,i=this.matchPos<=this.to&&this.re.exec(this.curLine)){if(r=(e=this.curLineStart+i.index)+i[0].length,this.matchPos=Gk(this.text,r+(e==r?1:0)),e==this.curLineStart+this.curLine.length&&this.nextLine(),(e<r||e>this.value.to)&&(!this.test||this.test(e,r,i)))return this.value={from:e,to:r,match:i},this;n=this.matchPos-this.curLineStart}else{if(!(this.curLineStart+this.curLine.length<this.to))return this.done=!0,this;this.nextLine(),n=0}}}]),t}(),rh=new WeakMap,oh=function(){function t(n,i){yc(this,t),this.from=n,this.text=i}return pc(t,[{key:"to",get:function t(){return this.from+this.text.length}}],[{key:"get",value:function n(i,e,r){var o,u,s,a=rh.get(i);return!a||a.from>=r||a.to<=e?(o=new t(e,i.sliceString(e,r)),rh.set(i,o),o):a.from==e&&a.to==r?a:(u=a.text,(s=a.from)>e&&(u=i.sliceString(e,s)+u,s=e),a.to<r&&(u+=i.sliceString(a.to,r)),rh.set(i,new t(s,u)),new t(e,u.slice(e-s,r-s)))}}]),t}(),uh=function(){function t(n,i,e,r,o){yc(this,t),this.text=n,this.to=o,this.done=!1,this.value=nh,this.matchPos=Gk(n,r),this.re=new RegExp(i,ih+((null==e?void 0:e.ignoreCase)?"i":"")),this.test=null==e?void 0:e.test,this.flat=oh.get(n,r,this.chunkEnd(r+5e3))}return pc(t,[{key:"chunkEnd",value:function t(n){return n>=this.to?this.to:this.text.lineAt(n).to}},{key:"next",value:function t(){for(var n,i,e,r;;){if(n=this.re.lastIndex=this.matchPos-this.flat.from,(i=this.re.exec(this.flat.text))&&!i[0]&&i.index==n&&(this.re.lastIndex=n+1,i=this.re.exec(this.flat.text)),i&&(r=(e=this.flat.from+i.index)+i[0].length,(this.flat.to>=this.to||i.index+i[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,r,i))))return this.value={from:e,to:r,match:i},this.matchPos=Gk(this.text,r+(e==r?1:0)),this;if(this.flat.to==this.to)return this.done=!0,this;this.flat=oh.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}]),t}(),"undefined"!=typeof Symbol&&(eh.prototype[Symbol.iterator]=uh.prototype[Symbol.iterator]=function(){return this}),sh=V.define(),ah=x.define({create:function t(){return!0},update:function t(n,i){var e,r,o=ic(i.effects);try{for(o.s();!(e=o.n()).done;)(r=e.value).is(sh)&&(n=r.value)}catch(t){o.e(t)}finally{o.f()}return n},provide:function t(n){return qe.from(n,(function(t){return t?Jk:null}))}}),fh=function t(n){var i,e=Yd(n,Jk);return e||(i=[sh.of(!0)],null==n.state.field(ah,!1)&&i.push(V.appendConfig.of([ah,hh])),n.dispatch({effects:i}),e=Yd(n,Jk)),e&&e.dom.querySelector("input").focus(),!0},hh=Vi.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),ch={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},lh=w.define({combine:function t(n){return il(n,ch,{highlightWordAroundCursor:function t(n,i){return n||i},minSelectionLength:Math.min,maxMatches:Math.min})}}),vh=Jt.mark({class:"cm-selectionMatch"}),dh=Jt.mark({class:"cm-selectionMatch cm-selectionMatch-main"}),yh=pn.fromClass(function(){function t(n){yc(this,t),this.decorations=this.getDeco(n)}return pc(t,[{key:"update",value:function t(n){(n.selectionSet||n.docChanged||n.viewportChanged)&&(this.decorations=this.getDeco(n.view))}},{key:"getDeco",value:function t(n){var i,e,r,o,u,s,a,f,h,c,l,v,d,y=n.state.facet(lh),m=n.state,p=m.selection;if(p.ranges.length>1)return Jt.none;if(r=null,(i=p.main).empty){if(!y.highlightWordAroundCursor)return Jt.none;if(!(o=m.wordAt(i.head)))return Jt.none;r=m.charCategorizer(i.head),e=m.sliceDoc(o.from,o.to)}else{if((u=i.to-i.from)<y.minSelectionLength||u>200)return Jt.none;if(y.wholeWords){if(e=m.sliceDoc(i.from,i.to),!Qk(r=m.charCategorizer(i.head),m,i.from,i.to)||!Xk(r,m,i.from,i.to))return Jt.none}else if(!(e=m.sliceDoc(i.from,i.to).trim()))return Jt.none}s=[],a=ic(n.visibleRanges);try{for(a.s();!(f=a.n()).done;)for(h=f.value,c=new th(m.doc,e,h.from,h.to);!c.next().done;)if(v=(l=c.value).from,d=l.to,(!r||Qk(r,m,v,d))&&(i.empty&&v<=i.from&&d>=i.to?s.push(dh.range(v,d)):(v>=i.to||d<=i.from)&&s.push(vh.range(v,d)),s.length>y.maxMatches))return Jt.none}catch(t){a.e(t)}finally{a.f()}return Jt.set(s)}}]),t}(),{decorations:function t(n){return n.decorations}}),mh=Vi.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),ph=function t(n){var i=n.state,e=n.dispatch,r=i.selection,o=k.create(r.ranges.map((function(t){return i.wordAt(t.head)||k.cursor(t.head)})),r.mainIndex);return!o.eq(r)&&(e(i.update({selection:o})),!0)},kh=function t(n){var i,e,r=n.state,o=n.dispatch,u=r.selection.ranges;return u.some((function(t){return t.from===t.to}))?ph({state:r,dispatch:o}):(i=r.sliceDoc(u[0].from,u[0].to),!r.selection.ranges.some((function(t){return r.sliceDoc(t.from,t.to)!=i}))&&(!!(e=Zk(r,i))&&(o(r.update({selection:r.selection.addRange(k.range(e.from,e.to),!1),effects:Vi.scrollIntoView(e.to)})),!0)))},gh=w.define({combine:function t(n){return il(n,{top:!1,caseSensitive:!1,literal:!1,wholeWord:!1,createPanel:function t(n){return new Uh(n)},scrollToMatch:function t(n){return Vi.scrollIntoView(n)}})}}),wh=function(){function t(n){yc(this,t),this.search=n.search,this.caseSensitive=!!n.caseSensitive,this.literal=!!n.literal,this.regexp=!!n.regexp,this.replace=n.replace||"",this.valid=!!this.search&&(!this.regexp||qk(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!n.wholeWord}return pc(t,[{key:"unquote",value:function t(n){return this.literal?n:n.replace(/\\([nrt\\])/g,(function(t,n){return"n"==n?"\n":"r"==n?"\r":"t"==n?"\t":"\\"}))}},{key:"eq",value:function t(n){return this.search==n.search&&this.replace==n.replace&&this.caseSensitive==n.caseSensitive&&this.regexp==n.regexp&&this.wholeWord==n.wholeWord}},{key:"create",value:function t(){return this.regexp?new xh(this):new Mh(this)}},{key:"getCursor",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,e=arguments.length>2?arguments[2]:void 0,r=n.doc?n:Q.create({doc:n});return null==e&&(e=r.doc.length),this.regexp?ig(this,r,i,e):tg(this,r,i,e)}}]),t}(),Mh=function(t){sc(i,t);var n=fc(i);function i(t){return yc(this,i),n.call(this,t)}return pc(i,[{key:"nextMatch",value:function t(n,i,e){var r=tg(this.spec,n,e,n.doc.length).nextOverlapping();return r.done&&(r=tg(this.spec,n,0,i).nextOverlapping()),r.done?null:r.value}},{key:"prevMatchInRange",value:function t(n,i,e){var r,o,u,s;for(r=e;;){for(o=Math.max(i,r-1e4-this.spec.unquoted.length),u=tg(this.spec,n,o,r),s=null;!u.nextOverlapping().done;)s=u.value;if(s)return s;if(o==i)return null;r-=1e4}}},{key:"prevMatch",value:function t(n,i,e){return this.prevMatchInRange(n,0,i)||this.prevMatchInRange(n,e,n.doc.length)}},{key:"getReplacement",value:function t(n){return this.spec.unquote(this.spec.replace)}},{key:"matchAll",value:function t(n,i){for(var e=tg(this.spec,n,0,n.doc.length),r=[];!e.next().done;){if(r.length>=i)return null;r.push(e.value)}return r}},{key:"highlight",value:function t(n,i,e,r){for(var o=tg(this.spec,n,Math.max(0,i-this.spec.unquoted.length),Math.min(e+this.spec.unquoted.length,n.doc.length));!o.next().done;)r(o.value.from,o.value.to)}}]),i}(bh=pc((function t(n){yc(this,t),this.spec=n}))),xh=function(t){sc(i,t);var n=fc(i);function i(){return yc(this,i),n.apply(this,arguments)}return pc(i,[{key:"nextMatch",value:function t(n,i,e){var r=ig(this.spec,n,e,n.doc.length).next();return r.done&&(r=ig(this.spec,n,0,i).next()),r.done?null:r.value}},{key:"prevMatchInRange",value:function t(n,i,e){var r,o,u,s;for(r=1;;r++){for(o=Math.max(i,e-1e4*r),u=ig(this.spec,n,o,e),s=null;!u.next().done;)s=u.value;if(s&&(o==i||s.from>o+10))return s;if(o==i)return null}}},{key:"prevMatch",value:function t(n,i,e){return this.prevMatchInRange(n,0,i)||this.prevMatchInRange(n,e,n.doc.length)}},{key:"getReplacement",value:function t(n){return this.spec.unquote(this.spec.replace.replace(/\$([$&\d+])/g,(function(t,i){return"$"==i?"$":"&"==i?n.match[0]:"0"!=i&&+i<n.match.length?n.match[i]:t})))}},{key:"matchAll",value:function t(n,i){for(var e=ig(this.spec,n,0,n.doc.length),r=[];!e.next().done;){if(r.length>=i)return null;r.push(e.value)}return r}},{key:"highlight",value:function t(n,i,e,r){for(var o=ig(this.spec,n,Math.max(0,i-250),Math.min(e+250,n.doc.length));!o.next().done;)r(o.value.from,o.value.to)}}]),i}(bh),Sh=V.define(),Ch=V.define(),jh=x.define({create:function t(n){return new Ph(hg(n).create(),null)},update:function t(n,i){var e,r,o=ic(i.effects);try{for(o.s();!(e=o.n()).done;)(r=e.value).is(Sh)?n=new Ph(r.value.create(),n.panel):r.is(Ch)&&(n=new Ph(n.query,r.value?fg:null))}catch(t){o.e(t)}finally{o.f()}return n},provide:function t(n){return qe.from(n,(function(t){return t.panel}))}}),Ph=pc((function t(n,i){yc(this,t),this.query=n,this.panel=i})),Oh=Jt.mark({class:"cm-searchMatch"}),Eh=Jt.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Ah=pn.fromClass(function(){function t(n){yc(this,t),this.view=n,this.decorations=this.highlight(n.state.field(jh))}return pc(t,[{key:"update",value:function t(n){var i=n.state.field(jh);(i!=n.startState.field(jh)||n.docChanged||n.selectionSet||n.viewportChanged)&&(this.decorations=this.highlight(i))}},{key:"highlight",value:function t(n){var i,e,r,o,u,s,a,f,h=n.query,c=n.panel;if(!c||!h.spec.valid)return Jt.none;for(i=this.view,e=new nt,r=0,u=(o=i.visibleRanges).length;r<u;r++){for(a=(s=o[r]).from,f=s.to;r<u-1&&f>o[r+1].from-500;)f=o[++r].to;h.highlight(i.state,a,f,(function(t,n){var r=i.state.selection.ranges.some((function(i){return i.from==t&&i.to==n}));e.add(t,n,r?Eh:Oh)}))}return e.finish()}}]),t}(),{decorations:function t(n){return n.decorations}}),Dh=ag((function(t,n){var i,e,r=n.query,o=t.state.selection.main.to,u=r.nextMatch(t.state,o,o);return!!u&&(i=k.single(u.from,u.to),e=t.state.facet(gh),t.dispatch({selection:i,effects:[dg(t,u),e.scrollToMatch(i.main,t)],userEvent:"select.search"}),lg(t),!0)})),Rh=ag((function(t,n){var i,e,r=n.query,o=t.state,u=o.selection.main.from,s=r.prevMatch(o,u,u);return!!s&&(i=k.single(s.from,s.to),e=t.state.facet(gh),t.dispatch({selection:i,effects:[dg(t,s),e.scrollToMatch(i.main,t)],userEvent:"select.search"}),lg(t),!0)})),Ih=ag((function(t,n){var i=n.query,e=i.matchAll(t.state,1e3);return!(!e||!e.length)&&(t.dispatch({selection:k.create(e.map((function(t){return k.range(t.from,t.to)}))),userEvent:"select.search.matches"}),!0)})),Th=function t(n){var i,e,r,o,u,s,a=n.state,f=n.dispatch,h=a.selection;if(h.ranges.length>1||h.main.empty)return!1;for(e=(i=h.main).from,r=i.to,o=[],u=0,s=new th(a.doc,a.sliceDoc(e,r));!s.next().done;){if(o.length>1e3)return!1;s.value.from==e&&(u=o.length),o.push(k.range(s.value.from,s.value.to))}return f(a.update({selection:k.create(o,u),userEvent:"select.search.matches"})),!0},Lh=ag((function(t,n){var i,e,r,o,u,s,a=n.query,f=t.state,h=f.selection.main,c=h.from,l=h.to;return!f.readOnly&&(!!(i=a.nextMatch(f,c,c))&&(e=[],u=[],i.from==c&&i.to==l&&(o=f.toText(a.getReplacement(i)),e.push({from:i.from,to:i.to,insert:o}),i=a.nextMatch(f,i.from,i.to),u.push(Vi.announce.of(f.phrase("replaced match on line $",f.doc.lineAt(c).number)+"."))),i&&(s=0==e.length||e[0].from>=i.to?0:i.to-i.from-o.length,r=k.single(i.from-s,i.to-s),u.push(dg(t,i)),u.push(f.facet(gh).scrollToMatch(r.main,t))),t.dispatch({changes:e,selection:r,effects:u,userEvent:"input.replace"}),!0))})),Bh=ag((function(t,n){var i,e,r=n.query;return!t.state.readOnly&&(!!(i=r.matchAll(t.state,1e9).map((function(t){var n,i;return{from:t.from,to:t.to,insert:r.getReplacement(t)}}))).length&&(e=t.state.phrase("replaced $ matches",i.length)+".",t.dispatch({changes:i,effects:Vi.announce.of(e),userEvent:"input.replace.all"}),!0))})),Nh=[{key:"Mod-f",run:_h=function t(n){var i,e,r=n.state.field(jh,!1);return r&&r.panel?(i=cg(n))&&i!=n.root.activeElement&&((e=hg(n.state,r.query.spec)).valid&&n.dispatch({effects:Sh.of(e)}),i.focus(),i.select()):n.dispatch({effects:[Ch.of(!0),r?Sh.of(hg(n.state,r.query.spec)):V.appendConfig.of(Vh)]}),!0},scope:"editor search-panel"},{key:"F3",run:Dh,shift:Rh,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Dh,shift:Rh,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Fh=function t(n){var i,e=n.state.field(jh,!1);return!(!e||!e.panel)&&((i=Yd(n,fg))&&i.dom.contains(n.root.activeElement)&&n.focus(),n.dispatch({effects:Ch.of(!1)}),!0)},scope:"editor search-panel"},{key:"Mod-Shift-l",run:Th},{key:"Alt-g",run:fh},{key:"Mod-d",run:kh,preventDefault:!0}],Uh=function(){function t(n){var i,e=this;function r(t,n,i){return jk("button",{class:"cm-button",name:t,onclick:n,type:"button"},i)}yc(this,t),this.view=n,i=this.query=n.state.field(jh).query.spec,this.commit=this.commit.bind(this),this.searchField=jk("input",{value:i.search,placeholder:vg(n,"Find"),"aria-label":vg(n,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=jk("input",{value:i.replace,placeholder:vg(n,"Replace"),"aria-label":vg(n,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=jk("input",{type:"checkbox",name:"case",form:"",checked:i.caseSensitive,onchange:this.commit}),this.reField=jk("input",{type:"checkbox",name:"re",form:"",checked:i.regexp,onchange:this.commit}),this.wordField=jk("input",{type:"checkbox",name:"word",form:"",checked:i.wholeWord,onchange:this.commit}),this.dom=jk("div",{onkeydown:function t(n){return e.keydown(n)},class:"cm-search"},[this.searchField,r("next",(function(){return Dh(n)}),[vg(n,"next")]),r("prev",(function(){return Rh(n)}),[vg(n,"previous")]),r("select",(function(){return Ih(n)}),[vg(n,"all")]),jk("label",null,[this.caseField,vg(n,"match case")]),jk("label",null,[this.reField,vg(n,"regexp")]),jk("label",null,[this.wordField,vg(n,"by word")])].concat(Jh(n.state.readOnly?[]:[jk("br"),this.replaceField,r("replace",(function(){return Lh(n)}),[vg(n,"replace")]),r("replaceAll",(function(){return Bh(n)}),[vg(n,"replace all")])]),[jk("button",{name:"close",onclick:function t(){return Fh(n)},"aria-label":vg(n,"close"),type:"button"},["\xd7"])]))}return pc(t,[{key:"commit",value:function t(){var n=new wh({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});n.eq(this.query)||(this.query=n,this.view.dispatch({effects:Sh.of(n)}))}},{key:"keydown",value:function t(n){md(this.view,n,"search-panel")?n.preventDefault():13==n.keyCode&&n.target==this.searchField?(n.preventDefault(),(n.shiftKey?Rh:Dh)(this.view)):13==n.keyCode&&n.target==this.replaceField&&(n.preventDefault(),Lh(this.view))}},{key:"update",value:function t(n){var i,e,r,o,u,s=ic(n.transactions);try{for(s.s();!(i=s.n()).done;){r=ic((e=i.value).effects);try{for(r.s();!(o=r.n()).done;)(u=o.value).is(Sh)&&!u.value.eq(this.query)&&this.setQuery(u.value)}catch(t){r.e(t)}finally{r.f()}}}catch(t){s.e(t)}finally{s.f()}}},{key:"setQuery",value:function t(n){this.query=n,this.searchField.value=n.search,this.replaceField.value=n.replace,this.caseField.checked=n.caseSensitive,this.reField.checked=n.regexp,this.wordField.checked=n.wholeWord}},{key:"mount",value:function t(){this.searchField.select()}},{key:"pos",get:function t(){return 80}},{key:"top",get:function t(){return this.view.state.facet(gh).top}}]),t}(),Hh=30,zh=/[\s\.,:;?!]/,Wh=Vi.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),Vh=[jh,E.lowest(Ah),Wh],$h=n.Search=Object.freeze({__proto__:null,RegExpCursor:eh,SearchCursor:th,SearchQuery:wh,closeSearchPanel:Fh,findNext:Dh,findPrevious:Rh,getSearchQuery:ug,gotoLine:fh,highlightSelectionMatches:Kk,openSearchPanel:_h,replaceAll:Bh,replaceNext:Lh,search:Yk,searchKeymap:Nh,searchPanelOpen:sg,selectMatches:Ih,selectNextOccurrence:kh,selectSelectionMatches:Th,setSearchQuery:Sh}),qh=n.basicSetup=function(){return[sy(),fy(),Rd(),Np(),lm(),Cd(),Od(),Q.allowMultipleSelections.of(!0),Zy(),dm(Jo,{fallback:!0}),pm(),vp(),jp(),zd(),Wd(),Bd(),Kk(),Qi.of([].concat(ws,Jh(Sf),Nh,Xs,Bo,bs,_f))]}()},"./dist/plugins/formulaPanel/editor/common/calcUtil.js":function(t,n,i){var e,r,o,u,s;function a(t,n,i,e,r){var o,u,s,a,f;void 0===r&&(r=!0),o=i.culture,u=i.ignoreError,s=i.Wve,a=i.Jde,i.ignoreError=e,i.culture=!0,i.Wve=r,i.Jde=!0;try{f=n.parse(i,t)}catch(t){}return i.culture=o,i.ignoreError=u,i.Wve=s,i.Jde=a,f}function f(t,n,i){if(t){var e;try{e=n.unparse(i,t)}catch(t){}return e}}function h(t,n,i,r,u){var s,a,f,h=new e.Parser,c=!0;return n.Mf?s=(0,o.Vgt)(h,t,n.Mf,i,r,c):(h.setParserOption(c),u.ignoreError=!0,a=t.split(""),f=h.parseToTokens(u,a,!1),f=(0,o.fillBlankToTokens)(f,a),s=(0,o.getExpressTokenImp)(h,n,u,null,f,a,i,r)),U(s,n)}function c(){return{arrayListSeparator:e.Parser.arrayListSeparator||s.COMMA,arrayGroupSeparator:e.Parser.arrayGroupSeparator||s.SEMICOLON,listSeparator:e.Parser.listSeparator||s.COMMA,numberDecimalSeparator:e.Parser.numberDecimalSeparator||s.FULL_STOP}}function l(t,n){var i,e,r,o,u;for(t=t.filter((function(t){return t.endIndex<n})),i=[],e=[],r="",o=0;o<t.length;o++)w(u=t[o])?r=u.text:b(u)?(i.push(r),e.push(0)):M(u)&&(r="",i.pop(),e.pop()),i.length>0&&g(u)&&e[e.length-1]++;if(i.length>0)return{functionName:i.pop(),activeParameter:e.pop()}}function v(t,n){var i,e,r,o,u,s=n.parameters||[],a=s.length||0;for(r=0;r<s.length;r++)if(s[r].repeatable)void 0===i&&(i=r);else if(void 0!==i){e=r-1;break}return void 0!==i&&(void 0===e&&(e=s.length-1),t>=i&&(t=e+(u=(t-i)%(o=e-i+1))+1<a?e+u+1:i+u)),t}function d(t,n){t=v(t,n);var i=n.parameters?n.parameters.length:0;return Math.min(t,i-1)}function y(t,n,i,e){return void 0===i&&(i=!0),void 0===e&&(e=!1),t.find((function(t){return m(t,n,i,e)}))}function m(t,n,i,e){return void 0===i&&(i=!0),void 0===e&&(e=!1),(i?n>=t.index:n>t.index)&&(e?n<=t.endIndex+1:n<t.endIndex+1)}function p(t,n,i){return n<=t.index&&i>=t.endIndex+1}function k(t,n){var i,e,r,o,u,a,f,h,c;for(t=t.filter((function(t){return t.endIndex<n})),i=[],e=[],r=[],o=0;o<t.length;o++)w(u=t[o])?(i.push(u.text.toUpperCase()),e.push([]),r.push(0)):M(u)?(i.pop(),e.pop(),r.pop()):g(u)&&(a=(0,s.lastItem)(i),f=(0,s.lastItem)(r),h=(0,s.lastItem)(e),c=t[o-1],("LAMBDA"===a||"LET"===a&&f%2==0)&&I(c)&&h.push(c.text),r[r.length-1]=f+1);return e.filter((function(t){return t.length>0})).reduce((function(t,n){return t.concat(n)}),[])}function g(t){return t.type===u.TokenType.FunctionArgumentSeparator}function w(t){return t.type===u.TokenType.FunctionName}function b(t){return t.type===u.TokenType.FunctionCallStart}function M(t){return t.type===u.TokenType.FunctionCallEnd}function x(t){return t.type===u.TokenType.SubExpressionStart}function S(t){return t.type===u.TokenType.SubExpressionEnd}function C(t){return t.type===u.TokenType.FormulaStart}function j(t){return t.type===u.TokenType.Unknown}function P(t){return j(t)&&N(t.text)===s.LEFT_PARENTHESES}function O(t){return j(t)&&N(t.text)===s.RIGHT_PARENTHESES}function E(t){return I(t)||L(t)}function A(t){return t.type===u.TokenType.OperatorInfix}function D(t){return t.type===u.TokenType.OperatorPrefix}function R(t){return t.type===u.TokenType.Whitespace}function I(t){return t.type===u.TokenType.Name}function T(t){return t.type===u.TokenType.OperatorPostfix&&"#"===t.text}function L(t){return t.type===u.TokenType.CellReference}function B(t){return E(t)&&t.ranges&&t.ranges.length>0}function _(t){var n,i=0;for(n=0;n<t.length&&t[n]===s.WHITESPACE;n++)i++;return i}function F(t,n,i){var e,r,o,u,s,a;for(void 0===i&&(i=4),e=_(t),r=[],o=function(){return 0===r.length},u=function(){return r[r.length-1]},s=0;s<n.length;s++)b(a=n[s])||x(a)?r.push(a):M(a)?!o()&&b(u())&&r.pop():S(a)&&!o()&&x(u())&&r.pop();return r.length>0&&(e+=i),e}function N(t){return t.replace(/\s+/g,"")}function U(t,n){var i,e,r,o=[],a=[],f=c(),h=!1;for(i=0;i<t.length;i++)(r=H(e=t[i],h,f))===u.TokenType.ArrayConstStart?(a.push(r),h=!0):r===u.TokenType.FunctionCallStart?(a.push(r),h=!1):r!==u.TokenType.FunctionCallEnd&&r!==u.TokenType.ArrayConstEnd||(a.pop(),h=(0,s.lastItem)(a)===u.TokenType.ArrayConstStart),o.push({type:r,index:e.index,endIndex:e.endIndex,text:e.text,ranges:e.ranges,canDrag:e.canDrag,colorIndex:e.colorIndex});return z(W(o),n)}function H(t,n,i){var e=t.type,o=t.subType,a=t.text.trim();if(1===e){if(1===o)return"ARRAY"===a?u.TokenType.ArrayConstStart:"@"===a||a===s.LEFT_PARENTHESES?u.TokenType.FunctionCallStart:u.TokenType.FunctionName;if(2===o)return a===s.RIGHT_PARENTHESES?u.TokenType.FunctionCallEnd:n?u.TokenType.ArrayConstEnd:u.TokenType.FunctionCallEnd;if((0,r.Df)(a))return u.TokenType.FormulaStart}else if(3===e){if(0===o)return n&&a===i.arrayListSeparator?u.TokenType.ArrayConstItemSeparator:n&&a===i.arrayGroupSeparator?u.TokenType.ArrayConstRowSeparator:u.TokenType.FunctionArgumentSeparator}else{if(4===e)return u.TokenType.OperatorPrefix;if(5===e)return u.TokenType.OperatorInfix;if(6===e)return u.TokenType.OperatorPostfix;if(0===e)return 5===o?u.TokenType.LogicalConst:4===o?u.TokenType.NumberConst:3===o?u.TokenType.StringConst:6===o?u.TokenType.ErrorConst:7===o||12===o?t.isName?u.TokenType.Name:u.TokenType.CellReference:u.TokenType.StringConst;if(2!==e)return 7===e?u.TokenType.Whitespace:u.TokenType.Unknown;if(1===o)return u.TokenType.SubExpressionStart;if(2===o)return u.TokenType.SubExpressionEnd}}function z(t,n){var i,r,o,u;for(i=t.length-2;i>0;i--)r=t[i],T(o=t[i+1])&&L(r)&&B(r)&&(u=new e.CalcReference(n,r.ranges).getSpillRef())&&u.$gt&&(r.text+=o.text,r.endIndex=o.endIndex,r.ranges=u.$gt,t.splice(i+1,1));return t}function W(t){var n,i,e,r,o,u,s,a=[];for(n=0;n<t.length;n++)V((i=t[n]).type)&&(e=i.text.match(/^(\s*)(\S+)(\s*)$/))&&4===e.length?(r=e[0],o=e[1],u=e[2],s=e[3],o||s?(o&&(i.index+=o.length,i.text=i.text.substring(o.length),a.push($(i.index,o))),a.push(i),s&&(i.endIndex-=s.length,i.text=i.text.substring(0,u.length),a.push($(i.endIndex+1,s)))):a.push(i)):a.push(i);return a}function V(t){return t===u.TokenType.FunctionCallStart||t===u.TokenType.FunctionCallEnd||t===u.TokenType.ArrayConstStart||t===u.TokenType.ArrayConstEnd}function $(t,n){return{type:u.TokenType.Whitespace,index:t,endIndex:t+n.length-1,text:n}}function q(){return e.Functions.findGlobalFunctions()}Object.defineProperty(n,"__esModule",{value:!0}),n.getGlobalFunctions=n.removeWhiteSpace=n.getIndentByPreviousText=n.getLineIndent=n.hasReferenceRanges=n.isReferenceToken=n.isAnchorOperatorToken=n.isNameToken=n.isWhitespaceToken=n.isPrefixOperatorToken=n.isInfixOperatorToken=n.isReferenceOrNameToken=n.isRightParenthesesToken=n.isLeftParenthesesToken=n.isNothingOperandToken=n.isFormulaStartToken=n.isSubExpressionEndToken=n.isSubExpressionStartToken=n.isFunctionCallEndToken=n.isFunctionCallStartToken=n.isFunctionCallToken=n.isFunctionArgumentSeparator=n.getLocalSymbol=n.includeToken=n.isInToken=n.getTokenByPos=n.getActiveParameterInSignatureTip=n.getActiveParameterInParameterResources=n.getSignatureStatus=n.getCultureInfo=n.parseToTokens=n.unparse=n.parse=void 0,e=i("CalcEngine"),r=i("Core"),o=i("SheetsCalc"),u=i("./dist/plugins/formulaPanel/editor/interface.js"),s=i("./dist/plugins/formulaPanel/editor/common/util.js"),n.parse=a,n.unparse=f,n.parseToTokens=h,n.getCultureInfo=c,n.getSignatureStatus=l,n.getActiveParameterInParameterResources=v,n.getActiveParameterInSignatureTip=d,n.getTokenByPos=y,n.isInToken=m,n.includeToken=p,n.getLocalSymbol=k,n.isFunctionArgumentSeparator=g,n.isFunctionCallToken=w,n.isFunctionCallStartToken=b,n.isFunctionCallEndToken=M,n.isSubExpressionStartToken=x,n.isSubExpressionEndToken=S,n.isFormulaStartToken=C,n.isNothingOperandToken=j,n.isLeftParenthesesToken=P,n.isRightParenthesesToken=O,n.isReferenceOrNameToken=E,n.isInfixOperatorToken=A,n.isPrefixOperatorToken=D,n.isWhitespaceToken=R,n.isNameToken=I,n.isAnchorOperatorToken=T,n.isReferenceToken=L,n.hasReferenceRanges=B,n.getLineIndent=_,n.getIndentByPreviousText=F,n.removeWhiteSpace=N,n.getGlobalFunctions=q},"./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js":function(t,n,i){var e,r,o,u,s,a,f,h,c,l;function v(t){return t.field(u.tokenField)}function d(t){return t.doc.toJSON().join("\n")}function y(t){return t.field(u.providerField).getFunctions()}function m(t,n){return(0,s.findFunction)(y(t),n)}function p(t){return y(t).map(s.convertToFunctionResource)}function k(t,n){return(0,s.findFunctionResource)(p(t),n)}function g(t){return t.field(u.customNamesField)}function w(t,n){return n=n.toUpperCase(),g(t).find((function(t){return t.getName().toUpperCase()===n}))}function b(t){var n=t.field(u.themeField),i=n.rules.find((function(t){return t.token===o.SyntaxHighlightingTokenType.reference})),e=i?i.color:"black";return Array.isArray(e)?e:[e]}function M(t,n,i){return t.find((function(t){return(0,a.isInToken)(t,n,!0,!0)&&x(t,i)}))}function x(t,n){var i=j(t.text,n);return i&&i.type===r.ExpressionType.reference}function S(t){var n=t.field(u.calcServiceField),i=t.field(u.calcSourceField),e=t.field(u.activeCellField),r=n.getParserContext(i);return r.row=e.row,r.column=e.col,r}function C(t,n){var i,e,r,o;return t.field(u.isFormulaField)?(i=t.field(u.calcSourceField),r=(e=t.field(u.activeCellField)).row,o=e.col,(0,a.parseToTokens)(n,i,r,o,S(t))):[]}function j(t,n,i){void 0===i&&(i=!1);var e=S(n);return(0,a.parse)(t,new r.Parser,e,!i)}function P(t,n){var i=S(n);return(0,a.unparse)(t,new r.Parser,i)}function O(t){return t.field(u.optionsField)}function E(t){var n=O(t);return l(n.tabSize)?c.DEFAULT_TAB_SIZE:n.tabSize}function A(t){var n=O(t);return l(n.formatWidthLimit)?c.DEFAULT_FORMAT_WIDTH_LIMIT:n.formatWidthLimit}function D(t){return s.WHITESPACE.repeat(E(t))}function R(t){var n=t.field(u.calcSourceField).Mf;if(n)return(0,f.Kde)(n.parent)||n}function I(t){return t.selection.main}function T(t){return t.field(u.providerField).getStructReferences()}function L(t,n,i){var e,o,u,s;return n===i||!(!(0,h.kf)(n)||!(0,h.kf)(i))&&(e=new r.Parser,o=S(t),u=(0,a.unparse)((0,a.parse)(n,e,o,!1,!1),e,o),s=(0,a.unparse)((0,a.parse)(i,e,o,!1,!1),e,o),!(!u||!s)&&u===s)}Object.defineProperty(n,"__esModule",{value:!0}),n.isSameFormula=n.getStructReferencesByState=n.getSelection=n.getActiveSheetByState=n.getOneIndentSpaceByState=n.getFormatWidthLimitByState=n.getTabSizeByState=n.getOptionsByState=n.unparseToText=n.parseToExpressionTree=n.parseToTokens=n.getParseContextByState=n.isValidReferenceToken=n.getValidReferenceTokenByPos=n.getReferenceTokenColors=n.getCustomNameByState=n.getCustomNamesByState=n.getFunctionResourceByState=n.getFunctionResourcesByState=n.getFunctionByState=n.getFunctionsByState=n.getTextByState=n.getTokensByState=void 0,e=i("Common"),r=i("CalcEngine"),o=i("./dist/plugins/formulaPanel/editor/interface.js"),u=i("./dist/plugins/formulaPanel/editor/featureProvider/customField.js"),s=i("./dist/plugins/formulaPanel/editor/common/util.js"),a=i("./dist/plugins/formulaPanel/editor/common/calcUtil.js"),f=i("./dist/plugins/formulaPanel/editor/common/spreadUtil.js"),h=i("Core"),c=i("./dist/plugins/formulaPanel/editor/common/const.js"),l=e.Common.lt.ht,n.getTokensByState=v,n.getTextByState=d,n.getFunctionsByState=y,n.getFunctionByState=m,n.getFunctionResourcesByState=p,n.getFunctionResourceByState=k,n.getCustomNamesByState=g,n.getCustomNameByState=w,n.getReferenceTokenColors=b,n.getValidReferenceTokenByPos=M,n.isValidReferenceToken=x,n.getParseContextByState=S,n.parseToTokens=C,n.parseToExpressionTree=j,n.unparseToText=P,n.getOptionsByState=O,n.getTabSizeByState=E,n.getFormatWidthLimitByState=A,n.getOneIndentSpaceByState=D,n.getActiveSheetByState=R,n.getSelection=I,n.getStructReferencesByState=T,n.isSameFormula=L},"./dist/plugins/formulaPanel/editor/common/const.js":function(t,n,i){var e,r,o,u;function s(){var t=new e.CalcService;return t.addResolver(new r.SheetReferenceResolver),t.addResolver(new r.StructureReferenceResolver),t}Object.defineProperty(n,"__esModule",{value:!0}),n.defaultTheme=n.defaultSyntaxHighlighRules=n.DEFAULT_ACTIVE_CELL_INFO=n.DEFAULT_FORMULA_EDITOR_OPTIONS=n.defaultCalcSource=n.defaultCalcService=n.DEFAULT_PROVIDER=n.DEFAULT_FORMAT_WIDTH_LIMIT=n.DEFAULT_TAB_SIZE=void 0,e=i("CalcEngine"),r=i("SheetsCalc"),o=i("./dist/plugins/formulaPanel/editor/interface.js"),u=i("./dist/plugins/formulaPanel/editor/common/calcUtil.js"),n.DEFAULT_TAB_SIZE=4,n.DEFAULT_FORMAT_WIDTH_LIMIT="auto",n.DEFAULT_PROVIDER={getStructReferences:function(){return[]},getFunctions:u.getGlobalFunctions},n.defaultCalcService=s(),n.defaultCalcSource=new e.CalcSource(n.defaultCalcService),n.DEFAULT_FORMULA_EDITOR_OPTIONS={formatWidthLimit:n.DEFAULT_FORMAT_WIDTH_LIMIT,tabSize:n.DEFAULT_TAB_SIZE},n.DEFAULT_ACTIVE_CELL_INFO={row:0,col:0},n.defaultSyntaxHighlighRules=[{token:o.SyntaxHighlightingTokenType.stringConst,color:"#CC1C1C"},{token:o.SyntaxHighlightingTokenType.errorConst,color:"#CC1C1C"},{token:o.SyntaxHighlightingTokenType.numberConst,color:"#088000"},{token:o.SyntaxHighlightingTokenType.booleanConst,color:"#088000"},{token:o.SyntaxHighlightingTokenType.function,color:"#1C1CFF"},{token:o.SyntaxHighlightingTokenType.argumentSeparator,color:"#FF0000"},{token:o.SyntaxHighlightingTokenType.operatorPrefix,color:"#FF0000"},{token:o.SyntaxHighlightingTokenType.operatorInfix,color:"#FF0000"},{token:o.SyntaxHighlightingTokenType.operatorPostfix,color:"#FF0000"},{token:o.SyntaxHighlightingTokenType.reference,color:["#0000ff","#008000","#9900cc","#800000","#00cc33","#cc6600","#cc0099"]}],n.defaultTheme={rules:n.defaultSyntaxHighlighRules}},"./dist/plugins/formulaPanel/editor/common/formatter.js":function(t,n,i){var e,r,o,u,s,a=this&&this.nJr||function(){return a=Object.assign||function(t){var n,i,e,r;for(i=1,e=arguments.length;i<e;i++)for(r in n=arguments[i])Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t},a.apply(this,arguments)};function f(t,n){var i,u=new e.Parser,s=n.parseContext,f=(0,r.parse)(t,u,s,!1,!1);if(f)return i=a(a({parser:u,oneIndentTab:o.WHITESPACE.repeat(n.tabSize)},n),(0,r.getCultureInfo)()),o.EQUAL+h(f,0,i,o.EQUAL)}function h(t,n,i,r,o,u){var s,a,f;return void 0===r&&(r=""),void 0===o&&(o=""),void 0===u&&(u=!0),t?(s=c(t,i),S(a=x(n,i,u)+s,i,r,o)&&((f=t.type)===e.ExpressionType.operator?a=l(t,n,i,r,o,u):f===e.ExpressionType.function?a=m(t,n,i,r,o,u):f===e.ExpressionType.parentheses?a=w(t,n,i,u):f===e.ExpressionType.array&&(a=k(t,n,i,u))),a):""}function c(t,n){var i,r;return t?r=(i=t.type)===e.ExpressionType.operator?v(t,n):i===e.ExpressionType.function?p(t,n):i===e.ExpressionType.parentheses?o.LEFT_PARENTHESES+c(t.value,n)+o.RIGHT_PARENTHESES:i===e.ExpressionType.array?g(t,n):b(t,n):""}function l(t,n,i,e,r,u){var a,f,l,v,y=t.operatorType,m=E(y);return P(y)?a=x(n,i,u)+m+h(t.value,n,i,e,r,!1):O(y)?a=h(t.value,n,i,e,m+r,u)+m:18===y?a=d(t,n,i,u):A(y)?(l=e+(f=h(t.value,n,i,e,o.WHITESPACE+m+s+r))+o.WHITESPACE+m,S(v=c(t.value2,i),i,l+o.WHITESPACE,r)?(v=h(t.value2,n+1,i,l+s,r),a=f+o.WHITESPACE+m+s+v):a=f+o.WHITESPACE+m+o.WHITESPACE+v):a=(f=h(t.value,n,i,e,r))+m+(v=h(t.value2,n,i,e+f+m,r,!1)),a}function v(t,n){var i,e,r,u=t.operatorType,s=E(u);return P(u)?i=s+c(t.value,n):O(u)?i=c(t.value,n)+s:(e=c(t.value,n),r=c(t.value2,n),i=18===u?y(t,n):A(u)?e+o.WHITESPACE+s+o.WHITESPACE+r:e+s+r),i}function d(t,n,i,e){return x(n,i,e)+b(t,i)}function y(t,n){return b(t,n)}function m(t,n,i,r,a,f){var c,l,v,d,y,m=x(n,i,f),p=(0,e.isFunction)(t.function)&&t.function.name||t.functionName;if(p===u)return h(t.arguments[0],n,i,r,"#"+a,f)+"#";if("@"===p)return m+"@"+h(t.arguments[0],n,i,r+m+"@",a,!1);if(c=!p&&t.function instanceof e.Expression?h(t.function,n,i,r,a,f)+o.LEFT_PARENTHESES:m+p+o.LEFT_PARENTHESES,0===(v=(l=t.arguments||[]).length))return c+o.RIGHT_PARENTHESES;for(c+=s,d=0;d<v;d++)c+=h(y=l[d],n+1,i),d!==v-1&&(c+=i.listSeparator),c+=s;return c+x(n,i)+o.RIGHT_PARENTHESES}function p(t,n){var i,r,s,a,f,h=(0,e.isFunction)(t.function)&&t.function.name||t.functionName;if(h===u)return c(t.arguments[0],n)+"#";if("@"===h)return"@"+c(t.arguments[0],n);for(i=!h&&t.function instanceof e.Expression?c(t.function,n)+o.LEFT_PARENTHESES:D(h)+o.LEFT_PARENTHESES,s=(r=t.arguments||[]).length,a=0;a<s;a++)i+=c(f=r[a],n),a!==s-1&&(i+=n.listSeparator+o.WHITESPACE);return i+o.RIGHT_PARENTHESES}function k(t,n,i,e){var r,u,a=t.value,f=a.getRowCount(),h=a.getColumnCount(),c=x(n,i,e),l=x(n+1,i),v=c+o.LEFT_CURLY_BRACKETS+s;for(r=0;r<f;r++){for(v+=l,u=0;u<h;u++)v+=M(a.getValue(r,u),i),u!==h-1&&(v+=i.arrayListSeparator+o.WHITESPACE);r!==f-1&&(v+=i.arrayGroupSeparator),v+=s}return v+x(n,i)+o.RIGHT_CURLY_BRACKETS}function g(t,n){var i,e,r=t.value,u=r.getRowCount(),s=r.getColumnCount(),a=o.LEFT_CURLY_BRACKETS;for(i=0;i<u;i++){for(e=0;e<s;e++)a+=M(r.getValue(i,e),n),e!==s-1&&(a+=n.arrayListSeparator+o.WHITESPACE);i!==u-1&&(a+=n.arrayGroupSeparator+o.WHITESPACE)}return a+o.RIGHT_CURLY_BRACKETS}function w(t,n,i,e){var r=h(t.value,n+1,i),u=x(n,i,e);return u+o.LEFT_PARENTHESES+s+r+s+x(n,i)+o.RIGHT_PARENTHESES}function b(t,n){var i=[];return n.parser.unparse(n.parseContext,t,i),i.join("")}function M(t,n){var i,r;return"string"==typeof t?i=e.ExpressionType.string:"boolean"==typeof t?i=e.ExpressionType.boolean:"number"==typeof t&&(i=e.ExpressionType.number),void 0===i?t.toString():((r=new e.Expression(i)).value=t,b(r,n))}function x(t,n,i){return void 0===i&&(i=!0),i?n.oneIndentTab.repeat(t):""}function S(t,n,i,e){if(t.trim().length>n.widthLimit)return!0;var r=C(i)+t+j(e);return n.measureTextFunc(r)>n.lineWidthLimit}function C(t){var n=t.lastIndexOf(s);return-1===n?t:t.substring(n+1)}function j(t){var n=t.indexOf(s);return-1===n?t:t.substring(0,n)}function P(t){return 0===t||1===t}function O(t){return 2===t}function E(t){return e.Z9t[t]}function A(t){return!(15===t||16===t||17===t||18===t)}function D(t){var n=(0,e.getMapping)()&&(0,e.getMapping)().builtInFunctionsMapping,i=n&&n[t];return i&&i.alias&&(t=i.alias),t}Object.defineProperty(n,"__esModule",{value:!0}),n.format=void 0,e=i("CalcEngine"),r=i("./dist/plugins/formulaPanel/editor/common/calcUtil.js"),o=i("./dist/plugins/formulaPanel/editor/common/util.js"),u="ANCHORARRAY",s="\n",n.format=f},"./dist/plugins/formulaPanel/editor/common/spreadUtil.js":function(t,n,i){var e,r;function o(t){if(t)return(0,e.jf)(t)}function u(t){var n,i=(0,r.getGlobalFunctions)(),e=function(t){Object.keys(t).forEach((function(n){i.push(t[n])}))};return t&&(e(t.Amt),(n=o(t))&&e(n.Amt),t.options.allowDynamicArray||(i=i.filter((function(t){return!t.isDynamicArrayFunction})))),i}Object.defineProperty(n,"__esModule",{value:!0}),n.getFunctionsByWorkbook=n.Kde=void 0,e=i("Core"),r=i("./dist/plugins/formulaPanel/editor/common/calcUtil.js"),n.Kde=o,n.getFunctionsByWorkbook=u},"./dist/plugins/formulaPanel/editor/common/util.js":function(t,n,i){var e,r,o,u,s=this&&this.nJr||function(){return s=Object.assign||function(t){var n,i,e,r;for(i=1,e=arguments.length;i<e;i++)for(r in n=arguments[i])Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t},s.apply(this,arguments)};function a(t){var n=t.description();return n&&(n=f(n)),{name:t.name,description:null==n?void 0:n.description,parameters:null==n?void 0:n.parameters}}function f(t){var n,i,e,r=[],o=t.parameters||[];for(n=0;n<o.length;n++)(e=(i=s({},o[n])).name.length>2&&i.name.startsWith("[")&&i.name.endsWith("]"))&&(i.optional=!0,i.name=i.name.substring(1,i.name.length-1)),i.repeatable&&(i.optional=!0),r.push(i);return s(s({},t),{parameters:r})}function h(t,n){return n=n.toUpperCase(),(t||[]).find((function(t){return t.name.toUpperCase()===n}))}function c(t,n){return n=n.toUpperCase(),(t||[]).find((function(t){return t.name.toUpperCase()===n}))}function l(t){return t&&0!==t.length?t.map(v).join(", "):""}function v(t){var n=t.name;return t.optional&&(n="["+n+"]"),t.repeatable&&(n="..."+n),n}function d(t){var n=t.name;return t.repeatable&&(n+=", ..."),t.optional&&(n="["+n+"]"),n}function y(t){return"".concat(t.name,"(").concat(l(t.parameters),")")}function m(t){return"(".concat(u().FORMULA," ").concat(y(t))}function p(t){return t[t.length-1]}function k(t){return"gc-formula-editor-tooltip-help-function-"+t}function g(t,n){var i,e,r,o,u,s=document.createElement("p");for(s.className=k("title"),i=function(t,n){var i=document.createElement("span");return i.className=n,i.textContent=t,s.appendChild(i),i},e=function(t){return k("title-"+t)},i(t.name,e("function-name")),i("(",e("parentheses")),r=t.parameters||[],o=0;o<r.length;o++)u=e("parameter"),void 0!==n&&n===o&&(u+=" "+e("active-parameter")),i(d(r[o]),u),o!==r.length-1&&i(",",e("parameter-separator"));return i(")",e("parentheses")),s}function w(t){var n=document.createElement("p");return n.textContent=t,n.className=k("description"),n}Object.defineProperty(n,"__esModule",{value:!0}),n.createHelpFunctionDescriptionDom=n.createHelpFunctionTitleDom=n.lastItem=n.getFunctionHoverTitle=n.getFunctionSignatureString=n.getParameterString=n.getParameterListString=n.findFunctionResource=n.findFunction=n.normalizeFunctionDescription=n.convertToFunctionResource=n.END_OF_LINE=n.WHITESPACE=n.RIGHT_CURLY_BRACKETS=n.LEFT_CURLY_BRACKETS=n.RIGHT_PARENTHESES=n.LEFT_PARENTHESES=n.SEMICOLON=n.COMMA=n.FULL_STOP=n.EQUAL=void 0,e=i("Common"),r=i("./dist/plugins/formulaPanel/editor/editor.ns.js"),o=new e.Common.ResourceManager(r.SR,"formulaEditor"),u=o.getResource.bind(o),n.EQUAL="=",n.FULL_STOP=".",n.COMMA=",",n.SEMICOLON=";",n.LEFT_PARENTHESES="(",n.RIGHT_PARENTHESES=")",n.LEFT_CURLY_BRACKETS="{",n.RIGHT_CURLY_BRACKETS="}",n.WHITESPACE=" ",n.END_OF_LINE="\r\n",n.convertToFunctionResource=a,n.normalizeFunctionDescription=f,n.findFunction=h,n.findFunctionResource=c,n.getParameterListString=l,n.getParameterString=v,n.getFunctionSignatureString=y,n.getFunctionHoverTitle=m,n.lastItem=p,n.createHelpFunctionTitleDom=g,n.createHelpFunctionDescriptionDom=w},"./dist/plugins/formulaPanel/editor/editor.ns.js":function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.SR=void 0;var e=i("./dist/plugins/formulaPanel/editor/editor.res.en.js");n.SR={en:e}},"./dist/plugins/formulaPanel/editor/editor.res.en.js":function(t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.FORMULA=n.INVALID_FORMULA=n.INVALID_EXPRESSION=n.DUPLICATE_IDENTIFIER=n.INVALID_IDENTIFIER_ARGUMENT=n.NO_MATCHED_ARGUMENTS=n.UNKNOWN_SHEET=n.UNKNOWN_NAME=n.MISS_LET_FUNCTION_BODY=n.MISS_RIGHT_PARENTHESES=n.NO_MATH_PARENTHESES=void 0,n.NO_MATH_PARENTHESES="No match parentheses",n.MISS_RIGHT_PARENTHESES="')' is expected.",n.MISS_LET_FUNCTION_BODY="Missing body of LET expression.",n.UNKNOWN_NAME="Unknown name",n.UNKNOWN_SHEET='Unknown sheet "$1"',n.NO_MATCHED_ARGUMENTS="Expected $1 arguments, but got $2",n.INVALID_IDENTIFIER_ARGUMENT="This argument must be an identifier to bind.",n.DUPLICATE_IDENTIFIER="Duplicate identifier $1",n.INVALID_EXPRESSION="Invalid EXPRESSION",n.INVALID_FORMULA="Invalid Formula",n.FORMULA="Formula"},"./dist/plugins/formulaPanel/editor/featureProvider/completion.js":function(t,n,i){var e,r,o,u,s,a,f,h=this&&this.nJr||function(){return h=Object.assign||function(t){var n,i,e,r;for(i=1,e=arguments.length;i<e;i++)for(r in n=arguments[i])Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t},h.apply(this,arguments)};function c(t,n){var i,e,u,s=(0,r.getSignatureStatus)((0,o.getTokensByState)(n.state),n.pos);s&&(i=(0,o.getFunctionResourceByState)(n.state,s.functionName))&&(e=(0,r.getActiveParameterInSignatureTip)(s.activeParameter,i),(u=i.parameters&&i.parameters[e])&&u.enum&&u.enum.forEach((function(n){t.push({label:n.value,detail:n.description,type:"enum",apply:n.value})})))}function l(t,n){var i=n.state,e=n.pos,u=(0,r.getLocalSymbol)((0,o.getTokensByState)(i),e);u.forEach((function(n){t.push({label:n,type:"variable",apply:n})}))}function v(t,n){var i;(0,o.getCustomNamesByState)(n.state).forEach((function(n){t.push({label:n.getName(),detail:n.getComment()||"",type:"constant",apply:n.getName()})}))}function d(t,n){var i;(0,o.getFunctionResourcesByState)(n.state).forEach((function(n){n.description&&t.push({label:n.name,detail:n.description,type:"function",apply:y})}))}function y(t,n,i,r){var o=t.state,s=o.selection.main,a=i-s.from,f=r-s.from,c=n.label,l=o.changeByRange((function(t){var n=t.from+a,u=t.from+f;return t!==s&&i!==r&&o.sliceDoc(n,u)!==o.sliceDoc(i,r)?{range:t}:{changes:{from:n,to:r===s.from?t.to:u,insert:c+"()"},range:e.State.EditorSelection.cursor(n+c.length+1)}}));t.dispatch(h(h({},l),{userEvent:"input.complete",effects:u.triggerSignatureTooltip.of(null)}))}function m(t){return(0,o.getStructReferencesByState)(t.state).map(k)}function p(t,n){var i,e,r=t.selection.main.head,u=n.text.substring(0,r-n.index);return u&&"["===u[u.length-1]?(i=u.substring(0,u.length-1),(e=(0,o.getStructReferencesByState)(t).find((function(t){return t.name===i})))?e.getColumns().map(k):[]):[]}function k(t){return{label:t.name,detail:t.description,type:"variable"}}function g(t){var n=t.state.selection.main.head,i=(0,o.getTokensByState)(t.state);return(0,r.getTokenByPos)(i,n,!1,!0)}function w(t){var n,i,e,r=t.state.field(s.isFormulaField);return r?(n=g(t))&&n.type===a.TokenType.StringConst?null:(i=t.matchBefore(/[\w.]*/),(e=[]).push.apply(e,p(t.state,n)),c(e,t),i&&i.from===i.to||(l(e,t),d(e,t),v(e,t),e.push.apply(e,m(t))),{from:i?i.from:t.pos,options:e}):null}Object.defineProperty(n,"__esModule",{value:!0}),n.autoCompletionExtensions=void 0,e=i("./dist/plugins/formulaPanel/editor/codemirror/index.js"),r=i("./dist/plugins/formulaPanel/editor/common/calcUtil.js"),o=i("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),u=i("./dist/plugins/formulaPanel/editor/featureProvider/signatureTooltips.js"),s=i("./dist/plugins/formulaPanel/editor/featureProvider/customField.js"),a=i("./dist/plugins/formulaPanel/editor/interface.js"),f=e.Autocomplete.autocompletion,n.autoCompletionExtensions=f({override:[w]})},"./dist/plugins/formulaPanel/editor/featureProvider/customField.js":function(t,n,i){var e,r,o,u,s,a,f;function h(t,n){return a.define({create:t,update:function(t,i){var e,r,o;for(e=0,r=i.effects;e<r.length;e++)if((o=r[e]).is(n))return o.value;return t}})}function c(t){return!!t.docChanged||t.effects.some((function(t){return t.is(n.setCalcServiceField)||t.is(n.setCalcSourceField)||t.is(n.setCustomNamesField)||t.is(n.setProviderField)||t.is(n.setActiveCellField)||t.is(n.rebuildFormulaEffect)}))}Object.defineProperty(n,"__esModule",{value:!0}),n.needRebuildToken=n.customFields=n.isFormattedFormulaField=n.isFormulaField=n.themeField=n.setThemeField=n.optionsField=n.setOptionsField=n.tokenField=n.rebuildFormulaEffect=n.providerField=n.setProviderField=n.customNamesField=n.setCustomNamesField=n.activeCellField=n.setActiveCellField=n.calcSourceField=n.setCalcSourceField=n.calcServiceField=n.setCalcServiceField=void 0,e=i("Core"),r=i("./dist/plugins/formulaPanel/editor/codemirror/index.js"),o=i("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),u=i("./dist/plugins/formulaPanel/editor/common/const.js"),s=i("./dist/plugins/formulaPanel/editor/featureProvider/formatter.js"),a=r.State.StateField,f=r.State.StateEffect,n.setCalcServiceField=f.define(),n.calcServiceField=h((function(){return u.defaultCalcService}),n.setCalcServiceField),n.setCalcSourceField=f.define(),n.calcSourceField=h((function(){return u.defaultCalcSource}),n.setCalcSourceField),n.setActiveCellField=f.define(),n.activeCellField=h((function(){return u.DEFAULT_ACTIVE_CELL_INFO}),n.setActiveCellField),n.setCustomNamesField=f.define(),n.customNamesField=h((function(){return[]}),n.setCustomNamesField),n.setProviderField=f.define(),n.providerField=h((function(){return u.DEFAULT_PROVIDER}),n.setProviderField),n.rebuildFormulaEffect=f.define(),n.tokenField=a.define({create:function(t){return(0,o.parseToTokens)(t,(0,o.getTextByState)(t))},update:function(t,n){return c(n)?(0,o.parseToTokens)(n.state,(0,o.getTextByState)(n.state)):t}}),n.setOptionsField=f.define(),n.optionsField=h((function(){return u.DEFAULT_FORMULA_EDITOR_OPTIONS}),n.setOptionsField),n.setThemeField=f.define(),n.themeField=h((function(){return u.defaultTheme}),n.setThemeField),n.isFormulaField=a.define({create:function(t){return(0,e.kf)((0,o.getTextByState)(t))},update:function(t,n){return n.docChanged?(0,e.kf)((0,o.getTextByState)(n.state)):t}}),n.isFormattedFormulaField=a.define({create:function(){return!0},update:function(t,n){return n.docChanged?!!n.annotation(s.formatDocumentAnnotation):t}}),n.customFields=[n.optionsField,n.themeField,n.isFormulaField,n.isFormattedFormulaField,n.activeCellField,n.calcServiceField,n.calcSourceField,n.customNamesField,n.providerField,n.tokenField],n.needRebuildToken=c},"./dist/plugins/formulaPanel/editor/featureProvider/dbClickRangeSelector.js":function(t,n,i){var e,r,o,u,s;Object.defineProperty(n,"__esModule",{value:!0}),n.doubleClickSelectRangeExtension=void 0,e=i("./dist/plugins/formulaPanel/editor/codemirror/index.js"),r=i("./dist/plugins/formulaPanel/editor/common/calcUtil.js"),o=i("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),u=i("./dist/plugins/formulaPanel/editor/featureProvider/customField.js"),s=e.State.EditorSelection,n.doubleClickSelectRangeExtension=e.View.EditorView.mouseSelectionStyle.of((function(t,n){var i,e,a=t.state.field(u.isFormulaField);return a?2!==n.detail||0!==n.button||null===(i=t.posAtCoords(n))?null:(e=t.state.selection,{get:function(n,i,u){var a,f,h=t.posAtCoords(n);return null===h?e:(a=(0,r.getTokenByPos)((0,o.getTokensByState)(t.state),h))?(f=s.range(a.index,a.endIndex+1),u?e.addRange(f):s.create([f])):e},update:function(t){i=t.changes.mapPos(i),e=e.map(t.changes)}}):null}))},"./dist/plugins/formulaPanel/editor/featureProvider/folding.js":function(t,n,i){var e,r;Object.defineProperty(n,"__esModule",{value:!0}),n.foldExtension=void 0,e=i("./dist/plugins/formulaPanel/editor/codemirror/index.js"),r=i("./dist/plugins/formulaPanel/editor/common/calcUtil.js"),n.foldExtension=e.Language.foldService.of((function(t,n,i){var e,o,u,s=t.doc.lineAt(n),a=t.doc.lines,f=(0,r.getLineIndent)(s.text),h=n,c=i;for(e=s.number+1;e<a&&(o=t.doc.line(e),(u=(0,r.getLineIndent)(o.text))>f);e++)c=o.to;return t.doc.lineAt(h).number===t.doc.lineAt(c).number?null:{from:h=s.to,to:c}}))},"./dist/plugins/formulaPanel/editor/featureProvider/formatter.js":function(t,n,i){var e,r,o,u,s,a,f;function h(t,n,i,e){var r=c(t),o=c(n),u=n.length,s=function(t,n){var i,e;for(t-=r[t],i=0;i<o.length;i++){if((e=i-o[i])===t&&!n){t=i;break}if(e>t){t=i-1;break}}return t<=u&&t>=0?t:0};return i===e?i=e=s(e,!1):(i=s(i,!0),e=s(e,!1)),[i,e]}function c(t){var n,i,e=function(t){return" "===t||"\n"===t},r=[0];for(n=1;n<=t.length;n++)i=r[n-1],r.push(i+(e(t[n-1])?1:0));return r}function l(t){var n,i=t.scrollDOM.getBoundingClientRect(),e=t.contentDOM.getBoundingClientRect(),r=v(i,e),o=t.contentDOM.querySelector(".cm-line");return o&&(n=window.getComputedStyle(o),r-=parseInt(n.paddingLeft,10)+parseInt(n.paddingRight,10)),r}function v(t,n){var i=Math.max(t.left,n.left),e=Math.min(t.right,n.right),r=e-i;return r>=0?r:0}function d(t){var n=window.getComputedStyle(t.contentDOM),i=n.font,e=document.createElement("canvas"),r=e.getContext("2d");return r.font=i,function(t){return r.measureText(t).width}}Object.defineProperty(n,"__esModule",{value:!0}),n.formatDocumentCommand=n.formatDocumentAnnotation=void 0,e=i("./dist/plugins/formulaPanel/editor/codemirror/index.js"),r=i("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),o=i("./dist/plugins/formulaPanel/editor/common/formatter.js"),u=i("./dist/plugins/formulaPanel/editor/featureProvider/customField.js"),s=i("./dist/plugins/formulaPanel/editor/featureProvider/signatureTooltips.js"),a=Number.MAX_SAFE_INTEGER,n.formatDocumentAnnotation=e.State.Annotation.define(),f=function(t){var i,e,f,c,v,y,m,p,k,g,w=t.state.field(u.isFormulaField);return!!w&&(i=(0,r.getTabSizeByState)(t.state),e=(0,r.getFormatWidthLimitByState)(t.state),f=a,c=function(t){return 0},"auto"===e&&(f=l(t),e=a,c=d(t)),v=t.state.selection.main,m={absoluteReference:!1,parseContext:y=(0,r.getParseContextByState)(t.state),tabSize:i,widthLimit:e,lineWidthLimit:f,measureTextFunc:c},p=(0,r.getTextByState)(t.state),void 0!==(k=(0,o.format)(p,m))&&(p===k||(g=h(p,k,v.from,v.to),t.dispatch({changes:{from:0,to:t.state.doc.length,insert:k},selection:{anchor:g[0],head:g[1]},annotations:[s.notTriggerSignatureTooltip.of(!0),n.formatDocumentAnnotation.of(!0)]})),!0))},n.formatDocumentCommand=f},"./dist/plugins/formulaPanel/editor/featureProvider/hoverTooltips.js":function(t,n,i){var e,r,o,u,s;Object.defineProperty(n,"__esModule",{value:!0}),n.hoverTooltipExtension=void 0,e=i("./dist/plugins/formulaPanel/editor/codemirror/index.js"),r=i("./dist/plugins/formulaPanel/editor/common/calcUtil.js"),o=i("./dist/plugins/formulaPanel/editor/common/util.js"),u=i("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),s=i("./dist/plugins/formulaPanel/editor/featureProvider/customField.js"),n.hoverTooltipExtension=e.View.hoverTooltip((function(t,n){var i,e,a,f,h=t.state.field(s.isFormulaField);return h?(i=(0,u.getTokensByState)(t.state),(e=(0,r.getTokenByPos)(i,n))?(a=[],f=(0,u.getFunctionResourceByState)(t.state,e.text),(0,r.isFunctionCallToken)(e)&&f&&(a.push((0,o.getFunctionHoverTitle)(f)),f.description&&a.push(f.description)),0===a.length?null:{pos:e.index,end:e.endIndex+1,above:!0,create:function(){var t=document.createElement("div");return t.className="gc-formula-editor-tooltip-help-function",t.appendChild((0,o.createHelpFunctionTitleDom)(f)),f.description&&t.appendChild((0,o.createHelpFunctionDescriptionDom)(f.description)),{dom:t}}}):null):null}))},"./dist/plugins/formulaPanel/editor/featureProvider/indent.js":function(t,n,i){var e,r,o;Object.defineProperty(n,"__esModule",{value:!0}),n.indentExtension=void 0,e=i("./dist/plugins/formulaPanel/editor/codemirror/index.js"),r=i("./dist/plugins/formulaPanel/editor/common/calcUtil.js"),o=i("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),n.indentExtension=e.Language.indentService.of((function(t,n){if(n<=0)return 0;var i=t.lineAt(n-1);return i&&i.text?(0,r.getIndentByPreviousText)(i.text,(0,o.getTokensByState)(t.state)):0}))},"./dist/plugins/formulaPanel/editor/featureProvider/lint.js":function(t,n,i){var e,r,o,u,s,a,f,h,c,l,v;function d(t,n){return v().NO_MATCHED_ARGUMENTS.replace("$1",t+"").replace("$2",n+"")}function y(t){return v().UNKNOWN_SHEET.replace("$1",t)}function m(t){return v().DUPLICATE_IDENTIFIER.replace("$1",t)}function p(t){var n,i,e,r=[],o=t.field(c.isFormulaField);return o?(n=(0,f.getTextByState)(t),O(r,i=(0,f.getTokensByState)(t),t,n),D(r)||((e=(0,f.parseToExpressionTree)(n,t))?b(r,e,t):E(r,i,t,n),(0,f.parseToExpressionTree)(n,t,!0)||D(r)||k(r,0,n.length,v().INVALID_FORMULA)),r):[]}function k(t,n,i,e,r){void 0===r&&(r="error"),t.push({from:n,to:i,message:e,severity:r})}function g(t,n,i,e){void 0===e&&(e="error"),k(t,n.index,n.endIndex+1,i,e)}function w(t,n,i,e){void 0===e&&(e="error"),k(t,n.lit,n.ywt,i,e)}function b(t,n,i){if(n){for(;n.type===u.ExpressionType.parentheses;){if(!n.value)return void w(t,n,v().INVALID_EXPRESSION);n=n.value}var e=n.type;e===u.ExpressionType.name?(0,f.getCustomNameByState)(i,n.value)||w(t,n,v().UNKNOWN_NAME,"warning"):e===u.ExpressionType.operator?(n.value&&b(t,n.value,i),n.value2&&b(t,n.value2,i)):e===u.ExpressionType.function?M(t,n,i):e===u.ExpressionType.reference&&P(t,n)}}function M(t,n,i){var e,r,o,s=n.functionName;if("LET"===s)x(t,n,i);else if("LAMBDA"===s)S(t,n,i);else for((0,u.isExpression)(n.function)?b(t,n.function,i):(e=(0,f.getFunctionByState)(i,s))?C(t,n,e):(0,f.getCustomNameByState)(i,s)||k(t,n.lit,n.lit+s.length,v().UNKNOWN_NAME,"warning"),r=n.arguments||[],o=0;o<r.length;o++)b(t,r[o],i)}function x(t,n,i){var e,r,o=n.lit,u=n.ywt,s=n.arguments||[];for(s.length<3&&k(t,o,u,d(3,s.length)),s.length>=3&&s.length%2==0&&k(t,o,u,v().MISS_LET_FUNCTION_BODY),e=[],r=0;r<s.length-1;r++)r%2==0?(j(t,s[r],e),e.push(s[r].value)):b(t,s[r],i);b(t,s[s.length-1],i)}function S(t,n,i){var e,r,o=n.lit,u=n.ywt,s=n.arguments||[];for(s.length<1&&k(t,o,u,d(1,s.length)),e=[],r=0;r<s.length-1;r++)j(t,s[r],e),e.push(s[r].value);b(t,s[s.length-1],i)}function C(t,n,i){var e=n.lit,r=n.ywt,o=i.minArgs||0,u=i.maxArgs!==h?i.maxArgs:Number.MAX_SAFE_INTEGER,s=n.arguments||[];s.length<o?k(t,e,r,d(o,s.length)):s.length>u&&k(t,e,r,d(u,s.length))}function j(t,n,i){var e=n.lit,r=n.ywt;!n||8!==n.type&&100!==n.type||n.value.indexOf(".")>-1?k(t,e,r,v().INVALID_IDENTIFIER_ARGUMENT):-1!==i.indexOf(n.value)&&k(t,e,r,m(n.value))}function P(t,n){var i=n.source,e=i&&i.getName();i instanceof u.ErrorSource&&e&&k(t,n.lit,n.lit+e.length,y(e),"warning")}function O(t,n,i,e){var r,o,u=[],a=function(t){return(0,s.isFunctionCallStartToken)(t)||(0,s.isSubExpressionStartToken)(t)||(0,s.isLeftParenthesesToken)(t)},f=function(t){return(0,s.isFunctionCallEndToken)(t)||(0,s.isSubExpressionEndToken)(t)||(0,s.isRightParenthesesToken)(t)};for(r=0;r<n.length;r++)a(o=n[r])?u.push(o):f(o)&&(u.length>0?u.pop():g(t,o,v().NO_MATH_PARENTHESES));u.length>0&&k(t,e.length,e.length,v().MISS_RIGHT_PARENTHESES)}function E(t,n,i,e){var r,o,u,f,h=[],c=[],l=[];for(r=0;r<n.length;r++)o=n[r],(0,s.isFunctionCallToken)(o)?(h.push({token:o}),l.push([])):(0,s.isSubExpressionStartToken)(o)?c.push({token:o}):(0,s.isFunctionCallEndToken)(o)?0===h.length?g(t,o,v().NO_MATH_PARENTHESES):(u=(0,a.lastItem)(h),h.pop(),l.pop(),u.hasError||(f=A(i,e,u.token,o),t.push.apply(t,f),D(f)&&(h.forEach((function(t){t.hasError=!0})),c.forEach((function(t){t.hasError=!0}))))):(0,s.isSubExpressionEndToken)(o)?0===c.length?g(t,o,v().NO_MATH_PARENTHESES):c.pop():(0,s.isFunctionArgumentSeparator)(o)?0!==h.length&&(0,a.lastItem)(l).push(o):(0,s.isRightParenthesesToken)(o)&&g(t,o,v().NO_MATH_PARENTHESES);(h.length>0||c.length>0)&&k(t,e.length,e.length,v().MISS_RIGHT_PARENTHESES)}function A(t,n,i,e){var r=[],o=i.index,u=e.endIndex+1,s=n.substring(o,u),a=(0,f.parseToExpressionTree)(s,t);return a?(M(r,a,t),r.forEach((function(t){t.from+=o,t.to+=o})),(0,f.parseToExpressionTree)(s,t,!0)||D(r)||k(r,o,u,v().INVALID_EXPRESSION),r):(k(r,o,u,v().INVALID_EXPRESSION),r)}function D(t){return t.some((function(t){return"error"===t.severity}))}Object.defineProperty(n,"__esModule",{value:!0}),n.getDiagnostic=n.linterExtension=void 0,e=i("./dist/plugins/formulaPanel/editor/codemirror/index.js"),r=i("Common"),o=i("./dist/plugins/formulaPanel/editor/editor.ns.js"),u=i("CalcEngine"),s=i("./dist/plugins/formulaPanel/editor/common/calcUtil.js"),a=i("./dist/plugins/formulaPanel/editor/common/util.js"),f=i("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),h=void 0,c=i("./dist/plugins/formulaPanel/editor/featureProvider/customField.js"),l=new r.Common.ResourceManager(o.SR,"formulaEditor"),v=l.getResource.bind(l),n.linterExtension=e.Lint.linter((function(t){return p(t.state)}),{needsRefresh:function(t){return t.transactions.some(c.needRebuildToken)}}),n.getDiagnostic=p},"./dist/plugins/formulaPanel/editor/featureProvider/readOnly.js":function(t,n,i){var e,r;function o(t,n){t.dispatch({effects:r.reconfigure(e.State.EditorState.readOnly.of(n))})}Object.defineProperty(n,"__esModule",{value:!0}),n.reconfigureReadOnly=n.readOnlyExtension=void 0,e=i("./dist/plugins/formulaPanel/editor/codemirror/index.js"),r=new e.State.Compartment,n.readOnlyExtension=r.of(e.State.EditorState.readOnly.of(!1)),n.reconfigureReadOnly=o},"./dist/plugins/formulaPanel/editor/featureProvider/signatureTooltips.js":function(t,n,i){var e,r,o,u,s,a,f,h,c,l,v;function d(t){var n,i,e,u,a,f=t.selection.main;return f&&f.from===f.to?(n=f.from,(i=(0,r.getSignatureStatus)((0,o.getTokensByState)(t),n))&&(e=(0,o.getFunctionResourceByState)(t,i.functionName))?(u=e,a=(0,r.getActiveParameterInSignatureTip)(i.activeParameter,u),[{pos:n,above:!0,arrow:!0,create:function(){var t=document.createElement("div");return t.className="gc-formula-editor-tooltip-help-function",t.appendChild((0,s.createHelpFunctionTitleDom)(u,a)),u.description&&t.appendChild((0,s.createHelpFunctionDescriptionDom)(u.description)),{dom:t,overlap:!0}}}]):[]):[]}Object.defineProperty(n,"__esModule",{value:!0}),n.signatureTooltipsExtensions=n.closeParameterHintsCommand=n.triggerParameterHintsCommand=n.hasParameterHints=n.notTriggerSignatureTooltip=n.closeSignatureTooltip=n.triggerSignatureTooltip=void 0,e=i("./dist/plugins/formulaPanel/editor/codemirror/index.js"),r=i("./dist/plugins/formulaPanel/editor/common/calcUtil.js"),o=i("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),u=i("./dist/plugins/formulaPanel/editor/featureProvider/customField.js"),s=i("./dist/plugins/formulaPanel/editor/common/util.js"),a=e.State.StateField,n.triggerSignatureTooltip=e.State.StateEffect.define(),n.closeSignatureTooltip=e.State.StateEffect.define(),n.notTriggerSignatureTooltip=e.State.Annotation.define(),f=a.define({create:function(){return[]},update:function(t,i){var e,r,o,s,a=i.state.field(u.isFormulaField);if(!a)return[];if(e=t&&t.length>0,i.annotation(n.notTriggerSignatureTooltip)&&!e)return[];for(r=0,o=i.effects;r<o.length;r++){if((s=o[r]).is(n.closeSignatureTooltip))return[];if(s.is(n.triggerSignatureTooltip))return d(i.state)}return i.docChanged?d(i.state):e?i.selection?d(i.state):t:[]},provide:function(t){return e.View.showTooltip.computeN([t],(function(n){return n.field(t)}))}}),h=function(t){return t.state.field(f).length>0},n.hasParameterHints=h,c=function(t){return t.dispatch({effects:n.triggerSignatureTooltip.of(null)}),!0},n.triggerParameterHintsCommand=c,l=function(t){return!!(0,n.hasParameterHints)(t)&&(t.dispatch({effects:n.closeSignatureTooltip.of(null)}),!0)},n.closeParameterHintsCommand=l,v=e.View.EditorView.updateListener.of((function(t){t.focusChanged&&!t.view.hasFocus&&(0,n.closeParameterHintsCommand)(t.view)})),n.signatureTooltipsExtensions=[f,v]},"./dist/plugins/formulaPanel/editor/featureProvider/syntaxHighlighting.js":function(t,n,i){var e,r,o,u,s,a,f;function h(t){return"gc-formula-editor-token_"+r.SyntaxHighlightingTokenType[t]}function c(t){var n;return t.field(u.isFormulaField)?f.of(v(t)):f.of([])}function l(t,i){var e={};return isNaN(i)||(e[n.TOKEN_INDEX_ATTRIBUTE_NAME]=i),{class:h(t),attributes:e}}function v(t){var n=(0,o.getTokensByState)(t);return d(n,t),n.map((function(t){var n=p(t);return e.View.Decoration.mark(l(n,t.colorIndex)).range(t.index,t.endIndex+1)}))}function d(t,n){var i,e=[];t.forEach((function(t){if((0,s.isReferenceToken)(t)||(0,s.isNameToken)(t)&&(0,s.hasReferenceRanges)(t)){var n=e.find((function(n){return y(n,t)}));t.colorIndex=n?n.colorIndex:m(e),e.push(t)}})),i=(0,o.getReferenceTokenColors)(n).length,e.forEach((function(t){t.colorIndex=t.colorIndex%i}))}function y(t,n){return(0,s.removeWhiteSpace)(t.text).toUpperCase()===(0,s.removeWhiteSpace)(n.text).toUpperCase()}function m(t){return t&&0!==t.length?Math.max.apply(Math,t.map((function(t){return t.colorIndex})))+1:0}function p(t){var n=t.type,i=r.SyntaxHighlightingTokenType.unknown;return n===r.TokenType.NumberConst?i=r.SyntaxHighlightingTokenType.numberConst:n===r.TokenType.StringConst?i=r.SyntaxHighlightingTokenType.stringConst:n===r.TokenType.LogicalConst?i=r.SyntaxHighlightingTokenType.booleanConst:n===r.TokenType.ErrorConst?i=r.SyntaxHighlightingTokenType.errorConst:n===r.TokenType.CellReference?i=r.SyntaxHighlightingTokenType.reference:n===r.TokenType.Name?i=(0,s.hasReferenceRanges)(t)?r.SyntaxHighlightingTokenType.reference:r.SyntaxHighlightingTokenType.name:n===r.TokenType.OperatorPrefix?i=r.SyntaxHighlightingTokenType.operatorPrefix:n===r.TokenType.OperatorInfix?i=r.SyntaxHighlightingTokenType.operatorInfix:n===r.TokenType.OperatorPostfix?i=r.SyntaxHighlightingTokenType.operatorPostfix:n===r.TokenType.Whitespace?i=r.SyntaxHighlightingTokenType.whitespace:n===r.TokenType.FunctionName||n===r.TokenType.FunctionCallStart||n===r.TokenType.FunctionCallEnd?i=r.SyntaxHighlightingTokenType.function:n===r.TokenType.FunctionArgumentSeparator||n===r.TokenType.ArrayConstRowSeparator||n===r.TokenType.ArrayConstItemSeparator?i=r.SyntaxHighlightingTokenType.argumentSeparator:n!==r.TokenType.SubExpressionStart&&n!==r.TokenType.SubExpressionEnd||(i=r.SyntaxHighlightingTokenType.subExpression),i}Object.defineProperty(n,"__esModule",{value:!0}),n.markReferenceTokenColorIndex=n.syntaxHighlightingTokenClassName=n.syntaxHighlightingField=n.TOKEN_INDEX_ATTRIBUTE_NAME=void 0,e=i("./dist/plugins/formulaPanel/editor/codemirror/index.js"),r=i("./dist/plugins/formulaPanel/editor/interface.js"),o=i("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),u=i("./dist/plugins/formulaPanel/editor/featureProvider/customField.js"),s=i("./dist/plugins/formulaPanel/editor/common/calcUtil.js"),a=e.State.StateField,f=e.State.RangeSet,n.TOKEN_INDEX_ATTRIBUTE_NAME="data-token-index",n.syntaxHighlightingField=a.define({create:c,update:function(t,n){return c(n.state)},provide:function(t){return e.View.EditorView.decorations.from(t)}}),n.syntaxHighlightingTokenClassName=h,n.markReferenceTokenColorIndex=d},"./dist/plugins/formulaPanel/editor/featureProvider/tab.js":function(t,n,i){var e,r;Object.defineProperty(n,"__esModule",{value:!0}),n.insertTab=void 0,e=i("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),r=function(t){if(t.state.readOnly)return!1;if(t.state.selection.ranges.some((function(t){return!t.empty})))return!1;var n=(0,e.getOneIndentSpaceByState)(t.state);return t.dispatch(t.state.update(t.state.replaceSelection(n),{scrollIntoView:!0,userEvent:"input"})),!0},n.insertTab=r},"./dist/plugins/formulaPanel/editor/featureProvider/theme.js":function(t,n,i){var e,r,o,u,s;function a(t){var n=t.autocompletionStyle,i=t.errorStyle;return u.theme({"& .cm-tooltip-autocomplete":{color:n.color,font:n.font,background:n.backgroundColor,border:n.border,"margin-left":"1em"},"& .cm-tooltip-autocomplete ul li":{padding:"5px"},"& .cm-tooltip-autocomplete ul li .cm-completionIcon-function":{color:n.function_icon.color,font:n.function_icon.font},"& .cm-tooltip-autocomplete ul li .cm-completionLabel":{color:n.function_name.color,font:n.function_name.font},"& .cm-tooltip-autocomplete ul li .cm-completionDetail":{color:n.function_name.color,font:n.function_name.font},"& .cm-tooltip-autocomplete ul li[aria-selected] .cm-completionIcon-function":{color:n.activeItem.color,background:n.activeItem.backgroundColor},"& .cm-tooltip-autocomplete ul li[aria-selected] .cm-completionLabel":{color:n.activeItem.color,background:n.activeItem.backgroundColor},"& .cm-tooltip-autocomplete ul li[aria-selected] .cm-completionDetail":{color:n.activeItem.color,background:n.activeItem.backgroundColor},"& .cm-tooltip-autocomplete ul li[aria-selected]":{color:n.activeItem.color,background:n.activeItem.backgroundColor},"& .cm-tooltip .cm-tooltip-lint .cm-diagnostic ":{color:i.color,font:i.font,background:i.backgroundColor}})}function f(t){var n={},i=function(t,i,e){var r=(0,o.syntaxHighlightingTokenClassName)(t),u=isNaN(e)?"":"[".concat(o.TOKEN_INDEX_ATTRIBUTE_NAME,'="').concat(e,'"]');n["& .".concat(r).concat(u)]=i};return t.forEach((function(t){Array.isArray(t.color)?(i(t.token,{color:t.color[0]}),t.color.forEach((function(n,e){i(t.token,{color:n},e)}))):i(t.token,{color:t.color})})),u.theme(n)}function h(t,n){return u.theme({"& .cm-scroller":{"background-color":t.backgroundColor,color:t.color,font:t.font},".cm-cursor, .cm-dropCursor":{borderLeftColor:t.caretColor},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:t.selectionBackColor},"& .cm-activeLine":{"background-color":t.activeLineBackColor},"& .cm-gutters":{"background-color":n.backgroundColor,color:n.color,font:n.font,"user-select":"none"},"& .cm-lineNumbers ":{width:"30px"},'& .cm-foldGutter span[title="Fold line"] ':{"padding-bottom":"8px"},"& .cm-gutterElement":{display:"flex","align-items":"center","justify-content":"flex-end"},"& .cm-activeLineGutter":{"background-color":t.activeLineBackColor},"& .cm-tooltip":{border:"none"}})}function c(t){var n=t.rules,i=t.editorContentStyle,e=t.editorGuttersStyle,r=[s];return i&&e&&(r=r.concat([h(i,e),a(i)])),n&&(r=r.concat(f(n))),r}Object.defineProperty(n,"__esModule",{value:!0}),n.themeExtension=n.createThemeExtension=n.themeCompartment=n.createSyntaxHighlightingTheme=void 0,e=i("./dist/plugins/formulaPanel/editor/codemirror/index.js"),r=i("./dist/plugins/formulaPanel/editor/common/const.js"),o=i("./dist/plugins/formulaPanel/editor/featureProvider/syntaxHighlighting.js"),u=e.View.EditorView,s=u.theme({"&":{height:"100%"},"&.cm-editor.cm-focused":{outline:"none"},"& .cm-line":{"line-height":1.35}}),n.createSyntaxHighlightingTheme=f,n.themeCompartment=new e.State.Compartment,n.createThemeExtension=c,n.themeExtension=n.themeCompartment.of(c(r.defaultTheme))},"./dist/plugins/formulaPanel/editor/featureProvider/toggleAbsoluteRelativeReferences.js":function(t,n,i){var e,r,o,u,s;function a(t,n,i,r,u,s){var a=(0,o.parseToExpressionTree)(t,n);return a.isFullColumn||a.isFullRow?(0,e.lmt)(a,i,r,!0,!0):a.hmt()?(0,e.dmt)(a,i,r):(0,e.lmt)(a,i,r,u,s),(0,o.unparseToText)(a,n)}function f(t,n,i){return(0,r.includeToken)(t,n,i)||(0,r.isInToken)(t,n,!0,!0)||(0,r.isInToken)(t,i,!0,!0)}Object.defineProperty(n,"__esModule",{value:!0}),n.toggleAbsoluteRelativeReferencesCommand=void 0,e=i("FormulaTextBox"),r=i("./dist/plugins/formulaPanel/editor/common/calcUtil.js"),o=i("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),u=i("./dist/plugins/formulaPanel/editor/featureProvider/customField.js"),s=function(t){var n,i,e,r,s,h,c,l,v,d,y,m,p,k=t.state.field(u.isFormulaField);return!!k&&(n=t.state,i=(0,o.getTokensByState)(n),e=n.selection.main,r=e.from,s=e.to,h=n.field(u.activeCellField),c=h.row,l=h.col,v=!1,d=0,y=r,m=s,(p=i.filter((function(t){return f(t,r,s)&&(0,o.isValidReferenceToken)(t,n)}))).forEach((function(i){var e,o,u=i.text.indexOf(":"),f=-1!==u,h=!f||r<=i.index+u,p=!f||s>i.index+u,k=a(i.text,n,c,l,h,p);k&&(t.dispatch({changes:{from:i.index+d,to:i.endIndex+1+d,insert:k}}),d+=k.length-i.text.length,e=i.index,o=i.endIndex+1,!f||h&&p||(h?o=i.index+u:p&&(e=i.index+u+1)),y=Math.min(y,e),m=Math.max(m,o),t.dispatch({selection:{anchor:y,head:m+d}}),v=!0)})),v)},n.toggleAbsoluteRelativeReferencesCommand=s},"./dist/plugins/formulaPanel/editor/formulaEditor-action.js":function(t,n,i){var e,r,o,u,s,a,f,h,c,l,v,d,y,m,p,k;function g(t,n){return void 0===n&&(n=!1),{canUndo:n,execute:t}}function w(t,n){return void 0===n&&(n=!1),g((function(n){return t(n.li.getView())}),n)}function b(t){var i=e.mt.Qf(),r=!i,o=i;t.register(y,n.Commands[y],27),t.register(h,n.Commands[h],32,r,!0,!1,o),t.register(c,n.Commands[c],27),t.register(l,n.Commands[l],115),t.register(v,n.Commands[v],70,!1,!0,!0),t.register(d,n.Commands[d],83,r,!1,!1,o)}Object.defineProperty(n,"__esModule",{value:!0}),n.registerDefaultCommands=n.Commands=n.executeCommitContextToCellCommand=void 0,e=i("Core"),r=i("FormulaTextBox"),o=i("./dist/plugins/formulaPanel/editor/common/spreadUtil.js"),u=i("./dist/plugins/formulaPanel/editor/featureProvider/formatter.js"),s=i("./dist/plugins/formulaPanel/editor/featureProvider/signatureTooltips.js"),a=i("./dist/plugins/formulaPanel/editor/featureProvider/toggleAbsoluteRelativeReferences.js"),f=i("./dist/plugins/formulaPanel/editor/spreadFeatureProvider/formulaReferencedRangesContext.js"),h="showHints",c="closeHints",l="toggleAbsoluteRelativeReferences",v="formatDocument",d="commitContentToActiveCell",y="exitEdit",m=function(t,n,i,r,o){var u,s,a,f;void 0===o&&(o=e.SheetArea.viewport),u=r.length>0?r:null,s={cmd:"editCell",sheetName:t.name(),row:n,col:i,sheetArea:o,newValue:u},t.dataRanges&&(a=t.dataRanges.getByPosition(n,i))&&(f=a.convertContext({sheet:t,row:n,col:i,sheetArea:o}))&&f.sheet!==t&&(s.sheetName=f.sheet.name(),s.row=f.row,s.col=f.col),t.Qy().execute(s)},n.executeCommitContextToCellCommand=m,p=g((function(t){var i,e,u,s,a=(0,o.Kde)(t.Vv);return!!a&&(i=r.Hde.Ude(),(0,f.isFormulaEditorReferencedRangesAcrossSheetContext)(i)?(i.zde(a),!0):(e=t.text(),u=a.getActiveRowIndex(),s=a.getActiveColumnIndex(),(0,n.executeCommitContextToCellCommand)(a,u,s,e),!0))})),k=g((function(t){var n,i=t.workbook();return!(!t.Qde()||!i)&&((n=t.li.getView()).contentDOM.blur(),(0,f.closeFormulaReferencedRanges)(n.state),i.focus(!1),i.focus(),t.Xde(),!0)})),n.Commands={},n.Commands[h]=w(s.triggerParameterHintsCommand),n.Commands[c]=w(s.closeParameterHintsCommand),n.Commands[v]=w(u.formatDocumentCommand),n.Commands[l]=w(a.toggleAbsoluteRelativeReferencesCommand),n.Commands[d]=p,n.Commands[y]=k,n.registerDefaultCommands=b},"./dist/plugins/formulaPanel/editor/formulaEditor-spreadjs.js":function(t,n,i){var e,r,o,u,s,a;function f(t){t.Dn.Fde()}function h(t){var n=t.Bde;if((0,u.isFormulaEditorReferencedRangesContext)(n)&&n.zQt.hasFocus)return!0}function c(t,n,i){var e,r,u,s,a,f="";if(t)if(r=(e=t.parent)&&e.options,(u=t.getFormulaInformation(n,i,3))&&u.hasFormula&&!o.mt.HRe(n,i,t)){if(f="="+u.formulaWithCulture,u.isDynamicArray)return"";u.isArrayFormula&&(f="{"+f+"}")}else s=t.getActualStyle(n,i),f="string"==typeof(a=t.getValue(n,i))&&(s.quotePrefix||a.length>1&&"="===a[0]&&r&&r.allowUserEditFormula&&!r.allowInvalidFormula)?"'"+a:o.mt.formatValue2Text(s,a,t,{sheet:t,row:n,col:i,sheetArea:3})||"";return f}Object.defineProperty(n,"__esModule",{value:!0}),n.getEditText=n.paintFormulaReferencedRanges=void 0,e=i("Common"),r=i("./dist/plugins/formulaPanel/editor/editor.ns.js"),o=i("Core"),u=i("./dist/plugins/formulaPanel/editor/spreadFeatureProvider/formulaReferencedRangesContext.js"),n.paintFormulaReferencedRanges=f,s=new e.Common.ResourceManager(r.SR,"formulaEditor"),a=s.getResource.bind(s),o.Worksheet.ch("formulaEditor",{preProcessKeyDown:function(t){h(this)&&(t.r=!0)},processCompositionStart:function(t){h(this)&&(t.r=!0)}}),n.getEditText=c,o.Workbook.ch("formulaEditor",{onCultureChanged:function(){a()}})},"./dist/plugins/formulaPanel/editor/formulaEditor.js":function(t,n,i){var e,r,o,u,s,a,f,h,c,l,v,d,y,m,p,k,g;function w(t,n,i){if(M(t,n,i))return!0;if(x(t,n,i))return!0;if(!b(t,n,i))return!0;var e={r:d};return r.Worksheet.et(t,"formulaPanelCheckIsReadOnly",e),!!e.r}function b(t,n,i){var e=t.getActualStyle(n,i);return!e||!1!==e.allowEditInCell}function M(t,n,i){return t.isActualProtected()&&!1!==t.l0(n,i,"locked")}function x(t,n,i){var e,o=t.getCellType(n,i);return!(!o||(e={sheet:t,sheetName:t.name(),sheetArea:r.SheetArea.viewport,row:n,col:i},!(e=o.lfe(e,v)).readonly))}Object.defineProperty(n,"__esModule",{value:!0}),n.FormulaEditor=n.CONST_FORMULA_EDITOR=void 0,e=i("Common"),r=i("Core"),o=i("./dist/plugins/formulaPanel/editor/formulaEditorCore.js"),u=i("./dist/plugins/formulaPanel/editor/common/const.js"),s=i("./dist/plugins/formulaPanel/editor/formulaEditor-action.js"),a=i("./dist/plugins/formulaPanel/editor/spreadFeatureProvider/formulaReferencedRangesExtension.js"),f=i("./dist/plugins/formulaPanel/editor/formulaEditor-spreadjs.js"),h=i("./dist/plugins/formulaPanel/editor/common/spreadUtil.js"),c=i("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),l=i("./dist/plugins/formulaPanel/editor/spreadFeatureProvider/structReferences.js"),n.CONST_FORMULA_EDITOR="formula-editor",v=void 0,d=null,y=r.mt.b0,m=r.GC$.extend,p=r.GC$.each,k=[a.formulaReferencedRangesExtension],g=function(){function t(i,a){var f,h;"string"==typeof i&&(i=document.getElementById(i)),f=this,h={container:i},t.et(f,"onCreate",h),i=h.container,f.Wc=i,f.li=new o.FormulaEditorCore(i,k),f.e$r(),f.Qy=new e.Commands.CommandManager(f),f.Zde=f.Zde.bind(f),f.spe=f.spe.bind(f),f.Yde=f.Yde.bind(f),f.$ve=f.$ve.bind(f),f.ove=f.ove.bind(f),f.tve=f.tve.bind(f),f.Rve=f.Rve.bind(f),f.hme=f.hme.bind(f),f.qve=f.qve.bind(f),f.yme=f.yme.bind(f),f.kme=f.kme.bind(f),f.LEt=y(u.DEFAULT_FORMULA_EDITOR_OPTIONS,f.kme),f.Zp(a),f.wme(),i.addEventListener("keydown",f.Zde),(0,s.registerDefaultCommands)(f.Qy),(0,r.GC$)(i).data(n.CONST_FORMULA_EDITOR,f)}return t.prototype.e$r=function(){var n=this;n.li.initTheme(),t.et(n,"onThemeChange",n.li.getTheme())},Object.defineProperty(t.prototype,"options",{get:function(){return this.LEt},set:function(t){if(t&&"object"==typeof t)for(var n in t)t.hasOwnProperty(n)&&(this.LEt[n]=t[n])},enumerable:!1,configurable:!0}),t.prototype.text=function(t){if(0===arguments.length)return this.li.getText();this.li.setText(t+"")},t.prototype.workbook=function(){return this.Vv},t.prototype.attach=function(t){var n=this;n.Vv!==t&&(n.detach(),n.Vv=t,n._6(),n.Vv.D3(r.Events.EnterCellInternal,n.spe),n.Vv.D3(r.Events.CellChanged,n.Yde),n.Vv.D3(r.Events.RangeChangedInternal,n.$ve),n.Vv.D3(r.Events.RangeFiltered,n.yme),n.Vv.D3(r.Events.RangeFilterCleared,n.yme),n.Vv.D3(r.Events.ActiveSheetChangingInternal,n.ove),n.Vv.D3(r.Events.ActiveSheetChangedInternal,n.tve),n.Vv.D3(r.Events.SheetOptionsChangedInternal,n.Rve),n.Vv.D3(r.Events.WorkbookOptionsChangedInternal,n.hme),n.Vv.D3(r.Events.CustomNameChangedInternal,n.qve))},t.prototype.detach=function(){var t=this,n=t.Vv;n&&(n._3(r.Events.EnterCellInternal,t.spe),n._3(r.Events.CellChanged,t.Yde),n._3(r.Events.RangeChangedInternal,t.$ve),n._3(r.Events.RangeFiltered,t.yme),n._3(r.Events.RangeFilterCleared,t.yme),n._3(r.Events.ActiveSheetChangingInternal,t.ove),n._3(r.Events.ActiveSheetChangedInternal,t.tve),n._3(r.Events.SheetOptionsChangedInternal,t.Rve),n._3(r.Events.WorkbookOptionsChangedInternal,t.hme),n._3(r.Events.CustomNameChangedInternal,t.qve),t.Vv=v,t._6())},t.prototype.format=function(){this.li.format()},t.prototype.commandManager=function(){return this.Qy},t.prototype.destroy=function(){var i=this;t.et(i,"onDestroy"),i.detach(),i.li.destroy(),i.Wc.removeEventListener("keydown",i.Zde),(0,r.GC$)(i.Wc).data(n.CONST_FORMULA_EDITOR,d)},t.prototype.refresh=function(){var t=this;t.e$r(),t._6()},t.prototype.getActiveCellInfo=function(){var t=this.li.getActiveCellInfo(),n=t.row,i=t.col,e=this.li.getCalcSource().Mf;return{sheet:e,row:n,col:i}},t.prototype.isFormattedFormula=function(){return this.li.isFormattedFormula()},t.prototype.Qde=function(){return this.li.getView().hasFocus},t.prototype.Xde=function(){var t,n,i=this.getActiveCellInfo(),e=i.sheet,o=i.row,u=i.col;e&&(t=this.li,n=(0,f.getEditText)(e,o,u),e.options.showFormulas&&e.hasFormula(o,u)&&r.mt.HRe(o,u,e)&&(n=""),(0,c.isSameFormula)(t.getView().state,t.getText(),n)||t.setText(n),t.format())},t.prototype.Zp=function(t){var n=this.LEt,i=t||{};i=m(!0,{},u.DEFAULT_FORMULA_EDITOR_OPTIONS,i),p(i,(function(t,i){n.hasOwnProperty(t)&&(n[t]=i)})),this.li.setOptions(n)},t.prototype.wme=function(){var t=this;t.li.setProvider({getStructReferences:function(){return(0,l.getStructReferencesByWorkbook)(t.Vv)},getFunctions:function(){return(0,h.getFunctionsByWorkbook)(t.Vv)}})},t.prototype.Zde=function(t){this.hve(t)},t.prototype.spe=function(){var t=this;t.tpe()?t.ope():(t.Xde(),t.Ove())},t.prototype.Yde=function(t,n){var i=this.getActiveCellInfo(),e=i.sheet,r=i.row,o=i.col;e===n.sheet&&r===n.row&&o===n.col&&("[styleinfo]"===n.propertyName&&this.Ove(),this.Xde())},t.prototype.$ve=function(t,n){if(n){var i=this.getActiveCellInfo(),e=i.sheet,o=i.row,u=i.col;e===n.sheet&&new r.Range(n.row,n.col,n.rowCount,n.colCount).contains(o,u)&&this.Xde()}},t.prototype.ove=function(t,n){(0,a.ave)(t,n)},t.prototype.tve=function(t,n){var i;(0,a.uve)(t,n)||this._6()},t.prototype.Rve=function(t,n){var i=n.propertyName;"isProtected"===i&&this.Ove(),"showFormulas"===i&&this.Xde()},t.prototype.hme=function(t,n){var i;"allowDynamicArray"===n.propertyName&&this.li.rebuildFormula()},t.prototype.qve=function(){this.sve()},t.prototype.yme=function(t,n){var i,e=null===(i=this.Vv)||void 0===i?void 0:i.getSheetTab(n.sheetName),r=this.li.getCalcSource().Mf;e&&e.Mf===r&&this.Xde()},t.prototype.kme=function(t,n,i){var e=this;n!==i&&this.li.setOptions(e.LEt)},t.prototype._6=function(){var t=this;t.eve(),t.rve(),t.sve(),t.ope()},t.prototype.eve=function(){var t,n=(null===(t=this.Vv)||void 0===t?void 0:t.getCalcService())||u.defaultCalcService;this.li.setCalcService(n)},t.prototype.rve=function(){var t=(0,h.Kde)(this.Vv);t?this.li.setCalcSource(t.Uw()):this.li.setCalcSource(u.defaultCalcSource),this.epe()},t.prototype.sve=function(){var t,n=[],i=this.Vv;i&&(n.push.apply(n,i.getCustomNames()),(t=(0,h.Kde)(i))&&n.push.apply(n,t.getCustomNames())),this.li.setCustomNames(n)},t.prototype.ope=function(){var t=this,n=t.rpe();t.li.setActiveCellInfo(n),t.Xde(),t.Ove(),t.li.clearHistory(),t.epe()},t.prototype.Ove=function(){var t=(0,h.Kde)(this.Vv);t?this.li.setReadOnly(w(t,t.getActiveRowIndex(),t.getActiveColumnIndex())):this.li.setReadOnly(!1)},t.prototype.tpe=function(){var t=this.li.getActiveCellInfo(),n=this.rpe();return t.row!==n.row||t.col!==n.col},t.prototype.rpe=function(){var t,n,i=(0,h.Kde)(this.Vv);return i?{row:t=i.getActiveRowIndex(),col:n=i.getActiveColumnIndex()}:u.DEFAULT_ACTIVE_CELL_INFO},t.prototype.epe=function(){this.options.onActiveCellChanged&&this.options.onActiveCellChanged()},t.prototype.hve=function(t){var n,i,e,o=this,u=o.Qy.getShortcutKey(t.keyCode,t.ctrlKey,t.shiftKey,t.altKey,t.metaKey),s=o.Qy.getCommands(u);if(s)for(n={cmds:s,r:d},r.Worksheet.et(this.Vv.getActiveSheet(),"beforeExecuteShortcut",n),s=n.cmds,i=0;i<s.length;i++)if(e=s[i].execute(o,{}))return e.ignoreCancelDefault||r.mt.vi(t),!0},t}(),n.FormulaEditor=g,(0,r.$e)(g)},"./dist/plugins/formulaPanel/editor/formulaEditorCore.js":function(t,n,i){var e,r,o,u,s,a,f,h,c,l,v,d,y,m,p,k,g,w,b,M,x,S,C,j,P,O,E,A,D,R,I,T,L,B,_,F,N,U,H,z,W,V,$,q,G,J,K,Q,X,Z,Y,tt;function nt(){return[r.basicSetup,Y,u.customFields,k.readOnlyExtension,m.themeExtension,c.foldExtension,l.indentExtension,s.syntaxHighlightingField,a.autoCompletionExtensions,f.hoverTooltipExtension,h.signatureTooltipsExtensions,d.doubleClickSelectRangeExtension,y.linterExtension]}Object.defineProperty(n,"__esModule",{value:!0}),n.FormulaEditorCore=void 0,e=i("Core"),r=i("./dist/plugins/formulaPanel/editor/codemirror/index.js"),o=i("./dist/plugins/formulaPanel/editor/interface.js"),u=i("./dist/plugins/formulaPanel/editor/featureProvider/customField.js"),s=i("./dist/plugins/formulaPanel/editor/featureProvider/syntaxHighlighting.js"),a=i("./dist/plugins/formulaPanel/editor/featureProvider/completion.js"),f=i("./dist/plugins/formulaPanel/editor/featureProvider/hoverTooltips.js"),h=i("./dist/plugins/formulaPanel/editor/featureProvider/signatureTooltips.js"),c=i("./dist/plugins/formulaPanel/editor/featureProvider/folding.js"),l=i("./dist/plugins/formulaPanel/editor/featureProvider/indent.js"),v=i("./dist/plugins/formulaPanel/editor/featureProvider/tab.js"),d=i("./dist/plugins/formulaPanel/editor/featureProvider/dbClickRangeSelector.js"),y=i("./dist/plugins/formulaPanel/editor/featureProvider/lint.js"),m=i("./dist/plugins/formulaPanel/editor/featureProvider/theme.js"),p=i("./dist/plugins/formulaPanel/editor/featureProvider/formatter.js"),k=i("./dist/plugins/formulaPanel/editor/featureProvider/readOnly.js"),g=i("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),w="gc-formula-editor-token-const-string",b="gc-formula-editor-token-const-number",M="gc-formula-editor-token-const-boolean",x="gc-formula-editor-token-const-error",S="gc-formula-editor-token-operator-prefix",C="gc-formula-editor-token-operator-infix",j="gc-formula-editor-token-operator-postfix",P="gc-formula-editor-token-function",O="gc-formula-editor-token-name",E="gc-formula-editor-token-reference-1",A="gc-formula-editor-token-reference-2",D="gc-formula-editor-token-reference-3",R="gc-formula-editor-token-reference-4",I="gc-formula-editor-token-reference-5",T="gc-formula-editor-token-reference-6",L="gc-formula-editor-token-reference-7",B="gc-formula-editor-token-argument-separator",_="gc-formula-editor-content",F="gc-formula-editor-gutters",N="gc-formula-editor-caret",U="gc-formula-editor-active-line",H="gc-formula-editor-selection",z="gc-formula-editor-tooltip-autocompletion-function",W="gc-formula-editor-tooltip-autocompletion-function-active-item",V="gc-formula-editor-tooltip-autocompletion-function-icon",$="gc-formula-editor-tooltip-autocompletion-function-name",q="gc-formula-editor-tooltip-autocompletion-function-description",G="gc-formula-editor-tooltip-error-message",J=e.I.fl,K=r.View.EditorView,Q=r.View.keymap,X=r.Commands.indentWithTab,Z=r.Autocomplete.acceptCompletion,Y=Q.of([{key:"Tab",run:Z},{key:"Tab",run:v.insertTab},X]),tt=function(){function t(t,n){this.ipe=n,this.zQt=new K({state:this.npe(""),parent:t})}return t.prototype.getView=function(){return this.zQt},t.prototype.getText=function(){return this.zQt.state.doc.toJSON().join("\n")},t.prototype.setText=function(t){this.zQt.dispatch({changes:{from:0,to:this.zQt.state.doc.length,insert:t}})},t.prototype.getFunctions=function(){return(0,g.getFunctionsByState)(this.zQt.state)},t.prototype.getCustomNames=function(){return this.zQt.state.field(u.customNamesField)},t.prototype.setCustomNames=function(t){this.zQt.dispatch({effects:u.setCustomNamesField.of(t)})},t.prototype.getOptions=function(){return this.zQt.state.field(u.optionsField)},t.prototype.setOptions=function(t){this.zQt.dispatch({effects:u.setOptionsField.of(t)})},t.prototype.getReadOnly=function(){return this.zQt.state.readOnly},t.prototype.setReadOnly=function(t){t!==this.getReadOnly()&&(0,k.reconfigureReadOnly)(this.zQt,t)},t.prototype.getTheme=function(){return this.zQt.state.field(u.themeField)},t.prototype.setTheme=function(t){this.zQt.dispatch({effects:u.setThemeField.of(t)}),this.zQt.dispatch({effects:m.themeCompartment.reconfigure((0,m.createThemeExtension)(t))})},t.prototype.getCalcSource=function(){return this.zQt.state.field(u.calcSourceField)},t.prototype.setCalcSource=function(t){this.zQt.dispatch({effects:u.setCalcSourceField.of(t)})},t.prototype.getCalcService=function(){return this.zQt.state.field(u.calcServiceField)},t.prototype.setCalcService=function(t){this.zQt.dispatch({effects:u.setCalcServiceField.of(t)})},t.prototype.getActiveCellInfo=function(){return this.zQt.state.field(u.activeCellField)},t.prototype.setActiveCellInfo=function(t){this.zQt.dispatch({effects:u.setActiveCellField.of(t)})},t.prototype.getProvider=function(){return this.zQt.state.field(u.providerField)},t.prototype.setProvider=function(t){this.zQt.dispatch({effects:u.setProviderField.of(t)})},t.prototype.format=function(){(0,p.formatDocumentCommand)(this.zQt)},t.prototype.hasFocus=function(){return this.zQt.hasFocus},t.prototype.destroy=function(){this.zQt.destroy()},t.prototype.rebuildFormula=function(){this.zQt.dispatch({effects:u.rebuildFormulaEffect.of(!0)})},t.prototype.clearHistory=function(){var t=this,n=t.getText(),i=t.getTheme(),e=t.getOptions(),r=t.getCalcService(),o=t.getCalcSource(),u=t.getCustomNames(),s=t.getActiveCellInfo(),a=t.getProvider(),f=t.getReadOnly(),h=t.npe(n);t.zQt.setState(h),t.setTheme(i),t.setOptions(e),t.setCalcService(r),t.setCalcSource(o),t.setActiveCellInfo(s),t.setCustomNames(u),t.setProvider(a),t.setReadOnly(f)},t.prototype.initTheme=function(){var t=[{token:o.SyntaxHighlightingTokenType.stringConst,color:J(w).color},{token:o.SyntaxHighlightingTokenType.numberConst,color:J(b).color},{token:o.SyntaxHighlightingTokenType.booleanConst,color:J(M).color},{token:o.SyntaxHighlightingTokenType.errorConst,color:J(x).color},{token:o.SyntaxHighlightingTokenType.operatorPrefix,color:J(S).color},{token:o.SyntaxHighlightingTokenType.operatorInfix,color:J(C).color},{token:o.SyntaxHighlightingTokenType.operatorPostfix,color:J(j).color},{token:o.SyntaxHighlightingTokenType.function,color:J(P).color},{token:o.SyntaxHighlightingTokenType.name,color:J(O).color},{token:o.SyntaxHighlightingTokenType.argumentSeparator,color:J(B).color},{token:o.SyntaxHighlightingTokenType.reference,color:[J(E).color,J(A).color,J(D).color,J(R).color,J(I).color,J(T).color,J(L).color]}],n={backgroundColor:J(_).backgroundColor,font:J(_).font,color:J(_).color,caretColor:J(N).color,selectionBackColor:J(H).backgroundColor,activeLineBackColor:J(U).backgroundColor,autocompletionStyle:{backgroundColor:J(z).backgroundColor,font:J(z).font,color:J(z).color,border:J(z).border,activeItem:{backgroundColor:J(W).backgroundColor,color:J(W).color},function_icon:{color:J(V).color,font:J(V).font},function_name:{color:J($).color,font:J($).font},function_description:{color:J(q).color,font:J(q).font}},errorStyle:{backgroundColor:J(G).backgroundColor,font:J(G).font,color:J(G).color}},i={backgroundColor:J(F).backgroundColor,font:J(F).font,color:J(F).color};this.setTheme({rules:t,editorContentStyle:n,editorGuttersStyle:i})},t.prototype.isFormattedFormula=function(){return this.zQt.state.field(u.isFormattedFormulaField)},t.prototype.npe=function(t){var n=nt().concat(this.ipe);return r.State.EditorState.create({extensions:n,doc:t})},t}(),n.FormulaEditorCore=tt},"./dist/plugins/formulaPanel/editor/interface.js":function(t,n){var i,e;Object.defineProperty(n,"__esModule",{value:!0}),n.TokenType=n.SyntaxHighlightingTokenType=void 0,function(t){t[t.subExpression=0]="subExpression",t[t.function=1]="function",t[t.argumentSeparator=2]="argumentSeparator",t[t.operatorPrefix=3]="operatorPrefix",t[t.operatorInfix=4]="operatorInfix",t[t.operatorPostfix=5]="operatorPostfix",t[t.stringConst=6]="stringConst",t[t.errorConst=7]="errorConst",t[t.numberConst=8]="numberConst",t[t.booleanConst=9]="booleanConst",t[t.name=10]="name",t[t.reference=11]="reference",t[t.whitespace=12]="whitespace",t[t.unknown=13]="unknown"}(i=n.SyntaxHighlightingTokenType||(n.SyntaxHighlightingTokenType={})),function(t){t[t.ErrorConst=0]="ErrorConst",t[t.LogicalConst=1]="LogicalConst",t[t.NumberConst=2]="NumberConst",t[t.StringConst=3]="StringConst",t[t.ArrayConstStart=4]="ArrayConstStart",t[t.ArrayConstEnd=5]="ArrayConstEnd",t[t.ArrayConstRowSeparator=6]="ArrayConstRowSeparator",t[t.ArrayConstItemSeparator=7]="ArrayConstItemSeparator",t[t.OperatorPrefix=8]="OperatorPrefix",t[t.OperatorInfix=9]="OperatorInfix",t[t.OperatorPostfix=10]="OperatorPostfix",t[t.FunctionName=11]="FunctionName",t[t.FunctionCallStart=12]="FunctionCallStart",t[t.FunctionCallEnd=13]="FunctionCallEnd",t[t.FunctionArgumentSeparator=14]="FunctionArgumentSeparator",t[t.SubExpressionStart=15]="SubExpressionStart",t[t.SubExpressionEnd=16]="SubExpressionEnd",t[t.CellReference=17]="CellReference",t[t.Name=18]="Name",t[t.FormulaStart=19]="FormulaStart",t[t.Whitespace=20]="Whitespace",t[t.Unknown=21]="Unknown"}(e=n.TokenType||(n.TokenType={}))},"./dist/plugins/formulaPanel/editor/spreadFeatureProvider/formulaReferencedRangesContext.js":function(t,n,i){var e,r,o,u,s,a,f,h,c,l,v,d,y,m;function p(t){var n,i,e=(0,a.getActiveSheetByState)(t);e&&(g(n=o.Hde.Ude())&&(n.zde(e),e=(0,a.getActiveSheetByState)(t)),k(i=e.Bde)&&(i.dispose(),e.Bde=d,w(e.parent,!1)))}function k(t){return t instanceof y}function g(t){return t instanceof m}function w(t,n){var i=function(t){t&&(t.rt.X6=n)};t.sheets.forEach(i),t.mp.forEach((function(t){i(t.Mf)}))}function b(t,n){void 0===n&&(n=!0),t.parent.e3(t,n)}Object.defineProperty(n,"__esModule",{value:!0}),n.setWorkbookFocusStatus=n.isFormulaEditorReferencedRangesAcrossSheetContext=n.isFormulaEditorReferencedRangesContext=n.closeFormulaReferencedRanges=n.FormulaEditorReferencedRangesAcrossSheetContext=n.FormulaEditorReferencedRangesContext=n.appendingRangeAnnotation=void 0,e=i("Common"),r=i("Core"),o=i("FormulaTextBox"),u=i("./dist/plugins/formulaPanel/editor/codemirror/index.js"),s=i("./dist/plugins/formulaPanel/editor/common/calcUtil.js"),a=i("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),f=i("./dist/plugins/formulaPanel/editor/common/util.js"),h=i("./dist/plugins/formulaPanel/editor/featureProvider/customField.js"),c=i("./dist/plugins/formulaPanel/editor/featureProvider/signatureTooltips.js"),l=i("./dist/plugins/formulaPanel/editor/featureProvider/syntaxHighlighting.js"),v=i("./dist/plugins/formulaPanel/editor/formulaEditor-action.js"),d=void 0,n.appendingRangeAnnotation=u.State.Annotation.define(),y=function(){function t(t){this.cmt=!0,this.rl=!1,this.Xvt=r.SelectionUnit.cell,this.Ivt=!1,this.xmt=!0,this.qMi=!1,this.XD=!1,this.umt=-1,this.zQt=t}return t.prototype.smt=function(){var t,n,i,e,o,u;if(!this.isFormula())return[];for(t=this.zQt.state,n=(0,a.getTokensByState)(t),(0,l.markReferenceTokenColorIndex)(n,t),i=[],e=0;e<n.length;e++)o=n[e],((0,s.isReferenceToken)(o)||(0,s.isNameToken)(o)&&(0,s.hasReferenceRanges)(o))&&i.push({index:i.length,textOffset:o.index,text:o.text,ranges:o.ranges,allowDrag:o.canDrag,sheetArea:r.SheetArea.viewport,tag:{colorIndex:o.colorIndex}});return(u=this.Fvt)&&i.push({textOffset:-1,text:"",ranges:[u],index:i.length,allowDrag:!1,isPivotClickCell:!0,tag:{colorIndex:0}}),i},t.prototype.pmt=function(t){var n,i=(0,a.getReferenceTokenColors)(this.zQt.state),e=this.smt()[t];return i[(null===(n=null==e?void 0:e.tag)||void 0===n?void 0:n.colorIndex)||0]},t.prototype.ymt=function(t){var n=this.zQt.state.selection.main.head;return t.textOffset<=n&&t.textOffset+t.text.length>=n},t.prototype.bmt=function(t){var n,i;return!!this.XD&&(n=this.zQt.state.selection.main.head,i=this.umt,t.textOffset>=i&&t.textOffset+t.text.length<=n)},t.prototype.Qvt=function(){return r.SheetArea.viewport},t.prototype.Dvt=function(){var t,n=this.zQt.state;return!n.readOnly&&(!(!this.XD&&!(0,r.Df)(this.text()))||!!this.isFormula()&&(!!(t=(0,s.getTokenByPos)((0,a.getTokensByState)(n),(0,a.getSelection)(n).from-1))&&((0,s.isFormulaStartToken)(t)||(0,s.isFunctionCallStartToken)(t)||(0,s.isSubExpressionStartToken)(t)||(0,s.isFunctionArgumentSeparator)(t)||(0,s.isLeftParenthesesToken)(t)||(0,s.isInfixOperatorToken)(t)||(0,s.isPrefixOperatorToken)(t)||(0,s.isWhitespaceToken)(t))))},t.prototype.text=function(){return(0,a.getTextByState)(this.zQt.state)},t.prototype.caret=function(){return this.zQt.state.selection.main.head},t.prototype.close=function(){},t.prototype.mmt=function(){},t.prototype.Vde=function(t,n){var i,e,r,o,u,s;n&&(i=this.zQt,(r=(e=this.smt())[t])&&(u=(o=r.textOffset)+r.text.length,s=o+n.length,i.dispatch({changes:{from:o,to:u,insert:n},selection:{anchor:s,head:s},annotations:c.notTriggerSignatureTooltip.of(!0)})))},t.prototype.Gvt=function(t,i,e,o,u){var s,f,h,l,v,d,y,m;if(void 0===u&&(u=r.SheetArea.viewport),t){if(h=(f=(s=this).zQt).state,!s.XD){if(!s.Dvt())return;i=!1,s.XD=!0,s.umt=(0,a.getSelection)(h).from}l=s.umt,v=(0,a.getSelection)(h).to,d=(0,a.getTokensByState)(h),y=(0,a.getValidReferenceTokenByPos)(d,v,h),e?(m=l+t.length,f.dispatch({changes:{from:l,to:v,insert:t},selection:{anchor:m,head:m},annotations:[n.appendingRangeAnnotation.of(!0),c.notTriggerSignatureTooltip.of(!0)]})):i?y&&y.index>=l&&v>=y.index&&(m=y.index+t.length,f.dispatch({changes:{from:y.index,to:v,insert:t},selection:{anchor:m,head:m},annotations:[n.appendingRangeAnnotation.of(!0),c.notTriggerSignatureTooltip.of(!0)]})):(v>l&&(t=s.fgt()+t),m=v+t.length,f.dispatch({changes:{from:v,to:v,insert:t},selection:{anchor:m,head:m},annotations:[n.appendingRangeAnnotation.of(!0),c.notTriggerSignatureTooltip.of(!0)]}))}},t.prototype.qD=function(){var t=this;t.XD&&(t.XD=!1,t.umt=-1)},t.prototype.onRangeMoved=function(){},t.prototype.onRangeResized=function(){},t.prototype.onRangeAppend=function(){},t.prototype.fgt=function(){var t=e.Common.CultureManager.Fe().NumberFormat;return t&&t.listSeparator||f.COMMA},t.prototype.cve=function(){return this.zQt.state.field(h.calcSourceField).Mf},t.prototype.fve=function(){return this.zQt.state.field(h.activeCellField)},t.prototype.isFormula=function(){return this.zQt.state.field(h.isFormulaField)},t.prototype.Ak=function(t){t&&(this.Dmt=[t])},t.prototype.Hce=function(){this.Dmt=d},t.prototype.Ymt=function(){return this.Dmt},t.prototype.dispose=function(){this.zQt=d},t.prototype.dve=function(){var t=this.zQt;t&&(p(t.state),t.hasFocus&&t.contentDOM.blur(),this.dispose())},t}(),n.FormulaEditorReferencedRangesContext=y,m=function(){function t(t){this.lve=t}return Object.defineProperty(t.prototype,"Ivt",{get:function(){return this.lve.Ivt},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Mf",{get:function(){return this.lve.cve()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_text",{get:function(){return this.lve.text()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bZ",{get:function(){return this.lve.fve().row},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mvt",{get:function(){return this.lve.fve().col},enumerable:!1,configurable:!0}),t.prototype.zde=function(t){var n=!1,i=this.Mf,e=this.bZ,r=this.mvt,o=this._text;return i!==t&&(b(i),n=!0),(0,v.executeCommitContextToCellCommand)(i,e,r,o),this.d5(),n},t.prototype.d5=function(){this.lve=d,o.Hde.DJ=d},t}(),n.FormulaEditorReferencedRangesAcrossSheetContext=m,n.closeFormulaReferencedRanges=p,n.isFormulaEditorReferencedRangesContext=k,n.isFormulaEditorReferencedRangesAcrossSheetContext=g,n.setWorkbookFocusStatus=w},"./dist/plugins/formulaPanel/editor/spreadFeatureProvider/formulaReferencedRangesExtension.js":function(t,n,i){var e,r,o,u,s,a,f,h;function c(t,n,i){var e=i.parent;t&&t.zQt===n||(i.Bde=new s.FormulaEditorReferencedRangesContext(n),(0,s.setWorkbookFocusStatus)(e,i.Bde.Dvt()))}function l(t,n,i){if((0,s.isFormulaEditorReferencedRangesContext)(t)){var e=i.parent;v(t,n,e)?(0,s.closeFormulaReferencedRanges)(n.state):document.activeElement!==n.contentDOM&&setTimeout((function(){n.focus()}),10)}}function v(t,n,i){var e=document.activeElement;return e!==n.contentDOM&&(!e.hasAttribute("data-gc-formula-editor-additional-element")&&!(t.Dvt()&&i&&i.Ti&&i.Ti.contains(e)))}function d(t,n){var i,e;y(t.keyCode)&&(e=(i=(0,o.getActiveSheetByState)(n.state))&&i.Bde,(0,s.isFormulaEditorReferencedRangesContext)(e)&&i.rt.yk(t))}function y(t){return 16===t||17===t||18===t}function m(t,n){var i,r=n.oldSheet,o=n.newSheet;r&&o&&r!==o&&(i=r.Bde,(0,s.isFormulaEditorReferencedRangesContext)(i)&&(i.Dvt()||e.Hde.DJ)&&(n.needTriggerSheetChange=!1,o.Bde=i,r.Bde=a))}function p(t,n){var i,r,o=n.oldSheet,f=n.newSheet;if(f&&!f.xT&&o!==f&&(i=f.Bde,(0,s.isFormulaEditorReferencedRangesContext)(i)&&(i.Dvt()||e.Hde.DJ)))return i.cve()!==f?e.Hde.DJ=new s.FormulaEditorReferencedRangesAcrossSheetContext(i):(r=e.Hde.DJ,(0,s.isFormulaEditorReferencedRangesAcrossSheetContext)(r)&&(r.d5(),e.Hde.DJ=a)),(0,u.paintFormulaReferencedRanges)(f),!0}Object.defineProperty(n,"__esModule",{value:!0}),n.uve=n.ave=n.isMetaKeyForAppendingRange=n.formulaReferencedRangesExtension=void 0,e=i("FormulaTextBox"),r=i("./dist/plugins/formulaPanel/editor/codemirror/index.js"),o=i("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),u=i("./dist/plugins/formulaPanel/editor/formulaEditor-spreadjs.js"),s=i("./dist/plugins/formulaPanel/editor/spreadFeatureProvider/formulaReferencedRangesContext.js"),a=void 0,f=r.View.EditorView.updateListener.of((function(t){var n,i,r,a=(0,o.getActiveSheetByState)(t.state);a&&(n=a.parent,i=a.Bde,r=e.Hde.Ude(),!i&&(0,s.isFormulaEditorReferencedRangesAcrossSheetContext)(r)&&(i=r.lve),t.focusChanged?(t.view.hasFocus?c(i,t.view,a):l(i,t.view,a),(0,u.paintFormulaReferencedRanges)(a)):(t.selectionSet||t.docChanged)&&i&&(t.transactions.some((function(t){return!t.annotation(s.appendingRangeAnnotation)}))&&i.qD(),(0,s.setWorkbookFocusStatus)(n,i.Dvt()),(0,u.paintFormulaReferencedRanges)(a)))})),h=r.View.ViewPlugin.define((function(){return null}),{eventHandlers:{keydown:d,keyup:d}}),n.formulaReferencedRangesExtension=[f,h],n.isMetaKeyForAppendingRange=y,n.ave=m,n.uve=p},"./dist/plugins/formulaPanel/editor/spreadFeatureProvider/structReferences.js":function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.getStructReferencesByWorkbook=void 0;var e=i("CalcEngine");function r(t){return t?o(t).concat(s(t)):[]}function o(t){var n=[];return t.sheets.forEach((function(t){var i;(t.tables&&t.tables.all()||[]).forEach((function(t){n.push({name:t.name(),description:(0,e.sR)().Fbx_TableName_Description+t.name(),getColumns:function(){return u(t)}})}))})),n}function u(t){for(var n,i,r=[],o=0,u="";null!==u;)u=t.getColumnName(o),o++,null!==u&&r.push({name:u,description:""});return n=(0,e.sR)().d2t,i=(0,e.getMapping)()&&(0,e.getMapping)().tableFunctionsMapping,Object.keys(n).forEach((function(t){var e=n[t],o=e.name,u=e.description;o=i&&i[o]||o,r.push({name:o,description:u})})),r}function s(t){var n=[];return t.mp.forEach((function(t){n.push({name:t.name(),description:(0,e.sR)().Fbx_TableSheetName_Description+t.name(),getColumns:function(){return a(t)}})})),n}function a(t){var n,i=[],e=t.getColumnCount();for(n=0;n<e;n++)i.push({name:t.getColumnName(n),description:""});return i}n.getStructReferencesByWorkbook=r},"./dist/plugins/formulaPanel/formulaPanel.entry.js":function(t,n,i){var e,r,o,u,s,a,f,h=this&&this.JKr||(Object.create?function(t,n,i,e){void 0===e&&(e=i);var r=Object.getOwnPropertyDescriptor(n,i);r&&!("get"in r?!n.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return n[i]}}),Object.defineProperty(t,e,r)}:function(t,n,i,e){void 0===e&&(e=i),t[e]=n[i]}),c=this&&this.XKr||function(t,n){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(n,i)||h(n,t,i)};Object.defineProperty(n,"__esModule",{value:!0}),n.findControl=n.vve=n.Commands=n.FormulaEditor=void 0,e=i("Core"),i("./dist/plugins/formulaPanel/editor/formulaEditor-spreadjs.js"),i("./dist/plugins/formulaPanel/editor/formulaEditor-action.js"),r=i("./dist/plugins/formulaPanel/editor/formulaEditor.js"),o=i("./dist/plugins/formulaPanel/editor/featureProvider/lint.js"),u=i("./dist/plugins/formulaPanel/editor/common/formatter.js"),s=i("./dist/plugins/formulaPanel/editor/formulaEditor.js"),Object.defineProperty(n,"FormulaEditor",{enumerable:!0,get:function(){return s.FormulaEditor}}),a=i("./dist/plugins/formulaPanel/editor/formulaEditor-action.js"),Object.defineProperty(n,"Commands",{enumerable:!0,get:function(){return a.Commands}}),n.vve={mve:o.getDiagnostic,I5:u.format},c(i("./dist/plugins/formulaPanel/editor/editor.ns.js"),n),f=function(t){return"string"==typeof t&&(t=document.getElementById(t)),(0,e.GC$)(t).data(r.CONST_FORMULA_EDITOR)},n.findControl=f},CalcEngine:function(n){n.exports=t.Spread.CalcEngine},Common:function(n){n.exports=t.Spread},Core:function(n){n.exports=t.Spread.Sheets},FormulaTextBox:function(n){n.exports=t.Spread.Sheets.FormulaTextBox},SheetsCalc:function(n){n.exports=t.Spread.Sheets.CalcEngine}},e={};function r(t){var n,o=e[t];return void 0!==o?o.exports:(n=e[t]={exports:{}},i[t].call(n.exports,n,n.exports,r),n.exports)}n=r("./dist/plugins/formulaPanel/formulaPanel.entry.js"),(((t=void 0===t?{}:t).Spread=t.Spread||{}).Sheets=t.Spread.Sheets||{}).FormulaPanel=n}(),t.Spread.Common.CultureManager.reloadResources&&t.Spread.Common.CultureManager.reloadResources("FormulaPanel")}));