@prismshadow/penguin-server 0.2.2 → 0.2.4

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 (302) hide show
  1. package/README.md +3 -0
  2. package/dist/api/types.d.ts +552 -49
  3. package/dist/chunk-KQQ3HSTK.js +568 -0
  4. package/dist/chunk-KQQ3HSTK.js.map +1 -0
  5. package/dist/hmr/manifest.d.ts +54 -0
  6. package/dist/hmr/manifest.js +27 -0
  7. package/dist/hmr/manifest.js.map +1 -0
  8. package/dist/index.js +4495 -1041
  9. package/dist/index.js.map +1 -1
  10. package/dist/reset-admin-password.d.ts +28 -0
  11. package/dist/reset-admin-password.js +39 -0
  12. package/dist/reset-admin-password.js.map +1 -0
  13. package/package.json +15 -3
  14. package/web-dist/assets/addon-fit-ClUHZ6NU.js +1 -0
  15. package/web-dist/assets/addon-web-links-BKMSMMvN.js +1 -0
  16. package/web-dist/assets/cpp-DIPi6g--.js +1 -0
  17. package/web-dist/assets/highlighter-Cp5vYdaX.js +152 -0
  18. package/web-dist/assets/index-BJNmFD1m.js +187 -0
  19. package/web-dist/assets/index-BneOZQwC.css +1 -0
  20. package/web-dist/assets/ruby-B13GW9FM.js +1 -0
  21. package/web-dist/assets/xterm-j28bzvOQ.js +9 -0
  22. package/web-dist/index.html +2 -2
  23. package/web-dist/assets/abap-BdImnpbu.js +0 -1
  24. package/web-dist/assets/actionscript-3-CoDkCxhg.js +0 -1
  25. package/web-dist/assets/ada-bCR0ucgS.js +0 -1
  26. package/web-dist/assets/andromeeda-C4gqWexZ.js +0 -1
  27. package/web-dist/assets/angular-html-DA-rfuFy.js +0 -1
  28. package/web-dist/assets/angular-ts-BrjP3tb8.js +0 -1
  29. package/web-dist/assets/apache-Pmp26Uib.js +0 -1
  30. package/web-dist/assets/apex-Dqspr-GT.js +0 -1
  31. package/web-dist/assets/apl-CORt7UWP.js +0 -1
  32. package/web-dist/assets/applescript-Co6uUVPk.js +0 -1
  33. package/web-dist/assets/ara-BRHolxvo.js +0 -1
  34. package/web-dist/assets/asciidoc-Ve4PFQV2.js +0 -1
  35. package/web-dist/assets/asm-D_Q5rh1f.js +0 -1
  36. package/web-dist/assets/astro-HNnZUWAn.js +0 -1
  37. package/web-dist/assets/aurora-x-D-2ljcwZ.js +0 -1
  38. package/web-dist/assets/awk-DMzUqQB5.js +0 -1
  39. package/web-dist/assets/ayu-dark-DYE7WIF3.js +0 -1
  40. package/web-dist/assets/ayu-light-BA47KaF1.js +0 -1
  41. package/web-dist/assets/ayu-mirage-32ctXXKs.js +0 -1
  42. package/web-dist/assets/ballerina-BFfxhgS-.js +0 -1
  43. package/web-dist/assets/bat-BkioyH1T.js +0 -1
  44. package/web-dist/assets/beancount-k_qm7-4y.js +0 -1
  45. package/web-dist/assets/berry-uYugtg8r.js +0 -1
  46. package/web-dist/assets/bibtex-CHM0blh-.js +0 -1
  47. package/web-dist/assets/bicep-Bmn6On1c.js +0 -1
  48. package/web-dist/assets/bird2-BIv1doCn.js +0 -1
  49. package/web-dist/assets/blade-2xfisSek.js +0 -1
  50. package/web-dist/assets/bsl-BO_Y6i37.js +0 -1
  51. package/web-dist/assets/c3-MRO5bC_T.js +0 -1
  52. package/web-dist/assets/cadence-Bv_4Rxtq.js +0 -1
  53. package/web-dist/assets/cairo-KRGpt6FW.js +0 -1
  54. package/web-dist/assets/catppuccin-frappe-DFWUc33u.js +0 -1
  55. package/web-dist/assets/catppuccin-latte-C9dUb6Cb.js +0 -1
  56. package/web-dist/assets/catppuccin-macchiato-DQyhUUbL.js +0 -1
  57. package/web-dist/assets/catppuccin-mocha-D87Tk5Gz.js +0 -1
  58. package/web-dist/assets/clarity-D53aC0YG.js +0 -1
  59. package/web-dist/assets/clojure-P80f7IUj.js +0 -1
  60. package/web-dist/assets/cmake-D1j8_8rp.js +0 -1
  61. package/web-dist/assets/cobol-nBiQ_Alo.js +0 -1
  62. package/web-dist/assets/codeowners-Bp6g37R7.js +0 -1
  63. package/web-dist/assets/codeql-DsOJ9woJ.js +0 -1
  64. package/web-dist/assets/coffee-Ch7k5sss.js +0 -1
  65. package/web-dist/assets/common-lisp-Cg-RD9OK.js +0 -1
  66. package/web-dist/assets/coq-DkFqJrB1.js +0 -1
  67. package/web-dist/assets/cpp-UfJy6YNI.js +0 -1
  68. package/web-dist/assets/crystal-DGywbUpC.js +0 -1
  69. package/web-dist/assets/csharp-DSvCPggb.js +0 -1
  70. package/web-dist/assets/csv-fuZLfV_i.js +0 -1
  71. package/web-dist/assets/cue-D82EKSYY.js +0 -1
  72. package/web-dist/assets/cypher-COkxafJQ.js +0 -1
  73. package/web-dist/assets/d-85-TOEBH.js +0 -1
  74. package/web-dist/assets/dark-plus-C3mMm8J8.js +0 -1
  75. package/web-dist/assets/dart-bE4Kk8sk.js +0 -1
  76. package/web-dist/assets/dax-CEL-wOlO.js +0 -1
  77. package/web-dist/assets/desktop-BmXAJ9_W.js +0 -1
  78. package/web-dist/assets/docker-BcOcwvcX.js +0 -1
  79. package/web-dist/assets/dotenv-Da5cRb03.js +0 -1
  80. package/web-dist/assets/dracula-BzJJZx-M.js +0 -1
  81. package/web-dist/assets/dracula-soft-BXkSAIEj.js +0 -1
  82. package/web-dist/assets/dream-maker-BtqSS_iP.js +0 -1
  83. package/web-dist/assets/edge-FbVlp4U3.js +0 -1
  84. package/web-dist/assets/elixir-CkH2-t6x.js +0 -1
  85. package/web-dist/assets/elm-DbKCFpqz.js +0 -1
  86. package/web-dist/assets/emacs-lisp-CXvaQtF9.js +0 -1
  87. package/web-dist/assets/erb-Dm6A9KJ5.js +0 -1
  88. package/web-dist/assets/erlang-DsQrWhSR.js +0 -1
  89. package/web-dist/assets/everforest-dark-BgDCqdQA.js +0 -1
  90. package/web-dist/assets/everforest-light-C8M2exoo.js +0 -1
  91. package/web-dist/assets/fennel-BYunw83y.js +0 -1
  92. package/web-dist/assets/fish-BvzEVeQv.js +0 -1
  93. package/web-dist/assets/fluent-C4IJs8-o.js +0 -1
  94. package/web-dist/assets/fortran-fixed-form-CkoXwp7k.js +0 -1
  95. package/web-dist/assets/fortran-free-form-BxgE0vQu.js +0 -1
  96. package/web-dist/assets/fsharp-CXgrBDvD.js +0 -1
  97. package/web-dist/assets/gdresource-BOOCDP_w.js +0 -1
  98. package/web-dist/assets/gdscript-C5YyOfLZ.js +0 -1
  99. package/web-dist/assets/gdshader-DkwncUOv.js +0 -1
  100. package/web-dist/assets/genie-D0YGMca9.js +0 -1
  101. package/web-dist/assets/gherkin-DyxjwDmM.js +0 -1
  102. package/web-dist/assets/git-commit-F4YmCXRG.js +0 -1
  103. package/web-dist/assets/git-rebase-r7XF79zn.js +0 -1
  104. package/web-dist/assets/github-dark-default-Cuk6v7N8.js +0 -1
  105. package/web-dist/assets/github-dark-dimmed-DH5Ifo-i.js +0 -1
  106. package/web-dist/assets/github-dark-high-contrast-E3gJ1_iC.js +0 -1
  107. package/web-dist/assets/github-light-default-D7oLnXFd.js +0 -1
  108. package/web-dist/assets/github-light-high-contrast-BfjtVDDH.js +0 -1
  109. package/web-dist/assets/gleam-BspZqrRM.js +0 -1
  110. package/web-dist/assets/glimmer-js-ByusRIyA.js +0 -1
  111. package/web-dist/assets/glimmer-ts-BfAWNZQY.js +0 -1
  112. package/web-dist/assets/glsl-DplSGwfg.js +0 -1
  113. package/web-dist/assets/gn-n2N0HUVH.js +0 -1
  114. package/web-dist/assets/gnuplot-DdkO51Og.js +0 -1
  115. package/web-dist/assets/graphql-ChdNCCLP.js +0 -1
  116. package/web-dist/assets/groovy-gcz8RCvz.js +0 -1
  117. package/web-dist/assets/gruvbox-dark-hard-CFHQjOhq.js +0 -1
  118. package/web-dist/assets/gruvbox-dark-medium-GsRaNv29.js +0 -1
  119. package/web-dist/assets/gruvbox-dark-soft-CVdnzihN.js +0 -1
  120. package/web-dist/assets/gruvbox-light-hard-CH1njM8p.js +0 -1
  121. package/web-dist/assets/gruvbox-light-medium-DRw_LuNl.js +0 -1
  122. package/web-dist/assets/gruvbox-light-soft-hJgmCMqR.js +0 -1
  123. package/web-dist/assets/hack-DbPARsA_.js +0 -1
  124. package/web-dist/assets/haml-D5jkg6IW.js +0 -1
  125. package/web-dist/assets/handlebars-BpdQsYii.js +0 -1
  126. package/web-dist/assets/haskell-Df6bDoY_.js +0 -1
  127. package/web-dist/assets/haxe-CzTSHFRz.js +0 -1
  128. package/web-dist/assets/hcl-BWvSN4gD.js +0 -1
  129. package/web-dist/assets/hjson-D5-asLiD.js +0 -1
  130. package/web-dist/assets/hlsl-D3lLCCz7.js +0 -1
  131. package/web-dist/assets/horizon-BUw7H-hv.js +0 -1
  132. package/web-dist/assets/horizon-bright-CUuTKBJd.js +0 -1
  133. package/web-dist/assets/houston-DnULxvSX.js +0 -1
  134. package/web-dist/assets/html-derivative-DlHx6ybY.js +0 -1
  135. package/web-dist/assets/http-jrhK8wxY.js +0 -1
  136. package/web-dist/assets/hurl-irOxFIW8.js +0 -1
  137. package/web-dist/assets/hxml-Bvhsp5Yf.js +0 -1
  138. package/web-dist/assets/hy-DFXneXwc.js +0 -1
  139. package/web-dist/assets/imba-DGztddWO.js +0 -1
  140. package/web-dist/assets/index-B3puu-Hr.js +0 -153
  141. package/web-dist/assets/index-CaDuyrN0.css +0 -1
  142. package/web-dist/assets/index-rgHg3m6g.js +0 -181
  143. package/web-dist/assets/jinja-f2NsQr07.js +0 -1
  144. package/web-dist/assets/jison-wvAkD_A8.js +0 -1
  145. package/web-dist/assets/json5-C9tS-k6U.js +0 -1
  146. package/web-dist/assets/jsonc-Des-eS-w.js +0 -1
  147. package/web-dist/assets/jsonl-DcaNXYhu.js +0 -1
  148. package/web-dist/assets/jsonnet-DFQXde-d.js +0 -1
  149. package/web-dist/assets/jssm-C2t-YnRu.js +0 -1
  150. package/web-dist/assets/julia-D7OTSIA_.js +0 -1
  151. package/web-dist/assets/just-CUsbIsdP.js +0 -1
  152. package/web-dist/assets/kanagawa-dragon-CkXjmgJE.js +0 -1
  153. package/web-dist/assets/kanagawa-lotus-CfQXZHmo.js +0 -1
  154. package/web-dist/assets/kanagawa-wave-DWedfzmr.js +0 -1
  155. package/web-dist/assets/kdl-DV7GczEv.js +0 -1
  156. package/web-dist/assets/kotlin-BdnUsdx6.js +0 -1
  157. package/web-dist/assets/kusto-wEQ09or8.js +0 -1
  158. package/web-dist/assets/laserwave-DUszq2jm.js +0 -1
  159. package/web-dist/assets/latex-CaSxy8MP.js +0 -1
  160. package/web-dist/assets/lean-BZvkOJ9d.js +0 -1
  161. package/web-dist/assets/less-B1dDrJ26.js +0 -1
  162. package/web-dist/assets/light-plus-B7mTdjB0.js +0 -1
  163. package/web-dist/assets/liquid-C0sCDyMI.js +0 -1
  164. package/web-dist/assets/llvm-DjAJT7YJ.js +0 -1
  165. package/web-dist/assets/logo-BtOb2qkB.js +0 -1
  166. package/web-dist/assets/lua-BaeVxFsk.js +0 -1
  167. package/web-dist/assets/luau-KW6xsasC.js +0 -1
  168. package/web-dist/assets/make-CHLpvVh8.js +0 -1
  169. package/web-dist/assets/marko-DjSrsDqO.js +0 -1
  170. package/web-dist/assets/material-theme-D5KoaKCx.js +0 -1
  171. package/web-dist/assets/material-theme-darker-BfHTSMKl.js +0 -1
  172. package/web-dist/assets/material-theme-lighter-B0m2ddpp.js +0 -1
  173. package/web-dist/assets/material-theme-ocean-CyktbL80.js +0 -1
  174. package/web-dist/assets/material-theme-palenight-Csfq5Kiy.js +0 -1
  175. package/web-dist/assets/matlab-D7o27uSR.js +0 -1
  176. package/web-dist/assets/mdc-DTYItulj.js +0 -1
  177. package/web-dist/assets/mdx-Cmh6b_Ma.js +0 -1
  178. package/web-dist/assets/mermaid-mWjccvbQ.js +0 -1
  179. package/web-dist/assets/min-dark-CafNBF8u.js +0 -1
  180. package/web-dist/assets/min-light-CTRr51gU.js +0 -1
  181. package/web-dist/assets/mipsasm-CKIfxQSi.js +0 -1
  182. package/web-dist/assets/mojo-rZm6bMo-.js +0 -1
  183. package/web-dist/assets/monokai-D4h5O-jR.js +0 -1
  184. package/web-dist/assets/moonbit-_H4v1dQx.js +0 -1
  185. package/web-dist/assets/move-IF9eRakj.js +0 -1
  186. package/web-dist/assets/narrat-DRg8JJMk.js +0 -1
  187. package/web-dist/assets/nextflow-C-mBbutL.js +0 -1
  188. package/web-dist/assets/nextflow-groovy-vE_lwT2v.js +0 -1
  189. package/web-dist/assets/nginx-BpAMiNFr.js +0 -1
  190. package/web-dist/assets/night-owl-C39BiMTA.js +0 -1
  191. package/web-dist/assets/night-owl-light-CMTm3GFP.js +0 -1
  192. package/web-dist/assets/nim-BIad80T-.js +0 -1
  193. package/web-dist/assets/nix-CwoSXNpI.js +0 -1
  194. package/web-dist/assets/nord-Ddv68eIx.js +0 -1
  195. package/web-dist/assets/nushell-Cz2AlsmD.js +0 -1
  196. package/web-dist/assets/objective-c-DXmwc3jG.js +0 -1
  197. package/web-dist/assets/objective-cpp-CLxacb5B.js +0 -1
  198. package/web-dist/assets/ocaml-C0hk2d4L.js +0 -1
  199. package/web-dist/assets/odin-BBf5iR-q.js +0 -1
  200. package/web-dist/assets/one-dark-pro-DVMEJ2y_.js +0 -1
  201. package/web-dist/assets/one-light-C3Wv6jpd.js +0 -1
  202. package/web-dist/assets/openscad-C4EeE6gA.js +0 -1
  203. package/web-dist/assets/pascal-D93ZcfNL.js +0 -1
  204. package/web-dist/assets/perl-B9cMNwum.js +0 -1
  205. package/web-dist/assets/pkl-u5AG7uiY.js +0 -1
  206. package/web-dist/assets/plastic-3e1v2bzS.js +0 -1
  207. package/web-dist/assets/plsql-ChMvpjG-.js +0 -1
  208. package/web-dist/assets/po-BTJTHyun.js +0 -1
  209. package/web-dist/assets/poimandres-CS3Unz2-.js +0 -1
  210. package/web-dist/assets/polar-C0HS_06l.js +0 -1
  211. package/web-dist/assets/postcss-CXtECtnM.js +0 -1
  212. package/web-dist/assets/powerquery-CEu0bR-o.js +0 -1
  213. package/web-dist/assets/powershell-Dpen1YoG.js +0 -1
  214. package/web-dist/assets/prisma-Dd19v3D-.js +0 -1
  215. package/web-dist/assets/prolog-CbFg5uaA.js +0 -1
  216. package/web-dist/assets/proto-C7zT0LnQ.js +0 -1
  217. package/web-dist/assets/pug-DKIMFp6K.js +0 -1
  218. package/web-dist/assets/puppet-BMWR74SV.js +0 -1
  219. package/web-dist/assets/purescript-CklMAg4u.js +0 -1
  220. package/web-dist/assets/qml-3beO22l8.js +0 -1
  221. package/web-dist/assets/qmldir-C8lEn-DE.js +0 -1
  222. package/web-dist/assets/qss-IeuSbFQv.js +0 -1
  223. package/web-dist/assets/r-Dspwwk_N.js +0 -1
  224. package/web-dist/assets/racket-BqYA7rlc.js +0 -1
  225. package/web-dist/assets/raku-DXvB9xmW.js +0 -1
  226. package/web-dist/assets/razor-BjBPvh-w.js +0 -1
  227. package/web-dist/assets/red-bN70gL4F.js +0 -1
  228. package/web-dist/assets/reg-C-SQnVFl.js +0 -1
  229. package/web-dist/assets/regexp-CDVJQ6XC.js +0 -1
  230. package/web-dist/assets/rel-C3B-1QV4.js +0 -1
  231. package/web-dist/assets/riscv-BM1_JUlF.js +0 -1
  232. package/web-dist/assets/ron-D8l8udqQ.js +0 -1
  233. package/web-dist/assets/rose-pine-dawn-DHQR4-dF.js +0 -1
  234. package/web-dist/assets/rose-pine-moon-D4_iv3hh.js +0 -1
  235. package/web-dist/assets/rose-pine-qdsjHGoJ.js +0 -1
  236. package/web-dist/assets/rosmsg-BJDFO7_C.js +0 -1
  237. package/web-dist/assets/rst-CpCqk9r5.js +0 -1
  238. package/web-dist/assets/ruby-DyJCeAvU.js +0 -1
  239. package/web-dist/assets/sas-DEy46yEz.js +0 -1
  240. package/web-dist/assets/sass-Cj5Yp3dK.js +0 -1
  241. package/web-dist/assets/scala-C151Ov-r.js +0 -1
  242. package/web-dist/assets/scheme-C98Dy4si.js +0 -1
  243. package/web-dist/assets/scss-D5BDwBP9.js +0 -1
  244. package/web-dist/assets/sdbl-DVxCFoDh.js +0 -1
  245. package/web-dist/assets/shaderlab-Dg9Lc6iA.js +0 -1
  246. package/web-dist/assets/shellsession-BADoaaVG.js +0 -1
  247. package/web-dist/assets/slack-dark-BthQWCQV.js +0 -1
  248. package/web-dist/assets/slack-ochin-DqwNpetd.js +0 -1
  249. package/web-dist/assets/smalltalk-BERRCDM3.js +0 -1
  250. package/web-dist/assets/snazzy-light-Bw305WKR.js +0 -1
  251. package/web-dist/assets/solarized-dark-DXbdFlpD.js +0 -1
  252. package/web-dist/assets/solarized-light-L9t79GZl.js +0 -1
  253. package/web-dist/assets/solidity-rGO070M0.js +0 -1
  254. package/web-dist/assets/soy-8wufbnw4.js +0 -1
  255. package/web-dist/assets/sparql-rVzFXLq3.js +0 -1
  256. package/web-dist/assets/splunk-BtCnVYZw.js +0 -1
  257. package/web-dist/assets/ssh-config-_ykCGR6B.js +0 -1
  258. package/web-dist/assets/stata-DI20mbqo.js +0 -1
  259. package/web-dist/assets/stylus-BEDo0Tqx.js +0 -1
  260. package/web-dist/assets/surrealql-Bq5Q-fJD.js +0 -1
  261. package/web-dist/assets/svelte-Cy7k_4gC.js +0 -1
  262. package/web-dist/assets/swift-D82vCrfD.js +0 -1
  263. package/web-dist/assets/synthwave-84-CbfX1IO0.js +0 -1
  264. package/web-dist/assets/system-verilog-CnnmHF94.js +0 -1
  265. package/web-dist/assets/systemd-4A_iFExJ.js +0 -1
  266. package/web-dist/assets/talonscript-CkByrt1z.js +0 -1
  267. package/web-dist/assets/tasl-QIJgUcNo.js +0 -1
  268. package/web-dist/assets/tcl-dwOrl1Do.js +0 -1
  269. package/web-dist/assets/templ-DhtptRzy.js +0 -1
  270. package/web-dist/assets/terraform-BETggiCN.js +0 -1
  271. package/web-dist/assets/tex-idrVyKtj.js +0 -1
  272. package/web-dist/assets/tokyo-night-hegEt444.js +0 -1
  273. package/web-dist/assets/ts-tags-D351s5mN.js +0 -1
  274. package/web-dist/assets/tsv-B_m7g4N7.js +0 -1
  275. package/web-dist/assets/turtle-BsS91CYL.js +0 -1
  276. package/web-dist/assets/twig-CW1WmMYd.js +0 -1
  277. package/web-dist/assets/typespec-CAFt9gP4.js +0 -1
  278. package/web-dist/assets/typst-DHCkPAjA.js +0 -1
  279. package/web-dist/assets/v-BcVCzyr7.js +0 -1
  280. package/web-dist/assets/vala-CsfeWuGM.js +0 -1
  281. package/web-dist/assets/vb-D17OF-Vu.js +0 -1
  282. package/web-dist/assets/verilog-BQ8w6xss.js +0 -1
  283. package/web-dist/assets/vesper-DRje8inN.js +0 -1
  284. package/web-dist/assets/vhdl-CeAyd5Ju.js +0 -1
  285. package/web-dist/assets/viml-CJc9bBzg.js +0 -1
  286. package/web-dist/assets/vitesse-black-Bkuqu6BP.js +0 -1
  287. package/web-dist/assets/vitesse-dark-D0r3Knsf.js +0 -1
  288. package/web-dist/assets/vitesse-light-CVO1_9PV.js +0 -1
  289. package/web-dist/assets/vue-D2xRrEX4.js +0 -1
  290. package/web-dist/assets/vue-html-AaS7Mt5G.js +0 -1
  291. package/web-dist/assets/vue-vine-BoDAl6tE.js +0 -1
  292. package/web-dist/assets/vyper-CDx5xZoG.js +0 -1
  293. package/web-dist/assets/wasm-CG6Dc4jp.js +0 -1
  294. package/web-dist/assets/wasm-MzD3tlZU.js +0 -1
  295. package/web-dist/assets/wenyan-BV7otONQ.js +0 -1
  296. package/web-dist/assets/wgsl-Dx-B1_4e.js +0 -1
  297. package/web-dist/assets/wikitext-BhOHFoWU.js +0 -1
  298. package/web-dist/assets/wit-5i3qLPDT.js +0 -1
  299. package/web-dist/assets/wolfram-lXgVvXCa.js +0 -1
  300. package/web-dist/assets/xsl-CtQFsRM5.js +0 -1
  301. package/web-dist/assets/zenscript-DVFEvuxE.js +0 -1
  302. package/web-dist/assets/zig-VOosw3JB.js +0 -1
