pi-outpost 0.41.0 → 0.43.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/dist/contract/validate-structured-exchange.mjs +1 -1
  2. package/dist/pi-outpost-tools.mjs +1 -1
  3. package/dist/pi-outpost.mjs +1995 -716
  4. package/dist/pi-outpost.sea.mjs +2 -2
  5. package/dist/sea-prep.blob +2 -2
  6. package/dist/web/assets/CodeEditor-B123NBEk.js +10 -0
  7. package/dist/web/assets/{PdfViewer-CJB_BAIm.js → PdfViewer-CvlaA88J.js} +2 -2
  8. package/dist/web/assets/{abnfDiagram-WEYOIA3C-DAbvsZGC.js → abnfDiagram-WEYOIA3C-DJT_Ic7m.js} +1 -1
  9. package/dist/web/assets/{architecture-WOLXFQ4H-D9h_CjHG.js → architecture-WOLXFQ4H-1X6UB03L.js} +1 -1
  10. package/dist/web/assets/{architectureDiagram-ZHVYKT53-DOIenU4B.js → architectureDiagram-ZHVYKT53-DtAcdgDf.js} +1 -1
  11. package/dist/web/assets/{blockDiagram-RJAE7QA3-4bLmAb3h.js → blockDiagram-RJAE7QA3-LwDn-ru7.js} +1 -1
  12. package/dist/web/assets/{c4Diagram-XDPPPE54-BOIUrB14.js → c4Diagram-XDPPPE54-HoGbXw41.js} +1 -1
  13. package/dist/web/assets/channel-BS1PdTTb.js +1 -0
  14. package/dist/web/assets/{chunk-2E7WHVMD-DCN3RDFe.js → chunk-2E7WHVMD-CgiRHuHp.js} +1 -1
  15. package/dist/web/assets/{chunk-4EMNKR2T-WfNGX9Q_.js → chunk-4EMNKR2T-DMtN1wk6.js} +1 -1
  16. package/dist/web/assets/{chunk-55XCU76K-COsR6SXW.js → chunk-55XCU76K-Cs2Iijw1.js} +1 -1
  17. package/dist/web/assets/{chunk-7S6XSTFO-BIdiCve1.js → chunk-7S6XSTFO-Je4Wj9Rr.js} +1 -1
  18. package/dist/web/assets/{chunk-AQDTSKZB-ClT8Hd6F.js → chunk-AQDTSKZB-C8GB_Ui_.js} +1 -1
  19. package/dist/web/assets/{chunk-DSNLSHJZ-Beg_OHes.js → chunk-DSNLSHJZ-DaRLU1qt.js} +3 -3
  20. package/dist/web/assets/{chunk-HAGFOTED-XSQJyCXd.js → chunk-HAGFOTED-D-D65AyF.js} +1 -1
  21. package/dist/web/assets/{chunk-HNE4Q36P-B_mIhDKd.js → chunk-HNE4Q36P-BwNe1j6O.js} +1 -1
  22. package/dist/web/assets/{chunk-NQOKRVIF-DwQCGBSa.js → chunk-NQOKRVIF-L8-NQaTk.js} +1 -1
  23. package/dist/web/assets/{chunk-UHW7PFBP-C-Q5MuZk.js → chunk-UHW7PFBP-HDXbOEZI.js} +1 -1
  24. package/dist/web/assets/{chunk-VQ5W62QI-Bap-yYFp.js → chunk-VQ5W62QI-ekymdHY7.js} +1 -1
  25. package/dist/web/assets/{chunk-WQQL4CDK-CQxPBsR7.js → chunk-WQQL4CDK-CvUSO1KH.js} +1 -1
  26. package/dist/web/assets/{chunk-YZO67HFG-CHVvHqDo.js → chunk-YZO67HFG-CjeirPb6.js} +1 -1
  27. package/dist/web/assets/{chunk-ZAUX2LTX-BE3wIqH-.js → chunk-ZAUX2LTX-cTNIHs1b.js} +1 -1
  28. package/dist/web/assets/{chunk-ZCHMQSOR-B67B91cE.js → chunk-ZCHMQSOR-CDrGWvIC.js} +1 -1
  29. package/dist/web/assets/{classDiagram-v2-4MYWR3UA-CMEI16zl.js → classDiagram-v2-4MYWR3UA-C1S0UW8z.js} +1 -1
  30. package/dist/web/assets/{conversationExport-BI930ong.js → conversationExport-jN-MYzY9.js} +1 -1
  31. package/dist/web/assets/{cynefin-EF2NZ3EQ-BGUl-uHo.js → cynefin-EF2NZ3EQ-BsGJ6FOt.js} +1 -1
  32. package/dist/web/assets/{cynefinDiagram-WF24UDRP-B51R4dAM.js → cynefinDiagram-WF24UDRP-qfjwnjVR.js} +1 -1
  33. package/dist/web/assets/{dagre-NK4GIZVX-IwFCTqDL.js → dagre-NK4GIZVX-3mDxlBxx.js} +1 -1
  34. package/dist/web/assets/{diagram-CBK3MWTC-B9tIvu-T.js → diagram-CBK3MWTC-CFOomBRX.js} +1 -1
  35. package/dist/web/assets/{diagram-I5XIIV2D-BqF0cblq.js → diagram-I5XIIV2D-B42chBq4.js} +1 -1
  36. package/dist/web/assets/{diagram-ODIL2UCW-N_-ytLq0.js → diagram-ODIL2UCW-DPHTNf2y.js} +1 -1
  37. package/dist/web/assets/{diagram-PFBEJUXE-BdEBWefU.js → diagram-PFBEJUXE-BWAna7eo.js} +1 -1
  38. package/dist/web/assets/{diagram-RJA3I4VV-VtHbaRbf.js → diagram-RJA3I4VV-C9scCIzU.js} +1 -1
  39. package/dist/web/assets/{diagram-TYUNFSNR-B-sH0ySQ.js → diagram-TYUNFSNR-C7NO-Ebj.js} +1 -1
  40. package/dist/web/assets/{dist-JU1VdNrZ.js → dist--GnAX59q.js} +1 -1
  41. package/dist/web/assets/{dist-DlCLnYVf.js → dist-7keixpik.js} +1 -1
  42. package/dist/web/assets/{dist-CTtTxsTx.js → dist-B5P2_Wxl.js} +4 -4
  43. package/dist/web/assets/dist-BKLvNQOI.js +1 -0
  44. package/dist/web/assets/{dist-vzzOZwa_.js → dist-BN_neRHz.js} +2 -2
  45. package/dist/web/assets/{dist-Ca0oZpta.js → dist-BkXwTZu_.js} +1 -1
  46. package/dist/web/assets/{dist-Ce7RryWZ.js → dist-Br4rIykL.js} +1 -1
  47. package/dist/web/assets/dist-CPiugJt4.js +1 -0
  48. package/dist/web/assets/dist-CeyFaRuq.js +1 -0
  49. package/dist/web/assets/dist-CpBfDDqU.js +6 -0
  50. package/dist/web/assets/dist-D3XrMxUX.js +1 -0
  51. package/dist/web/assets/dist-DhU_QeGu.js +23 -0
  52. package/dist/web/assets/{dist-xsRDtH0g.js → dist-E-qcoL74.js} +1 -1
  53. package/dist/web/assets/{dist-B-DmyEbc.js → dist-LcJcw4rx.js} +1 -1
  54. package/dist/web/assets/{dist-Dg26Dnwg.js → dist-hkE3Dzbh.js} +1 -1
  55. package/dist/web/assets/dist-nSu4Hl9U.js +11 -0
  56. package/dist/web/assets/{docxExport-DJfWC4sC.js → docxExport-DTdmyOrq.js} +1 -1
  57. package/dist/web/assets/{ebnfDiagram-V4P3TTPT-DdTAxLKI.js → ebnfDiagram-V4P3TTPT-CKVJPcOo.js} +1 -1
  58. package/dist/web/assets/{elk-QONTBCTQ-BagsN_3E.js → elk-QONTBCTQ-Bjpp_hUm.js} +1 -1
  59. package/dist/web/assets/{erDiagram-KYQIGQAA-5NgP_O9c.js → erDiagram-KYQIGQAA-ahXNOH2j.js} +1 -1
  60. package/dist/web/assets/{eventmodeling-K75KTNOO-CP_3dTqr.js → eventmodeling-K75KTNOO-DFuS5JWb.js} +1 -1
  61. package/dist/web/assets/flowDiagram-IUGLLWBU-B2S9crxg.js +1 -0
  62. package/dist/web/assets/{ganttDiagram-R7GPNTJY-BdTQIRV3.js → ganttDiagram-R7GPNTJY-CUF0vHKX.js} +1 -1
  63. package/dist/web/assets/{gitGraph-VSP46ZUC-BJ6Y9trW.js → gitGraph-VSP46ZUC-BuhP1sw9.js} +1 -1
  64. package/dist/web/assets/{gitGraphDiagram-PDYL7XHY-CyRrkR-o.js → gitGraphDiagram-PDYL7XHY-mwsEay51.js} +1 -1
  65. package/dist/web/assets/index-B56c-g9j.js +381 -0
  66. package/dist/web/assets/index-uwznXVRc.css +2 -0
  67. package/dist/web/assets/{info-OHQRW6UA-HraiW6lx.js → info-OHQRW6UA-DPDtdGUp.js} +1 -1
  68. package/dist/web/assets/{infoDiagram-MVDRKAX5-BByYELM1.js → infoDiagram-MVDRKAX5-DX6YZ_rL.js} +1 -1
  69. package/dist/web/assets/{ishikawaDiagram-HPEHV2GE-14cGpOGR.js → ishikawaDiagram-HPEHV2GE-atu1SIZJ.js} +1 -1
  70. package/dist/web/assets/{journeyDiagram-BOSHW7O7-e16RV5AA.js → journeyDiagram-BOSHW7O7-cgcHl15d.js} +1 -1
  71. package/dist/web/assets/{kanban-definition-FNSA4HC5-j2-AohDw.js → kanban-definition-FNSA4HC5-wHlf1Ksj.js} +1 -1
  72. package/dist/web/assets/{line-BWL4z1_X.js → line-DbL7nSAS.js} +1 -1
  73. package/dist/web/assets/{loadReferencedImage-CQSsbhbR.js → loadReferencedImage-CzNYo1b1.js} +1 -1
  74. package/dist/web/assets/{mermaid-parser.core-Do7Tg9-B.js → mermaid-parser.core-D-w11H_2.js} +3 -3
  75. package/dist/web/assets/{mermaid.core-BW4B0C_D.js → mermaid.core-CzmHcBmx.js} +4 -4
  76. package/dist/web/assets/{mermaidToImage-mp-maH4L.js → mermaidToImage-Hjyav5KM.js} +3 -3
  77. package/dist/web/assets/{mindmap-definition-6OY57UG3-kw0SvjxH.js → mindmap-definition-6OY57UG3-CENIwM-L.js} +1 -1
  78. package/dist/web/assets/{packet-JDAUHWVQ-5WW2dIds.js → packet-JDAUHWVQ-jKce2Koi.js} +1 -1
  79. package/dist/web/assets/{pdf-DPmpn0PO.js → pdf-DqL0VQOW.js} +1 -1
  80. package/dist/web/assets/{pegDiagram-ECIUJNBX-D3CdF8Oe.js → pegDiagram-ECIUJNBX-CGOM8vu4.js} +1 -1
  81. package/dist/web/assets/{pie-XZMESJXO-DzxfhMPA.js → pie-XZMESJXO-B5yMqhIx.js} +1 -1
  82. package/dist/web/assets/{pieDiagram-GNMPY74T-JvFKDsh5.js → pieDiagram-GNMPY74T-VIPVJFkC.js} +1 -1
  83. package/dist/web/assets/{quadrantDiagram-D57K4MC3-BpVVMVB9.js → quadrantDiagram-D57K4MC3-Bhcw441k.js} +1 -1
  84. package/dist/web/assets/{radar-ABXABTNO-Bb6ZwqmW.js → radar-ABXABTNO-GySynPpW.js} +1 -1
  85. package/dist/web/assets/{railroad-I3PHUGI6-UcVUbVwW.js → railroad-I3PHUGI6-Er78o-E7.js} +1 -1
  86. package/dist/web/assets/{railroad-abnf-LNEFI6M7-BDYDDqJo.js → railroad-abnf-LNEFI6M7-CmRixQEB.js} +1 -1
  87. package/dist/web/assets/{railroad-ebnf-DWYD2UWJ-DT1V5ADw.js → railroad-ebnf-DWYD2UWJ-TpIgAYZi.js} +1 -1
  88. package/dist/web/assets/{railroad-peg-JR7BVNR7-Bs3SYXYC.js → railroad-peg-JR7BVNR7-BYBFcRhP.js} +1 -1
  89. package/dist/web/assets/{railroadDiagram-Y72NRBL7-T-55lJK-.js → railroadDiagram-Y72NRBL7-C49UsCkt.js} +1 -1
  90. package/dist/web/assets/{requirementDiagram-EQYSW5RA-BB_D8C4x.js → requirementDiagram-EQYSW5RA-C-Ot8mK5.js} +1 -1
  91. package/dist/web/assets/{sankeyDiagram-SY24JHO5-D1UNkujB.js → sankeyDiagram-SY24JHO5-BbgF5ilv.js} +1 -1
  92. package/dist/web/assets/{sequenceDiagram-BLEHNHQU-BdqTzlXQ.js → sequenceDiagram-BLEHNHQU-BeKw8Gmx.js} +1 -1
  93. package/dist/web/assets/{stateDiagram-v2-A6IESKWZ-DahBWVWF.js → stateDiagram-v2-A6IESKWZ-dOQPr6MB.js} +1 -1
  94. package/dist/web/assets/{swimlanes-B3ENRKFQ-B7W6gAPJ.js → swimlanes-B3ENRKFQ-CE-O5FAt.js} +1 -1
  95. package/dist/web/assets/swimlanesDiagram-AYQRV4AK-Bx2hw5cd.js +8 -0
  96. package/dist/web/assets/{timeline-definition-JXYKGLGB-DeRGZkNM.js → timeline-definition-JXYKGLGB-BRmnUVft.js} +1 -1
  97. package/dist/web/assets/{treeView-D4JQ5SDB-bVfTngw9.js → treeView-D4JQ5SDB-qrcJIxSz.js} +1 -1
  98. package/dist/web/assets/{treemap-SAJKECNS-BsLC65qV.js → treemap-SAJKECNS-wbrhe8YH.js} +1 -1
  99. package/dist/web/assets/{usecaseDiagram-WPOLBNNX-BT_KOX6u.js → usecaseDiagram-WPOLBNNX-DnxJ8olM.js} +1 -1
  100. package/dist/web/assets/{vennDiagram-Q3Y3IDCW-B8iFdLXC.js → vennDiagram-Q3Y3IDCW-hBXedDkZ.js} +1 -1
  101. package/dist/web/assets/{wardley-7MLQ67FV-D3ASlV2r.js → wardley-7MLQ67FV-wA7AmV0Q.js} +1 -1
  102. package/dist/web/assets/{wardleyDiagram-IVAIDKWA-DF-fA6qo.js → wardleyDiagram-IVAIDKWA-B-bb5lDE.js} +1 -1
  103. package/dist/web/assets/{xychartDiagram-4URNHDU4-BNFwJp2J.js → xychartDiagram-4URNHDU4-DhCniusd.js} +1 -1
  104. package/dist/web/index.html +2 -2
  105. package/package.json +1 -1
  106. package/dist/web/assets/CodeEditor-BRHzz4Yr.js +0 -7
  107. package/dist/web/assets/channel-CXha6NDd.js +0 -1
  108. package/dist/web/assets/dist-BKFwqYly.js +0 -1
  109. package/dist/web/assets/dist-C7veN12y.js +0 -1
  110. package/dist/web/assets/dist-CD-q_PIa.js +0 -1
  111. package/dist/web/assets/dist-DROKnaR5.js +0 -11
  112. package/dist/web/assets/dist-Fp9hbDcK.js +0 -6
  113. package/dist/web/assets/dist-Gh_fG1XV.js +0 -23
  114. package/dist/web/assets/dist-JhF1fwib.js +0 -1
  115. package/dist/web/assets/flowDiagram-IUGLLWBU-CUAMGpzQ.js +0 -1
  116. package/dist/web/assets/index-CHfryxyT.css +0 -2
  117. package/dist/web/assets/index-Dmq-pdD4.js +0 -377
  118. package/dist/web/assets/swimlanesDiagram-AYQRV4AK-BFcimX7j.js +0 -8
@@ -1,4 +1,4 @@
1
1
  [diffend] Oversized file quarantined before diffing.
2
2
  name: package/dist/pi-outpost.sea.mjs
3
- size: 39741306 bytes
4
- sha256: 6448ae2908a7374f9a3900a4377eb972faa2b6fc09c2b12b4ab17445116d8f8a
3
+ size: 39844405 bytes
4
+ sha256: f428784281c9ce3d6a2027256898898fc69d07298ac44f9eea8fe1b354db2c22
@@ -1,4 +1,4 @@
1
1
  [diffend] Oversized file quarantined before diffing.
2
2
  name: package/dist/sea-prep.blob
