@mintlify/components 1.0.2 → 1.0.3

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 (310) hide show
  1. package/dist/_virtual/index3.js +3 -2
  2. package/dist/_virtual/index4.js +2 -3
  3. package/dist/node_modules/.pnpm/mermaid@11.12.2/node_modules/mermaid/dist/chunks/mermaid.core/c4Diagram-YG6GDRKO.js +1 -1
  4. package/dist/node_modules/.pnpm/mermaid@11.12.2/node_modules/mermaid/dist/chunks/mermaid.core/chunk-S3R3BYOJ.js +1 -1
  5. package/dist/node_modules/.pnpm/mermaid@11.12.2/node_modules/mermaid/dist/chunks/mermaid.core/chunk-TZMSLE5B.js +1 -1
  6. package/dist/node_modules/.pnpm/mermaid@11.12.2/node_modules/mermaid/dist/chunks/mermaid.core/ganttDiagram-JELNMOA3.js +1 -1
  7. package/dist/node_modules/.pnpm/mermaid@11.12.2/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-WL72ISMW.js +1 -1
  8. package/dist/node_modules/.pnpm/simple-swizzle@0.2.4/node_modules/simple-swizzle/index.js +1 -1
  9. package/dist/utils/shiki/worker-client.d.ts.map +1 -1
  10. package/dist/utils/shiki/worker-client.js +23 -15
  11. package/dist/utils/shiki/worker.js +14835 -0
  12. package/package.json +1 -1
  13. package/dist/assets/abap-5JJ_uXwM.js +0 -7
  14. package/dist/assets/actionscript-3-xjuv3cwm.js +0 -7
  15. package/dist/assets/ada-BG05PpOB.js +0 -7
  16. package/dist/assets/andromeeda-CXWv3Vhr.js +0 -4
  17. package/dist/assets/angular-html-tB_lckcv.js +0 -41
  18. package/dist/assets/angular-ts-CvnzV5YA.js +0 -29
  19. package/dist/assets/apache-D7jlTOw0.js +0 -7
  20. package/dist/assets/apex-wXvMBDlE.js +0 -7
  21. package/dist/assets/apl-BRhPozt1.js +0 -18
  22. package/dist/assets/applescript-guFn5j4s.js +0 -7
  23. package/dist/assets/ara-D87wAYhe.js +0 -7
  24. package/dist/assets/asciidoc-wIP9SKIB.js +0 -7
  25. package/dist/assets/asm-BIl1E4lX.js +0 -7
  26. package/dist/assets/astro-Dd3Gge64.js +0 -19
  27. package/dist/assets/aurora-x-C6DmnWDt.js +0 -4
  28. package/dist/assets/awk-x1P7Yy6J.js +0 -7
  29. package/dist/assets/ayu-dark-D2hjRftL.js +0 -4
  30. package/dist/assets/ballerina-D1k6pTDA.js +0 -7
  31. package/dist/assets/bat-CKn1WSW3.js +0 -7
  32. package/dist/assets/beancount-1v_PY4BB.js +0 -7
  33. package/dist/assets/berry-ChXc1sMd.js +0 -7
  34. package/dist/assets/bibtex-YjwILF7F.js +0 -7
  35. package/dist/assets/bicep-C0D_R8_K.js +0 -7
  36. package/dist/assets/blade-BFqftS0r.js +0 -22
  37. package/dist/assets/bsl-DJzmyrer.js +0 -9
  38. package/dist/assets/c-xjDmHeY4.js +0 -7
  39. package/dist/assets/c3-4IvzIgb1.js +0 -7
  40. package/dist/assets/cadence-4_3YDhNk.js +0 -7
  41. package/dist/assets/cairo-CckC4pbv.js +0 -9
  42. package/dist/assets/catppuccin-frappe-B5VVdV_e.js +0 -4
  43. package/dist/assets/catppuccin-latte-D8pvGdu1.js +0 -4
  44. package/dist/assets/catppuccin-macchiato-HRcjrIrY.js +0 -4
  45. package/dist/assets/catppuccin-mocha-CIwIEnSB.js +0 -4
  46. package/dist/assets/clarity-LYkNoMZG.js +0 -7
  47. package/dist/assets/clojure-BKPgNuET.js +0 -7
  48. package/dist/assets/cmake-DKfc4EHO.js +0 -7
  49. package/dist/assets/cobol-B4E4chqL.js +0 -13
  50. package/dist/assets/codeowners-CGzOUqRt.js +0 -7
  51. package/dist/assets/codeql-CB2tU2yr.js +0 -7
  52. package/dist/assets/coffee-CZwg37T3.js +0 -9
  53. package/dist/assets/common-lisp-Dpa6SDDF.js +0 -7
  54. package/dist/assets/constants-BVgHm26B.js +0 -180
  55. package/dist/assets/coq-BcttDLdJ.js +0 -7
  56. package/dist/assets/cpp-UrQuN-Tj.js +0 -22
  57. package/dist/assets/crystal-BWsFQXRE.js +0 -19
  58. package/dist/assets/csharp-DY-PZq5E.js +0 -7
  59. package/dist/assets/css-BWzGoL0I.js +0 -7
  60. package/dist/assets/csv-DH-1IWvI.js +0 -7
  61. package/dist/assets/cue-HSbRnhKw.js +0 -7
  62. package/dist/assets/cypher-DoZ7GUDp.js +0 -7
  63. package/dist/assets/d-CeeVpqRv.js +0 -7
  64. package/dist/assets/dark-plus-BZtx1JS2.js +0 -4
  65. package/dist/assets/dart-BMrxcFdH.js +0 -7
  66. package/dist/assets/dax-B2DK8VnI.js +0 -7
  67. package/dist/assets/desktop-C_92N0gp.js +0 -7
  68. package/dist/assets/diff-CIoVq7iw.js +0 -7
  69. package/dist/assets/docker-C_b4d5MG.js +0 -7
  70. package/dist/assets/dotenv-CTk-83yR.js +0 -7
  71. package/dist/assets/dracula-C90mcX-J.js +0 -4
  72. package/dist/assets/dracula-soft-CfxSDbho.js +0 -4
  73. package/dist/assets/dream-maker-BRhjIgJd.js +0 -7
  74. package/dist/assets/edge-D491zDED.js +0 -15
  75. package/dist/assets/elixir-Czy9FtQr.js +0 -11
  76. package/dist/assets/elm-BIz5FEly.js +0 -10
  77. package/dist/assets/emacs-lisp-BGC9IiHy.js +0 -7
  78. package/dist/assets/engine-compile-Nals-rd_.js +0 -2655
  79. package/dist/assets/engine-javascript-kJK-uiL8.js +0 -26
  80. package/dist/assets/erb-BDLLm5k9.js +0 -28
  81. package/dist/assets/erlang-Bs5tgDCH.js +0 -9
  82. package/dist/assets/everforest-dark-WkkMlVdr.js +0 -4
  83. package/dist/assets/everforest-light-BnEIoJmx.js +0 -4
  84. package/dist/assets/fennel-Bcsiz5ip.js +0 -7
  85. package/dist/assets/fish-DHyTDlfQ.js +0 -7
  86. package/dist/assets/fluent-4neBKDDj.js +0 -7
  87. package/dist/assets/fortran-fixed-form-CzBifAhA.js +0 -9
  88. package/dist/assets/fortran-free-form-CgyZ4k0y.js +0 -7
  89. package/dist/assets/fsharp-9GbbySMJ.js +0 -9
  90. package/dist/assets/gdresource-C-gYar6F.js +0 -11
  91. package/dist/assets/gdscript-BlipAn-9.js +0 -7
  92. package/dist/assets/gdshader-OUoLz6Pt.js +0 -7
  93. package/dist/assets/genie-CCD_4Lwj.js +0 -7
  94. package/dist/assets/get-code-styling-BR97GyAG.js +0 -22
  95. package/dist/assets/gherkin-DtBWBYmY.js +0 -7
  96. package/dist/assets/git-commit-CIBsd3Oe.js +0 -9
  97. package/dist/assets/git-rebase-Bsia5skB.js +0 -9
  98. package/dist/assets/github-dark-Crb_T9c1.js +0 -4
  99. package/dist/assets/github-dark-default-CrymNA3e.js +0 -4
  100. package/dist/assets/github-dark-dimmed-DVypsQQ6.js +0 -4
  101. package/dist/assets/github-dark-high-contrast-oosJriQF.js +0 -4
  102. package/dist/assets/github-light-DzgloXIJ.js +0 -4
  103. package/dist/assets/github-light-default-BUaqj3Kk.js +0 -4
  104. package/dist/assets/github-light-high-contrast-Be7TuOaG.js +0 -4
  105. package/dist/assets/gleam-Bby7sLtj.js +0 -7
  106. package/dist/assets/glimmer-js-BzgHg3Zc.js +0 -15
  107. package/dist/assets/glimmer-ts-BlaPG9Cu.js +0 -15
  108. package/dist/assets/glsl-B7qnt91l.js +0 -9
  109. package/dist/assets/gn-BZhHIoL6.js +0 -7
  110. package/dist/assets/gnuplot-ko8wwdty.js +0 -7
  111. package/dist/assets/go-C31R0L3d.js +0 -7
  112. package/dist/assets/graphql-DkLU_y6F.js +0 -15
  113. package/dist/assets/groovy-CnONGBTg.js +0 -7
  114. package/dist/assets/gruvbox-dark-hard-w2v6PtUq.js +0 -4
  115. package/dist/assets/gruvbox-dark-medium-BkadlV_U.js +0 -4
  116. package/dist/assets/gruvbox-dark-soft-BHFO6CEk.js +0 -4
  117. package/dist/assets/gruvbox-light-hard-9A_pD-e-.js +0 -4
  118. package/dist/assets/gruvbox-light-medium-DS4uqfa1.js +0 -4
  119. package/dist/assets/gruvbox-light-soft-qMWiTKK4.js +0 -4
  120. package/dist/assets/hack-CmE9IiKA.js +0 -13
  121. package/dist/assets/haml-DNJm2iOQ.js +0 -11
  122. package/dist/assets/handlebars-CKbDi_Yu.js +0 -15
  123. package/dist/assets/haskell-2dsAc57b.js +0 -7
  124. package/dist/assets/haxe-OKRacM9E.js +0 -7
  125. package/dist/assets/hcl-DWQu2dqK.js +0 -7
  126. package/dist/assets/hjson-By_UsfXI.js +0 -7
  127. package/dist/assets/hlsl-DA61eaD3.js +0 -7
  128. package/dist/assets/houston-CK0N9cPp.js +0 -4
  129. package/dist/assets/html-Djngp-pR.js +0 -11
  130. package/dist/assets/html-derivative-fp-x026m.js +0 -11
  131. package/dist/assets/http-CVXrBmpc.js +0 -20
  132. package/dist/assets/hurl-B08iSRaK.js +0 -18
  133. package/dist/assets/hxml-CwhzGRqU.js +0 -9
  134. package/dist/assets/hy-B23VqsRP.js +0 -7
  135. package/dist/assets/imba-C1GSCVFf.js +0 -7
  136. package/dist/assets/index-CTe_RbRk.js +0 -8103
  137. package/dist/assets/index-LI8xteqW.js +0 -670
  138. package/dist/assets/ini-r1O4-awP.js +0 -7
  139. package/dist/assets/java-Bl-5EZmB.js +0 -7
  140. package/dist/assets/javascript-Cq55jE6w.js +0 -7
  141. package/dist/assets/jinja-B9JtQer8.js +0 -16
  142. package/dist/assets/jison-9WPWo0xg.js +0 -9
  143. package/dist/assets/json-CndaR9w5.js +0 -7
  144. package/dist/assets/json5-C8Jm9K5X.js +0 -7
  145. package/dist/assets/jsonc-mlgADggJ.js +0 -7
  146. package/dist/assets/jsonl-CBj3pbR_.js +0 -7
  147. package/dist/assets/jsonnet-B_sZ3RZB.js +0 -7
  148. package/dist/assets/jssm-CvtepJVU.js +0 -7
  149. package/dist/assets/jsx-BfjkQ0v5.js +0 -7
  150. package/dist/assets/julia-B35Hq63p.js +0 -20
  151. package/dist/assets/kanagawa-dragon-Dgsvhj-I.js +0 -4
  152. package/dist/assets/kanagawa-lotus-bk4_W8LM.js +0 -4
  153. package/dist/assets/kanagawa-wave-CVNUZ7bU.js +0 -4
  154. package/dist/assets/kdl-CwdrBlJU.js +0 -7
  155. package/dist/assets/kotlin-K4QQzEsQ.js +0 -7
  156. package/dist/assets/kusto-CsRvhw27.js +0 -7
  157. package/dist/assets/laserwave-BU7zaG-q.js +0 -4
  158. package/dist/assets/latex-9MJ_87z0.js +0 -10
  159. package/dist/assets/lean-Cp_iMYZj.js +0 -7
  160. package/dist/assets/less-CFxJbkOX.js +0 -7
  161. package/dist/assets/light-plus-CCnaaxEe.js +0 -4
  162. package/dist/assets/liquid-CnCkCuIx.js +0 -15
  163. package/dist/assets/llvm-B-J6pQHT.js +0 -7
  164. package/dist/assets/log-BhdudKf6.js +0 -7
  165. package/dist/assets/logo-DdZuFRsA.js +0 -7
  166. package/dist/assets/lua-Du5IjHGG.js +0 -9
  167. package/dist/assets/luau-DphI6QoV.js +0 -7
  168. package/dist/assets/make-CzMpGB61.js +0 -7
  169. package/dist/assets/markdown-BIyFz8QW.js +0 -7
  170. package/dist/assets/marko-DCDpuARP.js +0 -15
  171. package/dist/assets/material-theme-B-3T0qQC.js +0 -4
  172. package/dist/assets/material-theme-darker-DMHCIvq5.js +0 -4
  173. package/dist/assets/material-theme-lighter-CnKSyNS5.js +0 -4
  174. package/dist/assets/material-theme-ocean-BKq6ZsFv.js +0 -4
  175. package/dist/assets/material-theme-palenight-BaYUoLXq.js +0 -4
  176. package/dist/assets/matlab-CJkuh4eh.js +0 -7
  177. package/dist/assets/mdc-DJAYQbdE.js +0 -16
  178. package/dist/assets/mdx-DBtujtWe.js +0 -7
  179. package/dist/assets/mermaid-HX_erI9P.js +0 -7
  180. package/dist/assets/min-dark-YawBJZLm.js +0 -4
  181. package/dist/assets/min-light-CqsTzpMg.js +0 -4
  182. package/dist/assets/mipsasm-CCIl-TEQ.js +0 -7
  183. package/dist/assets/mojo-CaOXUStQ.js +0 -7
  184. package/dist/assets/monokai-DaNL4wHF.js +0 -4
  185. package/dist/assets/moonbit-Cht8gpEw.js +0 -7
  186. package/dist/assets/move-BfRzl1yI.js +0 -7
  187. package/dist/assets/narrat-yNVO4v0G.js +0 -7
  188. package/dist/assets/nextflow-Vax1k-wQ.js +0 -7
  189. package/dist/assets/nginx-BGSh0oh7.js +0 -10
  190. package/dist/assets/night-owl-DEYddbGH.js +0 -4
  191. package/dist/assets/nim-BrBQX9sU.js +0 -22
  192. package/dist/assets/nix-DPigNF-w.js +0 -12
  193. package/dist/assets/nord-CUKU048J.js +0 -4
  194. package/dist/assets/nushell-607vq_HD.js +0 -7
  195. package/dist/assets/objective-c-CGXCwEak.js +0 -7
  196. package/dist/assets/objective-cpp-C6Ou-DLk.js +0 -7
  197. package/dist/assets/ocaml-B8c2W4N8.js +0 -7
  198. package/dist/assets/one-dark-pro-XdKxImzj.js +0 -4
  199. package/dist/assets/one-light-ByR-0BzF.js +0 -4
  200. package/dist/assets/openscad-jtaZZ0ry.js +0 -7
  201. package/dist/assets/pascal-Dyzoiklv.js +0 -7
  202. package/dist/assets/perl-CzrQlOhM.js +0 -18
  203. package/dist/assets/php-Dy1EJ_El.js +0 -20
  204. package/dist/assets/pkl-B7NRYePu.js +0 -7
  205. package/dist/assets/plastic-lmGvlDWy.js +0 -4
  206. package/dist/assets/plsql-ZYRyC0wP.js +0 -7
  207. package/dist/assets/po-CHOVNvtJ.js +0 -7
  208. package/dist/assets/poimandres-C_MUMTwG.js +0 -4
  209. package/dist/assets/polar-CElS9PCS.js +0 -7
  210. package/dist/assets/postcss-DgldbzUq.js +0 -7
  211. package/dist/assets/powerquery-B6VmGZs1.js +0 -7
  212. package/dist/assets/powershell-Dp4oaXtH.js +0 -7
  213. package/dist/assets/prisma-CPG4K8GD.js +0 -7
  214. package/dist/assets/prolog-BfH16pdb.js +0 -7
  215. package/dist/assets/proto-DRhBl2v_.js +0 -7
  216. package/dist/assets/pug-CRn2pWji.js +0 -13
  217. package/dist/assets/puppet-D93mTCzv.js +0 -7
  218. package/dist/assets/purescript-BwFPZeJE.js +0 -7
  219. package/dist/assets/python-hNCB2wYL.js +0 -7
  220. package/dist/assets/qml-B7tPv6LL.js +0 -9
  221. package/dist/assets/qmldir-C_cCg2m9.js +0 -7
  222. package/dist/assets/qss-CXFHvGeG.js +0 -7
  223. package/dist/assets/r-DW2dRJNU.js +0 -7
  224. package/dist/assets/racket-CElNGJsF.js +0 -7
  225. package/dist/assets/raku-BGNf9XOF.js +0 -7
  226. package/dist/assets/razor-CyXhXk_P.js +0 -13
  227. package/dist/assets/red-AJNT05eU.js +0 -4
  228. package/dist/assets/reg-B1yGSPeX.js +0 -7
  229. package/dist/assets/regexp-DpBcpYls.js +0 -7
  230. package/dist/assets/rel-COHg19E9.js +0 -7
  231. package/dist/assets/riscv-DGE7iFEu.js +0 -7
  232. package/dist/assets/rose-pine-BpSSTpDl.js +0 -4
  233. package/dist/assets/rose-pine-dawn-JuXMWM7e.js +0 -4
  234. package/dist/assets/rose-pine-moon-DfNEd67D.js +0 -4
  235. package/dist/assets/rosmsg-DV4uqfTE.js +0 -7
  236. package/dist/assets/rst-D95lMiha.js +0 -37
  237. package/dist/assets/ruby-BUW3G11x.js +0 -37
  238. package/dist/assets/rust-eyDPxu_F.js +0 -7
  239. package/dist/assets/sas-BY4ClbAs.js +0 -9
  240. package/dist/assets/sass-DgfD_AjS.js +0 -7
  241. package/dist/assets/scala-Bk1H2mSp.js +0 -7
  242. package/dist/assets/scheme-CvUmbwed.js +0 -7
  243. package/dist/assets/scss-BxX94kyr.js +0 -9
  244. package/dist/assets/sdbl-CsDj0b2n.js +0 -7
  245. package/dist/assets/shaderlab-BR6dybZt.js +0 -9
  246. package/dist/assets/shellscript-BFESB3IN.js +0 -7
  247. package/dist/assets/shellsession-BUDs6Lj1.js +0 -9
  248. package/dist/assets/slack-dark-DWWJ5rYK.js +0 -4
  249. package/dist/assets/slack-ochin-Bq5JRIP5.js +0 -4
  250. package/dist/assets/smalltalk-CepYz02F.js +0 -7
  251. package/dist/assets/snazzy-light-CI6w30cq.js +0 -4
  252. package/dist/assets/snippet-presets-C1agbVNG.js +0 -149
  253. package/dist/assets/solarized-dark-Bgqg9546.js +0 -4
  254. package/dist/assets/solarized-light-Cfhyx18w.js +0 -4
  255. package/dist/assets/solidity-Dy7cwWHW.js +0 -7
  256. package/dist/assets/soy-DNAEqrJs.js +0 -11
  257. package/dist/assets/sparql-xS45ySCY.js +0 -9
  258. package/dist/assets/splunk-xsP0MVkt.js +0 -7
  259. package/dist/assets/sql-DndjXwhS.js +0 -7
  260. package/dist/assets/ssh-config-ehSXrtEV.js +0 -7
  261. package/dist/assets/stata-BG4dPxUs.js +0 -9
  262. package/dist/assets/stylus-BoZJ_eV7.js +0 -7
  263. package/dist/assets/svelte-By0lGVKm.js +0 -15
  264. package/dist/assets/swift-QfFuvaTs.js +0 -7
  265. package/dist/assets/synthwave-84-DXKOZPq5.js +0 -4
  266. package/dist/assets/system-verilog-BEcmvm6Z.js +0 -7
  267. package/dist/assets/systemd-DJzDbKrW.js +0 -7
  268. package/dist/assets/talonscript-Djb-VPry.js +0 -7
  269. package/dist/assets/tasl-p9F3iH-j.js +0 -7
  270. package/dist/assets/tcl-3f-uwoUo.js +0 -7
  271. package/dist/assets/templ-C8RdSEL9.js +0 -13
  272. package/dist/assets/terraform-DgWhF4Yd.js +0 -7
  273. package/dist/assets/tex-S1UlajAM.js +0 -9
  274. package/dist/assets/tokyo-night-BAQ_Myi4.js +0 -4
  275. package/dist/assets/toml-BnyEyEPT.js +0 -7
  276. package/dist/assets/ts-tags-DHSmDqBZ.js +0 -54
  277. package/dist/assets/tsv-DY-yErdv.js +0 -7
  278. package/dist/assets/tsx-42HYAIDq.js +0 -7
  279. package/dist/assets/turtle-zqT8DlFI.js +0 -7
  280. package/dist/assets/twig-PY8yc1PN.js +0 -36
  281. package/dist/assets/typescript-B2_-ihnN.js +0 -7
  282. package/dist/assets/typespec-5eSNSxjj.js +0 -7
  283. package/dist/assets/typst-BW5EogfV.js +0 -7
  284. package/dist/assets/v-BMYuw6y3.js +0 -7
  285. package/dist/assets/vala-DZNmMJCf.js +0 -7
  286. package/dist/assets/vb-6IyLx8lg.js +0 -7
  287. package/dist/assets/verilog-CBEeotQw.js +0 -7
  288. package/dist/assets/vesper-BJtMxa6W.js +0 -4
  289. package/dist/assets/vhdl-Qbjr_6hW.js +0 -7
  290. package/dist/assets/viml-Ce8qq_0D.js +0 -7
  291. package/dist/assets/vitesse-black-BiRwe6jA.js +0 -4
  292. package/dist/assets/vitesse-dark-44qkAq30.js +0 -4
  293. package/dist/assets/vitesse-light-KXY5XYnn.js +0 -4
  294. package/dist/assets/vue-0FAXi_tn.js +0 -40
  295. package/dist/assets/vue-html-DiaQkc4E.js +0 -9
  296. package/dist/assets/vue-vine-BqFfTCsJ.js +0 -19
  297. package/dist/assets/vyper-Bq7Z2-Ss.js +0 -7
  298. package/dist/assets/wasm-BdTJGc7T.js +0 -7
  299. package/dist/assets/wasm-DQxwEHae.js +0 -7
  300. package/dist/assets/wenyan-ZWlLIQIr.js +0 -7
  301. package/dist/assets/wgsl-C7jKgLAu.js +0 -7
  302. package/dist/assets/wikitext-Bd2wE6rj.js +0 -7
  303. package/dist/assets/wit-14OfqCWW.js +0 -7
  304. package/dist/assets/wolfram-RapNeSab.js +0 -7
  305. package/dist/assets/worker-DAn5D1Z1.js +0 -359
  306. package/dist/assets/xml-Du1cw7kN.js +0 -9
  307. package/dist/assets/xsl-CfczXwS3.js +0 -10
  308. package/dist/assets/yaml-D_xpd4DU.js +0 -7
  309. package/dist/assets/zenscript-DaonNBty.js +0 -7
  310. package/dist/assets/zig-DWvk_5e3.js +0 -7
