From a04ec385130326a45c2bbd16d2db8e1bf095e0cb Mon Sep 17 00:00:00 2001 From: Adam Freidin Date: Thu, 5 Sep 2024 14:19:04 -0700 Subject: [PATCH] astro docs --- .gitignore | 1 + .nojekyll | 0 404.html | 60 + _astro/CodeMirror.BprfeSgn.js | 23 + _astro/KvPlayground.CGaUbB3T.js | 1 + _astro/PardonApplication.CGiMqu1Y.js | 1 + _astro/PardonPlayground.DSofBvNB.js | 6 + _astro/PardonPlaygroundLoader.B5xqmHkS.js | 3 + _astro/PardonPlaygroundLoader.DsO9Zd4c.js | 1 + _astro/ProductsView.DlkPrtPF.js | 1 + ...astro_type_script_index_0_lang.3nBd5krW.js | 1 + _astro/TestcasePlayground.Px7bhs-p.js | 1 + _astro/TestcasePlaygroundLoader.Cw96gKWd.js | 2 + _astro/api.3y1TnKr0.js | 1 + _astro/client.BlFyJLno.js | 1 + _astro/ec.8zarh.js | 3 + _astro/ec.j8ofn.css | 1 + _astro/hoisted.2TlRMASD.js | 2 + _astro/index.4VmesigZ.js | 1 + _astro/index.CSu0d8hT.css | 1 + _astro/lexer-CgIEgaNo.BGGAnFgt.js | 138 + _astro/page.7qqag-5g.js | 1 + _astro/pardon-Dbc5z6SD.DxyttN9Z.js | 49 + _astro/pardon-icon.DMh8nY6a_1ml4ej.svg | 52 + _astro/pardon-icon.DMh8nY6a_ZFhnyX.svg | 52 + _astro/playground-icons.DtPjAd2H.css | 1 + _astro/playground-mood.CFJWbv0F.css | 1 + _astro/preload-helper.CaDgunLA.js | 1 + _astro/products-server-hook.Duq5ctrJ.js | 1 + _astro/testcase-table.cKr1243y.css | 1 + _astro/trial-Df-0_jpB.Cx90g8F9.js | 30966 ++++++++++++++++ _astro/ui-core.C99k2Mmj.js | 2 + _astro/web.Djz3GSgY.js | 1 + faq/index.html | 116 + favicon.svg | 45 + guides/index.html | 87 + index.html | 69 + intro/collections/index.html | 217 + intro/dataflow/index.html | 242 + intro/index.html | 163 + intro/layers/index.html | 123 + intro/patterns/index.html | 110 + intro/quickstart/index.html | 156 + intro/schemas/index.html | 125 + intro/scripting/index.html | 166 + intro/templates/index.html | 191 + intro/testcases/index.html | 325 + pagefind/fragment/en_1d175ef.pf_fragment | Bin 0 -> 357 bytes pagefind/fragment/en_269ab09.pf_fragment | Bin 0 -> 4832 bytes pagefind/fragment/en_3d159d3.pf_fragment | Bin 0 -> 4762 bytes pagefind/fragment/en_80a2925.pf_fragment | Bin 0 -> 1112 bytes pagefind/fragment/en_8eabda2.pf_fragment | Bin 0 -> 2666 bytes pagefind/fragment/en_a6de4c6.pf_fragment | Bin 0 -> 543 bytes pagefind/fragment/en_a7ff605.pf_fragment | Bin 0 -> 1151 bytes pagefind/fragment/en_aa34157.pf_fragment | Bin 0 -> 2332 bytes pagefind/fragment/en_b637e0b.pf_fragment | Bin 0 -> 829 bytes pagefind/fragment/en_b67143f.pf_fragment | Bin 0 -> 3159 bytes pagefind/fragment/en_cca609c.pf_fragment | Bin 0 -> 3825 bytes pagefind/fragment/en_d2c5952.pf_fragment | Bin 0 -> 3180 bytes pagefind/fragment/en_dc131e4.pf_fragment | Bin 0 -> 1843 bytes pagefind/fragment/en_e657c8f.pf_fragment | Bin 0 -> 1425 bytes pagefind/fragment/en_eb3df89.pf_fragment | Bin 0 -> 3357 bytes pagefind/fragment/en_ec325da.pf_fragment | Bin 0 -> 1708 bytes pagefind/fragment/en_f5c3754.pf_fragment | Bin 0 -> 6429 bytes pagefind/index/en_2158f6c.pf_index | Bin 0 -> 11307 bytes pagefind/index/en_e7599a3.pf_index | Bin 0 -> 37287 bytes pagefind/pagefind-entry.json | 1 + pagefind/pagefind-highlight.js | 1069 + pagefind/pagefind-modular-ui.css | 214 + pagefind/pagefind-modular-ui.js | 8 + pagefind/pagefind-ui.css | 1 + pagefind/pagefind-ui.js | 2 + pagefind/pagefind.en_eb889c5de3.pf_meta | Bin 0 -> 249 bytes pagefind/pagefind.js | 9 + pagefind/wasm.en.pagefind | Bin 0 -> 70755 bytes pagefind/wasm.unknown.pagefind | Bin 0 -> 66775 bytes reference/https-format/index.html | 105 + sitemap-0.xml | 1 + sitemap-index.xml | 1 + tech/causality/index.html | 182 + tech/kv/index.html | 102 + tech/schema-tech/index.html | 209 + 82 files changed, 35416 insertions(+) create mode 100644 .gitignore create mode 100644 .nojekyll create mode 100644 404.html create mode 100644 _astro/CodeMirror.BprfeSgn.js create mode 100644 _astro/KvPlayground.CGaUbB3T.js create mode 100644 _astro/PardonApplication.CGiMqu1Y.js create mode 100644 _astro/PardonPlayground.DSofBvNB.js create mode 100644 _astro/PardonPlaygroundLoader.B5xqmHkS.js create mode 100644 _astro/PardonPlaygroundLoader.DsO9Zd4c.js create mode 100644 _astro/ProductsView.DlkPrtPF.js create mode 100644 _astro/Tabs.astro_astro_type_script_index_0_lang.3nBd5krW.js create mode 100644 _astro/TestcasePlayground.Px7bhs-p.js create mode 100644 _astro/TestcasePlaygroundLoader.Cw96gKWd.js create mode 100644 _astro/api.3y1TnKr0.js create mode 100644 _astro/client.BlFyJLno.js create mode 100644 _astro/ec.8zarh.js create mode 100644 _astro/ec.j8ofn.css create mode 100644 _astro/hoisted.2TlRMASD.js create mode 100644 _astro/index.4VmesigZ.js create mode 100644 _astro/index.CSu0d8hT.css create mode 100644 _astro/lexer-CgIEgaNo.BGGAnFgt.js create mode 100644 _astro/page.7qqag-5g.js create mode 100644 _astro/pardon-Dbc5z6SD.DxyttN9Z.js create mode 100644 _astro/pardon-icon.DMh8nY6a_1ml4ej.svg create mode 100644 _astro/pardon-icon.DMh8nY6a_ZFhnyX.svg create mode 100644 _astro/playground-icons.DtPjAd2H.css create mode 100644 _astro/playground-mood.CFJWbv0F.css create mode 100644 _astro/preload-helper.CaDgunLA.js create mode 100644 _astro/products-server-hook.Duq5ctrJ.js create mode 100644 _astro/testcase-table.cKr1243y.css create mode 100644 _astro/trial-Df-0_jpB.Cx90g8F9.js create mode 100644 _astro/ui-core.C99k2Mmj.js create mode 100644 _astro/web.Djz3GSgY.js create mode 100644 faq/index.html create mode 100644 favicon.svg create mode 100644 guides/index.html create mode 100644 index.html create mode 100644 intro/collections/index.html create mode 100644 intro/dataflow/index.html create mode 100644 intro/index.html create mode 100644 intro/layers/index.html create mode 100644 intro/patterns/index.html create mode 100644 intro/quickstart/index.html create mode 100644 intro/schemas/index.html create mode 100644 intro/scripting/index.html create mode 100644 intro/templates/index.html create mode 100644 intro/testcases/index.html create mode 100644 pagefind/fragment/en_1d175ef.pf_fragment create mode 100644 pagefind/fragment/en_269ab09.pf_fragment create mode 100644 pagefind/fragment/en_3d159d3.pf_fragment create mode 100644 pagefind/fragment/en_80a2925.pf_fragment create mode 100644 pagefind/fragment/en_8eabda2.pf_fragment create mode 100644 pagefind/fragment/en_a6de4c6.pf_fragment create mode 100644 pagefind/fragment/en_a7ff605.pf_fragment create mode 100644 pagefind/fragment/en_aa34157.pf_fragment create mode 100644 pagefind/fragment/en_b637e0b.pf_fragment create mode 100644 pagefind/fragment/en_b67143f.pf_fragment create mode 100644 pagefind/fragment/en_cca609c.pf_fragment create mode 100644 pagefind/fragment/en_d2c5952.pf_fragment create mode 100644 pagefind/fragment/en_dc131e4.pf_fragment create mode 100644 pagefind/fragment/en_e657c8f.pf_fragment create mode 100644 pagefind/fragment/en_eb3df89.pf_fragment create mode 100644 pagefind/fragment/en_ec325da.pf_fragment create mode 100644 pagefind/fragment/en_f5c3754.pf_fragment create mode 100644 pagefind/index/en_2158f6c.pf_index create mode 100644 pagefind/index/en_e7599a3.pf_index create mode 100644 pagefind/pagefind-entry.json create mode 100644 pagefind/pagefind-highlight.js create mode 100644 pagefind/pagefind-modular-ui.css create mode 100644 pagefind/pagefind-modular-ui.js create mode 100644 pagefind/pagefind-ui.css create mode 100644 pagefind/pagefind-ui.js create mode 100644 pagefind/pagefind.en_eb889c5de3.pf_meta create mode 100644 pagefind/pagefind.js create mode 100644 pagefind/wasm.en.pagefind create mode 100644 pagefind/wasm.unknown.pagefind create mode 100644 reference/https-format/index.html create mode 100644 sitemap-0.xml create mode 100644 sitemap-index.xml create mode 100644 tech/causality/index.html create mode 100644 tech/kv/index.html create mode 100644 tech/schema-tech/index.html diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..e43b0f98 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.DS_Store diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 00000000..e69de29b diff --git a/404.html b/404.html new file mode 100644 index 00000000..642b41e1 --- /dev/null +++ b/404.html @@ -0,0 +1,60 @@ + 404 | Pardon + + Skip to content

404

