@evandu/super-pi 0.1.111 → 0.1.113

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/.super-pi-check-inputs.json +2 -2
  2. package/dist/client/.super-pi-client-sources.json +8 -7
  3. package/dist/client/assets/{CodeMirrorEditor-CaF1aTpR.js → CodeMirrorEditor-moFTk5SE.js} +2 -2
  4. package/dist/client/assets/{dist-aC6cFQVF.js → dist-BR4s0dNg.js} +1 -1
  5. package/dist/client/assets/{dist-Bl_iPEld.js → dist-BUuPRG15.js} +1 -1
  6. package/dist/client/assets/{dist-CPo4IuhO.js → dist-Bds_PUYK.js} +1 -1
  7. package/dist/client/assets/{dist-BydrWuS9.js → dist-BsO40qxQ.js} +1 -1
  8. package/dist/client/assets/{dist-jDX3NY00.js → dist-CCYnr6ul.js} +1 -1
  9. package/dist/client/assets/{dist-f78PQc3f.js → dist-CL65aMXY.js} +1 -1
  10. package/dist/client/assets/{dist-BjrDHYro.js → dist-D9m04q-s.js} +1 -1
  11. package/dist/client/assets/{dist-o-3gMx5l.js → dist-DIfmMr8s.js} +1 -1
  12. package/dist/client/assets/{dist-CJHSsi_2.js → dist-DPDGd2jl.js} +1 -1
  13. package/dist/client/assets/{dist-C9gmrpfb.js → dist-DPvy57Ph.js} +1 -1
  14. package/dist/client/assets/{dist-CKziNS6e.js → dist-DQjJMys5.js} +1 -1
  15. package/dist/client/assets/{dist-CbkXScEJ.js → dist-Dnr5BxAi.js} +1 -1
  16. package/dist/client/assets/{dist-C2JgfsQ0.js → dist-DrbUrVWB.js} +1 -1
  17. package/dist/client/assets/{dist-BG1mkRxC.js → dist-DuWhzonJ.js} +1 -1
  18. package/dist/client/assets/{dist-DnwnynHW.js → dist-TgNJUr7p.js} +1 -1
  19. package/dist/client/assets/{dist-Bv-QAejS.js → dist-rhPxFuD1.js} +1 -1
  20. package/dist/client/assets/{index-CME3BwBz.js → index-BixdV7aQ.js} +23 -23
  21. package/dist/client/assets/index-CGXMw9LP.css +1 -0
  22. package/dist/client/index.html +2 -2
  23. package/dist/server/application/run-service.d.ts +7 -0
  24. package/dist/server/application/run-service.js +16 -0
  25. package/dist/server/file-name-index.d.ts +144 -0
  26. package/dist/server/file-name-index.js +324 -0
  27. package/dist/server/http-server.js +112 -3
  28. package/dist/server/index.js +10 -0
  29. package/dist/server/server-context.d.ts +9 -0
  30. package/dist/server/skills.d.ts +23 -0
  31. package/dist/server/skills.js +171 -0
  32. package/dist/server/types.d.ts +7 -0
  33. package/package.json +3 -1
  34. package/scripts/patch-brace-expansion.mjs +1 -1
  35. package/dist/client/assets/index-CauO59H-.css +0 -1
