@wildo-ai/application-creation-workbench 1.1.6 → 1.1.7

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 (96) hide show
  1. package/dist/.vite/manifest.json +385 -385
  2. package/dist/assets/{ChartEmptyState-vnbtQJRv.js → ChartEmptyState-BP_Yq5V7.js} +1 -1
  3. package/dist/assets/{ChartView-x1vQXM6x.js → ChartView-07Vh3EtV.js} +1 -1
  4. package/dist/assets/{_basePickBy-BUJtASGg.js → _basePickBy-C0TWefH3.js} +1 -1
  5. package/dist/assets/{_baseUniq-Chq6Hj0Q.js → _baseUniq-aBjj_hOi.js} +1 -1
  6. package/dist/assets/{arc-BeWl8gYK.js → arc-B7pBcXhk.js} +1 -1
  7. package/dist/assets/{architectureDiagram-VXUJARFQ-_fzd-qDz.js → architectureDiagram-VXUJARFQ-CxaR1SOK.js} +1 -1
  8. package/dist/assets/{blockDiagram-VD42YOAC-DM57jRhG.js → blockDiagram-VD42YOAC-FQ6rpl1q.js} +1 -1
  9. package/dist/assets/{c4Diagram-YG6GDRKO-N4hun6kR.js → c4Diagram-YG6GDRKO-MBotlECZ.js} +1 -1
  10. package/dist/assets/channel-BihP_0tn.js +1 -0
  11. package/dist/assets/{chunk-4BX2VUAB-B2xRE747.js → chunk-4BX2VUAB-DH3JjsZf.js} +1 -1
  12. package/dist/assets/{chunk-55IACEB6-CvJ9QtLx.js → chunk-55IACEB6-B-1eMtsJ.js} +1 -1
  13. package/dist/assets/{chunk-B4BG7PRW-rGkA9HFg.js → chunk-B4BG7PRW-DjqjS8Nd.js} +1 -1
  14. package/dist/assets/{chunk-DI55MBZ5-CxTq0cDY.js → chunk-DI55MBZ5-CNDJpkHu.js} +1 -1
  15. package/dist/assets/{chunk-FMBD7UC4-D9g3UvMM.js → chunk-FMBD7UC4-C_LJMr3H.js} +1 -1
  16. package/dist/assets/{chunk-QN33PNHL-DI9k8_lz.js → chunk-QN33PNHL-DOWhVFKY.js} +1 -1
  17. package/dist/assets/{chunk-QZHKN3VN-ChT_sHRj.js → chunk-QZHKN3VN-BqSJxIuw.js} +1 -1
  18. package/dist/assets/{chunk-TZMSLE5B-B5iYphMw.js → chunk-TZMSLE5B-CnGhg192.js} +1 -1
  19. package/dist/assets/classDiagram-2ON5EDUG-DmlHswhx.js +1 -0
  20. package/dist/assets/classDiagram-v2-WZHVMYZB-DmlHswhx.js +1 -0
  21. package/dist/assets/clone-H3FbKF9K.js +1 -0
  22. package/dist/assets/{cm6-editor-DJrEVp7y.js → cm6-editor-DpZrV-bm.js} +3 -3
  23. package/dist/assets/{code-block-IT6T5CEO-wawaxv6B.js → code-block-IT6T5CEO-CJXyw75w.js} +1 -1
  24. package/dist/assets/{context-ABN2sFMI.js → context-CYZBYFJH.js} +1 -1
  25. package/dist/assets/{cose-bilkent-S5V4N54A-Bb1K3eyS.js → cose-bilkent-S5V4N54A-BV1r6KdQ.js} +1 -1
  26. package/dist/assets/{dagre-6UL2VRFP-BvO-vk8t.js → dagre-6UL2VRFP-xo5kvHqM.js} +1 -1
  27. package/dist/assets/{diagram-PSM6KHXK-iEg6UnAL.js → diagram-PSM6KHXK-yWnIouwj.js} +1 -1
  28. package/dist/assets/{diagram-QEK2KX5R-DwO8fbtK.js → diagram-QEK2KX5R-7PaiBPsn.js} +1 -1
  29. package/dist/assets/{diagram-S2PKOQOG-GC7zy_a7.js → diagram-S2PKOQOG-CLb_cZaK.js} +1 -1
  30. package/dist/assets/{dropbox-picker-C1ceqxm5.js → dropbox-picker-dJzRo9BP.js} +1 -1
  31. package/dist/assets/{erDiagram-Q2GNP2WA-C6heLj_B.js → erDiagram-Q2GNP2WA-C7zQODGQ.js} +1 -1
  32. package/dist/assets/{flowDiagram-NV44I4VS-D4EOSGiq.js → flowDiagram-NV44I4VS-CU90-nPK.js} +1 -1
  33. package/dist/assets/{flows-actors-graph-runtime-CYPbbmDe.js → flows-actors-graph-runtime-I8VIayGy.js} +1 -1
  34. package/dist/assets/{ganttDiagram-JELNMOA3-BmEbJvgh.js → ganttDiagram-JELNMOA3-QChqch-L.js} +1 -1
  35. package/dist/assets/{gitGraphDiagram-V2S2FVAM-BwTGeiBP.js → gitGraphDiagram-V2S2FVAM-C9TJLfq4.js} +1 -1
  36. package/dist/assets/{google-drive-picker-DBCqNG9r.js → google-drive-picker-DP0pskfD.js} +1 -1
  37. package/dist/assets/{graph-CyXgL8Ys.js → graph-BSonitmV.js} +1 -1
  38. package/dist/assets/{graph-runtime-BdufMUiD.js → graph-runtime-8-ugTIpe.js} +1 -1
  39. package/dist/assets/{index-ClfSNKQc.js → index-B3f48X5_.js} +1 -1
  40. package/dist/assets/{index-CHFSxI_e.js → index-B5SFUruu.js} +1 -1
  41. package/dist/assets/{index-DfQCF6EF.js → index-BAj7bJQ9.js} +1 -1
  42. package/dist/assets/{index-CA1DFDQc.js → index-BVEXkCPp.js} +1 -1
  43. package/dist/assets/{index-COWIp8Rv.js → index-BZyZXiVP.js} +1 -1
  44. package/dist/assets/{index-vr8QPM_A.js → index-BkfsYGDI.js} +1 -1
  45. package/dist/assets/{index-BX1L2t3R.js → index-Bzi4leGz.js} +1 -1
  46. package/dist/assets/{index-DOy3EDwu.js → index-CFS2kf4X.js} +1 -1
  47. package/dist/assets/{index-au9Pn3nl.js → index-CTGTArYi.js} +1 -1
  48. package/dist/assets/{index-C0XMoTsM.js → index-CZfKMV0S.js} +1 -1
  49. package/dist/assets/{index-kqaFZuIz.js → index-CclRN4na.js} +1 -1
  50. package/dist/assets/{index-DKuz3qrC.js → index-CpNjptBT.js} +3 -3
  51. package/dist/assets/{index-CxsT3kOM.js → index-CqAJwEb9.js} +1 -1
  52. package/dist/assets/{index-D_ldXu1l.js → index-Cx98Z3Ta.js} +1 -1
  53. package/dist/assets/{index-K1CmWPh0.js → index-D-9PKSn4.js} +1 -1
  54. package/dist/assets/{index-BVnJDOvK.js → index-D12-fzIP.js} +1 -1
  55. package/dist/assets/{index-DpRaq7Jp.js → index-D8dkqP85.js} +13 -13
  56. package/dist/assets/{index-CI4ILsT2.js → index-DL_hDFJK.js} +1 -1
  57. package/dist/assets/{index-DrIhVGMk.js → index-DNdNQX3_.js} +1 -1
  58. package/dist/assets/{index-qy985yf3.js → index-DRrfjJvh.js} +1 -1
  59. package/dist/assets/{index-B0x1Gl0B.js → index-D_QZLEQq.js} +1 -1
  60. package/dist/assets/{index-d5nSXJSW.js → index-Dl0klRA0.js} +1 -1
  61. package/dist/assets/{index-Pn2SVSaH.js → index-DwafvHBM.js} +1 -1
  62. package/dist/assets/{index-CY5iDU16.js → index-dEth1qer.js} +1 -1
  63. package/dist/assets/{index-DqoaBbwq.js → index-jiRPxWhK.js} +1 -1
  64. package/dist/assets/{index-DxeCPsiE.js → index-tJ39cHN5.js} +1 -1
  65. package/dist/assets/{index-C7QRIEGk.js → index-vvv2MPol.js} +1 -1
  66. package/dist/assets/{index.es-DDxfmQRN.js → index.es-BIyJxiiZ.js} +1 -1
  67. package/dist/assets/{infoDiagram-HS3SLOUP-BXdMg9xN.js → infoDiagram-HS3SLOUP-Beor-41t.js} +1 -1
  68. package/dist/assets/{journeyDiagram-XKPGCS4Q-Du22u7uT.js → journeyDiagram-XKPGCS4Q-TTxuStRy.js} +1 -1
  69. package/dist/assets/{kanban-definition-3W4ZIXB7-DZG0ZQ3p.js → kanban-definition-3W4ZIXB7-BYqFfkjy.js} +1 -1
  70. package/dist/assets/{layout-pxaVeth5.js → layout-DrzykIoN.js} +1 -1
  71. package/dist/assets/{linear-n697rsbT.js → linear-D86elEgL.js} +1 -1
  72. package/dist/assets/{maximize-2-BrkaliYv.js → maximize-2-zJKkDRK0.js} +1 -1
  73. package/dist/assets/{mermaid-VLURNSYL-CqAj2yFa.js → mermaid-VLURNSYL-BAygRTK6.js} +4 -4
  74. package/dist/assets/{mermaid.core-CzuYaIvR.js → mermaid.core-bwWKwscf.js} +5 -5
  75. package/dist/assets/{mindmap-definition-VGOIOE7T-ARITf789.js → mindmap-definition-VGOIOE7T-DmkSZj5s.js} +1 -1
  76. package/dist/assets/{onedrive-picker-BU0we9mc.js → onedrive-picker-CyXOFDsr.js} +1 -1
  77. package/dist/assets/{pdf-viewer-KUL0u_rs.js → pdf-viewer-BSy3edho.js} +1 -1
  78. package/dist/assets/{pieDiagram-ADFJNKIX-BJmwIm-w.js → pieDiagram-ADFJNKIX-BoqRK1Nj.js} +1 -1
  79. package/dist/assets/{quadrantDiagram-AYHSOK5B-BzBOn_iU.js → quadrantDiagram-AYHSOK5B-iVG56kyl.js} +1 -1
  80. package/dist/assets/{requirementDiagram-UZGBJVZJ-DkYA_44W.js → requirementDiagram-UZGBJVZJ-BlfhbQSa.js} +1 -1
  81. package/dist/assets/{sankeyDiagram-TZEHDZUN-CWYB5O5b.js → sankeyDiagram-TZEHDZUN-CIqchrnr.js} +1 -1
  82. package/dist/assets/{sequenceDiagram-WL72ISMW-D9K_h-J2.js → sequenceDiagram-WL72ISMW-D98Lehfv.js} +1 -1
  83. package/dist/assets/{shiki-highlighter-runtime-Clxh3dCq.js → shiki-highlighter-runtime-CUsH9pAI.js} +1 -1
  84. package/dist/assets/{stateDiagram-FKZM4ZOC-CgTHGlx6.js → stateDiagram-FKZM4ZOC-DKCmtDHk.js} +1 -1
  85. package/dist/assets/stateDiagram-v2-4FDKWEC3-BExRj50s.js +1 -0
  86. package/dist/assets/{timeline-definition-IT6M3QCI-DgcY0NLY.js → timeline-definition-IT6M3QCI-DeDxHecT.js} +1 -1
  87. package/dist/assets/{treemap-GDKQZRPO-D-6O4De6.js → treemap-GDKQZRPO-DIQh1NSx.js} +1 -1
  88. package/dist/assets/{useQuickActionButtonBehavior-WboS9iSe.js → useQuickActionButtonBehavior-BpISdruD.js} +1 -1
  89. package/dist/assets/{xychartDiagram-PRI3JC2R-MHRzD2fB.js → xychartDiagram-PRI3JC2R-DeAMabcI.js} +1 -1
  90. package/dist/index.html +1 -1
  91. package/package.json +8 -8
  92. package/dist/assets/channel-k7BWypKE.js +0 -1
  93. package/dist/assets/classDiagram-2ON5EDUG-CTq2TSPz.js +0 -1
  94. package/dist/assets/classDiagram-v2-WZHVMYZB-CTq2TSPz.js +0 -1
  95. package/dist/assets/clone-CI0H6yae.js +0 -1
  96. package/dist/assets/stateDiagram-v2-4FDKWEC3-B2_CbdeF.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-COWIp8Rv.js","assets/index-B0x1Gl0B.js","assets/index-DxeCPsiE.js","assets/index-DpRaq7Jp.js","assets/index-D-THewyc.css","assets/index-CI4ILsT2.js","assets/index-d5nSXJSW.js","assets/index-CY5iDU16.js","assets/index-Pn2SVSaH.js","assets/index-DOy3EDwu.js","assets/index-C0XMoTsM.js","assets/index-kqaFZuIz.js","assets/index-DqoaBbwq.js","assets/index-CHFSxI_e.js","assets/index-C7QRIEGk.js","assets/index-ClfSNKQc.js","assets/index-CA1DFDQc.js","assets/index-au9Pn3nl.js","assets/index-CxsT3kOM.js","assets/index-vr8QPM_A.js","assets/index-DrIhVGMk.js","assets/index-BX1L2t3R.js","assets/index-qy985yf3.js","assets/dockerfile-BKs6k2Af.js","assets/simple-mode-GW_nhZxv.js","assets/factor-kuTfRLto.js","assets/nsis-LdVXkNf5.js","assets/pug-DeIclll2.js","assets/javascript-iXu5QeM3.js","assets/index-D_ldXu1l.js","assets/index-DfQCF6EF.js"])))=>i.map(i=>d[i]);
2
- import{_ as x,r as xe,aq as Rn,j as La}from"./index-DpRaq7Jp.js";let In=[],bo=[];(()=>{let n="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<n.length;e++)(e%2?bo:In).push(t=t+n[e])})();function Pa(n){if(n<768)return!1;for(let e=0,t=In.length;;){let i=e+t>>1;if(n<In[i])t=i;else if(n>=bo[i])e=i+1;else return!0;if(e==t)return!1}}function es(n){return n>=127462&&n<=127487}const ts=8205;function Ra(n,e,t=!0,i=!0){return(t?wo:Ia)(n,e,i)}function wo(n,e,t){if(e==n.length)return e;e&&vo(n.charCodeAt(e))&&ko(n.charCodeAt(e-1))&&e--;let i=pn(n,e);for(e+=is(i);e<n.length;){let r=pn(n,e);if(i==ts||r==ts||t&&Pa(r))e+=is(r),i=r;else if(es(r)){let s=0,o=e-2;for(;o>=0&&es(pn(n,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function Ia(n,e,t){for(;e>1;){let i=wo(n,e-2,t);if(i<e)return i;e--}return 0}function pn(n,e){let t=n.charCodeAt(e);if(!ko(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return vo(i)?(t-55296<<10)+(i-56320)+65536:t}function vo(n){return n>=56320&&n<57344}function ko(n){return n>=55296&&n<56320}function is(n){return n<65536?1:2}class N{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=Pt(this,e,t);let r=[];return this.decompose(0,e,r,2),i.length&&i.decompose(0,i.length,r,3),this.decompose(t,this.length,r,1),Be.from(r,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Pt(this,e,t);let i=[];return this.decompose(e,t,i,0),Be.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),r=new Xt(this),s=new Xt(e);for(let o=t,l=t;;){if(r.next(o),s.next(o),o=0,r.lineBreak!=s.lineBreak||r.done!=s.done||r.value!=s.value)return!1;if(l+=r.value.length,r.done||l>=i)return!0}}iter(e=1){return new Xt(this,e)}iterRange(e,t=this.length){return new So(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let r=this.line(e).from;i=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new Ao(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?N.empty:e.length<=32?new X(e):Be.from(X.split(e,[]))}}class X extends N{constructor(e,t=Ba(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,r){for(let s=0;;s++){let o=this.text[s],l=r+o.length;if((t?i:l)>=e)return new Va(r,l,i,o);r=l+1,i++}}decompose(e,t,i,r){let s=e<=0&&t>=this.length?this:new X(ns(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(r&1){let o=i.pop(),l=Vi(s.text,o.text.slice(),0,s.length);if(l.length<=32)i.push(new X(l,o.length+s.length));else{let a=l.length>>1;i.push(new X(l.slice(0,a)),new X(l.slice(a)))}}else i.push(s)}replace(e,t,i){if(!(i instanceof X))return super.replace(e,t,i);[e,t]=Pt(this,e,t);let r=Vi(this.text,Vi(i.text,ns(this.text,0,e)),t),s=this.length+i.length-(t-e);return r.length<=32?new X(r,s):Be.from(X.split(r,[]),s)}sliceString(e,t=this.length,i=`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BZyZXiVP.js","assets/index-D_QZLEQq.js","assets/index-tJ39cHN5.js","assets/index-D8dkqP85.js","assets/index-D-THewyc.css","assets/index-DL_hDFJK.js","assets/index-Dl0klRA0.js","assets/index-dEth1qer.js","assets/index-DwafvHBM.js","assets/index-CFS2kf4X.js","assets/index-CZfKMV0S.js","assets/index-CclRN4na.js","assets/index-jiRPxWhK.js","assets/index-B5SFUruu.js","assets/index-vvv2MPol.js","assets/index-B3f48X5_.js","assets/index-BVEXkCPp.js","assets/index-CTGTArYi.js","assets/index-CqAJwEb9.js","assets/index-BkfsYGDI.js","assets/index-DNdNQX3_.js","assets/index-Bzi4leGz.js","assets/index-DRrfjJvh.js","assets/dockerfile-BKs6k2Af.js","assets/simple-mode-GW_nhZxv.js","assets/factor-kuTfRLto.js","assets/nsis-LdVXkNf5.js","assets/pug-DeIclll2.js","assets/javascript-iXu5QeM3.js","assets/index-Cx98Z3Ta.js","assets/index-BAj7bJQ9.js"])))=>i.map(i=>d[i]);
2
+ import{_ as x,r as xe,aq as Rn,j as La}from"./index-D8dkqP85.js";let In=[],bo=[];(()=>{let n="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<n.length;e++)(e%2?bo:In).push(t=t+n[e])})();function Pa(n){if(n<768)return!1;for(let e=0,t=In.length;;){let i=e+t>>1;if(n<In[i])t=i;else if(n>=bo[i])e=i+1;else return!0;if(e==t)return!1}}function es(n){return n>=127462&&n<=127487}const ts=8205;function Ra(n,e,t=!0,i=!0){return(t?wo:Ia)(n,e,i)}function wo(n,e,t){if(e==n.length)return e;e&&vo(n.charCodeAt(e))&&ko(n.charCodeAt(e-1))&&e--;let i=pn(n,e);for(e+=is(i);e<n.length;){let r=pn(n,e);if(i==ts||r==ts||t&&Pa(r))e+=is(r),i=r;else if(es(r)){let s=0,o=e-2;for(;o>=0&&es(pn(n,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function Ia(n,e,t){for(;e>1;){let i=wo(n,e-2,t);if(i<e)return i;e--}return 0}function pn(n,e){let t=n.charCodeAt(e);if(!ko(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return vo(i)?(t-55296<<10)+(i-56320)+65536:t}function vo(n){return n>=56320&&n<57344}function ko(n){return n>=55296&&n<56320}function is(n){return n<65536?1:2}class N{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=Pt(this,e,t);let r=[];return this.decompose(0,e,r,2),i.length&&i.decompose(0,i.length,r,3),this.decompose(t,this.length,r,1),Be.from(r,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Pt(this,e,t);let i=[];return this.decompose(e,t,i,0),Be.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),r=new Xt(this),s=new Xt(e);for(let o=t,l=t;;){if(r.next(o),s.next(o),o=0,r.lineBreak!=s.lineBreak||r.done!=s.done||r.value!=s.value)return!1;if(l+=r.value.length,r.done||l>=i)return!0}}iter(e=1){return new Xt(this,e)}iterRange(e,t=this.length){return new So(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let r=this.line(e).from;i=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new Ao(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?N.empty:e.length<=32?new X(e):Be.from(X.split(e,[]))}}class X extends N{constructor(e,t=Ba(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,r){for(let s=0;;s++){let o=this.text[s],l=r+o.length;if((t?i:l)>=e)return new Va(r,l,i,o);r=l+1,i++}}decompose(e,t,i,r){let s=e<=0&&t>=this.length?this:new X(ns(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(r&1){let o=i.pop(),l=Vi(s.text,o.text.slice(),0,s.length);if(l.length<=32)i.push(new X(l,o.length+s.length));else{let a=l.length>>1;i.push(new X(l.slice(0,a)),new X(l.slice(a)))}}else i.push(s)}replace(e,t,i){if(!(i instanceof X))return super.replace(e,t,i);[e,t]=Pt(this,e,t);let r=Vi(this.text,Vi(i.text,ns(this.text,0,e)),t),s=this.length+i.length-(t-e);return r.length<=32?new X(r,s):Be.from(X.split(r,[]),s)}sliceString(e,t=this.length,i=`
3
3
  `){[e,t]=Pt(this,e,t);let r="";for(let s=0,o=0;s<=t&&o<this.text.length;o++){let l=this.text[o],a=s+l.length;s>e&&o&&(r+=i),e<a&&t>s&&(r+=l.slice(Math.max(0,e-s),t-s)),s=a+1}return r}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],r=-1;for(let s of e)i.push(s),r+=s.length+1,i.length==32&&(t.push(new X(i,r)),i=[],r=-1);return r>-1&&t.push(new X(i,r)),t}}class Be extends N{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,r){for(let s=0;;s++){let o=this.children[s],l=r+o.length,a=i+o.lines-1;if((t?a:l)>=e)return o.lineInner(e,t,i,r);r=l+1,i=a+1}}decompose(e,t,i,r){for(let s=0,o=0;o<=t&&s<this.children.length;s++){let l=this.children[s],a=o+l.length;if(e<=a&&t>=o){let h=r&((o<=e?1:0)|(a>=t?2:0));o>=e&&a<=t&&!h?i.push(l):l.decompose(e-o,t-o,i,h)}o=a+1}}replace(e,t,i){if([e,t]=Pt(this,e,t),i.lines<this.lines)for(let r=0,s=0;r<this.children.length;r++){let o=this.children[r],l=s+o.length;if(e>=s&&t<=l){let a=o.replace(e-s,t-s,i),h=this.lines-o.lines+a.lines;if(a.lines<h>>4&&a.lines>h>>6){let f=this.children.slice();return f[r]=a,new Be(f,this.length-(t-e)+i.length)}return super.replace(s,l,a)}s=l+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=`
4
4
  `){[e,t]=Pt(this,e,t);let r="";for(let s=0,o=0;s<this.children.length&&o<=t;s++){let l=this.children[s],a=o+l.length;o>e&&s&&(r+=i),e<a&&t>o&&(r+=l.sliceString(e-o,t-o,i)),o=a+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Be))return 0;let i=0,[r,s,o,l]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;r+=t,s+=t){if(r==o||s==l)return i;let a=this.children[r],h=e.children[s];if(a!=h)return i+a.scanIdentical(h,t);i+=a.length+1}}static from(e,t=e.reduce((i,r)=>i+r.length+1,-1)){let i=0;for(let d of e)i+=d.lines;if(i<32){let d=[];for(let p of e)p.flatten(d);return new X(d,t)}let r=Math.max(32,i>>5),s=r<<1,o=r>>1,l=[],a=0,h=-1,f=[];function u(d){let p;if(d.lines>s&&d instanceof Be)for(let g of d.children)u(g);else d.lines>o&&(a>o||!a)?(c(),l.push(d)):d instanceof X&&a&&(p=f[f.length-1])instanceof X&&d.lines+p.lines<=32?(a+=d.lines,h+=d.length+1,f[f.length-1]=new X(p.text.concat(d.text),p.length+1+d.length)):(a+d.lines>r&&c(),a+=d.lines,h+=d.length+1,f.push(d))}function c(){a!=0&&(l.push(f.length==1?f[0]:Be.from(f,h)),h=-1,a=f.length=0)}for(let d of e)u(d);return c(),l.length==1?l[0]:new Be(l,t)}}N.empty=new X([""],0);function Ba(n){let e=-1;for(let t of n)e+=t.length+1;return e}function Vi(n,e,t=0,i=1e9){for(let r=0,s=0,o=!0;s<n.length&&r<=i;s++){let l=n[s],a=r+l.length;a>=t&&(a>i&&(l=l.slice(0,i-r)),r<t&&(l=l.slice(t-r)),o?(e[e.length-1]+=l,o=!1):e.push(l)),r=a+1}return e}function ns(n,e,t){return Vi(n,[""],e,t)}class Xt{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof X?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,r=this.nodes[i],s=this.offsets[i],o=s>>1,l=r instanceof X?r.text.length:r.children.length;if(o==(t>0?l:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=`
5
5
  `,this;e--}else if(r instanceof X){let a=r.text[o+(t<0?-1:0)];if(this.offsets[i]+=t,a.length>Math.max(0,e))return this.value=e==0?a:t>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=r.children[o+(t<0?-1:0)];e>a.length?(e-=a.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(a),this.offsets.push(t>0?1:(a instanceof X?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class So{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new Xt(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*t,this.value=r.length<=i?r:t<0?r.slice(r.length-i):r.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class Ao{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:r}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(N.prototype[Symbol.iterator]=function(){return this.iter()},Xt.prototype[Symbol.iterator]=So.prototype[Symbol.iterator]=Ao.prototype[Symbol.iterator]=function(){return this});class Va{constructor(e,t,i,r){this.from=e,this.to=t,this.number=i,this.text=r}get length(){return this.to-this.from}}function Pt(n,e,t){return e=Math.max(0,Math.min(n.length,e)),[e,Math.max(e,Math.min(n.length,t))]}function se(n,e,t=!0,i=!0){return Ra(n,e,t,i)}function Na(n){return n>=56320&&n<57344}function Wa(n){return n>=55296&&n<56320}function Ha(n,e){let t=n.charCodeAt(e);if(!Wa(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return Na(i)?(t-55296<<10)+(i-56320)+65536:t}function Fa(n){return n<65536?1:2}const Bn=/\r\n?|\n/;var me=(function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n})(me||(me={}));class je{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t+1];e+=i<0?this.sections[t]:i}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,i=0,r=0;t<this.sections.length;){let s=this.sections[t++],o=this.sections[t++];o<0?(e(i,r,s),r+=s):r+=o,i+=s}}iterChangedRanges(e,t=!1){Vn(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let i=this.sections[t++],r=this.sections[t++];r<0?e.push(i,r):e.push(r,i)}return new je(e)}composeDesc(e){return this.empty?e:e.empty?this:Co(this,e)}mapDesc(e,t=!1){return e.empty?this:Nn(this,e,t)}mapPos(e,t=-1,i=me.Simple){let r=0,s=0;for(let o=0;o<this.sections.length;){let l=this.sections[o++],a=this.sections[o++],h=r+l;if(a<0){if(h>e)return s+(e-r);s+=l}else{if(i!=me.Simple&&h>=e&&(i==me.TrackDel&&r<e&&h>e||i==me.TrackBefore&&r<e||i==me.TrackAfter&&h>e))return null;if(h>e||h==e&&t<0&&!l)return e==r||t<0?s:s+a;s+=a}r=h}if(e>r)throw new RangeError(`Position ${e} is out of range for changeset of length ${r}`);return s}touchesRange(e,t=e){for(let i=0,r=0;i<this.sections.length&&r<=t;){let s=this.sections[i++],o=this.sections[i++],l=r+s;if(o>=0&&r<=t&&l>=e)return r<e&&l>t?"cover":!0;r=l}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let i=this.sections[t++],r=this.sections[t++];e+=(e?" ":"")+i+(r>=0?":"+r:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new je(e)}static create(e){return new je(e)}}class Z extends je{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Vn(this,(t,i,r,s,o)=>e=e.replace(r,r+(i-t),o),!1),e}mapDesc(e,t=!1){return Nn(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let r=0,s=0;r<t.length;r+=2){let o=t[r],l=t[r+1];if(l>=0){t[r]=l,t[r+1]=o;let a=r>>1;for(;i.length<a;)i.push(N.empty);i.push(o?e.slice(s,s+o):N.empty)}s+=o}return new Z(t,i)}compose(e){return this.empty?e:e.empty?this:Co(this,e,!0)}map(e,t=!1){return e.empty?this:Nn(this,e,t,!0)}iterChanges(e,t=!1){Vn(this,e,t)}get desc(){return je.create(this.sections)}filter(e){let t=[],i=[],r=[],s=new ii(this);e:for(let o=0,l=0;;){let a=o==e.length?1e9:e[o++];for(;l<a||l==a&&s.len==0;){if(s.done)break e;let f=Math.min(s.len,a-l);re(r,f,-1);let u=s.ins==-1?-1:s.off==0?s.ins:0;re(t,f,u),u>0&&nt(i,t,s.text),s.forward(f),l+=f}let h=e[o++];for(;l<h;){if(s.done)break e;let f=Math.min(s.len,h-l);re(t,f,-1),re(r,f,s.ins==-1?-1:s.off==0?s.ins:0),s.forward(f),l+=f}}return{changes:new Z(t,i),filtered:je.create(r)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t],r=this.sections[t+1];r<0?e.push(i):r==0?e.push([i]):e.push([i].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,i){let r=[],s=[],o=0,l=null;function a(f=!1){if(!f&&!r.length)return;o<t&&re(r,t-o,-1);let u=new Z(r,s);l=l?l.compose(u.map(l)):u,r=[],s=[],o=0}function h(f){if(Array.isArray(f))for(let u of f)h(u);else if(f instanceof Z){if(f.length!=t)throw new RangeError(`Mismatched change set length (got ${f.length}, expected ${t})`);a(),l=l?l.compose(f.map(l)):f}else{let{from:u,to:c=u,insert:d}=f;if(u>c||u<0||c>t)throw new RangeError(`Invalid change range ${u} to ${c} (in doc of length ${t})`);let p=d?typeof d=="string"?N.of(d.split(i||Bn)):d:N.empty,g=p.length;if(u==c&&g==0)return;u<o&&a(),u>o&&re(r,u-o,-1),re(r,c-u,g),nt(s,r,p),o=c}}return h(e),a(!l),l}static empty(e){return new Z(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let r=0;r<e.length;r++){let s=e[r];if(typeof s=="number")t.push(s,-1);else{if(!Array.isArray(s)||typeof s[0]!="number"||s.some((o,l)=>l&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)t.push(s[0],0);else{for(;i.length<r;)i.push(N.empty);i[r]=N.of(s.slice(1)),t.push(s[0],i[r].length)}}}return new Z(t,i)}static createSet(e,t){return new Z(e,t)}}function re(n,e,t,i=!1){if(e==0&&t<=0)return;let r=n.length-2;r>=0&&t<=0&&t==n[r+1]?n[r]+=e:r>=0&&e==0&&n[r]==0?n[r+1]+=t:i?(n[r]+=e,n[r+1]+=t):n.push(e,t)}function nt(n,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i<n.length)n[n.length-1]=n[n.length-1].append(t);else{for(;n.length<i;)n.push(N.empty);n.push(t)}}function Vn(n,e,t){let i=n.inserted;for(let r=0,s=0,o=0;o<n.sections.length;){let l=n.sections[o++],a=n.sections[o++];if(a<0)r+=l,s+=l;else{let h=r,f=s,u=N.empty;for(;h+=l,f+=a,a&&i&&(u=u.append(i[o-2>>1])),!(t||o==n.sections.length||n.sections[o+1]<0);)l=n.sections[o++],a=n.sections[o++];e(r,h,s,f,u),r=h,s=f}}}function Nn(n,e,t,i=!1){let r=[],s=i?[]:null,o=new ii(n),l=new ii(e);for(let a=-1;;){if(o.done&&l.len||l.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&l.ins==-1){let h=Math.min(o.len,l.len);re(r,h,-1),o.forward(h),l.forward(h)}else if(l.ins>=0&&(o.ins<0||a==o.i||o.off==0&&(l.len<o.len||l.len==o.len&&!t))){let h=l.len;for(re(r,l.ins,-1);h;){let f=Math.min(o.len,h);o.ins>=0&&a<o.i&&o.len<=f&&(re(r,0,o.ins),s&&nt(s,r,o.text),a=o.i),o.forward(f),h-=f}l.next()}else if(o.ins>=0){let h=0,f=o.len;for(;f;)if(l.ins==-1){let u=Math.min(f,l.len);h+=u,f-=u,l.forward(u)}else if(l.ins==0&&l.len<f)f-=l.len,l.next();else break;re(r,h,a<o.i?o.ins:0),s&&a<o.i&&nt(s,r,o.text),a=o.i,o.forward(o.len-f)}else{if(o.done&&l.done)return s?Z.createSet(r,s):je.create(r);throw new Error("Mismatched change set lengths")}}}function Co(n,e,t=!1){let i=[],r=t?[]:null,s=new ii(n),o=new ii(e);for(let l=!1;;){if(s.done&&o.done)return r?Z.createSet(i,r):je.create(i);if(s.ins==0)re(i,s.len,0,l),s.next();else if(o.len==0&&!o.done)re(i,0,o.ins,l),r&&nt(r,i,o.text),o.next();else{if(s.done||o.done)throw new Error("Mismatched change set lengths");{let a=Math.min(s.len2,o.len),h=i.length;if(s.ins==-1){let f=o.ins==-1?-1:o.off?0:o.ins;re(i,a,f,l),r&&f&&nt(r,i,o.text)}else o.ins==-1?(re(i,s.off?0:s.len,a,l),r&&nt(r,i,s.textBit(a))):(re(i,s.off?0:s.len,o.off?0:o.ins,l),r&&!o.off&&nt(r,i,o.text));l=(s.ins>a||o.ins>=0&&o.len>a)&&(l||i.length>h),s.forward2(a),o.forward(a)}}}}class ii{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?N.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?N.empty:t[i].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class tt{constructor(e,t,i,r){this.from=e,this.to=t,this.flags=i,this.goalColumn=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get undirectional(){return(this.flags&64)>0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}map(e,t=-1){let i,r;return this.empty?i=r=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),r=e.mapPos(this.to,-1)),i==this.from&&r==this.to?this:new tt(i,r,this.flags,this.goalColumn)}extend(e,t=e,i=0){if(e<=this.anchor&&t>=this.anchor)return v.range(e,t,void 0,void 0,i);let r=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return v.range(this.anchor,r,void 0,void 0,i)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return v.range(e.anchor,e.head)}static create(e,t,i,r){return new tt(e,t,i,r)}}class v{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:v.create(this.ranges.map(i=>i.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let i=0;i<this.ranges.length;i++)if(!this.ranges[i].eq(e.ranges[i],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new v([this.main],0)}addRange(e,t=!0){return v.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let i=this.ranges.slice();return i[t]=e,v.create(i,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new v(e.ranges.map(t=>tt.fromJSON(t)),e.main)}static single(e,t=e){return new v([v.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,r=0;r<e.length;r++){let s=e[r];if(s.empty?s.from<=i:s.from<i)return v.normalized(e.slice(),t);i=s.to}return new v(e,t)}static cursor(e,t=0,i,r){return tt.create(e,e,(t==0?0:t<0?8:16)|(i==null?7:Math.min(6,i)),r)}static range(e,t,i,r,s){let o=r==null?7:Math.min(6,r);return!s&&e!=t&&(s=t<e?1:-1),s&&(o|=s<0?8:16),t<e?tt.create(t,e,o|32,i):tt.create(e,t,o,i)}static undirectionalRange(e,t){return tt.create(e,t,64,void 0)}static normalized(e,t=0){let i=e[t];e.sort((r,s)=>r.from-s.from),t=e.indexOf(i);for(let r=1;r<e.length;r++){let s=e[r],o=e[r-1];if(s.empty?s.from<=o.to:s.from<o.to){let l=o.from,a=Math.max(s.to,o.to);r<=t&&t--,e.splice(--r,2,s.anchor>s.head?v.range(a,l):v.range(l,a))}}return new v(e,t)}}function _o(n,e){for(let t of n.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let Sr=0;class D{constructor(e,t,i,r,s){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=r,this.id=Sr++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new D(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:Ar),!!e.static,e.enables)}of(e){return new Ni([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Ni(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Ni(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function Ar(n,e){return n==e||n.length==e.length&&n.every((t,i)=>t===e[i])}class Ni{constructor(e,t,i,r){this.dependencies=e,this.facet=t,this.type=i,this.value=r,this.id=Sr++}dynamicSlot(e){var t;let i=this.value,r=this.facet.compareInput,s=this.id,o=e[s]>>1,l=this.type==2,a=!1,h=!1,f=[];for(let u of this.dependencies)u=="doc"?a=!0:u=="selection"?h=!0:(((t=e[u.id])!==null&&t!==void 0?t:1)&1)==0&&f.push(e[u.id]);return{create(u){return u.values[o]=i(u),1},update(u,c){if(a&&c.docChanged||h&&(c.docChanged||c.selection)||Wn(u,f)){let d=i(u);if(l?!rs(d,u.values[o],r):!r(d,u.values[o]))return u.values[o]=d,1}return 0},reconfigure:(u,c)=>{let d,p=c.config.address[s];if(p!=null){let g=ji(c,p);if(this.dependencies.every(y=>y instanceof D?c.facet(y)===u.facet(y):y instanceof at?c.field(y,!1)==u.field(y,!1):!0)||(l?rs(d=i(u),g,r):r(d=i(u),g)))return u.values[o]=g,0}else d=i(u);return u.values[o]=d,1}}}get extension(){return this}}function rs(n,e,t){if(n.length!=e.length)return!1;for(let i=0;i<n.length;i++)if(!t(n[i],e[i]))return!1;return!0}function Wn(n,e){let t=!1;for(let i of e)Yt(n,i)&1&&(t=!0);return t}function za(n,e,t){let i=t.map(a=>n[a.id]),r=t.map(a=>a.type),s=i.filter(a=>!(a&1)),o=n[e.id]>>1;function l(a){let h=[];for(let f=0;f<i.length;f++){let u=ji(a,i[f]);if(r[f]==2)for(let c of u)h.push(c);else h.push(u)}return e.combine(h)}return{create(a){for(let h of i)Yt(a,h);return a.values[o]=l(a),1},update(a,h){if(!Wn(a,s))return 0;let f=l(a);return e.compare(f,a.values[o])?0:(a.values[o]=f,1)},reconfigure(a,h){let f=Wn(a,i),u=h.config.facets[e.id],c=h.facet(e);if(u&&!f&&Ar(t,u))return a.values[o]=c,0;let d=l(a);return e.compare(d,c)?(a.values[o]=c,0):(a.values[o]=d,1)}}}const vi=D.define({static:!0});class at{constructor(e,t,i,r,s){this.id=e,this.createF=t,this.updateF=i,this.compareF=r,this.spec=s,this.provides=void 0}static define(e){let t=new at(Sr++,e.create,e.update,e.compare||((i,r)=>i===r),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(vi).find(i=>i.field==this);return(t?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>(i.values[t]=this.create(i),1),update:(i,r)=>{let s=i.values[t],o=this.updateF(s,r);return this.compareF(s,o)?0:(i.values[t]=o,1)},reconfigure:(i,r)=>{let s=i.facet(vi),o=r.facet(vi),l;return(l=s.find(a=>a.field==this))&&l!=o.find(a=>a.field==this)?(i.values[t]=l.create(i),1):r.config.address[this.id]!=null?(i.values[t]=r.field(this),0):(i.values[t]=this.create(i),1)}}}init(e){return[this,vi.of({field:this,create:e})]}get extension(){return this}}const gt={lowest:4,low:3,default:2,high:1,highest:0};function jt(n){return e=>new To(e,n)}const Cr={highest:jt(gt.highest),high:jt(gt.high),default:jt(gt.default),low:jt(gt.low),lowest:jt(gt.lowest)};class To{constructor(e,t){this.inner=e,this.prec=t}get extension(){return this}}class Rt{of(e){return new Hn(this,e)}reconfigure(e){return Rt.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Hn{constructor(e,t){this.compartment=e,this.inner=t}get extension(){return this}}class zi{constructor(e,t,i,r,s,o){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=r,this.staticValues=s,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<i.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(e,t,i){let r=[],s=Object.create(null),o=new Map;for(let c of ja(e,t,o))c instanceof at?r.push(c):(s[c.facet.id]||(s[c.facet.id]=[])).push(c);let l=Object.create(null),a=[],h=[];for(let c of r)l[c.id]=h.length<<1,h.push(d=>c.slot(d));let f=i?.config.facets;for(let c in s){let d=s[c],p=d[0].facet,g=f&&f[c]||[];if(d.every(y=>y.type==0))if(l[p.id]=a.length<<1|1,Ar(g,d))a.push(i.facet(p));else{let y=p.combine(d.map(b=>b.value));a.push(i&&p.compare(y,i.facet(p))?i.facet(p):y)}else{for(let y of d)y.type==0?(l[y.id]=a.length<<1|1,a.push(y.value)):(l[y.id]=h.length<<1,h.push(b=>y.dynamicSlot(b)));l[p.id]=h.length<<1,h.push(y=>za(y,p,d))}}let u=h.map(c=>c(l));return new zi(e,o,u,l,a,s)}}function ja(n,e,t){let i=[[],[],[],[],[]],r=new Map;function s(o,l){let a=r.get(o);if(a!=null){if(a<=l)return;let h=i[a].indexOf(o);h>-1&&i[a].splice(h,1),o instanceof Hn&&t.delete(o.compartment)}if(r.set(o,l),Array.isArray(o))for(let h of o)s(h,l);else if(o instanceof Hn){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(o.compartment)||o.inner;t.set(o.compartment,h),s(h,l)}else if(o instanceof To)s(o.inner,o.prec);else if(o instanceof at)i[l].push(o),o.provides&&s(o.provides,l);else if(o instanceof Ni)i[l].push(o),o.facet.extensions&&s(o.facet.extensions,gt.default);else{let h=o.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${o}).`);if(h==o)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(h,l)}}return s(n,gt.default),i.reduce((o,l)=>o.concat(l))}function Yt(n,e){if(e&1)return 2;let t=e>>1,i=n.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;n.status[t]=4;let r=n.computeSlot(n,n.config.dynamicSlots[t]);return n.status[t]=2|r}function ji(n,e){return e&1?n.config.staticValues[e>>1]:n.values[e>>1]}const Eo=D.define(),Fn=D.define({combine:n=>n.some(e=>e),static:!0}),Do=D.define({combine:n=>n.length?n[0]:void 0,static:!0}),Mo=D.define(),Oo=D.define(),Lo=D.define(),Po=D.define({combine:n=>n.length?n[0]:!1});class ht{constructor(e,t){this.type=e,this.value=t}static define(){return new Ka}}class Ka{of(e){return new ht(this,e)}}class qa{constructor(e){this.map=e}of(e){return new Y(this,e)}}class Y{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new Y(this.type,t)}is(e){return this.type==e}static define(e={}){return new qa(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let r of e){let s=r.map(t);s&&i.push(s)}return i}}Y.reconfigure=Y.define();Y.appendConfig=Y.define();class ee{constructor(e,t,i,r,s,o){this.startState=e,this.changes=t,this.selection=i,this.effects=r,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,i&&_o(i,t.newLength),s.some(l=>l.type==ee.time)||(this.annotations=s.concat(ee.time.of(Date.now())))}static create(e,t,i,r,s,o){return new ee(e,t,i,r,s,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(ee.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}ee.time=ht.define();ee.userEvent=ht.define();ee.addToHistory=ht.define();ee.remote=ht.define();function Ua(n,e){let t=[];for(let i=0,r=0;;){let s,o;if(i<n.length&&(r==e.length||e[r]>=n[i]))s=n[i++],o=n[i++];else if(r<e.length)s=e[r++],o=e[r++];else return t;!t.length||t[t.length-1]<s?t.push(s,o):t[t.length-1]<o&&(t[t.length-1]=o)}}function Ro(n,e,t){var i;let r,s,o;return t?(r=e.changes,s=Z.empty(e.changes.length),o=n.changes.compose(e.changes)):(r=e.changes.map(n.changes),s=n.changes.mapDesc(e.changes,!0),o=n.changes.compose(r)),{changes:o,selection:e.selection?e.selection.map(s):(i=n.selection)===null||i===void 0?void 0:i.map(r),effects:Y.mapEffects(n.effects,r).concat(Y.mapEffects(e.effects,s)),annotations:n.annotations.length?n.annotations.concat(e.annotations):e.annotations,scrollIntoView:n.scrollIntoView||e.scrollIntoView}}function zn(n,e,t){let i=e.selection,r=Et(e.annotations);return e.userEvent&&(r=r.concat(ee.userEvent.of(e.userEvent))),{changes:e.changes instanceof Z?e.changes:Z.of(e.changes||[],t,n.facet(Do)),selection:i&&(i instanceof v?i:v.single(i.anchor,i.head)),effects:Et(e.effects),annotations:r,scrollIntoView:!!e.scrollIntoView}}function Io(n,e,t){let i=zn(n,e.length?e[0]:{},n.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let s=1;s<e.length;s++){e[s].filter===!1&&(t=!1);let o=!!e[s].sequential;i=Ro(i,zn(n,e[s],o?i.changes.newLength:n.doc.length),o)}let r=ee.create(n,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return Ga(t?$a(r):r)}function $a(n){let e=n.startState,t=!0;for(let r of e.facet(Mo)){let s=r(n);if(s===!1){t=!1;break}Array.isArray(s)&&(t=t===!0?s:Ua(t,s))}if(t!==!0){let r,s;if(t===!1)s=n.changes.invertedDesc,r=Z.empty(e.doc.length);else{let o=n.changes.filter(t);r=o.changes,s=o.filtered.mapDesc(o.changes).invertedDesc}n=ee.create(e,r,n.selection&&n.selection.map(s),Y.mapEffects(n.effects,s),n.annotations,n.scrollIntoView)}let i=e.facet(Oo);for(let r=i.length-1;r>=0;r--){let s=i[r](n);s instanceof ee?n=s:Array.isArray(s)&&s.length==1&&s[0]instanceof ee?n=s[0]:n=Io(e,Et(s),!1)}return n}function Ga(n){let e=n.startState,t=e.facet(Lo),i=n;for(let r=t.length-1;r>=0;r--){let s=t[r](n);s&&Object.keys(s).length&&(i=Ro(i,zn(e,s,n.changes.newLength),!0))}return i==n?n:ee.create(e,n.changes,n.selection,i.effects,i.annotations,i.scrollIntoView)}const Ja=[];function Et(n){return n==null?Ja:Array.isArray(n)?n:[n]}var $e=(function(n){return n[n.Word=0]="Word",n[n.Space=1]="Space",n[n.Other=2]="Other",n})($e||($e={}));const Xa=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let jn;try{jn=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function Ya(n){if(jn)return jn.test(n);for(let e=0;e<n.length;e++){let t=n[e];if(/\w/.test(t)||t>"€"&&(t.toUpperCase()!=t.toLowerCase()||Xa.test(t)))return!0}return!1}function Qa(n){return e=>{if(!/\S/.test(e))return $e.Space;if(Ya(e))return $e.Word;for(let t=0;t<n.length;t++)if(e.indexOf(n[t])>-1)return $e.Word;return $e.Other}}class B{constructor(e,t,i,r,s,o){this.config=e,this.doc=t,this.selection=i,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=s,o&&(o._state=this);for(let l=0;l<this.config.dynamicSlots.length;l++)Yt(this,l<<1);this.computeSlot=null}field(e,t=!0){let i=this.config.address[e.id];if(i==null){if(t)throw new RangeError("Field is not present in this state");return}return Yt(this,i),ji(this,i)}update(...e){return Io(this,e,!0)}applyTransaction(e){let t=this.config,{base:i,compartments:r}=t;for(let l of e.effects)l.is(Rt.reconfigure)?(t&&(r=new Map,t.compartments.forEach((a,h)=>r.set(h,a)),t=null),r.set(l.value.compartment,l.value.extension)):l.is(Y.reconfigure)?(t=null,i=l.value):l.is(Y.appendConfig)&&(t=null,i=Et(i).concat(l.value));let s;t?s=e.startState.values.slice():(t=zi.resolve(i,r,this),s=new B(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(a,h)=>h.reconfigure(a,this),null).values);let o=e.startState.facet(Fn)?e.newSelection:e.newSelection.asSingle();new B(t,e.newDoc,o,s,(l,a)=>a.update(l,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:v.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),r=this.changes(i.changes),s=[i.range],o=Et(i.effects);for(let l=1;l<t.ranges.length;l++){let a=e(t.ranges[l]),h=this.changes(a.changes),f=h.map(r);for(let c=0;c<l;c++)s[c]=s[c].map(f);let u=r.mapDesc(h,!0);s.push(a.range.map(u)),r=r.compose(f),o=Y.mapEffects(o,f).concat(Y.mapEffects(Et(a.effects),u))}return{changes:r,selection:v.create(s,t.mainIndex),effects:o}}changes(e=[]){return e instanceof Z?e:Z.of(e,this.doc.length,this.facet(B.lineSeparator))}toText(e){return N.of(e.split(this.facet(B.lineSeparator)||Bn))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(Yt(this,t),ji(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let i in e){let r=e[i];r instanceof at&&this.config.address[r.id]!=null&&(t[i]=r.spec.toJSON(this.field(e[i]),this))}return t}static fromJSON(e,t={},i){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let r=[];if(i){for(let s in i)if(Object.prototype.hasOwnProperty.call(e,s)){let o=i[s],l=e[s];r.push(o.init(a=>o.spec.fromJSON(l,a)))}}return B.create({doc:e.doc,selection:v.fromJSON(e.selection),extensions:t.extensions?r.concat([t.extensions]):r})}static create(e={}){let t=zi.resolve(e.extensions||[],new Map),i=e.doc instanceof N?e.doc:N.of((e.doc||"").split(t.staticFacet(B.lineSeparator)||Bn)),r=e.selection?e.selection instanceof v?e.selection:v.single(e.selection.anchor,e.selection.head):v.single(0);return _o(r,i.length),t.staticFacet(Fn)||(r=r.asSingle()),new B(t,i,r,t.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(B.tabSize)}get lineBreak(){return this.facet(B.lineSeparator)||`
@@ -10,4 +10,4 @@ import{_ as x,r as xe,aq as Rn,j as La}from"./index-DpRaq7Jp.js";let In=[],bo=[]
10
10
  `&&n.lineWrapping&&(i&&(i=v.single(i.main.anchor-1,i.main.head-1)),t={from:s.from,to:s.to,insert:N.of([" "])}),t)return Br(n,t,i,o);if(i&&!Ji(i,s)){let l=!1,a="select";return n.inputState.lastSelectionTime>Date.now()-50&&(n.inputState.lastSelectionOrigin=="select"&&(l=!0),a=n.inputState.lastSelectionOrigin,a=="select.pointer"&&(i=gl(r.facet(yi).map(h=>h(n)),i))),n.dispatch({selection:i,scrollIntoView:l,userEvent:a}),!0}else return!1}function Br(n,e,t,i=-1){if(_.ios&&n.inputState.flushIOSKey(e))return!0;let r=n.state.selection.main;if(_.android&&(e.to==r.to&&(e.from==r.from||e.from==r.from-1&&n.state.sliceDoc(e.from,r.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&Mt(n.contentDOM,"Enter",13)||(e.from==r.from-1&&e.to==r.to&&e.insert.length==0||i==8&&e.insert.length<e.to-e.from&&e.to>r.head)&&Mt(n.contentDOM,"Backspace",8)||e.from==r.from&&e.to==r.to+1&&e.insert.length==0&&Mt(n.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();n.inputState.composing>=0&&n.inputState.composing++;let o,l=()=>o||(o=nf(n,e,t));return n.state.facet(nl).some(a=>a(n,e.from,e.to,s,l))||n.dispatch(l()),!0}function nf(n,e,t){let i,r=n.state,s=r.selection.main,o=-1;if(e.from==e.to&&e.from<s.from||e.from>s.to){let a=e.from<s.from?-1:1,h=a<0?s.from:s.to,f=ti(r.facet(yi).map(u=>u(n)),h,a);e.from==f&&(o=f)}if(o>-1)i={changes:e,selection:v.cursor(e.from+e.insert.length,-1)};else if(e.from>=s.from&&e.to<=s.to&&e.to-e.from>=(s.to-s.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&n.inputState.composing<0){let a=s.from<e.from?r.sliceDoc(s.from,e.from):"",h=s.to>e.to?r.sliceDoc(e.to,s.to):"";i=r.replaceSelection(n.state.toText(a+e.insert.sliceString(0,void 0,n.state.lineBreak)+h))}else{let a=r.changes(e),h=t&&t.main.to<=a.newLength?t.main:void 0;if(r.selection.ranges.length>1&&(n.inputState.composing>=0||n.inputState.compositionPendingChange)&&e.to<=s.to+10&&e.to>=s.to-10){let f=n.state.sliceDoc(e.from,e.to),u,c=t&&pl(n,t.main.head);if(c){let p=e.insert.length-(e.to-e.from);u={from:c.from,to:c.to-p}}else u=n.state.doc.lineAt(s.head);let d=s.to-e.to;i=r.changeByRange(p=>{if(p.from==s.from&&p.to==s.to)return{changes:a,range:h||p.map(a)};let g=p.to-d,y=g-f.length;if(n.state.sliceDoc(y,g)!=f||g>=u.from&&y<=u.to)return{range:p};let b=r.changes({from:y,to:g,insert:e.insert}),A=p.to-s.to;return{changes:b,range:h?v.range(Math.max(0,h.anchor+A),Math.max(0,h.head+A)):p.map(b)}})}else i={changes:a,selection:h&&r.selection.replaceRange(h)}}let l="input.type";return(n.composing||n.inputState.compositionPendingChange&&n.inputState.compositionEndedAt>Date.now()-50)&&(n.inputState.compositionPendingChange=!1,l+=".compose",n.inputState.compositionFirstChange&&(l+=".start",n.inputState.compositionFirstChange=!1)),r.update(i,{userEvent:l,scrollIntoView:!0})}function xl(n,e,t,i){let r=Math.min(n.length,e.length),s=0;for(;s<r&&n.charCodeAt(s)==e.charCodeAt(s);)s++;if(s==r&&n.length==e.length)return null;let o=n.length,l=e.length;for(;o>0&&l>0&&n.charCodeAt(o-1)==e.charCodeAt(l-1);)o--,l--;if(i=="end"){let a=Math.max(0,s-Math.min(o,l));t-=o+a-s}if(o<s&&n.length<e.length){let a=t<=s&&t>=o?s-t:0;s-=a,l=s+(l-o),o=s}else if(l<s){let a=t<=s&&t>=l?s-t:0;s-=a,o=s+(o-l),l=s}return{from:s,toA:o,toB:l}}function rf(n){let e=[];if(n.root.activeElement!=n.contentDOM)return e;let{anchorNode:t,anchorOffset:i,focusNode:r,focusOffset:s}=n.observer.selectionRange;return t&&(e.push(new ks(t,i)),(r!=t||s!=i)&&e.push(new ks(r,s))),e}function sf(n,e){if(n.length==0)return null;let t=n[0].pos,i=n.length==2?n[1].pos:t;return t>-1&&i>-1?v.single(t+e,i+e):null}function Ji(n,e){return e.head==n.main.head&&e.anchor==n.main.anchor}class of{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.touchActive=!1,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.lastIOSMomentumScroll=0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,_.safari&&e.contentDOM.addEventListener("input",()=>null),_.gecko&&kf(e.contentDOM.ownerDocument)}handleEvent(e){!gf(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,t){let i=this.handlers[e];if(i){for(let r of i.observers)r(this.view,t);for(let r of i.handlers){if(t.defaultPrevented)break;if(r(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=af(e),i=this.handlers,r=this.view.contentDOM;for(let s in t)if(s!="scroll"){let o=!t[s].handlers.length,l=i[s];l&&o!=!l.handlers.length&&(r.removeEventListener(s,this.handleEvent),l=null),l||r.addEventListener(s,this.handleEvent,{passive:o})}for(let s in i)s!="scroll"&&!t[s]&&r.removeEventListener(s,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&wl.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),_.android&&_.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;if(_.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&(bl.some(t=>t.keyCode==e.keyCode)&&!e.ctrlKey||hf.indexOf(e.key)>-1&&e.ctrlKey)){let t={ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey,shiftKey:e.shiftKey};return t.shiftKey&&_.ios&&!/^(off|none)$/.test(this.view.contentDOM.autocapitalize)&&lf(this.view.win)&&(t.shiftKey=!1),this.pendingIOSKey={key:e.key,keyCode:e.keyCode,mods:t},setTimeout(()=>this.flushIOSKey(),250),!0}return e.keyCode!=229&&this.view.observer.forceFlush(),!1}flushIOSKey(e){let t=this.pendingIOSKey;return!t||t.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,Mt(this.view.contentDOM,t.key,t.keyCode,t.mods))}ignoreDuringComposition(e){return!/^key/.test(e.type)||e.synthetic?!1:this.composing>0?!0:_.safari&&!_.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function lf(n){return n.visualViewport?n.visualViewport.height*n.visualViewport.scale/n.document.documentElement.clientHeight<.85:!1}function Ss(n,e){return(t,i)=>{try{return e.call(n,i,t)}catch(r){We(t.state,r)}}}function af(n){let e=Object.create(null);function t(i){return e[i]||(e[i]={observers:[],handlers:[]})}for(let i of n){let r=i.spec,s=r&&r.plugin.domEventHandlers,o=r&&r.plugin.domEventObservers;if(s)for(let l in s){let a=s[l];a&&t(l).handlers.push(Ss(i.value,a))}if(o)for(let l in o){let a=o[l];a&&t(l).observers.push(Ss(i.value,a))}}for(let i in Ee)t(i).handlers.push(Ee[i]);for(let i in fe)t(i).observers.push(fe[i]);return e}const bl=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],hf="dthko",wl=[16,17,18,20,91,92,224,225],Ci=6;function _i(n){return Math.max(0,n)*.7+8}function ff(n,e){return Math.max(Math.abs(n.clientX-e.clientX),Math.abs(n.clientY-e.clientY))}class uf{constructor(e,t,i,r){this.view=e,this.startEvent=t,this.style=i,this.mustSelect=r,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=Fo(e.contentDOM),this.atoms=e.state.facet(yi).map(o=>o(e));let s=e.contentDOM.ownerDocument;s.addEventListener("mousemove",this.move=this.move.bind(this)),s.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(B.allowMultipleSelections)&&cf(e,t),this.dragging=pf(e,t)&&Sl(t)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&ff(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,i=0,r=0,s=0,o=this.view.win.innerWidth,l=this.view.win.innerHeight;this.scrollParents.x&&({left:r,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:s,bottom:l}=this.scrollParents.y.getBoundingClientRect());let a=cl(this.view);e.clientX-a.left<=r+Ci?t=-_i(r-e.clientX):e.clientX+a.right>=o-Ci&&(t=_i(e.clientX-o)),e.clientY-a.top<=s+Ci?i=-_i(s-e.clientY):e.clientY+a.bottom>=l-Ci&&(i=_i(e.clientY-l)),this.setScrollSpeed(t,i)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:t}=this,i=gl(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!i.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:i,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(t=>t.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function cf(n,e){let t=n.state.facet(Zo);return t.length?t[0](e):_.mac?e.metaKey:e.ctrlKey}function df(n,e){let t=n.state.facet(el);return t.length?t[0](e):_.mac?!e.altKey:!e.ctrlKey}function pf(n,e){let{main:t}=n.state.selection;if(t.empty)return!1;let i=li(n.root);if(!i||i.rangeCount==0)return!0;let r=i.getRangeAt(0).getClientRects();for(let s=0;s<r.length;s++){let o=r[s];if(o.left<=e.clientX&&o.right>=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function gf(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,i;t!=n.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(i=J.get(t))&&i.isWidget()&&!i.isHidden&&i.widget.ignoreEvent(e))return!1;return!0}const Ee=Object.create(null),fe=Object.create(null),vl=_.ie&&_.ie_version<15||_.ios&&_.webkit_version<604;function mf(n){let e=n.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{n.focus(),t.remove(),kl(n,t.value)},50)}function ln(n,e,t){for(let i of n.facet(e))t=i(t,n);return t}function kl(n,e){e=ln(n.state,Lr,e);let{state:t}=n,i,r=1,s=t.toText(e),o=s.lines==t.selection.ranges.length;if(or!=null&&t.selection.ranges.every(a=>a.empty)&&or==s.toString()){let a=-1;i=t.changeByRange(h=>{let f=t.doc.lineAt(h.from);if(f.from==a)return{range:h};a=f.from;let u=t.toText((o?s.line(r++).text:e)+t.lineBreak);return{changes:{from:f.from,insert:u},range:v.cursor(h.from+u.length)}})}else o?i=t.changeByRange(a=>{let h=s.line(r++);return{changes:{from:a.from,to:a.to,insert:h.text},range:v.cursor(a.from+h.length)}}):i=t.replaceSelection(s);n.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}fe.scroll=n=>{let e=n.inputState;e.lastScrollTop=n.scrollDOM.scrollTop,e.lastScrollLeft=n.scrollDOM.scrollLeft,_.ios&&!e.touchActive&&(e.lastIOSMomentumScroll=Date.now())};fe.wheel=fe.mousewheel=n=>{n.inputState.lastWheelEvent=Date.now()};Ee.keydown=(n,e)=>(n.inputState.setSelectionOrigin("select"),e.keyCode==27&&n.inputState.tabFocusMode!=0&&(n.inputState.tabFocusMode=Date.now()+2e3),!1);fe.touchstart=(n,e)=>{let t=n.inputState,i=e.targetTouches[0];t.touchActive=!0,t.lastTouchTime=Date.now(),i&&(t.lastTouchX=i.clientX,t.lastTouchY=i.clientY),t.setSelectionOrigin("select.pointer")};fe.touchmove=n=>{n.inputState.setSelectionOrigin("select.pointer")};fe.touchend=(n,e)=>{n.inputState.touchActive=!1};Ee.mousedown=(n,e)=>{if(n.observer.flush(),n.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let i of n.state.facet(tl))if(t=i(n,e),t)break;if(!t&&e.button==0&&(t=xf(n,e)),t){let i=!n.hasFocus;n.inputState.startMouseSelection(new uf(n,e,t,i)),i&&n.observer.ignore(()=>{Ko(n.contentDOM);let s=n.root.activeElement;s&&!s.contains(n.contentDOM)&&s.blur()});let r=n.inputState.mouseSelection;if(r)return r.start(e),r.dragging===!1}else n.inputState.setSelectionOrigin("select.pointer");return!1};function As(n,e,t,i){if(i==1)return v.cursor(e,t);if(i==2)return qh(n.state,e,t);{let r=n.docView.lineAt(e,t),s=n.state.doc.lineAt(r?r.posAtEnd:e),o=r?r.posAtStart:s.from,l=r?r.posAtEnd:s.to;return l<n.state.doc.length&&l==s.to&&l++,v.undirectionalRange(o,l)}}const yf=_.ie&&_.ie_version<=11;let Cs=null,_s=0,Ts=0;function Sl(n){if(!yf)return n.detail;let e=Cs,t=Ts;return Cs=n,Ts=Date.now(),_s=!e||t>Date.now()-400&&Math.abs(e.clientX-n.clientX)<2&&Math.abs(e.clientY-n.clientY)<2?(_s+1)%3:1}function xf(n,e){let t=n.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),i=Sl(e),r=n.state.selection;return{update(s){s.docChanged&&(t.pos=s.changes.mapPos(t.pos),r=r.map(s.changes))},get(s,o,l){let a=n.posAndSideAtCoords({x:s.clientX,y:s.clientY},!1),h,f=As(n,a.pos,a.assoc,i);if(t.pos!=a.pos&&!o){let u=As(n,t.pos,t.assoc,i),c=Math.min(u.from,f.from),d=Math.max(u.to,f.to);f=c<f.from?v.range(c,d,f.assoc):v.range(d,c,f.assoc)}return o?r.replaceRange(r.main.extend(f.from,f.to,f.assoc)):l&&i==1&&r.ranges.length>1&&(h=bf(r,a.pos))?h:l?r.addRange(f):v.create([f])}}}function bf(n,e){for(let t=0;t<n.ranges.length;t++){let{from:i,to:r}=n.ranges[t];if(i<=e&&r>=e)return v.create(n.ranges.slice(0,t).concat(n.ranges.slice(t+1)),n.mainIndex==t?0:n.mainIndex-(n.mainIndex>t?1:0))}return null}Ee.dragstart=(n,e)=>{let{selection:{main:t}}=n.state;if(e.target.draggable){let r=n.docView.tile.nearest(e.target);if(r&&r.isWidget()){let s=r.posAtStart,o=s+r.length;(s>=t.to||o<=t.from)&&(t=v.undirectionalRange(s,o))}}let{inputState:i}=n;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",ln(n.state,Pr,n.state.sliceDoc(t.from,t.to))),e.dataTransfer.effectAllowed="copyMove"),!1};Ee.dragend=n=>(n.inputState.draggedContent=null,!1);function Es(n,e,t,i){if(t=ln(n.state,Lr,t),!t)return;let r=n.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:s}=n.inputState,o=i&&s&&df(n,e)?{from:s.from,to:s.to}:null,l={from:r,insert:t},a=n.state.changes(o?[o,l]:l);n.focus(),n.dispatch({changes:a,selection:{anchor:a.mapPos(r,-1),head:a.mapPos(r,1)},userEvent:o?"move.drop":"input.drop"}),n.inputState.draggedContent=null}Ee.drop=(n,e)=>{if(!e.dataTransfer)return!1;if(n.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let i=Array(t.length),r=0,s=()=>{++r==t.length&&Es(n,e,i.filter(o=>o!=null).join(n.state.lineBreak),!1)};for(let o=0;o<t.length;o++){let l=new FileReader;l.onerror=s,l.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(l.result)||(i[o]=l.result),s()},l.readAsText(t[o])}return!0}else{let i=e.dataTransfer.getData("Text");if(i)return Es(n,e,i,!0),!0}return!1};Ee.paste=(n,e)=>{if(n.state.readOnly)return!0;n.observer.flush();let t=vl?null:e.clipboardData;return t?(kl(n,t.getData("text/plain")||t.getData("text/uri-list")),!0):(mf(n),!1)};function wf(n,e){let t=n.dom.parentNode;if(!t)return;let i=t.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=e,i.focus(),i.selectionEnd=e.length,i.selectionStart=0,setTimeout(()=>{i.remove(),n.focus()},50)}function vf(n){let e=[],t=[],i=!1;for(let r of n.selection.ranges)r.empty||(e.push(n.sliceDoc(r.from,r.to)),t.push(r));if(!e.length){let r=-1;for(let{from:s}of n.selection.ranges){let o=n.doc.lineAt(s);o.number>r&&(e.push(o.text),t.push({from:o.from,to:Math.min(n.doc.length,o.to+1)})),r=o.number}i=!0}return{text:ln(n,Pr,e.join(n.lineBreak)),ranges:t,linewise:i}}let or=null;Ee.copy=Ee.cut=(n,e)=>{if(!Qt(n.contentDOM,n.observer.selectionRange))return!1;let{text:t,ranges:i,linewise:r}=vf(n.state);if(!t&&!r)return!1;or=r?t:null,e.type=="cut"&&!n.state.readOnly&&n.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let s=vl?null:e.clipboardData;return s?(s.clearData(),s.setData("text/plain",t),!0):(wf(n,t),!1)};const Al=ht.define();function Cl(n,e){let t=[];for(let i of n.facet(rl)){let r=i(n,e);r&&t.push(r)}return t.length?n.update({effects:t,annotations:Al.of(!0)}):null}function _l(n){setTimeout(()=>{let e=n.hasFocus;if(e!=n.inputState.notifiedFocused){let t=Cl(n.state,e);t?n.dispatch(t):n.update([])}},10)}fe.focus=n=>{n.inputState.lastFocusTime=Date.now(),!n.scrollDOM.scrollTop&&(n.inputState.lastScrollTop||n.inputState.lastScrollLeft)&&(n.scrollDOM.scrollTop=n.inputState.lastScrollTop,n.scrollDOM.scrollLeft=n.inputState.lastScrollLeft),_l(n)};fe.blur=n=>{n.observer.clearSelectionRange(),_l(n)};fe.compositionstart=fe.compositionupdate=n=>{n.observer.editContext||(n.inputState.compositionFirstChange==null&&(n.inputState.compositionFirstChange=!0),n.inputState.composing<0&&(n.inputState.composing=0))};fe.compositionend=n=>{n.observer.editContext||(n.inputState.composing=-1,n.inputState.compositionEndedAt=Date.now(),n.inputState.compositionPendingKey=!0,n.inputState.compositionPendingChange=n.observer.pendingRecords().length>0,n.inputState.compositionFirstChange=null,_.chrome&&_.android?n.observer.flushSoon():n.inputState.compositionPendingChange?Promise.resolve().then(()=>n.observer.flush()):setTimeout(()=>{n.inputState.composing<0&&n.docView.hasComposition&&n.update([])},50))};fe.contextmenu=n=>{n.inputState.lastContextMenu=Date.now()};Ee.beforeinput=(n,e)=>{var t,i;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(n.inputState.insertingText=e.data,n.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&n.observer.editContext){let s=(t=e.dataTransfer)===null||t===void 0?void 0:t.getData("text/plain"),o=e.getTargetRanges();if(s&&o.length){let l=o[0],a=n.posAtDOM(l.startContainer,l.startOffset),h=n.posAtDOM(l.endContainer,l.endOffset);return Br(n,{from:a,to:h,insert:n.state.toText(s)},null),!0}}let r;if(_.chrome&&_.android&&(r=bl.find(s=>s.inputType==e.inputType))&&(n.observer.delayAndroidKey(r.key,r.keyCode),r.key=="Backspace"||r.key=="Delete")){let s=((i=window.visualViewport)===null||i===void 0?void 0:i.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>s+10&&n.hasFocus&&(n.contentDOM.blur(),n.focus())},100)}return _.ios&&e.inputType=="deleteContentForward"&&n.observer.flushSoon(),_.safari&&e.inputType=="insertText"&&n.inputState.composing>=0&&setTimeout(()=>fe.compositionend(n,e),20),!1};const Ds=new Set;function kf(n){Ds.has(n)||(Ds.add(n),n.addEventListener("copy",()=>{}),n.addEventListener("cut",()=>{}))}const Ms=["pre-wrap","normal","pre-line","break-spaces"];let Vt=!1;function Os(){Vt=!1}class Sf{constructor(e){this.lineWrapping=e,this.doc=N.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let i=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((t-e-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return Ms.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let i=0;i<e.length;i++){let r=e[i];r<0?i++:this.heightSamples[Math.floor(r*10)]||(t=!0,this.heightSamples[Math.floor(r*10)]=!0)}return t}refresh(e,t,i,r,s,o){let l=Ms.indexOf(e)>-1,a=Math.abs(t-this.lineHeight)>.3||this.lineWrapping!=l;if(this.lineWrapping=l,this.lineHeight=t,this.charWidth=i,this.textHeight=r,this.lineLength=s,a){this.heightSamples={};for(let h=0;h<o.length;h++){let f=o[h];f<0?h++:this.heightSamples[Math.floor(f*10)]=!0}}return a}}class Af{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class Ce{constructor(e,t,i,r,s){this.from=e,this.length=t,this.top=i,this.height=r,this._content=s}get type(){return typeof this._content=="number"?pe.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof bt?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let t=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new Ce(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var q=(function(n){return n[n.ByPos=0]="ByPos",n[n.ByHeight=1]="ByHeight",n[n.ByPosNoHeight=2]="ByPosNoHeight",n})(q||(q={}));const Wi=.001;class he{constructor(e,t,i=2){this.length=e,this.height=t,this.flags=i}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>Wi&&(Vt=!0),this.height=e)}replace(e,t,i){return he.of(i)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,i,r){let s=this,o=i.doc;for(let l=r.length-1;l>=0;l--){let{fromA:a,toA:h,fromB:f,toB:u}=r[l],c=s.lineAt(a,q.ByPosNoHeight,i.setDoc(t),0,0),d=c.to>=h?c:s.lineAt(h,q.ByPosNoHeight,i,0,0);for(u+=d.to-h,h=d.to;l>0&&c.from<=r[l-1].toA;)a=r[l-1].fromA,f=r[l-1].fromB,l--,a<c.from&&(c=s.lineAt(a,q.ByPosNoHeight,i,0,0));f+=c.from-a,a=c.from;let p=Vr.build(i.setDoc(o),e,f,u);s=Xi(s,s.replace(a,h,p))}return s.updateHeight(i,0)}static empty(){return new ge(0,0,0)}static of(e){if(e.length==1)return e[0];let t=0,i=e.length,r=0,s=0;for(;;)if(t==i)if(r>s*2){let l=e[t-1];l.break?e.splice(--t,1,l.left,null,l.right):e.splice(--t,1,l.left,l.right),i+=1+l.break,r-=l.size}else if(s>r*2){let l=e[i];l.break?e.splice(i,1,l.left,null,l.right):e.splice(i,1,l.left,l.right),i+=2+l.break,s-=l.size}else break;else if(r<s){let l=e[t++];l&&(r+=l.size)}else{let l=e[--i];l&&(s+=l.size)}let o=0;return e[t-1]==null?(o=1,t--):e[t]==null&&(o=1,i++),new _f(he.of(e.slice(0,t)),o,he.of(e.slice(i)))}}function Xi(n,e){return n==e?n:(n.constructor!=e.constructor&&(Vt=!0),e)}he.prototype.size=1;const Cf=z.replace({});class Tl extends he{constructor(e,t,i){super(e,t),this.deco=i,this.spaceAbove=0}mainBlock(e,t){return new Ce(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,t,i,r){return this.spaceAbove&&e<i+this.spaceAbove?new Ce(r,0,i,this.spaceAbove,Cf):this.mainBlock(i,r)}lineAt(e,t,i,r,s){let o=this.mainBlock(r,s);return this.spaceAbove?this.blockAt(0,i,r,s).join(o):o}forEachLine(e,t,i,r,s,o){e<=s+this.length&&t>=s&&o(this.lineAt(0,q.ByPos,i,r,s))}setMeasuredHeight(e){let t=e.heights[e.index++];t<0?(this.spaceAbove=-t,t=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(t)}updateHeight(e,t=0,i=!1,r){return r&&r.from<=t&&r.more&&this.setMeasuredHeight(r),this.outdated=!1,this}toString(){return`block(${this.length})`}}class ge extends Tl{constructor(e,t,i){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=i}mainBlock(e,t){return new Ce(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,t,i){let r=i[0];return i.length==1&&(r instanceof ge||r instanceof ie&&r.flags&4)&&Math.abs(this.length-r.length)<10?(r instanceof ie?r=new ge(r.length,this.height,this.spaceAbove):r.height=this.height,this.outdated||(r.outdated=!1),r):he.of(i)}updateHeight(e,t=0,i=!1,r){return r&&r.from<=t&&r.more?this.setMeasuredHeight(r):(i||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class ie extends he{constructor(e){super(e,0)}heightMetrics(e,t){let i=e.doc.lineAt(t).number,r=e.doc.lineAt(t+this.length).number,s=r-i+1,o,l=0;if(e.lineWrapping){let a=Math.min(this.height,e.lineHeight*s);o=a/s,this.length>s+1&&(l=(this.height-a)/(this.length-s-1))}else o=this.height/s;return{firstLine:i,lastLine:r,perLine:o,perChar:l}}blockAt(e,t,i,r){let{firstLine:s,lastLine:o,perLine:l,perChar:a}=this.heightMetrics(t,r);if(t.lineWrapping){let h=r+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-i)/this.height))*this.length)),f=t.doc.lineAt(h),u=l+f.length*a,c=Math.max(i,e-u/2);return new Ce(f.from,f.length,c,u,0)}else{let h=Math.max(0,Math.min(o-s,Math.floor((e-i)/l))),{from:f,length:u}=t.doc.line(s+h);return new Ce(f,u,i+l*h,l,0)}}lineAt(e,t,i,r,s){if(t==q.ByHeight)return this.blockAt(e,i,r,s);if(t==q.ByPosNoHeight){let{from:d,to:p}=i.doc.lineAt(e);return new Ce(d,p-d,0,0,0)}let{firstLine:o,perLine:l,perChar:a}=this.heightMetrics(i,s),h=i.doc.lineAt(e),f=l+h.length*a,u=h.number-o,c=r+l*u+a*(h.from-s-u);return new Ce(h.from,h.length,Math.max(r,Math.min(c,r+this.height-f)),f,0)}forEachLine(e,t,i,r,s,o){e=Math.max(e,s),t=Math.min(t,s+this.length);let{firstLine:l,perLine:a,perChar:h}=this.heightMetrics(i,s);for(let f=e,u=r;f<=t;){let c=i.doc.lineAt(f);if(f==e){let p=c.number-l;u+=a*p+h*(e-s-p)}let d=a+h*c.length;o(new Ce(c.from,c.length,u,d,0)),u+=d,f=c.to+1}}replace(e,t,i){let r=this.length-t;if(r>0){let s=i[i.length-1];s instanceof ie?i[i.length-1]=new ie(s.length+r):i.push(null,new ie(r-1))}if(e>0){let s=i[0];s instanceof ie?i[0]=new ie(e+s.length):i.unshift(new ie(e-1),null)}return he.of(i)}decomposeLeft(e,t){t.push(new ie(e-1),null)}decomposeRight(e,t){t.push(null,new ie(this.length-e-1))}updateHeight(e,t=0,i=!1,r){let s=t+this.length;if(r&&r.from<=t+this.length&&r.more){let o=[],l=Math.max(t,r.from),a=-1;for(r.from>t&&o.push(new ie(r.from-t-1).updateHeight(e,t));l<=s&&r.more;){let f=e.doc.lineAt(l).length;o.length&&o.push(null);let u=r.heights[r.index++],c=0;u<0&&(c=-u,u=r.heights[r.index++]),a==-1?a=u:Math.abs(u-a)>=Wi&&(a=-2);let d=new ge(f,u,c);d.outdated=!1,o.push(d),l+=f+1}l<=s&&o.push(null,new ie(s-l).updateHeight(e,l));let h=he.of(o);return(a<0||Math.abs(h.height-this.height)>=Wi||Math.abs(a-this.heightMetrics(e,t).perLine)>=Wi)&&(Vt=!0),Xi(this,h)}else(i||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class _f extends he{constructor(e,t,i){super(e.length+t+i.length,e.height+i.height,t|(e.outdated||i.outdated?2:0)),this.left=e,this.right=i,this.size=e.size+i.size}get break(){return this.flags&1}blockAt(e,t,i,r){let s=i+this.left.height;return e<s?this.left.blockAt(e,t,i,r):this.right.blockAt(e,t,s,r+this.left.length+this.break)}lineAt(e,t,i,r,s){let o=r+this.left.height,l=s+this.left.length+this.break,a=t==q.ByHeight?e<o:e<l,h=a?this.left.lineAt(e,t,i,r,s):this.right.lineAt(e,t,i,o,l);if(this.break||(a?h.to<l:h.from>l))return h;let f=t==q.ByPosNoHeight?q.ByPosNoHeight:q.ByPos;return a?h.join(this.right.lineAt(l,f,i,o,l)):this.left.lineAt(l,f,i,r,s).join(h)}forEachLine(e,t,i,r,s,o){let l=r+this.left.height,a=s+this.left.length+this.break;if(this.break)e<a&&this.left.forEachLine(e,t,i,r,s,o),t>=a&&this.right.forEachLine(e,t,i,l,a,o);else{let h=this.lineAt(a,q.ByPos,i,r,s);e<h.from&&this.left.forEachLine(e,h.from-1,i,r,s,o),h.to>=e&&h.from<=t&&o(h),t>h.to&&this.right.forEachLine(h.to+1,t,i,l,a,o)}}replace(e,t,i){let r=this.left.length+this.break;if(t<r)return this.balanced(this.left.replace(e,t,i),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-r,t-r,i));let s=[];e>0&&this.decomposeLeft(e,s);let o=s.length;for(let l of i)s.push(l);if(e>0&&Ls(s,o-1),t<this.length){let l=s.length;this.decomposeRight(t,s),Ls(s,l)}return he.of(s)}decomposeLeft(e,t){let i=this.left.length;if(e<=i)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(i++,e>=i&&t.push(null)),e>i&&this.right.decomposeLeft(e-i,t)}decomposeRight(e,t){let i=this.left.length,r=i+this.break;if(e>=r)return this.right.decomposeRight(e-r,t);e<i&&this.left.decomposeRight(e,t),this.break&&e<r&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?he.of(this.break?[e,null,t]:[e,t]):(this.left=Xi(this.left,e),this.right=Xi(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,i=!1,r){let{left:s,right:o}=this,l=t+s.length+this.break,a=null;return r&&r.from<=t+s.length&&r.more?a=s=s.updateHeight(e,t,i,r):s.updateHeight(e,t,i),r&&r.from<=l+o.length&&r.more?a=o=o.updateHeight(e,l,i,r):o.updateHeight(e,l,i),a?this.balanced(s,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Ls(n,e){let t,i;n[e]==null&&(t=n[e-1])instanceof ie&&(i=n[e+1])instanceof ie&&n.splice(e-1,3,new ie(t.length+1+i.length))}const Tf=5;class Vr{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let i=Math.min(t,this.lineEnd),r=this.nodes[this.nodes.length-1];r instanceof ge?r.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new ge(i-this.pos,-1,0)),this.writtenTo=i,t>i&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,i){if(e<t||i.heightRelevant){let r=i.widget?i.widget.estimatedHeight:0,s=i.widget?i.widget.lineBreaks:0;r<0&&(r=this.oracle.lineHeight);let o=t-e;i.block?this.addBlock(new Tl(o,r,i)):(o||s||r>=Tf)&&this.addLineDeco(r,s,o)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new ge(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,t){let i=new ie(t-e);return this.oracle.doc.lineAt(e).to==t&&(i.flags|=4),i}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof ge)return e;let t=new ge(0,-1,0);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,i){let r=this.ensureLine();r.length+=i,r.collapsed+=i,r.widgetHeight=Math.max(r.widgetHeight,e),r.breaks+=t,this.writtenTo=this.pos=this.pos+i}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof ge)&&!this.isCovered?this.nodes.push(new ge(0,-1,0)):(this.writtenTo<this.pos||t==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let i=e;for(let r of this.nodes)r instanceof ge&&r.updateHeight(this.oracle,i),i+=r?r.length:1;return this.nodes}static build(e,t,i,r){let s=new Vr(i,e);return V.spans(t,i,r,s,0),s.finish(i)}}function Ef(n,e,t){let i=new Df;return V.compare(n,e,t,i,0),i.changes}class Df{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,i,r){(e<t||i&&i.heightRelevant||r&&r.heightRelevant)&&Dt(e,t,this.changes,5)}}function Mf(n,e){let t=n.getBoundingClientRect(),i=n.ownerDocument,r=i.defaultView||window,s=Math.max(0,t.left),o=Math.min(r.innerWidth,t.right),l=Math.max(0,t.top),a=Math.min(r.innerHeight,t.bottom);for(let h=n.parentNode;h&&h!=i.body;)if(h.nodeType==1){let f=h,u=window.getComputedStyle(f);if((f.scrollHeight>f.clientHeight||f.scrollWidth>f.clientWidth)&&u.overflow!="visible"){let c=f.getBoundingClientRect();s=Math.max(s,c.left),o=Math.min(o,c.right),l=Math.max(l,c.top),a=Math.min(h==n.parentNode?r.innerHeight:a,c.bottom)}h=u.position=="absolute"||u.position=="fixed"?f.offsetParent:f.parentNode}else if(h.nodeType==11)h=h.host;else break;return{left:s-t.left,right:Math.max(s,o)-t.left,top:l-(t.top+e),bottom:Math.max(l,a)-(t.top+e)}}function Of(n){let e=n.getBoundingClientRect(),t=n.ownerDocument.defaultView||window;return e.left<t.innerWidth&&e.right>0&&e.top<t.innerHeight&&e.bottom>0}function Lf(n,e){let t=n.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class Sn{constructor(e,t,i,r){this.from=e,this.to=t,this.size=i,this.displaySize=r}static same(e,t){if(e.length!=t.length)return!1;for(let i=0;i<e.length;i++){let r=e[i],s=t[i];if(r.from!=s.from||r.to!=s.to||r.size!=s.size)return!1}return!0}draw(e,t){return z.replace({widget:new Pf(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class Pf extends pi{constructor(e,t){super(),this.size=e,this.vertical=t}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class Ps{constructor(e,t){this.view=e,this.state=t,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scaleX=1,this.scaleY=1,this.scrollOffset=0,this.scrolledToBottom=!1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=Rs,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Q.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let i=t.facet(Rr).some(r=>typeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new Sf(i),this.stateDeco=Is(t),this.heightMap=he.empty().applyChanges(this.stateDeco,N.empty,this.heightOracle.setDoc(t.doc),[new we(0,0,0,t.doc.length)]);for(let r=0;r<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());r++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=z.set(this.lineGaps.map(r=>r.draw(this,!1))),this.scrollParent=e.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let i=0;i<=1;i++){let r=i?t.head:t.anchor;if(!e.some(({from:s,to:o})=>r>=s&&r<=o)){let{from:s,to:o}=this.lineBlockAt(r);e.push(new Ti(s,o))}}return this.viewports=e.sort((i,r)=>i.from-r.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?Rs:new Nr(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(Jt(e,this.scaler))})}update(e,t=null){this.state=e.state;let i=this.stateDeco;this.stateDeco=Is(this.state);let r=e.changedRanges,s=we.extendWithRanges(r,Ef(i,this.stateDeco,e?e.changes:Z.empty(this.state.doc.length))),o=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);Os(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),s),(this.heightMap.height!=o||Vt)&&(e.flags|=2),l?(this.scrollAnchorPos=e.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let a=s.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<a.from||t.range.head>a.to)||!this.viewportIsAppropriate(a))&&(a=this.getViewport(0,t));let h=a.from!=this.viewport.from||a.to!=this.viewport.to;this.viewport=a,e.flags|=this.updateForViewport(),(h||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(kh)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:e}=this,t=e.contentDOM,i=window.getComputedStyle(t),r=this.heightOracle,s=i.whiteSpace;this.defaultTextDirection=i.direction=="rtl"?Q.RTL:Q.LTR;let o=this.heightOracle.mustRefreshForWrapping(s)||this.mustMeasureContent==="refresh",l=t.getBoundingClientRect(),a=o||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let h=0,f=0;if(l.width&&l.height){let{scaleX:E,scaleY:M}=Ho(t,l);(E>.005&&Math.abs(this.scaleX-E)>.005||M>.005&&Math.abs(this.scaleY-M)>.005)&&(this.scaleX=E,this.scaleY=M,h|=16,o=a=!0)}let u=(parseInt(i.paddingTop)||0)*this.scaleY,c=(parseInt(i.paddingBottom)||0)*this.scaleY;(this.paddingTop!=u||this.paddingBottom!=c)&&(this.paddingTop=u,this.paddingBottom=c,h|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(r.lineWrapping&&(a=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=16);let d=Fo(this.view.contentDOM,!1).y;d!=this.scrollParent&&(this.scrollParent=d,this.scrollAnchorHeight=-1,this.scrollOffset=0);let p=this.getScrollOffset();this.scrollOffset!=p&&(this.scrollAnchorHeight=-1,this.scrollOffset=p),this.scrolledToBottom=qo(this.scrollParent||e.win);let g=(this.printing?Lf:Mf)(t,this.paddingTop),y=g.top-this.pixelViewport.top,b=g.bottom-this.pixelViewport.bottom;this.pixelViewport=g;let A=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(A!=this.inView&&(this.inView=A,A&&(a=!0)),!this.inView&&!this.scrollTarget&&!Of(e.dom))return 0;let S=l.width;if((this.contentDOMWidth!=S||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=e.scrollDOM.clientHeight,h|=16),a){let E=e.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights(E)&&(o=!0),o||r.lineWrapping&&Math.abs(S-this.contentDOMWidth)>r.charWidth){let{lineHeight:M,charWidth:T,textHeight:W}=e.docView.measureTextSize();o=M>0&&r.refresh(s,M,T,W,Math.max(5,S/T),E),o&&(e.docView.minWidth=0,h|=16)}y>0&&b>0?f=Math.max(y,b):y<0&&b<0&&(f=Math.min(y,b)),Os();for(let M of this.viewports){let T=M.from==this.viewport.from?E:e.docView.measureVisibleLineHeights(M);this.heightMap=(o?he.empty().applyChanges(this.stateDeco,N.empty,this.heightOracle,[new we(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(r,0,o,new Af(M.from,T))}Vt&&(h|=2)}let R=!this.viewportIsAppropriate(this.viewport,f)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return R&&(h&2&&(h|=this.updateScaler()),this.viewport=this.getViewport(f,this.scrollTarget),h|=this.updateForViewport()),(h&2||R)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let i=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),r=this.heightMap,s=this.heightOracle,{visibleTop:o,visibleBottom:l}=this,a=new Ti(r.lineAt(o-i*1e3,q.ByHeight,s,0,0).from,r.lineAt(l+(1-i)*1e3,q.ByHeight,s,0,0).to);if(t){let{head:h}=t.range;if(h<a.from||h>a.to){let f=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),u=r.lineAt(h,q.ByPos,s,0,0),c;t.y=="center"?c=(u.top+u.bottom)/2-f/2:t.y=="start"||t.y=="nearest"&&h<a.from?c=u.top:c=u.bottom-f,a=new Ti(r.lineAt(c-1e3/2,q.ByHeight,s,0,0).from,r.lineAt(c+f+1e3/2,q.ByHeight,s,0,0).to)}}return a}mapViewport(e,t){let i=t.mapPos(e.from,-1),r=t.mapPos(e.to,1);return new Ti(this.heightMap.lineAt(i,q.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(r,q.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},i=0){if(!this.inView)return!0;let{top:r}=this.heightMap.lineAt(e,q.ByPos,this.heightOracle,0,0),{bottom:s}=this.heightMap.lineAt(t,q.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:l}=this;return(e==0||r<=o-Math.max(10,Math.min(-i,250)))&&(t==this.state.doc.length||s>=l+Math.max(10,Math.min(i,250)))&&r>o-2*1e3&&s<l+2*1e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let i=[];for(let r of e)t.touchesRange(r.from,r.to)||i.push(new Sn(t.mapPos(r.from),t.mapPos(r.to),r.size,r.displaySize));return i}ensureLineGaps(e,t){let i=this.heightOracle.lineWrapping,r=i?1e4:2e3,s=r>>1,o=r<<1;if(this.defaultTextDirection!=Q.LTR&&!i)return[];let l=[],a=(f,u,c,d)=>{if(u-f<s)return;let p=this.state.selection.main,g=[p.from];p.empty||g.push(p.to);for(let b of g)if(b>f&&b<u){a(f,b-10,c,d),a(b+10,u,c,d);return}let y=If(e,b=>b.from>=c.from&&b.to<=c.to&&Math.abs(b.from-f)<s&&Math.abs(b.to-u)<s&&!g.some(A=>b.from<A&&b.to>A));if(!y){if(u<c.to&&t&&i&&t.visibleRanges.some(S=>S.from<=u&&S.to>=u)){let S=t.moveToLineBoundary(v.cursor(u),!1,!0).head;S>f&&(u=S)}let b=this.gapSize(c,f,u,d),A=i||b<2e6?b:2e6;y=new Sn(f,u,b,A)}l.push(y)},h=f=>{if(f.length<o||f.type!=pe.Text)return;let u=Rf(f.from,f.to,this.stateDeco);if(u.total<o)return;let c=this.scrollTarget?this.scrollTarget.range.head:null,d,p;if(i){let g=r/this.heightOracle.lineLength*this.heightOracle.lineHeight,y,b;if(c!=null){let A=Di(u,c),S=((this.visibleBottom-this.visibleTop)/2+g)/f.height;y=A-S,b=A+S}else y=(this.visibleTop-f.top-g)/f.height,b=(this.visibleBottom-f.top+g)/f.height;d=Ei(u,y),p=Ei(u,b)}else{let g=u.total*this.heightOracle.charWidth,y=r*this.heightOracle.charWidth,b=0;if(g>2e6)for(let M of e)M.from>=f.from&&M.from<f.to&&M.size!=M.displaySize&&M.from*this.heightOracle.charWidth+b<this.pixelViewport.left&&(b=M.size-M.displaySize);let A=this.pixelViewport.left+b,S=this.pixelViewport.right+b,R,E;if(c!=null){let M=Di(u,c),T=((S-A)/2+y)/g;R=M-T,E=M+T}else R=(A-y)/g,E=(S+y)/g;d=Ei(u,R),p=Ei(u,E)}d>f.from&&a(f.from,d,f,u),p<f.to&&a(p,f.to,f,u)};for(let f of this.viewportLines)Array.isArray(f.type)?f.type.forEach(h):h(f);return l}gapSize(e,t,i,r){let s=Di(r,i)-Di(r,t);return this.heightOracle.lineWrapping?e.height*s:r.total*this.heightOracle.charWidth*s}updateLineGaps(e){Sn.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=z.set(e.map(t=>t.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let i=[];V.spans(t,this.viewport.from,this.viewport.to,{span(s,o){i.push({from:s,to:o})},point(){}},20);let r=0;if(i.length!=this.visibleRanges.length)r=12;else for(let s=0;s<i.length&&!(r&8);s++){let o=this.visibleRanges[s],l=i[s];(o.from!=l.from||o.to!=l.to)&&(r|=4,e&&e.mapPos(o.from,-1)==l.from&&e.mapPos(o.to,1)==l.to||(r|=8))}return this.visibleRanges=i,r}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||Jt(this.heightMap.lineAt(e,q.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||Jt(this.heightMap.lineAt(this.scaler.fromDOM(e),q.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return(this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top)*this.scaleY}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return Jt(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class Ti{constructor(e,t){this.from=e,this.to=t}}function Rf(n,e,t){let i=[],r=n,s=0;return V.spans(t,n,e,{span(){},point(o,l){o>r&&(i.push({from:r,to:o}),s+=o-r),r=l}},20),r<e&&(i.push({from:r,to:e}),s+=e-r),{total:s,ranges:i}}function Ei({total:n,ranges:e},t){if(t<=0)return e[0].from;if(t>=1)return e[e.length-1].to;let i=Math.floor(n*t);for(let r=0;;r++){let{from:s,to:o}=e[r],l=o-s;if(i<=l)return s+i;i-=l}}function Di(n,e){let t=0;for(let{from:i,to:r}of n.ranges){if(e<=r){t+=e-i;break}t+=r-i}return t/n.total}function If(n,e){for(let t of n)if(e(t))return t}const Rs={toDOM(n){return n},fromDOM(n){return n},scale:1,eq(n){return n==this}};function Is(n){let e=n.facet(rn).filter(i=>typeof i!="function"),t=n.facet(Ir).filter(i=>typeof i!="function");return t.length&&e.push(V.join(t)),e}class Nr{constructor(e,t,i){let r=0,s=0,o=0;this.viewports=i.map(({from:l,to:a})=>{let h=t.lineAt(l,q.ByPos,e,0,0).top,f=t.lineAt(a,q.ByPos,e,0,0).bottom;return r+=f-h,{from:l,to:a,top:h,bottom:f,domTop:0,domBottom:0}}),this.scale=(7e6-r)/(t.height-r);for(let l of this.viewports)l.domTop=o+(l.top-s)*this.scale,o=l.domBottom=l.domTop+(l.bottom-l.top),s=l.bottom}toDOM(e){for(let t=0,i=0,r=0;;t++){let s=t<this.viewports.length?this.viewports[t]:null;if(!s||e<s.top)return r+(e-i)*this.scale;if(e<=s.bottom)return s.domTop+(e-s.top);i=s.bottom,r=s.domBottom}}fromDOM(e){for(let t=0,i=0,r=0;;t++){let s=t<this.viewports.length?this.viewports[t]:null;if(!s||e<s.domTop)return i+(e-r)/this.scale;if(e<=s.domBottom)return s.top+(e-s.domTop);i=s.bottom,r=s.domBottom}}eq(e){return e instanceof Nr?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((t,i)=>t.from==e.viewports[i].from&&t.to==e.viewports[i].to):!1}}function Jt(n,e){if(e.scale==1)return n;let t=e.toDOM(n.top),i=e.toDOM(n.bottom);return new Ce(n.from,n.length,t,i-t,Array.isArray(n._content)?n._content.map(r=>Jt(r,e)):n._content)}const Mi=D.define({combine:n=>n.join(" ")}),lr=D.define({combine:n=>n.indexOf(!0)>-1}),ar=rt.newName(),El=rt.newName(),Dl=rt.newName(),Ml={"&light":"."+El,"&dark":"."+Dl};function hr(n,e,t){return new rt(e,{finish(i){return/&/.test(i)?i.replace(/&\w*/,r=>{if(r=="&")return n;if(!t||!t[r])throw new RangeError(`Unsupported selector: ${r}`);return t[r]}):n+" "+i}})}const Bf=hr("."+ar,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{userSelect:"none",position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-selectionHandle":{backgroundColor:"currentColor",width:"1.5px"},".cm-selectionHandle-start::before, .cm-selectionHandle-end::before":{content:'""',backgroundColor:"inherit",borderRadius:"50%",width:"8px",height:"8px",position:"absolute",left:"-3.25px"},".cm-selectionHandle-start::before":{top:"-8px"},".cm-selectionHandle-end::before":{bottom:"-8px"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},".cm-panels-top":{top:"0"},".cm-panels-bottom":{bottom:"0"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},Ml),Vf={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},An=_.ie&&_.ie_version<=11;class Nf{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new fh,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let i of t)this.queue.push(i);(_.ie&&_.ie_version<=11||_.ios&&e.composing)&&t.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&_.android&&e.constructor.EDIT_CONTEXT!==!1&&!(_.chrome&&_.chrome_version<126)&&(this.editContext=new Hf(e),e.state.facet(Ue)&&(e.contentDOM.editContext=this.editContext.editContext)),An&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var t;((t=this.view.docView)===null||t===void 0?void 0:t.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(t=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,i)=>t!=e[i]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:i}=this,r=this.selectionRange;if(i.state.facet(Ue)?i.root.activeElement!=this.dom:!Qt(this.dom,r))return;let s=r.anchorNode&&i.docView.tile.nearest(r.anchorNode);if(s&&s.isWidget()&&s.widget.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(_.ie&&_.ie_version<=11||_.android&&_.chrome)&&!i.state.selection.main.empty&&r.focusNode&&ei(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=li(e.root);if(!t)return!1;let i=_.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&Wf(this.view,t)||t;if(!i||this.selectionRange.eq(i))return!1;let r=Qt(this.dom,i);return r&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&ch(this.dom,i)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(i),r&&(this.selectionChanged=!0),!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let i=this.dom;i;)if(i.nodeType==1)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==i?e++:t||(t=this.scrollTargets.slice(0,e)),t&&t.push(i),i=i.assignedSlot||i.parentNode;else if(i.nodeType==11)i=i.host;else break;if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let i of this.scrollTargets)i.removeEventListener("scroll",this.onScroll);for(let i of this.scrollTargets=t)i.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,Vf),An&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),An&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var i;if(!this.delayedAndroidKey){let r=()=>{let s=this.delayedAndroidKey;s&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=s.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&s.force&&Mt(this.dom,s.key,s.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(r)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!(!((i=this.delayedAndroidKey)===null||i===void 0)&&i.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,i=-1,r=!1;for(let s of e){let o=this.readMutation(s);o&&(o.typeOver&&(r=!0),t==-1?{from:t,to:i}=o:(t=Math.min(o.from,t),i=Math.max(o.to,i)))}return{from:t,to:i,typeOver:r}}readChange(){let{from:e,to:t,typeOver:i}=this.processRecords(),r=this.selectionChanged&&Qt(this.dom,this.selectionRange);if(e<0&&!r)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let s=new tf(this.view,e,t,i);return this.view.docView.domChanged={newSel:s.newSel?s.newSel.main:null},s}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let i=this.view.state,r=yl(this.view,t);return this.view.state==i&&(t.domChanged||t.newSel&&!Ji(this.view.state.selection,t.newSel.main))&&this.view.update([]),r}readMutation(e){let t=this.view.docView.tile.nearest(e.target);if(!t||t.isWidget())return null;if(t.markDirty(e.type=="attributes"),e.type=="childList"){let i=Bs(t,e.previousSibling||e.target.previousSibling,-1),r=Bs(t,e.nextSibling||e.target.nextSibling,1);return{from:i?t.posAfter(i):t.posAtStart,to:r?t.posBefore(r):t.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(Ue)!=e.state.facet(Ue)&&(e.view.contentDOM.editContext=e.state.facet(Ue)?this.editContext.editContext:null))}destroy(){var e,t,i;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(i=this.resizeScroll)===null||i===void 0||i.disconnect();for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function Bs(n,e,t){for(;e;){let i=J.get(e);if(i&&i.parent==n)return i;let r=e.parentNode;e=r!=n.dom?r:t>0?e.nextSibling:e.previousSibling}return null}function Vs(n,e){let t=e.startContainer,i=e.startOffset,r=e.endContainer,s=e.endOffset,o=n.docView.domAtPos(n.state.selection.main.anchor,1);return ei(o.node,o.offset,r,s)&&([t,i,r,s]=[r,s,t,i]),{anchorNode:t,anchorOffset:i,focusNode:r,focusOffset:s}}function Wf(n,e){if(e.getComposedRanges){let r=e.getComposedRanges(n.root)[0];if(r)return Vs(n,r)}let t=null;function i(r){r.preventDefault(),r.stopImmediatePropagation(),t=r.getTargetRanges()[0]}return n.contentDOM.addEventListener("beforeinput",i,!0),n.dom.ownerDocument.execCommand("indent"),n.contentDOM.removeEventListener("beforeinput",i,!0),t?Vs(n,t):null}class Hf{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=i=>{let r=e.state.selection.main,{anchor:s,head:o}=r,l=this.toEditorPos(i.updateRangeStart),a=this.toEditorPos(i.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:i.updateRangeStart,editorBase:l,drifted:!1});let h=a-l>i.text.length;l==this.from&&s<this.from?l=s:a==this.to&&s>this.to&&(a=s);let f=xl(e.state.sliceDoc(l,a),i.text,(h?r.from:r.to)-l,h?"end":null);if(!f){let c=v.single(this.toEditorPos(i.selectionStart),this.toEditorPos(i.selectionEnd));Ji(c,r)||e.dispatch({selection:c,userEvent:"select"});return}let u={from:f.from+l,to:f.toA+l,insert:N.of(i.text.slice(f.from,f.toB).split(`
11
11
  `))};if((_.mac||_.android)&&u.from==o-1&&/^\. ?$/.test(i.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(u={from:l,to:a,insert:N.of([i.text.replace("."," ")])}),this.pendingContextChange=u,!e.state.readOnly){let c=this.to-this.from+(u.to-u.from+u.insert.length);Br(e,u,v.single(this.toEditorPos(i.selectionStart,c),this.toEditorPos(i.selectionEnd,c)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),u.from<u.to&&!u.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,i.updateRangeStart-1),Math.min(t.text.length,i.updateRangeStart+1)))&&this.handlers.compositionend(i)},this.handlers.characterboundsupdate=i=>{let r=[],s=null;for(let o=this.toEditorPos(i.rangeStart),l=this.toEditorPos(i.rangeEnd);o<l;o++){let a=e.coordsForChar(o);s=a&&new DOMRect(a.left,a.top,a.right-a.left,a.bottom-a.top)||s||new DOMRect,r.push(s)}t.updateCharacterBounds(i.rangeStart,r)},this.handlers.textformatupdate=i=>{let r=[];for(let s of i.getTextFormats()){let o=s.underlineStyle,l=s.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(l)){let a=this.toEditorPos(s.rangeStart),h=this.toEditorPos(s.rangeEnd);if(a<h){let f=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(l)?1:2}px`;r.push(z.mark({attributes:{style:f}}).range(a,h))}}}e.dispatch({effects:ll.of(z.set(r))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:i}=this.composing;this.composing=null,i&&this.reset(e.state)}};for(let i in this.handlers)t.addEventListener(i,this.handlers[i]);this.measureReq={read:i=>{let r=li(i.root);r&&r.rangeCount&&this.editContext.updateSelectionBounds(r.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,i=!1,r=this.pendingContextChange;return e.changes.iterChanges((s,o,l,a,h)=>{if(i)return;let f=h.length-(o-s);if(r&&o>=r.to)if(r.from==s&&r.to==o&&r.insert.eq(h)){r=this.pendingContextChange=null,t+=f,this.to+=f;return}else r=null,this.revertPending(e.state);if(s+=t,o+=t,o<=this.from)this.from+=f,this.to+=f;else if(s<this.to){if(s<this.from||o>this.to||this.to-this.from+h.length>3e4){i=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(o),h.toString()),this.to+=f}t+=f}),r&&!i&&this.revertPending(e.state),!i}update(e){let t=this.pendingContextChange,i=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(i.from,i.to)&&e.transactions.some(r=>!r.isUserEvent("input.type")&&r.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,i=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),r=this.toContextPos(t.head);(this.editContext.selectionStart!=i||this.editContext.selectionEnd!=r)&&this.editContext.updateSelection(i,r)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>1e4*3)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let i=this.composing;return i&&i.drifted?i.editorBase+(e-i.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class O{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:i}=e;this.dispatchTransactions=e.dispatchTransactions||i&&(r=>r.forEach(s=>i(s,this)))||(r=>this.update(r)),this.dispatch=this.dispatch.bind(this),this._root=e.root||uh(e.parent)||document,this.viewState=new Ps(this,e.state||B.create(e)),e.scrollTo&&e.scrollTo.is(Ai)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(_t).map(r=>new xn(r));for(let r of this.plugins)r.update(this);this.observer=new Nf(this),this.inputState=new of(this),this.inputState.ensureHandlers(this.plugins),this.docView=new ws(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((t=document.fonts)===null||t===void 0)&&t.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...e){let t=e.length==1&&e[0]instanceof ee?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,i=!1,r,s=this.state;for(let c of e){if(c.startState!=s)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");s=c.state}if(this.destroyed){this.viewState.state=s;return}let o=this.hasFocus,l=0,a=null;e.some(c=>c.annotation(Al))?(this.inputState.notifiedFocused=o,l=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,a=Cl(s,o),a||(l=1));let h=this.observer.delayedAndroidKey,f=null;if(h?(this.observer.clearDelayedAndroidKey(),f=this.observer.readChange(),(f&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(f=null)):this.observer.clear(),s.facet(B.phrases)!=this.state.facet(B.phrases))return this.setState(s);r=Ui.create(this,s,e),r.flags|=l;let u=this.viewState.scrollTarget;try{this.updateState=2;for(let c of e){if(u&&(u=u.map(c.changes)),c.scrollIntoView){let{main:d}=c.state.selection,{x:p,y:g}=this.state.facet(O.cursorScrollMargin);u=new Ot(d.empty?d:v.cursor(d.head,d.head>d.anchor?-1:1),"nearest","nearest",g,p)}for(let d of c.effects)d.is(Ai)&&(u=d.value.clip(this.state))}this.viewState.update(r,u),this.bidiCache=Yi.update(this.bidiCache,r.changes),r.empty||(this.updatePlugins(r),this.inputState.update(r)),t=this.docView.update(r),this.state.facet(Gt)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(c=>c.isUserEvent("select.pointer")))}finally{this.updateState=0}if(r.startState.facet(Mi)!=r.state.facet(Mi)&&(this.viewState.mustMeasureContent=!0),(t||i||u||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!r.empty)for(let c of this.state.facet(nr))try{c(r)}catch(d){We(this.state,d,"update listener")}(a||f)&&Promise.resolve().then(()=>{a&&this.state==a.startState&&this.dispatch(a),f&&!yl(this,f)&&h.force&&Mt(this.contentDOM,h.key,h.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let i of this.plugins)i.destroy(this);this.viewState=new Ps(this,e),this.plugins=e.facet(_t).map(i=>new xn(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView.destroy(),this.docView=new ws(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(_t),i=e.state.facet(_t);if(t!=i){let r=[];for(let s of i){let o=t.indexOf(s);if(o<0)r.push(new xn(s));else{let l=this.plugins[o];l.mustUpdate=e,r.push(l)}}for(let s of this.plugins)s.mustUpdate!=e&&s.destroy(this);this.plugins=r,this.pluginMap.clear()}else for(let r of this.plugins)r.mustUpdate=e;for(let r=0;r<this.plugins.length;r++)this.plugins[r].update(this);t!=i&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docViewUpdate)try{t.docViewUpdate(this)}catch(i){We(this.state,i,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,i=this.viewState.scrollParent,r=this.viewState.getScrollOffset(),{scrollAnchorPos:s,scrollAnchorHeight:o}=this.viewState;Math.abs(r-this.viewState.scrollOffset)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(o<0)if(qo(i||this.win))s=-1,o=this.viewState.heightMap.height;else{let d=this.viewState.scrollAnchorAt(r);s=d.from,o=d.top}this.updateState=1;let a=this.viewState.measure();if(!a&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let h=[];a&4||([this.measureRequests,h]=[h,this.measureRequests]);let f=h.map(d=>{try{return d.read(this)}catch(p){return We(this.state,p),Ns}}),u=Ui.create(this,this.state,[]),c=!1;u.flags|=a,t?t.flags|=a:t=u,this.updateState=2,u.empty||(this.updatePlugins(u),this.inputState.update(u),this.updateAttrs(),c=this.docView.update(u),c&&this.docViewUpdate());for(let d=0;d<h.length;d++)if(f[d]!=Ns)try{let p=h[d];p.write&&p.write(f[d],this)}catch(p){We(this.state,p)}if(c&&this.docView.updateSelection(!0),!u.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,o=-1;continue}else{let p=((s<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(s).top)-o)/this.scaleY;if((p>1||p<-1)&&!(_.ios&&this.inputState.lastIOSMomentumScroll>Date.now()-100)&&(i==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){r=r+p,i?s<0?i.scrollTop=i.scrollHeight:i.scrollTop+=p:this.win.scrollBy(0,p),o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let l of this.state.facet(nr))l(t)}get themeClasses(){return ar+" "+(this.state.facet(lr)?Dl:El)+" "+this.state.facet(Mi)}updateAttrs(){let e=Ws(this,al,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Ue)?"true":"false",class:"cm-content",style:`${_.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),Ws(this,Rr,t);let i=this.observer.ignore(()=>{let r=ps(this.contentDOM,this.contentAttrs,t),s=ps(this.dom,this.editorAttrs,e);return r||s});return this.editorAttrs=e,this.contentAttrs=t,i}showAnnouncements(e){let t=!0;for(let i of e)for(let r of i.effects)if(r.is(O.announce)){t&&(this.announceDOM.textContent=""),t=!1;let s=this.announceDOM.appendChild(document.createElement("div"));s.textContent=r.value}}mountStyles(){this.styleModules=this.state.facet(Gt);let e=this.state.facet(O.cspNonce);rt.mount(this.root,this.styleModules.concat(Bf).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let t=0;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key){this.measureRequests[t]=e;return}}this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);return(t===void 0||t&&t.plugin!=e)&&this.pluginMap.set(e,t=this.plugins.find(i=>i.plugin==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,i){return kn(this,e,vs(this,e,t,i))}moveByGroup(e,t){return kn(this,e,vs(this,e,t,i=>Jh(this,e.head,i)))}visualLineSide(e,t){let i=this.bidiSpans(e),r=this.textDirectionAt(e.from),s=i[t?i.length-1:0];return v.cursor(s.side(t,r)+e.from,s.forward(!t,r)?1:-1)}moveToLineBoundary(e,t,i=!0){return Gh(this,e,t,i)}moveVertically(e,t,i){return kn(this,e,Xh(this,e,t,i))}domAtPos(e,t=1){return this.docView.domAtPos(e,t)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){this.readMeasured();let i=sr(this,e,t);return i&&i.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),sr(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let i=this.state.doc.lineAt(e),r=this.bidiSpans(i),s=r[Ne.find(r,e-i.from,-1,t)];return this.docView.coordsAt(e,t,s.dir==Q.RTL)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(sl)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>Ff)return Yo(e.length);let t=this.textDirectionAt(e.from),i;for(let s of this.bidiCache)if(s.from==e.from&&s.dir==t&&(s.fresh||Xo(s.isolates,i=ys(this,e))))return s.order;i||(i=ys(this,e));let r=bh(e.text,t,i);return this.bidiCache.push(new Yi(e.from,e.to,t,i,!0,r)),r}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||_.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Ko(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){var i,r,s,o;return Ai.of(new Ot(typeof e=="number"?v.cursor(e):e,(i=t.y)!==null&&i!==void 0?i:"nearest",(r=t.x)!==null&&r!==void 0?r:"nearest",(s=t.yMargin)!==null&&s!==void 0?s:5,(o=t.xMargin)!==null&&o!==void 0?o:5))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,i=this.viewState.scrollAnchorAt(e);return Ai.of(new Ot(v.cursor(i.from),"start","start",i.top-e,t,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return Te.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Te.define(()=>({}),{eventObservers:e})}static theme(e,t){let i=rt.newName(),r=[Mi.of(i),Gt.of(hr(`.${i}`,e))];return t&&t.dark&&r.push(lr.of(!0)),r}static baseTheme(e){return Cr.lowest(Gt.of(hr("."+ar,e,Ml)))}static findFromDOM(e){var t;let i=e.querySelector(".cm-content"),r=i&&J.get(i)||J.get(e);return((t=r?.root)===null||t===void 0?void 0:t.view)||null}}O.styleModule=Gt;O.inputHandler=nl;O.clipboardInputFilter=Lr;O.clipboardOutputFilter=Pr;O.scrollHandler=ol;O.focusChangeEffect=rl;O.perLineTextDirection=sl;O.exceptionSink=il;O.updateListener=nr;O.editable=Ue;O.mouseSelectionStyle=tl;O.dragMovesSelection=el;O.clickAddsSelectionRange=Zo;O.decorations=rn;O.blockWrappers=hl;O.outerDecorations=Ir;O.atomicRanges=yi;O.bidiIsolatedRanges=fl;O.cursorScrollMargin=D.define({combine:n=>{let e=5,t=5;for(let i of n)typeof i=="number"?e=t=i:{x:e,y:t}=i;return{x:e,y:t}}});O.scrollMargins=ul;O.darkTheme=lr;O.cspNonce=D.define({combine:n=>n.length?n[0]:""});O.contentAttributes=Rr;O.editorAttributes=al;O.lineWrapping=O.contentAttributes.of({class:"cm-lineWrapping"});O.announce=Y.define();const Ff=4096,Ns={};class Yi{constructor(e,t,i,r,s,o){this.from=e,this.to=t,this.dir=i,this.isolates=r,this.fresh=s,this.order=o}static update(e,t){if(t.empty&&!e.some(s=>s.fresh))return e;let i=[],r=e.length?e[e.length-1].dir:Q.LTR;for(let s=Math.max(0,e.length-10);s<e.length;s++){let o=e[s];o.dir==r&&!t.touchesRange(o.from,o.to)&&i.push(new Yi(t.mapPos(o.from,1),t.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return i}}function Ws(n,e,t){for(let i=n.state.facet(e),r=i.length-1;r>=0;r--){let s=i[r],o=typeof s=="function"?s(n):s;o&&Dr(o,t)}return t}const zf=_.mac?"mac":_.windows?"win":_.linux?"linux":"key";function jf(n,e){const t=n.split(/-(?!$)/);let i=t[t.length-1];i=="Space"&&(i=" ");let r,s,o,l;for(let a=0;a<t.length-1;++a){const h=t[a];if(/^(cmd|meta|m)$/i.test(h))l=!0;else if(/^a(lt)?$/i.test(h))r=!0;else if(/^(c|ctrl|control)$/i.test(h))s=!0;else if(/^s(hift)?$/i.test(h))o=!0;else if(/^mod$/i.test(h))e=="mac"?l=!0:s=!0;else throw new Error("Unrecognized modifier name: "+h)}return r&&(i="Alt-"+i),s&&(i="Ctrl-"+i),l&&(i="Meta-"+i),o&&(i="Shift-"+i),i}function Oi(n,e,t){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t!==!1&&e.shiftKey&&(n="Shift-"+n),n}const Kf=Cr.default(O.domEventHandlers({keydown(n,e){return Gf(qf(e.state),n,e,"editor")}})),Ol=D.define({enables:Kf}),Hs=new WeakMap;function qf(n){let e=n.facet(Ol),t=Hs.get(e);return t||Hs.set(e,t=$f(e.reduce((i,r)=>i.concat(r),[]))),t}let it=null;const Uf=4e3;function $f(n,e=zf){let t=Object.create(null),i=Object.create(null),r=(o,l)=>{let a=i[o];if(a==null)i[o]=l;else if(a!=l)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},s=(o,l,a,h,f)=>{var u,c;let d=t[o]||(t[o]=Object.create(null)),p=l.split(/ (?!$)/).map(b=>jf(b,e));for(let b=1;b<p.length;b++){let A=p.slice(0,b).join(" ");r(A,!0),d[A]||(d[A]={preventDefault:!0,stopPropagation:!1,run:[S=>{let R=it={view:S,prefix:A,scope:o};return setTimeout(()=>{it==R&&(it=null)},Uf),!0}]})}let g=p.join(" ");r(g,!1);let y=d[g]||(d[g]={preventDefault:!1,stopPropagation:!1,run:((c=(u=d._any)===null||u===void 0?void 0:u.run)===null||c===void 0?void 0:c.slice())||[]});a&&y.run.push(a),h&&(y.preventDefault=!0),f&&(y.stopPropagation=!0)};for(let o of n){let l=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let h of l){let f=t[h]||(t[h]=Object.create(null));f._any||(f._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:u}=o;for(let c in f)f[c].run.push(d=>u(d,fr))}let a=o[e]||o.key;if(a)for(let h of l)s(h,a,o.run,o.preventDefault,o.stopPropagation),o.shift&&s(h,"Shift-"+a,o.shift,o.preventDefault,o.stopPropagation)}return t}let fr=null;function Gf(n,e,t,i){fr=e;let r=rh(e),s=Ha(r,0),o=Fa(s)==r.length&&r!=" ",l="",a=!1,h=!1,f=!1;it&&it.view==t&&it.scope==i&&(l=it.prefix+" ",wl.indexOf(e.keyCode)<0&&(h=!0,it=null));let u=new Set,c=y=>{if(y){for(let b of y.run)if(!u.has(b)&&(u.add(b),b(t)))return y.stopPropagation&&(f=!0),!0;y.preventDefault&&(y.stopPropagation&&(f=!0),h=!0)}return!1},d=n[i],p,g;return d&&(c(d[l+Oi(r,e,!o)])?a=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(_.windows&&e.ctrlKey&&e.altKey)&&!(_.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(p=st[e.keyCode])&&p!=r?(c(d[l+Oi(p,e,!0)])||e.shiftKey&&(g=si[e.keyCode])!=r&&g!=p&&c(d[l+Oi(g,e,!1)]))&&(a=!0):o&&e.shiftKey&&c(d[l+Oi(r,e,!0)])&&(a=!0),!a&&c(d._any)&&(a=!0)),h&&(a=!0),a&&f&&e.stopPropagation(),fr=null,a}function Jf(){return Yf}const Xf=z.line({class:"cm-activeLine"}),Yf=Te.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.docChanged||n.selectionSet)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=-1,t=[];for(let i of n.state.selection.ranges){let r=n.lineBlockAt(i.head);r.from>e&&(t.push(Xf.range(r.from)),e=r.from)}return z.set(t)}},{decorations:n=>n.decorations});class Qf extends pi{constructor(e){super(),this.content=e}toDOM(e){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(e):this.content.cloneNode(!0)),t.setAttribute("aria-hidden","true"),t}coordsAt(e){let t=e.firstChild?Zt(e.firstChild):[];if(!t.length)return null;let i=window.getComputedStyle(e.parentNode),r=ai(t[0],i.direction!="rtl"),s=parseInt(i.lineHeight);return r.bottom-r.top>s*1.5?{left:r.left,right:r.right,top:r.top,bottom:r.top+s}:r}ignoreEvent(){return!1}}function Zf(n){let e=Te.fromClass(class{constructor(t){this.view=t,this.placeholder=n?z.set([z.widget({widget:new Qf(n),side:1}).range(0)]):z.none}get decorations(){return this.view.state.doc.length?z.none:this.placeholder}},{decorations:t=>t.decorations});return typeof n=="string"?[e,O.contentAttributes.of({"aria-placeholder":n})]:e}class kt extends xt{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}kt.prototype.elementClass="";kt.prototype.toDOM=void 0;kt.prototype.mapMode=me.TrackBefore;kt.prototype.startSide=kt.prototype.endSide=-1;kt.prototype.point=!0;const Cn=D.define(),eu=D.define(),Hi=D.define(),Fs=D.define({combine:n=>n.some(e=>e)});function tu(n){return[iu]}const iu=Te.fromClass(class{constructor(n){this.view=n,this.domAfter=null,this.prevViewport=n.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=n.state.facet(Hi).map(e=>new js(n,e)),this.fixed=!n.state.facet(Fs);for(let e of this.gutters)e.config.side=="after"?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),n.scrollDOM.insertBefore(this.dom,n.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(n){if(this.updateGutters(n)){let e=this.prevViewport,t=n.view.viewport,i=Math.min(e.to,t.to)-Math.max(e.from,t.from);this.syncGutters(i<(t.to-t.from)*.8)}if(n.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(Fs)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=n.view.viewport}syncGutters(n){let e=this.dom.nextSibling;n&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let t=V.iter(this.view.state.facet(Cn),this.view.viewport.from),i=[],r=this.gutters.map(s=>new nu(s,this.view.viewport,-this.view.documentPadding.top));for(let s of this.view.viewportLineBlocks)if(i.length&&(i=[]),Array.isArray(s.type)){let o=!0;for(let l of s.type)if(l.type==pe.Text&&o){ur(t,i,l.from);for(let a of r)a.line(this.view,l,i);o=!1}else if(l.widget)for(let a of r)a.widget(this.view,l)}else if(s.type==pe.Text){ur(t,i,s.from);for(let o of r)o.line(this.view,s,i)}else if(s.widget)for(let o of r)o.widget(this.view,s);for(let s of r)s.finish();n&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(n){let e=n.startState.facet(Hi),t=n.state.facet(Hi),i=n.docChanged||n.heightChanged||n.viewportChanged||!V.eq(n.startState.facet(Cn),n.state.facet(Cn),n.view.viewport.from,n.view.viewport.to);if(e==t)for(let r of this.gutters)r.update(n)&&(i=!0);else{i=!0;let r=[];for(let s of t){let o=e.indexOf(s);o<0?r.push(new js(this.view,s)):(this.gutters[o].update(n),r.push(this.gutters[o]))}for(let s of this.gutters)s.dom.remove(),r.indexOf(s)<0&&s.destroy();for(let s of r)s.config.side=="after"?this.getDOMAfter().appendChild(s.dom):this.dom.appendChild(s.dom);this.gutters=r}return i}destroy(){for(let n of this.gutters)n.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:n=>O.scrollMargins.of(e=>{let t=e.plugin(n);if(!t||t.gutters.length==0||!t.fixed)return null;let i=t.dom.offsetWidth*e.scaleX,r=t.domAfter?t.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==Q.LTR?{left:i,right:r}:{right:i,left:r}})});function zs(n){return Array.isArray(n)?n:[n]}function ur(n,e,t){for(;n.value&&n.from<=t;)n.from==t&&e.push(n.value),n.next()}class nu{constructor(e,t,i){this.gutter=e,this.height=i,this.i=0,this.cursor=V.iter(e.markers,t.from)}addElement(e,t,i){let{gutter:r}=this,s=(t.top-this.height)/e.scaleY,o=t.height/e.scaleY;if(this.i==r.elements.length){let l=new Ll(e,o,s,i);r.elements.push(l),r.dom.appendChild(l.dom)}else r.elements[this.i].update(e,o,s,i);this.height=t.bottom,this.i++}line(e,t,i){let r=[];ur(this.cursor,r,t.from),i.length&&(r=r.concat(i));let s=this.gutter.config.lineMarker(e,t,r);s&&r.unshift(s);let o=this.gutter;r.length==0&&!o.config.renderEmptyElements||this.addElement(e,t,r)}widget(e,t){let i=this.gutter.config.widgetMarker(e,t.widget,t),r=i?[i]:null;for(let s of e.state.facet(eu)){let o=s(e,t.widget,t);o&&(r||(r=[])).push(o)}r&&this.addElement(e,t,r)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class js{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let i in t.domEventHandlers)this.dom.addEventListener(i,r=>{let s=r.target,o;if(s!=this.dom&&this.dom.contains(s)){for(;s.parentNode!=this.dom;)s=s.parentNode;let a=s.getBoundingClientRect();o=(a.top+a.bottom)/2}else o=r.clientY;let l=e.lineBlockAtHeight(o-e.documentTop);t.domEventHandlers[i](e,l,r)&&r.preventDefault()});this.markers=zs(t.markers(e)),t.initialSpacer&&(this.spacer=new Ll(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=zs(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let r=this.config.updateSpacer(this.spacer.markers[0],e);r!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[r])}let i=e.view.viewport;return!V.eq(this.markers,t,i.from,i.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class Ll{constructor(e,t,i,r){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,i,r)}update(e,t,i,r){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),ru(this.markers,r)||this.setMarkers(e,r)}setMarkers(e,t){let i="cm-gutterElement",r=this.dom.firstChild;for(let s=0,o=0;;){let l=o,a=s<t.length?t[s++]:null,h=!1;if(a){let f=a.elementClass;f&&(i+=" "+f);for(let u=o;u<this.markers.length;u++)if(this.markers[u].compare(a)){l=u,h=!0;break}}else l=this.markers.length;for(;o<l;){let f=this.markers[o++];if(f.toDOM){f.destroy(r);let u=r.nextSibling;r.remove(),r=u}}if(!a)break;a.toDOM&&(h?r=r.nextSibling:this.dom.insertBefore(a.toDOM(e),r)),h&&o++}this.dom.className=i,this.markers=t}destroy(){this.setMarkers(null,[])}}function ru(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(!n[t].compare(e[t]))return!1;return!0}const su=D.define(),ou=D.define(),Tt=D.define({combine(n){return _r(n,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,t){let i=Object.assign({},e);for(let r in t){let s=i[r],o=t[r];i[r]=s?(l,a,h)=>s(l,a,h)||o(l,a,h):o}return i}})}});class _n extends kt{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Tn(n,e){return n.state.facet(Tt).formatNumber(e,n.state)}const lu=Hi.compute([Tt],n=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(su)},lineMarker(e,t,i){return i.some(r=>r.toDOM)?null:new _n(Tn(e,e.state.doc.lineAt(t.from).number))},widgetMarker:(e,t,i)=>{for(let r of e.state.facet(ou)){let s=r(e,t,i);if(s)return s}return null},lineMarkerChange:e=>e.startState.facet(Tt)!=e.state.facet(Tt),initialSpacer(e){return new _n(Tn(e,Ks(e.state.doc.lines)))},updateSpacer(e,t){let i=Tn(t.view,Ks(t.view.state.doc.lines));return i==e.number?e:new _n(i)},domEventHandlers:n.facet(Tt).domEventHandlers,side:"before"}));function au(n={}){return[Tt.of(n),tu(),lu]}function Ks(n){let e=9;for(;e<n;)e=e*10+9;return e}const hu=1024;let fu=0;class ve{constructor(e,t){this.from=e,this.to=t}}class P{constructor(e={}){this.id=fu++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=ue.match(e)),t=>{let i=e(t);return i===void 0?null:[this,i]}}}P.closedBy=new P({deserialize:n=>n.split(" ")});P.openedBy=new P({deserialize:n=>n.split(" ")});P.group=new P({deserialize:n=>n.split(" ")});P.isolate=new P({deserialize:n=>{if(n&&n!="rtl"&&n!="ltr"&&n!="auto")throw new RangeError("Invalid value for isolate: "+n);return n||"auto"}});P.contextHash=new P({perNode:!0});P.lookAhead=new P({perNode:!0});P.mounted=new P({perNode:!0});class Lt{constructor(e,t,i,r=!1){this.tree=e,this.overlay=t,this.parser=i,this.bracketed=r}static get(e){return e&&e.props&&e.props[P.mounted.id]}}const uu=Object.create(null);class ue{constructor(e,t,i,r=0){this.name=e,this.props=t,this.id=i,this.flags=r}static define(e){let t=e.props&&e.props.length?Object.create(null):uu,i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),r=new ue(e.name||"",t,e.id,i);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(r)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[s[0].id]=s[1]}}return r}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(P.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let i in e)for(let r of i.split(" "))t[r]=e[i];return i=>{for(let r=i.prop(P.group),s=-1;s<(r?r.length:0);s++){let o=t[s<0?i.name:r[s]];if(o)return o}}}}ue.none=new ue("",Object.create(null),0,8);class Wr{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let i of this.types){let r=null;for(let s of e){let o=s(i);if(o){r||(r=Object.assign({},i.props));let l=o[1],a=o[0];a.combine&&a.id in r&&(l=a.combine(r[a.id],l)),r[a.id]=l}}t.push(r?new ue(i.name,r,i.id,i.flags):i)}return new Wr(t)}}const Li=new WeakMap,qs=new WeakMap;var F;(function(n){n[n.ExcludeBuffers=1]="ExcludeBuffers",n[n.IncludeAnonymous=2]="IncludeAnonymous",n[n.IgnoreMounts=4]="IgnoreMounts",n[n.IgnoreOverlays=8]="IgnoreOverlays",n[n.EnterBracketed=16]="EnterBracketed"})(F||(F={}));class j{constructor(e,t,i,r,s){if(this.type=e,this.children=t,this.positions=i,this.length=r,this.props=null,s&&s.length){this.props=Object.create(null);for(let[o,l]of s)this.props[typeof o=="number"?o:o.id]=l}}toString(){let e=Lt.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let i of this.children){let r=i.toString();r&&(t&&(t+=","),t+=r)}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 Qi(this.topNode,e)}cursorAt(e,t=0,i=0){let r=Li.get(this)||this.topNode,s=new Qi(r);return s.moveTo(e,t),Li.set(this,s._tree),s}get topNode(){return new oe(this,0,0,null)}resolve(e,t=0){let i=fi(Li.get(this)||this.topNode,e,t,!1);return Li.set(this,i),i}resolveInner(e,t=0){let i=fi(qs.get(this)||this.topNode,e,t,!0);return qs.set(this,i),i}resolveStack(e,t=0){return pu(this,e,t)}iterate(e){let{enter:t,leave:i,from:r=0,to:s=this.length}=e,o=e.mode||0,l=(o&F.IncludeAnonymous)>0;for(let a=this.cursor(o|F.IncludeAnonymous);;){let h=!1;if(a.from<=s&&a.to>=r&&(!l&&a.type.isAnonymous||t(a)!==!1)){if(a.firstChild())continue;h=!0}for(;h&&i&&(l||!a.type.isAnonymous)&&i(a),!a.nextSibling();){if(!a.parent())return;h=!0}}}prop(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(e={}){return this.children.length<=8?this:zr(ue.none,this.children,this.positions,0,this.children.length,0,this.length,(t,i,r)=>new j(this.type,t,i,r,this.propValues),e.makeTree||((t,i,r)=>new j(ue.none,t,i,r)))}static build(e){return gu(e)}}j.empty=new j(ue.none,[],[],0);class Hr{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 Hr(this.buffer,this.index)}}class lt{constructor(e,t,i){this.buffer=e,this.length=t,this.set=i}get type(){return ue.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],i=this.buffer[e+3],r=this.set.types[t],s=r.name;if(/\W/.test(s)&&!r.isError&&(s=JSON.stringify(s)),e+=4,i==e)return s;let o=[];for(;e<i;)o.push(this.childString(e)),e=this.buffer[e+3];return s+"("+o.join(",")+")"}findChild(e,t,i,r,s){let{buffer:o}=this,l=-1;for(let a=e;a!=t&&!(Pl(s,r,o[a+1],o[a+2])&&(l=a,i>0));a=o[a+3]);return l}slice(e,t,i){let r=this.buffer,s=new Uint16Array(t-e),o=0;for(let l=e,a=0;l<t;){s[a++]=r[l++],s[a++]=r[l++]-i;let h=s[a++]=r[l++]-i;s[a++]=r[l++]-e,o=Math.max(o,h)}return new lt(s,o,this.set)}}function Pl(n,e,t,i){switch(n){case-2:return t<e;case-1:return i>=e&&t<e;case 0:return t<e&&i>e;case 1:return t<=e&&i>e;case 2:return i>e;case 4:return!0}}function fi(n,e,t,i){for(var r;n.from==n.to||(t<1?n.from>=e:n.from>e)||(t>-1?n.to<=e:n.to<e);){let o=!i&&n instanceof oe&&n.index<0?null:n.parent;if(!o)return n;n=o}let s=i?0:F.IgnoreOverlays;if(i)for(let o=n,l=o.parent;l;o=l,l=o.parent)o instanceof oe&&o.index<0&&((r=l.enter(e,t,s))===null||r===void 0?void 0:r.from)!=o.from&&(n=l);for(;;){let o=n.enter(e,t,s);if(!o)return n;n=o}}class Rl{cursor(e=0){return new Qi(this,e)}getChild(e,t=null,i=null){let r=Us(this,e,t,i);return r.length?r[0]:null}getChildren(e,t=null,i=null){return Us(this,e,t,i)}resolve(e,t=0){return fi(this,e,t,!1)}resolveInner(e,t=0){return fi(this,e,t,!0)}matchContext(e){return cr(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),i=this;for(;t;){let r=t.lastChild;if(!r||r.to!=t.to)break;r.type.isError&&r.from==r.to?(i=t,t=r.prevSibling):t=r}return i}get node(){return this}get next(){return this.parent}}class oe extends Rl{constructor(e,t,i,r){super(),this._tree=e,this.from=t,this.index=i,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(e,t,i,r,s=0){for(let o=this;;){for(let{children:l,positions:a}=o._tree,h=t>0?l.length:-1;e!=h;e+=t){let f=l[e],u=a[e]+o.from,c;if(!(!(s&F.EnterBracketed&&f instanceof j&&(c=Lt.get(f))&&!c.overlay&&c.bracketed&&i>=u&&i<=u+f.length)&&!Pl(r,i,u,u+f.length))){if(f instanceof lt){if(s&F.ExcludeBuffers)continue;let d=f.findChild(0,f.buffer.length,t,i-u,r);if(d>-1)return new He(new cu(o,f,e,u),null,d)}else if(s&F.IncludeAnonymous||!f.type.isAnonymous||Fr(f)){let d;if(!(s&F.IgnoreMounts)&&(d=Lt.get(f))&&!d.overlay)return new oe(d.tree,u,e,o);let p=new oe(f,u,e,o);return s&F.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(t<0?f.children.length-1:0,t,i,r,s)}}}if(s&F.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+t:e=t<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(e,t,i=0){let r;if(!(i&F.IgnoreOverlays)&&(r=Lt.get(this._tree))&&r.overlay){let s=e-this.from,o=i&F.EnterBracketed&&r.bracketed;for(let{from:l,to:a}of r.overlay)if((t>0||o?l<=s:l<s)&&(t<0||o?a>=s:a>s))return new oe(r.tree,r.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,i)}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 Us(n,e,t,i){let r=n.cursor(),s=[];if(!r.firstChild())return s;if(t!=null){for(let o=!1;!o;)if(o=r.type.is(t),!r.nextSibling())return s}for(;;){if(i!=null&&r.type.is(i))return s;if(r.type.is(e)&&s.push(r.node),!r.nextSibling())return i==null?s:[]}}function cr(n,e,t=e.length-1){for(let i=n;t>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(e[t]&&e[t]!=i.name)return!1;t--}}return!0}class cu{constructor(e,t,i,r){this.parent=e,this.buffer=t,this.index=i,this.start=r}}class He extends Rl{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,i){super(),this.context=e,this._parent=t,this.index=i,this.type=e.buffer.set.types[e.buffer.buffer[i]]}child(e,t,i){let{buffer:r}=this.context,s=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.context.start,i);return s<0?null:new He(this.context,this,s)}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(e,t,i=0){if(i&F.ExcludeBuffers)return null;let{buffer:r}=this.context,s=r.findChild(this.index+4,r.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return s<0?null:new He(this.context,this,s)}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:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new He(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new He(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:i}=this.context,r=this.index+4,s=i.buffer[this.index+3];if(s>r){let o=i.buffer[this.index+1];e.push(i.slice(r,s,o)),t.push(0)}return new j(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Il(n){if(!n.length)return null;let e=0,t=n[0];for(let s=1;s<n.length;s++){let o=n[s];(o.from>t.from||o.to<t.to)&&(t=o,e=s)}let i=t instanceof oe&&t.index<0?null:t.parent,r=n.slice();return i?r[e]=i:r.splice(e,1),new du(r,t)}class du{constructor(e,t){this.heads=e,this.node=t}get next(){return Il(this.heads)}}function pu(n,e,t){let i=n.resolveInner(e,t),r=null;for(let s=i instanceof oe?i:i.context.parent;s;s=s.parent)if(s.index<0){let o=s.parent;(r||(r=[i])).push(o.resolve(e,t)),s=o}else{let o=Lt.get(s.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let l=new oe(o.tree,o.overlay[0].from+s.from,-1,s);(r||(r=[i])).push(fi(l,e,t,!1))}}return r?Il(r):i}class Qi{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&~F.EnterBracketed,e instanceof oe)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let i=e._parent;i;i=i._parent)this.stack.unshift(i.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:i,buffer:r}=this.buffer;return this.type=t||r.set.types[r.buffer[e]],this.from=i+r.buffer[e+1],this.to=i+r.buffer[e+2],!0}yield(e){return e?e instanceof oe?(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,i){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,i,this.mode));let{buffer:r}=this.buffer,s=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.buffer.start,i);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}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,i=this.mode){return this.buffer?i&F.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&F.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&F.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,i=this.stack.length-1;if(e<0){let r=i<0?0:this.stack[i]+4;if(this.index!=r)return this.yieldBuf(t.findChild(r,this.index,-1,0,4))}else{let r=t.buffer[this.index+3];if(r<(i<0?t.buffer.length:t.buffer[this.stack[i]+3]))return this.yieldBuf(r)}return i<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,i,{buffer:r}=this;if(r){if(e>0){if(this.index<r.buffer.buffer.length)return!1}else for(let s=0;s<this.index;s++)if(r.buffer.buffer[s+3]<this.index)return!1;({index:t,parent:i}=r)}else({index:t,_parent:i}=this._tree);for(;i;{index:t,_parent:i}=i)if(t>-1)for(let s=t+e,o=e<0?-1:i._tree.children.length;s!=o;s+=e){let l=i._tree.children[s];if(this.mode&F.IncludeAnonymous||l instanceof lt||!l.type.isAnonymous||Fr(l))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,i=0;if(e&&e.context==this.buffer)e:for(let r=this.index,s=this.stack.length;s>=0;){for(let o=e;o;o=o._parent)if(o.index==r){if(r==this.index)return o;t=o,i=s+1;break e}r=this.stack[--s]}for(let r=i;r<this.stack.length;r++)t=new He(this.buffer,t,this.stack[r]);return this.bufferNode=new He(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let i=0;;){let r=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){i++;continue}this.type.isAnonymous||(r=!0)}for(;;){if(r&&t&&t(this),r=this.type.isAnonymous,!i)return;if(this.nextSibling())break;this.parent(),i--,r=!0}}}matchContext(e){if(!this.buffer)return cr(this.node.parent,e);let{buffer:t}=this.buffer,{types:i}=t.set;for(let r=e.length-1,s=this.stack.length-1;r>=0;s--){if(s<0)return cr(this._tree,e,r);let o=i[t.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[r]&&e[r]!=o.name)return!1;r--}}return!0}}function Fr(n){return n.children.some(e=>e instanceof lt||!e.type.isAnonymous||Fr(e))}function gu(n){var e;let{buffer:t,nodeSet:i,maxBufferLength:r=hu,reused:s=[],minRepeatType:o=i.types.length}=n,l=Array.isArray(t)?new Hr(t,t.length):t,a=i.types,h=0,f=0;function u(E,M,T,W,K,G){let{id:I,start:L,end:U,size:$}=l,te=f,Ye=h;if($<0)if(l.next(),$==-1){let qe=s[I];T.push(qe),W.push(L-E);return}else if($==-3){h=I;return}else if($==-4){f=I;return}else throw new RangeError(`Unrecognized record size: ${$}`);let zt=a[I],bi,ut,Qr=L-E;if(U-L<=r&&(ut=y(l.pos-M,K))){let qe=new Uint16Array(ut.size-ut.skip),ye=l.pos-ut.size,Oe=qe.length;for(;l.pos>ye;)Oe=b(ut.start,qe,Oe);bi=new lt(qe,U-ut.start,i),Qr=ut.start-E}else{let qe=l.pos-$;l.next();let ye=[],Oe=[],ct=I>=o?I:-1,At=0,wi=U;for(;l.pos>qe;)ct>=0&&l.id==ct&&l.size>=0?(l.end<=wi-r&&(p(ye,Oe,L,At,l.end,wi,ct,te,Ye),At=ye.length,wi=l.end),l.next()):G>2500?c(L,qe,ye,Oe):u(L,qe,ye,Oe,ct,G+1);if(ct>=0&&At>0&&At<ye.length&&p(ye,Oe,L,At,L,wi,ct,te,Ye),ye.reverse(),Oe.reverse(),ct>-1&&At>0){let Zr=d(zt,Ye);bi=zr(zt,ye,Oe,0,ye.length,0,U-L,Zr,Zr)}else bi=g(zt,ye,Oe,U-L,te-U,Ye)}T.push(bi),W.push(Qr)}function c(E,M,T,W){let K=[],G=0,I=-1;for(;l.pos>M;){let{id:L,start:U,end:$,size:te}=l;if(te>4)l.next();else{if(I>-1&&U<I)break;I<0&&(I=$-r),K.push(L,U,$),G++,l.next()}}if(G){let L=new Uint16Array(G*4),U=K[K.length-2];for(let $=K.length-3,te=0;$>=0;$-=3)L[te++]=K[$],L[te++]=K[$+1]-U,L[te++]=K[$+2]-U,L[te++]=te;T.push(new lt(L,K[2]-U,i)),W.push(U-E)}}function d(E,M){return(T,W,K)=>{let G=0,I=T.length-1,L,U;if(I>=0&&(L=T[I])instanceof j){if(!I&&L.type==E&&L.length==K)return L;(U=L.prop(P.lookAhead))&&(G=W[I]+L.length+U)}return g(E,T,W,K,G,M)}}function p(E,M,T,W,K,G,I,L,U){let $=[],te=[];for(;E.length>W;)$.push(E.pop()),te.push(M.pop()+T-K);E.push(g(i.types[I],$,te,G-K,L-G,U)),M.push(K-T)}function g(E,M,T,W,K,G,I){if(G){let L=[P.contextHash,G];I=I?[L].concat(I):[L]}if(K>25){let L=[P.lookAhead,K];I=I?[L].concat(I):[L]}return new j(E,M,T,W,I)}function y(E,M){let T=l.fork(),W=0,K=0,G=0,I=T.end-r,L={size:0,start:0,skip:0};e:for(let U=T.pos-E;T.pos>U;){let $=T.size;if(T.id==M&&$>=0){L.size=W,L.start=K,L.skip=G,G+=4,W+=4,T.next();continue}let te=T.pos-$;if($<0||te<U||T.start<I)break;let Ye=T.id>=o?4:0,zt=T.start;for(T.next();T.pos>te;){if(T.size<0)if(T.size==-3||T.size==-4)Ye+=4;else break e;else T.id>=o&&(Ye+=4);T.next()}K=zt,W+=$,G+=Ye}return(M<0||W==E)&&(L.size=W,L.start=K,L.skip=G),L.size>4?L:void 0}function b(E,M,T){let{id:W,start:K,end:G,size:I}=l;if(l.next(),I>=0&&W<o){let L=T;if(I>4){let U=l.pos-(I-4);for(;l.pos>U;)T=b(E,M,T)}M[--T]=L,M[--T]=G-E,M[--T]=K-E,M[--T]=W}else I==-3?h=W:I==-4&&(f=W);return T}let A=[],S=[];for(;l.pos>0;)u(n.start||0,n.bufferStart||0,A,S,-1,0);let R=(e=n.length)!==null&&e!==void 0?e:A.length?S[0]+A[0].length:0;return new j(a[n.topID],A.reverse(),S.reverse(),R)}const $s=new WeakMap;function Fi(n,e){if(!n.isAnonymous||e instanceof lt||e.type!=n)return 1;let t=$s.get(e);if(t==null){t=1;for(let i of e.children){if(i.type!=n||!(i instanceof j)){t=1;break}t+=Fi(n,i)}$s.set(e,t)}return t}function zr(n,e,t,i,r,s,o,l,a){let h=0;for(let p=i;p<r;p++)h+=Fi(n,e[p]);let f=Math.ceil(h*1.5/8),u=[],c=[];function d(p,g,y,b,A){for(let S=y;S<b;){let R=S,E=g[S],M=Fi(n,p[S]);for(S++;S<b;S++){let T=Fi(n,p[S]);if(M+T>=f)break;M+=T}if(S==R+1){if(M>f){let T=p[R];d(T.children,T.positions,0,T.children.length,g[R]+A);continue}u.push(p[R])}else{let T=g[S-1]+p[S-1].length-E;u.push(zr(n,p,g,R,S,E,T,null,a))}c.push(E+A-s)}}return d(e,t,i,r,0),(l||a)(u,c,o)}class Ld{constructor(){this.map=new WeakMap}setBuffer(e,t,i){let r=this.map.get(e);r||this.map.set(e,r=new Map),r.set(t,i)}getBuffer(e,t){let i=this.map.get(e);return i&&i.get(t)}set(e,t){e instanceof He?this.setBuffer(e.context.buffer,e.index,t):e instanceof oe&&this.map.set(e.tree,t)}get(e){return e instanceof He?this.getBuffer(e.context.buffer,e.index):e instanceof oe?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)}}class Je{constructor(e,t,i,r,s=!1,o=!1){this.from=e,this.to=t,this.tree=i,this.offset=r,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],i=!1){let r=[new Je(0,e.length,e,0,!1,i)];for(let s of t)s.to>e.length&&r.push(s);return r}static applyChanges(e,t,i=128){if(!t.length)return e;let r=[],s=1,o=e.length?e[0]:null;for(let l=0,a=0,h=0;;l++){let f=l<t.length?t[l]:null,u=f?f.fromA:1e9;if(u-a>=i)for(;o&&o.from<u;){let c=o;if(a>=c.from||u<=c.to||h){let d=Math.max(c.from,a)-h,p=Math.min(c.to,u)-h;c=d>=p?null:new Je(d,p,c.tree,c.offset+h,l>0,!!f)}if(c&&r.push(c),o.to>u)break;o=s<e.length?e[s++]:null}if(!f)break;a=f.toA,h=f.toA-f.toB}return r}}class Bl{startParse(e,t,i){return typeof e=="string"&&(e=new mu(e)),i=i?i.length?i.map(r=>new ve(r.from,r.to)):[new ve(0,0)]:[new ve(0,e.length)],this.createParse(e,t||[],i)}parse(e,t,i){let r=this.startParse(e,t,i);for(;;){let s=r.advance();if(s)return s}}}class mu{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 Pd(n){return(e,t,i,r)=>new xu(e,n,t,i,r)}class Gs{constructor(e,t,i,r,s,o){this.parser=e,this.parse=t,this.overlay=i,this.bracketed=r,this.target=s,this.from=o}}function Js(n){if(!n.length||n.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(n))}class yu{constructor(e,t,i,r,s,o,l,a){this.parser=e,this.predicate=t,this.mounts=i,this.index=r,this.start=s,this.bracketed=o,this.target=l,this.prev=a,this.depth=0,this.ranges=[]}}const dr=new P({perNode:!0});class xu{constructor(e,t,i,r,s){this.nest=t,this.input=i,this.fragments=r,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let i=this.baseParse.advance();if(!i)return null;if(this.baseParse=null,this.baseTree=i,this.startInner(),this.stoppedAt!=null)for(let r of this.inner)r.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let i=this.baseTree;return this.stoppedAt!=null&&(i=new j(i.type,i.children,i.positions,i.length,i.propValues.concat([[dr,this.stoppedAt]]))),i}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let i=Object.assign(Object.create(null),e.target.props);i[P.mounted.id]=new Lt(t,e.overlay,e.parser,e.bracketed),e.target.props=i}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 vu(this.fragments),t=null,i=null,r=new Qi(new oe(this.baseTree,this.ranges[0].from,0,null),F.IncludeAnonymous|F.IgnoreMounts);e:for(let s,o;;){let l=!0,a;if(this.stoppedAt!=null&&r.from>=this.stoppedAt)l=!1;else if(e.hasNode(r)){if(t){let h=t.mounts.find(f=>f.frag.from<=r.from&&f.frag.to>=r.to&&f.mount.overlay);if(h)for(let f of h.mount.overlay){let u=f.from+h.pos,c=f.to+h.pos;u>=r.from&&c<=r.to&&!t.ranges.some(d=>d.from<c&&d.to>u)&&t.ranges.push({from:u,to:c})}}l=!1}else if(i&&(o=bu(i.ranges,r.from,r.to)))l=o!=2;else if(!r.type.isAnonymous&&(s=this.nest(r,this.input))&&(r.from<r.to||!s.overlay)){r.tree||(wu(r),t&&t.depth++,i&&i.depth++);let h=e.findMounts(r.from,s.parser);if(typeof s.overlay=="function")t=new yu(s.parser,s.overlay,h,this.inner.length,r.from,!!s.bracketed,r.tree,t);else{let f=Qs(this.ranges,s.overlay||(r.from<r.to?[new ve(r.from,r.to)]:[]));f.length&&Js(f),(f.length||!s.overlay)&&this.inner.push(new Gs(s.parser,f.length?s.parser.startParse(this.input,Zs(h,f),f):s.parser.startParse(""),s.overlay?s.overlay.map(u=>new ve(u.from-r.from,u.to-r.from)):null,!!s.bracketed,r.tree,f.length?f[0].from:r.from)),s.overlay?f.length&&(i={ranges:f,depth:0,prev:i}):l=!1}}else if(t&&(a=t.predicate(r))&&(a===!0&&(a=new ve(r.from,r.to)),a.from<a.to)){let h=t.ranges.length-1;h>=0&&t.ranges[h].to==a.from?t.ranges[h]={from:t.ranges[h].from,to:a.to}:t.ranges.push(a)}if(l&&r.firstChild())t&&t.depth++,i&&i.depth++;else for(;!r.nextSibling();){if(!r.parent())break e;if(t&&!--t.depth){let h=Qs(this.ranges,t.ranges);h.length&&(Js(h),this.inner.splice(t.index,0,new Gs(t.parser,t.parser.startParse(this.input,Zs(t.mounts,h),h),t.ranges.map(f=>new ve(f.from-t.start,f.to-t.start)),t.bracketed,t.target,h[0].from))),t=t.prev}i&&!--i.depth&&(i=i.prev)}}}}function bu(n,e,t){for(let i of n){if(i.from>=t)break;if(i.to>e)return i.from<=e&&i.to>=t?2:1}return 0}function Xs(n,e,t,i,r,s){if(e<t){let o=n.buffer[e+1];i.push(n.slice(e,t,o)),r.push(o-s)}}function wu(n){let{node:e}=n,t=[],i=e.context.buffer;do t.push(n.index),n.parent();while(!n.tree);let r=n.tree,s=r.children.indexOf(i),o=r.children[s],l=o.buffer,a=[s];function h(f,u,c,d,p,g){let y=t[g],b=[],A=[];Xs(o,f,y,b,A,d);let S=l[y+1],R=l[y+2];a.push(b.length);let E=g?h(y+4,l[y+3],o.set.types[l[y]],S,R-S,g-1):e.toTree();return b.push(E),A.push(S-d),Xs(o,l[y+3],u,b,A,d),new j(c,b,A,p)}r.children[s]=h(0,l.length,ue.none,0,o.length,t.length-1);for(let f of a){let u=n.tree.children[f],c=n.tree.positions[f];n.yield(new oe(u,c+n.from,f,n._tree))}}class Ys{constructor(e,t){this.offset=t,this.done=!1,this.cursor=e.cursor(F.IncludeAnonymous|F.IgnoreMounts)}moveTo(e){let{cursor:t}=this,i=e-this.offset;for(;!this.done&&t.from<i;)if(!(t.to>=e&&t.enter(i,1,F.IgnoreOverlays|F.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 j)t=t.children[0];else break}return!1}}class vu{constructor(e){var t;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let i=this.curFrag=e[0];this.curTo=(t=i.tree.prop(dr))!==null&&t!==void 0?t:i.to,this.inner=new Ys(i.tree,-i.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(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let t=this.curFrag=this.fragments[this.fragI];this.curTo=(e=t.tree.prop(dr))!==null&&e!==void 0?e:t.to,this.inner=new Ys(t.tree,-t.offset)}}findMounts(e,t){var i;let r=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let s=this.inner.cursor.node;s;s=s.parent){let o=(i=s.tree)===null||i===void 0?void 0:i.prop(P.mounted);if(o&&o.parser==t)for(let l=this.fragI;l<this.fragments.length;l++){let a=this.fragments[l];if(a.from>=s.to)break;a.tree==this.curFrag.tree&&r.push({frag:a,pos:s.from-a.offset,mount:o})}}}return r}}function Qs(n,e){let t=null,i=e;for(let r=1,s=0;r<n.length;r++){let o=n[r-1].to,l=n[r].from;for(;s<i.length;s++){let a=i[s];if(a.from>=l)break;a.to<=o||(t||(i=t=e.slice()),a.from<o?(t[s]=new ve(a.from,o),a.to>l&&t.splice(s+1,0,new ve(l,a.to))):a.to>l?t[s--]=new ve(l,a.to):t.splice(s--,1))}}return i}function ku(n,e,t,i){let r=0,s=0,o=!1,l=!1,a=-1e9,h=[];for(;;){let f=r==n.length?1e9:o?n[r].to:n[r].from,u=s==e.length?1e9:l?e[s].to:e[s].from;if(o!=l){let c=Math.max(a,t),d=Math.min(f,u,i);c<d&&h.push(new ve(c,d))}if(a=Math.min(f,u),a==1e9)break;f==a&&(o?(o=!1,r++):o=!0),u==a&&(l?(l=!1,s++):l=!0)}return h}function Zs(n,e){let t=[];for(let{pos:i,mount:r,frag:s}of n){let o=i+(r.overlay?r.overlay[0].from:0),l=o+r.tree.length,a=Math.max(s.from,o),h=Math.min(s.to,l);if(r.overlay){let f=r.overlay.map(c=>new ve(c.from+i,c.to+i)),u=ku(e,f,a,h);for(let c=0,d=a;;c++){let p=c==u.length,g=p?h:u[c].from;if(g>d&&t.push(new Je(d,g,r.tree,-o,s.from>=d||s.openStart,s.to<=g||s.openEnd)),p)break;d=u[c].to}}else t.push(new Je(a,h,r.tree,-o,s.from>=o||s.openStart,s.to<=l||s.openEnd))}return t}let Su=0;class be{constructor(e,t,i,r){this.name=e,this.set=t,this.base=i,this.modified=r,this.id=Su++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let i=typeof e=="string"?e:"?";if(e instanceof be&&(t=e),t?.base)throw new Error("Can not derive from a modified tag");let r=new be(i,[],null,[]);if(r.set.push(r),t)for(let s of t.set)r.set.push(s);return r}static defineModifier(e){let t=new Zi(e);return i=>i.modified.indexOf(t)>-1?i:Zi.get(i.base||i,i.modified.concat(t).sort((r,s)=>r.id-s.id))}}let Au=0;class Zi{constructor(e){this.name=e,this.instances=[],this.id=Au++}static get(e,t){if(!t.length)return e;let i=t[0].instances.find(l=>l.base==e&&Cu(t,l.modified));if(i)return i;let r=[],s=new be(e.name,r,e,t);for(let l of t)l.instances.push(s);let o=_u(t);for(let l of e.set)if(!l.modified.length)for(let a of o)r.push(Zi.get(l,a));return s}}function Cu(n,e){return n.length==e.length&&n.every((t,i)=>t==e[i])}function _u(n){let e=[[]];for(let t=0;t<n.length;t++)for(let i=0,r=e.length;i<r;i++)e.push(e[i].concat(n[t]));return e.sort((t,i)=>i.length-t.length)}function Tu(n){let e=Object.create(null);for(let t in n){let i=n[t];Array.isArray(i)||(i=[i]);for(let r of t.split(" "))if(r){let s=[],o=2,l=r;for(let u=0;;){if(l=="..."&&u>0&&u+3==r.length){o=1;break}let c=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!c)throw new RangeError("Invalid path: "+r);if(s.push(c[0]=="*"?"":c[0][0]=='"'?JSON.parse(c[0]):c[0]),u+=c[0].length,u==r.length)break;let d=r[u++];if(u==r.length&&d=="!"){o=0;break}if(d!="/")throw new RangeError("Invalid path: "+r);l=r.slice(u)}let a=s.length-1,h=s[a];if(!h)throw new RangeError("Invalid path: "+r);let f=new ui(i,o,a>0?s.slice(0,a):null);e[h]=f.sort(e[h])}}return Vl.add(e)}const Vl=new P({combine(n,e){let t,i,r;for(;n||e;){if(!n||e&&n.depth>=e.depth?(r=e,e=e.next):(r=n,n=n.next),t&&t.mode==r.mode&&!r.context&&!t.context)continue;let s=new ui(r.tags,r.mode,r.context);t?t.next=s:i=s,t=s}return i}});class ui{constructor(e,t,i,r){this.tags=e,this.mode=t,this.context=i,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}}ui.empty=new ui([],2,null);function Nl(n,e){let t=Object.create(null);for(let s of n)if(!Array.isArray(s.tag))t[s.tag.id]=s.class;else for(let o of s.tag)t[o.id]=s.class;let{scope:i,all:r=null}=e||{};return{style:s=>{let o=r;for(let l of s)for(let a of l.set){let h=t[a.id];if(h){o=o?o+" "+h:h;break}}return o},scope:i}}function Eu(n,e){let t=null;for(let i of n){let r=i.style(e);r&&(t=t?t+" "+r:r)}return t}function Du(n,e,t,i=0,r=n.length){let s=new Mu(i,Array.isArray(e)?e:[e],t);s.highlightRange(n.cursor(),i,r,"",s.highlighters),s.flush(r)}class Mu{constructor(e,t,i){this.at=e,this.highlighters=t,this.span=i,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,i,r,s){let{type:o,from:l,to:a}=e;if(l>=i||a<=t)return;o.isTop&&(s=this.highlighters.filter(d=>!d.scope||d.scope(o)));let h=r,f=Ou(e)||ui.empty,u=Eu(s,f.tags);if(u&&(h&&(h+=" "),h+=u,f.mode==1&&(r+=(r?" ":"")+u)),this.startSpan(Math.max(t,l),h),f.opaque)return;let c=e.tree&&e.tree.prop(P.mounted);if(c&&c.overlay){let d=e.node.enter(c.overlay[0].from+l,1),p=this.highlighters.filter(y=>!y.scope||y.scope(c.tree.type)),g=e.firstChild();for(let y=0,b=l;;y++){let A=y<c.overlay.length?c.overlay[y]:null,S=A?A.from+l:a,R=Math.max(t,b),E=Math.min(i,S);if(R<E&&g)for(;e.from<E&&(this.highlightRange(e,R,E,r,s),this.startSpan(Math.min(E,e.to),h),!(e.to>=S||!e.nextSibling())););if(!A||S>i)break;b=A.to+l,b>t&&(this.highlightRange(d.cursor(),Math.max(t,A.from+l),Math.min(i,b),"",p),this.startSpan(Math.min(i,b),h))}g&&e.parent()}else if(e.firstChild()){c&&(r="");do if(!(e.to<=t)){if(e.from>=i)break;this.highlightRange(e,t,i,r,s),this.startSpan(Math.min(i,e.to),h)}while(e.nextSibling());e.parent()}}}function Ou(n){let e=n.type.prop(Vl);for(;e&&e.context&&!n.matchContext(e.context);)e=e.next;return e||null}const k=be.define,Pi=k(),Ze=k(),eo=k(Ze),to=k(Ze),et=k(),Ri=k(et),En=k(et),Ie=k(),dt=k(Ie),Pe=k(),Re=k(),pr=k(),qt=k(pr),Ii=k(),C={comment:Pi,lineComment:k(Pi),blockComment:k(Pi),docComment:k(Pi),name:Ze,variableName:k(Ze),typeName:eo,tagName:k(eo),propertyName:to,attributeName:k(to),className:k(Ze),labelName:k(Ze),namespace:k(Ze),macroName:k(Ze),literal:et,string:Ri,docString:k(Ri),character:k(Ri),attributeValue:k(Ri),number:En,integer:k(En),float:k(En),bool:k(et),regexp:k(et),escape:k(et),color:k(et),url:k(et),keyword:Pe,self:k(Pe),null:k(Pe),atom:k(Pe),unit:k(Pe),modifier:k(Pe),operatorKeyword:k(Pe),controlKeyword:k(Pe),definitionKeyword:k(Pe),moduleKeyword:k(Pe),operator:Re,derefOperator:k(Re),arithmeticOperator:k(Re),logicOperator:k(Re),bitwiseOperator:k(Re),compareOperator:k(Re),updateOperator:k(Re),definitionOperator:k(Re),typeOperator:k(Re),controlOperator:k(Re),punctuation:pr,separator:k(pr),bracket:qt,angleBracket:k(qt),squareBracket:k(qt),paren:k(qt),brace:k(qt),content:Ie,heading:dt,heading1:k(dt),heading2:k(dt),heading3:k(dt),heading4:k(dt),heading5:k(dt),heading6:k(dt),contentSeparator:k(Ie),list:k(Ie),quote:k(Ie),emphasis:k(Ie),strong:k(Ie),link:k(Ie),monospace:k(Ie),strikethrough:k(Ie),inserted:k(),deleted:k(),changed:k(),invalid:k(),meta:Ii,documentMeta:k(Ii),annotation:k(Ii),processingInstruction:k(Ii),definition:be.defineModifier("definition"),constant:be.defineModifier("constant"),function:be.defineModifier("function"),standard:be.defineModifier("standard"),local:be.defineModifier("local"),special:be.defineModifier("special")};for(let n in C){let e=C[n];e instanceof be&&(e.name=n)}Nl([{tag:C.link,class:"tok-link"},{tag:C.heading,class:"tok-heading"},{tag:C.emphasis,class:"tok-emphasis"},{tag:C.strong,class:"tok-strong"},{tag:C.keyword,class:"tok-keyword"},{tag:C.atom,class:"tok-atom"},{tag:C.bool,class:"tok-bool"},{tag:C.url,class:"tok-url"},{tag:C.labelName,class:"tok-labelName"},{tag:C.inserted,class:"tok-inserted"},{tag:C.deleted,class:"tok-deleted"},{tag:C.literal,class:"tok-literal"},{tag:C.string,class:"tok-string"},{tag:C.number,class:"tok-number"},{tag:[C.regexp,C.escape,C.special(C.string)],class:"tok-string2"},{tag:C.variableName,class:"tok-variableName"},{tag:C.local(C.variableName),class:"tok-variableName tok-local"},{tag:C.definition(C.variableName),class:"tok-variableName tok-definition"},{tag:C.special(C.variableName),class:"tok-variableName2"},{tag:C.definition(C.propertyName),class:"tok-propertyName tok-definition"},{tag:C.typeName,class:"tok-typeName"},{tag:C.namespace,class:"tok-namespace"},{tag:C.className,class:"tok-className"},{tag:C.macroName,class:"tok-macroName"},{tag:C.propertyName,class:"tok-propertyName"},{tag:C.operator,class:"tok-operator"},{tag:C.comment,class:"tok-comment"},{tag:C.meta,class:"tok-meta"},{tag:C.invalid,class:"tok-invalid"},{tag:C.punctuation,class:"tok-punctuation"}]);var Dn;const yt=new P;function Wl(n){return D.define({combine:n?e=>e.concat(n):void 0})}const Lu=new P;class ke{constructor(e,t,i=[],r=""){this.data=e,this.name=r,B.prototype.hasOwnProperty("tree")||Object.defineProperty(B.prototype,"tree",{get(){return Ke(this)}}),this.parser=t,this.extension=[Ht.of(this),B.languageData.of((s,o,l)=>{let a=io(s,o,l),h=a.type.prop(yt);if(!h)return[];let f=s.facet(h),u=a.type.prop(Lu);if(u){let c=a.resolve(o-a.from,l);for(let d of u)if(d.test(c,s)){let p=s.facet(d.facet);return d.type=="replace"?p:p.concat(f)}}return f})].concat(i)}isActiveAt(e,t,i=-1){return io(e,t,i).type.prop(yt)==this.data}findRegions(e){let t=e.facet(Ht);if(t?.data==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let i=[],r=(s,o)=>{if(s.prop(yt)==this.data){i.push({from:o,to:o+s.length});return}let l=s.prop(P.mounted);if(l){if(l.tree.prop(yt)==this.data){if(l.overlay)for(let a of l.overlay)i.push({from:a.from+o,to:a.to+o});else i.push({from:o,to:o+s.length});return}else if(l.overlay){let a=i.length;if(r(l.tree,l.overlay[0].from+o),i.length>a)return}}for(let a=0;a<s.children.length;a++){let h=s.children[a];h instanceof j&&r(h,s.positions[a]+o)}};return r(Ke(e),0),i}get allowsNesting(){return!0}}ke.setState=Y.define();function io(n,e,t){let i=n.facet(Ht),r=Ke(n).topNode;if(!i||i.allowsNesting)for(let s=r;s;s=s.enter(e,t,F.ExcludeBuffers|F.EnterBracketed))s.type.isTop&&(r=s);return r}class gr extends ke{constructor(e,t,i){super(e,t,[],i),this.parser=t}static define(e){let t=Wl(e.languageData);return new gr(t,e.parser.configure({props:[yt.add(i=>i.isTop?t:void 0)]}),e.name)}configure(e,t){return new gr(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Ke(n){let e=n.field(ke.state,!1);return e?e.tree:j.empty}class Pu{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 i=this.cursorPos-this.string.length;return e<i||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-i,t-i)}}let Ut=null;class Nt{constructor(e,t,i=[],r,s,o,l,a){this.parser=e,this.state=t,this.fragments=i,this.tree=r,this.treeLen=s,this.viewport=o,this.skipped=l,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(e,t,i){return new Nt(e,t,[],j.empty,0,i,[],null)}startParse(){return this.parser.startParse(new Pu(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=j.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var i;if(typeof e=="number"){let r=Date.now()+e;e=()=>Date.now()>r}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let r=this.parse.advance();if(r)if(this.fragments=this.withoutTempSkipped(Je.addTree(r,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(i=this.parse.stoppedAt)!==null&&i!==void 0?i:this.state.doc.length,this.tree=r,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(Je.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=Ut;Ut=this;try{return e()}finally{Ut=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=no(e,t.from,t.to);return e}changes(e,t){let{fragments:i,tree:r,treeLen:s,viewport:o,skipped:l}=this;if(this.takeTree(),!e.empty){let a=[];if(e.iterChangedRanges((h,f,u,c)=>a.push({fromA:h,toA:f,fromB:u,toB:c})),i=Je.applyChanges(i,a),r=j.empty,s=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){l=[];for(let h of this.skipped){let f=e.mapPos(h.from,1),u=e.mapPos(h.to,-1);f<u&&l.push({from:f,to:u})}}}return new Nt(this.parser,t,i,r,s,o,l,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 i=0;i<this.skipped.length;i++){let{from:r,to:s}=this.skipped[i];r<e.to&&s>e.from&&(this.fragments=no(this.fragments,r,s),this.skipped.splice(i--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends Bl{createParse(t,i,r){let s=r[0].from,o=r[r.length-1].to;return{parsedPos:s,advance(){let a=Ut;if(a){for(let h of r)a.tempSkipped.push(h);e&&(a.scheduleOn=a.scheduleOn?Promise.all([a.scheduleOn,e]):e)}return this.parsedPos=o,new j(ue.none,[],[],o-s)},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 Ut}}function no(n,e,t){return Je.applyChanges(n,[{fromA:e,toA:t,fromB:e,toB:t}])}class Wt{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),i=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,i)||t.takeTree(),new Wt(t)}static init(e){let t=Math.min(3e3,e.doc.length),i=Nt.create(e.facet(Ht).parser,e,{from:0,to:t});return i.work(20,t)||i.takeTree(),new Wt(i)}}ke.state=at.define({create:Wt.init,update(n,e){for(let t of e.effects)if(t.is(ke.setState))return t.value;return e.startState.facet(Ht)!=e.state.facet(Ht)?Wt.init(e.state):n.apply(e)}});let Hl=n=>{let e=setTimeout(()=>n(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(Hl=n=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(n,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const Mn=typeof navigator<"u"&&(!((Dn=navigator.scheduling)===null||Dn===void 0)&&Dn.isInputPending)?()=>navigator.scheduling.isInputPending():null,Ru=Te.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(ke.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(ke.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=Hl(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:i,viewport:{to:r}}=this.view,s=i.field(ke.state);if(s.tree==s.context.tree&&s.context.isDone(r+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!Mn?Math.max(25,e.timeRemaining()-5):1e9),l=s.context.treeLen<r&&i.doc.length>r+1e3,a=s.context.work(()=>Mn&&Mn()||Date.now()>o,r+(l?0:1e5));this.chunkBudget-=Date.now()-t,(a||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:ke.setState.of(new Wt(s.context))})),this.chunkBudget>0&&!(a&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>We(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Ht=D.define({combine(n){return n.length?n[0]:null},enables:n=>[ke.state,Ru,O.contentAttributes.compute([n],e=>{let t=e.facet(n);return t&&t.name?{"data-language":t.name}:{}})]});class Iu{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}class m{constructor(e,t,i,r,s,o=void 0){this.name=e,this.alias=t,this.extensions=i,this.filename=r,this.loadFunc=s,this.support=o,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then(e=>this.support=e,e=>{throw this.loading=null,e}))}static of(e){let{load:t,support:i}=e;if(!t){if(!i)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");t=()=>Promise.resolve(i)}return new m(e.name,(e.alias||[]).concat(e.name).map(r=>r.toLowerCase()),e.extensions||[],e.filename,t,i)}static matchFilename(e,t){for(let r of e)if(r.filename&&r.filename.test(t))return r;let i=/\.([^.]+)$/.exec(t);if(i){for(let r of e)if(r.extensions.indexOf(i[1])>-1)return r}return null}static matchLanguageName(e,t,i=!0){t=t.toLowerCase();for(let r of e)if(r.alias.some(s=>s==t))return r;if(i)for(let r of e)for(let s of r.alias){let o=t.indexOf(s);if(o>-1&&(s.length>2||!/\w/.test(t[o-1])&&!/\w/.test(t[o+s.length])))return r}return null}}const Bu=D.define(),jr=D.define({combine:n=>{if(!n.length)return" ";let e=n[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(n[0]));return e}});function St(n){let e=n.facet(jr);return e.charCodeAt(0)==9?n.tabSize*e.length:e.length}function ci(n,e){let t="",i=n.tabSize,r=n.facet(jr)[0];if(r==" "){for(;e>=i;)t+=" ",e-=i;r=" "}for(let s=0;s<e;s++)t+=r;return t}function Kr(n,e){n instanceof B&&(n=new an(n));for(let i of n.state.facet(Bu)){let r=i(n,e);if(r!==void 0)return r}let t=Ke(n.state);return t.length>=e?Vu(n,t,e):null}class an{constructor(e,t={}){this.state=e,this.options=t,this.unit=St(e)}lineAt(e,t=1){let i=this.state.doc.lineAt(e),{simulateBreak:r,simulateDoubleBreak:s}=this.options;return r!=null&&r>=i.from&&r<=i.to?s&&r==e?{text:"",from:e}:(t<0?r<e:r<=e)?{text:i.text.slice(r-i.from),from:r}:{text:i.text.slice(0,r-i.from),from:i.from}:i}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:i,from:r}=this.lineAt(e,t);return i.slice(e-r,Math.min(i.length,e+100-r))}column(e,t=1){let{text:i,from:r}=this.lineAt(e,t),s=this.countColumn(i,e-r),o=this.options.overrideIndentation?this.options.overrideIndentation(r):-1;return o>-1&&(s+=o-this.countColumn(i,i.search(/\S|$/))),s}countColumn(e,t=e.length){return tn(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:i,from:r}=this.lineAt(e,t),s=this.options.overrideIndentation;if(s){let o=s(r);if(o>-1)return o}return this.countColumn(i,i.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const Fl=new P;function Vu(n,e,t){let i=e.resolveStack(t),r=e.resolveInner(t,-1).resolve(t,0).enterUnfinishedNodesBefore(t);if(r!=i.node){let s=[];for(let o=r;o&&!(o.from<i.node.from||o.to>i.node.to||o.from==i.node.from&&o.type==i.node.type);o=o.parent)s.push(o);for(let o=s.length-1;o>=0;o--)i={node:s[o],next:i}}return zl(i,n,t)}function zl(n,e,t){for(let i=n;i;i=i.next){let r=Wu(i.node);if(r)return r(qr.create(e,t,i))}return 0}function Nu(n){return n.pos==n.options.simulateBreak&&n.options.simulateDoubleBreak}function Wu(n){let e=n.type.prop(Fl);if(e)return e;let t=n.firstChild,i;if(t&&(i=t.type.prop(P.closedBy))){let r=n.lastChild,s=r&&i.indexOf(r.name)>-1;return o=>jl(o,!0,1,void 0,s&&!Nu(o)?r.from:void 0)}return n.parent==null?Hu:null}function Hu(){return 0}class qr extends an{constructor(e,t,i){super(e.state,e.options),this.base=e,this.pos=t,this.context=i}get node(){return this.context.node}static create(e,t,i){return new qr(e,t,i)}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 i=e.resolve(t.from);for(;i.parent&&i.parent.from==i.from;)i=i.parent;if(Fu(i,e))break;t=this.state.doc.lineAt(i.from)}return this.lineIndent(t.from)}continue(){return zl(this.context.next,this.base,this.pos)}}function Fu(n,e){for(let t=e;t;t=t.parent)if(n==t)return!0;return!1}function zu(n){let e=n.node,t=e.childAfter(e.from),i=e.lastChild;if(!t)return null;let r=n.options.simulateBreak,s=n.state.doc.lineAt(t.from),o=r==null||r<=s.from?s.to:Math.min(s.to,r);for(let l=t.to;;){let a=e.childAfter(l);if(!a||a==i)return null;if(!a.type.isSkipped){if(a.from>=o)return null;let h=/^ */.exec(s.text.slice(t.to-s.from))[0].length;return{from:t.from,to:t.to+h}}l=a.to}}function Id({closing:n,align:e=!0,units:t=1}){return i=>jl(i,e,t,n)}function jl(n,e,t,i,r){let s=n.textAfter,o=s.match(/^\s*/)[0].length,l=i&&s.slice(o,o+i.length)==i||r==n.pos+o,a=e?zu(n):null;return a?l?n.column(a.from):n.column(a.to):n.baseIndent+(l?0:n.unit*t)}const Bd=n=>n.baseIndent;function Vd({except:n,units:e=1}={}){return t=>{let i=n&&n.test(t.textAfter);return t.baseIndent+(i?0:e*t.unit)}}const ju=200;function Ku(){return B.transactionFilter.of(n=>{if(!n.docChanged||!n.isUserEvent("input.type")&&!n.isUserEvent("input.complete"))return n;let e=n.startState.languageDataAt("indentOnInput",n.startState.selection.main.head);if(!e.length)return n;let t=n.newDoc,{head:i}=n.newSelection.main,r=t.lineAt(i);if(i>r.from+ju)return n;let s=t.sliceString(r.from,i);if(!e.some(h=>h.test(s)))return n;let{state:o}=n,l=-1,a=[];for(let{head:h}of o.selection.ranges){let f=o.doc.lineAt(h);if(f.from==l)continue;l=f.from;let u=Kr(o,f.from);if(u==null)continue;let c=/^\s*/.exec(f.text)[0],d=ci(o,u);c!=d&&a.push({from:f.from,to:f.from+c.length,insert:d})}return a.length?[n,{changes:a,sequential:!0}]:n})}const Nd=D.define(),Wd=new P;function Hd(n){let e=n.firstChild,t=n.lastChild;return e&&e.to<t.from?{from:e.to,to:t.type.isError?n.to:t.from}:null}class hn{constructor(e,t){this.specs=e;let i;function r(l){let a=rt.newName();return(i||(i=Object.create(null)))["."+a]=l,a}const s=typeof t.all=="string"?t.all:t.all?r(t.all):void 0,o=t.scope;this.scope=o instanceof ke?l=>l.prop(yt)==o.data:o?l=>l==o:void 0,this.style=Nl(e.map(l=>({tag:l.tag,class:l.class||r(Object.assign({},l,{tag:null}))})),{all:s}).style,this.module=i?new rt(i):null,this.themeType=t.themeType}static define(e,t){return new hn(e,t||{})}}const mr=D.define(),qu=D.define({combine(n){return n.length?[n[0]]:null}});function On(n){let e=n.facet(mr);return e.length?e:n.facet(qu)}function Uu(n,e){let t=[Gu],i;return n instanceof hn&&(n.module&&t.push(O.styleModule.of(n.module)),i=n.themeType),i?t.push(mr.computeN([O.darkTheme],r=>r.facet(O.darkTheme)==(i=="dark")?[n]:[])):t.push(mr.of(n)),t}class $u{constructor(e){this.markCache=Object.create(null),this.tree=Ke(e.state),this.decorations=this.buildDeco(e,On(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=Ke(e.state),i=On(e.state),r=i!=On(e.startState),{viewport:s}=e.view,o=e.changes.mapPos(this.decoratedTo,1);t.length<s.to&&!r&&t.type==this.tree.type&&o>=s.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(t!=this.tree||e.viewportChanged||r)&&(this.tree=t,this.decorations=this.buildDeco(e.view,i),this.decoratedTo=s.to)}buildDeco(e,t){if(!t||!this.tree.length)return z.none;let i=new ni;for(let{from:r,to:s}of e.visibleRanges)Du(this.tree,t,(o,l,a)=>{i.add(o,l,this.markCache[a]||(this.markCache[a]=z.mark({class:a})))},r,s);return i.finish()}}const Gu=Cr.high(Te.fromClass($u,{decorations:n=>n.decorations})),Ju=O.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Kl=1e4,ql="()[]{}",Ul=D.define({combine(n){return _r(n,{afterCursor:!0,brackets:ql,maxScanDistance:Kl,renderMatch:Qu})}}),Xu=z.mark({class:"cm-matchingBracket"}),Yu=z.mark({class:"cm-nonmatchingBracket"});function Qu(n){let e=[],t=n.matched?Xu:Yu;return e.push(t.range(n.start.from,n.start.to)),n.end&&e.push(t.range(n.end.from,n.end.to)),e}function ro(n){let e=[],t=n.facet(Ul);for(let i of n.selection.ranges){if(!i.empty)continue;let r=Fe(n,i.head,-1,t)||i.head>0&&Fe(n,i.head-1,1,t)||t.afterCursor&&(Fe(n,i.head,1,t)||i.head<n.doc.length&&Fe(n,i.head+1,-1,t));r&&(e=e.concat(t.renderMatch(r,n)))}return z.set(e,!0)}const Zu=Te.fromClass(class{constructor(n){this.paused=!1,this.decorations=ro(n.state)}update(n){(n.docChanged||n.selectionSet||this.paused)&&(n.view.composing?(this.decorations=this.decorations.map(n.changes),this.paused=!0):(this.decorations=ro(n.state),this.paused=!1))}},{decorations:n=>n.decorations}),ec=[Zu,Ju];function tc(n={}){return[Ul.of(n),ec]}const ic=new P;function yr(n,e,t){let i=n.prop(e<0?P.openedBy:P.closedBy);if(i)return i;if(n.name.length==1){let r=t.indexOf(n.name);if(r>-1&&r%2==(e<0?1:0))return[t[r+e]]}return null}function xr(n){let e=n.type.prop(ic);return e?e(n.node):n}function Fe(n,e,t,i={}){let r=i.maxScanDistance||Kl,s=i.brackets||ql,o=Ke(n),l=o.resolveInner(e,t);for(let a=l;a;a=a.parent){let h=yr(a.type,t,s);if(h&&a.from<a.to){let f=xr(a);if(f&&(t>0?e>=f.from&&e<f.to:e>f.from&&e<=f.to))return nc(n,e,t,a,f,h,s)}}return rc(n,e,t,o,l.type,r,s)}function nc(n,e,t,i,r,s,o){let l=i.parent,a={from:r.from,to:r.to},h=0,f=l?.cursor();if(f&&(t<0?f.childBefore(i.from):f.childAfter(i.to)))do if(t<0?f.to<=i.from:f.from>=i.to){if(h==0&&s.indexOf(f.type.name)>-1&&f.from<f.to){let u=xr(f);return{start:a,end:u?{from:u.from,to:u.to}:void 0,matched:!0}}else if(yr(f.type,t,o))h++;else if(yr(f.type,-t,o)){if(h==0){let u=xr(f);return{start:a,end:u&&u.from<u.to?{from:u.from,to:u.to}:void 0,matched:!1}}h--}}while(t<0?f.prevSibling():f.nextSibling());return{start:a,matched:!1}}function rc(n,e,t,i,r,s,o){if(t<0?!e:e==n.doc.length)return null;let l=t<0?n.sliceDoc(e-1,e):n.sliceDoc(e,e+1),a=o.indexOf(l);if(a<0||a%2==0!=t>0)return null;let h={from:t<0?e-1:e,to:t>0?e+1:e},f=n.doc.iterRange(e,t>0?n.doc.length:0),u=0;for(let c=0;!f.next().done&&c<=s;){let d=f.value;t<0&&(c+=d.length);let p=e+c*t;for(let g=t>0?0:d.length-1,y=t>0?d.length:-1;g!=y;g+=t){let b=o.indexOf(d[g]);if(!(b<0||i.resolveInner(p+g,1).type!=r))if(b%2==0==t>0)u++;else{if(u==1)return{start:h,end:{from:p+g,to:p+g+1},matched:b>>1==a>>1};u--}}t>0&&(c+=d.length)}return f.done?{start:h,matched:!1}:null}function so(n,e,t,i=0,r=0){e==null&&(e=n.search(/[^\s\u00a0]/),e==-1&&(e=n.length));let s=r;for(let o=i;o<e;o++)n.charCodeAt(o)==9?s+=t-s%t:s++;return s}class $l{constructor(e,t,i,r){this.string=e,this.tabSize=t,this.indentUnit=i,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),i;if(typeof e=="string"?i=t==e:i=t&&(e instanceof RegExp?e.test(t):e(t)),i)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=so(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue}indentation(){var e;return(e=this.overrideIndent)!==null&&e!==void 0?e:so(this.string,null,this.tabSize)}match(e,t,i){if(typeof e=="string"){let r=o=>i?o.toLowerCase():o,s=this.string.substr(this.pos,e.length);return r(s)==r(e)?(t!==!1&&(this.pos+=e.length),!0):null}else{let r=this.string.slice(this.pos).match(e);return r&&r.index>0?null:(r&&t!==!1&&(this.pos+=r[0].length),r)}}current(){return this.string.slice(this.start,this.pos)}}function sc(n){return{name:n.name||"",token:n.token,blankLine:n.blankLine||(()=>{}),startState:n.startState||(()=>!0),copyState:n.copyState||oc,indent:n.indent||(()=>null),languageData:n.languageData||{},tokenTable:n.tokenTable||Gr,mergeTokens:n.mergeTokens!==!1}}function oc(n){if(typeof n!="object")return n;let e={};for(let t in n){let i=n[t];e[t]=i instanceof Array?i.slice():i}return e}const oo=new WeakMap;class Ur extends ke{constructor(e){let t=Wl(e.languageData),i=sc(e),r,s=new class extends Bl{createParse(o,l,a){return new ac(r,o,l,a)}};super(t,s,[],e.name),this.topNode=uc(t,this),r=this,this.streamParser=i,this.stateAfter=new P({perNode:!0}),this.tokenTable=e.tokenTable?new Yl(i.tokenTable):fc}static define(e){return new Ur(e)}getIndent(e){let t,{overrideIndentation:i}=e.options;i&&(t=oo.get(e.state),t!=null&&t<e.pos-1e4&&(t=void 0));let r=$r(this,e.node.tree,e.node.from,e.node.from,t??e.pos),s,o;if(r?(o=r.state,s=r.pos+1):(o=this.streamParser.startState(e.unit),s=e.node.from),e.pos-s>1e4)return null;for(;s<e.pos;){let a=e.state.doc.lineAt(s),h=Math.min(e.pos,a.to);if(a.length){let f=i?i(a.from):-1,u=new $l(a.text,e.state.tabSize,e.unit,f<0?void 0:f);for(;u.pos<h-a.from;)Jl(this.streamParser.token,u,o)}else this.streamParser.blankLine(o,e.unit);if(h==e.pos)break;s=a.to+1}let l=e.lineAt(e.pos);return i&&t==null&&oo.set(e.state,l.from),this.streamParser.indent(o,/^\s*(.*)/.exec(l.text)[1],e)}get allowsNesting(){return!1}}function $r(n,e,t,i,r){let s=t>=i&&t+e.length<=r&&e.prop(n.stateAfter);if(s)return{state:n.streamParser.copyState(s),pos:t+e.length};for(let o=e.children.length-1;o>=0;o--){let l=e.children[o],a=t+e.positions[o],h=l instanceof j&&a<r&&$r(n,l,a,i,r);if(h)return h}return null}function Gl(n,e,t,i,r){if(r&&t<=0&&i>=e.length)return e;!r&&t==0&&e.type==n.topNode&&(r=!0);for(let s=e.children.length-1;s>=0;s--){let o=e.positions[s],l=e.children[s],a;if(o<i&&l instanceof j){if(!(a=Gl(n,l,t-o,i-o,r)))break;return r?new j(e.type,e.children.slice(0,s).concat(a),e.positions.slice(0,s+1),o+a.length):a}}return null}function lc(n,e,t,i,r){for(let s of e){let o=s.from+(s.openStart?25:0),l=s.to-(s.openEnd?25:0),a=o<=t&&l>t&&$r(n,s.tree,0-s.offset,t,l),h;if(a&&a.pos<=i&&(h=Gl(n,s.tree,t+s.offset,a.pos+s.offset,!1)))return{state:a.state,tree:h}}return{state:n.streamParser.startState(r?St(r):4),tree:j.empty}}class ac{constructor(e,t,i,r){this.lang=e,this.input=t,this.fragments=i,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 s=Nt.get(),o=r[0].from,{state:l,tree:a}=lc(e,i,o,this.to,s?.state);this.state=l,this.parsedPos=this.chunkStart=o+a.length;for(let h=0;h<a.children.length;h++)this.chunks.push(a.children[h]),this.chunkPos.push(a.positions[h]);s&&this.parsedPos<s.viewport.from-1e5&&r.some(h=>h.from<=s.viewport.from&&h.to>=s.viewport.from)&&(this.state=this.lang.streamParser.startState(St(s.state)),s.skipUntilInView(this.parsedPos,s.viewport.from),this.parsedPos=s.viewport.from),this.moveRangeIndex()}advance(){let e=Nt.get(),t=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt),i=Math.min(t,this.chunkStart+512);for(e&&(i=Math.min(i,e.viewport.to));this.parsedPos<i;)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==`
12
12
  `&&(t="");else{let i=t.indexOf(`
13
- `);i>-1&&(t=t.slice(0,i))}return e+t.length<=this.to?t:t.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,t=this.lineAfter(e),i=e+t.length;for(let r=this.rangeIndex;;){let s=this.ranges[r].to;if(s>=i||(t=t.slice(0,s-(i-t.length)),r++,r==this.ranges.length))break;let o=this.ranges[r].from,l=this.lineAfter(o);t+=l,i=o+l.length}return{line:t,end:i}}skipGapsTo(e,t,i){for(;;){let r=this.ranges[this.rangeIndex].to,s=e+t;if(i>0?r>s:r>=s)break;let o=this.ranges[++this.rangeIndex].from;t+=o-r}return t}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}emitToken(e,t,i,r){let s=4;if(this.ranges.length>1){r=this.skipGapsTo(t,r,1),t+=r;let l=this.chunk.length;r=this.skipGapsTo(i,r,-1),i+=r,s+=this.chunk.length-l}let o=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&s==4&&o>=0&&this.chunk[o]==e&&this.chunk[o+2]==t?this.chunk[o+2]=i:this.chunk.push(e,t,i,s),r}parseLine(e){let{line:t,end:i}=this.nextLine(),r=0,{streamParser:s}=this.lang,o=new $l(t,e?e.state.tabSize:4,e?St(e.state):2);if(o.eol())s.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let l=Jl(s.token,o,this.state);if(l&&(r=this.emitToken(this.lang.tokenTable.resolve(l),this.parsedPos+o.start,this.parsedPos+o.pos,r)),o.start>1e4)break}this.parsedPos=i,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}finishChunk(){let e=j.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:hc,topID:0,maxBufferLength:512,reused:this.chunkReused});e=new j(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 j(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}}function Jl(n,e,t){e.start=e.pos;for(let i=0;i<10;i++){let r=n(e,t);if(e.pos>e.start)return r}throw new Error("Stream parser failed to advance stream.")}const Gr=Object.create(null),di=[ue.none],hc=new Wr(di),lo=[],ao=Object.create(null),Xl=Object.create(null);for(let[n,e]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"]])Xl[n]=Ql(Gr,e);class Yl{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),Xl)}resolve(e){return e?this.table[e]||(this.table[e]=Ql(this.extra,e)):0}}const fc=new Yl(Gr);function Ln(n,e){lo.indexOf(n)>-1||(lo.push(n),console.warn(e))}function Ql(n,e){let t=[];for(let l of e.split(" ")){let a=[];for(let h of l.split(".")){let f=n[h]||C[h];f?typeof f=="function"?a.length?a=a.map(f):Ln(h,`Modifier ${h} used at start of tag`):a.length?Ln(h,`Tag ${h} used as modifier`):a=Array.isArray(f)?f:[f]:Ln(h,`Unknown highlighting tag ${h}`)}for(let h of a)t.push(h)}if(!t.length)return 0;let i=e.replace(/ /g,"_"),r=i+" "+t.map(l=>l.id),s=ao[r];if(s)return s.id;let o=ao[r]=ue.define({id:di.length,name:i,props:[Tu({[i]:t})]});return di.push(o),o.id}function uc(n,e){let t=ue.define({id:di.length,name:"Document",props:[yt.add(()=>n),Fl.add(()=>i=>e.getIndent(i))],top:!0});return di.push(t),t}Q.RTL,Q.LTR;const cc=n=>{let{state:e}=n,t=e.doc.lineAt(e.selection.main.from),i=Xr(n.state,t.from);return i.line?dc(n):i.block?gc(n):!1};function Jr(n,e){return({state:t,dispatch:i})=>{if(t.readOnly)return!1;let r=n(e,t);return r?(i(t.update(r)),!0):!1}}const dc=Jr(xc,0),pc=Jr(Zl,0),gc=Jr((n,e)=>Zl(n,e,yc(e)),0);function Xr(n,e){let t=n.languageDataAt("commentTokens",e,1);return t.length?t[0]:{}}const $t=50;function mc(n,{open:e,close:t},i,r){let s=n.sliceDoc(i-$t,i),o=n.sliceDoc(r,r+$t),l=/\s*$/.exec(s)[0].length,a=/^\s*/.exec(o)[0].length,h=s.length-l;if(s.slice(h-e.length,h)==e&&o.slice(a,a+t.length)==t)return{open:{pos:i-l,margin:l&&1},close:{pos:r+a,margin:a&&1}};let f,u;r-i<=2*$t?f=u=n.sliceDoc(i,r):(f=n.sliceDoc(i,i+$t),u=n.sliceDoc(r-$t,r));let c=/^\s*/.exec(f)[0].length,d=/\s*$/.exec(u)[0].length,p=u.length-d-t.length;return f.slice(c,c+e.length)==e&&u.slice(p,p+t.length)==t?{open:{pos:i+c+e.length,margin:/\s/.test(f.charAt(c+e.length))?1:0},close:{pos:r-d-t.length,margin:/\s/.test(u.charAt(p-1))?1:0}}:null}function yc(n){let e=[];for(let t of n.selection.ranges){let i=n.doc.lineAt(t.from),r=t.to<=i.to?i:n.doc.lineAt(t.to);r.from>i.from&&r.from==t.to&&(r=t.to==i.to+1?i:n.doc.lineAt(t.to-1));let s=e.length-1;s>=0&&e[s].to>i.from?e[s].to=r.to:e.push({from:i.from+/^\s*/.exec(i.text)[0].length,to:r.to})}return e}function Zl(n,e,t=e.selection.ranges){let i=t.map(s=>Xr(e,s.from).block);if(!i.every(s=>s))return null;let r=t.map((s,o)=>mc(e,i[o],s.from,s.to));if(n!=2&&!r.every(s=>s))return{changes:e.changes(t.map((s,o)=>r[o]?[]:[{from:s.from,insert:i[o].open+" "},{from:s.to,insert:" "+i[o].close}]))};if(n!=1&&r.some(s=>s)){let s=[];for(let o=0,l;o<r.length;o++)if(l=r[o]){let a=i[o],{open:h,close:f}=l;s.push({from:h.pos-a.open.length,to:h.pos+h.margin},{from:f.pos-f.margin,to:f.pos+a.close.length})}return{changes:s}}return null}function xc(n,e,t=e.selection.ranges){let i=[],r=-1;e:for(let{from:s,to:o}of t){let l=i.length,a=1e9,h;for(let f=s;f<=o;){let u=e.doc.lineAt(f);if(h==null&&(h=Xr(e,u.from).line,!h))continue e;if(u.from>r&&(s==o||o>u.from)){r=u.from;let c=/^\s*/.exec(u.text)[0].length,d=c==u.length,p=u.text.slice(c,c+h.length)==h?c:-1;c<u.text.length&&c<a&&(a=c),i.push({line:u,comment:p,token:h,indent:c,empty:d,single:!1})}f=u.to+1}if(a<1e9)for(let f=l;f<i.length;f++)i[f].indent<i[f].line.text.length&&(i[f].indent=a);i.length==l+1&&(i[l].single=!0)}if(n!=2&&i.some(s=>s.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:l,token:a,indent:h,empty:f,single:u}of i)(u||!f)&&s.push({from:l.from+h,insert:a+" "});let o=e.changes(s);return{changes:o,selection:e.selection.map(o,1)}}else if(n!=1&&i.some(s=>s.comment>=0)){let s=[];for(let{line:o,comment:l,token:a}of i)if(l>=0){let h=o.from+l,f=h+a.length;o.text[f-o.from]==" "&&f++,s.push({from:h,to:f})}return{changes:s}}return null}const br=ht.define(),bc=ht.define(),wc=D.define(),ea=D.define({combine(n){return _r(n,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(i,r)=>e(i,r)||t(i,r)})}}),ta=at.define({create(){return ze.empty},update(n,e){let t=e.state.facet(ea),i=e.annotation(br);if(i){let a=de.fromTransaction(e,i.selection),h=i.side,f=h==0?n.undone:n.done;return a?f=en(f,f.length,t.minDepth,a):f=ra(f,e.startState.selection),new ze(h==0?i.rest:f,h==0?f:i.rest)}let r=e.annotation(bc);if((r=="full"||r=="before")&&(n=n.isolate()),e.annotation(ee.addToHistory)===!1)return e.changes.empty?n:n.addMapping(e.changes.desc);let s=de.fromTransaction(e),o=e.annotation(ee.time),l=e.annotation(ee.userEvent);return s?n=n.addChanges(s,o,l,t,e):e.selection&&(n=n.addSelection(e.startState.selection,o,l,t.newGroupDelay)),(r=="full"||r=="after")&&(n=n.isolate()),n},toJSON(n){return{done:n.done.map(e=>e.toJSON()),undone:n.undone.map(e=>e.toJSON())}},fromJSON(n){return new ze(n.done.map(de.fromJSON),n.undone.map(de.fromJSON))}});function vc(n={}){return[ta,ea.of(n),O.domEventHandlers({beforeinput(e,t){let i=e.inputType=="historyUndo"?ia:e.inputType=="historyRedo"?wr:null;return i?(e.preventDefault(),i(t)):!1}})]}function fn(n,e){return function({state:t,dispatch:i}){if(!e&&t.readOnly)return!1;let r=t.field(ta,!1);if(!r)return!1;let s=r.pop(n,t,e);return s?(i(s),!0):!1}}const ia=fn(0,!1),wr=fn(1,!1),kc=fn(0,!0),Sc=fn(1,!0);class de{constructor(e,t,i,r,s){this.changes=e,this.effects=t,this.mapped=i,this.startSelection=r,this.selectionsAfter=s}setSelAfter(e){return new de(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,i;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(i=this.startSelection)===null||i===void 0?void 0:i.toJSON(),selectionsAfter:this.selectionsAfter.map(r=>r.toJSON())}}static fromJSON(e){return new de(e.changes&&Z.fromJSON(e.changes),[],e.mapped&&je.fromJSON(e.mapped),e.startSelection&&v.fromJSON(e.startSelection),e.selectionsAfter.map(v.fromJSON))}static fromTransaction(e,t){let i=Se;for(let r of e.startState.facet(wc)){let s=r(e);s.length&&(i=i.concat(s))}return!i.length&&e.changes.empty?null:new de(e.changes.invert(e.startState.doc),i,void 0,t||e.startState.selection,Se)}static selection(e){return new de(void 0,Se,void 0,void 0,e)}}function en(n,e,t,i){let r=e+1>t+20?e-t-1:0,s=n.slice(r,e);return s.push(i),s}function Ac(n,e){let t=[],i=!1;return n.iterChangedRanges((r,s)=>t.push(r,s)),e.iterChangedRanges((r,s,o,l)=>{for(let a=0;a<t.length;){let h=t[a++],f=t[a++];l>=h&&o<=f&&(i=!0)}}),i}function Cc(n,e){return n.ranges.length==e.ranges.length&&n.ranges.filter((t,i)=>t.empty!=e.ranges[i].empty).length===0}function na(n,e){return n.length?e.length?n.concat(e):n:e}const Se=[],_c=200;function ra(n,e){if(n.length){let t=n[n.length-1],i=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-_c));return i.length&&i[i.length-1].eq(e)?n:(i.push(e),en(n,n.length-1,1e9,t.setSelAfter(i)))}else return[de.selection([e])]}function Tc(n){let e=n[n.length-1],t=n.slice();return t[n.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),t}function Pn(n,e){if(!n.length)return n;let t=n.length,i=Se;for(;t;){let r=Ec(n[t-1],e,i);if(r.changes&&!r.changes.empty||r.effects.length){let s=n.slice(0,t);return s[t-1]=r,s}else e=r.mapped,t--,i=r.selectionsAfter}return i.length?[de.selection(i)]:Se}function Ec(n,e,t){let i=na(n.selectionsAfter.length?n.selectionsAfter.map(l=>l.map(e)):Se,t);if(!n.changes)return de.selection(i);let r=n.changes.map(e),s=e.mapDesc(n.changes,!0),o=n.mapped?n.mapped.composeDesc(s):s;return new de(r,Y.mapEffects(n.effects,e),o,n.startSelection.map(s),i)}const Dc=/^(input\.type|delete)($|\.)/;class ze{constructor(e,t,i=0,r=void 0){this.done=e,this.undone=t,this.prevTime=i,this.prevUserEvent=r}isolate(){return this.prevTime?new ze(this.done,this.undone):this}addChanges(e,t,i,r,s){let o=this.done,l=o[o.length-1];return l&&l.changes&&!l.changes.empty&&e.changes&&(!i||Dc.test(i))&&(!l.selectionsAfter.length&&t-this.prevTime<r.newGroupDelay&&r.joinToEvent(s,Ac(l.changes,e.changes))||i=="input.type.compose")?o=en(o,o.length-1,r.minDepth,new de(e.changes.compose(l.changes),na(Y.mapEffects(e.effects,l.changes),l.effects),l.mapped,l.startSelection,Se)):o=en(o,o.length,r.minDepth,e),new ze(o,Se,t,i)}addSelection(e,t,i,r){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:Se;return s.length>0&&t-this.prevTime<r&&i==this.prevUserEvent&&i&&/^select($|\.)/.test(i)&&Cc(s[s.length-1],e)?this:new ze(ra(this.done,e),this.undone,t,i)}addMapping(e){return new ze(Pn(this.done,e),Pn(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,i){let r=e==0?this.done:this.undone;if(r.length==0)return null;let s=r[r.length-1],o=s.selectionsAfter[0]||(s.startSelection?s.startSelection.map(s.changes.invertedDesc,1):t.selection);if(i&&s.selectionsAfter.length)return t.update({selection:s.selectionsAfter[s.selectionsAfter.length-1],annotations:br.of({side:e,rest:Tc(r),selection:o}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let l=r.length==1?Se:r.slice(0,r.length-1);return s.mapped&&(l=Pn(l,s.mapped)),t.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:br.of({side:e,rest:l,selection:o}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}ze.empty=new ze(Se,Se);const Mc=[{key:"Mod-z",run:ia,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:wr,preventDefault:!0},{linux:"Ctrl-Shift-z",run:wr,preventDefault:!0},{key:"Mod-u",run:kc,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Sc,preventDefault:!0}];function Ft(n,e){return v.create(n.ranges.map(e),n.mainIndex)}function De(n,e){return n.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function Me({state:n,dispatch:e},t){let i=Ft(n.selection,t);return i.eq(n.selection,!0)?!1:(e(De(n,i)),!0)}function un(n,e){return v.cursor(e?n.to:n.from)}function sa(n,e){return Me(n,t=>t.empty?n.moveByChar(t,e):un(t,e))}function le(n){return n.textDirectionAt(n.state.selection.main.head)==Q.LTR}const oa=n=>sa(n,!le(n)),la=n=>sa(n,le(n));function aa(n,e){return Me(n,t=>t.empty?n.moveByGroup(t,e):un(t,e))}const Oc=n=>aa(n,!le(n)),Lc=n=>aa(n,le(n));function Pc(n,e,t){if(e.type.prop(t))return!0;let i=e.to-e.from;return i&&(i>2||/[^\s,.;:]/.test(n.sliceDoc(e.from,e.to)))||e.firstChild}function cn(n,e,t){let i=Ke(n).resolveInner(e.head),r=t?P.closedBy:P.openedBy;for(let a=e.head;;){let h=t?i.childAfter(a):i.childBefore(a);if(!h)break;Pc(n,h,r)?i=h:a=t?h.to:h.from}let s=i.type.prop(r),o,l;return s&&(o=t?Fe(n,i.from,1):Fe(n,i.to,-1))&&o.matched?l=t?o.end.to:o.end.from:l=t?i.to:i.from,v.cursor(l,t?-1:1)}const Rc=n=>Me(n,e=>cn(n.state,e,!le(n))),Ic=n=>Me(n,e=>cn(n.state,e,le(n)));function ha(n,e){return Me(n,t=>{if(!t.empty)return un(t,e);let i=n.moveVertically(t,e);return i.head!=t.head?i:n.moveToLineBoundary(t,e)})}const fa=n=>ha(n,!1),ua=n=>ha(n,!0);function ca(n){let e=n.scrollDOM.clientHeight<n.scrollDOM.scrollHeight-2,t=0,i=0,r;if(e){for(let s of n.state.facet(O.scrollMargins)){let o=s(n);o?.top&&(t=Math.max(o?.top,t)),o?.bottom&&(i=Math.max(o?.bottom,i))}r=n.scrollDOM.clientHeight-t-i}else r=(n.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:t,marginBottom:i,selfScroll:e,height:Math.max(n.defaultLineHeight,r-5)}}function da(n,e){let t=ca(n),{state:i}=n,r=Ft(i.selection,o=>o.empty?n.moveVertically(o,e,t.height):un(o,e));if(r.eq(i.selection))return!1;let s;if(t.selfScroll){let o=n.coordsAtPos(i.selection.main.head),l=n.scrollDOM.getBoundingClientRect(),a=l.top+t.marginTop,h=l.bottom-t.marginBottom;o&&o.top>a&&o.bottom<h&&(s=O.scrollIntoView(r.main.head,{y:"start",yMargin:o.top-a}))}return n.dispatch(De(i,r),{effects:s}),!0}const ho=n=>da(n,!1),vr=n=>da(n,!0);function ft(n,e,t){let i=n.lineBlockAt(e.head),r=n.moveToLineBoundary(e,t);if(r.head==e.head&&r.head!=(t?i.to:i.from)&&(r=n.moveToLineBoundary(e,t,!1)),!t&&r.head==i.from&&i.length){let s=/^\s*/.exec(n.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;s&&e.head!=i.from+s&&(r=v.cursor(i.from+s))}return r}const Bc=n=>Me(n,e=>ft(n,e,!0)),Vc=n=>Me(n,e=>ft(n,e,!1)),Nc=n=>Me(n,e=>ft(n,e,!le(n))),Wc=n=>Me(n,e=>ft(n,e,le(n))),Hc=n=>Me(n,e=>v.cursor(n.lineBlockAt(e.head).from,1)),Fc=n=>Me(n,e=>v.cursor(n.lineBlockAt(e.head).to,-1));function zc(n,e,t){let i=!1,r=Ft(n.selection,s=>{let o=Fe(n,s.head,-1)||Fe(n,s.head,1)||s.head>0&&Fe(n,s.head-1,1)||s.head<n.doc.length&&Fe(n,s.head+1,-1);if(!o||!o.end)return s;i=!0;let l=o.start.from==s.head?o.end.to:o.end.from;return v.cursor(l)});return i?(e(De(n,r)),!0):!1}const jc=({state:n,dispatch:e})=>zc(n,e);function Ae(n,e,t){let i=Ft(n.state.selection,r=>{r.undirectional&&r.head>=r.anchor!=e&&(r=v.range(r.head,r.anchor));let s=t(r);return v.range(r.anchor,s.head,s.goalColumn,s.bidiLevel||void 0,s.assoc)});return i.eq(n.state.selection)?!1:(n.dispatch(De(n.state,i)),!0)}function pa(n,e){return Ae(n,e,t=>n.moveByChar(t,e))}const ga=n=>pa(n,!le(n)),ma=n=>pa(n,le(n));function ya(n,e){return Ae(n,e,t=>n.moveByGroup(t,e))}const Kc=n=>ya(n,!le(n)),qc=n=>ya(n,le(n)),Uc=n=>{let e=!le(n);return Ae(n,e,t=>cn(n.state,t,e))},$c=n=>{let e=le(n);return Ae(n,e,t=>cn(n.state,t,e))};function xa(n,e){return Ae(n,e,t=>n.moveVertically(t,e))}const ba=n=>xa(n,!1),wa=n=>xa(n,!0);function va(n,e){return Ae(n,e,t=>n.moveVertically(t,e,ca(n).height))}const fo=n=>va(n,!1),uo=n=>va(n,!0),Gc=n=>Ae(n,!0,e=>ft(n,e,!0)),Jc=n=>Ae(n,!1,e=>ft(n,e,!1)),Xc=n=>{let e=!le(n);return Ae(n,e,t=>ft(n,t,e))},Yc=n=>{let e=le(n);return Ae(n,e,t=>ft(n,t,e))},Qc=n=>Ae(n,!1,e=>v.cursor(n.lineBlockAt(e.head).from)),Zc=n=>Ae(n,!0,e=>v.cursor(n.lineBlockAt(e.head).to)),co=({state:n,dispatch:e})=>(e(De(n,{anchor:0})),!0),po=({state:n,dispatch:e})=>(e(De(n,{anchor:n.doc.length})),!0),go=({state:n,dispatch:e})=>(e(De(n,{anchor:n.selection.main.anchor,head:0})),!0),mo=({state:n,dispatch:e})=>(e(De(n,{anchor:n.selection.main.anchor,head:n.doc.length})),!0),ed=({state:n,dispatch:e})=>(e(n.update({selection:{anchor:0,head:n.doc.length},userEvent:"select"})),!0),td=({state:n,dispatch:e})=>{let t=dn(n).map(({from:i,to:r})=>v.undirectionalRange(i,Math.min(r+1,n.doc.length)));return e(n.update({selection:v.create(t),userEvent:"select"})),!0},id=({state:n,dispatch:e})=>{let t=Ft(n.selection,i=>{let r=Ke(n),s=r.resolveStack(i.from,1);if(i.empty){let o=r.resolveStack(i.from,-1);o.node.from>=s.node.from&&o.node.to<=s.node.to&&(s=o)}for(let o=s;o;o=o.next){let{node:l}=o;if((l.from<i.from&&l.to>=i.to||l.to>i.to&&l.from<=i.from)&&o.next)return v.undirectionalRange(l.from,l.to)}return i});return t.eq(n.selection)?!1:(e(De(n,t)),!0)};function ka(n,e){let{state:t}=n,i=t.selection,r=t.selection.ranges.slice();for(let s of t.selection.ranges){let o=t.doc.lineAt(s.head);if(e?o.to<n.state.doc.length:o.from>0)for(let l=s;;){let a=n.moveVertically(l,e);if(a.head<o.from||a.head>o.to){r.some(h=>h.head==a.head)||r.push(a);break}else{if(a.head==l.head)break;l=a}}}return r.length==i.ranges.length?!1:(n.dispatch(De(t,v.create(r,r.length-1))),!0)}const nd=n=>ka(n,!1),rd=n=>ka(n,!0),sd=({state:n,dispatch:e})=>{let t=n.selection,i=null;return t.ranges.length>1?i=v.create([t.main]):t.main.empty||(i=v.create([v.cursor(t.main.head)])),i?(e(De(n,i)),!0):!1};function xi(n,e){if(n.state.readOnly)return!1;let t="delete.selection",{state:i}=n,r=i.changeByRange(s=>{let{from:o,to:l}=s;if(o==l){let a=e(s);a<o?(t="delete.backward",a=Bi(n,a,!1)):a>o&&(t="delete.forward",a=Bi(n,a,!0)),o=Math.min(o,a),l=Math.max(l,a)}else o=Bi(n,o,!1),l=Bi(n,l,!0);return o==l?{range:s}:{changes:{from:o,to:l},range:v.cursor(o,o<s.head?-1:1)}});return r.changes.empty?!1:(n.dispatch(i.update(r,{scrollIntoView:!0,userEvent:t,effects:t=="delete.selection"?O.announce.of(i.phrase("Selection deleted")):void 0})),!0)}function Bi(n,e,t){if(n instanceof O)for(let i of n.state.facet(O.atomicRanges).map(r=>r(n)))i.between(e,e,(r,s)=>{r<e&&s>e&&(e=t?s:r)});return e}const Sa=(n,e,t)=>xi(n,i=>{let r=i.from,{state:s}=n,o=s.doc.lineAt(r),l,a;if(t&&!e&&r>o.from&&r<o.from+200&&!/[^ \t]/.test(l=o.text.slice(0,r-o.from))){if(l[l.length-1]==" ")return r-1;let h=tn(l,s.tabSize),f=h%St(s)||St(s);for(let u=0;u<f&&l[l.length-1-u]==" ";u++)r--;a=r}else a=se(o.text,r-o.from,e,e)+o.from,a==r&&o.number!=(e?s.doc.lines:1)?a+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(o.text.slice(a-o.from,r-o.from))&&(a=se(o.text,a-o.from,!1,!1)+o.from);return a}),kr=n=>Sa(n,!1,!0),Aa=n=>Sa(n,!0,!1),Ca=(n,e)=>xi(n,t=>{let i=t.head,{state:r}=n,s=r.doc.lineAt(i),o=r.charCategorizer(i);for(let l=null;;){if(i==(e?s.to:s.from)){i==t.head&&s.number!=(e?r.doc.lines:1)&&(i+=e?1:-1);break}let a=se(s.text,i-s.from,e)+s.from,h=s.text.slice(Math.min(i,a)-s.from,Math.max(i,a)-s.from),f=o(h);if(l!=null&&f!=l)break;(h!=" "||i!=t.head)&&(l=f),i=a}return i}),_a=n=>Ca(n,!1),od=n=>Ca(n,!0),ld=n=>xi(n,e=>{let t=n.lineBlockAt(e.head).to;return e.head<t?t:Math.min(n.state.doc.length,e.head+1)}),ad=n=>xi(n,e=>{let t=n.moveToLineBoundary(e,!1).head;return e.head>t?t:Math.max(0,e.head-1)}),hd=n=>xi(n,e=>{let t=n.moveToLineBoundary(e,!0).head;return e.head<t?t:Math.min(n.state.doc.length,e.head+1)}),fd=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(i=>({changes:{from:i.from,to:i.to,insert:N.of(["",""])},range:v.cursor(i.from)}));return e(n.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},ud=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(i=>{if(!i.empty||i.from==0||i.from==n.doc.length)return{range:i};let r=i.from,s=n.doc.lineAt(r),o=r==s.from?r-1:se(s.text,r-s.from,!1)+s.from,l=r==s.to?r+1:se(s.text,r-s.from,!0)+s.from;return{changes:{from:o,to:l,insert:n.doc.slice(r,l).append(n.doc.slice(o,r))},range:v.cursor(l)}});return t.changes.empty?!1:(e(n.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function dn(n){let e=[],t=-1;for(let i of n.selection.ranges){let r=n.doc.lineAt(i.from),s=n.doc.lineAt(i.to);if(!i.empty&&i.to==s.from&&(s=n.doc.lineAt(i.to-1)),t>=r.number){let o=e[e.length-1];o.to=s.to,o.ranges.push(i)}else e.push({from:r.from,to:s.to,ranges:[i]});t=s.number+1}return e}function Ta(n,e,t){if(n.readOnly)return!1;let i=[],r=[];for(let s of dn(n)){if(t?s.to==n.doc.length:s.from==0)continue;let o=n.doc.lineAt(t?s.to+1:s.from-1),l=o.length+1;if(t){i.push({from:s.to,to:o.to},{from:s.from,insert:o.text+n.lineBreak});for(let a of s.ranges)r.push(v.range(Math.min(n.doc.length,a.anchor+l),Math.min(n.doc.length,a.head+l)))}else{i.push({from:o.from,to:s.from},{from:s.to,insert:n.lineBreak+o.text});for(let a of s.ranges)r.push(v.range(a.anchor-l,a.head-l))}}return i.length?(e(n.update({changes:i,scrollIntoView:!0,selection:v.create(r,n.selection.mainIndex),userEvent:"move.line"})),!0):!1}const cd=({state:n,dispatch:e})=>Ta(n,e,!1),dd=({state:n,dispatch:e})=>Ta(n,e,!0);function Ea(n,e,t){if(n.readOnly)return!1;let i=[];for(let s of dn(n))t?i.push({from:s.from,insert:n.doc.slice(s.from,s.to)+n.lineBreak}):i.push({from:s.to,insert:n.lineBreak+n.doc.slice(s.from,s.to)});let r=n.changes(i);return e(n.update({changes:r,selection:n.selection.map(r,t?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const pd=({state:n,dispatch:e})=>Ea(n,e,!1),gd=({state:n,dispatch:e})=>Ea(n,e,!0),md=n=>{if(n.state.readOnly)return!1;let{state:e}=n,t=e.changes(dn(e).map(({from:r,to:s})=>(r>0?r--:s<e.doc.length&&s++,{from:r,to:s}))),i=Ft(e.selection,r=>{let s;if(n.lineWrapping){let o=n.lineBlockAt(r.head),l=n.coordsAtPos(r.head,r.assoc||1);l&&(s=o.bottom+n.documentTop-l.bottom+n.defaultLineHeight/2)}return n.moveVertically(r,!0,s)}).map(t);return n.dispatch({changes:t,selection:i,scrollIntoView:!0,userEvent:"delete.line"}),!0};function yd(n,e){if(/\(\)|\[\]|\{\}/.test(n.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=Ke(n).resolveInner(e),i=t.childBefore(e),r=t.childAfter(e),s;return i&&r&&i.to<=e&&r.from>=e&&(s=i.type.prop(P.closedBy))&&s.indexOf(r.name)>-1&&n.doc.lineAt(i.to).from==n.doc.lineAt(r.from).from&&!/\S/.test(n.sliceDoc(i.to,r.from))?{from:i.to,to:r.from}:null}const yo=Da(!1),xd=Da(!0);function Da(n){return({state:e,dispatch:t})=>{if(e.readOnly)return!1;let i=e.changeByRange(r=>{let{from:s,to:o}=r,l=e.doc.lineAt(s),a=!n&&s==o&&yd(e,s);n&&(s=o=(o<=l.to?l:e.doc.lineAt(o)).to);let h=new an(e,{simulateBreak:s,simulateDoubleBreak:!!a}),f=Kr(h,s);for(f==null&&(f=tn(/^\s*/.exec(e.doc.lineAt(s).text)[0],e.tabSize));o<l.to&&/\s/.test(l.text[o-l.from]);)o++;a?{from:s,to:o}=a:s>l.from&&s<l.from+100&&!/\S/.test(l.text.slice(0,s))&&(s=l.from);let u=["",ci(e,f)];return a&&u.push(ci(e,h.lineIndent(l.from,-1))),{changes:{from:s,to:o,insert:N.of(u)},range:v.cursor(s+1+u[1].length)}});return t(e.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}function Yr(n,e){let t=-1;return n.changeByRange(i=>{let r=[];for(let o=i.from;o<=i.to;){let l=n.doc.lineAt(o);l.number>t&&(i.empty||i.to>l.from)&&(e(l,r,i),t=l.number),o=l.to+1}let s=n.changes(r);return{changes:r,range:v.range(s.mapPos(i.anchor,1),s.mapPos(i.head,1))}})}const bd=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=Object.create(null),i=new an(n,{overrideIndentation:s=>{let o=t[s];return o??-1}}),r=Yr(n,(s,o,l)=>{let a=Kr(i,s.from);if(a==null)return;/\S/.test(s.text)||(a=0);let h=/^\s*/.exec(s.text)[0],f=ci(n,a);(h!=f||l.from<s.from+h.length)&&(t[s.from]=a,o.push({from:s.from,to:s.from+h.length,insert:f}))});return r.changes.empty||e(n.update(r,{userEvent:"indent"})),!0},Ma=({state:n,dispatch:e})=>n.readOnly?!1:(e(n.update(Yr(n,(t,i)=>{i.push({from:t.from,insert:n.facet(jr)})}),{userEvent:"input.indent"})),!0),Oa=({state:n,dispatch:e})=>n.readOnly?!1:(e(n.update(Yr(n,(t,i)=>{let r=/^\s*/.exec(t.text)[0];if(!r)return;let s=tn(r,n.tabSize),o=0,l=ci(n,Math.max(0,s-St(n)));for(;o<r.length&&o<l.length&&r.charCodeAt(o)==l.charCodeAt(o);)o++;i.push({from:t.from+o,to:t.from+r.length,insert:l.slice(o)})}),{userEvent:"delete.dedent"})),!0),wd=n=>(n.setTabFocusMode(),!0),vd=[{key:"Ctrl-b",run:oa,shift:ga,preventDefault:!0},{key:"Ctrl-f",run:la,shift:ma},{key:"Ctrl-p",run:fa,shift:ba},{key:"Ctrl-n",run:ua,shift:wa},{key:"Ctrl-a",run:Hc,shift:Qc},{key:"Ctrl-e",run:Fc,shift:Zc},{key:"Ctrl-d",run:Aa},{key:"Ctrl-h",run:kr},{key:"Ctrl-k",run:ld},{key:"Ctrl-Alt-h",run:_a},{key:"Ctrl-o",run:fd},{key:"Ctrl-t",run:ud},{key:"Ctrl-v",run:vr}],kd=[{key:"ArrowLeft",run:oa,shift:ga,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:Oc,shift:Kc,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Nc,shift:Xc,preventDefault:!0},{key:"ArrowRight",run:la,shift:ma,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:Lc,shift:qc,preventDefault:!0},{mac:"Cmd-ArrowRight",run:Wc,shift:Yc,preventDefault:!0},{key:"ArrowUp",run:fa,shift:ba,preventDefault:!0},{mac:"Cmd-ArrowUp",run:co,shift:go},{mac:"Ctrl-ArrowUp",run:ho,shift:fo},{key:"ArrowDown",run:ua,shift:wa,preventDefault:!0},{mac:"Cmd-ArrowDown",run:po,shift:mo},{mac:"Ctrl-ArrowDown",run:vr,shift:uo},{key:"PageUp",run:ho,shift:fo},{key:"PageDown",run:vr,shift:uo},{key:"Home",run:Vc,shift:Jc,preventDefault:!0},{key:"Mod-Home",run:co,shift:go},{key:"End",run:Bc,shift:Gc,preventDefault:!0},{key:"Mod-End",run:po,shift:mo},{key:"Enter",run:yo,shift:yo},{key:"Mod-a",run:ed},{key:"Backspace",run:kr,shift:kr,preventDefault:!0},{key:"Delete",run:Aa,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:_a,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:od,preventDefault:!0},{mac:"Mod-Backspace",run:ad,preventDefault:!0},{mac:"Mod-Delete",run:hd,preventDefault:!0}].concat(vd.map(n=>({mac:n.key,run:n.run,shift:n.shift}))),Sd=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:Rc,shift:Uc},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:Ic,shift:$c},{key:"Alt-ArrowUp",run:cd},{key:"Shift-Alt-ArrowUp",run:pd},{key:"Alt-ArrowDown",run:dd},{key:"Shift-Alt-ArrowDown",run:gd},{key:"Mod-Alt-ArrowUp",run:nd},{key:"Mod-Alt-ArrowDown",run:rd},{key:"Escape",run:sd},{key:"Mod-Enter",run:xd},{key:"Alt-l",mac:"Ctrl-l",run:td},{key:"Mod-i",run:id,preventDefault:!0},{key:"Mod-[",run:Oa},{key:"Mod-]",run:Ma},{key:"Mod-Alt-\\",run:bd},{key:"Shift-Mod-k",run:md},{key:"Shift-Mod-\\",run:jc},{key:"Mod-/",run:cc},{key:"Alt-A",mac:"Ctrl-A",run:pc},{key:"Ctrl-m",mac:"Shift-Alt-m",run:wd}].concat(kd),Ad={key:"Tab",run:Ma,shift:Oa};function w(n){return new Iu(Ur.define(n))}function Qe(n){return x(()=>import("./index-COWIp8Rv.js"),__vite__mapDeps([0,1,2,3,4])).then(e=>e.sql({dialect:e[n]}))}const Cd=[m.of({name:"C",extensions:["c","h","ino"],load(){return x(()=>import("./index-CI4ILsT2.js"),__vite__mapDeps([5,1,3,4])).then(n=>n.cpp())}}),m.of({name:"C++",alias:["cpp"],extensions:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],load(){return x(()=>import("./index-CI4ILsT2.js"),__vite__mapDeps([5,1,3,4])).then(n=>n.cpp())}}),m.of({name:"CQL",alias:["cassandra"],extensions:["cql"],load(){return Qe("Cassandra")}}),m.of({name:"CSS",extensions:["css"],load(){return x(()=>import("./index-d5nSXJSW.js"),__vite__mapDeps([6,1,3,4])).then(n=>n.css())}}),m.of({name:"Go",extensions:["go"],load(){return x(()=>import("./index-CY5iDU16.js"),__vite__mapDeps([7,1,2,3,4])).then(n=>n.go())}}),m.of({name:"HTML",alias:["xhtml"],extensions:["html","htm","handlebars","hbs"],load(){return x(()=>import("./index-Pn2SVSaH.js"),__vite__mapDeps([8,1,6,3,4,9,2])).then(n=>n.html())}}),m.of({name:"Java",extensions:["java"],load(){return x(()=>import("./index-C0XMoTsM.js"),__vite__mapDeps([10,1,3,4])).then(n=>n.java())}}),m.of({name:"JavaScript",alias:["ecmascript","js","node"],extensions:["js","mjs","cjs"],load(){return x(()=>import("./index-DOy3EDwu.js"),__vite__mapDeps([9,1,2,3,4])).then(n=>n.javascript())}}),m.of({name:"Jinja",extensions:["j2","jinja","jinja2"],load(){return x(()=>import("./index-kqaFZuIz.js"),__vite__mapDeps([11,8,1,6,3,4,9,2])).then(n=>n.jinja())}}),m.of({name:"JSON",alias:["json5"],extensions:["json","map"],load(){return x(()=>import("./index-DqoaBbwq.js"),__vite__mapDeps([12,1,3,4])).then(n=>n.json())}}),m.of({name:"JSX",extensions:["jsx"],load(){return x(()=>import("./index-DOy3EDwu.js"),__vite__mapDeps([9,1,2,3,4])).then(n=>n.javascript({jsx:!0}))}}),m.of({name:"LESS",extensions:["less"],load(){return x(()=>import("./index-CHFSxI_e.js"),__vite__mapDeps([13,6,1,3,4])).then(n=>n.less())}}),m.of({name:"Liquid",extensions:["liquid"],load(){return x(()=>import("./index-C7QRIEGk.js"),__vite__mapDeps([14,8,1,6,3,4,9,2])).then(n=>n.liquid())}}),m.of({name:"MariaDB SQL",load(){return Qe("MariaSQL")}}),m.of({name:"Markdown",extensions:["md","markdown","mkd"],load(){return x(()=>import("./index-ClfSNKQc.js"),__vite__mapDeps([15,2,8,1,6,3,4,9])).then(n=>n.markdown())}}),m.of({name:"MS SQL",load(){return Qe("MSSQL")}}),m.of({name:"MySQL",load(){return Qe("MySQL")}}),m.of({name:"PHP",extensions:["php","php3","php4","php5","php7","phtml"],load(){return x(()=>import("./index-CA1DFDQc.js"),__vite__mapDeps([16,1,8,6,3,4,9,2])).then(n=>n.php())}}),m.of({name:"PLSQL",extensions:["pls"],load(){return Qe("PLSQL")}}),m.of({name:"PostgreSQL",load(){return Qe("PostgreSQL")}}),m.of({name:"Python",extensions:["BUILD","bzl","py","pyw"],filename:/^(BUCK|BUILD)$/,load(){return x(()=>import("./index-au9Pn3nl.js"),__vite__mapDeps([17,1,2,3,4])).then(n=>n.python())}}),m.of({name:"Rust",extensions:["rs"],load(){return x(()=>import("./index-CxsT3kOM.js"),__vite__mapDeps([18,1,3,4])).then(n=>n.rust())}}),m.of({name:"Sass",extensions:["sass"],load(){return x(()=>import("./index-vr8QPM_A.js"),__vite__mapDeps([19,1,6,3,4])).then(n=>n.sass({indented:!0}))}}),m.of({name:"SCSS",extensions:["scss"],load(){return x(()=>import("./index-vr8QPM_A.js"),__vite__mapDeps([19,1,6,3,4])).then(n=>n.sass())}}),m.of({name:"SQL",extensions:["sql"],load(){return Qe("StandardSQL")}}),m.of({name:"SQLite",load(){return Qe("SQLite")}}),m.of({name:"TSX",extensions:["tsx"],load(){return x(()=>import("./index-DOy3EDwu.js"),__vite__mapDeps([9,1,2,3,4])).then(n=>n.javascript({jsx:!0,typescript:!0}))}}),m.of({name:"TypeScript",alias:["ts"],extensions:["ts","mts","cts"],load(){return x(()=>import("./index-DOy3EDwu.js"),__vite__mapDeps([9,1,2,3,4])).then(n=>n.javascript({typescript:!0}))}}),m.of({name:"WebAssembly",extensions:["wat","wast"],load(){return x(()=>import("./index-DrIhVGMk.js"),__vite__mapDeps([20,1,3,4])).then(n=>n.wast())}}),m.of({name:"XML",alias:["rss","wsdl","xsd"],extensions:["xml","xsl","xsd","svg"],load(){return x(()=>import("./index-BX1L2t3R.js"),__vite__mapDeps([21,1,3,4])).then(n=>n.xml())}}),m.of({name:"YAML",alias:["yml"],extensions:["yaml","yml"],load(){return x(()=>import("./index-qy985yf3.js"),__vite__mapDeps([22,1,3,4])).then(n=>n.yaml())}}),m.of({name:"APL",extensions:["dyalog","apl"],load(){return x(()=>import("./apl-B4CMkyY2.js"),[]).then(n=>w(n.apl))}}),m.of({name:"PGP",alias:["asciiarmor"],extensions:["asc","pgp","sig"],load(){return x(()=>import("./asciiarmor-Df11BRmG.js"),[]).then(n=>w(n.asciiArmor))}}),m.of({name:"ASN.1",extensions:["asn","asn1"],load(){return x(()=>import("./asn1-EdZsLKOL.js"),[]).then(n=>w(n.asn1({})))}}),m.of({name:"Asterisk",filename:/^extensions\.conf$/i,load(){return x(()=>import("./asterisk-B-8jnY81.js"),[]).then(n=>w(n.asterisk))}}),m.of({name:"Brainfuck",extensions:["b","bf"],load(){return x(()=>import("./brainfuck-C4LP7Hcl.js"),[]).then(n=>w(n.brainfuck))}}),m.of({name:"Cobol",extensions:["cob","cpy"],load(){return x(()=>import("./cobol-CWcv1MsR.js"),[]).then(n=>w(n.cobol))}}),m.of({name:"C#",alias:["csharp","cs"],extensions:["cs"],load(){return x(()=>import("./clike-B9uivgTg.js"),[]).then(n=>w(n.csharp))}}),m.of({name:"Clojure",extensions:["clj","cljc","cljx"],load(){return x(()=>import("./clojure-BMjYHr_A.js"),[]).then(n=>w(n.clojure))}}),m.of({name:"ClojureScript",extensions:["cljs"],load(){return x(()=>import("./clojure-BMjYHr_A.js"),[]).then(n=>w(n.clojure))}}),m.of({name:"Closure Stylesheets (GSS)",extensions:["gss"],load(){return x(()=>import("./css-BnMrqG3P.js"),[]).then(n=>w(n.gss))}}),m.of({name:"CMake",extensions:["cmake","cmake.in"],filename:/^CMakeLists\.txt$/,load(){return x(()=>import("./cmake-BQqOBYOt.js"),[]).then(n=>w(n.cmake))}}),m.of({name:"CoffeeScript",alias:["coffee","coffee-script"],extensions:["coffee"],load(){return x(()=>import("./coffeescript-S37ZYGWr.js"),[]).then(n=>w(n.coffeeScript))}}),m.of({name:"Common Lisp",alias:["lisp"],extensions:["cl","lisp","el"],load(){return x(()=>import("./commonlisp-DBKNyK5s.js"),[]).then(n=>w(n.commonLisp))}}),m.of({name:"Cypher",extensions:["cyp","cypher"],load(){return x(()=>import("./cypher-C_CwsFkJ.js"),[]).then(n=>w(n.cypher))}}),m.of({name:"Cython",extensions:["pyx","pxd","pxi"],load(){return x(()=>import("./python-BuPzkPfP.js"),[]).then(n=>w(n.cython))}}),m.of({name:"Crystal",extensions:["cr"],load(){return x(()=>import("./crystal-SjHAIU92.js"),[]).then(n=>w(n.crystal))}}),m.of({name:"D",extensions:["d"],load(){return x(()=>import("./d-pRatUO7H.js"),[]).then(n=>w(n.d))}}),m.of({name:"Dart",extensions:["dart"],load(){return x(()=>import("./clike-B9uivgTg.js"),[]).then(n=>w(n.dart))}}),m.of({name:"diff",extensions:["diff","patch"],load(){return x(()=>import("./diff-DbItnlRl.js"),[]).then(n=>w(n.diff))}}),m.of({name:"Dockerfile",filename:/^Dockerfile$/,load(){return x(()=>import("./dockerfile-BKs6k2Af.js"),__vite__mapDeps([23,24])).then(n=>w(n.dockerFile))}}),m.of({name:"DTD",extensions:["dtd"],load(){return x(()=>import("./dtd-DF_7sFjM.js"),[]).then(n=>w(n.dtd))}}),m.of({name:"Dylan",extensions:["dylan","dyl","intr"],load(){return x(()=>import("./dylan-DwRh75JA.js"),[]).then(n=>w(n.dylan))}}),m.of({name:"EBNF",load(){return x(()=>import("./ebnf-CDyGwa7X.js"),[]).then(n=>w(n.ebnf))}}),m.of({name:"ECL",extensions:["ecl"],load(){return x(()=>import("./ecl-Cabwm37j.js"),[]).then(n=>w(n.ecl))}}),m.of({name:"edn",extensions:["edn"],load(){return x(()=>import("./clojure-BMjYHr_A.js"),[]).then(n=>w(n.clojure))}}),m.of({name:"Eiffel",extensions:["e"],load(){return x(()=>import("./eiffel-CnydiIhH.js"),[]).then(n=>w(n.eiffel))}}),m.of({name:"Elm",extensions:["elm"],load(){return x(()=>import("./elm-vLlmbW-K.js"),[]).then(n=>w(n.elm))}}),m.of({name:"Erlang",extensions:["erl"],load(){return x(()=>import("./erlang-BNw1qcRV.js"),[]).then(n=>w(n.erlang))}}),m.of({name:"Esper",load(){return x(()=>import("./sql-D0XecflT.js"),[]).then(n=>w(n.esper))}}),m.of({name:"Factor",extensions:["factor"],load(){return x(()=>import("./factor-kuTfRLto.js"),__vite__mapDeps([25,24])).then(n=>w(n.factor))}}),m.of({name:"FCL",load(){return x(()=>import("./fcl-Kvtd6kyn.js"),[]).then(n=>w(n.fcl))}}),m.of({name:"Forth",extensions:["forth","fth","4th"],load(){return x(()=>import("./forth-Ffai-XNe.js"),[]).then(n=>w(n.forth))}}),m.of({name:"Fortran",extensions:["f","for","f77","f90","f95"],load(){return x(()=>import("./fortran-DYz_wnZ1.js"),[]).then(n=>w(n.fortran))}}),m.of({name:"F#",alias:["fsharp"],extensions:["fs"],load(){return x(()=>import("./mllike-CXdrOF99.js"),[]).then(n=>w(n.fSharp))}}),m.of({name:"Gas",extensions:["s"],load(){return x(()=>import("./gas-Bneqetm1.js"),[]).then(n=>w(n.gas))}}),m.of({name:"Gherkin",extensions:["feature"],load(){return x(()=>import("./gherkin-heZmZLOM.js"),[]).then(n=>w(n.gherkin))}}),m.of({name:"Groovy",extensions:["groovy","gradle"],filename:/^Jenkinsfile$/,load(){return x(()=>import("./groovy-D9Dt4D0W.js"),[]).then(n=>w(n.groovy))}}),m.of({name:"Haskell",extensions:["hs"],load(){return x(()=>import("./haskell-Cw1EW3IL.js"),[]).then(n=>w(n.haskell))}}),m.of({name:"Haxe",extensions:["hx"],load(){return x(()=>import("./haxe-H-WmDvRZ.js"),[]).then(n=>w(n.haxe))}}),m.of({name:"HXML",extensions:["hxml"],load(){return x(()=>import("./haxe-H-WmDvRZ.js"),[]).then(n=>w(n.hxml))}}),m.of({name:"HTTP",load(){return x(()=>import("./http-DBlCnlav.js"),[]).then(n=>w(n.http))}}),m.of({name:"IDL",extensions:["pro"],load(){return x(()=>import("./idl-BEugSyMb.js"),[]).then(n=>w(n.idl))}}),m.of({name:"JSON-LD",alias:["jsonld"],extensions:["jsonld"],load(){return x(()=>import("./javascript-iXu5QeM3.js"),[]).then(n=>w(n.jsonld))}}),m.of({name:"Julia",extensions:["jl"],load(){return x(()=>import("./julia-DuME0IfC.js"),[]).then(n=>w(n.julia))}}),m.of({name:"Kotlin",extensions:["kt","kts"],load(){return x(()=>import("./clike-B9uivgTg.js"),[]).then(n=>w(n.kotlin))}}),m.of({name:"LiveScript",alias:["ls"],extensions:["ls"],load(){return x(()=>import("./livescript-BwQOo05w.js"),[]).then(n=>w(n.liveScript))}}),m.of({name:"Lua",extensions:["lua"],load(){return x(()=>import("./lua-VAEuO923.js"),[]).then(n=>w(n.lua))}}),m.of({name:"mIRC",extensions:["mrc"],load(){return x(()=>import("./mirc-CjQqDB4T.js"),[]).then(n=>w(n.mirc))}}),m.of({name:"Mathematica",extensions:["m","nb","wl","wls"],load(){return x(()=>import("./mathematica-DTrFuWx2.js"),[]).then(n=>w(n.mathematica))}}),m.of({name:"Modelica",extensions:["mo"],load(){return x(()=>import("./modelica-Dc1JOy9r.js"),[]).then(n=>w(n.modelica))}}),m.of({name:"MUMPS",extensions:["mps"],load(){return x(()=>import("./mumps-BT43cFF4.js"),[]).then(n=>w(n.mumps))}}),m.of({name:"Mbox",extensions:["mbox"],load(){return x(()=>import("./mbox-CNhZ1qSd.js"),[]).then(n=>w(n.mbox))}}),m.of({name:"Nginx",filename:/nginx.*\.conf$/i,load(){return x(()=>import("./nginx-DdIZxoE0.js"),[]).then(n=>w(n.nginx))}}),m.of({name:"NSIS",extensions:["nsh","nsi"],load(){return x(()=>import("./nsis-LdVXkNf5.js"),__vite__mapDeps([26,24])).then(n=>w(n.nsis))}}),m.of({name:"NTriples",extensions:["nt","nq"],load(){return x(()=>import("./ntriples-BfvgReVJ.js"),[]).then(n=>w(n.ntriples))}}),m.of({name:"Objective-C",alias:["objective-c","objc"],extensions:["m"],load(){return x(()=>import("./clike-B9uivgTg.js"),[]).then(n=>w(n.objectiveC))}}),m.of({name:"Objective-C++",alias:["objective-c++","objc++"],extensions:["mm"],load(){return x(()=>import("./clike-B9uivgTg.js"),[]).then(n=>w(n.objectiveCpp))}}),m.of({name:"OCaml",extensions:["ml","mli","mll","mly"],load(){return x(()=>import("./mllike-CXdrOF99.js"),[]).then(n=>w(n.oCaml))}}),m.of({name:"Octave",extensions:["m"],load(){return x(()=>import("./octave-Ck1zUtKM.js"),[]).then(n=>w(n.octave))}}),m.of({name:"Oz",extensions:["oz"],load(){return x(()=>import("./oz-BzwKVEFT.js"),[]).then(n=>w(n.oz))}}),m.of({name:"Pascal",extensions:["p","pas"],load(){return x(()=>import("./pascal--L3eBynH.js"),[]).then(n=>w(n.pascal))}}),m.of({name:"Perl",extensions:["pl","pm"],load(){return x(()=>import("./perl-CdXCOZ3F.js"),[]).then(n=>w(n.perl))}}),m.of({name:"Pig",extensions:["pig"],load(){return x(()=>import("./pig-CevX1Tat.js"),[]).then(n=>w(n.pig))}}),m.of({name:"PowerShell",extensions:["ps1","psd1","psm1"],load(){return x(()=>import("./powershell-CFHJl5sT.js"),[]).then(n=>w(n.powerShell))}}),m.of({name:"Properties files",alias:["ini","properties"],extensions:["properties","ini","in"],load(){return x(()=>import("./properties-C78fOPTZ.js"),[]).then(n=>w(n.properties))}}),m.of({name:"ProtoBuf",extensions:["proto"],load(){return x(()=>import("./protobuf-ChK-085T.js"),[]).then(n=>w(n.protobuf))}}),m.of({name:"Pug",alias:["jade"],extensions:["pug","jade"],load(){return x(()=>import("./pug-DeIclll2.js"),__vite__mapDeps([27,28])).then(n=>w(n.pug))}}),m.of({name:"Puppet",extensions:["pp"],load(){return x(()=>import("./puppet-DMA9R1ak.js"),[]).then(n=>w(n.puppet))}}),m.of({name:"Q",extensions:["q"],load(){return x(()=>import("./q-pXgVlZs6.js"),[]).then(n=>w(n.q))}}),m.of({name:"R",alias:["rscript"],extensions:["r","R"],load(){return x(()=>import("./r-B6wPVr8A.js"),[]).then(n=>w(n.r))}}),m.of({name:"RPM Changes",load(){return x(()=>import("./rpm-CTu-6PCP.js"),[]).then(n=>w(n.rpmChanges))}}),m.of({name:"RPM Spec",extensions:["spec"],load(){return x(()=>import("./rpm-CTu-6PCP.js"),[]).then(n=>w(n.rpmSpec))}}),m.of({name:"Ruby",alias:["jruby","macruby","rake","rb","rbx"],extensions:["rb"],filename:/^(Gemfile|Rakefile)$/,load(){return x(()=>import("./ruby-B2Rjki9n.js"),[]).then(n=>w(n.ruby))}}),m.of({name:"SAS",extensions:["sas"],load(){return x(()=>import("./sas-B4kiWyti.js"),[]).then(n=>w(n.sas))}}),m.of({name:"Scala",extensions:["scala"],load(){return x(()=>import("./clike-B9uivgTg.js"),[]).then(n=>w(n.scala))}}),m.of({name:"Scheme",extensions:["scm","ss"],load(){return x(()=>import("./scheme-C41bIUwD.js"),[]).then(n=>w(n.scheme))}}),m.of({name:"Shell",alias:["bash","sh","zsh"],extensions:["sh","ksh","bash"],filename:/^PKGBUILD$/,load(){return x(()=>import("./shell-CjFT_Tl9.js"),[]).then(n=>w(n.shell))}}),m.of({name:"Sieve",extensions:["siv","sieve"],load(){return x(()=>import("./sieve-C3Gn_uJK.js"),[]).then(n=>w(n.sieve))}}),m.of({name:"Smalltalk",extensions:["st"],load(){return x(()=>import("./smalltalk-CnHTOXQT.js"),[]).then(n=>w(n.smalltalk))}}),m.of({name:"Solr",load(){return x(()=>import("./solr-DehyRSwq.js"),[]).then(n=>w(n.solr))}}),m.of({name:"SML",extensions:["sml","sig","fun","smackspec"],load(){return x(()=>import("./mllike-CXdrOF99.js"),[]).then(n=>w(n.sml))}}),m.of({name:"SPARQL",alias:["sparul"],extensions:["rq","sparql"],load(){return x(()=>import("./sparql-DkYu6x3z.js"),[]).then(n=>w(n.sparql))}}),m.of({name:"Spreadsheet",alias:["excel","formula"],load(){return x(()=>import("./spreadsheet-BCZA_wO0.js"),[]).then(n=>w(n.spreadsheet))}}),m.of({name:"Squirrel",extensions:["nut"],load(){return x(()=>import("./clike-B9uivgTg.js"),[]).then(n=>w(n.squirrel))}}),m.of({name:"Stylus",extensions:["styl"],load(){return x(()=>import("./stylus-B533Al4x.js"),[]).then(n=>w(n.stylus))}}),m.of({name:"Swift",extensions:["swift"],load(){return x(()=>import("./swift-BzpIVaGY.js"),[]).then(n=>w(n.swift))}}),m.of({name:"sTeX",load(){return x(()=>import("./stex-C3f8Ysf7.js"),[]).then(n=>w(n.stex))}}),m.of({name:"LaTeX",alias:["tex"],extensions:["text","ltx","tex"],load(){return x(()=>import("./stex-C3f8Ysf7.js"),[]).then(n=>w(n.stex))}}),m.of({name:"SystemVerilog",extensions:["v","sv","svh"],load(){return x(()=>import("./verilog-C6RDOZhf.js"),[]).then(n=>w(n.verilog))}}),m.of({name:"Tcl",extensions:["tcl"],load(){return x(()=>import("./tcl-DVfN8rqt.js"),[]).then(n=>w(n.tcl))}}),m.of({name:"Textile",extensions:["textile"],load(){return x(()=>import("./textile-CnDTJFAw.js"),[]).then(n=>w(n.textile))}}),m.of({name:"TiddlyWiki",load(){return x(()=>import("./tiddlywiki-DO-Gjzrf.js"),[]).then(n=>w(n.tiddlyWiki))}}),m.of({name:"Tiki wiki",load(){return x(()=>import("./tiki-DGYXhP31.js"),[]).then(n=>w(n.tiki))}}),m.of({name:"TOML",extensions:["toml"],load(){return x(()=>import("./toml-Bm5Em-hy.js"),[]).then(n=>w(n.toml))}}),m.of({name:"Troff",extensions:["1","2","3","4","5","6","7","8","9"],load(){return x(()=>import("./troff-wAsdV37c.js"),[]).then(n=>w(n.troff))}}),m.of({name:"TTCN",extensions:["ttcn","ttcn3","ttcnpp"],load(){return x(()=>import("./ttcn-CfJYG6tj.js"),[]).then(n=>w(n.ttcn))}}),m.of({name:"TTCN_CFG",extensions:["cfg"],load(){return x(()=>import("./ttcn-cfg-B9xdYoR4.js"),[]).then(n=>w(n.ttcnCfg))}}),m.of({name:"Turtle",extensions:["ttl"],load(){return x(()=>import("./turtle-B1tBg_DP.js"),[]).then(n=>w(n.turtle))}}),m.of({name:"Web IDL",extensions:["webidl"],load(){return x(()=>import("./webidl-ZXfAyPTL.js"),[]).then(n=>w(n.webIDL))}}),m.of({name:"VB.NET",extensions:["vb"],load(){return x(()=>import("./vb-CmGdzxic.js"),[]).then(n=>w(n.vb))}}),m.of({name:"VBScript",extensions:["vbs"],load(){return x(()=>import("./vbscript-BuJXcnF6.js"),[]).then(n=>w(n.vbScript))}}),m.of({name:"Velocity",extensions:["vtl"],load(){return x(()=>import("./velocity-D8B20fx6.js"),[]).then(n=>w(n.velocity))}}),m.of({name:"Verilog",extensions:["v"],load(){return x(()=>import("./verilog-C6RDOZhf.js"),[]).then(n=>w(n.verilog))}}),m.of({name:"VHDL",extensions:["vhd","vhdl"],load(){return x(()=>import("./vhdl-lSbBsy5d.js"),[]).then(n=>w(n.vhdl))}}),m.of({name:"XQuery",extensions:["xy","xquery","xq","xqm","xqy"],load(){return x(()=>import("./xquery-DzFWVndE.js"),[]).then(n=>w(n.xQuery))}}),m.of({name:"Yacas",extensions:["ys"],load(){return x(()=>import("./yacas-BJ4BC0dw.js"),[]).then(n=>w(n.yacas))}}),m.of({name:"Z80",extensions:["z80"],load(){return x(()=>import("./z80-Hz9HOZM7.js"),[]).then(n=>w(n.z80))}}),m.of({name:"MscGen",extensions:["mscgen","mscin","msc"],load(){return x(()=>import("./mscgen-BA5vi2Kp.js"),[]).then(n=>w(n.mscgen))}}),m.of({name:"Xù",extensions:["xu"],load(){return x(()=>import("./mscgen-BA5vi2Kp.js"),[]).then(n=>w(n.xu))}}),m.of({name:"MsGenny",extensions:["msgenny"],load(){return x(()=>import("./mscgen-BA5vi2Kp.js"),[]).then(n=>w(n.msgenny))}}),m.of({name:"Vue",extensions:["vue"],load(){return x(()=>import("./index-D_ldXu1l.js"),__vite__mapDeps([29,8,1,6,3,4,9,2])).then(n=>n.vue())}}),m.of({name:"Angular Template",load(){return x(()=>import("./index-DfQCF6EF.js"),__vite__mapDeps([30,8,1,6,3,4,9,2])).then(n=>n.angular())}})],_d=O.theme({"&":{color:"var(--foreground)",backgroundColor:"transparent",fontSize:"var(--text-sm, 0.875rem)"},".cm-content":{caretColor:"var(--foreground)",padding:"0"},"&.cm-focused":{outline:"none"},".cm-line":{padding:"0"},".cm-cursor, .cm-dropCursor":{borderLeftColor:"var(--foreground)"},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, ::selection":{backgroundColor:"color-mix(in oklch, var(--primary) 25%, transparent)"},".cm-gutters":{backgroundColor:"transparent",color:"var(--muted-foreground)",border:"none",paddingInlineEnd:"0.5rem"},".cm-activeLineGutter":{backgroundColor:"transparent",color:"var(--foreground)"},".cm-placeholder":{color:"var(--muted-foreground)"}}),Td={[Rn.CODE]:()=>[O.theme({".cm-scroller":{fontFamily:"var(--font-mono, ui-monospace, monospace)"},".cm-activeLine":{backgroundColor:"color-mix(in oklch, var(--muted) 40%, transparent)"}}),Jf(),tc()],[Rn.PROSE]:()=>[O.theme({".cm-scroller":{fontFamily:"inherit"}})]},Ed=hn.define([{tag:[C.keyword,C.operatorKeyword,C.modifier],color:"var(--primary)"},{tag:[C.string,C.special(C.string)],color:"var(--chart-2, var(--primary))"},{tag:[C.number,C.bool,C.atom,C.null],color:"var(--chart-4, var(--foreground))"},{tag:[C.comment,C.blockComment,C.lineComment],color:"var(--muted-foreground)",fontStyle:"italic"},{tag:[C.typeName,C.className,C.namespace],color:"var(--chart-1, var(--foreground))"},{tag:[C.function(C.variableName),C.function(C.propertyName)],color:"var(--chart-5, var(--foreground))"},{tag:[C.propertyName,C.attributeName],color:"var(--chart-3, var(--foreground))"},{tag:C.invalid,color:"var(--destructive)"},{tag:C.heading,color:"var(--primary)",fontWeight:"600"},{tag:C.strong,fontWeight:"600"},{tag:C.emphasis,fontStyle:"italic"},{tag:C.strikethrough,textDecoration:"line-through"},{tag:[C.link,C.url],color:"var(--chart-2, var(--primary))",textDecoration:"underline"},{tag:[C.processingInstruction,C.meta,C.punctuation],color:"var(--muted-foreground)"},{tag:C.monospace,fontFamily:"var(--font-mono, ui-monospace, monospace)"}]);async function Dd(n){if(!n||n==="plaintext")return null;const e=m.matchLanguageName(Cd,n,!0);return e?await e.load():null}const xo=xe.forwardRef(function({appearance:e=Rn.CODE,value:t,onChange:i,onBlur:r,language:s,placeholder:o,disabled:l=!1,readOnly:a=!1,autoFocus:h=!1,showLineNumbers:f=!1,minRows:u=6,className:c,"aria-label":d},p){const g=xe.useRef(null),y=xe.useRef(null),b=xe.useRef(i);b.current=i;const A=xe.useRef(r);A.current=r;const S=xe.useRef(new Rt),R=xe.useRef(new Rt);return xe.useImperativeHandle(p,()=>g.current),xe.useLayoutEffect(()=>{const E=g.current;if(!E)return;const M=B.create({doc:t??"",extensions:[vc(),Ku(),...Td[e](),...f?[au()]:[],...o?[Zf(o)]:[],Ol.of([...Sd,...Mc,Ad]),_d,Uu(Ed),O.lineWrapping,S.current.of([]),R.current.of([O.editable.of(!(l||a)),B.readOnly.of(l||a)]),O.updateListener.of(W=>{W.docChanged&&b.current?.(W.state.doc.toString())}),O.domEventHandlers({blur:()=>{A.current?.()}})]}),T=new O({state:M,parent:E});return y.current=T,h&&T.focus(),()=>{y.current=null,T.destroy()}},[]),xe.useEffect(()=>{const E=y.current;if(!E)return;const M=E.state.doc.toString(),T=t??"";T!==M&&E.dispatch({changes:{from:0,to:M.length,insert:T}})},[t]),xe.useEffect(()=>{let E=!1;return Dd(s).then(M=>{const T=y.current;E||!T||T.dispatch({effects:S.current.reconfigure(M??[])})}),()=>{E=!0}},[s]),xe.useEffect(()=>{const E=y.current;E&&E.dispatch({effects:R.current.reconfigure([O.editable.of(!(l||a)),B.readOnly.of(l||a)])})},[l,a]),La.jsx("div",{ref:g,role:"textbox","aria-multiline":"true","aria-label":d,"aria-disabled":l||void 0,"aria-readonly":a||void 0,"data-slot":"cm6-editor",className:c,style:{minHeight:`calc(${u} * 1.5em)`}})}),Fd=Object.freeze(Object.defineProperty({__proto__:null,CM6Editor:xo,default:xo},Symbol.toStringTag,{value:"Module"}));export{ht as A,tn as B,ke as C,hu as D,v as E,D as F,Nd as G,B as H,F as I,yt as J,m as K,gr as L,me as M,Wr as N,Nt as O,Bl as P,Fd as Q,xt as R,Y as S,j as T,pi as W,Iu as a,Ke as b,Vd as c,ue as d,P as e,Wd as f,ee as g,N as h,Fl as i,jr as j,z as k,at as l,O as m,Cr as n,Ol as o,Pd as p,Id as q,Hd as r,Tu as s,C as t,Bd as u,Ld as v,ic as w,Lu as x,Wl as y,be as z};
13
+ `);i>-1&&(t=t.slice(0,i))}return e+t.length<=this.to?t:t.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,t=this.lineAfter(e),i=e+t.length;for(let r=this.rangeIndex;;){let s=this.ranges[r].to;if(s>=i||(t=t.slice(0,s-(i-t.length)),r++,r==this.ranges.length))break;let o=this.ranges[r].from,l=this.lineAfter(o);t+=l,i=o+l.length}return{line:t,end:i}}skipGapsTo(e,t,i){for(;;){let r=this.ranges[this.rangeIndex].to,s=e+t;if(i>0?r>s:r>=s)break;let o=this.ranges[++this.rangeIndex].from;t+=o-r}return t}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}emitToken(e,t,i,r){let s=4;if(this.ranges.length>1){r=this.skipGapsTo(t,r,1),t+=r;let l=this.chunk.length;r=this.skipGapsTo(i,r,-1),i+=r,s+=this.chunk.length-l}let o=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&s==4&&o>=0&&this.chunk[o]==e&&this.chunk[o+2]==t?this.chunk[o+2]=i:this.chunk.push(e,t,i,s),r}parseLine(e){let{line:t,end:i}=this.nextLine(),r=0,{streamParser:s}=this.lang,o=new $l(t,e?e.state.tabSize:4,e?St(e.state):2);if(o.eol())s.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let l=Jl(s.token,o,this.state);if(l&&(r=this.emitToken(this.lang.tokenTable.resolve(l),this.parsedPos+o.start,this.parsedPos+o.pos,r)),o.start>1e4)break}this.parsedPos=i,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}finishChunk(){let e=j.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:hc,topID:0,maxBufferLength:512,reused:this.chunkReused});e=new j(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 j(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}}function Jl(n,e,t){e.start=e.pos;for(let i=0;i<10;i++){let r=n(e,t);if(e.pos>e.start)return r}throw new Error("Stream parser failed to advance stream.")}const Gr=Object.create(null),di=[ue.none],hc=new Wr(di),lo=[],ao=Object.create(null),Xl=Object.create(null);for(let[n,e]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"]])Xl[n]=Ql(Gr,e);class Yl{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),Xl)}resolve(e){return e?this.table[e]||(this.table[e]=Ql(this.extra,e)):0}}const fc=new Yl(Gr);function Ln(n,e){lo.indexOf(n)>-1||(lo.push(n),console.warn(e))}function Ql(n,e){let t=[];for(let l of e.split(" ")){let a=[];for(let h of l.split(".")){let f=n[h]||C[h];f?typeof f=="function"?a.length?a=a.map(f):Ln(h,`Modifier ${h} used at start of tag`):a.length?Ln(h,`Tag ${h} used as modifier`):a=Array.isArray(f)?f:[f]:Ln(h,`Unknown highlighting tag ${h}`)}for(let h of a)t.push(h)}if(!t.length)return 0;let i=e.replace(/ /g,"_"),r=i+" "+t.map(l=>l.id),s=ao[r];if(s)return s.id;let o=ao[r]=ue.define({id:di.length,name:i,props:[Tu({[i]:t})]});return di.push(o),o.id}function uc(n,e){let t=ue.define({id:di.length,name:"Document",props:[yt.add(()=>n),Fl.add(()=>i=>e.getIndent(i))],top:!0});return di.push(t),t}Q.RTL,Q.LTR;const cc=n=>{let{state:e}=n,t=e.doc.lineAt(e.selection.main.from),i=Xr(n.state,t.from);return i.line?dc(n):i.block?gc(n):!1};function Jr(n,e){return({state:t,dispatch:i})=>{if(t.readOnly)return!1;let r=n(e,t);return r?(i(t.update(r)),!0):!1}}const dc=Jr(xc,0),pc=Jr(Zl,0),gc=Jr((n,e)=>Zl(n,e,yc(e)),0);function Xr(n,e){let t=n.languageDataAt("commentTokens",e,1);return t.length?t[0]:{}}const $t=50;function mc(n,{open:e,close:t},i,r){let s=n.sliceDoc(i-$t,i),o=n.sliceDoc(r,r+$t),l=/\s*$/.exec(s)[0].length,a=/^\s*/.exec(o)[0].length,h=s.length-l;if(s.slice(h-e.length,h)==e&&o.slice(a,a+t.length)==t)return{open:{pos:i-l,margin:l&&1},close:{pos:r+a,margin:a&&1}};let f,u;r-i<=2*$t?f=u=n.sliceDoc(i,r):(f=n.sliceDoc(i,i+$t),u=n.sliceDoc(r-$t,r));let c=/^\s*/.exec(f)[0].length,d=/\s*$/.exec(u)[0].length,p=u.length-d-t.length;return f.slice(c,c+e.length)==e&&u.slice(p,p+t.length)==t?{open:{pos:i+c+e.length,margin:/\s/.test(f.charAt(c+e.length))?1:0},close:{pos:r-d-t.length,margin:/\s/.test(u.charAt(p-1))?1:0}}:null}function yc(n){let e=[];for(let t of n.selection.ranges){let i=n.doc.lineAt(t.from),r=t.to<=i.to?i:n.doc.lineAt(t.to);r.from>i.from&&r.from==t.to&&(r=t.to==i.to+1?i:n.doc.lineAt(t.to-1));let s=e.length-1;s>=0&&e[s].to>i.from?e[s].to=r.to:e.push({from:i.from+/^\s*/.exec(i.text)[0].length,to:r.to})}return e}function Zl(n,e,t=e.selection.ranges){let i=t.map(s=>Xr(e,s.from).block);if(!i.every(s=>s))return null;let r=t.map((s,o)=>mc(e,i[o],s.from,s.to));if(n!=2&&!r.every(s=>s))return{changes:e.changes(t.map((s,o)=>r[o]?[]:[{from:s.from,insert:i[o].open+" "},{from:s.to,insert:" "+i[o].close}]))};if(n!=1&&r.some(s=>s)){let s=[];for(let o=0,l;o<r.length;o++)if(l=r[o]){let a=i[o],{open:h,close:f}=l;s.push({from:h.pos-a.open.length,to:h.pos+h.margin},{from:f.pos-f.margin,to:f.pos+a.close.length})}return{changes:s}}return null}function xc(n,e,t=e.selection.ranges){let i=[],r=-1;e:for(let{from:s,to:o}of t){let l=i.length,a=1e9,h;for(let f=s;f<=o;){let u=e.doc.lineAt(f);if(h==null&&(h=Xr(e,u.from).line,!h))continue e;if(u.from>r&&(s==o||o>u.from)){r=u.from;let c=/^\s*/.exec(u.text)[0].length,d=c==u.length,p=u.text.slice(c,c+h.length)==h?c:-1;c<u.text.length&&c<a&&(a=c),i.push({line:u,comment:p,token:h,indent:c,empty:d,single:!1})}f=u.to+1}if(a<1e9)for(let f=l;f<i.length;f++)i[f].indent<i[f].line.text.length&&(i[f].indent=a);i.length==l+1&&(i[l].single=!0)}if(n!=2&&i.some(s=>s.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:l,token:a,indent:h,empty:f,single:u}of i)(u||!f)&&s.push({from:l.from+h,insert:a+" "});let o=e.changes(s);return{changes:o,selection:e.selection.map(o,1)}}else if(n!=1&&i.some(s=>s.comment>=0)){let s=[];for(let{line:o,comment:l,token:a}of i)if(l>=0){let h=o.from+l,f=h+a.length;o.text[f-o.from]==" "&&f++,s.push({from:h,to:f})}return{changes:s}}return null}const br=ht.define(),bc=ht.define(),wc=D.define(),ea=D.define({combine(n){return _r(n,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(i,r)=>e(i,r)||t(i,r)})}}),ta=at.define({create(){return ze.empty},update(n,e){let t=e.state.facet(ea),i=e.annotation(br);if(i){let a=de.fromTransaction(e,i.selection),h=i.side,f=h==0?n.undone:n.done;return a?f=en(f,f.length,t.minDepth,a):f=ra(f,e.startState.selection),new ze(h==0?i.rest:f,h==0?f:i.rest)}let r=e.annotation(bc);if((r=="full"||r=="before")&&(n=n.isolate()),e.annotation(ee.addToHistory)===!1)return e.changes.empty?n:n.addMapping(e.changes.desc);let s=de.fromTransaction(e),o=e.annotation(ee.time),l=e.annotation(ee.userEvent);return s?n=n.addChanges(s,o,l,t,e):e.selection&&(n=n.addSelection(e.startState.selection,o,l,t.newGroupDelay)),(r=="full"||r=="after")&&(n=n.isolate()),n},toJSON(n){return{done:n.done.map(e=>e.toJSON()),undone:n.undone.map(e=>e.toJSON())}},fromJSON(n){return new ze(n.done.map(de.fromJSON),n.undone.map(de.fromJSON))}});function vc(n={}){return[ta,ea.of(n),O.domEventHandlers({beforeinput(e,t){let i=e.inputType=="historyUndo"?ia:e.inputType=="historyRedo"?wr:null;return i?(e.preventDefault(),i(t)):!1}})]}function fn(n,e){return function({state:t,dispatch:i}){if(!e&&t.readOnly)return!1;let r=t.field(ta,!1);if(!r)return!1;let s=r.pop(n,t,e);return s?(i(s),!0):!1}}const ia=fn(0,!1),wr=fn(1,!1),kc=fn(0,!0),Sc=fn(1,!0);class de{constructor(e,t,i,r,s){this.changes=e,this.effects=t,this.mapped=i,this.startSelection=r,this.selectionsAfter=s}setSelAfter(e){return new de(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,i;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(i=this.startSelection)===null||i===void 0?void 0:i.toJSON(),selectionsAfter:this.selectionsAfter.map(r=>r.toJSON())}}static fromJSON(e){return new de(e.changes&&Z.fromJSON(e.changes),[],e.mapped&&je.fromJSON(e.mapped),e.startSelection&&v.fromJSON(e.startSelection),e.selectionsAfter.map(v.fromJSON))}static fromTransaction(e,t){let i=Se;for(let r of e.startState.facet(wc)){let s=r(e);s.length&&(i=i.concat(s))}return!i.length&&e.changes.empty?null:new de(e.changes.invert(e.startState.doc),i,void 0,t||e.startState.selection,Se)}static selection(e){return new de(void 0,Se,void 0,void 0,e)}}function en(n,e,t,i){let r=e+1>t+20?e-t-1:0,s=n.slice(r,e);return s.push(i),s}function Ac(n,e){let t=[],i=!1;return n.iterChangedRanges((r,s)=>t.push(r,s)),e.iterChangedRanges((r,s,o,l)=>{for(let a=0;a<t.length;){let h=t[a++],f=t[a++];l>=h&&o<=f&&(i=!0)}}),i}function Cc(n,e){return n.ranges.length==e.ranges.length&&n.ranges.filter((t,i)=>t.empty!=e.ranges[i].empty).length===0}function na(n,e){return n.length?e.length?n.concat(e):n:e}const Se=[],_c=200;function ra(n,e){if(n.length){let t=n[n.length-1],i=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-_c));return i.length&&i[i.length-1].eq(e)?n:(i.push(e),en(n,n.length-1,1e9,t.setSelAfter(i)))}else return[de.selection([e])]}function Tc(n){let e=n[n.length-1],t=n.slice();return t[n.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),t}function Pn(n,e){if(!n.length)return n;let t=n.length,i=Se;for(;t;){let r=Ec(n[t-1],e,i);if(r.changes&&!r.changes.empty||r.effects.length){let s=n.slice(0,t);return s[t-1]=r,s}else e=r.mapped,t--,i=r.selectionsAfter}return i.length?[de.selection(i)]:Se}function Ec(n,e,t){let i=na(n.selectionsAfter.length?n.selectionsAfter.map(l=>l.map(e)):Se,t);if(!n.changes)return de.selection(i);let r=n.changes.map(e),s=e.mapDesc(n.changes,!0),o=n.mapped?n.mapped.composeDesc(s):s;return new de(r,Y.mapEffects(n.effects,e),o,n.startSelection.map(s),i)}const Dc=/^(input\.type|delete)($|\.)/;class ze{constructor(e,t,i=0,r=void 0){this.done=e,this.undone=t,this.prevTime=i,this.prevUserEvent=r}isolate(){return this.prevTime?new ze(this.done,this.undone):this}addChanges(e,t,i,r,s){let o=this.done,l=o[o.length-1];return l&&l.changes&&!l.changes.empty&&e.changes&&(!i||Dc.test(i))&&(!l.selectionsAfter.length&&t-this.prevTime<r.newGroupDelay&&r.joinToEvent(s,Ac(l.changes,e.changes))||i=="input.type.compose")?o=en(o,o.length-1,r.minDepth,new de(e.changes.compose(l.changes),na(Y.mapEffects(e.effects,l.changes),l.effects),l.mapped,l.startSelection,Se)):o=en(o,o.length,r.minDepth,e),new ze(o,Se,t,i)}addSelection(e,t,i,r){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:Se;return s.length>0&&t-this.prevTime<r&&i==this.prevUserEvent&&i&&/^select($|\.)/.test(i)&&Cc(s[s.length-1],e)?this:new ze(ra(this.done,e),this.undone,t,i)}addMapping(e){return new ze(Pn(this.done,e),Pn(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,i){let r=e==0?this.done:this.undone;if(r.length==0)return null;let s=r[r.length-1],o=s.selectionsAfter[0]||(s.startSelection?s.startSelection.map(s.changes.invertedDesc,1):t.selection);if(i&&s.selectionsAfter.length)return t.update({selection:s.selectionsAfter[s.selectionsAfter.length-1],annotations:br.of({side:e,rest:Tc(r),selection:o}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let l=r.length==1?Se:r.slice(0,r.length-1);return s.mapped&&(l=Pn(l,s.mapped)),t.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:br.of({side:e,rest:l,selection:o}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}ze.empty=new ze(Se,Se);const Mc=[{key:"Mod-z",run:ia,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:wr,preventDefault:!0},{linux:"Ctrl-Shift-z",run:wr,preventDefault:!0},{key:"Mod-u",run:kc,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Sc,preventDefault:!0}];function Ft(n,e){return v.create(n.ranges.map(e),n.mainIndex)}function De(n,e){return n.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function Me({state:n,dispatch:e},t){let i=Ft(n.selection,t);return i.eq(n.selection,!0)?!1:(e(De(n,i)),!0)}function un(n,e){return v.cursor(e?n.to:n.from)}function sa(n,e){return Me(n,t=>t.empty?n.moveByChar(t,e):un(t,e))}function le(n){return n.textDirectionAt(n.state.selection.main.head)==Q.LTR}const oa=n=>sa(n,!le(n)),la=n=>sa(n,le(n));function aa(n,e){return Me(n,t=>t.empty?n.moveByGroup(t,e):un(t,e))}const Oc=n=>aa(n,!le(n)),Lc=n=>aa(n,le(n));function Pc(n,e,t){if(e.type.prop(t))return!0;let i=e.to-e.from;return i&&(i>2||/[^\s,.;:]/.test(n.sliceDoc(e.from,e.to)))||e.firstChild}function cn(n,e,t){let i=Ke(n).resolveInner(e.head),r=t?P.closedBy:P.openedBy;for(let a=e.head;;){let h=t?i.childAfter(a):i.childBefore(a);if(!h)break;Pc(n,h,r)?i=h:a=t?h.to:h.from}let s=i.type.prop(r),o,l;return s&&(o=t?Fe(n,i.from,1):Fe(n,i.to,-1))&&o.matched?l=t?o.end.to:o.end.from:l=t?i.to:i.from,v.cursor(l,t?-1:1)}const Rc=n=>Me(n,e=>cn(n.state,e,!le(n))),Ic=n=>Me(n,e=>cn(n.state,e,le(n)));function ha(n,e){return Me(n,t=>{if(!t.empty)return un(t,e);let i=n.moveVertically(t,e);return i.head!=t.head?i:n.moveToLineBoundary(t,e)})}const fa=n=>ha(n,!1),ua=n=>ha(n,!0);function ca(n){let e=n.scrollDOM.clientHeight<n.scrollDOM.scrollHeight-2,t=0,i=0,r;if(e){for(let s of n.state.facet(O.scrollMargins)){let o=s(n);o?.top&&(t=Math.max(o?.top,t)),o?.bottom&&(i=Math.max(o?.bottom,i))}r=n.scrollDOM.clientHeight-t-i}else r=(n.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:t,marginBottom:i,selfScroll:e,height:Math.max(n.defaultLineHeight,r-5)}}function da(n,e){let t=ca(n),{state:i}=n,r=Ft(i.selection,o=>o.empty?n.moveVertically(o,e,t.height):un(o,e));if(r.eq(i.selection))return!1;let s;if(t.selfScroll){let o=n.coordsAtPos(i.selection.main.head),l=n.scrollDOM.getBoundingClientRect(),a=l.top+t.marginTop,h=l.bottom-t.marginBottom;o&&o.top>a&&o.bottom<h&&(s=O.scrollIntoView(r.main.head,{y:"start",yMargin:o.top-a}))}return n.dispatch(De(i,r),{effects:s}),!0}const ho=n=>da(n,!1),vr=n=>da(n,!0);function ft(n,e,t){let i=n.lineBlockAt(e.head),r=n.moveToLineBoundary(e,t);if(r.head==e.head&&r.head!=(t?i.to:i.from)&&(r=n.moveToLineBoundary(e,t,!1)),!t&&r.head==i.from&&i.length){let s=/^\s*/.exec(n.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;s&&e.head!=i.from+s&&(r=v.cursor(i.from+s))}return r}const Bc=n=>Me(n,e=>ft(n,e,!0)),Vc=n=>Me(n,e=>ft(n,e,!1)),Nc=n=>Me(n,e=>ft(n,e,!le(n))),Wc=n=>Me(n,e=>ft(n,e,le(n))),Hc=n=>Me(n,e=>v.cursor(n.lineBlockAt(e.head).from,1)),Fc=n=>Me(n,e=>v.cursor(n.lineBlockAt(e.head).to,-1));function zc(n,e,t){let i=!1,r=Ft(n.selection,s=>{let o=Fe(n,s.head,-1)||Fe(n,s.head,1)||s.head>0&&Fe(n,s.head-1,1)||s.head<n.doc.length&&Fe(n,s.head+1,-1);if(!o||!o.end)return s;i=!0;let l=o.start.from==s.head?o.end.to:o.end.from;return v.cursor(l)});return i?(e(De(n,r)),!0):!1}const jc=({state:n,dispatch:e})=>zc(n,e);function Ae(n,e,t){let i=Ft(n.state.selection,r=>{r.undirectional&&r.head>=r.anchor!=e&&(r=v.range(r.head,r.anchor));let s=t(r);return v.range(r.anchor,s.head,s.goalColumn,s.bidiLevel||void 0,s.assoc)});return i.eq(n.state.selection)?!1:(n.dispatch(De(n.state,i)),!0)}function pa(n,e){return Ae(n,e,t=>n.moveByChar(t,e))}const ga=n=>pa(n,!le(n)),ma=n=>pa(n,le(n));function ya(n,e){return Ae(n,e,t=>n.moveByGroup(t,e))}const Kc=n=>ya(n,!le(n)),qc=n=>ya(n,le(n)),Uc=n=>{let e=!le(n);return Ae(n,e,t=>cn(n.state,t,e))},$c=n=>{let e=le(n);return Ae(n,e,t=>cn(n.state,t,e))};function xa(n,e){return Ae(n,e,t=>n.moveVertically(t,e))}const ba=n=>xa(n,!1),wa=n=>xa(n,!0);function va(n,e){return Ae(n,e,t=>n.moveVertically(t,e,ca(n).height))}const fo=n=>va(n,!1),uo=n=>va(n,!0),Gc=n=>Ae(n,!0,e=>ft(n,e,!0)),Jc=n=>Ae(n,!1,e=>ft(n,e,!1)),Xc=n=>{let e=!le(n);return Ae(n,e,t=>ft(n,t,e))},Yc=n=>{let e=le(n);return Ae(n,e,t=>ft(n,t,e))},Qc=n=>Ae(n,!1,e=>v.cursor(n.lineBlockAt(e.head).from)),Zc=n=>Ae(n,!0,e=>v.cursor(n.lineBlockAt(e.head).to)),co=({state:n,dispatch:e})=>(e(De(n,{anchor:0})),!0),po=({state:n,dispatch:e})=>(e(De(n,{anchor:n.doc.length})),!0),go=({state:n,dispatch:e})=>(e(De(n,{anchor:n.selection.main.anchor,head:0})),!0),mo=({state:n,dispatch:e})=>(e(De(n,{anchor:n.selection.main.anchor,head:n.doc.length})),!0),ed=({state:n,dispatch:e})=>(e(n.update({selection:{anchor:0,head:n.doc.length},userEvent:"select"})),!0),td=({state:n,dispatch:e})=>{let t=dn(n).map(({from:i,to:r})=>v.undirectionalRange(i,Math.min(r+1,n.doc.length)));return e(n.update({selection:v.create(t),userEvent:"select"})),!0},id=({state:n,dispatch:e})=>{let t=Ft(n.selection,i=>{let r=Ke(n),s=r.resolveStack(i.from,1);if(i.empty){let o=r.resolveStack(i.from,-1);o.node.from>=s.node.from&&o.node.to<=s.node.to&&(s=o)}for(let o=s;o;o=o.next){let{node:l}=o;if((l.from<i.from&&l.to>=i.to||l.to>i.to&&l.from<=i.from)&&o.next)return v.undirectionalRange(l.from,l.to)}return i});return t.eq(n.selection)?!1:(e(De(n,t)),!0)};function ka(n,e){let{state:t}=n,i=t.selection,r=t.selection.ranges.slice();for(let s of t.selection.ranges){let o=t.doc.lineAt(s.head);if(e?o.to<n.state.doc.length:o.from>0)for(let l=s;;){let a=n.moveVertically(l,e);if(a.head<o.from||a.head>o.to){r.some(h=>h.head==a.head)||r.push(a);break}else{if(a.head==l.head)break;l=a}}}return r.length==i.ranges.length?!1:(n.dispatch(De(t,v.create(r,r.length-1))),!0)}const nd=n=>ka(n,!1),rd=n=>ka(n,!0),sd=({state:n,dispatch:e})=>{let t=n.selection,i=null;return t.ranges.length>1?i=v.create([t.main]):t.main.empty||(i=v.create([v.cursor(t.main.head)])),i?(e(De(n,i)),!0):!1};function xi(n,e){if(n.state.readOnly)return!1;let t="delete.selection",{state:i}=n,r=i.changeByRange(s=>{let{from:o,to:l}=s;if(o==l){let a=e(s);a<o?(t="delete.backward",a=Bi(n,a,!1)):a>o&&(t="delete.forward",a=Bi(n,a,!0)),o=Math.min(o,a),l=Math.max(l,a)}else o=Bi(n,o,!1),l=Bi(n,l,!0);return o==l?{range:s}:{changes:{from:o,to:l},range:v.cursor(o,o<s.head?-1:1)}});return r.changes.empty?!1:(n.dispatch(i.update(r,{scrollIntoView:!0,userEvent:t,effects:t=="delete.selection"?O.announce.of(i.phrase("Selection deleted")):void 0})),!0)}function Bi(n,e,t){if(n instanceof O)for(let i of n.state.facet(O.atomicRanges).map(r=>r(n)))i.between(e,e,(r,s)=>{r<e&&s>e&&(e=t?s:r)});return e}const Sa=(n,e,t)=>xi(n,i=>{let r=i.from,{state:s}=n,o=s.doc.lineAt(r),l,a;if(t&&!e&&r>o.from&&r<o.from+200&&!/[^ \t]/.test(l=o.text.slice(0,r-o.from))){if(l[l.length-1]==" ")return r-1;let h=tn(l,s.tabSize),f=h%St(s)||St(s);for(let u=0;u<f&&l[l.length-1-u]==" ";u++)r--;a=r}else a=se(o.text,r-o.from,e,e)+o.from,a==r&&o.number!=(e?s.doc.lines:1)?a+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(o.text.slice(a-o.from,r-o.from))&&(a=se(o.text,a-o.from,!1,!1)+o.from);return a}),kr=n=>Sa(n,!1,!0),Aa=n=>Sa(n,!0,!1),Ca=(n,e)=>xi(n,t=>{let i=t.head,{state:r}=n,s=r.doc.lineAt(i),o=r.charCategorizer(i);for(let l=null;;){if(i==(e?s.to:s.from)){i==t.head&&s.number!=(e?r.doc.lines:1)&&(i+=e?1:-1);break}let a=se(s.text,i-s.from,e)+s.from,h=s.text.slice(Math.min(i,a)-s.from,Math.max(i,a)-s.from),f=o(h);if(l!=null&&f!=l)break;(h!=" "||i!=t.head)&&(l=f),i=a}return i}),_a=n=>Ca(n,!1),od=n=>Ca(n,!0),ld=n=>xi(n,e=>{let t=n.lineBlockAt(e.head).to;return e.head<t?t:Math.min(n.state.doc.length,e.head+1)}),ad=n=>xi(n,e=>{let t=n.moveToLineBoundary(e,!1).head;return e.head>t?t:Math.max(0,e.head-1)}),hd=n=>xi(n,e=>{let t=n.moveToLineBoundary(e,!0).head;return e.head<t?t:Math.min(n.state.doc.length,e.head+1)}),fd=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(i=>({changes:{from:i.from,to:i.to,insert:N.of(["",""])},range:v.cursor(i.from)}));return e(n.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},ud=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(i=>{if(!i.empty||i.from==0||i.from==n.doc.length)return{range:i};let r=i.from,s=n.doc.lineAt(r),o=r==s.from?r-1:se(s.text,r-s.from,!1)+s.from,l=r==s.to?r+1:se(s.text,r-s.from,!0)+s.from;return{changes:{from:o,to:l,insert:n.doc.slice(r,l).append(n.doc.slice(o,r))},range:v.cursor(l)}});return t.changes.empty?!1:(e(n.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function dn(n){let e=[],t=-1;for(let i of n.selection.ranges){let r=n.doc.lineAt(i.from),s=n.doc.lineAt(i.to);if(!i.empty&&i.to==s.from&&(s=n.doc.lineAt(i.to-1)),t>=r.number){let o=e[e.length-1];o.to=s.to,o.ranges.push(i)}else e.push({from:r.from,to:s.to,ranges:[i]});t=s.number+1}return e}function Ta(n,e,t){if(n.readOnly)return!1;let i=[],r=[];for(let s of dn(n)){if(t?s.to==n.doc.length:s.from==0)continue;let o=n.doc.lineAt(t?s.to+1:s.from-1),l=o.length+1;if(t){i.push({from:s.to,to:o.to},{from:s.from,insert:o.text+n.lineBreak});for(let a of s.ranges)r.push(v.range(Math.min(n.doc.length,a.anchor+l),Math.min(n.doc.length,a.head+l)))}else{i.push({from:o.from,to:s.from},{from:s.to,insert:n.lineBreak+o.text});for(let a of s.ranges)r.push(v.range(a.anchor-l,a.head-l))}}return i.length?(e(n.update({changes:i,scrollIntoView:!0,selection:v.create(r,n.selection.mainIndex),userEvent:"move.line"})),!0):!1}const cd=({state:n,dispatch:e})=>Ta(n,e,!1),dd=({state:n,dispatch:e})=>Ta(n,e,!0);function Ea(n,e,t){if(n.readOnly)return!1;let i=[];for(let s of dn(n))t?i.push({from:s.from,insert:n.doc.slice(s.from,s.to)+n.lineBreak}):i.push({from:s.to,insert:n.lineBreak+n.doc.slice(s.from,s.to)});let r=n.changes(i);return e(n.update({changes:r,selection:n.selection.map(r,t?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const pd=({state:n,dispatch:e})=>Ea(n,e,!1),gd=({state:n,dispatch:e})=>Ea(n,e,!0),md=n=>{if(n.state.readOnly)return!1;let{state:e}=n,t=e.changes(dn(e).map(({from:r,to:s})=>(r>0?r--:s<e.doc.length&&s++,{from:r,to:s}))),i=Ft(e.selection,r=>{let s;if(n.lineWrapping){let o=n.lineBlockAt(r.head),l=n.coordsAtPos(r.head,r.assoc||1);l&&(s=o.bottom+n.documentTop-l.bottom+n.defaultLineHeight/2)}return n.moveVertically(r,!0,s)}).map(t);return n.dispatch({changes:t,selection:i,scrollIntoView:!0,userEvent:"delete.line"}),!0};function yd(n,e){if(/\(\)|\[\]|\{\}/.test(n.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=Ke(n).resolveInner(e),i=t.childBefore(e),r=t.childAfter(e),s;return i&&r&&i.to<=e&&r.from>=e&&(s=i.type.prop(P.closedBy))&&s.indexOf(r.name)>-1&&n.doc.lineAt(i.to).from==n.doc.lineAt(r.from).from&&!/\S/.test(n.sliceDoc(i.to,r.from))?{from:i.to,to:r.from}:null}const yo=Da(!1),xd=Da(!0);function Da(n){return({state:e,dispatch:t})=>{if(e.readOnly)return!1;let i=e.changeByRange(r=>{let{from:s,to:o}=r,l=e.doc.lineAt(s),a=!n&&s==o&&yd(e,s);n&&(s=o=(o<=l.to?l:e.doc.lineAt(o)).to);let h=new an(e,{simulateBreak:s,simulateDoubleBreak:!!a}),f=Kr(h,s);for(f==null&&(f=tn(/^\s*/.exec(e.doc.lineAt(s).text)[0],e.tabSize));o<l.to&&/\s/.test(l.text[o-l.from]);)o++;a?{from:s,to:o}=a:s>l.from&&s<l.from+100&&!/\S/.test(l.text.slice(0,s))&&(s=l.from);let u=["",ci(e,f)];return a&&u.push(ci(e,h.lineIndent(l.from,-1))),{changes:{from:s,to:o,insert:N.of(u)},range:v.cursor(s+1+u[1].length)}});return t(e.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}function Yr(n,e){let t=-1;return n.changeByRange(i=>{let r=[];for(let o=i.from;o<=i.to;){let l=n.doc.lineAt(o);l.number>t&&(i.empty||i.to>l.from)&&(e(l,r,i),t=l.number),o=l.to+1}let s=n.changes(r);return{changes:r,range:v.range(s.mapPos(i.anchor,1),s.mapPos(i.head,1))}})}const bd=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=Object.create(null),i=new an(n,{overrideIndentation:s=>{let o=t[s];return o??-1}}),r=Yr(n,(s,o,l)=>{let a=Kr(i,s.from);if(a==null)return;/\S/.test(s.text)||(a=0);let h=/^\s*/.exec(s.text)[0],f=ci(n,a);(h!=f||l.from<s.from+h.length)&&(t[s.from]=a,o.push({from:s.from,to:s.from+h.length,insert:f}))});return r.changes.empty||e(n.update(r,{userEvent:"indent"})),!0},Ma=({state:n,dispatch:e})=>n.readOnly?!1:(e(n.update(Yr(n,(t,i)=>{i.push({from:t.from,insert:n.facet(jr)})}),{userEvent:"input.indent"})),!0),Oa=({state:n,dispatch:e})=>n.readOnly?!1:(e(n.update(Yr(n,(t,i)=>{let r=/^\s*/.exec(t.text)[0];if(!r)return;let s=tn(r,n.tabSize),o=0,l=ci(n,Math.max(0,s-St(n)));for(;o<r.length&&o<l.length&&r.charCodeAt(o)==l.charCodeAt(o);)o++;i.push({from:t.from+o,to:t.from+r.length,insert:l.slice(o)})}),{userEvent:"delete.dedent"})),!0),wd=n=>(n.setTabFocusMode(),!0),vd=[{key:"Ctrl-b",run:oa,shift:ga,preventDefault:!0},{key:"Ctrl-f",run:la,shift:ma},{key:"Ctrl-p",run:fa,shift:ba},{key:"Ctrl-n",run:ua,shift:wa},{key:"Ctrl-a",run:Hc,shift:Qc},{key:"Ctrl-e",run:Fc,shift:Zc},{key:"Ctrl-d",run:Aa},{key:"Ctrl-h",run:kr},{key:"Ctrl-k",run:ld},{key:"Ctrl-Alt-h",run:_a},{key:"Ctrl-o",run:fd},{key:"Ctrl-t",run:ud},{key:"Ctrl-v",run:vr}],kd=[{key:"ArrowLeft",run:oa,shift:ga,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:Oc,shift:Kc,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Nc,shift:Xc,preventDefault:!0},{key:"ArrowRight",run:la,shift:ma,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:Lc,shift:qc,preventDefault:!0},{mac:"Cmd-ArrowRight",run:Wc,shift:Yc,preventDefault:!0},{key:"ArrowUp",run:fa,shift:ba,preventDefault:!0},{mac:"Cmd-ArrowUp",run:co,shift:go},{mac:"Ctrl-ArrowUp",run:ho,shift:fo},{key:"ArrowDown",run:ua,shift:wa,preventDefault:!0},{mac:"Cmd-ArrowDown",run:po,shift:mo},{mac:"Ctrl-ArrowDown",run:vr,shift:uo},{key:"PageUp",run:ho,shift:fo},{key:"PageDown",run:vr,shift:uo},{key:"Home",run:Vc,shift:Jc,preventDefault:!0},{key:"Mod-Home",run:co,shift:go},{key:"End",run:Bc,shift:Gc,preventDefault:!0},{key:"Mod-End",run:po,shift:mo},{key:"Enter",run:yo,shift:yo},{key:"Mod-a",run:ed},{key:"Backspace",run:kr,shift:kr,preventDefault:!0},{key:"Delete",run:Aa,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:_a,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:od,preventDefault:!0},{mac:"Mod-Backspace",run:ad,preventDefault:!0},{mac:"Mod-Delete",run:hd,preventDefault:!0}].concat(vd.map(n=>({mac:n.key,run:n.run,shift:n.shift}))),Sd=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:Rc,shift:Uc},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:Ic,shift:$c},{key:"Alt-ArrowUp",run:cd},{key:"Shift-Alt-ArrowUp",run:pd},{key:"Alt-ArrowDown",run:dd},{key:"Shift-Alt-ArrowDown",run:gd},{key:"Mod-Alt-ArrowUp",run:nd},{key:"Mod-Alt-ArrowDown",run:rd},{key:"Escape",run:sd},{key:"Mod-Enter",run:xd},{key:"Alt-l",mac:"Ctrl-l",run:td},{key:"Mod-i",run:id,preventDefault:!0},{key:"Mod-[",run:Oa},{key:"Mod-]",run:Ma},{key:"Mod-Alt-\\",run:bd},{key:"Shift-Mod-k",run:md},{key:"Shift-Mod-\\",run:jc},{key:"Mod-/",run:cc},{key:"Alt-A",mac:"Ctrl-A",run:pc},{key:"Ctrl-m",mac:"Shift-Alt-m",run:wd}].concat(kd),Ad={key:"Tab",run:Ma,shift:Oa};function w(n){return new Iu(Ur.define(n))}function Qe(n){return x(()=>import("./index-BZyZXiVP.js"),__vite__mapDeps([0,1,2,3,4])).then(e=>e.sql({dialect:e[n]}))}const Cd=[m.of({name:"C",extensions:["c","h","ino"],load(){return x(()=>import("./index-DL_hDFJK.js"),__vite__mapDeps([5,1,3,4])).then(n=>n.cpp())}}),m.of({name:"C++",alias:["cpp"],extensions:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],load(){return x(()=>import("./index-DL_hDFJK.js"),__vite__mapDeps([5,1,3,4])).then(n=>n.cpp())}}),m.of({name:"CQL",alias:["cassandra"],extensions:["cql"],load(){return Qe("Cassandra")}}),m.of({name:"CSS",extensions:["css"],load(){return x(()=>import("./index-Dl0klRA0.js"),__vite__mapDeps([6,1,3,4])).then(n=>n.css())}}),m.of({name:"Go",extensions:["go"],load(){return x(()=>import("./index-dEth1qer.js"),__vite__mapDeps([7,1,2,3,4])).then(n=>n.go())}}),m.of({name:"HTML",alias:["xhtml"],extensions:["html","htm","handlebars","hbs"],load(){return x(()=>import("./index-DwafvHBM.js"),__vite__mapDeps([8,1,6,3,4,9,2])).then(n=>n.html())}}),m.of({name:"Java",extensions:["java"],load(){return x(()=>import("./index-CZfKMV0S.js"),__vite__mapDeps([10,1,3,4])).then(n=>n.java())}}),m.of({name:"JavaScript",alias:["ecmascript","js","node"],extensions:["js","mjs","cjs"],load(){return x(()=>import("./index-CFS2kf4X.js"),__vite__mapDeps([9,1,2,3,4])).then(n=>n.javascript())}}),m.of({name:"Jinja",extensions:["j2","jinja","jinja2"],load(){return x(()=>import("./index-CclRN4na.js"),__vite__mapDeps([11,8,1,6,3,4,9,2])).then(n=>n.jinja())}}),m.of({name:"JSON",alias:["json5"],extensions:["json","map"],load(){return x(()=>import("./index-jiRPxWhK.js"),__vite__mapDeps([12,1,3,4])).then(n=>n.json())}}),m.of({name:"JSX",extensions:["jsx"],load(){return x(()=>import("./index-CFS2kf4X.js"),__vite__mapDeps([9,1,2,3,4])).then(n=>n.javascript({jsx:!0}))}}),m.of({name:"LESS",extensions:["less"],load(){return x(()=>import("./index-B5SFUruu.js"),__vite__mapDeps([13,6,1,3,4])).then(n=>n.less())}}),m.of({name:"Liquid",extensions:["liquid"],load(){return x(()=>import("./index-vvv2MPol.js"),__vite__mapDeps([14,8,1,6,3,4,9,2])).then(n=>n.liquid())}}),m.of({name:"MariaDB SQL",load(){return Qe("MariaSQL")}}),m.of({name:"Markdown",extensions:["md","markdown","mkd"],load(){return x(()=>import("./index-B3f48X5_.js"),__vite__mapDeps([15,2,8,1,6,3,4,9])).then(n=>n.markdown())}}),m.of({name:"MS SQL",load(){return Qe("MSSQL")}}),m.of({name:"MySQL",load(){return Qe("MySQL")}}),m.of({name:"PHP",extensions:["php","php3","php4","php5","php7","phtml"],load(){return x(()=>import("./index-BVEXkCPp.js"),__vite__mapDeps([16,1,8,6,3,4,9,2])).then(n=>n.php())}}),m.of({name:"PLSQL",extensions:["pls"],load(){return Qe("PLSQL")}}),m.of({name:"PostgreSQL",load(){return Qe("PostgreSQL")}}),m.of({name:"Python",extensions:["BUILD","bzl","py","pyw"],filename:/^(BUCK|BUILD)$/,load(){return x(()=>import("./index-CTGTArYi.js"),__vite__mapDeps([17,1,2,3,4])).then(n=>n.python())}}),m.of({name:"Rust",extensions:["rs"],load(){return x(()=>import("./index-CqAJwEb9.js"),__vite__mapDeps([18,1,3,4])).then(n=>n.rust())}}),m.of({name:"Sass",extensions:["sass"],load(){return x(()=>import("./index-BkfsYGDI.js"),__vite__mapDeps([19,1,6,3,4])).then(n=>n.sass({indented:!0}))}}),m.of({name:"SCSS",extensions:["scss"],load(){return x(()=>import("./index-BkfsYGDI.js"),__vite__mapDeps([19,1,6,3,4])).then(n=>n.sass())}}),m.of({name:"SQL",extensions:["sql"],load(){return Qe("StandardSQL")}}),m.of({name:"SQLite",load(){return Qe("SQLite")}}),m.of({name:"TSX",extensions:["tsx"],load(){return x(()=>import("./index-CFS2kf4X.js"),__vite__mapDeps([9,1,2,3,4])).then(n=>n.javascript({jsx:!0,typescript:!0}))}}),m.of({name:"TypeScript",alias:["ts"],extensions:["ts","mts","cts"],load(){return x(()=>import("./index-CFS2kf4X.js"),__vite__mapDeps([9,1,2,3,4])).then(n=>n.javascript({typescript:!0}))}}),m.of({name:"WebAssembly",extensions:["wat","wast"],load(){return x(()=>import("./index-DNdNQX3_.js"),__vite__mapDeps([20,1,3,4])).then(n=>n.wast())}}),m.of({name:"XML",alias:["rss","wsdl","xsd"],extensions:["xml","xsl","xsd","svg"],load(){return x(()=>import("./index-Bzi4leGz.js"),__vite__mapDeps([21,1,3,4])).then(n=>n.xml())}}),m.of({name:"YAML",alias:["yml"],extensions:["yaml","yml"],load(){return x(()=>import("./index-DRrfjJvh.js"),__vite__mapDeps([22,1,3,4])).then(n=>n.yaml())}}),m.of({name:"APL",extensions:["dyalog","apl"],load(){return x(()=>import("./apl-B4CMkyY2.js"),[]).then(n=>w(n.apl))}}),m.of({name:"PGP",alias:["asciiarmor"],extensions:["asc","pgp","sig"],load(){return x(()=>import("./asciiarmor-Df11BRmG.js"),[]).then(n=>w(n.asciiArmor))}}),m.of({name:"ASN.1",extensions:["asn","asn1"],load(){return x(()=>import("./asn1-EdZsLKOL.js"),[]).then(n=>w(n.asn1({})))}}),m.of({name:"Asterisk",filename:/^extensions\.conf$/i,load(){return x(()=>import("./asterisk-B-8jnY81.js"),[]).then(n=>w(n.asterisk))}}),m.of({name:"Brainfuck",extensions:["b","bf"],load(){return x(()=>import("./brainfuck-C4LP7Hcl.js"),[]).then(n=>w(n.brainfuck))}}),m.of({name:"Cobol",extensions:["cob","cpy"],load(){return x(()=>import("./cobol-CWcv1MsR.js"),[]).then(n=>w(n.cobol))}}),m.of({name:"C#",alias:["csharp","cs"],extensions:["cs"],load(){return x(()=>import("./clike-B9uivgTg.js"),[]).then(n=>w(n.csharp))}}),m.of({name:"Clojure",extensions:["clj","cljc","cljx"],load(){return x(()=>import("./clojure-BMjYHr_A.js"),[]).then(n=>w(n.clojure))}}),m.of({name:"ClojureScript",extensions:["cljs"],load(){return x(()=>import("./clojure-BMjYHr_A.js"),[]).then(n=>w(n.clojure))}}),m.of({name:"Closure Stylesheets (GSS)",extensions:["gss"],load(){return x(()=>import("./css-BnMrqG3P.js"),[]).then(n=>w(n.gss))}}),m.of({name:"CMake",extensions:["cmake","cmake.in"],filename:/^CMakeLists\.txt$/,load(){return x(()=>import("./cmake-BQqOBYOt.js"),[]).then(n=>w(n.cmake))}}),m.of({name:"CoffeeScript",alias:["coffee","coffee-script"],extensions:["coffee"],load(){return x(()=>import("./coffeescript-S37ZYGWr.js"),[]).then(n=>w(n.coffeeScript))}}),m.of({name:"Common Lisp",alias:["lisp"],extensions:["cl","lisp","el"],load(){return x(()=>import("./commonlisp-DBKNyK5s.js"),[]).then(n=>w(n.commonLisp))}}),m.of({name:"Cypher",extensions:["cyp","cypher"],load(){return x(()=>import("./cypher-C_CwsFkJ.js"),[]).then(n=>w(n.cypher))}}),m.of({name:"Cython",extensions:["pyx","pxd","pxi"],load(){return x(()=>import("./python-BuPzkPfP.js"),[]).then(n=>w(n.cython))}}),m.of({name:"Crystal",extensions:["cr"],load(){return x(()=>import("./crystal-SjHAIU92.js"),[]).then(n=>w(n.crystal))}}),m.of({name:"D",extensions:["d"],load(){return x(()=>import("./d-pRatUO7H.js"),[]).then(n=>w(n.d))}}),m.of({name:"Dart",extensions:["dart"],load(){return x(()=>import("./clike-B9uivgTg.js"),[]).then(n=>w(n.dart))}}),m.of({name:"diff",extensions:["diff","patch"],load(){return x(()=>import("./diff-DbItnlRl.js"),[]).then(n=>w(n.diff))}}),m.of({name:"Dockerfile",filename:/^Dockerfile$/,load(){return x(()=>import("./dockerfile-BKs6k2Af.js"),__vite__mapDeps([23,24])).then(n=>w(n.dockerFile))}}),m.of({name:"DTD",extensions:["dtd"],load(){return x(()=>import("./dtd-DF_7sFjM.js"),[]).then(n=>w(n.dtd))}}),m.of({name:"Dylan",extensions:["dylan","dyl","intr"],load(){return x(()=>import("./dylan-DwRh75JA.js"),[]).then(n=>w(n.dylan))}}),m.of({name:"EBNF",load(){return x(()=>import("./ebnf-CDyGwa7X.js"),[]).then(n=>w(n.ebnf))}}),m.of({name:"ECL",extensions:["ecl"],load(){return x(()=>import("./ecl-Cabwm37j.js"),[]).then(n=>w(n.ecl))}}),m.of({name:"edn",extensions:["edn"],load(){return x(()=>import("./clojure-BMjYHr_A.js"),[]).then(n=>w(n.clojure))}}),m.of({name:"Eiffel",extensions:["e"],load(){return x(()=>import("./eiffel-CnydiIhH.js"),[]).then(n=>w(n.eiffel))}}),m.of({name:"Elm",extensions:["elm"],load(){return x(()=>import("./elm-vLlmbW-K.js"),[]).then(n=>w(n.elm))}}),m.of({name:"Erlang",extensions:["erl"],load(){return x(()=>import("./erlang-BNw1qcRV.js"),[]).then(n=>w(n.erlang))}}),m.of({name:"Esper",load(){return x(()=>import("./sql-D0XecflT.js"),[]).then(n=>w(n.esper))}}),m.of({name:"Factor",extensions:["factor"],load(){return x(()=>import("./factor-kuTfRLto.js"),__vite__mapDeps([25,24])).then(n=>w(n.factor))}}),m.of({name:"FCL",load(){return x(()=>import("./fcl-Kvtd6kyn.js"),[]).then(n=>w(n.fcl))}}),m.of({name:"Forth",extensions:["forth","fth","4th"],load(){return x(()=>import("./forth-Ffai-XNe.js"),[]).then(n=>w(n.forth))}}),m.of({name:"Fortran",extensions:["f","for","f77","f90","f95"],load(){return x(()=>import("./fortran-DYz_wnZ1.js"),[]).then(n=>w(n.fortran))}}),m.of({name:"F#",alias:["fsharp"],extensions:["fs"],load(){return x(()=>import("./mllike-CXdrOF99.js"),[]).then(n=>w(n.fSharp))}}),m.of({name:"Gas",extensions:["s"],load(){return x(()=>import("./gas-Bneqetm1.js"),[]).then(n=>w(n.gas))}}),m.of({name:"Gherkin",extensions:["feature"],load(){return x(()=>import("./gherkin-heZmZLOM.js"),[]).then(n=>w(n.gherkin))}}),m.of({name:"Groovy",extensions:["groovy","gradle"],filename:/^Jenkinsfile$/,load(){return x(()=>import("./groovy-D9Dt4D0W.js"),[]).then(n=>w(n.groovy))}}),m.of({name:"Haskell",extensions:["hs"],load(){return x(()=>import("./haskell-Cw1EW3IL.js"),[]).then(n=>w(n.haskell))}}),m.of({name:"Haxe",extensions:["hx"],load(){return x(()=>import("./haxe-H-WmDvRZ.js"),[]).then(n=>w(n.haxe))}}),m.of({name:"HXML",extensions:["hxml"],load(){return x(()=>import("./haxe-H-WmDvRZ.js"),[]).then(n=>w(n.hxml))}}),m.of({name:"HTTP",load(){return x(()=>import("./http-DBlCnlav.js"),[]).then(n=>w(n.http))}}),m.of({name:"IDL",extensions:["pro"],load(){return x(()=>import("./idl-BEugSyMb.js"),[]).then(n=>w(n.idl))}}),m.of({name:"JSON-LD",alias:["jsonld"],extensions:["jsonld"],load(){return x(()=>import("./javascript-iXu5QeM3.js"),[]).then(n=>w(n.jsonld))}}),m.of({name:"Julia",extensions:["jl"],load(){return x(()=>import("./julia-DuME0IfC.js"),[]).then(n=>w(n.julia))}}),m.of({name:"Kotlin",extensions:["kt","kts"],load(){return x(()=>import("./clike-B9uivgTg.js"),[]).then(n=>w(n.kotlin))}}),m.of({name:"LiveScript",alias:["ls"],extensions:["ls"],load(){return x(()=>import("./livescript-BwQOo05w.js"),[]).then(n=>w(n.liveScript))}}),m.of({name:"Lua",extensions:["lua"],load(){return x(()=>import("./lua-VAEuO923.js"),[]).then(n=>w(n.lua))}}),m.of({name:"mIRC",extensions:["mrc"],load(){return x(()=>import("./mirc-CjQqDB4T.js"),[]).then(n=>w(n.mirc))}}),m.of({name:"Mathematica",extensions:["m","nb","wl","wls"],load(){return x(()=>import("./mathematica-DTrFuWx2.js"),[]).then(n=>w(n.mathematica))}}),m.of({name:"Modelica",extensions:["mo"],load(){return x(()=>import("./modelica-Dc1JOy9r.js"),[]).then(n=>w(n.modelica))}}),m.of({name:"MUMPS",extensions:["mps"],load(){return x(()=>import("./mumps-BT43cFF4.js"),[]).then(n=>w(n.mumps))}}),m.of({name:"Mbox",extensions:["mbox"],load(){return x(()=>import("./mbox-CNhZ1qSd.js"),[]).then(n=>w(n.mbox))}}),m.of({name:"Nginx",filename:/nginx.*\.conf$/i,load(){return x(()=>import("./nginx-DdIZxoE0.js"),[]).then(n=>w(n.nginx))}}),m.of({name:"NSIS",extensions:["nsh","nsi"],load(){return x(()=>import("./nsis-LdVXkNf5.js"),__vite__mapDeps([26,24])).then(n=>w(n.nsis))}}),m.of({name:"NTriples",extensions:["nt","nq"],load(){return x(()=>import("./ntriples-BfvgReVJ.js"),[]).then(n=>w(n.ntriples))}}),m.of({name:"Objective-C",alias:["objective-c","objc"],extensions:["m"],load(){return x(()=>import("./clike-B9uivgTg.js"),[]).then(n=>w(n.objectiveC))}}),m.of({name:"Objective-C++",alias:["objective-c++","objc++"],extensions:["mm"],load(){return x(()=>import("./clike-B9uivgTg.js"),[]).then(n=>w(n.objectiveCpp))}}),m.of({name:"OCaml",extensions:["ml","mli","mll","mly"],load(){return x(()=>import("./mllike-CXdrOF99.js"),[]).then(n=>w(n.oCaml))}}),m.of({name:"Octave",extensions:["m"],load(){return x(()=>import("./octave-Ck1zUtKM.js"),[]).then(n=>w(n.octave))}}),m.of({name:"Oz",extensions:["oz"],load(){return x(()=>import("./oz-BzwKVEFT.js"),[]).then(n=>w(n.oz))}}),m.of({name:"Pascal",extensions:["p","pas"],load(){return x(()=>import("./pascal--L3eBynH.js"),[]).then(n=>w(n.pascal))}}),m.of({name:"Perl",extensions:["pl","pm"],load(){return x(()=>import("./perl-CdXCOZ3F.js"),[]).then(n=>w(n.perl))}}),m.of({name:"Pig",extensions:["pig"],load(){return x(()=>import("./pig-CevX1Tat.js"),[]).then(n=>w(n.pig))}}),m.of({name:"PowerShell",extensions:["ps1","psd1","psm1"],load(){return x(()=>import("./powershell-CFHJl5sT.js"),[]).then(n=>w(n.powerShell))}}),m.of({name:"Properties files",alias:["ini","properties"],extensions:["properties","ini","in"],load(){return x(()=>import("./properties-C78fOPTZ.js"),[]).then(n=>w(n.properties))}}),m.of({name:"ProtoBuf",extensions:["proto"],load(){return x(()=>import("./protobuf-ChK-085T.js"),[]).then(n=>w(n.protobuf))}}),m.of({name:"Pug",alias:["jade"],extensions:["pug","jade"],load(){return x(()=>import("./pug-DeIclll2.js"),__vite__mapDeps([27,28])).then(n=>w(n.pug))}}),m.of({name:"Puppet",extensions:["pp"],load(){return x(()=>import("./puppet-DMA9R1ak.js"),[]).then(n=>w(n.puppet))}}),m.of({name:"Q",extensions:["q"],load(){return x(()=>import("./q-pXgVlZs6.js"),[]).then(n=>w(n.q))}}),m.of({name:"R",alias:["rscript"],extensions:["r","R"],load(){return x(()=>import("./r-B6wPVr8A.js"),[]).then(n=>w(n.r))}}),m.of({name:"RPM Changes",load(){return x(()=>import("./rpm-CTu-6PCP.js"),[]).then(n=>w(n.rpmChanges))}}),m.of({name:"RPM Spec",extensions:["spec"],load(){return x(()=>import("./rpm-CTu-6PCP.js"),[]).then(n=>w(n.rpmSpec))}}),m.of({name:"Ruby",alias:["jruby","macruby","rake","rb","rbx"],extensions:["rb"],filename:/^(Gemfile|Rakefile)$/,load(){return x(()=>import("./ruby-B2Rjki9n.js"),[]).then(n=>w(n.ruby))}}),m.of({name:"SAS",extensions:["sas"],load(){return x(()=>import("./sas-B4kiWyti.js"),[]).then(n=>w(n.sas))}}),m.of({name:"Scala",extensions:["scala"],load(){return x(()=>import("./clike-B9uivgTg.js"),[]).then(n=>w(n.scala))}}),m.of({name:"Scheme",extensions:["scm","ss"],load(){return x(()=>import("./scheme-C41bIUwD.js"),[]).then(n=>w(n.scheme))}}),m.of({name:"Shell",alias:["bash","sh","zsh"],extensions:["sh","ksh","bash"],filename:/^PKGBUILD$/,load(){return x(()=>import("./shell-CjFT_Tl9.js"),[]).then(n=>w(n.shell))}}),m.of({name:"Sieve",extensions:["siv","sieve"],load(){return x(()=>import("./sieve-C3Gn_uJK.js"),[]).then(n=>w(n.sieve))}}),m.of({name:"Smalltalk",extensions:["st"],load(){return x(()=>import("./smalltalk-CnHTOXQT.js"),[]).then(n=>w(n.smalltalk))}}),m.of({name:"Solr",load(){return x(()=>import("./solr-DehyRSwq.js"),[]).then(n=>w(n.solr))}}),m.of({name:"SML",extensions:["sml","sig","fun","smackspec"],load(){return x(()=>import("./mllike-CXdrOF99.js"),[]).then(n=>w(n.sml))}}),m.of({name:"SPARQL",alias:["sparul"],extensions:["rq","sparql"],load(){return x(()=>import("./sparql-DkYu6x3z.js"),[]).then(n=>w(n.sparql))}}),m.of({name:"Spreadsheet",alias:["excel","formula"],load(){return x(()=>import("./spreadsheet-BCZA_wO0.js"),[]).then(n=>w(n.spreadsheet))}}),m.of({name:"Squirrel",extensions:["nut"],load(){return x(()=>import("./clike-B9uivgTg.js"),[]).then(n=>w(n.squirrel))}}),m.of({name:"Stylus",extensions:["styl"],load(){return x(()=>import("./stylus-B533Al4x.js"),[]).then(n=>w(n.stylus))}}),m.of({name:"Swift",extensions:["swift"],load(){return x(()=>import("./swift-BzpIVaGY.js"),[]).then(n=>w(n.swift))}}),m.of({name:"sTeX",load(){return x(()=>import("./stex-C3f8Ysf7.js"),[]).then(n=>w(n.stex))}}),m.of({name:"LaTeX",alias:["tex"],extensions:["text","ltx","tex"],load(){return x(()=>import("./stex-C3f8Ysf7.js"),[]).then(n=>w(n.stex))}}),m.of({name:"SystemVerilog",extensions:["v","sv","svh"],load(){return x(()=>import("./verilog-C6RDOZhf.js"),[]).then(n=>w(n.verilog))}}),m.of({name:"Tcl",extensions:["tcl"],load(){return x(()=>import("./tcl-DVfN8rqt.js"),[]).then(n=>w(n.tcl))}}),m.of({name:"Textile",extensions:["textile"],load(){return x(()=>import("./textile-CnDTJFAw.js"),[]).then(n=>w(n.textile))}}),m.of({name:"TiddlyWiki",load(){return x(()=>import("./tiddlywiki-DO-Gjzrf.js"),[]).then(n=>w(n.tiddlyWiki))}}),m.of({name:"Tiki wiki",load(){return x(()=>import("./tiki-DGYXhP31.js"),[]).then(n=>w(n.tiki))}}),m.of({name:"TOML",extensions:["toml"],load(){return x(()=>import("./toml-Bm5Em-hy.js"),[]).then(n=>w(n.toml))}}),m.of({name:"Troff",extensions:["1","2","3","4","5","6","7","8","9"],load(){return x(()=>import("./troff-wAsdV37c.js"),[]).then(n=>w(n.troff))}}),m.of({name:"TTCN",extensions:["ttcn","ttcn3","ttcnpp"],load(){return x(()=>import("./ttcn-CfJYG6tj.js"),[]).then(n=>w(n.ttcn))}}),m.of({name:"TTCN_CFG",extensions:["cfg"],load(){return x(()=>import("./ttcn-cfg-B9xdYoR4.js"),[]).then(n=>w(n.ttcnCfg))}}),m.of({name:"Turtle",extensions:["ttl"],load(){return x(()=>import("./turtle-B1tBg_DP.js"),[]).then(n=>w(n.turtle))}}),m.of({name:"Web IDL",extensions:["webidl"],load(){return x(()=>import("./webidl-ZXfAyPTL.js"),[]).then(n=>w(n.webIDL))}}),m.of({name:"VB.NET",extensions:["vb"],load(){return x(()=>import("./vb-CmGdzxic.js"),[]).then(n=>w(n.vb))}}),m.of({name:"VBScript",extensions:["vbs"],load(){return x(()=>import("./vbscript-BuJXcnF6.js"),[]).then(n=>w(n.vbScript))}}),m.of({name:"Velocity",extensions:["vtl"],load(){return x(()=>import("./velocity-D8B20fx6.js"),[]).then(n=>w(n.velocity))}}),m.of({name:"Verilog",extensions:["v"],load(){return x(()=>import("./verilog-C6RDOZhf.js"),[]).then(n=>w(n.verilog))}}),m.of({name:"VHDL",extensions:["vhd","vhdl"],load(){return x(()=>import("./vhdl-lSbBsy5d.js"),[]).then(n=>w(n.vhdl))}}),m.of({name:"XQuery",extensions:["xy","xquery","xq","xqm","xqy"],load(){return x(()=>import("./xquery-DzFWVndE.js"),[]).then(n=>w(n.xQuery))}}),m.of({name:"Yacas",extensions:["ys"],load(){return x(()=>import("./yacas-BJ4BC0dw.js"),[]).then(n=>w(n.yacas))}}),m.of({name:"Z80",extensions:["z80"],load(){return x(()=>import("./z80-Hz9HOZM7.js"),[]).then(n=>w(n.z80))}}),m.of({name:"MscGen",extensions:["mscgen","mscin","msc"],load(){return x(()=>import("./mscgen-BA5vi2Kp.js"),[]).then(n=>w(n.mscgen))}}),m.of({name:"Xù",extensions:["xu"],load(){return x(()=>import("./mscgen-BA5vi2Kp.js"),[]).then(n=>w(n.xu))}}),m.of({name:"MsGenny",extensions:["msgenny"],load(){return x(()=>import("./mscgen-BA5vi2Kp.js"),[]).then(n=>w(n.msgenny))}}),m.of({name:"Vue",extensions:["vue"],load(){return x(()=>import("./index-Cx98Z3Ta.js"),__vite__mapDeps([29,8,1,6,3,4,9,2])).then(n=>n.vue())}}),m.of({name:"Angular Template",load(){return x(()=>import("./index-BAj7bJQ9.js"),__vite__mapDeps([30,8,1,6,3,4,9,2])).then(n=>n.angular())}})],_d=O.theme({"&":{color:"var(--foreground)",backgroundColor:"transparent",fontSize:"var(--text-sm, 0.875rem)"},".cm-content":{caretColor:"var(--foreground)",padding:"0"},"&.cm-focused":{outline:"none"},".cm-line":{padding:"0"},".cm-cursor, .cm-dropCursor":{borderLeftColor:"var(--foreground)"},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, ::selection":{backgroundColor:"color-mix(in oklch, var(--primary) 25%, transparent)"},".cm-gutters":{backgroundColor:"transparent",color:"var(--muted-foreground)",border:"none",paddingInlineEnd:"0.5rem"},".cm-activeLineGutter":{backgroundColor:"transparent",color:"var(--foreground)"},".cm-placeholder":{color:"var(--muted-foreground)"}}),Td={[Rn.CODE]:()=>[O.theme({".cm-scroller":{fontFamily:"var(--font-mono, ui-monospace, monospace)"},".cm-activeLine":{backgroundColor:"color-mix(in oklch, var(--muted) 40%, transparent)"}}),Jf(),tc()],[Rn.PROSE]:()=>[O.theme({".cm-scroller":{fontFamily:"inherit"}})]},Ed=hn.define([{tag:[C.keyword,C.operatorKeyword,C.modifier],color:"var(--primary)"},{tag:[C.string,C.special(C.string)],color:"var(--chart-2, var(--primary))"},{tag:[C.number,C.bool,C.atom,C.null],color:"var(--chart-4, var(--foreground))"},{tag:[C.comment,C.blockComment,C.lineComment],color:"var(--muted-foreground)",fontStyle:"italic"},{tag:[C.typeName,C.className,C.namespace],color:"var(--chart-1, var(--foreground))"},{tag:[C.function(C.variableName),C.function(C.propertyName)],color:"var(--chart-5, var(--foreground))"},{tag:[C.propertyName,C.attributeName],color:"var(--chart-3, var(--foreground))"},{tag:C.invalid,color:"var(--destructive)"},{tag:C.heading,color:"var(--primary)",fontWeight:"600"},{tag:C.strong,fontWeight:"600"},{tag:C.emphasis,fontStyle:"italic"},{tag:C.strikethrough,textDecoration:"line-through"},{tag:[C.link,C.url],color:"var(--chart-2, var(--primary))",textDecoration:"underline"},{tag:[C.processingInstruction,C.meta,C.punctuation],color:"var(--muted-foreground)"},{tag:C.monospace,fontFamily:"var(--font-mono, ui-monospace, monospace)"}]);async function Dd(n){if(!n||n==="plaintext")return null;const e=m.matchLanguageName(Cd,n,!0);return e?await e.load():null}const xo=xe.forwardRef(function({appearance:e=Rn.CODE,value:t,onChange:i,onBlur:r,language:s,placeholder:o,disabled:l=!1,readOnly:a=!1,autoFocus:h=!1,showLineNumbers:f=!1,minRows:u=6,className:c,"aria-label":d},p){const g=xe.useRef(null),y=xe.useRef(null),b=xe.useRef(i);b.current=i;const A=xe.useRef(r);A.current=r;const S=xe.useRef(new Rt),R=xe.useRef(new Rt);return xe.useImperativeHandle(p,()=>g.current),xe.useLayoutEffect(()=>{const E=g.current;if(!E)return;const M=B.create({doc:t??"",extensions:[vc(),Ku(),...Td[e](),...f?[au()]:[],...o?[Zf(o)]:[],Ol.of([...Sd,...Mc,Ad]),_d,Uu(Ed),O.lineWrapping,S.current.of([]),R.current.of([O.editable.of(!(l||a)),B.readOnly.of(l||a)]),O.updateListener.of(W=>{W.docChanged&&b.current?.(W.state.doc.toString())}),O.domEventHandlers({blur:()=>{A.current?.()}})]}),T=new O({state:M,parent:E});return y.current=T,h&&T.focus(),()=>{y.current=null,T.destroy()}},[]),xe.useEffect(()=>{const E=y.current;if(!E)return;const M=E.state.doc.toString(),T=t??"";T!==M&&E.dispatch({changes:{from:0,to:M.length,insert:T}})},[t]),xe.useEffect(()=>{let E=!1;return Dd(s).then(M=>{const T=y.current;E||!T||T.dispatch({effects:S.current.reconfigure(M??[])})}),()=>{E=!0}},[s]),xe.useEffect(()=>{const E=y.current;E&&E.dispatch({effects:R.current.reconfigure([O.editable.of(!(l||a)),B.readOnly.of(l||a)])})},[l,a]),La.jsx("div",{ref:g,role:"textbox","aria-multiline":"true","aria-label":d,"aria-disabled":l||void 0,"aria-readonly":a||void 0,"data-slot":"cm6-editor",className:c,style:{minHeight:`calc(${u} * 1.5em)`}})}),Fd=Object.freeze(Object.defineProperty({__proto__:null,CM6Editor:xo,default:xo},Symbol.toStringTag,{value:"Module"}));export{ht as A,tn as B,ke as C,hu as D,v as E,D as F,Nd as G,B as H,F as I,yt as J,m as K,gr as L,me as M,Wr as N,Nt as O,Bl as P,Fd as Q,xt as R,Y as S,j as T,pi as W,Iu as a,Ke as b,Vd as c,ue as d,P as e,Wd as f,ee as g,N as h,Fl as i,jr as j,z as k,at as l,O as m,Cr as n,Ol as o,Pd as p,Id as q,Hd as r,Tu as s,C as t,Bd as u,Ld as v,ic as w,Lu as x,Wl as y,be as z};