@@ -1,2655 +0,0 @@
1
- var Lr = Object.defineProperty;
2
- var Fr = Object.getPrototypeOf;
3
- var Gr = Reflect.get;
4
- var Oe = (e) => {
5
- throw TypeError(e);
6
- };
7
- var Pr = (e, r, t) => r in e ? Lr(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
8
- var we = (e, r, t) => Pr(e, typeof r != "symbol" ? r + "" : r, t), me = (e, r, t) => r.has(e) || Oe("Cannot " + t);
9
- var $ = (e, r, t) => (me(e, r, "read from private field"), t ? t.call(e) : r.get(e)), z = (e, r, t) => r.has(e) ? Oe("Cannot add the same private member more than once") : r instanceof WeakSet ? r.add(e) : r.set(e, t), M = (e, r, t, n) => (me(e, r, "write to private field"), n ? n.call(e, t) : r.set(e, t), t), ye = (e, r, t) => (me(e, r, "access private method"), t);
10
- var De = (e, r, t) => Gr(Fr(e), t, r);
11
- function re(e) {
12
- if ([...e].length !== 1) throw new Error(`Expected "${e}" to be a single code point`);
13
- return e.codePointAt(0);
14
- }
15
- function Rr(e, r, t) {
16
- return e.has(r) || e.set(r, t), e.get(r);
17
- }
18
- const Le = /* @__PURE__ */ new Set(["alnum", "alpha", "ascii", "blank", "cntrl", "digit", "graph", "lower", "print", "punct", "space", "upper", "word", "xdigit"]), x = String.raw;
19
- function te(e, r) {
20
- if (e == null) throw new Error(r ?? "Value expected");
21
- return e;
22
- }
23
- const ar = x`\[\^?`, ir = `c.? | C(?:-.?)?|${x`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${x`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${x`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${x`o\{[^\}]*\}?`}|${x`\d{1,3}`}`, Fe = /[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/, ue = new RegExp(x`
24
- \\ (?:
25
- ${ir}
26
- | [gk]<[^>]*>?
27
- | [gk]'[^']*'?
28
- | .
29
- )
30
- | \( (?:
31
- \? (?:
32
- [:=!>({]
33
- | <[=!]
34
- | <[^>]*>
35
- | '[^']*'
36
- | ~\|?
37
- | #(?:[^)\\]|\\.?)*
38
- | [^:)]*[:)]
39
- )?
40
- | \*[^\)]*\)?
41
- )?
42
- | (?:${Fe.source})+
43
- | ${ar}
44
- | .
45
- `.replace(/\s+/g, ""), "gsu"), Ce = new RegExp(x`
46
- \\ (?:
47
- ${ir}
48
- | .
49
- )
50
- | \[:(?:\^?\p{Alpha}+|\^):\]
51
- | ${ar}
52
- | &&
53
- | .
54
- `.replace(/\s+/g, ""), "gsu");
55
- function Ur(e, r = {}) {
56
- const t = { flags: "", ...r, rules: { captureGroup: !1, singleline: !1, ...r.rules } };
57
- if (typeof e != "string") throw new Error("String expected as pattern");
58
- const n = tt(t.flags), s = [n.extended], o = { captureGroup: t.rules.captureGroup, getCurrentModX() {
59
- return s.at(-1);
60
- }, numOpenGroups: 0, popModX() {
61
- s.pop();
62
- }, pushModX(p) {
63
- s.push(p);
64
- }, replaceCurrentModX(p) {
65
- s[s.length - 1] = p;
66
- }, singleline: t.rules.singleline };
67
- let a = [], i;
68
- for (ue.lastIndex = 0; i = ue.exec(e); ) {
69
- const p = Or(o, e, i[0], ue.lastIndex);
70
- p.tokens ? a.push(...p.tokens) : p.token && a.push(p.token), p.lastIndex !== void 0 && (ue.lastIndex = p.lastIndex);
71
- }
72
- const u = [];
73
- let c = 0;
74
- a.filter((p) => p.type === "GroupOpen").forEach((p) => {
75
- p.kind === "capturing" ? p.number = ++c : p.raw === "(" && u.push(p);
76
- }), c || u.forEach((p, f) => {
77
- p.kind = "capturing", p.number = f + 1;
78
- });
79
- const l = c || u.length;
80
- return { tokens: a.map((p) => p.type === "EscapedNumber" ? st(p, l) : p).flat(), flags: n };
81
- }
82
- function Or(e, r, t, n) {
83
- const [s, o] = t;
84
- if (t === "[" || t === "[^") {
85
- const a = Dr(r, t, n);
86
- return { tokens: a.tokens, lastIndex: a.lastIndex };
87
- }
88
- if (s === "\\") {
89
- if ("AbBGyYzZ".includes(o)) return { token: Be(t, t) };
90
- if (/^\\g[<']/.test(t)) {
91
- if (!/^\\g(?:<[^>]+>|'[^']+')$/.test(t)) throw new Error(`Invalid group name "${t}"`);
92
- return { token: Qr(t) };
93
- }
94
- if (/^\\k[<']/.test(t)) {
95
- if (!/^\\k(?:<[^>]+>|'[^']+')$/.test(t)) throw new Error(`Invalid group name "${t}"`);
96
- return { token: cr(t) };
97
- }
98
- if (o === "K") return { token: lr("keep", t) };
99
- if (o === "N" || o === "R") return { token: j("newline", t, { negate: o === "N" }) };
100
- if (o === "O") return { token: j("any", t) };
101
- if (o === "X") return { token: j("text_segment", t) };
102
- const a = ur(t, { inCharClass: !1 });
103
- return Array.isArray(a) ? { tokens: a } : { token: a };
104
- }
105
- if (s === "(") {
106
- if (o === "*") return { token: Yr(t) };
107
- if (t === "(?{") throw new Error(`Unsupported callout "${t}"`);
108
- if (t.startsWith("(?#")) {
109
- if (r[n] !== ")") throw new Error('Unclosed comment group "(?#"');
110
- return { lastIndex: n + 1 };
111
- }
112
- if (/^\(\?[-imx]+[:)]$/.test(t)) return { token: Kr(t, e) };
113
- if (e.pushModX(e.getCurrentModX()), e.numOpenGroups++, t === "(" && !e.captureGroup || t === "(?:") return { token: Y("group", t) };
114
- if (t === "(?>") return { token: Y("atomic", t) };
115
- if (t === "(?=" || t === "(?!" || t === "(?<=" || t === "(?<!") return { token: Y(t[2] === "<" ? "lookbehind" : "lookahead", t, { negate: t.endsWith("!") }) };
116
- if (t === "(" && e.captureGroup || t.startsWith("(?<") && t.endsWith(">") || t.startsWith("(?'") && t.endsWith("'")) return { token: Y("capturing", t, { ...t !== "(" && { name: t.slice(3, -1) } }) };
117
- if (t.startsWith("(?~")) {
118
- if (t === "(?~|") throw new Error(`Unsupported absence function kind "${t}"`);
119
- return { token: Y("absence_repeater", t) };
120
- }
121
- throw t === "(?(" ? new Error(`Unsupported conditional "${t}"`) : new Error(`Invalid or unsupported group option "${t}"`);
122
- }
123
- if (t === ")") {
124
- if (e.popModX(), e.numOpenGroups--, e.numOpenGroups < 0) throw new Error('Unmatched ")"');
125
- return { token: jr(t) };
126
- }
127
- if (e.getCurrentModX()) {
128
- if (t === "#") {
129
- const a = r.indexOf(`
130
- `, n);
131
- return { lastIndex: a === -1 ? r.length : a };
132
- }
133
- if (/^\s$/.test(t)) {
134
- const a = /\s+/y;
135
- return a.lastIndex = n, { lastIndex: a.exec(r) ? a.lastIndex : n };
136
- }
137
- }
138
- if (t === ".") return { token: j("dot", t) };
139
- if (t === "^" || t === "$") {
140
- const a = e.singleline ? { "^": x`\A`, $: x`\Z` }[t] : t;
141
- return { token: Be(a, t) };
142
- }
143
- return t === "|" ? { token: Tr(t) } : Fe.test(t) ? { tokens: ot(t) } : { token: P(re(t), t) };
144
- }
145
- function Dr(e, r, t) {
146
- const n = [Te(r[1] === "^", r)];
147
- let s = 1, o;
148
- for (Ce.lastIndex = t; o = Ce.exec(e); ) {
149
- const a = o[0];
150
- if (a[0] === "[" && a[1] !== ":") s++, n.push(Te(a[1] === "^", a));
151
- else if (a === "]") {
152
- if (n.at(-1).type === "CharacterClassOpen") n.push(P(93, a));
153
- else if (s--, n.push(Vr(a)), !s) break;
154
- } else {
155
- const i = Br(a);
156
- Array.isArray(i) ? n.push(...i) : n.push(i);
157
- }
158
- }
159
- return { tokens: n, lastIndex: Ce.lastIndex || e.length };
160
- }
161
- function Br(e) {
162
- if (e[0] === "\\") return ur(e, { inCharClass: !0 });
163
- if (e[0] === "[") {
164
- const r = /\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(e);
165
- if (!r || !Le.has(r.groups.name)) throw new Error(`Invalid POSIX class "${e}"`);
166
- return j("posix", e, { value: r.groups.name, negate: !!r.groups.negate });
167
- }
168
- return e === "-" ? zr(e) : e === "&&" ? Wr(e) : P(re(e), e);
169
- }
170
- function ur(e, { inCharClass: r }) {
171
- const t = e[1];
172
- if (t === "c" || t === "C") return Jr(e);
173
- if ("dDhHsSwW".includes(t)) return et(e);
174
- if (e.startsWith(x`\o{`)) throw new Error(`Incomplete, invalid, or unsupported octal code point "${e}"`);
175
- if (/^\\[pP]\{/.test(e)) {
176
- if (e.length === 3) throw new Error(`Incomplete or invalid Unicode property "${e}"`);
177
- return rt(e);
178
- }
179
- if (new RegExp("^\\\\x[89A-Fa-f]\\p{AHex}", "u").test(e)) try {
180
- const n = e.split(/\\x/).slice(1).map((a) => parseInt(a, 16)), s = new TextDecoder("utf-8", { ignoreBOM: !0, fatal: !0 }).decode(new Uint8Array(n)), o = new TextEncoder();
181
- return [...s].map((a) => {
182
- const i = [...o.encode(a)].map((u) => `\\x${u.toString(16)}`).join("");
183
- return P(re(a), i);
184
- });
185
- } catch {
186
- throw new Error(`Multibyte code "${e}" incomplete or invalid in Oniguruma`);
187
- }
188
- if (t === "u" || t === "x") return P(nt(e), e);
189
- if (Ve.has(t)) return P(Ve.get(t), e);
190
- if (/\d/.test(t)) return Hr(r, e);
191
- if (e === "\\") throw new Error(x`Incomplete escape "\"`);
192
- if (t === "M") throw new Error(`Unsupported meta "${e}"`);
193
- if ([...e].length === 2) return P(e.codePointAt(1), e);
194
- throw new Error(`Unexpected escape "${e}"`);
195
- }
196
- function Tr(e) {
197
- return { type: "Alternator", raw: e };
198
- }
199
- function Be(e, r) {
200
- return { type: "Assertion", kind: e, raw: r };
201
- }
202
- function cr(e) {
203
- return { type: "Backreference", raw: e };
204
- }
205
- function P(e, r) {
206
- return { type: "Character", value: e, raw: r };
207
- }
208
- function Vr(e) {
209
- return { type: "CharacterClassClose", raw: e };
210
- }
211
- function zr(e) {
212
- return { type: "CharacterClassHyphen", raw: e };
213
- }
214
- function Wr(e) {
215
- return { type: "CharacterClassIntersector", raw: e };
216
- }
217
- function Te(e, r) {
218
- return { type: "CharacterClassOpen", negate: e, raw: r };
219
- }
220
- function j(e, r, t = {}) {
221
- return { type: "CharacterSet", kind: e, ...t, raw: r };
222
- }
223
- function lr(e, r, t = {}) {
224
- return e === "keep" ? { type: "Directive", kind: e, raw: r } : { type: "Directive", kind: e, flags: te(t.flags), raw: r };
225
- }
226
- function Hr(e, r) {
227
- return { type: "EscapedNumber", inCharClass: e, raw: r };
228
- }
229
- function jr(e) {
230
- return { type: "GroupClose", raw: e };
231
- }
232
- function Y(e, r, t = {}) {
233
- return { type: "GroupOpen", kind: e, ...t, raw: r };
234
- }
235
- function Xr(e, r, t, n) {
236
- return { type: "NamedCallout", kind: e, tag: r, arguments: t, raw: n };
237
- }
238
- function Zr(e, r, t, n) {
239
- return { type: "Quantifier", kind: e, min: r, max: t, raw: n };
240
- }
241
- function Qr(e) {
242
- return { type: "Subroutine", raw: e };
243
- }
244
- const qr = /* @__PURE__ */ new Set(["COUNT", "CMP", "ERROR", "FAIL", "MAX", "MISMATCH", "SKIP", "TOTAL_COUNT"]), Ve = /* @__PURE__ */ new Map([["a", 7], ["b", 8], ["e", 27], ["f", 12], ["n", 10], ["r", 13], ["t", 9], ["v", 11]]);
245
- function Jr(e) {
246
- const r = e[1] === "c" ? e[2] : e[3];
247
- if (!r || !/[A-Za-z]/.test(r)) throw new Error(`Unsupported control character "${e}"`);
248
- return P(re(r.toUpperCase()) - 64, e);
249
- }
250
- function Kr(e, r) {
251
- let { on: t, off: n } = /^\(\?(?<on>[imx]*)(?:-(?<off>[-imx]*))?/.exec(e).groups;
252
- n ?? (n = "");
253
- const s = (r.getCurrentModX() || t.includes("x")) && !n.includes("x"), o = We(t), a = We(n), i = {};
254
- if (o && (i.enable = o), a && (i.disable = a), e.endsWith(")")) return r.replaceCurrentModX(s), lr("flags", e, { flags: i });
255
- if (e.endsWith(":")) return r.pushModX(s), r.numOpenGroups++, Y("group", e, { ...(o || a) && { flags: i } });
256
- throw new Error(`Unexpected flag modifier "${e}"`);
257
- }
258
- function Yr(e) {
259
- const r = /\(\*(?<name>[A-Za-z_]\w*)?(?:\[(?<tag>(?:[A-Za-z_]\w*)?)\])?(?:\{(?<args>[^}]*)\})?\)/.exec(e);
260
- if (!r) throw new Error(`Incomplete or invalid named callout "${e}"`);
261
- const { name: t, tag: n, args: s } = r.groups;
262
- if (!t) throw new Error(`Invalid named callout "${e}"`);
263
- if (n === "") throw new Error(`Named callout tag with empty value not allowed "${e}"`);
264
- const o = s ? s.split(",").filter((l) => l !== "").map((l) => /^[+-]?\d+$/.test(l) ? +l : l) : [], [a, i, u] = o, c = qr.has(t) ? t.toLowerCase() : "custom";
265
- switch (c) {
266
- case "fail":
267
- case "mismatch":
268
- case "skip":
269
- if (o.length > 0) throw new Error(`Named callout arguments not allowed "${o}"`);
270
- break;
271
- case "error":
272
- if (o.length > 1) throw new Error(`Named callout allows only one argument "${o}"`);
273
- if (typeof a == "string") throw new Error(`Named callout argument must be a number "${a}"`);
274
- break;
275
- case "max":
276
- if (!o.length || o.length > 2) throw new Error(`Named callout must have one or two arguments "${o}"`);
277
- if (typeof a == "string" && !/^[A-Za-z_]\w*$/.test(a)) throw new Error(`Named callout argument one must be a tag or number "${a}"`);
278
- if (o.length === 2 && (typeof i == "number" || !/^[<>X]$/.test(i))) throw new Error(`Named callout optional argument two must be '<', '>', or 'X' "${i}"`);
279
- break;
280
- case "count":
281
- case "total_count":
282
- if (o.length > 1) throw new Error(`Named callout allows only one argument "${o}"`);
283
- if (o.length === 1 && (typeof a == "number" || !/^[<>X]$/.test(a))) throw new Error(`Named callout optional argument must be '<', '>', or 'X' "${a}"`);
284
- break;
285
- case "cmp":
286
- if (o.length !== 3) throw new Error(`Named callout must have three arguments "${o}"`);
287
- if (typeof a == "string" && !/^[A-Za-z_]\w*$/.test(a)) throw new Error(`Named callout argument one must be a tag or number "${a}"`);
288
- if (typeof i == "number" || !/^(?:[<>!=]=|[<>])$/.test(i)) throw new Error(`Named callout argument two must be '==', '!=', '>', '<', '>=', or '<=' "${i}"`);
289
- if (typeof u == "string" && !/^[A-Za-z_]\w*$/.test(u)) throw new Error(`Named callout argument three must be a tag or number "${u}"`);
290
- break;
291
- case "custom":
292
- throw new Error(`Undefined callout name "${t}"`);
293
- default:
294
- throw new Error(`Unexpected named callout kind "${c}"`);
295
- }
296
- return Xr(c, n ?? null, (s == null ? void 0 : s.split(",")) ?? null, e);
297
- }
298
- function ze(e) {
299
- let r = null, t, n;
300
- if (e[0] === "{") {
301
- const { minStr: s, maxStr: o } = /^\{(?<minStr>\d*)(?:,(?<maxStr>\d*))?/.exec(e).groups, a = 1e5;
302
- if (+s > a || o && +o > a) throw new Error("Quantifier value unsupported in Oniguruma");
303
- if (t = +s, n = o === void 0 ? +s : o === "" ? 1 / 0 : +o, t > n && (r = "possessive", [t, n] = [n, t]), e.endsWith("?")) {
304
- if (r === "possessive") throw new Error('Unsupported possessive interval quantifier chain with "?"');
305
- r = "lazy";
306
- } else r || (r = "greedy");
307
- } else t = e[0] === "+" ? 1 : 0, n = e[0] === "?" ? 1 : 1 / 0, r = e[1] === "+" ? "possessive" : e[1] === "?" ? "lazy" : "greedy";
308
- return Zr(r, t, n, e);
309
- }
310
- function et(e) {
311
- const r = e[1].toLowerCase();
312
- return j({ d: "digit", h: "hex", s: "space", w: "word" }[r], e, { negate: e[1] !== r });
313
- }
314
- function rt(e) {
315
- const { p: r, neg: t, value: n } = /^\\(?<p>[pP])\{(?<neg>\^?)(?<value>[^}]+)/.exec(e).groups;
316
- return j("property", e, { value: n, negate: r === "P" && !t || r === "p" && !!t });
317
- }
318
- function We(e) {
319
- const r = {};
320
- return e.includes("i") && (r.ignoreCase = !0), e.includes("m") && (r.dotAll = !0), e.includes("x") && (r.extended = !0), Object.keys(r).length ? r : null;
321
- }
322
- function tt(e) {
323
- const r = { ignoreCase: !1, dotAll: !1, extended: !1, digitIsAscii: !1, posixIsAscii: !1, spaceIsAscii: !1, wordIsAscii: !1, textSegmentMode: null };
324
- for (let t = 0; t < e.length; t++) {
325
- const n = e[t];
326
- if (!"imxDPSWy".includes(n)) throw new Error(`Invalid flag "${n}"`);
327
- if (n === "y") {
328
- if (!/^y{[gw]}/.test(e.slice(t))) throw new Error('Invalid or unspecified flag "y" mode');
329
- r.textSegmentMode = e[t + 2] === "g" ? "grapheme" : "word", t += 3;
330
- continue;
331
- }
332
- r[{ i: "ignoreCase", m: "dotAll", x: "extended", D: "digitIsAscii", P: "posixIsAscii", S: "spaceIsAscii", W: "wordIsAscii" }[n]] = !0;
333
- }
334
- return r;
335
- }
336
- function nt(e) {
337
- 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}"`);
338
- const r = e[2] === "{" ? new RegExp("^\\\\x\\{\\s*(?<hex>\\p{AHex}+)", "u").exec(e).groups.hex : e.slice(2);
339
- return parseInt(r, 16);
340
- }
341
- function st(e, r) {
342
- const { raw: t, inCharClass: n } = e, s = t.slice(1);
343
- if (!n && (s !== "0" && s.length === 1 || s[0] !== "0" && +s <= r)) return [cr(t)];
344
- const o = [], a = s.match(/^[0-7]+|\d/g);
345
- for (let i = 0; i < a.length; i++) {
346
- const u = a[i];
347
- let c;
348
- if (i === 0 && u !== "8" && u !== "9") {
349
- if (c = parseInt(u, 8), c > 127) throw new Error(x`Octal encoded byte above 177 unsupported "${t}"`);
350
- } else c = re(u);
351
- o.push(P(c, (i === 0 ? "\\" : "") + u));
352
- }
353
- return o;
354
- }
355
- function ot(e) {
356
- const r = [], t = new RegExp(Fe, "gy");
357
- let n;
358
- for (; n = t.exec(e); ) {
359
- const s = n[0];
360
- if (s[0] === "{") {
361
- const o = /^\{(?<min>\d+),(?<max>\d+)\}\??$/.exec(s);
362
- if (o) {
363
- const { min: a, max: i } = o.groups;
364
- if (+a > +i && s.endsWith("?")) {
365
- t.lastIndex--, r.push(ze(s.slice(0, -1)));
366
- continue;
367
- }
368
- }
369
- }
370
- r.push(ze(s));
371
- }
372
- return r;
373
- }
374
- function pr(e, r) {
375
- if (!Array.isArray(e.body)) throw new Error("Expected node with body array");
376
- if (e.body.length !== 1) return !1;
377
- const t = e.body[0];
378
- return !r || Object.keys(r).every((n) => r[n] === t[n]);
379
- }
380
- function at(e) {
381
- return it.has(e.type);
382
- }
383
- const it = /* @__PURE__ */ new Set(["AbsenceFunction", "Backreference", "CapturingGroup", "Character", "CharacterClass", "CharacterSet", "Group", "Quantifier", "Subroutine"]);
384
- function fr(e, r = {}) {
385
- const t = { flags: "", normalizeUnknownPropertyNames: !1, skipBackrefValidation: !1, skipLookbehindValidation: !1, skipPropertyNameValidation: !1, unicodePropertyMap: null, ...r, rules: { captureGroup: !1, singleline: !1, ...r.rules } }, n = Ur(e, { flags: t.flags, rules: { captureGroup: t.rules.captureGroup, singleline: t.rules.singleline } }), s = (f, g) => {
386
- const d = n.tokens[o.nextIndex];
387
- switch (o.parent = f, o.nextIndex++, d.type) {
388
- case "Alternator":
389
- return Q();
390
- case "Assertion":
391
- return ut(d);
392
- case "Backreference":
393
- return ct(d, o);
394
- case "Character":
395
- return de(d.value, { useLastValid: !!g.isCheckingRangeEnd });
396
- case "CharacterClassHyphen":
397
- return lt(d, o, g);
398
- case "CharacterClassOpen":
399
- return pt(d, o, g);
400
- case "CharacterSet":
401
- return ft(d, o);
402
- case "Directive":
403
- return yt(d.kind, { flags: d.flags });
404
- case "GroupOpen":
405
- return dt(d, o, g);
406
- case "NamedCallout":
407
- return bt(d.kind, d.tag, d.arguments);
408
- case "Quantifier":
409
- return gt(d, o);
410
- case "Subroutine":
411
- return ht(d, o);
412
- default:
413
- throw new Error(`Unexpected token type "${d.type}"`);
414
- }
415
- }, o = { capturingGroups: [], hasNumberedRef: !1, namedGroupsByName: /* @__PURE__ */ new Map(), nextIndex: 0, normalizeUnknownPropertyNames: t.normalizeUnknownPropertyNames, parent: null, skipBackrefValidation: t.skipBackrefValidation, skipLookbehindValidation: t.skipLookbehindValidation, skipPropertyNameValidation: t.skipPropertyNameValidation, subroutines: [], tokens: n.tokens, unicodePropertyMap: t.unicodePropertyMap, walk: s }, a = kt(Ct(n.flags));
416
- let i = a.body[0];
417
- for (; o.nextIndex < n.tokens.length; ) {
418
- const f = s(i, {});
419
- f.type === "Alternative" ? (a.body.push(f), i = f) : i.body.push(f);
420
- }
421
- const { capturingGroups: u, hasNumberedRef: c, namedGroupsByName: l, subroutines: p } = o;
422
- if (c && l.size && !t.rules.captureGroup) throw new Error("Numbered backref/subroutine not allowed when using named capture");
423
- for (const { ref: f } of p) if (typeof f == "number") {
424
- if (f > u.length) throw new Error("Subroutine uses a group number that's not defined");
425
- f && (u[f - 1].isSubroutined = !0);
426
- } else if (l.has(f)) {
427
- if (l.get(f).length > 1) throw new Error(x`Subroutine uses a duplicate group name "\g<${f}>"`);
428
- l.get(f)[0].isSubroutined = !0;
429
- } else throw new Error(x`Subroutine uses a group name that's not defined "\g<${f}>"`);
430
- return a;
431
- }
432
- function ut({ kind: e }) {
433
- return Ie(te({ "^": "line_start", $: "line_end", "\\A": "string_start", "\\b": "word_boundary", "\\B": "word_boundary", "\\G": "search_start", "\\y": "text_segment_boundary", "\\Y": "text_segment_boundary", "\\z": "string_end", "\\Z": "string_end_newline" }[e], `Unexpected assertion kind "${e}"`), { negate: e === x`\B` || e === x`\Y` });
434
- }
435
- function ct({ raw: e }, r) {
436
- const t = /^\\k[<']/.test(e), n = t ? e.slice(3, -1) : e.slice(1), s = (o, a = !1) => {
437
- const i = r.capturingGroups.length;
438
- let u = !1;
439
- if (o > i) if (r.skipBackrefValidation) u = !0;
440
- else throw new Error(`Not enough capturing groups defined to the left "${e}"`);
441
- return r.hasNumberedRef = !0, Se(a ? i + 1 - o : o, { orphan: u });
442
- };
443
- if (t) {
444
- const o = /^(?<sign>-?)0*(?<num>[1-9]\d*)$/.exec(n);
445
- if (o) return s(+o.groups.num, !!o.groups.sign);
446
- if (/[-+]/.test(n)) throw new Error(`Invalid backref name "${e}"`);
447
- if (!r.namedGroupsByName.has(n)) throw new Error(`Group name not defined to the left "${e}"`);
448
- return Se(n);
449
- }
450
- return s(+n);
451
- }
452
- function lt(e, r, t) {
453
- const { tokens: n, walk: s } = r, o = r.parent, a = o.body.at(-1), i = n[r.nextIndex];
454
- if (!t.isCheckingRangeEnd && a && a.type !== "CharacterClass" && a.type !== "CharacterClassRange" && i && i.type !== "CharacterClassOpen" && i.type !== "CharacterClassClose" && i.type !== "CharacterClassIntersector") {
455
- const u = s(o, { ...t, isCheckingRangeEnd: !0 });
456
- if (a.type === "Character" && u.type === "Character") return o.body.pop(), mt(a, u);
457
- throw new Error("Invalid character class range");
458
- }
459
- return de(re("-"));
460
- }
461
- function pt({ negate: e }, r, t) {
462
- const { tokens: n, walk: s } = r, o = n[r.nextIndex], a = [pe()];
463
- let i = Xe(o);
464
- for (; i.type !== "CharacterClassClose"; ) {
465
- if (i.type === "CharacterClassIntersector") a.push(pe()), r.nextIndex++;
466
- else {
467
- const c = a.at(-1);
468
- c.body.push(s(c, t));
469
- }
470
- i = Xe(n[r.nextIndex], o);
471
- }
472
- const u = pe({ negate: e });
473
- return a.length === 1 ? u.body = a[0].body : (u.kind = "intersection", u.body = a.map((c) => c.body.length === 1 ? c.body[0] : c)), r.nextIndex++, u;
474
- }
475
- function ft({ kind: e, negate: r, value: t }, n) {
476
- const { normalizeUnknownPropertyNames: s, skipPropertyNameValidation: o, unicodePropertyMap: a } = n;
477
- if (e === "property") {
478
- const i = ge(t);
479
- if (Le.has(i) && !(a != null && a.has(i))) e = "posix", t = i;
480
- else return ee(t, { negate: r, normalizeUnknownPropertyNames: s, skipPropertyNameValidation: o, unicodePropertyMap: a });
481
- }
482
- return e === "posix" ? xt(t, { negate: r }) : ve(e, { negate: r });
483
- }
484
- function dt(e, r, t) {
485
- const { tokens: n, capturingGroups: s, namedGroupsByName: o, skipLookbehindValidation: a, walk: i } = r, u = $t(e), c = u.type === "AbsenceFunction", l = je(u), p = l && u.negate;
486
- if (u.type === "CapturingGroup" && (s.push(u), u.name && Rr(o, u.name, []).push(u)), c && t.isInAbsenceFunction) throw new Error("Nested absence function not supported by Oniguruma");
487
- let f = Ze(n[r.nextIndex]);
488
- for (; f.type !== "GroupClose"; ) {
489
- if (f.type === "Alternator") u.body.push(Q()), r.nextIndex++;
490
- else {
491
- const g = u.body.at(-1), d = i(g, { ...t, isInAbsenceFunction: t.isInAbsenceFunction || c, isInLookbehind: t.isInLookbehind || l, isInNegLookbehind: t.isInNegLookbehind || p });
492
- if (g.body.push(d), (l || t.isInLookbehind) && !a) {
493
- const w = "Lookbehind includes a pattern not allowed by Oniguruma";
494
- if (p || t.isInNegLookbehind) {
495
- if (He(d) || d.type === "CapturingGroup") throw new Error(w);
496
- } else if (He(d) || je(d) && d.negate) throw new Error(w);
497
- }
498
- }
499
- f = Ze(n[r.nextIndex]);
500
- }
501
- return r.nextIndex++, u;
502
- }
503
- function gt({ kind: e, min: r, max: t }, n) {
504
- const s = n.parent, o = s.body.at(-1);
505
- if (!o || !at(o)) throw new Error("Quantifier requires a repeatable token");
506
- const a = gr(e, r, t, o);
507
- return s.body.pop(), a;
508
- }
509
- function ht({ raw: e }, r) {
510
- const { capturingGroups: t, subroutines: n } = r;
511
- let s = e.slice(3, -1);
512
- const o = /^(?<sign>[-+]?)0*(?<num>[1-9]\d*)$/.exec(s);
513
- if (o) {
514
- const i = +o.groups.num, u = t.length;
515
- if (r.hasNumberedRef = !0, s = { "": i, "+": u + i, "-": u + 1 - i }[o.groups.sign], s < 1) throw new Error("Invalid subroutine number");
516
- } else s === "0" && (s = 0);
517
- const a = hr(s);
518
- return n.push(a), a;
519
- }
520
- function wt(e, r) {
521
- return { type: "AbsenceFunction", kind: e, body: ie(r == null ? void 0 : r.body) };
522
- }
523
- function Q(e) {
524
- return { type: "Alternative", body: wr(e == null ? void 0 : e.body) };
525
- }
526
- function Ie(e, r) {
527
- const t = { type: "Assertion", kind: e };
528
- return (e === "word_boundary" || e === "text_segment_boundary") && (t.negate = !!(r != null && r.negate)), t;
529
- }
530
- function Se(e, r) {
531
- const t = !!(r != null && r.orphan);
532
- return { type: "Backreference", ref: e, ...t && { orphan: t } };
533
- }
534
- function dr(e, r) {
535
- const t = { name: void 0, isSubroutined: !1, ...r };
536
- if (t.name !== void 0 && !Et(t.name)) throw new Error(`Group name "${t.name}" invalid in Oniguruma`);
537
- return { type: "CapturingGroup", number: e, ...t.name && { name: t.name }, ...t.isSubroutined && { isSubroutined: t.isSubroutined }, body: ie(r == null ? void 0 : r.body) };
538
- }
539
- function de(e, r) {
540
- const t = { useLastValid: !1, ...r };
541
- if (e > 1114111) {
542
- const n = e.toString(16);
543
- if (t.useLastValid) e = 1114111;
544
- else throw e > 1310719 ? new Error(`Invalid code point out of range "\\x{${n}}"`) : new Error(`Invalid code point out of range in JS "\\x{${n}}"`);
545
- }
546
- return { type: "Character", value: e };
547
- }
548
- function pe(e) {
549
- const r = { kind: "union", negate: !1, ...e };
550
- return { type: "CharacterClass", kind: r.kind, negate: r.negate, body: wr(e == null ? void 0 : e.body) };
551
- }
552
- function mt(e, r) {
553
- if (r.value < e.value) throw new Error("Character class range out of order");
554
- return { type: "CharacterClassRange", min: e, max: r };
555
- }
556
- function ve(e, r) {
557
- const t = !!(r != null && r.negate), n = { type: "CharacterSet", kind: e };
558
- return (e === "digit" || e === "hex" || e === "newline" || e === "space" || e === "word") && (n.negate = t), (e === "text_segment" || e === "newline" && !t) && (n.variableLength = !0), n;
559
- }
560
- function yt(e, r = {}) {
561
- if (e === "keep") return { type: "Directive", kind: e };
562
- if (e === "flags") return { type: "Directive", kind: e, flags: te(r.flags) };
563
- throw new Error(`Unexpected directive kind "${e}"`);
564
- }
565
- function Ct(e) {
566
- return { type: "Flags", ...e };
567
- }
568
- function N(e) {
569
- const r = e == null ? void 0 : e.atomic, t = e == null ? void 0 : e.flags;
570
- if (r && t) throw new Error("Atomic group cannot have flags");
571
- return { type: "Group", ...r && { atomic: r }, ...t && { flags: t }, body: ie(e == null ? void 0 : e.body) };
572
- }
573
- function H(e) {
574
- const r = { behind: !1, negate: !1, ...e };
575
- return { type: "LookaroundAssertion", kind: r.behind ? "lookbehind" : "lookahead", negate: r.negate, body: ie(e == null ? void 0 : e.body) };
576
- }
577
- function bt(e, r, t) {
578
- return { type: "NamedCallout", kind: e, tag: r, arguments: t };
579
- }
580
- function xt(e, r) {
581
- const t = !!(r != null && r.negate);
582
- if (!Le.has(e)) throw new Error(`Invalid POSIX class "${e}"`);
583
- return { type: "CharacterSet", kind: "posix", value: e, negate: t };
584
- }
585
- function gr(e, r, t, n) {
586
- if (r > t) throw new Error("Invalid reversed quantifier range");
587
- return { type: "Quantifier", kind: e, min: r, max: t, body: n };
588
- }
589
- function kt(e, r) {
590
- return { type: "Regex", body: ie(r == null ? void 0 : r.body), flags: e };
591
- }
592
- function hr(e) {
593
- return { type: "Subroutine", ref: e };
594
- }
595
- function ee(e, r) {
596
- var s;
597
- const t = { negate: !1, normalizeUnknownPropertyNames: !1, skipPropertyNameValidation: !1, unicodePropertyMap: null, ...r };
598
- let n = (s = t.unicodePropertyMap) == null ? void 0 : s.get(ge(e));
599
- if (!n) {
600
- if (t.normalizeUnknownPropertyNames) n = At(e);
601
- else if (t.unicodePropertyMap && !t.skipPropertyNameValidation) throw new Error(x`Invalid Unicode property "\p{${e}}"`);
602
- }
603
- return { type: "CharacterSet", kind: "property", value: n ?? e, negate: t.negate };
604
- }
605
- function $t({ flags: e, kind: r, name: t, negate: n, number: s }) {
606
- switch (r) {
607
- case "absence_repeater":
608
- return wt("repeater");
609
- case "atomic":
610
- return N({ atomic: !0 });
611
- case "capturing":
612
- return dr(s, { name: t });
613
- case "group":
614
- return N({ flags: e });
615
- case "lookahead":
616
- case "lookbehind":
617
- return H({ behind: r === "lookbehind", negate: n });
618
- default:
619
- throw new Error(`Unexpected group kind "${r}"`);
620
- }
621
- }
622
- function ie(e) {
623
- if (e === void 0) e = [Q()];
624
- else if (!Array.isArray(e) || !e.length || !e.every((r) => r.type === "Alternative")) throw new Error("Invalid body; expected array of one or more Alternative nodes");
625
- return e;
626
- }
627
- function wr(e) {
628
- if (e === void 0) e = [];
629
- else if (!Array.isArray(e) || !e.every((r) => !!r.type)) throw new Error("Invalid body; expected array of nodes");
630
- return e;
631
- }
632
- function He(e) {
633
- return e.type === "LookaroundAssertion" && e.kind === "lookahead";
634
- }
635
- function je(e) {
636
- return e.type === "LookaroundAssertion" && e.kind === "lookbehind";
637
- }
638
- function Et(e) {
639
- return /^[\p{Alpha}\p{Pc}][^)]*$/u.test(e);
640
- }
641
- function At(e) {
642
- return e.trim().replace(/[- _]+/g, "_").replace(/[A-Z][a-z]+(?=[A-Z])/g, "$&_").replace(/[A-Za-z]+/g, (r) => r[0].toUpperCase() + r.slice(1).toLowerCase());
643
- }
644
- function ge(e) {
645
- return e.replace(/[- _]+/g, "").toLowerCase();
646
- }
647
- function Xe(e, r) {
648
- return te(e, `${(r == null ? void 0 : r.type) === "Character" && r.value === 93 ? "Empty" : "Unclosed"} character class`);
649
- }
650
- function Ze(e) {
651
- return te(e, "Unclosed group");
652
- }
653
- function se(e, r, t = null) {
654
- function n(o, a) {
655
- for (let i = 0; i < o.length; i++) {
656
- const u = s(o[i], a, i, o);
657
- i = Math.max(-1, i + u);
658
- }
659
- }
660
- function s(o, a = null, i = null, u = null) {
661
- var E, A;
662
- let c = 0, l = !1;
663
- const p = { node: o, parent: a, key: i, container: u, root: e, remove() {
664
- ce(u).splice(Math.max(0, J(i) + c), 1), c--, l = !0;
665
- }, removeAllNextSiblings() {
666
- return ce(u).splice(J(i) + 1);
667
- }, removeAllPrevSiblings() {
668
- const y = J(i) + c;
669
- return c -= y, ce(u).splice(0, Math.max(0, y));
670
- }, replaceWith(y, k = {}) {
671
- const v = !!k.traverse;
672
- u ? u[Math.max(0, J(i) + c)] = y : te(a, "Can't replace root node")[i] = y, v && s(y, a, i, u), l = !0;
673
- }, replaceWithMultiple(y, k = {}) {
674
- const v = !!k.traverse;
675
- if (ce(u).splice(Math.max(0, J(i) + c), 1, ...y), c += y.length - 1, v) {
676
- let V = 0;
677
- for (let _ = 0; _ < y.length; _++) V += s(y[_], a, J(i) + _ + V, u);
678
- }
679
- l = !0;
680
- }, skip() {
681
- l = !0;
682
- } }, { type: f } = o, g = r["*"], d = r[f], w = typeof g == "function" ? g : g == null ? void 0 : g.enter, m = typeof d == "function" ? d : d == null ? void 0 : d.enter;
683
- if (w == null || w(p, t), m == null || m(p, t), !l) switch (f) {
684
- case "AbsenceFunction":
685
- case "CapturingGroup":
686
- case "Group":
687
- n(o.body, o);
688
- break;
689
- case "Alternative":
690
- case "CharacterClass":
691
- n(o.body, o);
692
- break;
693
- case "Assertion":
694
- case "Backreference":
695
- case "Character":
696
- case "CharacterSet":
697
- case "Directive":
698
- case "Flags":
699
- case "NamedCallout":
700
- case "Subroutine":
701
- break;
702
- case "CharacterClassRange":
703
- s(o.min, o, "min"), s(o.max, o, "max");
704
- break;
705
- case "LookaroundAssertion":
706
- n(o.body, o);
707
- break;
708
- case "Quantifier":
709
- s(o.body, o, "body");
710
- break;
711
- case "Regex":
712
- n(o.body, o), s(o.flags, o, "flags");
713
- break;
714
- default:
715
- throw new Error(`Unexpected node type "${f}"`);
716
- }
717
- return (E = d == null ? void 0 : d.exit) == null || E.call(d, p, t), (A = g == null ? void 0 : g.exit) == null || A.call(g, p, t), c;
718
- }
719
- return s(e), e;
720
- }
721
- function ce(e) {
722
- if (!Array.isArray(e)) throw new Error("Container expected");
723
- return e;
724
- }
725
- function J(e) {
726
- if (typeof e != "number") throw new Error("Numeric key expected");
727
- return e;
728
- }
729
- const It = String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`;
730
- function St(e, r) {
731
- for (let t = 0; t < e.length; t++)
732
- e[t] >= r && e[t]++;
733
- }
734
- function vt(e, r, t, n) {
735
- return e.slice(0, r) + n + e.slice(r + t.length);
736
- }
737
- const S = Object.freeze({
738
- DEFAULT: "DEFAULT",
739
- CHAR_CLASS: "CHAR_CLASS"
740
- });
741
- function Ge(e, r, t, n) {
742
- const s = new RegExp(String.raw`${r}|(?<$skip>\[\^?|\\?.)`, "gsu"), o = [!1];
743
- let a = 0, i = "";
744
- for (const u of e.matchAll(s)) {
745
- const { 0: c, groups: { $skip: l } } = u;
746
- if (!l && (!n || n === S.DEFAULT == !a)) {
747
- t instanceof Function ? i += t(u, {
748
- context: a ? S.CHAR_CLASS : S.DEFAULT,
749
- negated: o[o.length - 1]
750
- }) : i += t;
751
- continue;
752
- }
753
- c[0] === "[" ? (a++, o.push(c[1] === "^")) : c === "]" && a && (a--, o.pop()), i += c;
754
- }
755
- return i;
756
- }
757
- function mr(e, r, t, n) {
758
- Ge(e, r, t, n);
759
- }
760
- function _t(e, r, t = 0, n) {
761
- if (!new RegExp(r, "su").test(e))
762
- return null;
763
- const s = new RegExp(`${r}|(?<$skip>\\\\?.)`, "gsu");
764
- s.lastIndex = t;
765
- let o = 0, a;
766
- for (; a = s.exec(e); ) {
767
- const { 0: i, groups: { $skip: u } } = a;
768
- if (!u && (!n || n === S.DEFAULT == !o))
769
- return a;
770
- i === "[" ? o++ : i === "]" && o && o--, s.lastIndex == a.index && s.lastIndex++;
771
- }
772
- return null;
773
- }
774
- function le(e, r, t) {
775
- return !!_t(e, r, 0, t);
776
- }
777
- function Mt(e, r) {
778
- const t = /\\?./gsu;
779
- t.lastIndex = r;
780
- let n = e.length, s = 0, o = 1, a;
781
- for (; a = t.exec(e); ) {
782
- const [i] = a;
783
- if (i === "[")
784
- s++;
785
- else if (s)
786
- i === "]" && s--;
787
- else if (i === "(")
788
- o++;
789
- else if (i === ")" && (o--, !o)) {
790
- n = a.index;
791
- break;
792
- }
793
- }
794
- return e.slice(r, n);
795
- }
796
- const Qe = new RegExp(String.raw`(?<noncapturingStart>${It})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`, "gsu");
797
- function Nt(e, r) {
798
- const t = (r == null ? void 0 : r.hiddenCaptures) ?? [];
799
- let n = (r == null ? void 0 : r.captureTransfers) ?? /* @__PURE__ */ new Map();
800
- if (!/\(\?>/.test(e))
801
- return {
802
- pattern: e,
803
- captureTransfers: n,
804
- hiddenCaptures: t
805
- };
806
- const s = "(?>", o = "(?:(?=(", a = [0], i = [];
807
- let u = 0, c = 0, l = NaN, p;
808
- do {
809
- p = !1;
810
- let f = 0, g = 0, d = !1, w;
811
- for (Qe.lastIndex = Number.isNaN(l) ? 0 : l + o.length; w = Qe.exec(e); ) {
812
- const { 0: m, index: E, groups: { capturingStart: A, noncapturingStart: y } } = w;
813
- if (m === "[")
814
- f++;
815
- else if (f)
816
- m === "]" && f--;
817
- else if (m === s && !d)
818
- l = E, d = !0;
819
- else if (d && y)
820
- g++;
821
- else if (A)
822
- d ? g++ : (u++, a.push(u + c));
823
- else if (m === ")" && d) {
824
- if (!g) {
825
- c++;
826
- const k = u + c;
827
- if (e = `${e.slice(0, l)}${o}${e.slice(l + s.length, E)}))<$$${k}>)${e.slice(E + 1)}`, p = !0, i.push(k), St(t, k), n.size) {
828
- const v = /* @__PURE__ */ new Map();
829
- n.forEach((V, _) => {
830
- v.set(
831
- _ >= k ? _ + 1 : _,
832
- V.map((q) => q >= k ? q + 1 : q)
833
- );
834
- }), n = v;
835
- }
836
- break;
837
- }
838
- g--;
839
- }
840
- }
841
- } while (p);
842
- return t.push(...i), e = Ge(
843
- e,
844
- String.raw`\\(?<backrefNum>[1-9]\d*)|<\$\$(?<wrappedBackrefNum>\d+)>`,
845
- ({ 0: f, groups: { backrefNum: g, wrappedBackrefNum: d } }) => {
846
- if (g) {
847
- const w = +g;
848
- if (w > a.length - 1)
849
- throw new Error(`Backref "${f}" greater than number of captures`);
850
- return `\\${a[w]}`;
851
- }
852
- return `\\${d}`;
853
- },
854
- S.DEFAULT
855
- ), {
856
- pattern: e,
857
- captureTransfers: n,
858
- hiddenCaptures: t
859
- };
860
- }
861
- const yr = String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`, be = new RegExp(String.raw`
862
- \\(?: \d+
863
- | c[A-Za-z]
864
- | [gk]<[^>]+>
865
- | [pPu]\{[^\}]+\}
866
- | u[A-Fa-f\d]{4}
867
- | x[A-Fa-f\d]{2}
868
- )
869
- | \((?: \? (?: [:=!>]
870
- | <(?:[=!]|[^>]+>)
871
- | [A-Za-z\-]+:
872
- | \(DEFINE\)
873
- ))?
874
- | (?<qBase>${yr})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?)
875
- | \\?.
876
- `.replace(/\s+/g, ""), "gsu");
877
- function Lt(e) {
878
- if (!new RegExp(`${yr}\\+`).test(e))
879
- return {
880
- pattern: e
881
- };
882
- const r = [];
883
- let t = null, n = null, s = "", o = 0, a;
884
- for (be.lastIndex = 0; a = be.exec(e); ) {
885
- const { 0: i, index: u, groups: { qBase: c, qMod: l, invalidQ: p } } = a;
886
- if (i === "[")
887
- o || (n = u), o++;
888
- else if (i === "]")
889
- o ? o-- : n = null;
890
- else if (!o)
891
- if (l === "+" && s && !s.startsWith("(")) {
892
- if (p)
893
- throw new Error(`Invalid quantifier "${i}"`);
894
- let f = -1;
895
- if (/^\{\d+\}$/.test(c))
896
- e = vt(e, u + c.length, l, "");
897
- else {
898
- if (s === ")" || s === "]") {
899
- const g = s === ")" ? t : n;
900
- if (g === null)
901
- throw new Error(`Invalid unmatched "${s}"`);
902
- e = `${e.slice(0, g)}(?>${e.slice(g, u)}${c})${e.slice(u + i.length)}`;
903
- } else
904
- e = `${e.slice(0, u - s.length)}(?>${s}${c})${e.slice(u + i.length)}`;
905
- f += 4;
906
- }
907
- be.lastIndex += f;
908
- } else i[0] === "(" ? r.push(u) : i === ")" && (t = r.length ? r.pop() : null);
909
- s = i;
910
- }
911
- return {
912
- pattern: e
913
- };
914
- }
915
- const I = String.raw, Ft = I`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`, _e = I`\(\?R=(?<rDepth>[^\)]+)\)|${Ft}`, he = I`\(\?<(?![=!])(?<captureName>[^>]+)>`, Cr = I`${he}|(?<unnamed>\()(?!\?)`, W = new RegExp(I`${he}|${_e}|\(\?|\\?.`, "gsu"), xe = "Cannot use multiple overlapping recursions";
916
- function Gt(e, r) {
917
- const { hiddenCaptures: t, mode: n } = {
918
- hiddenCaptures: [],
919
- mode: "plugin",
920
- ...r
921
- };
922
- let s = (r == null ? void 0 : r.captureTransfers) ?? /* @__PURE__ */ new Map();
923
- if (!new RegExp(_e, "su").test(e))
924
- return {
925
- pattern: e,
926
- captureTransfers: s,
927
- hiddenCaptures: t
928
- };
929
- if (n === "plugin" && le(e, I`\(\?\(DEFINE\)`, S.DEFAULT))
930
- throw new Error("DEFINE groups cannot be used with recursion");
931
- const o = [], a = le(e, I`\\[1-9]`, S.DEFAULT), i = /* @__PURE__ */ new Map(), u = [];
932
- let c = !1, l = 0, p = 0, f;
933
- for (W.lastIndex = 0; f = W.exec(e); ) {
934
- const { 0: g, groups: { captureName: d, rDepth: w, gRNameOrNum: m, gRDepth: E } } = f;
935
- if (g === "[")
936
- l++;
937
- else if (l)
938
- g === "]" && l--;
939
- else if (w) {
940
- if (qe(w), c)
941
- throw new Error(xe);
942
- if (a)
943
- throw new Error(
944
- // When used in `external` mode by transpilers other than Regex+, backrefs might have
945
- // gone through conversion from named to numbered, so avoid a misleading error
946
- `${n === "external" ? "Backrefs" : "Numbered backrefs"} cannot be used with global recursion`
947
- );
948
- const A = e.slice(0, f.index), y = e.slice(W.lastIndex);
949
- if (le(y, _e, S.DEFAULT))
950
- throw new Error(xe);
951
- const k = +w - 1;
952
- e = Je(
953
- A,
954
- y,
955
- k,
956
- !1,
957
- t,
958
- o,
959
- p
960
- ), s = Ye(
961
- s,
962
- A,
963
- k,
964
- o.length,
965
- 0,
966
- p
967
- );
968
- break;
969
- } else if (m) {
970
- qe(E);
971
- let A = !1;
972
- for (const ne of u)
973
- if (ne.name === m || ne.num === +m) {
974
- if (A = !0, ne.hasRecursedWithin)
975
- throw new Error(xe);
976
- break;
977
- }
978
- if (!A)
979
- throw new Error(I`Recursive \g cannot be used outside the referenced group "${n === "external" ? m : I`\g<${m}&R=${E}>`}"`);
980
- const y = i.get(m), k = Mt(e, y);
981
- if (a && le(k, I`${he}|\((?!\?)`, S.DEFAULT))
982
- throw new Error(
983
- // When used in `external` mode by transpilers other than Regex+, backrefs might have
984
- // gone through conversion from named to numbered, so avoid a misleading error
985
- `${n === "external" ? "Backrefs" : "Numbered backrefs"} cannot be used with recursion of capturing groups`
986
- );
987
- const v = e.slice(y, f.index), V = k.slice(v.length + g.length), _ = o.length, q = +E - 1, Ue = Je(
988
- v,
989
- V,
990
- q,
991
- !0,
992
- t,
993
- o,
994
- p
995
- );
996
- s = Ye(
997
- s,
998
- v,
999
- q,
1000
- o.length - _,
1001
- _,
1002
- p
1003
- );
1004
- const Mr = e.slice(0, y), Nr = e.slice(y + k.length);
1005
- e = `${Mr}${Ue}${Nr}`, W.lastIndex += Ue.length - g.length - v.length - V.length, u.forEach((ne) => ne.hasRecursedWithin = !0), c = !0;
1006
- } else if (d)
1007
- p++, i.set(String(p), W.lastIndex), i.set(d, W.lastIndex), u.push({
1008
- num: p,
1009
- name: d
1010
- });
1011
- else if (g[0] === "(") {
1012
- const A = g === "(";
1013
- A && (p++, i.set(String(p), W.lastIndex)), u.push(A ? { num: p } : {});
1014
- } else g === ")" && u.pop();
1015
- }
1016
- return t.push(...o), {
1017
- pattern: e,
1018
- captureTransfers: s,
1019
- hiddenCaptures: t
1020
- };
1021
- }
1022
- function qe(e) {
1023
- const r = `Max depth must be integer between 2 and 100; used ${e}`;
1024
- if (!/^[1-9]\d*$/.test(e))
1025
- throw new Error(r);
1026
- if (e = +e, e < 2 || e > 100)
1027
- throw new Error(r);
1028
- }
1029
- function Je(e, r, t, n, s, o, a) {
1030
- const i = /* @__PURE__ */ new Set();
1031
- n && mr(e + r, he, ({ groups: { captureName: c } }) => {
1032
- i.add(c);
1033
- }, S.DEFAULT);
1034
- const u = [
1035
- t,
1036
- n ? i : null,
1037
- s,
1038
- o,
1039
- a
1040
- ];
1041
- return `${e}${Ke(`(?:${e}`, "forward", ...u)}(?:)${Ke(`${r})`, "backward", ...u)}${r}`;
1042
- }
1043
- function Ke(e, r, t, n, s, o, a) {
1044
- const u = (l) => r === "forward" ? l + 2 : t - l + 2 - 1;
1045
- let c = "";
1046
- for (let l = 0; l < t; l++) {
1047
- const p = u(l);
1048
- c += Ge(
1049
- e,
1050
- I`${Cr}|\\k<(?<backref>[^>]+)>`,
1051
- ({ 0: f, groups: { captureName: g, unnamed: d, backref: w } }) => {
1052
- if (w && n && !n.has(w))
1053
- return f;
1054
- const m = `_$${p}`;
1055
- if (d || g) {
1056
- const E = a + o.length + 1;
1057
- return o.push(E), Pt(s, E), d ? f : `(?<${g}${m}>`;
1058
- }
1059
- return I`\k<${w}${m}>`;
1060
- },
1061
- S.DEFAULT
1062
- );
1063
- }
1064
- return c;
1065
- }
1066
- function Pt(e, r) {
1067
- for (let t = 0; t < e.length; t++)
1068
- e[t] >= r && e[t]++;
1069
- }
1070
- function Ye(e, r, t, n, s, o) {
1071
- if (e.size && n) {
1072
- let a = 0;
1073
- mr(r, Cr, () => a++, S.DEFAULT);
1074
- const i = o - a + s, u = /* @__PURE__ */ new Map();
1075
- return e.forEach((c, l) => {
1076
- const p = (n - a * t) / t, f = a * t, g = l > i + a ? l + n : l, d = [];
1077
- for (const w of c)
1078
- if (w <= i)
1079
- d.push(w);
1080
- else if (w > i + a + p)
1081
- d.push(w + n);
1082
- else if (w <= i + a)
1083
- for (let m = 0; m <= t; m++)
1084
- d.push(w + a * m);
1085
- else
1086
- for (let m = 0; m <= t; m++)
1087
- d.push(w + f + p * m);
1088
- u.set(g, d);
1089
- }), u;
1090
- }
1091
- return e;
1092
- }
1093
- var b = String.fromCodePoint, h = String.raw, R = {
1094
- flagGroups: (() => {
1095
- try {
1096
- new RegExp("(?i:)");
1097
- } catch {
1098
- return !1;
1099
- }
1100
- return !0;
1101
- })(),
1102
- unicodeSets: (() => {
1103
- try {
1104
- new RegExp("[[]]", "v");
1105
- } catch {
1106
- return !1;
1107
- }
1108
- return !0;
1109
- })()
1110
- };
1111
- R.bugFlagVLiteralHyphenIsRange = R.unicodeSets ? (() => {
1112
- try {
1113
- new RegExp(h`[\d\-a]`, "v");
1114
- } catch {
1115
- return !0;
1116
- }
1117
- return !1;
1118
- })() : !1;
1119
- R.bugNestedClassIgnoresNegation = R.unicodeSets && new RegExp("[[^a]]", "v").test("a");
1120
- function fe(e, { enable: r, disable: t }) {
1121
- return {
1122
- dotAll: !(t != null && t.dotAll) && !!(r != null && r.dotAll || e.dotAll),
1123
- ignoreCase: !(t != null && t.ignoreCase) && !!(r != null && r.ignoreCase || e.ignoreCase)
1124
- };
1125
- }
1126
- function oe(e, r, t) {
1127
- return e.has(r) || e.set(r, t), e.get(r);
1128
- }
1129
- function Me(e, r) {
1130
- return er[e] >= er[r];
1131
- }
1132
- function Rt(e, r) {
1133
- if (e == null)
1134
- throw new Error(r ?? "Value expected");
1135
- return e;
1136
- }
1137
- var er = {
1138
- ES2025: 2025,
1139
- ES2024: 2024,
1140
- ES2018: 2018
1141
- }, Ut = (
1142
- /** @type {const} */
1143
- {
1144
- auto: "auto",
1145
- ES2025: "ES2025",
1146
- ES2024: "ES2024",
1147
- ES2018: "ES2018"
1148
- }
1149
- );
1150
- function br(e = {}) {
1151
- if ({}.toString.call(e) !== "[object Object]")
1152
- throw new Error("Unexpected options");
1153
- if (e.target !== void 0 && !Ut[e.target])
1154
- throw new Error(`Unexpected target "${e.target}"`);
1155
- const r = {
1156
- // Sets the level of emulation rigor/strictness.
1157
- accuracy: "default",
1158
- // Disables advanced emulation that relies on returning a `RegExp` subclass, resulting in
1159
- // certain patterns not being emulatable.
1160
- avoidSubclass: !1,
1161
- // Oniguruma flags; a string with `i`, `m`, `x`, `D`, `S`, `W`, `y{g}` in any order (all
1162
- // optional). Oniguruma's `m` is equivalent to JavaScript's `s` (`dotAll`).
1163
- flags: "",
1164
- // Include JavaScript flag `g` (`global`) in the result.
1165
- global: !1,
1166
- // Include JavaScript flag `d` (`hasIndices`) in the result.
1167
- hasIndices: !1,
1168
- // Delay regex construction until first use if the transpiled pattern is at least this length.
1169
- lazyCompileLength: 1 / 0,
1170
- // JavaScript version used for generated regexes. Using `auto` detects the best value based on
1171
- // your environment. Later targets allow faster processing, simpler generated source, and
1172
- // support for additional features.
1173
- target: "auto",
1174
- // Disables minifications that simplify the pattern without changing the meaning.
1175
- verbose: !1,
1176
- ...e,
1177
- // Advanced options that override standard behavior, error checking, and flags when enabled.
1178
- rules: {
1179
- // Useful with TextMate grammars that merge backreferences across patterns.
1180
- allowOrphanBackrefs: !1,
1181
- // Use ASCII `\b` and `\B`, which increases search performance of generated regexes.
1182
- asciiWordBoundaries: !1,
1183
- // Allow unnamed captures and numbered calls (backreferences and subroutines) when using
1184
- // named capture. This is Oniguruma option `ONIG_OPTION_CAPTURE_GROUP`; on by default in
1185
- // `vscode-oniguruma`.
1186
- captureGroup: !1,
1187
- // Change the recursion depth limit from Oniguruma's `20` to an integer `2`–`20`.
1188
- recursionLimit: 20,
1189
- // `^` as `\A`; `$` as`\Z`. Improves search performance of generated regexes without changing
1190
- // the meaning if searching line by line. This is Oniguruma option `ONIG_OPTION_SINGLELINE`.
1191
- singleline: !1,
1192
- ...e.rules
1193
- }
1194
- };
1195
- return r.target === "auto" && (r.target = R.flagGroups ? "ES2025" : R.unicodeSets ? "ES2024" : "ES2018"), r;
1196
- }
1197
- var Ot = "[ -\r ]", Dt = /* @__PURE__ */ new Set([
1198
- b(304),
1199
- // İ
1200
- b(305)
1201
- // ı
1202
- ]), L = h`[\p{L}\p{M}\p{N}\p{Pc}]`;
1203
- function xr(e) {
1204
- if (Dt.has(e))
1205
- return [e];
1206
- const r = /* @__PURE__ */ new Set(), t = e.toLowerCase(), n = t.toUpperCase(), s = Vt.get(t), o = Bt.get(t), a = Tt.get(t);
1207
- return [...n].length === 1 && r.add(n), a && r.add(a), s && r.add(s), r.add(t), o && r.add(o), [...r];
1208
- }
1209
- var Pe = /* @__PURE__ */ new Map(
1210
- `C Other
1211
- Cc Control cntrl
1212
- Cf Format
1213
- Cn Unassigned
1214
- Co Private_Use
1215
- Cs Surrogate
1216
- L Letter
1217
- LC Cased_Letter
1218
- Ll Lowercase_Letter
1219
- Lm Modifier_Letter
1220
- Lo Other_Letter
1221
- Lt Titlecase_Letter
1222
- Lu Uppercase_Letter
1223
- M Mark Combining_Mark
1224
- Mc Spacing_Mark
1225
- Me Enclosing_Mark
1226
- Mn Nonspacing_Mark
1227
- N Number
1228
- Nd Decimal_Number digit
1229
- Nl Letter_Number
1230
- No Other_Number
1231
- P Punctuation punct
1232
- Pc Connector_Punctuation
1233
- Pd Dash_Punctuation
1234
- Pe Close_Punctuation
1235
- Pf Final_Punctuation
1236
- Pi Initial_Punctuation
1237
- Po Other_Punctuation
1238
- Ps Open_Punctuation
1239
- S Symbol
1240
- Sc Currency_Symbol
1241
- Sk Modifier_Symbol
1242
- Sm Math_Symbol
1243
- So Other_Symbol
1244
- Z Separator
1245
- Zl Line_Separator
1246
- Zp Paragraph_Separator
1247
- Zs Space_Separator
1248
- ASCII
1249
- ASCII_Hex_Digit AHex
1250
- Alphabetic Alpha
1251
- Any
1252
- Assigned
1253
- Bidi_Control Bidi_C
1254
- Bidi_Mirrored Bidi_M
1255
- Case_Ignorable CI
1256
- Cased
1257
- Changes_When_Casefolded CWCF
1258
- Changes_When_Casemapped CWCM
1259
- Changes_When_Lowercased CWL
1260
- Changes_When_NFKC_Casefolded CWKCF
1261
- Changes_When_Titlecased CWT
1262
- Changes_When_Uppercased CWU
1263
- Dash
1264
- Default_Ignorable_Code_Point DI
1265
- Deprecated Dep
1266
- Diacritic Dia
1267
- Emoji
1268
- Emoji_Component EComp
1269
- Emoji_Modifier EMod
1270
- Emoji_Modifier_Base EBase
1271
- Emoji_Presentation EPres
1272
- Extended_Pictographic ExtPict
1273
- Extender Ext
1274
- Grapheme_Base Gr_Base
1275
- Grapheme_Extend Gr_Ext
1276
- Hex_Digit Hex
1277
- IDS_Binary_Operator IDSB
1278
- IDS_Trinary_Operator IDST
1279
- ID_Continue IDC
1280
- ID_Start IDS
1281
- Ideographic Ideo
1282
- Join_Control Join_C
1283
- Logical_Order_Exception LOE
1284
- Lowercase Lower
1285
- Math
1286
- Noncharacter_Code_Point NChar
1287
- Pattern_Syntax Pat_Syn
1288
- Pattern_White_Space Pat_WS
1289
- Quotation_Mark QMark
1290
- Radical
1291
- Regional_Indicator RI
1292
- Sentence_Terminal STerm
1293
- Soft_Dotted SD
1294
- Terminal_Punctuation Term
1295
- Unified_Ideograph UIdeo
1296
- Uppercase Upper
1297
- Variation_Selector VS
1298
- White_Space space
1299
- XID_Continue XIDC
1300
- XID_Start XIDS`.split(/\s/).map((e) => [ge(e), e])
1301
- ), Bt = /* @__PURE__ */ new Map([
1302
- ["s", b(383)],
1303
- // s, ſ
1304
- [b(383), "s"]
1305
- // ſ, s
1306
- ]), Tt = /* @__PURE__ */ new Map([
1307
- [b(223), b(7838)],
1308
- // ß, ẞ
1309
- [b(107), b(8490)],
1310
- // k, K (Kelvin)
1311
- [b(229), b(8491)],
1312
- // å, Å (Angstrom)
1313
- [b(969), b(8486)]
1314
- // ω, Ω (Ohm)
1315
- ]), Vt = new Map([
1316
- U(453),
1317
- U(456),
1318
- U(459),
1319
- U(498),
1320
- ...ke(8072, 8079),
1321
- ...ke(8088, 8095),
1322
- ...ke(8104, 8111),
1323
- U(8124),
1324
- U(8140),
1325
- U(8188)
1326
- ]), zt = /* @__PURE__ */ new Map([
1327
- ["alnum", h`[\p{Alpha}\p{Nd}]`],
1328
- ["alpha", h`\p{Alpha}`],
1329
- ["ascii", h`\p{ASCII}`],
1330
- ["blank", h`[\p{Zs}\t]`],
1331
- ["cntrl", h`\p{Cc}`],
1332
- ["digit", h`\p{Nd}`],
1333
- ["graph", h`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],
1334
- ["lower", h`\p{Lower}`],
1335
- ["print", h`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],
1336
- ["punct", h`[\p{P}\p{S}]`],
1337
- // Updated value from Onig 6.9.9; changed from Unicode `\p{punct}`
1338
- ["space", h`\p{space}`],
1339
- ["upper", h`\p{Upper}`],
1340
- ["word", h`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],
1341
- ["xdigit", h`\p{AHex}`]
1342
- ]);
1343
- function Wt(e, r) {
1344
- const t = [];
1345
- for (let n = e; n <= r; n++)
1346
- t.push(n);
1347
- return t;
1348
- }
1349
- function U(e) {
1350
- const r = b(e);
1351
- return [r.toLowerCase(), r];
1352
- }
1353
- function ke(e, r) {
1354
- return Wt(e, r).map((t) => U(t));
1355
- }
1356
- var kr = /* @__PURE__ */ new Set([
1357
- "Lower",
1358
- "Lowercase",
1359
- "Upper",
1360
- "Uppercase",
1361
- "Ll",
1362
- "Lowercase_Letter",
1363
- "Lt",
1364
- "Titlecase_Letter",
1365
- "Lu",
1366
- "Uppercase_Letter"
1367
- // The `Changes_When_*` properties (and their aliases) could be included, but they're very rare.
1368
- // Some other properties include a handful of chars with specific cases only, but these chars are
1369
- // generally extreme edge cases and using such properties case insensitively generally produces
1370
- // undesired behavior anyway
1371
- ]);
1372
- function Ht(e, r) {
1373
- const t = {
1374
- // A couple edge cases exist where options `accuracy` and `bestEffortTarget` are used:
1375
- // - `CharacterSet` kind `text_segment` (`\X`): An exact representation would require heavy
1376
- // Unicode data; a best-effort approximation requires knowing the target.
1377
- // - `CharacterSet` kind `posix` with values `graph` and `print`: Their complex Unicode
1378
- // representations would be hard to change to ASCII versions after the fact in the generator
1379
- // based on `target`/`accuracy`, so produce the appropriate structure here.
1380
- accuracy: "default",
1381
- asciiWordBoundaries: !1,
1382
- avoidSubclass: !1,
1383
- bestEffortTarget: "ES2025",
1384
- ...r
1385
- };
1386
- $r(e);
1387
- const n = {
1388
- accuracy: t.accuracy,
1389
- asciiWordBoundaries: t.asciiWordBoundaries,
1390
- avoidSubclass: t.avoidSubclass,
1391
- flagDirectivesByAlt: /* @__PURE__ */ new Map(),
1392
- jsGroupNameMap: /* @__PURE__ */ new Map(),
1393
- minTargetEs2024: Me(t.bestEffortTarget, "ES2024"),
1394
- passedLookbehind: !1,
1395
- strategy: null,
1396
- // Subroutines can appear before the groups they ref, so collect reffed nodes for a second pass
1397
- subroutineRefMap: /* @__PURE__ */ new Map(),
1398
- supportedGNodes: /* @__PURE__ */ new Set(),
1399
- digitIsAscii: e.flags.digitIsAscii,
1400
- spaceIsAscii: e.flags.spaceIsAscii,
1401
- wordIsAscii: e.flags.wordIsAscii
1402
- };
1403
- se(e, jt, n);
1404
- const s = {
1405
- dotAll: e.flags.dotAll,
1406
- ignoreCase: e.flags.ignoreCase
1407
- }, o = {
1408
- currentFlags: s,
1409
- prevFlags: null,
1410
- globalFlags: s,
1411
- groupOriginByCopy: /* @__PURE__ */ new Map(),
1412
- groupsByName: /* @__PURE__ */ new Map(),
1413
- multiplexCapturesToLeftByRef: /* @__PURE__ */ new Map(),
1414
- openRefs: /* @__PURE__ */ new Map(),
1415
- reffedNodesByReferencer: /* @__PURE__ */ new Map(),
1416
- subroutineRefMap: n.subroutineRefMap
1417
- };
1418
- se(e, Xt, o);
1419
- const a = {
1420
- groupsByName: o.groupsByName,
1421
- highestOrphanBackref: 0,
1422
- numCapturesToLeft: 0,
1423
- reffedNodesByReferencer: o.reffedNodesByReferencer
1424
- };
1425
- return se(e, Zt, a), e._originMap = o.groupOriginByCopy, e._strategy = n.strategy, e;
1426
- }
1427
- var jt = {
1428
- AbsenceFunction({ node: e, parent: r, replaceWith: t }) {
1429
- const { body: n, kind: s } = e;
1430
- if (s === "repeater") {
1431
- const o = N();
1432
- o.body[0].body.push(
1433
- // Insert own alts as `body`
1434
- H({ negate: !0, body: n }),
1435
- ee("Any")
1436
- );
1437
- const a = N();
1438
- a.body[0].body.push(
1439
- gr("greedy", 0, 1 / 0, o)
1440
- ), t(C(a, r), { traverse: !0 });
1441
- } else
1442
- throw new Error('Unsupported absence function "(?~|"');
1443
- },
1444
- Alternative: {
1445
- enter({ node: e, parent: r, key: t }, { flagDirectivesByAlt: n }) {
1446
- const s = e.body.filter((o) => o.kind === "flags");
1447
- for (let o = t + 1; o < r.body.length; o++) {
1448
- const a = r.body[o];
1449
- oe(n, a, []).push(...s);
1450
- }
1451
- },
1452
- exit({ node: e }, { flagDirectivesByAlt: r }) {
1453
- var t;
1454
- if ((t = r.get(e)) != null && t.length) {
1455
- const n = Ar(r.get(e));
1456
- if (n) {
1457
- const s = N({ flags: n });
1458
- s.body[0].body = e.body, e.body = [C(s, e)];
1459
- }
1460
- }
1461
- }
1462
- },
1463
- Assertion({ node: e, parent: r, key: t, container: n, root: s, remove: o, replaceWith: a }, i) {
1464
- const { kind: u, negate: c } = e, { asciiWordBoundaries: l, avoidSubclass: p, supportedGNodes: f, wordIsAscii: g } = i;
1465
- if (u === "text_segment_boundary")
1466
- throw new Error(`Unsupported text segment boundary "\\${c ? "Y" : "y"}"`);
1467
- if (u === "line_end")
1468
- a(C(H({ body: [
1469
- Q({ body: [Ie("string_end")] }),
1470
- Q({ body: [de(10)] })
1471
- // `\n`
1472
- ] }), r));
1473
- else if (u === "line_start")
1474
- a(C(F(h`(?<=\A|\n(?!\z))`, { skipLookbehindValidation: !0 }), r));
1475
- else if (u === "search_start")
1476
- if (f.has(e))
1477
- s.flags.sticky = !0, o();
1478
- else {
1479
- const d = n[t - 1];
1480
- if (d && en(d))
1481
- a(C(H({ negate: !0 }), r));
1482
- else {
1483
- if (p)
1484
- throw new Error(h`Uses "\G" in a way that requires a subclass`);
1485
- a(O(Ie("string_start"), r)), i.strategy = "clip_search";
1486
- }
1487
- }
1488
- else if (!(u === "string_end" || u === "string_start")) if (u === "string_end_newline")
1489
- a(C(F(h`(?=\n?\z)`), r));
1490
- else if (u === "word_boundary") {
1491
- if (!g && !l) {
1492
- const d = `(?:(?<=${L})(?!${L})|(?<!${L})(?=${L}))`, w = `(?:(?<=${L})(?=${L})|(?<!${L})(?!${L}))`;
1493
- a(C(F(c ? w : d), r));
1494
- }
1495
- } else
1496
- throw new Error(`Unexpected assertion kind "${u}"`);
1497
- },
1498
- Backreference({ node: e }, { jsGroupNameMap: r }) {
1499
- let { ref: t } = e;
1500
- typeof t == "string" && !Ee(t) && (t = $e(t, r), e.ref = t);
1501
- },
1502
- CapturingGroup({ node: e }, { jsGroupNameMap: r, subroutineRefMap: t }) {
1503
- let { name: n } = e;
1504
- n && !Ee(n) && (n = $e(n, r), e.name = n), t.set(e.number, e), n && t.set(n, e);
1505
- },
1506
- CharacterClassRange({ node: e, parent: r, replaceWith: t }) {
1507
- if (r.kind === "intersection") {
1508
- const n = pe({ body: [e] });
1509
- t(C(n, r), { traverse: !0 });
1510
- }
1511
- },
1512
- CharacterSet({ node: e, parent: r, replaceWith: t }, { accuracy: n, minTargetEs2024: s, digitIsAscii: o, spaceIsAscii: a, wordIsAscii: i }) {
1513
- const { kind: u, negate: c, value: l } = e;
1514
- if (o && (u === "digit" || l === "digit")) {
1515
- t(O(ve("digit", { negate: c }), r));
1516
- return;
1517
- }
1518
- if (a && (u === "space" || l === "space")) {
1519
- t(C(Ae(F(Ot), c), r));
1520
- return;
1521
- }
1522
- if (i && (u === "word" || l === "word")) {
1523
- t(O(ve("word", { negate: c }), r));
1524
- return;
1525
- }
1526
- if (u === "any")
1527
- t(O(ee("Any"), r));
1528
- else if (u === "digit")
1529
- t(O(ee("Nd", { negate: c }), r));
1530
- else if (u !== "dot") if (u === "text_segment") {
1531
- if (n === "strict")
1532
- throw new Error(h`Use of "\X" requires non-strict accuracy`);
1533
- const p = "\\p{Emoji}(?:\\p{EMod}|\\uFE0F\\u20E3?|[\\x{E0020}-\\x{E007E}]+\\x{E007F})?", f = h`\p{RI}{2}|${p}(?:\u200D${p})*`;
1534
- t(C(F(
1535
- // Close approximation of an extended grapheme cluster; see <unicode.org/reports/tr29/>
1536
- h`(?>\r\n|${s ? h`\p{RGI_Emoji}` : f}|\P{M}\p{M}*)`,
1537
- // Allow JS property `RGI_Emoji` through
1538
- { skipPropertyNameValidation: !0 }
1539
- ), r));
1540
- } else if (u === "hex")
1541
- t(O(ee("AHex", { negate: c }), r));
1542
- else if (u === "newline")
1543
- t(C(F(c ? `[^
1544
- ]` : `(?>\r
1545
- ?|[
1546
- \v\f…\u2028\u2029])`), r));
1547
- else if (u === "posix")
1548
- if (!s && (l === "graph" || l === "print")) {
1549
- if (n === "strict")
1550
- throw new Error(`POSIX class "${l}" requires min target ES2024 or non-strict accuracy`);
1551
- let p = {
1552
- graph: "!-~",
1553
- print: " -~"
1554
- }[l];
1555
- c && (p = `\0-${b(p.codePointAt(0) - 1)}${b(p.codePointAt(2) + 1)}-􏿿`), t(C(F(`[${p}]`), r));
1556
- } else
1557
- t(C(Ae(F(zt.get(l)), c), r));
1558
- else if (u === "property")
1559
- Pe.has(ge(l)) || (e.key = "sc");
1560
- else if (u === "space")
1561
- t(O(ee("space", { negate: c }), r));
1562
- else if (u === "word")
1563
- t(C(Ae(F(L), c), r));
1564
- else
1565
- throw new Error(`Unexpected character set kind "${u}"`);
1566
- },
1567
- Directive({ node: e, parent: r, root: t, remove: n, replaceWith: s, removeAllPrevSiblings: o, removeAllNextSiblings: a }) {
1568
- const { kind: i, flags: u } = e;
1569
- if (i === "flags")
1570
- if (!u.enable && !u.disable)
1571
- n();
1572
- else {
1573
- const c = N({ flags: u });
1574
- c.body[0].body = a(), s(C(c, r), { traverse: !0 });
1575
- }
1576
- else if (i === "keep") {
1577
- const c = t.body[0], p = t.body.length === 1 && // Not emulatable if within a `CapturingGroup`
1578
- pr(c, { type: "Group" }) && c.body[0].body.length === 1 ? c.body[0] : t;
1579
- if (r.parent !== p || p.body.length > 1)
1580
- throw new Error(h`Uses "\K" in a way that's unsupported`);
1581
- const f = H({ behind: !0 });
1582
- f.body[0].body = o(), s(C(f, r));
1583
- } else
1584
- throw new Error(`Unexpected directive kind "${i}"`);
1585
- },
1586
- Flags({ node: e, parent: r }) {
1587
- if (e.posixIsAscii)
1588
- throw new Error('Unsupported flag "P"');
1589
- if (e.textSegmentMode === "word")
1590
- throw new Error('Unsupported flag "y{w}"');
1591
- [
1592
- "digitIsAscii",
1593
- // Flag D
1594
- "extended",
1595
- // Flag x
1596
- "posixIsAscii",
1597
- // Flag P
1598
- "spaceIsAscii",
1599
- // Flag S
1600
- "wordIsAscii",
1601
- // Flag W
1602
- "textSegmentMode"
1603
- // Flag y{g} or y{w}
1604
- ].forEach((t) => delete e[t]), Object.assign(e, {
1605
- // JS flag g; no Onig equiv
1606
- global: !1,
1607
- // JS flag d; no Onig equiv
1608
- hasIndices: !1,
1609
- // JS flag m; no Onig equiv but its behavior is always on in Onig. Onig's only line break
1610
- // char is line feed, unlike JS, so this flag isn't used since it would produce inaccurate
1611
- // results (also allows `^` and `$` to be used in the generator for string start and end)
1612
- multiline: !1,
1613
- // JS flag y; no Onig equiv, but used for `\G` emulation
1614
- sticky: e.sticky ?? !1
1615
- // Note: Regex+ doesn't allow explicitly adding flags it handles implicitly, so leave out
1616
- // properties `unicode` (JS flag u) and `unicodeSets` (JS flag v). Keep the existing values
1617
- // for `ignoreCase` (flag i) and `dotAll` (JS flag s, but Onig flag m)
1618
- }), r.options = {
1619
- disable: {
1620
- // Onig uses different rules for flag x than Regex+, so disable the implicit flag
1621
- x: !0,
1622
- // Onig has no flag to control "named capture only" mode but contextually applies its
1623
- // behavior when named capturing is used, so disable Regex+'s implicit flag for it
1624
- n: !0
1625
- },
1626
- force: {
1627
- // Always add flag v because we're generating an AST that relies on it (it enables JS
1628
- // support for Onig features nested classes, intersection, Unicode properties, etc.).
1629
- // However, the generator might disable flag v based on its `target` option
1630
- v: !0
1631
- }
1632
- };
1633
- },
1634
- Group({ node: e }) {
1635
- if (!e.flags)
1636
- return;
1637
- const { enable: r, disable: t } = e.flags;
1638
- r != null && r.extended && delete r.extended, t != null && t.extended && delete t.extended, r != null && r.dotAll && (t != null && t.dotAll) && delete r.dotAll, r != null && r.ignoreCase && (t != null && t.ignoreCase) && delete r.ignoreCase, r && !Object.keys(r).length && delete e.flags.enable, t && !Object.keys(t).length && delete e.flags.disable, !e.flags.enable && !e.flags.disable && delete e.flags;
1639
- },
1640
- LookaroundAssertion({ node: e }, r) {
1641
- const { kind: t } = e;
1642
- t === "lookbehind" && (r.passedLookbehind = !0);
1643
- },
1644
- NamedCallout({ node: e, parent: r, replaceWith: t }) {
1645
- const { kind: n } = e;
1646
- if (n === "fail")
1647
- t(C(H({ negate: !0 }), r));
1648
- else
1649
- throw new Error(`Unsupported named callout "(*${n.toUpperCase()}"`);
1650
- },
1651
- Quantifier({ node: e }) {
1652
- if (e.body.type === "Quantifier") {
1653
- const r = N();
1654
- r.body[0].body.push(e.body), e.body = C(r, e);
1655
- }
1656
- },
1657
- Regex: {
1658
- enter({ node: e }, { supportedGNodes: r }) {
1659
- const t = [];
1660
- let n = !1, s = !1;
1661
- for (const o of e.body)
1662
- if (o.body.length === 1 && o.body[0].kind === "search_start")
1663
- o.body.pop();
1664
- else {
1665
- const a = Sr(o.body);
1666
- a ? (n = !0, Array.isArray(a) ? t.push(...a) : t.push(a)) : s = !0;
1667
- }
1668
- n && !s && t.forEach((o) => r.add(o));
1669
- },
1670
- exit(e, { accuracy: r, passedLookbehind: t, strategy: n }) {
1671
- if (r === "strict" && t && n)
1672
- throw new Error(h`Uses "\G" in a way that requires non-strict accuracy`);
1673
- }
1674
- },
1675
- Subroutine({ node: e }, { jsGroupNameMap: r }) {
1676
- let { ref: t } = e;
1677
- typeof t == "string" && !Ee(t) && (t = $e(t, r), e.ref = t);
1678
- }
1679
- }, Xt = {
1680
- Backreference({ node: e }, { multiplexCapturesToLeftByRef: r, reffedNodesByReferencer: t }) {
1681
- const { orphan: n, ref: s } = e;
1682
- n || t.set(e, [...r.get(s).map(({ node: o }) => o)]);
1683
- },
1684
- CapturingGroup: {
1685
- enter({
1686
- node: e,
1687
- parent: r,
1688
- replaceWith: t,
1689
- skip: n
1690
- }, {
1691
- groupOriginByCopy: s,
1692
- groupsByName: o,
1693
- multiplexCapturesToLeftByRef: a,
1694
- openRefs: i,
1695
- reffedNodesByReferencer: u
1696
- }) {
1697
- const c = s.get(e);
1698
- if (c && i.has(e.number)) {
1699
- const p = O(rr(e.number), r);
1700
- u.set(p, i.get(e.number)), t(p);
1701
- return;
1702
- }
1703
- i.set(e.number, e), a.set(e.number, []), e.name && oe(a, e.name, []);
1704
- const l = a.get(e.name ?? e.number);
1705
- for (let p = 0; p < l.length; p++) {
1706
- const f = l[p];
1707
- if (
1708
- // This group is from subroutine expansion, and there's a multiplex value from either the
1709
- // origin node or a prior subroutine expansion group with the same origin
1710
- c === f.node || c && c === f.origin || // This group is not from subroutine expansion, and it comes after a subroutine expansion
1711
- // group that refers to this group
1712
- e === f.origin
1713
- ) {
1714
- l.splice(p, 1);
1715
- break;
1716
- }
1717
- }
1718
- if (a.get(e.number).push({ node: e, origin: c }), e.name && a.get(e.name).push({ node: e, origin: c }), e.name) {
1719
- const p = oe(o, e.name, /* @__PURE__ */ new Map());
1720
- let f = !1;
1721
- if (c)
1722
- f = !0;
1723
- else
1724
- for (const g of p.values())
1725
- if (!g.hasDuplicateNameToRemove) {
1726
- f = !0;
1727
- break;
1728
- }
1729
- o.get(e.name).set(e, { node: e, hasDuplicateNameToRemove: f });
1730
- }
1731
- },
1732
- exit({ node: e }, { openRefs: r }) {
1733
- r.delete(e.number);
1734
- }
1735
- },
1736
- Group: {
1737
- enter({ node: e }, r) {
1738
- r.prevFlags = r.currentFlags, e.flags && (r.currentFlags = fe(r.currentFlags, e.flags));
1739
- },
1740
- exit(e, r) {
1741
- r.currentFlags = r.prevFlags;
1742
- }
1743
- },
1744
- Subroutine({ node: e, parent: r, replaceWith: t }, n) {
1745
- const { isRecursive: s, ref: o } = e;
1746
- if (s) {
1747
- let l = r;
1748
- for (; (l = l.parent) && !(l.type === "CapturingGroup" && (l.name === o || l.number === o)); )
1749
- ;
1750
- n.reffedNodesByReferencer.set(e, l);
1751
- return;
1752
- }
1753
- const a = n.subroutineRefMap.get(o), i = o === 0, u = i ? rr(0) : (
1754
- // The reffed group might itself contain subroutines, which are expanded during sub-traversal
1755
- Er(a, n.groupOriginByCopy, null)
1756
- );
1757
- let c = u;
1758
- if (!i) {
1759
- const l = Ar(Jt(
1760
- a,
1761
- (f) => f.type === "Group" && !!f.flags
1762
- )), p = l ? fe(n.globalFlags, l) : n.globalFlags;
1763
- Qt(p, n.currentFlags) || (c = N({
1764
- flags: Kt(p)
1765
- }), c.body[0].body.push(u));
1766
- }
1767
- t(C(c, r), { traverse: !i });
1768
- }
1769
- }, Zt = {
1770
- Backreference({ node: e, parent: r, replaceWith: t }, n) {
1771
- if (e.orphan) {
1772
- n.highestOrphanBackref = Math.max(n.highestOrphanBackref, e.ref);
1773
- return;
1774
- }
1775
- const o = n.reffedNodesByReferencer.get(e).filter((a) => qt(a, e));
1776
- if (!o.length)
1777
- t(C(H({ negate: !0 }), r));
1778
- else if (o.length > 1) {
1779
- const a = N({
1780
- atomic: !0,
1781
- body: o.reverse().map((i) => Q({
1782
- body: [Se(i.number)]
1783
- }))
1784
- });
1785
- t(C(a, r));
1786
- } else
1787
- e.ref = o[0].number;
1788
- },
1789
- CapturingGroup({ node: e }, r) {
1790
- e.number = ++r.numCapturesToLeft, e.name && r.groupsByName.get(e.name).get(e).hasDuplicateNameToRemove && delete e.name;
1791
- },
1792
- Regex: {
1793
- exit({ node: e }, r) {
1794
- const t = Math.max(r.highestOrphanBackref - r.numCapturesToLeft, 0);
1795
- for (let n = 0; n < t; n++) {
1796
- const s = dr();
1797
- e.body.at(-1).body.push(s);
1798
- }
1799
- }
1800
- },
1801
- Subroutine({ node: e }, r) {
1802
- !e.isRecursive || e.ref === 0 || (e.ref = r.reffedNodesByReferencer.get(e).number);
1803
- }
1804
- };
1805
- function $r(e) {
1806
- se(e, {
1807
- "*"({ node: r, parent: t }) {
1808
- r.parent = t;
1809
- }
1810
- });
1811
- }
1812
- function Qt(e, r) {
1813
- return e.dotAll === r.dotAll && e.ignoreCase === r.ignoreCase;
1814
- }
1815
- function qt(e, r) {
1816
- let t = r;
1817
- do {
1818
- if (t.type === "Regex")
1819
- return !1;
1820
- if (t.type === "Alternative")
1821
- continue;
1822
- if (t === e)
1823
- return !1;
1824
- const n = Ir(t.parent);
1825
- for (const s of n) {
1826
- if (s === t)
1827
- break;
1828
- if (s === e || vr(s, e))
1829
- return !0;
1830
- }
1831
- } while (t = t.parent);
1832
- throw new Error("Unexpected path");
1833
- }
1834
- function Er(e, r, t, n) {
1835
- const s = Array.isArray(e) ? [] : {};
1836
- for (const [o, a] of Object.entries(e))
1837
- o === "parent" ? s.parent = Array.isArray(t) ? n : t : a && typeof a == "object" ? s[o] = Er(a, r, s, t) : (o === "type" && a === "CapturingGroup" && r.set(s, r.get(e) ?? e), s[o] = a);
1838
- return s;
1839
- }
1840
- function rr(e) {
1841
- const r = hr(e);
1842
- return r.isRecursive = !0, r;
1843
- }
1844
- function Jt(e, r) {
1845
- const t = [];
1846
- for (; e = e.parent; )
1847
- (!r || r(e)) && t.push(e);
1848
- return t;
1849
- }
1850
- function $e(e, r) {
1851
- if (r.has(e))
1852
- return r.get(e);
1853
- const t = `$${r.size}_${e.replace(/^[^$_\p{IDS}]|[^$\u200C\u200D\p{IDC}]/ug, "_")}`;
1854
- return r.set(e, t), t;
1855
- }
1856
- function Ar(e) {
1857
- const r = ["dotAll", "ignoreCase"], t = { enable: {}, disable: {} };
1858
- return e.forEach(({ flags: n }) => {
1859
- r.forEach((s) => {
1860
- var o, a;
1861
- (o = n.enable) != null && o[s] && (delete t.disable[s], t.enable[s] = !0), (a = n.disable) != null && a[s] && (t.disable[s] = !0);
1862
- });
1863
- }), Object.keys(t.enable).length || delete t.enable, Object.keys(t.disable).length || delete t.disable, t.enable || t.disable ? t : null;
1864
- }
1865
- function Kt({ dotAll: e, ignoreCase: r }) {
1866
- const t = {};
1867
- return (e || r) && (t.enable = {}, e && (t.enable.dotAll = !0), r && (t.enable.ignoreCase = !0)), (!e || !r) && (t.disable = {}, !e && (t.disable.dotAll = !0), !r && (t.disable.ignoreCase = !0)), t;
1868
- }
1869
- function Ir(e) {
1870
- if (!e)
1871
- throw new Error("Node expected");
1872
- const { body: r } = e;
1873
- return Array.isArray(r) ? r : r ? [r] : null;
1874
- }
1875
- function Sr(e) {
1876
- const r = e.find((t) => t.kind === "search_start" || rn(t, { negate: !1 }) || !Yt(t));
1877
- if (!r)
1878
- return null;
1879
- if (r.kind === "search_start")
1880
- return r;
1881
- if (r.type === "LookaroundAssertion")
1882
- return r.body[0].body[0];
1883
- if (r.type === "CapturingGroup" || r.type === "Group") {
1884
- const t = [];
1885
- for (const n of r.body) {
1886
- const s = Sr(n.body);
1887
- if (!s)
1888
- return null;
1889
- Array.isArray(s) ? t.push(...s) : t.push(s);
1890
- }
1891
- return t;
1892
- }
1893
- return null;
1894
- }
1895
- function vr(e, r) {
1896
- const t = Ir(e) ?? [];
1897
- for (const n of t)
1898
- if (n === r || vr(n, r))
1899
- return !0;
1900
- return !1;
1901
- }
1902
- function Yt({ type: e }) {
1903
- return e === "Assertion" || e === "Directive" || e === "LookaroundAssertion";
1904
- }
1905
- function en(e) {
1906
- const r = [
1907
- "Character",
1908
- "CharacterClass",
1909
- "CharacterSet"
1910
- ];
1911
- return r.includes(e.type) || e.type === "Quantifier" && e.min && r.includes(e.body.type);
1912
- }
1913
- function rn(e, r) {
1914
- const t = {
1915
- negate: null,
1916
- ...r
1917
- };
1918
- return e.type === "LookaroundAssertion" && (t.negate === null || e.negate === t.negate) && e.body.length === 1 && pr(e.body[0], {
1919
- type: "Assertion",
1920
- kind: "search_start"
1921
- });
1922
- }
1923
- function Ee(e) {
1924
- return /^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e);
1925
- }
1926
- function F(e, r) {
1927
- const n = fr(e, {
1928
- ...r,
1929
- // Providing a custom set of Unicode property names avoids converting some JS Unicode
1930
- // properties (ex: `\p{Alpha}`) to Onig POSIX classes
1931
- unicodePropertyMap: Pe
1932
- }).body;
1933
- return n.length > 1 || n[0].body.length > 1 ? N({ body: n }) : n[0].body[0];
1934
- }
1935
- function Ae(e, r) {
1936
- return e.negate = r, e;
1937
- }
1938
- function O(e, r) {
1939
- return e.parent = r, e;
1940
- }
1941
- function C(e, r) {
1942
- return $r(e), e.parent = r, e;
1943
- }
1944
- function tn(e, r) {
1945
- const t = br(r), n = Me(t.target, "ES2024"), s = Me(t.target, "ES2025"), o = t.rules.recursionLimit;
1946
- if (!Number.isInteger(o) || o < 2 || o > 20)
1947
- throw new Error("Invalid recursionLimit; use 2-20");
1948
- let a = null, i = null;
1949
- if (!s) {
1950
- const g = [e.flags.ignoreCase];
1951
- se(e, nn, {
1952
- getCurrentModI: () => g.at(-1),
1953
- popModI() {
1954
- g.pop();
1955
- },
1956
- pushModI(d) {
1957
- g.push(d);
1958
- },
1959
- setHasCasedChar() {
1960
- g.at(-1) ? a = !0 : i = !0;
1961
- }
1962
- });
1963
- }
1964
- const u = {
1965
- dotAll: e.flags.dotAll,
1966
- // - Turn global flag i on if a case insensitive node was used and no case sensitive nodes were
1967
- // used (to avoid unnecessary node expansion).
1968
- // - Turn global flag i off if a case sensitive node was used (since case sensitivity can't be
1969
- // forced without the use of ES2025 flag groups)
1970
- ignoreCase: !!((e.flags.ignoreCase || a) && !i)
1971
- };
1972
- let c = e;
1973
- const l = {
1974
- accuracy: t.accuracy,
1975
- appliedGlobalFlags: u,
1976
- captureMap: /* @__PURE__ */ new Map(),
1977
- currentFlags: {
1978
- dotAll: e.flags.dotAll,
1979
- ignoreCase: e.flags.ignoreCase
1980
- },
1981
- inCharClass: !1,
1982
- lastNode: c,
1983
- originMap: e._originMap,
1984
- recursionLimit: o,
1985
- useAppliedIgnoreCase: !!(!s && a && i),
1986
- useFlagMods: s,
1987
- useFlagV: n,
1988
- verbose: t.verbose
1989
- };
1990
- function p(g) {
1991
- return l.lastNode = c, c = g, Rt(sn[g.type], `Unexpected node type "${g.type}"`)(g, l, p);
1992
- }
1993
- const f = {
1994
- pattern: e.body.map(p).join("|"),
1995
- // Could reset `lastNode` at this point via `lastNode = ast`, but it isn't needed by flags
1996
- flags: p(e.flags),
1997
- options: { ...e.options }
1998
- };
1999
- return n || (delete f.options.force.v, f.options.disable.v = !0, f.options.unicodeSetsPlugin = null), f._captureTransfers = /* @__PURE__ */ new Map(), f._hiddenCaptures = [], l.captureMap.forEach((g, d) => {
2000
- g.hidden && f._hiddenCaptures.push(d), g.transferTo && oe(f._captureTransfers, g.transferTo, []).push(d);
2001
- }), f;
2002
- }
2003
- var nn = {
2004
- "*": {
2005
- enter({ node: e }, r) {
2006
- if (nr(e)) {
2007
- const t = r.getCurrentModI();
2008
- r.pushModI(
2009
- e.flags ? fe({ ignoreCase: t }, e.flags).ignoreCase : t
2010
- );
2011
- }
2012
- },
2013
- exit({ node: e }, r) {
2014
- nr(e) && r.popModI();
2015
- }
2016
- },
2017
- Backreference(e, r) {
2018
- r.setHasCasedChar();
2019
- },
2020
- Character({ node: e }, r) {
2021
- Re(b(e.value)) && r.setHasCasedChar();
2022
- },
2023
- CharacterClassRange({ node: e, skip: r }, t) {
2024
- r(), _r(e, { firstOnly: !0 }).length && t.setHasCasedChar();
2025
- },
2026
- CharacterSet({ node: e }, r) {
2027
- e.kind === "property" && kr.has(e.value) && r.setHasCasedChar();
2028
- }
2029
- }, sn = {
2030
- /**
2031
- @param {AlternativeNode} node
2032
- */
2033
- Alternative({ body: e }, r, t) {
2034
- return e.map(t).join("");
2035
- },
2036
- /**
2037
- @param {AssertionNode} node
2038
- */
2039
- Assertion({ kind: e, negate: r }) {
2040
- if (e === "string_end")
2041
- return "$";
2042
- if (e === "string_start")
2043
- return "^";
2044
- if (e === "word_boundary")
2045
- return r ? h`\B` : h`\b`;
2046
- throw new Error(`Unexpected assertion kind "${e}"`);
2047
- },
2048
- /**
2049
- @param {BackreferenceNode} node
2050
- */
2051
- Backreference({ ref: e }, r) {
2052
- if (typeof e != "number")
2053
- throw new Error("Unexpected named backref in transformed AST");
2054
- if (!r.useFlagMods && r.accuracy === "strict" && r.currentFlags.ignoreCase && !r.captureMap.get(e).ignoreCase)
2055
- throw new Error("Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy");
2056
- return "\\" + e;
2057
- },
2058
- /**
2059
- @param {CapturingGroupNode} node
2060
- */
2061
- CapturingGroup(e, r, t) {
2062
- const { body: n, name: s, number: o } = e, a = { ignoreCase: r.currentFlags.ignoreCase }, i = r.originMap.get(e);
2063
- return i && (a.hidden = !0, o > i.number && (a.transferTo = i.number)), r.captureMap.set(o, a), `(${s ? `?<${s}>` : ""}${n.map(t).join("|")})`;
2064
- },
2065
- /**
2066
- @param {CharacterNode} node
2067
- */
2068
- Character({ value: e }, r) {
2069
- const t = b(e), n = K(e, {
2070
- escDigit: r.lastNode.type === "Backreference",
2071
- inCharClass: r.inCharClass,
2072
- useFlagV: r.useFlagV
2073
- });
2074
- if (n !== t)
2075
- return n;
2076
- if (r.useAppliedIgnoreCase && r.currentFlags.ignoreCase && Re(t)) {
2077
- const s = xr(t);
2078
- return r.inCharClass ? s.join("") : s.length > 1 ? `[${s.join("")}]` : s[0];
2079
- }
2080
- return t;
2081
- },
2082
- /**
2083
- @param {CharacterClassNode} node
2084
- */
2085
- CharacterClass(e, r, t) {
2086
- const { kind: n, negate: s, parent: o } = e;
2087
- let { body: a } = e;
2088
- if (n === "intersection" && !r.useFlagV)
2089
- throw new Error("Use of character class intersection requires min target ES2024");
2090
- R.bugFlagVLiteralHyphenIsRange && r.useFlagV && a.some(sr) && (a = [de(45), ...a.filter((c) => !sr(c))]);
2091
- const i = () => `[${s ? "^" : ""}${a.map(t).join(n === "intersection" ? "&&" : "")}]`;
2092
- if (!r.inCharClass) {
2093
- if (
2094
- // Already established `kind !== 'intersection'` if `!state.useFlagV`; don't check again
2095
- (!r.useFlagV || R.bugNestedClassIgnoresNegation) && !s
2096
- ) {
2097
- const l = a.filter(
2098
- (p) => p.type === "CharacterClass" && p.kind === "union" && p.negate
2099
- );
2100
- if (l.length) {
2101
- const p = N(), f = p.body[0];
2102
- return p.parent = o, f.parent = p, a = a.filter((g) => !l.includes(g)), e.body = a, a.length ? (e.parent = f, f.body.push(e)) : p.body.pop(), l.forEach((g) => {
2103
- const d = Q({ body: [g] });
2104
- g.parent = d, d.parent = p, p.body.push(d);
2105
- }), t(p);
2106
- }
2107
- }
2108
- r.inCharClass = !0;
2109
- const c = i();
2110
- return r.inCharClass = !1, c;
2111
- }
2112
- const u = a[0];
2113
- if (
2114
- // Already established that the parent is a char class via `inCharClass`; don't check again
2115
- n === "union" && !s && u && // Allows many nested classes to work with `target` ES2018 which doesn't support nesting
2116
- ((!r.useFlagV || !r.verbose) && o.kind === "union" && !(R.bugFlagVLiteralHyphenIsRange && r.useFlagV) || !r.verbose && o.kind === "intersection" && // JS doesn't allow intersection with union or ranges
2117
- a.length === 1 && u.type !== "CharacterClassRange")
2118
- )
2119
- return a.map(t).join("");
2120
- if (!r.useFlagV && o.type === "CharacterClass")
2121
- throw new Error("Uses nested character class in a way that requires min target ES2024");
2122
- return i();
2123
- },
2124
- /**
2125
- @param {CharacterClassRangeNode} node
2126
- */
2127
- CharacterClassRange(e, r) {
2128
- const t = e.min.value, n = e.max.value, s = {
2129
- escDigit: !1,
2130
- inCharClass: !0,
2131
- useFlagV: r.useFlagV
2132
- }, o = K(t, s), a = K(n, s), i = /* @__PURE__ */ new Set();
2133
- if (r.useAppliedIgnoreCase && r.currentFlags.ignoreCase) {
2134
- const u = _r(e);
2135
- ln(u).forEach((l) => {
2136
- i.add(
2137
- Array.isArray(l) ? `${K(l[0], s)}-${K(l[1], s)}` : K(l, s)
2138
- );
2139
- });
2140
- }
2141
- return `${o}-${a}${[...i].join("")}`;
2142
- },
2143
- /**
2144
- @param {CharacterSetNode} node
2145
- */
2146
- CharacterSet({ kind: e, negate: r, value: t, key: n }, s) {
2147
- if (e === "dot")
2148
- return s.currentFlags.dotAll ? s.appliedGlobalFlags.dotAll || s.useFlagMods ? "." : "[^]" : (
2149
- // Onig's only line break char is line feed, unlike JS
2150
- h`[^\n]`
2151
- );
2152
- if (e === "digit")
2153
- return r ? h`\D` : h`\d`;
2154
- if (e === "property") {
2155
- if (s.useAppliedIgnoreCase && s.currentFlags.ignoreCase && kr.has(t))
2156
- throw new Error(`Unicode property "${t}" can't be case-insensitive when other chars have specific case`);
2157
- return `${r ? h`\P` : h`\p`}{${n ? `${n}=` : ""}${t}}`;
2158
- }
2159
- if (e === "word")
2160
- return r ? h`\W` : h`\w`;
2161
- throw new Error(`Unexpected character set kind "${e}"`);
2162
- },
2163
- /**
2164
- @param {FlagsNode} node
2165
- */
2166
- Flags(e, r) {
2167
- return (
2168
- // The transformer should never turn on the properties for flags d, g, m since Onig doesn't
2169
- // have equivs. Flag m is never used since Onig uses different line break chars than JS
2170
- // (node.hasIndices ? 'd' : '') +
2171
- // (node.global ? 'g' : '') +
2172
- // (node.multiline ? 'm' : '') +
2173
- (r.appliedGlobalFlags.ignoreCase ? "i" : "") + (e.dotAll ? "s" : "") + (e.sticky ? "y" : "")
2174
- );
2175
- },
2176
- /**
2177
- @param {GroupNode} node
2178
- */
2179
- Group({ atomic: e, body: r, flags: t, parent: n }, s, o) {
2180
- const a = s.currentFlags;
2181
- t && (s.currentFlags = fe(a, t));
2182
- const i = r.map(o).join("|"), u = !s.verbose && r.length === 1 && // Single alt
2183
- n.type !== "Quantifier" && !e && (!s.useFlagMods || !t) ? i : `(?${pn(e, t, s.useFlagMods)}${i})`;
2184
- return s.currentFlags = a, u;
2185
- },
2186
- /**
2187
- @param {LookaroundAssertionNode} node
2188
- */
2189
- LookaroundAssertion({ body: e, kind: r, negate: t }, n, s) {
2190
- return `(?${`${r === "lookahead" ? "" : "<"}${t ? "!" : "="}`}${e.map(s).join("|")})`;
2191
- },
2192
- /**
2193
- @param {QuantifierNode} node
2194
- */
2195
- Quantifier(e, r, t) {
2196
- return t(e.body) + fn(e);
2197
- },
2198
- /**
2199
- @param {SubroutineNode & {isRecursive: true}} node
2200
- */
2201
- Subroutine({ isRecursive: e, ref: r }, t) {
2202
- if (!e)
2203
- throw new Error("Unexpected non-recursive subroutine in transformed AST");
2204
- const n = t.recursionLimit;
2205
- return r === 0 ? `(?R=${n})` : h`\g<${r}&R=${n}>`;
2206
- }
2207
- }, on = /* @__PURE__ */ new Set([
2208
- "$",
2209
- "(",
2210
- ")",
2211
- "*",
2212
- "+",
2213
- ".",
2214
- "?",
2215
- "[",
2216
- "\\",
2217
- "]",
2218
- "^",
2219
- "{",
2220
- "|",
2221
- "}"
2222
- ]), an = /* @__PURE__ */ new Set([
2223
- "-",
2224
- "\\",
2225
- "]",
2226
- "^",
2227
- // Literal `[` doesn't require escaping with flag u, but this can help work around regex source
2228
- // linters and regex syntax processors that expect unescaped `[` to create a nested class
2229
- "["
2230
- ]), un = /* @__PURE__ */ new Set([
2231
- "(",
2232
- ")",
2233
- "-",
2234
- "/",
2235
- "[",
2236
- "\\",
2237
- "]",
2238
- "^",
2239
- "{",
2240
- "|",
2241
- "}",
2242
- // Double punctuators; also includes already-listed `-` and `^`
2243
- "!",
2244
- "#",
2245
- "$",
2246
- "%",
2247
- "&",
2248
- "*",
2249
- "+",
2250
- ",",
2251
- ".",
2252
- ":",
2253
- ";",
2254
- "<",
2255
- "=",
2256
- ">",
2257
- "?",
2258
- "@",
2259
- "`",
2260
- "~"
2261
- ]), tr = /* @__PURE__ */ new Map([
2262
- [9, h`\t`],
2263
- // horizontal tab
2264
- [10, h`\n`],
2265
- // line feed
2266
- [11, h`\v`],
2267
- // vertical tab
2268
- [12, h`\f`],
2269
- // form feed
2270
- [13, h`\r`],
2271
- // carriage return
2272
- [8232, h`\u2028`],
2273
- // line separator
2274
- [8233, h`\u2029`],
2275
- // paragraph separator
2276
- [65279, h`\uFEFF`]
2277
- // ZWNBSP/BOM
2278
- ]), cn = new RegExp("^\\p{Cased}$", "u");
2279
- function Re(e) {
2280
- return cn.test(e);
2281
- }
2282
- function _r(e, r) {
2283
- const t = !!(r != null && r.firstOnly), n = e.min.value, s = e.max.value, o = [];
2284
- if (n < 65 && (s === 65535 || s >= 131071) || n === 65536 && s >= 131071)
2285
- return o;
2286
- for (let a = n; a <= s; a++) {
2287
- const i = b(a);
2288
- if (!Re(i))
2289
- continue;
2290
- const u = xr(i).filter((c) => {
2291
- const l = c.codePointAt(0);
2292
- return l < n || l > s;
2293
- });
2294
- if (u.length && (o.push(...u), t))
2295
- break;
2296
- }
2297
- return o;
2298
- }
2299
- function K(e, { escDigit: r, inCharClass: t, useFlagV: n }) {
2300
- if (tr.has(e))
2301
- return tr.get(e);
2302
- if (
2303
- // Control chars, etc.; condition modeled on the Chrome developer console's display for strings
2304
- e < 32 || e > 126 && e < 160 || // Unicode planes 4-16; unassigned, special purpose, and private use area
2305
- e > 262143 || // Avoid corrupting a preceding backref by immediately following it with a literal digit
2306
- r && dn(e)
2307
- )
2308
- return e > 255 ? `\\u{${e.toString(16).toUpperCase()}}` : `\\x${e.toString(16).toUpperCase().padStart(2, "0")}`;
2309
- const s = t ? n ? un : an : on, o = b(e);
2310
- return (s.has(o) ? "\\" : "") + o;
2311
- }
2312
- function ln(e) {
2313
- const r = e.map((s) => s.codePointAt(0)).sort((s, o) => s - o), t = [];
2314
- let n = null;
2315
- for (let s = 0; s < r.length; s++)
2316
- r[s + 1] === r[s] + 1 ? n ?? (n = r[s]) : n === null ? t.push(r[s]) : (t.push([n, r[s]]), n = null);
2317
- return t;
2318
- }
2319
- function pn(e, r, t) {
2320
- if (e)
2321
- return ">";
2322
- let n = "";
2323
- if (r && t) {
2324
- const { enable: s, disable: o } = r;
2325
- n = (s != null && s.ignoreCase ? "i" : "") + (s != null && s.dotAll ? "s" : "") + (o ? "-" : "") + (o != null && o.ignoreCase ? "i" : "") + (o != null && o.dotAll ? "s" : "");
2326
- }
2327
- return `${n}:`;
2328
- }
2329
- function fn({ kind: e, max: r, min: t }) {
2330
- let n;
2331
- return !t && r === 1 ? n = "?" : !t && r === 1 / 0 ? n = "*" : t === 1 && r === 1 / 0 ? n = "+" : t === r ? n = `{${t}}` : n = `{${t},${r === 1 / 0 ? "" : r}}`, n + {
2332
- greedy: "",
2333
- lazy: "?",
2334
- possessive: "+"
2335
- }[e];
2336
- }
2337
- function nr({ type: e }) {
2338
- return e === "CapturingGroup" || e === "Group" || e === "LookaroundAssertion";
2339
- }
2340
- function dn(e) {
2341
- return e > 47 && e < 58;
2342
- }
2343
- function sr({ type: e, value: r }) {
2344
- return e === "Character" && r === 45;
2345
- }
2346
- var D, G, X, B, Z, ae, Ne, T, gn = (T = class extends RegExp {
2347
- /**
2348
- @overload
2349
- @param {string} pattern
2350
- @param {string} [flags]
2351
- @param {EmulatedRegExpOptions} [options]
2352
- */
2353
- /**
2354
- @overload
2355
- @param {EmulatedRegExp} pattern
2356
- @param {string} [flags]
2357
- */
2358
- constructor(t, n, s) {
2359
- var r = (...An) => (super(...An), z(this, ae), /**
2360
- @type {Map<number, {
2361
- hidden?: true;
2362
- transferTo?: number;
2363
- }>}
2364
- */
2365
- z(this, D, /* @__PURE__ */ new Map()), /**
2366
- @type {RegExp | EmulatedRegExp | null}
2367
- */
2368
- z(this, G, null), /**
2369
- @type {string}
2370
- */
2371
- z(this, X), /**
2372
- @type {Map<number, string>?}
2373
- */
2374
- z(this, B, null), /**
2375
- @type {string?}
2376
- */
2377
- z(this, Z, null), /**
2378
- Can be used to serialize the instance.
2379
- @type {EmulatedRegExpOptions}
2380
- */
2381
- we(this, "rawOptions", {}), this);
2382
- const o = !!(s != null && s.lazyCompile);
2383
- if (t instanceof RegExp) {
2384
- if (s)
2385
- throw new Error("Cannot provide options when copying a regexp");
2386
- const a = t;
2387
- r(a, n), M(this, X, a.source), a instanceof T && (M(this, D, $(a, D)), M(this, B, $(a, B)), M(this, Z, $(a, Z)), this.rawOptions = a.rawOptions);
2388
- } else {
2389
- const a = {
2390
- hiddenCaptures: [],
2391
- strategy: null,
2392
- transfers: [],
2393
- ...s
2394
- };
2395
- r(o ? "" : t, n), M(this, X, t), M(this, D, wn(a.hiddenCaptures, a.transfers)), M(this, Z, a.strategy), this.rawOptions = s ?? {};
2396
- }
2397
- o || M(this, G, this);
2398
- }
2399
- // Override the getter with one that works with lazy-compiled regexes
2400
- get source() {
2401
- return $(this, X) || "(?:)";
2402
- }
2403
- /**
2404
- Called internally by all String/RegExp methods that use regexes.
2405
- @override
2406
- @param {string} str
2407
- @returns {RegExpExecArray?}
2408
- */
2409
- exec(t) {
2410
- if (!$(this, G)) {
2411
- const { lazyCompile: o, ...a } = this.rawOptions;
2412
- M(this, G, new T($(this, X), this.flags, a));
2413
- }
2414
- const n = this.global || this.sticky, s = this.lastIndex;
2415
- if ($(this, Z) === "clip_search" && n && s) {
2416
- this.lastIndex = 0;
2417
- const o = ye(this, ae, Ne).call(this, t.slice(s));
2418
- return o && (hn(o, s, t, this.hasIndices), this.lastIndex += s), o;
2419
- }
2420
- return ye(this, ae, Ne).call(this, t);
2421
- }
2422
- }, D = new WeakMap(), G = new WeakMap(), X = new WeakMap(), B = new WeakMap(), Z = new WeakMap(), ae = new WeakSet(), /**
2423
- Adds support for hidden and transfer captures.
2424
- @param {string} str
2425
- @returns
2426
- */
2427
- Ne = function(t) {
2428
- $(this, G).lastIndex = this.lastIndex;
2429
- const n = De(T.prototype, this, "exec").call($(this, G), t);
2430
- if (this.lastIndex = $(this, G).lastIndex, !n || !$(this, D).size)
2431
- return n;
2432
- const s = [...n];
2433
- n.length = 1;
2434
- let o;
2435
- this.hasIndices && (o = [...n.indices], n.indices.length = 1);
2436
- const a = [0];
2437
- for (let i = 1; i < s.length; i++) {
2438
- const { hidden: u, transferTo: c } = $(this, D).get(i) ?? {};
2439
- if (u ? a.push(null) : (a.push(n.length), n.push(s[i]), this.hasIndices && n.indices.push(o[i])), c && s[i] !== void 0) {
2440
- const l = a[c];
2441
- if (!l)
2442
- throw new Error(`Invalid capture transfer to "${l}"`);
2443
- if (n[l] = s[i], this.hasIndices && (n.indices[l] = o[i]), n.groups) {
2444
- $(this, B) || M(this, B, mn(this.source));
2445
- const p = $(this, B).get(c);
2446
- p && (n.groups[p] = s[i], this.hasIndices && (n.indices.groups[p] = o[i]));
2447
- }
2448
- }
2449
- }
2450
- return n;
2451
- }, T);
2452
- function hn(e, r, t, n) {
2453
- if (e.index += r, e.input = t, n) {
2454
- const s = e.indices;
2455
- for (let a = 0; a < s.length; a++) {
2456
- const i = s[a];
2457
- i && (s[a] = [i[0] + r, i[1] + r]);
2458
- }
2459
- const o = s.groups;
2460
- o && Object.keys(o).forEach((a) => {
2461
- const i = o[a];
2462
- i && (o[a] = [i[0] + r, i[1] + r]);
2463
- });
2464
- }
2465
- }
2466
- function wn(e, r) {
2467
- const t = /* @__PURE__ */ new Map();
2468
- for (const n of e)
2469
- t.set(n, {
2470
- hidden: !0
2471
- });
2472
- for (const [n, s] of r)
2473
- for (const o of s)
2474
- oe(t, o, {}).transferTo = n;
2475
- return t;
2476
- }
2477
- function mn(e) {
2478
- const r = /(?<capture>\((?:\?<(?![=!])(?<name>[^>]+)>|(?!\?)))|\\?./gsu, t = /* @__PURE__ */ new Map();
2479
- let n = 0, s = 0, o;
2480
- for (; o = r.exec(e); ) {
2481
- const { 0: a, groups: { capture: i, name: u } } = o;
2482
- a === "[" ? n++ : n ? a === "]" && n-- : i && (s++, u && t.set(s, u));
2483
- }
2484
- return t;
2485
- }
2486
- function yn(e, r) {
2487
- const t = Cn(e, r);
2488
- return t.options ? new gn(t.pattern, t.flags, t.options) : new RegExp(t.pattern, t.flags);
2489
- }
2490
- function Cn(e, r) {
2491
- const t = br(r), n = fr(e, {
2492
- flags: t.flags,
2493
- normalizeUnknownPropertyNames: !0,
2494
- rules: {
2495
- captureGroup: t.rules.captureGroup,
2496
- singleline: t.rules.singleline
2497
- },
2498
- skipBackrefValidation: t.rules.allowOrphanBackrefs,
2499
- unicodePropertyMap: Pe
2500
- }), s = Ht(n, {
2501
- accuracy: t.accuracy,
2502
- asciiWordBoundaries: t.rules.asciiWordBoundaries,
2503
- avoidSubclass: t.avoidSubclass,
2504
- bestEffortTarget: t.target
2505
- }), o = tn(s, t), a = Gt(o.pattern, {
2506
- captureTransfers: o._captureTransfers,
2507
- hiddenCaptures: o._hiddenCaptures,
2508
- mode: "external"
2509
- }), i = Lt(a.pattern), u = Nt(i.pattern, {
2510
- captureTransfers: a.captureTransfers,
2511
- hiddenCaptures: a.hiddenCaptures
2512
- }), c = {
2513
- pattern: u.pattern,
2514
- flags: `${t.hasIndices ? "d" : ""}${t.global ? "g" : ""}${o.flags}${o.options.disable.v ? "u" : "v"}`
2515
- };
2516
- if (t.avoidSubclass) {
2517
- if (t.lazyCompileLength !== 1 / 0)
2518
- throw new Error("Lazy compilation requires subclass");
2519
- } else {
2520
- const l = u.hiddenCaptures.sort((d, w) => d - w), p = Array.from(u.captureTransfers), f = s._strategy, g = c.pattern.length >= t.lazyCompileLength;
2521
- (l.length || p.length || f || g) && (c.options = {
2522
- ...l.length && { hiddenCaptures: l },
2523
- ...p.length && { transfers: p },
2524
- ...f && { strategy: f },
2525
- ...g && { lazyCompile: g }
2526
- });
2527
- }
2528
- return c;
2529
- }
2530
- const or = 4294967295;
2531
- class bn {
2532
- constructor(r, t = {}) {
2533
- we(this, "regexps");
2534
- this.patterns = r, this.options = t;
2535
- const {
2536
- forgiving: n = !1,
2537
- cache: s,
2538
- regexConstructor: o
2539
- } = t;
2540
- if (!o)
2541
- throw new Error("Option `regexConstructor` is not provided");
2542
- this.regexps = r.map((a) => {
2543
- if (typeof a != "string")
2544
- return a;
2545
- const i = s == null ? void 0 : s.get(a);
2546
- if (i) {
2547
- if (i instanceof RegExp)
2548
- return i;
2549
- if (n)
2550
- return null;
2551
- throw i;
2552
- }
2553
- try {
2554
- const u = o(a);
2555
- return s == null || s.set(a, u), u;
2556
- } catch (u) {
2557
- if (s == null || s.set(a, u), n)
2558
- return null;
2559
- throw u;
2560
- }
2561
- });
2562
- }
2563
- findNextMatchSync(r, t, n) {
2564
- const s = typeof r == "string" ? r : r.content, o = [];
2565
- function a(i, u, c = 0) {
2566
- return {
2567
- index: i,
2568
- captureIndices: u.indices.map((l) => l == null ? {
2569
- start: or,
2570
- end: or,
2571
- length: 0
2572
- } : {
2573
- start: l[0] + c,
2574
- end: l[1] + c,
2575
- length: l[1] - l[0]
2576
- })
2577
- };
2578
- }
2579
- for (let i = 0; i < this.regexps.length; i++) {
2580
- const u = this.regexps[i];
2581
- if (u)
2582
- try {
2583
- u.lastIndex = t;
2584
- const c = u.exec(s);
2585
- if (!c)
2586
- continue;
2587
- if (c.index === t)
2588
- return a(i, c, 0);
2589
- o.push([i, c, 0]);
2590
- } catch (c) {
2591
- if (this.options.forgiving)
2592
- continue;
2593
- throw c;
2594
- }
2595
- }
2596
- if (o.length) {
2597
- const i = Math.min(...o.map((u) => u[1].index));
2598
- for (const [u, c, l] of o)
2599
- if (c.index === i)
2600
- return a(u, c, l);
2601
- }
2602
- return null;
2603
- }
2604
- }
2605
- function xn(e, r) {
2606
- return yn(
2607
- e,
2608
- {
2609
- global: !0,
2610
- hasIndices: !0,
2611
- // This has no benefit for the standard JS engine, but it avoids a perf penalty for
2612
- // precompiled grammars when constructing extremely long patterns that aren't always used
2613
- lazyCompileLength: 3e3,
2614
- rules: {
2615
- // Needed since TextMate grammars merge backrefs across patterns
2616
- allowOrphanBackrefs: !0,
2617
- // Improves search performance for generated regexes
2618
- asciiWordBoundaries: !0,
2619
- // Follow `vscode-oniguruma` which enables this Oniguruma option by default
2620
- captureGroup: !0,
2621
- // Oniguruma uses depth limit `20`; lowered here to keep regexes shorter and maybe
2622
- // sometimes faster, but can be increased if issues reported due to low limit
2623
- recursionLimit: 5,
2624
- // Oniguruma option for `^`->`\A`, `$`->`\Z`; improves search performance without any
2625
- // change in meaning since TM grammars search line by line
2626
- singleline: !0
2627
- },
2628
- ...r
2629
- }
2630
- );
2631
- }
2632
- function $n(e = {}) {
2633
- const r = Object.assign(
2634
- {
2635
- target: "auto",
2636
- cache: /* @__PURE__ */ new Map()
2637
- },
2638
- e
2639
- );
2640
- return r.regexConstructor || (r.regexConstructor = (t) => xn(t, { target: r.target })), {
2641
- createScanner(t) {
2642
- return new bn(t, r);
2643
- },
2644
- createString(t) {
2645
- return {
2646
- content: t
2647
- };
2648
- }
2649
- };
2650
- }
2651
- export {
2652
- bn as J,
2653
- $n as c,
2654
- xn as d
2655
- };