Page not found. Check the URL or try using the search bar.
Copyright 2024 Adobe. All rights reserved
\ No newline at end of file diff --git a/_astro/CodeMirror.BprfeSgn.js b/_astro/CodeMirror.BprfeSgn.js new file mode 100644 index 00000000..e4355b29 --- /dev/null +++ b/_astro/CodeMirror.BprfeSgn.js @@ -0,0 +1,23 @@ +import{k as pe,E as Te,a as Vn,G as ia,q as sa,u as na,c as Ie,j as ra,g as _n,h as oa,v as la,n as aa,i as Dn,e as ha,S as ca,r as fa,t as ho}from"./web.Djz3GSgY.js";class W{lineAt(t){if(t<0||t>this.length)throw new RangeError(`Invalid position ${t} in document of length ${this.length}`);return this.lineInner(t,!1,1,0)}line(t){if(t<1||t>this.lines)throw new RangeError(`Invalid line number ${t} in ${this.lines}-line document`);return this.lineInner(t,!0,1,0)}replace(t,e,i){[t,e]=Ae(this,t,e);let s=[];return this.decompose(0,t,s,2),i.length&&i.decompose(0,i.length,s,3),this.decompose(e,this.length,s,1),At.from(s,this.length-(e-t)+i.length)}append(t){return this.replace(this.length,this.length,t)}slice(t,e=this.length){[t,e]=Ae(this,t,e);let i=[];return this.decompose(t,e,i,0),At.from(i,e-t)}eq(t){if(t==this)return!0;if(t.length!=this.length||t.lines!=this.lines)return!1;let e=this.scanIdentical(t,1),i=this.length-this.scanIdentical(t,-1),s=new Je(this),r=new Je(t);for(let o=e,l=e;;){if(s.next(o),r.next(o),o=0,s.lineBreak!=r.lineBreak||s.done!=r.done||s.value!=r.value)return!1;if(l+=s.value.length,s.done||l>=i)return!0}}iter(t=1){return new Je(this,t)}iterRange(t,e=this.length){return new co(this,t,e)}iterLines(t,e){let i;if(t==null)i=this.iter();else{e==null&&(e=this.lines+1);let s=this.line(t).from;i=this.iterRange(s,Math.max(s,e==this.lines+1?this.length:e<=1?0:this.line(e-1).to))}return new fo(i)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}constructor(){}static of(t){if(t.length==0)throw new RangeError("A document must have at least one line");return t.length==1&&!t[0]?W.empty:t.length<=32?new L(t):At.from(L.split(t,[]))}}class L extends W{constructor(t,e=Oa(t)){super(),this.text=t,this.length=e}get lines(){return this.text.length}get children(){return null}lineInner(t,e,i,s){for(let r=0;;r++){let o=this.text[r],l=s+o.length;if((e?i:l)>=t)return new ua(s,l,i,o);s=l+1,i++}}decompose(t,e,i,s){let r=t<=0&&e>=this.length?this:new L(Gn(this.text,t,e),Math.min(e,this.length)-Math.max(0,t));if(s&1){let o=i.pop(),l=Wi(r.text,o.text.slice(),0,r.length);if(l.length<=32)i.push(new L(l,o.length+r.length));else{let a=l.length>>1;i.push(new L(l.slice(0,a)),new L(l.slice(a)))}}else i.push(r)}replace(t,e,i){if(!(i instanceof L))return super.replace(t,e,i);[t,e]=Ae(this,t,e);let s=Wi(this.text,Wi(i.text,Gn(this.text,0,t)),e),r=this.length+i.length-(e-t);return s.length<=32?new L(s,r):At.from(L.split(s,[]),r)}sliceString(t,e=this.length,i=` +`){[t,e]=Ae(this,t,e);let s="";for(let r=0,o=0;r<=e&&ot&&o&&(s+=i),tr&&(s+=l.slice(Math.max(0,t-r),e-r)),r=a+1}return s}flatten(t){for(let e of this.text)t.push(e)}scanIdentical(){return 0}static split(t,e){let i=[],s=-1;for(let r of t)i.push(r),s+=r.length+1,i.length==32&&(e.push(new L(i,s)),i=[],s=-1);return s>-1&&e.push(new L(i,s)),e}}class At extends W{constructor(t,e){super(),this.children=t,this.length=e,this.lines=0;for(let i of t)this.lines+=i.lines}lineInner(t,e,i,s){for(let r=0;;r++){let o=this.children[r],l=s+o.length,a=i+o.lines-1;if((e?a:l)>=t)return o.lineInner(t,e,i,s);s=l+1,i=a+1}}decompose(t,e,i,s){for(let r=0,o=0;o<=e&&r=o){let h=s&((o<=t?1:0)|(a>=e?2:0));o>=t&&a<=e&&!h?i.push(l):l.decompose(t-o,e-o,i,h)}o=a+1}}replace(t,e,i){if([t,e]=Ae(this,t,e),i.lines=r&&e<=l){let a=o.replace(t-r,e-r,i),h=this.lines-o.lines+a.lines;if(a.lines>4&&a.lines>h>>6){let c=this.children.slice();return c[s]=a,new At(c,this.length-(e-t)+i.length)}return super.replace(r,l,a)}r=l+1}return super.replace(t,e,i)}sliceString(t,e=this.length,i=` +`){[t,e]=Ae(this,t,e);let s="";for(let r=0,o=0;rt&&r&&(s+=i),to&&(s+=l.sliceString(t-o,e-o,i)),o=a+1}return s}flatten(t){for(let e of this.children)e.flatten(t)}scanIdentical(t,e){if(!(t instanceof At))return 0;let i=0,[s,r,o,l]=e>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;s+=e,r+=e){if(s==o||r==l)return i;let a=this.children[s],h=t.children[r];if(a!=h)return i+a.scanIdentical(h,e);i+=a.length+1}}static from(t,e=t.reduce((i,s)=>i+s.length+1,-1)){let i=0;for(let u of t)i+=u.lines;if(i<32){let u=[];for(let d of t)d.flatten(u);return new L(u,e)}let s=Math.max(32,i>>5),r=s<<1,o=s>>1,l=[],a=0,h=-1,c=[];function f(u){let d;if(u.lines>r&&u instanceof At)for(let p of u.children)f(p);else u.lines>o&&(a>o||!a)?(O(),l.push(u)):u instanceof L&&a&&(d=c[c.length-1])instanceof L&&u.lines+d.lines<=32?(a+=u.lines,h+=u.length+1,c[c.length-1]=new L(d.text.concat(u.text),d.length+1+u.length)):(a+u.lines>s&&O(),a+=u.lines,h+=u.length+1,c.push(u))}function O(){a!=0&&(l.push(c.length==1?c[0]:At.from(c,h)),h=-1,a=c.length=0)}for(let u of t)f(u);return O(),l.length==1?l[0]:new At(l,e)}}W.empty=new L([""],0);function Oa(n){let t=-1;for(let e of n)t+=e.length+1;return t}function Wi(n,t,e=0,i=1e9){for(let s=0,r=0,o=!0;r=e&&(a>i&&(l=l.slice(0,i-s)),s0?1:(t instanceof L?t.text.length:t.children.length)<<1]}nextInner(t,e){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,s=this.nodes[i],r=this.offsets[i],o=r>>1,l=s instanceof L?s.text.length:s.children.length;if(o==(e>0?l:0)){if(i==0)return this.done=!0,this.value="",this;e>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((r&1)==(e>0?0:1)){if(this.offsets[i]+=e,t==0)return this.lineBreak=!0,this.value=` +`,this;t--}else if(s instanceof L){let a=s.text[o+(e<0?-1:0)];if(this.offsets[i]+=e,a.length>Math.max(0,t))return this.value=t==0?a:e>0?a.slice(t):a.slice(0,a.length-t),this;t-=a.length}else{let a=s.children[o+(e<0?-1:0)];t>a.length?(t-=a.length,this.offsets[i]+=e):(e<0&&this.offsets[i]--,this.nodes.push(a),this.offsets.push(e>0?1:(a instanceof L?a.text.length:a.children.length)<<1))}}}next(t=0){return t<0&&(this.nextInner(-t,-this.dir),t=this.value.length),this.nextInner(t,this.dir)}}class co{constructor(t,e,i){this.value="",this.done=!1,this.cursor=new Je(t,e>i?-1:1),this.pos=e>i?t.length:0,this.from=Math.min(e,i),this.to=Math.max(e,i)}nextInner(t,e){if(e<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;t+=Math.max(0,e<0?this.pos-this.to:this.from-this.pos);let i=e<0?this.pos-this.from:this.to-this.pos;t>i&&(t=i),i-=t;let{value:s}=this.cursor.next(t);return this.pos+=(s.length+t)*e,this.value=s.length<=i?s:e<0?s.slice(s.length-i):s.slice(0,i),this.done=!this.value,this}next(t=0){return t<0?t=Math.max(t,this.from-this.pos):t>0&&(t=Math.min(t,this.to-this.pos)),this.nextInner(t,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class fo{constructor(t){this.inner=t,this.afterBreak=!0,this.value="",this.done=!1}next(t=0){let{done:e,lineBreak:i,value:s}=this.inner.next(t);return e&&this.afterBreak?(this.value="",this.afterBreak=!1):e?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(W.prototype[Symbol.iterator]=function(){return this.iter()},Je.prototype[Symbol.iterator]=co.prototype[Symbol.iterator]=fo.prototype[Symbol.iterator]=function(){return this});class ua{constructor(t,e,i,s){this.from=t,this.to=e,this.number=i,this.text=s}get length(){return this.to-this.from}}function Ae(n,t,e){return t=Math.max(0,Math.min(n.length,t)),[t,Math.max(t,Math.min(n.length,e))]}let Pe="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(n=>n?parseInt(n,36):1);for(let n=1;nn)return Pe[t-1]<=n;return!1}function Nn(n){return n>=127462&&n<=127487}const In=8205;function Et(n,t,e=!0,i=!0){return(e?Oo:pa)(n,t,i)}function Oo(n,t,e){if(t==n.length)return t;t&&uo(n.charCodeAt(t))&&po(n.charCodeAt(t-1))&&t--;let i=Yi(n,t);for(t+=As(i);t=0&&Nn(Yi(n,o));)r++,o-=2;if(r%2==0)break;t+=2}else break}return t}function pa(n,t,e){for(;t>0;){let i=Oo(n,t-2,e);if(i=56320&&n<57344}function po(n){return n>=55296&&n<56320}function Yi(n,t){let e=n.charCodeAt(t);if(!po(e)||t+1==n.length)return e;let i=n.charCodeAt(t+1);return uo(i)?(e-55296<<10)+(i-56320)+65536:e}function As(n){return n<65536?1:2}const Cs=/\r\n?|\n/;var lt=function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n}(lt||(lt={}));class Mt{constructor(t){this.sections=t}get length(){let t=0;for(let e=0;et)return r+(t-s);r+=l}else{if(i!=lt.Simple&&h>=t&&(i==lt.TrackDel&&st||i==lt.TrackBefore&&st))return null;if(h>t||h==t&&e<0&&!l)return t==s||e<0?r:r+a;r+=a}s=h}if(t>s)throw new RangeError(`Position ${t} is out of range for changeset of length ${s}`);return r}touchesRange(t,e=t){for(let i=0,s=0;i=0&&s<=e&&l>=t)return se?"cover":!0;s=l}return!1}toString(){let t="";for(let e=0;e=0?":"+s:"")}return t}toJSON(){return this.sections}static fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some(e=>typeof e!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Mt(t)}static create(t){return new Mt(t)}}class J extends Mt{constructor(t,e){super(t),this.inserted=e}apply(t){if(this.length!=t.length)throw new RangeError("Applying change set to a document with the wrong length");return Xs(this,(e,i,s,r,o)=>t=t.replace(s,s+(i-e),o),!1),t}mapDesc(t,e=!1){return Ws(this,t,e,!0)}invert(t){let e=this.sections.slice(),i=[];for(let s=0,r=0;s=0){e[s]=l,e[s+1]=o;let a=s>>1;for(;i.length0&&ee(i,e,r.text),r.forward(c),l+=c}let h=t[o++];for(;l>1].toJSON()))}return t}static of(t,e,i){let s=[],r=[],o=0,l=null;function a(c=!1){if(!c&&!s.length)return;oO||f<0||O>e)throw new RangeError(`Invalid change range ${f} to ${O} (in doc of length ${e})`);let d=u?typeof u=="string"?W.of(u.split(i||Cs)):u:W.empty,p=d.length;if(f==O&&p==0)return;fo&&rt(s,f-o,-1),rt(s,O-f,p),ee(r,s,d),o=O}}return h(t),a(!l),l}static empty(t){return new J(t?[t,-1]:[],[])}static fromJSON(t){if(!Array.isArray(t))throw new RangeError("Invalid JSON representation of ChangeSet");let e=[],i=[];for(let s=0;sl&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(r.length==1)e.push(r[0],0);else{for(;i.length=0&&e<=0&&e==n[s+1]?n[s]+=t:t==0&&n[s]==0?n[s+1]+=e:i?(n[s]+=t,n[s+1]+=e):n.push(t,e)}function ee(n,t,e){if(e.length==0)return;let i=t.length-2>>1;if(i>1])),!(e||o==n.sections.length||n.sections[o+1]<0);)l=n.sections[o++],a=n.sections[o++];t(s,h,r,c,f),s=h,r=c}}}function Ws(n,t,e,i=!1){let s=[],r=i?[]:null,o=new si(n),l=new si(t);for(let a=-1;;)if(o.ins==-1&&l.ins==-1){let h=Math.min(o.len,l.len);rt(s,h,-1),o.forward(h),l.forward(h)}else if(l.ins>=0&&(o.ins<0||a==o.i||o.off==0&&(l.len=0&&a=0){let h=0,c=o.len;for(;c;)if(l.ins==-1){let f=Math.min(c,l.len);h+=f,c-=f,l.forward(f)}else if(l.ins==0&&l.lena||o.ins>=0&&o.len>a)&&(l||i.length>h),r.forward2(a),o.forward(a)}}}}class si{constructor(t){this.set=t,this.i=0,this.next()}next(){let{sections:t}=this.set;this.i>1;return e>=t.length?W.empty:t[e]}textBit(t){let{inserted:e}=this.set,i=this.i-2>>1;return i>=e.length&&!t?W.empty:e[i].slice(this.off,t==null?void 0:this.off+t)}forward(t){t==this.len?this.next():(this.len-=t,this.off+=t)}forward2(t){this.ins==-1?this.forward(t):t==this.ins?this.next():(this.ins-=t,this.off+=t)}}class fe{constructor(t,e,i){this.from=t,this.to=e,this.flags=i}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let t=this.flags&7;return t==7?null:t}get goalColumn(){let t=this.flags>>6;return t==16777215?void 0:t}map(t,e=-1){let i,s;return this.empty?i=s=t.mapPos(this.from,e):(i=t.mapPos(this.from,1),s=t.mapPos(this.to,-1)),i==this.from&&s==this.to?this:new fe(i,s,this.flags)}extend(t,e=t){if(t<=this.anchor&&e>=this.anchor)return P.range(t,e);let i=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return P.range(this.anchor,i)}eq(t,e=!1){return this.anchor==t.anchor&&this.head==t.head&&(!e||!this.empty||this.assoc==t.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(t){if(!t||typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return P.range(t.anchor,t.head)}static create(t,e,i){return new fe(t,e,i)}}class P{constructor(t,e){this.ranges=t,this.mainIndex=e}map(t,e=-1){return t.empty?this:P.create(this.ranges.map(i=>i.map(t,e)),this.mainIndex)}eq(t,e=!1){if(this.ranges.length!=t.ranges.length||this.mainIndex!=t.mainIndex)return!1;for(let i=0;it.toJSON()),main:this.mainIndex}}static fromJSON(t){if(!t||!Array.isArray(t.ranges)||typeof t.main!="number"||t.main>=t.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new P(t.ranges.map(e=>fe.fromJSON(e)),t.main)}static single(t,e=t){return new P([P.range(t,e)],0)}static create(t,e=0){if(t.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,s=0;st?8:0)|r)}static normalized(t,e=0){let i=t[e];t.sort((s,r)=>s.from-r.from),e=t.indexOf(i);for(let s=1;sr.head?P.range(a,l):P.range(l,a))}}return new P(t,e)}}function mo(n,t){for(let e of n.ranges)if(e.to>t)throw new RangeError("Selection points outside of document")}let yn=0;class v{constructor(t,e,i,s,r){this.combine=t,this.compareInput=e,this.compare=i,this.isStatic=s,this.id=yn++,this.default=t([]),this.extensions=typeof r=="function"?r(this):r}get reader(){return this}static define(t={}){return new v(t.combine||(e=>e),t.compareInput||((e,i)=>e===i),t.compare||(t.combine?(e,i)=>e===i:Sn),!!t.static,t.enables)}of(t){return new Mi([],this,0,t)}compute(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new Mi(t,this,1,e)}computeN(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new Mi(t,this,2,e)}from(t,e){return e||(e=i=>i),this.compute([t],i=>e(i.field(t)))}}function Sn(n,t){return n==t||n.length==t.length&&n.every((e,i)=>e===t[i])}class Mi{constructor(t,e,i,s){this.dependencies=t,this.facet=e,this.type=i,this.value=s,this.id=yn++}dynamicSlot(t){var e;let i=this.value,s=this.facet.compareInput,r=this.id,o=t[r]>>1,l=this.type==2,a=!1,h=!1,c=[];for(let f of this.dependencies)f=="doc"?a=!0:f=="selection"?h=!0:((e=t[f.id])!==null&&e!==void 0?e:1)&1||c.push(t[f.id]);return{create(f){return f.values[o]=i(f),1},update(f,O){if(a&&O.docChanged||h&&(O.docChanged||O.selection)||Ys(f,c)){let u=i(f);if(l?!Bn(u,f.values[o],s):!s(u,f.values[o]))return f.values[o]=u,1}return 0},reconfigure:(f,O)=>{let u,d=O.config.address[r];if(d!=null){let p=_i(O,d);if(this.dependencies.every(g=>g instanceof v?O.facet(g)===f.facet(g):g instanceof Nt?O.field(g,!1)==f.field(g,!1):!0)||(l?Bn(u=i(f),p,s):s(u=i(f),p)))return f.values[o]=p,0}else u=i(f);return f.values[o]=u,1}}}}function Bn(n,t,e){if(n.length!=t.length)return!1;for(let i=0;in[a.id]),s=e.map(a=>a.type),r=i.filter(a=>!(a&1)),o=n[t.id]>>1;function l(a){let h=[];for(let c=0;ci===s),t);return t.provide&&(e.provides=t.provide(e)),e}create(t){let e=t.facet(Ln).find(i=>i.field==this);return(e?.create||this.createF)(t)}slot(t){let e=t[this.id]>>1;return{create:i=>(i.values[e]=this.create(i),1),update:(i,s)=>{let r=i.values[e],o=this.updateF(r,s);return this.compareF(r,o)?0:(i.values[e]=o,1)},reconfigure:(i,s)=>s.config.address[this.id]!=null?(i.values[e]=s.field(this),0):(i.values[e]=this.create(i),1)}}init(t){return[this,Ln.of({field:this,create:t})]}get extension(){return this}}const ce={lowest:4,low:3,default:2,high:1,highest:0};function je(n){return t=>new bo(t,n)}const Oi={highest:je(ce.highest),high:je(ce.high),default:je(ce.default),low:je(ce.low),lowest:je(ce.lowest)};class bo{constructor(t,e){this.inner=t,this.prec=e}}class ui{of(t){return new Ms(this,t)}reconfigure(t){return ui.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class Ms{constructor(t,e){this.compartment=t,this.inner=e}}class Vi{constructor(t,e,i,s,r,o){for(this.base=t,this.compartments=e,this.dynamicSlots=i,this.address=s,this.staticValues=r,this.facets=o,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(t,e,i){let s=[],r=Object.create(null),o=new Map;for(let O of ma(t,e,o))O instanceof Nt?s.push(O):(r[O.facet.id]||(r[O.facet.id]=[])).push(O);let l=Object.create(null),a=[],h=[];for(let O of s)l[O.id]=h.length<<1,h.push(u=>O.slot(u));let c=i?.config.facets;for(let O in r){let u=r[O],d=u[0].facet,p=c&&c[O]||[];if(u.every(g=>g.type==0))if(l[d.id]=a.length<<1|1,Sn(p,u))a.push(i.facet(d));else{let g=d.combine(u.map(b=>b.value));a.push(i&&d.compare(g,i.facet(d))?i.facet(d):g)}else{for(let g of u)g.type==0?(l[g.id]=a.length<<1|1,a.push(g.value)):(l[g.id]=h.length<<1,h.push(b=>g.dynamicSlot(b)));l[d.id]=h.length<<1,h.push(g=>ga(g,d,u))}}let f=h.map(O=>O(l));return new Vi(t,o,f,l,a,r)}}function ma(n,t,e){let i=[[],[],[],[],[]],s=new Map;function r(o,l){let a=s.get(o);if(a!=null){if(a<=l)return;let h=i[a].indexOf(o);h>-1&&i[a].splice(h,1),o instanceof Ms&&e.delete(o.compartment)}if(s.set(o,l),Array.isArray(o))for(let h of o)r(h,l);else if(o instanceof Ms){if(e.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=t.get(o.compartment)||o.inner;e.set(o.compartment,h),r(h,l)}else if(o instanceof bo)r(o.inner,o.prec);else if(o instanceof Nt)i[l].push(o),o.provides&&r(o.provides,l);else if(o instanceof Mi)i[l].push(o),o.facet.extensions&&r(o.facet.extensions,ce.default);else{let h=o.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);r(h,l)}}return r(n,ce.default),i.reduce((o,l)=>o.concat(l))}function ti(n,t){if(t&1)return 2;let e=t>>1,i=n.status[e];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;n.status[e]=4;let s=n.computeSlot(n,n.config.dynamicSlots[e]);return n.status[e]=2|s}function _i(n,t){return t&1?n.config.staticValues[t>>1]:n.values[t>>1]}const Qo=v.define(),zs=v.define({combine:n=>n.some(t=>t),static:!0}),yo=v.define({combine:n=>n.length?n[0]:void 0,static:!0}),So=v.define(),xo=v.define(),wo=v.define(),Po=v.define({combine:n=>n.length?n[0]:!1});class It{constructor(t,e){this.type=t,this.value=e}static define(){return new ba}}class ba{of(t){return new It(this,t)}}class Qa{constructor(t){this.map=t}of(t){return new N(this,t)}}class N{constructor(t,e){this.type=t,this.value=e}map(t){let e=this.type.map(this.value,t);return e===void 0?void 0:e==this.value?this:new N(this.type,e)}is(t){return this.type==t}static define(t={}){return new Qa(t.map||(e=>e))}static mapEffects(t,e){if(!t.length)return t;let i=[];for(let s of t){let r=s.map(e);r&&i.push(r)}return i}}N.reconfigure=N.define();N.appendConfig=N.define();class H{constructor(t,e,i,s,r,o){this.startState=t,this.changes=e,this.selection=i,this.effects=s,this.annotations=r,this.scrollIntoView=o,this._doc=null,this._state=null,i&&mo(i,e.newLength),r.some(l=>l.type==H.time)||(this.annotations=r.concat(H.time.of(Date.now())))}static create(t,e,i,s,r,o){return new H(t,e,i,s,r,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(t){for(let e of this.annotations)if(e.type==t)return e.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(t){let e=this.annotation(H.userEvent);return!!(e&&(e==t||e.length>t.length&&e.slice(0,t.length)==t&&e[t.length]=="."))}}H.time=It.define();H.userEvent=It.define();H.addToHistory=It.define();H.remote=It.define();function ya(n,t){let e=[];for(let i=0,s=0;;){let r,o;if(i=n[i]))r=n[i++],o=n[i++];else if(s=0;s--){let r=i[s](n);r instanceof H?n=r:Array.isArray(r)&&r.length==1&&r[0]instanceof H?n=r[0]:n=ko(t,$e(r),!1)}return n}function xa(n){let t=n.startState,e=t.facet(wo),i=n;for(let s=e.length-1;s>=0;s--){let r=e[s](n);r&&Object.keys(r).length&&(i=$o(i,qs(t,r,n.changes.newLength),!0))}return i==n?n:H.create(t,n.changes,n.selection,i.effects,i.annotations,i.scrollIntoView)}const wa=[];function $e(n){return n==null?wa:Array.isArray(n)?n:[n]}var Vt=function(n){return n[n.Word=0]="Word",n[n.Space=1]="Space",n[n.Other=2]="Other",n}(Vt||(Vt={}));const Pa=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Us;try{Us=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function $a(n){if(Us)return Us.test(n);for(let t=0;t"€"&&(e.toUpperCase()!=e.toLowerCase()||Pa.test(e)))return!0}return!1}function ka(n){return t=>{if(!/\S/.test(t))return Vt.Space;if($a(t))return Vt.Word;for(let e=0;e-1)return Vt.Word;return Vt.Other}}class z{constructor(t,e,i,s,r,o){this.config=t,this.doc=e,this.selection=i,this.values=s,this.status=t.statusTemplate.slice(),this.computeSlot=r,o&&(o._state=this);for(let l=0;ls.set(h,a)),e=null),s.set(l.value.compartment,l.value.extension)):l.is(N.reconfigure)?(e=null,i=l.value):l.is(N.appendConfig)&&(e=null,i=$e(i).concat(l.value));let r;e?r=t.startState.values.slice():(e=Vi.resolve(i,s,this),r=new z(e,this.doc,this.selection,e.dynamicSlots.map(()=>null),(a,h)=>h.reconfigure(a,this),null).values);let o=t.startState.facet(zs)?t.newSelection:t.newSelection.asSingle();new z(e,t.newDoc,o,r,(l,a)=>a.update(l,t),t)}replaceSelection(t){return typeof t=="string"&&(t=this.toText(t)),this.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:t},range:P.cursor(e.from+t.length)}))}changeByRange(t){let e=this.selection,i=t(e.ranges[0]),s=this.changes(i.changes),r=[i.range],o=$e(i.effects);for(let l=1;lo.spec.fromJSON(l,a)))}}return z.create({doc:t.doc,selection:P.fromJSON(t.selection),extensions:e.extensions?s.concat([e.extensions]):s})}static create(t={}){let e=Vi.resolve(t.extensions||[],new Map),i=t.doc instanceof W?t.doc:W.of((t.doc||"").split(e.staticFacet(z.lineSeparator)||Cs)),s=t.selection?t.selection instanceof P?t.selection:P.single(t.selection.anchor,t.selection.head):P.single(0);return mo(s,i.length),e.staticFacet(zs)||(s=s.asSingle()),new z(e,i,s,e.dynamicSlots.map(()=>null),(r,o)=>o.create(r),null)}get tabSize(){return this.facet(z.tabSize)}get lineBreak(){return this.facet(z.lineSeparator)||` +`}get readOnly(){return this.facet(Po)}phrase(t,...e){for(let i of this.facet(z.phrases))if(Object.prototype.hasOwnProperty.call(i,t)){t=i[t];break}return e.length&&(t=t.replace(/\$(\$|\d*)/g,(i,s)=>{if(s=="$")return"$";let r=+(s||1);return!r||r>e.length?i:e[r-1]})),t}languageDataAt(t,e,i=-1){let s=[];for(let r of this.facet(Qo))for(let o of r(this,e,i))Object.prototype.hasOwnProperty.call(o,t)&&s.push(o[t]);return s}charCategorizer(t){return ka(this.languageDataAt("wordChars",t).join(""))}wordAt(t){let{text:e,from:i,length:s}=this.doc.lineAt(t),r=this.charCategorizer(t),o=t-i,l=t-i;for(;o>0;){let a=Et(e,o,!1);if(r(e.slice(a,o))!=Vt.Word)break;o=a}for(;ln.length?n[0]:4});z.lineSeparator=yo;z.readOnly=Po;z.phrases=v.define({compare(n,t){let e=Object.keys(n),i=Object.keys(t);return e.length==i.length&&e.every(s=>n[s]==t[s])}});z.languageData=Qo;z.changeFilter=So;z.transactionFilter=xo;z.transactionExtender=wo;ui.reconfigure=N.define();function Za(n,t,e={}){let i={};for(let s of n)for(let r of Object.keys(s)){let o=s[r],l=i[r];if(l===void 0)i[r]=o;else if(!(l===o||o===void 0))if(Object.hasOwnProperty.call(e,r))i[r]=e[r](l,o);else throw new Error("Config merge conflict for field "+r)}for(let s in t)i[s]===void 0&&(i[s]=t[s]);return i}class ge{eq(t){return this==t}range(t,e=t){return js.create(t,e,this)}}ge.prototype.startSide=ge.prototype.endSide=0;ge.prototype.point=!1;ge.prototype.mapMode=lt.TrackDel;let js=class Zo{constructor(t,e,i){this.from=t,this.to=e,this.value=i}static create(t,e,i){return new Zo(t,e,i)}};function Es(n,t){return n.from-t.from||n.value.startSide-t.value.startSide}class xn{constructor(t,e,i,s){this.from=t,this.to=e,this.value=i,this.maxPoint=s}get length(){return this.to[this.to.length-1]}findIndex(t,e,i,s=0){let r=i?this.to:this.from;for(let o=s,l=r.length;;){if(o==l)return o;let a=o+l>>1,h=r[a]-t||(i?this.value[a].endSide:this.value[a].startSide)-e;if(a==o)return h>=0?o:l;h>=0?l=a:o=a+1}}between(t,e,i,s){for(let r=this.findIndex(e,-1e9,!0),o=this.findIndex(i,1e9,!1,r);ru||O==u&&h.startSide>0&&h.endSide<=0)continue;(u-O||h.endSide-h.startSide)<0||(o<0&&(o=O),h.point&&(l=Math.max(l,u-O)),i.push(h),s.push(O-o),r.push(u-o))}return{mapped:i.length?new xn(s,r,i,l):null,pos:o}}}class G{constructor(t,e,i,s){this.chunkPos=t,this.chunk=e,this.nextLayer=i,this.maxPoint=s}static create(t,e,i,s){return new G(t,e,i,s)}get length(){let t=this.chunk.length-1;return t<0?0:Math.max(this.chunkEnd(t),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let t=this.nextLayer.size;for(let e of this.chunk)t+=e.value.length;return t}chunkEnd(t){return this.chunkPos[t]+this.chunk[t].length}update(t){let{add:e=[],sort:i=!1,filterFrom:s=0,filterTo:r=this.length}=t,o=t.filter;if(e.length==0&&!o)return this;if(i&&(e=e.slice().sort(Es)),this.isEmpty)return e.length?G.of(e):this;let l=new vo(this,null,-1).goto(0),a=0,h=[],c=new ni;for(;l.value||a=0){let f=e[a++];c.addInner(f.from,f.to,f.value)||h.push(f)}else l.rangeIndex==1&&l.chunkIndexthis.chunkEnd(l.chunkIndex)||rl.to||r=r&&t<=r+o.length&&o.between(r,t-r,e-r,i)===!1)return}this.nextLayer.between(t,e,i)}}iter(t=0){return ri.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,e=0){return ri.from(t).goto(e)}static compare(t,e,i,s,r=-1){let o=t.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=r),l=e.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=r),a=Fn(o,l,i),h=new Ee(o,a,r),c=new Ee(l,a,r);i.iterGaps((f,O,u)=>Hn(h,f,c,O,u,s)),i.empty&&i.length==0&&Hn(h,0,c,0,0,s)}static eq(t,e,i=0,s){s==null&&(s=999999999);let r=t.filter(c=>!c.isEmpty&&e.indexOf(c)<0),o=e.filter(c=>!c.isEmpty&&t.indexOf(c)<0);if(r.length!=o.length)return!1;if(!r.length)return!0;let l=Fn(r,o),a=new Ee(r,l,0).goto(i),h=new Ee(o,l,0).goto(i);for(;;){if(a.to!=h.to||!Vs(a.active,h.active)||a.point&&(!h.point||!a.point.eq(h.point)))return!1;if(a.to>s)return!0;a.next(),h.next()}}static spans(t,e,i,s,r=-1){let o=new Ee(t,null,r).goto(e),l=e,a=o.openStart;for(;;){let h=Math.min(o.to,i);if(o.point){let c=o.activeForPoint(o.to),f=o.pointFroml&&(s.span(l,h,o.active,a),a=o.openEnd(h));if(o.to>i)return a+(o.point&&o.to>i?1:0);l=o.to,o.next()}}static of(t,e=!1){let i=new ni;for(let s of t instanceof js?[t]:e?va(t):t)i.add(s.from,s.to,s.value);return i.finish()}static join(t){if(!t.length)return G.empty;let e=t[t.length-1];for(let i=t.length-2;i>=0;i--)for(let s=t[i];s!=G.empty;s=s.nextLayer)e=new G(s.chunkPos,s.chunk,e,Math.max(s.maxPoint,e.maxPoint));return e}}G.empty=new G([],[],null,-1);function va(n){if(n.length>1)for(let t=n[0],e=1;e0)return n.slice().sort(Es);t=i}return n}G.empty.nextLayer=G.empty;class ni{finishChunk(t){this.chunks.push(new xn(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,t&&(this.from=[],this.to=[],this.value=[])}constructor(){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}add(t,e,i){this.addInner(t,e,i)||(this.nextLayer||(this.nextLayer=new ni)).add(t,e,i)}addInner(t,e,i){let s=t-this.lastTo||i.startSide-this.last.endSide;if(s<=0&&(t-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return s<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=t),this.from.push(t-this.chunkStart),this.to.push(e-this.chunkStart),this.last=i,this.lastFrom=t,this.lastTo=e,this.value.push(i),i.point&&(this.maxPoint=Math.max(this.maxPoint,e-t)),!0)}addChunk(t,e){if((t-this.lastTo||e.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,e.maxPoint),this.chunks.push(e),this.chunkPos.push(t);let i=e.value.length-1;return this.last=e.value[i],this.lastFrom=e.from[i]+t,this.lastTo=e.to[i]+t,!0}finish(){return this.finishInner(G.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return t;let e=G.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,e}}function Fn(n,t,e){let i=new Map;for(let r of n)for(let o=0;o=this.minPoint)break}}setRangeIndex(t){if(t==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=i&&s.push(new vo(o,e,i,r));return s.length==1?s[0]:new ri(s)}get startSide(){return this.value?this.value.startSide:0}goto(t,e=-1e9){for(let i of this.heap)i.goto(t,e);for(let i=this.heap.length>>1;i>=0;i--)fs(this.heap,i);return this.next(),this}forward(t,e){for(let i of this.heap)i.forward(t,e);for(let i=this.heap.length>>1;i>=0;i--)fs(this.heap,i);(this.to-t||this.value.endSide-e)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let t=this.heap[0];this.from=t.from,this.to=t.to,this.value=t.value,this.rank=t.rank,t.value&&t.next(),fs(this.heap,0)}}}function fs(n,t){for(let e=n[t];;){let i=(t<<1)+1;if(i>=n.length)break;let s=n[i];if(i+1=0&&(s=n[i+1],i++),e.compare(s)<0)break;n[i]=e,n[t]=s,t=i}}class Ee{constructor(t,e,i){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=ri.from(t,e,i)}goto(t,e=-1e9){return this.cursor.goto(t,e),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=t,this.endSide=e,this.openStart=-1,this.next(),this}forward(t,e){for(;this.minActive>-1&&(this.activeTo[this.minActive]-t||this.active[this.minActive].endSide-e)<0;)this.removeActive(this.minActive);this.cursor.forward(t,e)}removeActive(t){Qi(this.active,t),Qi(this.activeTo,t),Qi(this.activeRank,t),this.minActive=Kn(this.active,this.activeTo)}addActive(t){let e=0,{value:i,to:s,rank:r}=this.cursor;for(;e0;)e++;yi(this.active,e,i),yi(this.activeTo,e,s),yi(this.activeRank,e,r),t&&yi(t,e,this.cursor.from),this.minActive=Kn(this.active,this.activeTo)}next(){let t=this.to,e=this.point;this.point=null;let i=this.openStart<0?[]:null;for(;;){let s=this.minActive;if(s>-1&&(this.activeTo[s]-this.cursor.from||this.active[s].endSide-this.cursor.startSide)<0){if(this.activeTo[s]>t){this.to=this.activeTo[s],this.endSide=this.active[s].endSide;break}this.removeActive(s),i&&Qi(i,s)}else if(this.cursor.value)if(this.cursor.from>t){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let r=this.cursor.value;if(!r.point)this.addActive(i),this.cursor.next();else if(e&&this.cursor.to==this.to&&this.cursor.from=0&&i[s]=0&&!(this.activeRank[i]t||this.activeTo[i]==t&&this.active[i].endSide>=this.point.endSide)&&e.push(this.active[i]);return e.reverse()}openEnd(t){let e=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>t;i--)e++;return e}}function Hn(n,t,e,i,s,r){n.goto(t),e.goto(i);let o=i+s,l=i,a=i-t;for(;;){let h=n.to+a-e.to||n.endSide-e.endSide,c=h<0?n.to+a:e.to,f=Math.min(c,o);if(n.point||e.point?n.point&&e.point&&(n.point==e.point||n.point.eq(e.point))&&Vs(n.activeForPoint(n.to),e.activeForPoint(e.to))||r.comparePoint(l,f,n.point,e.point):f>l&&!Vs(n.active,e.active)&&r.compareRange(l,f,n.active,e.active),c>o)break;l=c,h<=0&&n.next(),h>=0&&e.next()}}function Vs(n,t){if(n.length!=t.length)return!1;for(let e=0;e=t;i--)n[i+1]=n[i];n[t]=e}function Kn(n,t){let e=-1,i=1e9;for(let s=0;s=t)return s;if(s==n.length)break;r+=n.charCodeAt(s)==9?e-r%e:1,s=Et(n,s)}return i===!0?-1:n.length}const _s="ͼ",Jn=typeof Symbol>"u"?"__"+_s:Symbol.for(_s),Ds=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),tr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class se{constructor(t,e){this.rules=[];let{finish:i}=e||{};function s(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function r(o,l,a,h){let c=[],f=/^@(\w+)\b/.exec(o[0]),O=f&&f[1]=="keyframes";if(f&&l==null)return a.push(o[0]+";");for(let u in l){let d=l[u];if(/&/.test(u))r(u.split(/,\s*/).map(p=>o.map(g=>p.replace(/&/,g))).reduce((p,g)=>p.concat(g)),d,a);else if(d&&typeof d=="object"){if(!f)throw new RangeError("The value of a property ("+u+") should be a primitive value.");r(s(u),d,c,O)}else d!=null&&c.push(u.replace(/_.*/,"").replace(/[A-Z]/g,p=>"-"+p.toLowerCase())+": "+d+";")}(c.length||O)&&a.push((i&&!f&&!h?o.map(i):o).join(", ")+" {"+c.join(" ")+"}")}for(let o in t)r(s(o),t[o],this.rules)}getRules(){return this.rules.join(` +`)}static newName(){let t=tr[Jn]||1;return tr[Jn]=t+1,_s+t.toString(36)}static mount(t,e,i){let s=t[Ds],r=i&&i.nonce;s?r&&s.setNonce(r):s=new Ta(t,r),s.mount(Array.isArray(e)?e:[e],t)}}let er=new Map;class Ta{constructor(t,e){let i=t.ownerDocument||t,s=i.defaultView;if(!t.head&&t.adoptedStyleSheets&&s.CSSStyleSheet){let r=er.get(i);if(r)return t[Ds]=r;this.sheet=new s.CSSStyleSheet,er.set(i,this)}else this.styleTag=i.createElement("style"),e&&this.styleTag.setAttribute("nonce",e);this.modules=[],t[Ds]=this}mount(t,e){let i=this.sheet,s=0,r=0;for(let o=0;o-1&&(this.modules.splice(a,1),r--,a=-1),a==-1){if(this.modules.splice(r++,0,l),i)for(let h=0;h",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Aa=typeof navigator<"u"&&/Mac/.test(navigator.platform),Ca=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var st=0;st<10;st++)ne[48+st]=ne[96+st]=String(st);for(var st=1;st<=24;st++)ne[st+111]="F"+st;for(var st=65;st<=90;st++)ne[st]=String.fromCharCode(st+32),oi[st]=String.fromCharCode(st);for(var Os in ne)oi.hasOwnProperty(Os)||(oi[Os]=ne[Os]);function Xa(n){var t=Aa&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||Ca&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",e=!t&&n.key||(n.shiftKey?oi:ne)[n.keyCode]||n.key||"Unidentified";return e=="Esc"&&(e="Escape"),e=="Del"&&(e="Delete"),e=="Left"&&(e="ArrowLeft"),e=="Up"&&(e="ArrowUp"),e=="Right"&&(e="ArrowRight"),e=="Down"&&(e="ArrowDown"),e}function li(n){let t;return n.nodeType==11?t=n.getSelection?n:n.ownerDocument:t=n,t.getSelection()}function Gs(n,t){return t?n==t||n.contains(t.nodeType!=1?t.parentNode:t):!1}function Wa(n){let t=n.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function zi(n,t){if(!t.anchorNode)return!1;try{return Gs(n,t.anchorNode)}catch{return!1}}function ai(n){return n.nodeType==3?be(n,0,n.nodeValue.length).getClientRects():n.nodeType==1?n.getClientRects():[]}function ei(n,t,e,i){return e?ir(n,t,e,i,-1)||ir(n,t,e,i,1):!1}function me(n){for(var t=0;;t++)if(n=n.previousSibling,!n)return t}function Di(n){return n.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(n.nodeName)}function ir(n,t,e,i,s){for(;;){if(n==e&&t==i)return!0;if(t==(s<0?0:Dt(n))){if(n.nodeName=="DIV")return!1;let r=n.parentNode;if(!r||r.nodeType!=1)return!1;t=me(n)+(s<0?0:1),n=r}else if(n.nodeType==1){if(n=n.childNodes[t+(s<0?-1:0)],n.nodeType==1&&n.contentEditable=="false")return!1;t=s<0?Dt(n):0}else return!1}}function Dt(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function ns(n,t){let e=t?n.left:n.right;return{left:e,right:e,top:n.top,bottom:n.bottom}}function Ya(n){let t=n.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:n.innerWidth,top:0,bottom:n.innerHeight}}function Ro(n,t){let e=t.width/n.offsetWidth,i=t.height/n.offsetHeight;return(e>.995&&e<1.005||!isFinite(e)||Math.abs(t.width-n.offsetWidth)<1)&&(e=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(t.height-n.offsetHeight)<1)&&(i=1),{scaleX:e,scaleY:i}}function Ma(n,t,e,i,s,r,o,l){let a=n.ownerDocument,h=a.defaultView||window;for(let c=n,f=!1;c&&!f;)if(c.nodeType==1){let O,u=c==a.body,d=1,p=1;if(u)O=Ya(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(c).position)&&(f=!0),c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let Q=c.getBoundingClientRect();({scaleX:d,scaleY:p}=Ro(c,Q)),O={left:Q.left,right:Q.left+c.clientWidth*d,top:Q.top,bottom:Q.top+c.clientHeight*p}}let g=0,b=0;if(s=="nearest")t.top0&&t.bottom>O.bottom+b&&(b=t.bottom-O.bottom+b+o)):t.bottom>O.bottom&&(b=t.bottom-O.bottom+o,e<0&&t.top-b0&&t.right>O.right+g&&(g=t.right-O.right+g+r)):t.right>O.right&&(g=t.right-O.right+r,e<0&&t.lefts.clientHeight&&(i=s),!e&&s.scrollWidth>s.clientWidth&&(e=s),s=s.assignedSlot||s.parentNode;else if(s.nodeType==11)s=s.host;else break;return{x:e,y:i}}class qa{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(t){return this.anchorNode==t.anchorNode&&this.anchorOffset==t.anchorOffset&&this.focusNode==t.focusNode&&this.focusOffset==t.focusOffset}setRange(t){let{anchorNode:e,focusNode:i}=t;this.set(e,Math.min(t.anchorOffset,e?Dt(e):0),i,Math.min(t.focusOffset,i?Dt(i):0))}set(t,e,i,s){this.anchorNode=t,this.anchorOffset=e,this.focusNode=i,this.focusOffset=s}}let xe=null;function To(n){if(n.setActive)return n.setActive();if(xe)return n.focus(xe);let t=[];for(let e=n;e&&(t.push(e,e.scrollTop,e.scrollLeft),e!=e.ownerDocument);e=e.parentNode);if(n.focus(xe==null?{get preventScroll(){return xe={preventScroll:!0},!0}}:void 0),!xe){xe=!1;for(let e=0;eMath.max(1,n.scrollHeight-n.clientHeight-4)}function Xo(n,t){for(let e=n,i=t;;){if(e.nodeType==3&&i>0)return{node:e,offset:i};if(e.nodeType==1&&i>0){if(e.contentEditable=="false")return null;e=e.childNodes[i-1],i=Dt(e)}else if(e.parentNode&&!Di(e))i=me(e),e=e.parentNode;else return null}}function Wo(n,t){for(let e=n,i=t;;){if(e.nodeType==3&&ie)return f.domBoundsAround(t,e,h);if(O>=t&&s==-1&&(s=a,r=h),h>e&&f.dom.parentNode==this.dom){o=a,l=c;break}c=O,h=O+f.breakAfter}return{from:r,to:l<0?i+this.length:l,startDOM:(s?this.children[s-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:o=0?this.children[o].dom:null}}markDirty(t=!1){this.flags|=2,this.markParentsDirty(t)}markParentsDirty(t){for(let e=this.parent;e;e=e.parent){if(t&&(e.flags|=2),e.flags&1)return;e.flags|=1,t=!1}}setParent(t){this.parent!=t&&(this.parent=t,this.flags&7&&this.markParentsDirty(!0))}setDOM(t){this.dom!=t&&(this.dom&&(this.dom.cmView=null),this.dom=t,t.cmView=this)}get rootView(){for(let t=this;;){let e=t.parent;if(!e)return t;t=e}}replaceChildren(t,e,i=wn){this.markDirty();for(let s=t;sthis.pos||t==this.pos&&(e>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=t-this.pos,this;let i=this.children[--this.i];this.pos-=i.length+i.breakAfter}}}function Mo(n,t,e,i,s,r,o,l,a){let{children:h}=n,c=h.length?h[t]:null,f=r.length?r[r.length-1]:null,O=f?f.breakAfter:o;if(!(t==i&&c&&!o&&!O&&r.length<2&&c.merge(e,s,r.length?f:null,e==0,l,a))){if(i0&&(!o&&r.length&&c.merge(e,c.length,r[0],!1,l,0)?c.breakAfter=r.shift().breakAfter:(e2);var x={mac:lr||/Mac/.test(ct.platform),windows:/Win/.test(ct.platform),linux:/Linux|X11/.test(ct.platform),ie:rs,ie_version:qo?Ns.documentMode||6:Bs?+Bs[1]:Is?+Is[1]:0,gecko:rr,gecko_version:rr?+(/Firefox\/(\d+)/.exec(ct.userAgent)||[0,0])[1]:0,chrome:!!us,chrome_version:us?+us[1]:0,ios:lr,android:/Android\b/.test(ct.userAgent),webkit:or,safari:Uo,webkit_version:or?+(/\bAppleWebKit\/(\d+)/.exec(ct.userAgent)||[0,0])[1]:0,tabSize:Ns.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};const Ea=256;class Pt extends j{constructor(t){super(),this.text=t}get length(){return this.text.length}createDOM(t){this.setDOM(t||document.createTextNode(this.text))}sync(t,e){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text)}reuseDOM(t){t.nodeType==3&&this.createDOM(t)}merge(t,e,i){return this.flags&8||i&&(!(i instanceof Pt)||this.length-(e-t)+i.length>Ea||i.flags&8)?!1:(this.text=this.text.slice(0,t)+(i?i.text:"")+this.text.slice(e),this.markDirty(),!0)}split(t){let e=new Pt(this.text.slice(t));return this.text=this.text.slice(0,t),this.markDirty(),e.flags|=this.flags&8,e}localPosFromDOM(t,e){return t==this.dom?e:e?this.text.length:0}domAtPos(t){return new ot(this.dom,t)}domBoundsAround(t,e,i){return{from:i,to:i+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(t,e){return Va(this.dom,t,e)}}class Gt extends j{constructor(t,e=[],i=0){super(),this.mark=t,this.children=e,this.length=i;for(let s of e)s.setParent(this)}setAttrs(t){if(Ao(t),this.mark.class&&(t.className=this.mark.class),this.mark.attrs)for(let e in this.mark.attrs)t.setAttribute(e,this.mark.attrs[e]);return t}canReuseDOM(t){return super.canReuseDOM(t)&&!((this.flags|t.flags)&8)}reuseDOM(t){t.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(t),this.flags|=6)}sync(t,e){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(t,e)}merge(t,e,i,s,r,o){return i&&(!(i instanceof Gt&&i.mark.eq(this.mark))||t&&r<=0||et&&e.push(i=t&&(s=r),i=a,r++}let o=this.length-t;return this.length=t,s>-1&&(this.children.length=s,this.markDirty()),new Gt(this.mark,e,o)}domAtPos(t){return jo(this,t)}coordsAt(t,e){return Vo(this,t,e)}}function Va(n,t,e){let i=n.nodeValue.length;t>i&&(t=i);let s=t,r=t,o=0;t==0&&e<0||t==i&&e>=0?x.chrome||x.gecko||(t?(s--,o=1):r=0)?0:l.length-1];return x.safari&&!o&&a.width==0&&(a=Array.prototype.find.call(l,h=>h.width)||a),o?ns(a,o<0):a||null}class Oe extends j{static create(t,e,i){return new Oe(t,e,i)}constructor(t,e,i){super(),this.widget=t,this.length=e,this.side=i,this.prevWidget=null}split(t){let e=Oe.create(this.widget,this.length-t,this.side);return this.length-=t,e}sync(t){(!this.dom||!this.widget.updateDOM(this.dom,t))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(t)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(t,e,i,s,r,o){return i&&(!(i instanceof Oe)||!this.widget.compare(i.widget)||t>0&&r<=0||e0)?ot.before(this.dom):ot.after(this.dom,t==this.length)}domBoundsAround(){return null}coordsAt(t,e){let i=this.widget.coordsAt(this.dom,t,e);if(i)return i;let s=this.dom.getClientRects(),r=null;if(!s.length)return null;let o=this.side?this.side<0:t>0;for(let l=o?s.length-1:0;r=s[l],!(t>0?l==0:l==s.length-1||r.top0?ot.before(this.dom):ot.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(t){return this.dom.getBoundingClientRect()}get overrideDOMText(){return W.empty}get isHidden(){return!0}}Pt.prototype.children=Oe.prototype.children=Ce.prototype.children=wn;function jo(n,t){let e=n.dom,{children:i}=n,s=0;for(let r=0;sr&&t0;r--){let o=i[r-1];if(o.dom.parentNode==e)return o.domAtPos(o.length)}for(let r=s;r0&&t instanceof Gt&&s.length&&(i=s[s.length-1])instanceof Gt&&i.mark.eq(t.mark)?Eo(i,t.children[0],e-1):(s.push(t),t.setParent(n)),n.length+=t.length}function Vo(n,t,e){let i=null,s=-1,r=null,o=-1;function l(h,c){for(let f=0,O=0;f=c&&(u.children.length?l(u,c-O):(!r||r.isHidden&&e>0)&&(d>c||O==d&&u.getSide()>0)?(r=u,o=c-O):(O-1?1:0)!=s.length-(e&&s.indexOf(e)>-1?1:0))return!1;for(let r of i)if(r!=e&&(s.indexOf(r)==-1||n[r]!==t[r]))return!1;return!0}function Fs(n,t,e){let i=!1;if(t)for(let s in t)e&&s in e||(i=!0,s=="style"?n.style.cssText="":n.removeAttribute(s));if(e)for(let s in e)t&&t[s]==e[s]||(i=!0,s=="style"?n.style.cssText=e[s]:n.setAttribute(s,e[s]));return i}function Da(n){let t=Object.create(null);for(let e=0;e0?3e8:-4e8:e>0?1e8:-1e8,new re(t,e,e,i,t.widget||null,!1)}static replace(t){let e=!!t.block,i,s;if(t.isBlockGap)i=-5e8,s=4e8;else{let{start:r,end:o}=_o(t,e);i=(r?e?-3e8:-1:5e8)-1,s=(o?e?2e8:1:-6e8)+1}return new re(t,i,s,e,t.widget||null,!0)}static line(t){return new pi(t)}static set(t,e=!1){return G.of(t,e)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}B.none=G.empty;class di extends B{constructor(t){let{start:e,end:i}=_o(t);super(e?-1:5e8,i?1:-6e8,null,t),this.tagName=t.tagName||"span",this.class=t.class||"",this.attrs=t.attributes||null}eq(t){var e,i;return this==t||t instanceof di&&this.tagName==t.tagName&&(this.class||((e=this.attrs)===null||e===void 0?void 0:e.class))==(t.class||((i=t.attrs)===null||i===void 0?void 0:i.class))&&Gi(this.attrs,t.attrs,"class")}range(t,e=t){if(t>=e)throw new RangeError("Mark decorations may not be empty");return super.range(t,e)}}di.prototype.point=!1;class pi extends B{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof pi&&this.spec.class==t.spec.class&&Gi(this.spec.attributes,t.spec.attributes)}range(t,e=t){if(e!=t)throw new RangeError("Line decoration ranges must be zero-length");return super.range(t,e)}}pi.prototype.mapMode=lt.TrackBefore;pi.prototype.point=!0;class re extends B{constructor(t,e,i,s,r,o){super(e,i,r,t),this.block=s,this.isReplace=o,this.mapMode=s?e<=0?lt.TrackBefore:lt.TrackAfter:lt.TrackDel}get type(){return this.startSide!=this.endSide?zt.WidgetRange:this.startSide<=0?zt.WidgetBefore:zt.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof re&&Ga(this.widget,t.widget)&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide}range(t,e=t){if(this.isReplace&&(t>e||t==e&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&e!=t)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(t,e)}}re.prototype.point=!0;function _o(n,t=!1){let{inclusiveStart:e,inclusiveEnd:i}=n;return e==null&&(e=n.inclusive),i==null&&(i=n.inclusive),{start:e??t,end:i??t}}function Ga(n,t){return n==t||!!(n&&t&&n.compare(t))}function Hs(n,t,e,i=0){let s=e.length-1;s>=0&&e[s]+i>=n?e[s]=Math.max(e[s],t):e.push(n,t)}class F extends j{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(t,e,i,s,r,o){if(i){if(!(i instanceof F))return!1;this.dom||i.transferDOM(this)}return s&&this.setDeco(i?i.attrs:null),zo(this,t,e,i?i.children.slice():[],r,o),!0}split(t){let e=new F;if(e.breakAfter=this.breakAfter,this.length==0)return e;let{i,off:s}=this.childPos(t);s&&(e.append(this.children[i].split(s),0),this.children[i].merge(s,this.children[i].length,null,!1,0,0),i++);for(let r=i;r0&&this.children[i-1].length==0;)this.children[--i].destroy();return this.children.length=i,this.markDirty(),this.length=t,e}transferDOM(t){this.dom&&(this.markDirty(),t.setDOM(this.dom),t.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(t){Gi(this.attrs,t)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=t)}append(t,e){Eo(this,t,e)}addLineDeco(t){let e=t.spec.attributes,i=t.spec.class;e&&(this.attrs=Ls(e,this.attrs||{})),i&&(this.attrs=Ls({class:i},this.attrs||{}))}domAtPos(t){return jo(this,t)}reuseDOM(t){t.nodeName=="DIV"&&(this.setDOM(t),this.flags|=6)}sync(t,e){var i;this.dom?this.flags&4&&(Ao(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),this.prevAttrs!==void 0&&(Fs(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(t,e);let s=this.dom.lastChild;for(;s&&j.get(s)instanceof Gt;)s=s.lastChild;if(!s||!this.length||s.nodeName!="BR"&&((i=j.get(s))===null||i===void 0?void 0:i.isEditable)==!1&&(!x.ios||!this.children.some(r=>r instanceof Pt))){let r=document.createElement("BR");r.cmIgnore=!0,this.dom.appendChild(r)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let t=0,e;for(let i of this.children){if(!(i instanceof Pt)||/[^ -~]/.test(i.text))return null;let s=ai(i.dom);if(s.length!=1)return null;t+=s[0].width,e=s[0].height}return t?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:t/this.length,textHeight:e}:null}coordsAt(t,e){let i=Vo(this,t,e);if(!this.children.length&&i&&this.parent){let{heightOracle:s}=this.parent.view.viewState,r=i.bottom-i.top;if(Math.abs(r-s.lineHeight)<2&&s.textHeight=e){if(r instanceof F)return r;if(o>e)break}s=o+r.breakAfter}return null}}class _t extends j{constructor(t,e,i){super(),this.widget=t,this.length=e,this.deco=i,this.breakAfter=0,this.prevWidget=null}merge(t,e,i,s,r,o){return i&&(!(i instanceof _t)||!this.widget.compare(i.widget)||t>0&&r<=0||e0}}class Ks extends os{constructor(t){super(),this.height=t}toDOM(){let t=document.createElement("div");return t.className="cm-gap",this.updateDOM(t),t}eq(t){return t.height==this.height}updateDOM(t){return t.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}class ii{constructor(t,e,i,s){this.doc=t,this.pos=e,this.end=i,this.disallowBlockEffectsFor=s,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=e}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let t=this.content[this.content.length-1];return!(t.breakAfter||t instanceof _t&&t.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new F),this.atCursorPos=!0),this.curLine}flushBuffer(t=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(Si(new Ce(-1),t),t.length),this.pendingBuffer=0)}addBlockWidget(t){this.flushBuffer(),this.curLine=null,this.content.push(t)}finish(t){this.pendingBuffer&&t<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,!this.posCovered()&&!(t&&this.content.length&&this.content[this.content.length-1]instanceof _t)&&this.getLine()}buildText(t,e,i){for(;t>0;){if(this.textOff==this.text.length){let{value:r,lineBreak:o,done:l}=this.cursor.next(this.skip);if(this.skip=0,l)throw new Error("Ran out of text content when drawing inline views");if(o){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,t--;continue}else this.text=r,this.textOff=0}let s=Math.min(this.text.length-this.textOff,t,512);this.flushBuffer(e.slice(e.length-i)),this.getLine().append(Si(new Pt(this.text.slice(this.textOff,this.textOff+s)),e),i),this.atCursorPos=!0,this.textOff+=s,t-=s,i=0}}span(t,e,i,s){this.buildText(e-t,i,s),this.pos=e,this.openStart<0&&(this.openStart=s)}point(t,e,i,s,r,o){if(this.disallowBlockEffectsFor[o]&&i instanceof re){if(i.block)throw new RangeError("Block decorations may not be specified via plugins");if(e>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let l=e-t;if(i instanceof re)if(i.block)i.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new _t(i.widget||Xe.block,l,i));else{let a=Oe.create(i.widget||Xe.inline,l,l?0:i.startSide),h=this.atCursorPos&&!a.isEditable&&r<=s.length&&(t0),c=!a.isEditable&&(ts.length||i.startSide<=0),f=this.getLine();this.pendingBuffer==2&&!h&&!a.isEditable&&(this.pendingBuffer=0),this.flushBuffer(s),h&&(f.append(Si(new Ce(1),s),r),r=s.length+Math.max(0,r-s.length)),f.append(Si(a,s),r),this.atCursorPos=c,this.pendingBuffer=c?ts.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=s.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(i);l&&(this.textOff+l<=this.text.length?this.textOff+=l:(this.skip+=l-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=e),this.openStart<0&&(this.openStart=r)}static build(t,e,i,s,r){let o=new ii(t,e,i,r);return o.openEnd=G.spans(s,e,i,o),o.openStart<0&&(o.openStart=o.openEnd),o.finish(o.openEnd),o}}function Si(n,t){for(let e of t)n=new Gt(e,[n],n.length);return n}class Xe extends os{constructor(t){super(),this.tag=t}eq(t){return t.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(t){return t.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}Xe.inline=new Xe("span");Xe.block=new Xe("div");var nt=function(n){return n[n.LTR=0]="LTR",n[n.RTL=1]="RTL",n}(nt||(nt={}));const Qe=nt.LTR,Pn=nt.RTL;function Do(n){let t=[];for(let e=0;e=e){if(l.level==i)return o;(r<0||(s!=0?s<0?l.frome:t[r].level>l.level))&&(r=o)}}if(r<0)throw new RangeError("Index out of range");return r}}function No(n,t){if(n.length!=t.length)return!1;for(let e=0;e=0;p-=3)if(Zt[p+1]==-u){let g=Zt[p+2],b=g&2?s:g&4?g&1?r:s:0;b&&(U[f]=U[Zt[p]]=b),l=p;break}}else{if(Zt.length==189)break;Zt[l++]=f,Zt[l++]=O,Zt[l++]=a}else if((d=U[f])==2||d==1){let p=d==s;a=p?0:1;for(let g=l-3;g>=0;g-=3){let b=Zt[g+2];if(b&2)break;if(p)Zt[g+2]|=2;else{if(b&4)break;Zt[g+2]|=4}}}}}function Ha(n,t,e,i){for(let s=0,r=i;s<=e.length;s++){let o=s?e[s-1].to:n,l=sa;)d==g&&(d=e[--p].from,g=p?e[p-1].to:n),U[--d]=u;a=c}else r=h,a++}}}function tn(n,t,e,i,s,r,o){let l=i%2?2:1;if(i%2==s%2)for(let a=t,h=0;aa&&o.push(new ie(a,p.from,u));let g=p.direction==Qe!=!(u%2);en(n,g?i+1:i,s,p.inner,p.from,p.to,o),a=p.to}d=p.to}else{if(d==e||(c?U[d]!=l:U[d]==l))break;d++}O?tn(n,a,d,i+1,s,O,o):at;){let c=!0,f=!1;if(!h||a>r[h-1].to){let p=U[a-1];p!=l&&(c=!1,f=p==16)}let O=!c&&l==1?[]:null,u=c?i:i+1,d=a;t:for(;;)if(h&&d==r[h-1].to){if(f)break t;let p=r[--h];if(!c)for(let g=p.from,b=h;;){if(g==t)break t;if(b&&r[b-1].to==g)g=r[--b].from;else{if(U[g-1]==l)break t;break}}if(O)O.push(p);else{p.toU.length;)U[U.length]=256;let i=[],s=t==Qe?0:1;return en(n,s,s,e,0,n.length,i),i}function Io(n){return[new ie(0,n,0)]}let Bo="";function Ja(n,t,e,i,s){var r;let o=i.head-n.from,l=ie.find(t,o,(r=i.bidiLevel)!==null&&r!==void 0?r:-1,i.assoc),a=t[l],h=a.side(s,e);if(o==h){let O=l+=s?1:-1;if(O<0||O>=t.length)return null;a=t[l=O],o=a.side(!s,e),h=a.side(s,e)}let c=Et(n.text,o,a.forward(s,e));(ca.to)&&(c=h),Bo=n.text.slice(Math.min(o,c),Math.max(o,c));let f=l==(s?t.length-1:0)?null:t[l+(s?1:-1)];return f&&c==h&&f.level+(s?0:1)n.some(t=>t)}),eh=v.define({combine:n=>n.some(t=>t)}),il=v.define();class Ze{constructor(t,e="nearest",i="nearest",s=5,r=5,o=!1){this.range=t,this.y=e,this.x=i,this.yMargin=s,this.xMargin=r,this.isSnapshot=o}map(t){return t.empty?this:new Ze(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(t){return this.range.to<=t.doc.length?this:new Ze(P.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const xi=N.define({map:(n,t)=>n.map(t)}),sl=N.define();function Xt(n,t,e){let i=n.facet(Ko);i.length?i[0](t):window.onerror?window.onerror(String(t),e,void 0,void 0,t):e?console.error(e+":",t):console.error(t)}const Jt=v.define({combine:n=>n.length?n[0]:!0});let ih=0;const Be=v.define();class ye{constructor(t,e,i,s,r){this.id=t,this.create=e,this.domEventHandlers=i,this.domEventObservers=s,this.extension=r(this)}static define(t,e){const{eventHandlers:i,eventObservers:s,provide:r,decorations:o}=e||{};return new ye(ih++,t,i,s,l=>{let a=[Be.of(l)];return o&&a.push(hi.of(h=>{let c=h.plugin(l);return c?o(c):B.none})),r&&a.push(r(l)),a})}static fromClass(t,e){return ye.define(i=>new t(i),e)}}class ds{constructor(t){this.spec=t,this.mustUpdate=null,this.value=null}update(t){if(this.value){if(this.mustUpdate){let e=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(e)}catch(i){if(Xt(e.state,i,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(t)}catch(e){Xt(t.state,e,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(t){var e;if(!((e=this.value)===null||e===void 0)&&e.destroy)try{this.value.destroy()}catch(i){Xt(t.state,i,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const nl=v.define(),Zn=v.define(),hi=v.define(),rl=v.define(),vn=v.define(),ol=v.define();function hr(n,t){let e=n.state.facet(ol);if(!e.length)return e;let i=e.map(r=>r instanceof Function?r(n):r),s=[];return G.spans(i,t.from,t.to,{point(){},span(r,o,l,a){let h=r-t.from,c=o-t.from,f=s;for(let O=l.length-1;O>=0;O--,a--){let u=l[O].spec.bidiIsolate,d;if(u==null&&(u=th(t.text,h,c)),a>0&&f.length&&(d=f[f.length-1]).to==h&&d.direction==u)d.to=c,f=d.inner;else{let p={from:h,to:c,direction:u,inner:[]};f.push(p),f=p.inner}}}}),s}const ll=v.define();function al(n){let t=0,e=0,i=0,s=0;for(let r of n.state.facet(ll)){let o=r(n);o&&(o.left!=null&&(t=Math.max(t,o.left)),o.right!=null&&(e=Math.max(e,o.right)),o.top!=null&&(i=Math.max(i,o.top)),o.bottom!=null&&(s=Math.max(s,o.bottom)))}return{left:t,right:e,top:i,bottom:s}}const Le=v.define();class yt{constructor(t,e,i,s){this.fromA=t,this.toA=e,this.fromB=i,this.toB=s}join(t){return new yt(Math.min(this.fromA,t.fromA),Math.max(this.toA,t.toA),Math.min(this.fromB,t.fromB),Math.max(this.toB,t.toB))}addToSet(t){let e=t.length,i=this;for(;e>0;e--){let s=t[e-1];if(!(s.fromA>i.toA)){if(s.toAc)break;r+=2}if(!a)return i;new yt(a.fromA,a.toA,a.fromB,a.toB).addToSet(i),o=a.toA,l=a.toB}}}class Ni{constructor(t,e,i){this.view=t,this.state=e,this.transactions=i,this.flags=0,this.startState=t.state,this.changes=J.empty(this.startState.doc.length);for(let r of i)this.changes=this.changes.compose(r.changes);let s=[];this.changes.iterChangedRanges((r,o,l,a)=>s.push(new yt(r,o,l,a))),this.changedRanges=s}static create(t,e,i){return new Ni(t,e,i)}get viewportChanged(){return(this.flags&4)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&10)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(t=>t.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}class cr extends j{get length(){return this.view.state.doc.length}constructor(t){super(),this.view=t,this.decorations=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.editContextFormatting=B.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(t.contentDOM),this.children=[new F],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new yt(0,0,0,t.state.doc.length)],0,null)}update(t){var e;let i=t.changedRanges;this.minWidth>0&&i.length&&(i.every(({fromA:h,toA:c})=>cthis.minWidthTo)?(this.minWidthFrom=t.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=t.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(t);let s=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((e=this.domChanged)===null||e===void 0)&&e.newSel?s=this.domChanged.newSel.head:!hh(t.changes,this.hasComposition)&&!t.selectionSet&&(s=t.state.selection.main.head));let r=s>-1?nh(this.view,t.changes,s):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:h,to:c}=this.hasComposition;i=new yt(h,c,t.changes.mapPos(h,-1),t.changes.mapPos(c,1)).addToSet(i.slice())}this.hasComposition=r?{from:r.range.fromB,to:r.range.toB}:null,(x.ie||x.chrome)&&!r&&t&&t.state.doc.lines!=t.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,l=this.updateDeco(),a=lh(o,l,t.changes);return i=yt.extendWithRanges(i,a),!(this.flags&7)&&i.length==0?!1:(this.updateInner(i,t.startState.doc.length,r),t.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(t,e,i){this.view.viewState.mustMeasureContent=!0,this.updateChildren(t,e,i);let{observer:s}=this.view;s.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let o=x.chrome||x.ios?{node:s.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,o),this.flags&=-8,o&&(o.written||s.selectionRange.focusNode!=o.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(o=>o.flags&=-9);let r=[];if(this.view.viewport.from||this.view.viewport.to=0?s[o]:null;if(!l)break;let{fromA:a,toA:h,fromB:c,toB:f}=l,O,u,d,p;if(i&&i.range.fromBc){let S=ii.build(this.view.state.doc,c,i.range.fromB,this.decorations,this.dynamicDecorationMap),k=ii.build(this.view.state.doc,i.range.toB,f,this.decorations,this.dynamicDecorationMap);u=S.breakAtStart,d=S.openStart,p=k.openEnd;let T=this.compositionView(i);k.breakAtStart?T.breakAfter=1:k.content.length&&T.merge(T.length,T.length,k.content[0],!1,k.openStart,0)&&(T.breakAfter=k.content[0].breakAfter,k.content.shift()),S.content.length&&T.merge(0,0,S.content[S.content.length-1],!0,0,S.openEnd)&&S.content.pop(),O=S.content.concat(T).concat(k.content)}else({content:O,breakAtStart:u,openStart:d,openEnd:p}=ii.build(this.view.state.doc,c,f,this.decorations,this.dynamicDecorationMap));let{i:g,off:b}=r.findPos(h,1),{i:Q,off:w}=r.findPos(a,-1);Mo(this,Q,w,g,b,O,u,d,p)}i&&this.fixCompositionDOM(i)}updateEditContextFormatting(t){this.editContextFormatting=this.editContextFormatting.map(t.changes);for(let e of t.transactions)for(let i of e.effects)i.is(sl)&&(this.editContextFormatting=i.value)}compositionView(t){let e=new Pt(t.text.nodeValue);e.flags|=8;for(let{deco:s}of t.marks)e=new Gt(s,[e],e.length);let i=new F;return i.append(e,0),i}fixCompositionDOM(t){let e=(r,o)=>{o.flags|=8|(o.children.some(a=>a.flags&7)?1:0),this.markedForComposition.add(o);let l=j.get(r);l&&l!=o&&(l.dom=null),o.setDOM(r)},i=this.childPos(t.range.fromB,1),s=this.children[i.i];e(t.line,s);for(let r=t.marks.length-1;r>=-1;r--)i=s.childPos(i.off,1),s=s.children[i.i],e(r>=0?t.marks[r].node:t.text,s)}updateSelection(t=!1,e=!1){(t||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let i=this.view.root.activeElement,s=i==this.dom,r=!s&&zi(this.dom,this.view.observer.selectionRange)&&!(i&&this.dom.contains(i));if(!(s||e||r))return;let o=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,a=this.moveToLine(this.domAtPos(l.anchor)),h=l.empty?a:this.moveToLine(this.domAtPos(l.head));if(x.gecko&&l.empty&&!this.hasComposition&&sh(a)){let f=document.createTextNode("");this.view.observer.ignore(()=>a.node.insertBefore(f,a.node.childNodes[a.offset]||null)),a=h=new ot(f,0),o=!0}let c=this.view.observer.selectionRange;(o||!c.focusNode||(!ei(a.node,a.offset,c.anchorNode,c.anchorOffset)||!ei(h.node,h.offset,c.focusNode,c.focusOffset))&&!this.suppressWidgetCursorChange(c,l))&&(this.view.observer.ignore(()=>{x.android&&x.chrome&&this.dom.contains(c.focusNode)&&ah(c.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let f=li(this.view.root);if(f)if(l.empty){if(x.gecko){let O=rh(a.node,a.offset);if(O&&O!=3){let u=(O==1?Xo:Wo)(a.node,a.offset);u&&(a=new ot(u.node,u.offset))}}f.collapse(a.node,a.offset),l.bidiLevel!=null&&f.caretBidiLevel!==void 0&&(f.caretBidiLevel=l.bidiLevel)}else if(f.extend){f.collapse(a.node,a.offset);try{f.extend(h.node,h.offset)}catch{}}else{let O=document.createRange();l.anchor>l.head&&([a,h]=[h,a]),O.setEnd(h.node,h.offset),O.setStart(a.node,a.offset),f.removeAllRanges(),f.addRange(O)}r&&this.view.root.activeElement==this.dom&&(this.dom.blur(),i&&i.focus())}),this.view.observer.setSelectionRange(a,h)),this.impreciseAnchor=a.precise?null:new ot(c.anchorNode,c.anchorOffset),this.impreciseHead=h.precise?null:new ot(c.focusNode,c.focusOffset)}suppressWidgetCursorChange(t,e){return this.hasComposition&&e.empty&&ei(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)&&this.posFromDOM(t.focusNode,t.focusOffset)==e.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:t}=this,e=t.state.selection.main,i=li(t.root),{anchorNode:s,anchorOffset:r}=t.observer.selectionRange;if(!i||!e.empty||!e.assoc||!i.modify)return;let o=F.find(this,e.head);if(!o)return;let l=o.posAtStart;if(e.head==l||e.head==l+o.length)return;let a=this.coordsAt(e.head,-1),h=this.coordsAt(e.head,1);if(!a||!h||a.bottom>h.top)return;let c=this.domAtPos(e.head+e.assoc);i.collapse(c.node,c.offset),i.modify("move",e.assoc<0?"forward":"backward","lineboundary"),t.observer.readSelectionRange();let f=t.observer.selectionRange;t.docView.posFromDOM(f.anchorNode,f.anchorOffset)!=e.from&&i.collapse(s,r)}moveToLine(t){let e=this.dom,i;if(t.node!=e)return t;for(let s=t.offset;!i&&s=0;s--){let r=j.get(e.childNodes[s]);r instanceof F&&(i=r.domAtPos(r.length))}return i?new ot(i.node,i.offset,!0):t}nearest(t){for(let e=t;e;){let i=j.get(e);if(i&&i.rootView==this)return i;e=e.parentNode}return null}posFromDOM(t,e){let i=this.nearest(t);if(!i)throw new RangeError("Trying to find position for a DOM position outside of the document");return i.localPosFromDOM(t,e)+i.posAtStart}domAtPos(t){let{i:e,off:i}=this.childCursor().findPos(t,-1);for(;e=0;o--){let l=this.children[o],a=r-l.breakAfter,h=a-l.length;if(at||l.covers(1))&&(!i||l instanceof F&&!(i instanceof F&&e>=0)))i=l,s=h;else if(i&&h==t&&a==t&&l instanceof _t&&Math.abs(e)<2){if(l.deco.startSide<0)break;o&&(i=null)}r=h}return i?i.coordsAt(t-s,e):null}coordsForChar(t){let{i:e,off:i}=this.childPos(t,1),s=this.children[e];if(!(s instanceof F))return null;for(;s.children.length;){let{i:l,off:a}=s.childPos(i,1);for(;;l++){if(l==s.children.length)return null;if((s=s.children[l]).length)break}i=a}if(!(s instanceof Pt))return null;let r=Et(s.text,i);if(r==i)return null;let o=be(s.dom,i,r).getClientRects();for(let l=0;lMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,l=-1,a=this.view.textDirection==nt.LTR;for(let h=0,c=0;cs)break;if(h>=i){let u=f.dom.getBoundingClientRect();if(e.push(u.height),o){let d=f.dom.lastChild,p=d?ai(d):[];if(p.length){let g=p[p.length-1],b=a?g.right-u.left:u.right-g.left;b>l&&(l=b,this.minWidth=r,this.minWidthFrom=h,this.minWidthTo=O)}}}h=O+f.breakAfter}return e}textDirectionAt(t){let{i:e}=this.childPos(t,1);return getComputedStyle(this.children[e].dom).direction=="rtl"?nt.RTL:nt.LTR}measureTextSize(){for(let r of this.children)if(r instanceof F){let o=r.measureTextSize();if(o)return o}let t=document.createElement("div"),e,i,s;return t.className="cm-line",t.style.width="99999px",t.style.position="absolute",t.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(t);let r=ai(t.firstChild)[0];e=t.getBoundingClientRect().height,i=r?r.width/27:7,s=r?r.height:e,t.remove()}),{lineHeight:e,charWidth:i,textHeight:s}}childCursor(t=this.length){let e=this.children.length;return e&&(t-=this.children[--e].length),new Yo(this.children,t,e)}computeBlockGapDeco(){let t=[],e=this.view.viewState;for(let i=0,s=0;;s++){let r=s==e.viewports.length?null:e.viewports[s],o=r?r.from-1:this.length;if(o>i){let l=(e.lineBlockAt(o).bottom-e.lineBlockAt(i).top)/this.view.scaleY;t.push(B.replace({widget:new Ks(l),block:!0,inclusive:!0,isBlockGap:!0}).range(i,o))}if(!r)break;i=r.to+1}return B.set(t)}updateDeco(){let t=1,e=this.view.state.facet(hi).map(r=>(this.dynamicDecorationMap[t++]=typeof r=="function")?r(this.view):r),i=!1,s=this.view.state.facet(rl).map((r,o)=>{let l=typeof r=="function";return l&&(i=!0),l?r(this.view):r});for(s.length&&(this.dynamicDecorationMap[t++]=i,e.push(G.join(s))),this.decorations=[this.editContextFormatting,...e,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];te.anchor?-1:1),s;if(!i)return;!e.empty&&(s=this.coordsAt(e.anchor,e.anchor>e.head?-1:1))&&(i={left:Math.min(i.left,s.left),top:Math.min(i.top,s.top),right:Math.max(i.right,s.right),bottom:Math.max(i.bottom,s.bottom)});let r=al(this.view),o={left:i.left-r.left,top:i.top-r.top,right:i.right+r.right,bottom:i.bottom+r.bottom},{offsetWidth:l,offsetHeight:a}=this.view.scrollDOM;Ma(this.view.scrollDOM,o,e.head{it.from&&(e=!0)}),e}function ch(n,t,e=1){let i=n.charCategorizer(t),s=n.doc.lineAt(t),r=t-s.from;if(s.length==0)return P.cursor(t);r==0?e=1:r==s.length&&(e=-1);let o=r,l=r;e<0?o=Et(s.text,r,!1):l=Et(s.text,r);let a=i(s.text.slice(o,l));for(;o>0;){let h=Et(s.text,o,!1);if(i(s.text.slice(h,o))!=a)break;o=h}for(;ln?t.left-n:Math.max(0,n-t.right)}function Oh(n,t){return t.top>n?t.top-n:Math.max(0,n-t.bottom)}function ps(n,t){return n.topt.top+1}function fr(n,t){return tn.bottom?{top:n.top,left:n.left,right:n.right,bottom:t}:n}function nn(n,t,e){let i,s,r,o,l=!1,a,h,c,f;for(let d=n.firstChild;d;d=d.nextSibling){let p=ai(d);for(let g=0;gw||o==w&&r>Q){i=d,s=b,r=Q,o=w;let S=w?e0?g0)}Q==0?e>b.bottom&&(!c||c.bottomb.top)&&(h=d,f=b):c&&ps(c,b)?c=Or(c,b.bottom):f&&ps(f,b)&&(f=fr(f,b.top))}}if(c&&c.bottom>=e?(i=a,s=c):f&&f.top<=e&&(i=h,s=f),!i)return{node:n,offset:0};let O=Math.max(s.left,Math.min(s.right,t));if(i.nodeType==3)return ur(i,O,e);if(l&&i.contentEditable!="false")return nn(i,O,e);let u=Array.prototype.indexOf.call(n.childNodes,i)+(t>=(s.left+s.right)/2?1:0);return{node:n,offset:u}}function ur(n,t,e){let i=n.nodeValue.length,s=-1,r=1e9,o=0;for(let l=0;le?c.top-e:e-c.bottom)-1;if(c.left-1<=t&&c.right+1>=t&&f=(c.left+c.right)/2,u=O;if((x.chrome||x.gecko)&&be(n,l).getBoundingClientRect().left==c.right&&(u=!O),f<=0)return{node:n,offset:l+(u?1:0)};s=l+(u?1:0),r=f}}}return{node:n,offset:s>-1?s:o>0?n.nodeValue.length:0}}function cl(n,t,e,i=-1){var s,r;let o=n.contentDOM.getBoundingClientRect(),l=o.top+n.viewState.paddingTop,a,{docHeight:h}=n.viewState,{x:c,y:f}=t,O=f-l;if(O<0)return 0;if(O>h)return n.state.doc.length;for(let S=n.viewState.heightOracle.textHeight/2,k=!1;a=n.elementAtHeight(O),a.type!=zt.Text;)for(;O=i>0?a.bottom+S:a.top-S,!(O>=0&&O<=h);){if(k)return e?null:0;k=!0,i=-i}f=l+O;let u=a.from;if(un.viewport.to)return n.viewport.to==n.state.doc.length?n.state.doc.length:e?null:dr(n,o,a,c,f);let d=n.dom.ownerDocument,p=n.root.elementFromPoint?n.root:d,g=p.elementFromPoint(c,f);g&&!n.contentDOM.contains(g)&&(g=null),g||(c=Math.max(o.left+1,Math.min(o.right-1,c)),g=p.elementFromPoint(c,f),g&&!n.contentDOM.contains(g)&&(g=null));let b,Q=-1;if(g&&((s=n.docView.nearest(g))===null||s===void 0?void 0:s.isEditable)!=!1){if(d.caretPositionFromPoint){let S=d.caretPositionFromPoint(c,f);S&&({offsetNode:b,offset:Q}=S)}else if(d.caretRangeFromPoint){let S=d.caretRangeFromPoint(c,f);S&&({startContainer:b,startOffset:Q}=S,(!n.contentDOM.contains(b)||x.safari&&uh(b,Q,c)||x.chrome&&dh(b,Q,c))&&(b=void 0))}}if(!b||!n.docView.dom.contains(b)){let S=F.find(n.docView,u);if(!S)return O>a.top+a.height/2?a.to:a.from;({node:b,offset:Q}=nn(S.dom,c,f))}let w=n.docView.nearest(b);if(!w)return null;if(w.isWidget&&((r=w.dom)===null||r===void 0?void 0:r.nodeType)==1){let S=w.dom.getBoundingClientRect();return t.yn.defaultLineHeight*1.5){let l=n.viewState.heightOracle.textHeight,a=Math.floor((s-e.top-(n.defaultLineHeight-l)*.5)/l);r+=a*n.viewState.heightOracle.lineLength}let o=n.state.sliceDoc(e.from,e.to);return e.from+Ra(o,r,n.state.tabSize)}function uh(n,t,e){let i;if(n.nodeType!=3||t!=(i=n.nodeValue.length))return!1;for(let s=n.nextSibling;s;s=s.nextSibling)if(s.nodeType!=1||s.nodeName!="BR")return!1;return be(n,i-1,i).getBoundingClientRect().left>e}function dh(n,t,e){if(t!=0)return!1;for(let s=n;;){let r=s.parentNode;if(!r||r.nodeType!=1||r.firstChild!=s)return!1;if(r.classList.contains("cm-line"))break;s=r}let i=n.nodeType==1?n.getBoundingClientRect():be(n,0,Math.max(n.nodeValue.length,1)).getBoundingClientRect();return e-i.left>5}function ph(n,t){let e=n.lineBlockAt(t);if(Array.isArray(e.type)){for(let i of e.type)if(i.to>t||i.to==t&&(i.to==e.to||i.type==zt.Text))return i}return e}function gh(n,t,e,i){let s=ph(n,t.head),r=!i||s.type!=zt.Text||!(n.lineWrapping||s.widgetLineBreaks)?null:n.coordsAtPos(t.assoc<0&&t.head>s.from?t.head-1:t.head);if(r){let o=n.dom.getBoundingClientRect(),l=n.textDirectionAt(s.from),a=n.posAtCoords({x:e==(l==nt.LTR)?o.right-1:o.left+1,y:(r.top+r.bottom)/2});if(a!=null)return P.cursor(a,e?-1:1)}return P.cursor(e?s.to:s.from,e?-1:1)}function pr(n,t,e,i){let s=n.state.doc.lineAt(t.head),r=n.bidiSpans(s),o=n.textDirectionAt(s.from);for(let l=t,a=null;;){let h=Ja(s,r,o,l,e),c=Bo;if(!h){if(s.number==(e?n.state.doc.lines:1))return l;c=` +`,s=n.state.doc.line(s.number+(e?1:-1)),r=n.bidiSpans(s),h=n.visualLineSide(s,!e)}if(a){if(!a(c))return l}else{if(!i)return h;a=i(c)}l=h}}function mh(n,t,e){let i=n.state.charCategorizer(t),s=i(e);return r=>{let o=i(r);return s==Vt.Space&&(s=o),s==o}}function bh(n,t,e,i){let s=t.head,r=e?1:-1;if(s==(e?n.state.doc.length:0))return P.cursor(s,t.assoc);let o=t.goalColumn,l,a=n.contentDOM.getBoundingClientRect(),h=n.coordsAtPos(s,t.assoc||-1),c=n.documentTop;if(h)o==null&&(o=h.left-a.left),l=r<0?h.top:h.bottom;else{let u=n.viewState.lineBlockAt(s);o==null&&(o=Math.min(a.right-a.left,n.defaultCharacterWidth*(s-u.from))),l=(r<0?u.top:u.bottom)+c}let f=a.left+o,O=i??n.viewState.heightOracle.textHeight>>1;for(let u=0;;u+=10){let d=l+(O+u)*r,p=cl(n,{x:f,y:d},!1,r);if(da.bottom||(r<0?ps)){let g=n.docView.coordsForChar(p),b=!g||d{if(t>r&&ts(n)),e.from,t.head>e.from?-1:1);return i==e.from?e:P.cursor(i,ir)&&this.lineBreak(),s=o}return this.findPointBefore(i,e),this}readTextNode(t){let e=t.nodeValue;for(let i of this.points)i.node==t&&(i.pos=this.text.length+Math.min(i.offset,e.length));for(let i=0,s=this.lineSeparator?null:/\r\n?|\n/g;;){let r=-1,o=1,l;if(this.lineSeparator?(r=e.indexOf(this.lineSeparator,i),o=this.lineSeparator.length):(l=s.exec(e))&&(r=l.index,o=l[0].length),this.append(e.slice(i,r<0?e.length:r)),r<0)break;if(this.lineBreak(),o>1)for(let a of this.points)a.node==t&&a.pos>this.text.length&&(a.pos-=o-1);i=r+o}}readNode(t){if(t.cmIgnore)return;let e=j.get(t),i=e&&e.overrideDOMText;if(i!=null){this.findPointInside(t,i.length);for(let s=i.iter();!s.next().done;)s.lineBreak?this.lineBreak():this.append(s.value)}else t.nodeType==3?this.readTextNode(t):t.nodeName=="BR"?t.nextSibling&&this.lineBreak():t.nodeType==1&&this.readRange(t.firstChild,null)}findPointBefore(t,e){for(let i of this.points)i.node==t&&t.childNodes[i.offset]==e&&(i.pos=this.text.length)}findPointInside(t,e){for(let i of this.points)(t.nodeType==3?i.node==t:t.contains(i.node))&&(i.pos=this.text.length+(yh(t,i.node,i.offset)?e:0))}}function yh(n,t,e){for(;;){if(!t||e-1;let{impreciseHead:r,impreciseAnchor:o}=t.docView;if(t.state.readOnly&&e>-1)this.newSel=null;else if(e>-1&&(this.bounds=t.docView.domBoundsAround(e,i,0))){let l=r||o?[]:Ph(t),a=new Qh(l,t.state);a.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=a.text,this.newSel=$h(l,this.bounds.from)}else{let l=t.observer.selectionRange,a=r&&r.node==l.focusNode&&r.offset==l.focusOffset||!Gs(t.contentDOM,l.focusNode)?t.state.selection.main.head:t.docView.posFromDOM(l.focusNode,l.focusOffset),h=o&&o.node==l.anchorNode&&o.offset==l.anchorOffset||!Gs(t.contentDOM,l.anchorNode)?t.state.selection.main.anchor:t.docView.posFromDOM(l.anchorNode,l.anchorOffset),c=t.viewport;if((x.ios||x.chrome)&&t.state.selection.main.empty&&a!=h&&(c.from>0||c.toDate.now()-100?n.inputState.lastKeyCode:-1;if(t.bounds){let{from:o,to:l}=t.bounds,a=s.from,h=null;(r===8||x.android&&t.text.length=s.from&&e.to<=s.to&&(e.from!=s.from||e.to!=s.to)&&s.to-s.from-(e.to-e.from)<=4?e={from:s.from,to:s.to,insert:n.state.doc.slice(s.from,e.from).append(e.insert).append(n.state.doc.slice(e.to,s.to))}:(x.mac||x.android)&&e&&e.from==e.to&&e.from==s.head-1&&/^\. ?$/.test(e.insert.toString())&&n.contentDOM.getAttribute("autocorrect")=="off"?(i&&e.insert.length==2&&(i=P.single(i.main.anchor-1,i.main.head-1)),e={from:s.from,to:s.to,insert:W.of([" "])}):x.chrome&&e&&e.from==e.to&&e.from==s.head&&e.insert.toString()==` + `&&n.lineWrapping&&(i&&(i=P.single(i.main.anchor-1,i.main.head-1)),e={from:s.from,to:s.to,insert:W.of([" "])}),e)return Rn(n,e,i,r);if(i&&!i.main.eq(s)){let o=!1,l="select";return n.inputState.lastSelectionTime>Date.now()-50&&(n.inputState.lastSelectionOrigin=="select"&&(o=!0),l=n.inputState.lastSelectionOrigin),n.dispatch({selection:i,scrollIntoView:o,userEvent:l}),!0}else return!1}function Rn(n,t,e,i=-1){if(x.ios&&n.inputState.flushIOSKey(t))return!0;let s=n.state.selection.main;if(x.android&&(t.to==s.to&&(t.from==s.from||t.from==s.from-1&&n.state.sliceDoc(t.from,s.from)==" ")&&t.insert.length==1&&t.insert.lines==2&&ke(n.contentDOM,"Enter",13)||(t.from==s.from-1&&t.to==s.to&&t.insert.length==0||i==8&&t.insert.lengths.head)&&ke(n.contentDOM,"Backspace",8)||t.from==s.from&&t.to==s.to+1&&t.insert.length==0&&ke(n.contentDOM,"Delete",46)))return!0;let r=t.insert.toString();n.inputState.composing>=0&&n.inputState.composing++;let o,l=()=>o||(o=xh(n,t,e));return n.state.facet(Jo).some(a=>a(n,t.from,t.to,r,l))||n.dispatch(l()),!0}function xh(n,t,e){let i,s=n.state,r=s.selection.main;if(t.from>=r.from&&t.to<=r.to&&t.to-t.from>=(r.to-r.from)/3&&(!e||e.main.empty&&e.main.from==t.from+t.insert.length)&&n.inputState.composing<0){let l=r.fromt.to?s.sliceDoc(t.to,r.to):"";i=s.replaceSelection(n.state.toText(l+t.insert.sliceString(0,void 0,n.state.lineBreak)+a))}else{let l=s.changes(t),a=e&&e.main.to<=l.newLength?e.main:void 0;if(s.selection.ranges.length>1&&n.inputState.composing>=0&&t.to<=r.to&&t.to>=r.to-10){let h=n.state.sliceDoc(t.from,t.to),c,f=e&&hl(n,e.main.head);if(f){let d=t.insert.length-(t.to-t.from);c={from:f.from,to:f.to-d}}else c=n.state.doc.lineAt(r.head);let O=r.to-t.to,u=r.to-r.from;i=s.changeByRange(d=>{if(d.from==r.from&&d.to==r.to)return{changes:l,range:a||d.map(l)};let p=d.to-O,g=p-h.length;if(d.to-d.from!=u||n.state.sliceDoc(g,p)!=h||d.to>=c.from&&d.from<=c.to)return{range:d};let b=s.changes({from:g,to:p,insert:t.insert}),Q=d.to-r.to;return{changes:b,range:a?P.range(Math.max(0,a.anchor+Q),Math.max(0,a.head+Q)):d.map(b)}})}else i={changes:l,selection:a&&s.selection.replaceRange(a)}}let o="input.type";return(n.composing||n.inputState.compositionPendingChange&&n.inputState.compositionEndedAt>Date.now()-50)&&(n.inputState.compositionPendingChange=!1,o+=".compose",n.inputState.compositionFirstChange&&(o+=".start",n.inputState.compositionFirstChange=!1)),s.update(i,{userEvent:o,scrollIntoView:!0})}function wh(n,t,e,i){let s=Math.min(n.length,t.length),r=0;for(;r0&&l>0&&n.charCodeAt(o-1)==t.charCodeAt(l-1);)o--,l--;if(i=="end"){let a=Math.max(0,r-Math.min(o,l));e-=o+a-r}if(o=o?r-e:0;r-=a,l=r+(l-o),o=r}else if(l=l?r-e:0;r-=a,o=r+(o-l),l=r}return{from:r,toA:o,toB:l}}function Ph(n){let t=[];if(n.root.activeElement!=n.contentDOM)return t;let{anchorNode:e,anchorOffset:i,focusNode:s,focusOffset:r}=n.observer.selectionRange;return e&&(t.push(new gr(e,i)),(s!=e||r!=i)&&t.push(new gr(s,r))),t}function $h(n,t){if(n.length==0)return null;let e=n[0].pos,i=n.length==2?n[1].pos:e;return e>-1&&i>-1?P.single(e+t,i+t):null}class kh{setSelectionOrigin(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now()}constructor(t){this.view=t,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=t.hasFocus,x.safari&&t.contentDOM.addEventListener("input",()=>null),x.gecko&&Vh(t.contentDOM.ownerDocument)}handleEvent(t){!Wh(this.view,t)||this.ignoreDuringComposition(t)||t.type=="keydown"&&this.keydown(t)||this.runHandlers(t.type,t)}runHandlers(t,e){let i=this.handlers[t];if(i){for(let s of i.observers)s(this.view,e);for(let s of i.handlers){if(e.defaultPrevented)break;if(s(this.view,e)){e.preventDefault();break}}}}ensureHandlers(t){let e=Zh(t),i=this.handlers,s=this.view.contentDOM;for(let r in e)if(r!="scroll"){let o=!e[r].handlers.length,l=i[r];l&&o!=!l.handlers.length&&(s.removeEventListener(r,this.handleEvent),l=null),l||s.addEventListener(r,this.handleEvent,{passive:o})}for(let r in i)r!="scroll"&&!e[r]&&s.removeEventListener(r,this.handleEvent);this.handlers=e}keydown(t){if(this.lastKeyCode=t.keyCode,this.lastKeyTime=Date.now(),t.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&t.keyCode!=27&&ul.indexOf(t.keyCode)<0&&(this.tabFocusMode=-1),x.android&&x.chrome&&!t.synthetic&&(t.keyCode==13||t.keyCode==8))return this.view.observer.delayAndroidKey(t.key,t.keyCode),!0;let e;return x.ios&&!t.synthetic&&!t.altKey&&!t.metaKey&&((e=Ol.find(i=>i.keyCode==t.keyCode))&&!t.ctrlKey||vh.indexOf(t.key)>-1&&t.ctrlKey&&!t.shiftKey)?(this.pendingIOSKey=e||t,setTimeout(()=>this.flushIOSKey(),250),!0):(t.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(t){let e=this.pendingIOSKey;return!e||e.key=="Enter"&&t&&t.from0?!0:x.safari&&!x.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1:!1}startMouseSelection(t){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=t}update(t){this.view.observer.update(t),this.mouseSelection&&this.mouseSelection.update(t),this.draggedContent&&t.docChanged&&(this.draggedContent=this.draggedContent.map(t.changes)),t.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function mr(n,t){return(e,i)=>{try{return t.call(n,i,e)}catch(s){Xt(e.state,s)}}}function Zh(n){let t=Object.create(null);function e(i){return t[i]||(t[i]={observers:[],handlers:[]})}for(let i of n){let s=i.spec;if(s&&s.domEventHandlers)for(let r in s.domEventHandlers){let o=s.domEventHandlers[r];o&&e(r).handlers.push(mr(i.value,o))}if(s&&s.domEventObservers)for(let r in s.domEventObservers){let o=s.domEventObservers[r];o&&e(r).observers.push(mr(i.value,o))}}for(let i in $t)e(i).handlers.push($t[i]);for(let i in St)e(i).observers.push(St[i]);return t}const Ol=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],vh="dthko",ul=[16,17,18,20,91,92,224,225],wi=6;function Pi(n){return Math.max(0,n)*.7+8}function Rh(n,t){return Math.max(Math.abs(n.clientX-t.clientX),Math.abs(n.clientY-t.clientY))}class Th{constructor(t,e,i,s){this.view=t,this.startEvent=e,this.style=i,this.mustSelect=s,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=e,this.scrollParents=za(t.contentDOM),this.atoms=t.state.facet(vn).map(o=>o(t));let r=t.contentDOM.ownerDocument;r.addEventListener("mousemove",this.move=this.move.bind(this)),r.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=e.shiftKey,this.multiple=t.state.facet(z.allowMultipleSelections)&&Ah(t,e),this.dragging=Xh(t,e)&&gl(e)==1?null:!1}start(t){this.dragging===!1&&this.select(t)}move(t){if(t.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&Rh(this.startEvent,t)<10)return;this.select(this.lastEvent=t);let e=0,i=0,s=0,r=0,o=this.view.win.innerWidth,l=this.view.win.innerHeight;this.scrollParents.x&&({left:s,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:r,bottom:l}=this.scrollParents.y.getBoundingClientRect());let a=al(this.view);t.clientX-a.left<=s+wi?e=-Pi(s-t.clientX):t.clientX+a.right>=o-wi&&(e=Pi(t.clientX-o)),t.clientY-a.top<=r+wi?i=-Pi(r-t.clientY):t.clientY+a.bottom>=l-wi&&(i=Pi(t.clientY-l)),this.setScrollSpeed(e,i)}up(t){this.dragging==null&&this.select(this.lastEvent),this.dragging||t.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let t=this.view.contentDOM.ownerDocument;t.removeEventListener("mousemove",this.move),t.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(t,e){this.scrollSpeed={x:t,y:e},t||e?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:t,y:e}=this.scrollSpeed;t&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=t,t=0),e&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=e,e=0),(t||e)&&this.view.win.scrollBy(t,e),this.dragging===!1&&this.select(this.lastEvent)}skipAtoms(t){let e=null;for(let i=0;ie.isUserEvent("input.type"))?this.destroy():this.style.update(t)&&setTimeout(()=>this.select(this.lastEvent),20)}}function Ah(n,t){let e=n.state.facet(Lo);return e.length?e[0](t):x.mac?t.metaKey:t.ctrlKey}function Ch(n,t){let e=n.state.facet(Fo);return e.length?e[0](t):x.mac?!t.altKey:!t.ctrlKey}function Xh(n,t){let{main:e}=n.state.selection;if(e.empty)return!1;let i=li(n.root);if(!i||i.rangeCount==0)return!0;let s=i.getRangeAt(0).getClientRects();for(let r=0;r=t.clientX&&o.top<=t.clientY&&o.bottom>=t.clientY)return!0}return!1}function Wh(n,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let e=t.target,i;e!=n.contentDOM;e=e.parentNode)if(!e||e.nodeType==11||(i=j.get(e))&&i.ignoreEvent(t))return!1;return!0}const $t=Object.create(null),St=Object.create(null),dl=x.ie&&x.ie_version<15||x.ios&&x.webkit_version<604;function Yh(n){let t=n.dom.parentNode;if(!t)return;let e=t.appendChild(document.createElement("textarea"));e.style.cssText="position: fixed; left: -10000px; top: 10px",e.focus(),setTimeout(()=>{n.focus(),e.remove(),pl(n,e.value)},50)}function ls(n,t,e){for(let i of n.facet(t))e=i(e,n);return e}function pl(n,t){t=ls(n.state,$n,t);let{state:e}=n,i,s=1,r=e.toText(t),o=r.lines==e.selection.ranges.length;if(rn!=null&&e.selection.ranges.every(a=>a.empty)&&rn==r.toString()){let a=-1;i=e.changeByRange(h=>{let c=e.doc.lineAt(h.from);if(c.from==a)return{range:h};a=c.from;let f=e.toText((o?r.line(s++).text:t)+e.lineBreak);return{changes:{from:c.from,insert:f},range:P.cursor(h.from+f.length)}})}else o?i=e.changeByRange(a=>{let h=r.line(s++);return{changes:{from:a.from,to:a.to,insert:h.text},range:P.cursor(a.from+h.length)}}):i=e.replaceSelection(r);n.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}St.scroll=n=>{n.inputState.lastScrollTop=n.scrollDOM.scrollTop,n.inputState.lastScrollLeft=n.scrollDOM.scrollLeft};$t.keydown=(n,t)=>(n.inputState.setSelectionOrigin("select"),t.keyCode==27&&n.inputState.tabFocusMode!=0&&(n.inputState.tabFocusMode=Date.now()+2e3),!1);St.touchstart=(n,t)=>{n.inputState.lastTouchTime=Date.now(),n.inputState.setSelectionOrigin("select.pointer")};St.touchmove=n=>{n.inputState.setSelectionOrigin("select.pointer")};$t.mousedown=(n,t)=>{if(n.observer.flush(),n.inputState.lastTouchTime>Date.now()-2e3)return!1;let e=null;for(let i of n.state.facet(Ho))if(e=i(n,t),e)break;if(!e&&t.button==0&&(e=qh(n,t)),e){let i=!n.hasFocus;n.inputState.startMouseSelection(new Th(n,t,e,i)),i&&n.observer.ignore(()=>{To(n.contentDOM);let r=n.root.activeElement;r&&!r.contains(n.contentDOM)&&r.blur()});let s=n.inputState.mouseSelection;if(s)return s.start(t),s.dragging===!1}return!1};function br(n,t,e,i){if(i==1)return P.cursor(t,e);if(i==2)return ch(n.state,t,e);{let s=F.find(n.docView,t),r=n.state.doc.lineAt(s?s.posAtEnd:t),o=s?s.posAtStart:r.from,l=s?s.posAtEnd:r.to;return lt>=e.top&&t<=e.bottom&&n>=e.left&&n<=e.right;function Mh(n,t,e,i){let s=F.find(n.docView,t);if(!s)return 1;let r=t-s.posAtStart;if(r==0)return 1;if(r==s.length)return-1;let o=s.coordsAt(r,-1);if(o&&Qr(e,i,o))return-1;let l=s.coordsAt(r,1);return l&&Qr(e,i,l)?1:o&&o.bottom>=i?-1:1}function yr(n,t){let e=n.posAtCoords({x:t.clientX,y:t.clientY},!1);return{pos:e,bias:Mh(n,e,t.clientX,t.clientY)}}const zh=x.ie&&x.ie_version<=11;let Sr=null,xr=0,wr=0;function gl(n){if(!zh)return n.detail;let t=Sr,e=wr;return Sr=n,wr=Date.now(),xr=!t||e>Date.now()-400&&Math.abs(t.clientX-n.clientX)<2&&Math.abs(t.clientY-n.clientY)<2?(xr+1)%3:1}function qh(n,t){let e=yr(n,t),i=gl(t),s=n.state.selection;return{update(r){r.docChanged&&(e.pos=r.changes.mapPos(e.pos),s=s.map(r.changes))},get(r,o,l){let a=yr(n,r),h,c=br(n,a.pos,a.bias,i);if(e.pos!=a.pos&&!o){let f=br(n,e.pos,e.bias,i),O=Math.min(f.from,c.from),u=Math.max(f.to,c.to);c=O1&&(h=Uh(s,a.pos))?h:l?s.addRange(c):P.create([c])}}}function Uh(n,t){for(let e=0;e=t)return P.create(n.ranges.slice(0,e).concat(n.ranges.slice(e+1)),n.mainIndex==e?0:n.mainIndex-(n.mainIndex>e?1:0))}return null}$t.dragstart=(n,t)=>{let{selection:{main:e}}=n.state;if(t.target.draggable){let s=n.docView.nearest(t.target);if(s&&s.isWidget){let r=s.posAtStart,o=r+s.length;(r>=e.to||o<=e.from)&&(e=P.range(r,o))}}let{inputState:i}=n;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=e,t.dataTransfer&&(t.dataTransfer.setData("Text",ls(n.state,kn,n.state.sliceDoc(e.from,e.to))),t.dataTransfer.effectAllowed="copyMove"),!1};$t.dragend=n=>(n.inputState.draggedContent=null,!1);function Pr(n,t,e,i){if(e=ls(n.state,$n,e),!e)return;let s=n.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:r}=n.inputState,o=i&&r&&Ch(n,t)?{from:r.from,to:r.to}:null,l={from:s,insert:e},a=n.state.changes(o?[o,l]:l);n.focus(),n.dispatch({changes:a,selection:{anchor:a.mapPos(s,-1),head:a.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"}),n.inputState.draggedContent=null}$t.drop=(n,t)=>{if(!t.dataTransfer)return!1;if(n.state.readOnly)return!0;let e=t.dataTransfer.files;if(e&&e.length){let i=Array(e.length),s=0,r=()=>{++s==e.length&&Pr(n,t,i.filter(o=>o!=null).join(n.state.lineBreak),!1)};for(let o=0;o{/[\x00-\x08\x0e-\x1f]{2}/.test(l.result)||(i[o]=l.result),r()},l.readAsText(e[o])}return!0}else{let i=t.dataTransfer.getData("Text");if(i)return Pr(n,t,i,!0),!0}return!1};$t.paste=(n,t)=>{if(n.state.readOnly)return!0;n.observer.flush();let e=dl?null:t.clipboardData;return e?(pl(n,e.getData("text/plain")||e.getData("text/uri-list")),!0):(Yh(n),!1)};function jh(n,t){let e=n.dom.parentNode;if(!e)return;let i=e.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=t,i.focus(),i.selectionEnd=t.length,i.selectionStart=0,setTimeout(()=>{i.remove(),n.focus()},50)}function Eh(n){let t=[],e=[],i=!1;for(let s of n.selection.ranges)s.empty||(t.push(n.sliceDoc(s.from,s.to)),e.push(s));if(!t.length){let s=-1;for(let{from:r}of n.selection.ranges){let o=n.doc.lineAt(r);o.number>s&&(t.push(o.text),e.push({from:o.from,to:Math.min(n.doc.length,o.to+1)})),s=o.number}i=!0}return{text:ls(n,kn,t.join(n.lineBreak)),ranges:e,linewise:i}}let rn=null;$t.copy=$t.cut=(n,t)=>{let{text:e,ranges:i,linewise:s}=Eh(n.state);if(!e&&!s)return!1;rn=s?e:null,t.type=="cut"&&!n.state.readOnly&&n.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let r=dl?null:t.clipboardData;return r?(r.clearData(),r.setData("text/plain",e),!0):(jh(n,e),!1)};const ml=It.define();function bl(n,t){let e=[];for(let i of n.facet(tl)){let s=i(n,t);s&&e.push(s)}return e?n.update({effects:e,annotations:ml.of(!0)}):null}function Ql(n){setTimeout(()=>{let t=n.hasFocus;if(t!=n.inputState.notifiedFocused){let e=bl(n.state,t);e?n.dispatch(e):n.update([])}},10)}St.focus=n=>{n.inputState.lastFocusTime=Date.now(),!n.scrollDOM.scrollTop&&(n.inputState.lastScrollTop||n.inputState.lastScrollLeft)&&(n.scrollDOM.scrollTop=n.inputState.lastScrollTop,n.scrollDOM.scrollLeft=n.inputState.lastScrollLeft),Ql(n)};St.blur=n=>{n.observer.clearSelectionRange(),Ql(n)};St.compositionstart=St.compositionupdate=n=>{n.observer.editContext||(n.inputState.compositionFirstChange==null&&(n.inputState.compositionFirstChange=!0),n.inputState.composing<0&&(n.inputState.composing=0))};St.compositionend=n=>{n.observer.editContext||(n.inputState.composing=-1,n.inputState.compositionEndedAt=Date.now(),n.inputState.compositionPendingKey=!0,n.inputState.compositionPendingChange=n.observer.pendingRecords().length>0,n.inputState.compositionFirstChange=null,x.chrome&&x.android?n.observer.flushSoon():n.inputState.compositionPendingChange?Promise.resolve().then(()=>n.observer.flush()):setTimeout(()=>{n.inputState.composing<0&&n.docView.hasComposition&&n.update([])},50))};St.contextmenu=n=>{n.inputState.lastContextMenu=Date.now()};$t.beforeinput=(n,t)=>{var e,i;if(t.inputType=="insertReplacementText"&&n.observer.editContext){let r=(e=t.dataTransfer)===null||e===void 0?void 0:e.getData("text/plain"),o=t.getTargetRanges();if(r&&o.length){let l=o[0],a=n.posAtDOM(l.startContainer,l.startOffset),h=n.posAtDOM(l.endContainer,l.endOffset);return Rn(n,{from:a,to:h,insert:n.state.toText(r)},null),!0}}let s;if(x.chrome&&x.android&&(s=Ol.find(r=>r.inputType==t.inputType))&&(n.observer.delayAndroidKey(s.key,s.keyCode),s.key=="Backspace"||s.key=="Delete")){let r=((i=window.visualViewport)===null||i===void 0?void 0:i.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>r+10&&n.hasFocus&&(n.contentDOM.blur(),n.focus())},100)}return x.ios&&t.inputType=="deleteContentForward"&&n.observer.flushSoon(),x.safari&&t.inputType=="insertText"&&n.inputState.composing>=0&&setTimeout(()=>St.compositionend(n,t),20),!1};const $r=new Set;function Vh(n){$r.has(n)||($r.add(n),n.addEventListener("copy",()=>{}),n.addEventListener("cut",()=>{}))}const kr=["pre-wrap","normal","pre-line","break-spaces"];let We=!1;function Zr(){We=!1}class _h{constructor(t){this.lineWrapping=t,this.doc=W.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(t,e){let i=this.doc.lineAt(e).number-this.doc.lineAt(t).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((e-t-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i}heightForLine(t){return this.lineWrapping?(1+Math.max(0,Math.ceil((t-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(t){return this.doc=t,this}mustRefreshForWrapping(t){return kr.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let e=!1;for(let i=0;i-1,a=Math.round(e)!=Math.round(this.lineHeight)||this.lineWrapping!=l;if(this.lineWrapping=l,this.lineHeight=e,this.charWidth=i,this.textHeight=s,this.lineLength=r,a){this.heightSamples={};for(let h=0;h0}set outdated(t){this.flags=(t?2:0)|this.flags&-3}setHeight(t){this.height!=t&&(Math.abs(this.height-t)>Ui&&(We=!0),this.height=t)}replace(t,e,i){return at.of(i)}decomposeLeft(t,e){e.push(this)}decomposeRight(t,e){e.push(this)}applyChanges(t,e,i,s){let r=this,o=i.doc;for(let l=s.length-1;l>=0;l--){let{fromA:a,toA:h,fromB:c,toB:f}=s[l],O=r.lineAt(a,D.ByPosNoHeight,i.setDoc(e),0,0),u=O.to>=h?O:r.lineAt(h,D.ByPosNoHeight,i,0,0);for(f+=u.to-h,h=u.to;l>0&&O.from<=s[l-1].toA;)a=s[l-1].fromA,c=s[l-1].fromB,l--,ar*2){let l=t[e-1];l.break?t.splice(--e,1,l.left,null,l.right):t.splice(--e,1,l.left,l.right),i+=1+l.break,s-=l.size}else if(r>s*2){let l=t[i];l.break?t.splice(i,1,l.left,null,l.right):t.splice(i,1,l.left,l.right),i+=2+l.break,r-=l.size}else break;else if(s=r&&o(this.blockAt(0,i,s,r))}updateHeight(t,e=0,i=!1,s){return s&&s.from<=e&&s.more&&this.setHeight(s.heights[s.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class pt extends yl{constructor(t,e){super(t,e,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(t,e,i,s){return new Ct(s,this.length,i,this.height,this.breaks)}replace(t,e,i){let s=i[0];return i.length==1&&(s instanceof pt||s instanceof it&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof it?s=new pt(s.length,this.height):s.height=this.height,this.outdated||(s.outdated=!1),s):at.of(i)}updateHeight(t,e=0,i=!1,s){return s&&s.from<=e&&s.more?this.setHeight(s.heights[s.index++]):(i||this.outdated)&&this.setHeight(Math.max(this.widgetHeight,t.heightForLine(this.length-this.collapsed))+this.breaks*t.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class it extends at{constructor(t){super(t,0)}heightMetrics(t,e){let i=t.doc.lineAt(e).number,s=t.doc.lineAt(e+this.length).number,r=s-i+1,o,l=0;if(t.lineWrapping){let a=Math.min(this.height,t.lineHeight*r);o=a/r,this.length>r+1&&(l=(this.height-a)/(this.length-r-1))}else o=this.height/r;return{firstLine:i,lastLine:s,perLine:o,perChar:l}}blockAt(t,e,i,s){let{firstLine:r,lastLine:o,perLine:l,perChar:a}=this.heightMetrics(e,s);if(e.lineWrapping){let h=s+(t0){let r=i[i.length-1];r instanceof it?i[i.length-1]=new it(r.length+s):i.push(null,new it(s-1))}if(t>0){let r=i[0];r instanceof it?i[0]=new it(t+r.length):i.unshift(new it(t-1),null)}return at.of(i)}decomposeLeft(t,e){e.push(new it(t-1),null)}decomposeRight(t,e){e.push(null,new it(this.length-t-1))}updateHeight(t,e=0,i=!1,s){let r=e+this.length;if(s&&s.from<=e+this.length&&s.more){let o=[],l=Math.max(e,s.from),a=-1;for(s.from>e&&o.push(new it(s.from-e-1).updateHeight(t,e));l<=r&&s.more;){let c=t.doc.lineAt(l).length;o.length&&o.push(null);let f=s.heights[s.index++];a==-1?a=f:Math.abs(f-a)>=Ui&&(a=-2);let O=new pt(c,f);O.outdated=!1,o.push(O),l+=c+1}l<=r&&o.push(null,new it(r-l).updateHeight(t,l));let h=at.of(o);return(a<0||Math.abs(h.height-this.height)>=Ui||Math.abs(a-this.heightMetrics(t,e).perLine)>=Ui)&&(We=!0),Ii(this,h)}else(i||this.outdated)&&(this.setHeight(t.heightForGap(e,e+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class Gh extends at{constructor(t,e,i){super(t.length+e+i.length,t.height+i.height,e|(t.outdated||i.outdated?2:0)),this.left=t,this.right=i,this.size=t.size+i.size}get break(){return this.flags&1}blockAt(t,e,i,s){let r=i+this.left.height;return tl))return h;let c=e==D.ByPosNoHeight?D.ByPosNoHeight:D.ByPos;return a?h.join(this.right.lineAt(l,c,i,o,l)):this.left.lineAt(l,c,i,s,r).join(h)}forEachLine(t,e,i,s,r,o){let l=s+this.left.height,a=r+this.left.length+this.break;if(this.break)t=a&&this.right.forEachLine(t,e,i,l,a,o);else{let h=this.lineAt(a,D.ByPos,i,s,r);t=t&&h.from<=e&&o(h),e>h.to&&this.right.forEachLine(h.to+1,e,i,l,a,o)}}replace(t,e,i){let s=this.left.length+this.break;if(ethis.left.length)return this.balanced(this.left,this.right.replace(t-s,e-s,i));let r=[];t>0&&this.decomposeLeft(t,r);let o=r.length;for(let l of i)r.push(l);if(t>0&&vr(r,o-1),e=i&&e.push(null)),t>i&&this.right.decomposeLeft(t-i,e)}decomposeRight(t,e){let i=this.left.length,s=i+this.break;if(t>=s)return this.right.decomposeRight(t-s,e);t2*e.size||e.size>2*t.size?at.of(this.break?[t,null,e]:[t,e]):(this.left=Ii(this.left,t),this.right=Ii(this.right,e),this.setHeight(t.height+e.height),this.outdated=t.outdated||e.outdated,this.size=t.size+e.size,this.length=t.length+this.break+e.length,this)}updateHeight(t,e=0,i=!1,s){let{left:r,right:o}=this,l=e+r.length+this.break,a=null;return s&&s.from<=e+r.length&&s.more?a=r=r.updateHeight(t,e,i,s):r.updateHeight(t,e,i),s&&s.from<=l+o.length&&s.more?a=o=o.updateHeight(t,l,i,s):o.updateHeight(t,l,i),a?this.balanced(r,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function vr(n,t){let e,i;n[t]==null&&(e=n[t-1])instanceof it&&(i=n[t+1])instanceof it&&n.splice(t-1,3,new it(e.length+1+i.length))}const Nh=5;class Tn{constructor(t,e){this.pos=t,this.oracle=e,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=t}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(t,e){if(this.lineStart>-1){let i=Math.min(e,this.lineEnd),s=this.nodes[this.nodes.length-1];s instanceof pt?s.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new pt(i-this.pos,-1)),this.writtenTo=i,e>i&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=e}point(t,e,i){if(t=Nh)&&this.addLineDeco(s,r,o)}else e>t&&this.span(t,e);this.lineEnd>-1&&this.lineEnd-1)return;let{from:t,to:e}=this.oracle.doc.lineAt(this.pos);this.lineStart=t,this.lineEnd=e,this.writtenTot&&this.nodes.push(new pt(this.pos-t,-1)),this.writtenTo=this.pos}blankContent(t,e){let i=new it(e-t);return this.oracle.doc.lineAt(t).to==e&&(i.flags|=4),i}ensureLine(){this.enterLine();let t=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(t instanceof pt)return t;let e=new pt(0,-1);return this.nodes.push(e),e}addBlock(t){this.enterLine();let e=t.deco;e&&e.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,e&&e.endSide>0&&(this.covering=t)}addLineDeco(t,e,i){let s=this.ensureLine();s.length+=i,s.collapsed+=i,s.widgetHeight=Math.max(s.widgetHeight,t),s.breaks+=e,this.writtenTo=this.pos=this.pos+i}finish(t){let e=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(e instanceof pt)&&!this.isCovered?this.nodes.push(new pt(0,-1)):(this.writtenToc.clientHeight||c.scrollWidth>c.clientWidth)&&f.overflow!="visible"){let O=c.getBoundingClientRect();r=Math.max(r,O.left),o=Math.min(o,O.right),l=Math.max(l,O.top),a=Math.min(h==n.parentNode?s.innerHeight:a,O.bottom)}h=f.position=="absolute"||f.position=="fixed"?c.offsetParent:c.parentNode}else if(h.nodeType==11)h=h.host;else break;return{left:r-e.left,right:Math.max(r,o)-e.left,top:l-(e.top+t),bottom:Math.max(l,a)-(e.top+t)}}function Fh(n,t){let e=n.getBoundingClientRect();return{left:0,right:e.right-e.left,top:t,bottom:e.bottom-(e.top+t)}}class ms{constructor(t,e,i){this.from=t,this.to=e,this.size=i}static same(t,e){if(t.length!=e.length)return!1;for(let i=0;itypeof i!="function"&&i.class=="cm-lineWrapping");this.heightOracle=new _h(e),this.stateDeco=t.facet(hi).filter(i=>typeof i!="function"),this.heightMap=at.empty().applyChanges(this.stateDeco,W.empty,this.heightOracle.setDoc(t.doc),[new yt(0,0,0,t.doc.length)]);for(let i=0;i<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());i++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=B.set(this.lineGaps.map(i=>i.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let t=[this.viewport],{main:e}=this.state.selection;for(let i=0;i<=1;i++){let s=i?e.head:e.anchor;if(!t.some(({from:r,to:o})=>s>=r&&s<=o)){let{from:r,to:o}=this.lineBlockAt(s);t.push(new $i(r,o))}}return this.viewports=t.sort((i,s)=>i.from-s.from),this.updateScaler()}updateScaler(){let t=this.scaler;return this.scaler=this.heightMap.height<=7e6?Tr:new An(this.heightOracle,this.heightMap,this.viewports),t.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,t=>{this.viewportLines.push(He(t,this.scaler))})}update(t,e=null){this.state=t.state;let i=this.stateDeco;this.stateDeco=this.state.facet(hi).filter(c=>typeof c!="function");let s=t.changedRanges,r=yt.extendWithRanges(s,Ih(i,this.stateDeco,t?t.changes:J.empty(this.state.doc.length))),o=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);Zr(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),r),(this.heightMap.height!=o||We)&&(t.flags|=2),l?(this.scrollAnchorPos=t.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);let a=r.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.range.heada.to)||!this.viewportIsAppropriate(a))&&(a=this.getViewport(0,e));let h=a.from!=this.viewport.from||a.to!=this.viewport.to;this.viewport=a,t.flags|=this.updateForViewport(),(h||!t.changes.empty||t.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,t.changes))),t.flags|=this.computeVisibleRanges(),e&&(this.scrollTarget=e),!this.mustEnforceCursorAssoc&&t.selectionSet&&t.view.lineWrapping&&t.state.selection.main.empty&&t.state.selection.main.assoc&&!t.state.facet(eh)&&(this.mustEnforceCursorAssoc=!0)}measure(t){let e=t.contentDOM,i=window.getComputedStyle(e),s=this.heightOracle,r=i.whiteSpace;this.defaultTextDirection=i.direction=="rtl"?nt.RTL:nt.LTR;let o=this.heightOracle.mustRefreshForWrapping(r),l=e.getBoundingClientRect(),a=o||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let h=0,c=0;if(l.width&&l.height){let{scaleX:S,scaleY:k}=Ro(e,l);(S>.005&&Math.abs(this.scaleX-S)>.005||k>.005&&Math.abs(this.scaleY-k)>.005)&&(this.scaleX=S,this.scaleY=k,h|=8,o=a=!0)}let f=(parseInt(i.paddingTop)||0)*this.scaleY,O=(parseInt(i.paddingBottom)||0)*this.scaleY;(this.paddingTop!=f||this.paddingBottom!=O)&&(this.paddingTop=f,this.paddingBottom=O,h|=10),this.editorWidth!=t.scrollDOM.clientWidth&&(s.lineWrapping&&(a=!0),this.editorWidth=t.scrollDOM.clientWidth,h|=8);let u=t.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=u&&(this.scrollAnchorHeight=-1,this.scrollTop=u),this.scrolledToBottom=Co(t.scrollDOM);let d=(this.printing?Fh:Lh)(e,this.paddingTop),p=d.top-this.pixelViewport.top,g=d.bottom-this.pixelViewport.bottom;this.pixelViewport=d;let b=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(b!=this.inView&&(this.inView=b,b&&(a=!0)),!this.inView&&!this.scrollTarget)return 0;let Q=l.width;if((this.contentDOMWidth!=Q||this.editorHeight!=t.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=t.scrollDOM.clientHeight,h|=8),a){let S=t.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(S)&&(o=!0),o||s.lineWrapping&&Math.abs(Q-this.contentDOMWidth)>s.charWidth){let{lineHeight:k,charWidth:T,textHeight:Z}=t.docView.measureTextSize();o=k>0&&s.refresh(r,k,T,Z,Q/T,S),o&&(t.docView.minWidth=0,h|=8)}p>0&&g>0?c=Math.max(p,g):p<0&&g<0&&(c=Math.min(p,g)),Zr();for(let k of this.viewports){let T=k.from==this.viewport.from?S:t.docView.measureVisibleLineHeights(k);this.heightMap=(o?at.empty().applyChanges(this.stateDeco,W.empty,this.heightOracle,[new yt(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new Dh(k.from,T))}We&&(h|=2)}let w=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return w&&(h&2&&(h|=this.updateScaler()),this.viewport=this.getViewport(c,this.scrollTarget),h|=this.updateForViewport()),(h&2||w)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,t)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,t.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(t,e){let i=.5-Math.max(-.5,Math.min(.5,t/1e3/2)),s=this.heightMap,r=this.heightOracle,{visibleTop:o,visibleBottom:l}=this,a=new $i(s.lineAt(o-i*1e3,D.ByHeight,r,0,0).from,s.lineAt(l+(1-i)*1e3,D.ByHeight,r,0,0).to);if(e){let{head:h}=e.range;if(ha.to){let c=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),f=s.lineAt(h,D.ByPos,r,0,0),O;e.y=="center"?O=(f.top+f.bottom)/2-c/2:e.y=="start"||e.y=="nearest"&&h=l+Math.max(10,Math.min(i,250)))&&s>o-2*1e3&&r>1,o=s<<1;if(this.defaultTextDirection!=nt.LTR&&!i)return[];let l=[],a=(c,f,O,u)=>{if(f-cc&&bb.from>=O.from&&b.to<=O.to&&Math.abs(b.from-c)b.fromQ));if(!g){if(fb.from<=f&&b.to>=f)){let b=e.moveToLineBoundary(P.cursor(f),!1,!0).head;b>c&&(f=b)}g=new ms(c,f,this.gapSize(O,c,f,u))}l.push(g)},h=c=>{if(c.lengthc.from&&a(c.from,u,c,f),de.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let e=[];G.spans(t,this.viewport.from,this.viewport.to,{span(s,r){e.push({from:s,to:r})},point(){}},20);let i=e.length!=this.visibleRanges.length||this.visibleRanges.some((s,r)=>s.from!=e[r].from||s.to!=e[r].to);return this.visibleRanges=e,i?4:0}lineBlockAt(t){return t>=this.viewport.from&&t<=this.viewport.to&&this.viewportLines.find(e=>e.from<=t&&e.to>=t)||He(this.heightMap.lineAt(t,D.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(t){return t>=this.viewportLines[0].top&&t<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(e=>e.top<=t&&e.bottom>=t)||He(this.heightMap.lineAt(this.scaler.fromDOM(t),D.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(t){let e=this.lineBlockAtHeight(t+8);return e.from>=this.viewport.from||this.viewportLines[0].top-t>200?e:this.viewportLines[0]}elementAtHeight(t){return He(this.heightMap.blockAt(this.scaler.fromDOM(t),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class $i{constructor(t,e){this.from=t,this.to=e}}function Kh(n,t,e){let i=[],s=n,r=0;return G.spans(e,n,t,{span(){},point(o,l){o>s&&(i.push({from:s,to:o}),r+=o-s),s=l}},20),s=1)return t[t.length-1].to;let i=Math.floor(n*e);for(let s=0;;s++){let{from:r,to:o}=t[s],l=o-r;if(i<=l)return r+i;i-=l}}function Zi(n,t){let e=0;for(let{from:i,to:s}of n.ranges){if(t<=s){e+=t-i;break}e+=s-i}return e/n.total}function Jh(n,t){for(let e of n)if(t(e))return e}const Tr={toDOM(n){return n},fromDOM(n){return n},scale:1,eq(n){return n==this}};class An{constructor(t,e,i){let s=0,r=0,o=0;this.viewports=i.map(({from:l,to:a})=>{let h=e.lineAt(l,D.ByPos,t,0,0).top,c=e.lineAt(a,D.ByPos,t,0,0).bottom;return s+=c-h,{from:l,to:a,top:h,bottom:c,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(e.height-s);for(let l of this.viewports)l.domTop=o+(l.top-r)*this.scale,o=l.domBottom=l.domTop+(l.bottom-l.top),r=l.bottom}toDOM(t){for(let e=0,i=0,s=0;;e++){let r=ee.from==t.viewports[i].from&&e.to==t.viewports[i].to):!1}}function He(n,t){if(t.scale==1)return n;let e=t.toDOM(n.top),i=t.toDOM(n.bottom);return new Ct(n.from,n.length,e,i-e,Array.isArray(n._content)?n._content.map(s=>He(s,t)):n._content)}const vi=v.define({combine:n=>n.join(" ")}),on=v.define({combine:n=>n.indexOf(!0)>-1}),ln=se.newName(),Sl=se.newName(),xl=se.newName(),wl={"&light":"."+Sl,"&dark":"."+xl};function an(n,t,e){return new se(t,{finish(i){return/&/.test(i)?i.replace(/&\w*/,s=>{if(s=="&")return n;if(!e||!e[s])throw new RangeError(`Unsupported selector: ${s}`);return e[s]}):n+" "+i}})}const tc=an("."+ln,{"&":{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,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",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"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&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",insetInlineStart: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,zIndex:300},"&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,')`,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"}},wl),ec={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},bs=x.ie&&x.ie_version<=11;class ic{constructor(t){this.view=t,this.active=!1,this.editContext=null,this.selectionRange=new qa,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.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=t.contentDOM,this.observer=new MutationObserver(e=>{for(let i of e)this.queue.push(i);(x.ie&&x.ie_version<=11||x.ios&&t.composing)&&e.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&t.constructor.EDIT_CONTEXT!==!1&&!(x.chrome&&x.chrome_version<126)&&(this.editContext=new nc(t),t.state.facet(Jt)&&(t.contentDOM.editContext=this.editContext.editContext)),bs&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),this.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),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var e;((e=this.view.docView)===null||e===void 0?void 0:e.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),e.length>0&&e[e.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(e=>{e.length>0&&e[e.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(t){this.view.inputState.runHandlers("scroll",t),this.intersecting&&this.view.measure()}onScroll(t){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(t)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(t){(t.type=="change"||!t.type)&&!t.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(t){if(this.gapIntersection&&(t.length!=this.gaps.length||this.gaps.some((e,i)=>e!=t[i]))){this.gapIntersection.disconnect();for(let e of t)this.gapIntersection.observe(e);this.gaps=t}}onSelectionChange(t){let e=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:i}=this,s=this.selectionRange;if(i.state.facet(Jt)?i.root.activeElement!=this.dom:!zi(i.dom,s))return;let r=s.anchorNode&&i.docView.nearest(s.anchorNode);if(r&&r.ignoreEvent(t)){e||(this.selectionChanged=!1);return}(x.ie&&x.ie_version<=11||x.android&&x.chrome)&&!i.state.selection.main.empty&&s.focusNode&&ei(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,e=li(t.root);if(!e)return!1;let i=x.safari&&t.root.nodeType==11&&Wa(this.dom.ownerDocument)==this.dom&&sc(this.view,e)||e;if(!i||this.selectionRange.eq(i))return!1;let s=zi(this.dom,i);return s&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime{let r=this.delayedAndroidKey;r&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=r.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&r.force&&ke(this.dom,r.key,r.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(s)}(!this.delayedAndroidKey||t=="Enter")&&(this.delayedAndroidKey={key:t,keyCode:e,force:this.lastChange{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}processRecords(){let t=this.pendingRecords();t.length&&(this.queue=[]);let e=-1,i=-1,s=!1;for(let r of t){let o=this.readMutation(r);o&&(o.typeOver&&(s=!0),e==-1?{from:e,to:i}=o:(e=Math.min(o.from,e),i=Math.max(o.to,i)))}return{from:e,to:i,typeOver:s}}readChange(){let{from:t,to:e,typeOver:i}=this.processRecords(),s=this.selectionChanged&&zi(this.dom,this.selectionRange);if(t<0&&!s)return null;t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let r=new Sh(this.view,t,e,i);return this.view.docView.domChanged={newSel:r.newSel?r.newSel.main:null},r}flush(t=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;t&&this.readSelectionRange();let e=this.readChange();if(!e)return this.view.requestMeasure(),!1;let i=this.view.state,s=fl(this.view,e);return this.view.state==i&&(e.domChanged||e.newSel&&!e.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),s}readMutation(t){let e=this.view.docView.nearest(t.target);if(!e||e.ignoreMutation(t))return null;if(e.markDirty(t.type=="attributes"),t.type=="attributes"&&(e.flags|=4),t.type=="childList"){let i=Ar(e,t.previousSibling||t.target.previousSibling,-1),s=Ar(e,t.nextSibling||t.target.nextSibling,1);return{from:i?e.posAfter(i):e.posAtStart,to:s?e.posBefore(s):e.posAtEnd,typeOver:!1}}else return t.type=="characterData"?{from:e.posAtStart,to:e.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}:null}setWindow(t){t!=this.win&&(this.removeWindowListeners(this.win),this.win=t,this.addWindowListeners(this.win))}addWindowListeners(t){t.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):t.addEventListener("beforeprint",this.onPrint),t.addEventListener("scroll",this.onScroll),t.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(t){t.removeEventListener("scroll",this.onScroll),t.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):t.removeEventListener("beforeprint",this.onPrint),t.document.removeEventListener("selectionchange",this.onSelectionChange)}update(t){this.editContext&&(this.editContext.update(t),t.startState.facet(Jt)!=t.state.facet(Jt)&&(t.view.contentDOM.editContext=t.state.facet(Jt)?this.editContext.editContext:null))}destroy(){var t,e,i;this.stop(),(t=this.intersection)===null||t===void 0||t.disconnect(),(e=this.gapIntersection)===null||e===void 0||e.disconnect(),(i=this.resizeScroll)===null||i===void 0||i.disconnect();for(let s of this.scrollTargets)s.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function Ar(n,t,e){for(;t;){let i=j.get(t);if(i&&i.parent==n)return i;let s=t.parentNode;t=s!=n.dom?s:e>0?t.nextSibling:t.previousSibling}return null}function Cr(n,t){let e=t.startContainer,i=t.startOffset,s=t.endContainer,r=t.endOffset,o=n.docView.domAtPos(n.state.selection.main.anchor);return ei(o.node,o.offset,s,r)&&([e,i,s,r]=[s,r,e,i]),{anchorNode:e,anchorOffset:i,focusNode:s,focusOffset:r}}function sc(n,t){if(t.getComposedRanges){let s=t.getComposedRanges(n.root)[0];if(s)return Cr(n,s)}let e=null;function i(s){s.preventDefault(),s.stopImmediatePropagation(),e=s.getTargetRanges()[0]}return n.contentDOM.addEventListener("beforeinput",i,!0),n.dom.ownerDocument.execCommand("indent"),n.contentDOM.removeEventListener("beforeinput",i,!0),e?Cr(n,e):null}class nc{constructor(t){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.resetRange(t.state);let e=this.editContext=new window.EditContext({text:t.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,t.state.selection.main.anchor))),selectionEnd:this.toContextPos(t.state.selection.main.head)});this.handlers.textupdate=i=>{let{anchor:s}=t.state.selection.main,r={from:this.toEditorPos(i.updateRangeStart),to:this.toEditorPos(i.updateRangeEnd),insert:W.of(i.text.split(` +`))};r.from==this.from&&sthis.to&&(r.to=s),!(r.from==r.to&&!r.insert.length)&&(this.pendingContextChange=r,t.state.readOnly||Rn(t,r,P.single(this.toEditorPos(i.selectionStart),this.toEditorPos(i.selectionEnd))),this.pendingContextChange&&(this.revertPending(t.state),this.setSelection(t.state)))},this.handlers.characterboundsupdate=i=>{let s=[],r=null;for(let o=this.toEditorPos(i.rangeStart),l=this.toEditorPos(i.rangeEnd);o{let s=[];for(let r of i.getTextFormats()){let o=r.underlineStyle,l=r.underlineThickness;if(o!="None"&&l!="None"){let a=`text-decoration: underline ${o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${l=="Thin"?1:2}px`;s.push(B.mark({attributes:{style:a}}).range(this.toEditorPos(r.rangeStart),this.toEditorPos(r.rangeEnd)))}}t.dispatch({effects:sl.of(B.set(s))})},this.handlers.compositionstart=()=>{t.inputState.composing<0&&(t.inputState.composing=0,t.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{t.inputState.composing=-1,t.inputState.compositionFirstChange=null};for(let i in this.handlers)e.addEventListener(i,this.handlers[i]);this.measureReq={read:i=>{this.editContext.updateControlBounds(i.contentDOM.getBoundingClientRect());let s=li(i.root);s&&s.rangeCount&&this.editContext.updateSelectionBounds(s.getRangeAt(0).getBoundingClientRect())}}}applyEdits(t){let e=0,i=!1,s=this.pendingContextChange;return t.changes.iterChanges((r,o,l,a,h)=>{if(i)return;let c=h.length-(o-r);if(s&&o>=s.to)if(s.from==r&&s.to==o&&s.insert.eq(h)){s=this.pendingContextChange=null,e+=c,this.to+=c;return}else s=null,this.revertPending(t.state);if(r+=e,o+=e,o<=this.from)this.from+=c,this.to+=c;else if(rthis.to||this.to-this.from+h.length>3e4){i=!0;return}this.editContext.updateText(this.toContextPos(r),this.toContextPos(o),h.toString()),this.to+=c}e+=c}),s&&!i&&this.revertPending(t.state),!i}update(t){let e=this.pendingContextChange;!this.applyEdits(t)||!this.rangeIsValid(t.state)?(this.pendingContextChange=null,this.resetRange(t.state),this.editContext.updateText(0,this.editContext.text.length,t.state.doc.sliceString(this.from,this.to)),this.setSelection(t.state)):(t.docChanged||t.selectionSet||e)&&this.setSelection(t.state),(t.geometryChanged||t.docChanged||t.selectionSet)&&t.view.requestMeasure(this.measureReq)}resetRange(t){let{head:e}=t.selection.main;this.from=Math.max(0,e-1e4),this.to=Math.min(t.doc.length,e+1e4)}revertPending(t){let e=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(e.from),this.toContextPos(e.from+e.insert.length),t.doc.sliceString(e.from,e.to))}setSelection(t){let{main:e}=t.selection,i=this.toContextPos(Math.max(this.from,Math.min(this.to,e.anchor))),s=this.toContextPos(e.head);(this.editContext.selectionStart!=i||this.editContext.selectionEnd!=s)&&this.editContext.updateSelection(i,s)}rangeIsValid(t){let{head:e}=t.selection.main;return!(this.from>0&&e-this.from<500||this.to1e4*3)}toEditorPos(t){return t+this.from}toContextPos(t){return t-this.from}destroy(){for(let t in this.handlers)this.editContext.removeEventListener(t,this.handlers[t])}}class R{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(t={}){var e;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.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),t.parent&&t.parent.appendChild(this.dom);let{dispatch:i}=t;this.dispatchTransactions=t.dispatchTransactions||i&&(s=>s.forEach(r=>i(r,this)))||(s=>this.update(s)),this.dispatch=this.dispatch.bind(this),this._root=t.root||Ua(t.parent)||document,this.viewState=new Rr(t.state||z.create(t)),t.scrollTo&&t.scrollTo.is(xi)&&(this.viewState.scrollTarget=t.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Be).map(s=>new ds(s));for(let s of this.plugins)s.update(this);this.observer=new ic(this),this.inputState=new kh(this),this.inputState.ensureHandlers(this.plugins),this.docView=new cr(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((e=document.fonts)===null||e===void 0)&&e.ready&&document.fonts.ready.then(()=>this.requestMeasure())}dispatch(...t){let e=t.length==1&&t[0]instanceof H?t:t.length==1&&Array.isArray(t[0])?t[0]:[this.state.update(...t)];this.dispatchTransactions(e,this)}update(t){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let e=!1,i=!1,s,r=this.state;for(let O of t){if(O.startState!=r)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");r=O.state}if(this.destroyed){this.viewState.state=r;return}let o=this.hasFocus,l=0,a=null;t.some(O=>O.annotation(ml))?(this.inputState.notifiedFocused=o,l=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,a=bl(r,o),a||(l=1));let h=this.observer.delayedAndroidKey,c=null;if(h?(this.observer.clearDelayedAndroidKey(),c=this.observer.readChange(),(c&&!this.state.doc.eq(r.doc)||!this.state.selection.eq(r.selection))&&(c=null)):this.observer.clear(),r.facet(z.phrases)!=this.state.facet(z.phrases))return this.setState(r);s=Ni.create(this,r,t),s.flags|=l;let f=this.viewState.scrollTarget;try{this.updateState=2;for(let O of t){if(f&&(f=f.map(O.changes)),O.scrollIntoView){let{main:u}=O.state.selection;f=new Ze(u.empty?u:P.cursor(u.head,u.head>u.anchor?-1:1))}for(let u of O.effects)u.is(xi)&&(f=u.value.clip(this.state))}this.viewState.update(s,f),this.bidiCache=Bi.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),e=this.docView.update(s),this.state.facet(Le)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(e,t.some(O=>O.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(vi)!=s.state.facet(vi)&&(this.viewState.mustMeasureContent=!0),(e||i||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),e&&this.docViewUpdate(),!s.empty)for(let O of this.state.facet(sn))try{O(s)}catch(u){Xt(this.state,u,"update listener")}(a||c)&&Promise.resolve().then(()=>{a&&this.state==a.startState&&this.dispatch(a),c&&!fl(this,c)&&h.force&&ke(this.contentDOM,h.key,h.keyCode)})}setState(t){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=t;return}this.updateState=2;let e=this.hasFocus;try{for(let i of this.plugins)i.destroy(this);this.viewState=new Rr(t),this.plugins=t.facet(Be).map(i=>new ds(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView.destroy(),this.docView=new cr(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}e&&this.focus(),this.requestMeasure()}updatePlugins(t){let e=t.startState.facet(Be),i=t.state.facet(Be);if(e!=i){let s=[];for(let r of i){let o=e.indexOf(r);if(o<0)s.push(new ds(r));else{let l=this.plugins[o];l.mustUpdate=t,s.push(l)}}for(let r of this.plugins)r.mustUpdate!=t&&r.destroy(this);this.plugins=s,this.pluginMap.clear()}else for(let s of this.plugins)s.mustUpdate=t;for(let s=0;s-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,t&&this.observer.forceFlush();let e=null,i=this.scrollDOM,s=i.scrollTop*this.scaleY,{scrollAnchorPos:r,scrollAnchorHeight:o}=this.viewState;Math.abs(s-this.viewState.scrollTop)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(o<0)if(Co(i))r=-1,o=this.viewState.heightMap.height;else{let u=this.viewState.scrollAnchorAt(s);r=u.from,o=u.top}this.updateState=1;let a=this.viewState.measure(this);if(!a&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let h=[];a&4||([this.measureRequests,h]=[h,this.measureRequests]);let c=h.map(u=>{try{return u.read(this)}catch(d){return Xt(this.state,d),Xr}}),f=Ni.create(this,this.state,[]),O=!1;f.flags|=a,e?e.flags|=a:e=f,this.updateState=2,f.empty||(this.updatePlugins(f),this.inputState.update(f),this.updateAttrs(),O=this.docView.update(f),O&&this.docViewUpdate());for(let u=0;u1||d<-1){s=s+d,i.scrollTop=s/this.scaleY,o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(e&&!e.empty)for(let l of this.state.facet(sn))l(e)}get themeClasses(){return ln+" "+(this.state.facet(on)?xl:Sl)+" "+this.state.facet(vi)}updateAttrs(){let t=Wr(this,nl,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),e={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(Jt)?"true":"false",class:"cm-content",style:`${x.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(e["aria-readonly"]="true"),Wr(this,Zn,e);let i=this.observer.ignore(()=>{let s=Fs(this.contentDOM,this.contentAttrs,e),r=Fs(this.dom,this.editorAttrs,t);return s||r});return this.editorAttrs=t,this.contentAttrs=e,i}showAnnouncements(t){let e=!0;for(let i of t)for(let s of i.effects)if(s.is(R.announce)){e&&(this.announceDOM.textContent=""),e=!1;let r=this.announceDOM.appendChild(document.createElement("div"));r.textContent=s.value}}mountStyles(){this.styleModules=this.state.facet(Le);let t=this.state.facet(R.cspNonce);se.mount(this.root,this.styleModules.concat(tc).reverse(),t?{nonce:t}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(t){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),t){if(this.measureRequests.indexOf(t)>-1)return;if(t.key!=null){for(let e=0;ei.spec==t)||null),e&&e.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(t){return this.readMeasured(),this.viewState.elementAtHeight(t)}lineBlockAtHeight(t){return this.readMeasured(),this.viewState.lineBlockAtHeight(t)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(t){return this.viewState.lineBlockAt(t)}get contentHeight(){return this.viewState.contentHeight}moveByChar(t,e,i){return gs(this,t,pr(this,t,e,i))}moveByGroup(t,e){return gs(this,t,pr(this,t,e,i=>mh(this,t.head,i)))}visualLineSide(t,e){let i=this.bidiSpans(t),s=this.textDirectionAt(t.from),r=i[e?i.length-1:0];return P.cursor(r.side(e,s)+t.from,r.forward(!e,s)?1:-1)}moveToLineBoundary(t,e,i=!0){return gh(this,t,e,i)}moveVertically(t,e,i){return gs(this,t,bh(this,t,e,i))}domAtPos(t){return this.docView.domAtPos(t)}posAtDOM(t,e=0){return this.docView.posFromDOM(t,e)}posAtCoords(t,e=!0){return this.readMeasured(),cl(this,t,e)}coordsAtPos(t,e=1){this.readMeasured();let i=this.docView.coordsAt(t,e);if(!i||i.left==i.right)return i;let s=this.state.doc.lineAt(t),r=this.bidiSpans(s),o=r[ie.find(r,t-s.from,-1,e)];return ns(i,o.dir==nt.LTR==e>0)}coordsForChar(t){return this.readMeasured(),this.docView.coordsForChar(t)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(t){return!this.state.facet(el)||tthis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>rc)return Io(t.length);let e=this.textDirectionAt(t.from),i;for(let r of this.bidiCache)if(r.from==t.from&&r.dir==e&&(r.fresh||No(r.isolates,i=hr(this,t))))return r.order;i||(i=hr(this,t));let s=Ka(t.text,e,i);return this.bidiCache.push(new Bi(t.from,t.to,e,i,!0,s)),s}get hasFocus(){var t;return(this.dom.ownerDocument.hasFocus()||x.safari&&((t=this.inputState)===null||t===void 0?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{To(this.contentDOM),this.docView.updateSelection()})}setRoot(t){this._root!=t&&(this._root=t,this.observer.setWindow((t.nodeType==9?t:t.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let t of this.plugins)t.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(t,e={}){return xi.of(new Ze(typeof t=="number"?P.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin))}scrollSnapshot(){let{scrollTop:t,scrollLeft:e}=this.scrollDOM,i=this.viewState.scrollAnchorAt(t);return xi.of(new Ze(P.cursor(i.from),"start","start",i.top-t,e,!0))}setTabFocusMode(t){t==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof t=="boolean"?this.inputState.tabFocusMode=t?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+t)}static domEventHandlers(t){return ye.define(()=>({}),{eventHandlers:t})}static domEventObservers(t){return ye.define(()=>({}),{eventObservers:t})}static theme(t,e){let i=se.newName(),s=[vi.of(i),Le.of(an(`.${i}`,t))];return e&&e.dark&&s.push(on.of(!0)),s}static baseTheme(t){return Oi.lowest(Le.of(an("."+ln,t,wl)))}static findFromDOM(t){var e;let i=t.querySelector(".cm-content"),s=i&&j.get(i)||j.get(t);return((e=s?.rootView)===null||e===void 0?void 0:e.view)||null}}R.styleModule=Le;R.inputHandler=Jo;R.clipboardInputFilter=$n;R.clipboardOutputFilter=kn;R.scrollHandler=il;R.focusChangeEffect=tl;R.perLineTextDirection=el;R.exceptionSink=Ko;R.updateListener=sn;R.editable=Jt;R.mouseSelectionStyle=Ho;R.dragMovesSelection=Fo;R.clickAddsSelectionRange=Lo;R.decorations=hi;R.outerDecorations=rl;R.atomicRanges=vn;R.bidiIsolatedRanges=ol;R.scrollMargins=ll;R.darkTheme=on;R.cspNonce=v.define({combine:n=>n.length?n[0]:""});R.contentAttributes=Zn;R.editorAttributes=nl;R.lineWrapping=R.contentAttributes.of({class:"cm-lineWrapping"});R.announce=N.define();const rc=4096,Xr={};class Bi{constructor(t,e,i,s,r,o){this.from=t,this.to=e,this.dir=i,this.isolates=s,this.fresh=r,this.order=o}static update(t,e){if(e.empty&&!t.some(r=>r.fresh))return t;let i=[],s=t.length?t[t.length-1].dir:nt.LTR;for(let r=Math.max(0,t.length-10);r=0;s--){let r=i[s],o=typeof r=="function"?r(n):r;o&&Ls(o,e)}return e}const oc=x.mac?"mac":x.windows?"win":x.linux?"linux":"key";function lc(n,t){const e=n.split(/-(?!$)/);let i=e[e.length-1];i=="Space"&&(i=" ");let s,r,o,l;for(let a=0;ai.concat(s),[]))),e}let te=null;const cc=4e3;function fc(n,t=oc){let e=Object.create(null),i=Object.create(null),s=(o,l)=>{let a=i[o];if(a==null)i[o]=l;else if(a!=l)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},r=(o,l,a,h,c)=>{var f,O;let u=e[o]||(e[o]=Object.create(null)),d=l.split(/ (?!$)/).map(b=>lc(b,t));for(let b=1;b{let S=te={view:w,prefix:Q,scope:o};return setTimeout(()=>{te==S&&(te=null)},cc),!0}]})}let p=d.join(" ");s(p,!1);let g=u[p]||(u[p]={preventDefault:!1,stopPropagation:!1,run:((O=(f=u._any)===null||f===void 0?void 0:f.run)===null||O===void 0?void 0:O.slice())||[]});a&&g.run.push(a),h&&(g.preventDefault=!0),c&&(g.stopPropagation=!0)};for(let o of n){let l=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let h of l){let c=e[h]||(e[h]=Object.create(null));c._any||(c._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:f}=o;for(let O in c)c[O].run.push(u=>f(u,hn))}let a=o[t]||o.key;if(a)for(let h of l)r(h,a,o.run,o.preventDefault,o.stopPropagation),o.shift&&r(h,"Shift-"+a,o.shift,o.preventDefault,o.stopPropagation)}return e}let hn=null;function Oc(n,t,e,i){hn=t;let s=Xa(t),r=Yi(s,0),o=As(r)==s.length&&s!=" ",l="",a=!1,h=!1,c=!1;te&&te.view==e&&te.scope==i&&(l=te.prefix+" ",ul.indexOf(t.keyCode)<0&&(h=!0,te=null));let f=new Set,O=g=>{if(g){for(let b of g.run)if(!f.has(b)&&(f.add(b),b(e)))return g.stopPropagation&&(c=!0),!0;g.preventDefault&&(g.stopPropagation&&(c=!0),h=!0)}return!1},u=n[i],d,p;return u&&(O(u[l+Ri(s,t,!o)])?a=!0:o&&(t.altKey||t.metaKey||t.ctrlKey)&&!(x.windows&&t.ctrlKey&&t.altKey)&&(d=ne[t.keyCode])&&d!=s?(O(u[l+Ri(d,t,!0)])||t.shiftKey&&(p=oi[t.keyCode])!=s&&p!=d&&O(u[l+Ri(p,t,!1)]))&&(a=!0):o&&t.shiftKey&&O(u[l+Ri(s,t,!0)])&&(a=!0),!a&&O(u._any)&&(a=!0)),h&&(a=!0),a&&c&&t.stopPropagation(),hn=null,a}const uc=!x.ios,Mr={".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"}},".cm-content":{"& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}};uc&&(Mr[".cm-line"].caretColor=Mr[".cm-content"].caretColor="transparent !important");class Ye extends ge{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}Ye.prototype.elementClass="";Ye.prototype.toDOM=void 0;Ye.prototype.mapMode=lt.TrackBefore;Ye.prototype.startSide=Ye.prototype.endSide=-1;Ye.prototype.point=!0;function Pl(n,t){const e=new ui,i=r=>{t()?.dispatch({effects:e.reconfigure(r)})};return pe(Te([t,typeof n=="function"?n:()=>n],([r,o])=>{r&&o&&(e.get(r.state)?i(o):r.dispatch({effects:N.appendConfig.of(e.of(o))}))},{defer:!0})),i}function dc(n){const[t,e]=Vn(),[i,s]=Vn();function r(l){return Pl(l,i)}const o=R.updateListener.of(l=>n?.onModelViewUpdate?.(l));return r(o),pe(Te(t,l=>{const a=z.create({doc:n?.value??""}),h=new R({state:a,parent:l,dispatch:(c,f)=>{if(n?.onTransactionDispatched&&n.onTransactionDispatched(c,f),h.update([c]),c.docChanged){const u=c.state.doc.toString();n?.onValueChange?.(u)}}});ia(()=>s(h)),sa(()=>{i()?.destroy(),s(void 0)})})),pe(Te(i,l=>{const a=l?.state.doc.toString();a!==n?.value&&l&&l.dispatch({changes:{from:0,to:a?.length,insert:n?.value??""}})},{defer:!0})),{editorView:i,ref:e,createExtension:r}}function zr(n){return n?R.editable.of(!1):[]}function pc(n,t){const e=t?na(t):!1,i=Pl(zr(e),n);pe(Te(t,s=>i(zr(s))))}function gc(n,t){const e=Ie(t);pe(Te(n,i=>{i&&pe(Te(e,s=>{const r=i?.state.doc.toString();r!==s&&i.dispatch({changes:{from:0,to:r?.length,insert:s??""}})}))}))}const $l=1024;let mc=0;class Qs{constructor(t,e){this.from=t,this.to=e}}class Y{constructor(t={}){this.id=mc++,this.perNode=!!t.perNode,this.deserialize=t.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(t){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof t!="function"&&(t=ut.match(t)),e=>{let i=t(e);return i===void 0?null:[this,i]}}}Y.closedBy=new Y({deserialize:n=>n.split(" ")});Y.openedBy=new Y({deserialize:n=>n.split(" ")});Y.group=new Y({deserialize:n=>n.split(" ")});Y.isolate=new Y({deserialize:n=>{if(n&&n!="rtl"&&n!="ltr"&&n!="auto")throw new RangeError("Invalid value for isolate: "+n);return n||"auto"}});Y.contextHash=new Y({perNode:!0});Y.lookAhead=new Y({perNode:!0});Y.mounted=new Y({perNode:!0});class Li{constructor(t,e,i){this.tree=t,this.overlay=e,this.parser=i}static get(t){return t&&t.props&&t.props[Y.mounted.id]}}const bc=Object.create(null);class ut{constructor(t,e,i,s=0){this.name=t,this.props=e,this.id=i,this.flags=s}static define(t){let e=t.props&&t.props.length?Object.create(null):bc,i=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),s=new ut(t.name||"",e,t.id,i);if(t.props){for(let r of t.props)if(Array.isArray(r)||(r=r(s)),r){if(r[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");e[r[0].id]=r[1]}}return s}prop(t){return this.props[t.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(t){if(typeof t=="string"){if(this.name==t)return!0;let e=this.prop(Y.group);return e?e.indexOf(t)>-1:!1}return this.id==t}static match(t){let e=Object.create(null);for(let i in t)for(let s of i.split(" "))e[s]=t[i];return i=>{for(let s=i.prop(Y.group),r=-1;r<(s?s.length:0);r++){let o=e[r<0?i.name:s[r]];if(o)return o}}}}ut.none=new ut("",Object.create(null),0,8);class Cn{constructor(t){this.types=t;for(let e=0;e0;for(let a=this.cursor(o|tt.IncludeAnonymous);;){let h=!1;if(a.from<=r&&a.to>=s&&(!l&&a.type.isAnonymous||e(a)!==!1)){if(a.firstChild())continue;h=!0}for(;h&&i&&(l||!a.type.isAnonymous)&&i(a),!a.nextSibling();){if(!a.parent())return;h=!0}}}prop(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t)}get propValues(){let t=[];if(this.props)for(let e in this.props)t.push([+e,this.props[e]]);return t}balance(t={}){return this.children.length<=8?this:Yn(ut.none,this.children,this.positions,0,this.children.length,0,this.length,(e,i,s)=>new K(this.type,e,i,s,this.propValues),t.makeTree||((e,i,s)=>new K(ut.none,e,i,s)))}static build(t){return xc(t)}}K.empty=new K(ut.none,[],[],0);class Xn{constructor(t,e){this.buffer=t,this.index=e}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new Xn(this.buffer,this.index)}}class oe{constructor(t,e,i){this.buffer=t,this.length=e,this.set=i}get type(){return ut.none}toString(){let t=[];for(let e=0;e0));a=o[a+3]);return l}slice(t,e,i){let s=this.buffer,r=new Uint16Array(e-t),o=0;for(let l=t,a=0;l=t&&et;case 1:return e<=t&&i>t;case 2:return i>t;case 4:return!0}}function ci(n,t,e,i){for(var s;n.from==n.to||(e<1?n.from>=t:n.from>t)||(e>-1?n.to<=t:n.to0?l.length:-1;t!=h;t+=e){let c=l[t],f=a[t]+o.from;if(kl(s,i,f,f+c.length)){if(c instanceof oe){if(r&tt.ExcludeBuffers)continue;let O=c.findChild(0,c.buffer.length,e,i-f,s);if(O>-1)return new Wt(new Qc(o,c,t,f),null,O)}else if(r&tt.IncludeAnonymous||!c.type.isAnonymous||Wn(c)){let O;if(!(r&tt.IgnoreMounts)&&(O=Li.get(c))&&!O.overlay)return new Ot(O.tree,f,t,o);let u=new Ot(c,f,t,o);return r&tt.IncludeAnonymous||!u.type.isAnonymous?u:u.nextChild(e<0?c.children.length-1:0,e,i,s)}}}if(r&tt.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?t=o.index+e:t=e<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(t){return this.nextChild(0,1,t,2)}childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}enter(t,e,i=0){let s;if(!(i&tt.IgnoreOverlays)&&(s=Li.get(this._tree))&&s.overlay){let r=t-this.from;for(let{from:o,to:l}of s.overlay)if((e>0?o<=r:o=r:l>r))return new Ot(s.tree,s.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,e,i)}nextSignificantParent(){let t=this;for(;t.type.isAnonymous&&t._parent;)t=t._parent;return t}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function Ur(n,t,e,i){let s=n.cursor(),r=[];if(!s.firstChild())return r;if(e!=null){for(let o=!1;!o;)if(o=s.type.is(e),!s.nextSibling())return r}for(;;){if(i!=null&&s.type.is(i))return r;if(s.type.is(t)&&r.push(s.node),!s.nextSibling())return i==null?r:[]}}function cn(n,t,e=t.length-1){for(let i=n.parent;e>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(t[e]&&t[e]!=i.name)return!1;e--}}return!0}class Qc{constructor(t,e,i,s){this.parent=t,this.buffer=e,this.index=i,this.start=s}}class Wt extends Zl{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(t,e,i){super(),this.context=t,this._parent=e,this.index=i,this.type=t.buffer.set.types[t.buffer.buffer[i]]}child(t,e,i){let{buffer:s}=this.context,r=s.findChild(this.index+4,s.buffer[this.index+3],t,e-this.context.start,i);return r<0?null:new Wt(this.context,this,r)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(t){return this.child(1,t,2)}childBefore(t){return this.child(-1,t,-2)}enter(t,e,i=0){if(i&tt.ExcludeBuffers)return null;let{buffer:s}=this.context,r=s.findChild(this.index+4,s.buffer[this.index+3],e>0?1:-1,t-this.context.start,e);return r<0?null:new Wt(this.context,this,r)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4)}get nextSibling(){let{buffer:t}=this.context,e=t.buffer[this.index+3];return e<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new Wt(this.context,this._parent,e):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,e=this._parent?this._parent.index+4:0;return this.index==e?this.externalSibling(-1):new Wt(this.context,this._parent,t.findChild(e,this.index,-1,0,4))}get tree(){return null}toTree(){let t=[],e=[],{buffer:i}=this.context,s=this.index+4,r=i.buffer[this.index+3];if(r>s){let o=i.buffer[this.index+1];t.push(i.slice(s,r,o)),e.push(0)}return new K(this.type,t,e,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function vl(n){if(!n.length)return null;let t=0,e=n[0];for(let r=1;re.from||o.to=t){let l=new Ot(o.tree,o.overlay[0].from+r.from,-1,r);(s||(s=[i])).push(ci(l,t,e,!1))}}return s?vl(s):i}class fn{get name(){return this.type.name}constructor(t,e=0){if(this.mode=e,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof Ot)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let i=t._parent;i;i=i._parent)this.stack.unshift(i.index);this.bufferNode=t,this.yieldBuf(t.index)}}yieldNode(t){return t?(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0):!1}yieldBuf(t,e){this.index=t;let{start:i,buffer:s}=this.buffer;return this.type=e||s.set.types[s.buffer[t]],this.from=i+s.buffer[t+1],this.to=i+s.buffer[t+2],!0}yield(t){return t?t instanceof Ot?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,e,i){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,e,i,this.mode));let{buffer:s}=this.buffer,r=s.findChild(this.index+4,s.buffer[this.index+3],t,e-this.buffer.start,i);return r<0?!1:(this.stack.push(this.index),this.yieldBuf(r))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,e,i=this.mode){return this.buffer?i&tt.ExcludeBuffers?!1:this.enterChild(1,t,e):this.yield(this._tree.enter(t,e,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&tt.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&tt.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode)):!1;let{buffer:e}=this.buffer,i=this.stack.length-1;if(t<0){let s=i<0?0:this.stack[i]+4;if(this.index!=s)return this.yieldBuf(e.findChild(s,this.index,-1,0,4))}else{let s=e.buffer[this.index+3];if(s<(i<0?e.buffer.length:e.buffer[this.stack[i]+3]))return this.yieldBuf(s)}return i<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let e,i,{buffer:s}=this;if(s){if(t>0){if(this.index-1)for(let r=e+t,o=t<0?-1:i._tree.children.length;r!=o;r+=t){let l=i._tree.children[r];if(this.mode&tt.IncludeAnonymous||l instanceof oe||!l.type.isAnonymous||Wn(l))return!1}return!0}move(t,e){if(e&&this.enterChild(t,0,4))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1}}next(t=!0){return this.move(1,t)}prev(t=!0){return this.move(-1,t)}moveTo(t,e=0){for(;(this.from==this.to||(e<1?this.from>=t:this.from>t)||(e>-1?this.to<=t:this.to=0;){for(let o=t;o;o=o._parent)if(o.index==s){if(s==this.index)return o;e=o,i=r+1;break t}s=this.stack[--r]}for(let s=i;s=0;r--){if(r<0)return cn(this.node,t,s);let o=i[e.buffer[this.stack[r]]];if(!o.isAnonymous){if(t[s]&&t[s]!=o.name)return!1;s--}}return!0}}function Wn(n){return n.children.some(t=>t instanceof oe||!t.type.isAnonymous||Wn(t))}function xc(n){var t;let{buffer:e,nodeSet:i,maxBufferLength:s=$l,reused:r=[],minRepeatType:o=i.types.length}=n,l=Array.isArray(e)?new Xn(e,e.length):e,a=i.types,h=0,c=0;function f(k,T,Z,E,M,X){let{id:C,start:$,end:V,size:q}=l,et=c;for(;q<0;)if(l.next(),q==-1){let mt=r[C];Z.push(mt),E.push($-k);return}else if(q==-3){h=C;return}else if(q==-4){c=C;return}else throw new RangeError(`Unrecognized record size: ${q}`);let gt=a[C],qt,xt,Bt=$-k;if(V-$<=s&&(xt=g(l.pos-T,M))){let mt=new Uint16Array(xt.size-xt.skip),I=l.pos-xt.size,kt=mt.length;for(;l.pos>I;)kt=b(xt.start,mt,kt);qt=new oe(mt,V-xt.start,i),Bt=xt.start-k}else{let mt=l.pos-q;l.next();let I=[],kt=[],ae=C>=o?C:-1,Se=0,bi=V;for(;l.pos>mt;)ae>=0&&l.id==ae&&l.size>=0?(l.end<=bi-s&&(d(I,kt,$,Se,l.end,bi,ae,et),Se=I.length,bi=l.end),l.next()):X>2500?O($,mt,I,kt):f($,mt,I,kt,ae,X+1);if(ae>=0&&Se>0&&Se-1&&Se>0){let En=u(gt);qt=Yn(gt,I,kt,0,I.length,0,V-$,En,En)}else qt=p(gt,I,kt,V-$,et-V)}Z.push(qt),E.push(Bt)}function O(k,T,Z,E){let M=[],X=0,C=-1;for(;l.pos>T;){let{id:$,start:V,end:q,size:et}=l;if(et>4)l.next();else{if(C>-1&&V=0;q-=3)$[et++]=M[q],$[et++]=M[q+1]-V,$[et++]=M[q+2]-V,$[et++]=et;Z.push(new oe($,M[2]-V,i)),E.push(V-k)}}function u(k){return(T,Z,E)=>{let M=0,X=T.length-1,C,$;if(X>=0&&(C=T[X])instanceof K){if(!X&&C.type==k&&C.length==E)return C;($=C.prop(Y.lookAhead))&&(M=Z[X]+C.length+$)}return p(k,T,Z,E,M)}}function d(k,T,Z,E,M,X,C,$){let V=[],q=[];for(;k.length>E;)V.push(k.pop()),q.push(T.pop()+Z-M);k.push(p(i.types[C],V,q,X-M,$-X)),T.push(M-Z)}function p(k,T,Z,E,M=0,X){if(h){let C=[Y.contextHash,h];X=X?[C].concat(X):[C]}if(M>25){let C=[Y.lookAhead,M];X=X?[C].concat(X):[C]}return new K(k,T,Z,E,X)}function g(k,T){let Z=l.fork(),E=0,M=0,X=0,C=Z.end-s,$={size:0,start:0,skip:0};t:for(let V=Z.pos-k;Z.pos>V;){let q=Z.size;if(Z.id==T&&q>=0){$.size=E,$.start=M,$.skip=X,X+=4,E+=4,Z.next();continue}let et=Z.pos-q;if(q<0||et=o?4:0,qt=Z.start;for(Z.next();Z.pos>et;){if(Z.size<0)if(Z.size==-3)gt+=4;else break t;else Z.id>=o&&(gt+=4);Z.next()}M=qt,E+=q,X+=gt}return(T<0||E==k)&&($.size=E,$.start=M,$.skip=X),$.size>4?$:void 0}function b(k,T,Z){let{id:E,start:M,end:X,size:C}=l;if(l.next(),C>=0&&E4){let V=l.pos-(C-4);for(;l.pos>V;)Z=b(k,T,Z)}T[--Z]=$,T[--Z]=X-k,T[--Z]=M-k,T[--Z]=E}else C==-3?h=E:C==-4&&(c=E);return Z}let Q=[],w=[];for(;l.pos>0;)f(n.start||0,n.bufferStart||0,Q,w,-1,0);let S=(t=n.length)!==null&&t!==void 0?t:Q.length?w[0]+Q[0].length:0;return new K(a[n.topID],Q.reverse(),w.reverse(),S)}const jr=new WeakMap;function ji(n,t){if(!n.isAnonymous||t instanceof oe||t.type!=n)return 1;let e=jr.get(t);if(e==null){e=1;for(let i of t.children){if(i.type!=n||!(i instanceof K)){e=1;break}e+=ji(n,i)}jr.set(t,e)}return e}function Yn(n,t,e,i,s,r,o,l,a){let h=0;for(let d=i;d=c)break;T+=Z}if(w==S+1){if(T>c){let Z=d[S];u(Z.children,Z.positions,0,Z.children.length,p[S]+Q);continue}f.push(d[S])}else{let Z=p[w-1]+d[w-1].length-k;f.push(Yn(n,d,p,S,w,k,Z,null,a))}O.push(k+Q-r)}}return u(t,e,i,s,0),(l||a)(f,O,o)}class wc{constructor(){this.map=new WeakMap}setBuffer(t,e,i){let s=this.map.get(t);s||this.map.set(t,s=new Map),s.set(e,i)}getBuffer(t,e){let i=this.map.get(t);return i&&i.get(e)}set(t,e){t instanceof Wt?this.setBuffer(t.context.buffer,t.index,e):t instanceof Ot&&this.map.set(t.tree,e)}get(t){return t instanceof Wt?this.getBuffer(t.context.buffer,t.index):t instanceof Ot?this.map.get(t.tree):void 0}cursorSet(t,e){t.buffer?this.setBuffer(t.buffer.buffer,t.index,e):this.map.set(t.tree,e)}cursorGet(t){return t.buffer?this.getBuffer(t.buffer.buffer,t.index):this.map.get(t.tree)}}class ue{constructor(t,e,i,s,r=!1,o=!1){this.from=t,this.to=e,this.tree=i,this.offset=s,this.open=(r?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(t,e=[],i=!1){let s=[new ue(0,t.length,t,0,!1,i)];for(let r of e)r.to>t.length&&s.push(r);return s}static applyChanges(t,e,i=128){if(!e.length)return t;let s=[],r=1,o=t.length?t[0]:null;for(let l=0,a=0,h=0;;l++){let c=l=i)for(;o&&o.from=O.from||f<=O.to||h){let u=Math.max(O.from,a)-h,d=Math.min(O.to,f)-h;O=u>=d?null:new ue(u,d,O.tree,O.offset+h,l>0,!!c)}if(O&&s.push(O),o.to>f)break;o=rnew Qs(s.from,s.to)):[new Qs(0,0)]:[new Qs(0,t.length)],this.createParse(t,e||[],i)}parse(t,e,i){let s=this.startParse(t,e,i);for(;;){let r=s.advance();if(r)return r}}}class Pc{constructor(t){this.string=t}get length(){return this.string.length}chunk(t){return this.string.slice(t)}get lineChunks(){return!1}read(t,e){return this.string.slice(t,e)}}new Y({perNode:!0});let $c=0;class bt{constructor(t,e,i,s){this.name=t,this.set=e,this.base=i,this.modified=s,this.id=$c++}toString(){let{name:t}=this;for(let e of this.modified)e.name&&(t=`${e.name}(${t})`);return t}static define(t,e){let i=typeof t=="string"?t:"?";if(t instanceof bt&&(e=t),e?.base)throw new Error("Can not derive from a modified tag");let s=new bt(i,[],null,[]);if(s.set.push(s),e)for(let r of e.set)s.set.push(r);return s}static defineModifier(t){let e=new Fi(t);return i=>i.modified.indexOf(e)>-1?i:Fi.get(i.base||i,i.modified.concat(e).sort((s,r)=>s.id-r.id))}}let kc=0;class Fi{constructor(t){this.name=t,this.instances=[],this.id=kc++}static get(t,e){if(!e.length)return t;let i=e[0].instances.find(l=>l.base==t&&Zc(e,l.modified));if(i)return i;let s=[],r=new bt(t.name,s,t,e);for(let l of e)l.instances.push(r);let o=vc(e);for(let l of t.set)if(!l.modified.length)for(let a of o)s.push(Fi.get(l,a));return r}}function Zc(n,t){return n.length==t.length&&n.every((e,i)=>e==t[i])}function vc(n){let t=[[]];for(let e=0;ei.length-e.length)}function Tl(n){let t=Object.create(null);for(let e in n){let i=n[e];Array.isArray(i)||(i=[i]);for(let s of e.split(" "))if(s){let r=[],o=2,l=s;for(let f=0;;){if(l=="..."&&f>0&&f+3==s.length){o=1;break}let O=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!O)throw new RangeError("Invalid path: "+s);if(r.push(O[0]=="*"?"":O[0][0]=='"'?JSON.parse(O[0]):O[0]),f+=O[0].length,f==s.length)break;let u=s[f++];if(f==s.length&&u=="!"){o=0;break}if(u!="/")throw new RangeError("Invalid path: "+s);l=s.slice(f)}let a=r.length-1,h=r[a];if(!h)throw new RangeError("Invalid path: "+s);let c=new Hi(i,o,a>0?r.slice(0,a):null);t[h]=c.sort(t[h])}}return Al.add(t)}const Al=new Y;class Hi{constructor(t,e,i,s){this.tags=t,this.mode=e,this.context=i,this.next=s}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(t){return!t||t.depth{let o=s;for(let l of r)for(let a of l.set){let h=e[a.id];if(h){o=o?o+" "+h:h;break}}return o},scope:i}}function Rc(n,t){let e=null;for(let i of n){let s=i.style(t);s&&(e=e?e+" "+s:s)}return e}function Tc(n,t,e,i=0,s=n.length){let r=new Ac(i,Array.isArray(t)?t:[t],e);r.highlightRange(n.cursor(),i,s,"",r.highlighters),r.flush(s)}class Ac{constructor(t,e,i){this.at=t,this.highlighters=e,this.span=i,this.class=""}startSpan(t,e){e!=this.class&&(this.flush(t),t>this.at&&(this.at=t),this.class=e)}flush(t){t>this.at&&this.class&&this.span(this.at,t,this.class)}highlightRange(t,e,i,s,r){let{type:o,from:l,to:a}=t;if(l>=i||a<=e)return;o.isTop&&(r=this.highlighters.filter(u=>!u.scope||u.scope(o)));let h=s,c=Cc(t)||Hi.empty,f=Rc(r,c.tags);if(f&&(h&&(h+=" "),h+=f,c.mode==1&&(s+=(s?" ":"")+f)),this.startSpan(Math.max(e,l),h),c.opaque)return;let O=t.tree&&t.tree.prop(Y.mounted);if(O&&O.overlay){let u=t.node.enter(O.overlay[0].from+l,1),d=this.highlighters.filter(g=>!g.scope||g.scope(O.tree.type)),p=t.firstChild();for(let g=0,b=l;;g++){let Q=g=w||!t.nextSibling())););if(!Q||w>i)break;b=Q.to+l,b>e&&(this.highlightRange(u.cursor(),Math.max(e,Q.from+l),Math.min(i,b),"",d),this.startSpan(Math.min(i,b),h))}p&&t.parent()}else if(t.firstChild()){O&&(s="");do if(!(t.to<=e)){if(t.from>=i)break;this.highlightRange(t,e,i,s,r),this.startSpan(Math.min(i,t.to),h)}while(t.nextSibling());t.parent()}}}function Cc(n){let t=n.type.prop(Al);for(;t&&t.context&&!n.matchContext(t.context);)t=t.next;return t||null}const y=bt.define,Ai=y(),Ht=y(),Er=y(Ht),Vr=y(Ht),Kt=y(),Ci=y(Kt),ys=y(Kt),Tt=y(),he=y(Tt),vt=y(),Rt=y(),On=y(),Ve=y(On),Xi=y(),m={comment:Ai,lineComment:y(Ai),blockComment:y(Ai),docComment:y(Ai),name:Ht,variableName:y(Ht),typeName:Er,tagName:y(Er),propertyName:Vr,attributeName:y(Vr),className:y(Ht),labelName:y(Ht),namespace:y(Ht),macroName:y(Ht),literal:Kt,string:Ci,docString:y(Ci),character:y(Ci),attributeValue:y(Ci),number:ys,integer:y(ys),float:y(ys),bool:y(Kt),regexp:y(Kt),escape:y(Kt),color:y(Kt),url:y(Kt),keyword:vt,self:y(vt),null:y(vt),atom:y(vt),unit:y(vt),modifier:y(vt),operatorKeyword:y(vt),controlKeyword:y(vt),definitionKeyword:y(vt),moduleKeyword:y(vt),operator:Rt,derefOperator:y(Rt),arithmeticOperator:y(Rt),logicOperator:y(Rt),bitwiseOperator:y(Rt),compareOperator:y(Rt),updateOperator:y(Rt),definitionOperator:y(Rt),typeOperator:y(Rt),controlOperator:y(Rt),punctuation:On,separator:y(On),bracket:Ve,angleBracket:y(Ve),squareBracket:y(Ve),paren:y(Ve),brace:y(Ve),content:Tt,heading:he,heading1:y(he),heading2:y(he),heading3:y(he),heading4:y(he),heading5:y(he),heading6:y(he),contentSeparator:y(Tt),list:y(Tt),quote:y(Tt),emphasis:y(Tt),strong:y(Tt),link:y(Tt),monospace:y(Tt),strikethrough:y(Tt),inserted:y(),deleted:y(),changed:y(),invalid:y(),meta:Xi,documentMeta:y(Xi),annotation:y(Xi),processingInstruction:y(Xi),definition:bt.defineModifier("definition"),constant:bt.defineModifier("constant"),function:bt.defineModifier("function"),standard:bt.defineModifier("standard"),local:bt.defineModifier("local"),special:bt.defineModifier("special")};for(let n in m){let t=m[n];t instanceof bt&&(t.name=n)}Cl([{tag:m.link,class:"tok-link"},{tag:m.heading,class:"tok-heading"},{tag:m.emphasis,class:"tok-emphasis"},{tag:m.strong,class:"tok-strong"},{tag:m.keyword,class:"tok-keyword"},{tag:m.atom,class:"tok-atom"},{tag:m.bool,class:"tok-bool"},{tag:m.url,class:"tok-url"},{tag:m.labelName,class:"tok-labelName"},{tag:m.inserted,class:"tok-inserted"},{tag:m.deleted,class:"tok-deleted"},{tag:m.literal,class:"tok-literal"},{tag:m.string,class:"tok-string"},{tag:m.number,class:"tok-number"},{tag:[m.regexp,m.escape,m.special(m.string)],class:"tok-string2"},{tag:m.variableName,class:"tok-variableName"},{tag:m.local(m.variableName),class:"tok-variableName tok-local"},{tag:m.definition(m.variableName),class:"tok-variableName tok-definition"},{tag:m.special(m.variableName),class:"tok-variableName2"},{tag:m.definition(m.propertyName),class:"tok-propertyName tok-definition"},{tag:m.typeName,class:"tok-typeName"},{tag:m.namespace,class:"tok-namespace"},{tag:m.className,class:"tok-className"},{tag:m.macroName,class:"tok-macroName"},{tag:m.propertyName,class:"tok-propertyName"},{tag:m.operator,class:"tok-operator"},{tag:m.comment,class:"tok-comment"},{tag:m.meta,class:"tok-meta"},{tag:m.invalid,class:"tok-invalid"},{tag:m.punctuation,class:"tok-punctuation"}]);var Ss;const we=new Y;function Xl(n){return v.define({combine:n?t=>t.concat(n):void 0})}const Mn=new Y;class wt{constructor(t,e,i=[],s=""){this.data=t,this.name=s,z.prototype.hasOwnProperty("tree")||Object.defineProperty(z.prototype,"tree",{get(){return le(this)}}),this.parser=e,this.extension=[ze.of(this),z.languageData.of((r,o,l)=>{let a=_r(r,o,l),h=a.type.prop(we);if(!h)return[];let c=r.facet(h),f=a.type.prop(Mn);if(f){let O=a.resolve(o-a.from,l);for(let u of f)if(u.test(O,r)){let d=r.facet(u.facet);return u.type=="replace"?d:d.concat(c)}}return c})].concat(i)}isActiveAt(t,e,i=-1){return _r(t,e,i).type.prop(we)==this.data}findRegions(t){let e=t.facet(ze);if(e?.data==this.data)return[{from:0,to:t.doc.length}];if(!e||!e.allowsNesting)return[];let i=[],s=(r,o)=>{if(r.prop(we)==this.data){i.push({from:o,to:o+r.length});return}let l=r.prop(Y.mounted);if(l){if(l.tree.prop(we)==this.data){if(l.overlay)for(let a of l.overlay)i.push({from:a.from+o,to:a.to+o});else i.push({from:o,to:o+r.length});return}else if(l.overlay){let a=i.length;if(s(l.tree,l.overlay[0].from+o),i.length>a)return}}for(let a=0;ai.isTop?e:void 0)]}),t.name)}configure(t,e){return new Ki(this.data,this.parser.configure(t),e||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function le(n){let t=n.field(wt.state,!1);return t?t.tree:K.empty}class Xc{constructor(t){this.doc=t,this.cursorPos=0,this.string="",this.cursor=t.iter()}get length(){return this.doc.length}syncTo(t){return this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length}chunk(t){return this.syncTo(t),this.string}get lineChunks(){return!0}read(t,e){let i=this.cursorPos-this.string.length;return t=this.cursorPos?this.doc.sliceString(t,e):this.string.slice(t-i,e-i)}}let _e=null;class Ji{constructor(t,e,i=[],s,r,o,l,a){this.parser=t,this.state=e,this.fragments=i,this.tree=s,this.treeLen=r,this.viewport=o,this.skipped=l,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(t,e,i){return new Ji(t,e,[],K.empty,0,i,[],null)}startParse(){return this.parser.startParse(new Xc(this.state.doc),this.fragments)}work(t,e){return e!=null&&e>=this.state.doc.length&&(e=void 0),this.tree!=K.empty&&this.isDone(e??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var i;if(typeof t=="number"){let s=Date.now()+t;t=()=>Date.now()>s}for(this.parse||(this.parse=this.startParse()),e!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&e=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&this.parse.stopAt(t),this.withContext(()=>{for(;!(e=this.parse.advance()););}),this.treeLen=t,this.tree=e,this.fragments=this.withoutTempSkipped(ue.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let e=_e;_e=this;try{return t()}finally{_e=e}}withoutTempSkipped(t){for(let e;e=this.tempSkipped.pop();)t=Dr(t,e.from,e.to);return t}changes(t,e){let{fragments:i,tree:s,treeLen:r,viewport:o,skipped:l}=this;if(this.takeTree(),!t.empty){let a=[];if(t.iterChangedRanges((h,c,f,O)=>a.push({fromA:h,toA:c,fromB:f,toB:O})),i=ue.applyChanges(i,a),s=K.empty,r=0,o={from:t.mapPos(o.from,-1),to:t.mapPos(o.to,1)},this.skipped.length){l=[];for(let h of this.skipped){let c=t.mapPos(h.from,1),f=t.mapPos(h.to,-1);ct.from&&(this.fragments=Dr(this.fragments,s,r),this.skipped.splice(i--,1))}return this.skipped.length>=e?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(t,e){this.skipped.push({from:t,to:e})}static getSkippingParser(t){return new class extends Rl{createParse(e,i,s){let r=s[0].from,o=s[s.length-1].to;return{parsedPos:r,advance(){let a=_e;if(a){for(let h of s)a.tempSkipped.push(h);t&&(a.scheduleOn=a.scheduleOn?Promise.all([a.scheduleOn,t]):t)}return this.parsedPos=o,new K(ut.none,[],[],o-r)},stoppedAt:null,stopAt(){}}}}}isDone(t){t=Math.min(t,this.state.doc.length);let e=this.fragments;return this.treeLen>=t&&e.length&&e[0].from==0&&e[0].to>=t}static get(){return _e}}function Dr(n,t,e){return ue.applyChanges(n,[{fromA:t,toA:e,fromB:t,toB:e}])}class Me{constructor(t){this.context=t,this.tree=t.tree}apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;let e=this.context.changes(t.changes,t.state),i=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),e.viewport.to);return e.work(20,i)||e.takeTree(),new Me(e)}static init(t){let e=Math.min(3e3,t.doc.length),i=Ji.create(t.facet(ze).parser,t,{from:0,to:e});return i.work(20,e)||i.takeTree(),new Me(i)}}wt.state=Nt.define({create:Me.init,update(n,t){for(let e of t.effects)if(e.is(wt.setState))return e.value;return t.startState.facet(ze)!=t.state.facet(ze)?Me.init(t.state):n.apply(t)}});let Wl=n=>{let t=setTimeout(()=>n(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<"u"&&(Wl=n=>{let t=-1,e=setTimeout(()=>{t=requestIdleCallback(n,{timeout:400})},100);return()=>t<0?clearTimeout(e):cancelIdleCallback(t)});const xs=typeof navigator<"u"&&(!((Ss=navigator.scheduling)===null||Ss===void 0)&&Ss.isInputPending)?()=>navigator.scheduling.isInputPending():null,Wc=ye.fromClass(class{constructor(t){this.view=t,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(t){let e=this.view.state.field(wt.state).context;(e.updateViewport(t.view.viewport)||this.view.viewport.to>e.treeLen)&&this.scheduleWork(),(t.docChanged||t.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(e)}scheduleWork(){if(this.working)return;let{state:t}=this.view,e=t.field(wt.state);(e.tree!=e.context.tree||!e.context.isDone(t.doc.length))&&(this.working=Wl(this.work))}work(t){this.working=null;let e=Date.now();if(this.chunkEnds+1e3,a=r.context.work(()=>xs&&xs()||Date.now()>o,s+(l?0:1e5));this.chunkBudget-=Date.now()-e,(a||this.chunkBudget<=0)&&(r.context.takeTree(),this.view.dispatch({effects:wt.setState.of(new Me(r.context))})),this.chunkBudget>0&&!(a&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(r.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then(()=>this.scheduleWork()).catch(e=>Xt(this.view.state,e)).then(()=>this.workScheduled--),t.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),ze=v.define({combine(n){return n.length?n[0]:null},enables:n=>[wt.state,Wc,R.contentAttributes.compute([n],t=>{let e=t.facet(n);return e&&e.name?{"data-language":e.name}:{}})]});class Yc{constructor(t,e=[]){this.language=t,this.support=e,this.extension=[t,e]}}const Mc=v.define({combine:n=>{if(!n.length)return" ";let t=n[0];if(!t||/\S/.test(t)||Array.from(t).some(e=>e!=t[0]))throw new Error("Invalid indent unit: "+JSON.stringify(n[0]));return t}}),zc=new Y;function qc(n){let t=n.node,e=t.childAfter(t.from),i=t.lastChild;if(!e)return null;let s=n.options.simulateBreak,r=n.state.doc.lineAt(e.from),o=s==null||s<=r.from?r.to:Math.min(r.to,s);for(let l=e.to;;){let a=t.childAfter(l);if(!a||a==i)return null;if(!a.type.isSkipped)return a.fromjc(i,t,e,n)}function jc(n,t,e,i,s){let r=n.textAfter,o=r.match(/^\s*/)[0].length,l=i&&r.slice(o,o+i.length)==i||s==n.pos+o,a=t?qc(n):null;return a?l?n.column(a.from):n.column(a.to):n.baseIndent+(l?0:n.unit*e)}const Ec=n=>n.baseIndent;function ws({except:n,units:t=1}={}){return e=>{let i=n&&n.test(e.textAfter);return e.baseIndent+(i?0:t*e.unit)}}const Vc=new Y;function _c(n){let t=n.firstChild,e=n.lastChild;return t&&t.tol.prop(we)==o.data:o?l=>l==o:void 0,this.style=Cl(t.map(l=>({tag:l.tag,class:l.class||s(Object.assign({},l,{tag:null}))})),{all:r}).style,this.module=i?new se(i):null,this.themeType=e.themeType}static define(t,e){return new gi(t,e||{})}}const un=v.define(),Dc=v.define({combine(n){return n.length?[n[0]]:null}});function Ps(n){let t=n.facet(un);return t.length?t:n.facet(Dc)}function Gc(n,t){let e=[Ic],i;return n instanceof gi&&(n.module&&e.push(R.styleModule.of(n.module)),i=n.themeType),i?e.push(un.computeN([R.darkTheme],s=>s.facet(R.darkTheme)==(i=="dark")?[n]:[])):e.push(un.of(n)),e}class Nc{constructor(t){this.markCache=Object.create(null),this.tree=le(t.state),this.decorations=this.buildDeco(t,Ps(t.state)),this.decoratedTo=t.viewport.to}update(t){let e=le(t.state),i=Ps(t.state),s=i!=Ps(t.startState),{viewport:r}=t.view,o=t.changes.mapPos(this.decoratedTo,1);e.length=r.to?(this.decorations=this.decorations.map(t.changes),this.decoratedTo=o):(e!=this.tree||t.viewportChanged||s)&&(this.tree=e,this.decorations=this.buildDeco(t.view,i),this.decoratedTo=r.to)}buildDeco(t,e){if(!e||!this.tree.length)return B.none;let i=new ni;for(let{from:s,to:r}of t.visibleRanges)Tc(this.tree,e,(o,l,a)=>{i.add(o,l,this.markCache[a]||(this.markCache[a]=B.mark({class:a})))},s,r);return i.finish()}}const Ic=Oi.high(ye.fromClass(Nc,{decorations:n=>n.decorations}));m.meta,m.link,m.heading,m.emphasis,m.strong,m.strikethrough,m.keyword,m.atom,m.bool,m.url,m.contentSeparator,m.labelName,m.literal,m.inserted,m.string,m.deleted,m.regexp,m.escape,m.string,m.variableName,m.variableName,m.typeName,m.namespace,m.className,m.variableName,m.macroName,m.propertyName,m.comment,m.invalid;const Bc=Object.create(null),Gr=[ut.none],Nr=[],Ir=Object.create(null),Lc=Object.create(null);for(let[n,t]of[["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"]])Lc[n]=Fc(Bc,t);function $s(n,t){Nr.indexOf(n)>-1||(Nr.push(n),console.warn(t))}function Fc(n,t){let e=[];for(let l of t.split(" ")){let a=[];for(let h of l.split(".")){let c=n[h]||m[h];c?typeof c=="function"?a.length?a=a.map(c):$s(h,`Modifier ${h} used at start of tag`):a.length?$s(h,`Tag ${h} used as modifier`):a=Array.isArray(c)?c:[c]:$s(h,`Unknown highlighting tag ${h}`)}for(let h of a)e.push(h)}if(!e.length)return 0;let i=t.replace(/ /g,"_"),s=i+" "+e.map(l=>l.id),r=Ir[s];if(r)return r.id;let o=Ir[s]=ut.define({id:Gr.length,name:i,props:[Tl({[i]:e})]});return Gr.push(o),o.id}nt.RTL,nt.LTR;const dn=It.define(),Hc=It.define(),Kc=v.define(),Yl=v.define({combine(n){return Za(n,{minDepth:100,newGroupDelay:500,joinToEvent:(t,e)=>e},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,e)=>(i,s)=>t(i,s)||e(i,s)})}}),Ml=Nt.define({create(){return Yt.empty},update(n,t){let e=t.state.facet(Yl),i=t.annotation(dn);if(i){let a=ft.fromTransaction(t,i.selection),h=i.side,c=h==0?n.undone:n.done;return a?c=ts(c,c.length,e.minDepth,a):c=Ul(c,t.startState.selection),new Yt(h==0?i.rest:c,h==0?c:i.rest)}let s=t.annotation(Hc);if((s=="full"||s=="before")&&(n=n.isolate()),t.annotation(H.addToHistory)===!1)return t.changes.empty?n:n.addMapping(t.changes.desc);let r=ft.fromTransaction(t),o=t.annotation(H.time),l=t.annotation(H.userEvent);return r?n=n.addChanges(r,o,l,e,t):t.selection&&(n=n.addSelection(t.startState.selection,o,l,e.newGroupDelay)),(s=="full"||s=="after")&&(n=n.isolate()),n},toJSON(n){return{done:n.done.map(t=>t.toJSON()),undone:n.undone.map(t=>t.toJSON())}},fromJSON(n){return new Yt(n.done.map(ft.fromJSON),n.undone.map(ft.fromJSON))}});function Jc(n={}){return[Ml,Yl.of(n),R.domEventHandlers({beforeinput(t,e){let i=t.inputType=="historyUndo"?zl:t.inputType=="historyRedo"?pn:null;return i?(t.preventDefault(),i(e)):!1}})]}function hs(n,t){return function({state:e,dispatch:i}){if(!t&&e.readOnly)return!1;let s=e.field(Ml,!1);if(!s)return!1;let r=s.pop(n,e,t);return r?(i(r),!0):!1}}const zl=hs(0,!1),pn=hs(1,!1),tf=hs(0,!0),ef=hs(1,!0);class ft{constructor(t,e,i,s,r){this.changes=t,this.effects=e,this.mapped=i,this.startSelection=s,this.selectionsAfter=r}setSelAfter(t){return new ft(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){var t,e,i;return{changes:(t=this.changes)===null||t===void 0?void 0:t.toJSON(),mapped:(e=this.mapped)===null||e===void 0?void 0:e.toJSON(),startSelection:(i=this.startSelection)===null||i===void 0?void 0:i.toJSON(),selectionsAfter:this.selectionsAfter.map(s=>s.toJSON())}}static fromJSON(t){return new ft(t.changes&&J.fromJSON(t.changes),[],t.mapped&&Mt.fromJSON(t.mapped),t.startSelection&&P.fromJSON(t.startSelection),t.selectionsAfter.map(P.fromJSON))}static fromTransaction(t,e){let i=Qt;for(let s of t.startState.facet(Kc)){let r=s(t);r.length&&(i=i.concat(r))}return!i.length&&t.changes.empty?null:new ft(t.changes.invert(t.startState.doc),i,void 0,e||t.startState.selection,Qt)}static selection(t){return new ft(void 0,Qt,void 0,void 0,t)}}function ts(n,t,e,i){let s=t+1>e+20?t-e-1:0,r=n.slice(s,t);return r.push(i),r}function sf(n,t){let e=[],i=!1;return n.iterChangedRanges((s,r)=>e.push(s,r)),t.iterChangedRanges((s,r,o,l)=>{for(let a=0;a=h&&o<=c&&(i=!0)}}),i}function nf(n,t){return n.ranges.length==t.ranges.length&&n.ranges.filter((e,i)=>e.empty!=t.ranges[i].empty).length===0}function ql(n,t){return n.length?t.length?n.concat(t):n:t}const Qt=[],rf=200;function Ul(n,t){if(n.length){let e=n[n.length-1],i=e.selectionsAfter.slice(Math.max(0,e.selectionsAfter.length-rf));return i.length&&i[i.length-1].eq(t)?n:(i.push(t),ts(n,n.length-1,1e9,e.setSelAfter(i)))}else return[ft.selection([t])]}function of(n){let t=n[n.length-1],e=n.slice();return e[n.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),e}function ks(n,t){if(!n.length)return n;let e=n.length,i=Qt;for(;e;){let s=lf(n[e-1],t,i);if(s.changes&&!s.changes.empty||s.effects.length){let r=n.slice(0,e);return r[e-1]=s,r}else t=s.mapped,e--,i=s.selectionsAfter}return i.length?[ft.selection(i)]:Qt}function lf(n,t,e){let i=ql(n.selectionsAfter.length?n.selectionsAfter.map(l=>l.map(t)):Qt,e);if(!n.changes)return ft.selection(i);let s=n.changes.map(t),r=t.mapDesc(n.changes,!0),o=n.mapped?n.mapped.composeDesc(r):r;return new ft(s,N.mapEffects(n.effects,t),o,n.startSelection.map(r),i)}const af=/^(input\.type|delete)($|\.)/;class Yt{constructor(t,e,i=0,s=void 0){this.done=t,this.undone=e,this.prevTime=i,this.prevUserEvent=s}isolate(){return this.prevTime?new Yt(this.done,this.undone):this}addChanges(t,e,i,s,r){let o=this.done,l=o[o.length-1];return l&&l.changes&&!l.changes.empty&&t.changes&&(!i||af.test(i))&&(!l.selectionsAfter.length&&e-this.prevTime0&&e-this.prevTimee%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,e,i=0){let s=t.parser.context;return new es(t,[],e,i,i,0,[],0,s?new Lr(s,s.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var e;let i=t>>19,s=t&65535,{parser:r}=this.p,o=this.reducePos=2e3&&!(!((e=this.p.parser.nodeSet.types[s])===null||e===void 0)&&e.isAnonymous)&&(h==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSizea;)this.stack.pop();this.reduceContext(s,h)}storeNode(t,e,i,s=4,r=!1){if(t==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&o.buffer[l-4]==0&&o.buffer[l-1]>-1){if(e==i)return;if(o.buffer[l-2]>=e){o.buffer[l-2]=i;return}}}if(!r||this.pos==i)this.buffer.push(t,e,i,s);else{let o=this.buffer.length;if(o>0&&this.buffer[o-4]!=0){let l=!1;for(let a=o;a>0&&this.buffer[a-2]>i;a-=4)if(this.buffer[a-1]>=0){l=!0;break}if(l)for(;o>0&&this.buffer[o-2]>i;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,s>4&&(s-=4)}this.buffer[o]=t,this.buffer[o+1]=e,this.buffer[o+2]=i,this.buffer[o+3]=s}}shift(t,e,i,s){if(t&131072)this.pushState(t&65535,this.pos);else if(t&262144)this.pos=s,this.shiftContext(e,i),e<=this.p.parser.maxNode&&this.buffer.push(e,i,s,4);else{let r=t,{parser:o}=this.p;(s>this.pos||e<=o.maxNode)&&(this.pos=s,o.stateFlag(r,1)||(this.reducePos=s)),this.pushState(r,i),this.shiftContext(e,i),e<=o.maxNode&&this.buffer.push(e,i,s,4)}}apply(t,e,i,s){t&65536?this.reduce(t):this.shift(t,e,i,s)}useNode(t,e){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=t)&&(this.p.reused.push(t),i++);let s=this.pos;this.reducePos=this.pos=s+t.length,this.pushState(e,s),this.buffer.push(i,s,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,e=t.buffer.length;for(;e>0&&t.buffer[e-2]>t.reducePos;)e-=4;let i=t.buffer.slice(e),s=t.bufferBase+e;for(;t&&s==t.bufferBase;)t=t.parent;return new es(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,s,this.curContext,this.lookAhead,t)}recoverByDelete(t,e){let i=t<=this.p.parser.maxNode;i&&this.storeNode(t,this.pos,e,4),this.storeNode(0,this.pos,e,i?8:4),this.pos=this.reducePos=e,this.score-=190}canShift(t){for(let e=new ff(this);;){let i=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,t);if(i==0)return!1;if(!(i&65536))return!0;e.reduce(i)}}recoverByInsert(t){if(this.stack.length>=300)return[];let e=this.p.parser.nextStates(this.state);if(e.length>8||this.stack.length>=120){let s=[];for(let r=0,o;ra&1&&l==o)||s.push(e[r],o)}e=s}let i=[];for(let s=0;s>19,s=e&65535,r=this.stack.length-i*3;if(r<0||t.getGoto(this.stack[r],s,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;e=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(e),!0}findForcedReduction(){let{parser:t}=this.p,e=[],i=(s,r)=>{if(!e.includes(s))return e.push(s),t.allActions(s,o=>{if(!(o&393216))if(o&65536){let l=(o>>19)-r;if(l>1){let a=o&65535,h=this.stack.length-l*3;if(h>=0&&t.getGoto(this.stack[h],a,!1)>=0)return l<<19|65536|a}}else{let l=i(o,r+1);if(l!=null)return l}})};return i(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:t}=this.p;return t.data[t.stateSlot(this.state,1)]==65535&&!t.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let e=0;ethis.lookAhead&&(this.emitLookAhead(),this.lookAhead=t)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class Lr{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}}class ff{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let e=t&65535,i=t>>19;i==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(i-1)*3;let s=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=s}}class is{constructor(t,e,i){this.stack=t,this.pos=e,this.index=i,this.buffer=t.buffer,this.index==0&&this.maybeNext()}static create(t,e=t.bufferBase+t.buffer.length){return new is(t,e,e-t.bufferBase)}maybeNext(){let t=this.stack.parent;t!=null&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new is(this.stack,this.pos,this.index)}}function Ke(n,t=Uint16Array){if(typeof n!="string")return n;let e=null;for(let i=0,s=0;i=92&&o--,o>=34&&o--;let a=o-32;if(a>=46&&(a-=46,l=!0),r+=a,l)break;r*=46}e?e[s++]=r:e=new t(r)}return e}class Ei{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Fr=new Ei;class Of{constructor(t,e){this.input=t,this.ranges=e,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Fr,this.rangeIndex=0,this.pos=this.chunkPos=e[0].from,this.range=e[0],this.end=e[e.length-1].to,this.readNext()}resolveOffset(t,e){let i=this.range,s=this.rangeIndex,r=this.pos+t;for(;ri.to:r>=i.to;){if(s==this.ranges.length-1)return null;let o=this.ranges[++s];r+=o.from-i.to,i=o}return r}clipPos(t){if(t>=this.range.from&&tt)return Math.max(t,e.from);return this.end}peek(t){let e=this.chunkOff+t,i,s;if(e>=0&&e=this.chunk2Pos&&il.to&&(this.chunk2=this.chunk2.slice(0,l.to-i)),s=this.chunk2.charCodeAt(0)}}return i>=this.token.lookAhead&&(this.token.lookAhead=i+1),s}acceptToken(t,e=0){let i=e?this.resolveOffset(e,-1):this.pos;if(i==null||i=this.chunk2Pos&&this.posthis.range.to?t.slice(0,this.range.to-this.pos):t,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(t=1){for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(t,e){if(e?(this.token=e,e.start=t,e.lookAhead=t+1,e.value=e.extended=-1):this.token=Fr,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,e-this.chunkPos);if(t>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,e-this.chunk2Pos);if(t>=this.range.from&&e<=this.range.to)return this.input.read(t,e);let i="";for(let s of this.ranges){if(s.from>=e)break;s.to>t&&(i+=this.input.read(Math.max(s.from,t),Math.min(s.to,e)))}return i}}class ve{constructor(t,e){this.data=t,this.id=e}token(t,e){let{parser:i}=e.p;jl(this.data,t,e,this.id,i.data,i.tokenPrecTable)}}ve.prototype.contextual=ve.prototype.fallback=ve.prototype.extend=!1;class gn{constructor(t,e,i){this.precTable=e,this.elseToken=i,this.data=typeof t=="string"?Ke(t):t}token(t,e){let i=t.pos,s=0;for(;;){let r=t.next<0,o=t.resolveOffset(1,1);if(jl(this.data,t,e,0,this.data,this.precTable),t.token.value>-1)break;if(this.elseToken==null)return;if(r||s++,o==null)break;t.reset(o,t.token)}s&&(t.reset(i,t.token),t.acceptToken(this.elseToken,s))}}gn.prototype.contextual=ve.prototype.fallback=ve.prototype.extend=!1;class cs{constructor(t,e={}){this.token=t,this.contextual=!!e.contextual,this.fallback=!!e.fallback,this.extend=!!e.extend}}function jl(n,t,e,i,s,r){let o=0,l=1<0){let d=n[u];if(a.allows(d)&&(t.token.value==-1||t.token.value==d||uf(d,t.token.value,s,r))){t.acceptToken(d);break}}let c=t.next,f=0,O=n[o+2];if(t.next<0&&O>f&&n[h+O*3-3]==65535){o=n[h+O*3-1];continue t}for(;f>1,d=h+u+(u<<1),p=n[d],g=n[d+1]||65536;if(c=g)f=u+1;else{o=n[d+2],t.advance();continue t}}break}}function Hr(n,t,e){for(let i=t,s;(s=n[i])!=65535;i++)if(s==e)return i-t;return-1}function uf(n,t,e,i){let s=Hr(e,i,t);return s<0||Hr(e,i,n)t)&&!i.type.isError)return e<0?Math.max(0,Math.min(i.to-1,t-25)):Math.min(n.length,Math.max(i.from+1,t+25));if(e<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return e<0?0:n.length}}class df{constructor(t,e){this.fragments=t,this.nodeSet=e,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?Kr(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?Kr(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(tt)return this.nextStart=o,null;if(r instanceof K){if(o==t){if(o=Math.max(this.safeFrom,t)&&(this.trees.push(r),this.start.push(o),this.index.push(0))}else this.index[e]++,this.nextStart=o+r.length}}}class pf{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map(i=>new Ei)}getActions(t){let e=0,i=null,{parser:s}=t.p,{tokenizers:r}=s,o=s.stateSlot(t.state,3),l=t.curContext?t.curContext.hash:0,a=0;for(let h=0;hf.end+25&&(a=Math.max(f.lookAhead,a)),f.value!=0)){let O=e;if(f.extended>-1&&(e=this.addActions(t,f.extended,f.end,e)),e=this.addActions(t,f.value,f.end,e),!c.extend&&(i=f,e>O))break}}for(;this.actions.length>e;)this.actions.pop();return a&&t.setLookAhead(a),!i&&t.pos==this.stream.end&&(i=new Ei,i.value=t.p.parser.eofTerm,i.start=i.end=t.pos,e=this.addActions(t,i.value,i.end,e)),this.mainToken=i,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let e=new Ei,{pos:i,p:s}=t;return e.start=i,e.end=Math.min(i+1,s.stream.end),e.value=i==s.stream.end?s.parser.eofTerm:0,e}updateCachedToken(t,e,i){let s=this.stream.clipPos(i.pos);if(e.token(this.stream.reset(s,t),i),t.value>-1){let{parser:r}=i.p;for(let o=0;o=0&&i.p.parser.dialect.allows(l>>1)){l&1?t.extended=l>>1:t.value=l>>1;break}}}else t.value=0,t.end=this.stream.clipPos(s+1)}putAction(t,e,i,s){for(let r=0;rt.bufferLength*4?new df(i,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t=this.stacks,e=this.minStackPos,i=this.stacks=[],s,r;if(this.bigReductionCount>300&&t.length==1){let[o]=t;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;oe)i.push(l);else{if(this.advanceStack(l,i,t))continue;{s||(s=[],r=[]),s.push(l);let a=this.tokens.getMainToken(l);r.push(a.value,a.end)}}break}}if(!i.length){let o=s&&Qf(s);if(o)return dt&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw dt&&s&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+e);this.recovering||(this.recovering=5)}if(this.recovering&&s){let o=this.stoppedAt!=null&&s[0].pos>this.stoppedAt?s[0]:this.runRecovery(s,r,i);if(o)return dt&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(i.length>o)for(i.sort((l,a)=>a.score-l.score);i.length>o;)i.pop();i.some(l=>l.reducePos>e)&&this.recovering--}else if(i.length>1){t:for(let o=0;o500&&h.buffer.length>500)if((l.score-h.score||l.buffer.length-h.buffer.length)>0)i.splice(a--,1);else{i.splice(o--,1);continue t}}}i.length>12&&i.splice(12,i.length-12)}this.minStackPos=i[0].pos;for(let o=1;o ":"";if(this.stoppedAt!=null&&s>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let h=t.curContext&&t.curContext.tracker.strict,c=h?t.curContext.hash:0;for(let f=this.fragments.nodeAt(s);f;){let O=this.parser.nodeSet.types[f.type.id]==f.type?r.getGoto(t.state,f.type.id):-1;if(O>-1&&f.length&&(!h||(f.prop(Y.contextHash)||0)==c))return t.useNode(f,O),dt&&console.log(o+this.stackID(t)+` (via reuse of ${r.getName(f.type.id)})`),!0;if(!(f instanceof K)||f.children.length==0||f.positions[0]>0)break;let u=f.children[0];if(u instanceof K&&f.positions[0]==0)f=u;else break}}let l=r.stateSlot(t.state,4);if(l>0)return t.reduce(l),dt&&console.log(o+this.stackID(t)+` (via always-reduce ${r.getName(l&65535)})`),!0;if(t.stack.length>=8400)for(;t.stack.length>6e3&&t.forceReduce(););let a=this.tokens.getActions(t);for(let h=0;hs?e.push(d):i.push(d)}return!1}advanceFully(t,e){let i=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>i)return Jr(t,e),!0}}runRecovery(t,e,i){let s=null,r=!1;for(let o=0;o ":"";if(l.deadEnd&&(r||(r=!0,l.restart(),dt&&console.log(c+this.stackID(l)+" (restarted)"),this.advanceFully(l,i))))continue;let f=l.split(),O=c;for(let u=0;f.forceReduce()&&u<10&&(dt&&console.log(O+this.stackID(f)+" (via force-reduce)"),!this.advanceFully(f,i));u++)dt&&(O=this.stackID(f)+" -> ");for(let u of l.recoverByInsert(a))dt&&console.log(c+this.stackID(u)+" (via recover-insert)"),this.advanceFully(u,i);this.stream.end>l.pos?(h==l.pos&&(h++,a=0),l.recoverByDelete(a,h),dt&&console.log(c+this.stackID(l)+` (via recover-delete ${this.parser.getName(a)})`),Jr(l,i)):(!s||s.scoren;class bf{constructor(t){this.start=t.start,this.shift=t.shift||vs,this.reduce=t.reduce||vs,this.reuse=t.reuse||vs,this.hash=t.hash||(()=>0),this.strict=t.strict!==!1}}class ss extends Rl{constructor(t){if(super(),this.wrappers=[],t.version!=14)throw new RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let e=t.nodeNames.split(" ");this.minRepeatTerm=e.length;for(let l=0;lt.topRules[l][1]),s=[];for(let l=0;l=0)r(c,a,l[h++]);else{let f=l[h+-c];for(let O=-c;O>0;O--)r(l[h++],a,f);h++}}}this.nodeSet=new Cn(e.map((l,a)=>ut.define({name:a>=this.minRepeatTerm?void 0:l,id:a,props:s[a],top:i.indexOf(a)>-1,error:a==0,skipped:t.skippedNodes&&t.skippedNodes.indexOf(a)>-1}))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=$l;let o=Ke(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let l=0;ltypeof l=="number"?new ve(o,l):l),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,e,i){let s=new gf(this,t,e,i);for(let r of this.wrappers)s=r(s,t,e,i);return s}getGoto(t,e,i=!1){let s=this.goto;if(e>=s[0])return-1;for(let r=s[e+1];;){let o=s[r++],l=o&1,a=s[r++];if(l&&i)return a;for(let h=r+(o>>1);r0}validAction(t,e){return!!this.allActions(t,i=>i==e?!0:null)}allActions(t,e){let i=this.stateSlot(t,4),s=i?e(i):void 0;for(let r=this.stateSlot(t,1);s==null;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=jt(this.data,r+2);else break;s=e(jt(this.data,r+1))}return s}nextStates(t){let e=[];for(let i=this.stateSlot(t,1);;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=jt(this.data,i+2);else break;if(!(this.data[i+2]&1)){let s=this.data[i+1];e.some((r,o)=>o&1&&r==s)||e.push(this.data[i],s)}}return e}configure(t){let e=Object.assign(Object.create(ss.prototype),this);if(t.props&&(e.nodeSet=this.nodeSet.extend(...t.props)),t.top){let i=this.topRules[t.top];if(!i)throw new RangeError(`Invalid top rule name ${t.top}`);e.top=i}return t.tokenizers&&(e.tokenizers=this.tokenizers.map(i=>{let s=t.tokenizers.find(r=>r.from==i);return s?s.to:i})),t.specializers&&(e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map((i,s)=>{let r=t.specializers.find(l=>l.from==i.external);if(!r)return i;let o=Object.assign(Object.assign({},i),{external:r.to});return e.specializers[s]=to(o),o})),t.contextTracker&&(e.context=t.contextTracker),t.dialect&&(e.dialect=this.parseDialect(t.dialect)),t.strict!=null&&(e.strict=t.strict),t.wrap&&(e.wrappers=e.wrappers.concat(t.wrap)),t.bufferLength!=null&&(e.bufferLength=t.bufferLength),e}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let e=this.dynamicPrecedences;return e==null?0:e[t]||0}parseDialect(t){let e=Object.keys(this.dialects),i=e.map(()=>!1);if(t)for(let r of t.split(" ")){let o=e.indexOf(r);o>=0&&(i[o]=!0)}let s=null;for(let r=0;ri)&&e.p.parser.stateFlag(e.state,2)&&(!t||t.scoren.external(e,i)<<1|t}return n.get}const yf=312,eo=1,Sf=2,xf=3,wf=4,Pf=313,$f=315,kf=316,Zf=5,vf=6,Rf=0,mn=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],El=125,Tf=59,bn=47,Af=42,Cf=43,Xf=45,Wf=60,Yf=44,Mf=63,zf=46,qf=new bf({start:!1,shift(n,t){return t==Zf||t==vf||t==$f?n:t==kf},strict:!1}),Uf=new cs((n,t)=>{let{next:e}=n;(e==El||e==-1||t.context)&&n.acceptToken(Pf)},{contextual:!0,fallback:!0}),jf=new cs((n,t)=>{let{next:e}=n,i;mn.indexOf(e)>-1||e==bn&&((i=n.peek(1))==bn||i==Af)||e!=El&&e!=Tf&&e!=-1&&!t.context&&n.acceptToken(yf)},{contextual:!0}),Ef=new cs((n,t)=>{let{next:e}=n;if(e==Cf||e==Xf){if(n.advance(),e==n.next){n.advance();let i=!t.context&&t.canShift(eo);n.acceptToken(i?eo:Sf)}}else e==Mf&&n.peek(1)==zf&&(n.advance(),n.advance(),(n.next<48||n.next>57)&&n.acceptToken(xf))},{contextual:!0});function Rs(n,t){return n>=65&&n<=90||n>=97&&n<=122||n==95||n>=192||!t&&n>=48&&n<=57}const Vf=new cs((n,t)=>{if(n.next!=Wf||!t.dialectEnabled(Rf)||(n.advance(),n.next==bn))return;let e=0;for(;mn.indexOf(n.next)>-1;)n.advance(),e++;if(Rs(n.next,!0)){for(n.advance(),e++;Rs(n.next,!1);)n.advance(),e++;for(;mn.indexOf(n.next)>-1;)n.advance(),e++;if(n.next==Yf)return;for(let i=0;;i++){if(i==7){if(!Rs(n.next,!0))return;break}if(n.next!="extends".charCodeAt(i))break;n.advance(),e++}}n.acceptToken(wf,-e)}),_f=Tl({"get set async static":m.modifier,"for while do if else switch try catch finally return throw break continue default case":m.controlKeyword,"in of await yield void typeof delete instanceof":m.operatorKeyword,"let var const using function class extends":m.definitionKeyword,"import export from":m.moduleKeyword,"with debugger as new":m.keyword,TemplateString:m.special(m.string),super:m.atom,BooleanLiteral:m.bool,this:m.self,null:m.null,Star:m.modifier,VariableName:m.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":m.function(m.variableName),VariableDefinition:m.definition(m.variableName),Label:m.labelName,PropertyName:m.propertyName,PrivatePropertyName:m.special(m.propertyName),"CallExpression/MemberExpression/PropertyName":m.function(m.propertyName),"FunctionDeclaration/VariableDefinition":m.function(m.definition(m.variableName)),"ClassDeclaration/VariableDefinition":m.definition(m.className),PropertyDefinition:m.definition(m.propertyName),PrivatePropertyDefinition:m.definition(m.special(m.propertyName)),UpdateOp:m.updateOperator,"LineComment Hashbang":m.lineComment,BlockComment:m.blockComment,Number:m.number,String:m.string,Escape:m.escape,ArithOp:m.arithmeticOperator,LogicOp:m.logicOperator,BitOp:m.bitwiseOperator,CompareOp:m.compareOperator,RegExp:m.regexp,Equals:m.definitionOperator,Arrow:m.function(m.punctuation),": Spread":m.punctuation,"( )":m.paren,"[ ]":m.squareBracket,"{ }":m.brace,"InterpolationStart InterpolationEnd":m.special(m.brace),".":m.derefOperator,", ;":m.separator,"@":m.meta,TypeName:m.typeName,TypeDefinition:m.definition(m.typeName),"type enum interface implements namespace module declare":m.definitionKeyword,"abstract global Privacy readonly override":m.modifier,"is keyof unique infer":m.operatorKeyword,JSXAttributeValue:m.attributeValue,JSXText:m.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":m.angleBracket,"JSXIdentifier JSXNameSpacedName":m.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":m.attributeName,"JSXBuiltin/JSXIdentifier":m.standard(m.tagName)}),Df={__proto__:null,export:20,as:25,from:33,default:36,async:41,function:42,extends:54,this:58,true:66,false:66,null:78,void:82,typeof:86,super:102,new:136,delete:148,yield:157,await:161,class:166,public:229,private:229,protected:229,readonly:231,instanceof:250,satisfies:253,in:254,const:256,import:290,keyof:345,unique:349,infer:355,is:391,abstract:411,implements:413,type:415,let:418,var:420,using:423,interface:429,enum:433,namespace:439,module:441,declare:445,global:449,for:468,of:477,while:480,with:484,do:488,if:492,else:494,switch:498,case:504,try:510,catch:514,finally:518,return:522,throw:526,break:530,continue:534,debugger:538},Gf={__proto__:null,async:123,get:125,set:127,declare:189,public:191,private:191,protected:191,static:193,abstract:195,override:197,readonly:203,accessor:205,new:395},Nf={__proto__:null,"<":187},If=ss.deserialize({version:14,states:"$@QO%TQ^OOO%[Q^OOO'_Q`OOP(lOWOOO*zQ?NdO'#CiO+RO!bO'#CjO+aO#tO'#CjO+oO!0LbO'#D^O.QQ^O'#DdO.bQ^O'#DoO%[Q^O'#DwO0fQ^O'#EPOOQ?Mr'#EX'#EXO1PQWO'#EUOOQO'#Em'#EmOOQO'#Ih'#IhO1XQWO'#GpO1dQWO'#ElO1iQWO'#ElO3hQ?NdO'#JmO6[Q?NdO'#JnO6uQWO'#F[O6zQ&jO'#FsOOQ?Mr'#Fe'#FeO7VO,YO'#FeO7eQ7[O'#FzO9RQWO'#FyOOQ?Mr'#Jn'#JnOOQ?Mp'#Jm'#JmO9WQWO'#GtOOQU'#KZ'#KZO9cQWO'#IUO9hQ?MxO'#IVOOQU'#JZ'#JZOOQU'#IZ'#IZQ`Q^OOO`Q^OOO9pQMnO'#DsO9wQ^O'#D{O:OQ^O'#D}O9^QWO'#GpO:VQ7[O'#CoO:eQWO'#EkO:pQWO'#EvO:uQ7[O'#FdO;dQWO'#GpOOQO'#K['#K[O;iQWO'#K[O;wQWO'#GxO;wQWO'#GyO;wQWO'#G{O9^QWO'#HOOVQWO'#CeO>gQWO'#H_O>oQWO'#HeO>oQWO'#HgO`Q^O'#HiO>oQWO'#HkO>oQWO'#HnO>tQWO'#HtO>yQ?MyO'#HzO%[Q^O'#H|O?UQ?MyO'#IOO?aQ?MyO'#IQO9hQ?MxO'#ISO?lQ?NdO'#CiO@nQ`O'#DiQOQWOOO%[Q^O'#D}OAUQWO'#EQO:VQ7[O'#EkOAaQWO'#EkOAlQpO'#FdOOQU'#Cg'#CgOOQ?Mp'#Dn'#DnOOQ?Mp'#Jq'#JqO%[Q^O'#JqOOQO'#Jt'#JtOOQO'#Id'#IdOBlQ`O'#EdOOQ?Mp'#Ec'#EcOOQ?Mp'#Jx'#JxOChQ?NQO'#EdOCrQ`O'#ETOOQO'#Js'#JsODWQ`O'#JtOEeQ`O'#ETOCrQ`O'#EdPErO#@ItO'#CbPOOO)CDx)CDxOOOO'#I['#I[OE}O!bO,59UOOQ?Mr,59U,59UOOOO'#I]'#I]OF]O#tO,59UO%[Q^O'#D`OOOO'#I_'#I_OFkO!0LbO,59xOOQ?Mr,59x,59xOFyQ^O'#I`OG^QWO'#JoOI]QrO'#JoO+}Q^O'#JoOIdQWO,5:OOIzQWO'#EmOJXQWO'#KOOJdQWO'#J}OJdQWO'#J}OJlQWO,5;ZOJqQWO'#J|OOQ?Mv,5:Z,5:ZOJxQ^O,5:ZOLvQ?NdO,5:cOMgQWO,5:kONQQ?MxO'#J{ONXQWO'#JzO9WQWO'#JzONmQWO'#JzONuQWO,5;YONzQWO'#JzO!#PQrO'#JnOOQ?Mr'#Ci'#CiO%[Q^O'#EPO!#oQrO,5:pOOQQ'#Ju'#JuOOQO-EpOOQU'#Jc'#JcOOQU,5>q,5>qOOQU-EtQWO'#HTO9^QWO'#HVO!DgQWO'#HVO:VQ7[O'#HXO!DlQWO'#HXOOQU,5=m,5=mO!DqQWO'#HYO!ESQWO'#CoO!EXQWO,59PO!EcQWO,59PO!GhQ^O,59POOQU,59P,59PO!GxQ?MxO,59PO%[Q^O,59PO!JTQ^O'#HaOOQU'#Hb'#HbOOQU'#Hc'#HcO`Q^O,5=yO!JkQWO,5=yO`Q^O,5>PO`Q^O,5>RO!JpQWO,5>TO`Q^O,5>VO!JuQWO,5>YO!JzQ^O,5>`OOQU,5>f,5>fO%[Q^O,5>fO9hQ?MxO,5>hOOQU,5>j,5>jO# UQWO,5>jOOQU,5>l,5>lO# UQWO,5>lOOQU,5>n,5>nO# rQ`O'#D[O%[Q^O'#JqO# |Q`O'#JqO#!kQ`O'#DjO#!|Q`O'#DjO#%_Q^O'#DjO#%fQWO'#JpO#%nQWO,5:TO#%sQWO'#EqO#&RQWO'#KPO#&ZQWO,5;[O#&`Q`O'#DjO#&mQ`O'#ESOOQ?Mr,5:l,5:lO%[Q^O,5:lO#&tQWO,5:lO>tQWO,5;VO!A}Q`O,5;VO!BVQ7[O,5;VO:VQ7[O,5;VO#&|QWO,5@]O#'RQ(CYO,5:pOOQO-EzO+}Q^O,5>zOOQO,5?Q,5?QO#*ZQ^O'#I`OOQO-E<^-E<^O#*hQWO,5@ZO#*pQrO,5@ZO#*wQWO,5@iOOQ?Mr1G/j1G/jO%[Q^O,5@jO#+PQWO'#IfOOQO-EuQ?NdO1G0|O#>|Q?NdO1G0|O#AZQ07bO'#CiO#CUQ07bO1G1_O#C]Q07bO'#JnO#CpQ?NdO,5?WOOQ?Mp-EoQWO1G3oO$3VQ^O1G3qO$7ZQ^O'#HpOOQU1G3t1G3tO$7hQWO'#HvO>tQWO'#HxOOQU1G3z1G3zO$7pQ^O1G3zO9hQ?MxO1G4QOOQU1G4S1G4SOOQ?Mp'#G]'#G]O9hQ?MxO1G4UO9hQ?MxO1G4WO$;wQWO,5@]O!(oQ^O,5;]O9WQWO,5;]O>tQWO,5:UO!(oQ^O,5:UO!A}Q`O,5:UO$;|Q07bO,5:UOOQO,5;],5;]O$tQWO1G0qO!A}Q`O1G0qO!BVQ7[O1G0qOOQ?Mp1G5w1G5wO!ArQ?MxO1G0ZOOQO1G0j1G0jO%[Q^O1G0jO$=aQ?MxO1G0jO$=lQ?MxO1G0jO!A}Q`O1G0ZOCrQ`O1G0ZO$=zQ?MxO1G0jOOQO1G0Z1G0ZO$>`Q?NdO1G0jPOOO-EjQpO,5rQrO1G4fOOQO1G4l1G4lO%[Q^O,5>zO$>|QWO1G5uO$?UQWO1G6TO$?^QrO1G6UO9WQWO,5?QO$?hQ?NdO1G6RO%[Q^O1G6RO$?xQ?MxO1G6RO$@ZQWO1G6QO$@ZQWO1G6QO9WQWO1G6QO$@cQWO,5?TO9WQWO,5?TOOQO,5?T,5?TO$@wQWO,5?TO$(PQWO,5?TOOQO-E[OOQU,5>[,5>[O%[Q^O'#HqO%8mQWO'#HsOOQU,5>b,5>bO9WQWO,5>bOOQU,5>d,5>dOOQU7+)f7+)fOOQU7+)l7+)lOOQU7+)p7+)pOOQU7+)r7+)rO%8rQ`O1G5wO%9WQ07bO1G0wO%9bQWO1G0wOOQO1G/p1G/pO%9mQ07bO1G/pO>tQWO1G/pO!(oQ^O'#DjOOQO,5>{,5>{OOQO-E<_-E<_OOQO,5?R,5?ROOQO-EtQWO7+&]O!A}Q`O7+&]OOQO7+%u7+%uO$>`Q?NdO7+&UOOQO7+&U7+&UO%[Q^O7+&UO%9wQ?MxO7+&UO!ArQ?MxO7+%uO!A}Q`O7+%uO%:SQ?MxO7+&UO%:bQ?NdO7++mO%[Q^O7++mO%:rQWO7++lO%:rQWO7++lOOQO1G4o1G4oO9WQWO1G4oO%:zQWO1G4oOOQQ7+%z7+%zO#&wQWO<|O%[Q^O,5>|OOQO-E<`-E<`O%FwQWO1G5xOOQ?Mr<]OOQU,5>_,5>_O&8uQWO1G3|O9WQWO7+&cO!(oQ^O7+&cOOQO7+%[7+%[O&8zQ07bO1G6UO>tQWO7+%[OOQ?Mr<tQWO<`Q?NdO<pQ?NdO,5?_O&@xQ?NdO7+'zO&CWQrO1G4hO&CbQ07bO7+&^O&EcQ07bO,5=UO&GgQ07bO,5=WO&GwQ07bO,5=UO&HXQ07bO,5=WO&HiQ07bO,59rO&JlQ07bO,5tQWO7+)hO'(OQWO<`Q?NdOAN?[OOQOAN>{AN>{O%[Q^OAN?[OOQO<`Q?NdOG24vO#&wQWOLD,nOOQULD,nLD,nO!&_Q7[OLD,nO'5TQrOLD,nO'5[Q07bO7+'xO'6}Q07bO,5?]O'8}Q07bO,5?_O':}Q07bO7+'zO'kOh%VOk+aO![']O%f+`O~O!d+cOa(WX![(WX'u(WX!Y(WX~Oa%lO![XO'u%lO~Oh%VO!i%cO~Oh%VO!i%cO(O%eO~O!d#vO#h(tO~Ob+nO%g+oO(O+kO(QTO(TUO!Z)TP~O!Y+pO`)SX~O[+tO~O`+uO~O![%}O(O%eO(P!lO`)SP~Oh%VO#]+zO~Oh%VOk+}O![$|O~O![,PO~O},RO![XO~O%k%tO~O!u,WO~Oe,]O~Ob,^O(O#nO(QTO(TUO!Z)RP~Oe%{O~O%g!QO(O&WO~P=RO[,cO`,bO~OPYOQYOSfOdzOeyOmkOoYOpkOqkOwkOyYO{YO!PWO!TkO!UkO!fuO!iZO!lYO!mYO!nYO!pvO!uxO!y]O%e}O(QTO(TUO([VO(j[O(yiO~O![!eO!r!gO$V!kO(O!dO~P!EkO`,bOa%lO'u%lO~OPYOQYOSfOd!jOe!iOmkOoYOpkOqkOwkOyYO{YO!PWO!TkO!UkO![!eO!fuO!iZO!lYO!mYO!nYO!pvO!u!hO$V!kO(O!dO(QTO(TUO([VO(j[O(yiO~Oa,hO!rwO#t!OO%i!OO%j!OO%k!OO~P!HTO!i&lO~O&Y,nO~O![,pO~O&k,rO&m,sOP&haQ&haS&haY&haa&had&hae&ham&hao&hap&haq&haw&hay&ha{&ha!P&ha!T&ha!U&ha![&ha!f&ha!i&ha!l&ha!m&ha!n&ha!p&ha!r&ha!u&ha!y&ha#t&ha$V&ha%e&ha%g&ha%i&ha%j&ha%k&ha%n&ha%p&ha%s&ha%t&ha%v&ha&S&ha&Y&ha&[&ha&^&ha&`&ha&c&ha&i&ha&o&ha&q&ha&s&ha&u&ha&w&ha's&ha(O&ha(Q&ha(T&ha([&ha(j&ha(y&ha!Z&ha&a&hab&ha&f&ha~O(O,xO~Oh!bX!Y!OX!Z!OX!d!OX!d!bX!i!bX#]!OX~O!Y!bX!Z!bX~P# ZO!d,}O#],|Oh(eX!Y#eX!Y(eX!Z#eX!Z(eX!d(eX!i(eX~Oh%VO!d-PO!i%cO!Y!^X!Z!^X~Op!nO!P!oO(QTO(TUO(`!mO~OP;POQ;POSfOdkOg'XX!Y'XX~P!+hO!Y.wOg(ka~OSfO![3uO$c3vO~O!Z3zO~Os3{O~P#.aOa$lq!Y$lq'u$lq's$lq!V$lq!h$lqs$lq![$lq%f$lq!d$lq~P!9mO!V3|O~P#.aO})zO!P){O(u%POk'ea(t'ea!Y'ea#]'ea~Og'ea#}'ea~P%)nO})zO!P){Ok'ga(t'ga(u'ga!Y'ga#]'ga~Og'ga#}'ga~P%*aO(m$YO~P#.aO!VfX!V$xX!YfX!Y$xX!d%PX#]fX~P!/gO(OQ#>g#@V#@e#@l#BR#Ba#C|#D[#Db#Dh#Dn#Dx#EO#EU#E`#Er#ExPPPPPPPPPP#FOPPPPPPP#Fs#Iz#KZ#Kb#KjPPP$!sP$!|$%t$,^$,a$,d$-P$-S$-Z$-cP$-i$-lP$.Y$.^$/U$0d$0i$1PPP$1U$1[$1`P$1c$1g$1k$2a$2x$3a$3e$3h$3k$3q$3t$3x$3|R!|RoqOXst!Z#d%k&o&q&r&t,k,p1|2PY!vQ']-]1a5eQ%rvQ%zyQ&R|Q&g!VS'T!e-TQ'c!iS'i!r!yU*e$|*V*jQ+i%{Q+v&TQ,[&aQ-Z'[Q-e'dQ-m'jQ0R*lQ1k,]R;v;T%QdOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%k%r&P&h&k&o&q&r&t&x'Q'_'o(P(R(X(`(t(v(z)y+R+V,h,k,p-a-i-w-}.l.s/f0a0g0v1d1t1u1w1y1|2P2R2r2x3^5b5m5}6O6R6f8R8X8h8rS#q];Q!r)Z$Z$n'U)o,|-P.}2b3u5`6]9h9y;P;S;T;W;X;Y;Z;[;];^;_;`;a;b;c;d;f;i;v;x;y;{ < TypeParamList TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewTarget new NewExpression ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression TypeArgList CompareOp < declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies in const CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression InstantiationExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast ArrowFunction TypeParamList SequenceExpression InstantiationExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var using TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:376,context:qf,nodeProps:[["isolate",-8,5,6,14,34,36,48,50,52,""],["group",-26,9,17,19,65,204,208,212,213,215,218,221,231,233,239,241,243,245,248,254,260,262,264,266,268,270,271,"Statement",-34,13,14,29,32,33,39,48,51,52,54,59,67,69,73,77,79,81,82,107,108,117,118,135,138,140,141,142,143,144,146,147,166,167,169,"Expression",-23,28,30,34,38,40,42,171,173,175,176,178,179,180,182,183,184,186,187,188,198,200,202,203,"Type",-3,85,100,106,"ClassItem"],["openedBy",23,"<",35,"InterpolationStart",53,"[",57,"{",70,"(",159,"JSXStartCloseTag"],["closedBy",24,">",37,"InterpolationEnd",47,"]",58,"}",71,")",164,"JSXEndTag"]],propSources:[_f],skippedNodes:[0,5,6,274],repeatNodeCount:37,tokenData:"$Fq07[R!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_tuEruvJSvwLkwx! Yxy!'iyz!(sz{!)}{|!,q|}!.O}!O!,q!O!P!/Y!P!Q!9j!Q!R#:O!R![#<_![!]#I_!]!^#Jk!^!_#Ku!_!`$![!`!a$$v!a!b$*T!b!c$,r!c!}Er!}#O$-|#O#P$/W#P#Q$4o#Q#R$5y#R#SEr#S#T$7W#T#o$8b#o#p$x#r#s$@U#s$f%Z$f$g+g$g#BYEr#BY#BZ$A`#BZ$ISEr$IS$I_$A`$I_$I|Er$I|$I}$Dk$I}$JO$Dk$JO$JTEr$JT$JU$A`$JU$KVEr$KV$KW$A`$KW&FUEr&FU&FV$A`&FV;'SEr;'S;=`I|<%l?HTEr?HT?HU$A`?HUOEr(n%d_$h&j(Rp(U!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z&j&hT$h&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c&j&zP;=`<%l&c'|'U]$h&j(U!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!b(SU(U!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!b(iP;=`<%l'}'|(oP;=`<%l&}'[(y]$h&j(RpOY(rYZ&cZr(rrs&cs!^(r!^!_)r!_#O(r#O#P&c#P#o(r#o#p)r#p;'S(r;'S;=`*a<%lO(rp)wU(RpOY)rZr)rs#O)r#P;'S)r;'S;=`*Z<%lO)rp*^P;=`<%l)r'[*dP;=`<%l(r#S*nX(Rp(U!bOY*gZr*grs'}sw*gwx)rx#O*g#P;'S*g;'S;=`+Z<%lO*g#S+^P;=`<%l*g(n+dP;=`<%l%Z07[+rq$h&j(Rp(U!b'w0/lOX%ZXY+gYZ&cZ[+g[p%Zpq+gqr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p$f%Z$f$g+g$g#BY%Z#BY#BZ+g#BZ$IS%Z$IS$I_+g$I_$JT%Z$JT$JU+g$JU$KV%Z$KV$KW+g$KW&FU%Z&FU&FV+g&FV;'S%Z;'S;=`+a<%l?HT%Z?HT?HU+g?HUO%Z07[.ST(S#S$h&j'x0/lO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c07[.n_$h&j(Rp(U!b'x0/lOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z)3p/x`$h&j!m),Q(Rp(U!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`0z!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z(KW1V`#u(Ch$h&j(Rp(U!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`2X!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z(KW2d_#u(Ch$h&j(Rp(U!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'At3l_(Q':f$h&j(U!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k(^4r_$h&j(U!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k&z5vX$h&jOr5qrs6cs!^5q!^!_6y!_#o5q#o#p6y#p;'S5q;'S;=`7h<%lO5q&z6jT$c`$h&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c`6|TOr6yrs7]s;'S6y;'S;=`7b<%lO6y`7bO$c``7eP;=`<%l6y&z7kP;=`<%l5q(^7w]$c`$h&j(U!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!r8uZ(U!bOY8pYZ6yZr8prs9hsw8pwx6yx#O8p#O#P6y#P;'S8p;'S;=`:R<%lO8p!r9oU$c`(U!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!r:UP;=`<%l8p(^:[P;=`<%l4k%9[:hh$h&j(Rp(U!bOY%ZYZ&cZq%Zqr`#P#o`x!^=^!^!_?q!_#O=^#O#P>`#P#o=^#o#p?q#p;'S=^;'S;=`@h<%lO=^&n>gXWS$h&jOY>`YZ&cZ!^>`!^!_?S!_#o>`#o#p?S#p;'S>`;'S;=`?k<%lO>`S?XSWSOY?SZ;'S?S;'S;=`?e<%lO?SS?hP;=`<%l?S&n?nP;=`<%l>`!f?xWWS(U!bOY?qZw?qwx?Sx#O?q#O#P?S#P;'S?q;'S;=`@b<%lO?q!f@eP;=`<%l?q(Q@kP;=`<%l=^'`@w]WS$h&j(RpOY@nYZ&cZr@nrs>`s!^@n!^!_Ap!_#O@n#O#P>`#P#o@n#o#pAp#p;'S@n;'S;=`Bg<%lO@ntAwWWS(RpOYApZrAprs?Ss#OAp#O#P?S#P;'SAp;'S;=`Ba<%lOAptBdP;=`<%lAp'`BjP;=`<%l@n#WBvYWS(Rp(U!bOYBmZrBmrs?qswBmwxApx#OBm#O#P?S#P;'SBm;'S;=`Cf<%lOBm#WCiP;=`<%lBm(rCoP;=`<%l^!Q^$h&j!U7`OY!=yYZ&cZ!P!=y!P!Q!>|!Q!^!=y!^!_!@c!_!}!=y!}#O!CW#O#P!Dy#P#o!=y#o#p!@c#p;'S!=y;'S;=`!Ek<%lO!=y|#X#Z&c#Z#[!>|#[#]&c#]#^!>|#^#a&c#a#b!>|#b#g&c#g#h!>|#h#i&c#i#j!>|#j#k!>|#k#m&c#m#n!>|#n#o&c#p;'S&c;'S;=`&w<%lO&c7`!@hX!U7`OY!@cZ!P!@c!P!Q!AT!Q!}!@c!}#O!Ar#O#P!Bq#P;'S!@c;'S;=`!CQ<%lO!@c7`!AYW!U7`#W#X!AT#Z#[!AT#]#^!AT#a#b!AT#g#h!AT#i#j!AT#j#k!AT#m#n!AT7`!AuVOY!ArZ#O!Ar#O#P!B[#P#Q!@c#Q;'S!Ar;'S;=`!Bk<%lO!Ar7`!B_SOY!ArZ;'S!Ar;'S;=`!Bk<%lO!Ar7`!BnP;=`<%l!Ar7`!BtSOY!@cZ;'S!@c;'S;=`!CQ<%lO!@c7`!CTP;=`<%l!@c^!Ezl$h&j(U!b!U7`OY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#W&}#W#X!Eq#X#Z&}#Z#[!Eq#[#]&}#]#^!Eq#^#a&}#a#b!Eq#b#g&}#g#h!Eq#h#i&}#i#j!Eq#j#k!Eq#k#m&}#m#n!Eq#n#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}8r!GyZ(U!b!U7`OY!GrZw!Grwx!@cx!P!Gr!P!Q!Hl!Q!}!Gr!}#O!JU#O#P!Bq#P;'S!Gr;'S;=`!J|<%lO!Gr8r!Hse(U!b!U7`OY'}Zw'}x#O'}#P#W'}#W#X!Hl#X#Z'}#Z#[!Hl#[#]'}#]#^!Hl#^#a'}#a#b!Hl#b#g'}#g#h!Hl#h#i'}#i#j!Hl#j#k!Hl#k#m'}#m#n!Hl#n;'S'};'S;=`(f<%lO'}8r!JZX(U!bOY!JUZw!JUwx!Arx#O!JU#O#P!B[#P#Q!Gr#Q;'S!JU;'S;=`!Jv<%lO!JU8r!JyP;=`<%l!JU8r!KPP;=`<%l!Gr>^!KZ^$h&j(U!bOY!KSYZ&cZw!KSwx!CWx!^!KS!^!_!JU!_#O!KS#O#P!DR#P#Q!^!LYP;=`<%l!KS>^!L`P;=`<%l!_#c#d#Bq#d#l%Z#l#m#Es#m#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#>j_$h&j(Rp(U!bp'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#?rd$h&j(Rp(U!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!R#AQ!R!S#AQ!S!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#AQ#S#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#A]f$h&j(Rp(U!bp'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!R#AQ!R!S#AQ!S!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#AQ#S#b%Z#b#c#>_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#Bzc$h&j(Rp(U!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!Y#DV!Y!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#DV#S#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#Dbe$h&j(Rp(U!bp'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!Y#DV!Y!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#DV#S#b%Z#b#c#>_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#E|g$h&j(Rp(U!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q![#Ge![!^%Z!^!_*g!_!c%Z!c!i#Ge!i#O%Z#O#P&c#P#R%Z#R#S#Ge#S#T%Z#T#Z#Ge#Z#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#Gpi$h&j(Rp(U!bp'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q![#Ge![!^%Z!^!_*g!_!c%Z!c!i#Ge!i#O%Z#O#P&c#P#R%Z#R#S#Ge#S#T%Z#T#Z#Ge#Z#b%Z#b#c#>_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z*)x#Il_!d$b$h&j#})Lv(Rp(U!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z)[#Jv_al$h&j(Rp(U!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z04f#LS^h#)`#O-Df[n]||-1},{term:338,get:n=>Gf[n]||-1},{term:92,get:n=>Nf[n]||-1}],tokenPrec:14749});function io(n){let t=Object.keys(n).join(""),e=/\w/.test(t);return e&&(t=t.replace(/\w/g,"")),`[${e?"\\w":""}${t.replace(/[^\w\s]/g,"\\$&")}]`}function Bf(n){let t=Object.create(null),e=Object.create(null);for(let{label:s}of n){t[s[0]]=!0;for(let r=1;rtypeof s=="string"?{label:s}:s),[e,i]=t.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:Bf(t);return s=>{let r=s.matchBefore(i);return r||s.explicit?{from:r?r.from:s.pos,options:t,validFor:e}:null}}function Ff(n,t){return e=>{for(let i=le(e.state).resolveInner(e.pos,-1);i;i=i.parent){if(n.indexOf(i.name)>-1)return null;if(i.type.isTop)break}return t(e)}}const Hf=It.define(),Kf=R.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:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&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:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class Jf{constructor(t,e,i,s){this.field=t,this.line=e,this.from=i,this.to=s}}class zn{constructor(t,e,i){this.field=t,this.from=e,this.to=i}map(t){let e=t.mapPos(this.from,-1,lt.TrackDel),i=t.mapPos(this.to,1,lt.TrackDel);return e==null||i==null?null:new zn(this.field,e,i)}}class qn{constructor(t,e){this.lines=t,this.fieldPositions=e}instantiate(t,e){let i=[],s=[e],r=t.doc.lineAt(e),o=/^\s*/.exec(r.text)[0];for(let a of this.lines){if(i.length){let h=o,c=/^\t*/.exec(a)[0].length;for(let f=0;fnew zn(a.field,s[a.line]+a.from,s[a.line]+a.to));return{text:i,ranges:l}}static parse(t){let e=[],i=[],s=[],r;for(let o of t.split(/\r\n?|\n/)){for(;r=/[#$]\{(?:(\d+)(?::([^}]*))?|((?:\\[{}]|[^}])*))\}/.exec(o);){let l=r[1]?+r[1]:null,a=r[2]||r[3]||"",h=-1,c=a.replace(/\\[{}]/g,f=>f[1]);for(let f=0;f=h&&O.field++}s.push(new Jf(h,i.length,r.index,r.index+c.length)),o=o.slice(0,r.index)+a+o.slice(r.index+r[0].length)}o=o.replace(/\\([{}])/g,(l,a,h)=>{for(let c of s)c.line==i.length&&c.from>h&&(c.from--,c.to--);return a}),i.push(o)}return new qn(i,s)}}let tO=B.widget({widget:new class extends os{toDOM(){let n=document.createElement("span");return n.className="cm-snippetFieldPosition",n}ignoreEvent(){return!1}}}),eO=B.mark({class:"cm-snippetField"});class qe{constructor(t,e){this.ranges=t,this.active=e,this.deco=B.set(t.map(i=>(i.from==i.to?tO:eO).range(i.from,i.to)))}map(t){let e=[];for(let i of this.ranges){let s=i.map(t);if(!s)return null;e.push(s)}return new qe(e,this.active)}selectionInsideField(t){return t.ranges.every(e=>this.ranges.some(i=>i.field==this.active&&i.from<=e.from&&i.to>=e.to))}}const mi=N.define({map(n,t){return n&&n.map(t)}}),iO=N.define(),fi=Nt.define({create(){return null},update(n,t){for(let e of t.effects){if(e.is(mi))return e.value;if(e.is(iO)&&n)return new qe(n.ranges,e.value)}return n&&t.docChanged&&(n=n.map(t.changes)),n&&t.selection&&!n.selectionInsideField(t.selection)&&(n=null),n},provide:n=>R.decorations.from(n,t=>t?t.deco:B.none)});function Un(n,t){return P.create(n.filter(e=>e.field==t).map(e=>P.range(e.from,e.to)))}function sO(n){let t=qn.parse(n);return(e,i,s,r)=>{let{text:o,ranges:l}=t.instantiate(e.state,s),a={changes:{from:s,to:r,insert:W.of(o)},scrollIntoView:!0,annotations:i?[Hf.of(i),H.userEvent.of("input.complete")]:void 0};if(l.length&&(a.selection=Un(l,0)),l.some(h=>h.field>0)){let h=new qe(l,0),c=a.effects=[mi.of(h)];e.state.field(fi,!1)===void 0&&c.push(N.appendConfig.of([fi,aO,hO,Kf]))}e.dispatch(e.state.update(a))}}function Vl(n){return({state:t,dispatch:e})=>{let i=t.field(fi,!1);if(!i||n<0&&i.active==0)return!1;let s=i.active+n,r=n>0&&!i.ranges.some(o=>o.field==s+n);return e(t.update({selection:Un(i.ranges,s),effects:mi.of(r?null:new qe(i.ranges,s)),scrollIntoView:!0})),!0}}const nO=({state:n,dispatch:t})=>n.field(fi,!1)?(t(n.update({effects:mi.of(null)})),!0):!1,rO=Vl(1),oO=Vl(-1),lO=[{key:"Tab",run:rO,shift:oO},{key:"Escape",run:nO}],so=v.define({combine(n){return n.length?n[0]:lO}}),aO=Oi.highest(as.compute([so],n=>n.facet(so)));function ht(n,t){return Object.assign(Object.assign({},t),{apply:sO(n)})}const hO=R.domEventHandlers({mousedown(n,t){let e=t.state.field(fi,!1),i;if(!e||(i=t.posAtCoords({x:n.clientX,y:n.clientY}))==null)return!1;let s=e.ranges.find(r=>r.from<=i&&r.to>=i);return!s||s.field==e.active?!1:(t.dispatch({selection:Un(e.ranges,s.field),effects:mi.of(e.ranges.some(r=>r.field>s.field)?new qe(e.ranges,s.field):null),scrollIntoView:!0}),!0)}}),_l=new class extends ge{};_l.startSide=1;_l.endSide=-1;const Dl=[ht("function ${name}(${params}) {\n ${}\n}",{label:"function",detail:"definition",type:"keyword"}),ht("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n ${}\n}",{label:"for",detail:"loop",type:"keyword"}),ht("for (let ${name} of ${collection}) {\n ${}\n}",{label:"for",detail:"of loop",type:"keyword"}),ht("do {\n ${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),ht("while (${}) {\n ${}\n}",{label:"while",detail:"loop",type:"keyword"}),ht(`try { + \${} +} catch (\${error}) { + \${} +}`,{label:"try",detail:"/ catch block",type:"keyword"}),ht("if (${}) {\n ${}\n}",{label:"if",detail:"block",type:"keyword"}),ht(`if (\${}) { + \${} +} else { + \${} +}`,{label:"if",detail:"/ else block",type:"keyword"}),ht(`class \${name} { + constructor(\${params}) { + \${} + } +}`,{label:"class",detail:"definition",type:"keyword"}),ht('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),ht('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],cO=Dl.concat([ht("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),ht("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),ht("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),no=new wc,Gl=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function De(n){return(t,e)=>{let i=t.node.getChild("VariableDefinition");return i&&e(i,n),!0}}const fO=["FunctionDeclaration"],OO={FunctionDeclaration:De("function"),ClassDeclaration:De("class"),ClassExpression:()=>!0,EnumDeclaration:De("constant"),TypeAliasDeclaration:De("type"),NamespaceDeclaration:De("namespace"),VariableDefinition(n,t){n.matchContext(fO)||t(n,"variable")},TypeDefinition(n,t){t(n,"type")},__proto__:null};function Nl(n,t){let e=no.get(t);if(e)return e;let i=[],s=!0;function r(o,l){let a=n.sliceString(o.from,o.to);i.push({label:a,type:l})}return t.cursor(tt.IncludeAnonymous).iterate(o=>{if(s)s=!1;else if(o.name){let l=OO[o.name];if(l&&l(o,r)||Gl.has(o.name))return!1}else if(o.to-o.from>8192){for(let l of Nl(n,o.node))i.push(l);return!1}}),no.set(t,i),i}const ro=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,Il=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName",".","?."];function uO(n){let t=le(n.state).resolveInner(n.pos,-1);if(Il.indexOf(t.name)>-1)return null;let e=t.name=="VariableName"||t.to-t.from<20&&ro.test(n.state.sliceDoc(t.from,t.to));if(!e&&!n.explicit)return null;let i=[];for(let s=t;s;s=s.parent)Gl.has(s.name)&&(i=i.concat(Nl(n.state.doc,s)));return{options:i,from:e?t.from:n.pos,validFor:ro}}const de=Ki.define({name:"javascript",parser:If.configure({props:[zc.add({IfStatement:ws({except:/^\s*({|else\b)/}),TryStatement:ws({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:Ec,SwitchBody:n=>{let t=n.textAfter,e=/^\s*\}/.test(t),i=/^\s*(case|default)\b/.test(t);return n.baseIndent+(e?0:i?1:2)*n.unit},Block:Uc({closing:"}"}),ArrowFunction:n=>n.baseIndent+n.unit,"TemplateString BlockComment":()=>null,"Statement Property":ws({except:/^{/}),JSXElement(n){let t=/^\s*<\//.test(n.textAfter);return n.lineIndent(n.node.from)+(t?0:n.unit)},JSXEscape(n){let t=/\s*\}/.test(n.textAfter);return n.lineIndent(n.node.from)+(t?0:n.unit)},"JSXOpenTag JSXSelfClosingTag"(n){return n.column(n.node.from)+n.unit}}),Vc.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":_c,BlockComment(n){return{from:n.from+2,to:n.to-2}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),Bl={test:n=>/^JSX/.test(n.name),facet:Xl({commentTokens:{block:{open:"{/*",close:"*/}"}}})},dO=de.configure({dialect:"ts"},"typescript"),pO=de.configure({dialect:"jsx",props:[Mn.add(n=>n.isTop?[Bl]:void 0)]}),gO=de.configure({dialect:"jsx ts",props:[Mn.add(n=>n.isTop?[Bl]:void 0)]},"typescript");let Ll=n=>({label:n,type:"keyword"});const Fl="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(Ll),mO=Fl.concat(["declare","implements","private","protected","public"].map(Ll));function bO(n={}){let t=n.jsx?n.typescript?gO:pO:n.typescript?dO:de,e=n.typescript?cO.concat(mO):Dl.concat(Fl);return new Yc(t,[de.data.of({autocomplete:Ff(Il,Lf(e))}),de.data.of({autocomplete:uO}),n.jsx?SO:[]])}function QO(n){for(;;){if(n.name=="JSXOpenTag"||n.name=="JSXSelfClosingTag"||n.name=="JSXFragmentTag")return n;if(n.name=="JSXEscape"||!n.parent)return null;n=n.parent}}function oo(n,t,e=n.length){for(let i=t?.firstChild;i;i=i.nextSibling)if(i.name=="JSXIdentifier"||i.name=="JSXBuiltin"||i.name=="JSXNamespacedName"||i.name=="JSXMemberExpression")return n.sliceString(i.from,Math.min(i.to,e));return""}const yO=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),SO=R.inputHandler.of((n,t,e,i,s)=>{if((yO?n.composing:n.compositionStarted)||n.state.readOnly||t!=e||i!=">"&&i!="/"||!de.isActiveAt(n.state,t,-1))return!1;let r=s(),{state:o}=r,l=o.changeByRange(a=>{var h;let{head:c}=a,f=le(o).resolveInner(c-1,-1),O;if(f.name=="JSXStartTag"&&(f=f.parent),!(o.doc.sliceString(c-1,c)!=i||f.name=="JSXAttributeValue"&&f.to>c)){if(i==">"&&f.name=="JSXFragmentTag")return{range:a,changes:{from:c,insert:""}};if(i=="/"&&f.name=="JSXStartCloseTag"){let u=f.parent,d=u.parent;if(d&&u.from==c-2&&((O=oo(o.doc,d.firstChild,c))||((h=d.firstChild)===null||h===void 0?void 0:h.name)=="JSXFragmentTag")){let p=`${O}>`;return{range:P.cursor(c+p.length,-1),changes:{from:c,insert:p}}}}else if(i==">"){let u=QO(f);if(u&&u.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(o.doc.sliceString(c,c+2))&&(O=oo(o.doc,u,c)))return{range:a,changes:{from:c,insert:``}}}}return{range:a}});return l.changes.empty?!1:(n.dispatch([r,o.update(l,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),jn="-",xO=n=>{const t=PO(n),{conflictingClassGroups:e,conflictingClassGroupModifiers:i}=n;return{getClassGroupId:o=>{const l=o.split(jn);return l[0]===""&&l.length!==1&&l.shift(),Hl(l,t)||wO(o)},getConflictingClassGroupIds:(o,l)=>{const a=e[o]||[];return l&&i[o]?[...a,...i[o]]:a}}},Hl=(n,t)=>{if(n.length===0)return t.classGroupId;const e=n[0],i=t.nextPart.get(e),s=i?Hl(n.slice(1),i):void 0;if(s)return s;if(t.validators.length===0)return;const r=n.join(jn);return t.validators.find(({validator:o})=>o(r))?.classGroupId},lo=/^\[(.+)\]$/,wO=n=>{if(lo.test(n)){const t=lo.exec(n)[1],e=t?.substring(0,t.indexOf(":"));if(e)return"arbitrary.."+e}},PO=n=>{const{theme:t,prefix:e}=n,i={nextPart:new Map,validators:[]};return kO(Object.entries(n.classGroups),e).forEach(([r,o])=>{Qn(o,i,r,t)}),i},Qn=(n,t,e,i)=>{n.forEach(s=>{if(typeof s=="string"){const r=s===""?t:ao(t,s);r.classGroupId=e;return}if(typeof s=="function"){if($O(s)){Qn(s(i),t,e,i);return}t.validators.push({validator:s,classGroupId:e});return}Object.entries(s).forEach(([r,o])=>{Qn(o,ao(t,r),e,i)})})},ao=(n,t)=>{let e=n;return t.split(jn).forEach(i=>{e.nextPart.has(i)||e.nextPart.set(i,{nextPart:new Map,validators:[]}),e=e.nextPart.get(i)}),e},$O=n=>n.isThemeGetter,kO=(n,t)=>t?n.map(([e,i])=>{const s=i.map(r=>typeof r=="string"?t+r:typeof r=="object"?Object.fromEntries(Object.entries(r).map(([o,l])=>[t+o,l])):r);return[e,s]}):n,ZO=n=>{if(n<1)return{get:()=>{},set:()=>{}};let t=0,e=new Map,i=new Map;const s=(r,o)=>{e.set(r,o),t++,t>n&&(t=0,i=e,e=new Map)};return{get(r){let o=e.get(r);if(o!==void 0)return o;if((o=i.get(r))!==void 0)return s(r,o),o},set(r,o){e.has(r)?e.set(r,o):s(r,o)}}},Kl="!",vO=n=>{const{separator:t,experimentalParseClassName:e}=n,i=t.length===1,s=t[0],r=t.length,o=l=>{const a=[];let h=0,c=0,f;for(let g=0;gc?f-c:void 0;return{modifiers:a,hasImportantModifier:u,baseClassName:d,maybePostfixModifierPosition:p}};return e?l=>e({className:l,parseClassName:o}):o},RO=n=>{if(n.length<=1)return n;const t=[];let e=[];return n.forEach(i=>{i[0]==="["?(t.push(...e.sort(),i),e=[]):e.push(i)}),t.push(...e.sort()),t},TO=n=>({cache:ZO(n.cacheSize),parseClassName:vO(n),...xO(n)}),AO=/\s+/,CO=(n,t)=>{const{parseClassName:e,getClassGroupId:i,getConflictingClassGroupIds:s}=t,r=[],o=n.trim().split(AO);let l="";for(let a=o.length-1;a>=0;a-=1){const h=o[a],{modifiers:c,hasImportantModifier:f,baseClassName:O,maybePostfixModifierPosition:u}=e(h);let d=!!u,p=i(d?O.substring(0,u):O);if(!p){if(!d){l=h+(l.length>0?" "+l:l);continue}if(p=i(O),!p){l=h+(l.length>0?" "+l:l);continue}d=!1}const g=RO(c).join(":"),b=f?g+Kl:g,Q=b+p;if(r.includes(Q))continue;r.push(Q);const w=s(p,d);for(let S=0;S0?" "+l:l)}return l};function XO(){let n=0,t,e,i="";for(;n{if(typeof n=="string")return n;let t,e="";for(let i=0;if(c),n());return e=TO(h),i=e.cache.get,s=e.cache.set,r=l,l(a)}function l(a){const h=i(a);if(h)return h;const c=CO(a,e);return s(a,c),c}return function(){return r(XO.apply(null,arguments))}}const _=n=>{const t=e=>e[n]||[];return t.isThemeGetter=!0,t},ta=/^\[(?:([a-z-]+):)?(.+)\]$/i,YO=/^\d+\/\d+$/,MO=new Set(["px","full","screen"]),zO=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,qO=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,UO=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,jO=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,EO=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ut=n=>Re(n)||MO.has(n)||YO.test(n),Lt=n=>Ue(n,"length",LO),Re=n=>!!n&&!Number.isNaN(Number(n)),Ts=n=>Ue(n,"number",Re),Ge=n=>!!n&&Number.isInteger(Number(n)),VO=n=>n.endsWith("%")&&Re(n.slice(0,-1)),A=n=>ta.test(n),Ft=n=>zO.test(n),_O=new Set(["length","size","percentage"]),DO=n=>Ue(n,_O,ea),GO=n=>Ue(n,"position",ea),NO=new Set(["image","url"]),IO=n=>Ue(n,NO,HO),BO=n=>Ue(n,"",FO),Ne=()=>!0,Ue=(n,t,e)=>{const i=ta.exec(n);return i?i[1]?typeof t=="string"?i[1]===t:t.has(i[1]):e(i[2]):!1},LO=n=>qO.test(n)&&!UO.test(n),ea=()=>!1,FO=n=>jO.test(n),HO=n=>EO.test(n),KO=()=>{const n=_("colors"),t=_("spacing"),e=_("blur"),i=_("brightness"),s=_("borderColor"),r=_("borderRadius"),o=_("borderSpacing"),l=_("borderWidth"),a=_("contrast"),h=_("grayscale"),c=_("hueRotate"),f=_("invert"),O=_("gap"),u=_("gradientColorStops"),d=_("gradientColorStopPositions"),p=_("inset"),g=_("margin"),b=_("opacity"),Q=_("padding"),w=_("saturate"),S=_("scale"),k=_("sepia"),T=_("skew"),Z=_("space"),E=_("translate"),M=()=>["auto","contain","none"],X=()=>["auto","hidden","clip","visible","scroll"],C=()=>["auto",A,t],$=()=>[A,t],V=()=>["",Ut,Lt],q=()=>["auto",Re,A],et=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],gt=()=>["solid","dashed","dotted","double","none"],qt=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],xt=()=>["start","end","center","between","around","evenly","stretch"],Bt=()=>["","0",A],mt=()=>["auto","avoid","all","avoid-page","page","left","right","column"],I=()=>[Re,A];return{cacheSize:500,separator:":",theme:{colors:[Ne],spacing:[Ut,Lt],blur:["none","",Ft,A],brightness:I(),borderColor:[n],borderRadius:["none","","full",Ft,A],borderSpacing:$(),borderWidth:V(),contrast:I(),grayscale:Bt(),hueRotate:I(),invert:Bt(),gap:$(),gradientColorStops:[n],gradientColorStopPositions:[VO,Lt],inset:C(),margin:C(),opacity:I(),padding:$(),saturate:I(),scale:I(),sepia:Bt(),skew:I(),space:$(),translate:$()},classGroups:{aspect:[{aspect:["auto","square","video",A]}],container:["container"],columns:[{columns:[Ft]}],"break-after":[{"break-after":mt()}],"break-before":[{"break-before":mt()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...et(),A]}],overflow:[{overflow:X()}],"overflow-x":[{"overflow-x":X()}],"overflow-y":[{"overflow-y":X()}],overscroll:[{overscroll:M()}],"overscroll-x":[{"overscroll-x":M()}],"overscroll-y":[{"overscroll-y":M()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[p]}],"inset-x":[{"inset-x":[p]}],"inset-y":[{"inset-y":[p]}],start:[{start:[p]}],end:[{end:[p]}],top:[{top:[p]}],right:[{right:[p]}],bottom:[{bottom:[p]}],left:[{left:[p]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Ge,A]}],basis:[{basis:C()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",A]}],grow:[{grow:Bt()}],shrink:[{shrink:Bt()}],order:[{order:["first","last","none",Ge,A]}],"grid-cols":[{"grid-cols":[Ne]}],"col-start-end":[{col:["auto",{span:["full",Ge,A]},A]}],"col-start":[{"col-start":q()}],"col-end":[{"col-end":q()}],"grid-rows":[{"grid-rows":[Ne]}],"row-start-end":[{row:["auto",{span:[Ge,A]},A]}],"row-start":[{"row-start":q()}],"row-end":[{"row-end":q()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",A]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",A]}],gap:[{gap:[O]}],"gap-x":[{"gap-x":[O]}],"gap-y":[{"gap-y":[O]}],"justify-content":[{justify:["normal",...xt()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...xt(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...xt(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[Q]}],px:[{px:[Q]}],py:[{py:[Q]}],ps:[{ps:[Q]}],pe:[{pe:[Q]}],pt:[{pt:[Q]}],pr:[{pr:[Q]}],pb:[{pb:[Q]}],pl:[{pl:[Q]}],m:[{m:[g]}],mx:[{mx:[g]}],my:[{my:[g]}],ms:[{ms:[g]}],me:[{me:[g]}],mt:[{mt:[g]}],mr:[{mr:[g]}],mb:[{mb:[g]}],ml:[{ml:[g]}],"space-x":[{"space-x":[Z]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[Z]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",A,t]}],"min-w":[{"min-w":[A,t,"min","max","fit"]}],"max-w":[{"max-w":[A,t,"none","full","min","max","fit","prose",{screen:[Ft]},Ft]}],h:[{h:[A,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[A,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[A,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[A,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Ft,Lt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Ts]}],"font-family":[{font:[Ne]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",A]}],"line-clamp":[{"line-clamp":["none",Re,Ts]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Ut,A]}],"list-image":[{"list-image":["none",A]}],"list-style-type":[{list:["none","disc","decimal",A]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[n]}],"placeholder-opacity":[{"placeholder-opacity":[b]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[n]}],"text-opacity":[{"text-opacity":[b]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...gt(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Ut,Lt]}],"underline-offset":[{"underline-offset":["auto",Ut,A]}],"text-decoration-color":[{decoration:[n]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:$()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",A]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",A]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[b]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...et(),GO]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",DO]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},IO]}],"bg-color":[{bg:[n]}],"gradient-from-pos":[{from:[d]}],"gradient-via-pos":[{via:[d]}],"gradient-to-pos":[{to:[d]}],"gradient-from":[{from:[u]}],"gradient-via":[{via:[u]}],"gradient-to":[{to:[u]}],rounded:[{rounded:[r]}],"rounded-s":[{"rounded-s":[r]}],"rounded-e":[{"rounded-e":[r]}],"rounded-t":[{"rounded-t":[r]}],"rounded-r":[{"rounded-r":[r]}],"rounded-b":[{"rounded-b":[r]}],"rounded-l":[{"rounded-l":[r]}],"rounded-ss":[{"rounded-ss":[r]}],"rounded-se":[{"rounded-se":[r]}],"rounded-ee":[{"rounded-ee":[r]}],"rounded-es":[{"rounded-es":[r]}],"rounded-tl":[{"rounded-tl":[r]}],"rounded-tr":[{"rounded-tr":[r]}],"rounded-br":[{"rounded-br":[r]}],"rounded-bl":[{"rounded-bl":[r]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[b]}],"border-style":[{border:[...gt(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[b]}],"divide-style":[{divide:gt()}],"border-color":[{border:[s]}],"border-color-x":[{"border-x":[s]}],"border-color-y":[{"border-y":[s]}],"border-color-t":[{"border-t":[s]}],"border-color-r":[{"border-r":[s]}],"border-color-b":[{"border-b":[s]}],"border-color-l":[{"border-l":[s]}],"divide-color":[{divide:[s]}],"outline-style":[{outline:["",...gt()]}],"outline-offset":[{"outline-offset":[Ut,A]}],"outline-w":[{outline:[Ut,Lt]}],"outline-color":[{outline:[n]}],"ring-w":[{ring:V()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[n]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[Ut,Lt]}],"ring-offset-color":[{"ring-offset":[n]}],shadow:[{shadow:["","inner","none",Ft,BO]}],"shadow-color":[{shadow:[Ne]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":[...qt(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":qt()}],filter:[{filter:["","none"]}],blur:[{blur:[e]}],brightness:[{brightness:[i]}],contrast:[{contrast:[a]}],"drop-shadow":[{"drop-shadow":["","none",Ft,A]}],grayscale:[{grayscale:[h]}],"hue-rotate":[{"hue-rotate":[c]}],invert:[{invert:[f]}],saturate:[{saturate:[w]}],sepia:[{sepia:[k]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[e]}],"backdrop-brightness":[{"backdrop-brightness":[i]}],"backdrop-contrast":[{"backdrop-contrast":[a]}],"backdrop-grayscale":[{"backdrop-grayscale":[h]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[c]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[b]}],"backdrop-saturate":[{"backdrop-saturate":[w]}],"backdrop-sepia":[{"backdrop-sepia":[k]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",A]}],duration:[{duration:I()}],ease:[{ease:["linear","in","out","in-out",A]}],delay:[{delay:I()}],animate:[{animate:["none","spin","ping","pulse","bounce",A]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[S]}],"scale-x":[{"scale-x":[S]}],"scale-y":[{"scale-y":[S]}],rotate:[{rotate:[Ge,A]}],"translate-x":[{"translate-x":[E]}],"translate-y":[{"translate-y":[E]}],"skew-x":[{"skew-x":[T]}],"skew-y":[{"skew-y":[T]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",A]}],accent:[{accent:["auto",n]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",A]}],"caret-color":[{caret:[n]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":$()}],"scroll-mx":[{"scroll-mx":$()}],"scroll-my":[{"scroll-my":$()}],"scroll-ms":[{"scroll-ms":$()}],"scroll-me":[{"scroll-me":$()}],"scroll-mt":[{"scroll-mt":$()}],"scroll-mr":[{"scroll-mr":$()}],"scroll-mb":[{"scroll-mb":$()}],"scroll-ml":[{"scroll-ml":$()}],"scroll-p":[{"scroll-p":$()}],"scroll-px":[{"scroll-px":$()}],"scroll-py":[{"scroll-py":$()}],"scroll-ps":[{"scroll-ps":$()}],"scroll-pe":[{"scroll-pe":$()}],"scroll-pt":[{"scroll-pt":$()}],"scroll-pr":[{"scroll-pr":$()}],"scroll-pb":[{"scroll-pb":$()}],"scroll-pl":[{"scroll-pl":$()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",A]}],fill:[{fill:[n,"none"]}],"stroke-w":[{stroke:[Ut,Lt,Ts]}],stroke:[{stroke:[n,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},JO=WO(KO);var tu=ho('
'),eu=ho("
");const iu=as.of([{key:"Enter",run(n){const{selection:{ranges:t},doc:e}=n.state;if(t.length!==1)return!1;const{from:i,to:s}=t[0];if(i!==s)return!1;const r=e.lineAt(i);return r.from!==i||r.number!==e.lines?!1:e.lines<2||e.line(e.lines-1).length?(n.dispatch([n.state.update({changes:{from:i,insert:` +`},selection:{anchor:i+1}})]),!1):!0}}]);function ou(n){const[t,e,i]=ra(n,["value","onModelViewUpdate","onTransactionDispatched","onValueChange"],["editorViewRef","readonly","icon","text"]),{editorView:s,ref:r,createExtension:o}=dc(t);return o(R.lineWrapping),o(Oi.high(iu)),o([Jc(),as.of(hf)]),o(R.theme({"&.cm-editor.cm-focused":{outline:"none"},".cm-content":{caretColor:"var(--text1)",fontSize:n.text??"12pt"}})),gc(Ie(()=>{if(n.readwrite||n.readonly)return s()}),Ie(()=>t.value??"")),pc(s,Ie(()=>n.readonly??!1)),pe(()=>{e.editorViewRef?.(s?.())}),o(Ie(()=>{if(n.javascript)return[bO(),Gc(gi.define([{tag:m.variableName,color:"light-dark(#479, #8AD)"},{tag:m.keyword,color:"light-dark(#832, #fa3)"},{tag:m.string,color:"light-dark(#954, #ec8)"},{tag:m.number,color:"#dae"},{tag:m.comment,color:"#f5d",fontStyle:"italic"}]))]})),(()=>{var l=_n(eu);return oa(r,l),la(l,aa(i,{get class(){return JO("relative",i.class)},onClick:()=>{s()?.focus()}}),!1),Dn(l,ha(ca,{get when(){return e.icon},get children(){var a=_n(tu);return Dn(a,()=>e.icon),a}})),fa(),l})()}export{ou as C}; diff --git a/_astro/KvPlayground.CGaUbB3T.js b/_astro/KvPlayground.CGaUbB3T.js new file mode 100644 index 00000000..2a2eb413 --- /dev/null +++ b/_astro/KvPlayground.CGaUbB3T.js @@ -0,0 +1 @@ +import{a as n,c as $,g as b,d as o,i as s,e as u,t as _}from"./web.Djz3GSgY.js";import{C as i}from"./CodeMirror.BprfeSgn.js";import{K as S}from"./lexer-CgIEgaNo.BGGAnFgt.js";var k=_('
');function y(g){const[r,d]=n(g.value??"a=b"),[c,a]=n(!0),f=$(e=>{try{const t=JSON.stringify(S.parse(r()),null,2);return a(!0),t}catch(t){return a(!1),e??String(t)}});return(()=>{var e=b(k),t=e.firstChild,[l,x]=o(t.nextSibling),m=l.nextSibling,[p,v]=o(m.nextSibling);return s(e,u(i,{readwrite:!0,class:"grow basis-32 overflow-auto rounded-lg bg-neutral-300 dark:bg-neutral-700",onValueChange:d,get value(){return r()}}),l,x),s(e,u(i,{class:"flex-auto overflow-auto rounded-lg bg-neutral-200 dark:bg-neutral-800",text:"10px",readonly:!0,get value(){return f()},get classList(){return{"text-red-500 dark:text-red-400":!c()}}}),p,v),e})()}export{y as default}; diff --git a/_astro/PardonApplication.CGiMqu1Y.js b/_astro/PardonApplication.CGiMqu1Y.js new file mode 100644 index 00000000..d4c2327c --- /dev/null +++ b/_astro/PardonApplication.CGiMqu1Y.js @@ -0,0 +1 @@ +import{B as s,C as p,c as u,e as m}from"./web.Djz3GSgY.js";import"./lexer-CgIEgaNo.BGGAnFgt.js";import{r as f}from"./pardon-Dbc5z6SD.DxyttN9Z.js";import"./trial-Df-0_jpB.Cx90g8F9.js";Error.captureStackTrace??=()=>{};Object.defineProperty(globalThis,"environment",{get(){return{}},set(){},configurable:!1});const i=s();function P(){return p(i)}function b(n){const e=u(()=>{try{return{application:d(n)}}catch(o){return{error:o}}});return m(i.Provider,{value:e,get children(){return n.children}})}function d(n){const{config:e,example:o,layers:t}=n,a=t?t.map(r=>c(e,r,"")):[c(e,"/collection/","/collection/")];return f({config:{root:"/",collections:t??["/collection/"]},layers:a,samples:[],example:{request:o}})}function c(n,e,o){return Object.entries(n).map(([t,a])=>{const r=`${o}${t}`;if(r.startsWith(e))return{name:r.slice(e.length),path:r,content:a}}).filter(Boolean).reduce((t,{name:a,path:r,content:l})=>Object.assign(t,{[a]:{path:r,content:l}}),{})}export{b as PardonApplication,i as default,P as usePardonContext}; diff --git a/_astro/PardonPlayground.DSofBvNB.js b/_astro/PardonPlayground.DSofBvNB.js new file mode 100644 index 00000000..0df7ffc9 --- /dev/null +++ b/_astro/PardonPlayground.DSofBvNB.js @@ -0,0 +1,6 @@ +import{c as y,e,M as L,z as be,a as w,k as j,A as q,u as C,B as W,C as X,g as M,d as x,i as m,S as k,r as F,f as O,t as R,o as Y}from"./web.Djz3GSgY.js";import{C as V}from"./CodeMirror.BprfeSgn.js";import{usePardonContext as Z}from"./PardonApplication.CGiMqu1Y.js";import{b as ve,c as xe,d as we,e as ye,f as _e,g as Se,h as ee,i as re,j as te,k as ne,l as ke,m as Pe,n as ze,o as Ee}from"./index.4VmesigZ.js";import{i as _}from"./PardonPlaygroundLoader.B5xqmHkS.js";import{h as Me,f as Re,P as Te}from"./products-server-hook.Duq5ctrJ.js";import{H as B,K as U,i as Ce}from"./lexer-CgIEgaNo.BGGAnFgt.js";import{p as qe}from"./trial-Df-0_jpB.Cx90g8F9.js";import"./api.3y1TnKr0.js";/* empty css */import{P as He}from"./pardon-Dbc5z6SD.DxyttN9Z.js";import"./preload-helper.CaDgunLA.js";/* empty css */function oe(){let r;const c=new Promise((h,i)=>r={resolve:h,reject:i});return{resolution:r,promise:c}}function Ae({context:r,FetchExecution:c,input:h,env:i,restart:b,runtime:$}){const u={delayed:(a,t)=>new Promise(n=>setTimeout(()=>n(t),a)),async serviceToken(a){return await new Promise(t=>setTimeout(t,700)),`service-token-${a}-${`${Date.now()}`.slice(-5)}`},async digest(a){return Array.from(new Uint8Array(await crypto.subtle.digest("SHA-256",new TextEncoder().encode(a)))).map(t=>t.toString(16).padStart(2,"0")).join("")}},f=y(()=>{const a=r();if("error"in a)return{error:a.error};const{compiler:t,collection:n}=a.application,s=(o={},d)=>qe({FetchExecution:c,context:{app:()=>a.application,durations:{},timestamps:{},...d,values:o,options:{pretty:!0,...d?.options},runtime:{...u,...d?.runtime}}});return t.import=async(o,d)=>{let l=t.resolve(o,d);const p=n.configurations[l.replace(/^pardon:/,"")];if(p?.export&&(l=t.resolve(p.export,`pardon:${p.path}`)),l==="pardon:example/products/products-helper.ts")return{async price({product:g,env:T}){const{inbound:{values:{price:P}}}=await s({product:g,env:T})`https://example.com/products/{{product}}`();return P}};console.warn(`no playground import definition for ${l}`)},{pardon:s}});return y(()=>{const a=f();if("error"in a)return{error:a.error};const{pardon:t}=a;try{const n=t(i(),{runtime:$?.(t)}),o=h()?n`${h()}`.init():n.match("");return b(),{execution:o}}catch(n){return{error:n}}})}function ie(r){const c=r.type==="response"?ve:xe;return e(be,{get children(){return[e(L,{get when(){return r.mood==="confused"},get children(){return e(we,{get size(){return r.iconSize}})}}),e(L,{get when(){return r.mood==="confuzzled"},get children(){return e(ye,{get size(){return r.iconSize}})}}),e(L,{get when(){return r.mood==="error"},get children(){return e(_e,{get size(){return r.iconSize}})}}),e(L,{get when(){return r.mood==="thinking"},get children(){return e(c,{class:"pulse",color:"gray",get size(){return r.iconSize}})}}),e(L,{get when(){return r.mood==="happy"},get children(){return e(Se,{color:"gray",get size(){return r.iconSize}})}})]}})}function Le(r){const[c,h]=w(()=>"confused"),i=y(()=>c()());return j(()=>{r.moodRef?.(i())}),q(()=>({executionHandle:r.executionHandle()}),async({executionHandle:b})=>{const[$,u]=w(C(C(c)));if(h(()=>$),"error"in b)return u(()=>"confuzzled"),{};const{execution:f}=b;await new Promise(n=>requestAnimationFrame(n));const a=f.preview;try{await a}catch{return u(()=>"confused"),{}}const t=oe();t.promise.then(n=>u(n)),setTimeout(()=>t.resolution.resolve("thinking"),200);try{await f.outbound,t.promise.then(()=>u("happy")),t.resolution.resolve("happy")}catch{t.promise.then(()=>u("error")),t.resolution.resolve("error")}return{}}),e(ie,{get mood(){return i()},iconSize:_})}const ae=W();function Ve(r){const c=C(()=>r.secrets);if(c!==void 0){const[h,i]=w(c);return e(ae.Provider,{value:{secrets:h,setSecrets:i,enabled:!0},get children(){return r.children}})}return y(()=>r.children)}function G(){return X(ae)??{enabled:!1,secrets:()=>!1}}var je=R('');function Ge(r){const{secrets:c,setSecrets:h,enabled:i}=G(),[,b]=le(),[$,u]=w(()=>({inflight:!1,gate:void 0})),f=y(()=>$()().inflight),a=y(()=>$()().gate),[t]=q(()=>({executionHandle:r.executionHandle()}),async({executionHandle:l})=>{const[p,g]=w(!1),[T,P]=w();if(u(()=>y(()=>({inflight:p(),gate:T()}))),g(!1),"error"in l)return{error:new Error("invalid application context",{cause:l.error})};const{execution:v}=l;try{await v.outbound}catch(E){return{error:E}}await new Promise(E=>requestAnimationFrame(E));const z=oe();P(z),await z.promise,g(!0);try{return{pardon:{result:await v.result,execution:v}}}catch(E){return{error:E}}}),[n,s]=w();j(()=>{s(l=>{if(t.state==="pending")return{};const p=t.latest?.error;return{pardon:t.latest?.pardon??l?.pardon,error:p}})});function o(){r.reset?.(),s({})}const d=y(()=>{const l=n()?.pardon?.result;return i&&c()?l&&B.responseObject.stringify(l.inbound.response):l&&B.responseObject.stringify(l.inbound.redacted)});return j(()=>b(n()?.pardon)),(()=>{var l=M(Ie);return m(l,e(k,{get when(){return d()},get fallback(){return e(se,{get executionHandle(){return r.executionHandle},onRequest:()=>{C(a)?.resolution.resolve(void 0)},get inflight(){return f()}})},get children(){return e(V,{get icon(){return(()=>{var p=M(Ue),g=p.firstChild,T=g.nextSibling,[P,v]=x(T.nextSibling);return g.$$click=o,m(g,e(ne,{size:_})),m(p,e(k,{when:i,get children(){var z=M(Ke);return z.$$mousedown=()=>i&&h(E=>!E),m(z,e(k,{get when(){return c()},get fallback(){return e(re,{color:"gray",size:_})},get children(){return e(te,{color:"gray",size:_})}})),F(),z}}),P,v),O(()=>p.classList.toggle("icon-grid-col",!!((d()?.trim()?.split(` +`).length??0)<3))),F(),p})()},get value(){return d()?.trim()},readonly:!0,class:"h-full max-h-48 overflow-y-auto rounded-md bg-emerald-200 p-2 shadow outline-gray-500 dark:bg-lime-800"})}})),l})()}Y(["click","mousedown"]);function Je(r){const[c,h]=w(()=>"confused"),i=y(()=>c()());return j(()=>{r.moodRef?.(i())}),q(()=>({executionHandle:r.executionHandle()}),async({executionHandle:b})=>{const[$,u]=w(C(C(c)));if(h(()=>$),"error"in b)return u(()=>"confuzzled"),{};const{execution:f}=b;await new Promise(t=>requestAnimationFrame(t));const a=f.preview;try{await a}catch{return u("confused"),{}}return u("happy"),{}}),e(ie,{get mood(){return i()},iconSize:_})}const Qe=Me(He,{async fetch(){return Ce(Re())}});var We=R('
'),Xe=R('
'),Ye=R("
");function gr(r){const c=Z(),h=C(c);if("error"in h)throw new Error("invalid initial application context",{cause:h.error});const{values:i,server:b,secrets:$}=r.options,u=i===!0?"":i||"",[f,a]=w(U.parse(u,"object")),[t,n]=w((h.application.example?.request||"").trim()),[s,o]=w({}),d=Ae({context:c,env:f,FetchExecution:b==="products"?Te:Qe,input:t,restart:s}),[l,p]=w();return e(Ve,{secrets:$?$==="shown":void 0,get children(){return e(Oe,{get children(){var g=M(We),T=g.firstChild,[P,v]=x(T.nextSibling),z=P.nextSibling,[E,ue]=x(z.nextSibling),de=E.nextSibling,[J,ge]=x(de.nextSibling),he=J.nextSibling,[Q,me]=x(he.nextSibling),pe=Q.nextSibling,[fe,$e]=x(pe.nextSibling);return m(g,()=>r.children,P,v),m(g,e(k,{get when(){return r.options.values},get children(){return e(V,{get icon(){return(()=>{var S=M(Xe),H=S.firstChild,[A,D]=x(H.nextSibling),N=A.nextSibling,[I,K]=x(N.nextSibling);return m(S,e(Pe,{color:"gray",size:_}),A,D),m(S,e(k,{get when(){return l()},get children(){return e(ze,{color:"gray",size:_})}}),I,K),S})()},class:"rounded-md bg-white p-2 shadow dark:bg-gray-700",value:u,onValueChange:S=>{try{a(U.parse(S,"object")),p(void 0)}catch(H){p(H)}}})}}),E,ue),m(g,e(V,{get icon(){return(()=>{var S=M(Ye),H=S.firstChild,[A,D]=x(H.nextSibling),N=A.nextSibling,[I,K]=x(N.nextSibling);return m(S,e(Ee,{color:"gray",size:_}),A,D),m(S,e(k,{get when(){return r.options.response},get children(){return e(Je,{executionHandle:d})}}),I,K),O(()=>S.classList.toggle("icon-grid-col",(t()?.split(` +`).length??0)<4)),S})()},class:"rounded-md bg-white p-2 shadow dark:bg-gray-700",get value(){return C(t)},onValueChange:n}),J,ge),m(g,e(k,{get when(){return r.options.response},get fallback(){return e(se,{executionHandle:d})},get children(){return e(Ge,{executionHandle:d,reset:()=>o({})})}}),Q,me),m(g,e(k,{get when(){return r.options.data},get children(){return e(Ne,{executionHandle:d})}}),fe,$e),g}})}})}export{gr as default}; diff --git a/_astro/PardonPlaygroundLoader.B5xqmHkS.js b/_astro/PardonPlaygroundLoader.B5xqmHkS.js new file mode 100644 index 00000000..5319aa5b --- /dev/null +++ b/_astro/PardonPlaygroundLoader.B5xqmHkS.js @@ -0,0 +1,3 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_astro/PardonApplication.CGiMqu1Y.js","_astro/web.Djz3GSgY.js","_astro/lexer-CgIEgaNo.BGGAnFgt.js","_astro/pardon-Dbc5z6SD.DxyttN9Z.js","_astro/trial-Df-0_jpB.Cx90g8F9.js","_astro/PardonPlayground.DSofBvNB.js","_astro/CodeMirror.BprfeSgn.js","_astro/index.4VmesigZ.js","_astro/products-server-hook.Duq5ctrJ.js","_astro/api.3y1TnKr0.js","_astro/preload-helper.CaDgunLA.js","_astro/playground-mood.CFJWbv0F.css","_astro/playground-icons.DtPjAd2H.css"])))=>i.map(i=>d[i]); +import{_ as S}from"./preload-helper.CaDgunLA.js";import{c as x,a as y,u as b,b as L,g as d,d as O,i as l,e as n,s as w,f as C,F as R,t as g,h as j,j as E,k as I,S as k,l as T,m as z,n as A}from"./web.Djz3GSgY.js";import{C as K}from"./CodeMirror.BprfeSgn.js";/* empty css */import{T as M}from"./index.4VmesigZ.js";const V=30;var D=g('
'),F=g("