@@ -1,2 +1,2 @@
1
- import{i as e}from"./index-CME3BwBz.js";var t=1024,n=0,r=class{constructor(e,t){this.from=e,this.to=t}},i=class{constructor(e={}){this.id=n++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw Error(`This node type doesn't define a deserialize function`)}),this.combine=e.combine||null}add(e){if(this.perNode)throw RangeError(`Can't add per-node props to node types`);return typeof e!=`function`&&(e=s.match(e)),t=>{let n=e(t);return n===void 0?null:[this,n]}}};i.closedBy=new i({deserialize:e=>e.split(` `)}),i.openedBy=new i({deserialize:e=>e.split(` `)}),i.group=new i({deserialize:e=>e.split(` `)}),i.isolate=new i({deserialize:e=>{if(e&&e!=`rtl`&&e!=`ltr`&&e!=`auto`)throw RangeError(`Invalid value for isolate: `+e);return e||`auto`}}),i.contextHash=new i({perNode:!0}),i.lookAhead=new i({perNode:!0}),i.mounted=new i({perNode:!0});var a=class{constructor(e,t,n,r=!1){this.tree=e,this.overlay=t,this.parser=n,this.bracketed=r}static get(e){return e&&e.props&&e.props[i.mounted.id]}},o=Object.create(null),s=class e{constructor(e,t,n,r=0){this.name=e,this.props=t,this.id=n,this.flags=r}static define(t){let n=t.props&&t.props.length?Object.create(null):o,r=+!!t.top|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),i=new e(t.name||``,n,t.id,r);if(t.props){for(let e of t.props)if(Array.isArray(e)||(e=e(i)),e){if(e[0].perNode)throw RangeError(`Can't store a per-node prop on a node type`);n[e[0].id]=e[1]}}return i}prop(e){return this.props[e.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(e){if(typeof e==`string`){if(this.name==e)return!0;let t=this.prop(i.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let r of n.split(` `))t[r]=e[n];return e=>{for(let n=e.prop(i.group),r=-1;r<(n?n.length:0);r++){let i=t[r<0?e.name:n[r]];if(i)return i}}}};s.none=new s(``,Object.create(null),0,8);var c=class e{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw RangeError(`Node type ids should correspond to array positions when creating a node set`)}extend(...t){let n=[];for(let e of this.types){let r=null;for(let n of t){let t=n(e);if(t){r||=Object.assign({},e.props);let n=t[1],i=t[0];i.combine&&i.id in r&&(n=i.combine(r[i.id],n)),r[i.id]=n}}n.push(r?new s(e.name,r,e.id,e.flags):e)}return new e(n)}},l=new WeakMap,u=new WeakMap,d;(function(e){e[e.ExcludeBuffers=1]=`ExcludeBuffers`,e[e.IncludeAnonymous=2]=`IncludeAnonymous`,e[e.IgnoreMounts=4]=`IgnoreMounts`,e[e.IgnoreOverlays=8]=`IgnoreOverlays`,e[e.EnterBracketed=16]=`EnterBracketed`})(d||={});var f=class e{constructor(e,t,n,r,i){if(this.type=e,this.children=t,this.positions=n,this.length=r,this.props=null,i&&i.length){this.props=Object.create(null);for(let[e,t]of i)this.props[typeof e==`number`?e:e.id]=t}}toString(){let e=a.get(this);if(e&&!e.overlay)return e.tree.toString();let t=``;for(let e of this.children){let n=e.toString();n&&(t&&(t+=`,`),t+=n)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?`(`+t+`)`:``):t}cursor(e=0){return new E(this.topNode,e)}cursorAt(e,t=0,n=0){let r=new E(l.get(this)||this.topNode);return r.moveTo(e,t),l.set(this,r._tree),r}get topNode(){return new v(this,0,0,null)}resolve(e,t=0){let n=g(l.get(this)||this.topNode,e,t,!1);return l.set(this,n),n}resolveInner(e,t=0){let n=g(u.get(this)||this.topNode,e,t,!0);return u.set(this,n),n}resolveStack(e,t=0){return T(this,e,t)}iterate(e){let{enter:t,leave:n,from:r=0,to:i=this.length}=e,a=e.mode||0,o=(a&d.IncludeAnonymous)>0;for(let e=this.cursor(a|d.IncludeAnonymous);;){let a=!1;if(e.from<=i&&e.to>=r&&(!o&&e.type.isAnonymous||t(e)!==!1)){if(e.firstChild())continue;a=!0}for(;a&&n&&(o||!e.type.isAnonymous)&&n(e),!e.nextSibling();){if(!e.parent())return;a=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(t={}){return this.children.length<=8?this:j(s.none,this.children,this.positions,0,this.children.length,0,this.length,(t,n,r)=>new e(this.type,t,n,r,this.propValues),t.makeTree||((t,n,r)=>new e(s.none,t,n,r)))}static build(e){return O(e)}};f.empty=new f(s.none,[],[],0);var p=class e{constructor(e,t){this.buffer=e,this.index=t}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 e(this.buffer,this.index)}},m=class e{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return s.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(`,`)}childString(e){let t=this.buffer[e],n=this.buffer[e+3],r=this.set.types[t],i=r.name;if(/\W/.test(i)&&!r.isError&&(i=JSON.stringify(i)),e+=4,n==e)return i;let a=[];for(;e<n;)a.push(this.childString(e)),e=this.buffer[e+3];return i+`(`+a.join(`,`)+`)`}findChild(e,t,n,r,i){let{buffer:a}=this,o=-1;for(let s=e;s!=t&&!(h(i,r,a[s+1],a[s+2])&&(o=s,n>0));s=a[s+3]);return o}slice(t,n,r){let i=this.buffer,a=new Uint16Array(n-t),o=0;for(let e=t,s=0;e<n;){a[s++]=i[e++],a[s++]=i[e++]-r;let n=a[s++]=i[e++]-r;a[s++]=i[e++]-t,o=Math.max(o,n)}return new e(a,o,this.set)}};function h(e,t,n,r){switch(e){case-2:return n<t;case-1:return r>=t&&n<t;case 0:return n<t&&r>t;case 1:return n<=t&&r>t;case 2:return r>t;case 4:return!0}}function g(e,t,n,r){for(;e.from==e.to||(n<1?e.from>=t:e.from>t)||(n>-1?e.to<=t:e.to<t);){let t=!r&&e instanceof v&&e.index<0?null:e.parent;if(!t)return e;e=t}let i=r?0:d.IgnoreOverlays;if(r)for(let r=e,a=r.parent;a;r=a,a=r.parent)r instanceof v&&r.index<0&&a.enter(t,n,i)?.from!=r.from&&(e=a);for(;;){let r=e.enter(t,n,i);if(!r)return e;e=r}}var _=class{cursor(e=0){return new E(this,e)}getChild(e,t=null,n=null){let r=y(this,e,t,n);return r.length?r[0]:null}getChildren(e,t=null,n=null){return y(this,e,t,n)}resolve(e,t=0){return g(this,e,t,!1)}resolveInner(e,t=0){return g(this,e,t,!0)}matchContext(e){return b(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),n=this;for(;t;){let e=t.lastChild;if(!e||e.to!=t.to)break;e.type.isError&&e.from==e.to?(n=t,t=e.prevSibling):t=e}return n}get node(){return this}get next(){return this.parent}},v=class e extends _{constructor(e,t,n,r){super(),this._tree=e,this.from=t,this.index=n,this._parent=r}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(t,n,r,i,o=0){for(let s=this;;){for(let{children:c,positions:l}=s._tree,u=n>0?c.length:-1;t!=u;t+=n){let u=c[t],p=l[t]+s.from,g;if(o&d.EnterBracketed&&u instanceof f&&(g=a.get(u))&&!g.overlay&&g.bracketed&&r>=p&&r<=p+u.length||h(i,r,p,p+u.length)){if(u instanceof m){if(o&d.ExcludeBuffers)continue;let e=u.findChild(0,u.buffer.length,n,r-p,i);if(e>-1)return new S(new x(s,u,t,p),null,e)}else if(o&d.IncludeAnonymous||!u.type.isAnonymous||D(u)){let c;if(!(o&d.IgnoreMounts)&&(c=a.get(u))&&!c.overlay)return new e(c.tree,p,t,s);let l=new e(u,p,t,s);return o&d.IncludeAnonymous||!l.type.isAnonymous?l:l.nextChild(n<0?u.children.length-1:0,n,r,i,o)}}}if(o&d.IncludeAnonymous||!s.type.isAnonymous||(t=s.index>=0?s.index+n:n<0?-1:s._parent._tree.children.length,s=s._parent,!s))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(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(t,n,r=0){let i;if(!(r&d.IgnoreOverlays)&&(i=a.get(this._tree))&&i.overlay){let a=t-this.from,o=r&d.EnterBracketed&&i.bracketed;for(let{from:t,to:r}of i.overlay)if((n>0||o?t<=a:t<a)&&(n<0||o?r>=a:r>a))return new e(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,n,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}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 y(e,t,n,r){let i=e.cursor(),a=[];if(!i.firstChild())return a;if(n!=null){for(let e=!1;!e;)if(e=i.type.is(n),!i.nextSibling())return a}for(;;){if(r!=null&&i.type.is(r))return a;if(i.type.is(t)&&a.push(i.node),!i.nextSibling())return r==null?a:[]}}function b(e,t,n=t.length-1){for(let r=e;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(t[n]&&t[n]!=r.name)return!1;n--}}return!0}var x=class{constructor(e,t,n,r){this.parent=e,this.buffer=t,this.index=n,this.start=r}},S=class e extends _{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(e,t,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(t,n,r){let{buffer:i}=this.context,a=i.findChild(this.index+4,i.buffer[this.index+3],t,n-this.context.start,r);return a<0?null:new e(this.context,this,a)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(t,n,r=0){if(r&d.ExcludeBuffers)return null;let{buffer:i}=this.context,a=i.findChild(this.index+4,i.buffer[this.index+3],n>0?1:-1,t-this.context.start,n);return a<0?null:new e(this.context,this,a)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:t}=this.context,n=t.buffer[this.index+3];return n<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new e(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new e(this.context,this._parent,t.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,r=this.index+4,i=n.buffer[this.index+3];if(i>r){let a=n.buffer[this.index+1];e.push(n.slice(r,i,a)),t.push(0)}return new f(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}};function C(e){if(!e.length)return null;let t=0,n=e[0];for(let r=1;r<e.length;r++){let i=e[r];(i.from>n.from||i.to<n.to)&&(n=i,t=r)}let r=n instanceof v&&n.index<0?null:n.parent,i=e.slice();return r?i[t]=r:i.splice(t,1),new w(i,n)}var w=class{constructor(e,t){this.heads=e,this.node=t}get next(){return C(this.heads)}};function T(e,t,n){let r=e.resolveInner(t,n),i=null;for(let e=r instanceof v?r:r.context.parent;e;e=e.parent)if(e.index<0){let a=e.parent;(i||=[r]).push(a.resolve(t,n)),e=a}else{let o=a.get(e.tree);if(o&&o.overlay&&o.overlay[0].from<=t&&o.overlay[o.overlay.length-1].to>=t){let a=new v(o.tree,o.overlay[0].from+e.from,-1,e);(i||=[r]).push(g(a,t,n,!1))}}return i?C(i):r}var E=class{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~d.EnterBracketed,e instanceof v)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let t=e._parent;t;t=t._parent)this.stack.unshift(t.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:n,buffer:r}=this.buffer;return this.type=t||r.set.types[r.buffer[e]],this.from=n+r.buffer[e+1],this.to=n+r.buffer[e+2],!0}yield(e){return e?e instanceof v?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:r}=this.buffer,i=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.buffer.start,n);return i<0?!1:(this.stack.push(this.index),this.yieldBuf(i))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,n=this.mode){return this.buffer?n&d.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&d.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&d.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,n=this.stack.length-1;if(e<0){let e=n<0?0:this.stack[n]+4;if(this.index!=e)return this.yieldBuf(t.findChild(e,this.index,-1,0,4))}else{let e=t.buffer[this.index+3];if(e<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(e)}return n<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode))}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,n,{buffer:r}=this;if(r){if(e>0){if(this.index<r.buffer.buffer.length)return!1}else for(let e=0;e<this.index;e++)if(r.buffer.buffer[e+3]<this.index)return!1;({index:t,parent:n}=r)}else({index:t,_parent:n}=this._tree);for(;n;{index:t,_parent:n}=n)if(t>-1)for(let r=t+e,i=e<0?-1:n._tree.children.length;r!=i;r+=e){let e=n._tree.children[r];if(this.mode&d.IncludeAnonymous||e instanceof m||!e.type.isAnonymous||D(e))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,n=0;if(e&&e.context==this.buffer)scan:for(let r=this.index,i=this.stack.length;i>=0;){for(let a=e;a;a=a._parent)if(a.index==r){if(r==this.index)return a;t=a,n=i+1;break scan}r=this.stack[--i]}for(let e=n;e<this.stack.length;e++)t=new S(this.buffer,t,this.stack[e]);return this.bufferNode=new S(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let n=0;;){let r=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){n++;continue}this.type.isAnonymous||(r=!0)}for(;;){if(r&&t&&t(this),r=this.type.isAnonymous,!n)return;if(this.nextSibling())break;this.parent(),n--,r=!0}}}matchContext(e){if(!this.buffer)return b(this.node.parent,e);let{buffer:t}=this.buffer,{types:n}=t.set;for(let r=e.length-1,i=this.stack.length-1;r>=0;i--){if(i<0)return b(this._tree,e,r);let a=n[t.buffer[this.stack[i]]];if(!a.isAnonymous){if(e[r]&&e[r]!=a.name)return!1;r--}}return!0}};function D(e){return e.children.some(e=>e instanceof m||!e.type.isAnonymous||D(e))}function O(e){let{buffer:n,nodeSet:r,maxBufferLength:a=t,reused:o=[],minRepeatType:s=r.types.length}=e,c=Array.isArray(n)?new p(n,n.length):n,l=r.types,u=0,d=0;function h(e,t,n,i,f,p){let{id:S,start:C,end:w,size:T}=c,E=d,D=u;if(T<0){if(c.next(),T==-1){let t=o[S];n.push(t),i.push(C-e);return}if(T==-3){u=S;return}if(T==-4){d=S;return}throw RangeError(`Unrecognized record size: ${T}`)}let O=l[S],k,A,M=C-e;if(w-C<=a&&(A=b(c.pos-t,f))){let t=new Uint16Array(A.size-A.skip),n=c.pos-A.size,i=t.length;for(;c.pos>n;)i=x(A.start,t,i);k=new m(t,w-A.start,r),M=A.start-e}else{let e=c.pos-T;c.next();let t=[],n=[],r=S>=s?S:-1,i=0,o=w,l=E;for(;c.pos>e;)r>=0&&c.id==r&&c.size>=0?(c.end<=o-a&&(v(t,n,C,i,c.end,o,r,l,D),i=t.length,o=c.end,l=d),c.next()):p>2500?g(C,e,t,n):h(C,e,t,n,r,p+1);if(r>=0&&i>0&&i<t.length&&v(t,n,C,i,C,o,r,l,D),t.reverse(),n.reverse(),r>-1&&i>0){let e=_(O,D);k=j(O,t,n,0,t.length,0,w-C,e,e)}else k=y(O,t,n,w-C,E-w,D)}n.push(k),i.push(M)}function g(e,t,n,i){let o=[],s=0,l=-1;for(;c.pos>t;){let{id:e,start:t,end:n,size:r}=c;if(r>4)c.next();else if(l>-1&&t<l)break;else l<0&&(l=n-a),o.push(e,t,n),s++,c.next()}if(s){let t=new Uint16Array(s*4),a=o[o.length-2];for(let e=o.length-3,n=0;e>=0;e-=3)t[n++]=o[e],t[n++]=o[e+1]-a,t[n++]=o[e+2]-a,t[n++]=n;n.push(new m(t,o[2]-a,r)),i.push(a-e)}}function _(e,t){return(n,r,a)=>{let o=0,s=n.length-1,c,l;if(s>=0&&(c=n[s])instanceof f){if(!s&&c.type==e&&c.length==a)return c;(l=c.prop(i.lookAhead))&&(o=r[s]+c.length+l-a)}return y(e,n,r,a,o,t)}}function v(e,t,n,i,a,o,s,c,l){let u=[],d=[];for(;e.length>i;)u.push(e.pop()),d.push(t.pop()+n-a);e.push(y(r.types[s],u,d,o-a,c-o,l)),t.push(a-n)}function y(e,t,n,r,a,o,s){if(o){let e=[i.contextHash,o];s=s?[e].concat(s):[e]}if(a>25){let e=[i.lookAhead,a];s=s?[e].concat(s):[e]}return new f(e,t,n,r,s)}function b(e,t){let n=c.fork(),r=0,i=0,o=0,l=n.end-a,u={size:0,start:0,skip:0};scan:for(let a=n.pos-e;n.pos>a;){let e=n.size;if(n.id==t&&e>=0){u.size=r,u.start=i,u.skip=o,o+=4,r+=4,n.next();continue}let c=n.pos-e;if(e<0||c<a||n.start<l)break;let d=n.id>=s?4:0,f=n.start;for(n.next();n.pos>c;){if(n.size<0){if(n.size==-3||n.size==-4)d+=4;else break scan}else n.id>=s&&(d+=4);n.next()}i=f,r+=e,o+=d}return(t<0||r==e)&&(u.size=r,u.start=i,u.skip=o),u.size>4?u:void 0}function x(e,t,n){let{id:r,start:i,end:a,size:o}=c;if(c.next(),o>=0&&r<s){let s=n;if(o>4){let r=c.pos-(o-4);for(;c.pos>r;)n=x(e,t,n)}t[--n]=s,t[--n]=a-e,t[--n]=i-e,t[--n]=r}else o==-3?u=r:o==-4&&(d=r);return n}let S=[],C=[];for(;c.pos>0;)h(e.start||0,e.bufferStart||0,S,C,-1,0);let w=e.length??(S.length?C[0]+S[0].length:0);return new f(l[e.topID],S.reverse(),C.reverse(),w)}var k=new WeakMap;function A(e,t){if(!e.isAnonymous||t instanceof m||t.type!=e)return 1;let n=k.get(t);if(n==null){n=1;for(let r of t.children){if(r.type!=e||!(r instanceof f)){n=1;break}n+=A(e,r)}k.set(t,n)}return n}function j(e,t,n,r,i,a,o,s,c){let l=0;for(let n=r;n<i;n++)l+=A(e,t[n]);let u=Math.ceil(l*1.5/8),d=[],f=[];function p(t,n,r,i,o){for(let s=r;s<i;){let r=s,l=n[s],m=A(e,t[s]);for(s++;s<i;s++){let n=A(e,t[s]);if(m+n>=u)break;m+=n}if(s==r+1){if(m>u){let e=t[r];p(e.children,e.positions,0,e.children.length,n[r]+o);continue}d.push(t[r])}else{let i=n[s-1]+t[s-1].length-l;d.push(j(e,t,n,r,s,l,i,null,c))}f.push(l+o-a)}}return p(t,n,r,i,0),(s||c)(d,f,o)}var M=class{constructor(){this.map=new WeakMap}setBuffer(e,t,n){let r=this.map.get(e);r||this.map.set(e,r=new Map),r.set(t,n)}getBuffer(e,t){let n=this.map.get(e);return n&&n.get(t)}set(e,t){e instanceof S?this.setBuffer(e.context.buffer,e.index,t):e instanceof v&&this.map.set(e.tree,t)}get(e){return e instanceof S?this.getBuffer(e.context.buffer,e.index):e instanceof v?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}},N=class e{constructor(e,t,n,r,i=!1,a=!1){this.from=e,this.to=t,this.tree=n,this.offset=r,this.open=!!i|(a?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(t,n=[],r=!1){let i=[new e(0,t.length,t,0,!1,r)];for(let e of n)e.to>t.length&&i.push(e);return i}static applyChanges(t,n,r=128){if(!n.length)return t;let i=[],a=1,o=t.length?t[0]:null;for(let s=0,c=0,l=0;;s++){let u=s<n.length?n[s]:null,d=u?u.fromA:1e9;if(d-c>=r)for(;o&&o.from<d;){let n=o;if(c>=n.from||d<=n.to||l){let t=Math.max(n.from,c)-l,r=Math.min(n.to,d)-l;n=t>=r?null:new e(t,r,n.tree,n.offset+l,s>0,!!u)}if(n&&i.push(n),o.to>d)break;o=a<t.length?t[a++]:null}if(!u)break;c=u.toA,l=u.toA-u.toB}return i}},ee=class{startParse(e,t,n){return typeof e==`string`&&(e=new te(e)),n=n?n.length?n.map(e=>new r(e.from,e.to)):[new r(0,0)]:[new r(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let r=this.startParse(e,t,n);for(;;){let e=r.advance();if(e)return e}}},te=class{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}};function ne(e){return(t,n,r,i)=>new oe(t,e,n,r,i)}var re=class{constructor(e,t,n,r,i,a){this.parser=e,this.parse=t,this.overlay=n,this.bracketed=r,this.target=i,this.from=a}};function ie(e){if(!e.length||e.some(e=>e.from>=e.to))throw RangeError(`Invalid inner parse ranges given: `+JSON.stringify(e))}var ae=class{constructor(e,t,n,r,i,a,o,s){this.parser=e,this.predicate=t,this.mounts=n,this.index=r,this.start=i,this.bracketed=a,this.target=o,this.prev=s,this.depth=0,this.ranges=[]}},P=new i({perNode:!0}),oe=class{constructor(e,t,n,r,i){this.nest=t,this.input=n,this.fragments=r,this.ranges=i,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let e=this.baseParse.advance();if(!e)return null;if(this.baseParse=null,this.baseTree=e,this.startInner(),this.stoppedAt!=null)for(let e of this.inner)e.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let e=this.baseTree;return this.stoppedAt!=null&&(e=new f(e.type,e.children,e.positions,e.length,e.propValues.concat([[P,this.stoppedAt]]))),e}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let n=Object.assign(Object.create(null),e.target.props);n[i.mounted.id]=new a(t,e.overlay,e.parser,e.bracketed),e.target.props=n}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].from<e&&(e=Math.min(e,this.inner[t].parse.parsedPos));return e}stopAt(e){if(this.stoppedAt=e,this.baseParse)this.baseParse.stopAt(e);else for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].parse.stopAt(e)}startInner(){let e=new de(this.fragments),t=null,n=null,i=new E(new v(this.baseTree,this.ranges[0].from,0,null),d.IncludeAnonymous|d.IgnoreMounts);scan:for(let a,o;;){let s=!0,c;if(this.stoppedAt!=null&&i.from>=this.stoppedAt)s=!1;else if(e.hasNode(i)){if(t){let e=t.mounts.find(e=>e.frag.from<=i.from&&e.frag.to>=i.to&&e.mount.overlay);if(e)for(let n of e.mount.overlay){let r=n.from+e.pos,a=n.to+e.pos;r>=i.from&&a<=i.to&&!t.ranges.some(e=>e.from<a&&e.to>r)&&t.ranges.push({from:r,to:a})}}s=!1}else if(n&&(o=se(n.ranges,i.from,i.to)))s=o!=2;else if(!i.type.isAnonymous&&(a=this.nest(i,this.input))&&(i.from<i.to||!a.overlay)){i.tree||(le(i),t&&t.depth++,n&&n.depth++);let o=e.findMounts(i.from,a.parser);if(typeof a.overlay==`function`)t=new ae(a.parser,a.overlay,o,this.inner.length,i.from,!!a.bracketed,i.tree,t);else{let e=fe(this.ranges,a.overlay||(i.from<i.to?[new r(i.from,i.to)]:[]));e.length&&ie(e),(e.length||!a.overlay)&&this.inner.push(new re(a.parser,e.length?a.parser.startParse(this.input,me(o,e),e):a.parser.startParse(``),a.overlay?a.overlay.map(e=>new r(e.from-i.from,e.to-i.from)):null,!!a.bracketed,i.tree,e.length?e[0].from:i.from)),a.overlay?e.length&&(n={ranges:e,depth:0,prev:n}):s=!1}}else if(t&&(c=t.predicate(i))&&(c===!0&&(c=new r(i.from,i.to)),c.from<c.to)){let e=t.ranges.length-1;e>=0&&t.ranges[e].to==c.from?t.ranges[e]={from:t.ranges[e].from,to:c.to}:t.ranges.push(c)}if(s&&i.firstChild())t&&t.depth++,n&&n.depth++;else for(;!i.nextSibling();){if(!i.parent())break scan;if(t&&!--t.depth){let e=fe(this.ranges,t.ranges);e.length&&(ie(e),this.inner.splice(t.index,0,new re(t.parser,t.parser.startParse(this.input,me(t.mounts,e),e),t.ranges.map(e=>new r(e.from-t.start,e.to-t.start)),t.bracketed,t.target,e[0].from))),t=t.prev}n&&!--n.depth&&(n=n.prev)}}}};function se(e,t,n){for(let r of e){if(r.from>=n)break;if(r.to>t)return r.from<=t&&r.to>=n?2:1}return 0}function ce(e,t,n,r,i,a){if(t<n){let o=e.buffer[t+1];r.push(e.slice(t,n,o)),i.push(o-a)}}function le(e){let{node:t}=e,n=[],r=t.context.buffer;do n.push(e.index),e.parent();while(!e.tree);let i=e.tree,a=i.children.indexOf(r),o=i.children[a],c=o.buffer,l=[a];function u(e,r,i,a,s,d){let p=n[d],m=[],h=[];ce(o,e,p,m,h,a);let g=c[p+1],_=c[p+2];l.push(m.length);let v=d?u(p+4,c[p+3],o.set.types[c[p]],g,_-g,d-1):t.toTree();return m.push(v),h.push(g-a),ce(o,c[p+3],r,m,h,a),new f(i,m,h,s)}i.children[a]=u(0,c.length,s.none,0,o.length,n.length-1);for(let t of l){let n=e.tree.children[t],r=e.tree.positions[t];e.yield(new v(n,r+e.from,t,e._tree))}}var ue=class{constructor(e,t){this.offset=t,this.done=!1,this.cursor=e.cursor(d.IncludeAnonymous|d.IgnoreMounts|d.ExcludeBuffers)}moveTo(e){let{cursor:t}=this,n=e-this.offset;for(;!this.done&&t.from<n;)if(!(t.to>=n&&t.enter(n,1,d.IncludeAnonymous|d.IgnoreOverlays|d.ExcludeBuffers))){if(t.to<=n)t.next(!1)||(this.done=!0);else break}}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let t=this.cursor.tree;;){if(t==e.tree)return!0;if(t.children.length&&t.positions[0]==0&&t.children[0]instanceof f)t=t.children[0];else break}return!1}},de=class{constructor(e){if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let t=this.curFrag=e[0];this.curTo=t.tree.prop(P)??t.to,this.inner=new ue(t.tree,-t.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let e=this.curFrag=this.fragments[this.fragI];this.curTo=e.tree.prop(P)??e.to,this.inner=new ue(e.tree,-e.offset)}}findMounts(e,t){let n=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let e=this.inner.cursor.node;e;e=e.parent){let r=e.tree?.prop(i.mounted);if(r&&r.parser==t)for(let t=this.fragI;t<this.fragments.length;t++){let i=this.fragments[t];if(i.from>=e.to)break;i.tree==this.curFrag.tree&&n.push({frag:i,pos:e.from-i.offset,mount:r})}}}return n}};function fe(e,t){let n=null,i=t;for(let a=1,o=0;a<e.length;a++){let s=e[a-1].to,c=e[a].from;for(;o<i.length;o++){let e=i[o];if(e.from>=c)break;e.to<=s||(n||(i=n=t.slice()),e.from<s?(n[o]=new r(e.from,s),e.to>c&&n.splice(o+1,0,new r(c,e.to))):e.to>c?n[o--]=new r(c,e.to):n.splice(o--,1))}}return i}function pe(e,t,n,i){let a=0,o=0,s=!1,c=!1,l=-1e9,u=[];for(;;){let d=a==e.length?1e9:s?e[a].to:e[a].from,f=o==t.length?1e9:c?t[o].to:t[o].from;if(s!=c){let e=Math.max(l,n),t=Math.min(d,f,i);e<t&&u.push(new r(e,t))}if(l=Math.min(d,f),l==1e9)break;d==l&&(s?(s=!1,a++):s=!0),f==l&&(c?(c=!1,o++):c=!0)}return u}function me(e,t){let n=[];for(let{pos:i,mount:a,frag:o}of e){let e=i+(a.overlay?a.overlay[0].from:0),s=e+a.tree.length,c=Math.max(o.from,e),l=Math.min(o.to,s);if(a.overlay){let s=pe(t,a.overlay.map(e=>new r(e.from+i,e.to+i)),c,l);for(let t=0,r=c;;t++){let i=t==s.length,c=i?l:s[t].from;if(c>r&&n.push(new N(r,c,a.tree,-e,o.from>=r||o.openStart,o.to<=c||o.openEnd)),i)break;r=s[t].to}}else n.push(new N(c,l,a.tree,-e,o.from>=e||o.openStart,o.to<=s||o.openEnd))}return n}var he=e({Tag:()=>F,classHighlighter:()=>Oe,getStyleTags:()=>Te,highlightCode:()=>Ce,highlightTree:()=>z,styleTags:()=>I,tagHighlighter:()=>R,tags:()=>$}),ge=0,F=class e{constructor(e,t,n,r){this.name=e,this.set=t,this.base=n,this.modified=r,this.id=ge++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(t,n){let r=typeof t==`string`?t:`?`;if(t instanceof e&&(n=t),n?.base)throw Error(`Can not derive from a modified tag`);let i=new e(r,[],null,[]);if(i.set.push(i),n)for(let e of n.set)i.set.push(e);return i}static defineModifier(e){let t=new ve(e);return e=>e.modified.indexOf(t)>-1?e:ve.get(e.base||e,e.modified.concat(t).sort((e,t)=>e.id-t.id))}},_e=0,ve=class e{constructor(e){this.name=e,this.instances=[],this.id=_e++}static get(t,n){if(!n.length)return t;let r=n[0].instances.find(e=>e.base==t&&ye(n,e.modified));if(r)return r;let i=[],a=new F(t.name,i,t,n);for(let e of n)e.instances.push(a);let o=be(n);for(let n of t.set)if(!n.modified.length)for(let t of o)i.push(e.get(n,t));return a}};function ye(e,t){return e.length==t.length&&e.every((e,n)=>e==t[n])}function be(e){let t=[[]];for(let n=0;n<e.length;n++)for(let r=0,i=t.length;r<i;r++)t.push(t[r].concat(e[n]));return t.sort((e,t)=>t.length-e.length)}function I(e){let t=Object.create(null);for(let n in e){let r=e[n];Array.isArray(r)||(r=[r]);for(let e of n.split(` `))if(e){let n=[],i=2,a=e;for(let t=0;;){if(a==`...`&&t>0&&t+3==e.length){i=1;break}let r=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!r)throw RangeError(`Invalid path: `+e);if(n.push(r[0]==`*`?``:r[0][0]==`"`?JSON.parse(r[0]):r[0]),t+=r[0].length,t==e.length)break;let o=e[t++];if(t==e.length&&o==`!`){i=0;break}if(o!=`/`)throw RangeError(`Invalid path: `+e);a=e.slice(t)}let o=n.length-1,s=n[o];if(!s)throw RangeError(`Invalid path: `+e);t[s]=new L(r,i,o>0?n.slice(0,o):null).sort(t[s])}}return xe.add(t)}var xe=new i({combine(e,t){let n,r,i;for(;e||t;){if(!e||t&&e.depth<=t.depth?(i=t,t=t.next):(i=e,e=e.next),n&&n.mode==i.mode&&!i.context&&!n.context)continue;let a=new L(i.tags,i.mode,i.context);n?n.next=a:r=a,n=a}return r}}),L=class{constructor(e,t,n,r){this.tags=e,this.mode=t,this.context=n,this.next=r}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}};L.empty=new L([],2,null);function R(e,t){let n=Object.create(null);for(let t of e)if(!Array.isArray(t.tag))n[t.tag.id]=t.class;else for(let e of t.tag)n[e.id]=t.class;let{scope:r,all:i=null}=t||{};return{style:e=>{let t=i;for(let r of e)for(let e of r.set){let r=n[e.id];if(r){t=t?t+` `+r:r;break}}return t},scope:r}}function Se(e,t){let n=null;for(let r of e){let e=r.style(t);e&&(n=n?n+` `+e:e)}return n}function z(e,t,n,r=0,i=e.length){let a=new we(r,Array.isArray(t)?t:[t],n);a.highlightRange(e.cursor(),r,i,``,a.highlighters),a.flush(i)}function Ce(e,t,n,r,i,a=0,o=e.length){let s=a;function c(t,n){if(!(t<=s)){for(let a=e.slice(s,t),o=0;;){let e=a.indexOf(`
1
+ import{i as e}from"./index-BixdV7aQ.js";var t=1024,n=0,r=class{constructor(e,t){this.from=e,this.to=t}},i=class{constructor(e={}){this.id=n++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw Error(`This node type doesn't define a deserialize function`)}),this.combine=e.combine||null}add(e){if(this.perNode)throw RangeError(`Can't add per-node props to node types`);return typeof e!=`function`&&(e=s.match(e)),t=>{let n=e(t);return n===void 0?null:[this,n]}}};i.closedBy=new i({deserialize:e=>e.split(` `)}),i.openedBy=new i({deserialize:e=>e.split(` `)}),i.group=new i({deserialize:e=>e.split(` `)}),i.isolate=new i({deserialize:e=>{if(e&&e!=`rtl`&&e!=`ltr`&&e!=`auto`)throw RangeError(`Invalid value for isolate: `+e);return e||`auto`}}),i.contextHash=new i({perNode:!0}),i.lookAhead=new i({perNode:!0}),i.mounted=new i({perNode:!0});var a=class{constructor(e,t,n,r=!1){this.tree=e,this.overlay=t,this.parser=n,this.bracketed=r}static get(e){return e&&e.props&&e.props[i.mounted.id]}},o=Object.create(null),s=class e{constructor(e,t,n,r=0){this.name=e,this.props=t,this.id=n,this.flags=r}static define(t){let n=t.props&&t.props.length?Object.create(null):o,r=+!!t.top|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),i=new e(t.name||``,n,t.id,r);if(t.props){for(let e of t.props)if(Array.isArray(e)||(e=e(i)),e){if(e[0].perNode)throw RangeError(`Can't store a per-node prop on a node type`);n[e[0].id]=e[1]}}return i}prop(e){return this.props[e.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(e){if(typeof e==`string`){if(this.name==e)return!0;let t=this.prop(i.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let r of n.split(` `))t[r]=e[n];return e=>{for(let n=e.prop(i.group),r=-1;r<(n?n.length:0);r++){let i=t[r<0?e.name:n[r]];if(i)return i}}}};s.none=new s(``,Object.create(null),0,8);var c=class e{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw RangeError(`Node type ids should correspond to array positions when creating a node set`)}extend(...t){let n=[];for(let e of this.types){let r=null;for(let n of t){let t=n(e);if(t){r||=Object.assign({},e.props);let n=t[1],i=t[0];i.combine&&i.id in r&&(n=i.combine(r[i.id],n)),r[i.id]=n}}n.push(r?new s(e.name,r,e.id,e.flags):e)}return new e(n)}},l=new WeakMap,u=new WeakMap,d;(function(e){e[e.ExcludeBuffers=1]=`ExcludeBuffers`,e[e.IncludeAnonymous=2]=`IncludeAnonymous`,e[e.IgnoreMounts=4]=`IgnoreMounts`,e[e.IgnoreOverlays=8]=`IgnoreOverlays`,e[e.EnterBracketed=16]=`EnterBracketed`})(d||={});var f=class e{constructor(e,t,n,r,i){if(this.type=e,this.children=t,this.positions=n,this.length=r,this.props=null,i&&i.length){this.props=Object.create(null);for(let[e,t]of i)this.props[typeof e==`number`?e:e.id]=t}}toString(){let e=a.get(this);if(e&&!e.overlay)return e.tree.toString();let t=``;for(let e of this.children){let n=e.toString();n&&(t&&(t+=`,`),t+=n)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?`(`+t+`)`:``):t}cursor(e=0){return new E(this.topNode,e)}cursorAt(e,t=0,n=0){let r=new E(l.get(this)||this.topNode);return r.moveTo(e,t),l.set(this,r._tree),r}get topNode(){return new v(this,0,0,null)}resolve(e,t=0){let n=g(l.get(this)||this.topNode,e,t,!1);return l.set(this,n),n}resolveInner(e,t=0){let n=g(u.get(this)||this.topNode,e,t,!0);return u.set(this,n),n}resolveStack(e,t=0){return T(this,e,t)}iterate(e){let{enter:t,leave:n,from:r=0,to:i=this.length}=e,a=e.mode||0,o=(a&d.IncludeAnonymous)>0;for(let e=this.cursor(a|d.IncludeAnonymous);;){let a=!1;if(e.from<=i&&e.to>=r&&(!o&&e.type.isAnonymous||t(e)!==!1)){if(e.firstChild())continue;a=!0}for(;a&&n&&(o||!e.type.isAnonymous)&&n(e),!e.nextSibling();){if(!e.parent())return;a=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(t={}){return this.children.length<=8?this:j(s.none,this.children,this.positions,0,this.children.length,0,this.length,(t,n,r)=>new e(this.type,t,n,r,this.propValues),t.makeTree||((t,n,r)=>new e(s.none,t,n,r)))}static build(e){return O(e)}};f.empty=new f(s.none,[],[],0);var p=class e{constructor(e,t){this.buffer=e,this.index=t}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 e(this.buffer,this.index)}},m=class e{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return s.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(`,`)}childString(e){let t=this.buffer[e],n=this.buffer[e+3],r=this.set.types[t],i=r.name;if(/\W/.test(i)&&!r.isError&&(i=JSON.stringify(i)),e+=4,n==e)return i;let a=[];for(;e<n;)a.push(this.childString(e)),e=this.buffer[e+3];return i+`(`+a.join(`,`)+`)`}findChild(e,t,n,r,i){let{buffer:a}=this,o=-1;for(let s=e;s!=t&&!(h(i,r,a[s+1],a[s+2])&&(o=s,n>0));s=a[s+3]);return o}slice(t,n,r){let i=this.buffer,a=new Uint16Array(n-t),o=0;for(let e=t,s=0;e<n;){a[s++]=i[e++],a[s++]=i[e++]-r;let n=a[s++]=i[e++]-r;a[s++]=i[e++]-t,o=Math.max(o,n)}return new e(a,o,this.set)}};function h(e,t,n,r){switch(e){case-2:return n<t;case-1:return r>=t&&n<t;case 0:return n<t&&r>t;case 1:return n<=t&&r>t;case 2:return r>t;case 4:return!0}}function g(e,t,n,r){for(;e.from==e.to||(n<1?e.from>=t:e.from>t)||(n>-1?e.to<=t:e.to<t);){let t=!r&&e instanceof v&&e.index<0?null:e.parent;if(!t)return e;e=t}let i=r?0:d.IgnoreOverlays;if(r)for(let r=e,a=r.parent;a;r=a,a=r.parent)r instanceof v&&r.index<0&&a.enter(t,n,i)?.from!=r.from&&(e=a);for(;;){let r=e.enter(t,n,i);if(!r)return e;e=r}}var _=class{cursor(e=0){return new E(this,e)}getChild(e,t=null,n=null){let r=y(this,e,t,n);return r.length?r[0]:null}getChildren(e,t=null,n=null){return y(this,e,t,n)}resolve(e,t=0){return g(this,e,t,!1)}resolveInner(e,t=0){return g(this,e,t,!0)}matchContext(e){return b(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),n=this;for(;t;){let e=t.lastChild;if(!e||e.to!=t.to)break;e.type.isError&&e.from==e.to?(n=t,t=e.prevSibling):t=e}return n}get node(){return this}get next(){return this.parent}},v=class e extends _{constructor(e,t,n,r){super(),this._tree=e,this.from=t,this.index=n,this._parent=r}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(t,n,r,i,o=0){for(let s=this;;){for(let{children:c,positions:l}=s._tree,u=n>0?c.length:-1;t!=u;t+=n){let u=c[t],p=l[t]+s.from,g;if(o&d.EnterBracketed&&u instanceof f&&(g=a.get(u))&&!g.overlay&&g.bracketed&&r>=p&&r<=p+u.length||h(i,r,p,p+u.length)){if(u instanceof m){if(o&d.ExcludeBuffers)continue;let e=u.findChild(0,u.buffer.length,n,r-p,i);if(e>-1)return new S(new x(s,u,t,p),null,e)}else if(o&d.IncludeAnonymous||!u.type.isAnonymous||D(u)){let c;if(!(o&d.IgnoreMounts)&&(c=a.get(u))&&!c.overlay)return new e(c.tree,p,t,s);let l=new e(u,p,t,s);return o&d.IncludeAnonymous||!l.type.isAnonymous?l:l.nextChild(n<0?u.children.length-1:0,n,r,i,o)}}}if(o&d.IncludeAnonymous||!s.type.isAnonymous||(t=s.index>=0?s.index+n:n<0?-1:s._parent._tree.children.length,s=s._parent,!s))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(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(t,n,r=0){let i;if(!(r&d.IgnoreOverlays)&&(i=a.get(this._tree))&&i.overlay){let a=t-this.from,o=r&d.EnterBracketed&&i.bracketed;for(let{from:t,to:r}of i.overlay)if((n>0||o?t<=a:t<a)&&(n<0||o?r>=a:r>a))return new e(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,n,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}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 y(e,t,n,r){let i=e.cursor(),a=[];if(!i.firstChild())return a;if(n!=null){for(let e=!1;!e;)if(e=i.type.is(n),!i.nextSibling())return a}for(;;){if(r!=null&&i.type.is(r))return a;if(i.type.is(t)&&a.push(i.node),!i.nextSibling())return r==null?a:[]}}function b(e,t,n=t.length-1){for(let r=e;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(t[n]&&t[n]!=r.name)return!1;n--}}return!0}var x=class{constructor(e,t,n,r){this.parent=e,this.buffer=t,this.index=n,this.start=r}},S=class e extends _{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(e,t,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(t,n,r){let{buffer:i}=this.context,a=i.findChild(this.index+4,i.buffer[this.index+3],t,n-this.context.start,r);return a<0?null:new e(this.context,this,a)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(t,n,r=0){if(r&d.ExcludeBuffers)return null;let{buffer:i}=this.context,a=i.findChild(this.index+4,i.buffer[this.index+3],n>0?1:-1,t-this.context.start,n);return a<0?null:new e(this.context,this,a)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:t}=this.context,n=t.buffer[this.index+3];return n<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new e(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new e(this.context,this._parent,t.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,r=this.index+4,i=n.buffer[this.index+3];if(i>r){let a=n.buffer[this.index+1];e.push(n.slice(r,i,a)),t.push(0)}return new f(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}};function C(e){if(!e.length)return null;let t=0,n=e[0];for(let r=1;r<e.length;r++){let i=e[r];(i.from>n.from||i.to<n.to)&&(n=i,t=r)}let r=n instanceof v&&n.index<0?null:n.parent,i=e.slice();return r?i[t]=r:i.splice(t,1),new w(i,n)}var w=class{constructor(e,t){this.heads=e,this.node=t}get next(){return C(this.heads)}};function T(e,t,n){let r=e.resolveInner(t,n),i=null;for(let e=r instanceof v?r:r.context.parent;e;e=e.parent)if(e.index<0){let a=e.parent;(i||=[r]).push(a.resolve(t,n)),e=a}else{let o=a.get(e.tree);if(o&&o.overlay&&o.overlay[0].from<=t&&o.overlay[o.overlay.length-1].to>=t){let a=new v(o.tree,o.overlay[0].from+e.from,-1,e);(i||=[r]).push(g(a,t,n,!1))}}return i?C(i):r}var E=class{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~d.EnterBracketed,e instanceof v)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let t=e._parent;t;t=t._parent)this.stack.unshift(t.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:n,buffer:r}=this.buffer;return this.type=t||r.set.types[r.buffer[e]],this.from=n+r.buffer[e+1],this.to=n+r.buffer[e+2],!0}yield(e){return e?e instanceof v?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:r}=this.buffer,i=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.buffer.start,n);return i<0?!1:(this.stack.push(this.index),this.yieldBuf(i))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,n=this.mode){return this.buffer?n&d.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&d.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&d.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,n=this.stack.length-1;if(e<0){let e=n<0?0:this.stack[n]+4;if(this.index!=e)return this.yieldBuf(t.findChild(e,this.index,-1,0,4))}else{let e=t.buffer[this.index+3];if(e<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(e)}return n<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode))}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,n,{buffer:r}=this;if(r){if(e>0){if(this.index<r.buffer.buffer.length)return!1}else for(let e=0;e<this.index;e++)if(r.buffer.buffer[e+3]<this.index)return!1;({index:t,parent:n}=r)}else({index:t,_parent:n}=this._tree);for(;n;{index:t,_parent:n}=n)if(t>-1)for(let r=t+e,i=e<0?-1:n._tree.children.length;r!=i;r+=e){let e=n._tree.children[r];if(this.mode&d.IncludeAnonymous||e instanceof m||!e.type.isAnonymous||D(e))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,n=0;if(e&&e.context==this.buffer)scan:for(let r=this.index,i=this.stack.length;i>=0;){for(let a=e;a;a=a._parent)if(a.index==r){if(r==this.index)return a;t=a,n=i+1;break scan}r=this.stack[--i]}for(let e=n;e<this.stack.length;e++)t=new S(this.buffer,t,this.stack[e]);return this.bufferNode=new S(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let n=0;;){let r=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){n++;continue}this.type.isAnonymous||(r=!0)}for(;;){if(r&&t&&t(this),r=this.type.isAnonymous,!n)return;if(this.nextSibling())break;this.parent(),n--,r=!0}}}matchContext(e){if(!this.buffer)return b(this.node.parent,e);let{buffer:t}=this.buffer,{types:n}=t.set;for(let r=e.length-1,i=this.stack.length-1;r>=0;i--){if(i<0)return b(this._tree,e,r);let a=n[t.buffer[this.stack[i]]];if(!a.isAnonymous){if(e[r]&&e[r]!=a.name)return!1;r--}}return!0}};function D(e){return e.children.some(e=>e instanceof m||!e.type.isAnonymous||D(e))}function O(e){let{buffer:n,nodeSet:r,maxBufferLength:a=t,reused:o=[],minRepeatType:s=r.types.length}=e,c=Array.isArray(n)?new p(n,n.length):n,l=r.types,u=0,d=0;function h(e,t,n,i,f,p){let{id:S,start:C,end:w,size:T}=c,E=d,D=u;if(T<0){if(c.next(),T==-1){let t=o[S];n.push(t),i.push(C-e);return}if(T==-3){u=S;return}if(T==-4){d=S;return}throw RangeError(`Unrecognized record size: ${T}`)}let O=l[S],k,A,M=C-e;if(w-C<=a&&(A=b(c.pos-t,f))){let t=new Uint16Array(A.size-A.skip),n=c.pos-A.size,i=t.length;for(;c.pos>n;)i=x(A.start,t,i);k=new m(t,w-A.start,r),M=A.start-e}else{let e=c.pos-T;c.next();let t=[],n=[],r=S>=s?S:-1,i=0,o=w,l=E;for(;c.pos>e;)r>=0&&c.id==r&&c.size>=0?(c.end<=o-a&&(v(t,n,C,i,c.end,o,r,l,D),i=t.length,o=c.end,l=d),c.next()):p>2500?g(C,e,t,n):h(C,e,t,n,r,p+1);if(r>=0&&i>0&&i<t.length&&v(t,n,C,i,C,o,r,l,D),t.reverse(),n.reverse(),r>-1&&i>0){let e=_(O,D);k=j(O,t,n,0,t.length,0,w-C,e,e)}else k=y(O,t,n,w-C,E-w,D)}n.push(k),i.push(M)}function g(e,t,n,i){let o=[],s=0,l=-1;for(;c.pos>t;){let{id:e,start:t,end:n,size:r}=c;if(r>4)c.next();else if(l>-1&&t<l)break;else l<0&&(l=n-a),o.push(e,t,n),s++,c.next()}if(s){let t=new Uint16Array(s*4),a=o[o.length-2];for(let e=o.length-3,n=0;e>=0;e-=3)t[n++]=o[e],t[n++]=o[e+1]-a,t[n++]=o[e+2]-a,t[n++]=n;n.push(new m(t,o[2]-a,r)),i.push(a-e)}}function _(e,t){return(n,r,a)=>{let o=0,s=n.length-1,c,l;if(s>=0&&(c=n[s])instanceof f){if(!s&&c.type==e&&c.length==a)return c;(l=c.prop(i.lookAhead))&&(o=r[s]+c.length+l-a)}return y(e,n,r,a,o,t)}}function v(e,t,n,i,a,o,s,c,l){let u=[],d=[];for(;e.length>i;)u.push(e.pop()),d.push(t.pop()+n-a);e.push(y(r.types[s],u,d,o-a,c-o,l)),t.push(a-n)}function y(e,t,n,r,a,o,s){if(o){let e=[i.contextHash,o];s=s?[e].concat(s):[e]}if(a>25){let e=[i.lookAhead,a];s=s?[e].concat(s):[e]}return new f(e,t,n,r,s)}function b(e,t){let n=c.fork(),r=0,i=0,o=0,l=n.end-a,u={size:0,start:0,skip:0};scan:for(let a=n.pos-e;n.pos>a;){let e=n.size;if(n.id==t&&e>=0){u.size=r,u.start=i,u.skip=o,o+=4,r+=4,n.next();continue}let c=n.pos-e;if(e<0||c<a||n.start<l)break;let d=n.id>=s?4:0,f=n.start;for(n.next();n.pos>c;){if(n.size<0){if(n.size==-3||n.size==-4)d+=4;else break scan}else n.id>=s&&(d+=4);n.next()}i=f,r+=e,o+=d}return(t<0||r==e)&&(u.size=r,u.start=i,u.skip=o),u.size>4?u:void 0}function x(e,t,n){let{id:r,start:i,end:a,size:o}=c;if(c.next(),o>=0&&r<s){let s=n;if(o>4){let r=c.pos-(o-4);for(;c.pos>r;)n=x(e,t,n)}t[--n]=s,t[--n]=a-e,t[--n]=i-e,t[--n]=r}else o==-3?u=r:o==-4&&(d=r);return n}let S=[],C=[];for(;c.pos>0;)h(e.start||0,e.bufferStart||0,S,C,-1,0);let w=e.length??(S.length?C[0]+S[0].length:0);return new f(l[e.topID],S.reverse(),C.reverse(),w)}var k=new WeakMap;function A(e,t){if(!e.isAnonymous||t instanceof m||t.type!=e)return 1;let n=k.get(t);if(n==null){n=1;for(let r of t.children){if(r.type!=e||!(r instanceof f)){n=1;break}n+=A(e,r)}k.set(t,n)}return n}function j(e,t,n,r,i,a,o,s,c){let l=0;for(let n=r;n<i;n++)l+=A(e,t[n]);let u=Math.ceil(l*1.5/8),d=[],f=[];function p(t,n,r,i,o){for(let s=r;s<i;){let r=s,l=n[s],m=A(e,t[s]);for(s++;s<i;s++){let n=A(e,t[s]);if(m+n>=u)break;m+=n}if(s==r+1){if(m>u){let e=t[r];p(e.children,e.positions,0,e.children.length,n[r]+o);continue}d.push(t[r])}else{let i=n[s-1]+t[s-1].length-l;d.push(j(e,t,n,r,s,l,i,null,c))}f.push(l+o-a)}}return p(t,n,r,i,0),(s||c)(d,f,o)}var M=class{constructor(){this.map=new WeakMap}setBuffer(e,t,n){let r=this.map.get(e);r||this.map.set(e,r=new Map),r.set(t,n)}getBuffer(e,t){let n=this.map.get(e);return n&&n.get(t)}set(e,t){e instanceof S?this.setBuffer(e.context.buffer,e.index,t):e instanceof v&&this.map.set(e.tree,t)}get(e){return e instanceof S?this.getBuffer(e.context.buffer,e.index):e instanceof v?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}},N=class e{constructor(e,t,n,r,i=!1,a=!1){this.from=e,this.to=t,this.tree=n,this.offset=r,this.open=!!i|(a?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(t,n=[],r=!1){let i=[new e(0,t.length,t,0,!1,r)];for(let e of n)e.to>t.length&&i.push(e);return i}static applyChanges(t,n,r=128){if(!n.length)return t;let i=[],a=1,o=t.length?t[0]:null;for(let s=0,c=0,l=0;;s++){let u=s<n.length?n[s]:null,d=u?u.fromA:1e9;if(d-c>=r)for(;o&&o.from<d;){let n=o;if(c>=n.from||d<=n.to||l){let t=Math.max(n.from,c)-l,r=Math.min(n.to,d)-l;n=t>=r?null:new e(t,r,n.tree,n.offset+l,s>0,!!u)}if(n&&i.push(n),o.to>d)break;o=a<t.length?t[a++]:null}if(!u)break;c=u.toA,l=u.toA-u.toB}return i}},ee=class{startParse(e,t,n){return typeof e==`string`&&(e=new te(e)),n=n?n.length?n.map(e=>new r(e.from,e.to)):[new r(0,0)]:[new r(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let r=this.startParse(e,t,n);for(;;){let e=r.advance();if(e)return e}}},te=class{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}};function ne(e){return(t,n,r,i)=>new oe(t,e,n,r,i)}var re=class{constructor(e,t,n,r,i,a){this.parser=e,this.parse=t,this.overlay=n,this.bracketed=r,this.target=i,this.from=a}};function ie(e){if(!e.length||e.some(e=>e.from>=e.to))throw RangeError(`Invalid inner parse ranges given: `+JSON.stringify(e))}var ae=class{constructor(e,t,n,r,i,a,o,s){this.parser=e,this.predicate=t,this.mounts=n,this.index=r,this.start=i,this.bracketed=a,this.target=o,this.prev=s,this.depth=0,this.ranges=[]}},P=new i({perNode:!0}),oe=class{constructor(e,t,n,r,i){this.nest=t,this.input=n,this.fragments=r,this.ranges=i,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let e=this.baseParse.advance();if(!e)return null;if(this.baseParse=null,this.baseTree=e,this.startInner(),this.stoppedAt!=null)for(let e of this.inner)e.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let e=this.baseTree;return this.stoppedAt!=null&&(e=new f(e.type,e.children,e.positions,e.length,e.propValues.concat([[P,this.stoppedAt]]))),e}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let n=Object.assign(Object.create(null),e.target.props);n[i.mounted.id]=new a(t,e.overlay,e.parser,e.bracketed),e.target.props=n}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].from<e&&(e=Math.min(e,this.inner[t].parse.parsedPos));return e}stopAt(e){if(this.stoppedAt=e,this.baseParse)this.baseParse.stopAt(e);else for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].parse.stopAt(e)}startInner(){let e=new de(this.fragments),t=null,n=null,i=new E(new v(this.baseTree,this.ranges[0].from,0,null),d.IncludeAnonymous|d.IgnoreMounts);scan:for(let a,o;;){let s=!0,c;if(this.stoppedAt!=null&&i.from>=this.stoppedAt)s=!1;else if(e.hasNode(i)){if(t){let e=t.mounts.find(e=>e.frag.from<=i.from&&e.frag.to>=i.to&&e.mount.overlay);if(e)for(let n of e.mount.overlay){let r=n.from+e.pos,a=n.to+e.pos;r>=i.from&&a<=i.to&&!t.ranges.some(e=>e.from<a&&e.to>r)&&t.ranges.push({from:r,to:a})}}s=!1}else if(n&&(o=se(n.ranges,i.from,i.to)))s=o!=2;else if(!i.type.isAnonymous&&(a=this.nest(i,this.input))&&(i.from<i.to||!a.overlay)){i.tree||(le(i),t&&t.depth++,n&&n.depth++);let o=e.findMounts(i.from,a.parser);if(typeof a.overlay==`function`)t=new ae(a.parser,a.overlay,o,this.inner.length,i.from,!!a.bracketed,i.tree,t);else{let e=fe(this.ranges,a.overlay||(i.from<i.to?[new r(i.from,i.to)]:[]));e.length&&ie(e),(e.length||!a.overlay)&&this.inner.push(new re(a.parser,e.length?a.parser.startParse(this.input,me(o,e),e):a.parser.startParse(``),a.overlay?a.overlay.map(e=>new r(e.from-i.from,e.to-i.from)):null,!!a.bracketed,i.tree,e.length?e[0].from:i.from)),a.overlay?e.length&&(n={ranges:e,depth:0,prev:n}):s=!1}}else if(t&&(c=t.predicate(i))&&(c===!0&&(c=new r(i.from,i.to)),c.from<c.to)){let e=t.ranges.length-1;e>=0&&t.ranges[e].to==c.from?t.ranges[e]={from:t.ranges[e].from,to:c.to}:t.ranges.push(c)}if(s&&i.firstChild())t&&t.depth++,n&&n.depth++;else for(;!i.nextSibling();){if(!i.parent())break scan;if(t&&!--t.depth){let e=fe(this.ranges,t.ranges);e.length&&(ie(e),this.inner.splice(t.index,0,new re(t.parser,t.parser.startParse(this.input,me(t.mounts,e),e),t.ranges.map(e=>new r(e.from-t.start,e.to-t.start)),t.bracketed,t.target,e[0].from))),t=t.prev}n&&!--n.depth&&(n=n.prev)}}}};function se(e,t,n){for(let r of e){if(r.from>=n)break;if(r.to>t)return r.from<=t&&r.to>=n?2:1}return 0}function ce(e,t,n,r,i,a){if(t<n){let o=e.buffer[t+1];r.push(e.slice(t,n,o)),i.push(o-a)}}function le(e){let{node:t}=e,n=[],r=t.context.buffer;do n.push(e.index),e.parent();while(!e.tree);let i=e.tree,a=i.children.indexOf(r),o=i.children[a],c=o.buffer,l=[a];function u(e,r,i,a,s,d){let p=n[d],m=[],h=[];ce(o,e,p,m,h,a);let g=c[p+1],_=c[p+2];l.push(m.length);let v=d?u(p+4,c[p+3],o.set.types[c[p]],g,_-g,d-1):t.toTree();return m.push(v),h.push(g-a),ce(o,c[p+3],r,m,h,a),new f(i,m,h,s)}i.children[a]=u(0,c.length,s.none,0,o.length,n.length-1);for(let t of l){let n=e.tree.children[t],r=e.tree.positions[t];e.yield(new v(n,r+e.from,t,e._tree))}}var ue=class{constructor(e,t){this.offset=t,this.done=!1,this.cursor=e.cursor(d.IncludeAnonymous|d.IgnoreMounts|d.ExcludeBuffers)}moveTo(e){let{cursor:t}=this,n=e-this.offset;for(;!this.done&&t.from<n;)if(!(t.to>=n&&t.enter(n,1,d.IncludeAnonymous|d.IgnoreOverlays|d.ExcludeBuffers))){if(t.to<=n)t.next(!1)||(this.done=!0);else break}}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let t=this.cursor.tree;;){if(t==e.tree)return!0;if(t.children.length&&t.positions[0]==0&&t.children[0]instanceof f)t=t.children[0];else break}return!1}},de=class{constructor(e){if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let t=this.curFrag=e[0];this.curTo=t.tree.prop(P)??t.to,this.inner=new ue(t.tree,-t.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let e=this.curFrag=this.fragments[this.fragI];this.curTo=e.tree.prop(P)??e.to,this.inner=new ue(e.tree,-e.offset)}}findMounts(e,t){let n=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let e=this.inner.cursor.node;e;e=e.parent){let r=e.tree?.prop(i.mounted);if(r&&r.parser==t)for(let t=this.fragI;t<this.fragments.length;t++){let i=this.fragments[t];if(i.from>=e.to)break;i.tree==this.curFrag.tree&&n.push({frag:i,pos:e.from-i.offset,mount:r})}}}return n}};function fe(e,t){let n=null,i=t;for(let a=1,o=0;a<e.length;a++){let s=e[a-1].to,c=e[a].from;for(;o<i.length;o++){let e=i[o];if(e.from>=c)break;e.to<=s||(n||(i=n=t.slice()),e.from<s?(n[o]=new r(e.from,s),e.to>c&&n.splice(o+1,0,new r(c,e.to))):e.to>c?n[o--]=new r(c,e.to):n.splice(o--,1))}}return i}function pe(e,t,n,i){let a=0,o=0,s=!1,c=!1,l=-1e9,u=[];for(;;){let d=a==e.length?1e9:s?e[a].to:e[a].from,f=o==t.length?1e9:c?t[o].to:t[o].from;if(s!=c){let e=Math.max(l,n),t=Math.min(d,f,i);e<t&&u.push(new r(e,t))}if(l=Math.min(d,f),l==1e9)break;d==l&&(s?(s=!1,a++):s=!0),f==l&&(c?(c=!1,o++):c=!0)}return u}function me(e,t){let n=[];for(let{pos:i,mount:a,frag:o}of e){let e=i+(a.overlay?a.overlay[0].from:0),s=e+a.tree.length,c=Math.max(o.from,e),l=Math.min(o.to,s);if(a.overlay){let s=pe(t,a.overlay.map(e=>new r(e.from+i,e.to+i)),c,l);for(let t=0,r=c;;t++){let i=t==s.length,c=i?l:s[t].from;if(c>r&&n.push(new N(r,c,a.tree,-e,o.from>=r||o.openStart,o.to<=c||o.openEnd)),i)break;r=s[t].to}}else n.push(new N(c,l,a.tree,-e,o.from>=e||o.openStart,o.to<=s||o.openEnd))}return n}var he=e({Tag:()=>F,classHighlighter:()=>Oe,getStyleTags:()=>Te,highlightCode:()=>Ce,highlightTree:()=>z,styleTags:()=>I,tagHighlighter:()=>R,tags:()=>$}),ge=0,F=class e{constructor(e,t,n,r){this.name=e,this.set=t,this.base=n,this.modified=r,this.id=ge++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(t,n){let r=typeof t==`string`?t:`?`;if(t instanceof e&&(n=t),n?.base)throw Error(`Can not derive from a modified tag`);let i=new e(r,[],null,[]);if(i.set.push(i),n)for(let e of n.set)i.set.push(e);return i}static defineModifier(e){let t=new ve(e);return e=>e.modified.indexOf(t)>-1?e:ve.get(e.base||e,e.modified.concat(t).sort((e,t)=>e.id-t.id))}},_e=0,ve=class e{constructor(e){this.name=e,this.instances=[],this.id=_e++}static get(t,n){if(!n.length)return t;let r=n[0].instances.find(e=>e.base==t&&ye(n,e.modified));if(r)return r;let i=[],a=new F(t.name,i,t,n);for(let e of n)e.instances.push(a);let o=be(n);for(let n of t.set)if(!n.modified.length)for(let t of o)i.push(e.get(n,t));return a}};function ye(e,t){return e.length==t.length&&e.every((e,n)=>e==t[n])}function be(e){let t=[[]];for(let n=0;n<e.length;n++)for(let r=0,i=t.length;r<i;r++)t.push(t[r].concat(e[n]));return t.sort((e,t)=>t.length-e.length)}function I(e){let t=Object.create(null);for(let n in e){let r=e[n];Array.isArray(r)||(r=[r]);for(let e of n.split(` `))if(e){let n=[],i=2,a=e;for(let t=0;;){if(a==`...`&&t>0&&t+3==e.length){i=1;break}let r=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!r)throw RangeError(`Invalid path: `+e);if(n.push(r[0]==`*`?``:r[0][0]==`"`?JSON.parse(r[0]):r[0]),t+=r[0].length,t==e.length)break;let o=e[t++];if(t==e.length&&o==`!`){i=0;break}if(o!=`/`)throw RangeError(`Invalid path: `+e);a=e.slice(t)}let o=n.length-1,s=n[o];if(!s)throw RangeError(`Invalid path: `+e);t[s]=new L(r,i,o>0?n.slice(0,o):null).sort(t[s])}}return xe.add(t)}var xe=new i({combine(e,t){let n,r,i;for(;e||t;){if(!e||t&&e.depth<=t.depth?(i=t,t=t.next):(i=e,e=e.next),n&&n.mode==i.mode&&!i.context&&!n.context)continue;let a=new L(i.tags,i.mode,i.context);n?n.next=a:r=a,n=a}return r}}),L=class{constructor(e,t,n,r){this.tags=e,this.mode=t,this.context=n,this.next=r}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}};L.empty=new L([],2,null);function R(e,t){let n=Object.create(null);for(let t of e)if(!Array.isArray(t.tag))n[t.tag.id]=t.class;else for(let e of t.tag)n[e.id]=t.class;let{scope:r,all:i=null}=t||{};return{style:e=>{let t=i;for(let r of e)for(let e of r.set){let r=n[e.id];if(r){t=t?t+` `+r:r;break}}return t},scope:r}}function Se(e,t){let n=null;for(let r of e){let e=r.style(t);e&&(n=n?n+` `+e:e)}return n}function z(e,t,n,r=0,i=e.length){let a=new we(r,Array.isArray(t)?t:[t],n);a.highlightRange(e.cursor(),r,i,``,a.highlighters),a.flush(i)}function Ce(e,t,n,r,i,a=0,o=e.length){let s=a;function c(t,n){if(!(t<=s)){for(let a=e.slice(s,t),o=0;;){let e=a.indexOf(`
2
2
  `,o),t=e<0?a.length:e;if(t>o&&r(a.slice(o,t),n),e<0)break;i(),o=e+1}s=t}}z(t,n,(e,t,n)=>{c(e,``),c(t,n)},a,o),c(o,``)}var we=class{constructor(e,t,n){this.at=e,this.highlighters=t,this.span=n,this.class=``}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,n,r,a){let{type:o,from:s,to:c}=e;if(s>=n||c<=t)return;o.isTop&&(a=this.highlighters.filter(e=>!e.scope||e.scope(o)));let l=r,u=Te(e)||L.empty,d=Se(a,u.tags);if(d&&(l&&(l+=` `),l+=d,u.mode==1&&(r+=(r?` `:``)+d)),this.startSpan(Math.max(t,s),l),u.opaque)return;let f=e.tree&&e.tree.prop(i.mounted);if(f&&f.overlay){let i=e.node.enter(f.overlay[0].from+s,1),o=this.highlighters.filter(e=>!e.scope||e.scope(f.tree.type)),u=e.firstChild();for(let d=0,p=s;;d++){let m=d<f.overlay.length?f.overlay[d]:null,h=m?m.from+s:c,g=Math.max(t,p),_=Math.min(n,h);if(g<_&&u)for(;e.from<_&&(this.highlightRange(e,g,_,r,a),this.startSpan(Math.min(_,e.to),l),!(e.to>=h||!e.nextSibling())););if(!m||h>n)break;p=m.to+s,p>t&&(this.highlightRange(i.cursor(),Math.max(t,m.from+s),Math.min(n,p),``,o),this.startSpan(Math.min(n,p),l))}u&&e.parent()}else if(e.firstChild()){f&&(r=``);do if(!(e.to<=t)){if(e.from>=n)break;this.highlightRange(e,t,n,r,a),this.startSpan(Math.min(n,e.to),l)}while(e.nextSibling());e.parent()}}};function Te(e){let t=e.type.prop(xe);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}var B=F.define,V=B(),H=B(),Ee=B(H),De=B(H),U=B(),W=B(U),G=B(U),K=B(),q=B(K),J=B(),Y=B(),X=B(),Z=B(X),Q=B(),$={comment:V,lineComment:B(V),blockComment:B(V),docComment:B(V),name:H,variableName:B(H),typeName:Ee,tagName:B(Ee),propertyName:De,attributeName:B(De),className:B(H),labelName:B(H),namespace:B(H),macroName:B(H),literal:U,string:W,docString:B(W),character:B(W),attributeValue:B(W),number:G,integer:B(G),float:B(G),bool:B(U),regexp:B(U),escape:B(U),color:B(U),url:B(U),keyword:J,self:B(J),null:B(J),atom:B(J),unit:B(J),modifier:B(J),operatorKeyword:B(J),controlKeyword:B(J),definitionKeyword:B(J),moduleKeyword:B(J),operator:Y,derefOperator:B(Y),arithmeticOperator:B(Y),logicOperator:B(Y),bitwiseOperator:B(Y),compareOperator:B(Y),updateOperator:B(Y),definitionOperator:B(Y),typeOperator:B(Y),controlOperator:B(Y),punctuation:X,separator:B(X),bracket:Z,angleBracket:B(Z),squareBracket:B(Z),paren:B(Z),brace:B(Z),content:K,heading:q,heading1:B(q),heading2:B(q),heading3:B(q),heading4:B(q),heading5:B(q),heading6:B(q),contentSeparator:B(K),list:B(K),quote:B(K),emphasis:B(K),strong:B(K),link:B(K),monospace:B(K),strikethrough:B(K),inserted:B(),deleted:B(),changed:B(),invalid:B(),meta:Q,documentMeta:B(Q),annotation:B(Q),processingInstruction:B(Q),definition:F.defineModifier(`definition`),constant:F.defineModifier(`constant`),function:F.defineModifier(`function`),standard:F.defineModifier(`standard`),local:F.defineModifier(`local`),special:F.defineModifier(`special`)};for(let e in $){let t=$[e];t instanceof F&&(t.name=e)}var Oe=R([{tag:$.link,class:`tok-link`},{tag:$.heading,class:`tok-heading`},{tag:$.emphasis,class:`tok-emphasis`},{tag:$.strong,class:`tok-strong`},{tag:$.keyword,class:`tok-keyword`},{tag:$.atom,class:`tok-atom`},{tag:$.bool,class:`tok-bool`},{tag:$.url,class:`tok-url`},{tag:$.labelName,class:`tok-labelName`},{tag:$.inserted,class:`tok-inserted`},{tag:$.deleted,class:`tok-deleted`},{tag:$.literal,class:`tok-literal`},{tag:$.string,class:`tok-string`},{tag:$.number,class:`tok-number`},{tag:[$.regexp,$.escape,$.special($.string)],class:`tok-string2`},{tag:$.variableName,class:`tok-variableName`},{tag:$.local($.variableName),class:`tok-variableName tok-local`},{tag:$.definition($.variableName),class:`tok-variableName tok-definition`},{tag:$.special($.variableName),class:`tok-variableName2`},{tag:$.definition($.propertyName),class:`tok-propertyName tok-definition`},{tag:$.typeName,class:`tok-typeName`},{tag:$.namespace,class:`tok-namespace`},{tag:$.className,class:`tok-className`},{tag:$.macroName,class:`tok-macroName`},{tag:$.propertyName,class:`tok-propertyName`},{tag:$.operator,class:`tok-operator`},{tag:$.comment,class:`tok-comment`},{tag:$.meta,class:`tok-meta`},{tag:$.invalid,class:`tok-invalid`},{tag:$.punctuation,class:`tok-punctuation`}]);export{R as a,d as c,s as d,M as f,ne as g,N as h,I as i,i as l,f as m,he as n,$ as o,ee as p,z as r,t as s,F as t,c as u};
@@ -1,3 +1,3 @@
1
- import{b as e,d as t,l as n,m as r,o as i,p as a,s as o,u as s,y as c}from"./dist-CbkXScEJ.js";import{_ as l,a as u,f as d,i as ee,n as f,o as te,r as p,t as m,u as ne}from"./dist-jDX3NY00.js";import{a as re,c as ie,d as h,h as g,i as ae,l as _,m as v,o as y,p as oe,r as se,u as ce}from"./dist-CJHSsi_2.js";function le(e,t,n,r=0,i=0){t??(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));let a=i;for(let i=r;i<t;i++)e.charCodeAt(i)==9?a+=n-a%n:a++;return a}var b=class{constructor(e,t,n,r){this.string=e,this.tabSize=t,this.indentUnit=n,this.overrideIndent=r,this.pos=0,this.start=0,this.lastColumnPos=0,this.lastColumnValue=0}eol(){return this.pos>=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)}eat(e){let t=this.string.charAt(this.pos),n;if(n=typeof e==`string`?t==e:t&&(e instanceof RegExp?e.test(t):e(t)),n)return++this.pos,t}eatWhile(e){let t=this.pos;for(;this.eat(e););return this.pos>t}eatSpace(){let e=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPos<this.start&&(this.lastColumnValue=le(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue}indentation(){return this.overrideIndent??le(this.string,null,this.tabSize)}match(e,t,n){if(typeof e==`string`){let r=e=>n?e.toLowerCase():e;return r(this.string.substr(this.pos,e.length))==r(e)?(t!==!1&&(this.pos+=e.length),!0):null}{let n=this.string.slice(this.pos).match(e);return n&&n.index>0?null:(n&&t!==!1&&(this.pos+=n[0].length),n)}}current(){return this.string.slice(this.start,this.pos)}},x=new _;function S(e){return o.define({combine:e?t=>t.concat(e):void 0})}var ue=new _,C=class{constructor(e,t,n=[],r=``){this.data=e,this.name=r,i.prototype.hasOwnProperty(`tree`)||Object.defineProperty(i.prototype,"tree",{get(){return w(this)}}),this.parser=t,this.extension=[O.of(this),i.languageData.of((e,t,n)=>{let r=de(e,t,n),i=r.type.prop(x);if(!i)return[];let a=e.facet(i),o=r.type.prop(ue);if(o){let i=r.resolve(t-r.from,n);for(let t of o)if(t.test(i,e)){let n=e.facet(t.facet);return t.type==`replace`?n:n.concat(a)}}return a})].concat(n)}isActiveAt(e,t,n=-1){return de(e,t,n).type.prop(x)==this.data}findRegions(e){let t=e.facet(O);if(t?.data==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let n=[],r=(e,t)=>{if(e.prop(x)==this.data){n.push({from:t,to:t+e.length});return}let i=e.prop(_.mounted);if(i){if(i.tree.prop(x)==this.data){if(i.overlay)for(let e of i.overlay)n.push({from:e.from+t,to:e.to+t});else n.push({from:t,to:t+e.length});return}if(i.overlay){let e=n.length;if(r(i.tree,i.overlay[0].from+t),n.length>e)return}}for(let n=0;n<e.children.length;n++){let i=e.children[n];i instanceof v&&r(i,e.positions[n]+t)}};return r(w(e),0),n}get allowsNesting(){return!0}};C.setState=a.define();function de(e,t,n){let r=e.facet(O),i=w(e).topNode;if(!r||r.allowsNesting)for(let e=i;e;e=e.enter(t,n,ie.ExcludeBuffers|ie.EnterBracketed))e.type.isTop&&(i=e);return i}var fe=class e extends C{constructor(e,t,n){super(e,t,[],n),this.parser=t}static define(t){let n=S(t.languageData);return new e(n,t.parser.configure({props:[x.add(e=>e.isTop?n:void 0)]}),t.name)}configure(t,n){return new e(this.data,this.parser.configure(t),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}};function w(e){let t=e.field(C.state,!1);return t?t.tree:v.empty}function pe(e,t,n=50){let r=e.field(C.state,!1)?.context;if(!r)return null;let i=r.viewport;r.updateViewport({from:0,to:t});let a=r.isDone(t)||r.work(n,t)?r.tree:null;return r.updateViewport(i),a}function me(e,t=e.doc.length){return e.field(C.state,!1)?.context.isDone(t)||!1}function he(e,t=e.viewport.to,n=100){let r=pe(e.state,t,n);return r!=w(e.state)&&e.dispatch({}),!!r}function ge(e){return e.plugin(xe)?.isWorking()||!1}var _e=class{constructor(e){this.doc=e,this.cursorPos=0,this.string=``,this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let n=this.cursorPos-this.string.length;return e<n||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}},T=null,E=class e{constructor(e,t,n=[],r,i,a,o,s){this.parser=e,this.state=t,this.fragments=n,this.tree=r,this.treeLen=i,this.viewport=a,this.skipped=o,this.scheduleOn=s,this.parse=null,this.tempSkipped=[]}static create(t,n,r){return new e(t,n,[],v.empty,0,r,[],null)}startParse(){return this.parser.startParse(new _e(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=v.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{if(typeof e==`number`){let t=Date.now()+e;e=()=>Date.now()>t}for(this.parse||=this.startParse(),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let n=this.parse.advance();if(n){if(this.fragments=this.withoutTempSkipped(g.addTree(n,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=this.parse.stoppedAt??this.state.doc.length,this.tree=n,this.parse=null,this.treeLen<(t??this.state.doc.length))this.parse=this.startParse();else return!0}if(e())return!1}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(g.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=T;T=this;try{return e()}finally{T=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=ve(e,t.from,t.to);return e}changes(t,n){let{fragments:r,tree:i,treeLen:a,viewport:o,skipped:s}=this;if(this.takeTree(),!t.empty){let e=[];if(t.iterChangedRanges((t,n,r,i)=>e.push({fromA:t,toA:n,fromB:r,toB:i})),r=g.applyChanges(r,e),i=v.empty,a=0,o={from:t.mapPos(o.from,-1),to:t.mapPos(o.to,1)},this.skipped.length){s=[];for(let e of this.skipped){let n=t.mapPos(e.from,1),r=t.mapPos(e.to,-1);n<r&&s.push({from:n,to:r})}}}return new e(this.parser,n,r,i,a,o,s,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let t=0;t<this.skipped.length;t++){let{from:n,to:r}=this.skipped[t];n<e.to&&r>e.from&&(this.fragments=ve(this.fragments,n,r),this.skipped.splice(t--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&=(this.takeTree(),null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends oe{createParse(t,n,r){let i=r[0].from,a=r[r.length-1].to;return{parsedPos:i,advance(){let t=T;if(t){for(let e of r)t.tempSkipped.push(e);e&&(t.scheduleOn=t.scheduleOn?Promise.all([t.scheduleOn,e]):e)}return this.parsedPos=a,new v(h.none,[],[],a-i)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return T}};function ve(e,t,n){return g.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}var D=class e{constructor(e){this.context=e,this.tree=e.tree}apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(t.changes,t.state),r=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,r)||n.takeTree(),new e(n)}static init(t){let n=Math.min(3e3,t.doc.length),r=E.create(t.facet(O).parser,t,{from:0,to:n});return r.work(20,n)||r.takeTree(),new e(r)}};C.state=r.define({create:D.init,update(e,t){for(let e of t.effects)if(e.is(C.setState))return e.value;return t.startState.facet(O)==t.state.facet(O)?e.apply(t):D.init(t.state)}});var ye=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<`u`&&(ye=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});var be=typeof navigator<`u`&&navigator.scheduling?.isInputPending?()=>navigator.scheduling.isInputPending():null,xe=u.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(C.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(C.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=ye(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:n,viewport:{to:r}}=this.view,i=n.field(C.state);if(i.tree==i.context.tree&&i.context.isDone(r+1e5))return;let a=Date.now()+Math.min(this.chunkBudget,100,e&&!be?Math.max(25,e.timeRemaining()-5):1e9),o=i.context.treeLen<r&&n.doc.length>r+1e3,s=i.context.work(()=>be&&be()||Date.now()>a,r+(o?0:1e5));this.chunkBudget-=Date.now()-t,(s||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:C.setState.of(new D(i.context))})),this.chunkBudget>0&&(!s||o)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(e){e.scheduleOn&&=(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(e=>d(this.view.state,e)).then(()=>this.workScheduled--),null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),O=o.define({combine(e){return e.length?e[0]:null},enables:e=>[C.state,xe,p.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]}),Se=class{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}},Ce=class e{constructor(e,t,n,r,i,a=void 0){this.name=e,this.alias=t,this.extensions=n,this.filename=r,this.loadFunc=i,this.support=a,this.loading=null}load(){return this.loading||=this.loadFunc().then(e=>this.support=e,e=>{throw this.loading=null,e})}static of(t){let{load:n,support:r}=t;if(!n){if(!r)throw RangeError(`Must pass either 'load' or 'support' to LanguageDescription.of`);n=()=>Promise.resolve(r)}return new e(t.name,(t.alias||[]).concat(t.name).map(e=>e.toLowerCase()),t.extensions||[],t.filename,n,r)}static matchFilename(e,t){for(let n of e)if(n.filename&&n.filename.test(t))return n;let n=/\.([^.]+)$/.exec(t);if(n){for(let t of e)if(t.extensions.indexOf(n[1])>-1)return t}return null}static matchLanguageName(e,t,n=!0){t=t.toLowerCase();for(let n of e)if(n.alias.some(e=>e==t))return n;if(n)for(let n of e)for(let e of n.alias){let r=t.indexOf(e);if(r>-1&&(e.length>2||!/\w/.test(t[r-1])&&!/\w/.test(t[r+e.length])))return n}return null}},we=o.define(),k=o.define({combine:e=>{if(!e.length)return` `;let t=e[0];if(!t||/\S/.test(t)||Array.from(t).some(e=>e!=t[0]))throw Error(`Invalid indent unit: `+JSON.stringify(e[0]));return t}});function A(e){let t=e.facet(k);return t.charCodeAt(0)==9?e.tabSize*t.length:t.length}function j(e,t){let n=``,r=e.tabSize,i=e.facet(k)[0];if(i==` `){for(;t>=r;)n+=` `,t-=r;i=` `}for(let e=0;e<t;e++)n+=i;return n}function M(e,t){e instanceof i&&(e=new N(e));for(let n of e.state.facet(we)){let r=n(e,t);if(r!==void 0)return r}let n=w(e.state);return n.length>=t?De(e,n,t):null}function Te(e,t,n){let r=Object.create(null),i=new N(e,{overrideIndentation:e=>r[e]??-1}),a=[];for(let o=t;o<=n;){let t=e.doc.lineAt(o);o=t.to+1;let n=M(i,t.from);if(n==null)continue;/\S/.test(t.text)||(n=0);let s=/^\s*/.exec(t.text)[0],c=j(e,n);s!=c&&(r[t.from]=n,a.push({from:t.from,to:t.from+s.length,insert:c}))}return e.changes(a)}var N=class{constructor(e,t={}){this.state=e,this.options=t,this.unit=A(e)}lineAt(e,t=1){let n=this.state.doc.lineAt(e),{simulateBreak:r,simulateDoubleBreak:i}=this.options;return r!=null&&r>=n.from&&r<=n.to?i&&r==e?{text:``,from:e}:(t<0?r<e:r<=e)?{text:n.text.slice(r-n.from),from:r}:{text:n.text.slice(0,r-n.from),from:n.from}:n}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return``;let{text:n,from:r}=this.lineAt(e,t);return n.slice(e-r,Math.min(n.length,e+100-r))}column(e,t=1){let{text:n,from:r}=this.lineAt(e,t),i=this.countColumn(n,e-r),a=this.options.overrideIndentation?this.options.overrideIndentation(r):-1;return a>-1&&(i+=a-this.countColumn(n,n.search(/\S|$/))),i}countColumn(t,n=t.length){return e(t,this.state.tabSize,n)}lineIndent(e,t=1){let{text:n,from:r}=this.lineAt(e,t),i=this.options.overrideIndentation;if(i){let e=i(r);if(e>-1)return e}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}},Ee=new _;function De(e,t,n){let r=t.resolveStack(n),i=t.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(i!=r.node){let e=[];for(let t=i;t&&!(t.from<r.node.from||t.to>r.node.to||t.from==r.node.from&&t.type==r.node.type);t=t.parent)e.push(t);for(let t=e.length-1;t>=0;t--)r={node:e[t],next:r}}return Oe(r,e,n)}function Oe(e,t,n){for(let r=e;r;r=r.next){let e=Ae(r.node);if(e)return e(Me.create(t,n,r))}return 0}function ke(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}function Ae(e){let t=e.type.prop(Ee);if(t)return t;let n=e.firstChild,r;if(n&&(r=n.type.prop(_.closedBy))){let t=e.lastChild,n=t&&r.indexOf(t.name)>-1;return e=>Ie(e,!0,1,void 0,n&&!ke(e)?t.from:void 0)}return e.parent==null?je:null}function je(){return 0}var Me=class e extends N{constructor(e,t,n){super(e.state,e.options),this.base=e,this.pos=t,this.context=n}get node(){return this.context.node}static create(t,n,r){return new e(t,n,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let n=e.resolve(t.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(Ne(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return Oe(this.context.next,this.base,this.pos)}};function Ne(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function Pe(e){let t=e.node,n=t.childAfter(t.from),r=t.lastChild;if(!n)return null;let i=e.options.simulateBreak,a=e.state.doc.lineAt(n.from),o=i==null||i<=a.from?a.to:Math.min(a.to,i);for(let e=n.to;;){let i=t.childAfter(e);if(!i||i==r)return null;if(!i.type.isSkipped){if(i.from>=o)return null;let e=/^ */.exec(a.text.slice(n.to-a.from))[0].length;return{from:n.from,to:n.to+e}}e=i.to}}function Fe({closing:e,align:t=!0,units:n=1}){return r=>Ie(r,t,n,e)}function Ie(e,t,n,r,i){let a=e.textAfter,o=a.match(/^\s*/)[0].length,s=r&&a.slice(o,o+r.length)==r||i==e.pos+o,c=t?Pe(e):null;return c?s?e.column(c.from):e.column(c.to):e.baseIndent+(s?0:e.unit*n)}var Le=e=>e.baseIndent;function Re({except:e,units:t=1}={}){return n=>{let r=e&&e.test(n.textAfter);return n.baseIndent+(r?0:t*n.unit)}}var ze=200;function Be(){return i.transactionFilter.of(e=>{if(!e.docChanged||!e.isUserEvent(`input.type`)&&!e.isUserEvent(`input.complete`))return e;let t=e.startState.languageDataAt(`indentOnInput`,e.startState.selection.main.head);if(!t.length)return e;let n=e.newDoc,{head:r}=e.newSelection.main,i=n.lineAt(r);if(r>i.from+ze)return e;let a=n.sliceString(i.from,r);if(!t.some(e=>e.test(a)))return e;let{state:o}=e,s=-1,c=[];for(let{head:e}of o.selection.ranges){let t=o.doc.lineAt(e);if(t.from==s)continue;s=t.from;let n=M(o,t.from);if(n==null)continue;let r=/^\s*/.exec(t.text)[0],i=j(o,n);r!=i&&c.push({from:t.from,to:t.from+r.length,insert:i})}return c.length?[e,{changes:c,sequential:!0}]:e})}var Ve=o.define(),He=new _;function Ue(e){let t=e.firstChild,n=e.lastChild;return t&&t.to<n.from?{from:t.to,to:n.type.isError?e.to:n.from}:null}function We(e,t,n){let r=w(e);if(r.length<n)return null;let i=r.resolveStack(n,1),a=null;for(let o=i;o;o=o.next){let i=o.node;if(i.to<=n||i.from>n)continue;if(a&&i.from<t)break;let s=i.type.prop(He);if(s&&(i.to<r.length-50||r.length==e.doc.length||!Ge(i))){let r=s(i,e);r&&r.from<=n&&r.from>=t&&r.to>n&&(a=r)}}return a}function Ge(e){let t=e.lastChild;return t&&t.to==e.to&&t.type.isError}function P(e,t,n){for(let r of e.facet(Ve)){let i=r(e,t,n);if(i)return i}return We(e,t,n)}function Ke(e,t){let n=t.mapPos(e.from,1),r=t.mapPos(e.to,-1);return n>=r?void 0:{from:n,to:r}}var F=a.define({map:Ke}),I=a.define({map:Ke});function L(e){let t=[];for(let{head:n}of e.state.selection.ranges)t.some(e=>e.from<=n&&e.to>=n)||t.push(e.lineBlockAt(n));return t}var R=r.define({create(){return m.none},update(e,t){t.isUserEvent(`delete`)&&t.changes.iterChangedRanges((t,n)=>e=qe(e,t,n)),e=e.map(t.changes);let n=[];for(let r of t.effects)r.is(F)&&!Ye(e,r.value.from,r.value.to)?n.push(r.value):r.is(I)&&(e=e.update({filter:(e,t)=>r.value.from!=e||r.value.to!=t,filterFrom:r.value.from,filterTo:r.value.to}));if(n.length){let{preparePlaceholder:r}=t.state.facet(H),i=n.map(e=>(r?m.replace({widget:new ot(r(t.state,e))}):at).range(e.from,e.to));e=e.update({add:i})}return t.selection&&(e=qe(e,t.selection.main.head)),e},provide:e=>p.decorations.from(e),toJSON(e,t){let n=[];return e.between(0,t.doc.length,(e,t)=>{n.push(e,t)}),n},fromJSON(e){if(!Array.isArray(e)||e.length%2)throw RangeError(`Invalid JSON for fold state`);let t=[];for(let n=0;n<e.length;){let r=e[n++],i=e[n++];if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid JSON for fold state`);t.push(at.range(r,i))}return m.set(t,!0)}});function qe(e,t,n=t){let r=!1;return e.between(t,n,(e,i)=>{e<n&&i>t&&(r=!0)}),r?e.update({filterFrom:t,filterTo:n,filter:(e,r)=>e>=n||r<=t}):e}function Je(e){return e.field(R,!1)||s.empty}function z(e,t,n){var r;let i=null;return(r=e.field(R,!1))==null||r.between(t,n,(e,t)=>{(!i||i.from>e)&&(i={from:e,to:t})}),i}function Ye(e,t,n){let r=!1;return e.between(t,t,(e,i)=>{e==t&&i==n&&(r=!0)}),r}function B(e,t){return e.field(R,!1)?t:t.concat(a.appendConfig.of(U()))}var Xe=e=>{for(let t of L(e)){let n=P(e.state,t.from,t.to);if(n)return e.dispatch({effects:B(e.state,[F.of(n),V(e,n)])}),!0}return!1},Ze=e=>{if(!e.state.field(R,!1))return!1;let t=[];for(let n of L(e)){let r=z(e.state,n.from,n.to);r&&t.push(I.of(r),V(e,r,!1))}return t.length&&e.dispatch({effects:t}),t.length>0};function V(e,t,n=!0){let r=e.state.doc.lineAt(t.from).number,i=e.state.doc.lineAt(t.to).number;return p.announce.of(`${e.state.phrase(n?`Folded lines`:`Unfolded lines`)} ${r} ${e.state.phrase(`to`)} ${i}.`)}var Qe=e=>{let{state:t}=e,n=[];for(let r=0;r<t.doc.length;){let i=e.lineBlockAt(r),a=P(t,i.from,i.to);a&&n.push(F.of(a)),r=(a?e.lineBlockAt(a.to):i).to+1}return n.length&&e.dispatch({effects:B(e.state,n)}),!!n.length},$e=e=>{let t=e.state.field(R,!1);if(!t||!t.size)return!1;let n=[];return t.between(0,e.state.doc.length,(e,t)=>{n.push(I.of({from:e,to:t}))}),e.dispatch({effects:n}),!0};function et(e,t){for(let n=t;;){let r=P(e.state,n.from,n.to);if(r&&r.to>t.from)return r;if(!n.from)return null;n=e.lineBlockAt(n.from-1)}}var tt=e=>{let t=[];for(let n of L(e)){let r=z(e.state,n.from,n.to);if(r)t.push(I.of(r),V(e,r,!1));else{let r=et(e,n);r&&t.push(F.of(r),V(e,r))}}return t.length>0&&e.dispatch({effects:B(e.state,t)}),!!t.length},nt=[{key:`Ctrl-Shift-[`,mac:`Cmd-Alt-[`,run:Xe},{key:`Ctrl-Shift-]`,mac:`Cmd-Alt-]`,run:Ze},{key:`Ctrl-Alt-[`,run:Qe},{key:`Ctrl-Alt-]`,run:$e}],rt={placeholderDOM:null,preparePlaceholder:null,placeholderText:`…`},H=o.define({combine(e){return c(e,rt)}});function U(e){let t=[R,lt];return e&&t.push(H.of(e)),t}function it(e,t){let{state:n}=e,r=n.facet(H),i=t=>{let n=e.lineBlockAt(e.posAtDOM(t.target)),r=z(e.state,n.from,n.to);r&&e.dispatch({effects:I.of(r)}),t.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(e,i,t);let a=document.createElement(`span`);return a.textContent=r.placeholderText,a.setAttribute(`aria-label`,n.phrase(`folded code`)),a.title=n.phrase(`unfold`),a.className=`cm-foldPlaceholder`,a.onclick=i,a}var at=m.replace({widget:new class extends te{toDOM(e){return it(e,null)}}}),ot=class extends te{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return it(e,this.value)}},st={openText:`⌄`,closedText:`›`,markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1},W=class extends ee{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement(`span`);return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?`Fold line`:`Unfold line`),t}};function ct(e={}){let n={...st,...e},r=new W(n,!0),i=new W(n,!1),a=u.fromClass(class{constructor(e){this.from=e.viewport.from,this.markers=this.buildMarkers(e)}update(e){(e.docChanged||e.viewportChanged||e.startState.facet(O)!=e.state.facet(O)||e.startState.field(R,!1)!=e.state.field(R,!1)||w(e.startState)!=w(e.state)||n.foldingChanged(e))&&(this.markers=this.buildMarkers(e.view))}buildMarkers(e){let n=new t;for(let t of e.viewportLineBlocks){let a=z(e.state,t.from,t.to)?i:P(e.state,t.from,t.to)?r:null;a&&n.add(t.from,t.from,a)}return n.finish()}}),{domEventHandlers:o}=n;return[a,ne({class:`cm-foldGutter`,markers(e){return e.plugin(a)?.markers||s.empty},initialSpacer(){return new W(n,!1)},domEventHandlers:{...o,click:(e,t,n)=>{if(o.click&&o.click(e,t,n))return!0;let r=z(e.state,t.from,t.to);if(r)return e.dispatch({effects:I.of(r)}),!0;let i=P(e.state,t.from,t.to);return i?(e.dispatch({effects:F.of(i)}),!0):!1}}}),U()]}var lt=p.baseTheme({".cm-foldPlaceholder":{backgroundColor:`#eee`,border:`1px solid #ddd`,color:`#888`,borderRadius:`.2em`,margin:`0 1px`,padding:`0 1px`,cursor:`pointer`},".cm-foldGutter span":{padding:`0 1px`,cursor:`pointer`}}),G=class e{constructor(e,t){this.specs=e;let n;function r(e){let t=l.newName();return(n||=Object.create(null))[`.`+t]=e,t}let i=typeof t.all==`string`?t.all:t.all?r(t.all):void 0,a=t.scope;this.scope=a instanceof C?e=>e.prop(x)==a.data:a?e=>e==a:void 0,this.style=re(e.map(e=>({tag:e.tag,class:e.class||r(Object.assign({},e,{tag:null}))})),{all:i}).style,this.module=n?new l(n):null,this.themeType=t.themeType}static define(t,n){return new e(t,n||{})}},K=o.define(),ut=o.define({combine(e){return e.length?[e[0]]:null}});function q(e){let t=e.facet(K);return t.length?t:e.facet(ut)}function dt(e,t){let n=[mt],r;return e instanceof G&&(e.module&&n.push(p.styleModule.of(e.module)),r=e.themeType),t?.fallback?n.push(ut.of(e)):r?n.push(K.computeN([p.darkTheme],t=>t.facet(p.darkTheme)==(r==`dark`)?[e]:[])):n.push(K.of(e)),n}function ft(e,t,n){let r=q(e),i=null;if(r){for(let e of r)if(!e.scope||n&&e.scope(n)){let n=e.style(t);n&&(i=i?i+` `+n:n)}}return i}var pt=class{constructor(e){this.markCache=Object.create(null),this.tree=w(e.state),this.decorations=this.buildDeco(e,q(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=w(e.state),n=q(e.state),r=n!=q(e.startState),{viewport:i}=e.view,a=e.changes.mapPos(this.decoratedTo,1);t.length<i.to&&!r&&t.type==this.tree.type&&a>=i.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=a):(t!=this.tree||e.viewportChanged||r)&&(this.tree=t,this.decorations=this.buildDeco(e.view,n),this.decoratedTo=i.to)}buildDeco(e,n){if(!n||!this.tree.length)return m.none;let r=new t;for(let{from:t,to:i}of e.visibleRanges)se(this.tree,n,(e,t,n)=>{r.add(e,t,this.markCache[n]||(this.markCache[n]=m.mark({class:n})))},t,i);return r.finish()}},mt=n.high(u.fromClass(pt,{decorations:e=>e.decorations})),ht=G.define([{tag:y.meta,color:`#404740`},{tag:y.link,textDecoration:`underline`},{tag:y.heading,textDecoration:`underline`,fontWeight:`bold`},{tag:y.emphasis,fontStyle:`italic`},{tag:y.strong,fontWeight:`bold`},{tag:y.strikethrough,textDecoration:`line-through`},{tag:y.keyword,color:`#708`},{tag:[y.atom,y.bool,y.url,y.contentSeparator,y.labelName],color:`#219`},{tag:[y.literal,y.inserted],color:`#164`},{tag:[y.string,y.deleted],color:`#a11`},{tag:[y.regexp,y.escape,y.special(y.string)],color:`#e40`},{tag:y.definition(y.variableName),color:`#00f`},{tag:y.local(y.variableName),color:`#30a`},{tag:[y.typeName,y.namespace],color:`#085`},{tag:y.className,color:`#167`},{tag:[y.special(y.variableName),y.macroName],color:`#256`},{tag:y.definition(y.propertyName),color:`#00c`},{tag:y.comment,color:`#940`},{tag:y.invalid,color:`#f00`}]),gt=p.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:`#328c8252`},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:`#bb555544`}}),_t=1e4,vt=`()[]{}`,yt=o.define({combine(e){return c(e,{afterCursor:!0,brackets:vt,maxScanDistance:_t,renderMatch:St})}}),bt=m.mark({class:`cm-matchingBracket`}),xt=m.mark({class:`cm-nonmatchingBracket`});function St(e){let t=[],n=e.matched?bt:xt;return t.push(n.range(e.start.from,e.start.to)),e.end&&t.push(n.range(e.end.from,e.end.to)),t}function Ct(e){let t=[],n=e.facet(yt);for(let r of e.selection.ranges){if(!r.empty)continue;let i=X(e,r.head,-1,n)||r.head>0&&X(e,r.head-1,1,n)||n.afterCursor&&(X(e,r.head,1,n)||r.head<e.doc.length&&X(e,r.head+1,-1,n));i&&(t=t.concat(n.renderMatch(i,e)))}return m.set(t,!0)}var wt=[u.fromClass(class{constructor(e){this.paused=!1,this.decorations=Ct(e.state)}update(e){(e.docChanged||e.selectionSet||this.paused)&&(e.view.composing?(this.decorations=this.decorations.map(e.changes),this.paused=!0):(this.decorations=Ct(e.state),this.paused=!1))}},{decorations:e=>e.decorations}),gt];function Tt(e={}){return[yt.of(e),wt]}var Et=new _;function J(e,t,n){let r=e.prop(t<0?_.openedBy:_.closedBy);if(r)return r;if(e.name.length==1){let r=n.indexOf(e.name);if(r>-1&&r%2==+(t<0))return[n[r+t]]}return null}function Y(e){let t=e.type.prop(Et);return t?t(e.node):e}function X(e,t,n,r={}){let i=r.maxScanDistance||_t,a=r.brackets||vt,o=w(e),s=o.resolveInner(t,n);for(let r=s;r;r=r.parent){let i=J(r.type,n,a);if(i&&r.from<r.to){let o=Y(r);if(o&&(n>0?t>=o.from&&t<o.to:t>o.from&&t<=o.to))return Dt(e,t,n,r,o,i,a)}}return Ot(e,t,n,o,s.type,i,a)}function Dt(e,t,n,r,i,a,o){let s=r.parent,c={from:i.from,to:i.to},l=0,u=s?.cursor();if(u&&(n<0?u.childBefore(r.from):u.childAfter(r.to)))do if(n<0?u.to<=r.from:u.from>=r.to){if(l==0&&a.indexOf(u.type.name)>-1&&u.from<u.to){let e=Y(u);return{start:c,end:e?{from:e.from,to:e.to}:void 0,matched:!0}}if(J(u.type,n,o))l++;else if(J(u.type,-n,o)){if(l==0){let e=Y(u);return{start:c,end:e&&e.from<e.to?{from:e.from,to:e.to}:void 0,matched:!1}}l--}}while(n<0?u.prevSibling():u.nextSibling());return{start:c,matched:!1}}function Ot(e,t,n,r,i,a,o){if(n<0?!t:t==e.doc.length)return null;let s=n<0?e.sliceDoc(t-1,t):e.sliceDoc(t,t+1),c=o.indexOf(s);if(c<0||c%2==0!=n>0)return null;let l={from:n<0?t-1:t,to:n>0?t+1:t},u=e.doc.iterRange(t,n>0?e.doc.length:0),d=0;for(let e=0;!u.next().done&&e<=a;){let a=u.value;n<0&&(e+=a.length);let s=t+e*n;for(let e=n>0?0:a.length-1,t=n>0?a.length:-1;e!=t;e+=n){let t=o.indexOf(a[e]);if(!(t<0||r.resolveInner(s+e,1).type!=i)){if(t%2==0==n>0)d++;else if(d==1)return{start:l,end:{from:s+e,to:s+e+1},matched:t>>1==c>>1};else d--}}n>0&&(e+=a.length)}return u.done?{start:l,matched:!1}:null}function kt(e){return{name:e.name||``,token:e.token,blankLine:e.blankLine||(()=>{}),startState:e.startState||(()=>!0),copyState:e.copyState||At,indent:e.indent||(()=>null),languageData:e.languageData||{},tokenTable:e.tokenTable||Lt,mergeTokens:e.mergeTokens!==!1}}function At(e){if(typeof e!=`object`)return e;let t={};for(let n in e){let r=e[n];t[n]=r instanceof Array?r.slice():r}return t}var jt=new WeakMap,Mt=class e extends C{constructor(e){let t=S(e.languageData),n=kt(e),r,i=new class extends oe{createParse(e,t,n){return new Ft(r,e,t,n)}};super(t,i,[],e.name),this.topNode=Kt(t,this),r=this,this.streamParser=n,this.stateAfter=new _({perNode:!0}),this.tokenTable=e.tokenTable?new Ht(n.tokenTable):Ut}static define(t){return new e(t)}getIndent(e){let t,{overrideIndentation:n}=e.options;n&&(t=jt.get(e.state),t!=null&&t<e.pos-1e4&&(t=void 0));let r=Z(this,e.node.tree,e.node.from,e.node.from,t??e.pos),i,a;if(r?(a=r.state,i=r.pos+1):(a=this.streamParser.startState(e.unit),i=e.node.from),e.pos-i>1e4)return null;for(;i<e.pos;){let t=e.state.doc.lineAt(i),r=Math.min(e.pos,t.to);if(t.length){let i=n?n(t.from):-1,o=new b(t.text,e.state.tabSize,e.unit,i<0?void 0:i);for(;o.pos<r-t.from;)It(this.streamParser.token,o,a)}else this.streamParser.blankLine(a,e.unit);if(r==e.pos)break;i=t.to+1}let o=e.lineAt(e.pos);return n&&t==null&&jt.set(e.state,o.from),this.streamParser.indent(a,/^\s*(.*)/.exec(o.text)[1],e)}get allowsNesting(){return!1}};function Z(e,t,n,r,i){let a=n>=r&&n+t.length<=i&&t.prop(e.stateAfter);if(a)return{state:e.streamParser.copyState(a),pos:n+t.length};for(let a=t.children.length-1;a>=0;a--){let o=t.children[a],s=n+t.positions[a],c=o instanceof v&&s<i&&Z(e,o,s,r,i);if(c)return c}return null}function Nt(e,t,n,r,i){if(i&&n<=0&&r>=t.length)return t;!i&&n==0&&t.type==e.topNode&&(i=!0);for(let a=t.children.length-1;a>=0;a--){let o=t.positions[a],s=t.children[a],c;if(o<r&&s instanceof v){if(!(c=Nt(e,s,n-o,r-o,i)))break;return i?new v(t.type,t.children.slice(0,a).concat(c),t.positions.slice(0,a+1),o+c.length):c}}return null}function Pt(e,t,n,r,i){for(let i of t){let t=i.from+(i.openStart?25:0),a=i.to-(i.openEnd?25:0),o=t<=n&&a>n&&Z(e,i.tree,0-i.offset,n,a),s;if(o&&o.pos<=r&&(s=Nt(e,i.tree,n+i.offset,o.pos+i.offset,!1)))return{state:o.state,tree:s}}return{state:e.streamParser.startState(i?A(i):4),tree:v.empty}}var Ft=class{constructor(e,t,n,r){this.lang=e,this.input=t,this.fragments=n,this.ranges=r,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=r[r.length-1].to;let i=E.get(),a=r[0].from,{state:o,tree:s}=Pt(e,n,a,this.to,i?.state);this.state=o,this.parsedPos=this.chunkStart=a+s.length;for(let e=0;e<s.children.length;e++)this.chunks.push(s.children[e]),this.chunkPos.push(s.positions[e]);i&&this.parsedPos<i.viewport.from-1e5&&r.some(e=>e.from<=i.viewport.from&&e.to>=i.viewport.from)&&(this.state=this.lang.streamParser.startState(A(i.state)),i.skipUntilInView(this.parsedPos,i.viewport.from),this.parsedPos=i.viewport.from),this.moveRangeIndex()}advance(){let e=E.get(),t=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt),n=Math.min(t,this.chunkStart+512);for(e&&(n=Math.min(n,e.viewport.to));this.parsedPos<n;)this.parseLine(e);return this.chunkStart<this.parsedPos&&this.finishChunk(),this.parsedPos>=t?this.finish():e&&this.parsedPos>=e.viewport.to?(e.skipUntilInView(this.parsedPos,t),this.finish()):null}stopAt(e){this.stoppedAt=e}lineAfter(e){let t=this.input.chunk(e);if(this.input.lineChunks)t==`
1
+ import{b as e,d as t,l as n,m as r,o as i,p as a,s as o,u as s,y as c}from"./dist-Dnr5BxAi.js";import{_ as l,a as u,f as d,i as ee,n as f,o as te,r as p,t as m,u as ne}from"./dist-CCYnr6ul.js";import{a as re,c as ie,d as h,h as g,i as ae,l as _,m as v,o as y,p as oe,r as se,u as ce}from"./dist-DPDGd2jl.js";function le(e,t,n,r=0,i=0){t??(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));let a=i;for(let i=r;i<t;i++)e.charCodeAt(i)==9?a+=n-a%n:a++;return a}var b=class{constructor(e,t,n,r){this.string=e,this.tabSize=t,this.indentUnit=n,this.overrideIndent=r,this.pos=0,this.start=0,this.lastColumnPos=0,this.lastColumnValue=0}eol(){return this.pos>=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)}eat(e){let t=this.string.charAt(this.pos),n;if(n=typeof e==`string`?t==e:t&&(e instanceof RegExp?e.test(t):e(t)),n)return++this.pos,t}eatWhile(e){let t=this.pos;for(;this.eat(e););return this.pos>t}eatSpace(){let e=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPos<this.start&&(this.lastColumnValue=le(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue}indentation(){return this.overrideIndent??le(this.string,null,this.tabSize)}match(e,t,n){if(typeof e==`string`){let r=e=>n?e.toLowerCase():e;return r(this.string.substr(this.pos,e.length))==r(e)?(t!==!1&&(this.pos+=e.length),!0):null}{let n=this.string.slice(this.pos).match(e);return n&&n.index>0?null:(n&&t!==!1&&(this.pos+=n[0].length),n)}}current(){return this.string.slice(this.start,this.pos)}},x=new _;function S(e){return o.define({combine:e?t=>t.concat(e):void 0})}var ue=new _,C=class{constructor(e,t,n=[],r=``){this.data=e,this.name=r,i.prototype.hasOwnProperty(`tree`)||Object.defineProperty(i.prototype,"tree",{get(){return w(this)}}),this.parser=t,this.extension=[O.of(this),i.languageData.of((e,t,n)=>{let r=de(e,t,n),i=r.type.prop(x);if(!i)return[];let a=e.facet(i),o=r.type.prop(ue);if(o){let i=r.resolve(t-r.from,n);for(let t of o)if(t.test(i,e)){let n=e.facet(t.facet);return t.type==`replace`?n:n.concat(a)}}return a})].concat(n)}isActiveAt(e,t,n=-1){return de(e,t,n).type.prop(x)==this.data}findRegions(e){let t=e.facet(O);if(t?.data==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let n=[],r=(e,t)=>{if(e.prop(x)==this.data){n.push({from:t,to:t+e.length});return}let i=e.prop(_.mounted);if(i){if(i.tree.prop(x)==this.data){if(i.overlay)for(let e of i.overlay)n.push({from:e.from+t,to:e.to+t});else n.push({from:t,to:t+e.length});return}if(i.overlay){let e=n.length;if(r(i.tree,i.overlay[0].from+t),n.length>e)return}}for(let n=0;n<e.children.length;n++){let i=e.children[n];i instanceof v&&r(i,e.positions[n]+t)}};return r(w(e),0),n}get allowsNesting(){return!0}};C.setState=a.define();function de(e,t,n){let r=e.facet(O),i=w(e).topNode;if(!r||r.allowsNesting)for(let e=i;e;e=e.enter(t,n,ie.ExcludeBuffers|ie.EnterBracketed))e.type.isTop&&(i=e);return i}var fe=class e extends C{constructor(e,t,n){super(e,t,[],n),this.parser=t}static define(t){let n=S(t.languageData);return new e(n,t.parser.configure({props:[x.add(e=>e.isTop?n:void 0)]}),t.name)}configure(t,n){return new e(this.data,this.parser.configure(t),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}};function w(e){let t=e.field(C.state,!1);return t?t.tree:v.empty}function pe(e,t,n=50){let r=e.field(C.state,!1)?.context;if(!r)return null;let i=r.viewport;r.updateViewport({from:0,to:t});let a=r.isDone(t)||r.work(n,t)?r.tree:null;return r.updateViewport(i),a}function me(e,t=e.doc.length){return e.field(C.state,!1)?.context.isDone(t)||!1}function he(e,t=e.viewport.to,n=100){let r=pe(e.state,t,n);return r!=w(e.state)&&e.dispatch({}),!!r}function ge(e){return e.plugin(xe)?.isWorking()||!1}var _e=class{constructor(e){this.doc=e,this.cursorPos=0,this.string=``,this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let n=this.cursorPos-this.string.length;return e<n||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}},T=null,E=class e{constructor(e,t,n=[],r,i,a,o,s){this.parser=e,this.state=t,this.fragments=n,this.tree=r,this.treeLen=i,this.viewport=a,this.skipped=o,this.scheduleOn=s,this.parse=null,this.tempSkipped=[]}static create(t,n,r){return new e(t,n,[],v.empty,0,r,[],null)}startParse(){return this.parser.startParse(new _e(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=v.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{if(typeof e==`number`){let t=Date.now()+e;e=()=>Date.now()>t}for(this.parse||=this.startParse(),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let n=this.parse.advance();if(n){if(this.fragments=this.withoutTempSkipped(g.addTree(n,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=this.parse.stoppedAt??this.state.doc.length,this.tree=n,this.parse=null,this.treeLen<(t??this.state.doc.length))this.parse=this.startParse();else return!0}if(e())return!1}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(g.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=T;T=this;try{return e()}finally{T=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=ve(e,t.from,t.to);return e}changes(t,n){let{fragments:r,tree:i,treeLen:a,viewport:o,skipped:s}=this;if(this.takeTree(),!t.empty){let e=[];if(t.iterChangedRanges((t,n,r,i)=>e.push({fromA:t,toA:n,fromB:r,toB:i})),r=g.applyChanges(r,e),i=v.empty,a=0,o={from:t.mapPos(o.from,-1),to:t.mapPos(o.to,1)},this.skipped.length){s=[];for(let e of this.skipped){let n=t.mapPos(e.from,1),r=t.mapPos(e.to,-1);n<r&&s.push({from:n,to:r})}}}return new e(this.parser,n,r,i,a,o,s,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let t=0;t<this.skipped.length;t++){let{from:n,to:r}=this.skipped[t];n<e.to&&r>e.from&&(this.fragments=ve(this.fragments,n,r),this.skipped.splice(t--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&=(this.takeTree(),null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends oe{createParse(t,n,r){let i=r[0].from,a=r[r.length-1].to;return{parsedPos:i,advance(){let t=T;if(t){for(let e of r)t.tempSkipped.push(e);e&&(t.scheduleOn=t.scheduleOn?Promise.all([t.scheduleOn,e]):e)}return this.parsedPos=a,new v(h.none,[],[],a-i)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return T}};function ve(e,t,n){return g.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}var D=class e{constructor(e){this.context=e,this.tree=e.tree}apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(t.changes,t.state),r=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,r)||n.takeTree(),new e(n)}static init(t){let n=Math.min(3e3,t.doc.length),r=E.create(t.facet(O).parser,t,{from:0,to:n});return r.work(20,n)||r.takeTree(),new e(r)}};C.state=r.define({create:D.init,update(e,t){for(let e of t.effects)if(e.is(C.setState))return e.value;return t.startState.facet(O)==t.state.facet(O)?e.apply(t):D.init(t.state)}});var ye=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<`u`&&(ye=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});var be=typeof navigator<`u`&&navigator.scheduling?.isInputPending?()=>navigator.scheduling.isInputPending():null,xe=u.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(C.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(C.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=ye(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:n,viewport:{to:r}}=this.view,i=n.field(C.state);if(i.tree==i.context.tree&&i.context.isDone(r+1e5))return;let a=Date.now()+Math.min(this.chunkBudget,100,e&&!be?Math.max(25,e.timeRemaining()-5):1e9),o=i.context.treeLen<r&&n.doc.length>r+1e3,s=i.context.work(()=>be&&be()||Date.now()>a,r+(o?0:1e5));this.chunkBudget-=Date.now()-t,(s||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:C.setState.of(new D(i.context))})),this.chunkBudget>0&&(!s||o)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(e){e.scheduleOn&&=(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(e=>d(this.view.state,e)).then(()=>this.workScheduled--),null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),O=o.define({combine(e){return e.length?e[0]:null},enables:e=>[C.state,xe,p.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]}),Se=class{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}},Ce=class e{constructor(e,t,n,r,i,a=void 0){this.name=e,this.alias=t,this.extensions=n,this.filename=r,this.loadFunc=i,this.support=a,this.loading=null}load(){return this.loading||=this.loadFunc().then(e=>this.support=e,e=>{throw this.loading=null,e})}static of(t){let{load:n,support:r}=t;if(!n){if(!r)throw RangeError(`Must pass either 'load' or 'support' to LanguageDescription.of`);n=()=>Promise.resolve(r)}return new e(t.name,(t.alias||[]).concat(t.name).map(e=>e.toLowerCase()),t.extensions||[],t.filename,n,r)}static matchFilename(e,t){for(let n of e)if(n.filename&&n.filename.test(t))return n;let n=/\.([^.]+)$/.exec(t);if(n){for(let t of e)if(t.extensions.indexOf(n[1])>-1)return t}return null}static matchLanguageName(e,t,n=!0){t=t.toLowerCase();for(let n of e)if(n.alias.some(e=>e==t))return n;if(n)for(let n of e)for(let e of n.alias){let r=t.indexOf(e);if(r>-1&&(e.length>2||!/\w/.test(t[r-1])&&!/\w/.test(t[r+e.length])))return n}return null}},we=o.define(),k=o.define({combine:e=>{if(!e.length)return` `;let t=e[0];if(!t||/\S/.test(t)||Array.from(t).some(e=>e!=t[0]))throw Error(`Invalid indent unit: `+JSON.stringify(e[0]));return t}});function A(e){let t=e.facet(k);return t.charCodeAt(0)==9?e.tabSize*t.length:t.length}function j(e,t){let n=``,r=e.tabSize,i=e.facet(k)[0];if(i==` `){for(;t>=r;)n+=` `,t-=r;i=` `}for(let e=0;e<t;e++)n+=i;return n}function M(e,t){e instanceof i&&(e=new N(e));for(let n of e.state.facet(we)){let r=n(e,t);if(r!==void 0)return r}let n=w(e.state);return n.length>=t?De(e,n,t):null}function Te(e,t,n){let r=Object.create(null),i=new N(e,{overrideIndentation:e=>r[e]??-1}),a=[];for(let o=t;o<=n;){let t=e.doc.lineAt(o);o=t.to+1;let n=M(i,t.from);if(n==null)continue;/\S/.test(t.text)||(n=0);let s=/^\s*/.exec(t.text)[0],c=j(e,n);s!=c&&(r[t.from]=n,a.push({from:t.from,to:t.from+s.length,insert:c}))}return e.changes(a)}var N=class{constructor(e,t={}){this.state=e,this.options=t,this.unit=A(e)}lineAt(e,t=1){let n=this.state.doc.lineAt(e),{simulateBreak:r,simulateDoubleBreak:i}=this.options;return r!=null&&r>=n.from&&r<=n.to?i&&r==e?{text:``,from:e}:(t<0?r<e:r<=e)?{text:n.text.slice(r-n.from),from:r}:{text:n.text.slice(0,r-n.from),from:n.from}:n}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return``;let{text:n,from:r}=this.lineAt(e,t);return n.slice(e-r,Math.min(n.length,e+100-r))}column(e,t=1){let{text:n,from:r}=this.lineAt(e,t),i=this.countColumn(n,e-r),a=this.options.overrideIndentation?this.options.overrideIndentation(r):-1;return a>-1&&(i+=a-this.countColumn(n,n.search(/\S|$/))),i}countColumn(t,n=t.length){return e(t,this.state.tabSize,n)}lineIndent(e,t=1){let{text:n,from:r}=this.lineAt(e,t),i=this.options.overrideIndentation;if(i){let e=i(r);if(e>-1)return e}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}},Ee=new _;function De(e,t,n){let r=t.resolveStack(n),i=t.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(i!=r.node){let e=[];for(let t=i;t&&!(t.from<r.node.from||t.to>r.node.to||t.from==r.node.from&&t.type==r.node.type);t=t.parent)e.push(t);for(let t=e.length-1;t>=0;t--)r={node:e[t],next:r}}return Oe(r,e,n)}function Oe(e,t,n){for(let r=e;r;r=r.next){let e=Ae(r.node);if(e)return e(Me.create(t,n,r))}return 0}function ke(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}function Ae(e){let t=e.type.prop(Ee);if(t)return t;let n=e.firstChild,r;if(n&&(r=n.type.prop(_.closedBy))){let t=e.lastChild,n=t&&r.indexOf(t.name)>-1;return e=>Ie(e,!0,1,void 0,n&&!ke(e)?t.from:void 0)}return e.parent==null?je:null}function je(){return 0}var Me=class e extends N{constructor(e,t,n){super(e.state,e.options),this.base=e,this.pos=t,this.context=n}get node(){return this.context.node}static create(t,n,r){return new e(t,n,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let n=e.resolve(t.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(Ne(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return Oe(this.context.next,this.base,this.pos)}};function Ne(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function Pe(e){let t=e.node,n=t.childAfter(t.from),r=t.lastChild;if(!n)return null;let i=e.options.simulateBreak,a=e.state.doc.lineAt(n.from),o=i==null||i<=a.from?a.to:Math.min(a.to,i);for(let e=n.to;;){let i=t.childAfter(e);if(!i||i==r)return null;if(!i.type.isSkipped){if(i.from>=o)return null;let e=/^ */.exec(a.text.slice(n.to-a.from))[0].length;return{from:n.from,to:n.to+e}}e=i.to}}function Fe({closing:e,align:t=!0,units:n=1}){return r=>Ie(r,t,n,e)}function Ie(e,t,n,r,i){let a=e.textAfter,o=a.match(/^\s*/)[0].length,s=r&&a.slice(o,o+r.length)==r||i==e.pos+o,c=t?Pe(e):null;return c?s?e.column(c.from):e.column(c.to):e.baseIndent+(s?0:e.unit*n)}var Le=e=>e.baseIndent;function Re({except:e,units:t=1}={}){return n=>{let r=e&&e.test(n.textAfter);return n.baseIndent+(r?0:t*n.unit)}}var ze=200;function Be(){return i.transactionFilter.of(e=>{if(!e.docChanged||!e.isUserEvent(`input.type`)&&!e.isUserEvent(`input.complete`))return e;let t=e.startState.languageDataAt(`indentOnInput`,e.startState.selection.main.head);if(!t.length)return e;let n=e.newDoc,{head:r}=e.newSelection.main,i=n.lineAt(r);if(r>i.from+ze)return e;let a=n.sliceString(i.from,r);if(!t.some(e=>e.test(a)))return e;let{state:o}=e,s=-1,c=[];for(let{head:e}of o.selection.ranges){let t=o.doc.lineAt(e);if(t.from==s)continue;s=t.from;let n=M(o,t.from);if(n==null)continue;let r=/^\s*/.exec(t.text)[0],i=j(o,n);r!=i&&c.push({from:t.from,to:t.from+r.length,insert:i})}return c.length?[e,{changes:c,sequential:!0}]:e})}var Ve=o.define(),He=new _;function Ue(e){let t=e.firstChild,n=e.lastChild;return t&&t.to<n.from?{from:t.to,to:n.type.isError?e.to:n.from}:null}function We(e,t,n){let r=w(e);if(r.length<n)return null;let i=r.resolveStack(n,1),a=null;for(let o=i;o;o=o.next){let i=o.node;if(i.to<=n||i.from>n)continue;if(a&&i.from<t)break;let s=i.type.prop(He);if(s&&(i.to<r.length-50||r.length==e.doc.length||!Ge(i))){let r=s(i,e);r&&r.from<=n&&r.from>=t&&r.to>n&&(a=r)}}return a}function Ge(e){let t=e.lastChild;return t&&t.to==e.to&&t.type.isError}function P(e,t,n){for(let r of e.facet(Ve)){let i=r(e,t,n);if(i)return i}return We(e,t,n)}function Ke(e,t){let n=t.mapPos(e.from,1),r=t.mapPos(e.to,-1);return n>=r?void 0:{from:n,to:r}}var F=a.define({map:Ke}),I=a.define({map:Ke});function L(e){let t=[];for(let{head:n}of e.state.selection.ranges)t.some(e=>e.from<=n&&e.to>=n)||t.push(e.lineBlockAt(n));return t}var R=r.define({create(){return m.none},update(e,t){t.isUserEvent(`delete`)&&t.changes.iterChangedRanges((t,n)=>e=qe(e,t,n)),e=e.map(t.changes);let n=[];for(let r of t.effects)r.is(F)&&!Ye(e,r.value.from,r.value.to)?n.push(r.value):r.is(I)&&(e=e.update({filter:(e,t)=>r.value.from!=e||r.value.to!=t,filterFrom:r.value.from,filterTo:r.value.to}));if(n.length){let{preparePlaceholder:r}=t.state.facet(H),i=n.map(e=>(r?m.replace({widget:new ot(r(t.state,e))}):at).range(e.from,e.to));e=e.update({add:i})}return t.selection&&(e=qe(e,t.selection.main.head)),e},provide:e=>p.decorations.from(e),toJSON(e,t){let n=[];return e.between(0,t.doc.length,(e,t)=>{n.push(e,t)}),n},fromJSON(e){if(!Array.isArray(e)||e.length%2)throw RangeError(`Invalid JSON for fold state`);let t=[];for(let n=0;n<e.length;){let r=e[n++],i=e[n++];if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid JSON for fold state`);t.push(at.range(r,i))}return m.set(t,!0)}});function qe(e,t,n=t){let r=!1;return e.between(t,n,(e,i)=>{e<n&&i>t&&(r=!0)}),r?e.update({filterFrom:t,filterTo:n,filter:(e,r)=>e>=n||r<=t}):e}function Je(e){return e.field(R,!1)||s.empty}function z(e,t,n){var r;let i=null;return(r=e.field(R,!1))==null||r.between(t,n,(e,t)=>{(!i||i.from>e)&&(i={from:e,to:t})}),i}function Ye(e,t,n){let r=!1;return e.between(t,t,(e,i)=>{e==t&&i==n&&(r=!0)}),r}function B(e,t){return e.field(R,!1)?t:t.concat(a.appendConfig.of(U()))}var Xe=e=>{for(let t of L(e)){let n=P(e.state,t.from,t.to);if(n)return e.dispatch({effects:B(e.state,[F.of(n),V(e,n)])}),!0}return!1},Ze=e=>{if(!e.state.field(R,!1))return!1;let t=[];for(let n of L(e)){let r=z(e.state,n.from,n.to);r&&t.push(I.of(r),V(e,r,!1))}return t.length&&e.dispatch({effects:t}),t.length>0};function V(e,t,n=!0){let r=e.state.doc.lineAt(t.from).number,i=e.state.doc.lineAt(t.to).number;return p.announce.of(`${e.state.phrase(n?`Folded lines`:`Unfolded lines`)} ${r} ${e.state.phrase(`to`)} ${i}.`)}var Qe=e=>{let{state:t}=e,n=[];for(let r=0;r<t.doc.length;){let i=e.lineBlockAt(r),a=P(t,i.from,i.to);a&&n.push(F.of(a)),r=(a?e.lineBlockAt(a.to):i).to+1}return n.length&&e.dispatch({effects:B(e.state,n)}),!!n.length},$e=e=>{let t=e.state.field(R,!1);if(!t||!t.size)return!1;let n=[];return t.between(0,e.state.doc.length,(e,t)=>{n.push(I.of({from:e,to:t}))}),e.dispatch({effects:n}),!0};function et(e,t){for(let n=t;;){let r=P(e.state,n.from,n.to);if(r&&r.to>t.from)return r;if(!n.from)return null;n=e.lineBlockAt(n.from-1)}}var tt=e=>{let t=[];for(let n of L(e)){let r=z(e.state,n.from,n.to);if(r)t.push(I.of(r),V(e,r,!1));else{let r=et(e,n);r&&t.push(F.of(r),V(e,r))}}return t.length>0&&e.dispatch({effects:B(e.state,t)}),!!t.length},nt=[{key:`Ctrl-Shift-[`,mac:`Cmd-Alt-[`,run:Xe},{key:`Ctrl-Shift-]`,mac:`Cmd-Alt-]`,run:Ze},{key:`Ctrl-Alt-[`,run:Qe},{key:`Ctrl-Alt-]`,run:$e}],rt={placeholderDOM:null,preparePlaceholder:null,placeholderText:`…`},H=o.define({combine(e){return c(e,rt)}});function U(e){let t=[R,lt];return e&&t.push(H.of(e)),t}function it(e,t){let{state:n}=e,r=n.facet(H),i=t=>{let n=e.lineBlockAt(e.posAtDOM(t.target)),r=z(e.state,n.from,n.to);r&&e.dispatch({effects:I.of(r)}),t.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(e,i,t);let a=document.createElement(`span`);return a.textContent=r.placeholderText,a.setAttribute(`aria-label`,n.phrase(`folded code`)),a.title=n.phrase(`unfold`),a.className=`cm-foldPlaceholder`,a.onclick=i,a}var at=m.replace({widget:new class extends te{toDOM(e){return it(e,null)}}}),ot=class extends te{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return it(e,this.value)}},st={openText:`⌄`,closedText:`›`,markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1},W=class extends ee{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement(`span`);return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?`Fold line`:`Unfold line`),t}};function ct(e={}){let n={...st,...e},r=new W(n,!0),i=new W(n,!1),a=u.fromClass(class{constructor(e){this.from=e.viewport.from,this.markers=this.buildMarkers(e)}update(e){(e.docChanged||e.viewportChanged||e.startState.facet(O)!=e.state.facet(O)||e.startState.field(R,!1)!=e.state.field(R,!1)||w(e.startState)!=w(e.state)||n.foldingChanged(e))&&(this.markers=this.buildMarkers(e.view))}buildMarkers(e){let n=new t;for(let t of e.viewportLineBlocks){let a=z(e.state,t.from,t.to)?i:P(e.state,t.from,t.to)?r:null;a&&n.add(t.from,t.from,a)}return n.finish()}}),{domEventHandlers:o}=n;return[a,ne({class:`cm-foldGutter`,markers(e){return e.plugin(a)?.markers||s.empty},initialSpacer(){return new W(n,!1)},domEventHandlers:{...o,click:(e,t,n)=>{if(o.click&&o.click(e,t,n))return!0;let r=z(e.state,t.from,t.to);if(r)return e.dispatch({effects:I.of(r)}),!0;let i=P(e.state,t.from,t.to);return i?(e.dispatch({effects:F.of(i)}),!0):!1}}}),U()]}var lt=p.baseTheme({".cm-foldPlaceholder":{backgroundColor:`#eee`,border:`1px solid #ddd`,color:`#888`,borderRadius:`.2em`,margin:`0 1px`,padding:`0 1px`,cursor:`pointer`},".cm-foldGutter span":{padding:`0 1px`,cursor:`pointer`}}),G=class e{constructor(e,t){this.specs=e;let n;function r(e){let t=l.newName();return(n||=Object.create(null))[`.`+t]=e,t}let i=typeof t.all==`string`?t.all:t.all?r(t.all):void 0,a=t.scope;this.scope=a instanceof C?e=>e.prop(x)==a.data:a?e=>e==a:void 0,this.style=re(e.map(e=>({tag:e.tag,class:e.class||r(Object.assign({},e,{tag:null}))})),{all:i}).style,this.module=n?new l(n):null,this.themeType=t.themeType}static define(t,n){return new e(t,n||{})}},K=o.define(),ut=o.define({combine(e){return e.length?[e[0]]:null}});function q(e){let t=e.facet(K);return t.length?t:e.facet(ut)}function dt(e,t){let n=[mt],r;return e instanceof G&&(e.module&&n.push(p.styleModule.of(e.module)),r=e.themeType),t?.fallback?n.push(ut.of(e)):r?n.push(K.computeN([p.darkTheme],t=>t.facet(p.darkTheme)==(r==`dark`)?[e]:[])):n.push(K.of(e)),n}function ft(e,t,n){let r=q(e),i=null;if(r){for(let e of r)if(!e.scope||n&&e.scope(n)){let n=e.style(t);n&&(i=i?i+` `+n:n)}}return i}var pt=class{constructor(e){this.markCache=Object.create(null),this.tree=w(e.state),this.decorations=this.buildDeco(e,q(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=w(e.state),n=q(e.state),r=n!=q(e.startState),{viewport:i}=e.view,a=e.changes.mapPos(this.decoratedTo,1);t.length<i.to&&!r&&t.type==this.tree.type&&a>=i.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=a):(t!=this.tree||e.viewportChanged||r)&&(this.tree=t,this.decorations=this.buildDeco(e.view,n),this.decoratedTo=i.to)}buildDeco(e,n){if(!n||!this.tree.length)return m.none;let r=new t;for(let{from:t,to:i}of e.visibleRanges)se(this.tree,n,(e,t,n)=>{r.add(e,t,this.markCache[n]||(this.markCache[n]=m.mark({class:n})))},t,i);return r.finish()}},mt=n.high(u.fromClass(pt,{decorations:e=>e.decorations})),ht=G.define([{tag:y.meta,color:`#404740`},{tag:y.link,textDecoration:`underline`},{tag:y.heading,textDecoration:`underline`,fontWeight:`bold`},{tag:y.emphasis,fontStyle:`italic`},{tag:y.strong,fontWeight:`bold`},{tag:y.strikethrough,textDecoration:`line-through`},{tag:y.keyword,color:`#708`},{tag:[y.atom,y.bool,y.url,y.contentSeparator,y.labelName],color:`#219`},{tag:[y.literal,y.inserted],color:`#164`},{tag:[y.string,y.deleted],color:`#a11`},{tag:[y.regexp,y.escape,y.special(y.string)],color:`#e40`},{tag:y.definition(y.variableName),color:`#00f`},{tag:y.local(y.variableName),color:`#30a`},{tag:[y.typeName,y.namespace],color:`#085`},{tag:y.className,color:`#167`},{tag:[y.special(y.variableName),y.macroName],color:`#256`},{tag:y.definition(y.propertyName),color:`#00c`},{tag:y.comment,color:`#940`},{tag:y.invalid,color:`#f00`}]),gt=p.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:`#328c8252`},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:`#bb555544`}}),_t=1e4,vt=`()[]{}`,yt=o.define({combine(e){return c(e,{afterCursor:!0,brackets:vt,maxScanDistance:_t,renderMatch:St})}}),bt=m.mark({class:`cm-matchingBracket`}),xt=m.mark({class:`cm-nonmatchingBracket`});function St(e){let t=[],n=e.matched?bt:xt;return t.push(n.range(e.start.from,e.start.to)),e.end&&t.push(n.range(e.end.from,e.end.to)),t}function Ct(e){let t=[],n=e.facet(yt);for(let r of e.selection.ranges){if(!r.empty)continue;let i=X(e,r.head,-1,n)||r.head>0&&X(e,r.head-1,1,n)||n.afterCursor&&(X(e,r.head,1,n)||r.head<e.doc.length&&X(e,r.head+1,-1,n));i&&(t=t.concat(n.renderMatch(i,e)))}return m.set(t,!0)}var wt=[u.fromClass(class{constructor(e){this.paused=!1,this.decorations=Ct(e.state)}update(e){(e.docChanged||e.selectionSet||this.paused)&&(e.view.composing?(this.decorations=this.decorations.map(e.changes),this.paused=!0):(this.decorations=Ct(e.state),this.paused=!1))}},{decorations:e=>e.decorations}),gt];function Tt(e={}){return[yt.of(e),wt]}var Et=new _;function J(e,t,n){let r=e.prop(t<0?_.openedBy:_.closedBy);if(r)return r;if(e.name.length==1){let r=n.indexOf(e.name);if(r>-1&&r%2==+(t<0))return[n[r+t]]}return null}function Y(e){let t=e.type.prop(Et);return t?t(e.node):e}function X(e,t,n,r={}){let i=r.maxScanDistance||_t,a=r.brackets||vt,o=w(e),s=o.resolveInner(t,n);for(let r=s;r;r=r.parent){let i=J(r.type,n,a);if(i&&r.from<r.to){let o=Y(r);if(o&&(n>0?t>=o.from&&t<o.to:t>o.from&&t<=o.to))return Dt(e,t,n,r,o,i,a)}}return Ot(e,t,n,o,s.type,i,a)}function Dt(e,t,n,r,i,a,o){let s=r.parent,c={from:i.from,to:i.to},l=0,u=s?.cursor();if(u&&(n<0?u.childBefore(r.from):u.childAfter(r.to)))do if(n<0?u.to<=r.from:u.from>=r.to){if(l==0&&a.indexOf(u.type.name)>-1&&u.from<u.to){let e=Y(u);return{start:c,end:e?{from:e.from,to:e.to}:void 0,matched:!0}}if(J(u.type,n,o))l++;else if(J(u.type,-n,o)){if(l==0){let e=Y(u);return{start:c,end:e&&e.from<e.to?{from:e.from,to:e.to}:void 0,matched:!1}}l--}}while(n<0?u.prevSibling():u.nextSibling());return{start:c,matched:!1}}function Ot(e,t,n,r,i,a,o){if(n<0?!t:t==e.doc.length)return null;let s=n<0?e.sliceDoc(t-1,t):e.sliceDoc(t,t+1),c=o.indexOf(s);if(c<0||c%2==0!=n>0)return null;let l={from:n<0?t-1:t,to:n>0?t+1:t},u=e.doc.iterRange(t,n>0?e.doc.length:0),d=0;for(let e=0;!u.next().done&&e<=a;){let a=u.value;n<0&&(e+=a.length);let s=t+e*n;for(let e=n>0?0:a.length-1,t=n>0?a.length:-1;e!=t;e+=n){let t=o.indexOf(a[e]);if(!(t<0||r.resolveInner(s+e,1).type!=i)){if(t%2==0==n>0)d++;else if(d==1)return{start:l,end:{from:s+e,to:s+e+1},matched:t>>1==c>>1};else d--}}n>0&&(e+=a.length)}return u.done?{start:l,matched:!1}:null}function kt(e){return{name:e.name||``,token:e.token,blankLine:e.blankLine||(()=>{}),startState:e.startState||(()=>!0),copyState:e.copyState||At,indent:e.indent||(()=>null),languageData:e.languageData||{},tokenTable:e.tokenTable||Lt,mergeTokens:e.mergeTokens!==!1}}function At(e){if(typeof e!=`object`)return e;let t={};for(let n in e){let r=e[n];t[n]=r instanceof Array?r.slice():r}return t}var jt=new WeakMap,Mt=class e extends C{constructor(e){let t=S(e.languageData),n=kt(e),r,i=new class extends oe{createParse(e,t,n){return new Ft(r,e,t,n)}};super(t,i,[],e.name),this.topNode=Kt(t,this),r=this,this.streamParser=n,this.stateAfter=new _({perNode:!0}),this.tokenTable=e.tokenTable?new Ht(n.tokenTable):Ut}static define(t){return new e(t)}getIndent(e){let t,{overrideIndentation:n}=e.options;n&&(t=jt.get(e.state),t!=null&&t<e.pos-1e4&&(t=void 0));let r=Z(this,e.node.tree,e.node.from,e.node.from,t??e.pos),i,a;if(r?(a=r.state,i=r.pos+1):(a=this.streamParser.startState(e.unit),i=e.node.from),e.pos-i>1e4)return null;for(;i<e.pos;){let t=e.state.doc.lineAt(i),r=Math.min(e.pos,t.to);if(t.length){let i=n?n(t.from):-1,o=new b(t.text,e.state.tabSize,e.unit,i<0?void 0:i);for(;o.pos<r-t.from;)It(this.streamParser.token,o,a)}else this.streamParser.blankLine(a,e.unit);if(r==e.pos)break;i=t.to+1}let o=e.lineAt(e.pos);return n&&t==null&&jt.set(e.state,o.from),this.streamParser.indent(a,/^\s*(.*)/.exec(o.text)[1],e)}get allowsNesting(){return!1}};function Z(e,t,n,r,i){let a=n>=r&&n+t.length<=i&&t.prop(e.stateAfter);if(a)return{state:e.streamParser.copyState(a),pos:n+t.length};for(let a=t.children.length-1;a>=0;a--){let o=t.children[a],s=n+t.positions[a],c=o instanceof v&&s<i&&Z(e,o,s,r,i);if(c)return c}return null}function Nt(e,t,n,r,i){if(i&&n<=0&&r>=t.length)return t;!i&&n==0&&t.type==e.topNode&&(i=!0);for(let a=t.children.length-1;a>=0;a--){let o=t.positions[a],s=t.children[a],c;if(o<r&&s instanceof v){if(!(c=Nt(e,s,n-o,r-o,i)))break;return i?new v(t.type,t.children.slice(0,a).concat(c),t.positions.slice(0,a+1),o+c.length):c}}return null}function Pt(e,t,n,r,i){for(let i of t){let t=i.from+(i.openStart?25:0),a=i.to-(i.openEnd?25:0),o=t<=n&&a>n&&Z(e,i.tree,0-i.offset,n,a),s;if(o&&o.pos<=r&&(s=Nt(e,i.tree,n+i.offset,o.pos+i.offset,!1)))return{state:o.state,tree:s}}return{state:e.streamParser.startState(i?A(i):4),tree:v.empty}}var Ft=class{constructor(e,t,n,r){this.lang=e,this.input=t,this.fragments=n,this.ranges=r,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=r[r.length-1].to;let i=E.get(),a=r[0].from,{state:o,tree:s}=Pt(e,n,a,this.to,i?.state);this.state=o,this.parsedPos=this.chunkStart=a+s.length;for(let e=0;e<s.children.length;e++)this.chunks.push(s.children[e]),this.chunkPos.push(s.positions[e]);i&&this.parsedPos<i.viewport.from-1e5&&r.some(e=>e.from<=i.viewport.from&&e.to>=i.viewport.from)&&(this.state=this.lang.streamParser.startState(A(i.state)),i.skipUntilInView(this.parsedPos,i.viewport.from),this.parsedPos=i.viewport.from),this.moveRangeIndex()}advance(){let e=E.get(),t=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt),n=Math.min(t,this.chunkStart+512);for(e&&(n=Math.min(n,e.viewport.to));this.parsedPos<n;)this.parseLine(e);return this.chunkStart<this.parsedPos&&this.finishChunk(),this.parsedPos>=t?this.finish():e&&this.parsedPos>=e.viewport.to?(e.skipUntilInView(this.parsedPos,t),this.finish()):null}stopAt(e){this.stoppedAt=e}lineAfter(e){let t=this.input.chunk(e);if(this.input.lineChunks)t==`
2
2
  `&&(t=``);else{let e=t.indexOf(`
3
3
  `);e>-1&&(t=t.slice(0,e))}return e+t.length<=this.to?t:t.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,t=this.lineAfter(e),n=e+t.length;for(let e=this.rangeIndex;;){let r=this.ranges[e].to;if(r>=n||(t=t.slice(0,r-(n-t.length)),e++,e==this.ranges.length))break;let i=this.ranges[e].from,a=this.lineAfter(i);t+=a,n=i+a.length}return{line:t,end:n}}skipGapsTo(e,t,n){for(;;){let r=this.ranges[this.rangeIndex].to,i=e+t;if(n>0?r>i:r>=i)break;let a=this.ranges[++this.rangeIndex].from;t+=a-r}return t}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}emitToken(e,t,n,r){let i=4;if(this.ranges.length>1){r=this.skipGapsTo(t,r,1),t+=r;let e=this.chunk.length;r=this.skipGapsTo(n,r,-1),n+=r,i+=this.chunk.length-e}let a=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&i==4&&a>=0&&this.chunk[a]==e&&this.chunk[a+2]==t?this.chunk[a+2]=n:this.chunk.push(e,t,n,i),r}parseLine(e){let{line:t,end:n}=this.nextLine(),r=0,{streamParser:i}=this.lang,a=new b(t,e?e.state.tabSize:4,e?A(e.state):2);if(a.eol())i.blankLine(this.state,a.indentUnit);else for(;!a.eol();){let e=It(i.token,a,this.state);if(e&&(r=this.emitToken(this.lang.tokenTable.resolve(e),this.parsedPos+a.start,this.parsedPos+a.pos,r)),a.start>1e4)break}this.parsedPos=n,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}finishChunk(){let e=v.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:Rt,topID:0,maxBufferLength:512,reused:this.chunkReused});e=new v(e.type,e.children,e.positions,e.length,[[this.lang.stateAfter,this.lang.streamParser.copyState(this.state)]]),this.chunks.push(e),this.chunkPos.push(this.chunkStart-this.ranges[0].from),this.chunk=[],this.chunkReused=void 0,this.chunkStart=this.parsedPos}finish(){return new v(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}};function It(e,t,n){t.start=t.pos;for(let r=0;r<10;r++){let r=e(t,n);if(t.pos>t.start)return r}throw Error(`Stream parser failed to advance stream.`)}var Lt=Object.create(null),Q=[h.none],Rt=new ce(Q),zt=[],Bt=Object.create(null),Vt=Object.create(null);for(let[e,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`]])Vt[e]=Gt(Lt,t);var Ht=class{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),Vt)}resolve(e){return e?this.table[e]||(this.table[e]=Gt(this.extra,e)):0}},Ut=new Ht(Lt);function Wt(e,t){zt.indexOf(e)>-1||(zt.push(e),console.warn(t))}function Gt(e,t){let n=[];for(let r of t.split(` `)){let t=[];for(let n of r.split(`.`)){let r=e[n]||y[n];r?typeof r==`function`?t.length?t=t.map(r):Wt(n,`Modifier ${n} used at start of tag`):t.length?Wt(n,`Tag ${n} used as modifier`):t=Array.isArray(r)?r:[r]:Wt(n,`Unknown highlighting tag ${n}`)}for(let e of t)n.push(e)}if(!n.length)return 0;let r=t.replace(/ /g,`_`),i=r+` `+n.map(e=>e.id),a=Bt[i];if(a)return a.id;let o=Bt[i]=h.define({id:Q.length,name:r,props:[ae({[r]:n})]});return Q.push(o),o.id}function Kt(e,t){let n=h.define({id:Q.length,name:`Document`,props:[x.add(()=>e),Ee.add(()=>e=>t.getIndent(e))],top:!0});return Q.push(n),n}function qt(e){return e.length<=4096&&/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/.test(e)}function Jt(e){for(let t=e.iter();!t.next().done;)if(qt(t.value))return!0;return!1}function Yt(e){let t=!1;return e.iterChanges((e,n,r,i,a)=>{!t&&Jt(a)&&(t=!0)}),t}var $=o.define({combine:e=>e.some(e=>e)});function Xt(e={}){let t=[Zt];return e.alwaysIsolate&&t.push($.of(!0)),t}var Zt=u.fromClass(class{constructor(e){this.always=e.state.facet($)||e.textDirection!=f.LTR||e.state.facet(p.perLineTextDirection),this.hasRTL=!this.always&&Jt(e.state.doc),this.tree=w(e.state),this.decorations=this.always||this.hasRTL?Qt(e,this.tree,this.always):m.none}update(e){let t=e.state.facet($)||e.view.textDirection!=f.LTR||e.state.facet(p.perLineTextDirection);if(!t&&!this.hasRTL&&Yt(e.changes)&&(this.hasRTL=!0),!t&&!this.hasRTL)return;let n=w(e.state);(t!=this.always||n!=this.tree||e.docChanged||e.viewportChanged)&&(this.tree=n,this.always=t,this.decorations=Qt(e.view,n,t))}},{provide:e=>{function t(t){return t.plugin(e)?.decorations??m.none}return[p.outerDecorations.of(t),n.lowest(p.bidiIsolatedRanges.of(t))]}});function Qt(e,n,r){let i=new t,a=e.visibleRanges;r||(a=$t(a,e.state.doc));for(let{from:e,to:t}of a)n.iterate({enter:e=>{let t=e.type.prop(_.isolate);t&&i.add(e.from,e.to,en[t])},from:e,to:t});return i.finish()}function $t(e,t){let n=t.iter(),r=0,i=[],a=null;for(let{from:t,to:o}of e)if(!(a&&a.to>t&&(t=a.to,t>=o)))for(r+n.value.length<t&&(n.next(t-(r+n.value.length)),r=t);;){let e=r,t=r+n.value.length;if(!n.lineBreak&&qt(n.value)&&(a&&a.to>e-10?a.to=Math.min(o,t):i.push(a={from:e,to:Math.min(o,t)})),t>=o)break;r=t,n.next()}return i}var en={rtl:m.mark({class:`cm-iso`,inclusive:!0,attributes:{dir:`rtl`},bidiIsolate:f.RTL}),ltr:m.mark({class:`cm-iso`,inclusive:!0,attributes:{dir:`ltr`},bidiIsolate:f.LTR}),auto:m.mark({class:`cm-iso`,inclusive:!0,attributes:{dir:`auto`},bidiIsolate:null})};export{_e as DocInput,G as HighlightStyle,N as IndentContext,fe as LRLanguage,C as Language,Ce as LanguageDescription,Se as LanguageSupport,E as ParseContext,Mt as StreamLanguage,b as StringStream,Me as TreeIndentContext,Xt as bidiIsolates,Tt as bracketMatching,Et as bracketMatchingHandle,U as codeFolding,Re as continuedIndent,ht as defaultHighlightStyle,S as defineLanguageFacet,Fe as delimitedIndent,pe as ensureSyntaxTree,Le as flatIndent,Qe as foldAll,Xe as foldCode,F as foldEffect,ct as foldGutter,Ue as foldInside,nt as foldKeymap,He as foldNodeProp,Ve as foldService,R as foldState,P as foldable,Je as foldedRanges,he as forceParsing,A as getIndentUnit,M as getIndentation,ft as highlightingFor,Ee as indentNodeProp,Be as indentOnInput,Te as indentRange,we as indentService,j as indentString,k as indentUnit,O as language,x as languageDataProp,X as matchBrackets,ue as sublanguageProp,dt as syntaxHighlighting,ge as syntaxParserRunning,w as syntaxTree,me as syntaxTreeAvailable,tt as toggleFold,$e as unfoldAll,Ze as unfoldCode,I as unfoldEffect};