code-playpad 0.10.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/README.md +218 -17
  2. package/dist/THIRD-PARTY-NOTICES.txt +223 -0
  3. package/dist/cdn.js +2 -2
  4. package/dist/compiler-B408qd3N.js +151 -0
  5. package/dist/{config-CT3H6Oum.js → config-DB58UVsk.js} +1 -1
  6. package/dist/{cpp-CO2abWii.js → cpp-C77X5wRk.js} +1 -1
  7. package/dist/{cpp-Cs32J8JC.js → cpp-DuOQ_23Z.js} +1 -1
  8. package/dist/{dist-DXjodKfp.js → dist-B4dyQ4mN.js} +1 -1
  9. package/dist/{dist-BkpKCrXQ.js → dist-BFlbXnjn.js} +1 -1
  10. package/dist/dist-BoJapv5W.js +28 -0
  11. package/dist/dist-BqLa1O1y.js +6 -0
  12. package/dist/dist-CJRlQ049.js +6 -0
  13. package/dist/{dist-CJxiVI4a.js → dist-DBpvb9b1.js} +1 -1
  14. package/dist/{dist-BIgiGgKu.js → dist-DRocX-cv.js} +1 -1
  15. package/dist/dist-DfjaG4Ra.js +6 -0
  16. package/dist/{dist-D2igTc4m.js → dist-DviSDQoT.js} +1 -1
  17. package/dist/dist-F28mE6nM.js +8 -0
  18. package/dist/{dist-CNOK8CHE.js → dist-TxeNlzAy.js} +1 -1
  19. package/dist/dist-y6lcdYKh.js +14 -0
  20. package/dist/element-COcjM0hI.js +521 -0
  21. package/dist/element.d.ts +26 -0
  22. package/dist/element.js +1 -1
  23. package/dist/hints-DpBIeoeG.js +6 -0
  24. package/dist/index.d.ts +3 -3
  25. package/dist/index.js +1 -1
  26. package/dist/{java-DeBiVPXO.js → java-Df5HdXMz.js} +1 -1
  27. package/dist/{java-8qjVCjsN.js → java-DyH3mSiH.js} +1 -1
  28. package/dist/{javascript-DLPaJJzf.js → javascript-BtHVyxzg.js} +2 -2
  29. package/dist/{javascript-B1tVx7AD.js → javascript-CWolHiSP.js} +1 -1
  30. package/dist/languages.d.ts +1 -1
  31. package/dist/{pyodide-BOoYEfX1.js → pyodide-3MPS4ySA.js} +2 -2
  32. package/dist/{pyodide-C8ImkXdD.js → pyodide-EUDn__Gx.js} +1 -1
  33. package/dist/react-CL1KABFm.js +9 -0
  34. package/dist/react-Db_rGDYu.js +4 -0
  35. package/dist/react-runtime-19.2.8.js +240 -0
  36. package/dist/react-vendor.generated-DMxIoCMn.js +6 -0
  37. package/dist/react-version.generated-BNNJmf7J.js +6 -0
  38. package/dist/react.d.ts +5 -1
  39. package/dist/react.js +1 -1
  40. package/dist/runtime/config.d.ts +15 -1
  41. package/dist/runtime/react/boot.d.ts +9 -0
  42. package/dist/runtime/react/compiler.d.ts +30 -0
  43. package/dist/runtime/react-vendor.generated.d.ts +5 -0
  44. package/dist/runtime/react-version.generated.d.ts +3 -0
  45. package/dist/runtime/react.d.ts +2 -0
  46. package/dist/standalone.js +214 -17
  47. package/dist/{hints-CCMgezw9.js → types-CfcYqU2K.js} +1 -1
  48. package/dist/types.d.ts +23 -0
  49. package/dist/worker-runtime-DvpugeXD.js +9 -0
  50. package/dist/{worker-runtime-sUPz1J56.js → worker-runtime-PykJQLB7.js} +1 -1
  51. package/package.json +21 -6
  52. package/dist/dist--J_vhCIU.js +0 -14
  53. package/dist/dist-BNvM_BAY.js +0 -6
  54. package/dist/dist-D7jBL3Ib.js +0 -28
  55. package/dist/dist-DfFrsBkU.js +0 -8
  56. package/dist/element-CQGYVEF7.js +0 -324
  57. package/dist/worker-runtime-DfYet3xy.js +0 -9
@@ -3,4 +3,4 @@
3
3
  * Bundles CodeMirror 6 and Lezer (MIT) © Marijn Haverbeke and others.
4
4
  * Full third-party licences: THIRD-PARTY-NOTICES.txt in this package.
5
5
  */