@@ -0,0 +1,152 @@
1
+ import{w as vt,s as Nn,f as $r,a as Lr,b as Pr,c as Dt,h as Tr,r as Gr,i as Mr,L as Or,_ as jt}from"./index-BJNmFD1m.js";const Ut={}.hasOwnProperty;function Br(e,t){const n=t||{};function r(s,...o){let i=r.invalid;const a=r.handlers;if(s&&Ut.call(s,e)){const c=String(s[e]);i=Ut.call(a,c)?a[c]:r.unknown}if(i)return i.call(this,s,...o)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}var k=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function Fr(e){return Nt(e)}function Nt(e){return Array.isArray(e)?Dr(e):e instanceof RegExp?e:typeof e=="object"?jr(e):e}function Dr(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=Nt(e[n]);return t}function jr(e){let t={};for(let n in e)t[n]=Nt(e[n]);return t}function Rn(e,...t){return t.forEach(n=>{for(let r in n)e[r]=n[r]}),e}function $n(e){const t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");return t===0?e:~t===e.length-1?$n(e.substring(0,e.length-1)):e.substr(~t+1)}var Je=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,we=class{static hasCaptures(e){return e===null?!1:(Je.lastIndex=0,Je.test(e))}static replaceCaptures(e,t,n){return e.replace(Je,(r,s,o,i)=>{let a=n[parseInt(s||o,10)];if(a){let c=t.substring(a.start,a.end);for(;c[0]===".";)c=c.substring(1);switch(i){case"downcase":return c.toLowerCase();case"upcase":return c.toUpperCase();default:return c}}else return r})}};function Ln(e,t){return e<t?-1:e>t?1:0}function Pn(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let s=0;s<n;s++){let o=Ln(e[s],t[s]);if(o!==0)return o}return 0}return n-r}function Wt(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function Tn(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var Gn=class{constructor(e){this.fn=e}cache=new Map;get(e){if(this.cache.has(e))return this.cache.get(e);const t=this.fn(e);return this.cache.set(e,t),t}},Ne=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(zr(e),t)}static createFromParsedTheme(e,t){return qr(e,t)}_cachedMatchRoot=new Gn(e=>this._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;const t=e.scopeName,r=this._cachedMatchRoot.get(t).find(s=>Ur(e.parent,s.parentScopes));return r?new Mn(r.fontStyle,r.foreground,r.background):null}},Ye=class Ee{constructor(t,n){this.parent=t,this.scopeName=n}static push(t,n){for(const r of n)t=new Ee(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new Ee(n,t[r]);return n}push(t){return new Ee(this,t)}getSegments(){let t=this;const n=[];for(;t;)n.push(t.scopeName),t=t.parent;return n.reverse(),n}toString(){return this.getSegments().join(" ")}extends(t){return this===t?!0:this.parent===null?!1:this.parent.extends(t)}getExtensionIfDefined(t){const n=[];let r=this;for(;r&&r!==t;)n.push(r.scopeName),r=r.parent;return r===t?n.reverse():void 0}};function Ur(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let r=t[n],s=!1;if(r===">"){if(n===t.length-1)return!1;r=t[++n],s=!0}for(;e&&!Wr(e.scopeName,r);){if(s)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function Wr(e,t){return t===e||e.startsWith(t)&&e[t.length]==="."}var Mn=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function zr(e){if(!e)return[];if(!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let s=0,o=t.length;s<o;s++){let i=t[s];if(!i.settings)continue;let a;if(typeof i.scope=="string"){let h=i.scope;h=h.replace(/^[,]+/,""),h=h.replace(/[,]+$/,""),a=h.split(",")}else Array.isArray(i.scope)?a=i.scope:a=[""];let c=-1;if(typeof i.settings.fontStyle=="string"){c=0;let h=i.settings.fontStyle.split(" ");for(let f=0,d=h.length;f<d;f++)switch(h[f]){case"italic":c=c|1;break;case"bold":c=c|2;break;case"underline":c=c|4;break;case"strikethrough":c=c|8;break}}let l=null;typeof i.settings.foreground=="string"&&Wt(i.settings.foreground)&&(l=i.settings.foreground);let u=null;typeof i.settings.background=="string"&&Wt(i.settings.background)&&(u=i.settings.background);for(let h=0,f=a.length;h<f;h++){let p=a[h].trim().split(" "),y=p[p.length-1],b=null;p.length>1&&(b=p.slice(0,p.length-1),b.reverse()),n[r++]=new Hr(y,b,s,c,l,u)}}return n}var Hr=class{constructor(e,t,n,r,s,o){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=s,this.background=o}},R=(e=>(e[e.NotSet=-1]="NotSet",e[e.None=0]="None",e[e.Italic=1]="Italic",e[e.Bold=2]="Bold",e[e.Underline=4]="Underline",e[e.Strikethrough=8]="Strikethrough",e))(R||{});function qr(e,t){e.sort((c,l)=>{let u=Ln(c.scope,l.scope);return u!==0||(u=Pn(c.parentScopes,l.parentScopes),u!==0)?u:c.index-l.index});let n=0,r="#000000",s="#ffffff";for(;e.length>=1&&e[0].scope==="";){let c=e.shift();c.fontStyle!==-1&&(n=c.fontStyle),c.foreground!==null&&(r=c.foreground),c.background!==null&&(s=c.background)}let o=new Vr(t),i=new Mn(n,o.getId(r),o.getId(s)),a=new Qr(new ft(0,null,-1,0,0),[]);for(let c=0,l=e.length;c<l;c++){let u=e[c];a.insert(0,u.scope,u.parentScopes,u.fontStyle,o.getId(u.foreground),o.getId(u.background))}return new Ne(o,i,a)}var Vr=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(e){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(e===null)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw new Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},Xr=Object.freeze([]),ft=class On{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(t,n,r,s,o){this.scopeDepth=t,this.parentScopes=n||Xr,this.fontStyle=r,this.foreground=s,this.background=o}clone(){return new On(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(t){let n=[];for(let r=0,s=t.length;r<s;r++)n[r]=t[r].clone();return n}acceptOverwrite(t,n,r,s){this.scopeDepth>t?console.log("how did this happen?"):this.scopeDepth=t,n!==-1&&(this.fontStyle=n),r!==0&&(this.foreground=r),s!==0&&(this.background=s)}},Qr=class dt{constructor(t,n=[],r={}){this._mainRule=t,this._children=r,this._rulesWithParentScopes=n}_rulesWithParentScopes;static _cmpBySpecificity(t,n){if(t.scopeDepth!==n.scopeDepth)return n.scopeDepth-t.scopeDepth;let r=0,s=0;for(;t.parentScopes[r]===">"&&r++,n.parentScopes[s]===">"&&s++,!(r>=t.parentScopes.length||s>=n.parentScopes.length);){const o=n.parentScopes[s].length-t.parentScopes[r].length;if(o!==0)return o;r++,s++}return n.parentScopes.length-t.parentScopes.length}match(t){if(t!==""){let r=t.indexOf("."),s,o;if(r===-1?(s=t,o=""):(s=t.substring(0,r),o=t.substring(r+1)),this._children.hasOwnProperty(s))return this._children[s].match(o)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(dt._cmpBySpecificity),n}insert(t,n,r,s,o,i){if(n===""){this._doInsertHere(t,r,s,o,i);return}let a=n.indexOf("."),c,l;a===-1?(c=n,l=""):(c=n.substring(0,a),l=n.substring(a+1));let u;this._children.hasOwnProperty(c)?u=this._children[c]:(u=new dt(this._mainRule.clone(),ft.cloneArr(this._rulesWithParentScopes)),this._children[c]=u),u.insert(t+1,l,r,s,o,i)}_doInsertHere(t,n,r,s,o){if(n===null){this._mainRule.acceptOverwrite(t,r,s,o);return}for(let i=0,a=this._rulesWithParentScopes.length;i<a;i++){let c=this._rulesWithParentScopes[i];if(Pn(c.parentScopes,n)===0){c.acceptOverwrite(t,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 ft(t,n,r,s,o))}},J=class L{static toBinaryStr(t){return t.toString(2).padStart(32,"0")}static print(t){const n=L.getLanguageId(t),r=L.getTokenType(t),s=L.getFontStyle(t),o=L.getForeground(t),i=L.getBackground(t);console.log({languageId:n,tokenType:r,fontStyle:s,foreground:o,background:i})}static getLanguageId(t){return(t&255)>>>0}static getTokenType(t){return(t&768)>>>8}static containsBalancedBrackets(t){return(t&1024)!==0}static getFontStyle(t){return(t&30720)>>>11}static getForeground(t){return(t&16744448)>>>15}static getBackground(t){return(t&4278190080)>>>24}static set(t,n,r,s,o,i,a){let c=L.getLanguageId(t),l=L.getTokenType(t),u=L.containsBalancedBrackets(t)?1:0,h=L.getFontStyle(t),f=L.getForeground(t),d=L.getBackground(t);return n!==0&&(c=n),r!==8&&(l=r),s!==null&&(u=s?1:0),o!==-1&&(h=o),i!==0&&(f=i),a!==0&&(d=a),(c<<0|l<<8|u<<10|h<<11|f<<15|d<<24)>>>0}};function Re(e,t){const n=[],r=Kr(e);let s=r.next();for(;s!==null;){let c=0;if(s.length===2&&s.charAt(1)===":"){switch(s.charAt(0)){case"R":c=1;break;case"L":c=-1;break;default:console.log(`Unknown priority ${s} in scope selector`)}s=r.next()}let l=i();if(n.push({matcher:l,priority:c}),s!==",")break;s=r.next()}return n;function o(){if(s==="-"){s=r.next();const c=o();return l=>!!c&&!c(l)}if(s==="("){s=r.next();const c=a();return s===")"&&(s=r.next()),c}if(zt(s)){const c=[];do c.push(s),s=r.next();while(zt(s));return l=>t(c,l)}return null}function i(){const c=[];let l=o();for(;l;)c.push(l),l=o();return u=>c.every(h=>h(u))}function a(){const c=[];let l=i();for(;l&&(c.push(l),s==="|"||s===",");){do s=r.next();while(s==="|"||s===",");l=i()}return u=>c.some(h=>h(u))}}function zt(e){return!!e&&!!e.match(/[\w\.:]+/)}function Kr(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;const r=n[0];return n=t.exec(e),r}}}function Bn(e){typeof e.dispose=="function"&&e.dispose()}var de=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},Zr=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},Jr=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(e){const t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},Yr=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new de(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){const e=this.Q;this.Q=[];const t=new Jr;for(const n of e)es(n,this.initialScopeName,this.repo,t);for(const n of t.references)if(n instanceof de){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 es(e,t,n,r){const s=n.lookup(e.scopeName);if(!s){if(e.scopeName===t)throw new Error(`No grammar provided for <${t}>`);return}const o=n.lookup(t);e instanceof de?Ie({baseGrammar:o,selfGrammar:s},r):pt(e.ruleName,{baseGrammar:o,selfGrammar:s,repository:s.repository},r);const i=n.injections(e.scopeName);if(i)for(const a of i)r.add(new de(a))}function pt(e,t,n){if(t.repository&&t.repository[e]){const r=t.repository[e];$e([r],t,n)}}function Ie(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&$e(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&$e(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function $e(e,t,n){for(const r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);const s=r.repository?Rn({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&$e(r.patterns,{...t,repository:s},n);const o=r.include;if(!o)continue;const i=Fn(o);switch(i.kind){case 0:Ie({...t,selfGrammar:t.baseGrammar},n);break;case 1:Ie(t,n);break;case 2:pt(i.ruleName,{...t,repository:s},n);break;case 3:case 4:const a=i.scopeName===t.selfGrammar.scopeName?t.selfGrammar:i.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(a){const c={baseGrammar:t.baseGrammar,selfGrammar:a,repository:s};i.kind===4?pt(i.ruleName,c,n):Ie(c,n)}else i.kind===4?n.add(new Zr(i.scopeName,i.ruleName)):n.add(new de(i.scopeName));break}}}var ts=class{kind=0},ns=class{kind=1},rs=class{constructor(e){this.ruleName=e}kind=2},ss=class{constructor(e){this.scopeName=e}kind=3},os=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function Fn(e){if(e==="$base")return new ts;if(e==="$self")return new ns;const t=e.indexOf("#");if(t===-1)return new ss(e);if(t===0)return new rs(e.substring(1));{const n=e.substring(0,t),r=e.substring(t+1);return new os(n,r)}}var is=/\\(\d+)/,Ht=/\\(\d+)/g,as=-1,Dn=-2;var be=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=we.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=we.hasCaptures(this._contentName)}get debugName(){const e=this.$location?`${$n(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return!this._nameIsCapturing||this._name===null||e===null||t===null?this._name:we.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:we.replaceCaptures(this._contentName,e,t)}},cs=class extends be{retokenizeCapturedWithRuleId;constructor(e,t,n,r,s){super(e,t,n,r),this.retokenizeCapturedWithRuleId=s}dispose(){}collectPatterns(e,t){throw new Error("Not supported!")}compile(e,t){throw new Error("Not supported!")}compileAG(e,t,n,r){throw new Error("Not supported!")}},ls=class extends be{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,s){super(e,t,n,null),this._match=new pe(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(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new ge,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},qt=class extends be{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,s){super(e,t,n,r),this.patterns=s.patterns,this.hasMissingPatterns=s.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(e,t){for(const n of this.patterns)e.getRule(n).collectPatterns(e,t)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new ge,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},gt=class extends be{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,s,o,i,a,c,l){super(e,t,n,r),this._begin=new pe(s,this.id),this.beginCaptures=o,this._end=new pe(i||"￿",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=a,this.applyEndPatternLast=c||!1,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e,t).compileAG(e,n,r)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new ge;for(const n of this.patterns)e.getRule(n).collectPatterns(e,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},Le=class extends be{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,n,r,s,o,i,a,c){super(e,t,n,r),this._begin=new pe(s,this.id),this.beginCaptures=o,this.whileCaptures=a,this._while=new pe(i,Dn),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new ge;for(const t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,n,r){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,n,r)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new ge,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||"￿"),this._cachedCompiledWhilePatterns}},jn=class N{static createCaptureRule(t,n,r,s,o){return t.registerRule(i=>new cs(n,i,r,s,o))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(s=>{if(t.id=s,t.match)return new ls(t.$vscodeTextmateLocation,t.id,t.name,t.match,N._compileCaptures(t.captures,n,r));if(typeof t.begin>"u"){t.repository&&(r=Rn({},r,t.repository));let o=t.patterns;return typeof o>"u"&&t.include&&(o=[{include:t.include}]),new qt(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,N._compilePatterns(o,n,r))}return t.while?new Le(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,N._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,N._compileCaptures(t.whileCaptures||t.captures,n,r),N._compilePatterns(t.patterns,n,r)):new gt(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,N._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,N._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,N._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,r){let s=[];if(t){let o=0;for(const i in t){if(i==="$vscodeTextmateLocation")continue;const a=parseInt(i,10);a>o&&(o=a)}for(let i=0;i<=o;i++)s[i]=null;for(const i in t){if(i==="$vscodeTextmateLocation")continue;const a=parseInt(i,10);let c=0;t[i].patterns&&(c=N.getCompiledRuleId(t[i],n,r)),s[a]=N.createCaptureRule(n,t[i].$vscodeTextmateLocation,t[i].name,t[i].contentName,c)}}return s}static _compilePatterns(t,n,r){let s=[];if(t)for(let o=0,i=t.length;o<i;o++){const a=t[o];let c=-1;if(a.include){const l=Fn(a.include);switch(l.kind){case 0:case 1:c=N.getCompiledRuleId(r[a.include],n,r);break;case 2:let u=r[l.ruleName];u&&(c=N.getCompiledRuleId(u,n,r));break;case 3:case 4:const h=l.scopeName,f=l.kind===4?l.ruleName:null,d=n.getExternalGrammar(h,r);if(d)if(f){let p=d.repository[f];p&&(c=N.getCompiledRuleId(p,n,d.repository))}else c=N.getCompiledRuleId(d.repository.$self,n,d.repository);break}}else c=N.getCompiledRuleId(a,n,r);if(c!==-1){const l=n.getRule(c);let u=!1;if((l instanceof qt||l instanceof gt||l instanceof Le)&&l.hasMissingPatterns&&l.patterns.length===0&&(u=!0),u)continue;s.push(c)}}return{patterns:s,hasMissingPatterns:(t?t.length:0)!==s.length}}},pe=class Un{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(t,n){if(t&&typeof t=="string"){const r=t.length;let s=0,o=[],i=!1;for(let a=0;a<r;a++)if(t.charAt(a)==="\\"&&a+1<r){const l=t.charAt(a+1);l==="z"?(o.push(t.substring(s,a)),o.push("$(?!\\n)(?<!\\n)"),s=a+2):(l==="A"||l==="G")&&(i=!0),a++}this.hasAnchor=i,s===0?this.source=t:(o.push(t.substring(s,r)),this.source=o.join(""))}else this.hasAnchor=!1,this.source=t;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=n,typeof this.source=="string"?this.hasBackReferences=is.test(this.source):this.hasBackReferences=!1}clone(){return new Un(this.source,this.ruleId)}setSource(t){this.source!==t&&(this.source=t,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(t,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=>t.substring(s.start,s.end));return Ht.lastIndex=0,this.source.replace(Ht,(s,o)=>Tn(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 t=[],n=[],r=[],s=[],o,i,a,c;for(o=0,i=this.source.length;o<i;o++)a=this.source.charAt(o),t[o]=a,n[o]=a,r[o]=a,s[o]=a,a==="\\"&&o+1<i&&(c=this.source.charAt(o+1),c==="A"?(t[o+1]="￿",n[o+1]="￿",r[o+1]="A",s[o+1]="A"):c==="G"?(t[o+1]="￿",n[o+1]="G",r[o+1]="￿",s[o+1]="G"):(t[o+1]=c,n[o+1]=c,r[o+1]=c,s[o+1]=c),o++);return{A0_G0:t.join(""),A0_G1:n.join(""),A1_G0:r.join(""),A1_G1:s.join("")}}resolveAnchors(t,n){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:t?n?this._anchorCache.A1_G1:this._anchorCache.A1_G0:n?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},ge=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(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(n=>n.source);this._cached=new Vt(e,t,this._items.map(n=>n.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){let r=this._items.map(s=>s.resolveAnchors(t,n));return new Vt(e,r,this._items.map(s=>s.ruleId))}},Vt=class{constructor(e,t,n){this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}scanner;dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(" - "+this.rules[t]+": "+this.regExps[t]);return e.join(`
2
+ `)}findNextMatchSync(e,t,n){const r=this.scanner.findNextMatchSync(e,t,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},et=class{constructor(e,t){this.languageId=e,this.tokenType=t}},us=class mt{_defaultAttributes;_embeddedLanguagesMatcher;constructor(t,n){this._defaultAttributes=new et(t,8),this._embeddedLanguagesMatcher=new hs(Object.entries(n||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?mt._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}static _NULL_SCOPE_METADATA=new et(0,0);_getBasicScopeAttributes=new Gn(t=>{const n=this._scopeToLanguage(t),r=this._toStandardTokenType(t);return new et(n,r)});_scopeToLanguage(t){return this._embeddedLanguagesMatcher.match(t)||0}_toStandardTokenType(t){const n=t.match(mt.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/},hs=class{values;scopesRegExp;constructor(e){if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);const t=e.map(([n,r])=>Tn(n));t.sort(),t.reverse(),this.scopesRegExp=new RegExp(`^((${t.join(")|(")}))($|\\.)`,"")}}match(e){if(!this.scopesRegExp)return;const t=e.match(this.scopesRegExp);if(t)return this.values.get(t[1])}},Xt=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function Wn(e,t,n,r,s,o,i,a){const c=t.content.length;let l=!1,u=-1;if(i){const d=fs(e,t,n,r,s,o);s=d.stack,r=d.linePos,n=d.isFirstLine,u=d.anchorPosition}const h=Date.now();for(;!l;){if(a!==0&&Date.now()-h>a)return new Xt(s,!0);f()}return new Xt(s,!1);function f(){const d=ds(e,t,n,r,s,u);if(!d){o.produce(s,c),l=!0;return}const p=d.captureIndices,y=d.matchedRuleId,b=p&&p.length>0?p[0].end>r:!1;if(y===as){const g=s.getRule(e);o.produce(s,p[0].start),s=s.withContentNameScopesList(s.nameScopesList),ue(e,t,n,s,o,g.endCaptures,p),o.produce(s,p[0].end);const m=s;if(s=s.parent,u=m.getAnchorPos(),!b&&m.getEnterPos()===r){s=m,o.produce(s,c),l=!0;return}}else{const g=e.getRule(y);o.produce(s,p[0].start);const m=s,_=g.getName(t.content,p),C=s.contentNameScopesList.pushAttributed(_,e);if(s=s.push(y,r,u,p[0].end===c,null,C,C),g instanceof gt){const S=g;ue(e,t,n,s,o,S.beginCaptures,p),o.produce(s,p[0].end),u=p[0].end;const v=S.getContentName(t.content,p),$=C.pushAttributed(v,e);if(s=s.withContentNameScopesList($),S.endHasBackReferences&&(s=s.withEndRule(S.getEndWithResolvedBackReferences(t.content,p))),!b&&m.hasSameRuleAs(s)){s=s.pop(),o.produce(s,c),l=!0;return}}else if(g instanceof Le){const S=g;ue(e,t,n,s,o,S.beginCaptures,p),o.produce(s,p[0].end),u=p[0].end;const v=S.getContentName(t.content,p),$=C.pushAttributed(v,e);if(s=s.withContentNameScopesList($),S.whileHasBackReferences&&(s=s.withEndRule(S.getWhileWithResolvedBackReferences(t.content,p))),!b&&m.hasSameRuleAs(s)){s=s.pop(),o.produce(s,c),l=!0;return}}else if(ue(e,t,n,s,o,g.captures,p),o.produce(s,p[0].end),s=s.pop(),!b){s=s.safePop(),o.produce(s,c),l=!0;return}}p[0].end>r&&(r=p[0].end,n=!1)}}function fs(e,t,n,r,s,o){let i=s.beginRuleCapturedEOL?0:-1;const a=[];for(let c=s;c;c=c.pop()){const l=c.getRule(e);l instanceof Le&&a.push({rule:l,stack:c})}for(let c=a.pop();c;c=a.pop()){const{ruleScanner:l,findOptions:u}=ms(c.rule,e,c.stack.endRule,n,r===i),h=l.findNextMatchSync(t,r,u);if(h){if(h.ruleId!==Dn){s=c.stack.pop();break}h.captureIndices&&h.captureIndices.length&&(o.produce(c.stack,h.captureIndices[0].start),ue(e,t,n,c.stack,o,c.rule.whileCaptures,h.captureIndices),o.produce(c.stack,h.captureIndices[0].end),i=h.captureIndices[0].end,h.captureIndices[0].end>r&&(r=h.captureIndices[0].end,n=!1))}else{s=c.stack.pop();break}}return{stack:s,linePos:r,anchorPosition:i,isFirstLine:n}}function ds(e,t,n,r,s,o){const i=ps(e,t,n,r,s,o),a=e.getInjections();if(a.length===0)return i;const c=gs(a,e,t,n,r,s,o);if(!c)return i;if(!i)return c;const l=i.captureIndices[0].start,u=c.captureIndices[0].start;return u<l||c.priorityMatch&&u===l?c:i}function ps(e,t,n,r,s,o){const i=s.getRule(e),{ruleScanner:a,findOptions:c}=zn(i,e,s.endRule,n,r===o),l=a.findNextMatchSync(t,r,c);return l?{captureIndices:l.captureIndices,matchedRuleId:l.ruleId}:null}function gs(e,t,n,r,s,o,i){let a=Number.MAX_VALUE,c=null,l,u=0;const h=o.contentNameScopesList.getScopeNames();for(let f=0,d=e.length;f<d;f++){const p=e[f];if(!p.matcher(h))continue;const y=t.getRule(p.ruleId),{ruleScanner:b,findOptions:g}=zn(y,t,null,r,s===i),m=b.findNextMatchSync(n,s,g);if(!m)continue;const _=m.captureIndices[0].start;if(!(_>=a)&&(a=_,c=m.captureIndices,l=m.ruleId,u=p.priority,a===s))break}return c?{priorityMatch:u===-1,captureIndices:c,matchedRuleId:l}:null}function zn(e,t,n,r,s){return{ruleScanner:e.compileAG(t,n,r,s),findOptions:0}}function ms(e,t,n,r,s){return{ruleScanner:e.compileWhileAG(t,n,r,s),findOptions:0}}function ue(e,t,n,r,s,o,i){if(o.length===0)return;const a=t.content,c=Math.min(o.length,i.length),l=[],u=i[0].end;for(let h=0;h<c;h++){const f=o[h];if(f===null)continue;const d=i[h];if(d.length===0)continue;if(d.start>u)break;for(;l.length>0&&l[l.length-1].endPos<=d.start;)s.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop();if(l.length>0?s.produceFromScopes(l[l.length-1].scopes,d.start):s.produce(r,d.start),f.retokenizeCapturedWithRuleId){const y=f.getName(a,i),b=r.contentNameScopesList.pushAttributed(y,e),g=f.getContentName(a,i),m=b.pushAttributed(g,e),_=r.push(f.retokenizeCapturedWithRuleId,d.start,-1,!1,null,b,m),C=e.createOnigString(a.substring(0,d.end));Wn(e,C,n&&d.start===0,d.start,_,s,!1,0),Bn(C);continue}const p=f.getName(a,i);if(p!==null){const b=(l.length>0?l[l.length-1].scopes:r.contentNameScopesList).pushAttributed(p,e);l.push(new ys(b,d.end))}}for(;l.length>0;)s.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop()}var ys=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function bs(e,t,n,r,s,o,i,a){return new ws(e,t,n,r,s,o,i,a)}function Qt(e,t,n,r,s){const o=Re(t,Pe),i=jn.getCompiledRuleId(n,r,s.repository);for(const a of o)e.push({debugSelector:t,matcher:a.matcher,ruleId:i,grammar:s,priority:a.priority})}function Pe(e,t){if(t.length<e.length)return!1;let n=0;return e.every(r=>{for(let s=n;s<t.length;s++)if(_s(t[s],r))return n=s+1,!0;return!1})}function _s(e,t){if(!e)return!1;if(e===t)return!0;const n=t.length;return e.length>n&&e.substr(0,n)===t&&e[n]==="."}var ws=class{constructor(e,t,n,r,s,o,i,a){if(this._rootScopeName=e,this.balancedBracketSelectors=o,this._onigLib=a,this._basicScopeAttributesProvider=new us(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=i,this._grammar=Kt(t,null),this._injections=null,this._tokenTypeMatchers=[],s)for(const c of Object.keys(s)){const l=Re(c,Pe);for(const u of l)this._tokenTypeMatchers.push({matcher:u.matcher,type:s[c]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(const e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){const e={lookup:s=>s===this._rootScopeName?this._grammar:this.getExternalGrammar(s),injections:s=>this._grammarRepository.injections(s)},t=[],n=this._rootScopeName,r=e.lookup(n);if(r){const s=r.injections;if(s)for(let i in s)Qt(t,i,s[i],this,r);const o=this._grammarRepository.injections(n);o&&o.forEach(i=>{const a=this.getExternalGrammar(i);if(a){const c=a.injectionSelector;c&&Qt(t,c,a,this,a)}})}return t.sort((s,o)=>s.priority-o.priority),t}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(e){const t=++this._lastRuleId,n=e(t);return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[e]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){const n=this._grammarRepository.lookup(e);if(n)return this._includedGrammars[e]=Kt(n,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,n=0){const r=this._tokenize(e,t,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(e,t,n=0){const r=this._tokenize(e,t,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(e,t,n,r){this._rootId===-1&&(this._rootId=jn.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let s;if(!t||t===yt.NULL){s=!0;const l=this._basicScopeAttributesProvider.getDefaultAttributes(),u=this.themeProvider.getDefaults(),h=J.set(0,l.languageId,l.tokenType,null,u.fontStyle,u.foregroundId,u.backgroundId),f=this.getRule(this._rootId).getName(null,null);let d;f?d=he.createRootAndLookUpScopeName(f,h,this):d=he.createRoot("unknown",h),t=new yt(null,this._rootId,-1,-1,!1,null,d,d)}else s=!1,t.reset();e=e+`
3
+ `;const o=this.createOnigString(e),i=o.content.length,a=new Ss(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),c=Wn(this,o,s,0,t,a,!0,r);return Bn(o),{lineLength:i,lineTokens:a,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function Kt(e,t){return e=Fr(e),e.repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var he=class F{constructor(t,n,r){this.parent=t,this.scopePath=n,this.tokenAttributes=r}static fromExtension(t,n){let r=t,s=t?.scopePath??null;for(const o of n)s=Ye.push(s,o.scopeNames),r=new F(r,s,o.encodedTokenAttributes);return r}static createRoot(t,n){return new F(null,new Ye(null,t),n)}static createRootAndLookUpScopeName(t,n,r){const s=r.getMetadataForScope(t),o=new Ye(null,t),i=r.themeProvider.themeMatch(o),a=F.mergeAttributes(n,s,i);return new F(null,o,a)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(t){return F.equals(this,t)}static equals(t,n){do{if(t===n||!t&&!n)return!0;if(!t||!n||t.scopeName!==n.scopeName||t.tokenAttributes!==n.tokenAttributes)return!1;t=t.parent,n=n.parent}while(!0)}static mergeAttributes(t,n,r){let s=-1,o=0,i=0;return r!==null&&(s=r.fontStyle,o=r.foregroundId,i=r.backgroundId),J.set(t,n.languageId,n.tokenType,null,s,o,i)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(" ")===-1)return F._pushAttributed(this,t,n);const r=t.split(/ /g);let s=this;for(const o of r)s=F._pushAttributed(s,o,n);return s}static _pushAttributed(t,n,r){const s=r.getMetadataForScope(n),o=t.scopePath.push(n),i=r.themeProvider.themeMatch(o),a=F.mergeAttributes(t.tokenAttributes,s,i);return new F(t,o,a)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(t){const n=[];let r=this;for(;r&&r!==t;)n.push({encodedTokenAttributes:r.tokenAttributes,scopeNames:r.scopePath.getExtensionIfDefined(r.parent?.scopePath??null)}),r=r.parent;return r===t?n.reverse():void 0}},yt=class X{constructor(t,n,r,s,o,i,a,c){this.parent=t,this.ruleId=n,this.beginRuleCapturedEOL=o,this.endRule=i,this.nameScopesList=a,this.contentNameScopesList=c,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=r,this._anchorPos=s}_stackElementBrand=void 0;static NULL=new X(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(t){return t===null?!1:X._equals(this,t)}static _equals(t,n){return t===n?!0:this._structuralEquals(t,n)?he.equals(t.contentNameScopesList,n.contentNameScopesList):!1}static _structuralEquals(t,n){do{if(t===n||!t&&!n)return!0;if(!t||!n||t.depth!==n.depth||t.ruleId!==n.ruleId||t.endRule!==n.endRule)return!1;t=t.parent,n=n.parent}while(!0)}clone(){return this}static _reset(t){for(;t;)t._enterPos=-1,t._anchorPos=-1,t=t.parent}reset(){X._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,r,s,o,i,a){return new X(this,t,n,r,s,o,i,a)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(t){return t.getRule(this.ruleId)}toString(){const t=[];return this._writeString(t,0),"["+t.join(",")+"]"}_writeString(t,n){return this.parent&&(n=this.parent._writeString(t,n)),t[n++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,n}withContentNameScopesList(t){return this.contentNameScopesList===t?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,t)}withEndRule(t){return this.endRule===t?this:new X(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(t){let n=this;for(;n&&n._enterPos===t._enterPos;){if(n.ruleId===t.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(t,n){const r=he.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new X(t,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,he.fromExtension(r,n.contentNameScopesList))}},Cs=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(n=>n==="*"?(this.allowAny=!0,[]):Re(n,Pe).map(r=>r.matcher)),this.unbalancedBracketScopes=t.flatMap(n=>Re(n,Pe).map(r=>r.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(e){for(const t of this.unbalancedBracketScopes)if(t(e))return!1;for(const t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},Ss=class{constructor(e,t,n,r){this.balancedBracketSelectors=r,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let r=e?.tokenAttributes??0,s=!1;if(this.balancedBracketSelectors?.matchesAlways&&(s=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const o=e?.getScopeNames()??[];for(const i of this._tokenTypeOverrides)i.matcher(o)&&(r=J.set(r,0,i.type,null,-1,0,0));this.balancedBracketSelectors&&(s=this.balancedBracketSelectors.match(o))}if(s&&(r=J.set(r,0,8,s,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===r){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(r),this._lastTokenEndIndex=t;return}const n=e?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:n}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),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}},ks=class{constructor(e,t){this._onigLib=t,this._theme=e}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(const e of this._grammars.values())e.dispose()}setTheme(e){this._theme=e}getColorMap(){return this._theme.getColorMap()}addGrammar(e,t){this._rawGrammars.set(e.scopeName,e),t&&this._injectionGrammars.set(e.scopeName,t)}lookup(e){return this._rawGrammars.get(e)}injections(e){return this._injectionGrammars.get(e)}getDefaults(){return this._theme.getDefaults()}themeMatch(e){return this._theme.match(e)}grammarForScopeName(e,t,n,r,s){if(!this._grammars.has(e)){let o=this._rawGrammars.get(e);if(!o)return null;this._grammars.set(e,bs(e,o,t,n,r,s,this,this._onigLib))}return this._grammars.get(e)}},xs=class{_options;_syncRegistry;_ensureGrammarCache;constructor(t){this._options=t,this._syncRegistry=new ks(Ne.createFromRawTheme(t.theme,t.colorMap),t.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(t,n){this._syncRegistry.setTheme(Ne.createFromRawTheme(t,n))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(t,n,r){return this.loadGrammarWithConfiguration(t,n,{embeddedLanguages:r})}loadGrammarWithConfiguration(t,n,r){return this._loadGrammar(t,n,r.embeddedLanguages,r.tokenTypes,new Cs(r.balancedBracketSelectors||[],r.unbalancedBracketSelectors||[]))}loadGrammar(t){return this._loadGrammar(t,0,null,null,null)}_loadGrammar(t,n,r,s,o){const i=new Yr(this._syncRegistry,t);for(;i.Q.length>0;)i.Q.map(a=>this._loadSingleGrammar(a.scopeName)),i.processQueue();return this._grammarForScopeName(t,n,r,s,o)}_loadSingleGrammar(t){this._ensureGrammarCache.has(t)||(this._doLoadSingleGrammar(t),this._ensureGrammarCache.set(t,!0))}_doLoadSingleGrammar(t){const n=this._options.loadGrammar(t);if(n){const r=typeof this._options.getInjections=="function"?this._options.getInjections(t):void 0;this._syncRegistry.addGrammar(n,r)}}addGrammar(t,n=[],r=0,s=null){return this._syncRegistry.addGrammar(t,n),this._grammarForScopeName(t.scopeName,r,s)}_grammarForScopeName(t,n=0,r=null,s=null,o=null){return this._syncRegistry.grammarForScopeName(t,n,r,s,o)}},bt=yt.NULL;function Te(e,t){const n=typeof e=="string"?{}:{...e.colorReplacements},r=typeof e=="string"?e:e.name;for(const[s,o]of Object.entries(t?.colorReplacements||{}))typeof o=="string"?n[s]=o:s===r&&Object.assign(n,o);return n}function q(e,t){return e&&(t?.[e?.toLowerCase()]||e)}function As(e){return Array.isArray(e)?e:[e]}async function Hn(e){return Promise.resolve(typeof e=="function"?e():e).then(t=>t.default||t)}function De(e){return!e||["plaintext","txt","text","plain"].includes(e)}function Es(e){return e==="ansi"||De(e)}function je(e){return e==="none"}function Is(e){return je(e)}const vs=/(\r?\n)/g;function Ue(e,t=!1){if(e.length===0)return[["",0]];const n=e.split(vs);let r=0;const s=[];for(let o=0;o<n.length;o+=2){const i=t?n[o]+(n[o+1]||""):n[o];s.push([i,r]),r+=n[o].length,r+=n[o+1]?.length||0}return s}const Zt={light:"#333333",dark:"#bbbbbb"},Jt={light:"#fffffe",dark:"#1e1e1e"},Yt="__shiki_resolved";function Rt(e){if(e?.[Yt])return e;const t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||="dark",t.colorReplacements={...t.colorReplacements},t.settings||=[];let{bg:n,fg:r}=t;if(!n||!r){const a=t.settings?t.settings.find(c=>!c.name&&!c.scope):void 0;a?.settings?.foreground&&(r=a.settings.foreground),a?.settings?.background&&(n=a.settings.background),!r&&t?.colors?.["editor.foreground"]&&(r=t.colors["editor.foreground"]),!n&&t?.colors?.["editor.background"]&&(n=t.colors["editor.background"]),r||(r=t.type==="light"?Zt.light:Zt.dark),n||(n=t.type==="light"?Jt.light:Jt.dark),t.fg=r,t.bg=n}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let s=0;const o=new Map;function i(a){if(o.has(a))return o.get(a);s+=1;const c=`#${s.toString(16).padStart(8,"0").toLowerCase()}`;return t.colorReplacements?.[`#${c}`]?i(a):(o.set(a,c),c)}t.settings=t.settings.map(a=>{const c=a.settings?.foreground&&!a.settings.foreground.startsWith("#"),l=a.settings?.background&&!a.settings.background.startsWith("#");if(!c&&!l)return a;const u={...a,settings:{...a.settings}};if(c){const h=i(a.settings.foreground);t.colorReplacements[h]=a.settings.foreground,u.settings.foreground=h}if(l){const h=i(a.settings.background);t.colorReplacements[h]=a.settings.background,u.settings.background=h}return u});for(const a of Object.keys(t.colors||{}))if((a==="editor.foreground"||a==="editor.background"||a.startsWith("terminal.ansi"))&&!t.colors[a]?.startsWith("#")){const c=i(t.colors[a]);t.colorReplacements[c]=t.colors[a],t.colors[a]=c}return Object.defineProperty(t,Yt,{enumerable:!1,writable:!1,value:!0}),t}async function qn(e){return[...new Set((await Promise.all(e.filter(t=>!Es(t)).map(async t=>await Hn(t).then(n=>Array.isArray(n)?n:[n])))).flat())]}async function Vn(e){return(await Promise.all(e.map(async t=>Is(t)?null:Rt(await Hn(t))))).filter(t=>!!t)}function Xn(e,t){if(!t)return e;if(t[e]){const n=new Set([e]);for(;t[e];){if(e=t[e],n.has(e))throw new k(`Circular alias \`${[...n].join(" -> ")} -> ${e}\``);n.add(e)}}return e}var Ns=class extends xs{_resolver;_themes;_langs;_alias;_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;constructor(e,t,n,r={}){super(e),this._resolver=e,this._themes=t,this._langs=n,this._alias=r,this._themes.map(s=>this.loadTheme(s)),this.loadLanguages(this._langs)}getTheme(e){return typeof e=="string"?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){const t=Rt(e);return t.name&&(this._resolvedThemes.set(t.name,t),this._loadedThemesCache=null),t}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(e){let t=this._textmateThemeCache.get(e);t||(t=Ne.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){return e=Xn(e,this._alias),this._resolvedGrammars.get(e)}loadLanguage(e){if(this.getGrammar(e.name))return;const t=new Set([...this._langMap.values()].filter(s=>s.embeddedLangsLazy?.includes(e.name)));this._resolver.addLanguage(e);const n={balancedBracketSelectors:e.balancedBracketSelectors||["*"],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);const r=this.loadGrammarWithConfiguration(e.scopeName,1,n);if(r.name=e.name,this._resolvedGrammars.set(e.name,r),e.aliases&&e.aliases.forEach(s=>{this._alias[s]=e.name}),this._loadedLanguagesCache=null,t.size)for(const s of t)this._resolvedGrammars.delete(s.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(s.scopeName),this._syncRegistry?._grammars?.delete(s.scopeName),this.loadLanguage(this._langMap.get(s.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(e){for(const r of e)this.resolveEmbeddedLanguages(r);const t=[...this._langGraph.entries()],n=t.filter(([r,s])=>!s);if(n.length){const r=t.filter(([s,o])=>o?(o.embeddedLanguages||o.embeddedLangs)?.some(i=>n.map(([a])=>a).includes(i)):!1).filter(s=>!n.includes(s));throw new k(`Missing languages ${n.map(([s])=>`\`${s}\``).join(", ")}, required by ${r.map(([s])=>`\`${s}\``).join(", ")}`)}for(const[r,s]of t)this._resolver.addLanguage(s);for(const[r,s]of t)this.loadLanguage(s)}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 t=e.embeddedLanguages??e.embeddedLangs;if(t)for(const n of t)this._langGraph.set(n,this._langMap.get(n))}},Rs=class{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(e,t){this._onigLib={createOnigScanner:n=>e.createScanner(n),createOnigString:n=>e.createString(n)},t.forEach(n=>this.addLanguage(n))}get onigLib(){return this._onigLib}getLangRegistration(e){return this._langs.get(e)}loadGrammar(e){return this._scopeToLang.get(e)}addLanguage(e){this._langs.set(e.name,e),e.aliases&&e.aliases.forEach(t=>{this._langs.set(t,e)}),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach(t=>{this._injections.get(t)||this._injections.set(t,[]),this._injections.get(t).push(e.scopeName)})}getInjections(e){const t=e.split(".");let n=[];for(let r=1;r<=t.length;r++){const s=t.slice(0,r).join(".");n=[...n,...this._injections.get(s)||[]]}return n}};let le=0;function $s(e){le+=1,e.warnings!==!1&&le>=10&&le%10===0&&console.warn(`[Shiki] ${le} 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 t=!1;if(!e.engine)throw new k("`engine` option is required for synchronous mode");const n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(Rt),s=new Ns(new Rs(e.engine,n),r,n,e.langAlias);let o;function i(m){return Xn(m,e.langAlias)}function a(m){b();const _=s.getGrammar(typeof m=="string"?m:m.name);if(!_)throw new k(`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"};b();const _=s.getTheme(m);if(!_)throw new k(`Theme \`${m}\` not found, you may need to load it first`);return _}function l(m){b();const _=c(m);return o!==m&&(s.setTheme(_),o=m),{theme:_,colorMap:s.getColorMap()}}function u(){return b(),s.getLoadedThemes()}function h(){return b(),s.getLoadedLanguages()}function f(...m){b(),s.loadLanguages(m.flat(1))}async function d(...m){return f(await qn(m))}function p(...m){b();for(const _ of m.flat(1))s.loadTheme(_)}async function y(...m){return b(),p(await Vn(m))}function b(){if(t)throw new k("Shiki instance has been disposed")}function g(){t||(t=!0,s.dispose(),le-=1)}return{setTheme:l,getTheme:c,getLanguage:a,getLoadedThemes:u,getLoadedLanguages:h,resolveLangAlias:i,loadLanguage:d,loadLanguageSync:f,loadTheme:y,loadThemeSync:p,dispose:g,[Symbol.dispose]:g}}async function Ls(e){e.engine||console.warn("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");const[t,n,r]=await Promise.all([Vn(e.themes||[]),qn(e.langs||[]),e.engine]);return $s({...e,themes:t,langs:n,engine:r})}const Qn=new WeakMap;function We(e,t){Qn.set(e,t)}function me(e){return Qn.get(e)}var ze=class Kn{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(t,n){return new Kn(Object.fromEntries(As(n).map(r=>[r,bt])),t)}constructor(...t){if(t.length===2){const[n,r]=t;this.lang=r,this._stacks=n}else{const[n,r,s]=t;this.lang=r,this._stacks={[s]:n}}}getInternalStack(t=this.theme){return this._stacks[t]}getScopes(t=this.theme){return Ps(this._stacks[t])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}};function Ps(e){const t=[],n=new Set;function r(s){if(n.has(s))return;n.add(s);const o=s?.nameScopesList?.scopeName;o&&t.push(o),s.parent&&r(s.parent)}return r(e),t}function Ts(e,t){if(!(e instanceof ze))throw new k("Invalid grammar state");return e.getInternalStack(t)}const Gs=/,/,Ms=/ /;function Zn(e,t,n={}){const{theme:r=e.getLoadedThemes()[0]}=n;if(De(e.resolveLangAlias(n.lang||"text"))||je(r))return Ue(t).map(a=>[{content:a[0],offset:a[1]}]);const{theme:s,colorMap:o}=e.setTheme(r),i=e.getLanguage(n.lang||"text");if(n.grammarState){if(n.grammarState.lang!==i.name)throw new k(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${i.name}"`);if(!n.grammarState.themes.includes(s.name))throw new k(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${s.name}"`)}return Bs(t,i,s,o,n)}function Os(...e){if(e.length===2)return me(e[1]);const[t,n,r={}]=e,{lang:s="text",theme:o=t.getLoadedThemes()[0]}=r;if(De(s)||je(o))throw new k("Plain language does not have grammar state");if(s==="ansi")throw new k("ANSI language does not have grammar state");const{theme:i,colorMap:a}=t.setTheme(o),c=t.getLanguage(s);return new ze($t(n,c,i,a,r).stateStack,c.name,i.name)}function Bs(e,t,n,r,s){const o=$t(e,t,n,r,s),i=new ze(o.stateStack,t.name,n.name);return We(o.tokens,i),o.tokens}function $t(e,t,n,r,s){const o=Te(n,s),{tokenizeMaxLineLength:i=0,tokenizeTimeLimit:a=500,includeExplanation:c=!1}=s,l=Ue(e);let u=s.grammarState?Ts(s.grammarState,n.name)??bt:s.grammarContextCode!=null?$t(s.grammarContextCode,t,n,r,{...s,grammarState:void 0,grammarContextCode:void 0}).stateStack:bt,h=[];const f=[];for(let d=0,p=l.length;d<p;d++){const[y,b]=l[d];if(y===""){h=[],f.push([]);continue}if(i>0&&y.length>=i){h=[],f.push([{content:y,offset:b,color:"",fontStyle:0}]);continue}let g,m,_;c&&c!=="tokenType"&&(g=t.tokenizeLine(y,u,a),m=g.tokens,_=0);const C=t.tokenizeLine2(y,u,a),S=C.tokens.length/2;for(let v=0;v<S;v++){const $=C.tokens[2*v],O=v+1<S?C.tokens[2*v+2]:y.length;if($===O)continue;const ee=C.tokens[2*v+1],Qe=q(r[J.getForeground(ee)],o),Ke=J.getFontStyle(ee),B={content:y.substring($,O),offset:b+$,color:Qe,fontStyle:Ke};if(c==="tokenType")B.type=J.getTokenType(ee);else if(c){const Bt=[];if(c!=="scopeName")for(const D of n.settings){let te;switch(typeof D.scope){case"string":te=D.scope.split(Gs).map(Ze=>Ze.trim());break;case"object":te=D.scope;break;default:continue}Bt.push({settings:D,selectors:te.map(Ze=>Ze.split(Ms))})}B.explanation=[];let Ft=0;for(;$+Ft<O;){const D=m[_],te=y.substring(D.startIndex,D.endIndex);Ft+=te.length,B.explanation.push({content:te,scopes:c==="scopeName"?Fs(D.scopes):Ds(Bt,D.scopes)}),_+=1}}h.push(B)}f.push(h),h=[],u=C.ruleStack}return{tokens:f,stateStack:u}}function Fs(e){return e.map(t=>({scopeName:t}))}function Ds(e,t){const n=[];for(let r=0,s=t.length;r<s;r++){const o=t[r];n[r]={scopeName:o,themeMatches:Us(e,o,t.slice(0,r))}}return n}function en(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]==="."}function js(e,t,n){if(!en(e.at(-1),t))return!1;let r=e.length-2,s=n.length-1;for(;r>=0&&s>=0;)en(e[r],n[s])&&(r-=1),s-=1;return r===-1}function Us(e,t,n){const r=[];for(const{selectors:s,settings:o}of e)for(const i of s)if(js(i,t,n)){r.push(o);break}return r}function Jn(e,t,n,r=Zn){const s=Object.entries(n.themes).filter(l=>l[1]).map(l=>({color:l[0],theme:l[1]})),o=s.map(l=>{const u=r(e,t,{...n,theme:l.theme});return{tokens:u,state:me(u),theme:typeof l.theme=="string"?l.theme:l.theme.name}}),i=Ws(...o.map(l=>l.tokens)),a=i[0].map((l,u)=>l.map((h,f)=>{const d={content:h.content,variants:{},offset:h.offset};return"includeExplanation"in n&&n.includeExplanation&&(d.explanation=h.explanation),i.forEach((p,y)=>{const{content:b,explanation:g,offset:m,..._}=p[u][f];d.variants[s[y].color]=_}),d})),c=o[0].state?new ze(Object.fromEntries(o.map(l=>[l.theme,l.state?.getInternalStack(l.theme)])),o[0].state.lang):void 0;return c&&We(a,c),a}function Ws(...e){const t=e.map(()=>[]),n=e.length;for(let r=0;r<e[0].length;r++){const s=e.map(c=>c[r]),o=t.map(()=>[]);t.forEach((c,l)=>c.push(o[l]));const i=s.map(()=>0),a=s.map(c=>c[0]);for(;a.every(c=>c);){const c=Math.min(...a.map(l=>l.content.length));for(let l=0;l<n;l++){const u=a[l];u.content.length===c?(o[l].push(u),i[l]+=1,a[l]=s[l][i[l]]):(o[l].push({...u,content:u.content.slice(0,c)}),a[l]={...u,content:u.content.slice(c),offset:u.offset+c})}}}return t}const zs=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"],Hs=/["&'<>`]/g,qs=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Vs=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,Xs=/[|\\{}()[\]^$+*?.]/g,tn=new WeakMap;function Qs(e,t){if(e=e.replace(t.subset?Ks(t.subset):Hs,r),t.subset||t.escapeOnly)return e;return e.replace(qs,n).replace(Vs,r);function n(s,o,i){return t.format((s.charCodeAt(0)-55296)*1024+s.charCodeAt(1)-56320+65536,i.charCodeAt(o+2),t)}function r(s,o,i){return t.format(s.charCodeAt(0),i.charCodeAt(o+1),t)}}function Ks(e){let t=tn.get(e);return t||(t=Zs(e),tn.set(e,t)),t}function Zs(e){const t=[];let n=-1;for(;++n<e.length;)t.push(e[n].replace(Xs,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}const Js=/[\dA-Fa-f]/;function Ys(e,t,n){const r="&#x"+e.toString(16).toUpperCase();return n&&t&&!Js.test(String.fromCharCode(t))?r:r+";"}const eo=/\d/;function to(e,t,n){const r="&#"+String(e);return n&&t&&!eo.test(String.fromCharCode(t))?r:r+";"}const no=["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:"€"},ro=["cent","copy","divide","gt","lt","not","para","times"],Yn={}.hasOwnProperty,_t={};let Ce;for(Ce in tt)Yn.call(tt,Ce)&&(_t[tt[Ce]]=Ce);const so=/[^\dA-Za-z]/;function oo(e,t,n,r){const s=String.fromCharCode(e);if(Yn.call(_t,s)){const o=_t[s],i="&"+o;return n&&no.includes(o)&&!ro.includes(o)&&(!r||t&&t!==61&&so.test(String.fromCharCode(t)))?i:i+";"}return""}function io(e,t,n){let r=Ys(e,t,n.omitOptionalSemicolons),s;if((n.useNamedReferences||n.useShortestReferences)&&(s=oo(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!s)&&n.useShortestReferences){const o=to(e,t,n.omitOptionalSemicolons);o.length<r.length&&(r=o)}return s&&(!n.useShortestReferences||s.length<r.length)?s:r}function ie(e,t){return Qs(e,Object.assign({format:io},t))}const ao=/^>|^->|<!--|-->|--!>|<!-$/g,co=[">"],lo=["<",">"];function uo(e,t,n,r){return r.settings.bogusComments?"<?"+ie(e.value,Object.assign({},r.settings.characterReferences,{subset:co}))+">":"<!--"+e.value.replace(ao,s)+"-->";function s(o){return ie(o,Object.assign({},r.settings.characterReferences,{subset:lo}))}}function ho(e,t,n,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"}const E=tr(1),er=tr(-1),fo=[];function tr(e){return t;function t(n,r,s){const o=n?n.children:fo;let i=(r||0)+e,a=o[i];if(!s)for(;a&&vt(a);)i+=e,a=o[i];return a}}const po={}.hasOwnProperty;function nr(e){return t;function t(n,r,s){return po.call(e,n.tagName)&&e[n.tagName](n,r,s)}}const Lt=nr({body:mo,caption:nt,colgroup:nt,dd:wo,dt:_o,head:nt,html:go,li:bo,optgroup:Co,option:So,p:yo,rp:nn,rt:nn,tbody:xo,td:rn,tfoot:Ao,th:rn,thead:ko,tr:Eo});function nt(e,t,n){const r=E(n,t,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&vt(r.value.charAt(0)))}function go(e,t,n){const r=E(n,t);return!r||r.type!=="comment"}function mo(e,t,n){const r=E(n,t);return!r||r.type!=="comment"}function yo(e,t,n){const r=E(n,t);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 bo(e,t,n){const r=E(n,t);return!r||r.type==="element"&&r.tagName==="li"}function _o(e,t,n){const r=E(n,t);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function wo(e,t,n){const r=E(n,t);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function nn(e,t,n){const r=E(n,t);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function Co(e,t,n){const r=E(n,t);return!r||r.type==="element"&&r.tagName==="optgroup"}function So(e,t,n){const r=E(n,t);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function ko(e,t,n){const r=E(n,t);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function xo(e,t,n){const r=E(n,t);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function Ao(e,t,n){return!E(n,t)}function Eo(e,t,n){const r=E(n,t);return!r||r.type==="element"&&r.tagName==="tr"}function rn(e,t,n){const r=E(n,t);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}const Io=nr({body:Ro,colgroup:$o,head:No,html:vo,tbody:Lo});function vo(e){const t=E(e,-1);return!t||t.type!=="comment"}function No(e){const t=new Set;for(const r of e.children)if(r.type==="element"&&(r.tagName==="base"||r.tagName==="title")){if(t.has(r.tagName))return!1;t.add(r.tagName)}const n=e.children[0];return!n||n.type==="element"}function Ro(e){const t=E(e,-1,!0);return!t||t.type!=="comment"&&!(t.type==="text"&&vt(t.value.charAt(0)))&&!(t.type==="element"&&(t.tagName==="meta"||t.tagName==="link"||t.tagName==="script"||t.tagName==="style"||t.tagName==="template"))}function $o(e,t,n){const r=er(n,t),s=E(e,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&Lt(r,n.children.indexOf(r),n)?!1:!!(s&&s.type==="element"&&s.tagName==="col")}function Lo(e,t,n){const r=er(n,t),s=E(e,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&Lt(r,n.children.indexOf(r),n)?!1:!!(s&&s.type==="element"&&s.tagName==="tr")}const Se={name:[[`
4
+ \f\r &/=>`.split(""),`
5
+ \f\r "&'/=>\``.split("")],[`\0
6
+ \f\r "&'/<=>`.split(""),`\0
7
+ \f\r "&'/<=>\``.split("")]],unquoted:[[`
8
+ \f\r &>`.split(""),`\0
9
+ \f\r "&'<=>\``.split("")],[`\0
10
+ \f\r "&'<=>\``.split(""),`\0
11
+ \f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function Po(e,t,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(e.tagName.toLowerCase());const a=[];let c;s.space==="html"&&e.tagName==="svg"&&(r.schema=Nn);const l=To(r,e.properties),u=r.all(s.space==="html"&&e.tagName==="template"?e.content:e);return r.schema=s,u&&(i=!1),(l||!o||!Io(e,t,n))&&(a.push("<",e.tagName,l?" "+l:""),i&&(s.space==="svg"||r.settings.closeSelfClosing)&&(c=l.charAt(l.length-1),(!r.settings.tightSelfClosing||c==="/"||c&&c!=='"'&&c!=="'")&&a.push(" "),a.push("/")),a.push(">")),a.push(u),!i&&(!o||!Lt(e,t,n))&&a.push("</"+e.tagName+">"),a.join("")}function To(e,t){const n=[];let r=-1,s;if(t){for(s in t)if(t[s]!==null&&t[s]!==void 0){const o=Go(e,s,t[s]);o&&n.push(o)}}for(;++r<n.length;){const o=e.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&o!=='"'&&o!=="'"&&(n[r]+=" ")}return n.join("")}function Go(e,t,n){const r=$r(e.schema,t),s=e.settings.allowParseErrors&&e.schema.space==="html"?0:1,o=e.settings.allowDangerousCharacters?0:1;let i=e.quote,a;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 c=ie(r.attribute,Object.assign({},e.settings.characterReferences,{subset:Se.name[s][o]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?Lr:Pr)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?c:(e.settings.preferUnquoted&&(a=ie(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:Se.unquoted[s][o]}))),a!==n&&(e.settings.quoteSmart&&Dt(n,i)>Dt(n,e.alternative)&&(i=e.alternative),a=i+ie(n,Object.assign({},e.settings.characterReferences,{subset:(i==="'"?Se.single:Se.double)[s][o],attribute:!0}))+i),c+(a&&"="+a))}const Mo=["<","&"];function rr(e,t,n,r){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?e.value:ie(e.value,Object.assign({},r.settings.characterReferences,{subset:Mo}))}function Oo(e,t,n,r){return r.settings.allowDangerousHtml?e.value:rr(e,t,n,r)}function Bo(e,t,n,r){return r.all(e)}const Fo=Br("type",{invalid:Do,unknown:jo,handlers:{comment:uo,doctype:ho,element:Po,raw:Oo,root:Bo,text:rr}});function Do(e){throw new Error("Expected node, not `"+e+"`")}function jo(e){const t=e;throw new Error("Cannot compile unknown node `"+t.type+"`")}const Uo={},Wo={},zo=[];function Ho(e,t){const n=t||Uo,r=n.quote||'"',s=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:qo,all:Vo,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||zs,characterReferences:n.characterReferences||Wo,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?Nn:Tr,quote:r,alternative:s}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)}function qo(e,t,n){return Fo(e,t,n,this)}function Vo(e){const t=[],n=e&&e.children||zo;let r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join("")}const sn=/\s+/g;function sr(e,t){if(!t)return e;e.properties||={},e.properties.class||=[],typeof e.properties.class=="string"&&(e.properties.class=e.properties.class.split(sn)),Array.isArray(e.properties.class)||(e.properties.class=[]);const n=Array.isArray(t)?t:t.split(sn);for(const r of n)r&&!e.properties.class.includes(r)&&e.properties.class.push(r);return e}function Xo(e){const t=Ue(e,!0).map(([s])=>s);function n(s){if(s===e.length)return{line:t.length-1,character:t.at(-1).length};let o=s,i=0;for(const a of t){if(o<a.length)break;o-=a.length,i++}return{line:i,character:o}}function r(s,o){let i=0;for(let a=0;a<s;a++)i+=t[a].length;return i+=o,i}return{lines:t,indexToPos:n,posToIndex:r}}const Qo=["color","background-color"];function Ko(e,t){let n=0;const r=[];for(const s of t)s>n&&r.push({...e,content:e.content.slice(n,s),offset:e.offset+n}),n=s;return n<e.content.length&&r.push({...e,content:e.content.slice(n),offset:e.offset+n}),r}function Zo(e,t){const n=[...t instanceof Set?t:new Set(t)].sort((r,s)=>r-s);return n.length?e.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,a)=>i-a);return o.length?Ko(s,o):s})):e}function Jo(e,t,n,r,s="css-vars"){const o={content:e.content,explanation:e.explanation,offset:e.offset},i=t.map(u=>Ge(e.variants[u])),a=new Set(i.flatMap(u=>Object.keys(u))),c={},l=(u,h)=>{const f=h==="color"?"":h==="background-color"?"-bg":`-${h}`;return n+t[u]+(h==="color"?"":f)};return i.forEach((u,h)=>{for(const f of a){const d=u[f]||"inherit";if(h===0&&r&&Qo.includes(f))if(r==="light-dark()"&&i.length>1){const p=t.findIndex(b=>b==="light"),y=t.findIndex(b=>b==="dark");if(p===-1||y===-1)throw new k('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');c[f]=`light-dark(${i[p][f]||"inherit"}, ${i[y][f]||"inherit"})`,s==="css-vars"&&(c[l(h,f)]=d)}else c[f]=d;else s==="css-vars"&&(c[l(h,f)]=d)}}),o.htmlStyle=c,o}function Ge(e){const t={};if(e.color&&(t.color=e.color),e.bgColor&&(t["background-color"]=e.bgColor),e.fontStyle){e.fontStyle&R.Italic&&(t["font-style"]="italic"),e.fontStyle&R.Bold&&(t["font-weight"]="bold");const n=[];e.fontStyle&R.Underline&&n.push("underline"),e.fontStyle&R.Strikethrough&&n.push("line-through"),n.length&&(t["text-decoration"]=n.join(" "))}return t}function wt(e){return typeof e=="string"?e:Object.entries(e).map(([t,n])=>`${t}:${n}`).join(";")}function Yo(){const e=new WeakMap;function t(n){if(!e.has(n.meta)){let s=function(i){if(typeof i=="number"){if(i<0||i>n.source.length)throw new k(`Invalid decoration offset: ${i}. Code length: ${n.source.length}`);return{...r.indexToPos(i),offset:i}}else{const a=r.lines[i.line];if(a===void 0)throw new k(`Invalid decoration position ${JSON.stringify(i)}. Lines length: ${r.lines.length}`);let c=i.character;if(c<0&&(c=a.length+c),c<0||c>a.length)throw new k(`Invalid decoration position ${JSON.stringify(i)}. Line ${i.line} length: ${a.length}`);return{...i,character:c,offset:r.posToIndex(i.line,c)}}};const r=Xo(n.source),o=(n.options.decorations||[]).map(i=>({...i,start:s(i.start),end:s(i.end)}));ei(o),e.set(n.meta,{decorations:o,converter:r,source:n.source})}return e.get(n.meta)}return{name:"shiki:decorations",tokens(n){if(this.options.decorations?.length)return Zo(n,t(this).decorations.flatMap(r=>[r.start.offset,r.end.offset]))},code(n){if(!this.options.decorations?.length)return;const r=t(this),s=[...n.children].filter(u=>u.type==="element"&&u.tagName==="span");if(s.length!==r.converter.lines.length)throw new k(`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,h,f,d){const p=s[u];let y="",b=-1,g=-1;if(h===0&&(b=0),f===0&&(g=0),f===Number.POSITIVE_INFINITY&&(g=p.children.length),b===-1||g===-1)for(let _=0;_<p.children.length;_++)y+=or(p.children[_]),b===-1&&y.length===h&&(b=_+1),g===-1&&y.length===f&&(g=_+1);if(b===-1)throw new k(`Failed to find start index for decoration ${JSON.stringify(d.start)}`);if(g===-1)throw new k(`Failed to find end index for decoration ${JSON.stringify(d.end)}`);const m=p.children.slice(b,g);if(!d.alwaysWrap&&m.length===p.children.length)a(p,d,"line");else if(!d.alwaysWrap&&m.length===1&&m[0].type==="element")a(m[0],d,"token");else{const _={type:"element",tagName:"span",properties:{},children:m};a(_,d,"wrapper"),p.children.splice(b,m.length,_)}}function i(u,h){s[u]=a(s[u],h,"line")}function a(u,h,f){const d=h.properties||{},p=h.transform||(y=>y);return u.tagName=h.tagName||"span",u.properties={...u.properties,...d,class:u.properties.class},h.properties?.class&&sr(u,h.properties.class),u=p(u,f)||u,u}const c=[],l=r.decorations.sort((u,h)=>h.start.offset-u.start.offset||u.end.offset-h.end.offset);for(const u of l){const{start:h,end:f}=u;if(h.line===f.line)o(h.line,h.character,f.character,u);else if(h.line<f.line){o(h.line,h.character,Number.POSITIVE_INFINITY,u);for(let d=h.line+1;d<f.line;d++)c.unshift(()=>i(d,u));o(f.line,0,f.character,u)}}c.forEach(u=>u())}}}function ei(e){for(let t=0;t<e.length;t++){const n=e[t];if(n.start.offset>n.end.offset)throw new k(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let r=t+1;r<e.length;r++){const s=e[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,a=s.start.offset<=n.start.offset&&n.start.offset<s.end.offset,c=s.start.offset<n.end.offset&&n.end.offset<=s.end.offset;if(o||i||a||c){if(o&&i||a&&c||a&&n.start.offset===n.end.offset||i&&s.start.offset===s.end.offset)continue;throw new k(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(s.start)} intersect.`)}}}}function or(e){return e.type==="text"?e.value:e.type==="element"?e.children.map(or).join(""):""}const ti=[Yo()];function Me(e){const t=ni(e.transformers||[]);return[...t.pre,...t.normal,...t.post,...ti]}function ni(e){const t=[],n=[],r=[];for(const s of e)switch(s.enforce){case"pre":t.push(s);break;case"post":n.push(s);break;default:r.push(s)}return{pre:t,post:n,normal:r}}var K=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],rt={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",8:"hidden",9:"strikethrough"};function ri(e,t){const n=e.indexOf("\x1B",t);if(n!==-1&&e[n+1]==="["){const r=e.indexOf("m",n);if(r!==-1)return{sequence:e.substring(n+2,r).split(";"),startPosition:n,position:r+1}}return{position:e.length}}function on(e){const t=e.shift();if(t==="2"){const n=e.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(t==="5"){const n=e.shift();if(n)return{type:"table",index:Number(n)}}}function si(e){const t=[];for(;e.length>0;){const n=e.shift();if(!n)continue;const r=Number.parseInt(n);if(!Number.isNaN(r))if(r===0)t.push({type:"resetAll"});else if(r<=9)rt[r]&&t.push({type:"setDecoration",value:rt[r]});else if(r<=29){const s=rt[r-20];s&&(t.push({type:"resetDecoration",value:s}),s==="dim"&&t.push({type:"resetDecoration",value:"bold"}))}else if(r<=37)t.push({type:"setForegroundColor",value:{type:"named",name:K[r-30]}});else if(r===38){const s=on(e);s&&t.push({type:"setForegroundColor",value:s})}else if(r===39)t.push({type:"resetForegroundColor"});else if(r<=47)t.push({type:"setBackgroundColor",value:{type:"named",name:K[r-40]}});else if(r===48){const s=on(e);s&&t.push({type:"setBackgroundColor",value:s})}else r===49?t.push({type:"resetBackgroundColor"}):r===53?t.push({type:"setDecoration",value:"overline"}):r===55?t.push({type:"resetDecoration",value:"overline"}):r>=90&&r<=97?t.push({type:"setForegroundColor",value:{type:"named",name:K[r-90+8]}}):r>=100&&r<=107&&t.push({type:"setBackgroundColor",value:{type:"named",name:K[r-100+8]}})}return t}function oi(){let e=null,t=null,n=new Set;return{parse(r){const s=[];let o=0;do{const i=ri(r,o),a=i.sequence?r.substring(o,i.startPosition):r.substring(o);if(a.length>0&&s.push({value:a,foreground:e,background:t,decorations:new Set(n)}),i.sequence){const c=si(i.sequence);for(const l of c)l.type==="resetAll"?(e=null,t=null,n.clear()):l.type==="resetForegroundColor"?e=null:l.type==="resetBackgroundColor"?t=null:l.type==="resetDecoration"&&n.delete(l.value);for(const l of c)l.type==="setForegroundColor"?e=l.value:l.type==="setBackgroundColor"?t=l.value:l.type==="setDecoration"&&n.add(l.value)}o=i.position}while(o<r.length);return s}}}var ii={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 ai(e=ii){function t(a){return e[a]}function n(a){return`#${a.map(c=>Math.max(0,Math.min(c,255)).toString(16).padStart(2,"0")).join("")}`}let r;function s(){if(r)return r;r=[];for(let l=0;l<K.length;l++)r.push(t(K[l]));let a=[0,95,135,175,215,255];for(let l=0;l<6;l++)for(let u=0;u<6;u++)for(let h=0;h<6;h++)r.push(n([a[l],a[u],a[h]]));let c=8;for(let l=0;l<24;l++,c+=10)r.push(n([c,c,c]));return r}function o(a){return s()[a]}function i(a){switch(a.type){case"named":return t(a.name);case"rgb":return n(a.rgb);case"table":return o(a.index)}}return{value:i}}const ci=/#([0-9a-f]{3,8})/i,li=/var\((--[\w-]+-ansi-[\w-]+)\)/,ui={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 hi(e,t,n){const r=Te(e,n),s=Ue(t),o=ai(Object.fromEntries(K.map(a=>{const c=`terminal.ansi${a[0].toUpperCase()}${a.substring(1)}`;return[a,e.colors?.[c]||ui[a]]}))),i=oi();return s.map(a=>i.parse(a[0]).map(c=>{let l,u;c.decorations.has("reverse")?(l=c.background?o.value(c.background):e.bg,u=c.foreground?o.value(c.foreground):e.fg):(l=c.foreground?o.value(c.foreground):e.fg,u=c.background?o.value(c.background):void 0),l=q(l,r),u=q(u,r),c.decorations.has("dim")&&(l=fi(l));let h=R.None;return c.decorations.has("bold")&&(h|=R.Bold),c.decorations.has("italic")&&(h|=R.Italic),c.decorations.has("underline")&&(h|=R.Underline),c.decorations.has("strikethrough")&&(h|=R.Strikethrough),{content:c.value,offset:a[1],color:l,bgColor:u,fontStyle:h}}))}function fi(e){const t=e.match(ci);if(t){const r=t[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],a=r[3];return`#${s}${s}${o}${o}${i}${i}${Math.round(Number.parseInt(`${a}${a}`,16)/2).toString(16).padStart(2,"0")}`}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=e.match(li);return n?`var(${n[1]}-dim)`:e}function Ct(e,t,n={}){const r=e.resolveLangAlias(n.lang||"text"),{theme:s=e.getLoadedThemes()[0]}=n;if(!De(r)&&!je(s)&&r==="ansi"){const{theme:o}=e.setTheme(s);return hi(o,t,n)}return Zn(e,t,n)}function Oe(e,t,n){let r,s,o,i,a,c;if("themes"in n){const{defaultColor:l="light",cssVariablePrefix:u="--shiki-",colorsRendering:h="css-vars"}=n,f=Object.entries(n.themes).filter(g=>g[1]).map(g=>({color:g[0],theme:g[1]})).sort((g,m)=>g.color===l?-1:m.color===l?1:0);if(f.length===0)throw new k("`themes` option must not be empty");const d=Jn(e,t,n,Ct);if(c=me(d),l&&l!=="light-dark()"&&!f.some(g=>g.color===l))throw new k(`\`themes\` option must contain the defaultColor key \`${l}\``);const p=f.map(g=>e.getTheme(g.theme)),y=f.map(g=>g.color);o=d.map(g=>g.map(m=>Jo(m,y,u,l,h))),c&&We(o,c);const b=f.map(g=>Te(g.theme,n));s=an(f,p,b,u,l,"fg",h),r=an(f,p,b,u,l,"bg",h),i=`shiki-themes ${p.map(g=>g.name).join(" ")}`,a=l?void 0:[s,r].join(";")}else if("theme"in n){const l=Te(n.theme,n);o=Ct(e,t,n);const u=e.getTheme(n.theme);r=q(u.bg,l),s=q(u.fg,l),i=u.name,c=me(o)}else throw new k("Invalid options, either `theme` or `themes` must be provided");return{tokens:o,fg:s,bg:r,themeName:i,rootStyle:a,grammarState:c}}function an(e,t,n,r,s,o,i){return e.map((a,c)=>{const l=q(t[c][o],n[c])||"inherit",u=`${r+a.color}${o==="bg"?"-bg":""}:${l}`;if(c===0&&s){if(s==="light-dark()"&&e.length>1){const h=e.findIndex(d=>d.color==="light"),f=e.findIndex(d=>d.color==="dark");if(h===-1||f===-1)throw new k('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');return`light-dark(${q(t[h][o],n[h])||"inherit"}, ${q(t[f][o],n[f])||"inherit"});${u}`}return l}return i==="css-vars"?u:null}).filter(a=>!!a).join(";")}const ir=/^\s+$/,di=/^(\s*)(.*?)(\s*)$/;function Be(e,t,n,r={meta:{},options:n,codeToHast:(s,o)=>Be(e,s,o),codeToTokens:(s,o)=>Oe(e,s,o)}){let s=t;for(const p of Me(n))s=p.preprocess?.call(r,s,n)||s;let{tokens:o,fg:i,bg:a,themeName:c,rootStyle:l,grammarState:u}=Oe(e,s,n);const{mergeWhitespaces:h=!0,mergeSameStyleTokens:f=!1}=n;h===!0?o=gi(o):h==="never"&&(o=mi(o)),f&&(o=yi(o));const d={...r,get source(){return s}};for(const p of Me(n))o=p.tokens?.call(d,o)||o;return pi(o,{...n,fg:i,bg:a,themeName:c,rootStyle:n.rootStyle===!1?!1:n.rootStyle??l},d,u)}function pi(e,t,n,r=me(e)){const s=Me(t),o=[],i={type:"root",children:[]},{structure:a="classic",tabindex:c="0"}=t,l={class:`shiki ${t.themeName||""}`};t.rootStyle!==!1&&(t.rootStyle!=null?l.style=t.rootStyle:l.style=`background-color:${t.bg};color:${t.fg}`),c!==!1&&c!=null&&(l.tabindex=c.toString());for(const[y,b]of Object.entries(t.meta||{}))y.startsWith("_")||(l[y]=b);let u={type:"element",tagName:"pre",properties:l,children:[],data:t.data},h={type:"element",tagName:"code",properties:{},children:o};const f=[],d={...n,structure:a,addClassToHast:sr,get source(){return n.source},get tokens(){return e},get options(){return t},get root(){return i},get pre(){return u},get code(){return h},get lines(){return f}};if(e.forEach((y,b)=>{b&&(a==="inline"?i.children.push({type:"element",tagName:"br",properties:{},children:[]}):a==="classic"&&o.push({type:"text",value:`
12
+ `}));let g={type:"element",tagName:"span",properties:{class:"line"},children:[]},m=0;for(const _ of y){let C={type:"element",tagName:"span",properties:{..._.htmlAttrs},children:[{type:"text",value:_.content}]};const S=wt(_.htmlStyle||Ge(_));S&&(C.properties.style=S);for(const v of s)C=v?.span?.call(d,C,b+1,m,g,_)||C;a==="inline"?i.children.push(C):a==="classic"&&g.children.push(C),m+=_.content.length}if(a==="classic"){for(const _ of s)g=_?.line?.call(d,g,b+1)||g;f.push(g),o.push(g)}else a==="inline"&&f.push(g)}),a==="classic"){for(const y of s)h=y?.code?.call(d,h)||h;u.children.push(h);for(const y of s)u=y?.pre?.call(d,u)||u;i.children.push(u)}else if(a==="inline"){const y=[];let b={type:"element",tagName:"span",properties:{class:"line"},children:[]};for(const m of i.children)m.type==="element"&&m.tagName==="br"?(y.push(b),b={type:"element",tagName:"span",properties:{class:"line"},children:[]}):(m.type==="element"||m.type==="text")&&b.children.push(m);y.push(b);let g={type:"element",tagName:"code",properties:{},children:y};for(const m of s)g=m?.code?.call(d,g)||g;i.children=[];for(let m=0;m<g.children.length;m++){m>0&&i.children.push({type:"element",tagName:"br",properties:{},children:[]});const _=g.children[m];_.type==="element"&&i.children.push(..._.children)}}let p=i;for(const y of s)p=y?.root?.call(d,p)||p;return r&&We(p,r),p}function gi(e){return e.map(t=>{const n=[];let r="",s;return t.forEach((o,i)=>{const a=!(o.fontStyle&&(o.fontStyle&R.Underline||o.fontStyle&R.Strikethrough));a&&ir.test(o.content)&&t[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 mi(e){return e.map(t=>t.flatMap(n=>{if(ir.test(n.content))return n;const r=n.content.match(di);if(!r)return n;const[,s,o,i]=r;if(!s&&!i)return n;const a=[{...n,offset:n.offset+s.length,content:o}];return s&&a.unshift({content:s,offset:n.offset}),i&&a.push({content:i,offset:n.offset+s.length+o.length}),a}))}function yi(e){return e.map(t=>{const n=[];for(const r of t){if(n.length===0){n.push({...r});continue}const s=n.at(-1),o=wt(s.htmlStyle||Ge(s)),i=wt(r.htmlStyle||Ge(r)),a=s.fontStyle&&(s.fontStyle&R.Underline||s.fontStyle&R.Strikethrough),c=r.fontStyle&&(r.fontStyle&R.Underline||r.fontStyle&R.Strikethrough);!a&&!c&&o===i?s.content+=r.content:n.push({...r})}return n})}const bi=Ho;function _i(e,t,n){const r={meta:{},options:n,codeToHast:(o,i)=>Be(e,o,i),codeToTokens:(o,i)=>Oe(e,o,i)};let s=bi(Be(e,t,n,r));for(const o of Me(n))s=o.postprocess?.call(r,s,n)||s;return s}async function wi(e){const t=await Ls(e);return{getLastGrammarState:(...n)=>Os(t,...n),codeToTokensBase:(n,r)=>Ct(t,n,r),codeToTokensWithThemes:(n,r)=>Jn(t,n,r),codeToTokens:(n,r)=>Oe(t,n,r),codeToHast:(n,r)=>Be(t,n,r),codeToHtml:(n,r)=>_i(t,n,r),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}const cn=4294967295;var Ci=class{patterns;options;regexps;constructor(e,t={}){this.patterns=e,this.options=t;const{forgiving:n=!1,cache:r,regexConstructor:s}=t;if(!s)throw new Error("Option `regexConstructor` is not provided");this.regexps=e.map(o=>{if(typeof o!="string")return o;const i=r?.get(o);if(i){if(i instanceof RegExp)return i;if(n)return null;throw i}try{const a=s(o);return r?.set(o,a),a}catch(a){if(r?.set(o,a),n)return null;throw a}})}findNextMatchSync(e,t,n){const r=typeof e=="string"?e:e.content,s=[];function o(i,a,c=0){return{index:i,captureIndices:a.indices.map(l=>l==null?{start:cn,end:cn,length:0}:{start:l[0]+c,end:l[1]+c,length:l[1]-l[0]})}}for(let i=0;i<this.regexps.length;i++){const a=this.regexps[i];if(a)try{a.lastIndex=t;const c=a.exec(r);if(!c)continue;if(c.index===t)return o(i,c,0);s.push([i,c,0])}catch(c){if(this.options.forgiving)continue;throw c}}if(s.length){const i=Math.min(...s.map(a=>a[1].index));for(const[a,c,l]of s)if(c.index===i)return o(a,c,l)}return null}};function ae(e){if([...e].length!==1)throw new Error(`Expected "${e}" to be a single code point`);return e.codePointAt(0)}function Si(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}const Pt=new Set(["alnum","alpha","ascii","blank","cntrl","digit","graph","lower","print","punct","space","upper","word","xdigit"]),I=String.raw;function ce(e,t){if(e==null)throw new Error(t??"Value expected");return e}const ar=I`\[\^?`,cr=`c.? | C(?:-.?)?|${I`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${I`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${I`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${I`o\{[^\}]*\}?`}|${I`\d{1,3}`}`,Tt=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,ke=new RegExp(I`
13
+ \\ (?:
14
+ ${cr}
15
+ | [gk]<[^>]*>?
16
+ | [gk]'[^']*'?
17
+ | .
18
+ )
19
+ | \( (?:
20
+ \? (?:
21
+ [:=!>({]
22
+ | <[=!]
23
+ | <[^>]*>
24
+ | '[^']*'
25
+ | ~\|?
26
+ | #(?:[^)\\]|\\.?)*
27
+ | [^:)]*[:)]
28
+ )?
29
+ | \*[^\)]*\)?
30
+ )?
31
+ | (?:${Tt.source})+
32
+ | ${ar}
33
+ | .
34
+ `.replace(/\s+/g,""),"gsu"),st=new RegExp(I`
35
+ \\ (?:
36
+ ${cr}
37
+ | .
38
+ )
39
+ | \[:(?:\^?\p{Alpha}+|\^):\]
40
+ | ${ar}
41
+ | &&
42
+ | .
43
+ `.replace(/\s+/g,""),"gsu");function ki(e,t={}){const n={flags:"",...t,rules:{captureGroup:!1,singleline:!1,...t.rules}};if(typeof e!="string")throw new Error("String expected as pattern");const r=Ui(n.flags),s=[r.extended],o={captureGroup:n.rules.captureGroup,getCurrentModX(){return s.at(-1)},numOpenGroups:0,popModX(){s.pop()},pushModX(h){s.push(h)},replaceCurrentModX(h){s[s.length-1]=h},singleline:n.rules.singleline};let i=[],a;for(ke.lastIndex=0;a=ke.exec(e);){const h=xi(o,e,a[0],ke.lastIndex);h.tokens?i.push(...h.tokens):h.token&&i.push(h.token),h.lastIndex!==void 0&&(ke.lastIndex=h.lastIndex)}const c=[];let l=0;i.filter(h=>h.type==="GroupOpen").forEach(h=>{h.kind==="capturing"?h.number=++l:h.raw==="("&&c.push(h)}),l||c.forEach((h,f)=>{h.kind="capturing",h.number=f+1});const u=l||c.length;return{tokens:i.map(h=>h.type==="EscapedNumber"?zi(h,u):h).flat(),flags:r}}function xi(e,t,n,r){const[s,o]=n;if(n==="["||n==="[^"){const i=Ai(t,n,r);return{tokens:i.tokens,lastIndex:i.lastIndex}}if(s==="\\"){if("AbBGyYzZ".includes(o))return{token:ln(n,n)};if(/^\\g[<']/.test(n)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(n))throw new Error(`Invalid group name "${n}"`);return{token:Gi(n)}}if(/^\\k[<']/.test(n)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(n))throw new Error(`Invalid group name "${n}"`);return{token:ur(n)}}if(o==="K")return{token:hr("keep",n)};if(o==="N"||o==="R")return{token:Z("newline",n,{negate:o==="N"})};if(o==="O")return{token:Z("any",n)};if(o==="X")return{token:Z("text_segment",n)};const i=lr(n,{inCharClass:!1});return Array.isArray(i)?{tokens:i}:{token:i}}if(s==="("){if(o==="*")return{token:Fi(n)};if(n==="(?{")throw new Error(`Unsupported callout "${n}"`);if(n.startsWith("(?#")){if(t[r]!==")")throw new Error('Unclosed comment group "(?#"');return{lastIndex:r+1}}if(/^\(\?[-imx]+[:)]$/.test(n))return{token:Bi(n,e)};if(e.pushModX(e.getCurrentModX()),e.numOpenGroups++,n==="("&&!e.captureGroup||n==="(?:")return{token:se("group",n)};if(n==="(?>")return{token:se("atomic",n)};if(n==="(?="||n==="(?!"||n==="(?<="||n==="(?<!")return{token:se(n[2]==="<"?"lookbehind":"lookahead",n,{negate:n.endsWith("!")})};if(n==="("&&e.captureGroup||n.startsWith("(?<")&&n.endsWith(">")||n.startsWith("(?'")&&n.endsWith("'"))return{token:se("capturing",n,{...n!=="("&&{name:n.slice(3,-1)}})};if(n.startsWith("(?~")){if(n==="(?~|")throw new Error(`Unsupported absence function kind "${n}"`);return{token:se("absence_repeater",n)}}throw n==="(?("?new Error(`Unsupported conditional "${n}"`):new Error(`Invalid or unsupported group option "${n}"`)}if(n===")"){if(e.popModX(),e.numOpenGroups--,e.numOpenGroups<0)throw new Error('Unmatched ")"');return{token:Li(n)}}if(e.getCurrentModX()){if(n==="#"){const i=t.indexOf(`
44
+ `,r);return{lastIndex:i===-1?t.length:i}}if(/^\s$/.test(n)){const i=/\s+/y;return i.lastIndex=r,{lastIndex:i.exec(t)?i.lastIndex:r}}}if(n===".")return{token:Z("dot",n)};if(n==="^"||n==="$"){const i=e.singleline?{"^":I`\A`,$:I`\Z`}[n]:n;return{token:ln(i,n)}}return n==="|"?{token:Ii(n)}:Tt.test(n)?{tokens:Hi(n)}:{token:W(ae(n),n)}}function Ai(e,t,n){const r=[un(t[1]==="^",t)];let s=1,o;for(st.lastIndex=n;o=st.exec(e);){const i=o[0];if(i[0]==="["&&i[1]!==":")s++,r.push(un(i[1]==="^",i));else if(i==="]"){if(r.at(-1).type==="CharacterClassOpen")r.push(W(93,i));else if(s--,r.push(vi(i)),!s)break}else{const a=Ei(i);Array.isArray(a)?r.push(...a):r.push(a)}}return{tokens:r,lastIndex:st.lastIndex||e.length}}function Ei(e){if(e[0]==="\\")return lr(e,{inCharClass:!0});if(e[0]==="["){const t=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(e);if(!t||!Pt.has(t.groups.name))throw new Error(`Invalid POSIX class "${e}"`);return Z("posix",e,{value:t.groups.name,negate:!!t.groups.negate})}return e==="-"?Ni(e):e==="&&"?Ri(e):W(ae(e),e)}function lr(e,{inCharClass:t}){const n=e[1];if(n==="c"||n==="C")return Oi(e);if("dDhHsSwW".includes(n))return Di(e);if(e.startsWith(I`\o{`))throw new Error(`Incomplete, invalid, or unsupported octal code point "${e}"`);if(/^\\[pP]\{/.test(e)){if(e.length===3)throw new Error(`Incomplete or invalid Unicode property "${e}"`);return ji(e)}if(new RegExp("^\\\\x[89A-Fa-f]\\p{AHex}","u").test(e))try{const r=e.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 a=[...o.encode(i)].map(c=>`\\x${c.toString(16)}`).join("");return W(ae(i),a)})}catch{throw new Error(`Multibyte code "${e}" incomplete or invalid in Oniguruma`)}if(n==="u"||n==="x")return W(Wi(e),e);if(hn.has(n))return W(hn.get(n),e);if(/\d/.test(n))return $i(t,e);if(e==="\\")throw new Error(I`Incomplete escape "\"`);if(n==="M")throw new Error(`Unsupported meta "${e}"`);if([...e].length===2)return W(e.codePointAt(1),e);throw new Error(`Unexpected escape "${e}"`)}function Ii(e){return{type:"Alternator",raw:e}}function ln(e,t){return{type:"Assertion",kind:e,raw:t}}function ur(e){return{type:"Backreference",raw:e}}function W(e,t){return{type:"Character",value:e,raw:t}}function vi(e){return{type:"CharacterClassClose",raw:e}}function Ni(e){return{type:"CharacterClassHyphen",raw:e}}function Ri(e){return{type:"CharacterClassIntersector",raw:e}}function un(e,t){return{type:"CharacterClassOpen",negate:e,raw:t}}function Z(e,t,n={}){return{type:"CharacterSet",kind:e,...n,raw:t}}function hr(e,t,n={}){return e==="keep"?{type:"Directive",kind:e,raw:t}:{type:"Directive",kind:e,flags:ce(n.flags),raw:t}}function $i(e,t){return{type:"EscapedNumber",inCharClass:e,raw:t}}function Li(e){return{type:"GroupClose",raw:e}}function se(e,t,n={}){return{type:"GroupOpen",kind:e,...n,raw:t}}function Pi(e,t,n,r){return{type:"NamedCallout",kind:e,tag:t,arguments:n,raw:r}}function Ti(e,t,n,r){return{type:"Quantifier",kind:e,min:t,max:n,raw:r}}function Gi(e){return{type:"Subroutine",raw:e}}const Mi=new Set(["COUNT","CMP","ERROR","FAIL","MAX","MISMATCH","SKIP","TOTAL_COUNT"]),hn=new Map([["a",7],["b",8],["e",27],["f",12],["n",10],["r",13],["t",9],["v",11]]);function Oi(e){const t=e[1]==="c"?e[2]:e[3];if(!t||!/[A-Za-z]/.test(t))throw new Error(`Unsupported control character "${e}"`);return W(ae(t.toUpperCase())-64,e)}function Bi(e,t){let{on:n,off:r}=/^\(\?(?<on>[imx]*)(?:-(?<off>[-imx]*))?/.exec(e).groups;r??="";const s=(t.getCurrentModX()||n.includes("x"))&&!r.includes("x"),o=dn(n),i=dn(r),a={};if(o&&(a.enable=o),i&&(a.disable=i),e.endsWith(")"))return t.replaceCurrentModX(s),hr("flags",e,{flags:a});if(e.endsWith(":"))return t.pushModX(s),t.numOpenGroups++,se("group",e,{...(o||i)&&{flags:a}});throw new Error(`Unexpected flag modifier "${e}"`)}function Fi(e){const t=/\(\*(?<name>[A-Za-z_]\w*)?(?:\[(?<tag>(?:[A-Za-z_]\w*)?)\])?(?:\{(?<args>[^}]*)\})?\)/.exec(e);if(!t)throw new Error(`Incomplete or invalid named callout "${e}"`);const{name:n,tag:r,args:s}=t.groups;if(!n)throw new Error(`Invalid named callout "${e}"`);if(r==="")throw new Error(`Named callout tag with empty value not allowed "${e}"`);const o=s?s.split(",").filter(u=>u!=="").map(u=>/^[+-]?\d+$/.test(u)?+u:u):[],[i,a,c]=o,l=Mi.has(n)?n.toLowerCase():"custom";switch(l){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 a=="number"||!/^[<>X]$/.test(a)))throw new Error(`Named callout optional argument two must be '<', '>', or 'X' "${a}"`);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 a=="number"||!/^(?:[<>!=]=|[<>])$/.test(a))throw new Error(`Named callout argument two must be '==', '!=', '>', '<', '>=', or '<=' "${a}"`);if(typeof c=="string"&&!/^[A-Za-z_]\w*$/.test(c))throw new Error(`Named callout argument three must be a tag or number "${c}"`);break;case"custom":throw new Error(`Undefined callout name "${n}"`);default:throw new Error(`Unexpected named callout kind "${l}"`)}return Pi(l,r??null,s?.split(",")??null,e)}function fn(e){let t=null,n,r;if(e[0]==="{"){const{minStr:s,maxStr:o}=/^\{(?<minStr>\d*)(?:,(?<maxStr>\d*))?/.exec(e).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&&(t="possessive",[n,r]=[r,n]),e.endsWith("?")){if(t==="possessive")throw new Error('Unsupported possessive interval quantifier chain with "?"');t="lazy"}else t||(t="greedy")}else n=e[0]==="+"?1:0,r=e[0]==="?"?1:1/0,t=e[1]==="+"?"possessive":e[1]==="?"?"lazy":"greedy";return Ti(t,n,r,e)}function Di(e){const t=e[1].toLowerCase();return Z({d:"digit",h:"hex",s:"space",w:"word"}[t],e,{negate:e[1]!==t})}function ji(e){const{p:t,neg:n,value:r}=/^\\(?<p>[pP])\{(?<neg>\^?)(?<value>[^}]+)/.exec(e).groups;return Z("property",e,{value:r,negate:t==="P"&&!n||t==="p"&&!!n})}function dn(e){const t={};return e.includes("i")&&(t.ignoreCase=!0),e.includes("m")&&(t.dotAll=!0),e.includes("x")&&(t.extended=!0),Object.keys(t).length?t:null}function Ui(e){const t={ignoreCase:!1,dotAll:!1,extended:!1,digitIsAscii:!1,posixIsAscii:!1,spaceIsAscii:!1,wordIsAscii:!1,textSegmentMode:null};for(let n=0;n<e.length;n++){const r=e[n];if(!"imxDPSWy".includes(r))throw new Error(`Invalid flag "${r}"`);if(r==="y"){if(!/^y{[gw]}/.test(e.slice(n)))throw new Error('Invalid or unspecified flag "y" mode');t.textSegmentMode=e[n+2]==="g"?"grapheme":"word",n+=3;continue}t[{i:"ignoreCase",m:"dotAll",x:"extended",D:"digitIsAscii",P:"posixIsAscii",S:"spaceIsAscii",W:"wordIsAscii"}[r]]=!0}return t}function Wi(e){if(new RegExp("^(?:\\\\u(?!\\p{AHex}{4})|\\\\x(?!\\p{AHex}{1,2}|\\{\\p{AHex}{1,8}\\}))","u").test(e))throw new Error(`Incomplete or invalid escape "${e}"`);const t=e[2]==="{"?new RegExp("^\\\\x\\{\\s*(?<hex>\\p{AHex}+)","u").exec(e).groups.hex:e.slice(2);return parseInt(t,16)}function zi(e,t){const{raw:n,inCharClass:r}=e,s=n.slice(1);if(!r&&(s!=="0"&&s.length===1||s[0]!=="0"&&+s<=t))return[ur(n)];const o=[],i=s.match(/^[0-7]+|\d/g);for(let a=0;a<i.length;a++){const c=i[a];let l;if(a===0&&c!=="8"&&c!=="9"){if(l=parseInt(c,8),l>127)throw new Error(I`Octal encoded byte above 177 unsupported "${n}"`)}else l=ae(c);o.push(W(l,(a===0?"\\":"")+c))}return o}function Hi(e){const t=[],n=new RegExp(Tt,"gy");let r;for(;r=n.exec(e);){const s=r[0];if(s[0]==="{"){const o=/^\{(?<min>\d+),(?<max>\d+)\}\??$/.exec(s);if(o){const{min:i,max:a}=o.groups;if(+i>+a&&s.endsWith("?")){n.lastIndex--,t.push(fn(s.slice(0,-1)));continue}}}t.push(fn(s))}return t}function fr(e,t){if(!Array.isArray(e.body))throw new Error("Expected node with body array");if(e.body.length!==1)return!1;const n=e.body[0];return!t||Object.keys(t).every(r=>t[r]===n[r])}function qi(e){return Vi.has(e.type)}const Vi=new Set(["AbsenceFunction","Backreference","CapturingGroup","Character","CharacterClass","CharacterSet","Group","Quantifier","Subroutine"]);function dr(e,t={}){const n={flags:"",normalizeUnknownPropertyNames:!1,skipBackrefValidation:!1,skipLookbehindValidation:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}},r=ki(e,{flags:n.flags,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline}}),s=(f,d)=>{const p=r.tokens[o.nextIndex];switch(o.parent=f,o.nextIndex++,p.type){case"Alternator":return Y();case"Assertion":return Xi(p);case"Backreference":return Qi(p,o);case"Character":return He(p.value,{useLastValid:!!d.isCheckingRangeEnd});case"CharacterClassHyphen":return Ki(p,o,d);case"CharacterClassOpen":return Zi(p,o,d);case"CharacterSet":return Ji(p,o);case"Directive":return sa(p.kind,{flags:p.flags});case"GroupOpen":return Yi(p,o,d);case"NamedCallout":return ia(p.kind,p.tag,p.arguments);case"Quantifier":return ea(p,o);case"Subroutine":return ta(p,o);default:throw new Error(`Unexpected token type "${p.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=ca(oa(r.flags));let a=i.body[0];for(;o.nextIndex<r.tokens.length;){const f=s(a,{});f.type==="Alternative"?(i.body.push(f),a=f):a.body.push(f)}const{capturingGroups:c,hasNumberedRef:l,namedGroupsByName:u,subroutines:h}=o;if(l&&u.size&&!n.rules.captureGroup)throw new Error("Numbered backref/subroutine not allowed when using named capture");for(const{ref:f}of h)if(typeof f=="number"){if(f>c.length)throw new Error("Subroutine uses a group number that's not defined");f&&(c[f-1].isSubroutined=!0)}else if(u.has(f)){if(u.get(f).length>1)throw new Error(I`Subroutine uses a duplicate group name "\g<${f}>"`);u.get(f)[0].isSubroutined=!0}else throw new Error(I`Subroutine uses a group name that's not defined "\g<${f}>"`);return i}function Xi({kind:e}){return St(ce({"^":"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"}[e],`Unexpected assertion kind "${e}"`),{negate:e===I`\B`||e===I`\Y`})}function Qi({raw:e},t){const n=/^\\k[<']/.test(e),r=n?e.slice(3,-1):e.slice(1),s=(o,i=!1)=>{const a=t.capturingGroups.length;let c=!1;if(o>a)if(t.skipBackrefValidation)c=!0;else throw new Error(`Not enough capturing groups defined to the left "${e}"`);return t.hasNumberedRef=!0,kt(i?a+1-o:o,{orphan:c})};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 "${e}"`);if(!t.namedGroupsByName.has(r))throw new Error(`Group name not defined to the left "${e}"`);return kt(r)}return s(+r)}function Ki(e,t,n){const{tokens:r,walk:s}=t,o=t.parent,i=o.body.at(-1),a=r[t.nextIndex];if(!n.isCheckingRangeEnd&&i&&i.type!=="CharacterClass"&&i.type!=="CharacterClassRange"&&a&&a.type!=="CharacterClassOpen"&&a.type!=="CharacterClassClose"&&a.type!=="CharacterClassIntersector"){const c=s(o,{...n,isCheckingRangeEnd:!0});if(i.type==="Character"&&c.type==="Character")return o.body.pop(),ra(i,c);throw new Error("Invalid character class range")}return He(ae("-"))}function Zi({negate:e},t,n){const{tokens:r,walk:s}=t,o=[ve()],i=r[t.nextIndex];let a=mn(i);for(;a.type!=="CharacterClassClose";){if(a.type==="CharacterClassIntersector")o.push(ve()),t.nextIndex++;else{const l=o.at(-1);l.body.push(s(l,n))}a=mn(r[t.nextIndex],i)}const c=ve({negate:e});return o.length===1?c.body=o[0].body:(c.kind="intersection",c.body=o.map(l=>l.body.length===1?l.body[0]:l)),t.nextIndex++,c}function Ji({kind:e,negate:t,value:n},r){const{normalizeUnknownPropertyNames:s,skipPropertyNameValidation:o,unicodePropertyMap:i}=r;if(e==="property"){const a=qe(n);if(Pt.has(a)&&!i?.has(a))e="posix",n=a;else return oe(n,{negate:t,normalizeUnknownPropertyNames:s,skipPropertyNameValidation:o,unicodePropertyMap:i})}return e==="posix"?aa(n,{negate:t}):xt(e,{negate:t})}function Yi(e,t,n){const{tokens:r,capturingGroups:s,namedGroupsByName:o,skipLookbehindValidation:i,walk:a}=t,c=la(e),l=c.type==="AbsenceFunction",u=gn(c),h=u&&c.negate;if(c.type==="CapturingGroup"&&(s.push(c),c.name&&Si(o,c.name,[]).push(c)),l&&n.isInAbsenceFunction)throw new Error("Nested absence function not supported by Oniguruma");let f=yn(r[t.nextIndex]);for(;f.type!=="GroupClose";){if(f.type==="Alternator")c.body.push(Y()),t.nextIndex++;else{const d=c.body.at(-1),p=a(d,{...n,isInAbsenceFunction:n.isInAbsenceFunction||l,isInLookbehind:n.isInLookbehind||u,isInNegLookbehind:n.isInNegLookbehind||h});if(d.body.push(p),(u||n.isInLookbehind)&&!i){const y="Lookbehind includes a pattern not allowed by Oniguruma";if(h||n.isInNegLookbehind){if(pn(p)||p.type==="CapturingGroup")throw new Error(y)}else if(pn(p)||gn(p)&&p.negate)throw new Error(y)}}f=yn(r[t.nextIndex])}return t.nextIndex++,c}function ea({kind:e,min:t,max:n},r){const s=r.parent,o=s.body.at(-1);if(!o||!qi(o))throw new Error("Quantifier requires a repeatable token");const i=gr(e,t,n,o);return s.body.pop(),i}function ta({raw:e},t){const{capturingGroups:n,subroutines:r}=t;let s=e.slice(3,-1);const o=/^(?<sign>[-+]?)0*(?<num>[1-9]\d*)$/.exec(s);if(o){const a=+o.groups.num,c=n.length;if(t.hasNumberedRef=!0,s={"":a,"+":c+a,"-":c+1-a}[o.groups.sign],s<1)throw new Error("Invalid subroutine number")}else s==="0"&&(s=0);const i=mr(s);return r.push(i),i}function na(e,t){return{type:"AbsenceFunction",kind:e,body:_e(t?.body)}}function Y(e){return{type:"Alternative",body:yr(e?.body)}}function St(e,t){const n={type:"Assertion",kind:e};return(e==="word_boundary"||e==="text_segment_boundary")&&(n.negate=!!t?.negate),n}function kt(e,t){const n=!!t?.orphan;return{type:"Backreference",ref:e,...n&&{orphan:n}}}function pr(e,t){const n={name:void 0,isSubroutined:!1,...t};if(n.name!==void 0&&!ua(n.name))throw new Error(`Group name "${n.name}" invalid in Oniguruma`);return{type:"CapturingGroup",number:e,...n.name&&{name:n.name},...n.isSubroutined&&{isSubroutined:n.isSubroutined},body:_e(t?.body)}}function He(e,t){const n={useLastValid:!1,...t};if(e>1114111){const r=e.toString(16);if(n.useLastValid)e=1114111;else throw e>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:e}}function ve(e){const t={kind:"union",negate:!1,...e};return{type:"CharacterClass",kind:t.kind,negate:t.negate,body:yr(e?.body)}}function ra(e,t){if(t.value<e.value)throw new Error("Character class range out of order");return{type:"CharacterClassRange",min:e,max:t}}function xt(e,t){const n=!!t?.negate,r={type:"CharacterSet",kind:e};return(e==="digit"||e==="hex"||e==="newline"||e==="space"||e==="word")&&(r.negate=n),(e==="text_segment"||e==="newline"&&!n)&&(r.variableLength=!0),r}function sa(e,t={}){if(e==="keep")return{type:"Directive",kind:e};if(e==="flags")return{type:"Directive",kind:e,flags:ce(t.flags)};throw new Error(`Unexpected directive kind "${e}"`)}function oa(e){return{type:"Flags",...e}}function G(e){const t=e?.atomic,n=e?.flags;if(t&&n)throw new Error("Atomic group cannot have flags");return{type:"Group",...t&&{atomic:t},...n&&{flags:n},body:_e(e?.body)}}function Q(e){const t={behind:!1,negate:!1,...e};return{type:"LookaroundAssertion",kind:t.behind?"lookbehind":"lookahead",negate:t.negate,body:_e(e?.body)}}function ia(e,t,n){return{type:"NamedCallout",kind:e,tag:t,arguments:n}}function aa(e,t){const n=!!t?.negate;if(!Pt.has(e))throw new Error(`Invalid POSIX class "${e}"`);return{type:"CharacterSet",kind:"posix",value:e,negate:n}}function gr(e,t,n,r){if(t>n)throw new Error("Invalid reversed quantifier range");return{type:"Quantifier",kind:e,min:t,max:n,body:r}}function ca(e,t){return{type:"Regex",body:_e(t?.body),flags:e}}function mr(e){return{type:"Subroutine",ref:e}}function oe(e,t){const n={negate:!1,normalizeUnknownPropertyNames:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t};let r=n.unicodePropertyMap?.get(qe(e));if(!r){if(n.normalizeUnknownPropertyNames)r=ha(e);else if(n.unicodePropertyMap&&!n.skipPropertyNameValidation)throw new Error(I`Invalid Unicode property "\p{${e}}"`)}return{type:"CharacterSet",kind:"property",value:r??e,negate:n.negate}}function la({flags:e,kind:t,name:n,negate:r,number:s}){switch(t){case"absence_repeater":return na("repeater");case"atomic":return G({atomic:!0});case"capturing":return pr(s,{name:n});case"group":return G({flags:e});case"lookahead":case"lookbehind":return Q({behind:t==="lookbehind",negate:r});default:throw new Error(`Unexpected group kind "${t}"`)}}function _e(e){if(e===void 0)e=[Y()];else if(!Array.isArray(e)||!e.length||!e.every(t=>t.type==="Alternative"))throw new Error("Invalid body; expected array of one or more Alternative nodes");return e}function yr(e){if(e===void 0)e=[];else if(!Array.isArray(e)||!e.every(t=>!!t.type))throw new Error("Invalid body; expected array of nodes");return e}function pn(e){return e.type==="LookaroundAssertion"&&e.kind==="lookahead"}function gn(e){return e.type==="LookaroundAssertion"&&e.kind==="lookbehind"}function ua(e){return/^[\p{Alpha}\p{Pc}][^)]*$/u.test(e)}function ha(e){return e.trim().replace(/[- _]+/g,"_").replace(/[A-Z][a-z]+(?=[A-Z])/g,"$&_").replace(/[A-Za-z]+/g,t=>t[0].toUpperCase()+t.slice(1).toLowerCase())}function qe(e){return e.replace(/[- _]+/g,"").toLowerCase()}function mn(e,t){const n=t;return ce(e,`Unclosed character class${n?.type==="Character"&&n.value===93&&n.raw==="]"?' (started with "]")':""}`)}function yn(e){return ce(e,"Unclosed group")}function fe(e,t,n=null){function r(o,i){for(let a=0;a<o.length;a++){const c=s(o[a],i,a,o);a=Math.max(-1,a+c)}}function s(o,i=null,a=null,c=null){let l=0,u=!1;const h={node:o,parent:i,key:a,container:c,root:e,remove(){xe(c).splice(Math.max(0,ne(a)+l),1),l--,u=!0},removeAllNextSiblings(){return xe(c).splice(ne(a)+1)},removeAllPrevSiblings(){const g=ne(a)+l;return l-=g,xe(c).splice(0,Math.max(0,g))},replaceWith(g,m={}){const _=!!m.traverse;c?c[Math.max(0,ne(a)+l)]=g:ce(i,"Can't replace root node")[a]=g,_&&s(g,i,a,c),u=!0},replaceWithMultiple(g,m={}){const _=!!m.traverse;if(xe(c).splice(Math.max(0,ne(a)+l),1,...g),l+=g.length-1,_){let C=0;for(let S=0;S<g.length;S++)C+=s(g[S],i,ne(a)+S+C,c)}u=!0},skip(){u=!0}},{type:f}=o,d=t["*"],p=t[f],y=typeof d=="function"?d:d?.enter,b=typeof p=="function"?p:p?.enter;if(y?.(h,n),b?.(h,n),!u)switch(f){case"AbsenceFunction":case"Alternative":case"CapturingGroup":case"CharacterClass":case"Group":case"LookaroundAssertion":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"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 "${f}"`)}return p?.exit?.(h,n),d?.exit?.(h,n),l}return s(e),e}function xe(e){if(!Array.isArray(e))throw new Error("Container expected");return e}function ne(e){if(typeof e!="number")throw new Error("Numeric key expected");return e}const fa=String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`;function da(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function pa(e,t,n,r){return e.slice(0,t)+r+e.slice(t+n.length)}const T=Object.freeze({DEFAULT:"DEFAULT",CHAR_CLASS:"CHAR_CLASS"});function Gt(e,t,n,r){const s=new RegExp(String.raw`${t}|(?<$skip>\[\^?|\\?.)`,"gsu"),o=[!1];let i=0,a="";for(const c of e.matchAll(s)){const{0:l,groups:{$skip:u}}=c;if(!u&&(!r||r===T.DEFAULT==!i)){n instanceof Function?a+=n(c,{context:i?T.CHAR_CLASS:T.DEFAULT,negated:o[o.length-1]}):a+=n;continue}l[0]==="["?(i++,o.push(l[1]==="^")):l==="]"&&i&&(i--,o.pop()),a+=l}return a}function br(e,t,n,r){Gt(e,t,n,r)}function ga(e,t,n=0,r){if(!new RegExp(t,"su").test(e))return null;const s=new RegExp(`${t}|(?<$skip>\\\\?.)`,"gsu");s.lastIndex=n;let o=0,i;for(;i=s.exec(e);){const{0:a,groups:{$skip:c}}=i;if(!c&&(!r||r===T.DEFAULT==!o))return i;a==="["?o++:a==="]"&&o&&o--,s.lastIndex==i.index&&s.lastIndex++}return null}function Ae(e,t,n){return!!ga(e,t,0,n)}function ma(e,t){const n=/\\?./gsu;n.lastIndex=t;let r=e.length,s=0,o=1,i;for(;i=n.exec(e);){const[a]=i;if(a==="[")s++;else if(s)a==="]"&&s--;else if(a==="(")o++;else if(a===")"&&(o--,!o)){r=i.index;break}}return e.slice(t,r)}const bn=new RegExp(String.raw`(?<noncapturingStart>${fa})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`,"gsu");function ya(e,t){const n=t?.hiddenCaptures??[];let r=t?.captureTransfers??new Map;if(!/\(\?>/.test(e))return{pattern:e,captureTransfers:r,hiddenCaptures:n};const s="(?>",o="(?:(?=(",i=[0],a=[];let c=0,l=0,u=NaN,h;do{h=!1;let f=0,d=0,p=!1,y;for(bn.lastIndex=Number.isNaN(u)?0:u+o.length;y=bn.exec(e);){const{0:b,index:g,groups:{capturingStart:m,noncapturingStart:_}}=y;if(b==="[")f++;else if(f)b==="]"&&f--;else if(b===s&&!p)u=g,p=!0;else if(p&&_)d++;else if(m)p?d++:(c++,i.push(c+l));else if(b===")"&&p){if(!d){l++;const C=c+l;if(e=`${e.slice(0,u)}${o}${e.slice(u+s.length,g)}))<$$${C}>)${e.slice(g+1)}`,h=!0,a.push(C),da(n,C),r.size){const S=new Map;r.forEach((v,$)=>{S.set($>=C?$+1:$,v.map(O=>O>=C?O+1:O))}),r=S}break}d--}}}while(h);return n.push(...a),e=Gt(e,String.raw`\\(?<backrefNum>[1-9]\d*)|<\$\$(?<wrappedBackrefNum>\d+)>`,({0:f,groups:{backrefNum:d,wrappedBackrefNum:p}})=>{if(d){const y=+d;if(y>i.length-1)throw new Error(`Backref "${f}" greater than number of captures`);return`\\${i[y]}`}return`\\${p}`},T.DEFAULT),{pattern:e,captureTransfers:r,hiddenCaptures:n}}const _r=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,ot=new RegExp(String.raw`
45
+ \\(?: \d+
46
+ | c[A-Za-z]
47
+ | [gk]<[^>]+>
48
+ | [pPu]\{[^\}]+\}
49
+ | u[A-Fa-f\d]{4}
50
+ | x[A-Fa-f\d]{2}
51
+ )
52
+ | \((?: \? (?: [:=!>]
53
+ | <(?:[=!]|[^>]+>)
54
+ | [A-Za-z\-]+:
55
+ | \(DEFINE\)
56
+ ))?
57
+ | (?<qBase>${_r})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?)
58
+ | \\?.
59
+ `.replace(/\s+/g,""),"gsu");function ba(e){if(!new RegExp(`${_r}\\+`).test(e))return{pattern:e};const t=[];let n=null,r=null,s="",o=0,i;for(ot.lastIndex=0;i=ot.exec(e);){const{0:a,index:c,groups:{qBase:l,qMod:u,invalidQ:h}}=i;if(a==="[")o||(r=c),o++;else if(a==="]")o?o--:r=null;else if(!o)if(u==="+"&&s&&!s.startsWith("(")){if(h)throw new Error(`Invalid quantifier "${a}"`);let f=-1;if(/^\{\d+\}$/.test(l))e=pa(e,c+l.length,u,"");else{if(s===")"||s==="]"){const d=s===")"?n:r;if(d===null)throw new Error(`Invalid unmatched "${s}"`);e=`${e.slice(0,d)}(?>${e.slice(d,c)}${l})${e.slice(c+a.length)}`}else e=`${e.slice(0,c-s.length)}(?>${s}${l})${e.slice(c+a.length)}`;f+=4}ot.lastIndex+=f}else a[0]==="("?t.push(c):a===")"&&(n=t.length?t.pop():null);s=a}return{pattern:e}}const P=String.raw,_a=P`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`,At=P`\(\?R=(?<rDepth>[^\)]+)\)|${_a}`,Ve=P`\(\?<(?![=!])(?<captureName>[^>]+)>`,wr=P`${Ve}|(?<unnamed>\()(?!\?)`,V=new RegExp(P`${Ve}|${At}|\(\?|\\?.`,"gsu"),it="Cannot use multiple overlapping recursions";function wa(e,t){const{hiddenCaptures:n,mode:r}={hiddenCaptures:[],mode:"plugin",...t};let s=t?.captureTransfers??new Map;if(!new RegExp(At,"su").test(e))return{pattern:e,captureTransfers:s,hiddenCaptures:n};if(r==="plugin"&&Ae(e,P`\(\?\(DEFINE\)`,T.DEFAULT))throw new Error("DEFINE groups cannot be used with recursion");const o=[],i=Ae(e,P`\\[1-9]`,T.DEFAULT),a=new Map,c=[];let l=!1,u=0,h=0,f;for(V.lastIndex=0;f=V.exec(e);){const{0:d,groups:{captureName:p,rDepth:y,gRNameOrNum:b,gRDepth:g}}=f;if(d==="[")u++;else if(u)d==="]"&&u--;else if(y){if(_n(y),l)throw new Error(it);if(i)throw new Error(`${r==="external"?"Backrefs":"Numbered backrefs"} cannot be used with global recursion`);const m=e.slice(0,f.index),_=e.slice(V.lastIndex);if(Ae(_,At,T.DEFAULT))throw new Error(it);const C=+y-1;e=wn(m,_,C,!1,n,o,h),s=Sn(s,m,C,o.length,0,h);break}else if(b){_n(g);let m=!1;for(const B of c)if(B.name===b||B.num===+b){if(m=!0,B.hasRecursedWithin)throw new Error(it);break}if(!m)throw new Error(P`Recursive \g cannot be used outside the referenced group "${r==="external"?b:P`\g<${b}&R=${g}>`}"`);const _=a.get(b),C=ma(e,_);if(i&&Ae(C,P`${Ve}|\((?!\?)`,T.DEFAULT))throw new Error(`${r==="external"?"Backrefs":"Numbered backrefs"} cannot be used with recursion of capturing groups`);const S=e.slice(_,f.index),v=C.slice(S.length+d.length),$=o.length,O=+g-1,ee=wn(S,v,O,!0,n,o,h);s=Sn(s,S,O,o.length-$,$,h);const Qe=e.slice(0,_),Ke=e.slice(_+C.length);e=`${Qe}${ee}${Ke}`,V.lastIndex+=ee.length-d.length-S.length-v.length,c.forEach(B=>B.hasRecursedWithin=!0),l=!0}else if(p)h++,a.set(String(h),V.lastIndex),a.set(p,V.lastIndex),c.push({num:h,name:p});else if(d[0]==="("){const m=d==="(";m&&(h++,a.set(String(h),V.lastIndex)),c.push(m?{num:h}:{})}else d===")"&&c.pop()}return n.push(...o),{pattern:e,captureTransfers:s,hiddenCaptures:n}}function _n(e){const t=`Max depth must be integer between 2 and 100; used ${e}`;if(!/^[1-9]\d*$/.test(e))throw new Error(t);if(e=+e,e<2||e>100)throw new Error(t)}function wn(e,t,n,r,s,o,i){const a=new Set;r&&br(e+t,Ve,({groups:{captureName:l}})=>{a.add(l)},T.DEFAULT);const c=[n,r?a:null,s,o,i];return`${e}${Cn(`(?:${e}`,"forward",...c)}(?:)${Cn(`${t})`,"backward",...c)}${t}`}function Cn(e,t,n,r,s,o,i){const c=u=>t==="forward"?u+2:n-u+2-1;let l="";for(let u=0;u<n;u++){const h=c(u);l+=Gt(e,P`${wr}|\\k<(?<backref>[^>]+)>`,({0:f,groups:{captureName:d,unnamed:p,backref:y}})=>{if(y&&r&&!r.has(y))return f;const b=`_$${h}`;if(p||d){const g=i+o.length+1;return o.push(g),Ca(s,g),p?f:`(?<${d}${b}>`}return P`\k<${y}${b}>`},T.DEFAULT)}return l}function Ca(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function Sn(e,t,n,r,s,o){if(e.size&&r){let i=0;br(t,wr,()=>i++,T.DEFAULT);const a=o-i+s,c=new Map;return e.forEach((l,u)=>{const h=(r-i*n)/n,f=i*n,d=u>a+i?u+r:u,p=[];for(const y of l)if(y<=a)p.push(y);else if(y>a+i+h)p.push(y+r);else if(y<=a+i)for(let b=0;b<=n;b++)p.push(y+i*b);else for(let b=0;b<=n;b++)p.push(y+f+h*b);c.set(d,p)}),c}return e}var A=String.fromCodePoint,w=String.raw,M={},Xe=globalThis.RegExp;M.flagGroups=(()=>{try{new Xe("(?i:)")}catch{return!1}return!0})();M.unicodeSets=(()=>{try{new Xe("[[]]","v")}catch{return!1}return!0})();M.bugFlagVLiteralHyphenIsRange=M.unicodeSets?(()=>{try{new Xe(w`[\d\-a]`,"v")}catch{return!0}return!1})():!1;M.bugNestedClassIgnoresNegation=M.unicodeSets&&new Xe("[[^a]]","v").test("a");function Fe(e,{enable:t,disable:n}){return{dotAll:!n?.dotAll&&!!(t?.dotAll||e.dotAll),ignoreCase:!n?.ignoreCase&&!!(t?.ignoreCase||e.ignoreCase)}}function ye(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}function Et(e,t){return kn[e]>=kn[t]}function Sa(e,t){if(e==null)throw new Error(t??"Value expected");return e}var kn={ES2025:2025,ES2024:2024,ES2018:2018},ka={auto:"auto",ES2025:"ES2025",ES2024:"ES2024",ES2018:"ES2018"};function Cr(e={}){if({}.toString.call(e)!=="[object Object]")throw new Error("Unexpected options");if(e.target!==void 0&&!ka[e.target])throw new Error(`Unexpected target "${e.target}"`);const t={accuracy:"default",avoidSubclass:!1,flags:"",global:!1,hasIndices:!1,lazyCompileLength:1/0,target:"auto",verbose:!1,...e,rules:{allowOrphanBackrefs:!1,asciiWordBoundaries:!1,captureGroup:!1,recursionLimit:20,singleline:!1,...e.rules}};return t.target==="auto"&&(t.target=M.flagGroups?"ES2025":M.unicodeSets?"ES2024":"ES2018"),t}var xa="[ -\r ]",Aa=new Set([A(304),A(305)]),j=w`[\p{L}\p{M}\p{N}\p{Pc}]`;function Sr(e){if(Aa.has(e))return[e];const t=new Set,n=e.toLowerCase(),r=n.toUpperCase(),s=va.get(n),o=Ea.get(n),i=Ia.get(n);return[...r].length===1&&t.add(r),i&&t.add(i),s&&t.add(s),t.add(n),o&&t.add(o),[...t]}var Mt=new Map(`C Other
60
+ Cc Control cntrl
61
+ Cf Format
62
+ Cn Unassigned
63
+ Co Private_Use
64
+ Cs Surrogate
65
+ L Letter
66
+ LC Cased_Letter
67
+ Ll Lowercase_Letter
68
+ Lm Modifier_Letter
69
+ Lo Other_Letter
70
+ Lt Titlecase_Letter
71
+ Lu Uppercase_Letter
72
+ M Mark Combining_Mark
73
+ Mc Spacing_Mark
74
+ Me Enclosing_Mark
75
+ Mn Nonspacing_Mark
76
+ N Number
77
+ Nd Decimal_Number digit
78
+ Nl Letter_Number
79
+ No Other_Number
80
+ P Punctuation punct
81
+ Pc Connector_Punctuation
82
+ Pd Dash_Punctuation
83
+ Pe Close_Punctuation
84
+ Pf Final_Punctuation
85
+ Pi Initial_Punctuation
86
+ Po Other_Punctuation
87
+ Ps Open_Punctuation
88
+ S Symbol
89
+ Sc Currency_Symbol
90
+ Sk Modifier_Symbol
91
+ Sm Math_Symbol
92
+ So Other_Symbol
93
+ Z Separator
94
+ Zl Line_Separator
95
+ Zp Paragraph_Separator
96
+ Zs Space_Separator
97
+ ASCII
98
+ ASCII_Hex_Digit AHex
99
+ Alphabetic Alpha
100
+ Any
101
+ Assigned
102
+ Bidi_Control Bidi_C
103
+ Bidi_Mirrored Bidi_M
104
+ Case_Ignorable CI
105
+ Cased
106
+ Changes_When_Casefolded CWCF
107
+ Changes_When_Casemapped CWCM
108
+ Changes_When_Lowercased CWL
109
+ Changes_When_NFKC_Casefolded CWKCF
110
+ Changes_When_Titlecased CWT
111
+ Changes_When_Uppercased CWU
112
+ Dash
113
+ Default_Ignorable_Code_Point DI
114
+ Deprecated Dep
115
+ Diacritic Dia
116
+ Emoji
117
+ Emoji_Component EComp
118
+ Emoji_Modifier EMod
119
+ Emoji_Modifier_Base EBase
120
+ Emoji_Presentation EPres
121
+ Extended_Pictographic ExtPict
122
+ Extender Ext
123
+ Grapheme_Base Gr_Base
124
+ Grapheme_Extend Gr_Ext
125
+ Hex_Digit Hex
126
+ IDS_Binary_Operator IDSB
127
+ IDS_Trinary_Operator IDST
128
+ ID_Continue IDC
129
+ ID_Start IDS
130
+ Ideographic Ideo
131
+ Join_Control Join_C
132
+ Logical_Order_Exception LOE
133
+ Lowercase Lower
134
+ Math
135
+ Noncharacter_Code_Point NChar
136
+ Pattern_Syntax Pat_Syn
137
+ Pattern_White_Space Pat_WS
138
+ Quotation_Mark QMark
139
+ Radical
140
+ Regional_Indicator RI
141
+ Sentence_Terminal STerm
142
+ Soft_Dotted SD
143
+ Terminal_Punctuation Term
144
+ Unified_Ideograph UIdeo
145
+ Uppercase Upper
146
+ Variation_Selector VS
147
+ White_Space space
148
+ XID_Continue XIDC
149
+ XID_Start XIDS`.split(/\s/).map(e=>[qe(e),e])),Ea=new Map([["s",A(383)],[A(383),"s"]]),Ia=new Map([[A(223),A(7838)],[A(107),A(8490)],[A(229),A(8491)],[A(969),A(8486)]]),va=new Map([z(453),z(456),z(459),z(498),...at(8072,8079),...at(8088,8095),...at(8104,8111),z(8124),z(8140),z(8188)]),Na=new Map([["alnum",w`[\p{Alpha}\p{Nd}]`],["alpha",w`\p{Alpha}`],["ascii",w`\p{ASCII}`],["blank",w`[\p{Zs}\t]`],["cntrl",w`\p{Cc}`],["digit",w`\p{Nd}`],["graph",w`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],["lower",w`\p{Lower}`],["print",w`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],["punct",w`[\p{P}\p{S}]`],["space",w`\p{space}`],["upper",w`\p{Upper}`],["word",w`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],["xdigit",w`\p{AHex}`]]);function Ra(e,t){const n=[];for(let r=e;r<=t;r++)n.push(r);return n}function z(e){const t=A(e);return[t.toLowerCase(),t]}function at(e,t){return Ra(e,t).map(n=>z(n))}var kr=new Set(["Lower","Lowercase","Upper","Uppercase","Ll","Lowercase_Letter","Lt","Titlecase_Letter","Lu","Uppercase_Letter"]);function $a(e,t){const n={accuracy:"default",asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:"ES2025",...t};xr(e);const r={accuracy:n.accuracy,asciiWordBoundaries:n.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:Et(n.bestEffortTarget,"ES2024"),passedLookbehind:!1,strategy:null,subroutineRefMap:new Map,supportedGNodes:new Set,digitIsAscii:e.flags.digitIsAscii,spaceIsAscii:e.flags.spaceIsAscii,wordIsAscii:e.flags.wordIsAscii};fe(e,La,r);const s={dotAll:e.flags.dotAll,ignoreCase:e.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};fe(e,Pa,o);const i={groupsByName:o.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:o.reffedNodesByReferencer};return fe(e,Ta,i),e._originMap=o.groupOriginByCopy,e._strategy=r.strategy,e}var La={AbsenceFunction({node:e,parent:t,replaceWith:n}){const{body:r,kind:s}=e;if(s==="repeater"){const o=G();o.body[0].body.push(Q({negate:!0,body:r}),oe("Any"));const i=G();i.body[0].body.push(gr("greedy",0,1/0,o)),n(x(i,t),{traverse:!0})}else throw new Error('Unsupported absence function "(?~|"')},Alternative:{enter({node:e,parent:t,key:n},{flagDirectivesByAlt:r}){const s=e.body.filter(o=>o.kind==="flags");for(let o=n+1;o<t.body.length;o++){const i=t.body[o];ye(r,i,[]).push(...s)}},exit({node:e},{flagDirectivesByAlt:t}){if(t.get(e)?.length){const n=Er(t.get(e));if(n){const r=G({flags:n});r.body[0].body=e.body,e.body=[x(r,e)]}}}},Assertion({node:e,parent:t,key:n,container:r,root:s,remove:o,replaceWith:i},a){const{kind:c,negate:l}=e,{asciiWordBoundaries:u,avoidSubclass:h,supportedGNodes:f,wordIsAscii:d}=a;if(c==="text_segment_boundary")throw new Error(`Unsupported text segment boundary "\\${l?"Y":"y"}"`);if(c==="line_end")i(x(Q({body:[Y({body:[St("string_end")]}),Y({body:[He(10)]})]}),t));else if(c==="line_start")i(x(U(w`(?<=\A|\n(?!\z))`,{skipLookbehindValidation:!0}),t));else if(c==="search_start")if(f.has(e))s.flags.sticky=!0,o();else{const p=r[n-1];if(p&&Da(p))i(x(Q({negate:!0}),t));else{if(h)throw new Error(w`Uses "\G" in a way that requires a subclass`);i(H(St("string_start"),t)),a.strategy="clip_search"}}else if(!(c==="string_end"||c==="string_start"))if(c==="string_end_newline")i(x(U(w`(?=\n?\z)`),t));else if(c==="word_boundary"){if(!d&&!u){const p=`(?:(?<=${j})(?!${j})|(?<!${j})(?=${j}))`,y=`(?:(?<=${j})(?=${j})|(?<!${j})(?!${j}))`;i(x(U(l?y:p),t))}}else throw new Error(`Unexpected assertion kind "${c}"`)},Backreference({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n=="string"&&!lt(n)&&(n=ct(n,t),e.ref=n)},CapturingGroup({node:e},{jsGroupNameMap:t,subroutineRefMap:n}){let{name:r}=e;r&&!lt(r)&&(r=ct(r,t),e.name=r),n.set(e.number,e),r&&n.set(r,e)},CharacterClassRange({node:e,parent:t,replaceWith:n}){if(t.kind==="intersection"){const r=ve({body:[e]});n(x(r,t),{traverse:!0})}},CharacterSet({node:e,parent:t,replaceWith:n},{accuracy:r,minTargetEs2024:s,digitIsAscii:o,spaceIsAscii:i,wordIsAscii:a}){const{kind:c,negate:l,value:u}=e;if(o&&(c==="digit"||u==="digit")){n(H(xt("digit",{negate:l}),t));return}if(i&&(c==="space"||u==="space")){n(x(ut(U(xa),l),t));return}if(a&&(c==="word"||u==="word")){n(H(xt("word",{negate:l}),t));return}if(c==="any")n(H(oe("Any"),t));else if(c==="digit")n(H(oe("Nd",{negate:l}),t));else if(c!=="dot")if(c==="text_segment"){if(r==="strict")throw new Error(w`Use of "\X" requires non-strict accuracy`);const h="\\p{Emoji}(?:\\p{EMod}|\\uFE0F\\u20E3?|[\\x{E0020}-\\x{E007E}]+\\x{E007F})?",f=w`\p{RI}{2}|${h}(?:\u200D${h})*`;n(x(U(w`(?>\r\n|${s?w`\p{RGI_Emoji}`:f}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),t))}else if(c==="hex")n(H(oe("AHex",{negate:l}),t));else if(c==="newline")n(x(U(l?`[^
150
+ ]`:`(?>\r
151
+ ?|[
152
+ \v\f…\u2028\u2029])`),t));else if(c==="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 h={graph:"!-~",print:" -~"}[u];l&&(h=`\0-${A(h.codePointAt(0)-1)}${A(h.codePointAt(2)+1)}-􏿿`),n(x(U(`[${h}]`),t))}else n(x(ut(U(Na.get(u)),l),t));else if(c==="property")Mt.has(qe(u))||(e.key="sc");else if(c==="space")n(H(oe("space",{negate:l}),t));else if(c==="word")n(x(ut(U(j),l),t));else throw new Error(`Unexpected character set kind "${c}"`)},Directive({node:e,parent:t,root:n,remove:r,replaceWith:s,removeAllPrevSiblings:o,removeAllNextSiblings:i}){const{kind:a,flags:c}=e;if(a==="flags")if(!c.enable&&!c.disable)r();else{const l=G({flags:c});l.body[0].body=i(),s(x(l,t),{traverse:!0})}else if(a==="keep"){const l=n.body[0],h=n.body.length===1&&fr(l,{type:"Group"})&&l.body[0].body.length===1?l.body[0]:n;if(t.parent!==h||h.body.length>1)throw new Error(w`Uses "\K" in a way that's unsupported`);const f=Q({behind:!0});f.body[0].body=o(),s(x(f,t))}else throw new Error(`Unexpected directive kind "${a}"`)},Flags({node:e,parent:t}){if(e.posixIsAscii)throw new Error('Unsupported flag "P"');if(e.textSegmentMode==="word")throw new Error('Unsupported flag "y{w}"');["digitIsAscii","extended","posixIsAscii","spaceIsAscii","wordIsAscii","textSegmentMode"].forEach(n=>delete e[n]),Object.assign(e,{global:!1,hasIndices:!1,multiline:!1,sticky:e.sticky??!1}),t.options={disable:{x:!0,n:!0},force:{v:!0}}},Group({node:e}){if(!e.flags)return;const{enable:t,disable:n}=e.flags;t?.extended&&delete t.extended,n?.extended&&delete n.extended,t?.dotAll&&n?.dotAll&&delete t.dotAll,t?.ignoreCase&&n?.ignoreCase&&delete t.ignoreCase,t&&!Object.keys(t).length&&delete e.flags.enable,n&&!Object.keys(n).length&&delete e.flags.disable,!e.flags.enable&&!e.flags.disable&&delete e.flags},LookaroundAssertion({node:e},t){const{kind:n}=e;n==="lookbehind"&&(t.passedLookbehind=!0)},NamedCallout({node:e,parent:t,replaceWith:n}){const{kind:r}=e;if(r==="fail")n(x(Q({negate:!0}),t));else throw new Error(`Unsupported named callout "(*${r.toUpperCase()}"`)},Quantifier({node:e}){if(e.body.type==="Quantifier"){const t=G();t.body[0].body.push(e.body),e.body=x(t,e)}},Regex:{enter({node:e},{supportedGNodes:t}){const n=[];let r=!1,s=!1;for(const o of e.body)if(o.body.length===1&&o.body[0].kind==="search_start")o.body.pop();else{const i=vr(o.body);i?(r=!0,Array.isArray(i)?n.push(...i):n.push(i)):s=!0}r&&!s&&n.forEach(o=>t.add(o))},exit(e,{accuracy:t,passedLookbehind:n,strategy:r}){if(t==="strict"&&n&&r)throw new Error(w`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n=="string"&&!lt(n)&&(n=ct(n,t),e.ref=n)}},Pa={Backreference({node:e},{multiplexCapturesToLeftByRef:t,reffedNodesByReferencer:n}){const{orphan:r,ref:s}=e;r||n.set(e,[...t.get(s).map(({node:o})=>o)])},CapturingGroup:{enter({node:e,parent:t,replaceWith:n,skip:r},{groupOriginByCopy:s,groupsByName:o,multiplexCapturesToLeftByRef:i,openRefs:a,reffedNodesByReferencer:c}){const l=s.get(e);if(l&&a.has(e.number)){const h=H(xn(e.number),t);c.set(h,a.get(e.number)),n(h);return}a.set(e.number,e),i.set(e.number,[]),e.name&&ye(i,e.name,[]);const u=i.get(e.name??e.number);for(let h=0;h<u.length;h++){const f=u[h];if(l===f.node||l&&l===f.origin||e===f.origin){u.splice(h,1);break}}if(i.get(e.number).push({node:e,origin:l}),e.name&&i.get(e.name).push({node:e,origin:l}),e.name){const h=ye(o,e.name,new Map);let f=!1;if(l)f=!0;else for(const d of h.values())if(!d.hasDuplicateNameToRemove){f=!0;break}o.get(e.name).set(e,{node:e,hasDuplicateNameToRemove:f})}},exit({node:e},{openRefs:t}){t.get(e.number)===e&&t.delete(e.number)}},Group:{enter({node:e},t){t.prevFlags=t.currentFlags,e.flags&&(t.currentFlags=Fe(t.currentFlags,e.flags))},exit(e,t){t.currentFlags=t.prevFlags}},Subroutine({node:e,parent:t,replaceWith:n},r){const{isRecursive:s,ref:o}=e;if(s){let u=t;for(;(u=u.parent)&&!(u.type==="CapturingGroup"&&(u.name===o||u.number===o)););r.reffedNodesByReferencer.set(e,u);return}const i=r.subroutineRefMap.get(o),a=o===0,c=a?xn(0):Ar(i,r.groupOriginByCopy,null);let l=c;if(!a){const u=Er(Oa(i,f=>f.type==="Group"&&!!f.flags)),h=u?Fe(r.globalFlags,u):r.globalFlags;Ga(h,r.currentFlags)||(l=G({flags:Ba(h)}),l.body[0].body.push(c))}n(x(l,t),{traverse:!a})}},Ta={Backreference({node:e,parent:t,replaceWith:n},r){if(e.orphan){r.highestOrphanBackref=Math.max(r.highestOrphanBackref,e.ref);return}const o=r.reffedNodesByReferencer.get(e).filter(i=>Ma(i,e));if(!o.length)n(x(Q({negate:!0}),t));else if(o.length>1){const i=G({atomic:!0,body:o.reverse().map(a=>Y({body:[kt(a.number)]}))});n(x(i,t))}else e.ref=o[0].number},CapturingGroup({node:e},t){e.number=++t.numCapturesToLeft,e.name&&t.groupsByName.get(e.name).get(e).hasDuplicateNameToRemove&&delete e.name},Regex:{exit({node:e},t){const n=Math.max(t.highestOrphanBackref-t.numCapturesToLeft,0);for(let r=0;r<n;r++){const s=pr();e.body.at(-1).body.push(s)}}},Subroutine({node:e},t){!e.isRecursive||e.ref===0||(e.ref=t.reffedNodesByReferencer.get(e).number)}};function xr(e){fe(e,{"*"({node:t,parent:n}){t.parent=n}})}function Ga(e,t){return e.dotAll===t.dotAll&&e.ignoreCase===t.ignoreCase}function Ma(e,t){let n=t;do{if(n.type==="Regex")return!1;if(n.type==="Alternative")continue;if(n===e)return!1;const r=Ir(n.parent);for(const s of r){if(s===n)break;if(s===e||Nr(s,e))return!0}}while(n=n.parent);throw new Error("Unexpected path")}function Ar(e,t,n,r){const s=Array.isArray(e)?[]:{};for(const[o,i]of Object.entries(e))o==="parent"?s.parent=Array.isArray(n)?r:n:i&&typeof i=="object"?s[o]=Ar(i,t,s,n):(o==="type"&&i==="CapturingGroup"&&t.set(s,t.get(e)??e),s[o]=i);return s}function xn(e){const t=mr(e);return t.isRecursive=!0,t}function Oa(e,t){const n=[];for(;e=e.parent;)(!t||t(e))&&n.push(e);return n}function ct(e,t){if(t.has(e))return t.get(e);const n=`$${t.size}_${e.replace(/^[^$_\p{IDS}]|[^$\u200C\u200D\p{IDC}]/ug,"_")}`;return t.set(e,n),n}function Er(e){const t=["dotAll","ignoreCase"],n={enable:{},disable:{}};return e.forEach(({flags:r})=>{t.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 Ba({dotAll:e,ignoreCase:t}){const n={};return(e||t)&&(n.enable={},e&&(n.enable.dotAll=!0),t&&(n.enable.ignoreCase=!0)),(!e||!t)&&(n.disable={},!e&&(n.disable.dotAll=!0),!t&&(n.disable.ignoreCase=!0)),n}function Ir(e){if(!e)throw new Error("Node expected");const{body:t}=e;return Array.isArray(t)?t:t?[t]:null}function vr(e){const t=e.find(n=>n.kind==="search_start"||ja(n,{negate:!1})||!Fa(n));if(!t)return null;if(t.kind==="search_start")return t;if(t.type==="LookaroundAssertion")return t.body[0].body[0];if(t.type==="CapturingGroup"||t.type==="Group"){const n=[];for(const r of t.body){const s=vr(r.body);if(!s)return null;Array.isArray(s)?n.push(...s):n.push(s)}return n}return null}function Nr(e,t){const n=Ir(e)??[];for(const r of n)if(r===t||Nr(r,t))return!0;return!1}function Fa({type:e}){return e==="Assertion"||e==="Directive"||e==="LookaroundAssertion"}function Da(e){const t=["Character","CharacterClass","CharacterSet"];return t.includes(e.type)||e.type==="Quantifier"&&e.min&&t.includes(e.body.type)}function ja(e,t){const n={negate:null,...t};return e.type==="LookaroundAssertion"&&(n.negate===null||e.negate===n.negate)&&e.body.length===1&&fr(e.body[0],{type:"Assertion",kind:"search_start"})}function lt(e){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e)}function U(e,t){const r=dr(e,{...t,unicodePropertyMap:Mt}).body;return r.length>1||r[0].body.length>1?G({body:r}):r[0].body[0]}function ut(e,t){return e.negate=t,e}function H(e,t){return e.parent=t,e}function x(e,t){return xr(e),e.parent=t,e}function Ua(e,t){const n=Cr(t),r=Et(n.target,"ES2024"),s=Et(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,a=null;if(!s){const d=[e.flags.ignoreCase];fe(e,Wa,{getCurrentModI:()=>d.at(-1),popModI(){d.pop()},pushModI(p){d.push(p)},setHasCasedChar(){d.at(-1)?i=!0:a=!0}})}const c={dotAll:e.flags.dotAll,ignoreCase:!!((e.flags.ignoreCase||i)&&!a)};let l=e;const u={accuracy:n.accuracy,appliedGlobalFlags:c,captureMap:new Map,currentFlags:{dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},inCharClass:!1,lastNode:l,originMap:e._originMap,recursionLimit:o,useAppliedIgnoreCase:!!(!s&&i&&a),useFlagMods:s,useFlagV:r,verbose:n.verbose};function h(d){return u.lastNode=l,l=d,Sa(za[d.type],`Unexpected node type "${d.type}"`)(d,u,h)}const f={pattern:e.body.map(h).join("|"),flags:h(e.flags),options:{...e.options}};return r||(delete f.options.force.v,f.options.disable.v=!0,f.options.unicodeSetsPlugin=null),f._captureTransfers=new Map,f._hiddenCaptures=[],u.captureMap.forEach((d,p)=>{d.hidden&&f._hiddenCaptures.push(p),d.transferTo&&ye(f._captureTransfers,d.transferTo,[]).push(p)}),f}var Wa={"*":{enter({node:e},t){if(En(e)){const n=t.getCurrentModI();t.pushModI(e.flags?Fe({ignoreCase:n},e.flags).ignoreCase:n)}},exit({node:e},t){En(e)&&t.popModI()}},Backreference(e,t){t.setHasCasedChar()},Character({node:e},t){Ot(A(e.value))&&t.setHasCasedChar()},CharacterClassRange({node:e,skip:t},n){t(),Rr(e,{firstOnly:!0}).length&&n.setHasCasedChar()},CharacterSet({node:e},t){e.kind==="property"&&kr.has(e.value)&&t.setHasCasedChar()}},za={Alternative({body:e},t,n){return e.map(n).join("")},Assertion({kind:e,negate:t}){if(e==="string_end")return"$";if(e==="string_start")return"^";if(e==="word_boundary")return t?w`\B`:w`\b`;throw new Error(`Unexpected assertion kind "${e}"`)},Backreference({ref:e},t){if(typeof e!="number")throw new Error("Unexpected named backref in transformed AST");if(!t.useFlagMods&&t.accuracy==="strict"&&t.currentFlags.ignoreCase&&!t.captureMap.get(e).ignoreCase)throw new Error("Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy");return"\\"+e},CapturingGroup(e,t,n){const{body:r,name:s,number:o}=e,i={ignoreCase:t.currentFlags.ignoreCase},a=t.originMap.get(e);return a&&(i.hidden=!0,o>a.number&&(i.transferTo=a.number)),t.captureMap.set(o,i),`(${s?`?<${s}>`:""}${r.map(n).join("|")})`},Character({value:e},t){const n=A(e),r=re(e,{escDigit:t.lastNode.type==="Backreference",inCharClass:t.inCharClass,useFlagV:t.useFlagV});if(r!==n)return r;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&Ot(n)){const s=Sr(n);return t.inCharClass?s.join(""):s.length>1?`[${s.join("")}]`:s[0]}return n},CharacterClass(e,t,n){const{kind:r,negate:s,parent:o}=e;let{body:i}=e;if(r==="intersection"&&!t.useFlagV)throw new Error("Use of character class intersection requires min target ES2024");M.bugFlagVLiteralHyphenIsRange&&t.useFlagV&&i.some(In)&&(i=[He(45),...i.filter(l=>!In(l))]);const a=()=>`[${s?"^":""}${i.map(n).join(r==="intersection"?"&&":"")}]`;if(!t.inCharClass){if((!t.useFlagV||M.bugNestedClassIgnoresNegation)&&!s){const u=i.filter(h=>h.type==="CharacterClass"&&h.kind==="union"&&h.negate);if(u.length){const h=G(),f=h.body[0];return h.parent=o,f.parent=h,i=i.filter(d=>!u.includes(d)),e.body=i,i.length?(e.parent=f,f.body.push(e)):h.body.pop(),u.forEach(d=>{const p=Y({body:[d]});d.parent=p,p.parent=h,h.body.push(p)}),n(h)}}t.inCharClass=!0;const l=a();return t.inCharClass=!1,l}const c=i[0];if(r==="union"&&!s&&c&&((!t.useFlagV||!t.verbose)&&o.kind==="union"&&!(M.bugFlagVLiteralHyphenIsRange&&t.useFlagV)||!t.verbose&&o.kind==="intersection"&&i.length===1&&c.type!=="CharacterClassRange"))return i.map(n).join("");if(!t.useFlagV&&o.type==="CharacterClass")throw new Error("Uses nested character class in a way that requires min target ES2024");return a()},CharacterClassRange(e,t){const n=e.min.value,r=e.max.value,s={escDigit:!1,inCharClass:!0,useFlagV:t.useFlagV},o=re(n,s),i=re(r,s),a=new Set;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase){const c=Rr(e);Qa(c).forEach(u=>{a.add(Array.isArray(u)?`${re(u[0],s)}-${re(u[1],s)}`:re(u,s))})}return`${o}-${i}${[...a].join("")}`},CharacterSet({kind:e,negate:t,value:n,key:r},s){if(e==="dot")return s.currentFlags.dotAll?s.appliedGlobalFlags.dotAll||s.useFlagMods?".":"[^]":w`[^\n]`;if(e==="digit")return t?w`\D`:w`\d`;if(e==="property"){if(s.useAppliedIgnoreCase&&s.currentFlags.ignoreCase&&kr.has(n))throw new Error(`Unicode property "${n}" can't be case-insensitive when other chars have specific case`);return`${t?w`\P`:w`\p`}{${r?`${r}=`:""}${n}}`}if(e==="word")return t?w`\W`:w`\w`;throw new Error(`Unexpected character set kind "${e}"`)},Flags(e,t){return(t.appliedGlobalFlags.ignoreCase?"i":"")+(e.dotAll?"s":"")+(e.sticky?"y":"")},Group({atomic:e,body:t,flags:n,parent:r},s,o){const i=s.currentFlags;n&&(s.currentFlags=Fe(i,n));const a=t.map(o).join("|"),c=!s.verbose&&t.length===1&&r.type!=="Quantifier"&&!e&&(!s.useFlagMods||!n)?a:`(?${Ka(e,n,s.useFlagMods)}${a})`;return s.currentFlags=i,c},LookaroundAssertion({body:e,kind:t,negate:n},r,s){return`(?${`${t==="lookahead"?"":"<"}${n?"!":"="}`}${e.map(s).join("|")})`},Quantifier(e,t,n){return n(e.body)+Za(e)},Subroutine({isRecursive:e,ref:t},n){if(!e)throw new Error("Unexpected non-recursive subroutine in transformed AST");const r=n.recursionLimit;return t===0?`(?R=${r})`:w`\g<${t}&R=${r}>`}},Ha=new Set(["$","(",")","*","+",".","?","[","\\","]","^","{","|","}"]),qa=new Set(["-","\\","]","^","["]),Va=new Set(["(",")","-","/","[","\\","]","^","{","|","}","!","#","$","%","&","*","+",",",".",":",";","<","=",">","?","@","`","~"]),An=new Map([[9,w`\t`],[10,w`\n`],[11,w`\v`],[12,w`\f`],[13,w`\r`],[8232,w`\u2028`],[8233,w`\u2029`],[65279,w`\uFEFF`]]),Xa=new RegExp("^\\p{Cased}$","u");function Ot(e){return Xa.test(e)}function Rr(e,t){const n=!!t?.firstOnly,r=e.min.value,s=e.max.value,o=[];if(r<65&&(s===65535||s>=131071)||r===65536&&s>=131071)return o;for(let i=r;i<=s;i++){const a=A(i);if(!Ot(a))continue;const c=Sr(a).filter(l=>{const u=l.codePointAt(0);return u<r||u>s});if(c.length&&(o.push(...c),n))break}return o}function re(e,{escDigit:t,inCharClass:n,useFlagV:r}){if(An.has(e))return An.get(e);if(e<32||e>126&&e<160||e>262143||t&&Ja(e))return e>255?`\\u{${e.toString(16).toUpperCase()}}`:`\\x${e.toString(16).toUpperCase().padStart(2,"0")}`;const s=n?r?Va:qa:Ha,o=A(e);return(s.has(o)?"\\":"")+o}function Qa(e){const t=e.map(s=>s.codePointAt(0)).sort((s,o)=>s-o),n=[];let r=null;for(let s=0;s<t.length;s++)t[s+1]===t[s]+1?r??=t[s]:r===null?n.push(t[s]):(n.push([r,t[s]]),r=null);return n}function Ka(e,t,n){if(e)return">";let r="";if(t&&n){const{enable:s,disable:o}=t;r=(s?.ignoreCase?"i":"")+(s?.dotAll?"s":"")+(o?"-":"")+(o?.ignoreCase?"i":"")+(o?.dotAll?"s":"")}return`${r}:`}function Za({kind:e,max:t,min:n}){let r;return!n&&t===1?r="?":!n&&t===1/0?r="*":n===1&&t===1/0?r="+":n===t?r=`{${n}}`:r=`{${n},${t===1/0?"":t}}`,r+{greedy:"",lazy:"?",possessive:"+"}[e]}function En({type:e}){return e==="CapturingGroup"||e==="Group"||e==="LookaroundAssertion"}function Ja(e){return e>47&&e<58}function In({type:e,value:t}){return e==="Character"&&t===45}var Ya=class It extends RegExp{#t=new Map;#e=null;#r;#n=null;#s=null;rawOptions={};get source(){return this.#r||"(?:)"}constructor(t,n,r){const s=!!r?.lazyCompile;if(t instanceof RegExp){if(r)throw new Error("Cannot provide options when copying a regexp");const o=t;super(o,n),this.#r=o.source,o instanceof It&&(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?"":t,n),this.#r=t,this.#t=tc(o.hiddenCaptures,o.transfers),this.#s=o.strategy,this.rawOptions=r??{}}s||(this.#e=this)}exec(t){if(!this.#e){const{lazyCompile:s,...o}=this.rawOptions;this.#e=new It(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(t.slice(r));return s&&(ec(s,r,t,this.hasIndices),this.lastIndex+=r),s}return this.#o(t)}#o(t){this.#e.lastIndex=this.lastIndex;const n=super.exec.call(this.#e,t);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:a,transferTo:c}=this.#t.get(i)??{};if(a?o.push(null):(o.push(n.length),n.push(r[i]),this.hasIndices&&n.indices.push(s[i])),c&&r[i]!==void 0){const l=o[c];if(!l)throw new Error(`Invalid capture transfer to "${l}"`);if(n[l]=r[i],this.hasIndices&&(n.indices[l]=s[i]),n.groups){this.#n||(this.#n=nc(this.source));const u=this.#n.get(c);u&&(n.groups[u]=r[i],this.hasIndices&&(n.indices.groups[u]=s[i]))}}}return n}};function ec(e,t,n,r){if(e.index+=t,e.input=n,r){const s=e.indices;for(let i=0;i<s.length;i++){const a=s[i];a&&(s[i]=[a[0]+t,a[1]+t])}const o=s.groups;o&&Object.keys(o).forEach(i=>{const a=o[i];a&&(o[i]=[a[0]+t,a[1]+t])})}}function tc(e,t){const n=new Map;for(const r of e)n.set(r,{hidden:!0});for(const[r,s]of t)for(const o of s)ye(n,o,{}).transferTo=r;return n}function nc(e){const t=/(?<capture>\((?:\?<(?![=!])(?<name>[^>]+)>|(?!\?)))|\\?./gsu,n=new Map;let r=0,s=0,o;for(;o=t.exec(e);){const{0:i,groups:{capture:a,name:c}}=o;i==="["?r++:r?i==="]"&&r--:a&&(s++,c&&n.set(s,c))}return n}function rc(e,t){const n=sc(e,t);return n.options?new Ya(n.pattern,n.flags,n.options):new RegExp(n.pattern,n.flags)}function sc(e,t){const n=Cr(t),r=dr(e,{flags:n.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline},skipBackrefValidation:n.rules.allowOrphanBackrefs,unicodePropertyMap:Mt}),s=$a(r,{accuracy:n.accuracy,asciiWordBoundaries:n.rules.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,bestEffortTarget:n.target}),o=Ua(s,n),i=wa(o.pattern,{captureTransfers:o._captureTransfers,hiddenCaptures:o._hiddenCaptures,mode:"external"}),a=ba(i.pattern),c=ya(a.pattern,{captureTransfers:i.captureTransfers,hiddenCaptures:i.hiddenCaptures}),l={pattern:c.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=c.hiddenCaptures.sort((p,y)=>p-y),h=Array.from(c.captureTransfers),f=s._strategy,d=l.pattern.length>=n.lazyCompileLength;(u.length||h.length||f||d)&&(l.options={...u.length&&{hiddenCaptures:u},...h.length&&{transfers:h},...f&&{strategy:f},...d&&{lazyCompile:d}})}return l}function oc(e,t){return rc(e,{global:!0,hasIndices:!0,lazyCompileLength:3e3,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...t})}function ic(e={}){const t={target:"auto",cache:new Map,...e};return t.regexConstructor||=n=>oc(n,{target:t.target}),{createScanner(n){return new Ci(n,t)},createString(n){return{content:n}}}}let vn;const ht=new Map;function ac(){return vn??=wi({themes:[jt(()=>import("./github-light-DAi9KRSo.js"),[]),jt(()=>import("./github-dark-DHJKELXO.js"),[])],langs:[],engine:ic()}),vn}function cc(e,t,n){let r=ht.get(t);return r||(r=n().then(s=>e.loadLanguage(s.default)).then(()=>{}).catch(s=>{throw ht.delete(t),s}),ht.set(t,r)),r}async function hc(e,t){const n=Gr(t);if(!n)return;const r=await ac(),s=Mr(n)?void 0:Or.get(n);return s&&await cc(r,n,s),r.codeToHtml(e,{lang:n,themes:{light:"github-light",dark:"github-dark"}})}export{hc as highlightToHtml};