@openchamber/web 2.3.0 → 2.3.1

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 (250) hide show
  1. package/dist/assets/AboutDialog-C1ulAXh5.js +1 -0
  2. package/dist/assets/ArchiveView-DJo1Bpw_.js +1 -0
  3. package/dist/assets/{CommandPalette-1VlA7PbL.js → CommandPalette-B6r6DPF9.js} +2 -2
  4. package/dist/assets/{DiffView-SHdJJ6tl.js → DiffView-mJuVm7Z4.js} +2 -2
  5. package/dist/assets/{FilePreviewCommentMenu-DlVgwRsr.js → FilePreviewCommentMenu-Ca4ziuof.js} +1 -1
  6. package/dist/assets/{FilesView-BeMtsSlV.js → FilesView-BBFbfDp9.js} +3 -3
  7. package/dist/assets/{GitView-npRGKKx8.js → GitView-WL1wkRFF.js} +3 -3
  8. package/dist/assets/GuestSurfacePane-peVDY5gW.js +1 -0
  9. package/dist/assets/HelpDialog-Dxc2yneu.js +1 -0
  10. package/dist/assets/{InProgressOperationBanner-B6iO22_7.js → InProgressOperationBanner-Dy0RiPsD.js} +1 -1
  11. package/dist/assets/JsonTreeView-BKUmh7Iw.js +1 -0
  12. package/dist/assets/MarkdownImageGallery-Cd6hLNmi.js +1 -0
  13. package/dist/assets/MarkdownRendererImpl-C-3B3mBt.js +1 -0
  14. package/dist/assets/MemoryDebugPanel-b116r1SF.js +1 -0
  15. package/dist/assets/OnboardingScreen-vBEhpU3q.js +1 -0
  16. package/dist/assets/OpenCodeStatusDialog-DH7dJ6MH.js +1 -0
  17. package/dist/assets/{PatchDiff-Du2s7T3U.js → PatchDiff-yM7vgQgi.js} +1 -1
  18. package/dist/assets/{PierreDiffViewer-B9K0gBvV.js → PierreDiffViewer-DnHKbYGl.js} +1 -1
  19. package/dist/assets/{PlanView-IkTcPrbw.js → PlanView-j0hLJmto.js} +2 -2
  20. package/dist/assets/RunOverview-ZuFZvDcu.js +2 -0
  21. package/dist/assets/ScheduledTasksDialog-UKXFFI91.js +5 -0
  22. package/dist/assets/{SettingsView-DIy5ZL4-.js → SettingsView-gB_NvyX4.js} +8 -8
  23. package/dist/assets/SettingsWindow-Dfb_RFpD.js +1 -0
  24. package/dist/assets/SourceBoardView-BjaL0nKs.js +1 -0
  25. package/dist/assets/SpaceAccessDialog-XzHRmIdT.js +1 -0
  26. package/dist/assets/SpaceApplyDialog-CxX9mrzT.js +1 -0
  27. package/dist/assets/{SpaceRow-YPmKQKeD.js → SpaceRow-vCpOCANO.js} +1 -1
  28. package/dist/assets/SpaceSetupOutput-CDZvJCf_.js +1 -0
  29. package/dist/assets/SpacesView-D3a9bCzn.js +1 -0
  30. package/dist/assets/{SubmoduleDiffSummary-RDY5md3p.js → SubmoduleDiffSummary-CQyRcvDZ.js} +1 -1
  31. package/dist/assets/{ToolOutputDialog-Dx85XZJs.js → ToolOutputDialog-judR_5mS.js} +2 -2
  32. package/dist/assets/{ToolPartDiffPreview-Dtv0xF9O.js → ToolPartDiffPreview-Ca9ISxfg.js} +1 -1
  33. package/dist/assets/UsageStatsView-C63Emjfj.js +1 -0
  34. package/dist/assets/{Virtualizer-DL535kyR.js → Virtualizer-DNgIEKcx.js} +1 -1
  35. package/dist/assets/{WalkthroughView-DcxbT5tc.js → WalkthroughView-D74b_7sC.js} +2 -2
  36. package/dist/assets/WorktreesView-hcm8Eb_C.js +1 -0
  37. package/dist/assets/appThemeRegistry-COeayQaQ.js +1 -0
  38. package/dist/assets/{ar-lP51qqz9.js → ar-1_zdYVV5.js} +2 -2
  39. package/dist/assets/computeVirtualFileMetrics-MZqvCQy0.js +3 -0
  40. package/dist/assets/{de-CpROAvTV.js → de-Ci7SGEQP.js} +3 -3
  41. package/dist/assets/{decorate-BNB7jeKg.js → decorate-CZeRRVC7.js} +1 -1
  42. package/dist/assets/{es-Bb8LKRhE.js → es-ZJii-6Tt.js} +2 -2
  43. package/dist/assets/{fr-BlNN9FC2.js → fr-C-hK8mvI.js} +2 -2
  44. package/dist/assets/{he-r546pCuc.js → he-t07CylP8.js} +2 -2
  45. package/dist/assets/index-D2tPUss-.js +1 -0
  46. package/dist/assets/{initializeSharedPreferences-dCHO04bl.js → initializeSharedPreferences-FxFkTjgn.js} +1 -1
  47. package/dist/assets/{isDiffPlainText-BwicHPpI.js → isDiffPlainText-C1F9opE5.js} +1 -1
  48. package/dist/assets/{isFilePlainText-Dk2R7BJo.js → isFilePlainText-B4SyJ-ni.js} +1 -1
  49. package/dist/assets/{ja-evNvJAHz.js → ja-iJr8aONy.js} +2 -2
  50. package/dist/assets/{katex-CMY-1eWf.css → katex-BEX7X_K8.css} +1 -1
  51. package/dist/assets/{katex.min-Iw9WSgM9.js → katex.min-C-51hS9A.js} +18 -18
  52. package/dist/assets/{ko-BPQP7lXe.js → ko-D5ow_yz-.js} +2 -2
  53. package/dist/assets/main-BtGnuno4.js +1048 -0
  54. package/dist/assets/main-uj5954n5.js +2 -0
  55. package/dist/assets/markdownCore-rBXCnAJp.js +9 -0
  56. package/dist/assets/miniChat-yWQmT2OS.js +2 -0
  57. package/dist/assets/mobile-NDAeGtzL.js +2 -0
  58. package/dist/assets/{moveWorkspacePath-B31RGdgu.js → moveWorkspacePath-BINgpJ9S.js} +1 -1
  59. package/dist/assets/{nl-CkQXd1nU.js → nl-CfqYrSVe.js} +2 -2
  60. package/dist/assets/{parseDiffFromFile-DcsKSY0J.js → parseDiffFromFile--DE4eHIp.js} +2 -2
  61. package/dist/assets/{patchFileDiff-Cx-HpjyI.js → patchFileDiff-BfFUmWgS.js} +1 -1
  62. package/dist/assets/pierreDiffTint-D9K6_CVD.js +29 -0
  63. package/dist/assets/{pl-C4i9Aizi.js → pl-Bn2_jAhL.js} +4 -4
  64. package/dist/assets/{pt-BR-CoYnG1CH.js → pt-BR-ZSDgn6cI.js} +2 -2
  65. package/dist/assets/relocateRestoredSession-C85Tk2y9.js +1 -0
  66. package/dist/assets/renderElectronMiniChatApp-BvAEmWhZ.js +2 -0
  67. package/dist/assets/{renderMobileApp-gDKxRJQi.js → renderMobileApp-T20l8ise.js} +7 -7
  68. package/dist/assets/{restartOpenCode-dq-SGun3.js → restartOpenCode-VEmIrLer.js} +1 -1
  69. package/dist/assets/runtimeEndpointReset-ExJsaWzA.js +55 -0
  70. package/dist/assets/scheduledTasksApi-NSyxVfHu.js +1 -0
  71. package/dist/assets/{selectionMarkdown-sDTBbKLh.js → selectionMarkdown-BJ2RhTXc.js} +2 -2
  72. package/dist/assets/{sessionOwnership-kZAtwMQd.js → sessionOwnership-BAX1xEJC.js} +1 -1
  73. package/dist/assets/{shikiHighlight-BRNXPlF-.js → shikiHighlight-DOzrE7BE.js} +1 -1
  74. package/dist/assets/{space-apply-CCOKLfrX.js → space-apply-DB_ZfJBW.js} +1 -1
  75. package/dist/assets/space-close-1kNlTkW1.js +1 -0
  76. package/dist/assets/{spaceNetwork-DUxJClu3.js → spaceNetwork-DA16ov_y.js} +1 -1
  77. package/dist/assets/{textMateThemeFromAppTheme-B6UJwdZz.js → textMateThemeFromAppTheme-BfIrjFAU.js} +1 -1
  78. package/dist/assets/{tr-D-_lz-lC.js → tr-C89uz1hs.js} +2 -2
  79. package/dist/assets/{uk-B49PGMYB.js → uk-uTYVPFrO.js} +2 -2
  80. package/dist/assets/{useAppFontEffects-3EN8Ava3.js → useAppFontEffects-C1ceAD51.js} +185 -185
  81. package/dist/assets/useCallableModelProviders-BkLsgs6y.js +1 -0
  82. package/dist/assets/{useInlineCommentController-l9cWyfuR.js → useInlineCommentController-ynkUsoVA.js} +1 -1
  83. package/dist/assets/{useRootScrollLock-UAQn24Y8.js → useRootScrollLock-DnoKH1HE.js} +2 -2
  84. package/dist/assets/{vendor-codemirror-autocomplete-C8FBSI9t.js → vendor-codemirror-autocomplete-BRKmCSiY.js} +1 -1
  85. package/dist/assets/{vendor-codemirror-commands-BhRb6jns.js → vendor-codemirror-commands-MmBpgSOc.js} +1 -1
  86. package/dist/assets/vendor-codemirror-lang-angular-Bj5Pk8sp.js +1 -0
  87. package/dist/assets/vendor-codemirror-lang-cpp-tZt-BOgi.js +1 -0
  88. package/dist/assets/vendor-codemirror-lang-css-DfdrZ848.js +1 -0
  89. package/dist/assets/{vendor-codemirror-lang-go-BHJEONih.js → vendor-codemirror-lang-go-C9OcoXdP.js} +2 -2
  90. package/dist/assets/vendor-codemirror-lang-html-C5kFuJzc.js +1 -0
  91. package/dist/assets/vendor-codemirror-lang-java-Divn2dnj.js +1 -0
  92. package/dist/assets/{vendor-codemirror-lang-javascript-CUmSxayT.js → vendor-codemirror-lang-javascript-DmPuKUEa.js} +2 -2
  93. package/dist/assets/vendor-codemirror-lang-jinja-B-8miA-Q.js +1 -0
  94. package/dist/assets/vendor-codemirror-lang-json-L0wsFFxi.js +1 -0
  95. package/dist/assets/vendor-codemirror-lang-less-CWlCIxCI.js +1 -0
  96. package/dist/assets/vendor-codemirror-lang-liquid-Dm8xthAW.js +1 -0
  97. package/dist/assets/vendor-codemirror-lang-markdown-CPn-qinN.js +1 -0
  98. package/dist/assets/vendor-codemirror-lang-php-DKIOifjN.js +1 -0
  99. package/dist/assets/vendor-codemirror-lang-python-BAVa3Hg5.js +3 -0
  100. package/dist/assets/vendor-codemirror-lang-rust-Dab90hdg.js +1 -0
  101. package/dist/assets/vendor-codemirror-lang-sass-eezaHFBZ.js +1 -0
  102. package/dist/assets/{vendor-codemirror-lang-sql-C1Jj9uuJ.js → vendor-codemirror-lang-sql-Vu-PR7cv.js} +2 -2
  103. package/dist/assets/vendor-codemirror-lang-vue-BthRGZHy.js +1 -0
  104. package/dist/assets/vendor-codemirror-lang-wast-Db6KSic0.js +1 -0
  105. package/dist/assets/vendor-codemirror-lang-xml-DQkh4sc1.js +1 -0
  106. package/dist/assets/vendor-codemirror-lang-yaml-Bt2N__AW.js +1 -0
  107. package/dist/assets/vendor-codemirror-language-DkBxRck3.js +3 -0
  108. package/dist/assets/vendor-codemirror-language-data-CTYHXywt.js +2 -0
  109. package/dist/assets/{vendor-codemirror-search-CvXM_pZg.js → vendor-codemirror-search-BKAwkhkm.js} +1 -1
  110. package/dist/assets/vendor-codemirror-streamparser-CmlTsbN2.js +1 -0
  111. package/dist/assets/vendor-codemirror-view-B66jUSmE.js +4 -0
  112. package/dist/assets/{vendor-replit-codemirror-vim-Ck2X_WZC.js → vendor-replit-codemirror-vim-D0bqFa1D.js} +5 -5
  113. package/dist/assets/{worker-DdhrXE7g.js → worker-BbEdJ2Oi.js} +18 -18
  114. package/dist/assets/workerFactory-Bw5qLmrM.js +1 -0
  115. package/dist/assets/{zh-CN-CS-9Os9n.js → zh-CN-DdTNG52a.js} +2 -2
  116. package/dist/assets/{zh-TW-D0XYVdcl.js → zh-TW-DPm_33Fi.js} +2 -2
  117. package/dist/index.html +3 -3
  118. package/dist/mini-chat.html +3 -3
  119. package/dist/mobile.html +3 -3
  120. package/package.json +2 -2
  121. package/server/index.js +4 -0
  122. package/server/lib/environment/store.js +3 -4
  123. package/server/lib/environment/store.test.js +17 -0
  124. package/server/lib/fs/DOCUMENTATION.md +4 -2
  125. package/server/lib/fs/routes.js +48 -13
  126. package/server/lib/fs/routes.test.js +118 -5
  127. package/server/lib/git/DOCUMENTATION.md +3 -1
  128. package/server/lib/git/contributor-remote.js +4 -0
  129. package/server/lib/git/contributor-remote.test.js +21 -0
  130. package/server/lib/git/service.js +20 -25
  131. package/server/lib/git/service.test.js +99 -0
  132. package/server/lib/git/worktree-creation.js +4 -5
  133. package/server/lib/github/DOCUMENTATION.md +1 -1
  134. package/server/lib/github/routes.auth.test.js +14 -0
  135. package/server/lib/github/routes.js +13 -5
  136. package/server/lib/github/routes.mutations.test.js +18 -2
  137. package/server/lib/message-queue/DOCUMENTATION.md +8 -2
  138. package/server/lib/message-queue/runtime.js +3 -2
  139. package/server/lib/message-queue/runtime.test.js +64 -2
  140. package/server/lib/openchamber-control/service.js +48 -13
  141. package/server/lib/openchamber-control/service.test.js +42 -0
  142. package/server/lib/opencode/DOCUMENTATION.md +3 -1
  143. package/server/lib/opencode/project-start-command.d.ts +11 -0
  144. package/server/lib/opencode/project-start-command.js +56 -0
  145. package/server/lib/opencode/project-start-command.test.js +80 -0
  146. package/server/lib/opencode/session-activity.js +43 -3
  147. package/server/lib/opencode/session-activity.test.js +97 -0
  148. package/server/lib/opencode/settings-runtime.js +19 -1
  149. package/server/lib/opencode/settings-runtime.test.js +23 -0
  150. package/server/lib/opencode/skill-routes.js +34 -1
  151. package/server/lib/opencode/skill-routes.test.js +99 -0
  152. package/server/lib/quota/DOCUMENTATION.md +13 -1
  153. package/server/lib/quota/providers/antigravity/api.js +104 -0
  154. package/server/lib/quota/providers/antigravity/auth.js +45 -0
  155. package/server/lib/quota/providers/antigravity/index.js +76 -0
  156. package/server/lib/quota/providers/antigravity/transforms.js +168 -0
  157. package/server/lib/quota/providers/antigravity/transforms.test.js +162 -0
  158. package/server/lib/quota/providers/codex.js +28 -4
  159. package/server/lib/quota/providers/codex.test.js +29 -0
  160. package/server/lib/quota/providers/google/auth.js +4 -49
  161. package/server/lib/quota/providers/google/transforms.js +3 -22
  162. package/server/lib/quota/providers/index.js +8 -0
  163. package/server/lib/quota/providers/opencode-go.js +3 -1
  164. package/server/lib/quota/providers/opencode-go.test.js +12 -0
  165. package/server/lib/routing/DOCUMENTATION.md +3 -1
  166. package/server/lib/routing/runtime.js +34 -1
  167. package/server/lib/routing/runtime.test.js +43 -1
  168. package/server/lib/scheduled-tasks/DOCUMENTATION.md +11 -0
  169. package/server/lib/scheduled-tasks/existing-session.js +52 -8
  170. package/server/lib/scheduled-tasks/existing-session.test.js +121 -0
  171. package/server/lib/scheduled-tasks/routes.js +26 -0
  172. package/server/lib/scheduled-tasks/runtime.js +1 -0
  173. package/server/lib/session-assist/runtime.js +3 -0
  174. package/server/lib/session-assist/runtime.test.js +47 -0
  175. package/server/lib/skills-catalog/DOCUMENTATION.md +10 -1
  176. package/server/lib/skills-catalog/install.js +1 -1
  177. package/server/lib/skills-catalog/installed-sources.d.ts +17 -0
  178. package/server/lib/skills-catalog/installed-sources.js +112 -0
  179. package/server/lib/skills-catalog/installed-sources.test.js +94 -0
  180. package/server/lib/small-model/DOCUMENTATION.md +12 -5
  181. package/server/lib/small-model/index.js +6 -4
  182. package/server/lib/small-model/index.test.js +40 -0
  183. package/server/lib/small-model/routes.js +3 -2
  184. package/server/lib/source-control/change-request-worktree.js +2 -6
  185. package/server/lib/source-control/mutation-storage.js +4 -1
  186. package/server/lib/source-control/mutation-storage.test.js +21 -0
  187. package/server/lib/spaces/DOCUMENTATION.md +1 -1
  188. package/server/lib/spaces/journey.js +10 -3
  189. package/server/lib/spaces/journey.test.js +13 -1
  190. package/server/lib/terminal/history.js +22 -2
  191. package/server/lib/terminal/history.test.js +23 -0
  192. package/server/lib/terminal/theme-response.js +14 -0
  193. package/server/lib/terminal/theme-response.test.js +10 -0
  194. package/dist/assets/AboutDialog-e8ek_kPI.js +0 -1
  195. package/dist/assets/ArchiveView-CjF4_TFg.js +0 -1
  196. package/dist/assets/GuestSurfacePane-4kmEXPLD.js +0 -1
  197. package/dist/assets/HelpDialog-CITMqPDK.js +0 -1
  198. package/dist/assets/JsonTreeView-xGikhCtL.js +0 -1
  199. package/dist/assets/MarkdownImageGallery-D0FJyr7C.js +0 -1
  200. package/dist/assets/MarkdownRendererImpl-BIM7Pjwk.js +0 -1
  201. package/dist/assets/MemoryDebugPanel-CBk8QW-M.js +0 -1
  202. package/dist/assets/OnboardingScreen-Cy6ARiMS.js +0 -1
  203. package/dist/assets/OpenCodeStatusDialog-YMHuJzwt.js +0 -1
  204. package/dist/assets/RunOverview-CHkGSW1x.js +0 -2
  205. package/dist/assets/ScheduledTasksDialog-77SO8zdJ.js +0 -4
  206. package/dist/assets/SettingsWindow-X74FIkdo.js +0 -1
  207. package/dist/assets/SourceBoardView-Cff2ejOW.js +0 -1
  208. package/dist/assets/SpaceAccessDialog-BXMZNRei.js +0 -1
  209. package/dist/assets/SpaceApplyDialog-BEJd2ryu.js +0 -1
  210. package/dist/assets/SpaceSetupOutput-Cb3XcIII.js +0 -1
  211. package/dist/assets/SpacesView-I3HaRKtW.js +0 -1
  212. package/dist/assets/UsageStatsView-DwTt9zIz.js +0 -1
  213. package/dist/assets/WorktreesView-Bh7GLvrR.js +0 -1
  214. package/dist/assets/appThemeRegistry-Bzb67M9O.js +0 -1
  215. package/dist/assets/computeVirtualFileMetrics-WAp98Bb7.js +0 -3
  216. package/dist/assets/index-BsupKM40.js +0 -1
  217. package/dist/assets/main-C_QGhDBL.js +0 -1048
  218. package/dist/assets/main-pWZ7F_hy.js +0 -2
  219. package/dist/assets/markdownCore-6gz4uJDQ.js +0 -9
  220. package/dist/assets/miniChat-DnaTfdYh.js +0 -2
  221. package/dist/assets/mobile-C7DIJqP8.js +0 -2
  222. package/dist/assets/pierreDiffTint-B297eqF0.js +0 -28
  223. package/dist/assets/relocateRestoredSession-D3lujODj.js +0 -1
  224. package/dist/assets/renderElectronMiniChatApp-BF4hNe69.js +0 -2
  225. package/dist/assets/runtimeEndpointReset-D6Lxhk0S.js +0 -55
  226. package/dist/assets/scheduledTasksApi-DUbAMrjW.js +0 -1
  227. package/dist/assets/space-close-CWcWwH4_.js +0 -1
  228. package/dist/assets/useCallableModelProviders-BB9xkUzM.js +0 -1
  229. package/dist/assets/vendor-codemirror-lang-angular-BpYCRJSk.js +0 -1
  230. package/dist/assets/vendor-codemirror-lang-cpp-BI3uPyjT.js +0 -1
  231. package/dist/assets/vendor-codemirror-lang-css-B2_PZTBl.js +0 -1
  232. package/dist/assets/vendor-codemirror-lang-html-BpvvTxbZ.js +0 -1
  233. package/dist/assets/vendor-codemirror-lang-java-BM5LQZ4u.js +0 -1
  234. package/dist/assets/vendor-codemirror-lang-jinja-D8nLZQPK.js +0 -1
  235. package/dist/assets/vendor-codemirror-lang-json-VDxF27mO.js +0 -1
  236. package/dist/assets/vendor-codemirror-lang-less-BecU2BJP.js +0 -1
  237. package/dist/assets/vendor-codemirror-lang-liquid-DCw83Anh.js +0 -1
  238. package/dist/assets/vendor-codemirror-lang-markdown-CimQAQbQ.js +0 -1
  239. package/dist/assets/vendor-codemirror-lang-php-C5Kpnpyb.js +0 -1
  240. package/dist/assets/vendor-codemirror-lang-python-BFE1OJNx.js +0 -3
  241. package/dist/assets/vendor-codemirror-lang-rust-hqZDyGIJ.js +0 -1
  242. package/dist/assets/vendor-codemirror-lang-sass-CAZML-Jl.js +0 -1
  243. package/dist/assets/vendor-codemirror-lang-vue-BHOTXcKp.js +0 -1
  244. package/dist/assets/vendor-codemirror-lang-wast-DcCHfPUI.js +0 -1
  245. package/dist/assets/vendor-codemirror-lang-xml-BO_V-1wZ.js +0 -1
  246. package/dist/assets/vendor-codemirror-lang-yaml-CPimap_N.js +0 -1
  247. package/dist/assets/vendor-codemirror-language-BBADuAkg.js +0 -3
  248. package/dist/assets/vendor-codemirror-language-data-Cu5ZbrPm.js +0 -2
  249. package/dist/assets/vendor-codemirror-view-1e0FQ6Wn.js +0 -4
  250. package/dist/assets/workerFactory-De9YXIdE.js +0 -1
@@ -1,6 +1,6 @@
1
- let U=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function Zs(t){return bn(t)}function bn(t){return Array.isArray(t)?Qs(t):t instanceof RegExp?t:typeof t=="object"?Ys(t):t}function Qs(t){let e=[];for(let n=0,r=t.length;n<r;n++)e[n]=bn(t[n]);return e}function Ys(t){let e={};for(let n in t)e[n]=bn(t[n]);return e}function Or(t,...e){return e.forEach(n=>{for(let r in n)t[r]=n[r]}),t}function Dr(t){const e=~t.lastIndexOf("/")||~t.lastIndexOf("\\");return e===0?t:~e===t.length-1?Dr(t.substring(0,t.length-1)):t.substr(~e+1)}var At=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,qe=class{static hasCaptures(t){return t===null?!1:(At.lastIndex=0,At.test(t))}static replaceCaptures(t,e,n){return t.replace(At,(r,s,o,i)=>{let l=n[parseInt(s||o,10)];if(l){let a=e.substring(l.start,l.end);for(;a[0]===".";)a=a.substring(1);switch(i){case"downcase":return a.toLowerCase();case"upcase":return a.toUpperCase();default:return a}}else return r})}};function Br(t,e){return t<e?-1:t>e?1:0}function Gr(t,e){if(t===null&&e===null)return 0;if(!t)return-1;if(!e)return 1;let n=t.length,r=e.length;if(n===r){for(let s=0;s<n;s++){let o=Br(t[s],e[s]);if(o!==0)return o}return 0}return n-r}function On(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 Fr(t){return t.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var Ur=class{constructor(t){this.fn=t}cache=new Map;get(t){if(this.cache.has(t))return this.cache.get(t);const e=this.fn(t);return this.cache.set(t,e),e}},at=class{constructor(t,e,n){this._colorMap=t,this._defaults=e,this._root=n}static createFromRawTheme(t,e){return this.createFromParsedTheme(to(t),e)}static createFromParsedTheme(t,e){return ro(t,e)}_cachedMatchRoot=new Ur(t=>this._root.match(t));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(s=>Js(t.parent,s.parentScopes));return r?new jr(r.fontStyle,r.foreground,r.background):null}},Rt=class rt{constructor(e,n){this.parent=e,this.scopeName=n}static push(e,n){for(const r of n)e=new rt(e,r);return e}static from(...e){let n=null;for(let r=0;r<e.length;r++)n=new rt(n,e[r]);return n}push(e){return new rt(this,e)}getSegments(){let e=this;const n=[];for(;e;)n.push(e.scopeName),e=e.parent;return n.reverse(),n}toString(){return this.getSegments().join(" ")}extends(e){return this===e?!0:this.parent===null?!1:this.parent.extends(e)}getExtensionIfDefined(e){const n=[];let r=this;for(;r&&r!==e;)n.push(r.scopeName),r=r.parent;return r===e?n.reverse():void 0}};function Js(t,e){if(e.length===0)return!0;for(let n=0;n<e.length;n++){let r=e[n],s=!1;if(r===">"){if(n===e.length-1)return!1;r=e[++n],s=!0}for(;t&&!eo(t.scopeName,r);){if(s)return!1;t=t.parent}if(!t)return!1;t=t.parent}return!0}function eo(t,e){return e===t||t.startsWith(e)&&t[e.length]==="."}var jr=class{constructor(t,e,n){this.fontStyle=t,this.foregroundId=e,this.backgroundId=n}};function to(t){if(!t)return[];if(!t.settings||!Array.isArray(t.settings))return[];let e=t.settings,n=[],r=0;for(let s=0,o=e.length;s<o;s++){let i=e[s];if(!i.settings)continue;let l;if(typeof i.scope=="string"){let f=i.scope;f=f.replace(/^[,]+/,""),f=f.replace(/[,]+$/,""),l=f.split(",")}else Array.isArray(i.scope)?l=i.scope:l=[""];let a=-1;if(typeof i.settings.fontStyle=="string"){a=0;let f=i.settings.fontStyle.split(" ");for(let h=0,p=f.length;h<p;h++)switch(f[h]){case"italic":a=a|1;break;case"bold":a=a|2;break;case"underline":a=a|4;break;case"strikethrough":a=a|8;break}}let c=null;typeof i.settings.foreground=="string"&&On(i.settings.foreground)&&(c=i.settings.foreground);let u=null;typeof i.settings.background=="string"&&On(i.settings.background)&&(u=i.settings.background);for(let f=0,h=l.length;f<h;f++){let d=l[f].trim().split(" "),b=d[d.length-1],w=null;d.length>1&&(w=d.slice(0,d.length-1),w.reverse()),n[r++]=new no(b,w,s,a,c,u)}}return n}var no=class{constructor(t,e,n,r,s,o){this.scope=t,this.parentScopes=e,this.index=n,this.fontStyle=r,this.foreground=s,this.background=o}},W=(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))(W||{});function ro(t,e){t.sort((a,c)=>{let u=Br(a.scope,c.scope);return u!==0||(u=Gr(a.parentScopes,c.parentScopes),u!==0)?u:a.index-c.index});let n=0,r="#000000",s="#ffffff";for(;t.length>=1&&t[0].scope==="";){let a=t.shift();a.fontStyle!==-1&&(n=a.fontStyle),a.foreground!==null&&(r=a.foreground),a.background!==null&&(s=a.background)}let o=new so(e),i=new jr(n,o.getId(r),o.getId(s)),l=new io(new Kt(0,null,-1,0,0),[]);for(let a=0,c=t.length;a<c;a++){let u=t[a];l.insert(0,u.scope,u.parentScopes,u.fontStyle,o.getId(u.foreground),o.getId(u.background))}return new at(o,i,l)}var so=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(t){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(t)){this._isFrozen=!0;for(let e=0,n=t.length;e<n;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)}},oo=Object.freeze([]),Kt=class zr{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,n,r,s,o){this.scopeDepth=e,this.parentScopes=n||oo,this.fontStyle=r,this.foreground=s,this.background=o}clone(){return new zr(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let n=[];for(let r=0,s=e.length;r<s;r++)n[r]=e[r].clone();return n}acceptOverwrite(e,n,r,s){this.scopeDepth>e?console.log("how did this happen?"):this.scopeDepth=e,n!==-1&&(this.fontStyle=n),r!==0&&(this.foreground=r),s!==0&&(this.background=s)}},io=class Zt{constructor(e,n=[],r={}){this._mainRule=e,this._children=r,this._rulesWithParentScopes=n}_rulesWithParentScopes;static _cmpBySpecificity(e,n){if(e.scopeDepth!==n.scopeDepth)return n.scopeDepth-e.scopeDepth;let r=0,s=0;for(;e.parentScopes[r]===">"&&r++,n.parentScopes[s]===">"&&s++,!(r>=e.parentScopes.length||s>=n.parentScopes.length);){const o=n.parentScopes[s].length-e.parentScopes[r].length;if(o!==0)return o;r++,s++}return n.parentScopes.length-e.parentScopes.length}match(e){if(e!==""){let r=e.indexOf("."),s,o;if(r===-1?(s=e,o=""):(s=e.substring(0,r),o=e.substring(r+1)),this._children.hasOwnProperty(s))return this._children[s].match(o)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(Zt._cmpBySpecificity),n}insert(e,n,r,s,o,i){if(n===""){this._doInsertHere(e,r,s,o,i);return}let l=n.indexOf("."),a,c;l===-1?(a=n,c=""):(a=n.substring(0,l),c=n.substring(l+1));let u;this._children.hasOwnProperty(a)?u=this._children[a]:(u=new Zt(this._mainRule.clone(),Kt.cloneArr(this._rulesWithParentScopes)),this._children[a]=u),u.insert(e+1,c,r,s,o,i)}_doInsertHere(e,n,r,s,o){if(n===null){this._mainRule.acceptOverwrite(e,r,s,o);return}for(let i=0,l=this._rulesWithParentScopes.length;i<l;i++){let a=this._rulesWithParentScopes[i];if(Gr(a.parentScopes,n)===0){a.acceptOverwrite(e,r,s,o);return}}r===-1&&(r=this._mainRule.fontStyle),s===0&&(s=this._mainRule.foreground),o===0&&(o=this._mainRule.background),this._rulesWithParentScopes.push(new Kt(e,n,r,s,o))}},Ae=class Z{static toBinaryStr(e){return e.toString(2).padStart(32,"0")}static print(e){const n=Z.getLanguageId(e),r=Z.getTokenType(e),s=Z.getFontStyle(e),o=Z.getForeground(e),i=Z.getBackground(e);console.log({languageId:n,tokenType:r,fontStyle:s,foreground:o,background:i})}static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return(e&1024)!==0}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(e,n,r,s,o,i,l){let a=Z.getLanguageId(e),c=Z.getTokenType(e),u=Z.containsBalancedBrackets(e)?1:0,f=Z.getFontStyle(e),h=Z.getForeground(e),p=Z.getBackground(e);return n!==0&&(a=n),r!==8&&(c=r),s!==null&&(u=s?1:0),o!==-1&&(f=o),i!==0&&(h=i),l!==0&&(p=l),(a<<0|c<<8|u<<10|f<<11|h<<15|p<<24)>>>0}};function lt(t,e){const n=[],r=ao(t);let s=r.next();for(;s!==null;){let a=0;if(s.length===2&&s.charAt(1)===":"){switch(s.charAt(0)){case"R":a=1;break;case"L":a=-1;break;default:console.log(`Unknown priority ${s} in scope selector`)}s=r.next()}let c=i();if(n.push({matcher:c,priority:a}),s!==",")break;s=r.next()}return n;function o(){if(s==="-"){s=r.next();const a=o();return c=>!!a&&!a(c)}if(s==="("){s=r.next();const a=l();return s===")"&&(s=r.next()),a}if(Dn(s)){const a=[];do a.push(s),s=r.next();while(Dn(s));return c=>e(a,c)}return null}function i(){const a=[];let c=o();for(;c;)a.push(c),c=o();return u=>a.every(f=>f(u))}function l(){const a=[];let c=i();for(;c&&(a.push(c),s==="|"||s===",");){do s=r.next();while(s==="|"||s===",");c=i()}return u=>a.some(f=>f(u))}}function Dn(t){return!!t&&!!t.match(/[\w\.:]+/)}function ao(t){let e=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=e.exec(t);return{next:()=>{if(!n)return null;const r=n[0];return n=e.exec(t),r}}}function Wr(t){typeof t.dispose=="function"&&t.dispose()}var Ge=class{constructor(t){this.scopeName=t}toKey(){return this.scopeName}},lo=class{constructor(t,e){this.scopeName=t,this.ruleName=e}toKey(){return`${this.scopeName}#${this.ruleName}`}},co=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(t){const e=t.toKey();this._seenReferenceKeys.has(e)||(this._seenReferenceKeys.add(e),this._references.push(t))}},uo=class{constructor(t,e){this.repo=t,this.initialScopeName=e,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Ge(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){const t=this.Q;this.Q=[];const e=new co;for(const n of t)fo(n,this.initialScopeName,this.repo,e);for(const n of e.references)if(n instanceof Ge){if(this.seenFullScopeRequests.has(n.scopeName))continue;this.seenFullScopeRequests.add(n.scopeName),this.Q.push(n)}else{if(this.seenFullScopeRequests.has(n.scopeName)||this.seenPartialScopeRequests.has(n.toKey()))continue;this.seenPartialScopeRequests.add(n.toKey()),this.Q.push(n)}}};function fo(t,e,n,r){const s=n.lookup(t.scopeName);if(!s){if(t.scopeName===e)throw new Error(`No grammar provided for <${e}>`);return}const o=n.lookup(e);t instanceof Ge?st({baseGrammar:o,selfGrammar:s},r):Qt(t.ruleName,{baseGrammar:o,selfGrammar:s,repository:s.repository},r);const i=n.injections(t.scopeName);if(i)for(const l of i)r.add(new Ge(l))}function Qt(t,e,n){if(e.repository&&e.repository[t]){const r=e.repository[t];ct([r],e,n)}}function st(t,e){t.selfGrammar.patterns&&Array.isArray(t.selfGrammar.patterns)&&ct(t.selfGrammar.patterns,{...t,repository:t.selfGrammar.repository},e),t.selfGrammar.injections&&ct(Object.values(t.selfGrammar.injections),{...t,repository:t.selfGrammar.repository},e)}function ct(t,e,n){for(const r of t){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);const s=r.repository?Or({},e.repository,r.repository):e.repository;Array.isArray(r.patterns)&&ct(r.patterns,{...e,repository:s},n);const o=r.include;if(!o)continue;const i=Hr(o);switch(i.kind){case 0:st({...e,selfGrammar:e.baseGrammar},n);break;case 1:st(e,n);break;case 2:Qt(i.ruleName,{...e,repository:s},n);break;case 3:case 4:const l=i.scopeName===e.selfGrammar.scopeName?e.selfGrammar:i.scopeName===e.baseGrammar.scopeName?e.baseGrammar:void 0;if(l){const a={baseGrammar:e.baseGrammar,selfGrammar:l,repository:s};i.kind===4?Qt(i.ruleName,a,n):st(a,n)}else i.kind===4?n.add(new lo(i.scopeName,i.ruleName)):n.add(new Ge(i.scopeName));break}}}var ho=class{kind=0},po=class{kind=1},go=class{constructor(t){this.ruleName=t}kind=2},mo=class{constructor(t){this.scopeName=t}kind=3},yo=class{constructor(t,e){this.scopeName=t,this.ruleName=e}kind=4};function Hr(t){if(t==="$base")return new ho;if(t==="$self")return new po;const e=t.indexOf("#");if(e===-1)return new mo(t);if(e===0)return new go(t.substring(1));{const n=t.substring(0,e),r=t.substring(e+1);return new yo(n,r)}}var bo=/\\(\d+)/,Bn=/\\(\d+)/g,wo=-1,Vr=-2;var We=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(t,e,n,r){this.$location=t,this.id=e,this._name=n||null,this._nameIsCapturing=qe.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=qe.hasCaptures(this._contentName)}get debugName(){const t=this.$location?`${Dr(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?this._name:qe.replaceCaptures(this._name,t,e)}getContentName(t,e){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:qe.replaceCaptures(this._contentName,t,e)}},Co=class extends We{retokenizeCapturedWithRuleId;constructor(t,e,n,r,s){super(t,e,n,r),this.retokenizeCapturedWithRuleId=s}dispose(){}collectPatterns(t,e){throw new Error("Not supported!")}compile(t,e){throw new Error("Not supported!")}compileAG(t,e,n,r){throw new Error("Not supported!")}},_o=class extends We{_match;captures;_cachedCompiledPatterns;constructor(t,e,n,r,s){super(t,e,n,null),this._match=new Fe(r,this.id),this.captures=s,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(t,e){e.push(this._match)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t).compileAG(t,n,r)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Ue,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Gn=class extends We{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(t,e,n,r,s){super(t,e,n,r),this.patterns=s.patterns,this.hasMissingPatterns=s.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(t,e){for(const n of this.patterns)t.getRule(n).collectPatterns(t,e)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t).compileAG(t,n,r)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Ue,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Yt=class extends We{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(t,e,n,r,s,o,i,l,a,c){super(t,e,n,r),this._begin=new Fe(s,this.id),this.beginCaptures=o,this._end=new Fe(i||"￿",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=l,this.applyEndPatternLast=a||!1,this.patterns=c.patterns,this.hasMissingPatterns=c.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(t,e){return this._end.resolveBackReferences(t,e)}collectPatterns(t,e){e.push(this._begin)}compile(t,e){return this._getCachedCompiledPatterns(t,e).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t,e).compileAG(t,n,r)}_getCachedCompiledPatterns(t,e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Ue;for(const n of this.patterns)t.getRule(n).collectPatterns(t,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,e):this._cachedCompiledPatterns.setSource(0,e)),this._cachedCompiledPatterns}},ut=class extends We{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(t,e,n,r,s,o,i,l,a){super(t,e,n,r),this._begin=new Fe(s,this.id),this.beginCaptures=o,this.whileCaptures=l,this._while=new Fe(i,Vr),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=a.patterns,this.hasMissingPatterns=a.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(t,e){return this._while.resolveBackReferences(t,e)}collectPatterns(t,e){e.push(this._begin)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t).compileAG(t,n,r)}_getCachedCompiledPatterns(t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Ue;for(const e of this.patterns)t.getRule(e).collectPatterns(t,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(t,e){return this._getCachedCompiledWhilePatterns(t,e).compile(t)}compileWhileAG(t,e,n,r){return this._getCachedCompiledWhilePatterns(t,e).compileAG(t,n,r)}_getCachedCompiledWhilePatterns(t,e){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new Ue,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,e||"￿"),this._cachedCompiledWhilePatterns}},qr=class z{static createCaptureRule(e,n,r,s,o){return e.registerRule(i=>new Co(n,i,r,s,o))}static getCompiledRuleId(e,n,r){return e.id||n.registerRule(s=>{if(e.id=s,e.match)return new _o(e.$vscodeTextmateLocation,e.id,e.name,e.match,z._compileCaptures(e.captures,n,r));if(typeof e.begin>"u"){e.repository&&(r=Or({},r,e.repository));let o=e.patterns;return typeof o>"u"&&e.include&&(o=[{include:e.include}]),new Gn(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,z._compilePatterns(o,n,r))}return e.while?new ut(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,z._compileCaptures(e.beginCaptures||e.captures,n,r),e.while,z._compileCaptures(e.whileCaptures||e.captures,n,r),z._compilePatterns(e.patterns,n,r)):new Yt(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,z._compileCaptures(e.beginCaptures||e.captures,n,r),e.end,z._compileCaptures(e.endCaptures||e.captures,n,r),e.applyEndPatternLast,z._compilePatterns(e.patterns,n,r))}),e.id}static _compileCaptures(e,n,r){let s=[];if(e){let o=0;for(const i in e){if(i==="$vscodeTextmateLocation")continue;const l=parseInt(i,10);l>o&&(o=l)}for(let i=0;i<=o;i++)s[i]=null;for(const i in e){if(i==="$vscodeTextmateLocation")continue;const l=parseInt(i,10);let a=0;e[i].patterns&&(a=z.getCompiledRuleId(e[i],n,r)),s[l]=z.createCaptureRule(n,e[i].$vscodeTextmateLocation,e[i].name,e[i].contentName,a)}}return s}static _compilePatterns(e,n,r){let s=[];if(e)for(let o=0,i=e.length;o<i;o++){const l=e[o];let a=-1;if(l.include){const c=Hr(l.include);switch(c.kind){case 0:case 1:a=z.getCompiledRuleId(r[l.include],n,r);break;case 2:let u=r[c.ruleName];u&&(a=z.getCompiledRuleId(u,n,r));break;case 3:case 4:const f=c.scopeName,h=c.kind===4?c.ruleName:null,p=n.getExternalGrammar(f,r);if(p)if(h){let d=p.repository[h];d&&(a=z.getCompiledRuleId(d,n,p.repository))}else a=z.getCompiledRuleId(p.repository.$self,n,p.repository);break}}else a=z.getCompiledRuleId(l,n,r);if(a!==-1){const c=n.getRule(a);let u=!1;if((c instanceof Gn||c instanceof Yt||c instanceof ut)&&c.hasMissingPatterns&&c.patterns.length===0&&(u=!0),u)continue;s.push(a)}}return{patterns:s,hasMissingPatterns:(e?e.length:0)!==s.length}}},Fe=class Xr{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,n){if(e&&typeof e=="string"){const r=e.length;let s=0,o=[],i=!1;for(let l=0;l<r;l++)if(e.charAt(l)==="\\"&&l+1<r){const c=e.charAt(l+1);c==="z"?(o.push(e.substring(s,l)),o.push("$(?!\\n)(?<!\\n)"),s=l+2):(c==="A"||c==="G")&&(i=!0),l++}this.hasAnchor=i,s===0?this.source=e:(o.push(e.substring(s,r)),this.source=o.join(""))}else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=n,typeof this.source=="string"?this.hasBackReferences=bo.test(this.source):this.hasBackReferences=!1}clone(){return new Xr(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,n){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let r=n.map(s=>e.substring(s.start,s.end));return Bn.lastIndex=0,this.source.replace(Bn,(s,o)=>Fr(r[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=[],n=[],r=[],s=[],o,i,l,a;for(o=0,i=this.source.length;o<i;o++)l=this.source.charAt(o),e[o]=l,n[o]=l,r[o]=l,s[o]=l,l==="\\"&&o+1<i&&(a=this.source.charAt(o+1),a==="A"?(e[o+1]="￿",n[o+1]="￿",r[o+1]="A",s[o+1]="A"):a==="G"?(e[o+1]="￿",n[o+1]="G",r[o+1]="￿",s[o+1]="G"):(e[o+1]=a,n[o+1]=a,r[o+1]=a,s[o+1]=a),o++);return{A0_G0:e.join(""),A0_G1:n.join(""),A1_G0:r.join(""),A1_G1:s.join("")}}resolveAnchors(e,n){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:e?n?this._anchorCache.A1_G1:this._anchorCache.A1_G0:n?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},Ue=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){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(n=>n.source);this._cached=new Fn(t,e,this._items.map(n=>n.ruleId))}return this._cached}compileAG(t,e,n){return this._hasAnchors?e?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(t,e,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(t,e,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(t,e,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(t,e,n)),this._anchorCache.A0_G0):this.compile(t)}_resolveAnchors(t,e,n){let r=this._items.map(s=>s.resolveAnchors(e,n));return new Fn(t,r,this._items.map(s=>s.ruleId))}},Fn=class{constructor(t,e,n){this.regExps=e,this.rules=n,this.scanner=t.createOnigScanner(e)}scanner;dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const t=[];for(let e=0,n=this.rules.length;e<n;e++)t.push(" - "+this.rules[e]+": "+this.regExps[e]);return t.join(`
2
- `)}findNextMatchSync(t,e,n){const r=this.scanner.findNextMatchSync(t,e,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},Lt=class{constructor(t,e){this.languageId=t,this.tokenType=e}},So=class Jt{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,n){this._defaultAttributes=new Lt(e,8),this._embeddedLanguagesMatcher=new ko(Object.entries(n||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(e){return e===null?Jt._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(e)}static _NULL_SCOPE_METADATA=new Lt(0,0);_getBasicScopeAttributes=new Ur(e=>{const n=this._scopeToLanguage(e),r=this._toStandardTokenType(e);return new Lt(n,r)});_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(e){const n=e.match(Jt.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[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!")}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},ko=class{values;scopesRegExp;constructor(t){if(t.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(t);const e=t.map(([n,r])=>Fr(n));e.sort(),e.reverse(),this.scopesRegExp=new RegExp(`^((${e.join(")|(")}))($|\\.)`,"")}}match(t){if(!this.scopesRegExp)return;const e=t.match(this.scopesRegExp);if(e)return this.values.get(e[1])}},Un=class{constructor(t,e){this.stack=t,this.stoppedEarly=e}};function Kr(t,e,n,r,s,o,i,l){const a=e.content.length;let c=!1,u=-1;if(i){const p=vo(t,e,n,r,s,o);s=p.stack,r=p.linePos,n=p.isFirstLine,u=p.anchorPosition}const f=Date.now();for(;!c;){if(l!==0&&Date.now()-f>l)return new Un(s,!0);h()}return new Un(s,!1);function h(){const p=xo(t,e,n,r,s,u);if(!p){o.produce(s,a),c=!0;return}const d=p.captureIndices,b=p.matchedRuleId,w=d&&d.length>0?d[0].end>r:!1;if(b===wo){const g=s.getRule(t);o.produce(s,d[0].start),s=s.withContentNameScopesList(s.nameScopesList),Oe(t,e,n,s,o,g.endCaptures,d),o.produce(s,d[0].end);const y=s;if(s=s.parent,u=y.getAnchorPos(),!w&&y.getEnterPos()===r){s=y,o.produce(s,a),c=!0;return}}else{const g=t.getRule(b);o.produce(s,d[0].start);const y=s,m=g.getName(e.content,d),_=s.contentNameScopesList.pushAttributed(m,t);if(s=s.push(b,r,u,d[0].end===a,null,_,_),g instanceof Yt){const S=g;Oe(t,e,n,s,o,S.beginCaptures,d),o.produce(s,d[0].end),u=d[0].end;const k=S.getContentName(e.content,d),v=_.pushAttributed(k,t);if(s=s.withContentNameScopesList(v),S.endHasBackReferences&&(s=s.withEndRule(S.getEndWithResolvedBackReferences(e.content,d))),!w&&y.hasSameRuleAs(s)){s=s.pop(),o.produce(s,a),c=!0;return}}else if(g instanceof ut){const S=g;Oe(t,e,n,s,o,S.beginCaptures,d),o.produce(s,d[0].end),u=d[0].end;const k=S.getContentName(e.content,d),v=_.pushAttributed(k,t);if(s=s.withContentNameScopesList(v),S.whileHasBackReferences&&(s=s.withEndRule(S.getWhileWithResolvedBackReferences(e.content,d))),!w&&y.hasSameRuleAs(s)){s=s.pop(),o.produce(s,a),c=!0;return}}else if(Oe(t,e,n,s,o,g.captures,d),o.produce(s,d[0].end),s=s.pop(),!w){s=s.safePop(),o.produce(s,a),c=!0;return}}d[0].end>r&&(r=d[0].end,n=!1)}}function vo(t,e,n,r,s,o){let i=s.beginRuleCapturedEOL?0:-1;const l=[];for(let a=s;a;a=a.pop()){const c=a.getRule(t);c instanceof ut&&l.push({rule:c,stack:a})}for(let a=l.pop();a;a=l.pop()){const{ruleScanner:c,findOptions:u}=Ao(a.rule,t,a.stack.endRule,n,r===i),f=c.findNextMatchSync(e,r,u);if(f){if(f.ruleId!==Vr){s=a.stack.pop();break}f.captureIndices&&f.captureIndices.length&&(o.produce(a.stack,f.captureIndices[0].start),Oe(t,e,n,a.stack,o,a.rule.whileCaptures,f.captureIndices),o.produce(a.stack,f.captureIndices[0].end),i=f.captureIndices[0].end,f.captureIndices[0].end>r&&(r=f.captureIndices[0].end,n=!1))}else{s=a.stack.pop();break}}return{stack:s,linePos:r,anchorPosition:i,isFirstLine:n}}function xo(t,e,n,r,s,o){const i=Eo(t,e,n,r,s,o),l=t.getInjections();if(l.length===0)return i;const a=Io(l,t,e,n,r,s,o);if(!a)return i;if(!i)return a;const c=i.captureIndices[0].start,u=a.captureIndices[0].start;return u<c||a.priorityMatch&&u===c?a:i}function Eo(t,e,n,r,s,o){const i=s.getRule(t),{ruleScanner:l,findOptions:a}=Zr(i,t,s.endRule,n,r===o),c=l.findNextMatchSync(e,r,a);return c?{captureIndices:c.captureIndices,matchedRuleId:c.ruleId}:null}function Io(t,e,n,r,s,o,i){let l=Number.MAX_VALUE,a=null,c,u=0;const f=o.contentNameScopesList.getScopeNames();for(let h=0,p=t.length;h<p;h++){const d=t[h];if(!d.matcher(f))continue;const b=e.getRule(d.ruleId),{ruleScanner:w,findOptions:g}=Zr(b,e,null,r,s===i),y=w.findNextMatchSync(n,s,g);if(!y)continue;const m=y.captureIndices[0].start;if(!(m>=l)&&(l=m,a=y.captureIndices,c=y.ruleId,u=d.priority,l===s))break}return a?{priorityMatch:u===-1,captureIndices:a,matchedRuleId:c}:null}function Zr(t,e,n,r,s){return{ruleScanner:t.compileAG(e,n,r,s),findOptions:0}}function Ao(t,e,n,r,s){return{ruleScanner:t.compileWhileAG(e,n,r,s),findOptions:0}}function Oe(t,e,n,r,s,o,i){if(o.length===0)return;const l=e.content,a=Math.min(o.length,i.length),c=[],u=i[0].end;for(let f=0;f<a;f++){const h=o[f];if(h===null)continue;const p=i[f];if(p.length===0)continue;if(p.start>u)break;for(;c.length>0&&c[c.length-1].endPos<=p.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,p.start):s.produce(r,p.start),h.retokenizeCapturedWithRuleId){const b=h.getName(l,i),w=r.contentNameScopesList.pushAttributed(b,t),g=h.getContentName(l,i),y=w.pushAttributed(g,t),m=r.push(h.retokenizeCapturedWithRuleId,p.start,-1,!1,null,w,y),_=t.createOnigString(l.substring(0,p.end));Kr(t,_,n&&p.start===0,p.start,m,s,!1,0),Wr(_);continue}const d=h.getName(l,i);if(d!==null){const w=(c.length>0?c[c.length-1].scopes:r.contentNameScopesList).pushAttributed(d,t);c.push(new Ro(w,p.end))}}for(;c.length>0;)s.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop()}var Ro=class{scopes;endPos;constructor(t,e){this.scopes=t,this.endPos=e}};function Lo(t,e,n,r,s,o,i,l){return new To(t,e,n,r,s,o,i,l)}function jn(t,e,n,r,s){const o=lt(e,ft),i=qr.getCompiledRuleId(n,r,s.repository);for(const l of o)t.push({debugSelector:e,matcher:l.matcher,ruleId:i,grammar:s,priority:l.priority})}function ft(t,e){if(e.length<t.length)return!1;let n=0;return t.every(r=>{for(let s=n;s<e.length;s++)if(No(e[s],r))return n=s+1,!0;return!1})}function No(t,e){if(!t)return!1;if(t===e)return!0;const n=e.length;return t.length>n&&t.substr(0,n)===e&&t[n]==="."}var To=class{constructor(t,e,n,r,s,o,i,l){if(this._rootScopeName=t,this.balancedBracketSelectors=o,this._onigLib=l,this._basicScopeAttributesProvider=new So(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=i,this._grammar=zn(e,null),this._injections=null,this._tokenTypeMatchers=[],s)for(const a of Object.keys(s)){const c=lt(a,ft);for(const u of c)this._tokenTypeMatchers.push({matcher:u.matcher,type:s[a]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;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={lookup:s=>s===this._rootScopeName?this._grammar:this.getExternalGrammar(s),injections:s=>this._grammarRepository.injections(s)},e=[],n=this._rootScopeName,r=t.lookup(n);if(r){const s=r.injections;if(s)for(let i in s)jn(e,i,s[i],this,r);const o=this._grammarRepository.injections(n);o&&o.forEach(i=>{const l=this.getExternalGrammar(i);if(l){const a=l.injectionSelector;a&&jn(e,a,l,this,l)}})}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,n=t(e);return this._ruleId2desc[e]=n,n}getRule(t){return this._ruleId2desc[t]}getExternalGrammar(t,e){if(this._includedGrammars[t])return this._includedGrammars[t];if(this._grammarRepository){const n=this._grammarRepository.lookup(t);if(n)return this._includedGrammars[t]=zn(n,e&&e.$base),this._includedGrammars[t]}}tokenizeLine(t,e,n=0){const r=this._tokenize(t,e,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(t,e,n=0){const r=this._tokenize(t,e,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(t,e,n,r){this._rootId===-1&&(this._rootId=qr.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let s;if(!e||e===en.NULL){s=!0;const c=this._basicScopeAttributesProvider.getDefaultAttributes(),u=this.themeProvider.getDefaults(),f=Ae.set(0,c.languageId,c.tokenType,null,u.fontStyle,u.foregroundId,u.backgroundId),h=this.getRule(this._rootId).getName(null,null);let p;h?p=De.createRootAndLookUpScopeName(h,f,this):p=De.createRoot("unknown",f),e=new en(null,this._rootId,-1,-1,!1,null,p,p)}else s=!1,e.reset();t=t+`
3
- `;const o=this.createOnigString(t),i=o.content.length,l=new $o(n,t,this._tokenTypeMatchers,this.balancedBracketSelectors),a=Kr(this,o,s,0,e,l,!0,r);return Wr(o),{lineLength:i,lineTokens:l,ruleStack:a.stack,stoppedEarly:a.stoppedEarly}}};function zn(t,e){return t=Zs(t),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 De=class ne{constructor(e,n,r){this.parent=e,this.scopePath=n,this.tokenAttributes=r}static fromExtension(e,n){let r=e,s=e?.scopePath??null;for(const o of n)s=Rt.push(s,o.scopeNames),r=new ne(r,s,o.encodedTokenAttributes);return r}static createRoot(e,n){return new ne(null,new Rt(null,e),n)}static createRootAndLookUpScopeName(e,n,r){const s=r.getMetadataForScope(e),o=new Rt(null,e),i=r.themeProvider.themeMatch(o),l=ne.mergeAttributes(n,s,i);return new ne(null,o,l)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(e){return ne.equals(this,e)}static equals(e,n){do{if(e===n||!e&&!n)return!0;if(!e||!n||e.scopeName!==n.scopeName||e.tokenAttributes!==n.tokenAttributes)return!1;e=e.parent,n=n.parent}while(!0)}static mergeAttributes(e,n,r){let s=-1,o=0,i=0;return r!==null&&(s=r.fontStyle,o=r.foregroundId,i=r.backgroundId),Ae.set(e,n.languageId,n.tokenType,null,s,o,i)}pushAttributed(e,n){if(e===null)return this;if(e.indexOf(" ")===-1)return ne._pushAttributed(this,e,n);const r=e.split(/ /g);let s=this;for(const o of r)s=ne._pushAttributed(s,o,n);return s}static _pushAttributed(e,n,r){const s=r.getMetadataForScope(n),o=e.scopePath.push(n),i=r.themeProvider.themeMatch(o),l=ne.mergeAttributes(e.tokenAttributes,s,i);return new ne(e,o,l)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){const n=[];let r=this;for(;r&&r!==e;)n.push({encodedTokenAttributes:r.tokenAttributes,scopeNames:r.scopePath.getExtensionIfDefined(r.parent?.scopePath??null)}),r=r.parent;return r===e?n.reverse():void 0}},en=class pe{constructor(e,n,r,s,o,i,l,a){this.parent=e,this.ruleId=n,this.beginRuleCapturedEOL=o,this.endRule=i,this.nameScopesList=l,this.contentNameScopesList=a,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=r,this._anchorPos=s}_stackElementBrand=void 0;static NULL=new pe(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(e){return e===null?!1:pe._equals(this,e)}static _equals(e,n){return e===n?!0:this._structuralEquals(e,n)?De.equals(e.contentNameScopesList,n.contentNameScopesList):!1}static _structuralEquals(e,n){do{if(e===n||!e&&!n)return!0;if(!e||!n||e.depth!==n.depth||e.ruleId!==n.ruleId||e.endRule!==n.endRule)return!1;e=e.parent,n=n.parent}while(!0)}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){pe._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(e,n,r,s,o,i,l){return new pe(this,e,n,r,s,o,i,l)}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,n){return this.parent&&(n=this.parent._writeString(e,n)),e[n++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,n}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 pe(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,e,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let n=this;for(;n&&n._enterPos===e._enterPos;){if(n.ruleId===e.ruleId)return!0;n=n.parent}return!1}toStateStackFrame(){return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(e,n){const r=De.fromExtension(e?.nameScopesList??null,n.nameScopesList);return new pe(e,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,De.fromExtension(r,n.contentNameScopesList))}},Po=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(t,e){this.balancedBracketScopes=t.flatMap(n=>n==="*"?(this.allowAny=!0,[]):lt(n,ft).map(r=>r.matcher)),this.unbalancedBracketScopes=e.flatMap(n=>lt(n,ft).map(r=>r.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}},$o=class{constructor(t,e,n,r){this.balancedBracketSelectors=r,this._emitBinaryTokens=t,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(t,e){this.produceFromScopes(t.contentNameScopesList,e)}produceFromScopes(t,e){if(this._lastTokenEndIndex>=e)return;if(this._emitBinaryTokens){let r=t?.tokenAttributes??0,s=!1;if(this.balancedBracketSelectors?.matchesAlways&&(s=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const o=t?.getScopeNames()??[];for(const i of this._tokenTypeOverrides)i.matcher(o)&&(r=Ae.set(r,0,i.type,null,-1,0,0));this.balancedBracketSelectors&&(s=this.balancedBracketSelectors.match(o))}if(s&&(r=Ae.set(r,0,8,s,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===r){this._lastTokenEndIndex=e;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(r),this._lastTokenEndIndex=e;return}const n=t?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:e,scopes:n}),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 n=new Uint32Array(this._binaryTokens.length);for(let r=0,s=this._binaryTokens.length;r<s;r++)n[r]=this._binaryTokens[r];return n}},Mo=class{constructor(t,e){this._onigLib=e,this._theme=t}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;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,n,r,s){if(!this._grammars.has(t)){let o=this._rawGrammars.get(t);if(!o)return null;this._grammars.set(t,Lo(t,o,e,n,r,s,this,this._onigLib))}return this._grammars.get(t)}},Oo=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new Mo(at.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,n){this._syncRegistry.setTheme(at.createFromRawTheme(e,n))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,n,r){return this.loadGrammarWithConfiguration(e,n,{embeddedLanguages:r})}loadGrammarWithConfiguration(e,n,r){return this._loadGrammar(e,n,r.embeddedLanguages,r.tokenTypes,new Po(r.balancedBracketSelectors||[],r.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,n,r,s,o){const i=new uo(this._syncRegistry,e);for(;i.Q.length>0;)i.Q.map(l=>this._loadSingleGrammar(l.scopeName)),i.processQueue();return this._grammarForScopeName(e,n,r,s,o)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){const n=this._options.loadGrammar(e);if(n){const r=typeof this._options.getInjections=="function"?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(n,r)}}addGrammar(e,n=[],r=0,s=null){return this._syncRegistry.addGrammar(e,n),this._grammarForScopeName(e.scopeName,r,s)}_grammarForScopeName(e,n=0,r=null,s=null,o=null){return this._syncRegistry.grammarForScopeName(e,n,r,s,o)}},tn=en.NULL;const Do=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];class He{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}He.prototype.normal={};He.prototype.property={};He.prototype.space=void 0;function Qr(t,e){const n={},r={};for(const s of t)Object.assign(n,s.property),Object.assign(r,s.normal);return new He(n,r,e)}function nn(t){return t.toLowerCase()}class q{constructor(e,n){this.attribute=n,this.property=e}}q.prototype.attribute="";q.prototype.booleanish=!1;q.prototype.boolean=!1;q.prototype.commaOrSpaceSeparated=!1;q.prototype.commaSeparated=!1;q.prototype.defined=!1;q.prototype.mustUseProperty=!1;q.prototype.number=!1;q.prototype.overloadedBoolean=!1;q.prototype.property="";q.prototype.spaceSeparated=!1;q.prototype.space=void 0;let Bo=0;const I=Ce(),M=Ce(),rn=Ce(),C=Ce(),N=Ce(),Ee=Ce(),X=Ce();function Ce(){return 2**++Bo}var sn=Object.freeze({__proto__:null,boolean:I,booleanish:M,commaOrSpaceSeparated:X,commaSeparated:Ee,number:C,overloadedBoolean:rn,spaceSeparated:N});const Nt=Object.keys(sn);class wn extends q{constructor(e,n,r,s){let o=-1;if(super(e,n),Wn(this,"space",s),typeof r=="number")for(;++o<Nt.length;){const i=Nt[o];Wn(this,Nt[o],(r&sn[i])===sn[i])}}}wn.prototype.defined=!0;function Wn(t,e,n){n&&(t[e]=n)}function Re(t){const e={},n={};for(const[r,s]of Object.entries(t.properties)){const o=new wn(r,t.transform(t.attributes||{},r),s,t.space);t.mustUseProperty&&t.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),e[r]=o,n[nn(r)]=r,n[nn(o.attribute)]=r}return new He(e,n,t.space)}const Yr=Re({properties:{ariaActiveDescendant:null,ariaAtomic:M,ariaAutoComplete:null,ariaBusy:M,ariaChecked:M,ariaColCount:C,ariaColIndex:C,ariaColSpan:C,ariaControls:N,ariaCurrent:null,ariaDescribedBy:N,ariaDetails:null,ariaDisabled:M,ariaDropEffect:N,ariaErrorMessage:null,ariaExpanded:M,ariaFlowTo:N,ariaGrabbed:M,ariaHasPopup:null,ariaHidden:M,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:N,ariaLevel:C,ariaLive:null,ariaModal:M,ariaMultiLine:M,ariaMultiSelectable:M,ariaOrientation:null,ariaOwns:N,ariaPlaceholder:null,ariaPosInSet:C,ariaPressed:M,ariaReadOnly:M,ariaRelevant:null,ariaRequired:M,ariaRoleDescription:N,ariaRowCount:C,ariaRowIndex:C,ariaRowSpan:C,ariaSelected:M,ariaSetSize:C,ariaSort:null,ariaValueMax:C,ariaValueMin:C,ariaValueNow:C,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function Jr(t,e){return e in t?t[e]:e}function es(t,e){return Jr(t,e.toLowerCase())}const Go=Re({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ee,acceptCharset:N,accessKey:N,action:null,allow:null,allowFullScreen:I,allowPaymentRequest:I,allowUserMedia:I,alt:null,as:null,async:I,autoCapitalize:null,autoComplete:N,autoFocus:I,autoPlay:I,blocking:N,capture:null,charSet:null,checked:I,cite:null,className:N,cols:C,colSpan:null,content:null,contentEditable:M,controls:I,controlsList:N,coords:C|Ee,crossOrigin:null,data:null,dateTime:null,decoding:null,default:I,defer:I,dir:null,dirName:null,disabled:I,download:rn,draggable:M,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:I,formTarget:null,headers:N,height:C,hidden:rn,high:C,href:null,hrefLang:null,htmlFor:N,httpEquiv:N,id:null,imageSizes:null,imageSrcSet:null,inert:I,inputMode:null,integrity:null,is:null,isMap:I,itemId:null,itemProp:N,itemRef:N,itemScope:I,itemType:N,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:I,low:C,manifest:null,max:null,maxLength:C,media:null,method:null,min:null,minLength:C,multiple:I,muted:I,name:null,nonce:null,noModule:I,noValidate:I,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:I,optimum:C,pattern:null,ping:N,placeholder:null,playsInline:I,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:I,referrerPolicy:null,rel:N,required:I,reversed:I,rows:C,rowSpan:C,sandbox:N,scope:null,scoped:I,seamless:I,selected:I,shadowRootClonable:I,shadowRootDelegatesFocus:I,shadowRootMode:null,shape:null,size:C,sizes:null,slot:null,span:C,spellCheck:M,src:null,srcDoc:null,srcLang:null,srcSet:null,start:C,step:null,style:null,tabIndex:C,target:null,title:null,translate:null,type:null,typeMustMatch:I,useMap:null,value:M,width:C,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:N,axis:null,background:null,bgColor:null,border:C,borderColor:null,bottomMargin:C,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:I,declare:I,event:null,face:null,frame:null,frameBorder:null,hSpace:C,leftMargin:C,link:null,longDesc:null,lowSrc:null,marginHeight:C,marginWidth:C,noResize:I,noHref:I,noShade:I,noWrap:I,object:null,profile:null,prompt:null,rev:null,rightMargin:C,rules:null,scheme:null,scrolling:M,standby:null,summary:null,text:null,topMargin:C,valueType:null,version:null,vAlign:null,vLink:null,vSpace:C,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:I,disableRemotePlayback:I,prefix:null,property:null,results:C,security:null,unselectable:null},space:"html",transform:es}),Fo=Re({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:X,accentHeight:C,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:C,amplitude:C,arabicForm:null,ascent:C,attributeName:null,attributeType:null,azimuth:C,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:C,by:null,calcMode:null,capHeight:C,className:N,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:C,diffuseConstant:C,direction:null,display:null,dur:null,divisor:C,dominantBaseline:null,download:I,dx:null,dy:null,edgeMode:null,editable:null,elevation:C,enableBackground:null,end:null,event:null,exponent:C,externalResourcesRequired:null,fill:null,fillOpacity:C,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Ee,g2:Ee,glyphName:Ee,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:C,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:C,horizOriginX:C,horizOriginY:C,id:null,ideographic:C,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:C,k:C,k1:C,k2:C,k3:C,k4:C,kernelMatrix:X,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:C,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:C,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:C,overlineThickness:C,paintOrder:null,panose1:null,path:null,pathLength:C,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:N,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:C,pointsAtY:C,pointsAtZ:C,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:X,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:X,rev:X,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:X,requiredFeatures:X,requiredFonts:X,requiredFormats:X,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:C,specularExponent:C,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:C,strikethroughThickness:C,string:null,stroke:null,strokeDashArray:X,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:C,strokeOpacity:C,strokeWidth:null,style:null,surfaceScale:C,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:X,tabIndex:C,tableValues:null,target:null,targetX:C,targetY:C,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:X,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:C,underlineThickness:C,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:C,values:null,vAlphabetic:C,vMathematical:C,vectorEffect:null,vHanging:C,vIdeographic:C,version:null,vertAdvY:C,vertOriginX:C,vertOriginY:C,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:C,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Jr}),ts=Re({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,e){return"xlink:"+e.slice(5).toLowerCase()}}),ns=Re({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:es}),rs=Re({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),Uo=/[A-Z]/g,Hn=/-[a-z]/g,jo=/^data[-\w.:]+$/i;function zo(t,e){const n=nn(e);let r=e,s=q;if(n in t.normal)return t.property[t.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&jo.test(e)){if(e.charAt(4)==="-"){const o=e.slice(5).replace(Hn,Ho);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=e.slice(4);if(!Hn.test(o)){let i=o.replace(Uo,Wo);i.charAt(0)!=="-"&&(i="-"+i),e="data"+i}}s=wn}return new s(r,e)}function Wo(t){return"-"+t.toLowerCase()}function Ho(t){return t.charAt(1).toUpperCase()}const Vo=Qr([Yr,Go,ts,ns,rs],"html"),ss=Qr([Yr,Fo,ts,ns,rs],"svg"),Vn={}.hasOwnProperty;function qo(t,e){const n=e||{};function r(s,...o){let i=r.invalid;const l=r.handlers;if(s&&Vn.call(s,t)){const a=String(s[t]);i=Vn.call(l,a)?l[a]:r.unknown}if(i)return i.call(this,s,...o)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}const Xo=/["&'<>`]/g,Ko=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Zo=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,Qo=/[|\\{}()[\]^$+*?.]/g,qn=new WeakMap;function Yo(t,e){if(t=t.replace(e.subset?Jo(e.subset):Xo,r),e.subset||e.escapeOnly)return t;return t.replace(Ko,n).replace(Zo,r);function n(s,o,i){return e.format((s.charCodeAt(0)-55296)*1024+s.charCodeAt(1)-56320+65536,i.charCodeAt(o+2),e)}function r(s,o,i){return e.format(s.charCodeAt(0),i.charCodeAt(o+1),e)}}function Jo(t){let e=qn.get(t);return e||(e=ei(t),qn.set(t,e)),e}function ei(t){const e=[];let n=-1;for(;++n<t.length;)e.push(t[n].replace(Qo,"\\$&"));return new RegExp("(?:"+e.join("|")+")","g")}const ti=/[\dA-Fa-f]/;function ni(t,e,n){const r="&#x"+t.toString(16).toUpperCase();return n&&e&&!ti.test(String.fromCharCode(e))?r:r+";"}const ri=/\d/;function si(t,e,n){const r="&#"+String(t);return n&&e&&!ri.test(String.fromCharCode(e))?r:r+";"}const oi=["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"],Tt={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",bull:"•",hellip:"…",prime:"′",Prime:"″",oline:"‾",frasl:"⁄",weierp:"℘",image:"ℑ",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"},ii=["cent","copy","divide","gt","lt","not","para","times"],os={}.hasOwnProperty,on={};let Xe;for(Xe in Tt)os.call(Tt,Xe)&&(on[Tt[Xe]]=Xe);const ai=/[^\dA-Za-z]/;function li(t,e,n,r){const s=String.fromCharCode(t);if(os.call(on,s)){const o=on[s],i="&"+o;return n&&oi.includes(o)&&!ii.includes(o)&&(!r||e&&e!==61&&ai.test(String.fromCharCode(e)))?i:i+";"}return""}function ci(t,e,n){let r=ni(t,e,n.omitOptionalSemicolons),s;if((n.useNamedReferences||n.useShortestReferences)&&(s=li(t,e,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!s)&&n.useShortestReferences){const o=si(t,e,n.omitOptionalSemicolons);o.length<r.length&&(r=o)}return s&&(!n.useShortestReferences||s.length<r.length)?s:r}function Ie(t,e){return Yo(t,Object.assign({format:ci},e))}const ui=/^>|^->|<!--|-->|--!>|<!-$/g,fi=[">"],hi=["<",">"];function di(t,e,n,r){return r.settings.bogusComments?"<?"+Ie(t.value,Object.assign({},r.settings.characterReferences,{subset:fi}))+">":"<!--"+t.value.replace(ui,s)+"-->";function s(o){return Ie(o,Object.assign({},r.settings.characterReferences,{subset:hi}))}}function pi(t,e,n,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"}function Xn(t,e){const n=String(t);if(typeof e!="string")throw new TypeError("Expected character");let r=0,s=n.indexOf(e);for(;s!==-1;)r++,s=n.indexOf(e,s+e.length);return r}function gi(t,e){const n=e||{};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}function mi(t){return t.join(" ").trim()}const yi=/[ \t\n\f\r]/g;function Cn(t){return typeof t=="object"?t.type==="text"?Kn(t.value):!1:Kn(t)}function Kn(t){return t.replace(yi,"")===""}const G=as(1),is=as(-1),bi=[];function as(t){return e;function e(n,r,s){const o=n?n.children:bi;let i=(r||0)+t,l=o[i];if(!s)for(;l&&Cn(l);)i+=t,l=o[i];return l}}const wi={}.hasOwnProperty;function ls(t){return e;function e(n,r,s){return wi.call(t,n.tagName)&&t[n.tagName](n,r,s)}}const _n=ls({body:_i,caption:Pt,colgroup:Pt,dd:xi,dt:vi,head:Pt,html:Ci,li:ki,optgroup:Ei,option:Ii,p:Si,rp:Zn,rt:Zn,tbody:Ri,td:Qn,tfoot:Li,th:Qn,thead:Ai,tr:Ni});function Pt(t,e,n){const r=G(n,e,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&Cn(r.value.charAt(0)))}function Ci(t,e,n){const r=G(n,e);return!r||r.type!=="comment"}function _i(t,e,n){const r=G(n,e);return!r||r.type!=="comment"}function Si(t,e,n){const r=G(n,e);return r?r.type==="element"&&(r.tagName==="address"||r.tagName==="article"||r.tagName==="aside"||r.tagName==="blockquote"||r.tagName==="details"||r.tagName==="div"||r.tagName==="dl"||r.tagName==="fieldset"||r.tagName==="figcaption"||r.tagName==="figure"||r.tagName==="footer"||r.tagName==="form"||r.tagName==="h1"||r.tagName==="h2"||r.tagName==="h3"||r.tagName==="h4"||r.tagName==="h5"||r.tagName==="h6"||r.tagName==="header"||r.tagName==="hgroup"||r.tagName==="hr"||r.tagName==="main"||r.tagName==="menu"||r.tagName==="nav"||r.tagName==="ol"||r.tagName==="p"||r.tagName==="pre"||r.tagName==="section"||r.tagName==="table"||r.tagName==="ul"):!n||!(n.type==="element"&&(n.tagName==="a"||n.tagName==="audio"||n.tagName==="del"||n.tagName==="ins"||n.tagName==="map"||n.tagName==="noscript"||n.tagName==="video"))}function ki(t,e,n){const r=G(n,e);return!r||r.type==="element"&&r.tagName==="li"}function vi(t,e,n){const r=G(n,e);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function xi(t,e,n){const r=G(n,e);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function Zn(t,e,n){const r=G(n,e);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function Ei(t,e,n){const r=G(n,e);return!r||r.type==="element"&&r.tagName==="optgroup"}function Ii(t,e,n){const r=G(n,e);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function Ai(t,e,n){const r=G(n,e);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function Ri(t,e,n){const r=G(n,e);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function Li(t,e,n){return!G(n,e)}function Ni(t,e,n){const r=G(n,e);return!r||r.type==="element"&&r.tagName==="tr"}function Qn(t,e,n){const r=G(n,e);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}const Ti=ls({body:Mi,colgroup:Oi,head:$i,html:Pi,tbody:Di});function Pi(t){const e=G(t,-1);return!e||e.type!=="comment"}function $i(t){const e=new Set;for(const r of t.children)if(r.type==="element"&&(r.tagName==="base"||r.tagName==="title")){if(e.has(r.tagName))return!1;e.add(r.tagName)}const n=t.children[0];return!n||n.type==="element"}function Mi(t){const e=G(t,-1,!0);return!e||e.type!=="comment"&&!(e.type==="text"&&Cn(e.value.charAt(0)))&&!(e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template"))}function Oi(t,e,n){const r=is(n,e),s=G(t,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&_n(r,n.children.indexOf(r),n)?!1:!!(s&&s.type==="element"&&s.tagName==="col")}function Di(t,e,n){const r=is(n,e),s=G(t,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&_n(r,n.children.indexOf(r),n)?!1:!!(s&&s.type==="element"&&s.tagName==="tr")}const Ke={name:[[`
1
+ let U=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function Qs(t){return bn(t)}function bn(t){return Array.isArray(t)?Ys(t):t instanceof RegExp?t:typeof t=="object"?Js(t):t}function Ys(t){let e=[];for(let n=0,r=t.length;n<r;n++)e[n]=bn(t[n]);return e}function Js(t){let e={};for(let n in t)e[n]=bn(t[n]);return e}function Dr(t,...e){return e.forEach(n=>{for(let r in n)t[r]=n[r]}),t}function Br(t){const e=~t.lastIndexOf("/")||~t.lastIndexOf("\\");return e===0?t:~e===t.length-1?Br(t.substring(0,t.length-1)):t.substr(~e+1)}var At=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,qe=class{static hasCaptures(t){return t===null?!1:(At.lastIndex=0,At.test(t))}static replaceCaptures(t,e,n){return t.replace(At,(r,s,o,i)=>{let l=n[parseInt(s||o,10)];if(l){let a=e.substring(l.start,l.end);for(;a[0]===".";)a=a.substring(1);switch(i){case"downcase":return a.toLowerCase();case"upcase":return a.toUpperCase();default:return a}}else return r})}};function Gr(t,e){return t<e?-1:t>e?1:0}function Fr(t,e){if(t===null&&e===null)return 0;if(!t)return-1;if(!e)return 1;let n=t.length,r=e.length;if(n===r){for(let s=0;s<n;s++){let o=Gr(t[s],e[s]);if(o!==0)return o}return 0}return n-r}function On(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 Ur(t){return t.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var jr=class{constructor(t){this.fn=t}cache=new Map;get(t){if(this.cache.has(t))return this.cache.get(t);const e=this.fn(t);return this.cache.set(t,e),e}},at=class{constructor(t,e,n){this._colorMap=t,this._defaults=e,this._root=n}static createFromRawTheme(t,e){return this.createFromParsedTheme(no(t),e)}static createFromParsedTheme(t,e){return so(t,e)}_cachedMatchRoot=new jr(t=>this._root.match(t));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(s=>eo(t.parent,s.parentScopes));return r?new zr(r.fontStyle,r.foreground,r.background):null}},Rt=class rt{constructor(e,n){this.parent=e,this.scopeName=n}static push(e,n){for(const r of n)e=new rt(e,r);return e}static from(...e){let n=null;for(let r=0;r<e.length;r++)n=new rt(n,e[r]);return n}push(e){return new rt(this,e)}getSegments(){let e=this;const n=[];for(;e;)n.push(e.scopeName),e=e.parent;return n.reverse(),n}toString(){return this.getSegments().join(" ")}extends(e){return this===e?!0:this.parent===null?!1:this.parent.extends(e)}getExtensionIfDefined(e){const n=[];let r=this;for(;r&&r!==e;)n.push(r.scopeName),r=r.parent;return r===e?n.reverse():void 0}};function eo(t,e){if(e.length===0)return!0;for(let n=0;n<e.length;n++){let r=e[n],s=!1;if(r===">"){if(n===e.length-1)return!1;r=e[++n],s=!0}for(;t&&!to(t.scopeName,r);){if(s)return!1;t=t.parent}if(!t)return!1;t=t.parent}return!0}function to(t,e){return e===t||t.startsWith(e)&&t[e.length]==="."}var zr=class{constructor(t,e,n){this.fontStyle=t,this.foregroundId=e,this.backgroundId=n}};function no(t){if(!t)return[];if(!t.settings||!Array.isArray(t.settings))return[];let e=t.settings,n=[],r=0;for(let s=0,o=e.length;s<o;s++){let i=e[s];if(!i.settings)continue;let l;if(typeof i.scope=="string"){let f=i.scope;f=f.replace(/^[,]+/,""),f=f.replace(/[,]+$/,""),l=f.split(",")}else Array.isArray(i.scope)?l=i.scope:l=[""];let a=-1;if(typeof i.settings.fontStyle=="string"){a=0;let f=i.settings.fontStyle.split(" ");for(let h=0,p=f.length;h<p;h++)switch(f[h]){case"italic":a=a|1;break;case"bold":a=a|2;break;case"underline":a=a|4;break;case"strikethrough":a=a|8;break}}let c=null;typeof i.settings.foreground=="string"&&On(i.settings.foreground)&&(c=i.settings.foreground);let u=null;typeof i.settings.background=="string"&&On(i.settings.background)&&(u=i.settings.background);for(let f=0,h=l.length;f<h;f++){let d=l[f].trim().split(" "),b=d[d.length-1],w=null;d.length>1&&(w=d.slice(0,d.length-1),w.reverse()),n[r++]=new ro(b,w,s,a,c,u)}}return n}var ro=class{constructor(t,e,n,r,s,o){this.scope=t,this.parentScopes=e,this.index=n,this.fontStyle=r,this.foreground=s,this.background=o}},W=(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))(W||{});function so(t,e){t.sort((a,c)=>{let u=Gr(a.scope,c.scope);return u!==0||(u=Fr(a.parentScopes,c.parentScopes),u!==0)?u:a.index-c.index});let n=0,r="#000000",s="#ffffff";for(;t.length>=1&&t[0].scope==="";){let a=t.shift();a.fontStyle!==-1&&(n=a.fontStyle),a.foreground!==null&&(r=a.foreground),a.background!==null&&(s=a.background)}let o=new oo(e),i=new zr(n,o.getId(r),o.getId(s)),l=new ao(new Xt(0,null,-1,0,0),[]);for(let a=0,c=t.length;a<c;a++){let u=t[a];l.insert(0,u.scope,u.parentScopes,u.fontStyle,o.getId(u.foreground),o.getId(u.background))}return new at(o,i,l)}var oo=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(t){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(t)){this._isFrozen=!0;for(let e=0,n=t.length;e<n;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)}},io=Object.freeze([]),Xt=class Wr{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,n,r,s,o){this.scopeDepth=e,this.parentScopes=n||io,this.fontStyle=r,this.foreground=s,this.background=o}clone(){return new Wr(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let n=[];for(let r=0,s=e.length;r<s;r++)n[r]=e[r].clone();return n}acceptOverwrite(e,n,r,s){this.scopeDepth>e?console.log("how did this happen?"):this.scopeDepth=e,n!==-1&&(this.fontStyle=n),r!==0&&(this.foreground=r),s!==0&&(this.background=s)}},ao=class Zt{constructor(e,n=[],r={}){this._mainRule=e,this._children=r,this._rulesWithParentScopes=n}_rulesWithParentScopes;static _cmpBySpecificity(e,n){if(e.scopeDepth!==n.scopeDepth)return n.scopeDepth-e.scopeDepth;let r=0,s=0;for(;e.parentScopes[r]===">"&&r++,n.parentScopes[s]===">"&&s++,!(r>=e.parentScopes.length||s>=n.parentScopes.length);){const o=n.parentScopes[s].length-e.parentScopes[r].length;if(o!==0)return o;r++,s++}return n.parentScopes.length-e.parentScopes.length}match(e){if(e!==""){let r=e.indexOf("."),s,o;if(r===-1?(s=e,o=""):(s=e.substring(0,r),o=e.substring(r+1)),this._children.hasOwnProperty(s))return this._children[s].match(o)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(Zt._cmpBySpecificity),n}insert(e,n,r,s,o,i){if(n===""){this._doInsertHere(e,r,s,o,i);return}let l=n.indexOf("."),a,c;l===-1?(a=n,c=""):(a=n.substring(0,l),c=n.substring(l+1));let u;this._children.hasOwnProperty(a)?u=this._children[a]:(u=new Zt(this._mainRule.clone(),Xt.cloneArr(this._rulesWithParentScopes)),this._children[a]=u),u.insert(e+1,c,r,s,o,i)}_doInsertHere(e,n,r,s,o){if(n===null){this._mainRule.acceptOverwrite(e,r,s,o);return}for(let i=0,l=this._rulesWithParentScopes.length;i<l;i++){let a=this._rulesWithParentScopes[i];if(Fr(a.parentScopes,n)===0){a.acceptOverwrite(e,r,s,o);return}}r===-1&&(r=this._mainRule.fontStyle),s===0&&(s=this._mainRule.foreground),o===0&&(o=this._mainRule.background),this._rulesWithParentScopes.push(new Xt(e,n,r,s,o))}},Re=class Z{static toBinaryStr(e){return e.toString(2).padStart(32,"0")}static print(e){const n=Z.getLanguageId(e),r=Z.getTokenType(e),s=Z.getFontStyle(e),o=Z.getForeground(e),i=Z.getBackground(e);console.log({languageId:n,tokenType:r,fontStyle:s,foreground:o,background:i})}static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return(e&1024)!==0}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(e,n,r,s,o,i,l){let a=Z.getLanguageId(e),c=Z.getTokenType(e),u=Z.containsBalancedBrackets(e)?1:0,f=Z.getFontStyle(e),h=Z.getForeground(e),p=Z.getBackground(e);return n!==0&&(a=n),r!==8&&(c=r),s!==null&&(u=s?1:0),o!==-1&&(f=o),i!==0&&(h=i),l!==0&&(p=l),(a<<0|c<<8|u<<10|f<<11|h<<15|p<<24)>>>0}};function lt(t,e){const n=[],r=lo(t);let s=r.next();for(;s!==null;){let a=0;if(s.length===2&&s.charAt(1)===":"){switch(s.charAt(0)){case"R":a=1;break;case"L":a=-1;break;default:console.log(`Unknown priority ${s} in scope selector`)}s=r.next()}let c=i();if(n.push({matcher:c,priority:a}),s!==",")break;s=r.next()}return n;function o(){if(s==="-"){s=r.next();const a=o();return c=>!!a&&!a(c)}if(s==="("){s=r.next();const a=l();return s===")"&&(s=r.next()),a}if(Dn(s)){const a=[];do a.push(s),s=r.next();while(Dn(s));return c=>e(a,c)}return null}function i(){const a=[];let c=o();for(;c;)a.push(c),c=o();return u=>a.every(f=>f(u))}function l(){const a=[];let c=i();for(;c&&(a.push(c),s==="|"||s===",");){do s=r.next();while(s==="|"||s===",");c=i()}return u=>a.some(f=>f(u))}}function Dn(t){return!!t&&!!t.match(/[\w\.:]+/)}function lo(t){let e=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=e.exec(t);return{next:()=>{if(!n)return null;const r=n[0];return n=e.exec(t),r}}}function Hr(t){typeof t.dispose=="function"&&t.dispose()}var Ge=class{constructor(t){this.scopeName=t}toKey(){return this.scopeName}},co=class{constructor(t,e){this.scopeName=t,this.ruleName=e}toKey(){return`${this.scopeName}#${this.ruleName}`}},uo=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(t){const e=t.toKey();this._seenReferenceKeys.has(e)||(this._seenReferenceKeys.add(e),this._references.push(t))}},fo=class{constructor(t,e){this.repo=t,this.initialScopeName=e,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Ge(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){const t=this.Q;this.Q=[];const e=new uo;for(const n of t)ho(n,this.initialScopeName,this.repo,e);for(const n of e.references)if(n instanceof Ge){if(this.seenFullScopeRequests.has(n.scopeName))continue;this.seenFullScopeRequests.add(n.scopeName),this.Q.push(n)}else{if(this.seenFullScopeRequests.has(n.scopeName)||this.seenPartialScopeRequests.has(n.toKey()))continue;this.seenPartialScopeRequests.add(n.toKey()),this.Q.push(n)}}};function ho(t,e,n,r){const s=n.lookup(t.scopeName);if(!s){if(t.scopeName===e)throw new Error(`No grammar provided for <${e}>`);return}const o=n.lookup(e);t instanceof Ge?st({baseGrammar:o,selfGrammar:s},r):Qt(t.ruleName,{baseGrammar:o,selfGrammar:s,repository:s.repository},r);const i=n.injections(t.scopeName);if(i)for(const l of i)r.add(new Ge(l))}function Qt(t,e,n){if(e.repository&&e.repository[t]){const r=e.repository[t];ct([r],e,n)}}function st(t,e){t.selfGrammar.patterns&&Array.isArray(t.selfGrammar.patterns)&&ct(t.selfGrammar.patterns,{...t,repository:t.selfGrammar.repository},e),t.selfGrammar.injections&&ct(Object.values(t.selfGrammar.injections),{...t,repository:t.selfGrammar.repository},e)}function ct(t,e,n){for(const r of t){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);const s=r.repository?Dr({},e.repository,r.repository):e.repository;Array.isArray(r.patterns)&&ct(r.patterns,{...e,repository:s},n);const o=r.include;if(!o)continue;const i=Vr(o);switch(i.kind){case 0:st({...e,selfGrammar:e.baseGrammar},n);break;case 1:st(e,n);break;case 2:Qt(i.ruleName,{...e,repository:s},n);break;case 3:case 4:const l=i.scopeName===e.selfGrammar.scopeName?e.selfGrammar:i.scopeName===e.baseGrammar.scopeName?e.baseGrammar:void 0;if(l){const a={baseGrammar:e.baseGrammar,selfGrammar:l,repository:s};i.kind===4?Qt(i.ruleName,a,n):st(a,n)}else i.kind===4?n.add(new co(i.scopeName,i.ruleName)):n.add(new Ge(i.scopeName));break}}}var po=class{kind=0},go=class{kind=1},mo=class{constructor(t){this.ruleName=t}kind=2},yo=class{constructor(t){this.scopeName=t}kind=3},bo=class{constructor(t,e){this.scopeName=t,this.ruleName=e}kind=4};function Vr(t){if(t==="$base")return new po;if(t==="$self")return new go;const e=t.indexOf("#");if(e===-1)return new yo(t);if(e===0)return new mo(t.substring(1));{const n=t.substring(0,e),r=t.substring(e+1);return new bo(n,r)}}var wo=/\\(\d+)/,Bn=/\\(\d+)/g,Co=-1,qr=-2;var We=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(t,e,n,r){this.$location=t,this.id=e,this._name=n||null,this._nameIsCapturing=qe.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=qe.hasCaptures(this._contentName)}get debugName(){const t=this.$location?`${Br(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?this._name:qe.replaceCaptures(this._name,t,e)}getContentName(t,e){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:qe.replaceCaptures(this._contentName,t,e)}},_o=class extends We{retokenizeCapturedWithRuleId;constructor(t,e,n,r,s){super(t,e,n,r),this.retokenizeCapturedWithRuleId=s}dispose(){}collectPatterns(t,e){throw new Error("Not supported!")}compile(t,e){throw new Error("Not supported!")}compileAG(t,e,n,r){throw new Error("Not supported!")}},So=class extends We{_match;captures;_cachedCompiledPatterns;constructor(t,e,n,r,s){super(t,e,n,null),this._match=new Fe(r,this.id),this.captures=s,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(t,e){e.push(this._match)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t).compileAG(t,n,r)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Ue,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Gn=class extends We{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(t,e,n,r,s){super(t,e,n,r),this.patterns=s.patterns,this.hasMissingPatterns=s.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(t,e){for(const n of this.patterns)t.getRule(n).collectPatterns(t,e)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t).compileAG(t,n,r)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Ue,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Yt=class extends We{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(t,e,n,r,s,o,i,l,a,c){super(t,e,n,r),this._begin=new Fe(s,this.id),this.beginCaptures=o,this._end=new Fe(i||"￿",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=l,this.applyEndPatternLast=a||!1,this.patterns=c.patterns,this.hasMissingPatterns=c.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(t,e){return this._end.resolveBackReferences(t,e)}collectPatterns(t,e){e.push(this._begin)}compile(t,e){return this._getCachedCompiledPatterns(t,e).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t,e).compileAG(t,n,r)}_getCachedCompiledPatterns(t,e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Ue;for(const n of this.patterns)t.getRule(n).collectPatterns(t,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,e):this._cachedCompiledPatterns.setSource(0,e)),this._cachedCompiledPatterns}},ut=class extends We{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(t,e,n,r,s,o,i,l,a){super(t,e,n,r),this._begin=new Fe(s,this.id),this.beginCaptures=o,this.whileCaptures=l,this._while=new Fe(i,qr),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=a.patterns,this.hasMissingPatterns=a.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(t,e){return this._while.resolveBackReferences(t,e)}collectPatterns(t,e){e.push(this._begin)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t).compileAG(t,n,r)}_getCachedCompiledPatterns(t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Ue;for(const e of this.patterns)t.getRule(e).collectPatterns(t,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(t,e){return this._getCachedCompiledWhilePatterns(t,e).compile(t)}compileWhileAG(t,e,n,r){return this._getCachedCompiledWhilePatterns(t,e).compileAG(t,n,r)}_getCachedCompiledWhilePatterns(t,e){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new Ue,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,e||"￿"),this._cachedCompiledWhilePatterns}},Kr=class z{static createCaptureRule(e,n,r,s,o){return e.registerRule(i=>new _o(n,i,r,s,o))}static getCompiledRuleId(e,n,r){return e.id||n.registerRule(s=>{if(e.id=s,e.match)return new So(e.$vscodeTextmateLocation,e.id,e.name,e.match,z._compileCaptures(e.captures,n,r));if(typeof e.begin>"u"){e.repository&&(r=Dr({},r,e.repository));let o=e.patterns;return typeof o>"u"&&e.include&&(o=[{include:e.include}]),new Gn(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,z._compilePatterns(o,n,r))}return e.while?new ut(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,z._compileCaptures(e.beginCaptures||e.captures,n,r),e.while,z._compileCaptures(e.whileCaptures||e.captures,n,r),z._compilePatterns(e.patterns,n,r)):new Yt(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,z._compileCaptures(e.beginCaptures||e.captures,n,r),e.end,z._compileCaptures(e.endCaptures||e.captures,n,r),e.applyEndPatternLast,z._compilePatterns(e.patterns,n,r))}),e.id}static _compileCaptures(e,n,r){let s=[];if(e){let o=0;for(const i in e){if(i==="$vscodeTextmateLocation")continue;const l=parseInt(i,10);l>o&&(o=l)}for(let i=0;i<=o;i++)s[i]=null;for(const i in e){if(i==="$vscodeTextmateLocation")continue;const l=parseInt(i,10);let a=0;e[i].patterns&&(a=z.getCompiledRuleId(e[i],n,r)),s[l]=z.createCaptureRule(n,e[i].$vscodeTextmateLocation,e[i].name,e[i].contentName,a)}}return s}static _compilePatterns(e,n,r){let s=[];if(e)for(let o=0,i=e.length;o<i;o++){const l=e[o];let a=-1;if(l.include){const c=Vr(l.include);switch(c.kind){case 0:case 1:a=z.getCompiledRuleId(r[l.include],n,r);break;case 2:let u=r[c.ruleName];u&&(a=z.getCompiledRuleId(u,n,r));break;case 3:case 4:const f=c.scopeName,h=c.kind===4?c.ruleName:null,p=n.getExternalGrammar(f,r);if(p)if(h){let d=p.repository[h];d&&(a=z.getCompiledRuleId(d,n,p.repository))}else a=z.getCompiledRuleId(p.repository.$self,n,p.repository);break}}else a=z.getCompiledRuleId(l,n,r);if(a!==-1){const c=n.getRule(a);let u=!1;if((c instanceof Gn||c instanceof Yt||c instanceof ut)&&c.hasMissingPatterns&&c.patterns.length===0&&(u=!0),u)continue;s.push(a)}}return{patterns:s,hasMissingPatterns:(e?e.length:0)!==s.length}}},Fe=class Xr{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,n){if(e&&typeof e=="string"){const r=e.length;let s=0,o=[],i=!1;for(let l=0;l<r;l++)if(e.charAt(l)==="\\"&&l+1<r){const c=e.charAt(l+1);c==="z"?(o.push(e.substring(s,l)),o.push("$(?!\\n)(?<!\\n)"),s=l+2):(c==="A"||c==="G")&&(i=!0),l++}this.hasAnchor=i,s===0?this.source=e:(o.push(e.substring(s,r)),this.source=o.join(""))}else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=n,typeof this.source=="string"?this.hasBackReferences=wo.test(this.source):this.hasBackReferences=!1}clone(){return new Xr(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,n){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let r=n.map(s=>e.substring(s.start,s.end));return Bn.lastIndex=0,this.source.replace(Bn,(s,o)=>Ur(r[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=[],n=[],r=[],s=[],o,i,l,a;for(o=0,i=this.source.length;o<i;o++)l=this.source.charAt(o),e[o]=l,n[o]=l,r[o]=l,s[o]=l,l==="\\"&&o+1<i&&(a=this.source.charAt(o+1),a==="A"?(e[o+1]="￿",n[o+1]="￿",r[o+1]="A",s[o+1]="A"):a==="G"?(e[o+1]="￿",n[o+1]="G",r[o+1]="￿",s[o+1]="G"):(e[o+1]=a,n[o+1]=a,r[o+1]=a,s[o+1]=a),o++);return{A0_G0:e.join(""),A0_G1:n.join(""),A1_G0:r.join(""),A1_G1:s.join("")}}resolveAnchors(e,n){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:e?n?this._anchorCache.A1_G1:this._anchorCache.A1_G0:n?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},Ue=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){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(n=>n.source);this._cached=new Fn(t,e,this._items.map(n=>n.ruleId))}return this._cached}compileAG(t,e,n){return this._hasAnchors?e?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(t,e,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(t,e,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(t,e,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(t,e,n)),this._anchorCache.A0_G0):this.compile(t)}_resolveAnchors(t,e,n){let r=this._items.map(s=>s.resolveAnchors(e,n));return new Fn(t,r,this._items.map(s=>s.ruleId))}},Fn=class{constructor(t,e,n){this.regExps=e,this.rules=n,this.scanner=t.createOnigScanner(e)}scanner;dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const t=[];for(let e=0,n=this.rules.length;e<n;e++)t.push(" - "+this.rules[e]+": "+this.regExps[e]);return t.join(`
2
+ `)}findNextMatchSync(t,e,n){const r=this.scanner.findNextMatchSync(t,e,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},Lt=class{constructor(t,e){this.languageId=t,this.tokenType=e}},ko=class Jt{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,n){this._defaultAttributes=new Lt(e,8),this._embeddedLanguagesMatcher=new vo(Object.entries(n||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(e){return e===null?Jt._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(e)}static _NULL_SCOPE_METADATA=new Lt(0,0);_getBasicScopeAttributes=new jr(e=>{const n=this._scopeToLanguage(e),r=this._toStandardTokenType(e);return new Lt(n,r)});_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(e){const n=e.match(Jt.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[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!")}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},vo=class{values;scopesRegExp;constructor(t){if(t.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(t);const e=t.map(([n,r])=>Ur(n));e.sort(),e.reverse(),this.scopesRegExp=new RegExp(`^((${e.join(")|(")}))($|\\.)`,"")}}match(t){if(!this.scopesRegExp)return;const e=t.match(this.scopesRegExp);if(e)return this.values.get(e[1])}},Un=class{constructor(t,e){this.stack=t,this.stoppedEarly=e}};function Zr(t,e,n,r,s,o,i,l){const a=e.content.length;let c=!1,u=-1;if(i){const p=xo(t,e,n,r,s,o);s=p.stack,r=p.linePos,n=p.isFirstLine,u=p.anchorPosition}const f=Date.now();for(;!c;){if(l!==0&&Date.now()-f>l)return new Un(s,!0);h()}return new Un(s,!1);function h(){const p=Eo(t,e,n,r,s,u);if(!p){o.produce(s,a),c=!0;return}const d=p.captureIndices,b=p.matchedRuleId,w=d&&d.length>0?d[0].end>r:!1;if(b===Co){const g=s.getRule(t);o.produce(s,d[0].start),s=s.withContentNameScopesList(s.nameScopesList),Oe(t,e,n,s,o,g.endCaptures,d),o.produce(s,d[0].end);const y=s;if(s=s.parent,u=y.getAnchorPos(),!w&&y.getEnterPos()===r){s=y,o.produce(s,a),c=!0;return}}else{const g=t.getRule(b);o.produce(s,d[0].start);const y=s,m=g.getName(e.content,d),_=s.contentNameScopesList.pushAttributed(m,t);if(s=s.push(b,r,u,d[0].end===a,null,_,_),g instanceof Yt){const S=g;Oe(t,e,n,s,o,S.beginCaptures,d),o.produce(s,d[0].end),u=d[0].end;const k=S.getContentName(e.content,d),v=_.pushAttributed(k,t);if(s=s.withContentNameScopesList(v),S.endHasBackReferences&&(s=s.withEndRule(S.getEndWithResolvedBackReferences(e.content,d))),!w&&y.hasSameRuleAs(s)){s=s.pop(),o.produce(s,a),c=!0;return}}else if(g instanceof ut){const S=g;Oe(t,e,n,s,o,S.beginCaptures,d),o.produce(s,d[0].end),u=d[0].end;const k=S.getContentName(e.content,d),v=_.pushAttributed(k,t);if(s=s.withContentNameScopesList(v),S.whileHasBackReferences&&(s=s.withEndRule(S.getWhileWithResolvedBackReferences(e.content,d))),!w&&y.hasSameRuleAs(s)){s=s.pop(),o.produce(s,a),c=!0;return}}else if(Oe(t,e,n,s,o,g.captures,d),o.produce(s,d[0].end),s=s.pop(),!w){s=s.safePop(),o.produce(s,a),c=!0;return}}d[0].end>r&&(r=d[0].end,n=!1)}}function xo(t,e,n,r,s,o){let i=s.beginRuleCapturedEOL?0:-1;const l=[];for(let a=s;a;a=a.pop()){const c=a.getRule(t);c instanceof ut&&l.push({rule:c,stack:a})}for(let a=l.pop();a;a=l.pop()){const{ruleScanner:c,findOptions:u}=Ro(a.rule,t,a.stack.endRule,n,r===i),f=c.findNextMatchSync(e,r,u);if(f){if(f.ruleId!==qr){s=a.stack.pop();break}f.captureIndices&&f.captureIndices.length&&(o.produce(a.stack,f.captureIndices[0].start),Oe(t,e,n,a.stack,o,a.rule.whileCaptures,f.captureIndices),o.produce(a.stack,f.captureIndices[0].end),i=f.captureIndices[0].end,f.captureIndices[0].end>r&&(r=f.captureIndices[0].end,n=!1))}else{s=a.stack.pop();break}}return{stack:s,linePos:r,anchorPosition:i,isFirstLine:n}}function Eo(t,e,n,r,s,o){const i=Io(t,e,n,r,s,o),l=t.getInjections();if(l.length===0)return i;const a=Ao(l,t,e,n,r,s,o);if(!a)return i;if(!i)return a;const c=i.captureIndices[0].start,u=a.captureIndices[0].start;return u<c||a.priorityMatch&&u===c?a:i}function Io(t,e,n,r,s,o){const i=s.getRule(t),{ruleScanner:l,findOptions:a}=Qr(i,t,s.endRule,n,r===o),c=l.findNextMatchSync(e,r,a);return c?{captureIndices:c.captureIndices,matchedRuleId:c.ruleId}:null}function Ao(t,e,n,r,s,o,i){let l=Number.MAX_VALUE,a=null,c,u=0;const f=o.contentNameScopesList.getScopeNames();for(let h=0,p=t.length;h<p;h++){const d=t[h];if(!d.matcher(f))continue;const b=e.getRule(d.ruleId),{ruleScanner:w,findOptions:g}=Qr(b,e,null,r,s===i),y=w.findNextMatchSync(n,s,g);if(!y)continue;const m=y.captureIndices[0].start;if(!(m>=l)&&(l=m,a=y.captureIndices,c=y.ruleId,u=d.priority,l===s))break}return a?{priorityMatch:u===-1,captureIndices:a,matchedRuleId:c}:null}function Qr(t,e,n,r,s){return{ruleScanner:t.compileAG(e,n,r,s),findOptions:0}}function Ro(t,e,n,r,s){return{ruleScanner:t.compileWhileAG(e,n,r,s),findOptions:0}}function Oe(t,e,n,r,s,o,i){if(o.length===0)return;const l=e.content,a=Math.min(o.length,i.length),c=[],u=i[0].end;for(let f=0;f<a;f++){const h=o[f];if(h===null)continue;const p=i[f];if(p.length===0)continue;if(p.start>u)break;for(;c.length>0&&c[c.length-1].endPos<=p.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,p.start):s.produce(r,p.start),h.retokenizeCapturedWithRuleId){const b=h.getName(l,i),w=r.contentNameScopesList.pushAttributed(b,t),g=h.getContentName(l,i),y=w.pushAttributed(g,t),m=r.push(h.retokenizeCapturedWithRuleId,p.start,-1,!1,null,w,y),_=t.createOnigString(l.substring(0,p.end));Zr(t,_,n&&p.start===0,p.start,m,s,!1,0),Hr(_);continue}const d=h.getName(l,i);if(d!==null){const w=(c.length>0?c[c.length-1].scopes:r.contentNameScopesList).pushAttributed(d,t);c.push(new Lo(w,p.end))}}for(;c.length>0;)s.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop()}var Lo=class{scopes;endPos;constructor(t,e){this.scopes=t,this.endPos=e}};function No(t,e,n,r,s,o,i,l){return new Po(t,e,n,r,s,o,i,l)}function jn(t,e,n,r,s){const o=lt(e,ft),i=Kr.getCompiledRuleId(n,r,s.repository);for(const l of o)t.push({debugSelector:e,matcher:l.matcher,ruleId:i,grammar:s,priority:l.priority})}function ft(t,e){if(e.length<t.length)return!1;let n=0;return t.every(r=>{for(let s=n;s<e.length;s++)if(To(e[s],r))return n=s+1,!0;return!1})}function To(t,e){if(!t)return!1;if(t===e)return!0;const n=e.length;return t.length>n&&t.substr(0,n)===e&&t[n]==="."}var Po=class{constructor(t,e,n,r,s,o,i,l){if(this._rootScopeName=t,this.balancedBracketSelectors=o,this._onigLib=l,this._basicScopeAttributesProvider=new ko(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=i,this._grammar=zn(e,null),this._injections=null,this._tokenTypeMatchers=[],s)for(const a of Object.keys(s)){const c=lt(a,ft);for(const u of c)this._tokenTypeMatchers.push({matcher:u.matcher,type:s[a]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;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={lookup:s=>s===this._rootScopeName?this._grammar:this.getExternalGrammar(s),injections:s=>this._grammarRepository.injections(s)},e=[],n=this._rootScopeName,r=t.lookup(n);if(r){const s=r.injections;if(s)for(let i in s)jn(e,i,s[i],this,r);const o=this._grammarRepository.injections(n);o&&o.forEach(i=>{const l=this.getExternalGrammar(i);if(l){const a=l.injectionSelector;a&&jn(e,a,l,this,l)}})}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,n=t(e);return this._ruleId2desc[e]=n,n}getRule(t){return this._ruleId2desc[t]}getExternalGrammar(t,e){if(this._includedGrammars[t])return this._includedGrammars[t];if(this._grammarRepository){const n=this._grammarRepository.lookup(t);if(n)return this._includedGrammars[t]=zn(n,e&&e.$base),this._includedGrammars[t]}}tokenizeLine(t,e,n=0){const r=this._tokenize(t,e,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(t,e,n=0){const r=this._tokenize(t,e,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(t,e,n,r){this._rootId===-1&&(this._rootId=Kr.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let s;if(!e||e===en.NULL){s=!0;const c=this._basicScopeAttributesProvider.getDefaultAttributes(),u=this.themeProvider.getDefaults(),f=Re.set(0,c.languageId,c.tokenType,null,u.fontStyle,u.foregroundId,u.backgroundId),h=this.getRule(this._rootId).getName(null,null);let p;h?p=De.createRootAndLookUpScopeName(h,f,this):p=De.createRoot("unknown",f),e=new en(null,this._rootId,-1,-1,!1,null,p,p)}else s=!1,e.reset();t=t+`
3
+ `;const o=this.createOnigString(t),i=o.content.length,l=new Mo(n,t,this._tokenTypeMatchers,this.balancedBracketSelectors),a=Zr(this,o,s,0,e,l,!0,r);return Hr(o),{lineLength:i,lineTokens:l,ruleStack:a.stack,stoppedEarly:a.stoppedEarly}}};function zn(t,e){return t=Qs(t),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 De=class ne{constructor(e,n,r){this.parent=e,this.scopePath=n,this.tokenAttributes=r}static fromExtension(e,n){let r=e,s=e?.scopePath??null;for(const o of n)s=Rt.push(s,o.scopeNames),r=new ne(r,s,o.encodedTokenAttributes);return r}static createRoot(e,n){return new ne(null,new Rt(null,e),n)}static createRootAndLookUpScopeName(e,n,r){const s=r.getMetadataForScope(e),o=new Rt(null,e),i=r.themeProvider.themeMatch(o),l=ne.mergeAttributes(n,s,i);return new ne(null,o,l)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(e){return ne.equals(this,e)}static equals(e,n){do{if(e===n||!e&&!n)return!0;if(!e||!n||e.scopeName!==n.scopeName||e.tokenAttributes!==n.tokenAttributes)return!1;e=e.parent,n=n.parent}while(!0)}static mergeAttributes(e,n,r){let s=-1,o=0,i=0;return r!==null&&(s=r.fontStyle,o=r.foregroundId,i=r.backgroundId),Re.set(e,n.languageId,n.tokenType,null,s,o,i)}pushAttributed(e,n){if(e===null)return this;if(e.indexOf(" ")===-1)return ne._pushAttributed(this,e,n);const r=e.split(/ /g);let s=this;for(const o of r)s=ne._pushAttributed(s,o,n);return s}static _pushAttributed(e,n,r){const s=r.getMetadataForScope(n),o=e.scopePath.push(n),i=r.themeProvider.themeMatch(o),l=ne.mergeAttributes(e.tokenAttributes,s,i);return new ne(e,o,l)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){const n=[];let r=this;for(;r&&r!==e;)n.push({encodedTokenAttributes:r.tokenAttributes,scopeNames:r.scopePath.getExtensionIfDefined(r.parent?.scopePath??null)}),r=r.parent;return r===e?n.reverse():void 0}},en=class pe{constructor(e,n,r,s,o,i,l,a){this.parent=e,this.ruleId=n,this.beginRuleCapturedEOL=o,this.endRule=i,this.nameScopesList=l,this.contentNameScopesList=a,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=r,this._anchorPos=s}_stackElementBrand=void 0;static NULL=new pe(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(e){return e===null?!1:pe._equals(this,e)}static _equals(e,n){return e===n?!0:this._structuralEquals(e,n)?De.equals(e.contentNameScopesList,n.contentNameScopesList):!1}static _structuralEquals(e,n){do{if(e===n||!e&&!n)return!0;if(!e||!n||e.depth!==n.depth||e.ruleId!==n.ruleId||e.endRule!==n.endRule)return!1;e=e.parent,n=n.parent}while(!0)}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){pe._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(e,n,r,s,o,i,l){return new pe(this,e,n,r,s,o,i,l)}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,n){return this.parent&&(n=this.parent._writeString(e,n)),e[n++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,n}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 pe(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,e,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let n=this;for(;n&&n._enterPos===e._enterPos;){if(n.ruleId===e.ruleId)return!0;n=n.parent}return!1}toStateStackFrame(){return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(e,n){const r=De.fromExtension(e?.nameScopesList??null,n.nameScopesList);return new pe(e,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,De.fromExtension(r,n.contentNameScopesList))}},$o=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(t,e){this.balancedBracketScopes=t.flatMap(n=>n==="*"?(this.allowAny=!0,[]):lt(n,ft).map(r=>r.matcher)),this.unbalancedBracketScopes=e.flatMap(n=>lt(n,ft).map(r=>r.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}},Mo=class{constructor(t,e,n,r){this.balancedBracketSelectors=r,this._emitBinaryTokens=t,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(t,e){this.produceFromScopes(t.contentNameScopesList,e)}produceFromScopes(t,e){if(this._lastTokenEndIndex>=e)return;if(this._emitBinaryTokens){let r=t?.tokenAttributes??0,s=!1;if(this.balancedBracketSelectors?.matchesAlways&&(s=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const o=t?.getScopeNames()??[];for(const i of this._tokenTypeOverrides)i.matcher(o)&&(r=Re.set(r,0,i.type,null,-1,0,0));this.balancedBracketSelectors&&(s=this.balancedBracketSelectors.match(o))}if(s&&(r=Re.set(r,0,8,s,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===r){this._lastTokenEndIndex=e;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(r),this._lastTokenEndIndex=e;return}const n=t?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:e,scopes:n}),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 n=new Uint32Array(this._binaryTokens.length);for(let r=0,s=this._binaryTokens.length;r<s;r++)n[r]=this._binaryTokens[r];return n}},Oo=class{constructor(t,e){this._onigLib=e,this._theme=t}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;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,n,r,s){if(!this._grammars.has(t)){let o=this._rawGrammars.get(t);if(!o)return null;this._grammars.set(t,No(t,o,e,n,r,s,this,this._onigLib))}return this._grammars.get(t)}},Do=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new Oo(at.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,n){this._syncRegistry.setTheme(at.createFromRawTheme(e,n))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,n,r){return this.loadGrammarWithConfiguration(e,n,{embeddedLanguages:r})}loadGrammarWithConfiguration(e,n,r){return this._loadGrammar(e,n,r.embeddedLanguages,r.tokenTypes,new $o(r.balancedBracketSelectors||[],r.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,n,r,s,o){const i=new fo(this._syncRegistry,e);for(;i.Q.length>0;)i.Q.map(l=>this._loadSingleGrammar(l.scopeName)),i.processQueue();return this._grammarForScopeName(e,n,r,s,o)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){const n=this._options.loadGrammar(e);if(n){const r=typeof this._options.getInjections=="function"?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(n,r)}}addGrammar(e,n=[],r=0,s=null){return this._syncRegistry.addGrammar(e,n),this._grammarForScopeName(e.scopeName,r,s)}_grammarForScopeName(e,n=0,r=null,s=null,o=null){return this._syncRegistry.grammarForScopeName(e,n,r,s,o)}},tn=en.NULL;const Bo=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];class He{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}He.prototype.normal={};He.prototype.property={};He.prototype.space=void 0;function Yr(t,e){const n={},r={};for(const s of t)Object.assign(n,s.property),Object.assign(r,s.normal);return new He(n,r,e)}function nn(t){return t.toLowerCase()}class q{constructor(e,n){this.attribute=n,this.property=e}}q.prototype.attribute="";q.prototype.booleanish=!1;q.prototype.boolean=!1;q.prototype.commaOrSpaceSeparated=!1;q.prototype.commaSeparated=!1;q.prototype.defined=!1;q.prototype.mustUseProperty=!1;q.prototype.number=!1;q.prototype.overloadedBoolean=!1;q.prototype.property="";q.prototype.spaceSeparated=!1;q.prototype.space=void 0;let Go=0;const I=Ce(),M=Ce(),rn=Ce(),C=Ce(),N=Ce(),Ie=Ce(),K=Ce();function Ce(){return 2**++Go}var sn=Object.freeze({__proto__:null,boolean:I,booleanish:M,commaOrSpaceSeparated:K,commaSeparated:Ie,number:C,overloadedBoolean:rn,spaceSeparated:N});const Nt=Object.keys(sn);class wn extends q{constructor(e,n,r,s){let o=-1;if(super(e,n),Wn(this,"space",s),typeof r=="number")for(;++o<Nt.length;){const i=Nt[o];Wn(this,Nt[o],(r&sn[i])===sn[i])}}}wn.prototype.defined=!0;function Wn(t,e,n){n&&(t[e]=n)}function Le(t){const e={},n={};for(const[r,s]of Object.entries(t.properties)){const o=new wn(r,t.transform(t.attributes||{},r),s,t.space);t.mustUseProperty&&t.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),e[r]=o,n[nn(r)]=r,n[nn(o.attribute)]=r}return new He(e,n,t.space)}const Jr=Le({properties:{ariaActiveDescendant:null,ariaAtomic:M,ariaAutoComplete:null,ariaBusy:M,ariaChecked:M,ariaColCount:C,ariaColIndex:C,ariaColSpan:C,ariaControls:N,ariaCurrent:null,ariaDescribedBy:N,ariaDetails:null,ariaDisabled:M,ariaDropEffect:N,ariaErrorMessage:null,ariaExpanded:M,ariaFlowTo:N,ariaGrabbed:M,ariaHasPopup:null,ariaHidden:M,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:N,ariaLevel:C,ariaLive:null,ariaModal:M,ariaMultiLine:M,ariaMultiSelectable:M,ariaOrientation:null,ariaOwns:N,ariaPlaceholder:null,ariaPosInSet:C,ariaPressed:M,ariaReadOnly:M,ariaRelevant:null,ariaRequired:M,ariaRoleDescription:N,ariaRowCount:C,ariaRowIndex:C,ariaRowSpan:C,ariaSelected:M,ariaSetSize:C,ariaSort:null,ariaValueMax:C,ariaValueMin:C,ariaValueNow:C,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function es(t,e){return e in t?t[e]:e}function ts(t,e){return es(t,e.toLowerCase())}const Fo=Le({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ie,acceptCharset:N,accessKey:N,action:null,allow:null,allowFullScreen:I,allowPaymentRequest:I,allowUserMedia:I,alt:null,as:null,async:I,autoCapitalize:null,autoComplete:N,autoFocus:I,autoPlay:I,blocking:N,capture:null,charSet:null,checked:I,cite:null,className:N,cols:C,colSpan:null,content:null,contentEditable:M,controls:I,controlsList:N,coords:C|Ie,crossOrigin:null,data:null,dateTime:null,decoding:null,default:I,defer:I,dir:null,dirName:null,disabled:I,download:rn,draggable:M,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:I,formTarget:null,headers:N,height:C,hidden:rn,high:C,href:null,hrefLang:null,htmlFor:N,httpEquiv:N,id:null,imageSizes:null,imageSrcSet:null,inert:I,inputMode:null,integrity:null,is:null,isMap:I,itemId:null,itemProp:N,itemRef:N,itemScope:I,itemType:N,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:I,low:C,manifest:null,max:null,maxLength:C,media:null,method:null,min:null,minLength:C,multiple:I,muted:I,name:null,nonce:null,noModule:I,noValidate:I,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:I,optimum:C,pattern:null,ping:N,placeholder:null,playsInline:I,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:I,referrerPolicy:null,rel:N,required:I,reversed:I,rows:C,rowSpan:C,sandbox:N,scope:null,scoped:I,seamless:I,selected:I,shadowRootClonable:I,shadowRootDelegatesFocus:I,shadowRootMode:null,shape:null,size:C,sizes:null,slot:null,span:C,spellCheck:M,src:null,srcDoc:null,srcLang:null,srcSet:null,start:C,step:null,style:null,tabIndex:C,target:null,title:null,translate:null,type:null,typeMustMatch:I,useMap:null,value:M,width:C,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:N,axis:null,background:null,bgColor:null,border:C,borderColor:null,bottomMargin:C,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:I,declare:I,event:null,face:null,frame:null,frameBorder:null,hSpace:C,leftMargin:C,link:null,longDesc:null,lowSrc:null,marginHeight:C,marginWidth:C,noResize:I,noHref:I,noShade:I,noWrap:I,object:null,profile:null,prompt:null,rev:null,rightMargin:C,rules:null,scheme:null,scrolling:M,standby:null,summary:null,text:null,topMargin:C,valueType:null,version:null,vAlign:null,vLink:null,vSpace:C,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:I,disableRemotePlayback:I,prefix:null,property:null,results:C,security:null,unselectable:null},space:"html",transform:ts}),Uo=Le({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:K,accentHeight:C,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:C,amplitude:C,arabicForm:null,ascent:C,attributeName:null,attributeType:null,azimuth:C,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:C,by:null,calcMode:null,capHeight:C,className:N,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:C,diffuseConstant:C,direction:null,display:null,dur:null,divisor:C,dominantBaseline:null,download:I,dx:null,dy:null,edgeMode:null,editable:null,elevation:C,enableBackground:null,end:null,event:null,exponent:C,externalResourcesRequired:null,fill:null,fillOpacity:C,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Ie,g2:Ie,glyphName:Ie,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:C,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:C,horizOriginX:C,horizOriginY:C,id:null,ideographic:C,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:C,k:C,k1:C,k2:C,k3:C,k4:C,kernelMatrix:K,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:C,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:C,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:C,overlineThickness:C,paintOrder:null,panose1:null,path:null,pathLength:C,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:N,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:C,pointsAtY:C,pointsAtZ:C,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:K,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:K,rev:K,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:K,requiredFeatures:K,requiredFonts:K,requiredFormats:K,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:C,specularExponent:C,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:C,strikethroughThickness:C,string:null,stroke:null,strokeDashArray:K,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:C,strokeOpacity:C,strokeWidth:null,style:null,surfaceScale:C,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:K,tabIndex:C,tableValues:null,target:null,targetX:C,targetY:C,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:K,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:C,underlineThickness:C,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:C,values:null,vAlphabetic:C,vMathematical:C,vectorEffect:null,vHanging:C,vIdeographic:C,version:null,vertAdvY:C,vertOriginX:C,vertOriginY:C,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:C,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:es}),ns=Le({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,e){return"xlink:"+e.slice(5).toLowerCase()}}),rs=Le({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:ts}),ss=Le({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),jo=/[A-Z]/g,Hn=/-[a-z]/g,zo=/^data[-\w.:]+$/i;function Wo(t,e){const n=nn(e);let r=e,s=q;if(n in t.normal)return t.property[t.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&zo.test(e)){if(e.charAt(4)==="-"){const o=e.slice(5).replace(Hn,Vo);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=e.slice(4);if(!Hn.test(o)){let i=o.replace(jo,Ho);i.charAt(0)!=="-"&&(i="-"+i),e="data"+i}}s=wn}return new s(r,e)}function Ho(t){return"-"+t.toLowerCase()}function Vo(t){return t.charAt(1).toUpperCase()}const qo=Yr([Jr,Fo,ns,rs,ss],"html"),os=Yr([Jr,Uo,ns,rs,ss],"svg"),Vn={}.hasOwnProperty;function Ko(t,e){const n=e||{};function r(s,...o){let i=r.invalid;const l=r.handlers;if(s&&Vn.call(s,t)){const a=String(s[t]);i=Vn.call(l,a)?l[a]:r.unknown}if(i)return i.call(this,s,...o)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}const Xo=/["&'<>`]/g,Zo=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Qo=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,Yo=/[|\\{}()[\]^$+*?.]/g,qn=new WeakMap;function Jo(t,e){if(t=t.replace(e.subset?ei(e.subset):Xo,r),e.subset||e.escapeOnly)return t;return t.replace(Zo,n).replace(Qo,r);function n(s,o,i){return e.format((s.charCodeAt(0)-55296)*1024+s.charCodeAt(1)-56320+65536,i.charCodeAt(o+2),e)}function r(s,o,i){return e.format(s.charCodeAt(0),i.charCodeAt(o+1),e)}}function ei(t){let e=qn.get(t);return e||(e=ti(t),qn.set(t,e)),e}function ti(t){const e=[];let n=-1;for(;++n<t.length;)e.push(t[n].replace(Yo,"\\$&"));return new RegExp("(?:"+e.join("|")+")","g")}const ni=/[\dA-Fa-f]/;function ri(t,e,n){const r="&#x"+t.toString(16).toUpperCase();return n&&e&&!ni.test(String.fromCharCode(e))?r:r+";"}const si=/\d/;function oi(t,e,n){const r="&#"+String(t);return n&&e&&!si.test(String.fromCharCode(e))?r:r+";"}const ii=["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"],Tt={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",bull:"•",hellip:"…",prime:"′",Prime:"″",oline:"‾",frasl:"⁄",weierp:"℘",image:"ℑ",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"},ai=["cent","copy","divide","gt","lt","not","para","times"],is={}.hasOwnProperty,on={};let Ke;for(Ke in Tt)is.call(Tt,Ke)&&(on[Tt[Ke]]=Ke);const li=/[^\dA-Za-z]/;function ci(t,e,n,r){const s=String.fromCharCode(t);if(is.call(on,s)){const o=on[s],i="&"+o;return n&&ii.includes(o)&&!ai.includes(o)&&(!r||e&&e!==61&&li.test(String.fromCharCode(e)))?i:i+";"}return""}function ui(t,e,n){let r=ri(t,e,n.omitOptionalSemicolons),s;if((n.useNamedReferences||n.useShortestReferences)&&(s=ci(t,e,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!s)&&n.useShortestReferences){const o=oi(t,e,n.omitOptionalSemicolons);o.length<r.length&&(r=o)}return s&&(!n.useShortestReferences||s.length<r.length)?s:r}function Ae(t,e){return Jo(t,Object.assign({format:ui},e))}const fi=/^>|^->|<!--|-->|--!>|<!-$/g,hi=[">"],di=["<",">"];function pi(t,e,n,r){return r.settings.bogusComments?"<?"+Ae(t.value,Object.assign({},r.settings.characterReferences,{subset:hi}))+">":"<!--"+t.value.replace(fi,s)+"-->";function s(o){return Ae(o,Object.assign({},r.settings.characterReferences,{subset:di}))}}function gi(t,e,n,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"}function Kn(t,e){const n=String(t);if(typeof e!="string")throw new TypeError("Expected character");let r=0,s=n.indexOf(e);for(;s!==-1;)r++,s=n.indexOf(e,s+e.length);return r}function mi(t,e){const n=e||{};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}function yi(t){return t.join(" ").trim()}const bi=/[ \t\n\f\r]/g;function Cn(t){return typeof t=="object"?t.type==="text"?Xn(t.value):!1:Xn(t)}function Xn(t){return t.replace(bi,"")===""}const G=ls(1),as=ls(-1),wi=[];function ls(t){return e;function e(n,r,s){const o=n?n.children:wi;let i=(r||0)+t,l=o[i];if(!s)for(;l&&Cn(l);)i+=t,l=o[i];return l}}const Ci={}.hasOwnProperty;function cs(t){return e;function e(n,r,s){return Ci.call(t,n.tagName)&&t[n.tagName](n,r,s)}}const _n=cs({body:Si,caption:Pt,colgroup:Pt,dd:Ei,dt:xi,head:Pt,html:_i,li:vi,optgroup:Ii,option:Ai,p:ki,rp:Zn,rt:Zn,tbody:Li,td:Qn,tfoot:Ni,th:Qn,thead:Ri,tr:Ti});function Pt(t,e,n){const r=G(n,e,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&Cn(r.value.charAt(0)))}function _i(t,e,n){const r=G(n,e);return!r||r.type!=="comment"}function Si(t,e,n){const r=G(n,e);return!r||r.type!=="comment"}function ki(t,e,n){const r=G(n,e);return r?r.type==="element"&&(r.tagName==="address"||r.tagName==="article"||r.tagName==="aside"||r.tagName==="blockquote"||r.tagName==="details"||r.tagName==="div"||r.tagName==="dl"||r.tagName==="fieldset"||r.tagName==="figcaption"||r.tagName==="figure"||r.tagName==="footer"||r.tagName==="form"||r.tagName==="h1"||r.tagName==="h2"||r.tagName==="h3"||r.tagName==="h4"||r.tagName==="h5"||r.tagName==="h6"||r.tagName==="header"||r.tagName==="hgroup"||r.tagName==="hr"||r.tagName==="main"||r.tagName==="menu"||r.tagName==="nav"||r.tagName==="ol"||r.tagName==="p"||r.tagName==="pre"||r.tagName==="section"||r.tagName==="table"||r.tagName==="ul"):!n||!(n.type==="element"&&(n.tagName==="a"||n.tagName==="audio"||n.tagName==="del"||n.tagName==="ins"||n.tagName==="map"||n.tagName==="noscript"||n.tagName==="video"))}function vi(t,e,n){const r=G(n,e);return!r||r.type==="element"&&r.tagName==="li"}function xi(t,e,n){const r=G(n,e);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function Ei(t,e,n){const r=G(n,e);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function Zn(t,e,n){const r=G(n,e);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function Ii(t,e,n){const r=G(n,e);return!r||r.type==="element"&&r.tagName==="optgroup"}function Ai(t,e,n){const r=G(n,e);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function Ri(t,e,n){const r=G(n,e);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function Li(t,e,n){const r=G(n,e);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function Ni(t,e,n){return!G(n,e)}function Ti(t,e,n){const r=G(n,e);return!r||r.type==="element"&&r.tagName==="tr"}function Qn(t,e,n){const r=G(n,e);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}const Pi=cs({body:Oi,colgroup:Di,head:Mi,html:$i,tbody:Bi});function $i(t){const e=G(t,-1);return!e||e.type!=="comment"}function Mi(t){const e=new Set;for(const r of t.children)if(r.type==="element"&&(r.tagName==="base"||r.tagName==="title")){if(e.has(r.tagName))return!1;e.add(r.tagName)}const n=t.children[0];return!n||n.type==="element"}function Oi(t){const e=G(t,-1,!0);return!e||e.type!=="comment"&&!(e.type==="text"&&Cn(e.value.charAt(0)))&&!(e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template"))}function Di(t,e,n){const r=as(n,e),s=G(t,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&_n(r,n.children.indexOf(r),n)?!1:!!(s&&s.type==="element"&&s.tagName==="col")}function Bi(t,e,n){const r=as(n,e),s=G(t,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&_n(r,n.children.indexOf(r),n)?!1:!!(s&&s.type==="element"&&s.tagName==="tr")}const Xe={name:[[`
4
4
  \f\r &/=>`.split(""),`
5
5
  \f\r "&'/=>\``.split("")],[`\0
6
6
  \f\r "&'/<=>`.split(""),`\0
@@ -8,10 +8,10 @@ let U=class extends Error{constructor(e){super(e),this.name="ShikiError"}};funct
8
8
  \f\r &>`.split(""),`\0
9
9
  \f\r "&'<=>\``.split("")],[`\0
10
10
  \f\r "&'<=>\``.split(""),`\0
11
- \f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function Bi(t,e,n,r){const s=r.schema,o=s.space==="svg"?!1:r.settings.omitOptionalTags;let i=s.space==="svg"?r.settings.closeEmptyElements:r.settings.voids.includes(t.tagName.toLowerCase());const l=[];let a;s.space==="html"&&t.tagName==="svg"&&(r.schema=ss);const c=Gi(r,t.properties),u=r.all(s.space==="html"&&t.tagName==="template"?t.content:t);return r.schema=s,u&&(i=!1),(c||!o||!Ti(t,e,n))&&(l.push("<",t.tagName,c?" "+c:""),i&&(s.space==="svg"||r.settings.closeSelfClosing)&&(a=c.charAt(c.length-1),(!r.settings.tightSelfClosing||a==="/"||a&&a!=='"'&&a!=="'")&&l.push(" "),l.push("/")),l.push(">")),l.push(u),!i&&(!o||!_n(t,e,n))&&l.push("</"+t.tagName+">"),l.join("")}function Gi(t,e){const n=[];let r=-1,s;if(e){for(s in e)if(e[s]!==null&&e[s]!==void 0){const o=Fi(t,s,e[s]);o&&n.push(o)}}for(;++r<n.length;){const o=t.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&o!=='"'&&o!=="'"&&(n[r]+=" ")}return n.join("")}function Fi(t,e,n){const r=zo(t.schema,e),s=t.settings.allowParseErrors&&t.schema.space==="html"?0:1,o=t.settings.allowDangerousCharacters?0:1;let i=t.quote,l;if(r.overloadedBoolean&&(n===r.attribute||n==="")?n=!0:(r.boolean||r.overloadedBoolean)&&(typeof n!="string"||n===r.attribute||n==="")&&(n=!!n),n==null||n===!1||typeof n=="number"&&Number.isNaN(n))return"";const a=Ie(r.attribute,Object.assign({},t.settings.characterReferences,{subset:Ke.name[s][o]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?gi:mi)(n,{padLeft:!t.settings.tightCommaSeparatedLists}):String(n),t.settings.collapseEmptyAttributes&&!n)?a:(t.settings.preferUnquoted&&(l=Ie(n,Object.assign({},t.settings.characterReferences,{attribute:!0,subset:Ke.unquoted[s][o]}))),l!==n&&(t.settings.quoteSmart&&Xn(n,i)>Xn(n,t.alternative)&&(i=t.alternative),l=i+Ie(n,Object.assign({},t.settings.characterReferences,{subset:(i==="'"?Ke.single:Ke.double)[s][o],attribute:!0}))+i),a+(l&&"="+l))}const Ui=["<","&"];function cs(t,e,n,r){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?t.value:Ie(t.value,Object.assign({},r.settings.characterReferences,{subset:Ui}))}function ji(t,e,n,r){return r.settings.allowDangerousHtml?t.value:cs(t,e,n,r)}function zi(t,e,n,r){return r.all(t)}const Wi=qo("type",{invalid:Hi,unknown:Vi,handlers:{comment:di,doctype:pi,element:Bi,raw:ji,root:zi,text:cs}});function Hi(t){throw new Error("Expected node, not `"+t+"`")}function Vi(t){const e=t;throw new Error("Cannot compile unknown node `"+e.type+"`")}const qi={},Xi={},Ki=[];function Zi(t,e){const n=e||qi,r=n.quote||'"',s=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:Qi,all:Yi,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||Do,characterReferences:n.characterReferences||Xi,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?ss:Vo,quote:r,alternative:s}.one(Array.isArray(t)?{type:"root",children:t}:t,void 0,void 0)}function Qi(t,e,n){return Wi(t,e,n,this)}function Yi(t){const e=[],n=t&&t.children||Ki;let r=-1;for(;++r<n.length;)e[r]=this.one(n[r],r,t);return e.join("")}function ht(t,e){const n=typeof t=="string"?{}:{...t.colorReplacements},r=typeof t=="string"?t:t.name;for(const[s,o]of Object.entries(e?.colorReplacements||{}))typeof o=="string"?n[s]=o:s===r&&Object.assign(n,o);return n}function fe(t,e){return t&&(e?.[t?.toLowerCase()]||t)}function Ji(t){return Array.isArray(t)?t:[t]}async function us(t){return Promise.resolve(typeof t=="function"?t():t).then(e=>e.default||e)}function Sn(t){return!t||["plaintext","txt","text","plain"].includes(t)}function ea(t){return t==="ansi"||Sn(t)}function kn(t){return t==="none"}function ta(t){return kn(t)}function fs(t,e){if(!e)return t;t.properties||={},t.properties.class||=[],typeof t.properties.class=="string"&&(t.properties.class=t.properties.class.split(/\s+/g)),Array.isArray(t.properties.class)||(t.properties.class=[]);const n=Array.isArray(e)?e:e.split(/\s+/g);for(const r of n)r&&!t.properties.class.includes(r)&&t.properties.class.push(r);return t}function Ct(t,e=!1){if(t.length===0)return[["",0]];const n=t.split(/(\r?\n)/g);let r=0;const s=[];for(let o=0;o<n.length;o+=2){const i=e?n[o]+(n[o+1]||""):n[o];s.push([i,r]),r+=n[o].length,r+=n[o+1]?.length||0}return s}function na(t){const e=Ct(t,!0).map(([s])=>s);function n(s){if(s===t.length)return{line:e.length-1,character:e[e.length-1].length};let o=s,i=0;for(const l of e){if(o<l.length)break;o-=l.length,i++}return{line:i,character:o}}function r(s,o){let i=0;for(let l=0;l<s;l++)i+=e[l].length;return i+=o,i}return{lines:e,indexToPos:n,posToIndex:r}}const vn="light-dark()",ra=["color","background-color"];function sa(t,e){let n=0;const r=[];for(const s of e)s>n&&r.push({...t,content:t.content.slice(n,s),offset:t.offset+n}),n=s;return n<t.content.length&&r.push({...t,content:t.content.slice(n),offset:t.offset+n}),r}function oa(t,e){const n=Array.from(e instanceof Set?e:new Set(e)).sort((r,s)=>r-s);return n.length?t.map(r=>r.flatMap(s=>{const o=n.filter(i=>s.offset<i&&i<s.offset+s.content.length).map(i=>i-s.offset).sort((i,l)=>i-l);return o.length?sa(s,o):s})):t}function ia(t,e,n,r,s="css-vars"){const o={content:t.content,explanation:t.explanation,offset:t.offset},i=e.map(u=>dt(t.variants[u])),l=new Set(i.flatMap(u=>Object.keys(u))),a={},c=(u,f)=>{const h=f==="color"?"":f==="background-color"?"-bg":`-${f}`;return n+e[u]+(f==="color"?"":h)};return i.forEach((u,f)=>{for(const h of l){const p=u[h]||"inherit";if(f===0&&r&&ra.includes(h))if(r===vn&&i.length>1){const d=e.findIndex(y=>y==="light"),b=e.findIndex(y=>y==="dark");if(d===-1||b===-1)throw new U('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');const w=i[d][h]||"inherit",g=i[b][h]||"inherit";a[h]=`light-dark(${w}, ${g})`,s==="css-vars"&&(a[c(f,h)]=p)}else a[h]=p;else s==="css-vars"&&(a[c(f,h)]=p)}}),o.htmlStyle=a,o}function dt(t){const e={};if(t.color&&(e.color=t.color),t.bgColor&&(e["background-color"]=t.bgColor),t.fontStyle){t.fontStyle&W.Italic&&(e["font-style"]="italic"),t.fontStyle&W.Bold&&(e["font-weight"]="bold");const n=[];t.fontStyle&W.Underline&&n.push("underline"),t.fontStyle&W.Strikethrough&&n.push("line-through"),n.length&&(e["text-decoration"]=n.join(" "))}return e}function an(t){return typeof t=="string"?t:Object.entries(t).map(([e,n])=>`${e}:${n}`).join(";")}const hs=new WeakMap;function _t(t,e){hs.set(t,e)}function je(t){return hs.get(t)}class Le{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(e,n){return new Le(Object.fromEntries(Ji(n).map(r=>[r,tn])),e)}constructor(...e){if(e.length===2){const[n,r]=e;this.lang=r,this._stacks=n}else{const[n,r,s]=e;this.lang=r,this._stacks={[s]:n}}}getInternalStack(e=this.theme){return this._stacks[e]}getScopes(e=this.theme){return aa(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}}function aa(t){const e=[],n=new Set;function r(s){if(n.has(s))return;n.add(s);const o=s?.nameScopesList?.scopeName;o&&e.push(o),s.parent&&r(s.parent)}return r(t),e}function la(t,e){if(!(t instanceof Le))throw new U("Invalid grammar state");return t.getInternalStack(e)}function ca(){const t=new WeakMap;function e(n){if(!t.has(n.meta)){let r=function(i){if(typeof i=="number"){if(i<0||i>n.source.length)throw new U(`Invalid decoration offset: ${i}. Code length: ${n.source.length}`);return{...s.indexToPos(i),offset:i}}else{const l=s.lines[i.line];if(l===void 0)throw new U(`Invalid decoration position ${JSON.stringify(i)}. Lines length: ${s.lines.length}`);let a=i.character;if(a<0&&(a=l.length+a),a<0||a>l.length)throw new U(`Invalid decoration position ${JSON.stringify(i)}. Line ${i.line} length: ${l.length}`);return{...i,character:a,offset:s.posToIndex(i.line,a)}}};const s=na(n.source),o=(n.options.decorations||[]).map(i=>({...i,start:r(i.start),end:r(i.end)}));ua(o),t.set(n.meta,{decorations:o,converter:s,source:n.source})}return t.get(n.meta)}return{name:"shiki:decorations",tokens(n){if(!this.options.decorations?.length)return;const s=e(this).decorations.flatMap(i=>[i.start.offset,i.end.offset]);return oa(n,s)},code(n){if(!this.options.decorations?.length)return;const r=e(this),s=Array.from(n.children).filter(u=>u.type==="element"&&u.tagName==="span");if(s.length!==r.converter.lines.length)throw new U(`Number of lines in code element (${s.length}) does not match the number of lines in the source (${r.converter.lines.length}). Failed to apply decorations.`);function o(u,f,h,p){const d=s[u];let b="",w=-1,g=-1;if(f===0&&(w=0),h===0&&(g=0),h===Number.POSITIVE_INFINITY&&(g=d.children.length),w===-1||g===-1)for(let m=0;m<d.children.length;m++)b+=ds(d.children[m]),w===-1&&b.length===f&&(w=m+1),g===-1&&b.length===h&&(g=m+1);if(w===-1)throw new U(`Failed to find start index for decoration ${JSON.stringify(p.start)}`);if(g===-1)throw new U(`Failed to find end index for decoration ${JSON.stringify(p.end)}`);const y=d.children.slice(w,g);if(!p.alwaysWrap&&y.length===d.children.length)l(d,p,"line");else if(!p.alwaysWrap&&y.length===1&&y[0].type==="element")l(y[0],p,"token");else{const m={type:"element",tagName:"span",properties:{},children:y};l(m,p,"wrapper"),d.children.splice(w,y.length,m)}}function i(u,f){s[u]=l(s[u],f,"line")}function l(u,f,h){const p=f.properties||{},d=f.transform||(b=>b);return u.tagName=f.tagName||"span",u.properties={...u.properties,...p,class:u.properties.class},f.properties?.class&&fs(u,f.properties.class),u=d(u,h)||u,u}const a=[],c=r.decorations.sort((u,f)=>f.start.offset-u.start.offset||u.end.offset-f.end.offset);for(const u of c){const{start:f,end:h}=u;if(f.line===h.line)o(f.line,f.character,h.character,u);else if(f.line<h.line){o(f.line,f.character,Number.POSITIVE_INFINITY,u);for(let p=f.line+1;p<h.line;p++)a.unshift(()=>i(p,u));o(h.line,0,h.character,u)}}a.forEach(u=>u())}}}function ua(t){for(let e=0;e<t.length;e++){const n=t[e];if(n.start.offset>n.end.offset)throw new U(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let r=e+1;r<t.length;r++){const s=t[r],o=n.start.offset<=s.start.offset&&s.start.offset<n.end.offset,i=n.start.offset<s.end.offset&&s.end.offset<=n.end.offset,l=s.start.offset<=n.start.offset&&n.start.offset<s.end.offset,a=s.start.offset<n.end.offset&&n.end.offset<=s.end.offset;if(o||i||l||a){if(o&&i||l&&a||l&&n.start.offset===n.end.offset||i&&s.start.offset===s.end.offset)continue;throw new U(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(s.start)} intersect.`)}}}}function ds(t){return t.type==="text"?t.value:t.type==="element"?t.children.map(ds).join(""):""}const fa=[ca()];function pt(t){const e=ha(t.transformers||[]);return[...e.pre,...e.normal,...e.post,...fa]}function ha(t){const e=[],n=[],r=[];for(const s of t)switch(s.enforce){case"pre":e.push(s);break;case"post":n.push(s);break;default:r.push(s)}return{pre:e,post:n,normal:r}}var me=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],$t={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",8:"hidden",9:"strikethrough"};function da(t,e){const n=t.indexOf("\x1B",e);if(n!==-1&&t[n+1]==="["){const r=t.indexOf("m",n);if(r!==-1)return{sequence:t.substring(n+2,r).split(";"),startPosition:n,position:r+1}}return{position:t.length}}function Yn(t){const e=t.shift();if(e==="2"){const n=t.splice(0,3).map(r=>Number.parseInt(r));return n.length!==3||n.some(r=>Number.isNaN(r))?void 0:{type:"rgb",rgb:n}}else if(e==="5"){const n=t.shift();if(n)return{type:"table",index:Number(n)}}}function pa(t){const e=[];for(;t.length>0;){const n=t.shift();if(!n)continue;const r=Number.parseInt(n);if(!Number.isNaN(r))if(r===0)e.push({type:"resetAll"});else if(r<=9)$t[r]&&e.push({type:"setDecoration",value:$t[r]});else if(r<=29){const s=$t[r-20];s&&(e.push({type:"resetDecoration",value:s}),s==="dim"&&e.push({type:"resetDecoration",value:"bold"}))}else if(r<=37)e.push({type:"setForegroundColor",value:{type:"named",name:me[r-30]}});else if(r===38){const s=Yn(t);s&&e.push({type:"setForegroundColor",value:s})}else if(r===39)e.push({type:"resetForegroundColor"});else if(r<=47)e.push({type:"setBackgroundColor",value:{type:"named",name:me[r-40]}});else if(r===48){const s=Yn(t);s&&e.push({type:"setBackgroundColor",value:s})}else r===49?e.push({type:"resetBackgroundColor"}):r===53?e.push({type:"setDecoration",value:"overline"}):r===55?e.push({type:"resetDecoration",value:"overline"}):r>=90&&r<=97?e.push({type:"setForegroundColor",value:{type:"named",name:me[r-90+8]}}):r>=100&&r<=107&&e.push({type:"setBackgroundColor",value:{type:"named",name:me[r-100+8]}})}return e}function ga(){let t=null,e=null,n=new Set;return{parse(r){const s=[];let o=0;do{const i=da(r,o),l=i.sequence?r.substring(o,i.startPosition):r.substring(o);if(l.length>0&&s.push({value:l,foreground:t,background:e,decorations:new Set(n)}),i.sequence){const a=pa(i.sequence);for(const c of a)c.type==="resetAll"?(t=null,e=null,n.clear()):c.type==="resetForegroundColor"?t=null:c.type==="resetBackgroundColor"?e=null:c.type==="resetDecoration"&&n.delete(c.value);for(const c of a)c.type==="setForegroundColor"?t=c.value:c.type==="setBackgroundColor"?e=c.value:c.type==="setDecoration"&&n.add(c.value)}o=i.position}while(o<r.length);return s}}}var ma={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 ya(t=ma){function e(l){return t[l]}function n(l){return`#${l.map(a=>Math.max(0,Math.min(a,255)).toString(16).padStart(2,"0")).join("")}`}let r;function s(){if(r)return r;r=[];for(let c=0;c<me.length;c++)r.push(e(me[c]));let l=[0,95,135,175,215,255];for(let c=0;c<6;c++)for(let u=0;u<6;u++)for(let f=0;f<6;f++)r.push(n([l[c],l[u],l[f]]));let a=8;for(let c=0;c<24;c++,a+=10)r.push(n([a,a,a]));return r}function o(l){return s()[l]}function i(l){switch(l.type){case"named":return e(l.name);case"rgb":return n(l.rgb);case"table":return o(l.index)}}return{value:i}}const ba={black:"#000000",red:"#cd3131",green:"#0DBC79",yellow:"#E5E510",blue:"#2472C8",magenta:"#BC3FBC",cyan:"#11A8CD",white:"#E5E5E5",brightBlack:"#666666",brightRed:"#F14C4C",brightGreen:"#23D18B",brightYellow:"#F5F543",brightBlue:"#3B8EEA",brightMagenta:"#D670D6",brightCyan:"#29B8DB",brightWhite:"#FFFFFF"};function wa(t,e,n){const r=ht(t,n),s=Ct(e),o=Object.fromEntries(me.map(a=>{const c=`terminal.ansi${a[0].toUpperCase()}${a.substring(1)}`,u=t.colors?.[c];return[a,u||ba[a]]})),i=ya(o),l=ga();return s.map(a=>l.parse(a[0]).map(c=>{let u,f;c.decorations.has("reverse")?(u=c.background?i.value(c.background):t.bg,f=c.foreground?i.value(c.foreground):t.fg):(u=c.foreground?i.value(c.foreground):t.fg,f=c.background?i.value(c.background):void 0),u=fe(u,r),f=fe(f,r),c.decorations.has("dim")&&(u=Ca(u));let h=W.None;return c.decorations.has("bold")&&(h|=W.Bold),c.decorations.has("italic")&&(h|=W.Italic),c.decorations.has("underline")&&(h|=W.Underline),c.decorations.has("strikethrough")&&(h|=W.Strikethrough),{content:c.value,offset:a[1],color:u,bgColor:f,fontStyle:h}}))}function Ca(t){const e=t.match(/#([0-9a-f]{3,8})/i);if(e){const r=e[1];if(r.length===8){const s=Math.round(Number.parseInt(r.slice(6,8),16)/2).toString(16).padStart(2,"0");return`#${r.slice(0,6)}${s}`}else{if(r.length===6)return`#${r}80`;if(r.length===4){const s=r[0],o=r[1],i=r[2],l=r[3],a=Math.round(Number.parseInt(`${l}${l}`,16)/2).toString(16).padStart(2,"0");return`#${s}${s}${o}${o}${i}${i}${a}`}else if(r.length===3){const s=r[0],o=r[1],i=r[2];return`#${s}${s}${o}${o}${i}${i}80`}}}const n=t.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return n?`var(${n[1]}-dim)`:t}function xn(t,e,n={}){const{theme:r=t.getLoadedThemes()[0]}=n,s=t.resolveLangAlias(n.lang||"text");if(Sn(s)||kn(r))return Ct(e).map(a=>[{content:a[0],offset:a[1]}]);const{theme:o,colorMap:i}=t.setTheme(r);if(s==="ansi")return wa(o,e,n);const l=t.getLanguage(n.lang||"text");if(n.grammarState){if(n.grammarState.lang!==l.name)throw new U(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${l.name}"`);if(!n.grammarState.themes.includes(o.name))throw new U(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${o.name}"`)}return Sa(e,l,o,i,n)}function _a(...t){if(t.length===2)return je(t[1]);const[e,n,r={}]=t,{lang:s="text",theme:o=e.getLoadedThemes()[0]}=r;if(Sn(s)||kn(o))throw new U("Plain language does not have grammar state");if(s==="ansi")throw new U("ANSI language does not have grammar state");const{theme:i,colorMap:l}=e.setTheme(o),a=e.getLanguage(s);return new Le(En(n,a,i,l,r).stateStack,a.name,i.name)}function Sa(t,e,n,r,s){const o=En(t,e,n,r,s),i=new Le(o.stateStack,e.name,n.name);return _t(o.tokens,i),o.tokens}function En(t,e,n,r,s){const o=ht(n,s),{tokenizeMaxLineLength:i=0,tokenizeTimeLimit:l=500}=s,a=Ct(t);let c=s.grammarState?la(s.grammarState,n.name)??tn:s.grammarContextCode!=null?En(s.grammarContextCode,e,n,r,{...s,grammarState:void 0,grammarContextCode:void 0}).stateStack:tn,u=[];const f=[];for(let h=0,p=a.length;h<p;h++){const[d,b]=a[h];if(d===""){u=[],f.push([]);continue}if(i>0&&d.length>=i){u=[],f.push([{content:d,offset:b,color:"",fontStyle:0}]);continue}let w,g,y;s.includeExplanation&&(w=e.tokenizeLine(d,c,l),g=w.tokens,y=0);const m=e.tokenizeLine2(d,c,l),_=m.tokens.length/2;for(let S=0;S<_;S++){const k=m.tokens[2*S],v=S+1<_?m.tokens[2*S+2]:d.length;if(k===v)continue;const A=m.tokens[2*S+1],L=fe(r[Ae.getForeground(A)],o),H=Ae.getFontStyle(A),he={content:d.substring(k,v),offset:b+k,color:L,fontStyle:H};if(s.includeExplanation){const E=[];if(s.includeExplanation!=="scopeName")for(const R of n.settings){let P;switch(typeof R.scope){case"string":P=R.scope.split(/,/).map(T=>T.trim());break;case"object":P=R.scope;break;default:continue}E.push({settings:R,selectors:P.map(T=>T.split(/ /))})}he.explanation=[];let V=0;for(;k+V<v;){const R=g[y],P=d.substring(R.startIndex,R.endIndex);V+=P.length,he.explanation.push({content:P,scopes:s.includeExplanation==="scopeName"?ka(R.scopes):va(E,R.scopes)}),y+=1}}u.push(he)}f.push(u),u=[],c=m.ruleStack}return{tokens:f,stateStack:c}}function ka(t){return t.map(e=>({scopeName:e}))}function va(t,e){const n=[];for(let r=0,s=e.length;r<s;r++){const o=e[r];n[r]={scopeName:o,themeMatches:Ea(t,o,e.slice(0,r))}}return n}function Jn(t,e){return t===e||e.substring(0,t.length)===t&&e[t.length]==="."}function xa(t,e,n){if(!Jn(t[t.length-1],e))return!1;let r=t.length-2,s=n.length-1;for(;r>=0&&s>=0;)Jn(t[r],n[s])&&(r-=1),s-=1;return r===-1}function Ea(t,e,n){const r=[];for(const{selectors:s,settings:o}of t)for(const i of s)if(xa(i,e,n)){r.push(o);break}return r}function ps(t,e,n){const r=Object.entries(n.themes).filter(a=>a[1]).map(a=>({color:a[0],theme:a[1]})),s=r.map(a=>{const c=xn(t,e,{...n,theme:a.theme}),u=je(c),f=typeof a.theme=="string"?a.theme:a.theme.name;return{tokens:c,state:u,theme:f}}),o=Ia(...s.map(a=>a.tokens)),i=o[0].map((a,c)=>a.map((u,f)=>{const h={content:u.content,variants:{},offset:u.offset};return"includeExplanation"in n&&n.includeExplanation&&(h.explanation=u.explanation),o.forEach((p,d)=>{const{content:b,explanation:w,offset:g,...y}=p[c][f];h.variants[r[d].color]=y}),h})),l=s[0].state?new Le(Object.fromEntries(s.map(a=>[a.theme,a.state?.getInternalStack(a.theme)])),s[0].state.lang):void 0;return l&&_t(i,l),i}function Ia(...t){const e=t.map(()=>[]),n=t.length;for(let r=0;r<t[0].length;r++){const s=t.map(a=>a[r]),o=e.map(()=>[]);e.forEach((a,c)=>a.push(o[c]));const i=s.map(()=>0),l=s.map(a=>a[0]);for(;l.every(a=>a);){const a=Math.min(...l.map(c=>c.content.length));for(let c=0;c<n;c++){const u=l[c];u.content.length===a?(o[c].push(u),i[c]+=1,l[c]=s[c][i[c]]):(o[c].push({...u,content:u.content.slice(0,a)}),l[c]={...u,content:u.content.slice(a),offset:u.offset+a})}}}return e}function gt(t,e,n){let r,s,o,i,l,a;if("themes"in n){const{defaultColor:c="light",cssVariablePrefix:u="--shiki-",colorsRendering:f="css-vars"}=n,h=Object.entries(n.themes).filter(g=>g[1]).map(g=>({color:g[0],theme:g[1]})).sort((g,y)=>g.color===c?-1:y.color===c?1:0);if(h.length===0)throw new U("`themes` option must not be empty");const p=ps(t,e,n);if(a=je(p),c&&vn!==c&&!h.find(g=>g.color===c))throw new U(`\`themes\` option must contain the defaultColor key \`${c}\``);const d=h.map(g=>t.getTheme(g.theme)),b=h.map(g=>g.color);o=p.map(g=>g.map(y=>ia(y,b,u,c,f))),a&&_t(o,a);const w=h.map(g=>ht(g.theme,n));s=er(h,d,w,u,c,"fg",f),r=er(h,d,w,u,c,"bg",f),i=`shiki-themes ${d.map(g=>g.name).join(" ")}`,l=c?void 0:[s,r].join(";")}else if("theme"in n){const c=ht(n.theme,n);o=xn(t,e,n);const u=t.getTheme(n.theme);r=fe(u.bg,c),s=fe(u.fg,c),i=u.name,a=je(o)}else throw new U("Invalid options, either `theme` or `themes` must be provided");return{tokens:o,fg:s,bg:r,themeName:i,rootStyle:l,grammarState:a}}function er(t,e,n,r,s,o,i){return t.map((l,a)=>{const c=fe(e[a][o],n[a])||"inherit",u=`${r+l.color}${o==="bg"?"-bg":""}:${c}`;if(a===0&&s){if(s===vn&&t.length>1){const f=t.findIndex(b=>b.color==="light"),h=t.findIndex(b=>b.color==="dark");if(f===-1||h===-1)throw new U('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');const p=fe(e[f][o],n[f])||"inherit",d=fe(e[h][o],n[h])||"inherit";return`light-dark(${p}, ${d});${u}`}return c}return i==="css-vars"?u:null}).filter(l=>!!l).join(";")}function mt(t,e,n,r={meta:{},options:n,codeToHast:(s,o)=>mt(t,s,o),codeToTokens:(s,o)=>gt(t,s,o)}){let s=e;for(const d of pt(n))s=d.preprocess?.call(r,s,n)||s;let{tokens:o,fg:i,bg:l,themeName:a,rootStyle:c,grammarState:u}=gt(t,s,n);const{mergeWhitespaces:f=!0,mergeSameStyleTokens:h=!1}=n;f===!0?o=Ra(o):f==="never"&&(o=La(o)),h&&(o=Na(o));const p={...r,get source(){return s}};for(const d of pt(n))o=d.tokens?.call(p,o)||o;return Aa(o,{...n,fg:i,bg:l,themeName:a,rootStyle:n.rootStyle===!1?!1:n.rootStyle??c},p,u)}function Aa(t,e,n,r=je(t)){const s=pt(e),o=[],i={type:"root",children:[]},{structure:l="classic",tabindex:a="0"}=e,c={class:`shiki ${e.themeName||""}`};e.rootStyle!==!1&&(e.rootStyle!=null?c.style=e.rootStyle:c.style=`background-color:${e.bg};color:${e.fg}`),a!==!1&&a!=null&&(c.tabindex=a.toString());for(const[b,w]of Object.entries(e.meta||{}))b.startsWith("_")||(c[b]=w);let u={type:"element",tagName:"pre",properties:c,children:[],data:e.data},f={type:"element",tagName:"code",properties:{},children:o};const h=[],p={...n,structure:l,addClassToHast:fs,get source(){return n.source},get tokens(){return t},get options(){return e},get root(){return i},get pre(){return u},get code(){return f},get lines(){return h}};if(t.forEach((b,w)=>{w&&(l==="inline"?i.children.push({type:"element",tagName:"br",properties:{},children:[]}):l==="classic"&&o.push({type:"text",value:`
12
- `}));let g={type:"element",tagName:"span",properties:{class:"line"},children:[]},y=0;for(const m of b){let _={type:"element",tagName:"span",properties:{...m.htmlAttrs},children:[{type:"text",value:m.content}]};const S=an(m.htmlStyle||dt(m));S&&(_.properties.style=S);for(const k of s)_=k?.span?.call(p,_,w+1,y,g,m)||_;l==="inline"?i.children.push(_):l==="classic"&&g.children.push(_),y+=m.content.length}if(l==="classic"){for(const m of s)g=m?.line?.call(p,g,w+1)||g;h.push(g),o.push(g)}else l==="inline"&&h.push(g)}),l==="classic"){for(const b of s)f=b?.code?.call(p,f)||f;u.children.push(f);for(const b of s)u=b?.pre?.call(p,u)||u;i.children.push(u)}else if(l==="inline"){const b=[];let w={type:"element",tagName:"span",properties:{class:"line"},children:[]};for(const m of i.children)m.type==="element"&&m.tagName==="br"?(b.push(w),w={type:"element",tagName:"span",properties:{class:"line"},children:[]}):(m.type==="element"||m.type==="text")&&w.children.push(m);b.push(w);let y={type:"element",tagName:"code",properties:{},children:b};for(const m of s)y=m?.code?.call(p,y)||y;i.children=[];for(let m=0;m<y.children.length;m++){m>0&&i.children.push({type:"element",tagName:"br",properties:{},children:[]});const _=y.children[m];_.type==="element"&&i.children.push(..._.children)}}let d=i;for(const b of s)d=b?.root?.call(p,d)||d;return r&&_t(d,r),d}function Ra(t){return t.map(e=>{const n=[];let r="",s;return e.forEach((o,i)=>{const a=!(o.fontStyle&&(o.fontStyle&W.Underline||o.fontStyle&W.Strikethrough));a&&o.content.match(/^\s+$/)&&e[i+1]?(s===void 0&&(s=o.offset),r+=o.content):r?(a?n.push({...o,offset:s,content:r+o.content}):n.push({content:r,offset:s},o),s=void 0,r=""):n.push(o)}),n})}function La(t){return t.map(e=>e.flatMap(n=>{if(n.content.match(/^\s+$/))return n;const r=n.content.match(/^(\s*)(.*?)(\s*)$/);if(!r)return n;const[,s,o,i]=r;if(!s&&!i)return n;const l=[{...n,offset:n.offset+s.length,content:o}];return s&&l.unshift({content:s,offset:n.offset}),i&&l.push({content:i,offset:n.offset+s.length+o.length}),l}))}function Na(t){return t.map(e=>{const n=[];for(const r of e){if(n.length===0){n.push({...r});continue}const s=n[n.length-1],o=an(s.htmlStyle||dt(s)),i=an(r.htmlStyle||dt(r)),l=s.fontStyle&&(s.fontStyle&W.Underline||s.fontStyle&W.Strikethrough),a=r.fontStyle&&(r.fontStyle&W.Underline||r.fontStyle&W.Strikethrough);!l&&!a&&o===i?s.content+=r.content:n.push({...r})}return n})}const Ta=Zi;function Pa(t,e,n){const r={meta:{},options:n,codeToHast:(o,i)=>mt(t,o,i),codeToTokens:(o,i)=>gt(t,o,i)};let s=Ta(mt(t,e,n,r));for(const o of pt(n))s=o.postprocess?.call(r,s,n)||s;return s}const tr={light:"#333333",dark:"#bbbbbb"},nr={light:"#fffffe",dark:"#1e1e1e"},rr="__shiki_resolved";function In(t){if(t?.[rr])return t;const e={...t};e.tokenColors&&!e.settings&&(e.settings=e.tokenColors,delete e.tokenColors),e.type||="dark",e.colorReplacements={...e.colorReplacements},e.settings||=[];let{bg:n,fg:r}=e;if(!n||!r){const l=e.settings?e.settings.find(a=>!a.name&&!a.scope):void 0;l?.settings?.foreground&&(r=l.settings.foreground),l?.settings?.background&&(n=l.settings.background),!r&&e?.colors?.["editor.foreground"]&&(r=e.colors["editor.foreground"]),!n&&e?.colors?.["editor.background"]&&(n=e.colors["editor.background"]),r||(r=e.type==="light"?tr.light:tr.dark),n||(n=e.type==="light"?nr.light:nr.dark),e.fg=r,e.bg=n}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 i(l){if(o.has(l))return o.get(l);s+=1;const a=`#${s.toString(16).padStart(8,"0").toLowerCase()}`;return e.colorReplacements?.[`#${a}`]?i(l):(o.set(l,a),a)}e.settings=e.settings.map(l=>{const a=l.settings?.foreground&&!l.settings.foreground.startsWith("#"),c=l.settings?.background&&!l.settings.background.startsWith("#");if(!a&&!c)return l;const u={...l,settings:{...l.settings}};if(a){const f=i(l.settings.foreground);e.colorReplacements[f]=l.settings.foreground,u.settings.foreground=f}if(c){const f=i(l.settings.background);e.colorReplacements[f]=l.settings.background,u.settings.background=f}return u});for(const l of Object.keys(e.colors||{}))if((l==="editor.foreground"||l==="editor.background"||l.startsWith("terminal.ansi"))&&!e.colors[l]?.startsWith("#")){const a=i(e.colors[l]);e.colorReplacements[a]=e.colors[l],e.colors[l]=a}return Object.defineProperty(e,rr,{enumerable:!1,writable:!1,value:!0}),e}async function gs(t){return Array.from(new Set((await Promise.all(t.filter(e=>!ea(e)).map(async e=>await us(e).then(n=>Array.isArray(n)?n:[n])))).flat()))}async function ms(t){return(await Promise.all(t.map(async n=>ta(n)?null:In(await us(n))))).filter(n=>!!n)}let $a=3;function Ma(t,e=3){e>$a||console.trace(`[SHIKI DEPRECATE]: ${t}`)}let xe=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function ys(t,e){if(!e)return t;if(e[t]){const n=new Set([t]);for(;e[t];){if(t=e[t],n.has(t))throw new xe(`Circular alias \`${Array.from(n).join(" -> ")} -> ${t}\``);n.add(t)}}return t}class Oa extends Oo{constructor(e,n,r,s={}){super(e),this._resolver=e,this._themes=n,this._langs=r,this._alias=s,this._themes.map(o=>this.loadTheme(o)),this.loadLanguages(this._langs)}_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;getTheme(e){return typeof e=="string"?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){const n=In(e);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(e){let n=this._textmateThemeCache.get(e);n||(n=at.createFromRawTheme(e),this._textmateThemeCache.set(e,n)),this._syncRegistry.setTheme(n)}getGrammar(e){return e=ys(e,this._alias),this._resolvedGrammars.get(e)}loadLanguage(e){if(this.getGrammar(e.name))return;const n=new Set([...this._langMap.values()].filter(o=>o.embeddedLangsLazy?.includes(e.name)));this._resolver.addLanguage(e);const r={balancedBracketSelectors:e.balancedBracketSelectors||["*"],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);const s=this.loadGrammarWithConfiguration(e.scopeName,1,r);if(s.name=e.name,this._resolvedGrammars.set(e.name,s),e.aliases&&e.aliases.forEach(o=>{this._alias[o]=e.name}),this._loadedLanguagesCache=null,n.size)for(const o of n)this._resolvedGrammars.delete(o.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(o.scopeName),this._syncRegistry?._grammars?.delete(o.scopeName),this.loadLanguage(this._langMap.get(o.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(e){for(const s of e)this.resolveEmbeddedLanguages(s);const n=Array.from(this._langGraph.entries()),r=n.filter(([s,o])=>!o);if(r.length){const s=n.filter(([o,i])=>i?(i.embeddedLanguages||i.embeddedLangs)?.some(a=>r.map(([c])=>c).includes(a)):!1).filter(o=>!r.includes(o));throw new xe(`Missing languages ${r.map(([o])=>`\`${o}\``).join(", ")}, required by ${s.map(([o])=>`\`${o}\``).join(", ")}`)}for(const[s,o]of n)this._resolver.addLanguage(o);for(const[s,o]of n)this.loadLanguage(o)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(e){this._langMap.set(e.name,e),this._langGraph.set(e.name,e);const n=e.embeddedLanguages??e.embeddedLangs;if(n)for(const r of n)this._langGraph.set(r,this._langMap.get(r))}}class Da{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(e,n){this._onigLib={createOnigScanner:r=>e.createScanner(r),createOnigString:r=>e.createString(r)},n.forEach(r=>this.addLanguage(r))}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(n=>{this._langs.set(n,e)}),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach(n=>{this._injections.get(n)||this._injections.set(n,[]),this._injections.get(n).push(e.scopeName)})}getInjections(e){const n=e.split(".");let r=[];for(let s=1;s<=n.length;s++){const o=n.slice(0,s).join(".");r=[...r,...this._injections.get(o)||[]]}return r}}let $e=0;function Ba(t){$e+=1,t.warnings!==!1&&$e>=10&&$e%10===0&&console.warn(`[Shiki] ${$e} 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 e=!1;if(!t.engine)throw new xe("`engine` option is required for synchronous mode");const n=(t.langs||[]).flat(1),r=(t.themes||[]).flat(1).map(In),s=new Da(t.engine,n),o=new Oa(s,r,n,t.langAlias);let i;function l(m){return ys(m,t.langAlias)}function a(m){g();const _=o.getGrammar(typeof m=="string"?m:m.name);if(!_)throw new xe(`Language \`${m}\` not found, you may need to load it first`);return _}function c(m){if(m==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};g();const _=o.getTheme(m);if(!_)throw new xe(`Theme \`${m}\` not found, you may need to load it first`);return _}function u(m){g();const _=c(m);i!==m&&(o.setTheme(_),i=m);const S=o.getColorMap();return{theme:_,colorMap:S}}function f(){return g(),o.getLoadedThemes()}function h(){return g(),o.getLoadedLanguages()}function p(...m){g(),o.loadLanguages(m.flat(1))}async function d(...m){return p(await gs(m))}function b(...m){g();for(const _ of m.flat(1))o.loadTheme(_)}async function w(...m){return g(),b(await ms(m))}function g(){if(e)throw new xe("Shiki instance has been disposed")}function y(){e||(e=!0,o.dispose(),$e-=1)}return{setTheme:u,getTheme:c,getLanguage:a,getLoadedThemes:f,getLoadedLanguages:h,resolveLangAlias:l,loadLanguage:d,loadLanguageSync:p,loadTheme:w,loadThemeSync:b,dispose:y,[Symbol.dispose]:y}}async function Ga(t){t.engine||Ma("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");const[e,n,r]=await Promise.all([ms(t.themes||[]),gs(t.langs||[]),t.engine]);return Ba({...t,themes:e,langs:n,engine:r})}async function Fa(t){const e=await Ga(t);return{getLastGrammarState:(...n)=>_a(e,...n),codeToTokensBase:(n,r)=>xn(e,n,r),codeToTokensWithThemes:(n,r)=>ps(e,n,r),codeToTokens:(n,r)=>gt(e,n,r),codeToHast:(n,r)=>mt(e,n,r),codeToHtml:(n,r)=>Pa(e,n,r),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...e,getInternalContext:()=>e}}function Ne(t){if([...t].length!==1)throw new Error(`Expected "${t}" to be a single code point`);return t.codePointAt(0)}function Ua(t,e,n){return t.has(e)||t.set(e,n),t.get(e)}const An=new Set(["alnum","alpha","ascii","blank","cntrl","digit","graph","lower","print","punct","space","upper","word","xdigit"]),j=String.raw;function Te(t,e){if(t==null)throw new Error(e??"Value expected");return t}const bs=j`\[\^?`,ws=`c.? | C(?:-.?)?|${j`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${j`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${j`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${j`o\{[^\}]*\}?`}|${j`\d{1,3}`}`,Rn=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,Ze=new RegExp(j`
11
+ \f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function Gi(t,e,n,r){const s=r.schema,o=s.space==="svg"?!1:r.settings.omitOptionalTags;let i=s.space==="svg"?r.settings.closeEmptyElements:r.settings.voids.includes(t.tagName.toLowerCase());const l=[];let a;s.space==="html"&&t.tagName==="svg"&&(r.schema=os);const c=Fi(r,t.properties),u=r.all(s.space==="html"&&t.tagName==="template"?t.content:t);return r.schema=s,u&&(i=!1),(c||!o||!Pi(t,e,n))&&(l.push("<",t.tagName,c?" "+c:""),i&&(s.space==="svg"||r.settings.closeSelfClosing)&&(a=c.charAt(c.length-1),(!r.settings.tightSelfClosing||a==="/"||a&&a!=='"'&&a!=="'")&&l.push(" "),l.push("/")),l.push(">")),l.push(u),!i&&(!o||!_n(t,e,n))&&l.push("</"+t.tagName+">"),l.join("")}function Fi(t,e){const n=[];let r=-1,s;if(e){for(s in e)if(e[s]!==null&&e[s]!==void 0){const o=Ui(t,s,e[s]);o&&n.push(o)}}for(;++r<n.length;){const o=t.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&o!=='"'&&o!=="'"&&(n[r]+=" ")}return n.join("")}function Ui(t,e,n){const r=Wo(t.schema,e),s=t.settings.allowParseErrors&&t.schema.space==="html"?0:1,o=t.settings.allowDangerousCharacters?0:1;let i=t.quote,l;if(r.overloadedBoolean&&(n===r.attribute||n==="")?n=!0:(r.boolean||r.overloadedBoolean)&&(typeof n!="string"||n===r.attribute||n==="")&&(n=!!n),n==null||n===!1||typeof n=="number"&&Number.isNaN(n))return"";const a=Ae(r.attribute,Object.assign({},t.settings.characterReferences,{subset:Xe.name[s][o]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?mi:yi)(n,{padLeft:!t.settings.tightCommaSeparatedLists}):String(n),t.settings.collapseEmptyAttributes&&!n)?a:(t.settings.preferUnquoted&&(l=Ae(n,Object.assign({},t.settings.characterReferences,{attribute:!0,subset:Xe.unquoted[s][o]}))),l!==n&&(t.settings.quoteSmart&&Kn(n,i)>Kn(n,t.alternative)&&(i=t.alternative),l=i+Ae(n,Object.assign({},t.settings.characterReferences,{subset:(i==="'"?Xe.single:Xe.double)[s][o],attribute:!0}))+i),a+(l&&"="+l))}const ji=["<","&"];function us(t,e,n,r){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?t.value:Ae(t.value,Object.assign({},r.settings.characterReferences,{subset:ji}))}function zi(t,e,n,r){return r.settings.allowDangerousHtml?t.value:us(t,e,n,r)}function Wi(t,e,n,r){return r.all(t)}const Hi=Ko("type",{invalid:Vi,unknown:qi,handlers:{comment:pi,doctype:gi,element:Gi,raw:zi,root:Wi,text:us}});function Vi(t){throw new Error("Expected node, not `"+t+"`")}function qi(t){const e=t;throw new Error("Cannot compile unknown node `"+e.type+"`")}const Ki={},Xi={},Zi=[];function Qi(t,e){const n=e||Ki,r=n.quote||'"',s=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:Yi,all:Ji,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||Bo,characterReferences:n.characterReferences||Xi,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?os:qo,quote:r,alternative:s}.one(Array.isArray(t)?{type:"root",children:t}:t,void 0,void 0)}function Yi(t,e,n){return Hi(t,e,n,this)}function Ji(t){const e=[],n=t&&t.children||Zi;let r=-1;for(;++r<n.length;)e[r]=this.one(n[r],r,t);return e.join("")}function ht(t,e){const n=typeof t=="string"?{}:{...t.colorReplacements},r=typeof t=="string"?t:t.name;for(const[s,o]of Object.entries(e?.colorReplacements||{}))typeof o=="string"?n[s]=o:s===r&&Object.assign(n,o);return n}function fe(t,e){return t&&(e?.[t?.toLowerCase()]||t)}function ea(t){return Array.isArray(t)?t:[t]}async function fs(t){return Promise.resolve(typeof t=="function"?t():t).then(e=>e.default||e)}function Sn(t){return!t||["plaintext","txt","text","plain"].includes(t)}function ta(t){return t==="ansi"||Sn(t)}function kn(t){return t==="none"}function na(t){return kn(t)}function hs(t,e){if(!e)return t;t.properties||={},t.properties.class||=[],typeof t.properties.class=="string"&&(t.properties.class=t.properties.class.split(/\s+/g)),Array.isArray(t.properties.class)||(t.properties.class=[]);const n=Array.isArray(e)?e:e.split(/\s+/g);for(const r of n)r&&!t.properties.class.includes(r)&&t.properties.class.push(r);return t}function Ct(t,e=!1){if(t.length===0)return[["",0]];const n=t.split(/(\r?\n)/g);let r=0;const s=[];for(let o=0;o<n.length;o+=2){const i=e?n[o]+(n[o+1]||""):n[o];s.push([i,r]),r+=n[o].length,r+=n[o+1]?.length||0}return s}function ra(t){const e=Ct(t,!0).map(([s])=>s);function n(s){if(s===t.length)return{line:e.length-1,character:e[e.length-1].length};let o=s,i=0;for(const l of e){if(o<l.length)break;o-=l.length,i++}return{line:i,character:o}}function r(s,o){let i=0;for(let l=0;l<s;l++)i+=e[l].length;return i+=o,i}return{lines:e,indexToPos:n,posToIndex:r}}const vn="light-dark()",sa=["color","background-color"];function oa(t,e){let n=0;const r=[];for(const s of e)s>n&&r.push({...t,content:t.content.slice(n,s),offset:t.offset+n}),n=s;return n<t.content.length&&r.push({...t,content:t.content.slice(n),offset:t.offset+n}),r}function ia(t,e){const n=Array.from(e instanceof Set?e:new Set(e)).sort((r,s)=>r-s);return n.length?t.map(r=>r.flatMap(s=>{const o=n.filter(i=>s.offset<i&&i<s.offset+s.content.length).map(i=>i-s.offset).sort((i,l)=>i-l);return o.length?oa(s,o):s})):t}function aa(t,e,n,r,s="css-vars"){const o={content:t.content,explanation:t.explanation,offset:t.offset},i=e.map(u=>dt(t.variants[u])),l=new Set(i.flatMap(u=>Object.keys(u))),a={},c=(u,f)=>{const h=f==="color"?"":f==="background-color"?"-bg":`-${f}`;return n+e[u]+(f==="color"?"":h)};return i.forEach((u,f)=>{for(const h of l){const p=u[h]||"inherit";if(f===0&&r&&sa.includes(h))if(r===vn&&i.length>1){const d=e.findIndex(y=>y==="light"),b=e.findIndex(y=>y==="dark");if(d===-1||b===-1)throw new U('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');const w=i[d][h]||"inherit",g=i[b][h]||"inherit";a[h]=`light-dark(${w}, ${g})`,s==="css-vars"&&(a[c(f,h)]=p)}else a[h]=p;else s==="css-vars"&&(a[c(f,h)]=p)}}),o.htmlStyle=a,o}function dt(t){const e={};if(t.color&&(e.color=t.color),t.bgColor&&(e["background-color"]=t.bgColor),t.fontStyle){t.fontStyle&W.Italic&&(e["font-style"]="italic"),t.fontStyle&W.Bold&&(e["font-weight"]="bold");const n=[];t.fontStyle&W.Underline&&n.push("underline"),t.fontStyle&W.Strikethrough&&n.push("line-through"),n.length&&(e["text-decoration"]=n.join(" "))}return e}function an(t){return typeof t=="string"?t:Object.entries(t).map(([e,n])=>`${e}:${n}`).join(";")}const ds=new WeakMap;function _t(t,e){ds.set(t,e)}function je(t){return ds.get(t)}class Ne{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(e,n){return new Ne(Object.fromEntries(ea(n).map(r=>[r,tn])),e)}constructor(...e){if(e.length===2){const[n,r]=e;this.lang=r,this._stacks=n}else{const[n,r,s]=e;this.lang=r,this._stacks={[s]:n}}}getInternalStack(e=this.theme){return this._stacks[e]}getScopes(e=this.theme){return la(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}}function la(t){const e=[],n=new Set;function r(s){if(n.has(s))return;n.add(s);const o=s?.nameScopesList?.scopeName;o&&e.push(o),s.parent&&r(s.parent)}return r(t),e}function ca(t,e){if(!(t instanceof Ne))throw new U("Invalid grammar state");return t.getInternalStack(e)}function ua(){const t=new WeakMap;function e(n){if(!t.has(n.meta)){let r=function(i){if(typeof i=="number"){if(i<0||i>n.source.length)throw new U(`Invalid decoration offset: ${i}. Code length: ${n.source.length}`);return{...s.indexToPos(i),offset:i}}else{const l=s.lines[i.line];if(l===void 0)throw new U(`Invalid decoration position ${JSON.stringify(i)}. Lines length: ${s.lines.length}`);let a=i.character;if(a<0&&(a=l.length+a),a<0||a>l.length)throw new U(`Invalid decoration position ${JSON.stringify(i)}. Line ${i.line} length: ${l.length}`);return{...i,character:a,offset:s.posToIndex(i.line,a)}}};const s=ra(n.source),o=(n.options.decorations||[]).map(i=>({...i,start:r(i.start),end:r(i.end)}));fa(o),t.set(n.meta,{decorations:o,converter:s,source:n.source})}return t.get(n.meta)}return{name:"shiki:decorations",tokens(n){if(!this.options.decorations?.length)return;const s=e(this).decorations.flatMap(i=>[i.start.offset,i.end.offset]);return ia(n,s)},code(n){if(!this.options.decorations?.length)return;const r=e(this),s=Array.from(n.children).filter(u=>u.type==="element"&&u.tagName==="span");if(s.length!==r.converter.lines.length)throw new U(`Number of lines in code element (${s.length}) does not match the number of lines in the source (${r.converter.lines.length}). Failed to apply decorations.`);function o(u,f,h,p){const d=s[u];let b="",w=-1,g=-1;if(f===0&&(w=0),h===0&&(g=0),h===Number.POSITIVE_INFINITY&&(g=d.children.length),w===-1||g===-1)for(let m=0;m<d.children.length;m++)b+=ps(d.children[m]),w===-1&&b.length===f&&(w=m+1),g===-1&&b.length===h&&(g=m+1);if(w===-1)throw new U(`Failed to find start index for decoration ${JSON.stringify(p.start)}`);if(g===-1)throw new U(`Failed to find end index for decoration ${JSON.stringify(p.end)}`);const y=d.children.slice(w,g);if(!p.alwaysWrap&&y.length===d.children.length)l(d,p,"line");else if(!p.alwaysWrap&&y.length===1&&y[0].type==="element")l(y[0],p,"token");else{const m={type:"element",tagName:"span",properties:{},children:y};l(m,p,"wrapper"),d.children.splice(w,y.length,m)}}function i(u,f){s[u]=l(s[u],f,"line")}function l(u,f,h){const p=f.properties||{},d=f.transform||(b=>b);return u.tagName=f.tagName||"span",u.properties={...u.properties,...p,class:u.properties.class},f.properties?.class&&hs(u,f.properties.class),u=d(u,h)||u,u}const a=[],c=r.decorations.sort((u,f)=>f.start.offset-u.start.offset||u.end.offset-f.end.offset);for(const u of c){const{start:f,end:h}=u;if(f.line===h.line)o(f.line,f.character,h.character,u);else if(f.line<h.line){o(f.line,f.character,Number.POSITIVE_INFINITY,u);for(let p=f.line+1;p<h.line;p++)a.unshift(()=>i(p,u));o(h.line,0,h.character,u)}}a.forEach(u=>u())}}}function fa(t){for(let e=0;e<t.length;e++){const n=t[e];if(n.start.offset>n.end.offset)throw new U(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let r=e+1;r<t.length;r++){const s=t[r],o=n.start.offset<=s.start.offset&&s.start.offset<n.end.offset,i=n.start.offset<s.end.offset&&s.end.offset<=n.end.offset,l=s.start.offset<=n.start.offset&&n.start.offset<s.end.offset,a=s.start.offset<n.end.offset&&n.end.offset<=s.end.offset;if(o||i||l||a){if(o&&i||l&&a||l&&n.start.offset===n.end.offset||i&&s.start.offset===s.end.offset)continue;throw new U(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(s.start)} intersect.`)}}}}function ps(t){return t.type==="text"?t.value:t.type==="element"?t.children.map(ps).join(""):""}const ha=[ua()];function pt(t){const e=da(t.transformers||[]);return[...e.pre,...e.normal,...e.post,...ha]}function da(t){const e=[],n=[],r=[];for(const s of t)switch(s.enforce){case"pre":e.push(s);break;case"post":n.push(s);break;default:r.push(s)}return{pre:e,post:n,normal:r}}var me=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],$t={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",8:"hidden",9:"strikethrough"};function pa(t,e){const n=t.indexOf("\x1B",e);if(n!==-1&&t[n+1]==="["){const r=t.indexOf("m",n);if(r!==-1)return{sequence:t.substring(n+2,r).split(";"),startPosition:n,position:r+1}}return{position:t.length}}function Yn(t){const e=t.shift();if(e==="2"){const n=t.splice(0,3).map(r=>Number.parseInt(r));return n.length!==3||n.some(r=>Number.isNaN(r))?void 0:{type:"rgb",rgb:n}}else if(e==="5"){const n=t.shift();if(n)return{type:"table",index:Number(n)}}}function ga(t){const e=[];for(;t.length>0;){const n=t.shift();if(!n)continue;const r=Number.parseInt(n);if(!Number.isNaN(r))if(r===0)e.push({type:"resetAll"});else if(r<=9)$t[r]&&e.push({type:"setDecoration",value:$t[r]});else if(r<=29){const s=$t[r-20];s&&(e.push({type:"resetDecoration",value:s}),s==="dim"&&e.push({type:"resetDecoration",value:"bold"}))}else if(r<=37)e.push({type:"setForegroundColor",value:{type:"named",name:me[r-30]}});else if(r===38){const s=Yn(t);s&&e.push({type:"setForegroundColor",value:s})}else if(r===39)e.push({type:"resetForegroundColor"});else if(r<=47)e.push({type:"setBackgroundColor",value:{type:"named",name:me[r-40]}});else if(r===48){const s=Yn(t);s&&e.push({type:"setBackgroundColor",value:s})}else r===49?e.push({type:"resetBackgroundColor"}):r===53?e.push({type:"setDecoration",value:"overline"}):r===55?e.push({type:"resetDecoration",value:"overline"}):r>=90&&r<=97?e.push({type:"setForegroundColor",value:{type:"named",name:me[r-90+8]}}):r>=100&&r<=107&&e.push({type:"setBackgroundColor",value:{type:"named",name:me[r-100+8]}})}return e}function ma(){let t=null,e=null,n=new Set;return{parse(r){const s=[];let o=0;do{const i=pa(r,o),l=i.sequence?r.substring(o,i.startPosition):r.substring(o);if(l.length>0&&s.push({value:l,foreground:t,background:e,decorations:new Set(n)}),i.sequence){const a=ga(i.sequence);for(const c of a)c.type==="resetAll"?(t=null,e=null,n.clear()):c.type==="resetForegroundColor"?t=null:c.type==="resetBackgroundColor"?e=null:c.type==="resetDecoration"&&n.delete(c.value);for(const c of a)c.type==="setForegroundColor"?t=c.value:c.type==="setBackgroundColor"?e=c.value:c.type==="setDecoration"&&n.add(c.value)}o=i.position}while(o<r.length);return s}}}var ya={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 ba(t=ya){function e(l){return t[l]}function n(l){return`#${l.map(a=>Math.max(0,Math.min(a,255)).toString(16).padStart(2,"0")).join("")}`}let r;function s(){if(r)return r;r=[];for(let c=0;c<me.length;c++)r.push(e(me[c]));let l=[0,95,135,175,215,255];for(let c=0;c<6;c++)for(let u=0;u<6;u++)for(let f=0;f<6;f++)r.push(n([l[c],l[u],l[f]]));let a=8;for(let c=0;c<24;c++,a+=10)r.push(n([a,a,a]));return r}function o(l){return s()[l]}function i(l){switch(l.type){case"named":return e(l.name);case"rgb":return n(l.rgb);case"table":return o(l.index)}}return{value:i}}const wa={black:"#000000",red:"#cd3131",green:"#0DBC79",yellow:"#E5E510",blue:"#2472C8",magenta:"#BC3FBC",cyan:"#11A8CD",white:"#E5E5E5",brightBlack:"#666666",brightRed:"#F14C4C",brightGreen:"#23D18B",brightYellow:"#F5F543",brightBlue:"#3B8EEA",brightMagenta:"#D670D6",brightCyan:"#29B8DB",brightWhite:"#FFFFFF"};function Ca(t,e,n){const r=ht(t,n),s=Ct(e),o=Object.fromEntries(me.map(a=>{const c=`terminal.ansi${a[0].toUpperCase()}${a.substring(1)}`,u=t.colors?.[c];return[a,u||wa[a]]})),i=ba(o),l=ma();return s.map(a=>l.parse(a[0]).map(c=>{let u,f;c.decorations.has("reverse")?(u=c.background?i.value(c.background):t.bg,f=c.foreground?i.value(c.foreground):t.fg):(u=c.foreground?i.value(c.foreground):t.fg,f=c.background?i.value(c.background):void 0),u=fe(u,r),f=fe(f,r),c.decorations.has("dim")&&(u=_a(u));let h=W.None;return c.decorations.has("bold")&&(h|=W.Bold),c.decorations.has("italic")&&(h|=W.Italic),c.decorations.has("underline")&&(h|=W.Underline),c.decorations.has("strikethrough")&&(h|=W.Strikethrough),{content:c.value,offset:a[1],color:u,bgColor:f,fontStyle:h}}))}function _a(t){const e=t.match(/#([0-9a-f]{3,8})/i);if(e){const r=e[1];if(r.length===8){const s=Math.round(Number.parseInt(r.slice(6,8),16)/2).toString(16).padStart(2,"0");return`#${r.slice(0,6)}${s}`}else{if(r.length===6)return`#${r}80`;if(r.length===4){const s=r[0],o=r[1],i=r[2],l=r[3],a=Math.round(Number.parseInt(`${l}${l}`,16)/2).toString(16).padStart(2,"0");return`#${s}${s}${o}${o}${i}${i}${a}`}else if(r.length===3){const s=r[0],o=r[1],i=r[2];return`#${s}${s}${o}${o}${i}${i}80`}}}const n=t.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return n?`var(${n[1]}-dim)`:t}function xn(t,e,n={}){const{theme:r=t.getLoadedThemes()[0]}=n,s=t.resolveLangAlias(n.lang||"text");if(Sn(s)||kn(r))return Ct(e).map(a=>[{content:a[0],offset:a[1]}]);const{theme:o,colorMap:i}=t.setTheme(r);if(s==="ansi")return Ca(o,e,n);const l=t.getLanguage(n.lang||"text");if(n.grammarState){if(n.grammarState.lang!==l.name)throw new U(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${l.name}"`);if(!n.grammarState.themes.includes(o.name))throw new U(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${o.name}"`)}return ka(e,l,o,i,n)}function Sa(...t){if(t.length===2)return je(t[1]);const[e,n,r={}]=t,{lang:s="text",theme:o=e.getLoadedThemes()[0]}=r;if(Sn(s)||kn(o))throw new U("Plain language does not have grammar state");if(s==="ansi")throw new U("ANSI language does not have grammar state");const{theme:i,colorMap:l}=e.setTheme(o),a=e.getLanguage(s);return new Ne(En(n,a,i,l,r).stateStack,a.name,i.name)}function ka(t,e,n,r,s){const o=En(t,e,n,r,s),i=new Ne(o.stateStack,e.name,n.name);return _t(o.tokens,i),o.tokens}function En(t,e,n,r,s){const o=ht(n,s),{tokenizeMaxLineLength:i=0,tokenizeTimeLimit:l=500}=s,a=Ct(t);let c=s.grammarState?ca(s.grammarState,n.name)??tn:s.grammarContextCode!=null?En(s.grammarContextCode,e,n,r,{...s,grammarState:void 0,grammarContextCode:void 0}).stateStack:tn,u=[];const f=[];for(let h=0,p=a.length;h<p;h++){const[d,b]=a[h];if(d===""){u=[],f.push([]);continue}if(i>0&&d.length>=i){u=[],f.push([{content:d,offset:b,color:"",fontStyle:0}]);continue}let w,g,y;s.includeExplanation&&(w=e.tokenizeLine(d,c,l),g=w.tokens,y=0);const m=e.tokenizeLine2(d,c,l),_=m.tokens.length/2;for(let S=0;S<_;S++){const k=m.tokens[2*S],v=S+1<_?m.tokens[2*S+2]:d.length;if(k===v)continue;const A=m.tokens[2*S+1],L=fe(r[Re.getForeground(A)],o),H=Re.getFontStyle(A),he={content:d.substring(k,v),offset:b+k,color:L,fontStyle:H};if(s.includeExplanation){const E=[];if(s.includeExplanation!=="scopeName")for(const R of n.settings){let P;switch(typeof R.scope){case"string":P=R.scope.split(/,/).map(T=>T.trim());break;case"object":P=R.scope;break;default:continue}E.push({settings:R,selectors:P.map(T=>T.split(/ /))})}he.explanation=[];let V=0;for(;k+V<v;){const R=g[y],P=d.substring(R.startIndex,R.endIndex);V+=P.length,he.explanation.push({content:P,scopes:s.includeExplanation==="scopeName"?va(R.scopes):xa(E,R.scopes)}),y+=1}}u.push(he)}f.push(u),u=[],c=m.ruleStack}return{tokens:f,stateStack:c}}function va(t){return t.map(e=>({scopeName:e}))}function xa(t,e){const n=[];for(let r=0,s=e.length;r<s;r++){const o=e[r];n[r]={scopeName:o,themeMatches:Ia(t,o,e.slice(0,r))}}return n}function Jn(t,e){return t===e||e.substring(0,t.length)===t&&e[t.length]==="."}function Ea(t,e,n){if(!Jn(t[t.length-1],e))return!1;let r=t.length-2,s=n.length-1;for(;r>=0&&s>=0;)Jn(t[r],n[s])&&(r-=1),s-=1;return r===-1}function Ia(t,e,n){const r=[];for(const{selectors:s,settings:o}of t)for(const i of s)if(Ea(i,e,n)){r.push(o);break}return r}function gs(t,e,n){const r=Object.entries(n.themes).filter(a=>a[1]).map(a=>({color:a[0],theme:a[1]})),s=r.map(a=>{const c=xn(t,e,{...n,theme:a.theme}),u=je(c),f=typeof a.theme=="string"?a.theme:a.theme.name;return{tokens:c,state:u,theme:f}}),o=Aa(...s.map(a=>a.tokens)),i=o[0].map((a,c)=>a.map((u,f)=>{const h={content:u.content,variants:{},offset:u.offset};return"includeExplanation"in n&&n.includeExplanation&&(h.explanation=u.explanation),o.forEach((p,d)=>{const{content:b,explanation:w,offset:g,...y}=p[c][f];h.variants[r[d].color]=y}),h})),l=s[0].state?new Ne(Object.fromEntries(s.map(a=>[a.theme,a.state?.getInternalStack(a.theme)])),s[0].state.lang):void 0;return l&&_t(i,l),i}function Aa(...t){const e=t.map(()=>[]),n=t.length;for(let r=0;r<t[0].length;r++){const s=t.map(a=>a[r]),o=e.map(()=>[]);e.forEach((a,c)=>a.push(o[c]));const i=s.map(()=>0),l=s.map(a=>a[0]);for(;l.every(a=>a);){const a=Math.min(...l.map(c=>c.content.length));for(let c=0;c<n;c++){const u=l[c];u.content.length===a?(o[c].push(u),i[c]+=1,l[c]=s[c][i[c]]):(o[c].push({...u,content:u.content.slice(0,a)}),l[c]={...u,content:u.content.slice(a),offset:u.offset+a})}}}return e}function gt(t,e,n){let r,s,o,i,l,a;if("themes"in n){const{defaultColor:c="light",cssVariablePrefix:u="--shiki-",colorsRendering:f="css-vars"}=n,h=Object.entries(n.themes).filter(g=>g[1]).map(g=>({color:g[0],theme:g[1]})).sort((g,y)=>g.color===c?-1:y.color===c?1:0);if(h.length===0)throw new U("`themes` option must not be empty");const p=gs(t,e,n);if(a=je(p),c&&vn!==c&&!h.find(g=>g.color===c))throw new U(`\`themes\` option must contain the defaultColor key \`${c}\``);const d=h.map(g=>t.getTheme(g.theme)),b=h.map(g=>g.color);o=p.map(g=>g.map(y=>aa(y,b,u,c,f))),a&&_t(o,a);const w=h.map(g=>ht(g.theme,n));s=er(h,d,w,u,c,"fg",f),r=er(h,d,w,u,c,"bg",f),i=`shiki-themes ${d.map(g=>g.name).join(" ")}`,l=c?void 0:[s,r].join(";")}else if("theme"in n){const c=ht(n.theme,n);o=xn(t,e,n);const u=t.getTheme(n.theme);r=fe(u.bg,c),s=fe(u.fg,c),i=u.name,a=je(o)}else throw new U("Invalid options, either `theme` or `themes` must be provided");return{tokens:o,fg:s,bg:r,themeName:i,rootStyle:l,grammarState:a}}function er(t,e,n,r,s,o,i){return t.map((l,a)=>{const c=fe(e[a][o],n[a])||"inherit",u=`${r+l.color}${o==="bg"?"-bg":""}:${c}`;if(a===0&&s){if(s===vn&&t.length>1){const f=t.findIndex(b=>b.color==="light"),h=t.findIndex(b=>b.color==="dark");if(f===-1||h===-1)throw new U('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');const p=fe(e[f][o],n[f])||"inherit",d=fe(e[h][o],n[h])||"inherit";return`light-dark(${p}, ${d});${u}`}return c}return i==="css-vars"?u:null}).filter(l=>!!l).join(";")}function mt(t,e,n,r={meta:{},options:n,codeToHast:(s,o)=>mt(t,s,o),codeToTokens:(s,o)=>gt(t,s,o)}){let s=e;for(const d of pt(n))s=d.preprocess?.call(r,s,n)||s;let{tokens:o,fg:i,bg:l,themeName:a,rootStyle:c,grammarState:u}=gt(t,s,n);const{mergeWhitespaces:f=!0,mergeSameStyleTokens:h=!1}=n;f===!0?o=La(o):f==="never"&&(o=Na(o)),h&&(o=Ta(o));const p={...r,get source(){return s}};for(const d of pt(n))o=d.tokens?.call(p,o)||o;return Ra(o,{...n,fg:i,bg:l,themeName:a,rootStyle:n.rootStyle===!1?!1:n.rootStyle??c},p,u)}function Ra(t,e,n,r=je(t)){const s=pt(e),o=[],i={type:"root",children:[]},{structure:l="classic",tabindex:a="0"}=e,c={class:`shiki ${e.themeName||""}`};e.rootStyle!==!1&&(e.rootStyle!=null?c.style=e.rootStyle:c.style=`background-color:${e.bg};color:${e.fg}`),a!==!1&&a!=null&&(c.tabindex=a.toString());for(const[b,w]of Object.entries(e.meta||{}))b.startsWith("_")||(c[b]=w);let u={type:"element",tagName:"pre",properties:c,children:[],data:e.data},f={type:"element",tagName:"code",properties:{},children:o};const h=[],p={...n,structure:l,addClassToHast:hs,get source(){return n.source},get tokens(){return t},get options(){return e},get root(){return i},get pre(){return u},get code(){return f},get lines(){return h}};if(t.forEach((b,w)=>{w&&(l==="inline"?i.children.push({type:"element",tagName:"br",properties:{},children:[]}):l==="classic"&&o.push({type:"text",value:`
12
+ `}));let g={type:"element",tagName:"span",properties:{class:"line"},children:[]},y=0;for(const m of b){let _={type:"element",tagName:"span",properties:{...m.htmlAttrs},children:[{type:"text",value:m.content}]};const S=an(m.htmlStyle||dt(m));S&&(_.properties.style=S);for(const k of s)_=k?.span?.call(p,_,w+1,y,g,m)||_;l==="inline"?i.children.push(_):l==="classic"&&g.children.push(_),y+=m.content.length}if(l==="classic"){for(const m of s)g=m?.line?.call(p,g,w+1)||g;h.push(g),o.push(g)}else l==="inline"&&h.push(g)}),l==="classic"){for(const b of s)f=b?.code?.call(p,f)||f;u.children.push(f);for(const b of s)u=b?.pre?.call(p,u)||u;i.children.push(u)}else if(l==="inline"){const b=[];let w={type:"element",tagName:"span",properties:{class:"line"},children:[]};for(const m of i.children)m.type==="element"&&m.tagName==="br"?(b.push(w),w={type:"element",tagName:"span",properties:{class:"line"},children:[]}):(m.type==="element"||m.type==="text")&&w.children.push(m);b.push(w);let y={type:"element",tagName:"code",properties:{},children:b};for(const m of s)y=m?.code?.call(p,y)||y;i.children=[];for(let m=0;m<y.children.length;m++){m>0&&i.children.push({type:"element",tagName:"br",properties:{},children:[]});const _=y.children[m];_.type==="element"&&i.children.push(..._.children)}}let d=i;for(const b of s)d=b?.root?.call(p,d)||d;return r&&_t(d,r),d}function La(t){return t.map(e=>{const n=[];let r="",s;return e.forEach((o,i)=>{const a=!(o.fontStyle&&(o.fontStyle&W.Underline||o.fontStyle&W.Strikethrough));a&&o.content.match(/^\s+$/)&&e[i+1]?(s===void 0&&(s=o.offset),r+=o.content):r?(a?n.push({...o,offset:s,content:r+o.content}):n.push({content:r,offset:s},o),s=void 0,r=""):n.push(o)}),n})}function Na(t){return t.map(e=>e.flatMap(n=>{if(n.content.match(/^\s+$/))return n;const r=n.content.match(/^(\s*)(.*?)(\s*)$/);if(!r)return n;const[,s,o,i]=r;if(!s&&!i)return n;const l=[{...n,offset:n.offset+s.length,content:o}];return s&&l.unshift({content:s,offset:n.offset}),i&&l.push({content:i,offset:n.offset+s.length+o.length}),l}))}function Ta(t){return t.map(e=>{const n=[];for(const r of e){if(n.length===0){n.push({...r});continue}const s=n[n.length-1],o=an(s.htmlStyle||dt(s)),i=an(r.htmlStyle||dt(r)),l=s.fontStyle&&(s.fontStyle&W.Underline||s.fontStyle&W.Strikethrough),a=r.fontStyle&&(r.fontStyle&W.Underline||r.fontStyle&W.Strikethrough);!l&&!a&&o===i?s.content+=r.content:n.push({...r})}return n})}const Pa=Qi;function $a(t,e,n){const r={meta:{},options:n,codeToHast:(o,i)=>mt(t,o,i),codeToTokens:(o,i)=>gt(t,o,i)};let s=Pa(mt(t,e,n,r));for(const o of pt(n))s=o.postprocess?.call(r,s,n)||s;return s}const tr={light:"#333333",dark:"#bbbbbb"},nr={light:"#fffffe",dark:"#1e1e1e"},rr="__shiki_resolved";function In(t){if(t?.[rr])return t;const e={...t};e.tokenColors&&!e.settings&&(e.settings=e.tokenColors,delete e.tokenColors),e.type||="dark",e.colorReplacements={...e.colorReplacements},e.settings||=[];let{bg:n,fg:r}=e;if(!n||!r){const l=e.settings?e.settings.find(a=>!a.name&&!a.scope):void 0;l?.settings?.foreground&&(r=l.settings.foreground),l?.settings?.background&&(n=l.settings.background),!r&&e?.colors?.["editor.foreground"]&&(r=e.colors["editor.foreground"]),!n&&e?.colors?.["editor.background"]&&(n=e.colors["editor.background"]),r||(r=e.type==="light"?tr.light:tr.dark),n||(n=e.type==="light"?nr.light:nr.dark),e.fg=r,e.bg=n}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 i(l){if(o.has(l))return o.get(l);s+=1;const a=`#${s.toString(16).padStart(8,"0").toLowerCase()}`;return e.colorReplacements?.[`#${a}`]?i(l):(o.set(l,a),a)}e.settings=e.settings.map(l=>{const a=l.settings?.foreground&&!l.settings.foreground.startsWith("#"),c=l.settings?.background&&!l.settings.background.startsWith("#");if(!a&&!c)return l;const u={...l,settings:{...l.settings}};if(a){const f=i(l.settings.foreground);e.colorReplacements[f]=l.settings.foreground,u.settings.foreground=f}if(c){const f=i(l.settings.background);e.colorReplacements[f]=l.settings.background,u.settings.background=f}return u});for(const l of Object.keys(e.colors||{}))if((l==="editor.foreground"||l==="editor.background"||l.startsWith("terminal.ansi"))&&!e.colors[l]?.startsWith("#")){const a=i(e.colors[l]);e.colorReplacements[a]=e.colors[l],e.colors[l]=a}return Object.defineProperty(e,rr,{enumerable:!1,writable:!1,value:!0}),e}async function ms(t){return Array.from(new Set((await Promise.all(t.filter(e=>!ta(e)).map(async e=>await fs(e).then(n=>Array.isArray(n)?n:[n])))).flat()))}async function ys(t){return(await Promise.all(t.map(async n=>na(n)?null:In(await fs(n))))).filter(n=>!!n)}let Ma=3;function Oa(t,e=3){e>Ma||console.trace(`[SHIKI DEPRECATE]: ${t}`)}let Ee=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function bs(t,e){if(!e)return t;if(e[t]){const n=new Set([t]);for(;e[t];){if(t=e[t],n.has(t))throw new Ee(`Circular alias \`${Array.from(n).join(" -> ")} -> ${t}\``);n.add(t)}}return t}class Da extends Do{constructor(e,n,r,s={}){super(e),this._resolver=e,this._themes=n,this._langs=r,this._alias=s,this._themes.map(o=>this.loadTheme(o)),this.loadLanguages(this._langs)}_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;getTheme(e){return typeof e=="string"?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){const n=In(e);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(e){let n=this._textmateThemeCache.get(e);n||(n=at.createFromRawTheme(e),this._textmateThemeCache.set(e,n)),this._syncRegistry.setTheme(n)}getGrammar(e){return e=bs(e,this._alias),this._resolvedGrammars.get(e)}loadLanguage(e){if(this.getGrammar(e.name))return;const n=new Set([...this._langMap.values()].filter(o=>o.embeddedLangsLazy?.includes(e.name)));this._resolver.addLanguage(e);const r={balancedBracketSelectors:e.balancedBracketSelectors||["*"],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);const s=this.loadGrammarWithConfiguration(e.scopeName,1,r);if(s.name=e.name,this._resolvedGrammars.set(e.name,s),e.aliases&&e.aliases.forEach(o=>{this._alias[o]=e.name}),this._loadedLanguagesCache=null,n.size)for(const o of n)this._resolvedGrammars.delete(o.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(o.scopeName),this._syncRegistry?._grammars?.delete(o.scopeName),this.loadLanguage(this._langMap.get(o.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(e){for(const s of e)this.resolveEmbeddedLanguages(s);const n=Array.from(this._langGraph.entries()),r=n.filter(([s,o])=>!o);if(r.length){const s=n.filter(([o,i])=>i?(i.embeddedLanguages||i.embeddedLangs)?.some(a=>r.map(([c])=>c).includes(a)):!1).filter(o=>!r.includes(o));throw new Ee(`Missing languages ${r.map(([o])=>`\`${o}\``).join(", ")}, required by ${s.map(([o])=>`\`${o}\``).join(", ")}`)}for(const[s,o]of n)this._resolver.addLanguage(o);for(const[s,o]of n)this.loadLanguage(o)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(e){this._langMap.set(e.name,e),this._langGraph.set(e.name,e);const n=e.embeddedLanguages??e.embeddedLangs;if(n)for(const r of n)this._langGraph.set(r,this._langMap.get(r))}}class Ba{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(e,n){this._onigLib={createOnigScanner:r=>e.createScanner(r),createOnigString:r=>e.createString(r)},n.forEach(r=>this.addLanguage(r))}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(n=>{this._langs.set(n,e)}),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach(n=>{this._injections.get(n)||this._injections.set(n,[]),this._injections.get(n).push(e.scopeName)})}getInjections(e){const n=e.split(".");let r=[];for(let s=1;s<=n.length;s++){const o=n.slice(0,s).join(".");r=[...r,...this._injections.get(o)||[]]}return r}}let Me=0;function Ga(t){Me+=1,t.warnings!==!1&&Me>=10&&Me%10===0&&console.warn(`[Shiki] ${Me} 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 e=!1;if(!t.engine)throw new Ee("`engine` option is required for synchronous mode");const n=(t.langs||[]).flat(1),r=(t.themes||[]).flat(1).map(In),s=new Ba(t.engine,n),o=new Da(s,r,n,t.langAlias);let i;function l(m){return bs(m,t.langAlias)}function a(m){g();const _=o.getGrammar(typeof m=="string"?m:m.name);if(!_)throw new Ee(`Language \`${m}\` not found, you may need to load it first`);return _}function c(m){if(m==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};g();const _=o.getTheme(m);if(!_)throw new Ee(`Theme \`${m}\` not found, you may need to load it first`);return _}function u(m){g();const _=c(m);i!==m&&(o.setTheme(_),i=m);const S=o.getColorMap();return{theme:_,colorMap:S}}function f(){return g(),o.getLoadedThemes()}function h(){return g(),o.getLoadedLanguages()}function p(...m){g(),o.loadLanguages(m.flat(1))}async function d(...m){return p(await ms(m))}function b(...m){g();for(const _ of m.flat(1))o.loadTheme(_)}async function w(...m){return g(),b(await ys(m))}function g(){if(e)throw new Ee("Shiki instance has been disposed")}function y(){e||(e=!0,o.dispose(),Me-=1)}return{setTheme:u,getTheme:c,getLanguage:a,getLoadedThemes:f,getLoadedLanguages:h,resolveLangAlias:l,loadLanguage:d,loadLanguageSync:p,loadTheme:w,loadThemeSync:b,dispose:y,[Symbol.dispose]:y}}async function Fa(t){t.engine||Oa("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");const[e,n,r]=await Promise.all([ys(t.themes||[]),ms(t.langs||[]),t.engine]);return Ga({...t,themes:e,langs:n,engine:r})}async function Ua(t){const e=await Fa(t);return{getLastGrammarState:(...n)=>Sa(e,...n),codeToTokensBase:(n,r)=>xn(e,n,r),codeToTokensWithThemes:(n,r)=>gs(e,n,r),codeToTokens:(n,r)=>gt(e,n,r),codeToHast:(n,r)=>mt(e,n,r),codeToHtml:(n,r)=>$a(e,n,r),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...e,getInternalContext:()=>e}}function Te(t){if([...t].length!==1)throw new Error(`Expected "${t}" to be a single code point`);return t.codePointAt(0)}function ja(t,e,n){return t.has(e)||t.set(e,n),t.get(e)}const An=new Set(["alnum","alpha","ascii","blank","cntrl","digit","graph","lower","print","punct","space","upper","word","xdigit"]),j=String.raw;function Pe(t,e){if(t==null)throw new Error(e??"Value expected");return t}const ws=j`\[\^?`,Cs=`c.? | C(?:-.?)?|${j`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${j`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${j`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${j`o\{[^\}]*\}?`}|${j`\d{1,3}`}`,Rn=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,Ze=new RegExp(j`
13
13
  \\ (?:
14
- ${ws}
14
+ ${Cs}
15
15
  | [gk]<[^>]*>?
16
16
  | [gk]'[^']*'?
17
17
  | .
@@ -29,19 +29,19 @@ let U=class extends Error{constructor(e){super(e),this.name="ShikiError"}};funct
29
29
  | \*[^\)]*\)?
30
30
  )?
31
31
  | (?:${Rn.source})+
32
- | ${bs}
32
+ | ${ws}
33
33
  | .
34
34
  `.replace(/\s+/g,""),"gsu"),Mt=new RegExp(j`
35
35
  \\ (?:
36
- ${ws}
36
+ ${Cs}
37
37
  | .
38
38
  )
39
39
  | \[:(?:\^?\p{Alpha}+|\^):\]
40
- | ${bs}
40
+ | ${ws}
41
41
  | &&
42
42
  | .
43
- `.replace(/\s+/g,""),"gsu");function ja(t,e={}){const n={flags:"",...e,rules:{captureGroup:!1,singleline:!1,...e.rules}};if(typeof t!="string")throw new Error("String expected as pattern");const r=al(n.flags),s=[r.extended],o={captureGroup:n.rules.captureGroup,getCurrentModX(){return s.at(-1)},numOpenGroups:0,popModX(){s.pop()},pushModX(f){s.push(f)},replaceCurrentModX(f){s[s.length-1]=f},singleline:n.rules.singleline};let i=[],l;for(Ze.lastIndex=0;l=Ze.exec(t);){const f=za(o,t,l[0],Ze.lastIndex);f.tokens?i.push(...f.tokens):f.token&&i.push(f.token),f.lastIndex!==void 0&&(Ze.lastIndex=f.lastIndex)}const a=[];let c=0;i.filter(f=>f.type==="GroupOpen").forEach(f=>{f.kind==="capturing"?f.number=++c:f.raw==="("&&a.push(f)}),c||a.forEach((f,h)=>{f.kind="capturing",f.number=h+1});const u=c||a.length;return{tokens:i.map(f=>f.type==="EscapedNumber"?cl(f,u):f).flat(),flags:r}}function za(t,e,n,r){const[s,o]=n;if(n==="["||n==="[^"){const i=Wa(e,n,r);return{tokens:i.tokens,lastIndex:i.lastIndex}}if(s==="\\"){if("AbBGyYzZ".includes(o))return{token:sr(n,n)};if(/^\\g[<']/.test(n)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(n))throw new Error(`Invalid group name "${n}"`);return{token:el(n)}}if(/^\\k[<']/.test(n)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(n))throw new Error(`Invalid group name "${n}"`);return{token:_s(n)}}if(o==="K")return{token:Ss("keep",n)};if(o==="N"||o==="R")return{token:ye("newline",n,{negate:o==="N"})};if(o==="O")return{token:ye("any",n)};if(o==="X")return{token:ye("text_segment",n)};const i=Cs(n,{inCharClass:!1});return Array.isArray(i)?{tokens:i}:{token:i}}if(s==="("){if(o==="*")return{token:sl(n)};if(n==="(?{")throw new Error(`Unsupported callout "${n}"`);if(n.startsWith("(?#")){if(e[r]!==")")throw new Error('Unclosed comment group "(?#"');return{lastIndex:r+1}}if(/^\(\?[-imx]+[:)]$/.test(n))return{token:rl(n,t)};if(t.pushModX(t.getCurrentModX()),t.numOpenGroups++,n==="("&&!t.captureGroup||n==="(?:")return{token:ke("group",n)};if(n==="(?>")return{token:ke("atomic",n)};if(n==="(?="||n==="(?!"||n==="(?<="||n==="(?<!")return{token:ke(n[2]==="<"?"lookbehind":"lookahead",n,{negate:n.endsWith("!")})};if(n==="("&&t.captureGroup||n.startsWith("(?<")&&n.endsWith(">")||n.startsWith("(?'")&&n.endsWith("'"))return{token:ke("capturing",n,{...n!=="("&&{name:n.slice(3,-1)}})};if(n.startsWith("(?~")){if(n==="(?~|")throw new Error(`Unsupported absence function kind "${n}"`);return{token:ke("absence_repeater",n)}}throw n==="(?("?new Error(`Unsupported conditional "${n}"`):new Error(`Invalid or unsupported group option "${n}"`)}if(n===")"){if(t.popModX(),t.numOpenGroups--,t.numOpenGroups<0)throw new Error('Unmatched ")"');return{token:Qa(n)}}if(t.getCurrentModX()){if(n==="#"){const i=e.indexOf(`
44
- `,r);return{lastIndex:i===-1?e.length:i}}if(/^\s$/.test(n)){const i=/\s+/y;return i.lastIndex=r,{lastIndex:i.exec(e)?i.lastIndex:r}}}if(n===".")return{token:ye("dot",n)};if(n==="^"||n==="$"){const i=t.singleline?{"^":j`\A`,$:j`\Z`}[n]:n;return{token:sr(i,n)}}return n==="|"?{token:Va(n)}:Rn.test(n)?{tokens:ul(n)}:{token:ie(Ne(n),n)}}function Wa(t,e,n){const r=[or(e[1]==="^",e)];let s=1,o;for(Mt.lastIndex=n;o=Mt.exec(t);){const i=o[0];if(i[0]==="["&&i[1]!==":")s++,r.push(or(i[1]==="^",i));else if(i==="]"){if(r.at(-1).type==="CharacterClassOpen")r.push(ie(93,i));else if(s--,r.push(qa(i)),!s)break}else{const l=Ha(i);Array.isArray(l)?r.push(...l):r.push(l)}}return{tokens:r,lastIndex:Mt.lastIndex||t.length}}function Ha(t){if(t[0]==="\\")return Cs(t,{inCharClass:!0});if(t[0]==="["){const e=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(t);if(!e||!An.has(e.groups.name))throw new Error(`Invalid POSIX class "${t}"`);return ye("posix",t,{value:e.groups.name,negate:!!e.groups.negate})}return t==="-"?Xa(t):t==="&&"?Ka(t):ie(Ne(t),t)}function Cs(t,{inCharClass:e}){const n=t[1];if(n==="c"||n==="C")return nl(t);if("dDhHsSwW".includes(n))return ol(t);if(t.startsWith(j`\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 il(t)}if(new RegExp("^\\\\x[89A-Fa-f]\\p{AHex}","u").test(t))try{const r=t.split(/\\x/).slice(1).map(i=>parseInt(i,16)),s=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}).decode(new Uint8Array(r)),o=new TextEncoder;return[...s].map(i=>{const l=[...o.encode(i)].map(a=>`\\x${a.toString(16)}`).join("");return ie(Ne(i),l)})}catch{throw new Error(`Multibyte code "${t}" incomplete or invalid in Oniguruma`)}if(n==="u"||n==="x")return ie(ll(t),t);if(ir.has(n))return ie(ir.get(n),t);if(/\d/.test(n))return Za(e,t);if(t==="\\")throw new Error(j`Incomplete escape "\"`);if(n==="M")throw new Error(`Unsupported meta "${t}"`);if([...t].length===2)return ie(t.codePointAt(1),t);throw new Error(`Unexpected escape "${t}"`)}function Va(t){return{type:"Alternator",raw:t}}function sr(t,e){return{type:"Assertion",kind:t,raw:e}}function _s(t){return{type:"Backreference",raw:t}}function ie(t,e){return{type:"Character",value:t,raw:e}}function qa(t){return{type:"CharacterClassClose",raw:t}}function Xa(t){return{type:"CharacterClassHyphen",raw:t}}function Ka(t){return{type:"CharacterClassIntersector",raw:t}}function or(t,e){return{type:"CharacterClassOpen",negate:t,raw:e}}function ye(t,e,n={}){return{type:"CharacterSet",kind:t,...n,raw:e}}function Ss(t,e,n={}){return t==="keep"?{type:"Directive",kind:t,raw:e}:{type:"Directive",kind:t,flags:Te(n.flags),raw:e}}function Za(t,e){return{type:"EscapedNumber",inCharClass:t,raw:e}}function Qa(t){return{type:"GroupClose",raw:t}}function ke(t,e,n={}){return{type:"GroupOpen",kind:t,...n,raw:e}}function Ya(t,e,n,r){return{type:"NamedCallout",kind:t,tag:e,arguments:n,raw:r}}function Ja(t,e,n,r){return{type:"Quantifier",kind:t,min:e,max:n,raw:r}}function el(t){return{type:"Subroutine",raw:t}}const tl=new Set(["COUNT","CMP","ERROR","FAIL","MAX","MISMATCH","SKIP","TOTAL_COUNT"]),ir=new Map([["a",7],["b",8],["e",27],["f",12],["n",10],["r",13],["t",9],["v",11]]);function nl(t){const e=t[1]==="c"?t[2]:t[3];if(!e||!/[A-Za-z]/.test(e))throw new Error(`Unsupported control character "${t}"`);return ie(Ne(e.toUpperCase())-64,t)}function rl(t,e){let{on:n,off:r}=/^\(\?(?<on>[imx]*)(?:-(?<off>[-imx]*))?/.exec(t).groups;r??="";const s=(e.getCurrentModX()||n.includes("x"))&&!r.includes("x"),o=lr(n),i=lr(r),l={};if(o&&(l.enable=o),i&&(l.disable=i),t.endsWith(")"))return e.replaceCurrentModX(s),Ss("flags",t,{flags:l});if(t.endsWith(":"))return e.pushModX(s),e.numOpenGroups++,ke("group",t,{...(o||i)&&{flags:l}});throw new Error(`Unexpected flag modifier "${t}"`)}function sl(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:n,tag:r,args:s}=e.groups;if(!n)throw new Error(`Invalid named callout "${t}"`);if(r==="")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):[],[i,l,a]=o,c=tl.has(n)?n.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 i=="string")throw new Error(`Named callout argument must be a number "${i}"`);break;case"max":if(!o.length||o.length>2)throw new Error(`Named callout must have one or two arguments "${o}"`);if(typeof i=="string"&&!/^[A-Za-z_]\w*$/.test(i))throw new Error(`Named callout argument one must be a tag or number "${i}"`);if(o.length===2&&(typeof l=="number"||!/^[<>X]$/.test(l)))throw new Error(`Named callout optional argument two must be '<', '>', or 'X' "${l}"`);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 i=="number"||!/^[<>X]$/.test(i)))throw new Error(`Named callout optional argument must be '<', '>', or 'X' "${i}"`);break;case"cmp":if(o.length!==3)throw new Error(`Named callout must have three arguments "${o}"`);if(typeof i=="string"&&!/^[A-Za-z_]\w*$/.test(i))throw new Error(`Named callout argument one must be a tag or number "${i}"`);if(typeof l=="number"||!/^(?:[<>!=]=|[<>])$/.test(l))throw new Error(`Named callout argument two must be '==', '!=', '>', '<', '>=', or '<=' "${l}"`);if(typeof a=="string"&&!/^[A-Za-z_]\w*$/.test(a))throw new Error(`Named callout argument three must be a tag or number "${a}"`);break;case"custom":throw new Error(`Undefined callout name "${n}"`);default:throw new Error(`Unexpected named callout kind "${c}"`)}return Ya(c,r??null,s?.split(",")??null,t)}function ar(t){let e=null,n,r;if(t[0]==="{"){const{minStr:s,maxStr:o}=/^\{(?<minStr>\d*)(?:,(?<maxStr>\d*))?/.exec(t).groups,i=1e5;if(+s>i||o&&+o>i)throw new Error("Quantifier value unsupported in Oniguruma");if(n=+s,r=o===void 0?+s:o===""?1/0:+o,n>r&&(e="possessive",[n,r]=[r,n]),t.endsWith("?")){if(e==="possessive")throw new Error('Unsupported possessive interval quantifier chain with "?"');e="lazy"}else e||(e="greedy")}else n=t[0]==="+"?1:0,r=t[0]==="?"?1:1/0,e=t[1]==="+"?"possessive":t[1]==="?"?"lazy":"greedy";return Ja(e,n,r,t)}function ol(t){const e=t[1].toLowerCase();return ye({d:"digit",h:"hex",s:"space",w:"word"}[e],t,{negate:t[1]!==e})}function il(t){const{p:e,neg:n,value:r}=/^\\(?<p>[pP])\{(?<neg>\^?)(?<value>[^}]+)/.exec(t).groups;return ye("property",t,{value:r,negate:e==="P"&&!n||e==="p"&&!!n})}function lr(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 al(t){const e={ignoreCase:!1,dotAll:!1,extended:!1,digitIsAscii:!1,posixIsAscii:!1,spaceIsAscii:!1,wordIsAscii:!1,textSegmentMode:null};for(let n=0;n<t.length;n++){const r=t[n];if(!"imxDPSWy".includes(r))throw new Error(`Invalid flag "${r}"`);if(r==="y"){if(!/^y{[gw]}/.test(t.slice(n)))throw new Error('Invalid or unspecified flag "y" mode');e.textSegmentMode=t[n+2]==="g"?"grapheme":"word",n+=3;continue}e[{i:"ignoreCase",m:"dotAll",x:"extended",D:"digitIsAscii",P:"posixIsAscii",S:"spaceIsAscii",W:"wordIsAscii"}[r]]=!0}return e}function ll(t){if(new RegExp("^(?:\\\\u(?!\\p{AHex}{4})|\\\\x(?!\\p{AHex}{1,2}|\\{\\p{AHex}{1,8}\\}))","u").test(t))throw new Error(`Incomplete or invalid escape "${t}"`);const e=t[2]==="{"?new RegExp("^\\\\x\\{\\s*(?<hex>\\p{AHex}+)","u").exec(t).groups.hex:t.slice(2);return parseInt(e,16)}function cl(t,e){const{raw:n,inCharClass:r}=t,s=n.slice(1);if(!r&&(s!=="0"&&s.length===1||s[0]!=="0"&&+s<=e))return[_s(n)];const o=[],i=s.match(/^[0-7]+|\d/g);for(let l=0;l<i.length;l++){const a=i[l];let c;if(l===0&&a!=="8"&&a!=="9"){if(c=parseInt(a,8),c>127)throw new Error(j`Octal encoded byte above 177 unsupported "${n}"`)}else c=Ne(a);o.push(ie(c,(l===0?"\\":"")+a))}return o}function ul(t){const e=[],n=new RegExp(Rn,"gy");let r;for(;r=n.exec(t);){const s=r[0];if(s[0]==="{"){const o=/^\{(?<min>\d+),(?<max>\d+)\}\??$/.exec(s);if(o){const{min:i,max:l}=o.groups;if(+i>+l&&s.endsWith("?")){n.lastIndex--,e.push(ar(s.slice(0,-1)));continue}}}e.push(ar(s))}return e}function ks(t,e){if(!Array.isArray(t.body))throw new Error("Expected node with body array");if(t.body.length!==1)return!1;const n=t.body[0];return!e||Object.keys(e).every(r=>e[r]===n[r])}function fl(t){return hl.has(t.type)}const hl=new Set(["AbsenceFunction","Backreference","CapturingGroup","Character","CharacterClass","CharacterSet","Group","Quantifier","Subroutine"]);function vs(t,e={}){const n={flags:"",normalizeUnknownPropertyNames:!1,skipBackrefValidation:!1,skipLookbehindValidation:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...e,rules:{captureGroup:!1,singleline:!1,...e.rules}},r=ja(t,{flags:n.flags,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline}}),s=(h,p)=>{const d=r.tokens[o.nextIndex];switch(o.parent=h,o.nextIndex++,d.type){case"Alternator":return we();case"Assertion":return dl(d);case"Backreference":return pl(d,o);case"Character":return St(d.value,{useLastValid:!!p.isCheckingRangeEnd});case"CharacterClassHyphen":return gl(d,o,p);case"CharacterClassOpen":return ml(d,o,p);case"CharacterSet":return yl(d,o);case"Directive":return kl(d.kind,{flags:d.flags});case"GroupOpen":return bl(d,o,p);case"NamedCallout":return xl(d.kind,d.tag,d.arguments);case"Quantifier":return wl(d,o);case"Subroutine":return Cl(d,o);default:throw new Error(`Unexpected token type "${d.type}"`)}},o={capturingGroups:[],hasNumberedRef:!1,namedGroupsByName:new Map,nextIndex:0,normalizeUnknownPropertyNames:n.normalizeUnknownPropertyNames,parent:null,skipBackrefValidation:n.skipBackrefValidation,skipLookbehindValidation:n.skipLookbehindValidation,skipPropertyNameValidation:n.skipPropertyNameValidation,subroutines:[],tokens:r.tokens,unicodePropertyMap:n.unicodePropertyMap,walk:s},i=Il(vl(r.flags));let l=i.body[0];for(;o.nextIndex<r.tokens.length;){const h=s(l,{});h.type==="Alternative"?(i.body.push(h),l=h):l.body.push(h)}const{capturingGroups:a,hasNumberedRef:c,namedGroupsByName:u,subroutines:f}=o;if(c&&u.size&&!n.rules.captureGroup)throw new Error("Numbered backref/subroutine not allowed when using named capture");for(const{ref:h}of f)if(typeof h=="number"){if(h>a.length)throw new Error("Subroutine uses a group number that's not defined");h&&(a[h-1].isSubroutined=!0)}else if(u.has(h)){if(u.get(h).length>1)throw new Error(j`Subroutine uses a duplicate group name "\g<${h}>"`);u.get(h)[0].isSubroutined=!0}else throw new Error(j`Subroutine uses a group name that's not defined "\g<${h}>"`);return i}function dl({kind:t}){return ln(Te({"^":"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===j`\B`||t===j`\Y`})}function pl({raw:t},e){const n=/^\\k[<']/.test(t),r=n?t.slice(3,-1):t.slice(1),s=(o,i=!1)=>{const l=e.capturingGroups.length;let a=!1;if(o>l)if(e.skipBackrefValidation)a=!0;else throw new Error(`Not enough capturing groups defined to the left "${t}"`);return e.hasNumberedRef=!0,cn(i?l+1-o:o,{orphan:a})};if(n){const o=/^(?<sign>-?)0*(?<num>[1-9]\d*)$/.exec(r);if(o)return s(+o.groups.num,!!o.groups.sign);if(/[-+]/.test(r))throw new Error(`Invalid backref name "${t}"`);if(!e.namedGroupsByName.has(r))throw new Error(`Group name not defined to the left "${t}"`);return cn(r)}return s(+r)}function gl(t,e,n){const{tokens:r,walk:s}=e,o=e.parent,i=o.body.at(-1),l=r[e.nextIndex];if(!n.isCheckingRangeEnd&&i&&i.type!=="CharacterClass"&&i.type!=="CharacterClassRange"&&l&&l.type!=="CharacterClassOpen"&&l.type!=="CharacterClassClose"&&l.type!=="CharacterClassIntersector"){const a=s(o,{...n,isCheckingRangeEnd:!0});if(i.type==="Character"&&a.type==="Character")return o.body.pop(),Sl(i,a);throw new Error("Invalid character class range")}return St(Ne("-"))}function ml({negate:t},e,n){const{tokens:r,walk:s}=e,o=r[e.nextIndex],i=[ot()];let l=fr(o);for(;l.type!=="CharacterClassClose";){if(l.type==="CharacterClassIntersector")i.push(ot()),e.nextIndex++;else{const c=i.at(-1);c.body.push(s(c,n))}l=fr(r[e.nextIndex],o)}const a=ot({negate:t});return i.length===1?a.body=i[0].body:(a.kind="intersection",a.body=i.map(c=>c.body.length===1?c.body[0]:c)),e.nextIndex++,a}function yl({kind:t,negate:e,value:n},r){const{normalizeUnknownPropertyNames:s,skipPropertyNameValidation:o,unicodePropertyMap:i}=r;if(t==="property"){const l=kt(n);if(An.has(l)&&!i?.has(l))t="posix",n=l;else return ve(n,{negate:e,normalizeUnknownPropertyNames:s,skipPropertyNameValidation:o,unicodePropertyMap:i})}return t==="posix"?El(n,{negate:e}):un(t,{negate:e})}function bl(t,e,n){const{tokens:r,capturingGroups:s,namedGroupsByName:o,skipLookbehindValidation:i,walk:l}=e,a=Al(t),c=a.type==="AbsenceFunction",u=ur(a),f=u&&a.negate;if(a.type==="CapturingGroup"&&(s.push(a),a.name&&Ua(o,a.name,[]).push(a)),c&&n.isInAbsenceFunction)throw new Error("Nested absence function not supported by Oniguruma");let h=hr(r[e.nextIndex]);for(;h.type!=="GroupClose";){if(h.type==="Alternator")a.body.push(we()),e.nextIndex++;else{const p=a.body.at(-1),d=l(p,{...n,isInAbsenceFunction:n.isInAbsenceFunction||c,isInLookbehind:n.isInLookbehind||u,isInNegLookbehind:n.isInNegLookbehind||f});if(p.body.push(d),(u||n.isInLookbehind)&&!i){const b="Lookbehind includes a pattern not allowed by Oniguruma";if(f||n.isInNegLookbehind){if(cr(d)||d.type==="CapturingGroup")throw new Error(b)}else if(cr(d)||ur(d)&&d.negate)throw new Error(b)}}h=hr(r[e.nextIndex])}return e.nextIndex++,a}function wl({kind:t,min:e,max:n},r){const s=r.parent,o=s.body.at(-1);if(!o||!fl(o))throw new Error("Quantifier requires a repeatable token");const i=Es(t,e,n,o);return s.body.pop(),i}function Cl({raw:t},e){const{capturingGroups:n,subroutines:r}=e;let s=t.slice(3,-1);const o=/^(?<sign>[-+]?)0*(?<num>[1-9]\d*)$/.exec(s);if(o){const l=+o.groups.num,a=n.length;if(e.hasNumberedRef=!0,s={"":l,"+":a+l,"-":a+1-l}[o.groups.sign],s<1)throw new Error("Invalid subroutine number")}else s==="0"&&(s=0);const i=Is(s);return r.push(i),i}function _l(t,e){return{type:"AbsenceFunction",kind:t,body:Ve(e?.body)}}function we(t){return{type:"Alternative",body:As(t?.body)}}function ln(t,e){const n={type:"Assertion",kind:t};return(t==="word_boundary"||t==="text_segment_boundary")&&(n.negate=!!e?.negate),n}function cn(t,e){const n=!!e?.orphan;return{type:"Backreference",ref:t,...n&&{orphan:n}}}function xs(t,e){const n={name:void 0,isSubroutined:!1,...e};if(n.name!==void 0&&!Rl(n.name))throw new Error(`Group name "${n.name}" invalid in Oniguruma`);return{type:"CapturingGroup",number:t,...n.name&&{name:n.name},...n.isSubroutined&&{isSubroutined:n.isSubroutined},body:Ve(e?.body)}}function St(t,e){const n={useLastValid:!1,...e};if(t>1114111){const r=t.toString(16);if(n.useLastValid)t=1114111;else throw t>1310719?new Error(`Invalid code point out of range "\\x{${r}}"`):new Error(`Invalid code point out of range in JS "\\x{${r}}"`)}return{type:"Character",value:t}}function ot(t){const e={kind:"union",negate:!1,...t};return{type:"CharacterClass",kind:e.kind,negate:e.negate,body:As(t?.body)}}function Sl(t,e){if(e.value<t.value)throw new Error("Character class range out of order");return{type:"CharacterClassRange",min:t,max:e}}function un(t,e){const n=!!e?.negate,r={type:"CharacterSet",kind:t};return(t==="digit"||t==="hex"||t==="newline"||t==="space"||t==="word")&&(r.negate=n),(t==="text_segment"||t==="newline"&&!n)&&(r.variableLength=!0),r}function kl(t,e={}){if(t==="keep")return{type:"Directive",kind:t};if(t==="flags")return{type:"Directive",kind:t,flags:Te(e.flags)};throw new Error(`Unexpected directive kind "${t}"`)}function vl(t){return{type:"Flags",...t}}function ee(t){const e=t?.atomic,n=t?.flags;if(e&&n)throw new Error("Atomic group cannot have flags");return{type:"Group",...e&&{atomic:e},...n&&{flags:n},body:Ve(t?.body)}}function ge(t){const e={behind:!1,negate:!1,...t};return{type:"LookaroundAssertion",kind:e.behind?"lookbehind":"lookahead",negate:e.negate,body:Ve(t?.body)}}function xl(t,e,n){return{type:"NamedCallout",kind:t,tag:e,arguments:n}}function El(t,e){const n=!!e?.negate;if(!An.has(t))throw new Error(`Invalid POSIX class "${t}"`);return{type:"CharacterSet",kind:"posix",value:t,negate:n}}function Es(t,e,n,r){if(e>n)throw new Error("Invalid reversed quantifier range");return{type:"Quantifier",kind:t,min:e,max:n,body:r}}function Il(t,e){return{type:"Regex",body:Ve(e?.body),flags:t}}function Is(t){return{type:"Subroutine",ref:t}}function ve(t,e){const n={negate:!1,normalizeUnknownPropertyNames:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...e};let r=n.unicodePropertyMap?.get(kt(t));if(!r){if(n.normalizeUnknownPropertyNames)r=Ll(t);else if(n.unicodePropertyMap&&!n.skipPropertyNameValidation)throw new Error(j`Invalid Unicode property "\p{${t}}"`)}return{type:"CharacterSet",kind:"property",value:r??t,negate:n.negate}}function Al({flags:t,kind:e,name:n,negate:r,number:s}){switch(e){case"absence_repeater":return _l("repeater");case"atomic":return ee({atomic:!0});case"capturing":return xs(s,{name:n});case"group":return ee({flags:t});case"lookahead":case"lookbehind":return ge({behind:e==="lookbehind",negate:r});default:throw new Error(`Unexpected group kind "${e}"`)}}function Ve(t){if(t===void 0)t=[we()];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 As(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 cr(t){return t.type==="LookaroundAssertion"&&t.kind==="lookahead"}function ur(t){return t.type==="LookaroundAssertion"&&t.kind==="lookbehind"}function Rl(t){return/^[\p{Alpha}\p{Pc}][^)]*$/u.test(t)}function Ll(t){return t.trim().replace(/[- _]+/g,"_").replace(/[A-Z][a-z]+(?=[A-Z])/g,"$&_").replace(/[A-Za-z]+/g,e=>e[0].toUpperCase()+e.slice(1).toLowerCase())}function kt(t){return t.replace(/[- _]+/g,"").toLowerCase()}function fr(t,e){return Te(t,`${e?.type==="Character"&&e.value===93?"Empty":"Unclosed"} character class`)}function hr(t){return Te(t,"Unclosed group")}function Be(t,e,n=null){function r(o,i){for(let l=0;l<o.length;l++){const a=s(o[l],i,l,o);l=Math.max(-1,l+a)}}function s(o,i=null,l=null,a=null){let c=0,u=!1;const f={node:o,parent:i,key:l,container:a,root:t,remove(){Qe(a).splice(Math.max(0,_e(l)+c),1),c--,u=!0},removeAllNextSiblings(){return Qe(a).splice(_e(l)+1)},removeAllPrevSiblings(){const g=_e(l)+c;return c-=g,Qe(a).splice(0,Math.max(0,g))},replaceWith(g,y={}){const m=!!y.traverse;a?a[Math.max(0,_e(l)+c)]=g:Te(i,"Can't replace root node")[l]=g,m&&s(g,i,l,a),u=!0},replaceWithMultiple(g,y={}){const m=!!y.traverse;if(Qe(a).splice(Math.max(0,_e(l)+c),1,...g),c+=g.length-1,m){let _=0;for(let S=0;S<g.length;S++)_+=s(g[S],i,_e(l)+S+_,a)}u=!0},skip(){u=!0}},{type:h}=o,p=e["*"],d=e[h],b=typeof p=="function"?p:p?.enter,w=typeof d=="function"?d:d?.enter;if(b?.(f,n),w?.(f,n),!u)switch(h){case"AbsenceFunction":case"CapturingGroup":case"Group":r(o.body,o);break;case"Alternative":case"CharacterClass":r(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"LookaroundAssertion":r(o.body,o);break;case"Quantifier":s(o.body,o,"body");break;case"Regex":r(o.body,o),s(o.flags,o,"flags");break;default:throw new Error(`Unexpected node type "${h}"`)}return d?.exit?.(f,n),p?.exit?.(f,n),c}return s(t),t}function Qe(t){if(!Array.isArray(t))throw new Error("Container expected");return t}function _e(t){if(typeof t!="number")throw new Error("Numeric key expected");return t}const Nl=String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`;function Tl(t,e){for(let n=0;n<t.length;n++)t[n]>=e&&t[n]++}function Pl(t,e,n,r){return t.slice(0,e)+r+t.slice(e+n.length)}const Y=Object.freeze({DEFAULT:"DEFAULT",CHAR_CLASS:"CHAR_CLASS"});function Ln(t,e,n,r){const s=new RegExp(String.raw`${e}|(?<$skip>\[\^?|\\?.)`,"gsu"),o=[!1];let i=0,l="";for(const a of t.matchAll(s)){const{0:c,groups:{$skip:u}}=a;if(!u&&(!r||r===Y.DEFAULT==!i)){n instanceof Function?l+=n(a,{context:i?Y.CHAR_CLASS:Y.DEFAULT,negated:o[o.length-1]}):l+=n;continue}c[0]==="["?(i++,o.push(c[1]==="^")):c==="]"&&i&&(i--,o.pop()),l+=c}return l}function Rs(t,e,n,r){Ln(t,e,n,r)}function $l(t,e,n=0,r){if(!new RegExp(e,"su").test(t))return null;const s=new RegExp(`${e}|(?<$skip>\\\\?.)`,"gsu");s.lastIndex=n;let o=0,i;for(;i=s.exec(t);){const{0:l,groups:{$skip:a}}=i;if(!a&&(!r||r===Y.DEFAULT==!o))return i;l==="["?o++:l==="]"&&o&&o--,s.lastIndex==i.index&&s.lastIndex++}return null}function Ye(t,e,n){return!!$l(t,e,0,n)}function Ml(t,e){const n=/\\?./gsu;n.lastIndex=e;let r=t.length,s=0,o=1,i;for(;i=n.exec(t);){const[l]=i;if(l==="[")s++;else if(s)l==="]"&&s--;else if(l==="(")o++;else if(l===")"&&(o--,!o)){r=i.index;break}}return t.slice(e,r)}const dr=new RegExp(String.raw`(?<noncapturingStart>${Nl})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`,"gsu");function Ol(t,e){const n=e?.hiddenCaptures??[];let r=e?.captureTransfers??new Map;if(!/\(\?>/.test(t))return{pattern:t,captureTransfers:r,hiddenCaptures:n};const s="(?>",o="(?:(?=(",i=[0],l=[];let a=0,c=0,u=NaN,f;do{f=!1;let h=0,p=0,d=!1,b;for(dr.lastIndex=Number.isNaN(u)?0:u+o.length;b=dr.exec(t);){const{0:w,index:g,groups:{capturingStart:y,noncapturingStart:m}}=b;if(w==="[")h++;else if(h)w==="]"&&h--;else if(w===s&&!d)u=g,d=!0;else if(d&&m)p++;else if(y)d?p++:(a++,i.push(a+c));else if(w===")"&&d){if(!p){c++;const _=a+c;if(t=`${t.slice(0,u)}${o}${t.slice(u+s.length,g)}))<$$${_}>)${t.slice(g+1)}`,f=!0,l.push(_),Tl(n,_),r.size){const S=new Map;r.forEach((k,v)=>{S.set(v>=_?v+1:v,k.map(A=>A>=_?A+1:A))}),r=S}break}p--}}}while(f);return n.push(...l),t=Ln(t,String.raw`\\(?<backrefNum>[1-9]\d*)|<\$\$(?<wrappedBackrefNum>\d+)>`,({0:h,groups:{backrefNum:p,wrappedBackrefNum:d}})=>{if(p){const b=+p;if(b>i.length-1)throw new Error(`Backref "${h}" greater than number of captures`);return`\\${i[b]}`}return`\\${d}`},Y.DEFAULT),{pattern:t,captureTransfers:r,hiddenCaptures:n}}const Ls=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,Ot=new RegExp(String.raw`
43
+ `.replace(/\s+/g,""),"gsu");function za(t,e={}){const n={flags:"",...e,rules:{captureGroup:!1,singleline:!1,...e.rules}};if(typeof t!="string")throw new Error("String expected as pattern");const r=ll(n.flags),s=[r.extended],o={captureGroup:n.rules.captureGroup,getCurrentModX(){return s.at(-1)},numOpenGroups:0,popModX(){s.pop()},pushModX(f){s.push(f)},replaceCurrentModX(f){s[s.length-1]=f},singleline:n.rules.singleline};let i=[],l;for(Ze.lastIndex=0;l=Ze.exec(t);){const f=Wa(o,t,l[0],Ze.lastIndex);f.tokens?i.push(...f.tokens):f.token&&i.push(f.token),f.lastIndex!==void 0&&(Ze.lastIndex=f.lastIndex)}const a=[];let c=0;i.filter(f=>f.type==="GroupOpen").forEach(f=>{f.kind==="capturing"?f.number=++c:f.raw==="("&&a.push(f)}),c||a.forEach((f,h)=>{f.kind="capturing",f.number=h+1});const u=c||a.length;return{tokens:i.map(f=>f.type==="EscapedNumber"?ul(f,u):f).flat(),flags:r}}function Wa(t,e,n,r){const[s,o]=n;if(n==="["||n==="[^"){const i=Ha(e,n,r);return{tokens:i.tokens,lastIndex:i.lastIndex}}if(s==="\\"){if("AbBGyYzZ".includes(o))return{token:sr(n,n)};if(/^\\g[<']/.test(n)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(n))throw new Error(`Invalid group name "${n}"`);return{token:tl(n)}}if(/^\\k[<']/.test(n)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(n))throw new Error(`Invalid group name "${n}"`);return{token:Ss(n)}}if(o==="K")return{token:ks("keep",n)};if(o==="N"||o==="R")return{token:ye("newline",n,{negate:o==="N"})};if(o==="O")return{token:ye("any",n)};if(o==="X")return{token:ye("text_segment",n)};const i=_s(n,{inCharClass:!1});return Array.isArray(i)?{tokens:i}:{token:i}}if(s==="("){if(o==="*")return{token:ol(n)};if(n==="(?{")throw new Error(`Unsupported callout "${n}"`);if(n.startsWith("(?#")){if(e[r]!==")")throw new Error('Unclosed comment group "(?#"');return{lastIndex:r+1}}if(/^\(\?[-imx]+[:)]$/.test(n))return{token:sl(n,t)};if(t.pushModX(t.getCurrentModX()),t.numOpenGroups++,n==="("&&!t.captureGroup||n==="(?:")return{token:ve("group",n)};if(n==="(?>")return{token:ve("atomic",n)};if(n==="(?="||n==="(?!"||n==="(?<="||n==="(?<!")return{token:ve(n[2]==="<"?"lookbehind":"lookahead",n,{negate:n.endsWith("!")})};if(n==="("&&t.captureGroup||n.startsWith("(?<")&&n.endsWith(">")||n.startsWith("(?'")&&n.endsWith("'"))return{token:ve("capturing",n,{...n!=="("&&{name:n.slice(3,-1)}})};if(n.startsWith("(?~")){if(n==="(?~|")throw new Error(`Unsupported absence function kind "${n}"`);return{token:ve("absence_repeater",n)}}throw n==="(?("?new Error(`Unsupported conditional "${n}"`):new Error(`Invalid or unsupported group option "${n}"`)}if(n===")"){if(t.popModX(),t.numOpenGroups--,t.numOpenGroups<0)throw new Error('Unmatched ")"');return{token:Ya(n)}}if(t.getCurrentModX()){if(n==="#"){const i=e.indexOf(`
44
+ `,r);return{lastIndex:i===-1?e.length:i}}if(/^\s$/.test(n)){const i=/\s+/y;return i.lastIndex=r,{lastIndex:i.exec(e)?i.lastIndex:r}}}if(n===".")return{token:ye("dot",n)};if(n==="^"||n==="$"){const i=t.singleline?{"^":j`\A`,$:j`\Z`}[n]:n;return{token:sr(i,n)}}return n==="|"?{token:qa(n)}:Rn.test(n)?{tokens:fl(n)}:{token:ie(Te(n),n)}}function Ha(t,e,n){const r=[or(e[1]==="^",e)];let s=1,o;for(Mt.lastIndex=n;o=Mt.exec(t);){const i=o[0];if(i[0]==="["&&i[1]!==":")s++,r.push(or(i[1]==="^",i));else if(i==="]"){if(r.at(-1).type==="CharacterClassOpen")r.push(ie(93,i));else if(s--,r.push(Ka(i)),!s)break}else{const l=Va(i);Array.isArray(l)?r.push(...l):r.push(l)}}return{tokens:r,lastIndex:Mt.lastIndex||t.length}}function Va(t){if(t[0]==="\\")return _s(t,{inCharClass:!0});if(t[0]==="["){const e=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(t);if(!e||!An.has(e.groups.name))throw new Error(`Invalid POSIX class "${t}"`);return ye("posix",t,{value:e.groups.name,negate:!!e.groups.negate})}return t==="-"?Xa(t):t==="&&"?Za(t):ie(Te(t),t)}function _s(t,{inCharClass:e}){const n=t[1];if(n==="c"||n==="C")return rl(t);if("dDhHsSwW".includes(n))return il(t);if(t.startsWith(j`\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 al(t)}if(new RegExp("^\\\\x[89A-Fa-f]\\p{AHex}","u").test(t))try{const r=t.split(/\\x/).slice(1).map(i=>parseInt(i,16)),s=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}).decode(new Uint8Array(r)),o=new TextEncoder;return[...s].map(i=>{const l=[...o.encode(i)].map(a=>`\\x${a.toString(16)}`).join("");return ie(Te(i),l)})}catch{throw new Error(`Multibyte code "${t}" incomplete or invalid in Oniguruma`)}if(n==="u"||n==="x")return ie(cl(t),t);if(ir.has(n))return ie(ir.get(n),t);if(/\d/.test(n))return Qa(e,t);if(t==="\\")throw new Error(j`Incomplete escape "\"`);if(n==="M")throw new Error(`Unsupported meta "${t}"`);if([...t].length===2)return ie(t.codePointAt(1),t);throw new Error(`Unexpected escape "${t}"`)}function qa(t){return{type:"Alternator",raw:t}}function sr(t,e){return{type:"Assertion",kind:t,raw:e}}function Ss(t){return{type:"Backreference",raw:t}}function ie(t,e){return{type:"Character",value:t,raw:e}}function Ka(t){return{type:"CharacterClassClose",raw:t}}function Xa(t){return{type:"CharacterClassHyphen",raw:t}}function Za(t){return{type:"CharacterClassIntersector",raw:t}}function or(t,e){return{type:"CharacterClassOpen",negate:t,raw:e}}function ye(t,e,n={}){return{type:"CharacterSet",kind:t,...n,raw:e}}function ks(t,e,n={}){return t==="keep"?{type:"Directive",kind:t,raw:e}:{type:"Directive",kind:t,flags:Pe(n.flags),raw:e}}function Qa(t,e){return{type:"EscapedNumber",inCharClass:t,raw:e}}function Ya(t){return{type:"GroupClose",raw:t}}function ve(t,e,n={}){return{type:"GroupOpen",kind:t,...n,raw:e}}function Ja(t,e,n,r){return{type:"NamedCallout",kind:t,tag:e,arguments:n,raw:r}}function el(t,e,n,r){return{type:"Quantifier",kind:t,min:e,max:n,raw:r}}function tl(t){return{type:"Subroutine",raw:t}}const nl=new Set(["COUNT","CMP","ERROR","FAIL","MAX","MISMATCH","SKIP","TOTAL_COUNT"]),ir=new Map([["a",7],["b",8],["e",27],["f",12],["n",10],["r",13],["t",9],["v",11]]);function rl(t){const e=t[1]==="c"?t[2]:t[3];if(!e||!/[A-Za-z]/.test(e))throw new Error(`Unsupported control character "${t}"`);return ie(Te(e.toUpperCase())-64,t)}function sl(t,e){let{on:n,off:r}=/^\(\?(?<on>[imx]*)(?:-(?<off>[-imx]*))?/.exec(t).groups;r??="";const s=(e.getCurrentModX()||n.includes("x"))&&!r.includes("x"),o=lr(n),i=lr(r),l={};if(o&&(l.enable=o),i&&(l.disable=i),t.endsWith(")"))return e.replaceCurrentModX(s),ks("flags",t,{flags:l});if(t.endsWith(":"))return e.pushModX(s),e.numOpenGroups++,ve("group",t,{...(o||i)&&{flags:l}});throw new Error(`Unexpected flag modifier "${t}"`)}function ol(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:n,tag:r,args:s}=e.groups;if(!n)throw new Error(`Invalid named callout "${t}"`);if(r==="")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):[],[i,l,a]=o,c=nl.has(n)?n.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 i=="string")throw new Error(`Named callout argument must be a number "${i}"`);break;case"max":if(!o.length||o.length>2)throw new Error(`Named callout must have one or two arguments "${o}"`);if(typeof i=="string"&&!/^[A-Za-z_]\w*$/.test(i))throw new Error(`Named callout argument one must be a tag or number "${i}"`);if(o.length===2&&(typeof l=="number"||!/^[<>X]$/.test(l)))throw new Error(`Named callout optional argument two must be '<', '>', or 'X' "${l}"`);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 i=="number"||!/^[<>X]$/.test(i)))throw new Error(`Named callout optional argument must be '<', '>', or 'X' "${i}"`);break;case"cmp":if(o.length!==3)throw new Error(`Named callout must have three arguments "${o}"`);if(typeof i=="string"&&!/^[A-Za-z_]\w*$/.test(i))throw new Error(`Named callout argument one must be a tag or number "${i}"`);if(typeof l=="number"||!/^(?:[<>!=]=|[<>])$/.test(l))throw new Error(`Named callout argument two must be '==', '!=', '>', '<', '>=', or '<=' "${l}"`);if(typeof a=="string"&&!/^[A-Za-z_]\w*$/.test(a))throw new Error(`Named callout argument three must be a tag or number "${a}"`);break;case"custom":throw new Error(`Undefined callout name "${n}"`);default:throw new Error(`Unexpected named callout kind "${c}"`)}return Ja(c,r??null,s?.split(",")??null,t)}function ar(t){let e=null,n,r;if(t[0]==="{"){const{minStr:s,maxStr:o}=/^\{(?<minStr>\d*)(?:,(?<maxStr>\d*))?/.exec(t).groups,i=1e5;if(+s>i||o&&+o>i)throw new Error("Quantifier value unsupported in Oniguruma");if(n=+s,r=o===void 0?+s:o===""?1/0:+o,n>r&&(e="possessive",[n,r]=[r,n]),t.endsWith("?")){if(e==="possessive")throw new Error('Unsupported possessive interval quantifier chain with "?"');e="lazy"}else e||(e="greedy")}else n=t[0]==="+"?1:0,r=t[0]==="?"?1:1/0,e=t[1]==="+"?"possessive":t[1]==="?"?"lazy":"greedy";return el(e,n,r,t)}function il(t){const e=t[1].toLowerCase();return ye({d:"digit",h:"hex",s:"space",w:"word"}[e],t,{negate:t[1]!==e})}function al(t){const{p:e,neg:n,value:r}=/^\\(?<p>[pP])\{(?<neg>\^?)(?<value>[^}]+)/.exec(t).groups;return ye("property",t,{value:r,negate:e==="P"&&!n||e==="p"&&!!n})}function lr(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 ll(t){const e={ignoreCase:!1,dotAll:!1,extended:!1,digitIsAscii:!1,posixIsAscii:!1,spaceIsAscii:!1,wordIsAscii:!1,textSegmentMode:null};for(let n=0;n<t.length;n++){const r=t[n];if(!"imxDPSWy".includes(r))throw new Error(`Invalid flag "${r}"`);if(r==="y"){if(!/^y{[gw]}/.test(t.slice(n)))throw new Error('Invalid or unspecified flag "y" mode');e.textSegmentMode=t[n+2]==="g"?"grapheme":"word",n+=3;continue}e[{i:"ignoreCase",m:"dotAll",x:"extended",D:"digitIsAscii",P:"posixIsAscii",S:"spaceIsAscii",W:"wordIsAscii"}[r]]=!0}return e}function cl(t){if(new RegExp("^(?:\\\\u(?!\\p{AHex}{4})|\\\\x(?!\\p{AHex}{1,2}|\\{\\p{AHex}{1,8}\\}))","u").test(t))throw new Error(`Incomplete or invalid escape "${t}"`);const e=t[2]==="{"?new RegExp("^\\\\x\\{\\s*(?<hex>\\p{AHex}+)","u").exec(t).groups.hex:t.slice(2);return parseInt(e,16)}function ul(t,e){const{raw:n,inCharClass:r}=t,s=n.slice(1);if(!r&&(s!=="0"&&s.length===1||s[0]!=="0"&&+s<=e))return[Ss(n)];const o=[],i=s.match(/^[0-7]+|\d/g);for(let l=0;l<i.length;l++){const a=i[l];let c;if(l===0&&a!=="8"&&a!=="9"){if(c=parseInt(a,8),c>127)throw new Error(j`Octal encoded byte above 177 unsupported "${n}"`)}else c=Te(a);o.push(ie(c,(l===0?"\\":"")+a))}return o}function fl(t){const e=[],n=new RegExp(Rn,"gy");let r;for(;r=n.exec(t);){const s=r[0];if(s[0]==="{"){const o=/^\{(?<min>\d+),(?<max>\d+)\}\??$/.exec(s);if(o){const{min:i,max:l}=o.groups;if(+i>+l&&s.endsWith("?")){n.lastIndex--,e.push(ar(s.slice(0,-1)));continue}}}e.push(ar(s))}return e}function vs(t,e){if(!Array.isArray(t.body))throw new Error("Expected node with body array");if(t.body.length!==1)return!1;const n=t.body[0];return!e||Object.keys(e).every(r=>e[r]===n[r])}function hl(t){return dl.has(t.type)}const dl=new Set(["AbsenceFunction","Backreference","CapturingGroup","Character","CharacterClass","CharacterSet","Group","Quantifier","Subroutine"]);function xs(t,e={}){const n={flags:"",normalizeUnknownPropertyNames:!1,skipBackrefValidation:!1,skipLookbehindValidation:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...e,rules:{captureGroup:!1,singleline:!1,...e.rules}},r=za(t,{flags:n.flags,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline}}),s=(h,p)=>{const d=r.tokens[o.nextIndex];switch(o.parent=h,o.nextIndex++,d.type){case"Alternator":return we();case"Assertion":return pl(d);case"Backreference":return gl(d,o);case"Character":return St(d.value,{useLastValid:!!p.isCheckingRangeEnd});case"CharacterClassHyphen":return ml(d,o,p);case"CharacterClassOpen":return yl(d,o,p);case"CharacterSet":return bl(d,o);case"Directive":return vl(d.kind,{flags:d.flags});case"GroupOpen":return wl(d,o,p);case"NamedCallout":return El(d.kind,d.tag,d.arguments);case"Quantifier":return Cl(d,o);case"Subroutine":return _l(d,o);default:throw new Error(`Unexpected token type "${d.type}"`)}},o={capturingGroups:[],hasNumberedRef:!1,namedGroupsByName:new Map,nextIndex:0,normalizeUnknownPropertyNames:n.normalizeUnknownPropertyNames,parent:null,skipBackrefValidation:n.skipBackrefValidation,skipLookbehindValidation:n.skipLookbehindValidation,skipPropertyNameValidation:n.skipPropertyNameValidation,subroutines:[],tokens:r.tokens,unicodePropertyMap:n.unicodePropertyMap,walk:s},i=Al(xl(r.flags));let l=i.body[0];for(;o.nextIndex<r.tokens.length;){const h=s(l,{});h.type==="Alternative"?(i.body.push(h),l=h):l.body.push(h)}const{capturingGroups:a,hasNumberedRef:c,namedGroupsByName:u,subroutines:f}=o;if(c&&u.size&&!n.rules.captureGroup)throw new Error("Numbered backref/subroutine not allowed when using named capture");for(const{ref:h}of f)if(typeof h=="number"){if(h>a.length)throw new Error("Subroutine uses a group number that's not defined");h&&(a[h-1].isSubroutined=!0)}else if(u.has(h)){if(u.get(h).length>1)throw new Error(j`Subroutine uses a duplicate group name "\g<${h}>"`);u.get(h)[0].isSubroutined=!0}else throw new Error(j`Subroutine uses a group name that's not defined "\g<${h}>"`);return i}function pl({kind:t}){return ln(Pe({"^":"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===j`\B`||t===j`\Y`})}function gl({raw:t},e){const n=/^\\k[<']/.test(t),r=n?t.slice(3,-1):t.slice(1),s=(o,i=!1)=>{const l=e.capturingGroups.length;let a=!1;if(o>l)if(e.skipBackrefValidation)a=!0;else throw new Error(`Not enough capturing groups defined to the left "${t}"`);return e.hasNumberedRef=!0,cn(i?l+1-o:o,{orphan:a})};if(n){const o=/^(?<sign>-?)0*(?<num>[1-9]\d*)$/.exec(r);if(o)return s(+o.groups.num,!!o.groups.sign);if(/[-+]/.test(r))throw new Error(`Invalid backref name "${t}"`);if(!e.namedGroupsByName.has(r))throw new Error(`Group name not defined to the left "${t}"`);return cn(r)}return s(+r)}function ml(t,e,n){const{tokens:r,walk:s}=e,o=e.parent,i=o.body.at(-1),l=r[e.nextIndex];if(!n.isCheckingRangeEnd&&i&&i.type!=="CharacterClass"&&i.type!=="CharacterClassRange"&&l&&l.type!=="CharacterClassOpen"&&l.type!=="CharacterClassClose"&&l.type!=="CharacterClassIntersector"){const a=s(o,{...n,isCheckingRangeEnd:!0});if(i.type==="Character"&&a.type==="Character")return o.body.pop(),kl(i,a);throw new Error("Invalid character class range")}return St(Te("-"))}function yl({negate:t},e,n){const{tokens:r,walk:s}=e,o=r[e.nextIndex],i=[ot()];let l=fr(o);for(;l.type!=="CharacterClassClose";){if(l.type==="CharacterClassIntersector")i.push(ot()),e.nextIndex++;else{const c=i.at(-1);c.body.push(s(c,n))}l=fr(r[e.nextIndex],o)}const a=ot({negate:t});return i.length===1?a.body=i[0].body:(a.kind="intersection",a.body=i.map(c=>c.body.length===1?c.body[0]:c)),e.nextIndex++,a}function bl({kind:t,negate:e,value:n},r){const{normalizeUnknownPropertyNames:s,skipPropertyNameValidation:o,unicodePropertyMap:i}=r;if(t==="property"){const l=kt(n);if(An.has(l)&&!i?.has(l))t="posix",n=l;else return xe(n,{negate:e,normalizeUnknownPropertyNames:s,skipPropertyNameValidation:o,unicodePropertyMap:i})}return t==="posix"?Il(n,{negate:e}):un(t,{negate:e})}function wl(t,e,n){const{tokens:r,capturingGroups:s,namedGroupsByName:o,skipLookbehindValidation:i,walk:l}=e,a=Rl(t),c=a.type==="AbsenceFunction",u=ur(a),f=u&&a.negate;if(a.type==="CapturingGroup"&&(s.push(a),a.name&&ja(o,a.name,[]).push(a)),c&&n.isInAbsenceFunction)throw new Error("Nested absence function not supported by Oniguruma");let h=hr(r[e.nextIndex]);for(;h.type!=="GroupClose";){if(h.type==="Alternator")a.body.push(we()),e.nextIndex++;else{const p=a.body.at(-1),d=l(p,{...n,isInAbsenceFunction:n.isInAbsenceFunction||c,isInLookbehind:n.isInLookbehind||u,isInNegLookbehind:n.isInNegLookbehind||f});if(p.body.push(d),(u||n.isInLookbehind)&&!i){const b="Lookbehind includes a pattern not allowed by Oniguruma";if(f||n.isInNegLookbehind){if(cr(d)||d.type==="CapturingGroup")throw new Error(b)}else if(cr(d)||ur(d)&&d.negate)throw new Error(b)}}h=hr(r[e.nextIndex])}return e.nextIndex++,a}function Cl({kind:t,min:e,max:n},r){const s=r.parent,o=s.body.at(-1);if(!o||!hl(o))throw new Error("Quantifier requires a repeatable token");const i=Is(t,e,n,o);return s.body.pop(),i}function _l({raw:t},e){const{capturingGroups:n,subroutines:r}=e;let s=t.slice(3,-1);const o=/^(?<sign>[-+]?)0*(?<num>[1-9]\d*)$/.exec(s);if(o){const l=+o.groups.num,a=n.length;if(e.hasNumberedRef=!0,s={"":l,"+":a+l,"-":a+1-l}[o.groups.sign],s<1)throw new Error("Invalid subroutine number")}else s==="0"&&(s=0);const i=As(s);return r.push(i),i}function Sl(t,e){return{type:"AbsenceFunction",kind:t,body:Ve(e?.body)}}function we(t){return{type:"Alternative",body:Rs(t?.body)}}function ln(t,e){const n={type:"Assertion",kind:t};return(t==="word_boundary"||t==="text_segment_boundary")&&(n.negate=!!e?.negate),n}function cn(t,e){const n=!!e?.orphan;return{type:"Backreference",ref:t,...n&&{orphan:n}}}function Es(t,e){const n={name:void 0,isSubroutined:!1,...e};if(n.name!==void 0&&!Ll(n.name))throw new Error(`Group name "${n.name}" invalid in Oniguruma`);return{type:"CapturingGroup",number:t,...n.name&&{name:n.name},...n.isSubroutined&&{isSubroutined:n.isSubroutined},body:Ve(e?.body)}}function St(t,e){const n={useLastValid:!1,...e};if(t>1114111){const r=t.toString(16);if(n.useLastValid)t=1114111;else throw t>1310719?new Error(`Invalid code point out of range "\\x{${r}}"`):new Error(`Invalid code point out of range in JS "\\x{${r}}"`)}return{type:"Character",value:t}}function ot(t){const e={kind:"union",negate:!1,...t};return{type:"CharacterClass",kind:e.kind,negate:e.negate,body:Rs(t?.body)}}function kl(t,e){if(e.value<t.value)throw new Error("Character class range out of order");return{type:"CharacterClassRange",min:t,max:e}}function un(t,e){const n=!!e?.negate,r={type:"CharacterSet",kind:t};return(t==="digit"||t==="hex"||t==="newline"||t==="space"||t==="word")&&(r.negate=n),(t==="text_segment"||t==="newline"&&!n)&&(r.variableLength=!0),r}function vl(t,e={}){if(t==="keep")return{type:"Directive",kind:t};if(t==="flags")return{type:"Directive",kind:t,flags:Pe(e.flags)};throw new Error(`Unexpected directive kind "${t}"`)}function xl(t){return{type:"Flags",...t}}function ee(t){const e=t?.atomic,n=t?.flags;if(e&&n)throw new Error("Atomic group cannot have flags");return{type:"Group",...e&&{atomic:e},...n&&{flags:n},body:Ve(t?.body)}}function ge(t){const e={behind:!1,negate:!1,...t};return{type:"LookaroundAssertion",kind:e.behind?"lookbehind":"lookahead",negate:e.negate,body:Ve(t?.body)}}function El(t,e,n){return{type:"NamedCallout",kind:t,tag:e,arguments:n}}function Il(t,e){const n=!!e?.negate;if(!An.has(t))throw new Error(`Invalid POSIX class "${t}"`);return{type:"CharacterSet",kind:"posix",value:t,negate:n}}function Is(t,e,n,r){if(e>n)throw new Error("Invalid reversed quantifier range");return{type:"Quantifier",kind:t,min:e,max:n,body:r}}function Al(t,e){return{type:"Regex",body:Ve(e?.body),flags:t}}function As(t){return{type:"Subroutine",ref:t}}function xe(t,e){const n={negate:!1,normalizeUnknownPropertyNames:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...e};let r=n.unicodePropertyMap?.get(kt(t));if(!r){if(n.normalizeUnknownPropertyNames)r=Nl(t);else if(n.unicodePropertyMap&&!n.skipPropertyNameValidation)throw new Error(j`Invalid Unicode property "\p{${t}}"`)}return{type:"CharacterSet",kind:"property",value:r??t,negate:n.negate}}function Rl({flags:t,kind:e,name:n,negate:r,number:s}){switch(e){case"absence_repeater":return Sl("repeater");case"atomic":return ee({atomic:!0});case"capturing":return Es(s,{name:n});case"group":return ee({flags:t});case"lookahead":case"lookbehind":return ge({behind:e==="lookbehind",negate:r});default:throw new Error(`Unexpected group kind "${e}"`)}}function Ve(t){if(t===void 0)t=[we()];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 Rs(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 cr(t){return t.type==="LookaroundAssertion"&&t.kind==="lookahead"}function ur(t){return t.type==="LookaroundAssertion"&&t.kind==="lookbehind"}function Ll(t){return/^[\p{Alpha}\p{Pc}][^)]*$/u.test(t)}function Nl(t){return t.trim().replace(/[- _]+/g,"_").replace(/[A-Z][a-z]+(?=[A-Z])/g,"$&_").replace(/[A-Za-z]+/g,e=>e[0].toUpperCase()+e.slice(1).toLowerCase())}function kt(t){return t.replace(/[- _]+/g,"").toLowerCase()}function fr(t,e){return Pe(t,`${e?.type==="Character"&&e.value===93?"Empty":"Unclosed"} character class`)}function hr(t){return Pe(t,"Unclosed group")}function Be(t,e,n=null){function r(o,i){for(let l=0;l<o.length;l++){const a=s(o[l],i,l,o);l=Math.max(-1,l+a)}}function s(o,i=null,l=null,a=null){let c=0,u=!1;const f={node:o,parent:i,key:l,container:a,root:t,remove(){Qe(a).splice(Math.max(0,_e(l)+c),1),c--,u=!0},removeAllNextSiblings(){return Qe(a).splice(_e(l)+1)},removeAllPrevSiblings(){const g=_e(l)+c;return c-=g,Qe(a).splice(0,Math.max(0,g))},replaceWith(g,y={}){const m=!!y.traverse;a?a[Math.max(0,_e(l)+c)]=g:Pe(i,"Can't replace root node")[l]=g,m&&s(g,i,l,a),u=!0},replaceWithMultiple(g,y={}){const m=!!y.traverse;if(Qe(a).splice(Math.max(0,_e(l)+c),1,...g),c+=g.length-1,m){let _=0;for(let S=0;S<g.length;S++)_+=s(g[S],i,_e(l)+S+_,a)}u=!0},skip(){u=!0}},{type:h}=o,p=e["*"],d=e[h],b=typeof p=="function"?p:p?.enter,w=typeof d=="function"?d:d?.enter;if(b?.(f,n),w?.(f,n),!u)switch(h){case"AbsenceFunction":case"CapturingGroup":case"Group":r(o.body,o);break;case"Alternative":case"CharacterClass":r(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"LookaroundAssertion":r(o.body,o);break;case"Quantifier":s(o.body,o,"body");break;case"Regex":r(o.body,o),s(o.flags,o,"flags");break;default:throw new Error(`Unexpected node type "${h}"`)}return d?.exit?.(f,n),p?.exit?.(f,n),c}return s(t),t}function Qe(t){if(!Array.isArray(t))throw new Error("Container expected");return t}function _e(t){if(typeof t!="number")throw new Error("Numeric key expected");return t}const Tl=String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`;function Pl(t,e){for(let n=0;n<t.length;n++)t[n]>=e&&t[n]++}function $l(t,e,n,r){return t.slice(0,e)+r+t.slice(e+n.length)}const Y=Object.freeze({DEFAULT:"DEFAULT",CHAR_CLASS:"CHAR_CLASS"});function Ln(t,e,n,r){const s=new RegExp(String.raw`${e}|(?<$skip>\[\^?|\\?.)`,"gsu"),o=[!1];let i=0,l="";for(const a of t.matchAll(s)){const{0:c,groups:{$skip:u}}=a;if(!u&&(!r||r===Y.DEFAULT==!i)){n instanceof Function?l+=n(a,{context:i?Y.CHAR_CLASS:Y.DEFAULT,negated:o[o.length-1]}):l+=n;continue}c[0]==="["?(i++,o.push(c[1]==="^")):c==="]"&&i&&(i--,o.pop()),l+=c}return l}function Ls(t,e,n,r){Ln(t,e,n,r)}function Ml(t,e,n=0,r){if(!new RegExp(e,"su").test(t))return null;const s=new RegExp(`${e}|(?<$skip>\\\\?.)`,"gsu");s.lastIndex=n;let o=0,i;for(;i=s.exec(t);){const{0:l,groups:{$skip:a}}=i;if(!a&&(!r||r===Y.DEFAULT==!o))return i;l==="["?o++:l==="]"&&o&&o--,s.lastIndex==i.index&&s.lastIndex++}return null}function Ye(t,e,n){return!!Ml(t,e,0,n)}function Ol(t,e){const n=/\\?./gsu;n.lastIndex=e;let r=t.length,s=0,o=1,i;for(;i=n.exec(t);){const[l]=i;if(l==="[")s++;else if(s)l==="]"&&s--;else if(l==="(")o++;else if(l===")"&&(o--,!o)){r=i.index;break}}return t.slice(e,r)}const dr=new RegExp(String.raw`(?<noncapturingStart>${Tl})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`,"gsu");function Dl(t,e){const n=e?.hiddenCaptures??[];let r=e?.captureTransfers??new Map;if(!/\(\?>/.test(t))return{pattern:t,captureTransfers:r,hiddenCaptures:n};const s="(?>",o="(?:(?=(",i=[0],l=[];let a=0,c=0,u=NaN,f;do{f=!1;let h=0,p=0,d=!1,b;for(dr.lastIndex=Number.isNaN(u)?0:u+o.length;b=dr.exec(t);){const{0:w,index:g,groups:{capturingStart:y,noncapturingStart:m}}=b;if(w==="[")h++;else if(h)w==="]"&&h--;else if(w===s&&!d)u=g,d=!0;else if(d&&m)p++;else if(y)d?p++:(a++,i.push(a+c));else if(w===")"&&d){if(!p){c++;const _=a+c;if(t=`${t.slice(0,u)}${o}${t.slice(u+s.length,g)}))<$$${_}>)${t.slice(g+1)}`,f=!0,l.push(_),Pl(n,_),r.size){const S=new Map;r.forEach((k,v)=>{S.set(v>=_?v+1:v,k.map(A=>A>=_?A+1:A))}),r=S}break}p--}}}while(f);return n.push(...l),t=Ln(t,String.raw`\\(?<backrefNum>[1-9]\d*)|<\$\$(?<wrappedBackrefNum>\d+)>`,({0:h,groups:{backrefNum:p,wrappedBackrefNum:d}})=>{if(p){const b=+p;if(b>i.length-1)throw new Error(`Backref "${h}" greater than number of captures`);return`\\${i[b]}`}return`\\${d}`},Y.DEFAULT),{pattern:t,captureTransfers:r,hiddenCaptures:n}}const Ns=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,Ot=new RegExp(String.raw`
45
45
  \\(?: \d+
46
46
  | c[A-Za-z]
47
47
  | [gk]<[^>]+>
@@ -54,9 +54,9 @@ let U=class extends Error{constructor(e){super(e),this.name="ShikiError"}};funct
54
54
  | [A-Za-z\-]+:
55
55
  | \(DEFINE\)
56
56
  ))?
57
- | (?<qBase>${Ls})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?)
57
+ | (?<qBase>${Ns})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?)
58
58
  | \\?.
59
- `.replace(/\s+/g,""),"gsu");function Dl(t){if(!new RegExp(`${Ls}\\+`).test(t))return{pattern:t};const e=[];let n=null,r=null,s="",o=0,i;for(Ot.lastIndex=0;i=Ot.exec(t);){const{0:l,index:a,groups:{qBase:c,qMod:u,invalidQ:f}}=i;if(l==="[")o||(r=a),o++;else if(l==="]")o?o--:r=null;else if(!o)if(u==="+"&&s&&!s.startsWith("(")){if(f)throw new Error(`Invalid quantifier "${l}"`);let h=-1;if(/^\{\d+\}$/.test(c))t=Pl(t,a+c.length,u,"");else{if(s===")"||s==="]"){const p=s===")"?n:r;if(p===null)throw new Error(`Invalid unmatched "${s}"`);t=`${t.slice(0,p)}(?>${t.slice(p,a)}${c})${t.slice(a+l.length)}`}else t=`${t.slice(0,a-s.length)}(?>${s}${c})${t.slice(a+l.length)}`;h+=4}Ot.lastIndex+=h}else l[0]==="("?e.push(a):l===")"&&(n=e.length?e.pop():null);s=l}return{pattern:t}}const Q=String.raw,Bl=Q`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`,fn=Q`\(\?R=(?<rDepth>[^\)]+)\)|${Bl}`,vt=Q`\(\?<(?![=!])(?<captureName>[^>]+)>`,Ns=Q`${vt}|(?<unnamed>\()(?!\?)`,de=new RegExp(Q`${vt}|${fn}|\(\?|\\?.`,"gsu"),Dt="Cannot use multiple overlapping recursions";function Gl(t,e){const{hiddenCaptures:n,mode:r}={hiddenCaptures:[],mode:"plugin",...e};let s=e?.captureTransfers??new Map;if(!new RegExp(fn,"su").test(t))return{pattern:t,captureTransfers:s,hiddenCaptures:n};if(r==="plugin"&&Ye(t,Q`\(\?\(DEFINE\)`,Y.DEFAULT))throw new Error("DEFINE groups cannot be used with recursion");const o=[],i=Ye(t,Q`\\[1-9]`,Y.DEFAULT),l=new Map,a=[];let c=!1,u=0,f=0,h;for(de.lastIndex=0;h=de.exec(t);){const{0:p,groups:{captureName:d,rDepth:b,gRNameOrNum:w,gRDepth:g}}=h;if(p==="[")u++;else if(u)p==="]"&&u--;else if(b){if(pr(b),c)throw new Error(Dt);if(i)throw new Error(`${r==="external"?"Backrefs":"Numbered backrefs"} cannot be used with global recursion`);const y=t.slice(0,h.index),m=t.slice(de.lastIndex);if(Ye(m,fn,Y.DEFAULT))throw new Error(Dt);const _=+b-1;t=gr(y,m,_,!1,n,o,f),s=yr(s,y,_,o.length,0,f);break}else if(w){pr(g);let y=!1;for(const E of a)if(E.name===w||E.num===+w){if(y=!0,E.hasRecursedWithin)throw new Error(Dt);break}if(!y)throw new Error(Q`Recursive \g cannot be used outside the referenced group "${r==="external"?w:Q`\g<${w}&R=${g}>`}"`);const m=l.get(w),_=Ml(t,m);if(i&&Ye(_,Q`${vt}|\((?!\?)`,Y.DEFAULT))throw new Error(`${r==="external"?"Backrefs":"Numbered backrefs"} cannot be used with recursion of capturing groups`);const S=t.slice(m,h.index),k=_.slice(S.length+p.length),v=o.length,A=+g-1,L=gr(S,k,A,!0,n,o,f);s=yr(s,S,A,o.length-v,v,f);const H=t.slice(0,m),he=t.slice(m+_.length);t=`${H}${L}${he}`,de.lastIndex+=L.length-p.length-S.length-k.length,a.forEach(E=>E.hasRecursedWithin=!0),c=!0}else if(d)f++,l.set(String(f),de.lastIndex),l.set(d,de.lastIndex),a.push({num:f,name:d});else if(p[0]==="("){const y=p==="(";y&&(f++,l.set(String(f),de.lastIndex)),a.push(y?{num:f}:{})}else p===")"&&a.pop()}return n.push(...o),{pattern:t,captureTransfers:s,hiddenCaptures:n}}function pr(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,t<2||t>100)throw new Error(e)}function gr(t,e,n,r,s,o,i){const l=new Set;r&&Rs(t+e,vt,({groups:{captureName:c}})=>{l.add(c)},Y.DEFAULT);const a=[n,r?l:null,s,o,i];return`${t}${mr(`(?:${t}`,"forward",...a)}(?:)${mr(`${e})`,"backward",...a)}${e}`}function mr(t,e,n,r,s,o,i){const a=u=>e==="forward"?u+2:n-u+2-1;let c="";for(let u=0;u<n;u++){const f=a(u);c+=Ln(t,Q`${Ns}|\\k<(?<backref>[^>]+)>`,({0:h,groups:{captureName:p,unnamed:d,backref:b}})=>{if(b&&r&&!r.has(b))return h;const w=`_$${f}`;if(d||p){const g=i+o.length+1;return o.push(g),Fl(s,g),d?h:`(?<${p}${w}>`}return Q`\k<${b}${w}>`},Y.DEFAULT)}return c}function Fl(t,e){for(let n=0;n<t.length;n++)t[n]>=e&&t[n]++}function yr(t,e,n,r,s,o){if(t.size&&r){let i=0;Rs(e,Ns,()=>i++,Y.DEFAULT);const l=o-i+s,a=new Map;return t.forEach((c,u)=>{const f=(r-i*n)/n,h=i*n,p=u>l+i?u+r:u,d=[];for(const b of c)if(b<=l)d.push(b);else if(b>l+i+f)d.push(b+r);else if(b<=l+i)for(let w=0;w<=n;w++)d.push(b+i*w);else for(let w=0;w<=n;w++)d.push(b+h+f*w);a.set(p,d)}),a}return t}var D=String.fromCodePoint,x=String.raw,ae={flagGroups:(()=>{try{new RegExp("(?i:)")}catch{return!1}return!0})(),unicodeSets:(()=>{try{new RegExp("[[]]","v")}catch{return!1}return!0})()};ae.bugFlagVLiteralHyphenIsRange=ae.unicodeSets?(()=>{try{new RegExp(x`[\d\-a]`,"v")}catch{return!0}return!1})():!1;ae.bugNestedClassIgnoresNegation=ae.unicodeSets&&new RegExp("[[^a]]","v").test("a");function yt(t,{enable:e,disable:n}){return{dotAll:!n?.dotAll&&!!(e?.dotAll||t.dotAll),ignoreCase:!n?.ignoreCase&&!!(e?.ignoreCase||t.ignoreCase)}}function ze(t,e,n){return t.has(e)||t.set(e,n),t.get(e)}function hn(t,e){return br[t]>=br[e]}function Ul(t,e){if(t==null)throw new Error(e??"Value expected");return t}var br={ES2025:2025,ES2024:2024,ES2018:2018},jl={auto:"auto",ES2025:"ES2025",ES2024:"ES2024",ES2018:"ES2018"};function Ts(t={}){if({}.toString.call(t)!=="[object Object]")throw new Error("Unexpected options");if(t.target!==void 0&&!jl[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=ae.flagGroups?"ES2025":ae.unicodeSets?"ES2024":"ES2018"),e}var zl="[ -\r ]",Wl=new Set([D(304),D(305)]),se=x`[\p{L}\p{M}\p{N}\p{Pc}]`;function Ps(t){if(Wl.has(t))return[t];const e=new Set,n=t.toLowerCase(),r=n.toUpperCase(),s=ql.get(n),o=Hl.get(n),i=Vl.get(n);return[...r].length===1&&e.add(r),i&&e.add(i),s&&e.add(s),e.add(n),o&&e.add(o),[...e]}var Nn=new Map(`C Other
59
+ `.replace(/\s+/g,""),"gsu");function Bl(t){if(!new RegExp(`${Ns}\\+`).test(t))return{pattern:t};const e=[];let n=null,r=null,s="",o=0,i;for(Ot.lastIndex=0;i=Ot.exec(t);){const{0:l,index:a,groups:{qBase:c,qMod:u,invalidQ:f}}=i;if(l==="[")o||(r=a),o++;else if(l==="]")o?o--:r=null;else if(!o)if(u==="+"&&s&&!s.startsWith("(")){if(f)throw new Error(`Invalid quantifier "${l}"`);let h=-1;if(/^\{\d+\}$/.test(c))t=$l(t,a+c.length,u,"");else{if(s===")"||s==="]"){const p=s===")"?n:r;if(p===null)throw new Error(`Invalid unmatched "${s}"`);t=`${t.slice(0,p)}(?>${t.slice(p,a)}${c})${t.slice(a+l.length)}`}else t=`${t.slice(0,a-s.length)}(?>${s}${c})${t.slice(a+l.length)}`;h+=4}Ot.lastIndex+=h}else l[0]==="("?e.push(a):l===")"&&(n=e.length?e.pop():null);s=l}return{pattern:t}}const Q=String.raw,Gl=Q`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`,fn=Q`\(\?R=(?<rDepth>[^\)]+)\)|${Gl}`,vt=Q`\(\?<(?![=!])(?<captureName>[^>]+)>`,Ts=Q`${vt}|(?<unnamed>\()(?!\?)`,de=new RegExp(Q`${vt}|${fn}|\(\?|\\?.`,"gsu"),Dt="Cannot use multiple overlapping recursions";function Fl(t,e){const{hiddenCaptures:n,mode:r}={hiddenCaptures:[],mode:"plugin",...e};let s=e?.captureTransfers??new Map;if(!new RegExp(fn,"su").test(t))return{pattern:t,captureTransfers:s,hiddenCaptures:n};if(r==="plugin"&&Ye(t,Q`\(\?\(DEFINE\)`,Y.DEFAULT))throw new Error("DEFINE groups cannot be used with recursion");const o=[],i=Ye(t,Q`\\[1-9]`,Y.DEFAULT),l=new Map,a=[];let c=!1,u=0,f=0,h;for(de.lastIndex=0;h=de.exec(t);){const{0:p,groups:{captureName:d,rDepth:b,gRNameOrNum:w,gRDepth:g}}=h;if(p==="[")u++;else if(u)p==="]"&&u--;else if(b){if(pr(b),c)throw new Error(Dt);if(i)throw new Error(`${r==="external"?"Backrefs":"Numbered backrefs"} cannot be used with global recursion`);const y=t.slice(0,h.index),m=t.slice(de.lastIndex);if(Ye(m,fn,Y.DEFAULT))throw new Error(Dt);const _=+b-1;t=gr(y,m,_,!1,n,o,f),s=yr(s,y,_,o.length,0,f);break}else if(w){pr(g);let y=!1;for(const E of a)if(E.name===w||E.num===+w){if(y=!0,E.hasRecursedWithin)throw new Error(Dt);break}if(!y)throw new Error(Q`Recursive \g cannot be used outside the referenced group "${r==="external"?w:Q`\g<${w}&R=${g}>`}"`);const m=l.get(w),_=Ol(t,m);if(i&&Ye(_,Q`${vt}|\((?!\?)`,Y.DEFAULT))throw new Error(`${r==="external"?"Backrefs":"Numbered backrefs"} cannot be used with recursion of capturing groups`);const S=t.slice(m,h.index),k=_.slice(S.length+p.length),v=o.length,A=+g-1,L=gr(S,k,A,!0,n,o,f);s=yr(s,S,A,o.length-v,v,f);const H=t.slice(0,m),he=t.slice(m+_.length);t=`${H}${L}${he}`,de.lastIndex+=L.length-p.length-S.length-k.length,a.forEach(E=>E.hasRecursedWithin=!0),c=!0}else if(d)f++,l.set(String(f),de.lastIndex),l.set(d,de.lastIndex),a.push({num:f,name:d});else if(p[0]==="("){const y=p==="(";y&&(f++,l.set(String(f),de.lastIndex)),a.push(y?{num:f}:{})}else p===")"&&a.pop()}return n.push(...o),{pattern:t,captureTransfers:s,hiddenCaptures:n}}function pr(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,t<2||t>100)throw new Error(e)}function gr(t,e,n,r,s,o,i){const l=new Set;r&&Ls(t+e,vt,({groups:{captureName:c}})=>{l.add(c)},Y.DEFAULT);const a=[n,r?l:null,s,o,i];return`${t}${mr(`(?:${t}`,"forward",...a)}(?:)${mr(`${e})`,"backward",...a)}${e}`}function mr(t,e,n,r,s,o,i){const a=u=>e==="forward"?u+2:n-u+2-1;let c="";for(let u=0;u<n;u++){const f=a(u);c+=Ln(t,Q`${Ts}|\\k<(?<backref>[^>]+)>`,({0:h,groups:{captureName:p,unnamed:d,backref:b}})=>{if(b&&r&&!r.has(b))return h;const w=`_$${f}`;if(d||p){const g=i+o.length+1;return o.push(g),Ul(s,g),d?h:`(?<${p}${w}>`}return Q`\k<${b}${w}>`},Y.DEFAULT)}return c}function Ul(t,e){for(let n=0;n<t.length;n++)t[n]>=e&&t[n]++}function yr(t,e,n,r,s,o){if(t.size&&r){let i=0;Ls(e,Ts,()=>i++,Y.DEFAULT);const l=o-i+s,a=new Map;return t.forEach((c,u)=>{const f=(r-i*n)/n,h=i*n,p=u>l+i?u+r:u,d=[];for(const b of c)if(b<=l)d.push(b);else if(b>l+i+f)d.push(b+r);else if(b<=l+i)for(let w=0;w<=n;w++)d.push(b+i*w);else for(let w=0;w<=n;w++)d.push(b+h+f*w);a.set(p,d)}),a}return t}var D=String.fromCodePoint,x=String.raw,ae={flagGroups:(()=>{try{new RegExp("(?i:)")}catch{return!1}return!0})(),unicodeSets:(()=>{try{new RegExp("[[]]","v")}catch{return!1}return!0})()};ae.bugFlagVLiteralHyphenIsRange=ae.unicodeSets?(()=>{try{new RegExp(x`[\d\-a]`,"v")}catch{return!0}return!1})():!1;ae.bugNestedClassIgnoresNegation=ae.unicodeSets&&new RegExp("[[^a]]","v").test("a");function yt(t,{enable:e,disable:n}){return{dotAll:!n?.dotAll&&!!(e?.dotAll||t.dotAll),ignoreCase:!n?.ignoreCase&&!!(e?.ignoreCase||t.ignoreCase)}}function ze(t,e,n){return t.has(e)||t.set(e,n),t.get(e)}function hn(t,e){return br[t]>=br[e]}function jl(t,e){if(t==null)throw new Error(e??"Value expected");return t}var br={ES2025:2025,ES2024:2024,ES2018:2018},zl={auto:"auto",ES2025:"ES2025",ES2024:"ES2024",ES2018:"ES2018"};function Ps(t={}){if({}.toString.call(t)!=="[object Object]")throw new Error("Unexpected options");if(t.target!==void 0&&!zl[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=ae.flagGroups?"ES2025":ae.unicodeSets?"ES2024":"ES2018"),e}var Wl="[ -\r ]",Hl=new Set([D(304),D(305)]),se=x`[\p{L}\p{M}\p{N}\p{Pc}]`;function $s(t){if(Hl.has(t))return[t];const e=new Set,n=t.toLowerCase(),r=n.toUpperCase(),s=Kl.get(n),o=Vl.get(n),i=ql.get(n);return[...r].length===1&&e.add(r),i&&e.add(i),s&&e.add(s),e.add(n),o&&e.add(o),[...e]}var Nn=new Map(`C Other
60
60
  Cc Control cntrl
61
61
  Cf Format
62
62
  Cn Unassigned
@@ -146,12 +146,12 @@ Uppercase Upper
146
146
  Variation_Selector VS
147
147
  White_Space space
148
148
  XID_Continue XIDC
149
- XID_Start XIDS`.split(/\s/).map(t=>[kt(t),t])),Hl=new Map([["s",D(383)],[D(383),"s"]]),Vl=new Map([[D(223),D(7838)],[D(107),D(8490)],[D(229),D(8491)],[D(969),D(8486)]]),ql=new Map([le(453),le(456),le(459),le(498),...Bt(8072,8079),...Bt(8088,8095),...Bt(8104,8111),le(8124),le(8140),le(8188)]),Xl=new Map([["alnum",x`[\p{Alpha}\p{Nd}]`],["alpha",x`\p{Alpha}`],["ascii",x`\p{ASCII}`],["blank",x`[\p{Zs}\t]`],["cntrl",x`\p{Cc}`],["digit",x`\p{Nd}`],["graph",x`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],["lower",x`\p{Lower}`],["print",x`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],["punct",x`[\p{P}\p{S}]`],["space",x`\p{space}`],["upper",x`\p{Upper}`],["word",x`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],["xdigit",x`\p{AHex}`]]);function Kl(t,e){const n=[];for(let r=t;r<=e;r++)n.push(r);return n}function le(t){const e=D(t);return[e.toLowerCase(),e]}function Bt(t,e){return Kl(t,e).map(n=>le(n))}var $s=new Set(["Lower","Lowercase","Upper","Uppercase","Ll","Lowercase_Letter","Lt","Titlecase_Letter","Lu","Uppercase_Letter"]);function Zl(t,e){const n={accuracy:"default",asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:"ES2025",...e};Ms(t);const r={accuracy:n.accuracy,asciiWordBoundaries:n.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:hn(n.bestEffortTarget,"ES2024"),passedLookbehind:!1,strategy:null,subroutineRefMap:new Map,supportedGNodes:new Set,digitIsAscii:t.flags.digitIsAscii,spaceIsAscii:t.flags.spaceIsAscii,wordIsAscii:t.flags.wordIsAscii};Be(t,Ql,r);const s={dotAll:t.flags.dotAll,ignoreCase:t.flags.ignoreCase},o={currentFlags:s,prevFlags:null,globalFlags:s,groupOriginByCopy:new Map,groupsByName:new Map,multiplexCapturesToLeftByRef:new Map,openRefs:new Map,reffedNodesByReferencer:new Map,subroutineRefMap:r.subroutineRefMap};Be(t,Yl,o);const i={groupsByName:o.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:o.reffedNodesByReferencer};return Be(t,Jl,i),t._originMap=o.groupOriginByCopy,t._strategy=r.strategy,t}var Ql={AbsenceFunction({node:t,parent:e,replaceWith:n}){const{body:r,kind:s}=t;if(s==="repeater"){const o=ee();o.body[0].body.push(ge({negate:!0,body:r}),ve("Any"));const i=ee();i.body[0].body.push(Es("greedy",0,1/0,o)),n($(i,e),{traverse:!0})}else throw new Error('Unsupported absence function "(?~|"')},Alternative:{enter({node:t,parent:e,key:n},{flagDirectivesByAlt:r}){const s=t.body.filter(o=>o.kind==="flags");for(let o=n+1;o<e.body.length;o++){const i=e.body[o];ze(r,i,[]).push(...s)}},exit({node:t},{flagDirectivesByAlt:e}){if(e.get(t)?.length){const n=Ds(e.get(t));if(n){const r=ee({flags:n});r.body[0].body=t.body,t.body=[$(r,t)]}}}},Assertion({node:t,parent:e,key:n,container:r,root:s,remove:o,replaceWith:i},l){const{kind:a,negate:c}=t,{asciiWordBoundaries:u,avoidSubclass:f,supportedGNodes:h,wordIsAscii:p}=l;if(a==="text_segment_boundary")throw new Error(`Unsupported text segment boundary "\\${c?"Y":"y"}"`);if(a==="line_end")i($(ge({body:[we({body:[ln("string_end")]}),we({body:[St(10)]})]}),e));else if(a==="line_start")i($(oe(x`(?<=\A|\n(?!\z))`,{skipLookbehindValidation:!0}),e));else if(a==="search_start")if(h.has(t))s.flags.sticky=!0,o();else{const d=r[n-1];if(d&&oc(d))i($(ge({negate:!0}),e));else{if(f)throw new Error(x`Uses "\G" in a way that requires a subclass`);i(ce(ln("string_start"),e)),l.strategy="clip_search"}}else if(!(a==="string_end"||a==="string_start"))if(a==="string_end_newline")i($(oe(x`(?=\n?\z)`),e));else if(a==="word_boundary"){if(!p&&!u){const d=`(?:(?<=${se})(?!${se})|(?<!${se})(?=${se}))`,b=`(?:(?<=${se})(?=${se})|(?<!${se})(?!${se}))`;i($(oe(c?b:d),e))}}else throw new Error(`Unexpected assertion kind "${a}"`)},Backreference({node:t},{jsGroupNameMap:e}){let{ref:n}=t;typeof n=="string"&&!Ft(n)&&(n=Gt(n,e),t.ref=n)},CapturingGroup({node:t},{jsGroupNameMap:e,subroutineRefMap:n}){let{name:r}=t;r&&!Ft(r)&&(r=Gt(r,e),t.name=r),n.set(t.number,t),r&&n.set(r,t)},CharacterClassRange({node:t,parent:e,replaceWith:n}){if(e.kind==="intersection"){const r=ot({body:[t]});n($(r,e),{traverse:!0})}},CharacterSet({node:t,parent:e,replaceWith:n},{accuracy:r,minTargetEs2024:s,digitIsAscii:o,spaceIsAscii:i,wordIsAscii:l}){const{kind:a,negate:c,value:u}=t;if(o&&(a==="digit"||u==="digit")){n(ce(un("digit",{negate:c}),e));return}if(i&&(a==="space"||u==="space")){n($(Ut(oe(zl),c),e));return}if(l&&(a==="word"||u==="word")){n(ce(un("word",{negate:c}),e));return}if(a==="any")n(ce(ve("Any"),e));else if(a==="digit")n(ce(ve("Nd",{negate:c}),e));else if(a!=="dot")if(a==="text_segment"){if(r==="strict")throw new Error(x`Use of "\X" requires non-strict accuracy`);const f="\\p{Emoji}(?:\\p{EMod}|\\uFE0F\\u20E3?|[\\x{E0020}-\\x{E007E}]+\\x{E007F})?",h=x`\p{RI}{2}|${f}(?:\u200D${f})*`;n($(oe(x`(?>\r\n|${s?x`\p{RGI_Emoji}`:h}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),e))}else if(a==="hex")n(ce(ve("AHex",{negate:c}),e));else if(a==="newline")n($(oe(c?`[^
149
+ XID_Start XIDS`.split(/\s/).map(t=>[kt(t),t])),Vl=new Map([["s",D(383)],[D(383),"s"]]),ql=new Map([[D(223),D(7838)],[D(107),D(8490)],[D(229),D(8491)],[D(969),D(8486)]]),Kl=new Map([le(453),le(456),le(459),le(498),...Bt(8072,8079),...Bt(8088,8095),...Bt(8104,8111),le(8124),le(8140),le(8188)]),Xl=new Map([["alnum",x`[\p{Alpha}\p{Nd}]`],["alpha",x`\p{Alpha}`],["ascii",x`\p{ASCII}`],["blank",x`[\p{Zs}\t]`],["cntrl",x`\p{Cc}`],["digit",x`\p{Nd}`],["graph",x`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],["lower",x`\p{Lower}`],["print",x`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],["punct",x`[\p{P}\p{S}]`],["space",x`\p{space}`],["upper",x`\p{Upper}`],["word",x`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],["xdigit",x`\p{AHex}`]]);function Zl(t,e){const n=[];for(let r=t;r<=e;r++)n.push(r);return n}function le(t){const e=D(t);return[e.toLowerCase(),e]}function Bt(t,e){return Zl(t,e).map(n=>le(n))}var Ms=new Set(["Lower","Lowercase","Upper","Uppercase","Ll","Lowercase_Letter","Lt","Titlecase_Letter","Lu","Uppercase_Letter"]);function Ql(t,e){const n={accuracy:"default",asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:"ES2025",...e};Os(t);const r={accuracy:n.accuracy,asciiWordBoundaries:n.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:hn(n.bestEffortTarget,"ES2024"),passedLookbehind:!1,strategy:null,subroutineRefMap:new Map,supportedGNodes:new Set,digitIsAscii:t.flags.digitIsAscii,spaceIsAscii:t.flags.spaceIsAscii,wordIsAscii:t.flags.wordIsAscii};Be(t,Yl,r);const s={dotAll:t.flags.dotAll,ignoreCase:t.flags.ignoreCase},o={currentFlags:s,prevFlags:null,globalFlags:s,groupOriginByCopy:new Map,groupsByName:new Map,multiplexCapturesToLeftByRef:new Map,openRefs:new Map,reffedNodesByReferencer:new Map,subroutineRefMap:r.subroutineRefMap};Be(t,Jl,o);const i={groupsByName:o.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:o.reffedNodesByReferencer};return Be(t,ec,i),t._originMap=o.groupOriginByCopy,t._strategy=r.strategy,t}var Yl={AbsenceFunction({node:t,parent:e,replaceWith:n}){const{body:r,kind:s}=t;if(s==="repeater"){const o=ee();o.body[0].body.push(ge({negate:!0,body:r}),xe("Any"));const i=ee();i.body[0].body.push(Is("greedy",0,1/0,o)),n($(i,e),{traverse:!0})}else throw new Error('Unsupported absence function "(?~|"')},Alternative:{enter({node:t,parent:e,key:n},{flagDirectivesByAlt:r}){const s=t.body.filter(o=>o.kind==="flags");for(let o=n+1;o<e.body.length;o++){const i=e.body[o];ze(r,i,[]).push(...s)}},exit({node:t},{flagDirectivesByAlt:e}){if(e.get(t)?.length){const n=Bs(e.get(t));if(n){const r=ee({flags:n});r.body[0].body=t.body,t.body=[$(r,t)]}}}},Assertion({node:t,parent:e,key:n,container:r,root:s,remove:o,replaceWith:i},l){const{kind:a,negate:c}=t,{asciiWordBoundaries:u,avoidSubclass:f,supportedGNodes:h,wordIsAscii:p}=l;if(a==="text_segment_boundary")throw new Error(`Unsupported text segment boundary "\\${c?"Y":"y"}"`);if(a==="line_end")i($(ge({body:[we({body:[ln("string_end")]}),we({body:[St(10)]})]}),e));else if(a==="line_start")i($(oe(x`(?<=\A|\n(?!\z))`,{skipLookbehindValidation:!0}),e));else if(a==="search_start")if(h.has(t))s.flags.sticky=!0,o();else{const d=r[n-1];if(d&&ic(d))i($(ge({negate:!0}),e));else{if(f)throw new Error(x`Uses "\G" in a way that requires a subclass`);i(ce(ln("string_start"),e)),l.strategy="clip_search"}}else if(!(a==="string_end"||a==="string_start"))if(a==="string_end_newline")i($(oe(x`(?=\n?\z)`),e));else if(a==="word_boundary"){if(!p&&!u){const d=`(?:(?<=${se})(?!${se})|(?<!${se})(?=${se}))`,b=`(?:(?<=${se})(?=${se})|(?<!${se})(?!${se}))`;i($(oe(c?b:d),e))}}else throw new Error(`Unexpected assertion kind "${a}"`)},Backreference({node:t},{jsGroupNameMap:e}){let{ref:n}=t;typeof n=="string"&&!Ft(n)&&(n=Gt(n,e),t.ref=n)},CapturingGroup({node:t},{jsGroupNameMap:e,subroutineRefMap:n}){let{name:r}=t;r&&!Ft(r)&&(r=Gt(r,e),t.name=r),n.set(t.number,t),r&&n.set(r,t)},CharacterClassRange({node:t,parent:e,replaceWith:n}){if(e.kind==="intersection"){const r=ot({body:[t]});n($(r,e),{traverse:!0})}},CharacterSet({node:t,parent:e,replaceWith:n},{accuracy:r,minTargetEs2024:s,digitIsAscii:o,spaceIsAscii:i,wordIsAscii:l}){const{kind:a,negate:c,value:u}=t;if(o&&(a==="digit"||u==="digit")){n(ce(un("digit",{negate:c}),e));return}if(i&&(a==="space"||u==="space")){n($(Ut(oe(Wl),c),e));return}if(l&&(a==="word"||u==="word")){n(ce(un("word",{negate:c}),e));return}if(a==="any")n(ce(xe("Any"),e));else if(a==="digit")n(ce(xe("Nd",{negate:c}),e));else if(a!=="dot")if(a==="text_segment"){if(r==="strict")throw new Error(x`Use of "\X" requires non-strict accuracy`);const f="\\p{Emoji}(?:\\p{EMod}|\\uFE0F\\u20E3?|[\\x{E0020}-\\x{E007E}]+\\x{E007F})?",h=x`\p{RI}{2}|${f}(?:\u200D${f})*`;n($(oe(x`(?>\r\n|${s?x`\p{RGI_Emoji}`:h}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),e))}else if(a==="hex")n(ce(xe("AHex",{negate:c}),e));else if(a==="newline")n($(oe(c?`[^
150
150
  ]`:`(?>\r
151
151
  ?|[
152
- \v\f…\u2028\u2029])`),e));else if(a==="posix")if(!s&&(u==="graph"||u==="print")){if(r==="strict")throw new Error(`POSIX class "${u}" requires min target ES2024 or non-strict accuracy`);let f={graph:"!-~",print:" -~"}[u];c&&(f=`\0-${D(f.codePointAt(0)-1)}${D(f.codePointAt(2)+1)}-􏿿`),n($(oe(`[${f}]`),e))}else n($(Ut(oe(Xl.get(u)),c),e));else if(a==="property")Nn.has(kt(u))||(t.key="sc");else if(a==="space")n(ce(ve("space",{negate:c}),e));else if(a==="word")n($(Ut(oe(se),c),e));else throw new Error(`Unexpected character set kind "${a}"`)},Directive({node:t,parent:e,root:n,remove:r,replaceWith:s,removeAllPrevSiblings:o,removeAllNextSiblings:i}){const{kind:l,flags:a}=t;if(l==="flags")if(!a.enable&&!a.disable)r();else{const c=ee({flags:a});c.body[0].body=i(),s($(c,e),{traverse:!0})}else if(l==="keep"){const c=n.body[0],f=n.body.length===1&&ks(c,{type:"Group"})&&c.body[0].body.length===1?c.body[0]:n;if(e.parent!==f||f.body.length>1)throw new Error(x`Uses "\K" in a way that's unsupported`);const h=ge({behind:!0});h.body[0].body=o(),s($(h,e))}else throw new Error(`Unexpected directive kind "${l}"`)},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(n=>delete t[n]),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:n}=t.flags;e?.extended&&delete e.extended,n?.extended&&delete n.extended,e?.dotAll&&n?.dotAll&&delete e.dotAll,e?.ignoreCase&&n?.ignoreCase&&delete e.ignoreCase,e&&!Object.keys(e).length&&delete t.flags.enable,n&&!Object.keys(n).length&&delete t.flags.disable,!t.flags.enable&&!t.flags.disable&&delete t.flags},LookaroundAssertion({node:t},e){const{kind:n}=t;n==="lookbehind"&&(e.passedLookbehind=!0)},NamedCallout({node:t,parent:e,replaceWith:n}){const{kind:r}=t;if(r==="fail")n($(ge({negate:!0}),e));else throw new Error(`Unsupported named callout "(*${r.toUpperCase()}"`)},Quantifier({node:t}){if(t.body.type==="Quantifier"){const e=ee();e.body[0].body.push(t.body),t.body=$(e,t)}},Regex:{enter({node:t},{supportedGNodes:e}){const n=[];let r=!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 i=Gs(o.body);i?(r=!0,Array.isArray(i)?n.push(...i):n.push(i)):s=!0}r&&!s&&n.forEach(o=>e.add(o))},exit(t,{accuracy:e,passedLookbehind:n,strategy:r}){if(e==="strict"&&n&&r)throw new Error(x`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:t},{jsGroupNameMap:e}){let{ref:n}=t;typeof n=="string"&&!Ft(n)&&(n=Gt(n,e),t.ref=n)}},Yl={Backreference({node:t},{multiplexCapturesToLeftByRef:e,reffedNodesByReferencer:n}){const{orphan:r,ref:s}=t;r||n.set(t,[...e.get(s).map(({node:o})=>o)])},CapturingGroup:{enter({node:t,parent:e,replaceWith:n,skip:r},{groupOriginByCopy:s,groupsByName:o,multiplexCapturesToLeftByRef:i,openRefs:l,reffedNodesByReferencer:a}){const c=s.get(t);if(c&&l.has(t.number)){const f=ce(wr(t.number),e);a.set(f,l.get(t.number)),n(f);return}l.set(t.number,t),i.set(t.number,[]),t.name&&ze(i,t.name,[]);const u=i.get(t.name??t.number);for(let f=0;f<u.length;f++){const h=u[f];if(c===h.node||c&&c===h.origin||t===h.origin){u.splice(f,1);break}}if(i.get(t.number).push({node:t,origin:c}),t.name&&i.get(t.name).push({node:t,origin:c}),t.name){const f=ze(o,t.name,new Map);let h=!1;if(c)h=!0;else for(const p of f.values())if(!p.hasDuplicateNameToRemove){h=!0;break}o.get(t.name).set(t,{node:t,hasDuplicateNameToRemove:h})}},exit({node:t},{openRefs:e}){e.delete(t.number)}},Group:{enter({node:t},e){e.prevFlags=e.currentFlags,t.flags&&(e.currentFlags=yt(e.currentFlags,t.flags))},exit(t,e){e.currentFlags=e.prevFlags}},Subroutine({node:t,parent:e,replaceWith:n},r){const{isRecursive:s,ref:o}=t;if(s){let u=e;for(;(u=u.parent)&&!(u.type==="CapturingGroup"&&(u.name===o||u.number===o)););r.reffedNodesByReferencer.set(t,u);return}const i=r.subroutineRefMap.get(o),l=o===0,a=l?wr(0):Os(i,r.groupOriginByCopy,null);let c=a;if(!l){const u=Ds(nc(i,h=>h.type==="Group"&&!!h.flags)),f=u?yt(r.globalFlags,u):r.globalFlags;ec(f,r.currentFlags)||(c=ee({flags:rc(f)}),c.body[0].body.push(a))}n($(c,e),{traverse:!l})}},Jl={Backreference({node:t,parent:e,replaceWith:n},r){if(t.orphan){r.highestOrphanBackref=Math.max(r.highestOrphanBackref,t.ref);return}const o=r.reffedNodesByReferencer.get(t).filter(i=>tc(i,t));if(!o.length)n($(ge({negate:!0}),e));else if(o.length>1){const i=ee({atomic:!0,body:o.reverse().map(l=>we({body:[cn(l.number)]}))});n($(i,e))}else t.ref=o[0].number},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 n=Math.max(e.highestOrphanBackref-e.numCapturesToLeft,0);for(let r=0;r<n;r++){const s=xs();t.body.at(-1).body.push(s)}}},Subroutine({node:t},e){!t.isRecursive||t.ref===0||(t.ref=e.reffedNodesByReferencer.get(t).number)}};function Ms(t){Be(t,{"*"({node:e,parent:n}){e.parent=n}})}function ec(t,e){return t.dotAll===e.dotAll&&t.ignoreCase===e.ignoreCase}function tc(t,e){let n=e;do{if(n.type==="Regex")return!1;if(n.type==="Alternative")continue;if(n===t)return!1;const r=Bs(n.parent);for(const s of r){if(s===n)break;if(s===t||Fs(s,t))return!0}}while(n=n.parent);throw new Error("Unexpected path")}function Os(t,e,n,r){const s=Array.isArray(t)?[]:{};for(const[o,i]of Object.entries(t))o==="parent"?s.parent=Array.isArray(n)?r:n:i&&typeof i=="object"?s[o]=Os(i,e,s,n):(o==="type"&&i==="CapturingGroup"&&e.set(s,e.get(t)??t),s[o]=i);return s}function wr(t){const e=Is(t);return e.isRecursive=!0,e}function nc(t,e){const n=[];for(;t=t.parent;)(!e||e(t))&&n.push(t);return n}function Gt(t,e){if(e.has(t))return e.get(t);const n=`$${e.size}_${t.replace(/^[^$_\p{IDS}]|[^$\u200C\u200D\p{IDC}]/ug,"_")}`;return e.set(t,n),n}function Ds(t){const e=["dotAll","ignoreCase"],n={enable:{},disable:{}};return t.forEach(({flags:r})=>{e.forEach(s=>{r.enable?.[s]&&(delete n.disable[s],n.enable[s]=!0),r.disable?.[s]&&(n.disable[s]=!0)})}),Object.keys(n.enable).length||delete n.enable,Object.keys(n.disable).length||delete n.disable,n.enable||n.disable?n:null}function rc({dotAll:t,ignoreCase:e}){const n={};return(t||e)&&(n.enable={},t&&(n.enable.dotAll=!0),e&&(n.enable.ignoreCase=!0)),(!t||!e)&&(n.disable={},!t&&(n.disable.dotAll=!0),!e&&(n.disable.ignoreCase=!0)),n}function Bs(t){if(!t)throw new Error("Node expected");const{body:e}=t;return Array.isArray(e)?e:e?[e]:null}function Gs(t){const e=t.find(n=>n.kind==="search_start"||ic(n,{negate:!1})||!sc(n));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 n=[];for(const r of e.body){const s=Gs(r.body);if(!s)return null;Array.isArray(s)?n.push(...s):n.push(s)}return n}return null}function Fs(t,e){const n=Bs(t)??[];for(const r of n)if(r===e||Fs(r,e))return!0;return!1}function sc({type:t}){return t==="Assertion"||t==="Directive"||t==="LookaroundAssertion"}function oc(t){const e=["Character","CharacterClass","CharacterSet"];return e.includes(t.type)||t.type==="Quantifier"&&t.min&&e.includes(t.body.type)}function ic(t,e){const n={negate:null,...e};return t.type==="LookaroundAssertion"&&(n.negate===null||t.negate===n.negate)&&t.body.length===1&&ks(t.body[0],{type:"Assertion",kind:"search_start"})}function Ft(t){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(t)}function oe(t,e){const r=vs(t,{...e,unicodePropertyMap:Nn}).body;return r.length>1||r[0].body.length>1?ee({body:r}):r[0].body[0]}function Ut(t,e){return t.negate=e,t}function ce(t,e){return t.parent=e,t}function $(t,e){return Ms(t),t.parent=e,t}function ac(t,e){const n=Ts(e),r=hn(n.target,"ES2024"),s=hn(n.target,"ES2025"),o=n.rules.recursionLimit;if(!Number.isInteger(o)||o<2||o>20)throw new Error("Invalid recursionLimit; use 2-20");let i=null,l=null;if(!s){const p=[t.flags.ignoreCase];Be(t,lc,{getCurrentModI:()=>p.at(-1),popModI(){p.pop()},pushModI(d){p.push(d)},setHasCasedChar(){p.at(-1)?i=!0:l=!0}})}const a={dotAll:t.flags.dotAll,ignoreCase:!!((t.flags.ignoreCase||i)&&!l)};let c=t;const u={accuracy:n.accuracy,appliedGlobalFlags:a,captureMap:new Map,currentFlags:{dotAll:t.flags.dotAll,ignoreCase:t.flags.ignoreCase},inCharClass:!1,lastNode:c,originMap:t._originMap,recursionLimit:o,useAppliedIgnoreCase:!!(!s&&i&&l),useFlagMods:s,useFlagV:r,verbose:n.verbose};function f(p){return u.lastNode=c,c=p,Ul(cc[p.type],`Unexpected node type "${p.type}"`)(p,u,f)}const h={pattern:t.body.map(f).join("|"),flags:f(t.flags),options:{...t.options}};return r||(delete h.options.force.v,h.options.disable.v=!0,h.options.unicodeSetsPlugin=null),h._captureTransfers=new Map,h._hiddenCaptures=[],u.captureMap.forEach((p,d)=>{p.hidden&&h._hiddenCaptures.push(d),p.transferTo&&ze(h._captureTransfers,p.transferTo,[]).push(d)}),h}var lc={"*":{enter({node:t},e){if(_r(t)){const n=e.getCurrentModI();e.pushModI(t.flags?yt({ignoreCase:n},t.flags).ignoreCase:n)}},exit({node:t},e){_r(t)&&e.popModI()}},Backreference(t,e){e.setHasCasedChar()},Character({node:t},e){Tn(D(t.value))&&e.setHasCasedChar()},CharacterClassRange({node:t,skip:e},n){e(),Us(t,{firstOnly:!0}).length&&n.setHasCasedChar()},CharacterSet({node:t},e){t.kind==="property"&&$s.has(t.value)&&e.setHasCasedChar()}},cc={Alternative({body:t},e,n){return t.map(n).join("")},Assertion({kind:t,negate:e}){if(t==="string_end")return"$";if(t==="string_start")return"^";if(t==="word_boundary")return e?x`\B`:x`\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,n){const{body:r,name:s,number:o}=t,i={ignoreCase:e.currentFlags.ignoreCase},l=e.originMap.get(t);return l&&(i.hidden=!0,o>l.number&&(i.transferTo=l.number)),e.captureMap.set(o,i),`(${s?`?<${s}>`:""}${r.map(n).join("|")})`},Character({value:t},e){const n=D(t),r=Se(t,{escDigit:e.lastNode.type==="Backreference",inCharClass:e.inCharClass,useFlagV:e.useFlagV});if(r!==n)return r;if(e.useAppliedIgnoreCase&&e.currentFlags.ignoreCase&&Tn(n)){const s=Ps(n);return e.inCharClass?s.join(""):s.length>1?`[${s.join("")}]`:s[0]}return n},CharacterClass(t,e,n){const{kind:r,negate:s,parent:o}=t;let{body:i}=t;if(r==="intersection"&&!e.useFlagV)throw new Error("Use of character class intersection requires min target ES2024");ae.bugFlagVLiteralHyphenIsRange&&e.useFlagV&&i.some(Sr)&&(i=[St(45),...i.filter(c=>!Sr(c))]);const l=()=>`[${s?"^":""}${i.map(n).join(r==="intersection"?"&&":"")}]`;if(!e.inCharClass){if((!e.useFlagV||ae.bugNestedClassIgnoresNegation)&&!s){const u=i.filter(f=>f.type==="CharacterClass"&&f.kind==="union"&&f.negate);if(u.length){const f=ee(),h=f.body[0];return f.parent=o,h.parent=f,i=i.filter(p=>!u.includes(p)),t.body=i,i.length?(t.parent=h,h.body.push(t)):f.body.pop(),u.forEach(p=>{const d=we({body:[p]});p.parent=d,d.parent=f,f.body.push(d)}),n(f)}}e.inCharClass=!0;const c=l();return e.inCharClass=!1,c}const a=i[0];if(r==="union"&&!s&&a&&((!e.useFlagV||!e.verbose)&&o.kind==="union"&&!(ae.bugFlagVLiteralHyphenIsRange&&e.useFlagV)||!e.verbose&&o.kind==="intersection"&&i.length===1&&a.type!=="CharacterClassRange"))return i.map(n).join("");if(!e.useFlagV&&o.type==="CharacterClass")throw new Error("Uses nested character class in a way that requires min target ES2024");return l()},CharacterClassRange(t,e){const n=t.min.value,r=t.max.value,s={escDigit:!1,inCharClass:!0,useFlagV:e.useFlagV},o=Se(n,s),i=Se(r,s),l=new Set;if(e.useAppliedIgnoreCase&&e.currentFlags.ignoreCase){const a=Us(t);pc(a).forEach(u=>{l.add(Array.isArray(u)?`${Se(u[0],s)}-${Se(u[1],s)}`:Se(u,s))})}return`${o}-${i}${[...l].join("")}`},CharacterSet({kind:t,negate:e,value:n,key:r},s){if(t==="dot")return s.currentFlags.dotAll?s.appliedGlobalFlags.dotAll||s.useFlagMods?".":"[^]":x`[^\n]`;if(t==="digit")return e?x`\D`:x`\d`;if(t==="property"){if(s.useAppliedIgnoreCase&&s.currentFlags.ignoreCase&&$s.has(n))throw new Error(`Unicode property "${n}" can't be case-insensitive when other chars have specific case`);return`${e?x`\P`:x`\p`}{${r?`${r}=`:""}${n}}`}if(t==="word")return e?x`\W`:x`\w`;throw new Error(`Unexpected character set kind "${t}"`)},Flags(t,e){return(e.appliedGlobalFlags.ignoreCase?"i":"")+(t.dotAll?"s":"")+(t.sticky?"y":"")},Group({atomic:t,body:e,flags:n,parent:r},s,o){const i=s.currentFlags;n&&(s.currentFlags=yt(i,n));const l=e.map(o).join("|"),a=!s.verbose&&e.length===1&&r.type!=="Quantifier"&&!t&&(!s.useFlagMods||!n)?l:`(?${gc(t,n,s.useFlagMods)}${l})`;return s.currentFlags=i,a},LookaroundAssertion({body:t,kind:e,negate:n},r,s){return`(?${`${e==="lookahead"?"":"<"}${n?"!":"="}`}${t.map(s).join("|")})`},Quantifier(t,e,n){return n(t.body)+mc(t)},Subroutine({isRecursive:t,ref:e},n){if(!t)throw new Error("Unexpected non-recursive subroutine in transformed AST");const r=n.recursionLimit;return e===0?`(?R=${r})`:x`\g<${e}&R=${r}>`}},uc=new Set(["$","(",")","*","+",".","?","[","\\","]","^","{","|","}"]),fc=new Set(["-","\\","]","^","["]),hc=new Set(["(",")","-","/","[","\\","]","^","{","|","}","!","#","$","%","&","*","+",",",".",":",";","<","=",">","?","@","`","~"]),Cr=new Map([[9,x`\t`],[10,x`\n`],[11,x`\v`],[12,x`\f`],[13,x`\r`],[8232,x`\u2028`],[8233,x`\u2029`],[65279,x`\uFEFF`]]),dc=new RegExp("^\\p{Cased}$","u");function Tn(t){return dc.test(t)}function Us(t,e){const n=!!e?.firstOnly,r=t.min.value,s=t.max.value,o=[];if(r<65&&(s===65535||s>=131071)||r===65536&&s>=131071)return o;for(let i=r;i<=s;i++){const l=D(i);if(!Tn(l))continue;const a=Ps(l).filter(c=>{const u=c.codePointAt(0);return u<r||u>s});if(a.length&&(o.push(...a),n))break}return o}function Se(t,{escDigit:e,inCharClass:n,useFlagV:r}){if(Cr.has(t))return Cr.get(t);if(t<32||t>126&&t<160||t>262143||e&&yc(t))return t>255?`\\u{${t.toString(16).toUpperCase()}}`:`\\x${t.toString(16).toUpperCase().padStart(2,"0")}`;const s=n?r?hc:fc:uc,o=D(t);return(s.has(o)?"\\":"")+o}function pc(t){const e=t.map(s=>s.codePointAt(0)).sort((s,o)=>s-o),n=[];let r=null;for(let s=0;s<e.length;s++)e[s+1]===e[s]+1?r??=e[s]:r===null?n.push(e[s]):(n.push([r,e[s]]),r=null);return n}function gc(t,e,n){if(t)return">";let r="";if(e&&n){const{enable:s,disable:o}=e;r=(s?.ignoreCase?"i":"")+(s?.dotAll?"s":"")+(o?"-":"")+(o?.ignoreCase?"i":"")+(o?.dotAll?"s":"")}return`${r}:`}function mc({kind:t,max:e,min:n}){let r;return!n&&e===1?r="?":!n&&e===1/0?r="*":n===1&&e===1/0?r="+":n===e?r=`{${n}}`:r=`{${n},${e===1/0?"":e}}`,r+{greedy:"",lazy:"?",possessive:"+"}[t]}function _r({type:t}){return t==="CapturingGroup"||t==="Group"||t==="LookaroundAssertion"}function yc(t){return t>47&&t<58}function Sr({type:t,value:e}){return t==="Character"&&e===45}var bc=class dn extends RegExp{#t=new Map;#e=null;#r;#n=null;#s=null;rawOptions={};get source(){return this.#r||"(?:)"}constructor(e,n,r){const s=!!r?.lazyCompile;if(e instanceof RegExp){if(r)throw new Error("Cannot provide options when copying a regexp");const o=e;super(o,n),this.#r=o.source,o instanceof dn&&(this.#t=o.#t,this.#n=o.#n,this.#s=o.#s,this.rawOptions=o.rawOptions)}else{const o={hiddenCaptures:[],strategy:null,transfers:[],...r};super(s?"":e,n),this.#r=e,this.#t=Cc(o.hiddenCaptures,o.transfers),this.#s=o.strategy,this.rawOptions=r??{}}s||(this.#e=this)}exec(e){if(!this.#e){const{lazyCompile:s,...o}=this.rawOptions;this.#e=new dn(this.#r,this.flags,o)}const n=this.global||this.sticky,r=this.lastIndex;if(this.#s==="clip_search"&&n&&r){this.lastIndex=0;const s=this.#o(e.slice(r));return s&&(wc(s,r,e,this.hasIndices),this.lastIndex+=r),s}return this.#o(e)}#o(e){this.#e.lastIndex=this.lastIndex;const n=super.exec.call(this.#e,e);if(this.lastIndex=this.#e.lastIndex,!n||!this.#t.size)return n;const r=[...n];n.length=1;let s;this.hasIndices&&(s=[...n.indices],n.indices.length=1);const o=[0];for(let i=1;i<r.length;i++){const{hidden:l,transferTo:a}=this.#t.get(i)??{};if(l?o.push(null):(o.push(n.length),n.push(r[i]),this.hasIndices&&n.indices.push(s[i])),a&&r[i]!==void 0){const c=o[a];if(!c)throw new Error(`Invalid capture transfer to "${c}"`);if(n[c]=r[i],this.hasIndices&&(n.indices[c]=s[i]),n.groups){this.#n||(this.#n=_c(this.source));const u=this.#n.get(a);u&&(n.groups[u]=r[i],this.hasIndices&&(n.indices.groups[u]=s[i]))}}}return n}};function wc(t,e,n,r){if(t.index+=e,t.input=n,r){const s=t.indices;for(let i=0;i<s.length;i++){const l=s[i];l&&(s[i]=[l[0]+e,l[1]+e])}const o=s.groups;o&&Object.keys(o).forEach(i=>{const l=o[i];l&&(o[i]=[l[0]+e,l[1]+e])})}}function Cc(t,e){const n=new Map;for(const r of t)n.set(r,{hidden:!0});for(const[r,s]of e)for(const o of s)ze(n,o,{}).transferTo=r;return n}function _c(t){const e=/(?<capture>\((?:\?<(?![=!])(?<name>[^>]+)>|(?!\?)))|\\?./gsu,n=new Map;let r=0,s=0,o;for(;o=e.exec(t);){const{0:i,groups:{capture:l,name:a}}=o;i==="["?r++:r?i==="]"&&r--:l&&(s++,a&&n.set(s,a))}return n}function Sc(t,e){const n=kc(t,e);return n.options?new bc(n.pattern,n.flags,n.options):new RegExp(n.pattern,n.flags)}function kc(t,e){const n=Ts(e),r=vs(t,{flags:n.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline},skipBackrefValidation:n.rules.allowOrphanBackrefs,unicodePropertyMap:Nn}),s=Zl(r,{accuracy:n.accuracy,asciiWordBoundaries:n.rules.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,bestEffortTarget:n.target}),o=ac(s,n),i=Gl(o.pattern,{captureTransfers:o._captureTransfers,hiddenCaptures:o._hiddenCaptures,mode:"external"}),l=Dl(i.pattern),a=Ol(l.pattern,{captureTransfers:i.captureTransfers,hiddenCaptures:i.hiddenCaptures}),c={pattern:a.pattern,flags:`${n.hasIndices?"d":""}${n.global?"g":""}${o.flags}${o.options.disable.v?"u":"v"}`};if(n.avoidSubclass){if(n.lazyCompileLength!==1/0)throw new Error("Lazy compilation requires subclass")}else{const u=a.hiddenCaptures.sort((d,b)=>d-b),f=Array.from(a.captureTransfers),h=s._strategy,p=c.pattern.length>=n.lazyCompileLength;(u.length||f.length||h||p)&&(c.options={...u.length&&{hiddenCaptures:u},...f.length&&{transfers:f},...h&&{strategy:h},...p&&{lazyCompile:p}})}return c}const kr=4294967295;class vc{constructor(e,n={}){this.patterns=e,this.options=n;const{forgiving:r=!1,cache:s,regexConstructor:o}=n;if(!o)throw new Error("Option `regexConstructor` is not provided");this.regexps=e.map(i=>{if(typeof i!="string")return i;const l=s?.get(i);if(l){if(l instanceof RegExp)return l;if(r)return null;throw l}try{const a=o(i);return s?.set(i,a),a}catch(a){if(s?.set(i,a),r)return null;throw a}})}regexps;findNextMatchSync(e,n,r){const s=typeof e=="string"?e:e.content,o=[];function i(l,a,c=0){return{index:l,captureIndices:a.indices.map(u=>u==null?{start:kr,end:kr,length:0}:{start:u[0]+c,end:u[1]+c,length:u[1]-u[0]})}}for(let l=0;l<this.regexps.length;l++){const a=this.regexps[l];if(a)try{a.lastIndex=n;const c=a.exec(s);if(!c)continue;if(c.index===n)return i(l,c,0);o.push([l,c,0])}catch(c){if(this.options.forgiving)continue;throw c}}if(o.length){const l=Math.min(...o.map(a=>a[1].index));for(const[a,c,u]of o)if(c.index===l)return i(a,c,u)}return null}}function xc(t,e){return Sc(t,{global:!0,hasIndices:!0,lazyCompileLength:3e3,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...e})}function Ec(t={}){const e=Object.assign({target:"auto",cache:new Map},t);return e.regexConstructor||=n=>xc(n,{target:e.target}),{createScanner(n){return new vc(n,e)},createString(n){return{content:n}}}}class Pn extends Error{constructor(e){super(e),this.name="ShikiError"}}function Ic(){return 2147483648}function Ac(){return typeof performance<"u"?performance.now():Date.now()}const Rc=(t,e)=>t+(e-t%e)%e;async function Lc(t){let e,n;const r={};function s(p){n=p,r.HEAPU8=new Uint8Array(p),r.HEAPU32=new Uint32Array(p)}function o(p,d,b){r.HEAPU8.copyWithin(p,d,d+b)}function i(p){try{return e.grow(p-n.byteLength+65535>>>16),s(e.buffer),1}catch{}}function l(p){const d=r.HEAPU8.length;p=p>>>0;const b=Ic();if(p>b)return!1;for(let w=1;w<=4;w*=2){let g=d*(1+.2/w);g=Math.min(g,p+100663296);const y=Math.min(b,Rc(Math.max(p,g),65536));if(i(y))return!0}return!1}const a=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function c(p,d,b=1024){const w=d+b;let g=d;for(;p[g]&&!(g>=w);)++g;if(g-d>16&&p.buffer&&a)return a.decode(p.subarray(d,g));let y="";for(;d<g;){let m=p[d++];if(!(m&128)){y+=String.fromCharCode(m);continue}const _=p[d++]&63;if((m&224)===192){y+=String.fromCharCode((m&31)<<6|_);continue}const S=p[d++]&63;if((m&240)===224?m=(m&15)<<12|_<<6|S:m=(m&7)<<18|_<<12|S<<6|p[d++]&63,m<65536)y+=String.fromCharCode(m);else{const k=m-65536;y+=String.fromCharCode(55296|k>>10,56320|k&1023)}}return y}function u(p,d){return p?c(r.HEAPU8,p,d):""}const f={emscripten_get_now:Ac,emscripten_memcpy_big:o,emscripten_resize_heap:l,fd_write:()=>0};async function h(){const d=await t({env:f,wasi_snapshot_preview1:f});e=d.memory,s(e.buffer),Object.assign(r,d),r.UTF8ToString=u}return await h(),r}var Nc=Object.defineProperty,Tc=(t,e,n)=>e in t?Nc(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,B=(t,e,n)=>Tc(t,typeof e!="symbol"?e+"":e,n);let F=null;function Pc(t){throw new Pn(t.UTF8ToString(t.getLastOnigError()))}class xt{constructor(e){B(this,"utf16Length"),B(this,"utf8Length"),B(this,"utf16Value"),B(this,"utf8Value"),B(this,"utf16OffsetToUtf8"),B(this,"utf8OffsetToUtf16");const n=e.length,r=xt._utf8ByteLength(e),s=r!==n,o=s?new Uint32Array(n+1):null;s&&(o[n]=r);const i=s?new Uint32Array(r+1):null;s&&(i[r]=n);const l=new Uint8Array(r);let a=0;for(let c=0;c<n;c++){const u=e.charCodeAt(c);let f=u,h=!1;if(u>=55296&&u<=56319&&c+1<n){const p=e.charCodeAt(c+1);p>=56320&&p<=57343&&(f=(u-55296<<10)+65536|p-56320,h=!0)}s&&(o[c]=a,h&&(o[c+1]=a),f<=127?i[a+0]=c:f<=2047?(i[a+0]=c,i[a+1]=c):f<=65535?(i[a+0]=c,i[a+1]=c,i[a+2]=c):(i[a+0]=c,i[a+1]=c,i[a+2]=c,i[a+3]=c)),f<=127?l[a++]=f:f<=2047?(l[a++]=192|(f&1984)>>>6,l[a++]=128|(f&63)>>>0):f<=65535?(l[a++]=224|(f&61440)>>>12,l[a++]=128|(f&4032)>>>6,l[a++]=128|(f&63)>>>0):(l[a++]=240|(f&1835008)>>>18,l[a++]=128|(f&258048)>>>12,l[a++]=128|(f&4032)>>>6,l[a++]=128|(f&63)>>>0),h&&c++}this.utf16Length=n,this.utf8Length=r,this.utf16Value=e,this.utf8Value=l,this.utf16OffsetToUtf8=o,this.utf8OffsetToUtf16=i}static _utf8ByteLength(e){let n=0;for(let r=0,s=e.length;r<s;r++){const o=e.charCodeAt(r);let i=o,l=!1;if(o>=55296&&o<=56319&&r+1<s){const a=e.charCodeAt(r+1);a>=56320&&a<=57343&&(i=(o-55296<<10)+65536|a-56320,l=!0)}i<=127?n+=1:i<=2047?n+=2:i<=65535?n+=3:n+=4,l&&r++}return n}createString(e){const n=e.omalloc(this.utf8Length);return e.HEAPU8.set(this.utf8Value,n),n}}const Et=class re{constructor(e){if(B(this,"id",++re.LAST_ID),B(this,"_onigBinding"),B(this,"content"),B(this,"utf16Length"),B(this,"utf8Length"),B(this,"utf16OffsetToUtf8"),B(this,"utf8OffsetToUtf16"),B(this,"ptr"),!F)throw new Pn("Must invoke loadWasm first.");this._onigBinding=F,this.content=e;const n=new xt(e);this.utf16Length=n.utf16Length,this.utf8Length=n.utf8Length,this.utf16OffsetToUtf8=n.utf16OffsetToUtf8,this.utf8OffsetToUtf16=n.utf8OffsetToUtf16,this.utf8Length<1e4&&!re._sharedPtrInUse?(re._sharedPtr||(re._sharedPtr=F.omalloc(1e4)),re._sharedPtrInUse=!0,F.HEAPU8.set(n.utf8Value,re._sharedPtr),this.ptr=re._sharedPtr):this.ptr=n.createString(F)}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===re._sharedPtr?re._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};B(Et,"LAST_ID",0);B(Et,"_sharedPtr",0);B(Et,"_sharedPtrInUse",!1);let js=Et;class $c{constructor(e){if(B(this,"_onigBinding"),B(this,"_ptr"),!F)throw new Pn("Must invoke loadWasm first.");const n=[],r=[];for(let l=0,a=e.length;l<a;l++){const c=new xt(e[l]);n[l]=c.createString(F),r[l]=c.utf8Length}const s=F.omalloc(4*e.length);F.HEAPU32.set(n,s/4);const o=F.omalloc(4*e.length);F.HEAPU32.set(r,o/4);const i=F.createOnigScanner(s,o,e.length);for(let l=0,a=e.length;l<a;l++)F.ofree(n[l]);F.ofree(o),F.ofree(s),i===0&&Pc(F),this._onigBinding=F,this._ptr=i}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(e,n,r){let s=0;if(typeof r=="number"&&(s=r),typeof e=="string"){e=new js(e);const o=this._findNextMatchSync(e,n,!1,s);return e.dispose(),o}return this._findNextMatchSync(e,n,!1,s)}_findNextMatchSync(e,n,r,s){const o=this._onigBinding,i=o.findNextOnigScannerMatch(this._ptr,e.id,e.ptr,e.utf8Length,e.convertUtf16OffsetToUtf8(n),s);if(i===0)return null;const l=o.HEAPU32;let a=i/4;const c=l[a++],u=l[a++],f=[];for(let h=0;h<u;h++){const p=e.convertUtf8OffsetToUtf16(l[a++]),d=e.convertUtf8OffsetToUtf16(l[a++]);f[h]={start:p,end:d,length:d-p}}return{index:c,captureIndices:f}}}function Mc(t){return typeof t.instantiator=="function"}function Oc(t){return typeof t.default=="function"}function Dc(t){return typeof t.data<"u"}function Bc(t){return typeof Response<"u"&&t instanceof Response}function Gc(t){return typeof ArrayBuffer<"u"&&(t instanceof ArrayBuffer||ArrayBuffer.isView(t))||typeof Buffer<"u"&&Buffer.isBuffer?.(t)||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer||typeof Uint32Array<"u"&&t instanceof Uint32Array}let Je;function Fc(t){if(Je)return Je;async function e(){F=await Lc(async n=>{let r=t;return r=await r,typeof r=="function"&&(r=await r(n)),typeof r=="function"&&(r=await r(n)),Mc(r)?r=await r.instantiator(n):Oc(r)?r=await r.default(n):(Dc(r)&&(r=r.data),Bc(r)?typeof WebAssembly.instantiateStreaming=="function"?r=await Uc(r)(n):r=await jc(r)(n):Gc(r)?r=await jt(r)(n):r instanceof WebAssembly.Module?r=await jt(r)(n):"default"in r&&r.default instanceof WebAssembly.Module&&(r=await jt(r.default)(n))),"instance"in r&&(r=r.instance),"exports"in r&&(r=r.exports),r})}return Je=e(),Je}function jt(t){return e=>WebAssembly.instantiate(t,e)}function Uc(t){return e=>WebAssembly.instantiateStreaming(t,e)}function jc(t){return async e=>{const n=await t.arrayBuffer();return WebAssembly.instantiate(n,e)}}async function zc(t){return t&&await Fc(t),{createScanner(e){return new $c(e.map(n=>typeof n=="string"?n:n.source))},createString(e){return new js(e)}}}function Wc(t){return t!==null&&typeof t=="object"&&"default"in t?t.default:t}var Hc=class extends Error{constructor(t){super(`Theme "${t}" is already registered`),this.name="DuplicateThemeError"}},Vc=class extends Error{constructor(t){super(`No loader registered for theme "${t}"`),this.name="UnregisteredThemeError"}},qc=class extends Error{constructor(t){super(`Theme "${t}" has not been resolved`),this.name="UnresolvedThemeError"}};function Xc(){const t=new Map,e=new Map,n=new Map;let r=0;function s(g,y){if(t.has(g))throw new Hc(g);t.set(g,y)}function o(g,y){return t.has(g)?!1:(t.set(g,y),!0)}function i(g){return t.has(g)}function l(g){const y=e.get(g);if(y!==void 0)return Promise.resolve(y);const m=n.get(g);if(m!==void 0)return m;const _=t.get(g);if(_===void 0)return Promise.reject(new Vc(g));const S=r,k=_().then(v=>{const A=Wc(v);return S===r&&e.set(g,A),n.get(g)===k&&n.delete(g),A}).catch(v=>{throw n.get(g)===k&&n.delete(g),v});return n.set(g,k),k}function a(g){return Promise.all(g.map(y=>l(y)))}function c(g,y){e.set(g,y)}function u(g){for(const[y,m]of g)c(y,m)}function f(g){return e.get(g)}function h(g){const y=[];for(const m of g){const _=e.get(m);if(_===void 0)throw new qc(m);y.push(_)}return y}function p(g){return e.has(g)}function d(g){for(const y of g)if(!e.has(y))return!1;return!0}function b(g){const y=e.get(g);return y!==void 0?y:l(g)}function w(){r++,e.clear(),n.clear()}return{clearResolvedThemes:w,getResolvedOrResolveTheme:b,getResolvedTheme:f,getResolvedThemes:h,hasRegisteredTheme:i,hasResolvedTheme:p,hasResolvedThemes:d,registerTheme:s,registerThemeIfAbsent:o,resolveTheme:l,resolveThemes:a,seedResolvedTheme:c,seedResolvedThemes:u}}class zs{diff(e,n,r={}){let s;typeof r=="function"?(s=r,r={}):"callback"in r&&(s=r.callback);const o=this.castInput(e,r),i=this.castInput(n,r),l=this.removeEmpty(this.tokenize(o,r)),a=this.removeEmpty(this.tokenize(i,r));return this.diffWithOptionsObj(l,a,r,s)}diffWithOptionsObj(e,n,r,s){var o;const i=y=>{if(y=this.postProcess(y,r),s){setTimeout(function(){s(y)},0);return}else return y},l=n.length,a=e.length;let c=1,u=l+a;r.maxEditLength!=null&&(u=Math.min(u,r.maxEditLength));const f=(o=r.timeout)!==null&&o!==void 0?o:1/0,h=Date.now()+f,p=[{oldPos:-1,lastComponent:void 0}];let d=this.extractCommon(p[0],n,e,0,r);if(p[0].oldPos+1>=a&&d+1>=l)return i(this.buildValues(p[0].lastComponent,n,e));let b=-1/0,w=1/0;const g=()=>{for(let y=Math.max(b,-c);y<=Math.min(w,c);y+=2){let m;const _=p[y-1],S=p[y+1];_&&(p[y-1]=void 0);let k=!1;if(S){const A=S.oldPos-y;k=S&&0<=A&&A<l}const v=_&&_.oldPos+1<a;if(!k&&!v){p[y]=void 0;continue}if(!v||k&&_.oldPos<S.oldPos?m=this.addToPath(S,!0,!1,0,r):m=this.addToPath(_,!1,!0,1,r),d=this.extractCommon(m,n,e,y,r),m.oldPos+1>=a&&d+1>=l)return i(this.buildValues(m.lastComponent,n,e))||!0;p[y]=m,m.oldPos+1>=a&&(w=Math.min(w,y-1)),d+1>=l&&(b=Math.max(b,y+1))}c++};if(s)(function y(){setTimeout(function(){if(c>u||Date.now()>h)return s(void 0);g()||y()},0)})();else for(;c<=u&&Date.now()<=h;){const y=g();if(y)return y}}addToPath(e,n,r,s,o){const i=e.lastComponent;return i&&!o.oneChangePerToken&&i.added===n&&i.removed===r?{oldPos:e.oldPos+s,lastComponent:{count:i.count+1,added:n,removed:r,previousComponent:i.previousComponent}}:{oldPos:e.oldPos+s,lastComponent:{count:1,added:n,removed:r,previousComponent:i}}}extractCommon(e,n,r,s,o){const i=n.length,l=r.length;let a=e.oldPos,c=a-s,u=0;for(;c+1<i&&a+1<l&&this.equals(r[a+1],n[c+1],o);)c++,a++,u++,o.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return u&&!o.oneChangePerToken&&(e.lastComponent={count:u,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=a,c}equals(e,n,r){return r.comparator?r.comparator(e,n):e===n||!!r.ignoreCase&&e.toLowerCase()===n.toLowerCase()}removeEmpty(e){const n=[];for(let r=0;r<e.length;r++)e[r]&&n.push(e[r]);return n}castInput(e,n){return e}tokenize(e,n){return Array.from(e)}join(e){return e.join("")}postProcess(e,n){return e}get useLongestToken(){return!1}buildValues(e,n,r){const s=[];let o;for(;e;)s.push(e),o=e.previousComponent,delete e.previousComponent,e=o;s.reverse();const i=s.length;let l=0,a=0,c=0;for(;l<i;l++){const u=s[l];if(u.removed)u.value=this.join(r.slice(c,c+u.count)),c+=u.count;else{if(!u.added&&this.useLongestToken){let f=n.slice(a,a+u.count);f=f.map(function(h,p){const d=r[c+p];return d.length>h.length?d:h}),u.value=this.join(f)}else u.value=this.join(n.slice(a,a+u.count));a+=u.count,u.added||(c+=u.count)}}return s}}class Kc extends zs{}const Zc=new Kc;function Qc(t,e,n){return Zc.diff(t,e,n)}const vr="a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}";class Yc extends zs{tokenize(e){const n=new RegExp(`(\\r?\\n)|[${vr}]+|[^\\S\\n\\r]+|[^${vr}]`,"ug");return e.match(n)||[]}}const Jc=new Yc;function eu(t,e,n){return Jc.diff(t,e,n)}function tu(t={}){const{classPrefix:e="__shiki_",classSuffix:n="",classReplacer:r=l=>l}=t,s=new Map;function o(l){return Object.entries(l).map(([a,c])=>`${a}:${c}`).join(";")}function i(l){const a=typeof l=="string"?l:o(l);let c=e+nu(a)+n;return c=r(c),s.has(c)||s.set(c,typeof l=="string"?l:{...l}),c}return{name:"@shikijs/transformers:style-to-class",pre(l){if(!l.properties.style)return;const a=i(l.properties.style);delete l.properties.style,this.addClassToHast(l,a)},tokens(l){for(const a of l)for(const c of a){if(!c.htmlStyle)continue;const u=i(c.htmlStyle);c.htmlStyle={},c.htmlAttrs||={},c.htmlAttrs.class?c.htmlAttrs.class+=` ${u}`:c.htmlAttrs.class=u}},getClassRegistry(){return s},getCSS(){let l="";for(const[a,c]of s.entries())l+=`.${a}{${typeof c=="string"?c:o(c)}}`;return l},clearRegistry(){s.clear()}}}function nu(t,e=0){let n=3735928559^e,r=1103547991^e;for(let s=0,o;s<t.length;s++)o=t.charCodeAt(s),n=Math.imul(n^o,2654435761),r=Math.imul(r^o,1597334677);return n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(r^r>>>13,3266489909),r=Math.imul(r^r>>>16,2246822507),r^=Math.imul(n^n>>>13,3266489909),(4294967296*(2097151&r)+(n>>>0)).toString(36).slice(0,6)}const ru=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,su=/^0(?:\.0+)?%?$/;function ou(t){const e=t.indexOf("(");if(e<=0||!t.endsWith(")"))return;const n=t.slice(0,e).trim();if(!/^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)$/i.test(n))return;const r=t.slice(e+1,-1).trim();if(r.length===0)return;const s=r.lastIndexOf("/");if(s!==-1)return r.slice(s+1).trim();if(/^(?:rgba|hsla)$/i.test(n)){const o=r.split(",");if(o.length===4)return o[3]?.trim()}}function iu(t){const e=/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})\b/i.exec(t.trim());if(e==null)return null;const n=e[1];let r,s=1;return n.length===3?r=n.split("").map(o=>o+o).join(""):n.length===6?r=n:(r=n.slice(0,6),s=parseInt(n.slice(6,8),16)/255),[parseInt(r.slice(0,2),16),parseInt(r.slice(2,4),16),parseInt(r.slice(4,6),16),s]}function zt(t){if(t==null)return null;const e=iu(t);if(e==null)return null;const n=e[0]/255,r=e[1]/255,s=e[2]/255,o=i=>i<=.03928?i/12.92:((i+.055)/1.055)**2.4;return .2126*o(n)+.7152*o(r)+.0722*o(s)}function xr(t){if(t==null)return!1;const e=t.trim().toLowerCase();if(e==="transparent"||ru.test(e))return!0;const n=ou(e);return n!=null&&su.test(n)}function au(t,e,n){if(e==null||n==null)return!1;const r=zt(t),s=zt(e),o=zt(n);return r==null||s==null||o==null?!1:Math.abs(r-o)<Math.abs(r-s)}const Er=new WeakMap;function Wt(t){const e=Er.get(t);if(e!=null)return e;const n=t.colors??{},r={...n},s=n["editor.background"]??t.bg,o=n["editor.foreground"]??t.fg,i=n["sideBar.background"]??s,l=n["sideBar.foreground"]??o;te(r,"editor.background",s),te(r,"editor.foreground",o),te(r,"sideBar.background",i),te(r,"sideBar.foreground",l),te(r,"input.background",n["input.background"]??i),te(r,"sideBarSectionHeader.foreground",n["sideBarSectionHeader.foreground"]??l),te(r,"list.activeSelectionForeground",n["list.activeSelectionForeground"]??l),te(r,"gitDecoration.addedResourceForeground",Ht(n["gitDecoration.addedResourceForeground"],n["terminal.ansiGreen"],n["editorGutter.addedBackground"])),te(r,"gitDecoration.modifiedResourceForeground",Ht(n["gitDecoration.modifiedResourceForeground"],n["terminal.ansiBlue"],n["editorGutter.modifiedBackground"])),te(r,"gitDecoration.deletedResourceForeground",Ht(n["gitDecoration.deletedResourceForeground"],n["terminal.ansiRed"],n["editorGutter.deletedBackground"]));const a=(xr(n["list.focusOutline"])?void 0:n["list.focusOutline"])??(xr(n.focusBorder)?void 0:n.focusBorder);a!=null?r["list.focusOutline"]=a:delete r["list.focusOutline"];const c=n["list.hoverBackground"];c!=null&&(lu(c,i)||au(c,i,l))&&delete r["list.hoverBackground"];const u=Object.freeze({...t,colors:Object.freeze(r)});return Er.set(t,u),u}function te(t,e,n){n!=null&&n!==""&&(t[e]=n)}function Ht(...t){for(const e of t)if(e!=null&&e!=="")return e}function lu(t,e){return e!=null&&t.toLowerCase()===e.toLowerCase()}(()=>{try{return!1}catch{return!1}})();const Ws={dark:"pierre-dark",light:"pierre-light"},Ir=new Map,Ar=new Set;function $n(t,e){t=Array.isArray(t)?t:[t];for(const n of t){if(Ar.has(n.name))continue;let r=Ir.get(n.name);r==null&&(r=n,Ir.set(n.name,r));const s=r.data.find(o=>o.name===r.name||o.aliases?.includes(r.name)===!0);if(s==null)throw new Error(`attachResolvedLanguages: No returned grammar declares "${r.name}" as its name or an alias.`);e.loadLanguageSync(r.data);try{e.getLanguage(r.name)}catch{throw new Error(`attachResolvedLanguages: "${s.name}" is already loaded without alias "${r.name}". Load the alias first or give the grammar a unique name.`)}Ar.add(r.name)}}const Rr=new Set,Vt=Xc();function Hs(t,e){t=Array.isArray(t)?t:[t];for(let n of t){let r;if(typeof n=="string"){if(r=Vt.getResolvedTheme(n),r==null)throw new Error(`loadResolvedThemes: ${n} is not resolved, you must resolve it before calling loadResolvedThemes`)}else r=n,n=n.name,Vt.getResolvedTheme(n)==null&&Vt.seedResolvedTheme(n,r);Rr.has(n)||(Rr.add(n),e.loadThemeSync(r))}}const ue=new Map;let Lr=0;const Me={"1c":"1c",abap:"abap",as:"actionscript-3",ada:"ada",adb:"ada",ads:"ada",adoc:"asciidoc",asciidoc:"asciidoc","component.html":"angular-html","component.ts":"angular-ts",conf:"nginx",htaccess:"apache",cls:"tex",trigger:"apex",apl:"apl",applescript:"applescript",scpt:"applescript",ara:"ara",asm:"asm",s:"riscv",astro:"astro",awk:"awk",bal:"ballerina",sh:"zsh",bash:"zsh",bat:"cmd",cmd:"cmd",be:"berry",beancount:"beancount",bib:"bibtex",bicep:"bicep","blade.php":"blade",bsl:"bsl",c:"c",h:"objective-cpp",cs:"csharp",cpp:"cpp",hpp:"cpp",cc:"cpp",cxx:"cpp",hh:"cpp",cdc:"cdc",cairo:"cairo",clar:"clarity",clj:"clojure",cljs:"clojure",cljc:"clojure",soy:"soy",cmake:"cmake","CMakeLists.txt":"cmake",cob:"cobol",cbl:"cobol",cobol:"cobol",CODEOWNERS:"codeowners",ql:"ql",coffee:"coffeescript",lisp:"lisp",cl:"lisp",lsp:"lisp",log:"log",v:"verilog",cql:"cql",cr:"crystal",css:"css",csv:"csv",cue:"cue",cypher:"cypher",cyp:"cypher",d:"d",dart:"dart",dax:"dax",desktop:"desktop",diff:"diff",patch:"diff",Dockerfile:"dockerfile",dockerfile:"dockerfile",env:"dotenv",dm:"dream-maker",edge:"edge",el:"emacs-lisp",ex:"elixir",exs:"elixir",elm:"elm",erb:"erb",erl:"erlang",hrl:"erlang",f:"fortran-fixed-form",for:"fortran-fixed-form",fs:"fsharp",fsi:"fsharp",fsx:"fsharp",f03:"f03",f08:"f08",f18:"f18",f77:"f77",f90:"fortran-free-form",f95:"fortran-free-form",fnl:"fennel",fish:"fish",ftl:"ftl",tres:"gdresource",res:"gdresource",gd:"gdscript",gdshader:"gdshader",gs:"genie",feature:"gherkin",COMMIT_EDITMSG:"git-commit","git-rebase-todo":"git-rebase",gjs:"glimmer-js",gleam:"gleam",gts:"glimmer-ts",glsl:"glsl",vert:"glsl",frag:"glsl",shader:"shaderlab",gp:"gnuplot",plt:"gnuplot",gnuplot:"gnuplot",go:"go",graphql:"graphql",gql:"graphql",groovy:"groovy",gvy:"groovy",hack:"hack",haml:"haml",hbs:"handlebars",handlebars:"handlebars",hs:"haskell",lhs:"haskell",hx:"haxe",hcl:"hcl",hjson:"hjson",hlsl:"hlsl",fx:"hlsl",html:"html",htm:"html",http:"http",rest:"http",hxml:"hxml",hy:"hy",imba:"imba",ini:"ini",cfg:"ini",jade:"pug",pug:"pug",java:"java",js:"javascript",mjs:"javascript",cjs:"javascript",jinja:"jinja",jinja2:"jinja",j2:"jinja",jison:"jison",jl:"julia",json:"json",json5:"json5",jsonc:"jsonc",jsonl:"jsonl",jsonnet:"jsonnet",libsonnet:"jsonnet",jssm:"jssm",jsx:"jsx",kt:"kotlin",kts:"kts",kql:"kusto",tex:"tex",ltx:"tex",lean:"lean4",less:"less",liquid:"liquid",lit:"lit",ll:"llvm",logo:"logo",lua:"lua",luau:"luau",Makefile:"makefile",mk:"makefile",makefile:"makefile",md:"markdown",markdown:"markdown",marko:"marko",m:"wolfram",mat:"matlab",mdc:"mdc",mdx:"mdx",wiki:"wikitext",mediawiki:"wikitext",mmd:"mermaid",mermaid:"mermaid",mips:"mipsasm",mojo:"mojo","🔥":"mojo",move:"move",nar:"narrat",nf:"nextflow",nim:"nim",nims:"nim",nimble:"nim",nix:"nix",nu:"nushell",mm:"objective-cpp",ml:"ocaml",mli:"ocaml",mll:"ocaml",mly:"ocaml",pas:"pascal",p:"pascal",pl:"prolog",pm:"perl",t:"perl",raku:"raku",p6:"raku",pl6:"raku",php:"php",phtml:"php",pls:"plsql",sql:"sql",po:"po",polar:"polar",pcss:"postcss",pot:"pot",potx:"potx",pq:"powerquery",pqm:"powerquery",ps1:"powershell",psm1:"powershell",psd1:"powershell",prisma:"prisma",pro:"prolog",P:"prolog",properties:"properties",proto:"protobuf",pp:"puppet",purs:"purescript",py:"python",pyw:"python",pyi:"python",qml:"qml",qmldir:"qmldir",qss:"qss",r:"r",R:"r",rkt:"racket",rktl:"racket",razor:"razor",cshtml:"razor",rb:"ruby",rbw:"ruby",reg:"reg",regex:"regexp",rel:"rel",rs:"rust",rst:"rst",rake:"ruby",gemspec:"ruby",jbuilder:"ruby",builder:"ruby",rabl:"ruby",arb:"ruby",ru:"ruby",podspec:"ruby",Gemfile:"ruby",Rakefile:"ruby",Guardfile:"ruby",Capfile:"ruby",Berksfile:"ruby",Brewfile:"ruby",Vagrantfile:"ruby",Thorfile:"ruby",Appraisals:"ruby",Dangerfile:"ruby",sas:"sas",sass:"sass",scala:"scala",sc:"scala",scm:"scheme",ss:"scheme",sld:"scheme",scss:"scss",sdbl:"sdbl",shadergraph:"shader",st:"smalltalk",sol:"solidity",sparql:"sparql",rq:"sparql",spl:"splunk",config:"ssh-config",do:"stata",ado:"stata",dta:"stata",styl:"stylus",stylus:"stylus",svelte:"svelte",swift:"swift",sv:"system-verilog",svh:"system-verilog",service:"systemd",socket:"systemd",device:"systemd",timer:"systemd",talon:"talonscript",tasl:"tasl",tcl:"tcl",templ:"templ",tf:"tf",tfvars:"tfvars",toml:"toml",ts:"typescript",mts:"typescript",cts:"typescript",tsp:"typespec",tsv:"tsv",tsx:"tsx",ttl:"turtle",twig:"twig",typ:"typst",vv:"v",vala:"vala",vapi:"vala",vb:"vb",vbs:"vb",bas:"vb",vh:"verilog",vhd:"vhdl",vhdl:"vhdl",vim:"vimscript",vue:"vue","vine.ts":"vue-vine",vy:"vyper",wasm:"wasm",wat:"wasm",wy:"文言",wgsl:"wgsl",wit:"wit",wl:"wolfram",nb:"wolfram",xml:"xml",xsl:"xsl",xslt:"xsl",yaml:"yaml",yml:"yml",zs:"zenscript",zig:"zig",zsh:"zsh",sty:"tex"};function pn(t){if(ue.has(t))return ue.get(t)??"text";if(Me[t]!=null)return Me[t];const e=t.match(/\.([^/\\]+\.[^/\\]+)$/);if(e!=null){if(ue.has(e[1]))return ue.get(e[1])??"text";if(Me[e[1]]!=null)return Me[e[1]]??"text"}const n=t.match(/\.([^.]+)$/)?.[1]??"";return ue.has(n)?ue.get(n)??"text":Me[n]??"text"}function cu(t,e){if(t<=Lr)return!1;ue.clear();for(const n in e){const r=e[n];r!=null&&ue.set(n,r)}return Lr=t,!0}function gn(t,e){for(const n of e)t.push(n)}function bt(t){let e=t.length;return t.charCodeAt(e-1)===10&&(e--,t.charCodeAt(e-1)===13&&e--),t.slice(0,e)}function uu(t){return{type:"text",value:t}}function fu({tagName:t,children:e=[],properties:n={}}){return{type:"element",tagName:t,properties:n,children:e}}function hu(t){let e=t.children[0];for(;e!=null;){if(e.type==="element"&&e.tagName==="code")return e;"children"in e?e=e.children[0]:e=null}}function du(t,e,n){const r=typeof n.lineInfo=="function"?n.lineInfo(e):n.lineInfo[e-1];if(r==null){const s=`processLine: line ${e}, contains no state.lineInfo`;throw console.error(s,{node:t,line:e,state:n}),new Error(s)}return t.tagName="div",t.properties["data-line"]=r.lineNumber,t.properties["data-alt-line"]=r.altLineNumber,t.properties["data-line-type"]=r.type,t.properties["data-line-index"]=r.lineIndex,t.children.length===0&&t.children.push(uu(`
153
- `)),t}const et=Symbol("no-token"),qt=Symbol("multiple-tokens");function Vs(t){const e=pu(t);if(e!=null)return e;let n=et;const r=[];let s=[],o;const i=()=>{if(s.length===0||o==null){s=[],o=void 0;return}if(s.length===1){const a=s[0];if(a?.type==="element"){gu(a,o);for(const c of a.children)it(c)}else it(a);r.push(a),s=[],o=void 0;return}for(const a of s)it(a);r.push(fu({tagName:"span",properties:{"data-char":o},children:s})),s=[],o=void 0},l=a=>{if(a!==et){if(a===qt){n=qt;return}if(n===et){n=a;return}n!==a&&(n=qt)}};for(const a of t.children){const c=a.type==="element"?Vs(a):et;if(l(c),typeof c!="number"){i(),r.push(a);continue}o!=null&&o!==c&&i(),o??=c,s.push(a)}return i(),t.children=r,n}function pu(t){const e=t.properties["data-char"];if(typeof e=="number")return e}function it(t){if(t.type==="element"){t.properties["data-char"]=void 0;for(const e of t.children)it(e)}}function gu(t,e){t.properties["data-char"]=e}function qs(t=!1,e=!1){const n={lineInfo:[]},r=[{line(s){return delete s.properties.class,s},pre(s){const o=hu(s),i=[];if(o!=null){let l=1;for(const a of o.children)a.type==="element"&&(t&&Vs(a),i.push(du(a,l,n)),l++);o.children=i}return s},...t?{tokens(s){for(const o of s){let i=0;for(const l of o){const a=l;a.__lineChar??=i,i+=l.content.length}}},preprocess(s,o){o.mergeWhitespaces="never"},span(s,o,i,l,a){if(a?.offset!=null&&a.content!=null){const c=a.__lineChar;return c!=null&&(s.properties["data-char"]=c),s}return s}}:null}];return e&&r.push(mu,Nr),t&&r.push({line:s=>(s.type==="element"&&s.children.length===0&&s.children.push({type:"element",tagName:"br",properties:{},children:[]}),s)}),{state:n,transformers:r,toClass:Nr}}const Nr=tu({classPrefix:"hl-"}),mu={name:"token-style-normalizer",tokens(t){for(const e of t)for(const n of e){if(n.htmlStyle!=null)continue;const r={};n.color!=null&&(r.color=n.color),n.bgColor!=null&&(r["background-color"]=n.bgColor),n.fontStyle!=null&&n.fontStyle!==0&&((n.fontStyle&1)!==0&&(r["font-style"]="italic"),(n.fontStyle&2)!==0&&(r["font-weight"]="bold"),(n.fontStyle&4)!==0&&(r["text-decoration"]="underline")),Object.keys(r).length>0&&(n.htmlStyle=r)}}};function K(t){return`--${t==="token"?"diffs-token":"diffs"}-`}function Xs({theme:t=Ws,highlighter:e,prefix:n}){let r="";if(typeof t=="string"){const s=e.getTheme(t),o=Wt(s);r+=`color:${o.fg};`,r+=`background-color:${o.bg};`,r+=`${K("global")}fg:${o.fg};`,r+=`${K("global")}bg:${o.bg};`,r+=Xt(s,n)}else{let s=e.getTheme(t.dark),o=Wt(s);r+=`${K("global")}dark:${o.fg};`,r+=`${K("global")}dark-bg:${o.bg};`,r+=Xt(s,"dark"),s=e.getTheme(t.light),o=Wt(s),r+=`${K("global")}light:${o.fg};`,r+=`${K("global")}light-bg:${o.bg};`,r+=Xt(s,"light")}return r}function Xt(t,e){e=e!=null?`${e}-`:"";let n="";const r=t.colors?.["gitDecoration.addedResourceForeground"]??t.colors?.["terminal.ansiGreen"];r!=null&&(n+=`${K("global")}${e}addition-color:${r};`);const s=t.colors?.["gitDecoration.deletedResourceForeground"]??t.colors?.["terminal.ansiRed"];s!=null&&(n+=`${K("global")}${e}deletion-color:${s};`);const o=t.colors?.["gitDecoration.modifiedResourceForeground"]??t.colors?.["terminal.ansiBlue"];return o!=null&&(n+=`${K("global")}${e}modified-color:${o};`),n}function mn(t){let e=t.children[0];for(;e!=null;){if(e.type==="element"&&e.tagName==="code")return e.children;"children"in e?e=e.children[0]:e=null}throw console.error(t),new Error("getLineNodes: Unable to find children")}function yn(t,e){return t-(e===0?0:1)}function Tr(t,e){return yn(t,e)+e}function yu({isPartial:t,rangeSize:e,expandedHunks:n,hunkIndex:r,collapsedContextThreshold:s}){const o=Math.max(e,0);if(o===0||t)return{fromStart:0,fromEnd:0,rangeSize:o,collapsedLines:o,renderAll:!1};if(n===!0||o<=s)return{fromStart:o,fromEnd:0,rangeSize:o,collapsedLines:0,renderAll:!0};const i=n?.get(r),l=Math.min(Math.max(i?.fromStart??0,0),o),a=Math.min(Math.max(i?.fromEnd??0,0),o),c=l+a,u=c>=o;return{fromStart:u?o:l,fromEnd:u?0:a,rangeSize:o,collapsedLines:Math.max(o-c,0),renderAll:u}}function bu({fileDiff:t,errorPrefix:e}){const n=t.hunks[t.hunks.length-1];if(n==null||t.isPartial||t.additionLines.length===0||t.deletionLines.length===0)return 0;const r=t.additionLines.length-Tr(n.additionStart,n.additionCount),s=t.deletionLines.length-Tr(n.deletionStart,n.deletionCount);if(r<=0&&s<=0)return 0;if(r!==s)throw new Error(`${e}: trailing context mismatch (additions=${r}, deletions=${s}) for ${t.name}`);return Math.min(r,s)}function wu({fileDiff:t,hunkIndex:e,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:s}){if(e!==t.hunks.length-1)return;const o=bu({fileDiff:t,errorPrefix:s});if(o<=0)return;if(n===!0||o<=r)return{fromStart:o,fromEnd:0,rangeSize:o,collapsedLines:0,renderAll:!0};const i=n?.get(t.hunks.length),l=Math.min(Math.max(i?.fromStart??0,0),o);return{fromStart:l,fromEnd:0,rangeSize:o,collapsedLines:o-l,renderAll:l>=o}}function Cu({diff:t,diffStyle:e,startingLine:n=0,totalLines:r=1/0,expandedHunks:s,collapsedContextThreshold:o=1,callback:i}){const l=_u({diff:t,diffStyle:e,startingLine:n,expandedHunks:s,collapsedContextThreshold:o}),a={viewportStart:n,viewportEnd:n+r,isWindowedHighlight:n>0||r<1/0,splitCount:l.splitCount,unifiedCount:l.unifiedCount,finalHunkIndex:t.hunks.length-1,shouldBreak(){if(!a.isWindowedHighlight)return!1;const c=a.unifiedCount>=n+r,u=a.splitCount>=n+r;return c&&u},shouldSkip(c,u){if(!a.isWindowedHighlight)return!1;const f=c>0&&a.unifiedCount+c<=n,h=u>0&&a.splitCount+u<=n;return f&&h},incrementCounts(c,u){a.unifiedCount+=c,a.splitCount+=u},isInWindow(c,u){if(!a.isWindowedHighlight)return!0;const f=a.isInUnifiedWindow(c),h=a.isInSplitWindow(u);return f||h},isInUnifiedWindow(c){return!a.isWindowedHighlight||a.unifiedCount>=n-c&&a.unifiedCount<n+r},isInSplitWindow(c){return!a.isWindowedHighlight||a.splitCount>=n-c&&a.splitCount<n+r},emit(c,u=!1){return u||a.incrementCounts(1,1),i(c)??!1}};e:for(let c=l.hunkIndex;c<t.hunks.length;c++){let u=function(E,V){return y==null||y.collapsedLines<=0||y.fromStart+y.fromEnd>0?0:V===h.splitLineStart+h.splitLineCount-1?y.collapsedLines:0},f=function(){return _?0:(_=!0,g.collapsedLines)};const h=t.hunks[c];if(h==null)throw new Error("iterateOverDiff: invalid hunk index");if(a.shouldBreak())break;const p=yn(h.deletionStart,h.deletionCount),d=yn(h.additionStart,h.additionCount),b=!t.isPartial&&h.deletionCount===0?p:h.deletionLineIndex,w=!t.isPartial&&h.additionCount===0?d:h.additionLineIndex,g=yu({isPartial:t.isPartial,rangeSize:h.collapsedBefore,expandedHunks:s,hunkIndex:c,collapsedContextThreshold:o}),y=c===a.finalHunkIndex?wu({fileDiff:t,hunkIndex:c,expandedHunks:s,collapsedContextThreshold:o,errorPrefix:"iterateOverDiff"}):void 0,m=g.fromStart+g.fromEnd;let _=g.collapsedLines===0;if(a.shouldSkip(m,m))a.incrementCounts(m,m),f();else{let E=h.unifiedLineStart-g.rangeSize,V=h.splitLineStart-g.rangeSize,R=b-g.rangeSize,P=w-g.rangeSize,T=p+1-g.rangeSize,J=d+1-g.rangeSize;if(tt(a,g.fromStart,e,O=>a.emit({hunkIndex:c,hunk:h,collapsedBefore:0,collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:T+O,lineIndex:R+O,noEOFCR:!1,unifiedLineIndex:E+O,splitLineIndex:V+O},additionLine:{unifiedLineIndex:E+O,splitLineIndex:V+O,lineIndex:P+O,lineNumber:J+O,noEOFCR:!1}}))||(E=h.unifiedLineStart-g.fromEnd,V=h.splitLineStart-g.fromEnd,R=b-g.fromEnd,P=w-g.fromEnd,T=p+1-g.fromEnd,J=d+1-g.fromEnd,tt(a,g.fromEnd,e,O=>a.emit({hunkIndex:c,hunk:h,collapsedBefore:f(),collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:T+O,lineIndex:R+O,noEOFCR:!1,unifiedLineIndex:E+O,splitLineIndex:V+O},additionLine:{unifiedLineIndex:E+O,splitLineIndex:V+O,lineIndex:P+O,lineNumber:J+O,noEOFCR:!1}}),()=>{f()})))break e}let S=h.unifiedLineStart,k=h.splitLineStart,v=b,A=w,L=p+1,H=d+1;const he=h.hunkContent.at(-1);for(const E of h.hunkContent){if(a.shouldBreak())break e;const V=E===he;if(E.type==="context"){if(a.shouldSkip(E.lines,E.lines))a.incrementCounts(E.lines,E.lines),f();else if(tt(a,E.lines,e,R=>{const P=V&&R===E.lines-1,T=S+R,J=k+R;return a.emit({hunkIndex:c,hunk:h,collapsedBefore:f(),collapsedAfter:u(T,J),type:"context",deletionLine:{lineNumber:L+R,lineIndex:v+R,noEOFCR:P&&h.noEOFCRDeletions,unifiedLineIndex:T,splitLineIndex:J},additionLine:{unifiedLineIndex:T,splitLineIndex:J,lineIndex:A+R,lineNumber:H+R,noEOFCR:P&&h.noEOFCRAdditions}})},()=>{f()}))break e;S+=E.lines,k+=E.lines,v+=E.lines,A+=E.lines,L+=E.lines,H+=E.lines}else{const R=Math.max(E.deletions,E.additions),P=E.deletions+E.additions;if(!a.shouldSkip(P,R)){const T=ku(a,E);(T[0]?.[0]??0)>0&&f();for(const[J,O]of T)for(let Pe=J;Pe<O;Pe++){const Ks=u(S+Pe,k+Pe);if(a.emit(vu({hunkIndex:c,hunk:h,collapsedBefore:f(),collapsedAfter:Ks,diffStyle:e,index:Pe,unifiedLineIndex:S,splitLineIndex:k,additionLineIndex:A,deletionLineIndex:v,additionLineNumber:H,deletionLineNumber:L,content:E,isLastContent:V,unifiedCount:P,splitCount:R}),!0))break e}}f(),a.incrementCounts(P,R),S+=P,k+=R,v+=E.deletions,A+=E.additions,L+=E.deletions,H+=E.additions}}if(y!=null){const{collapsedLines:E,fromStart:V,fromEnd:R}=y,P=V+R;if(tt(a,P,e,T=>{const J=T===P-1;return a.emit({hunkIndex:t.hunks.length,hunk:void 0,collapsedBefore:0,collapsedAfter:J?E:0,type:"context-expanded",deletionLine:{lineNumber:L+T,lineIndex:v+T,noEOFCR:!1,unifiedLineIndex:S+T,splitLineIndex:k+T},additionLine:{unifiedLineIndex:S+T,splitLineIndex:k+T,lineIndex:A+T,lineNumber:H+T,noEOFCR:!1}})},void 0,()=>a.shouldBreak()))break e}}}function _u({diff:t,diffStyle:e,startingLine:n,expandedHunks:r,collapsedContextThreshold:s}){return{hunkIndex:0,splitCount:0,unifiedCount:0}}function Su(t,e,n){if(!t.isWindowedHighlight||e<=0)return[0,e];const r=[];function s(l){const a=Math.max(0,t.viewportStart-l),c=Math.min(e,t.viewportEnd-l);c>a&&r.push([a,c])}if(s(t.unifiedCount),s(t.splitCount),r.length===0)return[0,0];let o=r[0][0],i=r[0][1];for(let l=1;l<r.length;l++){const a=r[l];o=Math.min(o,a[0]),i=Math.max(i,a[1])}return[o,i]}function tt(t,e,n,r,s,o){const[i,l]=Su(t,e);i>0&&(t.incrementCounts(i,i),s?.());let a=i;for(;a<e;){if(o?.()===!0)return!0;if(a>=l){t.incrementCounts(e-a,e-a);break}if(t.isInWindow(0,0)){if(r(a)===!0)return!0}else t.incrementCounts(1,1);a++}return!1}function ku(t,e,n){if(!t.isWindowedHighlight)return[[0,Math.max(e.deletions,e.additions)]];const r=[];function s(a,c){if(a+c<=t.viewportStart||a>=t.viewportEnd)return;const u=Math.max(0,t.viewportStart-a),f=Math.min(c,t.viewportEnd-a);return f>u?[u,f]:void 0}function o(a,c){return a}function i(a,c){if(a==null)return;const[u,f]=o(a);f>u&&r.push([u,f])}if(i(s(t.unifiedCount,e.deletions)),i(s(t.unifiedCount+e.deletions,e.additions)),i(s(t.splitCount,e.deletions)),i(s(t.splitCount,e.additions)),r.length===0)return r;r.sort((a,c)=>a[0]-c[0]);const l=[r[0]];for(const[a,c]of r.slice(1)){const u=l[l.length-1];a<=u[1]?u[1]=Math.max(u[1],c):l.push([a,c])}return l}function vu({hunkIndex:t,hunk:e,collapsedAfter:n,collapsedBefore:r,diffStyle:s,index:o,unifiedLineIndex:i,splitLineIndex:l,additionLineIndex:a,deletionLineIndex:c,additionLineNumber:u,deletionLineNumber:f,content:h,isLastContent:p,unifiedCount:d,splitCount:b}){const w=o<h.deletions?i+o:void 0,g=s==="unified"?o>=h.deletions?i+o:void 0:o<h.additions?i+h.deletions+o:void 0,y=s==="unified"?l+(o<h.deletions?o:o-h.deletions):l+o,m=o<h.deletions?c+o:void 0,_=o<h.deletions?f+o:void 0,S=s==="unified"?o>=h.deletions?a+(o-h.deletions):void 0:o<h.additions?a+o:void 0,k=s==="unified"?o>=h.deletions?u+(o-h.deletions):void 0:o<h.additions?u+o:void 0,v=s==="unified"?p&&o===h.deletions-1&&e.noEOFCRDeletions:p&&o===b-1&&e.noEOFCRDeletions,A=s==="unified"?p&&o===d-1&&e.noEOFCRAdditions:p&&o===b-1&&e.noEOFCRAdditions,L=m!=null&&_!=null&&w!=null?{lineNumber:_,lineIndex:m,noEOFCR:v,unifiedLineIndex:w,splitLineIndex:y}:void 0,H=S!=null&&k!=null&&g!=null?{unifiedLineIndex:g,splitLineIndex:y,lineIndex:S,lineNumber:k,noEOFCR:A}:void 0;if(L==null&&H!=null)return{type:"change",hunkIndex:t,hunk:e,collapsedAfter:n,collapsedBefore:r,deletionLine:void 0,additionLine:H};if(L!=null&&H==null)return{type:"change",hunkIndex:t,hunk:e,collapsedAfter:n,collapsedBefore:r,deletionLine:L,additionLine:void 0};if(L==null||H==null)throw new Error("iterateOverDiff: missing change line data");return{type:"change",hunkIndex:t,hunk:e,collapsedAfter:n,collapsedBefore:r,deletionLine:L,additionLine:H}}function wt({line:t,spanStart:e,spanLength:n}){return{start:{line:t,character:e},end:{line:t,character:e+n},properties:{"data-diff-span":""},alwaysWrap:!0}}function nt({item:t,arr:e,enableJoin:n,isNeutral:r=!1,isLastItem:s=!1}){const o=e[e.length-1];if(o==null||s||!n){e.push([r?0:1,t.value]);return}const i=o[0]===0;if(r===i||r&&t.value.length===1&&!i){o[1]+=t.value;return}e.push([r?0:1,t.value])}const xu={forcePlainText:!1};function Eu(t,e,n,{forcePlainText:r,startingLine:s,totalLines:o,expandedHunks:i,collapsedContextThreshold:l=1}=xu){r?(s??=0,o??=1/0):(s=0,o=1/0);const a=s>0||o<1/0,c=typeof n.theme=="string"?e.getTheme(n.theme).type:void 0,u=Xs({theme:n.theme,highlighter:e}),f=r&&!a&&(t.unifiedLineCount>1e3||t.splitLineCount>1e3)?"none":n.lineDiffType,h={deletionLines:[],additionLines:[]},{maxLineDiffLength:p}=n,d=!r&&!t.isPartial,b=r?i:void 0,w=new Map;function g(m){const _=d?0:m,S=w.get(_)??Ru();return w.set(_,S),S}function y(m,_,S,k){if(a){let v=S.at(-1);(v==null||v.targetIndex+v.count!==_)&&(v={targetIndex:_,originalOffset:k.length,count:0},S.push(v)),v.count++}k.push(m)}Cu({diff:t,diffStyle:"both",startingLine:s,totalLines:o,expandedHunks:a?b:!0,collapsedContextThreshold:l,callback:({hunkIndex:m,additionLine:_,deletionLine:S,type:k})=>{const v=g(m),A=_!=null?_.splitLineIndex:S.splitLineIndex;k==="change"&&_!=null&&S!=null&&Au({additionLine:t.additionLines[_.lineIndex],deletionLine:t.deletionLines[S.lineIndex],deletionLineIndex:v.deletionContent.length,additionLineIndex:v.additionContent.length,deletionDecorations:v.deletionDecorations,additionDecorations:v.additionDecorations,lineDiffType:f,maxLineDiffLength:p}),S!=null&&(y(t.deletionLines[S.lineIndex],S.lineIndex,v.deletionSegments,v.deletionContent),v.deletionInfo.push({type:k==="change"?"change-deletion":k,lineNumber:S.lineNumber,altLineNumber:k==="change"?void 0:_.lineNumber??void 0,lineIndex:`${S.unifiedLineIndex},${A}`})),_!=null&&(y(t.additionLines[_.lineIndex],_.lineIndex,v.additionSegments,v.additionContent),v.additionInfo.push({type:k==="change"?"change-addition":k,lineNumber:_.lineNumber,altLineNumber:k==="change"?void 0:S.lineNumber??void 0,lineIndex:`${_.unifiedLineIndex},${A}`}))}});for(const m of w.values()){if(m.deletionContent.length===0&&m.additionContent.length===0)continue;const _={name:t.prevName??t.name,contents:m.deletionContent.value},S={name:t.name,contents:m.additionContent.value},{deletionLines:k,additionLines:v}=Lu({deletionFile:_,deletionInfo:m.deletionInfo,deletionDecorations:m.deletionDecorations,additionFile:S,additionInfo:m.additionInfo,additionDecorations:m.additionDecorations,highlighter:e,options:n,languageOverride:r?"text":t.lang});if(d){h.deletionLines=k,h.additionLines=v;continue}if(m.deletionSegments.length>0)for(const A of m.deletionSegments)for(let L=0;L<A.count;L++)h.deletionLines[A.targetIndex+L]=k[A.originalOffset+L];else gn(h.deletionLines,k);if(m.additionSegments.length>0)for(const A of m.additionSegments)for(let L=0;L<A.count;L++)h.additionLines[A.targetIndex+L]=v[A.originalOffset+L];else gn(h.additionLines,v)}return{code:h,themeStyles:u,baseThemeType:c}}function Iu(t,{deletionLineIndex:e,additionLineIndex:n,deletionDecorations:r,additionDecorations:s}){let o=0,i=0,l=-1,a=0,c=-1,u=0;for(const{value:f,added:h,removed:p}of t)p?(l===-1&&(l=o),o+=f.length,a=o):h?(c===-1&&(c=i),i+=f.length,u=i):(o+=f.length,i+=f.length);l!==-1&&r.push(wt({line:e,spanStart:l,spanLength:a-l})),c!==-1&&s.push(wt({line:n,spanStart:c,spanLength:u-c}))}function Au({deletionLine:t,additionLine:e,deletionLineIndex:n,additionLineIndex:r,deletionDecorations:s,additionDecorations:o,lineDiffType:i,maxLineDiffLength:l}){if(t==null||e==null||i==="none"||(t=bt(t),e=bt(e),t.length>l||e.length>l))return;const a=i==="char"?Qc(t,e):eu(t,e);if(i==="word-line"){Iu(a,{deletionLineIndex:n,additionLineIndex:r,deletionDecorations:s,additionDecorations:o});return}const c=[],u=[],f=i==="word-alt",h=a.at(-1);for(const d of a){const b=d===h;!d.added&&!d.removed?(nt({item:d,arr:c,enableJoin:f,isNeutral:!0,isLastItem:b}),nt({item:d,arr:u,enableJoin:f,isNeutral:!0,isLastItem:b})):d.removed?nt({item:d,arr:c,enableJoin:f,isLastItem:b}):nt({item:d,arr:u,enableJoin:f,isLastItem:b})}let p=0;for(const d of c)d[0]===1&&s.push(wt({line:n,spanStart:p,spanLength:d[1].length})),p+=d[1].length;p=0;for(const d of u)d[0]===1&&o.push(wt({line:r,spanStart:p,spanLength:d[1].length})),p+=d[1].length}function Ru(){return{deletionContent:{push(t){this.value+=t,this.length++},value:"",length:0},additionContent:{push(t){this.value+=t,this.length++},value:"",length:0},deletionInfo:[],additionInfo:[],deletionDecorations:[],additionDecorations:[],deletionSegments:[],additionSegments:[]}}function Lu({deletionFile:t,additionFile:e,deletionInfo:n,additionInfo:r,highlighter:s,deletionDecorations:o,additionDecorations:i,languageOverride:l,options:{theme:a,...c}}){const u=l??pn(t.name),f=l??pn(e.name),{state:h,transformers:p}=qs(c.useTokenTransformer),d=typeof a=="string"?{...c,lang:"text",theme:a,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:K("token"),tokenizeTimeLimit:0}:{...c,lang:"text",themes:a,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:K("token"),tokenizeTimeLimit:0};return{deletionLines:t.contents===""?[]:(d.lang=u,h.lineInfo=n,d.decorations=o,mn(s.codeToHast(bt(t.contents),d))),additionLines:e.contents===""?[]:(d.lang=f,d.decorations=i,h.lineInfo=r,mn(s.codeToHast(bt(e.contents),d)))}}const Pr=10,$r=13,Nu=4,Tu=40;function Pu(t){const e=[0];let n=t.indexOf("\r"),r=t.indexOf(`
152
+ \v\f…\u2028\u2029])`),e));else if(a==="posix")if(!s&&(u==="graph"||u==="print")){if(r==="strict")throw new Error(`POSIX class "${u}" requires min target ES2024 or non-strict accuracy`);let f={graph:"!-~",print:" -~"}[u];c&&(f=`\0-${D(f.codePointAt(0)-1)}${D(f.codePointAt(2)+1)}-􏿿`),n($(oe(`[${f}]`),e))}else n($(Ut(oe(Xl.get(u)),c),e));else if(a==="property")Nn.has(kt(u))||(t.key="sc");else if(a==="space")n(ce(xe("space",{negate:c}),e));else if(a==="word")n($(Ut(oe(se),c),e));else throw new Error(`Unexpected character set kind "${a}"`)},Directive({node:t,parent:e,root:n,remove:r,replaceWith:s,removeAllPrevSiblings:o,removeAllNextSiblings:i}){const{kind:l,flags:a}=t;if(l==="flags")if(!a.enable&&!a.disable)r();else{const c=ee({flags:a});c.body[0].body=i(),s($(c,e),{traverse:!0})}else if(l==="keep"){const c=n.body[0],f=n.body.length===1&&vs(c,{type:"Group"})&&c.body[0].body.length===1?c.body[0]:n;if(e.parent!==f||f.body.length>1)throw new Error(x`Uses "\K" in a way that's unsupported`);const h=ge({behind:!0});h.body[0].body=o(),s($(h,e))}else throw new Error(`Unexpected directive kind "${l}"`)},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(n=>delete t[n]),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:n}=t.flags;e?.extended&&delete e.extended,n?.extended&&delete n.extended,e?.dotAll&&n?.dotAll&&delete e.dotAll,e?.ignoreCase&&n?.ignoreCase&&delete e.ignoreCase,e&&!Object.keys(e).length&&delete t.flags.enable,n&&!Object.keys(n).length&&delete t.flags.disable,!t.flags.enable&&!t.flags.disable&&delete t.flags},LookaroundAssertion({node:t},e){const{kind:n}=t;n==="lookbehind"&&(e.passedLookbehind=!0)},NamedCallout({node:t,parent:e,replaceWith:n}){const{kind:r}=t;if(r==="fail")n($(ge({negate:!0}),e));else throw new Error(`Unsupported named callout "(*${r.toUpperCase()}"`)},Quantifier({node:t}){if(t.body.type==="Quantifier"){const e=ee();e.body[0].body.push(t.body),t.body=$(e,t)}},Regex:{enter({node:t},{supportedGNodes:e}){const n=[];let r=!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 i=Fs(o.body);i?(r=!0,Array.isArray(i)?n.push(...i):n.push(i)):s=!0}r&&!s&&n.forEach(o=>e.add(o))},exit(t,{accuracy:e,passedLookbehind:n,strategy:r}){if(e==="strict"&&n&&r)throw new Error(x`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:t},{jsGroupNameMap:e}){let{ref:n}=t;typeof n=="string"&&!Ft(n)&&(n=Gt(n,e),t.ref=n)}},Jl={Backreference({node:t},{multiplexCapturesToLeftByRef:e,reffedNodesByReferencer:n}){const{orphan:r,ref:s}=t;r||n.set(t,[...e.get(s).map(({node:o})=>o)])},CapturingGroup:{enter({node:t,parent:e,replaceWith:n,skip:r},{groupOriginByCopy:s,groupsByName:o,multiplexCapturesToLeftByRef:i,openRefs:l,reffedNodesByReferencer:a}){const c=s.get(t);if(c&&l.has(t.number)){const f=ce(wr(t.number),e);a.set(f,l.get(t.number)),n(f);return}l.set(t.number,t),i.set(t.number,[]),t.name&&ze(i,t.name,[]);const u=i.get(t.name??t.number);for(let f=0;f<u.length;f++){const h=u[f];if(c===h.node||c&&c===h.origin||t===h.origin){u.splice(f,1);break}}if(i.get(t.number).push({node:t,origin:c}),t.name&&i.get(t.name).push({node:t,origin:c}),t.name){const f=ze(o,t.name,new Map);let h=!1;if(c)h=!0;else for(const p of f.values())if(!p.hasDuplicateNameToRemove){h=!0;break}o.get(t.name).set(t,{node:t,hasDuplicateNameToRemove:h})}},exit({node:t},{openRefs:e}){e.delete(t.number)}},Group:{enter({node:t},e){e.prevFlags=e.currentFlags,t.flags&&(e.currentFlags=yt(e.currentFlags,t.flags))},exit(t,e){e.currentFlags=e.prevFlags}},Subroutine({node:t,parent:e,replaceWith:n},r){const{isRecursive:s,ref:o}=t;if(s){let u=e;for(;(u=u.parent)&&!(u.type==="CapturingGroup"&&(u.name===o||u.number===o)););r.reffedNodesByReferencer.set(t,u);return}const i=r.subroutineRefMap.get(o),l=o===0,a=l?wr(0):Ds(i,r.groupOriginByCopy,null);let c=a;if(!l){const u=Bs(rc(i,h=>h.type==="Group"&&!!h.flags)),f=u?yt(r.globalFlags,u):r.globalFlags;tc(f,r.currentFlags)||(c=ee({flags:sc(f)}),c.body[0].body.push(a))}n($(c,e),{traverse:!l})}},ec={Backreference({node:t,parent:e,replaceWith:n},r){if(t.orphan){r.highestOrphanBackref=Math.max(r.highestOrphanBackref,t.ref);return}const o=r.reffedNodesByReferencer.get(t).filter(i=>nc(i,t));if(!o.length)n($(ge({negate:!0}),e));else if(o.length>1){const i=ee({atomic:!0,body:o.reverse().map(l=>we({body:[cn(l.number)]}))});n($(i,e))}else t.ref=o[0].number},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 n=Math.max(e.highestOrphanBackref-e.numCapturesToLeft,0);for(let r=0;r<n;r++){const s=Es();t.body.at(-1).body.push(s)}}},Subroutine({node:t},e){!t.isRecursive||t.ref===0||(t.ref=e.reffedNodesByReferencer.get(t).number)}};function Os(t){Be(t,{"*"({node:e,parent:n}){e.parent=n}})}function tc(t,e){return t.dotAll===e.dotAll&&t.ignoreCase===e.ignoreCase}function nc(t,e){let n=e;do{if(n.type==="Regex")return!1;if(n.type==="Alternative")continue;if(n===t)return!1;const r=Gs(n.parent);for(const s of r){if(s===n)break;if(s===t||Us(s,t))return!0}}while(n=n.parent);throw new Error("Unexpected path")}function Ds(t,e,n,r){const s=Array.isArray(t)?[]:{};for(const[o,i]of Object.entries(t))o==="parent"?s.parent=Array.isArray(n)?r:n:i&&typeof i=="object"?s[o]=Ds(i,e,s,n):(o==="type"&&i==="CapturingGroup"&&e.set(s,e.get(t)??t),s[o]=i);return s}function wr(t){const e=As(t);return e.isRecursive=!0,e}function rc(t,e){const n=[];for(;t=t.parent;)(!e||e(t))&&n.push(t);return n}function Gt(t,e){if(e.has(t))return e.get(t);const n=`$${e.size}_${t.replace(/^[^$_\p{IDS}]|[^$\u200C\u200D\p{IDC}]/ug,"_")}`;return e.set(t,n),n}function Bs(t){const e=["dotAll","ignoreCase"],n={enable:{},disable:{}};return t.forEach(({flags:r})=>{e.forEach(s=>{r.enable?.[s]&&(delete n.disable[s],n.enable[s]=!0),r.disable?.[s]&&(n.disable[s]=!0)})}),Object.keys(n.enable).length||delete n.enable,Object.keys(n.disable).length||delete n.disable,n.enable||n.disable?n:null}function sc({dotAll:t,ignoreCase:e}){const n={};return(t||e)&&(n.enable={},t&&(n.enable.dotAll=!0),e&&(n.enable.ignoreCase=!0)),(!t||!e)&&(n.disable={},!t&&(n.disable.dotAll=!0),!e&&(n.disable.ignoreCase=!0)),n}function Gs(t){if(!t)throw new Error("Node expected");const{body:e}=t;return Array.isArray(e)?e:e?[e]:null}function Fs(t){const e=t.find(n=>n.kind==="search_start"||ac(n,{negate:!1})||!oc(n));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 n=[];for(const r of e.body){const s=Fs(r.body);if(!s)return null;Array.isArray(s)?n.push(...s):n.push(s)}return n}return null}function Us(t,e){const n=Gs(t)??[];for(const r of n)if(r===e||Us(r,e))return!0;return!1}function oc({type:t}){return t==="Assertion"||t==="Directive"||t==="LookaroundAssertion"}function ic(t){const e=["Character","CharacterClass","CharacterSet"];return e.includes(t.type)||t.type==="Quantifier"&&t.min&&e.includes(t.body.type)}function ac(t,e){const n={negate:null,...e};return t.type==="LookaroundAssertion"&&(n.negate===null||t.negate===n.negate)&&t.body.length===1&&vs(t.body[0],{type:"Assertion",kind:"search_start"})}function Ft(t){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(t)}function oe(t,e){const r=xs(t,{...e,unicodePropertyMap:Nn}).body;return r.length>1||r[0].body.length>1?ee({body:r}):r[0].body[0]}function Ut(t,e){return t.negate=e,t}function ce(t,e){return t.parent=e,t}function $(t,e){return Os(t),t.parent=e,t}function lc(t,e){const n=Ps(e),r=hn(n.target,"ES2024"),s=hn(n.target,"ES2025"),o=n.rules.recursionLimit;if(!Number.isInteger(o)||o<2||o>20)throw new Error("Invalid recursionLimit; use 2-20");let i=null,l=null;if(!s){const p=[t.flags.ignoreCase];Be(t,cc,{getCurrentModI:()=>p.at(-1),popModI(){p.pop()},pushModI(d){p.push(d)},setHasCasedChar(){p.at(-1)?i=!0:l=!0}})}const a={dotAll:t.flags.dotAll,ignoreCase:!!((t.flags.ignoreCase||i)&&!l)};let c=t;const u={accuracy:n.accuracy,appliedGlobalFlags:a,captureMap:new Map,currentFlags:{dotAll:t.flags.dotAll,ignoreCase:t.flags.ignoreCase},inCharClass:!1,lastNode:c,originMap:t._originMap,recursionLimit:o,useAppliedIgnoreCase:!!(!s&&i&&l),useFlagMods:s,useFlagV:r,verbose:n.verbose};function f(p){return u.lastNode=c,c=p,jl(uc[p.type],`Unexpected node type "${p.type}"`)(p,u,f)}const h={pattern:t.body.map(f).join("|"),flags:f(t.flags),options:{...t.options}};return r||(delete h.options.force.v,h.options.disable.v=!0,h.options.unicodeSetsPlugin=null),h._captureTransfers=new Map,h._hiddenCaptures=[],u.captureMap.forEach((p,d)=>{p.hidden&&h._hiddenCaptures.push(d),p.transferTo&&ze(h._captureTransfers,p.transferTo,[]).push(d)}),h}var cc={"*":{enter({node:t},e){if(_r(t)){const n=e.getCurrentModI();e.pushModI(t.flags?yt({ignoreCase:n},t.flags).ignoreCase:n)}},exit({node:t},e){_r(t)&&e.popModI()}},Backreference(t,e){e.setHasCasedChar()},Character({node:t},e){Tn(D(t.value))&&e.setHasCasedChar()},CharacterClassRange({node:t,skip:e},n){e(),js(t,{firstOnly:!0}).length&&n.setHasCasedChar()},CharacterSet({node:t},e){t.kind==="property"&&Ms.has(t.value)&&e.setHasCasedChar()}},uc={Alternative({body:t},e,n){return t.map(n).join("")},Assertion({kind:t,negate:e}){if(t==="string_end")return"$";if(t==="string_start")return"^";if(t==="word_boundary")return e?x`\B`:x`\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,n){const{body:r,name:s,number:o}=t,i={ignoreCase:e.currentFlags.ignoreCase},l=e.originMap.get(t);return l&&(i.hidden=!0,o>l.number&&(i.transferTo=l.number)),e.captureMap.set(o,i),`(${s?`?<${s}>`:""}${r.map(n).join("|")})`},Character({value:t},e){const n=D(t),r=Se(t,{escDigit:e.lastNode.type==="Backreference",inCharClass:e.inCharClass,useFlagV:e.useFlagV});if(r!==n)return r;if(e.useAppliedIgnoreCase&&e.currentFlags.ignoreCase&&Tn(n)){const s=$s(n);return e.inCharClass?s.join(""):s.length>1?`[${s.join("")}]`:s[0]}return n},CharacterClass(t,e,n){const{kind:r,negate:s,parent:o}=t;let{body:i}=t;if(r==="intersection"&&!e.useFlagV)throw new Error("Use of character class intersection requires min target ES2024");ae.bugFlagVLiteralHyphenIsRange&&e.useFlagV&&i.some(Sr)&&(i=[St(45),...i.filter(c=>!Sr(c))]);const l=()=>`[${s?"^":""}${i.map(n).join(r==="intersection"?"&&":"")}]`;if(!e.inCharClass){if((!e.useFlagV||ae.bugNestedClassIgnoresNegation)&&!s){const u=i.filter(f=>f.type==="CharacterClass"&&f.kind==="union"&&f.negate);if(u.length){const f=ee(),h=f.body[0];return f.parent=o,h.parent=f,i=i.filter(p=>!u.includes(p)),t.body=i,i.length?(t.parent=h,h.body.push(t)):f.body.pop(),u.forEach(p=>{const d=we({body:[p]});p.parent=d,d.parent=f,f.body.push(d)}),n(f)}}e.inCharClass=!0;const c=l();return e.inCharClass=!1,c}const a=i[0];if(r==="union"&&!s&&a&&((!e.useFlagV||!e.verbose)&&o.kind==="union"&&!(ae.bugFlagVLiteralHyphenIsRange&&e.useFlagV)||!e.verbose&&o.kind==="intersection"&&i.length===1&&a.type!=="CharacterClassRange"))return i.map(n).join("");if(!e.useFlagV&&o.type==="CharacterClass")throw new Error("Uses nested character class in a way that requires min target ES2024");return l()},CharacterClassRange(t,e){const n=t.min.value,r=t.max.value,s={escDigit:!1,inCharClass:!0,useFlagV:e.useFlagV},o=Se(n,s),i=Se(r,s),l=new Set;if(e.useAppliedIgnoreCase&&e.currentFlags.ignoreCase){const a=js(t);gc(a).forEach(u=>{l.add(Array.isArray(u)?`${Se(u[0],s)}-${Se(u[1],s)}`:Se(u,s))})}return`${o}-${i}${[...l].join("")}`},CharacterSet({kind:t,negate:e,value:n,key:r},s){if(t==="dot")return s.currentFlags.dotAll?s.appliedGlobalFlags.dotAll||s.useFlagMods?".":"[^]":x`[^\n]`;if(t==="digit")return e?x`\D`:x`\d`;if(t==="property"){if(s.useAppliedIgnoreCase&&s.currentFlags.ignoreCase&&Ms.has(n))throw new Error(`Unicode property "${n}" can't be case-insensitive when other chars have specific case`);return`${e?x`\P`:x`\p`}{${r?`${r}=`:""}${n}}`}if(t==="word")return e?x`\W`:x`\w`;throw new Error(`Unexpected character set kind "${t}"`)},Flags(t,e){return(e.appliedGlobalFlags.ignoreCase?"i":"")+(t.dotAll?"s":"")+(t.sticky?"y":"")},Group({atomic:t,body:e,flags:n,parent:r},s,o){const i=s.currentFlags;n&&(s.currentFlags=yt(i,n));const l=e.map(o).join("|"),a=!s.verbose&&e.length===1&&r.type!=="Quantifier"&&!t&&(!s.useFlagMods||!n)?l:`(?${mc(t,n,s.useFlagMods)}${l})`;return s.currentFlags=i,a},LookaroundAssertion({body:t,kind:e,negate:n},r,s){return`(?${`${e==="lookahead"?"":"<"}${n?"!":"="}`}${t.map(s).join("|")})`},Quantifier(t,e,n){return n(t.body)+yc(t)},Subroutine({isRecursive:t,ref:e},n){if(!t)throw new Error("Unexpected non-recursive subroutine in transformed AST");const r=n.recursionLimit;return e===0?`(?R=${r})`:x`\g<${e}&R=${r}>`}},fc=new Set(["$","(",")","*","+",".","?","[","\\","]","^","{","|","}"]),hc=new Set(["-","\\","]","^","["]),dc=new Set(["(",")","-","/","[","\\","]","^","{","|","}","!","#","$","%","&","*","+",",",".",":",";","<","=",">","?","@","`","~"]),Cr=new Map([[9,x`\t`],[10,x`\n`],[11,x`\v`],[12,x`\f`],[13,x`\r`],[8232,x`\u2028`],[8233,x`\u2029`],[65279,x`\uFEFF`]]),pc=new RegExp("^\\p{Cased}$","u");function Tn(t){return pc.test(t)}function js(t,e){const n=!!e?.firstOnly,r=t.min.value,s=t.max.value,o=[];if(r<65&&(s===65535||s>=131071)||r===65536&&s>=131071)return o;for(let i=r;i<=s;i++){const l=D(i);if(!Tn(l))continue;const a=$s(l).filter(c=>{const u=c.codePointAt(0);return u<r||u>s});if(a.length&&(o.push(...a),n))break}return o}function Se(t,{escDigit:e,inCharClass:n,useFlagV:r}){if(Cr.has(t))return Cr.get(t);if(t<32||t>126&&t<160||t>262143||e&&bc(t))return t>255?`\\u{${t.toString(16).toUpperCase()}}`:`\\x${t.toString(16).toUpperCase().padStart(2,"0")}`;const s=n?r?dc:hc:fc,o=D(t);return(s.has(o)?"\\":"")+o}function gc(t){const e=t.map(s=>s.codePointAt(0)).sort((s,o)=>s-o),n=[];let r=null;for(let s=0;s<e.length;s++)e[s+1]===e[s]+1?r??=e[s]:r===null?n.push(e[s]):(n.push([r,e[s]]),r=null);return n}function mc(t,e,n){if(t)return">";let r="";if(e&&n){const{enable:s,disable:o}=e;r=(s?.ignoreCase?"i":"")+(s?.dotAll?"s":"")+(o?"-":"")+(o?.ignoreCase?"i":"")+(o?.dotAll?"s":"")}return`${r}:`}function yc({kind:t,max:e,min:n}){let r;return!n&&e===1?r="?":!n&&e===1/0?r="*":n===1&&e===1/0?r="+":n===e?r=`{${n}}`:r=`{${n},${e===1/0?"":e}}`,r+{greedy:"",lazy:"?",possessive:"+"}[t]}function _r({type:t}){return t==="CapturingGroup"||t==="Group"||t==="LookaroundAssertion"}function bc(t){return t>47&&t<58}function Sr({type:t,value:e}){return t==="Character"&&e===45}var wc=class dn extends RegExp{#t=new Map;#e=null;#r;#n=null;#s=null;rawOptions={};get source(){return this.#r||"(?:)"}constructor(e,n,r){const s=!!r?.lazyCompile;if(e instanceof RegExp){if(r)throw new Error("Cannot provide options when copying a regexp");const o=e;super(o,n),this.#r=o.source,o instanceof dn&&(this.#t=o.#t,this.#n=o.#n,this.#s=o.#s,this.rawOptions=o.rawOptions)}else{const o={hiddenCaptures:[],strategy:null,transfers:[],...r};super(s?"":e,n),this.#r=e,this.#t=_c(o.hiddenCaptures,o.transfers),this.#s=o.strategy,this.rawOptions=r??{}}s||(this.#e=this)}exec(e){if(!this.#e){const{lazyCompile:s,...o}=this.rawOptions;this.#e=new dn(this.#r,this.flags,o)}const n=this.global||this.sticky,r=this.lastIndex;if(this.#s==="clip_search"&&n&&r){this.lastIndex=0;const s=this.#o(e.slice(r));return s&&(Cc(s,r,e,this.hasIndices),this.lastIndex+=r),s}return this.#o(e)}#o(e){this.#e.lastIndex=this.lastIndex;const n=super.exec.call(this.#e,e);if(this.lastIndex=this.#e.lastIndex,!n||!this.#t.size)return n;const r=[...n];n.length=1;let s;this.hasIndices&&(s=[...n.indices],n.indices.length=1);const o=[0];for(let i=1;i<r.length;i++){const{hidden:l,transferTo:a}=this.#t.get(i)??{};if(l?o.push(null):(o.push(n.length),n.push(r[i]),this.hasIndices&&n.indices.push(s[i])),a&&r[i]!==void 0){const c=o[a];if(!c)throw new Error(`Invalid capture transfer to "${c}"`);if(n[c]=r[i],this.hasIndices&&(n.indices[c]=s[i]),n.groups){this.#n||(this.#n=Sc(this.source));const u=this.#n.get(a);u&&(n.groups[u]=r[i],this.hasIndices&&(n.indices.groups[u]=s[i]))}}}return n}};function Cc(t,e,n,r){if(t.index+=e,t.input=n,r){const s=t.indices;for(let i=0;i<s.length;i++){const l=s[i];l&&(s[i]=[l[0]+e,l[1]+e])}const o=s.groups;o&&Object.keys(o).forEach(i=>{const l=o[i];l&&(o[i]=[l[0]+e,l[1]+e])})}}function _c(t,e){const n=new Map;for(const r of t)n.set(r,{hidden:!0});for(const[r,s]of e)for(const o of s)ze(n,o,{}).transferTo=r;return n}function Sc(t){const e=/(?<capture>\((?:\?<(?![=!])(?<name>[^>]+)>|(?!\?)))|\\?./gsu,n=new Map;let r=0,s=0,o;for(;o=e.exec(t);){const{0:i,groups:{capture:l,name:a}}=o;i==="["?r++:r?i==="]"&&r--:l&&(s++,a&&n.set(s,a))}return n}function kc(t,e){const n=vc(t,e);return n.options?new wc(n.pattern,n.flags,n.options):new RegExp(n.pattern,n.flags)}function vc(t,e){const n=Ps(e),r=xs(t,{flags:n.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline},skipBackrefValidation:n.rules.allowOrphanBackrefs,unicodePropertyMap:Nn}),s=Ql(r,{accuracy:n.accuracy,asciiWordBoundaries:n.rules.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,bestEffortTarget:n.target}),o=lc(s,n),i=Fl(o.pattern,{captureTransfers:o._captureTransfers,hiddenCaptures:o._hiddenCaptures,mode:"external"}),l=Bl(i.pattern),a=Dl(l.pattern,{captureTransfers:i.captureTransfers,hiddenCaptures:i.hiddenCaptures}),c={pattern:a.pattern,flags:`${n.hasIndices?"d":""}${n.global?"g":""}${o.flags}${o.options.disable.v?"u":"v"}`};if(n.avoidSubclass){if(n.lazyCompileLength!==1/0)throw new Error("Lazy compilation requires subclass")}else{const u=a.hiddenCaptures.sort((d,b)=>d-b),f=Array.from(a.captureTransfers),h=s._strategy,p=c.pattern.length>=n.lazyCompileLength;(u.length||f.length||h||p)&&(c.options={...u.length&&{hiddenCaptures:u},...f.length&&{transfers:f},...h&&{strategy:h},...p&&{lazyCompile:p}})}return c}const kr=4294967295;class xc{constructor(e,n={}){this.patterns=e,this.options=n;const{forgiving:r=!1,cache:s,regexConstructor:o}=n;if(!o)throw new Error("Option `regexConstructor` is not provided");this.regexps=e.map(i=>{if(typeof i!="string")return i;const l=s?.get(i);if(l){if(l instanceof RegExp)return l;if(r)return null;throw l}try{const a=o(i);return s?.set(i,a),a}catch(a){if(s?.set(i,a),r)return null;throw a}})}regexps;findNextMatchSync(e,n,r){const s=typeof e=="string"?e:e.content,o=[];function i(l,a,c=0){return{index:l,captureIndices:a.indices.map(u=>u==null?{start:kr,end:kr,length:0}:{start:u[0]+c,end:u[1]+c,length:u[1]-u[0]})}}for(let l=0;l<this.regexps.length;l++){const a=this.regexps[l];if(a)try{a.lastIndex=n;const c=a.exec(s);if(!c)continue;if(c.index===n)return i(l,c,0);o.push([l,c,0])}catch(c){if(this.options.forgiving)continue;throw c}}if(o.length){const l=Math.min(...o.map(a=>a[1].index));for(const[a,c,u]of o)if(c.index===l)return i(a,c,u)}return null}}function Ec(t,e){return kc(t,{global:!0,hasIndices:!0,lazyCompileLength:3e3,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...e})}function Ic(t={}){const e=Object.assign({target:"auto",cache:new Map},t);return e.regexConstructor||=n=>Ec(n,{target:e.target}),{createScanner(n){return new xc(n,e)},createString(n){return{content:n}}}}class Pn extends Error{constructor(e){super(e),this.name="ShikiError"}}function Ac(){return 2147483648}function Rc(){return typeof performance<"u"?performance.now():Date.now()}const Lc=(t,e)=>t+(e-t%e)%e;async function Nc(t){let e,n;const r={};function s(p){n=p,r.HEAPU8=new Uint8Array(p),r.HEAPU32=new Uint32Array(p)}function o(p,d,b){r.HEAPU8.copyWithin(p,d,d+b)}function i(p){try{return e.grow(p-n.byteLength+65535>>>16),s(e.buffer),1}catch{}}function l(p){const d=r.HEAPU8.length;p=p>>>0;const b=Ac();if(p>b)return!1;for(let w=1;w<=4;w*=2){let g=d*(1+.2/w);g=Math.min(g,p+100663296);const y=Math.min(b,Lc(Math.max(p,g),65536));if(i(y))return!0}return!1}const a=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function c(p,d,b=1024){const w=d+b;let g=d;for(;p[g]&&!(g>=w);)++g;if(g-d>16&&p.buffer&&a)return a.decode(p.subarray(d,g));let y="";for(;d<g;){let m=p[d++];if(!(m&128)){y+=String.fromCharCode(m);continue}const _=p[d++]&63;if((m&224)===192){y+=String.fromCharCode((m&31)<<6|_);continue}const S=p[d++]&63;if((m&240)===224?m=(m&15)<<12|_<<6|S:m=(m&7)<<18|_<<12|S<<6|p[d++]&63,m<65536)y+=String.fromCharCode(m);else{const k=m-65536;y+=String.fromCharCode(55296|k>>10,56320|k&1023)}}return y}function u(p,d){return p?c(r.HEAPU8,p,d):""}const f={emscripten_get_now:Rc,emscripten_memcpy_big:o,emscripten_resize_heap:l,fd_write:()=>0};async function h(){const d=await t({env:f,wasi_snapshot_preview1:f});e=d.memory,s(e.buffer),Object.assign(r,d),r.UTF8ToString=u}return await h(),r}var Tc=Object.defineProperty,Pc=(t,e,n)=>e in t?Tc(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,B=(t,e,n)=>Pc(t,typeof e!="symbol"?e+"":e,n);let F=null;function $c(t){throw new Pn(t.UTF8ToString(t.getLastOnigError()))}class xt{constructor(e){B(this,"utf16Length"),B(this,"utf8Length"),B(this,"utf16Value"),B(this,"utf8Value"),B(this,"utf16OffsetToUtf8"),B(this,"utf8OffsetToUtf16");const n=e.length,r=xt._utf8ByteLength(e),s=r!==n,o=s?new Uint32Array(n+1):null;s&&(o[n]=r);const i=s?new Uint32Array(r+1):null;s&&(i[r]=n);const l=new Uint8Array(r);let a=0;for(let c=0;c<n;c++){const u=e.charCodeAt(c);let f=u,h=!1;if(u>=55296&&u<=56319&&c+1<n){const p=e.charCodeAt(c+1);p>=56320&&p<=57343&&(f=(u-55296<<10)+65536|p-56320,h=!0)}s&&(o[c]=a,h&&(o[c+1]=a),f<=127?i[a+0]=c:f<=2047?(i[a+0]=c,i[a+1]=c):f<=65535?(i[a+0]=c,i[a+1]=c,i[a+2]=c):(i[a+0]=c,i[a+1]=c,i[a+2]=c,i[a+3]=c)),f<=127?l[a++]=f:f<=2047?(l[a++]=192|(f&1984)>>>6,l[a++]=128|(f&63)>>>0):f<=65535?(l[a++]=224|(f&61440)>>>12,l[a++]=128|(f&4032)>>>6,l[a++]=128|(f&63)>>>0):(l[a++]=240|(f&1835008)>>>18,l[a++]=128|(f&258048)>>>12,l[a++]=128|(f&4032)>>>6,l[a++]=128|(f&63)>>>0),h&&c++}this.utf16Length=n,this.utf8Length=r,this.utf16Value=e,this.utf8Value=l,this.utf16OffsetToUtf8=o,this.utf8OffsetToUtf16=i}static _utf8ByteLength(e){let n=0;for(let r=0,s=e.length;r<s;r++){const o=e.charCodeAt(r);let i=o,l=!1;if(o>=55296&&o<=56319&&r+1<s){const a=e.charCodeAt(r+1);a>=56320&&a<=57343&&(i=(o-55296<<10)+65536|a-56320,l=!0)}i<=127?n+=1:i<=2047?n+=2:i<=65535?n+=3:n+=4,l&&r++}return n}createString(e){const n=e.omalloc(this.utf8Length);return e.HEAPU8.set(this.utf8Value,n),n}}const Et=class re{constructor(e){if(B(this,"id",++re.LAST_ID),B(this,"_onigBinding"),B(this,"content"),B(this,"utf16Length"),B(this,"utf8Length"),B(this,"utf16OffsetToUtf8"),B(this,"utf8OffsetToUtf16"),B(this,"ptr"),!F)throw new Pn("Must invoke loadWasm first.");this._onigBinding=F,this.content=e;const n=new xt(e);this.utf16Length=n.utf16Length,this.utf8Length=n.utf8Length,this.utf16OffsetToUtf8=n.utf16OffsetToUtf8,this.utf8OffsetToUtf16=n.utf8OffsetToUtf16,this.utf8Length<1e4&&!re._sharedPtrInUse?(re._sharedPtr||(re._sharedPtr=F.omalloc(1e4)),re._sharedPtrInUse=!0,F.HEAPU8.set(n.utf8Value,re._sharedPtr),this.ptr=re._sharedPtr):this.ptr=n.createString(F)}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===re._sharedPtr?re._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};B(Et,"LAST_ID",0);B(Et,"_sharedPtr",0);B(Et,"_sharedPtrInUse",!1);let zs=Et;class Mc{constructor(e){if(B(this,"_onigBinding"),B(this,"_ptr"),!F)throw new Pn("Must invoke loadWasm first.");const n=[],r=[];for(let l=0,a=e.length;l<a;l++){const c=new xt(e[l]);n[l]=c.createString(F),r[l]=c.utf8Length}const s=F.omalloc(4*e.length);F.HEAPU32.set(n,s/4);const o=F.omalloc(4*e.length);F.HEAPU32.set(r,o/4);const i=F.createOnigScanner(s,o,e.length);for(let l=0,a=e.length;l<a;l++)F.ofree(n[l]);F.ofree(o),F.ofree(s),i===0&&$c(F),this._onigBinding=F,this._ptr=i}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(e,n,r){let s=0;if(typeof r=="number"&&(s=r),typeof e=="string"){e=new zs(e);const o=this._findNextMatchSync(e,n,!1,s);return e.dispose(),o}return this._findNextMatchSync(e,n,!1,s)}_findNextMatchSync(e,n,r,s){const o=this._onigBinding,i=o.findNextOnigScannerMatch(this._ptr,e.id,e.ptr,e.utf8Length,e.convertUtf16OffsetToUtf8(n),s);if(i===0)return null;const l=o.HEAPU32;let a=i/4;const c=l[a++],u=l[a++],f=[];for(let h=0;h<u;h++){const p=e.convertUtf8OffsetToUtf16(l[a++]),d=e.convertUtf8OffsetToUtf16(l[a++]);f[h]={start:p,end:d,length:d-p}}return{index:c,captureIndices:f}}}function Oc(t){return typeof t.instantiator=="function"}function Dc(t){return typeof t.default=="function"}function Bc(t){return typeof t.data<"u"}function Gc(t){return typeof Response<"u"&&t instanceof Response}function Fc(t){return typeof ArrayBuffer<"u"&&(t instanceof ArrayBuffer||ArrayBuffer.isView(t))||typeof Buffer<"u"&&Buffer.isBuffer?.(t)||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer||typeof Uint32Array<"u"&&t instanceof Uint32Array}let Je;function Uc(t){if(Je)return Je;async function e(){F=await Nc(async n=>{let r=t;return r=await r,typeof r=="function"&&(r=await r(n)),typeof r=="function"&&(r=await r(n)),Oc(r)?r=await r.instantiator(n):Dc(r)?r=await r.default(n):(Bc(r)&&(r=r.data),Gc(r)?typeof WebAssembly.instantiateStreaming=="function"?r=await jc(r)(n):r=await zc(r)(n):Fc(r)?r=await jt(r)(n):r instanceof WebAssembly.Module?r=await jt(r)(n):"default"in r&&r.default instanceof WebAssembly.Module&&(r=await jt(r.default)(n))),"instance"in r&&(r=r.instance),"exports"in r&&(r=r.exports),r})}return Je=e(),Je}function jt(t){return e=>WebAssembly.instantiate(t,e)}function jc(t){return e=>WebAssembly.instantiateStreaming(t,e)}function zc(t){return async e=>{const n=await t.arrayBuffer();return WebAssembly.instantiate(n,e)}}async function Wc(t){return t&&await Uc(t),{createScanner(e){return new Mc(e.map(n=>typeof n=="string"?n:n.source))},createString(e){return new zs(e)}}}function Hc(t){return t!==null&&typeof t=="object"&&"default"in t?t.default:t}var Vc=class extends Error{constructor(t){super(`Theme "${t}" is already registered`),this.name="DuplicateThemeError"}},qc=class extends Error{constructor(t){super(`No loader registered for theme "${t}"`),this.name="UnregisteredThemeError"}},Kc=class extends Error{constructor(t){super(`Theme "${t}" has not been resolved`),this.name="UnresolvedThemeError"}};function Xc(){const t=new Map,e=new Map,n=new Map;let r=0;function s(g,y){if(t.has(g))throw new Vc(g);t.set(g,y)}function o(g,y){return t.has(g)?!1:(t.set(g,y),!0)}function i(g){return t.has(g)}function l(g){const y=e.get(g);if(y!==void 0)return Promise.resolve(y);const m=n.get(g);if(m!==void 0)return m;const _=t.get(g);if(_===void 0)return Promise.reject(new qc(g));const S=r,k=_().then(v=>{const A=Hc(v);return S===r&&e.set(g,A),n.get(g)===k&&n.delete(g),A}).catch(v=>{throw n.get(g)===k&&n.delete(g),v});return n.set(g,k),k}function a(g){return Promise.all(g.map(y=>l(y)))}function c(g,y){e.set(g,y)}function u(g){for(const[y,m]of g)c(y,m)}function f(g){return e.get(g)}function h(g){const y=[];for(const m of g){const _=e.get(m);if(_===void 0)throw new Kc(m);y.push(_)}return y}function p(g){return e.has(g)}function d(g){for(const y of g)if(!e.has(y))return!1;return!0}function b(g){const y=e.get(g);return y!==void 0?y:l(g)}function w(){r++,e.clear(),n.clear()}return{clearResolvedThemes:w,getResolvedOrResolveTheme:b,getResolvedTheme:f,getResolvedThemes:h,hasRegisteredTheme:i,hasResolvedTheme:p,hasResolvedThemes:d,registerTheme:s,registerThemeIfAbsent:o,resolveTheme:l,resolveThemes:a,seedResolvedTheme:c,seedResolvedThemes:u}}class Ws{diff(e,n,r={}){let s;typeof r=="function"?(s=r,r={}):"callback"in r&&(s=r.callback);const o=this.castInput(e,r),i=this.castInput(n,r),l=this.removeEmpty(this.tokenize(o,r)),a=this.removeEmpty(this.tokenize(i,r));return this.diffWithOptionsObj(l,a,r,s)}diffWithOptionsObj(e,n,r,s){var o;const i=y=>{if(y=this.postProcess(y,r),s){setTimeout(function(){s(y)},0);return}else return y},l=n.length,a=e.length;let c=1,u=l+a;r.maxEditLength!=null&&(u=Math.min(u,r.maxEditLength));const f=(o=r.timeout)!==null&&o!==void 0?o:1/0,h=Date.now()+f,p=[{oldPos:-1,lastComponent:void 0}];let d=this.extractCommon(p[0],n,e,0,r);if(p[0].oldPos+1>=a&&d+1>=l)return i(this.buildValues(p[0].lastComponent,n,e));let b=-1/0,w=1/0;const g=()=>{for(let y=Math.max(b,-c);y<=Math.min(w,c);y+=2){let m;const _=p[y-1],S=p[y+1];_&&(p[y-1]=void 0);let k=!1;if(S){const A=S.oldPos-y;k=S&&0<=A&&A<l}const v=_&&_.oldPos+1<a;if(!k&&!v){p[y]=void 0;continue}if(!v||k&&_.oldPos<S.oldPos?m=this.addToPath(S,!0,!1,0,r):m=this.addToPath(_,!1,!0,1,r),d=this.extractCommon(m,n,e,y,r),m.oldPos+1>=a&&d+1>=l)return i(this.buildValues(m.lastComponent,n,e))||!0;p[y]=m,m.oldPos+1>=a&&(w=Math.min(w,y-1)),d+1>=l&&(b=Math.max(b,y+1))}c++};if(s)(function y(){setTimeout(function(){if(c>u||Date.now()>h)return s(void 0);g()||y()},0)})();else for(;c<=u&&Date.now()<=h;){const y=g();if(y)return y}}addToPath(e,n,r,s,o){const i=e.lastComponent;return i&&!o.oneChangePerToken&&i.added===n&&i.removed===r?{oldPos:e.oldPos+s,lastComponent:{count:i.count+1,added:n,removed:r,previousComponent:i.previousComponent}}:{oldPos:e.oldPos+s,lastComponent:{count:1,added:n,removed:r,previousComponent:i}}}extractCommon(e,n,r,s,o){const i=n.length,l=r.length;let a=e.oldPos,c=a-s,u=0;for(;c+1<i&&a+1<l&&this.equals(r[a+1],n[c+1],o);)c++,a++,u++,o.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return u&&!o.oneChangePerToken&&(e.lastComponent={count:u,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=a,c}equals(e,n,r){return r.comparator?r.comparator(e,n):e===n||!!r.ignoreCase&&e.toLowerCase()===n.toLowerCase()}removeEmpty(e){const n=[];for(let r=0;r<e.length;r++)e[r]&&n.push(e[r]);return n}castInput(e,n){return e}tokenize(e,n){return Array.from(e)}join(e){return e.join("")}postProcess(e,n){return e}get useLongestToken(){return!1}buildValues(e,n,r){const s=[];let o;for(;e;)s.push(e),o=e.previousComponent,delete e.previousComponent,e=o;s.reverse();const i=s.length;let l=0,a=0,c=0;for(;l<i;l++){const u=s[l];if(u.removed)u.value=this.join(r.slice(c,c+u.count)),c+=u.count;else{if(!u.added&&this.useLongestToken){let f=n.slice(a,a+u.count);f=f.map(function(h,p){const d=r[c+p];return d.length>h.length?d:h}),u.value=this.join(f)}else u.value=this.join(n.slice(a,a+u.count));a+=u.count,u.added||(c+=u.count)}}return s}}class Zc extends Ws{}const Qc=new Zc;function Yc(t,e,n){return Qc.diff(t,e,n)}const vr="a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}";class Jc extends Ws{tokenize(e){const n=new RegExp(`(\\r?\\n)|[${vr}]+|[^\\S\\n\\r]+|[^${vr}]`,"ug");return e.match(n)||[]}}const eu=new Jc;function tu(t,e,n){return eu.diff(t,e,n)}function nu(t={}){const{classPrefix:e="__shiki_",classSuffix:n="",classReplacer:r=l=>l}=t,s=new Map;function o(l){return Object.entries(l).map(([a,c])=>`${a}:${c}`).join(";")}function i(l){const a=typeof l=="string"?l:o(l);let c=e+ru(a)+n;return c=r(c),s.has(c)||s.set(c,typeof l=="string"?l:{...l}),c}return{name:"@shikijs/transformers:style-to-class",pre(l){if(!l.properties.style)return;const a=i(l.properties.style);delete l.properties.style,this.addClassToHast(l,a)},tokens(l){for(const a of l)for(const c of a){if(!c.htmlStyle)continue;const u=i(c.htmlStyle);c.htmlStyle={},c.htmlAttrs||={},c.htmlAttrs.class?c.htmlAttrs.class+=` ${u}`:c.htmlAttrs.class=u}},getClassRegistry(){return s},getCSS(){let l="";for(const[a,c]of s.entries())l+=`.${a}{${typeof c=="string"?c:o(c)}}`;return l},clearRegistry(){s.clear()}}}function ru(t,e=0){let n=3735928559^e,r=1103547991^e;for(let s=0,o;s<t.length;s++)o=t.charCodeAt(s),n=Math.imul(n^o,2654435761),r=Math.imul(r^o,1597334677);return n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(r^r>>>13,3266489909),r=Math.imul(r^r>>>16,2246822507),r^=Math.imul(n^n>>>13,3266489909),(4294967296*(2097151&r)+(n>>>0)).toString(36).slice(0,6)}const su=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,ou=/^0(?:\.0+)?%?$/;function iu(t){const e=t.indexOf("(");if(e<=0||!t.endsWith(")"))return;const n=t.slice(0,e).trim();if(!/^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)$/i.test(n))return;const r=t.slice(e+1,-1).trim();if(r.length===0)return;const s=r.lastIndexOf("/");if(s!==-1)return r.slice(s+1).trim();if(/^(?:rgba|hsla)$/i.test(n)){const o=r.split(",");if(o.length===4)return o[3]?.trim()}}function au(t){const e=/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})\b/i.exec(t.trim());if(e==null)return null;const n=e[1];let r,s=1;return n.length===3?r=n.split("").map(o=>o+o).join(""):n.length===6?r=n:(r=n.slice(0,6),s=parseInt(n.slice(6,8),16)/255),[parseInt(r.slice(0,2),16),parseInt(r.slice(2,4),16),parseInt(r.slice(4,6),16),s]}function zt(t){if(t==null)return null;const e=au(t);if(e==null)return null;const n=e[0]/255,r=e[1]/255,s=e[2]/255,o=i=>i<=.03928?i/12.92:((i+.055)/1.055)**2.4;return .2126*o(n)+.7152*o(r)+.0722*o(s)}function xr(t){if(t==null)return!1;const e=t.trim().toLowerCase();if(e==="transparent"||su.test(e))return!0;const n=iu(e);return n!=null&&ou.test(n)}function lu(t,e,n){if(e==null||n==null)return!1;const r=zt(t),s=zt(e),o=zt(n);return r==null||s==null||o==null?!1:Math.abs(r-o)<Math.abs(r-s)}const Er=new WeakMap;function Wt(t){const e=Er.get(t);if(e!=null)return e;const n=t.colors??{},r={...n},s=n["editor.background"]??t.bg,o=n["editor.foreground"]??t.fg,i=n["sideBar.background"]??s,l=n["sideBar.foreground"]??o;te(r,"editor.background",s),te(r,"editor.foreground",o),te(r,"sideBar.background",i),te(r,"sideBar.foreground",l),te(r,"input.background",n["input.background"]??i),te(r,"sideBarSectionHeader.foreground",n["sideBarSectionHeader.foreground"]??l),te(r,"list.activeSelectionForeground",n["list.activeSelectionForeground"]??l),te(r,"gitDecoration.addedResourceForeground",Ht(n["gitDecoration.addedResourceForeground"],n["terminal.ansiGreen"],n["editorGutter.addedBackground"])),te(r,"gitDecoration.modifiedResourceForeground",Ht(n["gitDecoration.modifiedResourceForeground"],n["terminal.ansiBlue"],n["editorGutter.modifiedBackground"])),te(r,"gitDecoration.deletedResourceForeground",Ht(n["gitDecoration.deletedResourceForeground"],n["terminal.ansiRed"],n["editorGutter.deletedBackground"]));const a=(xr(n["list.focusOutline"])?void 0:n["list.focusOutline"])??(xr(n.focusBorder)?void 0:n.focusBorder);a!=null?r["list.focusOutline"]=a:delete r["list.focusOutline"];const c=n["list.hoverBackground"];c!=null&&(cu(c,i)||lu(c,i,l))&&delete r["list.hoverBackground"];const u=Object.freeze({...t,colors:Object.freeze(r)});return Er.set(t,u),u}function te(t,e,n){n!=null&&n!==""&&(t[e]=n)}function Ht(...t){for(const e of t)if(e!=null&&e!=="")return e}function cu(t,e){return e!=null&&t.toLowerCase()===e.toLowerCase()}(()=>{try{return!1}catch{return!1}})();const Hs={dark:"pierre-dark",light:"pierre-light"},Ir=new Map,Ar=new Set;function $n(t,e){t=Array.isArray(t)?t:[t];for(const n of t){if(Ar.has(n.name))continue;let r=Ir.get(n.name);r==null&&(r=n,Ir.set(n.name,r));const s=r.data.find(o=>o.name===r.name||o.aliases?.includes(r.name)===!0);if(s==null)throw new Error(`attachResolvedLanguages: No returned grammar declares "${r.name}" as its name or an alias.`);e.loadLanguageSync(r.data);try{e.getLanguage(r.name)}catch{throw new Error(`attachResolvedLanguages: "${s.name}" is already loaded without alias "${r.name}". Load the alias first or give the grammar a unique name.`)}Ar.add(r.name)}}const Rr=new Set,Vt=Xc();function Vs(t,e){t=Array.isArray(t)?t:[t];for(let n of t){let r;if(typeof n=="string"){if(r=Vt.getResolvedTheme(n),r==null)throw new Error(`loadResolvedThemes: ${n} is not resolved, you must resolve it before calling loadResolvedThemes`)}else r=n,n=n.name,Vt.getResolvedTheme(n)==null&&Vt.seedResolvedTheme(n,r);Rr.has(n)||(Rr.add(n),e.loadThemeSync(r))}}const ue=new Map;let Lr=0;const ke={"1c":"1c",abap:"abap",as:"actionscript-3",ada:"ada",adb:"ada",ads:"ada",adoc:"asciidoc",asciidoc:"asciidoc","component.html":"angular-html","component.ts":"angular-ts",conf:"nginx",htaccess:"apache",cls:"tex",trigger:"apex",apl:"apl",applescript:"applescript",scpt:"applescript",ara:"ara",asm:"asm",s:"riscv",astro:"astro",awk:"awk",bal:"ballerina",sh:"zsh",bash:"zsh",bat:"cmd",cmd:"cmd",be:"berry",beancount:"beancount",bib:"bibtex",bicep:"bicep","blade.php":"blade",bsl:"bsl",c:"c",h:"objective-cpp",cs:"csharp",cpp:"cpp",hpp:"cpp",cc:"cpp",cxx:"cpp",hh:"cpp",cdc:"cdc",cairo:"cairo",clar:"clarity",clj:"clojure",cljs:"clojure",cljc:"clojure",soy:"soy",cmake:"cmake","CMakeLists.txt":"cmake",cob:"cobol",cbl:"cobol",cobol:"cobol",CODEOWNERS:"codeowners",ql:"ql",coffee:"coffeescript",lisp:"lisp",cl:"lisp",lsp:"lisp",log:"log",v:"verilog",cql:"cql",cr:"crystal",css:"css",csv:"csv",cue:"cue",cypher:"cypher",cyp:"cypher",d:"d",dart:"dart",dax:"dax",desktop:"desktop",diff:"diff",patch:"diff",Dockerfile:"dockerfile",dockerfile:"dockerfile",env:"dotenv",dm:"dream-maker",edge:"edge",el:"emacs-lisp",ex:"elixir",exs:"elixir",elm:"elm",erb:"erb",erl:"erlang",hrl:"erlang",f:"fortran-fixed-form",for:"fortran-fixed-form",fs:"fsharp",fsi:"fsharp",fsx:"fsharp",f03:"f03",f08:"f08",f18:"f18",f77:"f77",f90:"fortran-free-form",f95:"fortran-free-form",fnl:"fennel",fish:"fish",ftl:"ftl",tres:"gdresource",res:"gdresource",gd:"gdscript",gdshader:"gdshader",gs:"genie",feature:"gherkin",COMMIT_EDITMSG:"git-commit","git-rebase-todo":"git-rebase",gjs:"glimmer-js",gleam:"gleam",gts:"glimmer-ts",glsl:"glsl",vert:"glsl",frag:"glsl",shader:"shaderlab",gp:"gnuplot",plt:"gnuplot",gnuplot:"gnuplot",go:"go",graphql:"graphql",gql:"graphql",groovy:"groovy",gvy:"groovy",hack:"hack",haml:"haml",hbs:"handlebars",handlebars:"handlebars",hs:"haskell",lhs:"haskell",hx:"haxe",hcl:"hcl",hjson:"hjson",hlsl:"hlsl",fx:"hlsl",html:"html",htm:"html",http:"http",rest:"http",hxml:"hxml",hy:"hy",imba:"imba",ini:"ini",cfg:"ini",jade:"pug",pug:"pug",java:"java",js:"javascript",mjs:"javascript",cjs:"javascript",jinja:"jinja",jinja2:"jinja",j2:"jinja",jison:"jison",jl:"julia",json:"json",json5:"json5",jsonc:"jsonc",jsonl:"jsonl",jsonnet:"jsonnet",libsonnet:"jsonnet",jssm:"jssm",jsx:"jsx",kt:"kotlin",kts:"kts",kql:"kusto",tex:"tex",ltx:"tex",lean:"lean4",less:"less",liquid:"liquid",lit:"lit",ll:"llvm",logo:"logo",lua:"lua",luau:"luau",Makefile:"makefile",mk:"makefile",makefile:"makefile",md:"markdown",markdown:"markdown",marko:"marko",m:"wolfram",mat:"matlab",mdc:"mdc",mdx:"mdx",wiki:"wikitext",mediawiki:"wikitext",mmd:"mermaid",mermaid:"mermaid",mips:"mipsasm",mojo:"mojo","🔥":"mojo",move:"move",nar:"narrat",nf:"nextflow",nim:"nim",nims:"nim",nimble:"nim",nix:"nix",nu:"nushell",mm:"objective-cpp",ml:"ocaml",mli:"ocaml",mll:"ocaml",mly:"ocaml",odin:"odin",pas:"pascal",p:"pascal",pl:"prolog",pm:"perl",t:"perl",raku:"raku",p6:"raku",pl6:"raku",php:"php",phtml:"php",pls:"plsql",sql:"sql",po:"po",polar:"polar",pcss:"postcss",pot:"pot",potx:"potx",pq:"powerquery",pqm:"powerquery",ps1:"powershell",psm1:"powershell",psd1:"powershell",prisma:"prisma",pro:"prolog",P:"prolog",properties:"properties",proto:"protobuf",pp:"puppet",purs:"purescript",py:"python",pyw:"python",pyi:"python",BUCK:"python",BUILD:"python",PACKAGE:"python",WORKSPACE:"python",Tiltfile:"python",bazel:"python",bxl:"python",bzl:"python",bzlmod:"python",star:"python",sky:"python",qml:"qml",qmldir:"qmldir",qss:"qss",r:"r",R:"r",rkt:"racket",rktl:"racket",razor:"razor",cshtml:"razor",rb:"ruby",rbw:"ruby",reg:"reg",regex:"regexp",rel:"rel",rs:"rust",rst:"rst",rake:"ruby",gemspec:"ruby",jbuilder:"ruby",builder:"ruby",rabl:"ruby",arb:"ruby",ru:"ruby",podspec:"ruby",Gemfile:"ruby",Rakefile:"ruby",Guardfile:"ruby",Capfile:"ruby",Berksfile:"ruby",Brewfile:"ruby",Vagrantfile:"ruby",Thorfile:"ruby",Appraisals:"ruby",Dangerfile:"ruby",sas:"sas",sass:"sass",scala:"scala",sc:"scala",scm:"scheme",ss:"scheme",sld:"scheme",scss:"scss",sdbl:"sdbl",shadergraph:"shader",st:"smalltalk",sol:"solidity",sparql:"sparql",rq:"sparql",spl:"splunk",config:"ssh-config",do:"stata",ado:"stata",dta:"stata",styl:"stylus",stylus:"stylus",svelte:"svelte",swift:"swift",sv:"system-verilog",svh:"system-verilog",service:"systemd",socket:"systemd",device:"systemd",timer:"systemd",talon:"talonscript",tasl:"tasl",tcl:"tcl",templ:"templ",tf:"tf",tfvars:"tfvars",toml:"toml",ts:"typescript",mts:"typescript",cts:"typescript",tsp:"typespec",tsv:"tsv",tsx:"tsx",ttl:"turtle",twig:"twig",typ:"typst",vv:"v",vala:"vala",vapi:"vala",vb:"vb",vbs:"vb",bas:"vb",vh:"verilog",vhd:"vhdl",vhdl:"vhdl",vim:"vimscript",vue:"vue","vine.ts":"vue-vine",vy:"vyper",wasm:"wasm",wat:"wasm",wy:"文言",wgsl:"wgsl",wit:"wit",wl:"wolfram",nb:"wolfram",xml:"xml",xsl:"xsl",xslt:"xsl",yaml:"yaml",yml:"yml",zs:"zenscript",zig:"zig",zsh:"zsh",sty:"tex"};function pn(t){const e=Nr(t);if(e!=null)return e;const n=t.split(/[/\\]/).pop()??t;return n===t?"text":Nr(n)??"text"}function Nr(t){if(ue.has(t))return ue.get(t)??"text";if(Object.hasOwn(ke,t))return ke[t]??null;const e=t.match(/\.([^/\\]+\.[^/\\]+)$/);if(e!=null){if(ue.has(e[1]))return ue.get(e[1])??"text";if(Object.hasOwn(ke,e[1]))return ke[e[1]]??"text"}const n=t.match(/\.([^.]+)$/)?.[1]??"";return ue.has(n)?ue.get(n)??"text":Object.hasOwn(ke,n)?ke[n]??"text":null}function uu(t,e){if(t<=Lr)return!1;ue.clear();for(const n in e){const r=e[n];r!=null&&ue.set(n,r)}return Lr=t,!0}function gn(t,e){for(const n of e)t.push(n)}function bt(t){let e=t.length;return t.charCodeAt(e-1)===10&&(e--,t.charCodeAt(e-1)===13&&e--),t.slice(0,e)}function fu(t){return{type:"text",value:t}}function hu({tagName:t,children:e=[],properties:n={}}){return{type:"element",tagName:t,properties:n,children:e}}function du(t){let e=t.children[0];for(;e!=null;){if(e.type==="element"&&e.tagName==="code")return e;"children"in e?e=e.children[0]:e=null}}function pu(t,e,n){const r=typeof n.lineInfo=="function"?n.lineInfo(e):n.lineInfo[e-1];if(r==null){const s=`processLine: line ${e}, contains no state.lineInfo`;throw console.error(s,{node:t,line:e,state:n}),new Error(s)}return t.tagName="div",t.properties["data-line"]=r.lineNumber,t.properties["data-alt-line"]=r.altLineNumber,t.properties["data-line-type"]=r.type,t.properties["data-line-index"]=r.lineIndex,t.children.length===0&&t.children.push(fu(`
153
+ `)),t}const et=Symbol("no-token"),qt=Symbol("multiple-tokens");function qs(t){const e=gu(t);if(e!=null)return e;let n=et;const r=[];let s=[],o;const i=()=>{if(s.length===0||o==null){s=[],o=void 0;return}if(s.length===1){const a=s[0];if(a?.type==="element"){mu(a,o);for(const c of a.children)it(c)}else it(a);r.push(a),s=[],o=void 0;return}for(const a of s)it(a);r.push(hu({tagName:"span",properties:{"data-char":o},children:s})),s=[],o=void 0},l=a=>{if(a!==et){if(a===qt){n=qt;return}if(n===et){n=a;return}n!==a&&(n=qt)}};for(const a of t.children){const c=a.type==="element"?qs(a):et;if(l(c),typeof c!="number"){i(),r.push(a);continue}o!=null&&o!==c&&i(),o??=c,s.push(a)}return i(),t.children=r,n}function gu(t){const e=t.properties["data-char"];if(typeof e=="number")return e}function it(t){if(t.type==="element"){t.properties["data-char"]=void 0;for(const e of t.children)it(e)}}function mu(t,e){t.properties["data-char"]=e}function Ks(t=!1,e=!1){const n={lineInfo:[]},r=[{line(s){return delete s.properties.class,s},pre(s){const o=du(s),i=[];if(o!=null){let l=1;for(const a of o.children)a.type==="element"&&(t&&qs(a),i.push(pu(a,l,n)),l++);o.children=i}return s},...t?{tokens(s){for(const o of s){let i=0;for(const l of o){const a=l;a.__lineChar??=i,i+=l.content.length}}},preprocess(s,o){o.mergeWhitespaces="never"},span(s,o,i,l,a){if(a?.offset!=null&&a.content!=null){const c=a.__lineChar;return c!=null&&(s.properties["data-char"]=c),s}return s}}:null}];return e&&r.push(yu,Tr),t&&r.push({line:s=>(s.type==="element"&&s.children.length===0&&s.children.push({type:"element",tagName:"br",properties:{},children:[]}),s)}),{state:n,transformers:r,toClass:Tr}}const Tr=nu({classPrefix:"hl-"}),yu={name:"token-style-normalizer",tokens(t){for(const e of t)for(const n of e){if(n.htmlStyle!=null)continue;const r={};n.color!=null&&(r.color=n.color),n.bgColor!=null&&(r["background-color"]=n.bgColor),n.fontStyle!=null&&n.fontStyle!==0&&((n.fontStyle&1)!==0&&(r["font-style"]="italic"),(n.fontStyle&2)!==0&&(r["font-weight"]="bold"),(n.fontStyle&4)!==0&&(r["text-decoration"]="underline")),Object.keys(r).length>0&&(n.htmlStyle=r)}}};function X(t){return`--${t==="token"?"diffs-token":"diffs"}-`}function Xs({theme:t=Hs,highlighter:e,prefix:n}){let r="";if(typeof t=="string"){const s=e.getTheme(t),o=Wt(s);r+=`color:${o.fg};`,r+=`background-color:${o.bg};`,r+=`${X("global")}fg:${o.fg};`,r+=`${X("global")}bg:${o.bg};`,r+=Kt(s,n)}else{let s=e.getTheme(t.dark),o=Wt(s);r+=`${X("global")}dark:${o.fg};`,r+=`${X("global")}dark-bg:${o.bg};`,r+=Kt(s,"dark"),s=e.getTheme(t.light),o=Wt(s),r+=`${X("global")}light:${o.fg};`,r+=`${X("global")}light-bg:${o.bg};`,r+=Kt(s,"light")}return r}function Kt(t,e){e=e!=null?`${e}-`:"";let n="";const r=t.colors?.["gitDecoration.addedResourceForeground"]??t.colors?.["terminal.ansiGreen"];r!=null&&(n+=`${X("global")}${e}addition-color:${r};`);const s=t.colors?.["gitDecoration.deletedResourceForeground"]??t.colors?.["terminal.ansiRed"];s!=null&&(n+=`${X("global")}${e}deletion-color:${s};`);const o=t.colors?.["gitDecoration.modifiedResourceForeground"]??t.colors?.["terminal.ansiBlue"];return o!=null&&(n+=`${X("global")}${e}modified-color:${o};`),n}function mn(t){let e=t.children[0];for(;e!=null;){if(e.type==="element"&&e.tagName==="code")return e.children;"children"in e?e=e.children[0]:e=null}throw console.error(t),new Error("getLineNodes: Unable to find children")}function yn(t,e){return t-(e===0?0:1)}function Pr(t,e){return yn(t,e)+e}function bu({isPartial:t,rangeSize:e,expandedHunks:n,hunkIndex:r,collapsedContextThreshold:s}){const o=Math.max(e,0);if(o===0||t)return{fromStart:0,fromEnd:0,rangeSize:o,collapsedLines:o,renderAll:!1};if(n===!0||o<=s)return{fromStart:o,fromEnd:0,rangeSize:o,collapsedLines:0,renderAll:!0};const i=n?.get(r),l=Math.min(Math.max(i?.fromStart??0,0),o),a=Math.min(Math.max(i?.fromEnd??0,0),o),c=l+a,u=c>=o;return{fromStart:u?o:l,fromEnd:u?0:a,rangeSize:o,collapsedLines:Math.max(o-c,0),renderAll:u}}function wu({fileDiff:t,errorPrefix:e}){const n=t.hunks[t.hunks.length-1];if(n==null||t.isPartial||t.additionLines.length===0||t.deletionLines.length===0)return 0;const r=t.additionLines.length-Pr(n.additionStart,n.additionCount),s=t.deletionLines.length-Pr(n.deletionStart,n.deletionCount);if(r<=0&&s<=0)return 0;if(r!==s)throw new Error(`${e}: trailing context mismatch (additions=${r}, deletions=${s}) for ${t.name}`);return Math.min(r,s)}function Cu({fileDiff:t,hunkIndex:e,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:s}){if(e!==t.hunks.length-1)return;const o=wu({fileDiff:t,errorPrefix:s});if(o<=0)return;if(n===!0||o<=r)return{fromStart:o,fromEnd:0,rangeSize:o,collapsedLines:0,renderAll:!0};const i=n?.get(t.hunks.length),l=Math.min(Math.max(i?.fromStart??0,0),o);return{fromStart:l,fromEnd:0,rangeSize:o,collapsedLines:o-l,renderAll:l>=o}}function _u({diff:t,diffStyle:e,startingLine:n=0,totalLines:r=1/0,expandedHunks:s,collapsedContextThreshold:o=1,callback:i}){const l=Su({diff:t,diffStyle:e,startingLine:n,expandedHunks:s,collapsedContextThreshold:o}),a={viewportStart:n,viewportEnd:n+r,isWindowedHighlight:n>0||r<1/0,splitCount:l.splitCount,unifiedCount:l.unifiedCount,finalHunkIndex:t.hunks.length-1,shouldBreak(){if(!a.isWindowedHighlight)return!1;const c=a.unifiedCount>=n+r,u=a.splitCount>=n+r;return c&&u},shouldSkip(c,u){if(!a.isWindowedHighlight)return!1;const f=c>0&&a.unifiedCount+c<=n,h=u>0&&a.splitCount+u<=n;return f&&h},incrementCounts(c,u){a.unifiedCount+=c,a.splitCount+=u},isInWindow(c,u){if(!a.isWindowedHighlight)return!0;const f=a.isInUnifiedWindow(c),h=a.isInSplitWindow(u);return f||h},isInUnifiedWindow(c){return!a.isWindowedHighlight||a.unifiedCount>=n-c&&a.unifiedCount<n+r},isInSplitWindow(c){return!a.isWindowedHighlight||a.splitCount>=n-c&&a.splitCount<n+r},emit(c,u=!1){return u||a.incrementCounts(1,1),i(c)??!1}};e:for(let c=l.hunkIndex;c<t.hunks.length;c++){let u=function(E,V){return y==null||y.collapsedLines<=0||y.fromStart+y.fromEnd>0?0:V===h.splitLineStart+h.splitLineCount-1?y.collapsedLines:0},f=function(){return _?0:(_=!0,g.collapsedLines)};const h=t.hunks[c];if(h==null)throw new Error("iterateOverDiff: invalid hunk index");if(a.shouldBreak())break;const p=yn(h.deletionStart,h.deletionCount),d=yn(h.additionStart,h.additionCount),b=!t.isPartial&&h.deletionCount===0?p:h.deletionLineIndex,w=!t.isPartial&&h.additionCount===0?d:h.additionLineIndex,g=bu({isPartial:t.isPartial,rangeSize:h.collapsedBefore,expandedHunks:s,hunkIndex:c,collapsedContextThreshold:o}),y=c===a.finalHunkIndex?Cu({fileDiff:t,hunkIndex:c,expandedHunks:s,collapsedContextThreshold:o,errorPrefix:"iterateOverDiff"}):void 0,m=g.fromStart+g.fromEnd;let _=g.collapsedLines===0;if(a.shouldSkip(m,m))a.incrementCounts(m,m),f();else{let E=h.unifiedLineStart-g.rangeSize,V=h.splitLineStart-g.rangeSize,R=b-g.rangeSize,P=w-g.rangeSize,T=p+1-g.rangeSize,J=d+1-g.rangeSize;if(tt(a,g.fromStart,e,O=>a.emit({hunkIndex:c,hunk:h,collapsedBefore:0,collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:T+O,lineIndex:R+O,noEOFCR:!1,unifiedLineIndex:E+O,splitLineIndex:V+O},additionLine:{unifiedLineIndex:E+O,splitLineIndex:V+O,lineIndex:P+O,lineNumber:J+O,noEOFCR:!1}}))||(E=h.unifiedLineStart-g.fromEnd,V=h.splitLineStart-g.fromEnd,R=b-g.fromEnd,P=w-g.fromEnd,T=p+1-g.fromEnd,J=d+1-g.fromEnd,tt(a,g.fromEnd,e,O=>a.emit({hunkIndex:c,hunk:h,collapsedBefore:f(),collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:T+O,lineIndex:R+O,noEOFCR:!1,unifiedLineIndex:E+O,splitLineIndex:V+O},additionLine:{unifiedLineIndex:E+O,splitLineIndex:V+O,lineIndex:P+O,lineNumber:J+O,noEOFCR:!1}}),()=>{f()})))break e}let S=h.unifiedLineStart,k=h.splitLineStart,v=b,A=w,L=p+1,H=d+1;const he=h.hunkContent.at(-1);for(const E of h.hunkContent){if(a.shouldBreak())break e;const V=E===he;if(E.type==="context"){if(a.shouldSkip(E.lines,E.lines))a.incrementCounts(E.lines,E.lines),f();else if(tt(a,E.lines,e,R=>{const P=V&&R===E.lines-1,T=S+R,J=k+R;return a.emit({hunkIndex:c,hunk:h,collapsedBefore:f(),collapsedAfter:u(T,J),type:"context",deletionLine:{lineNumber:L+R,lineIndex:v+R,noEOFCR:P&&h.noEOFCRDeletions,unifiedLineIndex:T,splitLineIndex:J},additionLine:{unifiedLineIndex:T,splitLineIndex:J,lineIndex:A+R,lineNumber:H+R,noEOFCR:P&&h.noEOFCRAdditions}})},()=>{f()}))break e;S+=E.lines,k+=E.lines,v+=E.lines,A+=E.lines,L+=E.lines,H+=E.lines}else{const R=Math.max(E.deletions,E.additions),P=E.deletions+E.additions;if(!a.shouldSkip(P,R)){const T=vu(a,E);(T[0]?.[0]??0)>0&&f();for(const[J,O]of T)for(let $e=J;$e<O;$e++){const Zs=u(S+$e,k+$e);if(a.emit(xu({hunkIndex:c,hunk:h,collapsedBefore:f(),collapsedAfter:Zs,diffStyle:e,index:$e,unifiedLineIndex:S,splitLineIndex:k,additionLineIndex:A,deletionLineIndex:v,additionLineNumber:H,deletionLineNumber:L,content:E,isLastContent:V,unifiedCount:P,splitCount:R}),!0))break e}}f(),a.incrementCounts(P,R),S+=P,k+=R,v+=E.deletions,A+=E.additions,L+=E.deletions,H+=E.additions}}if(y!=null){const{collapsedLines:E,fromStart:V,fromEnd:R}=y,P=V+R;if(tt(a,P,e,T=>{const J=T===P-1;return a.emit({hunkIndex:t.hunks.length,hunk:void 0,collapsedBefore:0,collapsedAfter:J?E:0,type:"context-expanded",deletionLine:{lineNumber:L+T,lineIndex:v+T,noEOFCR:!1,unifiedLineIndex:S+T,splitLineIndex:k+T},additionLine:{unifiedLineIndex:S+T,splitLineIndex:k+T,lineIndex:A+T,lineNumber:H+T,noEOFCR:!1}})},void 0,()=>a.shouldBreak()))break e}}}function Su({diff:t,diffStyle:e,startingLine:n,expandedHunks:r,collapsedContextThreshold:s}){return{hunkIndex:0,splitCount:0,unifiedCount:0}}function ku(t,e,n){if(!t.isWindowedHighlight||e<=0)return[0,e];const r=[];function s(l){const a=Math.max(0,t.viewportStart-l),c=Math.min(e,t.viewportEnd-l);c>a&&r.push([a,c])}if(s(t.unifiedCount),s(t.splitCount),r.length===0)return[0,0];let o=r[0][0],i=r[0][1];for(let l=1;l<r.length;l++){const a=r[l];o=Math.min(o,a[0]),i=Math.max(i,a[1])}return[o,i]}function tt(t,e,n,r,s,o){const[i,l]=ku(t,e);i>0&&(t.incrementCounts(i,i),s?.());let a=i;for(;a<e;){if(o?.()===!0)return!0;if(a>=l){t.incrementCounts(e-a,e-a);break}if(t.isInWindow(0,0)){if(r(a)===!0)return!0}else t.incrementCounts(1,1);a++}return!1}function vu(t,e,n){if(!t.isWindowedHighlight)return[[0,Math.max(e.deletions,e.additions)]];const r=[];function s(a,c){if(a+c<=t.viewportStart||a>=t.viewportEnd)return;const u=Math.max(0,t.viewportStart-a),f=Math.min(c,t.viewportEnd-a);return f>u?[u,f]:void 0}function o(a,c){return a}function i(a,c){if(a==null)return;const[u,f]=o(a);f>u&&r.push([u,f])}if(i(s(t.unifiedCount,e.deletions)),i(s(t.unifiedCount+e.deletions,e.additions)),i(s(t.splitCount,e.deletions)),i(s(t.splitCount,e.additions)),r.length===0)return r;r.sort((a,c)=>a[0]-c[0]);const l=[r[0]];for(const[a,c]of r.slice(1)){const u=l[l.length-1];a<=u[1]?u[1]=Math.max(u[1],c):l.push([a,c])}return l}function xu({hunkIndex:t,hunk:e,collapsedAfter:n,collapsedBefore:r,diffStyle:s,index:o,unifiedLineIndex:i,splitLineIndex:l,additionLineIndex:a,deletionLineIndex:c,additionLineNumber:u,deletionLineNumber:f,content:h,isLastContent:p,unifiedCount:d,splitCount:b}){const w=o<h.deletions?i+o:void 0,g=s==="unified"?o>=h.deletions?i+o:void 0:o<h.additions?i+h.deletions+o:void 0,y=s==="unified"?l+(o<h.deletions?o:o-h.deletions):l+o,m=o<h.deletions?c+o:void 0,_=o<h.deletions?f+o:void 0,S=s==="unified"?o>=h.deletions?a+(o-h.deletions):void 0:o<h.additions?a+o:void 0,k=s==="unified"?o>=h.deletions?u+(o-h.deletions):void 0:o<h.additions?u+o:void 0,v=s==="unified"?p&&o===h.deletions-1&&e.noEOFCRDeletions:p&&o===b-1&&e.noEOFCRDeletions,A=s==="unified"?p&&o===d-1&&e.noEOFCRAdditions:p&&o===b-1&&e.noEOFCRAdditions,L=m!=null&&_!=null&&w!=null?{lineNumber:_,lineIndex:m,noEOFCR:v,unifiedLineIndex:w,splitLineIndex:y}:void 0,H=S!=null&&k!=null&&g!=null?{unifiedLineIndex:g,splitLineIndex:y,lineIndex:S,lineNumber:k,noEOFCR:A}:void 0;if(L==null&&H!=null)return{type:"change",hunkIndex:t,hunk:e,collapsedAfter:n,collapsedBefore:r,deletionLine:void 0,additionLine:H};if(L!=null&&H==null)return{type:"change",hunkIndex:t,hunk:e,collapsedAfter:n,collapsedBefore:r,deletionLine:L,additionLine:void 0};if(L==null||H==null)throw new Error("iterateOverDiff: missing change line data");return{type:"change",hunkIndex:t,hunk:e,collapsedAfter:n,collapsedBefore:r,deletionLine:L,additionLine:H}}function wt({line:t,spanStart:e,spanLength:n}){return{start:{line:t,character:e},end:{line:t,character:e+n},properties:{"data-diff-span":""},alwaysWrap:!0}}function nt({item:t,arr:e,enableJoin:n,isNeutral:r=!1,isLastItem:s=!1}){const o=e[e.length-1];if(o==null||s||!n){e.push([r?0:1,t.value]);return}const i=o[0]===0;if(r===i||r&&t.value.length===1&&!i){o[1]+=t.value;return}e.push([r?0:1,t.value])}const Eu={forcePlainText:!1};function Iu(t,e,n,{forcePlainText:r,startingLine:s,totalLines:o,expandedHunks:i,collapsedContextThreshold:l=1}=Eu){r?(s??=0,o??=1/0):(s=0,o=1/0);const a=s>0||o<1/0,c=typeof n.theme=="string"?e.getTheme(n.theme).type:void 0,u=Xs({theme:n.theme,highlighter:e}),f=r&&!a&&(t.unifiedLineCount>1e3||t.splitLineCount>1e3)?"none":n.lineDiffType,h={deletionLines:[],additionLines:[]},{maxLineDiffLength:p}=n,d=!r&&!t.isPartial,b=r?i:void 0,w=new Map;function g(m){const _=d?0:m,S=w.get(_)??Lu();return w.set(_,S),S}function y(m,_,S,k){if(a){let v=S.at(-1);(v==null||v.targetIndex+v.count!==_)&&(v={targetIndex:_,originalOffset:k.length,count:0},S.push(v)),v.count++}k.push(m)}_u({diff:t,diffStyle:"both",startingLine:s,totalLines:o,expandedHunks:a?b:!0,collapsedContextThreshold:l,callback:({hunkIndex:m,additionLine:_,deletionLine:S,type:k})=>{const v=g(m),A=_!=null?_.splitLineIndex:S.splitLineIndex;k==="change"&&_!=null&&S!=null&&Ru({additionLine:t.additionLines[_.lineIndex],deletionLine:t.deletionLines[S.lineIndex],deletionLineIndex:v.deletionContent.length,additionLineIndex:v.additionContent.length,deletionDecorations:v.deletionDecorations,additionDecorations:v.additionDecorations,lineDiffType:f,maxLineDiffLength:p}),S!=null&&(y(t.deletionLines[S.lineIndex],S.lineIndex,v.deletionSegments,v.deletionContent),v.deletionInfo.push({type:k==="change"?"change-deletion":k,lineNumber:S.lineNumber,altLineNumber:k==="change"?void 0:_.lineNumber??void 0,lineIndex:`${S.unifiedLineIndex},${A}`})),_!=null&&(y(t.additionLines[_.lineIndex],_.lineIndex,v.additionSegments,v.additionContent),v.additionInfo.push({type:k==="change"?"change-addition":k,lineNumber:_.lineNumber,altLineNumber:k==="change"?void 0:S.lineNumber??void 0,lineIndex:`${_.unifiedLineIndex},${A}`}))}});for(const m of w.values()){if(m.deletionContent.length===0&&m.additionContent.length===0)continue;const _={name:t.prevName??t.name,contents:m.deletionContent.value},S={name:t.name,contents:m.additionContent.value},{deletionLines:k,additionLines:v}=Nu({deletionFile:_,deletionInfo:m.deletionInfo,deletionDecorations:m.deletionDecorations,additionFile:S,additionInfo:m.additionInfo,additionDecorations:m.additionDecorations,highlighter:e,options:n,languageOverride:r?"text":t.lang});if(d){h.deletionLines=k,h.additionLines=v;continue}if(m.deletionSegments.length>0)for(const A of m.deletionSegments)for(let L=0;L<A.count;L++)h.deletionLines[A.targetIndex+L]=k[A.originalOffset+L];else gn(h.deletionLines,k);if(m.additionSegments.length>0)for(const A of m.additionSegments)for(let L=0;L<A.count;L++)h.additionLines[A.targetIndex+L]=v[A.originalOffset+L];else gn(h.additionLines,v)}return{code:h,themeStyles:u,baseThemeType:c}}function Au(t,{deletionLineIndex:e,additionLineIndex:n,deletionDecorations:r,additionDecorations:s}){let o=0,i=0,l=-1,a=0,c=-1,u=0;for(const{value:f,added:h,removed:p}of t)p?(l===-1&&(l=o),o+=f.length,a=o):h?(c===-1&&(c=i),i+=f.length,u=i):(o+=f.length,i+=f.length);l!==-1&&r.push(wt({line:e,spanStart:l,spanLength:a-l})),c!==-1&&s.push(wt({line:n,spanStart:c,spanLength:u-c}))}function Ru({deletionLine:t,additionLine:e,deletionLineIndex:n,additionLineIndex:r,deletionDecorations:s,additionDecorations:o,lineDiffType:i,maxLineDiffLength:l}){if(t==null||e==null||i==="none"||(t=bt(t),e=bt(e),t.length>l||e.length>l))return;const a=i==="char"?Yc(t,e):tu(t,e);if(i==="word-line"){Au(a,{deletionLineIndex:n,additionLineIndex:r,deletionDecorations:s,additionDecorations:o});return}const c=[],u=[],f=i==="word-alt",h=a.at(-1);for(const d of a){const b=d===h;!d.added&&!d.removed?(nt({item:d,arr:c,enableJoin:f,isNeutral:!0,isLastItem:b}),nt({item:d,arr:u,enableJoin:f,isNeutral:!0,isLastItem:b})):d.removed?nt({item:d,arr:c,enableJoin:f,isLastItem:b}):nt({item:d,arr:u,enableJoin:f,isLastItem:b})}let p=0;for(const d of c)d[0]===1&&s.push(wt({line:n,spanStart:p,spanLength:d[1].length})),p+=d[1].length;p=0;for(const d of u)d[0]===1&&o.push(wt({line:r,spanStart:p,spanLength:d[1].length})),p+=d[1].length}function Lu(){return{deletionContent:{push(t){this.value+=t,this.length++},value:"",length:0},additionContent:{push(t){this.value+=t,this.length++},value:"",length:0},deletionInfo:[],additionInfo:[],deletionDecorations:[],additionDecorations:[],deletionSegments:[],additionSegments:[]}}function Nu({deletionFile:t,additionFile:e,deletionInfo:n,additionInfo:r,highlighter:s,deletionDecorations:o,additionDecorations:i,languageOverride:l,options:{theme:a,...c}}){const u=l??pn(t.name),f=l??pn(e.name),{state:h,transformers:p}=Ks(c.useTokenTransformer),d=typeof a=="string"?{...c,lang:"text",theme:a,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:X("token"),tokenizeTimeLimit:0}:{...c,lang:"text",themes:a,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:X("token"),tokenizeTimeLimit:0};return{deletionLines:t.contents===""?[]:(d.lang=u,h.lineInfo=n,d.decorations=o,mn(s.codeToHast(bt(t.contents),d))),additionLines:e.contents===""?[]:(d.lang=f,d.decorations=i,h.lineInfo=r,mn(s.codeToHast(bt(e.contents),d)))}}const $r=10,Mr=13,Tu=4,Pu=40;function $u(t){const e=[0];let n=t.indexOf("\r"),r=t.indexOf(`
154
154
  `),s=0,o=0;for(;n!==-1||r!==-1;){let i;if(n!==-1&&(r===-1||n<r)?r===n+1?(i=r+1,n=t.indexOf("\r",i),r=t.indexOf(`
155
155
  `,i)):(i=n+1,n=t.indexOf("\r",i)):(i=r+1,r=t.indexOf(`
156
- `,i)),e.push(i),++o===Nu){if(i-s<=Tu){for(let l=i;l<t.length;l++){const a=t.charCodeAt(l);(a===Pr||a===$r)&&(a===$r&&l+1<t.length&&t.charCodeAt(l+1)===Pr&&l++,e.push(l+1))}return e}s=i,o=0}}return e}function $u(t){const e=Pu(t);return Array.from({length:e.length},(n,r)=>{const s=e[r],o=e[r+1]??t.length;return t.slice(s,o)})}const Mu={forcePlainText:!1};function Ou(t,e,{theme:n,tokenizeMaxLineLength:r,useTokenTransformer:s},{forcePlainText:o,startingLine:i,totalLines:l,lines:a}=Mu){o?(i??=0,l??=1/0):(i=0,l=1/0);const c=i>0||l<1/0,{state:u,transformers:f}=qs(s),h=o?"text":t.lang??pn(t.name),p=typeof n=="string"?e.getTheme(n).type:void 0,d=Xs({theme:n,highlighter:e});u.lineInfo=y=>({type:"context",lineIndex:y-1+i,lineNumber:y+i});const b=typeof n=="string"?{lang:h,theme:n,transformers:f,defaultColor:!1,cssVariablePrefix:K("token"),tokenizeMaxLineLength:r,tokenizeTimeLimit:0}:{lang:h,themes:n,transformers:f,defaultColor:!1,cssVariablePrefix:K("token"),tokenizeMaxLineLength:r,tokenizeTimeLimit:0},w=mn(e.codeToHast(Du(c?Bu(a??$u(t.contents),i,l):t.contents),b)),g=c?new Array(i):w;return c&&gn(g,w),{code:g,themeStyles:d,baseThemeType:p}}function Du(t){return t.replace(/\r(?!\n)/g,`
157
- `)}function Bu(t,e,n){if(t.length===0)return"";const r=Math.min(e+n,t.length);return t.slice(e,r).join("")}let Mr,be={theme:Ws,useTokenTransformer:!1,tokenizeMaxLineLength:1e3,lineDiffType:"word-alt",maxLineDiffLength:1e3};self.addEventListener("error",t=>{console.error("[Shiki Worker] Unhandled error:",t.error)});self.addEventListener("message",t=>{Gu(t.data)});async function Gu(t){try{switch(t.type){case"initialize":await Fu(t);break;case"set-render-options":await Uu(t);break;case"file":await ju(t);break;case"diff":await zu(t);break;default:throw new Error(`Unknown request type: ${t.type}`)}}catch(e){console.error("Worker error:",e),Vu(t.id,e)}}async function Fu({id:t,renderOptions:e,preferredHighlighter:n,resolvedThemes:r,resolvedLanguages:s,customExtensionsVersion:o,customExtensionMap:i}){let l=It(n);"then"in l&&(l=await l),Mn({customExtensionsVersion:o,customExtensionMap:i}),Hs(r,l),s!=null&&$n(s,l),be=e,postMessage({type:"success",id:t,requestType:"initialize",sentAt:Date.now()})}async function Uu({id:t,renderOptions:e,resolvedThemes:n}){let r=It();"then"in r&&(r=await r),Hs(n,r),be=e,postMessage({type:"success",id:t,requestType:"set-render-options",sentAt:Date.now()})}async function ju({id:t,file:e,resolvedLanguages:n,customExtensionsVersion:r,customExtensionMap:s}){let o=It();"then"in o&&(o=await o),Mn({customExtensionsVersion:r,customExtensionMap:s}),n!=null&&$n(n,o);const i={theme:be.theme,useTokenTransformer:be.useTokenTransformer,tokenizeMaxLineLength:be.tokenizeMaxLineLength};Wu(t,Ou(e,o,i),i)}async function zu({id:t,diff:e,resolvedLanguages:n,customExtensionsVersion:r,customExtensionMap:s}){let o=It();"then"in o&&(o=await o),Mn({customExtensionsVersion:r,customExtensionMap:s}),n!=null&&$n(n,o),Hu(t,Eu(e,o,be),be)}function It(t="shiki-js"){return Mr??=Fa({themes:[],langs:[],engine:t==="shiki-wasm"?zc(import("./wasm-CG6Dc4jp.js")):Ec()}),Mr}function Mn({customExtensionsVersion:t,customExtensionMap:e}){if(!(t==null&&e==null)){if(t==null||e==null)throw new Error("Worker request must include both customExtensionsVersion and customExtensionMap");cu(t,e)}}function Wu(t,e,n){postMessage({type:"success",requestType:"file",id:t,result:e,options:n,sentAt:Date.now()})}function Hu(t,e,n){postMessage({type:"success",requestType:"diff",id:t,result:e,options:n,sentAt:Date.now()})}function Vu(t,e){const n={type:"error",id:t,error:e instanceof Error?e.message:String(e),stack:e instanceof Error?e.stack:void 0};postMessage(n)}
156
+ `,i)),e.push(i),++o===Tu){if(i-s<=Pu){for(let l=i;l<t.length;l++){const a=t.charCodeAt(l);(a===$r||a===Mr)&&(a===Mr&&l+1<t.length&&t.charCodeAt(l+1)===$r&&l++,e.push(l+1))}return e}s=i,o=0}}return e}function Mu(t){const e=$u(t);return Array.from({length:e.length},(n,r)=>{const s=e[r],o=e[r+1]??t.length;return t.slice(s,o)})}const Ou={forcePlainText:!1};function Du(t,e,{theme:n,tokenizeMaxLineLength:r,useTokenTransformer:s},{forcePlainText:o,startingLine:i,totalLines:l,lines:a}=Ou){o?(i??=0,l??=1/0):(i=0,l=1/0);const c=i>0||l<1/0,{state:u,transformers:f}=Ks(s),h=o?"text":t.lang??pn(t.name),p=typeof n=="string"?e.getTheme(n).type:void 0,d=Xs({theme:n,highlighter:e});u.lineInfo=y=>({type:"context",lineIndex:y-1+i,lineNumber:y+i});const b=typeof n=="string"?{lang:h,theme:n,transformers:f,defaultColor:!1,cssVariablePrefix:X("token"),tokenizeMaxLineLength:r,tokenizeTimeLimit:0}:{lang:h,themes:n,transformers:f,defaultColor:!1,cssVariablePrefix:X("token"),tokenizeMaxLineLength:r,tokenizeTimeLimit:0},w=mn(e.codeToHast(Bu(c?Gu(a??Mu(t.contents),i,l):t.contents),b)),g=c?new Array(i):w;return c&&gn(g,w),{code:g,themeStyles:d,baseThemeType:p}}function Bu(t){return t.replace(/\r(?!\n)/g,`
157
+ `)}function Gu(t,e,n){if(t.length===0)return"";const r=Math.min(e+n,t.length);return t.slice(e,r).join("")}let Or,be={theme:Hs,useTokenTransformer:!1,tokenizeMaxLineLength:1e3,lineDiffType:"word-alt",maxLineDiffLength:1e3};self.addEventListener("error",t=>{console.error("[Shiki Worker] Unhandled error:",t.error)});self.addEventListener("message",t=>{Fu(t.data)});async function Fu(t){try{switch(t.type){case"initialize":await Uu(t);break;case"set-render-options":await ju(t);break;case"file":await zu(t);break;case"diff":await Wu(t);break;default:throw new Error(`Unknown request type: ${t.type}`)}}catch(e){console.error("Worker error:",e),qu(t.id,e)}}async function Uu({id:t,renderOptions:e,preferredHighlighter:n,resolvedThemes:r,resolvedLanguages:s,customExtensionsVersion:o,customExtensionMap:i}){let l=It(n);"then"in l&&(l=await l),Mn({customExtensionsVersion:o,customExtensionMap:i}),Vs(r,l),s!=null&&$n(s,l),be=e,postMessage({type:"success",id:t,requestType:"initialize",sentAt:Date.now()})}async function ju({id:t,renderOptions:e,resolvedThemes:n}){let r=It();"then"in r&&(r=await r),Vs(n,r),be=e,postMessage({type:"success",id:t,requestType:"set-render-options",sentAt:Date.now()})}async function zu({id:t,file:e,resolvedLanguages:n,customExtensionsVersion:r,customExtensionMap:s}){let o=It();"then"in o&&(o=await o),Mn({customExtensionsVersion:r,customExtensionMap:s}),n!=null&&$n(n,o);const i={theme:be.theme,useTokenTransformer:be.useTokenTransformer,tokenizeMaxLineLength:be.tokenizeMaxLineLength};Hu(t,Du(e,o,i),i)}async function Wu({id:t,diff:e,resolvedLanguages:n,customExtensionsVersion:r,customExtensionMap:s}){let o=It();"then"in o&&(o=await o),Mn({customExtensionsVersion:r,customExtensionMap:s}),n!=null&&$n(n,o),Vu(t,Iu(e,o,be),be)}function It(t="shiki-js"){return Or??=Ua({themes:[],langs:[],engine:t==="shiki-wasm"?Wc(import("./wasm-CG6Dc4jp.js")):Ic()}),Or}function Mn({customExtensionsVersion:t,customExtensionMap:e}){if(!(t==null&&e==null)){if(t==null||e==null)throw new Error("Worker request must include both customExtensionsVersion and customExtensionMap");uu(t,e)}}function Hu(t,e,n){postMessage({type:"success",requestType:"file",id:t,result:e,options:n,sentAt:Date.now()})}function Vu(t,e,n){postMessage({type:"success",requestType:"diff",id:t,result:e,options:n,sentAt:Date.now()})}function qu(t,e){const n={type:"error",id:t,error:e instanceof Error?e.message:String(e),stack:e instanceof Error?e.stack:void 0};postMessage(n)}