6
- import{a as e,i as t,l as n,o as r,r as i,s as a,u as o}from"./dist-DfFrsBkU.js";var s=class e{constructor(e,t,n,r,i,a,o,s,c,l=0,u){this.p=e,this.stack=t,this.state=n,this.reducePos=r,this.pos=i,this.score=a,this.buffer=o,this.bufferBase=s,this.curContext=c,this.lookAhead=l,this.parent=u}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?`!`+this.score:``}`}static start(t,n,r=0){let i=t.parser.context;return new e(t,[],n,r,r,0,[],0,i?new c(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){let t=e>>19,n=e&65535,{parser:r}=this.p,i=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),a=r.dynamicPrecedence(n);if(a&&(this.score+=a),t==0){n<r.minRepeatTerm&&this.reducePos<this.pos&&(this.reducePos=this.pos),this.pushState(r.getGoto(this.state,n,!0),this.reducePos),n<r.minRepeatTerm&&this.storeNode(n,this.reducePos,this.reducePos,i?8:4,!0),this.reduceContext(n,this.reducePos);return}let o=this.stack.length-(t-1)*3-(e&262144?6:0),s=o?this.stack[o-2]:this.p.ranges[0].from;n<r.minRepeatTerm&&s==this.reducePos&&this.reducePos<this.pos&&(this.reducePos=this.pos);let c=this.reducePos-s;c>=2e3&&!this.p.parser.nodeSet.types[n]?.isAnonymous&&(s==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSize<c&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=s,this.p.lastBigReductionSize=c));let l=o?this.stack[o-1]:0,u=this.bufferBase+this.buffer.length-l;if(n<r.minRepeatTerm||e&131072){let e=r.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(n,s,e,u+4,!0)}if(e&262144)this.state=this.stack[o];else{let e=this.stack[o-3];this.state=r.getGoto(e,n,!0)}for(;this.stack.length>o;)this.stack.pop();this.reduceContext(n,s)}storeNode(e,t,n,r=4,i=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let e=this.buffer.length;if(e>0&&this.buffer[e-4]==0&&this.buffer[e-1]>-1){if(t==n)return;if(this.buffer[e-2]>=t){this.buffer[e-2]=n;return}}}if(!i||this.pos==n)this.buffer.push(e,t,n,r);else{let i=this.buffer.length;if(i>0&&(this.buffer[i-4]!=0||this.buffer[i-1]<0)){let e=!1;for(let t=i;t>0&&this.buffer[t-2]>n;t-=4)if(this.buffer[t-1]>=0){e=!0;break}if(e)for(;i>0&&this.buffer[i-2]>n;)this.buffer[i]=this.buffer[i-4],this.buffer[i+1]=this.buffer[i-3],this.buffer[i+2]=this.buffer[i-2],this.buffer[i+3]=this.buffer[i-1],i-=4,r>4&&(r-=4)}this.buffer[i]=e,this.buffer[i+1]=t,this.buffer[i+2]=n,this.buffer[i+3]=r}}shift(e,t,n,r){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=r,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,r,4);else{let i=e,{parser:a}=this.p;this.pos=r;let o=a.stateFlag(i,1);!o&&(r>n||t<=a.maxNode)&&(this.reducePos=r),this.pushState(i,o?n:Math.min(n,this.reducePos)),this.shiftContext(t,n),t<=a.maxNode&&this.buffer.push(t,n,r,4)}}apply(e,t,n,r){e&65536?this.reduce(e):this.shift(e,t,n,r)}useNode(e,t){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let r=this.pos;this.reducePos=this.pos=r+e.length,this.pushState(t,r),this.buffer.push(n,r,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let t=this,n=t.buffer.length;for(n&&t.buffer[n-4]==0&&(n-=4);n>0&&t.buffer[n-2]>t.reducePos;)n-=4;let r=t.buffer.slice(n),i=t.bufferBase+n;for(;t&&i==t.bufferBase;)t=t.parent;return new e(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,i,this.curContext,this.lookAhead,t)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new l(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(n==0)return!1;if(!(n&65536))return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let n=[];for(let r=0,i;r<t.length;r+=2)(i=t[r+1])!=this.state&&this.p.parser.hasAction(i,e)&&n.push(t[r],i);if(this.stack.length<120)for(let e=0;n.length<8&&e<t.length;e+=2){let r=t[e+1];n.some((e,t)=>t&1&&e==r)||n.push(t[e],r)}t=n}let n=[];for(let e=0;e<t.length&&n.length<4;e+=2){let r=t[e+1];if(r==this.state)continue;let i=this.split();i.pushState(r,this.pos),i.storeNode(0,i.pos,i.pos,4,!0),i.shiftContext(t[e],this.pos),i.reducePos=this.pos,i.score-=200,n.push(i)}return n}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if(!(t&65536))return!1;if(!e.validAction(this.state,t)){let n=t>>19,r=t&65535,i=this.stack.length-n*3;if(i<0||e.getGoto(this.stack[i],r,!1)<0){let e=this.findForcedReduction();if(e==null)return!1;t=e}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(r,i)=>{if(!t.includes(r))return t.push(r),e.allActions(r,t=>{if(!(t&393216)){if(t&65536){let n=(t>>19)-i;if(n>1){let r=t&65535,i=this.stack.length-n*3;if(i>=0&&e.getGoto(this.stack[i],r,!1)>=0)return n<<19|65536|r}}else{let e=n(t,i+1);if(e!=null)return e}}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new c(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){return e<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=e,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}},c=class{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}},l=class{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3;let r=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=r}},u=class e{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(t,n=t.bufferBase+t.buffer.length){return new e(t,n,n-t.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new e(this.stack,this.pos,this.index)}};function d(e,t=Uint16Array){if(typeof e!=`string`)return e;let n=null;for(let r=0,i=0;r<e.length;){let a=0;for(;;){let t=e.charCodeAt(r++),n=!1;if(t==126){a=65535;break}t>=92&&t--,t>=34&&t--;let i=t-32;if(i>=46&&(i-=46,n=!0),a+=i,n)break;a*=46}n?n[i++]=a:n=new t(a)}return n}var f=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}},p=new f,m=class{constructor(e,t){this.input=e,this.ranges=t,this.chunk=``,this.chunkOff=0,this.chunk2=``,this.chunk2Pos=0,this.next=-1,this.token=p,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,r=this.rangeIndex,i=this.pos+e;for(;i<n.from;){if(!r)return null;let e=this.ranges[--r];i-=n.from-e.to,n=e}for(;t<0?i>n.to:i>=n.to;){if(r==this.ranges.length-1)return null;let e=this.ranges[++r];i+=e.from-n.to,n=e}return i}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,n,r;if(t>=0&&t<this.chunk.length)n=this.pos+e,r=this.chunk.charCodeAt(t);else{let t=this.resolveOffset(e,1);if(t==null)return-1;if(n=t,n>=this.chunk2Pos&&n<this.chunk2Pos+this.chunk2.length)r=this.chunk2.charCodeAt(n-this.chunk2Pos);else{let e=this.rangeIndex,t=this.range;for(;t.to<=n;)t=this.ranges[++e];this.chunk2=this.input.chunk(this.chunk2Pos=n),n+this.chunk2.length>t.to&&(this.chunk2=this.chunk2.slice(0,t.to-n)),r=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),r}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(n==null||n<this.token.start)throw RangeError(`Token end out of bounds`);this.token.value=e,this.token.end=n}acceptTokenTo(e,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.next=this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?-1:this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk=``,this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=p,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk=``,this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n=``;for(let r of this.ranges){if(r.from>=t)break;r.to>e&&(n+=this.input.read(Math.max(r.from,e),Math.min(r.to,t)))}return n}},h=class{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;v(this.data,e,t,this.id,n.data,n.tokenPrecTable)}};h.prototype.contextual=h.prototype.fallback=h.prototype.extend=!1;var g=class{constructor(e,t,n){this.precTable=t,this.elseToken=n,this.data=typeof e==`string`?d(e):e}token(e,t){let n=e.pos,r=0;for(;;){let n=e.next<0,i=e.resolveOffset(1,1);if(v(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(n||r++,i==null)break;e.reset(i,e.token)}r&&(e.reset(n,e.token),e.acceptToken(this.elseToken,r))}};g.prototype.contextual=h.prototype.fallback=h.prototype.extend=!1;var _=class{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}};function v(e,t,n,r,i,a){let o=0,s=1<<r,{dialect:c}=n.p.parser;scan:for(;(s&e[o])!=0;){let n=e[o+1];for(let r=o+3;r<n;r+=2)if((e[r+1]&s)>0){let n=e[r];if(c.allows(n)&&(t.token.value==-1||t.token.value==n||b(n,t.token.value,i,a))){t.acceptToken(n);break}}let r=t.next,l=0,u=e[o+2];if(t.next<0&&u>l&&e[n+u*3-3]==65535){o=e[n+u*3-1];continue scan}for(;l<u;){let i=l+u>>1,a=n+i+(i<<1),s=e[a],c=e[a+1]||65536;if(r<s)u=i;else if(r>=c)l=i+1;else{o=e[a+2],t.advance();continue scan}}break}}function y(e,t,n){for(let r=t,i;(i=e[r])!=65535;r++)if(i==n)return r-t;return-1}function b(e,t,n,r){let i=y(n,r,t);return i<0||y(n,r,e)<i}var x=typeof process<`u`&&process.env&&/\bparse\b/.test(process.env.LOG),S=null;function C(e,n,r){let i=e.cursor(t.IncludeAnonymous);for(i.moveTo(n);;)if(!(r<0?i.childBefore(n):i.childAfter(n)))for(;;){if((r<0?i.to<n:i.from>n)&&!i.type.isError)return r<0?Math.max(0,Math.min(i.to-1,n-25)):Math.min(e.length,Math.max(i.from+1,n+25));if(r<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return r<0?0:e.length}}var w=class{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?C(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?C(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(t<this.nextStart)return null;for(;this.fragment&&this.safeTo<=t;)this.nextFragment();if(!this.fragment)return null;for(;;){let n=this.trees.length-1;if(n<0)return this.nextFragment(),null;let r=this.trees[n],i=this.index[n];if(i==r.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let a=r.children[i],s=this.start[n]+r.positions[i];if(s>t)return this.nextStart=s,null;if(a instanceof o){if(s==t){if(s<this.safeFrom)return null;let t=s+a.length;if(t<=this.safeTo){let n=a.prop(e.lookAhead);if(!n||t+n<this.fragment.to)return a}}this.index[n]++,s+a.length>=Math.max(this.safeFrom,t)&&(this.trees.push(a),this.start.push(s),this.index.push(0))}else this.index[n]++,this.nextStart=s+a.length}}},T=class{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(e=>new f)}getActions(e){let t=0,n=null,{parser:r}=e.p,{tokenizers:i}=r,a=r.stateSlot(e.state,3),o=e.curContext?e.curContext.hash:0,s=0;for(let r=0;r<i.length;r++){if(!(1<<r&a))continue;let c=i[r],l=this.tokens[r];if((!n||c.fallback)&&((c.contextual||l.start!=e.pos||l.mask!=a||l.context!=o)&&(this.updateCachedToken(l,c,e),l.mask=a,l.context=o),l.lookAhead>l.end+25&&(s=Math.max(l.lookAhead,s)),l.value!=0)){let r=t;if(l.extended>-1&&(t=this.addActions(e,l.extended,l.end,t)),t=this.addActions(e,l.value,l.end,t),!c.extend&&(n=l,t>r))break}}for(;this.actions.length>t;)this.actions.pop();return s&&e.setLookAhead(s),!n&&e.pos==this.stream.end&&(n=new f,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new f,{pos:n,p:r}=e;return t.start=n,t.end=Math.min(n+1,r.stream.end),t.value=n==r.stream.end?r.parser.eofTerm:0,t}updateCachedToken(e,t,n){let r=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(r,e),n),e.value>-1){let{parser:t}=n.p;for(let r=0;r<t.specialized.length;r++)if(t.specialized[r]==e.value){let i=t.specializers[r](this.stream.read(e.start,e.end),n);if(i>=0&&n.p.parser.dialect.allows(i>>1)){i&1?e.extended=i>>1:e.value=i>>1;break}}}else e.value=0,e.end=this.stream.clipPos(r+1)}putAction(e,t,n,r){for(let t=0;t<r;t+=3)if(this.actions[t]==e)return r;return this.actions[r++]=e,this.actions[r++]=t,this.actions[r++]=n,r}addActions(e,t,n,r){let{state:i}=e,{parser:a}=e.p,{data:o}=a;for(let e=0;e<2;e++)for(let s=a.stateSlot(i,e?2:1);;s+=3){if(o[s]==65535){if(o[s+1]==1)s=M(o,s+2);else{r==0&&o[s+1]==2&&(r=this.putAction(M(o,s+2),t,n,r));break}}o[s]==t&&(r=this.putAction(M(o,s+1),t,n,r))}return r}},E=class{constructor(e,t,n,r){this.parser=e,this.input=t,this.ranges=r,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new m(t,r),this.tokens=new T(e,this.stream),this.topTerm=e.top[1];let{from:i}=r[0];this.stacks=[s.start(this,e.top[0],i)],this.fragments=n.length&&this.stream.end-i>e.bufferLength*4?new w(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,n=this.stacks=[],r,i;if(this.bigReductionCount>300&&e.length==1){let[t]=e;for(;t.forceReduce()&&t.stack.length&&t.stack[t.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let a=0;a<e.length;a++){let o=e[a];for(;;){if(this.tokens.mainToken=null,o.pos>t)n.push(o);else if(this.advanceStack(o,n,e))continue;else{r||(r=[],i=[]),r.push(o);let e=this.tokens.getMainToken(o);i.push(e.value,e.end)}break}}if(!n.length){let e=r&&N(r);if(e)return x&&console.log(`Finish with `+this.stackID(e)),this.stackToTree(e);if(this.parser.strict)throw x&&r&&console.log(`Stuck with token `+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):`none`)),SyntaxError(`No parse at `+t);this.recovering||=5}if(this.recovering&&r){let e=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,i,n);if(e)return x&&console.log(`Force-finish `+this.stackID(e)),this.stackToTree(e.forceAll())}if(this.recovering){let e=this.recovering==1?1:this.recovering*3;if(n.length>e)for(n.sort((e,t)=>t.score-e.score);n.length>e;)n.pop();n.some(e=>e.reducePos>t)&&this.recovering--}else if(n.length>1){outer:for(let e=0;e<n.length-1;e++){let t=n[e];for(let r=e+1;r<n.length;r++){let i=n[r];if(t.sameState(i)||t.buffer.length>500&&i.buffer.length>500){if((t.score-i.score||t.buffer.length-i.buffer.length)>0)n.splice(r--,1);else{n.splice(e--,1);continue outer}}}}n.length>12&&(n.sort((e,t)=>t.score-e.score),n.splice(12,n.length-12))}this.minStackPos=n[0].pos;for(let e=1;e<n.length;e++)n[e].pos<this.minStackPos&&(this.minStackPos=n[e].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw RangeError(`Can't move stoppedAt forward`);this.stoppedAt=e}advanceStack(t,n,r){let i=t.pos,{parser:a}=this,s=x?this.stackID(t)+` -> `:``;if(this.stoppedAt!=null&&i>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let n=t.curContext&&t.curContext.tracker.strict,r=n?t.curContext.hash:0;for(let c=this.fragments.nodeAt(i);c;){let i=this.parser.nodeSet.types[c.type.id]==c.type?a.getGoto(t.state,c.type.id):-1;if(i>-1&&c.length&&(!n||(c.prop(e.contextHash)||0)==r))return t.useNode(c,i),x&&console.log(s+this.stackID(t)+` (via reuse of ${a.getName(c.type.id)})`),!0;if(!(c instanceof o)||c.children.length==0||c.positions[0]>0)break;let l=c.children[0];if(l instanceof o&&c.positions[0]==0)c=l;else break}}let c=a.stateSlot(t.state,4);if(c>0)return t.reduce(c),x&&console.log(s+this.stackID(t)+` (via always-reduce ${a.getName(c&65535)})`),!0;if(t.stack.length>=8400)for(;t.stack.length>6e3&&t.forceReduce(););let l=this.tokens.getActions(t);for(let e=0;e<l.length;){let o=l[e++],c=l[e++],u=l[e++],d=e==l.length||!r,f=d?t:t.split(),p=this.tokens.mainToken;if(f.apply(o,c,p?p.start:f.pos,u),x&&console.log(s+this.stackID(f)+` (via ${o&65536?`reduce of ${a.getName(o&65535)}`:`shift`} for ${a.getName(c)} @ ${i}${f==t?``:`, split`})`),d)return!0;f.pos>i?n.push(f):r.push(f)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return D(e,t),!0}}runRecovery(e,t,n){let r=null,i=!1;for(let a=0;a<e.length;a++){let o=e[a],s=t[a<<1],c=t[(a<<1)+1],l=x?this.stackID(o)+` -> `:``;if(o.deadEnd&&(i||(i=!0,o.restart(),x&&console.log(l+this.stackID(o)+` (restarted)`),this.advanceFully(o,n))))continue;let u=o.split(),d=l;for(let e=0;e<10&&u.forceReduce()&&(x&&console.log(d+this.stackID(u)+` (via force-reduce)`),!this.advanceFully(u,n));e++)x&&(d=this.stackID(u)+` -> `);for(let e of o.recoverByInsert(s))x&&console.log(l+this.stackID(e)+` (via recover-insert)`),this.advanceFully(e,n);this.stream.end>o.pos?(c==o.pos&&(c++,s=0),o.recoverByDelete(s,c),x&&console.log(l+this.stackID(o)+` (via recover-delete ${this.parser.getName(s)})`),D(o,n)):(!r||r.score<u.score)&&(r=u)}return r}stackToTree(e){return e.close(),o.build({buffer:u.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(S||=/* @__PURE__ */ new WeakMap).get(e);return t||S.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}};function D(e,t){for(let n=0;n<t.length;n++){let r=t[n];if(r.pos==e.pos&&r.sameState(e)){t[n].score<e.score&&(t[n]=e);return}}t.push(e)}var O=class{constructor(e,t,n){this.source=e,this.flags=t,this.disabled=n}allows(e){return!this.disabled||this.disabled[e]==0}},k=e=>e,A=class{constructor(e){this.start=e.start,this.shift=e.shift||k,this.reduce=e.reduce||k,this.reuse=e.reuse||k,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}},j=class t extends n{constructor(t){if(super(),this.wrappers=[],t.version!=14)throw RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let n=t.nodeNames.split(` `);this.minRepeatTerm=n.length;for(let e=0;e<t.repeatNodeCount;e++)n.push(``);let o=Object.keys(t.topRules).map(e=>t.topRules[e][1]),s=[];for(let e=0;e<n.length;e++)s.push([]);function c(e,t,n){s[e].push([t,t.deserialize(String(n))])}if(t.nodeProps)for(let n of t.nodeProps){let t=n[0];typeof t==`string`&&(t=e[t]);for(let e=1;e<n.length;){let r=n[e++];if(r>=0)c(r,t,n[e++]);else{let i=n[e+-r];for(let a=-r;a>0;a--)c(n[e++],t,i);e++}}}this.nodeSet=new r(n.map((e,n)=>a.define({name:n>=this.minRepeatTerm?void 0:e,id:n,props:s[n],top:o.indexOf(n)>-1,error:n==0,skipped:t.skippedNodes&&t.skippedNodes.indexOf(n)>-1}))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=i;let l=d(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let e=0;e<this.specializerSpecs.length;e++)this.specialized[e]=this.specializerSpecs[e].term;this.specializers=this.specializerSpecs.map(P),this.states=d(t.states,Uint32Array),this.data=d(t.stateData),this.goto=d(t.goto),this.maxTerm=t.maxTerm,this.tokenizers=t.tokenizers.map(e=>typeof e==`number`?new h(l,e):e),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let r=new E(this,e,t,n);for(let i of this.wrappers)r=i(r,e,t,n);return r}getGoto(e,t,n=!1){let r=this.goto;if(t>=r[0])return-1;for(let i=r[t+1];;){let t=r[i++],a=t&1,o=r[i++];if(a&&n)return o;for(let n=i+(t>>1);i<n;i++)if(r[i]==e)return o;if(a)return-1}}hasAction(e,t){let n=this.data;for(let r=0;r<2;r++)for(let i=this.stateSlot(e,r?2:1),a;;i+=3){if((a=n[i])==65535){if(n[i+1]==1)a=n[i=M(n,i+2)];else if(n[i+1]==2)return M(n,i+2);else break}if(a==t||a==0)return M(n,i+1)}return 0}stateSlot(e,t){return this.states[e*6+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,e=>e==t||null)}allActions(e,t){let n=this.stateSlot(e,4),r=n?t(n):void 0;for(let n=this.stateSlot(e,1);r==null;n+=3){if(this.data[n]==65535){if(this.data[n+1]==1)n=M(this.data,n+2);else break}r=t(M(this.data,n+1))}return r}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535){if(this.data[n+1]==1)n=M(this.data,n+2);else break}if(!(this.data[n+2]&1)){let e=this.data[n+1];t.some((t,n)=>n&1&&t==e)||t.push(this.data[n],e)}}return t}configure(e){let n=Object.assign(Object.create(t.prototype),this);if(e.props&&(n.nodeSet=this.nodeSet.extend(...e.props)),e.top){let t=this.topRules[e.top];if(!t)throw RangeError(`Invalid top rule name ${e.top}`);n.top=t}return e.tokenizers&&(n.tokenizers=this.tokenizers.map(t=>{let n=e.tokenizers.find(e=>e.from==t);return n?n.to:t})),e.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((t,r)=>{let i=e.specializers.find(e=>e.from==t.external);if(!i)return t;let a=Object.assign(Object.assign({},t),{external:i.to});return n.specializers[r]=P(a),a})),e.contextTracker&&(n.context=e.contextTracker),e.dialect&&(n.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(n.strict=e.strict),e.wrap&&(n.wrappers=n.wrappers.concat(e.wrap)),e.bufferLength!=null&&(n.bufferLength=e.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map(()=>!1);if(e)for(let r of e.split(` `)){let e=t.indexOf(r);e>=0&&(n[e]=!0)}let r=null;for(let e=0;e<t.length;e++)if(!n[e])for(let n=this.dialects[t[e]],i;(i=this.data[n++])!=65535;)(r||=new Uint8Array(this.maxTerm+1))[i]=1;return new O(e,n,r)}static deserialize(e){return new t(e)}};function M(e,t){return e[t]|e[t+1]<<16}function N(e){let t=null;for(let n of e){let e=n.p.stoppedAt;(n.pos==n.p.stream.end||e!=null&&n.pos>e)&&n.p.parser.stateFlag(n.state,2)&&(!t||t.score<n.score)&&(t=n)}return t}function P(e){if(e.external){let t=+!!e.extend;return(n,r)=>e.external(n,r)<<1|t}return e.get}export{g as i,_ as n,j as r,A as t};
6
+ import{a as e,i as t,l as n,o as r,r as i,s as a,u as o}from"./dist-F28mE6nM.js";var s=class e{constructor(e,t,n,r,i,a,o,s,c,l=0,u){this.p=e,this.stack=t,this.state=n,this.reducePos=r,this.pos=i,this.score=a,this.buffer=o,this.bufferBase=s,this.curContext=c,this.lookAhead=l,this.parent=u}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?`!`+this.score:``}`}static start(t,n,r=0){let i=t.parser.context;return new e(t,[],n,r,r,0,[],0,i?new c(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){let t=e>>19,n=e&65535,{parser:r}=this.p,i=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),a=r.dynamicPrecedence(n);if(a&&(this.score+=a),t==0){n<r.minRepeatTerm&&this.reducePos<this.pos&&(this.reducePos=this.pos),this.pushState(r.getGoto(this.state,n,!0),this.reducePos),n<r.minRepeatTerm&&this.storeNode(n,this.reducePos,this.reducePos,i?8:4,!0),this.reduceContext(n,this.reducePos);return}let o=this.stack.length-(t-1)*3-(e&262144?6:0),s=o?this.stack[o-2]:this.p.ranges[0].from;n<r.minRepeatTerm&&s==this.reducePos&&this.reducePos<this.pos&&(this.reducePos=this.pos);let c=this.reducePos-s;c>=2e3&&!this.p.parser.nodeSet.types[n]?.isAnonymous&&(s==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSize<c&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=s,this.p.lastBigReductionSize=c));let l=o?this.stack[o-1]:0,u=this.bufferBase+this.buffer.length-l;if(n<r.minRepeatTerm||e&131072){let e=r.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(n,s,e,u+4,!0)}if(e&262144)this.state=this.stack[o];else{let e=this.stack[o-3];this.state=r.getGoto(e,n,!0)}for(;this.stack.length>o;)this.stack.pop();this.reduceContext(n,s)}storeNode(e,t,n,r=4,i=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let e=this.buffer.length;if(e>0&&this.buffer[e-4]==0&&this.buffer[e-1]>-1){if(t==n)return;if(this.buffer[e-2]>=t){this.buffer[e-2]=n;return}}}if(!i||this.pos==n)this.buffer.push(e,t,n,r);else{let i=this.buffer.length;if(i>0&&(this.buffer[i-4]!=0||this.buffer[i-1]<0)){let e=!1;for(let t=i;t>0&&this.buffer[t-2]>n;t-=4)if(this.buffer[t-1]>=0){e=!0;break}if(e)for(;i>0&&this.buffer[i-2]>n;)this.buffer[i]=this.buffer[i-4],this.buffer[i+1]=this.buffer[i-3],this.buffer[i+2]=this.buffer[i-2],this.buffer[i+3]=this.buffer[i-1],i-=4,r>4&&(r-=4)}this.buffer[i]=e,this.buffer[i+1]=t,this.buffer[i+2]=n,this.buffer[i+3]=r}}shift(e,t,n,r){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=r,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,r,4);else{let i=e,{parser:a}=this.p;this.pos=r;let o=a.stateFlag(i,1);!o&&(r>n||t<=a.maxNode)&&(this.reducePos=r),this.pushState(i,o?n:Math.min(n,this.reducePos)),this.shiftContext(t,n),t<=a.maxNode&&this.buffer.push(t,n,r,4)}}apply(e,t,n,r){e&65536?this.reduce(e):this.shift(e,t,n,r)}useNode(e,t){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let r=this.pos;this.reducePos=this.pos=r+e.length,this.pushState(t,r),this.buffer.push(n,r,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let t=this,n=t.buffer.length;for(n&&t.buffer[n-4]==0&&(n-=4);n>0&&t.buffer[n-2]>t.reducePos;)n-=4;let r=t.buffer.slice(n),i=t.bufferBase+n;for(;t&&i==t.bufferBase;)t=t.parent;return new e(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,i,this.curContext,this.lookAhead,t)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new l(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(n==0)return!1;if(!(n&65536))return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let n=[];for(let r=0,i;r<t.length;r+=2)(i=t[r+1])!=this.state&&this.p.parser.hasAction(i,e)&&n.push(t[r],i);if(this.stack.length<120)for(let e=0;n.length<8&&e<t.length;e+=2){let r=t[e+1];n.some((e,t)=>t&1&&e==r)||n.push(t[e],r)}t=n}let n=[];for(let e=0;e<t.length&&n.length<4;e+=2){let r=t[e+1];if(r==this.state)continue;let i=this.split();i.pushState(r,this.pos),i.storeNode(0,i.pos,i.pos,4,!0),i.shiftContext(t[e],this.pos),i.reducePos=this.pos,i.score-=200,n.push(i)}return n}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if(!(t&65536))return!1;if(!e.validAction(this.state,t)){let n=t>>19,r=t&65535,i=this.stack.length-n*3;if(i<0||e.getGoto(this.stack[i],r,!1)<0){let e=this.findForcedReduction();if(e==null)return!1;t=e}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(r,i)=>{if(!t.includes(r))return t.push(r),e.allActions(r,t=>{if(!(t&393216)){if(t&65536){let n=(t>>19)-i;if(n>1){let r=t&65535,i=this.stack.length-n*3;if(i>=0&&e.getGoto(this.stack[i],r,!1)>=0)return n<<19|65536|r}}else{let e=n(t,i+1);if(e!=null)return e}}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new c(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){return e<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=e,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}},c=class{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}},l=class{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3;let r=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=r}},u=class e{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(t,n=t.bufferBase+t.buffer.length){return new e(t,n,n-t.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new e(this.stack,this.pos,this.index)}};function d(e,t=Uint16Array){if(typeof e!=`string`)return e;let n=null;for(let r=0,i=0;r<e.length;){let a=0;for(;;){let t=e.charCodeAt(r++),n=!1;if(t==126){a=65535;break}t>=92&&t--,t>=34&&t--;let i=t-32;if(i>=46&&(i-=46,n=!0),a+=i,n)break;a*=46}n?n[i++]=a:n=new t(a)}return n}var f=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}},p=new f,m=class{constructor(e,t){this.input=e,this.ranges=t,this.chunk=``,this.chunkOff=0,this.chunk2=``,this.chunk2Pos=0,this.next=-1,this.token=p,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,r=this.rangeIndex,i=this.pos+e;for(;i<n.from;){if(!r)return null;let e=this.ranges[--r];i-=n.from-e.to,n=e}for(;t<0?i>n.to:i>=n.to;){if(r==this.ranges.length-1)return null;let e=this.ranges[++r];i+=e.from-n.to,n=e}return i}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,n,r;if(t>=0&&t<this.chunk.length)n=this.pos+e,r=this.chunk.charCodeAt(t);else{let t=this.resolveOffset(e,1);if(t==null)return-1;if(n=t,n>=this.chunk2Pos&&n<this.chunk2Pos+this.chunk2.length)r=this.chunk2.charCodeAt(n-this.chunk2Pos);else{let e=this.rangeIndex,t=this.range;for(;t.to<=n;)t=this.ranges[++e];this.chunk2=this.input.chunk(this.chunk2Pos=n),n+this.chunk2.length>t.to&&(this.chunk2=this.chunk2.slice(0,t.to-n)),r=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),r}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(n==null||n<this.token.start)throw RangeError(`Token end out of bounds`);this.token.value=e,this.token.end=n}acceptTokenTo(e,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.next=this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?-1:this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk=``,this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=p,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk=``,this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n=``;for(let r of this.ranges){if(r.from>=t)break;r.to>e&&(n+=this.input.read(Math.max(r.from,e),Math.min(r.to,t)))}return n}},h=class{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;v(this.data,e,t,this.id,n.data,n.tokenPrecTable)}};h.prototype.contextual=h.prototype.fallback=h.prototype.extend=!1;var g=class{constructor(e,t,n){this.precTable=t,this.elseToken=n,this.data=typeof e==`string`?d(e):e}token(e,t){let n=e.pos,r=0;for(;;){let n=e.next<0,i=e.resolveOffset(1,1);if(v(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(n||r++,i==null)break;e.reset(i,e.token)}r&&(e.reset(n,e.token),e.acceptToken(this.elseToken,r))}};g.prototype.contextual=h.prototype.fallback=h.prototype.extend=!1;var _=class{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}};function v(e,t,n,r,i,a){let o=0,s=1<<r,{dialect:c}=n.p.parser;scan:for(;(s&e[o])!=0;){let n=e[o+1];for(let r=o+3;r<n;r+=2)if((e[r+1]&s)>0){let n=e[r];if(c.allows(n)&&(t.token.value==-1||t.token.value==n||b(n,t.token.value,i,a))){t.acceptToken(n);break}}let r=t.next,l=0,u=e[o+2];if(t.next<0&&u>l&&e[n+u*3-3]==65535){o=e[n+u*3-1];continue scan}for(;l<u;){let i=l+u>>1,a=n+i+(i<<1),s=e[a],c=e[a+1]||65536;if(r<s)u=i;else if(r>=c)l=i+1;else{o=e[a+2],t.advance();continue scan}}break}}function y(e,t,n){for(let r=t,i;(i=e[r])!=65535;r++)if(i==n)return r-t;return-1}function b(e,t,n,r){let i=y(n,r,t);return i<0||y(n,r,e)<i}var x=typeof process<`u`&&process.env&&/\bparse\b/.test(process.env.LOG),S=null;function C(e,n,r){let i=e.cursor(t.IncludeAnonymous);for(i.moveTo(n);;)if(!(r<0?i.childBefore(n):i.childAfter(n)))for(;;){if((r<0?i.to<n:i.from>n)&&!i.type.isError)return r<0?Math.max(0,Math.min(i.to-1,n-25)):Math.min(e.length,Math.max(i.from+1,n+25));if(r<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return r<0?0:e.length}}var w=class{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?C(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?C(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(t<this.nextStart)return null;for(;this.fragment&&this.safeTo<=t;)this.nextFragment();if(!this.fragment)return null;for(;;){let n=this.trees.length-1;if(n<0)return this.nextFragment(),null;let r=this.trees[n],i=this.index[n];if(i==r.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let a=r.children[i],s=this.start[n]+r.positions[i];if(s>t)return this.nextStart=s,null;if(a instanceof o){if(s==t){if(s<this.safeFrom)return null;let t=s+a.length;if(t<=this.safeTo){let n=a.prop(e.lookAhead);if(!n||t+n<this.fragment.to)return a}}this.index[n]++,s+a.length>=Math.max(this.safeFrom,t)&&(this.trees.push(a),this.start.push(s),this.index.push(0))}else this.index[n]++,this.nextStart=s+a.length}}},T=class{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(e=>new f)}getActions(e){let t=0,n=null,{parser:r}=e.p,{tokenizers:i}=r,a=r.stateSlot(e.state,3),o=e.curContext?e.curContext.hash:0,s=0;for(let r=0;r<i.length;r++){if(!(1<<r&a))continue;let c=i[r],l=this.tokens[r];if((!n||c.fallback)&&((c.contextual||l.start!=e.pos||l.mask!=a||l.context!=o)&&(this.updateCachedToken(l,c,e),l.mask=a,l.context=o),l.lookAhead>l.end+25&&(s=Math.max(l.lookAhead,s)),l.value!=0)){let r=t;if(l.extended>-1&&(t=this.addActions(e,l.extended,l.end,t)),t=this.addActions(e,l.value,l.end,t),!c.extend&&(n=l,t>r))break}}for(;this.actions.length>t;)this.actions.pop();return s&&e.setLookAhead(s),!n&&e.pos==this.stream.end&&(n=new f,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new f,{pos:n,p:r}=e;return t.start=n,t.end=Math.min(n+1,r.stream.end),t.value=n==r.stream.end?r.parser.eofTerm:0,t}updateCachedToken(e,t,n){let r=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(r,e),n),e.value>-1){let{parser:t}=n.p;for(let r=0;r<t.specialized.length;r++)if(t.specialized[r]==e.value){let i=t.specializers[r](this.stream.read(e.start,e.end),n);if(i>=0&&n.p.parser.dialect.allows(i>>1)){i&1?e.extended=i>>1:e.value=i>>1;break}}}else e.value=0,e.end=this.stream.clipPos(r+1)}putAction(e,t,n,r){for(let t=0;t<r;t+=3)if(this.actions[t]==e)return r;return this.actions[r++]=e,this.actions[r++]=t,this.actions[r++]=n,r}addActions(e,t,n,r){let{state:i}=e,{parser:a}=e.p,{data:o}=a;for(let e=0;e<2;e++)for(let s=a.stateSlot(i,e?2:1);;s+=3){if(o[s]==65535){if(o[s+1]==1)s=M(o,s+2);else{r==0&&o[s+1]==2&&(r=this.putAction(M(o,s+2),t,n,r));break}}o[s]==t&&(r=this.putAction(M(o,s+1),t,n,r))}return r}},E=class{constructor(e,t,n,r){this.parser=e,this.input=t,this.ranges=r,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new m(t,r),this.tokens=new T(e,this.stream),this.topTerm=e.top[1];let{from:i}=r[0];this.stacks=[s.start(this,e.top[0],i)],this.fragments=n.length&&this.stream.end-i>e.bufferLength*4?new w(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,n=this.stacks=[],r,i;if(this.bigReductionCount>300&&e.length==1){let[t]=e;for(;t.forceReduce()&&t.stack.length&&t.stack[t.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let a=0;a<e.length;a++){let o=e[a];for(;;){if(this.tokens.mainToken=null,o.pos>t)n.push(o);else if(this.advanceStack(o,n,e))continue;else{r||(r=[],i=[]),r.push(o);let e=this.tokens.getMainToken(o);i.push(e.value,e.end)}break}}if(!n.length){let e=r&&N(r);if(e)return x&&console.log(`Finish with `+this.stackID(e)),this.stackToTree(e);if(this.parser.strict)throw x&&r&&console.log(`Stuck with token `+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):`none`)),SyntaxError(`No parse at `+t);this.recovering||=5}if(this.recovering&&r){let e=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,i,n);if(e)return x&&console.log(`Force-finish `+this.stackID(e)),this.stackToTree(e.forceAll())}if(this.recovering){let e=this.recovering==1?1:this.recovering*3;if(n.length>e)for(n.sort((e,t)=>t.score-e.score);n.length>e;)n.pop();n.some(e=>e.reducePos>t)&&this.recovering--}else if(n.length>1){outer:for(let e=0;e<n.length-1;e++){let t=n[e];for(let r=e+1;r<n.length;r++){let i=n[r];if(t.sameState(i)||t.buffer.length>500&&i.buffer.length>500){if((t.score-i.score||t.buffer.length-i.buffer.length)>0)n.splice(r--,1);else{n.splice(e--,1);continue outer}}}}n.length>12&&(n.sort((e,t)=>t.score-e.score),n.splice(12,n.length-12))}this.minStackPos=n[0].pos;for(let e=1;e<n.length;e++)n[e].pos<this.minStackPos&&(this.minStackPos=n[e].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw RangeError(`Can't move stoppedAt forward`);this.stoppedAt=e}advanceStack(t,n,r){let i=t.pos,{parser:a}=this,s=x?this.stackID(t)+` -> `:``;if(this.stoppedAt!=null&&i>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let n=t.curContext&&t.curContext.tracker.strict,r=n?t.curContext.hash:0;for(let c=this.fragments.nodeAt(i);c;){let i=this.parser.nodeSet.types[c.type.id]==c.type?a.getGoto(t.state,c.type.id):-1;if(i>-1&&c.length&&(!n||(c.prop(e.contextHash)||0)==r))return t.useNode(c,i),x&&console.log(s+this.stackID(t)+` (via reuse of ${a.getName(c.type.id)})`),!0;if(!(c instanceof o)||c.children.length==0||c.positions[0]>0)break;let l=c.children[0];if(l instanceof o&&c.positions[0]==0)c=l;else break}}let c=a.stateSlot(t.state,4);if(c>0)return t.reduce(c),x&&console.log(s+this.stackID(t)+` (via always-reduce ${a.getName(c&65535)})`),!0;if(t.stack.length>=8400)for(;t.stack.length>6e3&&t.forceReduce(););let l=this.tokens.getActions(t);for(let e=0;e<l.length;){let o=l[e++],c=l[e++],u=l[e++],d=e==l.length||!r,f=d?t:t.split(),p=this.tokens.mainToken;if(f.apply(o,c,p?p.start:f.pos,u),x&&console.log(s+this.stackID(f)+` (via ${o&65536?`reduce of ${a.getName(o&65535)}`:`shift`} for ${a.getName(c)} @ ${i}${f==t?``:`, split`})`),d)return!0;f.pos>i?n.push(f):r.push(f)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return D(e,t),!0}}runRecovery(e,t,n){let r=null,i=!1;for(let a=0;a<e.length;a++){let o=e[a],s=t[a<<1],c=t[(a<<1)+1],l=x?this.stackID(o)+` -> `:``;if(o.deadEnd&&(i||(i=!0,o.restart(),x&&console.log(l+this.stackID(o)+` (restarted)`),this.advanceFully(o,n))))continue;let u=o.split(),d=l;for(let e=0;e<10&&u.forceReduce()&&(x&&console.log(d+this.stackID(u)+` (via force-reduce)`),!this.advanceFully(u,n));e++)x&&(d=this.stackID(u)+` -> `);for(let e of o.recoverByInsert(s))x&&console.log(l+this.stackID(e)+` (via recover-insert)`),this.advanceFully(e,n);this.stream.end>o.pos?(c==o.pos&&(c++,s=0),o.recoverByDelete(s,c),x&&console.log(l+this.stackID(o)+` (via recover-delete ${this.parser.getName(s)})`),D(o,n)):(!r||r.score<u.score)&&(r=u)}return r}stackToTree(e){return e.close(),o.build({buffer:u.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(S||=/* @__PURE__ */ new WeakMap).get(e);return t||S.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}};function D(e,t){for(let n=0;n<t.length;n++){let r=t[n];if(r.pos==e.pos&&r.sameState(e)){t[n].score<e.score&&(t[n]=e);return}}t.push(e)}var O=class{constructor(e,t,n){this.source=e,this.flags=t,this.disabled=n}allows(e){return!this.disabled||this.disabled[e]==0}},k=e=>e,A=class{constructor(e){this.start=e.start,this.shift=e.shift||k,this.reduce=e.reduce||k,this.reuse=e.reuse||k,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}},j=class t extends n{constructor(t){if(super(),this.wrappers=[],t.version!=14)throw RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let n=t.nodeNames.split(` `);this.minRepeatTerm=n.length;for(let e=0;e<t.repeatNodeCount;e++)n.push(``);let o=Object.keys(t.topRules).map(e=>t.topRules[e][1]),s=[];for(let e=0;e<n.length;e++)s.push([]);function c(e,t,n){s[e].push([t,t.deserialize(String(n))])}if(t.nodeProps)for(let n of t.nodeProps){let t=n[0];typeof t==`string`&&(t=e[t]);for(let e=1;e<n.length;){let r=n[e++];if(r>=0)c(r,t,n[e++]);else{let i=n[e+-r];for(let a=-r;a>0;a--)c(n[e++],t,i);e++}}}this.nodeSet=new r(n.map((e,n)=>a.define({name:n>=this.minRepeatTerm?void 0:e,id:n,props:s[n],top:o.indexOf(n)>-1,error:n==0,skipped:t.skippedNodes&&t.skippedNodes.indexOf(n)>-1}))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=i;let l=d(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let e=0;e<this.specializerSpecs.length;e++)this.specialized[e]=this.specializerSpecs[e].term;this.specializers=this.specializerSpecs.map(P),this.states=d(t.states,Uint32Array),this.data=d(t.stateData),this.goto=d(t.goto),this.maxTerm=t.maxTerm,this.tokenizers=t.tokenizers.map(e=>typeof e==`number`?new h(l,e):e),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let r=new E(this,e,t,n);for(let i of this.wrappers)r=i(r,e,t,n);return r}getGoto(e,t,n=!1){let r=this.goto;if(t>=r[0])return-1;for(let i=r[t+1];;){let t=r[i++],a=t&1,o=r[i++];if(a&&n)return o;for(let n=i+(t>>1);i<n;i++)if(r[i]==e)return o;if(a)return-1}}hasAction(e,t){let n=this.data;for(let r=0;r<2;r++)for(let i=this.stateSlot(e,r?2:1),a;;i+=3){if((a=n[i])==65535){if(n[i+1]==1)a=n[i=M(n,i+2)];else if(n[i+1]==2)return M(n,i+2);else break}if(a==t||a==0)return M(n,i+1)}return 0}stateSlot(e,t){return this.states[e*6+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,e=>e==t||null)}allActions(e,t){let n=this.stateSlot(e,4),r=n?t(n):void 0;for(let n=this.stateSlot(e,1);r==null;n+=3){if(this.data[n]==65535){if(this.data[n+1]==1)n=M(this.data,n+2);else break}r=t(M(this.data,n+1))}return r}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535){if(this.data[n+1]==1)n=M(this.data,n+2);else break}if(!(this.data[n+2]&1)){let e=this.data[n+1];t.some((t,n)=>n&1&&t==e)||t.push(this.data[n],e)}}return t}configure(e){let n=Object.assign(Object.create(t.prototype),this);if(e.props&&(n.nodeSet=this.nodeSet.extend(...e.props)),e.top){let t=this.topRules[e.top];if(!t)throw RangeError(`Invalid top rule name ${e.top}`);n.top=t}return e.tokenizers&&(n.tokenizers=this.tokenizers.map(t=>{let n=e.tokenizers.find(e=>e.from==t);return n?n.to:t})),e.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((t,r)=>{let i=e.specializers.find(e=>e.from==t.external);if(!i)return t;let a=Object.assign(Object.assign({},t),{external:i.to});return n.specializers[r]=P(a),a})),e.contextTracker&&(n.context=e.contextTracker),e.dialect&&(n.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(n.strict=e.strict),e.wrap&&(n.wrappers=n.wrappers.concat(e.wrap)),e.bufferLength!=null&&(n.bufferLength=e.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map(()=>!1);if(e)for(let r of e.split(` `)){let e=t.indexOf(r);e>=0&&(n[e]=!0)}let r=null;for(let e=0;e<t.length;e++)if(!n[e])for(let n=this.dialects[t[e]],i;(i=this.data[n++])!=65535;)(r||=new Uint8Array(this.maxTerm+1))[i]=1;return new O(e,n,r)}static deserialize(e){return new t(e)}};function M(e,t){return e[t]|e[t+1]<<16}function N(e){let t=null;for(let n of e){let e=n.p.stoppedAt;(n.pos==n.p.stream.end||e!=null&&n.pos>e)&&n.p.parser.stateFlag(n.state,2)&&(!t||t.score<n.score)&&(t=n)}return t}function P(e){if(e.external){let t=+!!e.extend;return(n,r)=>e.external(n,r)<<1|t}return e.get}export{g as i,_ as n,j as r,A as t};
@@ -0,0 +1,6 @@
1
+ /*!
2
+ * code-playpad — MIT © 2026 Seung Hun Lee
3
+ * Bundles CodeMirror 6 and Lezer (MIT) © Marijn Haverbeke and others.
4
+ * Full third-party licences: THIRD-PARTY-NOTICES.txt in this package.
5
+ */
6
+ import{a as e}from"./dist-D25hs99E.js";import{r as t}from"./dist-Vr-fb58P.js";import{LRLanguage as n,LanguageSupport as r,bracketMatchingHandle as i,d as a,foldNodeProp as o,indentNodeProp as s,n as c,syntaxTree as l,t as ee}from"./dist-F28mE6nM.js";import{n as u,r as te,t as ne}from"./dist-DRocX-cv.js";import{css as re,cssLanguage as d}from"./dist-BqLa1O1y.js";import{javascript as ie,javascriptLanguage as f,jsxLanguage as ae,tsxLanguage as oe,typescriptLanguage as se}from"./dist-BoJapv5W.js";var ce=55,le=1,ue=56,de=2,fe=57,pe=3,p=4,me=5,m=6,h=7,he=8,g=9,_=10,ge=11,_e=12,ve=13,v=58,ye=14,be=15,y=59,b=21,xe=23,x=24,Se=25,S=27,C=28,Ce=29,we=32,Te=35,Ee=37,De=38,Oe=0,ke=1,Ae={area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},je={dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},w={dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}};function Me(e){return e==45||e==46||e==58||e>=65&&e<=90||e==95||e>=97&&e<=122||e>=161}var T=null,E=null,D=0;function O(e,t){let n=e.pos+t;if(D==n&&E==e)return T;let r=e.peek(t),i=``;for(;Me(r);)i+=String.fromCharCode(r),r=e.peek(++t);return E=e,D=n,T=i?i.toLowerCase():r==Ne||r==Pe?void 0:null}var k=60,A=62,j=47,Ne=63,Pe=33,Fe=45;function M(e,t){this.name=e,this.parent=t}var Ie=[m,_,h,he,g],Le=new ne({start:null,shift(e,t,n,r){return Ie.indexOf(t)>-1?new M(O(r,1)||``,e):e},reduce(e,t){return t==b&&e?e.parent:e},reuse(e,t,n,r){let i=t.type.id;return i==m||i==Ee?new M(O(r,1)||``,e):e},strict:!1}),Re=new u((e,t)=>{if(e.next!=k){e.next<0&&t.context&&e.acceptToken(v);return}e.advance();let n=e.next==j;n&&e.advance();let r=O(e,0);if(r===void 0)return;if(!r)return e.acceptToken(n?be:ye);let i=t.context?t.context.name:null;if(n){if(r==i)return e.acceptToken(ge);if(i&&je[i])return e.acceptToken(v,-2);if(t.dialectEnabled(Oe))return e.acceptToken(_e);for(let e=t.context;e;e=e.parent)if(e.name==r)return;e.acceptToken(ve)}else{if(r==`script`)return e.acceptToken(h);if(r==`style`)return e.acceptToken(he);if(r==`textarea`)return e.acceptToken(g);if(Ae.hasOwnProperty(r))return e.acceptToken(_);i&&w[i]&&w[i][r]?e.acceptToken(v,-1):e.acceptToken(m)}},{contextual:!0}),ze=new u(e=>{for(let t=0,n=0;;n++){if(e.next<0){n&&e.acceptToken(y);break}if(e.next==Fe)t++;else if(e.next==A&&t>=2){n>=3&&e.acceptToken(y,-2);break}else t=0;e.advance()}});function Be(e){for(;e;e=e.parent)if(e.name==`svg`||e.name==`math`)return!0;return!1}var Ve=new u((e,t)=>{if(e.next==j&&e.peek(1)==A){let n=t.dialectEnabled(ke)||Be(t.context);e.acceptToken(n?me:p,2)}else e.next==A&&e.acceptToken(p,1)});function N(e,t,n){let r=2+e.length;return new u(i=>{for(let a=0,o=0,s=0;;s++){if(i.next<0){s&&i.acceptToken(t);break}if(a==0&&i.next==k||a==1&&i.next==j||a>=2&&a<r&&i.next==e.charCodeAt(a-2))a++,o++;else if(a==r&&i.next==A){s>o?i.acceptToken(t,-o):i.acceptToken(n,-(o-2));break}else if((i.next==10||i.next==13)&&s){i.acceptToken(t,1);break}else a=o=0;i.advance()}})}var He=N(`script`,ce,le),Ue=N(`style`,ue,de),We=N(`textarea`,fe,pe),Ge=ee({"Text RawText IncompleteTag IncompleteCloseTag":c.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":c.angleBracket,TagName:c.tagName,"MismatchedCloseTag/TagName":[c.tagName,c.invalid],AttributeName:c.attributeName,"AttributeValue UnquotedAttributeValue":c.attributeValue,Is:c.definitionOperator,"EntityReference CharacterReference":c.character,Comment:c.blockComment,ProcessingInst:c.processingInstruction,DoctypeDecl:c.documentMeta}),Ke=te.deserialize({version:14,states:",xOVO!rOOO!ZQ#tO'#CrO!`Q#tO'#C{O!eQ#tO'#DOO!jQ#tO'#DRO!oQ#tO'#DTO!tOaO'#CqO#PObO'#CqO#[OdO'#CqO$kO!rO'#CqOOO`'#Cq'#CqO$rO$fO'#DUO$zQ#tO'#DWO%PQ#tO'#DXOOO`'#Dl'#DlOOO`'#DZ'#DZQVO!rOOO%UQ&rO,59^O%aQ&rO,59gO%lQ&rO,59jO%wQ&rO,59mO&SQ&rO,59oOOOa'#D_'#D_O&_OaO'#CyO&jOaO,59]OOOb'#D`'#D`O&rObO'#C|O&}ObO,59]OOOd'#Da'#DaO'VOdO'#DPO'bOdO,59]OOO`'#Db'#DbO'jO!rO,59]O'qQ#tO'#DSOOO`,59],59]OOOp'#Dc'#DcO'vO$fO,59pOOO`,59p,59pO(OQ#|O,59rO(TQ#|O,59sOOO`-E7X-E7XO(YQ&rO'#CtOOQW'#D['#D[O(hQ&rO1G.xOOOa1G.x1G.xOOO`1G/Z1G/ZO(sQ&rO1G/ROOOb1G/R1G/RO)OQ&rO1G/UOOOd1G/U1G/UO)ZQ&rO1G/XOOO`1G/X1G/XO)fQ&rO1G/ZOOOa-E7]-E7]O)qQ#tO'#CzOOO`1G.w1G.wOOOb-E7^-E7^O)vQ#tO'#C}OOOd-E7_-E7_O){Q#tO'#DQOOO`-E7`-E7`O*QQ#|O,59nOOOp-E7a-E7aOOO`1G/[1G/[OOO`1G/^1G/^OOO`1G/_1G/_O*VQ,UO,59`OOQW-E7Y-E7YOOOa7+$d7+$dOOO`7+$u7+$uOOOb7+$m7+$mOOOd7+$p7+$pOOO`7+$s7+$sO*bQ#|O,59fO*gQ#|O,59iO*lQ#|O,59lOOO`1G/Y1G/YO*qO7[O'#CwO+SOMhO'#CwOOQW1G.z1G.zOOO`1G/Q1G/QOOO`1G/T1G/TOOO`1G/W1G/WOOOO'#D]'#D]O+eO7[O,59cOOQW,59c,59cOOOO'#D^'#D^O+vOMhO,59cOOOO-E7Z-E7ZOOQW1G.}1G.}OOOO-E7[-E7[",stateData:`,c~O!_OS~OUSOVPOWQOXROYTO[]O][O^^O_^Oa^Ob^Oc^Od^Oy^O|_O!eZO~OgaO~OgbO~OgcO~OgdO~OgeO~O!XfOPmP![mP~O!YiOQpP![pP~O!ZlORsP![sP~OUSOVPOWQOXROYTOZqO[]O][O^^O_^Oa^Ob^Oc^Od^Oy^O!eZO~O![rO~P#gO!]sO!fuO~OgvO~OgwO~OS|OT}OiyO~OS!POT}OiyO~OS!ROT}OiyO~OS!TOT}OiyO~OS}OT}OiyO~O!XfOPmX![mX~OP!WO![!XO~O!YiOQpX![pX~OQ!ZO![!XO~O!ZlORsX![sX~OR!]O![!XO~O![!XO~P#gOg!_O~O!]sO!f!aO~OS!bO~OS!cO~Oj!dOShXThXihX~OS!fOT!gOiyO~OS!hOT!gOiyO~OS!iOT!gOiyO~OS!jOT!gOiyO~OS!gOT!gOiyO~Og!kO~Og!lO~Og!mO~OS!nO~Ol!qO!a!oO!c!pO~OS!rO~OS!sO~OS!tO~Ob!uOc!uOd!uO!a!wO!b!uO~Ob!xOc!xOd!xO!c!wO!d!xO~Ob!uOc!uOd!uO!a!{O!b!uO~Ob!xOc!xOd!xO!c!{O!d!xO~OT~cbd!ey|!e~`,goto:"%q!aPPPPPPPPPPPPPPPPPPPPP!b!hP!nPP!zP!}#Q#T#Z#^#a#g#j#m#s#y!bP!b!bP$P$V$m$s$y%P%V%]%cPPPPPPPP%iX^OX`pXUOX`pezabcde{!O!Q!S!UR!q!dRhUR!XhXVOX`pRkVR!XkXWOX`pRnWR!XnXXOX`pQrXR!XpXYOX`pQ`ORx`Q{aQ!ObQ!QcQ!SdQ!UeZ!e{!O!Q!S!UQ!v!oR!z!vQ!y!pR!|!yQgUR!VgQjVR!YjQmWR![mQpXR!^pQtZR!`tS_O`ToXp",nodeNames:`⚠ StartCloseTag StartCloseTag StartCloseTag EndTag SelfClosingEndTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl`,maxTerm:68,context:Le,nodeProps:[[`closedBy`,-10,1,2,3,7,8,9,10,11,12,13,`EndTag`,6,`EndTag SelfClosingEndTag`,-4,22,31,34,37,`CloseTag`],[`openedBy`,4,`StartTag StartCloseTag`,5,`StartTag`,-4,30,33,36,38,`OpenTag`],[`group`,-10,14,15,18,19,20,21,40,41,42,43,`Entity`,17,`Entity TextContent`,-3,29,32,35,`TextContent Entity`],[`isolate`,-11,22,30,31,33,34,36,37,38,39,42,43,`ltr`,-3,27,28,40,``]],propSources:[Ge],skippedNodes:[0],repeatNodeCount:9,tokenData:"!<p!aR!YOX$qXY,QYZ,QZ[$q[]&X]^,Q^p$qpq,Qqr-_rs3_sv-_vw3}wxHYx}-_}!OH{!O!P-_!P!Q$q!Q![-_![!]Mz!]!^-_!^!_!$S!_!`!;x!`!a&X!a!c-_!c!}Mz!}#R-_#R#SMz#S#T1k#T#oMz#o#s-_#s$f$q$f%W-_%W%oMz%o%p-_%p&aMz&a&b-_&b1pMz1p4U-_4U4dMz4d4e-_4e$ISMz$IS$I`-_$I`$IbMz$Ib$Kh-_$Kh%#tMz%#t&/x-_&/x&EtMz&Et&FV-_&FV;'SMz;'S;:j!#|;:j;=`3X<%l?&r-_?&r?AhMz?Ah?BY$q?BY?MnMz?MnO$q!Z$|caPlW!b`!dpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr$qrs&}sv$qvw+Pwx(tx!^$q!^!_*V!_!a&X!a#S$q#S#T&X#T;'S$q;'S;=`+z<%lO$q!R&bXaP!b`!dpOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&Xq'UVaP!dpOv&}wx'kx!^&}!^!_(V!_;'S&};'S;=`(n<%lO&}P'pTaPOv'kw!^'k!_;'S'k;'S;=`(P<%lO'kP(SP;=`<%l'kp([S!dpOv(Vx;'S(V;'S;=`(h<%lO(Vp(kP;=`<%l(Vq(qP;=`<%l&}a({WaP!b`Or(trs'ksv(tw!^(t!^!_)e!_;'S(t;'S;=`*P<%lO(t`)jT!b`Or)esv)ew;'S)e;'S;=`)y<%lO)e`)|P;=`<%l)ea*SP;=`<%l(t!Q*^V!b`!dpOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!Q*vP;=`<%l*V!R*|P;=`<%l&XW+UYlWOX+PZ[+P^p+Pqr+Psw+Px!^+P!a#S+P#T;'S+P;'S;=`+t<%lO+PW+wP;=`<%l+P!Z+}P;=`<%l$q!a,]`aP!b`!dp!_^OX&XXY,QYZ,QZ]&X]^,Q^p&Xpq,Qqr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&X!_-ljiSaPlW!b`!dpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx!P-_!P!Q$q!Q!^-_!^!_*V!_!a&X!a#S-_#S#T1k#T#s-_#s$f$q$f;'S-_;'S;=`3X<%l?Ah-_?Ah?BY$q?BY?Mn-_?MnO$q[/ebiSlWOX+PZ[+P^p+Pqr/^sw/^x!P/^!P!Q+P!Q!^/^!a#S/^#S#T0m#T#s/^#s$f+P$f;'S/^;'S;=`1e<%l?Ah/^?Ah?BY+P?BY?Mn/^?MnO+PS0rXiSqr0msw0mx!P0m!Q!^0m!a#s0m$f;'S0m;'S;=`1_<%l?Ah0m?BY?Mn0mS1bP;=`<%l0m[1hP;=`<%l/^!V1vciSaP!b`!dpOq&Xqr1krs&}sv1kvw0mwx(tx!P1k!P!Q&X!Q!^1k!^!_*V!_!a&X!a#s1k#s$f&X$f;'S1k;'S;=`3R<%l?Ah1k?Ah?BY&X?BY?Mn1k?MnO&X!V3UP;=`<%l1k!_3[P;=`<%l-_!Z3hV!ahaP!dpOv&}wx'kx!^&}!^!_(V!_;'S&};'S;=`(n<%lO&}!_4WiiSlWd!ROX5uXZ7SZ[5u[^7S^p5uqr8trs7Sst>]tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^/^!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!Z5zblWOX5uXZ7SZ[5u[^7S^p5uqr5urs7Sst+Ptw5uwx7Sx!]5u!]!^7w!^!a7S!a#S5u#S#T7S#T;'S5u;'S;=`8n<%lO5u!R7VVOp7Sqs7St!]7S!]!^7l!^;'S7S;'S;=`7q<%lO7S!R7qOb!R!R7tP;=`<%l7S!Z8OYlWb!ROX+PZ[+P^p+Pqr+Psw+Px!^+P!a#S+P#T;'S+P;'S;=`+t<%lO+P!Z8qP;=`<%l5u!_8{iiSlWOX5uXZ7SZ[5u[^7S^p5uqr8trs7Sst/^tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^:j!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!_:sbiSlWb!ROX+PZ[+P^p+Pqr/^sw/^x!P/^!P!Q+P!Q!^/^!a#S/^#S#T0m#T#s/^#s$f+P$f;'S/^;'S;=`1e<%l?Ah/^?Ah?BY+P?BY?Mn/^?MnO+P!V<QciSOp7Sqr;{rs7Sst0mtw;{wx7Sx!P;{!P!Q7S!Q!];{!]!^=]!^!a7S!a#s;{#s$f7S$f;'S;{;'S;=`>P<%l?Ah;{?Ah?BY7S?BY?Mn;{?MnO7S!V=dXiSb!Rqr0msw0mx!P0m!Q!^0m!a#s0m$f;'S0m;'S;=`1_<%l?Ah0m?BY?Mn0m!V>SP;=`<%l;{!_>YP;=`<%l8t!_>dhiSlWOX@OXZAYZ[@O[^AY^p@OqrBwrsAYswBwwxAYx!PBw!P!Q@O!Q!]Bw!]!^/^!^!aAY!a#SBw#S#TE{#T#sBw#s$f@O$f;'SBw;'S;=`HS<%l?AhBw?Ah?BY@O?BY?MnBw?MnO@O!Z@TalWOX@OXZAYZ[@O[^AY^p@Oqr@OrsAYsw@OwxAYx!]@O!]!^Az!^!aAY!a#S@O#S#TAY#T;'S@O;'S;=`Bq<%lO@O!RA]UOpAYq!]AY!]!^Ao!^;'SAY;'S;=`At<%lOAY!RAtOc!R!RAwP;=`<%lAY!ZBRYlWc!ROX+PZ[+P^p+Pqr+Psw+Px!^+P!a#S+P#T;'S+P;'S;=`+t<%lO+P!ZBtP;=`<%l@O!_COhiSlWOX@OXZAYZ[@O[^AY^p@OqrBwrsAYswBwwxAYx!PBw!P!Q@O!Q!]Bw!]!^Dj!^!aAY!a#SBw#S#TE{#T#sBw#s$f@O$f;'SBw;'S;=`HS<%l?AhBw?Ah?BY@O?BY?MnBw?MnO@O!_DsbiSlWc!ROX+PZ[+P^p+Pqr/^sw/^x!P/^!P!Q+P!Q!^/^!a#S/^#S#T0m#T#s/^#s$f+P$f;'S/^;'S;=`1e<%l?Ah/^?Ah?BY+P?BY?Mn/^?MnO+P!VFQbiSOpAYqrE{rsAYswE{wxAYx!PE{!P!QAY!Q!]E{!]!^GY!^!aAY!a#sE{#s$fAY$f;'SE{;'S;=`G|<%l?AhE{?Ah?BYAY?BY?MnE{?MnOAY!VGaXiSc!Rqr0msw0mx!P0m!Q!^0m!a#s0m$f;'S0m;'S;=`1_<%l?Ah0m?BY?Mn0m!VHPP;=`<%lE{!_HVP;=`<%lBw!ZHcW!cxaP!b`Or(trs'ksv(tw!^(t!^!_)e!_;'S(t;'S;=`*P<%lO(t!aIYliSaPlW!b`!dpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx}-_}!OKQ!O!P-_!P!Q$q!Q!^-_!^!_*V!_!a&X!a#S-_#S#T1k#T#s-_#s$f$q$f;'S-_;'S;=`3X<%l?Ah-_?Ah?BY$q?BY?Mn-_?MnO$q!aK_kiSaPlW!b`!dpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx!P-_!P!Q$q!Q!^-_!^!_*V!_!`&X!`!aMS!a#S-_#S#T1k#T#s-_#s$f$q$f;'S-_;'S;=`3X<%l?Ah-_?Ah?BY$q?BY?Mn-_?MnO$q!TM_XaP!b`!dp!fQOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&X!aNZ!ZiSgQaPlW!b`!dpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx}-_}!OMz!O!PMz!P!Q$q!Q![Mz![!]Mz!]!^-_!^!_*V!_!a&X!a!c-_!c!}Mz!}#R-_#R#SMz#S#T1k#T#oMz#o#s-_#s$f$q$f$}-_$}%OMz%O%W-_%W%oMz%o%p-_%p&aMz&a&b-_&b1pMz1p4UMz4U4dMz4d4e-_4e$ISMz$IS$I`-_$I`$IbMz$Ib$Je-_$Je$JgMz$Jg$Kh-_$Kh%#tMz%#t&/x-_&/x&EtMz&Et&FV-_&FV;'SMz;'S;:j!#|;:j;=`3X<%l?&r-_?&r?AhMz?Ah?BY$q?BY?MnMz?MnO$q!a!$PP;=`<%lMz!R!$ZY!b`!dpOq*Vqr!$yrs(Vsv*Vwx)ex!a*V!a!b!4t!b;'S*V;'S;=`*s<%lO*V!R!%Q]!b`!dpOr*Vrs(Vsv*Vwx)ex}*V}!O!%y!O!f*V!f!g!']!g#W*V#W#X!0`#X;'S*V;'S;=`*s<%lO*V!R!&QX!b`!dpOr*Vrs(Vsv*Vwx)ex}*V}!O!&m!O;'S*V;'S;=`*s<%lO*V!R!&vV!b`!dp!ePOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!'dX!b`!dpOr*Vrs(Vsv*Vwx)ex!q*V!q!r!(P!r;'S*V;'S;=`*s<%lO*V!R!(WX!b`!dpOr*Vrs(Vsv*Vwx)ex!e*V!e!f!(s!f;'S*V;'S;=`*s<%lO*V!R!(zX!b`!dpOr*Vrs(Vsv*Vwx)ex!v*V!v!w!)g!w;'S*V;'S;=`*s<%lO*V!R!)nX!b`!dpOr*Vrs(Vsv*Vwx)ex!{*V!{!|!*Z!|;'S*V;'S;=`*s<%lO*V!R!*bX!b`!dpOr*Vrs(Vsv*Vwx)ex!r*V!r!s!*}!s;'S*V;'S;=`*s<%lO*V!R!+UX!b`!dpOr*Vrs(Vsv*Vwx)ex!g*V!g!h!+q!h;'S*V;'S;=`*s<%lO*V!R!+xY!b`!dpOr!+qrs!,hsv!+qvw!-Swx!.[x!`!+q!`!a!/j!a;'S!+q;'S;=`!0Y<%lO!+qq!,mV!dpOv!,hvx!-Sx!`!,h!`!a!-q!a;'S!,h;'S;=`!.U<%lO!,hP!-VTO!`!-S!`!a!-f!a;'S!-S;'S;=`!-k<%lO!-SP!-kO|PP!-nP;=`<%l!-Sq!-xS!dp|POv(Vx;'S(V;'S;=`(h<%lO(Vq!.XP;=`<%l!,ha!.aX!b`Or!.[rs!-Ssv!.[vw!-Sw!`!.[!`!a!.|!a;'S!.[;'S;=`!/d<%lO!.[a!/TT!b`|POr)esv)ew;'S)e;'S;=`)y<%lO)ea!/gP;=`<%l!.[!R!/sV!b`!dp|POr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!0]P;=`<%l!+q!R!0gX!b`!dpOr*Vrs(Vsv*Vwx)ex#c*V#c#d!1S#d;'S*V;'S;=`*s<%lO*V!R!1ZX!b`!dpOr*Vrs(Vsv*Vwx)ex#V*V#V#W!1v#W;'S*V;'S;=`*s<%lO*V!R!1}X!b`!dpOr*Vrs(Vsv*Vwx)ex#h*V#h#i!2j#i;'S*V;'S;=`*s<%lO*V!R!2qX!b`!dpOr*Vrs(Vsv*Vwx)ex#m*V#m#n!3^#n;'S*V;'S;=`*s<%lO*V!R!3eX!b`!dpOr*Vrs(Vsv*Vwx)ex#d*V#d#e!4Q#e;'S*V;'S;=`*s<%lO*V!R!4XX!b`!dpOr*Vrs(Vsv*Vwx)ex#X*V#X#Y!+q#Y;'S*V;'S;=`*s<%lO*V!R!4{Y!b`!dpOr!4trs!5ksv!4tvw!6Vwx!8]x!a!4t!a!b!:]!b;'S!4t;'S;=`!;r<%lO!4tq!5pV!dpOv!5kvx!6Vx!a!5k!a!b!7W!b;'S!5k;'S;=`!8V<%lO!5kP!6YTO!a!6V!a!b!6i!b;'S!6V;'S;=`!7Q<%lO!6VP!6lTO!`!6V!`!a!6{!a;'S!6V;'S;=`!7Q<%lO!6VP!7QOyPP!7TP;=`<%l!6Vq!7]V!dpOv!5kvx!6Vx!`!5k!`!a!7r!a;'S!5k;'S;=`!8V<%lO!5kq!7yS!dpyPOv(Vx;'S(V;'S;=`(h<%lO(Vq!8YP;=`<%l!5ka!8bX!b`Or!8]rs!6Vsv!8]vw!6Vw!a!8]!a!b!8}!b;'S!8];'S;=`!:V<%lO!8]a!9SX!b`Or!8]rs!6Vsv!8]vw!6Vw!`!8]!`!a!9o!a;'S!8];'S;=`!:V<%lO!8]a!9vT!b`yPOr)esv)ew;'S)e;'S;=`)y<%lO)ea!:YP;=`<%l!8]!R!:dY!b`!dpOr!4trs!5ksv!4tvw!6Vwx!8]x!`!4t!`!a!;S!a;'S!4t;'S;=`!;r<%lO!4t!R!;]V!b`!dpyPOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!;uP;=`<%l!4t!V!<TXjSaP!b`!dpOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&X",tokenizers:[He,Ue,We,Ve,Re,ze,0,1,2,3,4,5],topRules:{Document:[0,16]},dialects:{noMatch:0,selfClosing:515},tokenPrec:517});function P(e,t){let n=Object.create(null);for(let r of e.getChildren(x)){let e=r.getChild(Se),i=r.getChild(S)||r.getChild(C);e&&(n[t.read(e.from,e.to)]=i?i.type.id==S?t.read(i.from+1,i.to-1):t.read(i.from,i.to):``)}return n}function F(e,t){let n=e.getChild(xe);return n?t.read(n.from,n.to):` `}function I(e,t,n){let r;for(let i of n)if(!i.attrs||i.attrs(r||=P(e.node.parent.firstChild,t)))return{parser:i.parser,bracketed:!0};return null}function L(e=[],t=[]){let n=[],r=[],i=[],o=[];for(let t of e)(t.tag==`script`?n:t.tag==`style`?r:t.tag==`textarea`?i:o).push(t);let s=t.length?Object.create(null):null;for(let e of t)(s[e.name]||(s[e.name]=[])).push(e);return a((e,t)=>{let a=e.type.id;if(a==Ce)return I(e,t,n);if(a==we)return I(e,t,r);if(a==Te)return I(e,t,i);if(a==b&&o.length){let n=e.node,r=n.firstChild,i=r&&F(r,t),a;if(i){for(let e of o)if(e.tag==i&&(!e.attrs||e.attrs(a||=P(r,t)))){let t=n.lastChild,i=t.type.id==De?t.from:n.to;if(i>r.to)return{parser:e.parser,overlay:[{from:r.to,to:i}]}}}}if(s&&a==x){let n=e.node,r;if(r=n.firstChild){let e=s[t.read(r.from,r.to)];if(e)for(let r of e){if(r.tagName&&r.tagName!=F(n.parent,t))continue;let e=n.lastChild;if(e.type.id==S){let t=e.from+1,n=e.lastChild,i=e.to-(n&&n.isError?0:1);if(i>t)return{parser:r.parser,overlay:[{from:t,to:i}],bracketed:!0}}else if(e.type.id==C)return{parser:r.parser,overlay:[{from:e.from,to:e.to}]}}}}return null})}var R=[`_blank`,`_self`,`_top`,`_parent`],z=[`ascii`,`utf-8`,`utf-16`,`latin1`,`latin1`],B=[`get`,`post`,`put`,`delete`],V=[`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`],H=[`true`,`false`],U={},qe={a:{attrs:{href:null,ping:null,type:null,media:null,target:R,hreflang:null}},abbr:U,address:U,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:[`default`,`rect`,`circle`,`poly`]}},article:U,aside:U,audio:{attrs:{src:null,mediagroup:null,crossorigin:[`anonymous`,`use-credentials`],preload:[`none`,`metadata`,`auto`],autoplay:[`autoplay`],loop:[`loop`],controls:[`controls`]}},b:U,base:{attrs:{href:null,target:R}},bdi:U,bdo:U,blockquote:{attrs:{cite:null}},body:U,br:U,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:[`autofocus`],disabled:[`autofocus`],formenctype:V,formmethod:B,formnovalidate:[`novalidate`],formtarget:R,type:[`submit`,`reset`,`button`]}},canvas:{attrs:{width:null,height:null}},caption:U,center:U,cite:U,code:U,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:[`command`,`checkbox`,`radio`],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:[`disabled`],checked:[`checked`]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:[`disabled`],multiple:[`multiple`]}},datalist:{attrs:{data:null}},dd:U,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:[`open`]}},dfn:U,div:U,dl:U,dt:U,em:U,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:[`disabled`],form:null,name:null}},figcaption:U,figure:U,footer:U,form:{attrs:{action:null,name:null,"accept-charset":z,autocomplete:[`on`,`off`],enctype:V,method:B,novalidate:[`novalidate`],target:R}},h1:U,h2:U,h3:U,h4:U,h5:U,h6:U,head:{children:[`title`,`base`,`link`,`style`,`meta`,`script`,`noscript`,`command`]},header:U,hgroup:U,hr:U,html:{attrs:{manifest:null}},i:U,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:[`allow-top-navigation`,`allow-same-origin`,`allow-forms`,`allow-scripts`],seamless:[`seamless`]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:[`anonymous`,`use-credentials`]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:[`audio/*`,`video/*`,`image/*`],autocomplete:[`on`,`off`],autofocus:[`autofocus`],checked:[`checked`],disabled:[`disabled`],formenctype:V,formmethod:B,formnovalidate:[`novalidate`],formtarget:R,multiple:[`multiple`],readonly:[`readonly`],required:[`required`],type:[`hidden`,`text`,`search`,`tel`,`url`,`email`,`password`,`datetime`,`date`,`month`,`week`,`time`,`datetime-local`,`number`,`range`,`color`,`checkbox`,`radio`,`file`,`submit`,`image`,`reset`,`button`]}},ins:{attrs:{cite:null,datetime:null}},kbd:U,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:[`autofocus`],disabled:[`disabled`],keytype:[`RSA`]}},label:{attrs:{for:null,form:null}},legend:U,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:[`all`,`16x16`,`16x16 32x32`,`16x16 32x32 64x64`]}},map:{attrs:{name:null}},mark:U,menu:{attrs:{label:null,type:[`list`,`context`,`toolbar`]}},meta:{attrs:{content:null,charset:z,name:[`viewport`,`application-name`,`author`,`description`,`generator`,`keywords`],"http-equiv":[`content-language`,`content-type`,`default-style`,`refresh`]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:U,noscript:U,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:[`typemustmatch`]}},ol:{attrs:{reversed:[`reversed`],start:null,type:[`1`,`a`,`A`,`i`,`I`]},children:[`li`,`script`,`template`,`ul`,`ol`]},optgroup:{attrs:{disabled:[`disabled`],label:null}},option:{attrs:{disabled:[`disabled`],label:null,selected:[`selected`],value:null}},output:{attrs:{for:null,form:null,name:null}},p:U,param:{attrs:{name:null,value:null}},pre:U,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:U,rt:U,ruby:U,samp:U,script:{attrs:{type:[`text/javascript`],src:null,async:[`async`],defer:[`defer`],charset:z}},section:U,select:{attrs:{form:null,name:null,size:null,autofocus:[`autofocus`],disabled:[`disabled`],multiple:[`multiple`]}},slot:{attrs:{name:null}},small:U,source:{attrs:{src:null,type:null,media:null}},span:U,strong:U,style:{attrs:{type:[`text/css`],media:null,scoped:null}},sub:U,summary:U,sup:U,table:U,tbody:U,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:U,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:[`autofocus`],disabled:[`disabled`],readonly:[`readonly`],required:[`required`],wrap:[`soft`,`hard`]}},tfoot:U,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:[`row`,`col`,`rowgroup`,`colgroup`]}},thead:U,time:{attrs:{datetime:null}},title:U,tr:U,track:{attrs:{src:null,label:null,default:null,kind:[`subtitles`,`captions`,`descriptions`,`chapters`,`metadata`],srclang:null}},ul:{children:[`li`,`script`,`template`,`ul`,`ol`]},var:U,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:[`anonymous`,`use-credentials`],preload:[`auto`,`metadata`,`none`],autoplay:[`autoplay`],mediagroup:[`movie`],muted:[`muted`],controls:[`controls`]}},wbr:U},W={accesskey:null,class:null,contenteditable:H,contextmenu:null,dir:[`ltr`,`rtl`,`auto`],draggable:[`true`,`false`,`auto`],dropzone:[`copy`,`move`,`link`,`string:`,`file:`],hidden:[`hidden`],id:null,inert:[`inert`],itemid:null,itemprop:null,itemref:null,itemscope:[`itemscope`],itemtype:null,lang:[`ar`,`bn`,`de`,`en-GB`,`en-US`,`es`,`fr`,`hi`,`id`,`ja`,`pa`,`pt`,`ru`,`tr`,`zh`],spellcheck:H,autocorrect:H,autocapitalize:H,style:null,tabindex:null,title:null,translate:[`yes`,`no`],rel:[`stylesheet`,`alternate`,`author`,`bookmark`,`help`,`license`,`next`,`nofollow`,`noreferrer`,`prefetch`,`prev`,`search`,`tag`],role:/*@__PURE__*/ `alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer`.split(` `),"aria-activedescendant":null,"aria-atomic":H,"aria-autocomplete":[`inline`,`list`,`both`,`none`],"aria-busy":H,"aria-checked":[`true`,`false`,`mixed`,`undefined`],"aria-controls":null,"aria-describedby":null,"aria-disabled":H,"aria-dropeffect":null,"aria-expanded":[`true`,`false`,`undefined`],"aria-flowto":null,"aria-grabbed":[`true`,`false`,`undefined`],"aria-haspopup":H,"aria-hidden":H,"aria-invalid":[`true`,`false`,`grammar`,`spelling`],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":[`off`,`polite`,`assertive`],"aria-multiline":H,"aria-multiselectable":H,"aria-owns":null,"aria-posinset":null,"aria-pressed":[`true`,`false`,`mixed`,`undefined`],"aria-readonly":H,"aria-relevant":null,"aria-required":H,"aria-selected":[`true`,`false`,`undefined`],"aria-setsize":null,"aria-sort":[`ascending`,`descending`,`none`,`other`],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},G=/*@__PURE__*/ `beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload`.split(` `).map(e=>`on`+e);for(let e of G)W[e]=null;var K=class{constructor(e,t){this.tags={...qe,...e},this.globalAttrs={...W,...t},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}};K.default=/*@__PURE__*/ new K;function q(e,t,n=e.length){if(!t)return``;let r=t.firstChild,i=r&&r.getChild(`TagName`);return i?e.sliceString(i.from,Math.min(i.to,n)):``}function J(e,t=!1){for(;e;e=e.parent)if(e.name==`Element`){if(t)t=!1;else return e}return null}function Y(e,t,n){return n.tags[q(e,J(t))]?.children||n.allTags}function X(e,t){let n=[];for(let r=J(t);r&&!r.type.isTop;r=J(r.parent)){let i=q(e,r);if(i&&r.lastChild.name==`CloseTag`)break;i&&n.indexOf(i)<0&&(t.name==`EndTag`||t.from>=r.firstChild.to)&&n.push(i)}return n}var Z=/^[:\-\.\w\u00b7-\uffff]*$/;function Q(e,t,n,r,i){let a=/\s*>/.test(e.sliceDoc(i,i+5))?``:`>`,o=J(n,n.name==`StartTag`||n.name==`TagName`);return{from:r,to:i,options:Y(e.doc,o,t).map(e=>({label:e,type:`type`})).concat(X(e.doc,n).map((e,t)=>({label:`/`+e,apply:`/`+e+a,type:`type`,boost:99-t}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function Je(e,t,n,r){let i=/\s*>/.test(e.sliceDoc(r,r+5))?``:`>`;return{from:n,to:r,options:X(e.doc,t).map((e,t)=>({label:e,apply:e+i,type:`type`,boost:99-t})),validFor:Z}}function Ye(e,t,n,r){let i=[],a=0;for(let r of Y(e.doc,n,t))i.push({label:`<`+r,type:`type`});for(let t of X(e.doc,n))i.push({label:`</`+t+`>`,type:`type`,boost:99-a++});return{from:r,to:r,options:i,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function Xe(e,t,n,r,i){let a=J(n),o=a?t.tags[q(e.doc,a)]:null,s=o&&o.attrs?Object.keys(o.attrs):[];return{from:r,to:i,options:(o&&o.globalAttrs===!1?s:s.length?s.concat(t.globalAttrNames):t.globalAttrNames).map(e=>({label:e,type:`property`})),validFor:Z}}function Ze(e,t,n,r,i){let a=n.parent?.getChild(`AttributeName`),o=[],s;if(a){let c=e.sliceDoc(a.from,a.to),l=t.globalAttrs[c];if(!l){let r=J(n),i=r?t.tags[q(e.doc,r)]:null;l=i?.attrs&&i.attrs[c]}if(l){let t=e.sliceDoc(r,i).toLowerCase(),n=`"`,a=`"`;/^['"]/.test(t)?(s=t[0]==`"`?/^[^"]*$/:/^[^']*$/,n=``,a=e.sliceDoc(i,i+1)==t[0]?``:t[0],t=t.slice(1),r++):s=/^[^\s<>='"]*$/;for(let e of l)o.push({label:e,apply:n+e+a,type:`constant`})}}return{from:r,to:i,options:o,validFor:s}}function Qe(e,t){let{state:n,pos:r}=t,i=l(n).resolveInner(r,-1),a=i.resolve(r);for(let e=r,t;a==i&&(t=i.childBefore(e));){let n=t.lastChild;if(!n||!n.type.isError||n.from<n.to)break;a=i=t,e=n.from}return i.name==`TagName`?i.parent&&/CloseTag$/.test(i.parent.name)?Je(n,i,i.from,r):Q(n,e,i,i.from,r):i.name==`StartTag`||i.name==`IncompleteTag`?Q(n,e,i,r,r):i.name==`StartCloseTag`||i.name==`IncompleteCloseTag`?Je(n,i,r,r):i.name==`OpenTag`||i.name==`SelfClosingTag`||i.name==`AttributeName`?Xe(n,e,i,i.name==`AttributeName`?i.from:r,r):i.name==`Is`||i.name==`AttributeValue`||i.name==`UnquotedAttributeValue`?Ze(n,e,i,i.name==`Is`?r:i.from,r):t.explicit&&(a.name==`Element`||a.name==`Text`||a.name==`Document`)?Ye(n,e,i,r):null}function $e(e){let{extraTags:t,extraGlobalAttributes:n}=e,r=n||t?new K(t,n):K.default;return e=>Qe(r,e)}var et=/*@__PURE__*/ f.parser.configure({top:`SingleExpression`}),tt=[{tag:`script`,attrs:e=>e.type==`text/typescript`||e.lang==`ts`,parser:se.parser},{tag:`script`,attrs:e=>e.type==`text/babel`||e.type==`text/jsx`,parser:ae.parser},{tag:`script`,attrs:e=>e.type==`text/typescript-jsx`,parser:oe.parser},{tag:`script`,attrs(e){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(e.type)},parser:et},{tag:`script`,attrs(e){return!e.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(e.type)},parser:f.parser},{tag:`style`,attrs(e){return(!e.lang||e.lang==`css`)&&(!e.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(e.type))},parser:d.parser}],nt=/*@__PURE__*/ [{name:`style`,parser:/*@__PURE__*/ d.parser.configure({top:`Styles`})}].concat(/*@__PURE__*/ G.map(e=>({name:e,parser:f.parser}))),rt=/*@__PURE__*/ n.define({name:`html`,parser:/*@__PURE__*/ Ke.configure({props:[/*@__PURE__*/ s.add({Element(e){let t=/^(\s*)(<\/)?/.exec(e.textAfter);return e.node.to<=e.pos+t[0].length?e.continue():e.lineIndent(e.node.from)+(t[2]?0:e.unit)},"OpenTag CloseTag SelfClosingTag"(e){return e.column(e.node.from)+e.unit},Document(e){if(e.pos+/\s*/.exec(e.textAfter)[0].length<e.node.to)return e.continue();let t=null,n;for(let n=e.node;;){let e=n.lastChild;if(!e||e.name!=`Element`||e.to!=n.to)break;t=n=e}return t&&!((n=t.lastChild)&&(n.name==`CloseTag`||n.name==`SelfClosingTag`))?e.lineIndent(t.from)+e.unit:null}}),/*@__PURE__*/ o.add({Element(e){let t=e.firstChild,n=e.lastChild;return!t||t.name!=`OpenTag`?null:{from:t.to,to:n.name==`CloseTag`?n.from:e.to}}}),/*@__PURE__*/ i.add({"OpenTag CloseTag":e=>e.getChild(`TagName`)})]}),languageData:{commentTokens:{block:{open:`<!--`,close:`-->`}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:`-_`}}),$=/*@__PURE__*/ rt.configure({wrap:/*@__PURE__*/ L(tt,nt)});function it(e={}){let t=``,n;e.matchClosingTags===!1&&(t=`noMatch`),e.selfClosingTags===!0&&(t=(t?t+` `:``)+`selfClosing`),(e.nestedLanguages&&e.nestedLanguages.length||e.nestedAttributes&&e.nestedAttributes.length)&&(n=L((e.nestedLanguages||[]).concat(tt),(e.nestedAttributes||[]).concat(nt)));let i=n?rt.configure({wrap:n,dialect:t}):t?$.configure({dialect:t}):$;return new r(i,[$.data.of({autocomplete:$e(e)}),e.autoCloseTags===!1?[]:st,ie().support,re().support])}var at=/*@__PURE__*/ new Set(/*@__PURE__*/ `area base br col command embed frame hr img input keygen link meta param source track wbr menuitem`.split(` `));function ot(e,t,n){for(;;){if(t.lastChild?.name!=`CloseTag`)return!1;let r=t.parent;if(!r||q(e,r)!=n)return!0;t=r}}var st=/*@__PURE__*/ t.inputHandler.of((t,n,r,i,a)=>{if(t.composing||t.state.readOnly||n!=r||i!=`>`&&i!=`/`||!$.isActiveAt(t.state,n,-1))return!1;let o=a(),{state:s}=o,c=s.changeByRange(t=>{let n=s.doc.sliceString(t.from-1,t.to)==i,{head:r}=t,a=l(s).resolveInner(r,-1),o;if(n&&i==`>`&&a.name==`EndTag`){let e=a.parent;if((o=q(s.doc,e.parent,r))&&!at.has(o)&&!ot(s.doc,e.parent,o))return{range:t,changes:{from:r,to:r+ +(s.doc.sliceString(r,r+1)===`>`),insert:`</${o}>`}}}else if(n&&i==`/`&&a.name==`IncompleteCloseTag`){let t=a.parent;if(a.from==r-2&&t.lastChild?.name!=`CloseTag`&&(o=q(s.doc,t,r))&&!at.has(o)){let t=r+ +(s.doc.sliceString(r,r+1)===`>`),n=`${o}>`;return{range:e.cursor(r+n.length,-1),changes:{from:r,to:t,insert:n}}}}return{range:t}});return!c.changes.empty&&(t.dispatch([o,s.update(c,{userEvent:`input.complete`,scrollIntoView:!0})]),!0)});export{it as html};
@@ -3,4 +3,4 @@
3
3
  * Bundles CodeMirror 6 and Lezer (MIT) © Marijn Haverbeke and others.
4
4
  * Full third-party licences: THIRD-PARTY-NOTICES.txt in this package.
5
5
  */
6
- import{S as e,a as t,b as n,g as r,h as i,i as a,m as o,n as s,p as c,r as l,s as u,t as d,y as f}from"./dist-D25hs99E.js";import{n as p,r as m}from"./dist-Vr-fb58P.js";import{IndentContext as ee,a as te,getIndentUnit as ne,getIndentation as re,indentString as h,indentUnit as ie,matchBrackets as g,syntaxTree as _}from"./dist-DfFrsBkU.js";var ae=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=y(e.state,n.from);return r.line?oe(e):r.block?fe(e):!1};function v(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=e(t,n);return i?(r(n.update(i)),!0):!1}}var oe=/*@__PURE__*/ v(S,0),se=/*@__PURE__*/ v(S,1),ce=/*@__PURE__*/ v(S,2),le=/*@__PURE__*/ v(x,0),ue=/*@__PURE__*/ v(x,1),de=/*@__PURE__*/ v(x,2),fe=/*@__PURE__*/ v((e,t)=>x(e,t,me(t)),0);function y(e,t){let n=e.languageDataAt(`commentTokens`,t,1);return n.length?n[0]:{}}var b=50;function pe(e,{open:t,close:n},r,i){let a=e.sliceDoc(r-b,r),o=e.sliceDoc(i,i+b),s=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(o)[0].length,l=a.length-s;if(a.slice(l-t.length,l)==t&&o.slice(c,c+n.length)==n)return{open:{pos:r-s,margin:s&&1},close:{pos:i+c,margin:c&&1}};let u,d;i-r<=100?u=d=e.sliceDoc(r,i):(u=e.sliceDoc(r,r+b),d=e.sliceDoc(i-b,i));let f=/^\s*/.exec(u)[0].length,p=/\s*$/.exec(d)[0].length,m=d.length-p-n.length;return u.slice(f,f+t.length)==t&&d.slice(m,m+n.length)==n?{open:{pos:r+f+t.length,margin:+!!/\s/.test(u.charAt(f+t.length))},close:{pos:i-p-n.length,margin:+!!/\s/.test(d.charAt(m-1))}}:null}function me(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),i=n.to<=r.to?r:e.doc.lineAt(n.to);i.from>r.from&&i.from==n.to&&(i=n.to==r.to+1?r:e.doc.lineAt(n.to-1));let a=t.length-1;a>=0&&t[a].to>r.from?t[a].to=i.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return t}function x(e,t,n=t.selection.ranges){let r=n.map(e=>y(t,e.from).block);if(!r.every(e=>e))return null;let i=n.map((e,n)=>pe(t,r[n],e.from,e.to));if(e!=2&&!i.every(e=>e))return{changes:t.changes(n.map((e,t)=>i[t]?[]:[{from:e.from,insert:r[t].open+` `},{from:e.to,insert:` `+r[t].close}]))};if(e!=1&&i.some(e=>e)){let e=[];for(let t=0,n;t<i.length;t++)if(n=i[t]){let i=r[t],{open:a,close:o}=n;e.push({from:a.pos-i.open.length,to:a.pos+a.margin},{from:o.pos-o.margin,to:o.pos+i.close.length})}return{changes:e}}return null}function S(e,t,n=t.selection.ranges){let r=[],i=-1;ranges:for(let{from:e,to:a}of n){let n=r.length,o=1e9,s;for(let n=e;n<=a;){let c=t.doc.lineAt(n);if(s==null&&(s=y(t,c.from).line,!s))continue ranges;if(c.from>i&&(e==a||a>c.from)){i=c.from;let e=/^\s*/.exec(c.text)[0].length,t=e==c.length,n=c.text.slice(e,e+s.length)==s?e:-1;e<c.text.length&&e<o&&(o=e),r.push({line:c,comment:n,token:s,indent:e,empty:t,single:!1})}n=c.to+1}if(o<1e9)for(let e=n;e<r.length;e++)r[e].indent<r[e].line.text.length&&(r[e].indent=o);r.length==n+1&&(r[n].single=!0)}if(e!=2&&r.some(e=>e.comment<0&&(!e.empty||e.single))){let e=[];for(let{line:t,token:n,indent:i,empty:a,single:o}of r)(o||!a)&&e.push({from:t.from+i,insert:n+` `});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}if(e!=1&&r.some(e=>e.comment>=0)){let e=[];for(let{line:t,comment:n,token:i}of r)if(n>=0){let r=t.from+n,a=r+i.length;t.text[a-t.from]==` `&&a++,e.push({from:r,to:a})}return{changes:e}}return null}var C=/*@__PURE__*/ d.define(),he=/*@__PURE__*/ d.define(),ge=/*@__PURE__*/ u.define(),_e=/*@__PURE__*/ u.define({combine(e){return f(e,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,r)=>e(n,r)||t(n,r)})}}),w=/*@__PURE__*/ o.define({create(){return A.empty},update(e,t){let n=t.state.facet(_e),i=t.annotation(C);if(i){let r=D.fromTransaction(t,i.selection),a=i.side,o=a==0?e.undone:e.done;return o=r?O(o,o.length,n.minDepth,r):Ne(o,t.startState.selection),new A(a==0?i.rest:o,a==0?o:i.rest)}let a=t.annotation(he);if((a==`full`||a==`before`)&&(e=e.isolate()),t.annotation(r.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let o=D.fromTransaction(t),s=t.annotation(r.time),c=t.annotation(r.userEvent);return o?e=e.addChanges(o,s,c,n,t):t.selection&&(e=e.addSelection(t.startState.selection,s,c,n.newGroupDelay)),(a==`full`||a==`after`)&&(e=e.isolate()),e},toJSON(e){return{done:e.done.map(e=>e.toJSON()),undone:e.undone.map(e=>e.toJSON())}},fromJSON(e){return new A(e.done.map(D.fromJSON),e.undone.map(D.fromJSON))}});function ve(e={}){return[w,_e.of(e),m.domEventHandlers({beforeinput(e,t){let n=e.inputType==`historyUndo`?be:e.inputType==`historyRedo`?E:null;return n?(e.preventDefault(),n(t)):!1}})]}var ye=w;function T(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let i=n.field(w,!1);if(!i)return!1;let a=i.pop(e,n,t);return a?(r(a),!0):!1}}var be=/*@__PURE__*/ T(0,!1),E=/*@__PURE__*/ T(1,!1),xe=/*@__PURE__*/ T(0,!0),Se=/*@__PURE__*/ T(1,!0);function Ce(e){return function(t){let n=t.field(w,!1);if(!n)return 0;let r=e==0?n.done:n.undone;return r.length-(r.length&&!r[0].changes?1:0)}}var we=/*@__PURE__*/ Ce(0),Te=/*@__PURE__*/ Ce(1);function Ee(e){return function(t){let n=t.field(w,!1);if(!n)return!1;let r=e==0?n.done:n.undone;return r.length>0&&r[0].selectionsAfter.length>0}}var De=/*@__PURE__*/ Ee(0),Oe=/*@__PURE__*/ Ee(0),D=class e{constructor(e,t,n,r,i){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=r,this.selectionsAfter=i}setSelAfter(t){return new e(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){return{changes:this.changes?.toJSON(),mapped:this.mapped?.toJSON(),startSelection:this.startSelection?.toJSON(),selectionsAfter:this.selectionsAfter.map(e=>e.toJSON())}}static fromJSON(n){return new e(n.changes&&l.fromJSON(n.changes),[],n.mapped&&s.fromJSON(n.mapped),n.startSelection&&t.fromJSON(n.startSelection),n.selectionsAfter.map(t.fromJSON))}static fromTransaction(t,n){let r=k;for(let e of t.startState.facet(ge)){let n=e(t);n.length&&(r=r.concat(n))}return!r.length&&t.changes.empty?null:new e(t.changes.invert(t.startState.doc),r,void 0,n||t.startState.selection,k)}static selection(t){return new e(void 0,k,void 0,void 0,t)}};function O(e,t,n,r){let i=t+1>n+20?t-n-1:0,a=e.slice(i,t);return a.push(r),a}function ke(e,t){let n=[],r=!1;return e.iterChangedRanges((e,t)=>n.push(e,t)),t.iterChangedRanges((e,t,i,a)=>{for(let e=0;e<n.length;){let t=n[e++],o=n[e++];a>=t&&i<=o&&(r=!0)}}),r}function Ae(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((e,n)=>e.empty!=t.ranges[n].empty).length===0}function je(e,t){return e.length?t.length?e.concat(t):e:t}var k=[],Me=200;function Ne(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-Me));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),O(e,e.length-1,1e9,n.setSelAfter(r)))}return[D.selection([t])]}function Pe(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function Fe(e,t){if(!e.length)return e;let n=e.length,r=k;for(;n;){let i=Ie(e[n-1],t,r);if(i.changes&&!i.changes.empty||i.effects.length){let t=e.slice(0,n);return t[n-1]=i,t}t=i.mapped,n--,r=i.selectionsAfter}return r.length?[D.selection(r)]:k}function Ie(e,t,n){let r=je(e.selectionsAfter.length?e.selectionsAfter.map(e=>e.map(t)):k,n);if(!e.changes)return D.selection(r);let i=e.changes.map(t),a=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(a):a;return new D(i,c.mapEffects(e.effects,t),o,e.startSelection.map(a),r)}var Le=/^(input\.type|delete)($|\.)/,A=class e{constructor(e,t,n=0,r=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new e(this.done,this.undone):this}addChanges(t,n,r,i,a){let o=this.done,s=o[o.length-1];return o=s&&s.changes&&!s.changes.empty&&t.changes&&(!r||Le.test(r))&&(!s.selectionsAfter.length&&n-this.prevTime<i.newGroupDelay&&i.joinToEvent(a,ke(s.changes,t.changes))||r==`input.type.compose`)?O(o,o.length-1,i.minDepth,new D(t.changes.compose(s.changes),je(c.mapEffects(t.effects,s.changes),s.effects),s.mapped,s.startSelection,k)):O(o,o.length,i.minDepth,t),new e(o,k,n,r)}addSelection(t,n,r,i){let a=this.done.length?this.done[this.done.length-1].selectionsAfter:k;return a.length>0&&n-this.prevTime<i&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&Ae(a[a.length-1],t)?this:new e(Ne(this.done,t),this.undone,n,r)}addMapping(t){return new e(Fe(this.done,t),Fe(this.undone,t),this.prevTime,this.prevUserEvent)}pop(e,t,n){let r=e==0?this.done:this.undone;if(r.length==0)return null;let i=r[r.length-1],a=i.selectionsAfter[0]||(i.startSelection?i.startSelection.map(i.changes.invertedDesc,1):t.selection);if(n&&i.selectionsAfter.length)return t.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:C.of({side:e,rest:Pe(r),selection:a}),userEvent:e==0?`select.undo`:`select.redo`,scrollIntoView:!0});if(i.changes){let n=r.length==1?k:r.slice(0,r.length-1);return i.mapped&&(n=Fe(n,i.mapped)),t.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:C.of({side:e,rest:n,selection:a}),filter:!1,userEvent:e==0?`undo`:`redo`,scrollIntoView:!0})}return null}};A.empty=/*@__PURE__*/ new A(k,k);var Re=[{key:`Mod-z`,run:be,preventDefault:!0},{key:`Mod-y`,mac:`Mod-Shift-z`,run:E,preventDefault:!0},{linux:`Ctrl-Shift-z`,run:E,preventDefault:!0},{key:`Mod-u`,run:xe,preventDefault:!0},{key:`Alt-u`,mac:`Mod-Shift-u`,run:Se,preventDefault:!0}];function j(e,n){return t.create(e.ranges.map(n),e.mainIndex)}function M(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:`select`})}function N({state:e,dispatch:t},n){let r=j(e.selection,n);return!r.eq(e.selection,!0)&&(t(M(e,r)),!0)}function P(e,n){return t.cursor(n?e.to:e.from)}function F(e,t){return N(e,n=>n.empty?e.moveByChar(n,t):P(n,t))}function I(e){return e.textDirectionAt(e.state.selection.main.head)==p.LTR}var L=e=>F(e,!I(e)),ze=e=>F(e,I(e)),Be=e=>F(e,!0),Ve=e=>F(e,!1);function He(n,r,i){let a=r.head,o=n.doc.lineAt(a);return a=a==(i?o.to:o.from)?i?Math.min(n.doc.length,o.to+1):Math.max(0,o.from-1):o.from+e(o.text,a-o.from,i),t.cursor(a,i?-1:1)}function Ue(e,t){return N(e,n=>n.empty?He(e.state,n,t):P(n,t))}var We=e=>Ue(e,!0),Ge=e=>Ue(e,!1);function R(e,t){return N(e,n=>n.empty?e.moveByGroup(n,t):P(n,t))}var Ke=e=>R(e,!I(e)),qe=e=>R(e,I(e)),Je=e=>R(e,!0),Ye=e=>R(e,!1);function Xe(e,t,n){let r=e.state.charCategorizer(t),i=r(n),o=i!=a.Space;return e=>{let t=r(e);return t==a.Space?(o=!1,!0):o&&t==i}}var Ze=e=>N(e,t=>t.empty?e.moveByChar(t,!0,n=>Xe(e,t.head,n)):P(t,!0)),Qe=typeof Intl<`u`&&Intl.Segmenter?/*@__PURE__*/ new Intl.Segmenter(void 0,{granularity:`word`}):null;function $e(e,n,r){let i=e.state.charCategorizer(n.from),o=a.Space,s=n.from,c=0,l=!1,u=!1,d=!1,f=t=>{if(l)return!1;s+=r?t.length:-t.length;let n=i(t),f;if(n==a.Word&&t.charCodeAt(0)<128&&/[\W_]/.test(t)&&(n=-1),o==a.Space&&(o=n),o!=n)return!1;if(o==a.Word){if(t.toLowerCase()==t){if(!r&&u)return!1;d=!0}else if(d){if(r)return!1;l=!0}else{if(u&&r&&i(f=e.state.sliceDoc(s,s+1))==a.Word&&f.toLowerCase()==f)return!1;u=!0}}return c++,!0},p=e.moveByChar(n,r,e=>(f(e),f));if(Qe&&o==a.Word&&p.from==n.from+c*(r?1:-1)){let i=Math.min(n.head,p.head),a=Math.max(n.head,p.head),o=e.state.sliceDoc(i,a);if(o.length>1&&/[\u4E00-\uffff]/.test(o)){let e=Array.from(Qe.segment(o));if(e.length>1)return r?t.cursor(n.head+e[1].index,-1):t.cursor(p.head+e[e.length-1].index,1)}}return p}function et(e,t){return N(e,n=>n.empty?$e(e,n,t):P(n,t))}var tt=e=>et(e,!0),nt=e=>et(e,!1);function rt(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function z(e,n,r){let i=_(e).resolveInner(n.head),a=r?te.closedBy:te.openedBy;for(let t=n.head;;){let n=r?i.childAfter(t):i.childBefore(t);if(!n)break;rt(e,n,a)?i=n:t=r?n.to:n.from}let o=i.type.prop(a),s,c;return c=o&&(s=r?g(e,i.from,1):g(e,i.to,-1))&&s.matched?r?s.end.to:s.end.from:r?i.to:i.from,t.cursor(c,r?-1:1)}var it=e=>N(e,t=>z(e.state,t,!I(e))),at=e=>N(e,t=>z(e.state,t,I(e)));function ot(e,t){return N(e,n=>{if(!n.empty)return P(n,t);let r=e.moveVertically(n,t);return r.head==n.head?e.moveToLineBoundary(n,t):r})}var B=e=>ot(e,!1),V=e=>ot(e,!0);function st(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,i;if(t){for(let t of e.state.facet(m.scrollMargins)){let i=t(e);i?.top&&(n=Math.max(i?.top,n)),i?.bottom&&(r=Math.max(i?.bottom,r))}i=e.scrollDOM.clientHeight-n-r}else i=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:t,height:Math.max(e.defaultLineHeight,i-5)}}function ct(e,t){let n=st(e),{state:r}=e,i=j(r.selection,r=>r.empty?e.moveVertically(r,t,n.height):P(r,t));if(i.eq(r.selection))return!1;let a;if(n.selfScroll){let t=e.coordsAtPos(r.selection.main.head),o=e.scrollDOM.getBoundingClientRect(),s=o.top+n.marginTop,c=o.bottom-n.marginBottom;t&&t.top>s&&t.bottom<c&&(a=m.scrollIntoView(i.main.head,{y:`start`,yMargin:t.top-s}))}return e.dispatch(M(r,i),{effects:a}),!0}var H=e=>ct(e,!1),U=e=>ct(e,!0);function W(e,n,r){let i=e.lineBlockAt(n.head),a=e.moveToLineBoundary(n,r);if(a.head==n.head&&a.head!=(r?i.to:i.from)&&(a=e.moveToLineBoundary(n,r,!1)),!r&&a.head==i.from&&i.length){let r=/^\s*/.exec(e.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;r&&n.head!=i.from+r&&(a=t.cursor(i.from+r))}return a}var lt=e=>N(e,t=>W(e,t,!0)),ut=e=>N(e,t=>W(e,t,!1)),dt=e=>N(e,t=>W(e,t,!I(e))),ft=e=>N(e,t=>W(e,t,I(e))),pt=e=>N(e,n=>t.cursor(e.lineBlockAt(n.head).from,1)),mt=e=>N(e,n=>t.cursor(e.lineBlockAt(n.head).to,-1));function ht(e,n,r){let i=!1,a=j(e.selection,n=>{let a=g(e,n.head,-1)||g(e,n.head,1)||n.head>0&&g(e,n.head-1,1)||n.head<e.doc.length&&g(e,n.head+1,-1);if(!a||!a.end)return n;i=!0;let o=a.start.from==n.head?a.end.to:a.end.from;return r?t.range(n.anchor,o):t.cursor(o)});return i?(n(M(e,a)),!0):!1}var gt=({state:e,dispatch:t})=>ht(e,t,!1),_t=({state:e,dispatch:t})=>ht(e,t,!0);function G(e,n,r){let i=j(e.state.selection,e=>{e.undirectional&&e.head>=e.anchor!=n&&(e=t.range(e.head,e.anchor));let i=r(e);return t.range(e.anchor,i.head,i.goalColumn,i.bidiLevel||void 0,i.assoc)});return!i.eq(e.state.selection)&&(e.dispatch(M(e.state,i)),!0)}function K(e,t){return G(e,t,n=>e.moveByChar(n,t))}var q=e=>K(e,!I(e)),vt=e=>K(e,I(e)),yt=e=>K(e,!0),bt=e=>K(e,!1),xt=e=>G(e,!0,t=>He(e.state,t,!0)),St=e=>G(e,!1,t=>He(e.state,t,!1));function J(e,t){return G(e,t,n=>e.moveByGroup(n,t))}var Ct=e=>J(e,!I(e)),wt=e=>J(e,I(e)),Tt=e=>J(e,!0),Et=e=>J(e,!1),Dt=e=>G(e,!0,t=>e.moveByChar(t,!0,n=>Xe(e,t.head,n)));function Ot(e,t){return G(e,t,n=>$e(e,n,t))}var kt=e=>Ot(e,!0),At=e=>Ot(e,!1),jt=e=>{let t=!I(e);return G(e,t,n=>z(e.state,n,t))},Mt=e=>{let t=I(e);return G(e,t,n=>z(e.state,n,t))};function Nt(e,t){return G(e,t,n=>e.moveVertically(n,t))}var Pt=e=>Nt(e,!1),Ft=e=>Nt(e,!0);function It(e,t){return G(e,t,n=>e.moveVertically(n,t,st(e).height))}var Lt=e=>It(e,!1),Rt=e=>It(e,!0),zt=e=>G(e,!0,t=>W(e,t,!0)),Bt=e=>G(e,!1,t=>W(e,t,!1)),Vt=e=>{let t=!I(e);return G(e,t,n=>W(e,n,t))},Ht=e=>{let t=I(e);return G(e,t,n=>W(e,n,t))},Ut=e=>G(e,!1,n=>t.cursor(e.lineBlockAt(n.head).from)),Wt=e=>G(e,!0,n=>t.cursor(e.lineBlockAt(n.head).to)),Gt=({state:e,dispatch:t})=>(t(M(e,{anchor:0})),!0),Kt=({state:e,dispatch:t})=>(t(M(e,{anchor:e.doc.length})),!0),qt=({state:e,dispatch:t})=>(t(M(e,{anchor:e.selection.main.anchor,head:0})),!0),Jt=({state:e,dispatch:t})=>(t(M(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),Yt=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:`select`})),!0),Xt=({state:e,dispatch:n})=>{let r=Q(e).map(({from:n,to:r})=>t.undirectionalRange(n,Math.min(r+1,e.doc.length)));return n(e.update({selection:t.create(r),userEvent:`select`})),!0},Zt=({state:e,dispatch:n})=>{let r=j(e.selection,n=>{let r=_(e),i=r.resolveStack(n.from,1);if(n.empty){let e=r.resolveStack(n.from,-1);e.node.from>=i.node.from&&e.node.to<=i.node.to&&(i=e)}for(let e=i;e;e=e.next){let{node:r}=e;if((r.from<n.from&&r.to>=n.to||r.to>n.to&&r.from<=n.from)&&e.next)return t.undirectionalRange(r.from,r.to)}return n});return!r.eq(e.selection)&&(n(M(e,r)),!0)};function Qt(e,n){let{state:r}=e,i=r.selection,a=r.selection.ranges.slice();for(let t of r.selection.ranges){let i=r.doc.lineAt(t.head);if(n?i.to<e.state.doc.length:i.from>0)for(let r=t;;){let t=e.moveVertically(r,n);if(t.head<i.from||t.head>i.to){a.some(e=>e.head==t.head)||a.push(t);break}if(t.head==r.head)break;r=t}}return a.length!=i.ranges.length&&(e.dispatch(M(r,t.create(a,a.length-1))),!0)}var $t=e=>Qt(e,!1),en=e=>Qt(e,!0),tn=({state:e,dispatch:n})=>{let r=e.selection,i=null;return r.ranges.length>1?i=t.create([r.main]):r.main.empty||(i=t.create([t.cursor(r.main.head)])),i?(n(M(e,i)),!0):!1};function Y(e,n){if(e.state.readOnly)return!1;let r=`delete.selection`,{state:i}=e,a=i.changeByRange(i=>{let{from:a,to:o}=i;if(a==o){let t=n(i);t<a?(r=`delete.backward`,t=X(e,t,!1)):t>a&&(r=`delete.forward`,t=X(e,t,!0)),a=Math.min(a,t),o=Math.max(o,t)}else a=X(e,a,!1),o=X(e,o,!0);return a==o?{range:i}:{changes:{from:a,to:o},range:t.cursor(a,a<i.head?-1:1)}});return!a.changes.empty&&(e.dispatch(i.update(a,{scrollIntoView:!0,userEvent:r,effects:r==`delete.selection`?m.announce.of(i.phrase(`Selection deleted`)):void 0})),!0)}function X(e,t,n){if(e instanceof m)for(let r of e.state.facet(m.atomicRanges).map(t=>t(e)))r.between(t,t,(e,r)=>{e<t&&r>t&&(t=n?r:e)});return t}var nn=(t,r,i)=>Y(t,a=>{let o=a.from,{state:s}=t,c=s.doc.lineAt(o),l,u;if(i&&!r&&o>c.from&&o<c.from+200&&!/[^ \t]/.test(l=c.text.slice(0,o-c.from))){if(l[l.length-1]==` `)return o-1;let e=n(l,s.tabSize)%ne(s)||ne(s);for(let t=0;t<e&&l[l.length-1-t]==` `;t++)o--;u=o}else u=e(c.text,o-c.from,r,r)+c.from,u==o&&c.number!=(r?s.doc.lines:1)?u+=r?1:-1:!r&&/[\ufe00-\ufe0f]/.test(c.text.slice(u-c.from,o-c.from))&&(u=e(c.text,u-c.from,!1,!1)+c.from);return u}),Z=e=>nn(e,!1,!0),rn=e=>nn(e,!1,!1),an=e=>nn(e,!0,!1),on=(t,n)=>Y(t,r=>{let i=r.head,{state:a}=t,o=a.doc.lineAt(i),s=a.charCategorizer(i);for(let t=null;;){if(i==(n?o.to:o.from)){i==r.head&&o.number!=(n?a.doc.lines:1)&&(i+=n?1:-1);break}let c=e(o.text,i-o.from,n)+o.from,l=o.text.slice(Math.min(i,c)-o.from,Math.max(i,c)-o.from),u=s(l);if(t!=null&&u!=t)break;(l!=` `||i!=r.head)&&(t=u),i=c}return i}),sn=e=>on(e,!1),cn=e=>on(e,!0),ln=e=>Y(e,t=>e.moveByChar(t,!0,n=>Xe(e,t.head,n)).head),un=e=>Y(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),dn=e=>Y(e,t=>{let n=e.lineBlockAt(t.head).from;return t.head>n?n:Math.max(0,t.head-1)}),fn=e=>Y(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),pn=e=>Y(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),mn=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=[];for(let t=0,r=``,i=e.doc.iter();;){if(i.next(),i.lineBreak||i.done){let e=r.search(/\s+$/);if(e>-1&&n.push({from:t-(r.length-e),to:t}),i.done)break;r=``}else r=i.value;t+=i.value.length}return n.length?(t(e.update({changes:n,userEvent:`delete`})),!0):!1},hn=({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:i.of([``,``])},range:t.cursor(e.from)}));return n(e.update(r,{scrollIntoView:!0,userEvent:`input`})),!0},gn=({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=n.changeByRange(r=>{if(!r.empty||r.from==0||r.from==n.doc.length)return{range:r};let i=r.from,a=n.doc.lineAt(i),o=i==a.from?i-1:e(a.text,i-a.from,!1)+a.from,s=i==a.to?i+1:e(a.text,i-a.from,!0)+a.from;return{changes:{from:o,to:s,insert:n.doc.slice(i,s).append(n.doc.slice(o,i))},range:t.cursor(s)}});return!i.changes.empty&&(r(n.update(i,{scrollIntoView:!0,userEvent:`move.character`})),!0)};function Q(e){let t=[],n=-1;for(let r of e.selection.ranges){let i=e.doc.lineAt(r.from),a=e.doc.lineAt(r.to);if(!r.empty&&r.to==a.from&&(a=e.doc.lineAt(r.to-1)),n>=i.number){let e=t[t.length-1];e.to=a.to,e.ranges.push(r)}else t.push({from:i.from,to:a.to,ranges:[r]});n=a.number+1}return t}function _n(e,n,r){if(e.readOnly)return!1;let i=[],a=[];for(let n of Q(e)){if(r?n.to==e.doc.length:n.from==0)continue;let o=e.doc.lineAt(r?n.to+1:n.from-1),s=o.length+1;if(r){i.push({from:n.to,to:o.to},{from:n.from,insert:o.text+e.lineBreak});for(let r of n.ranges)a.push(t.range(Math.min(e.doc.length,r.anchor+s),Math.min(e.doc.length,r.head+s)))}else{i.push({from:o.from,to:n.from},{from:n.to,insert:e.lineBreak+o.text});for(let e of n.ranges)a.push(t.range(e.anchor-s,e.head-s))}}return i.length?(n(e.update({changes:i,scrollIntoView:!0,selection:t.create(a,e.selection.mainIndex),userEvent:`move.line`})),!0):!1}var vn=({state:e,dispatch:t})=>_n(e,t,!1),yn=({state:e,dispatch:t})=>_n(e,t,!0);function bn(e,t,n){if(e.readOnly)return!1;let r=[];for(let t of Q(e))n?r.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):r.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});let i=e.changes(r);return t(e.update({changes:i,selection:e.selection.map(i,n?1:-1),scrollIntoView:!0,userEvent:`input.copyline`})),!0}var xn=({state:e,dispatch:t})=>bn(e,t,!1),Sn=({state:e,dispatch:t})=>bn(e,t,!0),Cn=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(Q(t).map(({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n}))),r=j(t.selection,t=>{let n;if(e.lineWrapping){let r=e.lineBlockAt(t.head),i=e.coordsAtPos(t.head,t.assoc||1);i&&(n=r.bottom+e.documentTop-i.bottom+e.defaultLineHeight/2)}return e.moveVertically(t,!0,n)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:`delete.line`}),!0},wn=({state:e,dispatch:t})=>(t(e.update(e.replaceSelection(e.lineBreak),{scrollIntoView:!0,userEvent:`input`})),!0),Tn=({state:e,dispatch:n})=>(n(e.update(e.changeByRange(n=>{let r=/^\s*/.exec(e.doc.lineAt(n.from).text)[0];return{changes:{from:n.from,to:n.to,insert:e.lineBreak+r},range:t.cursor(n.from+r.length+1)}}),{scrollIntoView:!0,userEvent:`input`})),!0);function En(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=_(e).resolveInner(t),r=n.childBefore(t),i=n.childAfter(t),a;return r&&i&&r.to<=t&&i.from>=t&&(a=r.type.prop(te.closedBy))&&a.indexOf(i.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(i.from).from&&!/\S/.test(e.sliceDoc(r.to,i.from))?{from:r.to,to:i.from}:null}var Dn=/*@__PURE__*/ kn(!1),On=/*@__PURE__*/ kn(!0);function kn(e){return({state:r,dispatch:a})=>{if(r.readOnly)return!1;let o=r.changeByRange(a=>{let{from:o,to:s}=a,c=r.doc.lineAt(o),l=!e&&o==s&&En(r,o);e&&(o=s=(s<=c.to?c:r.doc.lineAt(s)).to);let u=new ee(r,{simulateBreak:o,simulateDoubleBreak:!!l}),d=re(u,o);for(d??=n(/^\s*/.exec(r.doc.lineAt(o).text)[0],r.tabSize);s<c.to&&/\s/.test(c.text[s-c.from]);)s++;l?{from:o,to:s}=l:o>c.from&&o<c.from+100&&!/\S/.test(c.text.slice(0,o))&&(o=c.from);let f=[``,h(r,d)];return l&&f.push(h(r,u.lineIndent(c.from,-1))),{changes:{from:o,to:s,insert:i.of(f)},range:t.cursor(o+1+f[1].length)}});return a(r.update(o,{scrollIntoView:!0,userEvent:`input`})),!0}}function An(e,n){let r=-1;return e.changeByRange(i=>{let a=[];for(let t=i.from;t<=i.to;){let o=e.doc.lineAt(t);o.number>r&&(i.empty||i.to>o.from)&&(n(o,a,i),r=o.number),t=o.to+1}let o=e.changes(a);return{changes:a,range:t.range(o.mapPos(i.anchor,1),o.mapPos(i.head,1))}})}var jn=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new ee(e,{overrideIndentation:e=>n[e]??-1}),i=An(e,(t,i,a)=>{let o=re(r,t.from);if(o==null)return;/\S/.test(t.text)||(o=0);let s=/^\s*/.exec(t.text)[0],c=h(e,o);(s!=c||a.from<t.from+s.length)&&(n[t.from]=o,i.push({from:t.from,to:t.from+s.length,insert:c}))});return i.changes.empty||t(e.update(i,{userEvent:`indent`})),!0},$=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(An(e,(t,n)=>{n.push({from:t.from,insert:e.facet(ie)})}),{userEvent:`input.indent`})),!0),Mn=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(An(e,(t,r)=>{let i=/^\s*/.exec(t.text)[0];if(!i)return;let a=n(i,e.tabSize),o=0,s=h(e,Math.max(0,a-ne(e)));for(;o<i.length&&o<s.length&&i.charCodeAt(o)==s.charCodeAt(o);)o++;r.push({from:t.from+o,to:t.from+i.length,insert:s.slice(o)})}),{userEvent:`delete.dedent`})),!0),Nn=e=>(e.setTabFocusMode(),!0),Pn=e=>(e.setTabFocusMode(2e3),!0),Fn=({state:e,dispatch:t})=>e.selection.ranges.some(e=>!e.empty)?$({state:e,dispatch:t}):(t(e.update(e.replaceSelection(` `),{scrollIntoView:!0,userEvent:`input`})),!0),In=[{key:`Ctrl-b`,run:L,shift:q,preventDefault:!0},{key:`Ctrl-f`,run:ze,shift:vt},{key:`Ctrl-p`,run:B,shift:Pt},{key:`Ctrl-n`,run:V,shift:Ft},{key:`Ctrl-a`,run:pt,shift:Ut},{key:`Ctrl-e`,run:mt,shift:Wt},{key:`Ctrl-d`,run:an},{key:`Ctrl-h`,run:Z},{key:`Ctrl-k`,run:un},{key:`Ctrl-Alt-h`,run:sn},{key:`Ctrl-o`,run:hn},{key:`Ctrl-t`,run:gn},{key:`Ctrl-v`,run:U}],Ln=/*@__PURE__*/ [{key:`ArrowLeft`,run:L,shift:q,preventDefault:!0},{key:`Mod-ArrowLeft`,mac:`Alt-ArrowLeft`,run:Ke,shift:Ct,preventDefault:!0},{mac:`Cmd-ArrowLeft`,run:dt,shift:Vt,preventDefault:!0},{key:`ArrowRight`,run:ze,shift:vt,preventDefault:!0},{key:`Mod-ArrowRight`,mac:`Alt-ArrowRight`,run:qe,shift:wt,preventDefault:!0},{mac:`Cmd-ArrowRight`,run:ft,shift:Ht,preventDefault:!0},{key:`ArrowUp`,run:B,shift:Pt,preventDefault:!0},{mac:`Cmd-ArrowUp`,run:Gt,shift:qt},{mac:`Ctrl-ArrowUp`,run:H,shift:Lt},{key:`ArrowDown`,run:V,shift:Ft,preventDefault:!0},{mac:`Cmd-ArrowDown`,run:Kt,shift:Jt},{mac:`Ctrl-ArrowDown`,run:U,shift:Rt},{key:`PageUp`,run:H,shift:Lt},{key:`PageDown`,run:U,shift:Rt},{key:`Home`,run:ut,shift:Bt,preventDefault:!0},{key:`Mod-Home`,run:Gt,shift:qt},{key:`End`,run:lt,shift:zt,preventDefault:!0},{key:`Mod-End`,run:Kt,shift:Jt},{key:`Enter`,run:Dn,shift:Dn},{key:`Mod-a`,run:Yt},{key:`Backspace`,run:Z,shift:Z,preventDefault:!0},{key:`Delete`,run:an,preventDefault:!0},{key:`Mod-Backspace`,mac:`Alt-Backspace`,run:sn,preventDefault:!0},{key:`Mod-Delete`,mac:`Alt-Delete`,run:cn,preventDefault:!0},{mac:`Mod-Backspace`,run:fn,preventDefault:!0},{mac:`Mod-Delete`,run:pn,preventDefault:!0}].concat(/*@__PURE__*/ In.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),Rn=/*@__PURE__*/ [{key:`Alt-ArrowLeft`,mac:`Ctrl-ArrowLeft`,run:it,shift:jt},{key:`Alt-ArrowRight`,mac:`Ctrl-ArrowRight`,run:at,shift:Mt},{key:`Alt-ArrowUp`,run:vn},{key:`Shift-Alt-ArrowUp`,run:xn},{key:`Alt-ArrowDown`,run:yn},{key:`Shift-Alt-ArrowDown`,run:Sn},{key:`Mod-Alt-ArrowUp`,run:$t},{key:`Mod-Alt-ArrowDown`,run:en},{key:`Escape`,run:tn},{key:`Mod-Enter`,run:On},{key:`Alt-l`,mac:`Ctrl-l`,run:Xt},{key:`Mod-i`,run:Zt,preventDefault:!0},{key:`Mod-[`,run:Mn},{key:`Mod-]`,run:$},{key:`Mod-Alt-\\`,run:jn},{key:`Shift-Mod-k`,run:Cn},{key:`Shift-Mod-\\`,run:gt},{key:`Mod-/`,run:ae},{key:`Alt-A`,mac:`Ctrl-A`,run:le},{key:`Ctrl-m`,mac:`Shift-Alt-m`,run:Nn}].concat(Ln),zn={key:`Tab`,run:$,shift:Mn};export{$t as addCursorAbove,en as addCursorBelow,ue as blockComment,de as blockUncomment,Oe as canRedoSelection,De as canUndoSelection,Sn as copyLineDown,xn as copyLineUp,Ve as cursorCharBackward,Ge as cursorCharBackwardLogical,Be as cursorCharForward,We as cursorCharForwardLogical,L as cursorCharLeft,ze as cursorCharRight,Kt as cursorDocEnd,Gt as cursorDocStart,Ye as cursorGroupBackward,Je as cursorGroupForward,Ze as cursorGroupForwardWin,Ke as cursorGroupLeft,qe as cursorGroupRight,ut as cursorLineBoundaryBackward,lt as cursorLineBoundaryForward,dt as cursorLineBoundaryLeft,ft as cursorLineBoundaryRight,V as cursorLineDown,mt as cursorLineEnd,pt as cursorLineStart,B as cursorLineUp,gt as cursorMatchingBracket,U as cursorPageDown,H as cursorPageUp,nt as cursorSubwordBackward,tt as cursorSubwordForward,it as cursorSyntaxLeft,at as cursorSyntaxRight,Rn as defaultKeymap,Z as deleteCharBackward,rn as deleteCharBackwardStrict,an as deleteCharForward,sn as deleteGroupBackward,cn as deleteGroupForward,ln as deleteGroupForwardWin,Cn as deleteLine,fn as deleteLineBoundaryBackward,pn as deleteLineBoundaryForward,un as deleteToLineEnd,dn as deleteToLineStart,mn as deleteTrailingWhitespace,In as emacsStyleKeymap,ve as history,ye as historyField,Re as historyKeymap,Mn as indentLess,$ as indentMore,jn as indentSelection,zn as indentWithTab,On as insertBlankLine,wn as insertNewline,Dn as insertNewlineAndIndent,Tn as insertNewlineKeepIndent,Fn as insertTab,ge as invertedEffects,he as isolateHistory,se as lineComment,ce as lineUncomment,yn as moveLineDown,vn as moveLineUp,E as redo,Te as redoDepth,Se as redoSelection,Yt as selectAll,bt as selectCharBackward,St as selectCharBackwardLogical,yt as selectCharForward,xt as selectCharForwardLogical,q as selectCharLeft,vt as selectCharRight,Jt as selectDocEnd,qt as selectDocStart,Et as selectGroupBackward,Tt as selectGroupForward,Dt as selectGroupForwardWin,Ct as selectGroupLeft,wt as selectGroupRight,Xt as selectLine,Bt as selectLineBoundaryBackward,zt as selectLineBoundaryForward,Vt as selectLineBoundaryLeft,Ht as selectLineBoundaryRight,Ft as selectLineDown,Wt as selectLineEnd,Ut as selectLineStart,Pt as selectLineUp,_t as selectMatchingBracket,Rt as selectPageDown,Lt as selectPageUp,Zt as selectParentSyntax,At as selectSubwordBackward,kt as selectSubwordForward,jt as selectSyntaxLeft,Mt as selectSyntaxRight,tn as simplifySelection,hn as splitLine,Ln as standardKeymap,Pn as temporarilySetTabFocusMode,le as toggleBlockComment,fe as toggleBlockCommentByLine,ae as toggleComment,oe as toggleLineComment,Nn as toggleTabFocusMode,gn as transposeChars,be as undo,we as undoDepth,xe as undoSelection};
6
+ import{S as e,a as t,b as n,g as r,h as i,i as a,m as o,n as s,p as c,r as l,s as u,t as d,y as f}from"./dist-D25hs99E.js";import{n as p,r as m}from"./dist-Vr-fb58P.js";import{IndentContext as ee,a as te,getIndentUnit as ne,getIndentation as re,indentString as h,indentUnit as ie,matchBrackets as g,syntaxTree as _}from"./dist-F28mE6nM.js";var ae=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=y(e.state,n.from);return r.line?oe(e):r.block?fe(e):!1};function v(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=e(t,n);return i?(r(n.update(i)),!0):!1}}var oe=/*@__PURE__*/ v(S,0),se=/*@__PURE__*/ v(S,1),ce=/*@__PURE__*/ v(S,2),le=/*@__PURE__*/ v(x,0),ue=/*@__PURE__*/ v(x,1),de=/*@__PURE__*/ v(x,2),fe=/*@__PURE__*/ v((e,t)=>x(e,t,me(t)),0);function y(e,t){let n=e.languageDataAt(`commentTokens`,t,1);return n.length?n[0]:{}}var b=50;function pe(e,{open:t,close:n},r,i){let a=e.sliceDoc(r-b,r),o=e.sliceDoc(i,i+b),s=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(o)[0].length,l=a.length-s;if(a.slice(l-t.length,l)==t&&o.slice(c,c+n.length)==n)return{open:{pos:r-s,margin:s&&1},close:{pos:i+c,margin:c&&1}};let u,d;i-r<=100?u=d=e.sliceDoc(r,i):(u=e.sliceDoc(r,r+b),d=e.sliceDoc(i-b,i));let f=/^\s*/.exec(u)[0].length,p=/\s*$/.exec(d)[0].length,m=d.length-p-n.length;return u.slice(f,f+t.length)==t&&d.slice(m,m+n.length)==n?{open:{pos:r+f+t.length,margin:+!!/\s/.test(u.charAt(f+t.length))},close:{pos:i-p-n.length,margin:+!!/\s/.test(d.charAt(m-1))}}:null}function me(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),i=n.to<=r.to?r:e.doc.lineAt(n.to);i.from>r.from&&i.from==n.to&&(i=n.to==r.to+1?r:e.doc.lineAt(n.to-1));let a=t.length-1;a>=0&&t[a].to>r.from?t[a].to=i.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return t}function x(e,t,n=t.selection.ranges){let r=n.map(e=>y(t,e.from).block);if(!r.every(e=>e))return null;let i=n.map((e,n)=>pe(t,r[n],e.from,e.to));if(e!=2&&!i.every(e=>e))return{changes:t.changes(n.map((e,t)=>i[t]?[]:[{from:e.from,insert:r[t].open+` `},{from:e.to,insert:` `+r[t].close}]))};if(e!=1&&i.some(e=>e)){let e=[];for(let t=0,n;t<i.length;t++)if(n=i[t]){let i=r[t],{open:a,close:o}=n;e.push({from:a.pos-i.open.length,to:a.pos+a.margin},{from:o.pos-o.margin,to:o.pos+i.close.length})}return{changes:e}}return null}function S(e,t,n=t.selection.ranges){let r=[],i=-1;ranges:for(let{from:e,to:a}of n){let n=r.length,o=1e9,s;for(let n=e;n<=a;){let c=t.doc.lineAt(n);if(s==null&&(s=y(t,c.from).line,!s))continue ranges;if(c.from>i&&(e==a||a>c.from)){i=c.from;let e=/^\s*/.exec(c.text)[0].length,t=e==c.length,n=c.text.slice(e,e+s.length)==s?e:-1;e<c.text.length&&e<o&&(o=e),r.push({line:c,comment:n,token:s,indent:e,empty:t,single:!1})}n=c.to+1}if(o<1e9)for(let e=n;e<r.length;e++)r[e].indent<r[e].line.text.length&&(r[e].indent=o);r.length==n+1&&(r[n].single=!0)}if(e!=2&&r.some(e=>e.comment<0&&(!e.empty||e.single))){let e=[];for(let{line:t,token:n,indent:i,empty:a,single:o}of r)(o||!a)&&e.push({from:t.from+i,insert:n+` `});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}if(e!=1&&r.some(e=>e.comment>=0)){let e=[];for(let{line:t,comment:n,token:i}of r)if(n>=0){let r=t.from+n,a=r+i.length;t.text[a-t.from]==` `&&a++,e.push({from:r,to:a})}return{changes:e}}return null}var C=/*@__PURE__*/ d.define(),he=/*@__PURE__*/ d.define(),ge=/*@__PURE__*/ u.define(),_e=/*@__PURE__*/ u.define({combine(e){return f(e,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,r)=>e(n,r)||t(n,r)})}}),w=/*@__PURE__*/ o.define({create(){return A.empty},update(e,t){let n=t.state.facet(_e),i=t.annotation(C);if(i){let r=D.fromTransaction(t,i.selection),a=i.side,o=a==0?e.undone:e.done;return o=r?O(o,o.length,n.minDepth,r):Ne(o,t.startState.selection),new A(a==0?i.rest:o,a==0?o:i.rest)}let a=t.annotation(he);if((a==`full`||a==`before`)&&(e=e.isolate()),t.annotation(r.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let o=D.fromTransaction(t),s=t.annotation(r.time),c=t.annotation(r.userEvent);return o?e=e.addChanges(o,s,c,n,t):t.selection&&(e=e.addSelection(t.startState.selection,s,c,n.newGroupDelay)),(a==`full`||a==`after`)&&(e=e.isolate()),e},toJSON(e){return{done:e.done.map(e=>e.toJSON()),undone:e.undone.map(e=>e.toJSON())}},fromJSON(e){return new A(e.done.map(D.fromJSON),e.undone.map(D.fromJSON))}});function ve(e={}){return[w,_e.of(e),m.domEventHandlers({beforeinput(e,t){let n=e.inputType==`historyUndo`?be:e.inputType==`historyRedo`?E:null;return n?(e.preventDefault(),n(t)):!1}})]}var ye=w;function T(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let i=n.field(w,!1);if(!i)return!1;let a=i.pop(e,n,t);return a?(r(a),!0):!1}}var be=/*@__PURE__*/ T(0,!1),E=/*@__PURE__*/ T(1,!1),xe=/*@__PURE__*/ T(0,!0),Se=/*@__PURE__*/ T(1,!0);function Ce(e){return function(t){let n=t.field(w,!1);if(!n)return 0;let r=e==0?n.done:n.undone;return r.length-(r.length&&!r[0].changes?1:0)}}var we=/*@__PURE__*/ Ce(0),Te=/*@__PURE__*/ Ce(1);function Ee(e){return function(t){let n=t.field(w,!1);if(!n)return!1;let r=e==0?n.done:n.undone;return r.length>0&&r[0].selectionsAfter.length>0}}var De=/*@__PURE__*/ Ee(0),Oe=/*@__PURE__*/ Ee(0),D=class e{constructor(e,t,n,r,i){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=r,this.selectionsAfter=i}setSelAfter(t){return new e(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){return{changes:this.changes?.toJSON(),mapped:this.mapped?.toJSON(),startSelection:this.startSelection?.toJSON(),selectionsAfter:this.selectionsAfter.map(e=>e.toJSON())}}static fromJSON(n){return new e(n.changes&&l.fromJSON(n.changes),[],n.mapped&&s.fromJSON(n.mapped),n.startSelection&&t.fromJSON(n.startSelection),n.selectionsAfter.map(t.fromJSON))}static fromTransaction(t,n){let r=k;for(let e of t.startState.facet(ge)){let n=e(t);n.length&&(r=r.concat(n))}return!r.length&&t.changes.empty?null:new e(t.changes.invert(t.startState.doc),r,void 0,n||t.startState.selection,k)}static selection(t){return new e(void 0,k,void 0,void 0,t)}};function O(e,t,n,r){let i=t+1>n+20?t-n-1:0,a=e.slice(i,t);return a.push(r),a}function ke(e,t){let n=[],r=!1;return e.iterChangedRanges((e,t)=>n.push(e,t)),t.iterChangedRanges((e,t,i,a)=>{for(let e=0;e<n.length;){let t=n[e++],o=n[e++];a>=t&&i<=o&&(r=!0)}}),r}function Ae(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((e,n)=>e.empty!=t.ranges[n].empty).length===0}function je(e,t){return e.length?t.length?e.concat(t):e:t}var k=[],Me=200;function Ne(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-Me));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),O(e,e.length-1,1e9,n.setSelAfter(r)))}return[D.selection([t])]}function Pe(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function Fe(e,t){if(!e.length)return e;let n=e.length,r=k;for(;n;){let i=Ie(e[n-1],t,r);if(i.changes&&!i.changes.empty||i.effects.length){let t=e.slice(0,n);return t[n-1]=i,t}t=i.mapped,n--,r=i.selectionsAfter}return r.length?[D.selection(r)]:k}function Ie(e,t,n){let r=je(e.selectionsAfter.length?e.selectionsAfter.map(e=>e.map(t)):k,n);if(!e.changes)return D.selection(r);let i=e.changes.map(t),a=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(a):a;return new D(i,c.mapEffects(e.effects,t),o,e.startSelection.map(a),r)}var Le=/^(input\.type|delete)($|\.)/,A=class e{constructor(e,t,n=0,r=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new e(this.done,this.undone):this}addChanges(t,n,r,i,a){let o=this.done,s=o[o.length-1];return o=s&&s.changes&&!s.changes.empty&&t.changes&&(!r||Le.test(r))&&(!s.selectionsAfter.length&&n-this.prevTime<i.newGroupDelay&&i.joinToEvent(a,ke(s.changes,t.changes))||r==`input.type.compose`)?O(o,o.length-1,i.minDepth,new D(t.changes.compose(s.changes),je(c.mapEffects(t.effects,s.changes),s.effects),s.mapped,s.startSelection,k)):O(o,o.length,i.minDepth,t),new e(o,k,n,r)}addSelection(t,n,r,i){let a=this.done.length?this.done[this.done.length-1].selectionsAfter:k;return a.length>0&&n-this.prevTime<i&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&Ae(a[a.length-1],t)?this:new e(Ne(this.done,t),this.undone,n,r)}addMapping(t){return new e(Fe(this.done,t),Fe(this.undone,t),this.prevTime,this.prevUserEvent)}pop(e,t,n){let r=e==0?this.done:this.undone;if(r.length==0)return null;let i=r[r.length-1],a=i.selectionsAfter[0]||(i.startSelection?i.startSelection.map(i.changes.invertedDesc,1):t.selection);if(n&&i.selectionsAfter.length)return t.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:C.of({side:e,rest:Pe(r),selection:a}),userEvent:e==0?`select.undo`:`select.redo`,scrollIntoView:!0});if(i.changes){let n=r.length==1?k:r.slice(0,r.length-1);return i.mapped&&(n=Fe(n,i.mapped)),t.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:C.of({side:e,rest:n,selection:a}),filter:!1,userEvent:e==0?`undo`:`redo`,scrollIntoView:!0})}return null}};A.empty=/*@__PURE__*/ new A(k,k);var Re=[{key:`Mod-z`,run:be,preventDefault:!0},{key:`Mod-y`,mac:`Mod-Shift-z`,run:E,preventDefault:!0},{linux:`Ctrl-Shift-z`,run:E,preventDefault:!0},{key:`Mod-u`,run:xe,preventDefault:!0},{key:`Alt-u`,mac:`Mod-Shift-u`,run:Se,preventDefault:!0}];function j(e,n){return t.create(e.ranges.map(n),e.mainIndex)}function M(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:`select`})}function N({state:e,dispatch:t},n){let r=j(e.selection,n);return!r.eq(e.selection,!0)&&(t(M(e,r)),!0)}function P(e,n){return t.cursor(n?e.to:e.from)}function F(e,t){return N(e,n=>n.empty?e.moveByChar(n,t):P(n,t))}function I(e){return e.textDirectionAt(e.state.selection.main.head)==p.LTR}var L=e=>F(e,!I(e)),ze=e=>F(e,I(e)),Be=e=>F(e,!0),Ve=e=>F(e,!1);function He(n,r,i){let a=r.head,o=n.doc.lineAt(a);return a=a==(i?o.to:o.from)?i?Math.min(n.doc.length,o.to+1):Math.max(0,o.from-1):o.from+e(o.text,a-o.from,i),t.cursor(a,i?-1:1)}function Ue(e,t){return N(e,n=>n.empty?He(e.state,n,t):P(n,t))}var We=e=>Ue(e,!0),Ge=e=>Ue(e,!1);function R(e,t){return N(e,n=>n.empty?e.moveByGroup(n,t):P(n,t))}var Ke=e=>R(e,!I(e)),qe=e=>R(e,I(e)),Je=e=>R(e,!0),Ye=e=>R(e,!1);function Xe(e,t,n){let r=e.state.charCategorizer(t),i=r(n),o=i!=a.Space;return e=>{let t=r(e);return t==a.Space?(o=!1,!0):o&&t==i}}var Ze=e=>N(e,t=>t.empty?e.moveByChar(t,!0,n=>Xe(e,t.head,n)):P(t,!0)),Qe=typeof Intl<`u`&&Intl.Segmenter?/*@__PURE__*/ new Intl.Segmenter(void 0,{granularity:`word`}):null;function $e(e,n,r){let i=e.state.charCategorizer(n.from),o=a.Space,s=n.from,c=0,l=!1,u=!1,d=!1,f=t=>{if(l)return!1;s+=r?t.length:-t.length;let n=i(t),f;if(n==a.Word&&t.charCodeAt(0)<128&&/[\W_]/.test(t)&&(n=-1),o==a.Space&&(o=n),o!=n)return!1;if(o==a.Word){if(t.toLowerCase()==t){if(!r&&u)return!1;d=!0}else if(d){if(r)return!1;l=!0}else{if(u&&r&&i(f=e.state.sliceDoc(s,s+1))==a.Word&&f.toLowerCase()==f)return!1;u=!0}}return c++,!0},p=e.moveByChar(n,r,e=>(f(e),f));if(Qe&&o==a.Word&&p.from==n.from+c*(r?1:-1)){let i=Math.min(n.head,p.head),a=Math.max(n.head,p.head),o=e.state.sliceDoc(i,a);if(o.length>1&&/[\u4E00-\uffff]/.test(o)){let e=Array.from(Qe.segment(o));if(e.length>1)return r?t.cursor(n.head+e[1].index,-1):t.cursor(p.head+e[e.length-1].index,1)}}return p}function et(e,t){return N(e,n=>n.empty?$e(e,n,t):P(n,t))}var tt=e=>et(e,!0),nt=e=>et(e,!1);function rt(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function z(e,n,r){let i=_(e).resolveInner(n.head),a=r?te.closedBy:te.openedBy;for(let t=n.head;;){let n=r?i.childAfter(t):i.childBefore(t);if(!n)break;rt(e,n,a)?i=n:t=r?n.to:n.from}let o=i.type.prop(a),s,c;return c=o&&(s=r?g(e,i.from,1):g(e,i.to,-1))&&s.matched?r?s.end.to:s.end.from:r?i.to:i.from,t.cursor(c,r?-1:1)}var it=e=>N(e,t=>z(e.state,t,!I(e))),at=e=>N(e,t=>z(e.state,t,I(e)));function ot(e,t){return N(e,n=>{if(!n.empty)return P(n,t);let r=e.moveVertically(n,t);return r.head==n.head?e.moveToLineBoundary(n,t):r})}var B=e=>ot(e,!1),V=e=>ot(e,!0);function st(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,i;if(t){for(let t of e.state.facet(m.scrollMargins)){let i=t(e);i?.top&&(n=Math.max(i?.top,n)),i?.bottom&&(r=Math.max(i?.bottom,r))}i=e.scrollDOM.clientHeight-n-r}else i=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:t,height:Math.max(e.defaultLineHeight,i-5)}}function ct(e,t){let n=st(e),{state:r}=e,i=j(r.selection,r=>r.empty?e.moveVertically(r,t,n.height):P(r,t));if(i.eq(r.selection))return!1;let a;if(n.selfScroll){let t=e.coordsAtPos(r.selection.main.head),o=e.scrollDOM.getBoundingClientRect(),s=o.top+n.marginTop,c=o.bottom-n.marginBottom;t&&t.top>s&&t.bottom<c&&(a=m.scrollIntoView(i.main.head,{y:`start`,yMargin:t.top-s}))}return e.dispatch(M(r,i),{effects:a}),!0}var H=e=>ct(e,!1),U=e=>ct(e,!0);function W(e,n,r){let i=e.lineBlockAt(n.head),a=e.moveToLineBoundary(n,r);if(a.head==n.head&&a.head!=(r?i.to:i.from)&&(a=e.moveToLineBoundary(n,r,!1)),!r&&a.head==i.from&&i.length){let r=/^\s*/.exec(e.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;r&&n.head!=i.from+r&&(a=t.cursor(i.from+r))}return a}var lt=e=>N(e,t=>W(e,t,!0)),ut=e=>N(e,t=>W(e,t,!1)),dt=e=>N(e,t=>W(e,t,!I(e))),ft=e=>N(e,t=>W(e,t,I(e))),pt=e=>N(e,n=>t.cursor(e.lineBlockAt(n.head).from,1)),mt=e=>N(e,n=>t.cursor(e.lineBlockAt(n.head).to,-1));function ht(e,n,r){let i=!1,a=j(e.selection,n=>{let a=g(e,n.head,-1)||g(e,n.head,1)||n.head>0&&g(e,n.head-1,1)||n.head<e.doc.length&&g(e,n.head+1,-1);if(!a||!a.end)return n;i=!0;let o=a.start.from==n.head?a.end.to:a.end.from;return r?t.range(n.anchor,o):t.cursor(o)});return i?(n(M(e,a)),!0):!1}var gt=({state:e,dispatch:t})=>ht(e,t,!1),_t=({state:e,dispatch:t})=>ht(e,t,!0);function G(e,n,r){let i=j(e.state.selection,e=>{e.undirectional&&e.head>=e.anchor!=n&&(e=t.range(e.head,e.anchor));let i=r(e);return t.range(e.anchor,i.head,i.goalColumn,i.bidiLevel||void 0,i.assoc)});return!i.eq(e.state.selection)&&(e.dispatch(M(e.state,i)),!0)}function K(e,t){return G(e,t,n=>e.moveByChar(n,t))}var q=e=>K(e,!I(e)),vt=e=>K(e,I(e)),yt=e=>K(e,!0),bt=e=>K(e,!1),xt=e=>G(e,!0,t=>He(e.state,t,!0)),St=e=>G(e,!1,t=>He(e.state,t,!1));function J(e,t){return G(e,t,n=>e.moveByGroup(n,t))}var Ct=e=>J(e,!I(e)),wt=e=>J(e,I(e)),Tt=e=>J(e,!0),Et=e=>J(e,!1),Dt=e=>G(e,!0,t=>e.moveByChar(t,!0,n=>Xe(e,t.head,n)));function Ot(e,t){return G(e,t,n=>$e(e,n,t))}var kt=e=>Ot(e,!0),At=e=>Ot(e,!1),jt=e=>{let t=!I(e);return G(e,t,n=>z(e.state,n,t))},Mt=e=>{let t=I(e);return G(e,t,n=>z(e.state,n,t))};function Nt(e,t){return G(e,t,n=>e.moveVertically(n,t))}var Pt=e=>Nt(e,!1),Ft=e=>Nt(e,!0);function It(e,t){return G(e,t,n=>e.moveVertically(n,t,st(e).height))}var Lt=e=>It(e,!1),Rt=e=>It(e,!0),zt=e=>G(e,!0,t=>W(e,t,!0)),Bt=e=>G(e,!1,t=>W(e,t,!1)),Vt=e=>{let t=!I(e);return G(e,t,n=>W(e,n,t))},Ht=e=>{let t=I(e);return G(e,t,n=>W(e,n,t))},Ut=e=>G(e,!1,n=>t.cursor(e.lineBlockAt(n.head).from)),Wt=e=>G(e,!0,n=>t.cursor(e.lineBlockAt(n.head).to)),Gt=({state:e,dispatch:t})=>(t(M(e,{anchor:0})),!0),Kt=({state:e,dispatch:t})=>(t(M(e,{anchor:e.doc.length})),!0),qt=({state:e,dispatch:t})=>(t(M(e,{anchor:e.selection.main.anchor,head:0})),!0),Jt=({state:e,dispatch:t})=>(t(M(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),Yt=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:`select`})),!0),Xt=({state:e,dispatch:n})=>{let r=Q(e).map(({from:n,to:r})=>t.undirectionalRange(n,Math.min(r+1,e.doc.length)));return n(e.update({selection:t.create(r),userEvent:`select`})),!0},Zt=({state:e,dispatch:n})=>{let r=j(e.selection,n=>{let r=_(e),i=r.resolveStack(n.from,1);if(n.empty){let e=r.resolveStack(n.from,-1);e.node.from>=i.node.from&&e.node.to<=i.node.to&&(i=e)}for(let e=i;e;e=e.next){let{node:r}=e;if((r.from<n.from&&r.to>=n.to||r.to>n.to&&r.from<=n.from)&&e.next)return t.undirectionalRange(r.from,r.to)}return n});return!r.eq(e.selection)&&(n(M(e,r)),!0)};function Qt(e,n){let{state:r}=e,i=r.selection,a=r.selection.ranges.slice();for(let t of r.selection.ranges){let i=r.doc.lineAt(t.head);if(n?i.to<e.state.doc.length:i.from>0)for(let r=t;;){let t=e.moveVertically(r,n);if(t.head<i.from||t.head>i.to){a.some(e=>e.head==t.head)||a.push(t);break}if(t.head==r.head)break;r=t}}return a.length!=i.ranges.length&&(e.dispatch(M(r,t.create(a,a.length-1))),!0)}var $t=e=>Qt(e,!1),en=e=>Qt(e,!0),tn=({state:e,dispatch:n})=>{let r=e.selection,i=null;return r.ranges.length>1?i=t.create([r.main]):r.main.empty||(i=t.create([t.cursor(r.main.head)])),i?(n(M(e,i)),!0):!1};function Y(e,n){if(e.state.readOnly)return!1;let r=`delete.selection`,{state:i}=e,a=i.changeByRange(i=>{let{from:a,to:o}=i;if(a==o){let t=n(i);t<a?(r=`delete.backward`,t=X(e,t,!1)):t>a&&(r=`delete.forward`,t=X(e,t,!0)),a=Math.min(a,t),o=Math.max(o,t)}else a=X(e,a,!1),o=X(e,o,!0);return a==o?{range:i}:{changes:{from:a,to:o},range:t.cursor(a,a<i.head?-1:1)}});return!a.changes.empty&&(e.dispatch(i.update(a,{scrollIntoView:!0,userEvent:r,effects:r==`delete.selection`?m.announce.of(i.phrase(`Selection deleted`)):void 0})),!0)}function X(e,t,n){if(e instanceof m)for(let r of e.state.facet(m.atomicRanges).map(t=>t(e)))r.between(t,t,(e,r)=>{e<t&&r>t&&(t=n?r:e)});return t}var nn=(t,r,i)=>Y(t,a=>{let o=a.from,{state:s}=t,c=s.doc.lineAt(o),l,u;if(i&&!r&&o>c.from&&o<c.from+200&&!/[^ \t]/.test(l=c.text.slice(0,o-c.from))){if(l[l.length-1]==` `)return o-1;let e=n(l,s.tabSize)%ne(s)||ne(s);for(let t=0;t<e&&l[l.length-1-t]==` `;t++)o--;u=o}else u=e(c.text,o-c.from,r,r)+c.from,u==o&&c.number!=(r?s.doc.lines:1)?u+=r?1:-1:!r&&/[\ufe00-\ufe0f]/.test(c.text.slice(u-c.from,o-c.from))&&(u=e(c.text,u-c.from,!1,!1)+c.from);return u}),Z=e=>nn(e,!1,!0),rn=e=>nn(e,!1,!1),an=e=>nn(e,!0,!1),on=(t,n)=>Y(t,r=>{let i=r.head,{state:a}=t,o=a.doc.lineAt(i),s=a.charCategorizer(i);for(let t=null;;){if(i==(n?o.to:o.from)){i==r.head&&o.number!=(n?a.doc.lines:1)&&(i+=n?1:-1);break}let c=e(o.text,i-o.from,n)+o.from,l=o.text.slice(Math.min(i,c)-o.from,Math.max(i,c)-o.from),u=s(l);if(t!=null&&u!=t)break;(l!=` `||i!=r.head)&&(t=u),i=c}return i}),sn=e=>on(e,!1),cn=e=>on(e,!0),ln=e=>Y(e,t=>e.moveByChar(t,!0,n=>Xe(e,t.head,n)).head),un=e=>Y(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),dn=e=>Y(e,t=>{let n=e.lineBlockAt(t.head).from;return t.head>n?n:Math.max(0,t.head-1)}),fn=e=>Y(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),pn=e=>Y(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),mn=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=[];for(let t=0,r=``,i=e.doc.iter();;){if(i.next(),i.lineBreak||i.done){let e=r.search(/\s+$/);if(e>-1&&n.push({from:t-(r.length-e),to:t}),i.done)break;r=``}else r=i.value;t+=i.value.length}return n.length?(t(e.update({changes:n,userEvent:`delete`})),!0):!1},hn=({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:i.of([``,``])},range:t.cursor(e.from)}));return n(e.update(r,{scrollIntoView:!0,userEvent:`input`})),!0},gn=({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=n.changeByRange(r=>{if(!r.empty||r.from==0||r.from==n.doc.length)return{range:r};let i=r.from,a=n.doc.lineAt(i),o=i==a.from?i-1:e(a.text,i-a.from,!1)+a.from,s=i==a.to?i+1:e(a.text,i-a.from,!0)+a.from;return{changes:{from:o,to:s,insert:n.doc.slice(i,s).append(n.doc.slice(o,i))},range:t.cursor(s)}});return!i.changes.empty&&(r(n.update(i,{scrollIntoView:!0,userEvent:`move.character`})),!0)};function Q(e){let t=[],n=-1;for(let r of e.selection.ranges){let i=e.doc.lineAt(r.from),a=e.doc.lineAt(r.to);if(!r.empty&&r.to==a.from&&(a=e.doc.lineAt(r.to-1)),n>=i.number){let e=t[t.length-1];e.to=a.to,e.ranges.push(r)}else t.push({from:i.from,to:a.to,ranges:[r]});n=a.number+1}return t}function _n(e,n,r){if(e.readOnly)return!1;let i=[],a=[];for(let n of Q(e)){if(r?n.to==e.doc.length:n.from==0)continue;let o=e.doc.lineAt(r?n.to+1:n.from-1),s=o.length+1;if(r){i.push({from:n.to,to:o.to},{from:n.from,insert:o.text+e.lineBreak});for(let r of n.ranges)a.push(t.range(Math.min(e.doc.length,r.anchor+s),Math.min(e.doc.length,r.head+s)))}else{i.push({from:o.from,to:n.from},{from:n.to,insert:e.lineBreak+o.text});for(let e of n.ranges)a.push(t.range(e.anchor-s,e.head-s))}}return i.length?(n(e.update({changes:i,scrollIntoView:!0,selection:t.create(a,e.selection.mainIndex),userEvent:`move.line`})),!0):!1}var vn=({state:e,dispatch:t})=>_n(e,t,!1),yn=({state:e,dispatch:t})=>_n(e,t,!0);function bn(e,t,n){if(e.readOnly)return!1;let r=[];for(let t of Q(e))n?r.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):r.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});let i=e.changes(r);return t(e.update({changes:i,selection:e.selection.map(i,n?1:-1),scrollIntoView:!0,userEvent:`input.copyline`})),!0}var xn=({state:e,dispatch:t})=>bn(e,t,!1),Sn=({state:e,dispatch:t})=>bn(e,t,!0),Cn=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(Q(t).map(({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n}))),r=j(t.selection,t=>{let n;if(e.lineWrapping){let r=e.lineBlockAt(t.head),i=e.coordsAtPos(t.head,t.assoc||1);i&&(n=r.bottom+e.documentTop-i.bottom+e.defaultLineHeight/2)}return e.moveVertically(t,!0,n)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:`delete.line`}),!0},wn=({state:e,dispatch:t})=>(t(e.update(e.replaceSelection(e.lineBreak),{scrollIntoView:!0,userEvent:`input`})),!0),Tn=({state:e,dispatch:n})=>(n(e.update(e.changeByRange(n=>{let r=/^\s*/.exec(e.doc.lineAt(n.from).text)[0];return{changes:{from:n.from,to:n.to,insert:e.lineBreak+r},range:t.cursor(n.from+r.length+1)}}),{scrollIntoView:!0,userEvent:`input`})),!0);function En(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=_(e).resolveInner(t),r=n.childBefore(t),i=n.childAfter(t),a;return r&&i&&r.to<=t&&i.from>=t&&(a=r.type.prop(te.closedBy))&&a.indexOf(i.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(i.from).from&&!/\S/.test(e.sliceDoc(r.to,i.from))?{from:r.to,to:i.from}:null}var Dn=/*@__PURE__*/ kn(!1),On=/*@__PURE__*/ kn(!0);function kn(e){return({state:r,dispatch:a})=>{if(r.readOnly)return!1;let o=r.changeByRange(a=>{let{from:o,to:s}=a,c=r.doc.lineAt(o),l=!e&&o==s&&En(r,o);e&&(o=s=(s<=c.to?c:r.doc.lineAt(s)).to);let u=new ee(r,{simulateBreak:o,simulateDoubleBreak:!!l}),d=re(u,o);for(d??=n(/^\s*/.exec(r.doc.lineAt(o).text)[0],r.tabSize);s<c.to&&/\s/.test(c.text[s-c.from]);)s++;l?{from:o,to:s}=l:o>c.from&&o<c.from+100&&!/\S/.test(c.text.slice(0,o))&&(o=c.from);let f=[``,h(r,d)];return l&&f.push(h(r,u.lineIndent(c.from,-1))),{changes:{from:o,to:s,insert:i.of(f)},range:t.cursor(o+1+f[1].length)}});return a(r.update(o,{scrollIntoView:!0,userEvent:`input`})),!0}}function An(e,n){let r=-1;return e.changeByRange(i=>{let a=[];for(let t=i.from;t<=i.to;){let o=e.doc.lineAt(t);o.number>r&&(i.empty||i.to>o.from)&&(n(o,a,i),r=o.number),t=o.to+1}let o=e.changes(a);return{changes:a,range:t.range(o.mapPos(i.anchor,1),o.mapPos(i.head,1))}})}var jn=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new ee(e,{overrideIndentation:e=>n[e]??-1}),i=An(e,(t,i,a)=>{let o=re(r,t.from);if(o==null)return;/\S/.test(t.text)||(o=0);let s=/^\s*/.exec(t.text)[0],c=h(e,o);(s!=c||a.from<t.from+s.length)&&(n[t.from]=o,i.push({from:t.from,to:t.from+s.length,insert:c}))});return i.changes.empty||t(e.update(i,{userEvent:`indent`})),!0},$=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(An(e,(t,n)=>{n.push({from:t.from,insert:e.facet(ie)})}),{userEvent:`input.indent`})),!0),Mn=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(An(e,(t,r)=>{let i=/^\s*/.exec(t.text)[0];if(!i)return;let a=n(i,e.tabSize),o=0,s=h(e,Math.max(0,a-ne(e)));for(;o<i.length&&o<s.length&&i.charCodeAt(o)==s.charCodeAt(o);)o++;r.push({from:t.from+o,to:t.from+i.length,insert:s.slice(o)})}),{userEvent:`delete.dedent`})),!0),Nn=e=>(e.setTabFocusMode(),!0),Pn=e=>(e.setTabFocusMode(2e3),!0),Fn=({state:e,dispatch:t})=>e.selection.ranges.some(e=>!e.empty)?$({state:e,dispatch:t}):(t(e.update(e.replaceSelection(` `),{scrollIntoView:!0,userEvent:`input`})),!0),In=[{key:`Ctrl-b`,run:L,shift:q,preventDefault:!0},{key:`Ctrl-f`,run:ze,shift:vt},{key:`Ctrl-p`,run:B,shift:Pt},{key:`Ctrl-n`,run:V,shift:Ft},{key:`Ctrl-a`,run:pt,shift:Ut},{key:`Ctrl-e`,run:mt,shift:Wt},{key:`Ctrl-d`,run:an},{key:`Ctrl-h`,run:Z},{key:`Ctrl-k`,run:un},{key:`Ctrl-Alt-h`,run:sn},{key:`Ctrl-o`,run:hn},{key:`Ctrl-t`,run:gn},{key:`Ctrl-v`,run:U}],Ln=/*@__PURE__*/ [{key:`ArrowLeft`,run:L,shift:q,preventDefault:!0},{key:`Mod-ArrowLeft`,mac:`Alt-ArrowLeft`,run:Ke,shift:Ct,preventDefault:!0},{mac:`Cmd-ArrowLeft`,run:dt,shift:Vt,preventDefault:!0},{key:`ArrowRight`,run:ze,shift:vt,preventDefault:!0},{key:`Mod-ArrowRight`,mac:`Alt-ArrowRight`,run:qe,shift:wt,preventDefault:!0},{mac:`Cmd-ArrowRight`,run:ft,shift:Ht,preventDefault:!0},{key:`ArrowUp`,run:B,shift:Pt,preventDefault:!0},{mac:`Cmd-ArrowUp`,run:Gt,shift:qt},{mac:`Ctrl-ArrowUp`,run:H,shift:Lt},{key:`ArrowDown`,run:V,shift:Ft,preventDefault:!0},{mac:`Cmd-ArrowDown`,run:Kt,shift:Jt},{mac:`Ctrl-ArrowDown`,run:U,shift:Rt},{key:`PageUp`,run:H,shift:Lt},{key:`PageDown`,run:U,shift:Rt},{key:`Home`,run:ut,shift:Bt,preventDefault:!0},{key:`Mod-Home`,run:Gt,shift:qt},{key:`End`,run:lt,shift:zt,preventDefault:!0},{key:`Mod-End`,run:Kt,shift:Jt},{key:`Enter`,run:Dn,shift:Dn},{key:`Mod-a`,run:Yt},{key:`Backspace`,run:Z,shift:Z,preventDefault:!0},{key:`Delete`,run:an,preventDefault:!0},{key:`Mod-Backspace`,mac:`Alt-Backspace`,run:sn,preventDefault:!0},{key:`Mod-Delete`,mac:`Alt-Delete`,run:cn,preventDefault:!0},{mac:`Mod-Backspace`,run:fn,preventDefault:!0},{mac:`Mod-Delete`,run:pn,preventDefault:!0}].concat(/*@__PURE__*/ In.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),Rn=/*@__PURE__*/ [{key:`Alt-ArrowLeft`,mac:`Ctrl-ArrowLeft`,run:it,shift:jt},{key:`Alt-ArrowRight`,mac:`Ctrl-ArrowRight`,run:at,shift:Mt},{key:`Alt-ArrowUp`,run:vn},{key:`Shift-Alt-ArrowUp`,run:xn},{key:`Alt-ArrowDown`,run:yn},{key:`Shift-Alt-ArrowDown`,run:Sn},{key:`Mod-Alt-ArrowUp`,run:$t},{key:`Mod-Alt-ArrowDown`,run:en},{key:`Escape`,run:tn},{key:`Mod-Enter`,run:On},{key:`Alt-l`,mac:`Ctrl-l`,run:Xt},{key:`Mod-i`,run:Zt,preventDefault:!0},{key:`Mod-[`,run:Mn},{key:`Mod-]`,run:$},{key:`Mod-Alt-\\`,run:jn},{key:`Shift-Mod-k`,run:Cn},{key:`Shift-Mod-\\`,run:gt},{key:`Mod-/`,run:ae},{key:`Alt-A`,mac:`Ctrl-A`,run:le},{key:`Ctrl-m`,mac:`Shift-Alt-m`,run:Nn}].concat(Ln),zn={key:`Tab`,run:$,shift:Mn};export{$t as addCursorAbove,en as addCursorBelow,ue as blockComment,de as blockUncomment,Oe as canRedoSelection,De as canUndoSelection,Sn as copyLineDown,xn as copyLineUp,Ve as cursorCharBackward,Ge as cursorCharBackwardLogical,Be as cursorCharForward,We as cursorCharForwardLogical,L as cursorCharLeft,ze as cursorCharRight,Kt as cursorDocEnd,Gt as cursorDocStart,Ye as cursorGroupBackward,Je as cursorGroupForward,Ze as cursorGroupForwardWin,Ke as cursorGroupLeft,qe as cursorGroupRight,ut as cursorLineBoundaryBackward,lt as cursorLineBoundaryForward,dt as cursorLineBoundaryLeft,ft as cursorLineBoundaryRight,V as cursorLineDown,mt as cursorLineEnd,pt as cursorLineStart,B as cursorLineUp,gt as cursorMatchingBracket,U as cursorPageDown,H as cursorPageUp,nt as cursorSubwordBackward,tt as cursorSubwordForward,it as cursorSyntaxLeft,at as cursorSyntaxRight,Rn as defaultKeymap,Z as deleteCharBackward,rn as deleteCharBackwardStrict,an as deleteCharForward,sn as deleteGroupBackward,cn as deleteGroupForward,ln as deleteGroupForwardWin,Cn as deleteLine,fn as deleteLineBoundaryBackward,pn as deleteLineBoundaryForward,un as deleteToLineEnd,dn as deleteToLineStart,mn as deleteTrailingWhitespace,In as emacsStyleKeymap,ve as history,ye as historyField,Re as historyKeymap,Mn as indentLess,$ as indentMore,jn as indentSelection,zn as indentWithTab,On as insertBlankLine,wn as insertNewline,Dn as insertNewlineAndIndent,Tn as insertNewlineKeepIndent,Fn as insertTab,ge as invertedEffects,he as isolateHistory,se as lineComment,ce as lineUncomment,yn as moveLineDown,vn as moveLineUp,E as redo,Te as redoDepth,Se as redoSelection,Yt as selectAll,bt as selectCharBackward,St as selectCharBackwardLogical,yt as selectCharForward,xt as selectCharForwardLogical,q as selectCharLeft,vt as selectCharRight,Jt as selectDocEnd,qt as selectDocStart,Et as selectGroupBackward,Tt as selectGroupForward,Dt as selectGroupForwardWin,Ct as selectGroupLeft,wt as selectGroupRight,Xt as selectLine,Bt as selectLineBoundaryBackward,zt as selectLineBoundaryForward,Vt as selectLineBoundaryLeft,Ht as selectLineBoundaryRight,Ft as selectLineDown,Wt as selectLineEnd,Ut as selectLineStart,Pt as selectLineUp,_t as selectMatchingBracket,Rt as selectPageDown,Lt as selectPageUp,Zt as selectParentSyntax,At as selectSubwordBackward,kt as selectSubwordForward,jt as selectSyntaxLeft,Mt as selectSyntaxRight,tn as simplifySelection,hn as splitLine,Ln as standardKeymap,Pn as temporarilySetTabFocusMode,le as toggleBlockComment,fe as toggleBlockCommentByLine,ae as toggleComment,oe as toggleLineComment,Nn as toggleTabFocusMode,gn as transposeChars,be as undo,we as undoDepth,xe as undoSelection};
@@ -0,0 +1,8 @@
1
+ /*!
2
+ * code-playpad — MIT © 2026 Seung Hun Lee
3
+ * Bundles CodeMirror 6 and Lezer (MIT) © Marijn Haverbeke and others.
4
+ * Full third-party licences: THIRD-PARTY-NOTICES.txt in this package.
5
+ */
6
+ 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-D25hs99E.js";import{a as l,d as u,i as d,l as f,n as p,o as m,p as h,r as g,t as _}from"./dist-Vr-fb58P.js";var ee=1024,v=0,y=class{constructor(e,t){this.from=e,this.to=t}},b=class{constructor(e={}){this.id=v++,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=C.match(e)),t=>{let n=e(t);return n===void 0?null:[this,n]}}};b.closedBy=new b({deserialize:e=>e.split(` `)}),b.openedBy=new b({deserialize:e=>e.split(` `)}),b.group=new b({deserialize:e=>e.split(` `)}),b.isolate=new b({deserialize:e=>{if(e&&e!=`rtl`&&e!=`ltr`&&e!=`auto`)throw RangeError(`Invalid value for isolate: `+e);return e||`auto`}}),b.contextHash=new b({perNode:!0}),b.lookAhead=new b({perNode:!0}),b.mounted=new b({perNode:!0});var x=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[b.mounted.id]}},S=Object.create(null),C=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):S,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(b.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(b.group),r=-1;r<(n?n.length:0);r++){let i=t[r<0?e.name:n[r]];if(i)return i}}}};C.none=new C(``,Object.create(null),0,8);var w=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 C(e.name,r,e.id,e.flags):e)}return new e(n)}},T=/* @__PURE__ */ new WeakMap,E=/* @__PURE__ */ 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 O=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=x.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 de(this.topNode,e)}cursorAt(e,t=0,n=0){let r=new de(T.get(this)||this.topNode);return r.moveTo(e,t),T.set(this,r._tree),r}get topNode(){return new A(this,0,0,null)}resolve(e,t=0){let n=re(T.get(this)||this.topNode,e,t,!1);return T.set(this,n),n}resolveInner(e,t=0){let n=re(E.get(this)||this.topNode,e,t,!0);return E.set(this,n),n}resolveStack(e,t=0){return ue(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:ge(C.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(C.none,t,n,r)))}static build(e){return pe(e)}};O.empty=new O(C.none,[],[],0);var te=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)}},k=class e{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return C.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&&!(ne(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 ne(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 re(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 A&&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 A&&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 ie=class{cursor(e=0){return new de(this,e)}getChild(e,t=null,n=null){let r=ae(this,e,t,n);return r.length?r[0]:null}getChildren(e,t=null,n=null){return ae(this,e,t,n)}resolve(e,t=0){return re(this,e,t,!1)}resolveInner(e,t=0){return re(this,e,t,!0)}matchContext(e){return oe(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}},A=class e extends ie{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,a=0){for(let o=this;;){for(let{children:s,positions:c}=o._tree,l=n>0?s.length:-1;t!=l;t+=n){let l=s[t],u=c[t]+o.from,d;if(a&D.EnterBracketed&&l instanceof O&&(d=x.get(l))&&!d.overlay&&d.bracketed&&r>=u&&r<=u+l.length||ne(i,r,u,u+l.length)){if(l instanceof k){if(a&D.ExcludeBuffers)continue;let e=l.findChild(0,l.buffer.length,n,r-u,i);if(e>-1)return new j(new se(o,l,t,u),null,e)}else if(a&D.IncludeAnonymous||!l.type.isAnonymous||fe(l)){let s;if(!(a&D.IgnoreMounts)&&(s=x.get(l))&&!s.overlay)return new e(s.tree,u,t,o);let c=new e(l,u,t,o);return a&D.IncludeAnonymous||!c.type.isAnonymous?c:c.nextChild(n<0?l.children.length-1:0,n,r,i,a)}}}if(a&D.IncludeAnonymous||!o.type.isAnonymous||(t=o.index>=0?o.index+n:n<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(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=x.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 ae(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 oe(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 se=class{constructor(e,t,n,r){this.parent=e,this.buffer=t,this.index=n,this.start=r}},j=class e extends ie{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 O(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}};function ce(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 A&&n.index<0?null:n.parent,i=e.slice();return r?i[t]=r:i.splice(t,1),new le(i,n)}var le=class{constructor(e,t){this.heads=e,this.node=t}get next(){return ce(this.heads)}};function ue(e,t,n){let r=e.resolveInner(t,n),i=null;for(let e=r instanceof A?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 a=x.get(e.tree);if(a&&a.overlay&&a.overlay[0].from<=t&&a.overlay[a.overlay.length-1].to>=t){let o=new A(a.tree,a.overlay[0].from+e.from,-1,e);(i||=[r]).push(re(o,t,n,!1))}}return i?ce(i):r}var de=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 A)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 A?(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 k||!e.type.isAnonymous||fe(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 j(this.buffer,t,this.stack[e]);return this.bufferNode=new j(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 oe(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 oe(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 fe(e){return e.children.some(e=>e instanceof k||!e.type.isAnonymous||fe(e))}function pe(e){let{buffer:t,nodeSet:n,maxBufferLength:r=ee,reused:i=[],minRepeatType:a=n.types.length}=e,o=Array.isArray(t)?new te(t,t.length):t,s=n.types,c=0,l=0;function u(e,t,_,ee,v,y){let{id:b,start:x,end:S,size:C}=o,w=l,T=c;if(C<0){if(o.next(),C==-1){let t=i[b];_.push(t),ee.push(x-e);return}if(C==-3){c=b;return}if(C==-4){l=b;return}throw RangeError(`Unrecognized record size: ${C}`)}let E=s[b],D,O,te=x-e;if(S-x<=r&&(O=h(o.pos-t,v))){let t=new Uint16Array(O.size-O.skip),r=o.pos-O.size,i=t.length;for(;o.pos>r;)i=g(O.start,t,i);D=new k(t,S-O.start,n),te=O.start-e}else{let e=o.pos-C;o.next();let t=[],n=[],i=b>=a?b:-1,s=0,c=S;for(;o.pos>e;)i>=0&&o.id==i&&o.size>=0?(o.end<=c-r&&(p(t,n,x,s,o.end,c,i,w,T),s=t.length,c=o.end),o.next()):y>2500?d(x,e,t,n):u(x,e,t,n,i,y+1);if(i>=0&&s>0&&s<t.length&&p(t,n,x,s,x,c,i,w,T),t.reverse(),n.reverse(),i>-1&&s>0){let e=f(E,T);D=ge(E,t,n,0,t.length,0,S-x,e,e)}else D=m(E,t,n,S-x,w-S,T)}_.push(D),ee.push(te)}function d(e,t,i,a){let s=[],c=0,l=-1;for(;o.pos>t;){let{id:e,start:t,end:n,size:i}=o;if(i>4)o.next();else if(l>-1&&t<l)break;else l<0&&(l=n-r),s.push(e,t,n),c++,o.next()}if(c){let t=new Uint16Array(c*4),r=s[s.length-2];for(let e=s.length-3,n=0;e>=0;e-=3)t[n++]=s[e],t[n++]=s[e+1]-r,t[n++]=s[e+2]-r,t[n++]=n;i.push(new k(t,s[2]-r,n)),a.push(r-e)}}function f(e,t){return(n,r,i)=>{let a=0,o=n.length-1,s,c;if(o>=0&&(s=n[o])instanceof O){if(!o&&s.type==e&&s.length==i)return s;(c=s.prop(b.lookAhead))&&(a=r[o]+s.length+c)}return m(e,n,r,i,a,t)}}function p(e,t,r,i,a,o,s,c,l){let u=[],d=[];for(;e.length>i;)u.push(e.pop()),d.push(t.pop()+r-a);e.push(m(n.types[s],u,d,o-a,c-o,l)),t.push(a-r)}function m(e,t,n,r,i,a,o){if(a){let e=[b.contextHash,a];o=o?[e].concat(o):[e]}if(i>25){let e=[b.lookAhead,i];o=o?[e].concat(o):[e]}return new O(e,t,n,r,o)}function h(e,t){let n=o.fork(),i=0,s=0,c=0,l=n.end-r,u={size:0,start:0,skip:0};scan:for(let r=n.pos-e;n.pos>r;){let e=n.size;if(n.id==t&&e>=0){u.size=i,u.start=s,u.skip=c,c+=4,i+=4,n.next();continue}let o=n.pos-e;if(e<0||o<r||n.start<l)break;let d=n.id>=a?4:0,f=n.start;for(n.next();n.pos>o;){if(n.size<0){if(n.size==-3||n.size==-4)d+=4;else break scan}else n.id>=a&&(d+=4);n.next()}s=f,i+=e,c+=d}return(t<0||i==e)&&(u.size=i,u.start=s,u.skip=c),u.size>4?u:void 0}function g(e,t,n){let{id:r,start:i,end:s,size:u}=o;if(o.next(),u>=0&&r<a){let a=n;if(u>4){let r=o.pos-(u-4);for(;o.pos>r;)n=g(e,t,n)}t[--n]=a,t[--n]=s-e,t[--n]=i-e,t[--n]=r}else u==-3?c=r:u==-4&&(l=r);return n}let _=[],v=[];for(;o.pos>0;)u(e.start||0,e.bufferStart||0,_,v,-1,0);let y=e.length??(_.length?v[0]+_[0].length:0);return new O(s[e.topID],_.reverse(),v.reverse(),y)}var me=/* @__PURE__ */ new WeakMap;function he(e,t){if(!e.isAnonymous||t instanceof k||t.type!=e)return 1;let n=me.get(t);if(n==null){n=1;for(let r of t.children){if(r.type!=e||!(r instanceof O)){n=1;break}n+=he(e,r)}me.set(t,n)}return n}function ge(e,t,n,r,i,a,o,s,c){let l=0;for(let n=r;n<i;n++)l+=he(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=he(e,t[s]);for(s++;s<i;s++){let n=he(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(ge(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 _e=class{constructor(){this.map=/* @__PURE__ */ new WeakMap}setBuffer(e,t,n){let r=this.map.get(e);r||this.map.set(e,r=/* @__PURE__ */ 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 j?this.setBuffer(e.context.buffer,e.index,t):e instanceof A&&this.map.set(e.tree,t)}get(e){return e instanceof j?this.getBuffer(e.context.buffer,e.index):e instanceof A?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)}},M=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}},ve=class{startParse(e,t,n){return typeof e==`string`&&(e=new ye(e)),n=n?n.length?n.map(e=>new y(e.from,e.to)):[new y(0,0)]:[new y(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}}},ye=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 be(e){return(t,n,r,i)=>new Te(t,e,n,r,i)}var xe=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 Se(e){if(!e.length||e.some(e=>e.from>=e.to))throw RangeError(`Invalid inner parse ranges given: `+JSON.stringify(e))}var Ce=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=[]}},we=new b({perNode:!0}),Te=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 O(e.type,e.children,e.positions,e.length,e.propValues.concat([[we,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[b.mounted.id]=new x(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 Ae(this.fragments),t=null,n=null,r=new de(new A(this.baseTree,this.ranges[0].from,0,null),D.IncludeAnonymous|D.IgnoreMounts);scan:for(let i,a;;){let o=!0,s;if(this.stoppedAt!=null&&r.from>=this.stoppedAt)o=!1;else if(e.hasNode(r)){if(t){let e=t.mounts.find(e=>e.frag.from<=r.from&&e.frag.to>=r.to&&e.mount.overlay);if(e)for(let n of e.mount.overlay){let i=n.from+e.pos,a=n.to+e.pos;i>=r.from&&a<=r.to&&!t.ranges.some(e=>e.from<a&&e.to>i)&&t.ranges.push({from:i,to:a})}}o=!1}else if(n&&(a=Ee(n.ranges,r.from,r.to)))o=a!=2;else if(!r.type.isAnonymous&&(i=this.nest(r,this.input))&&(r.from<r.to||!i.overlay)){r.tree||(Oe(r),t&&t.depth++,n&&n.depth++);let a=e.findMounts(r.from,i.parser);if(typeof i.overlay==`function`)t=new Ce(i.parser,i.overlay,a,this.inner.length,r.from,!!i.bracketed,r.tree,t);else{let e=je(this.ranges,i.overlay||(r.from<r.to?[new y(r.from,r.to)]:[]));e.length&&Se(e),(e.length||!i.overlay)&&this.inner.push(new xe(i.parser,e.length?i.parser.startParse(this.input,Ne(a,e),e):i.parser.startParse(``),i.overlay?i.overlay.map(e=>new y(e.from-r.from,e.to-r.from)):null,!!i.bracketed,r.tree,e.length?e[0].from:r.from)),i.overlay?e.length&&(n={ranges:e,depth:0,prev:n}):o=!1}}else if(t&&(s=t.predicate(r))&&(s===!0&&(s=new y(r.from,r.to)),s.from<s.to)){let e=t.ranges.length-1;e>=0&&t.ranges[e].to==s.from?t.ranges[e]={from:t.ranges[e].from,to:s.to}:t.ranges.push(s)}if(o&&r.firstChild())t&&t.depth++,n&&n.depth++;else for(;!r.nextSibling();){if(!r.parent())break scan;if(t&&!--t.depth){let e=je(this.ranges,t.ranges);e.length&&(Se(e),this.inner.splice(t.index,0,new xe(t.parser,t.parser.startParse(this.input,Ne(t.mounts,e),e),t.ranges.map(e=>new y(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 Ee(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 De(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 Oe(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],s=o.buffer,c=[a];function l(e,r,i,a,u,d){let f=n[d],p=[],m=[];De(o,e,f,p,m,a);let h=s[f+1],g=s[f+2];c.push(p.length);let _=d?l(f+4,s[f+3],o.set.types[s[f]],h,g-h,d-1):t.toTree();return p.push(_),m.push(h-a),De(o,s[f+3],r,p,m,a),new O(i,p,m,u)}i.children[a]=l(0,s.length,C.none,0,o.length,n.length-1);for(let t of c){let n=e.tree.children[t],r=e.tree.positions[t];e.yield(new A(n,r+e.from,t,e._tree))}}var ke=class{constructor(e,t){this.offset=t,this.done=!1,this.cursor=e.cursor(D.IncludeAnonymous|D.IgnoreMounts)}moveTo(e){let{cursor:t}=this,n=e-this.offset;for(;!this.done&&t.from<n;)if(!(t.to>=e&&t.enter(n,1,D.IgnoreOverlays|D.ExcludeBuffers))){if(t.to<=e)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 O)t=t.children[0];else break}return!1}},Ae=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(we)??t.to,this.inner=new ke(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(we)??e.to,this.inner=new ke(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(b.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 je(e,t){let n=null,r=t;for(let i=1,a=0;i<e.length;i++){let o=e[i-1].to,s=e[i].from;for(;a<r.length;a++){let e=r[a];if(e.from>=s)break;e.to<=o||(n||(r=n=t.slice()),e.from<o?(n[a]=new y(e.from,o),e.to>s&&n.splice(a+1,0,new y(s,e.to))):e.to>s?n[a--]=new y(s,e.to):n.splice(a--,1))}}return r}function Me(e,t,n,r){let i=0,a=0,o=!1,s=!1,c=-1e9,l=[];for(;;){let u=i==e.length?1e9:o?e[i].to:e[i].from,d=a==t.length?1e9:s?t[a].to:t[a].from;if(o!=s){let e=Math.max(c,n),t=Math.min(u,d,r);e<t&&l.push(new y(e,t))}if(c=Math.min(u,d),c==1e9)break;u==c&&(o?(o=!1,i++):o=!0),d==c&&(s?(s=!1,a++):s=!0)}return l}function Ne(e,t){let n=[];for(let{pos:r,mount:i,frag:a}of e){let e=r+(i.overlay?i.overlay[0].from:0),o=e+i.tree.length,s=Math.max(a.from,e),c=Math.min(a.to,o);if(i.overlay){let o=Me(t,i.overlay.map(e=>new y(e.from+r,e.to+r)),s,c);for(let t=0,r=s;;t++){let s=t==o.length,l=s?c:o[t].from;if(l>r&&n.push(new M(r,l,i.tree,-e,a.from>=r||a.openStart,a.to<=l||a.openEnd)),s)break;r=o[t].to}}else n.push(new M(s,c,i.tree,-e,a.from>=e||a.openStart,a.to<=o||a.openEnd))}return n}var Pe=0,N=class e{constructor(e,t,n,r){this.name=e,this.set=t,this.base=n,this.modified=r,this.id=Pe++}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 Ie(e);return e=>e.modified.indexOf(t)>-1?e:Ie.get(e.base||e,e.modified.concat(t).sort((e,t)=>e.id-t.id))}},Fe=0,Ie=class e{constructor(e){this.name=e,this.instances=[],this.id=Fe++}static get(t,n){if(!n.length)return t;let r=n[0].instances.find(e=>e.base==t&&Le(n,e.modified));if(r)return r;let i=[],a=new N(t.name,i,t,n);for(let e of n)e.instances.push(a);let o=Re(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 Le(e,t){return e.length==t.length&&e.every((e,n)=>e==t[n])}function Re(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 ze(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 P(r,i,o>0?n.slice(0,o):null).sort(t[s])}}return Be.add(t)}var Be=new b({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 P(i.tags,i.mode,i.context);n?n.next=a:r=a,n=a}return r}}),P=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}};P.empty=new P([],2,null);function Ve(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 He(e,t){let n=null;for(let r of e){let e=r.style(t);e&&(n=n?n+` `+e:e)}return n}function Ue(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)}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,i){let{type:a,from:o,to:s}=e;if(o>=n||s<=t)return;a.isTop&&(i=this.highlighters.filter(e=>!e.scope||e.scope(a)));let c=r,l=Ge(e)||P.empty,u=He(i,l.tags);if(u&&(c&&(c+=` `),c+=u,l.mode==1&&(r+=(r?` `:``)+u)),this.startSpan(Math.max(t,o),c),l.opaque)return;let d=e.tree&&e.tree.prop(b.mounted);if(d&&d.overlay){let a=e.node.enter(d.overlay[0].from+o,1),l=this.highlighters.filter(e=>!e.scope||e.scope(d.tree.type)),u=e.firstChild();for(let f=0,p=o;;f++){let m=f<d.overlay.length?d.overlay[f]:null,h=m?m.from+o:s,g=Math.max(t,p),_=Math.min(n,h);if(g<_&&u)for(;e.from<_&&(this.highlightRange(e,g,_,r,i),this.startSpan(Math.min(_,e.to),c),!(e.to>=h||!e.nextSibling())););if(!m||h>n)break;p=m.to+o,p>t&&(this.highlightRange(a.cursor(),Math.max(t,m.from+o),Math.min(n,p),``,l),this.startSpan(Math.min(n,p),c))}u&&e.parent()}else if(e.firstChild()){d&&(r=``);do if(!(e.to<=t)){if(e.from>=n)break;this.highlightRange(e,t,n,r,i),this.startSpan(Math.min(n,e.to),c)}while(e.nextSibling());e.parent()}}};function Ge(e){let t=e.type.prop(Be);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}var F=N.define,Ke=F(),I=F(),qe=F(I),Je=F(I),L=F(),Ye=F(L),Xe=F(L),R=F(),z=F(R),B=F(),V=F(),Ze=F(),H=F(Ze),Qe=F(),U={comment:Ke,lineComment:F(Ke),blockComment:F(Ke),docComment:F(Ke),name:I,variableName:F(I),typeName:qe,tagName:F(qe),propertyName:Je,attributeName:F(Je),className:F(I),labelName:F(I),namespace:F(I),macroName:F(I),literal:L,string:Ye,docString:F(Ye),character:F(Ye),attributeValue:F(Ye),number:Xe,integer:F(Xe),float:F(Xe),bool:F(L),regexp:F(L),escape:F(L),color:F(L),url:F(L),keyword:B,self:F(B),null:F(B),atom:F(B),unit:F(B),modifier:F(B),operatorKeyword:F(B),controlKeyword:F(B),definitionKeyword:F(B),moduleKeyword:F(B),operator:V,derefOperator:F(V),arithmeticOperator:F(V),logicOperator:F(V),bitwiseOperator:F(V),compareOperator:F(V),updateOperator:F(V),definitionOperator:F(V),typeOperator:F(V),controlOperator:F(V),punctuation:Ze,separator:F(Ze),bracket:H,angleBracket:F(H),squareBracket:F(H),paren:F(H),brace:F(H),content:R,heading:z,heading1:F(z),heading2:F(z),heading3:F(z),heading4:F(z),heading5:F(z),heading6:F(z),contentSeparator:F(R),list:F(R),quote:F(R),emphasis:F(R),strong:F(R),link:F(R),monospace:F(R),strikethrough:F(R),inserted:F(),deleted:F(),changed:F(),invalid:F(),meta:Qe,documentMeta:F(Qe),annotation:F(Qe),processingInstruction:F(Qe),definition:N.defineModifier(`definition`),constant:N.defineModifier(`constant`),function:N.defineModifier(`function`),standard:N.defineModifier(`standard`),local:N.defineModifier(`local`),special:N.defineModifier(`special`)};for(let e in U){let t=U[e];t instanceof N&&(t.name=e)}Ve([{tag:U.link,class:`tok-link`},{tag:U.heading,class:`tok-heading`},{tag:U.emphasis,class:`tok-emphasis`},{tag:U.strong,class:`tok-strong`},{tag:U.keyword,class:`tok-keyword`},{tag:U.atom,class:`tok-atom`},{tag:U.bool,class:`tok-bool`},{tag:U.url,class:`tok-url`},{tag:U.labelName,class:`tok-labelName`},{tag:U.inserted,class:`tok-inserted`},{tag:U.deleted,class:`tok-deleted`},{tag:U.literal,class:`tok-literal`},{tag:U.string,class:`tok-string`},{tag:U.number,class:`tok-number`},{tag:[U.regexp,U.escape,U.special(U.string)],class:`tok-string2`},{tag:U.variableName,class:`tok-variableName`},{tag:U.local(U.variableName),class:`tok-variableName tok-local`},{tag:U.definition(U.variableName),class:`tok-variableName tok-definition`},{tag:U.special(U.variableName),class:`tok-variableName2`},{tag:U.definition(U.propertyName),class:`tok-propertyName tok-definition`},{tag:U.typeName,class:`tok-typeName`},{tag:U.namespace,class:`tok-namespace`},{tag:U.className,class:`tok-className`},{tag:U.macroName,class:`tok-macroName`},{tag:U.propertyName,class:`tok-propertyName`},{tag:U.operator,class:`tok-operator`},{tag:U.comment,class:`tok-comment`},{tag:U.meta,class:`tok-meta`},{tag:U.invalid,class:`tok-invalid`},{tag:U.punctuation,class:`tok-punctuation`}]);var W=/*@__PURE__*/ new b;function $e(e){return o.define({combine:e?t=>t.concat(e):void 0})}var et=/*@__PURE__*/ new b,G=class{constructor(e,t,n=[],r=``){this.data=e,this.name=r,i.prototype.hasOwnProperty(`tree`)||Object.defineProperty(i.prototype,"tree",{get(){return K(this)}}),this.parser=t,this.extension=[J.of(this),i.languageData.of((e,t,n)=>{let r=tt(e,t,n),i=r.type.prop(W);if(!i)return[];let a=e.facet(i),o=r.type.prop(et);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 tt(e,t,n).type.prop(W)==this.data}findRegions(e){let t=e.facet(J);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(W)==this.data){n.push({from:t,to:t+e.length});return}let i=e.prop(b.mounted);if(i){if(i.tree.prop(W)==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 O&&r(i,e.positions[n]+t)}};return r(K(e),0),n}get allowsNesting(){return!0}};G.setState=/*@__PURE__*/ a.define();function tt(e,t,n){let r=e.facet(J),i=K(e).topNode;if(!r||r.allowsNesting)for(let e=i;e;e=e.enter(t,n,D.ExcludeBuffers|D.EnterBracketed))e.type.isTop&&(i=e);return i}var nt=class e extends G{constructor(e,t,n){super(e,t,[],n),this.parser=t}static define(t){let n=$e(t.languageData);return new e(n,t.parser.configure({props:[W.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 K(e){let t=e.field(G.state,!1);return t?t.tree:O.empty}function rt(e,t,n=50){let r=e.field(G.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 it(e,t=e.doc.length){return e.field(G.state,!1)?.context.isDone(t)||!1}function at(e,t=e.viewport.to,n=100){let r=rt(e.state,t,n);return r!=K(e.state)&&e.dispatch({}),!!r}function ot(e){return e.plugin(pt)?.isWorking()||!1}var st=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)}},q=null,ct=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,[],O.empty,0,r,[],null)}startParse(){return this.parser.startParse(new st(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=O.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(M.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(M.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=q;q=this;try{return e()}finally{q=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=lt(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=M.applyChanges(r,e),i=O.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=lt(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 ve{createParse(t,n,r){let i=r[0].from,a=r[r.length-1].to;return{parsedPos:i,advance(){let t=q;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 O(C.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 q}};function lt(e,t,n){return M.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}var ut=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=ct.create(t.facet(J).parser,t,{from:0,to:n});return r.work(20,n)||r.takeTree(),new e(r)}};G.state=/*@__PURE__*/ r.define({create:ut.init,update(e,t){for(let e of t.effects)if(e.is(G.setState))return e.value;return t.startState.facet(J)==t.state.facet(J)?e.apply(t):ut.init(t.state)}});var dt=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<`u`&&(dt=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});var ft=typeof navigator<`u`&&navigator.scheduling?.isInputPending?()=>navigator.scheduling.isInputPending():null,pt=/*@__PURE__*/ l.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(G.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(G.state);t.tree==t.context.tree&&t.context.isDone(e.doc.length)||(this.working=dt(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(G.state);if(i.tree==i.context.tree&&i.context.isDone(r+1e5))return;let a=Date.now()+Math.min(this.chunkBudget,100,e&&!ft?Math.max(25,e.timeRemaining()-5):1e9),o=i.context.treeLen<r&&n.doc.length>r+1e3,s=i.context.work(()=>ft&&ft()||Date.now()>a,r+(o?0:1e5));this.chunkBudget-=Date.now()-t,(s||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:G.setState.of(new ut(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=>u(this.view.state,e)).then(()=>this.workScheduled--),null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),J=/*@__PURE__*/ o.define({combine(e){return e.length?e[0]:null},enables:e=>[G.state,pt,g.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]}),mt=class{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}},ht=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}},gt=/*@__PURE__*/ o.define(),_t=/*@__PURE__*/ 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 Y(e){let t=e.facet(_t);return t.charCodeAt(0)==9?e.tabSize*t.length:t.length}function vt(e,t){let n=``,r=e.tabSize,i=e.facet(_t)[0];if(i==` `){for(;t>=r;)n+=` `,t-=r;i=` `}for(let e=0;e<t;e++)n+=i;return n}function yt(e,t){e instanceof i&&(e=new xt(e));for(let n of e.state.facet(gt)){let r=n(e,t);if(r!==void 0)return r}let n=K(e.state);return n.length>=t?Ct(e,n,t):null}function bt(e,t,n){let r=Object.create(null),i=new xt(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=yt(i,t.from);if(n==null)continue;/\S/.test(t.text)||(n=0);let s=/^\s*/.exec(t.text)[0],c=vt(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 xt=class{constructor(e,t={}){this.state=e,this.options=t,this.unit=Y(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}},St=/*@__PURE__*/ new b;function Ct(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 wt(r,e,n)}function wt(e,t,n){for(let r=e;r;r=r.next){let e=Et(r.node);if(e)return e(Ot.create(t,n,r))}return 0}function Tt(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}function Et(e){let t=e.type.prop(St);if(t)return t;let n=e.firstChild,r;if(n&&(r=n.type.prop(b.closedBy))){let t=e.lastChild,n=t&&r.indexOf(t.name)>-1;return e=>Mt(e,!0,1,void 0,n&&!Tt(e)?t.from:void 0)}return e.parent==null?Dt:null}function Dt(){return 0}var Ot=class e extends xt{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(kt(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return wt(this.context.next,this.base,this.pos)}};function kt(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function At(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 jt({closing:e,align:t=!0,units:n=1}){return r=>Mt(r,t,n,e)}function Mt(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?At(e):null;return c?s?e.column(c.from):e.column(c.to):e.baseIndent+(s?0:e.unit*n)}var Nt=e=>e.baseIndent;function Pt({except:e,units:t=1}={}){return n=>{let r=e&&e.test(n.textAfter);return n.baseIndent+(r?0:t*n.unit)}}var Ft=200;function It(){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+Ft)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=yt(o,t.from);if(n==null)continue;let r=/^\s*/.exec(t.text)[0],i=vt(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 Lt=/*@__PURE__*/ o.define(),Rt=/*@__PURE__*/ new b;function zt(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 Bt(e,t,n){let r=K(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(Rt);if(s&&(i.to<r.length-50||r.length==e.doc.length||!Vt(i))){let r=s(i,e);r&&r.from<=n&&r.from>=t&&r.to>n&&(a=r)}}return a}function Vt(e){let t=e.lastChild;return t&&t.to==e.to&&t.type.isError}function X(e,t,n){for(let r of e.facet(Lt)){let i=r(e,t,n);if(i)return i}return Bt(e,t,n)}function Ht(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 Z=/*@__PURE__*/ a.define({map:Ht}),Q=/*@__PURE__*/ a.define({map:Ht});function Ut(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 $=/*@__PURE__*/ r.define({create(){return _.none},update(e,t){t.isUserEvent(`delete`)&&t.changes.iterChangedRanges((t,n)=>e=Wt(e,t,n)),e=e.map(t.changes);let n=[];for(let r of t.effects)r.is(Z)&&!qt(e,r.value.from,r.value.to)?n.push(r.value):r.is(Q)&&(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(an),i=n.map(e=>(r?_.replace({widget:new ln(r(t.state,e))}):cn).range(e.from,e.to));e=e.update({add:i})}return t.selection&&(e=Wt(e,t.selection.main.head)),e},provide:e=>g.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(cn.range(r,i))}return _.set(t,!0)}});function Wt(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 Gt(e){return e.field($,!1)||s.empty}function Kt(e,t,n){var r;let i=null;return(r=e.field($,!1))==null||r.between(t,n,(e,t)=>{(!i||i.from>e)&&(i={from:e,to:t})}),i}function qt(e,t,n){let r=!1;return e.between(t,t,(e,i)=>{e==t&&i==n&&(r=!0)}),r}function Jt(e,t){return e.field($,!1)?t:t.concat(a.appendConfig.of(on()))}var Yt=e=>{for(let t of Ut(e)){let n=X(e.state,t.from,t.to);if(n)return e.dispatch({effects:Jt(e.state,[Z.of(n),Zt(e,n)])}),!0}return!1},Xt=e=>{if(!e.state.field($,!1))return!1;let t=[];for(let n of Ut(e)){let r=Kt(e.state,n.from,n.to);r&&t.push(Q.of(r),Zt(e,r,!1))}return t.length&&e.dispatch({effects:t}),t.length>0};function Zt(e,t,n=!0){let r=e.state.doc.lineAt(t.from).number,i=e.state.doc.lineAt(t.to).number;return g.announce.of(`${e.state.phrase(n?`Folded lines`:`Unfolded lines`)} ${r} ${e.state.phrase(`to`)} ${i}.`)}var Qt=e=>{let{state:t}=e,n=[];for(let r=0;r<t.doc.length;){let i=e.lineBlockAt(r),a=X(t,i.from,i.to);a&&n.push(Z.of(a)),r=(a?e.lineBlockAt(a.to):i).to+1}return n.length&&e.dispatch({effects:Jt(e.state,n)}),!!n.length},$t=e=>{let t=e.state.field($,!1);if(!t||!t.size)return!1;let n=[];return t.between(0,e.state.doc.length,(e,t)=>{n.push(Q.of({from:e,to:t}))}),e.dispatch({effects:n}),!0};function en(e,t){for(let n=t;;){let r=X(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 tn=e=>{let t=[];for(let n of Ut(e)){let r=Kt(e.state,n.from,n.to);if(r)t.push(Q.of(r),Zt(e,r,!1));else{let r=en(e,n);r&&t.push(Z.of(r),Zt(e,r))}}return t.length>0&&e.dispatch({effects:Jt(e.state,t)}),!!t.length},nn=[{key:`Ctrl-Shift-[`,mac:`Cmd-Alt-[`,run:Yt},{key:`Ctrl-Shift-]`,mac:`Cmd-Alt-]`,run:Xt},{key:`Ctrl-Alt-[`,run:Qt},{key:`Ctrl-Alt-]`,run:$t}],rn={placeholderDOM:null,preparePlaceholder:null,placeholderText:`…`},an=/*@__PURE__*/ o.define({combine(e){return c(e,rn)}});function on(e){let t=[$,pn];return e&&t.push(an.of(e)),t}function sn(e,t){let{state:n}=e,r=n.facet(an),i=t=>{let n=e.lineBlockAt(e.posAtDOM(t.target)),r=Kt(e.state,n.from,n.to);r&&e.dispatch({effects:Q.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 cn=/*@__PURE__*/ _.replace({widget:/*@__PURE__*/ new class extends m{toDOM(e){return sn(e,null)}}}),ln=class extends m{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return sn(e,this.value)}},un={openText:`⌄`,closedText:`›`,markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1},dn=class extends d{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 fn(e={}){let n={...un,...e},r=new dn(n,!0),i=new dn(n,!1),a=l.fromClass(class{constructor(e){this.from=e.viewport.from,this.markers=this.buildMarkers(e)}update(e){(e.docChanged||e.viewportChanged||e.startState.facet(J)!=e.state.facet(J)||e.startState.field($,!1)!=e.state.field($,!1)||K(e.startState)!=K(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=Kt(e.state,t.from,t.to)?i:X(e.state,t.from,t.to)?r:null;a&&n.add(t.from,t.from,a)}return n.finish()}}),{domEventHandlers:o}=n;return[a,f({class:`cm-foldGutter`,markers(e){return e.plugin(a)?.markers||s.empty},initialSpacer(){return new dn(n,!1)},domEventHandlers:{...o,click:(e,t,n)=>{if(o.click&&o.click(e,t,n))return!0;let r=Kt(e.state,t.from,t.to);if(r)return e.dispatch({effects:Q.of(r)}),!0;let i=X(e.state,t.from,t.to);return i?(e.dispatch({effects:Z.of(i)}),!0):!1}}}),on()]}var pn=/*@__PURE__*/ g.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`}}),mn=class e{constructor(e,t){this.specs=e;let n;function r(e){let t=h.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 G?e=>e.prop(W)==a.data:a?e=>e==a:void 0,this.style=Ve(e.map(e=>({tag:e.tag,class:e.class||r(Object.assign({},e,{tag:null}))})),{all:i}).style,this.module=n?new h(n):null,this.themeType=t.themeType}static define(t,n){return new e(t,n||{})}},hn=/*@__PURE__*/ o.define(),gn=/*@__PURE__*/ o.define({combine(e){return e.length?[e[0]]:null}});function _n(e){let t=e.facet(hn);return t.length?t:e.facet(gn)}function vn(e,t){let n=[xn],r;return e instanceof mn&&(e.module&&n.push(g.styleModule.of(e.module)),r=e.themeType),t?.fallback?n.push(gn.of(e)):r?n.push(hn.computeN([g.darkTheme],t=>t.facet(g.darkTheme)==(r==`dark`)?[e]:[])):n.push(hn.of(e)),n}function yn(e,t,n){let r=_n(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 bn=class{constructor(e){this.markCache=Object.create(null),this.tree=K(e.state),this.decorations=this.buildDeco(e,_n(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=K(e.state),n=_n(e.state),r=n!=_n(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 _.none;let r=new t;for(let{from:t,to:i}of e.visibleRanges)Ue(this.tree,n,(e,t,n)=>{r.add(e,t,this.markCache[n]||(this.markCache[n]=_.mark({class:n})))},t,i);return r.finish()}},xn=/*@__PURE__*/ n.high(/*@__PURE__*/ l.fromClass(bn,{decorations:e=>e.decorations})),Sn=/*@__PURE__*/ mn.define([{tag:U.meta,color:`#404740`},{tag:U.link,textDecoration:`underline`},{tag:U.heading,textDecoration:`underline`,fontWeight:`bold`},{tag:U.emphasis,fontStyle:`italic`},{tag:U.strong,fontWeight:`bold`},{tag:U.strikethrough,textDecoration:`line-through`},{tag:U.keyword,color:`#708`},{tag:[U.atom,U.bool,U.url,U.contentSeparator,U.labelName],color:`#219`},{tag:[U.literal,U.inserted],color:`#164`},{tag:[U.string,U.deleted],color:`#a11`},{tag:[U.regexp,U.escape,/*@__PURE__*/ U.special(U.string)],color:`#e40`},{tag:/*@__PURE__*/ U.definition(U.variableName),color:`#00f`},{tag:/*@__PURE__*/ U.local(U.variableName),color:`#30a`},{tag:[U.typeName,U.namespace],color:`#085`},{tag:U.className,color:`#167`},{tag:[/*@__PURE__*/ U.special(U.variableName),U.macroName],color:`#256`},{tag:/*@__PURE__*/ U.definition(U.propertyName),color:`#00c`},{tag:U.comment,color:`#940`},{tag:U.invalid,color:`#f00`}]),Cn=/*@__PURE__*/ g.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:`#328c8252`},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:`#bb555544`}}),wn=1e4,Tn=`()[]{}`,En=/*@__PURE__*/ o.define({combine(e){return c(e,{afterCursor:!0,brackets:Tn,maxScanDistance:wn,renderMatch:kn})}}),Dn=/*@__PURE__*/ _.mark({class:`cm-matchingBracket`}),On=/*@__PURE__*/ _.mark({class:`cm-nonmatchingBracket`});function kn(e){let t=[],n=e.matched?Dn:On;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 An(e){let t=[],n=e.facet(En);for(let r of e.selection.ranges){if(!r.empty)continue;let i=In(e,r.head,-1,n)||r.head>0&&In(e,r.head-1,1,n)||n.afterCursor&&(In(e,r.head,1,n)||r.head<e.doc.length&&In(e,r.head+1,-1,n));i&&(t=t.concat(n.renderMatch(i,e)))}return _.set(t,!0)}var jn=[/* @__PURE__ */ l.fromClass(class{constructor(e){this.paused=!1,this.decorations=An(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=An(e.state),this.paused=!1))}},{decorations:e=>e.decorations}),Cn];function Mn(e={}){return[En.of(e),jn]}var Nn=/*@__PURE__*/ new b;function Pn(e,t,n){let r=e.prop(t<0?b.openedBy:b.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 Fn(e){let t=e.type.prop(Nn);return t?t(e.node):e}function In(e,t,n,r={}){let i=r.maxScanDistance||wn,a=r.brackets||Tn,o=K(e),s=o.resolveInner(t,n);for(let r=s;r;r=r.parent){let i=Pn(r.type,n,a);if(i&&r.from<r.to){let o=Fn(r);if(o&&(n>0?t>=o.from&&t<o.to:t>o.from&&t<=o.to))return Ln(e,t,n,r,o,i,a)}}return Rn(e,t,n,o,s.type,i,a)}function Ln(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=Fn(u);return{start:c,end:e?{from:e.from,to:e.to}:void 0,matched:!0}}if(Pn(u.type,n,o))l++;else if(Pn(u.type,-n,o)){if(l==0){let e=Fn(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 Rn(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 zn(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 Bn=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=zn(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue}indentation(){return this.overrideIndent??zn(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)}};function Vn(e){return{name:e.name||``,token:e.token,blankLine:e.blankLine||(()=>{}),startState:e.startState||(()=>!0),copyState:e.copyState||Hn,indent:e.indent||(()=>null),languageData:e.languageData||{},tokenTable:e.tokenTable||Xn,mergeTokens:e.mergeTokens!==!1}}function Hn(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 Un=/*@__PURE__*/ new WeakMap,Wn=class e extends G{constructor(e){let t=$e(e.languageData),n=Vn(e),r,i=new class extends ve{createParse(e,t,n){return new Jn(r,e,t,n)}};super(t,i,[],e.name),this.topNode=or(t,this),r=this,this.streamParser=n,this.stateAfter=new b({perNode:!0}),this.tokenTable=e.tokenTable?new nr(n.tokenTable):rr}static define(t){return new e(t)}getIndent(e){let t,{overrideIndentation:n}=e.options;n&&(t=Un.get(e.state),t!=null&&t<e.pos-1e4&&(t=void 0));let r=Gn(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 Bn(t.text,e.state.tabSize,e.unit,i<0?void 0:i);for(;o.pos<r-t.from;)Yn(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&&Un.set(e.state,o.from),this.streamParser.indent(a,/^\s*(.*)/.exec(o.text)[1],e)}get allowsNesting(){return!1}};function Gn(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 O&&s<i&&Gn(e,o,s,r,i);if(c)return c}return null}function Kn(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 O){if(!(c=Kn(e,s,n-o,r-o,i)))break;return i?new O(t.type,t.children.slice(0,a).concat(c),t.positions.slice(0,a+1),o+c.length):c}}return null}function qn(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&&Gn(e,i.tree,0-i.offset,n,a),s;if(o&&o.pos<=r&&(s=Kn(e,i.tree,n+i.offset,o.pos+i.offset,!1)))return{state:o.state,tree:s}}return{state:e.streamParser.startState(i?Y(i):4),tree:O.empty}}var Jn=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=ct.get(),a=r[0].from,{state:o,tree:s}=qn(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(Y(i.state)),i.skipUntilInView(this.parsedPos,i.viewport.from),this.parsedPos=i.viewport.from),this.moveRangeIndex()}advance(){let e=ct.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==`
7
+ `&&(t=``);else{let e=t.indexOf(`
8
+ `);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 Bn(t,e?e.state.tabSize:4,e?Y(e.state):2);if(a.eol())i.blankLine(this.state,a.indentUnit);else for(;!a.eol();){let e=Yn(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=O.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:Qn,topID:0,maxBufferLength:512,reused:this.chunkReused});e=new O(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 O(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}};function Yn(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 Xn=/*@__PURE__*/ Object.create(null),Zn=[C.none],Qn=/*@__PURE__*/ new w(Zn),$n=[],er=/*@__PURE__*/ Object.create(null),tr=/*@__PURE__*/ 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`]])tr[e]=/*@__PURE__*/ ar(Xn,t);var nr=class{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),tr)}resolve(e){return e?this.table[e]||(this.table[e]=ar(this.extra,e)):0}},rr=/*@__PURE__*/ new nr(Xn);function ir(e,t){$n.indexOf(e)>-1||($n.push(e),console.warn(t))}function ar(e,t){let n=[];for(let r of t.split(` `)){let t=[];for(let n of r.split(`.`)){let r=e[n]||U[n];r?typeof r==`function`?t.length?t=t.map(r):ir(n,`Modifier ${n} used at start of tag`):t.length?ir(n,`Tag ${n} used as modifier`):t=Array.isArray(r)?r:[r]:ir(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=er[i];if(a)return a.id;let o=er[i]=C.define({id:Zn.length,name:r,props:[ze({[r]:n})]});return Zn.push(o),o.id}function or(e,t){let n=C.define({id:Zn.length,name:`Document`,props:[W.add(()=>e),St.add(()=>e=>t.getIndent(e))],top:!0});return Zn.push(n),n}function sr(e){return e.length<=4096&&/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/.test(e)}function cr(e){for(let t=e.iter();!t.next().done;)if(sr(t.value))return!0;return!1}function lr(e){let t=!1;return e.iterChanges((e,n,r,i,a)=>{!t&&cr(a)&&(t=!0)}),t}var ur=/*@__PURE__*/ o.define({combine:e=>e.some(e=>e)});function dr(e={}){let t=[fr];return e.alwaysIsolate&&t.push(ur.of(!0)),t}var fr=/*@__PURE__*/ l.fromClass(class{constructor(e){this.always=e.state.facet(ur)||e.textDirection!=p.LTR||e.state.facet(g.perLineTextDirection),this.hasRTL=!this.always&&cr(e.state.doc),this.tree=K(e.state),this.decorations=this.always||this.hasRTL?pr(e,this.tree,this.always):_.none}update(e){let t=e.state.facet(ur)||e.view.textDirection!=p.LTR||e.state.facet(g.perLineTextDirection);if(!t&&!this.hasRTL&&lr(e.changes)&&(this.hasRTL=!0),!t&&!this.hasRTL)return;let n=K(e.state);(t!=this.always||n!=this.tree||e.docChanged||e.viewportChanged)&&(this.tree=n,this.always=t,this.decorations=pr(e.view,n,t))}},{provide:e=>{function t(t){return t.plugin(e)?.decorations??_.none}return[g.outerDecorations.of(t),n.lowest(g.bidiIsolatedRanges.of(t))]}});function pr(e,n,r){let i=new t,a=e.visibleRanges;r||(a=mr(a,e.state.doc));for(let{from:e,to:t}of a)n.iterate({enter:e=>{let t=e.type.prop(b.isolate);t&&i.add(e.from,e.to,hr[t])},from:e,to:t});return i.finish()}function mr(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&&sr(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 hr={rtl:/*@__PURE__*/ _.mark({class:`cm-iso`,inclusive:!0,attributes:{dir:`rtl`},bidiIsolate:p.RTL}),ltr:/*@__PURE__*/ _.mark({class:`cm-iso`,inclusive:!0,attributes:{dir:`ltr`},bidiIsolate:p.LTR}),auto:/*@__PURE__*/ _.mark({class:`cm-iso`,inclusive:!0,attributes:{dir:`auto`},bidiIsolate:null})};export{st as DocInput,mn as HighlightStyle,xt as IndentContext,nt as LRLanguage,G as Language,ht as LanguageDescription,mt as LanguageSupport,ct as ParseContext,Wn as StreamLanguage,Bn as StringStream,Ot as TreeIndentContext,b as a,dr as bidiIsolates,Mn as bracketMatching,Nn as bracketMatchingHandle,_e as c,on as codeFolding,Pt as continuedIndent,be as d,Sn as defaultHighlightStyle,$e as defineLanguageFacet,jt as delimitedIndent,rt as ensureSyntaxTree,Nt as flatIndent,Qt as foldAll,Yt as foldCode,Z as foldEffect,fn as foldGutter,zt as foldInside,nn as foldKeymap,Rt as foldNodeProp,Lt as foldService,$ as foldState,X as foldable,Gt as foldedRanges,at as forceParsing,Y as getIndentUnit,yt as getIndentation,yn as highlightingFor,D as i,St as indentNodeProp,It as indentOnInput,bt as indentRange,gt as indentService,vt as indentString,_t as indentUnit,ve as l,J as language,W as languageDataProp,In as matchBrackets,U as n,w as o,ee as r,C as s,et as sublanguageProp,vn as syntaxHighlighting,ot as syntaxParserRunning,K as syntaxTree,it as syntaxTreeAvailable,ze as t,tn as toggleFold,O as u,$t as unfoldAll,Xt as unfoldCode,Q as unfoldEffect};