@marimo-team/frontend 0.15.5 → 0.16.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 (223) hide show
  1. package/dist/assets/{ConnectedDataExplorerComponent-Cn5-l2X1.js → ConnectedDataExplorerComponent-BErMbWvG.js} +1 -1
  2. package/dist/assets/{ImageComparisonComponent-CEXMKKA4.js → ImageComparisonComponent-fTHv1Ih0.js} +1 -1
  3. package/dist/assets/{VegaLite-Bt14Ds9k.js → VegaLite-Bdi-TyfY.js} +6 -6
  4. package/dist/assets/_baseEach-CNBxBxvS.js +1 -0
  5. package/dist/assets/_baseMap-D1WHjKrd.js +1 -0
  6. package/dist/assets/_baseUniq-CCgDNtZb.js +1 -0
  7. package/dist/assets/_createAggregator-DcD0kTA5.js +1 -0
  8. package/dist/assets/agent-panel-Crv430aI.js +268 -0
  9. package/dist/assets/agent-panel-D92Mfy1i.css +1 -0
  10. package/dist/assets/{any-language-editor-DiwNT6zp.js → any-language-editor-CQh552Wu.js} +1 -1
  11. package/dist/assets/architectureDiagram-W76B3OCA-BAJeBxzt.js +36 -0
  12. package/dist/assets/{between-horizontal-start-FyewyCGn.js → between-horizontal-start-Boxgxbt_.js} +1 -1
  13. package/dist/assets/{blockDiagram-QIGZ2CNN-BrOkAf_c.js → blockDiagram-QIGZ2CNN-CL-1svEK.js} +1 -1
  14. package/dist/assets/{c4Diagram-FPNF74CW-BHPzDxE2.js → c4Diagram-FPNF74CW-BbEqbCTl.js} +5 -5
  15. package/dist/assets/channel-_2eNSz0n.js +1 -0
  16. package/dist/assets/chat-panel-CXh5Wl6C.js +3 -0
  17. package/dist/assets/{chunk-4BX2VUAB-DLxaCNYh.js → chunk-4BX2VUAB-C--8TXeE.js} +1 -1
  18. package/dist/assets/{chunk-55IACEB6-DdzvO3HR.js → chunk-55IACEB6-Bj00HDqq.js} +1 -1
  19. package/dist/assets/{chunk-FMBD7UC4-R5o-nSiG.js → chunk-FMBD7UC4-C-lhB6hN.js} +1 -1
  20. package/dist/assets/{chunk-K7UQS3LO-DxaMrGgG.js → chunk-K7UQS3LO-B-pGTXPt.js} +1 -1
  21. package/dist/assets/{chunk-QN33PNHL-DqS9-FYm.js → chunk-QN33PNHL-DqUzGhvm.js} +1 -1
  22. package/dist/assets/{chunk-QZHKN3VN-BZ-TzajS.js → chunk-QZHKN3VN-TntJHfSk.js} +1 -1
  23. package/dist/assets/{chunk-TVAH2DTR-BsgP2dyv.js → chunk-TVAH2DTR-HUJb1psV.js} +1 -1
  24. package/dist/assets/{chunk-TZMSLE5B-D-h3ahXI.js → chunk-TZMSLE5B-BK3C__t3.js} +1 -1
  25. package/dist/assets/{circle-play-CQtRZ-rT.js → circle-play-DBLOv1Yu.js} +1 -1
  26. package/dist/assets/classDiagram-KNZD7YFC-BGmh9POF.js +1 -0
  27. package/dist/assets/classDiagram-v2-RKCZMP56-BGmh9POF.js +1 -0
  28. package/dist/assets/{clear-button-BY6Z_ViL.js → clear-button-BeoFbEKH.js} +1 -1
  29. package/dist/assets/clone-BFDSPAj3.js +1 -0
  30. package/dist/assets/command-palette-CXZiSv0I.js +1 -0
  31. package/dist/assets/common-C7oJcmCT.js +1 -0
  32. package/dist/assets/{compile-Ct_jzdKr.js → compile-7L0MwhyI.js} +1 -1
  33. package/dist/assets/cose-bilkent-S5V4N54A-BMkGLcVC.js +1 -0
  34. package/dist/assets/dagre-5GWH7T2D-BJtRienS.js +4 -0
  35. package/dist/assets/{data-grid-overlay-editor-BN_wulc3.js → data-grid-overlay-editor-DBkmGtNs.js} +1 -1
  36. package/dist/assets/datasources-panel-B7FbYLiy.js +1 -0
  37. package/dist/assets/{dependency-graph-panel-BOmSCZf7.js → dependency-graph-panel-DEdOxp2X.js} +4 -4
  38. package/dist/assets/diagram-N5W7TBWH-CmECY3nb.js +24 -0
  39. package/dist/assets/diagram-QEK2KX5R-DMOVSNKD.js +43 -0
  40. package/dist/assets/diagram-S2PKOQOG-BiJ96PNQ.js +24 -0
  41. package/dist/assets/{documentation-panel-BxjJO_Gw.js → documentation-panel-xULhaEv3.js} +1 -1
  42. package/dist/assets/edit-page-BrYda9VE.js +129 -0
  43. package/dist/assets/{ellipsis-vertical-UHbmjI2n.js → ellipsis-vertical-BBqXIlc2.js} +1 -1
  44. package/dist/assets/{empty-state-BIBXzY_0.js → empty-state-B3dA3G5P.js} +1 -1
  45. package/dist/assets/{erDiagram-AWTI2OKA-E84mAle_.js → erDiagram-AWTI2OKA-MP1DiFRo.js} +1 -1
  46. package/dist/assets/{error-panel-MEvQ6K7h.js → error-panel-Cc1sv-Ag.js} +1 -1
  47. package/dist/assets/file-explorer-panel-Bw59Kva1.js +1 -0
  48. package/dist/assets/{flowDiagram-PVAE7QVJ-DfbIRSAW.js → flowDiagram-PVAE7QVJ-BX7caPp7.js} +1 -1
  49. package/dist/assets/{ganttDiagram-OWAHRB6G-DR4HZ1z_.js → ganttDiagram-OWAHRB6G-B462g4Yf.js} +3 -3
  50. package/dist/assets/gitGraphDiagram-NY62KEGX-CGgvZ9-9.js +65 -0
  51. package/dist/assets/{glide-data-editor-nNmo1lPq.js → glide-data-editor-C0gUFZON.js} +4 -4
  52. package/dist/assets/graph-CHRVBzY5.js +1 -0
  53. package/dist/assets/{home-page-9eW6qida.js → home-page-Fb2osjys.js} +3 -3
  54. package/dist/assets/{index-DMomwMcN.js → index-BVgAenPd.js} +1 -1
  55. package/dist/assets/{index-B8llrTSo.js → index-BY93Ejhl.js} +1 -1
  56. package/dist/assets/{index-BFSnz7iM.js → index-C-8WADat.js} +1 -1
  57. package/dist/assets/{index-CPN7TRA1.js → index-C-GhZ7ti.js} +1 -1
  58. package/dist/assets/{index-DyLSuOH1.js → index-C1v_Z9et.js} +1 -1
  59. package/dist/assets/{index-VPWqq2Pg.js → index-C4Tn5NvJ.js} +1 -1
  60. package/dist/assets/{index-BAH034Ue.js → index-C77h_TXN.js} +1 -1
  61. package/dist/assets/{index-Dt9UWeWn.js → index-CQDrxQ0j.js} +1 -1
  62. package/dist/assets/{index-DWOaniGT.js → index-CWMgowgL.js} +1 -1
  63. package/dist/assets/{index-B1_GXGaP.js → index-Clbi_Yaq.js} +1 -1
  64. package/dist/assets/{index-B7yXbrLa.js → index-CpTPJo4k.js} +1 -1
  65. package/dist/assets/{index-CknhX2Vy.css → index-Cx0bsY1w.css} +1 -1
  66. package/dist/assets/{index-DqzMPAC8.js → index-D1vmG6DS.js} +2 -2
  67. package/dist/assets/{index-c6If577Q.js → index-D9UKkrr2.js} +1 -1
  68. package/dist/assets/{index-CB2pnVQG.js → index-DEQvTChO.js} +1 -1
  69. package/dist/assets/{index-OC46250R.js → index-DKEudB02.js} +205 -197
  70. package/dist/assets/{index-CSgxTUzD.js → index-DRMm6SNo.js} +1 -1
  71. package/dist/assets/{index-Bq516OmX.js → index-DoRmcrKM.js} +1 -1
  72. package/dist/assets/{index-DSU75csX.js → index-lYa_leQE.js} +1 -1
  73. package/dist/assets/{index-BLu5CX6z.js → index-vmICa5KN.js} +1 -1
  74. package/dist/assets/{index-uacyUula.js → index-z9bohSQJ.js} +1 -1
  75. package/dist/assets/infoDiagram-STP46IZ2-CVyrdLc8.js +2 -0
  76. package/dist/assets/isEmpty-DU_ogP_D.js +1 -0
  77. package/dist/assets/{journeyDiagram-BIP6EPQ6-BBiFyygf.js → journeyDiagram-BIP6EPQ6-C6EgLP_Q.js} +1 -1
  78. package/dist/assets/{kanban-definition-6OIFK2YF-DhgA6Nt6.js → kanban-definition-6OIFK2YF-BXzYO1yj.js} +4 -4
  79. package/dist/assets/layout-jihVw5-i.js +1 -0
  80. package/dist/assets/linear-C4blANlC.js +1 -0
  81. package/dist/assets/{links-CbvGxbsJ.js → links-D59GIweI.js} +3 -3
  82. package/dist/assets/{logs-panel-B9SmTZAW.js → logs-panel-D401qzZh.js} +1 -1
  83. package/dist/assets/markdown-renderer-Cd9eYyaL.js +263 -0
  84. package/dist/assets/{agent-panel-DpQ6muj-.css → markdown-renderer-ClyzDMmG.css} +1 -1
  85. package/dist/assets/mermaid-BEVuRz_O.js +1 -0
  86. package/dist/assets/{mermaid.core-4nVOEVX3.js → mermaid.core-CaSnaLH0.js} +41 -41
  87. package/dist/assets/min-DUMu_zeK.js +1 -0
  88. package/dist/assets/{mindmap-definition-Q6HEUPPD-CVLQNn1q.js → mindmap-definition-Q6HEUPPD-BXUM5MT2.js} +2 -2
  89. package/dist/assets/{number-overlay-editor-CzRzXLcd.js → number-overlay-editor-4uWXGlPG.js} +1 -1
  90. package/dist/assets/{outline-panel-uvsS-YEQ.js → outline-panel-DIzkvm2I.js} +1 -1
  91. package/dist/assets/packages-panel-CJL0MVlj.js +1 -0
  92. package/dist/assets/{pieDiagram-ADFJNKIX-C5IQ5DBZ.js → pieDiagram-ADFJNKIX-Dxt5PVNo.js} +3 -3
  93. package/dist/assets/{quadrantDiagram-LMRXKWRM-CFXFnQxx.js → quadrantDiagram-LMRXKWRM-D4pUaA31.js} +1 -1
  94. package/dist/assets/{react-plotly-mzdv02_Y.js → react-plotly-cJZ0VWBq.js} +1 -1
  95. package/dist/assets/{requirementDiagram-4UW4RH46-D9bPC89T.js → requirementDiagram-4UW4RH46-DVRTjgas.js} +1 -1
  96. package/dist/assets/run-page-BUEnMC9w.js +1 -0
  97. package/dist/assets/sankeyDiagram-GR3RE2ED-CVFnD9C-.js +10 -0
  98. package/dist/assets/scratchpad-panel-BIgRENkI.js +1 -0
  99. package/dist/assets/secrets-panel-xY5-V_BD.js +1 -0
  100. package/dist/assets/{sequenceDiagram-C3RYC4MD-6N7_hY4k.js → sequenceDiagram-C3RYC4MD-_lY4ZN_S.js} +4 -4
  101. package/dist/assets/{slides-component-EcjC8sDK.js → slides-component-Xjymwj7X.js} +1 -1
  102. package/dist/assets/snippets-panel-CTPYW41n.js +1 -0
  103. package/dist/assets/sortBy-BNZKwiq_.js +1 -0
  104. package/dist/assets/state-C4NiC9tO.js +1 -0
  105. package/dist/assets/stateDiagram-KXAO66HF-Da0JQWCn.js +1 -0
  106. package/dist/assets/stateDiagram-v2-UMBNRL4Z-D5lYZOOt.js +1 -0
  107. package/dist/assets/storage-CMdLzB_c.js +26 -0
  108. package/dist/assets/terminal-BPwTkXae.js +10 -0
  109. package/dist/assets/time-Dv5_Ouz_.js +1 -0
  110. package/dist/assets/{timeline-definition-XQNQX7LJ-BEaynAiY.js → timeline-definition-XQNQX7LJ-Dxh5Zu2e.js} +1 -1
  111. package/dist/assets/tracing-BCIurUfa.js +2 -0
  112. package/dist/assets/{tracing-panel-BmuHLPrY.js → tracing-panel-DAzrzNmm.js} +2 -2
  113. package/dist/assets/{trash-UBqfK4mR.js → trash-Dc6DSjz_.js} +1 -1
  114. package/dist/assets/{tree-XiEycetl.js → tree-jheoerAX.js} +1 -1
  115. package/dist/assets/{treemap-75Q7IDZK-CnuVFbBG.js → treemap-75Q7IDZK-IgpxeGaf.js} +21 -21
  116. package/dist/assets/{ts-tags-CloPe9IY.js → ts-tags-DxCDHihD.js} +1 -1
  117. package/dist/assets/variable-panel-DYAiLBmF.js +1 -0
  118. package/dist/assets/{vega-component-DsTH4tuX.js → vega-component-BpfpiPKI.js} +1 -1
  119. package/dist/assets/{xychartDiagram-6GGTOJPD-Dcz3O-A3.js → xychartDiagram-6GGTOJPD-CmNigJ31.js} +1 -1
  120. package/dist/index.html +2 -2
  121. package/package.json +8 -4
  122. package/src/__tests__/mocks.ts +43 -0
  123. package/src/components/app-config/user-config-form.tsx +32 -0
  124. package/src/components/chat/acp/__tests__/__snapshots__/prompt.test.ts.snap +55 -23
  125. package/src/components/chat/acp/__tests__/context-utils.test.ts +222 -0
  126. package/src/components/chat/acp/__tests__/prompt.test.ts +1 -1
  127. package/src/components/chat/acp/__tests__/state.test.ts +2 -6
  128. package/src/components/chat/acp/agent-docs.tsx +33 -6
  129. package/src/components/chat/acp/agent-panel.css +0 -18
  130. package/src/components/chat/acp/agent-panel.tsx +397 -72
  131. package/src/components/chat/acp/agent-selector.tsx +7 -1
  132. package/src/components/chat/acp/blocks.tsx +40 -10
  133. package/src/components/chat/acp/common.tsx +10 -2
  134. package/src/components/chat/acp/context-utils.ts +127 -0
  135. package/src/components/chat/acp/prompt.ts +34 -10
  136. package/src/components/chat/acp/state.ts +1 -1
  137. package/src/components/chat/acp/types.ts +8 -0
  138. package/src/components/chat/chat-panel.tsx +23 -88
  139. package/src/components/chat/chat-utils.ts +127 -1
  140. package/src/components/chat/markdown-renderer.css +39 -0
  141. package/src/components/chat/markdown-renderer.tsx +7 -38
  142. package/src/components/chat/tool-call-accordion.tsx +113 -23
  143. package/src/components/editor/Cell.tsx +6 -0
  144. package/src/components/editor/actions/name-cell-input.tsx +6 -1
  145. package/src/components/editor/actions/useCellActionButton.tsx +3 -1
  146. package/src/components/editor/ai/__tests__/completion-utils.test.ts +178 -1
  147. package/src/components/editor/ai/add-cell-with-ai.tsx +68 -66
  148. package/src/components/editor/ai/ai-completion-editor.tsx +29 -26
  149. package/src/components/editor/ai/completion-handlers.tsx +44 -6
  150. package/src/components/editor/ai/completion-utils.ts +92 -0
  151. package/src/components/editor/ai/transport/chat-transport.tsx +36 -0
  152. package/src/components/editor/cell/StagedAICell.tsx +51 -0
  153. package/src/components/editor/cell/cell-actions.tsx +2 -1
  154. package/src/components/terminal/__tests__/state.test.ts +207 -0
  155. package/src/components/terminal/hooks.ts +41 -0
  156. package/src/components/terminal/state.ts +75 -0
  157. package/src/components/terminal/terminal.tsx +334 -13
  158. package/src/components/terminal/theme.tsx +56 -0
  159. package/src/core/ai/__tests__/staged-cells.test.ts +356 -0
  160. package/src/core/ai/staged-cells.ts +208 -0
  161. package/src/core/cells/cells.ts +1 -1
  162. package/src/core/codemirror/lsp/federated-lsp.ts +1 -1
  163. package/src/core/islands/main.ts +2 -2
  164. package/src/core/kernel/messages.ts +8 -12
  165. package/src/core/saving/__tests__/filename.test.ts +37 -0
  166. package/src/core/static/__tests__/download-html.test.ts +43 -1
  167. package/src/core/websocket/useMarimoWebSocket.tsx +2 -2
  168. package/src/css/app/Cell.css +11 -0
  169. package/src/plugins/core/RenderHTML.tsx +36 -2
  170. package/src/plugins/core/__test__/RenderHTML.test.ts +72 -0
  171. package/src/plugins/core/registerReactComponent.tsx +28 -0
  172. package/src/plugins/impl/FileBrowserPlugin.tsx +8 -2
  173. package/src/stories/cell.stories.tsx +1 -1
  174. package/src/stories/layout/vertical/one-column.stories.tsx +1 -1
  175. package/src/utils/__tests__/cell-urls.test.ts +29 -0
  176. package/src/utils/__tests__/filenames.test.ts +18 -0
  177. package/src/utils/__tests__/path.test.ts +38 -0
  178. package/src/utils/__tests__/urls.test.ts +56 -1
  179. package/src/utils/errors.ts +9 -0
  180. package/dist/assets/_baseEach-C1FLm7WW.js +0 -1
  181. package/dist/assets/_baseMap-DBVArUYD.js +0 -1
  182. package/dist/assets/_baseUniq-Dk7ZPJ3N.js +0 -1
  183. package/dist/assets/_createAggregator-Bn38fDd3.js +0 -1
  184. package/dist/assets/agent-panel-COUYnuIK.js +0 -475
  185. package/dist/assets/architectureDiagram-W76B3OCA-DBzWQKKu.js +0 -36
  186. package/dist/assets/channel-CjhbjOv4.js +0 -1
  187. package/dist/assets/chat-panel-BPXKoTnZ.js +0 -7
  188. package/dist/assets/chat-panel-Brrs_eeH.css +0 -1
  189. package/dist/assets/classDiagram-KNZD7YFC-DHs5cFzy.js +0 -1
  190. package/dist/assets/classDiagram-v2-RKCZMP56-DHs5cFzy.js +0 -1
  191. package/dist/assets/clone-DM1YNjEn.js +0 -1
  192. package/dist/assets/command-palette-S0bzQp7v.js +0 -1
  193. package/dist/assets/common-B8U9k2Ly.js +0 -1
  194. package/dist/assets/cose-bilkent-S5V4N54A-wz1Sfx7j.js +0 -1
  195. package/dist/assets/dagre-5GWH7T2D-BfpcVBgq.js +0 -4
  196. package/dist/assets/datasources-panel-DfuURLJw.js +0 -1
  197. package/dist/assets/diagram-N5W7TBWH-Bf0oqqQh.js +0 -24
  198. package/dist/assets/diagram-QEK2KX5R-ZTc3qikh.js +0 -43
  199. package/dist/assets/diagram-S2PKOQOG-tLScBy7Z.js +0 -24
  200. package/dist/assets/edit-page-DJ8kJZ9w.js +0 -129
  201. package/dist/assets/file-explorer-panel-CzNUJ63G.js +0 -1
  202. package/dist/assets/gitGraphDiagram-NY62KEGX-C1t6QtVa.js +0 -65
  203. package/dist/assets/graph-CssCVWIq.js +0 -1
  204. package/dist/assets/index-DcCIe7np.js +0 -28
  205. package/dist/assets/infoDiagram-STP46IZ2-CwiAoz9f.js +0 -2
  206. package/dist/assets/layout-DpQrxGW-.js +0 -1
  207. package/dist/assets/linear-NsreOeBF.js +0 -1
  208. package/dist/assets/mermaid-DSt0r6IQ.js +0 -1
  209. package/dist/assets/min-D259kI3t.js +0 -1
  210. package/dist/assets/packages-panel-xMz9W2hW.js +0 -1
  211. package/dist/assets/run-page-Bb68qdhQ.js +0 -1
  212. package/dist/assets/sankeyDiagram-GR3RE2ED-BSJOau8E.js +0 -10
  213. package/dist/assets/scratchpad-panel-BF4BO-U4.js +0 -1
  214. package/dist/assets/secrets-panel-CdIX44dQ.js +0 -1
  215. package/dist/assets/snippets-panel-Dco9h0rb.js +0 -1
  216. package/dist/assets/sortBy-aLGA-PGK.js +0 -1
  217. package/dist/assets/stateDiagram-KXAO66HF-Bd68WT3b.js +0 -1
  218. package/dist/assets/stateDiagram-v2-UMBNRL4Z-BXz_GSwb.js +0 -1
  219. package/dist/assets/storage-CGlP4lCF.js +0 -26
  220. package/dist/assets/terminal-CxkHubcu.js +0 -9
  221. package/dist/assets/time-D2nr1UgQ.js +0 -1
  222. package/dist/assets/tracing-kTqHxa7q.js +0 -2
  223. package/dist/assets/variable-panel-noTnH-AQ.js +0 -1
@@ -1,475 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./angular-html-BZhSV2-l.js","./html-ReiWYoHo.js","./javascript-CY0YvwoL.js","./css-l46fsARh.js","./angular-ts-DRQ-j7PL.js","./scss-CHxzYwli.js","./apl-BnBkWLuz.js","./xml-BsgRw6d1.js","./java-DtRXFtDl.js","./json-LWN7Ml79.js","./astro-CXYfh229.js","./typescript-C6YI4KwS.js","./postcss-CeUBPB2S.js","./tsx-DYwE5ssU.js","./blade-CkGRa-l8.js","./html-derivative-BEFkAAPd.js","./sql-BhJCBb_s.js","./bsl-DGicdwC0.js","./sdbl-BpucmfEo.js","./cairo-Dz8fl918.js","./python-DlV7vnVD.js","./cobol-Dt3m7Jkx.js","./coffee-DgxxYT5L.js","./cpp-BmKY377x.js","./regexp-CpyjTnFF.js","./glsl-BDbjGBhJ.js","./c-BmJt9k-y.js","./crystal-DB6V90z1.js","./shellscript-B8OHlvmy.js","./edge-Brl-y200.js","./elixir-CGzfkNtR.js","./elm-DmpuOW2E.js","./erb-BNAqOH5i.js","./ruby-DJftxM78.js","./haml-DiuhmbKg.js","./graphql-DMns_A3G.js","./jsx-g2NrEQII.js","./lua-B09NiSMa.js","./yaml-c2-Vhxho.js","./erlang-DAw79KxH.js","./markdown-DY93LJPj.js","./fortran-fixed-form-D_2otJTs.js","./fortran-free-form-Ix_0F1Zz.js","./fsharp-DmSnwM-W.js","./gdresource-BLuZCTp3.js","./gdshader-BC7WJXp9.js","./gdscript-fffAh1pn.js","./git-commit-Bptnmh-c.js","./diff-Beq1YlA8.js","./git-rebase-CqNhyBhE.js","./glimmer-js-CamsSOgS.js","./glimmer-ts-DpQMos9P.js","./hack-CXH7pT2m.js","./handlebars-PuluTGUb.js","./http-BPFbEDC3.js","./hxml-DB3_nACV.js","./haxe-D-PmAGDa.js","./jinja-CXJbPSuL.js","./jison-iRP-Iv-P.js","./julia-BabrhEml.js","./r-C1kzXVmM.js","./latex-CCwiU5tQ.js","./tex-BGsfIjRo.js","./liquid-QTP3a8yd.js","./marko-CgCapwG0.js","./less-DKKxO4Pm.js","./mdc-CVidKc4b.js","./nginx-CtwUG8yW.js","./nim-BCqJOqd2.js","./perl-Da10OPbb.js","./php-hSYFjEJr.js","./pug-DYUvS0f2.js","./qml-DiX3J200.js","./razor-7Qmv-3mF.js","./csharp-yFVQ185C.js","./rst-DU5WA_Li.js","./cmake-BYiqpiH1.js","./sas-BBCK0tAG.js","./shaderlab-DNyPh2Q6.js","./hlsl-B-PjNM4a.js","./shellsession-OATBsyRD.js","./soy-BjzVbqVk.js","./sparql-CLNNOQQI.js","./turtle-BVy4HXn4.js","./stata-G4GYNNPE.js","./svelte-Dg-n8Id4.js","./templ-C0tOEwaA.js","./go-BR7YH85S.js","./ts-tags-CloPe9IY.js","./twig-D8xgA4Ji.js","./vue-ChwqA4lT.js","./vue-html-DP_EF96N.js","./vue-vine-K4R7Z1Ei.js","./stylus-BeJftkpb.js","./xsl-DCNnPbrB.js","./mermaid.core-4nVOEVX3.js","./index-OC46250R.js","./index-CknhX2Vy.css","./transform-D9VCJYws.js","./timer-Bqd5yn_a.js","./step-BwsUM5iJ.js"])))=>i.map(i=>d[i]);
2
- var Kh=Object.defineProperty;var ef=Object.getPrototypeOf;var tf=Reflect.get;var xl=Z=>{throw TypeError(Z)};var rf=(Z,Y,re)=>Y in Z?Kh(Z,Y,{enumerable:!0,configurable:!0,writable:!0,value:re}):Z[Y]=re;var v=(Z,Y,re)=>rf(Z,typeof Y!="symbol"?Y+"":Y,re),Ps=(Z,Y,re)=>Y.has(Z)||xl("Cannot "+re);var J=(Z,Y,re)=>(Ps(Z,Y,"read from private field"),re?re.call(Z):Y.get(Z)),we=(Z,Y,re)=>Y.has(Z)?xl("Cannot add the same private member more than once"):Y instanceof WeakSet?Y.add(Z):Y.set(Z,re),fe=(Z,Y,re,Ct)=>(Ps(Z,Y,"write to private field"),Ct?Ct.call(Z,re):Y.set(Z,re),re),Re=(Z,Y,re)=>(Ps(Z,Y,"access private method"),re);var wl=(Z,Y,re,Ct)=>({set _(hn){fe(Z,Y,hn,re)},get _(){return J(Z,Y,Ct)}}),kl=(Z,Y,re)=>tf(ef(Z),re,Y);import{c as lt,f_ as F,f$ as ae,g0 as j,g1 as M,g2 as qt,g3 as ke,g4 as Wt,g5 as ct,g6 as Rs,g7 as Ht,g8 as nf,d as Qt,r as R,j as g,g9 as sf,cG as of,a9 as af,a0 as b,ga as lf,aU as Ls,_ as vl,$ as El,a as H,gb as js,aO as Ve,bc as Sl,bV as Os,gc as cf,dX as uf,gd as pf,I as Ie,bx as Cl,ad as df,ae as mf,ac as hf,eL as ff,ge as gf,gf as _f,M as bf,gg as yf,cS as xf,P as wf,dY as kf,dS as vf,dU as Ef,dV as Sf,dW as Cf,aj as Af,cx as If,gh as Nf,gi as $s,C as Tf,cd as un,am as Al,cA as Le,cU as Pf,au as Rf,cV as Lf,eV as jf,cY as Of,cX as $f,al as Df,L as Mf,a$ as Il,gj as Nl,S as Vf,dg as Gf,bi as zf,dT as Ds,cD as Tl,U as Ff,ed as Bf,__tla as Uf}from"./index-OC46250R.js";import{u as qf,r as Wf,a as Hf,V as Qf,b as Zf,v as Xf,t as Jf,c as Ms,f as Pl,p as Rl,e as Ll,n as jl,h as Ol,s as Vs,g as Yf,i as Kf,S as eg,o as br,l as tg,j as pn,m as St,w as Gs,k as rg,q as ng,x as $l,d as sg}from"./index-DcCIe7np.js";import Dl from"./katex-LV4FpwlL.js";import{R as Ml,__tla as og}from"./edit-page-DJ8kJZ9w.js";import{d as Vl}from"./links-CbvGxbsJ.js";import{P as Gl}from"./empty-state-BIBXzY_0.js";import{__tla as ag}from"./storage-CGlP4lCF.js";import"./index-Dt9UWeWn.js";import"./index-BAH034Ue.js";import"./index-DqzMPAC8.js";import"./index-DSU75csX.js";import"./index-CSgxTUzD.js";import"./index-BLu5CX6z.js";import"./index-B8llrTSo.js";import"./index-CPN7TRA1.js";import"./index-BFSnz7iM.js";import"./index-Bq516OmX.js";import"./index-CB2pnVQG.js";import"./index-DWOaniGT.js";import"./index-c6If577Q.js";import"./apl-CXdQSnD-.js";import"./asciiarmor-D5V0T9Cu.js";import"./asn1-DWPaVWf6.js";import"./brainfuck-CtZaYBKt.js";import"./cobol-stawOqaz.js";import"./clike-BgBwzOhw.js";import"./clojure-DiuoqK-z.js";import"./css-ZjFoif2m.js";import"./cmake-DXn5xaP-.js";import"./coffeescript-BTDxI-eT.js";import"./commonlisp-vq6DHwts.js";import"./cypher-gJDei3ni.js";import"./python-DD-Q2bae.js";import"./crystal-CRzZ78HM.js";import"./d-BShv7fp-.js";import"./diff-UJJ5BM9S.js";import"./dtd-DI9Herc-.js";import"./dylan-DkEP81N9.js";import"./ecl-DPFc0Uaf.js";import"./eiffel-DR5c0IrL.js";import"./elm-DompmV0j.js";import"./erlang-BuqgqA5h.js";import"./factor-CFXhaUWb.js";import"./simple-mode-C3vEBAcb.js";import"./forth-POgR1ypr.js";import"./fortran-DL7KluxX.js";import"./mllike-3c2dg9RT.js";import"./gas-bV0CklSb.js";import"./gherkin-B6X1vGSW.js";import"./groovy-DnIzCrpZ.js";import"./haskell-CLQs6EAM.js";import"./haxe-D25e-2l-.js";import"./idl-pcmmZuaN.js";import"./javascript-BpzJj0-u.js";import"./jinja2-DhgKlfW7.js";import"./julia-DjdwvFuI.js";import"./livescript-HO6ttBFx.js";import"./lua-8DXOpKDz.js";import"./mirc-DkvFAiy5.js";import"./mathematica-IIbmv7SK.js";import"./modelica-DSrSSXCg.js";import"./mumps-zvxmGV4l.js";import"./mbox-z_N2Mo3d.js";import"./nsis-BvKfQ9lQ.js";import"./ntriples-BSwWqoLa.js";import"./octave-C4hdQ5Hf.js";import"./oz-qQq7irPq.js";import"./pascal-CafrKXZF.js";import"./perl-tdMlh9QA.js";import"./pig-CwGJVRC4.js";import"./powershell-D1ly3AHC.js";import"./properties-_nPj978X.js";import"./protobuf-B4y9do6W.js";import"./pug-BTvK5tSS.js";import"./puppet-Bc-yJKzi.js";import"./q-B0kTJ4cI.js";import"./r-BA4EbLKE.js";import"./rpm-DI_rRufH.js";import"./ruby-CR-u2WLS.js";import"./sas-Bqaci40L.js";import"./scheme-qjP0V5Ag.js";import"./shell-BLav31RL.js";import"./sieve-r025o_jW.js";import"./smalltalk-C7J3IyEP.js";import"./sparql-BRLJFz69.js";import"./stylus-Bdo_Aemu.js";import"./swift-B_XXVlXX.js";import"./verilog-B4LBqg_1.js";import"./tcl-B2fODqDH.js";import"./textile-BuVhTOzU.js";import"./toml-wcPdHu67.js";import"./troff-Ce85hlLp.js";import"./ttcn-BxnYHtq8.js";import"./ttcn-cfg-CKJxb-l2.js";import"./turtle-BkSuIpt-.js";import"./webidl-CGwyPRYs.js";import"./vb-BHgjm0DN.js";import"./vbscript-Dawdd5GZ.js";import"./velocity-BdD_26Jv.js";import"./vhdl-CWWH2SUo.js";import"./xquery-CVDBqZPY.js";import"./yacas-I8QjZlxf.js";import"./z80-D8p3gKXp.js";import"./mscgen-B2igx18G.js";import"./index-DMomwMcN.js";import"./trash-UBqfK4mR.js";import"./_createAggregator-Bn38fDd3.js";import"./_baseEach-C1FLm7WW.js";import{__tla as ig}from"./loro_wasm_bg-C1ks32Vm.js";let zl,lg=Promise.all([(()=>{try{return Uf}catch{}})(),(()=>{try{return og}catch{}})(),(()=>{try{return ag}catch{}})(),(()=>{try{return ig}catch{}})()]).then(async()=>{var $e,zt,ln,mr,hr,Ft,fr,ye,Fl,Bl,zs,Ul,dn,Ze,Ce,ot,Xe,yt,at,xt,gr,Bs,it,Ns;const Z=lt("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]),Y=lt("circle-stop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]]),re=lt("file-audio-2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v2",key:"17k7jt"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"3",cy:"17",r:"1",key:"vo6nti"}],["path",{d:"M2 17v-3a4 4 0 0 1 8 0v3",key:"1ggdre"}],["circle",{cx:"9",cy:"17",r:"1",key:"bc1fq4"}]]),Ct=lt("plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]),hn=lt("shield-check",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),Hl=lt("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]),Zt=lt("wifi-off",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),fn=lt("wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]),Ws={}.hasOwnProperty,Ql="authenticate",Zl="initialize",Xl="session/cancel",Jl="session/load",Yl="session/new",Kl="session/prompt",ec="fs/read_text_file",tc="fs/write_text_file",rc="session/request_permission",nc="session/update",Hs=F({content:j(),path:j(),sessionId:j()}),Qs=F({limit:ct().optional().nullable(),line:ct().optional().nullable(),path:j(),sessionId:j()}),sc=ae([M("assistant"),M("user")]),oc=F({mimeType:j().optional().nullable(),text:j(),uri:j()}),ac=F({blob:j(),mimeType:j().optional().nullable(),uri:j()}),Zs=ae([M("read"),M("edit"),M("delete"),M("move"),M("search"),M("execute"),M("think"),M("fetch"),M("other")]),Xs=ae([M("pending"),M("in_progress"),M("completed"),M("failed")]),ic=Rs(),lc=F({content:j()}),cc=F({outcome:ae([F({outcome:M("cancelled")}),F({optionId:j(),outcome:M("selected")})])}),uc=F({sessionId:j()}),pc=F({methodId:j()}),je=F({audience:ke(sc).optional().nullable(),lastModified:j().optional().nullable(),priority:ct().optional().nullable()}),Js=ae([oc,ac]),dc=Rs(),mc=F({sessionId:j()}),hc=Rs(),fc=F({stopReason:ae([M("end_turn"),M("max_tokens"),M("max_turn_requests"),M("refusal"),M("cancelled")])}),gc=F({kind:ae([M("allow_once"),M("allow_always"),M("reject_once"),M("reject_always")]),name:j(),optionId:j()}),gn=ae([F({content:ae([F({annotations:je.optional().nullable(),text:j(),type:M("text")}),F({annotations:je.optional().nullable(),data:j(),mimeType:j(),type:M("image"),uri:j().optional().nullable()}),F({annotations:je.optional().nullable(),data:j(),mimeType:j(),type:M("audio")}),F({annotations:je.optional().nullable(),description:j().optional().nullable(),mimeType:j().optional().nullable(),name:j(),size:ct().optional().nullable(),title:j().optional().nullable(),type:M("resource_link"),uri:j()}),F({annotations:je.optional().nullable(),resource:Js,type:M("resource")})]),type:M("content")}),F({newText:j(),oldText:j().optional().nullable(),path:j(),type:M("diff")})]),_n=F({line:ct().optional().nullable(),path:j()}),_c=F({readTextFile:Ht().optional(),writeTextFile:Ht().optional()}),bc=F({name:j(),value:j()}),Ys=F({args:ke(j()),command:j(),env:ke(bc),name:j()}),yr=ae([F({annotations:je.optional().nullable(),text:j(),type:M("text")}),F({annotations:je.optional().nullable(),data:j(),mimeType:j(),type:M("image"),uri:j().optional().nullable()}),F({annotations:je.optional().nullable(),data:j(),mimeType:j(),type:M("audio")}),F({annotations:je.optional().nullable(),description:j().optional().nullable(),mimeType:j().optional().nullable(),name:j(),size:ct().optional().nullable(),title:j().optional().nullable(),type:M("resource_link"),uri:j()}),F({annotations:je.optional().nullable(),resource:Js,type:M("resource")})]),yc=F({description:j().optional().nullable(),id:j(),name:j()}),xc=F({audio:Ht().optional(),embeddedContext:Ht().optional(),image:Ht().optional()}),wc=F({content:j(),priority:ae([M("high"),M("medium"),M("low")]),status:ae([M("pending"),M("in_progress"),M("completed")])}),kc=ae([ic,lc,cc]),vc=uc,Ec=F({cwd:j(),mcpServers:ke(Ys)}),Sc=F({cwd:j(),mcpServers:ke(Ys),sessionId:j()}),Cc=F({prompt:ke(yr),sessionId:j()}),Ks=F({sessionId:j(),update:ae([F({content:yr,sessionUpdate:M("user_message_chunk")}),F({content:yr,sessionUpdate:M("agent_message_chunk")}),F({content:yr,sessionUpdate:M("agent_thought_chunk")}),F({content:ke(gn).optional(),kind:ae([M("read"),M("edit"),M("delete"),M("move"),M("search"),M("execute"),M("think"),M("fetch"),M("other")]).optional(),locations:ke(_n).optional(),rawInput:qt(Wt()).optional(),rawOutput:qt(Wt()).optional(),sessionUpdate:M("tool_call"),status:ae([M("pending"),M("in_progress"),M("completed"),M("failed")]).optional(),title:j(),toolCallId:j()}),F({content:ke(gn).optional().nullable(),kind:Zs.optional().nullable(),locations:ke(_n).optional().nullable(),rawInput:qt(Wt()).optional(),rawOutput:qt(Wt()).optional(),sessionUpdate:M("tool_call_update"),status:Xs.optional().nullable(),title:j().optional().nullable(),toolCallId:j()}),F({entries:ke(wc),sessionUpdate:M("plan")})])}),Ac=F({content:ke(gn).optional().nullable(),kind:Zs.optional().nullable(),locations:ke(_n).optional().nullable(),rawInput:qt(Wt()).optional(),rawOutput:qt(Wt()).optional(),status:Xs.optional().nullable(),title:j().optional().nullable(),toolCallId:j()}),Ic=F({fs:_c.optional()}),Nc=F({loadSession:Ht().optional(),promptCapabilities:xc.optional()}),Tc=Ks,eo=F({options:ke(gc),sessionId:j(),toolCall:Ac}),Pc=F({clientCapabilities:Ic.optional(),protocolVersion:ct()}),Rc=F({agentCapabilities:Nc.optional(),authMethods:ke(yc).optional(),protocolVersion:ct()}),Lc=ae([Hs,Qs,eo]),jc=ae([Pc,pc,Ec,Sc,Cc]),Oc=ae([Rc,dc,mc,hc,fc]);ae([Lc,kc,vc,jc,Oc,Tc]);class $c{constructor(e,r,n){we(this,$e);fe(this,$e,new Dc(async(s,o)=>{const a=e(this);switch(s){case tc:{const i=Hs.parse(o);return a.writeTextFile(i)}case ec:{const i=Qs.parse(o);return a.readTextFile(i)}case rc:{const i=eo.parse(o);return a.requestPermission(i)}case nc:{const i=Ks.parse(o);return a.sessionUpdate(i)}default:throw Te.methodNotFound(s)}},r,n))}async initialize(e){return await J(this,$e).sendRequest(Zl,e)}async newSession(e){return await J(this,$e).sendRequest(Yl,e)}async loadSession(e){return await J(this,$e).sendRequest(Jl,e)}async authenticate(e){return await J(this,$e).sendRequest(Ql,e)}async prompt(e){return await J(this,$e).sendRequest(Kl,e)}async cancel(e){return await J(this,$e).sendNotification(Xl,e)}}$e=new WeakMap;class Dc{constructor(e,r,n){we(this,ye);we(this,zt,new Map);we(this,ln,0);we(this,mr);we(this,hr);we(this,Ft,Promise.resolve());we(this,fr);fe(this,mr,e),fe(this,hr,r),fe(this,fr,new TextEncoder),Re(this,ye,Fl).call(this,n)}async sendRequest(e,r){const n=wl(this,ln)._++,s=new Promise((o,a)=>{J(this,zt).set(n,{resolve:o,reject:a})});return await Re(this,ye,dn).call(this,{jsonrpc:"2.0",id:n,method:e,params:r}),s}async sendNotification(e,r){await Re(this,ye,dn).call(this,{jsonrpc:"2.0",method:e,params:r})}}zt=new WeakMap,ln=new WeakMap,mr=new WeakMap,hr=new WeakMap,Ft=new WeakMap,fr=new WeakMap,ye=new WeakSet,Fl=async function(e){let r="";const n=new TextDecoder;for await(const s of e){r+=n.decode(s,{stream:!0});const o=r.split(`
3
- `);r=o.pop()||"";for(const a of o){const i=a.trim();if(i){const l=JSON.parse(i);Re(this,ye,Bl).call(this,l)}}}},Bl=async function(e){if("method"in e&&"id"in e){const r=await Re(this,ye,zs).call(this,e.method,e.params);await Re(this,ye,dn).call(this,{jsonrpc:"2.0",id:e.id,...r})}else"method"in e?await Re(this,ye,zs).call(this,e.method,e.params):"id"in e&&Re(this,ye,Ul).call(this,e)},zs=async function(e,r){try{return{result:await J(this,mr).call(this,e,r)??null}}catch(n){if(n instanceof Te)return n.toResult();if(n instanceof nf)return Te.invalidParams(JSON.stringify(n.format(),void 0,2)).toResult();let s;return(n instanceof Error||typeof n=="object"&&n!=null&&"message"in n&&typeof n.message=="string")&&(s=n.message),Te.internalError(s).toResult()}},Ul=function(e){const r=J(this,zt).get(e.id);r&&("result"in e?r.resolve(e.result):"error"in e&&r.reject(e.error),J(this,zt).delete(e.id))},dn=async function(e){const r=JSON.stringify(e)+`
4
- `;return fe(this,Ft,J(this,Ft).then(async()=>{const n=J(this,hr).getWriter();try{await n.write(J(this,fr).encode(r))}finally{n.releaseLock()}}).catch(n=>{console.error("ACP write error:",n)})),J(this,Ft)};class Te extends Error{constructor(r,n,s){super(n);v(this,"code");v(this,"data");this.code=r,this.name="RequestError",s&&(this.data={details:s})}static parseError(r){return new Te(-32700,"Parse error",r)}static invalidRequest(r){return new Te(-32600,"Invalid request",r)}static methodNotFound(r){return new Te(-32601,"Method not found",r)}static invalidParams(r){return new Te(-32602,"Invalid params",r)}static internalError(r){return new Te(-32603,"Internal error",r)}static authRequired(r){return new Te(-32e3,"Authentication required",r)}toResult(){return{error:{code:this.code,message:this.message,data:this.data}}}}class Mc{constructor(){v(this,"promise");v(this,"resolve");v(this,"reject");this.promise=new Promise((e,r)=>{this.resolve=e,this.reject=r})}}class Vc{constructor(e,r){v(this,"agent");v(this,"options");v(this,"pendingPermissions",new Map);this.agent=e,this.options=r}async sessionUpdate(e){this.options.onSessionNotification(e)}async writeTextFile(e){if(this.options.writeTextFile)return this.options.writeTextFile(e);throw new Error("Write text file handler not implemented")}async readTextFile(e){if(this.options.readTextFile)return this.options.readTextFile(e);throw new Error("Read text file handler not implemented")}async requestPermission(e){const r=`${Date.now()}-${Math.random()}`,n=new Mc;return this.pendingPermissions.set(r,n),this.options.onRequestPermission({...e,id:r}),n.promise}resolvePermission(e,r){const n=this.pendingPermissions.get(e);n&&(this.pendingPermissions.delete(e),n.resolve(r))}rejectPermission(e,r){const n=this.pendingPermissions.get(e);n&&(this.pendingPermissions.delete(e),n.reject(r))}}class Gc{constructor(e,r){v(this,"agent");v(this,"callbacks");this.agent=e,this.callbacks=r}async initialize(e){var r,n;return(n=(r=this.callbacks).on_initialize_start)==null||n.call(r,e),this.agent.initialize(e).then(s=>{var o,a;return(a=(o=this.callbacks).on_initialize_response)==null||a.call(o,s,e),s})}async newSession(e){var r,n;return(n=(r=this.callbacks).on_newSession_start)==null||n.call(r,e),this.agent.newSession(e).then(s=>{var o,a;return(a=(o=this.callbacks).on_newSession_response)==null||a.call(o,s,e),s})}async loadSession(e){var r,n;if((n=(r=this.callbacks).on_loadSession_start)==null||n.call(r,e),this.agent.loadSession)return this.agent.loadSession(e).then(()=>{var s,o;(o=(s=this.callbacks).on_loadSession_response)==null||o.call(s,void 0,e)});throw new Error("Agent does not support loadSession capability")}async authenticate(e){var r,n;return(n=(r=this.callbacks).on_authenticate_start)==null||n.call(r,e),this.agent.authenticate(e).then(()=>{var s,o;(o=(s=this.callbacks).on_authenticate_response)==null||o.call(s,void 0,e)})}async prompt(e){var r,n;return(n=(r=this.callbacks).on_prompt_start)==null||n.call(r,e),this.agent.prompt(e).then(s=>{var o,a;return(a=(o=this.callbacks).on_prompt_response)==null||a.call(o,s,e),s})}async cancel(e){var r,n;return(n=(r=this.callbacks).on_cancel_start)==null||n.call(r,e),this.agent.cancel(e).then(()=>{var s,o;(o=(s=this.callbacks).on_cancel_response)==null||o.call(s,void 0,e)})}}const zc=globalThis.ReadableStream,Fc=globalThis.WritableStream;globalThis.ReadableStream!==void 0&&globalThis.WritableStream!==void 0||console.warn("Streams API not supported in this browser. Consider using a polyfill.");class Bc{constructor(e){v(this,"managers",new Map);v(this,"options");v(this,"currentUrl",null);this.options=e}async connect(e){this.currentUrl=e;let r=this.managers.get(e);if(r){if(r.getConnectionState()==="connected"){const n=r.getStreams();if(n)return n}}else r=new Uc({url:e,onConnectionStateChange:n=>this.options.onConnectionStateChange(n,e),onError:n=>this.options.onError(n,e),reconnectAttempts:this.options.reconnectAttempts,reconnectDelay:this.options.reconnectDelay}),this.managers.set(e,r);return await r.connect()}disconnect(e){if(e){const r=this.managers.get(e);r&&(r.disconnect(),this.managers.delete(e))}else{for(const[r,n]of this.managers.entries())n.disconnect(),this.managers.delete(r);this.currentUrl=null}}getCurrentUrl(){return this.currentUrl}getConnectionState(e){const r=e||this.currentUrl;if(!r)return"disconnected";const n=this.managers.get(r);return n?n.getConnectionState():"disconnected"}getActiveConnections(){return Array.from(this.managers.keys()).filter(e=>{var r;return((r=this.managers.get(e))==null?void 0:r.getConnectionState())==="connected"})}}class Uc{constructor(e){v(this,"ws",null);v(this,"options");v(this,"reconnectCount",0);v(this,"reconnectTimer",null);v(this,"readableStream",null);v(this,"writableStream",null);this.options={reconnectAttempts:3,reconnectDelay:1e3,...e}}async connect(){this.updateConnectionState({status:"connecting",url:this.options.url});try{return this.ws=new WebSocket(this.options.url),new Promise((e,r)=>{this.ws?(this.ws.onopen=()=>{var n;this.reconnectCount=0,this.updateConnectionState({status:"connected",url:this.options.url}),this.ws&&(this.readableStream=(function(s){const o=new zc({start(i){s.onmessage=l=>{if(l.data instanceof ArrayBuffer)i.enqueue(new Uint8Array(l.data));else if(l.data instanceof Uint8Array)i.enqueue(l.data);else{const c=new TextEncoder;i.enqueue(c.encode(`${l.data}
5
- `))}},s.onclose=()=>{i.close()},s.onerror=l=>{i.error(l)}},cancel(){s.close()}}),a=async function*(){const i=o.getReader();try{for(;;){const{value:l,done:c}=await i.read();if(c)break;yield l}}finally{i.releaseLock()}};return o.values=a,o[Symbol.asyncIterator]=a,o})(this.ws),this.writableStream=(n=this.ws,new Fc({write(s){n.readyState===WebSocket.OPEN&&n.send(s)},close(){n.close()},abort(){n.close()}})),e({readable:this.readableStream,writable:this.writableStream}))},this.ws.onerror=n=>{const s=new Error("WebSocket connection error");this.options.onError(s),this.updateConnectionState({status:"error",error:s.message,url:this.options.url}),r(s)},this.ws.onclose=()=>{this.updateConnectionState({status:"disconnected",url:this.options.url}),this.attemptReconnect()}):r(new Error("WebSocket not initialized"))})}catch(e){const r=e instanceof Error?e:new Error(String(e));throw this.options.onError(r),this.updateConnectionState({status:"error",error:r.message,url:this.options.url}),r}}disconnect(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.ws&&(this.ws.close(),this.ws=null),this.readableStream=null,this.writableStream=null,this.updateConnectionState({status:"disconnected"})}attemptReconnect(){this.reconnectCount<(this.options.reconnectAttempts||3)&&(this.reconnectCount++,this.reconnectTimer=setTimeout(async()=>{try{await this.connect()}catch{}},this.options.reconnectDelay))}updateConnectionState(e){this.options.onConnectionStateChange(e)}getConnectionState(){if(!this.ws)return"disconnected";switch(this.ws.readyState){case WebSocket.CONNECTING:return"connecting";case WebSocket.OPEN:return"connected";case WebSocket.CLOSING:case WebSocket.CLOSED:return"disconnected";default:return"error"}}getStreams(){return this.readableStream&&this.writableStream?{readable:this.readableStream,writable:this.writableStream}:null}}const to=t=>{let e;const r=new Set,n=(i,l)=>{const c=typeof i=="function"?i(e):i;if(!Object.is(c,e)){const u=e;e=l??(typeof c!="object"||c===null)?c:Object.assign({},e,c),r.forEach(d=>d(e,u))}},s=()=>e,o={setState:n,getState:s,getInitialState:()=>a,subscribe:i=>(r.add(i),()=>r.delete(i))},a=e=t(n,s,o);return o},qc=t=>t,ro=t=>{const e=(n=>n?to(n):to)(t),r=n=>(function(s,o=qc){const a=Qt.useSyncExternalStore(s.subscribe,Qt.useCallback(()=>o(s.getState()),[s,o]),Qt.useCallback(()=>o(s.getInitialState()),[s,o]));return Qt.useDebugValue(a),a})(e,n);return Object.assign(r,e),r},Wc=(no=(t,e)=>({connections:{},activeConnectionUrl:null,connectionState:{status:"disconnected"},agentCapabilities:null,activeSessionId:null,notifications:{},setConnection:(r,n,s)=>{t(o=>{var a,i;return{connections:{...o.connections,[r]:{url:r,state:n,capabilities:s??((a=o.connections[r])==null?void 0:a.capabilities)??null}},...o.activeConnectionUrl===r&&{connectionState:n,agentCapabilities:s??((i=o.connections[r])==null?void 0:i.capabilities)??null}}})},setActiveConnection:r=>{t(n=>{const s=r?n.connections[r]:null;return{activeConnectionUrl:r,connectionState:(s==null?void 0:s.state)??{status:"disconnected"},agentCapabilities:(s==null?void 0:s.capabilities)??null}})},removeConnection:r=>{t(n=>{const s={...n.connections};delete s[r];const o=n.activeConnectionUrl===r?null:n.activeConnectionUrl,a=o?s[o]:null;return{connections:s,activeConnectionUrl:o,connectionState:(a==null?void 0:a.state)??{status:"disconnected"},agentCapabilities:(a==null?void 0:a.capabilities)??null}})},setConnectionState:r=>{t({connectionState:r});const{activeConnectionUrl:n}=e();n&&e().setConnection(n,r)},setAgentCapabilities:r=>{t({agentCapabilities:r});const{activeConnectionUrl:n}=e();n&&e().setConnection(n,e().connectionState,r)},setActiveSessionId:r=>{t({activeSessionId:r})},addNotification:r=>{const n=e().notifications,s=e().activeSessionId;if(!s)return;const o={...r,id:`${Date.now()}-${Math.random()}`,timestamp:Date.now()},a=n[s]||[],i={...n,[s]:[...a,o]};t({notifications:i})},clearNotifications:r=>{if(r){const n={...e().notifications};delete n[r],t({notifications:n})}else t({notifications:{}})},getActiveNotifications:()=>{const{activeSessionId:r,notifications:n}=e();return r&&n[r]||[]},getActiveConnection:()=>{const{activeConnectionUrl:r,connections:n}=e();return r&&n[r]||null},getConnection:r=>{const{connections:n}=e();return n[r]||{url:r,state:{status:"disconnected"},capabilities:null}}}))?ro(no):ro;var no;const Hc=typeof window<"u"?R.useLayoutEffect:R.useEffect;function Ke(t){const e=R.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return Hc(()=>{e.current=t},[t]),R.useCallback((...r)=>{var n;return(n=e.current)==null?void 0:n.call(e,...r)},[e])}const so=["tool_call","tool_call_update"];function Qc(t,e){return!!t&&(t.type==="session_notification"&&e.type==="session_notification"?!(!so.includes(t.data.update.sessionUpdate)||!so.includes(e.data.update.sessionUpdate))||t.data.update.sessionUpdate===e.data.update.sessionUpdate:t.type===e.type)}function Zc(t){var r;const e=new Map;for(const n of t)e.has(n.toolCallId)||e.set(n.toolCallId,[]),(r=e.get(n.toolCallId))==null||r.push(n);return Array.from(e.values()).map(n=>{var o;const s=n.at(0);return(function(a,i){if(!a)throw new Error(i)})(!!(s!=null&&s.toolCallId),"Tool call ID is required"),{...s,toolCallId:s.toolCallId,status:(o=n.at(-1))==null?void 0:o.status,rawOutput:Object.assign({},...n.map(a=>a.rawOutput)),locations:n.flatMap(a=>a.locations||[]),content:n.flatMap(a=>a.content||[])}})}const Xc="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",oo=[],ao={allowDangerousHtml:!0},Jc=/^(https?|ircs?|mailto|xmpp)$/i,Yc=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Kc(t){const e=t.indexOf(":"),r=t.indexOf("?"),n=t.indexOf("#"),s=t.indexOf("/");return e===-1||s!==-1&&e>s||r!==-1&&e>r||n!==-1&&e>n||Jc.test(t.slice(0,e))?t:""}const io=/[#.]/g;function lo(t,e,r){const n=r?(function(s){const o=new Map;for(const a of s)o.set(a.toLowerCase(),a);return o})(r):void 0;return function(s,o,...a){let i;if(s==null){i={type:"root",children:[]};const l=o;a.unshift(l)}else{i=(function(u,d){const p=u||"",m={};let h,y,_=0;for(;_<p.length;){io.lastIndex=_;const f=io.exec(p),w=p.slice(_,f?f.index:p.length);w&&(h?h==="#"?m.id=w:Array.isArray(m.className)?m.className.push(w):m.className=[w]:y=w,_+=w.length),f&&(h=f[0],_++)}return{type:"element",tagName:y||d||"div",properties:m,children:[]}})(s,e);const l=i.tagName.toLowerCase(),c=n?n.get(l):void 0;if(i.tagName=c||l,(function(u){if(u===null||typeof u!="object"||Array.isArray(u))return!0;if(typeof u.type!="string")return!1;const d=u,p=Object.keys(u);for(const m of p){const h=d[m];if(h&&typeof h=="object"){if(!Array.isArray(h))return!0;const y=h;for(const _ of y)if(typeof _!="number"&&typeof _!="string")return!0}}return!!("children"in u&&Array.isArray(u.children))})(o))a.unshift(o);else for(const[u,d]of Object.entries(o))eu(t,i.properties,u,d)}for(const l of a)bn(i.children,l);return i.type==="element"&&i.tagName==="template"&&(i.content={type:"root",children:i.children},i.children=[]),i}}function eu(t,e,r,n){const s=Pl(t,r);let o;if(n!=null){if(typeof n=="number"){if(Number.isNaN(n))return;o=n}else o=typeof n=="boolean"?n:typeof n=="string"?s.spaceSeparated?Rl(n):s.commaSeparated?Ll(n):s.commaOrSpaceSeparated?Rl(Ll(n).join(" ")):co(s,s.property,n):Array.isArray(n)?[...n]:s.property==="style"?(function(a){const i=[];for(const[l,c]of Object.entries(a))i.push([l,c].join(": "));return i.join("; ")})(n):String(n);if(Array.isArray(o)){const a=[];for(const i of o)a.push(co(s,s.property,i));o=a}s.property==="className"&&Array.isArray(e.className)&&(o=e.className.concat(o)),e[s.property]=o}}function bn(t,e){if(e!=null)if(typeof e=="number"||typeof e=="string")t.push({type:"text",value:String(e)});else if(Array.isArray(e))for(const r of e)bn(t,r);else{if(typeof e!="object"||!("type"in e))throw new Error("Expected node, nodes, or string, got `"+e+"`");e.type==="root"?bn(t,e.children):t.push(e)}}function co(t,e,r){if(typeof r=="string"){if(t.number&&r&&!Number.isNaN(Number(r)))return Number(r);if((t.boolean||t.overloadedBoolean)&&(r===""||jl(r)===jl(e)))return!0}return r}const tu=lo(Ol,"div"),ru=lo(Vs,"g",["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","solidColor","textArea","textPath"]),uo="http://www.w3.org/1999/xhtml",nu="http://www.w3.org/2000/svg";function po(t,e){const r=(function(n,s){switch(n.nodeType){case 1:return(function(o,a){const i=o.namespaceURI,l=i===nu?ru:tu,c=i===uo?o.tagName.toLowerCase():o.tagName,u=i===uo&&c==="template"?o.content:o,d=o.getAttributeNames(),p={};let m=-1;for(;++m<d.length;)p[d[m]]=o.getAttribute(d[m])||"";return l(c,p,ho(u,a))})(n,s);case 3:return(function(o){return{type:"text",value:o.nodeValue||""}})(n);case 8:return(function(o){return{type:"comment",value:o.nodeValue||""}})(n);case 9:return mo(n,s);case 10:return{type:"doctype"};case 11:return mo(n,s);default:return}})(t,e);return r&&e.afterTransform&&e.afterTransform(t,r),r}function mo(t,e){return{type:"root",children:ho(t,e)}}function ho(t,e){const r=t.childNodes,n=[];let s=-1;for(;++s<r.length;){const o=po(r[s],e);o!==void 0&&n.push(o)}return n}function su(t,e){const r=(function(n){const s=document.createElement("template");return s.innerHTML=n,s.content})(t);return po(r,{})||{type:"root",children:[]}}new DOMParser;const fo=function(t,e,r){const n=Yf(r);if(!t||!t.type||!t.children)throw new Error("Expected parent node");if(typeof e=="number"){if(e<0||e===Number.POSITIVE_INFINITY)throw new Error("Expected positive finite number as index")}else if((e=t.children.indexOf(e))<0)throw new Error("Expected child node or index");for(;++e<t.children.length;)if(n(t.children[e],e,t))return t.children[e]},ut=function(t){if(t==null)return ou;if(typeof t=="string")return(function(e){return yn(r);function r(n){return n.tagName===e}})(t);if(typeof t=="object")return(function(e){const r=[];let n=-1;for(;++n<e.length;)r[n]=ut(e[n]);return yn(s);function s(...o){let a=-1;for(;++a<r.length;)if(r[a].apply(this,o))return!0;return!1}})(t);if(typeof t=="function")return yn(t);throw new Error("Expected function, string, or array as `test`")};function yn(t){return function(e,r,n){return!!((function(s){return s!==null&&typeof s=="object"&&"type"in s&&"tagName"in s})(e)&&t.call(this,e,typeof r=="number"?r:void 0,n||void 0))}}function ou(t){return!!(t&&typeof t=="object"&&"type"in t&&t.type==="element"&&"tagName"in t&&typeof t.tagName=="string")}const go=/\n/g,_o=/[\t ]+/g,xn=ut("br"),bo=ut(function(t){return t.tagName==="td"||t.tagName==="th"}),au=ut("p"),yo=ut("tr"),iu=ut(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",function(t){return!!(t.properties||{}).hidden},function(t){return t.tagName==="dialog"&&!(t.properties||{}).open}]),xo=ut(["address","article","aside","blockquote","body","caption","center","dd","dialog","dir","dl","dt","div","figure","figcaption","footer","form,","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","legend","li","listing","main","menu","nav","ol","p","plaintext","pre","section","ul","xmp"]);function wo(t,e,r){return t.type==="element"?(function(n,s,o){const a=vo(n,o),i=n.children||[];let l,c,u=-1,d=[];if(iu(n))return d;for(xn(n)||yo(n)&&fo(s,n,yo)?c=`
6
- `:au(n)?(l=2,c=2):xo(n)&&(l=1,c=1);++u<i.length;)d=d.concat(wo(i[u],n,{whitespace:a,breakBefore:u?void 0:l,breakAfter:u<i.length-1?xn(i[u+1]):c}));return bo(n)&&fo(s,n,bo)&&d.push(" "),l&&d.unshift(l),c&&d.push(c),d})(t,e,r):t.type==="text"?r.whitespace==="normal"?ko(t,r):(function(n){return[String(n.value)]})(t):[]}function ko(t,e){const r=String(t.value),n=[],s=[];let o=0;for(;o<=r.length;){go.lastIndex=o;const l=go.exec(r),c=l&&"index"in l?l.index:r.length;n.push(lu(r.slice(o,c).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,""),o!==0||e.breakBefore,c!==r.length||e.breakAfter)),o=c+1}let a,i=-1;for(;++i<n.length;)n[i].charCodeAt(n[i].length-1)===8203||i<n.length-1&&n[i+1].charCodeAt(0)===8203?(s.push(n[i]),a=void 0):n[i]?(typeof a=="number"&&s.push(a),s.push(n[i]),a=0):i!==0&&i!==n.length-1||s.push(0);return s}function lu(t,e,r){const n=[];let s,o=0;for(;o<t.length;){_o.lastIndex=o;const a=_o.exec(t);s=a?a.index:t.length,o||s||!a||e||n.push(""),o!==s&&n.push(t.slice(o,s)),o=a?s+a[0].length:s}return o===s||r||n.push(""),n.join(" ")}function vo(t,e){if(t.type==="element"){const r=t.properties||{};switch(t.tagName){case"listing":case"plaintext":case"xmp":return"pre";case"nobr":return"nowrap";case"pre":return r.wrap?"pre-wrap":"pre";case"td":case"th":return r.noWrap?"nowrap":e.whitespace;case"textarea":return"pre-wrap"}}return e.whitespace}const cu={},uu=[];function pu(t){const e=t||cu;return function(r,n){Kf(r,"element",function(s,o){const a=Array.isArray(s.properties.className)?s.properties.className:uu,i=a.includes("language-math"),l=a.includes("math-display"),c=a.includes("math-inline");let u=l;if(!i&&!l&&!c)return;let d=o[o.length-1],p=s;if(s.tagName==="code"&&i&&d&&d.type==="element"&&d.tagName==="pre"&&(p=d,d=o[o.length-2],u=!0),!d)return;const m=(function(_,f){const w=f||{},k="children"in _?_.children:[],x=xo(_),S=vo(_,{whitespace:w.whitespace||"normal"}),E=[];_.type!=="text"&&_.type!=="comment"||E.push(...ko(_,{breakBefore:!0,breakAfter:!0}));let C=-1;for(;++C<k.length;)E.push(...wo(k[C],_,{whitespace:S,breakBefore:C?void 0:x,breakAfter:C<k.length-1?xn(k[C+1]):x}));const N=[];let I;for(C=-1;++C<E.length;){const D=E[C];typeof D=="number"?I!==void 0&&D>I&&(I=D):D&&(I!==void 0&&I>-1&&N.push(`
7
- `.repeat(I)||" "),I=-1,N.push(D))}return N.join("")})(p,{whitespace:"pre"});let h;try{h=Dl.renderToString(m,{...e,displayMode:u,throwOnError:!0})}catch(_){const f=_,w=f.name.toLowerCase();n.message("Could not render math with KaTeX",{ancestors:[...o,s],cause:f,place:s.position,ruleId:w,source:"rehype-katex"});try{h=Dl.renderToString(m,{...e,displayMode:u,strict:"ignore",throwOnError:!1})}catch{h=[{type:"element",tagName:"span",properties:{className:["katex-error"],style:"color:"+(e.errorColor||"#cc0000"),title:String(_)},children:[{type:"text",value:m}]}]}}typeof h=="string"&&(h=su(h).children);const y=d.children.indexOf(p);return d.children.splice(y,1,...h),eg})}}const du={tokenize:function(t,e,r){const n=this,s=n.events[n.events.length-1],o=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0;let a=0;return function(f){return t.enter("mathFlow"),t.enter("mathFlowFence"),t.enter("mathFlowFenceSequence"),i(f)};function i(f){return f===36?(t.consume(f),a++,i):a<2?r(f):(t.exit("mathFlowFenceSequence"),pn(t,l,"whitespace")(f))}function l(f){return f===null||St(f)?u(f):(t.enter("mathFlowFenceMeta"),t.enter("chunkString",{contentType:"string"}),c(f))}function c(f){return f===null||St(f)?(t.exit("chunkString"),t.exit("mathFlowFenceMeta"),u(f)):f===36?r(f):(t.consume(f),c)}function u(f){return t.exit("mathFlowFence"),n.interrupt?e(f):t.attempt(Eo,d,y)(f)}function d(f){return t.attempt({tokenize:_,partial:!0},y,p)(f)}function p(f){return(o?pn(t,m,"linePrefix",o+1):m)(f)}function m(f){return f===null?y(f):St(f)?t.attempt(Eo,d,y)(f):(t.enter("mathFlowValue"),h(f))}function h(f){return f===null||St(f)?(t.exit("mathFlowValue"),m(f)):(t.consume(f),h)}function y(f){return t.exit("mathFlow"),e(f)}function _(f,w,k){let x=0;return pn(f,function(C){return f.enter("mathFlowFence"),f.enter("mathFlowFenceSequence"),S(C)},"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4);function S(C){return C===36?(x++,f.consume(C),S):x<a?k(C):(f.exit("mathFlowFenceSequence"),pn(f,E,"whitespace")(C))}function E(C){return C===null||St(C)?(f.exit("mathFlowFence"),w(C)):k(C)}}},concrete:!0,name:"mathFlow"},Eo={tokenize:function(t,e,r){const n=this;return function(o){return o===null?e(o):(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s)};function s(o){return n.parser.lazy[n.now().line]?r(o):e(o)}},partial:!0};function mu(t){let e=(t||{}).singleDollarTextMath;return e==null&&(e=!0),{tokenize:function(r,n,s){let o,a,i=0;return function(p){return r.enter("mathText"),r.enter("mathTextSequence"),l(p)};function l(p){return p===36?(r.consume(p),i++,l):i<2&&!e?s(p):(r.exit("mathTextSequence"),c(p))}function c(p){return p===null?s(p):p===36?(a=r.enter("mathTextSequence"),o=0,d(p)):p===32?(r.enter("space"),r.consume(p),r.exit("space"),c):St(p)?(r.enter("lineEnding"),r.consume(p),r.exit("lineEnding"),c):(r.enter("mathTextData"),u(p))}function u(p){return p===null||p===32||p===36||St(p)?(r.exit("mathTextData"),c(p)):(r.consume(p),u)}function d(p){return p===36?(r.consume(p),o++,d):o===i?(r.exit("mathTextSequence"),r.exit("mathText"),n(p)):(a.type="mathTextData",u(p))}},resolve:hu,previous:fu,name:"mathText"}}function hu(t){let e,r,n=t.length-4,s=3;if(!(t[s][1].type!=="lineEnding"&&t[s][1].type!=="space"||t[n][1].type!=="lineEnding"&&t[n][1].type!=="space")){for(e=s;++e<n;)if(t[e][1].type==="mathTextData"){t[n][1].type="mathTextPadding",t[s][1].type="mathTextPadding",s+=2,n-=2;break}}for(e=s-1,n++;++e<=n;)r===void 0?e!==n&&t[e][1].type!=="lineEnding"&&(r=e):e!==n&&t[e][1].type!=="lineEnding"||(t[r][1].type="mathTextData",e!==r+2&&(t[r][1].end=t[e-1][1].end,t.splice(r+2,e-r-2),n-=e-r-2,e=r+2),r=void 0);return t}function fu(t){return t!==36||this.events[this.events.length-1][1].type==="characterEscape"}const gu={};function _u(t){const e=t||gu,r=this.data(),n=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);n.push((function(a){return{flow:{36:du},text:{36:mu(a)}}})(e)),s.push((function(){return{enter:{mathFlow:function(i){this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[{type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]}]}},i)},mathFlowFenceMeta:function(){this.buffer()},mathText:function(i){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},i),this.buffer()}},exit:{mathFlow:function(i){const l=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),c=this.stack[this.stack.length-1];br(c.type==="math"),this.exit(i),c.value=l;const u=c.data.hChildren[0];br(u.type==="element"),br(u.tagName==="code"),u.children.push({type:"text",value:l}),this.data.mathFlowInside=void 0},mathFlowFence:function(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)},mathFlowFenceMeta:function(){const i=this.resume(),l=this.stack[this.stack.length-1];br(l.type==="math"),l.meta=i},mathFlowValue:a,mathText:function(i){const l=this.resume(),c=this.stack[this.stack.length-1];br(c.type==="inlineMath"),this.exit(i),c.value=l,c.data.hChildren.push({type:"text",value:l})},mathTextData:a}};function a(i){this.config.enter.data.call(this,i),this.config.exit.data.call(this,i)}})()),o.push((function(a){let i=(a||{}).singleDollarTextMath;return i==null&&(i=!0),l.peek=function(){return"$"},{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:`
8
- `,inConstruct:"mathFlowMeta"},{character:"$",after:i?void 0:"\\$",inConstruct:"phrasing"},{character:"$",inConstruct:"mathFlowMeta"},{atBreak:!0,character:"$",after:"\\$"}],handlers:{math:function(c,u,d,p){const m=c.value||"",h=d.createTracker(p),y="$".repeat(Math.max(tg(m,"$")+1,2)),_=d.enter("mathFlow");let f=h.move(y);if(c.meta){const w=d.enter("mathFlowMeta");f+=h.move(d.safe(c.meta,{after:`
9
- `,before:f,encode:["$"],...h.current()})),w()}return f+=h.move(`
10
- `),m&&(f+=h.move(m+`
11
- `)),f+=h.move(y),_(),f},inlineMath:l}};function l(c,u,d){let p=c.value||"",m=1;for(i||m++;new RegExp("(^|[^$])"+"\\$".repeat(m)+"([^$]|$)").test(p);)m++;const h="$".repeat(m);/[^ \r\n]/.test(p)&&(/^[ \r\n]/.test(p)&&/[ \r\n]$/.test(p)||/^\$|\$$/.test(p))&&(p=" "+p+" ");let y=-1;for(;++y<d.unsafe.length;){const _=d.unsafe[y];if(!_.atBreak)continue;const f=d.compilePattern(_);let w;for(;w=f.exec(p);){let k=w.index;p.codePointAt(k)===10&&p.codePointAt(k-1)===13&&k--,p=p.slice(0,k)+" "+p.slice(w.index+1)}}return h+p+h}})(e))}var So,et={},bu=(function(){if(So)return et;So=1;var t=et&&et.__assign||function(){return t=Object.assign||function(s){for(var o,a=1,i=arguments.length;a<i;a++)for(var l in o=arguments[a])Object.prototype.hasOwnProperty.call(o,l)&&(s[l]=o[l]);return s},t.apply(this,arguments)},e=et&&et.__rest||function(s,o){var a={};for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&o.indexOf(i)<0&&(a[i]=s[i]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function"){var l=0;for(i=Object.getOwnPropertySymbols(s);l<i.length;l++)o.indexOf(i[l])<0&&Object.prototype.propertyIsEnumerable.call(s,i[l])&&(a[i[l]]=s[i[l]])}return a};Object.defineProperty(et,"__esModule",{value:!0}),et.default=function(s){return function(o){var a=o.defaultOrigin,i=a===void 0?"":a,l=o.allowedLinkPrefixes,c=l===void 0?[]:l,u=o.allowedImagePrefixes,d=u===void 0?[]:u,p=o.components,m=e(o,["defaultOrigin","allowedLinkPrefixes","allowedImagePrefixes","components"]),h=c.length&&!c.every(function(E){return E==="*"}),y=d.length&&!d.every(function(E){return E==="*"});if(!i&&(h||y))throw new Error("defaultOrigin is required when allowedLinkPrefixes or allowedImagePrefixes are provided");var _=function(E){if(typeof E!="string")return null;try{return new URL(E)}catch{if(i)try{return new URL(E,i)}catch{return null}return null}},f=function(E){return typeof E=="string"&&E.startsWith("/")},w=function(E,C){if(!E||!_(E))return null;if(C.includes("*")){var N=f(E),I=_(E);return I?N?I.pathname+I.search+I.hash:I.href:null}var D=f(E),P=_(E);return P&&C.some(function(A){var V=_(A);return!!V&&V.origin===P.origin&&P.href.startsWith(V.href)})?D?P.pathname+P.search+P.hash:P.href:null},k={a:function(E){var C=E.href,N=E.children,I=E.node,D=e(E,["href","children","node"]),P=w(C,c);return P!==null?p!=null&&p.a?(0,n.createElement)(p.a,t({href:P,children:N,node:I,target:"_blank",rel:"noopener noreferrer"},D)):(0,r.jsx)("a",t({href:P},D,{target:"_blank",rel:"noopener noreferrer",children:N})):(0,r.jsxs)("span",{className:"text-gray-500",title:"Blocked URL: ".concat(C),children:[N," [blocked]"]})},img:function(E){var C=E.src,N=E.alt,I=E.node,D=e(E,["src","alt","node"]),P=w(C,d);return P!==null?p!=null&&p.img?(0,n.createElement)(p.img,t({src:P,alt:N,node:I},D)):(0,r.jsx)("img",t({src:P,alt:N},D)):(0,r.jsxs)("span",{className:"inline-block bg-gray-200 dark:bg-gray-700 text-gray-600 dark:text-gray-400 px-3 py-1 rounded text-sm",children:["[Image blocked: ",N||"No description","]"]})}},x=t(t({},p),k),S=t(t({},m),{components:x});return(0,n.createElement)(s,S)}};var r=sf(),n=of();return et})();const Co=af(bu);let oe=class extends Error{constructor(t){super(t),this.name="ShikiError"}};function wn(t){return Array.isArray(t)?(function(e){let r=[];for(let n=0,s=e.length;n<s;n++)r[n]=wn(e[n]);return r})(t):t instanceof RegExp?t:typeof t=="object"?(function(e){let r={};for(let n in e)r[n]=wn(e[n]);return r})(t):t}function Ao(t,...e){return e.forEach(r=>{for(let n in r)t[n]=r[n]}),t}function Io(t){const e=~t.lastIndexOf("/")||~t.lastIndexOf("\\");return e===0?t:~e===t.length-1?Io(t.substring(0,t.length-1)):t.substr(1+~e)}var kn=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,xr=class{static hasCaptures(t){return t!==null&&(kn.lastIndex=0,kn.test(t))}static replaceCaptures(t,e,r){return t.replace(kn,(n,s,o,a)=>{let i=r[parseInt(s||o,10)];if(!i)return n;{let l=e.substring(i.start,i.end);for(;l[0]===".";)l=l.substring(1);switch(a){case"downcase":return l.toLowerCase();case"upcase":return l.toUpperCase();default:return l}}})}};function No(t,e){return t<e?-1:t>e?1:0}function To(t,e){if(t===null&&e===null)return 0;if(!t)return-1;if(!e)return 1;let r=t.length,n=e.length;if(r===n){for(let s=0;s<r;s++){let o=No(t[s],e[s]);if(o!==0)return o}return 0}return r-n}function Po(t){return!!/^#[0-9a-f]{6}$/i.test(t)||!!/^#[0-9a-f]{8}$/i.test(t)||!!/^#[0-9a-f]{3}$/i.test(t)||!!/^#[0-9a-f]{4}$/i.test(t)}function Ro(t){return t.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var Lo=class{constructor(t){v(this,"cache",new Map);this.fn=t}get(t){if(this.cache.has(t))return this.cache.get(t);const e=this.fn(t);return this.cache.set(t,e),e}},wr=class{constructor(t,e,r){v(this,"_cachedMatchRoot",new Lo(t=>this._root.match(t)));this._colorMap=t,this._defaults=e,this._root=r}static createFromRawTheme(t,e){return this.createFromParsedTheme((function(r){if(!r)return[];if(!r.settings||!Array.isArray(r.settings))return[];let n=r.settings,s=[],o=0;for(let a=0,i=n.length;a<i;a++){let l,c=n[a];if(!c.settings)continue;if(typeof c.scope=="string"){let m=c.scope;m=m.replace(/^[,]+/,""),m=m.replace(/[,]+$/,""),l=m.split(",")}else l=Array.isArray(c.scope)?c.scope:[""];let u=-1;if(typeof c.settings.fontStyle=="string"){u=0;let m=c.settings.fontStyle.split(" ");for(let h=0,y=m.length;h<y;h++)switch(m[h]){case"italic":u|=1;break;case"bold":u|=2;break;case"underline":u|=4;break;case"strikethrough":u|=8}}let d=null;typeof c.settings.foreground=="string"&&Po(c.settings.foreground)&&(d=c.settings.foreground);let p=null;typeof c.settings.background=="string"&&Po(c.settings.background)&&(p=c.settings.background);for(let m=0,h=l.length;m<h;m++){let y=l[m].trim().split(" "),_=y[y.length-1],f=null;y.length>1&&(f=y.slice(0,y.length-1),f.reverse()),s[o++]=new xu(_,f,a,u,d,p)}}return s})(t),e)}static createFromParsedTheme(t,e){return(function(r,n){r.sort((u,d)=>{let p=No(u.scope,d.scope);return p!==0?p:(p=To(u.parentScopes,d.parentScopes),p!==0?p:u.index-d.index)});let s=0,o="#000000",a="#ffffff";for(;r.length>=1&&r[0].scope==="";){let u=r.shift();u.fontStyle!==-1&&(s=u.fontStyle),u.foreground!==null&&(o=u.foreground),u.background!==null&&(a=u.background)}let i=new wu(n),l=new jo(s,i.getId(o),i.getId(a)),c=new vu(new En(0,null,-1,0,0),[]);for(let u=0,d=r.length;u<d;u++){let p=r[u];c.insert(0,p.scope,p.parentScopes,p.fontStyle,i.getId(p.foreground),i.getId(p.background))}return new wr(i,l,c)})(t,e)}getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(t){if(t===null)return this._defaults;const e=t.scopeName,r=this._cachedMatchRoot.get(e).find(n=>(function(s,o){if(o.length===0)return!0;for(let a=0;a<o.length;a++){let i=o[a],l=!1;if(i===">"){if(a===o.length-1)return!1;i=o[++a],l=!0}for(;s&&!yu(s.scopeName,i);){if(l)return!1;s=s.parent}if(!s)return!1;s=s.parent}return!0})(t.parent,n.parentScopes));return r?new jo(r.fontStyle,r.foreground,r.background):null}},vn=class mn{constructor(e,r){this.parent=e,this.scopeName=r}static push(e,r){for(const n of r)e=new mn(e,n);return e}static from(...e){let r=null;for(let n=0;n<e.length;n++)r=new mn(r,e[n]);return r}push(e){return new mn(this,e)}getSegments(){let e=this;const r=[];for(;e;)r.push(e.scopeName),e=e.parent;return r.reverse(),r}toString(){return this.getSegments().join(" ")}extends(e){return this===e||this.parent!==null&&this.parent.extends(e)}getExtensionIfDefined(e){const r=[];let n=this;for(;n&&n!==e;)r.push(n.scopeName),n=n.parent;return n===e?r.reverse():void 0}};function yu(t,e){return e===t||t.startsWith(e)&&t[e.length]==="."}var jo=class{constructor(t,e,r){this.fontStyle=t,this.foregroundId=e,this.backgroundId=r}},xu=class{constructor(t,e,r,n,s,o){this.scope=t,this.parentScopes=e,this.index=r,this.fontStyle=n,this.foreground=s,this.background=o}},ge=(t=>(t[t.NotSet=-1]="NotSet",t[t.None=0]="None",t[t.Italic=1]="Italic",t[t.Bold=2]="Bold",t[t.Underline=4]="Underline",t[t.Strikethrough=8]="Strikethrough",t))(ge||{}),wu=class{constructor(t){v(this,"_isFrozen");v(this,"_lastColorId");v(this,"_id2color");v(this,"_color2id");if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(t)){this._isFrozen=!0;for(let e=0,r=t.length;e<r;e++)this._color2id[t[e]]=e,this._id2color[e]=t[e]}else this._isFrozen=!1}getId(t){if(t===null)return 0;t=t.toUpperCase();let e=this._color2id[t];if(e)return e;if(this._isFrozen)throw new Error(`Missing color in color map - ${t}`);return e=++this._lastColorId,this._color2id[t]=e,this._id2color[e]=t,e}getColorMap(){return this._id2color.slice(0)}},ku=Object.freeze([]),En=class ql{constructor(e,r,n,s,o){v(this,"scopeDepth");v(this,"parentScopes");v(this,"fontStyle");v(this,"foreground");v(this,"background");this.scopeDepth=e,this.parentScopes=r||ku,this.fontStyle=n,this.foreground=s,this.background=o}clone(){return new ql(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let r=[];for(let n=0,s=e.length;n<s;n++)r[n]=e[n].clone();return r}acceptOverwrite(e,r,n,s){this.scopeDepth>e?console.log("how did this happen?"):this.scopeDepth=e,r!==-1&&(this.fontStyle=r),n!==0&&(this.foreground=n),s!==0&&(this.background=s)}},vu=class Fs{constructor(e,r=[],n={}){v(this,"_rulesWithParentScopes");this._mainRule=e,this._children=n,this._rulesWithParentScopes=r}static _cmpBySpecificity(e,r){if(e.scopeDepth!==r.scopeDepth)return r.scopeDepth-e.scopeDepth;let n=0,s=0;for(;e.parentScopes[n]===">"&&n++,r.parentScopes[s]===">"&&s++,!(n>=e.parentScopes.length||s>=r.parentScopes.length);){const o=r.parentScopes[s].length-e.parentScopes[n].length;if(o!==0)return o;n++,s++}return r.parentScopes.length-e.parentScopes.length}match(e){if(e!==""){let n,s,o=e.indexOf(".");if(o===-1?(n=e,s=""):(n=e.substring(0,o),s=e.substring(o+1)),this._children.hasOwnProperty(n))return this._children[n].match(s)}const r=this._rulesWithParentScopes.concat(this._mainRule);return r.sort(Fs._cmpBySpecificity),r}insert(e,r,n,s,o,a){if(r==="")return void this._doInsertHere(e,n,s,o,a);let i,l,c,u=r.indexOf(".");u===-1?(i=r,l=""):(i=r.substring(0,u),l=r.substring(u+1)),this._children.hasOwnProperty(i)?c=this._children[i]:(c=new Fs(this._mainRule.clone(),En.cloneArr(this._rulesWithParentScopes)),this._children[i]=c),c.insert(e+1,l,n,s,o,a)}_doInsertHere(e,r,n,s,o){if(r!==null){for(let a=0,i=this._rulesWithParentScopes.length;a<i;a++){let l=this._rulesWithParentScopes[a];if(To(l.parentScopes,r)===0)return void l.acceptOverwrite(e,n,s,o)}n===-1&&(n=this._mainRule.fontStyle),s===0&&(s=this._mainRule.foreground),o===0&&(o=this._mainRule.background),this._rulesWithParentScopes.push(new En(e,r,n,s,o))}else this._mainRule.acceptOverwrite(e,n,s,o)}},At=class Ne{static toBinaryStr(e){return e.toString(2).padStart(32,"0")}static print(e){const r=Ne.getLanguageId(e),n=Ne.getTokenType(e),s=Ne.getFontStyle(e),o=Ne.getForeground(e),a=Ne.getBackground(e);console.log({languageId:r,tokenType:n,fontStyle:s,foreground:o,background:a})}static getLanguageId(e){return(255&e)>>>0}static getTokenType(e){return(768&e)>>>8}static containsBalancedBrackets(e){return!!(1024&e)}static getFontStyle(e){return(30720&e)>>>11}static getForeground(e){return(16744448&e)>>>15}static getBackground(e){return(4278190080&e)>>>24}static set(e,r,n,s,o,a,i){let l=Ne.getLanguageId(e),c=Ne.getTokenType(e),u=Ne.containsBalancedBrackets(e)?1:0,d=Ne.getFontStyle(e),p=Ne.getForeground(e),m=Ne.getBackground(e);return r!==0&&(l=r),n!==8&&(c=n),s!==null&&(u=s?1:0),o!==-1&&(d=o),a!==0&&(p=a),i!==0&&(m=i),(l|c<<8|u<<10|d<<11|p<<15|m<<24)>>>0}};function cg(t){return t}function kr(t,e){const r=[],n=(function(i){let l=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,c=l.exec(i);return{next:()=>{if(!c)return null;const u=c[0];return c=l.exec(i),u}}})(t);let s=n.next();for(;s!==null;){let i=0;if(s.length===2&&s.charAt(1)===":"){switch(s.charAt(0)){case"R":i=1;break;case"L":i=-1;break;default:console.log(`Unknown priority ${s} in scope selector`)}s=n.next()}let l=a();if(r.push({matcher:l,priority:i}),s!==",")break;s=n.next()}return r;function o(){if(s==="-"){s=n.next();const i=o();return l=>!!i&&!i(l)}if(s==="("){s=n.next();const i=(function(){const l=[];let c=a();for(;c&&(l.push(c),s==="|"||s===",");){do s=n.next();while(s==="|"||s===",");c=a()}return u=>l.some(d=>d(u))})();return s===")"&&(s=n.next()),i}if(Oo(s)){const i=[];do i.push(s),s=n.next();while(Oo(s));return l=>e(i,l)}return null}function a(){const i=[];let l=o();for(;l;)i.push(l),l=o();return c=>i.every(u=>u(c))}}function Oo(t){return!!t&&!!t.match(/[\w\.:]+/)}function $o(t){typeof t.dispose=="function"&&t.dispose()}var Xt=class{constructor(t){this.scopeName=t}toKey(){return this.scopeName}},Eu=class{constructor(t,e){this.scopeName=t,this.ruleName=e}toKey(){return`${this.scopeName}#${this.ruleName}`}},Su=class{constructor(){v(this,"_references",[]);v(this,"_seenReferenceKeys",new Set);v(this,"visitedRule",new Set)}get references(){return this._references}add(t){const e=t.toKey();this._seenReferenceKeys.has(e)||(this._seenReferenceKeys.add(e),this._references.push(t))}},Cu=class{constructor(t,e){v(this,"seenFullScopeRequests",new Set);v(this,"seenPartialScopeRequests",new Set);v(this,"Q");this.repo=t,this.initialScopeName=e,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Xt(this.initialScopeName)]}processQueue(){const t=this.Q;this.Q=[];const e=new Su;for(const r of t)Au(r,this.initialScopeName,this.repo,e);for(const r of e.references)if(r instanceof Xt){if(this.seenFullScopeRequests.has(r.scopeName))continue;this.seenFullScopeRequests.add(r.scopeName),this.Q.push(r)}else{if(this.seenFullScopeRequests.has(r.scopeName)||this.seenPartialScopeRequests.has(r.toKey()))continue;this.seenPartialScopeRequests.add(r.toKey()),this.Q.push(r)}}};function Au(t,e,r,n){const s=r.lookup(t.scopeName);if(!s){if(t.scopeName===e)throw new Error(`No grammar provided for <${e}>`);return}const o=r.lookup(e);t instanceof Xt?vr({baseGrammar:o,selfGrammar:s},n):Sn(t.ruleName,{baseGrammar:o,selfGrammar:s,repository:s.repository},n);const a=r.injections(t.scopeName);if(a)for(const i of a)n.add(new Xt(i))}function Sn(t,e,r){e.repository&&e.repository[t]&&Er([e.repository[t]],e,r)}function vr(t,e){t.selfGrammar.patterns&&Array.isArray(t.selfGrammar.patterns)&&Er(t.selfGrammar.patterns,{...t,repository:t.selfGrammar.repository},e),t.selfGrammar.injections&&Er(Object.values(t.selfGrammar.injections),{...t,repository:t.selfGrammar.repository},e)}function Er(t,e,r){for(const n of t){if(r.visitedRule.has(n))continue;r.visitedRule.add(n);const s=n.repository?Ao({},e.repository,n.repository):e.repository;Array.isArray(n.patterns)&&Er(n.patterns,{...e,repository:s},r);const o=n.include;if(!o)continue;const a=Do(o);switch(a.kind){case 0:vr({...e,selfGrammar:e.baseGrammar},r);break;case 1:vr(e,r);break;case 2:Sn(a.ruleName,{...e,repository:s},r);break;case 3:case 4:const i=a.scopeName===e.selfGrammar.scopeName?e.selfGrammar:a.scopeName===e.baseGrammar.scopeName?e.baseGrammar:void 0;if(i){const l={baseGrammar:e.baseGrammar,selfGrammar:i,repository:s};a.kind===4?Sn(a.ruleName,l,r):vr(l,r)}else a.kind===4?r.add(new Eu(a.scopeName,a.ruleName)):r.add(new Xt(a.scopeName))}}}var Iu=class{constructor(){v(this,"kind",0)}},Nu=class{constructor(){v(this,"kind",1)}},Tu=class{constructor(t){v(this,"kind",2);this.ruleName=t}},Pu=class{constructor(t){v(this,"kind",3);this.scopeName=t}},Ru=class{constructor(t,e){v(this,"kind",4);this.scopeName=t,this.ruleName=e}};function Do(t){if(t==="$base")return new Iu;if(t==="$self")return new Nu;const e=t.indexOf("#");if(e===-1)return new Pu(t);if(e===0)return new Tu(t.substring(1));{const r=t.substring(0,e),n=t.substring(e+1);return new Ru(r,n)}}var Lu=/\\(\d+)/,Mo=/\\(\d+)/g,Jt=class{constructor(t,e,r,n){v(this,"$location");v(this,"id");v(this,"_nameIsCapturing");v(this,"_name");v(this,"_contentNameIsCapturing");v(this,"_contentName");this.$location=t,this.id=e,this._name=r||null,this._nameIsCapturing=xr.hasCaptures(this._name),this._contentName=n||null,this._contentNameIsCapturing=xr.hasCaptures(this._contentName)}get debugName(){const t=this.$location?`${Io(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${t}`}getName(t,e){return this._nameIsCapturing&&this._name!==null&&t!==null&&e!==null?xr.replaceCaptures(this._name,t,e):this._name}getContentName(t,e){return this._contentNameIsCapturing&&this._contentName!==null?xr.replaceCaptures(this._contentName,t,e):this._contentName}},ju=class extends Jt{constructor(e,r,n,s,o){super(e,r,n,s);v(this,"retokenizeCapturedWithRuleId");this.retokenizeCapturedWithRuleId=o}dispose(){}collectPatterns(e,r){throw new Error("Not supported!")}compile(e,r){throw new Error("Not supported!")}compileAG(e,r,n,s){throw new Error("Not supported!")}},Ou=class extends Jt{constructor(e,r,n,s,o){super(e,r,n,null);v(this,"_match");v(this,"captures");v(this,"_cachedCompiledPatterns");this._match=new Yt(s,this.id),this.captures=o,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,r){r.push(this._match)}compile(e,r){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,r,n,s){return this._getCachedCompiledPatterns(e).compileAG(e,n,s)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Kt,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Vo=class extends Jt{constructor(e,r,n,s,o){super(e,r,n,s);v(this,"hasMissingPatterns");v(this,"patterns");v(this,"_cachedCompiledPatterns");this.patterns=o.patterns,this.hasMissingPatterns=o.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(e,r){for(const n of this.patterns)e.getRule(n).collectPatterns(e,r)}compile(e,r){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,r,n,s){return this._getCachedCompiledPatterns(e).compileAG(e,n,s)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Kt,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Cn=class extends Jt{constructor(e,r,n,s,o,a,i,l,c,u){super(e,r,n,s);v(this,"_begin");v(this,"beginCaptures");v(this,"_end");v(this,"endHasBackReferences");v(this,"endCaptures");v(this,"applyEndPatternLast");v(this,"hasMissingPatterns");v(this,"patterns");v(this,"_cachedCompiledPatterns");this._begin=new Yt(o,this.id),this.beginCaptures=a,this._end=new Yt(i||"\uFFFF",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=l,this.applyEndPatternLast=c||!1,this.patterns=u.patterns,this.hasMissingPatterns=u.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,r){return this._end.resolveBackReferences(e,r)}collectPatterns(e,r){r.push(this._begin)}compile(e,r){return this._getCachedCompiledPatterns(e,r).compile(e)}compileAG(e,r,n,s){return this._getCachedCompiledPatterns(e,r).compileAG(e,n,s)}_getCachedCompiledPatterns(e,r){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Kt;for(const n of this.patterns)e.getRule(n).collectPatterns(e,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,r):this._cachedCompiledPatterns.setSource(0,r)),this._cachedCompiledPatterns}},Sr=class extends Jt{constructor(e,r,n,s,o,a,i,l,c){super(e,r,n,s);v(this,"_begin");v(this,"beginCaptures");v(this,"whileCaptures");v(this,"_while");v(this,"whileHasBackReferences");v(this,"hasMissingPatterns");v(this,"patterns");v(this,"_cachedCompiledPatterns");v(this,"_cachedCompiledWhilePatterns");this._begin=new Yt(o,this.id),this.beginCaptures=a,this.whileCaptures=l,this._while=new Yt(i,-2),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,r){return this._while.resolveBackReferences(e,r)}collectPatterns(e,r){r.push(this._begin)}compile(e,r){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,r,n,s){return this._getCachedCompiledPatterns(e).compileAG(e,n,s)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Kt;for(const r of this.patterns)e.getRule(r).collectPatterns(e,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(e,r){return this._getCachedCompiledWhilePatterns(e,r).compile(e)}compileWhileAG(e,r,n,s){return this._getCachedCompiledWhilePatterns(e,r).compileAG(e,n,s)}_getCachedCompiledWhilePatterns(e,r){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new Kt,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,r||"\uFFFF"),this._cachedCompiledWhilePatterns}},Go=class _e{static createCaptureRule(e,r,n,s,o){return e.registerRule(a=>new ju(r,a,n,s,o))}static getCompiledRuleId(e,r,n){return e.id||r.registerRule(s=>{if(e.id=s,e.match)return new Ou(e.$vscodeTextmateLocation,e.id,e.name,e.match,_e._compileCaptures(e.captures,r,n));if(e.begin===void 0){e.repository&&(n=Ao({},n,e.repository));let o=e.patterns;return o===void 0&&e.include&&(o=[{include:e.include}]),new Vo(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,_e._compilePatterns(o,r,n))}return e.while?new Sr(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,_e._compileCaptures(e.beginCaptures||e.captures,r,n),e.while,_e._compileCaptures(e.whileCaptures||e.captures,r,n),_e._compilePatterns(e.patterns,r,n)):new Cn(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,_e._compileCaptures(e.beginCaptures||e.captures,r,n),e.end,_e._compileCaptures(e.endCaptures||e.captures,r,n),e.applyEndPatternLast,_e._compilePatterns(e.patterns,r,n))}),e.id}static _compileCaptures(e,r,n){let s=[];if(e){let o=0;for(const a in e){if(a==="$vscodeTextmateLocation")continue;const i=parseInt(a,10);i>o&&(o=i)}for(let a=0;a<=o;a++)s[a]=null;for(const a in e){if(a==="$vscodeTextmateLocation")continue;const i=parseInt(a,10);let l=0;e[a].patterns&&(l=_e.getCompiledRuleId(e[a],r,n)),s[i]=_e.createCaptureRule(r,e[a].$vscodeTextmateLocation,e[a].name,e[a].contentName,l)}}return s}static _compilePatterns(e,r,n){let s=[];if(e)for(let o=0,a=e.length;o<a;o++){const i=e[o];let l=-1;if(i.include){const c=Do(i.include);switch(c.kind){case 0:case 1:l=_e.getCompiledRuleId(n[i.include],r,n);break;case 2:let u=n[c.ruleName];u&&(l=_e.getCompiledRuleId(u,r,n));break;case 3:case 4:const d=c.scopeName,p=c.kind===4?c.ruleName:null,m=r.getExternalGrammar(d,n);if(m)if(p){let h=m.repository[p];h&&(l=_e.getCompiledRuleId(h,r,m.repository))}else l=_e.getCompiledRuleId(m.repository.$self,r,m.repository)}}else l=_e.getCompiledRuleId(i,r,n);if(l!==-1){const c=r.getRule(l);let u=!1;if((c instanceof Vo||c instanceof Cn||c instanceof Sr)&&c.hasMissingPatterns&&c.patterns.length===0&&(u=!0),u)continue;s.push(l)}}return{patterns:s,hasMissingPatterns:(e?e.length:0)!==s.length}}},Yt=class Wl{constructor(e,r){v(this,"source");v(this,"ruleId");v(this,"hasAnchor");v(this,"hasBackReferences");v(this,"_anchorCache");if(e&&typeof e=="string"){const n=e.length;let s=0,o=[],a=!1;for(let i=0;i<n;i++)if(e.charAt(i)==="\\"&&i+1<n){const l=e.charAt(i+1);l==="z"?(o.push(e.substring(s,i)),o.push("$(?!\\n)(?<!\\n)"),s=i+2):l!=="A"&&l!=="G"||(a=!0),i++}this.hasAnchor=a,s===0?this.source=e:(o.push(e.substring(s,n)),this.source=o.join(""))}else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=r,typeof this.source=="string"?this.hasBackReferences=Lu.test(this.source):this.hasBackReferences=!1}clone(){return new Wl(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,r){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let n=r.map(s=>e.substring(s.start,s.end));return Mo.lastIndex=0,this.source.replace(Mo,(s,o)=>Ro(n[parseInt(o,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let e,r,n,s,o=[],a=[],i=[],l=[];for(e=0,r=this.source.length;e<r;e++)n=this.source.charAt(e),o[e]=n,a[e]=n,i[e]=n,l[e]=n,n==="\\"&&e+1<r&&(s=this.source.charAt(e+1),s==="A"?(o[e+1]="\uFFFF",a[e+1]="\uFFFF",i[e+1]="A",l[e+1]="A"):s==="G"?(o[e+1]="\uFFFF",a[e+1]="G",i[e+1]="\uFFFF",l[e+1]="G"):(o[e+1]=s,a[e+1]=s,i[e+1]=s,l[e+1]=s),e++);return{A0_G0:o.join(""),A0_G1:a.join(""),A1_G0:i.join(""),A1_G1:l.join("")}}resolveAnchors(e,r){return this.hasAnchor&&this._anchorCache&&typeof this.source=="string"?e?r?this._anchorCache.A1_G1:this._anchorCache.A1_G0:r?this._anchorCache.A0_G1:this._anchorCache.A0_G0:this.source}},Kt=class{constructor(){v(this,"_items");v(this,"_hasAnchors");v(this,"_cached");v(this,"_anchorCache");this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(t){this._items.push(t),this._hasAnchors=this._hasAnchors||t.hasAnchor}unshift(t){this._items.unshift(t),this._hasAnchors=this._hasAnchors||t.hasAnchor}length(){return this._items.length}setSource(t,e){this._items[t].source!==e&&(this._disposeCaches(),this._items[t].setSource(e))}compile(t){if(!this._cached){let e=this._items.map(r=>r.source);this._cached=new zo(t,e,this._items.map(r=>r.ruleId))}return this._cached}compileAG(t,e,r){return this._hasAnchors?e?r?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(t,e,r)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(t,e,r)),this._anchorCache.A1_G0):r?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(t,e,r)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(t,e,r)),this._anchorCache.A0_G0):this.compile(t)}_resolveAnchors(t,e,r){let n=this._items.map(s=>s.resolveAnchors(e,r));return new zo(t,n,this._items.map(s=>s.ruleId))}},zo=class{constructor(t,e,r){v(this,"scanner");this.regExps=e,this.rules=r,this.scanner=t.createOnigScanner(e)}dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const t=[];for(let e=0,r=this.rules.length;e<r;e++)t.push(" - "+this.rules[e]+": "+this.regExps[e]);return t.join(`
12
- `)}findNextMatchSync(t,e,r){const n=this.scanner.findNextMatchSync(t,e,r);return n?{ruleId:this.rules[n.index],captureIndices:n.captureIndices}:null}},An=class{constructor(t,e){this.languageId=t,this.tokenType=e}},$u=(Ze=class{constructor(e,r){v(this,"_defaultAttributes");v(this,"_embeddedLanguagesMatcher");v(this,"_getBasicScopeAttributes",new Lo(e=>{const r=this._scopeToLanguage(e),n=this._toStandardTokenType(e);return new An(r,n)}));this._defaultAttributes=new An(e,8),this._embeddedLanguagesMatcher=new Du(Object.entries(r||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(e){return e===null?Ze._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(e)}_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(e){const r=e.match(Ze.STANDARD_TOKEN_TYPE_REGEXP);if(!r)return 8;switch(r[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"meta.embedded":return 0}throw new Error("Unexpected match for standard token type!")}},v(Ze,"_NULL_SCOPE_METADATA",new An(0,0)),v(Ze,"STANDARD_TOKEN_TYPE_REGEXP",/\b(comment|string|regex|meta\.embedded)\b/),Ze),Du=class{constructor(t){v(this,"values");v(this,"scopesRegExp");if(t.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(t);const e=t.map(([r,n])=>Ro(r));e.sort(),e.reverse(),this.scopesRegExp=new RegExp(`^((${e.join(")|(")}))($|\\.)`,"")}}match(t){if(!this.scopesRegExp)return;const e=t.match(this.scopesRegExp);return e?this.values.get(e[1]):void 0}},Fo=class{constructor(t,e){this.stack=t,this.stoppedEarly=e}};function Bo(t,e,r,n,s,o,a,i){const l=e.content.length;let c=!1,u=-1;if(a){const m=(function(h,y,_,f,w,k){let x=w.beginRuleCapturedEOL?0:-1;const S=[];for(let E=w;E;E=E.pop()){const C=E.getRule(h);C instanceof Sr&&S.push({rule:C,stack:E})}for(let E=S.pop();E;E=S.pop()){const{ruleScanner:C,findOptions:N}=Mu(E.rule,h,E.stack.endRule,_,f===x),I=C.findNextMatchSync(y,f,N);if(!I){w=E.stack.pop();break}if(I.ruleId!==-2){w=E.stack.pop();break}I.captureIndices&&I.captureIndices.length&&(k.produce(E.stack,I.captureIndices[0].start),er(h,y,_,E.stack,k,E.rule.whileCaptures,I.captureIndices),k.produce(E.stack,I.captureIndices[0].end),x=I.captureIndices[0].end,I.captureIndices[0].end>f&&(f=I.captureIndices[0].end,_=!1))}return{stack:w,linePos:f,anchorPosition:x,isFirstLine:_}})(t,e,r,n,s,o);s=m.stack,n=m.linePos,r=m.isFirstLine,u=m.anchorPosition}const d=Date.now();for(;!c;){if(i!==0&&Date.now()-d>i)return new Fo(s,!0);p()}return new Fo(s,!1);function p(){const m=(function(f,w,k,x,S,E){const C=(function(A,V,T,L,G,z){const B=G.getRule(A),{ruleScanner:W,findOptions:te}=Uo(B,A,G.endRule,T,L===z),ee=W.findNextMatchSync(V,L,te);return ee?{captureIndices:ee.captureIndices,matchedRuleId:ee.ruleId}:null})(f,w,k,x,S,E),N=f.getInjections();if(N.length===0)return C;const I=(function(A,V,T,L,G,z,B){let W,te=Number.MAX_VALUE,ee=null,xe=0;const se=z.contentNameScopesList.getScopeNames();for(let pe=0,wt=A.length;pe<wt;pe++){const Je=A[pe];if(!Je.matcher(se))continue;const Bt=V.getRule(Je.ruleId),{ruleScanner:Ts,findOptions:kt}=Uo(Bt,V,null,L,G===B),Ye=Ts.findNextMatchSync(T,G,kt);if(!Ye)continue;const cn=Ye.captureIndices[0].start;if(!(cn>=te)&&(te=cn,ee=Ye.captureIndices,W=Ye.ruleId,xe=Je.priority,te===G))break}return ee?{priorityMatch:xe===-1,captureIndices:ee,matchedRuleId:W}:null})(N,f,w,k,x,S,E);if(!I)return C;if(!C)return I;const D=C.captureIndices[0].start,P=I.captureIndices[0].start;return P<D||I.priorityMatch&&P===D?I:C})(t,e,r,n,s,u);if(!m)return o.produce(s,l),void(c=!0);const h=m.captureIndices,y=m.matchedRuleId,_=!!(h&&h.length>0)&&h[0].end>n;if(y===-1){const f=s.getRule(t);o.produce(s,h[0].start),s=s.withContentNameScopesList(s.nameScopesList),er(t,e,r,s,o,f.endCaptures,h),o.produce(s,h[0].end);const w=s;if(s=s.parent,u=w.getAnchorPos(),!_&&w.getEnterPos()===n)return s=w,o.produce(s,l),void(c=!0)}else{const f=t.getRule(y);o.produce(s,h[0].start);const w=s,k=f.getName(e.content,h),x=s.contentNameScopesList.pushAttributed(k,t);if(s=s.push(y,n,u,h[0].end===l,null,x,x),f instanceof Cn){const S=f;er(t,e,r,s,o,S.beginCaptures,h),o.produce(s,h[0].end),u=h[0].end;const E=S.getContentName(e.content,h),C=x.pushAttributed(E,t);if(s=s.withContentNameScopesList(C),S.endHasBackReferences&&(s=s.withEndRule(S.getEndWithResolvedBackReferences(e.content,h))),!_&&w.hasSameRuleAs(s))return s=s.pop(),o.produce(s,l),void(c=!0)}else if(f instanceof Sr){const S=f;er(t,e,r,s,o,S.beginCaptures,h),o.produce(s,h[0].end),u=h[0].end;const E=S.getContentName(e.content,h),C=x.pushAttributed(E,t);if(s=s.withContentNameScopesList(C),S.whileHasBackReferences&&(s=s.withEndRule(S.getWhileWithResolvedBackReferences(e.content,h))),!_&&w.hasSameRuleAs(s))return s=s.pop(),o.produce(s,l),void(c=!0)}else if(er(t,e,r,s,o,f.captures,h),o.produce(s,h[0].end),s=s.pop(),!_)return s=s.safePop(),o.produce(s,l),void(c=!0)}h[0].end>n&&(n=h[0].end,r=!1)}}function Uo(t,e,r,n,s){return{ruleScanner:t.compileAG(e,r,n,s),findOptions:0}}function Mu(t,e,r,n,s){return{ruleScanner:t.compileWhileAG(e,r,n,s),findOptions:0}}function er(t,e,r,n,s,o,a){if(o.length===0)return;const i=e.content,l=Math.min(o.length,a.length),c=[],u=a[0].end;for(let d=0;d<l;d++){const p=o[d];if(p===null)continue;const m=a[d];if(m.length===0)continue;if(m.start>u)break;for(;c.length>0&&c[c.length-1].endPos<=m.start;)s.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop();if(c.length>0?s.produceFromScopes(c[c.length-1].scopes,m.start):s.produce(n,m.start),p.retokenizeCapturedWithRuleId){const y=p.getName(i,a),_=n.contentNameScopesList.pushAttributed(y,t),f=p.getContentName(i,a),w=_.pushAttributed(f,t),k=n.push(p.retokenizeCapturedWithRuleId,m.start,-1,!1,null,_,w),x=t.createOnigString(i.substring(0,m.end));Bo(t,x,r&&m.start===0,m.start,k,s,!1,0),$o(x);continue}const h=p.getName(i,a);if(h!==null){const y=(c.length>0?c[c.length-1].scopes:n.contentNameScopesList).pushAttributed(h,t);c.push(new Vu(y,m.end))}}for(;c.length>0;)s.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop()}var Vu=class{constructor(t,e){v(this,"scopes");v(this,"endPos");this.scopes=t,this.endPos=e}};function qo(t,e,r,n,s){const o=kr(e,Cr),a=Go.getCompiledRuleId(r,n,s.repository);for(const i of o)t.push({debugSelector:e,matcher:i.matcher,ruleId:a,grammar:s,priority:i.priority})}function Cr(t,e){if(e.length<t.length)return!1;let r=0;return t.every(n=>{for(let s=r;s<e.length;s++)if(Gu(e[s],n))return r=s+1,!0;return!1})}function Gu(t,e){if(!t)return!1;if(t===e)return!0;const r=e.length;return t.length>r&&t.substr(0,r)===e&&t[r]==="."}var zu=class{constructor(t,e,r,n,s,o,a,i){v(this,"_rootId");v(this,"_lastRuleId");v(this,"_ruleId2desc");v(this,"_includedGrammars");v(this,"_grammarRepository");v(this,"_grammar");v(this,"_injections");v(this,"_basicScopeAttributesProvider");v(this,"_tokenTypeMatchers");if(this._rootScopeName=t,this.balancedBracketSelectors=o,this._onigLib=i,this._basicScopeAttributesProvider=new $u(r,n),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=a,this._grammar=Wo(e,null),this._injections=null,this._tokenTypeMatchers=[],s)for(const l of Object.keys(s)){const c=kr(l,Cr);for(const u of c)this._tokenTypeMatchers.push({matcher:u.matcher,type:s[l]})}}get themeProvider(){return this._grammarRepository}dispose(){for(const t of this._ruleId2desc)t&&t.dispose()}createOnigScanner(t){return this._onigLib.createOnigScanner(t)}createOnigString(t){return this._onigLib.createOnigString(t)}getMetadataForScope(t){return this._basicScopeAttributesProvider.getBasicScopeAttributes(t)}_collectInjections(){const t=s=>s===this._rootScopeName?this._grammar:this.getExternalGrammar(s),e=[],r=this._rootScopeName,n=t(r);if(n){const s=n.injections;if(s)for(let a in s)qo(e,a,s[a],this,n);const o=this._grammarRepository.injections(r);o&&o.forEach(a=>{const i=this.getExternalGrammar(a);if(i){const l=i.injectionSelector;l&&qo(e,l,i,this,i)}})}return e.sort((s,o)=>s.priority-o.priority),e}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(t){const e=++this._lastRuleId,r=t(e);return this._ruleId2desc[e]=r,r}getRule(t){return this._ruleId2desc[t]}getExternalGrammar(t,e){if(this._includedGrammars[t])return this._includedGrammars[t];if(this._grammarRepository){const r=this._grammarRepository.lookup(t);if(r)return this._includedGrammars[t]=Wo(r,e&&e.$base),this._includedGrammars[t]}}tokenizeLine(t,e,r=0){const n=this._tokenize(t,e,!1,r);return{tokens:n.lineTokens.getResult(n.ruleStack,n.lineLength),ruleStack:n.ruleStack,stoppedEarly:n.stoppedEarly}}tokenizeLine2(t,e,r=0){const n=this._tokenize(t,e,!0,r);return{tokens:n.lineTokens.getBinaryResult(n.ruleStack,n.lineLength),ruleStack:n.ruleStack,stoppedEarly:n.stoppedEarly}}_tokenize(t,e,r,n){let s;if(this._rootId===-1&&(this._rootId=Go.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections()),e&&e!==In.NULL)s=!1,e.reset();else{s=!0;const c=this._basicScopeAttributesProvider.getDefaultAttributes(),u=this.themeProvider.getDefaults(),d=At.set(0,c.languageId,c.tokenType,null,u.fontStyle,u.foregroundId,u.backgroundId),p=this.getRule(this._rootId).getName(null,null);let m;m=p?tr.createRootAndLookUpScopeName(p,d,this):tr.createRoot("unknown",d),e=new In(null,this._rootId,-1,-1,!1,null,m,m)}t+=`
13
- `;const o=this.createOnigString(t),a=o.content.length,i=new Bu(r,t,this._tokenTypeMatchers,this.balancedBracketSelectors),l=Bo(this,o,s,0,e,i,!0,n);return $o(o),{lineLength:a,lineTokens:i,ruleStack:l.stack,stoppedEarly:l.stoppedEarly}}};function Wo(t,e){return(t=wn(t)).repository=t.repository||{},t.repository.$self={$vscodeTextmateLocation:t.$vscodeTextmateLocation,patterns:t.patterns,name:t.scopeName},t.repository.$base=e||t.repository.$self,t}var tr=class Ge{constructor(e,r,n){this.parent=e,this.scopePath=r,this.tokenAttributes=n}static fromExtension(e,r){let n=e,s=(e==null?void 0:e.scopePath)??null;for(const o of r)s=vn.push(s,o.scopeNames),n=new Ge(n,s,o.encodedTokenAttributes);return n}static createRoot(e,r){return new Ge(null,new vn(null,e),r)}static createRootAndLookUpScopeName(e,r,n){const s=n.getMetadataForScope(e),o=new vn(null,e),a=n.themeProvider.themeMatch(o),i=Ge.mergeAttributes(r,s,a);return new Ge(null,o,i)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(e){return Ge.equals(this,e)}static equals(e,r){for(;;){if(e===r||!e&&!r)return!0;if(!e||!r||e.scopeName!==r.scopeName||e.tokenAttributes!==r.tokenAttributes)return!1;e=e.parent,r=r.parent}}static mergeAttributes(e,r,n){let s=-1,o=0,a=0;return n!==null&&(s=n.fontStyle,o=n.foregroundId,a=n.backgroundId),At.set(e,r.languageId,r.tokenType,null,s,o,a)}pushAttributed(e,r){if(e===null)return this;if(e.indexOf(" ")===-1)return Ge._pushAttributed(this,e,r);const n=e.split(/ /g);let s=this;for(const o of n)s=Ge._pushAttributed(s,o,r);return s}static _pushAttributed(e,r,n){const s=n.getMetadataForScope(r),o=e.scopePath.push(r),a=n.themeProvider.themeMatch(o),i=Ge.mergeAttributes(e.tokenAttributes,s,a);return new Ge(e,o,i)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){var s;const r=[];let n=this;for(;n&&n!==e;)r.push({encodedTokenAttributes:n.tokenAttributes,scopeNames:n.scopePath.getExtensionIfDefined(((s=n.parent)==null?void 0:s.scopePath)??null)}),n=n.parent;return n===e?r.reverse():void 0}},In=(Ce=class{constructor(e,r,n,s,o,a,i,l){v(this,"_stackElementBrand");v(this,"_enterPos");v(this,"_anchorPos");v(this,"depth");this.parent=e,this.ruleId=r,this.beginRuleCapturedEOL=o,this.endRule=a,this.nameScopesList=i,this.contentNameScopesList=l,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=n,this._anchorPos=s}equals(e){return e!==null&&Ce._equals(this,e)}static _equals(e,r){return e===r||!!this._structuralEquals(e,r)&&tr.equals(e.contentNameScopesList,r.contentNameScopesList)}static _structuralEquals(e,r){for(;;){if(e===r||!e&&!r)return!0;if(!e||!r||e.depth!==r.depth||e.ruleId!==r.ruleId||e.endRule!==r.endRule)return!1;e=e.parent,r=r.parent}}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){Ce._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(e,r,n,s,o,a,i){return new Ce(this,e,r,n,s,o,a,i)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){const e=[];return this._writeString(e,0),"["+e.join(",")+"]"}_writeString(e,r){var n,s;return this.parent&&(r=this.parent._writeString(e,r)),e[r++]=`(${this.ruleId}, ${(n=this.nameScopesList)==null?void 0:n.toString()}, ${(s=this.contentNameScopesList)==null?void 0:s.toString()})`,r}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(e){return this.endRule===e?this:new Ce(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,e,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let r=this;for(;r&&r._enterPos===e._enterPos;){if(r.ruleId===e.ruleId)return!0;r=r.parent}return!1}toStateStackFrame(){var e,r,n;return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:((r=this.nameScopesList)==null?void 0:r.getExtensionIfDefined(((e=this.parent)==null?void 0:e.nameScopesList)??null))??[],contentNameScopesList:((n=this.contentNameScopesList)==null?void 0:n.getExtensionIfDefined(this.nameScopesList))??[]}}static pushFrame(e,r){const n=tr.fromExtension((e==null?void 0:e.nameScopesList)??null,r.nameScopesList);return new Ce(e,r.ruleId,r.enterPos??-1,r.anchorPos??-1,r.beginRuleCapturedEOL,r.endRule,n,tr.fromExtension(n,r.contentNameScopesList))}},v(Ce,"NULL",new Ce(null,0,0,0,!1,null,null,null)),Ce),Fu=class{constructor(t,e){v(this,"balancedBracketScopes");v(this,"unbalancedBracketScopes");v(this,"allowAny",!1);this.balancedBracketScopes=t.flatMap(r=>r==="*"?(this.allowAny=!0,[]):kr(r,Cr).map(n=>n.matcher)),this.unbalancedBracketScopes=e.flatMap(r=>kr(r,Cr).map(n=>n.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(t){for(const e of this.unbalancedBracketScopes)if(e(t))return!1;for(const e of this.balancedBracketScopes)if(e(t))return!0;return this.allowAny}},Bu=class{constructor(t,e,r,n){v(this,"_emitBinaryTokens");v(this,"_lineText");v(this,"_tokens");v(this,"_binaryTokens");v(this,"_lastTokenEndIndex");v(this,"_tokenTypeOverrides");this.balancedBracketSelectors=n,this._emitBinaryTokens=t,this._tokenTypeOverrides=r,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}produce(t,e){this.produceFromScopes(t.contentNameScopesList,e)}produceFromScopes(t,e){var n;if(this._lastTokenEndIndex>=e)return;if(this._emitBinaryTokens){let s=(t==null?void 0:t.tokenAttributes)??0,o=!1;if((n=this.balancedBracketSelectors)!=null&&n.matchesAlways&&(o=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const a=(t==null?void 0:t.getScopeNames())??[];for(const i of this._tokenTypeOverrides)i.matcher(a)&&(s=At.set(s,0,i.type,null,-1,0,0));this.balancedBracketSelectors&&(o=this.balancedBracketSelectors.match(a))}return o&&(s=At.set(s,0,8,o,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===s?void(this._lastTokenEndIndex=e):(this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(s),void(this._lastTokenEndIndex=e))}const r=(t==null?void 0:t.getScopeNames())??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:e,scopes:r}),this._lastTokenEndIndex=e}getResult(t,e){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===e-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(t,e),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(t,e){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===e-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(t,e),this._binaryTokens[this._binaryTokens.length-2]=0);const r=new Uint32Array(this._binaryTokens.length);for(let n=0,s=this._binaryTokens.length;n<s;n++)r[n]=this._binaryTokens[n];return r}},Uu=class{constructor(t,e){v(this,"_grammars",new Map);v(this,"_rawGrammars",new Map);v(this,"_injectionGrammars",new Map);v(this,"_theme");this._onigLib=e,this._theme=t}dispose(){for(const t of this._grammars.values())t.dispose()}setTheme(t){this._theme=t}getColorMap(){return this._theme.getColorMap()}addGrammar(t,e){this._rawGrammars.set(t.scopeName,t),e&&this._injectionGrammars.set(t.scopeName,e)}lookup(t){return this._rawGrammars.get(t)}injections(t){return this._injectionGrammars.get(t)}getDefaults(){return this._theme.getDefaults()}themeMatch(t){return this._theme.match(t)}grammarForScopeName(t,e,r,n,s){if(!this._grammars.has(t)){let o=this._rawGrammars.get(t);if(!o)return null;this._grammars.set(t,(function(a,i,l,c,u,d,p,m){return new zu(a,i,l,c,u,d,p,m)})(t,o,e,r,n,s,this,this._onigLib))}return this._grammars.get(t)}},qu=class{constructor(t){v(this,"_options");v(this,"_syncRegistry");v(this,"_ensureGrammarCache");this._options=t,this._syncRegistry=new Uu(wr.createFromRawTheme(t.theme,t.colorMap),t.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(t,e){this._syncRegistry.setTheme(wr.createFromRawTheme(t,e))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(t,e,r){return this.loadGrammarWithConfiguration(t,e,{embeddedLanguages:r})}loadGrammarWithConfiguration(t,e,r){return this._loadGrammar(t,e,r.embeddedLanguages,r.tokenTypes,new Fu(r.balancedBracketSelectors||[],r.unbalancedBracketSelectors||[]))}loadGrammar(t){return this._loadGrammar(t,0,null,null,null)}_loadGrammar(t,e,r,n,s){const o=new Cu(this._syncRegistry,t);for(;o.Q.length>0;)o.Q.map(a=>this._loadSingleGrammar(a.scopeName)),o.processQueue();return this._grammarForScopeName(t,e,r,n,s)}_loadSingleGrammar(t){this._ensureGrammarCache.has(t)||(this._doLoadSingleGrammar(t),this._ensureGrammarCache.set(t,!0))}_doLoadSingleGrammar(t){const e=this._options.loadGrammar(t);if(e){const r=typeof this._options.getInjections=="function"?this._options.getInjections(t):void 0;this._syncRegistry.addGrammar(e,r)}}addGrammar(t,e=[],r=0,n=null){return this._syncRegistry.addGrammar(t,e),this._grammarForScopeName(t.scopeName,r,n)}_grammarForScopeName(t,e=0,r=null,n=null,s=null){return this._syncRegistry.grammarForScopeName(t,e,r,n,s)}},Nn=In.NULL;const Wu=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"],Hu=/["&'<>`]/g,Qu=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Zu=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,Xu=/[|\\{}()[\]^$+*?.]/g,Ho=new WeakMap;function Ju(t,e){return t=t.replace(e.subset?(function(n){let s=Ho.get(n);return s||(s=(function(o){const a=[];let i=-1;for(;++i<o.length;)a.push(o[i].replace(Xu,"\\$&"));return new RegExp("(?:"+a.join("|")+")","g")})(n),Ho.set(n,s)),s})(e.subset):Hu,r),e.subset||e.escapeOnly?t:t.replace(Qu,function(n,s,o){return e.format(1024*(n.charCodeAt(0)-55296)+n.charCodeAt(1)-56320+65536,o.charCodeAt(s+2),e)}).replace(Zu,r);function r(n,s,o){return e.format(n.charCodeAt(0),o.charCodeAt(s+1),e)}}const Yu=/[\dA-Fa-f]/,Ku=/\d/,ep=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],Tn={nbsp:"\xA0",iexcl:"\xA1",cent:"\xA2",pound:"\xA3",curren:"\xA4",yen:"\xA5",brvbar:"\xA6",sect:"\xA7",uml:"\xA8",copy:"\xA9",ordf:"\xAA",laquo:"\xAB",not:"\xAC",shy:"\xAD",reg:"\xAE",macr:"\xAF",deg:"\xB0",plusmn:"\xB1",sup2:"\xB2",sup3:"\xB3",acute:"\xB4",micro:"\xB5",para:"\xB6",middot:"\xB7",cedil:"\xB8",sup1:"\xB9",ordm:"\xBA",raquo:"\xBB",frac14:"\xBC",frac12:"\xBD",frac34:"\xBE",iquest:"\xBF",Agrave:"\xC0",Aacute:"\xC1",Acirc:"\xC2",Atilde:"\xC3",Auml:"\xC4",Aring:"\xC5",AElig:"\xC6",Ccedil:"\xC7",Egrave:"\xC8",Eacute:"\xC9",Ecirc:"\xCA",Euml:"\xCB",Igrave:"\xCC",Iacute:"\xCD",Icirc:"\xCE",Iuml:"\xCF",ETH:"\xD0",Ntilde:"\xD1",Ograve:"\xD2",Oacute:"\xD3",Ocirc:"\xD4",Otilde:"\xD5",Ouml:"\xD6",times:"\xD7",Oslash:"\xD8",Ugrave:"\xD9",Uacute:"\xDA",Ucirc:"\xDB",Uuml:"\xDC",Yacute:"\xDD",THORN:"\xDE",szlig:"\xDF",agrave:"\xE0",aacute:"\xE1",acirc:"\xE2",atilde:"\xE3",auml:"\xE4",aring:"\xE5",aelig:"\xE6",ccedil:"\xE7",egrave:"\xE8",eacute:"\xE9",ecirc:"\xEA",euml:"\xEB",igrave:"\xEC",iacute:"\xED",icirc:"\xEE",iuml:"\xEF",eth:"\xF0",ntilde:"\xF1",ograve:"\xF2",oacute:"\xF3",ocirc:"\xF4",otilde:"\xF5",ouml:"\xF6",divide:"\xF7",oslash:"\xF8",ugrave:"\xF9",uacute:"\xFA",ucirc:"\xFB",uuml:"\xFC",yacute:"\xFD",thorn:"\xFE",yuml:"\xFF",fnof:"\u0192",Alpha:"\u0391",Beta:"\u0392",Gamma:"\u0393",Delta:"\u0394",Epsilon:"\u0395",Zeta:"\u0396",Eta:"\u0397",Theta:"\u0398",Iota:"\u0399",Kappa:"\u039A",Lambda:"\u039B",Mu:"\u039C",Nu:"\u039D",Xi:"\u039E",Omicron:"\u039F",Pi:"\u03A0",Rho:"\u03A1",Sigma:"\u03A3",Tau:"\u03A4",Upsilon:"\u03A5",Phi:"\u03A6",Chi:"\u03A7",Psi:"\u03A8",Omega:"\u03A9",alpha:"\u03B1",beta:"\u03B2",gamma:"\u03B3",delta:"\u03B4",epsilon:"\u03B5",zeta:"\u03B6",eta:"\u03B7",theta:"\u03B8",iota:"\u03B9",kappa:"\u03BA",lambda:"\u03BB",mu:"\u03BC",nu:"\u03BD",xi:"\u03BE",omicron:"\u03BF",pi:"\u03C0",rho:"\u03C1",sigmaf:"\u03C2",sigma:"\u03C3",tau:"\u03C4",upsilon:"\u03C5",phi:"\u03C6",chi:"\u03C7",psi:"\u03C8",omega:"\u03C9",thetasym:"\u03D1",upsih:"\u03D2",piv:"\u03D6",bull:"\u2022",hellip:"\u2026",prime:"\u2032",Prime:"\u2033",oline:"\u203E",frasl:"\u2044",weierp:"\u2118",image:"\u2111",real:"\u211C",trade:"\u2122",alefsym:"\u2135",larr:"\u2190",uarr:"\u2191",rarr:"\u2192",darr:"\u2193",harr:"\u2194",crarr:"\u21B5",lArr:"\u21D0",uArr:"\u21D1",rArr:"\u21D2",dArr:"\u21D3",hArr:"\u21D4",forall:"\u2200",part:"\u2202",exist:"\u2203",empty:"\u2205",nabla:"\u2207",isin:"\u2208",notin:"\u2209",ni:"\u220B",prod:"\u220F",sum:"\u2211",minus:"\u2212",lowast:"\u2217",radic:"\u221A",prop:"\u221D",infin:"\u221E",ang:"\u2220",and:"\u2227",or:"\u2228",cap:"\u2229",cup:"\u222A",int:"\u222B",there4:"\u2234",sim:"\u223C",cong:"\u2245",asymp:"\u2248",ne:"\u2260",equiv:"\u2261",le:"\u2264",ge:"\u2265",sub:"\u2282",sup:"\u2283",nsub:"\u2284",sube:"\u2286",supe:"\u2287",oplus:"\u2295",otimes:"\u2297",perp:"\u22A5",sdot:"\u22C5",lceil:"\u2308",rceil:"\u2309",lfloor:"\u230A",rfloor:"\u230B",lang:"\u2329",rang:"\u232A",loz:"\u25CA",spades:"\u2660",clubs:"\u2663",hearts:"\u2665",diams:"\u2666",quot:'"',amp:"&",lt:"<",gt:">",OElig:"\u0152",oelig:"\u0153",Scaron:"\u0160",scaron:"\u0161",Yuml:"\u0178",circ:"\u02C6",tilde:"\u02DC",ensp:"\u2002",emsp:"\u2003",thinsp:"\u2009",zwnj:"\u200C",zwj:"\u200D",lrm:"\u200E",rlm:"\u200F",ndash:"\u2013",mdash:"\u2014",lsquo:"\u2018",rsquo:"\u2019",sbquo:"\u201A",ldquo:"\u201C",rdquo:"\u201D",bdquo:"\u201E",dagger:"\u2020",Dagger:"\u2021",permil:"\u2030",lsaquo:"\u2039",rsaquo:"\u203A",euro:"\u20AC"},tp=["cent","copy","divide","gt","lt","not","para","times"],Qo={}.hasOwnProperty,Pn={};let Ar;for(Ar in Tn)Qo.call(Tn,Ar)&&(Pn[Tn[Ar]]=Ar);const rp=/[^\dA-Za-z]/;function np(t,e,r){let n,s=(function(o,a,i){const l="&#x"+o.toString(16).toUpperCase();return i&&a&&!Yu.test(String.fromCharCode(a))?l:l+";"})(t,e,r.omitOptionalSemicolons);if((r.useNamedReferences||r.useShortestReferences)&&(n=(function(o,a,i,l){const c=String.fromCharCode(o);if(Qo.call(Pn,c)){const u=Pn[c],d="&"+u;return i&&ep.includes(u)&&!tp.includes(u)&&(!l||a&&a!==61&&rp.test(String.fromCharCode(a)))?d:d+";"}return""})(t,e,r.omitOptionalSemicolons,r.attribute)),(r.useShortestReferences||!n)&&r.useShortestReferences){const o=(function(a,i,l){const c="&#"+String(a);return l&&i&&!Ku.test(String.fromCharCode(i))?c:c+";"})(t,e,r.omitOptionalSemicolons);o.length<s.length&&(s=o)}return n&&(!r.useShortestReferences||n.length<s.length)?n:s}function It(t,e){return Ju(t,Object.assign({format:np},e))}const sp=/^>|^->|<!--|-->|--!>|<!-$/g,op=[">"],ap=["<",">"],ie=Xo(1),Zo=Xo(-1),ip=[];function Xo(t){return function(e,r,n){const s=e?e.children:ip;let o=(r||0)+t,a=s[o];if(!n)for(;a&&Gs(a);)o+=t,a=s[o];return a}}const lp={}.hasOwnProperty;function Jo(t){return function(e,r,n){return lp.call(t,e.tagName)&&t[e.tagName](e,r,n)}}const Rn=Jo({body:function(t,e,r){const n=ie(r,e);return!n||n.type!=="comment"},caption:Ln,colgroup:Ln,dd:function(t,e,r){const n=ie(r,e);return!n||n.type==="element"&&(n.tagName==="dt"||n.tagName==="dd")},dt:function(t,e,r){const n=ie(r,e);return!!(n&&n.type==="element"&&(n.tagName==="dt"||n.tagName==="dd"))},head:Ln,html:function(t,e,r){const n=ie(r,e);return!n||n.type!=="comment"},li:function(t,e,r){const n=ie(r,e);return!n||n.type==="element"&&n.tagName==="li"},optgroup:function(t,e,r){const n=ie(r,e);return!n||n.type==="element"&&n.tagName==="optgroup"},option:function(t,e,r){const n=ie(r,e);return!n||n.type==="element"&&(n.tagName==="option"||n.tagName==="optgroup")},p:function(t,e,r){const n=ie(r,e);return n?n.type==="element"&&(n.tagName==="address"||n.tagName==="article"||n.tagName==="aside"||n.tagName==="blockquote"||n.tagName==="details"||n.tagName==="div"||n.tagName==="dl"||n.tagName==="fieldset"||n.tagName==="figcaption"||n.tagName==="figure"||n.tagName==="footer"||n.tagName==="form"||n.tagName==="h1"||n.tagName==="h2"||n.tagName==="h3"||n.tagName==="h4"||n.tagName==="h5"||n.tagName==="h6"||n.tagName==="header"||n.tagName==="hgroup"||n.tagName==="hr"||n.tagName==="main"||n.tagName==="menu"||n.tagName==="nav"||n.tagName==="ol"||n.tagName==="p"||n.tagName==="pre"||n.tagName==="section"||n.tagName==="table"||n.tagName==="ul"):!r||!(r.type==="element"&&(r.tagName==="a"||r.tagName==="audio"||r.tagName==="del"||r.tagName==="ins"||r.tagName==="map"||r.tagName==="noscript"||r.tagName==="video"))},rp:Yo,rt:Yo,tbody:function(t,e,r){const n=ie(r,e);return!n||n.type==="element"&&(n.tagName==="tbody"||n.tagName==="tfoot")},td:Ko,tfoot:function(t,e,r){return!ie(r,e)},th:Ko,thead:function(t,e,r){const n=ie(r,e);return!!(n&&n.type==="element"&&(n.tagName==="tbody"||n.tagName==="tfoot"))},tr:function(t,e,r){const n=ie(r,e);return!n||n.type==="element"&&n.tagName==="tr"}});function Ln(t,e,r){const n=ie(r,e,!0);return!n||n.type!=="comment"&&!(n.type==="text"&&Gs(n.value.charAt(0)))}function Yo(t,e,r){const n=ie(r,e);return!n||n.type==="element"&&(n.tagName==="rp"||n.tagName==="rt")}function Ko(t,e,r){const n=ie(r,e);return!n||n.type==="element"&&(n.tagName==="td"||n.tagName==="th")}const cp=Jo({body:function(t){const e=ie(t,-1,!0);return!(e&&(e.type==="comment"||e.type==="text"&&Gs(e.value.charAt(0))||e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template")))},colgroup:function(t,e,r){const n=Zo(r,e),s=ie(t,-1,!0);return r&&n&&n.type==="element"&&n.tagName==="colgroup"&&Rn(n,r.children.indexOf(n),r)?!1:!!(s&&s.type==="element"&&s.tagName==="col")},head:function(t){const e=new Set;for(const n of t.children)if(n.type==="element"&&(n.tagName==="base"||n.tagName==="title")){if(e.has(n.tagName))return!1;e.add(n.tagName)}const r=t.children[0];return!r||r.type==="element"},html:function(t){const e=ie(t,-1);return!e||e.type!=="comment"},tbody:function(t,e,r){const n=Zo(r,e),s=ie(t,-1);return r&&n&&n.type==="element"&&(n.tagName==="thead"||n.tagName==="tbody")&&Rn(n,r.children.indexOf(n),r)?!1:!!(s&&s.type==="element"&&s.tagName==="tr")}}),Ir={name:[[`
14
- \f\r &/=>`.split(""),`
15
- \f\r "&'/=>\``.split("")],[`\0
16
- \f\r "&'/<=>`.split(""),`\0
17
- \f\r "&'/<=>\``.split("")]],unquoted:[[`
18
- \f\r &>`.split(""),`\0
19
- \f\r "&'<=>\``.split("")],[`\0
20
- \f\r "&'<=>\``.split(""),`\0
21
- \f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function up(t,e,r){const n=Pl(t.schema,e),s=t.settings.allowParseErrors&&t.schema.space==="html"?0:1,o=t.settings.allowDangerousCharacters?0:1;let a,i=t.quote;if(!n.overloadedBoolean||r!==n.attribute&&r!==""?!n.boolean&&!n.overloadedBoolean||typeof r=="string"&&r!==n.attribute&&r!==""||(r=!!r):r=!0,r==null||r===!1||typeof r=="number"&&Number.isNaN(r))return"";const l=It(n.attribute,Object.assign({},t.settings.characterReferences,{subset:Ir.name[s][o]}));return r===!0?l:(r=Array.isArray(r)?(n.commaSeparated?rg:ng)(r,{padLeft:!t.settings.tightCommaSeparatedLists}):String(r),t.settings.collapseEmptyAttributes&&!r?l:(t.settings.preferUnquoted&&(a=It(r,Object.assign({},t.settings.characterReferences,{attribute:!0,subset:Ir.unquoted[s][o]}))),a!==r&&(t.settings.quoteSmart&&$l(r,i)>$l(r,t.alternative)&&(i=t.alternative),a=i+It(r,Object.assign({},t.settings.characterReferences,{subset:(i==="'"?Ir.single:Ir.double)[s][o],attribute:!0}))+i),l+(a&&"="+a)))}const pp=["<","&"];function ea(t,e,r,n){return!r||r.type!=="element"||r.tagName!=="script"&&r.tagName!=="style"?It(t.value,Object.assign({},n.settings.characterReferences,{subset:pp})):t.value}const dp=(function(t,e){const r=e||{};function n(s,...o){let a=n.invalid;const i=n.handlers;if(s&&Ws.call(s,t)){const l=String(s[t]);a=Ws.call(i,l)?i[l]:n.unknown}if(a)return a.call(this,s,...o)}return n.handlers=r.handlers||{},n.invalid=r.invalid,n.unknown=r.unknown,n})("type",{invalid:function(t){throw new Error("Expected node, not `"+t+"`")},unknown:function(t){throw new Error("Cannot compile unknown node `"+t.type+"`")},handlers:{comment:function(t,e,r,n){return n.settings.bogusComments?"<?"+It(t.value,Object.assign({},n.settings.characterReferences,{subset:op}))+">":"<!--"+t.value.replace(sp,function(s){return It(s,Object.assign({},n.settings.characterReferences,{subset:ap}))})+"-->"},doctype:function(t,e,r,n){return"<!"+(n.settings.upperDoctype?"DOCTYPE":"doctype")+(n.settings.tightDoctype?"":" ")+"html>"},element:function(t,e,r,n){const s=n.schema,o=s.space!=="svg"&&n.settings.omitOptionalTags;let a=s.space==="svg"?n.settings.closeEmptyElements:n.settings.voids.includes(t.tagName.toLowerCase());const i=[];let l;s.space==="html"&&t.tagName==="svg"&&(n.schema=Vs);const c=(function(d,p){const m=[];let h,y=-1;if(p){for(h in p)if(p[h]!==null&&p[h]!==void 0){const _=up(d,h,p[h]);_&&m.push(_)}}for(;++y<m.length;){const _=d.settings.tightAttributes?m[y].charAt(m[y].length-1):void 0;y!==m.length-1&&_!=='"'&&_!=="'"&&(m[y]+=" ")}return m.join("")})(n,t.properties),u=n.all(s.space==="html"&&t.tagName==="template"?t.content:t);return n.schema=s,u&&(a=!1),!c&&o&&cp(t,e,r)||(i.push("<",t.tagName,c?" "+c:""),a&&(s.space==="svg"||n.settings.closeSelfClosing)&&(l=c.charAt(c.length-1),(!n.settings.tightSelfClosing||l==="/"||l&&l!=='"'&&l!=="'")&&i.push(" "),i.push("/")),i.push(">")),i.push(u),a||o&&Rn(t,e,r)||i.push("</"+t.tagName+">"),i.join("")},raw:function(t,e,r,n){return n.settings.allowDangerousHtml?t.value:ea(t,0,r,n)},root:function(t,e,r,n){return n.all(t)},text:ea}}),mp={},hp={},fp=[];function gp(t,e,r){return dp(t,e,r,this)}function _p(t){const e=[],r=t&&t.children||fp;let n=-1;for(;++n<r.length;)e[n]=this.one(r[n],n,t);return e.join("")}function Nr(t,e){const r=typeof t=="string"?{}:{...t.colorReplacements},n=typeof t=="string"?t:t.name;for(const[s,o]of Object.entries((e==null?void 0:e.colorReplacements)||{}))typeof o=="string"?r[s]=o:s===n&&Object.assign(r,o);return r}function tt(t,e){return t&&(e==null?void 0:e[t==null?void 0:t.toLowerCase()])||t}async function ta(t){return Promise.resolve(typeof t=="function"?t():t).then(e=>e.default||e)}function jn(t){return!t||["plaintext","txt","text","plain"].includes(t)}function ra(t){return t==="ansi"||jn(t)}function On(t){return t==="none"}function na(t){return On(t)}function sa(t,e){var n;if(!e)return t;t.properties||(t.properties={}),(n=t.properties).class||(n.class=[]),typeof t.properties.class=="string"&&(t.properties.class=t.properties.class.split(/\s+/g)),Array.isArray(t.properties.class)||(t.properties.class=[]);const r=Array.isArray(e)?e:e.split(/\s+/g);for(const s of r)s&&!t.properties.class.includes(s)&&t.properties.class.push(s);return t}function Tr(t,e=!1){var o;const r=t.split(/(\r?\n)/g);let n=0;const s=[];for(let a=0;a<r.length;a+=2){const i=e?r[a]+(r[a+1]||""):r[a];s.push([i,n]),n+=r[a].length,n+=((o=r[a+1])==null?void 0:o.length)||0}return s}const $n="light-dark()",bp=["color","background-color"];function Pr(t){const e={};if(t.color&&(e.color=t.color),t.bgColor&&(e["background-color"]=t.bgColor),t.fontStyle){t.fontStyle&ge.Italic&&(e["font-style"]="italic"),t.fontStyle&ge.Bold&&(e["font-weight"]="bold");const r=[];t.fontStyle&ge.Underline&&r.push("underline"),t.fontStyle&ge.Strikethrough&&r.push("line-through"),r.length&&(e["text-decoration"]=r.join(" "))}return e}function Dn(t){return typeof t=="string"?t:Object.entries(t).map(([e,r])=>`${e}:${r}`).join(";")}const oa=new WeakMap;function Rr(t,e){oa.set(t,e)}function rr(t){return oa.get(t)}class Nt{constructor(...e){v(this,"_stacks",{});v(this,"lang");if(e.length===2){const[r,n]=e;this.lang=n,this._stacks=r}else{const[r,n,s]=e;this.lang=n,this._stacks={[s]:r}}}get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(e,r){return new Nt(Object.fromEntries((function(n){return Array.isArray(n)?n:[n]})(r).map(n=>[n,Nn])),e)}getInternalStack(e=this.theme){return this._stacks[e]}getScopes(e=this.theme){return(function(r){const n=[],s=new Set;function o(a){var l;if(s.has(a))return;s.add(a);const i=(l=a==null?void 0:a.nameScopesList)==null?void 0:l.scopeName;i&&n.push(i),a.parent&&o(a.parent)}return o(r),n})(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}}function yp(){const t=new WeakMap;function e(r){if(!t.has(r.meta)){let n=function(a){if(typeof a=="number"){if(a<0||a>r.source.length)throw new oe(`Invalid decoration offset: ${a}. Code length: ${r.source.length}`);return{...s.indexToPos(a),offset:a}}{const i=s.lines[a.line];if(i===void 0)throw new oe(`Invalid decoration position ${JSON.stringify(a)}. Lines length: ${s.lines.length}`);let l=a.character;if(l<0&&(l=i.length+l),l<0||l>i.length)throw new oe(`Invalid decoration position ${JSON.stringify(a)}. Line ${a.line} length: ${i.length}`);return{...a,character:l,offset:s.posToIndex(a.line,l)}}};const s=(function(a){const i=Tr(a,!0).map(([l])=>l);return{lines:i,indexToPos:function(l){if(l===a.length)return{line:i.length-1,character:i[i.length-1].length};let c=l,u=0;for(const d of i){if(c<d.length)break;c-=d.length,u++}return{line:u,character:c}},posToIndex:function(l,c){let u=0;for(let d=0;d<l;d++)u+=i[d].length;return u+=c,u}}})(r.source),o=(r.options.decorations||[]).map(a=>({...a,start:n(a.start),end:n(a.end)}));(function(a){for(let i=0;i<a.length;i++){const l=a[i];if(l.start.offset>l.end.offset)throw new oe(`Invalid decoration range: ${JSON.stringify(l.start)} - ${JSON.stringify(l.end)}`);for(let c=i+1;c<a.length;c++){const u=a[c],d=l.start.offset<=u.start.offset&&u.start.offset<l.end.offset,p=l.start.offset<u.end.offset&&u.end.offset<=l.end.offset,m=u.start.offset<=l.start.offset&&l.start.offset<u.end.offset,h=u.start.offset<l.end.offset&&l.end.offset<=u.end.offset;if(d||p||m||h){if(d&&p||m&&h||m&&l.start.offset===l.end.offset||p&&u.start.offset===u.end.offset)continue;throw new oe(`Decorations ${JSON.stringify(l.start)} and ${JSON.stringify(u.start)} intersect.`)}}}})(o),t.set(r.meta,{decorations:o,converter:s,source:r.source})}return t.get(r.meta)}return{name:"shiki:decorations",tokens(r){var o;if(!((o=this.options.decorations)!=null&&o.length))return;const n=e(this).decorations.flatMap(a=>[a.start.offset,a.end.offset]);return(function(a,i){const l=Array.from(i instanceof Set?i:new Set(i)).sort((c,u)=>c-u);return l.length?a.map(c=>c.flatMap(u=>{const d=l.filter(p=>u.offset<p&&p<u.offset+u.content.length).map(p=>p-u.offset).sort((p,m)=>p-m);return d.length?(function(p,m){let h=0;const y=[];for(const _ of m)_>h&&y.push({...p,content:p.content.slice(h,_),offset:p.offset+h}),h=_;return h<p.content.length&&y.push({...p,content:p.content.slice(h),offset:p.offset+h}),y})(u,d):u})):a})(r,n)},code(r){var u;if(!((u=this.options.decorations)!=null&&u.length))return;const n=e(this),s=Array.from(r.children).filter(d=>d.type==="element"&&d.tagName==="span");if(s.length!==n.converter.lines.length)throw new oe(`Number of lines in code element (${s.length}) does not match the number of lines in the source (${n.converter.lines.length}). Failed to apply decorations.`);function o(d,p,m,h){const y=s[d];let _="",f=-1,w=-1;if(p===0&&(f=0),m===0&&(w=0),m===Number.POSITIVE_INFINITY&&(w=y.children.length),f===-1||w===-1)for(let x=0;x<y.children.length;x++)_+=aa(y.children[x]),f===-1&&_.length===p&&(f=x+1),w===-1&&_.length===m&&(w=x+1);if(f===-1)throw new oe(`Failed to find start index for decoration ${JSON.stringify(h.start)}`);if(w===-1)throw new oe(`Failed to find end index for decoration ${JSON.stringify(h.end)}`);const k=y.children.slice(f,w);if(h.alwaysWrap||k.length!==y.children.length)if(h.alwaysWrap||k.length!==1||k[0].type!=="element"){const x={type:"element",tagName:"span",properties:{},children:k};i(x,h,"wrapper"),y.children.splice(f,k.length,x)}else i(k[0],h,"token");else i(y,h,"line")}function a(d,p){s[d]=i(s[d],p,"line")}function i(d,p,m){var _;const h=p.properties||{},y=p.transform||(f=>f);return d.tagName=p.tagName||"span",d.properties={...d.properties,...h,class:d.properties.class},(_=p.properties)!=null&&_.class&&sa(d,p.properties.class),d=y(d,m)||d}const l=[],c=n.decorations.sort((d,p)=>p.start.offset-d.start.offset||d.end.offset-p.end.offset);for(const d of c){const{start:p,end:m}=d;if(p.line===m.line)o(p.line,p.character,m.character,d);else if(p.line<m.line){o(p.line,p.character,Number.POSITIVE_INFINITY,d);for(let h=p.line+1;h<m.line;h++)l.unshift(()=>a(h,d));o(m.line,0,m.character,d)}}l.forEach(d=>d())}}}function aa(t){return t.type==="text"?t.value:t.type==="element"?t.children.map(aa).join(""):""}const xp=[yp()];function Lr(t){const e=(function(r){const n=[],s=[],o=[];for(const a of r)switch(a.enforce){case"pre":n.push(a);break;case"post":s.push(a);break;default:o.push(a)}return{pre:n,post:s,normal:o}})(t.transformers||[]);return[...e.pre,...e.normal,...e.post,...xp]}var pt=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],Mn={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",8:"hidden",9:"strikethrough"};function wp(t,e){const r=t.indexOf("\x1B",e);if(r!==-1&&t[r+1]==="["){const n=t.indexOf("m",r);if(n!==-1)return{sequence:t.substring(r+2,n).split(";"),startPosition:r,position:n+1}}return{position:t.length}}function ia(t){const e=t.shift();if(e==="2"){const r=t.splice(0,3).map(n=>Number.parseInt(n));return r.length!==3||r.some(n=>Number.isNaN(n))?void 0:{type:"rgb",rgb:r}}if(e==="5"){const r=t.shift();if(r)return{type:"table",index:Number(r)}}}function kp(t){const e=[];for(;t.length>0;){const r=t.shift();if(!r)continue;const n=Number.parseInt(r);if(!Number.isNaN(n))if(n===0)e.push({type:"resetAll"});else if(n<=9)Mn[n]&&e.push({type:"setDecoration",value:Mn[n]});else if(n<=29){const s=Mn[n-20];s&&(e.push({type:"resetDecoration",value:s}),s==="dim"&&e.push({type:"resetDecoration",value:"bold"}))}else if(n<=37)e.push({type:"setForegroundColor",value:{type:"named",name:pt[n-30]}});else if(n===38){const s=ia(t);s&&e.push({type:"setForegroundColor",value:s})}else if(n===39)e.push({type:"resetForegroundColor"});else if(n<=47)e.push({type:"setBackgroundColor",value:{type:"named",name:pt[n-40]}});else if(n===48){const s=ia(t);s&&e.push({type:"setBackgroundColor",value:s})}else n===49?e.push({type:"resetBackgroundColor"}):n===53?e.push({type:"setDecoration",value:"overline"}):n===55?e.push({type:"resetDecoration",value:"overline"}):n>=90&&n<=97?e.push({type:"setForegroundColor",value:{type:"named",name:pt[n-90+8]}}):n>=100&&n<=107&&e.push({type:"setBackgroundColor",value:{type:"named",name:pt[n-100+8]}})}return e}var vp={black:"#000000",red:"#bb0000",green:"#00bb00",yellow:"#bbbb00",blue:"#0000bb",magenta:"#ff00ff",cyan:"#00bbbb",white:"#eeeeee",brightBlack:"#555555",brightRed:"#ff5555",brightGreen:"#00ff00",brightYellow:"#ffff55",brightBlue:"#5555ff",brightMagenta:"#ff55ff",brightCyan:"#55ffff",brightWhite:"#ffffff"};function Ep(t=vp){function e(o){return t[o]}function r(o){return`#${o.map(a=>Math.max(0,Math.min(a,255)).toString(16).padStart(2,"0")).join("")}`}let n;function s(o){return(function(){if(n)return n;n=[];for(let l=0;l<pt.length;l++)n.push(e(pt[l]));let a=[0,95,135,175,215,255];for(let l=0;l<6;l++)for(let c=0;c<6;c++)for(let u=0;u<6;u++)n.push(r([a[l],a[c],a[u]]));let i=8;for(let l=0;l<24;l++,i+=10)n.push(r([i,i,i]));return n})()[o]}return{value:function(o){switch(o.type){case"named":return e(o.name);case"rgb":return r(o.rgb);case"table":return s(o.index)}}}}function Sp(t,e,r){const n=Nr(t,r),s=Tr(e),o=Ep(Object.fromEntries(pt.map(i=>{var l;return[i,(l=t.colors)==null?void 0:l[`terminal.ansi${i[0].toUpperCase()}${i.substring(1)}`]]}))),a=(function(){let i=null,l=null,c=new Set;return{parse(u){const d=[];let p=0;do{const m=wp(u,p),h=m.sequence?u.substring(p,m.startPosition):u.substring(p);if(h.length>0&&d.push({value:h,foreground:i,background:l,decorations:new Set(c)}),m.sequence){const y=kp(m.sequence);for(const _ of y)_.type==="resetAll"?(i=null,l=null,c.clear()):_.type==="resetForegroundColor"?i=null:_.type==="resetBackgroundColor"?l=null:_.type==="resetDecoration"&&c.delete(_.value);for(const _ of y)_.type==="setForegroundColor"?i=_.value:_.type==="setBackgroundColor"?l=_.value:_.type==="setDecoration"&&c.add(_.value)}p=m.position}while(p<u.length);return d}}})();return s.map(i=>a.parse(i[0]).map(l=>{let c,u;l.decorations.has("reverse")?(c=l.background?o.value(l.background):t.bg,u=l.foreground?o.value(l.foreground):t.fg):(c=l.foreground?o.value(l.foreground):t.fg,u=l.background?o.value(l.background):void 0),c=tt(c,n),u=tt(u,n),l.decorations.has("dim")&&(c=(function(p){const m=p.match(/#([0-9a-f]{3})([0-9a-f]{3})?([0-9a-f]{2})?/);if(m){if(m[3]){const y=Math.round(Number.parseInt(m[3],16)/2).toString(16).padStart(2,"0");return`#${m[1]}${m[2]}${y}`}return m[2]?`#${m[1]}${m[2]}80`:`#${Array.from(m[1]).map(y=>`${y}${y}`).join("")}80`}const h=p.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return h?`var(${h[1]}-dim)`:p})(c));let d=ge.None;return l.decorations.has("bold")&&(d|=ge.Bold),l.decorations.has("italic")&&(d|=ge.Italic),l.decorations.has("underline")&&(d|=ge.Underline),l.decorations.has("strikethrough")&&(d|=ge.Strikethrough),{content:l.value,offset:i[1],color:c,bgColor:u,fontStyle:d}}))}function Vn(t,e,r={}){const{lang:n="text",theme:s=t.getLoadedThemes()[0]}=r;if(jn(n)||On(s))return Tr(e).map(l=>[{content:l[0],offset:l[1]}]);const{theme:o,colorMap:a}=t.setTheme(s);if(n==="ansi")return Sp(o,e,r);const i=t.getLanguage(n);if(r.grammarState){if(r.grammarState.lang!==i.name)throw new oe(`Grammar state language "${r.grammarState.lang}" does not match highlight language "${i.name}"`);if(!r.grammarState.themes.includes(o.name))throw new oe(`Grammar state themes "${r.grammarState.themes}" do not contain highlight theme "${o.name}"`)}return(function(l,c,u,d,p){const m=jr(l,c,u,d,p),h=new Nt(jr(l,c,u,d,p).stateStack,c.name,u.name);return Rr(m.tokens,h),m.tokens})(e,i,o,a,r)}function jr(t,e,r,n,s){const o=Nr(r,s),{tokenizeMaxLineLength:a=0,tokenizeTimeLimit:i=500}=s,l=Tr(t);let c=s.grammarState?(function(p,m){if(!(p instanceof Nt))throw new oe("Invalid grammar state");return p.getInternalStack(m)})(s.grammarState,r.name)??Nn:s.grammarContextCode!=null?jr(s.grammarContextCode,e,r,n,{...s,grammarState:void 0,grammarContextCode:void 0}).stateStack:Nn,u=[];const d=[];for(let p=0,m=l.length;p<m;p++){const[h,y]=l[p];if(h===""){u=[],d.push([]);continue}if(a>0&&h.length>=a){u=[],d.push([{content:h,offset:y,color:"",fontStyle:0}]);continue}let _,f,w;s.includeExplanation&&(_=e.tokenizeLine(h,c,i),f=_.tokens,w=0);const k=e.tokenizeLine2(h,c,i),x=k.tokens.length/2;for(let S=0;S<x;S++){const E=k.tokens[2*S],C=S+1<x?k.tokens[2*S+2]:h.length;if(E===C)continue;const N=k.tokens[2*S+1],I=tt(n[At.getForeground(N)],o),D=At.getFontStyle(N),P={content:h.substring(E,C),offset:y+E,color:I,fontStyle:D};if(s.includeExplanation){const A=[];if(s.includeExplanation!=="scopeName")for(const T of r.settings){let L;switch(typeof T.scope){case"string":L=T.scope.split(/,/).map(G=>G.trim());break;case"object":L=T.scope;break;default:continue}A.push({settings:T,selectors:L.map(G=>G.split(/ /))})}P.explanation=[];let V=0;for(;E+V<C;){const T=f[w],L=h.substring(T.startIndex,T.endIndex);V+=L.length,P.explanation.push({content:L,scopes:s.includeExplanation==="scopeName"?Cp(T.scopes):Ap(A,T.scopes)}),w+=1}}u.push(P)}d.push(u),u=[],c=k.ruleStack}return{tokens:d,stateStack:c}}function Cp(t){return t.map(e=>({scopeName:e}))}function Ap(t,e){const r=[];for(let n=0,s=e.length;n<s;n++){const o=e[n];r[n]={scopeName:o,themeMatches:Np(t,o,e.slice(0,n))}}return r}function la(t,e){return t===e||e.substring(0,t.length)===t&&e[t.length]==="."}function Ip(t,e,r){if(!la(t[t.length-1],e))return!1;let n=t.length-2,s=r.length-1;for(;n>=0&&s>=0;)la(t[n],r[s])&&(n-=1),s-=1;return n===-1}function Np(t,e,r){const n=[];for(const{selectors:s,settings:o}of t)for(const a of s)if(Ip(a,e,r)){n.push(o);break}return n}function ca(t,e,r){const n=Object.entries(r.themes).filter(l=>l[1]).map(l=>({color:l[0],theme:l[1]})),s=n.map(l=>{const c=Vn(t,e,{...r,theme:l.theme});return{tokens:c,state:rr(c),theme:typeof l.theme=="string"?l.theme:l.theme.name}}),o=(function(...l){const c=l.map(()=>[]),u=l.length;for(let d=0;d<l[0].length;d++){const p=l.map(_=>_[d]),m=c.map(()=>[]);c.forEach((_,f)=>_.push(m[f]));const h=p.map(()=>0),y=p.map(_=>_[0]);for(;y.every(_=>_);){const _=Math.min(...y.map(f=>f.content.length));for(let f=0;f<u;f++){const w=y[f];w.content.length===_?(m[f].push(w),h[f]+=1,y[f]=p[f][h[f]]):(m[f].push({...w,content:w.content.slice(0,_)}),y[f]={...w,content:w.content.slice(_),offset:w.offset+_})}}}return c})(...s.map(l=>l.tokens)),a=o[0].map((l,c)=>l.map((u,d)=>{const p={content:u.content,variants:{},offset:u.offset};return"includeExplanation"in r&&r.includeExplanation&&(p.explanation=u.explanation),o.forEach((m,h)=>{const{content:y,explanation:_,offset:f,...w}=m[c][d];p.variants[n[h].color]=w}),p})),i=s[0].state?new Nt(Object.fromEntries(s.map(l=>{var c;return[l.theme,(c=l.state)==null?void 0:c.getInternalStack(l.theme)]})),s[0].state.lang):void 0;return i&&Rr(a,i),a}function Or(t,e,r){let n,s,o,a,i,l;if("themes"in r){const{defaultColor:c="light",cssVariablePrefix:u="--shiki-",colorsRendering:d="css-vars"}=r,p=Object.entries(r.themes).filter(f=>f[1]).map(f=>({color:f[0],theme:f[1]})).sort((f,w)=>f.color===c?-1:w.color===c?1:0);if(p.length===0)throw new oe("`themes` option must not be empty");const m=ca(t,e,r);if(l=rr(m),c&&$n!==c&&!p.find(f=>f.color===c))throw new oe(`\`themes\` option must contain the defaultColor key \`${c}\``);const h=p.map(f=>t.getTheme(f.theme)),y=p.map(f=>f.color);o=m.map(f=>f.map(w=>(function(k,x,S,E,C="css-vars"){const N={content:k.content,explanation:k.explanation,offset:k.offset},I=x.map(V=>Pr(k.variants[V])),D=new Set(I.flatMap(V=>Object.keys(V))),P={},A=(V,T)=>{const L=T==="color"?"":T==="background-color"?"-bg":`-${T}`;return S+x[V]+(T==="color"?"":L)};return I.forEach((V,T)=>{for(const L of D){const G=V[L]||"inherit";if(T===0&&E&&bp.includes(L))if(E===$n&&I.length>1){const z=x.findIndex(ee=>ee==="light"),B=x.findIndex(ee=>ee==="dark");if(z===-1||B===-1)throw new oe('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');const W=I[z][L]||"inherit",te=I[B][L]||"inherit";P[L]=`light-dark(${W}, ${te})`,C==="css-vars"&&(P[A(T,L)]=G)}else P[L]=G;else C==="css-vars"&&(P[A(T,L)]=G)}}),N.htmlStyle=P,N})(w,y,u,c,d))),l&&Rr(o,l);const _=p.map(f=>Nr(f.theme,r));s=ua(p,h,_,u,c,"fg",d),n=ua(p,h,_,u,c,"bg",d),a=`shiki-themes ${h.map(f=>f.name).join(" ")}`,i=c?void 0:[s,n].join(";")}else{if(!("theme"in r))throw new oe("Invalid options, either `theme` or `themes` must be provided");{const c=Nr(r.theme,r);o=Vn(t,e,r);const u=t.getTheme(r.theme);n=tt(u.bg,c),s=tt(u.fg,c),a=u.name,l=rr(o)}}return{tokens:o,fg:s,bg:n,themeName:a,rootStyle:i,grammarState:l}}function ua(t,e,r,n,s,o,a){return t.map((i,l)=>{const c=tt(e[l][o],r[l])||"inherit",u=`${n+i.color}${o==="bg"?"-bg":""}:${c}`;if(l===0&&s){if(s===$n&&t.length>1){const d=t.findIndex(m=>m.color==="light"),p=t.findIndex(m=>m.color==="dark");if(d===-1||p===-1)throw new oe('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');return`light-dark(${tt(e[d][o],r[d])||"inherit"}, ${tt(e[p][o],r[p])||"inherit"});${u}`}return c}return a==="css-vars"?u:null}).filter(i=>!!i).join(";")}function $r(t,e,r,n={meta:{},options:r,codeToHast:(s,o)=>$r(t,s,o),codeToTokens:(s,o)=>Or(t,s,o)}){var h,y;let s=e;for(const _ of Lr(r))s=((h=_.preprocess)==null?void 0:h.call(n,s,r))||s;let{tokens:o,fg:a,bg:i,themeName:l,rootStyle:c,grammarState:u}=Or(t,s,r);const{mergeWhitespaces:d=!0,mergeSameStyleTokens:p=!1}=r;d===!0?o=(function(_){return _.map(f=>{const w=[];let k="",x=0;return f.forEach((S,E)=>{const C=!(S.fontStyle&&(S.fontStyle&ge.Underline||S.fontStyle&ge.Strikethrough));C&&S.content.match(/^\s+$/)&&f[E+1]?(x||(x=S.offset),k+=S.content):k?(C?w.push({...S,offset:x,content:k+S.content}):w.push({content:k,offset:x},S),x=0,k=""):w.push(S)}),w})})(o):d==="never"&&(o=(function(_){return _.map(f=>f.flatMap(w=>{if(w.content.match(/^\s+$/))return w;const k=w.content.match(/^(\s*)(.*?)(\s*)$/);if(!k)return w;const[,x,S,E]=k;if(!x&&!E)return w;const C=[{...w,offset:w.offset+x.length,content:S}];return x&&C.unshift({content:x,offset:w.offset}),E&&C.push({content:E,offset:w.offset+x.length+S.length}),C}))})(o)),p&&(o=(function(_){return _.map(f=>{const w=[];for(const k of f){if(w.length===0){w.push({...k});continue}const x=w[w.length-1],S=Dn(x.htmlStyle||Pr(x)),E=Dn(k.htmlStyle||Pr(k)),C=x.fontStyle&&(x.fontStyle&ge.Underline||x.fontStyle&ge.Strikethrough),N=k.fontStyle&&(k.fontStyle&ge.Underline||k.fontStyle&ge.Strikethrough);C||N||S!==E?w.push({...k}):x.content+=k.content}return w})})(o));const m={...n,get source(){return s}};for(const _ of Lr(r))o=((y=_.tokens)==null?void 0:y.call(m,o))||o;return(function(_,f,w,k=rr(_)){var T,L,G;const x=Lr(f),S=[],E={type:"root",children:[]},{structure:C="classic",tabindex:N="0"}=f;let I={type:"element",tagName:"pre",properties:{class:`shiki ${f.themeName||""}`,style:f.rootStyle||`background-color:${f.bg};color:${f.fg}`,...N!==!1&&N!=null?{tabindex:N.toString()}:{},...Object.fromEntries(Array.from(Object.entries(f.meta||{})).filter(([z])=>!z.startsWith("_")))},children:[]},D={type:"element",tagName:"code",properties:{},children:S};const P=[],A={...w,structure:C,addClassToHast:sa,get source(){return w.source},get tokens(){return _},get options(){return f},get root(){return E},get pre(){return I},get code(){return D},get lines(){return P}};if(_.forEach((z,B)=>{var ee,xe;B&&(C==="inline"?E.children.push({type:"element",tagName:"br",properties:{},children:[]}):C==="classic"&&S.push({type:"text",value:`
22
- `}));let W={type:"element",tagName:"span",properties:{class:"line"},children:[]},te=0;for(const se of z){let pe={type:"element",tagName:"span",properties:{...se.htmlAttrs},children:[{type:"text",value:se.content}]};const wt=Dn(se.htmlStyle||Pr(se));wt&&(pe.properties.style=wt);for(const Je of x)pe=((ee=Je==null?void 0:Je.span)==null?void 0:ee.call(A,pe,B+1,te,W,se))||pe;C==="inline"?E.children.push(pe):C==="classic"&&W.children.push(pe),te+=se.content.length}if(C==="classic"){for(const se of x)W=((xe=se==null?void 0:se.line)==null?void 0:xe.call(A,W,B+1))||W;P.push(W),S.push(W)}}),C==="classic"){for(const z of x)D=((T=z==null?void 0:z.code)==null?void 0:T.call(A,D))||D;I.children.push(D);for(const z of x)I=((L=z==null?void 0:z.pre)==null?void 0:L.call(A,I))||I;E.children.push(I)}let V=E;for(const z of x)V=((G=z==null?void 0:z.root)==null?void 0:G.call(A,V))||V;return k&&Rr(V,k),V})(o,{...r,fg:a,bg:i,themeName:l,rootStyle:c},m,u)}const Tp=function(t,e){const r=e||mp,n=r.quote||'"',s=n==='"'?"'":'"';if(n!=='"'&&n!=="'")throw new Error("Invalid quote `"+n+"`, expected `'` or `\"`");return{one:gp,all:_p,settings:{omitOptionalTags:r.omitOptionalTags||!1,allowParseErrors:r.allowParseErrors||!1,allowDangerousCharacters:r.allowDangerousCharacters||!1,quoteSmart:r.quoteSmart||!1,preferUnquoted:r.preferUnquoted||!1,tightAttributes:r.tightAttributes||!1,upperDoctype:r.upperDoctype||!1,tightDoctype:r.tightDoctype||!1,bogusComments:r.bogusComments||!1,tightCommaSeparatedLists:r.tightCommaSeparatedLists||!1,tightSelfClosing:r.tightSelfClosing||!1,collapseEmptyAttributes:r.collapseEmptyAttributes||!1,allowDangerousHtml:r.allowDangerousHtml||!1,voids:r.voids||Wu,characterReferences:r.characterReferences||hp,closeSelfClosing:r.closeSelfClosing||!1,closeEmptyElements:r.closeEmptyElements||!1},schema:r.space==="svg"?Vs:Ol,quote:n,alternative:s}.one(Array.isArray(t)?{type:"root",children:t}:t,void 0,void 0)},Pp="#333333",Rp="#bbbbbb",Lp="#fffffe",jp="#1e1e1e",pa="__shiki_resolved";function Gn(t){var i,l,c,u,d;if(t!=null&&t[pa])return t;const e={...t};e.tokenColors&&!e.settings&&(e.settings=e.tokenColors,delete e.tokenColors),e.type||(e.type="dark"),e.colorReplacements={...e.colorReplacements},e.settings||(e.settings=[]);let{bg:r,fg:n}=e;if(!r||!n){const p=e.settings?e.settings.find(m=>!m.name&&!m.scope):void 0;(i=p==null?void 0:p.settings)!=null&&i.foreground&&(n=p.settings.foreground),(l=p==null?void 0:p.settings)!=null&&l.background&&(r=p.settings.background),!n&&((c=e==null?void 0:e.colors)!=null&&c["editor.foreground"])&&(n=e.colors["editor.foreground"]),!r&&((u=e==null?void 0:e.colors)!=null&&u["editor.background"])&&(r=e.colors["editor.background"]),n||(n=e.type==="light"?Pp:Rp),r||(r=e.type==="light"?Lp:jp),e.fg=n,e.bg=r}e.settings[0]&&e.settings[0].settings&&!e.settings[0].scope||e.settings.unshift({settings:{foreground:e.fg,background:e.bg}});let s=0;const o=new Map;function a(p){var h;if(o.has(p))return o.get(p);s+=1;const m=`#${s.toString(16).padStart(8,"0").toLowerCase()}`;return(h=e.colorReplacements)!=null&&h[`#${m}`]?a(p):(o.set(p,m),m)}e.settings=e.settings.map(p=>{var _,f;const m=((_=p.settings)==null?void 0:_.foreground)&&!p.settings.foreground.startsWith("#"),h=((f=p.settings)==null?void 0:f.background)&&!p.settings.background.startsWith("#");if(!m&&!h)return p;const y={...p,settings:{...p.settings}};if(m){const w=a(p.settings.foreground);e.colorReplacements[w]=p.settings.foreground,y.settings.foreground=w}if(h){const w=a(p.settings.background);e.colorReplacements[w]=p.settings.background,y.settings.background=w}return y});for(const p of Object.keys(e.colors||{}))if((p==="editor.foreground"||p==="editor.background"||p.startsWith("terminal.ansi"))&&!((d=e.colors[p])!=null&&d.startsWith("#"))){const m=a(e.colors[p]);e.colorReplacements[m]=e.colors[p],e.colors[p]=m}return Object.defineProperty(e,pa,{enumerable:!1,writable:!1,value:!0}),e}async function da(t){return Array.from(new Set((await Promise.all(t.filter(e=>!ra(e)).map(async e=>await ta(e).then(r=>Array.isArray(r)?r:[r])))).flat()))}async function ma(t){return(await Promise.all(t.map(async e=>na(e)?null:Gn(await ta(e))))).filter(e=>!!e)}let Tt=class extends Error{constructor(t){super(t),this.name="ShikiError"}};class Op extends qu{constructor(r,n,s,o={}){super(r);v(this,"_resolvedThemes",new Map);v(this,"_resolvedGrammars",new Map);v(this,"_langMap",new Map);v(this,"_langGraph",new Map);v(this,"_textmateThemeCache",new WeakMap);v(this,"_loadedThemesCache",null);v(this,"_loadedLanguagesCache",null);this._resolver=r,this._themes=n,this._langs=s,this._alias=o,this._themes.map(a=>this.loadTheme(a)),this.loadLanguages(this._langs)}getTheme(r){return typeof r=="string"?this._resolvedThemes.get(r):this.loadTheme(r)}loadTheme(r){const n=Gn(r);return n.name&&(this._resolvedThemes.set(n.name,n),this._loadedThemesCache=null),n}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(r){let n=this._textmateThemeCache.get(r);n||(n=wr.createFromRawTheme(r),this._textmateThemeCache.set(r,n)),this._syncRegistry.setTheme(n)}getGrammar(r){if(this._alias[r]){const n=new Set([r]);for(;this._alias[r];){if(r=this._alias[r],n.has(r))throw new Tt(`Circular alias \`${Array.from(n).join(" -> ")} -> ${r}\``);n.add(r)}}return this._resolvedGrammars.get(r)}loadLanguage(r){var a,i,l,c;if(this.getGrammar(r.name))return;const n=new Set([...this._langMap.values()].filter(u=>{var d;return(d=u.embeddedLangsLazy)==null?void 0:d.includes(r.name)}));this._resolver.addLanguage(r);const s={balancedBracketSelectors:r.balancedBracketSelectors||["*"],unbalancedBracketSelectors:r.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(r.scopeName,r);const o=this.loadGrammarWithConfiguration(r.scopeName,1,s);if(o.name=r.name,this._resolvedGrammars.set(r.name,o),r.aliases&&r.aliases.forEach(u=>{this._alias[u]=r.name}),this._loadedLanguagesCache=null,n.size)for(const u of n)this._resolvedGrammars.delete(u.name),this._loadedLanguagesCache=null,(i=(a=this._syncRegistry)==null?void 0:a._injectionGrammars)==null||i.delete(u.scopeName),(c=(l=this._syncRegistry)==null?void 0:l._grammars)==null||c.delete(u.scopeName),this.loadLanguage(this._langMap.get(u.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(r){for(const o of r)this.resolveEmbeddedLanguages(o);const n=Array.from(this._langGraph.entries()),s=n.filter(([o,a])=>!a);if(s.length){const o=n.filter(([a,i])=>{var l;return i&&((l=i.embeddedLangs)==null?void 0:l.some(c=>s.map(([u])=>u).includes(c)))}).filter(a=>!s.includes(a));throw new Tt(`Missing languages ${s.map(([a])=>`\`${a}\``).join(", ")}, required by ${o.map(([a])=>`\`${a}\``).join(", ")}`)}for(const[o,a]of n)this._resolver.addLanguage(a);for(const[o,a]of n)this.loadLanguage(a)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(r){if(this._langMap.set(r.name,r),this._langGraph.set(r.name,r),r.embeddedLangs)for(const n of r.embeddedLangs)this._langGraph.set(n,this._langMap.get(n))}}class $p{constructor(e,r){v(this,"_langs",new Map);v(this,"_scopeToLang",new Map);v(this,"_injections",new Map);v(this,"_onigLib");this._onigLib={createOnigScanner:n=>e.createScanner(n),createOnigString:n=>e.createString(n)},r.forEach(n=>this.addLanguage(n))}get onigLib(){return this._onigLib}getLangRegistration(e){return this._langs.get(e)}loadGrammar(e){return this._scopeToLang.get(e)}addLanguage(e){this._langs.set(e.name,e),e.aliases&&e.aliases.forEach(r=>{this._langs.set(r,e)}),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach(r=>{this._injections.get(r)||this._injections.set(r,[]),this._injections.get(r).push(e.scopeName)})}getInjections(e){const r=e.split(".");let n=[];for(let s=1;s<=r.length;s++){const o=r.slice(0,s).join(".");n=[...n,...this._injections.get(o)||[]]}return n}}let nr=0;async function Dp(t){t.engine||(function(s,o=3){o>3||console.trace(`[SHIKI DEPRECATE]: ${s}`)})("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");const[e,r,n]=await Promise.all([ma(t.themes||[]),da(t.langs||[]),t.engine]);return(function(s){nr+=1,s.warnings!==!1&&nr>=10&&nr%10==0&&console.warn(`[Shiki] ${nr} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let o=!1;if(!s.engine)throw new Tt("`engine` option is required for synchronous mode");const a=(s.langs||[]).flat(1),i=(s.themes||[]).flat(1).map(Gn),l=new $p(s.engine,a),c=new Op(l,i,a,s.langAlias);let u;function d(_){if(_==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};h();const f=c.getTheme(_);if(!f)throw new Tt(`Theme \`${_}\` not found, you may need to load it first`);return f}function p(..._){h(),c.loadLanguages(_.flat(1))}function m(..._){h();for(const f of _.flat(1))c.loadTheme(f)}function h(){if(o)throw new Tt("Shiki instance has been disposed")}function y(){o||(o=!0,c.dispose(),nr-=1)}return{setTheme:function(_){h();const f=d(_);return u!==_&&(c.setTheme(f),u=_),{theme:f,colorMap:c.getColorMap()}},getTheme:d,getLanguage:function(_){h();const f=c.getGrammar(typeof _=="string"?_:_.name);if(!f)throw new Tt(`Language \`${_}\` not found, you may need to load it first`);return f},getLoadedThemes:function(){return h(),c.getLoadedThemes()},getLoadedLanguages:function(){return h(),c.getLoadedLanguages()},loadLanguage:async function(..._){return p(await da(_))},loadLanguageSync:p,loadTheme:async function(..._){return h(),m(await ma(_))},loadThemeSync:m,dispose:y,[Symbol.dispose]:y}})({...t,themes:e,langs:r,engine:n})}async function Mp(t){const e=await Dp(t);return{getLastGrammarState:(...r)=>(function(...n){if(n.length===2)return rr(n[1]);const[s,o,a={}]=n,{lang:i="text",theme:l=s.getLoadedThemes()[0]}=a;if(jn(i)||On(l))throw new oe("Plain language does not have grammar state");if(i==="ansi")throw new oe("ANSI language does not have grammar state");const{theme:c,colorMap:u}=s.setTheme(l),d=s.getLanguage(i);return new Nt(jr(o,d,c,u,a).stateStack,d.name,c.name)})(e,...r),codeToTokensBase:(r,n)=>Vn(e,r,n),codeToTokensWithThemes:(r,n)=>ca(e,r,n),codeToTokens:(r,n)=>Or(e,r,n),codeToHast:(r,n)=>$r(e,r,n),codeToHtml:(r,n)=>(function(s,o,a){var c;const i={meta:{},options:a,codeToHast:(u,d)=>$r(s,u,d),codeToTokens:(u,d)=>Or(s,u,d)};let l=Tp($r(s,o,a,i));for(const u of Lr(a))l=((c=u.postprocess)==null?void 0:c.call(i,l,a))||l;return l})(e,r,n),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...e,getInternalContext:()=>e}}function Vp(t){const e=t.langs,r=t.themes,n=t.engine;return async function(s){function o(u){var d;if(typeof u=="string"){if(ra(u))return[];u=((d=s.langAlias)==null?void 0:d[u])||u;const p=e[u];if(!p)throw new oe(`Language \`${u}\` is not included in this bundle. You may want to load it from external source.`);return p}return u}function a(u){if(na(u))return"none";if(typeof u=="string"){const d=r[u];if(!d)throw new oe(`Theme \`${u}\` is not included in this bundle. You may want to load it from external source.`);return d}return u}const i=(s.themes??[]).map(u=>a(u)),l=(s.langs??[]).map(u=>o(u)),c=await Mp({engine:s.engine??n(),...s,themes:i,langs:l});return{...c,loadLanguage:(...u)=>c.loadLanguage(...u.map(o)),loadTheme:(...u)=>c.loadTheme(...u.map(a)),getBundledLanguages:()=>e,getBundledThemes:()=>r}}}const ha=[{id:"abap",name:"ABAP",import:()=>b(()=>import("./abap-DnJxzdy9.js"),[],import.meta.url)},{id:"actionscript-3",name:"ActionScript",import:()=>b(()=>import("./actionscript-3-CKUqbIUM.js"),[],import.meta.url)},{id:"ada",name:"Ada",import:()=>b(()=>import("./ada-iG1FnIvR.js"),[],import.meta.url)},{id:"angular-html",name:"Angular HTML",import:()=>b(()=>import("./angular-html-BZhSV2-l.js").then(t=>t.f),__vite__mapDeps([0,1,2,3]),import.meta.url)},{id:"angular-ts",name:"Angular TypeScript",import:()=>b(()=>import("./angular-ts-DRQ-j7PL.js"),__vite__mapDeps([4,0,1,2,3,5]),import.meta.url)},{id:"apache",name:"Apache Conf",import:()=>b(()=>import("./apache-CdTKWnKT.js"),[],import.meta.url)},{id:"apex",name:"Apex",import:()=>b(()=>import("./apex-3xxtq2mv.js"),[],import.meta.url)},{id:"apl",name:"APL",import:()=>b(()=>import("./apl-BnBkWLuz.js"),__vite__mapDeps([6,1,2,3,7,8,9]),import.meta.url)},{id:"applescript",name:"AppleScript",import:()=>b(()=>import("./applescript-BlLNmGTp.js"),[],import.meta.url)},{id:"ara",name:"Ara",import:()=>b(()=>import("./ara-Ba3fhlsS.js"),[],import.meta.url)},{id:"asciidoc",name:"AsciiDoc",aliases:["adoc"],import:()=>b(()=>import("./asciidoc-XTVL4-GN.js"),[],import.meta.url)},{id:"asm",name:"Assembly",import:()=>b(()=>import("./asm-CHX6lpGW.js"),[],import.meta.url)},{id:"astro",name:"Astro",import:()=>b(()=>import("./astro-CXYfh229.js"),__vite__mapDeps([10,9,2,11,3,12,13]),import.meta.url)},{id:"awk",name:"AWK",import:()=>b(()=>import("./awk-XRrwoikR.js"),[],import.meta.url)},{id:"ballerina",name:"Ballerina",import:()=>b(()=>import("./ballerina-Dh0JsEtz.js"),[],import.meta.url)},{id:"bat",name:"Batch File",aliases:["batch"],import:()=>b(()=>import("./bat-BVu0TwaT.js"),[],import.meta.url)},{id:"beancount",name:"Beancount",import:()=>b(()=>import("./beancount-BuQJKJpV.js"),[],import.meta.url)},{id:"berry",name:"Berry",aliases:["be"],import:()=>b(()=>import("./berry-D4qT7XM1.js"),[],import.meta.url)},{id:"bibtex",name:"BibTeX",import:()=>b(()=>import("./bibtex-CGjxJ4Zd.js"),[],import.meta.url)},{id:"bicep",name:"Bicep",import:()=>b(()=>import("./bicep-DysT5qaJ.js"),[],import.meta.url)},{id:"blade",name:"Blade",import:()=>b(()=>import("./blade-CkGRa-l8.js"),__vite__mapDeps([14,15,1,2,3,7,8,16,9]),import.meta.url)},{id:"bsl",name:"1C (Enterprise)",aliases:["1c"],import:()=>b(()=>import("./bsl-DGicdwC0.js"),__vite__mapDeps([17,18]),import.meta.url)},{id:"c",name:"C",import:()=>b(()=>import("./c-BmJt9k-y.js"),[],import.meta.url)},{id:"cadence",name:"Cadence",aliases:["cdc"],import:()=>b(()=>import("./cadence-CWn_mfEc.js"),[],import.meta.url)},{id:"cairo",name:"Cairo",import:()=>b(()=>import("./cairo-Dz8fl918.js"),__vite__mapDeps([19,20]),import.meta.url)},{id:"clarity",name:"Clarity",import:()=>b(()=>import("./clarity-DF5_RAtY.js"),[],import.meta.url)},{id:"clojure",name:"Clojure",aliases:["clj"],import:()=>b(()=>import("./clojure-BjI0Knrv.js"),[],import.meta.url)},{id:"cmake",name:"CMake",import:()=>b(()=>import("./cmake-BYiqpiH1.js"),[],import.meta.url)},{id:"cobol",name:"COBOL",import:()=>b(()=>import("./cobol-Dt3m7Jkx.js"),__vite__mapDeps([21,1,2,3,8]),import.meta.url)},{id:"codeowners",name:"CODEOWNERS",import:()=>b(()=>import("./codeowners-L91meNbn.js"),[],import.meta.url)},{id:"codeql",name:"CodeQL",aliases:["ql"],import:()=>b(()=>import("./codeql-Cd-JFsJB.js"),[],import.meta.url)},{id:"coffee",name:"CoffeeScript",aliases:["coffeescript"],import:()=>b(()=>import("./coffee-DgxxYT5L.js"),__vite__mapDeps([22,2]),import.meta.url)},{id:"common-lisp",name:"Common Lisp",aliases:["lisp"],import:()=>b(()=>import("./common-lisp-DOi1njVG.js"),[],import.meta.url)},{id:"coq",name:"Coq",import:()=>b(()=>import("./coq-BfbrVLCY.js"),[],import.meta.url)},{id:"cpp",name:"C++",aliases:["c++"],import:()=>b(()=>import("./cpp-BmKY377x.js"),__vite__mapDeps([23,24,25,26,16]),import.meta.url)},{id:"crystal",name:"Crystal",import:()=>b(()=>import("./crystal-DB6V90z1.js"),__vite__mapDeps([27,1,2,3,16,26,28]),import.meta.url)},{id:"csharp",name:"C#",aliases:["c#","cs"],import:()=>b(()=>import("./csharp-yFVQ185C.js"),[],import.meta.url)},{id:"css",name:"CSS",import:()=>b(()=>import("./css-l46fsARh.js"),[],import.meta.url)},{id:"csv",name:"CSV",import:()=>b(()=>import("./csv-DXKU4rRd.js"),[],import.meta.url)},{id:"cue",name:"CUE",import:()=>b(()=>import("./cue-zmT78Agv.js"),[],import.meta.url)},{id:"cypher",name:"Cypher",aliases:["cql"],import:()=>b(()=>import("./cypher-bkHSskm3.js"),[],import.meta.url)},{id:"d",name:"D",import:()=>b(()=>import("./d-vs9xsbRV.js"),[],import.meta.url)},{id:"dart",name:"Dart",import:()=>b(()=>import("./dart-BMkYYGiN.js"),[],import.meta.url)},{id:"dax",name:"DAX",import:()=>b(()=>import("./dax-D135z3aS.js"),[],import.meta.url)},{id:"desktop",name:"Desktop",import:()=>b(()=>import("./desktop-CigPEpQ5.js"),[],import.meta.url)},{id:"diff",name:"Diff",import:()=>b(()=>import("./diff-Beq1YlA8.js"),[],import.meta.url)},{id:"docker",name:"Dockerfile",aliases:["dockerfile"],import:()=>b(()=>import("./docker-V5Al5bpF.js"),[],import.meta.url)},{id:"dotenv",name:"dotEnv",import:()=>b(()=>import("./dotenv-D9G8sA2m.js"),[],import.meta.url)},{id:"dream-maker",name:"Dream Maker",import:()=>b(()=>import("./dream-maker-BsoKROiO.js"),[],import.meta.url)},{id:"edge",name:"Edge",import:()=>b(()=>import("./edge-Brl-y200.js"),__vite__mapDeps([29,11,1,2,3,15]),import.meta.url)},{id:"elixir",name:"Elixir",import:()=>b(()=>import("./elixir-CGzfkNtR.js"),__vite__mapDeps([30,1,2,3]),import.meta.url)},{id:"elm",name:"Elm",import:()=>b(()=>import("./elm-DmpuOW2E.js"),__vite__mapDeps([31,25,26]),import.meta.url)},{id:"emacs-lisp",name:"Emacs Lisp",aliases:["elisp"],import:()=>b(()=>import("./emacs-lisp-BcpYGiHp.js"),[],import.meta.url)},{id:"erb",name:"ERB",import:()=>b(()=>import("./erb-BNAqOH5i.js"),__vite__mapDeps([32,1,2,3,33,34,7,8,16,35,11,36,13,23,24,25,26,28,37,38]),import.meta.url)},{id:"erlang",name:"Erlang",aliases:["erl"],import:()=>b(()=>import("./erlang-DAw79KxH.js"),__vite__mapDeps([39,40]),import.meta.url)},{id:"fennel",name:"Fennel",import:()=>b(()=>import("./fennel-qzPJJAAI.js"),[],import.meta.url)},{id:"fish",name:"Fish",import:()=>b(()=>import("./fish-BTv9qkVe.js"),[],import.meta.url)},{id:"fluent",name:"Fluent",aliases:["ftl"],import:()=>b(()=>import("./fluent-BsukS3Co.js"),[],import.meta.url)},{id:"fortran-fixed-form",name:"Fortran (Fixed Form)",aliases:["f","for","f77"],import:()=>b(()=>import("./fortran-fixed-form-D_2otJTs.js"),__vite__mapDeps([41,42]),import.meta.url)},{id:"fortran-free-form",name:"Fortran (Free Form)",aliases:["f90","f95","f03","f08","f18"],import:()=>b(()=>import("./fortran-free-form-Ix_0F1Zz.js"),[],import.meta.url)},{id:"fsharp",name:"F#",aliases:["f#","fs"],import:()=>b(()=>import("./fsharp-DmSnwM-W.js"),__vite__mapDeps([43,40]),import.meta.url)},{id:"gdresource",name:"GDResource",import:()=>b(()=>import("./gdresource-BLuZCTp3.js"),__vite__mapDeps([44,45,46]),import.meta.url)},{id:"gdscript",name:"GDScript",import:()=>b(()=>import("./gdscript-fffAh1pn.js"),[],import.meta.url)},{id:"gdshader",name:"GDShader",import:()=>b(()=>import("./gdshader-BC7WJXp9.js"),[],import.meta.url)},{id:"genie",name:"Genie",import:()=>b(()=>import("./genie-IZOju1hG.js"),[],import.meta.url)},{id:"gherkin",name:"Gherkin",import:()=>b(()=>import("./gherkin-DUpgZfGr.js"),[],import.meta.url)},{id:"git-commit",name:"Git Commit Message",import:()=>b(()=>import("./git-commit-Bptnmh-c.js"),__vite__mapDeps([47,48]),import.meta.url)},{id:"git-rebase",name:"Git Rebase Message",import:()=>b(()=>import("./git-rebase-CqNhyBhE.js"),__vite__mapDeps([49,28]),import.meta.url)},{id:"gleam",name:"Gleam",import:()=>b(()=>import("./gleam-CCCEh_av.js"),[],import.meta.url)},{id:"glimmer-js",name:"Glimmer JS",aliases:["gjs"],import:()=>b(()=>import("./glimmer-js-CamsSOgS.js"),__vite__mapDeps([50,2,11,3,1]),import.meta.url)},{id:"glimmer-ts",name:"Glimmer TS",aliases:["gts"],import:()=>b(()=>import("./glimmer-ts-DpQMos9P.js"),__vite__mapDeps([51,11,3,2,1]),import.meta.url)},{id:"glsl",name:"GLSL",import:()=>b(()=>import("./glsl-BDbjGBhJ.js"),__vite__mapDeps([25,26]),import.meta.url)},{id:"gnuplot",name:"Gnuplot",import:()=>b(()=>import("./gnuplot-D0FoiB-W.js"),[],import.meta.url)},{id:"go",name:"Go",import:()=>b(()=>import("./go-BR7YH85S.js"),[],import.meta.url)},{id:"graphql",name:"GraphQL",aliases:["gql"],import:()=>b(()=>import("./graphql-DMns_A3G.js"),__vite__mapDeps([35,2,11,36,13]),import.meta.url)},{id:"groovy",name:"Groovy",import:()=>b(()=>import("./groovy-D9sPn4Z-.js"),[],import.meta.url)},{id:"hack",name:"Hack",import:()=>b(()=>import("./hack-CXH7pT2m.js"),__vite__mapDeps([52,1,2,3,16]),import.meta.url)},{id:"haml",name:"Ruby Haml",import:()=>b(()=>import("./haml-DiuhmbKg.js"),__vite__mapDeps([34,2,3]),import.meta.url)},{id:"handlebars",name:"Handlebars",aliases:["hbs"],import:()=>b(()=>import("./handlebars-PuluTGUb.js"),__vite__mapDeps([53,1,2,3,38]),import.meta.url)},{id:"haskell",name:"Haskell",aliases:["hs"],import:()=>b(()=>import("./haskell-Cp0NQEkn.js"),[],import.meta.url)},{id:"haxe",name:"Haxe",import:()=>b(()=>import("./haxe-D-PmAGDa.js"),[],import.meta.url)},{id:"hcl",name:"HashiCorp HCL",import:()=>b(()=>import("./hcl-DRMo6eis.js"),[],import.meta.url)},{id:"hjson",name:"Hjson",import:()=>b(()=>import("./hjson-BPEpXUFQ.js"),[],import.meta.url)},{id:"hlsl",name:"HLSL",import:()=>b(()=>import("./hlsl-B-PjNM4a.js"),[],import.meta.url)},{id:"html",name:"HTML",import:()=>b(()=>import("./html-ReiWYoHo.js"),__vite__mapDeps([1,2,3]),import.meta.url)},{id:"html-derivative",name:"HTML (Derivative)",import:()=>b(()=>import("./html-derivative-BEFkAAPd.js"),__vite__mapDeps([15,1,2,3]),import.meta.url)},{id:"http",name:"HTTP",import:()=>b(()=>import("./http-BPFbEDC3.js"),__vite__mapDeps([54,28,9,7,8,35,2,11,36,13]),import.meta.url)},{id:"hxml",name:"HXML",import:()=>b(()=>import("./hxml-DB3_nACV.js"),__vite__mapDeps([55,56]),import.meta.url)},{id:"hy",name:"Hy",import:()=>b(()=>import("./hy-CLIvbAhW.js"),[],import.meta.url)},{id:"imba",name:"Imba",import:()=>b(()=>import("./imba-B-tO30Ge.js"),[],import.meta.url)},{id:"ini",name:"INI",aliases:["properties"],import:()=>b(()=>import("./ini-Bpxu4Zsc.js"),[],import.meta.url)},{id:"java",name:"Java",import:()=>b(()=>import("./java-DtRXFtDl.js"),[],import.meta.url)},{id:"javascript",name:"JavaScript",aliases:["js"],import:()=>b(()=>import("./javascript-CY0YvwoL.js"),[],import.meta.url)},{id:"jinja",name:"Jinja",import:()=>b(()=>import("./jinja-CXJbPSuL.js"),__vite__mapDeps([57,1,2,3]),import.meta.url)},{id:"jison",name:"Jison",import:()=>b(()=>import("./jison-iRP-Iv-P.js"),__vite__mapDeps([58,2]),import.meta.url)},{id:"json",name:"JSON",import:()=>b(()=>import("./json-LWN7Ml79.js"),[],import.meta.url)},{id:"json5",name:"JSON5",import:()=>b(()=>import("./json5-CgCB487x.js"),[],import.meta.url)},{id:"jsonc",name:"JSON with Comments",import:()=>b(()=>import("./jsonc-BXrjvC_e.js"),[],import.meta.url)},{id:"jsonl",name:"JSON Lines",import:()=>b(()=>import("./jsonl-D5dm1SHP.js"),[],import.meta.url)},{id:"jsonnet",name:"Jsonnet",import:()=>b(()=>import("./jsonnet-B60UklUs.js"),[],import.meta.url)},{id:"jssm",name:"JSSM",aliases:["fsl"],import:()=>b(()=>import("./jssm-CsqlGknB.js"),[],import.meta.url)},{id:"jsx",name:"JSX",import:()=>b(()=>import("./jsx-g2NrEQII.js"),[],import.meta.url)},{id:"julia",name:"Julia",aliases:["jl"],import:()=>b(()=>import("./julia-BabrhEml.js"),__vite__mapDeps([59,23,24,25,26,16,20,2,60]),import.meta.url)},{id:"kotlin",name:"Kotlin",aliases:["kt","kts"],import:()=>b(()=>import("./kotlin-DiV2Dt9D.js"),[],import.meta.url)},{id:"kusto",name:"Kusto",aliases:["kql"],import:()=>b(()=>import("./kusto-KSLuQd98.js"),[],import.meta.url)},{id:"latex",name:"LaTeX",import:()=>b(()=>import("./latex-CCwiU5tQ.js"),__vite__mapDeps([61,62,60]),import.meta.url)},{id:"lean",name:"Lean 4",aliases:["lean4"],import:()=>b(()=>import("./lean-C20waPKk.js"),[],import.meta.url)},{id:"less",name:"Less",import:()=>b(()=>import("./less-DKKxO4Pm.js"),[],import.meta.url)},{id:"liquid",name:"Liquid",import:()=>b(()=>import("./liquid-QTP3a8yd.js"),__vite__mapDeps([63,1,2,3,9]),import.meta.url)},{id:"llvm",name:"LLVM IR",import:()=>b(()=>import("./llvm-CfjccL00.js"),[],import.meta.url)},{id:"log",name:"Log file",import:()=>b(()=>import("./log-CnKjEmrw.js"),[],import.meta.url)},{id:"logo",name:"Logo",import:()=>b(()=>import("./logo-BmG1tMr6.js"),[],import.meta.url)},{id:"lua",name:"Lua",import:()=>b(()=>import("./lua-B09NiSMa.js"),__vite__mapDeps([37,26]),import.meta.url)},{id:"luau",name:"Luau",import:()=>b(()=>import("./luau-C2pF66fA.js"),[],import.meta.url)},{id:"make",name:"Makefile",aliases:["makefile"],import:()=>b(()=>import("./make-Ccm3NI5i.js"),[],import.meta.url)},{id:"markdown",name:"Markdown",aliases:["md"],import:()=>b(()=>import("./markdown-DY93LJPj.js"),[],import.meta.url)},{id:"marko",name:"Marko",import:()=>b(()=>import("./marko-CgCapwG0.js"),__vite__mapDeps([64,3,65,5,11]),import.meta.url)},{id:"matlab",name:"MATLAB",import:()=>b(()=>import("./matlab-nYX3zffi.js"),[],import.meta.url)},{id:"mdc",name:"MDC",import:()=>b(()=>import("./mdc-CVidKc4b.js"),__vite__mapDeps([66,40,38,15,1,2,3]),import.meta.url)},{id:"mdx",name:"MDX",import:()=>b(()=>import("./mdx-C8C9IGe9.js"),[],import.meta.url)},{id:"mermaid",name:"Mermaid",aliases:["mmd"],import:()=>b(()=>import("./mermaid-ZuTRVWig.js"),[],import.meta.url)},{id:"mipsasm",name:"MIPS Assembly",aliases:["mips"],import:()=>b(()=>import("./mipsasm-BjAqecqh.js"),[],import.meta.url)},{id:"mojo",name:"Mojo",import:()=>b(()=>import("./mojo-gr1MWCNv.js"),[],import.meta.url)},{id:"move",name:"Move",import:()=>b(()=>import("./move-BJN6DhLB.js"),[],import.meta.url)},{id:"narrat",name:"Narrat Language",aliases:["nar"],import:()=>b(()=>import("./narrat-BTSicUR-.js"),[],import.meta.url)},{id:"nextflow",name:"Nextflow",aliases:["nf"],import:()=>b(()=>import("./nextflow-CvZ2-N7x.js"),[],import.meta.url)},{id:"nginx",name:"Nginx",import:()=>b(()=>import("./nginx-CtwUG8yW.js"),__vite__mapDeps([67,37,26]),import.meta.url)},{id:"nim",name:"Nim",import:()=>b(()=>import("./nim-BCqJOqd2.js"),__vite__mapDeps([68,26,1,2,3,7,8,25,40]),import.meta.url)},{id:"nix",name:"Nix",import:()=>b(()=>import("./nix-DiXPdoNa.js"),[],import.meta.url)},{id:"nushell",name:"nushell",aliases:["nu"],import:()=>b(()=>import("./nushell-a9nsepcr.js"),[],import.meta.url)},{id:"objective-c",name:"Objective-C",aliases:["objc"],import:()=>b(()=>import("./objective-c-DLT9zZoE.js"),[],import.meta.url)},{id:"objective-cpp",name:"Objective-C++",import:()=>b(()=>import("./objective-cpp-DKXr-AK_.js"),[],import.meta.url)},{id:"ocaml",name:"OCaml",import:()=>b(()=>import("./ocaml-DP9q6K5L.js"),[],import.meta.url)},{id:"pascal",name:"Pascal",import:()=>b(()=>import("./pascal-DjTTLVNS.js"),[],import.meta.url)},{id:"perl",name:"Perl",import:()=>b(()=>import("./perl-Da10OPbb.js"),__vite__mapDeps([69,1,2,3,7,8,16]),import.meta.url)},{id:"php",name:"PHP",import:()=>b(()=>import("./php-hSYFjEJr.js"),__vite__mapDeps([70,1,2,3,7,8,16,9]),import.meta.url)},{id:"plsql",name:"PL/SQL",import:()=>b(()=>import("./plsql-CJrHCTnj.js"),[],import.meta.url)},{id:"po",name:"Gettext PO",aliases:["pot","potx"],import:()=>b(()=>import("./po-y5MdiEbo.js"),[],import.meta.url)},{id:"polar",name:"Polar",import:()=>b(()=>import("./polar-Bsx6RkUC.js"),[],import.meta.url)},{id:"postcss",name:"PostCSS",import:()=>b(()=>import("./postcss-CeUBPB2S.js"),[],import.meta.url)},{id:"powerquery",name:"PowerQuery",import:()=>b(()=>import("./powerquery-CW27I574.js"),[],import.meta.url)},{id:"powershell",name:"PowerShell",aliases:["ps","ps1"],import:()=>b(()=>import("./powershell-DSYJ6xcj.js"),[],import.meta.url)},{id:"prisma",name:"Prisma",import:()=>b(()=>import("./prisma-CLoN-gBj.js"),[],import.meta.url)},{id:"prolog",name:"Prolog",import:()=>b(()=>import("./prolog-Bgt5DHUA.js"),[],import.meta.url)},{id:"proto",name:"Protocol Buffer 3",aliases:["protobuf"],import:()=>b(()=>import("./proto-BVbLr_ub.js"),[],import.meta.url)},{id:"pug",name:"Pug",aliases:["jade"],import:()=>b(()=>import("./pug-DYUvS0f2.js"),__vite__mapDeps([71,2,3,1]),import.meta.url)},{id:"puppet",name:"Puppet",import:()=>b(()=>import("./puppet-TSkl_nn0.js"),[],import.meta.url)},{id:"purescript",name:"PureScript",import:()=>b(()=>import("./purescript-BrDje9qL.js"),[],import.meta.url)},{id:"python",name:"Python",aliases:["py"],import:()=>b(()=>import("./python-DlV7vnVD.js"),[],import.meta.url)},{id:"qml",name:"QML",import:()=>b(()=>import("./qml-DiX3J200.js"),__vite__mapDeps([72,2]),import.meta.url)},{id:"qmldir",name:"QML Directory",import:()=>b(()=>import("./qmldir-CSZk7E48.js"),[],import.meta.url)},{id:"qss",name:"Qt Style Sheets",import:()=>b(()=>import("./qss-DACx-k9g.js"),[],import.meta.url)},{id:"r",name:"R",import:()=>b(()=>import("./r-C1kzXVmM.js"),[],import.meta.url)},{id:"racket",name:"Racket",import:()=>b(()=>import("./racket-D1nq-KeH.js"),[],import.meta.url)},{id:"raku",name:"Raku",aliases:["perl6"],import:()=>b(()=>import("./raku-DocPDKZq.js"),[],import.meta.url)},{id:"razor",name:"ASP.NET Razor",import:()=>b(()=>import("./razor-7Qmv-3mF.js"),__vite__mapDeps([73,1,2,3,74]),import.meta.url)},{id:"reg",name:"Windows Registry Script",import:()=>b(()=>import("./reg-5ydmJHEw.js"),[],import.meta.url)},{id:"regexp",name:"RegExp",aliases:["regex"],import:()=>b(()=>import("./regexp-CpyjTnFF.js"),[],import.meta.url)},{id:"rel",name:"Rel",import:()=>b(()=>import("./rel-D68lwU-3.js"),[],import.meta.url)},{id:"riscv",name:"RISC-V",import:()=>b(()=>import("./riscv-Cl4WfXj6.js"),[],import.meta.url)},{id:"rst",name:"reStructuredText",import:()=>b(()=>import("./rst-DU5WA_Li.js"),__vite__mapDeps([75,15,1,2,3,23,24,25,26,16,20,28,38,76,33,34,7,8,35,11,36,13,37]),import.meta.url)},{id:"ruby",name:"Ruby",aliases:["rb"],import:()=>b(()=>import("./ruby-DJftxM78.js"),__vite__mapDeps([33,1,2,3,34,7,8,16,35,11,36,13,23,24,25,26,28,37,38]),import.meta.url)},{id:"rust",name:"Rust",aliases:["rs"],import:()=>b(()=>import("./rust-DpWcZSqc.js"),[],import.meta.url)},{id:"sas",name:"SAS",import:()=>b(()=>import("./sas-BBCK0tAG.js"),__vite__mapDeps([77,16]),import.meta.url)},{id:"sass",name:"Sass",import:()=>b(()=>import("./sass-DY_rGA2-.js"),[],import.meta.url)},{id:"scala",name:"Scala",import:()=>b(()=>import("./scala-CYRsmRER.js"),[],import.meta.url)},{id:"scheme",name:"Scheme",import:()=>b(()=>import("./scheme-C45fPb3F.js"),[],import.meta.url)},{id:"scss",name:"SCSS",import:()=>b(()=>import("./scss-CHxzYwli.js"),__vite__mapDeps([5,3]),import.meta.url)},{id:"sdbl",name:"1C (Query)",aliases:["1c-query"],import:()=>b(()=>import("./sdbl-BpucmfEo.js"),[],import.meta.url)},{id:"shaderlab",name:"ShaderLab",aliases:["shader"],import:()=>b(()=>import("./shaderlab-DNyPh2Q6.js"),__vite__mapDeps([78,79]),import.meta.url)},{id:"shellscript",name:"Shell",aliases:["bash","sh","shell","zsh"],import:()=>b(()=>import("./shellscript-B8OHlvmy.js"),[],import.meta.url)},{id:"shellsession",name:"Shell Session",aliases:["console"],import:()=>b(()=>import("./shellsession-OATBsyRD.js"),__vite__mapDeps([80,28]),import.meta.url)},{id:"smalltalk",name:"Smalltalk",import:()=>b(()=>import("./smalltalk-CKvddXL8.js"),[],import.meta.url)},{id:"solidity",name:"Solidity",import:()=>b(()=>import("./solidity-NK5CeKHG.js"),[],import.meta.url)},{id:"soy",name:"Closure Templates",aliases:["closure-templates"],import:()=>b(()=>import("./soy-BjzVbqVk.js"),__vite__mapDeps([81,1,2,3]),import.meta.url)},{id:"sparql",name:"SPARQL",import:()=>b(()=>import("./sparql-CLNNOQQI.js"),__vite__mapDeps([82,83]),import.meta.url)},{id:"splunk",name:"Splunk Query Language",aliases:["spl"],import:()=>b(()=>import("./splunk-CFtInczE.js"),[],import.meta.url)},{id:"sql",name:"SQL",import:()=>b(()=>import("./sql-BhJCBb_s.js"),[],import.meta.url)},{id:"ssh-config",name:"SSH Config",import:()=>b(()=>import("./ssh-config-Dqsr-I88.js"),[],import.meta.url)},{id:"stata",name:"Stata",import:()=>b(()=>import("./stata-G4GYNNPE.js"),__vite__mapDeps([84,16]),import.meta.url)},{id:"stylus",name:"Stylus",aliases:["styl"],import:()=>b(()=>import("./stylus-BeJftkpb.js"),[],import.meta.url)},{id:"svelte",name:"Svelte",import:()=>b(()=>import("./svelte-Dg-n8Id4.js"),__vite__mapDeps([85,2,11,3,12]),import.meta.url)},{id:"swift",name:"Swift",import:()=>b(()=>import("./swift-CvVgI3Em.js"),[],import.meta.url)},{id:"system-verilog",name:"SystemVerilog",import:()=>b(()=>import("./system-verilog-B3nElewZ.js"),[],import.meta.url)},{id:"systemd",name:"Systemd Units",import:()=>b(()=>import("./systemd-B7SlkmfE.js"),[],import.meta.url)},{id:"talonscript",name:"TalonScript",aliases:["talon"],import:()=>b(()=>import("./talonscript-BrsbXmRy.js"),[],import.meta.url)},{id:"tasl",name:"Tasl",import:()=>b(()=>import("./tasl-CMkPZNj1.js"),[],import.meta.url)},{id:"tcl",name:"Tcl",import:()=>b(()=>import("./tcl-CiyEbZSK.js"),[],import.meta.url)},{id:"templ",name:"Templ",import:()=>b(()=>import("./templ-C0tOEwaA.js"),__vite__mapDeps([86,87,2,3]),import.meta.url)},{id:"terraform",name:"Terraform",aliases:["tf","tfvars"],import:()=>b(()=>import("./terraform-BUB-_BlF.js"),[],import.meta.url)},{id:"tex",name:"TeX",import:()=>b(()=>import("./tex-BGsfIjRo.js"),__vite__mapDeps([62,60]),import.meta.url)},{id:"toml",name:"TOML",import:()=>b(()=>import("./toml-VldhK7iW.js"),[],import.meta.url)},{id:"ts-tags",name:"TypeScript with Tags",aliases:["lit"],import:()=>b(()=>import("./ts-tags-CloPe9IY.js"),__vite__mapDeps([88,11,3,2,25,26,1,16,7,8]),import.meta.url)},{id:"tsv",name:"TSV",import:()=>b(()=>import("./tsv-BQ9ptESM.js"),[],import.meta.url)},{id:"tsx",name:"TSX",import:()=>b(()=>import("./tsx-DYwE5ssU.js"),[],import.meta.url)},{id:"turtle",name:"Turtle",import:()=>b(()=>import("./turtle-BVy4HXn4.js"),[],import.meta.url)},{id:"twig",name:"Twig",import:()=>b(()=>import("./twig-D8xgA4Ji.js"),__vite__mapDeps([89,3,2,5,70,1,7,8,16,9,20,33,34,35,11,36,13,23,24,25,26,28,37,38]),import.meta.url)},{id:"typescript",name:"TypeScript",aliases:["ts"],import:()=>b(()=>import("./typescript-C6YI4KwS.js"),[],import.meta.url)},{id:"typespec",name:"TypeSpec",aliases:["tsp"],import:()=>b(()=>import("./typespec-DDqafzeT.js"),[],import.meta.url)},{id:"typst",name:"Typst",aliases:["typ"],import:()=>b(()=>import("./typst-JIZTSUoJ.js"),[],import.meta.url)},{id:"v",name:"V",import:()=>b(()=>import("./v-CfE8ItaL.js"),[],import.meta.url)},{id:"vala",name:"Vala",import:()=>b(()=>import("./vala-p2PL1w-1.js"),[],import.meta.url)},{id:"vb",name:"Visual Basic",aliases:["cmd"],import:()=>b(()=>import("./vb-Dv-GCw1m.js"),[],import.meta.url)},{id:"verilog",name:"Verilog",import:()=>b(()=>import("./verilog-DKP7kpC6.js"),[],import.meta.url)},{id:"vhdl",name:"VHDL",import:()=>b(()=>import("./vhdl-Cog-DhcW.js"),[],import.meta.url)},{id:"viml",name:"Vim Script",aliases:["vim","vimscript"],import:()=>b(()=>import("./viml-0AN1aqkP.js"),[],import.meta.url)},{id:"vue",name:"Vue",import:()=>b(()=>import("./vue-ChwqA4lT.js"),__vite__mapDeps([90,3,2,11,9,15,1]),import.meta.url)},{id:"vue-html",name:"Vue HTML",import:()=>b(()=>import("./vue-html-DP_EF96N.js"),__vite__mapDeps([91,90,3,2,11,9,15,1]),import.meta.url)},{id:"vue-vine",name:"Vue Vine",import:()=>b(()=>import("./vue-vine-K4R7Z1Ei.js"),__vite__mapDeps([92,3,5,65,93,12,90,2,11,9,15,1]),import.meta.url)},{id:"vyper",name:"Vyper",aliases:["vy"],import:()=>b(()=>import("./vyper-sB2l1MOO.js"),[],import.meta.url)},{id:"wasm",name:"WebAssembly",import:()=>b(()=>import("./wasm-CSAWeJiV.js"),[],import.meta.url)},{id:"wenyan",name:"Wenyan",aliases:["\u6587\u8A00"],import:()=>b(()=>import("./wenyan-CLHHXU5e.js"),[],import.meta.url)},{id:"wgsl",name:"WGSL",import:()=>b(()=>import("./wgsl-DiTcYanS.js"),[],import.meta.url)},{id:"wikitext",name:"Wikitext",aliases:["mediawiki","wiki"],import:()=>b(()=>import("./wikitext-DT8E9qe0.js"),[],import.meta.url)},{id:"wit",name:"WebAssembly Interface Types",import:()=>b(()=>import("./wit-CtjT-RdY.js"),[],import.meta.url)},{id:"wolfram",name:"Wolfram",aliases:["wl"],import:()=>b(()=>import("./wolfram-1xJNnwe2.js"),[],import.meta.url)},{id:"xml",name:"XML",import:()=>b(()=>import("./xml-BsgRw6d1.js"),__vite__mapDeps([7,8]),import.meta.url)},{id:"xsl",name:"XSL",import:()=>b(()=>import("./xsl-DCNnPbrB.js"),__vite__mapDeps([94,7,8]),import.meta.url)},{id:"yaml",name:"YAML",aliases:["yml"],import:()=>b(()=>import("./yaml-c2-Vhxho.js"),[],import.meta.url)},{id:"zenscript",name:"ZenScript",import:()=>b(()=>import("./zenscript-ChP1MlQf.js"),[],import.meta.url)},{id:"zig",name:"Zig",import:()=>b(()=>import("./zig-rivS3YQG.js"),[],import.meta.url)}],Gp=Object.fromEntries(ha.map(t=>[t.id,t.import])),zp=Object.fromEntries(ha.flatMap(t=>{var e;return((e=t.aliases)==null?void 0:e.map(r=>[r,t.import]))||[]})),Fp={...Gp,...zp},Bp=[{id:"andromeeda",displayName:"Andromeeda",type:"dark",import:()=>b(()=>import("./andromeeda-C-Jbm3Hp.js"),[],import.meta.url)},{id:"aurora-x",displayName:"Aurora X",type:"dark",import:()=>b(()=>import("./aurora-x-D-2ljcwZ.js"),[],import.meta.url)},{id:"ayu-dark",displayName:"Ayu Dark",type:"dark",import:()=>b(()=>import("./ayu-dark-Cv9koXgw.js"),[],import.meta.url)},{id:"catppuccin-frappe",displayName:"Catppuccin Frapp\xE9",type:"dark",import:()=>b(()=>import("./catppuccin-frappe-BBxmzUt6.js"),[],import.meta.url)},{id:"catppuccin-latte",displayName:"Catppuccin Latte",type:"light",import:()=>b(()=>import("./catppuccin-latte-Jep7L2Wt.js"),[],import.meta.url)},{id:"catppuccin-macchiato",displayName:"Catppuccin Macchiato",type:"dark",import:()=>b(()=>import("./catppuccin-macchiato-CIUZ1G5V.js"),[],import.meta.url)},{id:"catppuccin-mocha",displayName:"Catppuccin Mocha",type:"dark",import:()=>b(()=>import("./catppuccin-mocha-NBseiqgx.js"),[],import.meta.url)},{id:"dark-plus",displayName:"Dark Plus",type:"dark",import:()=>b(()=>import("./dark-plus-C3mMm8J8.js"),[],import.meta.url)},{id:"dracula",displayName:"Dracula Theme",type:"dark",import:()=>b(()=>import("./dracula-BzJJZx-M.js"),[],import.meta.url)},{id:"dracula-soft",displayName:"Dracula Theme Soft",type:"dark",import:()=>b(()=>import("./dracula-soft-BXkSAIEj.js"),[],import.meta.url)},{id:"everforest-dark",displayName:"Everforest Dark",type:"dark",import:()=>b(()=>import("./everforest-dark-BgDCqdQA.js"),[],import.meta.url)},{id:"everforest-light",displayName:"Everforest Light",type:"light",import:()=>b(()=>import("./everforest-light-C8M2exoo.js"),[],import.meta.url)},{id:"github-dark",displayName:"GitHub Dark",type:"dark",import:()=>b(()=>import("./github-dark-DHJKELXO.js"),[],import.meta.url)},{id:"github-dark-default",displayName:"GitHub Dark Default",type:"dark",import:()=>b(()=>import("./github-dark-default-Cuk6v7N8.js"),[],import.meta.url)},{id:"github-dark-dimmed",displayName:"GitHub Dark Dimmed",type:"dark",import:()=>b(()=>import("./github-dark-dimmed-DH5Ifo-i.js"),[],import.meta.url)},{id:"github-dark-high-contrast",displayName:"GitHub Dark High Contrast",type:"dark",import:()=>b(()=>import("./github-dark-high-contrast-E3gJ1_iC.js"),[],import.meta.url)},{id:"github-light",displayName:"GitHub Light",type:"light",import:()=>b(()=>import("./github-light-DAi9KRSo.js"),[],import.meta.url)},{id:"github-light-default",displayName:"GitHub Light Default",type:"light",import:()=>b(()=>import("./github-light-default-D7oLnXFd.js"),[],import.meta.url)},{id:"github-light-high-contrast",displayName:"GitHub Light High Contrast",type:"light",import:()=>b(()=>import("./github-light-high-contrast-BfjtVDDH.js"),[],import.meta.url)},{id:"gruvbox-dark-hard",displayName:"Gruvbox Dark Hard",type:"dark",import:()=>b(()=>import("./gruvbox-dark-hard-D1uDOp7C.js"),[],import.meta.url)},{id:"gruvbox-dark-medium",displayName:"Gruvbox Dark Medium",type:"dark",import:()=>b(()=>import("./gruvbox-dark-medium-DkhsQLT2.js"),[],import.meta.url)},{id:"gruvbox-dark-soft",displayName:"Gruvbox Dark Soft",type:"dark",import:()=>b(()=>import("./gruvbox-dark-soft-CcyOm34o.js"),[],import.meta.url)},{id:"gruvbox-light-hard",displayName:"Gruvbox Light Hard",type:"light",import:()=>b(()=>import("./gruvbox-light-hard-DKzvysjW.js"),[],import.meta.url)},{id:"gruvbox-light-medium",displayName:"Gruvbox Light Medium",type:"light",import:()=>b(()=>import("./gruvbox-light-medium-DPcUKYIF.js"),[],import.meta.url)},{id:"gruvbox-light-soft",displayName:"Gruvbox Light Soft",type:"light",import:()=>b(()=>import("./gruvbox-light-soft-CGqH5EJj.js"),[],import.meta.url)},{id:"houston",displayName:"Houston",type:"dark",import:()=>b(()=>import("./houston-DnULxvSX.js"),[],import.meta.url)},{id:"kanagawa-dragon",displayName:"Kanagawa Dragon",type:"dark",import:()=>b(()=>import("./kanagawa-dragon-CkXjmgJE.js"),[],import.meta.url)},{id:"kanagawa-lotus",displayName:"Kanagawa Lotus",type:"light",import:()=>b(()=>import("./kanagawa-lotus-CfQXZHmo.js"),[],import.meta.url)},{id:"kanagawa-wave",displayName:"Kanagawa Wave",type:"dark",import:()=>b(()=>import("./kanagawa-wave-DWedfzmr.js"),[],import.meta.url)},{id:"laserwave",displayName:"LaserWave",type:"dark",import:()=>b(()=>import("./laserwave-DUszq2jm.js"),[],import.meta.url)},{id:"light-plus",displayName:"Light Plus",type:"light",import:()=>b(()=>import("./light-plus-B7mTdjB0.js"),[],import.meta.url)},{id:"material-theme",displayName:"Material Theme",type:"dark",import:()=>b(()=>import("./material-theme-D5KoaKCx.js"),[],import.meta.url)},{id:"material-theme-darker",displayName:"Material Theme Darker",type:"dark",import:()=>b(()=>import("./material-theme-darker-BfHTSMKl.js"),[],import.meta.url)},{id:"material-theme-lighter",displayName:"Material Theme Lighter",type:"light",import:()=>b(()=>import("./material-theme-lighter-B0m2ddpp.js"),[],import.meta.url)},{id:"material-theme-ocean",displayName:"Material Theme Ocean",type:"dark",import:()=>b(()=>import("./material-theme-ocean-CyktbL80.js"),[],import.meta.url)},{id:"material-theme-palenight",displayName:"Material Theme Palenight",type:"dark",import:()=>b(()=>import("./material-theme-palenight-Csfq5Kiy.js"),[],import.meta.url)},{id:"min-dark",displayName:"Min Dark",type:"dark",import:()=>b(()=>import("./min-dark-CafNBF8u.js"),[],import.meta.url)},{id:"min-light",displayName:"Min Light",type:"light",import:()=>b(()=>import("./min-light-CTRr51gU.js"),[],import.meta.url)},{id:"monokai",displayName:"Monokai",type:"dark",import:()=>b(()=>import("./monokai-D4h5O-jR.js"),[],import.meta.url)},{id:"night-owl",displayName:"Night Owl",type:"dark",import:()=>b(()=>import("./night-owl-C39BiMTA.js"),[],import.meta.url)},{id:"nord",displayName:"Nord",type:"dark",import:()=>b(()=>import("./nord-Ddv68eIx.js"),[],import.meta.url)},{id:"one-dark-pro",displayName:"One Dark Pro",type:"dark",import:()=>b(()=>import("./one-dark-pro-DVMEJ2y_.js"),[],import.meta.url)},{id:"one-light",displayName:"One Light",type:"light",import:()=>b(()=>import("./one-light-PoHY5YXO.js"),[],import.meta.url)},{id:"plastic",displayName:"Plastic",type:"dark",import:()=>b(()=>import("./plastic-3e1v2bzS.js"),[],import.meta.url)},{id:"poimandres",displayName:"Poimandres",type:"dark",import:()=>b(()=>import("./poimandres-CS3Unz2-.js"),[],import.meta.url)},{id:"red",displayName:"Red",type:"dark",import:()=>b(()=>import("./red-bN70gL4F.js"),[],import.meta.url)},{id:"rose-pine",displayName:"Ros\xE9 Pine",type:"dark",import:()=>b(()=>import("./rose-pine-BHrmToEH.js"),[],import.meta.url)},{id:"rose-pine-dawn",displayName:"Ros\xE9 Pine Dawn",type:"light",import:()=>b(()=>import("./rose-pine-dawn-CnK8MTSM.js"),[],import.meta.url)},{id:"rose-pine-moon",displayName:"Ros\xE9 Pine Moon",type:"dark",import:()=>b(()=>import("./rose-pine-moon-NleAzG8P.js"),[],import.meta.url)},{id:"slack-dark",displayName:"Slack Dark",type:"dark",import:()=>b(()=>import("./slack-dark-BthQWCQV.js"),[],import.meta.url)},{id:"slack-ochin",displayName:"Slack Ochin",type:"light",import:()=>b(()=>import("./slack-ochin-DqwNpetd.js"),[],import.meta.url)},{id:"snazzy-light",displayName:"Snazzy Light",type:"light",import:()=>b(()=>import("./snazzy-light-Bw305WKR.js"),[],import.meta.url)},{id:"solarized-dark",displayName:"Solarized Dark",type:"dark",import:()=>b(()=>import("./solarized-dark-DXbdFlpD.js"),[],import.meta.url)},{id:"solarized-light",displayName:"Solarized Light",type:"light",import:()=>b(()=>import("./solarized-light-L9t79GZl.js"),[],import.meta.url)},{id:"synthwave-84",displayName:"Synthwave '84",type:"dark",import:()=>b(()=>import("./synthwave-84-ChtBzv_y.js"),[],import.meta.url)},{id:"tokyo-night",displayName:"Tokyo Night",type:"dark",import:()=>b(()=>import("./tokyo-night-hegEt444.js"),[],import.meta.url)},{id:"vesper",displayName:"Vesper",type:"dark",import:()=>b(()=>import("./vesper-DU1UobuO.js"),[],import.meta.url)},{id:"vitesse-black",displayName:"Vitesse Black",type:"dark",import:()=>b(()=>import("./vitesse-black-Bkuqu6BP.js"),[],import.meta.url)},{id:"vitesse-dark",displayName:"Vitesse Dark",type:"dark",import:()=>b(()=>import("./vitesse-dark-D0r3Knsf.js"),[],import.meta.url)},{id:"vitesse-light",displayName:"Vitesse Light",type:"light",import:()=>b(()=>import("./vitesse-light-CVO1_9PV.js"),[],import.meta.url)}],Up=Object.fromEntries(Bp.map(t=>[t.id,t.import]));class zn extends Error{constructor(e){super(e),this.name="ShikiError"}}function qp(){return typeof performance<"u"?performance.now():Date.now()}const Wp=(t,e)=>t+(e-t%e)%e;async function Hp(t){let e,r;const n={};function s(c){r=c,n.HEAPU8=new Uint8Array(c),n.HEAPU32=new Uint32Array(c)}function o(c){try{return e.grow(c-r.byteLength+65535>>>16),s(e.buffer),1}catch{}}const a=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function i(c,u){return c?(function(d,p,m=1024){const h=p+m;let y=p;for(;d[y]&&!(y>=h);)++y;if(y-p>16&&d.buffer&&a)return a.decode(d.subarray(p,y));let _="";for(;p<y;){let f=d[p++];if(!(128&f)){_+=String.fromCharCode(f);continue}const w=63&d[p++];if((224&f)==192){_+=String.fromCharCode((31&f)<<6|w);continue}const k=63&d[p++];if(f=(240&f)==224?(15&f)<<12|w<<6|k:(7&f)<<18|w<<12|k<<6|63&d[p++],f<65536)_+=String.fromCharCode(f);else{const x=f-65536;_+=String.fromCharCode(55296|x>>10,56320|1023&x)}}return _})(n.HEAPU8,c,u):""}const l={emscripten_get_now:qp,emscripten_memcpy_big:function(c,u,d){n.HEAPU8.copyWithin(c,u,u+d)},emscripten_resize_heap:function(c){const u=n.HEAPU8.length,d=2147483648;if((c>>>=0)>d)return!1;for(let p=1;p<=4;p*=2){let m=u*(1+.2/p);if(m=Math.min(m,c+100663296),o(Math.min(d,Wp(Math.max(c,m),65536))))return!0}return!1},fd_write:()=>0};return await(async function(){const c={env:l,wasi_snapshot_preview1:l},u=await t(c);e=u.memory,s(e.buffer),Object.assign(n,u),n.UTF8ToString=i})(),n}var Qp=Object.defineProperty,le=(t,e,r)=>((n,s,o)=>s in n?Qp(n,s,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[s]=o)(t,typeof e!="symbol"?e+"":e,r);let me=null;class Dr{constructor(e){le(this,"utf16Length"),le(this,"utf8Length"),le(this,"utf16Value"),le(this,"utf8Value"),le(this,"utf16OffsetToUtf8"),le(this,"utf8OffsetToUtf16");const r=e.length,n=Dr._utf8ByteLength(e),s=n!==r,o=s?new Uint32Array(r+1):null;s&&(o[r]=n);const a=s?new Uint32Array(n+1):null;s&&(a[n]=r);const i=new Uint8Array(n);let l=0;for(let c=0;c<r;c++){const u=e.charCodeAt(c);let d=u,p=!1;if(u>=55296&&u<=56319&&c+1<r){const m=e.charCodeAt(c+1);m>=56320&&m<=57343&&(d=65536+(u-55296<<10)|m-56320,p=!0)}s&&(o[c]=l,p&&(o[c+1]=l),d<=127?a[l+0]=c:d<=2047?(a[l+0]=c,a[l+1]=c):d<=65535?(a[l+0]=c,a[l+1]=c,a[l+2]=c):(a[l+0]=c,a[l+1]=c,a[l+2]=c,a[l+3]=c)),d<=127?i[l++]=d:d<=2047?(i[l++]=192|(1984&d)>>>6,i[l++]=128|(63&d)>>>0):d<=65535?(i[l++]=224|(61440&d)>>>12,i[l++]=128|(4032&d)>>>6,i[l++]=128|(63&d)>>>0):(i[l++]=240|(1835008&d)>>>18,i[l++]=128|(258048&d)>>>12,i[l++]=128|(4032&d)>>>6,i[l++]=128|(63&d)>>>0),p&&c++}this.utf16Length=r,this.utf8Length=n,this.utf16Value=e,this.utf8Value=i,this.utf16OffsetToUtf8=o,this.utf8OffsetToUtf16=a}static _utf8ByteLength(e){let r=0;for(let n=0,s=e.length;n<s;n++){const o=e.charCodeAt(n);let a=o,i=!1;if(o>=55296&&o<=56319&&n+1<s){const l=e.charCodeAt(n+1);l>=56320&&l<=57343&&(a=65536+(o-55296<<10)|l-56320,i=!0)}r+=a<=127?1:a<=2047?2:a<=65535?3:4,i&&n++}return r}createString(e){const r=e.omalloc(this.utf8Length);return e.HEAPU8.set(this.utf8Value,r),r}}const Mr=class ze{constructor(e){if(le(this,"id",++ze.LAST_ID),le(this,"_onigBinding"),le(this,"content"),le(this,"utf16Length"),le(this,"utf8Length"),le(this,"utf16OffsetToUtf8"),le(this,"utf8OffsetToUtf16"),le(this,"ptr"),!me)throw new zn("Must invoke loadWasm first.");this._onigBinding=me,this.content=e;const r=new Dr(e);this.utf16Length=r.utf16Length,this.utf8Length=r.utf8Length,this.utf16OffsetToUtf8=r.utf16OffsetToUtf8,this.utf8OffsetToUtf16=r.utf8OffsetToUtf16,this.utf8Length<1e4&&!ze._sharedPtrInUse?(ze._sharedPtr||(ze._sharedPtr=me.omalloc(1e4)),ze._sharedPtrInUse=!0,me.HEAPU8.set(r.utf8Value,ze._sharedPtr),this.ptr=ze._sharedPtr):this.ptr=r.createString(me)}convertUtf8OffsetToUtf16(e){return this.utf8OffsetToUtf16?e<0?0:e>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[e]:e}convertUtf16OffsetToUtf8(e){return this.utf16OffsetToUtf8?e<0?0:e>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[e]:e}dispose(){this.ptr===ze._sharedPtr?ze._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};le(Mr,"LAST_ID",0),le(Mr,"_sharedPtr",0),le(Mr,"_sharedPtrInUse",!1);let Vr,fa=Mr;class Zp{constructor(e){if(le(this,"_onigBinding"),le(this,"_ptr"),!me)throw new zn("Must invoke loadWasm first.");const r=[],n=[];for(let i=0,l=e.length;i<l;i++){const c=new Dr(e[i]);r[i]=c.createString(me),n[i]=c.utf8Length}const s=me.omalloc(4*e.length);me.HEAPU32.set(r,s/4);const o=me.omalloc(4*e.length);me.HEAPU32.set(n,o/4);const a=me.createOnigScanner(s,o,e.length);for(let i=0,l=e.length;i<l;i++)me.ofree(r[i]);me.ofree(o),me.ofree(s),a===0&&(function(i){throw new zn(i.UTF8ToString(i.getLastOnigError()))})(me),this._onigBinding=me,this._ptr=a}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(e,r,n){let s=0;if(typeof n=="number"&&(s=n),typeof e=="string"){e=new fa(e);const o=this._findNextMatchSync(e,r,!1,s);return e.dispose(),o}return this._findNextMatchSync(e,r,!1,s)}_findNextMatchSync(e,r,n,s){const o=this._onigBinding,a=o.findNextOnigScannerMatch(this._ptr,e.id,e.ptr,e.utf8Length,e.convertUtf16OffsetToUtf8(r),s);if(a===0)return null;const i=o.HEAPU32;let l=a/4;const c=i[l++],u=i[l++],d=[];for(let p=0;p<u;p++){const m=e.convertUtf8OffsetToUtf16(i[l++]),h=e.convertUtf8OffsetToUtf16(i[l++]);d[p]={start:m,end:h,length:h-m}}return{index:c,captureIndices:d}}}function Xp(t){return Vr||(Vr=(async function(){me=await Hp(async e=>{let r=t;var n;return r=await r,typeof r=="function"&&(r=await r(e)),typeof r=="function"&&(r=await r(e)),typeof r.instantiator=="function"?r=await r.instantiator(e):(function(s){return typeof s.default=="function"})(r)?r=await r.default(e):((function(s){return s.data!==void 0})(r)&&(r=r.data),(function(s){return typeof Response<"u"&&s instanceof Response})(r)?r=typeof WebAssembly.instantiateStreaming=="function"?await(n=r,s=>WebAssembly.instantiateStreaming(n,s))(e):await(function(s){return async o=>{const a=await s.arrayBuffer();return WebAssembly.instantiate(a,o)}})(r)(e):(function(s){var o;return typeof ArrayBuffer<"u"&&(s instanceof ArrayBuffer||ArrayBuffer.isView(s))||typeof Buffer<"u"&&((o=Buffer.isBuffer)==null?void 0:o.call(Buffer,s))||typeof SharedArrayBuffer<"u"&&s instanceof SharedArrayBuffer||typeof Uint32Array<"u"&&s instanceof Uint32Array})(r)?r=await Fn(r)(e):r instanceof WebAssembly.Module?r=await Fn(r)(e):"default"in r&&r.default instanceof WebAssembly.Module&&(r=await Fn(r.default)(e))),"instance"in r&&(r=r.instance),"exports"in r&&(r=r.exports),r})})(),Vr)}function Fn(t){return e=>WebAssembly.instantiate(t,e)}const ga=Vp({langs:Fp,themes:Up,engine:()=>(async function(t){return t&&await Xp(t),{createScanner:e=>new Zp(e.map(r=>typeof r=="string"?r:r.source)),createString:e=>new fa(e)}})(b(()=>import("./wasm--yL7jHw-.js"),[],import.meta.url))});function Pt(t){if([...t].length!==1)throw new Error(`Expected "${t}" to be a single code point`);return t.codePointAt(0)}const Bn=new Set(["alnum","alpha","ascii","blank","cntrl","digit","graph","lower","print","punct","space","upper","word","xdigit"]),he=String.raw;function Rt(t,e){if(t==null)throw new Error(e??"Value expected");return t}const _a=he`\[\^?`,ba=`c.? | C(?:-.?)?|${he`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${he`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${he`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${he`o\{[^\}]*\}?`}|${he`\d{1,3}`}`,Un=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,Gr=new RegExp(he`
23
- \\ (?:
24
- ${ba}
25
- | [gk]<[^>]*>?
26
- | [gk]'[^']*'?
27
- | .
28
- )
29
- | \( (?:
30
- \? (?:
31
- [:=!>({]
32
- | <[=!]
33
- | <[^>]*>
34
- | '[^']*'
35
- | ~\|?
36
- | #(?:[^)\\]|\\.?)*
37
- | [^:)]*[:)]
38
- )?
39
- | \*[^\)]*\)?
40
- )?
41
- | (?:${Un.source})+
42
- | ${_a}
43
- | .
44
- `.replace(/\s+/g,""),"gsu"),qn=new RegExp(he`
45
- \\ (?:
46
- ${ba}
47
- | .
48
- )
49
- | \[:(?:\^?\p{Alpha}+|\^):\]
50
- | ${_a}
51
- | &&
52
- | .
53
- `.replace(/\s+/g,""),"gsu");function Jp(t,e={}){const r={flags:"",...e,rules:{captureGroup:!1,singleline:!1,...e.rules}};if(typeof t!="string")throw new Error("String expected as pattern");const n=(function(d){const p={ignoreCase:!1,dotAll:!1,extended:!1,digitIsAscii:!1,posixIsAscii:!1,spaceIsAscii:!1,wordIsAscii:!1,textSegmentMode:null};for(let m=0;m<d.length;m++){const h=d[m];if(!"imxDPSWy".includes(h))throw new Error(`Invalid flag "${h}"`);if(h!=="y")p[{i:"ignoreCase",m:"dotAll",x:"extended",D:"digitIsAscii",P:"posixIsAscii",S:"spaceIsAscii",W:"wordIsAscii"}[h]]=!0;else{if(!/^y{[gw]}/.test(d.slice(m)))throw new Error('Invalid or unspecified flag "y" mode');p.textSegmentMode=d[m+2]==="g"?"grapheme":"word",m+=3}}return p})(r.flags),s=[n.extended],o={captureGroup:r.rules.captureGroup,getCurrentModX:()=>s.at(-1),numOpenGroups:0,popModX(){s.pop()},pushModX(d){s.push(d)},replaceCurrentModX(d){s[s.length-1]=d},singleline:r.rules.singleline};let a,i=[];for(Gr.lastIndex=0;a=Gr.exec(t);){const d=Yp(o,t,a[0],Gr.lastIndex);d.tokens?i.push(...d.tokens):d.token&&i.push(d.token),d.lastIndex!==void 0&&(Gr.lastIndex=d.lastIndex)}const l=[];let c=0;i.filter(d=>d.type==="GroupOpen").forEach(d=>{d.kind==="capturing"?d.number=++c:d.raw==="("&&l.push(d)}),c||l.forEach((d,p)=>{d.kind="capturing",d.number=p+1});const u=c||l.length;return{tokens:i.map(d=>d.type==="EscapedNumber"?(function(p,m){const{raw:h,inCharClass:y}=p,_=h.slice(1);if(!y&&(_!=="0"&&_.length===1||_[0]!=="0"&&+_<=m))return[wa(h)];const f=[],w=_.match(/^[0-7]+|\d/g);for(let k=0;k<w.length;k++){const x=w[k];let S;if(k===0&&x!=="8"&&x!=="9"){if(S=parseInt(x,8),S>127)throw new Error(he`Octal encoded byte above 177 unsupported "${h}"`)}else S=Pt(x);f.push(Fe(S,(k===0?"\\":"")+x))}return f})(d,u):d).flat(),flags:n}}function Yp(t,e,r,n){const[s,o]=r;if(r==="["||r==="[^"){const a=(function(i,l,c){const u=[ka(l[1]==="^",l)];let d,p=1;for(qn.lastIndex=c;d=qn.exec(i);){const m=d[0];if(m[0]==="["&&m[1]!==":")p++,u.push(ka(m[1]==="^",m));else if(m==="]"){if(u.at(-1).type==="CharacterClassOpen")u.push(Fe(93,m));else if(p--,u.push(td(m)),!p)break}else{const h=Kp(m);Array.isArray(h)?u.push(...h):u.push(h)}}return{tokens:u,lastIndex:qn.lastIndex||i.length}})(e,r,n);return{tokens:a.tokens,lastIndex:a.lastIndex}}if(s==="\\"){if("AbBGyYzZ".includes(o))return{token:xa(r,r)};if(/^\\g[<']/.test(r)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(r))throw new Error(`Invalid group name "${r}"`);return{token:nd(r)}}if(/^\\k[<']/.test(r)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(r))throw new Error(`Invalid group name "${r}"`);return{token:wa(r)}}if(o==="K")return{token:va("keep",r)};if(o==="N"||o==="R")return{token:dt("newline",r,{negate:o==="N"})};if(o==="O")return{token:dt("any",r)};if(o==="X")return{token:dt("text_segment",r)};const a=ya(r,{inCharClass:!1});return Array.isArray(a)?{tokens:a}:{token:a}}if(s==="("){if(o==="*")return{token:ad(r)};if(r==="(?{")throw new Error(`Unsupported callout "${r}"`);if(r.startsWith("(?#")){if(e[n]!==")")throw new Error('Unclosed comment group "(?#"');return{lastIndex:n+1}}if(/^\(\?[-imx]+[:)]$/.test(r))return{token:od(r,t)};if(t.pushModX(t.getCurrentModX()),t.numOpenGroups++,r==="("&&!t.captureGroup||r==="(?:")return{token:Lt("group",r)};if(r==="(?>")return{token:Lt("atomic",r)};if(r==="(?="||r==="(?!"||r==="(?<="||r==="(?<!")return{token:Lt(r[2]==="<"?"lookbehind":"lookahead",r,{negate:r.endsWith("!")})};if(r==="("&&t.captureGroup||r.startsWith("(?<")&&r.endsWith(">")||r.startsWith("(?'")&&r.endsWith("'"))return{token:Lt("capturing",r,{...r!=="("&&{name:r.slice(3,-1)}})};if(r.startsWith("(?~")){if(r==="(?~|")throw new Error(`Unsupported absence function kind "${r}"`);return{token:Lt("absence_repeater",r)}}throw r==="(?("?new Error(`Unsupported conditional "${r}"`):new Error(`Invalid or unsupported group option "${r}"`)}if(r===")"){if(t.popModX(),t.numOpenGroups--,t.numOpenGroups<0)throw new Error('Unmatched ")"');return{token:rd(r)}}if(t.getCurrentModX()){if(r==="#"){const a=e.indexOf(`
54
- `,n);return{lastIndex:a===-1?e.length:a}}if(/^\s$/.test(r)){const a=/\s+/y;return a.lastIndex=n,{lastIndex:a.exec(e)?a.lastIndex:n}}}return r==="."?{token:dt("dot",r)}:r==="^"||r==="$"?{token:xa(t.singleline?{"^":he`\A`,$:he`\Z`}[r]:r,r)}:r==="|"?{token:ed(r)}:Un.test(r)?{tokens:id(r)}:{token:Fe(Pt(r),r)}}function Kp(t){if(t[0]==="\\")return ya(t,{inCharClass:!0});if(t[0]==="["){const e=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(t);if(!e||!Bn.has(e.groups.name))throw new Error(`Invalid POSIX class "${t}"`);return dt("posix",t,{value:e.groups.name,negate:!!e.groups.negate})}return t==="-"?(function(e){return{type:"CharacterClassHyphen",raw:e}})(t):t==="&&"?(function(e){return{type:"CharacterClassIntersector",raw:e}})(t):Fe(Pt(t),t)}function ya(t,{inCharClass:e}){const r=t[1];if(r==="c"||r==="C")return(function(n){const s=n[1]==="c"?n[2]:n[3];if(!s||!/[A-Za-z]/.test(s))throw new Error(`Unsupported control character "${n}"`);return Fe(Pt(s.toUpperCase())-64,n)})(t);if("dDhHsSwW".includes(r))return(function(n){const s=n[1].toLowerCase();return dt({d:"digit",h:"hex",s:"space",w:"word"}[s],n,{negate:n[1]!==s})})(t);if(t.startsWith(he`\o{`))throw new Error(`Incomplete, invalid, or unsupported octal code point "${t}"`);if(/^\\[pP]\{/.test(t)){if(t.length===3)throw new Error(`Incomplete or invalid Unicode property "${t}"`);return(function(n){const{p:s,neg:o,value:a}=/^\\(?<p>[pP])\{(?<neg>\^?)(?<value>[^}]+)/.exec(n).groups;return dt("property",n,{value:a,negate:s==="P"&&!o||s==="p"&&!!o})})(t)}if(new RegExp("^\\\\x[89A-Fa-f]\\p{AHex}","u").test(t))try{const n=t.split(/\\x/).slice(1).map(a=>parseInt(a,16)),s=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}).decode(new Uint8Array(n)),o=new TextEncoder;return[...s].map(a=>{const i=[...o.encode(a)].map(l=>`\\x${l.toString(16)}`).join("");return Fe(Pt(a),i)})}catch{throw new Error(`Multibyte code "${t}" incomplete or invalid in Oniguruma`)}if(r==="u"||r==="x")return Fe((function(n){if(new RegExp("^(?:\\\\u(?!\\p{AHex}{4})|\\\\x(?!\\p{AHex}{1,2}|\\{\\p{AHex}{1,8}\\}))","u").test(n))throw new Error(`Incomplete or invalid escape "${n}"`);const s=n[2]==="{"?new RegExp("^\\\\x\\{\\s*(?<hex>\\p{AHex}+)","u").exec(n).groups.hex:n.slice(2);return parseInt(s,16)})(t),t);if(Ea.has(r))return Fe(Ea.get(r),t);if(/\d/.test(r))return(function(n,s){return{type:"EscapedNumber",inCharClass:n,raw:s}})(e,t);if(t==="\\")throw new Error(he`Incomplete escape "\"`);if(r==="M")throw new Error(`Unsupported meta "${t}"`);if([...t].length===2)return Fe(t.codePointAt(1),t);throw new Error(`Unexpected escape "${t}"`)}function ed(t){return{type:"Alternator",raw:t}}function xa(t,e){return{type:"Assertion",kind:t,raw:e}}function wa(t){return{type:"Backreference",raw:t}}function Fe(t,e){return{type:"Character",value:t,raw:e}}function td(t){return{type:"CharacterClassClose",raw:t}}function ka(t,e){return{type:"CharacterClassOpen",negate:t,raw:e}}function dt(t,e,r={}){return{type:"CharacterSet",kind:t,...r,raw:e}}function va(t,e,r={}){return t==="keep"?{type:"Directive",kind:t,raw:e}:{type:"Directive",kind:t,flags:Rt(r.flags),raw:e}}function rd(t){return{type:"GroupClose",raw:t}}function Lt(t,e,r={}){return{type:"GroupOpen",kind:t,...r,raw:e}}function nd(t){return{type:"Subroutine",raw:t}}const sd=new Set(["COUNT","CMP","ERROR","FAIL","MAX","MISMATCH","SKIP","TOTAL_COUNT"]),Ea=new Map([["a",7],["b",8],["e",27],["f",12],["n",10],["r",13],["t",9],["v",11]]);function od(t,e){let{on:r,off:n}=/^\(\?(?<on>[imx]*)(?:-(?<off>[-imx]*))?/.exec(t).groups;n??(n="");const s=(e.getCurrentModX()||r.includes("x"))&&!n.includes("x"),o=Ca(r),a=Ca(n),i={};if(o&&(i.enable=o),a&&(i.disable=a),t.endsWith(")"))return e.replaceCurrentModX(s),va("flags",t,{flags:i});if(t.endsWith(":"))return e.pushModX(s),e.numOpenGroups++,Lt("group",t,{...(o||a)&&{flags:i}});throw new Error(`Unexpected flag modifier "${t}"`)}function ad(t){const e=/\(\*(?<name>[A-Za-z_]\w*)?(?:\[(?<tag>(?:[A-Za-z_]\w*)?)\])?(?:\{(?<args>[^}]*)\})?\)/.exec(t);if(!e)throw new Error(`Incomplete or invalid named callout "${t}"`);const{name:r,tag:n,args:s}=e.groups;if(!r)throw new Error(`Invalid named callout "${t}"`);if(n==="")throw new Error(`Named callout tag with empty value not allowed "${t}"`);const o=s?s.split(",").filter(u=>u!=="").map(u=>/^[+-]?\d+$/.test(u)?+u:u):[],[a,i,l]=o,c=sd.has(r)?r.toLowerCase():"custom";switch(c){case"fail":case"mismatch":case"skip":if(o.length>0)throw new Error(`Named callout arguments not allowed "${o}"`);break;case"error":if(o.length>1)throw new Error(`Named callout allows only one argument "${o}"`);if(typeof a=="string")throw new Error(`Named callout argument must be a number "${a}"`);break;case"max":if(!o.length||o.length>2)throw new Error(`Named callout must have one or two arguments "${o}"`);if(typeof a=="string"&&!/^[A-Za-z_]\w*$/.test(a))throw new Error(`Named callout argument one must be a tag or number "${a}"`);if(o.length===2&&(typeof i=="number"||!/^[<>X]$/.test(i)))throw new Error(`Named callout optional argument two must be '<', '>', or 'X' "${i}"`);break;case"count":case"total_count":if(o.length>1)throw new Error(`Named callout allows only one argument "${o}"`);if(o.length===1&&(typeof a=="number"||!/^[<>X]$/.test(a)))throw new Error(`Named callout optional argument must be '<', '>', or 'X' "${a}"`);break;case"cmp":if(o.length!==3)throw new Error(`Named callout must have three arguments "${o}"`);if(typeof a=="string"&&!/^[A-Za-z_]\w*$/.test(a))throw new Error(`Named callout argument one must be a tag or number "${a}"`);if(typeof i=="number"||!/^(?:[<>!=]=|[<>])$/.test(i))throw new Error(`Named callout argument two must be '==', '!=', '>', '<', '>=', or '<=' "${i}"`);if(typeof l=="string"&&!/^[A-Za-z_]\w*$/.test(l))throw new Error(`Named callout argument three must be a tag or number "${l}"`);break;case"custom":throw new Error(`Undefined callout name "${r}"`);default:throw new Error(`Unexpected named callout kind "${c}"`)}return(function(u,d,p,m){return{type:"NamedCallout",kind:u,tag:d,arguments:p,raw:m}})(c,n??null,(s==null?void 0:s.split(","))??null,t)}function Sa(t){let e,r,n=null;if(t[0]==="{"){const{minStr:s,maxStr:o}=/^\{(?<minStr>\d*)(?:,(?<maxStr>\d*))?/.exec(t).groups,a=1e5;if(+s>a||o&&+o>a)throw new Error("Quantifier value unsupported in Oniguruma");if(e=+s,r=o===void 0?+s:o===""?1/0:+o,e>r&&(n="possessive",[e,r]=[r,e]),t.endsWith("?")){if(n==="possessive")throw new Error('Unsupported possessive interval quantifier chain with "?"');n="lazy"}else n||(n="greedy")}else e=t[0]==="+"?1:0,r=t[0]==="?"?1:1/0,n=t[1]==="+"?"possessive":t[1]==="?"?"lazy":"greedy";return(function(s,o,a,i){return{type:"Quantifier",kind:s,min:o,max:a,raw:i}})(n,e,r,t)}function Ca(t){const e={};return t.includes("i")&&(e.ignoreCase=!0),t.includes("m")&&(e.dotAll=!0),t.includes("x")&&(e.extended=!0),Object.keys(e).length?e:null}function id(t){const e=[],r=new RegExp(Un,"gy");let n;for(;n=r.exec(t);){const s=n[0];if(s[0]==="{"){const o=/^\{(?<min>\d+),(?<max>\d+)\}\??$/.exec(s);if(o){const{min:a,max:i}=o.groups;if(+a>+i&&s.endsWith("?")){r.lastIndex--,e.push(Sa(s.slice(0,-1)));continue}}}e.push(Sa(s))}return e}function Aa(t,e){if(!Array.isArray(t.body))throw new Error("Expected node with body array");if(t.body.length!==1)return!1;const r=t.body[0];return!e||Object.keys(e).every(n=>e[n]===r[n])}const ld=new Set(["AbsenceFunction","Backreference","CapturingGroup","Character","CharacterClass","CharacterSet","Group","Quantifier","Subroutine"]);function Ia(t,e={}){const r={flags:"",normalizeUnknownPropertyNames:!1,skipBackrefValidation:!1,skipLookbehindValidation:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...e,rules:{captureGroup:!1,singleline:!1,...e.rules}},n=Jp(t,{flags:r.flags,rules:{captureGroup:r.rules.captureGroup,singleline:r.rules.singleline}}),s=(p,m)=>{const h=n.tokens[o.nextIndex];switch(o.parent=p,o.nextIndex++,h.type){case"Alternator":return mt();case"Assertion":return cd(h);case"Backreference":return(function({raw:y},_){const f=/^\\k[<']/.test(y),w=f?y.slice(3,-1):y.slice(1),k=(x,S=!1)=>{const E=_.capturingGroups.length;let C=!1;if(x>E){if(!_.skipBackrefValidation)throw new Error(`Not enough capturing groups defined to the left "${y}"`);C=!0}return _.hasNumberedRef=!0,Hn(S?E+1-x:x,{orphan:C})};if(f){const x=/^(?<sign>-?)0*(?<num>[1-9]\d*)$/.exec(w);if(x)return k(+x.groups.num,!!x.groups.sign);if(/[-+]/.test(w))throw new Error(`Invalid backref name "${y}"`);if(!_.namedGroupsByName.has(w))throw new Error(`Group name not defined to the left "${y}"`);return Hn(w)}return k(+w)})(h,o);case"Character":return zr(h.value,{useLastValid:!!m.isCheckingRangeEnd});case"CharacterClassHyphen":return(function(y,_,f){const{tokens:w,walk:k}=_,x=_.parent,S=x.body.at(-1),E=w[_.nextIndex];if(!f.isCheckingRangeEnd&&S&&S.type!=="CharacterClass"&&S.type!=="CharacterClassRange"&&E&&E.type!=="CharacterClassOpen"&&E.type!=="CharacterClassClose"&&E.type!=="CharacterClassIntersector"){const C=k(x,{...f,isCheckingRangeEnd:!0});if(S.type==="Character"&&C.type==="Character")return x.body.pop(),(function(N,I){if(I.value<N.value)throw new Error("Character class range out of order");return{type:"CharacterClassRange",min:N,max:I}})(S,C);throw new Error("Invalid character class range")}return zr(Pt("-"))})(0,o,m);case"CharacterClassOpen":return(function({negate:y},_,f){const{tokens:w,walk:k}=_,x=w[_.nextIndex],S=[Fr()];let E=Oa(x);for(;E.type!=="CharacterClassClose";){if(E.type==="CharacterClassIntersector")S.push(Fr()),_.nextIndex++;else{const N=S.at(-1);N.body.push(k(N,f))}E=Oa(w[_.nextIndex],x)}const C=Fr({negate:y});return S.length===1?C.body=S[0].body:(C.kind="intersection",C.body=S.map(N=>N.body.length===1?N.body[0]:N)),_.nextIndex++,C})(h,o,m);case"CharacterSet":return ud(h,o);case"Directive":return dd(h.kind,{flags:h.flags});case"GroupOpen":return(function(y,_,f){const{tokens:w,capturingGroups:k,namedGroupsByName:x,skipLookbehindValidation:S,walk:E}=_,C=(function({flags:A,kind:V,name:T,negate:L,number:G}){switch(V){case"absence_repeater":return(function(z,B){return{type:"AbsenceFunction",kind:z,body:sr(B==null?void 0:B.body)}})("repeater");case"atomic":return Pe({atomic:!0});case"capturing":return Na(G,{name:T});case"group":return Pe({flags:A});case"lookahead":case"lookbehind":return ht({behind:V==="lookbehind",negate:L});default:throw new Error(`Unexpected group kind "${V}"`)}})(y),N=C.type==="AbsenceFunction",I=ja(C),D=I&&C.negate;if(C.type==="CapturingGroup"&&(k.push(C),C.name&&(function(A,V,T){return A.has(V)||A.set(V,T),A.get(V)})(x,C.name,[]).push(C)),N&&f.isInAbsenceFunction)throw new Error("Nested absence function not supported by Oniguruma");let P=$a(w[_.nextIndex]);for(;P.type!=="GroupClose";){if(P.type==="Alternator")C.body.push(mt()),_.nextIndex++;else{const A=C.body.at(-1),V=E(A,{...f,isInAbsenceFunction:f.isInAbsenceFunction||N,isInLookbehind:f.isInLookbehind||I,isInNegLookbehind:f.isInNegLookbehind||D});if(A.body.push(V),(I||f.isInLookbehind)&&!S){const T="Lookbehind includes a pattern not allowed by Oniguruma";if(D||f.isInNegLookbehind){if(La(V)||V.type==="CapturingGroup")throw new Error(T)}else if(La(V)||ja(V)&&V.negate)throw new Error(T)}}P=$a(w[_.nextIndex])}return _.nextIndex++,C})(h,o,m);case"NamedCallout":return(function(y,_,f){return{type:"NamedCallout",kind:y,tag:_,arguments:f}})(h.kind,h.tag,h.arguments);case"Quantifier":return pd(h,o);case"Subroutine":return(function({raw:y},_){const{capturingGroups:f,subroutines:w}=_;let k=y.slice(3,-1);const x=/^(?<sign>[-+]?)0*(?<num>[1-9]\d*)$/.exec(k);if(x){const E=+x.groups.num,C=f.length;if(_.hasNumberedRef=!0,k={"":E,"+":C+E,"-":C+1-E}[x.groups.sign],k<1)throw new Error("Invalid subroutine number")}else k==="0"&&(k=0);const S=Pa(k);return w.push(S),S})(h,o);default:throw new Error(`Unexpected token type "${h.type}"`)}},o={capturingGroups:[],hasNumberedRef:!1,namedGroupsByName:new Map,nextIndex:0,normalizeUnknownPropertyNames:r.normalizeUnknownPropertyNames,parent:null,skipBackrefValidation:r.skipBackrefValidation,skipLookbehindValidation:r.skipLookbehindValidation,skipPropertyNameValidation:r.skipPropertyNameValidation,subroutines:[],tokens:n.tokens,unicodePropertyMap:r.unicodePropertyMap,walk:s},a=(function(p,m){return{type:"Regex",body:sr(m==null?void 0:m.body),flags:p}})((function(p){return{type:"Flags",...p}})(n.flags));let i=a.body[0];for(;o.nextIndex<n.tokens.length;){const p=s(i,{});p.type==="Alternative"?(a.body.push(p),i=p):i.body.push(p)}const{capturingGroups:l,hasNumberedRef:c,namedGroupsByName:u,subroutines:d}=o;if(c&&u.size&&!r.rules.captureGroup)throw new Error("Numbered backref/subroutine not allowed when using named capture");for(const{ref:p}of d)if(typeof p=="number"){if(p>l.length)throw new Error("Subroutine uses a group number that's not defined");p&&(l[p-1].isSubroutined=!0)}else{if(!u.has(p))throw new Error(he`Subroutine uses a group name that's not defined "\g<${p}>"`);if(u.get(p).length>1)throw new Error(he`Subroutine uses a duplicate group name "\g<${p}>"`);u.get(p)[0].isSubroutined=!0}return a}function cd({kind:t}){return Wn(Rt({"^":"line_start",$:"line_end","\\A":"string_start","\\b":"word_boundary","\\B":"word_boundary","\\G":"search_start","\\y":"text_segment_boundary","\\Y":"text_segment_boundary","\\z":"string_end","\\Z":"string_end_newline"}[t],`Unexpected assertion kind "${t}"`),{negate:t===he`\B`||t===he`\Y`})}function ud({kind:t,negate:e,value:r},n){const{normalizeUnknownPropertyNames:s,skipPropertyNameValidation:o,unicodePropertyMap:a}=n;if(t==="property"){const i=Br(r);if(!Bn.has(i)||a!=null&&a.has(i))return jt(r,{negate:e,normalizeUnknownPropertyNames:s,skipPropertyNameValidation:o,unicodePropertyMap:a});t="posix",r=i}return t==="posix"?(function(i,l){const c=!!(l!=null&&l.negate);if(!Bn.has(i))throw new Error(`Invalid POSIX class "${i}"`);return{type:"CharacterSet",kind:"posix",value:i,negate:c}})(r,{negate:e}):Qn(t,{negate:e})}function pd({kind:t,min:e,max:r},n){const s=n.parent,o=s.body.at(-1);if(!o||!(function(i){return ld.has(i.type)})(o))throw new Error("Quantifier requires a repeatable token");const a=Ta(t,e,r,o);return s.body.pop(),a}function mt(t){return{type:"Alternative",body:Ra(t==null?void 0:t.body)}}function Wn(t,e){const r={type:"Assertion",kind:t};return(t==="word_boundary"||t==="text_segment_boundary")&&(r.negate=!!(e!=null&&e.negate)),r}function Hn(t,e){const r=!!(e!=null&&e.orphan);return{type:"Backreference",ref:t,...r&&{orphan:r}}}function Na(t,e){const r={name:void 0,isSubroutined:!1,...e};if(r.name!==void 0&&!(function(n){return/^[\p{Alpha}\p{Pc}][^)]*$/u.test(n)})(r.name))throw new Error(`Group name "${r.name}" invalid in Oniguruma`);return{type:"CapturingGroup",number:t,...r.name&&{name:r.name},...r.isSubroutined&&{isSubroutined:r.isSubroutined},body:sr(e==null?void 0:e.body)}}function zr(t,e){const r={useLastValid:!1,...e};if(t>1114111){const n=t.toString(16);if(!r.useLastValid)throw t>1310719?new Error(`Invalid code point out of range "\\x{${n}}"`):new Error(`Invalid code point out of range in JS "\\x{${n}}"`);t=1114111}return{type:"Character",value:t}}function Fr(t){const e={kind:"union",negate:!1,...t};return{type:"CharacterClass",kind:e.kind,negate:e.negate,body:Ra(t==null?void 0:t.body)}}function Qn(t,e){const r=!!(e!=null&&e.negate),n={type:"CharacterSet",kind:t};return(t==="digit"||t==="hex"||t==="newline"||t==="space"||t==="word")&&(n.negate=r),(t==="text_segment"||t==="newline"&&!r)&&(n.variableLength=!0),n}function dd(t,e={}){if(t==="keep")return{type:"Directive",kind:t};if(t==="flags")return{type:"Directive",kind:t,flags:Rt(e.flags)};throw new Error(`Unexpected directive kind "${t}"`)}function Pe(t){const e=t==null?void 0:t.atomic,r=t==null?void 0:t.flags;if(e&&r)throw new Error("Atomic group cannot have flags");return{type:"Group",...e&&{atomic:e},...r&&{flags:r},body:sr(t==null?void 0:t.body)}}function ht(t){const e={behind:!1,negate:!1,...t};return{type:"LookaroundAssertion",kind:e.behind?"lookbehind":"lookahead",negate:e.negate,body:sr(t==null?void 0:t.body)}}function Ta(t,e,r,n){if(e>r)throw new Error("Invalid reversed quantifier range");return{type:"Quantifier",kind:t,min:e,max:r,body:n}}function Pa(t){return{type:"Subroutine",ref:t}}function jt(t,e){var s;const r={negate:!1,normalizeUnknownPropertyNames:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...e};let n=(s=r.unicodePropertyMap)==null?void 0:s.get(Br(t));if(!n){if(r.normalizeUnknownPropertyNames)n=(function(o){return o.trim().replace(/[- _]+/g,"_").replace(/[A-Z][a-z]+(?=[A-Z])/g,"$&_").replace(/[A-Za-z]+/g,a=>a[0].toUpperCase()+a.slice(1).toLowerCase())})(t);else if(r.unicodePropertyMap&&!r.skipPropertyNameValidation)throw new Error(he`Invalid Unicode property "\p{${t}}"`)}return{type:"CharacterSet",kind:"property",value:n??t,negate:r.negate}}function sr(t){if(t===void 0)t=[mt()];else if(!Array.isArray(t)||!t.length||!t.every(e=>e.type==="Alternative"))throw new Error("Invalid body; expected array of one or more Alternative nodes");return t}function Ra(t){if(t===void 0)t=[];else if(!Array.isArray(t)||!t.every(e=>!!e.type))throw new Error("Invalid body; expected array of nodes");return t}function La(t){return t.type==="LookaroundAssertion"&&t.kind==="lookahead"}function ja(t){return t.type==="LookaroundAssertion"&&t.kind==="lookbehind"}function Br(t){return t.replace(/[- _]+/g,"").toLowerCase()}function Oa(t,e){return Rt(t,((e==null?void 0:e.type)==="Character"&&e.value===93?"Empty":"Unclosed")+" character class")}function $a(t){return Rt(t,"Unclosed group")}function or(t,e,r=null){function n(o,a){for(let i=0;i<o.length;i++){const l=s(o[i],a,i,o);i=Math.max(-1,i+l)}}function s(o,a=null,i=null,l=null){var f,w;let c=0,u=!1;const d={node:o,parent:a,key:i,container:l,root:t,remove(){Ur(l).splice(Math.max(0,Ot(i)+c),1),c--,u=!0},removeAllNextSiblings:()=>Ur(l).splice(Ot(i)+1),removeAllPrevSiblings(){const k=Ot(i)+c;return c-=k,Ur(l).splice(0,Math.max(0,k))},replaceWith(k,x={}){const S=!!x.traverse;l?l[Math.max(0,Ot(i)+c)]=k:Rt(a,"Can't replace root node")[i]=k,S&&s(k,a,i,l),u=!0},replaceWithMultiple(k,x={}){const S=!!x.traverse;if(Ur(l).splice(Math.max(0,Ot(i)+c),1,...k),c+=k.length-1,S){let E=0;for(let C=0;C<k.length;C++)E+=s(k[C],a,Ot(i)+C+E,l)}u=!0},skip(){u=!0}},{type:p}=o,m=e["*"],h=e[p],y=typeof m=="function"?m:m==null?void 0:m.enter,_=typeof h=="function"?h:h==null?void 0:h.enter;if(y==null||y(d,r),_==null||_(d,r),!u)switch(p){case"AbsenceFunction":case"CapturingGroup":case"Group":case"Alternative":case"CharacterClass":case"LookaroundAssertion":n(o.body,o);break;case"Assertion":case"Backreference":case"Character":case"CharacterSet":case"Directive":case"Flags":case"NamedCallout":case"Subroutine":break;case"CharacterClassRange":s(o.min,o,"min"),s(o.max,o,"max");break;case"Quantifier":s(o.body,o,"body");break;case"Regex":n(o.body,o),s(o.flags,o,"flags");break;default:throw new Error(`Unexpected node type "${p}"`)}return(f=h==null?void 0:h.exit)==null||f.call(h,d,r),(w=m==null?void 0:m.exit)==null||w.call(m,d,r),c}return s(t),t}function Ur(t){if(!Array.isArray(t))throw new Error("Container expected");return t}function Ot(t){if(typeof t!="number")throw new Error("Numeric key expected");return t}const md=String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`;function hd(t,e){for(let r=0;r<t.length;r++)t[r]>=e&&t[r]++}function fd(t,e,r,n){return t.slice(0,e)+n+t.slice(e+r.length)}const Ee=Object.freeze({DEFAULT:"DEFAULT",CHAR_CLASS:"CHAR_CLASS"});function Zn(t,e,r,n){const s=new RegExp(String.raw`${e}|(?<$skip>\[\^?|\\?.)`,"gsu"),o=[!1];let a=0,i="";for(const l of t.matchAll(s)){const{0:c,groups:{$skip:u}}=l;u||n&&n===Ee.DEFAULT!=!a?(c[0]==="["?(a++,o.push(c[1]==="^")):c==="]"&&a&&(a--,o.pop()),i+=c):i+=r instanceof Function?r(l,{context:a?Ee.CHAR_CLASS:Ee.DEFAULT,negated:o[o.length-1]}):r}return i}function Da(t,e,r,n){Zn(t,e,r,n)}function qr(t,e,r){return!!(function(n,s,o=0,a){if(!new RegExp(s,"su").test(n))return null;const i=new RegExp(`${s}|(?<$skip>\\\\?.)`,"gsu");i.lastIndex=o;let l,c=0;for(;l=i.exec(n);){const{0:u,groups:{$skip:d}}=l;if(!(d||a&&a===Ee.DEFAULT!=!c))return l;u==="["?c++:u==="]"&&c&&c--,i.lastIndex==l.index&&i.lastIndex++}return null})(t,e,0,r)}function gd(t,e){const r=/\\?./gsu;r.lastIndex=e;let n,s=t.length,o=0,a=1;for(;n=r.exec(t);){const[i]=n;if(i==="[")o++;else if(o)i==="]"&&o--;else if(i==="(")a++;else if(i===")"&&(a--,!a)){s=n.index;break}}return t.slice(e,s)}const Ma=new RegExp(String.raw`(?<noncapturingStart>${md})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`,"gsu"),Va=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,Xn=new RegExp(String.raw`
55
- \\(?: \d+
56
- | c[A-Za-z]
57
- | [gk]<[^>]+>
58
- | [pPu]\{[^\}]+\}
59
- | u[A-Fa-f\d]{4}
60
- | x[A-Fa-f\d]{2}
61
- )
62
- | \((?: \? (?: [:=!>]
63
- | <(?:[=!]|[^>]+>)
64
- | [A-Za-z\-]+:
65
- | \(DEFINE\)
66
- ))?
67
- | (?<qBase>${Va})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?)
68
- | \\?.
69
- `.replace(/\s+/g,""),"gsu"),Se=String.raw,_d=Se`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`,Jn=Se`\(\?R=(?<rDepth>[^\)]+)\)|${_d}`,Wr=Se`\(\?<(?![=!])(?<captureName>[^>]+)>`,Ga=Se`${Wr}|(?<unnamed>\()(?!\?)`,ft=new RegExp(Se`${Wr}|${Jn}|\(\?|\\?.`,"gsu"),Yn="Cannot use multiple overlapping recursions";function za(t){const e=`Max depth must be integer between 2 and 100; used ${t}`;if(!/^[1-9]\d*$/.test(t))throw new Error(e);if((t=+t)<2||t>100)throw new Error(e)}function Fa(t,e,r,n,s,o,a){const i=new Set;n&&Da(t+e,Wr,({groups:{captureName:c}})=>{i.add(c)},Ee.DEFAULT);const l=[r,n?i:null,s,o,a];return`${t}${Ba(`(?:${t}`,"forward",...l)}(?:)${Ba(`${e})`,"backward",...l)}${e}`}function Ba(t,e,r,n,s,o,a){const i=c=>e==="forward"?c+2:r-c+2-1;let l="";for(let c=0;c<r;c++){const u=i(c);l+=Zn(t,Se`${Ga}|\\k<(?<backref>[^>]+)>`,({0:d,groups:{captureName:p,unnamed:m,backref:h}})=>{if(h&&n&&!n.has(h))return d;const y=`_$${u}`;if(m||p){const _=a+o.length+1;return o.push(_),bd(s,_),m?d:`(?<${p}${y}>`}return Se`\k<${h}${y}>`},Ee.DEFAULT)}return l}function bd(t,e){for(let r=0;r<t.length;r++)t[r]>=e&&t[r]++}function Ua(t,e,r,n,s,o){if(t.size&&n){let a=0;Da(e,Ga,()=>a++,Ee.DEFAULT);const i=o-a+s,l=new Map;return t.forEach((c,u)=>{const d=(n-a*r)/r,p=a*r,m=u>i+a?u+n:u,h=[];for(const y of c)if(y<=i)h.push(y);else if(y>i+a+d)h.push(y+n);else if(y<=i+a)for(let _=0;_<=r;_++)h.push(y+a*_);else for(let _=0;_<=r;_++)h.push(y+p+d*_);l.set(m,h)}),l}return t}var ce=String.fromCodePoint,U=String.raw,Be={flagGroups:(()=>{try{new RegExp("(?i:)")}catch{return!1}return!0})(),unicodeSets:(()=>{try{new RegExp("","v")}catch{return!1}return!0})()};function Hr(t,{enable:e,disable:r}){return{dotAll:!(r!=null&&r.dotAll||!(e!=null&&e.dotAll)&&!t.dotAll),ignoreCase:!(r!=null&&r.ignoreCase||!(e!=null&&e.ignoreCase)&&!t.ignoreCase)}}function ar(t,e,r){return t.has(e)||t.set(e,r),t.get(e)}function Kn(t,e){return qa[t]>=qa[e]}Be.bugFlagVLiteralHyphenIsRange=!!Be.unicodeSets&&(()=>{try{new RegExp(U`[\d\-a]`,"v")}catch{return!0}return!1})(),Be.bugNestedClassIgnoresNegation=Be.unicodeSets&&new RegExp("[[^a]]","v").test("a");var qa={ES2025:2025,ES2024:2024,ES2018:2018},yd={auto:"auto",ES2025:"ES2025",ES2024:"ES2024",ES2018:"ES2018"};function Wa(t={}){if({}.toString.call(t)!=="[object Object]")throw new Error("Unexpected options");if(t.target!==void 0&&!yd[t.target])throw new Error(`Unexpected target "${t.target}"`);const e={accuracy:"default",avoidSubclass:!1,flags:"",global:!1,hasIndices:!1,lazyCompileLength:1/0,target:"auto",verbose:!1,...t,rules:{allowOrphanBackrefs:!1,asciiWordBoundaries:!1,captureGroup:!1,recursionLimit:20,singleline:!1,...t.rules}};return e.target==="auto"&&(e.target=Be.flagGroups?"ES2025":Be.unicodeSets?"ES2024":"ES2018"),e}var xd=new Set([ce(304),ce(305)]),Ue=U`[\p{L}\p{M}\p{N}\p{Pc}]`;function Ha(t){if(xd.has(t))return[t];const e=new Set,r=t.toLowerCase(),n=r.toUpperCase(),s=vd.get(r),o=wd.get(r),a=kd.get(r);return[...n].length===1&&e.add(n),a&&e.add(a),s&&e.add(s),e.add(r),o&&e.add(o),[...e]}var es=new Map(`C Other
70
- Cc Control cntrl
71
- Cf Format
72
- Cn Unassigned
73
- Co Private_Use
74
- Cs Surrogate
75
- L Letter
76
- LC Cased_Letter
77
- Ll Lowercase_Letter
78
- Lm Modifier_Letter
79
- Lo Other_Letter
80
- Lt Titlecase_Letter
81
- Lu Uppercase_Letter
82
- M Mark Combining_Mark
83
- Mc Spacing_Mark
84
- Me Enclosing_Mark
85
- Mn Nonspacing_Mark
86
- N Number
87
- Nd Decimal_Number digit
88
- Nl Letter_Number
89
- No Other_Number
90
- P Punctuation punct
91
- Pc Connector_Punctuation
92
- Pd Dash_Punctuation
93
- Pe Close_Punctuation
94
- Pf Final_Punctuation
95
- Pi Initial_Punctuation
96
- Po Other_Punctuation
97
- Ps Open_Punctuation
98
- S Symbol
99
- Sc Currency_Symbol
100
- Sk Modifier_Symbol
101
- Sm Math_Symbol
102
- So Other_Symbol
103
- Z Separator
104
- Zl Line_Separator
105
- Zp Paragraph_Separator
106
- Zs Space_Separator
107
- ASCII
108
- ASCII_Hex_Digit AHex
109
- Alphabetic Alpha
110
- Any
111
- Assigned
112
- Bidi_Control Bidi_C
113
- Bidi_Mirrored Bidi_M
114
- Case_Ignorable CI
115
- Cased
116
- Changes_When_Casefolded CWCF
117
- Changes_When_Casemapped CWCM
118
- Changes_When_Lowercased CWL
119
- Changes_When_NFKC_Casefolded CWKCF
120
- Changes_When_Titlecased CWT
121
- Changes_When_Uppercased CWU
122
- Dash
123
- Default_Ignorable_Code_Point DI
124
- Deprecated Dep
125
- Diacritic Dia
126
- Emoji
127
- Emoji_Component EComp
128
- Emoji_Modifier EMod
129
- Emoji_Modifier_Base EBase
130
- Emoji_Presentation EPres
131
- Extended_Pictographic ExtPict
132
- Extender Ext
133
- Grapheme_Base Gr_Base
134
- Grapheme_Extend Gr_Ext
135
- Hex_Digit Hex
136
- IDS_Binary_Operator IDSB
137
- IDS_Trinary_Operator IDST
138
- ID_Continue IDC
139
- ID_Start IDS
140
- Ideographic Ideo
141
- Join_Control Join_C
142
- Logical_Order_Exception LOE
143
- Lowercase Lower
144
- Math
145
- Noncharacter_Code_Point NChar
146
- Pattern_Syntax Pat_Syn
147
- Pattern_White_Space Pat_WS
148
- Quotation_Mark QMark
149
- Radical
150
- Regional_Indicator RI
151
- Sentence_Terminal STerm
152
- Soft_Dotted SD
153
- Terminal_Punctuation Term
154
- Unified_Ideograph UIdeo
155
- Uppercase Upper
156
- Variation_Selector VS
157
- White_Space space
158
- XID_Continue XIDC
159
- XID_Start XIDS`.split(/\s/).map(t=>[Br(t),t])),wd=new Map([["s",ce(383)],[ce(383),"s"]]),kd=new Map([[ce(223),ce(7838)],[ce(107),ce(8490)],[ce(229),ce(8491)],[ce(969),ce(8486)]]),vd=new Map([rt(453),rt(456),rt(459),rt(498),...ts(8072,8079),...ts(8088,8095),...ts(8104,8111),rt(8124),rt(8140),rt(8188)]),Ed=new Map([["alnum",U`[\p{Alpha}\p{Nd}]`],["alpha",U`\p{Alpha}`],["ascii",U`\p{ASCII}`],["blank",U`[\p{Zs}\t]`],["cntrl",U`\p{Cc}`],["digit",U`\p{Nd}`],["graph",U`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],["lower",U`\p{Lower}`],["print",U`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],["punct",U`[\p{P}\p{S}]`],["space",U`\p{space}`],["upper",U`\p{Upper}`],["word",U`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],["xdigit",U`\p{AHex}`]]);function rt(t){const e=ce(t);return[e.toLowerCase(),e]}function ts(t,e){return(function(r,n){const s=[];for(let o=r;o<=n;o++)s.push(o);return s})(t,e).map(r=>rt(r))}var Qa=new Set(["Lower","Lowercase","Upper","Uppercase","Ll","Lowercase_Letter","Lt","Titlecase_Letter","Lu","Uppercase_Letter"]),Sd={AbsenceFunction({node:t,parent:e,replaceWith:r}){const{body:n,kind:s}=t;if(s!=="repeater")throw new Error('Unsupported absence function "(?~|"');{const o=Pe();o.body[0].body.push(ht({negate:!0,body:n}),jt("Any"));const a=Pe();a.body[0].body.push(Ta("greedy",0,1/0,o)),r(ne(a,e),{traverse:!0})}},Alternative:{enter({node:t,parent:e,key:r},{flagDirectivesByAlt:n}){const s=t.body.filter(o=>o.kind==="flags");for(let o=r+1;o<e.body.length;o++)ar(n,e.body[o],[]).push(...s)},exit({node:t},{flagDirectivesByAlt:e}){var r;if((r=e.get(t))!=null&&r.length){const n=Ya(e.get(t));if(n){const s=Pe({flags:n});s.body[0].body=t.body,t.body=[ne(s,t)]}}}},Assertion({node:t,parent:e,key:r,container:n,root:s,remove:o,replaceWith:a},i){const{kind:l,negate:c}=t,{asciiWordBoundaries:u,avoidSubclass:d,supportedGNodes:p,wordIsAscii:m}=i;if(l==="text_segment_boundary")throw new Error(`Unsupported text segment boundary "\\${c?"Y":"y"}"`);if(l==="line_end")a(ne(ht({body:[mt({body:[Wn("string_end")]}),mt({body:[zr(10)]})]}),e));else if(l==="line_start")a(ne(qe(U`(?<=\A|\n(?!\z))`,{skipLookbehindValidation:!0}),e));else if(l==="search_start")if(p.has(t))s.flags.sticky=!0,o();else{const h=n[r-1];if(h&&(function(y){const _=["Character","CharacterClass","CharacterSet"];return _.includes(y.type)||y.type==="Quantifier"&&y.min&&_.includes(y.body.type)})(h))a(ne(ht({negate:!0}),e));else{if(d)throw new Error(U`Uses "\G" in a way that requires a subclass`);a(nt(Wn("string_start"),e)),i.strategy="clip_search"}}else if(!(l==="string_end"||l==="string_start"))if(l==="string_end_newline")a(ne(qe(U`(?=\n?\z)`),e));else{if(l!=="word_boundary")throw new Error(`Unexpected assertion kind "${l}"`);!m&&!u&&a(ne(qe(c?`(?:(?<=${Ue})(?=${Ue})|(?<!${Ue})(?!${Ue}))`:`(?:(?<=${Ue})(?!${Ue})|(?<!${Ue})(?=${Ue}))`),e))}},Backreference({node:t},{jsGroupNameMap:e}){let{ref:r}=t;typeof r!="string"||ns(r)||(r=rs(r,e),t.ref=r)},CapturingGroup({node:t},{jsGroupNameMap:e,subroutineRefMap:r}){let{name:n}=t;n&&!ns(n)&&(n=rs(n,e),t.name=n),r.set(t.number,t),n&&r.set(n,t)},CharacterClassRange({node:t,parent:e,replaceWith:r}){e.kind==="intersection"&&r(ne(Fr({body:[t]}),e),{traverse:!0})},CharacterSet({node:t,parent:e,replaceWith:r},{accuracy:n,minTargetEs2024:s,digitIsAscii:o,spaceIsAscii:a,wordIsAscii:i}){const{kind:l,negate:c,value:u}=t;if(!o||l!=="digit"&&u!=="digit")if(!a||l!=="space"&&u!=="space")if(!i||l!=="word"&&u!=="word"){if(l==="any")r(nt(jt("Any"),e));else if(l==="digit")r(nt(jt("Nd",{negate:c}),e));else if(l!=="dot")if(l==="text_segment"){if(n==="strict")throw new Error(U`Use of "\X" requires non-strict accuracy`);const d="\\p{Emoji}(?:\\p{EMod}|\\uFE0F\\u20E3?|[\\x{E0020}-\\x{E007E}]+\\x{E007F})?",p=U`\p{RI}{2}|${d}(?:\u200D${d})*`;r(ne(qe(U`(?>\r\n|${s?U`\p{RGI_Emoji}`:p}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),e))}else if(l==="hex")r(nt(jt("AHex",{negate:c}),e));else if(l==="newline")r(ne(qe(c?`[^
160
- ]`:`(?>\r
161
- ?|[
162
- \v\f\x85\u2028\u2029])`),e));else if(l==="posix")if(s||u!=="graph"&&u!=="print")r(ne(ss(qe(Ed.get(u)),c),e));else{if(n==="strict")throw new Error(`POSIX class "${u}" requires min target ES2024 or non-strict accuracy`);let d={graph:"!-~",print:" -~"}[u];c&&(d=`\0-${ce(d.codePointAt(0)-1)}${ce(d.codePointAt(2)+1)}-\u{10FFFF}`),r(ne(qe(`[${d}]`),e))}else if(l==="property")es.has(Br(u))||(t.key="sc");else if(l==="space")r(nt(jt("space",{negate:c}),e));else{if(l!=="word")throw new Error(`Unexpected character set kind "${l}"`);r(ne(ss(qe(Ue),c),e))}}else r(nt(Qn("word",{negate:c}),e));else r(ne(ss(qe("[ -\r ]"),c),e));else r(nt(Qn("digit",{negate:c}),e))},Directive({node:t,parent:e,root:r,remove:n,replaceWith:s,removeAllPrevSiblings:o,removeAllNextSiblings:a}){const{kind:i,flags:l}=t;if(i==="flags")if(l.enable||l.disable){const c=Pe({flags:l});c.body[0].body=a(),s(ne(c,e),{traverse:!0})}else n();else{if(i!=="keep")throw new Error(`Unexpected directive kind "${i}"`);{const c=r.body[0],u=r.body.length===1&&Aa(c,{type:"Group"})&&c.body[0].body.length===1?c.body[0]:r;if(e.parent!==u||u.body.length>1)throw new Error(U`Uses "\K" in a way that's unsupported`);const d=ht({behind:!0});d.body[0].body=o(),s(ne(d,e))}}},Flags({node:t,parent:e}){if(t.posixIsAscii)throw new Error('Unsupported flag "P"');if(t.textSegmentMode==="word")throw new Error('Unsupported flag "y{w}"');["digitIsAscii","extended","posixIsAscii","spaceIsAscii","wordIsAscii","textSegmentMode"].forEach(r=>delete t[r]),Object.assign(t,{global:!1,hasIndices:!1,multiline:!1,sticky:t.sticky??!1}),e.options={disable:{x:!0,n:!0},force:{v:!0}}},Group({node:t}){if(!t.flags)return;const{enable:e,disable:r}=t.flags;e!=null&&e.extended&&delete e.extended,r!=null&&r.extended&&delete r.extended,e!=null&&e.dotAll&&(r!=null&&r.dotAll)&&delete e.dotAll,e!=null&&e.ignoreCase&&(r!=null&&r.ignoreCase)&&delete e.ignoreCase,e&&!Object.keys(e).length&&delete t.flags.enable,r&&!Object.keys(r).length&&delete t.flags.disable,!t.flags.enable&&!t.flags.disable&&delete t.flags},LookaroundAssertion({node:t},e){const{kind:r}=t;r==="lookbehind"&&(e.passedLookbehind=!0)},NamedCallout({node:t,parent:e,replaceWith:r}){const{kind:n}=t;if(n!=="fail")throw new Error(`Unsupported named callout "(*${n.toUpperCase()}"`);r(ne(ht({negate:!0}),e))},Quantifier({node:t}){if(t.body.type==="Quantifier"){const e=Pe();e.body[0].body.push(t.body),t.body=ne(e,t)}},Regex:{enter({node:t},{supportedGNodes:e}){const r=[];let n=!1,s=!1;for(const o of t.body)if(o.body.length===1&&o.body[0].kind==="search_start")o.body.pop();else{const a=ei(o.body);a?(n=!0,Array.isArray(a)?r.push(...a):r.push(a)):s=!0}n&&!s&&r.forEach(o=>e.add(o))},exit(t,{accuracy:e,passedLookbehind:r,strategy:n}){if(e==="strict"&&r&&n)throw new Error(U`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:t},{jsGroupNameMap:e}){let{ref:r}=t;typeof r!="string"||ns(r)||(r=rs(r,e),t.ref=r)}},Cd={Backreference({node:t},{multiplexCapturesToLeftByRef:e,reffedNodesByReferencer:r}){const{orphan:n,ref:s}=t;n||r.set(t,[...e.get(s).map(({node:o})=>o)])},CapturingGroup:{enter({node:t,parent:e,replaceWith:r,skip:n},{groupOriginByCopy:s,groupsByName:o,multiplexCapturesToLeftByRef:a,openRefs:i,reffedNodesByReferencer:l}){const c=s.get(t);if(c&&i.has(t.number)){const d=nt(Ja(t.number),e);return l.set(d,i.get(t.number)),void r(d)}i.set(t.number,t),a.set(t.number,[]),t.name&&ar(a,t.name,[]);const u=a.get(t.name??t.number);for(let d=0;d<u.length;d++){const p=u[d];if(c===p.node||c&&c===p.origin||t===p.origin){u.splice(d,1);break}}if(a.get(t.number).push({node:t,origin:c}),t.name&&a.get(t.name).push({node:t,origin:c}),t.name){const d=ar(o,t.name,new Map);let p=!1;if(c)p=!0;else for(const m of d.values())if(!m.hasDuplicateNameToRemove){p=!0;break}o.get(t.name).set(t,{node:t,hasDuplicateNameToRemove:p})}},exit({node:t},{openRefs:e}){e.delete(t.number)}},Group:{enter({node:t},e){e.prevFlags=e.currentFlags,t.flags&&(e.currentFlags=Hr(e.currentFlags,t.flags))},exit(t,e){e.currentFlags=e.prevFlags}},Subroutine({node:t,parent:e,replaceWith:r},n){const{isRecursive:s,ref:o}=t;if(s){let u=e;for(;(u=u.parent)&&(u.type!=="CapturingGroup"||u.name!==o&&u.number!==o););return void n.reffedNodesByReferencer.set(t,u)}const a=n.subroutineRefMap.get(o),i=o===0,l=i?Ja(0):Xa(a,n.groupOriginByCopy,null);let c=l;if(!i){const u=Ya((function(p,m){const h=[];for(;p=p.parent;)m&&!m(p)||h.push(p);return h})(a,p=>p.type==="Group"&&!!p.flags)),d=u?Hr(n.globalFlags,u):n.globalFlags;(function(p,m){return p.dotAll===m.dotAll&&p.ignoreCase===m.ignoreCase})(d,n.currentFlags)||(c=Pe({flags:Id(d)}),c.body[0].body.push(l))}r(ne(c,e),{traverse:!i})}},Ad={Backreference({node:t,parent:e,replaceWith:r},n){if(t.orphan)return void(n.highestOrphanBackref=Math.max(n.highestOrphanBackref,t.ref));const s=n.reffedNodesByReferencer.get(t).filter(o=>(function(a,i){let l=i;do{if(l.type==="Regex")return!1;if(l.type==="Alternative")continue;if(l===a)return!1;const c=Ka(l.parent);for(const u of c){if(u===l)break;if(u===a||ti(u,a))return!0}}while(l=l.parent);throw new Error("Unexpected path")})(o,t));s.length?s.length>1?r(ne(Pe({atomic:!0,body:s.reverse().map(o=>mt({body:[Hn(o.number)]}))}),e)):t.ref=s[0].number:r(ne(ht({negate:!0}),e))},CapturingGroup({node:t},e){t.number=++e.numCapturesToLeft,t.name&&e.groupsByName.get(t.name).get(t).hasDuplicateNameToRemove&&delete t.name},Regex:{exit({node:t},e){const r=Math.max(e.highestOrphanBackref-e.numCapturesToLeft,0);for(let n=0;n<r;n++){const s=Na();t.body.at(-1).body.push(s)}}},Subroutine({node:t},e){t.isRecursive&&t.ref!==0&&(t.ref=e.reffedNodesByReferencer.get(t).number)}};function Za(t){or(t,{"*"({node:e,parent:r}){e.parent=r}})}function Xa(t,e,r,n){const s=Array.isArray(t)?[]:{};for(const[o,a]of Object.entries(t))o==="parent"?s.parent=Array.isArray(r)?n:r:a&&typeof a=="object"?s[o]=Xa(a,e,s,r):(o==="type"&&a==="CapturingGroup"&&e.set(s,e.get(t)??t),s[o]=a);return s}function Ja(t){const e=Pa(t);return e.isRecursive=!0,e}function rs(t,e){if(e.has(t))return e.get(t);const r=`$${e.size}_${t.replace(/^[^$_\p{IDS}]|[^$\u200C\u200D\p{IDC}]/gu,"_")}`;return e.set(t,r),r}function Ya(t){const e=["dotAll","ignoreCase"],r={enable:{},disable:{}};return t.forEach(({flags:n})=>{e.forEach(s=>{var o,a;(o=n.enable)!=null&&o[s]&&(delete r.disable[s],r.enable[s]=!0),(a=n.disable)!=null&&a[s]&&(r.disable[s]=!0)})}),Object.keys(r.enable).length||delete r.enable,Object.keys(r.disable).length||delete r.disable,r.enable||r.disable?r:null}function Id({dotAll:t,ignoreCase:e}){const r={};return(t||e)&&(r.enable={},t&&(r.enable.dotAll=!0),e&&(r.enable.ignoreCase=!0)),t&&e||(r.disable={},!t&&(r.disable.dotAll=!0),!e&&(r.disable.ignoreCase=!0)),r}function Ka(t){if(!t)throw new Error("Node expected");const{body:e}=t;return Array.isArray(e)?e:e?[e]:null}function ei(t){const e=t.find(r=>r.kind==="search_start"||(function(n,s){const o={negate:null,...s};return n.type==="LookaroundAssertion"&&(o.negate===null||n.negate===o.negate)&&n.body.length===1&&Aa(n.body[0],{type:"Assertion",kind:"search_start"})})(r,{negate:!1})||!(function({type:n}){return n==="Assertion"||n==="Directive"||n==="LookaroundAssertion"})(r));if(!e)return null;if(e.kind==="search_start")return e;if(e.type==="LookaroundAssertion")return e.body[0].body[0];if(e.type==="CapturingGroup"||e.type==="Group"){const r=[];for(const n of e.body){const s=ei(n.body);if(!s)return null;Array.isArray(s)?r.push(...s):r.push(s)}return r}return null}function ti(t,e){const r=Ka(t)??[];for(const n of r)if(n===e||ti(n,e))return!0;return!1}function ns(t){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(t)}function qe(t,e){const r=Ia(t,{...e,unicodePropertyMap:es}).body;return r.length>1||r[0].body.length>1?Pe({body:r}):r[0].body[0]}function ss(t,e){return t.negate=e,t}function nt(t,e){return t.parent=e,t}function ne(t,e){return Za(t),t.parent=e,t}function Nd(t,e){const r=Wa(e),n=Kn(r.target,"ES2024"),s=Kn(r.target,"ES2025"),o=r.rules.recursionLimit;if(!Number.isInteger(o)||o<2||o>20)throw new Error("Invalid recursionLimit; use 2-20");let a=null,i=null;if(!s){const m=[t.flags.ignoreCase];or(t,Td,{getCurrentModI:()=>m.at(-1),popModI(){m.pop()},pushModI(h){m.push(h)},setHasCasedChar(){m.at(-1)?a=!0:i=!0}})}const l={dotAll:t.flags.dotAll,ignoreCase:!(!t.flags.ignoreCase&&!a||i)};let c=t;const u={accuracy:r.accuracy,appliedGlobalFlags:l,captureMap:new Map,currentFlags:{dotAll:t.flags.dotAll,ignoreCase:t.flags.ignoreCase},inCharClass:!1,lastNode:c,originMap:t._originMap,recursionLimit:o,useAppliedIgnoreCase:!(s||!a||!i),useFlagMods:s,useFlagV:n,verbose:r.verbose};function d(m){return u.lastNode=c,c=m,(function(h,y){if(h==null)throw new Error(y??"Value expected");return h})(Pd[m.type],`Unexpected node type "${m.type}"`)(m,u,d)}const p={pattern:t.body.map(d).join("|"),flags:d(t.flags),options:{...t.options}};return n||(delete p.options.force.v,p.options.disable.v=!0,p.options.unicodeSetsPlugin=null),p._captureTransfers=new Map,p._hiddenCaptures=[],u.captureMap.forEach((m,h)=>{m.hidden&&p._hiddenCaptures.push(h),m.transferTo&&ar(p._captureTransfers,m.transferTo,[]).push(h)}),p}var Td={"*":{enter({node:t},e){if(si(t)){const r=e.getCurrentModI();e.pushModI(t.flags?Hr({ignoreCase:r},t.flags).ignoreCase:r)}},exit({node:t},e){si(t)&&e.popModI()}},Backreference(t,e){e.setHasCasedChar()},Character({node:t},e){os(ce(t.value))&&e.setHasCasedChar()},CharacterClassRange({node:t,skip:e},r){e(),ni(t,{firstOnly:!0}).length&&r.setHasCasedChar()},CharacterSet({node:t},e){t.kind==="property"&&Qa.has(t.value)&&e.setHasCasedChar()}},Pd={Alternative:({body:t},e,r)=>t.map(r).join(""),Assertion({kind:t,negate:e}){if(t==="string_end")return"$";if(t==="string_start")return"^";if(t==="word_boundary")return e?U`\B`:U`\b`;throw new Error(`Unexpected assertion kind "${t}"`)},Backreference({ref:t},e){if(typeof t!="number")throw new Error("Unexpected named backref in transformed AST");if(!e.useFlagMods&&e.accuracy==="strict"&&e.currentFlags.ignoreCase&&!e.captureMap.get(t).ignoreCase)throw new Error("Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy");return"\\"+t},CapturingGroup(t,e,r){const{body:n,name:s,number:o}=t,a={ignoreCase:e.currentFlags.ignoreCase},i=e.originMap.get(t);return i&&(a.hidden=!0,o>i.number&&(a.transferTo=i.number)),e.captureMap.set(o,a),`(${s?`?<${s}>`:""}${n.map(r).join("|")})`},Character({value:t},e){const r=ce(t),n=$t(t,{escDigit:e.lastNode.type==="Backreference",inCharClass:e.inCharClass,useFlagV:e.useFlagV});if(n!==r)return n;if(e.useAppliedIgnoreCase&&e.currentFlags.ignoreCase&&os(r)){const s=Ha(r);return e.inCharClass?s.join(""):s.length>1?`[${s.join("")}]`:s[0]}return r},CharacterClass(t,e,r){const{kind:n,negate:s,parent:o}=t;let{body:a}=t;if(n==="intersection"&&!e.useFlagV)throw new Error("Use of class intersection requires min target ES2024");Be.bugFlagVLiteralHyphenIsRange&&e.useFlagV&&a.some(oi)&&(a=[zr(45),...a.filter(c=>!oi(c))]);const i=()=>`[${s?"^":""}${a.map(r).join(n==="intersection"?"&&":"")}]`;if(!e.inCharClass){if((!e.useFlagV||Be.bugNestedClassIgnoresNegation)&&!s){const u=a.filter(d=>d.type==="CharacterClass"&&d.kind==="union"&&d.negate);if(u.length){const d=Pe(),p=d.body[0];return d.parent=o,p.parent=d,a=a.filter(m=>!u.includes(m)),t.body=a,a.length?(t.parent=p,p.body.push(t)):d.body.pop(),u.forEach(m=>{const h=mt({body:[m]});m.parent=h,h.parent=d,d.body.push(h)}),r(d)}}e.inCharClass=!0;const c=i();return e.inCharClass=!1,c}const l=a[0];if(n==="union"&&!s&&l&&((!e.useFlagV||!e.verbose)&&o.kind==="union"&&(!Be.bugFlagVLiteralHyphenIsRange||!e.useFlagV)||!e.verbose&&o.kind==="intersection"&&a.length===1&&l.type!=="CharacterClassRange"))return a.map(r).join("");if(!e.useFlagV&&o.type==="CharacterClass")throw new Error("Use of nested character class requires min target ES2024");return i()},CharacterClassRange(t,e){const r=t.min.value,n=t.max.value,s={escDigit:!1,inCharClass:!0,useFlagV:e.useFlagV},o=$t(r,s),a=$t(n,s),i=new Set;return e.useAppliedIgnoreCase&&e.currentFlags.ignoreCase&&(function(c){const u=c.map(m=>m.codePointAt(0)).sort((m,h)=>m-h),d=[];let p=null;for(let m=0;m<u.length;m++)u[m+1]===u[m]+1?p??(p=u[m]):p===null?d.push(u[m]):(d.push([p,u[m]]),p=null);return d})(ni(t)).forEach(c=>{i.add(Array.isArray(c)?`${$t(c[0],s)}-${$t(c[1],s)}`:$t(c,s))}),`${o}-${a}${[...i].join("")}`},CharacterSet({kind:t,negate:e,value:r,key:n},s){if(t==="dot")return s.currentFlags.dotAll?s.appliedGlobalFlags.dotAll||s.useFlagMods?".":"[^]":U`[^\n]`;if(t==="digit")return e?U`\D`:U`\d`;if(t==="property"){if(s.useAppliedIgnoreCase&&s.currentFlags.ignoreCase&&Qa.has(r))throw new Error(`Unicode property "${r}" can't be case-insensitive when other chars have specific case`);return`${e?U`\P`:U`\p`}{${n?`${n}=`:""}${r}}`}if(t==="word")return e?U`\W`:U`\w`;throw new Error(`Unexpected character set kind "${t}"`)},Flags:(t,e)=>(e.appliedGlobalFlags.ignoreCase?"i":"")+(t.dotAll?"s":"")+(t.sticky?"y":""),Group({atomic:t,body:e,flags:r,parent:n},s,o){const a=s.currentFlags;r&&(s.currentFlags=Hr(a,r));const i=e.map(o).join("|"),l=s.verbose||e.length!==1||n.type==="Quantifier"||t||s.useFlagMods&&r?`(?${(function(c,u,d){if(c)return">";let p="";if(u&&d){const{enable:m,disable:h}=u;p=(m!=null&&m.ignoreCase?"i":"")+(m!=null&&m.dotAll?"s":"")+(h?"-":"")+(h!=null&&h.ignoreCase?"i":"")+(h!=null&&h.dotAll?"s":"")}return`${p}:`})(t,r,s.useFlagMods)}${i})`:i;return s.currentFlags=a,l},LookaroundAssertion:({body:t,kind:e,negate:r},n,s)=>`(?${`${e==="lookahead"?"":"<"}${r?"!":"="}`}${t.map(s).join("|")})`,Quantifier:(t,e,r)=>r(t.body)+(function({kind:n,max:s,min:o}){let a;return a=o||s!==1?o||s!==1/0?o===1&&s===1/0?"+":o===s?`{${o}}`:`{${o},${s===1/0?"":s}}`:"*":"?",a+{greedy:"",lazy:"?",possessive:"+"}[n]})(t),Subroutine({isRecursive:t,ref:e},r){if(!t)throw new Error("Unexpected non-recursive subroutine in transformed AST");const n=r.recursionLimit;return e===0?`(?R=${n})`:U`\g<${e}&R=${n}>`}},Rd=new Set(["$","(",")","*","+",".","?","[","\\","]","^","{","|","}"]),Ld=new Set(["-","\\","]","^","["]),jd=new Set(["(",")","-","/","[","\\","]","^","{","|","}","!","#","$","%","&","*","+",",",".",":",";","<","=",">","?","@","`","~"]),ri=new Map([[9,U`\t`],[10,U`\n`],[11,U`\v`],[12,U`\f`],[13,U`\r`],[8232,U`\u2028`],[8233,U`\u2029`],[65279,U`\uFEFF`]]),Od=new RegExp("^\\p{Cased}$","u");function os(t){return Od.test(t)}function ni(t,e){const r=!!(e!=null&&e.firstOnly),n=t.min.value,s=t.max.value,o=[];if(n<65&&(s===65535||s>=131071)||n===65536&&s>=131071)return o;for(let a=n;a<=s;a++){const i=ce(a);if(!os(i))continue;const l=Ha(i).filter(c=>{const u=c.codePointAt(0);return u<n||u>s});if(l.length&&(o.push(...l),r))break}return o}function $t(t,{escDigit:e,inCharClass:r,useFlagV:n}){if(ri.has(t))return ri.get(t);if(t<32||t>126&&t<160||t>262143||e&&(s=t)>47&&s<58)return t>255?`\\u{${t.toString(16).toUpperCase()}}`:`\\x${t.toString(16).toUpperCase().padStart(2,"0")}`;var s;const o=r?n?jd:Ld:Rd,a=ce(t);return(o.has(a)?"\\":"")+a}function si({type:t}){return t==="CapturingGroup"||t==="Group"||t==="LookaroundAssertion"}function oi({type:t,value:e}){return t==="Character"&&e===45}var $d=(it=class extends RegExp{constructor(r,n,s){var e=(...ug)=>(super(...ug),we(this,gr),we(this,ot,new Map),we(this,Xe,null),we(this,yt),we(this,at,null),we(this,xt,null),v(this,"rawOptions",{}),this);const o=!!(s!=null&&s.lazyCompile);if(r instanceof RegExp){if(s)throw new Error("Cannot provide options when copying a regexp");const a=r;e(a,n),fe(this,yt,a.source),a instanceof it&&(fe(this,ot,J(a,ot)),fe(this,at,J(a,at)),fe(this,xt,J(a,xt)),this.rawOptions=a.rawOptions)}else{const a={hiddenCaptures:[],strategy:null,transfers:[],...s};e(o?"":r,n),fe(this,yt,r),fe(this,ot,(function(i,l){const c=new Map;for(const u of i)c.set(u,{hidden:!0});for(const[u,d]of l)for(const p of d)ar(c,p,{}).transferTo=u;return c})(a.hiddenCaptures,a.transfers)),fe(this,xt,a.strategy),this.rawOptions=s??{}}o||fe(this,Xe,this)}get source(){return J(this,yt)||"(?:)"}exec(r){if(!J(this,Xe)){const{lazyCompile:o,...a}=this.rawOptions;fe(this,Xe,new it(J(this,yt),this.flags,a))}const n=this.global||this.sticky,s=this.lastIndex;if(J(this,xt)==="clip_search"&&n&&s){this.lastIndex=0;const o=Re(this,gr,Bs).call(this,r.slice(s));return o&&((function(a,i,l,c){if(a.index+=i,a.input=l,c){const u=a.indices;for(let p=0;p<u.length;p++){const m=u[p];m&&(u[p]=[m[0]+i,m[1]+i])}const d=u.groups;d&&Object.keys(d).forEach(p=>{const m=d[p];m&&(d[p]=[m[0]+i,m[1]+i])})}})(o,s,r,this.hasIndices),this.lastIndex+=s),o}return Re(this,gr,Bs).call(this,r)}},ot=new WeakMap,Xe=new WeakMap,yt=new WeakMap,at=new WeakMap,xt=new WeakMap,gr=new WeakSet,Bs=function(r){J(this,Xe).lastIndex=this.lastIndex;const n=kl(it.prototype,this,"exec").call(J(this,Xe),r);if(this.lastIndex=J(this,Xe).lastIndex,!n||!J(this,ot).size)return n;const s=[...n];let o;n.length=1,this.hasIndices&&(o=[...n.indices],n.indices.length=1);const a=[0];for(let i=1;i<s.length;i++){const{hidden:l,transferTo:c}=J(this,ot).get(i)??{};if(l?a.push(null):(a.push(n.length),n.push(s[i]),this.hasIndices&&n.indices.push(o[i])),c&&s[i]!==void 0){const u=a[c];if(!u)throw new Error(`Invalid capture transfer to "${u}"`);if(n[u]=s[i],this.hasIndices&&(n.indices[u]=o[i]),n.groups){J(this,at)||fe(this,at,Dd(this.source));const d=J(this,at).get(c);d&&(n.groups[d]=s[i],this.hasIndices&&(n.indices.groups[d]=o[i]))}}}return n},it);function Dd(t){const e=/(?<capture>\((?:\?<(?![=!])(?<name>[^>]+)>|(?!\?)))|\\?./gsu,r=new Map;let n,s=0,o=0;for(;n=e.exec(t);){const{0:a,groups:{capture:i,name:l}}=n;a==="["?s++:s?a==="]"&&s--:i&&(o++,l&&r.set(o,l))}return r}function Md(t,e){const r=(function(n,s){const o=Wa(s),a=Ia(n,{flags:o.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:o.rules.captureGroup,singleline:o.rules.singleline},skipBackrefValidation:o.rules.allowOrphanBackrefs,unicodePropertyMap:es}),i=(function(p,m){const h={accuracy:"default",asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:"ES2025",...m};Za(p);const y={accuracy:h.accuracy,asciiWordBoundaries:h.asciiWordBoundaries,avoidSubclass:h.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:Kn(h.bestEffortTarget,"ES2024"),passedLookbehind:!1,strategy:null,subroutineRefMap:new Map,supportedGNodes:new Set,digitIsAscii:p.flags.digitIsAscii,spaceIsAscii:p.flags.spaceIsAscii,wordIsAscii:p.flags.wordIsAscii};or(p,Sd,y);const _={dotAll:p.flags.dotAll,ignoreCase:p.flags.ignoreCase},f={currentFlags:_,prevFlags:null,globalFlags:_,groupOriginByCopy:new Map,groupsByName:new Map,multiplexCapturesToLeftByRef:new Map,openRefs:new Map,reffedNodesByReferencer:new Map,subroutineRefMap:y.subroutineRefMap};return or(p,Cd,f),or(p,Ad,{groupsByName:f.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:f.reffedNodesByReferencer}),p._originMap=f.groupOriginByCopy,p._strategy=y.strategy,p})(a,{accuracy:o.accuracy,asciiWordBoundaries:o.rules.asciiWordBoundaries,avoidSubclass:o.avoidSubclass,bestEffortTarget:o.target}),l=Nd(i,o),c=(function(p,m){const{hiddenCaptures:h,mode:y}={hiddenCaptures:[],mode:"plugin",...m};let _=(m==null?void 0:m.captureTransfers)??new Map;if(!new RegExp(Jn,"su").test(p))return{pattern:p,captureTransfers:_,hiddenCaptures:h};if(y==="plugin"&&qr(p,Se`\(\?\(DEFINE\)`,Ee.DEFAULT))throw new Error("DEFINE groups cannot be used with recursion");const f=[],w=qr(p,Se`\\[1-9]`,Ee.DEFAULT),k=new Map,x=[];let S,E=!1,C=0,N=0;for(ft.lastIndex=0;S=ft.exec(p);){const{0:I,groups:{captureName:D,rDepth:P,gRNameOrNum:A,gRDepth:V}}=S;if(I==="[")C++;else if(C)I==="]"&&C--;else{if(P){if(za(P),E)throw new Error(Yn);if(w)throw new Error((y==="external"?"Backrefs":"Numbered backrefs")+" cannot be used with global recursion");const T=p.slice(0,S.index),L=p.slice(ft.lastIndex);if(qr(L,Jn,Ee.DEFAULT))throw new Error(Yn);const G=+P-1;p=Fa(T,L,G,!1,h,f,N),_=Ua(_,T,G,f.length,0,N);break}if(A){za(V);let T=!1;for(const pe of x)if(pe.name===A||pe.num===+A){if(T=!0,pe.hasRecursedWithin)throw new Error(Yn);break}if(!T)throw new Error(Se`Recursive \g cannot be used outside the referenced group "${y==="external"?A:Se`\g<${A}&R=${V}>`}"`);const L=k.get(A),G=gd(p,L);if(w&&qr(G,Se`${Wr}|\((?!\?)`,Ee.DEFAULT))throw new Error((y==="external"?"Backrefs":"Numbered backrefs")+" cannot be used with recursion of capturing groups");const z=p.slice(L,S.index),B=G.slice(z.length+I.length),W=f.length,te=+V-1,ee=Fa(z,B,te,!0,h,f,N);_=Ua(_,z,te,f.length-W,W,N);const xe=p.slice(0,L),se=p.slice(L+G.length);p=`${xe}${ee}${se}`,ft.lastIndex+=ee.length-I.length-z.length-B.length,x.forEach(pe=>pe.hasRecursedWithin=!0),E=!0}else if(D)N++,k.set(String(N),ft.lastIndex),k.set(D,ft.lastIndex),x.push({num:N,name:D});else if(I[0]==="("){const T=I==="(";T&&(N++,k.set(String(N),ft.lastIndex)),x.push(T?{num:N}:{})}else I===")"&&x.pop()}}return h.push(...f),{pattern:p,captureTransfers:_,hiddenCaptures:h}})(l.pattern,{captureTransfers:l._captureTransfers,hiddenCaptures:l._hiddenCaptures,mode:"external"}),u=(function(p,m){const h=(m==null?void 0:m.hiddenCaptures)??[];let y=(m==null?void 0:m.captureTransfers)??new Map;if(!/\(\?>/.test(p))return{pattern:p,captureTransfers:y,hiddenCaptures:h};const _="(?:(?=(",f=[0],w=[];let k,x=0,S=0,E=NaN;do{k=!1;let C,N=0,I=0,D=!1;for(Ma.lastIndex=Number.isNaN(E)?0:E+7;C=Ma.exec(p);){const{0:P,index:A,groups:{capturingStart:V,noncapturingStart:T}}=C;if(P==="[")N++;else if(N)P==="]"&&N--;else if(P!=="(?>"||D){if(D&&T)I++;else if(V)D?I++:(x++,f.push(x+S));else if(P===")"&&D){if(!I){S++;const L=x+S;if(p=`${p.slice(0,E)}${_}${p.slice(E+3,A)}))<$$${L}>)${p.slice(A+1)}`,k=!0,w.push(L),hd(h,L),y.size){const G=new Map;y.forEach((z,B)=>{G.set(B>=L?B+1:B,z.map(W=>W>=L?W+1:W))}),y=G}break}I--}}else E=A,D=!0}}while(k);return h.push(...w),p=Zn(p,String.raw`\\(?<backrefNum>[1-9]\d*)|<\$\$(?<wrappedBackrefNum>\d+)>`,({0:C,groups:{backrefNum:N,wrappedBackrefNum:I}})=>{if(N){const D=+N;if(D>f.length-1)throw new Error(`Backref "${C}" greater than number of captures`);return`\\${f[D]}`}return`\\${I}`},Ee.DEFAULT),{pattern:p,captureTransfers:y,hiddenCaptures:h}})((function(p){if(!new RegExp(`${Va}\\+`).test(p))return{pattern:p};const m=[];let h,y=null,_=null,f="",w=0;for(Xn.lastIndex=0;h=Xn.exec(p);){const{0:k,index:x,groups:{qBase:S,qMod:E,invalidQ:C}}=h;if(k==="[")w||(_=x),w++;else if(k==="]")w?w--:_=null;else if(!w)if(E==="+"&&f&&!f.startsWith("(")){if(C)throw new Error(`Invalid quantifier "${k}"`);let N=-1;if(/^\{\d+\}$/.test(S))p=fd(p,x+S.length,E,"");else{if(f===")"||f==="]"){const I=f===")"?y:_;if(I===null)throw new Error(`Invalid unmatched "${f}"`);p=`${p.slice(0,I)}(?>${p.slice(I,x)}${S})${p.slice(x+k.length)}`}else p=`${p.slice(0,x-f.length)}(?>${f}${S})${p.slice(x+k.length)}`;N+=4}Xn.lastIndex+=N}else k[0]==="("?m.push(x):k===")"&&(y=m.length?m.pop():null);f=k}return{pattern:p}})(c.pattern).pattern,{captureTransfers:c.captureTransfers,hiddenCaptures:c.hiddenCaptures}),d={pattern:u.pattern,flags:`${o.hasIndices?"d":""}${o.global?"g":""}${l.flags}${l.options.disable.v?"u":"v"}`};if(o.avoidSubclass){if(o.lazyCompileLength!==1/0)throw new Error("Lazy compilation requires subclass")}else{const p=u.hiddenCaptures.sort((_,f)=>_-f),m=Array.from(u.captureTransfers),h=i._strategy,y=d.pattern.length>=o.lazyCompileLength;(p.length||m.length||h||y)&&(d.options={...p.length&&{hiddenCaptures:p},...m.length&&{transfers:m},...h&&{strategy:h},...y&&{lazyCompile:y}})}return d})(t,e);return r.options?new $d(r.pattern,r.flags,r.options):new RegExp(r.pattern,r.flags)}const ai=4294967295;class Vd{constructor(e,r={}){v(this,"regexps");this.patterns=e,this.options=r;const{forgiving:n=!1,cache:s,regexConstructor:o}=r;if(!o)throw new Error("Option `regexConstructor` is not provided");this.regexps=e.map(a=>{if(typeof a!="string")return a;const i=s==null?void 0:s.get(a);if(i){if(i instanceof RegExp)return i;if(n)return null;throw i}try{const l=o(a);return s==null||s.set(a,l),l}catch(l){if(s==null||s.set(a,l),n)return null;throw l}})}findNextMatchSync(e,r,n){const s=typeof e=="string"?e:e.content,o=[];function a(i,l,c=0){return{index:i,captureIndices:l.indices.map(u=>u==null?{start:ai,end:ai,length:0}:{start:u[0]+c,end:u[1]+c,length:u[1]-u[0]})}}for(let i=0;i<this.regexps.length;i++){const l=this.regexps[i];if(l)try{l.lastIndex=r;const c=l.exec(s);if(!c)continue;if(c.index===r)return a(i,c,0);o.push([i,c,0])}catch(c){if(this.options.forgiving)continue;throw c}}if(o.length){const i=Math.min(...o.map(l=>l[1].index));for(const[l,c,u]of o)if(c.index===i)return a(l,c,u)}return null}}function Gd(t={}){const e=Object.assign({target:"auto",cache:new Map},t);return e.regexConstructor||(e.regexConstructor=r=>(function(n,s){return Md(n,{global:!0,hasIndices:!0,lazyCompileLength:3e3,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...s})})(r,{target:e.target})),{createScanner:r=>new Vd(r,e),createString:r=>({content:r})}}const zd=t=>{const e=Bd(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:s=>{const o=s.split("-");return o[0]===""&&o.length!==1&&o.shift(),ii(o,e)||Fd(s)},getConflictingClassGroupIds:(s,o)=>{const a=r[s]||[];return o&&n[s]?[...a,...n[s]]:a}}},ii=(t,e)=>{var a;if(t.length===0)return e.classGroupId;const r=t[0],n=e.nextPart.get(r),s=n?ii(t.slice(1),n):void 0;if(s)return s;if(e.validators.length===0)return;const o=t.join("-");return(a=e.validators.find(({validator:i})=>i(o)))==null?void 0:a.classGroupId},li=/^\[(.+)\]$/,Fd=t=>{if(li.test(t)){const e=li.exec(t)[1],r=e==null?void 0:e.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},Bd=t=>{const{theme:e,classGroups:r}=t,n={nextPart:new Map,validators:[]};for(const s in r)as(r[s],n,s,e);return n},as=(t,e,r,n)=>{t.forEach(s=>{if(typeof s=="string")return void((s===""?e:ci(e,s)).classGroupId=r);if(typeof s=="function")return Ud(s)?void as(s(n),e,r,n):void e.validators.push({validator:s,classGroupId:r});Object.entries(s).forEach(([o,a])=>{as(a,ci(e,o),r,n)})})},ci=(t,e)=>{let r=t;return e.split("-").forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},Ud=t=>t.isThemeGetter,qd=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,r=new Map,n=new Map;const s=(o,a)=>{r.set(o,a),e++,e>t&&(e=0,n=r,r=new Map)};return{get(o){let a=r.get(o);return a!==void 0?a:(a=n.get(o))!==void 0?(s(o,a),a):void 0},set(o,a){r.has(o)?r.set(o,a):s(o,a)}}},Wd=t=>{const{prefix:e,experimentalParseClassName:r}=t;let n=s=>{const o=[];let a,i=0,l=0,c=0;for(let p=0;p<s.length;p++){let m=s[p];if(i===0&&l===0){if(m===":"){o.push(s.slice(c,p)),c=p+1;continue}if(m==="/"){a=p;continue}}m==="["?i++:m==="]"?i--:m==="("?l++:m===")"&&l--}const u=o.length===0?s:s.substring(c),d=Hd(u);return{modifiers:o,hasImportantModifier:d!==u,baseClassName:d,maybePostfixModifierPosition:a&&a>c?a-c:void 0}};if(e){const s=e+":",o=n;n=a=>a.startsWith(s)?o(a.substring(s.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:a,maybePostfixModifierPosition:void 0}}if(r){const s=n;n=o=>r({className:o,parseClassName:s})}return n},Hd=t=>t.endsWith("!")?t.substring(0,t.length-1):t.startsWith("!")?t.substring(1):t,Qd=t=>{const e=Object.fromEntries(t.orderSensitiveModifiers.map(r=>[r,!0]));return r=>{if(r.length<=1)return r;const n=[];let s=[];return r.forEach(o=>{o[0]==="["||e[o]?(n.push(...s.sort(),o),s=[]):s.push(o)}),n.push(...s.sort()),n}},Zd=/\s+/;function Xd(){let t,e,r=0,n="";for(;r<arguments.length;)(t=arguments[r++])&&(e=ui(t))&&(n&&(n+=" "),n+=e);return n}const ui=t=>{if(typeof t=="string")return t;let e,r="";for(let n=0;n<t.length;n++)t[n]&&(e=ui(t[n]))&&(r&&(r+=" "),r+=e);return r};function Jd(t,...e){let r,n,s,o=function(i){const l=e.reduce((c,u)=>u(c),t());return r=(c=>({cache:qd(c.cacheSize),parseClassName:Wd(c),sortModifiers:Qd(c),...zd(c)}))(l),n=r.cache.get,s=r.cache.set,o=a,a(i)};function a(i){const l=n(i);if(l)return l;const c=((u,d)=>{const{parseClassName:p,getClassGroupId:m,getConflictingClassGroupIds:h,sortModifiers:y}=d,_=[],f=u.trim().split(Zd);let w="";for(let k=f.length-1;k>=0;k-=1){const x=f[k],{isExternal:S,modifiers:E,hasImportantModifier:C,baseClassName:N,maybePostfixModifierPosition:I}=p(x);if(S){w=x+(w.length>0?" "+w:w);continue}let D=!!I,P=m(D?N.substring(0,I):N);if(!P){if(!D){w=x+(w.length>0?" "+w:w);continue}if(P=m(N),!P){w=x+(w.length>0?" "+w:w);continue}D=!1}const A=y(E).join(":"),V=C?A+"!":A,T=V+P;if(_.includes(T))continue;_.push(T);const L=h(P,D);for(let G=0;G<L.length;++G){const z=L[G];_.push(V+z)}w=x+(w.length>0?" "+w:w)}return w})(i,r);return s(i,c),c}return function(){return o(Xd.apply(null,arguments))}}const ue=t=>{const e=r=>r[t]||[];return e.isThemeGetter=!0,e},pi=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,di=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Yd=/^\d+\/\d+$/,Kd=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,em=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,tm=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,rm=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,nm=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Dt=t=>Yd.test(t),q=t=>!!t&&!Number.isNaN(Number(t)),st=t=>!!t&&Number.isInteger(Number(t)),is=t=>t.endsWith("%")&&q(t.slice(0,-1)),We=t=>Kd.test(t),sm=()=>!0,om=t=>em.test(t)&&!tm.test(t),mi=()=>!1,am=t=>rm.test(t),im=t=>nm.test(t),lm=t=>!O(t)&&!$(t),cm=t=>Mt(t,bi,mi),O=t=>pi.test(t),gt=t=>Mt(t,yi,om),ls=t=>Mt(t,hm,q),hi=t=>Mt(t,gi,mi),um=t=>Mt(t,_i,im),Qr=t=>Mt(t,xi,am),$=t=>di.test(t),ir=t=>Vt(t,yi),pm=t=>Vt(t,fm),fi=t=>Vt(t,gi),dm=t=>Vt(t,bi),mm=t=>Vt(t,_i),Zr=t=>Vt(t,xi,!0),Mt=(t,e,r)=>{const n=pi.exec(t);return!!n&&(n[1]?e(n[1]):r(n[2]))},Vt=(t,e,r=!1)=>{const n=di.exec(t);return!!n&&(n[1]?e(n[1]):r)},gi=t=>t==="position"||t==="percentage",_i=t=>t==="image"||t==="url",bi=t=>t==="length"||t==="size"||t==="bg-size",yi=t=>t==="length",hm=t=>t==="number",fm=t=>t==="family-name",xi=t=>t==="shadow",gm=Jd(()=>{const t=ue("color"),e=ue("font"),r=ue("text"),n=ue("font-weight"),s=ue("tracking"),o=ue("leading"),a=ue("breakpoint"),i=ue("container"),l=ue("spacing"),c=ue("radius"),u=ue("shadow"),d=ue("inset-shadow"),p=ue("text-shadow"),m=ue("drop-shadow"),h=ue("blur"),y=ue("perspective"),_=ue("aspect"),f=ue("ease"),w=ue("animate"),k=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",$,O],x=()=>[$,O,l],S=()=>[Dt,"full","auto",...x()],E=()=>[st,"none","subgrid",$,O],C=()=>["auto",{span:["full",st,$,O]},st,$,O],N=()=>[st,"auto",$,O],I=()=>["auto","min","max","fr",$,O],D=()=>["auto",...x()],P=()=>[Dt,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...x()],A=()=>[t,$,O],V=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",fi,hi,{position:[$,O]}],T=()=>["auto","cover","contain",dm,cm,{size:[$,O]}],L=()=>[is,ir,gt],G=()=>["","none","full",c,$,O],z=()=>["",q,ir,gt],B=()=>[q,is,fi,hi],W=()=>["","none",h,$,O],te=()=>["none",q,$,O],ee=()=>["none",q,$,O],xe=()=>[q,$,O],se=()=>[Dt,"full",...x()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[We],breakpoint:[We],color:[sm],container:[We],"drop-shadow":[We],ease:["in","out","in-out"],font:[lm],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[We],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[We],shadow:[We],spacing:["px",q],text:[We],"text-shadow":[We],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Dt,O,$,_]}],container:["container"],columns:[{columns:[q,O,$,i]}],"break-after":[{"break-after":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-before":[{"break-before":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:k()}],overflow:[{overflow:["auto","hidden","clip","visible","scroll"]}],"overflow-x":[{"overflow-x":["auto","hidden","clip","visible","scroll"]}],"overflow-y":[{"overflow-y":["auto","hidden","clip","visible","scroll"]}],overscroll:[{overscroll:["auto","contain","none"]}],"overscroll-x":[{"overscroll-x":["auto","contain","none"]}],"overscroll-y":[{"overscroll-y":["auto","contain","none"]}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:S()}],"inset-x":[{"inset-x":S()}],"inset-y":[{"inset-y":S()}],start:[{start:S()}],end:[{end:S()}],top:[{top:S()}],right:[{right:S()}],bottom:[{bottom:S()}],left:[{left:S()}],visibility:["visible","invisible","collapse"],z:[{z:[st,"auto",$,O]}],basis:[{basis:[Dt,"full","auto",i,...x()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[q,Dt,"auto","initial","none",O]}],grow:[{grow:["",q,$,O]}],shrink:[{shrink:["",q,$,O]}],order:[{order:[st,"first","last","none",$,O]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:C()}],"col-start":[{"col-start":N()}],"col-end":[{"col-end":N()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:C()}],"row-start":[{"row-start":N()}],"row-end":[{"row-end":N()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":I()}],"auto-rows":[{"auto-rows":I()}],gap:[{gap:x()}],"gap-x":[{"gap-x":x()}],"gap-y":[{"gap-y":x()}],"justify-content":[{justify:["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe","normal"]}],"justify-items":[{"justify-items":["start","end","center","stretch","center-safe","end-safe","normal"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],"align-content":[{content:["normal","start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"align-items":[{items:["start","end","center","stretch","center-safe","end-safe",{baseline:["","last"]}]}],"align-self":[{self:["auto","start","end","center","stretch","center-safe","end-safe",{baseline:["","last"]}]}],"place-content":[{"place-content":["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"place-items":[{"place-items":["start","end","center","stretch","center-safe","end-safe","baseline"]}],"place-self":[{"place-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],p:[{p:x()}],px:[{px:x()}],py:[{py:x()}],ps:[{ps:x()}],pe:[{pe:x()}],pt:[{pt:x()}],pr:[{pr:x()}],pb:[{pb:x()}],pl:[{pl:x()}],m:[{m:D()}],mx:[{mx:D()}],my:[{my:D()}],ms:[{ms:D()}],me:[{me:D()}],mt:[{mt:D()}],mr:[{mr:D()}],mb:[{mb:D()}],ml:[{ml:D()}],"space-x":[{"space-x":x()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":x()}],"space-y-reverse":["space-y-reverse"],size:[{size:P()}],w:[{w:[i,"screen",...P()]}],"min-w":[{"min-w":[i,"screen","none",...P()]}],"max-w":[{"max-w":[i,"screen","none","prose",{screen:[a]},...P()]}],h:[{h:["screen","lh",...P()]}],"min-h":[{"min-h":["screen","lh","none",...P()]}],"max-h":[{"max-h":["screen","lh",...P()]}],"font-size":[{text:["base",r,ir,gt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,$,ls]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",is,O]}],"font-family":[{font:[pm,O,e]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,$,O]}],"line-clamp":[{"line-clamp":[q,"none",$,ls]}],leading:[{leading:[o,...x()]}],"list-image":[{"list-image":["none",$,O]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",$,O]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:A()}],"text-color":[{text:A()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:["solid","dashed","dotted","double","wavy"]}],"text-decoration-thickness":[{decoration:[q,"from-font","auto",$,gt]}],"text-decoration-color":[{decoration:A()}],"underline-offset":[{"underline-offset":[q,"auto",$,O]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:x()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",$,O]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",$,O]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:V()}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","space","round"]}]}],"bg-size":[{bg:T()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},st,$,O],radial:["",$,O],conic:[st,$,O]},mm,um]}],"bg-color":[{bg:A()}],"gradient-from-pos":[{from:L()}],"gradient-via-pos":[{via:L()}],"gradient-to-pos":[{to:L()}],"gradient-from":[{from:A()}],"gradient-via":[{via:A()}],"gradient-to":[{to:A()}],rounded:[{rounded:G()}],"rounded-s":[{"rounded-s":G()}],"rounded-e":[{"rounded-e":G()}],"rounded-t":[{"rounded-t":G()}],"rounded-r":[{"rounded-r":G()}],"rounded-b":[{"rounded-b":G()}],"rounded-l":[{"rounded-l":G()}],"rounded-ss":[{"rounded-ss":G()}],"rounded-se":[{"rounded-se":G()}],"rounded-ee":[{"rounded-ee":G()}],"rounded-es":[{"rounded-es":G()}],"rounded-tl":[{"rounded-tl":G()}],"rounded-tr":[{"rounded-tr":G()}],"rounded-br":[{"rounded-br":G()}],"rounded-bl":[{"rounded-bl":G()}],"border-w":[{border:z()}],"border-w-x":[{"border-x":z()}],"border-w-y":[{"border-y":z()}],"border-w-s":[{"border-s":z()}],"border-w-e":[{"border-e":z()}],"border-w-t":[{"border-t":z()}],"border-w-r":[{"border-r":z()}],"border-w-b":[{"border-b":z()}],"border-w-l":[{"border-l":z()}],"divide-x":[{"divide-x":z()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":z()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:["solid","dashed","dotted","double","hidden","none"]}],"divide-style":[{divide:["solid","dashed","dotted","double","hidden","none"]}],"border-color":[{border:A()}],"border-color-x":[{"border-x":A()}],"border-color-y":[{"border-y":A()}],"border-color-s":[{"border-s":A()}],"border-color-e":[{"border-e":A()}],"border-color-t":[{"border-t":A()}],"border-color-r":[{"border-r":A()}],"border-color-b":[{"border-b":A()}],"border-color-l":[{"border-l":A()}],"divide-color":[{divide:A()}],"outline-style":[{outline:["solid","dashed","dotted","double","none","hidden"]}],"outline-offset":[{"outline-offset":[q,$,O]}],"outline-w":[{outline:["",q,ir,gt]}],"outline-color":[{outline:A()}],shadow:[{shadow:["","none",u,Zr,Qr]}],"shadow-color":[{shadow:A()}],"inset-shadow":[{"inset-shadow":["none",d,Zr,Qr]}],"inset-shadow-color":[{"inset-shadow":A()}],"ring-w":[{ring:z()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:A()}],"ring-offset-w":[{"ring-offset":[q,gt]}],"ring-offset-color":[{"ring-offset":A()}],"inset-ring-w":[{"inset-ring":z()}],"inset-ring-color":[{"inset-ring":A()}],"text-shadow":[{"text-shadow":["none",p,Zr,Qr]}],"text-shadow-color":[{"text-shadow":A()}],opacity:[{opacity:[q,$,O]}],"mix-blend":[{"mix-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"]}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[q]}],"mask-image-linear-from-pos":[{"mask-linear-from":B()}],"mask-image-linear-to-pos":[{"mask-linear-to":B()}],"mask-image-linear-from-color":[{"mask-linear-from":A()}],"mask-image-linear-to-color":[{"mask-linear-to":A()}],"mask-image-t-from-pos":[{"mask-t-from":B()}],"mask-image-t-to-pos":[{"mask-t-to":B()}],"mask-image-t-from-color":[{"mask-t-from":A()}],"mask-image-t-to-color":[{"mask-t-to":A()}],"mask-image-r-from-pos":[{"mask-r-from":B()}],"mask-image-r-to-pos":[{"mask-r-to":B()}],"mask-image-r-from-color":[{"mask-r-from":A()}],"mask-image-r-to-color":[{"mask-r-to":A()}],"mask-image-b-from-pos":[{"mask-b-from":B()}],"mask-image-b-to-pos":[{"mask-b-to":B()}],"mask-image-b-from-color":[{"mask-b-from":A()}],"mask-image-b-to-color":[{"mask-b-to":A()}],"mask-image-l-from-pos":[{"mask-l-from":B()}],"mask-image-l-to-pos":[{"mask-l-to":B()}],"mask-image-l-from-color":[{"mask-l-from":A()}],"mask-image-l-to-color":[{"mask-l-to":A()}],"mask-image-x-from-pos":[{"mask-x-from":B()}],"mask-image-x-to-pos":[{"mask-x-to":B()}],"mask-image-x-from-color":[{"mask-x-from":A()}],"mask-image-x-to-color":[{"mask-x-to":A()}],"mask-image-y-from-pos":[{"mask-y-from":B()}],"mask-image-y-to-pos":[{"mask-y-to":B()}],"mask-image-y-from-color":[{"mask-y-from":A()}],"mask-image-y-to-color":[{"mask-y-to":A()}],"mask-image-radial":[{"mask-radial":[$,O]}],"mask-image-radial-from-pos":[{"mask-radial-from":B()}],"mask-image-radial-to-pos":[{"mask-radial-to":B()}],"mask-image-radial-from-color":[{"mask-radial-from":A()}],"mask-image-radial-to-color":[{"mask-radial-to":A()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"]}],"mask-image-conic-pos":[{"mask-conic":[q]}],"mask-image-conic-from-pos":[{"mask-conic-from":B()}],"mask-image-conic-to-pos":[{"mask-conic-to":B()}],"mask-image-conic-from-color":[{"mask-conic-from":A()}],"mask-image-conic-to-color":[{"mask-conic-to":A()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:V()}],"mask-repeat":[{mask:["no-repeat",{repeat:["","x","y","space","round"]}]}],"mask-size":[{mask:T()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",$,O]}],filter:[{filter:["","none",$,O]}],blur:[{blur:W()}],brightness:[{brightness:[q,$,O]}],contrast:[{contrast:[q,$,O]}],"drop-shadow":[{"drop-shadow":["","none",m,Zr,Qr]}],"drop-shadow-color":[{"drop-shadow":A()}],grayscale:[{grayscale:["",q,$,O]}],"hue-rotate":[{"hue-rotate":[q,$,O]}],invert:[{invert:["",q,$,O]}],saturate:[{saturate:[q,$,O]}],sepia:[{sepia:["",q,$,O]}],"backdrop-filter":[{"backdrop-filter":["","none",$,O]}],"backdrop-blur":[{"backdrop-blur":W()}],"backdrop-brightness":[{"backdrop-brightness":[q,$,O]}],"backdrop-contrast":[{"backdrop-contrast":[q,$,O]}],"backdrop-grayscale":[{"backdrop-grayscale":["",q,$,O]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[q,$,O]}],"backdrop-invert":[{"backdrop-invert":["",q,$,O]}],"backdrop-opacity":[{"backdrop-opacity":[q,$,O]}],"backdrop-saturate":[{"backdrop-saturate":[q,$,O]}],"backdrop-sepia":[{"backdrop-sepia":["",q,$,O]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":x()}],"border-spacing-x":[{"border-spacing-x":x()}],"border-spacing-y":[{"border-spacing-y":x()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",$,O]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[q,"initial",$,O]}],ease:[{ease:["linear","initial",f,$,O]}],delay:[{delay:[q,$,O]}],animate:[{animate:["none",w,$,O]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[y,$,O]}],"perspective-origin":[{"perspective-origin":k()}],rotate:[{rotate:te()}],"rotate-x":[{"rotate-x":te()}],"rotate-y":[{"rotate-y":te()}],"rotate-z":[{"rotate-z":te()}],scale:[{scale:ee()}],"scale-x":[{"scale-x":ee()}],"scale-y":[{"scale-y":ee()}],"scale-z":[{"scale-z":ee()}],"scale-3d":["scale-3d"],skew:[{skew:xe()}],"skew-x":[{"skew-x":xe()}],"skew-y":[{"skew-y":xe()}],transform:[{transform:[$,O,"","none","gpu","cpu"]}],"transform-origin":[{origin:k()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:se()}],"translate-x":[{"translate-x":se()}],"translate-y":[{"translate-y":se()}],"translate-z":[{"translate-z":se()}],"translate-none":["translate-none"],accent:[{accent:A()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:A()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",$,O]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":x()}],"scroll-mx":[{"scroll-mx":x()}],"scroll-my":[{"scroll-my":x()}],"scroll-ms":[{"scroll-ms":x()}],"scroll-me":[{"scroll-me":x()}],"scroll-mt":[{"scroll-mt":x()}],"scroll-mr":[{"scroll-mr":x()}],"scroll-mb":[{"scroll-mb":x()}],"scroll-ml":[{"scroll-ml":x()}],"scroll-p":[{"scroll-p":x()}],"scroll-px":[{"scroll-px":x()}],"scroll-py":[{"scroll-py":x()}],"scroll-ps":[{"scroll-ps":x()}],"scroll-pe":[{"scroll-pe":x()}],"scroll-pt":[{"scroll-pt":x()}],"scroll-pr":[{"scroll-pr":x()}],"scroll-pb":[{"scroll-pb":x()}],"scroll-pl":[{"scroll-pl":x()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",$,O]}],fill:[{fill:["none",...A()]}],"stroke-w":[{stroke:[q,ir,gt,ls]}],stroke:[{stroke:["none",...A()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function _m(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var _t={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};function wi(t){_t=t}var lr={exec:()=>null};function X(t,e=""){let r=typeof t=="string"?t:t.source,n={replace:(s,o)=>{let a=typeof o=="string"?o:o.source;return a=a.replace(be.caret,"$1"),r=r.replace(s,a),n},getRegex:()=>new RegExp(r,e)};return n}var be={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i")},cr=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,cs=/(?:[*+-]|\d{1,9}[.)])/,ki=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,vi=X(ki).replace(/bull/g,cs).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),bm=X(ki).replace(/bull/g,cs).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),us=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,ps=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,ym=X(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",ps).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),xm=X(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,cs).getRegex(),Xr="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ds=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,wm=X("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",ds).replace("tag",Xr).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ei=X(us).replace("hr",cr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Xr).getRegex(),ms={blockquote:X(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Ei).getRegex(),code:/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,def:ym,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:cr,html:wm,lheading:vi,list:xm,newline:/^(?:[ \t]*(?:\n|$))+/,paragraph:Ei,table:lr,text:/^[^\n]+/},Si=X("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",cr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Xr).getRegex(),km={...ms,lheading:bm,table:Si,paragraph:X(us).replace("hr",cr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Si).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Xr).getRegex()},vm={...ms,html:X(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ds).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:lr,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:X(us).replace("hr",cr).replace("heading",` *#{1,6} *[^
163
- ]`).replace("lheading",vi).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Ci=/^( {2,}|\\)\n(?!\s*$)/,Jr=/[\p{P}\p{S}]/u,hs=/[\s\p{P}\p{S}]/u,Ai=/[^\s\p{P}\p{S}]/u,Em=X(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,hs).getRegex(),Ii=/(?!~)[\p{P}\p{S}]/u,Ni=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Sm=X(Ni,"u").replace(/punct/g,Jr).getRegex(),Cm=X(Ni,"u").replace(/punct/g,Ii).getRegex(),Ti="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Am=X(Ti,"gu").replace(/notPunctSpace/g,Ai).replace(/punctSpace/g,hs).replace(/punct/g,Jr).getRegex(),Im=X(Ti,"gu").replace(/notPunctSpace/g,/(?:[^\s\p{P}\p{S}]|~)/u).replace(/punctSpace/g,/(?!~)[\s\p{P}\p{S}]/u).replace(/punct/g,Ii).getRegex(),Nm=X("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Ai).replace(/punctSpace/g,hs).replace(/punct/g,Jr).getRegex(),Tm=X(/\\(punct)/,"gu").replace(/punct/g,Jr).getRegex(),Pm=X(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Rm=X(ds).replace("(?:-->|$)","-->").getRegex(),Lm=X("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Rm).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Yr=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`[^`]*`|[^\[\]\\`])*?/,jm=X(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Yr).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Pi=X(/^!?\[(label)\]\[(ref)\]/).replace("label",Yr).replace("ref",ps).getRegex(),Ri=X(/^!?\[(ref)\](?:\[\])?/).replace("ref",ps).getRegex(),fs={_backpedal:lr,anyPunctuation:Tm,autolink:Pm,blockSkip:/\[[^\[\]]*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)|`[^`]*?`|<(?! )[^<>]*?>/g,br:Ci,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:lr,emStrongLDelim:Sm,emStrongRDelimAst:Am,emStrongRDelimUnd:Nm,escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,link:jm,nolink:Ri,punctuation:Em,reflink:Pi,reflinkSearch:X("reflink|nolink(?!\\()","g").replace("reflink",Pi).replace("nolink",Ri).getRegex(),tag:Lm,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,url:lr},Om={...fs,link:X(/^!?\[(label)\]\((.*?)\)/).replace("label",Yr).getRegex(),reflink:X(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Yr).getRegex()},gs={...fs,emStrongRDelimAst:Im,emStrongLDelim:Cm,url:X(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},$m={...gs,br:X(Ci).replace("{2,}","*").getRegex(),text:X(gs.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Kr={normal:ms,gfm:km,pedantic:vm},ur={normal:fs,gfm:gs,breaks:$m,pedantic:Om},Dm={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Li=t=>Dm[t];function Oe(t,e){if(e){if(be.escapeTest.test(t))return t.replace(be.escapeReplace,Li)}else if(be.escapeTestNoEncode.test(t))return t.replace(be.escapeReplaceNoEncode,Li);return t}function ji(t){try{t=encodeURI(t).replace(be.percentDecode,"%")}catch{return null}return t}function Oi(t,e){var o;let r=t.replace(be.findPipe,(a,i,l)=>{let c=!1,u=i;for(;--u>=0&&l[u]==="\\";)c=!c;return c?"|":" |"}),n=r.split(be.splitPipe),s=0;if(n[0].trim()||n.shift(),n.length>0&&!((o=n.at(-1))!=null&&o.trim())&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;s<n.length;s++)n[s]=n[s].trim().replace(be.slashPipe,"|");return n}function pr(t,e,r){let n=t.length;if(n===0)return"";let s=0;for(;s<n&&t.charAt(n-s-1)===e;)s++;return t.slice(0,n-s)}function $i(t,e,r,n,s){let o=e.href,a=e.title||null,i=t[1].replace(s.other.outputLinkReplace,"$1");n.state.inLink=!0;let l={type:t[0].charAt(0)==="!"?"image":"link",raw:r,href:o,title:a,text:i,tokens:n.inlineTokens(i)};return n.state.inLink=!1,l}var en=class{constructor(t){v(this,"options");v(this,"rules");v(this,"lexer");this.options=t||_t}space(t){let e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){let e=this.rules.block.code.exec(t);if(e){let r=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?r:pr(r,`
164
- `)}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let r=e[0],n=(function(s,o,a){let i=s.match(a.other.indentCodeCompensation);if(i===null)return o;let l=i[1];return o.split(`
165
- `).map(c=>{let u=c.match(a.other.beginningSpace);if(u===null)return c;let[d]=u;return d.length>=l.length?c.slice(l.length):c}).join(`
166
- `)})(r,e[3]||"",this.rules);return{type:"code",raw:r,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:n}}}heading(t){let e=this.rules.block.heading.exec(t);if(e){let r=e[2].trim();if(this.rules.other.endingHash.test(r)){let n=pr(r,"#");(this.options.pedantic||!n||this.rules.other.endingSpaceChar.test(n))&&(r=n.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(t){let e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:pr(e[0],`
167
- `)}}blockquote(t){let e=this.rules.block.blockquote.exec(t);if(e){let r=pr(e[0],`
168
- `).split(`
169
- `),n="",s="",o=[];for(;r.length>0;){let a,i=!1,l=[];for(a=0;a<r.length;a++)if(this.rules.other.blockquoteStart.test(r[a]))l.push(r[a]),i=!0;else{if(i)break;l.push(r[a])}r=r.slice(a);let c=l.join(`
170
- `),u=c.replace(this.rules.other.blockquoteSetextReplace,`
171
- $1`).replace(this.rules.other.blockquoteSetextReplace2,"");n=n?`${n}
172
- ${c}`:c,s=s?`${s}
173
- ${u}`:u;let d=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(u,o,!0),this.lexer.state.top=d,r.length===0)break;let p=o.at(-1);if((p==null?void 0:p.type)==="code")break;if((p==null?void 0:p.type)==="blockquote"){let m=p,h=m.raw+`
174
- `+r.join(`
175
- `),y=this.blockquote(h);o[o.length-1]=y,n=n.substring(0,n.length-m.raw.length)+y.raw,s=s.substring(0,s.length-m.text.length)+y.text;break}if((p==null?void 0:p.type)==="list"){let m=p,h=m.raw+`
176
- `+r.join(`
177
- `),y=this.list(h);o[o.length-1]=y,n=n.substring(0,n.length-p.raw.length)+y.raw,s=s.substring(0,s.length-m.raw.length)+y.raw,r=h.substring(o.at(-1).raw.length).split(`
178
- `);continue}}return{type:"blockquote",raw:n,tokens:o,text:s}}}list(t){let e=this.rules.block.list.exec(t);if(e){let r=e[1].trim(),n=r.length>1,s={type:"list",raw:"",ordered:n,start:n?+r.slice(0,-1):"",loose:!1,items:[]};r=n?`\\d{1,9}\\${r.slice(-1)}`:`\\${r}`,this.options.pedantic&&(r=n?r:"[*+-]");let o=this.rules.other.listItemRegex(r),a=!1;for(;t;){let l=!1,c="",u="";if(!(e=o.exec(t))||this.rules.block.hr.test(t))break;c=e[0],t=t.substring(c.length);let d=e[2].split(`
179
- `,1)[0].replace(this.rules.other.listReplaceTabs,f=>" ".repeat(3*f.length)),p=t.split(`
180
- `,1)[0],m=!d.trim(),h=0;if(this.options.pedantic?(h=2,u=d.trimStart()):m?h=e[1].length+1:(h=e[2].search(this.rules.other.nonSpaceChar),h=h>4?1:h,u=d.slice(h),h+=e[1].length),m&&this.rules.other.blankLine.test(p)&&(c+=p+`
181
- `,t=t.substring(p.length+1),l=!0),!l){let f=this.rules.other.nextBulletRegex(h),w=this.rules.other.hrRegex(h),k=this.rules.other.fencesBeginRegex(h),x=this.rules.other.headingBeginRegex(h),S=this.rules.other.htmlBeginRegex(h);for(;t;){let E,C=t.split(`
182
- `,1)[0];if(p=C,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting," "),E=p):E=p.replace(this.rules.other.tabCharGlobal," "),k.test(p)||x.test(p)||S.test(p)||f.test(p)||w.test(p))break;if(E.search(this.rules.other.nonSpaceChar)>=h||!p.trim())u+=`
183
- `+E.slice(h);else{if(m||d.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||k.test(d)||x.test(d)||w.test(d))break;u+=`
184
- `+p}!m&&!p.trim()&&(m=!0),c+=C+`
185
- `,t=t.substring(C.length+1),d=E.slice(h)}}s.loose||(a?s.loose=!0:this.rules.other.doubleBlankLine.test(c)&&(a=!0));let y,_=null;this.options.gfm&&(_=this.rules.other.listIsTask.exec(u),_&&(y=_[0]!=="[ ] ",u=u.replace(this.rules.other.listReplaceTask,""))),s.items.push({type:"list_item",raw:c,task:!!_,checked:y,loose:!1,text:u,tokens:[]}),s.raw+=c}let i=s.items.at(-1);if(!i)return;i.raw=i.raw.trimEnd(),i.text=i.text.trimEnd(),s.raw=s.raw.trimEnd();for(let l=0;l<s.items.length;l++)if(this.lexer.state.top=!1,s.items[l].tokens=this.lexer.blockTokens(s.items[l].text,[]),!s.loose){let c=s.items[l].tokens.filter(d=>d.type==="space"),u=c.length>0&&c.some(d=>this.rules.other.anyLine.test(d.raw));s.loose=u}if(s.loose)for(let l=0;l<s.items.length;l++)s.items[l].loose=!0;return s}}html(t){let e=this.rules.block.html.exec(t);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(t){let e=this.rules.block.def.exec(t);if(e){let r=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),n=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:r,raw:e[0],href:n,title:s}}}table(t){var a;let e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let r=Oi(e[1]),n=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=(a=e[3])!=null&&a.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
186
- `):[],o={type:"table",raw:e[0],header:[],align:[],rows:[]};if(r.length===n.length){for(let i of n)this.rules.other.tableAlignRight.test(i)?o.align.push("right"):this.rules.other.tableAlignCenter.test(i)?o.align.push("center"):this.rules.other.tableAlignLeft.test(i)?o.align.push("left"):o.align.push(null);for(let i=0;i<r.length;i++)o.header.push({text:r[i],tokens:this.lexer.inline(r[i]),header:!0,align:o.align[i]});for(let i of s)o.rows.push(Oi(i,o.header.length).map((l,c)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:o.align[c]})));return o}}lheading(t){let e=this.rules.block.lheading.exec(t);if(e)return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(t){let e=this.rules.block.paragraph.exec(t);if(e){let r=e[1].charAt(e[1].length-1)===`
187
- `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:r,tokens:this.lexer.inline(r)}}}text(t){let e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){let e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){let e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){let e=this.rules.inline.link.exec(t);if(e){let r=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let o=pr(r.slice(0,-1),"\\");if((r.length-o.length)%2==0)return}else{let o=(function(a,i){if(a.indexOf(i[1])===-1)return-1;let l=0;for(let c=0;c<a.length;c++)if(a[c]==="\\")c++;else if(a[c]===i[0])l++;else if(a[c]===i[1]&&(l--,l<0))return c;return l>0?-2:-1})(e[2],"()");if(o===-2)return;if(o>-1){let a=(e[0].indexOf("!")===0?5:4)+e[1].length+o;e[2]=e[2].substring(0,o),e[0]=e[0].substring(0,a).trim(),e[3]=""}}let n=e[2],s="";if(this.options.pedantic){let o=this.rules.other.pedanticHrefTitle.exec(n);o&&(n=o[1],s=o[3])}else s=e[3]?e[3].slice(1,-1):"";return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?n.slice(1):n.slice(1,-1)),$i(e,{href:n&&n.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let r;if((r=this.rules.inline.reflink.exec(t))||(r=this.rules.inline.nolink.exec(t))){let n=e[(r[2]||r[1]).replace(this.rules.other.multipleSpaceGlobal," ").toLowerCase()];if(!n){let s=r[0].charAt(0);return{type:"text",raw:s,text:s}}return $i(r,n,r[0],this.lexer,this.rules)}}emStrong(t,e,r=""){let n=this.rules.inline.emStrongLDelim.exec(t);if(!(!n||n[3]&&r.match(this.rules.other.unicodeAlphaNumeric))&&(!n[1]&&!n[2]||!r||this.rules.inline.punctuation.exec(r))){let s,o,a=[...n[0]].length-1,i=a,l=0,c=n[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,e=e.slice(-1*t.length+a);(n=c.exec(e))!=null;){if(s=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!s)continue;if(o=[...s].length,n[3]||n[4]){i+=o;continue}if((n[5]||n[6])&&a%3&&!((a+o)%3)){l+=o;continue}if(i-=o,i>0)continue;o=Math.min(o,o+i+l);let u=[...n[0]][0].length,d=t.slice(0,a+n.index+u+o);if(Math.min(a,o)%2){let m=d.slice(1,-1);return{type:"em",raw:d,text:m,tokens:this.lexer.inlineTokens(m)}}let p=d.slice(2,-2);return{type:"strong",raw:d,text:p,tokens:this.lexer.inlineTokens(p)}}}}codespan(t){let e=this.rules.inline.code.exec(t);if(e){let r=e[2].replace(this.rules.other.newLineCharGlobal," "),n=this.rules.other.nonSpaceChar.test(r),s=this.rules.other.startingSpaceChar.test(r)&&this.rules.other.endingSpaceChar.test(r);return n&&s&&(r=r.substring(1,r.length-1)),{type:"codespan",raw:e[0],text:r}}}br(t){let e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t){let e=this.rules.inline.del.exec(t);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(t){let e=this.rules.inline.autolink.exec(t);if(e){let r,n;return e[2]==="@"?(r=e[1],n="mailto:"+r):(r=e[1],n=r),{type:"link",raw:e[0],text:r,href:n,tokens:[{type:"text",raw:r,text:r}]}}}url(t){var r;let e;if(e=this.rules.inline.url.exec(t)){let n,s;if(e[2]==="@")n=e[0],s="mailto:"+n;else{let o;do o=e[0],e[0]=((r=this.rules.inline._backpedal.exec(e[0]))==null?void 0:r[0])??"";while(o!==e[0]);n=e[0],s=e[1]==="www."?"http://"+e[0]:e[0]}return{type:"link",raw:e[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(t){let e=this.rules.inline.text.exec(t);if(e){let r=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:r}}}},He=class Us{constructor(e){v(this,"tokens");v(this,"options");v(this,"state");v(this,"tokenizer");v(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||_t,this.options.tokenizer=this.options.tokenizer||new en,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let r={other:be,block:Kr.normal,inline:ur.normal};this.options.pedantic?(r.block=Kr.pedantic,r.inline=ur.pedantic):this.options.gfm&&(r.block=Kr.gfm,this.options.breaks?r.inline=ur.breaks:r.inline=ur.gfm),this.tokenizer.rules=r}static get rules(){return{block:Kr,inline:ur}}static lex(e,r){return new Us(r).lex(e)}static lexInline(e,r){return new Us(r).inlineTokens(e)}lex(e){e=e.replace(be.carriageReturn,`
188
- `),this.blockTokens(e,this.tokens);for(let r=0;r<this.inlineQueue.length;r++){let n=this.inlineQueue[r];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,r=[],n=!1){var s,o,a;for(this.options.pedantic&&(e=e.replace(be.tabCharGlobal," ").replace(be.spaceLine,""));e;){let i;if((o=(s=this.options.extensions)==null?void 0:s.block)!=null&&o.some(c=>!!(i=c.call({lexer:this},e,r))&&(e=e.substring(i.raw.length),r.push(i),!0)))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let c=r.at(-1);i.raw.length===1&&c!==void 0?c.raw+=`
189
- `:r.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let c=r.at(-1);(c==null?void 0:c.type)==="paragraph"||(c==null?void 0:c.type)==="text"?(c.raw+=(c.raw.endsWith(`
190
- `)?"":`
191
- `)+i.raw,c.text+=`
192
- `+i.text,this.inlineQueue.at(-1).src=c.text):r.push(i);continue}if(i=this.tokenizer.fences(e)){e=e.substring(i.raw.length),r.push(i);continue}if(i=this.tokenizer.heading(e)){e=e.substring(i.raw.length),r.push(i);continue}if(i=this.tokenizer.hr(e)){e=e.substring(i.raw.length),r.push(i);continue}if(i=this.tokenizer.blockquote(e)){e=e.substring(i.raw.length),r.push(i);continue}if(i=this.tokenizer.list(e)){e=e.substring(i.raw.length),r.push(i);continue}if(i=this.tokenizer.html(e)){e=e.substring(i.raw.length),r.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);let c=r.at(-1);(c==null?void 0:c.type)==="paragraph"||(c==null?void 0:c.type)==="text"?(c.raw+=(c.raw.endsWith(`
193
- `)?"":`
194
- `)+i.raw,c.text+=`
195
- `+i.raw,this.inlineQueue.at(-1).src=c.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title},r.push(i));continue}if(i=this.tokenizer.table(e)){e=e.substring(i.raw.length),r.push(i);continue}if(i=this.tokenizer.lheading(e)){e=e.substring(i.raw.length),r.push(i);continue}let l=e;if((a=this.options.extensions)!=null&&a.startBlock){let c,u=1/0,d=e.slice(1);this.options.extensions.startBlock.forEach(p=>{c=p.call({lexer:this},d),typeof c=="number"&&c>=0&&(u=Math.min(u,c))}),u<1/0&&u>=0&&(l=e.substring(0,u+1))}if(this.state.top&&(i=this.tokenizer.paragraph(l))){let c=r.at(-1);n&&(c==null?void 0:c.type)==="paragraph"?(c.raw+=(c.raw.endsWith(`
196
- `)?"":`
197
- `)+i.raw,c.text+=`
198
- `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):r.push(i),n=l.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let c=r.at(-1);(c==null?void 0:c.type)==="text"?(c.raw+=(c.raw.endsWith(`
199
- `)?"":`
200
- `)+i.raw,c.text+=`
201
- `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):r.push(i);continue}if(e){let c="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(c);break}throw new Error(c)}}return this.state.top=!0,r}inline(e,r=[]){return this.inlineQueue.push({src:e,tokens:r}),r}inlineTokens(e,r=[]){var i,l,c;let n=e,s=null;if(this.tokens.links){let u=Object.keys(this.tokens.links);if(u.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)u.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(n))!=null;)n=n.slice(0,s.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(s=this.tokenizer.rules.inline.blockSkip.exec(n))!=null;)n=n.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let o=!1,a="";for(;e;){let u;if(o||(a=""),o=!1,(l=(i=this.options.extensions)==null?void 0:i.inline)==null?void 0:l.some(p=>!!(u=p.call({lexer:this},e,r))&&(e=e.substring(u.raw.length),r.push(u),!0)))continue;if(u=this.tokenizer.escape(e)){e=e.substring(u.raw.length),r.push(u);continue}if(u=this.tokenizer.tag(e)){e=e.substring(u.raw.length),r.push(u);continue}if(u=this.tokenizer.link(e)){e=e.substring(u.raw.length),r.push(u);continue}if(u=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(u.raw.length);let p=r.at(-1);u.type==="text"&&(p==null?void 0:p.type)==="text"?(p.raw+=u.raw,p.text+=u.text):r.push(u);continue}if(u=this.tokenizer.emStrong(e,n,a)){e=e.substring(u.raw.length),r.push(u);continue}if(u=this.tokenizer.codespan(e)){e=e.substring(u.raw.length),r.push(u);continue}if(u=this.tokenizer.br(e)){e=e.substring(u.raw.length),r.push(u);continue}if(u=this.tokenizer.del(e)){e=e.substring(u.raw.length),r.push(u);continue}if(u=this.tokenizer.autolink(e)){e=e.substring(u.raw.length),r.push(u);continue}if(!this.state.inLink&&(u=this.tokenizer.url(e))){e=e.substring(u.raw.length),r.push(u);continue}let d=e;if((c=this.options.extensions)!=null&&c.startInline){let p,m=1/0,h=e.slice(1);this.options.extensions.startInline.forEach(y=>{p=y.call({lexer:this},h),typeof p=="number"&&p>=0&&(m=Math.min(m,p))}),m<1/0&&m>=0&&(d=e.substring(0,m+1))}if(u=this.tokenizer.inlineText(d)){e=e.substring(u.raw.length),u.raw.slice(-1)!=="_"&&(a=u.raw.slice(-1)),o=!0;let p=r.at(-1);(p==null?void 0:p.type)==="text"?(p.raw+=u.raw,p.text+=u.text):r.push(u);continue}if(e){let p="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(p);break}throw new Error(p)}}return r}},tn=class{constructor(t){v(this,"options");v(this,"parser");this.options=t||_t}space(t){return""}code({text:t,lang:e,escaped:r}){var o;let n=(o=(e||"").match(be.notSpaceStart))==null?void 0:o[0],s=t.replace(be.endingNewline,"")+`
202
- `;return n?'<pre><code class="language-'+Oe(n)+'">'+(r?s:Oe(s,!0))+`</code></pre>
203
- `:"<pre><code>"+(r?s:Oe(s,!0))+`</code></pre>
204
- `}blockquote({tokens:t}){return`<blockquote>
205
- ${this.parser.parse(t)}</blockquote>
206
- `}html({text:t}){return t}def(t){return""}heading({tokens:t,depth:e}){return`<h${e}>${this.parser.parseInline(t)}</h${e}>
207
- `}hr(t){return`<hr>
208
- `}list(t){let e=t.ordered,r=t.start,n="";for(let o=0;o<t.items.length;o++){let a=t.items[o];n+=this.listitem(a)}let s=e?"ol":"ul";return"<"+s+(e&&r!==1?' start="'+r+'"':"")+`>
209
- `+n+"</"+s+`>
210
- `}listitem(t){var r;let e="";if(t.task){let n=this.checkbox({checked:!!t.checked});t.loose?((r=t.tokens[0])==null?void 0:r.type)==="paragraph"?(t.tokens[0].text=n+" "+t.tokens[0].text,t.tokens[0].tokens&&t.tokens[0].tokens.length>0&&t.tokens[0].tokens[0].type==="text"&&(t.tokens[0].tokens[0].text=n+" "+Oe(t.tokens[0].tokens[0].text),t.tokens[0].tokens[0].escaped=!0)):t.tokens.unshift({type:"text",raw:n+" ",text:n+" ",escaped:!0}):e+=n+" "}return e+=this.parser.parse(t.tokens,!!t.loose),`<li>${e}</li>
211
- `}checkbox({checked:t}){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:t}){return`<p>${this.parser.parseInline(t)}</p>
212
- `}table(t){let e="",r="";for(let s=0;s<t.header.length;s++)r+=this.tablecell(t.header[s]);e+=this.tablerow({text:r});let n="";for(let s=0;s<t.rows.length;s++){let o=t.rows[s];r="";for(let a=0;a<o.length;a++)r+=this.tablecell(o[a]);n+=this.tablerow({text:r})}return n&&(n=`<tbody>${n}</tbody>`),`<table>
213
- <thead>
214
- `+e+`</thead>
215
- `+n+`</table>
216
- `}tablerow({text:t}){return`<tr>
217
- ${t}</tr>
218
- `}tablecell(t){let e=this.parser.parseInline(t.tokens),r=t.header?"th":"td";return(t.align?`<${r} align="${t.align}">`:`<${r}>`)+e+`</${r}>
219
- `}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${Oe(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:r}){let n=this.parser.parseInline(r),s=ji(t);if(s===null)return n;let o='<a href="'+(t=s)+'"';return e&&(o+=' title="'+Oe(e)+'"'),o+=">"+n+"</a>",o}image({href:t,title:e,text:r,tokens:n}){n&&(r=this.parser.parseInline(n,this.parser.textRenderer));let s=ji(t);if(s===null)return Oe(r);let o=`<img src="${t=s}" alt="${r}"`;return e&&(o+=` title="${Oe(e)}"`),o+=">",o}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:Oe(t.text)}},_s=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}},Qe=class qs{constructor(e){v(this,"options");v(this,"renderer");v(this,"textRenderer");this.options=e||_t,this.options.renderer=this.options.renderer||new tn,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new _s}static parse(e,r){return new qs(r).parse(e)}static parseInline(e,r){return new qs(r).parseInline(e)}parse(e,r=!0){var s,o;let n="";for(let a=0;a<e.length;a++){let i=e[a];if((o=(s=this.options.extensions)==null?void 0:s.renderers)!=null&&o[i.type]){let c=i,u=this.options.extensions.renderers[c.type].call({parser:this},c);if(u!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(c.type)){n+=u||"";continue}}let l=i;switch(l.type){case"space":n+=this.renderer.space(l);continue;case"hr":n+=this.renderer.hr(l);continue;case"heading":n+=this.renderer.heading(l);continue;case"code":n+=this.renderer.code(l);continue;case"table":n+=this.renderer.table(l);continue;case"blockquote":n+=this.renderer.blockquote(l);continue;case"list":n+=this.renderer.list(l);continue;case"html":n+=this.renderer.html(l);continue;case"def":n+=this.renderer.def(l);continue;case"paragraph":n+=this.renderer.paragraph(l);continue;case"text":{let c=l,u=this.renderer.text(c);for(;a+1<e.length&&e[a+1].type==="text";)c=e[++a],u+=`
220
- `+this.renderer.text(c);n+=r?this.renderer.paragraph({type:"paragraph",raw:u,text:u,tokens:[{type:"text",raw:u,text:u,escaped:!0}]}):u;continue}default:{let c='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return n}parseInline(e,r=this.renderer){var s,o;let n="";for(let a=0;a<e.length;a++){let i=e[a];if((o=(s=this.options.extensions)==null?void 0:s.renderers)!=null&&o[i.type]){let c=this.options.extensions.renderers[i.type].call({parser:this},i);if(c!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){n+=c||"";continue}}let l=i;switch(l.type){case"escape":case"text":n+=r.text(l);break;case"html":n+=r.html(l);break;case"link":n+=r.link(l);break;case"image":n+=r.image(l);break;case"strong":n+=r.strong(l);break;case"em":n+=r.em(l);break;case"codespan":n+=r.codespan(l);break;case"br":n+=r.br(l);break;case"del":n+=r.del(l);break;default:{let c='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return n}},rn=(Ns=class{constructor(t){v(this,"options");v(this,"block");this.options=t||_t}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}provideLexer(){return this.block?He.lex:He.lexInline}provideParser(){return this.block?Qe.parse:Qe.parseInline}},v(Ns,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"])),Ns),bt=new class{constructor(...t){v(this,"defaults",{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null});v(this,"options",this.setOptions);v(this,"parse",this.parseMarkdown(!0));v(this,"parseInline",this.parseMarkdown(!1));v(this,"Parser",Qe);v(this,"Renderer",tn);v(this,"TextRenderer",_s);v(this,"Lexer",He);v(this,"Tokenizer",en);v(this,"Hooks",rn);this.use(...t)}walkTokens(t,e){var n,s;let r=[];for(let o of t)switch(r=r.concat(e.call(this,o)),o.type){case"table":{let a=o;for(let i of a.header)r=r.concat(this.walkTokens(i.tokens,e));for(let i of a.rows)for(let l of i)r=r.concat(this.walkTokens(l.tokens,e));break}case"list":{let a=o;r=r.concat(this.walkTokens(a.items,e));break}default:{let a=o;(s=(n=this.defaults.extensions)==null?void 0:n.childTokens)!=null&&s[a.type]?this.defaults.extensions.childTokens[a.type].forEach(i=>{let l=a[i].flat(1/0);r=r.concat(this.walkTokens(l,e))}):a.tokens&&(r=r.concat(this.walkTokens(a.tokens,e)))}}return r}use(...t){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(r=>{let n={...r};if(n.async=this.defaults.async||n.async||!1,r.extensions&&(r.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){let o=e.renderers[s.name];e.renderers[s.name]=o?function(...a){let i=s.renderer.apply(this,a);return i===!1&&(i=o.apply(this,a)),i}:s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let o=e[s.level];o?o.unshift(s.tokenizer):e[s.level]=[s.tokenizer],s.start&&(s.level==="block"?e.startBlock?e.startBlock.push(s.start):e.startBlock=[s.start]:s.level==="inline"&&(e.startInline?e.startInline.push(s.start):e.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(e.childTokens[s.name]=s.childTokens)}),n.extensions=e),r.renderer){let s=this.defaults.renderer||new tn(this.defaults);for(let o in r.renderer){if(!(o in s))throw new Error(`renderer '${o}' does not exist`);if(["options","parser"].includes(o))continue;let a=o,i=r.renderer[a],l=s[a];s[a]=(...c)=>{let u=i.apply(s,c);return u===!1&&(u=l.apply(s,c)),u||""}}n.renderer=s}if(r.tokenizer){let s=this.defaults.tokenizer||new en(this.defaults);for(let o in r.tokenizer){if(!(o in s))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;let a=o,i=r.tokenizer[a],l=s[a];s[a]=(...c)=>{let u=i.apply(s,c);return u===!1&&(u=l.apply(s,c)),u}}n.tokenizer=s}if(r.hooks){let s=this.defaults.hooks||new rn;for(let o in r.hooks){if(!(o in s))throw new Error(`hook '${o}' does not exist`);if(["options","block"].includes(o))continue;let a=o,i=r.hooks[a],l=s[a];rn.passThroughHooks.has(o)?s[a]=c=>{if(this.defaults.async)return Promise.resolve(i.call(s,c)).then(d=>l.call(s,d));let u=i.call(s,c);return l.call(s,u)}:s[a]=(...c)=>{let u=i.apply(s,c);return u===!1&&(u=l.apply(s,c)),u}}n.hooks=s}if(r.walkTokens){let s=this.defaults.walkTokens,o=r.walkTokens;n.walkTokens=function(a){let i=[];return i.push(o.call(this,a)),s&&(i=i.concat(s.call(this,a))),i}}this.defaults={...this.defaults,...n}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return He.lex(t,e??this.defaults)}parser(t,e){return Qe.parse(t,e??this.defaults)}parseMarkdown(t){return(e,r)=>{let n={...r},s={...this.defaults,...n},o=this.onError(!!s.silent,!!s.async);if(this.defaults.async===!0&&n.async===!1)return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));s.hooks&&(s.hooks.options=s,s.hooks.block=t);let a=s.hooks?s.hooks.provideLexer():t?He.lex:He.lexInline,i=s.hooks?s.hooks.provideParser():t?Qe.parse:Qe.parseInline;if(s.async)return Promise.resolve(s.hooks?s.hooks.preprocess(e):e).then(l=>a(l,s)).then(l=>s.hooks?s.hooks.processAllTokens(l):l).then(l=>s.walkTokens?Promise.all(this.walkTokens(l,s.walkTokens)).then(()=>l):l).then(l=>i(l,s)).then(l=>s.hooks?s.hooks.postprocess(l):l).catch(o);try{s.hooks&&(e=s.hooks.preprocess(e));let l=a(e,s);s.hooks&&(l=s.hooks.processAllTokens(l)),s.walkTokens&&this.walkTokens(l,s.walkTokens);let c=i(l,s);return s.hooks&&(c=s.hooks.postprocess(c)),c}catch(l){return o(l)}}}onError(t,e){return r=>{if(r.message+=`
221
- Please report this to https://github.com/markedjs/marked.`,t){let n="<p>An error occurred:</p><pre>"+Oe(r.message+"",!0)+"</pre>";return e?Promise.resolve(n):n}if(e)return Promise.reject(r);throw r}}};function K(t,e){return bt.parse(t,e)}K.options=K.setOptions=function(t){return bt.setOptions(t),K.defaults=bt.defaults,wi(K.defaults),K},K.getDefaults=_m,K.defaults=_t,K.use=function(...t){return bt.use(...t),K.defaults=bt.defaults,wi(K.defaults),K},K.walkTokens=function(t,e){return bt.walkTokens(t,e)},K.parseInline=bt.parseInline,K.Parser=Qe,K.parser=Qe.parse,K.Renderer=tn,K.TextRenderer=_s,K.Lexer=He,K.lexer=He.lex,K.Tokenizer=en,K.Hooks=rn,K.parse=K,K.options,K.setOptions,K.use,K.walkTokens,K.parseInline,Qe.parse,He.lex;var Q=(...t)=>gm(lf(t)),bs=(t,e,r)=>{let n=typeof e=="string"?new Blob([e],{type:r}):e,s=URL.createObjectURL(n),o=document.createElement("a");o.href=s,o.download=t,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(s)},Mm=/<pre(\s|>)/,ys=R.createContext({code:""}),Vm=new class{constructor(){this.lightHighlighter=null,this.darkHighlighter=null,this.lightTheme=null,this.darkTheme=null,this.loadedLanguages=new Set,this.initializationPromise=null}async ensureHighlightersInitialized(t,e){var r,n;let[s,o]=t,a=Gd({forgiving:!0}),i=!this.lightHighlighter||this.lightTheme!==s,l=!this.darkHighlighter||this.darkTheme!==o;(i||l)&&this.loadedLanguages.clear();let c=!this.loadedLanguages.has(e);if(i?(this.lightHighlighter=await ga({themes:[s],langs:[e],engine:a}),this.lightTheme=s,this.loadedLanguages.add(e)):c&&await((r=this.lightHighlighter)==null?void 0:r.loadLanguage(e)),l){let u=c?[...this.loadedLanguages,e]:Array.from(this.loadedLanguages);this.darkHighlighter=await ga({themes:[o],langs:u.length>0?u:[e],engine:a}),this.darkTheme=o}else c&&await((n=this.darkHighlighter)==null?void 0:n.loadLanguage(e));c&&this.loadedLanguages.add(e)}async highlightCode(t,e,r,n){var s,o;this.initializationPromise&&await this.initializationPromise,this.initializationPromise=this.ensureHighlightersInitialized(r,e),await this.initializationPromise,this.initializationPromise=null;let a=d=>n?d.replace(Mm,`<pre class="${n}"$1`):d,[i,l]=r,c=(s=this.lightHighlighter)==null?void 0:s.codeToHtml(t,{lang:e,theme:i}),u=(o=this.darkHighlighter)==null?void 0:o.codeToHtml(t,{lang:e,theme:l});return[Di(a(c)),Di(a(u))]}},Di=t=>t.replace(/(<pre[^>]*)(style="[^"]*background[^";]*;?[^"]*")([^>]*>)/g,"$1$3"),Gm=({code:t,language:e,className:r,children:n,preClassName:s,...o})=>{let[a,i]=R.useState(""),[l,c]=R.useState(""),u=R.useRef(!1),[d,p]=R.useContext(qi);return R.useEffect(()=>(u.current=!0,Vm.highlightCode(t,e,[d,p],s).then(([m,h])=>{u.current&&(i(m),c(h))}),()=>{u.current=!1}),[t,e,d,p,s]),g.jsx(ys.Provider,{value:{code:t},children:g.jsxs("div",{className:"my-4 w-full overflow-hidden rounded-xl border","data-code-block-container":!0,"data-language":e,children:[g.jsxs("div",{className:"flex items-center justify-between bg-muted/80 p-3 text-muted-foreground text-xs","data-code-block-header":!0,"data-language":e,children:[g.jsx("span",{className:"ml-1 font-mono lowercase",children:e}),g.jsx("div",{className:"flex items-center gap-2",children:n})]}),g.jsx("div",{className:"w-full",children:g.jsxs("div",{className:"min-w-full",children:[g.jsx("div",{className:Q("overflow-x-auto dark:hidden",r),dangerouslySetInnerHTML:{__html:a},"data-code-block":!0,"data-language":e,...o}),g.jsx("div",{className:Q("hidden overflow-x-auto dark:block",r),dangerouslySetInnerHTML:{__html:l},"data-code-block":!0,"data-language":e,...o})]})})]})})},Mi={"1c":"1c","1c-query":"1cq",abap:"abap","actionscript-3":"as",ada:"ada",adoc:"adoc","angular-html":"html","angular-ts":"ts",apache:"conf",apex:"cls",apl:"apl",applescript:"applescript",ara:"ara",asciidoc:"adoc",asm:"asm",astro:"astro",awk:"awk",ballerina:"bal",bash:"sh",bat:"bat",batch:"bat",be:"be",beancount:"beancount",berry:"berry",bibtex:"bib",bicep:"bicep",blade:"blade.php",bsl:"bsl",c:"c","c#":"cs","c++":"cpp",cadence:"cdc",cairo:"cairo",cdc:"cdc",clarity:"clar",clj:"clj",clojure:"clj","closure-templates":"soy",cmake:"cmake",cmd:"cmd",cobol:"cob",codeowners:"CODEOWNERS",codeql:"ql",coffee:"coffee",coffeescript:"coffee","common-lisp":"lisp",console:"sh",coq:"v",cpp:"cpp",cql:"cql",crystal:"cr",cs:"cs",csharp:"cs",css:"css",csv:"csv",cue:"cue",cypher:"cql",d:"d",dart:"dart",dax:"dax",desktop:"desktop",diff:"diff",docker:"dockerfile",dockerfile:"dockerfile",dotenv:"env","dream-maker":"dm",edge:"edge",elisp:"el",elixir:"ex",elm:"elm","emacs-lisp":"el",erb:"erb",erl:"erl",erlang:"erl",f:"f","f#":"fs",f03:"f03",f08:"f08",f18:"f18",f77:"f77",f90:"f90",f95:"f95",fennel:"fnl",fish:"fish",fluent:"ftl",for:"for","fortran-fixed-form":"f","fortran-free-form":"f90",fs:"fs",fsharp:"fs",fsl:"fsl",ftl:"ftl",gdresource:"tres",gdscript:"gd",gdshader:"gdshader",genie:"gs",gherkin:"feature","git-commit":"gitcommit","git-rebase":"gitrebase",gjs:"js",gleam:"gleam","glimmer-js":"js","glimmer-ts":"ts",glsl:"glsl",gnuplot:"plt",go:"go",gql:"gql",graphql:"graphql",groovy:"groovy",gts:"gts",hack:"hack",haml:"haml",handlebars:"hbs",haskell:"hs",haxe:"hx",hbs:"hbs",hcl:"hcl",hjson:"hjson",hlsl:"hlsl",hs:"hs",html:"html","html-derivative":"html",http:"http",hxml:"hxml",hy:"hy",imba:"imba",ini:"ini",jade:"jade",java:"java",javascript:"js",jinja:"jinja",jison:"jison",jl:"jl",js:"js",json:"json",json5:"json5",jsonc:"jsonc",jsonl:"jsonl",jsonnet:"jsonnet",jssm:"jssm",jsx:"jsx",julia:"jl",kotlin:"kt",kql:"kql",kt:"kt",kts:"kts",kusto:"kql",latex:"tex",lean:"lean",lean4:"lean",less:"less",liquid:"liquid",lisp:"lisp",lit:"lit",llvm:"ll",log:"log",logo:"logo",lua:"lua",luau:"luau",make:"mak",makefile:"mak",markdown:"md",marko:"marko",matlab:"m",md:"md",mdc:"mdc",mdx:"mdx",mediawiki:"wiki",mermaid:"mmd",mips:"s",mipsasm:"s",mmd:"mmd",mojo:"mojo",move:"move",nar:"nar",narrat:"narrat",nextflow:"nf",nf:"nf",nginx:"conf",nim:"nim",nix:"nix",nu:"nu",nushell:"nu",objc:"m","objective-c":"m","objective-cpp":"mm",ocaml:"ml",pascal:"pas",perl:"pl",perl6:"p6",php:"php",plsql:"pls",po:"po",polar:"polar",postcss:"pcss",pot:"pot",potx:"potx",powerquery:"pq",powershell:"ps1",prisma:"prisma",prolog:"pl",properties:"properties",proto:"proto",protobuf:"proto",ps:"ps",ps1:"ps1",pug:"pug",puppet:"pp",purescript:"purs",py:"py",python:"py",ql:"ql",qml:"qml",qmldir:"qmldir",qss:"qss",r:"r",racket:"rkt",raku:"raku",razor:"cshtml",rb:"rb",reg:"reg",regex:"regex",regexp:"regexp",rel:"rel",riscv:"s",rs:"rs",rst:"rst",ruby:"rb",rust:"rs",sas:"sas",sass:"sass",scala:"scala",scheme:"scm",scss:"scss",sdbl:"sdbl",sh:"sh",shader:"shader",shaderlab:"shader",shell:"sh",shellscript:"sh",shellsession:"sh",smalltalk:"st",solidity:"sol",soy:"soy",sparql:"rq",spl:"spl",splunk:"spl",sql:"sql","ssh-config":"config",stata:"do",styl:"styl",stylus:"styl",svelte:"svelte",swift:"swift","system-verilog":"sv",systemd:"service",talon:"talon",talonscript:"talon",tasl:"tasl",tcl:"tcl",templ:"templ",terraform:"tf",tex:"tex",tf:"tf",tfvars:"tfvars",toml:"toml",ts:"ts","ts-tags":"ts",tsp:"tsp",tsv:"tsv",tsx:"tsx",turtle:"ttl",twig:"twig",typ:"typ",typescript:"ts",typespec:"tsp",typst:"typ",v:"v",vala:"vala",vb:"vb",verilog:"v",vhdl:"vhdl",vim:"vim",viml:"vim",vimscript:"vim",vue:"vue","vue-html":"html","vue-vine":"vine",vy:"vy",vyper:"vy",wasm:"wasm",wenyan:"wy",wgsl:"wgsl",wiki:"wiki",wikitext:"wiki",wit:"wit",wl:"wl",wolfram:"wl",xml:"xml",xsl:"xsl",yaml:"yaml",yml:"yml",zenscript:"zs",zig:"zig",zsh:"zsh",\u6587\u8A00:"wy"},Vi=({onDownload:t,onError:e,language:r,children:n,className:s,code:o,...a})=>{let i=R.useContext(ys).code,l=o??i,c=`file.${r&&r in Mi?Mi[r]:"txt"}`;return g.jsx("button",{className:Q("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground",s),onClick:()=>{try{bs(c,l,"text/plain"),t==null||t()}catch(u){e==null||e(u)}},title:"Download file",type:"button",...a,children:n??g.jsx(Ls,{size:14})})},Gi=({onCopy:t,onError:e,timeout:r=2e3,children:n,className:s,code:o,...a})=>{let[i,l]=R.useState(!1),c=R.useRef(0),u=R.useContext(ys).code,d=o??u;R.useEffect(()=>()=>{window.clearTimeout(c.current)},[]);let p=i?vl:El;return g.jsx("button",{className:Q("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground",s),onClick:async()=>{var m;if(typeof window<"u"&&(m=navigator==null?void 0:navigator.clipboard)!=null&&m.writeText)try{i||(await navigator.clipboard.writeText(d),l(!0),t==null||t(),c.current=window.setTimeout(()=>l(!1),r))}catch(h){e==null||e(h)}else e==null||e(new Error("Clipboard API not available"))},type:"button",...a,children:n??g.jsx(p,{size:14})})},zi=!1,zm=({chart:t,className:e})=>{let[r,n]=R.useState(null),[s,o]=R.useState(!0),[a,i]=R.useState(""),[l,c]=R.useState("");if(R.useEffect(()=>{(async()=>{try{n(null),o(!0);let d=await(async()=>{if(!zi){let y=(await b(async()=>{const{default:_}=await import("./mermaid.core-4nVOEVX3.js").then(async f=>(await f.__tla,f)).then(f=>f.as);return{default:_}},__vite__mapDeps([95,96,97,98,99,100]),import.meta.url)).default;return y.initialize({startOnLoad:!1,theme:"default",securityLevel:"strict",fontFamily:"monospace",suppressErrorRendering:!0}),zi=!0,y}return(await b(async()=>{const{default:y}=await import("./mermaid.core-4nVOEVX3.js").then(async _=>(await _.__tla,_)).then(_=>_.as);return{default:y}},__vite__mapDeps([95,96,97,98,99,100]),import.meta.url)).default})(),p=t.split("").reduce((y,_)=>(y<<5)-y+_.charCodeAt(0)|0,0),m=`mermaid-${Math.abs(p)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:h}=await d.render(m,t);i(h),c(h)}catch(d){if(!l&&!a){let p=d instanceof Error?d.message:"Failed to render Mermaid chart";n(p)}}finally{o(!1)}})()},[t]),s&&!a&&!l)return g.jsx("div",{className:Q("my-4 flex justify-center p-4",e),children:g.jsxs("div",{className:"flex items-center space-x-2 text-muted-foreground",children:[g.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-current border-b-2"}),g.jsx("span",{className:"text-sm",children:"Loading diagram..."})]})});if(r&&!a&&!l)return g.jsxs("div",{className:Q("rounded-lg border border-red-200 bg-red-50 p-4",e),children:[g.jsxs("p",{className:"font-mono text-red-700 text-sm",children:["Mermaid Error: ",r]}),g.jsxs("details",{className:"mt-2",children:[g.jsx("summary",{className:"cursor-pointer text-red-600 text-xs",children:"Show Code"}),g.jsx("pre",{className:"mt-2 overflow-x-auto rounded bg-red-100 p-2 text-red-800 text-xs",children:t})]})]});let u=a||l;return g.jsx("div",{"aria-label":"Mermaid chart",className:Q("my-4 flex justify-center",e),dangerouslySetInnerHTML:{__html:u},role:"img"})};function Fi(t){var e,r;let n=[],s=[],o=t.querySelectorAll("thead th");for(let i of o)n.push(((e=i.textContent)==null?void 0:e.trim())||"");let a=t.querySelectorAll("tbody tr");for(let i of a){let l=[],c=i.querySelectorAll("td");for(let u of c)l.push(((r=u.textContent)==null?void 0:r.trim())||"");s.push(l)}return{headers:n,rows:s}}function xs(t){let{headers:e,rows:r}=t,n=o=>o.includes(",")||o.includes('"')||o.includes(`
222
- `)?`"${o.replace(/"/g,'""')}"`:o,s=[];e.length>0&&s.push(e.map(n).join(","));for(let o of r)s.push(o.map(n).join(","));return s.join(`
223
- `)}function Bi(t){let{headers:e,rows:r}=t;if(e.length===0)return"";let n=[],s=e.map(o=>o.replace(/\|/g,"\\|"));n.push(`| ${s.join(" | ")} |`),n.push(`| ${e.map(()=>"---").join(" | ")} |`);for(let o of r){let a=[...o];for(;a.length<e.length;)a.push("");let i=a.map(l=>l.replace(/\|/g,"\\|"));n.push(`| ${i.join(" | ")} |`)}return n.join(`
224
- `)}var Fm=({children:t,className:e,onCopy:r,onError:n,timeout:s=2e3,format:o="markdown"})=>{let[a,i]=R.useState(!1),l=R.useRef(0);R.useEffect(()=>()=>{window.clearTimeout(l.current)},[]);let c=a?vl:El;return g.jsx("button",{className:Q("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground",e),onClick:async u=>{var d;if(typeof window<"u"&&(d=navigator==null?void 0:navigator.clipboard)!=null&&d.writeText)try{if(!a){let p=u.currentTarget.closest('[data-streamdown="table-wrapper"]'),m=p==null?void 0:p.querySelector("table");if(!m)return void(n==null||n(new Error("Table not found")));let h=Fi(m),y="";switch(o){case"csv":default:y=xs(h);break;case"markdown":y=Bi(h);break;case"text":y=xs(h).replace(/,/g," ")}await navigator.clipboard.writeText(y),i(!0),r==null||r(),l.current=window.setTimeout(()=>i(!1),s)}}catch(p){n==null||n(p)}else n==null||n(new Error("Clipboard API not available"))},title:`Copy table as ${o}`,type:"button",children:t??g.jsx(c,{size:14})})},Bm=({children:t,className:e,onDownload:r,onError:n})=>{let[s,o]=R.useState(!1),a=R.useRef(null),i=l=>{var c;try{let u=(c=a.current)==null?void 0:c.closest('[data-streamdown="table-wrapper"]'),d=u==null?void 0:u.querySelector("table");if(!d)return void(n==null||n(new Error("Table not found")));let p=Fi(d),m=l==="csv"?xs(p):Bi(p);bs("table."+(l==="csv"?"csv":"md"),m,l==="csv"?"text/csv":"text/markdown"),o(!1),r==null||r(l)}catch(u){n==null||n(u)}};return R.useEffect(()=>{let l=c=>{a.current&&!a.current.contains(c.target)&&o(!1)};return document.addEventListener("mousedown",l),()=>{document.removeEventListener("mousedown",l)}},[]),g.jsxs("div",{className:"relative",ref:a,children:[g.jsx("button",{className:Q("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground",e),onClick:()=>o(!s),title:"Download table",type:"button",children:t??g.jsx(Ls,{size:14})}),s&&g.jsxs("div",{className:"absolute top-full right-0 z-10 mt-1 min-w-[120px] rounded-md border border-border bg-white shadow-lg",children:[g.jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>i("csv"),type:"button",children:"CSV"}),g.jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>i("markdown"),type:"button",children:"Markdown"})]})]})},Um=/language-([^\s]+)/,qm={ol:({node:t,children:e,className:r,...n})=>g.jsx("ol",{className:Q("ml-4 list-outside list-decimal whitespace-normal",r),"data-streamdown":"ordered-list",...n,children:e}),li:({node:t,children:e,className:r,...n})=>g.jsx("li",{className:Q("py-1",r),"data-streamdown":"list-item",...n,children:e}),ul:({node:t,children:e,className:r,...n})=>g.jsx("ul",{className:Q("ml-4 list-outside list-disc whitespace-normal",r),"data-streamdown":"unordered-list",...n,children:e}),hr:({node:t,className:e,...r})=>g.jsx("hr",{className:Q("my-6 border-border",e),"data-streamdown":"horizontal-rule",...r}),strong:({node:t,children:e,className:r,...n})=>g.jsx("span",{className:Q("font-semibold",r),"data-streamdown":"strong",...n,children:e}),a:({node:t,children:e,className:r,href:n,...s})=>{let o=n==="streamdown:incomplete-link";return g.jsx("a",{className:Q("font-medium text-primary underline",r),"data-incomplete":o,"data-streamdown":"link",href:n,rel:"noreferrer",target:"_blank",...s,children:e})},h1:({node:t,children:e,className:r,...n})=>g.jsx("h1",{className:Q("mt-6 mb-2 font-semibold text-3xl",r),"data-streamdown":"heading-1",...n,children:e}),h2:({node:t,children:e,className:r,...n})=>g.jsx("h2",{className:Q("mt-6 mb-2 font-semibold text-2xl",r),"data-streamdown":"heading-2",...n,children:e}),h3:({node:t,children:e,className:r,...n})=>g.jsx("h3",{className:Q("mt-6 mb-2 font-semibold text-xl",r),"data-streamdown":"heading-3",...n,children:e}),h4:({node:t,children:e,className:r,...n})=>g.jsx("h4",{className:Q("mt-6 mb-2 font-semibold text-lg",r),"data-streamdown":"heading-4",...n,children:e}),h5:({node:t,children:e,className:r,...n})=>g.jsx("h5",{className:Q("mt-6 mb-2 font-semibold text-base",r),"data-streamdown":"heading-5",...n,children:e}),h6:({node:t,children:e,className:r,...n})=>g.jsx("h6",{className:Q("mt-6 mb-2 font-semibold text-sm",r),"data-streamdown":"heading-6",...n,children:e}),table:({node:t,children:e,className:r,...n})=>g.jsxs("div",{className:"my-4 flex flex-col space-y-2","data-streamdown":"table-wrapper",children:[g.jsxs("div",{className:"flex items-center justify-end gap-1",children:[g.jsx(Fm,{}),g.jsx(Bm,{})]}),g.jsx("div",{className:"overflow-x-auto",children:g.jsx("table",{className:Q("w-full border-collapse border border-border",r),"data-streamdown":"table",...n,children:e})})]}),thead:({node:t,children:e,className:r,...n})=>g.jsx("thead",{className:Q("bg-muted/80",r),"data-streamdown":"table-header",...n,children:e}),tbody:({node:t,children:e,className:r,...n})=>g.jsx("tbody",{className:Q("divide-y divide-border bg-muted/40",r),"data-streamdown":"table-body",...n,children:e}),tr:({node:t,children:e,className:r,...n})=>g.jsx("tr",{className:Q("border-border border-b",r),"data-streamdown":"table-row",...n,children:e}),th:({node:t,children:e,className:r,...n})=>g.jsx("th",{className:Q("whitespace-nowrap px-4 py-2 text-left font-semibold text-sm",r),"data-streamdown":"table-header-cell",...n,children:e}),td:({node:t,children:e,className:r,...n})=>g.jsx("td",{className:Q("px-4 py-2 text-sm",r),"data-streamdown":"table-cell",...n,children:e}),blockquote:({node:t,children:e,className:r,...n})=>g.jsx("blockquote",{className:Q("my-4 border-muted-foreground/30 border-l-4 pl-4 text-muted-foreground italic",r),"data-streamdown":"blockquote",...n,children:e}),code:({node:t,className:e,children:r,...n})=>{var s,o,a;if(((s=t==null?void 0:t.position)==null?void 0:s.start.line)===((o=t==null?void 0:t.position)==null?void 0:o.end.line))return g.jsx("code",{className:Q("rounded bg-muted px-1.5 py-0.5 font-mono text-sm",e),"data-streamdown":"inline-code",...n,children:r});let i=e==null?void 0:e.match(Um),l=(a=i==null?void 0:i.at(1))!=null?a:"",c="";return R.isValidElement(r)&&r.props&&typeof r.props=="object"&&"children"in r.props&&typeof r.props.children=="string"?c=r.props.children:typeof r=="string"&&(c=r),l==="mermaid"?g.jsxs("div",{className:Q("group relative my-4 h-auto rounded-xl border p-4",e),"data-streamdown":"mermaid-block",children:[g.jsxs("div",{className:"flex items-center justify-end gap-2",children:[g.jsx(Vi,{code:c,language:l}),g.jsx(Gi,{code:c})]}),g.jsx(zm,{chart:c})]}):g.jsxs(Gm,{className:Q("overflow-x-auto border-t",e),code:c,"data-language":l,"data-streamdown":"code-block",language:l,preClassName:"overflow-x-auto font-mono text-xs p-4 bg-muted/40",children:[g.jsx(Vi,{code:c,language:l}),g.jsx(Gi,{})]})},img:({node:t,className:e,src:r,alt:n,...s})=>r?g.jsxs("div",{className:"group relative my-4 inline-block","data-streamdown":"image-wrapper",children:[g.jsx("img",{alt:n,className:Q("max-w-full rounded-lg",e),"data-streamdown":"image",src:r,...s}),g.jsx("div",{className:"pointer-events-none absolute inset-0 hidden rounded-lg bg-black/10 group-hover:block"}),g.jsx("button",{className:Q("absolute right-2 bottom-2 flex h-8 w-8 cursor-pointer items-center justify-center rounded-md border border-border bg-background/90 shadow-sm backdrop-blur-sm transition-all duration-200 hover:bg-background","opacity-0 group-hover:opacity-100"),onClick:async()=>{var o;if(r)try{let a=await(await fetch(r)).blob(),i=new URL(r,window.location.origin).pathname.split("/").pop()||"",l=i.includes(".")&&((o=i.split(".").pop())==null?void 0:o.length)<=4,c="";if(l)c=i;else{let u=a.type,d="png";u.includes("jpeg")||u.includes("jpg")?d="jpg":u.includes("png")?d="png":u.includes("svg")?d="svg":u.includes("gif")?d="gif":u.includes("webp")&&(d="webp"),c=`${(n||i||"image").replace(/\.[^/.]+$/,"")}.${d}`}bs(c,a,a.type)}catch(a){console.error("Failed to download image:",a)}},title:"Download image",type:"button",children:g.jsx(Ls,{size:14})})]}):null,pre:({children:t})=>t,sup:({node:t,children:e,className:r,...n})=>g.jsx("sup",{className:Q("text-sm",r),"data-streamdown":"superscript",...n,children:e}),sub:({node:t,children:e,className:r,...n})=>g.jsx("sub",{className:Q("text-sm",r),"data-streamdown":"subscript",...n,children:e})},Wm=t=>{let e=K.use({gfm:!0}).lexer(t).map(n=>n.raw),r=[];for(let n=0;n<e.length;n++){let s=e[n];if(s.trim()==="$$"&&r.length>0){let o=r.at(-1),a=o.trimStart().startsWith("$$"),i=(o.match(/\$\$/g)||[]).length;if(a&&i%2==1){r[r.length-1]=o+s;continue}}if(r.length>0&&s.trimEnd().endsWith("$$")){let o=r.at(-1),a=o.trimStart().startsWith("$$"),i=(o.match(/\$\$/g)||[]).length,l=(s.match(/\$\$/g)||[]).length;if(a&&i%2==1&&!s.trimStart().startsWith("$$")&&l===1){r[r.length-1]=o+s;continue}}r.push(s)}return r},Hm=/(!?\[)([^\]]*?)$/,Qm=/(\*\*)([^*]*?)$/,Zm=/(__)([^_]*?)$/,Xm=/(\*\*\*)([^*]*?)$/,Jm=/(\*)([^*]*?)$/,Ym=/(_)([^_]*?)$/,Km=/(`)([^`]*?)$/,eh=/(~~)([^~]*?)$/,nn=t=>{let e=(t.match(/```/g)||[]).length;return e>0&&e%2==0&&t.includes(`
225
- `)},Ui=(t,e)=>{let r=!1,n=!1;for(let s=0;s<t.length&&s<e;s++)t[s]!=="\\"||t[s+1]!=="$"?t[s]==="$"&&(t[s+1]==="$"?(n=!n,s++,r=!1):n||(r=!r)):s++;return r||n},th=t=>{if(nn(t))return t;if(t.match(Ym)){let e=-1;for(let n=0;n<t.length;n++)if(t[n]==="_"&&t[n-1]!=="_"&&t[n+1]!=="_"&&!Ui(t,n)){e=n;break}if(e===-1)return t;let r=t.substring(e+1);if(!r||/^[\s_~*`]*$/.test(r))return t;if((n=>n.split("").reduce((s,o,a)=>{if(o==="_"){let i=n[a-1],l=n[a+1];if(i==="\\"||Ui(n,a))return s;if(i!=="_"&&l!=="_")return s+1}return s},0))(t)%2==1)return`${t}_`}return t},rh=(t,e)=>{let r=t.substring(e,e+3)==="```",n=e>0&&t.substring(e-1,e+2)==="```",s=e>1&&t.substring(e-2,e+1)==="```";return r||n||s},nh=t=>{if(t.match(/^```[^`\n]*```?$/)&&!t.includes(`
226
- `))return t.endsWith("``")&&!t.endsWith("```")?`${t}\``:t;let e=(t.match(/```/g)||[]).length,r=e%2==1;if(e>0&&e%2==0&&t.includes(`
227
- `)||(t.endsWith("```\n")||t.endsWith("```"))&&e%2==0)return t;let n=t.match(Km);if(n&&!r){let s=n[2];if(!s||/^[\s_~*`]*$/.test(s))return t;if((o=>{let a=0;for(let i=0;i<o.length;i++)o[i]==="`"&&!rh(o,i)&&a++;return a})(t)%2==1)return`${t}\``}return t},sh=t=>{if(nn(t)||/^\*{4,}$/.test(t))return t;let e=t.match(Xm);if(e){let r=e[2];if(!r||/^[\s_~*`]*$/.test(r))return t;if((n=>{let s=0,o=n.match(/\*+/g)||[];for(let a of o){let i=a.length;i>=3&&(s+=Math.floor(i/3))}return s})(t)%2==1)return`${t}***`}return t},oh=t=>{if(!t||typeof t!="string")return t;let e=t,r=(n=>{let s=n.match(Hm);if(s){if(s[1].startsWith("!")){let o=n.lastIndexOf(s[1]);return n.substring(0,o)}return`${n}](streamdown:incomplete-link)`}return n})(e);return r.endsWith("](streamdown:incomplete-link)")?r:(e=r,e=sh(e),e=(n=>{if(nn(n))return n;let s=n.match(Qm);if(s){let o=s[2];if(!o||/^[\s_~*`]*$/.test(o))return n;let a=n.lastIndexOf(s[1]),i=n.substring(0,a).lastIndexOf(`
228
- `),l=i===-1?0:i+1,c=n.substring(l,a);if(/^[\s]*[-*+][\s]+$/.test(c)&&o.includes(`
229
- `))return n;if((n.match(/\*\*/g)||[]).length%2==1)return`${n}**`}return n})(e),e=(n=>{let s=n.match(Zm);if(s){let o=s[2];if(!o||/^[\s_~*`]*$/.test(o))return n;let a=n.lastIndexOf(s[1]),i=n.substring(0,a).lastIndexOf(`
230
- `),l=i===-1?0:i+1,c=n.substring(l,a);if(/^[\s]*[-*+][\s]+$/.test(c)&&o.includes(`
231
- `))return n;if((n.match(/__/g)||[]).length%2==1)return`${n}__`}return n})(e),e=(n=>{if(nn(n))return n;if(n.match(Jm)){let s=-1;for(let a=0;a<n.length;a++)if(n[a]==="*"&&n[a-1]!=="*"&&n[a+1]!=="*"){s=a;break}if(s===-1)return n;let o=n.substring(s+1);if(!o||/^[\s_~*`]*$/.test(o))return n;if((a=>a.split("").reduce((i,l,c)=>{if(l==="*"){let u=a[c-1],d=a[c+1];if(u==="\\")return i;let p=c;for(let m=c-1;m>=0;m--){if(a[m]===`
232
- `){p=m+1;break}if(m===0){p=0;break}}if(a.substring(p,c).trim()===""&&(d===" "||d===" "))return i;if(u!=="*"&&d!=="*")return i+1}return i},0))(n)%2==1)return`${n}*`}return n})(e),e=th(e),e=nh(e),e=(n=>{let s=n.match(eh);if(s){let o=s[2];if(!o||/^[\s_~*`]*$/.test(o))return n;if((n.match(/~~/g)||[]).length%2==1)return`${n}~~`}return n})(e),e=(n=>{if((n.match(/\$\$/g)||[]).length%2==0)return n;let s=n.indexOf("$$");return s===-1||n.indexOf(`
233
- `,s)===-1||n.endsWith(`
234
- `)?`${n}$$`:`${n}
235
- $$`})(e),e)},ah=(Co.default||Co)(function(t){const e=(function(n){const s=n.rehypePlugins||oo,o=n.remarkPlugins||oo,a=n.remarkRehypeOptions?{...n.remarkRehypeOptions,...ao}:ao;return qf().use(Wf).use(o).use(Hf,a).use(s)})(t),r=(function(n){const s=n.children||"",o=new Qf;return typeof s=="string"&&(o.value=s),o})(t);return(function(n,s){const o=s.allowedElements,a=s.allowElement,i=s.components,l=s.disallowedElements,c=s.skipHtml,u=s.unwrapDisallowed,d=s.urlTransform||Kc;for(const m of Yc)Object.hasOwn(s,m.from)&&Zf("Unexpected `"+m.from+"` prop, "+(m.to?"use `"+m.to+"` instead":"remove it")+" (see <"+Xc+"#"+m.id+"> for more info)");return Xf(n,p),Jf(n,{Fragment:g.Fragment,components:i,ignoreInvalidStyle:!0,jsx:g.jsx,jsxs:g.jsxs,passKeys:!0,passNode:!0});function p(m,h,y){if(m.type==="raw"&&y&&typeof h=="number")return c?y.children.splice(h,1):y.children[h]={type:"text",value:m.value},h;if(m.type==="element"){let _;for(_ in Ms)if(Object.hasOwn(Ms,_)&&Object.hasOwn(m.properties,_)){const f=m.properties[_],w=Ms[_];(w===null||w.includes(m.tagName))&&(m.properties[_]=d(String(f||""),_,m))}}if(m.type==="element"){let _=o?!o.includes(m.tagName):!!l&&l.includes(m.tagName);if(!_&&a&&typeof h=="number"&&(_=!a(m,h,y)),_&&y&&typeof h=="number")return u&&m.children?y.children.splice(h,1,...m.children):y.children.splice(h,1),h}}})(e.runSync(e.parse(r),r),t)}),qi=R.createContext(["github-light","github-dark"]),ih={singleDollarTextMath:!1},lh={},Wi=R.memo(({content:t,shouldParseIncompleteMarkdown:e,...r})=>{let n=R.useMemo(()=>typeof t=="string"&&e?oh(t.trim()):t,[t,e]);return g.jsx(ah,{...r,children:n})},(t,e)=>t.content===e.content);Wi.displayName="Block";var ws=R.memo(({children:t,allowedImagePrefixes:e=["*"],allowedLinkPrefixes:r=["*"],defaultOrigin:n,parseIncompleteMarkdown:s=!0,components:o,rehypePlugins:a,remarkPlugins:i,className:l,shikiTheme:c=["github-light","github-dark"],...u})=>{let d=R.useId(),p=R.useMemo(()=>Wm(typeof t=="string"?t:""),[t]),m=R.useMemo(()=>()=>pu({errorColor:"var(--color-muted-foreground)"}),[]);return g.jsx(qi.Provider,{value:c,children:g.jsx("div",{className:Q("space-y-4",l),...u,children:p.map((h,y)=>g.jsx(Wi,{allowedImagePrefixes:e,allowedLinkPrefixes:r,components:{...qm,...o},content:h,defaultOrigin:n,rehypePlugins:[m,...a??[]],remarkPlugins:[[sg,lh],[_u,ih],...i??[]],shouldParseIncompleteMarkdown:s},`${d}-block_${y}`))})})},(t,e)=>t.children===e.children&&t.shikiTheme===e.shikiTheme);ws.displayName="Streamdown";const ch=t=>{const e=H.c(14),{message:r}=t.data;if(r.includes("WebSocket"))return null;let n,s,o,a,i,l,c;return e[0]===Symbol.for("react.memo_cache_sentinel")?(n=g.jsx("div",{className:"flex-shrink-0",children:g.jsx(Os,{className:"h-5 w-5 text-[var(--red-11)]"})}),e[0]=n):n=e[0],e[1]===Symbol.for("react.memo_cache_sentinel")?(s=g.jsx("div",{className:"flex items-center gap-2 mb-2",children:g.jsx("h4",{className:"text-sm font-medium text-[var(--red-11)]",children:"Agent Error"})}),e[1]=s):s=e[1],e[2]!==r?(o=g.jsx("div",{className:"text-sm text-[var(--red-11)] leading-relaxed mb-3",children:r}),e[2]=r,e[3]=o):o=e[3],e[4]!==t.onRetry?(a=t.onRetry&&g.jsxs(Ve,{size:"xs",variant:"outline",onClick:t.onRetry,className:"text-[var(--red-11)] border-[var(--red-6)] hover:bg-[var(--red-3)]",children:[g.jsx(Ml,{className:"h-3 w-3 mr-1"}),"Retry"]}),e[4]=t.onRetry,e[5]=a):a=e[5],e[6]!==t.onDismiss?(i=t.onDismiss&&g.jsxs(Ve,{size:"xs",variant:"ghost",onClick:t.onDismiss,className:"text-[var(--red-10)] hover:bg-[var(--red-3)]",children:[g.jsx(Sl,{className:"h-3 w-3 mr-1"}),"Dismiss"]}),e[6]=t.onDismiss,e[7]=i):i=e[7],e[8]!==a||e[9]!==i?(l=g.jsxs("div",{className:"flex items-center gap-2",children:[a,i]}),e[8]=a,e[9]=i,e[10]=l):l=e[10],e[11]!==o||e[12]!==l?(c=g.jsx("div",{className:"border border-[var(--red-6)] bg-[var(--red-2)] rounded-lg p-4 my-2","data-block-type":"error",children:g.jsxs("div",{className:"flex items-start gap-3",children:[n,g.jsxs("div",{className:"flex-1 min-w-0",children:[s,o,l]})]})}),e[11]=o,e[12]=l,e[13]=c):c=e[13],c},uh=t=>{const e=H.c(33),{status:r}=t.data;if(t.isConnected)return null;let n;e[0]!==r?(n=(()=>{switch(r){case"connected":return{icon:g.jsx(fn,{className:"h-4 w-4"}),title:"Connected to Agent",message:"Successfully established connection with the AI agent",bgColor:"bg-[var(--blue-2)]",borderColor:"border-[var(--blue-6)]",textColor:"text-[var(--blue-11)]",iconColor:"text-[var(--blue-10)]"};case"disconnected":return{icon:g.jsx(Zt,{className:"h-4 w-4"}),title:"Disconnected from Agent",message:"Connection to the AI agent has been lost",bgColor:"bg-[var(--amber-2)]",borderColor:"border-[var(--amber-6)]",textColor:"text-[var(--amber-11)]",iconColor:"text-[var(--amber-10)]"};case"connecting":return{icon:g.jsx(fn,{className:"h-4 w-4 animate-pulse"}),title:"Connecting to Agent",message:"Establishing connection with the AI agent...",bgColor:"bg-[var(--gray-2)]",borderColor:"border-[var(--gray-6)]",textColor:"text-[var(--gray-11)]",iconColor:"text-[var(--gray-10)]"};case"error":return{icon:g.jsx(Zt,{className:"h-4 w-4"}),title:"Connection Error",message:"Failed to connect to the AI agent",bgColor:"bg-[var(--red-2)]",borderColor:"border-[var(--red-6)]",textColor:"text-[var(--red-11)]",iconColor:"text-[var(--red-10)]"};default:return{icon:g.jsx(Zt,{className:"h-4 w-4"}),title:"Connection Status Changed",message:`Agent connection status: ${r}`,bgColor:"bg-[var(--gray-2)]",borderColor:"border-[var(--gray-6)]",textColor:"text-[var(--gray-11)]",iconColor:"text-[var(--gray-10)]"}}})(),e[0]=r,e[1]=n):n=e[1];const s=n,o=r==="disconnected"||r==="error",a=`border ${s.borderColor} ${s.bgColor} rounded-lg p-3 my-2`,i=`flex-shrink-0 ${s.iconColor}`;let l;e[2]!==s.icon||e[3]!==i?(l=g.jsx("div",{className:i,children:s.icon}),e[2]=s.icon,e[3]=i,e[4]=l):l=e[4];const c=`text-sm font-medium ${s.textColor}`;let u,d,p;e[5]!==s.title||e[6]!==c?(u=g.jsx("h4",{className:c,children:s.title}),e[5]=s.title,e[6]=c,e[7]=u):u=e[7],e[8]!==t.timestamp?(d=t.timestamp&&g.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(t.timestamp).toLocaleTimeString()}),e[8]=t.timestamp,e[9]=d):d=e[9],e[10]!==u||e[11]!==d?(p=g.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[u,d]}),e[10]=u,e[11]=d,e[12]=p):p=e[12];const m=`text-sm ${s.textColor} opacity-90 mb-2`;let h,y,_,f,w;return e[13]!==s.message||e[14]!==m?(h=g.jsx("div",{className:m,children:s.message}),e[13]=s.message,e[14]=m,e[15]=h):h=e[15],e[16]!==s.bgColor||e[17]!==s.borderColor||e[18]!==s.textColor||e[19]!==t.onRetry||e[20]!==o?(y=o&&t.onRetry&&g.jsxs(Ve,{size:"xs",variant:"outline",onClick:t.onRetry,className:`${s.textColor} ${s.borderColor} hover:${s.bgColor}`,children:[g.jsx(Ml,{className:"h-3 w-3 mr-1"}),"Retry Connection"]}),e[16]=s.bgColor,e[17]=s.borderColor,e[18]=s.textColor,e[19]=t.onRetry,e[20]=o,e[21]=y):y=e[21],e[22]!==y||e[23]!==p||e[24]!==h?(_=g.jsxs("div",{className:"flex-1 min-w-0",children:[p,h,y]}),e[22]=y,e[23]=p,e[24]=h,e[25]=_):_=e[25],e[26]!==_||e[27]!==l?(f=g.jsxs("div",{className:"flex items-start gap-3",children:[l,_]}),e[26]=_,e[27]=l,e[28]=f):f=e[28],e[29]!==r||e[30]!==a||e[31]!==f?(w=g.jsx("div",{className:a,"data-block-type":"connection-change","data-status":r,children:f}),e[29]=r,e[30]=a,e[31]=f,e[32]=w):w=e[32],w},ph=t=>{const e=H.c(7),r=t.startTimestamp/1e3,n=t.endTimestamp/1e3,s=`Thought for ${Math.round(n-r)||"1"}s`;let o,a,i;return e[0]!==t.data?(o=t.data.map(vh),e[0]=t.data,e[1]=o):o=e[1],e[2]!==o?(a=g.jsx("div",{className:"flex flex-col gap-2 text-muted-foreground",children:g.jsx(sn,{data:o})}),e[2]=o,e[3]=a):a=e[3],e[4]!==s||e[5]!==a?(i=g.jsx("div",{className:"text-xs text-muted-foreground",children:g.jsx(vs,{title:s,children:a})}),e[4]=s,e[5]=a,e[6]=i):i=e[6],i},dh=t=>{const e=H.c(14);let r,n,s,o,a,i;if(e[0]!==t.data){const l=t.data.flatMap(Eh);s="rounded-lg border bg-background p-2 text-xs";const c=g.jsxs("span",{className:"font-medium text-muted-foreground",children:["To-dos"," ",g.jsx("span",{className:"font-normal text-muted-foreground",children:l.length})]});e[5]!==c?(o=g.jsx("div",{className:"flex items-center justify-between mb-2",children:c}),e[5]=c,e[6]=o):o=e[6],r="flex flex-col gap-1",n=l.map(Sh),e[0]=t.data,e[1]=r,e[2]=n,e[3]=s,e[4]=o}else r=e[1],n=e[2],s=e[3],o=e[4];return e[7]!==r||e[8]!==n?(a=g.jsx("ul",{className:r,children:n}),e[7]=r,e[8]=n,e[9]=a):a=e[9],e[10]!==s||e[11]!==o||e[12]!==a?(i=g.jsxs("div",{className:s,children:[o,a]}),e[10]=s,e[11]=o,e[12]=a,e[13]=i):i=e[13],i},mh=t=>{const e=H.c(4);let r,n;return e[0]!==t.data?(r=t.data.map(Ch),e[0]=t.data,e[1]=r):r=e[1],e[2]!==r?(n=g.jsx("div",{className:"flex flex-col gap-2 text-muted-foreground border p-2 bg-background rounded break-words",children:g.jsx(sn,{data:r})}),e[2]=r,e[3]=n):n=e[3],n},hh=t=>{const e=H.c(4);let r,n;return e[0]!==t.data?(r=t.data.map(Ah),e[0]=t.data,e[1]=r):r=e[1],e[2]!==r?(n=g.jsx("div",{className:"flex flex-col gap-2",children:g.jsx(sn,{data:r})}),e[2]=r,e[3]=n):n=e[3],n},sn=t=>{const e=H.c(5),r=Ih;let n,s;if(e[0]!==t.data){let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=(a,i)=>g.jsx(Qt.Fragment,{children:r(a)},`${a.type}-${i}`),e[2]=o):o=e[2],n=t.data.map(o),e[0]=t.data,e[1]=n}else n=e[1];return e[3]!==n?(s=g.jsx("div",{children:n}),e[3]=n,e[4]=s):s=e[4],s},Hi=t=>{const e=H.c(3),r=`data:${t.data.mimeType};base64,${t.data.data}`,n=t.data.uri??"";let s;return e[0]!==r||e[1]!==n?(s=g.jsx("img",{src:r,alt:n}),e[0]=r,e[1]=n,e[2]=s):s=e[2],s},Qi=t=>{const e=H.c(3),r=`data:${t.data.mimeType};base64,${t.data.data}`;let n,s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(n=g.jsx("track",{kind:"captions"}),e[0]=n):n=e[0],e[1]!==r?(s=g.jsx("audio",{src:r,controls:!0,children:n}),e[1]=r,e[2]=s):s=e[2],s},fh=t=>{var r,n;const e=H.c(25);if("text"in t.data.resource){let s,o,a,i;return e[0]!==t.data.resource.mimeType?(s=t.data.resource.mimeType&&g.jsx(ks,{mimeType:t.data.resource.mimeType}),e[0]=t.data.resource.mimeType,e[1]=s):s=e[1],e[2]!==t.data.resource.uri||e[3]!==s?(o=g.jsx(df,{children:g.jsxs("span",{className:"flex items-center gap-1",children:[s,t.data.resource.uri]})}),e[2]=t.data.resource.uri,e[3]=s,e[4]=o):o=e[4],e[5]!==t.data.resource.text?(a=g.jsx(mf,{className:"max-h-96 overflow-y-auto scrollbar-thin",children:g.jsx(ws,{children:t.data.resource.text})}),e[5]=t.data.resource.text,e[6]=a):a=e[6],e[7]!==o||e[8]!==a?(i=g.jsxs(hf,{children:[o,a]}),e[7]=o,e[8]=a,e[9]=i):i=e[9],i}if("blob"in t.data.resource){if((r=t.data.resource.mimeType)!=null&&r.startsWith("image/")){let u;return e[10]!==t.data.resource.blob||e[11]!==t.data.resource.mimeType?(u=g.jsx(Hi,{data:{type:"image",mimeType:t.data.resource.mimeType,data:t.data.resource.blob}}),e[10]=t.data.resource.blob,e[11]=t.data.resource.mimeType,e[12]=u):u=e[12],u}if((n=t.data.resource.mimeType)!=null&&n.startsWith("audio/")){let u;return e[13]!==t.data.resource.blob||e[14]!==t.data.resource.mimeType?(u=g.jsx(Qi,{data:{type:"audio",mimeType:t.data.resource.mimeType,data:t.data.resource.blob}}),e[13]=t.data.resource.blob,e[14]=t.data.resource.mimeType,e[15]=u):u=e[15],u}const s=t.data.resource.blob,o=t.data.resource.mimeType??"";let a;e[16]!==s||e[17]!==o?(a=ff(s,o),e[16]=s,e[17]=o,e[18]=a):a=e[18];const i=a;let l,c;return e[19]!==t.data.resource.mimeType?(l=t.data.resource.mimeType&&g.jsx(ks,{mimeType:t.data.resource.mimeType}),e[19]=t.data.resource.mimeType,e[20]=l):l=e[20],e[21]!==i||e[22]!==t.data.resource.uri||e[23]!==l?(c=g.jsxs("a",{href:i,className:"flex items-center gap-1",download:!0,children:[l,t.data.resource.uri]}),e[21]=i,e[22]=t.data.resource.uri,e[23]=l,e[24]=c):c=e[24],c}return Cl(t.data.resource),null},gh=t=>{const e=H.c(8);if(t.data.uri.startsWith("http")){let o;return e[0]!==t.data.name||e[1]!==t.data.uri?(o=g.jsx("a",{href:t.data.uri,target:"_blank",rel:"noopener noreferrer",className:"text-link hover:underline",children:t.data.name}),e[0]=t.data.name,e[1]=t.data.uri,e[2]=o):o=e[2],o}let r;e[3]!==t.data.mimeType?(r=t.data.mimeType&&g.jsx(ks,{mimeType:t.data.mimeType}),e[3]=t.data.mimeType,e[4]=r):r=e[4];const n=t.data.name||t.data.title||t.data.uri;let s;return e[5]!==r||e[6]!==n?(s=g.jsxs("span",{className:"flex items-center gap-1",children:[r,n]}),e[5]=r,e[6]=n,e[7]=s):s=e[7],s},ks=t=>{const e=H.c(6);if(t.mimeType.startsWith("image/")){let n;return e[0]===Symbol.for("react.memo_cache_sentinel")?(n=g.jsx(gf,{className:"h-2 w-2"}),e[0]=n):n=e[0],n}if(t.mimeType.startsWith("audio/")){let n;return e[1]===Symbol.for("react.memo_cache_sentinel")?(n=g.jsx(re,{className:"h-2 w-2"}),e[1]=n):n=e[1],n}if(t.mimeType.startsWith("video/")){let n;return e[2]===Symbol.for("react.memo_cache_sentinel")?(n=g.jsx(_f,{className:"h-2 w-2"}),e[2]=n):n=e[2],n}if(t.mimeType.startsWith("text/")){let n;return e[3]===Symbol.for("react.memo_cache_sentinel")?(n=g.jsx(bf,{className:"h-2 w-2"}),e[3]=n):n=e[3],n}if(t.mimeType.startsWith("application/")){let n;return e[4]===Symbol.for("react.memo_cache_sentinel")?(n=g.jsx(yf,{className:"h-2 w-2"}),e[4]=n):n=e[4],n}let r;return e[5]===Symbol.for("react.memo_cache_sentinel")?(r=g.jsx(xf,{className:"h-2 w-2"}),e[5]=r):r=e[5],r},_h=t=>{const e=H.c(9);if(t.data.length===0)return null;const r=t.data[0].sessionUpdate;let n;e[0]!==t.endTimestamp||e[1]!==t.startTimestamp?(n=i=>(function(l){const c=l[0];return c.sessionUpdate==="tool_call"||c.sessionUpdate==="tool_call_update"})(i)?g.jsx(bh,{data:i}):i[0].sessionUpdate==="agent_thought_chunk"?g.jsx(ph,{startTimestamp:t.startTimestamp,endTimestamp:t.endTimestamp,data:i}):(function(l){return l[0].sessionUpdate==="user_message_chunk"})(i)?g.jsx(mh,{data:i}):(function(l){return l[0].sessionUpdate==="agent_message_chunk"})(i)?g.jsx(hh,{data:i}):(function(l){return l[0].sessionUpdate==="plan"})(i)?g.jsx(dh,{data:i}):g.jsx(vs,{title:i[0].sessionUpdate,children:g.jsx(cf,{data:i,format:"tree",className:"max-h-64"})}),e[0]=t.endTimestamp,e[1]=t.startTimestamp,e[2]=n):n=e[2];const s=n;let o,a;return e[3]!==t.data||e[4]!==s?(o=s(t.data),e[3]=t.data,e[4]=s,e[5]=o):o=e[5],e[6]!==r||e[7]!==o?(a=g.jsx("div",{className:"flex flex-col text-sm gap-2","data-block-type":r,children:o}),e[6]=r,e[7]=o,e[8]=a):a=e[8],a},bh=t=>{const e=H.c(6);let r,n,s;return e[0]!==t.data?(r="flex flex-col text-muted-foreground",n=Zc(t.data).map(Nh),e[0]=t.data,e[1]=r,e[2]=n):(r=e[1],n=e[2]),e[3]!==r||e[4]!==n?(s=g.jsx("div",{className:r,children:n}),e[3]=r,e[4]=n,e[5]=s):s=e[5],s},yh=t=>{const e=H.c(4);let r,n;return e[0]!==t.data?(r=t.data.map(Th),e[0]=t.data,e[1]=r):r=e[1],e[2]!==r?(n=g.jsx("div",{className:"flex flex-col gap-2 text-muted-foreground",children:r}),e[2]=r,e[3]=n):n=e[3],n};function xh(t){var n;const e=t.title||pf.startCase(t.kind||"")||"Tool call",r=(n=t.locations)==null?void 0:n[0];return r&&!e.includes(r.path)?`${e}: ${r.path}`:e}function wh(t){return t.startsWith("`")&&t.endsWith("`")?g.jsx("i",{children:t.slice(1,-1)}):t}const kh=t=>{const e=H.c(6);if(t.data.length<=1)return null;let r,n,s;return e[0]!==t.data?(r="flex flex-col gap-2",n=t.data.map(Ph).join(`
236
- `),e[0]=t.data,e[1]=r,e[2]=n):(r=e[1],n=e[2]),e[3]!==r||e[4]!==n?(s=g.jsx("div",{className:r,children:n}),e[3]=r,e[4]=n,e[5]=s):s=e[5],s},Zi=t=>{var m,h;const e=H.c(22);let r;e[0]!==t.data.content?(r=(m=t.data.content)==null?void 0:m.filter(Rh).map(Lh),e[0]=t.data.content,e[1]=r):r=e[1];const n=r;let s;e[2]!==t.data.content?(s=(h=t.data.content)==null?void 0:h.filter(jh),e[2]=t.data.content,e[3]=s):s=e[3];const o=s,a=t.data.locations,i=t.data.status==="failed",l=a&&a.length>0;if((n==null?void 0:n.length)===0&&(o==null?void 0:o.length)===0&&l){const y=t.data.kind||"";let _,f,w;return e[4]!==y?(_=js(y),e[4]=y,e[5]=_):_=e[5],e[6]!==a?(f=a==null?void 0:a.map(Oh).join(", "),e[6]=a,e[7]=f):f=e[7],e[8]!==_||e[9]!==f?(w=g.jsx("div",{className:"flex flex-col gap-2 pr-2",children:g.jsxs("span",{className:"text-xs text-muted-foreground",children:[_," ",f]})}),e[8]=_,e[9]=f,e[10]=w):w=e[10],w}let c,u,d,p;return e[11]!==a?(c=a&&g.jsx(kh,{data:a}),e[11]=a,e[12]=c):c=e[12],e[13]!==n?(u=n&&g.jsx(sn,{data:n}),e[13]=n,e[14]=u):u=e[14],e[15]!==o||e[16]!==i?(d=o&&!i&&g.jsx(yh,{data:o}),e[15]=o,e[16]=i,e[17]=d):d=e[17],e[18]!==c||e[19]!==u||e[20]!==d?(p=g.jsxs("div",{className:"flex flex-col gap-2 pr-2",children:[c,u,d]}),e[18]=c,e[19]=u,e[20]=d,e[21]=p):p=e[21],p};function vh(t){return t.content}function Eh(t){return t.entries}function Sh(t,e){return g.jsxs("li",{className:`
237
- flex items-center gap-2 px-2 py-1 rounded
238
- `,children:[g.jsx("input",{type:"checkbox",checked:t.status==="completed",readOnly:!0,className:"accent-primary h-4 w-4 rounded border border-muted-foreground/30",tabIndex:-1}),g.jsx("span",{className:Ie("text-xs",t.status==="completed"&&"line-through text-muted-foreground"),children:t.content})]},`${t.status}-${e}`)}function Ch(t){return t.content}function Ah(t){return t.content}function Ih(t){return t.type==="text"?g.jsx(ws,{children:t.text}):t.type==="image"?g.jsx(Hi,{data:t}):t.type==="audio"?g.jsx(Qi,{data:t}):t.type==="resource"?g.jsx(fh,{data:t}):t.type==="resource_link"?g.jsx(gh,{data:t}):(Cl(t),null)}function Nh(t){return g.jsx(vs,{status:t.status==="completed"?"success":t.status==="failed"?"error":t.status==="in_progress"||t.status==="pending"?"loading":void 0,title:g.jsx("span",{"data-tool-data":JSON.stringify(t),children:wh(xh(t))}),defaultIcon:g.jsx(uf,{className:"h-3 w-3"}),children:g.jsx(Zi,{data:t})},t.toolCallId)}function Th(t){return g.jsxs("div",{className:"border rounded-md overflow-hidden bg-[var(--gray-2)] max-h-64 overflow-y-auto scrollbar-thin",children:[g.jsx("div",{className:"px-2 py-1 bg-[var(--gray-2)] border-b text-xs font-medium text-[var(--gray-11)]",children:t.path}),g.jsxs("div",{className:"font-mono text-xs",children:[t.oldText&&g.jsx("div",{className:"px-3 py-1 border-b bg-[var(--red-2)] border-b-[var(--red-6)]",children:g.jsxs("div",{className:"flex",children:[g.jsx("span",{className:"text-[var(--red-11)] select-none mr-2",children:"-"}),g.jsx("pre",{className:"text-[var(--red-11)] px-1 rounded whitespace-pre-wrap break-words flex-1 line-through opacity-80",children:t.oldText})]})}),t.newText&&g.jsx("div",{className:"px-3 py-1 bg-[var(--grass-2)] border-b-[var(--grass-6)]",children:g.jsxs("div",{className:"flex",children:[g.jsx("span",{className:"text-[var(--grass-11)] select-none mr-2",children:"+"}),g.jsx("pre",{className:"text-[var(--grass-11)] px-1 rounded whitespace-pre-wrap break-words flex-1 italic opacity-90",children:t.newText})]})})]})]},t.path)}function Ph(t){return t.line?`${t.path}:${t.line}`:t.path}function Rh(t){return t.type==="content"}function Lh(t){return t.content}function jh(t){return t.type==="diff"}function Oh(t){return t.path}const vs=t=>{const e=H.c(31),{title:r,children:n,status:s,index:o,defaultIcon:a}=t,i=o===void 0?0:o;let l;e[0]!==a||e[1]!==s?(l=()=>{switch(s){case"loading":return g.jsx(kf,{className:"h-3 w-3 animate-spin"});case"error":return g.jsx(Os,{className:"h-3 w-3 text-destructive"});case"success":return g.jsx(Vl,{className:"h-3 w-3 text-[var(--blue-9)]"});default:return a}},e[0]=a,e[1]=s,e[2]=l):l=e[2];const c=l,u=`tool-${i}`,d=s==="error"&&"text-destructive/80",p=s==="success"&&"text-[var(--blue-8)]";let m,h,y,_,f,w,k,x,S,E;return e[3]!==d||e[4]!==p?(m=Ie("py-1 text-xs border-border shadow-none! ring-0! bg-muted hover:bg-muted/30 px-2 gap-1 rounded-sm [&[data-state=open]>svg]:rotate-180",d,p),e[3]=d,e[4]=p,e[5]=m):m=e[5],e[6]!==c?(h=c(),e[6]=c,e[7]=h):h=e[7],e[8]!==r?(y=g.jsx("code",{className:"font-mono text-xs",children:r}),e[8]=r,e[9]=y):y=e[9],e[10]!==h||e[11]!==y?(_=g.jsxs("span",{className:"flex items-center gap-1",children:[h,y]}),e[10]=h,e[11]=y,e[12]=_):_=e[12],e[13]!==m||e[14]!==_?(f=g.jsx(vf,{className:m,children:_}),e[13]=m,e[14]=_,e[15]=f):f=e[15],e[16]!==n||e[17]!==s?(w=s!=="error"&&g.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-1",children:n}),e[16]=n,e[17]=s,e[18]=w):w=e[18],e[19]!==n||e[20]!==s?(k=s==="error"&&g.jsx("div",{className:"bg-destructive/10 border border-destructive/20 rounded-md p-3 text-xs text-destructive",children:n}),e[19]=n,e[20]=s,e[21]=k):k=e[21],e[22]!==w||e[23]!==k?(x=g.jsx(Ef,{className:"p-2",children:g.jsxs("div",{className:"space-y-3 max-h-64 overflow-y-auto scrollbar-thin",children:[w,k]})}),e[22]=w,e[23]=k,e[24]=x):x=e[24],e[25]!==f||e[26]!==x?(S=g.jsxs(Sf,{value:"tool-call",className:"border-0",children:[f,x]}),e[25]=f,e[26]=x,e[27]=S):S=e[27],e[28]!==S||e[29]!==u?(E=g.jsx(Cf,{type:"single",collapsible:!0,className:"w-full",children:S},u),e[28]=S,e[29]=u,e[30]=E):E=e[30],E},Xi=R.memo(t=>{const e=H.c(16),{status:r,className:n}=t;let s;e[0]!==r?(s=()=>{switch(r){case"connected":return{icon:g.jsx(fn,{className:"h-3 w-3"}),label:"Connected",variant:"default",className:"bg-[var(--blue-3)] text-[var(--blue-11)] border-[var(--blue-5)]"};case"connecting":return{icon:g.jsx(Ct,{className:"h-3 w-3 animate-pulse"}),label:"Connecting",variant:"secondary",className:"bg-[var(--yellow-3)] text-[var(--yellow-11)] border-[var(--yellow-5)]"};case"disconnected":return{icon:g.jsx(Zt,{className:"h-3 w-3"}),label:"Disconnected",variant:"outline",className:"bg-[var(--red-3)] text-[var(--red-11)] border-[var(--red-5)]"};default:return{icon:g.jsx(Zt,{className:"h-3 w-3"}),label:r||"Unknown",variant:"outline",className:"bg-[var(--gray-3)] text-[var(--gray-11)] border-[var(--gray-5)]"}}},e[0]=r,e[1]=s):s=e[1];const o=s;let a,i,l,c,u,d;return e[2]!==n||e[3]!==o?(i=o(),a=wf,l=i.variant,c=Ie(i.className,n),e[2]=n,e[3]=o,e[4]=a,e[5]=i,e[6]=l,e[7]=c):(a=e[4],i=e[5],l=e[6],c=e[7]),e[8]!==i.label?(u=g.jsx("span",{className:"ml-1 text-xs font-medium",children:i.label}),e[8]=i.label,e[9]=u):u=e[9],e[10]!==a||e[11]!==i.icon||e[12]!==l||e[13]!==c||e[14]!==u?(d=g.jsxs(a,{variant:l,className:c,children:[i.icon,u]}),e[10]=a,e[11]=i.icon,e[12]=l,e[13]=c,e[14]=u,e[15]=d):d=e[15],d});Xi.displayName="ConnectionStatus";const Ji=R.memo(t=>{const e=H.c(14),{permission:r,onResolve:n}=t;let s,o,a,i,l,c;if(e[0]===Symbol.for("react.memo_cache_sentinel")?(s=g.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[g.jsx(hn,{className:"h-4 w-4 text-[var(--amber-11)]"}),g.jsx("h3",{className:"text-sm font-medium text-[var(--amber-11)]",children:"Permission Request"})]}),o=g.jsx("p",{className:"text-sm text-[var(--amber-11)] mb-3",children:"The AI agent is requesting permission to proceed:"}),e[0]=s,e[1]=o):(s=e[0],o=e[1]),e[2]!==r.toolCall?(a=g.jsx(Zi,{data:r.toolCall}),e[2]=r.toolCall,e[3]=a):a=e[3],e[4]!==n||e[5]!==r.options){let u;e[7]!==n?(u=d=>g.jsxs(Ve,{size:"xs",variant:"text",className:d.kind.startsWith("allow")?"text-[var(--blue-10)]":"text-[var(--red-10)]",onClick:()=>n(d),children:[d.kind.startsWith("allow")&&g.jsx(Vl,{className:"h-3 w-3 mr-1"}),d.kind.startsWith("reject")&&g.jsx(Os,{className:"h-3 w-3 mr-1"}),d.name]},d.optionId),e[7]=n,e[8]=u):u=e[8],i=r.options.map(u),e[4]=n,e[5]=r.options,e[6]=i}else i=e[6];return e[9]!==i?(l=g.jsx("div",{className:"flex gap-2",children:i}),e[9]=i,e[10]=l):l=e[10],e[11]!==a||e[12]!==l?(c=g.jsxs("div",{className:"border border-[var(--amber-8)] bg-[var(--amber-2)] rounded-lg p-2",children:[s,o,a,l]}),e[11]=a,e[12]=l,e[13]=c):c=e[13],c});Ji.displayName="PermissionRequest";const dr=If("marimo:acp:sessions:v1",{sessions:[],activeTabId:null}),Es=Af(t=>{const e=t(dr);return e.activeTabId&&e.sessions.find(r=>r.tabId===e.activeTabId)||null},(t,e,r)=>{e(dr,n=>({...n,activeTabId:r}))});function Yi(t,e=20){return t.length<=e?t:`${t.slice(0,e-3)}...`}function $h(t,e){const r=el(e.agentId),n=Date.now(),s=e.firstMessage?Yi(e.firstMessage.trim()):`New ${e.agentId} session`,o=`tab_${Nf()}`;if(r==="single"){const a=t.sessions.filter(l=>l.agentId===e.agentId),i=t.sessions.filter(l=>l.agentId!==e.agentId);if(a.length>0){const l=a[0],c={agentId:e.agentId,title:s,createdAt:n,lastUsedAt:n,tabId:l.tabId,externalAgentSessionId:null};return{...t,sessions:[...i.slice(0,0),c],activeTabId:c.tabId}}}return{...t,sessions:[...t.sessions.slice(0,0),{agentId:e.agentId,tabId:o,title:s,createdAt:n,lastUsedAt:n,externalAgentSessionId:null}],activeTabId:o}}function Ki(t,e){const r=t.activeTabId;return r?{...t,sessions:t.sessions.map(n=>n.tabId===r?{...n,externalAgentSessionId:e,lastUsedAt:Date.now()}:n)}:t}const on={claude:{port:3017,command:"npx @zed-industries/claude-code-acp",webSocketUrl:"ws://localhost:3017/message",sessionSupport:"single"},gemini:{port:3019,command:"npx @google/gemini-cli --experimental-acp",webSocketUrl:"ws://localhost:3019/message",sessionSupport:"single"}};function el(t){return on[t].sessionSupport}const tl=R.memo(t=>{const e=H.c(26),{agentId:r,showCopy:n,className:s}=t,o=n===void 0||n;let a;e[0]!==r?(a=(function(k){const x=on[k].port;return`npx supergateway --stdio\\
239
- "${on[k].command}" \\
240
- --outputTransport ws --port ${x} `})(r),e[0]=r,e[1]=a):a=e[1];const i=a;let l;e[2]!==r?(l=(function(k){return js(k)})(r),e[2]=r,e[3]=l):l=e[3];const c=l;let u,d,p,m,h,y,_,f,w;return e[4]!==s?(u=Ie("space-y-2",s),e[4]=s,e[5]=u):u=e[5],e[6]!==r?(d=g.jsx($s,{provider:r,className:"h-4 w-4"}),e[6]=r,e[7]=d):d=e[7],e[8]!==c?(p=g.jsx("span",{className:"font-medium text-sm",children:c}),e[8]=c,e[9]=p):p=e[9],e[10]!==d||e[11]!==p?(m=g.jsxs("div",{className:"flex items-center gap-2",children:[d,p]}),e[10]=d,e[11]=p,e[12]=m):m=e[12],e[13]===Symbol.for("react.memo_cache_sentinel")?(h=g.jsx(Hl,{className:"h-4 w-4 mt-0.5 text-muted-foreground flex-shrink-0"}),e[13]=h):h=e[13],e[14]!==i?(y=g.jsx("code",{className:"text-xs font-mono break-all flex-1 whitespace-pre-wrap",children:i}),e[14]=i,e[15]=y):y=e[15],e[16]!==i||e[17]!==o?(_=o&&g.jsx(Tf,{value:i,className:"h-3 w-3"}),e[16]=i,e[17]=o,e[18]=_):_=e[18],e[19]!==_||e[20]!==y?(f=g.jsx("div",{className:"bg-muted/50 rounded-md p-2 border",children:g.jsxs("div",{className:"flex items-start gap-2 text-xs",children:[h,y,_]})}),e[19]=_,e[20]=y,e[21]=f):f=e[21],e[22]!==f||e[23]!==u||e[24]!==m?(w=g.jsxs("div",{className:u,children:[m,f]}),e[22]=f,e[23]=u,e[24]=m,e[25]=w):w=e[25],w});tl.displayName="AgentDocItem";const Ss=R.memo(t=>{const e=H.c(22),{title:r,description:n,agents:s,showCopy:o,className:a}=t;let i;e[0]!==s?(i=s===void 0?["claude","gemini"]:s,e[0]=s,e[1]=i):i=e[1];const l=i,c=o===void 0||o;let u,d,p,m,h,y,_;if(e[2]!==a?(u=Ie("space-y-4",a),e[2]=a,e[3]=u):u=e[3],e[4]!==r?(d=g.jsx("h3",{className:"font-medium text-sm",children:r}),e[4]=r,e[5]=d):d=e[5],e[6]!==n?(p=g.jsx("p",{className:"text-xs text-muted-foreground",children:n}),e[6]=n,e[7]=p):p=e[7],e[8]!==d||e[9]!==p?(m=g.jsxs("div",{className:"space-y-2",children:[d,p]}),e[8]=d,e[9]=p,e[10]=m):m=e[10],e[11]!==l||e[12]!==c){let f;e[14]!==c?(f=w=>g.jsx(tl,{agentId:w,showCopy:c},w),e[14]=c,e[15]=f):f=e[15],h=l.map(f),e[11]=l,e[12]=c,e[13]=h}else h=e[13];return e[16]!==h?(y=g.jsx("div",{className:"space-y-3",children:h}),e[16]=h,e[17]=y):y=e[17],e[18]!==u||e[19]!==m||e[20]!==y?(_=g.jsxs("div",{className:u,children:[m,y]}),e[18]=u,e[19]=m,e[20]=y,e[21]=_):_=e[21],_});Ss.displayName="AgentDocs";const rl=[{id:"claude",displayName:"Claude",iconId:"anthropic"},{id:"gemini",displayName:"Gemini",iconId:"google"}],nl=R.memo(t=>{const e=H.c(24),{agent:r,onSelect:n,existingSessions:s}=t;let o;e[0]!==r.id?(o=el(r.id),e[0]=r.id,e[1]=o):o=e[1];const a=o;let i;if(e[2]!==r.id||e[3]!==s){let f;e[5]!==r.id?(f=w=>w.agentId===r.id,e[5]=r.id,e[6]=f):f=e[6],i=s.some(f),e[2]=r.id,e[3]=s,e[4]=i}else i=e[4];const l=i;let c;e[7]!==r.displayName||e[8]!==l||e[9]!==a?(c=()=>a==="single"&&l?`Reset ${r.displayName} session`:`New ${r.displayName} session`,e[7]=r.displayName,e[8]=l,e[9]=a,e[10]=c):c=e[10];const u=c;let d,p;e[11]!==r.id||e[12]!==n?(d=()=>n(r.id),e[11]=r.id,e[12]=n,e[13]=d):d=e[13],e[14]!==r.iconId?(p=g.jsx($s,{provider:r.iconId,className:"h-3 w-3 mr-2"}),e[14]=r.iconId,e[15]=p):p=e[15];const m=u();let h,y,_;return e[16]!==m?(h=g.jsx("span",{children:m}),e[16]=m,e[17]=h):h=e[17],e[18]!==p||e[19]!==h?(y=g.jsxs("div",{className:"flex items-center w-full",children:[p,h]}),e[18]=p,e[19]=h,e[20]=y):y=e[20],e[21]!==d||e[22]!==y?(_=g.jsx(Pf,{onClick:d,className:"cursor-pointer",children:y}),e[21]=d,e[22]=y,e[23]=_):_=e[23],_});nl.displayName="AgentMenuItem";const an=R.memo(t=>{const e=H.c(23),{onSessionCreated:r,className:n}=t,[s,o]=un(dr),a=Al(Es),[i,l]=R.useState(!1);let c;e[0]!==r||e[1]!==s||e[2]!==a||e[3]!==o?(c=async S=>{const E=$h(s,{agentId:S});o(E),a(E.activeTabId),l(!1),r==null||r(S)},e[0]=r,e[1]=s,e[2]=a,e[3]=o,e[4]=c):c=e[4];const u=Le(c);let d,p,m,h,y,_,f,w,k,x;return e[5]!==n?(d=Ie("h-6 gap-1 px-2 text-xs bg-muted/30 hover:bg-muted/50 border border-border border-y-0 rounded-none focus-visible:ring-0",n),e[5]=n,e[6]=d):d=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(p=g.jsx("span",{children:"New session"}),m=g.jsx(Rf,{className:"h-3 w-3"}),e[7]=p,e[8]=m):(p=e[7],m=e[8]),e[9]!==d?(h=g.jsx(Lf,{asChild:!0,children:g.jsxs(Ve,{variant:"ghost",size:"sm",className:d,children:[p,m]})}),e[9]=d,e[10]=h):h=e[10],e[11]!==u||e[12]!==s?(y=rl.map(S=>g.jsx(nl,{agent:S,onSelect:u,existingSessions:s.sessions},S.id)),e[11]=u,e[12]=s,e[13]=y):y=e[13],e[14]===Symbol.for("react.memo_cache_sentinel")?(_=g.jsx(jf,{}),e[14]=_):_=e[14],e[15]===Symbol.for("react.memo_cache_sentinel")?(f=g.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-3",children:"To start an external agent, run the following command in your terminal:"}),e[15]=f):f=e[15],e[16]===Symbol.for("react.memo_cache_sentinel")?(w=g.jsxs("div",{className:"px-2 py-2",children:[f,g.jsx(Ss,{agents:rl.map(Dh),showCopy:!0})]}),e[16]=w):w=e[16],e[17]!==y?(k=g.jsxs(Of,{align:"start",className:"w-fit",children:[y,_,w]}),e[17]=y,e[18]=k):k=e[18],e[19]!==i||e[20]!==k||e[21]!==h?(x=g.jsxs($f,{open:i,onOpenChange:l,children:[h,k]}),e[19]=i,e[20]=k,e[21]=h,e[22]=x):x=e[22],x});function Dh(t){return t.id}an.displayName="AgentSelector";const sl=R.memo(t=>{const e=H.c(10),{isVisible:r,onScrollToBottom:n,className:s}=t;if(!r)return null;let o,a,i,l,c,u;return e[0]!==s?(o=Ie("absolute bottom-2 right-6 z-10 animate-in fade-in-0 zoom-in-95 duration-200",s),e[0]=s,e[1]=o):o=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(a=Ie("h-8 w-8 p-0 rounded-full","bg-background/90 backdrop-blur-sm","border border-border/50","shadow-md shadow-black/10","hover:bg-background hover:shadow-black/15","transition-all duration-200","focus:outline-none focus:ring-2 focus:ring-primary/50"),i=g.jsx(Z,{className:"h-4 w-4"}),l=g.jsx("span",{className:"sr-only",children:"Scroll to bottom"}),e[2]=a,e[3]=i,e[4]=l):(a=e[2],i=e[3],l=e[4]),e[5]!==n?(c=g.jsxs(Ve,{variant:"secondary",size:"sm",onClick:n,className:a,children:[i,l]}),e[5]=n,e[6]=c):c=e[6],e[7]!==o||e[8]!==c?(u=g.jsx("div",{className:o,children:c}),e[7]=o,e[8]=c,e[9]=u):u=e[9],u});sl.displayName="ScrollToBottomButton";const ol=R.memo(t=>{const e=H.c(23),{session:r,isActive:n,onSelect:s,onClose:o}=t,a=n&&"bg-background border-b-0 relative z-10";let i,l,c,u,d,p,m,h,y;return e[0]!==a?(i=Ie("flex items-center gap-1 px-2 py-1 text-xs border-r border-border bg-muted/30 hover:bg-muted/50 cursor-pointer min-w-0",a),e[0]=a,e[1]=i):i=e[1],e[2]!==s||e[3]!==r.tabId?(l=()=>s(r.tabId),e[2]=s,e[3]=r.tabId,e[4]=l):l=e[4],e[5]!==r.agentId?(c=g.jsx("span",{className:"text-muted-foreground text-[10px] font-medium",children:g.jsx($s,{provider:r.agentId,className:"h-3 w-3"})}),e[5]=r.agentId,e[6]=c):c=e[6],e[7]!==r.title?(u=g.jsx("span",{className:"truncate",title:r.title,children:r.title}),e[7]=r.title,e[8]=u):u=e[8],e[9]!==c||e[10]!==u?(d=g.jsxs("div",{className:"flex items-center gap-1 min-w-0 flex-1",children:[c,u]}),e[9]=c,e[10]=u,e[11]=d):d=e[11],e[12]!==o||e[13]!==r.tabId?(p=_=>{_.stopPropagation(),o(r.tabId)},e[12]=o,e[13]=r.tabId,e[14]=p):p=e[14],e[15]===Symbol.for("react.memo_cache_sentinel")?(m=g.jsx(Sl,{className:"h-3 w-3"}),e[15]=m):m=e[15],e[16]!==p?(h=g.jsx(Ve,{variant:"ghost",size:"sm",className:"h-4 w-4 p-0 hover:bg-destructive/20 hover:text-destructive flex-shrink-0",onClick:p,children:m}),e[16]=p,e[17]=h):h=e[17],e[18]!==i||e[19]!==l||e[20]!==d||e[21]!==h?(y=g.jsxs("div",{className:i,onClick:l,children:[d,h]}),e[18]=i,e[19]=l,e[20]=d,e[21]=h,e[22]=y):y=e[22],y});ol.displayName="SessionTab";const al=R.memo(t=>{const e=H.c(11),{sessions:r,activeTabId:n,onSelectSession:s,onCloseSession:o}=t;let a,i;if(e[0]!==n||e[1]!==o||e[2]!==s||e[3]!==r){let l;e[5]!==n||e[6]!==o||e[7]!==s?(l=c=>g.jsx(ol,{session:c,isActive:c.tabId===n,onSelect:s,onClose:o},c.tabId),e[5]=n,e[6]=o,e[7]=s,e[8]=l):l=e[8],a=r.map(l),e[0]=n,e[1]=o,e[2]=s,e[3]=r,e[4]=a}else a=e[4];return e[9]!==a?(i=g.jsx("div",{className:"flex min-w-0 flex-1 overflow-x-auto",children:a}),e[9]=a,e[10]=i):i=e[10],i});al.displayName="SessionList";const il=R.memo(t=>{const e=H.c(5),{className:r}=t;let n,s,o;return e[0]!==r?(n=Ie("flex items-center border-b bg-muted/20",r),e[0]=r,e[1]=n):n=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(s=g.jsx(an,{className:"h-6"}),e[2]=s):s=e[2],e[3]!==n?(o=g.jsx("div",{className:n,children:s}),e[3]=n,e[4]=o):o=e[4],o});il.displayName="EmptySessionTabs";const Cs=R.memo(t=>{const e=H.c(18),{className:r}=t,[n,s]=un(dr),o=Al(Es);let a;e[0]!==o||e[1]!==s?(a=_=>{o(_),s(f=>(function(w,k){return{...w,sessions:w.sessions.map(x=>x.tabId===k?{...x,lastUsedAt:Date.now()}:x)}})(f,_))},e[0]=o,e[1]=s,e[2]=a):a=e[2];const i=Le(a);let l;e[3]!==s?(l=_=>{s(f=>(function(w,k){const x=w.sessions.filter(S=>S.tabId!==k);return{sessions:x,activeTabId:w.activeTabId===k?x.length>0?x[x.length-1].tabId:null:w.activeTabId}})(f,_))},e[3]=s,e[4]=l):l=e[4];const c=Le(l),{sessions:u,activeTabId:d}=n;if(u.length===0){let _;return e[5]!==r?(_=g.jsx(il,{className:r}),e[5]=r,e[6]=_):_=e[6],_}let p,m,h,y;return e[7]!==r?(p=Ie("flex items-center border-b bg-muted/20 overflow-hidden",r),e[7]=r,e[8]=p):p=e[8],e[9]!==d||e[10]!==c||e[11]!==i||e[12]!==u?(m=g.jsx(al,{sessions:u,activeTabId:d,onSelectSession:i,onCloseSession:c}),e[9]=d,e[10]=c,e[11]=i,e[12]=u,e[13]=m):m=e[13],e[14]===Symbol.for("react.memo_cache_sentinel")?(h=g.jsx(an,{className:"h-6 flex-shrink-0"}),e[14]=h):h=e[14],e[15]!==p||e[16]!==m?(y=g.jsxs("div",{className:p,children:[m,h]}),e[15]=p,e[16]=m,e[17]=y):y=e[17],y});Cs.displayName="SessionTabs";const Mh=t=>{const e=H.c(17),{notifications:r,isConnected:n,onRetryConnection:s,onRetryLastAction:o,onDismissError:a}=t;let i,l,c;if(e[0]!==n||e[1]!==r||e[2]!==a||e[3]!==s||e[4]!==o){let u,d=(function(h){const y=[];for(const _ of h){const f=y[y.length-1];f&&Qc(f.at(0),_)?f.push(_):y.push([_])}return y})(r);d=d.filter((h,y)=>y===d.length-1||!ll(h)),e[7]!==n||e[8]!==a||e[9]!==s||e[10]!==o?(u=h=>{if(h.length===0)return null;if(h[0].type==="error"){const y=h[h.length-1];return g.jsx(ch,{data:y.data,onRetry:o,onDismiss:a?()=>a(y.id):void 0},y.id)}if(ll(h)){const y=h[h.length-1];return g.jsx(uh,{data:y.data,isConnected:n,onRetry:s,timestamp:y.timestamp},y.id)}if((function(y){return y[0].type==="session_notification"})(h)){const y=h[0].timestamp,_=h[h.length-1].timestamp,f=h.map(Vh);return g.jsx(_h,{data:f,startTimestamp:y,endTimestamp:_})}return"Unknown notification type"},e[7]=n,e[8]=a,e[9]=s,e[10]=o,e[11]=u):u=e[11];const p=u;let m;i="flex flex-col gap-4 px-2 pb-10",e[12]!==p?(m=h=>g.jsx(Qt.Fragment,{children:p(h)},h[0].id),e[12]=p,e[13]=m):m=e[13],l=d.map(m),e[0]=n,e[1]=r,e[2]=a,e[3]=s,e[4]=o,e[5]=i,e[6]=l}else i=e[5],l=e[6];return e[14]!==i||e[15]!==l?(c=g.jsx("div",{className:i,children:l}),e[14]=i,e[15]=l,e[16]=c):c=e[16],c};function ll(t){return t[0].type==="connection_change"}function Vh(t){return t.data.update}function Gh(t){return`
241
- I am currently editing a marimo notebook.
242
- You can read or write to the notebook at @${t}
243
-
244
- If you make edits to the notebook, only edit the contents inside the function decorator with @app.cell.
245
- marimo will automatically handle adding the parameters and return statement of the function. For example,
246
- for each edit, just return:
247
-
248
- \`\`\`
249
- @app.cell
250
- def __():
251
- <your code here>
252
- return
253
- \`\`\`
254
-
255
- ## Marimo fundamentals
256
-
257
- Marimo is a reactive notebook that differs from traditional notebooks in key ways:
258
-
259
- - Cells execute automatically when their dependencies change
260
- - Variables cannot be redeclared across cells
261
- - The notebook forms a directed acyclic graph (DAG)
262
- - The last expression in a cell is automatically displayed
263
- - UI elements are reactive and update the notebook automatically
264
-
265
- ## Code Requirements
266
-
267
- 1. All code must be complete and runnable
268
- 2. Follow consistent coding style throughout
269
- 3. Include descriptive variable names and helpful comments
270
- 4. Import all modules in the first cell, always including \`import marimo as mo\`
271
- 5. Never redeclare variables across cells
272
- 6. Ensure no cycles in notebook dependency graph
273
- 7. The last expression in a cell is automatically displayed, just like in Jupyter notebooks.
274
- 8. Don't include comments in markdown cells
275
- 9. Don't include comments in SQL cells
276
-
277
- ## Reactivity
278
-
279
- Marimo's reactivity means:
280
-
281
- - When a variable changes, all cells that use that variable automatically re-execute
282
- - UI elements trigger updates when their values change without explicit callbacks
283
- - UI element values are accessed through \`.value\` attribute
284
- - You cannot access a UI element's value in the same cell where it's defined
285
-
286
- ## Best Practices
287
-
288
- <data_handling>
289
- - Use pandas for data manipulation
290
- - Implement proper data validation
291
- - Handle missing values appropriately
292
- - Use efficient data structures
293
- - A variable in the last expression of a cell is automatically displayed as a table
294
- </data_handling>
295
-
296
- <visualization>
297
- - For matplotlib: use plt.gca() as the last expression instead of plt.show()
298
- - For plotly: return the figure object directly
299
- - For altair: return the chart object directly
300
- - Include proper labels, titles, and color schemes
301
- - Make visualizations interactive where appropriate
302
- </visualization>
303
-
304
- <ui_elements>
305
- - Access UI element values with .value attribute (e.g., slider.value)
306
- - Create UI elements in one cell and reference them in later cells
307
- - Create intuitive layouts with mo.hstack(), mo.vstack(), and mo.tabs()
308
- - Prefer reactive updates over callbacks (marimo handles reactivity automatically)
309
- - Group related UI elements for better organization
310
- </ui_elements>
311
-
312
- <sql>
313
- - When writing duckdb, prefer using marimo's SQL cells, which start with _df = mo.sql(query)
314
- - See the SQL with duckdb example for an example on how to do this
315
- - Don't add comments in cells that use mo.sql()
316
- - Consider using \`vega_datasets\` for common example datasets
317
- </sql>
318
-
319
- ## Troubleshooting
320
-
321
- Common issues and solutions:
322
- - Circular dependencies: Reorganize code to remove cycles in the dependency graph
323
- - UI element value access: Move access to a separate cell from definition
324
- - Visualization not showing: Ensure the visualization object is the last expression
325
-
326
- ## Available UI elements
327
-
328
- - \`mo.ui.altair_chart(altair_chart)\`
329
- - \`mo.ui.button(value=None, kind='primary')\`
330
- - \`mo.ui.run_button(label=None, tooltip=None, kind='primary')\`
331
- - \`mo.ui.checkbox(label='', value=False)\`
332
- - \`mo.ui.date(value=None, label=None, full_width=False)\`
333
- - \`mo.ui.dropdown(options, value=None, label=None, full_width=False)\`
334
- - \`mo.ui.file(label='', multiple=False, full_width=False)\`
335
- - \`mo.ui.number(value=None, label=None, full_width=False)\`
336
- - \`mo.ui.radio(options, value=None, label=None, full_width=False)\`
337
- - \`mo.ui.refresh(options: List[str], default_interval: str)\`
338
- - \`mo.ui.slider(start, stop, value=None, label=None, full_width=False, step=None)\`
339
- - \`mo.ui.range_slider(start, stop, value=None, label=None, full_width=False, step=None)\`
340
- - \`mo.ui.table(data, columns=None, on_select=None, sortable=True, filterable=True)\`
341
- - \`mo.ui.text(value='', label=None, full_width=False)\`
342
- - \`mo.ui.text_area(value='', label=None, full_width=False)\`
343
- - \`mo.ui.data_explorer(df)\`
344
- - \`mo.ui.dataframe(df)\`
345
- - \`mo.ui.plotly(plotly_figure)\`
346
- - \`mo.ui.tabs(elements: dict[str, mo.ui.Element])\`
347
- - \`mo.ui.array(elements: list[mo.ui.Element])\`
348
- - \`mo.ui.form(element: mo.ui.Element, label='', bordered=True)\`
349
-
350
- ## Layout and utility functions
351
-
352
- - \`mo.md(text)\` - display markdown
353
- - \`mo.stop(predicate, output=None)\` - stop execution conditionally
354
- - \`mo.Html(html)\` - display HTML
355
- - \`mo.image(image)\` - display an image
356
- - \`mo.hstack(elements)\` - stack elements horizontally
357
- - \`mo.vstack(elements)\` - stack elements vertically
358
- - \`mo.tabs(elements)\` - create a tabbed interface
359
-
360
- ## Examples
361
-
362
- <example title="Basic UI with reactivity">
363
- ${Gt([`
364
- import marimo as mo
365
- import matplotlib.pyplot as plt
366
- import numpy as np
367
- `,`
368
- n_points = mo.ui.slider(10, 100, value=50, label="Number of points")
369
- n_points
370
- `,`
371
- x = np.random.rand(n_points.value)
372
- y = np.random.rand(n_points.value)
373
-
374
- plt.figure(figsize=(8, 6))
375
- plt.scatter(x, y, alpha=0.7)
376
- plt.title(f"Scatter plot with {n_points.value} points")
377
- plt.xlabel("X axis")
378
- plt.ylabel("Y axis")
379
- plt.gca()
380
- `])}
381
- </example>
382
-
383
- <example title="Data explorer">
384
- ${Gt([`
385
- import marimo as mo
386
- import pandas as pd
387
- from vega_datasets import data
388
- `,`
389
- cars_df = data.cars()
390
- mo.ui.data_explorer(cars_df)
391
- `])}
392
- </example>
393
-
394
- <example title="Multiple UI elements">
395
- ${Gt([`
396
- import marimo as mo
397
- import pandas as pd
398
- import matplotlib.pyplot as plt
399
- import seaborn as sns
400
- `,`
401
- iris = sns.load_dataset('iris')
402
- `,`
403
- species_selector = mo.ui.dropdown(
404
- options=["All"] + iris["species"].unique().tolist(),
405
- value="All",
406
- label="Species"
407
- )
408
- x_feature = mo.ui.dropdown(
409
- options=iris.select_dtypes('number').columns.tolist(),
410
- value="sepal_length",
411
- label="X Feature"
412
- )
413
- y_feature = mo.ui.dropdown(
414
- options=iris.select_dtypes('number').columns.tolist(),
415
- value="sepal_width",
416
- label="Y Feature"
417
- )
418
- mo.hstack([species_selector, x_feature, y_feature])
419
- `,`
420
- filtered_data = iris if species_selector.value == "All" else iris[iris["species"] == species_selector.value]
421
-
422
- plt.figure(figsize=(10, 6))
423
- sns.scatterplot(
424
- data=filtered_data,
425
- x=x_feature.value,
426
- y=y_feature.value,
427
- hue="species"
428
- )
429
- plt.title(f"{y_feature.value} vs {x_feature.value}")
430
- plt.gca()
431
- `])}
432
- </example>
433
-
434
- <example title="Interactive chart with Altair">
435
- ${Gt([`
436
- import marimo as mo
437
- import altair as alt
438
- import pandas as pd
439
- `,`# Load dataset
440
- cars_df = pd.read_csv('<https://raw.githubusercontent.com/vega/vega-datasets/master/data/cars.json>')
441
- _chart = alt.Chart(cars_df).mark_point().encode(
442
- x='Horsepower',
443
- y='Miles_per_Gallon',
444
- color='Origin',
445
- )
446
- `,`chart = mo.ui.altair_chart(_chart)
447
- chart`,`
448
- # Display the selection
449
- chart.value`])}
450
- </example>
451
-
452
- <example title="Run Button Example">
453
- ${Gt(["import marimo as mo",`
454
- first_button = mo.ui.run_button(label="Option 1")
455
- second_button = mo.ui.run_button(label="Option 2")
456
- [first_button, second_button]`,`
457
- if first_button.value:
458
- print("You chose option 1!")
459
- elif second_button.value:
460
- print("You chose option 2!")
461
- else:
462
- print("Click a button!")`])}
463
- </example>
464
-
465
- <example title="SQL with duckdb">
466
- ${Gt([`import marimo as mo
467
- import pandas as pd`,"cars_df = pd.read_csv('<https://raw.githubusercontent.com/vega/vega-datasets/master/data/cars.json>')",'_df = mo.sql("SELECT * from cars_df WHERE Miles_per_Gallon > 20")'])}
468
- </example>`}function Gt(t){return t.map(e=>{return`
469
- @app.cell
470
- def __():
471
- ${r=e,r.trim().split(`
472
- `).map(n=>" "+n).join(`
473
- `)}
474
- return
475
- `;var r}).join("")}const ve=Mf.get("agents"),cl=R.memo(t=>{const e=H.c(4),{currentAgentId:r}=t;let n,s;return e[0]!==r?(n=r?js(r):"Agents",e[0]=r,e[1]=n):n=e[1],e[2]!==n?(s=g.jsx("span",{className:"text-sm font-medium",children:n}),e[2]=n,e[3]=s):s=e[3],s});cl.displayName="AgentTitle";const ul=R.memo(t=>{const e=H.c(4),{connectionState:r,onConnect:n,onDisconnect:s}=t,o=r.status==="connected",a=o?s:n,i=r.status==="connecting",l=o?"Disconnect":"Connect";let c;return e[0]!==a||e[1]!==i||e[2]!==l?(c=g.jsx(Ve,{variant:"outline",size:"xs",onClick:a,disabled:i,children:l}),e[0]=a,e[1]=i,e[2]=l,e[3]=c):c=e[3],c});ul.displayName="ConnectionControl";const pl=R.memo(t=>{const e=H.c(9),{currentAgentId:r,connectionStatus:n,shouldShowConnectionControl:s}=t;let o,a,i,l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=g.jsx(Ds,{className:"h-4 w-4 text-muted-foreground"}),e[0]=o):o=e[0],e[1]!==r?(a=g.jsx(cl,{currentAgentId:r}),e[1]=r,e[2]=a):a=e[2],e[3]!==n||e[4]!==s?(i=s&&g.jsx(Xi,{status:n}),e[3]=n,e[4]=s,e[5]=i):i=e[5],e[6]!==a||e[7]!==i?(l=g.jsxs("div",{className:"flex items-center gap-2",children:[o,a,i]}),e[6]=a,e[7]=i,e[8]=l):l=e[8],l});pl.displayName="HeaderInfo";const As=R.memo(t=>{const e=H.c(19),{connectionState:r,currentAgentId:n,onConnect:s,onDisconnect:o,onRestartThread:a,hasActiveSession:i,shouldShowConnectionControl:l}=t;let c,u,d,p,m;return e[0]!==r.status||e[1]!==n||e[2]!==l?(c=g.jsx(pl,{currentAgentId:n,connectionStatus:r.status,shouldShowConnectionControl:l}),e[0]=r.status,e[1]=n,e[2]=l,e[3]=c):c=e[3],e[4]!==r.status||e[5]!==i||e[6]!==a?(u=i&&r.status==="connected"&&a&&g.jsxs(Ve,{variant:"outline",size:"xs",onClick:a,title:"Restart thread (create new session)",children:[g.jsx(zf,{className:"h-3 w-3 mr-1"}),"Restart"]}),e[4]=r.status,e[5]=i,e[6]=a,e[7]=u):u=e[7],e[8]!==r||e[9]!==s||e[10]!==o||e[11]!==l?(d=l&&g.jsx(ul,{connectionState:r,onConnect:s,onDisconnect:o}),e[8]=r,e[9]=s,e[10]=o,e[11]=l,e[12]=d):d=e[12],e[13]!==u||e[14]!==d?(p=g.jsxs("div",{className:"flex items-center gap-2",children:[u,d]}),e[13]=u,e[14]=d,e[15]=p):p=e[15],e[16]!==c||e[17]!==p?(m=g.jsxs("div",{className:"flex border-b px-3 py-2 justify-between shrink-0 items-center",children:[c,p]}),e[16]=c,e[17]=p,e[18]=m):m=e[18],m});As.displayName="AgentPanelHeader";const dl=R.memo(t=>{const e=H.c(14),{currentAgentId:r,connectionState:n,onConnect:s,onDisconnect:o}=t;let a,i,l,c,u,d;return e[0]!==n||e[1]!==r||e[2]!==s||e[3]!==o?(a=g.jsx(As,{connectionState:n,currentAgentId:r,onConnect:s,onDisconnect:o,hasActiveSession:!1}),e[0]=n,e[1]=r,e[2]=s,e[3]=o,e[4]=a):a=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(i=g.jsx(Cs,{}),e[5]=i):i=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(l=g.jsx(Gl,{title:"No Agent Sessions",description:"Create a new session to start a conversation",action:g.jsx(an,{className:"border-y-1 rounded"}),icon:g.jsx(Ds,{})}),e[6]=l):l=e[6],e[7]!==n.status?(c=n.status==="disconnected"&&g.jsx(Ss,{className:"border-t pt-6",title:"Connect to an agent",description:"Start agents by running these commands in your terminal:"}),e[7]=n.status,e[8]=c):c=e[8],e[9]!==c?(u=g.jsx("div",{className:"flex-1 flex items-center justify-center p-6",children:g.jsxs("div",{className:"max-w-md w-full space-y-6",children:[l,c]})}),e[9]=c,e[10]=u):u=e[10],e[11]!==a||e[12]!==u?(d=g.jsxs("div",{className:"flex flex-col h-full",children:[a,i,u]}),e[11]=a,e[12]=u,e[13]=d):d=e[13],d});dl.displayName="EmptyState";const ml=R.memo(t=>{const e=H.c(10),{isLoading:r,isRequestingPermission:n,onStop:s}=t;if(!r)return null;let o,a,i,l,c,u;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=g.jsx(Ff,{size:"small",className:"text-primary"}),e[0]=o):o=e[0],e[1]!==n?(a=g.jsxs("div",{className:"flex items-center gap-2",children:[o,n?g.jsx("span",{children:"Waiting for permission to continue..."}):g.jsx("span",{children:"Agent is working..."})]}),e[1]=n,e[2]=a):a=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(i=g.jsx(Y,{className:"h-3 w-3 mr-1"}),l=g.jsx("span",{className:"text-xs",children:"Stop"}),e[3]=i,e[4]=l):(i=e[3],l=e[4]),e[5]!==s?(c=g.jsx("div",{className:"flex items-center gap-2",children:g.jsxs(Ve,{size:"sm",variant:"outline",onClick:s,className:"h-6 px-2",children:[i,l]})}),e[5]=s,e[6]=c):c=e[6],e[7]!==a||e[8]!==c?(u=g.jsx("div",{className:"px-3 py-2 border-t bg-muted/30 flex-shrink-0",children:g.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[a,c]})}),e[7]=a,e[8]=c,e[9]=u):u=e[9],u});ml.displayName="LoadingIndicator";const hl=R.memo(t=>{const e=H.c(11),{isLoading:r,activeSessionId:n,promptValue:s,onPromptValueChange:o,onPromptSubmit:a}=t,i=(r||!n)&&"opacity-50 pointer-events-none";let l;e[0]!==i?(l=Ie("px-3 py-2 border-t bg-background flex-shrink-0 min-h-[80px]",i),e[0]=i,e[1]=l):l=e[1];const c=r?Tl.NOOP:o,u=r?"Processing...":"Ask your AI agent...",d=r?"opacity-50 pointer-events-none":"";let p,m;return e[2]!==a||e[3]!==s||e[4]!==c||e[5]!==u||e[6]!==d?(p=g.jsx(Bf,{value:s,onChange:c,onSubmit:a,onClose:Tl.NOOP,placeholder:u,className:d,maxHeight:"120px"}),e[2]=a,e[3]=s,e[4]=c,e[5]=u,e[6]=d,e[7]=p):p=e[7],e[8]!==l||e[9]!==p?(m=g.jsx("div",{className:l,children:p}),e[8]=l,e[9]=p,e[10]=m):m=e[10],m});hl.displayName="PromptArea";const fl=R.memo(t=>{const e=H.c(30),{hasNotifications:r,connectionState:n,notifications:s,pendingPermission:o,onResolvePermission:a,onRetryConnection:i,onRetryLastAction:l,onDismissError:c,sessionId:u}=t,[d,p]=R.useState(!0),m=R.useRef(null);let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{const P=m.current;if(!P)return;const{scrollTop:A,scrollHeight:V,clientHeight:T}=P,L=!(V>T)||Math.abs(V-T-A)<5;p(L)},e[0]=h):h=e[0];const y=Le(h);let _;e[1]===Symbol.for("react.memo_cache_sentinel")?(_=()=>{const P=m.current;P&&P.scrollTo({top:P.scrollHeight,behavior:"smooth"})},e[1]=_):_=e[1];const f=Le(_);let w,k,x,S,E,C;e[2]!==d||e[3]!==s.length||e[4]!==f?(w=()=>{if(d&&s.length>0){const P=setTimeout(f,100);return()=>clearTimeout(P)}},k=[s.length,d,f],e[2]=d,e[3]=s.length,e[4]=f,e[5]=w,e[6]=k):(w=e[5],k=e[6]),R.useEffect(w,k),e[7]!==a||e[8]!==o?(x=o&&g.jsx("div",{className:"p-3 border-b",children:g.jsx(Ji,{permission:o,onResolve:a})}),e[7]=a,e[8]=o,e[9]=x):x=e[9],e[10]!==u?(S=u&&g.jsxs("div",{className:"text-xs text-muted-foreground mb-2 px-2",children:["Session ID: ",u]}),e[10]=u,e[11]=S):S=e[11],e[12]!==n||e[13]!==r||e[14]!==s||e[15]!==c||e[16]!==i||e[17]!==l?(E=r?g.jsx("div",{className:"space-y-2",children:g.jsx(Mh,{isConnected:n.status==="connected",notifications:s,onRetryConnection:i,onRetryLastAction:l,onDismissError:c})}):g.jsx("div",{className:"flex items-center justify-center h-full min-h-[200px]",children:g.jsx(Gl,{title:"Waiting for agent",description:"Your AI agent will appear here when active",icon:g.jsx(Ds,{})})}),e[12]=n,e[13]=r,e[14]=s,e[15]=c,e[16]=i,e[17]=l,e[18]=E):E=e[18],e[19]!==y||e[20]!==S||e[21]!==E?(C=g.jsxs("div",{ref:m,className:"flex-1 bg-muted/20 w-full flex flex-col overflow-y-auto p-2",onScroll:y,children:[S,E]}),e[19]=y,e[20]=S,e[21]=E,e[22]=C):C=e[22];const N=!d&&r;let I,D;return e[23]!==f||e[24]!==N?(I=g.jsx(sl,{isVisible:N,onScrollToBottom:f}),e[23]=f,e[24]=N,e[25]=I):I=e[25],e[26]!==I||e[27]!==x||e[28]!==C?(D=g.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden flex-shrink-0 relative",children:[x,C,I]}),e[26]=I,e[27]=x,e[28]=C,e[29]=D):D=e[29],D});fl.displayName="ChatContent";const Is="_skip_auto_connect_";function gl(){const t=Il.get(Nl);return t?Gf.dirname(t):""}zl=()=>{const[t,e]=R.useState(!1),[r,n]=R.useState(""),[s]=un(Es),[o,a]=un(dr),i=s?(l=s.agentId,on[l].webSocketUrl):Is;var l;const{sendUpdateFile:c,sendFileDetails:u}=Df(),d=R.useRef(!1),p=(function(T){const{wsUrl:L,autoConnect:G=!0,reconnectAttempts:z=3,reconnectDelay:B=2e3,clientOptions:W={}}=T,{getConnection:te,notifications:ee,activeSessionId:xe,agentCapabilities:se,setActiveSessionId:pe,setConnection:wt,setActiveConnection:Je,addNotification:Bt,clearNotifications:Ts}=Wc(),[kt,Ye]=R.useState(null),[cn,_l]=R.useState(null),[zh,Fh]=R.useState(!1),vt=R.useRef(null),Ut=R.useRef(null),Bh=R.useRef(null),Uh=R.useRef(!1),qh=Ke((de,Ae)=>{wt(Ae,de),Bt({type:"connection_change",data:de})}),Wh=Ke((de,Ae)=>{Bt({type:"error",data:de})}),Hh=Ke(de=>{Bt({type:"session_notification",data:de})}),Qh=Ke(de=>{Ye(de)}),bl=Ke(async()=>{vt.current||(vt.current=new Bc({onConnectionStateChange:qh,onError:Wh,reconnectAttempts:z,reconnectDelay:B})),Je(L);const{readable:de,writable:Ae}=await vt.current.connect(L),Jh=new $c(De=>{const Me=new Vc(De,{...W,onRequestPermission:Et=>{var _r;(_r=W==null?void 0:W.onRequestPermission)==null||_r.call(W,Et),Qh(Et)},onSessionNotification:Et=>{var _r;(_r=W==null?void 0:W.onSessionNotification)==null||_r.call(W,Et),Hh(Et)}});return Ut.current=Me,Me},Ae,de),Yh=new Gc(Jh,{on_initialize_response:De=>{const Me=De.agentCapabilities;console.log("[acp] Agent capabilities",Me);const Et=te(L);wt(L,Et.state,Me)},on_newSession_response:De=>{console.log("[acp] New session created",De),pe(De.sessionId)},on_loadSession_response:(De,Me)=>{console.log("[acp] Session resumed",Me),pe(Me.sessionId)},on_prompt_start:De=>{for(const Me of De.prompt)Bt({type:"session_notification",data:{sessionId:De.sessionId,update:{sessionUpdate:"user_message_chunk",content:Me}}})}});_l(Yh)}),yl=Ke(de=>{const Ae=de||L;vt.current&&(de?vt.current.disconnect(de):(vt.current.disconnect(Ae),vt.current=null,Ut.current=null,_l(null))),de||(Ye(null),Uh.current=!1,Bh.current=null,Fh(!1))}),Zh=Ke(de=>{if(kt&&Ut.current){const Ae=kt.id;Ae&&Ut.current.resolvePermission(Ae,de)}Ye(null)}),Xh=Ke(de=>{if(kt&&Ut.current){const Ae=kt.id;Ae&&Ut.current.rejectPermission(Ae,de)}Ye(null)});return R.useEffect(()=>(G&&bl().catch(console.error),()=>{yl()}),[G,L]),{connect:bl,disconnect:yl,connectionState:te(L).state,activeSessionId:xe,notifications:xe&&ee[xe]||[],isSessionLoading:zh,clearNotifications:Ts,pendingPermission:kt,resolvePermission:Zh,rejectPermission:Xh,agent:cn,agentCapabilities:se}})({wsUrl:i,clientOptions:{readTextFile:T=>(ve.debug("Agent requesting file read",{path:T.path}),u({path:T.path}).then(L=>({content:L.contents||""}))),writeTextFile:T=>(ve.debug("Agent requesting file write",{path:T.path,contentLength:T.content.length}),c({path:T.path,contents:T.content}).then(()=>null))},autoConnect:!1}),{connect:m,disconnect:h,connectionState:y,notifications:_,pendingPermission:f,resolvePermission:w,activeSessionId:k,agent:x}=p;R.useEffect(()=>{if(i!==Is)return ve.debug("Auto-connecting to agent",{sessionId:k}),m(),()=>{}},[i]);const S=Le(async()=>{if(d.current||!x)return;k&&await x.cancel({sessionId:k}).catch(L=>{ve.error("Failed to cancel active session",{error:L})}),ve.debug("Creating new agent session",{}),d.current=!0;const T=await x.newSession({cwd:gl(),mcpServers:[]}).finally(()=>{d.current=!1});a(L=>Ki(L,T.sessionId))}),E=Le(async T=>{if(x){if(ve.debug("Resuming agent session",{sessionId:T}),!x.loadSession)throw new Error("Agent does not support loading sessions");await x.loadSession({sessionId:T,cwd:gl(),mcpServers:[]}),a(L=>Ki(L,T))}}),C=y.status==="connected",N=s==null?void 0:s.externalAgentSessionId;R.useEffect(()=>{!C||!s||!x||k&&N||(async()=>{try{if(N)try{await E(N)}catch(T){ve.debug("Failed to resume session, creating new session",{externalSessionId:N,error:T}),await S()}else await S()}catch(T){ve.error("Failed to create or resume session:",T)}})()},[C,x,N,k]);const I=Le(async(T,L)=>{if(!k||!x||t)return;ve.debug("Submitting prompt to agent",{sessionId:k}),e(!0),n(""),s!=null&&s.title.startsWith("New ")&&a(z=>(function(B,W){const te=B.activeTabId;return te?{...B,sessions:B.sessions.map(ee=>ee.tabId===te?{...ee,title:Yi(W)}:ee)}:B})(z,L));const G=Il.get(Nl);if(G)try{await x.prompt({sessionId:k,prompt:[{type:"text",text:L},{type:"resource_link",uri:G,mimeType:"text/x-python",name:G},{type:"resource",resource:{uri:"marimo_rules.md",mimeType:"text/markdown",text:Gh(G)}}]})}catch(z){ve.error("Failed to send prompt",{error:z})}finally{e(!1)}else Vf({title:"Notebook must be named",description:"Please name the notebook to use the agent",variant:"danger"})}),D=Le(async()=>{k&&x&&(await x.cancel({sessionId:k}),e(!1))}),P=Le(()=>{ve.debug("Manual connect requested",{currentStatus:y.status}),m()}),A=Le(()=>{ve.debug("Manual disconnect requested",{sessionId:k,currentStatus:y.status}),h()}),V=_.length>0;return o.sessions.length>0?g.jsxs("div",{className:"flex flex-col flex-1 overflow-hidden mo-agent-panel",children:[g.jsx(As,{connectionState:y,currentAgentId:s==null?void 0:s.agentId,onConnect:P,onDisconnect:A,onRestartThread:S,hasActiveSession:!0,shouldShowConnectionControl:i!==Is}),g.jsx(Cs,{}),g.jsx(fl,{sessionId:k,hasNotifications:V,connectionState:y,notifications:_,pendingPermission:f,onResolvePermission:T=>{ve.debug("Resolving permission request",{sessionId:k,option:T}),w(T)},onRetryConnection:P}),g.jsx(ml,{isLoading:t,isRequestingPermission:!!f,onStop:D}),g.jsx(hl,{isLoading:t,activeSessionId:k,promptValue:r,onPromptValueChange:n,onPromptSubmit:I})]}):g.jsx(dl,{currentAgentId:s==null?void 0:s.agentId,connectionState:y,onConnect:P,onDisconnect:A})}});export{lg as __tla,zl as default};