markstream-react 0.0.54 → 0.0.55

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 (323) hide show
  1. package/dist/{Tooltip-DRyaxB2U.js → Tooltip-Bx_S1cbE.js} +136 -136
  2. package/dist/{codeBlockExtraProps-bURhH5ZJ.js → codeBlockExtraProps-RaPzFq78.js} +1 -1
  3. package/dist/{index-BfHYFUlj.js → index-D0DspXy9.js} +1 -1
  4. package/dist/index.js +1 -1
  5. package/dist/next.js +1 -1
  6. package/dist/server.js +1 -1
  7. package/dist/tailwind.cjs +1 -1
  8. package/dist/tailwind.js +1 -1
  9. package/dist/types/hooks/useSmoothMarkdownStream.d.ts +1 -18
  10. package/package.json +2 -2
  11. package/dist/abap-DnJxzdy9.js +0 -1
  12. package/dist/actionscript-3-DKotD2Vd.js +0 -1
  13. package/dist/ada-iG1FnIvR.js +0 -1
  14. package/dist/andromeeda-C4gqWexZ.js +0 -1
  15. package/dist/angular-html-C5GGT2tR.js +0 -1
  16. package/dist/angular-ts-Qqqp7JE0.js +0 -1
  17. package/dist/apache-CdTKWnKT.js +0 -1
  18. package/dist/apex-BtozVX6V.js +0 -1
  19. package/dist/apl-BkgZWazH.js +0 -1
  20. package/dist/applescript-BlLNmGTp.js +0 -1
  21. package/dist/ara-Ba3fhlsS.js +0 -1
  22. package/dist/asciidoc-AY8u9WWM.js +0 -1
  23. package/dist/asm-CHX6lpGW.js +0 -1
  24. package/dist/astro-BxFA88J7.js +0 -1
  25. package/dist/aurora-x-D-2ljcwZ.js +0 -1
  26. package/dist/awk-XRrwoikR.js +0 -1
  27. package/dist/ayu-dark-DYE7WIF3.js +0 -1
  28. package/dist/ayu-light-BA47KaF1.js +0 -1
  29. package/dist/ayu-mirage-32ctXXKs.js +0 -1
  30. package/dist/ballerina-Dh0JsEtz.js +0 -1
  31. package/dist/bat-BVu0TwaT.js +0 -1
  32. package/dist/beancount-CJl0njO0.js +0 -1
  33. package/dist/berry-Bmu6i3Vs.js +0 -1
  34. package/dist/bibtex-CGjxJ4Zd.js +0 -1
  35. package/dist/bicep-DSW96mAt.js +0 -1
  36. package/dist/bird2-DxzquW1t.js +0 -1
  37. package/dist/blade-B0Yy4jmA.js +0 -1
  38. package/dist/bsl-DGicdwC0.js +0 -1
  39. package/dist/c-BmJt9k-y.js +0 -1
  40. package/dist/c3-BP_4uRj3.js +0 -1
  41. package/dist/cadence-DbDq8SCj.js +0 -1
  42. package/dist/cairo-Dz8fl918.js +0 -1
  43. package/dist/catppuccin-frappe-DFWUc33u.js +0 -1
  44. package/dist/catppuccin-latte-C9dUb6Cb.js +0 -1
  45. package/dist/catppuccin-macchiato-DQyhUUbL.js +0 -1
  46. package/dist/catppuccin-mocha-D87Tk5Gz.js +0 -1
  47. package/dist/clarity-Bb40UnPS.js +0 -1
  48. package/dist/clojure-BjI0Knrv.js +0 -1
  49. package/dist/cmake-BYiqpiH1.js +0 -1
  50. package/dist/cobol-B1Bs9cCy.js +0 -1
  51. package/dist/codeowners-L91meNbn.js +0 -1
  52. package/dist/codeql-Cd-JFsJB.js +0 -1
  53. package/dist/coffee-BDkVV41o.js +0 -1
  54. package/dist/common-lisp-DOi1njVG.js +0 -1
  55. package/dist/coq-BfbrVLCY.js +0 -1
  56. package/dist/cpp-oXxK9OCk.js +0 -1
  57. package/dist/crystal-2eHiXEKD.js +0 -1
  58. package/dist/csharp-DhuT4xSQ.js +0 -1
  59. package/dist/css-C6sBVIXB.js +0 -1
  60. package/dist/csv-DXKU4rRd.js +0 -1
  61. package/dist/cue-zmT78Agv.js +0 -1
  62. package/dist/cypher-bkHSskm3.js +0 -1
  63. package/dist/d-vs9xsbRV.js +0 -1
  64. package/dist/dark-plus-C3mMm8J8.js +0 -1
  65. package/dist/dart-ATbvIoNW.js +0 -1
  66. package/dist/dax-D135z3aS.js +0 -1
  67. package/dist/desktop-CigPEpQ5.js +0 -1
  68. package/dist/diff-Beq1YlA8.js +0 -1
  69. package/dist/docker-V5Al5bpF.js +0 -1
  70. package/dist/dotenv-D9G8sA2m.js +0 -1
  71. package/dist/dracula-BzJJZx-M.js +0 -1
  72. package/dist/dracula-soft-BXkSAIEj.js +0 -1
  73. package/dist/dream-maker-BsoKROiO.js +0 -1
  74. package/dist/edge-BUP_aW-j.js +0 -1
  75. package/dist/elixir-CV6JUqYA.js +0 -1
  76. package/dist/elm-5NnWpb8Q.js +0 -1
  77. package/dist/emacs-lisp-C4732ieo.js +0 -1
  78. package/dist/erb-DzuXK2qx.js +0 -1
  79. package/dist/erlang-DAw79KxH.js +0 -1
  80. package/dist/everforest-dark-BgDCqdQA.js +0 -1
  81. package/dist/everforest-light-C8M2exoo.js +0 -1
  82. package/dist/fennel-qzPJJAAI.js +0 -1
  83. package/dist/fish-Cx6My9pS.js +0 -1
  84. package/dist/fluent-BsukS3Co.js +0 -1
  85. package/dist/fortran-fixed-form-BiRvzwyR.js +0 -1
  86. package/dist/fortran-free-form-CakU9R0a.js +0 -1
  87. package/dist/fsharp-BmLNaTNL.js +0 -1
  88. package/dist/gdresource-pHyHNgx5.js +0 -1
  89. package/dist/gdscript-BpxQpKjR.js +0 -1
  90. package/dist/gdshader-BC7WJXp9.js +0 -1
  91. package/dist/genie-IZOju1hG.js +0 -1
  92. package/dist/gherkin-DUpgZfGr.js +0 -1
  93. package/dist/git-commit-Bptnmh-c.js +0 -1
  94. package/dist/git-rebase-CqNhyBhE.js +0 -1
  95. package/dist/github-dark-DHJKELXO.js +0 -1
  96. package/dist/github-dark-default-Cuk6v7N8.js +0 -1
  97. package/dist/github-dark-dimmed-DH5Ifo-i.js +0 -1
  98. package/dist/github-dark-high-contrast-E3gJ1_iC.js +0 -1
  99. package/dist/github-light-DAi9KRSo.js +0 -1
  100. package/dist/github-light-default-D7oLnXFd.js +0 -1
  101. package/dist/github-light-high-contrast-BfjtVDDH.js +0 -1
  102. package/dist/gleam-CCCEh_av.js +0 -1
  103. package/dist/glimmer-js-C8NS61CI.js +0 -1
  104. package/dist/glimmer-ts-B-RapyDB.js +0 -1
  105. package/dist/glsl-BDbjGBhJ.js +0 -1
  106. package/dist/gn-BNGDdMfm.js +0 -1
  107. package/dist/gnuplot-D0FoiB-W.js +0 -1
  108. package/dist/go-D4Ovm2g9.js +0 -1
  109. package/dist/graphql-DTlHKpVh.js +0 -1
  110. package/dist/groovy-D9sPn4Z-.js +0 -1
  111. package/dist/gruvbox-dark-hard-CFHQjOhq.js +0 -1
  112. package/dist/gruvbox-dark-medium-GsRaNv29.js +0 -1
  113. package/dist/gruvbox-dark-soft-CVdnzihN.js +0 -1
  114. package/dist/gruvbox-light-hard-CH1njM8p.js +0 -1
  115. package/dist/gruvbox-light-medium-DRw_LuNl.js +0 -1
  116. package/dist/gruvbox-light-soft-hJgmCMqR.js +0 -1
  117. package/dist/hack-BxpNoYuc.js +0 -1
  118. package/dist/haml-B9roiRDW.js +0 -1
  119. package/dist/handlebars-Bal7dEre.js +0 -1
  120. package/dist/haskell-Cp0NQEkn.js +0 -1
  121. package/dist/haxe-D-PmAGDa.js +0 -1
  122. package/dist/hcl-DRMo6eis.js +0 -1
  123. package/dist/hjson-BPEpXUFQ.js +0 -1
  124. package/dist/hlsl-B-PjNM4a.js +0 -1
  125. package/dist/horizon-BUw7H-hv.js +0 -1
  126. package/dist/horizon-bright-CUuTKBJd.js +0 -1
  127. package/dist/houston-DnULxvSX.js +0 -1
  128. package/dist/html-B3ILK6fm.js +0 -1
  129. package/dist/html-derivative-CfZez7eO.js +0 -1
  130. package/dist/http-Dh7mhfAc.js +0 -1
  131. package/dist/hurl-DvxDWHzM.js +0 -1
  132. package/dist/hxml-DB3_nACV.js +0 -1
  133. package/dist/hy-CLIvbAhW.js +0 -1
  134. package/dist/imba-B-tO30Ge.js +0 -1
  135. package/dist/index-70BGc65F.js +0 -1
  136. package/dist/index-Bsx2m-LR.js +0 -47
  137. package/dist/ini-Bpxu4Zsc.js +0 -1
  138. package/dist/java-DtRXFtDl.js +0 -1
  139. package/dist/javascript-DFyEbC5y.js +0 -1
  140. package/dist/jinja-CVIIYihW.js +0 -1
  141. package/dist/jison-rKmQmF2-.js +0 -1
  142. package/dist/json-LWN7Ml79.js +0 -1
  143. package/dist/json5-CgCB487x.js +0 -1
  144. package/dist/jsonc-BXrjvC_e.js +0 -1
  145. package/dist/jsonl-D5dm1SHP.js +0 -1
  146. package/dist/jsonnet-B60UklUs.js +0 -1
  147. package/dist/jssm-CsqlGknB.js +0 -1
  148. package/dist/jsx-g2NrEQII.js +0 -1
  149. package/dist/julia-3RKjS8FQ.js +0 -1
  150. package/dist/just-CVCZ9vRQ.js +0 -1
  151. package/dist/kanagawa-dragon-CkXjmgJE.js +0 -1
  152. package/dist/kanagawa-lotus-CfQXZHmo.js +0 -1
  153. package/dist/kanagawa-wave-DWedfzmr.js +0 -1
  154. package/dist/kdl-DWIPcypl.js +0 -1
  155. package/dist/kotlin-DiV2Dt9D.js +0 -1
  156. package/dist/kusto-Bjy7G7j4.js +0 -1
  157. package/dist/laserwave-DUszq2jm.js +0 -1
  158. package/dist/latex-Bs1X87VY.js +0 -1
  159. package/dist/lean-BpZurxeZ.js +0 -1
  160. package/dist/less-DKKxO4Pm.js +0 -1
  161. package/dist/light-plus-B7mTdjB0.js +0 -1
  162. package/dist/liquid-DhgCFC9B.js +0 -1
  163. package/dist/llvm-w4szIS5k.js +0 -1
  164. package/dist/log-CnKjEmrw.js +0 -1
  165. package/dist/logo-BmG1tMr6.js +0 -1
  166. package/dist/lua-DlAioYQl.js +0 -1
  167. package/dist/luau-CDzI2T2B.js +0 -1
  168. package/dist/make-Ccm3NI5i.js +0 -1
  169. package/dist/markdown-DY93LJPj.js +0 -1
  170. package/dist/marko-DcK8dvuy.js +0 -1
  171. package/dist/material-theme-D5KoaKCx.js +0 -1
  172. package/dist/material-theme-darker-BfHTSMKl.js +0 -1
  173. package/dist/material-theme-lighter-B0m2ddpp.js +0 -1
  174. package/dist/material-theme-ocean-CyktbL80.js +0 -1
  175. package/dist/material-theme-palenight-Csfq5Kiy.js +0 -1
  176. package/dist/matlab-nYX3zffi.js +0 -1
  177. package/dist/mdc-DQafIqD6.js +0 -1
  178. package/dist/mdx-C8C9IGe9.js +0 -1
  179. package/dist/mermaid--Jyu4oWd.js +0 -1
  180. package/dist/min-dark-CafNBF8u.js +0 -1
  181. package/dist/min-light-CTRr51gU.js +0 -1
  182. package/dist/mipsasm-BjAqecqh.js +0 -1
  183. package/dist/mojo-C2cxD0aZ.js +0 -1
  184. package/dist/monokai-D4h5O-jR.js +0 -1
  185. package/dist/moonbit-B4gpyPjt.js +0 -1
  186. package/dist/move-Dg7rFHVC.js +0 -1
  187. package/dist/narrat-BTSicUR-.js +0 -1
  188. package/dist/nextflow-CRfcQpDI.js +0 -1
  189. package/dist/nextflow-groovy-DuWVVkaq.js +0 -1
  190. package/dist/nginx-B2z8CTeP.js +0 -1
  191. package/dist/night-owl-C39BiMTA.js +0 -1
  192. package/dist/night-owl-light-CMTm3GFP.js +0 -1
  193. package/dist/nim-DP_Ekwra.js +0 -1
  194. package/dist/nix-_0LqsLde.js +0 -1
  195. package/dist/nord-Ddv68eIx.js +0 -1
  196. package/dist/nushell-Mk45ZIMx.js +0 -1
  197. package/dist/objective-c-DLT9zZoE.js +0 -1
  198. package/dist/objective-cpp-DKXr-AK_.js +0 -1
  199. package/dist/ocaml-DP9q6K5L.js +0 -1
  200. package/dist/odin-BINPiy40.js +0 -1
  201. package/dist/one-dark-pro-DVMEJ2y_.js +0 -1
  202. package/dist/one-light-C3Wv6jpd.js +0 -1
  203. package/dist/openscad-CVq2HK1T.js +0 -1
  204. package/dist/pascal-DjTTLVNS.js +0 -1
  205. package/dist/perl-CmsZP_P9.js +0 -1
  206. package/dist/php-vdga8FKK.js +0 -1
  207. package/dist/pierre-dark-CyvmCCZW.js +0 -1
  208. package/dist/pierre-dark-protanopia-deuteranopia-Rgc0TwpF.js +0 -1
  209. package/dist/pierre-dark-soft-BHGpRqa4.js +0 -1
  210. package/dist/pierre-dark-tritanopia-Beq2gCRQ.js +0 -1
  211. package/dist/pierre-dark-vibrant-BWBVywrn.js +0 -1
  212. package/dist/pierre-light-480U9XYS.js +0 -1
  213. package/dist/pierre-light-protanopia-deuteranopia-CaVOBURG.js +0 -1
  214. package/dist/pierre-light-soft-CVdyfjmI.js +0 -1
  215. package/dist/pierre-light-tritanopia-B4_gpKOM.js +0 -1
  216. package/dist/pierre-light-vibrant-DdTDNdfJ.js +0 -1
  217. package/dist/pkl-0Sl31KKD.js +0 -1
  218. package/dist/plastic-3e1v2bzS.js +0 -1
  219. package/dist/plsql-CJrHCTnj.js +0 -1
  220. package/dist/po-y5MdiEbo.js +0 -1
  221. package/dist/poimandres-CS3Unz2-.js +0 -1
  222. package/dist/polar-Bsx6RkUC.js +0 -1
  223. package/dist/postcss-CeUBPB2S.js +0 -1
  224. package/dist/powerquery-CW27I574.js +0 -1
  225. package/dist/powershell-DSYJ6xcj.js +0 -1
  226. package/dist/prisma-CLoN-gBj.js +0 -1
  227. package/dist/prolog-Bgt5DHUA.js +0 -1
  228. package/dist/proto-C194Edqz.js +0 -1
  229. package/dist/pug-KXbBtQiy.js +0 -1
  230. package/dist/puppet-TSkl_nn0.js +0 -1
  231. package/dist/purescript-BrDje9qL.js +0 -1
  232. package/dist/python-DlV7vnVD.js +0 -1
  233. package/dist/qml-DTv-54bL.js +0 -1
  234. package/dist/qmldir-CSZk7E48.js +0 -1
  235. package/dist/qss-DACx-k9g.js +0 -1
  236. package/dist/r-EOoB7omE.js +0 -1
  237. package/dist/racket-D1nq-KeH.js +0 -1
  238. package/dist/raku-DocPDKZq.js +0 -1
  239. package/dist/razor-B-tk-wsx.js +0 -1
  240. package/dist/red-bN70gL4F.js +0 -1
  241. package/dist/reg-5ydmJHEw.js +0 -1
  242. package/dist/regexp-CpyjTnFF.js +0 -1
  243. package/dist/rel-D68lwU-3.js +0 -1
  244. package/dist/riscv-Cl4WfXj6.js +0 -1
  245. package/dist/ron-DIZViclS.js +0 -1
  246. package/dist/rose-pine-dawn-DHQR4-dF.js +0 -1
  247. package/dist/rose-pine-moon-D4_iv3hh.js +0 -1
  248. package/dist/rose-pine-qdsjHGoJ.js +0 -1
  249. package/dist/rosmsg-sf_0D22S.js +0 -1
  250. package/dist/rst-BG5pn2qR.js +0 -1
  251. package/dist/ruby-DcH2yJAk.js +0 -1
  252. package/dist/rust-DpWcZSqc.js +0 -1
  253. package/dist/sas-B5HzFFRM.js +0 -1
  254. package/dist/sass-DY_rGA2-.js +0 -1
  255. package/dist/scala-CYRsmRER.js +0 -1
  256. package/dist/scheme-C45fPb3F.js +0 -1
  257. package/dist/scss-BV51UrMN.js +0 -1
  258. package/dist/sdbl-BpucmfEo.js +0 -1
  259. package/dist/shaderlab-DNyPh2Q6.js +0 -1
  260. package/dist/shellscript-B8OHlvmy.js +0 -1
  261. package/dist/shellsession-OATBsyRD.js +0 -1
  262. package/dist/slack-dark-BthQWCQV.js +0 -1
  263. package/dist/slack-ochin-DqwNpetd.js +0 -1
  264. package/dist/smalltalk-CKvddXL8.js +0 -1
  265. package/dist/snazzy-light-Bw305WKR.js +0 -1
  266. package/dist/solarized-dark-DXbdFlpD.js +0 -1
  267. package/dist/solarized-light-L9t79GZl.js +0 -1
  268. package/dist/solidity-XfXaqt9k.js +0 -1
  269. package/dist/soy-B8YA9JrK.js +0 -1
  270. package/dist/sparql-CLNNOQQI.js +0 -1
  271. package/dist/splunk-CFtInczE.js +0 -1
  272. package/dist/sql-Q2iGWUi5.js +0 -1
  273. package/dist/ssh-config-Dqsr-I88.js +0 -1
  274. package/dist/stata-BR_XK0X0.js +0 -1
  275. package/dist/stylus-BeJftkpb.js +0 -1
  276. package/dist/surrealql-C_6seBBi.js +0 -1
  277. package/dist/svelte-0br9ZpFT.js +0 -1
  278. package/dist/swift-0qv2hBXI.js +0 -1
  279. package/dist/synthwave-84-ChtBzv_y.js +0 -1
  280. package/dist/system-verilog-B3nElewZ.js +0 -1
  281. package/dist/systemd-B7SlkmfE.js +0 -1
  282. package/dist/talonscript-BrsbXmRy.js +0 -1
  283. package/dist/tasl-CMkPZNj1.js +0 -1
  284. package/dist/tcl-CiyEbZSK.js +0 -1
  285. package/dist/templ-B0JhIwv9.js +0 -1
  286. package/dist/terraform-BUB-_BlF.js +0 -1
  287. package/dist/tex-ByCZWQmN.js +0 -1
  288. package/dist/tokyo-night-hegEt444.js +0 -1
  289. package/dist/toml-VldhK7iW.js +0 -1
  290. package/dist/ts-tags-BWP4nPgY.js +0 -1
  291. package/dist/tsv-BQ9ptESM.js +0 -1
  292. package/dist/tsx-DYwE5ssU.js +0 -1
  293. package/dist/turtle-BVy4HXn4.js +0 -1
  294. package/dist/twig-z8zdyiH9.js +0 -1
  295. package/dist/typescript-DI7mmMRd.js +0 -1
  296. package/dist/typespec-BAzX0Tk7.js +0 -1
  297. package/dist/typst-JIZTSUoJ.js +0 -1
  298. package/dist/v-B66J5FdL.js +0 -1
  299. package/dist/vala-p2PL1w-1.js +0 -1
  300. package/dist/vb-Dv-GCw1m.js +0 -1
  301. package/dist/verilog-DKP7kpC6.js +0 -1
  302. package/dist/vesper-DRje8inN.js +0 -1
  303. package/dist/vhdl-Cog-DhcW.js +0 -1
  304. package/dist/viml-0AN1aqkP.js +0 -1
  305. package/dist/vitesse-black-Bkuqu6BP.js +0 -1
  306. package/dist/vitesse-dark-D0r3Knsf.js +0 -1
  307. package/dist/vitesse-light-CVO1_9PV.js +0 -1
  308. package/dist/vue-DqsE_lDH.js +0 -1
  309. package/dist/vue-html-a8uCr53v.js +0 -1
  310. package/dist/vue-vine-CVmLzYuL.js +0 -1
  311. package/dist/vyper-sB2l1MOO.js +0 -1
  312. package/dist/wasm--yL7jHw-.js +0 -1
  313. package/dist/wasm-CSAWeJiV.js +0 -1
  314. package/dist/wenyan-CLHHXU5e.js +0 -1
  315. package/dist/wgsl-DiTcYanS.js +0 -1
  316. package/dist/wikitext-DT8E9qe0.js +0 -1
  317. package/dist/wit-CtjT-RdY.js +0 -1
  318. package/dist/wolfram-1xJNnwe2.js +0 -1
  319. package/dist/xml-BsgRw6d1.js +0 -1
  320. package/dist/xsl-CNIkWbJg.js +0 -1
  321. package/dist/yaml-c2-Vhxho.js +0 -1
  322. package/dist/zenscript-ChP1MlQf.js +0 -1
  323. package/dist/zig-rivS3YQG.js +0 -1
@@ -1,47 +0,0 @@
1
- var e,t,n,i,r,o,s,a,l,d,c,u,h,f,p,m=Object.defineProperty,g=Object.getPrototypeOf,v=Reflect.get,b=e=>{throw TypeError(e)},y=(e,t,n)=>((e,t,n)=>t in e?m(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n),C=(e,t,n)=>t.has(e)||b("Cannot "+n),S=(e,t,n)=>(C(e,t,"read from private field"),n?n.call(e):t.get(e)),k=(e,t,n)=>t.has(e)?b("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),x=(e,t,n,i)=>(C(e,t,"write to private field"),i?i.call(e,n):t.set(e,n),n),w=(e,t,n)=>(C(e,t,"access private method"),n);const L="diffs-container",T=(()=>{try{return"development"===process.env.NODE_ENV}catch{return!1}})(),A=/(?=^From [a-f0-9]+ .+$)/m,I=/(?=^diff --git)/gm,E=/(?=^---\s+\S)/gm,M=/(?=^@@ )/gm,R=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@(?: (.*))?/m,P=/(?<=\n)/,N=/^(---|\+\+\+)\s+([^\t\r\n]+)/,D=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,H=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,_=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,O=/^<{7,}(?:\s.*)?$/,j=/^\|{7,}(?:\s.*)?$/,F=/^={7,}$/,B=/^>{7,}(?:\s.*)?$/,$="header-prefix",z="header-metadata",U="header-custom",G={dark:"pierre-dark",light:"pierre-light"},W="data-theme-css",V="data-unsafe-css",q="data-core-css",K="data-diffs-scrollbar-measure",X="--diffs-scrollbar-gutter-measured",Q=1,Y=1e5,J={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,spacing:8},Z={...J,hunkLineCount:1},ee={paddingTop:8,paddingBottom:8,gap:8},te={omega:.015,positionEpsilon:.5,velocityEpsilon:.05},ne=Object.freeze({fromStart:0,fromEnd:0}),ie={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},re={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0},oe=/* @__PURE__ */new Set;let se=null;function ae(e){oe.add(e),null!=se||(se=requestAnimationFrame(de))}function le(e){oe.delete(e),0===oe.size&&null!=se&&(cancelAnimationFrame(se),se=null)}function de(e){const t=new Set(oe);oe.clear();for(const i of t)try{i(e)}catch(n){console.error(n)}se=oe.size>0?requestAnimationFrame(de):null}function ce(e,t,n){if(e===t||null==e||null==t)return e===t;const i=new Set(n),r=Object.keys(e),o=new Set(Object.keys(t));for(const s of r)if(o.delete(s),!(i.has(s)||s in t&&e[s]===t[s]))return!1;for(const s of Array.from(o))if(!i.has(s))return!1;return!0}function ue(e,t){return null==e||null==t||"string"==typeof e||"string"==typeof t?e===t:e.dark===t.dark&&e.light===t.light}function he(e,t){var n,i;const r=null!=(n=null==e?void 0:e.theme)?n:G,o=null!=(i=null==t?void 0:t.theme)?i:G,s=fe(e),a=fe(t);return ue(r,o)&&ce(e,t,["theme","parseDiffOptions"])&&ce(s,a)}function fe(e){if(null!=e&&"parseDiffOptions"in e)return e.parseDiffOptions}function pe(e,t){return(null==e?void 0:e.start)===(null==t?void 0:t.start)&&(null==e?void 0:e.end)===(null==t?void 0:t.end)&&(null==e?void 0:e.side)===(null==t?void 0:t.side)&&(null==e?void 0:e.endSide)===(null==t?void 0:t.endSide)}function me({scrollTop:e,scrollHeight:t,height:n,fitPerfectly:i=!1,fitPerfectlyOverscroll:r=0,overscrollSize:o}){const s=n+2*o,a=i?n+2*r:s;if(s>=(t=Math.max(t,a))||i){const n=Math.max(e-r,0),i=Math.min(e+a,t);return{top:n,bottom:Math.max(i,n)}}let l=e+n/2-s/2,d=l+s;return l<0&&(l=0),d>t&&(d=t),l=Math.floor(Math.max(l,0)),{top:l,bottom:Math.ceil(Math.max(Math.min(d,t),l))}}function ge(){return"undefined"!=typeof window&&"function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function ve(e){return{type:"text",value:e}}function be({tagName:e,children:t=[],properties:n={}}){return{type:"element",tagName:e,properties:n,children:t}}function ye({name:e,width:t=16,height:n=16,properties:i}){return be({tagName:"svg",properties:{width:t,height:n,viewBox:"0 0 16 16",...i},children:[be({tagName:"use",properties:{href:`#${e.replace(/^#/,"")}`}})]})}function Ce(e){let t=e.children[0];for(;null!=t;){if("element"===t.type&&"code"===t.tagName)return t;t="children"in t?t.children[0]:null}}function Se(e){return be({tagName:"div",properties:{"data-gutter":""},children:e})}function ke(e,t,n,i={}){return be({tagName:"div",properties:{"data-line-type":e,"data-column-number":t,"data-line-index":n,...i},children:null!=t?[be({tagName:"span",properties:{"data-line-number-content":""},children:[ve(`${t}`)]})]:void 0})}function xe(e,t,n){return be({tagName:"div",properties:{"data-gutter-buffer":t,"data-buffer-size":n,"data-line-type":"annotation"===t?void 0:e,style:"annotation"===t?`grid-row: span ${n};`:`grid-row: span ${n};min-height:calc(${n} * 1lh);`}})}function we(){return be({tagName:"button",properties:{"data-utility-button":"",type:"button"},children:[ye({name:"diffs-icon-plus",properties:{"data-icon":""}})]})}const Le=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];class Te{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}}function Ae(e,t){const n={},i={};for(const r of e)Object.assign(n,r.property),Object.assign(i,r.normal);return new Te(n,i,t)}function Ie(e){return e.toLowerCase()}Te.prototype.normal={},Te.prototype.property={},Te.prototype.space=void 0;class Ee{constructor(e,t){this.attribute=t,this.property=e}}Ee.prototype.attribute="",Ee.prototype.booleanish=!1,Ee.prototype.boolean=!1,Ee.prototype.commaOrSpaceSeparated=!1,Ee.prototype.commaSeparated=!1,Ee.prototype.defined=!1,Ee.prototype.mustUseProperty=!1,Ee.prototype.number=!1,Ee.prototype.overloadedBoolean=!1,Ee.prototype.property="",Ee.prototype.spaceSeparated=!1,Ee.prototype.space=void 0;let Me=0;const Re=je(),Pe=je(),Ne=je(),De=je(),He=je(),_e=je(),Oe=je();function je(){return 2**++Me}const Fe=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,boolean:Re,booleanish:Pe,commaOrSpaceSeparated:Oe,commaSeparated:_e,number:De,overloadedBoolean:Ne,spaceSeparated:He},Symbol.toStringTag,{value:"Module"})),Be=Object.keys(Fe);class $e extends Ee{constructor(e,t,n,i){let r=-1;if(super(e,t),ze(this,"space",i),"number"==typeof n)for(;++r<Be.length;){const e=Be[r];ze(this,Be[r],(n&Fe[e])===Fe[e])}}}function ze(e,t,n){n&&(e[t]=n)}function Ue(e){const t={},n={};for(const[i,r]of Object.entries(e.properties)){const o=new $e(i,e.transform(e.attributes||{},i),r,e.space);e.mustUseProperty&&e.mustUseProperty.includes(i)&&(o.mustUseProperty=!0),t[i]=o,n[Ie(i)]=i,n[Ie(o.attribute)]=i}return new Te(t,n,e.space)}$e.prototype.defined=!0;const Ge=Ue({properties:{ariaActiveDescendant:null,ariaAtomic:Pe,ariaAutoComplete:null,ariaBusy:Pe,ariaChecked:Pe,ariaColCount:De,ariaColIndex:De,ariaColSpan:De,ariaControls:He,ariaCurrent:null,ariaDescribedBy:He,ariaDetails:null,ariaDisabled:Pe,ariaDropEffect:He,ariaErrorMessage:null,ariaExpanded:Pe,ariaFlowTo:He,ariaGrabbed:Pe,ariaHasPopup:null,ariaHidden:Pe,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:He,ariaLevel:De,ariaLive:null,ariaModal:Pe,ariaMultiLine:Pe,ariaMultiSelectable:Pe,ariaOrientation:null,ariaOwns:He,ariaPlaceholder:null,ariaPosInSet:De,ariaPressed:Pe,ariaReadOnly:Pe,ariaRelevant:null,ariaRequired:Pe,ariaRoleDescription:He,ariaRowCount:De,ariaRowIndex:De,ariaRowSpan:De,ariaSelected:Pe,ariaSetSize:De,ariaSort:null,ariaValueMax:De,ariaValueMin:De,ariaValueNow:De,ariaValueText:null,role:null},transform:(e,t)=>"role"===t?t:"aria-"+t.slice(4).toLowerCase()});function We(e,t){return t in e?e[t]:t}function Ve(e,t){return We(e,t.toLowerCase())}const qe=Ue({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:_e,acceptCharset:He,accessKey:He,action:null,allow:null,allowFullScreen:Re,allowPaymentRequest:Re,allowUserMedia:Re,alt:null,as:null,async:Re,autoCapitalize:null,autoComplete:He,autoFocus:Re,autoPlay:Re,blocking:He,capture:null,charSet:null,checked:Re,cite:null,className:He,cols:De,colSpan:null,content:null,contentEditable:Pe,controls:Re,controlsList:He,coords:De|_e,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Re,defer:Re,dir:null,dirName:null,disabled:Re,download:Ne,draggable:Pe,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Re,formTarget:null,headers:He,height:De,hidden:Ne,high:De,href:null,hrefLang:null,htmlFor:He,httpEquiv:He,id:null,imageSizes:null,imageSrcSet:null,inert:Re,inputMode:null,integrity:null,is:null,isMap:Re,itemId:null,itemProp:He,itemRef:He,itemScope:Re,itemType:He,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Re,low:De,manifest:null,max:null,maxLength:De,media:null,method:null,min:null,minLength:De,multiple:Re,muted:Re,name:null,nonce:null,noModule:Re,noValidate:Re,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Re,optimum:De,pattern:null,ping:He,placeholder:null,playsInline:Re,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Re,referrerPolicy:null,rel:He,required:Re,reversed:Re,rows:De,rowSpan:De,sandbox:He,scope:null,scoped:Re,seamless:Re,selected:Re,shadowRootClonable:Re,shadowRootDelegatesFocus:Re,shadowRootMode:null,shape:null,size:De,sizes:null,slot:null,span:De,spellCheck:Pe,src:null,srcDoc:null,srcLang:null,srcSet:null,start:De,step:null,style:null,tabIndex:De,target:null,title:null,translate:null,type:null,typeMustMatch:Re,useMap:null,value:Pe,width:De,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:He,axis:null,background:null,bgColor:null,border:De,borderColor:null,bottomMargin:De,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Re,declare:Re,event:null,face:null,frame:null,frameBorder:null,hSpace:De,leftMargin:De,link:null,longDesc:null,lowSrc:null,marginHeight:De,marginWidth:De,noResize:Re,noHref:Re,noShade:Re,noWrap:Re,object:null,profile:null,prompt:null,rev:null,rightMargin:De,rules:null,scheme:null,scrolling:Pe,standby:null,summary:null,text:null,topMargin:De,valueType:null,version:null,vAlign:null,vLink:null,vSpace:De,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Re,disableRemotePlayback:Re,prefix:null,property:null,results:De,security:null,unselectable:null},space:"html",transform:Ve}),Ke=Ue({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Oe,accentHeight:De,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:De,amplitude:De,arabicForm:null,ascent:De,attributeName:null,attributeType:null,azimuth:De,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:De,by:null,calcMode:null,capHeight:De,className:He,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:De,diffuseConstant:De,direction:null,display:null,dur:null,divisor:De,dominantBaseline:null,download:Re,dx:null,dy:null,edgeMode:null,editable:null,elevation:De,enableBackground:null,end:null,event:null,exponent:De,externalResourcesRequired:null,fill:null,fillOpacity:De,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:_e,g2:_e,glyphName:_e,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:De,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:De,horizOriginX:De,horizOriginY:De,id:null,ideographic:De,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:De,k:De,k1:De,k2:De,k3:De,k4:De,kernelMatrix:Oe,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:De,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:De,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:De,overlineThickness:De,paintOrder:null,panose1:null,path:null,pathLength:De,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:He,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:De,pointsAtY:De,pointsAtZ:De,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Oe,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Oe,rev:Oe,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Oe,requiredFeatures:Oe,requiredFonts:Oe,requiredFormats:Oe,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:De,specularExponent:De,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:De,strikethroughThickness:De,string:null,stroke:null,strokeDashArray:Oe,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:De,strokeOpacity:De,strokeWidth:null,style:null,surfaceScale:De,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Oe,tabIndex:De,tableValues:null,target:null,targetX:De,targetY:De,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Oe,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:De,underlineThickness:De,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:De,values:null,vAlphabetic:De,vMathematical:De,vectorEffect:null,vHanging:De,vIdeographic:De,version:null,vertAdvY:De,vertOriginX:De,vertOriginY:De,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:De,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:We}),Xe=Ue({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform:(e,t)=>"xlink:"+t.slice(5).toLowerCase()}),Qe=Ue({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Ve}),Ye=Ue({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(e,t)=>"xml:"+t.slice(3).toLowerCase()}),Je=/[A-Z]/g,Ze=/-[a-z]/g,et=/^data[-\w.:]+$/i;function tt(e){return"-"+e.toLowerCase()}function nt(e){return e.charAt(1).toUpperCase()}const it=Ae([Ge,qe,Xe,Qe,Ye],"html"),rt=Ae([Ge,Ke,Xe,Qe,Ye],"svg"),ot={}.hasOwnProperty,st=/["&'<>`]/g,at=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,lt=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,dt=/[|\\{}()[\]^$+*?.]/g,ct=/* @__PURE__ */new WeakMap;const ut=/[\dA-Fa-f]/,ht=/\d/,ft=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],pt={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",bull:"•",hellip:"…",prime:"′",Prime:"″",oline:"‾",frasl:"⁄",weierp:"℘",image:"ℑ",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"},mt=["cent","copy","divide","gt","lt","not","para","times"],gt={}.hasOwnProperty,vt={};let bt;for(bt in pt)gt.call(pt,bt)&&(vt[pt[bt]]=bt);const yt=/[^\dA-Za-z]/;function Ct(e,t,n){let i,r=function(e,t,n){const i="&#x"+e.toString(16).toUpperCase();return n&&t&&!ut.test(String.fromCharCode(t))?i:i+";"}(e,t,n.omitOptionalSemicolons);if((n.useNamedReferences||n.useShortestReferences)&&(i=function(e,t,n,i){const r=String.fromCharCode(e);if(gt.call(vt,r)){const e=vt[r],o="&"+e;return n&&ft.includes(e)&&!mt.includes(e)&&(!i||t&&61!==t&&yt.test(String.fromCharCode(t)))?o:o+";"}return""}(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!i)&&n.useShortestReferences){const i=function(e,t,n){const i="&#"+String(e);return n&&t&&!ht.test(String.fromCharCode(t))?i:i+";"}(e,t,n.omitOptionalSemicolons);i.length<r.length&&(r=i)}return i&&(!n.useShortestReferences||i.length<r.length)?i:r}function St(e,t){return function(e,t){return e=e.replace(t.subset?function(e){let t=ct.get(e);return t||(t=function(e){const t=[];let n=-1;for(;++n<e.length;)t.push(e[n].replace(dt,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}(e),ct.set(e,t)),t}(t.subset):st,n),t.subset||t.escapeOnly?e:e.replace(at,function(e,n,i){return t.format(1024*(e.charCodeAt(0)-55296)+e.charCodeAt(1)-56320+65536,i.charCodeAt(n+2),t)}).replace(lt,n);function n(e,n,i){return t.format(e.charCodeAt(0),i.charCodeAt(n+1),t)}}(e,Object.assign({format:Ct},t))}const kt=/^>|^->|<!--|-->|--!>|<!-$/g,xt=[">"],wt=["<",">"];function Lt(e,t){const n=String(e);if("string"!=typeof t)throw new TypeError("Expected character");let i=0,r=n.indexOf(t);for(;-1!==r;)i++,r=n.indexOf(t,r+t.length);return i}function Tt(e,t){const n=t||{};return(""===e[e.length-1]?[...e,""]:e).join((n.padRight?" ":"")+","+(!1===n.padLeft?"":" ")).trim()}function At(e){return e.join(" ").trim()}const It=/[ \t\n\f\r]/g;function Et(e){return"object"==typeof e?"text"===e.type&&Mt(e.value):Mt(e)}function Mt(e){return""===e.replace(It,"")}const Rt=Dt(1),Pt=Dt(-1),Nt=[];function Dt(e){return function(t,n,i){const r=t?t.children:Nt;let o=(n||0)+e,s=r[o];if(!i)for(;s&&Et(s);)o+=e,s=r[o];return s}}const Ht={}.hasOwnProperty;function _t(e){return function(t,n,i){return Ht.call(e,t.tagName)&&e[t.tagName](t,n,i)}}const Ot=_t({body:function(e,t,n){const i=Rt(n,t);return!i||"comment"!==i.type},caption:jt,colgroup:jt,dd:function(e,t,n){const i=Rt(n,t);return!i||"element"===i.type&&("dt"===i.tagName||"dd"===i.tagName)},dt:function(e,t,n){const i=Rt(n,t);return Boolean(i&&"element"===i.type&&("dt"===i.tagName||"dd"===i.tagName))},head:jt,html:function(e,t,n){const i=Rt(n,t);return!i||"comment"!==i.type},li:function(e,t,n){const i=Rt(n,t);return!i||"element"===i.type&&"li"===i.tagName},optgroup:function(e,t,n){const i=Rt(n,t);return!i||"element"===i.type&&"optgroup"===i.tagName},option:function(e,t,n){const i=Rt(n,t);return!i||"element"===i.type&&("option"===i.tagName||"optgroup"===i.tagName)},p:function(e,t,n){const i=Rt(n,t);return i?"element"===i.type&&("address"===i.tagName||"article"===i.tagName||"aside"===i.tagName||"blockquote"===i.tagName||"details"===i.tagName||"div"===i.tagName||"dl"===i.tagName||"fieldset"===i.tagName||"figcaption"===i.tagName||"figure"===i.tagName||"footer"===i.tagName||"form"===i.tagName||"h1"===i.tagName||"h2"===i.tagName||"h3"===i.tagName||"h4"===i.tagName||"h5"===i.tagName||"h6"===i.tagName||"header"===i.tagName||"hgroup"===i.tagName||"hr"===i.tagName||"main"===i.tagName||"menu"===i.tagName||"nav"===i.tagName||"ol"===i.tagName||"p"===i.tagName||"pre"===i.tagName||"section"===i.tagName||"table"===i.tagName||"ul"===i.tagName):!n||!("element"===n.type&&("a"===n.tagName||"audio"===n.tagName||"del"===n.tagName||"ins"===n.tagName||"map"===n.tagName||"noscript"===n.tagName||"video"===n.tagName))},rp:Ft,rt:Ft,tbody:function(e,t,n){const i=Rt(n,t);return!i||"element"===i.type&&("tbody"===i.tagName||"tfoot"===i.tagName)},td:Bt,tfoot:function(e,t,n){return!Rt(n,t)},th:Bt,thead:function(e,t,n){const i=Rt(n,t);return Boolean(i&&"element"===i.type&&("tbody"===i.tagName||"tfoot"===i.tagName))},tr:function(e,t,n){const i=Rt(n,t);return!i||"element"===i.type&&"tr"===i.tagName}});function jt(e,t,n){const i=Rt(n,t,!0);return!i||"comment"!==i.type&&!("text"===i.type&&Et(i.value.charAt(0)))}function Ft(e,t,n){const i=Rt(n,t);return!i||"element"===i.type&&("rp"===i.tagName||"rt"===i.tagName)}function Bt(e,t,n){const i=Rt(n,t);return!i||"element"===i.type&&("td"===i.tagName||"th"===i.tagName)}const $t=_t({body:function(e){const t=Rt(e,-1,!0);return!(t&&("comment"===t.type||"text"===t.type&&Et(t.value.charAt(0))||"element"===t.type&&("meta"===t.tagName||"link"===t.tagName||"script"===t.tagName||"style"===t.tagName||"template"===t.tagName)))},colgroup:function(e,t,n){const i=Pt(n,t),r=Rt(e,-1,!0);return!(n&&i&&"element"===i.type&&"colgroup"===i.tagName&&Ot(i,n.children.indexOf(i),n))&&Boolean(r&&"element"===r.type&&"col"===r.tagName)},head:function(e){const t=/* @__PURE__ */new Set;for(const i of e.children)if("element"===i.type&&("base"===i.tagName||"title"===i.tagName)){if(t.has(i.tagName))return!1;t.add(i.tagName)}const n=e.children[0];return!n||"element"===n.type},html:function(e){const t=Rt(e,-1);return!t||"comment"!==t.type},tbody:function(e,t,n){const i=Pt(n,t),r=Rt(e,-1);return(!n||!i||"element"!==i.type||"thead"!==i.tagName&&"tbody"!==i.tagName||!Ot(i,n.children.indexOf(i),n))&&Boolean(r&&"element"===r.type&&"tr"===r.tagName)}}),zt={name:[["\t\n\f\r &/=>".split(""),"\t\n\f\r \"&'/=>`".split("")],["\0\t\n\f\r \"&'/<=>".split(""),"\0\t\n\f\r \"&'/<=>`".split("")]],unquoted:[["\t\n\f\r &>".split(""),"\0\t\n\f\r \"&'<=>`".split("")],["\0\t\n\f\r \"&'<=>`".split(""),"\0\t\n\f\r \"&'<=>`".split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function Ut(e,t,n){const i=function(e,t){const n=Ie(t);let i=t,r=Ee;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&"data"===n.slice(0,4)&&et.test(t)){if("-"===t.charAt(4)){const e=t.slice(5).replace(Ze,nt);i="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{const e=t.slice(4);if(!Ze.test(e)){let n=e.replace(Je,tt);"-"!==n.charAt(0)&&(n="-"+n),t="data"+n}}r=$e}return new r(i,t)}(e.schema,t),r=e.settings.allowParseErrors&&"html"===e.schema.space?0:1,o=e.settings.allowDangerousCharacters?0:1;let s,a=e.quote;if(!i.overloadedBoolean||n!==i.attribute&&""!==n?!i.boolean&&!i.overloadedBoolean||"string"==typeof n&&n!==i.attribute&&""!==n||(n=Boolean(n)):n=!0,null==n||!1===n||"number"==typeof n&&Number.isNaN(n))return"";const l=St(i.attribute,Object.assign({},e.settings.characterReferences,{subset:zt.name[r][o]}));return!0===n?l:(n=Array.isArray(n)?(i.commaSeparated?Tt:At)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n?l:(e.settings.preferUnquoted&&(s=St(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:zt.unquoted[r][o]}))),s!==n&&(e.settings.quoteSmart&&Lt(n,a)>Lt(n,e.alternative)&&(a=e.alternative),s=a+St(n,Object.assign({},e.settings.characterReferences,{subset:("'"===a?zt.single:zt.double)[r][o],attribute:!0}))+a),l+(s?"="+s:s)))}const Gt=["<","&"];function Wt(e,t,n,i){return!n||"element"!==n.type||"script"!==n.tagName&&"style"!==n.tagName?St(e.value,Object.assign({},i.settings.characterReferences,{subset:Gt})):e.value}const Vt=function(e,t){const n=t||{};function i(t,...n){let r=i.invalid;const o=i.handlers;if(t&&ot.call(t,e)){const n=String(t[e]);r=ot.call(o,n)?o[n]:i.unknown}if(r)return r.call(this,t,...n)}return i.handlers=n.handlers||{},i.invalid=n.invalid,i.unknown=n.unknown,i}("type",{invalid:function(e){throw new Error("Expected node, not `"+e+"`")},unknown:function(e){throw new Error("Cannot compile unknown node `"+e.type+"`")},handlers:{comment:function(e,t,n,i){return i.settings.bogusComments?"<?"+St(e.value,Object.assign({},i.settings.characterReferences,{subset:xt}))+">":"\x3c!--"+e.value.replace(kt,function(e){return St(e,Object.assign({},i.settings.characterReferences,{subset:wt}))})+"--\x3e"},doctype:function(e,t,n,i){return"<!"+(i.settings.upperDoctype?"DOCTYPE":"doctype")+(i.settings.tightDoctype?"":" ")+"html>"},element:function(e,t,n,i){const r=i.schema,o="svg"!==r.space&&i.settings.omitOptionalTags;let s="svg"===r.space?i.settings.closeEmptyElements:i.settings.voids.includes(e.tagName.toLowerCase());const a=[];let l;"html"===r.space&&"svg"===e.tagName&&(i.schema=rt);const d=function(e,t){const n=[];let i,r=-1;if(t)for(i in t)if(null!==t[i]&&void 0!==t[i]){const r=Ut(e,i,t[i]);r&&n.push(r)}for(;++r<n.length;){const t=e.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&'"'!==t&&"'"!==t&&(n[r]+=" ")}return n.join("")}(i,e.properties),c=i.all("html"===r.space&&"template"===e.tagName?e.content:e);return i.schema=r,c&&(s=!1),!d&&o&&$t(e,t,n)||(a.push("<",e.tagName,d?" "+d:""),s&&("svg"===r.space||i.settings.closeSelfClosing)&&(l=d.charAt(d.length-1),(!i.settings.tightSelfClosing||"/"===l||l&&'"'!==l&&"'"!==l)&&a.push(" "),a.push("/")),a.push(">")),a.push(c),s||o&&Ot(e,t,n)||a.push("</"+e.tagName+">"),a.join("")},raw:function(e,t,n,i){return i.settings.allowDangerousHtml?e.value:Wt(e,0,n,i)},root:function(e,t,n,i){return i.all(e)},text:Wt}}),qt={},Kt={},Xt=[];function Qt(e,t){const n=t||qt,i=n.quote||'"',r='"'===i?"'":'"';if('"'!==i&&"'"!==i)throw new Error("Invalid quote `"+i+"`, expected `'` or `\"`");return{one:Yt,all:Jt,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||Le,characterReferences:n.characterReferences||Kt,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:"svg"===n.space?rt:it,quote:i,alternative:r}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)}function Yt(e,t,n){return Vt(e,t,n,this)}function Jt(e){const t=[],n=e&&e.children||Xt;let i=-1;for(;++i<n.length;)t[i]=this.one(n[i],i,e);return t.join("")}var Zt=class{constructor(e,t){y(this,"mode"),y(this,"options"),y(this,"hoveredLine"),y(this,"hoveredToken"),y(this,"pre"),y(this,"gutterUtilityLine"),y(this,"gutterUtilityContainer"),y(this,"gutterUtilityButton"),y(this,"gutterUtilitySlot"),y(this,"interactiveLinesAttr",!1),y(this,"interactiveLineNumbersAttr",!1),y(this,"hasPointerListeners",!1),y(this,"hasDocumentPointerListeners",!1),y(this,"selectedRange",null),y(this,"proposedSelectedRange"),y(this,"renderedSelectionRange"),y(this,"selectionAnchor"),y(this,"queuedSelectionRender"),y(this,"pointerSession",{mode:"idle"}),y(this,"getHoveredLine",()=>{var e;const t=null!=(e=this.gutterUtilityLine)?e:this.hoveredLine;if(null!=t){if("diff"===this.mode&&"diff-line"===t.type)return{lineNumber:t.lineNumber,side:t.annotationSide};if("file"===this.mode&&"line"===t.type)return{lineNumber:t.lineNumber}}}),y(this,"handlePointerClick",e=>{const{onHunkExpand:t,onLineClick:n,onLineNumberClick:i,onTokenClick:r,onMergeConflictActionClick:o}=this.options;null==t&&null==n&&null==i&&null==o&&null==r||null!=this.options.onGutterUtilityClick&&hn(e.composedPath())||(fn(this.options.__debugPointerEvents,"click"),this.handlePointerEvent({eventType:"click",event:e}))}),y(this,"handlePointerMove",e=>{if("mouse"!==e.pointerType)return;const{lineHoverHighlight:t="disabled",onLineEnter:n,onLineLeave:i,onTokenEnter:r,onTokenLeave:o,enableGutterUtility:s=!1}=this.options;("disabled"!==t||s||null!=n||null!=i||null!=r||null!=o)&&(fn(this.options.__debugPointerEvents,"move"),this.handlePointerEvent({eventType:"move",event:e}))}),y(this,"handlePointerLeave",e=>{var t,n,i,r;const{__debugPointerEvents:o}=this.options;fn(o,"move"),null!=this.hoveredLine||null!=this.hoveredToken?(null!=this.hoveredToken&&(null==(n=(t=this.options).onTokenLeave)||n.call(t,this.hoveredToken,e),this.clearHoveredToken()),null!=this.hoveredLine&&(null==(r=(i=this.options).onLineLeave)||r.call(i,{...this.hoveredLine,event:e}),this.clearHoveredLine()),this.placeUtility()):fn(o,"move")}),y(this,"handlePointerDown",e=>{if("mouse"===e.pointerType&&0!==e.button||null==this.pre||"idle"!==this.pointerSession.mode)return;const t=e.composedPath();hn(t)&&null!=this.options.onGutterUtilityClick?this.startGutterSelectionFromPointerDown(e):("mouse"!==e.pointerType&&this.revealUtilityFromGutterPath(t),this.startLineSelectionFromPointerDown(e))}),y(this,"handleDocumentPointerMove",e=>{const{enableLineSelection:t=!1}=this.options;switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();const n=this.resolveSelectionPoint(e,{source:"coordinates-first"});if(null==n)return;return this.pointerSession.current=n,void(!0===t&&this.updateSelection(n.lineNumber,n.side))}case"selecting":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();const t=this.resolveSelectionInfo(e,{source:"coordinates-first",requireNumberColumn:!1});if(null==t||null==this.selectionAnchor)return;return void this.updateSelection(t.lineNumber,t.eventSide)}case"pendingSingleLineUnselect":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();const t=this.resolveSelectionInfo(e,{source:"coordinates-first",requireNumberColumn:!1});if(null==t||null==this.selectionAnchor)return;if(i={lineNumber:t.lineNumber,side:t.eventSide},(n=this.pointerSession.pending).lineNumber===i.lineNumber&&n.side===i.side)return;return this.updateSelection(t.lineNumber,t.eventSide,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.notifySelectionChangeDelta(),void(this.pointerSession={mode:"selecting",pointerId:e.pointerId})}}var n,i}),y(this,"handleDocumentPointerUp",e=>{const{enableLineSelection:t=!1,onGutterUtilityClick:n}=this.options;switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();const i=this.resolveSelectionPoint(e,{source:"coordinates-first"});return null!=i&&(this.pointerSession.current=i,t&&this.updateSelection(i.lineNumber,i.side)),null==n||n(this.buildSelectedLineRange(this.pointerSession.anchor,this.pointerSession.current)),this.selectionAnchor=void 0,t&&(this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(),this.clearProposedSelection()),this.clearPointerSession(),void this.detachDocumentPointerListeners()}case"pendingSingleLineUnselect":if(e.pointerId!==this.pointerSession.pointerId)return;return e.preventDefault(),this.updateSelection(null,void 0,!1),this.selectionAnchor=void 0,this.clearPendingSingleLineState(),this.detachDocumentPointerListeners(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(),void this.clearProposedSelection();case"selecting":if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.selectionAnchor=void 0,this.detachDocumentPointerListeners(),this.clearPointerSession(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(),this.clearProposedSelection()}}),y(this,"handleDocumentPointerCancel",e=>{switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":case"selecting":case"pendingSingleLineUnselect":if("pointerId"in this.pointerSession&&e.pointerId!==this.pointerSession.pointerId)return;this.selectionAnchor=void 0,this.clearProposedSelection(),this.clearPendingSingleLineState(),this.clearPointerSession(),this.detachDocumentPointerListeners()}}),y(this,"renderSelection",()=>{if(null!=this.queuedSelectionRender&&(cancelAnimationFrame(this.queuedSelectionRender),this.queuedSelectionRender=void 0),null==this.pre||this.renderedSelectionRange===this.selectedRange)return;const e=this.pre.querySelectorAll("[data-selected-line]");for(const a of e)a.removeAttribute("data-selected-line");if(this.renderedSelectionRange=this.selectedRange,null==this.selectedRange)return;const{children:t}=this.pre;if(0===t.length)return;if(t.length>2)throw console.error(t),new Error("InteractionManager.renderSelection: Somehow there are more than 2 code elements...");const n="split"===this.pre.getAttribute("data-diff-type"),i=this.getIndexesFromSelection(this.selectedRange,n);if(null==i)throw console.error({rowRange:i,selectedRange:this.selectedRange}),new Error("InteractionManager.renderSelection: No valid rowRange");const r=i.start===i.end,o=Math.min(i.start,i.end),s=Math.max(i.start,i.end);for(const a of t){const[e,t]=a.children,i=t.children.length;if(i!==e.children.length)throw new Error("InteractionManager.renderSelection: gutter and content children dont match, something is wrong");for(let a=0;a<i;a++){const i=t.children[a],l=e.children[a];if(!(i instanceof HTMLElement&&l instanceof HTMLElement))continue;const d=this.parseLineIndex(i,n);if((null!=d?d:0)>s)break;if(null==d||d<o)continue;let c=r?"single":d===o?"first":d===s?"last":"";i.setAttribute("data-selected-line",c),l.setAttribute("data-selected-line",c),l.nextSibling instanceof HTMLElement&&i.nextSibling instanceof HTMLElement&&(i.nextSibling.hasAttribute("data-line-annotation")||i.nextSibling.hasAttribute("data-merge-conflict-actions"))&&(r?(c="last",i.setAttribute("data-selected-line","first")):d===o?c="":d===s&&i.setAttribute("data-selected-line",""),i.nextSibling.setAttribute("data-selected-line",c),l.nextSibling.setAttribute("data-selected-line",c))}}}),this.mode=e,this.options=t}setOptions(e){this.options=e}cleanUp(){var e,t,n,i,r,o,s;null==(e=this.pre)||e.removeEventListener("click",this.handlePointerClick),null==(t=this.pre)||t.removeEventListener("pointerdown",this.handlePointerDown),null==(n=this.pre)||n.removeEventListener("pointermove",this.handlePointerMove),null==(i=this.pre)||i.removeEventListener("pointerleave",this.handlePointerLeave),null==(r=this.pre)||r.removeAttribute("data-interactive-lines"),null==(o=this.pre)||o.removeAttribute("data-interactive-line-numbers"),this.pre=void 0,null==(s=this.gutterUtilityContainer)||s.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.clearHoveredLine(),this.clearHoveredToken(),this.detachDocumentPointerListeners(),this.clearPointerSession(),null!=this.queuedSelectionRender&&(cancelAnimationFrame(this.queuedSelectionRender),this.queuedSelectionRender=void 0),this.interactiveLinesAttr=!1,this.interactiveLineNumbersAttr=!1,this.hasPointerListeners=!1}setup(e){this.setSelectionDirty();const{usesCustomGutterUtility:t=!1,enableGutterUtility:n=!1}=this.options;this.pre!==e&&(this.cleanUp(),this.pre=e),n?this.ensureGutterUtilityNode(t):null!=this.gutterUtilityContainer&&(this.gutterUtilityContainer.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,"gutterSelecting"===this.pointerSession.mode&&(this.clearPointerSession(),this.detachDocumentPointerListeners())),this.syncPointerListeners(e),this.updateInteractiveLineAttributes(),this.renderSelection(),this.placeUtility()}setSelectionDirty(){this.renderedSelectionRange=void 0}isSelectionDirty(){return null===this.renderedSelectionRange}setSelection(e,t){var n;const i=!(e===this.selectedRange||pe(null!=e?e:void 0,null!=(n=this.selectedRange)?n:void 0));(this.isSelectionDirty()||i)&&(this.proposedSelectedRange=void 0,this.selectedRange=e,this.renderSelection(),this.placeUtility(),i&&!1!==(null==t?void 0:t.notify)&&this.notifySelectionCommitted())}getSelection(){return this.selectedRange}handlePointerEvent({eventType:e,event:t}){var n,i;const{__debugPointerEvents:r}=this.options,o=t.composedPath();fn(r,e);const s=this.resolvePointerTarget(o);fn(r,e);const{onLineClick:a,onLineNumberClick:l,onLineEnter:d,onLineLeave:c,onTokenClick:u,onTokenEnter:h,onTokenLeave:f,onHunkExpand:p,onMergeConflictActionClick:m}=this.options;switch(e){case"move":{const e=on(s)&&(null==(n=this.hoveredLine)?void 0:n.lineElement)===s.lineElement;rn(s)&&(null==(i=this.hoveredToken)?void 0:i.tokenElement)===s.tokenElement||(null!=this.hoveredToken&&(null==f||f(this.hoveredToken,t),this.clearHoveredToken()),rn(s)&&(this.setHoveredToken(this.toTokenEventBaseProps(s)),null==h||h(this.hoveredToken,t))),e||(null!=this.hoveredLine&&(null==c||c({...this.hoveredLine,event:t}),this.clearHoveredLine()),on(s)?(this.setHoveredLine(this.toEventBaseProps(s)),this.placeUtility(),null==d||d({...this.hoveredLine,event:t})):this.placeUtility());break}case"click":{if(null==s)break;if(function(e){return"kind"in e&&"merge-conflict-action"===e.kind}(s)&&null!=m){m(s);break}if(function(e){return"type"in e&&"line-info"===e.type}(s)&&null!=p){p(s.hunkIndex,s.all||t.shiftKey?"both":s.direction,s.all||t.shiftKey?Number.POSITIVE_INFINITY:void 0);break}if(!on(s))break;rn(s)&&null!=u&&u(this.toTokenEventBaseProps(s),t);const e=this.toEventBaseProps(s);null!=l&&s.numberColumn?l({...e,event:t}):null!=a&&a({...e,event:t});break}}}syncPointerListeners(e){const{__debugPointerEvents:t,lineHoverHighlight:n="disabled",onLineClick:i,onLineNumberClick:r,onLineEnter:o,onLineLeave:s,onTokenClick:a,onTokenEnter:l,onTokenLeave:d,onHunkExpand:c,onMergeConflictActionClick:u,enableGutterUtility:h=!1,enableLineSelection:f=!1,onGutterUtilityClick:p}=this.options,m=null!=p,g="disabled"!==n||null!=i||null!=r||null!=o||null!=s||null!=a||null!=l||null!=d||null!=c||null!=u||h||f||m;g&&!this.hasPointerListeners?(e.addEventListener("click",this.handlePointerClick),e.addEventListener("pointerdown",this.handlePointerDown),e.addEventListener("pointermove",this.handlePointerMove),e.addEventListener("pointerleave",this.handlePointerLeave),this.hasPointerListeners=!0,fn(t,"click",(()=>{const e=[];"both"!==t&&"click"!==t||(null!=i&&e.push("onLineClick"),null!=r&&e.push("onLineNumberClick"),null!=c&&e.push("expandable hunk separators"),null!=u&&e.push("merge conflict actions"))})()),fn(t,"move"),fn(t,"move")):!g&&this.hasPointerListeners&&(e.removeEventListener("click",this.handlePointerClick),e.removeEventListener("pointerdown",this.handlePointerDown),e.removeEventListener("pointermove",this.handlePointerMove),e.removeEventListener("pointerleave",this.handlePointerLeave),this.hasPointerListeners=!1);const v="selecting"===this.pointerSession.mode||"pendingSingleLineUnselect"===this.pointerSession.mode,b="gutterSelecting"===this.pointerSession.mode;(!f&&v||!m&&b)&&(this.clearPointerSession(),this.detachDocumentPointerListeners(),this.selectionAnchor=void 0,this.clearPendingSingleLineState())}updateInteractiveLineAttributes(){if(null==this.pre)return;const{onLineClick:e,onLineNumberClick:t,enableLineSelection:n=!1}=this.options,i=null!=e,r=null!=t||n;i&&!this.interactiveLinesAttr?(this.pre.setAttribute("data-interactive-lines",""),this.interactiveLinesAttr=!0):!i&&this.interactiveLinesAttr&&(this.pre.removeAttribute("data-interactive-lines"),this.interactiveLinesAttr=!1),r&&!this.interactiveLineNumbersAttr?(this.pre.setAttribute("data-interactive-line-numbers",""),this.interactiveLineNumbersAttr=!0):!r&&this.interactiveLineNumbersAttr&&(this.pre.removeAttribute("data-interactive-line-numbers"),this.interactiveLineNumbersAttr=!1)}startLineSelectionFromPointerDown(e){var t,n,i;const{enableLineSelection:r=!1}=this.options;if(!r)return;const o=this.resolveSelectionInfo(e,{source:"event-path",requireNumberColumn:!0});if(null==o)return;const{pre:s}=this;if(null==s)return;const{lineNumber:a,eventSide:l,lineIndex:d}=o;if(e.shiftKey&&null!=this.selectedRange){const n=this.getIndexesFromSelection(this.selectedRange,"split"===s.getAttribute("data-diff-type"));if(null==n)return;const i=n.start<=n.end?d>=n.start:d<=n.end;return this.selectionAnchor={lineNumber:i?this.selectedRange.start:this.selectedRange.end,side:i?this.selectedRange.side:null!=(t=this.selectedRange.endSide)?t:this.selectedRange.side},this.updateSelection(a,l,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:"selecting",pointerId:e.pointerId},void this.attachDocumentPointerListeners()}if((null==(n=this.selectedRange)?void 0:n.start)===a&&(null==(i=this.selectedRange)?void 0:i.end)===a){const t={lineNumber:a,side:l};return this.selectionAnchor=t,this.pointerSession={mode:"pendingSingleLineUnselect",pointerId:e.pointerId,anchor:t,pending:t},void this.attachDocumentPointerListeners()}!0===this.options.controlledSelection?this.proposedSelectedRange=null:this.selectedRange=null,this.placeUtility(),this.selectionAnchor={lineNumber:a,side:l},this.updateSelection(a,l,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:"selecting",pointerId:e.pointerId},this.attachDocumentPointerListeners()}startGutterSelectionFromPointerDown(e){var t,n;const{enableLineSelection:i=!1,onGutterUtilityClick:r}=this.options;if(null==r)return;const o=this.currentSelectionEnds(),s=null!=(t=null==o?void 0:o.bottom)?t:this.resolveSelectionPoint(e,{source:"event-path",excludeUtility:!1}),a=null!=(n=null==o?void 0:o.top)?n:s;null!=s&&null!=a&&(e.preventDefault(),e.stopPropagation(),this.pointerSession={mode:"gutterSelecting",pointerId:e.pointerId,anchor:a,current:s},i&&(this.selectionAnchor={lineNumber:a.lineNumber,side:a.side},this.updateSelection(s.lineNumber,s.side,!1),this.notifySelectionStart(this.getCurrentSelectionRange())),this.attachDocumentPointerListeners())}clearHoveredLine(){null!=this.hoveredLine&&(this.hoveredLine.lineElement.removeAttribute("data-hovered"),this.hoveredLine.numberElement.removeAttribute("data-hovered"),this.hoveredLine=void 0)}setHoveredLine(e){const{lineHoverHighlight:t="disabled"}=this.options;null!=this.hoveredLine&&this.clearHoveredLine(),this.hoveredLine=e,"disabled"!==t&&("both"!==t&&"line"!==t||this.hoveredLine.lineElement.setAttribute("data-hovered",""),"both"!==t&&"number"!==t||this.hoveredLine.numberElement.setAttribute("data-hovered",""))}clearHoveredToken(){null!=this.hoveredToken&&(this.hoveredToken=void 0)}setHoveredToken(e){null!=this.hoveredToken&&this.clearHoveredToken(),this.hoveredToken=e}ensureGutterUtilityNode(e){var t;if(null==this.gutterUtilityContainer&&(this.gutterUtilityContainer=document.createElement("div"),this.gutterUtilityContainer.setAttribute("data-gutter-utility-slot","")),e)null!=this.gutterUtilityButton&&(this.gutterUtilityButton.remove(),this.gutterUtilityButton=void 0),null==this.gutterUtilitySlot&&(this.gutterUtilitySlot=document.createElement("slot"),this.gutterUtilitySlot.name="gutter-utility-slot"),this.gutterUtilitySlot.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilitySlot);else{if(null==(t=this.gutterUtilitySlot)||t.remove(),this.gutterUtilitySlot=void 0,null==this.gutterUtilityButton){const e=document.createElement("div");e.innerHTML=Qt(we());const t=e.firstElementChild;if(!(t instanceof HTMLButtonElement))throw new Error("InteractionManager.ensureGutterUtilityNode: Node element should be a button");t.remove(),this.gutterUtilityButton=t}this.gutterUtilityButton.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilityButton)}}revealUtilityFromGutterPath(e){if(this.placeUtilityFromSelection())return;const t=this.resolvePointerTarget(e);nn(t)&&t.numberColumn&&this.showUtilityOnLine(this.toEventBaseProps(t))}placeUtility(){this.placeUtilityFromSelection()||(null==this.hoveredLine?this.hideUtility():this.showUtilityOnLine(this.hoveredLine))}placeUtilityFromSelection(){const e=this.currentSelectionEnds();if(null==e)return!1;const t=this.targetForSelectionPoint(e.bottom);return null==t?this.hideUtility():this.showUtilityOnLine(this.toEventBaseProps(t)),!0}showUtilityOnLine(e){null!=this.gutterUtilityContainer&&(this.gutterUtilityLine=e,e.numberElement.appendChild(this.gutterUtilityContainer))}hideUtility(){var e;null==(e=this.gutterUtilityContainer)||e.remove(),this.gutterUtilityLine=void 0}currentSelectionEnds(){const e=this.getCurrentSelectionRange();return null==e?void 0:this.selectionEnds(e)}selectionEnds(e){var t;const n={lineNumber:e.start,side:e.side},i={lineNumber:e.end,side:null!=(t=e.endSide)?t:e.side},r=this.selectionPointRowIndex(n),o=this.selectionPointRowIndex(i);if(null!=r&&null!=o)return r>o?{top:i,bottom:n}:{top:n,bottom:i}}selectionPointRowIndex(e){const t=this.getLineIndex(e.lineNumber,e.side);if(null!=t)return this.isSplitDiff()?t[1]:t[0]}targetForSelectionPoint(e){if(null==this.pre)return;const t=this.getLineIndex(e.lineNumber,e.side);if(null==t)return;const n="diff"===this.mode?`${t[0]},${t[1]}`:`${t[0]}`,i=this.pre.querySelectorAll(`[data-column-number="${e.lineNumber}"][data-line-index="${n}"]`);for(const r of i){if(!(r instanceof HTMLElement))continue;const t=this.resolvePointerTarget(ln(r));if(nn(t)&&("diff"!==this.mode||null==e.side||t.side===e.side))return t}}attachDocumentPointerListeners(){this.hasDocumentPointerListeners||(document.addEventListener("pointermove",this.handleDocumentPointerMove),document.addEventListener("pointerup",this.handleDocumentPointerUp),document.addEventListener("pointercancel",this.handleDocumentPointerCancel),this.hasDocumentPointerListeners=!0)}detachDocumentPointerListeners(){this.hasDocumentPointerListeners&&(document.removeEventListener("pointermove",this.handleDocumentPointerMove),document.removeEventListener("pointerup",this.handleDocumentPointerUp),document.removeEventListener("pointercancel",this.handleDocumentPointerCancel),this.hasDocumentPointerListeners=!1)}clearPointerSession(){this.pointerSession={mode:"idle"}}clearPendingSingleLineState(){"pendingSingleLineUnselect"===this.pointerSession.mode&&(this.pointerSession={mode:"idle"})}selectionInfoFromPath(e,t){const n=this.resolvePointerTarget(e);if(nn(n)&&(!t||n.numberColumn)&&null!=n.splitLineIndex)return{lineIndex:n.splitLineIndex,lineNumber:n.lineNumber,eventSide:"diff"===this.mode?n.side:void 0}}resolveSelectionInfo(e,t){const n=this.resolveSelectionPath(e,t);return null!=n?this.selectionInfoFromPath(n,t.requireNumberColumn):void 0}selectionPointFromPath(e){const t=this.resolvePointerTarget(e);if(nn(t))return{lineNumber:t.lineNumber,side:"diff"===this.mode?t.side:void 0}}resolveSelectionPoint(e,t){const n=this.resolveSelectionPath(e,t);return null!=n?this.selectionPointFromPath(n):void 0}resolveSelectionPath(e,t){const n=!1!==t.excludeUtility;switch(t.source){case"event-path":return this.pathFromEventPath(e.composedPath(),n);case"coordinates-first":{const t=this.pathFromCoordinates(e,n);return void 0!==t?null!=t?t:void 0:this.pathFromEventPath(e.composedPath(),n)}}}pathFromCoordinates(e,t){var n;const i=this.hitTest(e);if(void 0!==i)return null===i?null:null!=(n=this.pathFromElement(i,t))?n:null}pathFromEventPath(e,t){if(!t||!hn(e))for(const n of e)if(n instanceof Element)return this.pathFromElement(n,t)}pathFromElement(e,t){const n=ln(e);if(t&&hn(n))return;const i=function(e){const t=e.closest("[data-line], [data-column-number]");if(t instanceof HTMLElement)return t;const n=e.closest('[data-line-annotation], [data-gutter-buffer="annotation"]');if(!(n instanceof HTMLElement))return;const i=n.previousElementSibling;return i instanceof HTMLElement&&(i.hasAttribute("data-line")||i.hasAttribute("data-column-number"))?i:void 0}(e);return null!=i?ln(i):this.pathFromAnnotationSlot(e)}pathFromAnnotationSlot(e){const t=function(e){if(null==e)return;const t=/^annotation-(?:(additions|deletions)-)?(\d+)$/.exec(e);if(null==t)return;const n=Number.parseInt(t[2],10);return!Number.isFinite(n)||n<=0?void 0:{lineNumber:n,side:t[1]}}(function(e){var t,n;const i=e.closest('[slot^="annotation-"]');if(i instanceof HTMLElement)return null!=(t=i.getAttribute("slot"))?t:void 0;if(e instanceof HTMLElement){const t=null!=(n=e.getAttribute("name"))?n:void 0;return null!=t&&t.startsWith("annotation-")?t:void 0}}(e));if(null==t)return;const n=this.targetForSelectionPoint(t);return null!=n?ln(n.lineElement):void 0}hitTest(e){var t;if(!Number.isFinite(e.clientX)||!Number.isFinite(e.clientY))return;const n=null==(t=this.pre)?void 0:t.getRootNode(),i=dn(n)?n:dn(document)?document:void 0;return null!=i?i.elementFromPoint(e.clientX,e.clientY):void 0}getLineIndex(e,t){const{getLineIndex:n}=this.options;return null!=n?n(e,t):[e-1,e-1]}getCurrentSelectionRange(){return void 0!==this.proposedSelectedRange?this.proposedSelectedRange:this.selectedRange}clearProposedSelection(){this.proposedSelectedRange=void 0}updateSelection(e,t,n=!0){var i,r,o,s;const a=this.getCurrentSelectionRange();let l;if(null==e)l=null;else{const n=null!=(r=null==(i=this.selectionAnchor)?void 0:i.side)?r:t,a=null!=(s=null==(o=this.selectionAnchor)?void 0:o.lineNumber)?s:e;l=this.buildSelectionRange(a,e,n,t)}pe(null!=a?a:void 0,null!=l?l:void 0)||(!0===this.options.controlledSelection?this.proposedSelectedRange=l:(this.selectedRange=l,null!=this.queuedSelectionRender||(this.queuedSelectionRender=requestAnimationFrame(this.renderSelection))),this.placeUtility(),n&&this.notifySelectionChangeDelta())}getIndexesFromSelection(e,t){var n;if(null==this.pre)return;const i=this.getLineIndex(e.start,e.side),r=this.getLineIndex(e.end,null!=(n=e.endSide)?n:e.side);return null!=i&&null!=r?{start:t?i[1]:i[0],end:t?r[1]:r[0]}:void 0}notifySelectionCommitted(){var e,t,n;null==(n=(t=this.options).onLineSelected)||n.call(t,null!=(e=this.getCurrentSelectionRange())?e:null)}notifySelectionChangeDelta(){var e,t,n;null==(n=(t=this.options).onLineSelectionChange)||n.call(t,null!=(e=this.getCurrentSelectionRange())?e:null)}notifySelectionStart(e){var t,n;null==(n=(t=this.options).onLineSelectionStart)||n.call(t,e)}notifySelectionEnd(e){var t,n;null==(n=(t=this.options).onLineSelectionEnd)||n.call(t,e)}toEventBaseProps(e){return"file"===this.mode?{type:"line",lineElement:e.lineElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn,numberElement:e.numberElement}:{type:"diff-line",annotationSide:e.side,lineType:e.lineType,lineElement:e.lineElement,numberElement:e.numberElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn}}toTokenEventBaseProps({lineCharEnd:e,lineCharStart:t,lineNumber:n,side:i,tokenElement:r,tokenText:o}){return"file"===this.mode?{type:"token",lineCharEnd:e,lineCharStart:t,lineNumber:n,tokenElement:r,tokenText:o}:{type:"token",lineCharEnd:e,lineCharStart:t,lineNumber:n,side:i,tokenElement:r,tokenText:o}}buildSelectedLineRange(e,t){return this.buildSelectionRange(e.lineNumber,t.lineNumber,e.side,t.side)}buildSelectionRange(e,t,n,i){return{start:e,end:t,...null!=n?{side:n}:{},...n!==i&&null!=i?{endSide:i}:{}}}resolvePointerTarget(e){var t,n,i,r,o,s,a,l;let d,c,u,h,f,p,m,g,v,b,y=!1;for(const S of e){if(!(S instanceof HTMLElement))continue;if(null==b&&S.hasAttribute("data-merge-conflict-action")){const e=null!=(t=S.getAttribute("data-merge-conflict-action"))?t:void 0,i=null!=(n=S.getAttribute("data-merge-conflict-conflict-index"))?n:void 0,r=null!=i?Number.parseInt(i,10):NaN;sn(e)&&Number.isFinite(r)&&(b={kind:"merge-conflict-action",resolution:e,conflictIndex:r})}if(null==p&&S.hasAttribute("data-char")){p=S;const e=S.getAttribute("data-char");if(null!=e){const t=Number.parseInt(e,10);if(!Number.isNaN(t)){const e=null!=(i=S.textContent)?i:"",n=t+e.length;""===e.trim()&&!0!==this.options.enableTokenInteractionsOnWhitespace||(m={tokenElement:p,lineCharStart:t,lineCharEnd:n,tokenText:e});continue}}}const e=null==f&&null!=(r=S.getAttribute("data-column-number"))?r:void 0;if(null!=e){f=S,v=Number.parseInt(e,10),y=!0,d=un(S),h=null!=(o=S.getAttribute("data-line-index"))?o:void 0;continue}const C=null==u&&null!=(s=S.getAttribute("data-line"))?s:void 0;if(null!=C){u=S,v=Number.parseInt(C,10),d=un(S),h=null!=(a=S.getAttribute("data-line-index"))?a:void 0;continue}if(null==g&&(S.hasAttribute("data-expand-button")||S.hasAttribute("data-unmodified-lines"))){g={hunkIndex:void 0,direction:(()=>S.hasAttribute("data-expand-up")?"up":S.hasAttribute("data-expand-down")?"down":"both")(),all:S.hasAttribute("data-expand-all-button")};continue}const k=null!=g&&null!=(l=S.getAttribute("data-expand-index"))?l:void 0;if(null!=g&&null!=k){const e=Number.parseInt(k,10);Number.isNaN(e)||(g.hunkIndex=e);continue}if(null==c&&S.hasAttribute("data-code")){c=S;break}}if(null!=b)return b;if(null!=(null==g?void 0:g.hunkIndex))return{type:"line-info",hunkIndex:g.hunkIndex,direction:g.direction,all:g.all};if(null!=u||(u=null!=h?an(c,`[data-line][data-line-index="${h}"]`):void 0),null!=f||(f=null!=h?an(c,`[data-column-number][data-line-index="${h}"]`):void 0),null==c||null==u||null==f||null==d||null==v||Number.isNaN(v))return;const C=this.parseLineIndex(u,this.isSplitDiff());return null!=m?"file"===this.mode?{kind:"token",lineType:d,lineElement:u,lineNumber:v,numberColumn:y,numberElement:f,side:void 0,splitLineIndex:C,...m}:{kind:"token",lineType:d,lineElement:u,lineNumber:v,numberColumn:y,numberElement:f,side:cn(d,c),splitLineIndex:C,...m}:"file"===this.mode?{kind:"line",lineType:d,lineElement:u,lineNumber:v,numberColumn:y,numberElement:f,side:void 0,splitLineIndex:C}:{kind:"line",lineType:d,lineElement:u,lineNumber:v,numberColumn:y,numberElement:f,side:cn(d,c),splitLineIndex:C}}isSplitDiff(){var e;return"split"===(null==(e=this.pre)?void 0:e.getAttribute("data-diff-type"))}parseLineIndex(e,t){var n;const i=(null!=(n=e.getAttribute("data-line-index"))?n:"").split(",").map(e=>Number.parseInt(e,10)).filter(e=>!Number.isNaN(e));return t&&2===i.length?i[1]:t?void 0:i[0]}};function en({enableTokenInteractionsOnWhitespace:e,enableGutterUtility:t,lineHoverHighlight:n,onGutterUtilityClick:i,onLineClick:r,onLineEnter:o,onLineLeave:s,onLineNumberClick:a,onTokenClick:l,onTokenEnter:d,onTokenLeave:c,renderGutterUtility:u,__debugPointerEvents:h,enableLineSelection:f,controlledSelection:p,onLineSelected:m,onLineSelectionStart:g,onLineSelectionChange:v,onLineSelectionEnd:b},y,C,S){return{enableTokenInteractionsOnWhitespace:e,enableGutterUtility:tn({enableGutterUtility:t,renderGutterUtility:u,onGutterUtilityClick:i}),usesCustomGutterUtility:null!=u,lineHoverHighlight:n,onGutterUtilityClick:i,onHunkExpand:y,onMergeConflictActionClick:S,onLineClick:r,onLineEnter:o,onLineLeave:s,onLineNumberClick:a,onTokenClick:l,onTokenEnter:d,onTokenLeave:c,__debugPointerEvents:h,enableLineSelection:f,controlledSelection:p,onLineSelected:m,onLineSelectionStart:g,onLineSelectionChange:v,onLineSelectionEnd:b,getLineIndex:C}}function tn({enableGutterUtility:e,renderGutterUtility:t,onGutterUtilityClick:n}){if(null!=n&&null!=t)throw new Error("Cannot use both 'onGutterUtilityClick' and 'renderGutterUtility'. Use only one gutter utility API.");return null!=e&&e}function nn(e){return null!=e&&"kind"in e&&"line"===e.kind}function rn(e){return null!=e&&"kind"in e&&"token"===e.kind}function on(e){return nn(e)||rn(e)}function sn(e){return"current"===e||"incoming"===e||"both"===e}function an(e,t){const n=null==e?void 0:e.querySelector(t);return n instanceof HTMLElement?n:void 0}function ln(e){const t=[];let n=e;for(;null!=n;)t.push(n),n=n.parentNode;return t}function dn(e){return null!=e&&"function"==typeof e.elementFromPoint}function cn(e,t){switch(e){case"change-deletion":return"deletions";case"change-addition":return"additions";default:return t.hasAttribute("data-deletions")?"deletions":"additions"}}function un(e){const t=e.getAttribute("data-line-type");if(null!=t)switch(t){case"change-deletion":case"change-addition":case"context":case"context-expanded":return t;default:return}}function hn(e){for(const t of e)if(t instanceof HTMLElement&&(t.hasAttribute("data-utility-button")||t.hasAttribute("data-gutter-utility-slot")||"gutter-utility-slot"===t.getAttribute("slot")||"gutter-utility-slot"===t.getAttribute("name")))return!0;return!1}function fn(e="none",t,...n){switch(e){case"none":return;case"both":break;case"click":if("click"!==t)return;break;case"move":if("move"!==t)return}}var pn=(e=class{constructor(){y(this,"observedNodes",/* @__PURE__ */new Map),y(this,"applyColumnUpdates",e=>{for(const[t,n]of e){const e=null!=n.codeInlineSize?mn(n.codeInlineSize):t.codeWidth,i=null!=n.numberInlineSize?gn(n.numberInlineSize):t.numberWidth,r=e!==t.codeWidth,o=i!==t.numberWidth;if((r||o)&&(t.codeWidth=e,t.numberWidth=i,r&&t.codeElement.style.setProperty("--diffs-column-width","number"==typeof e?`${e}px`:"auto"),o&&t.codeElement.style.setProperty("--diffs-column-number-width",0===i?"auto":`${i}px`),r||o&&"auto"!==e)){const n="number"==typeof e?Math.max(e-i,0):0;t.codeElement.style.setProperty("--diffs-column-content-width",n>0?`${n}px`:"auto")}}})}static getResizeObserver(){var t;const n=null!=(t=e.resizeObserver)?t:new ResizeObserver(e.handleSharedResizeEntries);return e.resizeObserver=n,n}static handleSharedResizeEntries(t){const n=/* @__PURE__ */new Map;for(const i of t){const t=e.managersByElement.get(i.target);if(null==t)continue;const r=n.get(t);null==r?n.set(t,[i]):r.push(i)}for(const[e,i]of n)e.handleResizeEntries(i)}setup(e,t){var n;const i=/* @__PURE__ */new Set;let r=0;const o=new Map(this.observedNodes);this.observedNodes.clear();for(const s of e.children){if(2===r)break;const e=(()=>{if(s instanceof HTMLElement&&"CODE"===s.tagName)return s})();if(null==e)continue;r++;let t=o.get(e);if(null!=t&&"code"!==t.type)throw new Error("ResizeManager.setup: somehow a code node is being used for an annotation, should be impossible");let n=e.firstElementChild;n instanceof HTMLElement||(n=null),null!=t?(this.observedNodes.set(e,t),o.delete(e),t.numberElement!==n?(null!=t.numberElement&&(this.unobserve(t.numberElement),o.delete(t.numberElement)),null!=n&&(this.observe(n),o.delete(n),this.observedNodes.set(n,t)),t.numberElement=n,t.numberWidth=0):null!=t.numberElement?(o.delete(t.numberElement),this.observedNodes.set(t.numberElement,t)):t.numberWidth=0):(t={type:"code",codeElement:e,numberElement:n,codeWidth:"auto",numberWidth:0},this.observedNodes.set(e,t),this.observe(e),null!=n&&(this.observedNodes.set(n,t),this.observe(n)))}if(r>1&&!t){const t=e.querySelectorAll('[data-line-annotation*=","]'),r=/* @__PURE__ */new Map;for(const e of t){if(!(e instanceof HTMLElement))continue;const t=null!=(n=e.getAttribute("data-line-annotation"))?n:"";if(!/^-?\d+,-?\d+$/.test(t)){console.error("DiffFileRenderer.setupResizeObserver: Invalid element or annotation",{lineAnnotation:t,element:e});continue}let i=r.get(t);null==i&&(i=[],r.set(t,i)),i.push(e)}for(const[e,n]of r){if(2!==n.length){console.error("DiffFileRenderer.setupResizeObserver: Bad Pair",e,n);continue}const[t,r]=n,s=t.firstElementChild,a=r.firstElementChild;if(!(t instanceof HTMLElement&&r instanceof HTMLElement&&s instanceof HTMLElement&&a instanceof HTMLElement))continue;let l=o.get(s);if(null!=l){this.observedNodes.set(s,l),this.observedNodes.set(a,l),o.delete(s),o.delete(a);continue}const d=s.getBoundingClientRect().height,c=a.getBoundingClientRect().height;l={type:"annotations",column1:{container:t,child:s,childHeight:d},column2:{container:r,child:a,childHeight:c},currentHeight:"auto"},i.add({child1:s,child2:a,item:l,newHeight:Math.max(d,c)})}for(const e of i)this.applyNewHeight(e.item,e.newHeight),this.observedNodes.set(e.child1,e.item),this.observedNodes.set(e.child2,e.item),this.observe(e.child1),this.observe(e.child2);i.clear()}for(const[s,a]of o)this.unobserve(s),"code"===a.type?vn(a):bn(a);o.clear()}cleanUp(){for(const e of this.observedNodes.keys())this.unobserve(e);this.observedNodes.clear()}observe(t){const{managersByElement:n}=e,i=n.get(t);if(i!==this){if(null!=i&&i!==this)throw new Error("ResizeManager.observe: element is already owned by another ResizeManager");n.set(t,this),e.getResizeObserver().observe(t)}}unobserve(t){const{managersByElement:n,resizeObserver:i}=e,r=n.get(t);if(null!=r){if(r!==this)throw new Error("ResizeManager.unobserve: element is owned by another ResizeManager");n.delete(t),null==i||i.unobserve(t),null!=i&&0===n.size&&(i.disconnect(),e.resizeObserver=void 0)}}handleResizeEntries(e){var t;const n=/* @__PURE__ */new Map,i=/* @__PURE__ */new Set;for(const r of e){const{target:e,borderBoxSize:o,contentBoxSize:s}=r;if(!(e instanceof HTMLElement)){console.error("ResizeManager.handleResizeEntries: Invalid element for ResizeObserver",r);continue}const a=this.observedNodes.get(e);if(null!=a){if("annotations"===a.type){const t=(()=>e===a.column1.child?a.column1:e===a.column2.child?a.column2:void 0)();if(null==t){console.error("ResizeManager.handleResizeEntries: Couldn't find a column for",{item:a,target:e});continue}t.childHeight=o[0].blockSize,i.add(a)}else if("code"===a.type){const i=null!=(t=n.get(a))?t:{},r=s[0].inlineSize;e===a.codeElement?i.codeInlineSize=r:e===a.numberElement&&(i.numberInlineSize=r),n.set(a,i)}}else console.error("ResizeManager.handleResizeEntries: Not a valid observed node",r)}this.applyAnnotationUpdates(i),i.clear(),this.applyColumnUpdates(n),n.clear()}applyAnnotationUpdates(e){for(const t of e)this.applyNewHeight(t,Math.max(t.column1.childHeight,t.column2.childHeight))}applyNewHeight(e,t){t!==e.currentHeight&&(e.currentHeight=Math.max(t,0),e.column1.container.style.setProperty("--diffs-annotation-min-height",`${e.currentHeight}px`),e.column2.container.style.setProperty("--diffs-annotation-min-height",`${e.currentHeight}px`))}},y(e,"resizeObserver"),y(e,"managersByElement",/* @__PURE__ */new Map),e);function mn(e){const t=Math.max(Math.floor(e),0);return 0===t?"auto":t}function gn(e){return Math.max(Math.ceil(e),0)}function vn(e){e.codeElement.isConnected&&(e.codeElement.style.removeProperty("--diffs-column-content-width"),e.codeElement.style.removeProperty("--diffs-column-number-width"),e.codeElement.style.removeProperty("--diffs-column-width"))}function bn(e){e.column1.container.isConnected&&e.column1.container.style.removeProperty("--diffs-annotation-min-height"),e.column2.container.isConnected&&e.column2.container.style.removeProperty("--diffs-annotation-min-height")}const yn=/* @__PURE__ */new Map,Cn=/* @__PURE__ */new Map,Sn=/* @__PURE__ */new Map,kn=/* @__PURE__ */new Set;function xn(e){for(const t of Array.isArray(e)?e:[e])if("text"!==t&&"ansi"!==t&&!kn.has(t))return!1;return!0}function wn(e,t){e=Array.isArray(e)?e:[e];for(const n of e){if(kn.has(n.name))continue;let e=yn.get(n.name);null==e&&(e=n,yn.set(n.name,e)),kn.add(e.name),t.loadLanguageSync(e.data)}}function Ln(){yn.clear(),kn.clear()}function Tn(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}var An=Object.defineProperty,In=Object.getOwnPropertyDescriptor,En=Object.getOwnPropertyNames,Mn=Object.prototype.hasOwnProperty,Rn=(e,t)=>{let n={};for(var i in e)An(n,i,{get:e[i],enumerable:!0});return An(n,Symbol.toStringTag,{value:"Module"}),n},Pn=(e,t,n)=>(((e,t,n,i)=>{if(t&&"object"==typeof t||"function"==typeof t)for(var r,o=En(t),s=0,a=o.length;s<a;s++)r=o[s],Mn.call(e,r)||"default"===r||An(e,r,{get:(e=>t[e]).bind(null,r),enumerable:!(i=In(t,r))||i.enumerable})})(e,t),n);const Nn=[{id:"abap",name:"ABAP",import:()=>import("./abap-DnJxzdy9.js")},{id:"actionscript-3",name:"ActionScript",import:()=>import("./actionscript-3-DKotD2Vd.js")},{id:"ada",name:"Ada",import:()=>import("./ada-iG1FnIvR.js")},{id:"angular-html",name:"Angular HTML",import:()=>import("./angular-html-C5GGT2tR.js").then(e=>e.a)},{id:"angular-ts",name:"Angular TypeScript",import:()=>import("./angular-ts-Qqqp7JE0.js")},{id:"apache",name:"Apache Conf",import:()=>import("./apache-CdTKWnKT.js")},{id:"apex",name:"Apex",import:()=>import("./apex-BtozVX6V.js")},{id:"apl",name:"APL",import:()=>import("./apl-BkgZWazH.js")},{id:"applescript",name:"AppleScript",import:()=>import("./applescript-BlLNmGTp.js")},{id:"ara",name:"Ara",import:()=>import("./ara-Ba3fhlsS.js")},{id:"asciidoc",name:"AsciiDoc",aliases:["adoc"],import:()=>import("./asciidoc-AY8u9WWM.js")},{id:"asm",name:"Assembly",import:()=>import("./asm-CHX6lpGW.js")},{id:"astro",name:"Astro",import:()=>import("./astro-BxFA88J7.js")},{id:"awk",name:"AWK",import:()=>import("./awk-XRrwoikR.js")},{id:"ballerina",name:"Ballerina",import:()=>import("./ballerina-Dh0JsEtz.js")},{id:"bat",name:"Batch File",aliases:["batch"],import:()=>import("./bat-BVu0TwaT.js")},{id:"beancount",name:"Beancount",import:()=>import("./beancount-CJl0njO0.js")},{id:"berry",name:"Berry",aliases:["be"],import:()=>import("./berry-Bmu6i3Vs.js")},{id:"bibtex",name:"BibTeX",import:()=>import("./bibtex-CGjxJ4Zd.js")},{id:"bicep",name:"Bicep",import:()=>import("./bicep-DSW96mAt.js")},{id:"bird2",name:"BIRD2 Configuration",aliases:["bird"],import:()=>import("./bird2-DxzquW1t.js")},{id:"blade",name:"Blade",import:()=>import("./blade-B0Yy4jmA.js")},{id:"bsl",name:"1C (Enterprise)",aliases:["1c"],import:()=>import("./bsl-DGicdwC0.js")},{id:"c",name:"C",import:()=>import("./c-BmJt9k-y.js")},{id:"c3",name:"C3",import:()=>import("./c3-BP_4uRj3.js")},{id:"cadence",name:"Cadence",aliases:["cdc"],import:()=>import("./cadence-DbDq8SCj.js")},{id:"cairo",name:"Cairo",import:()=>import("./cairo-Dz8fl918.js")},{id:"clarity",name:"Clarity",import:()=>import("./clarity-Bb40UnPS.js")},{id:"clojure",name:"Clojure",aliases:["clj"],import:()=>import("./clojure-BjI0Knrv.js")},{id:"cmake",name:"CMake",import:()=>import("./cmake-BYiqpiH1.js")},{id:"cobol",name:"COBOL",import:()=>import("./cobol-B1Bs9cCy.js")},{id:"codeowners",name:"CODEOWNERS",import:()=>import("./codeowners-L91meNbn.js")},{id:"codeql",name:"CodeQL",aliases:["ql"],import:()=>import("./codeql-Cd-JFsJB.js")},{id:"coffee",name:"CoffeeScript",aliases:["coffeescript"],import:()=>import("./coffee-BDkVV41o.js")},{id:"common-lisp",name:"Common Lisp",aliases:["lisp"],import:()=>import("./common-lisp-DOi1njVG.js")},{id:"coq",name:"Coq",import:()=>import("./coq-BfbrVLCY.js")},{id:"cpp",name:"C++",aliases:["c++"],import:()=>import("./cpp-oXxK9OCk.js")},{id:"crystal",name:"Crystal",import:()=>import("./crystal-2eHiXEKD.js")},{id:"csharp",name:"C#",aliases:["c#","cs"],import:()=>import("./csharp-DhuT4xSQ.js")},{id:"css",name:"CSS",import:()=>import("./css-C6sBVIXB.js")},{id:"csv",name:"CSV",import:()=>import("./csv-DXKU4rRd.js")},{id:"cue",name:"CUE",import:()=>import("./cue-zmT78Agv.js")},{id:"cypher",name:"Cypher",aliases:["cql"],import:()=>import("./cypher-bkHSskm3.js")},{id:"d",name:"D",import:()=>import("./d-vs9xsbRV.js")},{id:"dart",name:"Dart",import:()=>import("./dart-ATbvIoNW.js")},{id:"dax",name:"DAX",import:()=>import("./dax-D135z3aS.js")},{id:"desktop",name:"Desktop",import:()=>import("./desktop-CigPEpQ5.js")},{id:"diff",name:"Diff",import:()=>import("./diff-Beq1YlA8.js")},{id:"docker",name:"Dockerfile",aliases:["dockerfile"],import:()=>import("./docker-V5Al5bpF.js")},{id:"dotenv",name:"dotEnv",import:()=>import("./dotenv-D9G8sA2m.js")},{id:"dream-maker",name:"Dream Maker",import:()=>import("./dream-maker-BsoKROiO.js")},{id:"edge",name:"Edge",import:()=>import("./edge-BUP_aW-j.js")},{id:"elixir",name:"Elixir",import:()=>import("./elixir-CV6JUqYA.js")},{id:"elm",name:"Elm",import:()=>import("./elm-5NnWpb8Q.js")},{id:"emacs-lisp",name:"Emacs Lisp",aliases:["elisp"],import:()=>import("./emacs-lisp-C4732ieo.js")},{id:"erb",name:"ERB",import:()=>import("./erb-DzuXK2qx.js")},{id:"erlang",name:"Erlang",aliases:["erl"],import:()=>import("./erlang-DAw79KxH.js")},{id:"fennel",name:"Fennel",import:()=>import("./fennel-qzPJJAAI.js")},{id:"fish",name:"Fish",import:()=>import("./fish-Cx6My9pS.js")},{id:"fluent",name:"Fluent",aliases:["ftl"],import:()=>import("./fluent-BsukS3Co.js")},{id:"fortran-fixed-form",name:"Fortran (Fixed Form)",aliases:["f","for","f77"],import:()=>import("./fortran-fixed-form-BiRvzwyR.js")},{id:"fortran-free-form",name:"Fortran (Free Form)",aliases:["f90","f95","f03","f08","f18"],import:()=>import("./fortran-free-form-CakU9R0a.js")},{id:"fsharp",name:"F#",aliases:["f#","fs"],import:()=>import("./fsharp-BmLNaTNL.js")},{id:"gdresource",name:"GDResource",aliases:["tscn","tres"],import:()=>import("./gdresource-pHyHNgx5.js")},{id:"gdscript",name:"GDScript",aliases:["gd"],import:()=>import("./gdscript-BpxQpKjR.js")},{id:"gdshader",name:"GDShader",import:()=>import("./gdshader-BC7WJXp9.js")},{id:"genie",name:"Genie",import:()=>import("./genie-IZOju1hG.js")},{id:"gherkin",name:"Gherkin",import:()=>import("./gherkin-DUpgZfGr.js")},{id:"git-commit",name:"Git Commit Message",import:()=>import("./git-commit-Bptnmh-c.js")},{id:"git-rebase",name:"Git Rebase Message",import:()=>import("./git-rebase-CqNhyBhE.js")},{id:"gleam",name:"Gleam",import:()=>import("./gleam-CCCEh_av.js")},{id:"glimmer-js",name:"Glimmer JS",aliases:["gjs"],import:()=>import("./glimmer-js-C8NS61CI.js")},{id:"glimmer-ts",name:"Glimmer TS",aliases:["gts"],import:()=>import("./glimmer-ts-B-RapyDB.js")},{id:"glsl",name:"GLSL",import:()=>import("./glsl-BDbjGBhJ.js")},{id:"gn",name:"GN",import:()=>import("./gn-BNGDdMfm.js")},{id:"gnuplot",name:"Gnuplot",import:()=>import("./gnuplot-D0FoiB-W.js")},{id:"go",name:"Go",import:()=>import("./go-D4Ovm2g9.js")},{id:"graphql",name:"GraphQL",aliases:["gql"],import:()=>import("./graphql-DTlHKpVh.js")},{id:"groovy",name:"Groovy",import:()=>import("./groovy-D9sPn4Z-.js")},{id:"hack",name:"Hack",import:()=>import("./hack-BxpNoYuc.js")},{id:"haml",name:"Ruby Haml",import:()=>import("./haml-B9roiRDW.js")},{id:"handlebars",name:"Handlebars",aliases:["hbs"],import:()=>import("./handlebars-Bal7dEre.js")},{id:"haskell",name:"Haskell",aliases:["hs"],import:()=>import("./haskell-Cp0NQEkn.js")},{id:"haxe",name:"Haxe",import:()=>import("./haxe-D-PmAGDa.js")},{id:"hcl",name:"HashiCorp HCL",import:()=>import("./hcl-DRMo6eis.js")},{id:"hjson",name:"Hjson",import:()=>import("./hjson-BPEpXUFQ.js")},{id:"hlsl",name:"HLSL",import:()=>import("./hlsl-B-PjNM4a.js")},{id:"html",name:"HTML",import:()=>import("./html-B3ILK6fm.js")},{id:"html-derivative",name:"HTML (Derivative)",import:()=>import("./html-derivative-CfZez7eO.js")},{id:"http",name:"HTTP",import:()=>import("./http-Dh7mhfAc.js")},{id:"hurl",name:"Hurl",import:()=>import("./hurl-DvxDWHzM.js")},{id:"hxml",name:"HXML",import:()=>import("./hxml-DB3_nACV.js")},{id:"hy",name:"Hy",import:()=>import("./hy-CLIvbAhW.js")},{id:"imba",name:"Imba",import:()=>import("./imba-B-tO30Ge.js")},{id:"ini",name:"INI",aliases:["properties"],import:()=>import("./ini-Bpxu4Zsc.js")},{id:"java",name:"Java",import:()=>import("./java-DtRXFtDl.js")},{id:"javascript",name:"JavaScript",aliases:["js","cjs","mjs"],import:()=>import("./javascript-DFyEbC5y.js")},{id:"jinja",name:"Jinja",import:()=>import("./jinja-CVIIYihW.js")},{id:"jison",name:"Jison",import:()=>import("./jison-rKmQmF2-.js")},{id:"json",name:"JSON",import:()=>import("./json-LWN7Ml79.js")},{id:"json5",name:"JSON5",import:()=>import("./json5-CgCB487x.js")},{id:"jsonc",name:"JSON with Comments",import:()=>import("./jsonc-BXrjvC_e.js")},{id:"jsonl",name:"JSON Lines",import:()=>import("./jsonl-D5dm1SHP.js")},{id:"jsonnet",name:"Jsonnet",import:()=>import("./jsonnet-B60UklUs.js")},{id:"jssm",name:"JSSM",aliases:["fsl"],import:()=>import("./jssm-CsqlGknB.js")},{id:"jsx",name:"JSX",import:()=>import("./jsx-g2NrEQII.js")},{id:"julia",name:"Julia",aliases:["jl"],import:()=>import("./julia-3RKjS8FQ.js")},{id:"just",name:"Just",import:()=>import("./just-CVCZ9vRQ.js")},{id:"kdl",name:"KDL",import:()=>import("./kdl-DWIPcypl.js")},{id:"kotlin",name:"Kotlin",aliases:["kt","kts"],import:()=>import("./kotlin-DiV2Dt9D.js")},{id:"kusto",name:"Kusto",aliases:["kql"],import:()=>import("./kusto-Bjy7G7j4.js")},{id:"latex",name:"LaTeX",import:()=>import("./latex-Bs1X87VY.js")},{id:"lean",name:"Lean 4",aliases:["lean4"],import:()=>import("./lean-BpZurxeZ.js")},{id:"less",name:"Less",import:()=>import("./less-DKKxO4Pm.js")},{id:"liquid",name:"Liquid",import:()=>import("./liquid-DhgCFC9B.js")},{id:"llvm",name:"LLVM IR",import:()=>import("./llvm-w4szIS5k.js")},{id:"log",name:"Log file",import:()=>import("./log-CnKjEmrw.js")},{id:"logo",name:"Logo",import:()=>import("./logo-BmG1tMr6.js")},{id:"lua",name:"Lua",import:()=>import("./lua-DlAioYQl.js")},{id:"luau",name:"Luau",import:()=>import("./luau-CDzI2T2B.js")},{id:"make",name:"Makefile",aliases:["makefile"],import:()=>import("./make-Ccm3NI5i.js")},{id:"markdown",name:"Markdown",aliases:["md"],import:()=>import("./markdown-DY93LJPj.js")},{id:"marko",name:"Marko",import:()=>import("./marko-DcK8dvuy.js")},{id:"matlab",name:"MATLAB",import:()=>import("./matlab-nYX3zffi.js")},{id:"mdc",name:"MDC",import:()=>import("./mdc-DQafIqD6.js")},{id:"mdx",name:"MDX",import:()=>import("./mdx-C8C9IGe9.js")},{id:"mermaid",name:"Mermaid",aliases:["mmd"],import:()=>import("./mermaid--Jyu4oWd.js")},{id:"mipsasm",name:"MIPS Assembly",aliases:["mips"],import:()=>import("./mipsasm-BjAqecqh.js")},{id:"mojo",name:"Mojo",import:()=>import("./mojo-C2cxD0aZ.js")},{id:"moonbit",name:"MoonBit",aliases:["mbt","mbti"],import:()=>import("./moonbit-B4gpyPjt.js")},{id:"move",name:"Move",import:()=>import("./move-Dg7rFHVC.js")},{id:"narrat",name:"Narrat Language",aliases:["nar"],import:()=>import("./narrat-BTSicUR-.js")},{id:"nextflow",name:"Nextflow",aliases:["nf"],import:()=>import("./nextflow-CRfcQpDI.js")},{id:"nextflow-groovy",name:"Nextflow Groovy",import:()=>import("./nextflow-groovy-DuWVVkaq.js")},{id:"nginx",name:"Nginx",import:()=>import("./nginx-B2z8CTeP.js")},{id:"nim",name:"Nim",import:()=>import("./nim-DP_Ekwra.js")},{id:"nix",name:"Nix",import:()=>import("./nix-_0LqsLde.js")},{id:"nushell",name:"nushell",aliases:["nu"],import:()=>import("./nushell-Mk45ZIMx.js")},{id:"objective-c",name:"Objective-C",aliases:["objc"],import:()=>import("./objective-c-DLT9zZoE.js")},{id:"objective-cpp",name:"Objective-C++",import:()=>import("./objective-cpp-DKXr-AK_.js")},{id:"ocaml",name:"OCaml",import:()=>import("./ocaml-DP9q6K5L.js")},{id:"odin",name:"Odin",import:()=>import("./odin-BINPiy40.js")},{id:"openscad",name:"OpenSCAD",aliases:["scad"],import:()=>import("./openscad-CVq2HK1T.js")},{id:"pascal",name:"Pascal",import:()=>import("./pascal-DjTTLVNS.js")},{id:"perl",name:"Perl",import:()=>import("./perl-CmsZP_P9.js")},{id:"php",name:"PHP",import:()=>import("./php-vdga8FKK.js")},{id:"pkl",name:"Pkl",import:()=>import("./pkl-0Sl31KKD.js")},{id:"plsql",name:"PL/SQL",import:()=>import("./plsql-CJrHCTnj.js")},{id:"po",name:"Gettext PO",aliases:["pot","potx"],import:()=>import("./po-y5MdiEbo.js")},{id:"polar",name:"Polar",import:()=>import("./polar-Bsx6RkUC.js")},{id:"postcss",name:"PostCSS",import:()=>import("./postcss-CeUBPB2S.js")},{id:"powerquery",name:"PowerQuery",import:()=>import("./powerquery-CW27I574.js")},{id:"powershell",name:"PowerShell",aliases:["ps","ps1"],import:()=>import("./powershell-DSYJ6xcj.js")},{id:"prisma",name:"Prisma",import:()=>import("./prisma-CLoN-gBj.js")},{id:"prolog",name:"Prolog",import:()=>import("./prolog-Bgt5DHUA.js")},{id:"proto",name:"Protocol Buffer 3",aliases:["protobuf"],import:()=>import("./proto-C194Edqz.js")},{id:"pug",name:"Pug",aliases:["jade"],import:()=>import("./pug-KXbBtQiy.js")},{id:"puppet",name:"Puppet",import:()=>import("./puppet-TSkl_nn0.js")},{id:"purescript",name:"PureScript",import:()=>import("./purescript-BrDje9qL.js")},{id:"python",name:"Python",aliases:["py"],import:()=>import("./python-DlV7vnVD.js")},{id:"qml",name:"QML",import:()=>import("./qml-DTv-54bL.js")},{id:"qmldir",name:"QML Directory",import:()=>import("./qmldir-CSZk7E48.js")},{id:"qss",name:"Qt Style Sheets",import:()=>import("./qss-DACx-k9g.js")},{id:"r",name:"R",import:()=>import("./r-EOoB7omE.js")},{id:"racket",name:"Racket",import:()=>import("./racket-D1nq-KeH.js")},{id:"raku",name:"Raku",aliases:["perl6"],import:()=>import("./raku-DocPDKZq.js")},{id:"razor",name:"ASP.NET Razor",import:()=>import("./razor-B-tk-wsx.js")},{id:"reg",name:"Windows Registry Script",import:()=>import("./reg-5ydmJHEw.js")},{id:"regexp",name:"RegExp",aliases:["regex"],import:()=>import("./regexp-CpyjTnFF.js")},{id:"rel",name:"Rel",import:()=>import("./rel-D68lwU-3.js")},{id:"riscv",name:"RISC-V",import:()=>import("./riscv-Cl4WfXj6.js")},{id:"ron",name:"RON",import:()=>import("./ron-DIZViclS.js")},{id:"rosmsg",name:"ROS Interface",import:()=>import("./rosmsg-sf_0D22S.js")},{id:"rst",name:"reStructuredText",import:()=>import("./rst-BG5pn2qR.js")},{id:"ruby",name:"Ruby",aliases:["rb"],import:()=>import("./ruby-DcH2yJAk.js")},{id:"rust",name:"Rust",aliases:["rs"],import:()=>import("./rust-DpWcZSqc.js")},{id:"sas",name:"SAS",import:()=>import("./sas-B5HzFFRM.js")},{id:"sass",name:"Sass",import:()=>import("./sass-DY_rGA2-.js")},{id:"scala",name:"Scala",import:()=>import("./scala-CYRsmRER.js")},{id:"scheme",name:"Scheme",import:()=>import("./scheme-C45fPb3F.js")},{id:"scss",name:"SCSS",import:()=>import("./scss-BV51UrMN.js")},{id:"sdbl",name:"1C (Query)",aliases:["1c-query"],import:()=>import("./sdbl-BpucmfEo.js")},{id:"shaderlab",name:"ShaderLab",aliases:["shader"],import:()=>import("./shaderlab-DNyPh2Q6.js")},{id:"shellscript",name:"Shell",aliases:["bash","sh","shell","zsh"],import:()=>import("./shellscript-B8OHlvmy.js")},{id:"shellsession",name:"Shell Session",aliases:["console"],import:()=>import("./shellsession-OATBsyRD.js")},{id:"smalltalk",name:"Smalltalk",import:()=>import("./smalltalk-CKvddXL8.js")},{id:"solidity",name:"Solidity",import:()=>import("./solidity-XfXaqt9k.js")},{id:"soy",name:"Closure Templates",aliases:["closure-templates"],import:()=>import("./soy-B8YA9JrK.js")},{id:"sparql",name:"SPARQL",import:()=>import("./sparql-CLNNOQQI.js")},{id:"splunk",name:"Splunk Query Language",aliases:["spl"],import:()=>import("./splunk-CFtInczE.js")},{id:"sql",name:"SQL",import:()=>import("./sql-Q2iGWUi5.js")},{id:"ssh-config",name:"SSH Config",import:()=>import("./ssh-config-Dqsr-I88.js")},{id:"stata",name:"Stata",import:()=>import("./stata-BR_XK0X0.js")},{id:"stylus",name:"Stylus",aliases:["styl"],import:()=>import("./stylus-BeJftkpb.js")},{id:"surrealql",name:"SurrealQL",aliases:["surql"],import:()=>import("./surrealql-C_6seBBi.js")},{id:"svelte",name:"Svelte",import:()=>import("./svelte-0br9ZpFT.js")},{id:"swift",name:"Swift",import:()=>import("./swift-0qv2hBXI.js")},{id:"system-verilog",name:"SystemVerilog",import:()=>import("./system-verilog-B3nElewZ.js")},{id:"systemd",name:"Systemd Units",import:()=>import("./systemd-B7SlkmfE.js")},{id:"talonscript",name:"TalonScript",aliases:["talon"],import:()=>import("./talonscript-BrsbXmRy.js")},{id:"tasl",name:"Tasl",import:()=>import("./tasl-CMkPZNj1.js")},{id:"tcl",name:"Tcl",import:()=>import("./tcl-CiyEbZSK.js")},{id:"templ",name:"Templ",import:()=>import("./templ-B0JhIwv9.js")},{id:"terraform",name:"Terraform",aliases:["tf","tfvars"],import:()=>import("./terraform-BUB-_BlF.js")},{id:"tex",name:"TeX",import:()=>import("./tex-ByCZWQmN.js")},{id:"toml",name:"TOML",import:()=>import("./toml-VldhK7iW.js")},{id:"ts-tags",name:"TypeScript with Tags",aliases:["lit"],import:()=>import("./ts-tags-BWP4nPgY.js")},{id:"tsv",name:"TSV",import:()=>import("./tsv-BQ9ptESM.js")},{id:"tsx",name:"TSX",import:()=>import("./tsx-DYwE5ssU.js")},{id:"turtle",name:"Turtle",import:()=>import("./turtle-BVy4HXn4.js")},{id:"twig",name:"Twig",import:()=>import("./twig-z8zdyiH9.js")},{id:"typescript",name:"TypeScript",aliases:["ts","cts","mts"],import:()=>import("./typescript-DI7mmMRd.js")},{id:"typespec",name:"TypeSpec",aliases:["tsp"],import:()=>import("./typespec-BAzX0Tk7.js")},{id:"typst",name:"Typst",aliases:["typ"],import:()=>import("./typst-JIZTSUoJ.js")},{id:"v",name:"V",import:()=>import("./v-B66J5FdL.js")},{id:"vala",name:"Vala",import:()=>import("./vala-p2PL1w-1.js")},{id:"vb",name:"Visual Basic",aliases:["cmd"],import:()=>import("./vb-Dv-GCw1m.js")},{id:"verilog",name:"Verilog",import:()=>import("./verilog-DKP7kpC6.js")},{id:"vhdl",name:"VHDL",import:()=>import("./vhdl-Cog-DhcW.js")},{id:"viml",name:"Vim Script",aliases:["vim","vimscript"],import:()=>import("./viml-0AN1aqkP.js")},{id:"vue",name:"Vue",import:()=>import("./vue-DqsE_lDH.js")},{id:"vue-html",name:"Vue HTML",import:()=>import("./vue-html-a8uCr53v.js")},{id:"vue-vine",name:"Vue Vine",import:()=>import("./vue-vine-CVmLzYuL.js")},{id:"vyper",name:"Vyper",aliases:["vy"],import:()=>import("./vyper-sB2l1MOO.js")},{id:"wasm",name:"WebAssembly",import:()=>import("./wasm-CSAWeJiV.js")},{id:"wenyan",name:"Wenyan",aliases:["文言"],import:()=>import("./wenyan-CLHHXU5e.js")},{id:"wgsl",name:"WGSL",import:()=>import("./wgsl-DiTcYanS.js")},{id:"wikitext",name:"Wikitext",aliases:["mediawiki","wiki"],import:()=>import("./wikitext-DT8E9qe0.js")},{id:"wit",name:"WebAssembly Interface Types",import:()=>import("./wit-CtjT-RdY.js")},{id:"wolfram",name:"Wolfram",aliases:["wl"],import:()=>import("./wolfram-1xJNnwe2.js")},{id:"xml",name:"XML",import:()=>import("./xml-BsgRw6d1.js")},{id:"xsl",name:"XSL",import:()=>import("./xsl-CNIkWbJg.js")},{id:"yaml",name:"YAML",aliases:["yml"],import:()=>import("./yaml-c2-Vhxho.js")},{id:"zenscript",name:"ZenScript",import:()=>import("./zenscript-ChP1MlQf.js")},{id:"zig",name:"Zig",import:()=>import("./zig-rivS3YQG.js")}],Dn=Object.fromEntries(Nn.map(e=>[e.id,e.import])),Hn=Object.fromEntries(Nn.flatMap(e=>{var t;return(null==(t=e.aliases)?void 0:t.map(t=>[t,e.import]))||[]})),_n={...Dn,...Hn},On=[{id:"andromeeda",displayName:"Andromeeda",type:"dark",import:()=>import("./andromeeda-C4gqWexZ.js")},{id:"aurora-x",displayName:"Aurora X",type:"dark",import:()=>import("./aurora-x-D-2ljcwZ.js")},{id:"ayu-dark",displayName:"Ayu Dark",type:"dark",import:()=>import("./ayu-dark-DYE7WIF3.js")},{id:"ayu-light",displayName:"Ayu Light",type:"light",import:()=>import("./ayu-light-BA47KaF1.js")},{id:"ayu-mirage",displayName:"Ayu Mirage",type:"dark",import:()=>import("./ayu-mirage-32ctXXKs.js")},{id:"catppuccin-frappe",displayName:"Catppuccin Frappé",type:"dark",import:()=>import("./catppuccin-frappe-DFWUc33u.js")},{id:"catppuccin-latte",displayName:"Catppuccin Latte",type:"light",import:()=>import("./catppuccin-latte-C9dUb6Cb.js")},{id:"catppuccin-macchiato",displayName:"Catppuccin Macchiato",type:"dark",import:()=>import("./catppuccin-macchiato-DQyhUUbL.js")},{id:"catppuccin-mocha",displayName:"Catppuccin Mocha",type:"dark",import:()=>import("./catppuccin-mocha-D87Tk5Gz.js")},{id:"dark-plus",displayName:"Dark Plus",type:"dark",import:()=>import("./dark-plus-C3mMm8J8.js")},{id:"dracula",displayName:"Dracula Theme",type:"dark",import:()=>import("./dracula-BzJJZx-M.js")},{id:"dracula-soft",displayName:"Dracula Theme Soft",type:"dark",import:()=>import("./dracula-soft-BXkSAIEj.js")},{id:"everforest-dark",displayName:"Everforest Dark",type:"dark",import:()=>import("./everforest-dark-BgDCqdQA.js")},{id:"everforest-light",displayName:"Everforest Light",type:"light",import:()=>import("./everforest-light-C8M2exoo.js")},{id:"github-dark",displayName:"GitHub Dark",type:"dark",import:()=>import("./github-dark-DHJKELXO.js")},{id:"github-dark-default",displayName:"GitHub Dark Default",type:"dark",import:()=>import("./github-dark-default-Cuk6v7N8.js")},{id:"github-dark-dimmed",displayName:"GitHub Dark Dimmed",type:"dark",import:()=>import("./github-dark-dimmed-DH5Ifo-i.js")},{id:"github-dark-high-contrast",displayName:"GitHub Dark High Contrast",type:"dark",import:()=>import("./github-dark-high-contrast-E3gJ1_iC.js")},{id:"github-light",displayName:"GitHub Light",type:"light",import:()=>import("./github-light-DAi9KRSo.js")},{id:"github-light-default",displayName:"GitHub Light Default",type:"light",import:()=>import("./github-light-default-D7oLnXFd.js")},{id:"github-light-high-contrast",displayName:"GitHub Light High Contrast",type:"light",import:()=>import("./github-light-high-contrast-BfjtVDDH.js")},{id:"gruvbox-dark-hard",displayName:"Gruvbox Dark Hard",type:"dark",import:()=>import("./gruvbox-dark-hard-CFHQjOhq.js")},{id:"gruvbox-dark-medium",displayName:"Gruvbox Dark Medium",type:"dark",import:()=>import("./gruvbox-dark-medium-GsRaNv29.js")},{id:"gruvbox-dark-soft",displayName:"Gruvbox Dark Soft",type:"dark",import:()=>import("./gruvbox-dark-soft-CVdnzihN.js")},{id:"gruvbox-light-hard",displayName:"Gruvbox Light Hard",type:"light",import:()=>import("./gruvbox-light-hard-CH1njM8p.js")},{id:"gruvbox-light-medium",displayName:"Gruvbox Light Medium",type:"light",import:()=>import("./gruvbox-light-medium-DRw_LuNl.js")},{id:"gruvbox-light-soft",displayName:"Gruvbox Light Soft",type:"light",import:()=>import("./gruvbox-light-soft-hJgmCMqR.js")},{id:"horizon",displayName:"Horizon",type:"dark",import:()=>import("./horizon-BUw7H-hv.js")},{id:"horizon-bright",displayName:"Horizon Bright",type:"light",import:()=>import("./horizon-bright-CUuTKBJd.js")},{id:"houston",displayName:"Houston",type:"dark",import:()=>import("./houston-DnULxvSX.js")},{id:"kanagawa-dragon",displayName:"Kanagawa Dragon",type:"dark",import:()=>import("./kanagawa-dragon-CkXjmgJE.js")},{id:"kanagawa-lotus",displayName:"Kanagawa Lotus",type:"light",import:()=>import("./kanagawa-lotus-CfQXZHmo.js")},{id:"kanagawa-wave",displayName:"Kanagawa Wave",type:"dark",import:()=>import("./kanagawa-wave-DWedfzmr.js")},{id:"laserwave",displayName:"LaserWave",type:"dark",import:()=>import("./laserwave-DUszq2jm.js")},{id:"light-plus",displayName:"Light Plus",type:"light",import:()=>import("./light-plus-B7mTdjB0.js")},{id:"material-theme",displayName:"Material Theme",type:"dark",import:()=>import("./material-theme-D5KoaKCx.js")},{id:"material-theme-darker",displayName:"Material Theme Darker",type:"dark",import:()=>import("./material-theme-darker-BfHTSMKl.js")},{id:"material-theme-lighter",displayName:"Material Theme Lighter",type:"light",import:()=>import("./material-theme-lighter-B0m2ddpp.js")},{id:"material-theme-ocean",displayName:"Material Theme Ocean",type:"dark",import:()=>import("./material-theme-ocean-CyktbL80.js")},{id:"material-theme-palenight",displayName:"Material Theme Palenight",type:"dark",import:()=>import("./material-theme-palenight-Csfq5Kiy.js")},{id:"min-dark",displayName:"Min Dark",type:"dark",import:()=>import("./min-dark-CafNBF8u.js")},{id:"min-light",displayName:"Min Light",type:"light",import:()=>import("./min-light-CTRr51gU.js")},{id:"monokai",displayName:"Monokai",type:"dark",import:()=>import("./monokai-D4h5O-jR.js")},{id:"night-owl",displayName:"Night Owl",type:"dark",import:()=>import("./night-owl-C39BiMTA.js")},{id:"night-owl-light",displayName:"Night Owl Light",type:"light",import:()=>import("./night-owl-light-CMTm3GFP.js")},{id:"nord",displayName:"Nord",type:"dark",import:()=>import("./nord-Ddv68eIx.js")},{id:"one-dark-pro",displayName:"One Dark Pro",type:"dark",import:()=>import("./one-dark-pro-DVMEJ2y_.js")},{id:"one-light",displayName:"One Light",type:"light",import:()=>import("./one-light-C3Wv6jpd.js")},{id:"plastic",displayName:"Plastic",type:"dark",import:()=>import("./plastic-3e1v2bzS.js")},{id:"poimandres",displayName:"Poimandres",type:"dark",import:()=>import("./poimandres-CS3Unz2-.js")},{id:"red",displayName:"Red",type:"dark",import:()=>import("./red-bN70gL4F.js")},{id:"rose-pine",displayName:"Rosé Pine",type:"dark",import:()=>import("./rose-pine-qdsjHGoJ.js")},{id:"rose-pine-dawn",displayName:"Rosé Pine Dawn",type:"light",import:()=>import("./rose-pine-dawn-DHQR4-dF.js")},{id:"rose-pine-moon",displayName:"Rosé Pine Moon",type:"dark",import:()=>import("./rose-pine-moon-D4_iv3hh.js")},{id:"slack-dark",displayName:"Slack Dark",type:"dark",import:()=>import("./slack-dark-BthQWCQV.js")},{id:"slack-ochin",displayName:"Slack Ochin",type:"light",import:()=>import("./slack-ochin-DqwNpetd.js")},{id:"snazzy-light",displayName:"Snazzy Light",type:"light",import:()=>import("./snazzy-light-Bw305WKR.js")},{id:"solarized-dark",displayName:"Solarized Dark",type:"dark",import:()=>import("./solarized-dark-DXbdFlpD.js")},{id:"solarized-light",displayName:"Solarized Light",type:"light",import:()=>import("./solarized-light-L9t79GZl.js")},{id:"synthwave-84",displayName:"Synthwave '84",type:"dark",import:()=>import("./synthwave-84-ChtBzv_y.js")},{id:"tokyo-night",displayName:"Tokyo Night",type:"dark",import:()=>import("./tokyo-night-hegEt444.js")},{id:"vesper",displayName:"Vesper",type:"dark",import:()=>import("./vesper-DRje8inN.js")},{id:"vitesse-black",displayName:"Vitesse Black",type:"dark",import:()=>import("./vitesse-black-Bkuqu6BP.js")},{id:"vitesse-dark",displayName:"Vitesse Dark",type:"dark",import:()=>import("./vitesse-dark-D0r3Knsf.js")},{id:"vitesse-light",displayName:"Vitesse Light",type:"light",import:()=>import("./vitesse-light-CVO1_9PV.js")}],jn=Object.fromEntries(On.map(e=>[e.id,e.import]));var Fn=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function Bn(){return"undefined"!=typeof performance?performance.now():Date.now()}const $n=(e,t)=>e+(t-e%t)%t;var zn=Object.defineProperty,Un=(e,t,n)=>((e,t,n)=>t in e?zn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);let Gn=null;class Wn{constructor(e){Un(this,"utf16Length"),Un(this,"utf8Length"),Un(this,"utf16Value"),Un(this,"utf8Value"),Un(this,"utf16OffsetToUtf8"),Un(this,"utf8OffsetToUtf16");const t=e.length,n=Wn._utf8ByteLength(e),i=n!==t,r=i?new Uint32Array(t+1):null;i&&(r[t]=n);const o=i?new Uint32Array(n+1):null;i&&(o[n]=t);const s=new Uint8Array(n);let a=0;for(let l=0;l<t;l++){const n=e.charCodeAt(l);let d=n,c=!1;if(n>=55296&&n<=56319&&l+1<t){const t=e.charCodeAt(l+1);t>=56320&&t<=57343&&(d=65536+(n-55296<<10)|t-56320,c=!0)}i&&(r[l]=a,c&&(r[l+1]=a),d<=127?o[a+0]=l:d<=2047?(o[a+0]=l,o[a+1]=l):d<=65535?(o[a+0]=l,o[a+1]=l,o[a+2]=l):(o[a+0]=l,o[a+1]=l,o[a+2]=l,o[a+3]=l)),d<=127?s[a++]=d:d<=2047?(s[a++]=192|(1984&d)>>>6,s[a++]=128|(63&d)>>>0):d<=65535?(s[a++]=224|(61440&d)>>>12,s[a++]=128|(4032&d)>>>6,s[a++]=128|(63&d)>>>0):(s[a++]=240|(1835008&d)>>>18,s[a++]=128|(258048&d)>>>12,s[a++]=128|(4032&d)>>>6,s[a++]=128|(63&d)>>>0),c&&l++}this.utf16Length=t,this.utf8Length=n,this.utf16Value=e,this.utf8Value=s,this.utf16OffsetToUtf8=r,this.utf8OffsetToUtf16=o}static _utf8ByteLength(e){let t=0;for(let n=0,i=e.length;n<i;n++){const r=e.charCodeAt(n);let o=r,s=!1;if(r>=55296&&r<=56319&&n+1<i){const t=e.charCodeAt(n+1);t>=56320&&t<=57343&&(o=65536+(r-55296<<10)|t-56320,s=!0)}t+=o<=127?1:o<=2047?2:o<=65535?3:4,s&&n++}return t}createString(e){const t=e.omalloc(this.utf8Length);return e.HEAPU8.set(this.utf8Value,t),t}}const Vn=class e{constructor(t){if(Un(this,"id",++e.LAST_ID),Un(this,"_onigBinding"),Un(this,"content"),Un(this,"utf16Length"),Un(this,"utf8Length"),Un(this,"utf16OffsetToUtf8"),Un(this,"utf8OffsetToUtf16"),Un(this,"ptr"),!Gn)throw new Fn("Must invoke loadWasm first.");this._onigBinding=Gn,this.content=t;const n=new Wn(t);this.utf16Length=n.utf16Length,this.utf8Length=n.utf8Length,this.utf16OffsetToUtf8=n.utf16OffsetToUtf8,this.utf8OffsetToUtf16=n.utf8OffsetToUtf16,this.utf8Length<1e4&&!e._sharedPtrInUse?(e._sharedPtr||(e._sharedPtr=Gn.omalloc(1e4)),e._sharedPtrInUse=!0,Gn.HEAPU8.set(n.utf8Value,e._sharedPtr),this.ptr=e._sharedPtr):this.ptr=n.createString(Gn)}convertUtf8OffsetToUtf16(e){return this.utf8OffsetToUtf16?e<0?0:e>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[e]:e}convertUtf16OffsetToUtf8(e){return this.utf16OffsetToUtf8?e<0?0:e>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[e]:e}dispose(){this.ptr===e._sharedPtr?e._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};Un(Vn,"LAST_ID",0),Un(Vn,"_sharedPtr",0),Un(Vn,"_sharedPtrInUse",!1);let qn,Kn,Xn=Vn;class Qn{constructor(e){if(Un(this,"_onigBinding"),Un(this,"_ptr"),!Gn)throw new Fn("Must invoke loadWasm first.");const t=[],n=[];for(let s=0,a=e.length;s<a;s++){const i=new Wn(e[s]);t[s]=i.createString(Gn),n[s]=i.utf8Length}const i=Gn.omalloc(4*e.length);Gn.HEAPU32.set(t,i/4);const r=Gn.omalloc(4*e.length);Gn.HEAPU32.set(n,r/4);const o=Gn.createOnigScanner(i,r,e.length);for(let s=0,a=e.length;s<a;s++)Gn.ofree(t[s]);Gn.ofree(r),Gn.ofree(i),0===o&&function(e){throw new Fn(e.UTF8ToString(e.getLastOnigError()))}(Gn),this._onigBinding=Gn,this._ptr=o}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(e,t,n){let i=0;if("number"==typeof n&&(i=n),"string"==typeof e){e=new Xn(e);const n=this._findNextMatchSync(e,t,!1,i);return e.dispose(),n}return this._findNextMatchSync(e,t,!1,i)}_findNextMatchSync(e,t,n,i){const r=this._onigBinding,o=r.findNextOnigScannerMatch(this._ptr,e.id,e.ptr,e.utf8Length,e.convertUtf16OffsetToUtf8(t),i);if(0===o)return null;const s=r.HEAPU32;let a=o/4;const l=s[a++],d=s[a++],c=[];for(let u=0;u<d;u++){const t=e.convertUtf8OffsetToUtf16(s[a++]),n=e.convertUtf8OffsetToUtf16(s[a++]);c[u]={start:t,end:n,length:n-t}}return{index:l,captureIndices:c}}}function Yn(e){return qn||(qn=async function(){Gn=await async function(e){let t,n;const i={};function r(e){n=e,i.HEAPU8=new Uint8Array(e),i.HEAPU32=new Uint32Array(e)}function o(e){try{return t.grow(e-n.byteLength+65535>>>16),r(t.buffer),1}catch{}}const s="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function a(e,t){return e?function(e,t,n=1024){const i=t+n;let r=t;for(;e[r]&&!(r>=i);)++r;if(r-t>16&&e.buffer&&s)return s.decode(e.subarray(t,r));let o="";for(;t<r;){let n=e[t++];if(!(128&n)){o+=String.fromCharCode(n);continue}const i=63&e[t++];if(192==(224&n)){o+=String.fromCharCode((31&n)<<6|i);continue}const r=63&e[t++];if(n=224==(240&n)?(15&n)<<12|i<<6|r:(7&n)<<18|i<<12|r<<6|63&e[t++],n<65536)o+=String.fromCharCode(n);else{const e=n-65536;o+=String.fromCharCode(55296|e>>10,56320|1023&e)}}return o}(i.HEAPU8,e,t):""}const l={emscripten_get_now:Bn,emscripten_memcpy_big:function(e,t,n){i.HEAPU8.copyWithin(e,t,t+n)},emscripten_resize_heap:function(e){const t=i.HEAPU8.length,n=2147483648;if((e>>>=0)>n)return!1;for(let i=1;i<=4;i*=2){let r=t*(1+.2/i);if(r=Math.min(r,e+100663296),o(Math.min(n,$n(Math.max(e,r),65536))))return!0}return!1},fd_write:()=>0};return await async function(){const n={env:l,wasi_snapshot_preview1:l},o=await e(n);t=o.memory,r(t.buffer),Object.assign(i,o),i.UTF8ToString=a}(),i}(async t=>{let n=e;var i;return n=await n,"function"==typeof n&&(n=await n(t)),"function"==typeof n&&(n=await n(t)),"function"==typeof n.instantiator?n=await n.instantiator(t):"function"!=typeof n.default?(function(e){return void 0!==e.data}(n)&&(n=n.data),function(e){return"undefined"!=typeof Response&&e instanceof Response}(n)?n="function"==typeof WebAssembly.instantiateStreaming?await(i=n,e=>WebAssembly.instantiateStreaming(i,e))(t):await function(e){return async t=>{const n=await e.arrayBuffer();return WebAssembly.instantiate(n,t)}}(n)(t):function(e){var t;return"undefined"!=typeof ArrayBuffer&&(e instanceof ArrayBuffer||ArrayBuffer.isView(e))||"undefined"!=typeof Buffer&&(null==(t=Buffer.isBuffer)?void 0:t.call(Buffer,e))||"undefined"!=typeof SharedArrayBuffer&&e instanceof SharedArrayBuffer||"undefined"!=typeof Uint32Array&&e instanceof Uint32Array}(n)||n instanceof WebAssembly.Module?n=await Jn(n)(t):"default"in n&&n.default instanceof WebAssembly.Module&&(n=await Jn(n.default)(t))):n=await n.default(t),"instance"in n&&(n=n.instance),"exports"in n&&(n=n.exports),n})}(),qn)}function Jn(e){return t=>WebAssembly.instantiate(e,t)}async function Zn(e){return e&&await Yn(e),{createScanner:e=>new Qn(e.map(e=>"string"==typeof e?e:e.source)),createString:e=>new Xn(e)}}const ei=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,createOnigurumaEngine:Zn,getDefaultWasmLoader:function(){return Kn},loadWasm:Yn,setDefaultWasmLoader:function(e){Kn=e}},Symbol.toStringTag,{value:"Module"}));var ti=/* @__PURE__ */Rn({});Pn(ti,ei);var ni=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function ii(e){return Array.isArray(e)?function(e){let t=[];for(let n=0,i=e.length;n<i;n++)t[n]=ii(e[n]);return t}(e):e instanceof RegExp?e:"object"==typeof e?function(e){let t={};for(let n in e)t[n]=ii(e[n]);return t}(e):e}function ri(e,...t){return t.forEach(t=>{for(let n in t)e[n]=t[n]}),e}function oi(e){const t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");return 0===t?e:~t===e.length-1?oi(e.substring(0,e.length-1)):e.substr(1+~t)}var si=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,ai=class{static hasCaptures(e){return null!==e&&(si.lastIndex=0,si.test(e))}static replaceCaptures(e,t,n){return e.replace(si,(e,i,r,o)=>{let s=n[parseInt(i||r,10)];if(!s)return e;{let e=t.substring(s.start,s.end);for(;"."===e[0];)e=e.substring(1);switch(o){case"downcase":return e.toLowerCase();case"upcase":return e.toUpperCase();default:return e}}})}};function li(e,t){return e<t?-1:e>t?1:0}function di(e,t){if(null===e&&null===t)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,i=t.length;if(n===i){for(let i=0;i<n;i++){let n=li(e[i],t[i]);if(0!==n)return n}return 0}return n-i}function ci(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function ui(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var hi=class{constructor(e){y(this,"cache",/* @__PURE__ */new Map),this.fn=e}get(e){if(this.cache.has(e))return this.cache.get(e);const t=this.fn(e);return this.cache.set(e,t),t}},fi=class{constructor(e,t,n){y(this,"_cachedMatchRoot",new hi(e=>this._root.match(e))),this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(function(e){if(!e)return[];if(!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],i=0;for(let r=0,o=t.length;r<o;r++){let e,o=t[r];if(!o.settings)continue;if("string"==typeof o.scope){let t=o.scope;t=t.replace(/^[,]+/,""),t=t.replace(/[,]+$/,""),e=t.split(",")}else e=Array.isArray(o.scope)?o.scope:[""];let s=-1;if("string"==typeof o.settings.fontStyle){s=0;let e=o.settings.fontStyle.split(" ");for(let t=0,n=e.length;t<n;t++)switch(e[t]){case"italic":s|=1;break;case"bold":s|=2;break;case"underline":s|=4;break;case"strikethrough":s|=8}}let a=null;"string"==typeof o.settings.foreground&&ci(o.settings.foreground)&&(a=o.settings.foreground);let l=null;"string"==typeof o.settings.background&&ci(o.settings.background)&&(l=o.settings.background);for(let t=0,d=e.length;t<d;t++){let o=e[t].trim().split(" "),d=o[o.length-1],c=null;o.length>1&&(c=o.slice(0,o.length-1),c.reverse()),n[i++]=new vi(d,c,r,s,a,l)}}return n}(e),t)}static createFromParsedTheme(e,t){return function(e,t){e.sort((e,t)=>{let n=li(e.scope,t.scope);return 0!==n?n:(n=di(e.parentScopes,t.parentScopes),0!==n?n:e.index-t.index)});let n=0,i="#000000",r="#ffffff";for(;e.length>=1&&""===e[0].scope;){let t=e.shift();-1!==t.fontStyle&&(n=t.fontStyle),null!==t.foreground&&(i=t.foreground),null!==t.background&&(r=t.background)}let o=new yi(t),s=new gi(n,o.getId(i),o.getId(r)),a=new ki(new Si(0,null,-1,0,0),[]);for(let l=0,d=e.length;l<d;l++){let t=e[l];a.insert(0,t.scope,t.parentScopes,t.fontStyle,o.getId(t.foreground),o.getId(t.background))}return new fi(o,s,a)}(e,t)}getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(null===e)return this._defaults;const t=e.scopeName,n=this._cachedMatchRoot.get(t).find(t=>function(e,t){if(0===t.length)return!0;for(let n=0;n<t.length;n++){let i=t[n],r=!1;if(">"===i){if(n===t.length-1)return!1;i=t[++n],r=!0}for(;e&&!mi(e.scopeName,i);){if(r)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}(e.parent,t.parentScopes));return n?new gi(n.fontStyle,n.foreground,n.background):null}},pi=class e{constructor(e,t){this.parent=e,this.scopeName=t}static push(t,n){for(const i of n)t=new e(t,i);return t}static from(...t){let n=null;for(let i=0;i<t.length;i++)n=new e(n,t[i]);return n}push(t){return new e(this,t)}getSegments(){let e=this;const t=[];for(;e;)t.push(e.scopeName),e=e.parent;return t.reverse(),t}toString(){return this.getSegments().join(" ")}extends(e){return this===e||null!==this.parent&&this.parent.extends(e)}getExtensionIfDefined(e){const t=[];let n=this;for(;n&&n!==e;)t.push(n.scopeName),n=n.parent;return n===e?t.reverse():void 0}};function mi(e,t){return t===e||e.startsWith(t)&&"."===e[t.length]}var gi=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}},vi=class{constructor(e,t,n,i,r,o){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=i,this.foreground=r,this.background=o}},bi=/* @__PURE__ */(e=>(e[e.NotSet=-1]="NotSet",e[e.None=0]="None",e[e.Italic=1]="Italic",e[e.Bold=2]="Bold",e[e.Underline=4]="Underline",e[e.Strikethrough=8]="Strikethrough",e))(bi||{}),yi=class{constructor(e){if(y(this,"_isFrozen"),y(this,"_lastColorId"),y(this,"_id2color"),y(this,"_color2id"),this._lastColorId=0,this._id2color=[],this._color2id=/* @__PURE__ */Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(null===e)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw new Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},Ci=Object.freeze([]),Si=class e{constructor(e,t,n,i,r){y(this,"scopeDepth"),y(this,"parentScopes"),y(this,"fontStyle"),y(this,"foreground"),y(this,"background"),this.scopeDepth=e,this.parentScopes=t||Ci,this.fontStyle=n,this.foreground=i,this.background=r}clone(){return new e(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let t=[];for(let n=0,i=e.length;n<i;n++)t[n]=e[n].clone();return t}acceptOverwrite(e,t,n,i){this.scopeDepth>e||(this.scopeDepth=e),-1!==t&&(this.fontStyle=t),0!==n&&(this.foreground=n),0!==i&&(this.background=i)}},ki=class e{constructor(e,t=[],n={}){y(this,"_rulesWithParentScopes"),this._mainRule=e,this._children=n,this._rulesWithParentScopes=t}static _cmpBySpecificity(e,t){if(e.scopeDepth!==t.scopeDepth)return t.scopeDepth-e.scopeDepth;let n=0,i=0;for(;">"===e.parentScopes[n]&&n++,">"===t.parentScopes[i]&&i++,!(n>=e.parentScopes.length||i>=t.parentScopes.length);){const r=t.parentScopes[i].length-e.parentScopes[n].length;if(0!==r)return r;n++,i++}return t.parentScopes.length-e.parentScopes.length}match(t){if(""!==t){let e,n,i=t.indexOf(".");if(-1===i?(e=t,n=""):(e=t.substring(0,i),n=t.substring(i+1)),this._children.hasOwnProperty(e))return this._children[e].match(n)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(e._cmpBySpecificity),n}insert(t,n,i,r,o,s){if(""===n)return void this._doInsertHere(t,i,r,o,s);let a,l,d,c=n.indexOf(".");-1===c?(a=n,l=""):(a=n.substring(0,c),l=n.substring(c+1)),this._children.hasOwnProperty(a)?d=this._children[a]:(d=new e(this._mainRule.clone(),Si.cloneArr(this._rulesWithParentScopes)),this._children[a]=d),d.insert(t+1,l,i,r,o,s)}_doInsertHere(e,t,n,i,r){if(null!==t){for(let o=0,s=this._rulesWithParentScopes.length;o<s;o++){let s=this._rulesWithParentScopes[o];if(0===di(s.parentScopes,t))return void s.acceptOverwrite(e,n,i,r)}-1===n&&(n=this._mainRule.fontStyle),0===i&&(i=this._mainRule.foreground),0===r&&(r=this._mainRule.background),this._rulesWithParentScopes.push(new Si(e,t,n,i,r))}else this._mainRule.acceptOverwrite(e,n,i,r)}},xi=class e{static toBinaryStr(e){return e.toString(2).padStart(32,"0")}static print(t){e.getLanguageId(t),e.getTokenType(t),e.getFontStyle(t),e.getForeground(t),e.getBackground(t)}static getLanguageId(e){return(255&e)>>>0}static getTokenType(e){return(768&e)>>>8}static containsBalancedBrackets(e){return!!(1024&e)}static getFontStyle(e){return(30720&e)>>>11}static getForeground(e){return(16744448&e)>>>15}static getBackground(e){return(4278190080&e)>>>24}static set(t,n,i,r,o,s,a){let l=e.getLanguageId(t),d=e.getTokenType(t),c=e.containsBalancedBrackets(t)?1:0,u=e.getFontStyle(t),h=e.getForeground(t),f=e.getBackground(t);return 0!==n&&(l=n),8!==i&&(d=i),null!==r&&(c=r?1:0),-1!==o&&(u=o),0!==s&&(h=s),0!==a&&(f=a),(l|d<<8|c<<10|u<<11|h<<15|f<<24)>>>0}};function wi(e){return e}function Li(e,t){const n=[],i=function(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;const i=n[0];return n=t.exec(e),i}}}(e);let r=i.next();for(;null!==r;){let e=0;if(2===r.length&&":"===r.charAt(1)){switch(r.charAt(0)){case"R":e=1;break;case"L":e=-1}r=i.next()}let t=s();if(n.push({matcher:t,priority:e}),","!==r)break;r=i.next()}return n;function o(){if("-"===r){r=i.next();const e=o();return t=>!!e&&!e(t)}if("("===r){r=i.next();const e=function(){const e=[];let t=s();for(;t&&(e.push(t),"|"===r||","===r);){do{r=i.next()}while("|"===r||","===r);t=s()}return t=>e.some(e=>e(t))}();return")"===r&&(r=i.next()),e}if(Ti(r)){const e=[];do{e.push(r),r=i.next()}while(Ti(r));return n=>t(e,n)}return null}function s(){const e=[];let t=o();for(;t;)e.push(t),t=o();return t=>e.every(e=>e(t))}}function Ti(e){return!!e&&!!e.match(/[\w\.:]+/)}function Ai(e){"function"==typeof e.dispose&&e.dispose()}var Ii=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},Ei=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},Mi=class{constructor(){y(this,"_references",[]),y(this,"_seenReferenceKeys",/* @__PURE__ */new Set),y(this,"visitedRule",/* @__PURE__ */new Set)}get references(){return this._references}add(e){const t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},Ri=class{constructor(e,t){y(this,"seenFullScopeRequests",/* @__PURE__ */new Set),y(this,"seenPartialScopeRequests",/* @__PURE__ */new Set),y(this,"Q"),this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Ii(this.initialScopeName)]}processQueue(){const e=this.Q;this.Q=[];const t=new Mi;for(const n of e)Pi(n,this.initialScopeName,this.repo,t);for(const n of t.references)if(n instanceof Ii){if(this.seenFullScopeRequests.has(n.scopeName))continue;this.seenFullScopeRequests.add(n.scopeName),this.Q.push(n)}else{if(this.seenFullScopeRequests.has(n.scopeName))continue;if(this.seenPartialScopeRequests.has(n.toKey()))continue;this.seenPartialScopeRequests.add(n.toKey()),this.Q.push(n)}}};function Pi(e,t,n,i){const r=n.lookup(e.scopeName);if(!r){if(e.scopeName===t)throw new Error(`No grammar provided for <${t}>`);return}const o=n.lookup(t);e instanceof Ii?Di({baseGrammar:o,selfGrammar:r},i):Ni(e.ruleName,{baseGrammar:o,selfGrammar:r,repository:r.repository},i);const s=n.injections(e.scopeName);if(s)for(const a of s)i.add(new Ii(a))}function Ni(e,t,n){t.repository&&t.repository[e]&&Hi([t.repository[e]],t,n)}function Di(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&Hi(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&Hi(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function Hi(e,t,n){for(const i of e){if(n.visitedRule.has(i))continue;n.visitedRule.add(i);const e=i.repository?ri({},t.repository,i.repository):t.repository;Array.isArray(i.patterns)&&Hi(i.patterns,{...t,repository:e},n);const r=i.include;if(!r)continue;const o=$i(r);switch(o.kind){case 0:Di({...t,selfGrammar:t.baseGrammar},n);break;case 1:Di(t,n);break;case 2:Ni(o.ruleName,{...t,repository:e},n);break;case 3:case 4:const i=o.scopeName===t.selfGrammar.scopeName?t.selfGrammar:o.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(i){const r={baseGrammar:t.baseGrammar,selfGrammar:i,repository:e};4===o.kind?Ni(o.ruleName,r,n):Di(r,n)}else 4===o.kind?n.add(new Ei(o.scopeName,o.ruleName)):n.add(new Ii(o.scopeName))}}}var _i=class{constructor(){y(this,"kind",0)}},Oi=class{constructor(){y(this,"kind",1)}},ji=class{constructor(e){y(this,"kind",2),this.ruleName=e}},Fi=class{constructor(e){y(this,"kind",3),this.scopeName=e}},Bi=class{constructor(e,t){y(this,"kind",4),this.scopeName=e,this.ruleName=t}};function $i(e){if("$base"===e)return new _i;if("$self"===e)return new Oi;const t=e.indexOf("#");if(-1===t)return new Fi(e);if(0===t)return new ji(e.substring(1));{const n=e.substring(0,t),i=e.substring(t+1);return new Bi(n,i)}}var zi=/\\(\d+)/,Ui=/\\(\d+)/g,Gi=class{constructor(e,t,n,i){y(this,"$location"),y(this,"id"),y(this,"_nameIsCapturing"),y(this,"_name"),y(this,"_contentNameIsCapturing"),y(this,"_contentName"),this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=ai.hasCaptures(this._name),this._contentName=i||null,this._contentNameIsCapturing=ai.hasCaptures(this._contentName)}get debugName(){const e=this.$location?`${oi(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return this._nameIsCapturing&&null!==this._name&&null!==e&&null!==t?ai.replaceCaptures(this._name,e,t):this._name}getContentName(e,t){return this._contentNameIsCapturing&&null!==this._contentName?ai.replaceCaptures(this._contentName,e,t):this._contentName}},Wi=class extends Gi{constructor(e,t,n,i,r){super(e,t,n,i),y(this,"retokenizeCapturedWithRuleId"),this.retokenizeCapturedWithRuleId=r}dispose(){}collectPatterns(e,t){throw new Error("Not supported!")}compile(e,t){throw new Error("Not supported!")}compileAG(e,t,n,i){throw new Error("Not supported!")}},Vi=class extends Gi{constructor(e,t,n,i,r){super(e,t,n,null),y(this,"_match"),y(this,"captures"),y(this,"_cachedCompiledPatterns"),this._match=new Yi(i,this.id),this.captures=r,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,i){return this._getCachedCompiledPatterns(e).compileAG(e,n,i)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Ji,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},qi=class extends Gi{constructor(e,t,n,i,r){super(e,t,n,i),y(this,"hasMissingPatterns"),y(this,"patterns"),y(this,"_cachedCompiledPatterns"),this.patterns=r.patterns,this.hasMissingPatterns=r.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(e,t){for(const n of this.patterns)e.getRule(n).collectPatterns(e,t)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,i){return this._getCachedCompiledPatterns(e).compileAG(e,n,i)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Ji,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Ki=class extends Gi{constructor(e,t,n,i,r,o,s,a,l,d){super(e,t,n,i),y(this,"_begin"),y(this,"beginCaptures"),y(this,"_end"),y(this,"endHasBackReferences"),y(this,"endCaptures"),y(this,"applyEndPatternLast"),y(this,"hasMissingPatterns"),y(this,"patterns"),y(this,"_cachedCompiledPatterns"),this._begin=new Yi(r,this.id),this.beginCaptures=o,this._end=new Yi(s||"￿",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=a,this.applyEndPatternLast=l||!1,this.patterns=d.patterns,this.hasMissingPatterns=d.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,n,i){return this._getCachedCompiledPatterns(e,t).compileAG(e,n,i)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Ji;for(const t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},Xi=class extends Gi{constructor(e,t,n,i,r,o,s,a,l){super(e,t,n,i),y(this,"_begin"),y(this,"beginCaptures"),y(this,"whileCaptures"),y(this,"_while"),y(this,"whileHasBackReferences"),y(this,"hasMissingPatterns"),y(this,"patterns"),y(this,"_cachedCompiledPatterns"),y(this,"_cachedCompiledWhilePatterns"),this._begin=new Yi(r,this.id),this.beginCaptures=o,this.whileCaptures=a,this._while=new Yi(s,-2),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,i){return this._getCachedCompiledPatterns(e).compileAG(e,n,i)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Ji;for(const t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,n,i){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,n,i)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new Ji,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||"￿"),this._cachedCompiledWhilePatterns}},Qi=class e{static createCaptureRule(e,t,n,i,r){return e.registerRule(e=>new Wi(t,e,n,i,r))}static getCompiledRuleId(t,n,i){return t.id||n.registerRule(r=>{if(t.id=r,t.match)return new Vi(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,n,i));if(void 0===t.begin){t.repository&&(i=ri({},i,t.repository));let r=t.patterns;return void 0===r&&t.include&&(r=[{include:t.include}]),new qi(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(r,n,i))}return t.while?new Xi(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,i),t.while,e._compileCaptures(t.whileCaptures||t.captures,n,i),e._compilePatterns(t.patterns,n,i)):new Ki(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,i),t.end,e._compileCaptures(t.endCaptures||t.captures,n,i),t.applyEndPatternLast,e._compilePatterns(t.patterns,n,i))}),t.id}static _compileCaptures(t,n,i){let r=[];if(t){let o=0;for(const e in t){if("$vscodeTextmateLocation"===e)continue;const t=parseInt(e,10);t>o&&(o=t)}for(let e=0;e<=o;e++)r[e]=null;for(const s in t){if("$vscodeTextmateLocation"===s)continue;const o=parseInt(s,10);let a=0;t[s].patterns&&(a=e.getCompiledRuleId(t[s],n,i)),r[o]=e.createCaptureRule(n,t[s].$vscodeTextmateLocation,t[s].name,t[s].contentName,a)}}return r}static _compilePatterns(t,n,i){let r=[];if(t)for(let o=0,s=t.length;o<s;o++){const s=t[o];let a=-1;if(s.include){const t=$i(s.include);switch(t.kind){case 0:case 1:a=e.getCompiledRuleId(i[s.include],n,i);break;case 2:let r=i[t.ruleName];r&&(a=e.getCompiledRuleId(r,n,i));break;case 3:case 4:const o=t.scopeName,l=4===t.kind?t.ruleName:null,d=n.getExternalGrammar(o,i);if(d)if(l){let t=d.repository[l];t&&(a=e.getCompiledRuleId(t,n,d.repository))}else a=e.getCompiledRuleId(d.repository.$self,n,d.repository)}}else a=e.getCompiledRuleId(s,n,i);if(-1!==a){const e=n.getRule(a);let t=!1;if((e instanceof qi||e instanceof Ki||e instanceof Xi)&&e.hasMissingPatterns&&0===e.patterns.length&&(t=!0),t)continue;r.push(a)}}return{patterns:r,hasMissingPatterns:(t?t.length:0)!==r.length}}},Yi=class e{constructor(e,t){if(y(this,"source"),y(this,"ruleId"),y(this,"hasAnchor"),y(this,"hasBackReferences"),y(this,"_anchorCache"),e&&"string"==typeof e){const t=e.length;let n=0,i=[],r=!1;for(let o=0;o<t;o++)if("\\"===e.charAt(o)&&o+1<t){const t=e.charAt(o+1);"z"===t?(i.push(e.substring(n,o)),i.push("$(?!\\n)(?<!\\n)"),n=o+2):"A"!==t&&"G"!==t||(r=!0),o++}this.hasAnchor=r,0===n?this.source=e:(i.push(e.substring(n,t)),this.source=i.join(""))}else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=t,"string"==typeof this.source?this.hasBackReferences=zi.test(this.source):this.hasBackReferences=!1}clone(){return new e(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,t){if("string"!=typeof this.source)throw new Error("This method should only be called if the source is a string");let n=t.map(t=>e.substring(t.start,t.end));return Ui.lastIndex=0,this.source.replace(Ui,(e,t)=>ui(n[parseInt(t,10)]||""))}_buildAnchorCache(){if("string"!=typeof this.source)throw new Error("This method should only be called if the source is a string");let e,t,n,i,r=[],o=[],s=[],a=[];for(e=0,t=this.source.length;e<t;e++)n=this.source.charAt(e),r[e]=n,o[e]=n,s[e]=n,a[e]=n,"\\"===n&&e+1<t&&(i=this.source.charAt(e+1),"A"===i?(r[e+1]="￿",o[e+1]="￿",s[e+1]="A",a[e+1]="A"):"G"===i?(r[e+1]="￿",o[e+1]="G",s[e+1]="￿",a[e+1]="G"):(r[e+1]=i,o[e+1]=i,s[e+1]=i,a[e+1]=i),e++);return{A0_G0:r.join(""),A0_G1:o.join(""),A1_G0:s.join(""),A1_G1:a.join("")}}resolveAnchors(e,t){return this.hasAnchor&&this._anchorCache&&"string"==typeof this.source?e?t?this._anchorCache.A1_G1:this._anchorCache.A1_G0:t?this._anchorCache.A0_G1:this._anchorCache.A0_G0:this.source}},Ji=class{constructor(){y(this,"_items"),y(this,"_hasAnchors"),y(this,"_cached"),y(this,"_anchorCache"),this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(e=>e.source);this._cached=new Zi(e,t,this._items.map(e=>e.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){let i=this._items.map(e=>e.resolveAnchors(t,n));return new Zi(e,i,this._items.map(e=>e.ruleId))}},Zi=class{constructor(e,t,n){y(this,"scanner"),this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}dispose(){"function"==typeof this.scanner.dispose&&this.scanner.dispose()}toString(){const e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(" - "+this.rules[t]+": "+this.regExps[t]);return e.join("\n")}findNextMatchSync(e,t,n){const i=this.scanner.findNextMatchSync(e,t,n);return i?{ruleId:this.rules[i.index],captureIndices:i.captureIndices}:null}},er=class{constructor(e,t){this.languageId=e,this.tokenType=t}},tr=(t=class{constructor(e,t){y(this,"_defaultAttributes"),y(this,"_embeddedLanguagesMatcher"),y(this,"_getBasicScopeAttributes",new hi(e=>{const t=this._scopeToLanguage(e),n=this._toStandardTokenType(e);return new er(t,n)})),this._defaultAttributes=new er(e,8),this._embeddedLanguagesMatcher=new nr(Object.entries(t||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(e){return null===e?t._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(e)}_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(e){const n=e.match(t.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"meta.embedded":return 0}throw new Error("Unexpected match for standard token type!")}},y(t,"_NULL_SCOPE_METADATA",new er(0,0)),y(t,"STANDARD_TOKEN_TYPE_REGEXP",/\b(comment|string|regex|meta\.embedded)\b/),t),nr=class{constructor(e){if(y(this,"values"),y(this,"scopesRegExp"),0===e.length)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);const t=e.map(([e,t])=>ui(e));t.sort(),t.reverse(),this.scopesRegExp=new RegExp(`^((${t.join(")|(")}))($|\\.)`,"")}}match(e){if(!this.scopesRegExp)return;const t=e.match(this.scopesRegExp);return t?this.values.get(t[1]):void 0}};"undefined"!=typeof process&&process.env.VSCODE_TEXTMATE_DEBUG;var ir=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function rr(e,t,n,i,r,o,s,a){const l=t.content.length;let d=!1,c=-1;if(s){const s=function(e,t,n,i,r,o){let s=r.beginRuleCapturedEOL?0:-1;const a=[];for(let l=r;l;l=l.pop()){const t=l.getRule(e);t instanceof Xi&&a.push({rule:t,stack:l})}for(let l=a.pop();l;l=a.pop()){const{ruleScanner:a,findOptions:d}=sr(l.rule,e,l.stack.endRule,n,i===s),c=a.findNextMatchSync(t,i,d);if(!c){r=l.stack.pop();break}if(-2!==c.ruleId){r=l.stack.pop();break}c.captureIndices&&c.captureIndices.length&&(o.produce(l.stack,c.captureIndices[0].start),ar(e,t,n,l.stack,o,l.rule.whileCaptures,c.captureIndices),o.produce(l.stack,c.captureIndices[0].end),s=c.captureIndices[0].end,c.captureIndices[0].end>i&&(i=c.captureIndices[0].end,n=!1))}return{stack:r,linePos:i,anchorPosition:s,isFirstLine:n}}(e,t,n,i,r,o);r=s.stack,i=s.linePos,n=s.isFirstLine,c=s.anchorPosition}const u=Date.now();for(;!d;){if(0!==a&&Date.now()-u>a)return new ir(r,!0);h()}return new ir(r,!1);function h(){const s=function(e,t,n,i,r,o){const s=function(e,t,n,i,r,o){const s=r.getRule(e),{ruleScanner:a,findOptions:l}=or(s,e,r.endRule,n,i===o),d=a.findNextMatchSync(t,i,l);return d?{captureIndices:d.captureIndices,matchedRuleId:d.ruleId}:null}(e,t,n,i,r,o),a=e.getInjections();if(0===a.length)return s;const l=function(e,t,n,i,r,o,s){let a,l=Number.MAX_VALUE,d=null,c=0;const u=o.contentNameScopesList.getScopeNames();for(let h=0,f=e.length;h<f;h++){const o=e[h];if(!o.matcher(u))continue;const f=t.getRule(o.ruleId),{ruleScanner:p,findOptions:m}=or(f,t,null,i,r===s),g=p.findNextMatchSync(n,r,m);if(!g)continue;const v=g.captureIndices[0].start;if(!(v>=l)&&(l=v,d=g.captureIndices,a=g.ruleId,c=o.priority,l===r))break}return d?{priorityMatch:-1===c,captureIndices:d,matchedRuleId:a}:null}(a,e,t,n,i,r,o);if(!l)return s;if(!s)return l;const d=s.captureIndices[0].start,c=l.captureIndices[0].start;return c<d||l.priorityMatch&&c===d?l:s}(e,t,n,i,r,c);if(!s)return o.produce(r,l),void(d=!0);const a=s.captureIndices,u=s.matchedRuleId,h=!!(a&&a.length>0)&&a[0].end>i;if(-1===u){const s=r.getRule(e);o.produce(r,a[0].start),r=r.withContentNameScopesList(r.nameScopesList),ar(e,t,n,r,o,s.endCaptures,a),o.produce(r,a[0].end);const u=r;if(r=r.parent,c=u.getAnchorPos(),!h&&u.getEnterPos()===i)return r=u,o.produce(r,l),void(d=!0)}else{const s=e.getRule(u);o.produce(r,a[0].start);const f=r,p=s.getName(t.content,a),m=r.contentNameScopesList.pushAttributed(p,e);if(r=r.push(u,i,c,a[0].end===l,null,m,m),s instanceof Ki){const i=s;ar(e,t,n,r,o,i.beginCaptures,a),o.produce(r,a[0].end),c=a[0].end;const u=i.getContentName(t.content,a),p=m.pushAttributed(u,e);if(r=r.withContentNameScopesList(p),i.endHasBackReferences&&(r=r.withEndRule(i.getEndWithResolvedBackReferences(t.content,a))),!h&&f.hasSameRuleAs(r))return r=r.pop(),o.produce(r,l),void(d=!0)}else if(s instanceof Xi){const i=s;ar(e,t,n,r,o,i.beginCaptures,a),o.produce(r,a[0].end),c=a[0].end;const u=i.getContentName(t.content,a),p=m.pushAttributed(u,e);if(r=r.withContentNameScopesList(p),i.whileHasBackReferences&&(r=r.withEndRule(i.getWhileWithResolvedBackReferences(t.content,a))),!h&&f.hasSameRuleAs(r))return r=r.pop(),o.produce(r,l),void(d=!0)}else if(ar(e,t,n,r,o,s.captures,a),o.produce(r,a[0].end),r=r.pop(),!h)return r=r.safePop(),o.produce(r,l),void(d=!0)}a[0].end>i&&(i=a[0].end,n=!1)}}function or(e,t,n,i,r){return{ruleScanner:e.compileAG(t,n,i,r),findOptions:0}}function sr(e,t,n,i,r){return{ruleScanner:e.compileWhileAG(t,n,i,r),findOptions:0}}function ar(e,t,n,i,r,o,s){if(0===o.length)return;const a=t.content,l=Math.min(o.length,s.length),d=[],c=s[0].end;for(let u=0;u<l;u++){const t=o[u];if(null===t)continue;const l=s[u];if(0===l.length)continue;if(l.start>c)break;for(;d.length>0&&d[d.length-1].endPos<=l.start;)r.produceFromScopes(d[d.length-1].scopes,d[d.length-1].endPos),d.pop();if(d.length>0?r.produceFromScopes(d[d.length-1].scopes,l.start):r.produce(i,l.start),t.retokenizeCapturedWithRuleId){const o=t.getName(a,s),d=i.contentNameScopesList.pushAttributed(o,e),c=t.getContentName(a,s),u=d.pushAttributed(c,e),h=i.push(t.retokenizeCapturedWithRuleId,l.start,-1,!1,null,d,u),f=e.createOnigString(a.substring(0,l.end));rr(e,f,n&&0===l.start,l.start,h,r,!1,0),Ai(f);continue}const h=t.getName(a,s);if(null!==h){const t=(d.length>0?d[d.length-1].scopes:i.contentNameScopesList).pushAttributed(h,e);d.push(new lr(t,l.end))}}for(;d.length>0;)r.produceFromScopes(d[d.length-1].scopes,d[d.length-1].endPos),d.pop()}var lr=class{constructor(e,t){y(this,"scopes"),y(this,"endPos"),this.scopes=e,this.endPos=t}};function dr(e,t,n,i,r){const o=Li(t,cr),s=Qi.getCompiledRuleId(n,i,r.repository);for(const a of o)e.push({debugSelector:t,matcher:a.matcher,ruleId:s,grammar:r,priority:a.priority})}function cr(e,t){if(t.length<e.length)return!1;let n=0;return e.every(e=>{for(let i=n;i<t.length;i++)if(ur(t[i],e))return n=i+1,!0;return!1})}function ur(e,t){if(!e)return!1;if(e===t)return!0;const n=t.length;return e.length>n&&e.substr(0,n)===t&&"."===e[n]}var hr=class{constructor(e,t,n,i,r,o,s,a){if(y(this,"_rootId"),y(this,"_lastRuleId"),y(this,"_ruleId2desc"),y(this,"_includedGrammars"),y(this,"_grammarRepository"),y(this,"_grammar"),y(this,"_injections"),y(this,"_basicScopeAttributesProvider"),y(this,"_tokenTypeMatchers"),this._rootScopeName=e,this.balancedBracketSelectors=o,this._onigLib=a,this._basicScopeAttributesProvider=new tr(n,i),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=s,this._grammar=fr(t,null),this._injections=null,this._tokenTypeMatchers=[],r)for(const l of Object.keys(r)){const e=Li(l,cr);for(const t of e)this._tokenTypeMatchers.push({matcher:t.matcher,type:r[l]})}}get themeProvider(){return this._grammarRepository}dispose(){for(const e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){const e=[],t=this._rootScopeName,n=(e=>e===this._rootScopeName?this._grammar:this.getExternalGrammar(e))(t);if(n){const i=n.injections;if(i)for(let t in i)dr(e,t,i[t],this,n);const r=this._grammarRepository.injections(t);r&&r.forEach(t=>{const n=this.getExternalGrammar(t);if(n){const t=n.injectionSelector;t&&dr(e,t,n,this,n)}})}return e.sort((e,t)=>e.priority-t.priority),e}getInjections(){return null===this._injections&&(this._injections=this._collectInjections()),this._injections}registerRule(e){const t=++this._lastRuleId,n=e(t);return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[e]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){const n=this._grammarRepository.lookup(e);if(n)return this._includedGrammars[e]=fr(n,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,n=0){const i=this._tokenize(e,t,!1,n);return{tokens:i.lineTokens.getResult(i.ruleStack,i.lineLength),ruleStack:i.ruleStack,stoppedEarly:i.stoppedEarly}}tokenizeLine2(e,t,n=0){const i=this._tokenize(e,t,!0,n);return{tokens:i.lineTokens.getBinaryResult(i.ruleStack,i.lineLength),ruleStack:i.ruleStack,stoppedEarly:i.stoppedEarly}}_tokenize(e,t,n,i){let r;if(-1===this._rootId&&(this._rootId=Qi.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections()),t&&t!==mr.NULL)r=!1,t.reset();else{r=!0;const e=this._basicScopeAttributesProvider.getDefaultAttributes(),n=this.themeProvider.getDefaults(),i=xi.set(0,e.languageId,e.tokenType,null,n.fontStyle,n.foregroundId,n.backgroundId),o=this.getRule(this._rootId).getName(null,null);let s;s=o?pr.createRootAndLookUpScopeName(o,i,this):pr.createRoot("unknown",i),t=new mr(null,this._rootId,-1,-1,!1,null,s,s)}e+="\n";const o=this.createOnigString(e),s=o.content.length,a=new vr(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),l=rr(this,o,r,0,t,a,!0,i);return Ai(o),{lineLength:s,lineTokens:a,ruleStack:l.stack,stoppedEarly:l.stoppedEarly}}};function fr(e,t){return(e=ii(e)).repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var pr=class e{constructor(e,t,n){this.parent=e,this.scopePath=t,this.tokenAttributes=n}static fromExtension(t,n){var i;let r=t,o=null!=(i=null==t?void 0:t.scopePath)?i:null;for(const s of n)o=pi.push(o,s.scopeNames),r=new e(r,o,s.encodedTokenAttributes);return r}static createRoot(t,n){return new e(null,new pi(null,t),n)}static createRootAndLookUpScopeName(t,n,i){const r=i.getMetadataForScope(t),o=new pi(null,t),s=i.themeProvider.themeMatch(o),a=e.mergeAttributes(n,r,s);return new e(null,o,a)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(t){return e.equals(this,t)}static equals(e,t){for(;;){if(e===t)return!0;if(!e&&!t)return!0;if(!e||!t)return!1;if(e.scopeName!==t.scopeName||e.tokenAttributes!==t.tokenAttributes)return!1;e=e.parent,t=t.parent}}static mergeAttributes(e,t,n){let i=-1,r=0,o=0;return null!==n&&(i=n.fontStyle,r=n.foregroundId,o=n.backgroundId),xi.set(e,t.languageId,t.tokenType,null,i,r,o)}pushAttributed(t,n){if(null===t)return this;if(-1===t.indexOf(" "))return e._pushAttributed(this,t,n);const i=t.split(/ /g);let r=this;for(const o of i)r=e._pushAttributed(r,o,n);return r}static _pushAttributed(t,n,i){const r=i.getMetadataForScope(n),o=t.scopePath.push(n),s=i.themeProvider.themeMatch(o),a=e.mergeAttributes(t.tokenAttributes,r,s);return new e(t,o,a)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){var t,n;const i=[];let r=this;for(;r&&r!==e;)i.push({encodedTokenAttributes:r.tokenAttributes,scopeNames:r.scopePath.getExtensionIfDefined(null!=(n=null==(t=r.parent)?void 0:t.scopePath)?n:null)}),r=r.parent;return r===e?i.reverse():void 0}},mr=(n=class{constructor(e,t,n,i,r,o,s,a){y(this,"_stackElementBrand"),y(this,"_enterPos"),y(this,"_anchorPos"),y(this,"depth"),this.parent=e,this.ruleId=t,this.beginRuleCapturedEOL=r,this.endRule=o,this.nameScopesList=s,this.contentNameScopesList=a,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=n,this._anchorPos=i}equals(e){return null!==e&&n._equals(this,e)}static _equals(e,t){return e===t||!!this._structuralEquals(e,t)&&pr.equals(e.contentNameScopesList,t.contentNameScopesList)}static _structuralEquals(e,t){for(;;){if(e===t)return!0;if(!e&&!t)return!0;if(!e||!t)return!1;if(e.depth!==t.depth||e.ruleId!==t.ruleId||e.endRule!==t.endRule)return!1;e=e.parent,t=t.parent}}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){n._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(e,t,i,r,o,s,a){return new n(this,e,t,i,r,o,s,a)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){const e=[];return this._writeString(e,0),"["+e.join(",")+"]"}_writeString(e,t){var n,i;return this.parent&&(t=this.parent._writeString(e,t)),e[t++]=`(${this.ruleId}, ${null==(n=this.nameScopesList)?void 0:n.toString()}, ${null==(i=this.contentNameScopesList)?void 0:i.toString()})`,t}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(e){return this.endRule===e?this:new n(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,e,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let t=this;for(;t&&t._enterPos===e._enterPos;){if(t.ruleId===e.ruleId)return!0;t=t.parent}return!1}toStateStackFrame(){var e,t,n,i,r,o;return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:null!=(i=null==(n=this.nameScopesList)?void 0:n.getExtensionIfDefined(null!=(t=null==(e=this.parent)?void 0:e.nameScopesList)?t:null))?i:[],contentNameScopesList:null!=(o=null==(r=this.contentNameScopesList)?void 0:r.getExtensionIfDefined(this.nameScopesList))?o:[]}}static pushFrame(e,t){var i,r,o;const s=pr.fromExtension(null!=(i=null==e?void 0:e.nameScopesList)?i:null,t.nameScopesList);return new n(e,t.ruleId,null!=(r=t.enterPos)?r:-1,null!=(o=t.anchorPos)?o:-1,t.beginRuleCapturedEOL,t.endRule,s,pr.fromExtension(s,t.contentNameScopesList))}},y(n,"NULL",new n(null,0,0,0,!1,null,null,null)),n),gr=class{constructor(e,t){y(this,"balancedBracketScopes"),y(this,"unbalancedBracketScopes"),y(this,"allowAny",!1),this.balancedBracketScopes=e.flatMap(e=>"*"===e?(this.allowAny=!0,[]):Li(e,cr).map(e=>e.matcher)),this.unbalancedBracketScopes=t.flatMap(e=>Li(e,cr).map(e=>e.matcher))}get matchesAlways(){return this.allowAny&&0===this.unbalancedBracketScopes.length}get matchesNever(){return 0===this.balancedBracketScopes.length&&!this.allowAny}match(e){for(const t of this.unbalancedBracketScopes)if(t(e))return!1;for(const t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},vr=class{constructor(e,t,n,i){y(this,"_emitBinaryTokens"),y(this,"_lineText"),y(this,"_tokens"),y(this,"_binaryTokens"),y(this,"_lastTokenEndIndex"),y(this,"_tokenTypeOverrides"),this.balancedBracketSelectors=i,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){var n,i,r,o;if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let o=null!=(n=null==e?void 0:e.tokenAttributes)?n:0,s=!1;if((null==(i=this.balancedBracketSelectors)?void 0:i.matchesAlways)&&(s=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const t=null!=(r=null==e?void 0:e.getScopeNames())?r:[];for(const e of this._tokenTypeOverrides)e.matcher(t)&&(o=xi.set(o,0,wi(e.type),null,-1,0,0));this.balancedBracketSelectors&&(s=this.balancedBracketSelectors.match(t))}return s&&(o=xi.set(o,0,8,s,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===o||(this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(o)),void(this._lastTokenEndIndex=t)}const s=null!=(o=null==e?void 0:e.getScopeNames())?o:[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:s}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),0===this._tokens.length&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),0===this._binaryTokens.length&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);const n=new Uint32Array(this._binaryTokens.length);for(let i=0,r=this._binaryTokens.length;i<r;i++)n[i]=this._binaryTokens[i];return n}},br=class{constructor(e,t){y(this,"_grammars",/* @__PURE__ */new Map),y(this,"_rawGrammars",/* @__PURE__ */new Map),y(this,"_injectionGrammars",/* @__PURE__ */new Map),y(this,"_theme"),this._onigLib=t,this._theme=e}dispose(){for(const e of this._grammars.values())e.dispose()}setTheme(e){this._theme=e}getColorMap(){return this._theme.getColorMap()}addGrammar(e,t){this._rawGrammars.set(e.scopeName,e),t&&this._injectionGrammars.set(e.scopeName,t)}lookup(e){return this._rawGrammars.get(e)}injections(e){return this._injectionGrammars.get(e)}getDefaults(){return this._theme.getDefaults()}themeMatch(e){return this._theme.match(e)}grammarForScopeName(e,t,n,i,r){if(!this._grammars.has(e)){let o=this._rawGrammars.get(e);if(!o)return null;this._grammars.set(e,function(e,t,n,i,r,o,s,a){return new hr(e,t,n,i,r,o,s,a)}(e,o,t,n,i,r,this,this._onigLib))}return this._grammars.get(e)}},yr=class{constructor(e){y(this,"_options"),y(this,"_syncRegistry"),y(this,"_ensureGrammarCache"),this._options=e,this._syncRegistry=new br(fi.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=/* @__PURE__ */new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(fi.createFromRawTheme(e,t))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,t,n){return this.loadGrammarWithConfiguration(e,t,{embeddedLanguages:n})}loadGrammarWithConfiguration(e,t,n){return this._loadGrammar(e,t,n.embeddedLanguages,n.tokenTypes,new gr(n.balancedBracketSelectors||[],n.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,n,i,r){const o=new Ri(this._syncRegistry,e);for(;o.Q.length>0;)o.Q.map(e=>this._loadSingleGrammar(e.scopeName)),o.processQueue();return this._grammarForScopeName(e,t,n,i,r)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){const t=this._options.loadGrammar(e);if(t){const n="function"==typeof this._options.getInjections?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(t,n)}}addGrammar(e,t=[],n=0,i=null){return this._syncRegistry.addGrammar(e,t),this._grammarForScopeName(e.scopeName,n,i)}_grammarForScopeName(e,t=0,n=null,i=null,r=null){return this._syncRegistry.grammarForScopeName(e,t,n,i,r)}},Cr=mr.NULL;function Sr(e,t){const n="string"==typeof e?{}:{...e.colorReplacements},i="string"==typeof e?e:e.name;for(const[r,o]of Object.entries((null==t?void 0:t.colorReplacements)||{}))"string"==typeof o?n[r]=o:r===i&&Object.assign(n,o);return n}function kr(e,t){return e&&(null==t?void 0:t[null==e?void 0:e.toLowerCase()])||e}async function xr(e){return Promise.resolve("function"==typeof e?e():e).then(e=>e.default||e)}function wr(e){return!e||["plaintext","txt","text","plain"].includes(e)}function Lr(e){return"ansi"===e||wr(e)}function Tr(e){return"none"===e}function Ar(e){return Tr(e)}const Ir=/(\r?\n)/g;function Er(e,t=!1){var n;if(0===e.length)return[["",0]];const i=e.split(Ir);let r=0;const o=[];for(let s=0;s<i.length;s+=2){const e=t?i[s]+(i[s+1]||""):i[s];o.push([e,r]),r+=i[s].length,r+=(null==(n=i[s+1])?void 0:n.length)||0}return o}const Mr="__shiki_resolved";function Rr(e){var t,n,i,r,o;if(null==e?void 0:e[Mr])return e;const s={...e};s.tokenColors&&!s.settings&&(s.settings=s.tokenColors,delete s.tokenColors),s.type||(s.type="dark"),s.colorReplacements={...s.colorReplacements},s.settings||(s.settings=[]);let{bg:a,fg:l}=s;if(!a||!l){const e=s.settings?s.settings.find(e=>!e.name&&!e.scope):void 0;(null==(t=null==e?void 0:e.settings)?void 0:t.foreground)&&(l=e.settings.foreground),(null==(n=null==e?void 0:e.settings)?void 0:n.background)&&(a=e.settings.background),!l&&(null==(i=null==s?void 0:s.colors)?void 0:i["editor.foreground"])&&(l=s.colors["editor.foreground"]),!a&&(null==(r=null==s?void 0:s.colors)?void 0:r["editor.background"])&&(a=s.colors["editor.background"]),l||(l="light"===s.type?"#333333":"#bbbbbb"),a||(a="light"===s.type?"#fffffe":"#1e1e1e"),s.fg=l,s.bg=a}s.settings[0]&&s.settings[0].settings&&!s.settings[0].scope||s.settings.unshift({settings:{foreground:s.fg,background:s.bg}});let d=0;const c=/* @__PURE__ */new Map;function u(e){var t;if(c.has(e))return c.get(e);d+=1;const n=`#${d.toString(16).padStart(8,"0").toLowerCase()}`;return(null==(t=s.colorReplacements)?void 0:t[`#${n}`])?u(e):(c.set(e,n),n)}s.settings=s.settings.map(e=>{var t,n;const i=(null==(t=e.settings)?void 0:t.foreground)&&!e.settings.foreground.startsWith("#"),r=(null==(n=e.settings)?void 0:n.background)&&!e.settings.background.startsWith("#");if(!i&&!r)return e;const o={...e,settings:{...e.settings}};if(i){const t=u(e.settings.foreground);s.colorReplacements[t]=e.settings.foreground,o.settings.foreground=t}if(r){const t=u(e.settings.background);s.colorReplacements[t]=e.settings.background,o.settings.background=t}return o});for(const h of Object.keys(s.colors||{}))if(("editor.foreground"===h||"editor.background"===h||h.startsWith("terminal.ansi"))&&!(null==(o=s.colors[h])?void 0:o.startsWith("#"))){const e=u(s.colors[h]);s.colorReplacements[e]=s.colors[h],s.colors[h]=e}return Object.defineProperty(s,Mr,{enumerable:!1,writable:!1,value:!0}),s}async function Pr(e){return[...new Set((await Promise.all(e.filter(e=>!Lr(e)).map(async e=>await xr(e).then(e=>Array.isArray(e)?e:[e])))).flat())]}async function Nr(e){return(await Promise.all(e.map(async e=>Ar(e)?null:Rr(await xr(e))))).filter(e=>!!e)}function Dr(e,t){if(!t)return e;if(t[e]){const n=/* @__PURE__ */new Set([e]);for(;t[e];){if(e=t[e],n.has(e))throw new ni(`Circular alias \`${[...n].join(" -> ")} -> ${e}\``);n.add(e)}}return e}var Hr=class extends yr{constructor(e,t,n,i={}){super(e),y(this,"_resolver"),y(this,"_themes"),y(this,"_langs"),y(this,"_alias"),y(this,"_resolvedThemes",/* @__PURE__ */new Map),y(this,"_resolvedGrammars",/* @__PURE__ */new Map),y(this,"_langMap",/* @__PURE__ */new Map),y(this,"_langGraph",/* @__PURE__ */new Map),y(this,"_textmateThemeCache",/* @__PURE__ */new WeakMap),y(this,"_loadedThemesCache",null),y(this,"_loadedLanguagesCache",null),this._resolver=e,this._themes=t,this._langs=n,this._alias=i,this._themes.map(e=>this.loadTheme(e)),this.loadLanguages(this._langs)}getTheme(e){return"string"==typeof e?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){const t=Rr(e);return t.name&&(this._resolvedThemes.set(t.name,t),this._loadedThemesCache=null),t}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(e){let t=this._textmateThemeCache.get(e);t||(t=fi.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){return e=Dr(e,this._alias),this._resolvedGrammars.get(e)}loadLanguage(e){var t,n,i,r;if(this.getGrammar(e.name))return;const o=new Set([...this._langMap.values()].filter(t=>{var n;return null==(n=t.embeddedLangsLazy)?void 0:n.includes(e.name)}));this._resolver.addLanguage(e);const s={balancedBracketSelectors:e.balancedBracketSelectors||["*"],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);const a=this.loadGrammarWithConfiguration(e.scopeName,1,s);if(a.name=e.name,this._resolvedGrammars.set(e.name,a),e.aliases&&e.aliases.forEach(t=>{this._alias[t]=e.name}),this._loadedLanguagesCache=null,o.size)for(const l of o)this._resolvedGrammars.delete(l.name),this._loadedLanguagesCache=null,null==(n=null==(t=this._syncRegistry)?void 0:t._injectionGrammars)||n.delete(l.scopeName),null==(r=null==(i=this._syncRegistry)?void 0:i._grammars)||r.delete(l.scopeName),this.loadLanguage(this._langMap.get(l.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(e){for(const i of e)this.resolveEmbeddedLanguages(i);const t=[...this._langGraph.entries()],n=t.filter(([e,t])=>!t);if(n.length){const e=t.filter(([e,t])=>{var i;return!!t&&(null==(i=t.embeddedLanguages||t.embeddedLangs)?void 0:i.some(e=>n.map(([e])=>e).includes(e)))}).filter(e=>!n.includes(e));throw new ni(`Missing languages ${n.map(([e])=>`\`${e}\``).join(", ")}, required by ${e.map(([e])=>`\`${e}\``).join(", ")}`)}for(const[i,r]of t)this._resolver.addLanguage(r);for(const[i,r]of t)this.loadLanguage(r)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[.../* @__PURE__ */new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(e){var t;this._langMap.set(e.name,e),this._langGraph.set(e.name,e);const n=null!=(t=e.embeddedLanguages)?t:e.embeddedLangs;if(n)for(const i of n)this._langGraph.set(i,this._langMap.get(i))}},_r=class{constructor(e,t){y(this,"_langs",/* @__PURE__ */new Map),y(this,"_scopeToLang",/* @__PURE__ */new Map),y(this,"_injections",/* @__PURE__ */new Map),y(this,"_onigLib"),this._onigLib={createOnigScanner:t=>e.createScanner(t),createOnigString:t=>e.createString(t)},t.forEach(e=>this.addLanguage(e))}get onigLib(){return this._onigLib}getLangRegistration(e){return this._langs.get(e)}loadGrammar(e){return this._scopeToLang.get(e)}addLanguage(e){this._langs.set(e.name,e),e.aliases&&e.aliases.forEach(t=>{this._langs.set(t,e)}),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach(t=>{this._injections.get(t)||this._injections.set(t,[]),this._injections.get(t).push(e.scopeName)})}getInjections(e){const t=e.split(".");let n=[];for(let i=1;i<=t.length;i++){const e=t.slice(0,i).join(".");n=[...n,...this._injections.get(e)||[]]}return n}};let Or=0;const jr=/* @__PURE__ */new WeakMap;function Fr(e,t){jr.set(e,t)}function Br(e){return jr.get(e)}var $r=class e{constructor(...e){if(y(this,"_stacks",{}),y(this,"lang"),2===e.length){const[t,n]=e;this.lang=n,this._stacks=t}else{const[t,n,i]=e;this.lang=n,this._stacks={[i]:t}}}get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(t,n){return new e(Object.fromEntries((i=n,Array.isArray(i)?i:[i]).map(e=>[e,Cr])),t);var i}getInternalStack(e=this.theme){return this._stacks[e]}getScopes(e=this.theme){return function(e){const t=[],n=/* @__PURE__ */new Set;return function e(i){var r;if(n.has(i))return;n.add(i);const o=null==(r=null==i?void 0:i.nameScopesList)?void 0:r.scopeName;o&&t.push(o),i.parent&&e(i.parent)}(e),t}(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}};const zr=/,/,Ur=/ /;function Gr(e,t,n={}){const{theme:i=e.getLoadedThemes()[0]}=n;if(wr(e.resolveLangAlias(n.lang||"text"))||Tr(i))return Er(t).map(e=>[{content:e[0],offset:e[1]}]);const{theme:r,colorMap:o}=e.setTheme(i),s=e.getLanguage(n.lang||"text");if(n.grammarState){if(n.grammarState.lang!==s.name)throw new ni(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${s.name}"`);if(!n.grammarState.themes.includes(r.name))throw new ni(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${r.name}"`)}return function(e,t,n,i,r){const o=Wr(e,t,n,i,r),s=new $r(o.stateStack,t.name,n.name);return Fr(o.tokens,s),o.tokens}(t,s,r,o,n)}function Wr(e,t,n,i,r){var o;const s=Sr(n,r),{tokenizeMaxLineLength:a=0,tokenizeTimeLimit:l=500,includeExplanation:d=!1}=r,c=Er(e);let u=r.grammarState?null!=(o=function(e,t){if(!(e instanceof $r))throw new ni("Invalid grammar state");return e.getInternalStack(t)}(r.grammarState,n.name))?o:Cr:null!=r.grammarContextCode?Wr(r.grammarContextCode,t,n,i,{...r,grammarState:void 0,grammarContextCode:void 0}).stateStack:Cr,h=[];const f=[];for(let p=0,m=c.length;p<m;p++){const[e,r]=c[p];if(""===e){h=[],f.push([]);continue}if(a>0&&e.length>=a){h=[],f.push([{content:e,offset:r,color:"",fontStyle:0}]);continue}let o,m,g;d&&"tokenType"!==d&&(o=t.tokenizeLine(e,u,l),m=o.tokens,g=0);const v=t.tokenizeLine2(e,u,l),b=v.tokens.length/2;for(let t=0;t<b;t++){const o=v.tokens[2*t],a=t+1<b?v.tokens[2*t+2]:e.length;if(o===a)continue;const l=v.tokens[2*t+1],c=kr(i[xi.getForeground(l)],s),u=xi.getFontStyle(l),f={content:e.substring(o,a),offset:r+o,color:c,fontStyle:u};if("tokenType"===d)f.type=xi.getTokenType(l);else if(d){const t=[];if("scopeName"!==d)for(const e of n.settings){let n;switch(typeof e.scope){case"string":n=e.scope.split(zr).map(e=>e.trim());break;case"object":n=e.scope;break;default:continue}t.push({settings:e,selectors:n.map(e=>e.split(Ur))})}f.explanation=[];let i=0;for(;o+i<a;){const n=m[g],r=e.substring(n.startIndex,n.endIndex);i+=r.length,f.explanation.push({content:r,scopes:"scopeName"===d?Vr(n.scopes):qr(t,n.scopes)}),g+=1}}h.push(f)}f.push(h),h=[],u=v.ruleStack}return{tokens:f,stateStack:u}}function Vr(e){return e.map(e=>({scopeName:e}))}function qr(e,t){const n=[];for(let i=0,r=t.length;i<r;i++){const r=t[i];n[i]={scopeName:r,themeMatches:Qr(e,r,t.slice(0,i))}}return n}function Kr(e,t){return e===t||t.substring(0,e.length)===e&&"."===t[e.length]}function Xr(e,t,n){if(!Kr(e.at(-1),t))return!1;let i=e.length-2,r=n.length-1;for(;i>=0&&r>=0;)Kr(e[i],n[r])&&(i-=1),r-=1;return-1===i}function Qr(e,t,n){const i=[];for(const{selectors:r,settings:o}of e)for(const e of r)if(Xr(e,t,n)){i.push(o);break}return i}function Yr(e,t,n,i=Gr){const r=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})),o=r.map(r=>{const o=i(e,t,{...n,theme:r.theme});return{tokens:o,state:Br(o),theme:"string"==typeof r.theme?r.theme:r.theme.name}}),s=function(...e){const t=e.map(()=>[]),n=e.length;for(let i=0;i<e[0].length;i++){const r=e.map(e=>e[i]),o=t.map(()=>[]);t.forEach((e,t)=>e.push(o[t]));const s=r.map(()=>0),a=r.map(e=>e[0]);for(;a.every(e=>e);){const e=Math.min(...a.map(e=>e.content.length));for(let t=0;t<n;t++){const n=a[t];n.content.length===e?(o[t].push(n),s[t]+=1,a[t]=r[t][s[t]]):(o[t].push({...n,content:n.content.slice(0,e)}),a[t]={...n,content:n.content.slice(e),offset:n.offset+e})}}}return t}(...o.map(e=>e.tokens)),a=s[0].map((e,t)=>e.map((e,i)=>{const o={content:e.content,variants:{},offset:e.offset};return"includeExplanation"in n&&n.includeExplanation&&(o.explanation=e.explanation),s.forEach((e,n)=>{const{content:s,explanation:a,offset:l,...d}=e[t][i];o.variants[r[n].color]=d}),o})),l=o[0].state?new $r(Object.fromEntries(o.map(e=>{var t;return[e.theme,null==(t=e.state)?void 0:t.getInternalStack(e.theme)]})),o[0].state.lang):void 0;return l&&Fr(a,l),a}const Jr=/\s+/g;function Zr(e,t){var n;if(!t)return e;e.properties||(e.properties={}),(n=e.properties).class||(n.class=[]),"string"==typeof e.properties.class&&(e.properties.class=e.properties.class.split(Jr)),Array.isArray(e.properties.class)||(e.properties.class=[]);const i=Array.isArray(t)?t:t.split(Jr);for(const r of i)r&&!e.properties.class.includes(r)&&e.properties.class.push(r);return e}const eo=/:?lang=["']([^"']+)["']/g,to=/(?:```|~~~)([\w-]+)/g,no=/\\begin\{([\w-]+)\}/g,io=/<script\s+(?:type|lang)=["']([^"']+)["']/gi,ro=["color","background-color"];function oo(e){const t={};if(e.color&&(t.color=e.color),e.bgColor&&(t["background-color"]=e.bgColor),e.fontStyle){e.fontStyle&bi.Italic&&(t["font-style"]="italic"),e.fontStyle&bi.Bold&&(t["font-weight"]="bold");const n=[];e.fontStyle&bi.Underline&&n.push("underline"),e.fontStyle&bi.Strikethrough&&n.push("line-through"),n.length&&(t["text-decoration"]=n.join(" "))}return t}function so(e){return"string"==typeof e?e:Object.entries(e).map(([e,t])=>`${e}:${t}`).join(";")}function ao(){const e=/* @__PURE__ */new WeakMap;function t(t){if(!e.has(t.meta)){let n=function(e){if("number"==typeof e){if(e<0||e>t.source.length)throw new ni(`Invalid decoration offset: ${e}. Code length: ${t.source.length}`);return{...i.indexToPos(e),offset:e}}{const t=i.lines[e.line];if(void 0===t)throw new ni(`Invalid decoration position ${JSON.stringify(e)}. Lines length: ${i.lines.length}`);let n=e.character;if(n<0&&(n=t.length+n),n<0||n>t.length)throw new ni(`Invalid decoration position ${JSON.stringify(e)}. Line ${e.line} length: ${t.length}`);return{...e,character:n,offset:i.posToIndex(e.line,n)}}};const i=function(e){const t=Er(e,!0).map(([e])=>e);return{lines:t,indexToPos:function(n){if(n===e.length)return{line:t.length-1,character:t.at(-1).length};let i=n,r=0;for(const e of t){if(i<e.length)break;i-=e.length,r++}return{line:r,character:i}},posToIndex:function(e,n){let i=0;for(let r=0;r<e;r++)i+=t[r].length;return i+=n,i}}}(t.source),r=(t.options.decorations||[]).map(e=>({...e,start:n(e.start),end:n(e.end)}));!function(e){for(let t=0;t<e.length;t++){const n=e[t];if(n.start.offset>n.end.offset)throw new ni(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let i=t+1;i<e.length;i++){const t=e[i],r=n.start.offset<=t.start.offset&&t.start.offset<n.end.offset,o=n.start.offset<t.end.offset&&t.end.offset<=n.end.offset,s=t.start.offset<=n.start.offset&&n.start.offset<t.end.offset,a=t.start.offset<n.end.offset&&n.end.offset<=t.end.offset;if(r||o||s||a){if(r&&o)continue;if(s&&a)continue;if(s&&n.start.offset===n.end.offset)continue;if(o&&t.start.offset===t.end.offset)continue;throw new ni(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(t.start)} intersect.`)}}}}(r),e.set(t.meta,{decorations:r,converter:i,source:t.source})}return e.get(t.meta)}return{name:"shiki:decorations",tokens(e){var n;if(null==(n=this.options.decorations)?void 0:n.length)return function(e,t){const n=[...t instanceof Set?t:new Set(t)].sort((e,t)=>e-t);return n.length?e.map(e=>e.flatMap(e=>{const t=n.filter(t=>e.offset<t&&t<e.offset+e.content.length).map(t=>t-e.offset).sort((e,t)=>e-t);return t.length?function(e,t){let n=0;const i=[];for(const r of t)r>n&&i.push({...e,content:e.content.slice(n,r),offset:e.offset+n}),n=r;return n<e.content.length&&i.push({...e,content:e.content.slice(n),offset:e.offset+n}),i}(e,t):e})):e}(e,t(this).decorations.flatMap(e=>[e.start.offset,e.end.offset]))},code(e){var n;if(!(null==(n=this.options.decorations)?void 0:n.length))return;const i=t(this),r=[...e.children].filter(e=>"element"===e.type&&"span"===e.tagName);if(r.length!==i.converter.lines.length)throw new ni(`Number of lines in code element (${r.length}) does not match the number of lines in the source (${i.converter.lines.length}). Failed to apply decorations.`);function o(e,t,n,i){const o=r[e];let s="",l=-1,d=-1;if(0===t&&(l=0),0===n&&(d=0),n===Number.POSITIVE_INFINITY&&(d=o.children.length),-1===l||-1===d)for(let r=0;r<o.children.length;r++)s+=lo(o.children[r]),-1===l&&s.length===t&&(l=r+1),-1===d&&s.length===n&&(d=r+1);if(-1===l)throw new ni(`Failed to find start index for decoration ${JSON.stringify(i.start)}`);if(-1===d)throw new ni(`Failed to find end index for decoration ${JSON.stringify(i.end)}`);const c=o.children.slice(l,d);if(i.alwaysWrap||c.length!==o.children.length)if(i.alwaysWrap||1!==c.length||"element"!==c[0].type){const e={type:"element",tagName:"span",properties:{},children:c};a(e,i,"wrapper"),o.children.splice(l,c.length,e)}else a(c[0],i,"token");else a(o,i,"line")}function s(e,t){r[e]=a(r[e],t,"line")}function a(e,t,n){var i;const r=t.properties||{},o=t.transform||(e=>e);return e.tagName=t.tagName||"span",e.properties={...e.properties,...r,class:e.properties.class},(null==(i=t.properties)?void 0:i.class)&&Zr(e,t.properties.class),o(e,n)||e}const l=[],d=i.decorations.sort((e,t)=>t.start.offset-e.start.offset||e.end.offset-t.end.offset);for(const t of d){const{start:e,end:n}=t;if(e.line===n.line)o(e.line,e.character,n.character,t);else if(e.line<n.line){o(e.line,e.character,Number.POSITIVE_INFINITY,t);for(let i=e.line+1;i<n.line;i++)l.unshift(()=>s(i,t));o(n.line,0,n.character,t)}}l.forEach(e=>e())}}}function lo(e){return"text"===e.type?e.value:"element"===e.type?e.children.map(lo).join(""):""}const co=[/* @__PURE__ */ao()];function uo(e){const t=function(e){const t=[],n=[],i=[];for(const r of e)switch(r.enforce){case"pre":t.push(r);break;case"post":n.push(r);break;default:i.push(r)}return{pre:t,post:n,normal:i}}(e.transformers||[]);return[...t.pre,...t.normal,...t.post,...co]}var ho=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],fo={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",8:"hidden",9:"strikethrough"};function po(e,t){const n=e.indexOf("",t);if(-1!==n&&"["===e[n+1]){const t=e.indexOf("m",n);if(-1!==t)return{sequence:e.substring(n+2,t).split(";"),startPosition:n,position:t+1}}return{position:e.length}}function mo(e){const t=e.shift();if("2"===t){const t=e.splice(0,3).map(e=>Number.parseInt(e));if(3!==t.length||t.some(e=>Number.isNaN(e)))return;return{type:"rgb",rgb:t}}if("5"===t){const t=e.shift();if(t)return{type:"table",index:Number(t)}}}function go(e){const t=[];for(;e.length>0;){const n=e.shift();if(!n)continue;const i=Number.parseInt(n);if(!Number.isNaN(i))if(0===i)t.push({type:"resetAll"});else if(i<=9)fo[i]&&t.push({type:"setDecoration",value:fo[i]});else if(i<=29){const e=fo[i-20];e&&(t.push({type:"resetDecoration",value:e}),"dim"===e&&t.push({type:"resetDecoration",value:"bold"}))}else if(i<=37)t.push({type:"setForegroundColor",value:{type:"named",name:ho[i-30]}});else if(38===i){const n=mo(e);n&&t.push({type:"setForegroundColor",value:n})}else if(39===i)t.push({type:"resetForegroundColor"});else if(i<=47)t.push({type:"setBackgroundColor",value:{type:"named",name:ho[i-40]}});else if(48===i){const n=mo(e);n&&t.push({type:"setBackgroundColor",value:n})}else 49===i?t.push({type:"resetBackgroundColor"}):53===i?t.push({type:"setDecoration",value:"overline"}):55===i?t.push({type:"resetDecoration",value:"overline"}):i>=90&&i<=97?t.push({type:"setForegroundColor",value:{type:"named",name:ho[i-90+8]}}):i>=100&&i<=107&&t.push({type:"setBackgroundColor",value:{type:"named",name:ho[i-100+8]}})}return t}var vo={black:"#000000",red:"#bb0000",green:"#00bb00",yellow:"#bbbb00",blue:"#0000bb",magenta:"#ff00ff",cyan:"#00bbbb",white:"#eeeeee",brightBlack:"#555555",brightRed:"#ff5555",brightGreen:"#00ff00",brightYellow:"#ffff55",brightBlue:"#5555ff",brightMagenta:"#ff55ff",brightCyan:"#55ffff",brightWhite:"#ffffff"};function bo(e=vo){function t(t){return e[t]}function n(e){return`#${e.map(e=>Math.max(0,Math.min(e,255)).toString(16).padStart(2,"0")).join("")}`}let i;return{value:function(e){switch(e.type){case"named":return t(e.name);case"rgb":return n(e.rgb);case"table":return r=e.index,function(){if(i)return i;i=[];for(let n=0;n<ho.length;n++)i.push(t(ho[n]));let e=[0,95,135,175,215,255];for(let t=0;t<6;t++)for(let r=0;r<6;r++)for(let o=0;o<6;o++)i.push(n([e[t],e[r],e[o]]));let r=8;for(let t=0;t<24;t++,r+=10)i.push(n([r,r,r]));return i}()[r]}var r}}}const yo=/#([0-9a-f]{3,8})/i,Co=/var\((--[\w-]+-ansi-[\w-]+)\)/,So={black:"#000000",red:"#cd3131",green:"#0DBC79",yellow:"#E5E510",blue:"#2472C8",magenta:"#BC3FBC",cyan:"#11A8CD",white:"#E5E5E5",brightBlack:"#666666",brightRed:"#F14C4C",brightGreen:"#23D18B",brightYellow:"#F5F543",brightBlue:"#3B8EEA",brightMagenta:"#D670D6",brightCyan:"#29B8DB",brightWhite:"#FFFFFF"};function ko(e,t,n={}){const i=e.resolveLangAlias(n.lang||"text"),{theme:r=e.getLoadedThemes()[0]}=n;if(!wr(i)&&!Tr(r)&&"ansi"===i){const{theme:i}=e.setTheme(r);return function(e,t,n){const i=Sr(e,n),r=Er(t),o=bo(Object.fromEntries(ho.map(t=>{var n;const i=`terminal.ansi${t[0].toUpperCase()}${t.substring(1)}`;return[t,(null==(n=e.colors)?void 0:n[i])||So[t]]}))),s=function(){let e=null,t=null,n=/* @__PURE__ */new Set;return{parse(i){const r=[];let o=0;do{const s=po(i,o),a=s.sequence?i.substring(o,s.startPosition):i.substring(o);if(a.length>0&&r.push({value:a,foreground:e,background:t,decorations:new Set(n)}),s.sequence){const i=go(s.sequence);for(const r of i)"resetAll"===r.type?(e=null,t=null,n.clear()):"resetForegroundColor"===r.type?e=null:"resetBackgroundColor"===r.type?t=null:"resetDecoration"===r.type&&n.delete(r.value);for(const r of i)"setForegroundColor"===r.type?e=r.value:"setBackgroundColor"===r.type?t=r.value:"setDecoration"===r.type&&n.add(r.value)}o=s.position}while(o<i.length);return r}}}();return r.map(t=>s.parse(t[0]).map(n=>{let r,s;n.decorations.has("reverse")?(r=n.background?o.value(n.background):e.bg,s=n.foreground?o.value(n.foreground):e.fg):(r=n.foreground?o.value(n.foreground):e.fg,s=n.background?o.value(n.background):void 0),r=kr(r,i),s=kr(s,i),n.decorations.has("dim")&&(r=function(e){const t=e.match(yo);if(t){const e=t[1];if(8===e.length){const t=Math.round(Number.parseInt(e.slice(6,8),16)/2).toString(16).padStart(2,"0");return`#${e.slice(0,6)}${t}`}if(6===e.length)return`#${e}80`;if(4===e.length){const t=e[0],n=e[1],i=e[2],r=e[3];return`#${t}${t}${n}${n}${i}${i}${Math.round(Number.parseInt(`${r}${r}`,16)/2).toString(16).padStart(2,"0")}`}if(3===e.length){const t=e[0],n=e[1],i=e[2];return`#${t}${t}${n}${n}${i}${i}80`}}const n=e.match(Co);return n?`var(${n[1]}-dim)`:e}(r));let a=bi.None;return n.decorations.has("bold")&&(a|=bi.Bold),n.decorations.has("italic")&&(a|=bi.Italic),n.decorations.has("underline")&&(a|=bi.Underline),n.decorations.has("strikethrough")&&(a|=bi.Strikethrough),{content:n.value,offset:t[1],color:r,bgColor:s,fontStyle:a}}))}(i,t,n)}return Gr(e,t,n)}function xo(e,t,n){let i,r,o,s,a,l;if("themes"in n){const{defaultColor:d="light",cssVariablePrefix:c="--shiki-",colorsRendering:u="css-vars"}=n,h=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})).sort((e,t)=>e.color===d?-1:t.color===d?1:0);if(0===h.length)throw new ni("`themes` option must not be empty");const f=Yr(e,t,n,ko);if(l=Br(f),d&&"light-dark()"!==d&&!h.some(e=>e.color===d))throw new ni(`\`themes\` option must contain the defaultColor key \`${d}\``);const p=h.map(t=>e.getTheme(t.theme)),m=h.map(e=>e.color);o=f.map(e=>e.map(e=>function(e,t,n,i,r="css-vars"){const o={content:e.content,explanation:e.explanation,offset:e.offset},s=t.map(t=>oo(e.variants[t])),a=new Set(s.flatMap(e=>Object.keys(e))),l={},d=(e,i)=>{const r="color"===i?"":"background-color"===i?"-bg":`-${i}`;return n+t[e]+("color"===i?"":r)};return s.forEach((e,n)=>{for(const o of a){const a=e[o]||"inherit";if(0===n&&i&&ro.includes(o))if("light-dark()"===i&&s.length>1){const e=t.findIndex(e=>"light"===e),i=t.findIndex(e=>"dark"===e);if(-1===e||-1===i)throw new ni('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');l[o]=`light-dark(${s[e][o]||"inherit"}, ${s[i][o]||"inherit"})`,"css-vars"===r&&(l[d(n,o)]=a)}else l[o]=a;else"css-vars"===r&&(l[d(n,o)]=a)}}),o.htmlStyle=l,o}(e,m,c,d,u))),l&&Fr(o,l);const g=h.map(e=>Sr(e.theme,n));r=wo(h,p,g,c,d,"fg",u),i=wo(h,p,g,c,d,"bg",u),s=`shiki-themes ${p.map(e=>e.name).join(" ")}`,a=d?void 0:[r,i].join(";")}else{if(!("theme"in n))throw new ni("Invalid options, either `theme` or `themes` must be provided");{const a=Sr(n.theme,n);o=ko(e,t,n);const d=e.getTheme(n.theme);i=kr(d.bg,a),r=kr(d.fg,a),s=d.name,l=Br(o)}}return{tokens:o,fg:r,bg:i,themeName:s,rootStyle:a,grammarState:l}}function wo(e,t,n,i,r,o,s){return e.map((a,l)=>{const d=kr(t[l][o],n[l])||"inherit",c=`${i+a.color}${"bg"===o?"-bg":""}:${d}`;if(0===l&&r){if("light-dark()"===r&&e.length>1){const i=e.findIndex(e=>"light"===e.color),r=e.findIndex(e=>"dark"===e.color);if(-1===i||-1===r)throw new ni('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');return`light-dark(${kr(t[i][o],n[i])||"inherit"}, ${kr(t[r][o],n[r])||"inherit"});${c}`}return d}return"css-vars"===s?c:null}).filter(e=>!!e).join(";")}const Lo=/^\s+$/,To=/^(\s*)(.*?)(\s*)$/;function Ao(e,t,n,i={meta:{},options:n,codeToHast:(t,n)=>Ao(e,t,n),codeToTokens:(t,n)=>xo(e,t,n)}){var r,o,s;let a=t;for(const v of uo(n))a=(null==(r=v.preprocess)?void 0:r.call(i,a,n))||a;let{tokens:l,fg:d,bg:c,themeName:u,rootStyle:h,grammarState:f}=xo(e,a,n);const{mergeWhitespaces:p=!0,mergeSameStyleTokens:m=!1}=n;!0===p?l=function(e){return e.map(e=>{const t=[];let n,i="";return e.forEach((r,o)=>{const s=!(r.fontStyle&&(r.fontStyle&bi.Underline||r.fontStyle&bi.Strikethrough));s&&Lo.test(r.content)&&e[o+1]?(void 0===n&&(n=r.offset),i+=r.content):i?(s?t.push({...r,offset:n,content:i+r.content}):t.push({content:i,offset:n},r),n=void 0,i=""):t.push(r)}),t})}(l):"never"===p&&(l=function(e){return e.map(e=>e.flatMap(e=>{if(Lo.test(e.content))return e;const t=e.content.match(To);if(!t)return e;const[,n,i,r]=t;if(!n&&!r)return e;const o=[{...e,offset:e.offset+n.length,content:i}];return n&&o.unshift({content:n,offset:e.offset}),r&&o.push({content:r,offset:e.offset+n.length+i.length}),o}))}(l)),m&&(l=function(e){return e.map(e=>{const t=[];for(const n of e){if(0===t.length){t.push({...n});continue}const e=t.at(-1),i=so(e.htmlStyle||oo(e)),r=so(n.htmlStyle||oo(n)),o=e.fontStyle&&(e.fontStyle&bi.Underline||e.fontStyle&bi.Strikethrough),s=n.fontStyle&&(n.fontStyle&bi.Underline||n.fontStyle&bi.Strikethrough);o||s||i!==r?t.push({...n}):e.content+=n.content}return t})}(l));const g={...i,get source(){return a}};for(const v of uo(n))l=(null==(o=v.tokens)?void 0:o.call(g,l))||l;return function(e,t,n,i=Br(e)){var r,o,s,a;const l=uo(t),d=[],c={type:"root",children:[]},{structure:u="classic",tabindex:h="0"}=t,f={class:`shiki ${t.themeName||""}`};!1!==t.rootStyle&&(null!=t.rootStyle?f.style=t.rootStyle:f.style=`background-color:${t.bg};color:${t.fg}`),!1!==h&&null!=h&&(f.tabindex=h.toString());for(const[y,C]of Object.entries(t.meta||{}))y.startsWith("_")||(f[y]=C);let p={type:"element",tagName:"pre",properties:f,children:[],data:t.data},m={type:"element",tagName:"code",properties:{},children:d};const g=[],v={...n,structure:u,addClassToHast:Zr,get source(){return n.source},get tokens(){return e},get options(){return t},get root(){return c},get pre(){return p},get code(){return m},get lines(){return g}};if(e.forEach((e,t)=>{var n,i;t&&("inline"===u?c.children.push({type:"element",tagName:"br",properties:{},children:[]}):"classic"===u&&d.push({type:"text",value:"\n"}));let r={type:"element",tagName:"span",properties:{class:"line"},children:[]},o=0;for(const s of e){let e={type:"element",tagName:"span",properties:{...s.htmlAttrs},children:[{type:"text",value:s.content}]};const i=so(s.htmlStyle||oo(s));i&&(e.properties.style=i);for(const a of l)e=(null==(n=null==a?void 0:a.span)?void 0:n.call(v,e,t+1,o,r,s))||e;"inline"===u?c.children.push(e):"classic"===u&&r.children.push(e),o+=s.content.length}if("classic"===u){for(const e of l)r=(null==(i=null==e?void 0:e.line)?void 0:i.call(v,r,t+1))||r;g.push(r),d.push(r)}else"inline"===u&&g.push(r)}),"classic"===u){for(const e of l)m=(null==(r=null==e?void 0:e.code)?void 0:r.call(v,m))||m;p.children.push(m);for(const e of l)p=(null==(o=null==e?void 0:e.pre)?void 0:o.call(v,p))||p;c.children.push(p)}else if("inline"===u){const e=[];let t={type:"element",tagName:"span",properties:{class:"line"},children:[]};for(const i of c.children)"element"===i.type&&"br"===i.tagName?(e.push(t),t={type:"element",tagName:"span",properties:{class:"line"},children:[]}):"element"!==i.type&&"text"!==i.type||t.children.push(i);e.push(t);let n={type:"element",tagName:"code",properties:{},children:e};for(const i of l)n=(null==(s=null==i?void 0:i.code)?void 0:s.call(v,n))||n;c.children=[];for(let i=0;i<n.children.length;i++){i>0&&c.children.push({type:"element",tagName:"br",properties:{},children:[]});const e=n.children[i];"element"===e.type&&c.children.push(...e.children)}}let b=c;for(const y of l)b=(null==(a=null==y?void 0:y.root)?void 0:a.call(v,b))||b;return i&&Fr(b,i),b}(l,{...n,fg:d,bg:c,themeName:u,rootStyle:!1!==n.rootStyle&&(null!=(s=n.rootStyle)?s:h)},g,f)}const Io=Qt;async function Eo(e){const t=await async function(e){e.engine||console.warn("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");const[t,n,i]=await Promise.all([Nr(e.themes||[]),Pr(e.langs||[]),e.engine]);return function(e){Or+=1,!1!==e.warnings&&Or>=10&&Or%10==0&&console.warn(`[Shiki] ${Or} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let t=!1;if(!e.engine)throw new ni("`engine` option is required for synchronous mode");const n=(e.langs||[]).flat(1),i=(e.themes||[]).flat(1).map(Rr),r=new Hr(new _r(e.engine,n),i,n,e.langAlias);let o;function s(e){if("none"===e)return{bg:"",fg:"",name:"none",settings:[],type:"dark"};d();const t=r.getTheme(e);if(!t)throw new ni(`Theme \`${e}\` not found, you may need to load it first`);return t}function a(...e){d(),r.loadLanguages(e.flat(1))}function l(...e){d();for(const t of e.flat(1))r.loadTheme(t)}function d(){if(t)throw new ni("Shiki instance has been disposed")}function c(){t||(t=!0,r.dispose(),Or-=1)}return{setTheme:function(e){d();const t=s(e);return o!==e&&(r.setTheme(t),o=e),{theme:t,colorMap:r.getColorMap()}},getTheme:s,getLanguage:function(e){d();const t=r.getGrammar("string"==typeof e?e:e.name);if(!t)throw new ni(`Language \`${e}\` not found, you may need to load it first`);return t},getLoadedThemes:function(){return d(),r.getLoadedThemes()},getLoadedLanguages:function(){return d(),r.getLoadedLanguages()},resolveLangAlias:function(t){return Dr(t,e.langAlias)},loadLanguage:async function(...e){return a(await Pr(e))},loadLanguageSync:a,loadTheme:async function(...e){return d(),l(await Nr(e))},loadThemeSync:l,dispose:c,[Symbol.dispose]:c}}({...e,themes:t,langs:n,engine:i})}(e);return{getLastGrammarState:(...e)=>function(...e){if(2===e.length)return Br(e[1]);const[t,n,i={}]=e,{lang:r="text",theme:o=t.getLoadedThemes()[0]}=i;if(wr(r)||Tr(o))throw new ni("Plain language does not have grammar state");if("ansi"===r)throw new ni("ANSI language does not have grammar state");const{theme:s,colorMap:a}=t.setTheme(o),l=t.getLanguage(r);return new $r(Wr(n,l,s,a,i).stateStack,l.name,s.name)}(t,...e),codeToTokensBase:(e,n)=>ko(t,e,n),codeToTokensWithThemes:(e,n)=>Yr(t,e,n),codeToTokens:(e,n)=>xo(t,e,n),codeToHast:(e,n)=>Ao(t,e,n),codeToHtml:(e,n)=>function(e,t,n){var i;const r={meta:{},options:n,codeToHast:(t,n)=>Ao(e,t,n),codeToTokens:(t,n)=>xo(e,t,n)};let o=Io(Ao(e,t,n,r));for(const s of uo(n))o=(null==(i=s.postprocess)?void 0:i.call(r,o,n))||o;return o}(t,e,n),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}function Mo(e){const t=e.langs,n=e.themes,i=e.engine;return async function(e){var r,o,s;function a(n){var i;if("string"==typeof n){if(Lr(n=(null==(i=e.langAlias)?void 0:i[n])||n))return[];const r=t[n];if(!r)throw new ni(`Language \`${n}\` is not included in this bundle. You may want to load it from external source.`);return r}return n}function l(e){if(Ar(e))return"none";if("string"==typeof e){const t=n[e];if(!t)throw new ni(`Theme \`${e}\` is not included in this bundle. You may want to load it from external source.`);return t}return e}const d=(null!=(r=e.themes)?r:[]).map(e=>l(e)),c=(null!=(o=e.langs)?o:[]).map(e=>a(e)),u=await Eo({engine:null!=(s=e.engine)?s:i(),...e,themes:d,langs:c});return{...u,loadLanguage:(...e)=>u.loadLanguage(...e.map(a)),loadTheme:(...e)=>u.loadTheme(...e.map(l)),getBundledLanguages:()=>t,getBundledThemes:()=>n}}}function Ro(e,t){const n=function(e){let t;return async function(n={}){if(t){const e=await t;return await Promise.all([e.loadTheme(...n.themes||[]),e.loadLanguage(...n.langs||[])]),e}{t=e({...n,themes:[],langs:[]});const i=await t;return await Promise.all([i.loadTheme(...n.themes||[]),i.loadLanguage(...n.langs||[])]),i}}}(e);async function i(e,i){var r;const o=await n({langs:[i.lang],themes:"theme"in i?[i.theme]:Object.values(i.themes)}),s=await(null==(r=null==t?void 0:t.guessEmbeddedLanguages)?void 0:r.call(t,e,i.lang,o));return s&&await o.loadLanguage(...s),o}return{getSingletonHighlighter:e=>n(e),codeToHtml:async(e,t)=>(await i(e,t)).codeToHtml(e,t),codeToHast:async(e,t)=>(await i(e,t)).codeToHast(e,t),codeToTokens:async(e,t)=>(await i(e,t)).codeToTokens(e,t),codeToTokensBase:async(e,t)=>(await i(e,t)).codeToTokensBase(e,t),codeToTokensWithThemes:async(e,t)=>(await i(e,t)).codeToTokensWithThemes(e,t),getLastGrammarState:async(e,t)=>(await n({langs:[t.lang],themes:[t.theme]})).getLastGrammarState(e,t)}}function Po(e={}){var t;const{name:n="css-variables",variablePrefix:i="--shiki-",fontStyle:r=!0}=e,o=t=>{var n;return(null==(n=e.variableDefaults)?void 0:n[t])?`var(${i}${t}, ${e.variableDefaults[t]})`:`var(${i}${t})`},s={name:n,type:"dark",colors:{"editor.foreground":o("foreground"),"editor.background":o("background"),"terminal.ansiBlack":o("ansi-black"),"terminal.ansiRed":o("ansi-red"),"terminal.ansiGreen":o("ansi-green"),"terminal.ansiYellow":o("ansi-yellow"),"terminal.ansiBlue":o("ansi-blue"),"terminal.ansiMagenta":o("ansi-magenta"),"terminal.ansiCyan":o("ansi-cyan"),"terminal.ansiWhite":o("ansi-white"),"terminal.ansiBrightBlack":o("ansi-bright-black"),"terminal.ansiBrightRed":o("ansi-bright-red"),"terminal.ansiBrightGreen":o("ansi-bright-green"),"terminal.ansiBrightYellow":o("ansi-bright-yellow"),"terminal.ansiBrightBlue":o("ansi-bright-blue"),"terminal.ansiBrightMagenta":o("ansi-bright-magenta"),"terminal.ansiBrightCyan":o("ansi-bright-cyan"),"terminal.ansiBrightWhite":o("ansi-bright-white")},tokenColors:[{scope:["keyword.operator.accessor","meta.group.braces.round.function.arguments","meta.template.expression","markup.fenced_code meta.embedded.block"],settings:{foreground:o("foreground")}},{scope:"emphasis",settings:{fontStyle:"italic"}},{scope:["strong","markup.heading.markdown","markup.bold.markdown"],settings:{fontStyle:"bold"}},{scope:["markup.italic.markdown"],settings:{fontStyle:"italic"}},{scope:"meta.link.inline.markdown",settings:{fontStyle:"underline",foreground:o("token-link")}},{scope:["string","markup.fenced_code","markup.inline"],settings:{foreground:o("token-string")}},{scope:["comment","string.quoted.docstring.multi"],settings:{foreground:o("token-comment")}},{scope:["constant.numeric","constant.language","constant.other.placeholder","constant.character.format.placeholder","variable.language.this","variable.other.object","variable.other.class","variable.other.constant","meta.property-name","meta.property-value","support"],settings:{foreground:o("token-constant")}},{scope:["keyword","storage.modifier","storage.type","storage.control.clojure","entity.name.function.clojure","entity.name.tag.yaml","support.function.node","support.type.property-name.json","punctuation.separator.key-value","punctuation.definition.template-expression"],settings:{foreground:o("token-keyword")}},{scope:"variable.parameter.function",settings:{foreground:o("token-parameter")}},{scope:["support.function","entity.name.type","entity.other.inherited-class","meta.function-call","meta.instance.constructor","entity.other.attribute-name","entity.name.function","constant.keyword.clojure"],settings:{foreground:o("token-function")}},{scope:["entity.name.tag","string.quoted","string.regexp","string.interpolated","string.template","string.unquoted.plain.out.yaml","keyword.other.template"],settings:{foreground:o("token-string-expression")}},{scope:["punctuation.definition.arguments","punctuation.definition.dict","punctuation.separator","meta.function-call.arguments"],settings:{foreground:o("token-punctuation")}},{scope:["markup.underline.link","punctuation.definition.metadata.markdown"],settings:{foreground:o("token-link")}},{scope:["beginning.punctuation.definition.list.markdown"],settings:{foreground:o("token-string")}},{scope:["punctuation.definition.string.begin.markdown","punctuation.definition.string.end.markdown","string.other.link.title.markdown","string.other.link.description.markdown"],settings:{foreground:o("token-keyword")}},{scope:["markup.inserted","meta.diff.header.to-file","punctuation.definition.inserted"],settings:{foreground:o("token-inserted")}},{scope:["markup.deleted","meta.diff.header.from-file","punctuation.definition.deleted"],settings:{foreground:o("token-deleted")}},{scope:["markup.changed","punctuation.definition.changed"],settings:{foreground:o("token-changed")}}]};return r||(s.tokenColors=null==(t=s.tokenColors)?void 0:t.map(e=>{var t;return(null==(t=e.settings)?void 0:t.fontStyle)&&delete e.settings.fontStyle,e})),s}var No=/* @__PURE__ */Rn({bundledLanguages:()=>_n,bundledLanguagesAlias:()=>Hn,bundledLanguagesBase:()=>Dn,bundledLanguagesInfo:()=>Nn,bundledThemes:()=>jn,bundledThemesInfo:()=>On,codeToHast:()=>_o,codeToHtml:()=>Ho,codeToTokens:()=>Oo,codeToTokensBase:()=>jo,codeToTokensWithThemes:()=>Fo,createHighlighter:()=>Do,getLastGrammarState:()=>$o,getSingletonHighlighter:()=>Bo});const Do=/* @__PURE__ */Mo({langs:_n,themes:jn,engine:()=>(0,ti.createOnigurumaEngine)(import("./wasm--yL7jHw-.js"))}),{codeToHtml:Ho,codeToHast:_o,codeToTokens:Oo,codeToTokensBase:jo,codeToTokensWithThemes:Fo,getSingletonHighlighter:Bo,getLastGrammarState:$o}=/* @__PURE__ */Ro(Do,{guessEmbeddedLanguages:function(e,t,n){const i=/* @__PURE__ */new Set;for(const o of e.matchAll(eo)){const e=o[1].toLowerCase().trim();e&&i.add(e)}for(const o of e.matchAll(to)){const e=o[1].toLowerCase().trim();e&&i.add(e)}for(const o of e.matchAll(no)){const e=o[1].toLowerCase().trim();e&&i.add(e)}for(const o of e.matchAll(io)){const e=o[1].toLowerCase().trim(),t=e.includes("/")?e.split("/").pop():e;t&&i.add(t)}if(!n)return[...i];const r=n.getBundledLanguages();return[...i].filter(e=>e&&r[e])}}),zo=4294967295;var Uo=class{constructor(e,t={}){y(this,"patterns"),y(this,"options"),y(this,"regexps"),this.patterns=e,this.options=t;const{forgiving:n=!1,cache:i,regexConstructor:r}=t;if(!r)throw new Error("Option `regexConstructor` is not provided");this.regexps=e.map(e=>{if("string"!=typeof e)return e;const t=null==i?void 0:i.get(e);if(t){if(t instanceof RegExp)return t;if(n)return null;throw t}try{const t=r(e);return null==i||i.set(e,t),t}catch(o){if(null==i||i.set(e,o),n)return null;throw o}})}findNextMatchSync(e,t,n){const i="string"==typeof e?e:e.content,r=[];function o(e,t,n=0){return{index:e,captureIndices:t.indices.map(e=>null==e?{start:zo,end:zo,length:0}:{start:e[0]+n,end:e[1]+n,length:e[1]-e[0]})}}for(let a=0;a<this.regexps.length;a++){const e=this.regexps[a];if(e)try{e.lastIndex=t;const n=e.exec(i);if(!n)continue;if(n.index===t)return o(a,n,0);r.push([a,n,0])}catch(s){if(this.options.forgiving)continue;throw s}}if(r.length){const e=Math.min(...r.map(e=>e[1].index));for(const[t,n,i]of r)if(n.index===e)return o(t,n,i)}return null}};function Go(e){if(1!==[...e].length)throw new Error(`Expected "${e}" to be a single code point`);return e.codePointAt(0)}const Wo=/* @__PURE__ */new Set(["alnum","alpha","ascii","blank","cntrl","digit","graph","lower","print","punct","space","upper","word","xdigit"]),Vo=String.raw;function qo(e,t){if(null==e)throw new Error(null!=t?t:"Value expected");return e}const Ko=Vo`\[\^?`,Xo=`c.? | C(?:-.?)?|${Vo`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${Vo`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${Vo`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${Vo`o\{[^\}]*\}?`}|${Vo`\d{1,3}`}`,Qo=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,Yo=new RegExp(Vo`
2
- \\ (?:
3
- ${Xo}
4
- | [gk]<[^>]*>?
5
- | [gk]'[^']*'?
6
- | .
7
- )
8
- | \( (?:
9
- \? (?:
10
- [:=!>({]
11
- | <[=!]
12
- | <[^>]*>
13
- | '[^']*'
14
- | ~\|?
15
- | #(?:[^)\\]|\\.?)*
16
- | [^:)]*[:)]
17
- )?
18
- | \*[^\)]*\)?
19
- )?
20
- | (?:${Qo.source})+
21
- | ${Ko}
22
- | .
23
- `.replace(/\s+/g,""),"gsu"),Jo=new RegExp(Vo`
24
- \\ (?:
25
- ${Xo}
26
- | .
27
- )
28
- | \[:(?:\^?\p{Alpha}+|\^):\]
29
- | ${Ko}
30
- | &&
31
- | .
32
- `.replace(/\s+/g,""),"gsu");function Zo(e,t,n,i){const[r,o]=n;if("["===n||"[^"===n){const e=function(e,t,n){const i=[as("^"===t[1],t)];let r,o=1;for(Jo.lastIndex=n;r=Jo.exec(e);){const e=r[0];if("["===e[0]&&":"!==e[1])o++,i.push(as("^"===e[1],e));else if("]"===e){if("CharacterClassOpen"===i.at(-1).type)i.push(os(93,e));else if(o--,i.push(ss(e)),!o)break}else{const t=es(e);Array.isArray(t)?i.push(...t):i.push(t)}}return{tokens:i,lastIndex:Jo.lastIndex||e.length}}(t,n,i);return{tokens:e.tokens,lastIndex:e.lastIndex}}if("\\"===r){if("AbBGyYzZ".includes(o))return{token:is(n,n)};if(/^\\g[<']/.test(n)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(n))throw new Error(`Invalid group name "${n}"`);return{token:hs(n)}}if(/^\\k[<']/.test(n)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(n))throw new Error(`Invalid group name "${n}"`);return{token:rs(n)}}if("K"===o)return{token:ds("keep",n)};if("N"===o||"R"===o)return{token:ls("newline",n,{negate:"N"===o})};if("O"===o)return{token:ls("any",n)};if("X"===o)return{token:ls("text_segment",n)};const e=ts(n,{inCharClass:!1});return Array.isArray(e)?{tokens:e}:{token:e}}if("("===r){if("*"===o)return{token:gs(n)};if("(?{"===n)throw new Error(`Unsupported callout "${n}"`);if(n.startsWith("(?#")){if(")"!==t[i])throw new Error('Unclosed comment group "(?#"');return{lastIndex:i+1}}if(/^\(\?[-imx]+[:)]$/.test(n))return{token:ms(n,e)};if(e.pushModX(e.getCurrentModX()),e.numOpenGroups++,"("===n&&!e.captureGroup||"(?:"===n)return{token:us("group",n)};if("(?>"===n)return{token:us("atomic",n)};if("(?="===n||"(?!"===n||"(?<="===n||"(?<!"===n)return{token:us("<"===n[2]?"lookbehind":"lookahead",n,{negate:n.endsWith("!")})};if("("===n&&e.captureGroup||n.startsWith("(?<")&&n.endsWith(">")||n.startsWith("(?'")&&n.endsWith("'"))return{token:us("capturing",n,{..."("!==n&&{name:n.slice(3,-1)}})};if(n.startsWith("(?~")){if("(?~|"===n)throw new Error(`Unsupported absence function kind "${n}"`);return{token:us("absence_repeater",n)}}throw"(?("===n?new Error(`Unsupported conditional "${n}"`):new Error(`Invalid or unsupported group option "${n}"`)}if(")"===n){if(e.popModX(),e.numOpenGroups--,e.numOpenGroups<0)throw new Error('Unmatched ")"');return{token:cs(n)}}if(e.getCurrentModX()){if("#"===n){const e=t.indexOf("\n",i);return{lastIndex:-1===e?t.length:e}}if(/^\s$/.test(n)){const e=/\s+/y;return e.lastIndex=i,{lastIndex:e.exec(t)?e.lastIndex:i}}}return"."===n?{token:ls("dot",n)}:"^"===n||"$"===n?{token:is(e.singleline?{"^":Vo`\A`,$:Vo`\Z`}[n]:n,n)}:"|"===n?{token:ns(n)}:Qo.test(n)?{tokens:ys(n)}:{token:os(Go(n),n)}}function es(e){if("\\"===e[0])return ts(e,{inCharClass:!0});if("["===e[0]){const t=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(e);if(!t||!Wo.has(t.groups.name))throw new Error(`Invalid POSIX class "${e}"`);return ls("posix",e,{value:t.groups.name,negate:!!t.groups.negate})}return"-"===e?function(e){return{type:"CharacterClassHyphen",raw:e}}(e):"&&"===e?function(e){return{type:"CharacterClassIntersector",raw:e}}(e):os(Go(e),e)}function ts(e,{inCharClass:t}){const n=e[1];if("c"===n||"C"===n)return function(e){const t="c"===e[1]?e[2]:e[3];if(!t||!/[A-Za-z]/.test(t))throw new Error(`Unsupported control character "${e}"`);return os(Go(t.toUpperCase())-64,e)}(e);if("dDhHsSwW".includes(n))return function(e){const t=e[1].toLowerCase();return ls({d:"digit",h:"hex",s:"space",w:"word"}[t],e,{negate:e[1]!==t})}(e);if(e.startsWith(Vo`\o{`))throw new Error(`Incomplete, invalid, or unsupported octal code point "${e}"`);if(/^\\[pP]\{/.test(e)){if(3===e.length)throw new Error(`Incomplete or invalid Unicode property "${e}"`);return function(e){const{p:t,neg:n,value:i}=/^\\(?<p>[pP])\{(?<neg>\^?)(?<value>[^}]+)/.exec(e).groups;return ls("property",e,{value:i,negate:"P"===t&&!n||"p"===t&&!!n})}(e)}if(/^\\x[89A-Fa-f]\p{AHex}/u.test(e))try{const t=e.split(/\\x/).slice(1).map(e=>parseInt(e,16)),n=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}).decode(new Uint8Array(t)),i=new TextEncoder;return[...n].map(e=>{const t=[...i.encode(e)].map(e=>`\\x${e.toString(16)}`).join("");return os(Go(e),t)})}catch{throw new Error(`Multibyte code "${e}" incomplete or invalid in Oniguruma`)}if("u"===n||"x"===n)return os(function(e){if(/^(?:\\u(?!\p{AHex}{4})|\\x(?!\p{AHex}{1,2}|\{\p{AHex}{1,8}\}))/u.test(e))throw new Error(`Incomplete or invalid escape "${e}"`);const t="{"===e[2]?/^\\x\{\s*(?<hex>\p{AHex}+)/u.exec(e).groups.hex:e.slice(2);return parseInt(t,16)}(e),e);if(ps.has(n))return os(ps.get(n),e);if(/\d/.test(n))return function(e,t){return{type:"EscapedNumber",inCharClass:e,raw:t}}(t,e);if("\\"===e)throw new Error(Vo`Incomplete escape "\"`);if("M"===n)throw new Error(`Unsupported meta "${e}"`);if(2===[...e].length)return os(e.codePointAt(1),e);throw new Error(`Unexpected escape "${e}"`)}function ns(e){return{type:"Alternator",raw:e}}function is(e,t){return{type:"Assertion",kind:e,raw:t}}function rs(e){return{type:"Backreference",raw:e}}function os(e,t){return{type:"Character",value:e,raw:t}}function ss(e){return{type:"CharacterClassClose",raw:e}}function as(e,t){return{type:"CharacterClassOpen",negate:e,raw:t}}function ls(e,t,n={}){return{type:"CharacterSet",kind:e,...n,raw:t}}function ds(e,t,n={}){return"keep"===e?{type:"Directive",kind:e,raw:t}:{type:"Directive",kind:e,flags:qo(n.flags),raw:t}}function cs(e){return{type:"GroupClose",raw:e}}function us(e,t,n={}){return{type:"GroupOpen",kind:e,...n,raw:t}}function hs(e){return{type:"Subroutine",raw:e}}const fs=/* @__PURE__ */new Set(["COUNT","CMP","ERROR","FAIL","MAX","MISMATCH","SKIP","TOTAL_COUNT"]),ps=/* @__PURE__ */new Map([["a",7],["b",8],["e",27],["f",12],["n",10],["r",13],["t",9],["v",11]]);function ms(e,t){let{on:n,off:i}=/^\(\?(?<on>[imx]*)(?:-(?<off>[-imx]*))?/.exec(e).groups;null!=i||(i="");const r=(t.getCurrentModX()||n.includes("x"))&&!i.includes("x"),o=bs(n),s=bs(i),a={};if(o&&(a.enable=o),s&&(a.disable=s),e.endsWith(")"))return t.replaceCurrentModX(r),ds("flags",e,{flags:a});if(e.endsWith(":"))return t.pushModX(r),t.numOpenGroups++,us("group",e,{...(o||s)&&{flags:a}});throw new Error(`Unexpected flag modifier "${e}"`)}function gs(e){var t;const n=/\(\*(?<name>[A-Za-z_]\w*)?(?:\[(?<tag>(?:[A-Za-z_]\w*)?)\])?(?:\{(?<args>[^}]*)\})?\)/.exec(e);if(!n)throw new Error(`Incomplete or invalid named callout "${e}"`);const{name:i,tag:r,args:o}=n.groups;if(!i)throw new Error(`Invalid named callout "${e}"`);if(""===r)throw new Error(`Named callout tag with empty value not allowed "${e}"`);const s=o?o.split(",").filter(e=>""!==e).map(e=>/^[+-]?\d+$/.test(e)?+e:e):[],[a,l,d]=s,c=fs.has(i)?i.toLowerCase():"custom";switch(c){case"fail":case"mismatch":case"skip":if(s.length>0)throw new Error(`Named callout arguments not allowed "${s}"`);break;case"error":if(s.length>1)throw new Error(`Named callout allows only one argument "${s}"`);if("string"==typeof a)throw new Error(`Named callout argument must be a number "${a}"`);break;case"max":if(!s.length||s.length>2)throw new Error(`Named callout must have one or two arguments "${s}"`);if("string"==typeof a&&!/^[A-Za-z_]\w*$/.test(a))throw new Error(`Named callout argument one must be a tag or number "${a}"`);if(2===s.length&&("number"==typeof l||!/^[<>X]$/.test(l)))throw new Error(`Named callout optional argument two must be '<', '>', or 'X' "${l}"`);break;case"count":case"total_count":if(s.length>1)throw new Error(`Named callout allows only one argument "${s}"`);if(1===s.length&&("number"==typeof a||!/^[<>X]$/.test(a)))throw new Error(`Named callout optional argument must be '<', '>', or 'X' "${a}"`);break;case"cmp":if(3!==s.length)throw new Error(`Named callout must have three arguments "${s}"`);if("string"==typeof a&&!/^[A-Za-z_]\w*$/.test(a))throw new Error(`Named callout argument one must be a tag or number "${a}"`);if("number"==typeof l||!/^(?:[<>!=]=|[<>])$/.test(l))throw new Error(`Named callout argument two must be '==', '!=', '>', '<', '>=', or '<=' "${l}"`);if("string"==typeof d&&!/^[A-Za-z_]\w*$/.test(d))throw new Error(`Named callout argument three must be a tag or number "${d}"`);break;case"custom":throw new Error(`Undefined callout name "${i}"`);default:throw new Error(`Unexpected named callout kind "${c}"`)}return function(e,t,n,i){return{type:"NamedCallout",kind:e,tag:t,arguments:n,raw:i}}(c,null!=r?r:null,null!=(t=null==o?void 0:o.split(","))?t:null,e)}function vs(e){let t,n,i=null;if("{"===e[0]){const{minStr:r,maxStr:o}=/^\{(?<minStr>\d*)(?:,(?<maxStr>\d*))?/.exec(e).groups,s=1e5;if(+r>s||o&&+o>s)throw new Error("Quantifier value unsupported in Oniguruma");if(t=+r,n=void 0===o?+r:""===o?1/0:+o,t>n&&(i="possessive",[t,n]=[n,t]),e.endsWith("?")){if("possessive"===i)throw new Error('Unsupported possessive interval quantifier chain with "?"');i="lazy"}else i||(i="greedy")}else t="+"===e[0]?1:0,n="?"===e[0]?1:1/0,i="+"===e[1]?"possessive":"?"===e[1]?"lazy":"greedy";return function(e,t,n,i){return{type:"Quantifier",kind:e,min:t,max:n,raw:i}}(i,t,n,e)}function bs(e){const t={};return e.includes("i")&&(t.ignoreCase=!0),e.includes("m")&&(t.dotAll=!0),e.includes("x")&&(t.extended=!0),Object.keys(t).length?t:null}function ys(e){const t=[],n=new RegExp(Qo,"gy");let i;for(;i=n.exec(e);){const e=i[0];if("{"===e[0]){const i=/^\{(?<min>\d+),(?<max>\d+)\}\??$/.exec(e);if(i){const{min:r,max:o}=i.groups;if(+r>+o&&e.endsWith("?")){n.lastIndex--,t.push(vs(e.slice(0,-1)));continue}}}t.push(vs(e))}return t}function Cs(e,t){if(!Array.isArray(e.body))throw new Error("Expected node with body array");if(1!==e.body.length)return!1;const n=e.body[0];return!t||Object.keys(t).every(e=>t[e]===n[e])}const Ss=/* @__PURE__ */new Set(["AbsenceFunction","Backreference","CapturingGroup","Character","CharacterClass","CharacterSet","Group","Quantifier","Subroutine"]);function ks(e,t={}){const n={flags:"",normalizeUnknownPropertyNames:!1,skipBackrefValidation:!1,skipLookbehindValidation:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}},i=function(e,t={}){const n={flags:"",...t,rules:{captureGroup:!1,singleline:!1,...t.rules}};if("string"!=typeof e)throw new Error("String expected as pattern");const i=function(e){const t={ignoreCase:!1,dotAll:!1,extended:!1,digitIsAscii:!1,posixIsAscii:!1,spaceIsAscii:!1,wordIsAscii:!1,textSegmentMode:null};for(let n=0;n<e.length;n++){const i=e[n];if(!"imxDPSWy".includes(i))throw new Error(`Invalid flag "${i}"`);if("y"!==i)t[{i:"ignoreCase",m:"dotAll",x:"extended",D:"digitIsAscii",P:"posixIsAscii",S:"spaceIsAscii",W:"wordIsAscii"}[i]]=!0;else{if(!/^y{[gw]}/.test(e.slice(n)))throw new Error('Invalid or unspecified flag "y" mode');t.textSegmentMode="g"===e[n+2]?"grapheme":"word",n+=3}}return t}(n.flags),r=[i.extended],o={captureGroup:n.rules.captureGroup,getCurrentModX:()=>r.at(-1),numOpenGroups:0,popModX(){r.pop()},pushModX(e){r.push(e)},replaceCurrentModX(e){r[r.length-1]=e},singleline:n.rules.singleline};let s,a=[];for(Yo.lastIndex=0;s=Yo.exec(e);){const t=Zo(o,e,s[0],Yo.lastIndex);t.tokens?a.push(...t.tokens):t.token&&a.push(t.token),void 0!==t.lastIndex&&(Yo.lastIndex=t.lastIndex)}const l=[];let d=0;a.filter(e=>"GroupOpen"===e.type).forEach(e=>{"capturing"===e.kind?e.number=++d:"("===e.raw&&l.push(e)}),d||l.forEach((e,t)=>{e.kind="capturing",e.number=t+1});const c=d||l.length;return{tokens:a.map(e=>"EscapedNumber"===e.type?function(e,t){const{raw:n,inCharClass:i}=e,r=n.slice(1);if(!i&&("0"!==r&&1===r.length||"0"!==r[0]&&+r<=t))return[rs(n)];const o=[],s=r.match(/^[0-7]+|\d/g);for(let a=0;a<s.length;a++){const e=s[a];let t;if(0===a&&"8"!==e&&"9"!==e){if(t=parseInt(e,8),t>127)throw new Error(Vo`Octal encoded byte above 177 unsupported "${n}"`)}else t=Go(e);o.push(os(t,(0===a?"\\":"")+e))}return o}(e,c):e).flat(),flags:i}}(e,{flags:n.flags,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline}}),r=(e,t)=>{const n=i.tokens[o.nextIndex];switch(o.parent=e,o.nextIndex++,n.type){case"Alternator":return xs();case"Assertion":return function({kind:e}){return ws(qo({"^":"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===Vo`\B`||e===Vo`\Y`})}(n);case"Backreference":return function({raw:e},t){const n=/^\\k[<']/.test(e),i=n?e.slice(3,-1):e.slice(1),r=(n,i=!1)=>{const r=t.capturingGroups.length;let o=!1;if(n>r){if(!t.skipBackrefValidation)throw new Error(`Not enough capturing groups defined to the left "${e}"`);o=!0}return t.hasNumberedRef=!0,Ls(i?r+1-n:n,{orphan:o})};if(n){const n=/^(?<sign>-?)0*(?<num>[1-9]\d*)$/.exec(i);if(n)return r(+n.groups.num,!!n.groups.sign);if(/[-+]/.test(i))throw new Error(`Invalid backref name "${e}"`);if(!t.namedGroupsByName.has(i))throw new Error(`Group name not defined to the left "${e}"`);return Ls(i)}return r(+i)}(n,o);case"Character":return As(n.value,{useLastValid:!!t.isCheckingRangeEnd});case"CharacterClassHyphen":return function(e,t,n){const{tokens:i,walk:r}=t,o=t.parent,s=o.body.at(-1),a=i[t.nextIndex];if(!n.isCheckingRangeEnd&&s&&"CharacterClass"!==s.type&&"CharacterClassRange"!==s.type&&a&&"CharacterClassOpen"!==a.type&&"CharacterClassClose"!==a.type&&"CharacterClassIntersector"!==a.type){const e=r(o,{...n,isCheckingRangeEnd:!0});if("Character"===s.type&&"Character"===e.type)return o.body.pop(),function(e,t){if(t.value<e.value)throw new Error("Character class range out of order");return{type:"CharacterClassRange",min:e,max:t}}(s,e);throw new Error("Invalid character class range")}return As(Go("-"))}(0,o,t);case"CharacterClassOpen":return function({negate:e},t,n){const{tokens:i,walk:r}=t,o=[Is()],s=i[t.nextIndex];let a=Bs(s);for(;"CharacterClassClose"!==a.type;){if("CharacterClassIntersector"===a.type)o.push(Is()),t.nextIndex++;else{const e=o.at(-1);e.body.push(r(e,n))}a=Bs(i[t.nextIndex],s)}const l=Is({negate:e});return 1===o.length?l.body=o[0].body:(l.kind="intersection",l.body=o.map(e=>1===e.body.length?e.body[0]:e)),t.nextIndex++,l}(n,o,t);case"CharacterSet":return function({kind:e,negate:t,value:n},i){const{normalizeUnknownPropertyNames:r,skipPropertyNameValidation:o,unicodePropertyMap:s}=i;if("property"===e){const i=Fs(n);if(!Wo.has(i)||(null==s?void 0:s.has(i)))return Ds(n,{negate:t,normalizeUnknownPropertyNames:r,skipPropertyNameValidation:o,unicodePropertyMap:s});e="posix",n=i}return"posix"===e?function(e,t){const n=!!(null==t?void 0:t.negate);if(!Wo.has(e))throw new Error(`Invalid POSIX class "${e}"`);return{type:"CharacterSet",kind:"posix",value:e,negate:n}}(n,{negate:t}):Es(e,{negate:t})}(n,o);case"Directive":return function(e,t={}){if("keep"===e)return{type:"Directive",kind:e};if("flags"===e)return{type:"Directive",kind:e,flags:qo(t.flags)};throw new Error(`Unexpected directive kind "${e}"`)}(n.kind,{flags:n.flags});case"GroupOpen":return function(e,t,n){const{tokens:i,capturingGroups:r,namedGroupsByName:o,skipLookbehindValidation:s,walk:a}=t,l=function({flags:e,kind:t,name:n,negate:i,number:r}){switch(t){case"absence_repeater":return{type:"AbsenceFunction",kind:"repeater",body:Hs(void 0)};case"atomic":return Ms({atomic:!0});case"capturing":return Ts(r,{name:n});case"group":return Ms({flags:e});case"lookahead":case"lookbehind":return Rs({behind:"lookbehind"===t,negate:i});default:throw new Error(`Unexpected group kind "${t}"`)}}(e),d="AbsenceFunction"===l.type,c=js(l),u=c&&l.negate;if("CapturingGroup"===l.type&&(r.push(l),l.name&&function(e,t){return e.has(t)||e.set(t,[]),e.get(t)}(o,l.name).push(l)),d&&n.isInAbsenceFunction)throw new Error("Nested absence function not supported by Oniguruma");let h=$s(i[t.nextIndex]);for(;"GroupClose"!==h.type;){if("Alternator"===h.type)l.body.push(xs()),t.nextIndex++;else{const e=l.body.at(-1),t=a(e,{...n,isInAbsenceFunction:n.isInAbsenceFunction||d,isInLookbehind:n.isInLookbehind||c,isInNegLookbehind:n.isInNegLookbehind||u});if(e.body.push(t),(c||n.isInLookbehind)&&!s){const e="Lookbehind includes a pattern not allowed by Oniguruma";if(u||n.isInNegLookbehind){if(Os(t)||"CapturingGroup"===t.type)throw new Error(e)}else if(Os(t)||js(t)&&t.negate)throw new Error(e)}}h=$s(i[t.nextIndex])}return t.nextIndex++,l}(n,o,t);case"NamedCallout":return function(e,t,n){return{type:"NamedCallout",kind:e,tag:t,arguments:n}}(n.kind,n.tag,n.arguments);case"Quantifier":return function({kind:e,min:t,max:n},i){const r=i.parent,o=r.body.at(-1);if(!o||!function(e){return Ss.has(e.type)}(o))throw new Error("Quantifier requires a repeatable token");const s=Ps(e,t,n,o);return r.body.pop(),s}(n,o);case"Subroutine":return function({raw:e},t){const{capturingGroups:n,subroutines:i}=t;let r=e.slice(3,-1);const o=/^(?<sign>[-+]?)0*(?<num>[1-9]\d*)$/.exec(r);if(o){const e=+o.groups.num,i=n.length;if(t.hasNumberedRef=!0,r={"":e,"+":i+e,"-":i+1-e}[o.groups.sign],r<1)throw new Error("Invalid subroutine number")}else"0"===r&&(r=0);const s=Ns(r);return i.push(s),s}(n,o);default:throw new Error(`Unexpected token type "${n.type}"`)}},o={capturingGroups:[],hasNumberedRef:!1,namedGroupsByName:/* @__PURE__ */new Map,nextIndex:0,normalizeUnknownPropertyNames:n.normalizeUnknownPropertyNames,parent:null,skipBackrefValidation:n.skipBackrefValidation,skipLookbehindValidation:n.skipLookbehindValidation,skipPropertyNameValidation:n.skipPropertyNameValidation,subroutines:[],tokens:i.tokens,unicodePropertyMap:n.unicodePropertyMap,walk:r},s=function(e){return{type:"Regex",body:Hs(void 0),flags:e}}(function(e){return{type:"Flags",...e}}(i.flags));let a=s.body[0];for(;o.nextIndex<i.tokens.length;){const e=r(a,{});"Alternative"===e.type?(s.body.push(e),a=e):a.body.push(e)}const{capturingGroups:l,hasNumberedRef:d,namedGroupsByName:c,subroutines:u}=o;if(d&&c.size&&!n.rules.captureGroup)throw new Error("Numbered backref/subroutine not allowed when using named capture");for(const{ref:h}of u)if("number"==typeof h){if(h>l.length)throw new Error("Subroutine uses a group number that's not defined");h&&(l[h-1].isSubroutined=!0)}else{if(!c.has(h))throw new Error(Vo`Subroutine uses a group name that's not defined "\g<${h}>"`);if(c.get(h).length>1)throw new Error(Vo`Subroutine uses a duplicate group name "\g<${h}>"`);c.get(h)[0].isSubroutined=!0}return s}function xs(e){return{type:"Alternative",body:_s(null==e?void 0:e.body)}}function ws(e,t){const n={type:"Assertion",kind:e};return("word_boundary"===e||"text_segment_boundary"===e)&&(n.negate=!!(null==t?void 0:t.negate)),n}function Ls(e,t){const n=!!(null==t?void 0:t.orphan);return{type:"Backreference",ref:e,...n&&{orphan:n}}}function Ts(e,t){const n={name:void 0,isSubroutined:!1,...t};if(void 0!==n.name&&!function(e){return/^[\p{Alpha}\p{Pc}][^)]*$/u.test(e)}(n.name))throw new Error(`Group name "${n.name}" invalid in Oniguruma`);return{type:"CapturingGroup",number:e,...n.name&&{name:n.name},...n.isSubroutined&&{isSubroutined:n.isSubroutined},body:Hs(null==t?void 0:t.body)}}function As(e,t){const n={useLastValid:!1,...t};if(e>1114111){const t=e.toString(16);if(!n.useLastValid)throw e>1310719?new Error(`Invalid code point out of range "\\x{${t}}"`):new Error(`Invalid code point out of range in JS "\\x{${t}}"`);e=1114111}return{type:"Character",value:e}}function Is(e){const t={kind:"union",negate:!1,...e};return{type:"CharacterClass",kind:t.kind,negate:t.negate,body:_s(null==e?void 0:e.body)}}function Es(e,t){const n=!!(null==t?void 0:t.negate),i={type:"CharacterSet",kind:e};return("digit"===e||"hex"===e||"newline"===e||"space"===e||"word"===e)&&(i.negate=n),("text_segment"===e||"newline"===e&&!n)&&(i.variableLength=!0),i}function Ms(e){const t=null==e?void 0:e.atomic,n=null==e?void 0:e.flags;if(t&&n)throw new Error("Atomic group cannot have flags");return{type:"Group",...t&&{atomic:t},...n&&{flags:n},body:Hs(null==e?void 0:e.body)}}function Rs(e){const t={behind:!1,negate:!1,...e};return{type:"LookaroundAssertion",kind:t.behind?"lookbehind":"lookahead",negate:t.negate,body:Hs(null==e?void 0:e.body)}}function Ps(e,t,n,i){if(t>n)throw new Error("Invalid reversed quantifier range");return{type:"Quantifier",kind:e,min:t,max:n,body:i}}function Ns(e){return{type:"Subroutine",ref:e}}function Ds(e,t){var n;const i={negate:!1,normalizeUnknownPropertyNames:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t};let r=null==(n=i.unicodePropertyMap)?void 0:n.get(Fs(e));if(!r)if(i.normalizeUnknownPropertyNames)r=function(e){return e.trim().replace(/[- _]+/g,"_").replace(/[A-Z][a-z]+(?=[A-Z])/g,"$&_").replace(/[A-Za-z]+/g,e=>e[0].toUpperCase()+e.slice(1).toLowerCase())}(e);else if(i.unicodePropertyMap&&!i.skipPropertyNameValidation)throw new Error(Vo`Invalid Unicode property "\p{${e}}"`);return{type:"CharacterSet",kind:"property",value:null!=r?r:e,negate:i.negate}}function Hs(e){if(void 0===e)e=[xs()];else if(!Array.isArray(e)||!e.length||!e.every(e=>"Alternative"===e.type))throw new Error("Invalid body; expected array of one or more Alternative nodes");return e}function _s(e){if(void 0===e)e=[];else if(!Array.isArray(e)||!e.every(e=>!!e.type))throw new Error("Invalid body; expected array of nodes");return e}function Os(e){return"LookaroundAssertion"===e.type&&"lookahead"===e.kind}function js(e){return"LookaroundAssertion"===e.type&&"lookbehind"===e.kind}function Fs(e){return e.replace(/[- _]+/g,"").toLowerCase()}function Bs(e,t){const n=t;return qo(e,"Unclosed character class"+("Character"===(null==n?void 0:n.type)&&93===n.value&&"]"===n.raw?' (started with "]")':""))}function $s(e){return qo(e,"Unclosed group")}function zs(e,t,n=null){function i(e,t){for(let n=0;n<e.length;n++){const i=r(e[n],t,n,e);n=Math.max(-1,n+i)}}function r(o,s=null,a=null,l=null){var d,c;let u=0,h=!1;const f={node:o,parent:s,key:a,container:l,root:e,remove(){Us(l).splice(Math.max(0,Gs(a)+u),1),u--,h=!0},removeAllNextSiblings:()=>Us(l).splice(Gs(a)+1),removeAllPrevSiblings(){const e=Gs(a)+u;return u-=e,Us(l).splice(0,Math.max(0,e))},replaceWith(e,t={}){const n=!!t.traverse;l?l[Math.max(0,Gs(a)+u)]=e:qo(s,"Can't replace root node")[a]=e,n&&r(e,s,a,l),h=!0},replaceWithMultiple(e,t={}){const n=!!t.traverse;if(Us(l).splice(Math.max(0,Gs(a)+u),1,...e),u+=e.length-1,n){let t=0;for(let n=0;n<e.length;n++)t+=r(e[n],s,Gs(a)+n+t,l)}h=!0},skip(){h=!0}},{type:p}=o,m=t["*"],g=t[p],v="function"==typeof m?m:null==m?void 0:m.enter,b="function"==typeof g?g:null==g?void 0:g.enter;if(null==v||v(f,n),null==b||b(f,n),!h)switch(p){case"AbsenceFunction":case"Alternative":case"CapturingGroup":case"CharacterClass":case"Group":case"LookaroundAssertion":i(o.body,o);break;case"Assertion":case"Backreference":case"Character":case"CharacterSet":case"Directive":case"Flags":case"NamedCallout":case"Subroutine":break;case"CharacterClassRange":r(o.min,o,"min"),r(o.max,o,"max");break;case"Quantifier":r(o.body,o,"body");break;case"Regex":i(o.body,o),r(o.flags,o,"flags");break;default:throw new Error(`Unexpected node type "${p}"`)}return null==(d=null==g?void 0:g.exit)||d.call(g,f,n),null==(c=null==m?void 0:m.exit)||c.call(m,f,n),u}return r(e),e}function Us(e){if(!Array.isArray(e))throw new Error("Container expected");return e}function Gs(e){if("number"!=typeof e)throw new Error("Numeric key expected");return e}const Ws=String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`;function Vs(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function qs(e,t,n,i){return e.slice(0,t)+i+e.slice(t+n.length)}const Ks=Object.freeze({DEFAULT:"DEFAULT",CHAR_CLASS:"CHAR_CLASS"});function Xs(e,t,n,i){const r=new RegExp(String.raw`${t}|(?<$skip>\[\^?|\\?.)`,"gsu"),o=[!1];let s=0,a="";for(const l of e.matchAll(r)){const{0:e,groups:{$skip:t}}=l;t||i&&i===Ks.DEFAULT!=!s?("["===e[0]?(s++,o.push("^"===e[1])):"]"===e&&s&&(s--,o.pop()),a+=e):a+=n instanceof Function?n(l,{context:s?Ks.CHAR_CLASS:Ks.DEFAULT,negated:o[o.length-1]}):n}return a}function Qs(e,t,n,i){Xs(e,t,n,i)}function Ys(e,t,n){return!!function(e,t,n=0,i){if(!new RegExp(t,"su").test(e))return null;const r=new RegExp(`${t}|(?<$skip>\\\\?.)`,"gsu");r.lastIndex=n;let o,s=0;for(;o=r.exec(e);){const{0:e,groups:{$skip:t}}=o;if(!(t||i&&i===Ks.DEFAULT!=!s))return o;"["===e?s++:"]"===e&&s&&s--,r.lastIndex==o.index&&r.lastIndex++}return null}(e,t,0,n)}function Js(e,t){const n=/\\?./gsu;n.lastIndex=t;let i,r=e.length,o=0,s=1;for(;i=n.exec(e);){const[e]=i;if("["===e)o++;else if(o)"]"===e&&o--;else if("("===e)s++;else if(")"===e&&(s--,!s)){r=i.index;break}}return e.slice(t,r)}const Zs=new RegExp(String.raw`(?<noncapturingStart>${Ws})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`,"gsu"),ea=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,ta=new RegExp(String.raw`
33
- \\(?: \d+
34
- | c[A-Za-z]
35
- | [gk]<[^>]+>
36
- | [pPu]\{[^\}]+\}
37
- | u[A-Fa-f\d]{4}
38
- | x[A-Fa-f\d]{2}
39
- )
40
- | \((?: \? (?: [:=!>]
41
- | <(?:[=!]|[^>]+>)
42
- | [A-Za-z\-]+:
43
- | \(DEFINE\)
44
- ))?
45
- | (?<qBase>${ea})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?)
46
- | \\?.
47
- `.replace(/\s+/g,""),"gsu"),na=String.raw,ia=na`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`,ra=na`\(\?R=(?<rDepth>[^\)]+)\)|${ia}`,oa=na`\(\?<(?![=!])(?<captureName>[^>]+)>`,sa=na`${oa}|(?<unnamed>\()(?!\?)`,aa=new RegExp(na`${oa}|${ra}|\(\?|\\?.`,"gsu"),la="Cannot use multiple overlapping recursions";function da(e){const t=`Max depth must be integer between 2 and 100; used ${e}`;if(!/^[1-9]\d*$/.test(e))throw new Error(t);if((e=+e)<2||e>100)throw new Error(t)}function ca(e,t,n,i,r,o,s){const a=/* @__PURE__ */new Set;i&&Qs(e+t,oa,({groups:{captureName:e}})=>{a.add(e)},Ks.DEFAULT);const l=[n,i?a:null,r,o,s];return`${e}${ua(`(?:${e}`,"forward",...l)}(?:)${ua(`${t})`,"backward",...l)}${t}`}function ua(e,t,n,i,r,o,s){const a=e=>"forward"===t?e+2:n-e+2-1;let l="";for(let d=0;d<n;d++){const t=a(d);l+=Xs(e,na`${sa}|\\k<(?<backref>[^>]+)>`,({0:e,groups:{captureName:n,unnamed:a,backref:l}})=>{if(l&&i&&!i.has(l))return e;const d=`_$${t}`;if(a||n){const t=s+o.length+1;return o.push(t),ha(r,t),a?e:`(?<${n}${d}>`}return na`\k<${l}${d}>`},Ks.DEFAULT)}return l}function ha(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function fa(e,t,n,i,r,o){if(e.size&&i){let s=0;Qs(t,sa,()=>s++,Ks.DEFAULT);const a=o-s+r,l=/* @__PURE__ */new Map;return e.forEach((e,t)=>{const r=(i-s*n)/n,o=s*n,d=t>a+s?t+i:t,c=[];for(const l of e)if(l<=a)c.push(l);else if(l>a+s+r)c.push(l+i);else if(l<=a+s)for(let e=0;e<=n;e++)c.push(l+s*e);else for(let e=0;e<=n;e++)c.push(l+o+r*e);l.set(d,c)}),l}return e}var pa=String.fromCodePoint,ma=String.raw,ga={},va=globalThis.RegExp;function ba(e,{enable:t,disable:n}){return{dotAll:!((null==n?void 0:n.dotAll)||!(null==t?void 0:t.dotAll)&&!e.dotAll),ignoreCase:!((null==n?void 0:n.ignoreCase)||!(null==t?void 0:t.ignoreCase)&&!e.ignoreCase)}}function ya(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}function Ca(e,t){return Sa[e]>=Sa[t]}ga.flagGroups=(()=>{try{new va("(?i:)")}catch{return!1}return!0})(),ga.unicodeSets=(()=>{try{new va("[[]]","v")}catch{return!1}return!0})(),ga.bugFlagVLiteralHyphenIsRange=!!ga.unicodeSets&&(()=>{try{new va(ma`[\d\-a]`,"v")}catch{return!0}return!1})(),ga.bugNestedClassIgnoresNegation=ga.unicodeSets&&new va("[[^a]]","v").test("a");var Sa={ES2025:2025,ES2024:2024,ES2018:2018},ka={auto:"auto",ES2025:"ES2025",ES2024:"ES2024",ES2018:"ES2018"};function xa(e={}){if("[object Object]"!=={}.toString.call(e))throw new Error("Unexpected options");if(void 0!==e.target&&!ka[e.target])throw new Error(`Unexpected target "${e.target}"`);const t={accuracy:"default",avoidSubclass:!1,flags:"",global:!1,hasIndices:!1,lazyCompileLength:1/0,target:"auto",verbose:!1,...e,rules:{allowOrphanBackrefs:!1,asciiWordBoundaries:!1,captureGroup:!1,recursionLimit:20,singleline:!1,...e.rules}};return"auto"===t.target&&(t.target=ga.flagGroups?"ES2025":ga.unicodeSets?"ES2024":"ES2018"),t}var wa=/* @__PURE__ */new Set([pa(304),pa(305)]),La=ma`[\p{L}\p{M}\p{N}\p{Pc}]`;function Ta(e){if(wa.has(e))return[e];const t=/* @__PURE__ */new Set,n=e.toLowerCase(),i=n.toUpperCase(),r=Ma.get(n),o=Ia.get(n),s=Ea.get(n);return 1===[...i].length&&t.add(i),s&&t.add(s),r&&t.add(r),t.add(n),o&&t.add(o),[...t]}var Aa=/* @__PURE__ */new Map("C Other\nCc Control cntrl\nCf Format\nCn Unassigned\nCo Private_Use\nCs Surrogate\nL Letter\nLC Cased_Letter\nLl Lowercase_Letter\nLm Modifier_Letter\nLo Other_Letter\nLt Titlecase_Letter\nLu Uppercase_Letter\nM Mark Combining_Mark\nMc Spacing_Mark\nMe Enclosing_Mark\nMn Nonspacing_Mark\nN Number\nNd Decimal_Number digit\nNl Letter_Number\nNo Other_Number\nP Punctuation punct\nPc Connector_Punctuation\nPd Dash_Punctuation\nPe Close_Punctuation\nPf Final_Punctuation\nPi Initial_Punctuation\nPo Other_Punctuation\nPs Open_Punctuation\nS Symbol\nSc Currency_Symbol\nSk Modifier_Symbol\nSm Math_Symbol\nSo Other_Symbol\nZ Separator\nZl Line_Separator\nZp Paragraph_Separator\nZs Space_Separator\nASCII\nASCII_Hex_Digit AHex\nAlphabetic Alpha\nAny\nAssigned\nBidi_Control Bidi_C\nBidi_Mirrored Bidi_M\nCase_Ignorable CI\nCased\nChanges_When_Casefolded CWCF\nChanges_When_Casemapped CWCM\nChanges_When_Lowercased CWL\nChanges_When_NFKC_Casefolded CWKCF\nChanges_When_Titlecased CWT\nChanges_When_Uppercased CWU\nDash\nDefault_Ignorable_Code_Point DI\nDeprecated Dep\nDiacritic Dia\nEmoji\nEmoji_Component EComp\nEmoji_Modifier EMod\nEmoji_Modifier_Base EBase\nEmoji_Presentation EPres\nExtended_Pictographic ExtPict\nExtender Ext\nGrapheme_Base Gr_Base\nGrapheme_Extend Gr_Ext\nHex_Digit Hex\nIDS_Binary_Operator IDSB\nIDS_Trinary_Operator IDST\nID_Continue IDC\nID_Start IDS\nIdeographic Ideo\nJoin_Control Join_C\nLogical_Order_Exception LOE\nLowercase Lower\nMath\nNoncharacter_Code_Point NChar\nPattern_Syntax Pat_Syn\nPattern_White_Space Pat_WS\nQuotation_Mark QMark\nRadical\nRegional_Indicator RI\nSentence_Terminal STerm\nSoft_Dotted SD\nTerminal_Punctuation Term\nUnified_Ideograph UIdeo\nUppercase Upper\nVariation_Selector VS\nWhite_Space space\nXID_Continue XIDC\nXID_Start XIDS".split(/\s/).map(e=>[Fs(e),e])),Ia=/* @__PURE__ */new Map([["s",pa(383)],[pa(383),"s"]]),Ea=/* @__PURE__ */new Map([[pa(223),pa(7838)],[pa(107),pa(8490)],[pa(229),pa(8491)],[pa(969),pa(8486)]]),Ma=new Map([Pa(453),Pa(456),Pa(459),Pa(498),...Na(8072,8079),...Na(8088,8095),...Na(8104,8111),Pa(8124),Pa(8140),Pa(8188)]),Ra=/* @__PURE__ */new Map([["alnum",ma`[\p{Alpha}\p{Nd}]`],["alpha",ma`\p{Alpha}`],["ascii",ma`\p{ASCII}`],["blank",ma`[\p{Zs}\t]`],["cntrl",ma`\p{Cc}`],["digit",ma`\p{Nd}`],["graph",ma`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],["lower",ma`\p{Lower}`],["print",ma`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],["punct",ma`[\p{P}\p{S}]`],["space",ma`\p{space}`],["upper",ma`\p{Upper}`],["word",ma`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],["xdigit",ma`\p{AHex}`]]);function Pa(e){const t=pa(e);return[t.toLowerCase(),t]}function Na(e,t){return function(e,t){const n=[];for(let i=e;i<=t;i++)n.push(i);return n}(e,t).map(e=>Pa(e))}var Da=/* @__PURE__ */new Set(["Lower","Lowercase","Upper","Uppercase","Ll","Lowercase_Letter","Lt","Titlecase_Letter","Lu","Uppercase_Letter"]),Ha={AbsenceFunction({node:e,parent:t,replaceWith:n}){const{body:i,kind:r}=e;if("repeater"!==r)throw new Error('Unsupported absence function "(?~|"');{const e=Ms();e.body[0].body.push(Rs({negate:!0,body:i}),Ds("Any"));const r=Ms();r.body[0].body.push(Ps("greedy",0,1/0,e)),n(Ya(r,t),{traverse:!0})}},Alternative:{enter({node:e,parent:t,key:n},{flagDirectivesByAlt:i}){const r=e.body.filter(e=>"flags"===e.kind);for(let o=n+1;o<t.body.length;o++)ya(i,t.body[o],[]).push(...r)},exit({node:e},{flagDirectivesByAlt:t}){var n;if(null==(n=t.get(e))?void 0:n.length){const n=za(t.get(e));if(n){const t=Ms({flags:n});t.body[0].body=e.body,e.body=[Ya(t,e)]}}}},Assertion({node:e,parent:t,key:n,container:i,root:r,remove:o,replaceWith:s},a){const{kind:l,negate:d}=e,{asciiWordBoundaries:c,avoidSubclass:u,supportedGNodes:h,wordIsAscii:f}=a;if("text_segment_boundary"===l)throw new Error(`Unsupported text segment boundary "\\${d?"Y":"y"}"`);if("line_end"===l)s(Ya(Rs({body:[xs({body:[ws("string_end")]}),xs({body:[As(10)]})]}),t));else if("line_start"===l)s(Ya(Ka(ma`(?<=\A|\n(?!\z))`,{skipLookbehindValidation:!0}),t));else if("search_start"===l)if(h.has(e))r.flags.sticky=!0,o();else{const e=i[n-1];if(e&&function(e){const t=["Character","CharacterClass","CharacterSet"];return t.includes(e.type)||"Quantifier"===e.type&&e.min&&t.includes(e.body.type)}(e))s(Ya(Rs({negate:!0}),t));else{if(u)throw new Error(ma`Uses "\G" in a way that requires a subclass`);s(Qa(ws("string_start"),t)),a.strategy="clip_search"}}else if("string_end"===l||"string_start"===l);else if("string_end_newline"===l)s(Ya(Ka(ma`(?=\n?\z)`),t));else{if("word_boundary"!==l)throw new Error(`Unexpected assertion kind "${l}"`);f||c||s(Ya(Ka(d?`(?:(?<=${La})(?=${La})|(?<!${La})(?!${La}))`:`(?:(?<=${La})(?!${La})|(?<!${La})(?=${La}))`),t))}},Backreference({node:e},{jsGroupNameMap:t}){let{ref:n}=e;"string"!=typeof n||qa(n)||(n=$a(n,t),e.ref=n)},CapturingGroup({node:e},{jsGroupNameMap:t,subroutineRefMap:n}){let{name:i}=e;i&&!qa(i)&&(i=$a(i,t),e.name=i),n.set(e.number,e),i&&n.set(i,e)},CharacterClassRange({node:e,parent:t,replaceWith:n}){"intersection"===t.kind&&n(Ya(Is({body:[e]}),t),{traverse:!0})},CharacterSet({node:e,parent:t,replaceWith:n},{accuracy:i,minTargetEs2024:r,digitIsAscii:o,spaceIsAscii:s,wordIsAscii:a}){const{kind:l,negate:d,value:c}=e;if(!o||"digit"!==l&&"digit"!==c)if(!s||"space"!==l&&"space"!==c)if(!a||"word"!==l&&"word"!==c)if("any"===l)n(Qa(Ds("Any"),t));else if("digit"===l)n(Qa(Ds("Nd",{negate:d}),t));else if("dot"===l);else if("text_segment"===l){if("strict"===i)throw new Error(ma`Use of "\X" requires non-strict accuracy`);const e="\\p{Emoji}(?:\\p{EMod}|\\uFE0F\\u20E3?|[\\x{E0020}-\\x{E007E}]+\\x{E007F})?",o=ma`\p{RI}{2}|${e}(?:\u200D${e})*`;n(Ya(Ka(ma`(?>\r\n|${r?ma`\p{RGI_Emoji}`:o}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),t))}else if("hex"===l)n(Qa(Ds("AHex",{negate:d}),t));else if("newline"===l)n(Ya(Ka(d?"[^\n]":"(?>\r\n?|[\n\v\f…\u2028\u2029])"),t));else if("posix"===l)if(r||"graph"!==c&&"print"!==c)n(Ya(Xa(Ka(Ra.get(c)),d),t));else{if("strict"===i)throw new Error(`POSIX class "${c}" requires min target ES2024 or non-strict accuracy`);let e={graph:"!-~",print:" -~"}[c];d&&(e=`\0-${pa(e.codePointAt(0)-1)}${pa(e.codePointAt(2)+1)}-􏿿`),n(Ya(Ka(`[${e}]`),t))}else if("property"===l)Aa.has(Fs(c))||(e.key="sc");else if("space"===l)n(Qa(Ds("space",{negate:d}),t));else{if("word"!==l)throw new Error(`Unexpected character set kind "${l}"`);n(Ya(Xa(Ka(La),d),t))}else n(Qa(Es("word",{negate:d}),t));else n(Ya(Xa(Ka("[\t-\r ]"),d),t));else n(Qa(Es("digit",{negate:d}),t))},Directive({node:e,parent:t,root:n,remove:i,replaceWith:r,removeAllPrevSiblings:o,removeAllNextSiblings:s}){const{kind:a,flags:l}=e;if("flags"===a)if(l.enable||l.disable){const e=Ms({flags:l});e.body[0].body=s(),r(Ya(e,t),{traverse:!0})}else i();else{if("keep"!==a)throw new Error(`Unexpected directive kind "${a}"`);{const e=n.body[0],i=1===n.body.length&&Cs(e,{type:"Group"})&&1===e.body[0].body.length?e.body[0]:n;if(t.parent!==i||i.body.length>1)throw new Error(ma`Uses "\K" in a way that's unsupported`);const s=Rs({behind:!0});s.body[0].body=o(),r(Ya(s,t))}}},Flags({node:e,parent:t}){var n;if(e.posixIsAscii)throw new Error('Unsupported flag "P"');if("word"===e.textSegmentMode)throw new Error('Unsupported flag "y{w}"');["digitIsAscii","extended","posixIsAscii","spaceIsAscii","wordIsAscii","textSegmentMode"].forEach(t=>delete e[t]),Object.assign(e,{global:!1,hasIndices:!1,multiline:!1,sticky:null!=(n=e.sticky)&&n}),t.options={disable:{x:!0,n:!0},force:{v:!0}}},Group({node:e}){if(!e.flags)return;const{enable:t,disable:n}=e.flags;(null==t?void 0:t.extended)&&delete t.extended,(null==n?void 0:n.extended)&&delete n.extended,(null==t?void 0:t.dotAll)&&(null==n?void 0:n.dotAll)&&delete t.dotAll,(null==t?void 0:t.ignoreCase)&&(null==n?void 0:n.ignoreCase)&&delete t.ignoreCase,t&&!Object.keys(t).length&&delete e.flags.enable,n&&!Object.keys(n).length&&delete e.flags.disable,!e.flags.enable&&!e.flags.disable&&delete e.flags},LookaroundAssertion({node:e},t){const{kind:n}=e;"lookbehind"===n&&(t.passedLookbehind=!0)},NamedCallout({node:e,parent:t,replaceWith:n}){const{kind:i}=e;if("fail"!==i)throw new Error(`Unsupported named callout "(*${i.toUpperCase()}"`);n(Ya(Rs({negate:!0}),t))},Quantifier({node:e}){if("Quantifier"===e.body.type){const t=Ms();t.body[0].body.push(e.body),e.body=Ya(t,e)}},Regex:{enter({node:e},{supportedGNodes:t}){const n=[];let i=!1,r=!1;for(const o of e.body)if(1===o.body.length&&"search_start"===o.body[0].kind)o.body.pop();else{const e=Wa(o.body);e?(i=!0,Array.isArray(e)?n.push(...e):n.push(e)):r=!0}i&&!r&&n.forEach(e=>t.add(e))},exit(e,{accuracy:t,passedLookbehind:n,strategy:i}){if("strict"===t&&n&&i)throw new Error(ma`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:e},{jsGroupNameMap:t}){let{ref:n}=e;"string"!=typeof n||qa(n)||(n=$a(n,t),e.ref=n)}},_a={Backreference({node:e},{multiplexCapturesToLeftByRef:t,reffedNodesByReferencer:n}){const{orphan:i,ref:r}=e;i||n.set(e,[...t.get(r).map(({node:e})=>e)])},CapturingGroup:{enter({node:e,parent:t,replaceWith:n,skip:i},{groupOriginByCopy:r,groupsByName:o,multiplexCapturesToLeftByRef:s,openRefs:a,reffedNodesByReferencer:l}){var d;const c=r.get(e);if(c&&a.has(e.number)){const i=Qa(Ba(e.number),t);return l.set(i,a.get(e.number)),void n(i)}a.set(e.number,e),s.set(e.number,[]),e.name&&ya(s,e.name,[]);const u=s.get(null!=(d=e.name)?d:e.number);for(let h=0;h<u.length;h++){const t=u[h];if(c===t.node||c&&c===t.origin||e===t.origin){u.splice(h,1);break}}if(s.get(e.number).push({node:e,origin:c}),e.name&&s.get(e.name).push({node:e,origin:c}),e.name){const t=ya(o,e.name,/* @__PURE__ */new Map);let n=!1;if(c)n=!0;else for(const e of t.values())if(!e.hasDuplicateNameToRemove){n=!0;break}o.get(e.name).set(e,{node:e,hasDuplicateNameToRemove:n})}},exit({node:e},{openRefs:t}){t.get(e.number)===e&&t.delete(e.number)}},Group:{enter({node:e},t){t.prevFlags=t.currentFlags,e.flags&&(t.currentFlags=ba(t.currentFlags,e.flags))},exit(e,t){t.currentFlags=t.prevFlags}},Subroutine({node:e,parent:t,replaceWith:n},i){const{isRecursive:r,ref:o}=e;if(r){let n=t;for(;(n=n.parent)&&("CapturingGroup"!==n.type||n.name!==o&&n.number!==o););return void i.reffedNodesByReferencer.set(e,n)}const s=i.subroutineRefMap.get(o),a=0===o,l=a?Ba(0):Fa(s,i.groupOriginByCopy,null);let d=l;if(!a){const e=za(function(e,t){const n=[];for(;e=e.parent;)t&&!t(e)||n.push(e);return n}(s,e=>"Group"===e.type&&!!e.flags)),t=e?ba(i.globalFlags,e):i.globalFlags;c=t,u=i.currentFlags,(c.dotAll!==u.dotAll||c.ignoreCase!==u.ignoreCase)&&(d=Ms({flags:Ua(t)}),d.body[0].body.push(l))}var c,u;n(Ya(d,t),{traverse:!a})}},Oa={Backreference({node:e,parent:t,replaceWith:n},i){if(e.orphan)return void(i.highestOrphanBackref=Math.max(i.highestOrphanBackref,e.ref));const r=i.reffedNodesByReferencer.get(e).filter(t=>function(e,t){let n=t;do{if("Regex"===n.type)return!1;if("Alternative"===n.type)continue;if(n===e)return!1;const t=Ga(n.parent);for(const i of t){if(i===n)break;if(i===e||Va(i,e))return!0}}while(n=n.parent);throw new Error("Unexpected path")}(t,e));r.length?r.length>1?n(Ya(Ms({atomic:!0,body:r.reverse().map(e=>xs({body:[Ls(e.number)]}))}),t)):e.ref=r[0].number:n(Ya(Rs({negate:!0}),t))},CapturingGroup({node:e},t){e.number=++t.numCapturesToLeft,e.name&&t.groupsByName.get(e.name).get(e).hasDuplicateNameToRemove&&delete e.name},Regex:{exit({node:e},t){const n=Math.max(t.highestOrphanBackref-t.numCapturesToLeft,0);for(let i=0;i<n;i++){const t=Ts();e.body.at(-1).body.push(t)}}},Subroutine({node:e},t){e.isRecursive&&0!==e.ref&&(e.ref=t.reffedNodesByReferencer.get(e).number)}};function ja(e){zs(e,{"*"({node:e,parent:t}){e.parent=t}})}function Fa(e,t,n,i){var r;const o=Array.isArray(e)?[]:{};for(const[s,a]of Object.entries(e))"parent"===s?o.parent=Array.isArray(n)?i:n:a&&"object"==typeof a?o[s]=Fa(a,t,o,n):("type"===s&&"CapturingGroup"===a&&t.set(o,null!=(r=t.get(e))?r:e),o[s]=a);return o}function Ba(e){const t=Ns(e);return t.isRecursive=!0,t}function $a(e,t){if(t.has(e))return t.get(e);const n=`$${t.size}_${e.replace(/^[^$_\p{IDS}]|[^$\u200C\u200D\p{IDC}]/gu,"_")}`;return t.set(e,n),n}function za(e){const t=["dotAll","ignoreCase"],n={enable:{},disable:{}};return e.forEach(({flags:e})=>{t.forEach(t=>{var i,r;(null==(i=e.enable)?void 0:i[t])&&(delete n.disable[t],n.enable[t]=!0),(null==(r=e.disable)?void 0:r[t])&&(n.disable[t]=!0)})}),Object.keys(n.enable).length||delete n.enable,Object.keys(n.disable).length||delete n.disable,n.enable||n.disable?n:null}function Ua({dotAll:e,ignoreCase:t}){const n={};return(e||t)&&(n.enable={},e&&(n.enable.dotAll=!0),t&&(n.enable.ignoreCase=!0)),e&&t||(n.disable={},!e&&(n.disable.dotAll=!0),!t&&(n.disable.ignoreCase=!0)),n}function Ga(e){if(!e)throw new Error("Node expected");const{body:t}=e;return Array.isArray(t)?t:t?[t]:null}function Wa(e){const t=e.find(e=>"search_start"===e.kind||function(e){const t={negate:null,negate:!1};return"LookaroundAssertion"===e.type&&(null===t.negate||e.negate===t.negate)&&1===e.body.length&&Cs(e.body[0],{type:"Assertion",kind:"search_start"})}(e)||!function({type:e}){return"Assertion"===e||"Directive"===e||"LookaroundAssertion"===e}(e));if(!t)return null;if("search_start"===t.kind)return t;if("LookaroundAssertion"===t.type)return t.body[0].body[0];if("CapturingGroup"===t.type||"Group"===t.type){const e=[];for(const n of t.body){const t=Wa(n.body);if(!t)return null;Array.isArray(t)?e.push(...t):e.push(t)}return e}return null}function Va(e,t){var n;const i=null!=(n=Ga(e))?n:[];for(const r of i)if(r===t||Va(r,t))return!0;return!1}function qa(e){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e)}function Ka(e,t){const n=ks(e,{...t,unicodePropertyMap:Aa}).body;return n.length>1||n[0].body.length>1?Ms({body:n}):n[0].body[0]}function Xa(e,t){return e.negate=t,e}function Qa(e,t){return e.parent=t,e}function Ya(e,t){return ja(e),e.parent=t,e}var Ja={"*":{enter({node:e},t){if(ll(e)){const n=t.getCurrentModI();t.pushModI(e.flags?ba({ignoreCase:n},e.flags).ignoreCase:n)}},exit({node:e},t){ll(e)&&t.popModI()}},Backreference(e,t){t.setHasCasedChar()},Character({node:e},t){ol(pa(e.value))&&t.setHasCasedChar()},CharacterClassRange({node:e,skip:t},n){t(),sl(e,{firstOnly:!0}).length&&n.setHasCasedChar()},CharacterSet({node:e},t){"property"===e.kind&&Da.has(e.value)&&t.setHasCasedChar()}},Za={Alternative:({body:e},t,n)=>e.map(n).join(""),Assertion({kind:e,negate:t}){if("string_end"===e)return"$";if("string_start"===e)return"^";if("word_boundary"===e)return t?ma`\B`:ma`\b`;throw new Error(`Unexpected assertion kind "${e}"`)},Backreference({ref:e},t){if("number"!=typeof e)throw new Error("Unexpected named backref in transformed AST");if(!t.useFlagMods&&"strict"===t.accuracy&&t.currentFlags.ignoreCase&&!t.captureMap.get(e).ignoreCase)throw new Error("Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy");return"\\"+e},CapturingGroup(e,t,n){const{body:i,name:r,number:o}=e,s={ignoreCase:t.currentFlags.ignoreCase},a=t.originMap.get(e);return a&&(s.hidden=!0,o>a.number&&(s.transferTo=a.number)),t.captureMap.set(o,s),`(${r?`?<${r}>`:""}${i.map(n).join("|")})`},Character({value:e},t){const n=pa(e),i=al(e,{escDigit:"Backreference"===t.lastNode.type,inCharClass:t.inCharClass,useFlagV:t.useFlagV});if(i!==n)return i;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&ol(n)){const e=Ta(n);return t.inCharClass?e.join(""):e.length>1?`[${e.join("")}]`:e[0]}return n},CharacterClass(e,t,n){const{kind:i,negate:r,parent:o}=e;let{body:s}=e;if("intersection"===i&&!t.useFlagV)throw new Error("Use of character class intersection requires min target ES2024");ga.bugFlagVLiteralHyphenIsRange&&t.useFlagV&&s.some(dl)&&(s=[As(45),...s.filter(e=>!dl(e))]);const a=()=>`[${r?"^":""}${s.map(n).join("intersection"===i?"&&":"")}]`;if(!t.inCharClass){if((!t.useFlagV||ga.bugNestedClassIgnoresNegation)&&!r){const t=s.filter(e=>"CharacterClass"===e.type&&"union"===e.kind&&e.negate);if(t.length){const i=Ms(),r=i.body[0];return i.parent=o,r.parent=i,s=s.filter(e=>!t.includes(e)),e.body=s,s.length?(e.parent=r,r.body.push(e)):i.body.pop(),t.forEach(e=>{const t=xs({body:[e]});e.parent=t,t.parent=i,i.body.push(t)}),n(i)}}t.inCharClass=!0;const i=a();return t.inCharClass=!1,i}const l=s[0];if("union"===i&&!r&&l&&((!t.useFlagV||!t.verbose)&&"union"===o.kind&&(!ga.bugFlagVLiteralHyphenIsRange||!t.useFlagV)||!t.verbose&&"intersection"===o.kind&&1===s.length&&"CharacterClassRange"!==l.type))return s.map(n).join("");if(!t.useFlagV&&"CharacterClass"===o.type)throw new Error("Uses nested character class in a way that requires min target ES2024");return a()},CharacterClassRange(e,t){const n=e.min.value,i=e.max.value,r={escDigit:!1,inCharClass:!0,useFlagV:t.useFlagV},o=al(n,r),s=al(i,r),a=/* @__PURE__ */new Set;return t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&function(e){const t=e.map(e=>e.codePointAt(0)).sort((e,t)=>e-t),n=[];let i=null;for(let r=0;r<t.length;r++)t[r+1]===t[r]+1?null!=i||(i=t[r]):null===i?n.push(t[r]):(n.push([i,t[r]]),i=null);return n}(sl(e)).forEach(e=>{a.add(Array.isArray(e)?`${al(e[0],r)}-${al(e[1],r)}`:al(e,r))}),`${o}-${s}${[...a].join("")}`},CharacterSet({kind:e,negate:t,value:n,key:i},r){if("dot"===e)return r.currentFlags.dotAll?r.appliedGlobalFlags.dotAll||r.useFlagMods?".":"[^]":ma`[^\n]`;if("digit"===e)return t?ma`\D`:ma`\d`;if("property"===e){if(r.useAppliedIgnoreCase&&r.currentFlags.ignoreCase&&Da.has(n))throw new Error(`Unicode property "${n}" can't be case-insensitive when other chars have specific case`);return`${t?ma`\P`:ma`\p`}{${i?`${i}=`:""}${n}}`}if("word"===e)return t?ma`\W`:ma`\w`;throw new Error(`Unexpected character set kind "${e}"`)},Flags:(e,t)=>(t.appliedGlobalFlags.ignoreCase?"i":"")+(e.dotAll?"s":"")+(e.sticky?"y":""),Group({atomic:e,body:t,flags:n,parent:i},r,o){const s=r.currentFlags;n&&(r.currentFlags=ba(s,n));const a=t.map(o).join("|"),l=r.verbose||1!==t.length||"Quantifier"===i.type||e||r.useFlagMods&&n?`(?${function(e,t,n){if(e)return">";let i="";if(t&&n){const{enable:e,disable:n}=t;i=((null==e?void 0:e.ignoreCase)?"i":"")+((null==e?void 0:e.dotAll)?"s":"")+(n?"-":"")+((null==n?void 0:n.ignoreCase)?"i":"")+((null==n?void 0:n.dotAll)?"s":"")}return`${i}:`}(e,n,r.useFlagMods)}${a})`:a;return r.currentFlags=s,l},LookaroundAssertion:({body:e,kind:t,negate:n},i,r)=>`(?${"lookahead"===t?"":"<"}${n?"!":"="}${e.map(r).join("|")})`,Quantifier:(e,t,n)=>n(e.body)+function({kind:e,max:t,min:n}){let i;return i=n||1!==t?n||t!==1/0?1===n&&t===1/0?"+":n===t?`{${n}}`:`{${n},${t===1/0?"":t}}`:"*":"?",i+{greedy:"",lazy:"?",possessive:"+"}[e]}(e),Subroutine({isRecursive:e,ref:t},n){if(!e)throw new Error("Unexpected non-recursive subroutine in transformed AST");const i=n.recursionLimit;return 0===t?`(?R=${i})`:ma`\g<${t}&R=${i}>`}},el=/* @__PURE__ */new Set(["$","(",")","*","+",".","?","[","\\","]","^","{","|","}"]),tl=/* @__PURE__ */new Set(["-","\\","]","^","["]),nl=/* @__PURE__ */new Set(["(",")","-","/","[","\\","]","^","{","|","}","!","#","$","%","&","*","+",",",".",":",";","<","=",">","?","@","`","~"]),il=/* @__PURE__ */new Map([[9,ma`\t`],[10,ma`\n`],[11,ma`\v`],[12,ma`\f`],[13,ma`\r`],[8232,ma`\u2028`],[8233,ma`\u2029`],[65279,ma`\uFEFF`]]),rl=/^\p{Cased}$/u;function ol(e){return rl.test(e)}function sl(e,t){const n=!!(null==t?void 0:t.firstOnly),i=e.min.value,r=e.max.value,o=[];if(i<65&&(65535===r||r>=131071)||65536===i&&r>=131071)return o;for(let s=i;s<=r;s++){const e=pa(s);if(!ol(e))continue;const t=Ta(e).filter(e=>{const t=e.codePointAt(0);return t<i||t>r});if(t.length&&(o.push(...t),n))break}return o}function al(e,{escDigit:t,inCharClass:n,useFlagV:i}){if(il.has(e))return il.get(e);if(e<32||e>126&&e<160||e>262143||t&&(r=e)>47&&r<58)return e>255?`\\u{${e.toString(16).toUpperCase()}}`:`\\x${e.toString(16).toUpperCase().padStart(2,"0")}`;var r;const o=n?i?nl:tl:el,s=pa(e);return(o.has(s)?"\\":"")+s}function ll({type:e}){return"CapturingGroup"===e||"Group"===e||"LookaroundAssertion"===e}function dl({type:e,value:t}){return"Character"===e&&45===t}var cl=(c=class extends RegExp{constructor(e,t,n){var d=(...e)=>(super(...e),k(this,l),k(this,i,/* @__PURE__ */new Map),k(this,r,null),k(this,o),k(this,s,null),k(this,a,null),y(this,"rawOptions",{}),this);const u=!!(null==n?void 0:n.lazyCompile);if(e instanceof RegExp){if(n)throw new Error("Cannot provide options when copying a regexp");const r=e;d(r,t),x(this,o,r.source),r instanceof c&&(x(this,i,S(r,i)),x(this,s,S(r,s)),x(this,a,S(r,a)),this.rawOptions=r.rawOptions)}else{const r={hiddenCaptures:[],strategy:null,transfers:[],...n};d(u?"":e,t),x(this,o,e),x(this,i,function(e,t){const n=/* @__PURE__ */new Map;for(const i of e)n.set(i,{hidden:!0});for(const[i,r]of t)for(const e of r)ya(n,e,{}).transferTo=i;return n}(r.hiddenCaptures,r.transfers)),x(this,a,r.strategy),this.rawOptions=null!=n?n:{}}u||x(this,r,this)}get source(){return S(this,o)||"(?:)"}exec(e){if(!S(this,r)){const{lazyCompile:e,...t}=this.rawOptions;x(this,r,new c(S(this,o),this.flags,t))}const t=this.global||this.sticky,n=this.lastIndex;if("clip_search"===S(this,a)&&t&&n){this.lastIndex=0;const t=w(this,l,d).call(this,e.slice(n));return t&&(function(e,t,n,i){if(e.index+=t,e.input=n,i){const n=e.indices;for(let e=0;e<n.length;e++){const i=n[e];i&&(n[e]=[i[0]+t,i[1]+t])}const i=n.groups;i&&Object.keys(i).forEach(e=>{const n=i[e];n&&(i[e]=[n[0]+t,n[1]+t])})}}(t,n,e,this.hasIndices),this.lastIndex+=n),t}return w(this,l,d).call(this,e)}},i=new WeakMap,r=new WeakMap,o=new WeakMap,s=new WeakMap,a=new WeakMap,l=new WeakSet,d=function(e){var t;S(this,r).lastIndex=this.lastIndex;const n=(o=c.prototype,v(g(o),"exec",this)).call(S(this,r),e);var o;if(this.lastIndex=S(this,r).lastIndex,!n||!S(this,i).size)return n;const a=[...n];let l;n.length=1,this.hasIndices&&(l=[...n.indices],n.indices.length=1);const d=[0];for(let r=1;r<a.length;r++){const{hidden:e,transferTo:o}=null!=(t=S(this,i).get(r))?t:{};if(e?d.push(null):(d.push(n.length),n.push(a[r]),this.hasIndices&&n.indices.push(l[r])),o&&void 0!==a[r]){const e=d[o];if(!e)throw new Error(`Invalid capture transfer to "${e}"`);if(n[e]=a[r],this.hasIndices&&(n.indices[e]=l[r]),n.groups){S(this,s)||x(this,s,ul(this.source));const e=S(this,s).get(o);e&&(n.groups[e]=a[r],this.hasIndices&&(n.indices.groups[e]=l[r]))}}}return n},c);function ul(e){const t=/(?<capture>\((?:\?<(?![=!])(?<name>[^>]+)>|(?!\?)))|\\?./gsu,n=/* @__PURE__ */new Map;let i,r=0,o=0;for(;i=t.exec(e);){const{0:e,groups:{capture:t,name:s}}=i;"["===e?r++:r?"]"===e&&r--:t&&(o++,s&&n.set(o,s))}return n}function hl(e,t){const n=function(e,t){const n=xa(t),i=function(e,t){const n={accuracy:"default",asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:"ES2025",...t};ja(e);const i={accuracy:n.accuracy,asciiWordBoundaries:n.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,flagDirectivesByAlt:/* @__PURE__ */new Map,jsGroupNameMap:/* @__PURE__ */new Map,minTargetEs2024:Ca(n.bestEffortTarget,"ES2024"),passedLookbehind:!1,strategy:null,subroutineRefMap:/* @__PURE__ */new Map,supportedGNodes:/* @__PURE__ */new Set,digitIsAscii:e.flags.digitIsAscii,spaceIsAscii:e.flags.spaceIsAscii,wordIsAscii:e.flags.wordIsAscii};zs(e,Ha,i);const r={dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},o={currentFlags:r,prevFlags:null,globalFlags:r,groupOriginByCopy:/* @__PURE__ */new Map,groupsByName:/* @__PURE__ */new Map,multiplexCapturesToLeftByRef:/* @__PURE__ */new Map,openRefs:/* @__PURE__ */new Map,reffedNodesByReferencer:/* @__PURE__ */new Map,subroutineRefMap:i.subroutineRefMap};return zs(e,_a,o),zs(e,Oa,{groupsByName:o.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:o.reffedNodesByReferencer}),e._originMap=o.groupOriginByCopy,e._strategy=i.strategy,e}(ks(e,{flags:n.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline},skipBackrefValidation:n.rules.allowOrphanBackrefs,unicodePropertyMap:Aa}),{accuracy:n.accuracy,asciiWordBoundaries:n.rules.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,bestEffortTarget:n.target}),r=function(e,t){const n=xa(t),i=Ca(n.target,"ES2024"),r=Ca(n.target,"ES2025"),o=n.rules.recursionLimit;if(!Number.isInteger(o)||o<2||o>20)throw new Error("Invalid recursionLimit; use 2-20");let s=null,a=null;if(!r){const t=[e.flags.ignoreCase];zs(e,Ja,{getCurrentModI:()=>t.at(-1),popModI(){t.pop()},pushModI(e){t.push(e)},setHasCasedChar(){t.at(-1)?s=!0:a=!0}})}const l={dotAll:e.flags.dotAll,ignoreCase:!(!e.flags.ignoreCase&&!s||a)};let d=e;const c={accuracy:n.accuracy,appliedGlobalFlags:l,captureMap:/* @__PURE__ */new Map,currentFlags:{dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},inCharClass:!1,lastNode:d,originMap:e._originMap,recursionLimit:o,useAppliedIgnoreCase:!(r||!s||!a),useFlagMods:r,useFlagV:i,verbose:n.verbose};function u(e){return c.lastNode=d,d=e,function(e,t){if(null==e)throw new Error(null!=t?t:"Value expected");return e}(Za[e.type],`Unexpected node type "${e.type}"`)(e,c,u)}const h={pattern:e.body.map(u).join("|"),flags:u(e.flags),options:{...e.options}};return i||(delete h.options.force.v,h.options.disable.v=!0,h.options.unicodeSetsPlugin=null),h._captureTransfers=/* @__PURE__ */new Map,h._hiddenCaptures=[],c.captureMap.forEach((e,t)=>{e.hidden&&h._hiddenCaptures.push(t),e.transferTo&&ya(h._captureTransfers,e.transferTo,[]).push(t)}),h}(i,n),o=function(e,t){var n;const{hiddenCaptures:i,mode:r}={hiddenCaptures:[],mode:"plugin",...t};let o=null!=(n=null==t?void 0:t.captureTransfers)?n:/* @__PURE__ */new Map;if(!new RegExp(ra,"su").test(e))return{pattern:e,captureTransfers:o,hiddenCaptures:i};if("plugin"===r&&Ys(e,na`\(\?\(DEFINE\)`,Ks.DEFAULT))throw new Error("DEFINE groups cannot be used with recursion");const s=[],a=Ys(e,na`\\[1-9]`,Ks.DEFAULT),l=/* @__PURE__ */new Map,d=[];let c,u=!1,h=0,f=0;for(aa.lastIndex=0;c=aa.exec(e);){const{0:t,groups:{captureName:n,rDepth:p,gRNameOrNum:m,gRDepth:g}}=c;if("["===t)h++;else if(h)"]"===t&&h--;else{if(p){if(da(p),u)throw new Error(la);if(a)throw new Error(("external"===r?"Backrefs":"Numbered backrefs")+" cannot be used with global recursion");const t=e.slice(0,c.index),n=e.slice(aa.lastIndex);if(Ys(n,ra,Ks.DEFAULT))throw new Error(la);const l=+p-1;e=ca(t,n,l,!1,i,s,f),o=fa(o,t,l,s.length,0,f);break}if(m){da(g);let n=!1;for(const e of d)if(e.name===m||e.num===+m){if(n=!0,e.hasRecursedWithin)throw new Error(la);break}if(!n)throw new Error(na`Recursive \g cannot be used outside the referenced group "${"external"===r?m:na`\g<${m}&R=${g}>`}"`);const h=l.get(m),p=Js(e,h);if(a&&Ys(p,na`${oa}|\((?!\?)`,Ks.DEFAULT))throw new Error(("external"===r?"Backrefs":"Numbered backrefs")+" cannot be used with recursion of capturing groups");const v=e.slice(h,c.index),b=p.slice(v.length+t.length),y=s.length,C=+g-1,S=ca(v,b,C,!0,i,s,f);o=fa(o,v,C,s.length-y,y,f);const k=e.slice(0,h),x=e.slice(h+p.length);e=`${k}${S}${x}`,aa.lastIndex+=S.length-t.length-v.length-b.length,d.forEach(e=>e.hasRecursedWithin=!0),u=!0}else if(n)f++,l.set(String(f),aa.lastIndex),l.set(n,aa.lastIndex),d.push({num:f,name:n});else if("("===t[0]){const e="("===t;e&&(f++,l.set(String(f),aa.lastIndex)),d.push(e?{num:f}:{})}else")"===t&&d.pop()}}return i.push(...s),{pattern:e,captureTransfers:o,hiddenCaptures:i}}(r.pattern,{captureTransfers:r._captureTransfers,hiddenCaptures:r._hiddenCaptures,mode:"external"}),s=function(e,t){var n,i;const r=null!=(n=null==t?void 0:t.hiddenCaptures)?n:[];let o=null!=(i=null==t?void 0:t.captureTransfers)?i:/* @__PURE__ */new Map;if(!/\(\?>/.test(e))return{pattern:e,captureTransfers:o,hiddenCaptures:r};const s=[0],a=[];let l,d=0,c=0,u=NaN;do{l=!1;let t,n=0,i=0,h=!1;for(Zs.lastIndex=Number.isNaN(u)?0:u+7;t=Zs.exec(e);){const{0:f,index:p,groups:{capturingStart:m,noncapturingStart:g}}=t;if("["===f)n++;else if(n)"]"===f&&n--;else if("(?>"!==f||h){if(h&&g)i++;else if(m)h?i++:(d++,s.push(d+c));else if(")"===f&&h){if(!i){c++;const t=d+c;if(e=`${e.slice(0,u)}(?:(?=(${e.slice(u+3,p)}))<$$${t}>)${e.slice(p+1)}`,l=!0,a.push(t),Vs(r,t),o.size){const e=/* @__PURE__ */new Map;o.forEach((n,i)=>{e.set(i>=t?i+1:i,n.map(e=>e>=t?e+1:e))}),o=e}break}i--}}else u=p,h=!0}}while(l);return r.push(...a),{pattern:e=Xs(e,String.raw`\\(?<backrefNum>[1-9]\d*)|<\$\$(?<wrappedBackrefNum>\d+)>`,({0:e,groups:{backrefNum:t,wrappedBackrefNum:n}})=>{if(t){const n=+t;if(n>s.length-1)throw new Error(`Backref "${e}" greater than number of captures`);return`\\${s[n]}`}return`\\${n}`},Ks.DEFAULT),captureTransfers:o,hiddenCaptures:r}}(function(e){if(!new RegExp(`${ea}\\+`).test(e))return{pattern:e};const t=[];let n,i=null,r=null,o="",s=0;for(ta.lastIndex=0;n=ta.exec(e);){const{0:a,index:l,groups:{qBase:d,qMod:c,invalidQ:u}}=n;if("["===a)s||(r=l),s++;else if("]"===a)s?s--:r=null;else if(!s)if("+"===c&&o&&!o.startsWith("(")){if(u)throw new Error(`Invalid quantifier "${a}"`);let t=-1;if(/^\{\d+\}$/.test(d))e=qs(e,l+d.length,c,"");else{if(")"===o||"]"===o){const t=")"===o?i:r;if(null===t)throw new Error(`Invalid unmatched "${o}"`);e=`${e.slice(0,t)}(?>${e.slice(t,l)}${d})${e.slice(l+a.length)}`}else e=`${e.slice(0,l-o.length)}(?>${o}${d})${e.slice(l+a.length)}`;t+=4}ta.lastIndex+=t}else"("===a[0]?t.push(l):")"===a&&(i=t.length?t.pop():null);o=a}return{pattern:e}}(o.pattern).pattern,{captureTransfers:o.captureTransfers,hiddenCaptures:o.hiddenCaptures}),a={pattern:s.pattern,flags:`${n.hasIndices?"d":""}${n.global?"g":""}${r.flags}${r.options.disable.v?"u":"v"}`};if(n.avoidSubclass){if(n.lazyCompileLength!==1/0)throw new Error("Lazy compilation requires subclass")}else{const e=s.hiddenCaptures.sort((e,t)=>e-t),t=Array.from(s.captureTransfers),r=i._strategy,o=a.pattern.length>=n.lazyCompileLength;(e.length||t.length||r||o)&&(a.options={...e.length&&{hiddenCaptures:e},...t.length&&{transfers:t},...r&&{strategy:r},...o&&{lazyCompile:o}})}return a}(e,t);return n.options?new cl(n.pattern,n.flags,n.options):new RegExp(n.pattern,n.flags)}function fl(e,t){return hl(e,{global:!0,hasIndices:!0,lazyCompileLength:3e3,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...t})}function pl(e={}){const t={target:"auto",cache:/* @__PURE__ */new Map,...e};return t.regexConstructor||(t.regexConstructor=e=>fl(e,{target:t.target})),{createScanner:e=>new Uo(e,t),createString:e=>({content:e})}}async function ml(e){if(Tn())throw new Error(`resolveLanguage("${e}") cannot be called from a worker context. Languages must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);const t=Cn.get(e);if(null!=t)return t;try{let t=Sn.get(e);if(null==t&&Object.prototype.hasOwnProperty.call(_n,e)&&(t=_n[e]),null==t)throw new Error(`resolveLanguage: "${e}" not found in bundled or custom languages`);const n=t().then(({default:t})=>{const n={name:e,data:t};return yn.has(e)||yn.set(e,n),n});return Cn.set(e,n),await n}finally{Cn.delete(e)}}function gl(e){var t;return null!=(t=yn.get(e))?t:ml(e)}Pn(/* @__PURE__ */Rn({bundledLanguages:()=>_n,bundledLanguagesAlias:()=>Hn,bundledLanguagesBase:()=>Dn,bundledLanguagesInfo:()=>Nn,bundledThemes:()=>jn,bundledThemesInfo:()=>On,codeToHast:()=>_o,codeToHtml:()=>Ho,codeToTokens:()=>Oo,codeToTokensBase:()=>jo,codeToTokensWithThemes:()=>Fo,createHighlighter:()=>Do,createJavaScriptRegexEngine:()=>pl,createOnigurumaEngine:()=>Zn,defaultJavaScriptRegexConstructor:()=>fl,getLastGrammarState:()=>$o,getSingletonHighlighter:()=>Bo,loadWasm:()=>Yn}),No);const vl=/* @__PURE__ */new Set;function bl(e){const t=[],n=/* @__PURE__ */new Set;for(const h of function(e){return yl(e)||function(e){return"string"==typeof e.name&&"function"==typeof e.load}(e)}(i=e.themes)?[i]:i){const e=yl(h)?h.getThemes():[h];for(const i of e){if(n.has(i.name))throw new Error(`Theme collection already contains theme "${i.name}"`);n.add(i.name),t.push(i)}}var i;const r=Object.freeze([...t]),o=Object.freeze(r.filter(e=>"light"===e.colorScheme)),s=Object.freeze(r.filter(e=>"dark"===e.colorScheme)),a=new Map(r.map(e=>[e.name,e])),l=Object.freeze(r.map(e=>e.name)),d=Object.freeze(o.map(e=>e.name)),c=Object.freeze(s.map(e=>e.name));function u(e){if(null==e)return r;const{colorScheme:t,collection:n}=e;return null==n?"light"===t?o:"dark"===t?s:r:r.filter(e=>e.collection===n&&(null==t||e.colorScheme===t))}return{getTheme:e=>a.get(e),getThemes:e=>u(e),getThemeNames:e=>null==(null==e?void 0:e.collection)?"light"===(null==e?void 0:e.colorScheme)?d:"dark"===(null==e?void 0:e.colorScheme)?c:l:u(e).map(e=>e.name),hasTheme:e=>a.has(e),orderBy:e=>bl({themes:r.map((e,t)=>({descriptor:e,index:t})).sort((t,n)=>{const i=e(t.descriptor,n.descriptor);return 0!==i?i:t.index-n.index}).map(e=>e.descriptor)}),pick(e){const t=[],n=/* @__PURE__ */new Set;for(const i of e){if(n.has(i))throw new Error(`Theme collection pick already includes theme "${i}"`);n.add(i);const e=a.get(i);if(null==e)throw new Error(`Theme collection does not contain theme "${i}"`);t.push(e)}return bl({themes:t})},registerInto(e){for(const t of r)e.registerThemeIfAbsent(t.name,t.load)}}}function yl(e){return"function"==typeof e.getThemes}function Cl(e){return null!==e&&"object"==typeof e&&"default"in e?e.default:e}var Sl=class extends Error{constructor(e){super(`Theme "${e}" is already registered`),this.name="DuplicateThemeError"}},kl=class extends Error{constructor(e){super(`No loader registered for theme "${e}"`),this.name="UnregisteredThemeError"}},xl=class extends Error{constructor(e){super(`Theme "${e}" has not been resolved`),this.name="UnresolvedThemeError"}};const wl=function(){const e=/* @__PURE__ */new Map,t=/* @__PURE__ */new Map,n=/* @__PURE__ */new Map;let i=0;function r(r){const o=t.get(r);if(void 0!==o)return Promise.resolve(o);const s=n.get(r);if(void 0!==s)return s;const a=e.get(r);if(void 0===a)return Promise.reject(new kl(r));const l=i,d=a().then(e=>{const o=Cl(e);return l===i&&t.set(r,o),n.get(r)===d&&n.delete(r),o}).catch(e=>{throw n.get(r)===d&&n.delete(r),e});return n.set(r,d),d}function o(e,n){t.set(e,n)}return{clearResolvedThemes:function(){i++,t.clear(),n.clear()},getResolvedOrResolveTheme:function(e){const n=t.get(e);return void 0!==n?n:r(e)},getResolvedTheme:function(e){return t.get(e)},getResolvedThemes:function(e){const n=[];for(const i of e){const e=t.get(i);if(void 0===e)throw new xl(i);n.push(e)}return n},hasRegisteredTheme:function(t){return e.has(t)},hasResolvedTheme:function(e){return t.has(e)},hasResolvedThemes:function(e){for(const n of e)if(!t.has(n))return!1;return!0},registerTheme:function(t,n){if(e.has(t))throw new Sl(t);e.set(t,n)},registerThemeIfAbsent:function(t,n){return!e.has(t)&&(e.set(t,n),!0)},resolveTheme:r,resolveThemes:function(e){return Promise.all(e.map(e=>r(e)))},seedResolvedTheme:o,seedResolvedThemes:function(e){for(const[t,n]of e)o(t,n)}}}();function Ll(e,t){e=Array.isArray(e)?e:[e];for(let n of e){let e;if("string"==typeof n){if(e=wl.getResolvedTheme(n),null==e)throw new Error(`loadResolvedThemes: ${n} is not resolved, you must resolve it before calling loadResolvedThemes`)}else e=n,n=n.name,null==wl.getResolvedTheme(n)&&wl.seedResolvedTheme(n,e);vl.has(n)||(vl.add(n),t.loadThemeSync(e))}}function Tl(){wl.clearResolvedThemes(),vl.clear()}function Al({name:e,load:t,colorScheme:n,collection:i,displayName:r}){return{name:e,colorScheme:n,collection:i,displayName:r,load:(o=t,async()=>Rr(Cl(await o())))};var o}const Il=["pierre-light","pierre-light-soft","pierre-light-vibrant","pierre-light-protanopia-deuteranopia","pierre-light-tritanopia"],El=[...Il,"pierre-dark","pierre-dark-soft","pierre-dark-vibrant","pierre-dark-protanopia-deuteranopia","pierre-dark-tritanopia"],Ml=new Set(Il);function Rl(e){return Ml.has(e)?"light":"dark"}const Pl={"pierre-dark":"Pierre Dark","pierre-dark-soft":"Pierre Dark Soft","pierre-dark-vibrant":"Pierre Dark Vibrant","pierre-dark-protanopia-deuteranopia":"Pierre Dark Protanopia & Deuteranopia","pierre-dark-tritanopia":"Pierre Dark Tritanopia","pierre-light":"Pierre Light","pierre-light-soft":"Pierre Light Soft","pierre-light-vibrant":"Pierre Light Vibrant","pierre-light-protanopia-deuteranopia":"Pierre Light Protanopia & Deuteranopia","pierre-light-tritanopia":"Pierre Light Tritanopia"},Nl={"pierre-dark":()=>import("./pierre-dark-CyvmCCZW.js"),"pierre-dark-soft":()=>import("./pierre-dark-soft-BHGpRqa4.js"),"pierre-dark-vibrant":()=>import("./pierre-dark-vibrant-BWBVywrn.js"),"pierre-dark-protanopia-deuteranopia":()=>import("./pierre-dark-protanopia-deuteranopia-Rgc0TwpF.js"),"pierre-dark-tritanopia":()=>import("./pierre-dark-tritanopia-Beq2gCRQ.js"),"pierre-light":()=>import("./pierre-light-480U9XYS.js"),"pierre-light-soft":()=>import("./pierre-light-soft-CVdyfjmI.js"),"pierre-light-vibrant":()=>import("./pierre-light-vibrant-DdTDNdfJ.js"),"pierre-light-protanopia-deuteranopia":()=>import("./pierre-light-protanopia-deuteranopia-CaVOBURG.js"),"pierre-light-tritanopia":()=>import("./pierre-light-tritanopia-B4_gpKOM.js")},Dl=bl({themes:El.map(e=>function(e){return Al({name:e,collection:"pierre",colorScheme:Rl(e),displayName:Pl[e],load:Nl[e]})}(e))}),Hl=["ayu-light","catppuccin-latte","everforest-light","github-light","github-light-default","github-light-high-contrast","gruvbox-light-hard","gruvbox-light-medium","gruvbox-light-soft","horizon-bright","kanagawa-lotus","light-plus","material-theme-lighter","min-light","night-owl-light","one-light","rose-pine-dawn","slack-ochin","snazzy-light","solarized-light","vitesse-light"],_l=new Set(Hl);function Ol(e){return _l.has(e)?"light":"dark"}const jl={andromeeda:()=>import("./andromeeda-C4gqWexZ.js"),"aurora-x":()=>import("./aurora-x-D-2ljcwZ.js"),"ayu-dark":()=>import("./ayu-dark-DYE7WIF3.js"),"ayu-light":()=>import("./ayu-light-BA47KaF1.js"),"ayu-mirage":()=>import("./ayu-mirage-32ctXXKs.js"),"catppuccin-frappe":()=>import("./catppuccin-frappe-DFWUc33u.js"),"catppuccin-latte":()=>import("./catppuccin-latte-C9dUb6Cb.js"),"catppuccin-macchiato":()=>import("./catppuccin-macchiato-DQyhUUbL.js"),"catppuccin-mocha":()=>import("./catppuccin-mocha-D87Tk5Gz.js"),"dark-plus":()=>import("./dark-plus-C3mMm8J8.js"),dracula:()=>import("./dracula-BzJJZx-M.js"),"dracula-soft":()=>import("./dracula-soft-BXkSAIEj.js"),"everforest-dark":()=>import("./everforest-dark-BgDCqdQA.js"),"everforest-light":()=>import("./everforest-light-C8M2exoo.js"),"github-dark":()=>import("./github-dark-DHJKELXO.js"),"github-dark-default":()=>import("./github-dark-default-Cuk6v7N8.js"),"github-dark-dimmed":()=>import("./github-dark-dimmed-DH5Ifo-i.js"),"github-dark-high-contrast":()=>import("./github-dark-high-contrast-E3gJ1_iC.js"),"github-light":()=>import("./github-light-DAi9KRSo.js"),"github-light-default":()=>import("./github-light-default-D7oLnXFd.js"),"github-light-high-contrast":()=>import("./github-light-high-contrast-BfjtVDDH.js"),"gruvbox-dark-hard":()=>import("./gruvbox-dark-hard-CFHQjOhq.js"),"gruvbox-dark-medium":()=>import("./gruvbox-dark-medium-GsRaNv29.js"),"gruvbox-dark-soft":()=>import("./gruvbox-dark-soft-CVdnzihN.js"),"gruvbox-light-hard":()=>import("./gruvbox-light-hard-CH1njM8p.js"),"gruvbox-light-medium":()=>import("./gruvbox-light-medium-DRw_LuNl.js"),"gruvbox-light-soft":()=>import("./gruvbox-light-soft-hJgmCMqR.js"),horizon:()=>import("./horizon-BUw7H-hv.js"),"horizon-bright":()=>import("./horizon-bright-CUuTKBJd.js"),houston:()=>import("./houston-DnULxvSX.js"),"kanagawa-dragon":()=>import("./kanagawa-dragon-CkXjmgJE.js"),"kanagawa-lotus":()=>import("./kanagawa-lotus-CfQXZHmo.js"),"kanagawa-wave":()=>import("./kanagawa-wave-DWedfzmr.js"),laserwave:()=>import("./laserwave-DUszq2jm.js"),"light-plus":()=>import("./light-plus-B7mTdjB0.js"),"material-theme":()=>import("./material-theme-D5KoaKCx.js"),"material-theme-darker":()=>import("./material-theme-darker-BfHTSMKl.js"),"material-theme-lighter":()=>import("./material-theme-lighter-B0m2ddpp.js"),"material-theme-ocean":()=>import("./material-theme-ocean-CyktbL80.js"),"material-theme-palenight":()=>import("./material-theme-palenight-Csfq5Kiy.js"),"min-dark":()=>import("./min-dark-CafNBF8u.js"),"min-light":()=>import("./min-light-CTRr51gU.js"),monokai:()=>import("./monokai-D4h5O-jR.js"),"night-owl":()=>import("./night-owl-C39BiMTA.js"),"night-owl-light":()=>import("./night-owl-light-CMTm3GFP.js"),nord:()=>import("./nord-Ddv68eIx.js"),"one-dark-pro":()=>import("./one-dark-pro-DVMEJ2y_.js"),"one-light":()=>import("./one-light-C3Wv6jpd.js"),plastic:()=>import("./plastic-3e1v2bzS.js"),poimandres:()=>import("./poimandres-CS3Unz2-.js"),red:()=>import("./red-bN70gL4F.js"),"rose-pine":()=>import("./rose-pine-qdsjHGoJ.js"),"rose-pine-dawn":()=>import("./rose-pine-dawn-DHQR4-dF.js"),"rose-pine-moon":()=>import("./rose-pine-moon-D4_iv3hh.js"),"slack-dark":()=>import("./slack-dark-BthQWCQV.js"),"slack-ochin":()=>import("./slack-ochin-DqwNpetd.js"),"snazzy-light":()=>import("./snazzy-light-Bw305WKR.js"),"solarized-dark":()=>import("./solarized-dark-DXbdFlpD.js"),"solarized-light":()=>import("./solarized-light-L9t79GZl.js"),"synthwave-84":()=>import("./synthwave-84-ChtBzv_y.js"),"tokyo-night":()=>import("./tokyo-night-hegEt444.js"),vesper:()=>import("./vesper-DRje8inN.js"),"vitesse-black":()=>import("./vitesse-black-Bkuqu6BP.js"),"vitesse-dark":()=>import("./vitesse-dark-D0r3Knsf.js"),"vitesse-light":()=>import("./vitesse-light-CVO1_9PV.js")};function Fl(e){return Al({name:e,collection:"shiki",colorScheme:Ol(e),load:jl[e]})}const Bl=bl({themes:Object.freeze([...Hl.map(e=>Fl(e)),...["andromeeda","aurora-x","ayu-dark","ayu-mirage","catppuccin-frappe","catppuccin-macchiato","catppuccin-mocha","dark-plus","dracula","dracula-soft","everforest-dark","github-dark","github-dark-default","github-dark-dimmed","github-dark-high-contrast","gruvbox-dark-hard","gruvbox-dark-medium","gruvbox-dark-soft","horizon","houston","kanagawa-dragon","kanagawa-wave","laserwave","material-theme","material-theme-darker","material-theme-ocean","material-theme-palenight","min-dark","monokai","night-owl","nord","one-dark-pro","plastic","poimandres","red","rose-pine","rose-pine-moon","slack-dark","solarized-dark","synthwave-84","tokyo-night","vesper","vitesse-black","vitesse-dark"].map(e=>Fl(e))])});function $l(e){if(Tn())throw new Error(`Theme "${e}" cannot be resolved from a worker context. Themes must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);if(wl.hasRegisteredTheme(e))return;const t=Bl.getTheme(e);if(null==t)throw new Error(`No valid theme loader registered for "${e}"`);wl.registerThemeIfAbsent(t.name,t.load)}function zl(e,t){if(t.name!==e)throw new Error(`resolvedTheme: themeName: ${e} does not match theme.name: ${t.name}`)}async function Ul(e){$l(e);const t=await wl.resolveTheme(e);return zl(e,t),t}function Gl(e){var t;return null!=(t=wl.getResolvedTheme(e))?t:Ul(e)}let Wl;async function Vl({themes:e,langs:t,preferredHighlighter:n="shiki-js"}){null!=Wl||(Wl=Do({themes:[],langs:["text"],engine:"shiki-wasm"===n?Zn(import("./wasm--yL7jHw-.js")):pl()}));const i=Xl(Wl)?await Wl:Wl;Wl=i;const r=[];for(const s of t){if("text"===s||"ansi"===s)continue;const e=gl(s);"then"in e?r.push(e):wn(e,i)}const o=[];for(const s of e){const e=Gl(s);"then"in e?o.push(e):Ll(e,Wl)}return(r.length>0||o.length>0)&&await Promise.all([Promise.all(r).then(e=>{wn(e,i)}),Promise.all(o).then(e=>{Ll(e,i)})]),i}function ql(e=Wl){return null!=e&&!("then"in e)}function Kl(){if(null!=Wl&&!("then"in Wl))return Wl}function Xl(e=Wl){return null!=e&&"then"in e}function Ql(e=Wl){return null==e}async function Yl(e){await Vl(e)}async function Jl(){null!=Wl&&((await Wl).dispose(),Ln(),Tl(),Wl=void 0)}bl({themes:[Dl,Bl]});for(const cp of Dl.getThemes())wl.registerThemeIfAbsent(cp.name,cp.load);function Zl(e=G){const t=[];return"string"==typeof e?t.push(e):(t.push(e.dark),t.push(e.light)),t}function ed(e){for(const t of Zl(e))if(!vl.has(t))return!1;return!0}function td(e){return wl.hasResolvedThemes(e)}function nd(e,t){return ue(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength}function id(e,t){return(null==e?void 0:e.cacheKey)===(null==t?void 0:t.cacheKey)&&(null==e?void 0:e.contents)===(null==t?void 0:t.contents)&&(null==e?void 0:e.name)===(null==t?void 0:t.name)&&(null==e?void 0:e.lang)===(null==t?void 0:t.lang)}function rd(e,t){return null==e||null==t?e===t:e.startingLine===t.startingLine&&e.totalLines===t.totalLines&&e.bufferBefore===t.bufferBefore&&e.bufferAfter===t.bufferAfter}function od(e){var t;return be({tagName:"div",children:[be({tagName:"div",children:null==(t=e.annotations)?void 0:t.map(e=>be({tagName:"slot",properties:{name:e}})),properties:{"data-annotation-content":""}})],properties:{"data-line-annotation":`${e.hunkIndex},${e.lineIndex}`}})}function sd(e){switch(e){case"file":return"diffs-icon-file-code";case"change":return"diffs-icon-symbol-modified";case"new":return"diffs-icon-symbol-added";case"deleted":return"diffs-icon-symbol-deleted";case"rename-pure":case"rename-changed":return"diffs-icon-symbol-moved"}}function ad({fileOrDiff:e,mode:t,stickyHeader:n}){var i;const r="type"in e?e:void 0,o={"data-diffs-header":t,"data-change-type":null==r?void 0:r.type,"data-sticky":n?"":void 0};return be({tagName:"div",children:["custom"===t?be({tagName:"slot",properties:{name:U}}):ld({name:e.name,prevName:"prevName"in e?e.prevName:void 0,iconType:null!=(i=null==r?void 0:r.type)?i:"file"}),..."custom"===t?[]:[dd(r)]],properties:o})}function ld({name:e,prevName:t,iconType:n}){const i=[be({tagName:"slot",properties:{name:$}}),ye({name:sd(n),properties:{"data-change-icon":n}})];return null!=t&&(i.push(be({tagName:"div",children:[be({tagName:"bdi",children:[ve(t)]})],properties:{"data-prev-name":""}})),i.push(ye({name:"diffs-icon-arrow-right-short",properties:{"data-rename-icon":""}}))),i.push(be({tagName:"div",children:[be({tagName:"bdi",children:[ve(e)]})],properties:{"data-title":""}})),be({tagName:"div",children:i,properties:{"data-header-content":""}})}function dd(e){const t=[];if(null!=e){let n=0,i=0;for(const t of e.hunks)n+=t.additionLines,i+=t.deletionLines;(i>0||0===n)&&t.push(be({tagName:"span",children:[ve(`-${i}`)],properties:{"data-deletions-count":""}})),(n>0||0===i)&&t.push(be({tagName:"span",children:[ve(`+${n}`)],properties:{"data-additions-count":""}}))}return t.push(be({tagName:"slot",properties:{name:z}})),be({tagName:"div",children:t,properties:{"data-metadata":""}})}function cd(e){return be({tagName:"pre",properties:ud(e)})}function ud({diffIndicators:e,disableBackground:t,disableLineNumbers:n,overflow:i,split:r,totalLines:o,type:s,customProperties:a}){return{...a,"data-diff":"diff"===s?"":void 0,"data-file":"file"===s?"":void 0,"data-diff-type":"diff"===s?r?"split":"single":void 0,"data-overflow":i,"data-disable-line-numbers":n?"":void 0,"data-background":t?void 0:"","data-indicators":"bars"===e||"classic"===e?e:void 0,style:`--diffs-min-number-column-width-default:${`${o}`.length}ch;`}}const hd=/* @__PURE__ */new Map;let fd=0;const pd={"1c":"1c",abap:"abap",as:"actionscript-3",ada:"ada",adb:"ada",ads:"ada",adoc:"asciidoc",asciidoc:"asciidoc","component.html":"angular-html","component.ts":"angular-ts",conf:"nginx",htaccess:"apache",cls:"tex",trigger:"apex",apl:"apl",applescript:"applescript",scpt:"applescript",ara:"ara",asm:"asm",s:"riscv",astro:"astro",awk:"awk",bal:"ballerina",sh:"zsh",bash:"zsh",bat:"cmd",cmd:"cmd",be:"berry",beancount:"beancount",bib:"bibtex",bicep:"bicep","blade.php":"blade",bsl:"bsl",c:"c",h:"objective-cpp",cs:"csharp",cpp:"cpp",hpp:"cpp",cc:"cpp",cxx:"cpp",hh:"cpp",cdc:"cdc",cairo:"cairo",clar:"clarity",clj:"clojure",cljs:"clojure",cljc:"clojure",soy:"soy",cmake:"cmake","CMakeLists.txt":"cmake",cob:"cobol",cbl:"cobol",cobol:"cobol",CODEOWNERS:"codeowners",ql:"ql",coffee:"coffeescript",lisp:"lisp",cl:"lisp",lsp:"lisp",log:"log",v:"verilog",cql:"cql",cr:"crystal",css:"css",csv:"csv",cue:"cue",cypher:"cypher",cyp:"cypher",d:"d",dart:"dart",dax:"dax",desktop:"desktop",diff:"diff",patch:"diff",Dockerfile:"dockerfile",dockerfile:"dockerfile",env:"dotenv",dm:"dream-maker",edge:"edge",el:"emacs-lisp",ex:"elixir",exs:"elixir",elm:"elm",erb:"erb",erl:"erlang",hrl:"erlang",f:"fortran-fixed-form",for:"fortran-fixed-form",fs:"fsharp",fsi:"fsharp",fsx:"fsharp",f03:"f03",f08:"f08",f18:"f18",f77:"f77",f90:"fortran-free-form",f95:"fortran-free-form",fnl:"fennel",fish:"fish",ftl:"ftl",tres:"gdresource",res:"gdresource",gd:"gdscript",gdshader:"gdshader",gs:"genie",feature:"gherkin",COMMIT_EDITMSG:"git-commit","git-rebase-todo":"git-rebase",gjs:"glimmer-js",gleam:"gleam",gts:"glimmer-ts",glsl:"glsl",vert:"glsl",frag:"glsl",shader:"shaderlab",gp:"gnuplot",plt:"gnuplot",gnuplot:"gnuplot",go:"go",graphql:"graphql",gql:"graphql",groovy:"groovy",gvy:"groovy",hack:"hack",haml:"haml",hbs:"handlebars",handlebars:"handlebars",hs:"haskell",lhs:"haskell",hx:"haxe",hcl:"hcl",hjson:"hjson",hlsl:"hlsl",fx:"hlsl",html:"html",htm:"html",http:"http",rest:"http",hxml:"hxml",hy:"hy",imba:"imba",ini:"ini",cfg:"ini",jade:"pug",pug:"pug",java:"java",js:"javascript",mjs:"javascript",cjs:"javascript",jinja:"jinja",jinja2:"jinja",j2:"jinja",jison:"jison",jl:"julia",json:"json",json5:"json5",jsonc:"jsonc",jsonl:"jsonl",jsonnet:"jsonnet",libsonnet:"jsonnet",jssm:"jssm",jsx:"jsx",kt:"kotlin",kts:"kts",kql:"kusto",tex:"tex",ltx:"tex",lean:"lean4",less:"less",liquid:"liquid",lit:"lit",ll:"llvm",logo:"logo",lua:"lua",luau:"luau",Makefile:"makefile",mk:"makefile",makefile:"makefile",md:"markdown",markdown:"markdown",marko:"marko",m:"wolfram",mat:"matlab",mdc:"mdc",mdx:"mdx",wiki:"wikitext",mediawiki:"wikitext",mmd:"mermaid",mermaid:"mermaid",mips:"mipsasm",mojo:"mojo","🔥":"mojo",move:"move",nar:"narrat",nf:"nextflow",nim:"nim",nims:"nim",nimble:"nim",nix:"nix",nu:"nushell",mm:"objective-cpp",ml:"ocaml",mli:"ocaml",mll:"ocaml",mly:"ocaml",pas:"pascal",p:"pascal",pl:"prolog",pm:"perl",t:"perl",raku:"raku",p6:"raku",pl6:"raku",php:"php",phtml:"php",pls:"plsql",sql:"sql",po:"po",polar:"polar",pcss:"postcss",pot:"pot",potx:"potx",pq:"powerquery",pqm:"powerquery",ps1:"powershell",psm1:"powershell",psd1:"powershell",prisma:"prisma",pro:"prolog",P:"prolog",properties:"properties",proto:"protobuf",pp:"puppet",purs:"purescript",py:"python",pyw:"python",pyi:"python",qml:"qml",qmldir:"qmldir",qss:"qss",r:"r",R:"r",rkt:"racket",rktl:"racket",razor:"razor",cshtml:"razor",rb:"ruby",rbw:"ruby",reg:"reg",regex:"regexp",rel:"rel",rs:"rust",rst:"rst",rake:"ruby",gemspec:"ruby",jbuilder:"ruby",builder:"ruby",rabl:"ruby",arb:"ruby",ru:"ruby",podspec:"ruby",Gemfile:"ruby",Rakefile:"ruby",Guardfile:"ruby",Capfile:"ruby",Berksfile:"ruby",Brewfile:"ruby",Vagrantfile:"ruby",Thorfile:"ruby",Appraisals:"ruby",Dangerfile:"ruby",sas:"sas",sass:"sass",scala:"scala",sc:"scala",scm:"scheme",ss:"scheme",sld:"scheme",scss:"scss",sdbl:"sdbl",shadergraph:"shader",st:"smalltalk",sol:"solidity",sparql:"sparql",rq:"sparql",spl:"splunk",config:"ssh-config",do:"stata",ado:"stata",dta:"stata",styl:"stylus",stylus:"stylus",svelte:"svelte",swift:"swift",sv:"system-verilog",svh:"system-verilog",service:"systemd",socket:"systemd",device:"systemd",timer:"systemd",talon:"talonscript",tasl:"tasl",tcl:"tcl",templ:"templ",tf:"tf",tfvars:"tfvars",toml:"toml",ts:"typescript",tsp:"typespec",tsv:"tsv",tsx:"tsx",ttl:"turtle",twig:"twig",typ:"typst",vv:"v",vala:"vala",vapi:"vala",vb:"vb",vbs:"vb",bas:"vb",vh:"verilog",vhd:"vhdl",vhdl:"vhdl",vim:"vimscript",vue:"vue","vine.ts":"vue-vine",vy:"vyper",wasm:"wasm",wat:"wasm",wy:"文言",wgsl:"wgsl",wit:"wit",wl:"wolfram",nb:"wolfram",xml:"xml",xsl:"xsl",xslt:"xsl",yaml:"yaml",yml:"yml",zs:"zenscript",zig:"zig",zsh:"zsh",sty:"tex"};function md(e){var t,n,i,r,o,s,a;if(hd.has(e))return null!=(t=hd.get(e))?t:"text";if(null!=pd[e])return pd[e];const l=e.match(/\.([^/\\]+\.[^/\\]+)$/);if(null!=l){if(hd.has(l[1]))return null!=(n=hd.get(l[1]))?n:"text";if(null!=pd[l[1]])return null!=(i=pd[l[1]])?i:"text"}const d=null!=(o=null==(r=e.match(/\.([^.]+)$/))?void 0:r[1])?o:"";return hd.has(d)?null!=(s=hd.get(d))?s:"text":null!=(a=pd[d])?a:"text"}function gd(e,t){if(e<=fd)return!1;hd.clear();for(const n in t){const e=t[n];null!=e&&hd.set(n,e)}return fd=e,!0}function vd(){return fd}function bd(e,t){const n=hd.get(e);return n!==t&&(null!=n&&console.warn(`setCustomExtension: overriding custom mapping for "${e}" from "${n}" to "${t}"`),hd.set(e,t),fd++,!0)}function yd(){return Object.fromEntries(hd)}function Cd(e,{theme:t,preferredHighlighter:n="shiki-js"}){return{langs:[null!=e?e:"text"],themes:Zl(t),preferredHighlighter:n}}function Sd(e){return`annotation-${"side"in e?`${e.side}-`:""}${e.lineNumber}`}function kd(e){return e.replace(/\n$|\r\n$/,"")}function xd(e,t,n){const i="function"==typeof n.lineInfo?n.lineInfo(t):n.lineInfo[t-1];if(null==i){const i=`processLine: line ${t}, contains no state.lineInfo`;throw console.error(i,{node:e,line:t,state:n}),new Error(i)}return e.tagName="div",e.properties["data-line"]=i.lineNumber,e.properties["data-alt-line"]=i.altLineNumber,e.properties["data-line-type"]=i.type,e.properties["data-line-index"]=i.lineIndex,0===e.children.length&&e.children.push(ve("\n")),e}const wd=/* @__PURE__ */Symbol("no-token"),Ld=/* @__PURE__ */Symbol("multiple-tokens");function Td(e){const t=function(e){const t=e.properties["data-char"];if("number"==typeof t)return t}(e);if(null!=t)return t;let n=wd;const i=[];let r,o=[];const s=()=>{if(0===o.length||null==r)return o=[],void(r=void 0);if(1===o.length){const t=o[0];if("element"===(null==t?void 0:t.type)){e=r,t.properties["data-char"]=e;for(const e of t.children)Ad(e)}else Ad(t);return i.push(t),o=[],void(r=void 0)}var e;for(const t of o)Ad(t);i.push(be({tagName:"span",properties:{"data-char":r},children:o})),o=[],r=void 0},a=e=>{e!==wd&&(e!==Ld?n!==wd?n!==e&&(n=Ld):n=e:n=Ld)};for(const l of e.children){const e="element"===l.type?Td(l):wd;a(e),"number"==typeof e?(null!=r&&r!==e&&s(),null!=r||(r=e),o.push(l)):(s(),i.push(l))}return s(),e.children=i,n}function Ad(e){if("element"===e.type){e.properties["data-char"]=void 0;for(const t of e.children)Ad(t)}}function Id(e=!1,t=!1){const n={lineInfo:[]},i=[{line:e=>(delete e.properties.class,e),pre(t){const i=Ce(t),r=[];if(null!=i){let t=1;for(const o of i.children)"element"===o.type&&(e&&Td(o),r.push(xd(o,t,n)),t++);i.children=r}return t},...e?{tokens(e){for(const t of e){let e=0;for(const n of t){const t=n;null!=t.__lineChar||(t.__lineChar=e),e+=n.content.length}}},preprocess(e,t){t.mergeWhitespaces="never"},span(e,t,n,i,r){if(null!=(null==r?void 0:r.offset)&&null!=r.content){const t=r.__lineChar;return null!=t&&(e.properties["data-char"]=t),e}return e}}:null}];return t&&i.push(Md,Ed),{state:n,transformers:i,toClass:Ed}}const Ed=function(e={}){const{classPrefix:t="__shiki_",classSuffix:n="",classReplacer:i=e=>e}=e,r=/* @__PURE__ */new Map;function o(e){return Object.entries(e).map(([e,t])=>`${e}:${t}`).join(";")}function s(e){let s=t+function(e,t=0){let n=3735928559^t,i=1103547991^t;for(let r,o=0;o<e.length;o++)r=e.charCodeAt(o),n=Math.imul(n^r,2654435761),i=Math.imul(i^r,1597334677);return n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(i^i>>>13,3266489909),i=Math.imul(i^i>>>16,2246822507),i^=Math.imul(n^n>>>13,3266489909),(4294967296*(2097151&i)+(n>>>0)).toString(36).slice(0,6)}("string"==typeof e?e:o(e))+n;return s=i(s),r.has(s)||r.set(s,"string"==typeof e?e:{...e}),s}return{name:"@shikijs/transformers:style-to-class",pre(e){if(!e.properties.style)return;const t=s(e.properties.style);delete e.properties.style,this.addClassToHast(e,t)},tokens(e){for(const t of e)for(const e of t){if(!e.htmlStyle)continue;const t=s(e.htmlStyle);e.htmlStyle={},e.htmlAttrs||(e.htmlAttrs={}),e.htmlAttrs.class?e.htmlAttrs.class+=` ${t}`:e.htmlAttrs.class=t}},getClassRegistry:()=>r,getCSS(){let e="";for(const[t,n]of r.entries())e+=`.${t}{${"string"==typeof n?n:o(n)}}`;return e},clearRegistry(){r.clear()}}}({classPrefix:"hl-"}),Md={name:"token-style-normalizer",tokens(e){for(const t of e)for(const e of t){if(null!=e.htmlStyle)continue;const t={};null!=e.color&&(t.color=e.color),null!=e.bgColor&&(t["background-color"]=e.bgColor),null!=e.fontStyle&&0!==e.fontStyle&&(1&e.fontStyle&&(t["font-style"]="italic"),2&e.fontStyle&&(t["font-weight"]="bold"),4&e.fontStyle&&(t["text-decoration"]="underline")),Object.keys(t).length>0&&(e.htmlStyle=t)}}};function Rd(e){return`--${"token"===e?"diffs-token":"diffs"}-`}const Pd=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,Nd=/^0(?:\.0+)?%?$/;function Dd(e){if(null==e)return null;const t=function(e){const t=/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})\b/i.exec(e.trim());if(null==t)return null;const n=t[1];let i,r=1;return 3===n.length?i=n.split("").map(e=>e+e).join(""):6===n.length?i=n:(i=n.slice(0,6),r=parseInt(n.slice(6,8),16)/255),[parseInt(i.slice(0,2),16),parseInt(i.slice(2,4),16),parseInt(i.slice(4,6),16),r]}(e);if(null==t)return null;const n=t[0]/255,i=t[1]/255,r=t[2]/255,o=e=>e<=.03928?e/12.92:((e+.055)/1.055)**2.4;return.2126*o(n)+.7152*o(i)+.0722*o(r)}function Hd(e){if(null==e)return!1;const t=e.trim().toLowerCase();if("transparent"===t)return!0;if(Pd.test(t))return!0;const n=function(e){var t;const n=e.indexOf("(");if(n<=0||!e.endsWith(")"))return;const i=e.slice(0,n).trim();if(!/^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)$/i.test(i))return;const r=e.slice(n+1,-1).trim();if(0===r.length)return;const o=r.lastIndexOf("/");if(-1!==o)return r.slice(o+1).trim();if(/^(?:rgba|hsla)$/i.test(i)){const e=r.split(",");if(4===e.length)return null==(t=e[3])?void 0:t.trim()}}(t);return null!=n&&Nd.test(n)}const _d=/* @__PURE__ */new WeakMap;function Od(e){var t,n,i,r,o,s,a,l,d;const c=_d.get(e);if(null!=c)return c;const u=null!=(t=e.colors)?t:{},h={...u},f=null!=(n=u["editor.background"])?n:e.bg,p=null!=(i=u["editor.foreground"])?i:e.fg,m=null!=(r=u["sideBar.background"])?r:f,g=null!=(o=u["sideBar.foreground"])?o:p;jd(h,"editor.background",f),jd(h,"editor.foreground",p),jd(h,"sideBar.background",m),jd(h,"sideBar.foreground",g),jd(h,"input.background",null!=(s=u["input.background"])?s:m),jd(h,"sideBarSectionHeader.foreground",null!=(a=u["sideBarSectionHeader.foreground"])?a:g),jd(h,"list.activeSelectionForeground",null!=(l=u["list.activeSelectionForeground"])?l:g),jd(h,"gitDecoration.addedResourceForeground",Fd(u["gitDecoration.addedResourceForeground"],u["terminal.ansiGreen"],u["editorGutter.addedBackground"])),jd(h,"gitDecoration.modifiedResourceForeground",Fd(u["gitDecoration.modifiedResourceForeground"],u["terminal.ansiBlue"],u["editorGutter.modifiedBackground"])),jd(h,"gitDecoration.deletedResourceForeground",Fd(u["gitDecoration.deletedResourceForeground"],u["terminal.ansiRed"],u["editorGutter.deletedBackground"]));const v=null!=(d=Hd(u["list.focusOutline"])?void 0:u["list.focusOutline"])?d:Hd(u.focusBorder)?void 0:u.focusBorder;null!=v?h["list.focusOutline"]=v:delete h["list.focusOutline"];const b=u["list.hoverBackground"];var y;null!=b&&(null!=(y=m)&&b.toLowerCase()===y.toLowerCase()||function(e,t,n){if(null==t||null==n)return!1;const i=Dd(e),r=Dd(t),o=Dd(n);return null!=i&&null!=r&&null!=o&&Math.abs(i-o)<Math.abs(i-r)}(b,m,g))&&delete h["list.hoverBackground"];const C=Object.freeze({...e,colors:Object.freeze(h)});return _d.set(e,C),C}function jd(e,t,n){null!=n&&""!==n&&(e[t]=n)}function Fd(...e){for(const t of e)if(null!=t&&""!==t)return t}function Bd({theme:e=G,highlighter:t,prefix:n}){let i="";if("string"==typeof e){const r=t.getTheme(e),o=Od(r);i+=`color:${o.fg};`,i+=`background-color:${o.bg};`,i+=`${Rd("global")}fg:${o.fg};`,i+=`${Rd("global")}bg:${o.bg};`,i+=$d(r,n)}else{let n=t.getTheme(e.dark),r=Od(n);i+=`${Rd("global")}dark:${r.fg};`,i+=`${Rd("global")}dark-bg:${r.bg};`,i+=$d(n,"dark"),n=t.getTheme(e.light),r=Od(n),i+=`${Rd("global")}light:${r.fg};`,i+=`${Rd("global")}light-bg:${r.bg};`,i+=$d(n,"light")}return i}function $d(e,t){var n,i,r,o,s,a,l,d,c;t=null!=t?`${t}-`:"";let u="";const h=null!=(r=null==(n=e.colors)?void 0:n["gitDecoration.addedResourceForeground"])?r:null==(i=e.colors)?void 0:i["terminal.ansiGreen"];null!=h&&(u+=`${Rd("global")}${t}addition-color:${h};`);const f=null!=(a=null==(o=e.colors)?void 0:o["gitDecoration.deletedResourceForeground"])?a:null==(s=e.colors)?void 0:s["terminal.ansiRed"];null!=f&&(u+=`${Rd("global")}${t}deletion-color:${f};`);const p=null!=(c=null==(l=e.colors)?void 0:l["gitDecoration.modifiedResourceForeground"])?c:null==(d=e.colors)?void 0:d["terminal.ansiBlue"];return null!=p&&(u+=`${Rd("global")}${t}modified-color:${p};`),u}function zd(e){let t=e.children[0];for(;null!=t;){if("element"===t.type&&"code"===t.tagName)return t.children;t="children"in t?t.children[0]:null}throw console.error(e),new Error("getLineNodes: Unable to find children")}function Ud({lines:e,startingLine:t=0,totalLines:n=1/0,callback:i}){const r=Math.min(t+n,e.length),o=(()=>{const t=e.at(-1);return""===t||"\n"===t||"\r\n"===t||"\r"===t?Math.max(0,e.length-2):e.length-1})();for(let s=t;s<r;s++){const t=s===o;if(!0===i({lineIndex:s,lineNumber:s+1,content:e[s],isLastLine:t})||t)break}}function Gd(e){return""!==e?e.split(P):[]}const Wd={forcePlainText:!1};function Vd(e,t,{theme:n=G,tokenizeMaxLineLength:i,useTokenTransformer:r},{forcePlainText:o,startingLine:s,totalLines:a,lines:l}=Wd){var d;o?(null!=s||(s=0),null!=a||(a=1/0)):(s=0,a=1/0);const c=s>0||a<1/0,{state:u,transformers:h}=Id(r),f=o?"text":null!=(d=e.lang)?d:md(e.name),p="string"==typeof n?t.getTheme(n).type:void 0,m=Bd({theme:n,highlighter:t});u.lineInfo=e=>({type:"context",lineIndex:e-1+s,lineNumber:e+s});const g="string"==typeof n?{lang:f,theme:n,transformers:h,defaultColor:!1,cssVariablePrefix:Rd("token"),tokenizeMaxLineLength:i,tokenizeTimeLimit:0}:{lang:f,themes:n,transformers:h,defaultColor:!1,cssVariablePrefix:Rd("token"),tokenizeMaxLineLength:i,tokenizeTimeLimit:0},v=zd(t.codeToHast(c?function(e,t,n){let i="";return Ud({lines:e,startingLine:t,totalLines:n,callback({content:e}){i+=e}}),i}(null!=l?l:Gd(e.contents),s,a):kd(e.contents),g)),b=c?new Array(s):v;return c&&b.push(...v),{code:b,themeStyles:m,baseThemeType:p}}const qd="-1,-1";function Kd(e){var t;return null!=(t=null==e?void 0:e.some(e=>0===e.lineNumber))&&t}function Xd(e){const t=e[0];return null!=t&&t.length>0?t:void 0}function Qd(e){return 0===e.startingLine&&e.totalLines>0}function Yd(e,t){return be({tagName:"div",children:e,properties:{"data-content":"",style:`grid-row: span ${t}`}})}function Jd(e){var t;return"text"===(null!=(t=e.lang)?t:md(e.name))}function Zd(e){return!0===e.useTokenTransformer||null!=e.onTokenClick||null!=e.onTokenEnter||null!=e.onTokenLeave}let ec=-1;var tc=class{constructor(e={theme:G},t,n){var i;y(this,"options"),y(this,"onRenderUpdate"),y(this,"workerManager"),y(this,"__id","file-renderer:"+ ++ec),y(this,"highlighter"),y(this,"renderCache"),y(this,"computedLang","text"),y(this,"lineAnnotations",{}),y(this,"lineCache"),this.options=e,this.onRenderUpdate=t,this.workerManager=n,!0!==(null==n?void 0:n.isWorkingPool())&&(this.highlighter=ed(null!=(i=e.theme)?i:G)?Kl():void 0)}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}setLineAnnotations(e){var t;this.lineAnnotations={};for(const n of e){const e=null!=(t=this.lineAnnotations[n.lineNumber])?t:[];this.lineAnnotations[n.lineNumber]=e,e.push(n)}}cleanUp(){this.recycle(),this.workerManager=void 0,this.onRenderUpdate=void 0}recycle(){var e;this.clearRenderCache(),this.highlighter=void 0,null==(e=this.workerManager)||e.cleanUpTasks(this),this.lineCache=void 0}clearRenderCache(){this.renderCache=void 0}hydrate(e){var t,n,i;const{options:r}=this.getRenderOptions(e),o=nc(this.getOrCreateLineCache(e).length,this.getTokenizeMaxLength());let s=null==(t=this.workerManager)?void 0:t.getFileResultCache(e);null==s||nd(r,s.options)||(s=void 0),null!=this.renderCache||(this.renderCache={file:e,options:r,highlighted:!o&&!Jd(e),result:o||null==s?void 0:s.result,renderRange:void 0}),!0===(null==(n=this.workerManager)?void 0:n.isWorkingPool())?null!=this.renderCache.result||o||this.workerManager.highlightFileAST(this,e):null==this.highlighter&&(this.computedLang=null!=(i=e.lang)?i:md(e.name),this.initializeHighlighter())}getRenderOptions(e){const t=(()=>{var e;if(!0===(null==(e=this.workerManager)?void 0:e.isWorkingPool()))return this.workerManager.getFileRenderOptions();const{theme:t=G,tokenizeMaxLineLength:n=1e3}=this.options;return{theme:t,useTokenTransformer:Zd(this.options),tokenizeMaxLineLength:n}})(),{renderCache:n}=this;return null==(null==n?void 0:n.result)?{options:t,forceHighlight:!0}:id(e,n.file)&&nd(t,n.options)?{options:t,forceHighlight:!1}:{options:t,forceHighlight:!0}}getOrCreateLineCache(e){if(null==e.cacheKey)return this.lineCache=void 0,Gd(e.contents);let{lineCache:t}=this;return null!=t&&t.cacheKey===e.cacheKey||(t={cacheKey:e.cacheKey,lines:Gd(e.contents)}),this.lineCache=t,t.lines}renderFile(e=(e=>null==(e=this.renderCache)?void 0:e.file)(),t=ie){var n,i;if(null==e)return;let{options:r,forceHighlight:o}=this.getRenderOptions(e);const s=this.getMatchingWorkerResultCache(e,r);null==s||this.hasHighlightedRenderCache(e,r)||(this.renderCache={file:e,highlighted:!0,renderRange:void 0,...s},o=!1),null!=this.renderCache||(this.renderCache={file:e,highlighted:!1,options:r,result:void 0,renderRange:void 0});const a=this.getOrCreateLineCache(e),l=e.contents.length>0,d=!l||Jd(e)||nc(a.length,this.getTokenizeMaxLength()),c=!id(e,this.renderCache.file),u=!rd(this.renderCache.renderRange,t);if(!0===(null==(n=this.workerManager)?void 0:n.isWorkingPool()))(d||null==this.renderCache.result||!this.renderCache.highlighted&&(c||u))&&(this.renderCache.file=e,this.renderCache.options=r,this.renderCache.highlighted=!1,(null==this.renderCache.result||c||u||o)&&(this.renderCache.result=this.workerManager.getPlainFileAST(e,t.startingLine,t.totalLines,a)),this.renderCache.renderRange=t),d||!l||this.renderCache.highlighted&&!o||this.workerManager.highlightFileAST(this,e);else{this.computedLang=null!=(i=e.lang)?i:md(e.name);const t=null!=this.highlighter&&ed(r.theme),n=null!=this.highlighter&&xn(this.computedLang),s=!d&&n;if(null!=this.highlighter&&t&&(o||d||!this.renderCache.highlighted&&s||null==this.renderCache.result)){const{result:t,options:i}=this.renderFileWithHighlighter(e,this.highlighter,d||!n);this.renderCache={file:e,options:i,highlighted:s,result:t,renderRange:void 0}}t&&(d||n)||this.asyncHighlight(e).then(({result:t,options:n})=>{null!=this.renderCache&&(this.renderCache.highlighted=!1),this.onHighlightSuccess(e,t,n,!d)})}return null!=this.renderCache.result?this.processFileResult(this.renderCache.file,t,this.renderCache.result):void 0}async asyncRender(e,t=ie){const{result:n}=await this.asyncHighlight(e);return this.processFileResult(e,t,n)}async asyncHighlight(e){var t;const n=nc(this.getOrCreateLineCache(e).length,this.getTokenizeMaxLength());this.computedLang=n?"text":null!=(t=e.lang)?t:md(e.name);const i=null!=this.highlighter&&td(Zl(this.options.theme)),r=n||null!=this.highlighter&&xn(this.computedLang);return null!=this.highlighter&&i&&r||(this.highlighter=await this.initializeHighlighter()),this.renderFileWithHighlighter(e,this.highlighter,n)}renderFileWithHighlighter(e,t,n=!1){const{options:i}=this.getRenderOptions(e);return{result:Vd(e,t,i,{forcePlainText:n}),options:i}}processFileResult(e,t,{code:n,themeStyles:i,baseThemeType:r}){var o;const{disableFileHeader:s=!1}=this.options,a=[],l=Se(),d=this.getOrCreateLineCache(e);let c=0;const u=Qd(t)?Xd(this.lineAnnotations):void 0;return null!=u&&(l.children.push(xe("context","annotation",1)),a.push(od({hunkIndex:-1,lineIndex:-1,annotations:u.map(e=>Sd(e))})),c++),Ud({lines:d,startingLine:t.startingLine,totalLines:t.totalLines,callback:({lineIndex:t,lineNumber:i})=>{const r=n[t];if(null==r){const n="FileRenderer.processFileResult: Line doesnt exist";throw console.error(n,{name:e.name,lineIndex:t,lineNumber:i,lines:d}),new Error(n)}if(null!=r){l.children.push(ke("context",i,`${t}`)),a.push(r),c++;const e=this.lineAnnotations[i];null!=e&&(l.children.push(xe("context","annotation",1)),a.push(od({hunkIndex:0,lineIndex:i,annotations:e.map(e=>Sd(e))})),c++)}}}),l.properties.style=`grid-row: span ${c}`,{gutterAST:null!=(o=l.children)?o:[],contentAST:a,preAST:this.createPreElement(d.length),headerAST:s?void 0:this.renderHeader(e),totalLines:d.length,rowCount:c,themeStyles:i,baseThemeType:r,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:""}}renderHeader(e){const{headerRenderMode:t="default",stickyHeader:n=!1}=this.options;return ad({fileOrDiff:e,mode:t,stickyHeader:n})}renderFullHTML(e){return Qt(this.renderFullAST(e))}renderFullAST(e,t=[]){return t.push(be({tagName:"code",children:this.renderCodeAST(e),properties:{"data-code":""}})),{...e.preAST,children:t}}renderCodeAST(e){const t=Se();return t.children=e.gutterAST,t.properties.style=`grid-row: span ${e.rowCount}`,[t,Yd(e.contentAST,e.rowCount)]}renderPartialHTML(e,t=!1){return Qt(t?be({tagName:"code",children:e,properties:{"data-code":""}}):e)}async initializeHighlighter(){return this.highlighter=await Vl(Cd(this.computedLang,this.options)),this.highlighter}onHighlightSuccess(e,t,n,i=!0){var r;if(null==this.renderCache)return;const o=!id(e,this.renderCache.file)||!this.renderCache.highlighted||!nd(n,this.renderCache.options);this.renderCache={file:e,options:n,highlighted:i,result:t,renderRange:void 0},o&&(null==(r=this.onRenderUpdate)||r.call(this))}getMatchingWorkerResultCache(e,t){var n;const i=null==(n=this.workerManager)?void 0:n.getFileResultCache(e);if(null!=i&&nd(t,i.options))return i}hasHighlightedRenderCache(e,t){const{renderCache:n}=this;return null!=(null==n?void 0:n.result)&&n.highlighted&&id(e,n.file)&&nd(t,n.options)}onHighlightError(e){console.error(e)}getTokenizeMaxLength(){var e;return null!=(e=this.options.tokenizeMaxLength)?e:1e5}createPreElement(e){const{disableLineNumbers:t=!1,overflow:n="scroll"}=this.options;return cd({type:"file",diffIndicators:"none",disableBackground:!0,disableLineNumbers:t,overflow:n,split:!1,totalLines:e})}};function nc(e,t){return e>t}const ic='<svg data-icon-sprite aria-hidden="true" width="0" height="0">\n <symbol id="diffs-icon-arrow-right-short" viewBox="0 0 16 16">\n <path d="M8.47 4.22a.75.75 0 0 0 0 1.06l1.97 1.97H3.75a.75.75 0 0 0 0 1.5h6.69l-1.97 1.97a.75.75 0 1 0 1.06 1.06l3.25-3.25a.75.75 0 0 0 0-1.06L9.53 4.22a.75.75 0 0 0-1.06 0"/>\n </symbol>\n <symbol id="diffs-icon-brand-github" viewBox="0 0 16 16">\n <path d="M8 0c4.42 0 8 3.58 8 8a8.01 8.01 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27s-1.36.09-2 .27c-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8"/>\n </symbol>\n <symbol id="diffs-icon-chevron" viewBox="0 0 16 16">\n <path d="M1.47 4.47a.75.75 0 0 1 1.06 0L8 9.94l5.47-5.47a.75.75 0 1 1 1.06 1.06l-6 6a.75.75 0 0 1-1.06 0l-6-6a.75.75 0 0 1 0-1.06"/>\n </symbol>\n <symbol id="diffs-icon-chevrons-narrow" viewBox="0 0 10 16">\n <path d="M4.47 2.22a.75.75 0 0 1 1.06 0l3.25 3.25a.75.75 0 0 1-1.06 1.06L5 3.81 2.28 6.53a.75.75 0 0 1-1.06-1.06zM1.22 9.47a.75.75 0 0 1 1.06 0L5 12.19l2.72-2.72a.75.75 0 0 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0l-3.25-3.25a.75.75 0 0 1 0-1.06"/>\n </symbol>\n <symbol id="diffs-icon-diff-split" viewBox="0 0 16 16">\n <path d="M14 0H8.5v16H14a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2m-1.5 6.5v1h1a.5.5 0 0 1 0 1h-1v1a.5.5 0 0 1-1 0v-1h-1a.5.5 0 0 1 0-1h1v-1a.5.5 0 0 1 1 0"/><path d="M2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h5.5V0zm.5 7.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1 0-1" opacity=".3"/>\n </symbol>\n <symbol id="diffs-icon-diff-unified" viewBox="0 0 16 16">\n <path fill-rule="evenodd" d="M16 14a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V8.5h16zm-8-4a.5.5 0 0 0-.5.5v1h-1a.5.5 0 0 0 0 1h1v1a.5.5 0 0 0 1 0v-1h1a.5.5 0 0 0 0-1h-1v-1A.5.5 0 0 0 8 10" clip-rule="evenodd"/><path fill-rule="evenodd" d="M14 0a2 2 0 0 1 2 2v5.5H0V2a2 2 0 0 1 2-2zM6.5 3.5a.5.5 0 0 0 0 1h3a.5.5 0 0 0 0-1z" clip-rule="evenodd" opacity=".4"/>\n </symbol>\n <symbol id="diffs-icon-expand" viewBox="0 0 16 16">\n <path d="M3.47 5.47a.75.75 0 0 1 1.06 0L8 8.94l3.47-3.47a.75.75 0 1 1 1.06 1.06l-4 4a.75.75 0 0 1-1.06 0l-4-4a.75.75 0 0 1 0-1.06"/>\n </symbol>\n <symbol id="diffs-icon-expand-all" viewBox="0 0 16 16">\n <path d="M11.47 9.47a.75.75 0 1 1 1.06 1.06l-4 4a.75.75 0 0 1-1.06 0l-4-4a.75.75 0 1 1 1.06-1.06L8 12.94zM7.526 1.418a.75.75 0 0 1 1.004.052l4 4a.75.75 0 1 1-1.06 1.06L8 3.06 4.53 6.53a.75.75 0 1 1-1.06-1.06l4-4z"/>\n </symbol>\n <symbol id="diffs-icon-file-code" viewBox="0 0 16 16">\n <path d="M10.75 0c.199 0 .39.08.53.22l3.5 3.5c.14.14.22.331.22.53v9A2.75 2.75 0 0 1 12.25 16h-8.5A2.75 2.75 0 0 1 1 13.25V2.75A2.75 2.75 0 0 1 3.75 0zm-7 1.5c-.69 0-1.25.56-1.25 1.25v10.5c0 .69.56 1.25 1.25 1.25h8.5c.69 0 1.25-.56 1.25-1.25V5h-1.25A2.25 2.25 0 0 1 10 2.75V1.5z"/><path d="M7.248 6.19a.75.75 0 0 1 .063 1.058L5.753 9l1.558 1.752a.75.75 0 0 1-1.122.996l-2-2.25a.75.75 0 0 1 0-.996l2-2.25a.75.75 0 0 1 1.06-.063M8.69 7.248a.75.75 0 1 1 1.12-.996l2 2.25a.75.75 0 0 1 0 .996l-2 2.25a.75.75 0 1 1-1.12-.996L10.245 9z"/>\n </symbol>\n <symbol id="diffs-icon-plus" viewBox="0 0 16 16">\n <path d="M8 3a.75.75 0 0 1 .75.75v3.5h3.5a.75.75 0 0 1 0 1.5h-3.5v3.5a.75.75 0 0 1-1.5 0v-3.5h-3.5a.75.75 0 0 1 0-1.5h3.5v-3.5A.75.75 0 0 1 8 3"/>\n </symbol>\n <symbol id="diffs-icon-symbol-added" viewBox="0 0 16 16">\n <path d="M8 4a.75.75 0 0 1 .75.75v2.5h2.5a.75.75 0 0 1 0 1.5h-2.5v2.5a.75.75 0 0 1-1.5 0v-2.5h-2.5a.75.75 0 0 1 0-1.5h2.5v-2.5A.75.75 0 0 1 8 4"/><path d="M1.788 4.296c.196-.88.478-1.381.802-1.706s.826-.606 1.706-.802C5.194 1.588 6.387 1.5 8 1.5s2.806.088 3.704.288c.88.196 1.381.478 1.706.802s.607.826.802 1.706c.2.898.288 2.091.288 3.704s-.088 2.806-.288 3.704c-.195.88-.478 1.381-.802 1.706s-.826.607-1.706.802c-.898.2-2.091.288-3.704.288s-2.806-.088-3.704-.288c-.88-.195-1.381-.478-1.706-.802s-.606-.826-.802-1.706C1.588 10.806 1.5 9.613 1.5 8s.088-2.806.288-3.704M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8"/>\n </symbol>\n <symbol id="diffs-icon-symbol-deleted" viewBox="0 0 16 16">\n <path d="M4 8a.75.75 0 0 1 .75-.75h6.5a.75.75 0 0 1 0 1.5h-6.5A.75.75 0 0 1 4 8"/><path d="M1.788 4.296c.196-.88.478-1.381.802-1.706s.826-.606 1.706-.802C5.194 1.588 6.387 1.5 8 1.5s2.806.088 3.704.288c.88.196 1.381.478 1.706.802s.607.826.802 1.706c.2.898.288 2.091.288 3.704s-.088 2.806-.288 3.704c-.195.88-.478 1.381-.802 1.706s-.826.607-1.706.802c-.898.2-2.091.288-3.704.288s-2.806-.088-3.704-.288c-.88-.195-1.381-.478-1.706-.802s-.606-.826-.802-1.706C1.588 10.806 1.5 9.613 1.5 8s.088-2.806.288-3.704M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8"/>\n </symbol>\n <symbol id="diffs-icon-symbol-diffstat" viewBox="0 0 16 16">\n <path d="M1.788 4.296c.196-.88.478-1.381.802-1.706s.826-.606 1.706-.802C5.194 1.588 6.387 1.5 8 1.5s2.806.088 3.704.288c.88.196 1.381.478 1.706.802s.607.826.802 1.706c.2.898.288 2.091.288 3.704s-.088 2.806-.288 3.704c-.195.88-.478 1.381-.802 1.706s-.826.607-1.706.802c-.898.2-2.091.288-3.704.288s-2.806-.088-3.704-.288c-.88-.195-1.381-.478-1.706-.802s-.606-.826-.802-1.706C1.588 10.806 1.5 9.613 1.5 8s.088-2.806.288-3.704M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8"/><path d="M8.75 4.296a.75.75 0 0 0-1.5 0V6.25h-2a.75.75 0 0 0 0 1.5h2v1.5h1.5v-1.5h2a.75.75 0 0 0 0-1.5h-2zM5.25 10a.75.75 0 0 0 0 1.5h5.5a.75.75 0 0 0 0-1.5z"/>\n </symbol>\n <symbol id="diffs-icon-symbol-ignored" viewBox="0 0 16 16">\n <path d="M1.5 8c0 1.613.088 2.806.288 3.704.196.88.478 1.381.802 1.706s.826.607 1.706.802c.898.2 2.091.288 3.704.288s2.806-.088 3.704-.288c.88-.195 1.381-.478 1.706-.802s.607-.826.802-1.706c.2-.898.288-2.091.288-3.704s-.088-2.806-.288-3.704c-.195-.88-.478-1.381-.802-1.706s-.826-.606-1.706-.802C10.806 1.588 9.613 1.5 8 1.5s-2.806.088-3.704.288c-.88.196-1.381.478-1.706.802s-.606.826-.802 1.706C1.588 5.194 1.5 6.387 1.5 8M0 8c0-6.588 1.412-8 8-8s8 1.412 8 8-1.412 8-8 8-8-1.412-8-8m11.53-2.47a.75.75 0 0 0-1.06-1.06l-6 6a.75.75 0 1 0 1.06 1.06z"/>\n </symbol>\n <symbol id="diffs-icon-symbol-modified" viewBox="0 0 16 16">\n <path d="M1.5 8c0 1.613.088 2.806.288 3.704.196.88.478 1.381.802 1.706s.826.607 1.706.802c.898.2 2.091.288 3.704.288s2.806-.088 3.704-.288c.88-.195 1.381-.478 1.706-.802s.607-.826.802-1.706c.2-.898.288-2.091.288-3.704s-.088-2.806-.288-3.704c-.195-.88-.478-1.381-.802-1.706s-.826-.606-1.706-.802C10.806 1.588 9.613 1.5 8 1.5s-2.806.088-3.704.288c-.88.196-1.381.478-1.706.802s-.606.826-.802 1.706C1.588 5.194 1.5 6.387 1.5 8M0 8c0-6.588 1.412-8 8-8s8 1.412 8 8-1.412 8-8 8-8-1.412-8-8m8 3a3 3 0 1 0 0-6 3 3 0 0 0 0 6"/>\n </symbol>\n <symbol id="diffs-icon-symbol-moved" viewBox="0 0 16 16">\n <path d="M1.788 4.296c.196-.88.478-1.381.802-1.706s.826-.606 1.706-.802C5.194 1.588 6.387 1.5 8 1.5s2.806.088 3.704.288c.88.196 1.381.478 1.706.802s.607.826.802 1.706c.2.898.288 2.091.288 3.704s-.088 2.806-.288 3.704c-.195.88-.478 1.381-.802 1.706s-.826.607-1.706.802c-.898.2-2.091.288-3.704.288s-2.806-.088-3.704-.288c-.88-.195-1.381-.478-1.706-.802s-.606-.826-.802-1.706C1.588 10.806 1.5 9.613 1.5 8s.088-2.806.288-3.704M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8"/><path d="M8.495 4.695a.75.75 0 0 0-.05 1.06L10.486 8l-2.041 2.246a.75.75 0 0 0 1.11 1.008l2.5-2.75a.75.75 0 0 0 0-1.008l-2.5-2.75a.75.75 0 0 0-1.06-.051m-4 0a.75.75 0 0 0-.05 1.06l2.044 2.248-1.796 1.995a.75.75 0 0 0 1.114 1.004l2.25-2.5a.75.75 0 0 0-.002-1.007l-2.5-2.75a.75.75 0 0 0-1.06-.05"/>\n </symbol>\n <symbol id="diffs-icon-symbol-ref" viewBox="0 0 16 16">\n <path d="M1.5 8c0 1.613.088 2.806.288 3.704.196.88.478 1.381.802 1.706.286.286.71.54 1.41.73V1.86c-.7.19-1.124.444-1.41.73-.324.325-.606.826-.802 1.706C1.588 5.194 1.5 6.387 1.5 8m4 6.397c.697.07 1.522.103 2.5.103 1.613 0 2.806-.088 3.704-.288.88-.195 1.381-.478 1.706-.802s.607-.826.802-1.706c.2-.898.288-2.091.288-3.704s-.088-2.806-.288-3.704c-.195-.88-.478-1.381-.802-1.706s-.826-.606-1.706-.802C10.806 1.588 9.613 1.5 8 1.5c-.978 0-1.803.033-2.5.103zM0 8c0-6.588 1.412-8 8-8s8 1.412 8 8-1.412 8-8 8-8-1.412-8-8m7-2a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1z"/>\n </symbol>\n</svg>';function rc(e,t){return e.lineNumber===t.lineNumber&&e.metadata===t.metadata}function oc(e,t){return null==e||null==t?e===t:function(e=sc,t=sc){if(e===t)return!0;const n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(const r of n)if(e[r]!==t[r])return!1;return!0}(e.customProperties,t.customProperties)&&e.type===t.type&&e.diffIndicators===t.diffIndicators&&e.disableBackground===t.disableBackground&&e.disableLineNumbers===t.disableLineNumbers&&e.overflow===t.overflow&&e.split===t.split&&e.totalLines===t.totalLines}const sc={};function ac(e){const t=document.createElement("div");return t.dataset.annotationSlot="",t.slot=e,t.style.whiteSpace="normal",t}function lc(){const e=document.createElement("div");return e.slot="gutter-utility-slot",e.style.position="absolute",e.style.top="0",e.style.bottom="0",e.style.textAlign="center",e.style.whiteSpace="normal",e.style.touchAction="none",e}function dc(){const e=document.createElement("style");return e.setAttribute(V,""),e}var cc='@layer base {\n :host {\n --diffs-font-fallback: "SF Mono", Monaco, Consolas, "Ubuntu Mono", "Liberation Mono",\n "Courier New", monospace;\n --diffs-header-font-fallback: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",\n "Noto Sans", "Liberation Sans", Arial, sans-serif;\n --diffs-mixer: light-dark(#000, #fff);\n --diffs-gap-fallback: 8px;\n --diffs-scrollbar-gutter-fallback: 6px;\n --diffs-scrollbar-gutter: var(--diffs-scrollbar-gutter-override, var(--diffs-scrollbar-gutter-measured, var(--diffs-scrollbar-gutter-fallback)));\n --diffs-added-light: #0dbe4e;\n --diffs-added-dark: #5ecc71;\n --diffs-modified-light: #009fff;\n --diffs-modified-dark: #69b1ff;\n --diffs-deleted-light: #ff2e3f;\n --diffs-deleted-dark: #ff6762;\n color-scheme: light dark;\n font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));\n font-size: var(--diffs-font-size, 13px);\n line-height: var(--diffs-line-height, 20px);\n font-feature-settings: var(--diffs-font-features);\n --diffs-bg: light-dark(var(--diffs-light-bg, #fff), var(--diffs-dark-bg, #000));\n --diffs-bg-buffer: var(--diffs-bg-buffer-override, light-dark(color-mix(in lab, var(--diffs-bg) 92%, var(--diffs-mixer)), color-mix(in lab, var(--diffs-bg) 92%, var(--diffs-mixer))));\n --diffs-bg-context: var(--diffs-bg-context-override, light-dark(color-mix(in lab, var(--diffs-bg) 98.5%, var(--diffs-mixer)), color-mix(in lab, var(--diffs-bg) 92.5%, var(--diffs-mixer))));\n --diffs-bg-context-gutter: var(--diffs-bg-context-gutter-override, light-dark(color-mix(in lab, var(--diffs-bg-context) 90%, var(--diffs-bg)), color-mix(in lab, var(--diffs-bg-context) 45%, var(--diffs-bg))));\n --diffs-bg-separator: var(--diffs-bg-separator-override, light-dark(color-mix(in lab, var(--diffs-bg) 96%, var(--diffs-mixer)), color-mix(in lab, var(--diffs-bg) 85%, var(--diffs-mixer))));\n --diffs-fg: light-dark(var(--diffs-light, #000), var(--diffs-dark, #fff));\n --diffs-fg-number: var(--diffs-fg-number-override, light-dark(color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg)), color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg))));\n --diffs-fg-conflict-marker: var(--diffs-fg-conflict-marker-override, var(--diffs-fg-number));\n --diffs-deletion-base: var(--diffs-deletion-color-override, light-dark(var(--diffs-light-deletion-color, var(--diffs-deletion-color, var(--diffs-deleted-light))), var(--diffs-dark-deletion-color, var(--diffs-deletion-color, var(--diffs-deleted-dark)))));\n --diffs-addition-base: var(--diffs-addition-color-override, light-dark(var(--diffs-light-addition-color, var(--diffs-addition-color, var(--diffs-added-light))), var(--diffs-dark-addition-color, var(--diffs-addition-color, var(--diffs-added-dark)))));\n --diffs-modified-base: var(--diffs-modified-color-override, light-dark(var(--diffs-light-modified-color, var(--diffs-modified-color, var(--diffs-modified-light))), var(--diffs-dark-modified-color, var(--diffs-modified-color, var(--diffs-modified-dark)))));\n --diffs-bg-deletion: var(--diffs-bg-deletion-override, light-dark(color-mix(in lab, var(--diffs-bg) 88%, var(--diffs-deletion-base)), color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-deletion-base))));\n --diffs-bg-deletion-emphasis: var(--diffs-bg-deletion-emphasis-override, light-dark(rgb(from var(--diffs-deletion-base) r g b / .15), rgb(from var(--diffs-deletion-base) r g b / .2)));\n --diffs-bg-addition: var(--diffs-bg-addition-override, light-dark(color-mix(in lab, var(--diffs-bg) 88%, var(--diffs-addition-base)), color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-addition-base))));\n --diffs-bg-addition-emphasis: var(--diffs-bg-addition-emphasis-override, light-dark(rgb(from var(--diffs-addition-base) r g b / .15), rgb(from var(--diffs-addition-base) r g b / .2)));\n --diffs-selection-base: var(--diffs-modified-base);\n --diffs-selection-number-fg: light-dark(color-mix(in lab, var(--diffs-selection-base) 65%, var(--diffs-mixer)), color-mix(in lab, var(--diffs-selection-base) 75%, var(--diffs-mixer)));\n background-color: var(--diffs-bg);\n color: var(--diffs-fg);\n display: block;\n }\n\n pre, code, [data-error-wrapper] {\n isolation: isolate;\n font-family: var(--diffs-font-family, var(--diffs-font-fallback));\n outline: none;\n margin: 0;\n padding: 0;\n display: block;\n }\n\n pre, code {\n background-color: var(--diffs-bg);\n }\n\n code {\n contain: content;\n }\n\n *, :before, :after {\n box-sizing: border-box;\n }\n\n [data-icon-sprite] {\n display: none;\n }\n\n [data-diffs-header], [data-separator] {\n font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));\n }\n\n [data-diffs-header][data-sticky] {\n z-index: 1;\n background-color: var(--diffs-bg);\n position: sticky;\n top: 0;\n }\n\n [data-file-info] {\n color: var(--fg);\n background-color: color-mix(in lab, var(--bg) 98%, var(--fg));\n border-block: 1px solid color-mix(in lab, var(--bg) 95%, var(--fg));\n padding: 10px;\n font-weight: 700;\n }\n\n [data-diff], [data-file] {\n --diffs-grid-number-column-width: minmax(min-content, max-content);\n --diffs-code-grid: var(--diffs-grid-number-column-width) 1fr;\n\n &[data-dehydrated] {\n --diffs-code-grid: var(--diffs-grid-number-column-width) minmax(0, 1fr);\n }\n\n &:hover [data-code]::-webkit-scrollbar-thumb {\n background-color: var(--diffs-bg-context);\n }\n }\n\n @supports (-webkit-touch-callout: none) {\n :host {\n --diffs-scrollbar-gutter-fallback: 0px;\n }\n }\n\n [data-line] span {\n color: light-dark(var(--diffs-token-light, var(--diffs-light)), var(--diffs-token-dark, var(--diffs-dark)));\n background-color: light-dark(var(--diffs-token-light-bg, inherit), var(--diffs-token-dark-bg, inherit));\n font-weight: light-dark(var(--diffs-token-light-font-weight, inherit), var(--diffs-token-dark-font-weight, inherit));\n font-style: light-dark(var(--diffs-token-light-font-style, inherit), var(--diffs-token-dark-font-style, inherit));\n text-decoration: light-dark(var(--diffs-token-light-text-decoration, inherit), var(--diffs-token-dark-text-decoration, inherit));\n }\n\n [data-line], [data-gutter-buffer], [data-column-number], [data-line-annotation], [data-no-newline], [data-merge-conflict], [data-merge-conflict-actions] {\n --diffs-computed-decoration-bg: var(--diffs-bg);\n --diffs-computed-diff-line-bg: var(--diffs-bg);\n --diffs-computed-selected-line-bg: var(--diffs-bg);\n color: var(--diffs-fg);\n background-color: var(--diffs-line-bg, var(--diffs-bg));\n\n @media (pointer: fine) {\n &:where([data-hovered]) {\n --diffs-computed-hovered-line-bg: light-dark(color-mix(in lab,\n var(--diffs-computed-selected-line-bg) 97%,\n var(--diffs-bg-hover-override, var(--diffs-mixer))), color-mix(in lab,\n var(--diffs-computed-selected-line-bg) 91%,\n var(--diffs-bg-hover-override, var(--diffs-mixer))));\n --diffs-line-bg: var(--diffs-computed-hovered-line-bg, inherit);\n }\n }\n }\n\n [data-line], [data-no-newline] {\n &[data-decoration-bg] {\n --mix-deco-light: 92%;\n --mix-deco-dark: 85%;\n\n &[data-decoration-bg-depth="2"] {\n --mix-deco-light: 88%;\n --mix-deco-dark: 80%;\n }\n\n &[data-decoration-bg-depth="3"] {\n --mix-deco-light: 85%;\n --mix-deco-dark: 78%;\n }\n\n @media (pointer: fine) {\n &[data-hovered]:not([data-selected-line]) {\n --mix-deco-light: 85%;\n --mix-deco-dark: 85%;\n }\n\n &[data-hovered]:not([data-selected-line])[data-decoration-bg-depth="2"] {\n --mix-deco-light: 83%;\n --mix-deco-dark: 83%;\n }\n\n &[data-hovered]:not([data-selected-line])[data-decoration-bg-depth="3"] {\n --mix-deco-light: 81%;\n --mix-deco-dark: 81%;\n }\n }\n\n --diffs-computed-decoration-bg: light-dark(color-mix(in lab,\n var(--diffs-bg) var(--mix-deco-light),\n var(--diffs-decoration-bg)), color-mix(in lab,\n var(--diffs-bg) var(--mix-deco-dark),\n var(--diffs-decoration-bg)));\n --diffs-computed-diff-line-bg: var(--diffs-computed-decoration-bg);\n --diffs-computed-selected-line-bg: var(--diffs-computed-decoration-bg);\n --diffs-line-bg: var(--diffs-computed-decoration-bg);\n }\n }\n\n [data-line-annotation], [data-gutter-buffer="annotation"] {\n --diffs-annotation-bg: var(--diffs-bg-context);\n --diffs-computed-decoration-bg: var(--diffs-annotation-bg);\n --diffs-computed-diff-line-bg: var(--diffs-annotation-bg);\n --diffs-computed-selected-line-bg: var(--diffs-annotation-bg);\n --diffs-line-bg: var(--diffs-annotation-bg);\n }\n\n [data-merge-conflict-actions], [data-gutter-buffer="merge-conflict-action"], [data-gutter-buffer="merge-conflict-marker-base"], [data-gutter-buffer="merge-conflict-marker-separator"], [data-merge-conflict="marker-base"], [data-merge-conflict="marker-separator"] {\n --diffs-computed-decoration-bg: var(--diffs-bg-context);\n --diffs-computed-diff-line-bg: var(--diffs-bg-context);\n --diffs-computed-selected-line-bg: var(--diffs-bg-context);\n --diffs-line-bg: var(--diffs-bg-context);\n }\n\n [data-gutter-buffer="merge-conflict-marker-start"], [data-merge-conflict="marker-start"] {\n --diffs-computed-decoration-bg: light-dark(color-mix(in lab,\n var(--diffs-bg) 78%,\n var(--conflict-bg-current-header-override, var(--diffs-addition-base))), color-mix(in lab,\n var(--diffs-bg) 68%,\n var(--conflict-bg-current-header-override, var(--diffs-addition-base))));\n --diffs-computed-diff-line-bg: var(--diffs-computed-decoration-bg);\n --diffs-computed-selected-line-bg: var(--diffs-computed-decoration-bg);\n --diffs-line-bg: var(--diffs-computed-decoration-bg);\n }\n\n [data-gutter-buffer="merge-conflict-marker-end"], [data-merge-conflict="marker-end"] {\n --diffs-computed-decoration-bg: light-dark(color-mix(in lab,\n var(--diffs-bg) 78%,\n var(--conflict-bg-incoming-header-override, var(--diffs-modified-base))), color-mix(in lab,\n var(--diffs-bg) 68%,\n var(--conflict-bg-incoming-header-override, var(--diffs-modified-base))));\n --diffs-computed-diff-line-bg: var(--diffs-computed-decoration-bg);\n --diffs-computed-selected-line-bg: var(--diffs-computed-decoration-bg);\n --diffs-line-bg: var(--diffs-computed-decoration-bg);\n }\n\n [data-has-merge-conflict] [data-line-annotation], [data-has-merge-conflict] [data-gutter-buffer="annotation"] {\n --diffs-computed-decoration-bg: var(--diffs-bg);\n --diffs-computed-diff-line-bg: var(--diffs-bg);\n --diffs-computed-selected-line-bg: var(--diffs-bg);\n --diffs-line-bg: var(--diffs-bg);\n }\n\n :where([data-background]) {\n & [data-gutter-buffer], & [data-column-number] {\n --mix-light: 91%;\n --mix-dark: 85%;\n }\n\n & [data-line], & [data-no-newline] {\n --mix-light: 88%;\n --mix-dark: 80%;\n }\n\n & [data-gutter-buffer], & [data-column-number], & [data-line], & [data-no-newline] {\n --diffs-diff-line-mix-target: var(--diffs-bg);\n\n &[data-line-type="change-deletion"] {\n --diffs-diff-line-mix-target: var(--diffs-bg-deletion-override, var(--diffs-deletion-base));\n\n @media (pointer: fine) {\n &[data-hovered] {\n --mix-light: 80%;\n --mix-dark: 75%;\n }\n }\n\n &:where([data-gutter-buffer], [data-column-number]) {\n color: var(--diffs-fg-number-deletion-override, var(--diffs-deletion-base));\n --diffs-diff-line-mix-target: var(--diffs-bg-deletion-number-override, var(--diffs-deletion-base));\n }\n\n --diffs-computed-diff-line-bg: light-dark(color-mix(in lab,\n var(--diffs-computed-decoration-bg) var(--mix-light),\n var(--diffs-diff-line-mix-target)), color-mix(in lab,\n var(--diffs-computed-decoration-bg) var(--mix-dark),\n var(--diffs-diff-line-mix-target)));\n --diffs-computed-selected-line-bg: var(--diffs-computed-diff-line-bg);\n --diffs-line-bg: var(--diffs-computed-diff-line-bg, inherit);\n }\n\n &[data-line-type="change-addition"] {\n --diffs-diff-line-mix-target: var(--diffs-bg-addition-override, var(--diffs-addition-base));\n\n @media (pointer: fine) {\n &[data-hovered] {\n --mix-light: 80%;\n --mix-dark: 70%;\n }\n }\n\n &:where([data-gutter-buffer], [data-column-number]) {\n color: var(--diffs-fg-number-addition-override, var(--diffs-addition-base));\n --diffs-diff-line-mix-target: var(--diffs-bg-addition-number-override, var(--diffs-addition-base));\n }\n\n --diffs-computed-diff-line-bg: light-dark(color-mix(in lab,\n var(--diffs-computed-decoration-bg) var(--mix-light),\n var(--diffs-diff-line-mix-target)), color-mix(in lab,\n var(--diffs-computed-decoration-bg) var(--mix-dark),\n var(--diffs-diff-line-mix-target)));\n --diffs-computed-selected-line-bg: var(--diffs-computed-diff-line-bg);\n --diffs-line-bg: var(--diffs-computed-diff-line-bg, inherit);\n }\n\n &[data-merge-conflict="current"] {\n --diffs-diff-line-mix-target: var(--conflict-bg-current-override, var(--diffs-addition-base));\n\n &:where([data-gutter-buffer], [data-column-number]) {\n color: var(--diffs-fg-number-addition-override, var(--diffs-addition-base));\n --diffs-diff-line-mix-target: var(--conflict-bg-current-number-override, var(--diffs-addition-base));\n }\n\n @media (pointer: fine) {\n &[data-hovered] {\n --mix-light: 80%;\n --mix-dark: 70%;\n }\n }\n\n --diffs-computed-diff-line-bg: light-dark(color-mix(in lab,\n var(--diffs-computed-decoration-bg) var(--mix-light),\n var(--diffs-diff-line-mix-target)), color-mix(in lab,\n var(--diffs-computed-decoration-bg) var(--mix-dark),\n var(--diffs-diff-line-mix-target)));\n --diffs-computed-selected-line-bg: var(--diffs-computed-diff-line-bg);\n --diffs-line-bg: var(--diffs-computed-diff-line-bg, inherit);\n }\n\n &[data-merge-conflict="incoming"] {\n --diffs-diff-line-mix-target: var(--conflict-bg-incoming-override, var(--diffs-modified-base));\n\n &:where([data-gutter-buffer], [data-column-number]) {\n color: var(--diffs-modified-base);\n --diffs-diff-line-mix-target: var(--conflict-bg-incoming-number-override, var(--diffs-modified-base));\n }\n\n @media (pointer: fine) {\n &[data-hovered] {\n --mix-light: 80%;\n --mix-dark: 70%;\n }\n }\n\n --diffs-computed-diff-line-bg: light-dark(color-mix(in lab,\n var(--diffs-computed-decoration-bg) var(--mix-light),\n var(--diffs-diff-line-mix-target)), color-mix(in lab,\n var(--diffs-computed-decoration-bg) var(--mix-dark),\n var(--diffs-diff-line-mix-target)));\n --diffs-computed-selected-line-bg: var(--diffs-computed-diff-line-bg);\n --diffs-line-bg: var(--diffs-computed-diff-line-bg, inherit);\n }\n }\n }\n\n [data-gutter-buffer], [data-column-number], [data-line], [data-line-annotation], [data-merge-conflict], [data-merge-conflict-actions], [data-no-newline] {\n --diffs-selection-mix-target: var(--diffs-bg-selection-override, var(--diffs-selection-base));\n\n &:where([data-line], [data-line-annotation], [data-merge-conflict], [data-merge-conflict-actions], [data-no-newline])[data-selected-line] {\n --mix-selection-light: 82%;\n --mix-selection-dark: 75%;\n\n @media (pointer: fine) {\n &[data-hovered]:not([data-merge-conflict], [data-line-type="change-addition"], [data-line-type="change-deletion"]) {\n --mix-selection-light: 75%;\n --mix-selection-dark: 70%;\n }\n }\n }\n\n &:where([data-gutter-buffer], [data-column-number])[data-selected-line] {\n --mix-selection-light: 75%;\n --mix-selection-dark: 60%;\n --diffs-selection-mix-target: var(--diffs-bg-selection-number-override, var(--diffs-selection-base));\n\n @media (pointer: fine) {\n &[data-hovered]:not([data-merge-conflict], [data-line-type="change-addition"], [data-line-type="change-deletion"]) {\n --mix-selection-light: 70%;\n --mix-selection-dark: 55%;\n }\n }\n }\n\n &[data-selected-line] {\n --diffs-computed-selected-line-bg: light-dark(color-mix(in lab,\n var(--diffs-computed-diff-line-bg) var(--mix-selection-light),\n var(--diffs-selection-mix-target)), color-mix(in lab,\n var(--diffs-computed-diff-line-bg) var(--mix-selection-dark),\n var(--diffs-selection-mix-target)));\n --diffs-line-bg: var(--diffs-computed-selected-line-bg, inherit);\n }\n }\n\n [data-gutter-buffer], [data-column-number] {\n &[data-selected-line] {\n color: var(--diffs-selection-number-fg);\n }\n }\n\n [data-no-newline] {\n user-select: none;\n\n & span {\n opacity: .6;\n }\n }\n\n [data-diff-type="split"][data-overflow="scroll"] {\n grid-template-columns: 1fr 1fr;\n display: grid;\n\n & [data-additions] {\n border-left: 1px solid var(--diffs-bg);\n }\n\n & [data-deletions] {\n border-right: 1px solid var(--diffs-bg);\n }\n }\n\n [data-code] {\n grid-auto-flow: dense;\n grid-template-columns: var(--diffs-code-grid);\n overflow: var(--diffs-overflow-override, scroll) clip;\n overscroll-behavior-x: none;\n tab-size: var(--diffs-tab-size, 2);\n padding-top: var(--diffs-gap-block, var(--diffs-gap-fallback));\n padding-bottom: max(0px,\n calc(var(--diffs-gap-block, var(--diffs-gap-fallback)) -\n var(--diffs-scrollbar-gutter)));\n scrollbar-gutter: stable;\n align-self: flex-start;\n display: grid;\n }\n\n [data-diffs-scrollbar-measure] {\n opacity: 0;\n pointer-events: none;\n scrollbar-gutter: auto;\n grid-template-columns: none;\n width: 100px;\n height: 100px;\n padding: 0;\n position: absolute;\n top: -200px;\n left: -200px;\n }\n\n [data-container-size] {\n container-type: inline-size;\n }\n\n [data-code]::-webkit-scrollbar {\n width: 0;\n height: var(--diffs-scrollbar-gutter);\n }\n\n [data-code]::-webkit-scrollbar-track {\n background: none;\n }\n\n [data-code]::-webkit-scrollbar-thumb {\n background-color: #0000;\n background-clip: content-box;\n border: 1px solid #0000;\n border-radius: 3px;\n }\n\n [data-code]::-webkit-scrollbar-corner {\n background-color: #0000;\n }\n\n @supports ((-moz-appearance: none)) {\n [data-code] {\n scrollbar-width: thin;\n scrollbar-color: var(--diffs-bg-context) transparent;\n padding-bottom: var(--diffs-gap-block, var(--diffs-gap-fallback));\n }\n }\n\n [data-diffs-header] ~ [data-diff], [data-diffs-header] ~ [data-file] {\n & [data-code], &[data-overflow="wrap"] {\n padding-top: 0;\n }\n }\n\n [data-gutter] {\n grid-template-rows: subgrid;\n grid-template-columns: subgrid;\n z-index: 3;\n background-color: var(--diffs-bg);\n grid-column: 1;\n display: grid;\n position: relative;\n\n & [data-gutter-buffer], & [data-column-number] {\n border-right: var(--diffs-gap-style, 2px solid var(--diffs-bg));\n }\n }\n\n [data-content] {\n grid-template-rows: subgrid;\n grid-template-columns: subgrid;\n background-color: var(--diffs-bg);\n grid-column: 2;\n min-width: 0;\n display: grid;\n }\n\n [data-diff-type="split"][data-overflow="wrap"] {\n grid-auto-flow: dense;\n grid-template-columns: repeat(2, var(--diffs-code-grid));\n padding-block: var(--diffs-gap-block, var(--diffs-gap-fallback));\n display: grid;\n\n & [data-deletions] {\n display: contents;\n\n & [data-gutter] {\n grid-column: 1;\n }\n\n & [data-content] {\n border-right: 1px solid var(--diffs-bg);\n grid-column: 2;\n }\n }\n\n & [data-additions] {\n display: contents;\n\n & [data-gutter] {\n border-left: 1px solid var(--diffs-bg);\n grid-column: 3;\n }\n\n & [data-content] {\n grid-column: 4;\n }\n }\n }\n\n [data-overflow="scroll"] [data-gutter] {\n position: sticky;\n left: 0;\n }\n\n [data-interactive-lines] [data-line] {\n cursor: pointer;\n }\n\n [data-interactive-line-numbers] [data-column-number] {\n cursor: pointer;\n touch-action: none;\n }\n\n [data-content-buffer], [data-gutter-buffer] {\n user-select: none;\n min-height: 1lh;\n position: relative;\n }\n\n [data-gutter-buffer] {\n padding-left: 2ch;\n padding-right: 1ch;\n\n &:before {\n content: "";\n min-width: var(--diffs-min-number-column-width, var(--diffs-min-number-column-width-default, 3ch));\n display: block;\n }\n }\n\n [data-gutter-buffer="annotation"] {\n --diffs-annotation-bg: var(--diffs-bg-context-gutter);\n min-height: 0;\n }\n\n [data-gutter-buffer="buffer"] {\n --diffs-line-bg: var(--diffs-bg-context-gutter);\n }\n\n [data-content-buffer] {\n background-position: 5px 0;\n background-size: 8px 8px;\n background-origin: border-box;\n background-image: repeating-linear-gradient(-45deg,\n transparent,\n transparent calc(3px * 1.414),\n var(--diffs-bg-buffer) calc(3px * 1.414),\n var(--diffs-bg-buffer) calc(4px * 1.414));\n grid-column: 1;\n }\n\n [data-separator] {\n box-sizing: content-box;\n background-color: var(--diffs-bg);\n }\n\n [data-separator="simple"] {\n min-height: 4px;\n }\n\n [data-separator="line-info"], [data-separator="line-info-basic"], [data-separator="metadata"], [data-separator="simple"] {\n background-color: var(--diffs-bg-separator);\n }\n\n [data-separator="line-info"], [data-separator="line-info-basic"], [data-separator="metadata"] {\n height: 32px;\n position: relative;\n }\n\n [data-separator-wrapper] {\n user-select: none;\n fill: currentColor;\n background-color: var(--diffs-bg);\n align-items: center;\n height: 100%;\n display: flex;\n position: absolute;\n inset-inline: 0;\n }\n\n [data-content] [data-separator-wrapper] {\n display: none;\n }\n\n [data-separator="metadata"] [data-separator-wrapper] {\n background-color: var(--diffs-bg-separator);\n height: 100%;\n color: var(--diffs-fg-number);\n white-space: nowrap;\n text-overflow: ellipsis;\n min-width: min-content;\n padding-inline: 1ch;\n inset-inline: 100% auto;\n overflow: hidden;\n }\n\n [data-separator="line-info"] {\n margin-block: var(--diffs-gap-block, var(--diffs-gap-fallback));\n\n & [data-separator-wrapper] {\n min-width: 16px;\n }\n }\n\n [data-separator="line-info-basic"], [data-separator="metadata"] {\n margin-block: 0;\n }\n\n [data-separator="line-info"][data-separator-first] {\n margin-top: 0;\n }\n\n [data-separator="line-info"][data-separator-last] {\n margin-bottom: 0;\n }\n\n [data-expand-index] [data-separator-wrapper] {\n grid-template-columns: 32px auto;\n display: grid;\n }\n\n [data-expand-index] [data-separator-wrapper][data-separator-multi-button] {\n grid-template-columns: 32px 32px auto;\n }\n\n [data-expand-button], [data-separator-content] {\n background-color: var(--diffs-bg-separator);\n flex: none;\n align-items: center;\n display: flex;\n }\n\n [data-expand-index] [data-separator-content]:hover {\n cursor: pointer;\n text-decoration: underline;\n }\n\n [data-expand-button] {\n cursor: pointer;\n min-width: 32px;\n color: var(--diffs-fg-number);\n border-right: 2px solid var(--diffs-bg);\n flex-shrink: 0;\n justify-content: center;\n align-self: stretch;\n\n &:hover {\n color: var(--diffs-fg);\n }\n\n &[data-expand-all-button] {\n display: none;\n }\n }\n\n [data-expand-down] [data-icon] {\n transform: scaleY(-1);\n }\n\n [data-separator-content] {\n height: 100%;\n color: var(--diffs-fg-number);\n flex: auto;\n justify-content: flex-start;\n padding: 0 1ch;\n overflow: hidden;\n }\n\n [data-separator="line-info"], [data-separator="line-info-basic"] {\n & [data-separator-content] {\n user-select: none;\n height: 100%;\n overflow: clip;\n }\n }\n\n [data-unmodified-lines] {\n text-overflow: ellipsis;\n white-space: nowrap;\n flex: 0 auto;\n min-width: 0;\n display: block;\n overflow: hidden;\n }\n\n @supports (width: 1cqi) {\n [data-unified] {\n & [data-separator="line-info"] [data-separator-wrapper] {\n padding-inline: var(--diffs-gap-inline, var(--diffs-gap-fallback));\n width: 100cqi;\n\n & [data-separator-content] {\n border-radius: 6px;\n }\n }\n\n & [data-separator="line-info"][data-expand-index] [data-separator-wrapper] [data-separator-content] {\n border-top-left-radius: unset;\n border-bottom-left-radius: unset;\n }\n }\n\n [data-gutter] {\n & [data-separator="line-info"] [data-separator-wrapper] {\n padding-left: var(--diffs-gap-inline, var(--diffs-gap-fallback));\n }\n\n & [data-separator="line-info"] [data-separator-content] {\n border-top-left-radius: 6px;\n border-bottom-left-radius: 6px;\n }\n\n & [data-separator="line-info"][data-expand-index] [data-separator-content] {\n border-top-left-radius: unset;\n border-bottom-left-radius: unset;\n }\n }\n\n [data-additions] {\n & [data-content] [data-separator="line-info"] {\n background-color: var(--diffs-bg);\n\n & [data-separator-wrapper] {\n display: none;\n }\n }\n\n & [data-gutter] [data-separator="line-info"] [data-separator-wrapper] {\n background-color: var(--diffs-bg-separator);\n border-top-right-radius: 6px;\n border-bottom-right-radius: 6px;\n height: 100%;\n display: block;\n\n & [data-separator-content], & [data-expand-button] {\n display: none;\n }\n }\n }\n\n [data-overflow="scroll"] [data-additions] [data-gutter] [data-separator="line-info"] [data-separator-wrapper] {\n width: calc(100cqi - var(--diffs-gap-inline, var(--diffs-gap-fallback)));\n }\n\n [data-overflow="wrap"] [data-additions] [data-content] [data-separator="line-info"] [data-separator-wrapper] {\n background-color: var(--diffs-bg-separator);\n height: 100%;\n margin-right: var(--diffs-gap-inline, var(--diffs-gap-fallback));\n border-top-right-radius: 6px;\n border-bottom-right-radius: 6px;\n display: block;\n\n & [data-separator-content], & [data-expand-button] {\n display: none;\n }\n }\n\n [data-separator="line-info"] [data-separator-wrapper] {\n & [data-expand-both], & [data-expand-down], & [data-expand-up] {\n border-top-left-radius: 6px;\n border-bottom-left-radius: 6px;\n }\n }\n\n @media (pointer: fine) {\n [data-separator="line-info"] [data-separator-wrapper] {\n &[data-separator-multi-button] {\n & [data-expand-up] {\n border-top-left-radius: 6px;\n border-bottom-left-radius: unset;\n }\n\n & [data-expand-down] {\n border-bottom-left-radius: 6px;\n border-top-left-radius: unset;\n }\n }\n }\n }\n }\n\n @media (pointer: coarse) {\n [data-separator="line-info-basic"] [data-separator-wrapper][data-separator-multi-button] {\n grid-template-columns: 34px 34px auto;\n\n & [data-separator-content] {\n grid-column: unset;\n grid-row: unset;\n }\n }\n\n @supports (width: 1cqi) {\n [data-separator="line-info"] [data-separator-wrapper] {\n & [data-expand-both], & [data-expand-down], & [data-expand-up] {\n border-top-left-radius: 6px;\n border-bottom-left-radius: 6px;\n }\n\n &[data-separator-multi-button] {\n & [data-expand-up] {\n border-top-left-radius: 6px;\n border-bottom-left-radius: 6px;\n }\n\n & [data-expand-down] {\n border-bottom-left-radius: unset;\n border-top-left-radius: unset;\n }\n }\n }\n }\n }\n\n @media (pointer: fine) {\n [data-separator-wrapper][data-separator-multi-button] {\n grid-template-rows: 50% 50%;\n display: grid;\n\n & [data-separator-content] {\n grid-area: 1 / 2 / -1;\n min-width: min-content;\n }\n\n & [data-expand-button] {\n grid-column: 1;\n }\n }\n\n [data-separator="line-info"] [data-separator-wrapper], [data-separator="line-info"] [data-separator-wrapper][data-separator-multi-button] {\n grid-template-columns: 34px auto;\n }\n\n [data-separator="line-info-basic"][data-expand-index] [data-separator-wrapper] {\n grid-template-columns: 100% auto;\n }\n\n [data-separator="line-info"], [data-separator="line-info-basic"] {\n & [data-separator-multi-button] {\n & [data-expand-up] {\n border-bottom: 1px solid var(--diffs-bg);\n border-right: 2px solid var(--diffs-bg);\n }\n\n & [data-expand-down] {\n border-top: 1px solid var(--diffs-bg);\n border-right: 2px solid var(--diffs-bg);\n }\n }\n }\n }\n\n [data-additions] [data-gutter] [data-separator-wrapper], [data-additions] [data-separator="line-info-basic"] [data-separator-wrapper], [data-content] [data-separator-wrapper] {\n display: none;\n }\n\n [data-line-annotation] {\n min-height: var(--diffs-annotation-min-height, 0);\n z-index: 2;\n }\n\n [data-merge-conflict-actions] {\n z-index: 2;\n }\n\n [data-separator="custom"] {\n grid-template-columns: subgrid;\n display: grid;\n }\n\n [data-line], [data-column-number], [data-no-newline] {\n padding-inline: 1ch;\n position: relative;\n }\n\n [data-indicators="classic"] [data-line] {\n padding-inline-start: 2ch;\n }\n\n [data-indicators="classic"] {\n & [data-line-type="change-addition"], & [data-line-type="change-deletion"] {\n &[data-no-newline], &[data-line] {\n &:before {\n user-select: none;\n width: 1ch;\n height: 1lh;\n display: inline-block;\n position: absolute;\n top: 0;\n left: 0;\n }\n }\n }\n\n & [data-line-type="change-addition"] {\n &[data-line], &[data-no-newline] {\n &:before {\n content: "+";\n color: var(--diffs-addition-base);\n }\n }\n }\n\n & [data-line-type="change-deletion"] {\n &[data-line], &[data-no-newline] {\n &:before {\n content: "-";\n color: var(--diffs-deletion-base);\n }\n }\n }\n }\n\n [data-indicators="bars"] {\n & [data-line-type="change-deletion"], & [data-line-type="change-addition"] {\n &[data-column-number] {\n &:before {\n content: "";\n user-select: none;\n contain: strict;\n width: 4px;\n height: 100%;\n display: block;\n position: absolute;\n top: 0;\n left: 0;\n }\n }\n }\n\n & [data-line-type="change-deletion"] {\n &[data-column-number] {\n &:before {\n background-image: linear-gradient(0deg,\n var(--diffs-bg-deletion) 50%,\n var(--diffs-deletion-base) 50%);\n background-repeat: repeat;\n background-size: 2px 2px;\n background-size: calc(1lh / round(1lh / 2px))\n calc(1lh / round(1lh / 2px));\n }\n }\n }\n\n & [data-line-type="change-addition"] {\n &[data-column-number] {\n &:before {\n background-color: var(--diffs-addition-base);\n }\n }\n }\n }\n\n [data-overflow="wrap"] {\n & [data-line], & [data-annotation-content] {\n white-space: pre-wrap;\n word-break: break-word;\n }\n }\n\n [data-overflow="scroll"] [data-line] {\n white-space: pre;\n min-height: 1lh;\n }\n\n [data-column-number] {\n box-sizing: content-box;\n text-align: right;\n user-select: none;\n color: var(--diffs-fg-number);\n padding-left: 2ch;\n }\n\n [data-line-number-content] {\n min-width: var(--diffs-min-number-column-width, var(--diffs-min-number-column-width-default, 3ch));\n z-index: 1;\n display: inline-block;\n position: relative;\n }\n\n [data-disable-line-numbers] {\n & [data-gutter-buffer], & [data-column-number] {\n min-width: 4px;\n padding: 0;\n\n &:before {\n min-width: 0;\n }\n }\n\n & [data-line-number-content] {\n display: none;\n }\n\n & [data-gutter-utility-slot] {\n right: unset;\n justify-content: flex-start;\n left: 0;\n }\n\n &[data-indicators="bars"] [data-gutter-utility-slot] {\n left: 6px;\n }\n }\n\n [data-file][data-disable-line-numbers] {\n & [data-gutter-buffer], & [data-column-number] {\n border-right: 0;\n min-width: 0;\n }\n }\n\n [data-diff-span] {\n box-decoration-break: clone;\n border-radius: 3px;\n }\n\n [data-line-type="change-addition"] [data-diff-span] {\n background-color: var(--diffs-bg-addition-emphasis);\n }\n\n [data-line-type="change-deletion"] [data-diff-span] {\n background-color: var(--diffs-bg-deletion-emphasis);\n }\n\n [data-merge-conflict="marker-start"], [data-merge-conflict="marker-base"], [data-merge-conflict="marker-separator"], [data-merge-conflict="marker-end"] {\n color: var(--diffs-fg);\n padding-left: 1ch;\n }\n\n [data-merge-conflict="marker-start"], [data-merge-conflict="marker-end"] {\n align-items: center;\n display: flex;\n\n &:after {\n color: var(--diffs-fg-conflict-marker);\n font-size: .75rem;\n font-style: normal;\n line-height: 1.25rem;\n font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));\n padding-left: 1ch;\n }\n }\n\n [data-merge-conflict="marker-start"]:after {\n content: "(Current Change)";\n }\n\n [data-merge-conflict="marker-end"]:after {\n content: "(Incoming Change)";\n }\n\n [data-merge-conflict-actions-content] {\n min-height: 1.75rem;\n font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));\n color: var(--diffs-fg);\n align-items: center;\n gap: .25rem;\n padding-inline: .5rem;\n font-size: .75rem;\n line-height: 1.2;\n display: flex;\n }\n\n [data-merge-conflict-action] {\n appearance: none;\n color: var(--diffs-fg-number);\n font: inherit;\n cursor: pointer;\n background: none;\n border: 0;\n padding: 0;\n font-style: normal;\n }\n\n [data-merge-conflict-action]:hover {\n color: var(--diffs-fg);\n }\n\n [data-merge-conflict-action="current"]:hover {\n color: var(--diffs-addition-base);\n }\n\n [data-merge-conflict-action="incoming"]:hover {\n color: var(--diffs-modified-base);\n }\n\n [data-merge-conflict-action-separator] {\n color: var(--diffs-fg-number);\n opacity: .6;\n user-select: none;\n }\n\n [data-diffs-header="default"] {\n background-color: var(--diffs-bg);\n justify-content: space-between;\n align-items: center;\n gap: var(--diffs-gap-inline, var(--diffs-gap-fallback));\n min-height: calc(1lh + (var(--diffs-gap-block, var(--diffs-gap-fallback)) * 3));\n z-index: 2;\n flex-direction: row;\n padding-inline: 16px;\n display: flex;\n position: relative;\n top: 0;\n }\n\n [data-header-content] {\n align-items: center;\n gap: var(--diffs-gap-inline, var(--diffs-gap-fallback));\n white-space: nowrap;\n flex-direction: row;\n min-width: 0;\n display: flex;\n }\n\n [data-header-content] [data-prev-name], [data-header-content] [data-title] {\n text-overflow: ellipsis;\n white-space: nowrap;\n direction: rtl;\n min-width: 0;\n overflow: hidden;\n }\n\n [data-prev-name] {\n opacity: .7;\n }\n\n [data-rename-icon] {\n fill: currentColor;\n flex-grow: 0;\n flex-shrink: 0;\n }\n\n [data-diffs-header="default"] [data-metadata] {\n white-space: nowrap;\n align-items: center;\n gap: 1ch;\n display: flex;\n }\n\n [data-diffs-header="default"] [data-additions-count] {\n font-family: var(--diffs-font-family, var(--diffs-font-fallback));\n color: var(--diffs-addition-base);\n }\n\n [data-diffs-header="default"] [data-deletions-count] {\n font-family: var(--diffs-font-family, var(--diffs-font-fallback));\n color: var(--diffs-deletion-base);\n }\n\n [data-change-icon] {\n fill: currentColor;\n flex-shrink: 0;\n }\n\n [data-change-icon="change"], [data-change-icon="rename-pure"], [data-change-icon="rename-changed"] {\n color: var(--diffs-modified-base);\n }\n\n [data-change-icon="new"] {\n color: var(--diffs-addition-base);\n }\n\n [data-change-icon="deleted"] {\n color: var(--diffs-deletion-base);\n }\n\n [data-change-icon="file"] {\n opacity: .6;\n }\n\n [data-annotation-content] {\n z-index: 2;\n isolation: isolate;\n align-self: flex-start;\n min-width: 0;\n display: flow-root;\n position: relative;\n }\n\n [data-overflow="scroll"] [data-annotation-content], [data-overflow="scroll"] [data-merge-conflict-actions-content] {\n width: var(--diffs-column-content-width, auto);\n left: var(--diffs-column-number-width, 0);\n position: sticky;\n }\n\n [data-annotation-slot] {\n text-wrap-mode: wrap;\n word-break: normal;\n white-space-collapse: collapse;\n }\n\n [data-gutter-utility-slot] {\n touch-action: none;\n justify-content: flex-end;\n display: flex;\n position: absolute;\n top: 0;\n bottom: 0;\n right: 0;\n }\n\n [data-utility-button] {\n appearance: none;\n cursor: pointer;\n width: 1lh;\n height: 1lh;\n font-size: var(--diffs-font-size, 13px);\n line-height: var(--diffs-line-height, 20px);\n background-color: var(--diffs-modified-base);\n color: var(--diffs-bg);\n fill: currentColor;\n z-index: 4;\n touch-action: none;\n border: none;\n border-radius: 4px;\n justify-content: center;\n align-items: center;\n margin-right: calc(-1lh + 1ch);\n padding: 0;\n display: flex;\n position: relative;\n\n &:before {\n content: "";\n display: block;\n position: absolute;\n inset: 0 0 0 -4px;\n }\n }\n\n [data-decoration-bar-stack] {\n pointer-events: none;\n isolation: isolate;\n z-index: 1;\n background-color: var(--diffs-decoration-bar-color, transparent);\n box-sizing: content-box;\n border-left: 2px solid var(--diffs-bg);\n border-right: 2px solid var(--diffs-bg);\n width: 6px;\n position: absolute;\n top: 0;\n bottom: 0;\n right: -2px;\n\n [data-decoration-bar-depth="1"] & {\n background-color: color-mix(in lab,\n var(--diffs-bg) 20%,\n var(--diffs-decoration-bar-color, transparent));\n }\n\n [data-decoration-bar-depth="2"] & {\n background-color: color-mix(in lab,\n var(--diffs-bg) 45%,\n var(--diffs-decoration-bar-color, transparent));\n }\n\n [data-decoration-bar-depth="3"] & {\n background-color: color-mix(in lab,\n var(--diffs-bg) 65%,\n var(--diffs-decoration-bar-color, transparent));\n }\n\n [data-decoration-bar-start] & {\n border-top-left-radius: 5px;\n border-top-right-radius: 5px;\n }\n\n [data-decoration-bar-end] & {\n z-index: 3;\n border-bottom-right-radius: 5px;\n border-bottom-left-radius: 5px;\n }\n }\n\n [data-placeholder] {\n contain: strict;\n }\n\n [data-error-wrapper] {\n padding: var(--diffs-gap-block, var(--diffs-gap-fallback))\n var(--diffs-gap-inline, var(--diffs-gap-fallback));\n scrollbar-width: none;\n max-height: 400px;\n overflow: auto;\n\n & [data-error-message] {\n color: var(--diffs-deletion-base);\n font-size: 18px;\n font-weight: bold;\n }\n\n & [data-error-stack] {\n color: var(--diffs-fg-number);\n }\n }\n}\n\n@layer theme, rendered, unsafe;\n';let uc;function hc(e){if(null!=uc)return uc;const t=e.host;if("undefined"!=typeof HTMLElement&&t instanceof HTMLElement&&!t.isConnected)return;const n=document.createElement("div");n.setAttribute("data-code",""),n.setAttribute(K,"true");const i=document.createElement("div");return i.style.position="relative",i.style.width="200%",i.style.height="200%",n.appendChild(i),e.appendChild(n),uc=Math.max(n.offsetHeight-n.clientHeight,0),n.remove(),uc}function fc(e){return`${X}: ${null==e?"var(--diffs-scrollbar-gutter-fallback)":`${e}px`};`}const pc="@layer base, theme, rendered, unsafe;",mc=new RegExp(`${gc=X,gc.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*:\\s*[^;]+;`);var gc;function vc(e){return`${pc}\n${cc}\n@layer theme {\n ${e}\n}`}function bc(e){return`${pc}\n@layer unsafe {\n ${e}\n}`}function yc(e,t="system",n){return`${pc}\n@layer rendered {\n :host {${"system"===t?"":`\n color-scheme: ${t};`}\n ${fc(n)}\n ${e}\n }\n}`}function Cc(e,t){const n=fc(t);return e.replace(mc,n)}function Sc({code:e,pre:t,columnType:n,rowSpan:i,containerSize:r=!1}={}){return null==e&&((e=document.createElement("code")).setAttribute("data-code",""),null!=n&&e.setAttribute(`data-${n}`,""),null==t||t.appendChild(e)),null!=i?e.style.setProperty("grid-row",`span ${i}`):e.style.removeProperty("grid-row"),r?e.setAttribute("data-container-size",""):e.removeAttribute("data-container-size"),e}function kc(e,t){var n;if(null==t)return;const i=null!=(n=e.shadowRoot)?n:e.attachShadow({mode:"open"});""===i.innerHTML&&(i.innerHTML=t)}function xc(e,{type:t,diffIndicators:n,disableBackground:i,disableLineNumbers:r,overflow:o,split:s,totalLines:a,customProperties:l}){if(null!=l)for(const d in l){const t=l[d];null!=t&&e.setAttribute(d,`${t}`)}switch("diff"===t?(e.setAttribute("data-diff",""),e.removeAttribute("data-file")):(e.setAttribute("data-file",""),e.removeAttribute("data-diff")),n){case"bars":case"classic":e.setAttribute("data-indicators",n);break;case"none":e.removeAttribute("data-indicators")}return r?e.setAttribute("data-disable-line-numbers",""):e.removeAttribute("data-disable-line-numbers"),i?e.removeAttribute("data-background"):e.setAttribute("data-background",""),"diff"===t?e.setAttribute("data-diff-type",s?"split":"single"):e.removeAttribute("data-diff-type"),e.setAttribute("data-overflow",o),e.style.setProperty("--diffs-min-number-column-width-default",`${`${a}`.length}ch`),e}function wc(e){var t;if("undefined"!=typeof HTMLStyleElement&&e instanceof HTMLStyleElement)return!0;const n=null!=(t=e.tagName)?t:e.nodeName;return"string"==typeof n&&"style"===n.toLowerCase()}function Lc(e){return{theme:null==e?void 0:e.theme,disableLineNumbers:null==e?void 0:e.disableLineNumbers,overflow:null==e?void 0:e.overflow,themeType:null==e?void 0:e.themeType,collapsed:null==e?void 0:e.collapsed,disableFileHeader:null==e?void 0:e.disableFileHeader,disableVirtualizationBuffers:null==e?void 0:e.disableVirtualizationBuffers,stickyHeader:null==e?void 0:e.stickyHeader,preferredHighlighter:null==e?void 0:e.preferredHighlighter,useCSSClasses:null==e?void 0:e.useCSSClasses,useTokenTransformer:null==e?void 0:e.useTokenTransformer,tokenizeMaxLineLength:null==e?void 0:e.tokenizeMaxLineLength,tokenizeMaxLength:null==e?void 0:e.tokenizeMaxLength,unsafeCSS:null==e?void 0:e.unsafeCSS,headerRenderMode:null!=(null==e?void 0:e.renderCustomHeader)?"custom":"default"}}function Tc({shadowRoot:e,currentNode:t,themeCSS:n}){if(""!==n.trim())return null!=t||(t=function(){const e=document.createElement("style");return e.setAttribute(W,""),e}()),t.textContent=n,t.parentNode!==e&&e.appendChild(t),t;null==t||t.remove()}if("undefined"!=typeof HTMLElement&&null==customElements.get("diffs-container")){let e;class t extends HTMLElement{constructor(){if(super(),null!=this.shadowRoot)return;const t=this.attachShadow({mode:"open"});null==e&&(e=new CSSStyleSheet,e.replaceSync(cc)),t.adoptedStyleSheets=[e]}connectedCallback(){var e;hc(null!=(e=this.shadowRoot)?e:this.attachShadow({mode:"open"}))}}customElements.define(L,t)}const Ac=[];let Ic=-1;var Ec=(u=class{constructor(e={theme:G},t,n=!1){var i;y(this,"options"),y(this,"workerManager"),y(this,"isContainerManaged"),y(this,"__id","file:"+ ++Ic),y(this,"type","file"),y(this,"fileContainer"),y(this,"spriteSVG"),y(this,"pre"),y(this,"code"),y(this,"bufferBefore"),y(this,"bufferAfter"),y(this,"themeCSSStyle"),y(this,"appliedThemeCSS"),y(this,"hasAdoptedThemeCSS",!1),y(this,"unsafeCSSStyle"),y(this,"appliedUnsafeCSS"),y(this,"gutterUtilityContent"),y(this,"errorWrapper"),y(this,"placeHolder"),y(this,"lastRenderedHeaderHTML"),y(this,"cachedHeaderHTML"),y(this,"appliedPreAttributes"),y(this,"lastRowCount"),y(this,"mounted",!1),y(this,"headerElement"),y(this,"headerCustom"),y(this,"headerPrefix"),y(this,"headerMetadata"),y(this,"fileRenderer"),y(this,"resizeManager"),y(this,"interactionManager"),y(this,"annotationCache",/* @__PURE__ */new Map),y(this,"lineAnnotations",[]),y(this,"managersDirty",!1),y(this,"file"),y(this,"renderRange"),y(this,"enabled",!0),y(this,"handleHighlightRender",()=>{this.rerender()}),y(this,"getHoveredLine",()=>this.interactionManager.getHoveredLine()),this.options=e,this.workerManager=t,this.isContainerManaged=n,this.fileRenderer=new tc(e,this.handleHighlightRender,this.workerManager),this.resizeManager=new pn,this.interactionManager=new Zt("file",en(e)),null==(i=this.workerManager)||i.subscribeToThemeChanges(this)}rerender(){this.enabled&&null!=this.file&&this.render({file:this.file,forceRender:!0,renderRange:this.renderRange})}onThemeChange(){this.fileRenderer.clearRenderCache(),this.rerender()}setOptions(e){null!=e&&(this.options=e,this.cachedHeaderHTML=void 0,this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(en(this.options))}mergeOptions(e){this.options={...this.options,...e}}setThemeType(e){var t;(null!=(t=this.options.themeType)?t:"system")!==e&&(this.mergeOptions({themeType:e}),this.applyCachedThemeState(e))}applyCachedThemeState(e){var t;if("string"==typeof this.options.theme||null==this.fileContainer||null==this.appliedThemeCSS)return!1;const n=null!=(t=this.appliedThemeCSS.baseThemeType)?t:e;return this.appliedThemeCSS.themeType!==n&&(this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType),!0)}hasThemeChanged(){var e;return null!=this.appliedThemeCSS&&!ue(this.appliedThemeCSS.theme,null!=(e=this.options.theme)?e:G)}setLineAnnotations(e){this.lineAnnotations=e}setSelectedLines(e,t){this.interactionManager.setSelection(e,t)}flushManagers(){if(!this.managersDirty||null==this.pre)return void(this.managersDirty=!1);const{overflow:e="scroll"}=this.options;this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,"wrap"===e),this.managersDirty=!1}cleanUp(e=!1){var t,n;this.emitPostRender(!0),this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.managersDirty=!1,null==(t=this.workerManager)||t.unsubscribeToThemeChanges(this),this.renderRange=void 0,this.isContainerManaged||null==(n=this.fileContainer)||n.remove(),this.fileContainer=void 0,this.mounted=!1,e||(this.lineAnnotations=[]),this.annotationCache.clear(),this.pre=void 0,this.bufferBefore=void 0,this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.lastRenderedHeaderHTML=void 0,e||(this.cachedHeaderHTML=void 0),this.errorWrapper=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.placeHolder=void 0,this.unsafeCSSStyle=void 0,e?this.fileRenderer.recycle():(this.fileRenderer.cleanUp(),this.workerManager=void 0,this.file=void 0),this.enabled=!1}virtualizedSetup(){var e;this.enabled=!0,null==(e=this.workerManager)||e.subscribeToThemeChanges(this)}hydrate(e){const{fileContainer:t,prerenderedHTML:n,preventEmit:i=!1,file:r,lineAnnotations:o}=e;this.hydrateElements(t,n),function(e,t,n=!1){return!n&&null==e&&null!=t}(this.pre,r,this.options.collapsed)||function(e,t,n=!1){return null==e&&null!=t&&!n}(this.headerElement,r,this.options.disableFileHeader)?this.render({...e,preventEmit:!0}):this.hydrationSetup({file:r,lineAnnotations:o}),i||this.emitPostRender()}hydrateElements(e,t){var n,i;this.fileContainer!==e&&this.emitPostRender(!0),kc(e,t);for(const r of Array.from(null!=(i=null==(n=e.shadowRoot)?void 0:n.children)?i:[]))r instanceof SVGElement?this.spriteSVG=r:r instanceof HTMLElement&&(r instanceof HTMLPreElement?(this.pre=r,this.appliedPreAttributes=void 0):r instanceof HTMLStyleElement&&r.hasAttribute("data-theme-css")?this.themeCSSStyle=r:r instanceof HTMLStyleElement&&r.hasAttribute("data-unsafe-css")?(this.unsafeCSSStyle=r,this.appliedUnsafeCSS=r.textContent):"diffsHeader"in r.dataset&&(this.headerElement=r,this.lastRenderedHeaderHTML=void 0));null!=this.pre&&(this.syncCodeNodeFromPre(this.pre),this.pre.removeAttribute("data-dehydrated")),this.fileContainer=e,this.hydrateMeasuredScrollbar()}hydrationSetup({file:e,lineAnnotations:t}){this.lineAnnotations=null!=t?t:this.lineAnnotations,this.file=e,this.fileRenderer.setOptions(Lc(this.options)),this.syncInteractionOptions(),null!=this.pre&&(this.fileRenderer.hydrate(e),this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}getOrCreateLineCache(e=this.file){return null!=e?this.fileRenderer.getOrCreateLineCache(e):Ac}render({file:e,fileContainer:t,forceRender:n=!1,preventEmit:i=!1,containerWrapper:r,deferManagers:o=!1,lineAnnotations:s,renderRange:a}){var l;const{collapsed:d=!1,themeType:c="system"}=this.options;if(!this.enabled)throw new Error("File.render: attempting to call render after cleaned up");const u=d?void 0:a,h=this.renderRange,f=this.hasThemeChanged(),p=null!=s&&(s.length>0||this.lineAnnotations.length>0)&&s!==this.lineAnnotations,m=!id(this.file,e);if(!d&&!n&&rd(u,this.renderRange)&&!m&&!p&&!f)return this.applyCachedThemeState(c);this.renderRange=u,m&&(this.cachedHeaderHTML=void 0),this.file=e,this.fileRenderer.setOptions(Lc(this.options)),this.syncInteractionOptions(),null!=s&&this.setLineAnnotations(s),this.fileRenderer.setLineAnnotations(this.lineAnnotations);const{disableErrorHandling:g=!1,disableFileHeader:v=!1}=this.options;if(v&&(null!=this.headerElement&&(this.headerElement.remove(),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0),this.clearHeaderSlots()),t=this.getOrCreateFileContainerNode(t,r),this.applyCachedThemeState(c),d){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{const n=this.fileRenderer.renderFile(e,re);null!=n&&this.applyThemeState(t,n.themeStyles,c,n.baseThemeType),null!=(null==n?void 0:n.headerAST)&&this.applyHeaderToDOM(n.headerAST,t),this.injectUnsafeCSS()}catch(b){if(g)throw b;console.error(b),b instanceof Error&&this.applyErrorToDOM(b,t)}return i||this.emitPostRender(),!0}try{const i=this.getOrCreatePreNode(t);if(!this.canPartiallyRender(n,p,m||f)||!this.applyPartialRender(h,u)){const n=this.fileRenderer.renderFile(e,u);if(null==n)return!1===(null==(l=this.workerManager)?void 0:l.isInitialized())&&this.workerManager.initialize().then(()=>this.rerender()),!1;this.applyThemeState(t,n.themeStyles,c,n.baseThemeType),null!=n.headerAST&&this.applyHeaderToDOM(n.headerAST,t),this.applyFullRender(n,i)}this.applyBuffers(i,u),this.injectUnsafeCSS(),this.managersDirty=!0,o||this.flushManagers(),this.renderAnnotations(),this.renderGutterUtility()}catch(b){if(g)throw b;console.error(b),b instanceof Error&&this.applyErrorToDOM(b,t)}return i||this.emitPostRender(),!0}emitPostRender(e=!1){const{fileContainer:t,options:{onPostRender:n}}=this;if(e){if(!this.mounted)return;if(this.mounted=!1,null==t)return;return void(null==n||n(t,this,"unmount"))}if(null==t)return;const i=this.mounted?"update":"mount";this.mounted=!0,null==n||n(t,this,i)}removeRenderedCode(){var e,t,n,i;this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),null==(e=this.bufferBefore)||e.remove(),this.bufferBefore=void 0,null==(t=this.bufferAfter)||t.remove(),this.bufferAfter=void 0,null==(n=this.code)||n.remove(),this.code=void 0,null==(i=this.pre)||i.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){var e;for(const{element:t}of this.annotationCache.values())t.remove();this.annotationCache.clear(),null==(e=this.gutterUtilityContent)||e.remove(),this.gutterUtilityContent=void 0}canPartiallyRender(e,t,n){return!(e||t||n)}renderPlaceholder(e){var t;if(null==this.fileContainer)return!1;if(this.emitPostRender(!0),this.cleanChildNodes(),null==this.placeHolder){const e=null!=(t=this.fileContainer.shadowRoot)?t:this.fileContainer.attachShadow({mode:"open"});this.placeHolder=document.createElement("div"),this.placeHolder.dataset.placeholder="",e.appendChild(this.placeHolder)}return this.placeHolder.style.setProperty("height",`${e}px`),!0}primeHighlightCache(){var e;const{file:t,workerManager:n}=this;null==t||null==t.cacheKey||null==n||Jd(t)||this.fileRenderer.getOrCreateLineCache(t).length>(null!=(e=this.options.tokenizeMaxLength)?e:1e5)||n.primeFileHighlightCache(t)}cleanChildNodes(){var e,t,n,i,r,o,s,a,l,d,c,u,h;this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),null==(e=this.bufferAfter)||e.remove(),null==(t=this.bufferBefore)||t.remove(),null==(n=this.code)||n.remove(),null==(i=this.errorWrapper)||i.remove(),null==(r=this.headerElement)||r.remove(),null==(o=this.gutterUtilityContent)||o.remove(),null==(s=this.headerPrefix)||s.remove(),null==(a=this.headerMetadata)||a.remove(),null==(l=this.headerCustom)||l.remove(),null==(d=this.pre)||d.remove(),null==(c=this.spriteSVG)||c.remove(),null==(u=this.themeCSSStyle)||u.remove(),null==(h=this.unsafeCSSStyle)||h.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.code=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.gutterUtilityContent=void 0,this.headerPrefix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.lastRenderedHeaderHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderAnnotations(){if(this.isContainerManaged||null==this.fileContainer){for(const{element:e}of this.annotationCache.values())e.remove();return void this.annotationCache.clear()}const e=new Map(this.annotationCache),{renderAnnotation:t}=this.options;if(null!=t&&this.lineAnnotations.length>0)for(const[n,i]of this.lineAnnotations.entries()){const r=`${n}-${Sd(i)}`;let o=this.annotationCache.get(r);if(null==o||!rc(i,o.annotation)){null==o||o.element.remove();const e=t(i);if(null==e)continue;o={element:ac(Sd(i)),annotation:i},o.element.appendChild(e),this.fileContainer.appendChild(o.element),this.annotationCache.set(r,o)}e.delete(r)}for(const[n,{element:i}]of e.entries())this.annotationCache.delete(n),i.remove()}renderGutterUtility(){var e,t;const{renderGutterUtility:n}=this.options;if(null==this.fileContainer||null==n)return null==(e=this.gutterUtilityContent)||e.remove(),void(this.gutterUtilityContent=void 0);const i=n(this.interactionManager.getHoveredLine);if(null!=i&&null!=this.gutterUtilityContent)return;if(null==i)return null==(t=this.gutterUtilityContent)||t.remove(),void(this.gutterUtilityContent=void 0);const r=lc();r.appendChild(i),this.fileContainer.appendChild(r),this.gutterUtilityContent=r}injectUnsafeCSS(){var e,t;const{unsafeCSS:n}=this.options,i=null==(e=this.fileContainer)?void 0:e.shadowRoot;if(null!=i)return null==n||""===n?(null!=this.unsafeCSSStyle&&(this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0),void(this.appliedUnsafeCSS=void 0)):void((null==(t=this.unsafeCSSStyle)?void 0:t.parentNode)===i&&this.appliedUnsafeCSS===n||(null!=this.unsafeCSSStyle||(this.unsafeCSSStyle=dc()),this.unsafeCSSStyle.parentNode!==i&&i.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=bc(n),this.appliedUnsafeCSS=n))}applyThemeState(e,t,n,i){var r,o,s,a,l;const d=null!=(r=e.shadowRoot)?r:e.attachShadow({mode:"open"}),c=null!=i?i:n,u=null!=(o=this.options.theme)?o:G,h="string"==typeof u?u:{...u},f=hc(d);if((null==(s=this.themeCSSStyle)?void 0:s.parentNode)!==d||(null==(a=this.appliedThemeCSS)?void 0:a.themeStyles)!==t||this.appliedThemeCSS.themeType!==c||this.appliedThemeCSS.scrollbarGutter!==f){if(this.hasAdoptedThemeCSS&&(null==(l=this.themeCSSStyle)?void 0:l.parentNode)===d)return this.hasAdoptedThemeCSS=!1,void(this.appliedThemeCSS={theme:h,themeStyles:t,themeType:c,baseThemeType:i,scrollbarGutter:f});this.themeCSSStyle=Tc({shadowRoot:d,currentNode:this.themeCSSStyle,themeCSS:yc(t,c,f)}),this.appliedThemeCSS=null!=this.themeCSSStyle?{theme:h,themeStyles:t,themeType:c,baseThemeType:i,scrollbarGutter:f}:void 0}else this.appliedThemeCSS.theme=h}hydrateMeasuredScrollbar(){var e,t;const n=null==(e=this.fileContainer)?void 0:e.shadowRoot;null!=n&&null!=this.themeCSSStyle&&(this.themeCSSStyle.textContent=Cc(null!=(t=this.themeCSSStyle.textContent)?t:"",hc(n)))}applyFullRender(e,t){this.cleanupErrorWrapper(),this.applyPreNodeAttributes(t,e),this.code=Sc({code:this.code}),this.code.innerHTML=this.fileRenderer.renderPartialHTML(this.fileRenderer.renderCodeAST(e)),t.replaceChildren(this.code),this.lastRowCount=e.rowCount}applyPartialRender(e,t){if(null==e||null==t)return!1;const{file:n,code:i}=this,r=null!=i?this.getColumns(i):void 0;if(null==n||null==i||null==r)return!1;const o=e.startingLine,s=t.startingLine,a=e.totalLines===1/0?Number.POSITIVE_INFINITY:o+e.totalLines,l=t.totalLines===1/0?Number.POSITIVE_INFINITY:s+t.totalLines,d=Math.max(o,s),c=Math.min(a,l);if(c<=d)return!1;if(!this.trimDOMToOverlap(r.gutter,d,c)||!this.trimDOMToOverlap(r.content,d,c))return!1;let{length:u}=r.content.children;const h=(e,t)=>{if(!(t<=0))return this.fileRenderer.renderFile(n,{startingLine:e,totalLines:t,bufferBefore:0,bufferAfter:0})},f=s<d?h(s,d-s):void 0;if(void 0===f&&s<d)return!1;const p=l===Number.POSITIVE_INFINITY?Number.POSITIVE_INFINITY:Math.max(0,l-c),m=l>c?h(c,p):void 0;return!(void 0===m&&l>c||(this.cleanupErrorWrapper(),null!=f&&(r.gutter.insertAdjacentHTML("afterbegin",this.fileRenderer.renderPartialHTML(f.gutterAST)),r.content.insertAdjacentHTML("afterbegin",this.fileRenderer.renderPartialHTML(f.contentAST)),u+=f.rowCount),null!=m&&(r.gutter.insertAdjacentHTML("beforeend",this.fileRenderer.renderPartialHTML(m.gutterAST)),r.content.insertAdjacentHTML("beforeend",this.fileRenderer.renderPartialHTML(m.contentAST)),u+=m.rowCount),this.lastRowCount!==u&&(r.gutter.style.setProperty("grid-row",`span ${u}`),r.content.style.setProperty("grid-row",`span ${u}`),this.lastRowCount=u),0))}getColumns(e){const t=e.children[0],n=e.children[1];if(t instanceof HTMLElement&&n instanceof HTMLElement&&null!=t.dataset.gutter&&null!=n.dataset.content)return{gutter:t,content:n}}trimDOMToOverlap(e,t,n){var i,r,o,s;const a=this.getDOMBoundaryIndices(e,[t,n]),l=null!=(i=a.get(t))?i:e.children.length,d=null!=(r=a.get(n))?r:e.children.length;if(l>d)return!1;for(let c=e.children.length-1;c>=d;c-=1)null==(o=e.children[c])||o.remove();for(let c=l-1;c>=0;c-=1)null==(s=e.children[c])||s.remove();return!0}getDOMBoundaryIndices(e,t){const n=[...new Set(t)].sort((e,t)=>e-t),i=/* @__PURE__ */new Map;if(0===n.length)return i;let r=0,o=n[r];const{children:s}=e;0===o&&(i.set(0,0),r+=1,o=n[r]);for(let a=0;a<s.length;a+=1){const e=s[a];if(!(e instanceof HTMLElement))continue;const t=this.getLineIndexFromDOMNode(e);if(null!=t){for(;null!=o&&t>=o;)i.set(o,a),r+=1,o=n[r];if(r>=n.length)break}}for(const a of n)i.has(a)||i.set(a,s.length);return i}getLineIndexFromDOMNode(e){const t=e.dataset.lineIndex;if(null==t)return;const n=Number(t);return Number.isNaN(n)?void 0:n}applyBuffers(e,t){if(null==t||this.shouldDisableVirtualizationBuffers())return null!=this.bufferBefore&&(this.bufferBefore.remove(),this.bufferBefore=void 0),void(null!=this.bufferAfter&&(this.bufferAfter.remove(),this.bufferAfter=void 0));t.bufferBefore>0?(null==this.bufferBefore&&(this.bufferBefore=document.createElement("div"),this.bufferBefore.dataset.virtualizerBuffer="before",e.before(this.bufferBefore)),this.bufferBefore.style.setProperty("height",`${t.bufferBefore}px`),this.bufferBefore.style.setProperty("contain","strict")):null!=this.bufferBefore&&(this.bufferBefore.remove(),this.bufferBefore=void 0),t.bufferAfter>0?(null==this.bufferAfter&&(this.bufferAfter=document.createElement("div"),this.bufferAfter.dataset.virtualizerBuffer="after",e.after(this.bufferAfter)),this.bufferAfter.style.setProperty("height",`${t.bufferAfter}px`),this.bufferAfter.style.setProperty("contain","strict")):null!=this.bufferAfter&&(this.bufferAfter.remove(),this.bufferAfter=void 0)}shouldDisableVirtualizationBuffers(){var e;return null!=(e=this.options.disableVirtualizationBuffers)&&e}applyHeaderToDOM(e,t){var n,i,r,o,s,a,l,d,c,u;const{file:h}=this;if(null==h)return;this.cleanupErrorWrapper(),null==(n=this.placeHolder)||n.remove(),this.placeHolder=void 0;const f=null!=(i=this.cachedHeaderHTML)?i:Qt(e);if(this.cachedHeaderHTML=f,f!==this.lastRenderedHeaderHTML){const e=document.createElement("div");e.innerHTML=f;const n=e.firstElementChild;if(!(n instanceof HTMLElement))return;null!=this.headerElement?null==(r=t.shadowRoot)||r.replaceChild(n,this.headerElement):null==(o=t.shadowRoot)||o.prepend(n),this.headerElement=n,this.lastRenderedHeaderHTML=f}if(this.isContainerManaged)return;const{renderHeaderPrefix:p,renderCustomHeader:m,renderHeaderMetadata:g}=this.options;if(null!=m){const e=null!=(s=m(h))?s:void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,U,e),null==(a=this.headerPrefix)||a.remove(),null==(l=this.headerMetadata)||l.remove(),this.headerPrefix=void 0,this.headerMetadata=void 0}else{const e=null!=(d=null==p?void 0:p(h))?d:void 0,n=null!=(c=null==g?void 0:g(h))?c:void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,$,e),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,z,n),null==(u=this.headerCustom)||u.remove(),this.headerCustom=void 0}}clearHeaderSlots(){var e,t,n;null==(e=this.headerPrefix)||e.remove(),null==(t=this.headerMetadata)||t.remove(),null==(n=this.headerCustom)||n.remove(),this.headerPrefix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,n,i){if(null==i)return void(null==t||t.remove());const r=null!=t?t:this.createHeaderSlotElement(n);return null==t&&e.appendChild(r),this.replaceHeaderSlotContent(r,i),r}replaceHeaderSlotContent(e,t){e.replaceChildren(),t instanceof Element?e.appendChild(t):e.innerText=`${t}`}createHeaderSlotElement(e){const t=document.createElement("div");return t.slot=e,t}getOrCreateFileContainerNode(e,t){var n;const{fileContainer:i}=this,r=null!=(n=null!=e?e:i)?n:document.createElement("diffs-container"),o=i!==r;return o&&this.emitPostRender(!0),this.fileContainer=r,null!=i&&o&&(this.lastRenderedHeaderHTML=void 0,this.headerElement=void 0),null!=t&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),o&&this.adoptReusableShellElements(this.fileContainer),this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(e){var t;const{shadowRoot:n}=e;if(null!=n)for(const i of n.children)i instanceof SVGElement?null!=this.spriteSVG||(this.spriteSVG=i):wc(i)&&i.hasAttribute("data-theme-css")?(null!=this.themeCSSStyle||(this.themeCSSStyle=i),this.hasAdoptedThemeCSS=!0):wc(i)&&i.hasAttribute("data-unsafe-css")&&(null!=this.unsafeCSSStyle||(this.unsafeCSSStyle=i),null!=this.appliedUnsafeCSS||(this.appliedUnsafeCSS=null!=(t=this.options.unsafeCSS)?t:void 0))}ensureSpriteSVG(e){var t;const n=null!=(t=e.shadowRoot)?t:e.attachShadow({mode:"open"});if(null==this.spriteSVG){const e=document.createElement("div");e.innerHTML=ic;const t=e.firstChild;t instanceof SVGElement&&(this.spriteSVG=t)}null!=this.spriteSVG&&this.spriteSVG.parentNode!==n&&n.appendChild(this.spriteSVG)}getOrCreatePreNode(e){var t,n,i;const r=null!=(t=e.shadowRoot)?t:e.attachShadow({mode:"open"});return null==this.pre?(this.pre=document.createElement("pre"),this.appliedPreAttributes=void 0,this.code=void 0,r.appendChild(this.pre)):this.pre.parentNode!==r&&(null==(n=e.shadowRoot)||n.appendChild(this.pre),this.appliedPreAttributes=void 0),null==(i=this.placeHolder)||i.remove(),this.placeHolder=void 0,this.pre}syncCodeNodeFromPre(e){this.code=void 0;for(const t of Array.from(e.children))if(t instanceof HTMLElement&&t.hasAttribute("data-code"))return void(this.code=t)}applyPreNodeAttributes(e,{totalLines:t}){const{overflow:n="scroll",disableLineNumbers:i=!1}=this.options,r={type:"file",split:!1,overflow:n,disableLineNumbers:i,diffIndicators:"none",disableBackground:!0,totalLines:t};oc(r,this.appliedPreAttributes)||(xc(e,r),this.appliedPreAttributes=r)}applyErrorToDOM(e,t){var n,i,r;this.cleanupErrorWrapper(),null==(n=this.pre)||n.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;const o=null!=(i=t.shadowRoot)?i:t.attachShadow({mode:"open"});null!=this.errorWrapper||(this.errorWrapper=document.createElement("div")),this.errorWrapper.dataset.errorWrapper="",this.errorWrapper.textContent="",o.appendChild(this.errorWrapper);const s=document.createElement("div");s.dataset.errorMessage="",s.innerText=e.message,this.errorWrapper.appendChild(s);const a=document.createElement("pre");a.dataset.errorStack="",a.innerText=null!=(r=e.stack)?r:"No Error Stack",this.errorWrapper.appendChild(a)}cleanupErrorWrapper(){var e;null==(e=this.errorWrapper)||e.remove(),this.errorWrapper=void 0}},y(u,"LoadedCustomComponent",!0),u);function Mc(e){return{...J,...e}}function Rc(e,t){const n=function(e,t){var n;return null!=(n=e.paddingTop)?n:t?e.spacing:0}(e,t);return t?n:e.diffHeaderHeight+n}function Pc(e){var t;return null!=(t=e.paddingBottom)?t:e.spacing}let Nc=-1;var Dc=class extends Ec{constructor(e,t,n=J,i,r=!1){super(e,i,r),y(this,"virtualizer"),y(this,"metrics"),y(this,"__id","virtualized-file:"+ ++Nc),y(this,"top"),y(this,"height",0),y(this,"cache",{heights:/* @__PURE__ */new Map,checkpoints:[],fileAnnotationHeight:0}),y(this,"isVisible",!1),y(this,"isSetup",!1),y(this,"layoutDirty",!0),y(this,"forceRenderOverride"),y(this,"currentCollapsed"),y(this,"onRender",e=>null!=this.fileContainer&&null!=this.file&&(e&&(this.top=this.getVirtualizedTop()),this.render({file:this.file}))),this.virtualizer=t,this.metrics=n}setMetrics(e,t=!1){!t&&ce(this.metrics,e)||(this.metrics=e,this.resetLayoutCache())}setLineAnnotations(e){this.syncLineAnnotations(e)&&this.resetLayoutCache()}syncLineAnnotations(e){return null!=e&&e!==this.lineAnnotations&&(0!==e.length||0!==this.lineAnnotations.length)&&(super.setLineAnnotations(e),!0)}hasLineAnnotations(){return this.lineAnnotations.some(e=>e.lineNumber>0)}getLineHeight(e,t=!1){const n=this.cache.heights.get(e);if(null!=n)return n;const i=t?2:1;return this.metrics.lineHeight*i}setOptions(e){if(this.isAdvancedMode())throw new Error("VirtualizedFile.setOptions cannot be used inside CodeView. Update CodeView options instead.");if(null==e)return;const{options:t}=this,n=!he(t,e),i=function(e,t){var n,i,r,o,s,a,l,d;return(null!=(n=e.overflow)?n:"scroll")!==(null!=(i=t.overflow)?i:"scroll")||(null!=(r=e.collapsed)&&r)!==(null!=(o=t.collapsed)&&o)||(null!=(s=e.disableLineNumbers)&&s)!==(null!=(a=t.disableLineNumbers)&&a)||(null!=(l=e.disableFileHeader)&&l)!==(null!=(d=t.disableFileHeader)&&d)||e.unsafeCSS!==t.unsafeCSS}(t,e);super.setOptions(e),i&&this.resetLayoutCache(!0),n&&(this.forceRenderOverride=!0),n&&this.virtualizer.instanceChanged(this,i)}setThemeType(e){if(this.isAdvancedMode())throw new Error("VirtualizedFile.setThemeType cannot be used inside CodeView. Update CodeView options instead.");super.setThemeType(e)}resetLayoutCache(e=!1){this.layoutDirty=!0,this.cache.fileAnnotationHeight=0,this.cache.heights.size>0&&this.cache.heights.clear(),this.cache.checkpoints.length>0&&(this.cache.checkpoints.length=0),null!=this.renderRange&&(this.renderRange=void 0),e&&this.isSimpleMode()&&this.computeApproximateSize()}reconcileHeights(){var e;let t=!1;if(null==this.fileContainer||null==this.file)return 0!==this.height&&(t=!0),this.height=0,t;const{overflow:n="scroll"}=this.options;if(this.top=this.getVirtualizedTop(),"scroll"===n&&0===this.lineAnnotations.length&&!this.isResizeDebuggingEnabled())return t;if(null==this.code)return t;const i=this.code.children[1];if(!(i instanceof HTMLElement))return t;const r=Kd(this.lineAnnotations);if(null!=this.renderRange&&r&&Qd(this.renderRange)){const n=null!=(e=function(e){let t;for(const n of e.children)n instanceof HTMLElement&&n.dataset.lineAnnotation===qd&&(t=Math.max(null!=t?t:0,n.getBoundingClientRect().height));return t}(i))?e:0;n!==this.cache.fileAnnotationHeight&&(this.cache.fileAnnotationHeight=n,t=!0)}else r||0===this.cache.fileAnnotationHeight||(this.cache.fileAnnotationHeight=0,t=!0);for(const o of i.children){if(!(o instanceof HTMLElement))continue;const e=o.dataset.lineIndex;if(null==e)continue;const n=Number(e);let i=o.getBoundingClientRect().height,r=!1;o.nextElementSibling instanceof HTMLElement&&("lineAnnotation"in o.nextElementSibling.dataset||"noNewline"in o.nextElementSibling.dataset)&&("noNewline"in o.nextElementSibling.dataset&&(r=!0),i+=o.nextElementSibling.getBoundingClientRect().height),i!==this.getLineHeight(n,r)&&(t=!0,i===this.metrics.lineHeight*(r?2:1)?this.cache.heights.delete(n):this.cache.heights.set(n,i))}return(t||this.isResizeDebuggingEnabled())&&this.computeApproximateSize(!0),t}prepareCodeViewItem(e,t,n,i){const r=this.syncLineAnnotations(i);let o=!0===(null==n?void 0:n.resetFileLayoutCache)||r;null!=(null==n?void 0:n.metrics)&&(this.metrics=n.metrics,o=!0);const{collapsed:s=!1}=this.options;return this.currentCollapsed!==s&&(this.currentCollapsed=s,o=!0),o&&this.resetLayoutCache(),this.file!==e&&(this.layoutDirty=!0),this.file=e,this.top=t,this.computeApproximateSize(),this.height}getLinePosition(e){var t,n;if(null==this.file||e<1)return;const{disableFileHeader:i=!1,collapsed:r=!1}=this.options,o=Hc(this.getOrCreateLineCache(this.file));let s=Rc(this.metrics,i);if(r||o<0)return{top:s,height:0};const a=Math.min(Math.max(e-1,0),o),{overflow:l="scroll"}=this.options,{lineHeight:d}=this.metrics;if(s+=this.cache.fileAnnotationHeight,"scroll"===l&&!this.hasLineAnnotations())return{top:s+a*d,height:d};const c=this.getLayoutCheckpointBeforeLineIndex(a);s=null!=(t=null==c?void 0:c.top)?t:s;for(let u=null!=(n=null==c?void 0:c.lineIndex)?n:0;u<a;u++)s+=this.getLineHeight(u,!1);return{top:s,height:this.getLineHeight(a,!1)}}getNumericScrollAnchor(e){if(null==this.file||null==this.renderRange)return;const{disableFileHeader:t=!1,collapsed:n=!1,overflow:i="scroll"}=this.options;if(n||this.renderRange.totalLines<=0)return;const r=Hc(this.getOrCreateLineCache(this.file));if(r<0)return;const o=Rc(this.metrics,t),s=Math.min(this.renderRange.startingLine,r),a=Math.min(s+this.renderRange.totalLines-1,r);if(a<s)return;const{fileAnnotationHeight:l}=this.cache;if("scroll"===i&&!this.hasLineAnnotations()){const{lineHeight:t}=this.metrics,n=o+(0===s?l:this.renderRange.bufferBefore),i=s+Math.max(Math.ceil((e-n)/t),0);if(i>a)return;return{lineNumber:i+1,top:o+l+i*t}}let d=o+(0===s?l:this.renderRange.bufferBefore);for(let c=s;c<=a;c++){if(d>=e)return{lineNumber:c+1,top:d};d+=this.getLineHeight(c)}}getVirtualizedHeight(){return this.height}getAdvancedStickySpecs(e){if(null==this.top||null==this.file)return;if(!0===this.options.collapsed)return{topOffset:this.top,height:this.height};const t=null!=e?this.computeRenderRangeFromWindow(this.file,this.top,e):this.renderRange;if(null==t)return;const{bufferBefore:n,bufferAfter:i,totalLines:r}=t;let o=0;if(0===r){const t=null!=e?e:this.virtualizer.getWindowSpecs();this.top<t.top&&(o=i)}return{topOffset:this.top+n+o,height:this.height-(n+i)}}cleanUp(e=!1){var t;null!=this.fileContainer&&this.isSimpleMode()&&(null==(t=this.getSimpleVirtualizer())||t.disconnect(this.fileContainer)),e||this.resetLayoutCache(),this.isSetup=!1,super.cleanUp(e)}computeApproximateSize(e=!1){const t=this.isResizeDebuggingEnabled();if(!e&&!this.layoutDirty&&!t)return;const n=0===this.height;if(this.height=0,this.cache.checkpoints=[],null==this.file)return void(this.layoutDirty=!1);const{disableFileHeader:i=!1,collapsed:r=!1,overflow:o="scroll"}=this.options,{lineHeight:s}=this.metrics,a=this.getOrCreateLineCache(this.file),l=Rc(this.metrics,i),d=Pc(this.metrics);if(this.height+=l,r)this.layoutDirty=!1;else{if(this.height+=this.cache.fileAnnotationHeight,"scroll"!==o||this.hasLineAnnotations()?Ud({lines:a,callback:({lineIndex:e})=>{this.addLayoutCheckpoint(e,this.height),this.height+=this.getLineHeight(e,!1)}}):this.height+=this.getOrCreateLineCache(this.file).length*s,a.length>0&&(this.height+=d),null!=this.fileContainer&&t&&!n){const e=this.fileContainer.getBoundingClientRect();e.height!==this.height&&(this.file.name,e.height,this.height)}this.layoutDirty=!1}}setVisibility(e){this.isAdvancedMode()||null==this.fileContainer||(e&&!this.isVisible?(this.top=this.getVirtualizedTop(),this.isVisible=!0):!e&&this.isVisible&&(this.isVisible=!1,this.rerender()))}rerender(){this.enabled&&null!=this.file&&(this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!1))}render({fileContainer:e,file:t,forceRender:n=!1,lineAnnotations:i,...r}){var o,s;const{forceRenderOverride:a,isSetup:l}=this;this.forceRenderOverride=void 0;const d=this.syncLineAnnotations(i);if(d&&this.resetLayoutCache(),null!=this.file||(this.file=t),e=this.getOrCreateFileContainerNode(e),null==this.file)return console.error("VirtualizedFile.render: attempting to virtually render when we dont have file"),!1;if(l)null!=this.top||(this.top=this.getVirtualizedTop());else{this.computeApproximateSize();const t=this.getSimpleVirtualizer();if(null!=this.top||(this.top=this.getVirtualizedTop()),this.isAdvancedMode())this.isVisible=!0;else{if(null==t)throw new Error("VirtualizedFile.render: simple virtualizer is not available");t.connect(e,this),this.isVisible=t.isInstanceVisible(null!=(o=this.top)?o:0,this.height)}this.isSetup=!0}if(!this.isVisible&&this.isSimpleMode())return this.renderPlaceholder(this.height);const c=this.virtualizer.getWindowSpecs(),u=null!=(s=this.top)?s:0,h=this.computeRenderRangeFromWindow(this.file,u,c);return super.render({file:this.file,fileContainer:e,renderRange:h,lineAnnotations:i,forceRender:(null!=a?a:n)||d,...r})}syncVirtualizedTop(){this.top=this.getVirtualizedTop()}shouldDisableVirtualizationBuffers(){return this.isAdvancedMode()||super.shouldDisableVirtualizationBuffers()}isSimpleMode(){return"simple"===this.virtualizer.type}isAdvancedMode(){return"advanced"===this.virtualizer.type}addLayoutCheckpoint(e,t){e%5e3==0&&this.cache.checkpoints.push({lineIndex:e,top:t})}getLayoutCheckpointBeforeLineIndex(e){if(e<=0||0===this.cache.checkpoints.length)return;let t,n=0,i=this.cache.checkpoints.length-1;for(;n<=i;){const r=n+i>>1,o=this.cache.checkpoints[r];if(null==o)throw new Error("VirtualizedFile: invalid checkpoint index");o.lineIndex<=e?(t=o,n=r+1):i=r-1}return t}getLayoutCheckpointBeforeTop(e,t){let n=0,i=this.cache.checkpoints.length-1,r=-1;for(;n<=i;){const t=n+i>>1,o=this.cache.checkpoints[t];if(null==o)throw new Error("VirtualizedFile: invalid checkpoint index");o.top<=e?(r=t,n=t+1):i=t-1}if(null==t)return r>=0?this.cache.checkpoints[r]:void 0;for(let o=r;o>=0;o--){const e=this.cache.checkpoints[o];if(null==e)throw new Error("VirtualizedFile: invalid checkpoint index");if(e.lineIndex%t===0)return e}}getVirtualizedTop(){return"advanced"===this.virtualizer.type?this.virtualizer.getLocalTopForInstance(this):null!=this.fileContainer?this.virtualizer.getOffsetInScrollContainer(this.fileContainer):0}getSimpleVirtualizer(){return"simple"===this.virtualizer.type?this.virtualizer:void 0}isResizeDebuggingEnabled(){var e,t;return null!=(t=null==(e=this.getSimpleVirtualizer())?void 0:e.config.resizeDebugging)&&t}computeRenderRangeFromWindow(e,t,{top:n,bottom:i}){var r,o,s,a;const{disableFileHeader:l=!1,overflow:d="scroll"}=this.options,{hunkLineCount:c,lineHeight:u}=this.metrics,h=this.getOrCreateLineCache(e),f=h.length,p=this.height,m=Rc(this.metrics,l),g=f>0?Pc(this.metrics):0,{fileAnnotationHeight:v}=this.cache,b=m+v,y=Math.max(0,p-m-v-g),C=Kd(this.lineAnnotations),S=t+m,k=v>0&&C&&S<i&&S+v>n;if(t<n-p||t>i)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:p-m-g};if(f<=c)return{startingLine:0,totalLines:c,bufferBefore:0,bufferAfter:0};const x=Math.ceil(Math.max(i-n,0)/u),w=Math.ceil(x/c)*c+2*c,L=w/c,T=(n+i)/2;if("scroll"===d&&!this.hasLineAnnotations()){const e=t+b;if(!(k||e<i&&e+y>n))return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:p-m-g};const r=Math.floor(k&&T<t+b?0:(T-(t+b))/u),o=Math.floor(r/c)-Math.floor(L/2),s=Math.ceil(f/c),a=Math.max(0,Math.min(o,s))*c,l=o<0?w+o*c:w,d=0===a?0:v+a*u,h=Math.min(l,f-a);return{startingLine:a,totalLines:l,bufferBefore:d,bufferAfter:Math.max(0,(f-a-h)*u)}}const A=L,I=[],E=this.getLayoutCheckpointBeforeTop(Math.max(0,n-t-w*u*2),c);let M,R,P,N=t+(null!=(r=null==E?void 0:E.top)?r:b),D=null!=(o=null==E?void 0:E.lineIndex)?o:0;if(Ud({lines:h,startingLine:null!=(s=null==E?void 0:E.lineIndex)?s:0,callback:({lineIndex:e})=>{const r=D%c===0,o=Math.floor(D/c);if(r&&(I[o]=N-(t+b),null!=P)){if(P<=0)return!0;P--}const s=this.getLineHeight(e,!1);return N>n-s&&N<i&&(null!=M||(M=o)),N+s>T&&(null!=R||(R=o)),null==P&&N>=i&&r&&(P=A),D++,N+=s,!1}}),null==M){if(!k)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:p-m-g};M=0,R=0}null!=R||(R=M);const H=Math.round(R-L/2),_=Math.max(0,Math.ceil(f/c)-L),O=Math.max(0,Math.min(H,_)),j=O*c,F=H<0?w+H*c:w,B=null!=(a=I[O])?a:0,$=0===j?0:v+B,z=O+F/c,U=z<I.length?y-I[z]:y-(N-t-b);return{startingLine:j,totalLines:F,bufferBefore:$,bufferAfter:Math.max(0,U)}}};function Hc(e){const t=e.at(-1);return null==t||""===t||"\n"===t||"\r\n"===t||"\r"===t?e.length-2:e.length-1}function _c(e,t){return e===t||null!=(null==e?void 0:e.cacheKey)&&e.cacheKey===(null==t?void 0:t.cacheKey)}const Oc=new TextEncoder,jc=new TextDecoder("utf-8",{ignoreBOM:!0}),Fc=/[\uD800-\uDFFF]/,Bc=1024;let $c=new Uint8Array(Bc);function zc(){$c.length!==Bc&&($c=new Uint8Array(Bc))}function Uc(e){if(0===e.length)return e;if(Fc.test(e))return JSON.parse(JSON.stringify(e));const t=3*e.length;$c.length<t&&($c=new Uint8Array(t));const{written:n}=Oc.encodeInto(e,$c);return jc.decode($c.subarray(0,n))}function Gc(e,t,n){try{return function(e,t,n=!1){const i=function(e){return e.startsWith("diff --git")||e.includes("\ndiff --git")}(e),r=i?ru(e,"diff --git"):function(e){if(0===e.length)return[""];const t=[];let n=0,i=0,r=0,o=0,s=!1;for(;i<e.length;){const a=Zc(e,i);if(r<=0&&o<=0){if(Yc(e,i)){i>n&&t.push(e.slice(n,i)),n=i,s=!0,i=Zc(e,a);continue}if(s&&e.startsWith("@@ -",i)){const t=nu(e.slice(i,a));null!=t&&(r=t.deletionCount,o=t.additionCount)}i=a;continue}const l=e[i];"\\"!==l?(" "===l?(r=Math.max(r-1,0),o=Math.max(o-1,0)):"-"===l?r=Math.max(r-1,0):"+"===l&&(o=Math.max(o-1,0)),i=a):i=a}return t.push(e.slice(n)),t}(e);let o;const s=[];for(const a of r){if(i&&!I.test(a)){if(null==o)o=Uc(a);else{if(n)throw Error("parsePatchContent: unknown file blob");console.error("parsePatchContent: unknown file blob:",a)}continue}if(!i&&!Qc(a)){if(null==o)o=Uc(a);else{if(n)throw Error("parsePatchContent: unknown file blob");console.error("parsePatchContent: unknown file blob:",a)}continue}const e=Vc(a,{cacheKey:null!=t?`${t}-${s.length}`:void 0,isGitDiff:i,throwOnError:n});null!=e&&s.push(e)}return{patchMetadata:o,files:s}}(e,t,n)}finally{zc()}}function Wc(e,t){try{return Vc(e,t)}finally{zc()}}function Vc(e,{cacheKey:t,isGitDiff:n=I.test(e),oldFile:i,newFile:r,throwOnError:o=!1}={}){var s,a,l;let d=0;const c=ru(e,"@@ ");let u;const h=null==i||null==r;let f=0,p=0;for(const m of c){const e=Xc(m),c=e[0];if(null==c){if(o)throw Error("parsePatchContent: invalid hunk");console.error("parsePatchContent: invalid hunk",m);continue}const g=nu(c);let v,b,y=0,C=0;if(null==g||null==u){if(null!=u){if(o)throw Error("parsePatchContent: Invalid hunk");console.error("parsePatchContent: Invalid hunk",m);continue}u={name:"",type:"change",hunks:[],splitLineCount:0,unifiedLineCount:0,isPartial:h,additionLines:h||null==i||null==r?[]:Kc(r.contents),deletionLines:h||null==i||null==r?[]:Kc(i.contents),cacheKey:su(t)},1===u.additionLines.length&&""===(null==r?void 0:r.contents)&&(u.additionLines.length=0),1===u.deletionLines.length&&""===(null==i?void 0:i.contents)&&(u.deletionLines.length=0);for(const t of e){if(t.startsWith("diff --git")){const e=t.trim().match(H),n=null!=(s=null==e?void 0:e[1])?s:null==e?void 0:e[2],i=null!=(a=null==e?void 0:e[3])?a:null==e?void 0:e[4];if(null==n||null==i){if(o)throw Error("parsePatchContent: invalid git diff header");console.error("parsePatchContent: invalid git diff header",t);continue}u.name=Uc(i.trim()),n!==i&&(u.prevName=Uc(n.trim()));continue}const e=t.startsWith("---")||t.startsWith("+++")?t.match(n?D:N):null;if(null!=e){const[,t,n]=e;if("---"===t&&"/dev/null"!==n){const e=Uc(n.trim());u.prevName=e,u.name=e}else"+++"===t&&"/dev/null"!==n&&(u.name=Uc(n.trim()))}else if(n){if(t.startsWith("new mode ")&&(u.mode=Uc(t.slice(8).trim())),t.startsWith("old mode ")&&(u.prevMode=Uc(t.slice(8).trim())),t.startsWith("new file mode")&&(u.type="new",u.mode=Uc(t.slice(13).trim())),t.startsWith("deleted file mode")&&(u.type="deleted",u.mode=Uc(t.slice(17).trim())),t.startsWith("similarity index")&&(t.startsWith("similarity index 100%")?u.type="rename-pure":u.type="rename-changed"),t.startsWith("index ")){const[,e,n,i]=null!=(l=t.trim().match(_))?l:[];null!=e&&(u.prevObjectId=Uc(e)),null!=n&&(u.newObjectId=Uc(n)),null!=i&&(u.mode=Uc(i))}t.startsWith("rename from ")&&(u.prevName=Uc(t.slice(12).trim())),t.startsWith("rename to ")&&(u.name=Uc(t.slice(10).trim()))}}continue}for(;e.length>0&&("\n"===e[e.length-1]||"\r"===e[e.length-1]||"\r\n"===e[e.length-1]||""===e[e.length-1]);)e.pop();const{additionStart:S,deletionStart:k}=g;f=h?f:k-1,p=h?p:S-1;const x={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:g.additionCount,additionStart:S,additionLines:y,deletionCount:g.deletionCount,deletionStart:k,deletionLines:C,deletionLineIndex:f,additionLineIndex:p,hunkContent:[],hunkContext:su(g.hunkContext),hunkSpecs:Uc(c),noEOFCRAdditions:!1,noEOFCRDeletions:!1};let w=0,L=0;for(let t=1;t<e.length;t++){const n=e[t];if(w>=x.additionCount&&L>=x.deletionCount&&!n.startsWith("\\")){if(o&&eu(n)&&!tu(n))throw Error("parsePatchContent: hunk has more lines than expected");break}const i=n[0];if("+"!==i&&"-"!==i&&" "!==i&&"\\"!==i){if(o)throw Error("parsePatchContent: invalid hunk line");console.error(`parseLineType: Invalid firstChar: "${i}", full line: "${n}"`),console.error("processFile: invalid rawLine:",n);continue}const r=au(i);if("addition"===r){if(o&&w>=x.additionCount)throw Error("parsePatchContent: hunk has too many addition lines");const e=lu(n);null!=v&&"change"===v.type||(v=du("change",f,p),x.hunkContent.push(v)),p++,w++,h&&u.additionLines.push(e),v.additions++,y++,b="addition"}else if("deletion"===r){if(o&&L>=x.deletionCount)throw Error("parsePatchContent: hunk has too many deletion lines");const e=lu(n);null!=v&&"change"===v.type||(v=du("change",f,p),x.hunkContent.push(v)),f++,L++,h&&u.deletionLines.push(e),v.deletions++,C++,b="deletion"}else if("context"===r){if(o&&(L>=x.deletionCount||w>=x.additionCount))throw Error("parsePatchContent: hunk has too many context lines");const e=lu(n);null!=v&&"context"===v.type||(v=du("context",f,p),x.hunkContent.push(v)),p++,f++,w++,L++,h&&(u.deletionLines.push(e),u.additionLines.push(e)),v.lines++,b="context"}else if("metadata"===r&&null!=v){if("context"===v.type?(x.noEOFCRAdditions=!0,x.noEOFCRDeletions=!0):"deletion"===b?x.noEOFCRDeletions=!0:"addition"===b&&(x.noEOFCRAdditions=!0),h&&("addition"===b||"context"===b)){const e=u.additionLines.length-1;e>=0&&(u.additionLines[e]=kd(u.additionLines[e]))}if(h&&("deletion"===b||"context"===b)){const e=u.deletionLines.length-1;e>=0&&(u.deletionLines[e]=kd(u.deletionLines[e]))}}}if(o&&(w!==x.additionCount||L!==x.deletionCount))throw Error("parsePatchContent: hunk line count mismatch");x.additionLines=y,x.deletionLines=C,x.collapsedBefore=Math.max(x.additionStart-1-d,0),u.hunks.push(x),d=x.additionStart+x.additionCount-1;for(const t of x.hunkContent)"context"===t.type?(x.splitLineCount+=t.lines,x.unifiedLineCount+=t.lines):(x.splitLineCount+=Math.max(t.additions,t.deletions),x.unifiedLineCount+=t.deletions+t.additions);x.splitLineStart=u.splitLineCount+x.collapsedBefore,x.unifiedLineStart=u.unifiedLineCount+x.collapsedBefore,u.splitLineCount+=x.collapsedBefore+x.splitLineCount,u.unifiedLineCount+=x.collapsedBefore+x.unifiedLineCount}if(null!=u){if(o&&h&&!n&&0===u.hunks.length)throw Error("parsePatchContent: unified file has no hunks");if(u.hunks.length>0&&!h&&u.additionLines.length>0&&u.deletionLines.length>0){const e=u.hunks[u.hunks.length-1],t=e.additionStart+e.additionCount-1,n=u.additionLines.length,i=Math.max(n-t,0);u.splitLineCount+=i,u.unifiedLineCount+=i}return n||(null!=u.prevName&&u.name!==u.prevName?u.hunks.length>0?u.type="rename-changed":u.type="rename-pure":null!=i&&""!==i.contents||null==r||""===r.contents?null==i||""===i.contents||null!=r&&""!==r.contents||(u.type="deleted"):u.type="new"),"rename-pure"!==u.type&&"rename-changed"!==u.type&&(u.prevName=void 0),u}}function qc(e,t,n=!1){const i=[],r=function(e){return e.startsWith("From ")||e.includes("\nFrom ")}(e)?e.split(A):[e];for(const s of r)try{i.push(Gc(s,null!=t?`${t}-${i.length}`:void 0,n))}catch(o){if(n)throw o;console.error(o)}return i}function Kc(e){const t=Xc(e);for(let n=0;n<t.length;n++)t[n]=Uc(t[n]);return t}function Xc(e){if(0===e.length)return[""];const t=[];let n=0;for(;;){const i=e.indexOf("\n",n);if(-1===i)break;t.push(e.slice(n,i+1)),n=i+1}return n<e.length&&t.push(e.slice(n)),t}function Qc(e){return Yc(e,0)}function Yc(e,t){const n=Zc(e,t);return Jc(e,t,"---")&&Jc(e,n,"+++")}function Jc(e,t,n){if(!e.startsWith(n,t))return!1;const i=e[t+n.length];if(" "!==i&&"\t"!==i)return!1;for(let r=t+n.length+1;r<e.length;r++){const t=e[r];if("\n"===t||"\r"===t)break;if(" "!==t&&"\t"!==t)return!0}return!1}function Zc(e,t){const n=e.indexOf("\n",t);return-1===n?e.length:n+1}function eu(e){const t=e[0];return"+"===t||"-"===t||" "===t}function tu(e){if(!e.startsWith("--"))return!1;for(let t=2;t<e.length;t++){const n=e[t];if(" "!==n&&"\t"!==n&&"\n"!==n&&"\r"!==n)return!1}return!0}function nu(e){if(!e.startsWith("@@ -"))return;let t=4;const n=iu(e,t);if(null==n)return;const i=n.value;t=n.endIndex;let r=1;if(","===e[t]){const n=iu(e,t+1);if(null==n)return;r=n.value,t=n.endIndex}if(" "!==e[t]||"+"!==e[t+1])return;t+=2;const o=iu(e,t);if(null==o)return;const s=o.value;t=o.endIndex;let a,l=1;if(","===e[t]){const n=iu(e,t+1);if(null==n)return;l=n.value,t=n.endIndex}if(" "!==e[t]||"@"!==e[t+1]||"@"!==e[t+2])return;const d=t+3;return" "===e[d]&&(a=function(e){return e.endsWith("\r\n")?e.slice(0,-2):e.endsWith("\n")?e.slice(0,-1):e}(e.slice(d+1))),{additionCount:l,additionStart:s,deletionCount:r,deletionStart:i,hunkContext:a}}function iu(e,t){let n=t,i=0;for(;n<e.length;n++){const t=e.charCodeAt(n)-48;if(t<0||t>9)break;i=10*i+t}if(n!==t)return{value:i,endIndex:n}}function ru(e,t){if(0===e.length)return[""];const n=`\n${t}`,i=e.startsWith(t)?0:ou(e,n,0);if(-1===i)return[e];const r=[];i>0&&r.push(e.slice(0,i));let o=i;for(;;){const t=ou(e,n,o+1);if(-1===t)break;r.push(e.slice(o,t)),o=t}return r.push(e.slice(o)),r}function ou(e,t,n){const i=e.indexOf(t,n);return-1===i?-1:i+1}function su(e){return null==e?e:Uc(e)}function au(e){return" "===e?"context":"\\"===e?"metadata":"+"===e?"addition":"deletion"}function lu(e){const t=e.slice(1);return Uc(""===t?"\n":t)}function du(e,t,n){return"change"===e?{type:"change",additions:0,deletions:0,additionLineIndex:n,deletionLineIndex:t}:{type:"context",lines:0,additionLineIndex:n,deletionLineIndex:t}}class cu{diff(e,t,n={}){let i;"function"==typeof n?(i=n,n={}):"callback"in n&&(i=n.callback);const r=this.castInput(e,n),o=this.castInput(t,n),s=this.removeEmpty(this.tokenize(r,n)),a=this.removeEmpty(this.tokenize(o,n));return this.diffWithOptionsObj(s,a,n,i)}diffWithOptionsObj(e,t,n,i){var r;const o=e=>(e=this.postProcess(e,n),i?void setTimeout(function(){i(e)},0):e),s=t.length,a=e.length;let l=1,d=s+a;null!=n.maxEditLength&&(d=Math.min(d,n.maxEditLength));const c=null!==(r=n.timeout)&&void 0!==r?r:1/0,u=Date.now()+c,h=[{oldPos:-1,lastComponent:void 0}];let f=this.extractCommon(h[0],t,e,0,n);if(h[0].oldPos+1>=a&&f+1>=s)return o(this.buildValues(h[0].lastComponent,t,e));let p=-1/0,m=1/0;const g=()=>{for(let i=Math.max(p,-l);i<=Math.min(m,l);i+=2){let r;const l=h[i-1],d=h[i+1];l&&(h[i-1]=void 0);let c=!1;if(d){const e=d.oldPos-i;c=d&&0<=e&&e<s}const u=l&&l.oldPos+1<a;if(c||u){if(r=!u||c&&l.oldPos<d.oldPos?this.addToPath(d,!0,!1,0,n):this.addToPath(l,!1,!0,1,n),f=this.extractCommon(r,t,e,i,n),r.oldPos+1>=a&&f+1>=s)return o(this.buildValues(r.lastComponent,t,e))||!0;h[i]=r,r.oldPos+1>=a&&(m=Math.min(m,i-1)),f+1>=s&&(p=Math.max(p,i+1))}else h[i]=void 0}l++};if(i)!function e(){setTimeout(function(){if(l>d||Date.now()>u)return i(void 0);g()||e()},0)}();else for(;l<=d&&Date.now()<=u;){const e=g();if(e)return e}}addToPath(e,t,n,i,r){const o=e.lastComponent;return o&&!r.oneChangePerToken&&o.added===t&&o.removed===n?{oldPos:e.oldPos+i,lastComponent:{count:o.count+1,added:t,removed:n,previousComponent:o.previousComponent}}:{oldPos:e.oldPos+i,lastComponent:{count:1,added:t,removed:n,previousComponent:o}}}extractCommon(e,t,n,i,r){const o=t.length,s=n.length;let a=e.oldPos,l=a-i,d=0;for(;l+1<o&&a+1<s&&this.equals(n[a+1],t[l+1],r);)l++,a++,d++,r.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return d&&!r.oneChangePerToken&&(e.lastComponent={count:d,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=a,l}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){const t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join("")}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){const i=[];let r;for(;e;)i.push(e),r=e.previousComponent,delete e.previousComponent,e=r;i.reverse();const o=i.length;let s=0,a=0,l=0;for(;s<o;s++){const e=i[s];if(e.removed)e.value=this.join(n.slice(l,l+e.count)),l+=e.count;else{if(!e.added&&this.useLongestToken){let i=t.slice(a,a+e.count);i=i.map(function(e,t){const i=n[l+t];return i.length>e.length?i:e}),e.value=this.join(i)}else e.value=this.join(t.slice(a,a+e.count));a+=e.count,e.added||(l+=e.count)}}return i}}const uu=new class extends cu{},hu="a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}",fu=new class extends cu{tokenize(e){const t=new RegExp(`(\\r?\\n)|[${hu}]+|[^\\S\\n\\r]+|[^${hu}]`,"ug");return e.match(t)||[]}},pu=new class extends cu{constructor(){super(...arguments),this.tokenize=gu}equals(e,t,n){return n.ignoreWhitespace?(n.newlineIsToken&&e.includes("\n")||(e=e.trim()),n.newlineIsToken&&t.includes("\n")||(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith("\n")&&(e=e.slice(0,-1)),t.endsWith("\n")&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function mu(e,t,n){return pu.diff(e,t,n)}function gu(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,"\n"));const n=[],i=e.split(/(\n|\r\n)/);i[i.length-1]||i.pop();for(let r=0;r<i.length;r++){const e=i[r];r%2&&!t.newlineIsToken?n[n.length-1]+=e:n.push(e)}return n}function vu(e){if(!function(e){for(let t=0;t<e.length;t++)if(e[t]<" "||e[t]>"~"||'"'===e[t]||"\\"===e[t])return!0;return!1}(e))return e;let t='"';const n=(new TextEncoder).encode(e);let i=0;for(;i<n.length;){const e=n[i];t+=7===e?"\\a":8===e?"\\b":9===e?"\\t":10===e?"\\n":11===e?"\\v":12===e?"\\f":13===e?"\\r":34===e?'\\"':92===e?"\\\\":e>=32&&e<=126?String.fromCharCode(e):"\\"+e.toString(8).padStart(3,"0"),i++}return t+='"',t}const bu={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function yu(e,t,n,i,r,o,s){let a;a=s?"function"==typeof s?{callback:s}:s:{},void 0===a.context&&(a.context=4);const l=a.context;if(a.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(!a.callback)return d(mu(n,i,a));{const{callback:e}=a;mu(n,i,Object.assign(Object.assign({},a),{callback:t=>{const n=d(t);e(n)}}))}function d(n){if(!n)return;function i(e){return e.map(function(e){return" "+e})}n.push({value:"",lines:[]});const s=[];let a=0,d=0,c=[],u=1,h=1;for(let e=0;e<n.length;e++){const t=n[e],r=t.lines||Su(t.value);if(t.lines=r,t.added||t.removed){if(!a){const t=n[e-1];a=u,d=h,t&&(c=l>0?i(t.lines.slice(-l)):[],a-=c.length,d-=c.length)}for(const e of r)c.push((t.added?"+":"-")+e);t.added?h+=r.length:u+=r.length}else{if(a)if(r.length<=2*l&&e<n.length-2)for(const e of i(r))c.push(e);else{const e=Math.min(r.length,l);for(const n of i(r.slice(0,e)))c.push(n);const t={oldStart:a,oldLines:u-a+e,newStart:d,newLines:h-d+e,lines:c};s.push(t),a=0,d=0,c=[]}u+=r.length,h+=r.length}}for(const e of s)for(let t=0;t<e.lines.length;t++)e.lines[t].endsWith("\n")?e.lines[t]=e.lines[t].slice(0,-1):(e.lines.splice(t+1,0,"\"),t++);return{oldFileName:e,newFileName:t,oldHeader:r,newHeader:o,hunks:s}}}function Cu(e,t){var n,i,r,o,s,a;if(t||(t=bu),Array.isArray(e)){if(e.length>1&&!t.includeFileHeaders&&!e.every(e=>e.isGit))throw new Error("Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)");return e.map(e=>Cu(e,t)).join("\n")}const l=[];if(e.isGit){if(t=bu,!e.oldFileName)throw new Error("oldFileName must be specified for Git patches");if(!e.newFileName)throw new Error("newFileName must be specified for Git patches");let d=e.oldFileName,c=e.newFileName;e.isCreate&&"/dev/null"===d?d=c.replace(/^b\//,"a/"):e.isDelete&&"/dev/null"===c&&(c=d.replace(/^a\//,"b/")),l.push("diff --git "+vu(d)+" "+vu(c)),e.isDelete&&l.push("deleted file mode "+(null!==(n=e.oldMode)&&void 0!==n?n:"100644")),e.isCreate&&l.push("new file mode "+(null!==(i=e.newMode)&&void 0!==i?i:"100644")),e.oldMode&&e.newMode&&!e.isDelete&&!e.isCreate&&(l.push("old mode "+e.oldMode),l.push("new mode "+e.newMode)),e.isRename&&(l.push("rename from "+vu((null!==(r=e.oldFileName)&&void 0!==r?r:"").replace(/^a\//,""))),l.push("rename to "+vu((null!==(o=e.newFileName)&&void 0!==o?o:"").replace(/^b\//,"")))),e.isCopy&&(l.push("copy from "+vu((null!==(s=e.oldFileName)&&void 0!==s?s:"").replace(/^a\//,""))),l.push("copy to "+vu((null!==(a=e.newFileName)&&void 0!==a?a:"").replace(/^b\//,""))))}else t.includeIndex&&e.oldFileName==e.newFileName&&void 0!==e.oldFileName&&l.push("Index: "+e.oldFileName),t.includeUnderline&&l.push("===================================================================");const d=e.hunks.length>0;!t.includeFileHeaders||void 0===e.oldFileName||void 0===e.newFileName||e.isGit&&!d||(l.push("--- "+vu(e.oldFileName)+(e.oldHeader?"\t"+e.oldHeader:"")),l.push("+++ "+vu(e.newFileName)+(e.newHeader?"\t"+e.newHeader:"")));for(let c=0;c<e.hunks.length;c++){const t=e.hunks[c],n=0===t.oldLines?t.oldStart-1:t.oldStart,i=0===t.newLines?t.newStart-1:t.newStart;l.push("@@ -"+n+","+t.oldLines+" +"+i+","+t.newLines+" @@");for(const e of t.lines)l.push(e)}return l.join("\n")+"\n"}function Su(e){const t=e.endsWith("\n"),n=e.split("\n").map(e=>e+"\n");return t?n.pop():n.push(n.pop().slice(0,-1)),n}function ku(e,t,n,i=!1){const r=Wc(function(e,t,n,i,r,o,s){if("function"==typeof s&&(s={callback:s}),!(null==s?void 0:s.callback)){const a=yu(e,t,n,i,r,o,s);if(!a)return;return Cu(a,null==s?void 0:s.headerOptions)}{const{callback:a}=s;yu(e,t,n,i,r,o,Object.assign(Object.assign({},s),{callback:e=>{a(e?Cu(e,s.headerOptions):void 0)}}))}}(e.name,t.name,e.contents,t.contents,e.header,t.header,n),{cacheKey:(()=>{if(null!=e.cacheKey&&null!=t.cacheKey)return`${e.cacheKey}:${t.cacheKey}`})(),oldFile:e,newFile:t,throwOnError:i});if(null==r)throw new Error("parseDiffFrom: FileInvalid diff -- probably need to fix something -- if the files are the same maybe?");return null!=t.lang&&(r.lang=t.lang),r}var xu=class{constructor(){y(this,"isDeletionsScrolling",!1),y(this,"isAdditionsScrolling",!1),y(this,"timeoutId",-1),y(this,"codeDeletions"),y(this,"codeAdditions"),y(this,"enabled",!1),y(this,"handleDeletionsScroll",()=>{var e,t;this.isAdditionsScrolling||(this.isDeletionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isDeletionsScrolling=!1},300),null==(t=this.codeAdditions)||t.scrollTo({left:null==(e=this.codeDeletions)?void 0:e.scrollLeft}))}),y(this,"handleAdditionsScroll",()=>{var e,t;this.isDeletionsScrolling||(this.isAdditionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isAdditionsScrolling=!1},300),null==(t=this.codeDeletions)||t.scrollTo({left:null==(e=this.codeAdditions)?void 0:e.scrollLeft}))})}cleanUp(){var e,t;this.enabled&&(null==(e=this.codeDeletions)||e.removeEventListener("scroll",this.handleDeletionsScroll),null==(t=this.codeAdditions)||t.removeEventListener("scroll",this.handleAdditionsScroll),clearTimeout(this.timeoutId),this.codeDeletions=void 0,this.codeAdditions=void 0,this.enabled=!1)}setup(e,t,n){var i,r,o;if(null==t||null==n)for(const s of null!=(i=e.children)?i:[])s instanceof HTMLElement&&("deletions"in s.dataset?t=s:"additions"in s.dataset&&(n=s));null!=n&&null!=t?(this.codeDeletions!==t&&(null==(r=this.codeDeletions)||r.removeEventListener("scroll",this.handleDeletionsScroll),this.codeDeletions=t,t.addEventListener("scroll",this.handleDeletionsScroll,{passive:!0})),this.codeAdditions!==n&&(null==(o=this.codeAdditions)||o.removeEventListener("scroll",this.handleAdditionsScroll),this.codeAdditions=n,n.addEventListener("scroll",this.handleAdditionsScroll,{passive:!0})),this.enabled=!0):this.cleanUp()}};function wu(e,t){return ue(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength&&e.lineDiffType===t.lineDiffType&&e.maxLineDiffLength===t.maxLineDiffLength}function Lu(e){return be({tagName:"div",properties:{"data-content-buffer":"","data-buffer-size":e,style:`grid-row: span ${e};min-height:calc(${e} * 1lh)`}})}function Tu(e){return be({tagName:"div",children:[be({tagName:"span",children:[ve("No newline at end of file")]})],properties:{"data-no-newline":"","data-line-type":e,"data-column-content":""}})}function Au(e){return be({tagName:"div",children:[ye({name:"both"===e?"diffs-icon-expand-all":"diffs-icon-expand",properties:{"data-icon":""}})],properties:{role:"button","data-expand-button":"","data-expand-both":"both"===e?"":void 0,"data-expand-up":"up"===e?"":void 0,"data-expand-down":"down"===e?"":void 0}})}function Iu({type:e,content:t,expandIndex:n,chunked:i=!1,slotName:r,isFirstHunk:o,isLastHunk:s}){let a=0;const l=[];if("metadata"===e&&null!=t&&l.push(be({tagName:"div",children:[ve(t)],properties:{"data-separator-wrapper":""}})),("line-info"===e||"line-info-basic"===e)&&null!=t){const e=[];null!=n&&(i?(o||(e.push(Au("up")),a++),s||(e.push(Au("down")),a++)):(e.push(Au(o||s?o?"down":"up":"both")),a++)),e.push(be({tagName:"div",children:[be({tagName:"span",children:[ve(t)],properties:{"data-unmodified-lines":""}})],properties:{"data-separator-content":""}})),i&&null!=n&&e.push(be({tagName:"div",children:[ve("Expand all")],properties:{role:"button","data-expand-button":"","data-expand-all-button":""}})),l.push(be({tagName:"div",children:e,properties:{"data-separator-wrapper":"","data-separator-multi-button":a>1?"":void 0}}))}return"custom"===e&&null!=r&&l.push(be({tagName:"slot",properties:{name:r}})),be({tagName:"div",children:l,properties:{"data-separator":0===l.length?"simple":e,"data-expand-index":n,"data-separator-first":o?"":void 0,"data-separator-last":s?"":void 0}})}function Eu(e,t){return`hunk-separator-${e}-${t}`}function Mu(e){const t=e.at(-1);return null==t?0:Math.max(t.additionStart+t.additionCount,t.deletionStart+t.deletionCount)}function Ru(e){return 0===e.startingLine&&e.totalLines===1/0&&0===e.bufferBefore&&0===e.bufferAfter}function Pu({line:e,spanStart:t,spanLength:n}){return{start:{line:e,character:t},end:{line:e,character:t+n},properties:{"data-diff-span":""},alwaysWrap:!0}}function Nu({item:e,arr:t,enableJoin:n,isNeutral:i=!1,isLastItem:r=!1}){const o=t[t.length-1];if(null==o||r||!n)return void t.push([i?0:1,e.value]);const s=0===o[0];i===s||i&&1===e.value.length&&!s?o[1]+=e.value:t.push([i?0:1,e.value])}function Du({isPartial:e,rangeSize:t,expandedHunks:n,hunkIndex:i,collapsedContextThreshold:r}){var o,s;const a=Math.max(t,0);if(0===a||e)return{fromStart:0,fromEnd:0,rangeSize:a,collapsedLines:a,renderAll:!1};if(!0===n||a<=r)return{fromStart:a,fromEnd:0,rangeSize:a,collapsedLines:0,renderAll:!0};const l=null==n?void 0:n.get(i),d=Math.min(Math.max(null!=(o=null==l?void 0:l.fromStart)?o:0,0),a),c=Math.min(Math.max(null!=(s=null==l?void 0:l.fromEnd)?s:0,0),a),u=d+c,h=u>=a;return{fromStart:h?a:d,fromEnd:h?0:c,rangeSize:a,collapsedLines:Math.max(a-u,0),renderAll:h}}function Hu({fileDiff:e,errorPrefix:t}){const n=e.hunks[e.hunks.length-1];if(null==n||e.isPartial||0===e.additionLines.length||0===e.deletionLines.length)return 0;const i=e.additionLines.length-(n.additionLineIndex+n.additionCount),r=e.deletionLines.length-(n.deletionLineIndex+n.deletionCount);if(i<=0&&r<=0)return 0;if(i!==r)throw new Error(`${t}: trailing context mismatch (additions=${i}, deletions=${r}) for ${e.name}`);return Math.min(i,r)}function _u({fileDiff:e,hunkIndex:t,expandedHunks:n,collapsedContextThreshold:i,errorPrefix:r}){var o;if(t!==e.hunks.length-1)return;const s=Hu({fileDiff:e,errorPrefix:r});if(s<=0)return;if(!0===n||s<=i)return{fromStart:s,fromEnd:0,rangeSize:s,collapsedLines:0,renderAll:!0};const a=null==n?void 0:n.get(e.hunks.length),l=Math.min(Math.max(null!=(o=null==a?void 0:a.fromStart)?o:0,0),s);return{fromStart:l,fromEnd:0,rangeSize:s,collapsedLines:s-l,renderAll:l>=s}}function Ou({type:e,metrics:t}){var n;return null!=(n=t.hunkSeparatorHeight)?n:function(e){switch(e){case"simple":return 4;case"metadata":case"line-info":case"line-info-basic":case"custom":return 32}}(e)}function ju({type:e,metrics:t}){return"simple"===e||"metadata"===e||"line-info-basic"===e?0:t.spacing}function Fu({type:e,metrics:t,hunkIndex:n,hunkSpecs:i}){if(!function({type:e,hunkIndex:t,hunkSpecs:n}){switch(e){case"simple":return t>0;case"metadata":return null!=n;case"line-info":case"line-info-basic":case"custom":return!0}}({type:e,hunkIndex:n,hunkSpecs:i}))return;const r=Ou({type:e,metrics:t}),o=ju({type:e,metrics:t}),s=n>0?o:0;return{height:r,gapBefore:s,gapAfter:o,totalHeight:s+r+o}}function Bu({type:e,metrics:t}){if(!function(e){return"simple"!==e&&"metadata"!==e}(e))return;const n=Ou({type:e,metrics:t}),i=ju({type:e,metrics:t});return{height:n,gapBefore:i,gapAfter:0,totalHeight:i+n}}function $u({diff:e,diffStyle:t,startingLine:n=0,totalLines:i=1/0,expandedHunks:r,collapsedContextThreshold:o=1,callback:s}){var a,l;const d=function({diff:e,diffStyle:t,startingLine:n,expandedHunks:i,collapsedContextThreshold:r}){if(n<=0||"both"===t)return{hunkIndex:0,splitCount:0,unifiedCount:0};const o=function({diff:e,expandedHunks:t,collapsedContextThreshold:n}){let i=0,r=0;const o=e.hunks.length-1,s=[{splitCount:0,unifiedCount:0}];for(let a=0;a<e.hunks.length;a++){const l=e.hunks[a];if(null==l)throw new Error("iterateOverDiff: invalid hunk summary index");const d=Du({isPartial:e.isPartial,rangeSize:l.collapsedBefore,expandedHunks:t,hunkIndex:a,collapsedContextThreshold:n}),c=d.fromStart+d.fromEnd;i+=c+l.splitLineCount,r+=c+l.unifiedLineCount;const u=a===o?_u({fileDiff:e,hunkIndex:a,expandedHunks:t,collapsedContextThreshold:n,errorPrefix:"iterateOverDiff"}):void 0;if(null!=u){const e=u.fromStart+u.fromEnd;i+=e,r+=e}s.push({splitCount:i,unifiedCount:r})}return s}({diff:e,expandedHunks:i,collapsedContextThreshold:r});let s=0,a=e.hunks.length-1,l=e.hunks.length;for(;s<=a;){const e=s+a>>1,i=o[e+1];if(null==i)throw new Error("iterateOverDiff: invalid hunk prefix index");("unified"===t?i.unifiedCount:i.splitCount)>n?(l=e,a=e-1):s=e+1}if(l>=e.hunks.length){const t=o[e.hunks.length];if(null==t)throw new Error("iterateOverDiff: invalid terminal hunk prefix index");return{hunkIndex:e.hunks.length,splitCount:t.splitCount,unifiedCount:t.unifiedCount}}const d=o[l];if(null==d)throw new Error("iterateOverDiff: invalid selected hunk prefix index");return{hunkIndex:l,splitCount:d.splitCount,unifiedCount:d.unifiedCount}}({diff:e,diffStyle:t,startingLine:n,expandedHunks:r,collapsedContextThreshold:o}),c={viewportStart:n,viewportEnd:n+i,isWindowedHighlight:n>0||i<1/0,splitCount:d.splitCount,unifiedCount:d.unifiedCount,finalHunkIndex:e.hunks.length-1,shouldBreak(){if(!c.isWindowedHighlight)return!1;const e=c.unifiedCount>=n+i,r=c.splitCount>=n+i;return"unified"===t?e:("split"===t||e)&&r},shouldSkip(e,i){if(!c.isWindowedHighlight)return!1;const r=c.unifiedCount+e<n,o=c.splitCount+i<n;return"unified"===t?r:("split"===t||r)&&o},incrementCounts(e,n){"unified"!==t&&"both"!==t||(c.unifiedCount+=e),"split"!==t&&"both"!==t||(c.splitCount+=n)},isInWindow(e,n){if(!c.isWindowedHighlight)return!0;const i=c.isInUnifiedWindow(e),r=c.isInSplitWindow(n);return"unified"===t?i:"split"===t?r:i||r},isInUnifiedWindow:e=>!c.isWindowedHighlight||c.unifiedCount>=n-e&&c.unifiedCount<n+i,isInSplitWindow:e=>!c.isWindowedHighlight||c.splitCount>=n-e&&c.splitCount<n+i,emit(e,n=!1){var i;return n||("unified"===t?c.incrementCounts(1,0):"split"===t?c.incrementCounts(0,1):c.incrementCounts(1,1)),null!=(i=s(e))&&i}};e:for(let u=d.hunkIndex;u<e.hunks.length;u++){let n=function(e,n){return null==h||h.collapsedLines<=0||h.fromStart+h.fromEnd>0?0:"unified"===t?e===s.unifiedLineStart+s.unifiedLineCount-1?h.collapsedLines:0:n===s.splitLineStart+s.splitLineCount-1?h.collapsedLines:0},i=function(){return p?0:(p=!0,d.collapsedLines)};const s=e.hunks[u];if(null==s)throw new Error("iterateOverDiff: invalid hunk index");if(c.shouldBreak())break;const d=Du({isPartial:e.isPartial,rangeSize:s.collapsedBefore,expandedHunks:r,hunkIndex:u,collapsedContextThreshold:o}),h=u===c.finalHunkIndex?_u({fileDiff:e,hunkIndex:u,expandedHunks:r,collapsedContextThreshold:o,errorPrefix:"iterateOverDiff"}):void 0,f=d.fromStart+d.fromEnd;let p=0===d.collapsedLines;if(c.shouldSkip(f,f))c.incrementCounts(f,f),i();else{let e=s.unifiedLineStart-d.rangeSize,n=s.splitLineStart-d.rangeSize,r=s.deletionLineIndex-d.rangeSize,o=s.additionLineIndex-d.rangeSize,a=s.deletionStart-d.rangeSize,l=s.additionStart-d.rangeSize;if(zu(c,d.fromStart,t,t=>c.emit({hunkIndex:u,hunk:s,collapsedBefore:0,collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:a+t,lineIndex:r+t,noEOFCR:!1,unifiedLineIndex:e+t,splitLineIndex:n+t},additionLine:{unifiedLineIndex:e+t,splitLineIndex:n+t,lineIndex:o+t,lineNumber:l+t,noEOFCR:!1}})))break e;if(e=s.unifiedLineStart-d.fromEnd,n=s.splitLineStart-d.fromEnd,r=s.deletionLineIndex-d.fromEnd,o=s.additionLineIndex-d.fromEnd,a=s.deletionStart-d.fromEnd,l=s.additionStart-d.fromEnd,zu(c,d.fromEnd,t,t=>c.emit({hunkIndex:u,hunk:s,collapsedBefore:i(),collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:a+t,lineIndex:r+t,noEOFCR:!1,unifiedLineIndex:e+t,splitLineIndex:n+t},additionLine:{unifiedLineIndex:e+t,splitLineIndex:n+t,lineIndex:o+t,lineNumber:l+t,noEOFCR:!1}}),()=>{i()}))break e}let m=s.unifiedLineStart,g=s.splitLineStart,v=s.deletionLineIndex,b=s.additionLineIndex,y=s.deletionStart,C=s.additionStart;const S=s.hunkContent.at(-1);for(const e of s.hunkContent){if(c.shouldBreak())break e;const r=e===S;if("context"===e.type){if(c.shouldSkip(e.lines,e.lines))c.incrementCounts(e.lines,e.lines),i();else if(zu(c,e.lines,t,t=>{const o=r&&t===e.lines-1,a=m+t,l=g+t;return c.emit({hunkIndex:u,hunk:s,collapsedBefore:i(),collapsedAfter:n(a,l),type:"context",deletionLine:{lineNumber:y+t,lineIndex:v+t,noEOFCR:o&&s.noEOFCRDeletions,unifiedLineIndex:a,splitLineIndex:l},additionLine:{unifiedLineIndex:a,splitLineIndex:l,lineIndex:b+t,lineNumber:C+t,noEOFCR:o&&s.noEOFCRAdditions}})},()=>{i()}))break e;m+=e.lines,g+=e.lines,v+=e.lines,b+=e.lines,y+=e.lines,C+=e.lines}else{const o=Math.max(e.deletions,e.additions),d=e.deletions+e.additions;if(!c.shouldSkip(d,o)){const h=Uu(c,e,t);(null!=(l=null==(a=h[0])?void 0:a[0])?l:0)>0&&i();for(const[a,l]of h)for(let h=a;h<l;h++){const a=n(m+h,"unified"===t?g+(h<e.deletions?h:h-e.deletions):g+h);if(c.emit(Gu({hunkIndex:u,hunk:s,collapsedBefore:i(),collapsedAfter:a,diffStyle:t,index:h,unifiedLineIndex:m,splitLineIndex:g,additionLineIndex:b,deletionLineIndex:v,additionLineNumber:C,deletionLineNumber:y,content:e,isLastContent:r,unifiedCount:d,splitCount:o}),!0))break e}}i(),c.incrementCounts(d,o),m+=d,g+=o,v+=e.deletions,b+=e.additions,y+=e.deletions,C+=e.additions}}if(null!=h){const{collapsedLines:n,fromStart:i,fromEnd:r}=h,o=i+r;if(zu(c,o,t,t=>{const i=t===o-1;return c.emit({hunkIndex:e.hunks.length,hunk:void 0,collapsedBefore:0,collapsedAfter:i?n:0,type:"context-expanded",deletionLine:{lineNumber:y+t,lineIndex:v+t,noEOFCR:!1,unifiedLineIndex:m+t,splitLineIndex:g+t},additionLine:{unifiedLineIndex:m+t,splitLineIndex:g+t,lineIndex:b+t,lineNumber:C+t,noEOFCR:!1}})},void 0,()=>c.shouldBreak()))break e}}}function zu(e,t,n,i,r,o){const[s,a]=function(e,t,n){if(!e.isWindowedHighlight||t<=0)return[0,t];const i=[];function r(n){const r=Math.max(0,e.viewportStart-n),o=Math.min(t,e.viewportEnd-n);o>r&&i.push([r,o])}if("split"!==n&&r(e.unifiedCount),"unified"!==n&&r(e.splitCount),0===i.length)return[0,0];let o=i[0][0],s=i[0][1];for(let a=1;a<i.length;a++){const e=i[a];o=Math.min(o,e[0]),s=Math.max(s,e[1])}return[o,s]}(e,t,n);s>0&&(e.incrementCounts(s,s),null==r||r());let l=s;for(;l<t;){if(!0===(null==o?void 0:o()))return!0;if(l>=a){e.incrementCounts(t-l,t-l);break}if(e.isInWindow(0,0)){if(!0===i(l))return!0}else e.incrementCounts(1,1);l++}return!1}function Uu(e,t,n){if(!e.isWindowedHighlight)return[[0,"unified"===n?t.deletions+t.additions:Math.max(t.deletions,t.additions)]];const i="unified"!==n,r="unified"===n?"unified":"split",o=[];function s(t,n){if(t+n<=e.viewportStart||t>=e.viewportEnd)return;const i=Math.max(0,e.viewportStart-t),r=Math.min(n,e.viewportEnd-t);return r>i?[i,r]:void 0}function a(e,n){if(null==e)return;const[i,s]=function(e,n){return"split"===r?e:"additions"===n?[e[0]+t.deletions,e[1]+t.deletions]:e}(e,n);s>i&&o.push([i,s])}if("split"!==n&&(a(s(e.unifiedCount,t.deletions),"deletions"),a(s(e.unifiedCount+t.deletions,t.additions),"additions")),i&&(a(s(e.splitCount,t.deletions),"deletions"),a(s(e.splitCount,t.additions),"additions")),0===o.length)return o;o.sort((e,t)=>e[0]-t[0]);const l=[o[0]];for(const[d,c]of o.slice(1)){const e=l[l.length-1];d<=e[1]?e[1]=Math.max(e[1],c):l.push([d,c])}return l}function Gu({hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:i,diffStyle:r,index:o,unifiedLineIndex:s,splitLineIndex:a,additionLineIndex:l,deletionLineIndex:d,additionLineNumber:c,deletionLineNumber:u,content:h,isLastContent:f,unifiedCount:p,splitCount:m}){const g=o<h.deletions?s+o:void 0,v="unified"===r?o>=h.deletions?s+o:void 0:o<h.additions?s+h.deletions+o:void 0,b="unified"===r?a+(o<h.deletions?o:o-h.deletions):a+o,y=o<h.deletions?d+o:void 0,C=o<h.deletions?u+o:void 0,S="unified"===r?o>=h.deletions?l+(o-h.deletions):void 0:o<h.additions?l+o:void 0,k="unified"===r?o>=h.deletions?c+(o-h.deletions):void 0:o<h.additions?c+o:void 0,x="unified"===r?f&&o===h.deletions-1&&t.noEOFCRDeletions:f&&o===m-1&&t.noEOFCRDeletions,w="unified"===r?f&&o===p-1&&t.noEOFCRAdditions:f&&o===m-1&&t.noEOFCRAdditions,L=null!=y&&null!=C&&null!=g?{lineNumber:C,lineIndex:y,noEOFCR:x,unifiedLineIndex:g,splitLineIndex:b}:void 0,T=null!=S&&null!=k&&null!=v?{unifiedLineIndex:v,splitLineIndex:b,lineIndex:S,lineNumber:k,noEOFCR:w}:void 0;if(null==L&&null!=T)return{type:"change",hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:i,deletionLine:void 0,additionLine:T};if(null!=L&&null==T)return{type:"change",hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:i,deletionLine:L,additionLine:void 0};if(null==L||null==T)throw new Error("iterateOverDiff: missing change line data");return{type:"change",hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:i,deletionLine:L,additionLine:T}}const Wu={forcePlainText:!1};function Vu(e,t,n,{forcePlainText:i,startingLine:r,totalLines:o,expandedHunks:s,collapsedContextThreshold:a=1}=Wu){var l;i?(null!=r||(r=0),null!=o||(o=1/0)):(r=0,o=1/0);const d=r>0||o<1/0,c="string"==typeof n.theme?t.getTheme(n.theme).type:void 0,u=Bd({theme:n.theme,highlighter:t}),h=i&&!d&&(e.unifiedLineCount>1e3||e.splitLineCount>1e3)?"none":n.lineDiffType,f={deletionLines:[],additionLines:[]},{maxLineDiffLength:p}=n,m=!i&&!e.isPartial,g=i?s:void 0,v=/* @__PURE__ */new Map;function b(e,t,n,i){if(d){let e=n.at(-1);null!=e&&e.targetIndex+e.count===t||(e={targetIndex:t,originalOffset:i.length,count:0},n.push(e)),e.count++}i.push(e)}$u({diff:e,diffStyle:"both",startingLine:r,totalLines:o,expandedHunks:!d||g,collapsedContextThreshold:a,callback:({hunkIndex:t,additionLine:n,deletionLine:i,type:r})=>{var o,s;const a=function(e){var t;const n=m?0:e,i=null!=(t=v.get(n))?t:{deletionContent:{push(e){this.value+=e,this.length++},value:"",length:0},additionContent:{push(e){this.value+=e,this.length++},value:"",length:0},deletionInfo:[],additionInfo:[],deletionDecorations:[],additionDecorations:[],deletionSegments:[],additionSegments:[]};return v.set(n,i),i}(t),l=null!=n?n.splitLineIndex:i.splitLineIndex;"change"===r&&null!=n&&null!=i&&function({deletionLine:e,additionLine:t,deletionLineIndex:n,additionLineIndex:i,deletionDecorations:r,additionDecorations:o,lineDiffType:s,maxLineDiffLength:a}){if(null==e||null==t||"none"===s)return;if(e=kd(e),t=kd(t),e.length>a||t.length>a)return;const l="char"===s?(f=e,p=t,uu.diff(f,p,void 0)):function(e,t){return fu.diff(e,t,void 0)}(e,t),d=[],c=[],u="word-alt"===s,h=l.at(-1);var f,p;for(const g of l){const e=g===h;g.added||g.removed?g.removed?Nu({item:g,arr:d,enableJoin:u,isLastItem:e}):Nu({item:g,arr:c,enableJoin:u,isLastItem:e}):(Nu({item:g,arr:d,enableJoin:u,isNeutral:!0,isLastItem:e}),Nu({item:g,arr:c,enableJoin:u,isNeutral:!0,isLastItem:e}))}let m=0;for(const g of d)1===g[0]&&r.push(Pu({line:n,spanStart:m,spanLength:g[1].length})),m+=g[1].length;m=0;for(const g of c)1===g[0]&&o.push(Pu({line:i,spanStart:m,spanLength:g[1].length})),m+=g[1].length}({additionLine:e.additionLines[n.lineIndex],deletionLine:e.deletionLines[i.lineIndex],deletionLineIndex:a.deletionContent.length,additionLineIndex:a.additionContent.length,deletionDecorations:a.deletionDecorations,additionDecorations:a.additionDecorations,lineDiffType:h,maxLineDiffLength:p}),null!=i&&(b(e.deletionLines[i.lineIndex],i.lineIndex,a.deletionSegments,a.deletionContent),a.deletionInfo.push({type:"change"===r?"change-deletion":r,lineNumber:i.lineNumber,altLineNumber:"change"===r?void 0:null!=(o=n.lineNumber)?o:void 0,lineIndex:`${i.unifiedLineIndex},${l}`})),null!=n&&(b(e.additionLines[n.lineIndex],n.lineIndex,a.additionSegments,a.additionContent),a.additionInfo.push({type:"change"===r?"change-addition":r,lineNumber:n.lineNumber,altLineNumber:"change"===r?void 0:null!=(s=i.lineNumber)?s:void 0,lineIndex:`${n.unifiedLineIndex},${l}`}))}});for(const y of v.values()){if(0===y.deletionContent.length&&0===y.additionContent.length)continue;const r={name:null!=(l=e.prevName)?l:e.name,contents:y.deletionContent.value},o={name:e.name,contents:y.additionContent.value},{deletionLines:s,additionLines:a}=qu({deletionFile:r,deletionInfo:y.deletionInfo,deletionDecorations:y.deletionDecorations,additionFile:o,additionInfo:y.additionInfo,additionDecorations:y.additionDecorations,highlighter:t,options:n,languageOverride:i?"text":e.lang});if(m)f.deletionLines=s,f.additionLines=a;else{if(y.deletionSegments.length>0)for(const e of y.deletionSegments)for(let t=0;t<e.count;t++)f.deletionLines[e.targetIndex+t]=s[e.originalOffset+t];else f.deletionLines.push(...s);if(y.additionSegments.length>0)for(const e of y.additionSegments)for(let t=0;t<e.count;t++)f.additionLines[e.targetIndex+t]=a[e.originalOffset+t];else f.additionLines.push(...a)}}return{code:f,themeStyles:u,baseThemeType:c}}function qu({deletionFile:e,additionFile:t,deletionInfo:n,additionInfo:i,highlighter:r,deletionDecorations:o,additionDecorations:s,languageOverride:a,options:{theme:l=G,...d}}){const c=null!=a?a:md(e.name),u=null!=a?a:md(t.name),{state:h,transformers:f}=Id(d.useTokenTransformer),p="string"==typeof l?{...d,lang:"text",theme:l,transformers:f,decorations:void 0,defaultColor:!1,cssVariablePrefix:Rd("token"),tokenizeTimeLimit:0}:{...d,lang:"text",themes:l,transformers:f,decorations:void 0,defaultColor:!1,cssVariablePrefix:Rd("token"),tokenizeTimeLimit:0};return{deletionLines:""===e.contents?[]:(p.lang=c,h.lineInfo=n,p.decorations=o,zd(r.codeToHast(kd(e.contents),p))),additionLines:""===t.contents?[]:(p.lang=u,p.decorations=s,h.lineInfo=i,zd(r.codeToHast(kd(t.contents),p)))}}function Ku(e){var t,n;const i=null!=(t=e.lang)?t:md(e.name),r=null!=(n=e.lang)?n:null!=e.prevName?md(e.prevName):"text";return"text"===i&&"text"===r}let Xu=-1;var Qu=class{constructor(e={theme:G},t,n){var i;y(this,"options"),y(this,"onRenderUpdate"),y(this,"workerManager"),y(this,"__id","diff-hunks-renderer:"+ ++Xu),y(this,"highlighter"),y(this,"diff"),y(this,"expandedHunks",/* @__PURE__ */new Map),y(this,"deletionAnnotations",{}),y(this,"additionAnnotations",{}),y(this,"computedLang","text"),y(this,"renderCache"),y(this,"createAnnotationElement",e=>od(e)),this.options=e,this.onRenderUpdate=t,this.workerManager=n,!0!==(null==n?void 0:n.isWorkingPool())&&(this.highlighter=ed(null!=(i=e.theme)?i:G)?Kl():void 0)}cleanUp(){this.recycle(),this.expandedHunks.clear(),this.workerManager=void 0,this.onRenderUpdate=void 0}recycle(){var e;this.highlighter=void 0,this.diff=void 0,this.clearRenderCache(),this.additionAnnotations={},this.deletionAnnotations={},null==(e=this.workerManager)||e.cleanUpTasks(this)}clearRenderCache(){this.renderCache=void 0}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}expandHunk(e,t,n=this.getOptionsWithDefaults().expansionLineCount){var i,r;const o={...null!=(i=this.expandedHunks.get(e))?i:{fromStart:0,fromEnd:0}};"up"!==t&&"both"!==t||(o.fromStart+=n),"down"!==t&&"both"!==t||(o.fromEnd+=n),!0!==(null==(r=this.renderCache)?void 0:r.highlighted)&&this.clearRenderCache(),this.expandedHunks.set(e,o)}getExpandedHunk(e){var t;return null!=(t=this.expandedHunks.get(e))?t:ne}getExpandedHunksMap(){return this.expandedHunks}setLineAnnotations(e){var t;this.additionAnnotations={},this.deletionAnnotations={};for(const n of e){const e=(()=>{switch(n.side){case"deletions":return this.deletionAnnotations;case"additions":return this.additionAnnotations}})(),i=null!=(t=e[n.lineNumber])?t:[];e[n.lineNumber]=i,i.push(n)}}getUnifiedLineDecoration({lineType:e}){return{gutterLineType:e}}getSplitLineDecoration({side:e,type:t}){return"change"!==t?{gutterLineType:t}:{gutterLineType:"deletions"===e?"change-deletion":"change-addition"}}getOptionsWithDefaults(){var e,t;const{diffIndicators:n="bars",diffStyle:i="split",disableBackground:r=!1,disableFileHeader:o=!1,disableLineNumbers:s=!1,disableVirtualizationBuffers:a=!1,collapsed:l=!1,expandUnchanged:d=!1,collapsedContextThreshold:c=1,expansionLineCount:u=100,hunkSeparators:h="line-info",lineDiffType:f="word-alt",maxLineDiffLength:p=1e3,overflow:m="scroll",stickyHeader:g=!1,theme:v=G,headerRenderMode:b="default",tokenizeMaxLineLength:y=1e3,tokenizeMaxLength:C=Y,useTokenTransformer:S=!1,useCSSClasses:k=!1}=this.options;return{diffIndicators:n,diffStyle:i,disableBackground:r,disableFileHeader:o,disableLineNumbers:s,disableVirtualizationBuffers:a,collapsed:l,expandUnchanged:d,collapsedContextThreshold:c,expansionLineCount:u,hunkSeparators:h,lineDiffType:f,maxLineDiffLength:p,overflow:m,stickyHeader:g,theme:null!=(t=null==(e=this.workerManager)?void 0:e.getDiffRenderOptions().theme)?t:v,headerRenderMode:b,tokenizeMaxLineLength:y,tokenizeMaxLength:C,useTokenTransformer:S,useCSSClasses:k}}async initializeHighlighter(){return this.highlighter=await Vl(Cd(this.computedLang,this.options)),this.highlighter}hydrate(e){var t,n,i;if(null==e)return;this.diff=e;const{options:r}=this.getRenderOptions(e),o=oh(e,this.getTokenizeMaxLength());let s=null==(t=this.workerManager)?void 0:t.getDiffResultCache(e);null==s||wu(r,s.options)||(s=void 0),null!=this.renderCache||(this.renderCache={diff:e,highlighted:!o&&!Ku(e),options:r,result:o||null==s?void 0:s.result,renderRange:void 0}),!0===(null==(n=this.workerManager)?void 0:n.isWorkingPool())?null!=this.renderCache.result||o||this.workerManager.highlightDiffAST(this,this.diff):null==this.highlighter&&(this.computedLang=null!=(i=e.lang)?i:md(e.name),this.initializeHighlighter())}getRenderOptions(e){const t=(()=>{var e;if(!0===(null==(e=this.workerManager)?void 0:e.isWorkingPool()))return this.workerManager.getDiffRenderOptions();const{theme:t,tokenizeMaxLineLength:n,lineDiffType:i,maxLineDiffLength:r}=this.getOptionsWithDefaults();return{theme:t,useTokenTransformer:Zd(this.options),tokenizeMaxLineLength:n,lineDiffType:i,maxLineDiffLength:r}})();this.getOptionsWithDefaults();const{renderCache:n}=this;return null==(null==n?void 0:n.result)?{options:t,forceHighlight:!0}:_c(e,n.diff)&&wu(t,n.options)?{options:t,forceHighlight:!1}:{options:t,forceHighlight:!0}}renderDiff(e=(e=>null==(e=this.renderCache)?void 0:e.diff)(),t=ie){var n,i;if(null==e)return;const{expandUnchanged:r=!1,collapsedContextThreshold:o}=this.getOptionsWithDefaults();let{options:s,forceHighlight:a}=this.getRenderOptions(e);const l=this.getMatchingWorkerResultCache(e,s);null==l||this.hasHighlightedRenderCache(e,s)||(this.renderCache={diff:e,highlighted:!0,renderRange:void 0,...l},a=!1),null!=this.renderCache||(this.renderCache={diff:e,highlighted:!1,options:s,result:void 0,renderRange:void 0});const d=e.additionLines.length>0||e.deletionLines.length>0,c=!d||Ku(e)||oh(e,this.getTokenizeMaxLength()),u=!_c(e,this.renderCache.diff),h=!rd(this.renderCache.renderRange,t);if(!0===(null==(n=this.workerManager)?void 0:n.isWorkingPool()))(c||null==this.renderCache.result||!this.renderCache.highlighted&&(u||h))&&(this.renderCache.diff=e,this.renderCache.options=s,this.renderCache.highlighted=!1,(null==this.renderCache.result||u||h||a)&&(this.renderCache.result=this.workerManager.getPlainDiffAST(e,t.startingLine,t.totalLines,!!Ru(t)||!!r||this.expandedHunks,o)),this.renderCache.renderRange=t),c||!d||this.renderCache.highlighted&&!a||this.workerManager.highlightDiffAST(this,e);else{this.computedLang=null!=(i=e.lang)?i:md(e.name);const t=null!=this.highlighter&&ed(s.theme),n=null!=this.highlighter&&xn(this.computedLang),r=!c&&n;if(null!=this.highlighter&&t&&(a||c||!this.renderCache.highlighted&&r||null==this.renderCache.result)){const{result:t,options:i}=this.renderDiffWithHighlighter(e,this.highlighter,c||!n);this.renderCache={diff:e,options:i,highlighted:r,result:t,renderRange:void 0}}t&&(c||n)||this.asyncHighlight(e).then(({result:t,options:n})=>{null!=this.renderCache&&(this.renderCache.highlighted=!1),this.onHighlightSuccess(e,t,n,!c)})}return null!=this.renderCache.result?this.processDiffResult(this.renderCache.diff,t,this.renderCache.result):void 0}async asyncRender(e,t=ie){const{result:n}=await this.asyncHighlight(e);return this.processDiffResult(e,t,n)}createPreElement(e,t,n){const{diffIndicators:i,disableBackground:r,disableLineNumbers:o,overflow:s}=this.getOptionsWithDefaults();return cd({type:"diff",diffIndicators:i,disableBackground:r,disableLineNumbers:o,overflow:s,split:e,totalLines:t,customProperties:n})}async asyncHighlight(e){var t,n;const i=oh(e,this.getTokenizeMaxLength());this.computedLang=i?"text":null!=(t=e.lang)?t:md(e.name);const r=null!=this.highlighter&&ed(null!=(n=this.options.theme)?n:G),o=i||null!=this.highlighter&&xn(this.computedLang);return null!=this.highlighter&&r&&o||(this.highlighter=await this.initializeHighlighter()),this.renderDiffWithHighlighter(e,this.highlighter,i)}renderDiffWithHighlighter(e,t,n=!1){const{options:i}=this.getRenderOptions(e),{collapsedContextThreshold:r}=this.getOptionsWithDefaults();return{result:Vu(e,t,i,{forcePlainText:n,expandedHunks:!!n||void 0,collapsedContextThreshold:r}),options:i}}onHighlightSuccess(e,t,n,i=!0){var r;if(null==this.renderCache)return;const o=!this.renderCache.highlighted||!wu(this.renderCache.options,n)||!_c(this.renderCache.diff,e);this.renderCache={diff:e,options:n,highlighted:i,result:t,renderRange:void 0},o&&(null==(r=this.onRenderUpdate)||r.call(this))}getMatchingWorkerResultCache(e,t){var n;const i=null==(n=this.workerManager)?void 0:n.getDiffResultCache(e);if(null!=i&&wu(t,i.options))return i}hasHighlightedRenderCache(e,t){const{renderCache:n}=this;return null!=(null==n?void 0:n.result)&&n.highlighted&&_c(e,n.diff)&&wu(t,n.options)}onHighlightError(e){console.error(e)}getTokenizeMaxLength(){var e;return null!=(e=this.options.tokenizeMaxLength)?e:1e5}processDiffResult(e,t,{code:n,themeStyles:i,baseThemeType:r}){var o,s;const{diffStyle:a,disableFileHeader:l,expandUnchanged:d,expansionLineCount:c,collapsedContextThreshold:u,hunkSeparators:h}=this.getOptionsWithDefaults();this.diff=e;const f="unified"===a;let p=[],m=[],g=[];const v=[],{additionLines:b,deletionLines:y}=n,C={rowCount:0,hunkSeparators:h,additionsContentAST:p,deletionsContentAST:m,unifiedContentAST:g,unifiedGutterAST:Se(),deletionsGutterAST:Se(),additionsGutterAST:Se(),expansionLineCount:c,hunkData:v,incrementRowCount(e=1){C.rowCount+=e},pushToGutter(e,t){switch(e){case"unified":C.unifiedGutterAST.children.push(t);break;case"deletions":C.deletionsGutterAST.children.push(t);break;case"additions":C.additionsGutterAST.children.push(t)}}},S=Hu({fileDiff:e,errorPrefix:"DiffHunksRenderer.processDiffResult"}),k={size:0,side:void 0,increment(){this.size+=1},flush(){if("unified"!==a){if(this.size<=0||null==this.side)return this.side=void 0,void(this.size=0);"additions"===this.side?(C.pushToGutter("additions",xe(void 0,"buffer",this.size)),null==p||p.push(Lu(this.size))):(C.pushToGutter("deletions",xe(void 0,"buffer",this.size)),null==m||m.push(Lu(this.size))),this.size=0,this.side=void 0}}},x=(e,t,n,i,r)=>{C.pushToGutter(e,ke(t,n,i,r))};function w(e){k.flush(),"unified"===a?ih("unified",e,C):(ih("deletions",e,C),ih("additions",e,C))}this.pushFileLevelAnnotations(e,a,t,C),$u({diff:e,diffStyle:a,startingLine:t.startingLine,totalLines:t.totalLines,expandedHunks:!!d||this.expandedHunks,collapsedContextThreshold:u,callback:({hunkIndex:t,hunk:n,collapsedBefore:i,collapsedAfter:r,additionLine:o,deletionLine:s,type:l})=>{var d,c,u,f,p;const m=null!=s?s.splitLineIndex:o.splitLineIndex,g=null!=o?o.unifiedLineIndex:s.unifiedLineIndex;"split"===a&&"change"!==l&&k.flush(),i>0&&w({hunkIndex:t,collapsedLines:i,rangeSize:Math.max(null!=(d=null==n?void 0:n.collapsedBefore)?d:0,0),hunkSpecs:null==n?void 0:n.hunkSpecs,isFirstHunk:0===t,isLastHunk:!1,isExpandable:!e.isPartial});const v="unified"===a?g:m,L={type:l,hunkIndex:t,lineIndex:v,unifiedLineIndex:g,splitLineIndex:m,deletionLine:s,additionLine:o};if("unified"===a){const n=null==(c=this.getUnifiedInjectedRowsForLine)?void 0:c.call(this,L);null!=(null==n?void 0:n.before)&&eh(n.before,C);let i=null!=s?y[s.lineIndex]:void 0,r=null!=o?b[o.lineIndex]:void 0;if(null==i&&null==r){const t="DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong";throw console.error(t,{file:e.name}),new Error(t)}const a="change"===l?null!=o?"change-addition":"change-deletion":l,d=this.getUnifiedLineDecoration({type:l,lineType:a,additionLineIndex:null==o?void 0:o.lineIndex,deletionLineIndex:null==s?void 0:s.lineIndex});x("unified",d.gutterLineType,null!=o?o.lineNumber:s.lineNumber,`${g},${m}`,d.gutterProperties),null!=r?r=rh(r,d.contentProperties):null!=i&&(i=rh(i,d.contentProperties)),nh({diffStyle:"unified",type:l,deletionLine:i,additionLine:r,unifiedSpan:this.getAnnotations("unified",null==s?void 0:s.lineNumber,null==o?void 0:o.lineNumber,t,v),createAnnotationElement:e=>this.createAnnotationElement(e),context:C}),null!=(null==n?void 0:n.after)&&eh(n.after,C)}else{const n=null==(u=this.getSplitInjectedRowsForLine)?void 0:u.call(this,L);null!=(null==n?void 0:n.before)&&th(n.before,C,k);let i=null!=s?y[s.lineIndex]:void 0,r=null!=o?b[o.lineIndex]:void 0;const a=this.getSplitLineDecoration({side:"deletions",type:l,lineIndex:null==s?void 0:s.lineIndex}),d=this.getSplitLineDecoration({side:"additions",type:l,lineIndex:null==o?void 0:o.lineIndex});if(null==i&&null==r){const t="DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong";throw console.error(t,{file:e.name}),new Error(t)}const c=(()=>{if("change"===l){if(null==r)return"additions";if(null==i)return"deletions"}})();if(null!=c){if(null!=k.side&&k.side!==c)throw new Error("DiffHunksRenderer.processDiffResult: iterateOverDiff, invalid pending splits");k.side=c,k.increment()}const h=this.getAnnotations("split",null==s?void 0:s.lineNumber,null==o?void 0:o.lineNumber,t,v);if(null!=h&&k.size>0&&k.flush(),null!=s){const e=rh(i,a.contentProperties);x("deletions",a.gutterLineType,s.lineNumber,`${s.unifiedLineIndex},${m}`,a.gutterProperties),null!=e&&(i=e)}if(null!=o){const e=rh(r,d.contentProperties);x("additions",d.gutterLineType,o.lineNumber,`${o.unifiedLineIndex},${m}`,d.gutterProperties),null!=e&&(r=e)}nh({diffStyle:"split",type:l,additionLine:r,deletionLine:i,...h,createAnnotationElement:e=>this.createAnnotationElement(e),context:C}),null!=(null==n?void 0:n.after)&&th(n.after,C,k)}const T="split"===a&&null!=n&&m===n.splitLineStart+n.splitLineCount-1,A=!!T&&n.noEOFCRDeletions,I=!!T&&n.noEOFCRAdditions,E=null!=(f=null==s?void 0:s.noEOFCR)&&f||A,M=null!=(p=null==o?void 0:o.noEOFCR)&&p||I;if(M||E){if("split"===a&&k.flush(),E){const e="context"===l||"context-expanded"===l?l:"change-deletion";"unified"===a?(C.unifiedContentAST.push(Tu(e)),C.pushToGutter("unified",xe(e,"metadata",1))):(C.deletionsContentAST.push(Tu(e)),C.pushToGutter("deletions",xe(e,"metadata",1)),M||(C.pushToGutter("additions",xe(void 0,"buffer",1)),C.additionsContentAST.push(Lu(1))))}if(M){const e="context"===l||"context-expanded"===l?l:"change-addition";"unified"===a?(C.unifiedContentAST.push(Tu(e)),C.pushToGutter("unified",xe(e,"metadata",1))):(C.additionsContentAST.push(Tu(e)),C.pushToGutter("additions",xe(e,"metadata",1)),E||(C.pushToGutter("deletions",xe(void 0,"buffer",1)),C.deletionsContentAST.push(Lu(1))))}C.incrementRowCount(1)}r>0&&"simple"!==h&&w({hunkIndex:"context-expanded"===l?t:t+1,collapsedLines:r,rangeSize:S,hunkSpecs:void 0,isFirstHunk:!1,isLastHunk:!0,isExpandable:!e.isPartial}),C.incrementRowCount(1)}}),"split"===a&&k.flush();const L=Math.max(Mu(e.hunks),null!=(o=e.additionLines.length)?o:0,null!=(s=e.deletionLines.length)?s:0),T=t.bufferBefore>0||t.bufferAfter>0,A=!f&&"deleted"!==e.type,I=!f&&"new"!==e.type,E=C.rowCount>0||T;p=A&&E?p:void 0,m=I&&E?m:void 0,g=f&&E?g:void 0;const M=this.createPreElement(null!=m&&null!=p,L);return{unifiedGutterAST:f&&E?C.unifiedGutterAST.children:void 0,unifiedContentAST:g,deletionsGutterAST:I&&E?C.deletionsGutterAST.children:void 0,deletionsContentAST:m,additionsGutterAST:A&&E?C.additionsGutterAST.children:void 0,additionsContentAST:p,hunkData:v,preNode:M,themeStyles:i,baseThemeType:r,headerElement:l?void 0:this.renderHeader(this.diff),totalLines:L,rowCount:C.rowCount,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:""}}renderCodeAST(e,t){const n="unified"===e?t.unifiedGutterAST:"deletions"===e?t.deletionsGutterAST:t.additionsGutterAST,i="unified"===e?t.unifiedContentAST:"deletions"===e?t.deletionsContentAST:t.additionsContentAST;if(null==n||null==i)return;const r=Se(n);return r.properties.style=`grid-row: span ${t.rowCount}`,[r,Yd(i,t.rowCount)]}renderFullAST(e,t=[]){const n="line-info"===this.getOptionsWithDefaults().hunkSeparators,i=this.renderCodeAST("unified",e);if(null!=i)return t.push(be({tagName:"code",children:i,properties:{"data-code":"","data-container-size":n?"":void 0,"data-unified":""}})),{...e.preNode,children:t};const r=this.renderCodeAST("deletions",e);null!=r&&t.push(be({tagName:"code",children:r,properties:{"data-code":"","data-container-size":n?"":void 0,"data-deletions":""}}));const o=this.renderCodeAST("additions",e);return null!=o&&t.push(be({tagName:"code",children:o,properties:{"data-code":"","data-container-size":n?"":void 0,"data-additions":""}})),{...e.preNode,children:t}}renderFullHTML(e,t=[]){return Qt(this.renderFullAST(e,t))}renderPartialHTML(e,t){return Qt(null==t?e:be({tagName:"code",children:e,properties:{"data-code":"","data-container-size":"line-info"===this.getOptionsWithDefaults().hunkSeparators?"":void 0,[`data-${t}`]:""}}))}pushFileLevelAnnotations(e,t,n,i){if(!Qd(n))return;const r="new"!==e.type?Yu(Xd(this.deletionAnnotations)):[],o="deleted"!==e.type?Yu(Xd(this.additionAnnotations)):[];if(0===r.length&&0===o.length)return;const{createAnnotationElement:s}=this;nh("unified"!==t?{diffStyle:t,type:"context",deletionSpan:{type:"annotation",hunkIndex:-1,lineIndex:-1,annotations:r},additionSpan:{type:"annotation",hunkIndex:-1,lineIndex:-1,annotations:o},createAnnotationElement:s,context:i}:{diffStyle:t,type:"context",unifiedSpan:{type:"annotation",hunkIndex:-1,lineIndex:-1,annotations:r.concat(o)},createAnnotationElement:s,context:i})}getAnnotations(e,t,n,i,r){var o,s;const a={type:"annotation",hunkIndex:i,lineIndex:r,annotations:[]};if(null!=t)for(const d of null!=(o=this.deletionAnnotations[t])?o:[])a.annotations.push(Sd(d));const l={type:"annotation",hunkIndex:i,lineIndex:r,annotations:[]};if(null!=n)for(const d of null!=(s=this.additionAnnotations[n])?s:[])("unified"===e?a:l).annotations.push(Sd(d));return"unified"===e?a.annotations.length>0?a:void 0:0!==l.annotations.length||0!==a.annotations.length?{deletionSpan:a,additionSpan:l}:void 0}renderHeader(e){const{headerRenderMode:t,stickyHeader:n}=this.getOptionsWithDefaults();return ad({fileOrDiff:e,mode:t,stickyHeader:n})}};function Yu(e){var t;return null!=(t=null==e?void 0:e.map(e=>Sd(e)))?t:[]}const Ju=new Intl.PluralRules("en-US");function Zu(e){return`${e} unmodified line${"one"===Ju.select(e)?"":"s"}`}function eh(e,t){for(const n of e)t.unifiedContentAST.push(n.content),t.pushToGutter("unified",n.gutter),t.incrementRowCount(1)}function th(e,t,n){for(const{deletion:i,addition:r}of e){if(null==i&&null==r)continue;const e=null!=i&&null!=r?void 0:null==i?"deletions":"additions";null!=e&&n.side===e||n.flush(),null!=i&&(t.deletionsContentAST.push(i.content),t.pushToGutter("deletions",i.gutter)),null!=r&&(t.additionsContentAST.push(r.content),t.pushToGutter("additions",r.gutter)),null!=e&&(n.side=e,n.increment()),t.incrementRowCount(1)}}function nh({diffStyle:e,type:t,deletionLine:n,additionLine:i,unifiedSpan:r,deletionSpan:o,additionSpan:s,createAnnotationElement:a,context:l}){let d=!1;if("unified"===e){if(null!=i?l.unifiedContentAST.push(i):null!=n&&l.unifiedContentAST.push(n),null!=r){const e="change"===t?null!=n?"change-deletion":"change-addition":t;l.unifiedContentAST.push(a(r)),l.pushToGutter("unified",xe(e,"annotation",1)),d=!0}}else if("split"===e){if(null!=n&&l.deletionsContentAST.push(n),null!=i&&l.additionsContentAST.push(i),null!=o){const e="change"===t?null!=n?"change-deletion":"context":t;l.deletionsContentAST.push(a(o)),l.pushToGutter("deletions",xe(e,"annotation",1)),d=!0}if(null!=s){const e="change"===t?null!=i?"change-addition":"context":t;l.additionsContentAST.push(a(s)),l.pushToGutter("additions",xe(e,"annotation",1)),d=!0}}d&&l.incrementRowCount(1)}function ih(e,{hunkIndex:t,collapsedLines:n,rangeSize:i,hunkSpecs:r,isFirstHunk:o,isLastHunk:s,isExpandable:a},l){if(n<=0)return;const d="unified"===e?l.unifiedContentAST:"deletions"===e?l.deletionsContentAST:l.additionsContentAST;if("metadata"===l.hunkSeparators)return void(null!=r&&(l.pushToGutter(e,Iu({type:"metadata",content:r,isFirstHunk:o,isLastHunk:s})),d.push(Iu({type:"metadata",content:r,isFirstHunk:o,isLastHunk:s})),"additions"!==e&&l.incrementRowCount(1)));if("simple"===l.hunkSeparators)return void(t>0&&(l.pushToGutter(e,Iu({type:"simple",isFirstHunk:o,isLastHunk:!1})),d.push(Iu({type:"simple",isFirstHunk:o,isLastHunk:!1})),"additions"!==e&&l.incrementRowCount(1)));const c=Eu(e,t),u=i>l.expansionLineCount,h=a?t:void 0;l.pushToGutter(e,Iu({type:l.hunkSeparators,content:Zu(n),expandIndex:h,chunked:u,slotName:c,isFirstHunk:o,isLastHunk:s})),d.push(Iu({type:l.hunkSeparators,content:Zu(n),expandIndex:h,chunked:u,slotName:c,isFirstHunk:o,isLastHunk:s})),"additions"!==e&&l.incrementRowCount(1),l.hunkData.push({slotName:c,hunkIndex:t,lines:n,type:e,expandable:a?{up:!o,down:!s,chunked:u}:void 0})}function rh(e,t){return null==e||"element"!==e.type||null==t?e:{...e,properties:{...e.properties,...t}}}function oh(e,t){return Math.max(e.additionLines.length,e.deletionLines.length)>t}function sh(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side&&e.metadata===t.metadata}function ah(e,t){var n,i,r,o,s,a;return e.slotName===t.slotName&&e.hunkIndex===t.hunkIndex&&e.lines===t.lines&&e.type===t.type&&(null==(n=e.expandable)?void 0:n.chunked)===(null==(i=t.expandable)?void 0:i.chunked)&&(null==(r=e.expandable)?void 0:r.up)===(null==(o=t.expandable)?void 0:o.up)&&(null==(s=e.expandable)?void 0:s.down)===(null==(a=t.expandable)?void 0:a.down)}let lh=-1;var dh=(h=class{constructor(e={theme:G},t,n=!1){var i,r;y(this,"options"),y(this,"workerManager"),y(this,"isContainerManaged"),y(this,"__id","file-diff:"+ ++lh),y(this,"type","file-diff"),y(this,"fileContainer"),y(this,"spriteSVG"),y(this,"pre"),y(this,"codeUnified"),y(this,"codeDeletions"),y(this,"codeAdditions"),y(this,"bufferBefore"),y(this,"bufferAfter"),y(this,"themeCSSStyle"),y(this,"appliedThemeCSS"),y(this,"hasAdoptedThemeCSS",!1),y(this,"unsafeCSSStyle"),y(this,"appliedUnsafeCSS"),y(this,"gutterUtilityContent"),y(this,"headerElement"),y(this,"headerPrefix"),y(this,"headerMetadata"),y(this,"headerCustom"),y(this,"separatorCache",/* @__PURE__ */new Map),y(this,"errorWrapper"),y(this,"placeHolder"),y(this,"hunksRenderer"),y(this,"resizeManager"),y(this,"scrollSyncManager"),y(this,"interactionManager"),y(this,"annotationCache",/* @__PURE__ */new Map),y(this,"lineAnnotations",[]),y(this,"managersDirty",!1),y(this,"deletionFile"),y(this,"additionFile"),y(this,"fileDiff"),y(this,"renderRange"),y(this,"appliedPreAttributes"),y(this,"lastRenderedHeaderHTML"),y(this,"cachedHeaderHTML"),y(this,"lastRowCount"),y(this,"mounted",!1),y(this,"enabled",!0),y(this,"handleHighlightRender",()=>{this.rerender()}),y(this,"getLineIndex",(e,t="additions")=>{if(null==this.fileDiff)return;const n=this.fileDiff.hunks.at(-1);let i,r;e:for(const o of this.fileDiff.hunks){let s="deletions"===t?o.deletionStart:o.additionStart;const a="deletions"===t?o.deletionCount:o.additionCount;let l=o.splitLineStart,d=o.unifiedLineStart;if(e<s){const t=s-e;i=Math.max(d-t,0),r=Math.max(l-t,0);break e}if(!(e>=s+a)){for(const n of o.hunkContent)if("context"===n.type){if(e<s+n.lines){const t=e-s;r=l+t,i=d+t;break e}s+=n.lines,l+=n.lines,d+=n.lines}else{const o="deletions"===t?n.deletions:n.additions;if(e<s+o){const o=e-s;i=d+("additions"===t?n.deletions:0)+o,r=l+o;break e}s+=o,l+=Math.max(n.deletions,n.additions),d+=n.deletions+n.additions}break e}if(o===n){const t=e-(s+a);i=d+o.unifiedLineCount+t,r=l+o.splitLineCount+t;break e}}return null!=i&&null!=r?[i,r]:void 0}),y(this,"getHoveredLine",()=>this.interactionManager.getHoveredLine()),y(this,"handleExpandHunk",(e,t,n)=>{this.expandHunk(e,t,n)}),y(this,"expandHunk",(e,t,n)=>{this.hunksRenderer.expandHunk(e,t,n),this.rerender()}),this.options=e,this.workerManager=t,this.isContainerManaged=n,this.hunksRenderer=this.createHunksRenderer(e),this.resizeManager=new pn,this.scrollSyncManager=new xu,this.interactionManager=new Zt("diff",en(e,"function"==typeof e.hunkSeparators||"line-info"===(null!=(i=e.hunkSeparators)?i:"line-info")||"line-info-basic"===e.hunkSeparators?this.handleExpandHunk:void 0,this.getLineIndex)),null==(r=this.workerManager)||r.subscribeToThemeChanges(this),this.enabled=!0}getHunksRendererOptions(e){return function(e){return{theme:null==e?void 0:e.theme,disableLineNumbers:null==e?void 0:e.disableLineNumbers,overflow:null==e?void 0:e.overflow,collapsed:null==e?void 0:e.collapsed,disableFileHeader:null==e?void 0:e.disableFileHeader,disableVirtualizationBuffers:null==e?void 0:e.disableVirtualizationBuffers,stickyHeader:null==e?void 0:e.stickyHeader,preferredHighlighter:null==e?void 0:e.preferredHighlighter,useCSSClasses:null==e?void 0:e.useCSSClasses,useTokenTransformer:null==e?void 0:e.useTokenTransformer,tokenizeMaxLineLength:null==e?void 0:e.tokenizeMaxLineLength,tokenizeMaxLength:null==e?void 0:e.tokenizeMaxLength,diffStyle:null==e?void 0:e.diffStyle,diffIndicators:null==e?void 0:e.diffIndicators,disableBackground:null==e?void 0:e.disableBackground,hunkSeparators:"function"==typeof(null==e?void 0:e.hunkSeparators)?"custom":null==e?void 0:e.hunkSeparators,expandUnchanged:null==e?void 0:e.expandUnchanged,collapsedContextThreshold:null==e?void 0:e.collapsedContextThreshold,lineDiffType:null==e?void 0:e.lineDiffType,maxLineDiffLength:null==e?void 0:e.maxLineDiffLength,expansionLineCount:null==e?void 0:e.expansionLineCount,headerRenderMode:null!=(null==e?void 0:e.renderCustomHeader)?"custom":"default"}}(e)}createHunksRenderer(e){return new Qu(this.getHunksRendererOptions(e),this.handleHighlightRender,this.workerManager)}setOptions(e){null!=e&&(this.options=e,this.cachedHeaderHTML=void 0,this.hunksRenderer.setOptions(this.getHunksRendererOptions(e)),this.syncInteractionOptions())}syncInteractionOptions(){var e;this.interactionManager.setOptions(en(this.options,"function"==typeof this.options.hunkSeparators||"line-info"===(null!=(e=this.options.hunkSeparators)?e:"line-info")||"line-info-basic"===this.options.hunkSeparators?this.handleExpandHunk:void 0,this.getLineIndex))}mergeOptions(e){this.options={...this.options,...e}}setThemeType(e){var t;(null!=(t=this.options.themeType)?t:"system")!==e&&(this.mergeOptions({themeType:e}),this.applyCachedThemeState(e))}applyCachedThemeState(e){var t;if("string"==typeof this.options.theme||null==this.fileContainer||null==this.appliedThemeCSS)return!1;const n=null!=(t=this.appliedThemeCSS.baseThemeType)?t:e;return this.appliedThemeCSS.themeType!==n&&(this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType),!0)}hasThemeChanged(){var e;return null!=this.appliedThemeCSS&&!ue(this.appliedThemeCSS.theme,null!=(e=this.options.theme)?e:G)}setLineAnnotations(e){this.lineAnnotations=e}canPartiallyRender(e,t,n){return!(e||t||n||"function"==typeof this.options.hunkSeparators)}setSelectedLines(e,t){this.interactionManager.setSelection(e,t)}flushManagers(){if(!this.managersDirty||null==this.pre)return void(this.managersDirty=!1);const{diffStyle:e="split",overflow:t="scroll"}=this.options;this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,"wrap"===t),"scroll"===t&&"split"===e?this.scrollSyncManager.setup(this.pre,this.codeDeletions,this.codeAdditions):this.scrollSyncManager.cleanUp(),this.managersDirty=!1}cleanUp(e=!1){var t,n;this.emitPostRender(!0),this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.managersDirty=!1,null==(t=this.workerManager)||t.unsubscribeToThemeChanges(this),this.renderRange=void 0,this.isContainerManaged||null==(n=this.fileContainer)||n.remove(),this.fileContainer=void 0,this.mounted=!1,e||(this.lineAnnotations=[]),this.clearAuxiliaryNodes(),this.annotationCache.clear(),this.pre=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,this.bufferBefore=void 0,this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.placeHolder=void 0,this.lastRenderedHeaderHTML=void 0,e||(this.cachedHeaderHTML=void 0),this.errorWrapper=void 0,this.spriteSVG=void 0,this.lastRowCount=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,e?this.hunksRenderer.recycle():(this.hunksRenderer.cleanUp(),this.workerManager=void 0,this.fileDiff=void 0,this.deletionFile=void 0,this.additionFile=void 0),this.enabled=!1}virtualizedSetup(){var e;this.enabled=!0,null==(e=this.workerManager)||e.subscribeToThemeChanges(this)}hydrate(e){const{fileContainer:t,prerenderedHTML:n,preventEmit:i=!1,lineAnnotations:r,oldFile:o,newFile:s,fileDiff:a}=e;this.hydrateElements(t,n),function(e,t,n=!1){return!n&&null==e&&t}(this.pre,function({fileDiff:e,oldFile:t,newFile:n}){return null!=e&&e.hunks.length>0||null!=t||null!=n}({fileDiff:a,oldFile:o,newFile:s}),this.options.collapsed)||function(e,t,n=!1){return null==e&&t&&!n}(this.headerElement,function({fileDiff:e,oldFile:t,newFile:n}){return null!=e||null!=t||null!=n}({fileDiff:a,oldFile:o,newFile:s}),this.options.disableFileHeader)?this.render({...e,preventEmit:!0}):this.hydrationSetup({fileDiff:a,oldFile:o,newFile:s,lineAnnotations:r}),i||this.emitPostRender()}hydrateElements(e,t){var n,i;this.fileContainer!==e&&this.emitPostRender(!0),kc(e,t);for(const r of null!=(i=null==(n=e.shadowRoot)?void 0:n.children)?i:[])if(r instanceof SVGElement)this.spriteSVG=r;else if(r instanceof HTMLElement)if(r instanceof HTMLPreElement){this.pre=r;for(const e of r.children)e instanceof HTMLElement&&"code"===e.tagName.toLowerCase()&&("deletions"in e.dataset&&(this.codeDeletions=e),"additions"in e.dataset&&(this.codeAdditions=e),"unified"in e.dataset&&(this.codeUnified=e))}else"diffsHeader"in r.dataset?this.headerElement=r:r instanceof HTMLStyleElement&&r.hasAttribute("data-theme-css")?this.themeCSSStyle=r:r instanceof HTMLStyleElement&&r.hasAttribute("data-unsafe-css")&&(this.unsafeCSSStyle=r,this.appliedUnsafeCSS=r.textContent);null!=this.pre&&(this.syncCodeNodesFromPre(this.pre),this.pre.removeAttribute("data-dehydrated")),this.fileContainer=e,this.hydrateMeasuredScrollbar()}hydrationSetup({fileDiff:e,oldFile:t,newFile:n,lineAnnotations:i}){this.lineAnnotations=null!=i?i:this.lineAnnotations,this.additionFile=n,this.deletionFile=t,this.fileDiff=null!=e?e:null!=t&&null!=n?ku(t,n,this.options.parseDiffOptions):void 0,null!=this.pre&&(this.syncInteractionOptions(),this.hunksRenderer.hydrate(this.fileDiff),this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}rerender(){!this.enabled||null==this.fileDiff&&null==this.additionFile&&null==this.deletionFile||this.render({forceRender:!0,renderRange:this.renderRange})}onThemeChange(){this.hunksRenderer.clearRenderCache(),this.rerender()}render({oldFile:e,newFile:t,fileDiff:n,deferManagers:i=!1,forceRender:r=!1,preventEmit:o=!1,lineAnnotations:s,fileContainer:a,containerWrapper:l,renderRange:d}){var c;if(!this.enabled)throw new Error("FileDiff.render: attempting to call render after cleaned up");const{collapsed:u=!1,themeType:h="system"}=this.options,f=u?void 0:d,p=this.hasThemeChanged(),m=!(null==e||null==t||id(e,this.deletionFile)&&id(t,this.additionFile));let g=null!=n&&n!==this.fileDiff;const v=null!=s&&(s.length>0||this.lineAnnotations.length>0)&&s!==this.lineAnnotations;if(!u&&rd(f,this.renderRange)&&!r&&!v&&!p&&(null!=n&&n===this.fileDiff||null==n&&!m))return this.applyCachedThemeState(h);const{renderRange:b}=this;if(this.renderRange=f,this.deletionFile=e,this.additionFile=t,null!=n?this.fileDiff=n:null!=e&&null!=t&&m&&(g=!0,this.fileDiff=ku(e,t,this.options.parseDiffOptions)),g&&(this.cachedHeaderHTML=void 0),null!=s&&this.setLineAnnotations(s),null==this.fileDiff)return!1;this.hunksRenderer.setOptions(this.getHunksRendererOptions(this.options)),this.syncInteractionOptions(),this.hunksRenderer.setLineAnnotations(this.lineAnnotations);const{disableErrorHandling:y=!1,disableFileHeader:C=!1}=this.options;if(C&&(null!=this.headerElement&&(this.headerElement.remove(),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0),this.clearHeaderSlots()),a=this.getOrCreateFileContainer(a,l),this.applyCachedThemeState(h),u){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{const e=this.hunksRenderer.renderDiff(this.fileDiff,re);null!=e&&this.applyThemeState(a,e.themeStyles,h,e.baseThemeType),null!=(null==e?void 0:e.headerElement)&&this.applyHeaderToDOM(e.headerElement,a),this.renderSeparators([]),this.injectUnsafeCSS()}catch(S){if(y)throw S;console.error(S),S instanceof Error&&this.applyErrorToDOM(S,a)}return o||this.emitPostRender(),!0}try{const e=this.getOrCreatePreNode(a);if(!this.canPartiallyRender(r,v,m||g||p)||!this.applyPartialRender({previousRenderRange:b,renderRange:f})){const t=this.hunksRenderer.renderDiff(this.fileDiff,f);if(null==t)return!1===(null==(c=this.workerManager)?void 0:c.isInitialized())&&this.workerManager.initialize().then(()=>this.rerender()),!1;this.applyThemeState(a,t.themeStyles,h,t.baseThemeType),null!=t.headerElement&&this.applyHeaderToDOM(t.headerElement,a),null!=t.additionsContentAST||null!=t.deletionsContentAST||null!=t.unifiedContentAST?this.applyHunksToDOM(e,t):null!=this.pre&&(this.pre.remove(),this.pre=void 0),this.renderSeparators(t.hunkData)}this.applyBuffers(e,f),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,i||this.flushManagers()}catch(S){if(y)throw S;console.error(S),S instanceof Error&&this.applyErrorToDOM(S,a)}return o||this.emitPostRender(),!0}emitPostRender(e=!1){var t,n;const{fileContainer:i,options:{onPostRender:r}}=this;if(e){if(!this.mounted)return;if(this.mounted=!1,null==i)return;return void(null==(n=(t=this.options).onPostRender)||n.call(t,i,this,"unmount"))}if(null==i)return;const o=this.mounted?"update":"mount";this.mounted=!0,null==r||r(i,this,o)}removeRenderedCode(){var e,t,n,i,r,o;this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),null==(e=this.bufferBefore)||e.remove(),this.bufferBefore=void 0,null==(t=this.bufferAfter)||t.remove(),this.bufferAfter=void 0,null==(n=this.codeUnified)||n.remove(),this.codeUnified=void 0,null==(i=this.codeDeletions)||i.remove(),this.codeDeletions=void 0,null==(r=this.codeAdditions)||r.remove(),this.codeAdditions=void 0,null==(o=this.pre)||o.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){var e;for(const{element:t}of this.separatorCache.values())t.remove();this.separatorCache.clear();for(const{element:t}of this.annotationCache.values())t.remove();this.annotationCache.clear(),null==(e=this.gutterUtilityContent)||e.remove(),this.gutterUtilityContent=void 0}renderPlaceholder(e){var t;if(null==this.fileContainer)return!1;if(this.emitPostRender(!0),this.cleanChildNodes(),null==this.placeHolder){const e=null!=(t=this.fileContainer.shadowRoot)?t:this.fileContainer.attachShadow({mode:"open"});this.placeHolder=document.createElement("div"),this.placeHolder.dataset.placeholder="",e.appendChild(this.placeHolder)}return this.placeHolder.style.setProperty("height",`${e}px`),!0}primeHighlightCache(){var e;const{fileDiff:t,workerManager:n}=this;if(null==t||null==n||Ku(t))return;const i=null!=(e=this.options.tokenizeMaxLength)?e:1e5;Math.max(t.additionLines.length,t.deletionLines.length)>i||n.primeDiffHighlightCache(t)}cleanChildNodes(){var e,t,n,i,r,o,s,a,l,d,c,u,h,f;this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.clearAuxiliaryNodes(),null==(e=this.bufferAfter)||e.remove(),null==(t=this.bufferBefore)||t.remove(),null==(n=this.codeAdditions)||n.remove(),null==(i=this.codeDeletions)||i.remove(),null==(r=this.codeUnified)||r.remove(),null==(o=this.errorWrapper)||o.remove(),null==(s=this.headerElement)||s.remove(),null==(a=this.headerPrefix)||a.remove(),null==(l=this.headerMetadata)||l.remove(),null==(d=this.headerCustom)||d.remove(),null==(c=this.pre)||c.remove(),null==(u=this.spriteSVG)||u.remove(),null==(h=this.themeCSSStyle)||h.remove(),null==(f=this.unsafeCSSStyle)||f.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.codeAdditions=void 0,this.codeDeletions=void 0,this.codeUnified=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.lastRenderedHeaderHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderSeparators(e){const{hunkSeparators:t}=this.options;if(this.isContainerManaged||null==this.fileContainer||"function"!=typeof t){for(const{element:e}of this.separatorCache.values())e.remove();return void this.separatorCache.clear()}const n=new Map(this.separatorCache);for(const i of e){const e=i.slotName;let r=this.separatorCache.get(e);if(null==r||!ah(i,r.hunkData)){null==r||r.element.remove();const n=document.createElement("div");n.style.display="contents",n.slot=i.slotName;const o=t(i,this);null!=o&&n.appendChild(o),this.fileContainer.appendChild(n),r={element:n,hunkData:i},this.separatorCache.set(e,r)}n.delete(e)}for(const[i,{element:r}]of n.entries())this.separatorCache.delete(i),r.remove()}renderAnnotations(){if(this.isContainerManaged||null==this.fileContainer){for(const{element:e}of this.annotationCache.values())e.remove();return void this.annotationCache.clear()}const e=new Map(this.annotationCache),{renderAnnotation:t}=this.options;if(null!=t&&this.lineAnnotations.length>0)for(const[n,i]of this.lineAnnotations.entries()){const r=`${n}-${Sd(i)}`;let o=this.annotationCache.get(r);if(null==o||!sh(i,o.annotation)){null==o||o.element.remove();const e=t(i);if(null==e)continue;o={element:ac(Sd(i)),annotation:i},o.element.appendChild(e),this.fileContainer.appendChild(o.element),this.annotationCache.set(r,o)}e.delete(r)}for(const[n,{element:i}]of e.entries())this.annotationCache.delete(n),i.remove()}renderGutterUtility(){var e,t;const{renderGutterUtility:n}=this.options;if(null==this.fileContainer||null==n)return null==(e=this.gutterUtilityContent)||e.remove(),void(this.gutterUtilityContent=void 0);const i=n(this.interactionManager.getHoveredLine);if(null!=i&&null!=this.gutterUtilityContent)return;if(null==i)return null==(t=this.gutterUtilityContent)||t.remove(),void(this.gutterUtilityContent=void 0);const r=lc();r.appendChild(i),this.fileContainer.appendChild(r),this.gutterUtilityContent=r}getOrCreateFileContainer(e,t){var n;const{fileContainer:i}=this,r=null!=(n=null!=e?e:i)?n:document.createElement("diffs-container"),o=i!==r;return o&&this.emitPostRender(!0),this.fileContainer=r,null!=i&&o&&(this.lastRenderedHeaderHTML=void 0,this.headerElement=void 0),null!=t&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),o&&this.adoptReusableShellElements(this.fileContainer),this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(e){var t;const{shadowRoot:n}=e;if(null!=n)for(const i of n.children)i instanceof SVGElement?null!=this.spriteSVG||(this.spriteSVG=i):wc(i)&&i.hasAttribute("data-theme-css")?(null!=this.themeCSSStyle||(this.themeCSSStyle=i),this.hasAdoptedThemeCSS=!0):wc(i)&&i.hasAttribute("data-unsafe-css")&&(null!=this.unsafeCSSStyle||(this.unsafeCSSStyle=i),null!=this.appliedUnsafeCSS||(this.appliedUnsafeCSS=null!=(t=this.options.unsafeCSS)?t:void 0))}ensureSpriteSVG(e){var t;const n=null!=(t=e.shadowRoot)?t:e.attachShadow({mode:"open"});if(null==this.spriteSVG){const e=document.createElement("div");e.innerHTML=ic;const t=e.firstChild;t instanceof SVGElement&&(this.spriteSVG=t)}null!=this.spriteSVG&&this.spriteSVG.parentNode!==n&&n.appendChild(this.spriteSVG)}getOrCreatePreNode(e){var t,n;const i=null!=(t=e.shadowRoot)?t:e.attachShadow({mode:"open"});return null==this.pre?(this.pre=document.createElement("pre"),this.appliedPreAttributes=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,i.appendChild(this.pre)):this.pre.parentNode!==i&&(i.appendChild(this.pre),this.appliedPreAttributes=void 0),null==(n=this.placeHolder)||n.remove(),this.placeHolder=void 0,this.pre}syncCodeNodesFromPre(e){this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0;for(const t of Array.from(e.children))t instanceof HTMLElement&&(t.hasAttribute("data-unified")?this.codeUnified=t:t.hasAttribute("data-deletions")?this.codeDeletions=t:t.hasAttribute("data-additions")&&(this.codeAdditions=t))}applyHeaderToDOM(e,t){var n,i,r,o,s,a,l,d,c,u;this.cleanupErrorWrapper(),null==(n=this.placeHolder)||n.remove(),this.placeHolder=void 0;const{fileDiff:h}=this,f=null!=(i=this.cachedHeaderHTML)?i:Qt(e);if(this.cachedHeaderHTML=f,f!==this.lastRenderedHeaderHTML){const e=document.createElement("div");e.innerHTML=f;const n=e.firstElementChild;if(!(n instanceof HTMLElement))return;null!=this.headerElement?null==(r=t.shadowRoot)||r.replaceChild(n,this.headerElement):null==(o=t.shadowRoot)||o.prepend(n),this.headerElement=n,this.lastRenderedHeaderHTML=f}if(this.isContainerManaged||null==h)return;const{renderCustomHeader:p,renderHeaderPrefix:m,renderHeaderMetadata:g}=this.options;if(null!=p){const e=null!=(s=p(h))?s:void 0;return this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,U,e),null==(a=this.headerPrefix)||a.remove(),null==(l=this.headerMetadata)||l.remove(),this.headerPrefix=void 0,void(this.headerMetadata=void 0)}const v=null!=(d=null==m?void 0:m(h))?d:void 0,b=null!=(c=null==g?void 0:g(h))?c:void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,$,v),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,z,b),null==(u=this.headerCustom)||u.remove(),this.headerCustom=void 0}clearHeaderSlots(){var e,t,n;null==(e=this.headerPrefix)||e.remove(),null==(t=this.headerMetadata)||t.remove(),null==(n=this.headerCustom)||n.remove(),this.headerPrefix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,n,i){if(null==i)return void(null==t||t.remove());const r=null!=t?t:this.createHeaderSlotElement(n);return null==t&&e.appendChild(r),this.replaceHeaderSlotContent(r,i),r}replaceHeaderSlotContent(e,t){e.replaceChildren(),t instanceof Element?e.appendChild(t):e.innerText=`${t}`}createHeaderSlotElement(e){const t=document.createElement("div");return t.slot=e,t}injectUnsafeCSS(){var e,t;const{unsafeCSS:n}=this.options,i=null==(e=this.fileContainer)?void 0:e.shadowRoot;if(null!=i)return null==n||""===n?(null!=this.unsafeCSSStyle&&(this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0),void(this.appliedUnsafeCSS=void 0)):void((null==(t=this.unsafeCSSStyle)?void 0:t.parentNode)===i&&this.appliedUnsafeCSS===n||(null!=this.unsafeCSSStyle||(this.unsafeCSSStyle=dc()),this.unsafeCSSStyle.parentNode!==i&&i.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=bc(n),this.appliedUnsafeCSS=n))}applyThemeState(e,t,n,i){var r,o,s,a,l;const d=null!=(r=e.shadowRoot)?r:e.attachShadow({mode:"open"}),c=null!=i?i:n,u=null!=(o=this.options.theme)?o:G,h="string"==typeof u?u:{...u},f=hc(d);if((null==(s=this.themeCSSStyle)?void 0:s.parentNode)!==d||(null==(a=this.appliedThemeCSS)?void 0:a.themeStyles)!==t||this.appliedThemeCSS.themeType!==c||this.appliedThemeCSS.scrollbarGutter!==f){if(this.hasAdoptedThemeCSS&&(null==(l=this.themeCSSStyle)?void 0:l.parentNode)===d)return this.hasAdoptedThemeCSS=!1,void(this.appliedThemeCSS={theme:h,themeStyles:t,themeType:c,baseThemeType:i,scrollbarGutter:f});this.themeCSSStyle=Tc({shadowRoot:d,currentNode:this.themeCSSStyle,themeCSS:yc(t,c,f)}),this.appliedThemeCSS=null!=this.themeCSSStyle?{theme:h,themeStyles:t,themeType:c,baseThemeType:i,scrollbarGutter:f}:void 0}else this.appliedThemeCSS.theme=h}hydrateMeasuredScrollbar(){var e,t;const n=null==(e=this.fileContainer)?void 0:e.shadowRoot;null!=n&&null!=this.themeCSSStyle&&(this.themeCSSStyle.textContent=Cc(null!=(t=this.themeCSSStyle.textContent)?t:"",hc(n)))}applyHunksToDOM(e,t){var n,i,r,o,s,a,l,d,c,u;const{overflow:h="scroll"}=this.options,f="line-info"===(null!=(n=this.options.hunkSeparators)?n:"line-info"),p="wrap"===h?t.rowCount:void 0;this.cleanupErrorWrapper(),this.applyPreNodeAttributes(e,t);let m=!1;const g=[],v=this.hunksRenderer.renderCodeAST("unified",t),b=this.hunksRenderer.renderCodeAST("deletions",t),y=this.hunksRenderer.renderCodeAST("additions",t);null!=v?(m=null==this.codeUnified||null!=this.codeAdditions||null!=this.codeDeletions,null==(i=this.codeDeletions)||i.remove(),this.codeDeletions=void 0,null==(r=this.codeAdditions)||r.remove(),this.codeAdditions=void 0,this.codeUnified=Sc({code:this.codeUnified,columnType:"unified",rowSpan:p,containerSize:f}),this.codeUnified.innerHTML=this.hunksRenderer.renderPartialHTML(v),g.push(this.codeUnified)):null!=b||null!=y?(null!=b?(m=null==this.codeDeletions||null!=this.codeUnified,null==(o=this.codeUnified)||o.remove(),this.codeUnified=void 0,this.codeDeletions=Sc({code:this.codeDeletions,columnType:"deletions",rowSpan:p,containerSize:f}),this.codeDeletions.innerHTML=this.hunksRenderer.renderPartialHTML(b),g.push(this.codeDeletions)):(null==(s=this.codeDeletions)||s.remove(),this.codeDeletions=void 0),null!=y?(m=m||null==this.codeAdditions||null!=this.codeUnified,null==(a=this.codeUnified)||a.remove(),this.codeUnified=void 0,this.codeAdditions=Sc({code:this.codeAdditions,columnType:"additions",rowSpan:p,containerSize:f}),this.codeAdditions.innerHTML=this.hunksRenderer.renderPartialHTML(y),g.push(this.codeAdditions)):(null==(l=this.codeAdditions)||l.remove(),this.codeAdditions=void 0)):(null==(d=this.codeUnified)||d.remove(),this.codeUnified=void 0,null==(c=this.codeDeletions)||c.remove(),this.codeDeletions=void 0,null==(u=this.codeAdditions)||u.remove(),this.codeAdditions=void 0),0===g.length?e.textContent="":m&&e.replaceChildren(...g),this.lastRowCount=t.rowCount}applyPartialRender({previousRenderRange:e,renderRange:t}){const{pre:n,codeUnified:i,codeAdditions:r,codeDeletions:o,options:{diffStyle:s="split"}}=this;if(null==n||null==e||null==t||!Number.isFinite(e.totalLines)||!Number.isFinite(t.totalLines)||null==this.lastRowCount)return!1;const a=this.getCodeColumns(s,i,o,r);if(null==a)return!1;const l=e.startingLine,d=t.startingLine,c=l+e.totalLines,u=d+t.totalLines,h=Math.max(l,d),f=Math.min(c,u);if(f<=h)return!1;const p=Math.max(0,h-l),m=Math.max(0,c-f),g=this.trimColumns({columns:a,trimStart:p,trimEnd:m,previousStart:l,overlapStart:h,overlapEnd:f,diffStyle:s});if(g<0)throw new Error("applyPartialRender: failed to trim to overlap");if(this.lastRowCount<g)throw new Error("applyPartialRender: trimmed beyond DOM row count");let v=this.lastRowCount-g;const b=(e,t)=>{if(!(t<=0||null==this.fileDiff))return this.hunksRenderer.renderDiff(this.fileDiff,{startingLine:e,totalLines:t,bufferBefore:0,bufferAfter:0})},y=b(d,Math.max(h-d,0));if(null==y&&d<h)return!1;const C=b(f,Math.max(u-f,0));if(null==C&&u>f)return!1;const S=(e,t)=>{if(null!=e){if("unified"!==s||Array.isArray(a)){if("split"!==s||!Array.isArray(a))throw new Error("FileDiff.applyPartialRender.applyChunk: invalid chunk application");this.insertPartialHTML(s,a,e,t)}else this.insertPartialHTML(s,a,e,t);v+=e.rowCount}};return this.cleanupErrorWrapper(),S(y,"afterbegin"),S(C,"beforeend"),this.lastRowCount!==v&&(this.applyRowSpan(s,a,v),this.lastRowCount=v),!0}insertPartialHTML(e,t,n,i){if("unified"!==e||Array.isArray(t)){if("split"!==e||!Array.isArray(t))throw new Error("FileDiff.insertPartialHTML: Invalid argument composition");{const e=this.hunksRenderer.renderCodeAST("deletions",n),r=this.hunksRenderer.renderCodeAST("additions",n);this.renderPartialColumn(t[0],e,i),this.renderPartialColumn(t[1],r,i)}}else{const e=this.hunksRenderer.renderCodeAST("unified",n);this.renderPartialColumn(t,e,i)}}renderPartialColumn(e,t,n){if(null==e||null==t)return;const i=ch(t[0]),r=ch(t[1]);if(null==i||null==r)throw new Error("FileDiff.insertPartialHTML: Unexpected AST structure");const o=r.at(0);"beforeend"===n&&"element"===(null==o?void 0:o.type)&&"number"==typeof o.properties["data-buffer-size"]&&this.mergeBuffersIfNecessary(o.properties["data-buffer-size"],e.content.children[e.content.children.length-1],e.gutter.children[e.gutter.children.length-1],i,r,!0);const s=r.at(-1);"afterbegin"===n&&"element"===(null==s?void 0:s.type)&&"number"==typeof s.properties["data-buffer-size"]&&this.mergeBuffersIfNecessary(s.properties["data-buffer-size"],e.content.children[0],e.gutter.children[0],i,r,!1),e.gutter.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(i)),e.content.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(r))}mergeBuffersIfNecessary(e,t,n,i,r,o){if(!(t instanceof HTMLElement&&n instanceof HTMLElement))return;const s=this.getBufferSize(t.dataset);null!=s&&(o?(i.shift(),r.shift()):(i.pop(),r.pop()),this.updateBufferSize(t,s+e),this.updateBufferSize(n,s+e))}applyRowSpan(e,t,n){const i=e=>{null!=e&&(e.gutter.style.setProperty("grid-row",`span ${n}`),e.content.style.setProperty("grid-row",`span ${n}`))};if("unified"!==e||Array.isArray(t)){if("split"!==e||!Array.isArray(t))throw new Error("dun fuuuuked up");i(t[0]),i(t[1])}else i(t)}trimColumnRows(e,t,n){let i=0,r=0,o=0,s=!1;const a=n>=0;if(null==e)return 0;const l=Array.from(e.content.children),d=Array.from(e.gutter.children);if(l.length!==d.length)throw new Error("FileDiff.trimColumnRows: columns do not match");for(;o<l.length&&(!(t<=0)||a||s);){const e=d[o],c=l[o];if(o++,!(e instanceof HTMLElement&&c instanceof HTMLElement))throw console.error({gutterElement:e,contentElement:c}),new Error("FileDiff.trimColumnRows: invalid row elements");if(s&&(s=!1,"annotation"===e.dataset.gutterBuffer&&"lineAnnotation"in c.dataset||"metadata"===e.dataset.gutterBuffer&&"noNewline"in c.dataset))e.remove(),c.remove(),r++;else if("lineIndex"in e.dataset&&"lineIndex"in c.dataset)(t>0||a&&i>=n)&&(e.remove(),c.remove(),t>0&&0===--t&&(s=!0),r++),i++;else if("separator"in e.dataset&&"separator"in c.dataset)(t>0||a&&i>=n)&&(e.remove(),c.remove(),r++);else if("annotation"===e.dataset.gutterBuffer&&"lineAnnotation"in c.dataset)(t>0||a&&i>=n)&&(e.remove(),c.remove(),r++);else{if("metadata"!==e.dataset.gutterBuffer||!("noNewline"in c.dataset)){if("buffer"===e.dataset.gutterBuffer&&"contentBuffer"in c.dataset){const o=this.getBufferSize(c.dataset);if(null==o)throw new Error("FileDiff.trimColumnRows: invalid element");if(t>0){const n=Math.min(t,o),i=o-n;i>0?(this.updateBufferSize(e,i),this.updateBufferSize(c,i),r+=n):(e.remove(),c.remove(),r+=o),0===(t-=n)&&0===i&&(s=!0)}else if(a){const t=i+o-1;if(n<=i)e.remove(),c.remove(),r+=o;else if(n<=t){const i=t-n+1,s=o-i;this.updateBufferSize(e,s),this.updateBufferSize(c,s),r+=i}}i+=o;continue}throw console.error({gutterElement:e,contentElement:c}),new Error("FileDiff.trimColumnRows: unknown row elements")}(t>0||a&&i>=n)&&(e.remove(),c.remove(),r++)}}return r}trimColumns({columns:e,diffStyle:t,overlapEnd:n,overlapStart:i,previousStart:r,trimEnd:o,trimStart:s}){const a=Math.max(0,i-r),l=n-r;if(l<0)throw new Error("FileDiff.trimColumns: overlap ends before previous");const d=s>0,c=o>0;if(!d&&!c)return 0;const u=d?a:0,h=c?l:-1;if("unified"!==t||Array.isArray(e)){if("split"===t&&Array.isArray(e)){const t=this.trimColumnRows(e[0],u,h),n=this.trimColumnRows(e[1],u,h);if(null!=e[0]&&null!=e[1]&&t!==n)throw new Error("FileDiff.trimColumns: split columns out of sync");return null!=e[0]?t:n}throw console.error({diffStyle:t,columns:e}),new Error("FileDiff.trimColumns: Invalid columns for diffType")}return this.trimColumnRows(e,u,h)}getBufferSize(e){var t;const n=Number.parseInt(null!=(t=null==e?void 0:e.bufferSize)?t:"",10);return Number.isNaN(n)?void 0:n}updateBufferSize(e,t){e.dataset.bufferSize=`${t}`,e.style.setProperty("grid-row",`span ${t}`),e.style.setProperty("min-height",`calc(${t} * 1lh)`)}getCodeColumns(e,t,n,i){function r(e){if(null==e)return;const t=e.children[0],n=e.children[1];return t instanceof HTMLElement&&n instanceof HTMLElement&&null!=t.dataset.gutter&&null!=n.dataset.content?{gutter:t,content:n}:void 0}if("unified"===e)return r(t);{const e=r(n),t=r(i);return null!=e||null!=t?[e,t]:void 0}}applyBuffers(e,t){if(null==t||this.shouldDisableVirtualizationBuffers())return null!=this.bufferBefore&&(this.bufferBefore.remove(),this.bufferBefore=void 0),void(null!=this.bufferAfter&&(this.bufferAfter.remove(),this.bufferAfter=void 0));t.bufferBefore>0?(null==this.bufferBefore&&(this.bufferBefore=document.createElement("div"),this.bufferBefore.dataset.virtualizerBuffer="before",e.before(this.bufferBefore)),this.bufferBefore.style.setProperty("height",`${t.bufferBefore}px`),this.bufferBefore.style.setProperty("contain","strict")):null!=this.bufferBefore&&(this.bufferBefore.remove(),this.bufferBefore=void 0),t.bufferAfter>0?(null==this.bufferAfter&&(this.bufferAfter=document.createElement("div"),this.bufferAfter.dataset.virtualizerBuffer="after",e.after(this.bufferAfter)),this.bufferAfter.style.setProperty("height",`${t.bufferAfter}px`),this.bufferAfter.style.setProperty("contain","strict")):null!=this.bufferAfter&&(this.bufferAfter.remove(),this.bufferAfter=void 0)}shouldDisableVirtualizationBuffers(){var e;return null!=(e=this.options.disableVirtualizationBuffers)&&e}applyPreNodeAttributes(e,{additionsContentAST:t,deletionsContentAST:n,totalLines:i},r){const{diffIndicators:o="bars",disableBackground:s=!1,disableLineNumbers:a=!1,overflow:l="scroll",diffStyle:d="split"}=this.options,c={type:"diff",diffIndicators:o,disableBackground:s,disableLineNumbers:a,overflow:l,split:"unified"!==d&&null!=t&&null!=n,totalLines:i,customProperties:r};oc(c,this.appliedPreAttributes)||(xc(e,c),this.appliedPreAttributes=c)}applyErrorToDOM(e,t){var n,i,r;this.cleanupErrorWrapper(),null==(n=this.pre)||n.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;const o=null!=(i=t.shadowRoot)?i:t.attachShadow({mode:"open"});null!=this.errorWrapper||(this.errorWrapper=document.createElement("div")),this.errorWrapper.dataset.errorWrapper="",this.errorWrapper.textContent="",o.appendChild(this.errorWrapper);const s=document.createElement("div");s.dataset.errorMessage="",s.innerText=e.message,this.errorWrapper.appendChild(s);const a=document.createElement("pre");a.dataset.errorStack="",a.innerText=null!=(r=e.stack)?r:"No Error Stack",this.errorWrapper.appendChild(a)}cleanupErrorWrapper(){var e;null==(e=this.errorWrapper)||e.remove(),this.errorWrapper=void 0}},y(h,"LoadedCustomComponent",!0),h);function ch(e){var t;if(null!=e&&"element"===e.type)return null!=(t=e.children)?t:[]}function uh(e){if(!e.noEOFCRAdditions&&!e.noEOFCRDeletions)return{split:0,unified:0};const t=e.hunkContent.at(-1);if(null==t)return{split:0,unified:0};if("context"===t.type){const e=t.lines>0?1:0;return{split:e,unified:e}}return function(e,t){const n=(t.deletions>0&&e.noEOFCRDeletions?1:0)+(t.additions>0&&e.noEOFCRAdditions?1:0),i=t.deletions>0&&e.noEOFCRDeletions,r=t.additions>0&&e.noEOFCRAdditions;return{split:i||r?1:0,unified:n}}(e,t)}const hh=5e3;let fh=-1;var ph=class extends dh{constructor(e,t,n,i,r=!1){super(e,i,r),y(this,"__id","little-virtualized-file-diff:"+ ++fh),y(this,"top"),y(this,"height",0),y(this,"metrics"),y(this,"cache",{heightDeltas:/* @__PURE__ */new Map,measuredHeightDeltaTotal:0,estimatedSplitHeight:void 0,estimatedUnifiedHeight:void 0,checkpoints:[],totalLines:0,fileAnnotationHeight:0}),y(this,"isVisible",!1),y(this,"isSetup",!1),y(this,"virtualizer"),y(this,"layoutDirty",!0),y(this,"forceRenderOverride"),y(this,"currentCollapsed"),y(this,"onRender",e=>null!=this.fileContainer&&(e&&(this.top=this.getVirtualizedTop()),this.render())),y(this,"expandHunk",(e,t,n)=>{this.hunksRenderer.expandHunk(e,t,n),this.forceRenderOverride=!0,this.resetLayoutCache({includeEstimatedHeights:!0}),this.isSimpleMode()&&this.computeApproximateSize(),this.virtualizer.instanceChanged(this,!0)}),this.virtualizer=t,this.metrics=Mc(n)}setMetrics(e,t=!1){const n=Mc(e);!t&&ce(this.metrics,n)||(this.metrics=n,this.resetLayoutCache({includeEstimatedHeights:!0}))}setLineAnnotations(e){this.syncLineAnnotations(e)&&this.resetLayoutCache({includeEstimatedHeights:!1})}syncLineAnnotations(e){return null!=e&&e!==this.lineAnnotations&&(0!==e.length||0!==this.lineAnnotations.length)&&(super.setLineAnnotations(e),!0)}setFileAnnotationHeight(e){const t=this.cache.fileAnnotationHeight;return e!==t&&(this.cache.fileAnnotationHeight=e,this.cache.measuredHeightDeltaTotal+=e-t,!0)}hasFileAnnotations(e=this.fileDiff){return!(null==e||!Kd(this.lineAnnotations))&&this.lineAnnotations.some(t=>0===t.lineNumber&&("new"===e.type?"additions"===t.side:"deleted"!==e.type||"deletions"===t.side))}getLineHeight(e,t=!1){var n;return this.getEstimatedLineHeight(t)+(null!=(n=this.cache.heightDeltas.get(e))?n:0)}getEstimatedLineHeight(e=!1){const t=e?2:1;return this.metrics.lineHeight*t}setOptions(e){if(this.isAdvancedMode())throw new Error("VirtualizedFileDiff.setOptions cannot be used inside CodeView. Update CodeView options instead.");if(null==e)return;const{options:t}=this,n=!he(t,e),i=n&&function(e,t){var n,i,r,o,s,a,l,d,c,u,h,f,p,m,g,v,b,y;return(null!=(n=e.diffStyle)?n:"split")!==(null!=(i=t.diffStyle)?i:"split")||(null!=(r=e.overflow)?r:"scroll")!==(null!=(o=t.overflow)?o:"scroll")||(null!=(s=e.collapsed)&&s)!==(null!=(a=t.collapsed)&&a)||(null!=(l=e.disableLineNumbers)&&l)!==(null!=(d=t.disableLineNumbers)&&d)||(null!=(c=e.disableFileHeader)&&c)!==(null!=(u=t.disableFileHeader)&&u)||(null!=(h=e.diffIndicators)?h:"bars")!==(null!=(f=t.diffIndicators)?f:"bars")||(null!=(p=e.hunkSeparators)?p:"line-info")!==(null!=(m=t.hunkSeparators)?m:"line-info")||(null!=(g=e.expandUnchanged)&&g)!==(null!=(v=t.expandUnchanged)&&v)||(null!=(b=e.collapsedContextThreshold)?b:1)!==(null!=(y=t.collapsedContextThreshold)?y:1)||e.unsafeCSS!==t.unsafeCSS}(t,e);super.setOptions(e),i&&this.resetLayoutCache({forceSimpleRecompute:!0,includeEstimatedHeights:yh(t,e)}),n&&(this.forceRenderOverride=!0),n&&this.isSimpleMode()&&this.virtualizer.instanceChanged(this,i)}setThemeType(e){if(this.isAdvancedMode())throw new Error("VirtualizedFileDiff.setThemeType cannot be used inside CodeView. Update CodeView options instead.");super.setThemeType(e)}resetLayoutCache({forceSimpleRecompute:e=!1,includeEstimatedHeights:t=!1}={}){this.layoutDirty=!0,this.cache.fileAnnotationHeight=0,this.cache.heightDeltas.size>0&&this.cache.heightDeltas.clear(),0!==this.cache.measuredHeightDeltaTotal&&(this.cache.measuredHeightDeltaTotal=0),this.cache.checkpoints.length>0&&(this.cache.checkpoints.length=0),0!==this.cache.totalLines&&(this.cache.totalLines=0),t&&(this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0),null!=this.renderRange&&(this.renderRange=void 0),e&&this.isSimpleMode()&&this.computeApproximateSize()}reconcileHeights(){var e,t;let n=!1;const{overflow:i="scroll"}=this.options;if(null==this.fileContainer||null==this.fileDiff)return 0!==this.height&&(n=!0),this.height=0,n;if(this.top=this.getVirtualizedTop(),"scroll"===i&&0===this.lineAnnotations.length&&!this.isResizeDebuggingEnabled())return n;const r=this.getDiffStyle(),o="split"===r?[this.codeDeletions,this.codeAdditions]:[this.codeUnified],s=this.hasFileAnnotations(this.fileDiff);if(null!=this.renderRange&&s&&Qd(this.renderRange)){const t=null!=(e=function(e){let t;for(const n of e){if(null==n)continue;const e=n.children[1];if(e instanceof HTMLElement)for(const n of e.children)n instanceof HTMLElement&&n.dataset.lineAnnotation===qd&&(t=Math.max(null!=t?t:0,n.getBoundingClientRect().height))}return t}(o))?e:0;this.setFileAnnotationHeight(t)&&(n=!0)}else!s&&this.setFileAnnotationHeight(0)&&(n=!0);for(const a of o){if(null==a)continue;const e=a.children[1];if(e instanceof HTMLElement)for(const i of e.children){if(!(i instanceof HTMLElement))continue;const e=i.dataset.lineIndex;if(null==e)continue;const o=Ch(e,r);let s=i.getBoundingClientRect().height,a=!1;i.nextElementSibling instanceof HTMLElement&&("lineAnnotation"in i.nextElementSibling.dataset||"noNewline"in i.nextElementSibling.dataset)&&("noNewline"in i.nextElementSibling.dataset&&(a=!0),s+=i.nextElementSibling.getBoundingClientRect().height);const l=this.getEstimatedLineHeight(a),d=null!=(t=this.cache.heightDeltas.get(o))?t:0,c=s-l;c!==d&&(n=!0,this.cache.measuredHeightDeltaTotal+=c-d,0===c?this.cache.heightDeltas.delete(o):this.cache.heightDeltas.set(o,c))}}return(n||this.isResizeDebuggingEnabled())&&this.computeApproximateSize(!0),n}prepareCodeViewItem(e,t,n,i){const r=!_c(this.fileDiff,e),o=this.syncLineAnnotations(i);let s=!0===(null==n?void 0:n.resetDiffLayoutCache)||r||o,a=r||!0===(null==n?void 0:n.resetDiffLayoutCache)&&n.includeEstimatedDiffHeights;null!=(null==n?void 0:n.metrics)&&(this.metrics=Mc(n.metrics),s=!0,a=!0);const{collapsed:l=!1}=this.options;return this.currentCollapsed!==l&&(this.currentCollapsed=l,s=!0),s&&this.resetLayoutCache({includeEstimatedHeights:a}),this.fileDiff=e,this.top=t,this.computeApproximateSize(),this.height}getLinePosition(e,t="additions"){var n,i;if(null==this.fileDiff||e<1)return;const r=this.getLineIndex(e,t);if(null==r)return;const{disableFileHeader:o=!1,expandUnchanged:s=!1,collapsed:a=!1,collapsedContextThreshold:l=1}=this.options,d=this.getDiffStyle(),c=this.getHunkSeparatorType(),u="split"===d?r[1]:r[0];this.approximateLayoutCheckpoints();const h=Rc(this.metrics,o),f=this.getLayoutCheckpointBeforeLineIndex(u);let p,m=null!=(n=null==f?void 0:f.top)?n:h+this.cache.fileAnnotationHeight;return a?{top:h,height:0}:($u({diff:this.fileDiff,diffStyle:d,startingLine:null!=(i=null==f?void 0:f.renderedLineIndex)?i:0,expandedHunks:!!s||this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:l,callback:({hunkIndex:e,hunk:t,collapsedBefore:n,collapsedAfter:i,deletionLine:r,additionLine:o})=>{var s,a,l,h;const f="split"===d?null!=(s=null==o?void 0:o.splitLineIndex)?s:null==r?void 0:r.splitLineIndex:null!=(a=null==o?void 0:o.unifiedLineIndex)?a:null==r?void 0:r.unifiedLineIndex;if(null==f)throw new Error("VirtualizedFileDiff.getLinePosition: missing line index data");if(n>0){const i=Fu({type:c,metrics:this.metrics,hunkIndex:e,hunkSpecs:null==t?void 0:t.hunkSpecs});if(null!=i){if(m+=i.gapBefore,u>=f-n&&u<f)return p={top:m,height:i.height},!0;m+=i.height+i.gapAfter}}const g=this.getLineHeight(f,null!=(l=null==o?void 0:o.noEOFCR)&&l||null!=(h=null==r?void 0:r.noEOFCR)&&h);if(f===u)return p={top:m,height:g},!0;if(m+=g,i>0){const e=Bu({type:c,metrics:this.metrics});if(null!=e){if(u>f&&u<=f+i)return p={top:m+e.gapBefore,height:e.height},!0;m+=e.totalHeight}}return!1}}),p)}getNumericScrollAnchor(e){var t,n;if(null==this.fileDiff)return;const{disableFileHeader:i=!1,expandUnchanged:r=!1,collapsed:o=!1,collapsedContextThreshold:s=1}=this.options;if(o)return;const a=this.getDiffStyle(),l=this.getHunkSeparatorType();this.approximateLayoutCheckpoints();const d=this.getLayoutCheckpointBeforeTop(e);let c,u=null!=(t=null==d?void 0:d.top)?t:Rc(this.metrics,i)+this.cache.fileAnnotationHeight;return $u({diff:this.fileDiff,diffStyle:a,startingLine:null!=(n=null==d?void 0:d.renderedLineIndex)?n:0,expandedHunks:!!r||this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:s,callback:({hunkIndex:t,hunk:n,collapsedBefore:i,collapsedAfter:r,deletionLine:o,additionLine:s})=>{var d,h,f,p;const m="split"===a?null!=(d=null==s?void 0:s.splitLineIndex)?d:null==o?void 0:o.splitLineIndex:null!=(h=null==s?void 0:s.unifiedLineIndex)?h:null==o?void 0:o.unifiedLineIndex;if(null==m)throw new Error("VirtualizedFileDiff.getNumericScrollAnchor: missing line index data");if(i>0){const e=Fu({type:l,metrics:this.metrics,hunkIndex:t,hunkSpecs:null==n?void 0:n.hunkSpecs});null!=e&&(u+=e.totalHeight)}if(u>=e&&(null!=o?c={lineNumber:o.lineNumber,side:"deletions",top:u}:null!=s&&(c={lineNumber:s.lineNumber,side:"additions",top:u}),null!=c))return!0;const g=this.getLineHeight(m,null!=(f=null==s?void 0:s.noEOFCR)&&f||null!=(p=null==o?void 0:o.noEOFCR)&&p);if(u+=g,r>0){const e=Bu({type:l,metrics:this.metrics});null!=e&&(u+=e.totalHeight)}return!1}}),c}getVirtualizedHeight(){return this.height}getAdvancedStickySpecs(e){if(null==this.top||null==this.fileDiff)return;if(!0===this.options.collapsed)return{topOffset:this.top,height:this.height};const t=null!=e?this.computeRenderRangeFromWindow(this.fileDiff,this.top,e):this.renderRange;if(null==t)return;const{bufferBefore:n,bufferAfter:i,totalLines:r}=t;let o=0;if(0===r){const t=null!=e?e:this.virtualizer.getWindowSpecs();this.top<t.top&&(o=i)}return{topOffset:this.top+n+o,height:this.height-(n+i)}}cleanUp(e=!1){var t;null!=this.fileContainer&&this.isSimpleMode()&&(null==(t=this.getSimpleVirtualizer())||t.disconnect(this.fileContainer)),e||this.resetLayoutCache({includeEstimatedHeights:!0}),this.isSetup=!1,super.cleanUp(e)}setVisibility(e){this.isAdvancedMode()||null==this.fileContainer||(this.renderRange=void 0,e&&!this.isVisible?(this.top=this.getVirtualizedTop(),this.isVisible=!0):!e&&this.isVisible&&(this.isVisible=!1,this.rerender()))}rerender(){!this.enabled||null==this.fileDiff&&null==this.additionFile&&null==this.deletionFile||(this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!1))}computeApproximateSize(e=!1){const t=this.isResizeDebuggingEnabled();if(!e&&!this.layoutDirty&&!t)return;const n=0===this.height;if(this.height=0,this.cache.checkpoints=[],this.cache.totalLines=0,null==this.fileDiff)return void(this.layoutDirty=!1);const{disableFileHeader:i=!1,collapsed:r=!1}=this.options,o=Rc(this.metrics,i);this.height+=o,r||(this.height=this.getActiveEstimatedHeight()+this.cache.measuredHeightDeltaTotal,t&&!n&&this.validateComputedHeight()),this.layoutDirty=!1}getActiveEstimatedHeight(){this.ensureEstimatedDiffHeights();const e="split"===this.getDiffStyle()?this.cache.estimatedSplitHeight:this.cache.estimatedUnifiedHeight;if(null==e)throw new Error("VirtualizedFileDiff.getActiveEstimatedHeight: missing estimated height");return e}ensureEstimatedDiffHeights(){if(null==this.fileDiff)return this.cache.estimatedSplitHeight=void 0,void(this.cache.estimatedUnifiedHeight=void 0);if(null!=this.cache.estimatedSplitHeight&&null!=this.cache.estimatedUnifiedHeight)return;const{disableFileHeader:e=!1,expandUnchanged:t=!1,collapsedContextThreshold:n=1}=this.options,{splitHeight:i,unifiedHeight:r}=function({fileDiff:e,metrics:t,disableFileHeader:n,hunkSeparators:i,expandUnchanged:r,expandedHunks:o,collapsedContextThreshold:s}){var a,l,d,c;let u=Rc(t,n),h=u;const f=!!r||o,p=e.hunks.length-1;for(let m=0;m<e.hunks.length;m++){const n=e.hunks[m];if(null==n)throw new Error("computeEstimatedDiffHeights: invalid hunk index");const r=Du({isPartial:e.isPartial,rangeSize:n.collapsedBefore,expandedHunks:f,hunkIndex:m,collapsedContextThreshold:s}),o=(r.fromStart+r.fromEnd)*t.lineHeight;if(u+=o,h+=o,r.collapsedLines>0){const e=null!=(l=null==(a=Fu({type:i,metrics:t,hunkIndex:m,hunkSpecs:n.hunkSpecs}))?void 0:a.totalHeight)?l:0;u+=e,h+=e}u+=n.splitLineCount*t.lineHeight,h+=n.unifiedLineCount*t.lineHeight;const g=uh(n);u+=g.split*t.lineHeight,h+=g.unified*t.lineHeight;const v=m===p?_u({fileDiff:e,hunkIndex:m,expandedHunks:f,collapsedContextThreshold:s,errorPrefix:"computeEstimatedDiffHeights"}):void 0;if(null!=v){const e=(v.fromStart+v.fromEnd)*t.lineHeight;if(u+=e,h+=e,v.collapsedLines>0){const e=null!=(c=null==(d=Bu({type:i,metrics:t}))?void 0:d.totalHeight)?c:0;u+=e,h+=e}}}if(e.hunks.length>0){const e=Pc(t);u+=e,h+=e}return{splitHeight:u,unifiedHeight:h}}({fileDiff:this.fileDiff,metrics:this.metrics,disableFileHeader:e,hunkSeparators:this.getHunkSeparatorType(),expandUnchanged:t,expandedHunks:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:n});this.cache.estimatedSplitHeight=i,this.cache.estimatedUnifiedHeight=r}validateComputedHeight(){if(null==this.fileContainer||null==this.fileDiff)return;const e=this.fileContainer.getBoundingClientRect();e.height!==this.height&&(this.fileDiff.name,e.height,this.height)}render({fileContainer:e,oldFile:t,newFile:n,fileDiff:i,forceRender:r=!1,lineAnnotations:o,...s}={}){var a,l;const{forceRenderOverride:d,isSetup:c}=this;this.forceRenderOverride=void 0;const u=this.syncLineAnnotations(o);if(u&&this.resetLayoutCache({includeEstimatedHeights:!1}),null!=this.fileDiff||(this.fileDiff=null!=i?i:null!=t&&null!=n?ku(t,n,this.options.parseDiffOptions):void 0),e=this.getOrCreateFileContainer(e),null==this.fileDiff)return console.error("VirtualizedFileDiff.render: attempting to virtually render when we dont have the correct data"),!1;if(c)null!=this.top||(this.top=this.getVirtualizedTop());else{this.computeApproximateSize();const t=this.getSimpleVirtualizer();if(null!=this.top||(this.top=this.getVirtualizedTop()),this.isAdvancedMode())this.isVisible=!0;else{if(null==t)throw new Error("VirtualizedFileDiff.render: simple virtualizer is not available");t.connect(e,this),this.isVisible=t.isInstanceVisible(null!=(a=this.top)?a:0,this.height)}this.isSetup=!0}if(!this.isVisible&&this.isSimpleMode())return this.renderPlaceholder(this.height);const h=this.virtualizer.getWindowSpecs(),f=null!=(l=this.top)?l:0,p=this.computeRenderRangeFromWindow(this.fileDiff,f,h);return super.render({fileDiff:this.fileDiff,fileContainer:e,renderRange:p,oldFile:t,newFile:n,lineAnnotations:o,forceRender:(null!=d?d:r)||u,...s})}syncVirtualizedTop(){this.top=this.getVirtualizedTop()}shouldDisableVirtualizationBuffers(){return this.isAdvancedMode()||super.shouldDisableVirtualizationBuffers()}isSimpleMode(){return"simple"===this.virtualizer.type}isAdvancedMode(){return"advanced"===this.virtualizer.type}getVirtualizedTop(){return"advanced"===this.virtualizer.type?this.virtualizer.getLocalTopForInstance(this):null!=this.fileContainer?this.virtualizer.getOffsetInScrollContainer(this.fileContainer):0}getSimpleVirtualizer(){return"simple"===this.virtualizer.type?this.virtualizer:void 0}isResizeDebuggingEnabled(){var e,t;return null!=(t=null==(e=this.getSimpleVirtualizer())?void 0:e.config.resizeDebugging)&&t}getDiffStyle(){var e;return null!=(e=this.options.diffStyle)?e:"split"}getHunkSeparatorType(){return"function"==typeof(e=this.options.hunkSeparators)?"custom":null!=e?e:"line-info";var e}approximateLayoutCheckpoints(){var e,t,n,i;if(this.cache.checkpoints.length>0||null==this.fileDiff||0===this.fileDiff.hunks.length||!0===this.options.collapsed)return;const{disableFileHeader:r=!1,expandUnchanged:o=!1,collapsedContextThreshold:s=1}=this.options,a=this.fileDiff.hunks.length-1,l=this.getDiffStyle(),d=this.getHunkSeparatorType(),c=!!o||this.hunksRenderer.getExpandedHunksMap(),u=function(e){const t=Array.from(e).sort((e,t)=>e[0]-t[0]),n=[],i=[0];let r=0;for(const[o,s]of t)n.push(o),r+=s,i.push(r);return{lineIndexes:n,prefixTotals:i}}(this.cache.heightDeltas);let h=Rc(this.metrics,r)+this.cache.fileAnnotationHeight,f=0;const p=({rowCount:e,startLineIndex:t,preSeparatorHeight:n=0,postSeparatorHeight:i=0,metadataOffsets:r=[]})=>{if(e<=0)return;const o=f,s=f+e;let a=function(e){return Math.ceil(e/hh)*hh}(o);for(;a<s;){const e=a-o,i=h+(e>0?n:0)+e*this.metrics.lineHeight+vh(r,e)*this.metrics.lineHeight+mh(u,t,t+e);this.cache.checkpoints.push({renderedLineIndex:a,lineIndex:t+e,top:i}),a+=hh}h+=n+e*this.metrics.lineHeight+r.length*this.metrics.lineHeight+mh(u,t,t+e)+i,f=s};for(let m=0;m<this.fileDiff.hunks.length;m++){const r=this.fileDiff.hunks[m];if(null==r)throw new Error("VirtualizedFileDiff.approximateLayoutCheckpoints: invalid hunk index");const o=Du({isPartial:this.fileDiff.isPartial,rangeSize:r.collapsedBefore,expandedHunks:c,hunkIndex:m,collapsedContextThreshold:s}),u=o.collapsedLines>0&&null!=(t=null==(e=Fu({type:d,metrics:this.metrics,hunkIndex:m,hunkSpecs:r.hunkSpecs}))?void 0:e.totalHeight)?t:0;p({rowCount:o.fromStart,startLineIndex:("split"===l?r.splitLineStart:r.unifiedLineStart)-o.rangeSize});let h=u;p({rowCount:o.fromEnd,startLineIndex:("split"===l?r.splitLineStart:r.unifiedLineStart)-o.fromEnd,preSeparatorHeight:h}),o.fromEnd>0&&(h=0);const f=m===a?_u({fileDiff:this.fileDiff,hunkIndex:m,expandedHunks:c,collapsedContextThreshold:s,errorPrefix:"VirtualizedFileDiff"}):void 0,g=null!=f&&f.collapsedLines>0&&null!=(i=null==(n=Bu({type:d,metrics:this.metrics}))?void 0:n.totalHeight)?i:0,v=null!=f?f.fromStart+f.fromEnd:0,b="split"===l?r.splitLineCount:r.unifiedLineCount,y="split"===l?r.splitLineStart:r.unifiedLineStart;p({rowCount:b,startLineIndex:y,preSeparatorHeight:h,postSeparatorHeight:0===v?g:0,metadataOffsets:bh({diffStyle:l,hunk:r,rowCount:b})}),null!=f&&v>0&&p({rowCount:v,startLineIndex:y+b,postSeparatorHeight:g})}this.cache.totalLines=f}getLayoutCheckpointBeforeLineIndex(e){if(e<=0||0===this.cache.checkpoints.length)return;let t,n=0,i=this.cache.checkpoints.length-1;for(;n<=i;){const r=n+i>>1,o=this.cache.checkpoints[r];if(null==o)throw new Error("VirtualizedFileDiff: invalid checkpoint index");o.lineIndex<=e?(t=o,n=r+1):i=r-1}return t}getLayoutCheckpointBeforeTop(e,t){let n=0,i=this.cache.checkpoints.length-1,r=-1;for(;n<=i;){const t=n+i>>1,o=this.cache.checkpoints[t];if(null==o)throw new Error("VirtualizedFileDiff: invalid checkpoint index");o.top<=e?(r=t,n=t+1):i=t-1}if(null==t)return r>=0?this.cache.checkpoints[r]:void 0;for(let o=r;o>=0;o--){const e=this.cache.checkpoints[o];if(null==e)throw new Error("VirtualizedFileDiff: invalid checkpoint index");if(e.renderedLineIndex%t===0)return e}}getExpandedLineCount(e,t){let n=0;if(e.isPartial){for(const i of e.hunks)n+="split"===t?i.splitLineCount:i.unifiedLineCount;return n}const{expandUnchanged:i=!1,collapsedContextThreshold:r=1}=this.options,o=!!i||this.hunksRenderer.getExpandedHunksMap();for(const[a,l]of e.hunks.entries()){n+="split"===t?l.splitLineCount:l.unifiedLineCount;const i=Math.max(l.collapsedBefore,0),{fromStart:s,fromEnd:d,renderAll:c}=Du({isPartial:e.isPartial,rangeSize:i,expandedHunks:o,hunkIndex:a,collapsedContextThreshold:r});i>0&&(n+=c?i:s+d)}const s=_u({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:o,collapsedContextThreshold:r,errorPrefix:"VirtualizedFileDiff"});return null!=s&&(n+=s.fromStart+s.fromEnd),n}computeRenderRangeFromWindow(e,t,{top:n,bottom:i}){var r,o,s,a;const{disableFileHeader:l=!1,expandUnchanged:d=!1,collapsedContextThreshold:c=1}=this.options,{hunkLineCount:u,lineHeight:h}=this.metrics,f=this.getDiffStyle(),p=this.getHunkSeparatorType(),m=this.height;let g=this.cache.totalLines>0?this.cache.totalLines:this.getExpandedLineCount(e,f);const v=Rc(this.metrics,l),b=e.hunks.length>0?Pc(this.metrics):0,{fileAnnotationHeight:y}=this.cache,C=v+y,S=Math.max(0,m-v-y-b),k=this.hasFileAnnotations(e),x=t+v,w=y>0&&k&&x<i&&x+y>n;if(t<n-m||t>i)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:m-v-b};if(g<=u||0===e.hunks.length)return{startingLine:0,totalLines:u,bufferBefore:0,bufferAfter:0};this.approximateLayoutCheckpoints(),g=this.cache.totalLines>0?this.cache.totalLines:g;const L=Math.ceil(Math.max(i-n,0)/h),T=Math.ceil(L/u)*u+u,A=T/u,I=A,E=[],M=(n+i)/2,R=this.getLayoutCheckpointBeforeTop(Math.max(0,n-t-T*h*2),u);let P,N,D,H=t+(null!=(r=null==R?void 0:R.top)?r:C),_=null!=(o=null==R?void 0:R.renderedLineIndex)?o:0;if($u({diff:e,diffStyle:f,startingLine:null!=(s=null==R?void 0:R.renderedLineIndex)?s:0,expandedHunks:!!d||this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:c,callback:({hunkIndex:e,hunk:r,collapsedBefore:o,collapsedAfter:s,deletionLine:a,additionLine:l})=>{var d,c,h,m,g,v;const b=null!=l?l.splitLineIndex:a.splitLineIndex,y=null!=l?l.unifiedLineIndex:a.unifiedLineIndex,S=null!=(d=null==l?void 0:l.noEOFCR)&&d||null!=(c=null==a?void 0:a.noEOFCR)&&c,k=null!=(m=null==(h=o>0?Fu({type:p,metrics:this.metrics,hunkIndex:e,hunkSpecs:null==r?void 0:r.hunkSpecs}):void 0)?void 0:h.totalHeight)?m:0;H+=k;const x=_%u===0,w=Math.floor(_/u);if(x&&(E[w]=H-(t+C+k),null!=D)){if(D<=0)return!0;D--}const L=this.getLineHeight("split"===f?b:y,S);return H>n-L&&H<i&&(null!=P||(P=w)),null==N&&H+L>M&&(N=w),null==D&&H>=i&&x&&(D=I),_++,H+=L,s>0&&(H+=null!=(v=null==(g=Bu({type:p,metrics:this.metrics}))?void 0:g.totalHeight)?v:0),!1}}),null==P){if(!w)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:m-v-b};P=0,N=0}null!=N||(N=P);const O=Math.round(N-A/2),j=Math.max(0,Math.ceil(g/u)-A),F=Math.max(0,Math.min(O,j)),B=F*u,$=O<0?T+O*u:T,z=null!=(a=E[F])?a:0,U=0===B?0:y+z,G=F+$/u,W=G<E.length?S-E[G]:S-(H-t-C);return{startingLine:B,totalLines:$,bufferBefore:U,bufferAfter:Math.max(0,W)}}};function mh({lineIndexes:e,prefixTotals:t},n,i){var r,o;if(n>=i||0===e.length)return 0;const s=gh(e,n);return(null!=(r=t[gh(e,i)])?r:0)-(null!=(o=t[s])?o:0)}function gh(e,t){let n=0,i=e.length;for(;n<i;){const r=n+i>>1,o=e[r];if(null==o)throw new Error("VirtualizedFileDiff: invalid prefix index");o<t?n=r+1:i=r}return n}function vh(e,t){let n=0;for(const i of e)i<t&&n++;return n}function bh({diffStyle:e,hunk:t,rowCount:n}){if(n<=0||!t.noEOFCRAdditions&&!t.noEOFCRDeletions)return[];const i=t.hunkContent.at(-1);if(null==i)return[];if("context"===i.type)return[n-1];const r=Math.max(i.deletions,i.additions),o=i.deletions+i.additions;if("split"===e)return r>0&&(t.noEOFCRAdditions||t.noEOFCRDeletions)?[n-1]:[];const s=[],a=n-o;return i.deletions>0&&t.noEOFCRDeletions&&s.push(a+i.deletions-1),i.additions>0&&t.noEOFCRAdditions&&s.push(n-1),s}function yh(e,t){var n,i,r,o,s,a,l,d;return(null!=(n=e.disableFileHeader)&&n)!==(null!=(i=t.disableFileHeader)&&i)||(null!=(r=e.hunkSeparators)?r:"line-info")!==(null!=(o=t.hunkSeparators)?o:"line-info")||(null!=(s=e.expandUnchanged)&&s)!==(null!=(a=t.expandUnchanged)&&a)||(null!=(l=e.collapsedContextThreshold)?l:1)!==(null!=(d=t.collapsedContextThreshold)?d:1)}function Ch(e,t){const[n,i]=e.split(",").map(Number);return"split"===t?i:n}function Sh(e){var t;const n=null!=(t=window.devicePixelRatio)?t:1;return Math.round(e*n)/n}const kh=["theme","disableLineNumbers","overflow","themeType","disableFileHeader","disableVirtualizationBuffers","preferredHighlighter","useCSSClasses","useTokenTransformer","tokenizeMaxLineLength","tokenizeMaxLength","unsafeCSS","diffStyle","diffIndicators","disableBackground","expandUnchanged","collapsedContextThreshold","lineDiffType","maxLineDiffLength","expansionLineCount","lineHoverHighlight","enableTokenInteractionsOnWhitespace","enableGutterUtility","__debugPointerEvents","enableLineSelection","controlledSelection","disableErrorHandling"],xh=["theme","disableLineNumbers","overflow","themeType","disableFileHeader","disableVirtualizationBuffers","preferredHighlighter","useCSSClasses","useTokenTransformer","tokenizeMaxLineLength","tokenizeMaxLength","unsafeCSS","lineHoverHighlight","enableTokenInteractionsOnWhitespace","enableGutterUtility","__debugPointerEvents","enableLineSelection","controlledSelection","disableErrorHandling"],wh=["renderCustomHeader","renderHeaderPrefix","renderHeaderMetadata","renderAnnotation","renderGutterUtility","onPostRender","onGutterUtilityClick","onLineClick","onLineNumberClick","onLineEnter","onLineLeave","onTokenClick","onTokenEnter","onTokenLeave"],Lh=["onLineSelected","onLineSelectionStart","onLineSelectionChange","onLineSelectionEnd"],Th=/* @__PURE__ */Symbol("CodeView.itemOptionsState");function Ah(e,t){Object.defineProperty(e,Th,{configurable:!1,enumerable:!1,value:t})}function Ih(e){return e[Th]}function Eh(e,t,n){Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get(){return n(this)}})}const Mh="--diffs-overflow-override",Rh=11e6,Ph=(()=>{const{navigator:e}=globalThis,t=e.userAgent,n=/iP(?:hone|ad|od)/.test(t),i="MacIntel"===e.platform&&e.maxTouchPoints>1;return(n||i)&&/AppleWebKit/.test(t)&&/Safari/.test(t)&&!/(CriOS|FxiOS|EdgiOS|OPiOS)/.test(t)})();var Nh=(f=class{constructor(e={theme:G},t,n=!1){y(this,"type","advanced"),y(this,"config",{overscrollSize:200,intersectionObserverMargin:0,resizeDebugging:!1}),y(this,"items",[]),y(this,"idToItem",/* @__PURE__ */new Map),y(this,"selectedLines",null),y(this,"instanceToItem",/* @__PURE__ */new Map),y(this,"layoutDirtyIndex"),y(this,"pendingLayoutReset"),y(this,"renderOptionsRevision",0),y(this,"slotCoordinator"),y(this,"slotSnapshot"),y(this,"scrollListeners",/* @__PURE__ */new Set),y(this,"scrollHeight",0),y(this,"containerHeight",-1),y(this,"scrollTop",0),y(this,"scrollPageOffset",0),y(this,"scrollDirty",!0),y(this,"scrollInteractionFixTimer"),y(this,"pointerEventsDisabled",!1),y(this,"codeOverflowFix",!1),y(this,"height",0),y(this,"heightDirty",!0),y(this,"windowSpecs",{top:0,bottom:0}),y(this,"renderState",{scrollTop:-1,firstIndex:-1,lastIndex:-1,stickyHeight:0,stickyTop:-1,stickyBottom:-1}),y(this,"itemMetricsCache",Z),y(this,"fileOptionsPrototype"),y(this,"diffOptionsPrototype"),y(this,"pendingScrollTarget"),y(this,"pendingLayoutAnchor"),y(this,"shouldFixContainerFocus",!1),y(this,"scrollAnimation"),y(this,"root"),y(this,"resizeObserver"),y(this,"container",document.createElement("div")),y(this,"stickyContainer",document.createElement("div")),y(this,"stickyOffset",document.createElement("div")),y(this,"elementPool",[]),y(this,"elementPoolVersion",0),y(this,"elementPoolTracker",/* @__PURE__ */new WeakMap),y(this,"pendingElementPool",[]),y(this,"options"),y(this,"workerManager"),y(this,"isContainerManaged"),y(this,"restoreScrollInteractions",()=>{this.clearScrollInteractionTimer(),this.pointerEventsDisabled&&(this.stickyContainer.style.removeProperty("pointer-events"),this.pointerEventsDisabled=!1),this.codeOverflowFix&&(this.stickyContainer.style.setProperty(Mh,"auto"),this.codeOverflowFix=!1)}),y(this,"computeRenderRangeAndEmit",(e=performance.now())=>{if(f.__STOP||null==this.container)return;const t=this.getHeight(),n=this.getScrollTop();let i=n,r=null!=this.pendingLayoutAnchor,o=this.getScrollAnchor(i);if(null!=this.layoutDirtyIndex&&(this.recomputeLayout(this.layoutDirtyIndex,this.pendingLayoutReset),this.layoutDirtyIndex=void 0,this.pendingLayoutReset=void 0,r=!0),r&&null!=o){const e=this.resolveAnchoredScrollTop(o);if(null!=e){const t=e-i;i=e,null!=this.scrollAnimation&&(this.scrollAnimation.position+=t)}}r&&(i=this.clampScrollTop(i),this.syncContainerHeight());const s=this.computeTargetScrollTopForFrame(i,e),a=!r&&(-1===this.renderState.scrollTop||Math.abs(s-this.renderState.scrollTop)>t+2*this.config.overscrollSize);a&&(o=void 0),this.windowSpecs=me({scrollTop:s,height:t,scrollHeight:this.getScrollHeight(),fitPerfectly:a,fitPerfectlyOverscroll:this.getFitPerfectlyOverscroll(),overscrollSize:this.config.overscrollSize});let l=n;(null!=this.pendingScrollTarget&&s!==l||this.needsScrollPageUpdate(s))&&(this.applyScrollFix(s,l,this.windowSpecs),l=s);const{top:d,bottom:c}=this.windowSpecs,{firstIndex:u,lastIndex:h}=this.renderState;if(u>=0)for(let f=u;f<=h;f++){const e=this.items[f];if(null==e)throw new Error(`CodeView.computeRenderRangeAndEmit: No item at index: ${f}`);e.top>d-e.height&&e.top<=c||this.releaseRenderedItem(e)}let p;const m=/* @__PURE__ */new Set,g=this.findFirstVisibleIndex(d),v=this.findLastVisibleIndex(c);for(let f=g;f<=v;f++){const e=this.items[f];if(null==e)throw new Error("CodeView.computeRenderRangeAndEmit: missing item");const{instance:t}=e;null==e.element?(e.element=this.acquireElement(),Bh(this.stickyContainer,e.element,p),t.virtualizedSetup(),Fh(e,e.element)&&(e.renderedOptionsRevision=this.renderOptionsRevision,m.add(e)),p=e.element):(Bh(this.stickyContainer,e.element,p),Fh(e,void 0,e.renderedOptionsRevision!==this.renderOptionsRevision)&&(e.renderedOptionsRevision=this.renderOptionsRevision,m.add(e)),p=e.element)}this.renderState.firstIndex=g<=v?g:-1,this.renderState.lastIndex=v,this.flushSlotCoordinator(),this.reconcileRenderedItems(m),this.syncContainerHeight(),this.updateStickyPositioning();const b=null!=o?this.resolveAnchoredScrollTop(o):void 0;o===this.pendingLayoutAnchor&&(this.pendingLayoutAnchor=void 0);const y=null!=b?b-i:0;let C=s,S=!1;if(null!=this.pendingScrollTarget){const t=this.advanceScrollAnimation(e,y);null!=t?(C=t,S=!0):C=i}else C=null!=b?b:s;C!==l&&(this.applyScrollFix(C,l,this.windowSpecs),l=C),S&&null!=this.pendingScrollTarget&&this.isPendingTargetSettled(this.pendingScrollTarget)&&(this.pendingScrollTarget=void 0,this.scrollAnimation=void 0),this.renderState.scrollTop=Sh(l),this.flushManagers(m),this.validateStickyContainerHeight(),this.fixContainerFocus(),(a||null!=this.scrollAnimation)&&this.render()}),y(this,"handleScroll",()=>{f.__STOP||(this.suspendScrollInteractions(),this.scrollDirty=!0,this.notifyScroll(),this.render())}),y(this,"clearPendingScroll",()=>{this.pendingScrollTarget=void 0,this.pendingLayoutAnchor=void 0,this.scrollAnimation=void 0}),y(this,"handleResize",e=>{for(const t of e)if(t.target===this.stickyContainer){if(t.borderBoxSize[0].blockSize!==this.renderState.stickyHeight){const e=this.getScrollTop(),t=this.getScrollAnchor(e);this.reconcileRenderedItems(),this.updateStickyPositioning();const n=null!=t?this.resolveAnchoredScrollTop(t):void 0;if(null!=n){const t=n-e;this.applyScrollFix(n,e,this.windowSpecs),null!=this.scrollAnimation&&(this.scrollAnimation.position+=t)}null!=this.pendingScrollTarget&&this.isPendingTargetSettled(this.pendingScrollTarget)&&(this.pendingScrollTarget=void 0,this.scrollAnimation=void 0)}}else this.scrollDirty=!0,this.heightDirty=!0,this.render()}),this.options=e,this.computeMetricsCache(e.itemMetrics),this.fileOptionsPrototype=this.createFileOptionsPrototype(),this.diffOptionsPrototype=this.createDiffOptionsPrototype(),this.workerManager=t,this.isContainerManaged=n,this.stickyOffset.style.contain="layout size",this.stickyContainer.style.position="sticky",this.stickyContainer.style.width="100%",this.stickyContainer.style.contain="layout style inline-size",this.stickyContainer.style.isolation="isolate",this.stickyContainer.style.display="flex",this.stickyContainer.style.flexDirection="column"}getLayout(){var e;return null!=(e=this.options.layout)?e:ee}computeMetricsCache(e){var t,n,i,r;return this.itemMetricsCache={hunkLineCount:null!=(t=null==e?void 0:e.hunkLineCount)?t:Z.hunkLineCount,lineHeight:null!=(n=null==e?void 0:e.lineHeight)?n:Z.lineHeight,diffHeaderHeight:null!=(i=null==e?void 0:e.diffHeaderHeight)?i:Z.diffHeaderHeight,hunkSeparatorHeight:null==e?void 0:e.hunkSeparatorHeight,spacing:null!=(r=null==e?void 0:e.spacing)?r:Z.spacing,paddingTop:null==e?void 0:e.paddingTop,paddingBottom:null==e?void 0:e.paddingBottom},this.itemMetricsCache}getSmoothScrollSettings(){var e;return null!=(e=this.options.smoothScrollSettings)?e:te}shouldDisablePointerEvents(){return!0!==this.options.pointerEventsOnScroll}shouldValidateItemHeights(){return T&&!0===this.options.__devOnlyValidateItemHeights}validateRenderedItemHeight(e){if(!this.shouldValidateItemHeights()||null==e.element)return;const t=e.instance.getAdvancedStickySpecs();if(null==t)return;const n=t.height,i=e.element.getBoundingClientRect().height;n!==i&&console.error("CodeView: reconciled item height does not match DOM height",{id:e.item.id,type:e.type,index:e.index,version:e.version,expectedHeight:n,actualHeight:i,delta:i-n,stickyTopOffset:t.topOffset,virtualizedHeight:e.instance.getVirtualizedHeight(),top:e.top,scrollTop:this.getScrollTop(),windowSpecs:{...this.windowSpecs},element:e.element,instance:e.instance})}validateStickyContainerHeight(){var e,t;if(!this.shouldValidateItemHeights())return;const{firstIndex:n,lastIndex:i,stickyHeight:r,stickyTop:o,stickyBottom:s}=this.renderState;if(-1===n||-1===i)return;const a=this.stickyContainer.getBoundingClientRect().height;Math.abs(a-r)<1||console.error("CodeView: sticky container height does not match computed layout",{computedStickyHeight:r,actualStickyHeight:a,delta:a-r,stickyTop:o,stickyBottom:s,firstIndex:n,lastIndex:i,firstStickySpecs:null==(e=this.items[n])?void 0:e.instance.getAdvancedStickySpecs(),lastStickySpecs:null==(t=this.items[i])?void 0:t.instance.getAdvancedStickySpecs(),scrollTop:this.getScrollTop(),scrollPageOffset:this.scrollPageOffset,windowSpecs:{...this.windowSpecs},stickyContainer:this.stickyContainer})}clearScrollInteractionTimer(){null!=this.scrollInteractionFixTimer&&(clearTimeout(this.scrollInteractionFixTimer),this.scrollInteractionFixTimer=void 0)}suspendScrollInteractions(){this.clearScrollInteractionTimer(),this.shouldDisablePointerEvents()&&!this.pointerEventsDisabled&&(this.stickyContainer.style.pointerEvents="none",this.pointerEventsDisabled=!0),Ph&&!this.codeOverflowFix&&(this.stickyContainer.style.setProperty(Mh,"hidden"),this.codeOverflowFix=!0),this.scrollInteractionFixTimer=setTimeout(this.restoreScrollInteractions,120)}syncLayout(){var e,t;const{gap:n,paddingBottom:i,paddingTop:r}=this.getLayout();this.stickyContainer.style.gap=`${n}px`,null==(e=this.container)||e.style.setProperty("margin-top",`${r}px`),null==(t=this.container)||t.style.setProperty("margin-bottom",`${i}px`)}setup(e){var t;if(null!=this.root)throw new Error("CodeView.setup: already setup");null==(t=this.workerManager)||t.subscribeToThemeChanges(this),this.root=e,this.root.style.overflowAnchor="none",this.root.hasAttribute("tabindex")||(this.root.tabIndex=-1),null!=this.container||(this.container=document.createElement("div")),this.container.style.contain="layout style",this.syncLayout(),this.container.appendChild(this.stickyOffset),this.container.appendChild(this.stickyContainer),this.root.appendChild(this.container),this.scrollDirty=!0,this.heightDirty=!0,this.resizeObserver=new ResizeObserver(this.handleResize),this.resizeObserver.observe(this.stickyContainer),this.root.addEventListener("scroll",this.handleScroll,{passive:!0}),this.root.addEventListener("wheel",this.clearPendingScroll,{passive:!0}),this.root.addEventListener("touchstart",this.clearPendingScroll,{passive:!0}),this.root.addEventListener("pointerdown",this.clearPendingScroll,{passive:!0}),this.root.addEventListener("keydown",this.clearPendingScroll,{passive:!0}),this.resizeObserver.observe(this.root),this.render(!0),window.__INSTANCE=this,window.__TOGGLE=()=>{f.__STOP?(f.__STOP=!1,this.scrollTo({type:"position",position:f.__lastScrollPosition,behavior:"instant"})):(f.__lastScrollPosition=this.getScrollTop(),f.__STOP=!0)}}reset(){var e;this.restoreScrollInteractions(),this.cleanAllRenderedItems(),this.selectedLines=null,this.items.length=0,this.idToItem.clear(),this.instanceToItem.clear(),this.layoutDirtyIndex=void 0,this.pendingLayoutReset=void 0,this.stickyContainer.textContent="",this.stickyOffset.style.height="",null==(e=this.container)||e.style.removeProperty("height"),this.containerHeight=-1,this.windowSpecs={top:0,bottom:0},this.pendingLayoutAnchor=void 0,this.shouldFixContainerFocus=!1,this.height=0,this.scrollTop=0,this.scrollPageOffset=0,this.scrollHeight=0,this.scrollDirty=!0,this.heightDirty=!0,this.resetRenderState(),this.isContainerManaged||this.flushSlotCoordinator()}cleanUp(){var e,t,n,i,r,o,s,a,l;this.reset(),this.clearElementPool(),this.restoreScrollInteractions(),null==(e=this.workerManager)||e.unsubscribeToThemeChanges(this),null==(t=this.resizeObserver)||t.disconnect(),this.resizeObserver=void 0,null==(n=this.root)||n.removeEventListener("scroll",this.handleScroll),null==(i=this.root)||i.removeEventListener("wheel",this.clearPendingScroll),null==(r=this.root)||r.removeEventListener("touchstart",this.clearPendingScroll),null==(o=this.root)||o.removeEventListener("pointerdown",this.clearPendingScroll),null==(s=this.root)||s.removeEventListener("keydown",this.clearPendingScroll),null==(a=this.root)||a.style.removeProperty("overflow-anchor"),null==(l=this.container)||l.remove(),this.stickyOffset.remove(),this.stickyContainer.remove(),this.stickyContainer.textContent="",this.root=void 0,this.container=void 0}cleanAllRenderedItems(){if(-1!==this.renderState.firstIndex)for(let e=this.renderState.firstIndex;e<=this.renderState.lastIndex;e++){const t=this.items[e];if(null==t)throw new Error(`CodeView.cleanAllRenderedItems: Item does not exist at index: ${e}`);this.releaseRenderedItem(t)}}primeScrollTarget(e){if("position"===e.type)return;const t=this.idToItem.get(e.id);null!=t&&t.instance.primeHighlightCache()}getElementPoolLimit(){const e=this.getHeight()+2*this.config.overscrollSize,{diffHeaderHeight:t}=this.itemMetricsCache;return Math.max(8,Math.ceil(e/Math.max(t,10))+1)*(this.isContainerManaged?2:1)}acquireElement(){this.promotePendingPooledElements();let e=this.elementPool.pop();for(;null!=e&&!this.isElementPoolGenerationCurrent(e);)e=this.elementPool.pop();return null!=e||(e=document.createElement(L)),this.markElementPoolGenerationCurrent(e),e}releaseRenderedItem(e){const{element:t}=e;null!=t&&this.renderedItemOwnsFocus(t)&&(this.shouldFixContainerFocus=!0),e.instance.cleanUp(!0),e.element=void 0,null!=t&&(t.remove(),this.cleanElement(t),this.queueElementForPool(t))}renderedItemOwnsFocus(e){var t;const{activeElement:n}=document;return n===e||e.contains(n)||null!=(null==(t=e.shadowRoot)?void 0:t.activeElement)}fixContainerFocus(){var e;this.shouldFixContainerFocus&&(this.shouldFixContainerFocus=!1,null==(e=this.root)||e.focus({preventScroll:!0}))}cleanElement(e){const{shadowRoot:t}=e;if(null!=t)for(const n of Array.from(t.children))_h(n)||n.remove();this.isContainerManaged||e.replaceChildren()}queueElementForPool(e){const t=this.getElementPoolLimit();!this.isElementPoolGenerationCurrent(e)||this.getElementPoolSize()>=t||(this.isElementClean(e)?this.elementPool.push(e):this.pendingElementPool.push(e))}promotePendingPooledElements(){if(0===this.pendingElementPool.length)return;const{pendingElementPool:e}=this;this.pendingElementPool=[];const t=this.getElementPoolLimit();for(const n of e)this.isElementPoolGenerationCurrent(n)&&this.isElementClean(n)&&this.elementPool.length<t?this.elementPool.push(n):this.isElementPoolGenerationCurrent(n)&&this.getElementPoolSize()<t&&this.pendingElementPool.push(n)}isElementClean(e){return 0===e.childNodes.length}getElementPoolSize(){return this.elementPool.length+this.pendingElementPool.length}clearElementPool(){this.elementPool.length=0,this.pendingElementPool.length=0}invalidateElementPool(){this.elementPoolVersion++,this.clearElementPool()}markElementPoolGenerationCurrent(e){this.elementPoolTracker.set(e,this.elementPoolVersion)}isElementPoolGenerationCurrent(e){return this.elementPoolTracker.get(e)===this.elementPoolVersion}resolveEffectiveScrollBehavior(e,t){var n;return ge()?"instant":"smooth-auto"!==e.behavior?null!=(n=e.behavior)?n:"instant":Math.abs(t-this.getScrollTop())<=10*this.getHeight()?"smooth":"instant"}scrollTo(e){if(null==this.root)return;const t=this.normalizeScrollTarget(e);if(null==t)return;const n=this.resolveScrollTargetTop(t);null!=n&&(this.primeScrollTarget(t),"smooth"===this.resolveEffectiveScrollBehavior(t,n)?null!=this.scrollAnimation||(this.scrollAnimation={position:this.getScrollTop(),velocity:0,lastTimestamp:performance.now()}):this.scrollAnimation=void 0,this.suspendScrollInteractions(),this.pendingLayoutAnchor=void 0,this.pendingScrollTarget=t,this.render())}setSelectedLines(e,t){this.applySelectedLines(e,t)}getSelectedLines(){return this.selectedLines}clearSelectedLines(e){this.applySelectedLines(null,e)}getItem(e){var t;return null==(t=this.idToItem.get(e))?void 0:t.item}updateItem(e){const t=this.idToItem.get(e.id);return null==t?(console.error(`CodeView.updateItem: unknown item id "${e.id}"`),!1):!!this.syncItemRecord(t,e)&&(this.markItemLayoutDirty(t),this.scrollDirty=!0,this.render(),this.syncSelection(),!0)}updateItemId(e,t){var n,i,r;if(e===t)return!0;const o=this.idToItem.get(e);return null==o?(console.error(`CodeView.updateItemId: unknown item id "${e}"`),!1):this.idToItem.has(t)?(console.error(`CodeView.updateItemId: duplicate item id "${t}"`),!1):(this.idToItem.delete(e),o.item.id=t,this.idToItem.set(t,o),this.updateItemOptionsId(o.instance.options,t),(null==(n=this.selectedLines)?void 0:n.id)===e&&(this.selectedLines={...this.selectedLines,id:t},null==(r=(i=this.options).onSelectedLinesChange)||r.call(i,this.selectedLines)),this.renamePendingScrollTarget(e,t),this.renamePendingLayoutAnchor(e,t),this.render(),!0)}addItem(e){this.addItems([e]),this.syncSelection()}addItems(e){this.appendItemsInternal(e),this.syncSelection()}setItems(e){0===e.length?this.reset():0===this.items.length?this.appendItemsInternal(e):this.tryAppendItems(e)||this.reconcileItems(e),this.syncSelection()}appendItemsInternal(e,t=!0){if(0===e.length)return;const n=this.getLayout();let i=0===this.items.length?0:this.scrollHeight+n.gap;const r=i;for(let o=0;o<e.length;o++){const t=e[o];if(null==t)throw new Error("CodeView.appendItemsInternal: missing input item");if(this.idToItem.has(t.id))throw new Error(`CodeView.addItem: duplicate id "${t.id}"`);const r=this.createItem(t,this.items.length,i);this.items.push(r),this.idToItem.set(r.item.id,r),this.instanceToItem.set(r.instance,r),r.height=Dh(r),i+=r.height+n.gap}this.scrollHeight=i-n.gap,this.scrollDirty=!0,t&&(this.canSkipRenderForAppend(r)?this.syncContainerHeight():this.render())}canSkipRenderForAppend(e){return null!=this.container&&-1!==this.renderState.firstIndex&&null==this.pendingScrollTarget&&null==this.scrollAnimation&&null==this.layoutDirtyIndex&&e>this.windowSpecs.bottom}onThemeChange(){this.invalidateElementPool()}setOptions(e){if(null==e)return;this.capturePendingLayoutAnchor();const{options:t}=this,n=this.getLayout(),{itemMetricsCache:i}=this;var r,o,s,a,l,d;o=e,ue(null!=(s=(r=t).theme)?s:G,null!=(a=o.theme)?a:G)&&(null!=(l=r.themeType)?l:"system")===(null!=(d=o.themeType)?d:"system")&&r.unsafeCSS===o.unsafeCSS||this.invalidateElementPool(),this.options=e;const c=this.computeMetricsCache(e.itemMetrics),u=!ce(i,c),h=!ce(n,this.getLayout());h&&this.syncLayout();const f=u||function(e,t){var n,i,r,o,s,a,l,d,c,u,h,f,p,m,g,v;return(null!=(n=e.overflow)?n:"scroll")!==(null!=(i=t.overflow)?i:"scroll")||(null!=(r=e.disableLineNumbers)&&r)!==(null!=(o=t.disableLineNumbers)&&o)||(null!=(s=e.disableFileHeader)&&s)!==(null!=(a=t.disableFileHeader)&&a)||e.unsafeCSS!==t.unsafeCSS||(null!=(l=e.diffStyle)?l:"split")!==(null!=(d=t.diffStyle)?d:"split")||(null!=(c=e.diffIndicators)?c:"bars")!==(null!=(u=t.diffIndicators)?u:"bars")||(null!=(h=e.hunkSeparators)?h:"line-info")!==(null!=(f=t.hunkSeparators)?f:"line-info")||(null!=(p=e.expandUnchanged)&&p)!==(null!=(m=t.expandUnchanged)&&m)||(null!=(g=e.collapsedContextThreshold)?g:1)!==(null!=(v=t.collapsedContextThreshold)?v:1)}(t,e);if(f){const n=this.pendingLayoutReset;this.pendingLayoutReset={metrics:u?c:null==n?void 0:n.metrics,resetFileLayoutCache:!0,resetDiffLayoutCache:!0,includeEstimatedDiffHeights:!0===(null==n?void 0:n.includeEstimatedDiffHeights)||u||Hh(t,e)}}(h||f)&&(this.markLayoutDirtyFromIndex(0),this.scrollDirty=!0),he(t,e)||this.renderOptionsRevision++,!this.isContainerManaged&&this.items.length>0&&this.render()}capturePendingLayoutAnchor(){null!=this.root&&0!==this.items.length&&null==this.pendingScrollTarget&&(this.pendingLayoutAnchor=this.getScrollAnchor(this.getScrollTop()))}render(e=!1){f.__STOP||(e?(le(this.computeRenderRangeAndEmit),this.computeRenderRangeAndEmit()):ae(this.computeRenderRangeAndEmit))}instanceChanged(e,t){const n=this.instanceToItem.get(e);if(null==n)throw new Error("CodeView.instanceChanged: An instance has changed that is not registered");t&&this.markItemLayoutDirty(n),this.render()}getWindowSpecs(){return this.windowSpecs}getContainerElement(){return this.root}getRenderedItems(){const{firstIndex:e,lastIndex:t}=this.renderState;if(-1===e||-1===t||t<e)return[];const n=[];for(let i=e;i<=t;i++){const e=this.items[i];null!=(null==e?void 0:e.element)&&("diff"===e.type?n.push({id:e.item.id,type:"diff",item:e.item,version:e.version,element:e.element,instance:e.instance}):n.push({id:e.item.id,type:"file",item:e.item,version:e.version,element:e.element,instance:e.instance}))}return n}setSlotCoordinator(e){return e!==this.slotCoordinator&&(this.slotCoordinator=e,this.slotSnapshot=void 0,!0)}getSlotSnapshot(e){return zh(this.getRenderedItems(),e)}subscribeToScroll(e){return this.scrollListeners.add(e),()=>{this.scrollListeners.delete(e)}}getLocalTopForInstance(e){const t=this.instanceToItem.get(e);if(null==t)throw new Error("CodeView.getLocalTopForInstance: unknown virtualized instance");return t.top}getTopForItem(e){const t=this.idToItem.get(e);if(null!=t)return t.top+this.getLayout().paddingTop}createItem(e,t,n){const{itemMetricsCache:i}=this;if("diff"===e.type){const r=new ph(this.createDiffOptions(e.id),this,i,this.workerManager,this.isContainerManaged);return{type:"diff",item:e,version:e.version,index:t,top:n,height:0,element:void 0,renderedOptionsRevision:this.renderOptionsRevision,instance:r}}const r=new Dc(this.createFileOptions(e.id),this,i,this.workerManager,this.isContainerManaged);return{type:"file",item:e,version:e.version,index:t,top:n,height:0,element:void 0,renderedOptionsRevision:this.renderOptionsRevision,instance:r}}applySelectedLines(e,t){var n,i,r,o;const{selectedLines:s}=this;null==e&&null==s||null!=e&&(null==s?void 0:s.id)===e.id&&pe(s.range,e.range)||(null!=s&&s.id!==(null==e?void 0:e.id)&&(null==(n=this.idToItem.get(s.id))||n.instance.setSelectedLines(null,{notify:!1})),this.selectedLines=e,null==(o=this.idToItem.get(null!=(i=null==e?void 0:e.id)?i:""))||o.instance.setSelectedLines(null!=(r=null==e?void 0:e.range)?r:null,t))}syncSelection(){if(null==this.selectedLines)return;const e=this.idToItem.get(this.selectedLines.id);null!=e?e.instance.setSelectedLines(this.selectedLines.range,{notify:!1}):this.selectedLines=null}renamePendingScrollTarget(e,t){const{pendingScrollTarget:n}=this;null!=n&&"position"!==n.type&&n.id===e&&(this.pendingScrollTarget={...n,id:t})}renamePendingLayoutAnchor(e,t){var n;(null==(n=this.pendingLayoutAnchor)?void 0:n.id)===e&&(this.pendingLayoutAnchor.id=t)}createFileOptionsPrototype(){const e={};for(const t of xh)Eh(e,t,()=>this.options[t]);Eh(e,"stickyHeader",()=>this.options.stickyHeaders),Eh(e,"collapsed",e=>{var t;return!0===(null==(t=this.getItemOptions(Ih(e),"file"))?void 0:t.item.collapsed)});for(const t of wh)this.defineItemSharedCallback(e,"file",t);for(const t of Lh)this.defineItemSelectionCallback(e,"file",t);return e}createDiffOptionsPrototype(){const e={};for(const t of kh)Eh(e,t,()=>this.options[t]);Eh(e,"stickyHeader",()=>this.options.stickyHeaders),Eh(e,"hunkSeparators",()=>this.options.hunkSeparators),Eh(e,"collapsed",e=>{var t;return!0===(null==(t=this.getItemOptions(Ih(e),"diff"))?void 0:t.item.collapsed)});for(const t of wh)this.defineItemSharedCallback(e,"diff",t);for(const t of Lh)this.defineItemSelectionCallback(e,"diff",t);return e}createFileOptions(e){const t=Object.create(this.fileOptionsPrototype);return Ah(t,{id:e}),t}createDiffOptions(e){const t=Object.create(this.diffOptionsPrototype);return Ah(t,{id:e}),t}updateItemOptionsId(e,t){Ih(e).id=t}getItemOptions(e,t){const n=this.idToItem.get(e.id);if(null!=n&&n.type===t)return n}defineItemSharedCallback(e,t,n){Eh(e,n,e=>{var i;if(null==this.options[n])return;const r=Ih(e),o=null!=(i=r.callbackCache)?i:r.callbackCache={};let s=o[n];return null==s&&(s=(...e)=>{const i=this.getItemOptions(r,t);if(null==i)return;const o=this.options[n];return null==o?void 0:o(...e,i)},o[n]=s),s})}defineItemSelectionCallback(e,t,n){Eh(e,n,e=>{var i;if(!0!==this.options.enableLineSelection)return;const r=Ih(e),o=null!=(i=r.callbackCache)?i:r.callbackCache={};let s=o[n];return null==s&&(s=e=>{var i,o,s;const a=this.getItemOptions(r,t);if(null==a)return;const l=null==e?null:{id:a.item.id,range:e};!0!==this.options.controlledSelection&&(null==e&&(null==(i=this.selectedLines)?void 0:i.id)!==a.item.id||this.applySelectedLines(l,{notify:!1})),null==(s=(o=this.options).onSelectedLinesChange)||s.call(o,l);const d=this.options[n];return null==d?void 0:d(e,a)},o[n]=s),s})}markLayoutDirtyFromIndex(e){var t;this.layoutDirtyIndex=Math.min(null!=(t=this.layoutDirtyIndex)?t:e,e)}markItemLayoutDirty(e){if(this.items[e.index]!==e)throw new Error(`CodeView.markItemLayoutDirty: unknown item id "${e.item.id}"`);this.markLayoutDirtyFromIndex(e.index)}tryAppendItems(e){if(e.length<=this.items.length)return!1;for(let t=0;t<this.items.length;t++){const n=this.items[t];if(null==n)throw new Error("CodeView.tryAppendItems: missing existing item");const i=e[t];if(null==i||n.item.id!==i.id||n.type!==i.type)return!1}for(let t=0;t<this.items.length;t++){const n=this.items[t];if(null==n)throw new Error("CodeView.tryAppendItems: missing existing item");const i=e[t];if(null==i)throw new Error("CodeView.tryAppendItems: append candidate missing prefix item");this.syncItemRecord(n,i)&&this.markLayoutDirtyFromIndex(t)}return this.appendItemsInternal(e.slice(this.items.length),!1),this.scrollDirty=!0,this.render(),!0}reconcileItems(e){const{items:t,idToItem:n}=this,i=new Set(t),r=[],o=/* @__PURE__ */new Map,s=/* @__PURE__ */new Map;let a;for(let l=0;l<e.length;l++){const d=e[l];if(null==d)throw new Error("CodeView.reconcileItems: missing input item");if(o.has(d.id))throw new Error(`CodeView.setItems: duplicate id "${d.id}"`);const c=n.get(d.id),u=null!=c&&c.type===d.type?c:this.createItem(d,l,0);u.index=l,null!=c&&c.type===d.type?(i.delete(c),this.syncItemRecord(u,d)&&(a=Math.min(null!=a?a:l,l))):a=Math.min(null!=a?a:l,l),t[l]!==u&&(a=Math.min(null!=a?a:l,l)),r.push(u),o.set(d.id,u),s.set(u.instance,u)}for(let l=0;l<t.length;l++){const e=t[l];if(null==e||!i.has(e))continue;this.releaseRenderedItem(e);const n=Math.max(r.length-1,0);a=Math.min(null!=a?a:n,n)}null!=a&&(this.items=r,this.idToItem=o,this.instanceToItem=s,this.renderState.firstIndex>=r.length?this.resetRenderState():this.renderState.lastIndex>=r.length&&(this.renderState.lastIndex=r.length-1),this.markLayoutDirtyFromIndex(a),this.scrollDirty=!0,this.render())}syncItemRecord(e,t){if(e.type!==t.type)throw new Error(`CodeView.syncItemRecord: type mismatch for id "${t.id}"`);return e.version!==t.version&&(e.item=t,e.version=t.version,e.renderedOptionsRevision=-1,!0)}getMaxScrollTopForHeight(e){const{paddingBottom:t,paddingTop:n}=this.getLayout();return Math.max(n+e+t-this.getHeight(),0)}getMaxScrollTop(){return this.getMaxScrollTopForHeight(this.getScrollHeight())}shouldRebaseScroll(){return this.getMaxScrollTop()>Rh}getPagedScrollHeight(){return this.shouldRebaseScroll()?Math.min(this.getScrollHeight(),12e6):this.getScrollHeight()}getMaxPagedScrollTop(){return this.getMaxScrollTopForHeight(this.getPagedScrollHeight())}clampPagedScrollTop(e){const t=this.getMaxPagedScrollTop();return Math.max(0,Math.min(e,t))}clampScrollTop(e){const t=this.getMaxScrollTop();return Math.max(0,Math.min(e,t))}getMaxScrollPageOffset(){return Math.max(this.getMaxScrollTop()-this.getMaxPagedScrollTop(),0)}clampScrollPageOffset(e){const t=this.getMaxScrollPageOffset();return Math.max(0,Math.min(e,t))}resolveScrollPageWindow(e,t){let n=Sh(this.clampPagedScrollTop(t)),i=this.clampScrollPageOffset(e-n);return n=Sh(this.clampPagedScrollTop(e-i)),i=this.clampScrollPageOffset(e-n),{pagedScrollTop:n,scrollPageOffset:i}}resolvePagedScrollPosition(e){if(!this.shouldRebaseScroll())return{pagedScrollTop:this.clampPagedScrollTop(e),scrollPageOffset:0};const t=this.clampScrollPageOffset(this.scrollPageOffset),n=e-t,i=this.getMaxPagedScrollTop(),r=this.getMaxScrollPageOffset(),o=n<1e6&&t>0;return n<0||n>i||n>Rh&&t<r||o?this.resolveScrollPageWindow(e,o?Math.min(1e7,i):2e6):{pagedScrollTop:Sh(this.clampPagedScrollTop(n)),scrollPageOffset:t}}needsScrollPageUpdate(e){const t=Sh(this.clampScrollTop(e)),{scrollPageOffset:n}=this.resolvePagedScrollPosition(t);return n!==this.scrollPageOffset}getPagedLayoutTop(e){return this.shouldRebaseScroll()?Math.max(e-this.scrollPageOffset,0):e}getStickyHeaderOffset(){return!0===this.options.stickyHeaders&&!0!==this.options.disableFileHeader?this.itemMetricsCache.diffHeaderHeight:0}getScrollTargetRect(e){const t=this.idToItem.get(e.id);if(null==t)return void console.warn(`CodeView.scrollTo: unknown item id "${e.id}"`);if("item"===e.type)return{top:t.top,height:t.height};if("range"===e.type){const n=this.getRangeScrollPosition(t,e);return null==n?void console.warn(`CodeView.scrollTo: unable to resolve range ${Oh(e.range)} for item "${e.id}"`):{top:t.top+n.top,height:n.height}}const n=this.getLineScrollPosition(t,e);if(null!=n)return{top:t.top+n.top,height:n.height};console.warn(`CodeView.scrollTo: unable to resolve line ${e.lineNumber} for item "${e.id}"`)}normalizeScrollTarget(e){var t;if("position"===e.type||"nearest"!==e.align)return e;const n=this.getScrollTargetRect(e);if(null==n)return;const i=null!=(t=e.offset)?t:0,r=this.getLayout().paddingTop+n.top,o=r+n.height,s=this.getScrollTop(),a=s+("line"===e.type||"range"===e.type?this.getStickyHeaderOffset():0),l=s+this.getHeight();return r-i<=a&&o+i>=l?void 0:r-i<a?{...e,align:"start"}:o+i>l?{...e,align:"end"}:void 0}resolveScrollTargetTop(e){if("position"===e.type){const t=this.clampScrollTop(e.position);return t!==e.position?t:this.clampScrollTop(e.position-this.getStickyHeaderOffset())}const t=this.idToItem.get(e.id);if(null==t)return void console.warn(`CodeView.scrollTo: unknown item id "${e.id}"`);if("item"===e.type)return this.clampScrollTop(this.resolveAlignedScrollPosition(t.top,t.height,e.align,e.offset));if("range"===e.type){const n=this.getRangeScrollPosition(t,e);return null==n?void console.warn(`CodeView.scrollTo: unable to resolve range ${Oh(e.range)} for item "${e.id}"`):this.clampScrollTop(this.resolveAlignedScrollPosition(t.top+n.top,n.height,e.align,e.offset,this.getStickyHeaderOffset()))}const n=this.getLineScrollPosition(t,e);if(null!=n)return this.clampScrollTop(this.resolveAlignedScrollPosition(t.top+n.top,n.height,e.align,e.offset,this.getStickyHeaderOffset()));console.warn(`CodeView.scrollTo: unable to resolve line ${e.lineNumber} for item "${e.id}"`)}resolveAlignedScrollPosition(e,t,n,i=0,r=0){e+=this.getLayout().paddingTop;const o=this.getHeight();return"center"===n&&t+i<o?e-(o-t)/2+i:"end"===n?e-(o-t)+i:e-r-i}getLineScrollPosition(e,t){return"diff"===e.type?e.instance.getLinePosition(t.lineNumber,t.side):e.instance.getLinePosition(t.lineNumber)}getRangeScrollPosition(e,t){var n;const{range:i}=t,r=this.getLineScrollPosition(e,{type:"line",id:t.id,lineNumber:i.start,side:i.side}),o=this.getLineScrollPosition(e,{type:"line",id:t.id,lineNumber:i.end,side:null!=(n=i.endSide)?n:i.side});if(null==r||null==o)return;const s=r.top,a=s+r.height,l=o.top,d=l+o.height,c=Math.min(s,l);return{top:c,height:Math.max(a,d)-c}}computeTargetScrollTopForFrame(e,t){if(null==this.pendingScrollTarget)return e;const n=this.resolveScrollTargetTop(this.pendingScrollTarget);if(null==n)return e;const{scrollAnimation:i}=this;return null==i?n:this.computeSpringStep(i,n,t).position}computeSpringStep(e,t,n){const i=Math.max(0,n-e.lastTimestamp),{omega:r}=this.getSmoothScrollSettings(),o=Math.exp(-r*i),s=e.position-t,a=e.velocity+r*s;return{position:t+(s+a*i)*o,velocity:(a*(1-r*i)-r*s)*o}}advanceScrollAnimation(e,t){if(null==this.pendingScrollTarget)return;const n=this.resolveScrollTargetTop(this.pendingScrollTarget);if(null==n)return this.pendingScrollTarget=void 0,void(this.scrollAnimation=void 0);const i=this.scrollAnimation;if(null==i)return n;i.position+=t;const{position:r,velocity:o}=this.computeSpringStep(i,n,e);i.lastTimestamp=e,i.position=r,i.velocity=o;const{positionEpsilon:s,velocityEpsilon:a}=this.getSmoothScrollSettings();return Math.abs(n-r)<=s&&Math.abs(o)<=a?(i.position=n,i.velocity=0,this.scrollAnimation=void 0,n):i.position}flushManagers(e){for(const t of e)t.instance.flushManagers()}syncContainerHeight(){const e=this.getPagedScrollHeight();null!=this.container&&this.containerHeight!==e&&(this.container.style.height=`${e}px`,this.containerHeight=e)}getStickyBounds(e){var t,n;const{firstIndex:i,lastIndex:r}=null!=e?{firstIndex:this.findFirstVisibleIndex(e.top),lastIndex:this.findLastVisibleIndex(e.bottom)}:this.renderState;if(-1===i||-1===r||i>r)return;const o=null==(t=this.items[i])?void 0:t.instance.getAdvancedStickySpecs(e),s=null==(n=this.items[r])?void 0:n.instance.getAdvancedStickySpecs(e);return null!=o&&null!=s?{stickyTop:this.getPagedLayoutTop(Math.max(o.topOffset,0)),stickyBottom:this.getPagedLayoutTop(s.topOffset+s.height)}:void 0}applyStickyPositioning({stickyTop:e,stickyBottom:t}){const n=this.getHeight(),{itemMetricsCache:i}=this,r=t-e;this.renderState.stickyHeight=r,this.renderState.stickyTop=e,this.renderState.stickyBottom=t,this.stickyOffset.style.height=`${e}px`;const o=-1*(Math.random()*i.lineHeight|0),s=-Math.max(r+o,0)+n;this.stickyContainer.style.top=`${s}px`,this.stickyContainer.style.bottom=`${s+i.diffHeaderHeight}px`}syncPagedScrollScaffolding(e){this.syncContainerHeight();const t=this.getStickyBounds(e);null!=t&&this.applyStickyPositioning(t)}reconcileRenderedItems(e){const{firstIndex:t,lastIndex:n}=this.renderState;if(-1===t)return;let i=-1,r=!1;for(let o=t;o<this.items.length&&(r||!(o>n));o++){const t=this.items[o];if(null==t)throw new Error("CodeView.reconcileRenderedItems: Invalid item");-1===i?i=t.top:t.top!==i&&(t.top=i,t.instance.syncVirtualizedTop(),r=!0),(null==e?o<=n:e.has(t))&&(t.instance.reconcileHeights()&&(r=!0,t.height=t.instance.getVirtualizedHeight()),this.validateRenderedItemHeight(t)),i+=t.instance.getVirtualizedHeight(),o<this.items.length-1&&(i+=this.getLayout().gap)}r&&null!=i&&(this.scrollDirty=!0,this.scrollHeight=i)}updateStickyPositioning(){const e=this.getStickyBounds();if(null==e)return;const{stickyTop:t,stickyBottom:n}=e;n-t===this.renderState.stickyHeight&&t===this.renderState.stickyTop&&n===this.renderState.stickyBottom||this.applyStickyPositioning(e)}getScrollAnchorViewportTop(e,t){return e<t?t+this.getStickyHeaderOffset():t}getScrollAnchor(e){if(null!=this.pendingLayoutAnchor)return this.pendingLayoutAnchor;const{firstIndex:t,lastIndex:n,stickyTop:i,stickyBottom:r}=this.renderState;if(-1===t||-1===n)return;const o=this.getHeight();if(-1!==i&&-1!==r)for(let s=t;s<=n;s++){const t=this.items[s];if(null==t)continue;const n=this.getLayout().paddingTop+t.top;if(n+t.height<=e)continue;if(n>=e+o)break;if(n>=e)return{type:"item",id:t.item.id,viewportOffset:n-e};const i=this.getScrollAnchorViewportTop(n,e)-n,r=t.instance.getNumericScrollAnchor(i);if(null!=r){const i=n+r.top;return{type:"line",id:t.item.id,lineNumber:r.lineNumber,side:r.side,viewportOffset:i-e}}}}resolveAnchoredScrollTop(e){const t=this.idToItem.get(e.id);if(null==t)return;const{paddingTop:n}=this.getLayout();if("item"===e.type){const i=n+t.top;return this.clampScrollTop(i-e.viewportOffset)}const i="diff"===t.type?t.instance.getLinePosition(e.lineNumber,e.side):t.instance.getLinePosition(e.lineNumber);if(null==i)return;const r=n+t.top+i.top;return this.clampScrollTop(r-e.viewportOffset)}applyScrollFix(e,t,n){if(null==this.root)return;const i=Sh(this.clampScrollTop(e)),r=Sh(t),{scrollPageOffset:o}=this,s=Sh(this.clampPagedScrollTop(r-o)),{pagedScrollTop:a,scrollPageOffset:l}=this.resolvePagedScrollPosition(i),d=a,c=o!==l;(i!==this.renderState.scrollTop||i!==r||d!==s||c)&&(this.suspendScrollInteractions(),(d!==s||c)&&(this.scrollPageOffset=l,this.syncPagedScrollScaffolding(n)),d!==s&&this.root.scrollTo({top:d,behavior:"instant"}),this.renderState.scrollTop=i,this.scrollTop=i,this.scrollDirty=!1)}isPendingTargetSettled(e){const t=this.resolveScrollTargetTop(e);return null==t||Sh(this.getScrollTop())===Sh(t)}getScrollTop(){var e,t;if(!this.scrollDirty)return this.scrollTop;this.scrollDirty=!1;const n=null!=(t=null==(e=this.root)?void 0:e.scrollTop)?t:0;return this.scrollTop=this.clampScrollTop(n+this.scrollPageOffset),this.scrollTop}getHeight(){var e,t;return this.heightDirty?(this.heightDirty=!1,this.height=null!=(t=null==(e=this.root)?void 0:e.getBoundingClientRect().height)?t:0,this.height):this.height}getScrollHeight(){return this.scrollHeight}flushSlotCoordinator(){if(null==this.slotCoordinator)return;const{onSnapshotChange:e}=this.slotCoordinator,t=zh(this.getRenderedItems(),this.slotCoordinator);(function(e,t){if(null==e||null==t)return e===t;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){const i=e[n],r=t[n];if(null==i||null==r||i.id!==r.id||i.type!==r.type||i.element!==r.element||i.version!==r.version)return!1}return!0})(this.slotSnapshot,t)||(this.slotSnapshot=t,e(t))}notifyScroll(){if(0===this.scrollListeners.size)return;const e=this.getScrollTop();for(const t of this.scrollListeners)t(e,this)}findFirstVisibleIndex(e){let t=0,n=this.items.length-1,i=this.items.length;for(;t<=n;){const r=t+n>>1,o=this.items[r];if(null==o)throw new Error("CodeView.findFirstVisibleIndex: invalid item index");o.top+o.height>e?(i=r,n=r-1):t=r+1}return i}findLastVisibleIndex(e){let t=0,n=this.items.length-1,i=-1;for(;t<=n;){const r=t+n>>1,o=this.items[r];if(null==o)throw new Error("CodeView.findLastVisibleIndex: invalid item index");o.top<=e?(i=r,t=r+1):n=r-1}return i}recomputeLayout(e=0,t){var n,i;if(0===this.items.length)return void(this.scrollHeight=0);const r=this.getLayout();let o=0;if(e>0){const t=this.items[e-1];if(null==t)throw new Error("CodeView.recomputeLayout: invalid dirty index");o=t.top+t.height+r.gap}for(let s=e;s<this.items.length;s++){const e=this.items[s];if(null==e)throw new Error("CodeView.recomputeLayout: invalid item index");e.top=o,"diff"===e.type?e.height=e.instance.prepareCodeViewItem(e.item.fileDiff,o,t,null!=(n=e.item.annotations)?n:[]):e.height=e.instance.prepareCodeViewItem(e.item.file,o,t,null!=(i=e.item.annotations)?i:[]),o+=e.height,s<this.items.length-1&&(o+=r.gap)}o!==this.scrollHeight&&(this.scrollDirty=!0),this.scrollHeight=o}resetRenderState(){this.renderState.scrollTop=-1,this.renderState.firstIndex=-1,this.renderState.lastIndex=-1,this.renderState.stickyHeight=0,this.renderState.stickyTop=-1,this.renderState.stickyBottom=-1}getFitPerfectlyOverscroll(){return this.getLayout().gap+this.itemMetricsCache.diffHeaderHeight}},y(f,"__STOP",!1),y(f,"__lastScrollPosition",0),f);function Dh(e){var t,n;return e.instance.cleanUp(!0),"diff"===e.type?e.instance.prepareCodeViewItem(e.item.fileDiff,e.top,void 0,null!=(t=e.item.annotations)?t:[]):e.instance.prepareCodeViewItem(e.item.file,e.top,void 0,null!=(n=e.item.annotations)?n:[])}function Hh(e,t){var n,i,r,o,s,a,l,d;return(null!=(n=e.disableFileHeader)&&n)!==(null!=(i=t.disableFileHeader)&&i)||(null!=(r=e.hunkSeparators)?r:"line-info")!==(null!=(o=t.hunkSeparators)?o:"line-info")||(null!=(s=e.expandUnchanged)&&s)!==(null!=(a=t.expandUnchanged)&&a)||(null!=(l=e.collapsedContextThreshold)?l:1)!==(null!=(d=t.collapsedContextThreshold)?d:1)}function _h(e){return e instanceof SVGElement||wc(e)&&(e.hasAttribute("data-core-css")||e.hasAttribute("data-theme-css")||e.hasAttribute("data-unsafe-css"))}function Oh(e){var t;const n=jh(e.start,e.side),i=jh(e.end,null!=(t=e.endSide)?t:e.side);return n===i?n:`${n}-${i}`}function jh(e,t){return null==t?`${e}`:`${"deletions"===t?"D":"A"}${e}`}function Fh(e,t,n=!1){var i,r;return"diff"===e.type?e.instance.render({deferManagers:!0,fileContainer:t,fileDiff:e.item.fileDiff,forceRender:n,lineAnnotations:null!=(i=e.item.annotations)?i:[]}):e.instance.render({deferManagers:!0,fileContainer:t,file:e.item.file,forceRender:n,lineAnnotations:null!=(r=e.item.annotations)?r:[]})}function Bh(e,t,n){null!=n?n.nextSibling!==t&&n.after(t):e.firstChild!==t&&e.prepend(t)}function $h(e){var t,n;return(null!=(n=null==(t=e.annotations)?void 0:t.length)?n:0)>0}function zh(e,{hasHeaderRenderers:t,hasAnnotationRenderer:n,hasGutterRenderer:i}){if(0===e.length)return;if(t||i)return e;if(!n)return;const r=[];for(const o of e)$h(o.item)&&r.push(o);return r.length>0?r:void 0}var Uh=class e{constructor(e){y(this,"options"),y(this,"tokensStable",[]),y(this,"tokensUnstable",[]),y(this,"lastUnstableCodeChunk",""),y(this,"lastStableGrammarState"),this.options=e}async enqueue(e){const t=(this.lastUnstableCodeChunk+e).split("\n"),n=[];let i=[];const r=this.tokensUnstable.length;return t.forEach((e,r)=>{const o=r===t.length-1,s=this.options.highlighter.codeToTokens(e,{...this.options,grammarState:this.lastStableGrammarState}),a=s.tokens[0];o||a.push({content:"\n",offset:0}),o?(i=a,this.lastUnstableCodeChunk=e):(this.lastStableGrammarState=s.grammarState,n.push(...a))}),this.tokensStable.push(...n),this.tokensUnstable=i,{recall:r,stable:n,unstable:i}}close(){const e=this.tokensUnstable;return this.tokensUnstable=[],this.lastUnstableCodeChunk="",this.lastStableGrammarState=void 0,{stable:e}}clear(){this.tokensStable=[],this.tokensUnstable=[],this.lastUnstableCodeChunk="",this.lastStableGrammarState=void 0}clone(){const t=new e(this.options);return t.lastUnstableCodeChunk=this.lastUnstableCodeChunk,t.tokensUnstable=this.tokensUnstable,t.tokensStable=this.tokensStable,t.lastStableGrammarState=this.lastStableGrammarState,t}},Gh=class extends TransformStream{constructor(e){const t=new Uh(e),{allowRecalls:n=!1}=e;super({async transform(e,i){const{stable:r,unstable:o,recall:s}=await t.enqueue(e);n&&s>0&&i.enqueue({recall:s});for(const t of r)i.enqueue(t);if(n)for(const t of o)i.enqueue(t)},async flush(e){const{stable:i}=t.close();if(!n)for(const t of i)e.enqueue(t)}}),y(this,"tokenizer"),y(this,"options"),this.tokenizer=t,this.options=e}};function Wh(e){var t;const n=document.createElement("span");return n.style=so(null!=(t=e.htmlStyle)?t:oo(e)),n.textContent=e.content,n}let Vh=-1;var qh=class{constructor(e={theme:G}){var t;y(this,"options"),y(this,"__id","file-stream:"+ ++Vh),y(this,"highlighter"),y(this,"stream"),y(this,"abortController"),y(this,"fileContainer"),y(this,"pre"),y(this,"code"),y(this,"gutterElement"),y(this,"contentElement"),y(this,"themeCSSStyle"),y(this,"appliedThemeCSS"),y(this,"currentRowCount",0),y(this,"queuedSetupArgs"),y(this,"queuedTokens",[]),y(this,"handleWrite",e=>{var t,n;"recall"in e&&this.queuedTokens.length>=e.recall?this.queuedTokens.length=this.queuedTokens.length-e.recall:this.queuedTokens.push(e),ae(this.render),null==(n=(t=this.options).onStreamWrite)||n.call(t,e)}),y(this,"currentLineIndex"),y(this,"currentLineElement"),y(this,"render",()=>{var e,t,n,i,r,o;null==(t=(e=this.options).onPreRender)||t.call(e,this);const{gutter:s,content:a}=this.getOrCreateStreamColumns(),l=document.createDocumentFragment(),d=document.createDocumentFragment();for(const c of this.queuedTokens)if("recall"in c){if(null==this.currentLineElement)throw new Error("FileStream.render: no current line element, shouldnt be possible to get here");if(c.recall>this.currentLineElement.childNodes.length)throw new Error("FileStream.render: Token recall exceed the current line, there's probably a bug...");for(let e=0;e<c.recall;e++)null==(n=this.currentLineElement.lastChild)||n.remove()}else{const e=Wh(c);if(null==this.currentLineElement){const{gutterLine:e,contentLine:t}=this.createLine();l.appendChild(e),d.appendChild(t)}if(null==(i=this.currentLineElement)||i.appendChild(e),"\n"===c.content){this.currentLineIndex++;const{gutterLine:e,contentLine:t}=this.createLine();l.appendChild(e),d.appendChild(t)}}l.childNodes.length>0&&s.appendChild(l),d.childNodes.length>0&&a.appendChild(d),this.queuedTokens.length=0,null==(o=(r=this.options).onPostRender)||o.call(r,this)}),this.options=e,this.currentLineIndex=null!=(t=this.options.startingLineIndex)?t:1}cleanUp(){var e;null==(e=this.abortController)||e.abort(),this.abortController=void 0}setThemeType(e){var t;(null!=(t=this.options.themeType)?t:"system")!==e&&(this.options={...this.options,themeType:e},"string"!=typeof this.options.theme&&null!=this.fileContainer&&null!=this.appliedThemeCSS&&this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType))}async initializeHighlighter(){return this.highlighter=await Vl(Cd(this.options.lang,this.options)),this.highlighter}async setup(e,t){const n=null!=this.queuedSetupArgs;if(this.queuedSetupArgs=[e,t],n)return;null!=this.highlighter||(this.highlighter=await this.initializeHighlighter());const[i,r]=this.queuedSetupArgs;this.queuedSetupArgs=void 0;const o=i;this.setupStream(o,r,this.highlighter)}setupStream(e,t,n){var i,r,o,s;const{disableLineNumbers:a=!1,overflow:l="scroll",theme:d=G,themeType:c="system"}=this.options,u=this.getOrCreateFileContainer();null==u.parentElement&&t.appendChild(u),null!=this.pre||(this.pre=document.createElement("pre")),null==this.pre.parentElement&&(null==(i=u.shadowRoot)||i.appendChild(this.pre));const h="string"==typeof d?n.getTheme(d).type:void 0,f=Bd({theme:d,highlighter:n});this.applyThemeState(u,f,c,h);const p=xc(this.pre,{type:"file",diffIndicators:"none",disableBackground:!0,disableLineNumbers:a,overflow:l,split:!1,totalLines:0});p.textContent="",this.pre=p,this.code=Sc({code:this.code,pre:p}),this.gutterElement=void 0,this.contentElement=void 0,this.currentRowCount=0,this.currentLineElement=void 0,this.currentLineIndex=null!=(r=this.options.startingLineIndex)?r:1,null==(o=this.abortController)||o.abort(),this.abortController=new AbortController;const{onStreamStart:m,onStreamClose:g,onStreamAbort:v}=this.options;null==(s=this.stream)||s.cancel().catch(()=>{}),this.stream=e,this.stream.pipeThrough(new Gh("string"==typeof d?{...this.options,theme:d,highlighter:n,allowRecalls:!0,defaultColor:!1,cssVariablePrefix:Rd("token"),tokenizeTimeLimit:0}:{...this.options,themes:d,highlighter:n,allowRecalls:!0,defaultColor:!1,cssVariablePrefix:Rd("token"),tokenizeTimeLimit:0})).pipeTo(new WritableStream({start(e){null==m||m(e)},close(){null==g||g()},abort(e){null==v||v(e)},write:this.handleWrite}),{signal:this.abortController.signal}).catch(e=>{"AbortError"!==e.name&&console.error("FileStream pipe error:",e)})}getOrCreateStreamColumns(){if(null==this.code)throw new Error("FileStream: expected code element to exist");if(null!=this.gutterElement&&null!=this.contentElement)return{gutter:this.gutterElement,content:this.contentElement};const e=document.createElement("div");e.dataset.gutter="";const t=document.createElement("div");return t.dataset.content="",this.code.appendChild(e),this.code.appendChild(t),this.gutterElement=e,this.contentElement=t,{gutter:e,content:t}}updateRowSpan(){null!=this.gutterElement&&(this.gutterElement.style.gridRow=`span ${this.currentRowCount}`),null!=this.contentElement&&(this.contentElement.style.gridRow=`span ${this.currentRowCount}`)}createLine(){const e=this.currentLineIndex,t=""+(e-1),n=document.createElement("div");n.dataset.columnNumber=`${e}`,n.dataset.lineType="context",n.dataset.lineIndex=t;const i=document.createElement("span");i.dataset.lineNumberContent="",i.textContent=`${e}`,n.appendChild(i);const r=document.createElement("div");return r.dataset.line=`${e}`,r.dataset.lineType="context",r.dataset.lineIndex=t,this.currentRowCount+=1,this.updateRowSpan(),this.currentLineElement=r,{gutterLine:n,contentLine:r}}getOrCreateFileContainer(e){return null!=e&&e===this.fileContainer||null==e&&null!=this.fileContainer||(null!=this.fileContainer&&null!=e&&e!==this.fileContainer&&(this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0),this.fileContainer=null!=e?e:document.createElement("diffs-container")),this.fileContainer}applyThemeState(e,t,n,i){var r,o,s,a;const l=null!=(r=e.shadowRoot)?r:e.attachShadow({mode:"open"}),d=null!=i?i:n,c=null!=(o=this.options.theme)?o:G,u="string"==typeof c?c:{...c},h=hc(l);(null==(s=this.themeCSSStyle)?void 0:s.parentNode)!==l||(null==(a=this.appliedThemeCSS)?void 0:a.themeStyles)!==t||this.appliedThemeCSS.themeType!==d||this.appliedThemeCSS.scrollbarGutter!==h?(this.themeCSSStyle=Tc({shadowRoot:l,currentNode:this.themeCSSStyle,themeCSS:yc(t,d,h)}),this.appliedThemeCSS=null!=this.themeCSSStyle?{theme:u,themeStyles:t,themeType:d,baseThemeType:i,scrollbarGutter:h}:void 0):this.appliedThemeCSS.theme=u}};function Kh(e,t){const{resolution:n,hunkIndex:i,startContentIndex:r,endContentIndex:o,indexesToDelete:s=/* @__PURE__ */new Set}=t,a=e.hunks[i];if(null==a)throw console.error({diff:e,hunkIndex:i}),new Error(`resolveRegion: Invalid hunk index: ${i}`);if(r<0||o>=a.hunkContent.length||r>o)throw new Error(`resolveRegion: Invalid content range, ${r}, ${o}`);const{hunks:l,additionLines:d,deletionLines:c}=e,u={...e,hunks:[],deletionLines:[],additionLines:[],splitLineCount:0,unifiedLineCount:0,cacheKey:null!=e.cacheKey?`${e.cacheKey}:${n[0]}-${i}:${r}-${o}`:void 0},h={nextAdditionLineIndex:0,nextDeletionLineIndex:0,nextAdditionStart:1,nextDeletionStart:1,splitLineCount:0,unifiedLineCount:0},f=i===l.length-1&&o===a.hunkContent.length-1,p=!e.isPartial;for(const[g,v]of l.entries()){Qh(e,u,h,v.deletionLineIndex-v.collapsedBefore,v.additionLineIndex-v.collapsedBefore,v.collapsedBefore,p);const t={...v,hunkContent:[],additionStart:h.nextAdditionStart,deletionStart:h.nextDeletionStart,additionLineIndex:h.nextAdditionLineIndex,deletionLineIndex:h.nextDeletionLineIndex,additionCount:0,deletionCount:0,deletionLines:0,additionLines:0,splitLineStart:h.splitLineCount,unifiedLineStart:h.unifiedLineCount,splitLineCount:0,unifiedLineCount:0};for(const[e,a]of v.hunkContent.entries())if(g!==i||e<r||e>o){Yh(a,u,c,d);const e={...a,additionLineIndex:h.nextAdditionLineIndex,deletionLineIndex:h.nextDeletionLineIndex};t.hunkContent.push(e),Zh(e,h,t)}else if(s.has(e))t.hunkContent.push({type:"context",lines:0,deletionLineIndex:h.nextDeletionLineIndex,additionLineIndex:h.nextAdditionLineIndex});else if("context"===a.type){Yh(a,u,c,d);const e={...a,deletionLineIndex:h.nextDeletionLineIndex,additionLineIndex:h.nextAdditionLineIndex};t.hunkContent.push(e),Zh(e,h,t)}else{Jh(n,a,u,c,d);const e={type:"context",lines:"deletions"===n?a.deletions:"additions"===n?a.additions:a.deletions+a.additions,deletionLineIndex:h.nextDeletionLineIndex,additionLineIndex:h.nextAdditionLineIndex};t.hunkContent.push(e),Zh(e,h,t)}if(g===i&&f){const e="deletions"===n?v.noEOFCRDeletions:v.noEOFCRAdditions;t.noEOFCRAdditions=e,t.noEOFCRDeletions=e}u.hunks.push(t)}const m=l.at(-1);return null==m||e.isPartial||Xh(u,c,d,m.deletionLineIndex+m.deletionCount,m.additionLineIndex+m.additionCount,Math.min(c.length-(m.deletionLineIndex+m.deletionCount),d.length-(m.additionLineIndex+m.additionCount))),u.splitLineCount=h.splitLineCount,u.unifiedLineCount=h.unifiedLineCount,u}function Xh(e,t,n,i,r,o){for(let s=0;s<o;s++){const o=t[i+s],a=n[r+s];if(null==o||null==a)throw new Error("pushCollapsedContextLines: missing collapsed context line");e.deletionLines.push(o),e.additionLines.push(a)}}function Qh(e,t,n,i,r,o,s){o<=0||(s&&(Xh(t,e.deletionLines,e.additionLines,i,r,o),n.nextAdditionLineIndex+=o,n.nextDeletionLineIndex+=o),n.nextAdditionStart+=o,n.nextDeletionStart+=o,n.splitLineCount+=o,n.unifiedLineCount+=o)}function Yh(e,t,n,i){if("context"===e.type)for(let r=0;r<e.lines;r++){const n=i[e.additionLineIndex+r];if(null==n)throw console.error({additionLines:i,content:e,i:r}),new Error("pushContentLinesToDiff: Context line does not exist");t.deletionLines.push(n),t.additionLines.push(n)}else{const r=Math.max(e.deletions,e.additions);for(let o=0;o<r;o++){if(o<e.deletions){const i=n[e.deletionLineIndex+o];if(null==i)throw console.error({deletionLines:n,content:e,i:o}),new Error("pushContentLinesToDiff: Deletion line does not exist");t.deletionLines.push(i)}if(o<e.additions){const n=i[e.additionLineIndex+o];if(null==n)throw console.error({additionLines:i,content:e,i:o}),new Error("pushContentLinesToDiff: Addition line does not exist");t.additionLines.push(n)}}}}function Jh(e,t,n,i,r){if("deletions"===e||"both"===e)for(let o=0;o<t.deletions;o++){const e=i[t.deletionLineIndex+o];if(null==e)throw console.error({deletionLines:i,content:t,i:o}),new Error("pushResolveLinesToDiff: Deletion line does not exist");n.deletionLines.push(e),n.additionLines.push(e)}if("additions"===e||"both"===e)for(let o=0;o<t.additions;o++){const e=r[t.additionLineIndex+o];if(null==e)throw console.error({additionLines:r,content:t,i:o}),new Error("pushResolveLinesToDiff: Addition line does not exist");n.deletionLines.push(e),n.additionLines.push(e)}}function Zh(e,t,n){"context"===e.type?(t.nextAdditionLineIndex+=e.lines,t.nextDeletionLineIndex+=e.lines,t.nextAdditionStart+=e.lines,t.nextDeletionStart+=e.lines,t.splitLineCount+=e.lines,t.unifiedLineCount+=e.lines,n.additionCount+=e.lines,n.deletionCount+=e.lines,n.splitLineCount+=e.lines,n.unifiedLineCount+=e.lines):(t.nextAdditionLineIndex+=e.additions,t.nextDeletionLineIndex+=e.deletions,t.nextAdditionStart+=e.additions,t.nextDeletionStart+=e.deletions,t.splitLineCount+=Math.max(e.deletions,e.additions),t.unifiedLineCount+=e.deletions+e.additions,n.deletionCount+=e.deletions,n.deletionLines+=e.deletions,n.additionCount+=e.additions,n.additionLines+=e.additions,n.splitLineCount+=Math.max(e.deletions,e.additions),n.unifiedLineCount+=e.deletions+e.additions)}function ef(e){const t="string"==typeof e?e:e.type;return"accept"===t||"incoming"===t?"additions":"reject"===t||"current"===t?"deletions":"both"}function tf(e,t,n){return Kh(e,{resolution:ef(n),hunkIndex:t.hunkIndex,startContentIndex:t.startContentIndex,endContentIndex:t.endContentIndex,indexesToDelete:nf(t)})}function nf(e){const t=/* @__PURE__ */new Set;return null!=e.baseContentIndex&&t.add(e.baseContentIndex),e.endMarkerContentIndex!==e.endContentIndex&&t.add(e.endMarkerContentIndex),t}function rf({hunkIndex:e,lineIndex:t,conflictIndex:n}){return`merge-conflict-action-${e}-${t}-${n}`}function of(e,t){const n=t.hunks[e.hunkIndex];if(null!=n)return{hunkIndex:e.hunkIndex,lineIndex:Sf(n,e.startContentIndex)}}function sf(e,t=6){const n={deletionLines:[],additionLines:[],conflictStack:[],conflictBuilders:[],actions:[],hunks:[],nextConflictIndex:0,splitLineCount:0,unifiedLineCount:0,lastHunkEnd:0,activeHunk:void 0,maxContextLines:t=Math.max(t,1),maxContextLines2:2*t},i=e.contents,r=i.length;if(r>0){let e=0,t=0,o=i.indexOf("\n",e);for(;-1!==o;)af(n,i.slice(e,o+1),t),e=o+1,t++,o=i.indexOf("\n",e);e<r&&af(n,i.slice(e),t)}if(n.conflictStack.length>0)throw new Error("parseMergeConflictDiffFromFile: unfinished merge conflict marker stack");null!=n.activeHunk&&n.activeHunk.hunkContent.length>0&&(cf(n,n.activeHunk,"trailing"),uf(n));for(let u=0;u<n.conflictBuilders.length;u++){const e=n.conflictBuilders[u];if(null==e||!e.completed)throw new Error(`parseMergeConflictDiffFromFile: failed to build merge conflict action ${u}`)}if(n.hunks.length>0&&n.additionLines.length>0&&n.deletionLines.length>0){const e=n.hunks[n.hunks.length-1],t=Math.max(n.additionLines.length-(e.additionStart+e.additionCount-1),0);n.splitLineCount+=t,n.unifiedLineCount+=t}const o=n.deletionLines.join(""),s=n.additionLines.join(""),a=bf(e,"current",o),l=bf(e,"incoming",s);let d="change";""===s?d="deleted":""===o&&(d="new");const c={name:e.name,prevName:void 0,type:d,hunks:n.hunks,splitLineCount:n.splitLineCount,unifiedLineCount:n.unifiedLineCount,isPartial:!1,deletionLines:n.deletionLines,additionLines:n.additionLines,cacheKey:null!=e.cacheKey?`${e.cacheKey}:merge-conflict-diff`:void 0};return{fileDiff:c,currentFile:a,incomingFile:l,actions:n.actions,markerRows:yf(c,n.actions)}}function af(e,t,n){const i=e.conflictStack[e.conflictStack.length-1];if(null==i)return t.length>=7&&60===t.charCodeAt(0)&&"start"===vf(t)?void pf(e,t,n):void hf(e,t);const r=vf(t);if("start"!==r){if("base"===r)return i.stage="base",i.baseMarkerLineIndex=n,void(i.markerLines.base=t);if("separator"===r)return i.stage="incoming",i.separatorLineIndex=n,void(i.markerLines.separator=t);if("end"===r){const i=e.conflictStack.pop();if(null==i)throw new Error("parseMergeConflictDiffFromFile: encountered end marker before start marker");return void function(e,t,n,i){var r;if(null==t.separatorLineIndex||null==t.markerLines.separator)throw new Error(`parseMergeConflictDiffFromFile: conflict ${t.conflictIndex} is missing a separator marker`);const o=e.conflictBuilders[t.conflictIndex];if(null==o)throw new Error(`parseMergeConflictDiffFromFile: failed to finalize conflict ${t.conflictIndex}`);const s=o.action;s.markerLines.separator=t.markerLines.separator,s.markerLines.end=i,null!=t.markerLines.base&&(s.markerLines.base=t.markerLines.base),s.conflict={conflictIndex:t.conflictIndex,startLineIndex:t.startLineIndex,startLineNumber:t.startLineIndex+1,separatorLineIndex:t.separatorLineIndex,separatorLineNumber:t.separatorLineIndex+1,endLineIndex:n,endLineNumber:n+1,baseMarkerLineIndex:t.baseMarkerLineIndex,baseMarkerLineNumber:null!=t.baseMarkerLineIndex?t.baseMarkerLineIndex+1:void 0};const a=null!=(r=s.currentContentIndex)?r:s.incomingContentIndex;if(null!=s.currentContentIndex||(s.currentContentIndex=a),null!=s.incomingContentIndex||(s.incomingContentIndex=a),s.startContentIndex<0&&null!=a&&(s.startContentIndex=a),s.endContentIndex<0&&null!=a&&(s.endContentIndex=a),s.endMarkerContentIndex<0&&null!=a&&(s.endMarkerContentIndex=a),s.hunkIndex<0||s.startContentIndex<0||s.endContentIndex<0||s.endMarkerContentIndex<0)throw new Error(`parseMergeConflictDiffFromFile: failed to anchor merge conflict ${t.conflictIndex}`);e.actions[s.conflictIndex]=s,o.completed=!0}(e,i,n,t)}"current"===i.stage?ff(e,"deletion",t,i.conflictIndex,"current"):"base"===i.stage?hf(e,t,i.conflictIndex):ff(e,"addition",t,i.conflictIndex,"incoming")}else pf(e,t,n)}function lf(e){return null!=e.activeHunk||(e.activeHunk=mf(e.additionLines.length+1,e.deletionLines.length+1)),e.activeHunk}function df(e,t,n,i){const r=e.conflictBuilders[t];if(null==r)throw new Error(`parseMergeConflictDiffFromFile: failed to locate conflict action ${t}`);const o=r.action,s=e.hunks.length;if(o.hunkIndex<0)o.hunkIndex=s;else if(o.hunkIndex!==s)throw new Error(`parseMergeConflictDiffFromFile: conflict ${t} spans multiple hunks and cannot be anchored`);o.startContentIndex<0&&(o.startContentIndex=i),o.endContentIndex=i,o.endMarkerContentIndex=i,"current"!==n?"base"!==n?o.incomingContentIndex=i:null!=o.baseContentIndex||(o.baseContentIndex=i):null!=o.currentContentIndex||(o.currentContentIndex=i)}function cf(e,t,n){let i=t.contextBufferCount,r=t.contextBufferAdditionStart,o=t.contextBufferDeletionStart;if("leading"===n&&i>e.maxContextLines){const n=i-e.maxContextLines;r+=n,o+=n,i=e.maxContextLines,t.additionStart+=n,t.deletionStart+=n,t.additionLineIndex+=n,t.deletionLineIndex+=n}if("trailing"===n&&i>e.maxContextLines&&(i=e.maxContextLines),0===i)return t.contextBufferCount=0,void(t.contextBufferBaseConflicts=void 0);const s=t.hunkContent,a=s[s.length-1];let l;"context"===(null==a?void 0:a.type)?(a.lines+=i,l=s.length-1):(s.push({type:"context",lines:i,additionLineIndex:r,deletionLineIndex:o}),l=s.length-1),t.additionCount+=i,t.deletionCount+=i;const d=t.contextBufferBaseConflicts;if(null!=d){const n=r-t.contextBufferAdditionStart;for(const[t,r]of d)t>=n&&t<n+i&&df(e,r,"base",l)}t.contextBufferCount=0,t.contextBufferBaseConflicts=void 0}function uf(e){if(null==e.activeHunk)return;const t=e.activeHunk;if(e.activeHunk=void 0,0===t.hunkContent.length)return;let n=0,i=0;for(const s of t.hunkContent)"context"===s.type?(n+=s.lines,i+=s.lines):(n+=Math.max(s.additions,s.deletions),i+=s.additions+s.deletions);const r=Math.max(t.additionStart-1-e.lastHunkEnd,0),o={collapsedBefore:r,additionStart:t.additionStart,additionCount:t.additionCount,additionLines:t.additionLines,additionLineIndex:t.additionLineIndex,deletionStart:t.deletionStart,deletionCount:t.deletionCount,deletionLines:t.deletionLines,deletionLineIndex:t.deletionLineIndex,hunkContent:t.hunkContent,hunkContext:void 0,hunkSpecs:`@@ -${gf(t.deletionStart,t.deletionCount)} +${gf(t.additionStart,t.additionCount)} @@\n`,splitLineStart:e.splitLineCount+r,splitLineCount:n,unifiedLineStart:e.unifiedLineCount+r,unifiedLineCount:i,noEOFCRAdditions:!1,noEOFCRDeletions:!1};e.hunks.push(o),e.splitLineCount+=r+n,e.unifiedLineCount+=r+i,e.lastHunkEnd=t.additionStart+t.additionCount-1}function hf(e,t,n=-1){const i=lf(e);0===i.contextBufferCount&&(i.contextBufferAdditionStart=e.additionLines.length,i.contextBufferDeletionStart=e.deletionLines.length),e.additionLines.push(t),e.deletionLines.push(t),n>=0&&(null!=i.contextBufferBaseConflicts||(i.contextBufferBaseConflicts=/* @__PURE__ */new Map),i.contextBufferBaseConflicts.set(i.contextBufferCount,n)),i.contextBufferCount++}function ff(e,t,n,i,r){let o=lf(e);o.hunkContent.length>0&&o.contextBufferCount>e.maxContextLines2&&(function(e){if(null==e.activeHunk)return;const t=e.activeHunk,n=t.contextBufferCount,i=n-e.maxContextLines2,r=t.contextBufferAdditionStart+n-e.maxContextLines,o=t.contextBufferDeletionStart+n-e.maxContextLines;let s;if(null!=t.contextBufferBaseConflicts){const i=n-e.maxContextLines;for(const[e,n]of t.contextBufferBaseConflicts)e>=i&&(null!=s||(s=/* @__PURE__ */new Map),s.set(e-i,n))}cf(e,t,"trailing");const a=t.additionCount,l=t.deletionCount;uf(e),e.activeHunk=mf(t.additionStart+a+i,t.deletionStart+l+i),e.activeHunk.contextBufferAdditionStart=r,e.activeHunk.contextBufferDeletionStart=o,e.activeHunk.contextBufferCount=e.maxContextLines,e.activeHunk.contextBufferBaseConflicts=s}(e),o=e.activeHunk),cf(e,o,0===o.hunkContent.length?"leading":"before-change");const s=e.additionLines.length,a=e.deletionLines.length;"addition"===t?e.additionLines.push(n):e.deletionLines.push(n);const l=function(e,t,n,i){const r=e.hunkContent,o=r[r.length-1];return"change"===(null==o?void 0:o.type)?("addition"===t?o.additions++:o.deletions++,r.length-1):(r.push({type:"change",additions:"addition"===t?1:0,deletions:"deletion"===t?1:0,additionLineIndex:n,deletionLineIndex:i}),r.length-1)}(o,t,s,a);"addition"===t?(o.additionCount++,o.additionLines++):(o.deletionCount++,o.deletionLines++),df(e,i,r,l)}function pf(e,t,n){const i=e.nextConflictIndex;e.nextConflictIndex++,e.conflictStack.push({conflictIndex:i,stage:"current",startLineIndex:n,markerLines:{start:t}}),e.conflictBuilders[i]={completed:!1,action:{conflict:{conflictIndex:i,startLineIndex:n,startLineNumber:n+1,separatorLineIndex:n,separatorLineNumber:n+1,endLineIndex:n,endLineNumber:n+1,baseMarkerLineIndex:void 0,baseMarkerLineNumber:void 0},conflictIndex:i,hunkIndex:-1,startContentIndex:-1,endContentIndex:-1,endMarkerContentIndex:-1,markerLines:{start:t,separator:"",end:""}}}}function mf(e,t){return{additionStart:e,deletionStart:t,additionCount:0,deletionCount:0,additionLines:0,deletionLines:0,additionLineIndex:Math.max(e-1,0),deletionLineIndex:Math.max(t-1,0),hunkContent:[],contextBufferAdditionStart:Math.max(e-1,0),contextBufferDeletionStart:Math.max(t-1,0),contextBufferCount:0,contextBufferBaseConflicts:void 0}}function gf(e,t){return 1===t?`${e}`:`${e},${t}`}function vf(e){if(e.length<7)return;const t=e.charCodeAt(0);if(60!==t&&62!==t&&61!==t&&124!==t)return;const n=function(e){let t=e.length;return t>0&&10===e.charCodeAt(t-1)&&t--,t>0&&13===e.charCodeAt(t-1)&&t--,t}(e);if(n<7)return;let i=1;for(;i<n&&e.charCodeAt(i)===t;)i++;if(!(i<7)){if(61===t)return i===n?"separator":void 0;var r;if(i===n||9===(r=e.charCodeAt(i))||10===r||11===r||12===r||13===r||32===r)return 60===t?"start":62===t?"end":"base"}}function bf(e,t,n){return{...e,contents:n,cacheKey:null!=e.cacheKey?`${e.cacheKey}:merge-conflict-${t}`:void 0}}function yf(e,t){const n=[],i=new Array(e.hunks.length),r=(t,n)=>{var r;const o=e.hunks[t];if(null==o)return 0;let s=i[t];if(null==s){s=new Array(o.hunkContent.length+1);let e=o.unifiedLineStart;s[0]=e;for(let t=0;t<o.hunkContent.length;t++){const n=o.hunkContent[t];e+="context"===n.type?n.lines:n.deletions+n.additions,s[t+1]=e}i[t]=s}return null!=(r=s[Math.max(n,0)])?r:o.unifiedLineStart},o=(e,t)=>{var n,o;const s=r(e,t),a=null!=(o=null==(n=i[e])?void 0:n[Math.max(t+1,0)])?o:r(e,t+1);return Math.max(s,a-1)};for(const s of t){if(null==s)continue;const t=e.hunks[s.hunkIndex];if(null==t)continue;const i=r(s.hunkIndex,s.startContentIndex);if(n.push(Cf(s,"marker-start",s.startContentIndex,s.markerLines.start,i)),null!=s.baseContentIndex){const e=s.currentContentIndex,i=s.incomingContentIndex;if(null==e||null==i)continue;const a=s.markerLines.base;if(null==a)continue;const l=t.hunkContent[e],d=t.hunkContent[s.baseContentIndex],c=t.hunkContent[i];if("change"!==(null==l?void 0:l.type)||"context"!==(null==d?void 0:d.type)||"change"!==(null==c?void 0:c.type))continue;const u=r(s.hunkIndex,e),h=r(s.hunkIndex,i);n.push(Cf(s,"marker-base",s.baseContentIndex,a,u+l.deletions)),n.push(Cf(s,"marker-separator",s.baseContentIndex,s.markerLines.separator,h),Cf(s,"marker-end",s.endMarkerContentIndex,s.markerLines.end,o(s.hunkIndex,s.endMarkerContentIndex)));continue}const a=s.currentContentIndex;if(null==a)continue;const l=t.hunkContent[a];if("change"!==(null==l?void 0:l.type))continue;const d=r(s.hunkIndex,a),c=l.deletions>0?d+l.deletions:i;n.push(Cf(s,"marker-separator",a,s.markerLines.separator,c),Cf(s,"marker-end",s.endMarkerContentIndex,s.markerLines.end,o(s.hunkIndex,s.endMarkerContentIndex)))}return n}function Cf(e,t,n,i,r){return{type:t,hunkIndex:e.hunkIndex,contentIndex:n,conflictIndex:e.conflictIndex,lineText:i,lineIndex:r}}function Sf(e,t){let n=e.unifiedLineStart;for(let i=0;i<t;i++){const t=e.hunkContent[i];n+="context"===t.type?t.lines:t.deletions+t.additions}return n}var kf=class extends Qu{constructor(e={theme:G},t,n){super(void 0,t,n),y(this,"pendingConflictActions",[]),y(this,"pendingMarkerRows",[]),y(this,"injectedRows",/* @__PURE__ */new Map),y(this,"options"),y(this,"getUnifiedInjectedRowsForLine",e=>{const t=this.injectedRows.get(`${e.hunkIndex}:${e.lineIndex}`);if(null==t||0===t.length)return;const{mergeConflictActionsType:n}=this.getOptionsWithDefaults(),i=[],r=[];for(const o of t)"actions"!==o.type?("marker-end"===o.type?r:i).push({content:Af(o),gutter:Lf("marker",o.type)}):i.push({content:Tf({row:o,includeDefaultActions:"default"===n,includeSlot:!0}),gutter:Lf("action")});return{before:i.length>0?i:void 0,after:r.length>0?r:void 0}}),this.options=e}setConflictState(e,t,n){this.pendingConflictActions=e,this.pendingMarkerRows=t,this.syncInjectedRows(e,t,n)}syncInjectedRows(e,t,n){this.injectedRows.clear();for(const i of e){const e=null!=i?of(i,n):void 0;if(null==i||null==e)continue;const t={type:"actions",hunkIndex:e.hunkIndex,lineIndex:e.lineIndex,conflictIndex:i.conflictIndex};this.addInjectedRow(t)}for(const i of t)this.addInjectedRow(i)}addInjectedRow(e){const t=`${e.hunkIndex}:${e.lineIndex}`,n=this.injectedRows.get(t);null==n?this.injectedRows.set(t,[e]):n.push(e)}renderDiff(e,t=ie){return null!=e&&this.syncInjectedRows(this.pendingConflictActions,this.pendingMarkerRows,e),super.renderDiff(e,t)}async asyncRender(e,t=ie){return this.syncInjectedRows(this.pendingConflictActions,this.pendingMarkerRows,e),super.asyncRender(e,t)}createPreElement(e,t){return super.createPreElement(e,t,{"data-has-merge-conflict":""})}getUnifiedLineDecoration({type:e,lineType:t}){const n="change"===e?"change-deletion"===t?"current":"incoming":void 0;return{gutterLineType:"change"===e?"context":t,gutterProperties:xf(n),contentProperties:wf(e,n)}}getSplitLineDecoration({side:e,type:t}){const n="change"===t?"deletions"===e?"current":"incoming":void 0;return{gutterLineType:"change"===t?"context":t,gutterProperties:xf(n),contentProperties:wf(t,n)}}getOptionsWithDefaults(){var e;const t=super.getOptionsWithDefaults();return t.diffStyle="unified",t.lineDiffType="none",t.mergeConflictActionsType=null!=(e=this.options.mergeConflictActionsType)?e:"default",t}};function xf(e){return null!=e?{"data-merge-conflict":e}:void 0}function wf(e,t){if(null!=t)return"change"===e?"current"===t||"incoming"===t?{"data-line-type":"context","data-merge-conflict":t}:void 0:"marker-start"===t||"marker-base"===t||"marker-separator"===t||"marker-end"===t?{"data-merge-conflict":t}:void 0}function Lf(e,t){const n=xe(void 0,"annotation",1);return n.properties["data-gutter-buffer"]="action"===e?"merge-conflict-action":`merge-conflict-${null!=t?t:"marker"}`,n}function Tf({row:e,includeDefaultActions:t,includeSlot:n}){const i=t?[If({resolution:"current",label:"Accept current change",conflictIndex:r=e.conflictIndex}),Ef(),If({resolution:"incoming",label:"Accept incoming change",conflictIndex:r}),Ef(),If({resolution:"both",label:"Accept both",conflictIndex:r})]:[];var r;return i.push(be({tagName:"slot",properties:{name:rf({hunkIndex:e.hunkIndex,lineIndex:e.lineIndex,conflictIndex:e.conflictIndex}),"data-merge-conflict-action-slot":""}})),be({tagName:"div",properties:{"data-merge-conflict-actions":""},children:[be({tagName:"div",properties:{"data-merge-conflict-actions-content":""},children:i})]})}function Af(e){return be({tagName:"div",properties:{"data-merge-conflict":e.type,"data-merge-conflict-marker-row":""},children:[ve(e.lineText.replace(/(?:\r\n|\n|\r)$/,""))]})}function If({resolution:e,label:t,conflictIndex:n}){return be({tagName:"button",properties:{type:"button","data-merge-conflict-action":e,"data-merge-conflict-conflict-index":`${n}`},children:[ve(t)]})}function Ef(){return be({tagName:"span",properties:{"data-merge-conflict-action-separator":""},children:[ve("|")]})}function Mf(e,t){return e.hunkIndex===t.hunkIndex&&e.startContentIndex===t.startContentIndex&&e.endContentIndex===t.endContentIndex&&e.currentContentIndex===t.currentContentIndex&&e.baseContentIndex===t.baseContentIndex&&e.incomingContentIndex===t.incomingContentIndex&&e.endMarkerContentIndex===t.endMarkerContentIndex&&e.conflictIndex===t.conflictIndex&&function(e,t){return e.conflictIndex===t.conflictIndex&&e.startLineIndex===t.startLineIndex&&e.startLineNumber===t.startLineNumber&&e.separatorLineIndex===t.separatorLineIndex&&e.separatorLineNumber===t.separatorLineNumber&&e.endLineIndex===t.endLineIndex&&e.endLineNumber===t.endLineNumber&&e.baseMarkerLineIndex===t.baseMarkerLineIndex&&e.baseMarkerLineNumber===t.baseMarkerLineNumber}(e.conflict,t.conflict)}let Rf=-1;var Pf=class extends dh{constructor(e={theme:G},t,n=!1){super(void 0,t,n),y(this,"options"),y(this,"__id","unresolved-file:"+ ++Rf),y(this,"type","unresolved-file"),y(this,"computedCache",{file:void 0,fileDiff:void 0,actions:void 0,markerRows:void 0}),y(this,"conflictActions",[]),y(this,"markerRows",[]),y(this,"conflictActionCache",/* @__PURE__ */new Map),y(this,"handleMergeConflictActionClick",e=>{const t=this.conflictActions[e.conflictIndex];if(null==t)return;if(t.conflictIndex!==e.conflictIndex)throw console.error({conflictIndex:e.conflictIndex,action:t}),new Error("UnresolvedFile.handleMergeConflictActionClick: conflictIndex and conflictAction don't match");const n={resolution:e.resolution,conflict:t.conflict};null==this.options.onMergeConflictAction?this.resolveConflictAndRender(e.conflictIndex,e.resolution):this.options.onMergeConflictAction(n,this)}),this.options=e,this.setOptions(e)}setOptions(e){if(null!=e){if(null!=e.onMergeConflictAction&&null!=e.onMergeConflictResolve)throw new Error("UnresolvedFile: onMergeConflictAction and onMergeConflictResolve are mutually exclusive. Use only one callback.");this.options=e,this.hunksRenderer.setOptions(this.getHunksRendererOptions(e)),this.syncInteractionOptions()}}syncInteractionOptions(){var e;this.interactionManager.setOptions(en(this.options,"function"==typeof this.options.hunkSeparators||"line-info"===(null!=(e=this.options.hunkSeparators)?e:"line-info")||"line-info-basic"===this.options.hunkSeparators?this.handleExpandHunk:void 0,this.getLineIndex,this.handleMergeConflictActionClick))}createHunksRenderer(e){return new kf(this.getHunksRendererOptions(e),this.handleHighlightRender,this.workerManager)}getHunksRendererOptions(e){return Hf(e,this.options)}applyPreNodeAttributes(e,t){super.applyPreNodeAttributes(e,t,{"data-has-merge-conflict":""})}cleanUp(){this.emitPostRender(!0),this.clearMergeConflictActionCache(),this.computedCache={file:void 0,fileDiff:void 0,actions:void 0,markerRows:void 0},this.conflictActions=[],super.cleanUp()}getOrComputeDiff({file:e,fileDiff:t,actions:n,markerRows:i}){var r;const{maxContextLines:o,onMergeConflictAction:s}=this.options;e:{if(null!=s){const r=null!=t;if(r!==(null!=n)||r!==(null!=i))throw new Error("UnresolvedFile.getOrComputeDiff: fileDiff, actions, and markerRows must be passed together");if(null!=t&&null!=n&&null!=i){this.computedCache={file:null!=e?e:this.computedCache.file,fileDiff:t,actions:n,markerRows:i};break e}if(null!=e||null!=this.computedCache.file){if(null!=e&&null!=this.computedCache.file&&!id(e,this.computedCache.file)&&null!=this.computedCache.fileDiff&&null!=this.computedCache.actions)throw new Error("UnresolvedFile.getOrComputeDiff: file can only be used to initialize unresolved state once. Pass fileDiff and actions for subsequent updates.");if(null!=e||(e=this.computedCache.file),null==e)throw new Error("UnresolvedFile.getOrComputeDiff: file is null, should be impossible");if(!id(e,this.computedCache.file)||null==this.computedCache.fileDiff||null==this.computedCache.actions){const t=sf(e,o);this.computedCache={file:e,fileDiff:t.fileDiff,actions:t.actions,markerRows:t.markerRows}}t=this.computedCache.fileDiff,n=this.computedCache.actions,i=this.computedCache.markerRows;break e}t=this.computedCache.fileDiff,n=this.computedCache.actions,i=this.computedCache.markerRows;break e}if(null!=t||null!=n||null!=i)throw new Error("UnresolvedFile.getOrComputeDiff: fileDiff, actions, and markerRows are only usable in controlled mode, you must pass in `onMergeConflictAction`");if(null!=e&&null!=this.computedCache.file&&!id(e,this.computedCache.file))throw new Error("UnresolvedFile.getOrComputeDiff: uncontrolled unresolved files parse the file only once. Later updates must come from the cached diff state.");if(null!=(r=this.computedCache).file||(r.file=e),null==this.computedCache.fileDiff&&null!=this.computedCache.file){const e=sf(this.computedCache.file,o);this.computedCache.fileDiff=e.fileDiff,this.computedCache.actions=e.actions,this.computedCache.markerRows=e.markerRows}t=this.computedCache.fileDiff,n=this.computedCache.actions,i=this.computedCache.markerRows}if(null!=t&&null!=n&&null!=i)return{fileDiff:t,actions:n,markerRows:i}}hydrate(e){const{file:t,fileDiff:n,actions:i,markerRows:r,lineAnnotations:o,fileContainer:s,prerenderedHTML:a,preventEmit:l=!1}=e,d=this.getOrComputeDiff({file:t,fileDiff:n,actions:i,markerRows:r});null!=d&&(this.hydrateElements(s,a),this.setActiveMergeConflictState(d.actions,d.markerRows),function(e,t,n=!1){return!n&&null==e&&null!=t}(this.pre,d.fileDiff,this.options.collapsed)||function(e,t,n=!1){return null==e&&null!=t&&!n}(this.headerElement,d.fileDiff,this.options.disableFileHeader)?this.render({...e,preventEmit:!0}):(this.hydrationSetup({fileDiff:d.fileDiff,lineAnnotations:o}),null!=this.pre&&this.renderMergeConflictActionSlots()),l||this.emitPostRender())}rerender(){this.enabled&&null!=this.fileDiff&&this.render({forceRender:!0,renderRange:this.renderRange})}render(e={}){const{file:t,fileDiff:n,actions:i,markerRows:r,lineAnnotations:o,preventEmit:s=!1,...a}=e,l=this.getOrComputeDiff({file:t,fileDiff:n,actions:i,markerRows:r});if(null==l)return!1;this.setActiveMergeConflictState(l.actions,l.markerRows);const d=super.render({...a,fileDiff:l.fileDiff,lineAnnotations:o,preventEmit:!0});return d&&(this.renderMergeConflictActionSlots(),s||this.emitPostRender()),d}resolveConflict(e,t,n=this.computedCache.fileDiff){const i=this.conflictActions[e];if(null==n||null==i)return;if(i.conflictIndex!==e)throw console.error({conflictIndex:e,action:i}),new Error("UnresolvedFile.resolveConflict: conflictIndex and conflictAction don't match");const r=tf(n,i,t),o=this.computedCache.file,{file:s,actions:a,markerRows:l}=function({fileDiff:e,previousActions:t,resolvedConflictIndex:n,previousFile:i,resolution:r}){const o=t[n];if(null==o)throw new Error("rebuildFileAndActions: missing resolved action for unresolved file rebuild");const s=function(e,t,n,i){const r=function(e,t){var n;const i=(null!=(n=e.baseMarkerLineIndex)?n:e.separatorLineIndex)-e.startLineIndex-1,r=e.endLineIndex-e.separatorLineIndex-1;return("current"===t?i:"incoming"===t?r:i+r)-(e.endLineIndex-e.startLineIndex+1)}(n.conflict,i);return e.map((e,i)=>{if(i!==t&&null!=e)return e.conflict.startLineIndex>n.conflict.endLineIndex?{...e,conflict:Df(e.conflict,r)}:e})}(t,n,o,r),a=yf(e,s);return{file:Nf({fileDiff:e,resolvedAction:o,resolvedConflictIndex:n,previousFile:i,resolution:r}),actions:s,markerRows:a}}({fileDiff:r,previousActions:this.conflictActions,resolvedConflictIndex:e,previousFile:o,resolution:t});return{file:s,fileDiff:r,actions:a,markerRows:l}}resolveConflictAndRender(e,t){var n,i,r;const o=this.conflictActions[e];if(null==o)return;if(o.conflictIndex!==e)throw console.error({conflictIndex:e,action:o}),new Error("UnresolvedFile.resolveConflictAndRender: conflictIndex and conflictAction don't match");const s={resolution:t,conflict:o.conflict},{file:a,fileDiff:l,actions:d,markerRows:c}=null!=(n=this.resolveConflict(e,t))?n:{};null!=a&&null!=l&&null!=d&&null!=c&&(this.computedCache={file:a,fileDiff:l,actions:d,markerRows:c},this.setActiveMergeConflictState(d,c),null!=this.workerManager?this.hunksRenderer.renderDiff(l):this.render({forceRender:!0}),null==(r=(i=this.options).onMergeConflictResolve)||r.call(i,a,s))}setActiveMergeConflictState(e=this.conflictActions,t=this.markerRows){this.conflictActions=e,this.markerRows=t,null!=this.computedCache.fileDiff&&this.hunksRenderer instanceof kf&&this.hunksRenderer.setConflictState("none"===this.options.mergeConflictActionsType?[]:e,t,this.computedCache.fileDiff)}renderMergeConflictActionSlots(){const{fileDiff:e}=this.computedCache;if(this.isContainerManaged||null==this.fileContainer||"function"!=typeof this.options.mergeConflictActionsType||0===this.conflictActions.length||null==e)return void this.clearMergeConflictActionCache();const t=new Map(this.conflictActionCache);for(let n=0;n<this.conflictActions.length;n++){const i=this.conflictActions[n];if(null==i)continue;if(i.conflictIndex!==n)throw console.error({conflictIndex:n,action:i}),new Error("UnresolvedFile.renderMergeConflictActionSlots: conflictIndex and conflictAction don't match");const r=of(i,e);if(null==r)continue;const o=i.conflictIndex,s=rf({hunkIndex:r.hunkIndex,lineIndex:r.lineIndex,conflictIndex:o}),a=`${n}-${s}`;let l=this.conflictActionCache.get(a);if(null==l||!Mf(l.action,i)){null==l||l.element.remove();const e=this.renderMergeConflictAction(i);if(null==e)continue;const t=ac(s);t.appendChild(e),this.fileContainer.appendChild(t),l={element:t,action:i},this.conflictActionCache.set(a,l)}t.delete(a)}for(const[n,{element:i}]of t.entries())this.conflictActionCache.delete(n),i.remove()}renderMergeConflictAction(e){if("function"!=typeof this.options.mergeConflictActionsType)return;const t=this.options.mergeConflictActionsType(e,this);if(null!=t){if(t instanceof HTMLElement)return t;if("undefined"!=typeof DocumentFragment&&t instanceof DocumentFragment){const e=document.createElement("div");return e.style.display="contents",e.appendChild(t),e}}}clearMergeConflictActionCache(){for(const{element:e}of this.conflictActionCache.values())e.remove();this.conflictActionCache.clear()}};function Nf({resolvedAction:e,resolvedConflictIndex:t,previousFile:n,fileDiff:i,resolution:r}){var o,s;const a=Gd(null!=(o=null==n?void 0:n.contents)?o:""),{conflict:l}=e,d=function(e,t,n){var i;const r=e.slice(t.startLineIndex+1,null!=(i=t.baseMarkerLineIndex)?i:t.separatorLineIndex),o=e.slice(t.separatorLineIndex+1,t.endLineIndex);return"current"===n?r:"incoming"===n?o:[...r,...o]}(a,l,r),c=[...a.slice(0,l.startLineIndex),...d,...a.slice(l.endLineIndex+1)].join("");return{name:null!=(s=null==n?void 0:n.name)?s:i.name,contents:c,cacheKey:null!=(null==n?void 0:n.cacheKey)?`${n.cacheKey}:mc-${t}-${r}`:void 0}}function Df(e,t){return{...e,startLineIndex:e.startLineIndex+t,startLineNumber:e.startLineNumber+t,separatorLineIndex:e.separatorLineIndex+t,separatorLineNumber:e.separatorLineNumber+t,endLineIndex:e.endLineIndex+t,endLineNumber:e.endLineNumber+t,baseMarkerLineIndex:null!=e.baseMarkerLineIndex?e.baseMarkerLineIndex+t:void 0,baseMarkerLineNumber:null!=e.baseMarkerLineNumber?e.baseMarkerLineNumber+t:void 0}}function Hf(e,t){return{...t,...e,hunkSeparators:"function"==typeof(null==e?void 0:e.hunkSeparators)?"custom":null==e?void 0:e.hunkSeparators,mergeConflictActionsType:"function"==typeof(null==e?void 0:e.mergeConflictActionsType)?"custom":null==e?void 0:e.mergeConflictActionsType}}function _f(e,t){return null==e||null==t?e===t:e.top===t.top&&e.bottom===t.bottom}const Of=[0,1e-6,.99999,1],jf={overscrollSize:1e3,intersectionObserverMargin:4e3,resizeDebugging:!1};let Ff=0,Bf=-1;var $f=(p=class{constructor(e){y(this,"__id","virtualizer-"+ ++Bf),y(this,"config"),y(this,"type","simple"),y(this,"intersectionObserver"),y(this,"scrollTop",0),y(this,"height",0),y(this,"scrollHeight",0),y(this,"windowSpecs",{top:0,bottom:0}),y(this,"root"),y(this,"contentContainer"),y(this,"resizeObserver"),y(this,"observers",/* @__PURE__ */new Map),y(this,"visibleInstances",/* @__PURE__ */new Map),y(this,"visibleInstancesDirty",!1),y(this,"instancesChanged",/* @__PURE__ */new Set),y(this,"scrollDirty",!0),y(this,"heightDirty",!0),y(this,"scrollHeightDirty",!0),y(this,"renderedObservers",0),y(this,"connectQueue",/* @__PURE__ */new Map),y(this,"handleContainerResize",e=>{if(null==this.root)return;let t=!1;for(const n of e){const e=n.borderBoxSize[0].blockSize;this.root instanceof Document?e!==this.scrollHeight&&(this.scrollHeightDirty=!0,t=!0,this.config.resizeDebugging&&(this.__id,Ff=e)):n.target===this.root?e!==this.height&&(this.heightDirty=!0,t=!0):n.target===this.contentContainer&&(this.scrollHeightDirty=!0,t=!0,this.config.resizeDebugging&&(this.__id,Ff=e))}t&&ae(this.computeRenderRangeAndEmit)}),y(this,"handleWindowResize",()=>{p.__STOP||window.innerHeight===this.height||(this.heightDirty=!0,ae(this.computeRenderRangeAndEmit))}),y(this,"handleWindowScroll",()=>{!p.__STOP&&null!=this.root&&this.root instanceof Document&&(this.scrollDirty=!0,ae(this.computeRenderRangeAndEmit))}),y(this,"handleElementScroll",()=>{p.__STOP||null==this.root||this.root instanceof Document||(this.scrollDirty=!0,ae(this.computeRenderRangeAndEmit))}),y(this,"computeRenderRangeAndEmit",()=>{if(p.__STOP)return;const e=this.heightDirty||this.scrollHeightDirty;if(!(this.scrollDirty||this.scrollHeightDirty||this.heightDirty||this.renderedObservers!==this.observers.size||this.visibleInstancesDirty||0!==this.instancesChanged.size))return;let t=this.instancesChanged.size>0;if(0===this.instancesChanged.size){const t=me({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),overscrollSize:this.config.overscrollSize});if(!e&&_f(this.windowSpecs,t)&&this.renderedObservers===this.observers.size&&!this.visibleInstancesDirty)return;this.windowSpecs=t}this.visibleInstancesDirty=!1,this.renderedObservers=this.observers.size;const n=this.getScrollAnchor(this.height),i=/* @__PURE__ */new Set;for(const r of e?this.observers.values():this.visibleInstances.values())r.onRender(e)&&i.add(r);for(const r of this.instancesChanged)i.has(r)||r.onRender(e)&&i.add(r);this.scrollFix(n);for(const r of i)r.reconcileHeights();t||(t=this.instancesChanged.size>0),t&&this.markDOMDirty(),(t||e)&&ae(this.computeRenderRangeAndEmit),i.clear(),this.instancesChanged.clear()}),y(this,"handleIntersectionChange",e=>{this.scrollDirty=!0;for(const{target:t,isIntersecting:n}of e){if(!(t instanceof HTMLElement))throw new Error("Virtualizer.handleIntersectionChange: target not an HTMLElement");const e=this.observers.get(t);null!=e&&(n&&!this.visibleInstances.has(t)?(e.setVisibility(!0),this.visibleInstances.set(t,e),this.visibleInstancesDirty=!0):!n&&this.visibleInstances.has(t)&&(e.setVisibility(!1),this.visibleInstances.delete(t),this.visibleInstancesDirty=!0))}this.visibleInstancesDirty&&ae(this.computeRenderRangeAndEmit)}),this.config={...jf,...e}}setup(e,t){if(null==this.root){this.root=e,this.resizeObserver=new ResizeObserver(this.handleContainerResize),this.intersectionObserver=new IntersectionObserver(this.handleIntersectionChange,{root:this.root,threshold:Of,rootMargin:`${this.config.intersectionObserverMargin}px 0px ${this.config.intersectionObserverMargin}px 0px`}),e instanceof Document?this.setupWindow():this.setupElement(t),window.__INSTANCE=this,window.__TOGGLE=()=>{var e;p.__STOP?(p.__STOP=!1,(null!=(e=this.getScrollContainerElement())?e:window).scrollTo({top:p.__lastScrollPosition}),ae(this.computeRenderRangeAndEmit)):(p.__lastScrollPosition=this.getScrollTop(),p.__STOP=!0)};for(const[e,t]of this.connectQueue.entries())this.connect(e,t);this.connectQueue.clear(),this.markDOMDirty(),ae(this.computeRenderRangeAndEmit)}}instanceChanged(e,t){this.instancesChanged.add(e),t&&this.markDOMDirty(),ae(this.computeRenderRangeAndEmit)}getWindowSpecs(){return 0===this.windowSpecs.top&&0===this.windowSpecs.bottom&&(this.windowSpecs=me({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),overscrollSize:this.config.overscrollSize})),this.windowSpecs}isInstanceVisible(e,t){const n=this.getScrollTop(),i=this.getHeight(),r=this.config.intersectionObserverMargin;return!(e<n-r-t||e>n+i+r)}setupWindow(){var e;if(null==this.root||!(this.root instanceof Document))throw new Error("Virtualizer.setupWindow: Invalid setup method");window.addEventListener("scroll",this.handleWindowScroll,{passive:!0}),window.addEventListener("resize",this.handleWindowResize,{passive:!0}),null==(e=this.resizeObserver)||e.observe(this.root.documentElement)}setupElement(e){var t,n,i;if(null==this.root||this.root instanceof Document)throw new Error("Virtualizer.setupElement: Invalid setup method");this.root.addEventListener("scroll",this.handleElementScroll,{passive:!0}),null==(t=this.resizeObserver)||t.observe(this.root),null!=e||(e=null!=(n=this.root.firstElementChild)?n:void 0),e instanceof HTMLElement&&(this.contentContainer=e,null==(i=this.resizeObserver)||i.observe(e))}cleanUp(){var e,t,n;null==(e=this.resizeObserver)||e.disconnect(),this.resizeObserver=void 0,null==(t=this.intersectionObserver)||t.disconnect(),this.intersectionObserver=void 0,null==(n=this.root)||n.removeEventListener("scroll",this.handleElementScroll),window.removeEventListener("scroll",this.handleWindowScroll),window.removeEventListener("resize",this.handleWindowResize),this.root=void 0,this.contentContainer=void 0,this.observers.clear(),this.visibleInstances.clear(),this.instancesChanged.clear(),this.connectQueue.clear(),this.visibleInstancesDirty=!1,this.windowSpecs={top:0,bottom:0},this.scrollTop=0,this.height=0,this.scrollHeight=0}getOffsetInScrollContainer(e){return this.getScrollTop()+zf(e,this.getScrollContainerElement())}connect(e,t){if(this.observers.has(e))throw new Error("Virtualizer.connect: instance is already connected...");return null==this.intersectionObserver?this.connectQueue.set(e,t):(this.intersectionObserver.observe(e),this.observers.set(e,t),this.instancesChanged.add(t),this.markDOMDirty(),ae(this.computeRenderRangeAndEmit)),()=>this.disconnect(e)}disconnect(e){var t;const n=this.observers.get(e);this.connectQueue.delete(e),null!=n&&(null==(t=this.intersectionObserver)||t.unobserve(e),this.observers.delete(e),this.visibleInstances.delete(e)&&(this.visibleInstancesDirty=!0),this.markDOMDirty(),ae(this.computeRenderRangeAndEmit))}scrollFix(e){var t;if(null==e)return;const n=this.getScrollContainerElement(),{lineIndex:i,lineOffset:r,fileElement:o,fileOffset:s,fileTypeOffset:a}=e;if(null!=i&&null!=r){const e=null==(t=o.shadowRoot)?void 0:t.querySelector(`[data-line][data-line-index="${i}"]`);if(e instanceof HTMLElement){const t=zf(e,n);if(t!==r){const e=t-r;this.applyScrollFix(e)}return}}const l=zf(o,n);if("top"===a)l!==s&&this.applyScrollFix(l-s);else{const e=l+o.getBoundingClientRect().height;e!==s&&this.applyScrollFix(e-s)}}applyScrollFix(e){null==this.root||this.root instanceof Document?window.scrollTo({top:window.scrollY+e,behavior:"instant"}):this.root.scrollTo({top:this.root.scrollTop+e,behavior:"instant"}),this.markDOMDirty()}getScrollAnchor(e){var t,n;const i=this.getScrollContainerElement();let r;for(const[o]of this.visibleInstances.entries()){const s=zf(o,i),a=s+o.offsetHeight;let l,d,c,u;if(a<=0?(l=a,d="bottom"):(l=s,d="top"),a>0&&s<e)for(const e of null!=(n=null==(t=o.shadowRoot)?void 0:t.querySelectorAll("[data-line][data-line-index]"))?n:[]){if(!(e instanceof HTMLElement))continue;const t=e.dataset.lineIndex;if(null==t)continue;const n=zf(e,i);if(!(n<0)){c=t,u=n;break}}if(null!=(null==r?void 0:r.lineOffset)&&null==u)continue;let h=!1;(null==r||null!=u&&(null==r.lineOffset||u<r.lineOffset)||null==u&&null==r.lineOffset&&(l>=0&&(r.fileOffset<0||l<r.fileOffset)||l<0&&r.fileOffset<0&&l>r.fileOffset))&&(h=!0),h&&(r={fileElement:o,fileTypeOffset:d,fileOffset:l,lineIndex:c,lineOffset:u})}return r}getScrollTop(){if(!this.scrollDirty)return this.scrollTop;this.scrollDirty=!1;let e=(()=>null==this.root?0:this.root instanceof Document?window.scrollY:this.root.scrollTop)();return e=Math.max(0,Math.min(e,this.getScrollHeight()-this.getHeight())),this.scrollTop=e,e}getScrollHeight(){return this.scrollHeightDirty?(this.scrollHeightDirty=!1,this.scrollHeight=(()=>null==this.root?0:this.root instanceof Document?this.root.documentElement.scrollHeight:this.root.scrollHeight)(),this.scrollHeight):this.scrollHeight}getHeight(){return this.heightDirty?(this.heightDirty=!1,this.height=(()=>null==this.root?0:this.root instanceof Document?globalThis.innerHeight:this.root.getBoundingClientRect().height)(),this.height):this.height}markDOMDirty(){this.scrollDirty=!0,this.scrollHeightDirty=!0,this.heightDirty=!0}getScrollContainerElement(){return null==this.root||this.root instanceof Document?void 0:this.root}},y(p,"__STOP",!1),y(p,"__lastScrollPosition",0),p);function zf(e,t){var n;const i=e.getBoundingClientRect(),r=null!=(n=null==t?void 0:t.getBoundingClientRect().top)?n:0;return i.top-r}function Uf(e){const t=[];for(const n of e){const e=yn.get(n);if(null==e)throw new Error(`getResolvedLanguages: ${n} is not resolved. Please resolve languages before calling getResolvedLanguages`);t.push(e)}return t}function Gf(e){for(const t of Array.isArray(e)?e:[e])if(!yn.has(t))return!1;return!0}function Wf(e,t,n=[]){if("text"===e||"ansi"===e)throw new Error("registerCustomLanguage: 'text' and 'ansi' are reserved language names");if(Sn.has(e))console.error(`registerCustomLanguage: lang: ${e} is already registered`);else{Sn.set(e,t);for(const t of n)bd(t,e)}}async function Vf(e){var t;const n=[],i=[];for(const r of e){if("text"===r||"ansi"===r)continue;const e=null!=(t=gl(r))?t:ml(r);"then"in e?i.push(e):n.push(e)}return i.length>0&&await Promise.all(i).then(e=>{for(const t of e){if(null==t)throw new Error("resolvedLanguages: unable to resolve language");n.push(t)}}),n}function qf(e){return wl.getResolvedThemes(e)}function Kf(e,t){try{const n=Al({name:e,load:t});wl.registerTheme(n.name,n.load)}catch(n){if(n instanceof Sl)return void console.error("SharedHighlight.registerCustomTheme: theme name already registered",e);throw n}}function Xf(e,t,n=!1){const i=Po({name:e,variablePrefix:Rd("global"),variableDefaults:t,fontStyle:n});Kf(e,()=>Promise.resolve(i))}async function Qf(e){for(const n of e)$l(n);const t=await wl.resolveThemes(e);for(let n=0;n<e.length;n++)zl(e[n],t[n]);return t}function Yf(e,t){return null==e||null==t?e===t:e.busyWorkers===t.busyWorkers&&e.diffCacheSize===t.diffCacheSize&&e.fileCacheSize===t.fileCacheSize&&e.managerState===t.managerState&&e.activeTasks===t.activeTasks&&e.queuedTasks===t.queuedTasks&&e.themeSubscribers===t.themeSubscribers&&e.totalWorkers===t.totalWorkers&&e.workersFailed===t.workersFailed}function Jf(e){const t=document.createElement("div");t.dataset.line=`${e}`;const n=document.createElement("div");n.dataset.columnNumber="",n.textContent=`${e}`;const i=document.createElement("div");return i.dataset.columnContent="",t.appendChild(n),t.appendChild(i),{row:t,content:i}}function Zf(e,t=!1){return be({tagName:"style",children:[ve(t?vc(e):bc(e))],properties:{[q]:t?"":void 0,[V]:t?void 0:""}})}function ep(e){return be({tagName:"style",children:[ve(e)],properties:{[W]:""}})}function tp(e,t,n){const i=e.hunks[t];if(null==i)throw console.error({hunkIndex:t,diff:e}),new Error("diffAcceptRejectHunk: Invalid hunk index");return Kh(e,{resolution:ef(n),hunkIndex:t,..."object"==typeof n?{startContentIndex:n.changeIndex,endContentIndex:n.changeIndex}:{startContentIndex:0,endContentIndex:Math.max(0,(null!=(r=i.hunkContent.length)?r:1)-1)}});var r}function np(e){return e.includes("\r\n")?"CRLF":e.includes("\r")?"CR":e.includes("\n")?"LF":"none"}function ip(e){const t=qc(e);if(1!==t.length)throw console.error(t),new Error("PatchDiff: Provided patch must include only 1 patch, with 1 diff");const{files:n}=t[0];if(1!==n.length)throw console.error(n),new Error("FileDiff: Provided patch must contain exactly 1 file diff");return n[0]}function rp(e){const t=e[0];if("+"!==t&&"-"!==t&&" "!==t&&"\\"!==t)return void console.error(`parseLineType: Invalid firstChar: "${t}", full line: "${e}"`);const n=e.substring(1);return{line:""===n?"\n":n,type:" "===t?"context":"\\"===t?"metadata":"+"===t?"addition":"deletion"}}function op(e,t){return{...e,lang:t}}function sp(e,t=10){var n,i;const r=[];let o;for(const a of e.split("\n")){const e=a.match(R);if(null!=e){null!=o&&(o.hunkLines.length>0&&(ap(o,t,"trailing"),lp(o,r)),o=void 0);const s=parseInt(e[3]),l=parseInt(e[1]),d=parseInt(null!=(n=e[4])?n:"1"),c=parseInt(null!=(i=e[2])?i:"1");isNaN(s)||isNaN(l)||isNaN(d)||isNaN(c)?r.push(a):o={additionStart:s,deletionStart:l,additionCount:0,deletionCount:0,hunkLines:[],contextLines:[]};continue}if(null!=o){if(a.startsWith(" "))o.contextLines.push(a);else if(""!==a){if(o.hunkLines.length>0&&o.contextLines.length>2*t){const e=o.contextLines.length-2*t,n=o.contextLines.slice(-t);ap(o,t,"trailing");const{additionCount:i,deletionCount:s}=o;lp(o,r),o={additionStart:o.additionStart+i+e,deletionStart:o.deletionStart+s+e,deletionCount:0,additionCount:0,contextLines:n,hunkLines:[]}}ap(o,t,0===o.hunkLines.length?"leading":"before-change"),o.hunkLines.push(a),a.startsWith("+")?o.additionCount+=1:a.startsWith("-")&&(o.deletionCount+=1)}}else r.push(a)}null!=o&&o.hunkLines.length>0&&(ap(o,t,"trailing"),lp(o,r));const s=r.join("\n");return e.endsWith("\n")?`${s}\n`:s}function ap(e,t,n){if("leading"===n&&e.contextLines.length>t){const n=e.contextLines.length-t;e.contextLines.splice(0,n),e.additionStart+=n,e.deletionStart+=n}return"trailing"===n&&e.contextLines.length>t&&(e.contextLines.length=t),e.contextLines.length>0&&(e.hunkLines.push(...e.contextLines),e.additionCount+=e.contextLines.length,e.deletionCount+=e.contextLines.length,e.contextLines.length=0),e}function lp(e,t){t.push(`@@ -${dp(e.deletionStart,e.deletionCount)} +${dp(e.additionStart,e.additionCount)} @@`),t.push(...e.hunkLines)}function dp(e,t){return 1===t?`${e}`:`${e},${t}`}export{H as ALTERNATE_FILE_NAMES_GIT,kn as AttachedLanguages,vl as AttachedThemes,A as COMMIT_METADATA_SPLIT,q as CORE_CSS_ATTRIBUTE,U as CUSTOM_HEADER_SLOT_ID,Gh as CodeToTokenTransformStream,Nh as CodeView,Z as DEFAULT_CODE_VIEW_FILE_METRICS,ee as DEFAULT_CODE_VIEW_LAYOUT,Q as DEFAULT_COLLAPSED_CONTEXT_THRESHOLD,ne as DEFAULT_EXPANDED_REGION,ie as DEFAULT_RENDER_RANGE,te as DEFAULT_SMOOTH_SCROLL_SETTINGS,G as DEFAULT_THEMES,Y as DEFAULT_TOKENIZE_MAX_LENGTH,J as DEFAULT_VIRTUAL_FILE_METRICS,T as DIFFS_DEVELOPMENT_BUILD,X as DIFFS_SCROLLBAR_GUTTER_MEASURED_PROPERTY,K as DIFFS_SCROLLBAR_MEASURE_ATTRIBUTE,L as DIFFS_TAG_NAME,Qu as DiffHunksRenderer,re as EMPTY_RENDER_RANGE,pd as EXTENSION_TO_FILE_FORMAT,N as FILENAME_HEADER_REGEX,D as FILENAME_HEADER_REGEX_GIT,M as FILE_CONTEXT_BLOB,Ec as File,dh as FileDiff,tc as FileRenderer,qh as FileStream,I as GIT_DIFF_FILE_BREAK_REGEX,z as HEADER_METADATA_SLOT_ID,$ as HEADER_PREFIX_SLOT_ID,R as HUNK_HEADER,_ as INDEX_LINE_METADATA,Zt as InteractionManager,j as MERGE_CONFLICT_BASE_MARKER_REGEX,B as MERGE_CONFLICT_END_MARKER_REGEX,F as MERGE_CONFLICT_SEPARATOR_MARKER_REGEX,O as MERGE_CONFLICT_START_MARKER_REGEX,Sn as RegisteredCustomLanguages,pn as ResizeManager,yn as ResolvedLanguages,Cn as ResolvingLanguages,P as SPLIT_WITH_NEWLINES,ic as SVGSpriteSheet,xu as ScrollSyncManager,Uh as ShikiStreamTokenizer,W as THEME_CSS_ATTRIBUTE,E as UNIFIED_DIFF_FILE_BREAK_REGEX,V as UNSAFE_CSS_ATTRIBUTE,Pf as UnresolvedFile,Dc as VirtualizedFile,ph as VirtualizedFileDiff,$f as Virtualizer,sh as areDiffLineAnnotationsEqual,wu as areDiffRenderOptionsEqual,_c as areDiffTargetsEqual,nd as areFileRenderOptionsEqual,id as areFilesEqual,ah as areHunkDataEqual,xn as areLanguagesAttached,rc as areLineAnnotationsEqual,ce as areObjectsEqual,he as areOptionsEqual,oc as arePrePropertiesEqual,rd as areRenderRangesEqual,pe as areSelectionsEqual,ed as areThemesAttached,ue as areThemesEqual,_f as areVirtualWindowSpecsEqual,Yf as areWorkerStatsEqual,wn as attachResolvedLanguages,Ll as attachResolvedThemes,kd as cleanLastNewline,Ln as cleanUpResolvedLanguages,Tl as cleanUpResolvedThemes,Ho as codeToHtml,od as createAnnotationElement,ac as createAnnotationWrapperNode,Po as createCSSVariablesTheme,Pu as createDiffSpanDecoration,Lu as createEmptyRowBuffer,ad as createFileHeaderElement,xe as createGutterGap,ke as createGutterItem,lc as createGutterUtilityContentNode,we as createGutterUtilityElement,Se as createGutterWrapper,be as createHastElement,ye as createIconElement,Tu as createNoNewlineElement,cd as createPreElement,ud as createPreWrapperProperties,Jf as createRowNodes,Iu as createSeparator,Wh as createSpanFromToken,Zf as createStyleElement,ve as createTextNodeElement,ep as createThemeStyleElement,Id as createTransformerWithState,dc as createUnsafeCSSStyleNode,me as createWindowFromScrollPosition,le as dequeueRender,Uc as detachString,tp as diffAcceptRejectHunk,Jl as disposeHighlighter,Ce as findCodeElement,Rd as formatCSSVariablePrefix,yd as getCustomExtensionsMap,vd as getCustomExtensionsVersion,md as getFiletypeFromFileName,Kl as getHighlighterIfLoaded,Cd as getHighlighterOptions,Bd as getHighlighterThemeStyles,Eu as getHunkSeparatorSlotName,sd as getIconForType,Sd as getLineAnnotationName,np as getLineEndingType,zd as getLineNodes,Sc as getOrCreateCodeNode,Uf as getResolvedLanguages,gl as getResolvedOrResolveLanguage,Gl as getResolvedOrResolveTheme,qf as getResolvedThemes,Vl as getSharedHighlighter,ip as getSingularPatch,Zl as getThemes,Mu as getTotalLineCountFromHunks,Hf as getUnresolvedDiffHunksRendererOptions,Gf as hasResolvedLanguages,td as hasResolvedThemes,Ru as isDefaultRenderRange,ql as isHighlighterLoaded,Xl as isHighlighterLoading,Ql as isHighlighterNull,Tn as isWorkerContext,ku as parseDiffFromFile,rp as parseLineType,qc as parsePatchFiles,Cc as patchScrollbarGutterSize,en as pluckInteractionOptions,ge as prefersReducedMotion,Yl as preloadHighlighter,kc as prerenderHTMLIfNecessary,Wc as processFile,xd as processLine,Gc as processPatch,Nu as pushOrJoinSpan,ae as queueRender,Xf as registerCustomCSSVariableTheme,Wf as registerCustomLanguage,Kf as registerCustomTheme,zc as releaseStringDetachBuffer,Vu as renderDiffWithHighlighter,Vd as renderFileWithHighlighter,gd as replaceCustomExtensions,tf as resolveConflict,ml as resolveLanguage,Vf as resolveLanguages,Kh as resolveRegion,Ul as resolveTheme,Qf as resolveThemes,bd as setCustomExtension,op as setLanguageOverride,xc as setPreNodeProperties,sp as trimPatchContext,vc as wrapCoreCSS,yc as wrapThemeCSS,bc as wrapUnsafeCSS};