3
- size: 39740434 bytes
4
- sha256: 87f9b1c01657b0d34932cefdbc6f6c13e19af00643a5fa993eab6c2106a2c30e
3
+ size: 39843463 bytes
4
+ sha256: 303eb0ace84284a7f188e4ba9b0c84af2bba7e666dc61998c8af724e97adda79
@@ -0,0 +1,10 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-DhU_QeGu.js","assets/rolldown-runtime-COiEfhsA.js","assets/dist-7keixpik.js","assets/dist-E-qcoL74.js","assets/dist-Br4rIykL.js","assets/dist-D3XrMxUX.js","assets/dist-CPiugJt4.js","assets/dist-BKLvNQOI.js","assets/dist-CpBfDDqU.js","assets/dist-B5P2_Wxl.js","assets/dist-nSu4Hl9U.js","assets/dist-BkXwTZu_.js","assets/dist-LcJcw4rx.js","assets/dist--GnAX59q.js","assets/dist-CeyFaRuq.js","assets/dist-BN_neRHz.js","assets/dist-hkE3Dzbh.js"])))=>i.map(i=>d[i]);
2
+ import{n as e}from"./rolldown-runtime-COiEfhsA.js";import{D as t,E as n,M as r}from"./index-B56c-g9j.js";import{$ as i,A as a,B as o,C as s,Ct as c,E as l,F as u,G as d,H as f,I as p,J as m,K as h,L as ee,M as g,N as _,O as te,P as ne,Q as v,R as re,S as ie,U as ae,V as oe,W as se,X as ce,Y as le,Z as ue,at as de,b as fe,c as pe,ct as y,dt as b,et as x,ft as S,g as me,gt as he,ht as C,it as ge,j as _e,k as w,lt as T,m as ve,mt as ye,nt as be,ot as xe,pt as Se,q as Ce,rt as we,s as Te,st as E,t as Ee,tt as De,ut as Oe,vt as ke,w as Ae,y as je,z as Me}from"./dist-7keixpik.js";var D=r(),Ne=class{constructor(e,t,n,r){this.state=e,this.pos=t,this.explicit=n,this.view=r,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=w(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),n=Math.max(t.from,this.pos-250),r=t.text.slice(n-t.from,this.pos-t.from),i=r.search(ze(e,!1));return i<0?null:{from:n+i,to:this.pos,text:r.slice(i)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,n){e==`abort`&&this.abortListeners&&(this.abortListeners.push(t),n&&n.onDocChange&&(this.abortOnDocChange=!0))}};function Pe(e){let t=Object.keys(e).join(``),n=/\w/.test(t);return n&&(t=t.replace(/\w/g,``)),`[${n?`\\w`:``}${t.replace(/[^\w\s]/g,`\\$&`)}]`}function Fe(e){let t=Object.create(null),n=Object.create(null);for(let{label:r}of e){t[r[0]]=!0;for(let e=1;e<r.length;e++)n[r[e]]=!0}let r=Pe(t)+Pe(n)+`*$`;return[RegExp(`^`+r),new RegExp(r)]}function Ie(e){let t=e.map(e=>typeof e==`string`?{label:e}:e),[n,r]=t.every(e=>/^\w+$/.test(e.label))?[/\w*$/,/\w+$/]:Fe(t);return e=>{let i=e.matchBefore(r);return i||e.explicit?{from:i?i.from:e.pos,options:t,validFor:n}:null}}function Le(e,t){return n=>{for(let t=w(n.state).resolveInner(n.pos,-1);t;t=t.parent){if(e.indexOf(t.name)>-1)return null;if(t.type.isTop)break}return t(n)}}var Re=class{constructor(e,t,n,r){this.completion=e,this.source=t,this.match=n,this.score=r}};function O(e){return e.selection.main.from}function ze(e,t){let{source:n}=e,r=t&&n[0]!=`^`,i=n[n.length-1]!=`$`;return!r&&!i?e:RegExp(`${r?`^`:``}(?:${n})${i?`$`:``}`,e.flags??(e.ignoreCase?`i`:``))}var Be=le.define();function Ve(e,t,n,r){let{main:i}=e.selection,a=n-i.from,o=r-i.from;return{...e.changeByRange(s=>{if(s!=i&&n!=r&&e.sliceDoc(s.from+a,s.from+o)!=e.sliceDoc(n,r))return{range:s};let c=e.toText(t);return{changes:{from:s.from+a,to:r==i.from?s.to:s.from+o,insert:c},range:x.cursor(s.from+a+c.length)}}),scrollIntoView:!0,userEvent:`input.complete`}}var He=new WeakMap;function Ue(e){if(!Array.isArray(e))return e;let t=He.get(e);return t||He.set(e,t=Ie(e)),t}var We=E.define(),k=E.define(),Ge=class{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t<e.length;){let n=b(e,t),r=S(n);this.chars.push(n);let i=e.slice(t,t+r),a=i.toUpperCase();this.folded.push(b(a==i?i.toLowerCase():a,0)),t+=r}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:t,folded:n,any:r,precise:i,byWord:a}=this;if(t.length==1){let r=b(e,0),i=S(r),a=i==e.length?0:-100;if(r!=t[0]){if(r==n[0])a+=-200;else return null}return this.ret(a,[0,i])}let o=e.indexOf(this.pattern);if(o==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let s=t.length,c=0;if(o<0){for(let i=0,a=Math.min(e.length,200);i<a&&c<s;){let a=b(e,i);(a==t[c]||a==n[c])&&(r[c++]=i),i+=S(a)}if(c<s)return null}let l=0,u=0,d=!1,f=0,p=-1,m=-1,h=/[a-z]/.test(e),ee=!0;for(let r=0,c=Math.min(e.length,200),g=0;r<c&&u<s;){let c=b(e,r);o<0&&(l<s&&c==t[l]&&(i[l++]=r),f<s&&(c==t[f]||c==n[f]?(f==0&&(p=r),m=r+1,f++):f=0));let _,te=c<255?c>=48&&c<=57||c>=97&&c<=122?2:+(c>=65&&c<=90):(_=he(c))==_.toLowerCase()?_==_.toUpperCase()?0:2:1;(!r||te==1&&h||g==0&&te!=0)&&(t[u]==c||n[u]==c&&(d=!0)?a[u++]=r:a.length&&(ee=!1)),g=te,r+=S(c)}return u==s&&a[0]==0&&ee?this.result(-100+(d?-200:0),a,e):f==s&&p==0?this.ret(-200-e.length+(m==e.length?0:-100),[0,m]):o>-1?this.ret(-700-e.length,[o,o+this.pattern.length]):f==s?this.ret(-900-e.length,[p,m]):u==s?this.result(-100+(d?-200:0)+-700+(ee?0:-1100),a,e):t.length==2?null:this.result((r[0]?-700:0)+-200+-1100,r,e)}result(e,t,n){let r=[],i=0;for(let e of t){let t=e+(this.astral?S(b(n,e)):1);i&&r[i-1]==e?r[i-1]=t:(r[i++]=e,r[i++]=t)}return this.ret(e-n.length,r)}},Ke=class{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let t=e.slice(0,this.pattern.length),n=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return n==null?null:(this.matched=[0,t.length],this.score=n+(e.length==this.pattern.length?0:-100),this)}},A=be.define({combine(e){return Se(e,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>``,optionClass:()=>``,aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:Je,filterStrict:!1,compareCompletions:(e,t)=>(e.sortText||e.label).localeCompare(t.sortText||t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>n=>qe(e(n),t(n)),optionClass:(e,t)=>n=>qe(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function qe(e,t){return e?t?e+` `+t:e:t}function Je(e,t,n,r,i,a){let o=e.textDirection==_e.RTL,s=o,c=!1,l=`top`,u,d,f=t.left-i.left,p=i.right-t.right,m=r.right-r.left,h=r.bottom-r.top;if(s&&f<Math.min(m,p)?s=!1:!s&&p<Math.min(m,f)&&(s=!0),m<=(s?f:p))u=Math.max(i.top,Math.min(n.top,i.bottom-h))-t.top,d=Math.min(400,s?f:p);else{c=!0,d=Math.min(400,(o?t.right:i.right-t.left)-30);let e=i.bottom-t.bottom;e>=h||e>t.top?u=n.bottom-t.top:(l=`bottom`,u=t.bottom-n.top)}let ee=(t.bottom-t.top)/a.offsetHeight,g=(t.right-t.left)/a.offsetWidth;return{style:`${l}: ${u/ee}px; max-width: ${d/g}px`,class:`cm-completionInfo-`+(c?o?`left-narrow`:`right-narrow`:s?`left`:`right`)}}var Ye=E.define();function Xe(e){let t=e.addToOptions.slice();return e.icons&&t.push({render(e){let t=document.createElement(`div`);return t.classList.add(`cm-completionIcon`),e.type&&t.classList.add(...e.type.split(/\s+/g).map(e=>`cm-completionIcon-`+e)),t.setAttribute(`aria-hidden`,`true`),t},position:20}),t.push({render(e,t,n,r){let i=document.createElement(`span`);i.className=`cm-completionLabel`;let a=e.displayLabel||e.label,o=0;for(let e=0;e<r.length;){let t=r[e++],n=r[e++];t>o&&i.appendChild(document.createTextNode(a.slice(o,t)));let s=i.appendChild(document.createElement(`span`));s.appendChild(document.createTextNode(a.slice(t,n))),s.className=`cm-completionMatchedText`,o=n}return o<a.length&&i.appendChild(document.createTextNode(a.slice(o))),i},position:50},{render(e){if(!e.detail)return null;let t=document.createElement(`span`);return t.className=`cm-completionDetail`,t.textContent=e.detail,t},position:80}),t.sort((e,t)=>e.position-t.position).map(e=>e.render)}function Ze(e,t,n){if(e<=n)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){let e=Math.floor(t/n);return{from:e*n,to:(e+1)*n}}let r=Math.ceil((e-t)/n);return{from:e-r*n,to:e-(r-1)*n}}var Qe=class{constructor(e,t,n){this.view=e,this.stateField=t,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:e=>this.placeInfo(e),key:this},this.space=null,this.currentClass=``;let r=e.state.field(t),{options:i,selected:a}=r.open,o=e.state.facet(A);this.optionContent=Xe(o),this.optionClass=o.optionClass,this.tooltipClass=o.tooltipClass,this.range=Ze(i.length,a,o.maxRenderedOptions),this.dom=document.createElement(`div`),this.dom.className=`cm-tooltip-autocomplete`,this.updateTooltipClass(e.state),this.dom.addEventListener(`mousedown`,n=>{let{options:r}=e.state.field(t).open;for(let t=n.target,i;t&&t!=this.dom;t=t.parentNode)if(t.nodeName==`LI`&&(i=/-(\d+)$/.exec(t.id))&&+i[1]<r.length){this.applyCompletion(e,r[+i[1]]),n.preventDefault();return}if(n.target==this.list){let t=this.list.classList.contains(`cm-completionListIncompleteTop`)&&n.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains(`cm-completionListIncompleteBottom`)&&n.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;t!=null&&(e.dispatch({effects:Ye.of(t)}),n.preventDefault())}}),this.dom.addEventListener(`focusout`,t=>{let n=e.state.field(this.stateField,!1);n&&n.tooltip&&e.state.facet(A).closeOnBlur&&t.relatedTarget!=e.contentDOM&&e.dispatch({effects:k.of(null)})}),this.showOptions(i,r.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener(`scroll`,()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){let t=e.state.field(this.stateField),n=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),t!=n){let{options:r,selected:i,disabled:a}=t.open;(!n.open||n.open.options!=r)&&(this.range=Ze(r.length,i,e.state.facet(A).maxRenderedOptions),this.showOptions(r,t.id)),this.updateSel(),a!=n.open?.disabled&&this.dom.classList.toggle(`cm-tooltip-autocomplete-disabled`,!!a)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let e of this.currentClass.split(` `))e&&this.dom.classList.remove(e);for(let e of t.split(` `))e&&this.dom.classList.add(e);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;(t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to)&&(this.range=Ze(t.options.length,t.selected,this.view.state.facet(A).maxRenderedOptions),this.showOptions(t.options,e.id));let n=this.updateSelectedOption(t.selected);if(n){this.destroyInfo();let{completion:r}=t.options[t.selected],{info:i}=r;if(!i)return;let a=typeof i==`string`?document.createTextNode(i):i(r);if(!a)return;`then`in a?a.then(t=>{t&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(t,r)}).catch(e=>h(this.view.state,e,`completion info`)):(this.addInfoPane(a,r),n.setAttribute(`aria-describedby`,this.info.id))}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement(`div`);if(n.className=`cm-tooltip cm-completionInfo`,n.id=`cm-completionInfo-`+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)n.appendChild(e),this.infoDestroy=null;else{let{dom:t,destroy:r}=e;n.appendChild(t),this.infoDestroy=r||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,r=this.range.from;n;n=n.nextSibling,r++)n.nodeName!=`LI`||!n.id?r--:r==e?n.hasAttribute(`aria-selected`)||(n.setAttribute(`aria-selected`,`true`),t=n):n.hasAttribute(`aria-selected`)&&(n.removeAttribute(`aria-selected`),n.removeAttribute(`aria-describedby`));return t&&et(this.list,t),t}measureInfo(){let e=this.dom.querySelector(`[aria-selected]`);if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),r=e.getBoundingClientRect(),i=this.space;if(!i){let e=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:e.clientWidth,bottom:e.clientHeight}}return r.top>Math.min(i.bottom,t.bottom)-10||r.bottom<Math.max(i.top,t.top)+10?null:this.view.state.facet(A).positionInfo(this.view,t,r,n,i,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className=`cm-tooltip cm-completionInfo `+(e.class||``)):this.info.style.cssText=`top: -1e6px`)}createListBox(e,t,n){let r=document.createElement(`ul`);r.id=t,r.setAttribute(`role`,`listbox`),r.setAttribute(`aria-expanded`,`true`),r.setAttribute(`aria-label`,this.view.state.phrase(`Completions`)),r.addEventListener(`mousedown`,e=>{e.target==r&&e.preventDefault()});let i=null;for(let a=n.from;a<n.to;a++){let{completion:o,match:s}=e[a],{section:c}=o;if(c){let e=typeof c==`string`?c:c.name;if(e!=i&&(a>n.from||n.from==0)){if(i=e,typeof c!=`string`&&c.header)r.appendChild(c.header(c));else{let t=r.appendChild(document.createElement(`completion-section`));t.textContent=e}}}let l=r.appendChild(document.createElement(`li`));l.id=t+`-`+a,l.setAttribute(`role`,`option`);let u=this.optionClass(o);u&&(l.className=u);for(let e of this.optionContent){let t=e(o,this.view.state,this.view,s);t&&l.appendChild(t)}}return n.from&&r.classList.add(`cm-completionListIncompleteTop`),n.to<e.length&&r.classList.add(`cm-completionListIncompleteBottom`),r}destroyInfo(){this.info&&=(this.infoDestroy&&this.infoDestroy(),this.info.remove(),null)}destroy(){this.destroyInfo()}};function $e(e,t){return n=>new Qe(n,e,t)}function et(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=n.height/e.offsetHeight;r.top<n.top?e.scrollTop-=(n.top-r.top)/i:r.bottom>n.bottom&&(e.scrollTop+=(r.bottom-n.bottom)/i)}function tt(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+ +!!e.type}function nt(e,t){let n=[],r=null,i=null,a=e=>{n.push(e);let{section:t}=e.completion;if(t){r||=[];let e=typeof t==`string`?t:t.name;r.some(t=>t.name==e)||r.push(typeof t==`string`?{name:e}:t)}},o=t.facet(A);for(let r of e)if(r.hasResult()){let e=r.result.getMatch;if(r.result.filter===!1)for(let t of r.result.options)a(new Re(t,r.source,e?e(t):[],1e9-n.length));else{let n=t.sliceDoc(r.from,r.to),s,c=o.filterStrict?new Ke(n):new Ge(n);for(let t of r.result.options)if(s=c.match(t.label)){let n=t.displayLabel?e?e(t,s.matched):[]:s.matched,o=s.score+(t.boost||0);if(a(new Re(t,r.source,n,o)),typeof t.section==`object`&&t.section.rank===`dynamic`){let{name:e}=t.section;i||=Object.create(null),i[e]=Math.max(o,i[e]||-1e9)}}}}if(r){let e=Object.create(null),t=0,a=(e,t)=>(e.rank===`dynamic`&&t.rank===`dynamic`?i[t.name]-i[e.name]:0)||(typeof e.rank==`number`?e.rank:1e9)-(typeof t.rank==`number`?t.rank:1e9)||(e.name<t.name?-1:1);for(let n of r.sort(a))t-=1e5,e[n.name]=t;for(let t of n){let{section:n}=t.completion;n&&(t.score+=e[typeof n==`string`?n:n.name])}}let s=[],c=null,l=o.compareCompletions;for(let e of n.sort((e,t)=>t.score-e.score||l(e.completion,t.completion))){let t=e.completion;!c||c.label!=t.label||c.detail!=t.detail||c.type!=null&&t.type!=null&&c.type!=t.type||c.apply!=t.apply||c.boost!=t.boost?s.push(e):tt(e.completion)>tt(c)&&(s[s.length-1]=e),c=e.completion}return s}var rt=class e{constructor(e,t,n,r,i,a){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=r,this.selected=i,this.disabled=a}setSelected(t,n){return t==this.selected||t>=this.options.length?this:new e(this.options,ct(n,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,n,r,i,a,o){if(i&&!o&&t.some(e=>e.isPending))return i.setDisabled();let s=nt(t,n);if(!s.length)return i&&t.some(e=>e.isPending)?i.setDisabled():null;let c=n.facet(A).selectOnOpen?0:-1;if(i&&i.selected!=c&&i.selected!=-1){let e=i.options[i.selected].completion;for(let t=0;t<s.length;t++)if(s[t].completion==e){c=t;break}}return new e(s,ct(r,c),{pos:t.reduce((e,t)=>t.hasResult()?Math.min(e,t.from):e,1e8),create:ht,above:a.aboveCursor},i?i.timestamp:Date.now(),c,!1)}map(t){return new e(this.options,this.attrs,{...this.tooltip,pos:t.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new e(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}},it=class e{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new e(lt,`cm-ac-`+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:n}=t,r=n.facet(A),i=(r.override||n.languageDataAt(`autocomplete`,O(n)).map(Ue)).map(e=>(this.active.find(t=>t.source==e)||new j(e,+!!this.active.some(e=>e.state!=0))).update(t,r));i.length==this.active.length&&i.every((e,t)=>e==this.active[t])&&(i=this.active);let a=this.open,o=t.effects.some(e=>e.is(pt));a&&t.docChanged&&(a=a.map(t.changes)),t.selection||i.some(e=>e.hasResult()&&t.changes.touchesRange(e.from,e.to))||!at(i,this.active)||o?a=rt.build(i,n,this.id,a,r,o):a&&a.disabled&&!i.some(e=>e.isPending)&&(a=null),!a&&i.every(e=>!e.isPending)&&i.some(e=>e.hasResult())&&(i=i.map(e=>e.hasResult()?new j(e.source,0):e));for(let e of t.effects)e.is(Ye)&&(a&&=a.setSelected(e.value,this.id));return i==this.active&&a==this.open?this:new e(i,this.id,a)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?ot:st}};function at(e,t){if(e==t)return!0;for(let n=0,r=0;;){for(;n<e.length&&!e[n].hasResult();)n++;for(;r<t.length&&!t[r].hasResult();)r++;let i=n==e.length,a=r==t.length;if(i||a)return i==a;if(e[n++].result!=t[r++].result)return!1}}var ot={"aria-autocomplete":`list`},st={};function ct(e,t){let n={"aria-autocomplete":`list`,"aria-haspopup":`listbox`,"aria-controls":e};return t>-1&&(n[`aria-activedescendant`]=e+`-`+t),n}var lt=[];function ut(e,t){if(e.isUserEvent(`input.complete`)){let n=e.annotation(Be);if(n&&t.activateOnCompletion(n))return 12}let n=e.isUserEvent(`input.type`);return n&&t.activateOnTyping?5:n?1:e.isUserEvent(`delete.backward`)?2:e.selection?8:e.docChanged?16:0}var j=class e{constructor(e,t,n=!1){this.source=e,this.state=t,this.explicit=n}hasResult(){return!1}get isPending(){return this.state==1}update(t,n){let r=ut(t,n),i=this;(r&8||r&16&&this.touches(t))&&(i=new e(i.source,0)),r&4&&i.state==0&&(i=new e(this.source,1)),i=i.updateFor(t,r);for(let n of t.effects)if(n.is(We))i=new e(i.source,1,n.value);else if(n.is(k))i=new e(i.source,0);else if(n.is(pt))for(let e of n.value)e.source==i.source&&(i=e);return i}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(O(e.state))}},dt=class e extends j{constructor(e,t,n,r,i,a){super(e,3,t),this.limit=n,this.result=r,this.from=i,this.to=a}hasResult(){return!0}updateFor(t,n){if(!(n&3))return this.map(t.changes);let r=this.result;r.map&&!t.changes.empty&&(r=r.map(r,t.changes));let i=t.changes.mapPos(this.from),a=t.changes.mapPos(this.to,1),o=O(t.state);if(o>a||!r||n&2&&(O(t.startState)==this.from||o<this.limit))return new j(this.source,n&4?1:0);let s=t.changes.mapPos(this.limit);return ft(r.validFor,t.state,i,a)?new e(this.source,this.explicit,s,r,i,a):r.update&&(r=r.update(r,i,a,new Ne(t.state,o,!1)))?new e(this.source,this.explicit,s,r,r.from,r.to??O(t.state)):new j(this.source,1,this.explicit)}map(t){if(t.empty)return this;let n=this.result.map?this.result.map(this.result,t):this.result;return n?new e(this.source,this.explicit,t.mapPos(this.limit),n,t.mapPos(this.from),t.mapPos(this.to,1)):new j(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}};function ft(e,t,n,r){if(!e)return!1;let i=t.sliceDoc(n,r);return typeof e==`function`?e(i,n,r,t):ze(e,!0).test(i)}var pt=E.define({map(e,t){return e.map(e=>e.map(t))}}),M=y.define({create(){return it.start()},update(e,t){return e.update(t)},provide:e=>[m.from(e,e=>e.tooltip),g.contentAttributes.from(e,e=>e.attrs)]});function mt(e,t){let n=t.completion.apply||t.completion.label,r=e.state.field(M).active.find(e=>e.source==t.source);return r instanceof dt&&(typeof n==`string`?e.dispatch({...Ve(e.state,n,r.from,r.to),annotations:Be.of(t.completion)}):n(e,t.completion,r.from,r.to),!0)}var ht=$e(M,mt);function gt(e,t=`option`){return n=>{let r=n.state.field(M,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<n.state.facet(A).interactionDelay)return!1;let i=1,a;t==`page`&&(a=Me(n,r.open.tooltip))&&(i=Math.max(2,Math.floor(a.dom.offsetHeight/a.dom.querySelector(`li`).offsetHeight)-1));let{length:o}=r.open.options,s=r.open.selected>-1?r.open.selected+i*(e?1:-1):e?0:o-1;return s<0?s=t==`page`?0:o-1:s>=o&&(s=t==`page`?o-1:0),n.dispatch({effects:Ye.of(s)}),!0}}var _t=e=>{let t=e.state.field(M,!1);return e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(A).interactionDelay?!1:mt(e,t.open.options[t.open.selected])},vt=e=>e.state.field(M,!1)?(e.dispatch({effects:We.of(!0)}),!0):!1,yt=e=>{let t=e.state.field(M,!1);return!t||!t.active.some(e=>e.state!=0)?!1:(e.dispatch({effects:k.of(null)}),!0)},bt=class{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}},xt=50,St=1e3,Ct=ne.fromClass(class{constructor(e){this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let t of e.state.field(M).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(M),n=e.state.facet(A);if(!e.selectionSet&&!e.docChanged&&e.startState.field(M)==t)return;let r=e.transactions.some(e=>{let t=ut(e,n);return t&8||(e.selection||e.docChanged)&&!(t&3)});for(let t=0;t<this.running.length;t++){let n=this.running[t];if(r||n.context.abortOnDocChange&&e.docChanged||n.updates.length+e.transactions.length>xt&&Date.now()-n.time>St){for(let e of n.context.abortListeners)try{e()}catch(e){h(this.view.state,e)}n.context.abortListeners=null,this.running.splice(t--,1)}else n.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),e.transactions.some(e=>e.effects.some(e=>e.is(We)))&&(this.pendingStart=!0);let i=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=t.active.some(e=>e.isPending&&!this.running.some(t=>t.active.source==e.source))?setTimeout(()=>this.startUpdate(),i):-1,this.composing!=0)for(let t of e.transactions)t.isUserEvent(`input.type`)?this.composing=2:this.composing==2&&t.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:e}=this.view,t=e.field(M);for(let e of t.active)e.isPending&&!this.running.some(t=>t.active.source==e.source)&&this.startQuery(e);this.running.length&&t.open&&t.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(A).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=new Ne(t,O(t),e.explicit,this.view),r=new bt(e,n);this.running.push(r),Promise.resolve(e.source(n)).then(e=>{r.context.aborted||(r.done=e||null,this.scheduleAccept())},e=>{this.view.dispatch({effects:k.of(null)}),h(this.view.state,e)})}scheduleAccept(){this.running.every(e=>e.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(A).updateSyncTime))}accept(){this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(A),n=this.view.state.field(M);for(let r=0;r<this.running.length;r++){let i=this.running[r];if(i.done===void 0)continue;if(this.running.splice(r--,1),i.done){let n=O(i.updates.length?i.updates[0].startState:this.view.state),r=Math.min(n,i.done.from+ +!i.active.explicit),a=new dt(i.active.source,i.active.explicit,r,i.done,i.done.from,i.done.to??n);for(let e of i.updates)a=a.update(e,t);if(a.hasResult()){e.push(a);continue}}let a=n.active.find(e=>e.source==i.active.source);if(a&&a.isPending){if(i.done==null){let n=new j(i.active.source,0);for(let e of i.updates)n=n.update(e,t);n.isPending||e.push(n)}else this.startQuery(a)}}(e.length||n.open&&n.open.disabled)&&this.view.dispatch({effects:pt.of(e)})}},{eventHandlers:{blur(e){let t=this.view.state.field(M,!1);if(t&&t.tooltip&&this.view.state.facet(A).closeOnBlur){let n=t.open&&Me(this.view,t.open.tooltip);(!n||!n.dom.contains(e.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:k.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:We.of(!1)}),20),this.composing=0}}}),wt=typeof navigator==`object`&&/Win/.test(navigator.platform),Tt=ge.highest(g.domEventHandlers({keydown(e,t){let n=t.state.field(M,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&!(wt&&e.altKey)||e.metaKey)return!1;let r=n.open.options[n.open.selected],i=n.active.find(e=>e.source==r.source),a=r.completion.commitCharacters||i.result.commitCharacters;return a&&a.indexOf(e.key)>-1&&mt(t,r),!1}})),Et=g.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:`monospace`,whiteSpace:`nowrap`,overflow:`hidden auto`,maxWidth_fallback:`700px`,maxWidth:`min(700px, 95vw)`,minWidth:`250px`,maxHeight:`10em`,height:`100%`,listStyle:`none`,margin:0,padding:0,"& > li, & > completion-section":{padding:`1px 3px`,lineHeight:1.2},"& > li":{overflowX:`hidden`,textOverflow:`ellipsis`,cursor:`pointer`},"& > completion-section":{display:`list-item`,borderBottom:`1px solid silver`,paddingLeft:`0.5em`,opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:`#17c`,color:`white`},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:`#777`},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:`#347`,color:`white`},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:`#444`},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:`"···"`,opacity:.5,display:`block`,textAlign:`center`,cursor:`pointer`},".cm-tooltip.cm-completionInfo":{position:`absolute`,padding:`3px 9px`,width:`max-content`,maxWidth:`400px`,boxSizing:`border-box`,whiteSpace:`pre-line`},".cm-completionInfo.cm-completionInfo-left":{right:`100%`},".cm-completionInfo.cm-completionInfo-right":{left:`100%`},".cm-completionInfo.cm-completionInfo-left-narrow":{right:`30px`},".cm-completionInfo.cm-completionInfo-right-narrow":{left:`30px`},"&light .cm-snippetField":{backgroundColor:`#00000022`},"&dark .cm-snippetField":{backgroundColor:`#ffffff22`},".cm-snippetFieldPosition":{verticalAlign:`text-top`,width:0,height:`1.15em`,display:`inline-block`,margin:`0 -0.7px -.7em`,borderLeft:`1.4px dotted #888`},".cm-completionMatchedText":{textDecoration:`underline`},".cm-completionDetail":{marginLeft:`0.5em`,fontStyle:`italic`},".cm-completionIcon":{fontSize:`90%`,width:`.8em`,display:`inline-block`,textAlign:`center`,paddingRight:`.6em`,opacity:`0.6`,boxSizing:`content-box`},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:`'ƒ'`}},".cm-completionIcon-class":{"&:after":{content:`'○'`}},".cm-completionIcon-interface":{"&:after":{content:`'◌'`}},".cm-completionIcon-variable":{"&:after":{content:`'𝑥'`}},".cm-completionIcon-constant":{"&:after":{content:`'𝐶'`}},".cm-completionIcon-type":{"&:after":{content:`'𝑡'`}},".cm-completionIcon-enum":{"&:after":{content:`'∪'`}},".cm-completionIcon-property":{"&:after":{content:`'□'`}},".cm-completionIcon-keyword":{"&:after":{content:`'🔑︎'`}},".cm-completionIcon-namespace":{"&:after":{content:`'▢'`}},".cm-completionIcon-text":{"&:after":{content:`'abc'`,fontSize:`50%`,verticalAlign:`middle`}}}),Dt=class{constructor(e,t,n,r){this.field=e,this.line=t,this.from=n,this.to=r}},Ot=class e{constructor(e,t,n){this.field=e,this.from=t,this.to=n}map(t){let n=t.mapPos(this.from,-1,we.TrackDel),r=t.mapPos(this.to,1,we.TrackDel);return n==null||r==null?null:new e(this.field,n,r)}},kt=class e{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let n=[],r=[t],i=e.doc.lineAt(t),a=/^\s*/.exec(i.text)[0];for(let i of this.lines){if(n.length){let n=a,o=/^\t*/.exec(i)[0].length;for(let t=0;t<o;t++)n+=e.facet(Ae);r.push(t+n.length-o),i=n+i.slice(o)}n.push(i),t+=i.length+1}return{text:n,ranges:this.fieldPositions.map(e=>new Ot(e.field,r[e.line]+e.from,r[e.line]+e.to))}}static parse(t){let n=[],r=[],i=[],a;for(let e of t.split(/\r\n?|\n/)){for(;a=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(e);){let t=a[1]?+a[1]:null,o=a[2]||a[3]||``,s=-1;t===0&&(t=1e9);let c=o.replace(/\\[{}]/g,e=>e[1]);for(let e=0;e<n.length;e++)(t==null?c&&n[e].name==c:n[e].seq==t)&&(s=e);if(s<0){let e=0;for(;e<n.length&&(t==null||n[e].seq!=null&&n[e].seq<t);)e++;n.splice(e,0,{seq:t,name:c}),s=e;for(let e of i)e.field>=s&&e.field++}for(let e of i)if(e.line==r.length&&e.from>a.index){let t=a[2]?3+(a[1]||``).length:2;e.from-=t,e.to-=t}i.push(new Dt(s,r.length,a.index,a.index+c.length)),e=e.slice(0,a.index)+o+e.slice(a.index+a[0].length)}e=e.replace(/\\([{}])/g,(e,t,n)=>{for(let e of i)e.line==r.length&&e.from>n&&(e.from--,e.to--);return t}),r.push(e)}return new e(r,i)}},At=a.widget({widget:new class extends u{toDOM(){let e=document.createElement(`span`);return e.className=`cm-snippetFieldPosition`,e}ignoreEvent(){return!1}}}),jt=a.mark({class:`cm-snippetField`}),Mt=class e{constructor(e,t){this.ranges=e,this.active=t,this.deco=a.set(e.map(e=>(e.from==e.to?At:jt).range(e.from,e.to)),!0)}map(t){let n=[];for(let e of this.ranges){let r=e.map(t);if(!r)return null;n.push(r)}return new e(n,this.active)}selectionInsideField(e){return e.ranges.every(e=>this.ranges.some(t=>t.field==this.active&&t.from<=e.from&&t.to>=e.to))}},N=E.define({map(e,t){return e&&e.map(t)}}),Nt=E.define(),P=y.define({create(){return null},update(e,t){for(let n of t.effects){if(n.is(N))return n.value;if(n.is(Nt)&&e)return new Mt(e.ranges,n.value)}return e&&t.docChanged&&(e=e.map(t.changes)),e&&t.selection&&!e.selectionInsideField(t.selection)&&(e=null),e},provide:e=>g.decorations.from(e,e=>e?e.deco:a.none)});function Pt(e,t){return x.create(e.filter(e=>e.field==t).map(e=>x.range(e.from,e.to)))}function Ft(e){let t=kt.parse(e);return(e,n,r,i)=>{let{text:a,ranges:o}=t.instantiate(e.state,r),{main:s}=e.state.selection,c={changes:{from:r,to:i==s.from?s.to:i,insert:T.of(a)},scrollIntoView:!0,annotations:n?[Be.of(n),Oe.userEvent.of(`input.complete`)]:void 0};if(o.length&&(c.selection=Pt(o,0)),o.some(e=>e.field>0)){let t=new Mt(o,0),n=c.effects=[N.of(t)];e.state.field(P,!1)===void 0&&n.push(E.appendConfig.of([P,zt,Vt,Et]))}e.dispatch(e.state.update(c))}}function It(e){return({state:t,dispatch:n})=>{let r=t.field(P,!1);if(!r||e<0&&r.active==0)return!1;let i=r.active+e,a=e>0&&!r.ranges.some(t=>t.field==i+e);return n(t.update({selection:Pt(r.ranges,i),effects:N.of(a?null:new Mt(r.ranges,i)),scrollIntoView:!0})),!0}}var Lt=[{key:`Tab`,run:It(1),shift:It(-1)},{key:`Escape`,run:({state:e,dispatch:t})=>e.field(P,!1)?(t(e.update({effects:N.of(null)})),!0):!1}],Rt=be.define({combine(e){return e.length?e[0]:Lt}}),zt=ge.highest(se.compute([Rt],e=>e.facet(Rt)));function Bt(e,t){return{...t,apply:Ft(e)}}var Vt=g.domEventHandlers({mousedown(e,t){let n=t.state.field(P,!1),r;if(!n||(r=t.posAtCoords({x:e.clientX,y:e.clientY}))==null)return!1;let i=n.ranges.find(e=>e.from<=r&&e.to>=r);return!i||i.field==n.active?!1:(t.dispatch({selection:Pt(n.ranges,i.field),effects:N.of(n.ranges.some(e=>e.field>i.field)?new Mt(n.ranges,i.field):null),scrollIntoView:!0}),!0)}}),F={brackets:[`(`,`[`,`{`,`'`,`"`],before:`)]}:;>`,stringPrefixes:[]},I=E.define({map(e,t){return t.mapPos(e,-1,we.TrackAfter)??void 0}}),Ht=new class extends xe{};Ht.startSide=1,Ht.endSide=-1;var Ut=y.define({create(){return de.empty},update(e,t){if(e=e.map(t.changes),t.selection){let n=t.state.doc.lineAt(t.selection.main.head);e=e.update({filter:e=>e>=n.from&&e<=n.to})}for(let n of t.effects)n.is(I)&&(e=e.update({add:[Ht.range(n.value,n.value+1)]}));return e}});function Wt(){return[Yt,Ut]}var Gt=`()[]{}<>«»»«[]{}`;function Kt(e){for(let t=0;t<16;t+=2)if(Gt.charCodeAt(t)==e)return Gt.charAt(t+1);return he(e<128?e:e+1)}function qt(e,t){return e.languageDataAt(`closeBrackets`,t)[0]||F}var Jt=typeof navigator==`object`&&/Android\b/.test(navigator.userAgent),Yt=g.inputHandler.of((e,t,n,r)=>{if((Jt?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let i=e.state.selection.main;if(r.length>2||r.length==2&&S(b(r,0))==1||t!=i.from||n!=i.to)return!1;let a=Zt(e.state,r);return a?(e.dispatch(a),!0):!1}),Xt=[{key:`Backspace`,run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=qt(e,e.selection.main.head).brackets||F.brackets,r=null,i=e.changeByRange(t=>{if(t.empty){let r=en(e.doc,t.head);for(let i of n)if(i==r&&$t(e.doc,t.head)==Kt(b(i,0)))return{changes:{from:t.head-i.length,to:t.head+i.length},range:x.cursor(t.head-i.length)}}return{range:r=t}});return r||t(e.update(i,{scrollIntoView:!0,userEvent:`delete.backward`})),!r}}];function Zt(e,t){let n=qt(e,e.selection.main.head),r=n.brackets||F.brackets;for(let i of r){let a=Kt(b(i,0));if(t==i)return a==i?rn(e,i,r.indexOf(i+i+i)>-1,n):tn(e,i,a,n.before||F.before);if(t==a&&Qt(e,e.selection.main.from))return nn(e,i,a)}return null}function Qt(e,t){let n=!1;return e.field(Ut).between(0,e.doc.length,e=>{e==t&&(n=!0)}),n}function $t(e,t){let n=e.sliceString(t,t+2);return n.slice(0,S(b(n,0)))}function en(e,t){let n=e.sliceString(t-2,t);return S(b(n,0))==n.length?n:n.slice(1)}function tn(e,t,n,r){let i=null,a=e.changeByRange(a=>{if(!a.empty)return{changes:[{insert:t,from:a.from},{insert:n,from:a.to}],effects:I.of(a.to+t.length),range:x.range(a.anchor+t.length,a.head+t.length)};let o=$t(e.doc,a.head);return!o||/\s/.test(o)||r.indexOf(o)>-1?{changes:{insert:t+n,from:a.head},effects:I.of(a.head+t.length),range:x.cursor(a.head+t.length)}:{range:i=a}});return i?null:e.update(a,{scrollIntoView:!0,userEvent:`input.type`})}function nn(e,t,n){let r=null,i=e.changeByRange(t=>t.empty&&$t(e.doc,t.head)==n?{changes:{from:t.head,to:t.head+n.length,insert:n},range:x.cursor(t.head+n.length)}:r={range:t});return r?null:e.update(i,{scrollIntoView:!0,userEvent:`input.type`})}function rn(e,t,n,r){let i=r.stringPrefixes||F.stringPrefixes,a=null,o=e.changeByRange(r=>{if(!r.empty)return{changes:[{insert:t,from:r.from},{insert:t,from:r.to}],effects:I.of(r.to+t.length),range:x.range(r.anchor+t.length,r.head+t.length)};let o=r.head,s=$t(e.doc,o),c;if(s==t){if(an(e,o))return{changes:{insert:t+t,from:o},effects:I.of(o+t.length),range:x.cursor(o+t.length)};if(Qt(e,o)){let r=n&&e.sliceDoc(o,o+t.length*3)==t+t+t?t+t+t:t;return{changes:{from:o,to:o+r.length,insert:r},range:x.cursor(o+r.length)}}}else if(n&&e.sliceDoc(o-2*t.length,o)==t+t&&(c=sn(e,o-2*t.length,i))>-1&&an(e,c))return{changes:{insert:t+t+t+t,from:o},effects:I.of(o+t.length),range:x.cursor(o+t.length)};else if(e.charCategorizer(o)(s)!=v.Word&&sn(e,o,i)>-1&&!on(e,o,t,i))return{changes:{insert:t+t,from:o},effects:I.of(o+t.length),range:x.cursor(o+t.length)};return{range:a=r}});return a?null:e.update(o,{scrollIntoView:!0,userEvent:`input.type`})}function an(e,t){let n=w(e).resolveInner(t+1);return n.parent&&n.from==t}function on(e,t,n,r){let i=w(e).resolveInner(t,-1),a=r.reduce((e,t)=>Math.max(e,t.length),0);for(let o=0;o<5;o++){let o=e.sliceDoc(i.from,Math.min(i.to,i.from+n.length+a)),s=o.indexOf(n);if(!s||s>-1&&r.indexOf(o.slice(0,s))>-1){let t=i.firstChild;for(;t&&t.from==i.from&&t.to-t.from>n.length+s;){if(e.sliceDoc(t.to-n.length,t.to)==n)return!1;t=t.firstChild}return!0}let c=i.to==t&&i.parent;if(!c)break;i=c}return!1}function sn(e,t,n){let r=e.charCategorizer(t);if(r(e.sliceDoc(t-1,t))!=v.Word)return t;for(let i of n){let n=t-i.length;if(e.sliceDoc(n,t)==i&&r(e.sliceDoc(n-1,n))!=v.Word)return n}return-1}function cn(e={}){return[Tt,M,A.of(e),Ct,un,Et]}var ln=[{key:`Ctrl-Space`,run:vt},{mac:"Alt-`",run:vt},{mac:`Alt-i`,run:vt},{key:`Escape`,run:yt},{key:`ArrowDown`,run:gt(!0)},{key:`ArrowUp`,run:gt(!1)},{key:`PageDown`,run:gt(!0,`page`)},{key:`PageUp`,run:gt(!1,`page`)},{key:`Enter`,run:_t}],un=ge.highest(se.computeN([A],e=>e.facet(A).defaultKeymap?[ln]:[])),dn=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=gn(e.state,n.from);return r.line?pn(e):r.block?hn(e):!1};function fn(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=e(t,n);return i?(r(n.update(i)),!0):!1}}var pn=fn(xn,0),mn=fn(bn,0),hn=fn((e,t)=>bn(e,t,yn(t)),0);function gn(e,t){let n=e.languageDataAt(`commentTokens`,t,1);return n.length?n[0]:{}}var _n=50;function vn(e,{open:t,close:n},r,i){let a=e.sliceDoc(r-_n,r),o=e.sliceDoc(i,i+_n),s=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(o)[0].length,l=a.length-s;if(a.slice(l-t.length,l)==t&&o.slice(c,c+n.length)==n)return{open:{pos:r-s,margin:s&&1},close:{pos:i+c,margin:c&&1}};let u,d;i-r<=100?u=d=e.sliceDoc(r,i):(u=e.sliceDoc(r,r+_n),d=e.sliceDoc(i-_n,i));let f=/^\s*/.exec(u)[0].length,p=/\s*$/.exec(d)[0].length,m=d.length-p-n.length;return u.slice(f,f+t.length)==t&&d.slice(m,m+n.length)==n?{open:{pos:r+f+t.length,margin:+!!/\s/.test(u.charAt(f+t.length))},close:{pos:i-p-n.length,margin:+!!/\s/.test(d.charAt(m-1))}}:null}function yn(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),i=n.to<=r.to?r:e.doc.lineAt(n.to);i.from>r.from&&i.from==n.to&&(i=n.to==r.to+1?r:e.doc.lineAt(n.to-1));let a=t.length-1;a>=0&&t[a].to>r.from?t[a].to=i.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return t}function bn(e,t,n=t.selection.ranges){let r=n.map(e=>gn(t,e.from).block);if(!r.every(e=>e))return null;let i=n.map((e,n)=>vn(t,r[n],e.from,e.to));if(e!=2&&!i.every(e=>e))return{changes:t.changes(n.map((e,t)=>i[t]?[]:[{from:e.from,insert:r[t].open+` `},{from:e.to,insert:` `+r[t].close}]))};if(e!=1&&i.some(e=>e)){let e=[];for(let t=0,n;t<i.length;t++)if(n=i[t]){let i=r[t],{open:a,close:o}=n;e.push({from:a.pos-i.open.length,to:a.pos+a.margin},{from:o.pos-o.margin,to:o.pos+i.close.length})}return{changes:e}}return null}function xn(e,t,n=t.selection.ranges){let r=[],i=-1;ranges:for(let{from:e,to:a}of n){let n=r.length,o=1e9,s;for(let n=e;n<=a;){let c=t.doc.lineAt(n);if(s==null&&(s=gn(t,c.from).line,!s))continue ranges;if(c.from>i&&(e==a||a>c.from)){i=c.from;let e=/^\s*/.exec(c.text)[0].length,t=e==c.length,n=c.text.slice(e,e+s.length)==s?e:-1;e<c.text.length&&e<o&&(o=e),r.push({line:c,comment:n,token:s,indent:e,empty:t,single:!1})}n=c.to+1}if(o<1e9)for(let e=n;e<r.length;e++)r[e].indent<r[e].line.text.length&&(r[e].indent=o);r.length==n+1&&(r[n].single=!0)}if(e!=2&&r.some(e=>e.comment<0&&(!e.empty||e.single))){let e=[];for(let{line:t,token:n,indent:i,empty:a,single:o}of r)(o||!a)&&e.push({from:t.from+i,insert:n+` `});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}if(e!=1&&r.some(e=>e.comment>=0)){let e=[];for(let{line:t,comment:n,token:i}of r)if(n>=0){let r=t.from+n,a=r+i.length;t.text[a-t.from]==` `&&a++,e.push({from:r,to:a})}return{changes:e}}return null}var Sn=le.define(),Cn=le.define(),wn=be.define(),Tn=be.define({combine(e){return Se(e,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,r)=>e(n,r)||t(n,r)})}}),En=y.define({create(){return z.empty},update(e,t){let n=t.state.facet(Tn),r=t.annotation(Sn);if(r){let i=L.fromTransaction(t,r.selection),a=r.side,o=a==0?e.undone:e.done;return o=i?Nn(o,o.length,n.minDepth,i):Rn(o,t.startState.selection),new z(a==0?r.rest:o,a==0?o:r.rest)}let i=t.annotation(Cn);if((i==`full`||i==`before`)&&(e=e.isolate()),t.annotation(Oe.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let a=L.fromTransaction(t),o=t.annotation(Oe.time),s=t.annotation(Oe.userEvent);return a?e=e.addChanges(a,o,s,n,t):t.selection&&(e=e.addSelection(t.startState.selection,o,s,n.newGroupDelay)),(i==`full`||i==`after`)&&(e=e.isolate()),e},toJSON(e){return{done:e.done.map(e=>e.toJSON()),undone:e.undone.map(e=>e.toJSON())}},fromJSON(e){return new z(e.done.map(L.fromJSON),e.undone.map(L.fromJSON))}});function Dn(e={}){return[En,Tn.of(e),g.domEventHandlers({beforeinput(e,t){let n=e.inputType==`historyUndo`?kn:e.inputType==`historyRedo`?An:null;return n?(e.preventDefault(),n(t)):!1}})]}function On(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let i=n.field(En,!1);if(!i)return!1;let a=i.pop(e,n,t);return a?(r(a),!0):!1}}var kn=On(0,!1),An=On(1,!1),jn=On(0,!0),Mn=On(1,!0),L=class e{constructor(e,t,n,r,i){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=r,this.selectionsAfter=i}setSelAfter(t){return new e(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){return{changes:this.changes?.toJSON(),mapped:this.mapped?.toJSON(),startSelection:this.startSelection?.toJSON(),selectionsAfter:this.selectionsAfter.map(e=>e.toJSON())}}static fromJSON(t){return new e(t.changes&&ue.fromJSON(t.changes),[],t.mapped&&ce.fromJSON(t.mapped),t.startSelection&&x.fromJSON(t.startSelection),t.selectionsAfter.map(x.fromJSON))}static fromTransaction(t,n){let r=R;for(let e of t.startState.facet(wn)){let n=e(t);n.length&&(r=r.concat(n))}return!r.length&&t.changes.empty?null:new e(t.changes.invert(t.startState.doc),r,void 0,n||t.startState.selection,R)}static selection(t){return new e(void 0,R,void 0,void 0,t)}};function Nn(e,t,n,r){let i=t+1>n+20?t-n-1:0,a=e.slice(i,t);return a.push(r),a}function Pn(e,t){let n=[],r=!1;return e.iterChangedRanges((e,t)=>n.push(e,t)),t.iterChangedRanges((e,t,i,a)=>{for(let e=0;e<n.length;){let t=n[e++],o=n[e++];a>=t&&i<=o&&(r=!0)}}),r}function Fn(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((e,n)=>e.empty!=t.ranges[n].empty).length===0}function In(e,t){return e.length?t.length?e.concat(t):e:t}var R=[],Ln=200;function Rn(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-Ln));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),Nn(e,e.length-1,1e9,n.setSelAfter(r)))}return[L.selection([t])]}function zn(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function Bn(e,t){if(!e.length)return e;let n=e.length,r=R;for(;n;){let i=Vn(e[n-1],t,r);if(i.changes&&!i.changes.empty||i.effects.length){let t=e.slice(0,n);return t[n-1]=i,t}t=i.mapped,n--,r=i.selectionsAfter}return r.length?[L.selection(r)]:R}function Vn(e,t,n){let r=In(e.selectionsAfter.length?e.selectionsAfter.map(e=>e.map(t)):R,n);if(!e.changes)return L.selection(r);let i=e.changes.map(t),a=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(a):a;return new L(i,E.mapEffects(e.effects,t),o,e.startSelection.map(a),r)}var Hn=/^(input\.type|delete)($|\.)/,z=class e{constructor(e,t,n=0,r=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new e(this.done,this.undone):this}addChanges(t,n,r,i,a){let o=this.done,s=o[o.length-1];return o=s&&s.changes&&!s.changes.empty&&t.changes&&(!r||Hn.test(r))&&(!s.selectionsAfter.length&&n-this.prevTime<i.newGroupDelay&&i.joinToEvent(a,Pn(s.changes,t.changes))||r==`input.type.compose`)?Nn(o,o.length-1,i.minDepth,new L(t.changes.compose(s.changes),In(E.mapEffects(t.effects,s.changes),s.effects),s.mapped,s.startSelection,R)):Nn(o,o.length,i.minDepth,t),new e(o,R,n,r)}addSelection(t,n,r,i){let a=this.done.length?this.done[this.done.length-1].selectionsAfter:R;return a.length>0&&n-this.prevTime<i&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&Fn(a[a.length-1],t)?this:new e(Rn(this.done,t),this.undone,n,r)}addMapping(t){return new e(Bn(this.done,t),Bn(this.undone,t),this.prevTime,this.prevUserEvent)}pop(e,t,n){let r=e==0?this.done:this.undone;if(r.length==0)return null;let i=r[r.length-1],a=i.selectionsAfter[0]||(i.startSelection?i.startSelection.map(i.changes.invertedDesc,1):t.selection);if(n&&i.selectionsAfter.length)return t.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:Sn.of({side:e,rest:zn(r),selection:a}),userEvent:e==0?`select.undo`:`select.redo`,scrollIntoView:!0});if(i.changes){let n=r.length==1?R:r.slice(0,r.length-1);return i.mapped&&(n=Bn(n,i.mapped)),t.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:Sn.of({side:e,rest:n,selection:a}),filter:!1,userEvent:e==0?`undo`:`redo`,scrollIntoView:!0})}return null}};z.empty=new z(R,R);var Un=[{key:`Mod-z`,run:kn,preventDefault:!0},{key:`Mod-y`,mac:`Mod-Shift-z`,run:An,preventDefault:!0},{linux:`Ctrl-Shift-z`,run:An,preventDefault:!0},{key:`Mod-u`,run:jn,preventDefault:!0},{key:`Alt-u`,mac:`Mod-Shift-u`,run:Mn,preventDefault:!0}];function B(e,t){return x.create(e.ranges.map(t),e.mainIndex)}function V(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:`select`})}function H({state:e,dispatch:t},n){let r=B(e.selection,n);return!r.eq(e.selection,!0)&&(t(V(e,r)),!0)}function Wn(e,t){return x.cursor(t?e.to:e.from)}function Gn(e,t){return H(e,n=>n.empty?e.moveByChar(n,t):Wn(n,t))}function U(e){return e.textDirectionAt(e.state.selection.main.head)==_e.LTR}var Kn=e=>Gn(e,!U(e)),qn=e=>Gn(e,U(e));function Jn(e,t){return H(e,n=>n.empty?e.moveByGroup(n,t):Wn(n,t))}var Yn=e=>Jn(e,!U(e)),Xn=e=>Jn(e,U(e));typeof Intl<`u`&&Intl.Segmenter;function Zn(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function Qn(e,t,n){let r=w(e).resolveInner(t.head),i=n?c.closedBy:c.openedBy;for(let a=t.head;;){let t=n?r.childAfter(a):r.childBefore(a);if(!t)break;Zn(e,t,i)?r=t:a=n?t.to:t.from}let a=r.type.prop(i),o,s;return s=a&&(o=n?l(e,r.from,1):l(e,r.to,-1))&&o.matched?n?o.end.to:o.end.from:n?r.to:r.from,x.cursor(s,n?-1:1)}var $n=e=>H(e,t=>Qn(e.state,t,!U(e))),er=e=>H(e,t=>Qn(e.state,t,U(e)));function tr(e,t){return H(e,n=>{if(!n.empty)return Wn(n,t);let r=e.moveVertically(n,t);return r.head==n.head?e.moveToLineBoundary(n,t):r})}var nr=e=>tr(e,!1),rr=e=>tr(e,!0);function ir(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,i;if(t){for(let t of e.state.facet(g.scrollMargins)){let i=t(e);i?.top&&(n=Math.max(i?.top,n)),i?.bottom&&(r=Math.max(i?.bottom,r))}i=e.scrollDOM.clientHeight-n-r}else i=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:t,height:Math.max(e.defaultLineHeight,i-5)}}function ar(e,t){let n=ir(e),{state:r}=e,i=B(r.selection,r=>r.empty?e.moveVertically(r,t,n.height):Wn(r,t));if(i.eq(r.selection))return!1;let a;if(n.selfScroll){let t=e.coordsAtPos(r.selection.main.head),o=e.scrollDOM.getBoundingClientRect(),s=o.top+n.marginTop,c=o.bottom-n.marginBottom;t&&t.top>s&&t.bottom<c&&(a=g.scrollIntoView(i.main.head,{y:`start`,yMargin:t.top-s}))}return e.dispatch(V(r,i),{effects:a}),!0}var or=e=>ar(e,!1),sr=e=>ar(e,!0);function W(e,t,n){let r=e.lineBlockAt(t.head),i=e.moveToLineBoundary(t,n);if(i.head==t.head&&i.head!=(n?r.to:r.from)&&(i=e.moveToLineBoundary(t,n,!1)),!n&&i.head==r.from&&r.length){let n=/^\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;n&&t.head!=r.from+n&&(i=x.cursor(r.from+n))}return i}var cr=e=>H(e,t=>W(e,t,!0)),lr=e=>H(e,t=>W(e,t,!1)),ur=e=>H(e,t=>W(e,t,!U(e))),dr=e=>H(e,t=>W(e,t,U(e))),fr=e=>H(e,t=>e.moveToLineBoundary(t,!1,!1)),pr=e=>H(e,t=>e.moveToLineBoundary(t,!0,!1));function mr(e,t,n){let r=!1,i=B(e.selection,t=>{let i=l(e,t.head,-1)||l(e,t.head,1)||t.head>0&&l(e,t.head-1,1)||t.head<e.doc.length&&l(e,t.head+1,-1);if(!i||!i.end)return t;r=!0;let a=i.start.from==t.head?i.end.to:i.end.from;return n?x.range(t.anchor,a):x.cursor(a)});return r?(t(V(e,i)),!0):!1}var hr=({state:e,dispatch:t})=>mr(e,t,!1);function G(e,t,n){let r=B(e.state.selection,e=>{e.undirectional&&e.head>=e.anchor!=t&&(e=x.range(e.head,e.anchor));let r=n(e);return x.range(e.anchor,r.head,r.goalColumn,r.bidiLevel||void 0,r.assoc)});return!r.eq(e.state.selection)&&(e.dispatch(V(e.state,r)),!0)}function gr(e,t){return G(e,t,n=>e.moveByChar(n,t))}var _r=e=>gr(e,!U(e)),vr=e=>gr(e,U(e));function yr(e,t){return G(e,t,n=>e.moveByGroup(n,t))}var br=e=>yr(e,!U(e)),xr=e=>yr(e,U(e)),Sr=e=>{let t=!U(e);return G(e,t,n=>Qn(e.state,n,t))},Cr=e=>{let t=U(e);return G(e,t,n=>Qn(e.state,n,t))};function wr(e,t){return G(e,t,n=>e.moveVertically(n,t))}var Tr=e=>wr(e,!1),Er=e=>wr(e,!0);function Dr(e,t){return G(e,t,n=>e.moveVertically(n,t,ir(e).height))}var Or=e=>Dr(e,!1),kr=e=>Dr(e,!0),Ar=e=>G(e,!0,t=>W(e,t,!0)),jr=e=>G(e,!1,t=>W(e,t,!1)),Mr=e=>{let t=!U(e);return G(e,t,n=>W(e,n,t))},Nr=e=>{let t=U(e);return G(e,t,n=>W(e,n,t))},Pr=e=>G(e,!1,t=>x.cursor(e.lineBlockAt(t.head).from)),Fr=e=>G(e,!0,t=>x.cursor(e.lineBlockAt(t.head).to)),Ir=({state:e,dispatch:t})=>(t(V(e,{anchor:0})),!0),Lr=({state:e,dispatch:t})=>(t(V(e,{anchor:e.doc.length})),!0),Rr=({state:e,dispatch:t})=>(t(V(e,{anchor:e.selection.main.anchor,head:0})),!0),zr=({state:e,dispatch:t})=>(t(V(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),Br=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:`select`})),!0),Vr=({state:e,dispatch:t})=>{let n=oi(e).map(({from:t,to:n})=>x.undirectionalRange(t,Math.min(n+1,e.doc.length)));return t(e.update({selection:x.create(n),userEvent:`select`})),!0},Hr=({state:e,dispatch:t})=>{let n=B(e.selection,t=>{let n=w(e),r=n.resolveStack(t.from,1);if(t.empty){let e=n.resolveStack(t.from,-1);e.node.from>=r.node.from&&e.node.to<=r.node.to&&(r=e)}for(let e=r;e;e=e.next){let{node:n}=e;if((n.from<t.from&&n.to>=t.to||n.to>t.to&&n.from<=t.from)&&e.next)return x.undirectionalRange(n.from,n.to)}return t});return!n.eq(e.selection)&&(t(V(e,n)),!0)};function Ur(e,t){let{state:n}=e,r=n.selection,i=n.selection.ranges.slice();for(let r of n.selection.ranges){let a=n.doc.lineAt(r.head);if(t?a.to<e.state.doc.length:a.from>0)for(let n=r;;){let r=e.moveVertically(n,t);if(r.head<a.from||r.head>a.to){i.some(e=>e.head==r.head)||i.push(r);break}if(r.head==n.head)break;n=r}}return i.length!=r.ranges.length&&(e.dispatch(V(n,x.create(i,i.length-1))),!0)}var Wr=e=>Ur(e,!1),Gr=e=>Ur(e,!0),Kr=({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=x.create([n.main]):n.main.empty||(r=x.create([x.cursor(n.main.head)])),r?(t(V(e,r)),!0):!1};function qr(e,t){if(e.state.readOnly)return!1;let n=`delete.selection`,{state:r}=e,i=r.changeByRange(r=>{let{from:i,to:a}=r;if(i==a){let o=t(r);o<i?(n=`delete.backward`,o=Jr(e,o,!1)):o>i&&(n=`delete.forward`,o=Jr(e,o,!0)),i=Math.min(i,o),a=Math.max(a,o)}else i=Jr(e,i,!1),a=Jr(e,a,!0);return i==a?{range:r}:{changes:{from:i,to:a},range:x.cursor(i,i<r.head?-1:1)}});return!i.changes.empty&&(e.dispatch(r.update(i,{scrollIntoView:!0,userEvent:n,effects:n==`delete.selection`?g.announce.of(r.phrase(`Selection deleted`)):void 0})),!0)}function Jr(e,t,n){if(e instanceof g)for(let r of e.state.facet(g.atomicRanges).map(t=>t(e)))r.between(t,t,(e,r)=>{e<t&&r>t&&(t=n?r:e)});return t}var Yr=(e,t,n)=>qr(e,r=>{let i=r.from,{state:a}=e,o=a.doc.lineAt(i),s,c;if(n&&!t&&i>o.from&&i<o.from+200&&!/[^ \t]/.test(s=o.text.slice(0,i-o.from))){if(s[s.length-1]==` `)return i-1;let e=ye(s,a.tabSize)%je(a)||je(a);for(let t=0;t<e&&s[s.length-1-t]==` `;t++)i--;c=i}else c=C(o.text,i-o.from,t,t)+o.from,c==i&&o.number!=(t?a.doc.lines:1)?c+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(o.text.slice(c-o.from,i-o.from))&&(c=C(o.text,c-o.from,!1,!1)+o.from);return c}),Xr=e=>Yr(e,!1,!0),Zr=e=>Yr(e,!0,!1),Qr=(e,t)=>qr(e,n=>{let r=n.head,{state:i}=e,a=i.doc.lineAt(r),o=i.charCategorizer(r);for(let e=null;;){if(r==(t?a.to:a.from)){r==n.head&&a.number!=(t?i.doc.lines:1)&&(r+=t?1:-1);break}let s=C(a.text,r-a.from,t)+a.from,c=a.text.slice(Math.min(r,s)-a.from,Math.max(r,s)-a.from),l=o(c);if(e!=null&&l!=e)break;(c!=` `||r!=n.head)&&(e=l),r=s}return r}),$r=e=>Qr(e,!1),ei=e=>Qr(e,!0),ti=e=>qr(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),ni=e=>qr(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),ri=e=>qr(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),ii=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:T.of([``,``])},range:x.cursor(e.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:`input`})),!0},ai=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(t=>{if(!t.empty||t.from==0||t.from==e.doc.length)return{range:t};let n=t.from,r=e.doc.lineAt(n),i=n==r.from?n-1:C(r.text,n-r.from,!1)+r.from,a=n==r.to?n+1:C(r.text,n-r.from,!0)+r.from;return{changes:{from:i,to:a,insert:e.doc.slice(n,a).append(e.doc.slice(i,n))},range:x.cursor(a)}});return!n.changes.empty&&(t(e.update(n,{scrollIntoView:!0,userEvent:`move.character`})),!0)};function oi(e){let t=[],n=-1;for(let r of e.selection.ranges){let i=e.doc.lineAt(r.from),a=e.doc.lineAt(r.to);if(!r.empty&&r.to==a.from&&(a=e.doc.lineAt(r.to-1)),n>=i.number){let e=t[t.length-1];e.to=a.to,e.ranges.push(r)}else t.push({from:i.from,to:a.to,ranges:[r]});n=a.number+1}return t}function si(e,t,n){if(e.readOnly)return!1;let r=[],i=[];for(let t of oi(e)){if(n?t.to==e.doc.length:t.from==0)continue;let a=e.doc.lineAt(n?t.to+1:t.from-1),o=a.length+1;if(n){r.push({from:t.to,to:a.to},{from:t.from,insert:a.text+e.lineBreak});for(let n of t.ranges)i.push(x.range(Math.min(e.doc.length,n.anchor+o),Math.min(e.doc.length,n.head+o)))}else{r.push({from:a.from,to:t.from},{from:t.to,insert:e.lineBreak+a.text});for(let e of t.ranges)i.push(x.range(e.anchor-o,e.head-o))}}return r.length?(t(e.update({changes:r,scrollIntoView:!0,selection:x.create(i,e.selection.mainIndex),userEvent:`move.line`})),!0):!1}var ci=({state:e,dispatch:t})=>si(e,t,!1),li=({state:e,dispatch:t})=>si(e,t,!0);function ui(e,t,n){if(e.readOnly)return!1;let r=[];for(let t of oi(e))n?r.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):r.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});let i=e.changes(r);return t(e.update({changes:i,selection:e.selection.map(i,n?1:-1),scrollIntoView:!0,userEvent:`input.copyline`})),!0}var di=({state:e,dispatch:t})=>ui(e,t,!1),fi=({state:e,dispatch:t})=>ui(e,t,!0),pi=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(oi(t).map(({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n}))),r=B(t.selection,t=>{let n;if(e.lineWrapping){let r=e.lineBlockAt(t.head),i=e.coordsAtPos(t.head,t.assoc||1);i&&(n=r.bottom+e.documentTop-i.bottom+e.defaultLineHeight/2)}return e.moveVertically(t,!0,n)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:`delete.line`}),!0};function mi(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=w(e).resolveInner(t),r=n.childBefore(t),i=n.childAfter(t),a;return r&&i&&r.to<=t&&i.from>=t&&(a=r.type.prop(c.closedBy))&&a.indexOf(i.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(i.from).from&&!/\S/.test(e.sliceDoc(r.to,i.from))?{from:r.to,to:i.from}:null}var hi=_i(!1),gi=_i(!0);function _i(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange(n=>{let{from:r,to:i}=n,a=t.doc.lineAt(r),o=!e&&r==i&&mi(t,r);e&&(r=i=(i<=a.to?a:t.doc.lineAt(i)).to);let c=new Ee(t,{simulateBreak:r,simulateDoubleBreak:!!o}),l=fe(c,r);for(l??=ye(/^\s*/.exec(t.doc.lineAt(r).text)[0],t.tabSize);i<a.to&&/\s/.test(a.text[i-a.from]);)i++;o?{from:r,to:i}=o:r>a.from&&r<a.from+100&&!/\S/.test(a.text.slice(0,r))&&(r=a.from);let u=[``,s(t,l)];return o&&u.push(s(t,c.lineIndent(a.from,-1))),{changes:{from:r,to:i,insert:T.of(u)},range:x.cursor(r+1+u[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:`input`})),!0}}function vi(e,t){let n=-1;return e.changeByRange(r=>{let i=[];for(let a=r.from;a<=r.to;){let o=e.doc.lineAt(a);o.number>n&&(r.empty||r.to>o.from)&&(t(o,i,r),n=o.number),a=o.to+1}let a=e.changes(i);return{changes:i,range:x.range(a.mapPos(r.anchor,1),a.mapPos(r.head,1))}})}var yi=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new Ee(e,{overrideIndentation:e=>n[e]??-1}),i=vi(e,(t,i,a)=>{let o=fe(r,t.from);if(o==null)return;/\S/.test(t.text)||(o=0);let c=/^\s*/.exec(t.text)[0],l=s(e,o);(c!=l||a.from<t.from+c.length)&&(n[t.from]=o,i.push({from:t.from,to:t.from+c.length,insert:l}))});return i.changes.empty||t(e.update(i,{userEvent:`indent`})),!0},bi=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(vi(e,(t,n)=>{n.push({from:t.from,insert:e.facet(Ae)})}),{userEvent:`input.indent`})),!0),xi=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(vi(e,(t,n)=>{let r=/^\s*/.exec(t.text)[0];if(!r)return;let i=ye(r,e.tabSize),a=0,o=s(e,Math.max(0,i-je(e)));for(;a<r.length&&a<o.length&&r.charCodeAt(a)==o.charCodeAt(a);)a++;n.push({from:t.from+a,to:t.from+r.length,insert:o.slice(a)})}),{userEvent:`delete.dedent`})),!0),Si=e=>(e.setTabFocusMode(),!0),Ci=[{key:`Ctrl-b`,run:Kn,shift:_r,preventDefault:!0},{key:`Ctrl-f`,run:qn,shift:vr},{key:`Ctrl-p`,run:nr,shift:Tr},{key:`Ctrl-n`,run:rr,shift:Er},{key:`Ctrl-a`,run:fr,shift:Pr},{key:`Ctrl-e`,run:pr,shift:Fr},{key:`Ctrl-d`,run:Zr},{key:`Ctrl-h`,run:Xr},{key:`Ctrl-k`,run:ti},{key:`Ctrl-Alt-h`,run:$r},{key:`Ctrl-o`,run:ii},{key:`Ctrl-t`,run:ai},{key:`Ctrl-v`,run:sr}],wi=[{key:`ArrowLeft`,run:Kn,shift:_r,preventDefault:!0},{key:`Mod-ArrowLeft`,mac:`Alt-ArrowLeft`,run:Yn,shift:br,preventDefault:!0},{mac:`Cmd-ArrowLeft`,run:ur,shift:Mr,preventDefault:!0},{key:`ArrowRight`,run:qn,shift:vr,preventDefault:!0},{key:`Mod-ArrowRight`,mac:`Alt-ArrowRight`,run:Xn,shift:xr,preventDefault:!0},{mac:`Cmd-ArrowRight`,run:dr,shift:Nr,preventDefault:!0},{key:`ArrowUp`,run:nr,shift:Tr,preventDefault:!0},{mac:`Cmd-ArrowUp`,run:Ir,shift:Rr},{mac:`Ctrl-ArrowUp`,run:or,shift:Or},{key:`ArrowDown`,run:rr,shift:Er,preventDefault:!0},{mac:`Cmd-ArrowDown`,run:Lr,shift:zr},{mac:`Ctrl-ArrowDown`,run:sr,shift:kr},{key:`PageUp`,run:or,shift:Or},{key:`PageDown`,run:sr,shift:kr},{key:`Home`,run:lr,shift:jr,preventDefault:!0},{key:`Mod-Home`,run:Ir,shift:Rr},{key:`End`,run:cr,shift:Ar,preventDefault:!0},{key:`Mod-End`,run:Lr,shift:zr},{key:`Enter`,run:hi,shift:hi},{key:`Mod-a`,run:Br},{key:`Backspace`,run:Xr,shift:Xr,preventDefault:!0},{key:`Delete`,run:Zr,preventDefault:!0},{key:`Mod-Backspace`,mac:`Alt-Backspace`,run:$r,preventDefault:!0},{key:`Mod-Delete`,mac:`Alt-Delete`,run:ei,preventDefault:!0},{mac:`Mod-Backspace`,run:ni,preventDefault:!0},{mac:`Mod-Delete`,run:ri,preventDefault:!0}].concat(Ci.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),Ti=[{key:`Alt-ArrowLeft`,mac:`Ctrl-ArrowLeft`,run:$n,shift:Sr},{key:`Alt-ArrowRight`,mac:`Ctrl-ArrowRight`,run:er,shift:Cr},{key:`Alt-ArrowUp`,run:ci},{key:`Shift-Alt-ArrowUp`,run:di},{key:`Alt-ArrowDown`,run:li},{key:`Shift-Alt-ArrowDown`,run:fi},{key:`Mod-Alt-ArrowUp`,run:Wr},{key:`Mod-Alt-ArrowDown`,run:Gr},{key:`Escape`,run:Kr},{key:`Mod-Enter`,run:gi},{key:`Alt-l`,mac:`Ctrl-l`,run:Vr},{key:`Mod-i`,run:Hr,preventDefault:!0},{key:`Mod-[`,run:xi},{key:`Mod-]`,run:bi},{key:`Mod-Alt-\\`,run:yi},{key:`Shift-Mod-k`,run:pi},{key:`Shift-Mod-\\`,run:hr},{key:`Mod-/`,run:dn},{key:`Alt-A`,mac:`Ctrl-A`,run:mn},{key:`Ctrl-m`,mac:`Shift-Alt-m`,run:Si}].concat(wi),Ei=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFKD`):e=>e,Di=class{constructor(e,t,n=0,r=e.length,i,a){this.test=a,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer=``,this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=i?e=>i(Ei(e)):Ei,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return b(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=he(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=S(e);let r=this.normalize(t);if(r.length)for(let e=0,i=n,a=!0;;e++){let n=r.charCodeAt(e),o=this.match(n,i,a,this.bufferPos+this.bufferStart,e==r.length-1);if(o)return this.value=o,this;if(e==r.length-1)break;a&&e<t.length&&t.charCodeAt(e)==n?i++:a=!1}}}match(e,t,n,r,i){let a=null;for(let t=0;t<this.matches.length;){let n=this.matches[t],o=!1;this.query.charCodeAt(n.index)==e&&(n.index==this.query.length-1?a={from:n.from,to:r,precise:i&&n.precise}:(n.index++,o=!0)),o?t++:this.matches.splice(t,1)}return this.query.charCodeAt(0)==e&&(this.query.length==1?a={from:t,to:r,precise:n&&i}:this.matches.push({from:t,index:1,precise:n})),a&&this.test&&!this.test(a.from,a.to,this.buffer,this.bufferStart)&&(a=null),a}};typeof Symbol<`u`&&(Di.prototype[Symbol.iterator]=function(){return this});var Oi={from:-1,to:-1,match:/.*/.exec(``),precise:!0},ki=`gm`+(/x/.unicode==null?``:`u`),Ai=class{constructor(e,t,n,r=0,i=e.length){if(this.text=e,this.to=i,this.curLine=``,this.done=!1,this.value=Oi,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new Ni(e,t,n,r,i);this.re=new RegExp(t,ki+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.iter=e.iter();let a=e.lineAt(r);this.curLineStart=a.from,this.matchPos=Pi(e,r),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine=``:(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine=``:this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=Pi(this.text,r+ +(n==r)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,precise:!0,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}},ji=new WeakMap,Mi=class e{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(t,n,r){let i=ji.get(t);if(!i||i.from>=r||i.to<=n){let i=new e(n,t.sliceString(n,r));return ji.set(t,i),i}if(i.from==n&&i.to==r)return i;let{text:a,from:o}=i;return o>n&&(a=t.sliceString(n,o)+a,o=n),i.to<r&&(a+=t.sliceString(i.to,r)),ji.set(t,new e(o,a)),new e(n,a.slice(n-o,r-o))}},Ni=class{constructor(e,t,n,r,i){this.text=e,this.to=i,this.done=!1,this.value=Oi,this.matchPos=Pi(e,r),this.re=new RegExp(t,ki+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.flat=Mi.get(e,r,this.chunkEnd(r+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,precise:!0,match:t},this.matchPos=Pi(this.text,n+ +(e==n)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Mi.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<`u`&&(Ai.prototype[Symbol.iterator]=Ni.prototype[Symbol.iterator]=function(){return this});function Pi(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344;)t++;return t}var Fi={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Ii=be.define({combine(e){return Se(e,Fi,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function Li(e){let t=[Ui,Hi];return e&&t.push(Ii.of(e)),t}var Ri=a.mark({class:`cm-selectionMatch`}),zi=a.mark({class:`cm-selectionMatch cm-selectionMatch-main`});function Bi(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=v.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=v.Word)}function Vi(e,t,n,r){return e(t.sliceDoc(n,n+1))==v.Word&&e(t.sliceDoc(r-1,r))==v.Word}var Hi=ne.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(Ii),{state:n}=e,r=n.selection;if(r.ranges.length>1)return a.none;let i=r.main,o,s=null;if(i.empty){if(!t.highlightWordAroundCursor)return a.none;let e=n.wordAt(i.head);if(!e)return a.none;s=n.charCategorizer(i.head),o=n.sliceDoc(e.from,e.to)}else{let e=i.to-i.from;if(e<t.minSelectionLength||e>200)return a.none;if(t.wholeWords){if(o=n.sliceDoc(i.from,i.to),s=n.charCategorizer(i.head),!(Bi(s,n,i.from,i.to)&&Vi(s,n,i.from,i.to)))return a.none}else if(o=n.sliceDoc(i.from,i.to),!o)return a.none}let c=[];for(let r of e.visibleRanges){let e=new Di(n.doc,o,r.from,r.to);for(;!e.next().done;){let{from:r,to:o}=e.value;if((!s||Bi(s,n,r,o))&&(i.empty&&r<=i.from&&o>=i.to?c.push(zi.range(r,o)):(r>=i.to||o<=i.from)&&c.push(Ri.range(r,o)),c.length>t.maxMatches))return a.none}}return a.set(c)}},{decorations:e=>e.decorations}),Ui=g.baseTheme({".cm-selectionMatch":{backgroundColor:`#99ff7780`},".cm-searchMatch .cm-selectionMatch":{backgroundColor:`transparent`}}),Wi=({state:e,dispatch:t})=>{let{selection:n}=e,r=x.create(n.ranges.map(t=>e.wordAt(t.head)||x.cursor(t.head)),n.mainIndex);return!r.eq(n)&&(t(e.update({selection:r})),!0)};function Gi(e,t){let{main:n,ranges:r}=e.selection,i=e.wordAt(n.head),a=i&&i.from==n.from&&i.to==n.to;for(let n=!1,i=new Di(e.doc,t,r[r.length-1].to);;)if(i.next(),i.done){if(n)return null;i=new Di(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),n=!0}else{if(n&&r.some(e=>e.from==i.value.from))continue;if(a){let t=e.wordAt(i.value.from);if(!t||t.from!=i.value.from||t.to!=i.value.to)continue}return i.value}}var Ki=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(e=>e.from===e.to))return Wi({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(t=>e.sliceDoc(t.from,t.to)!=r))return!1;let i=Gi(e,r);return i?(t(e.update({selection:e.selection.addRange(x.range(i.from,i.to),!1),effects:g.scrollIntoView(i.to)})),!0):!1};async function K(e){return Te.define(await e())}var qi=async()=>(await n(async()=>{let{javascript:e}=await import(`./dist-DhU_QeGu.js`).then(e=>e.t);return{javascript:e}},__vite__mapDeps([0,1,2,3]))).javascript({typescript:!0}),Ji=async()=>(await n(async()=>{let{javascript:e}=await import(`./dist-DhU_QeGu.js`).then(e=>e.t);return{javascript:e}},__vite__mapDeps([0,1,2,3]))).javascript({typescript:!0,jsx:!0}),Yi=async()=>(await n(async()=>{let{javascript:e}=await import(`./dist-DhU_QeGu.js`).then(e=>e.t);return{javascript:e}},__vite__mapDeps([0,1,2,3]))).javascript({jsx:!0}),Xi=async()=>(await n(async()=>{let{json:e}=await import(`./dist-Br4rIykL.js`);return{json:e}},__vite__mapDeps([4,2,3]))).json(),Zi=async()=>(await n(async()=>{let{css:e}=await import(`./dist-D3XrMxUX.js`).then(e=>e.r);return{css:e}},__vite__mapDeps([5,1,2,3]))).css(),Qi=async()=>(await n(async()=>{let{html:e}=await import(`./dist-CPiugJt4.js`);return{html:e}},__vite__mapDeps([6,2,3,5,1,0]))).html(),$i=async()=>(await n(async()=>{let{xml:e}=await import(`./dist-BKLvNQOI.js`);return{xml:e}},__vite__mapDeps([7,2,3]))).xml(),ea=async()=>(await n(async()=>{let{markdown:e}=await import(`./dist-CpBfDDqU.js`);return{markdown:e}},__vite__mapDeps([8,2,6,3,5,1,0]))).markdown(),ta=async()=>(await n(async()=>{let{python:e}=await import(`./dist-B5P2_Wxl.js`);return{python:e}},__vite__mapDeps([9,2,3]))).python(),na=async()=>(await n(async()=>{let{go:e}=await import(`./dist-nSu4Hl9U.js`);return{go:e}},__vite__mapDeps([10,2,3]))).go(),ra=async()=>(await n(async()=>{let{rust:e}=await import(`./dist-BkXwTZu_.js`);return{rust:e}},__vite__mapDeps([11,2,3]))).rust(),ia=async()=>(await n(async()=>{let{java:e}=await import(`./dist-LcJcw4rx.js`);return{java:e}},__vite__mapDeps([12,2,3]))).java(),q=async()=>(await n(async()=>{let{cpp:e}=await import(`./dist--GnAX59q.js`);return{cpp:e}},__vite__mapDeps([13,2,3]))).cpp(),aa=async()=>(await n(async()=>{let{php:e}=await import(`./dist-CeyFaRuq.js`);return{php:e}},__vite__mapDeps([14,2,3,6,5,1,0]))).php(),oa=async()=>(await n(async()=>{let{sql:e}=await import(`./dist-BN_neRHz.js`);return{sql:e}},__vite__mapDeps([15,2,3]))).sql(),sa=async()=>(await n(async()=>{let{yaml:e}=await import(`./dist-hkE3Dzbh.js`);return{yaml:e}},__vite__mapDeps([16,2,3]))).yaml(),ca=()=>K(async()=>(await n(async()=>{let{shell:e}=await import(`./shell-DwuoZtxw.js`);return{shell:e}},[])).shell),la=()=>K(async()=>(await n(async()=>{let{dockerFile:e}=await import(`./dockerfile-BDePf5PZ.js`);return{dockerFile:e}},[])).dockerFile),ua=()=>K(async()=>(await n(async()=>{let{toml:e}=await import(`./toml-BPTmHmyx.js`);return{toml:e}},[])).toml),J=()=>K(async()=>(await n(async()=>{let{properties:e}=await import(`./properties-C357ku5U.js`);return{properties:e}},[])).properties),da={ts:qi,mts:qi,cts:qi,tsx:Ji,js:Yi,jsx:Yi,mjs:Yi,cjs:Yi,json:Xi,jsonc:Xi,css:Zi,scss:Zi,less:Zi,html:Qi,htm:Qi,xml:$i,svg:$i,md:ea,markdown:ea,py:ta,go:na,rs:ra,java:ia,c:q,h:q,cpp:q,cc:q,cxx:q,hpp:q,php:aa,sql:oa,yaml:sa,yml:sa,sh:ca,bash:ca,zsh:ca,toml:ua,ini:J,cfg:J,properties:J,env:J,rb:()=>K(async()=>(await n(async()=>{let{ruby:e}=await import(`./ruby-ChfNwlCY.js`);return{ruby:e}},[])).ruby),cs:()=>K(async()=>(await n(async()=>{let{csharp:e}=await import(`./clike-2o81gGCY.js`);return{csharp:e}},[])).csharp)};function fa(e){let t=e.split(`/`).pop()??e;if(/^dockerfile$/i.test(t))return la();if(/^\.env(\..+)?$/.test(t))return J();let n=t.lastIndexOf(`.`),r=n<0?void 0:da[t.slice(n+1).toLowerCase()];return r===void 0?Promise.resolve(null):r()}var Y=class e{constructor(e,t,n,r){this.fromA=e,this.toA=t,this.fromB=n,this.toB=r}offset(t,n=t){return new e(this.fromA+t,this.toA+t,this.fromB+n,this.toB+n)}};function X(e,t,n,r,i,a){if(e==r)return[];let o=xa(e,t,n,r,i,a),s=Sa(e,t+o,n,r,i+o,a);t+=o,n-=s,i+=o,a-=s;let c=n-t,l=a-i;if(!c||!l)return[new Y(t,n,i,a)];if(c>l){let o=e.slice(t,n).indexOf(r.slice(i,a));if(o>-1)return[new Y(t,t+o,i,i),new Y(t+o+l,n,a,a)]}else if(l>c){let o=r.slice(i,a).indexOf(e.slice(t,n));if(o>-1)return[new Y(t,t,i,i+o),new Y(n,n,i+o+c,a)]}if(c==1||l==1)return[new Y(t,n,i,a)];let u=wa(e,t,n,r,i,a);if(u){let[o,s,c]=u;return X(e,t,o,r,i,s).concat(X(e,o+c,n,r,s+c,a))}return ha(e,t,n,r,i,a)}var pa=1e9,ma=0;function ha(e,t,n,r,i,a){let o=n-t,s=a-i;if(pa<1e9&&Math.min(o,s)>pa*16||ma>0&&Date.now()>ma)return Math.min(o,s)>pa*64?[new Y(t,n,i,a)]:Ta(e,t,n,r,i,a);let c=Math.ceil((o+s)/2);_a.reset(c),va.reset(c);let l=(n,a)=>e.charCodeAt(t+n)==r.charCodeAt(i+a),u=(t,i)=>e.charCodeAt(n-t-1)==r.charCodeAt(a-i-1),d=(o-s)%2==0?null:va,f=d?null:_a;for(let p=0;p<c;p++){if(p>pa||ma>0&&!(p&63)&&Date.now()>ma)return Ta(e,t,n,r,i,a);let m=_a.advance(p,o,s,c,d,!1,l)||va.advance(p,o,s,c,f,!0,u);if(m)return ya(e,t,n,t+m[0],r,i,a,i+m[1])}return[new Y(t,n,i,a)]}var ga=class{constructor(){this.vec=[]}reset(e){this.len=e<<1;for(let e=0;e<this.len;e++)this.vec[e]=-1;this.vec[e+1]=0,this.start=this.end=0}advance(e,t,n,r,i,a,o){for(let s=-e+this.start;s<=e-this.end;s+=2){let c=r+s,l=s==-e||s!=e&&this.vec[c-1]<this.vec[c+1]?this.vec[c+1]:this.vec[c-1]+1,u=l-s;for(;l<t&&u<n&&o(l,u);)l++,u++;if(this.vec[c]=l,l>t)this.end+=2;else if(u>n)this.start+=2;else if(i){let e=r+(t-n)-s;if(e>=0&&e<this.len&&i.vec[e]!=-1){if(a){let n=i.vec[e];if(n>=t-l)return[n,r+n-e]}else{let n=t-i.vec[e];if(l>=n)return[l,u]}}}}return null}},_a=new ga,va=new ga;function ya(e,t,n,r,i,a,o,s){let c=!1;return!Z(e,r)&&++r==n&&(c=!0),!Z(i,s)&&++s==o&&(c=!0),c?[new Y(t,n,a,o)]:X(e,t,r,i,a,s).concat(X(e,r,n,i,s,o))}function ba(e,t){let n=1,r=Math.min(e,t);for(;n<r;)n<<=1;return n}function xa(e,t,n,r,i,a){if(t==n||t==a||e.charCodeAt(t)!=r.charCodeAt(i))return 0;let o=ba(n-t,a-i);for(let s=t,c=i;;){let i=s+o,l=c+o;if(i>n||l>a||e.slice(s,i)!=r.slice(c,l)){if(o==1)return s-t-+!Z(e,s);o>>=1}else if(i==n||l==a)return i-t;else s=i,c=l}}function Sa(e,t,n,r,i,a){if(t==n||i==a||e.charCodeAt(n-1)!=r.charCodeAt(a-1))return 0;let o=ba(n-t,a-i);for(let s=n,c=a;;){let a=s-o,l=c-o;if(a<t||l<i||e.slice(a,s)!=r.slice(l,c)){if(o==1)return n-s-+!Z(e,s);o>>=1}else if(a==t||l==i)return n-a;else s=a,c=l}}function Ca(e,t,n,r,i,a,o,s){let c=r.slice(i,a),l=null;for(;;){if(l||o<s)return l;for(let s=t+o;;){Z(e,s)||s++;let u=s+o;if(Z(e,u)||(u+=u==s+1?1:-1),u>=n)break;let d=e.slice(s,u),f=-1;for(;(f=c.indexOf(d,f+1))!=-1;){let o=xa(e,u,n,r,i+f+d.length,a),c=Sa(e,t,s,r,i,i+f),p=d.length+o+c;(!l||l[2]<p)&&(l=[s-c,i+f-c,p])}s=u}if(s<0)return l;o>>=1}}function wa(e,t,n,r,i,a){let o=n-t,s=a-i;if(o<s){let o=wa(r,i,a,e,t,n);return o&&[o[1],o[0],o[2]]}return o<4||s*2<o?null:Ca(e,t,n,r,i,a,Math.floor(o/4),-1)}function Ta(e,t,n,r,i,a){let o=n-t,s=a-i,c;if(o<s){let s=Ca(r,i,a,e,t,n,Math.floor(o/6),50);c=s&&[s[1],s[0],s[2]]}else c=Ca(e,t,n,r,i,a,Math.floor(s/6),50);if(!c)return[new Y(t,n,i,a)];let[l,u,d]=c;return X(e,t,l,r,i,u).concat(X(e,l+d,n,r,u+d,a))}function Ea(e,t){for(let n=1;n<e.length;n++){let r=e[n-1],i=e[n];r.toA>i.fromA-t&&r.toB>i.fromB-t&&(e[n-1]=new Y(r.fromA,i.toA,r.fromB,i.toB),e.splice(n--,1))}}function Da(e,t,n){for(;;){Ea(n,1);let r=!1;for(let i=0;i<n.length;i++){let a=n[i],o,s;(o=xa(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new Y(a.fromA+o,a.toA,a.fromB+o,a.toB)),(s=Sa(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new Y(a.fromA,a.toA-s,a.fromB,a.toB-s));let c=a.toA-a.fromA,l=a.toB-a.fromB;if(c&&l)continue;let u=a.fromA-(i?n[i-1].toA:0),d=(i<n.length-1?n[i+1].fromA:e.length)-a.toA;if(!u||!d)continue;let f=c?e.slice(a.fromA,a.toA):t.slice(a.fromB,a.toB);u<=f.length&&e.slice(a.fromA-u,a.fromA)==f.slice(f.length-u)?(n[i]=new Y(a.fromA-u,a.toA-u,a.fromB-u,a.toB-u),r=!0):d<=f.length&&e.slice(a.toA,a.toA+d)==f.slice(0,d)&&(n[i]=new Y(a.fromA+d,a.toA+d,a.fromB+d,a.toB+d),r=!0)}if(!r)break}return n}var Oa=e=>e>=55296&&e<=56319,ka=e=>e>=56320&&e<=57343;function Z(e,t){return!t||t==e.length||!Oa(e.charCodeAt(t-1))||!ka(e.charCodeAt(t))}function Aa(e,t,n){let r=n?.override;return r?r(e,t):(pa=(n?.scanLimit??1e9)>>1,ma=n?.timeout?Date.now()+n.timeout:0,Da(e,t,X(e,0,e.length,t,0,t.length)))}function ja(e){return e.fromA===e.toA?`added`:e.fromB===e.toB?`deleted`:`modified`}function Ma(e){return e.split(/\r?\n/)}var Na=256,Pa=2048,Fa=63232;function Ia(e){let t=Na+e;return String.fromCharCode(t>=55296?t+Pa:t)}function La(e,t){let n=new Map,r=e=>{let t=``;for(let r of e){let e=n.get(r);if(e===void 0){if(n.size>=Fa)return null;e=Ia(n.size),n.set(r,e)}t+=e}return t},i=r(e),a=r(t);return i===null||a===null?null:Aa(i,a).map(({fromA:e,toA:t,fromB:n,toB:r})=>({fromA:e,toA:t,fromB:n,toB:r}))}function Ra(e,t,n){let r=t.slice(n.fromA,n.toA);if(n.fromB===n.toB){if(n.fromB<e.lines){let t=e.line(n.fromB+1).from;return{from:t,to:t,insert:T.of([...r,``])}}return{from:e.length,to:e.length,insert:T.of([``,...r])}}let i=e.line(n.fromB+1).from,a=e.line(n.toB).to;return r.length===0?(n.toB<e.lines?a=e.line(n.toB+1).from:n.fromB>0&&(i=e.line(n.fromB).to),{from:i,to:a,insert:T.empty}):{from:i,to:a,insert:T.of(r)}}var za=E.define(),Ba=E.define();function Va(e){let t=[];for(let n=e.iterLines();!n.next().done;)t.push(n.value);return t}function Ha(e,t){return e===null?[]:La(e,Va(t))??[]}function Ua(e,t){let n=t.findIndex(t=>t.fromA===e.fromA&&t.toA===e.toA);return n===-1?null:n}var Q=y.define({create:()=>({baseline:null,hunks:[],open:null}),update(e,t){let{baseline:n,hunks:r,open:i}=e,a=!1;for(let e of t.effects)e.is(za)&&(n=e.value===null?null:Ma(e.value),i=null,a=!0);if(a||t.docChanged&&n!==null){let e=i===null?void 0:r[i];r=Ha(n,t.state.doc),i=e===void 0?null:Ua(e,r)}for(let e of t.effects)e.is(Ba)&&(i=i===e.value?null:e.value);return n===e.baseline&&r===e.hunks&&i===e.open?e:{baseline:n,hunks:r,open:i}}}),Wa=class extends _{kind;index;atEnd;constructor(e,t,n=!1){super(),this.kind=e,this.index=t,this.atEnd=n}eq(e){return e.kind===this.kind&&e.index===this.index&&e.atEnd===this.atEnd}toDOM(e){let t=document.createElement(`div`);return t.className=`cm-git-mark cm-git-${this.kind}${this.atEnd?` cm-git-at-end`:``}`,t.dataset.gitChange=this.kind,t.title={added:`Added since HEAD: click to see the change`,modified:`Changed since HEAD: click to see what was there`,deleted:`Lines removed since HEAD: click to see them`}[this.kind],t.addEventListener(`mousedown`,t=>{t.preventDefault(),e.dispatch({effects:Ba.of(this.index)})}),t}};function Ga(e){let{hunks:t}=e.field(Q),n=e.doc,r=[];for(let[e,i]of t.entries()){let t=ja(i);if(t===`deleted`){let a=i.fromB>=n.lines;r.push(new Wa(t,e,a).range(n.line(a?n.lines:i.fromB+1).from))}else for(let a=i.fromB;a<i.toB;a++)r.push(new Wa(t,e).range(n.line(a+1).from))}return de.of(r,!0)}var Ka=class extends u{index;kind;old;editable;constructor(e,t,n,r){super(),this.index=e,this.kind=t,this.old=n,this.editable=r}eq(e){return e.index===this.index&&e.editable===this.editable&&e.old.join(`
3
+ `)===this.old.join(`
4
+ `)}toDOM(e){let t=document.createElement(`div`);t.className=`cm-git-peek`,t.setAttribute(`role`,`region`),t.setAttribute(`aria-label`,`HEAD version of this change`);let n=document.createElement(`div`);n.className=`cm-git-peek-bar`;let r=document.createElement(`span`);if(r.textContent=this.kind===`added`?`Not in HEAD`:`In HEAD`,n.append(r),this.editable){let t=document.createElement(`button`);t.type=`button`,t.textContent=`Revert this change`,t.addEventListener(`click`,()=>{let{baseline:t,hunks:n}=e.state.field(Q),r=n[this.index];t!==null&&r!==void 0&&(e.dispatch({changes:Ra(e.state.doc,t,r),userEvent:`input.revert`}),e.focus())}),n.append(t)}let i=document.createElement(`button`);if(i.type=`button`,i.textContent=`Close`,i.addEventListener(`click`,()=>e.dispatch({effects:Ba.of(this.index)})),n.append(i),t.append(n),this.old.length>0){let e=document.createElement(`pre`);e.className=`cm-git-peek-old`,e.textContent=this.old.join(`
5
+ `),t.append(e)}return t}ignoreEvent(){return!0}};function qa(e){let t=e.field(Q);if(t.open===null||t.baseline===null)return a.none;let n=t.hunks[t.open];if(n===void 0)return a.none;let r=e.doc,i=ja(n),o=t.baseline.slice(n.fromA,n.toA),s=new Ka(t.open,i,o,!e.readOnly),c=i!==`deleted`,l=c?r.line(n.toB):n.fromB<r.lines?r.line(n.fromB+1):r.line(r.lines),u=c||n.fromB>=r.lines;return a.set(a.widget({widget:s,block:!0,side:u?1:-1}).range(u?l.to:l.from))}function Ja(){return[Q,g.decorations.compute([Q],qa),o({class:`cm-git-gutter`,markers:e=>Ga(e.state),lineMarkerChange:e=>e.startState.field(Q)!==e.state.field(Q)})]}var Ya=e({CodeEditor:()=>no,detectIndentUnit:()=>$a,documentPosition:()=>$}),Xa=t(),Za=E.define(),Qa=y.define({create:()=>a.none,update(e,t){for(let e of t.effects)if(e.is(Za))return a.set(e.value.map(({from:e,to:t,current:n})=>a.mark({class:n?`find-match-current`:`find-match`}).range(e,t)),!0);return e.map(t.changes)},provide:e=>g.decorations.from(e)});function $a(e){if(/^\t/m.test(e))return` `;let t=[...e.matchAll(/^( +)\S/gm)].map(e=>e[1].length).filter(e=>e>=2&&e<=8);return` `.repeat(t.length===0?2:Math.min(...t))}function $(e,t){let n=0;for(let r=e.indexOf(`\r
6
+ `);r!==-1&&r<t-1;r=e.indexOf(`\r
7
+ `,r+2))n++;return t-n}var eo=({state:e,dispatch:t})=>e.selection.ranges.some(e=>!e.empty)?bi({state:e,dispatch:t}):(t(e.update(e.replaceSelection(e.facet(Ae)),{scrollIntoView:!0,userEvent:`input`})),!0);function to(e){return[f(),Dn(),re(),De.allowMultipleSelections.of(!0),ie(),Wt(),cn({activateOnTyping:!1}),Ce(),p(),oe(),se.of([...[`Ctrl-s`,`Meta-s`].map(t=>({key:t,preventDefault:!0,run:()=>(e.current.onSave?.(),!0)})),{key:`Mod-d`,run:Ki,preventDefault:!0},...Xt,...Ti,...Un,...me,...ln,{key:`Tab`,run:eo,shift:xi,preventDefault:!0}]),g.updateListener.of(t=>{t.docChanged&&e.current.onChange?.(t.state.sliceDoc())})]}function no({value:e,path:t,onChange:n,onSave:r,handle:a,readOnly:o=!1,baseline:s=null,label:c=o?`File source`:`File editor`}){let l=(0,D.useRef)(null),u=(0,D.useRef)(null),f=(0,D.useRef)({onChange:n,onSave:r});f.current={onChange:n,onSave:r},(0,D.useImperativeHandle)(a,()=>({focus:()=>u.current?.focus(),select(e,t){let n=u.current;if(n===null)return;let r=n.state.sliceDoc(),i=n.state.doc.length,a=Math.min($(r,e),i),o=Math.min($(r,t),i);n.dispatch({selection:x.single(a,o),effects:g.scrollIntoView(a,{y:`center`})})},markMatches(e,t){let n=u.current;if(n===null)return;let r=n.state.sliceDoc(),i=n.state.doc.length,a=e.map(({start:e,end:n},a)=>({from:Math.min($(r,e),i),to:Math.min($(r,n),i),current:a===t})).filter(({from:e,to:t})=>e<t);n.dispatch({effects:Za.of(a)})}})),(0,D.useEffect)(()=>{let n=new i,r=new g({parent:l.current,state:De.create({doc:e,extensions:[De.lineSeparator.of(e.includes(`\r
8
+ `)?`\r
9
+ `:`
10
+ `),Ae.of($a(e)),d(),Ja(),ae(),ve(),ee(),te(ke),pe(),Li(),Qa,g.lineWrapping,g.contentAttributes.of({"aria-label":c,spellcheck:`false`}),...o?[De.readOnly.of(!0),g.editable.of(!1),se.of(me)]:to(f),n.of([])]})});u.current=r,s!==null&&r.dispatch({effects:za.of(s)}),o||r.focus();let a=!0;return fa(t).then(e=>{a&&e!==null&&r.dispatch({effects:n.reconfigure(e)})},()=>{}),()=>{a=!1,r.destroy(),u.current=null}},[]),(0,D.useEffect)(()=>{let t=u.current;t!==null&&t.state.sliceDoc()!==e&&t.dispatch({changes:{from:0,to:t.state.doc.length,insert:e}})},[e]);let p=(0,D.useRef)(s);return(0,D.useEffect)(()=>{let e=u.current;e!==null&&p.current!==s&&(p.current=s,e.dispatch({effects:za.of(s)}))},[s]),(0,Xa.jsx)(`div`,{ref:l,className:`code-editor h-full w-full`,"data-testid":o?`file-source`:`file-editor`})}export{no as CodeEditor,Bt as a,$a as detectIndentUnit,$ as documentPosition,Le as i,Ne as n,Ie as r,Ya as t};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/pdf-DPmpn0PO.js","assets/index-Dmq-pdD4.js","assets/rolldown-runtime-COiEfhsA.js","assets/index-CHfryxyT.css"])))=>i.map(i=>d[i]);
2
- import{D as e,E as t,M as n,k as r,n as i,r as a}from"./index-Dmq-pdD4.js";var o=n();function s(e,t){if(e<=0)return[];let n=Math.min(Math.max(Math.round(t),1),e),r=[n],i=n-1,a=n+1;for(;i>=1||a<=e;)i>=1&&r.push(i--),a<=e&&r.push(a++);return r}function c(e,t,n,r,i=()=>new Promise(e=>setTimeout(e,0))){let a=!1,o=s(e.numPages,t);return(async()=>{for(let t of o){if(a)return;let r;try{r=await e.getPageText(t)}catch{r=``}if(a)return;n(t,r),await i()}a||r()})(),{cancel:()=>{a=!0}}}function l(e,t,n){if(n===``)return[];let r=[];for(let a=1;a<=t;a++){let t=e.get(a);if(t===void 0)continue;let o=i(t,n);for(let e=0;e<o.length;e++)r.push({page:a,ordinalOnPage:e})}return r}var u=e(),d=[.5,.75,1,1.25,1.5,2,3];function f(e){return e>=1048576?`${Math.round(e/1048576)} MB`:`${Math.round(e/1024)} KB`}function p(e){switch(e.kind){case`too-large`:return e.limitBytes===void 0?`This PDF is larger than the server's PDF limit.`:`This PDF is larger than the ${f(e.limitBytes)} limit the server allows.`;case`encrypted`:return`This PDF is password-protected, so it cannot be displayed.`;case`not-found`:return`This file no longer exists.`;case`unauthorized`:return`This session is not authorized to read this file.`;case`unreadable`:return`This file could not be read as a PDF.`}}async function m(e,t,n,i,a){let o=await fetch(r(e,t,null,i,a),{headers:n?{Authorization:`Bearer ${n}`}:{}});if(!o.ok){if(o.status===413){let e=await o.json().catch(()=>({}));throw{kind:`too-large`,...typeof e.limit==`number`?{limitBytes:e.limit}:{}}}throw o.status===401||o.status===403?{kind:`unauthorized`}:o.status===404?{kind:`not-found`}:{kind:`unreadable`}}return new Uint8Array(await o.arrayBuffer())}var h=null;function g(){return h??=t(()=>import(`./pdf-DPmpn0PO.js`),__vite__mapDeps([0,1,2,3])),h}async function _(e){let t=await g();t.GlobalWorkerOptions.workerSrc=new URL(`/assets/pdf.worker.min-CjEcRF4W.mjs`,``+import.meta.url).toString();let n=t.getDocument({data:e,useWorkerFetch:!1,isOffscreenCanvasSupported:!1});try{return{doc:await n.promise,task:n}}catch(e){throw await n.destroy().catch(()=>{}),{kind:(e instanceof Error?e.name:``)===`PasswordException`?`encrypted`:`unreadable`}}}async function v(e,t,n,r){if(n!==null&&e.streamTextContent!==void 0){n.replaceChildren();try{let i=await g();n.style.setProperty(`--total-scale-factor`,String(r)),await new i.TextLayer({textContentSource:await e.streamTextContent(),container:n,viewport:t}).render()}catch{n.replaceChildren()}}}function y(e){try{e?.cancel()}catch{}}function b(e){return typeof e==`object`&&!!e&&typeof e.kind==`string`}var x=1;function S({doc:e,pageNumber:t,scale:n,baseSize:r,active:i,registerSlot:a,onTextLayerReady:s}){let c=(0,o.useRef)(null),l=(0,o.useRef)(null),d=(0,o.useRef)(null),[f,p]=(0,o.useState)(!1),[m,h]=(0,o.useState)({width:r.width*n,height:r.height*n});return(0,o.useEffect)(()=>{h({width:r.width*n,height:r.height*n})},[r.width,r.height,n]),(0,o.useEffect)(()=>{if(!i)return;let r=!1,a=d.current;return y(a),(async()=>{try{let i=await e.getPage(t),o=i.getViewport({scale:n}),u=c.current;if(r||u===null||(await a?.promise.catch(()=>{}),r))return;h({width:o.width,height:o.height}),u.width=Math.floor(o.width),u.height=Math.floor(o.height);let f=i.render({canvas:u,viewport:o,annotationMode:0});if(d.current=f,await f.promise,r)return;await v(i,o,l.current,n),r||(p(!1),s?.(t,l.current))}catch(e){let t=e instanceof Error?e.name:``;!r&&t!==`RenderingCancelledException`&&p(!0)}})(),()=>{r=!0,y(d.current),s?.(t,null)}},[e,t,n,i]),(0,u.jsx)(`div`,{ref:e=>a(t,e),"data-page":t,className:`relative mx-auto mb-4 bg-white shadow last:mb-0`,style:{width:m.width,height:m.height},children:f?(0,u.jsxs)(`p`,{className:`absolute inset-0 flex items-center justify-center p-4 text-center text-xs text-red-600 dark:text-red-400`,children:[`Page `,t,` could not be rendered.`]}):i?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`canvas`,{ref:c,className:`block h-full w-full`}),(0,u.jsx)(`div`,{ref:l,className:`pdf-text-layer`,"aria-hidden":!0})]}):null})}var C=(0,o.forwardRef)(function({path:e,serverUrl:t=``,token:n=null,workspace:r,revision:i=0,onLoaded:s,findQuery:f=``,onFindStateChange:h},g){let[v,y]=(0,o.useState)(null),[C,w]=(0,o.useState)(null),[T,E]=(0,o.useState)(1),[D,O]=(0,o.useState)(2),[k,A]=(0,o.useState)(null),j=(0,o.useRef)(null),M=(0,o.useRef)(new Map),[N,P]=(0,o.useState)(new Map),[F,I]=(0,o.useState)(!1),[L,R]=(0,o.useState)([]),[z,B]=(0,o.useState)(-1),V=(0,o.useRef)(null),H=(0,o.useRef)(!1),U=(0,o.useRef)(f),W=(0,o.useRef)(new Map),G=(0,o.useRef)(null),K=(0,o.useRef)([]),q=(0,o.useRef)(-1),J=(0,o.useRef)(f);(0,o.useEffect)(()=>{K.current=L},[L]),(0,o.useEffect)(()=>{q.current=z},[z]),(0,o.useEffect)(()=>{J.current=f},[f]);let Y=(0,o.useCallback)(()=>{G.current?.result.clear(),G.current=null},[]),X=(0,o.useCallback)((e,t)=>{Y();let n=a(t,J.current);G.current={page:e.page,result:n};let r=n.matches[e.ordinalOnPage]?.marks??[];for(let e of r)e.classList.add(`find-match-current`);r[0]?.scrollIntoView({block:`center`})},[Y]),Z=(0,o.useCallback)((e,t)=>{if(t===null){W.current.delete(e);return}W.current.set(e,t);let n=K.current[q.current];n!==void 0&&n.page===e&&X(n,t)},[X]);(0,o.useEffect)(()=>{let a=!1,o=null;return y(null),w(null),E(1),A(null),V.current?.cancel(),V.current=null,H.current=!1,P(new Map),I(!1),R([]),B(-1),Y(),W.current.clear(),(async()=>{try{let{doc:c,task:l}=await _(await m(t,e,n,i,r));if(o=l,a){await l.destroy().catch(()=>{});return}try{let e=(await c.getPage(1)).getViewport({scale:1});a||A({width:e.width,height:e.height})}catch{a||A({width:612,height:792})}if(a)return;y(c),s?.(e)}catch(e){a||w(b(e)?e:{kind:`unreadable`})}})(),()=>{a=!0,o?.destroy().catch(()=>{})}},[e,t,n,r,i]);let Q=v?.numPages??0,ee=(0,o.useCallback)((e,t)=>{t===null?M.current.delete(e):M.current.set(e,t)},[]);(0,o.useEffect)(()=>{if(v===null||f===``||H.current)return;H.current=!0,I(!0);let e=v,t={numPages:e.numPages,getPageText:async t=>{let n=await e.getPage(t);return n.getTextContent===void 0?``:(await n.getTextContent()).items.map(e=>typeof e.str==`string`?e.str:``).join(``)}};V.current=c(t,T,(e,t)=>P(n=>{let r=new Map(n);return r.set(e,t),r}),()=>I(!1))},[v,f]),(0,o.useEffect)(()=>()=>{V.current?.cancel(),V.current=null},[v]),(0,o.useEffect)(()=>{let e=l(N,v?.numPages??0,f),t=f!==U.current;U.current=f,R(e),B(n=>e.length===0?-1:t||n===-1?0:Math.min(n,e.length-1))},[N,f,v]),(0,o.useEffect)(()=>{if(z===-1||L.length===0){Y();return}let e=L[z];if(G.current!==null&&G.current.page!==e.page&&Y(),Math.abs(e.page-T)>x){$(e.page);return}let t=W.current.get(e.page);t!==void 0&&X(e,t)},[z,L]),(0,o.useImperativeHandle)(g,()=>({findNext(){K.current.length!==0&&B(e=>(e+1)%K.current.length)},findPrevious(){K.current.length!==0&&B(e=>(e-1+K.current.length)%K.current.length)}}),[]),(0,o.useEffect)(()=>{h?.({matchCount:L.length,currentIndex:z,searching:F})},[L.length,z,F]),(0,o.useEffect)(()=>{if(v===null||typeof IntersectionObserver>`u`)return;let e=j.current;if(e===null)return;let t=new IntersectionObserver(e=>{for(let t of e){if(!t.isIntersecting)continue;let e=Number(t.target.dataset.page);Number.isFinite(e)&&E(e)}},{root:e,rootMargin:`-45% 0px -45% 0px`,threshold:0});for(let e of M.current.values())t.observe(e);return()=>t.disconnect()},[v,Q]);let $=(0,o.useCallback)(e=>{e<1||e>Q||(E(e),M.current.get(e)?.scrollIntoView({block:`start`}))},[Q]);return C===null?v===null?(0,u.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,u.jsx)(`p`,{className:`text-sm text-zinc-500`,children:`Loading PDF…`})}):(0,u.jsxs)(`div`,{className:`flex h-full flex-col`,onKeyDown:e=>{if(e.key===`PageDown`||e.key===`ArrowRight`)$(T+1);else if(e.key===`PageUp`||e.key===`ArrowLeft`)$(T-1);else return;e.preventDefault()},children:[(0,u.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-zinc-200 px-3 py-2 text-xs dark:border-zinc-800`,children:[(0,u.jsx)(`button`,{type:`button`,onClick:()=>$(T-1),disabled:T<=1,"aria-label":`Previous page`,className:`rounded px-2 py-1 hover:bg-zinc-100 disabled:opacity-40 dark:hover:bg-zinc-800`,children:`‹`}),(0,u.jsxs)(`span`,{className:`tabular-nums text-zinc-600 dark:text-zinc-400`,children:[`Page `,T,` / `,Q]}),(0,u.jsx)(`button`,{type:`button`,onClick:()=>$(T+1),disabled:T>=Q,"aria-label":`Next page`,className:`rounded px-2 py-1 hover:bg-zinc-100 disabled:opacity-40 dark:hover:bg-zinc-800`,children:`›`}),(0,u.jsxs)(`span`,{className:`ml-auto flex items-center gap-1`,children:[(0,u.jsx)(`button`,{type:`button`,onClick:()=>O(e=>Math.max(0,e-1)),disabled:D===0,"aria-label":`Zoom out`,className:`rounded px-2 py-1 hover:bg-zinc-100 disabled:opacity-40 dark:hover:bg-zinc-800`,children:`−`}),(0,u.jsxs)(`span`,{className:`tabular-nums text-zinc-500`,children:[Math.round(d[D]*100),`%`]}),(0,u.jsx)(`button`,{type:`button`,onClick:()=>O(e=>Math.min(d.length-1,e+1)),disabled:D===d.length-1,"aria-label":`Zoom in`,className:`rounded px-2 py-1 hover:bg-zinc-100 disabled:opacity-40 dark:hover:bg-zinc-800`,children:`+`})]})]}),(0,u.jsx)(`div`,{ref:j,className:`flex-1 overflow-auto bg-zinc-100 p-4 dark:bg-zinc-950`,children:k!==null&&Array.from({length:Q},(e,t)=>t+1).map(e=>(0,u.jsx)(S,{doc:v,pageNumber:e,scale:d[D],baseSize:k,active:Math.abs(e-T)<=x,registerSlot:ee,onTextLayerReady:Z},e))})]}):(0,u.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,u.jsx)(`p`,{className:`max-w-md text-center text-sm text-zinc-600 dark:text-zinc-400`,children:p(C)})})});export{C as PdfViewer,C as default};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/pdf-DqL0VQOW.js","assets/index-B56c-g9j.js","assets/rolldown-runtime-COiEfhsA.js","assets/index-uwznXVRc.css"])))=>i.map(i=>d[i]);
2
+ import{D as e,E as t,M as n,k as r,n as i,r as a}from"./index-B56c-g9j.js";var o=n();function s(e,t){if(e<=0)return[];let n=Math.min(Math.max(Math.round(t),1),e),r=[n],i=n-1,a=n+1;for(;i>=1||a<=e;)i>=1&&r.push(i--),a<=e&&r.push(a++);return r}function c(e,t,n,r,i=()=>new Promise(e=>setTimeout(e,0))){let a=!1,o=s(e.numPages,t);return(async()=>{for(let t of o){if(a)return;let r;try{r=await e.getPageText(t)}catch{r=``}if(a)return;n(t,r),await i()}a||r()})(),{cancel:()=>{a=!0}}}function l(e,t,n){if(n===``)return[];let r=[];for(let a=1;a<=t;a++){let t=e.get(a);if(t===void 0)continue;let o=i(t,n);for(let e=0;e<o.length;e++)r.push({page:a,ordinalOnPage:e})}return r}var u=e(),d=[.5,.75,1,1.25,1.5,2,3];function f(e){return e>=1048576?`${Math.round(e/1048576)} MB`:`${Math.round(e/1024)} KB`}function p(e){switch(e.kind){case`too-large`:return e.limitBytes===void 0?`This PDF is larger than the server's PDF limit.`:`This PDF is larger than the ${f(e.limitBytes)} limit the server allows.`;case`encrypted`:return`This PDF is password-protected, so it cannot be displayed.`;case`not-found`:return`This file no longer exists.`;case`unauthorized`:return`This session is not authorized to read this file.`;case`unreadable`:return`This file could not be read as a PDF.`}}async function m(e,t,n,i,a){let o=await fetch(r(e,t,null,i,a),{headers:n?{Authorization:`Bearer ${n}`}:{}});if(!o.ok){if(o.status===413){let e=await o.json().catch(()=>({}));throw{kind:`too-large`,...typeof e.limit==`number`?{limitBytes:e.limit}:{}}}throw o.status===401||o.status===403?{kind:`unauthorized`}:o.status===404?{kind:`not-found`}:{kind:`unreadable`}}return new Uint8Array(await o.arrayBuffer())}var h=null;function g(){return h??=t(()=>import(`./pdf-DqL0VQOW.js`),__vite__mapDeps([0,1,2,3])),h}async function _(e){let t=await g();t.GlobalWorkerOptions.workerSrc=new URL(`/assets/pdf.worker.min-CjEcRF4W.mjs`,``+import.meta.url).toString();let n=t.getDocument({data:e,useWorkerFetch:!1,isOffscreenCanvasSupported:!1});try{return{doc:await n.promise,task:n}}catch(e){throw await n.destroy().catch(()=>{}),{kind:(e instanceof Error?e.name:``)===`PasswordException`?`encrypted`:`unreadable`}}}async function v(e,t,n,r){if(n!==null&&e.streamTextContent!==void 0){n.replaceChildren();try{let i=await g();n.style.setProperty(`--total-scale-factor`,String(r)),await new i.TextLayer({textContentSource:await e.streamTextContent(),container:n,viewport:t}).render()}catch{n.replaceChildren()}}}function y(e){try{e?.cancel()}catch{}}function b(e){return typeof e==`object`&&!!e&&typeof e.kind==`string`}var x=1;function S({doc:e,pageNumber:t,scale:n,baseSize:r,active:i,registerSlot:a,onTextLayerReady:s}){let c=(0,o.useRef)(null),l=(0,o.useRef)(null),d=(0,o.useRef)(null),[f,p]=(0,o.useState)(!1),[m,h]=(0,o.useState)({width:r.width*n,height:r.height*n});return(0,o.useEffect)(()=>{h({width:r.width*n,height:r.height*n})},[r.width,r.height,n]),(0,o.useEffect)(()=>{if(!i)return;let r=!1,a=d.current;return y(a),(async()=>{try{let i=await e.getPage(t),o=i.getViewport({scale:n}),u=c.current;if(r||u===null||(await a?.promise.catch(()=>{}),r))return;h({width:o.width,height:o.height}),u.width=Math.floor(o.width),u.height=Math.floor(o.height);let f=i.render({canvas:u,viewport:o,annotationMode:0});if(d.current=f,await f.promise,r)return;await v(i,o,l.current,n),r||(p(!1),s?.(t,l.current))}catch(e){let t=e instanceof Error?e.name:``;!r&&t!==`RenderingCancelledException`&&p(!0)}})(),()=>{r=!0,y(d.current),s?.(t,null)}},[e,t,n,i]),(0,u.jsx)(`div`,{ref:e=>a(t,e),"data-page":t,className:`relative mx-auto mb-4 bg-white shadow last:mb-0`,style:{width:m.width,height:m.height},children:f?(0,u.jsxs)(`p`,{className:`absolute inset-0 flex items-center justify-center p-4 text-center text-xs text-red-600 dark:text-red-400`,children:[`Page `,t,` could not be rendered.`]}):i?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`canvas`,{ref:c,className:`block h-full w-full`}),(0,u.jsx)(`div`,{ref:l,className:`pdf-text-layer`,"aria-hidden":!0})]}):null})}var C=(0,o.forwardRef)(function({path:e,serverUrl:t=``,token:n=null,workspace:r,revision:i=0,onLoaded:s,findQuery:f=``,onFindStateChange:h},g){let[v,y]=(0,o.useState)(null),[C,w]=(0,o.useState)(null),[T,E]=(0,o.useState)(1),[D,O]=(0,o.useState)(2),[k,A]=(0,o.useState)(null),j=(0,o.useRef)(null),M=(0,o.useRef)(new Map),[N,P]=(0,o.useState)(new Map),[F,I]=(0,o.useState)(!1),[L,R]=(0,o.useState)([]),[z,B]=(0,o.useState)(-1),V=(0,o.useRef)(null),H=(0,o.useRef)(!1),U=(0,o.useRef)(f),W=(0,o.useRef)(new Map),G=(0,o.useRef)(null),K=(0,o.useRef)([]),q=(0,o.useRef)(-1),J=(0,o.useRef)(f);(0,o.useEffect)(()=>{K.current=L},[L]),(0,o.useEffect)(()=>{q.current=z},[z]),(0,o.useEffect)(()=>{J.current=f},[f]);let Y=(0,o.useCallback)(()=>{G.current?.result.clear(),G.current=null},[]),X=(0,o.useCallback)((e,t)=>{Y();let n=a(t,J.current);G.current={page:e.page,result:n};let r=n.matches[e.ordinalOnPage]?.marks??[];for(let e of r)e.classList.add(`find-match-current`);r[0]?.scrollIntoView({block:`center`})},[Y]),Z=(0,o.useCallback)((e,t)=>{if(t===null){W.current.delete(e);return}W.current.set(e,t);let n=K.current[q.current];n!==void 0&&n.page===e&&X(n,t)},[X]);(0,o.useEffect)(()=>{let a=!1,o=null;return y(null),w(null),E(1),A(null),V.current?.cancel(),V.current=null,H.current=!1,P(new Map),I(!1),R([]),B(-1),Y(),W.current.clear(),(async()=>{try{let{doc:c,task:l}=await _(await m(t,e,n,i,r));if(o=l,a){await l.destroy().catch(()=>{});return}try{let e=(await c.getPage(1)).getViewport({scale:1});a||A({width:e.width,height:e.height})}catch{a||A({width:612,height:792})}if(a)return;y(c),s?.(e)}catch(e){a||w(b(e)?e:{kind:`unreadable`})}})(),()=>{a=!0,o?.destroy().catch(()=>{})}},[e,t,n,r,i]);let Q=v?.numPages??0,ee=(0,o.useCallback)((e,t)=>{t===null?M.current.delete(e):M.current.set(e,t)},[]);(0,o.useEffect)(()=>{if(v===null||f===``||H.current)return;H.current=!0,I(!0);let e=v,t={numPages:e.numPages,getPageText:async t=>{let n=await e.getPage(t);return n.getTextContent===void 0?``:(await n.getTextContent()).items.map(e=>typeof e.str==`string`?e.str:``).join(``)}};V.current=c(t,T,(e,t)=>P(n=>{let r=new Map(n);return r.set(e,t),r}),()=>I(!1))},[v,f]),(0,o.useEffect)(()=>()=>{V.current?.cancel(),V.current=null},[v]),(0,o.useEffect)(()=>{let e=l(N,v?.numPages??0,f),t=f!==U.current;U.current=f,R(e),B(n=>e.length===0?-1:t||n===-1?0:Math.min(n,e.length-1))},[N,f,v]),(0,o.useEffect)(()=>{if(z===-1||L.length===0){Y();return}let e=L[z];if(G.current!==null&&G.current.page!==e.page&&Y(),Math.abs(e.page-T)>x){$(e.page);return}let t=W.current.get(e.page);t!==void 0&&X(e,t)},[z,L]),(0,o.useImperativeHandle)(g,()=>({findNext(){K.current.length!==0&&B(e=>(e+1)%K.current.length)},findPrevious(){K.current.length!==0&&B(e=>(e-1+K.current.length)%K.current.length)}}),[]),(0,o.useEffect)(()=>{h?.({matchCount:L.length,currentIndex:z,searching:F})},[L.length,z,F]),(0,o.useEffect)(()=>{if(v===null||typeof IntersectionObserver>`u`)return;let e=j.current;if(e===null)return;let t=new IntersectionObserver(e=>{for(let t of e){if(!t.isIntersecting)continue;let e=Number(t.target.dataset.page);Number.isFinite(e)&&E(e)}},{root:e,rootMargin:`-45% 0px -45% 0px`,threshold:0});for(let e of M.current.values())t.observe(e);return()=>t.disconnect()},[v,Q]);let $=(0,o.useCallback)(e=>{e<1||e>Q||(E(e),M.current.get(e)?.scrollIntoView({block:`start`}))},[Q]);return C===null?v===null?(0,u.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,u.jsx)(`p`,{className:`text-sm text-zinc-500`,children:`Loading PDF…`})}):(0,u.jsxs)(`div`,{className:`flex h-full flex-col`,onKeyDown:e=>{if(e.key===`PageDown`||e.key===`ArrowRight`)$(T+1);else if(e.key===`PageUp`||e.key===`ArrowLeft`)$(T-1);else return;e.preventDefault()},children:[(0,u.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-zinc-200 px-3 py-2 text-xs dark:border-zinc-800`,children:[(0,u.jsx)(`button`,{type:`button`,onClick:()=>$(T-1),disabled:T<=1,"aria-label":`Previous page`,className:`rounded px-2 py-1 hover:bg-zinc-100 disabled:opacity-40 dark:hover:bg-zinc-800`,children:`‹`}),(0,u.jsxs)(`span`,{className:`tabular-nums text-zinc-600 dark:text-zinc-400`,children:[`Page `,T,` / `,Q]}),(0,u.jsx)(`button`,{type:`button`,onClick:()=>$(T+1),disabled:T>=Q,"aria-label":`Next page`,className:`rounded px-2 py-1 hover:bg-zinc-100 disabled:opacity-40 dark:hover:bg-zinc-800`,children:`›`}),(0,u.jsxs)(`span`,{className:`ml-auto flex items-center gap-1`,children:[(0,u.jsx)(`button`,{type:`button`,onClick:()=>O(e=>Math.max(0,e-1)),disabled:D===0,"aria-label":`Zoom out`,className:`rounded px-2 py-1 hover:bg-zinc-100 disabled:opacity-40 dark:hover:bg-zinc-800`,children:`−`}),(0,u.jsxs)(`span`,{className:`tabular-nums text-zinc-500`,children:[Math.round(d[D]*100),`%`]}),(0,u.jsx)(`button`,{type:`button`,onClick:()=>O(e=>Math.min(d.length-1,e+1)),disabled:D===d.length-1,"aria-label":`Zoom in`,className:`rounded px-2 py-1 hover:bg-zinc-100 disabled:opacity-40 dark:hover:bg-zinc-800`,children:`+`})]})]}),(0,u.jsx)(`div`,{ref:j,className:`flex-1 overflow-auto bg-zinc-100 p-4 dark:bg-zinc-950`,children:k!==null&&Array.from({length:Q},(e,t)=>t+1).map(e=>(0,u.jsx)(S,{doc:v,pageNumber:e,scale:d[D],baseSize:k,active:Math.abs(e-T)<=x,registerSlot:ee,onTextLayerReady:Z},e))})]}):(0,u.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,u.jsx)(`p`,{className:`max-w-md text-center text-sm text-zinc-600 dark:text-zinc-400`,children:p(C)})})});export{C as PdfViewer,C as default};
@@ -1 +1 @@
1
- import{m as e,t}from"./mermaid-parser.core-Do7Tg9-B.js";import{n}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as r}from"./src-BWF7jMDv.js";import"./chunk-DSNLSHJZ-Beg_OHes.js";import{n as i,r as a,t as o}from"./chunk-2E7WHVMD-DCN3RDFe.js";import{t as s}from"./chunk-JWPE2WC7-DVXcaiue.js";import"./mermaid.core-BW4B0C_D.js";var c=e().RailroadAbnf.parser.LangiumParser,l=n(e=>{let t=e.alternatives.map(u);return t.length===1?t[0]:{type:`choice`,alternatives:t}},`transformAlternation`),u=n(e=>{let t=e.elements.map(f);return t.length===1?t[0]:{type:`sequence`,elements:t}},`transformConcatenation`),d=n(e=>{if(e.includes(`*`)){let[t,n]=e.split(`*`);return{min:t?parseInt(t,10):0,max:n?parseInt(n,10):1/0}}let t=parseInt(e,10);return{min:t,max:t}},`parseRepeat`),f=n(e=>{let t=p(e.primary);if(!e.repeat)return t;let{min:n,max:r}=d(e.repeat);return n===0&&r===1?{type:`optional`,element:t}:{type:`repetition`,element:t,min:n,max:r}},`transformElement`),p=n(e=>{switch(e.$type){case`AbnfStringLiteral`:return{type:`terminal`,value:e.value};case`AbnfNumVal`:return{type:`terminal`,value:e.value};case`AbnfRuleName`:return{type:`nonterminal`,name:e.name};case`AbnfGroup`:return l(e.element);case`AbnfOptionalGroup`:return{type:`optional`,element:l(e.element)};default:throw Error(`Unsupported ABNF primary node: ${e.$type}`)}},`transformPrimary`),m=n(e=>({name:e.name,definition:l(e.definition)}),`transformRule`),h=n(e=>{s(e,o),e.title&&o.setTitle(e.title),e.rules.map(e=>o.addRule(m(e)))},`populateDb`),g={parser:{parse:n(e=>{o.clear(),r.debug(`[ABNF Parser] Starting Langium parse`);let n=c.parse(e);if(n.lexerErrors.length>0||n.parserErrors.length>0)throw new t(n);let i=n.value;r.debug(`[ABNF Parser] Parsed rules:`,i.rules.length),h(i),r.debug(`[ABNF Parser] Parse complete`)},`parse`),parser:{yy:o}},db:o,renderer:a,styles:i};export{g as diagram};
1
+ import{m as e,t}from"./mermaid-parser.core-D-w11H_2.js";import{n}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as r}from"./src-BWF7jMDv.js";import"./chunk-DSNLSHJZ-DaRLU1qt.js";import{n as i,r as a,t as o}from"./chunk-2E7WHVMD-CgiRHuHp.js";import{t as s}from"./chunk-JWPE2WC7-DVXcaiue.js";import"./mermaid.core-CzmHcBmx.js";var c=e().RailroadAbnf.parser.LangiumParser,l=n(e=>{let t=e.alternatives.map(u);return t.length===1?t[0]:{type:`choice`,alternatives:t}},`transformAlternation`),u=n(e=>{let t=e.elements.map(f);return t.length===1?t[0]:{type:`sequence`,elements:t}},`transformConcatenation`),d=n(e=>{if(e.includes(`*`)){let[t,n]=e.split(`*`);return{min:t?parseInt(t,10):0,max:n?parseInt(n,10):1/0}}let t=parseInt(e,10);return{min:t,max:t}},`parseRepeat`),f=n(e=>{let t=p(e.primary);if(!e.repeat)return t;let{min:n,max:r}=d(e.repeat);return n===0&&r===1?{type:`optional`,element:t}:{type:`repetition`,element:t,min:n,max:r}},`transformElement`),p=n(e=>{switch(e.$type){case`AbnfStringLiteral`:return{type:`terminal`,value:e.value};case`AbnfNumVal`:return{type:`terminal`,value:e.value};case`AbnfRuleName`:return{type:`nonterminal`,name:e.name};case`AbnfGroup`:return l(e.element);case`AbnfOptionalGroup`:return{type:`optional`,element:l(e.element)};default:throw Error(`Unsupported ABNF primary node: ${e.$type}`)}},`transformPrimary`),m=n(e=>({name:e.name,definition:l(e.definition)}),`transformRule`),h=n(e=>{s(e,o),e.title&&o.setTitle(e.title),e.rules.map(e=>o.addRule(m(e)))},`populateDb`),g={parser:{parse:n(e=>{o.clear(),r.debug(`[ABNF Parser] Starting Langium parse`);let n=c.parse(e);if(n.lexerErrors.length>0||n.parserErrors.length>0)throw new t(n);let i=n.value;r.debug(`[ABNF Parser] Parsed rules:`,i.rules.length),h(i),r.debug(`[ABNF Parser] Parse complete`)},`parse`),parser:{yy:o}},db:o,renderer:a,styles:i};export{g as diagram};
@@ -1 +1 @@
1
- import"./chunk-NGNAAXSQ-C2Wy9Xmz.js";export{M as createArchitectureServices}from"./mermaid-parser.core-Do7Tg9-B.js";
1
+ import"./chunk-NGNAAXSQ-C2Wy9Xmz.js";export{M as createArchitectureServices}from"./mermaid-parser.core-D-w11H_2.js";