openfox 1.6.94 → 1.6.96

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 (331) hide show
  1. package/dist/{auto-compaction-UOYOMWLZ.js → auto-compaction-M2LTRUXL.js} +5 -5
  2. package/dist/{chat-handler-5HU4QWD4.js → chat-handler-WEG7W3OY.js} +8 -8
  3. package/dist/{chunk-PNIXFZZH.js → chunk-2BEPXMWB.js} +2 -2
  4. package/dist/{chunk-FVVLGR2G.js → chunk-BK7QEUQF.js} +5 -5
  5. package/dist/{chunk-QIFXGM2L.js → chunk-EXRMBJME.js} +55 -48
  6. package/dist/{chunk-CHEVYEM4.js → chunk-OBJE2622.js} +3 -3
  7. package/dist/{chunk-DTXWOKAG.js → chunk-QAN42RJQ.js} +3 -3
  8. package/dist/{chunk-PQCFNTFJ.js → chunk-QWGO6DE3.js} +16 -3
  9. package/dist/{chunk-4I3C46WU.js → chunk-RREZKLOD.js} +1 -1
  10. package/dist/{chunk-PAAUYFYS.js → chunk-T67WWSM7.js} +3 -24
  11. package/dist/cli/dev.js +1 -1
  12. package/dist/cli/index.js +1 -1
  13. package/dist/{events-HTVBWGHO.js → events-2UP7O6LW.js} +2 -2
  14. package/dist/{orchestrator-KGYZO6XH.js → orchestrator-JNDOPIVQ.js} +6 -6
  15. package/dist/package.json +4 -2
  16. package/dist/{processor-QFBRN6AZ.js → processor-GISJIZH7.js} +5 -5
  17. package/dist/{protocol-XRiJzlOK.d.ts → protocol-BFKDuZ7J.d.ts} +1 -0
  18. package/dist/{protocol-QDSVJTRN.js → protocol-FZUIA4BS.js} +2 -2
  19. package/dist/{serve-PSZFEXYU.js → serve-O5JK3PNM.js} +7 -7
  20. package/dist/server/index.d.ts +1 -1
  21. package/dist/server/index.js +6 -6
  22. package/dist/{settings-AYSWDZUI.js → settings-RMRS6GEW.js} +2 -2
  23. package/dist/shared/index.d.ts +2 -2
  24. package/dist/{tools-FZS5JNQE.js → tools-UFAPVX45.js} +5 -5
  25. package/dist/web/assets/abap-BdImnpbu.js +1 -0
  26. package/dist/web/assets/actionscript-3-CoDkCxhg.js +1 -0
  27. package/dist/web/assets/ada-bCR0ucgS.js +1 -0
  28. package/dist/web/assets/andromeeda-C4gqWexZ.js +1 -0
  29. package/dist/web/assets/angular-html-DA-rfuFy.js +1 -0
  30. package/dist/web/assets/angular-ts-BrjP3tb8.js +1 -0
  31. package/dist/web/assets/apache-Pmp26Uib.js +1 -0
  32. package/dist/web/assets/apex-Dqspr-GT.js +1 -0
  33. package/dist/web/assets/apl-CORt7UWP.js +1 -0
  34. package/dist/web/assets/applescript-Co6uUVPk.js +1 -0
  35. package/dist/web/assets/ara-BRHolxvo.js +1 -0
  36. package/dist/web/assets/asciidoc-Ve4PFQV2.js +1 -0
  37. package/dist/web/assets/asm-D_Q5rh1f.js +1 -0
  38. package/dist/web/assets/astro-HNnZUWAn.js +1 -0
  39. package/dist/web/assets/aurora-x-D-2ljcwZ.js +1 -0
  40. package/dist/web/assets/awk-DMzUqQB5.js +1 -0
  41. package/dist/web/assets/ayu-dark-DYE7WIF3.js +1 -0
  42. package/dist/web/assets/ayu-light-BA47KaF1.js +1 -0
  43. package/dist/web/assets/ayu-mirage-32ctXXKs.js +1 -0
  44. package/dist/web/assets/ballerina-BFfxhgS-.js +1 -0
  45. package/dist/web/assets/bat-BkioyH1T.js +1 -0
  46. package/dist/web/assets/beancount-k_qm7-4y.js +1 -0
  47. package/dist/web/assets/berry-uYugtg8r.js +1 -0
  48. package/dist/web/assets/bibtex-CHM0blh-.js +1 -0
  49. package/dist/web/assets/bicep-Bmn6On1c.js +1 -0
  50. package/dist/web/assets/bird2-BIv1doCn.js +1 -0
  51. package/dist/web/assets/blade-2xfisSek.js +1 -0
  52. package/dist/web/assets/bsl-BO_Y6i37.js +1 -0
  53. package/dist/web/assets/c-BIGW1oBm.js +1 -0
  54. package/dist/web/assets/c3-MRO5bC_T.js +1 -0
  55. package/dist/web/assets/cadence-Bv_4Rxtq.js +1 -0
  56. package/dist/web/assets/cairo-KRGpt6FW.js +1 -0
  57. package/dist/web/assets/catppuccin-frappe-DFWUc33u.js +1 -0
  58. package/dist/web/assets/catppuccin-latte-C9dUb6Cb.js +1 -0
  59. package/dist/web/assets/catppuccin-macchiato-DQyhUUbL.js +1 -0
  60. package/dist/web/assets/catppuccin-mocha-D87Tk5Gz.js +1 -0
  61. package/dist/web/assets/clarity-D53aC0YG.js +1 -0
  62. package/dist/web/assets/clojure-P80f7IUj.js +1 -0
  63. package/dist/web/assets/cmake-D1j8_8rp.js +1 -0
  64. package/dist/web/assets/cobol-nBiQ_Alo.js +1 -0
  65. package/dist/web/assets/codeowners-Bp6g37R7.js +1 -0
  66. package/dist/web/assets/codeql-DsOJ9woJ.js +1 -0
  67. package/dist/web/assets/coffee-Ch7k5sss.js +1 -0
  68. package/dist/web/assets/common-lisp-Cg-RD9OK.js +1 -0
  69. package/dist/web/assets/coq-DkFqJrB1.js +1 -0
  70. package/dist/web/assets/cpp-UfJy6YNI.js +1 -0
  71. package/dist/web/assets/crystal-DGywbUpC.js +1 -0
  72. package/dist/web/assets/csharp-DSvCPggb.js +1 -0
  73. package/dist/web/assets/css-CLj8gQPS.js +1 -0
  74. package/dist/web/assets/csv-fuZLfV_i.js +1 -0
  75. package/dist/web/assets/cue-D82EKSYY.js +1 -0
  76. package/dist/web/assets/cypher-COkxafJQ.js +1 -0
  77. package/dist/web/assets/d-85-TOEBH.js +1 -0
  78. package/dist/web/assets/dark-plus-C3mMm8J8.js +1 -0
  79. package/dist/web/assets/dart-bE4Kk8sk.js +1 -0
  80. package/dist/web/assets/dax-CEL-wOlO.js +1 -0
  81. package/dist/web/assets/desktop-BmXAJ9_W.js +1 -0
  82. package/dist/web/assets/diff-D97Zzqfu.js +1 -0
  83. package/dist/web/assets/docker-BcOcwvcX.js +1 -0
  84. package/dist/web/assets/dotenv-Da5cRb03.js +1 -0
  85. package/dist/web/assets/dracula-BzJJZx-M.js +1 -0
  86. package/dist/web/assets/dracula-soft-BXkSAIEj.js +1 -0
  87. package/dist/web/assets/dream-maker-BtqSS_iP.js +1 -0
  88. package/dist/web/assets/edge-FbVlp4U3.js +1 -0
  89. package/dist/web/assets/elixir-CkH2-t6x.js +1 -0
  90. package/dist/web/assets/elm-DbKCFpqz.js +1 -0
  91. package/dist/web/assets/emacs-lisp-CXvaQtF9.js +1 -0
  92. package/dist/web/assets/erb-Dm6A9KJ5.js +1 -0
  93. package/dist/web/assets/erlang-DsQrWhSR.js +1 -0
  94. package/dist/web/assets/everforest-dark-BgDCqdQA.js +1 -0
  95. package/dist/web/assets/everforest-light-C8M2exoo.js +1 -0
  96. package/dist/web/assets/fennel-BYunw83y.js +1 -0
  97. package/dist/web/assets/fish-BvzEVeQv.js +1 -0
  98. package/dist/web/assets/fluent-C4IJs8-o.js +1 -0
  99. package/dist/web/assets/fortran-fixed-form-CkoXwp7k.js +1 -0
  100. package/dist/web/assets/fortran-free-form-BxgE0vQu.js +1 -0
  101. package/dist/web/assets/fsharp-CXgrBDvD.js +1 -0
  102. package/dist/web/assets/gdresource-BOOCDP_w.js +1 -0
  103. package/dist/web/assets/gdscript-C5YyOfLZ.js +1 -0
  104. package/dist/web/assets/gdshader-DkwncUOv.js +1 -0
  105. package/dist/web/assets/genie-D0YGMca9.js +1 -0
  106. package/dist/web/assets/gherkin-DyxjwDmM.js +1 -0
  107. package/dist/web/assets/git-commit-F4YmCXRG.js +1 -0
  108. package/dist/web/assets/git-rebase-r7XF79zn.js +1 -0
  109. package/dist/web/assets/github-dark-DHJKELXO.js +1 -0
  110. package/dist/web/assets/github-dark-default-Cuk6v7N8.js +1 -0
  111. package/dist/web/assets/github-dark-dimmed-DH5Ifo-i.js +1 -0
  112. package/dist/web/assets/github-dark-high-contrast-E3gJ1_iC.js +1 -0
  113. package/dist/web/assets/github-light-DAi9KRSo.js +1 -0
  114. package/dist/web/assets/github-light-default-D7oLnXFd.js +1 -0
  115. package/dist/web/assets/github-light-high-contrast-BfjtVDDH.js +1 -0
  116. package/dist/web/assets/gleam-BspZqrRM.js +1 -0
  117. package/dist/web/assets/glimmer-js-ByusRIyA.js +1 -0
  118. package/dist/web/assets/glimmer-ts-BfAWNZQY.js +1 -0
  119. package/dist/web/assets/glsl-DplSGwfg.js +1 -0
  120. package/dist/web/assets/gn-n2N0HUVH.js +1 -0
  121. package/dist/web/assets/gnuplot-DdkO51Og.js +1 -0
  122. package/dist/web/assets/go-C27-OAKa.js +1 -0
  123. package/dist/web/assets/graphql-ChdNCCLP.js +1 -0
  124. package/dist/web/assets/groovy-gcz8RCvz.js +1 -0
  125. package/dist/web/assets/gruvbox-dark-hard-CFHQjOhq.js +1 -0
  126. package/dist/web/assets/gruvbox-dark-medium-GsRaNv29.js +1 -0
  127. package/dist/web/assets/gruvbox-dark-soft-CVdnzihN.js +1 -0
  128. package/dist/web/assets/gruvbox-light-hard-CH1njM8p.js +1 -0
  129. package/dist/web/assets/gruvbox-light-medium-DRw_LuNl.js +1 -0
  130. package/dist/web/assets/gruvbox-light-soft-hJgmCMqR.js +1 -0
  131. package/dist/web/assets/hack-DbPARsA_.js +1 -0
  132. package/dist/web/assets/haml-D5jkg6IW.js +1 -0
  133. package/dist/web/assets/handlebars-BpdQsYii.js +1 -0
  134. package/dist/web/assets/haskell-Df6bDoY_.js +1 -0
  135. package/dist/web/assets/haxe-CzTSHFRz.js +1 -0
  136. package/dist/web/assets/hcl-BWvSN4gD.js +1 -0
  137. package/dist/web/assets/hjson-D5-asLiD.js +1 -0
  138. package/dist/web/assets/hlsl-D3lLCCz7.js +1 -0
  139. package/dist/web/assets/horizon-BUw7H-hv.js +1 -0
  140. package/dist/web/assets/horizon-bright-CUuTKBJd.js +1 -0
  141. package/dist/web/assets/houston-DnULxvSX.js +1 -0
  142. package/dist/web/assets/html-derivative-DlHx6ybY.js +1 -0
  143. package/dist/web/assets/html-pp8916En.js +1 -0
  144. package/dist/web/assets/http-jrhK8wxY.js +1 -0
  145. package/dist/web/assets/hurl-irOxFIW8.js +1 -0
  146. package/dist/web/assets/hxml-Bvhsp5Yf.js +1 -0
  147. package/dist/web/assets/hy-DFXneXwc.js +1 -0
  148. package/dist/web/assets/imba-DGztddWO.js +1 -0
  149. package/dist/web/assets/index-C2E3ZO-C.js +298 -0
  150. package/dist/web/assets/{index-CGEQK8Pf.css → index-FSFABXQ1.css} +1 -1
  151. package/dist/web/assets/ini-BEwlwnbL.js +1 -0
  152. package/dist/web/assets/java-CylS5w8V.js +1 -0
  153. package/dist/web/assets/javascript-wDzz0qaB.js +1 -0
  154. package/dist/web/assets/jinja-f2NsQr07.js +1 -0
  155. package/dist/web/assets/jison-wvAkD_A8.js +1 -0
  156. package/dist/web/assets/json-Cp-IABpG.js +1 -0
  157. package/dist/web/assets/json5-C9tS-k6U.js +1 -0
  158. package/dist/web/assets/jsonc-Des-eS-w.js +1 -0
  159. package/dist/web/assets/jsonl-DcaNXYhu.js +1 -0
  160. package/dist/web/assets/jsonnet-DFQXde-d.js +1 -0
  161. package/dist/web/assets/jssm-C2t-YnRu.js +1 -0
  162. package/dist/web/assets/jsx-g9-lgVsj.js +1 -0
  163. package/dist/web/assets/julia-D7OTSIA_.js +1 -0
  164. package/dist/web/assets/just-CUsbIsdP.js +1 -0
  165. package/dist/web/assets/kanagawa-dragon-CkXjmgJE.js +1 -0
  166. package/dist/web/assets/kanagawa-lotus-CfQXZHmo.js +1 -0
  167. package/dist/web/assets/kanagawa-wave-DWedfzmr.js +1 -0
  168. package/dist/web/assets/kdl-DV7GczEv.js +1 -0
  169. package/dist/web/assets/kotlin-BdnUsdx6.js +1 -0
  170. package/dist/web/assets/kusto-wEQ09or8.js +1 -0
  171. package/dist/web/assets/laserwave-DUszq2jm.js +1 -0
  172. package/dist/web/assets/latex-CaSxy8MP.js +1 -0
  173. package/dist/web/assets/lean-BZvkOJ9d.js +1 -0
  174. package/dist/web/assets/less-B1dDrJ26.js +1 -0
  175. package/dist/web/assets/light-plus-B7mTdjB0.js +1 -0
  176. package/dist/web/assets/liquid-C0sCDyMI.js +1 -0
  177. package/dist/web/assets/llvm-DjAJT7YJ.js +1 -0
  178. package/dist/web/assets/log-2UxHyX5q.js +1 -0
  179. package/dist/web/assets/logo-BtOb2qkB.js +1 -0
  180. package/dist/web/assets/lua-BaeVxFsk.js +1 -0
  181. package/dist/web/assets/luau-KW6xsasC.js +1 -0
  182. package/dist/web/assets/make-CHLpvVh8.js +1 -0
  183. package/dist/web/assets/markdown-Cvjx9yec.js +1 -0
  184. package/dist/web/assets/marko-DjSrsDqO.js +1 -0
  185. package/dist/web/assets/material-theme-D5KoaKCx.js +1 -0
  186. package/dist/web/assets/material-theme-darker-BfHTSMKl.js +1 -0
  187. package/dist/web/assets/material-theme-lighter-B0m2ddpp.js +1 -0
  188. package/dist/web/assets/material-theme-ocean-CyktbL80.js +1 -0
  189. package/dist/web/assets/material-theme-palenight-Csfq5Kiy.js +1 -0
  190. package/dist/web/assets/matlab-D7o27uSR.js +1 -0
  191. package/dist/web/assets/mdc-DTYItulj.js +1 -0
  192. package/dist/web/assets/mdx-Cmh6b_Ma.js +1 -0
  193. package/dist/web/assets/mermaid-mWjccvbQ.js +1 -0
  194. package/dist/web/assets/min-dark-CafNBF8u.js +1 -0
  195. package/dist/web/assets/min-light-CTRr51gU.js +1 -0
  196. package/dist/web/assets/mipsasm-CKIfxQSi.js +1 -0
  197. package/dist/web/assets/mojo-rZm6bMo-.js +1 -0
  198. package/dist/web/assets/monokai-D4h5O-jR.js +1 -0
  199. package/dist/web/assets/moonbit-_H4v1dQx.js +1 -0
  200. package/dist/web/assets/move-IF9eRakj.js +1 -0
  201. package/dist/web/assets/narrat-DRg8JJMk.js +1 -0
  202. package/dist/web/assets/nextflow-C-mBbutL.js +1 -0
  203. package/dist/web/assets/nextflow-groovy-vE_lwT2v.js +1 -0
  204. package/dist/web/assets/nginx-BpAMiNFr.js +1 -0
  205. package/dist/web/assets/night-owl-C39BiMTA.js +1 -0
  206. package/dist/web/assets/night-owl-light-CMTm3GFP.js +1 -0
  207. package/dist/web/assets/nim-BIad80T-.js +1 -0
  208. package/dist/web/assets/nix-CwoSXNpI.js +1 -0
  209. package/dist/web/assets/nord-Ddv68eIx.js +1 -0
  210. package/dist/web/assets/nushell-Cz2AlsmD.js +1 -0
  211. package/dist/web/assets/objective-c-DXmwc3jG.js +1 -0
  212. package/dist/web/assets/objective-cpp-CLxacb5B.js +1 -0
  213. package/dist/web/assets/ocaml-C0hk2d4L.js +1 -0
  214. package/dist/web/assets/odin-BBf5iR-q.js +1 -0
  215. package/dist/web/assets/one-dark-pro-DVMEJ2y_.js +1 -0
  216. package/dist/web/assets/one-light-C3Wv6jpd.js +1 -0
  217. package/dist/web/assets/openscad-C4EeE6gA.js +1 -0
  218. package/dist/web/assets/pascal-D93ZcfNL.js +1 -0
  219. package/dist/web/assets/perl-B9cMNwum.js +1 -0
  220. package/dist/web/assets/php-Csjmro_R.js +1 -0
  221. package/dist/web/assets/pkl-u5AG7uiY.js +1 -0
  222. package/dist/web/assets/plastic-3e1v2bzS.js +1 -0
  223. package/dist/web/assets/plsql-ChMvpjG-.js +1 -0
  224. package/dist/web/assets/po-BTJTHyun.js +1 -0
  225. package/dist/web/assets/poimandres-CS3Unz2-.js +1 -0
  226. package/dist/web/assets/polar-C0HS_06l.js +1 -0
  227. package/dist/web/assets/postcss-CXtECtnM.js +1 -0
  228. package/dist/web/assets/powerquery-CEu0bR-o.js +1 -0
  229. package/dist/web/assets/powershell-Dpen1YoG.js +1 -0
  230. package/dist/web/assets/prisma-Dd19v3D-.js +1 -0
  231. package/dist/web/assets/prolog-CbFg5uaA.js +1 -0
  232. package/dist/web/assets/proto-C7zT0LnQ.js +1 -0
  233. package/dist/web/assets/pug-DKIMFp6K.js +1 -0
  234. package/dist/web/assets/puppet-BMWR74SV.js +1 -0
  235. package/dist/web/assets/purescript-CklMAg4u.js +1 -0
  236. package/dist/web/assets/python-B6aJPvgy.js +1 -0
  237. package/dist/web/assets/qml-3beO22l8.js +1 -0
  238. package/dist/web/assets/qmldir-C8lEn-DE.js +1 -0
  239. package/dist/web/assets/qss-IeuSbFQv.js +1 -0
  240. package/dist/web/assets/r-Dspwwk_N.js +1 -0
  241. package/dist/web/assets/racket-BqYA7rlc.js +1 -0
  242. package/dist/web/assets/raku-DXvB9xmW.js +1 -0
  243. package/dist/web/assets/razor-BjBPvh-w.js +1 -0
  244. package/dist/web/assets/red-bN70gL4F.js +1 -0
  245. package/dist/web/assets/reg-C-SQnVFl.js +1 -0
  246. package/dist/web/assets/regexp-CDVJQ6XC.js +1 -0
  247. package/dist/web/assets/rel-C3B-1QV4.js +1 -0
  248. package/dist/web/assets/riscv-BM1_JUlF.js +1 -0
  249. package/dist/web/assets/ron-D8l8udqQ.js +1 -0
  250. package/dist/web/assets/rose-pine-dawn-DHQR4-dF.js +1 -0
  251. package/dist/web/assets/rose-pine-moon-D4_iv3hh.js +1 -0
  252. package/dist/web/assets/rose-pine-qdsjHGoJ.js +1 -0
  253. package/dist/web/assets/rosmsg-BJDFO7_C.js +1 -0
  254. package/dist/web/assets/rst-CpCqk9r5.js +1 -0
  255. package/dist/web/assets/ruby-DyJCeAvU.js +1 -0
  256. package/dist/web/assets/rust-B1yitclQ.js +1 -0
  257. package/dist/web/assets/sas-DEy46yEz.js +1 -0
  258. package/dist/web/assets/sass-Cj5Yp3dK.js +1 -0
  259. package/dist/web/assets/scala-C151Ov-r.js +1 -0
  260. package/dist/web/assets/scheme-C98Dy4si.js +1 -0
  261. package/dist/web/assets/scss-D5BDwBP9.js +1 -0
  262. package/dist/web/assets/sdbl-DVxCFoDh.js +1 -0
  263. package/dist/web/assets/shaderlab-Dg9Lc6iA.js +1 -0
  264. package/dist/web/assets/shellscript-Yzrsuije.js +1 -0
  265. package/dist/web/assets/shellsession-BADoaaVG.js +1 -0
  266. package/dist/web/assets/slack-dark-BthQWCQV.js +1 -0
  267. package/dist/web/assets/slack-ochin-DqwNpetd.js +1 -0
  268. package/dist/web/assets/smalltalk-BERRCDM3.js +1 -0
  269. package/dist/web/assets/snazzy-light-Bw305WKR.js +1 -0
  270. package/dist/web/assets/solarized-dark-DXbdFlpD.js +1 -0
  271. package/dist/web/assets/solarized-light-L9t79GZl.js +1 -0
  272. package/dist/web/assets/solidity-rGO070M0.js +1 -0
  273. package/dist/web/assets/soy-8wufbnw4.js +1 -0
  274. package/dist/web/assets/sparql-rVzFXLq3.js +1 -0
  275. package/dist/web/assets/splunk-BtCnVYZw.js +1 -0
  276. package/dist/web/assets/sql-CRqJ_cUM.js +1 -0
  277. package/dist/web/assets/ssh-config-_ykCGR6B.js +1 -0
  278. package/dist/web/assets/stata-DI20mbqo.js +1 -0
  279. package/dist/web/assets/stylus-BEDo0Tqx.js +1 -0
  280. package/dist/web/assets/surrealql-Bq5Q-fJD.js +1 -0
  281. package/dist/web/assets/svelte-Cy7k_4gC.js +1 -0
  282. package/dist/web/assets/swift-D82vCrfD.js +1 -0
  283. package/dist/web/assets/synthwave-84-CbfX1IO0.js +1 -0
  284. package/dist/web/assets/system-verilog-CnnmHF94.js +1 -0
  285. package/dist/web/assets/systemd-4A_iFExJ.js +1 -0
  286. package/dist/web/assets/talonscript-CkByrt1z.js +1 -0
  287. package/dist/web/assets/tasl-QIJgUcNo.js +1 -0
  288. package/dist/web/assets/tcl-dwOrl1Do.js +1 -0
  289. package/dist/web/assets/templ-DhtptRzy.js +1 -0
  290. package/dist/web/assets/terraform-BETggiCN.js +1 -0
  291. package/dist/web/assets/tex-idrVyKtj.js +1 -0
  292. package/dist/web/assets/tokyo-night-hegEt444.js +1 -0
  293. package/dist/web/assets/toml-vGWfd6FD.js +1 -0
  294. package/dist/web/assets/ts-tags-D351s5mN.js +1 -0
  295. package/dist/web/assets/tsv-B_m7g4N7.js +1 -0
  296. package/dist/web/assets/tsx-COt5Ahok.js +1 -0
  297. package/dist/web/assets/turtle-BsS91CYL.js +1 -0
  298. package/dist/web/assets/twig-CW1WmMYd.js +1 -0
  299. package/dist/web/assets/typescript-BPQ3VLAy.js +1 -0
  300. package/dist/web/assets/typespec-CAFt9gP4.js +1 -0
  301. package/dist/web/assets/typst-DHCkPAjA.js +1 -0
  302. package/dist/web/assets/v-BcVCzyr7.js +1 -0
  303. package/dist/web/assets/vala-CsfeWuGM.js +1 -0
  304. package/dist/web/assets/vb-D17OF-Vu.js +1 -0
  305. package/dist/web/assets/verilog-BQ8w6xss.js +1 -0
  306. package/dist/web/assets/vesper-DRje8inN.js +1 -0
  307. package/dist/web/assets/vhdl-CeAyd5Ju.js +1 -0
  308. package/dist/web/assets/viml-CJc9bBzg.js +1 -0
  309. package/dist/web/assets/vitesse-black-Bkuqu6BP.js +1 -0
  310. package/dist/web/assets/vitesse-dark-D0r3Knsf.js +1 -0
  311. package/dist/web/assets/vitesse-light-CVO1_9PV.js +1 -0
  312. package/dist/web/assets/vue-D2xRrEX4.js +1 -0
  313. package/dist/web/assets/vue-html-AaS7Mt5G.js +1 -0
  314. package/dist/web/assets/vue-vine-BoDAl6tE.js +1 -0
  315. package/dist/web/assets/vyper-CDx5xZoG.js +1 -0
  316. package/dist/web/assets/wasm-CG6Dc4jp.js +1 -0
  317. package/dist/web/assets/wasm-MzD3tlZU.js +1 -0
  318. package/dist/web/assets/wenyan-BV7otONQ.js +1 -0
  319. package/dist/web/assets/wgsl-Dx-B1_4e.js +1 -0
  320. package/dist/web/assets/wikitext-BhOHFoWU.js +1 -0
  321. package/dist/web/assets/wit-5i3qLPDT.js +1 -0
  322. package/dist/web/assets/wolfram-lXgVvXCa.js +1 -0
  323. package/dist/web/assets/xml-sdJ4AIDG.js +1 -0
  324. package/dist/web/assets/xsl-CtQFsRM5.js +1 -0
  325. package/dist/web/assets/yaml-Buea-lGh.js +1 -0
  326. package/dist/web/assets/zenscript-DVFEvuxE.js +1 -0
  327. package/dist/web/assets/zig-VOosw3JB.js +1 -0
  328. package/dist/web/index.html +2 -2
  329. package/dist/web/sw.js +1 -1
  330. package/package.json +4 -2
  331. package/dist/web/assets/index-GOp_0IH2.js +0 -158
@@ -0,0 +1,298 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/angular-html-DA-rfuFy.js","assets/html-pp8916En.js","assets/javascript-wDzz0qaB.js","assets/css-CLj8gQPS.js","assets/angular-ts-BrjP3tb8.js","assets/scss-D5BDwBP9.js","assets/apl-CORt7UWP.js","assets/xml-sdJ4AIDG.js","assets/java-CylS5w8V.js","assets/json-Cp-IABpG.js","assets/astro-HNnZUWAn.js","assets/typescript-BPQ3VLAy.js","assets/postcss-CXtECtnM.js","assets/tsx-COt5Ahok.js","assets/blade-2xfisSek.js","assets/html-derivative-DlHx6ybY.js","assets/sql-CRqJ_cUM.js","assets/bsl-BO_Y6i37.js","assets/sdbl-DVxCFoDh.js","assets/cairo-KRGpt6FW.js","assets/python-B6aJPvgy.js","assets/cobol-nBiQ_Alo.js","assets/coffee-Ch7k5sss.js","assets/cpp-UfJy6YNI.js","assets/regexp-CDVJQ6XC.js","assets/glsl-DplSGwfg.js","assets/c-BIGW1oBm.js","assets/crystal-DGywbUpC.js","assets/shellscript-Yzrsuije.js","assets/edge-FbVlp4U3.js","assets/elixir-CkH2-t6x.js","assets/elm-DbKCFpqz.js","assets/erb-Dm6A9KJ5.js","assets/ruby-DyJCeAvU.js","assets/haml-D5jkg6IW.js","assets/graphql-ChdNCCLP.js","assets/jsx-g9-lgVsj.js","assets/lua-BaeVxFsk.js","assets/yaml-Buea-lGh.js","assets/erlang-DsQrWhSR.js","assets/markdown-Cvjx9yec.js","assets/fortran-fixed-form-CkoXwp7k.js","assets/fortran-free-form-BxgE0vQu.js","assets/fsharp-CXgrBDvD.js","assets/gdresource-BOOCDP_w.js","assets/gdshader-DkwncUOv.js","assets/gdscript-C5YyOfLZ.js","assets/git-commit-F4YmCXRG.js","assets/diff-D97Zzqfu.js","assets/git-rebase-r7XF79zn.js","assets/glimmer-js-ByusRIyA.js","assets/glimmer-ts-BfAWNZQY.js","assets/hack-DbPARsA_.js","assets/handlebars-BpdQsYii.js","assets/http-jrhK8wxY.js","assets/hurl-irOxFIW8.js","assets/csv-fuZLfV_i.js","assets/hxml-Bvhsp5Yf.js","assets/haxe-CzTSHFRz.js","assets/jinja-f2NsQr07.js","assets/jison-wvAkD_A8.js","assets/julia-D7OTSIA_.js","assets/r-Dspwwk_N.js","assets/just-CUsbIsdP.js","assets/perl-B9cMNwum.js","assets/latex-CaSxy8MP.js","assets/tex-idrVyKtj.js","assets/liquid-C0sCDyMI.js","assets/marko-DjSrsDqO.js","assets/less-B1dDrJ26.js","assets/mdc-DTYItulj.js","assets/nextflow-C-mBbutL.js","assets/nextflow-groovy-vE_lwT2v.js","assets/nginx-BpAMiNFr.js","assets/nim-BIad80T-.js","assets/php-Csjmro_R.js","assets/pug-DKIMFp6K.js","assets/qml-3beO22l8.js","assets/razor-BjBPvh-w.js","assets/csharp-DSvCPggb.js","assets/rst-CpCqk9r5.js","assets/cmake-D1j8_8rp.js","assets/sas-DEy46yEz.js","assets/shaderlab-Dg9Lc6iA.js","assets/hlsl-D3lLCCz7.js","assets/shellsession-BADoaaVG.js","assets/soy-8wufbnw4.js","assets/sparql-rVzFXLq3.js","assets/turtle-BsS91CYL.js","assets/stata-DI20mbqo.js","assets/surrealql-Bq5Q-fJD.js","assets/svelte-Cy7k_4gC.js","assets/templ-DhtptRzy.js","assets/go-C27-OAKa.js","assets/ts-tags-D351s5mN.js","assets/twig-CW1WmMYd.js","assets/vue-D2xRrEX4.js","assets/vue-html-AaS7Mt5G.js","assets/vue-vine-BoDAl6tE.js","assets/stylus-BEDo0Tqx.js","assets/xsl-CtQFsRM5.js"])))=>i.map(i=>d[i]);
2
+ var AE=Object.defineProperty;var DE=Object.getPrototypeOf;var LE=Reflect.get;var Vy=e=>{throw TypeError(e)};var RE=(e,t,n)=>t in e?AE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var me=(e,t,n)=>RE(e,typeof t!="symbol"?t+"":t,n),uf=(e,t,n)=>t.has(e)||Vy("Cannot "+n);var Tn=(e,t,n)=>(uf(e,t,"read from private field"),n?n.call(e):t.get(e)),ci=(e,t,n)=>t.has(e)?Vy("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),xr=(e,t,n,s)=>(uf(e,t,"write to private field"),s?s.call(e,n):t.set(e,n),n),df=(e,t,n)=>(uf(e,t,"access private method"),n);var Gy=(e,t,n)=>LE(DE(e),n,t);function OE(e,t){for(var n=0;n<t.length;n++){const s=t[n];if(typeof s!="string"&&!Array.isArray(s)){for(const a in s)if(a!=="default"&&!(a in e)){const o=Object.getOwnPropertyDescriptor(s,a);o&&Object.defineProperty(e,a,o.get?o:{enumerable:!0,get:()=>s[a]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))s(a);new MutationObserver(a=>{for(const o of a)if(o.type==="childList")for(const c of o.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&s(c)}).observe(document,{childList:!0,subtree:!0});function n(a){const o={};return a.integrity&&(o.integrity=a.integrity),a.referrerPolicy&&(o.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?o.credentials="include":a.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function s(a){if(a.ep)return;a.ep=!0;const o=n(a);fetch(a.href,o)}})();function bu(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var hf={exports:{}},Ro={};/**
3
+ * @license React
4
+ * react-jsx-runtime.production.js
5
+ *
6
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
7
+ *
8
+ * This source code is licensed under the MIT license found in the
9
+ * LICENSE file in the root directory of this source tree.
10
+ */var Wy;function ME(){if(Wy)return Ro;Wy=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(s,a,o){var c=null;if(o!==void 0&&(c=""+o),a.key!==void 0&&(c=""+a.key),"key"in a){o={};for(var l in a)l!=="key"&&(o[l]=a[l])}else o=a;return a=o.ref,{$$typeof:e,type:s,key:c,ref:a!==void 0?a:null,props:o}}return Ro.Fragment=t,Ro.jsx=n,Ro.jsxs=n,Ro}var qy;function IE(){return qy||(qy=1,hf.exports=ME()),hf.exports}var u=IE(),ff={exports:{}},Ye={};/**
11
+ * @license React
12
+ * react.production.js
13
+ *
14
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
15
+ *
16
+ * This source code is licensed under the MIT license found in the
17
+ * LICENSE file in the root directory of this source tree.
18
+ */var Ky;function PE(){if(Ky)return Ye;Ky=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),c=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),m=Symbol.for("react.activity"),_=Symbol.iterator;function y(z){return z===null||typeof z!="object"?null:(z=_&&z[_]||z["@@iterator"],typeof z=="function"?z:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,v={};function b(z,V,U){this.props=z,this.context=V,this.refs=v,this.updater=U||w}b.prototype.isReactComponent={},b.prototype.setState=function(z,V){if(typeof z!="object"&&typeof z!="function"&&z!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,z,V,"setState")},b.prototype.forceUpdate=function(z){this.updater.enqueueForceUpdate(this,z,"forceUpdate")};function x(){}x.prototype=b.prototype;function S(z,V,U){this.props=z,this.context=V,this.refs=v,this.updater=U||w}var j=S.prototype=new x;j.constructor=S,k(j,b.prototype),j.isPureReactComponent=!0;var N=Array.isArray;function T(){}var D={H:null,A:null,T:null,S:null},A=Object.prototype.hasOwnProperty;function B(z,V,U){var ee=U.ref;return{$$typeof:e,type:z,key:V,ref:ee!==void 0?ee:null,props:U}}function R(z,V){return B(z.type,V,z.props)}function $(z){return typeof z=="object"&&z!==null&&z.$$typeof===e}function F(z){var V={"=":"=0",":":"=2"};return"$"+z.replace(/[=:]/g,function(U){return V[U]})}var W=/\/+/g;function Y(z,V){return typeof z=="object"&&z!==null&&z.key!=null?F(""+z.key):V.toString(36)}function P(z){switch(z.status){case"fulfilled":return z.value;case"rejected":throw z.reason;default:switch(typeof z.status=="string"?z.then(T,T):(z.status="pending",z.then(function(V){z.status==="pending"&&(z.status="fulfilled",z.value=V)},function(V){z.status==="pending"&&(z.status="rejected",z.reason=V)})),z.status){case"fulfilled":return z.value;case"rejected":throw z.reason}}throw z}function H(z,V,U,ee,Z){var ne=typeof z;(ne==="undefined"||ne==="boolean")&&(z=null);var X=!1;if(z===null)X=!0;else switch(ne){case"bigint":case"string":case"number":X=!0;break;case"object":switch(z.$$typeof){case e:case t:X=!0;break;case p:return X=z._init,H(X(z._payload),V,U,ee,Z)}}if(X)return Z=Z(z),X=ee===""?"."+Y(z,0):ee,N(Z)?(U="",X!=null&&(U=X.replace(W,"$&/")+"/"),H(Z,V,U,"",function(se){return se})):Z!=null&&($(Z)&&(Z=R(Z,U+(Z.key==null||z&&z.key===Z.key?"":(""+Z.key).replace(W,"$&/")+"/")+X)),V.push(Z)),1;X=0;var G=ee===""?".":ee+":";if(N(z))for(var le=0;le<z.length;le++)ee=z[le],ne=G+Y(ee,le),X+=H(ee,V,U,ne,Z);else if(le=y(z),typeof le=="function")for(z=le.call(z),le=0;!(ee=z.next()).done;)ee=ee.value,ne=G+Y(ee,le++),X+=H(ee,V,U,ne,Z);else if(ne==="object"){if(typeof z.then=="function")return H(P(z),V,U,ee,Z);throw V=String(z),Error("Objects are not valid as a React child (found: "+(V==="[object Object]"?"object with keys {"+Object.keys(z).join(", ")+"}":V)+"). If you meant to render a collection of children, use an array instead.")}return X}function J(z,V,U){if(z==null)return z;var ee=[],Z=0;return H(z,ee,"","",function(ne){return V.call(U,ne,Z++)}),ee}function K(z){if(z._status===-1){var V=z._result;V=V(),V.then(function(U){(z._status===0||z._status===-1)&&(z._status=1,z._result=U)},function(U){(z._status===0||z._status===-1)&&(z._status=2,z._result=U)}),z._status===-1&&(z._status=0,z._result=V)}if(z._status===1)return z._result.default;throw z._result}var I=typeof reportError=="function"?reportError:function(z){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var V=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof z=="object"&&z!==null&&typeof z.message=="string"?String(z.message):String(z),error:z});if(!window.dispatchEvent(V))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",z);return}console.error(z)},L={map:J,forEach:function(z,V,U){J(z,function(){V.apply(this,arguments)},U)},count:function(z){var V=0;return J(z,function(){V++}),V},toArray:function(z){return J(z,function(V){return V})||[]},only:function(z){if(!$(z))throw Error("React.Children.only expected to receive a single React element child.");return z}};return Ye.Activity=m,Ye.Children=L,Ye.Component=b,Ye.Fragment=n,Ye.Profiler=a,Ye.PureComponent=S,Ye.StrictMode=s,Ye.Suspense=h,Ye.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=D,Ye.__COMPILER_RUNTIME={__proto__:null,c:function(z){return D.H.useMemoCache(z)}},Ye.cache=function(z){return function(){return z.apply(null,arguments)}},Ye.cacheSignal=function(){return null},Ye.cloneElement=function(z,V,U){if(z==null)throw Error("The argument must be a React element, but you passed "+z+".");var ee=k({},z.props),Z=z.key;if(V!=null)for(ne in V.key!==void 0&&(Z=""+V.key),V)!A.call(V,ne)||ne==="key"||ne==="__self"||ne==="__source"||ne==="ref"&&V.ref===void 0||(ee[ne]=V[ne]);var ne=arguments.length-2;if(ne===1)ee.children=U;else if(1<ne){for(var X=Array(ne),G=0;G<ne;G++)X[G]=arguments[G+2];ee.children=X}return B(z.type,Z,ee)},Ye.createContext=function(z){return z={$$typeof:c,_currentValue:z,_currentValue2:z,_threadCount:0,Provider:null,Consumer:null},z.Provider=z,z.Consumer={$$typeof:o,_context:z},z},Ye.createElement=function(z,V,U){var ee,Z={},ne=null;if(V!=null)for(ee in V.key!==void 0&&(ne=""+V.key),V)A.call(V,ee)&&ee!=="key"&&ee!=="__self"&&ee!=="__source"&&(Z[ee]=V[ee]);var X=arguments.length-2;if(X===1)Z.children=U;else if(1<X){for(var G=Array(X),le=0;le<X;le++)G[le]=arguments[le+2];Z.children=G}if(z&&z.defaultProps)for(ee in X=z.defaultProps,X)Z[ee]===void 0&&(Z[ee]=X[ee]);return B(z,ne,Z)},Ye.createRef=function(){return{current:null}},Ye.forwardRef=function(z){return{$$typeof:l,render:z}},Ye.isValidElement=$,Ye.lazy=function(z){return{$$typeof:p,_payload:{_status:-1,_result:z},_init:K}},Ye.memo=function(z,V){return{$$typeof:f,type:z,compare:V===void 0?null:V}},Ye.startTransition=function(z){var V=D.T,U={};D.T=U;try{var ee=z(),Z=D.S;Z!==null&&Z(U,ee),typeof ee=="object"&&ee!==null&&typeof ee.then=="function"&&ee.then(T,I)}catch(ne){I(ne)}finally{V!==null&&U.types!==null&&(V.types=U.types),D.T=V}},Ye.unstable_useCacheRefresh=function(){return D.H.useCacheRefresh()},Ye.use=function(z){return D.H.use(z)},Ye.useActionState=function(z,V,U){return D.H.useActionState(z,V,U)},Ye.useCallback=function(z,V){return D.H.useCallback(z,V)},Ye.useContext=function(z){return D.H.useContext(z)},Ye.useDebugValue=function(){},Ye.useDeferredValue=function(z,V){return D.H.useDeferredValue(z,V)},Ye.useEffect=function(z,V){return D.H.useEffect(z,V)},Ye.useEffectEvent=function(z){return D.H.useEffectEvent(z)},Ye.useId=function(){return D.H.useId()},Ye.useImperativeHandle=function(z,V,U){return D.H.useImperativeHandle(z,V,U)},Ye.useInsertionEffect=function(z,V){return D.H.useInsertionEffect(z,V)},Ye.useLayoutEffect=function(z,V){return D.H.useLayoutEffect(z,V)},Ye.useMemo=function(z,V){return D.H.useMemo(z,V)},Ye.useOptimistic=function(z,V){return D.H.useOptimistic(z,V)},Ye.useReducer=function(z,V,U){return D.H.useReducer(z,V,U)},Ye.useRef=function(z){return D.H.useRef(z)},Ye.useState=function(z){return D.H.useState(z)},Ye.useSyncExternalStore=function(z,V,U){return D.H.useSyncExternalStore(z,V,U)},Ye.useTransition=function(){return D.H.useTransition()},Ye.version="19.2.4",Ye}var Yy;function Su(){return Yy||(Yy=1,ff.exports=PE()),ff.exports}var O=Su();const Hs=bu(O),BE=OE({__proto__:null,default:Hs},[O]);var mf={exports:{}},Oo={},pf={exports:{}},gf={};/**
19
+ * @license React
20
+ * scheduler.production.js
21
+ *
22
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
23
+ *
24
+ * This source code is licensed under the MIT license found in the
25
+ * LICENSE file in the root directory of this source tree.
26
+ */var Xy;function zE(){return Xy||(Xy=1,(function(e){function t(H,J){var K=H.length;H.push(J);e:for(;0<K;){var I=K-1>>>1,L=H[I];if(0<a(L,J))H[I]=J,H[K]=L,K=I;else break e}}function n(H){return H.length===0?null:H[0]}function s(H){if(H.length===0)return null;var J=H[0],K=H.pop();if(K!==J){H[0]=K;e:for(var I=0,L=H.length,z=L>>>1;I<z;){var V=2*(I+1)-1,U=H[V],ee=V+1,Z=H[ee];if(0>a(U,K))ee<L&&0>a(Z,U)?(H[I]=Z,H[ee]=K,I=ee):(H[I]=U,H[V]=K,I=V);else if(ee<L&&0>a(Z,K))H[I]=Z,H[ee]=K,I=ee;else break e}}return J}function a(H,J){var K=H.sortIndex-J.sortIndex;return K!==0?K:H.id-J.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var c=Date,l=c.now();e.unstable_now=function(){return c.now()-l}}var h=[],f=[],p=1,m=null,_=3,y=!1,w=!1,k=!1,v=!1,b=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,S=typeof setImmediate<"u"?setImmediate:null;function j(H){for(var J=n(f);J!==null;){if(J.callback===null)s(f);else if(J.startTime<=H)s(f),J.sortIndex=J.expirationTime,t(h,J);else break;J=n(f)}}function N(H){if(k=!1,j(H),!w)if(n(h)!==null)w=!0,T||(T=!0,F());else{var J=n(f);J!==null&&P(N,J.startTime-H)}}var T=!1,D=-1,A=5,B=-1;function R(){return v?!0:!(e.unstable_now()-B<A)}function $(){if(v=!1,T){var H=e.unstable_now();B=H;var J=!0;try{e:{w=!1,k&&(k=!1,x(D),D=-1),y=!0;var K=_;try{t:{for(j(H),m=n(h);m!==null&&!(m.expirationTime>H&&R());){var I=m.callback;if(typeof I=="function"){m.callback=null,_=m.priorityLevel;var L=I(m.expirationTime<=H);if(H=e.unstable_now(),typeof L=="function"){m.callback=L,j(H),J=!0;break t}m===n(h)&&s(h),j(H)}else s(h);m=n(h)}if(m!==null)J=!0;else{var z=n(f);z!==null&&P(N,z.startTime-H),J=!1}}break e}finally{m=null,_=K,y=!1}J=void 0}}finally{J?F():T=!1}}}var F;if(typeof S=="function")F=function(){S($)};else if(typeof MessageChannel<"u"){var W=new MessageChannel,Y=W.port2;W.port1.onmessage=$,F=function(){Y.postMessage(null)}}else F=function(){b($,0)};function P(H,J){D=b(function(){H(e.unstable_now())},J)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(H){H.callback=null},e.unstable_forceFrameRate=function(H){0>H||125<H?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):A=0<H?Math.floor(1e3/H):5},e.unstable_getCurrentPriorityLevel=function(){return _},e.unstable_next=function(H){switch(_){case 1:case 2:case 3:var J=3;break;default:J=_}var K=_;_=J;try{return H()}finally{_=K}},e.unstable_requestPaint=function(){v=!0},e.unstable_runWithPriority=function(H,J){switch(H){case 1:case 2:case 3:case 4:case 5:break;default:H=3}var K=_;_=H;try{return J()}finally{_=K}},e.unstable_scheduleCallback=function(H,J,K){var I=e.unstable_now();switch(typeof K=="object"&&K!==null?(K=K.delay,K=typeof K=="number"&&0<K?I+K:I):K=I,H){case 1:var L=-1;break;case 2:L=250;break;case 5:L=1073741823;break;case 4:L=1e4;break;default:L=5e3}return L=K+L,H={id:p++,callback:J,priorityLevel:H,startTime:K,expirationTime:L,sortIndex:-1},K>I?(H.sortIndex=K,t(f,H),n(h)===null&&H===n(f)&&(k?(x(D),D=-1):k=!0,P(N,K-I))):(H.sortIndex=L,t(h,H),w||y||(w=!0,T||(T=!0,F()))),H},e.unstable_shouldYield=R,e.unstable_wrapCallback=function(H){var J=_;return function(){var K=_;_=J;try{return H.apply(this,arguments)}finally{_=K}}}})(gf)),gf}var Qy;function HE(){return Qy||(Qy=1,pf.exports=zE()),pf.exports}var xf={exports:{}},bn={};/**
27
+ * @license React
28
+ * react-dom.production.js
29
+ *
30
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
31
+ *
32
+ * This source code is licensed under the MIT license found in the
33
+ * LICENSE file in the root directory of this source tree.
34
+ */var Jy;function $E(){if(Jy)return bn;Jy=1;var e=Su();function t(h){var f="https://react.dev/errors/"+h;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)f+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+h+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var s={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},a=Symbol.for("react.portal");function o(h,f,p){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:m==null?null:""+m,children:h,containerInfo:f,implementation:p}}var c=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(h,f){if(h==="font")return"";if(typeof f=="string")return f==="use-credentials"?f:""}return bn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,bn.createPortal=function(h,f){var p=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!f||f.nodeType!==1&&f.nodeType!==9&&f.nodeType!==11)throw Error(t(299));return o(h,f,null,p)},bn.flushSync=function(h){var f=c.T,p=s.p;try{if(c.T=null,s.p=2,h)return h()}finally{c.T=f,s.p=p,s.d.f()}},bn.preconnect=function(h,f){typeof h=="string"&&(f?(f=f.crossOrigin,f=typeof f=="string"?f==="use-credentials"?f:"":void 0):f=null,s.d.C(h,f))},bn.prefetchDNS=function(h){typeof h=="string"&&s.d.D(h)},bn.preinit=function(h,f){if(typeof h=="string"&&f&&typeof f.as=="string"){var p=f.as,m=l(p,f.crossOrigin),_=typeof f.integrity=="string"?f.integrity:void 0,y=typeof f.fetchPriority=="string"?f.fetchPriority:void 0;p==="style"?s.d.S(h,typeof f.precedence=="string"?f.precedence:void 0,{crossOrigin:m,integrity:_,fetchPriority:y}):p==="script"&&s.d.X(h,{crossOrigin:m,integrity:_,fetchPriority:y,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},bn.preinitModule=function(h,f){if(typeof h=="string")if(typeof f=="object"&&f!==null){if(f.as==null||f.as==="script"){var p=l(f.as,f.crossOrigin);s.d.M(h,{crossOrigin:p,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0})}}else f==null&&s.d.M(h)},bn.preload=function(h,f){if(typeof h=="string"&&typeof f=="object"&&f!==null&&typeof f.as=="string"){var p=f.as,m=l(p,f.crossOrigin);s.d.L(h,p,{crossOrigin:m,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0,type:typeof f.type=="string"?f.type:void 0,fetchPriority:typeof f.fetchPriority=="string"?f.fetchPriority:void 0,referrerPolicy:typeof f.referrerPolicy=="string"?f.referrerPolicy:void 0,imageSrcSet:typeof f.imageSrcSet=="string"?f.imageSrcSet:void 0,imageSizes:typeof f.imageSizes=="string"?f.imageSizes:void 0,media:typeof f.media=="string"?f.media:void 0})}},bn.preloadModule=function(h,f){if(typeof h=="string")if(f){var p=l(f.as,f.crossOrigin);s.d.m(h,{as:typeof f.as=="string"&&f.as!=="script"?f.as:void 0,crossOrigin:p,integrity:typeof f.integrity=="string"?f.integrity:void 0})}else s.d.m(h)},bn.requestFormReset=function(h){s.d.r(h)},bn.unstable_batchedUpdates=function(h,f){return h(f)},bn.useFormState=function(h,f,p){return c.H.useFormState(h,f,p)},bn.useFormStatus=function(){return c.H.useHostTransitionStatus()},bn.version="19.2.4",bn}var Zy;function I0(){if(Zy)return xf.exports;Zy=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),xf.exports=$E(),xf.exports}/**
35
+ * @license React
36
+ * react-dom-client.production.js
37
+ *
38
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
39
+ *
40
+ * This source code is licensed under the MIT license found in the
41
+ * LICENSE file in the root directory of this source tree.
42
+ */var ev;function UE(){if(ev)return Oo;ev=1;var e=HE(),t=Su(),n=I0();function s(r){var i="https://react.dev/errors/"+r;if(1<arguments.length){i+="?args[]="+encodeURIComponent(arguments[1]);for(var d=2;d<arguments.length;d++)i+="&args[]="+encodeURIComponent(arguments[d])}return"Minified React error #"+r+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function o(r){var i=r,d=r;if(r.alternate)for(;i.return;)i=i.return;else{r=i;do i=r,(i.flags&4098)!==0&&(d=i.return),r=i.return;while(r)}return i.tag===3?d:null}function c(r){if(r.tag===13){var i=r.memoizedState;if(i===null&&(r=r.alternate,r!==null&&(i=r.memoizedState)),i!==null)return i.dehydrated}return null}function l(r){if(r.tag===31){var i=r.memoizedState;if(i===null&&(r=r.alternate,r!==null&&(i=r.memoizedState)),i!==null)return i.dehydrated}return null}function h(r){if(o(r)!==r)throw Error(s(188))}function f(r){var i=r.alternate;if(!i){if(i=o(r),i===null)throw Error(s(188));return i!==r?null:r}for(var d=r,g=i;;){var C=d.return;if(C===null)break;var E=C.alternate;if(E===null){if(g=C.return,g!==null){d=g;continue}break}if(C.child===E.child){for(E=C.child;E;){if(E===d)return h(C),r;if(E===g)return h(C),i;E=E.sibling}throw Error(s(188))}if(d.return!==g.return)d=C,g=E;else{for(var M=!1,q=C.child;q;){if(q===d){M=!0,d=C,g=E;break}if(q===g){M=!0,g=C,d=E;break}q=q.sibling}if(!M){for(q=E.child;q;){if(q===d){M=!0,d=E,g=C;break}if(q===g){M=!0,g=E,d=C;break}q=q.sibling}if(!M)throw Error(s(189))}}if(d.alternate!==g)throw Error(s(190))}if(d.tag!==3)throw Error(s(188));return d.stateNode.current===d?r:i}function p(r){var i=r.tag;if(i===5||i===26||i===27||i===6)return r;for(r=r.child;r!==null;){if(i=p(r),i!==null)return i;r=r.sibling}return null}var m=Object.assign,_=Symbol.for("react.element"),y=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),v=Symbol.for("react.strict_mode"),b=Symbol.for("react.profiler"),x=Symbol.for("react.consumer"),S=Symbol.for("react.context"),j=Symbol.for("react.forward_ref"),N=Symbol.for("react.suspense"),T=Symbol.for("react.suspense_list"),D=Symbol.for("react.memo"),A=Symbol.for("react.lazy"),B=Symbol.for("react.activity"),R=Symbol.for("react.memo_cache_sentinel"),$=Symbol.iterator;function F(r){return r===null||typeof r!="object"?null:(r=$&&r[$]||r["@@iterator"],typeof r=="function"?r:null)}var W=Symbol.for("react.client.reference");function Y(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===W?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case k:return"Fragment";case b:return"Profiler";case v:return"StrictMode";case N:return"Suspense";case T:return"SuspenseList";case B:return"Activity"}if(typeof r=="object")switch(r.$$typeof){case w:return"Portal";case S:return r.displayName||"Context";case x:return(r._context.displayName||"Context")+".Consumer";case j:var i=r.render;return r=r.displayName,r||(r=i.displayName||i.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case D:return i=r.displayName||null,i!==null?i:Y(r.type)||"Memo";case A:i=r._payload,r=r._init;try{return Y(r(i))}catch{}}return null}var P=Array.isArray,H=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,J=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K={pending:!1,data:null,method:null,action:null},I=[],L=-1;function z(r){return{current:r}}function V(r){0>L||(r.current=I[L],I[L]=null,L--)}function U(r,i){L++,I[L]=r.current,r.current=i}var ee=z(null),Z=z(null),ne=z(null),X=z(null);function G(r,i){switch(U(ne,i),U(Z,r),U(ee,null),i.nodeType){case 9:case 11:r=(r=i.documentElement)&&(r=r.namespaceURI)?fy(r):0;break;default:if(r=i.tagName,i=i.namespaceURI)i=fy(i),r=my(i,r);else switch(r){case"svg":r=1;break;case"math":r=2;break;default:r=0}}V(ee),U(ee,r)}function le(){V(ee),V(Z),V(ne)}function se(r){r.memoizedState!==null&&U(X,r);var i=ee.current,d=my(i,r.type);i!==d&&(U(Z,r),U(ee,d))}function ve(r){Z.current===r&&(V(ee),V(Z)),X.current===r&&(V(X),No._currentValue=K)}var be,Oe;function Be(r){if(be===void 0)try{throw Error()}catch(d){var i=d.stack.trim().match(/\n( *(at )?)/);be=i&&i[1]||"",Oe=-1<d.stack.indexOf(`
43
+ at`)?" (<anonymous>)":-1<d.stack.indexOf("@")?"@unknown:0:0":""}return`
44
+ `+be+r+Oe}var Pe=!1;function Ve(r,i){if(!r||Pe)return"";Pe=!0;var d=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var g={DetermineComponentFrameRoot:function(){try{if(i){var _e=function(){throw Error()};if(Object.defineProperty(_e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(_e,[])}catch(de){var ce=de}Reflect.construct(r,[],_e)}else{try{_e.call()}catch(de){ce=de}r.call(_e.prototype)}}else{try{throw Error()}catch(de){ce=de}(_e=r())&&typeof _e.catch=="function"&&_e.catch(function(){})}}catch(de){if(de&&ce&&typeof de.stack=="string")return[de.stack,ce.stack]}return[null,null]}};g.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var C=Object.getOwnPropertyDescriptor(g.DetermineComponentFrameRoot,"name");C&&C.configurable&&Object.defineProperty(g.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var E=g.DetermineComponentFrameRoot(),M=E[0],q=E[1];if(M&&q){var te=M.split(`
45
+ `),oe=q.split(`
46
+ `);for(C=g=0;g<te.length&&!te[g].includes("DetermineComponentFrameRoot");)g++;for(;C<oe.length&&!oe[C].includes("DetermineComponentFrameRoot");)C++;if(g===te.length||C===oe.length)for(g=te.length-1,C=oe.length-1;1<=g&&0<=C&&te[g]!==oe[C];)C--;for(;1<=g&&0<=C;g--,C--)if(te[g]!==oe[C]){if(g!==1||C!==1)do if(g--,C--,0>C||te[g]!==oe[C]){var pe=`
47
+ `+te[g].replace(" at new "," at ");return r.displayName&&pe.includes("<anonymous>")&&(pe=pe.replace("<anonymous>",r.displayName)),pe}while(1<=g&&0<=C);break}}}finally{Pe=!1,Error.prepareStackTrace=d}return(d=r?r.displayName||r.name:"")?Be(d):""}function Ae(r,i){switch(r.tag){case 26:case 27:case 5:return Be(r.type);case 16:return Be("Lazy");case 13:return r.child!==i&&i!==null?Be("Suspense Fallback"):Be("Suspense");case 19:return Be("SuspenseList");case 0:case 15:return Ve(r.type,!1);case 11:return Ve(r.type.render,!1);case 1:return Ve(r.type,!0);case 31:return Be("Activity");default:return""}}function dt(r){try{var i="",d=null;do i+=Ae(r,d),d=r,r=r.return;while(r);return i}catch(g){return`
48
+ Error generating stack: `+g.message+`
49
+ `+g.stack}}var lt=Object.prototype.hasOwnProperty,ye=e.unstable_scheduleCallback,Ne=e.unstable_cancelCallback,fe=e.unstable_shouldYield,De=e.unstable_requestPaint,ze=e.unstable_now,_t=e.unstable_getCurrentPriorityLevel,ue=e.unstable_ImmediatePriority,we=e.unstable_UserBlockingPriority,Le=e.unstable_NormalPriority,He=e.unstable_LowPriority,Xe=e.unstable_IdlePriority,It=e.log,st=e.unstable_setDisableYieldValue,he=null,Re=null;function qe(r){if(typeof It=="function"&&st(r),Re&&typeof Re.setStrictMode=="function")try{Re.setStrictMode(he,r)}catch{}}var Ke=Math.clz32?Math.clz32:Ni,nn=Math.log,Ht=Math.LN2;function Ni(r){return r>>>=0,r===0?32:31-(nn(r)/Ht|0)|0}var ge=256,Se=262144,Te=4194304;function Je(r){var i=r&42;if(i!==0)return i;switch(r&-r){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return r&261888;case 262144:case 524288:case 1048576:case 2097152:return r&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return r&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return r}}function ht(r,i,d){var g=r.pendingLanes;if(g===0)return 0;var C=0,E=r.suspendedLanes,M=r.pingedLanes;r=r.warmLanes;var q=g&134217727;return q!==0?(g=q&~E,g!==0?C=Je(g):(M&=q,M!==0?C=Je(M):d||(d=q&~r,d!==0&&(C=Je(d))))):(q=g&~E,q!==0?C=Je(q):M!==0?C=Je(M):d||(d=g&~r,d!==0&&(C=Je(d)))),C===0?0:i!==0&&i!==C&&(i&E)===0&&(E=C&-C,d=i&-i,E>=d||E===32&&(d&4194048)!==0)?i:C}function Ge(r,i){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&i)===0}function mn(r,i){switch(r){case 1:case 2:case 4:case 8:case 64:return i+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return i+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Gt(){var r=Te;return Te<<=1,(Te&62914560)===0&&(Te=4194304),r}function rn(r){for(var i=[],d=0;31>d;d++)i.push(r);return i}function Ai(r,i){r.pendingLanes|=i,i!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function Qu(r,i,d,g,C,E){var M=r.pendingLanes;r.pendingLanes=d,r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0,r.expiredLanes&=d,r.entangledLanes&=d,r.errorRecoveryDisabledLanes&=d,r.shellSuspendCounter=0;var q=r.entanglements,te=r.expirationTimes,oe=r.hiddenUpdates;for(d=M&~d;0<d;){var pe=31-Ke(d),_e=1<<pe;q[pe]=0,te[pe]=-1;var ce=oe[pe];if(ce!==null)for(oe[pe]=null,pe=0;pe<ce.length;pe++){var de=ce[pe];de!==null&&(de.lane&=-536870913)}d&=~_e}g!==0&&Yp(r,g,0),E!==0&&C===0&&r.tag!==0&&(r.suspendedLanes|=E&~(M&~i))}function Yp(r,i,d){r.pendingLanes|=i,r.suspendedLanes&=~i;var g=31-Ke(i);r.entangledLanes|=i,r.entanglements[g]=r.entanglements[g]|1073741824|d&261930}function Xp(r,i){var d=r.entangledLanes|=i;for(r=r.entanglements;d;){var g=31-Ke(d),C=1<<g;C&i|r[g]&i&&(r[g]|=i),d&=~C}}function Qp(r,i){var d=i&-i;return d=(d&42)!==0?1:Ju(d),(d&(r.suspendedLanes|i))!==0?0:d}function Ju(r){switch(r){case 2:r=1;break;case 8:r=4;break;case 32:r=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:r=128;break;case 268435456:r=134217728;break;default:r=0}return r}function Zu(r){return r&=-r,2<r?8<r?(r&134217727)!==0?32:268435456:8:2}function Jp(){var r=J.p;return r!==0?r:(r=window.event,r===void 0?32:Py(r.type))}function Zp(r,i){var d=J.p;try{return J.p=r,i()}finally{J.p=d}}var ds=Math.random().toString(36).slice(2),pn="__reactFiber$"+ds,An="__reactProps$"+ds,Di="__reactContainer$"+ds,ed="__reactEvents$"+ds,yC="__reactListeners$"+ds,vC="__reactHandles$"+ds,eg="__reactResources$"+ds,Fa="__reactMarker$"+ds;function td(r){delete r[pn],delete r[An],delete r[ed],delete r[yC],delete r[vC]}function Li(r){var i=r[pn];if(i)return i;for(var d=r.parentNode;d;){if(i=d[Di]||d[pn]){if(d=i.alternate,i.child!==null||d!==null&&d.child!==null)for(r=by(r);r!==null;){if(d=r[pn])return d;r=by(r)}return i}r=d,d=r.parentNode}return null}function Ri(r){if(r=r[pn]||r[Di]){var i=r.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return r}return null}function Va(r){var i=r.tag;if(i===5||i===26||i===27||i===6)return r.stateNode;throw Error(s(33))}function Oi(r){var i=r[eg];return i||(i=r[eg]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function un(r){r[Fa]=!0}var tg=new Set,ng={};function Ws(r,i){Mi(r,i),Mi(r+"Capture",i)}function Mi(r,i){for(ng[r]=i,r=0;r<i.length;r++)tg.add(i[r])}var bC=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),rg={},sg={};function SC(r){return lt.call(sg,r)?!0:lt.call(rg,r)?!1:bC.test(r)?sg[r]=!0:(rg[r]=!0,!1)}function vl(r,i,d){if(SC(i))if(d===null)r.removeAttribute(i);else{switch(typeof d){case"undefined":case"function":case"symbol":r.removeAttribute(i);return;case"boolean":var g=i.toLowerCase().slice(0,5);if(g!=="data-"&&g!=="aria-"){r.removeAttribute(i);return}}r.setAttribute(i,""+d)}}function bl(r,i,d){if(d===null)r.removeAttribute(i);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(i);return}r.setAttribute(i,""+d)}}function Br(r,i,d,g){if(g===null)r.removeAttribute(d);else{switch(typeof g){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(d);return}r.setAttributeNS(i,d,""+g)}}function Zn(r){switch(typeof r){case"bigint":case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function ig(r){var i=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function wC(r,i,d){var g=Object.getOwnPropertyDescriptor(r.constructor.prototype,i);if(!r.hasOwnProperty(i)&&typeof g<"u"&&typeof g.get=="function"&&typeof g.set=="function"){var C=g.get,E=g.set;return Object.defineProperty(r,i,{configurable:!0,get:function(){return C.call(this)},set:function(M){d=""+M,E.call(this,M)}}),Object.defineProperty(r,i,{enumerable:g.enumerable}),{getValue:function(){return d},setValue:function(M){d=""+M},stopTracking:function(){r._valueTracker=null,delete r[i]}}}}function nd(r){if(!r._valueTracker){var i=ig(r)?"checked":"value";r._valueTracker=wC(r,i,""+r[i])}}function ag(r){if(!r)return!1;var i=r._valueTracker;if(!i)return!0;var d=i.getValue(),g="";return r&&(g=ig(r)?r.checked?"true":"false":r.value),r=g,r!==d?(i.setValue(r),!0):!1}function Sl(r){if(r=r||(typeof document<"u"?document:void 0),typeof r>"u")return null;try{return r.activeElement||r.body}catch{return r.body}}var CC=/[\n"\\]/g;function er(r){return r.replace(CC,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function rd(r,i,d,g,C,E,M,q){r.name="",M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"?r.type=M:r.removeAttribute("type"),i!=null?M==="number"?(i===0&&r.value===""||r.value!=i)&&(r.value=""+Zn(i)):r.value!==""+Zn(i)&&(r.value=""+Zn(i)):M!=="submit"&&M!=="reset"||r.removeAttribute("value"),i!=null?sd(r,M,Zn(i)):d!=null?sd(r,M,Zn(d)):g!=null&&r.removeAttribute("value"),C==null&&E!=null&&(r.defaultChecked=!!E),C!=null&&(r.checked=C&&typeof C!="function"&&typeof C!="symbol"),q!=null&&typeof q!="function"&&typeof q!="symbol"&&typeof q!="boolean"?r.name=""+Zn(q):r.removeAttribute("name")}function og(r,i,d,g,C,E,M,q){if(E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"&&(r.type=E),i!=null||d!=null){if(!(E!=="submit"&&E!=="reset"||i!=null)){nd(r);return}d=d!=null?""+Zn(d):"",i=i!=null?""+Zn(i):d,q||i===r.value||(r.value=i),r.defaultValue=i}g=g??C,g=typeof g!="function"&&typeof g!="symbol"&&!!g,r.checked=q?r.checked:!!g,r.defaultChecked=!!g,M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"&&(r.name=M),nd(r)}function sd(r,i,d){i==="number"&&Sl(r.ownerDocument)===r||r.defaultValue===""+d||(r.defaultValue=""+d)}function Ii(r,i,d,g){if(r=r.options,i){i={};for(var C=0;C<d.length;C++)i["$"+d[C]]=!0;for(d=0;d<r.length;d++)C=i.hasOwnProperty("$"+r[d].value),r[d].selected!==C&&(r[d].selected=C),C&&g&&(r[d].defaultSelected=!0)}else{for(d=""+Zn(d),i=null,C=0;C<r.length;C++){if(r[C].value===d){r[C].selected=!0,g&&(r[C].defaultSelected=!0);return}i!==null||r[C].disabled||(i=r[C])}i!==null&&(i.selected=!0)}}function lg(r,i,d){if(i!=null&&(i=""+Zn(i),i!==r.value&&(r.value=i),d==null)){r.defaultValue!==i&&(r.defaultValue=i);return}r.defaultValue=d!=null?""+Zn(d):""}function cg(r,i,d,g){if(i==null){if(g!=null){if(d!=null)throw Error(s(92));if(P(g)){if(1<g.length)throw Error(s(93));g=g[0]}d=g}d==null&&(d=""),i=d}d=Zn(i),r.defaultValue=d,g=r.textContent,g===d&&g!==""&&g!==null&&(r.value=g),nd(r)}function Pi(r,i){if(i){var d=r.firstChild;if(d&&d===r.lastChild&&d.nodeType===3){d.nodeValue=i;return}}r.textContent=i}var kC=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function ug(r,i,d){var g=i.indexOf("--")===0;d==null||typeof d=="boolean"||d===""?g?r.setProperty(i,""):i==="float"?r.cssFloat="":r[i]="":g?r.setProperty(i,d):typeof d!="number"||d===0||kC.has(i)?i==="float"?r.cssFloat=d:r[i]=(""+d).trim():r[i]=d+"px"}function dg(r,i,d){if(i!=null&&typeof i!="object")throw Error(s(62));if(r=r.style,d!=null){for(var g in d)!d.hasOwnProperty(g)||i!=null&&i.hasOwnProperty(g)||(g.indexOf("--")===0?r.setProperty(g,""):g==="float"?r.cssFloat="":r[g]="");for(var C in i)g=i[C],i.hasOwnProperty(C)&&d[C]!==g&&ug(r,C,g)}else for(var E in i)i.hasOwnProperty(E)&&ug(r,E,i[E])}function id(r){if(r.indexOf("-")===-1)return!1;switch(r){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var EC=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["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"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["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"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["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"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),jC=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function wl(r){return jC.test(""+r)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":r}function zr(){}var ad=null;function od(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var Bi=null,zi=null;function hg(r){var i=Ri(r);if(i&&(r=i.stateNode)){var d=r[An]||null;e:switch(r=i.stateNode,i.type){case"input":if(rd(r,d.value,d.defaultValue,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name),i=d.name,d.type==="radio"&&i!=null){for(d=r;d.parentNode;)d=d.parentNode;for(d=d.querySelectorAll('input[name="'+er(""+i)+'"][type="radio"]'),i=0;i<d.length;i++){var g=d[i];if(g!==r&&g.form===r.form){var C=g[An]||null;if(!C)throw Error(s(90));rd(g,C.value,C.defaultValue,C.defaultValue,C.checked,C.defaultChecked,C.type,C.name)}}for(i=0;i<d.length;i++)g=d[i],g.form===r.form&&ag(g)}break e;case"textarea":lg(r,d.value,d.defaultValue);break e;case"select":i=d.value,i!=null&&Ii(r,!!d.multiple,i,!1)}}}var ld=!1;function fg(r,i,d){if(ld)return r(i,d);ld=!0;try{var g=r(i);return g}finally{if(ld=!1,(Bi!==null||zi!==null)&&(uc(),Bi&&(i=Bi,r=zi,zi=Bi=null,hg(i),r)))for(i=0;i<r.length;i++)hg(r[i])}}function Ga(r,i){var d=r.stateNode;if(d===null)return null;var g=d[An]||null;if(g===null)return null;d=g[i];e:switch(i){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(g=!g.disabled)||(r=r.type,g=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!g;break e;default:r=!1}if(r)return null;if(d&&typeof d!="function")throw Error(s(231,i,typeof d));return d}var Hr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),cd=!1;if(Hr)try{var Wa={};Object.defineProperty(Wa,"passive",{get:function(){cd=!0}}),window.addEventListener("test",Wa,Wa),window.removeEventListener("test",Wa,Wa)}catch{cd=!1}var hs=null,ud=null,Cl=null;function mg(){if(Cl)return Cl;var r,i=ud,d=i.length,g,C="value"in hs?hs.value:hs.textContent,E=C.length;for(r=0;r<d&&i[r]===C[r];r++);var M=d-r;for(g=1;g<=M&&i[d-g]===C[E-g];g++);return Cl=C.slice(r,1<g?1-g:void 0)}function kl(r){var i=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&i===13&&(r=13)):r=i,r===10&&(r=13),32<=r||r===13?r:0}function El(){return!0}function pg(){return!1}function Dn(r){function i(d,g,C,E,M){this._reactName=d,this._targetInst=C,this.type=g,this.nativeEvent=E,this.target=M,this.currentTarget=null;for(var q in r)r.hasOwnProperty(q)&&(d=r[q],this[q]=d?d(E):E[q]);return this.isDefaultPrevented=(E.defaultPrevented!=null?E.defaultPrevented:E.returnValue===!1)?El:pg,this.isPropagationStopped=pg,this}return m(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var d=this.nativeEvent;d&&(d.preventDefault?d.preventDefault():typeof d.returnValue!="unknown"&&(d.returnValue=!1),this.isDefaultPrevented=El)},stopPropagation:function(){var d=this.nativeEvent;d&&(d.stopPropagation?d.stopPropagation():typeof d.cancelBubble!="unknown"&&(d.cancelBubble=!0),this.isPropagationStopped=El)},persist:function(){},isPersistent:El}),i}var qs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},jl=Dn(qs),qa=m({},qs,{view:0,detail:0}),TC=Dn(qa),dd,hd,Ka,Tl=m({},qa,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:md,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==Ka&&(Ka&&r.type==="mousemove"?(dd=r.screenX-Ka.screenX,hd=r.screenY-Ka.screenY):hd=dd=0,Ka=r),dd)},movementY:function(r){return"movementY"in r?r.movementY:hd}}),gg=Dn(Tl),NC=m({},Tl,{dataTransfer:0}),AC=Dn(NC),DC=m({},qa,{relatedTarget:0}),fd=Dn(DC),LC=m({},qs,{animationName:0,elapsedTime:0,pseudoElement:0}),RC=Dn(LC),OC=m({},qs,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),MC=Dn(OC),IC=m({},qs,{data:0}),xg=Dn(IC),PC={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},BC={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},zC={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function HC(r){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(r):(r=zC[r])?!!i[r]:!1}function md(){return HC}var $C=m({},qa,{key:function(r){if(r.key){var i=PC[r.key]||r.key;if(i!=="Unidentified")return i}return r.type==="keypress"?(r=kl(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?BC[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:md,charCode:function(r){return r.type==="keypress"?kl(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?kl(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),UC=Dn($C),FC=m({},Tl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),_g=Dn(FC),VC=m({},qa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:md}),GC=Dn(VC),WC=m({},qs,{propertyName:0,elapsedTime:0,pseudoElement:0}),qC=Dn(WC),KC=m({},Tl,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),YC=Dn(KC),XC=m({},qs,{newState:0,oldState:0}),QC=Dn(XC),JC=[9,13,27,32],pd=Hr&&"CompositionEvent"in window,Ya=null;Hr&&"documentMode"in document&&(Ya=document.documentMode);var ZC=Hr&&"TextEvent"in window&&!Ya,yg=Hr&&(!pd||Ya&&8<Ya&&11>=Ya),vg=" ",bg=!1;function Sg(r,i){switch(r){case"keyup":return JC.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function wg(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var Hi=!1;function ek(r,i){switch(r){case"compositionend":return wg(i);case"keypress":return i.which!==32?null:(bg=!0,vg);case"textInput":return r=i.data,r===vg&&bg?null:r;default:return null}}function tk(r,i){if(Hi)return r==="compositionend"||!pd&&Sg(r,i)?(r=mg(),Cl=ud=hs=null,Hi=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1<i.char.length)return i.char;if(i.which)return String.fromCharCode(i.which)}return null;case"compositionend":return yg&&i.locale!=="ko"?null:i.data;default:return null}}var nk={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Cg(r){var i=r&&r.nodeName&&r.nodeName.toLowerCase();return i==="input"?!!nk[r.type]:i==="textarea"}function kg(r,i,d,g){Bi?zi?zi.push(g):zi=[g]:Bi=g,i=xc(i,"onChange"),0<i.length&&(d=new jl("onChange","change",null,d,g),r.push({event:d,listeners:i}))}var Xa=null,Qa=null;function rk(r){oy(r,0)}function Nl(r){var i=Va(r);if(ag(i))return r}function Eg(r,i){if(r==="change")return i}var jg=!1;if(Hr){var gd;if(Hr){var xd="oninput"in document;if(!xd){var Tg=document.createElement("div");Tg.setAttribute("oninput","return;"),xd=typeof Tg.oninput=="function"}gd=xd}else gd=!1;jg=gd&&(!document.documentMode||9<document.documentMode)}function Ng(){Xa&&(Xa.detachEvent("onpropertychange",Ag),Qa=Xa=null)}function Ag(r){if(r.propertyName==="value"&&Nl(Qa)){var i=[];kg(i,Qa,r,od(r)),fg(rk,i)}}function sk(r,i,d){r==="focusin"?(Ng(),Xa=i,Qa=d,Xa.attachEvent("onpropertychange",Ag)):r==="focusout"&&Ng()}function ik(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return Nl(Qa)}function ak(r,i){if(r==="click")return Nl(i)}function ok(r,i){if(r==="input"||r==="change")return Nl(i)}function lk(r,i){return r===i&&(r!==0||1/r===1/i)||r!==r&&i!==i}var Hn=typeof Object.is=="function"?Object.is:lk;function Ja(r,i){if(Hn(r,i))return!0;if(typeof r!="object"||r===null||typeof i!="object"||i===null)return!1;var d=Object.keys(r),g=Object.keys(i);if(d.length!==g.length)return!1;for(g=0;g<d.length;g++){var C=d[g];if(!lt.call(i,C)||!Hn(r[C],i[C]))return!1}return!0}function Dg(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function Lg(r,i){var d=Dg(r);r=0;for(var g;d;){if(d.nodeType===3){if(g=r+d.textContent.length,r<=i&&g>=i)return{node:d,offset:i-r};r=g}e:{for(;d;){if(d.nextSibling){d=d.nextSibling;break e}d=d.parentNode}d=void 0}d=Dg(d)}}function Rg(r,i){return r&&i?r===i?!0:r&&r.nodeType===3?!1:i&&i.nodeType===3?Rg(r,i.parentNode):"contains"in r?r.contains(i):r.compareDocumentPosition?!!(r.compareDocumentPosition(i)&16):!1:!1}function Og(r){r=r!=null&&r.ownerDocument!=null&&r.ownerDocument.defaultView!=null?r.ownerDocument.defaultView:window;for(var i=Sl(r.document);i instanceof r.HTMLIFrameElement;){try{var d=typeof i.contentWindow.location.href=="string"}catch{d=!1}if(d)r=i.contentWindow;else break;i=Sl(r.document)}return i}function _d(r){var i=r&&r.nodeName&&r.nodeName.toLowerCase();return i&&(i==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||i==="textarea"||r.contentEditable==="true")}var ck=Hr&&"documentMode"in document&&11>=document.documentMode,$i=null,yd=null,Za=null,vd=!1;function Mg(r,i,d){var g=d.window===d?d.document:d.nodeType===9?d:d.ownerDocument;vd||$i==null||$i!==Sl(g)||(g=$i,"selectionStart"in g&&_d(g)?g={start:g.selectionStart,end:g.selectionEnd}:(g=(g.ownerDocument&&g.ownerDocument.defaultView||window).getSelection(),g={anchorNode:g.anchorNode,anchorOffset:g.anchorOffset,focusNode:g.focusNode,focusOffset:g.focusOffset}),Za&&Ja(Za,g)||(Za=g,g=xc(yd,"onSelect"),0<g.length&&(i=new jl("onSelect","select",null,i,d),r.push({event:i,listeners:g}),i.target=$i)))}function Ks(r,i){var d={};return d[r.toLowerCase()]=i.toLowerCase(),d["Webkit"+r]="webkit"+i,d["Moz"+r]="moz"+i,d}var Ui={animationend:Ks("Animation","AnimationEnd"),animationiteration:Ks("Animation","AnimationIteration"),animationstart:Ks("Animation","AnimationStart"),transitionrun:Ks("Transition","TransitionRun"),transitionstart:Ks("Transition","TransitionStart"),transitioncancel:Ks("Transition","TransitionCancel"),transitionend:Ks("Transition","TransitionEnd")},bd={},Ig={};Hr&&(Ig=document.createElement("div").style,"AnimationEvent"in window||(delete Ui.animationend.animation,delete Ui.animationiteration.animation,delete Ui.animationstart.animation),"TransitionEvent"in window||delete Ui.transitionend.transition);function Ys(r){if(bd[r])return bd[r];if(!Ui[r])return r;var i=Ui[r],d;for(d in i)if(i.hasOwnProperty(d)&&d in Ig)return bd[r]=i[d];return r}var Pg=Ys("animationend"),Bg=Ys("animationiteration"),zg=Ys("animationstart"),uk=Ys("transitionrun"),dk=Ys("transitionstart"),hk=Ys("transitioncancel"),Hg=Ys("transitionend"),$g=new Map,Sd="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Sd.push("scrollEnd");function mr(r,i){$g.set(r,i),Ws(i,[r])}var Al=typeof reportError=="function"?reportError:function(r){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var i=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof r=="object"&&r!==null&&typeof r.message=="string"?String(r.message):String(r),error:r});if(!window.dispatchEvent(i))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",r);return}console.error(r)},tr=[],Fi=0,wd=0;function Dl(){for(var r=Fi,i=wd=Fi=0;i<r;){var d=tr[i];tr[i++]=null;var g=tr[i];tr[i++]=null;var C=tr[i];tr[i++]=null;var E=tr[i];if(tr[i++]=null,g!==null&&C!==null){var M=g.pending;M===null?C.next=C:(C.next=M.next,M.next=C),g.pending=C}E!==0&&Ug(d,C,E)}}function Ll(r,i,d,g){tr[Fi++]=r,tr[Fi++]=i,tr[Fi++]=d,tr[Fi++]=g,wd|=g,r.lanes|=g,r=r.alternate,r!==null&&(r.lanes|=g)}function Cd(r,i,d,g){return Ll(r,i,d,g),Rl(r)}function Xs(r,i){return Ll(r,null,null,i),Rl(r)}function Ug(r,i,d){r.lanes|=d;var g=r.alternate;g!==null&&(g.lanes|=d);for(var C=!1,E=r.return;E!==null;)E.childLanes|=d,g=E.alternate,g!==null&&(g.childLanes|=d),E.tag===22&&(r=E.stateNode,r===null||r._visibility&1||(C=!0)),r=E,E=E.return;return r.tag===3?(E=r.stateNode,C&&i!==null&&(C=31-Ke(d),r=E.hiddenUpdates,g=r[C],g===null?r[C]=[i]:g.push(i),i.lane=d|536870912),E):null}function Rl(r){if(50<So)throw So=0,Rh=null,Error(s(185));for(var i=r.return;i!==null;)r=i,i=r.return;return r.tag===3?r.stateNode:null}var Vi={};function fk(r,i,d,g){this.tag=r,this.key=d,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=i,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=g,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function $n(r,i,d,g){return new fk(r,i,d,g)}function kd(r){return r=r.prototype,!(!r||!r.isReactComponent)}function $r(r,i){var d=r.alternate;return d===null?(d=$n(r.tag,i,r.key,r.mode),d.elementType=r.elementType,d.type=r.type,d.stateNode=r.stateNode,d.alternate=r,r.alternate=d):(d.pendingProps=i,d.type=r.type,d.flags=0,d.subtreeFlags=0,d.deletions=null),d.flags=r.flags&65011712,d.childLanes=r.childLanes,d.lanes=r.lanes,d.child=r.child,d.memoizedProps=r.memoizedProps,d.memoizedState=r.memoizedState,d.updateQueue=r.updateQueue,i=r.dependencies,d.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},d.sibling=r.sibling,d.index=r.index,d.ref=r.ref,d.refCleanup=r.refCleanup,d}function Fg(r,i){r.flags&=65011714;var d=r.alternate;return d===null?(r.childLanes=0,r.lanes=i,r.child=null,r.subtreeFlags=0,r.memoizedProps=null,r.memoizedState=null,r.updateQueue=null,r.dependencies=null,r.stateNode=null):(r.childLanes=d.childLanes,r.lanes=d.lanes,r.child=d.child,r.subtreeFlags=0,r.deletions=null,r.memoizedProps=d.memoizedProps,r.memoizedState=d.memoizedState,r.updateQueue=d.updateQueue,r.type=d.type,i=d.dependencies,r.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),r}function Ol(r,i,d,g,C,E){var M=0;if(g=r,typeof r=="function")kd(r)&&(M=1);else if(typeof r=="string")M=_E(r,d,ee.current)?26:r==="html"||r==="head"||r==="body"?27:5;else e:switch(r){case B:return r=$n(31,d,i,C),r.elementType=B,r.lanes=E,r;case k:return Qs(d.children,C,E,i);case v:M=8,C|=24;break;case b:return r=$n(12,d,i,C|2),r.elementType=b,r.lanes=E,r;case N:return r=$n(13,d,i,C),r.elementType=N,r.lanes=E,r;case T:return r=$n(19,d,i,C),r.elementType=T,r.lanes=E,r;default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case S:M=10;break e;case x:M=9;break e;case j:M=11;break e;case D:M=14;break e;case A:M=16,g=null;break e}M=29,d=Error(s(130,r===null?"null":typeof r,"")),g=null}return i=$n(M,d,i,C),i.elementType=r,i.type=g,i.lanes=E,i}function Qs(r,i,d,g){return r=$n(7,r,g,i),r.lanes=d,r}function Ed(r,i,d){return r=$n(6,r,null,i),r.lanes=d,r}function Vg(r){var i=$n(18,null,null,0);return i.stateNode=r,i}function jd(r,i,d){return i=$n(4,r.children!==null?r.children:[],r.key,i),i.lanes=d,i.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},i}var Gg=new WeakMap;function nr(r,i){if(typeof r=="object"&&r!==null){var d=Gg.get(r);return d!==void 0?d:(i={value:r,source:i,stack:dt(i)},Gg.set(r,i),i)}return{value:r,source:i,stack:dt(i)}}var Gi=[],Wi=0,Ml=null,eo=0,rr=[],sr=0,fs=null,Cr=1,kr="";function Ur(r,i){Gi[Wi++]=eo,Gi[Wi++]=Ml,Ml=r,eo=i}function Wg(r,i,d){rr[sr++]=Cr,rr[sr++]=kr,rr[sr++]=fs,fs=r;var g=Cr;r=kr;var C=32-Ke(g)-1;g&=~(1<<C),d+=1;var E=32-Ke(i)+C;if(30<E){var M=C-C%5;E=(g&(1<<M)-1).toString(32),g>>=M,C-=M,Cr=1<<32-Ke(i)+C|d<<C|g,kr=E+r}else Cr=1<<E|d<<C|g,kr=r}function Td(r){r.return!==null&&(Ur(r,1),Wg(r,1,0))}function Nd(r){for(;r===Ml;)Ml=Gi[--Wi],Gi[Wi]=null,eo=Gi[--Wi],Gi[Wi]=null;for(;r===fs;)fs=rr[--sr],rr[sr]=null,kr=rr[--sr],rr[sr]=null,Cr=rr[--sr],rr[sr]=null}function qg(r,i){rr[sr++]=Cr,rr[sr++]=kr,rr[sr++]=fs,Cr=i.id,kr=i.overflow,fs=r}var gn=null,At=null,ft=!1,ms=null,ir=!1,Ad=Error(s(519));function ps(r){var i=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw to(nr(i,r)),Ad}function Kg(r){var i=r.stateNode,d=r.type,g=r.memoizedProps;switch(i[pn]=r,i[An]=g,d){case"dialog":at("cancel",i),at("close",i);break;case"iframe":case"object":case"embed":at("load",i);break;case"video":case"audio":for(d=0;d<Co.length;d++)at(Co[d],i);break;case"source":at("error",i);break;case"img":case"image":case"link":at("error",i),at("load",i);break;case"details":at("toggle",i);break;case"input":at("invalid",i),og(i,g.value,g.defaultValue,g.checked,g.defaultChecked,g.type,g.name,!0);break;case"select":at("invalid",i);break;case"textarea":at("invalid",i),cg(i,g.value,g.defaultValue,g.children)}d=g.children,typeof d!="string"&&typeof d!="number"&&typeof d!="bigint"||i.textContent===""+d||g.suppressHydrationWarning===!0||dy(i.textContent,d)?(g.popover!=null&&(at("beforetoggle",i),at("toggle",i)),g.onScroll!=null&&at("scroll",i),g.onScrollEnd!=null&&at("scrollend",i),g.onClick!=null&&(i.onclick=zr),i=!0):i=!1,i||ps(r,!0)}function Yg(r){for(gn=r.return;gn;)switch(gn.tag){case 5:case 31:case 13:ir=!1;return;case 27:case 3:ir=!0;return;default:gn=gn.return}}function qi(r){if(r!==gn)return!1;if(!ft)return Yg(r),ft=!0,!1;var i=r.tag,d;if((d=i!==3&&i!==27)&&((d=i===5)&&(d=r.type,d=!(d!=="form"&&d!=="button")||Kh(r.type,r.memoizedProps)),d=!d),d&&At&&ps(r),Yg(r),i===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(s(317));At=vy(r)}else if(i===31){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(s(317));At=vy(r)}else i===27?(i=At,Ns(r.type)?(r=Zh,Zh=null,At=r):At=i):At=gn?or(r.stateNode.nextSibling):null;return!0}function Js(){At=gn=null,ft=!1}function Dd(){var r=ms;return r!==null&&(Mn===null?Mn=r:Mn.push.apply(Mn,r),ms=null),r}function to(r){ms===null?ms=[r]:ms.push(r)}var Ld=z(null),Zs=null,Fr=null;function gs(r,i,d){U(Ld,i._currentValue),i._currentValue=d}function Vr(r){r._currentValue=Ld.current,V(Ld)}function Rd(r,i,d){for(;r!==null;){var g=r.alternate;if((r.childLanes&i)!==i?(r.childLanes|=i,g!==null&&(g.childLanes|=i)):g!==null&&(g.childLanes&i)!==i&&(g.childLanes|=i),r===d)break;r=r.return}}function Od(r,i,d,g){var C=r.child;for(C!==null&&(C.return=r);C!==null;){var E=C.dependencies;if(E!==null){var M=C.child;E=E.firstContext;e:for(;E!==null;){var q=E;E=C;for(var te=0;te<i.length;te++)if(q.context===i[te]){E.lanes|=d,q=E.alternate,q!==null&&(q.lanes|=d),Rd(E.return,d,r),g||(M=null);break e}E=q.next}}else if(C.tag===18){if(M=C.return,M===null)throw Error(s(341));M.lanes|=d,E=M.alternate,E!==null&&(E.lanes|=d),Rd(M,d,r),M=null}else M=C.child;if(M!==null)M.return=C;else for(M=C;M!==null;){if(M===r){M=null;break}if(C=M.sibling,C!==null){C.return=M.return,M=C;break}M=M.return}C=M}}function Ki(r,i,d,g){r=null;for(var C=i,E=!1;C!==null;){if(!E){if((C.flags&524288)!==0)E=!0;else if((C.flags&262144)!==0)break}if(C.tag===10){var M=C.alternate;if(M===null)throw Error(s(387));if(M=M.memoizedProps,M!==null){var q=C.type;Hn(C.pendingProps.value,M.value)||(r!==null?r.push(q):r=[q])}}else if(C===X.current){if(M=C.alternate,M===null)throw Error(s(387));M.memoizedState.memoizedState!==C.memoizedState.memoizedState&&(r!==null?r.push(No):r=[No])}C=C.return}r!==null&&Od(i,r,d,g),i.flags|=262144}function Il(r){for(r=r.firstContext;r!==null;){if(!Hn(r.context._currentValue,r.memoizedValue))return!0;r=r.next}return!1}function ei(r){Zs=r,Fr=null,r=r.dependencies,r!==null&&(r.firstContext=null)}function xn(r){return Xg(Zs,r)}function Pl(r,i){return Zs===null&&ei(r),Xg(r,i)}function Xg(r,i){var d=i._currentValue;if(i={context:i,memoizedValue:d,next:null},Fr===null){if(r===null)throw Error(s(308));Fr=i,r.dependencies={lanes:0,firstContext:i},r.flags|=524288}else Fr=Fr.next=i;return d}var mk=typeof AbortController<"u"?AbortController:function(){var r=[],i=this.signal={aborted:!1,addEventListener:function(d,g){r.push(g)}};this.abort=function(){i.aborted=!0,r.forEach(function(d){return d()})}},pk=e.unstable_scheduleCallback,gk=e.unstable_NormalPriority,Wt={$$typeof:S,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Md(){return{controller:new mk,data:new Map,refCount:0}}function no(r){r.refCount--,r.refCount===0&&pk(gk,function(){r.controller.abort()})}var ro=null,Id=0,Yi=0,Xi=null;function xk(r,i){if(ro===null){var d=ro=[];Id=0,Yi=zh(),Xi={status:"pending",value:void 0,then:function(g){d.push(g)}}}return Id++,i.then(Qg,Qg),i}function Qg(){if(--Id===0&&ro!==null){Xi!==null&&(Xi.status="fulfilled");var r=ro;ro=null,Yi=0,Xi=null;for(var i=0;i<r.length;i++)(0,r[i])()}}function _k(r,i){var d=[],g={status:"pending",value:null,reason:null,then:function(C){d.push(C)}};return r.then(function(){g.status="fulfilled",g.value=i;for(var C=0;C<d.length;C++)(0,d[C])(i)},function(C){for(g.status="rejected",g.reason=C,C=0;C<d.length;C++)(0,d[C])(void 0)}),g}var Jg=H.S;H.S=function(r,i){M_=ze(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&xk(r,i),Jg!==null&&Jg(r,i)};var ti=z(null);function Pd(){var r=ti.current;return r!==null?r:Ct.pooledCache}function Bl(r,i){i===null?U(ti,ti.current):U(ti,i.pool)}function Zg(){var r=Pd();return r===null?null:{parent:Wt._currentValue,pool:r}}var Qi=Error(s(460)),Bd=Error(s(474)),zl=Error(s(542)),Hl={then:function(){}};function ex(r){return r=r.status,r==="fulfilled"||r==="rejected"}function tx(r,i,d){switch(d=r[d],d===void 0?r.push(i):d!==i&&(i.then(zr,zr),i=d),i.status){case"fulfilled":return i.value;case"rejected":throw r=i.reason,rx(r),r;default:if(typeof i.status=="string")i.then(zr,zr);else{if(r=Ct,r!==null&&100<r.shellSuspendCounter)throw Error(s(482));r=i,r.status="pending",r.then(function(g){if(i.status==="pending"){var C=i;C.status="fulfilled",C.value=g}},function(g){if(i.status==="pending"){var C=i;C.status="rejected",C.reason=g}})}switch(i.status){case"fulfilled":return i.value;case"rejected":throw r=i.reason,rx(r),r}throw ri=i,Qi}}function ni(r){try{var i=r._init;return i(r._payload)}catch(d){throw d!==null&&typeof d=="object"&&typeof d.then=="function"?(ri=d,Qi):d}}var ri=null;function nx(){if(ri===null)throw Error(s(459));var r=ri;return ri=null,r}function rx(r){if(r===Qi||r===zl)throw Error(s(483))}var Ji=null,so=0;function $l(r){var i=so;return so+=1,Ji===null&&(Ji=[]),tx(Ji,r,i)}function io(r,i){i=i.props.ref,r.ref=i!==void 0?i:null}function Ul(r,i){throw i.$$typeof===_?Error(s(525)):(r=Object.prototype.toString.call(i),Error(s(31,r==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":r)))}function sx(r){function i(ie,re){if(r){var ae=ie.deletions;ae===null?(ie.deletions=[re],ie.flags|=16):ae.push(re)}}function d(ie,re){if(!r)return null;for(;re!==null;)i(ie,re),re=re.sibling;return null}function g(ie){for(var re=new Map;ie!==null;)ie.key!==null?re.set(ie.key,ie):re.set(ie.index,ie),ie=ie.sibling;return re}function C(ie,re){return ie=$r(ie,re),ie.index=0,ie.sibling=null,ie}function E(ie,re,ae){return ie.index=ae,r?(ae=ie.alternate,ae!==null?(ae=ae.index,ae<re?(ie.flags|=67108866,re):ae):(ie.flags|=67108866,re)):(ie.flags|=1048576,re)}function M(ie){return r&&ie.alternate===null&&(ie.flags|=67108866),ie}function q(ie,re,ae,xe){return re===null||re.tag!==6?(re=Ed(ae,ie.mode,xe),re.return=ie,re):(re=C(re,ae),re.return=ie,re)}function te(ie,re,ae,xe){var $e=ae.type;return $e===k?pe(ie,re,ae.props.children,xe,ae.key):re!==null&&(re.elementType===$e||typeof $e=="object"&&$e!==null&&$e.$$typeof===A&&ni($e)===re.type)?(re=C(re,ae.props),io(re,ae),re.return=ie,re):(re=Ol(ae.type,ae.key,ae.props,null,ie.mode,xe),io(re,ae),re.return=ie,re)}function oe(ie,re,ae,xe){return re===null||re.tag!==4||re.stateNode.containerInfo!==ae.containerInfo||re.stateNode.implementation!==ae.implementation?(re=jd(ae,ie.mode,xe),re.return=ie,re):(re=C(re,ae.children||[]),re.return=ie,re)}function pe(ie,re,ae,xe,$e){return re===null||re.tag!==7?(re=Qs(ae,ie.mode,xe,$e),re.return=ie,re):(re=C(re,ae),re.return=ie,re)}function _e(ie,re,ae){if(typeof re=="string"&&re!==""||typeof re=="number"||typeof re=="bigint")return re=Ed(""+re,ie.mode,ae),re.return=ie,re;if(typeof re=="object"&&re!==null){switch(re.$$typeof){case y:return ae=Ol(re.type,re.key,re.props,null,ie.mode,ae),io(ae,re),ae.return=ie,ae;case w:return re=jd(re,ie.mode,ae),re.return=ie,re;case A:return re=ni(re),_e(ie,re,ae)}if(P(re)||F(re))return re=Qs(re,ie.mode,ae,null),re.return=ie,re;if(typeof re.then=="function")return _e(ie,$l(re),ae);if(re.$$typeof===S)return _e(ie,Pl(ie,re),ae);Ul(ie,re)}return null}function ce(ie,re,ae,xe){var $e=re!==null?re.key:null;if(typeof ae=="string"&&ae!==""||typeof ae=="number"||typeof ae=="bigint")return $e!==null?null:q(ie,re,""+ae,xe);if(typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case y:return ae.key===$e?te(ie,re,ae,xe):null;case w:return ae.key===$e?oe(ie,re,ae,xe):null;case A:return ae=ni(ae),ce(ie,re,ae,xe)}if(P(ae)||F(ae))return $e!==null?null:pe(ie,re,ae,xe,null);if(typeof ae.then=="function")return ce(ie,re,$l(ae),xe);if(ae.$$typeof===S)return ce(ie,re,Pl(ie,ae),xe);Ul(ie,ae)}return null}function de(ie,re,ae,xe,$e){if(typeof xe=="string"&&xe!==""||typeof xe=="number"||typeof xe=="bigint")return ie=ie.get(ae)||null,q(re,ie,""+xe,$e);if(typeof xe=="object"&&xe!==null){switch(xe.$$typeof){case y:return ie=ie.get(xe.key===null?ae:xe.key)||null,te(re,ie,xe,$e);case w:return ie=ie.get(xe.key===null?ae:xe.key)||null,oe(re,ie,xe,$e);case A:return xe=ni(xe),de(ie,re,ae,xe,$e)}if(P(xe)||F(xe))return ie=ie.get(ae)||null,pe(re,ie,xe,$e,null);if(typeof xe.then=="function")return de(ie,re,ae,$l(xe),$e);if(xe.$$typeof===S)return de(ie,re,ae,Pl(re,xe),$e);Ul(re,xe)}return null}function Me(ie,re,ae,xe){for(var $e=null,pt=null,Ie=re,et=re=0,ut=null;Ie!==null&&et<ae.length;et++){Ie.index>et?(ut=Ie,Ie=null):ut=Ie.sibling;var gt=ce(ie,Ie,ae[et],xe);if(gt===null){Ie===null&&(Ie=ut);break}r&&Ie&&gt.alternate===null&&i(ie,Ie),re=E(gt,re,et),pt===null?$e=gt:pt.sibling=gt,pt=gt,Ie=ut}if(et===ae.length)return d(ie,Ie),ft&&Ur(ie,et),$e;if(Ie===null){for(;et<ae.length;et++)Ie=_e(ie,ae[et],xe),Ie!==null&&(re=E(Ie,re,et),pt===null?$e=Ie:pt.sibling=Ie,pt=Ie);return ft&&Ur(ie,et),$e}for(Ie=g(Ie);et<ae.length;et++)ut=de(Ie,ie,et,ae[et],xe),ut!==null&&(r&&ut.alternate!==null&&Ie.delete(ut.key===null?et:ut.key),re=E(ut,re,et),pt===null?$e=ut:pt.sibling=ut,pt=ut);return r&&Ie.forEach(function(Os){return i(ie,Os)}),ft&&Ur(ie,et),$e}function Fe(ie,re,ae,xe){if(ae==null)throw Error(s(151));for(var $e=null,pt=null,Ie=re,et=re=0,ut=null,gt=ae.next();Ie!==null&&!gt.done;et++,gt=ae.next()){Ie.index>et?(ut=Ie,Ie=null):ut=Ie.sibling;var Os=ce(ie,Ie,gt.value,xe);if(Os===null){Ie===null&&(Ie=ut);break}r&&Ie&&Os.alternate===null&&i(ie,Ie),re=E(Os,re,et),pt===null?$e=Os:pt.sibling=Os,pt=Os,Ie=ut}if(gt.done)return d(ie,Ie),ft&&Ur(ie,et),$e;if(Ie===null){for(;!gt.done;et++,gt=ae.next())gt=_e(ie,gt.value,xe),gt!==null&&(re=E(gt,re,et),pt===null?$e=gt:pt.sibling=gt,pt=gt);return ft&&Ur(ie,et),$e}for(Ie=g(Ie);!gt.done;et++,gt=ae.next())gt=de(Ie,ie,et,gt.value,xe),gt!==null&&(r&&gt.alternate!==null&&Ie.delete(gt.key===null?et:gt.key),re=E(gt,re,et),pt===null?$e=gt:pt.sibling=gt,pt=gt);return r&&Ie.forEach(function(NE){return i(ie,NE)}),ft&&Ur(ie,et),$e}function wt(ie,re,ae,xe){if(typeof ae=="object"&&ae!==null&&ae.type===k&&ae.key===null&&(ae=ae.props.children),typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case y:e:{for(var $e=ae.key;re!==null;){if(re.key===$e){if($e=ae.type,$e===k){if(re.tag===7){d(ie,re.sibling),xe=C(re,ae.props.children),xe.return=ie,ie=xe;break e}}else if(re.elementType===$e||typeof $e=="object"&&$e!==null&&$e.$$typeof===A&&ni($e)===re.type){d(ie,re.sibling),xe=C(re,ae.props),io(xe,ae),xe.return=ie,ie=xe;break e}d(ie,re);break}else i(ie,re);re=re.sibling}ae.type===k?(xe=Qs(ae.props.children,ie.mode,xe,ae.key),xe.return=ie,ie=xe):(xe=Ol(ae.type,ae.key,ae.props,null,ie.mode,xe),io(xe,ae),xe.return=ie,ie=xe)}return M(ie);case w:e:{for($e=ae.key;re!==null;){if(re.key===$e)if(re.tag===4&&re.stateNode.containerInfo===ae.containerInfo&&re.stateNode.implementation===ae.implementation){d(ie,re.sibling),xe=C(re,ae.children||[]),xe.return=ie,ie=xe;break e}else{d(ie,re);break}else i(ie,re);re=re.sibling}xe=jd(ae,ie.mode,xe),xe.return=ie,ie=xe}return M(ie);case A:return ae=ni(ae),wt(ie,re,ae,xe)}if(P(ae))return Me(ie,re,ae,xe);if(F(ae)){if($e=F(ae),typeof $e!="function")throw Error(s(150));return ae=$e.call(ae),Fe(ie,re,ae,xe)}if(typeof ae.then=="function")return wt(ie,re,$l(ae),xe);if(ae.$$typeof===S)return wt(ie,re,Pl(ie,ae),xe);Ul(ie,ae)}return typeof ae=="string"&&ae!==""||typeof ae=="number"||typeof ae=="bigint"?(ae=""+ae,re!==null&&re.tag===6?(d(ie,re.sibling),xe=C(re,ae),xe.return=ie,ie=xe):(d(ie,re),xe=Ed(ae,ie.mode,xe),xe.return=ie,ie=xe),M(ie)):d(ie,re)}return function(ie,re,ae,xe){try{so=0;var $e=wt(ie,re,ae,xe);return Ji=null,$e}catch(Ie){if(Ie===Qi||Ie===zl)throw Ie;var pt=$n(29,Ie,null,ie.mode);return pt.lanes=xe,pt.return=ie,pt}finally{}}}var si=sx(!0),ix=sx(!1),xs=!1;function zd(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Hd(r,i){r=r.updateQueue,i.updateQueue===r&&(i.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,callbacks:null})}function _s(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function ys(r,i,d){var g=r.updateQueue;if(g===null)return null;if(g=g.shared,(xt&2)!==0){var C=g.pending;return C===null?i.next=i:(i.next=C.next,C.next=i),g.pending=i,i=Rl(r),Ug(r,null,d),i}return Ll(r,g,i,d),Rl(r)}function ao(r,i,d){if(i=i.updateQueue,i!==null&&(i=i.shared,(d&4194048)!==0)){var g=i.lanes;g&=r.pendingLanes,d|=g,i.lanes=d,Xp(r,d)}}function $d(r,i){var d=r.updateQueue,g=r.alternate;if(g!==null&&(g=g.updateQueue,d===g)){var C=null,E=null;if(d=d.firstBaseUpdate,d!==null){do{var M={lane:d.lane,tag:d.tag,payload:d.payload,callback:null,next:null};E===null?C=E=M:E=E.next=M,d=d.next}while(d!==null);E===null?C=E=i:E=E.next=i}else C=E=i;d={baseState:g.baseState,firstBaseUpdate:C,lastBaseUpdate:E,shared:g.shared,callbacks:g.callbacks},r.updateQueue=d;return}r=d.lastBaseUpdate,r===null?d.firstBaseUpdate=i:r.next=i,d.lastBaseUpdate=i}var Ud=!1;function oo(){if(Ud){var r=Xi;if(r!==null)throw r}}function lo(r,i,d,g){Ud=!1;var C=r.updateQueue;xs=!1;var E=C.firstBaseUpdate,M=C.lastBaseUpdate,q=C.shared.pending;if(q!==null){C.shared.pending=null;var te=q,oe=te.next;te.next=null,M===null?E=oe:M.next=oe,M=te;var pe=r.alternate;pe!==null&&(pe=pe.updateQueue,q=pe.lastBaseUpdate,q!==M&&(q===null?pe.firstBaseUpdate=oe:q.next=oe,pe.lastBaseUpdate=te))}if(E!==null){var _e=C.baseState;M=0,pe=oe=te=null,q=E;do{var ce=q.lane&-536870913,de=ce!==q.lane;if(de?(ct&ce)===ce:(g&ce)===ce){ce!==0&&ce===Yi&&(Ud=!0),pe!==null&&(pe=pe.next={lane:0,tag:q.tag,payload:q.payload,callback:null,next:null});e:{var Me=r,Fe=q;ce=i;var wt=d;switch(Fe.tag){case 1:if(Me=Fe.payload,typeof Me=="function"){_e=Me.call(wt,_e,ce);break e}_e=Me;break e;case 3:Me.flags=Me.flags&-65537|128;case 0:if(Me=Fe.payload,ce=typeof Me=="function"?Me.call(wt,_e,ce):Me,ce==null)break e;_e=m({},_e,ce);break e;case 2:xs=!0}}ce=q.callback,ce!==null&&(r.flags|=64,de&&(r.flags|=8192),de=C.callbacks,de===null?C.callbacks=[ce]:de.push(ce))}else de={lane:ce,tag:q.tag,payload:q.payload,callback:q.callback,next:null},pe===null?(oe=pe=de,te=_e):pe=pe.next=de,M|=ce;if(q=q.next,q===null){if(q=C.shared.pending,q===null)break;de=q,q=de.next,de.next=null,C.lastBaseUpdate=de,C.shared.pending=null}}while(!0);pe===null&&(te=_e),C.baseState=te,C.firstBaseUpdate=oe,C.lastBaseUpdate=pe,E===null&&(C.shared.lanes=0),Cs|=M,r.lanes=M,r.memoizedState=_e}}function ax(r,i){if(typeof r!="function")throw Error(s(191,r));r.call(i)}function ox(r,i){var d=r.callbacks;if(d!==null)for(r.callbacks=null,r=0;r<d.length;r++)ax(d[r],i)}var Zi=z(null),Fl=z(0);function lx(r,i){r=Zr,U(Fl,r),U(Zi,i),Zr=r|i.baseLanes}function Fd(){U(Fl,Zr),U(Zi,Zi.current)}function Vd(){Zr=Fl.current,V(Zi),V(Fl)}var Un=z(null),ar=null;function vs(r){var i=r.alternate;U($t,$t.current&1),U(Un,r),ar===null&&(i===null||Zi.current!==null||i.memoizedState!==null)&&(ar=r)}function Gd(r){U($t,$t.current),U(Un,r),ar===null&&(ar=r)}function cx(r){r.tag===22?(U($t,$t.current),U(Un,r),ar===null&&(ar=r)):bs()}function bs(){U($t,$t.current),U(Un,Un.current)}function Fn(r){V(Un),ar===r&&(ar=null),V($t)}var $t=z(0);function Vl(r){for(var i=r;i!==null;){if(i.tag===13){var d=i.memoizedState;if(d!==null&&(d=d.dehydrated,d===null||Qh(d)||Jh(d)))return i}else if(i.tag===19&&(i.memoizedProps.revealOrder==="forwards"||i.memoizedProps.revealOrder==="backwards"||i.memoizedProps.revealOrder==="unstable_legacy-backwards"||i.memoizedProps.revealOrder==="together")){if((i.flags&128)!==0)return i}else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===r)break;for(;i.sibling===null;){if(i.return===null||i.return===r)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}var Gr=0,Ze=null,bt=null,qt=null,Gl=!1,ea=!1,ii=!1,Wl=0,co=0,ta=null,yk=0;function Pt(){throw Error(s(321))}function Wd(r,i){if(i===null)return!1;for(var d=0;d<i.length&&d<r.length;d++)if(!Hn(r[d],i[d]))return!1;return!0}function qd(r,i,d,g,C,E){return Gr=E,Ze=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,H.H=r===null||r.memoizedState===null?Wx:lh,ii=!1,E=d(g,C),ii=!1,ea&&(E=dx(i,d,g,C)),ux(r),E}function ux(r){H.H=fo;var i=bt!==null&&bt.next!==null;if(Gr=0,qt=bt=Ze=null,Gl=!1,co=0,ta=null,i)throw Error(s(300));r===null||Kt||(r=r.dependencies,r!==null&&Il(r)&&(Kt=!0))}function dx(r,i,d,g){Ze=r;var C=0;do{if(ea&&(ta=null),co=0,ea=!1,25<=C)throw Error(s(301));if(C+=1,qt=bt=null,r.updateQueue!=null){var E=r.updateQueue;E.lastEffect=null,E.events=null,E.stores=null,E.memoCache!=null&&(E.memoCache.index=0)}H.H=qx,E=i(d,g)}while(ea);return E}function vk(){var r=H.H,i=r.useState()[0];return i=typeof i.then=="function"?uo(i):i,r=r.useState()[0],(bt!==null?bt.memoizedState:null)!==r&&(Ze.flags|=1024),i}function Kd(){var r=Wl!==0;return Wl=0,r}function Yd(r,i,d){i.updateQueue=r.updateQueue,i.flags&=-2053,r.lanes&=~d}function Xd(r){if(Gl){for(r=r.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}Gl=!1}Gr=0,qt=bt=Ze=null,ea=!1,co=Wl=0,ta=null}function jn(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return qt===null?Ze.memoizedState=qt=r:qt=qt.next=r,qt}function Ut(){if(bt===null){var r=Ze.alternate;r=r!==null?r.memoizedState:null}else r=bt.next;var i=qt===null?Ze.memoizedState:qt.next;if(i!==null)qt=i,bt=r;else{if(r===null)throw Ze.alternate===null?Error(s(467)):Error(s(310));bt=r,r={memoizedState:bt.memoizedState,baseState:bt.baseState,baseQueue:bt.baseQueue,queue:bt.queue,next:null},qt===null?Ze.memoizedState=qt=r:qt=qt.next=r}return qt}function ql(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function uo(r){var i=co;return co+=1,ta===null&&(ta=[]),r=tx(ta,r,i),i=Ze,(qt===null?i.memoizedState:qt.next)===null&&(i=i.alternate,H.H=i===null||i.memoizedState===null?Wx:lh),r}function Kl(r){if(r!==null&&typeof r=="object"){if(typeof r.then=="function")return uo(r);if(r.$$typeof===S)return xn(r)}throw Error(s(438,String(r)))}function Qd(r){var i=null,d=Ze.updateQueue;if(d!==null&&(i=d.memoCache),i==null){var g=Ze.alternate;g!==null&&(g=g.updateQueue,g!==null&&(g=g.memoCache,g!=null&&(i={data:g.data.map(function(C){return C.slice()}),index:0})))}if(i==null&&(i={data:[],index:0}),d===null&&(d=ql(),Ze.updateQueue=d),d.memoCache=i,d=i.data[i.index],d===void 0)for(d=i.data[i.index]=Array(r),g=0;g<r;g++)d[g]=R;return i.index++,d}function Wr(r,i){return typeof i=="function"?i(r):i}function Yl(r){var i=Ut();return Jd(i,bt,r)}function Jd(r,i,d){var g=r.queue;if(g===null)throw Error(s(311));g.lastRenderedReducer=d;var C=r.baseQueue,E=g.pending;if(E!==null){if(C!==null){var M=C.next;C.next=E.next,E.next=M}i.baseQueue=C=E,g.pending=null}if(E=r.baseState,C===null)r.memoizedState=E;else{i=C.next;var q=M=null,te=null,oe=i,pe=!1;do{var _e=oe.lane&-536870913;if(_e!==oe.lane?(ct&_e)===_e:(Gr&_e)===_e){var ce=oe.revertLane;if(ce===0)te!==null&&(te=te.next={lane:0,revertLane:0,gesture:null,action:oe.action,hasEagerState:oe.hasEagerState,eagerState:oe.eagerState,next:null}),_e===Yi&&(pe=!0);else if((Gr&ce)===ce){oe=oe.next,ce===Yi&&(pe=!0);continue}else _e={lane:0,revertLane:oe.revertLane,gesture:null,action:oe.action,hasEagerState:oe.hasEagerState,eagerState:oe.eagerState,next:null},te===null?(q=te=_e,M=E):te=te.next=_e,Ze.lanes|=ce,Cs|=ce;_e=oe.action,ii&&d(E,_e),E=oe.hasEagerState?oe.eagerState:d(E,_e)}else ce={lane:_e,revertLane:oe.revertLane,gesture:oe.gesture,action:oe.action,hasEagerState:oe.hasEagerState,eagerState:oe.eagerState,next:null},te===null?(q=te=ce,M=E):te=te.next=ce,Ze.lanes|=_e,Cs|=_e;oe=oe.next}while(oe!==null&&oe!==i);if(te===null?M=E:te.next=q,!Hn(E,r.memoizedState)&&(Kt=!0,pe&&(d=Xi,d!==null)))throw d;r.memoizedState=E,r.baseState=M,r.baseQueue=te,g.lastRenderedState=E}return C===null&&(g.lanes=0),[r.memoizedState,g.dispatch]}function Zd(r){var i=Ut(),d=i.queue;if(d===null)throw Error(s(311));d.lastRenderedReducer=r;var g=d.dispatch,C=d.pending,E=i.memoizedState;if(C!==null){d.pending=null;var M=C=C.next;do E=r(E,M.action),M=M.next;while(M!==C);Hn(E,i.memoizedState)||(Kt=!0),i.memoizedState=E,i.baseQueue===null&&(i.baseState=E),d.lastRenderedState=E}return[E,g]}function hx(r,i,d){var g=Ze,C=Ut(),E=ft;if(E){if(d===void 0)throw Error(s(407));d=d()}else d=i();var M=!Hn((bt||C).memoizedState,d);if(M&&(C.memoizedState=d,Kt=!0),C=C.queue,nh(px.bind(null,g,C,r),[r]),C.getSnapshot!==i||M||qt!==null&&qt.memoizedState.tag&1){if(g.flags|=2048,na(9,{destroy:void 0},mx.bind(null,g,C,d,i),null),Ct===null)throw Error(s(349));E||(Gr&127)!==0||fx(g,i,d)}return d}function fx(r,i,d){r.flags|=16384,r={getSnapshot:i,value:d},i=Ze.updateQueue,i===null?(i=ql(),Ze.updateQueue=i,i.stores=[r]):(d=i.stores,d===null?i.stores=[r]:d.push(r))}function mx(r,i,d,g){i.value=d,i.getSnapshot=g,gx(i)&&xx(r)}function px(r,i,d){return d(function(){gx(i)&&xx(r)})}function gx(r){var i=r.getSnapshot;r=r.value;try{var d=i();return!Hn(r,d)}catch{return!0}}function xx(r){var i=Xs(r,2);i!==null&&In(i,r,2)}function eh(r){var i=jn();if(typeof r=="function"){var d=r;if(r=d(),ii){qe(!0);try{d()}finally{qe(!1)}}}return i.memoizedState=i.baseState=r,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wr,lastRenderedState:r},i}function _x(r,i,d,g){return r.baseState=d,Jd(r,bt,typeof g=="function"?g:Wr)}function bk(r,i,d,g,C){if(Jl(r))throw Error(s(485));if(r=i.action,r!==null){var E={payload:C,action:r,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(M){E.listeners.push(M)}};H.T!==null?d(!0):E.isTransition=!1,g(E),d=i.pending,d===null?(E.next=i.pending=E,yx(i,E)):(E.next=d.next,i.pending=d.next=E)}}function yx(r,i){var d=i.action,g=i.payload,C=r.state;if(i.isTransition){var E=H.T,M={};H.T=M;try{var q=d(C,g),te=H.S;te!==null&&te(M,q),vx(r,i,q)}catch(oe){th(r,i,oe)}finally{E!==null&&M.types!==null&&(E.types=M.types),H.T=E}}else try{E=d(C,g),vx(r,i,E)}catch(oe){th(r,i,oe)}}function vx(r,i,d){d!==null&&typeof d=="object"&&typeof d.then=="function"?d.then(function(g){bx(r,i,g)},function(g){return th(r,i,g)}):bx(r,i,d)}function bx(r,i,d){i.status="fulfilled",i.value=d,Sx(i),r.state=d,i=r.pending,i!==null&&(d=i.next,d===i?r.pending=null:(d=d.next,i.next=d,yx(r,d)))}function th(r,i,d){var g=r.pending;if(r.pending=null,g!==null){g=g.next;do i.status="rejected",i.reason=d,Sx(i),i=i.next;while(i!==g)}r.action=null}function Sx(r){r=r.listeners;for(var i=0;i<r.length;i++)(0,r[i])()}function wx(r,i){return i}function Cx(r,i){if(ft){var d=Ct.formState;if(d!==null){e:{var g=Ze;if(ft){if(At){t:{for(var C=At,E=ir;C.nodeType!==8;){if(!E){C=null;break t}if(C=or(C.nextSibling),C===null){C=null;break t}}E=C.data,C=E==="F!"||E==="F"?C:null}if(C){At=or(C.nextSibling),g=C.data==="F!";break e}}ps(g)}g=!1}g&&(i=d[0])}}return d=jn(),d.memoizedState=d.baseState=i,g={pending:null,lanes:0,dispatch:null,lastRenderedReducer:wx,lastRenderedState:i},d.queue=g,d=Fx.bind(null,Ze,g),g.dispatch=d,g=eh(!1),E=oh.bind(null,Ze,!1,g.queue),g=jn(),C={state:i,dispatch:null,action:r,pending:null},g.queue=C,d=bk.bind(null,Ze,C,E,d),C.dispatch=d,g.memoizedState=r,[i,d,!1]}function kx(r){var i=Ut();return Ex(i,bt,r)}function Ex(r,i,d){if(i=Jd(r,i,wx)[0],r=Yl(Wr)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var g=uo(i)}catch(M){throw M===Qi?zl:M}else g=i;i=Ut();var C=i.queue,E=C.dispatch;return d!==i.memoizedState&&(Ze.flags|=2048,na(9,{destroy:void 0},Sk.bind(null,C,d),null)),[g,E,r]}function Sk(r,i){r.action=i}function jx(r){var i=Ut(),d=bt;if(d!==null)return Ex(i,d,r);Ut(),i=i.memoizedState,d=Ut();var g=d.queue.dispatch;return d.memoizedState=r,[i,g,!1]}function na(r,i,d,g){return r={tag:r,create:d,deps:g,inst:i,next:null},i=Ze.updateQueue,i===null&&(i=ql(),Ze.updateQueue=i),d=i.lastEffect,d===null?i.lastEffect=r.next=r:(g=d.next,d.next=r,r.next=g,i.lastEffect=r),r}function Tx(){return Ut().memoizedState}function Xl(r,i,d,g){var C=jn();Ze.flags|=r,C.memoizedState=na(1|i,{destroy:void 0},d,g===void 0?null:g)}function Ql(r,i,d,g){var C=Ut();g=g===void 0?null:g;var E=C.memoizedState.inst;bt!==null&&g!==null&&Wd(g,bt.memoizedState.deps)?C.memoizedState=na(i,E,d,g):(Ze.flags|=r,C.memoizedState=na(1|i,E,d,g))}function Nx(r,i){Xl(8390656,8,r,i)}function nh(r,i){Ql(2048,8,r,i)}function wk(r){Ze.flags|=4;var i=Ze.updateQueue;if(i===null)i=ql(),Ze.updateQueue=i,i.events=[r];else{var d=i.events;d===null?i.events=[r]:d.push(r)}}function Ax(r){var i=Ut().memoizedState;return wk({ref:i,nextImpl:r}),function(){if((xt&2)!==0)throw Error(s(440));return i.impl.apply(void 0,arguments)}}function Dx(r,i){return Ql(4,2,r,i)}function Lx(r,i){return Ql(4,4,r,i)}function Rx(r,i){if(typeof i=="function"){r=r();var d=i(r);return function(){typeof d=="function"?d():i(null)}}if(i!=null)return r=r(),i.current=r,function(){i.current=null}}function Ox(r,i,d){d=d!=null?d.concat([r]):null,Ql(4,4,Rx.bind(null,i,r),d)}function rh(){}function Mx(r,i){var d=Ut();i=i===void 0?null:i;var g=d.memoizedState;return i!==null&&Wd(i,g[1])?g[0]:(d.memoizedState=[r,i],r)}function Ix(r,i){var d=Ut();i=i===void 0?null:i;var g=d.memoizedState;if(i!==null&&Wd(i,g[1]))return g[0];if(g=r(),ii){qe(!0);try{r()}finally{qe(!1)}}return d.memoizedState=[g,i],g}function sh(r,i,d){return d===void 0||(Gr&1073741824)!==0&&(ct&261930)===0?r.memoizedState=i:(r.memoizedState=d,r=P_(),Ze.lanes|=r,Cs|=r,d)}function Px(r,i,d,g){return Hn(d,i)?d:Zi.current!==null?(r=sh(r,d,g),Hn(r,i)||(Kt=!0),r):(Gr&42)===0||(Gr&1073741824)!==0&&(ct&261930)===0?(Kt=!0,r.memoizedState=d):(r=P_(),Ze.lanes|=r,Cs|=r,i)}function Bx(r,i,d,g,C){var E=J.p;J.p=E!==0&&8>E?E:8;var M=H.T,q={};H.T=q,oh(r,!1,i,d);try{var te=C(),oe=H.S;if(oe!==null&&oe(q,te),te!==null&&typeof te=="object"&&typeof te.then=="function"){var pe=_k(te,g);ho(r,i,pe,Wn(r))}else ho(r,i,g,Wn(r))}catch(_e){ho(r,i,{then:function(){},status:"rejected",reason:_e},Wn())}finally{J.p=E,M!==null&&q.types!==null&&(M.types=q.types),H.T=M}}function Ck(){}function ih(r,i,d,g){if(r.tag!==5)throw Error(s(476));var C=zx(r).queue;Bx(r,C,i,K,d===null?Ck:function(){return Hx(r),d(g)})}function zx(r){var i=r.memoizedState;if(i!==null)return i;i={memoizedState:K,baseState:K,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wr,lastRenderedState:K},next:null};var d={};return i.next={memoizedState:d,baseState:d,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wr,lastRenderedState:d},next:null},r.memoizedState=i,r=r.alternate,r!==null&&(r.memoizedState=i),i}function Hx(r){var i=zx(r);i.next===null&&(i=r.alternate.memoizedState),ho(r,i.next.queue,{},Wn())}function ah(){return xn(No)}function $x(){return Ut().memoizedState}function Ux(){return Ut().memoizedState}function kk(r){for(var i=r.return;i!==null;){switch(i.tag){case 24:case 3:var d=Wn();r=_s(d);var g=ys(i,r,d);g!==null&&(In(g,i,d),ao(g,i,d)),i={cache:Md()},r.payload=i;return}i=i.return}}function Ek(r,i,d){var g=Wn();d={lane:g,revertLane:0,gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},Jl(r)?Vx(i,d):(d=Cd(r,i,d,g),d!==null&&(In(d,r,g),Gx(d,i,g)))}function Fx(r,i,d){var g=Wn();ho(r,i,d,g)}function ho(r,i,d,g){var C={lane:g,revertLane:0,gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null};if(Jl(r))Vx(i,C);else{var E=r.alternate;if(r.lanes===0&&(E===null||E.lanes===0)&&(E=i.lastRenderedReducer,E!==null))try{var M=i.lastRenderedState,q=E(M,d);if(C.hasEagerState=!0,C.eagerState=q,Hn(q,M))return Ll(r,i,C,0),Ct===null&&Dl(),!1}catch{}finally{}if(d=Cd(r,i,C,g),d!==null)return In(d,r,g),Gx(d,i,g),!0}return!1}function oh(r,i,d,g){if(g={lane:2,revertLane:zh(),gesture:null,action:g,hasEagerState:!1,eagerState:null,next:null},Jl(r)){if(i)throw Error(s(479))}else i=Cd(r,d,g,2),i!==null&&In(i,r,2)}function Jl(r){var i=r.alternate;return r===Ze||i!==null&&i===Ze}function Vx(r,i){ea=Gl=!0;var d=r.pending;d===null?i.next=i:(i.next=d.next,d.next=i),r.pending=i}function Gx(r,i,d){if((d&4194048)!==0){var g=i.lanes;g&=r.pendingLanes,d|=g,i.lanes=d,Xp(r,d)}}var fo={readContext:xn,use:Kl,useCallback:Pt,useContext:Pt,useEffect:Pt,useImperativeHandle:Pt,useLayoutEffect:Pt,useInsertionEffect:Pt,useMemo:Pt,useReducer:Pt,useRef:Pt,useState:Pt,useDebugValue:Pt,useDeferredValue:Pt,useTransition:Pt,useSyncExternalStore:Pt,useId:Pt,useHostTransitionStatus:Pt,useFormState:Pt,useActionState:Pt,useOptimistic:Pt,useMemoCache:Pt,useCacheRefresh:Pt};fo.useEffectEvent=Pt;var Wx={readContext:xn,use:Kl,useCallback:function(r,i){return jn().memoizedState=[r,i===void 0?null:i],r},useContext:xn,useEffect:Nx,useImperativeHandle:function(r,i,d){d=d!=null?d.concat([r]):null,Xl(4194308,4,Rx.bind(null,i,r),d)},useLayoutEffect:function(r,i){return Xl(4194308,4,r,i)},useInsertionEffect:function(r,i){Xl(4,2,r,i)},useMemo:function(r,i){var d=jn();i=i===void 0?null:i;var g=r();if(ii){qe(!0);try{r()}finally{qe(!1)}}return d.memoizedState=[g,i],g},useReducer:function(r,i,d){var g=jn();if(d!==void 0){var C=d(i);if(ii){qe(!0);try{d(i)}finally{qe(!1)}}}else C=i;return g.memoizedState=g.baseState=C,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:C},g.queue=r,r=r.dispatch=Ek.bind(null,Ze,r),[g.memoizedState,r]},useRef:function(r){var i=jn();return r={current:r},i.memoizedState=r},useState:function(r){r=eh(r);var i=r.queue,d=Fx.bind(null,Ze,i);return i.dispatch=d,[r.memoizedState,d]},useDebugValue:rh,useDeferredValue:function(r,i){var d=jn();return sh(d,r,i)},useTransition:function(){var r=eh(!1);return r=Bx.bind(null,Ze,r.queue,!0,!1),jn().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,i,d){var g=Ze,C=jn();if(ft){if(d===void 0)throw Error(s(407));d=d()}else{if(d=i(),Ct===null)throw Error(s(349));(ct&127)!==0||fx(g,i,d)}C.memoizedState=d;var E={value:d,getSnapshot:i};return C.queue=E,Nx(px.bind(null,g,E,r),[r]),g.flags|=2048,na(9,{destroy:void 0},mx.bind(null,g,E,d,i),null),d},useId:function(){var r=jn(),i=Ct.identifierPrefix;if(ft){var d=kr,g=Cr;d=(g&~(1<<32-Ke(g)-1)).toString(32)+d,i="_"+i+"R_"+d,d=Wl++,0<d&&(i+="H"+d.toString(32)),i+="_"}else d=yk++,i="_"+i+"r_"+d.toString(32)+"_";return r.memoizedState=i},useHostTransitionStatus:ah,useFormState:Cx,useActionState:Cx,useOptimistic:function(r){var i=jn();i.memoizedState=i.baseState=r;var d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=d,i=oh.bind(null,Ze,!0,d),d.dispatch=i,[r,i]},useMemoCache:Qd,useCacheRefresh:function(){return jn().memoizedState=kk.bind(null,Ze)},useEffectEvent:function(r){var i=jn(),d={impl:r};return i.memoizedState=d,function(){if((xt&2)!==0)throw Error(s(440));return d.impl.apply(void 0,arguments)}}},lh={readContext:xn,use:Kl,useCallback:Mx,useContext:xn,useEffect:nh,useImperativeHandle:Ox,useInsertionEffect:Dx,useLayoutEffect:Lx,useMemo:Ix,useReducer:Yl,useRef:Tx,useState:function(){return Yl(Wr)},useDebugValue:rh,useDeferredValue:function(r,i){var d=Ut();return Px(d,bt.memoizedState,r,i)},useTransition:function(){var r=Yl(Wr)[0],i=Ut().memoizedState;return[typeof r=="boolean"?r:uo(r),i]},useSyncExternalStore:hx,useId:$x,useHostTransitionStatus:ah,useFormState:kx,useActionState:kx,useOptimistic:function(r,i){var d=Ut();return _x(d,bt,r,i)},useMemoCache:Qd,useCacheRefresh:Ux};lh.useEffectEvent=Ax;var qx={readContext:xn,use:Kl,useCallback:Mx,useContext:xn,useEffect:nh,useImperativeHandle:Ox,useInsertionEffect:Dx,useLayoutEffect:Lx,useMemo:Ix,useReducer:Zd,useRef:Tx,useState:function(){return Zd(Wr)},useDebugValue:rh,useDeferredValue:function(r,i){var d=Ut();return bt===null?sh(d,r,i):Px(d,bt.memoizedState,r,i)},useTransition:function(){var r=Zd(Wr)[0],i=Ut().memoizedState;return[typeof r=="boolean"?r:uo(r),i]},useSyncExternalStore:hx,useId:$x,useHostTransitionStatus:ah,useFormState:jx,useActionState:jx,useOptimistic:function(r,i){var d=Ut();return bt!==null?_x(d,bt,r,i):(d.baseState=r,[r,d.queue.dispatch])},useMemoCache:Qd,useCacheRefresh:Ux};qx.useEffectEvent=Ax;function ch(r,i,d,g){i=r.memoizedState,d=d(g,i),d=d==null?i:m({},i,d),r.memoizedState=d,r.lanes===0&&(r.updateQueue.baseState=d)}var uh={enqueueSetState:function(r,i,d){r=r._reactInternals;var g=Wn(),C=_s(g);C.payload=i,d!=null&&(C.callback=d),i=ys(r,C,g),i!==null&&(In(i,r,g),ao(i,r,g))},enqueueReplaceState:function(r,i,d){r=r._reactInternals;var g=Wn(),C=_s(g);C.tag=1,C.payload=i,d!=null&&(C.callback=d),i=ys(r,C,g),i!==null&&(In(i,r,g),ao(i,r,g))},enqueueForceUpdate:function(r,i){r=r._reactInternals;var d=Wn(),g=_s(d);g.tag=2,i!=null&&(g.callback=i),i=ys(r,g,d),i!==null&&(In(i,r,d),ao(i,r,d))}};function Kx(r,i,d,g,C,E,M){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(g,E,M):i.prototype&&i.prototype.isPureReactComponent?!Ja(d,g)||!Ja(C,E):!0}function Yx(r,i,d,g){r=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(d,g),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(d,g),i.state!==r&&uh.enqueueReplaceState(i,i.state,null)}function ai(r,i){var d=i;if("ref"in i){d={};for(var g in i)g!=="ref"&&(d[g]=i[g])}if(r=r.defaultProps){d===i&&(d=m({},d));for(var C in r)d[C]===void 0&&(d[C]=r[C])}return d}function Xx(r){Al(r)}function Qx(r){console.error(r)}function Jx(r){Al(r)}function Zl(r,i){try{var d=r.onUncaughtError;d(i.value,{componentStack:i.stack})}catch(g){setTimeout(function(){throw g})}}function Zx(r,i,d){try{var g=r.onCaughtError;g(d.value,{componentStack:d.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(C){setTimeout(function(){throw C})}}function dh(r,i,d){return d=_s(d),d.tag=3,d.payload={element:null},d.callback=function(){Zl(r,i)},d}function e_(r){return r=_s(r),r.tag=3,r}function t_(r,i,d,g){var C=d.type.getDerivedStateFromError;if(typeof C=="function"){var E=g.value;r.payload=function(){return C(E)},r.callback=function(){Zx(i,d,g)}}var M=d.stateNode;M!==null&&typeof M.componentDidCatch=="function"&&(r.callback=function(){Zx(i,d,g),typeof C!="function"&&(ks===null?ks=new Set([this]):ks.add(this));var q=g.stack;this.componentDidCatch(g.value,{componentStack:q!==null?q:""})})}function jk(r,i,d,g,C){if(d.flags|=32768,g!==null&&typeof g=="object"&&typeof g.then=="function"){if(i=d.alternate,i!==null&&Ki(i,d,C,!0),d=Un.current,d!==null){switch(d.tag){case 31:case 13:return ar===null?dc():d.alternate===null&&Bt===0&&(Bt=3),d.flags&=-257,d.flags|=65536,d.lanes=C,g===Hl?d.flags|=16384:(i=d.updateQueue,i===null?d.updateQueue=new Set([g]):i.add(g),Ih(r,g,C)),!1;case 22:return d.flags|=65536,g===Hl?d.flags|=16384:(i=d.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([g])},d.updateQueue=i):(d=i.retryQueue,d===null?i.retryQueue=new Set([g]):d.add(g)),Ih(r,g,C)),!1}throw Error(s(435,d.tag))}return Ih(r,g,C),dc(),!1}if(ft)return i=Un.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=C,g!==Ad&&(r=Error(s(422),{cause:g}),to(nr(r,d)))):(g!==Ad&&(i=Error(s(423),{cause:g}),to(nr(i,d))),r=r.current.alternate,r.flags|=65536,C&=-C,r.lanes|=C,g=nr(g,d),C=dh(r.stateNode,g,C),$d(r,C),Bt!==4&&(Bt=2)),!1;var E=Error(s(520),{cause:g});if(E=nr(E,d),bo===null?bo=[E]:bo.push(E),Bt!==4&&(Bt=2),i===null)return!0;g=nr(g,d),d=i;do{switch(d.tag){case 3:return d.flags|=65536,r=C&-C,d.lanes|=r,r=dh(d.stateNode,g,r),$d(d,r),!1;case 1:if(i=d.type,E=d.stateNode,(d.flags&128)===0&&(typeof i.getDerivedStateFromError=="function"||E!==null&&typeof E.componentDidCatch=="function"&&(ks===null||!ks.has(E))))return d.flags|=65536,C&=-C,d.lanes|=C,C=e_(C),t_(C,r,d,g),$d(d,C),!1}d=d.return}while(d!==null);return!1}var hh=Error(s(461)),Kt=!1;function _n(r,i,d,g){i.child=r===null?ix(i,null,d,g):si(i,r.child,d,g)}function n_(r,i,d,g,C){d=d.render;var E=i.ref;if("ref"in g){var M={};for(var q in g)q!=="ref"&&(M[q]=g[q])}else M=g;return ei(i),g=qd(r,i,d,M,E,C),q=Kd(),r!==null&&!Kt?(Yd(r,i,C),qr(r,i,C)):(ft&&q&&Td(i),i.flags|=1,_n(r,i,g,C),i.child)}function r_(r,i,d,g,C){if(r===null){var E=d.type;return typeof E=="function"&&!kd(E)&&E.defaultProps===void 0&&d.compare===null?(i.tag=15,i.type=E,s_(r,i,E,g,C)):(r=Ol(d.type,null,g,i,i.mode,C),r.ref=i.ref,r.return=i,i.child=r)}if(E=r.child,!vh(r,C)){var M=E.memoizedProps;if(d=d.compare,d=d!==null?d:Ja,d(M,g)&&r.ref===i.ref)return qr(r,i,C)}return i.flags|=1,r=$r(E,g),r.ref=i.ref,r.return=i,i.child=r}function s_(r,i,d,g,C){if(r!==null){var E=r.memoizedProps;if(Ja(E,g)&&r.ref===i.ref)if(Kt=!1,i.pendingProps=g=E,vh(r,C))(r.flags&131072)!==0&&(Kt=!0);else return i.lanes=r.lanes,qr(r,i,C)}return fh(r,i,d,g,C)}function i_(r,i,d,g){var C=g.children,E=r!==null?r.memoizedState:null;if(r===null&&i.stateNode===null&&(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),g.mode==="hidden"){if((i.flags&128)!==0){if(E=E!==null?E.baseLanes|d:d,r!==null){for(g=i.child=r.child,C=0;g!==null;)C=C|g.lanes|g.childLanes,g=g.sibling;g=C&~E}else g=0,i.child=null;return a_(r,i,E,d,g)}if((d&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},r!==null&&Bl(i,E!==null?E.cachePool:null),E!==null?lx(i,E):Fd(),cx(i);else return g=i.lanes=536870912,a_(r,i,E!==null?E.baseLanes|d:d,d,g)}else E!==null?(Bl(i,E.cachePool),lx(i,E),bs(),i.memoizedState=null):(r!==null&&Bl(i,null),Fd(),bs());return _n(r,i,C,d),i.child}function mo(r,i){return r!==null&&r.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function a_(r,i,d,g,C){var E=Pd();return E=E===null?null:{parent:Wt._currentValue,pool:E},i.memoizedState={baseLanes:d,cachePool:E},r!==null&&Bl(i,null),Fd(),cx(i),r!==null&&Ki(r,i,g,!0),i.childLanes=C,null}function ec(r,i){return i=nc({mode:i.mode,children:i.children},r.mode),i.ref=r.ref,r.child=i,i.return=r,i}function o_(r,i,d){return si(i,r.child,null,d),r=ec(i,i.pendingProps),r.flags|=2,Fn(i),i.memoizedState=null,r}function Tk(r,i,d){var g=i.pendingProps,C=(i.flags&128)!==0;if(i.flags&=-129,r===null){if(ft){if(g.mode==="hidden")return r=ec(i,g),i.lanes=536870912,mo(null,r);if(Gd(i),(r=At)?(r=yy(r,ir),r=r!==null&&r.data==="&"?r:null,r!==null&&(i.memoizedState={dehydrated:r,treeContext:fs!==null?{id:Cr,overflow:kr}:null,retryLane:536870912,hydrationErrors:null},d=Vg(r),d.return=i,i.child=d,gn=i,At=null)):r=null,r===null)throw ps(i);return i.lanes=536870912,null}return ec(i,g)}var E=r.memoizedState;if(E!==null){var M=E.dehydrated;if(Gd(i),C)if(i.flags&256)i.flags&=-257,i=o_(r,i,d);else if(i.memoizedState!==null)i.child=r.child,i.flags|=128,i=null;else throw Error(s(558));else if(Kt||Ki(r,i,d,!1),C=(d&r.childLanes)!==0,Kt||C){if(g=Ct,g!==null&&(M=Qp(g,d),M!==0&&M!==E.retryLane))throw E.retryLane=M,Xs(r,M),In(g,r,M),hh;dc(),i=o_(r,i,d)}else r=E.treeContext,At=or(M.nextSibling),gn=i,ft=!0,ms=null,ir=!1,r!==null&&qg(i,r),i=ec(i,g),i.flags|=4096;return i}return r=$r(r.child,{mode:g.mode,children:g.children}),r.ref=i.ref,i.child=r,r.return=i,r}function tc(r,i){var d=i.ref;if(d===null)r!==null&&r.ref!==null&&(i.flags|=4194816);else{if(typeof d!="function"&&typeof d!="object")throw Error(s(284));(r===null||r.ref!==d)&&(i.flags|=4194816)}}function fh(r,i,d,g,C){return ei(i),d=qd(r,i,d,g,void 0,C),g=Kd(),r!==null&&!Kt?(Yd(r,i,C),qr(r,i,C)):(ft&&g&&Td(i),i.flags|=1,_n(r,i,d,C),i.child)}function l_(r,i,d,g,C,E){return ei(i),i.updateQueue=null,d=dx(i,g,d,C),ux(r),g=Kd(),r!==null&&!Kt?(Yd(r,i,E),qr(r,i,E)):(ft&&g&&Td(i),i.flags|=1,_n(r,i,d,E),i.child)}function c_(r,i,d,g,C){if(ei(i),i.stateNode===null){var E=Vi,M=d.contextType;typeof M=="object"&&M!==null&&(E=xn(M)),E=new d(g,E),i.memoizedState=E.state!==null&&E.state!==void 0?E.state:null,E.updater=uh,i.stateNode=E,E._reactInternals=i,E=i.stateNode,E.props=g,E.state=i.memoizedState,E.refs={},zd(i),M=d.contextType,E.context=typeof M=="object"&&M!==null?xn(M):Vi,E.state=i.memoizedState,M=d.getDerivedStateFromProps,typeof M=="function"&&(ch(i,d,M,g),E.state=i.memoizedState),typeof d.getDerivedStateFromProps=="function"||typeof E.getSnapshotBeforeUpdate=="function"||typeof E.UNSAFE_componentWillMount!="function"&&typeof E.componentWillMount!="function"||(M=E.state,typeof E.componentWillMount=="function"&&E.componentWillMount(),typeof E.UNSAFE_componentWillMount=="function"&&E.UNSAFE_componentWillMount(),M!==E.state&&uh.enqueueReplaceState(E,E.state,null),lo(i,g,E,C),oo(),E.state=i.memoizedState),typeof E.componentDidMount=="function"&&(i.flags|=4194308),g=!0}else if(r===null){E=i.stateNode;var q=i.memoizedProps,te=ai(d,q);E.props=te;var oe=E.context,pe=d.contextType;M=Vi,typeof pe=="object"&&pe!==null&&(M=xn(pe));var _e=d.getDerivedStateFromProps;pe=typeof _e=="function"||typeof E.getSnapshotBeforeUpdate=="function",q=i.pendingProps!==q,pe||typeof E.UNSAFE_componentWillReceiveProps!="function"&&typeof E.componentWillReceiveProps!="function"||(q||oe!==M)&&Yx(i,E,g,M),xs=!1;var ce=i.memoizedState;E.state=ce,lo(i,g,E,C),oo(),oe=i.memoizedState,q||ce!==oe||xs?(typeof _e=="function"&&(ch(i,d,_e,g),oe=i.memoizedState),(te=xs||Kx(i,d,te,g,ce,oe,M))?(pe||typeof E.UNSAFE_componentWillMount!="function"&&typeof E.componentWillMount!="function"||(typeof E.componentWillMount=="function"&&E.componentWillMount(),typeof E.UNSAFE_componentWillMount=="function"&&E.UNSAFE_componentWillMount()),typeof E.componentDidMount=="function"&&(i.flags|=4194308)):(typeof E.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=g,i.memoizedState=oe),E.props=g,E.state=oe,E.context=M,g=te):(typeof E.componentDidMount=="function"&&(i.flags|=4194308),g=!1)}else{E=i.stateNode,Hd(r,i),M=i.memoizedProps,pe=ai(d,M),E.props=pe,_e=i.pendingProps,ce=E.context,oe=d.contextType,te=Vi,typeof oe=="object"&&oe!==null&&(te=xn(oe)),q=d.getDerivedStateFromProps,(oe=typeof q=="function"||typeof E.getSnapshotBeforeUpdate=="function")||typeof E.UNSAFE_componentWillReceiveProps!="function"&&typeof E.componentWillReceiveProps!="function"||(M!==_e||ce!==te)&&Yx(i,E,g,te),xs=!1,ce=i.memoizedState,E.state=ce,lo(i,g,E,C),oo();var de=i.memoizedState;M!==_e||ce!==de||xs||r!==null&&r.dependencies!==null&&Il(r.dependencies)?(typeof q=="function"&&(ch(i,d,q,g),de=i.memoizedState),(pe=xs||Kx(i,d,pe,g,ce,de,te)||r!==null&&r.dependencies!==null&&Il(r.dependencies))?(oe||typeof E.UNSAFE_componentWillUpdate!="function"&&typeof E.componentWillUpdate!="function"||(typeof E.componentWillUpdate=="function"&&E.componentWillUpdate(g,de,te),typeof E.UNSAFE_componentWillUpdate=="function"&&E.UNSAFE_componentWillUpdate(g,de,te)),typeof E.componentDidUpdate=="function"&&(i.flags|=4),typeof E.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof E.componentDidUpdate!="function"||M===r.memoizedProps&&ce===r.memoizedState||(i.flags|=4),typeof E.getSnapshotBeforeUpdate!="function"||M===r.memoizedProps&&ce===r.memoizedState||(i.flags|=1024),i.memoizedProps=g,i.memoizedState=de),E.props=g,E.state=de,E.context=te,g=pe):(typeof E.componentDidUpdate!="function"||M===r.memoizedProps&&ce===r.memoizedState||(i.flags|=4),typeof E.getSnapshotBeforeUpdate!="function"||M===r.memoizedProps&&ce===r.memoizedState||(i.flags|=1024),g=!1)}return E=g,tc(r,i),g=(i.flags&128)!==0,E||g?(E=i.stateNode,d=g&&typeof d.getDerivedStateFromError!="function"?null:E.render(),i.flags|=1,r!==null&&g?(i.child=si(i,r.child,null,C),i.child=si(i,null,d,C)):_n(r,i,d,C),i.memoizedState=E.state,r=i.child):r=qr(r,i,C),r}function u_(r,i,d,g){return Js(),i.flags|=256,_n(r,i,d,g),i.child}var mh={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function ph(r){return{baseLanes:r,cachePool:Zg()}}function gh(r,i,d){return r=r!==null?r.childLanes&~d:0,i&&(r|=Gn),r}function d_(r,i,d){var g=i.pendingProps,C=!1,E=(i.flags&128)!==0,M;if((M=E)||(M=r!==null&&r.memoizedState===null?!1:($t.current&2)!==0),M&&(C=!0,i.flags&=-129),M=(i.flags&32)!==0,i.flags&=-33,r===null){if(ft){if(C?vs(i):bs(),(r=At)?(r=yy(r,ir),r=r!==null&&r.data!=="&"?r:null,r!==null&&(i.memoizedState={dehydrated:r,treeContext:fs!==null?{id:Cr,overflow:kr}:null,retryLane:536870912,hydrationErrors:null},d=Vg(r),d.return=i,i.child=d,gn=i,At=null)):r=null,r===null)throw ps(i);return Jh(r)?i.lanes=32:i.lanes=536870912,null}var q=g.children;return g=g.fallback,C?(bs(),C=i.mode,q=nc({mode:"hidden",children:q},C),g=Qs(g,C,d,null),q.return=i,g.return=i,q.sibling=g,i.child=q,g=i.child,g.memoizedState=ph(d),g.childLanes=gh(r,M,d),i.memoizedState=mh,mo(null,g)):(vs(i),xh(i,q))}var te=r.memoizedState;if(te!==null&&(q=te.dehydrated,q!==null)){if(E)i.flags&256?(vs(i),i.flags&=-257,i=_h(r,i,d)):i.memoizedState!==null?(bs(),i.child=r.child,i.flags|=128,i=null):(bs(),q=g.fallback,C=i.mode,g=nc({mode:"visible",children:g.children},C),q=Qs(q,C,d,null),q.flags|=2,g.return=i,q.return=i,g.sibling=q,i.child=g,si(i,r.child,null,d),g=i.child,g.memoizedState=ph(d),g.childLanes=gh(r,M,d),i.memoizedState=mh,i=mo(null,g));else if(vs(i),Jh(q)){if(M=q.nextSibling&&q.nextSibling.dataset,M)var oe=M.dgst;M=oe,g=Error(s(419)),g.stack="",g.digest=M,to({value:g,source:null,stack:null}),i=_h(r,i,d)}else if(Kt||Ki(r,i,d,!1),M=(d&r.childLanes)!==0,Kt||M){if(M=Ct,M!==null&&(g=Qp(M,d),g!==0&&g!==te.retryLane))throw te.retryLane=g,Xs(r,g),In(M,r,g),hh;Qh(q)||dc(),i=_h(r,i,d)}else Qh(q)?(i.flags|=192,i.child=r.child,i=null):(r=te.treeContext,At=or(q.nextSibling),gn=i,ft=!0,ms=null,ir=!1,r!==null&&qg(i,r),i=xh(i,g.children),i.flags|=4096);return i}return C?(bs(),q=g.fallback,C=i.mode,te=r.child,oe=te.sibling,g=$r(te,{mode:"hidden",children:g.children}),g.subtreeFlags=te.subtreeFlags&65011712,oe!==null?q=$r(oe,q):(q=Qs(q,C,d,null),q.flags|=2),q.return=i,g.return=i,g.sibling=q,i.child=g,mo(null,g),g=i.child,q=r.child.memoizedState,q===null?q=ph(d):(C=q.cachePool,C!==null?(te=Wt._currentValue,C=C.parent!==te?{parent:te,pool:te}:C):C=Zg(),q={baseLanes:q.baseLanes|d,cachePool:C}),g.memoizedState=q,g.childLanes=gh(r,M,d),i.memoizedState=mh,mo(r.child,g)):(vs(i),d=r.child,r=d.sibling,d=$r(d,{mode:"visible",children:g.children}),d.return=i,d.sibling=null,r!==null&&(M=i.deletions,M===null?(i.deletions=[r],i.flags|=16):M.push(r)),i.child=d,i.memoizedState=null,d)}function xh(r,i){return i=nc({mode:"visible",children:i},r.mode),i.return=r,r.child=i}function nc(r,i){return r=$n(22,r,null,i),r.lanes=0,r}function _h(r,i,d){return si(i,r.child,null,d),r=xh(i,i.pendingProps.children),r.flags|=2,i.memoizedState=null,r}function h_(r,i,d){r.lanes|=i;var g=r.alternate;g!==null&&(g.lanes|=i),Rd(r.return,i,d)}function yh(r,i,d,g,C,E){var M=r.memoizedState;M===null?r.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:g,tail:d,tailMode:C,treeForkCount:E}:(M.isBackwards=i,M.rendering=null,M.renderingStartTime=0,M.last=g,M.tail=d,M.tailMode=C,M.treeForkCount=E)}function f_(r,i,d){var g=i.pendingProps,C=g.revealOrder,E=g.tail;g=g.children;var M=$t.current,q=(M&2)!==0;if(q?(M=M&1|2,i.flags|=128):M&=1,U($t,M),_n(r,i,g,d),g=ft?eo:0,!q&&r!==null&&(r.flags&128)!==0)e:for(r=i.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&h_(r,d,i);else if(r.tag===19)h_(r,d,i);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===i)break e;for(;r.sibling===null;){if(r.return===null||r.return===i)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}switch(C){case"forwards":for(d=i.child,C=null;d!==null;)r=d.alternate,r!==null&&Vl(r)===null&&(C=d),d=d.sibling;d=C,d===null?(C=i.child,i.child=null):(C=d.sibling,d.sibling=null),yh(i,!1,C,d,E,g);break;case"backwards":case"unstable_legacy-backwards":for(d=null,C=i.child,i.child=null;C!==null;){if(r=C.alternate,r!==null&&Vl(r)===null){i.child=C;break}r=C.sibling,C.sibling=d,d=C,C=r}yh(i,!0,d,null,E,g);break;case"together":yh(i,!1,null,null,void 0,g);break;default:i.memoizedState=null}return i.child}function qr(r,i,d){if(r!==null&&(i.dependencies=r.dependencies),Cs|=i.lanes,(d&i.childLanes)===0)if(r!==null){if(Ki(r,i,d,!1),(d&i.childLanes)===0)return null}else return null;if(r!==null&&i.child!==r.child)throw Error(s(153));if(i.child!==null){for(r=i.child,d=$r(r,r.pendingProps),i.child=d,d.return=i;r.sibling!==null;)r=r.sibling,d=d.sibling=$r(r,r.pendingProps),d.return=i;d.sibling=null}return i.child}function vh(r,i){return(r.lanes&i)!==0?!0:(r=r.dependencies,!!(r!==null&&Il(r)))}function Nk(r,i,d){switch(i.tag){case 3:G(i,i.stateNode.containerInfo),gs(i,Wt,r.memoizedState.cache),Js();break;case 27:case 5:se(i);break;case 4:G(i,i.stateNode.containerInfo);break;case 10:gs(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,Gd(i),null;break;case 13:var g=i.memoizedState;if(g!==null)return g.dehydrated!==null?(vs(i),i.flags|=128,null):(d&i.child.childLanes)!==0?d_(r,i,d):(vs(i),r=qr(r,i,d),r!==null?r.sibling:null);vs(i);break;case 19:var C=(r.flags&128)!==0;if(g=(d&i.childLanes)!==0,g||(Ki(r,i,d,!1),g=(d&i.childLanes)!==0),C){if(g)return f_(r,i,d);i.flags|=128}if(C=i.memoizedState,C!==null&&(C.rendering=null,C.tail=null,C.lastEffect=null),U($t,$t.current),g)break;return null;case 22:return i.lanes=0,i_(r,i,d,i.pendingProps);case 24:gs(i,Wt,r.memoizedState.cache)}return qr(r,i,d)}function m_(r,i,d){if(r!==null)if(r.memoizedProps!==i.pendingProps)Kt=!0;else{if(!vh(r,d)&&(i.flags&128)===0)return Kt=!1,Nk(r,i,d);Kt=(r.flags&131072)!==0}else Kt=!1,ft&&(i.flags&1048576)!==0&&Wg(i,eo,i.index);switch(i.lanes=0,i.tag){case 16:e:{var g=i.pendingProps;if(r=ni(i.elementType),i.type=r,typeof r=="function")kd(r)?(g=ai(r,g),i.tag=1,i=c_(null,i,r,g,d)):(i.tag=0,i=fh(null,i,r,g,d));else{if(r!=null){var C=r.$$typeof;if(C===j){i.tag=11,i=n_(null,i,r,g,d);break e}else if(C===D){i.tag=14,i=r_(null,i,r,g,d);break e}}throw i=Y(r)||r,Error(s(306,i,""))}}return i;case 0:return fh(r,i,i.type,i.pendingProps,d);case 1:return g=i.type,C=ai(g,i.pendingProps),c_(r,i,g,C,d);case 3:e:{if(G(i,i.stateNode.containerInfo),r===null)throw Error(s(387));g=i.pendingProps;var E=i.memoizedState;C=E.element,Hd(r,i),lo(i,g,null,d);var M=i.memoizedState;if(g=M.cache,gs(i,Wt,g),g!==E.cache&&Od(i,[Wt],d,!0),oo(),g=M.element,E.isDehydrated)if(E={element:g,isDehydrated:!1,cache:M.cache},i.updateQueue.baseState=E,i.memoizedState=E,i.flags&256){i=u_(r,i,g,d);break e}else if(g!==C){C=nr(Error(s(424)),i),to(C),i=u_(r,i,g,d);break e}else{switch(r=i.stateNode.containerInfo,r.nodeType){case 9:r=r.body;break;default:r=r.nodeName==="HTML"?r.ownerDocument.body:r}for(At=or(r.firstChild),gn=i,ft=!0,ms=null,ir=!0,d=ix(i,null,g,d),i.child=d;d;)d.flags=d.flags&-3|4096,d=d.sibling}else{if(Js(),g===C){i=qr(r,i,d);break e}_n(r,i,g,d)}i=i.child}return i;case 26:return tc(r,i),r===null?(d=ky(i.type,null,i.pendingProps,null))?i.memoizedState=d:ft||(d=i.type,r=i.pendingProps,g=_c(ne.current).createElement(d),g[pn]=i,g[An]=r,yn(g,d,r),un(g),i.stateNode=g):i.memoizedState=ky(i.type,r.memoizedProps,i.pendingProps,r.memoizedState),null;case 27:return se(i),r===null&&ft&&(g=i.stateNode=Sy(i.type,i.pendingProps,ne.current),gn=i,ir=!0,C=At,Ns(i.type)?(Zh=C,At=or(g.firstChild)):At=C),_n(r,i,i.pendingProps.children,d),tc(r,i),r===null&&(i.flags|=4194304),i.child;case 5:return r===null&&ft&&((C=g=At)&&(g=iE(g,i.type,i.pendingProps,ir),g!==null?(i.stateNode=g,gn=i,At=or(g.firstChild),ir=!1,C=!0):C=!1),C||ps(i)),se(i),C=i.type,E=i.pendingProps,M=r!==null?r.memoizedProps:null,g=E.children,Kh(C,E)?g=null:M!==null&&Kh(C,M)&&(i.flags|=32),i.memoizedState!==null&&(C=qd(r,i,vk,null,null,d),No._currentValue=C),tc(r,i),_n(r,i,g,d),i.child;case 6:return r===null&&ft&&((r=d=At)&&(d=aE(d,i.pendingProps,ir),d!==null?(i.stateNode=d,gn=i,At=null,r=!0):r=!1),r||ps(i)),null;case 13:return d_(r,i,d);case 4:return G(i,i.stateNode.containerInfo),g=i.pendingProps,r===null?i.child=si(i,null,g,d):_n(r,i,g,d),i.child;case 11:return n_(r,i,i.type,i.pendingProps,d);case 7:return _n(r,i,i.pendingProps,d),i.child;case 8:return _n(r,i,i.pendingProps.children,d),i.child;case 12:return _n(r,i,i.pendingProps.children,d),i.child;case 10:return g=i.pendingProps,gs(i,i.type,g.value),_n(r,i,g.children,d),i.child;case 9:return C=i.type._context,g=i.pendingProps.children,ei(i),C=xn(C),g=g(C),i.flags|=1,_n(r,i,g,d),i.child;case 14:return r_(r,i,i.type,i.pendingProps,d);case 15:return s_(r,i,i.type,i.pendingProps,d);case 19:return f_(r,i,d);case 31:return Tk(r,i,d);case 22:return i_(r,i,d,i.pendingProps);case 24:return ei(i),g=xn(Wt),r===null?(C=Pd(),C===null&&(C=Ct,E=Md(),C.pooledCache=E,E.refCount++,E!==null&&(C.pooledCacheLanes|=d),C=E),i.memoizedState={parent:g,cache:C},zd(i),gs(i,Wt,C)):((r.lanes&d)!==0&&(Hd(r,i),lo(i,null,null,d),oo()),C=r.memoizedState,E=i.memoizedState,C.parent!==g?(C={parent:g,cache:g},i.memoizedState=C,i.lanes===0&&(i.memoizedState=i.updateQueue.baseState=C),gs(i,Wt,g)):(g=E.cache,gs(i,Wt,g),g!==C.cache&&Od(i,[Wt],d,!0))),_n(r,i,i.pendingProps.children,d),i.child;case 29:throw i.pendingProps}throw Error(s(156,i.tag))}function Kr(r){r.flags|=4}function bh(r,i,d,g,C){if((i=(r.mode&32)!==0)&&(i=!1),i){if(r.flags|=16777216,(C&335544128)===C)if(r.stateNode.complete)r.flags|=8192;else if($_())r.flags|=8192;else throw ri=Hl,Bd}else r.flags&=-16777217}function p_(r,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)r.flags&=-16777217;else if(r.flags|=16777216,!Ay(i))if($_())r.flags|=8192;else throw ri=Hl,Bd}function rc(r,i){i!==null&&(r.flags|=4),r.flags&16384&&(i=r.tag!==22?Gt():536870912,r.lanes|=i,aa|=i)}function po(r,i){if(!ft)switch(r.tailMode){case"hidden":i=r.tail;for(var d=null;i!==null;)i.alternate!==null&&(d=i),i=i.sibling;d===null?r.tail=null:d.sibling=null;break;case"collapsed":d=r.tail;for(var g=null;d!==null;)d.alternate!==null&&(g=d),d=d.sibling;g===null?i||r.tail===null?r.tail=null:r.tail.sibling=null:g.sibling=null}}function Dt(r){var i=r.alternate!==null&&r.alternate.child===r.child,d=0,g=0;if(i)for(var C=r.child;C!==null;)d|=C.lanes|C.childLanes,g|=C.subtreeFlags&65011712,g|=C.flags&65011712,C.return=r,C=C.sibling;else for(C=r.child;C!==null;)d|=C.lanes|C.childLanes,g|=C.subtreeFlags,g|=C.flags,C.return=r,C=C.sibling;return r.subtreeFlags|=g,r.childLanes=d,i}function Ak(r,i,d){var g=i.pendingProps;switch(Nd(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Dt(i),null;case 1:return Dt(i),null;case 3:return d=i.stateNode,g=null,r!==null&&(g=r.memoizedState.cache),i.memoizedState.cache!==g&&(i.flags|=2048),Vr(Wt),le(),d.pendingContext&&(d.context=d.pendingContext,d.pendingContext=null),(r===null||r.child===null)&&(qi(i)?Kr(i):r===null||r.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,Dd())),Dt(i),null;case 26:var C=i.type,E=i.memoizedState;return r===null?(Kr(i),E!==null?(Dt(i),p_(i,E)):(Dt(i),bh(i,C,null,g,d))):E?E!==r.memoizedState?(Kr(i),Dt(i),p_(i,E)):(Dt(i),i.flags&=-16777217):(r=r.memoizedProps,r!==g&&Kr(i),Dt(i),bh(i,C,r,g,d)),null;case 27:if(ve(i),d=ne.current,C=i.type,r!==null&&i.stateNode!=null)r.memoizedProps!==g&&Kr(i);else{if(!g){if(i.stateNode===null)throw Error(s(166));return Dt(i),null}r=ee.current,qi(i)?Kg(i):(r=Sy(C,g,d),i.stateNode=r,Kr(i))}return Dt(i),null;case 5:if(ve(i),C=i.type,r!==null&&i.stateNode!=null)r.memoizedProps!==g&&Kr(i);else{if(!g){if(i.stateNode===null)throw Error(s(166));return Dt(i),null}if(E=ee.current,qi(i))Kg(i);else{var M=_c(ne.current);switch(E){case 1:E=M.createElementNS("http://www.w3.org/2000/svg",C);break;case 2:E=M.createElementNS("http://www.w3.org/1998/Math/MathML",C);break;default:switch(C){case"svg":E=M.createElementNS("http://www.w3.org/2000/svg",C);break;case"math":E=M.createElementNS("http://www.w3.org/1998/Math/MathML",C);break;case"script":E=M.createElement("div"),E.innerHTML="<script><\/script>",E=E.removeChild(E.firstChild);break;case"select":E=typeof g.is=="string"?M.createElement("select",{is:g.is}):M.createElement("select"),g.multiple?E.multiple=!0:g.size&&(E.size=g.size);break;default:E=typeof g.is=="string"?M.createElement(C,{is:g.is}):M.createElement(C)}}E[pn]=i,E[An]=g;e:for(M=i.child;M!==null;){if(M.tag===5||M.tag===6)E.appendChild(M.stateNode);else if(M.tag!==4&&M.tag!==27&&M.child!==null){M.child.return=M,M=M.child;continue}if(M===i)break e;for(;M.sibling===null;){if(M.return===null||M.return===i)break e;M=M.return}M.sibling.return=M.return,M=M.sibling}i.stateNode=E;e:switch(yn(E,C,g),C){case"button":case"input":case"select":case"textarea":g=!!g.autoFocus;break e;case"img":g=!0;break e;default:g=!1}g&&Kr(i)}}return Dt(i),bh(i,i.type,r===null?null:r.memoizedProps,i.pendingProps,d),null;case 6:if(r&&i.stateNode!=null)r.memoizedProps!==g&&Kr(i);else{if(typeof g!="string"&&i.stateNode===null)throw Error(s(166));if(r=ne.current,qi(i)){if(r=i.stateNode,d=i.memoizedProps,g=null,C=gn,C!==null)switch(C.tag){case 27:case 5:g=C.memoizedProps}r[pn]=i,r=!!(r.nodeValue===d||g!==null&&g.suppressHydrationWarning===!0||dy(r.nodeValue,d)),r||ps(i,!0)}else r=_c(r).createTextNode(g),r[pn]=i,i.stateNode=r}return Dt(i),null;case 31:if(d=i.memoizedState,r===null||r.memoizedState!==null){if(g=qi(i),d!==null){if(r===null){if(!g)throw Error(s(318));if(r=i.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(s(557));r[pn]=i}else Js(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Dt(i),r=!1}else d=Dd(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=d),r=!0;if(!r)return i.flags&256?(Fn(i),i):(Fn(i),null);if((i.flags&128)!==0)throw Error(s(558))}return Dt(i),null;case 13:if(g=i.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(C=qi(i),g!==null&&g.dehydrated!==null){if(r===null){if(!C)throw Error(s(318));if(C=i.memoizedState,C=C!==null?C.dehydrated:null,!C)throw Error(s(317));C[pn]=i}else Js(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Dt(i),C=!1}else C=Dd(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=C),C=!0;if(!C)return i.flags&256?(Fn(i),i):(Fn(i),null)}return Fn(i),(i.flags&128)!==0?(i.lanes=d,i):(d=g!==null,r=r!==null&&r.memoizedState!==null,d&&(g=i.child,C=null,g.alternate!==null&&g.alternate.memoizedState!==null&&g.alternate.memoizedState.cachePool!==null&&(C=g.alternate.memoizedState.cachePool.pool),E=null,g.memoizedState!==null&&g.memoizedState.cachePool!==null&&(E=g.memoizedState.cachePool.pool),E!==C&&(g.flags|=2048)),d!==r&&d&&(i.child.flags|=8192),rc(i,i.updateQueue),Dt(i),null);case 4:return le(),r===null&&Fh(i.stateNode.containerInfo),Dt(i),null;case 10:return Vr(i.type),Dt(i),null;case 19:if(V($t),g=i.memoizedState,g===null)return Dt(i),null;if(C=(i.flags&128)!==0,E=g.rendering,E===null)if(C)po(g,!1);else{if(Bt!==0||r!==null&&(r.flags&128)!==0)for(r=i.child;r!==null;){if(E=Vl(r),E!==null){for(i.flags|=128,po(g,!1),r=E.updateQueue,i.updateQueue=r,rc(i,r),i.subtreeFlags=0,r=d,d=i.child;d!==null;)Fg(d,r),d=d.sibling;return U($t,$t.current&1|2),ft&&Ur(i,g.treeForkCount),i.child}r=r.sibling}g.tail!==null&&ze()>lc&&(i.flags|=128,C=!0,po(g,!1),i.lanes=4194304)}else{if(!C)if(r=Vl(E),r!==null){if(i.flags|=128,C=!0,r=r.updateQueue,i.updateQueue=r,rc(i,r),po(g,!0),g.tail===null&&g.tailMode==="hidden"&&!E.alternate&&!ft)return Dt(i),null}else 2*ze()-g.renderingStartTime>lc&&d!==536870912&&(i.flags|=128,C=!0,po(g,!1),i.lanes=4194304);g.isBackwards?(E.sibling=i.child,i.child=E):(r=g.last,r!==null?r.sibling=E:i.child=E,g.last=E)}return g.tail!==null?(r=g.tail,g.rendering=r,g.tail=r.sibling,g.renderingStartTime=ze(),r.sibling=null,d=$t.current,U($t,C?d&1|2:d&1),ft&&Ur(i,g.treeForkCount),r):(Dt(i),null);case 22:case 23:return Fn(i),Vd(),g=i.memoizedState!==null,r!==null?r.memoizedState!==null!==g&&(i.flags|=8192):g&&(i.flags|=8192),g?(d&536870912)!==0&&(i.flags&128)===0&&(Dt(i),i.subtreeFlags&6&&(i.flags|=8192)):Dt(i),d=i.updateQueue,d!==null&&rc(i,d.retryQueue),d=null,r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(d=r.memoizedState.cachePool.pool),g=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(g=i.memoizedState.cachePool.pool),g!==d&&(i.flags|=2048),r!==null&&V(ti),null;case 24:return d=null,r!==null&&(d=r.memoizedState.cache),i.memoizedState.cache!==d&&(i.flags|=2048),Vr(Wt),Dt(i),null;case 25:return null;case 30:return null}throw Error(s(156,i.tag))}function Dk(r,i){switch(Nd(i),i.tag){case 1:return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 3:return Vr(Wt),le(),r=i.flags,(r&65536)!==0&&(r&128)===0?(i.flags=r&-65537|128,i):null;case 26:case 27:case 5:return ve(i),null;case 31:if(i.memoizedState!==null){if(Fn(i),i.alternate===null)throw Error(s(340));Js()}return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 13:if(Fn(i),r=i.memoizedState,r!==null&&r.dehydrated!==null){if(i.alternate===null)throw Error(s(340));Js()}return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 19:return V($t),null;case 4:return le(),null;case 10:return Vr(i.type),null;case 22:case 23:return Fn(i),Vd(),r!==null&&V(ti),r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 24:return Vr(Wt),null;case 25:return null;default:return null}}function g_(r,i){switch(Nd(i),i.tag){case 3:Vr(Wt),le();break;case 26:case 27:case 5:ve(i);break;case 4:le();break;case 31:i.memoizedState!==null&&Fn(i);break;case 13:Fn(i);break;case 19:V($t);break;case 10:Vr(i.type);break;case 22:case 23:Fn(i),Vd(),r!==null&&V(ti);break;case 24:Vr(Wt)}}function go(r,i){try{var d=i.updateQueue,g=d!==null?d.lastEffect:null;if(g!==null){var C=g.next;d=C;do{if((d.tag&r)===r){g=void 0;var E=d.create,M=d.inst;g=E(),M.destroy=g}d=d.next}while(d!==C)}}catch(q){vt(i,i.return,q)}}function Ss(r,i,d){try{var g=i.updateQueue,C=g!==null?g.lastEffect:null;if(C!==null){var E=C.next;g=E;do{if((g.tag&r)===r){var M=g.inst,q=M.destroy;if(q!==void 0){M.destroy=void 0,C=i;var te=d,oe=q;try{oe()}catch(pe){vt(C,te,pe)}}}g=g.next}while(g!==E)}}catch(pe){vt(i,i.return,pe)}}function x_(r){var i=r.updateQueue;if(i!==null){var d=r.stateNode;try{ox(i,d)}catch(g){vt(r,r.return,g)}}}function __(r,i,d){d.props=ai(r.type,r.memoizedProps),d.state=r.memoizedState;try{d.componentWillUnmount()}catch(g){vt(r,i,g)}}function xo(r,i){try{var d=r.ref;if(d!==null){switch(r.tag){case 26:case 27:case 5:var g=r.stateNode;break;case 30:g=r.stateNode;break;default:g=r.stateNode}typeof d=="function"?r.refCleanup=d(g):d.current=g}}catch(C){vt(r,i,C)}}function Er(r,i){var d=r.ref,g=r.refCleanup;if(d!==null)if(typeof g=="function")try{g()}catch(C){vt(r,i,C)}finally{r.refCleanup=null,r=r.alternate,r!=null&&(r.refCleanup=null)}else if(typeof d=="function")try{d(null)}catch(C){vt(r,i,C)}else d.current=null}function y_(r){var i=r.type,d=r.memoizedProps,g=r.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":d.autoFocus&&g.focus();break e;case"img":d.src?g.src=d.src:d.srcSet&&(g.srcset=d.srcSet)}}catch(C){vt(r,r.return,C)}}function Sh(r,i,d){try{var g=r.stateNode;Zk(g,r.type,d,i),g[An]=i}catch(C){vt(r,r.return,C)}}function v_(r){return r.tag===5||r.tag===3||r.tag===26||r.tag===27&&Ns(r.type)||r.tag===4}function wh(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||v_(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.tag===27&&Ns(r.type)||r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function Ch(r,i,d){var g=r.tag;if(g===5||g===6)r=r.stateNode,i?(d.nodeType===9?d.body:d.nodeName==="HTML"?d.ownerDocument.body:d).insertBefore(r,i):(i=d.nodeType===9?d.body:d.nodeName==="HTML"?d.ownerDocument.body:d,i.appendChild(r),d=d._reactRootContainer,d!=null||i.onclick!==null||(i.onclick=zr));else if(g!==4&&(g===27&&Ns(r.type)&&(d=r.stateNode,i=null),r=r.child,r!==null))for(Ch(r,i,d),r=r.sibling;r!==null;)Ch(r,i,d),r=r.sibling}function sc(r,i,d){var g=r.tag;if(g===5||g===6)r=r.stateNode,i?d.insertBefore(r,i):d.appendChild(r);else if(g!==4&&(g===27&&Ns(r.type)&&(d=r.stateNode),r=r.child,r!==null))for(sc(r,i,d),r=r.sibling;r!==null;)sc(r,i,d),r=r.sibling}function b_(r){var i=r.stateNode,d=r.memoizedProps;try{for(var g=r.type,C=i.attributes;C.length;)i.removeAttributeNode(C[0]);yn(i,g,d),i[pn]=r,i[An]=d}catch(E){vt(r,r.return,E)}}var Yr=!1,Yt=!1,kh=!1,S_=typeof WeakSet=="function"?WeakSet:Set,dn=null;function Lk(r,i){if(r=r.containerInfo,Wh=kc,r=Og(r),_d(r)){if("selectionStart"in r)var d={start:r.selectionStart,end:r.selectionEnd};else e:{d=(d=r.ownerDocument)&&d.defaultView||window;var g=d.getSelection&&d.getSelection();if(g&&g.rangeCount!==0){d=g.anchorNode;var C=g.anchorOffset,E=g.focusNode;g=g.focusOffset;try{d.nodeType,E.nodeType}catch{d=null;break e}var M=0,q=-1,te=-1,oe=0,pe=0,_e=r,ce=null;t:for(;;){for(var de;_e!==d||C!==0&&_e.nodeType!==3||(q=M+C),_e!==E||g!==0&&_e.nodeType!==3||(te=M+g),_e.nodeType===3&&(M+=_e.nodeValue.length),(de=_e.firstChild)!==null;)ce=_e,_e=de;for(;;){if(_e===r)break t;if(ce===d&&++oe===C&&(q=M),ce===E&&++pe===g&&(te=M),(de=_e.nextSibling)!==null)break;_e=ce,ce=_e.parentNode}_e=de}d=q===-1||te===-1?null:{start:q,end:te}}else d=null}d=d||{start:0,end:0}}else d=null;for(qh={focusedElem:r,selectionRange:d},kc=!1,dn=i;dn!==null;)if(i=dn,r=i.child,(i.subtreeFlags&1028)!==0&&r!==null)r.return=i,dn=r;else for(;dn!==null;){switch(i=dn,E=i.alternate,r=i.flags,i.tag){case 0:if((r&4)!==0&&(r=i.updateQueue,r=r!==null?r.events:null,r!==null))for(d=0;d<r.length;d++)C=r[d],C.ref.impl=C.nextImpl;break;case 11:case 15:break;case 1:if((r&1024)!==0&&E!==null){r=void 0,d=i,C=E.memoizedProps,E=E.memoizedState,g=d.stateNode;try{var Me=ai(d.type,C);r=g.getSnapshotBeforeUpdate(Me,E),g.__reactInternalSnapshotBeforeUpdate=r}catch(Fe){vt(d,d.return,Fe)}}break;case 3:if((r&1024)!==0){if(r=i.stateNode.containerInfo,d=r.nodeType,d===9)Xh(r);else if(d===1)switch(r.nodeName){case"HEAD":case"HTML":case"BODY":Xh(r);break;default:r.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((r&1024)!==0)throw Error(s(163))}if(r=i.sibling,r!==null){r.return=i.return,dn=r;break}dn=i.return}}function w_(r,i,d){var g=d.flags;switch(d.tag){case 0:case 11:case 15:Qr(r,d),g&4&&go(5,d);break;case 1:if(Qr(r,d),g&4)if(r=d.stateNode,i===null)try{r.componentDidMount()}catch(M){vt(d,d.return,M)}else{var C=ai(d.type,i.memoizedProps);i=i.memoizedState;try{r.componentDidUpdate(C,i,r.__reactInternalSnapshotBeforeUpdate)}catch(M){vt(d,d.return,M)}}g&64&&x_(d),g&512&&xo(d,d.return);break;case 3:if(Qr(r,d),g&64&&(r=d.updateQueue,r!==null)){if(i=null,d.child!==null)switch(d.child.tag){case 27:case 5:i=d.child.stateNode;break;case 1:i=d.child.stateNode}try{ox(r,i)}catch(M){vt(d,d.return,M)}}break;case 27:i===null&&g&4&&b_(d);case 26:case 5:Qr(r,d),i===null&&g&4&&y_(d),g&512&&xo(d,d.return);break;case 12:Qr(r,d);break;case 31:Qr(r,d),g&4&&E_(r,d);break;case 13:Qr(r,d),g&4&&j_(r,d),g&64&&(r=d.memoizedState,r!==null&&(r=r.dehydrated,r!==null&&(d=$k.bind(null,d),oE(r,d))));break;case 22:if(g=d.memoizedState!==null||Yr,!g){i=i!==null&&i.memoizedState!==null||Yt,C=Yr;var E=Yt;Yr=g,(Yt=i)&&!E?Jr(r,d,(d.subtreeFlags&8772)!==0):Qr(r,d),Yr=C,Yt=E}break;case 30:break;default:Qr(r,d)}}function C_(r){var i=r.alternate;i!==null&&(r.alternate=null,C_(i)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(i=r.stateNode,i!==null&&td(i)),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}var Mt=null,Ln=!1;function Xr(r,i,d){for(d=d.child;d!==null;)k_(r,i,d),d=d.sibling}function k_(r,i,d){if(Re&&typeof Re.onCommitFiberUnmount=="function")try{Re.onCommitFiberUnmount(he,d)}catch{}switch(d.tag){case 26:Yt||Er(d,i),Xr(r,i,d),d.memoizedState?d.memoizedState.count--:d.stateNode&&(d=d.stateNode,d.parentNode.removeChild(d));break;case 27:Yt||Er(d,i);var g=Mt,C=Ln;Ns(d.type)&&(Mt=d.stateNode,Ln=!1),Xr(r,i,d),Eo(d.stateNode),Mt=g,Ln=C;break;case 5:Yt||Er(d,i);case 6:if(g=Mt,C=Ln,Mt=null,Xr(r,i,d),Mt=g,Ln=C,Mt!==null)if(Ln)try{(Mt.nodeType===9?Mt.body:Mt.nodeName==="HTML"?Mt.ownerDocument.body:Mt).removeChild(d.stateNode)}catch(E){vt(d,i,E)}else try{Mt.removeChild(d.stateNode)}catch(E){vt(d,i,E)}break;case 18:Mt!==null&&(Ln?(r=Mt,xy(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,d.stateNode),ma(r)):xy(Mt,d.stateNode));break;case 4:g=Mt,C=Ln,Mt=d.stateNode.containerInfo,Ln=!0,Xr(r,i,d),Mt=g,Ln=C;break;case 0:case 11:case 14:case 15:Ss(2,d,i),Yt||Ss(4,d,i),Xr(r,i,d);break;case 1:Yt||(Er(d,i),g=d.stateNode,typeof g.componentWillUnmount=="function"&&__(d,i,g)),Xr(r,i,d);break;case 21:Xr(r,i,d);break;case 22:Yt=(g=Yt)||d.memoizedState!==null,Xr(r,i,d),Yt=g;break;default:Xr(r,i,d)}}function E_(r,i){if(i.memoizedState===null&&(r=i.alternate,r!==null&&(r=r.memoizedState,r!==null))){r=r.dehydrated;try{ma(r)}catch(d){vt(i,i.return,d)}}}function j_(r,i){if(i.memoizedState===null&&(r=i.alternate,r!==null&&(r=r.memoizedState,r!==null&&(r=r.dehydrated,r!==null))))try{ma(r)}catch(d){vt(i,i.return,d)}}function Rk(r){switch(r.tag){case 31:case 13:case 19:var i=r.stateNode;return i===null&&(i=r.stateNode=new S_),i;case 22:return r=r.stateNode,i=r._retryCache,i===null&&(i=r._retryCache=new S_),i;default:throw Error(s(435,r.tag))}}function ic(r,i){var d=Rk(r);i.forEach(function(g){if(!d.has(g)){d.add(g);var C=Uk.bind(null,r,g);g.then(C,C)}})}function Rn(r,i){var d=i.deletions;if(d!==null)for(var g=0;g<d.length;g++){var C=d[g],E=r,M=i,q=M;e:for(;q!==null;){switch(q.tag){case 27:if(Ns(q.type)){Mt=q.stateNode,Ln=!1;break e}break;case 5:Mt=q.stateNode,Ln=!1;break e;case 3:case 4:Mt=q.stateNode.containerInfo,Ln=!0;break e}q=q.return}if(Mt===null)throw Error(s(160));k_(E,M,C),Mt=null,Ln=!1,E=C.alternate,E!==null&&(E.return=null),C.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)T_(i,r),i=i.sibling}var pr=null;function T_(r,i){var d=r.alternate,g=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:Rn(i,r),On(r),g&4&&(Ss(3,r,r.return),go(3,r),Ss(5,r,r.return));break;case 1:Rn(i,r),On(r),g&512&&(Yt||d===null||Er(d,d.return)),g&64&&Yr&&(r=r.updateQueue,r!==null&&(g=r.callbacks,g!==null&&(d=r.shared.hiddenCallbacks,r.shared.hiddenCallbacks=d===null?g:d.concat(g))));break;case 26:var C=pr;if(Rn(i,r),On(r),g&512&&(Yt||d===null||Er(d,d.return)),g&4){var E=d!==null?d.memoizedState:null;if(g=r.memoizedState,d===null)if(g===null)if(r.stateNode===null){e:{g=r.type,d=r.memoizedProps,C=C.ownerDocument||C;t:switch(g){case"title":E=C.getElementsByTagName("title")[0],(!E||E[Fa]||E[pn]||E.namespaceURI==="http://www.w3.org/2000/svg"||E.hasAttribute("itemprop"))&&(E=C.createElement(g),C.head.insertBefore(E,C.querySelector("head > title"))),yn(E,g,d),E[pn]=r,un(E),g=E;break e;case"link":var M=Ty("link","href",C).get(g+(d.href||""));if(M){for(var q=0;q<M.length;q++)if(E=M[q],E.getAttribute("href")===(d.href==null||d.href===""?null:d.href)&&E.getAttribute("rel")===(d.rel==null?null:d.rel)&&E.getAttribute("title")===(d.title==null?null:d.title)&&E.getAttribute("crossorigin")===(d.crossOrigin==null?null:d.crossOrigin)){M.splice(q,1);break t}}E=C.createElement(g),yn(E,g,d),C.head.appendChild(E);break;case"meta":if(M=Ty("meta","content",C).get(g+(d.content||""))){for(q=0;q<M.length;q++)if(E=M[q],E.getAttribute("content")===(d.content==null?null:""+d.content)&&E.getAttribute("name")===(d.name==null?null:d.name)&&E.getAttribute("property")===(d.property==null?null:d.property)&&E.getAttribute("http-equiv")===(d.httpEquiv==null?null:d.httpEquiv)&&E.getAttribute("charset")===(d.charSet==null?null:d.charSet)){M.splice(q,1);break t}}E=C.createElement(g),yn(E,g,d),C.head.appendChild(E);break;default:throw Error(s(468,g))}E[pn]=r,un(E),g=E}r.stateNode=g}else Ny(C,r.type,r.stateNode);else r.stateNode=jy(C,g,r.memoizedProps);else E!==g?(E===null?d.stateNode!==null&&(d=d.stateNode,d.parentNode.removeChild(d)):E.count--,g===null?Ny(C,r.type,r.stateNode):jy(C,g,r.memoizedProps)):g===null&&r.stateNode!==null&&Sh(r,r.memoizedProps,d.memoizedProps)}break;case 27:Rn(i,r),On(r),g&512&&(Yt||d===null||Er(d,d.return)),d!==null&&g&4&&Sh(r,r.memoizedProps,d.memoizedProps);break;case 5:if(Rn(i,r),On(r),g&512&&(Yt||d===null||Er(d,d.return)),r.flags&32){C=r.stateNode;try{Pi(C,"")}catch(Me){vt(r,r.return,Me)}}g&4&&r.stateNode!=null&&(C=r.memoizedProps,Sh(r,C,d!==null?d.memoizedProps:C)),g&1024&&(kh=!0);break;case 6:if(Rn(i,r),On(r),g&4){if(r.stateNode===null)throw Error(s(162));g=r.memoizedProps,d=r.stateNode;try{d.nodeValue=g}catch(Me){vt(r,r.return,Me)}}break;case 3:if(bc=null,C=pr,pr=yc(i.containerInfo),Rn(i,r),pr=C,On(r),g&4&&d!==null&&d.memoizedState.isDehydrated)try{ma(i.containerInfo)}catch(Me){vt(r,r.return,Me)}kh&&(kh=!1,N_(r));break;case 4:g=pr,pr=yc(r.stateNode.containerInfo),Rn(i,r),On(r),pr=g;break;case 12:Rn(i,r),On(r);break;case 31:Rn(i,r),On(r),g&4&&(g=r.updateQueue,g!==null&&(r.updateQueue=null,ic(r,g)));break;case 13:Rn(i,r),On(r),r.child.flags&8192&&r.memoizedState!==null!=(d!==null&&d.memoizedState!==null)&&(oc=ze()),g&4&&(g=r.updateQueue,g!==null&&(r.updateQueue=null,ic(r,g)));break;case 22:C=r.memoizedState!==null;var te=d!==null&&d.memoizedState!==null,oe=Yr,pe=Yt;if(Yr=oe||C,Yt=pe||te,Rn(i,r),Yt=pe,Yr=oe,On(r),g&8192)e:for(i=r.stateNode,i._visibility=C?i._visibility&-2:i._visibility|1,C&&(d===null||te||Yr||Yt||oi(r)),d=null,i=r;;){if(i.tag===5||i.tag===26){if(d===null){te=d=i;try{if(E=te.stateNode,C)M=E.style,typeof M.setProperty=="function"?M.setProperty("display","none","important"):M.display="none";else{q=te.stateNode;var _e=te.memoizedProps.style,ce=_e!=null&&_e.hasOwnProperty("display")?_e.display:null;q.style.display=ce==null||typeof ce=="boolean"?"":(""+ce).trim()}}catch(Me){vt(te,te.return,Me)}}}else if(i.tag===6){if(d===null){te=i;try{te.stateNode.nodeValue=C?"":te.memoizedProps}catch(Me){vt(te,te.return,Me)}}}else if(i.tag===18){if(d===null){te=i;try{var de=te.stateNode;C?_y(de,!0):_y(te.stateNode,!1)}catch(Me){vt(te,te.return,Me)}}}else if((i.tag!==22&&i.tag!==23||i.memoizedState===null||i===r)&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===r)break e;for(;i.sibling===null;){if(i.return===null||i.return===r)break e;d===i&&(d=null),i=i.return}d===i&&(d=null),i.sibling.return=i.return,i=i.sibling}g&4&&(g=r.updateQueue,g!==null&&(d=g.retryQueue,d!==null&&(g.retryQueue=null,ic(r,d))));break;case 19:Rn(i,r),On(r),g&4&&(g=r.updateQueue,g!==null&&(r.updateQueue=null,ic(r,g)));break;case 30:break;case 21:break;default:Rn(i,r),On(r)}}function On(r){var i=r.flags;if(i&2){try{for(var d,g=r.return;g!==null;){if(v_(g)){d=g;break}g=g.return}if(d==null)throw Error(s(160));switch(d.tag){case 27:var C=d.stateNode,E=wh(r);sc(r,E,C);break;case 5:var M=d.stateNode;d.flags&32&&(Pi(M,""),d.flags&=-33);var q=wh(r);sc(r,q,M);break;case 3:case 4:var te=d.stateNode.containerInfo,oe=wh(r);Ch(r,oe,te);break;default:throw Error(s(161))}}catch(pe){vt(r,r.return,pe)}r.flags&=-3}i&4096&&(r.flags&=-4097)}function N_(r){if(r.subtreeFlags&1024)for(r=r.child;r!==null;){var i=r;N_(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),r=r.sibling}}function Qr(r,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)w_(r,i.alternate,i),i=i.sibling}function oi(r){for(r=r.child;r!==null;){var i=r;switch(i.tag){case 0:case 11:case 14:case 15:Ss(4,i,i.return),oi(i);break;case 1:Er(i,i.return);var d=i.stateNode;typeof d.componentWillUnmount=="function"&&__(i,i.return,d),oi(i);break;case 27:Eo(i.stateNode);case 26:case 5:Er(i,i.return),oi(i);break;case 22:i.memoizedState===null&&oi(i);break;case 30:oi(i);break;default:oi(i)}r=r.sibling}}function Jr(r,i,d){for(d=d&&(i.subtreeFlags&8772)!==0,i=i.child;i!==null;){var g=i.alternate,C=r,E=i,M=E.flags;switch(E.tag){case 0:case 11:case 15:Jr(C,E,d),go(4,E);break;case 1:if(Jr(C,E,d),g=E,C=g.stateNode,typeof C.componentDidMount=="function")try{C.componentDidMount()}catch(oe){vt(g,g.return,oe)}if(g=E,C=g.updateQueue,C!==null){var q=g.stateNode;try{var te=C.shared.hiddenCallbacks;if(te!==null)for(C.shared.hiddenCallbacks=null,C=0;C<te.length;C++)ax(te[C],q)}catch(oe){vt(g,g.return,oe)}}d&&M&64&&x_(E),xo(E,E.return);break;case 27:b_(E);case 26:case 5:Jr(C,E,d),d&&g===null&&M&4&&y_(E),xo(E,E.return);break;case 12:Jr(C,E,d);break;case 31:Jr(C,E,d),d&&M&4&&E_(C,E);break;case 13:Jr(C,E,d),d&&M&4&&j_(C,E);break;case 22:E.memoizedState===null&&Jr(C,E,d),xo(E,E.return);break;case 30:break;default:Jr(C,E,d)}i=i.sibling}}function Eh(r,i){var d=null;r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(d=r.memoizedState.cachePool.pool),r=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(r=i.memoizedState.cachePool.pool),r!==d&&(r!=null&&r.refCount++,d!=null&&no(d))}function jh(r,i){r=null,i.alternate!==null&&(r=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==r&&(i.refCount++,r!=null&&no(r))}function gr(r,i,d,g){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)A_(r,i,d,g),i=i.sibling}function A_(r,i,d,g){var C=i.flags;switch(i.tag){case 0:case 11:case 15:gr(r,i,d,g),C&2048&&go(9,i);break;case 1:gr(r,i,d,g);break;case 3:gr(r,i,d,g),C&2048&&(r=null,i.alternate!==null&&(r=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==r&&(i.refCount++,r!=null&&no(r)));break;case 12:if(C&2048){gr(r,i,d,g),r=i.stateNode;try{var E=i.memoizedProps,M=E.id,q=E.onPostCommit;typeof q=="function"&&q(M,i.alternate===null?"mount":"update",r.passiveEffectDuration,-0)}catch(te){vt(i,i.return,te)}}else gr(r,i,d,g);break;case 31:gr(r,i,d,g);break;case 13:gr(r,i,d,g);break;case 23:break;case 22:E=i.stateNode,M=i.alternate,i.memoizedState!==null?E._visibility&2?gr(r,i,d,g):_o(r,i):E._visibility&2?gr(r,i,d,g):(E._visibility|=2,ra(r,i,d,g,(i.subtreeFlags&10256)!==0||!1)),C&2048&&Eh(M,i);break;case 24:gr(r,i,d,g),C&2048&&jh(i.alternate,i);break;default:gr(r,i,d,g)}}function ra(r,i,d,g,C){for(C=C&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var E=r,M=i,q=d,te=g,oe=M.flags;switch(M.tag){case 0:case 11:case 15:ra(E,M,q,te,C),go(8,M);break;case 23:break;case 22:var pe=M.stateNode;M.memoizedState!==null?pe._visibility&2?ra(E,M,q,te,C):_o(E,M):(pe._visibility|=2,ra(E,M,q,te,C)),C&&oe&2048&&Eh(M.alternate,M);break;case 24:ra(E,M,q,te,C),C&&oe&2048&&jh(M.alternate,M);break;default:ra(E,M,q,te,C)}i=i.sibling}}function _o(r,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var d=r,g=i,C=g.flags;switch(g.tag){case 22:_o(d,g),C&2048&&Eh(g.alternate,g);break;case 24:_o(d,g),C&2048&&jh(g.alternate,g);break;default:_o(d,g)}i=i.sibling}}var yo=8192;function sa(r,i,d){if(r.subtreeFlags&yo)for(r=r.child;r!==null;)D_(r,i,d),r=r.sibling}function D_(r,i,d){switch(r.tag){case 26:sa(r,i,d),r.flags&yo&&r.memoizedState!==null&&yE(d,pr,r.memoizedState,r.memoizedProps);break;case 5:sa(r,i,d);break;case 3:case 4:var g=pr;pr=yc(r.stateNode.containerInfo),sa(r,i,d),pr=g;break;case 22:r.memoizedState===null&&(g=r.alternate,g!==null&&g.memoizedState!==null?(g=yo,yo=16777216,sa(r,i,d),yo=g):sa(r,i,d));break;default:sa(r,i,d)}}function L_(r){var i=r.alternate;if(i!==null&&(r=i.child,r!==null)){i.child=null;do i=r.sibling,r.sibling=null,r=i;while(r!==null)}}function vo(r){var i=r.deletions;if((r.flags&16)!==0){if(i!==null)for(var d=0;d<i.length;d++){var g=i[d];dn=g,O_(g,r)}L_(r)}if(r.subtreeFlags&10256)for(r=r.child;r!==null;)R_(r),r=r.sibling}function R_(r){switch(r.tag){case 0:case 11:case 15:vo(r),r.flags&2048&&Ss(9,r,r.return);break;case 3:vo(r);break;case 12:vo(r);break;case 22:var i=r.stateNode;r.memoizedState!==null&&i._visibility&2&&(r.return===null||r.return.tag!==13)?(i._visibility&=-3,ac(r)):vo(r);break;default:vo(r)}}function ac(r){var i=r.deletions;if((r.flags&16)!==0){if(i!==null)for(var d=0;d<i.length;d++){var g=i[d];dn=g,O_(g,r)}L_(r)}for(r=r.child;r!==null;){switch(i=r,i.tag){case 0:case 11:case 15:Ss(8,i,i.return),ac(i);break;case 22:d=i.stateNode,d._visibility&2&&(d._visibility&=-3,ac(i));break;default:ac(i)}r=r.sibling}}function O_(r,i){for(;dn!==null;){var d=dn;switch(d.tag){case 0:case 11:case 15:Ss(8,d,i);break;case 23:case 22:if(d.memoizedState!==null&&d.memoizedState.cachePool!==null){var g=d.memoizedState.cachePool.pool;g!=null&&g.refCount++}break;case 24:no(d.memoizedState.cache)}if(g=d.child,g!==null)g.return=d,dn=g;else e:for(d=r;dn!==null;){g=dn;var C=g.sibling,E=g.return;if(C_(g),g===d){dn=null;break e}if(C!==null){C.return=E,dn=C;break e}dn=E}}}var Ok={getCacheForType:function(r){var i=xn(Wt),d=i.data.get(r);return d===void 0&&(d=r(),i.data.set(r,d)),d},cacheSignal:function(){return xn(Wt).controller.signal}},Mk=typeof WeakMap=="function"?WeakMap:Map,xt=0,Ct=null,it=null,ct=0,yt=0,Vn=null,ws=!1,ia=!1,Th=!1,Zr=0,Bt=0,Cs=0,li=0,Nh=0,Gn=0,aa=0,bo=null,Mn=null,Ah=!1,oc=0,M_=0,lc=1/0,cc=null,ks=null,sn=0,Es=null,oa=null,es=0,Dh=0,Lh=null,I_=null,So=0,Rh=null;function Wn(){return(xt&2)!==0&&ct!==0?ct&-ct:H.T!==null?zh():Jp()}function P_(){if(Gn===0)if((ct&536870912)===0||ft){var r=Se;Se<<=1,(Se&3932160)===0&&(Se=262144),Gn=r}else Gn=536870912;return r=Un.current,r!==null&&(r.flags|=32),Gn}function In(r,i,d){(r===Ct&&(yt===2||yt===9)||r.cancelPendingCommit!==null)&&(la(r,0),js(r,ct,Gn,!1)),Ai(r,d),((xt&2)===0||r!==Ct)&&(r===Ct&&((xt&2)===0&&(li|=d),Bt===4&&js(r,ct,Gn,!1)),jr(r))}function B_(r,i,d){if((xt&6)!==0)throw Error(s(327));var g=!d&&(i&127)===0&&(i&r.expiredLanes)===0||Ge(r,i),C=g?Bk(r,i):Mh(r,i,!0),E=g;do{if(C===0){ia&&!g&&js(r,i,0,!1);break}else{if(d=r.current.alternate,E&&!Ik(d)){C=Mh(r,i,!1),E=!1;continue}if(C===2){if(E=i,r.errorRecoveryDisabledLanes&E)var M=0;else M=r.pendingLanes&-536870913,M=M!==0?M:M&536870912?536870912:0;if(M!==0){i=M;e:{var q=r;C=bo;var te=q.current.memoizedState.isDehydrated;if(te&&(la(q,M).flags|=256),M=Mh(q,M,!1),M!==2){if(Th&&!te){q.errorRecoveryDisabledLanes|=E,li|=E,C=4;break e}E=Mn,Mn=C,E!==null&&(Mn===null?Mn=E:Mn.push.apply(Mn,E))}C=M}if(E=!1,C!==2)continue}}if(C===1){la(r,0),js(r,i,0,!0);break}e:{switch(g=r,E=C,E){case 0:case 1:throw Error(s(345));case 4:if((i&4194048)!==i)break;case 6:js(g,i,Gn,!ws);break e;case 2:Mn=null;break;case 3:case 5:break;default:throw Error(s(329))}if((i&62914560)===i&&(C=oc+300-ze(),10<C)){if(js(g,i,Gn,!ws),ht(g,0,!0)!==0)break e;es=i,g.timeoutHandle=py(z_.bind(null,g,d,Mn,cc,Ah,i,Gn,li,aa,ws,E,"Throttled",-0,0),C);break e}z_(g,d,Mn,cc,Ah,i,Gn,li,aa,ws,E,null,-0,0)}}break}while(!0);jr(r)}function z_(r,i,d,g,C,E,M,q,te,oe,pe,_e,ce,de){if(r.timeoutHandle=-1,_e=i.subtreeFlags,_e&8192||(_e&16785408)===16785408){_e={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:zr},D_(i,E,_e);var Me=(E&62914560)===E?oc-ze():(E&4194048)===E?M_-ze():0;if(Me=vE(_e,Me),Me!==null){es=E,r.cancelPendingCommit=Me(q_.bind(null,r,i,E,d,g,C,M,q,te,pe,_e,null,ce,de)),js(r,E,M,!oe);return}}q_(r,i,E,d,g,C,M,q,te)}function Ik(r){for(var i=r;;){var d=i.tag;if((d===0||d===11||d===15)&&i.flags&16384&&(d=i.updateQueue,d!==null&&(d=d.stores,d!==null)))for(var g=0;g<d.length;g++){var C=d[g],E=C.getSnapshot;C=C.value;try{if(!Hn(E(),C))return!1}catch{return!1}}if(d=i.child,i.subtreeFlags&16384&&d!==null)d.return=i,i=d;else{if(i===r)break;for(;i.sibling===null;){if(i.return===null||i.return===r)return!0;i=i.return}i.sibling.return=i.return,i=i.sibling}}return!0}function js(r,i,d,g){i&=~Nh,i&=~li,r.suspendedLanes|=i,r.pingedLanes&=~i,g&&(r.warmLanes|=i),g=r.expirationTimes;for(var C=i;0<C;){var E=31-Ke(C),M=1<<E;g[E]=-1,C&=~M}d!==0&&Yp(r,d,i)}function uc(){return(xt&6)===0?(wo(0),!1):!0}function Oh(){if(it!==null){if(yt===0)var r=it.return;else r=it,Fr=Zs=null,Xd(r),Ji=null,so=0,r=it;for(;r!==null;)g_(r.alternate,r),r=r.return;it=null}}function la(r,i){var d=r.timeoutHandle;d!==-1&&(r.timeoutHandle=-1,nE(d)),d=r.cancelPendingCommit,d!==null&&(r.cancelPendingCommit=null,d()),es=0,Oh(),Ct=r,it=d=$r(r.current,null),ct=i,yt=0,Vn=null,ws=!1,ia=Ge(r,i),Th=!1,aa=Gn=Nh=li=Cs=Bt=0,Mn=bo=null,Ah=!1,(i&8)!==0&&(i|=i&32);var g=r.entangledLanes;if(g!==0)for(r=r.entanglements,g&=i;0<g;){var C=31-Ke(g),E=1<<C;i|=r[C],g&=~E}return Zr=i,Dl(),d}function H_(r,i){Ze=null,H.H=fo,i===Qi||i===zl?(i=nx(),yt=3):i===Bd?(i=nx(),yt=4):yt=i===hh?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,Vn=i,it===null&&(Bt=1,Zl(r,nr(i,r.current)))}function $_(){var r=Un.current;return r===null?!0:(ct&4194048)===ct?ar===null:(ct&62914560)===ct||(ct&536870912)!==0?r===ar:!1}function U_(){var r=H.H;return H.H=fo,r===null?fo:r}function F_(){var r=H.A;return H.A=Ok,r}function dc(){Bt=4,ws||(ct&4194048)!==ct&&Un.current!==null||(ia=!0),(Cs&134217727)===0&&(li&134217727)===0||Ct===null||js(Ct,ct,Gn,!1)}function Mh(r,i,d){var g=xt;xt|=2;var C=U_(),E=F_();(Ct!==r||ct!==i)&&(cc=null,la(r,i)),i=!1;var M=Bt;e:do try{if(yt!==0&&it!==null){var q=it,te=Vn;switch(yt){case 8:Oh(),M=6;break e;case 3:case 2:case 9:case 6:Un.current===null&&(i=!0);var oe=yt;if(yt=0,Vn=null,ca(r,q,te,oe),d&&ia){M=0;break e}break;default:oe=yt,yt=0,Vn=null,ca(r,q,te,oe)}}Pk(),M=Bt;break}catch(pe){H_(r,pe)}while(!0);return i&&r.shellSuspendCounter++,Fr=Zs=null,xt=g,H.H=C,H.A=E,it===null&&(Ct=null,ct=0,Dl()),M}function Pk(){for(;it!==null;)V_(it)}function Bk(r,i){var d=xt;xt|=2;var g=U_(),C=F_();Ct!==r||ct!==i?(cc=null,lc=ze()+500,la(r,i)):ia=Ge(r,i);e:do try{if(yt!==0&&it!==null){i=it;var E=Vn;t:switch(yt){case 1:yt=0,Vn=null,ca(r,i,E,1);break;case 2:case 9:if(ex(E)){yt=0,Vn=null,G_(i);break}i=function(){yt!==2&&yt!==9||Ct!==r||(yt=7),jr(r)},E.then(i,i);break e;case 3:yt=7;break e;case 4:yt=5;break e;case 7:ex(E)?(yt=0,Vn=null,G_(i)):(yt=0,Vn=null,ca(r,i,E,7));break;case 5:var M=null;switch(it.tag){case 26:M=it.memoizedState;case 5:case 27:var q=it;if(M?Ay(M):q.stateNode.complete){yt=0,Vn=null;var te=q.sibling;if(te!==null)it=te;else{var oe=q.return;oe!==null?(it=oe,hc(oe)):it=null}break t}}yt=0,Vn=null,ca(r,i,E,5);break;case 6:yt=0,Vn=null,ca(r,i,E,6);break;case 8:Oh(),Bt=6;break e;default:throw Error(s(462))}}zk();break}catch(pe){H_(r,pe)}while(!0);return Fr=Zs=null,H.H=g,H.A=C,xt=d,it!==null?0:(Ct=null,ct=0,Dl(),Bt)}function zk(){for(;it!==null&&!fe();)V_(it)}function V_(r){var i=m_(r.alternate,r,Zr);r.memoizedProps=r.pendingProps,i===null?hc(r):it=i}function G_(r){var i=r,d=i.alternate;switch(i.tag){case 15:case 0:i=l_(d,i,i.pendingProps,i.type,void 0,ct);break;case 11:i=l_(d,i,i.pendingProps,i.type.render,i.ref,ct);break;case 5:Xd(i);default:g_(d,i),i=it=Fg(i,Zr),i=m_(d,i,Zr)}r.memoizedProps=r.pendingProps,i===null?hc(r):it=i}function ca(r,i,d,g){Fr=Zs=null,Xd(i),Ji=null,so=0;var C=i.return;try{if(jk(r,C,i,d,ct)){Bt=1,Zl(r,nr(d,r.current)),it=null;return}}catch(E){if(C!==null)throw it=C,E;Bt=1,Zl(r,nr(d,r.current)),it=null;return}i.flags&32768?(ft||g===1?r=!0:ia||(ct&536870912)!==0?r=!1:(ws=r=!0,(g===2||g===9||g===3||g===6)&&(g=Un.current,g!==null&&g.tag===13&&(g.flags|=16384))),W_(i,r)):hc(i)}function hc(r){var i=r;do{if((i.flags&32768)!==0){W_(i,ws);return}r=i.return;var d=Ak(i.alternate,i,Zr);if(d!==null){it=d;return}if(i=i.sibling,i!==null){it=i;return}it=i=r}while(i!==null);Bt===0&&(Bt=5)}function W_(r,i){do{var d=Dk(r.alternate,r);if(d!==null){d.flags&=32767,it=d;return}if(d=r.return,d!==null&&(d.flags|=32768,d.subtreeFlags=0,d.deletions=null),!i&&(r=r.sibling,r!==null)){it=r;return}it=r=d}while(r!==null);Bt=6,it=null}function q_(r,i,d,g,C,E,M,q,te){r.cancelPendingCommit=null;do fc();while(sn!==0);if((xt&6)!==0)throw Error(s(327));if(i!==null){if(i===r.current)throw Error(s(177));if(E=i.lanes|i.childLanes,E|=wd,Qu(r,d,E,M,q,te),r===Ct&&(it=Ct=null,ct=0),oa=i,Es=r,es=d,Dh=E,Lh=C,I_=g,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(r.callbackNode=null,r.callbackPriority=0,Fk(Le,function(){return J_(),null})):(r.callbackNode=null,r.callbackPriority=0),g=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||g){g=H.T,H.T=null,C=J.p,J.p=2,M=xt,xt|=4;try{Lk(r,i,d)}finally{xt=M,J.p=C,H.T=g}}sn=1,K_(),Y_(),X_()}}function K_(){if(sn===1){sn=0;var r=Es,i=oa,d=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||d){d=H.T,H.T=null;var g=J.p;J.p=2;var C=xt;xt|=4;try{T_(i,r);var E=qh,M=Og(r.containerInfo),q=E.focusedElem,te=E.selectionRange;if(M!==q&&q&&q.ownerDocument&&Rg(q.ownerDocument.documentElement,q)){if(te!==null&&_d(q)){var oe=te.start,pe=te.end;if(pe===void 0&&(pe=oe),"selectionStart"in q)q.selectionStart=oe,q.selectionEnd=Math.min(pe,q.value.length);else{var _e=q.ownerDocument||document,ce=_e&&_e.defaultView||window;if(ce.getSelection){var de=ce.getSelection(),Me=q.textContent.length,Fe=Math.min(te.start,Me),wt=te.end===void 0?Fe:Math.min(te.end,Me);!de.extend&&Fe>wt&&(M=wt,wt=Fe,Fe=M);var ie=Lg(q,Fe),re=Lg(q,wt);if(ie&&re&&(de.rangeCount!==1||de.anchorNode!==ie.node||de.anchorOffset!==ie.offset||de.focusNode!==re.node||de.focusOffset!==re.offset)){var ae=_e.createRange();ae.setStart(ie.node,ie.offset),de.removeAllRanges(),Fe>wt?(de.addRange(ae),de.extend(re.node,re.offset)):(ae.setEnd(re.node,re.offset),de.addRange(ae))}}}}for(_e=[],de=q;de=de.parentNode;)de.nodeType===1&&_e.push({element:de,left:de.scrollLeft,top:de.scrollTop});for(typeof q.focus=="function"&&q.focus(),q=0;q<_e.length;q++){var xe=_e[q];xe.element.scrollLeft=xe.left,xe.element.scrollTop=xe.top}}kc=!!Wh,qh=Wh=null}finally{xt=C,J.p=g,H.T=d}}r.current=i,sn=2}}function Y_(){if(sn===2){sn=0;var r=Es,i=oa,d=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||d){d=H.T,H.T=null;var g=J.p;J.p=2;var C=xt;xt|=4;try{w_(r,i.alternate,i)}finally{xt=C,J.p=g,H.T=d}}sn=3}}function X_(){if(sn===4||sn===3){sn=0,De();var r=Es,i=oa,d=es,g=I_;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?sn=5:(sn=0,oa=Es=null,Q_(r,r.pendingLanes));var C=r.pendingLanes;if(C===0&&(ks=null),Zu(d),i=i.stateNode,Re&&typeof Re.onCommitFiberRoot=="function")try{Re.onCommitFiberRoot(he,i,void 0,(i.current.flags&128)===128)}catch{}if(g!==null){i=H.T,C=J.p,J.p=2,H.T=null;try{for(var E=r.onRecoverableError,M=0;M<g.length;M++){var q=g[M];E(q.value,{componentStack:q.stack})}}finally{H.T=i,J.p=C}}(es&3)!==0&&fc(),jr(r),C=r.pendingLanes,(d&261930)!==0&&(C&42)!==0?r===Rh?So++:(So=0,Rh=r):So=0,wo(0)}}function Q_(r,i){(r.pooledCacheLanes&=i)===0&&(i=r.pooledCache,i!=null&&(r.pooledCache=null,no(i)))}function fc(){return K_(),Y_(),X_(),J_()}function J_(){if(sn!==5)return!1;var r=Es,i=Dh;Dh=0;var d=Zu(es),g=H.T,C=J.p;try{J.p=32>d?32:d,H.T=null,d=Lh,Lh=null;var E=Es,M=es;if(sn=0,oa=Es=null,es=0,(xt&6)!==0)throw Error(s(331));var q=xt;if(xt|=4,R_(E.current),A_(E,E.current,M,d),xt=q,wo(0,!1),Re&&typeof Re.onPostCommitFiberRoot=="function")try{Re.onPostCommitFiberRoot(he,E)}catch{}return!0}finally{J.p=C,H.T=g,Q_(r,i)}}function Z_(r,i,d){i=nr(d,i),i=dh(r.stateNode,i,2),r=ys(r,i,2),r!==null&&(Ai(r,2),jr(r))}function vt(r,i,d){if(r.tag===3)Z_(r,r,d);else for(;i!==null;){if(i.tag===3){Z_(i,r,d);break}else if(i.tag===1){var g=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof g.componentDidCatch=="function"&&(ks===null||!ks.has(g))){r=nr(d,r),d=e_(2),g=ys(i,d,2),g!==null&&(t_(d,g,i,r),Ai(g,2),jr(g));break}}i=i.return}}function Ih(r,i,d){var g=r.pingCache;if(g===null){g=r.pingCache=new Mk;var C=new Set;g.set(i,C)}else C=g.get(i),C===void 0&&(C=new Set,g.set(i,C));C.has(d)||(Th=!0,C.add(d),r=Hk.bind(null,r,i,d),i.then(r,r))}function Hk(r,i,d){var g=r.pingCache;g!==null&&g.delete(i),r.pingedLanes|=r.suspendedLanes&d,r.warmLanes&=~d,Ct===r&&(ct&d)===d&&(Bt===4||Bt===3&&(ct&62914560)===ct&&300>ze()-oc?(xt&2)===0&&la(r,0):Nh|=d,aa===ct&&(aa=0)),jr(r)}function ey(r,i){i===0&&(i=Gt()),r=Xs(r,i),r!==null&&(Ai(r,i),jr(r))}function $k(r){var i=r.memoizedState,d=0;i!==null&&(d=i.retryLane),ey(r,d)}function Uk(r,i){var d=0;switch(r.tag){case 31:case 13:var g=r.stateNode,C=r.memoizedState;C!==null&&(d=C.retryLane);break;case 19:g=r.stateNode;break;case 22:g=r.stateNode._retryCache;break;default:throw Error(s(314))}g!==null&&g.delete(i),ey(r,d)}function Fk(r,i){return ye(r,i)}var mc=null,ua=null,Ph=!1,pc=!1,Bh=!1,Ts=0;function jr(r){r!==ua&&r.next===null&&(ua===null?mc=ua=r:ua=ua.next=r),pc=!0,Ph||(Ph=!0,Gk())}function wo(r,i){if(!Bh&&pc){Bh=!0;do for(var d=!1,g=mc;g!==null;){if(r!==0){var C=g.pendingLanes;if(C===0)var E=0;else{var M=g.suspendedLanes,q=g.pingedLanes;E=(1<<31-Ke(42|r)+1)-1,E&=C&~(M&~q),E=E&201326741?E&201326741|1:E?E|2:0}E!==0&&(d=!0,sy(g,E))}else E=ct,E=ht(g,g===Ct?E:0,g.cancelPendingCommit!==null||g.timeoutHandle!==-1),(E&3)===0||Ge(g,E)||(d=!0,sy(g,E));g=g.next}while(d);Bh=!1}}function Vk(){ty()}function ty(){pc=Ph=!1;var r=0;Ts!==0&&tE()&&(r=Ts);for(var i=ze(),d=null,g=mc;g!==null;){var C=g.next,E=ny(g,i);E===0?(g.next=null,d===null?mc=C:d.next=C,C===null&&(ua=d)):(d=g,(r!==0||(E&3)!==0)&&(pc=!0)),g=C}sn!==0&&sn!==5||wo(r),Ts!==0&&(Ts=0)}function ny(r,i){for(var d=r.suspendedLanes,g=r.pingedLanes,C=r.expirationTimes,E=r.pendingLanes&-62914561;0<E;){var M=31-Ke(E),q=1<<M,te=C[M];te===-1?((q&d)===0||(q&g)!==0)&&(C[M]=mn(q,i)):te<=i&&(r.expiredLanes|=q),E&=~q}if(i=Ct,d=ct,d=ht(r,r===i?d:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),g=r.callbackNode,d===0||r===i&&(yt===2||yt===9)||r.cancelPendingCommit!==null)return g!==null&&g!==null&&Ne(g),r.callbackNode=null,r.callbackPriority=0;if((d&3)===0||Ge(r,d)){if(i=d&-d,i===r.callbackPriority)return i;switch(g!==null&&Ne(g),Zu(d)){case 2:case 8:d=we;break;case 32:d=Le;break;case 268435456:d=Xe;break;default:d=Le}return g=ry.bind(null,r),d=ye(d,g),r.callbackPriority=i,r.callbackNode=d,i}return g!==null&&g!==null&&Ne(g),r.callbackPriority=2,r.callbackNode=null,2}function ry(r,i){if(sn!==0&&sn!==5)return r.callbackNode=null,r.callbackPriority=0,null;var d=r.callbackNode;if(fc()&&r.callbackNode!==d)return null;var g=ct;return g=ht(r,r===Ct?g:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),g===0?null:(B_(r,g,i),ny(r,ze()),r.callbackNode!=null&&r.callbackNode===d?ry.bind(null,r):null)}function sy(r,i){if(fc())return null;B_(r,i,!0)}function Gk(){rE(function(){(xt&6)!==0?ye(ue,Vk):ty()})}function zh(){if(Ts===0){var r=Yi;r===0&&(r=ge,ge<<=1,(ge&261888)===0&&(ge=256)),Ts=r}return Ts}function iy(r){return r==null||typeof r=="symbol"||typeof r=="boolean"?null:typeof r=="function"?r:wl(""+r)}function ay(r,i){var d=i.ownerDocument.createElement("input");return d.name=i.name,d.value=i.value,r.id&&d.setAttribute("form",r.id),i.parentNode.insertBefore(d,i),r=new FormData(r),d.parentNode.removeChild(d),r}function Wk(r,i,d,g,C){if(i==="submit"&&d&&d.stateNode===C){var E=iy((C[An]||null).action),M=g.submitter;M&&(i=(i=M[An]||null)?iy(i.formAction):M.getAttribute("formAction"),i!==null&&(E=i,M=null));var q=new jl("action","action",null,g,C);r.push({event:q,listeners:[{instance:null,listener:function(){if(g.defaultPrevented){if(Ts!==0){var te=M?ay(C,M):new FormData(C);ih(d,{pending:!0,data:te,method:C.method,action:E},null,te)}}else typeof E=="function"&&(q.preventDefault(),te=M?ay(C,M):new FormData(C),ih(d,{pending:!0,data:te,method:C.method,action:E},E,te))},currentTarget:C}]})}}for(var Hh=0;Hh<Sd.length;Hh++){var $h=Sd[Hh],qk=$h.toLowerCase(),Kk=$h[0].toUpperCase()+$h.slice(1);mr(qk,"on"+Kk)}mr(Pg,"onAnimationEnd"),mr(Bg,"onAnimationIteration"),mr(zg,"onAnimationStart"),mr("dblclick","onDoubleClick"),mr("focusin","onFocus"),mr("focusout","onBlur"),mr(uk,"onTransitionRun"),mr(dk,"onTransitionStart"),mr(hk,"onTransitionCancel"),mr(Hg,"onTransitionEnd"),Mi("onMouseEnter",["mouseout","mouseover"]),Mi("onMouseLeave",["mouseout","mouseover"]),Mi("onPointerEnter",["pointerout","pointerover"]),Mi("onPointerLeave",["pointerout","pointerover"]),Ws("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ws("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ws("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ws("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ws("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ws("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Co="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Yk=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Co));function oy(r,i){i=(i&4)!==0;for(var d=0;d<r.length;d++){var g=r[d],C=g.event;g=g.listeners;e:{var E=void 0;if(i)for(var M=g.length-1;0<=M;M--){var q=g[M],te=q.instance,oe=q.currentTarget;if(q=q.listener,te!==E&&C.isPropagationStopped())break e;E=q,C.currentTarget=oe;try{E(C)}catch(pe){Al(pe)}C.currentTarget=null,E=te}else for(M=0;M<g.length;M++){if(q=g[M],te=q.instance,oe=q.currentTarget,q=q.listener,te!==E&&C.isPropagationStopped())break e;E=q,C.currentTarget=oe;try{E(C)}catch(pe){Al(pe)}C.currentTarget=null,E=te}}}}function at(r,i){var d=i[ed];d===void 0&&(d=i[ed]=new Set);var g=r+"__bubble";d.has(g)||(ly(i,r,2,!1),d.add(g))}function Uh(r,i,d){var g=0;i&&(g|=4),ly(d,r,g,i)}var gc="_reactListening"+Math.random().toString(36).slice(2);function Fh(r){if(!r[gc]){r[gc]=!0,tg.forEach(function(d){d!=="selectionchange"&&(Yk.has(d)||Uh(d,!1,r),Uh(d,!0,r))});var i=r.nodeType===9?r:r.ownerDocument;i===null||i[gc]||(i[gc]=!0,Uh("selectionchange",!1,i))}}function ly(r,i,d,g){switch(Py(i)){case 2:var C=wE;break;case 8:C=CE;break;default:C=sf}d=C.bind(null,i,d,r),C=void 0,!cd||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(C=!0),g?C!==void 0?r.addEventListener(i,d,{capture:!0,passive:C}):r.addEventListener(i,d,!0):C!==void 0?r.addEventListener(i,d,{passive:C}):r.addEventListener(i,d,!1)}function Vh(r,i,d,g,C){var E=g;if((i&1)===0&&(i&2)===0&&g!==null)e:for(;;){if(g===null)return;var M=g.tag;if(M===3||M===4){var q=g.stateNode.containerInfo;if(q===C)break;if(M===4)for(M=g.return;M!==null;){var te=M.tag;if((te===3||te===4)&&M.stateNode.containerInfo===C)return;M=M.return}for(;q!==null;){if(M=Li(q),M===null)return;if(te=M.tag,te===5||te===6||te===26||te===27){g=E=M;continue e}q=q.parentNode}}g=g.return}fg(function(){var oe=E,pe=od(d),_e=[];e:{var ce=$g.get(r);if(ce!==void 0){var de=jl,Me=r;switch(r){case"keypress":if(kl(d)===0)break e;case"keydown":case"keyup":de=UC;break;case"focusin":Me="focus",de=fd;break;case"focusout":Me="blur",de=fd;break;case"beforeblur":case"afterblur":de=fd;break;case"click":if(d.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":de=gg;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":de=AC;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":de=GC;break;case Pg:case Bg:case zg:de=RC;break;case Hg:de=qC;break;case"scroll":case"scrollend":de=TC;break;case"wheel":de=YC;break;case"copy":case"cut":case"paste":de=MC;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":de=_g;break;case"toggle":case"beforetoggle":de=QC}var Fe=(i&4)!==0,wt=!Fe&&(r==="scroll"||r==="scrollend"),ie=Fe?ce!==null?ce+"Capture":null:ce;Fe=[];for(var re=oe,ae;re!==null;){var xe=re;if(ae=xe.stateNode,xe=xe.tag,xe!==5&&xe!==26&&xe!==27||ae===null||ie===null||(xe=Ga(re,ie),xe!=null&&Fe.push(ko(re,xe,ae))),wt)break;re=re.return}0<Fe.length&&(ce=new de(ce,Me,null,d,pe),_e.push({event:ce,listeners:Fe}))}}if((i&7)===0){e:{if(ce=r==="mouseover"||r==="pointerover",de=r==="mouseout"||r==="pointerout",ce&&d!==ad&&(Me=d.relatedTarget||d.fromElement)&&(Li(Me)||Me[Di]))break e;if((de||ce)&&(ce=pe.window===pe?pe:(ce=pe.ownerDocument)?ce.defaultView||ce.parentWindow:window,de?(Me=d.relatedTarget||d.toElement,de=oe,Me=Me?Li(Me):null,Me!==null&&(wt=o(Me),Fe=Me.tag,Me!==wt||Fe!==5&&Fe!==27&&Fe!==6)&&(Me=null)):(de=null,Me=oe),de!==Me)){if(Fe=gg,xe="onMouseLeave",ie="onMouseEnter",re="mouse",(r==="pointerout"||r==="pointerover")&&(Fe=_g,xe="onPointerLeave",ie="onPointerEnter",re="pointer"),wt=de==null?ce:Va(de),ae=Me==null?ce:Va(Me),ce=new Fe(xe,re+"leave",de,d,pe),ce.target=wt,ce.relatedTarget=ae,xe=null,Li(pe)===oe&&(Fe=new Fe(ie,re+"enter",Me,d,pe),Fe.target=ae,Fe.relatedTarget=wt,xe=Fe),wt=xe,de&&Me)t:{for(Fe=Xk,ie=de,re=Me,ae=0,xe=ie;xe;xe=Fe(xe))ae++;xe=0;for(var $e=re;$e;$e=Fe($e))xe++;for(;0<ae-xe;)ie=Fe(ie),ae--;for(;0<xe-ae;)re=Fe(re),xe--;for(;ae--;){if(ie===re||re!==null&&ie===re.alternate){Fe=ie;break t}ie=Fe(ie),re=Fe(re)}Fe=null}else Fe=null;de!==null&&cy(_e,ce,de,Fe,!1),Me!==null&&wt!==null&&cy(_e,wt,Me,Fe,!0)}}e:{if(ce=oe?Va(oe):window,de=ce.nodeName&&ce.nodeName.toLowerCase(),de==="select"||de==="input"&&ce.type==="file")var pt=Eg;else if(Cg(ce))if(jg)pt=ok;else{pt=ik;var Ie=sk}else de=ce.nodeName,!de||de.toLowerCase()!=="input"||ce.type!=="checkbox"&&ce.type!=="radio"?oe&&id(oe.elementType)&&(pt=Eg):pt=ak;if(pt&&(pt=pt(r,oe))){kg(_e,pt,d,pe);break e}Ie&&Ie(r,ce,oe),r==="focusout"&&oe&&ce.type==="number"&&oe.memoizedProps.value!=null&&sd(ce,"number",ce.value)}switch(Ie=oe?Va(oe):window,r){case"focusin":(Cg(Ie)||Ie.contentEditable==="true")&&($i=Ie,yd=oe,Za=null);break;case"focusout":Za=yd=$i=null;break;case"mousedown":vd=!0;break;case"contextmenu":case"mouseup":case"dragend":vd=!1,Mg(_e,d,pe);break;case"selectionchange":if(ck)break;case"keydown":case"keyup":Mg(_e,d,pe)}var et;if(pd)e:{switch(r){case"compositionstart":var ut="onCompositionStart";break e;case"compositionend":ut="onCompositionEnd";break e;case"compositionupdate":ut="onCompositionUpdate";break e}ut=void 0}else Hi?Sg(r,d)&&(ut="onCompositionEnd"):r==="keydown"&&d.keyCode===229&&(ut="onCompositionStart");ut&&(yg&&d.locale!=="ko"&&(Hi||ut!=="onCompositionStart"?ut==="onCompositionEnd"&&Hi&&(et=mg()):(hs=pe,ud="value"in hs?hs.value:hs.textContent,Hi=!0)),Ie=xc(oe,ut),0<Ie.length&&(ut=new xg(ut,r,null,d,pe),_e.push({event:ut,listeners:Ie}),et?ut.data=et:(et=wg(d),et!==null&&(ut.data=et)))),(et=ZC?ek(r,d):tk(r,d))&&(ut=xc(oe,"onBeforeInput"),0<ut.length&&(Ie=new xg("onBeforeInput","beforeinput",null,d,pe),_e.push({event:Ie,listeners:ut}),Ie.data=et)),Wk(_e,r,oe,d,pe)}oy(_e,i)})}function ko(r,i,d){return{instance:r,listener:i,currentTarget:d}}function xc(r,i){for(var d=i+"Capture",g=[];r!==null;){var C=r,E=C.stateNode;if(C=C.tag,C!==5&&C!==26&&C!==27||E===null||(C=Ga(r,d),C!=null&&g.unshift(ko(r,C,E)),C=Ga(r,i),C!=null&&g.push(ko(r,C,E))),r.tag===3)return g;r=r.return}return[]}function Xk(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5&&r.tag!==27);return r||null}function cy(r,i,d,g,C){for(var E=i._reactName,M=[];d!==null&&d!==g;){var q=d,te=q.alternate,oe=q.stateNode;if(q=q.tag,te!==null&&te===g)break;q!==5&&q!==26&&q!==27||oe===null||(te=oe,C?(oe=Ga(d,E),oe!=null&&M.unshift(ko(d,oe,te))):C||(oe=Ga(d,E),oe!=null&&M.push(ko(d,oe,te)))),d=d.return}M.length!==0&&r.push({event:i,listeners:M})}var Qk=/\r\n?/g,Jk=/\u0000|\uFFFD/g;function uy(r){return(typeof r=="string"?r:""+r).replace(Qk,`
50
+ `).replace(Jk,"")}function dy(r,i){return i=uy(i),uy(r)===i}function St(r,i,d,g,C,E){switch(d){case"children":typeof g=="string"?i==="body"||i==="textarea"&&g===""||Pi(r,g):(typeof g=="number"||typeof g=="bigint")&&i!=="body"&&Pi(r,""+g);break;case"className":bl(r,"class",g);break;case"tabIndex":bl(r,"tabindex",g);break;case"dir":case"role":case"viewBox":case"width":case"height":bl(r,d,g);break;case"style":dg(r,g,E);break;case"data":if(i!=="object"){bl(r,"data",g);break}case"src":case"href":if(g===""&&(i!=="a"||d!=="href")){r.removeAttribute(d);break}if(g==null||typeof g=="function"||typeof g=="symbol"||typeof g=="boolean"){r.removeAttribute(d);break}g=wl(""+g),r.setAttribute(d,g);break;case"action":case"formAction":if(typeof g=="function"){r.setAttribute(d,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof E=="function"&&(d==="formAction"?(i!=="input"&&St(r,i,"name",C.name,C,null),St(r,i,"formEncType",C.formEncType,C,null),St(r,i,"formMethod",C.formMethod,C,null),St(r,i,"formTarget",C.formTarget,C,null)):(St(r,i,"encType",C.encType,C,null),St(r,i,"method",C.method,C,null),St(r,i,"target",C.target,C,null)));if(g==null||typeof g=="symbol"||typeof g=="boolean"){r.removeAttribute(d);break}g=wl(""+g),r.setAttribute(d,g);break;case"onClick":g!=null&&(r.onclick=zr);break;case"onScroll":g!=null&&at("scroll",r);break;case"onScrollEnd":g!=null&&at("scrollend",r);break;case"dangerouslySetInnerHTML":if(g!=null){if(typeof g!="object"||!("__html"in g))throw Error(s(61));if(d=g.__html,d!=null){if(C.children!=null)throw Error(s(60));r.innerHTML=d}}break;case"multiple":r.multiple=g&&typeof g!="function"&&typeof g!="symbol";break;case"muted":r.muted=g&&typeof g!="function"&&typeof g!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(g==null||typeof g=="function"||typeof g=="boolean"||typeof g=="symbol"){r.removeAttribute("xlink:href");break}d=wl(""+g),r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",d);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":g!=null&&typeof g!="function"&&typeof g!="symbol"?r.setAttribute(d,""+g):r.removeAttribute(d);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":g&&typeof g!="function"&&typeof g!="symbol"?r.setAttribute(d,""):r.removeAttribute(d);break;case"capture":case"download":g===!0?r.setAttribute(d,""):g!==!1&&g!=null&&typeof g!="function"&&typeof g!="symbol"?r.setAttribute(d,g):r.removeAttribute(d);break;case"cols":case"rows":case"size":case"span":g!=null&&typeof g!="function"&&typeof g!="symbol"&&!isNaN(g)&&1<=g?r.setAttribute(d,g):r.removeAttribute(d);break;case"rowSpan":case"start":g==null||typeof g=="function"||typeof g=="symbol"||isNaN(g)?r.removeAttribute(d):r.setAttribute(d,g);break;case"popover":at("beforetoggle",r),at("toggle",r),vl(r,"popover",g);break;case"xlinkActuate":Br(r,"http://www.w3.org/1999/xlink","xlink:actuate",g);break;case"xlinkArcrole":Br(r,"http://www.w3.org/1999/xlink","xlink:arcrole",g);break;case"xlinkRole":Br(r,"http://www.w3.org/1999/xlink","xlink:role",g);break;case"xlinkShow":Br(r,"http://www.w3.org/1999/xlink","xlink:show",g);break;case"xlinkTitle":Br(r,"http://www.w3.org/1999/xlink","xlink:title",g);break;case"xlinkType":Br(r,"http://www.w3.org/1999/xlink","xlink:type",g);break;case"xmlBase":Br(r,"http://www.w3.org/XML/1998/namespace","xml:base",g);break;case"xmlLang":Br(r,"http://www.w3.org/XML/1998/namespace","xml:lang",g);break;case"xmlSpace":Br(r,"http://www.w3.org/XML/1998/namespace","xml:space",g);break;case"is":vl(r,"is",g);break;case"innerText":case"textContent":break;default:(!(2<d.length)||d[0]!=="o"&&d[0]!=="O"||d[1]!=="n"&&d[1]!=="N")&&(d=EC.get(d)||d,vl(r,d,g))}}function Gh(r,i,d,g,C,E){switch(d){case"style":dg(r,g,E);break;case"dangerouslySetInnerHTML":if(g!=null){if(typeof g!="object"||!("__html"in g))throw Error(s(61));if(d=g.__html,d!=null){if(C.children!=null)throw Error(s(60));r.innerHTML=d}}break;case"children":typeof g=="string"?Pi(r,g):(typeof g=="number"||typeof g=="bigint")&&Pi(r,""+g);break;case"onScroll":g!=null&&at("scroll",r);break;case"onScrollEnd":g!=null&&at("scrollend",r);break;case"onClick":g!=null&&(r.onclick=zr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!ng.hasOwnProperty(d))e:{if(d[0]==="o"&&d[1]==="n"&&(C=d.endsWith("Capture"),i=d.slice(2,C?d.length-7:void 0),E=r[An]||null,E=E!=null?E[d]:null,typeof E=="function"&&r.removeEventListener(i,E,C),typeof g=="function")){typeof E!="function"&&E!==null&&(d in r?r[d]=null:r.hasAttribute(d)&&r.removeAttribute(d)),r.addEventListener(i,g,C);break e}d in r?r[d]=g:g===!0?r.setAttribute(d,""):vl(r,d,g)}}}function yn(r,i,d){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":at("error",r),at("load",r);var g=!1,C=!1,E;for(E in d)if(d.hasOwnProperty(E)){var M=d[E];if(M!=null)switch(E){case"src":g=!0;break;case"srcSet":C=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,i));default:St(r,i,E,M,d,null)}}C&&St(r,i,"srcSet",d.srcSet,d,null),g&&St(r,i,"src",d.src,d,null);return;case"input":at("invalid",r);var q=E=M=C=null,te=null,oe=null;for(g in d)if(d.hasOwnProperty(g)){var pe=d[g];if(pe!=null)switch(g){case"name":C=pe;break;case"type":M=pe;break;case"checked":te=pe;break;case"defaultChecked":oe=pe;break;case"value":E=pe;break;case"defaultValue":q=pe;break;case"children":case"dangerouslySetInnerHTML":if(pe!=null)throw Error(s(137,i));break;default:St(r,i,g,pe,d,null)}}og(r,E,q,te,oe,M,C,!1);return;case"select":at("invalid",r),g=M=E=null;for(C in d)if(d.hasOwnProperty(C)&&(q=d[C],q!=null))switch(C){case"value":E=q;break;case"defaultValue":M=q;break;case"multiple":g=q;default:St(r,i,C,q,d,null)}i=E,d=M,r.multiple=!!g,i!=null?Ii(r,!!g,i,!1):d!=null&&Ii(r,!!g,d,!0);return;case"textarea":at("invalid",r),E=C=g=null;for(M in d)if(d.hasOwnProperty(M)&&(q=d[M],q!=null))switch(M){case"value":g=q;break;case"defaultValue":C=q;break;case"children":E=q;break;case"dangerouslySetInnerHTML":if(q!=null)throw Error(s(91));break;default:St(r,i,M,q,d,null)}cg(r,g,C,E);return;case"option":for(te in d)if(d.hasOwnProperty(te)&&(g=d[te],g!=null))switch(te){case"selected":r.selected=g&&typeof g!="function"&&typeof g!="symbol";break;default:St(r,i,te,g,d,null)}return;case"dialog":at("beforetoggle",r),at("toggle",r),at("cancel",r),at("close",r);break;case"iframe":case"object":at("load",r);break;case"video":case"audio":for(g=0;g<Co.length;g++)at(Co[g],r);break;case"image":at("error",r),at("load",r);break;case"details":at("toggle",r);break;case"embed":case"source":case"link":at("error",r),at("load",r);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(oe in d)if(d.hasOwnProperty(oe)&&(g=d[oe],g!=null))switch(oe){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,i));default:St(r,i,oe,g,d,null)}return;default:if(id(i)){for(pe in d)d.hasOwnProperty(pe)&&(g=d[pe],g!==void 0&&Gh(r,i,pe,g,d,void 0));return}}for(q in d)d.hasOwnProperty(q)&&(g=d[q],g!=null&&St(r,i,q,g,d,null))}function Zk(r,i,d,g){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var C=null,E=null,M=null,q=null,te=null,oe=null,pe=null;for(de in d){var _e=d[de];if(d.hasOwnProperty(de)&&_e!=null)switch(de){case"checked":break;case"value":break;case"defaultValue":te=_e;default:g.hasOwnProperty(de)||St(r,i,de,null,g,_e)}}for(var ce in g){var de=g[ce];if(_e=d[ce],g.hasOwnProperty(ce)&&(de!=null||_e!=null))switch(ce){case"type":E=de;break;case"name":C=de;break;case"checked":oe=de;break;case"defaultChecked":pe=de;break;case"value":M=de;break;case"defaultValue":q=de;break;case"children":case"dangerouslySetInnerHTML":if(de!=null)throw Error(s(137,i));break;default:de!==_e&&St(r,i,ce,de,g,_e)}}rd(r,M,q,te,oe,pe,E,C);return;case"select":de=M=q=ce=null;for(E in d)if(te=d[E],d.hasOwnProperty(E)&&te!=null)switch(E){case"value":break;case"multiple":de=te;default:g.hasOwnProperty(E)||St(r,i,E,null,g,te)}for(C in g)if(E=g[C],te=d[C],g.hasOwnProperty(C)&&(E!=null||te!=null))switch(C){case"value":ce=E;break;case"defaultValue":q=E;break;case"multiple":M=E;default:E!==te&&St(r,i,C,E,g,te)}i=q,d=M,g=de,ce!=null?Ii(r,!!d,ce,!1):!!g!=!!d&&(i!=null?Ii(r,!!d,i,!0):Ii(r,!!d,d?[]:"",!1));return;case"textarea":de=ce=null;for(q in d)if(C=d[q],d.hasOwnProperty(q)&&C!=null&&!g.hasOwnProperty(q))switch(q){case"value":break;case"children":break;default:St(r,i,q,null,g,C)}for(M in g)if(C=g[M],E=d[M],g.hasOwnProperty(M)&&(C!=null||E!=null))switch(M){case"value":ce=C;break;case"defaultValue":de=C;break;case"children":break;case"dangerouslySetInnerHTML":if(C!=null)throw Error(s(91));break;default:C!==E&&St(r,i,M,C,g,E)}lg(r,ce,de);return;case"option":for(var Me in d)if(ce=d[Me],d.hasOwnProperty(Me)&&ce!=null&&!g.hasOwnProperty(Me))switch(Me){case"selected":r.selected=!1;break;default:St(r,i,Me,null,g,ce)}for(te in g)if(ce=g[te],de=d[te],g.hasOwnProperty(te)&&ce!==de&&(ce!=null||de!=null))switch(te){case"selected":r.selected=ce&&typeof ce!="function"&&typeof ce!="symbol";break;default:St(r,i,te,ce,g,de)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Fe in d)ce=d[Fe],d.hasOwnProperty(Fe)&&ce!=null&&!g.hasOwnProperty(Fe)&&St(r,i,Fe,null,g,ce);for(oe in g)if(ce=g[oe],de=d[oe],g.hasOwnProperty(oe)&&ce!==de&&(ce!=null||de!=null))switch(oe){case"children":case"dangerouslySetInnerHTML":if(ce!=null)throw Error(s(137,i));break;default:St(r,i,oe,ce,g,de)}return;default:if(id(i)){for(var wt in d)ce=d[wt],d.hasOwnProperty(wt)&&ce!==void 0&&!g.hasOwnProperty(wt)&&Gh(r,i,wt,void 0,g,ce);for(pe in g)ce=g[pe],de=d[pe],!g.hasOwnProperty(pe)||ce===de||ce===void 0&&de===void 0||Gh(r,i,pe,ce,g,de);return}}for(var ie in d)ce=d[ie],d.hasOwnProperty(ie)&&ce!=null&&!g.hasOwnProperty(ie)&&St(r,i,ie,null,g,ce);for(_e in g)ce=g[_e],de=d[_e],!g.hasOwnProperty(_e)||ce===de||ce==null&&de==null||St(r,i,_e,ce,g,de)}function hy(r){switch(r){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function eE(){if(typeof performance.getEntriesByType=="function"){for(var r=0,i=0,d=performance.getEntriesByType("resource"),g=0;g<d.length;g++){var C=d[g],E=C.transferSize,M=C.initiatorType,q=C.duration;if(E&&q&&hy(M)){for(M=0,q=C.responseEnd,g+=1;g<d.length;g++){var te=d[g],oe=te.startTime;if(oe>q)break;var pe=te.transferSize,_e=te.initiatorType;pe&&hy(_e)&&(te=te.responseEnd,M+=pe*(te<q?1:(q-oe)/(te-oe)))}if(--g,i+=8*(E+M)/(C.duration/1e3),r++,10<r)break}}if(0<r)return i/r/1e6}return navigator.connection&&(r=navigator.connection.downlink,typeof r=="number")?r:5}var Wh=null,qh=null;function _c(r){return r.nodeType===9?r:r.ownerDocument}function fy(r){switch(r){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function my(r,i){if(r===0)switch(i){case"svg":return 1;case"math":return 2;default:return 0}return r===1&&i==="foreignObject"?0:r}function Kh(r,i){return r==="textarea"||r==="noscript"||typeof i.children=="string"||typeof i.children=="number"||typeof i.children=="bigint"||typeof i.dangerouslySetInnerHTML=="object"&&i.dangerouslySetInnerHTML!==null&&i.dangerouslySetInnerHTML.__html!=null}var Yh=null;function tE(){var r=window.event;return r&&r.type==="popstate"?r===Yh?!1:(Yh=r,!0):(Yh=null,!1)}var py=typeof setTimeout=="function"?setTimeout:void 0,nE=typeof clearTimeout=="function"?clearTimeout:void 0,gy=typeof Promise=="function"?Promise:void 0,rE=typeof queueMicrotask=="function"?queueMicrotask:typeof gy<"u"?function(r){return gy.resolve(null).then(r).catch(sE)}:py;function sE(r){setTimeout(function(){throw r})}function Ns(r){return r==="head"}function xy(r,i){var d=i,g=0;do{var C=d.nextSibling;if(r.removeChild(d),C&&C.nodeType===8)if(d=C.data,d==="/$"||d==="/&"){if(g===0){r.removeChild(C),ma(i);return}g--}else if(d==="$"||d==="$?"||d==="$~"||d==="$!"||d==="&")g++;else if(d==="html")Eo(r.ownerDocument.documentElement);else if(d==="head"){d=r.ownerDocument.head,Eo(d);for(var E=d.firstChild;E;){var M=E.nextSibling,q=E.nodeName;E[Fa]||q==="SCRIPT"||q==="STYLE"||q==="LINK"&&E.rel.toLowerCase()==="stylesheet"||d.removeChild(E),E=M}}else d==="body"&&Eo(r.ownerDocument.body);d=C}while(d);ma(i)}function _y(r,i){var d=r;r=0;do{var g=d.nextSibling;if(d.nodeType===1?i?(d._stashedDisplay=d.style.display,d.style.display="none"):(d.style.display=d._stashedDisplay||"",d.getAttribute("style")===""&&d.removeAttribute("style")):d.nodeType===3&&(i?(d._stashedText=d.nodeValue,d.nodeValue=""):d.nodeValue=d._stashedText||""),g&&g.nodeType===8)if(d=g.data,d==="/$"){if(r===0)break;r--}else d!=="$"&&d!=="$?"&&d!=="$~"&&d!=="$!"||r++;d=g}while(d)}function Xh(r){var i=r.firstChild;for(i&&i.nodeType===10&&(i=i.nextSibling);i;){var d=i;switch(i=i.nextSibling,d.nodeName){case"HTML":case"HEAD":case"BODY":Xh(d),td(d);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(d.rel.toLowerCase()==="stylesheet")continue}r.removeChild(d)}}function iE(r,i,d,g){for(;r.nodeType===1;){var C=d;if(r.nodeName.toLowerCase()!==i.toLowerCase()){if(!g&&(r.nodeName!=="INPUT"||r.type!=="hidden"))break}else if(g){if(!r[Fa])switch(i){case"meta":if(!r.hasAttribute("itemprop"))break;return r;case"link":if(E=r.getAttribute("rel"),E==="stylesheet"&&r.hasAttribute("data-precedence"))break;if(E!==C.rel||r.getAttribute("href")!==(C.href==null||C.href===""?null:C.href)||r.getAttribute("crossorigin")!==(C.crossOrigin==null?null:C.crossOrigin)||r.getAttribute("title")!==(C.title==null?null:C.title))break;return r;case"style":if(r.hasAttribute("data-precedence"))break;return r;case"script":if(E=r.getAttribute("src"),(E!==(C.src==null?null:C.src)||r.getAttribute("type")!==(C.type==null?null:C.type)||r.getAttribute("crossorigin")!==(C.crossOrigin==null?null:C.crossOrigin))&&E&&r.hasAttribute("async")&&!r.hasAttribute("itemprop"))break;return r;default:return r}}else if(i==="input"&&r.type==="hidden"){var E=C.name==null?null:""+C.name;if(C.type==="hidden"&&r.getAttribute("name")===E)return r}else return r;if(r=or(r.nextSibling),r===null)break}return null}function aE(r,i,d){if(i==="")return null;for(;r.nodeType!==3;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!d||(r=or(r.nextSibling),r===null))return null;return r}function yy(r,i){for(;r.nodeType!==8;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!i||(r=or(r.nextSibling),r===null))return null;return r}function Qh(r){return r.data==="$?"||r.data==="$~"}function Jh(r){return r.data==="$!"||r.data==="$?"&&r.ownerDocument.readyState!=="loading"}function oE(r,i){var d=r.ownerDocument;if(r.data==="$~")r._reactRetry=i;else if(r.data!=="$?"||d.readyState!=="loading")i();else{var g=function(){i(),d.removeEventListener("DOMContentLoaded",g)};d.addEventListener("DOMContentLoaded",g),r._reactRetry=g}}function or(r){for(;r!=null;r=r.nextSibling){var i=r.nodeType;if(i===1||i===3)break;if(i===8){if(i=r.data,i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"||i==="F!"||i==="F")break;if(i==="/$"||i==="/&")return null}}return r}var Zh=null;function vy(r){r=r.nextSibling;for(var i=0;r;){if(r.nodeType===8){var d=r.data;if(d==="/$"||d==="/&"){if(i===0)return or(r.nextSibling);i--}else d!=="$"&&d!=="$!"&&d!=="$?"&&d!=="$~"&&d!=="&"||i++}r=r.nextSibling}return null}function by(r){r=r.previousSibling;for(var i=0;r;){if(r.nodeType===8){var d=r.data;if(d==="$"||d==="$!"||d==="$?"||d==="$~"||d==="&"){if(i===0)return r;i--}else d!=="/$"&&d!=="/&"||i++}r=r.previousSibling}return null}function Sy(r,i,d){switch(i=_c(d),r){case"html":if(r=i.documentElement,!r)throw Error(s(452));return r;case"head":if(r=i.head,!r)throw Error(s(453));return r;case"body":if(r=i.body,!r)throw Error(s(454));return r;default:throw Error(s(451))}}function Eo(r){for(var i=r.attributes;i.length;)r.removeAttributeNode(i[0]);td(r)}var lr=new Map,wy=new Set;function yc(r){return typeof r.getRootNode=="function"?r.getRootNode():r.nodeType===9?r:r.ownerDocument}var ts=J.d;J.d={f:lE,r:cE,D:uE,C:dE,L:hE,m:fE,X:pE,S:mE,M:gE};function lE(){var r=ts.f(),i=uc();return r||i}function cE(r){var i=Ri(r);i!==null&&i.tag===5&&i.type==="form"?Hx(i):ts.r(r)}var da=typeof document>"u"?null:document;function Cy(r,i,d){var g=da;if(g&&typeof i=="string"&&i){var C=er(i);C='link[rel="'+r+'"][href="'+C+'"]',typeof d=="string"&&(C+='[crossorigin="'+d+'"]'),wy.has(C)||(wy.add(C),r={rel:r,crossOrigin:d,href:i},g.querySelector(C)===null&&(i=g.createElement("link"),yn(i,"link",r),un(i),g.head.appendChild(i)))}}function uE(r){ts.D(r),Cy("dns-prefetch",r,null)}function dE(r,i){ts.C(r,i),Cy("preconnect",r,i)}function hE(r,i,d){ts.L(r,i,d);var g=da;if(g&&r&&i){var C='link[rel="preload"][as="'+er(i)+'"]';i==="image"&&d&&d.imageSrcSet?(C+='[imagesrcset="'+er(d.imageSrcSet)+'"]',typeof d.imageSizes=="string"&&(C+='[imagesizes="'+er(d.imageSizes)+'"]')):C+='[href="'+er(r)+'"]';var E=C;switch(i){case"style":E=ha(r);break;case"script":E=fa(r)}lr.has(E)||(r=m({rel:"preload",href:i==="image"&&d&&d.imageSrcSet?void 0:r,as:i},d),lr.set(E,r),g.querySelector(C)!==null||i==="style"&&g.querySelector(jo(E))||i==="script"&&g.querySelector(To(E))||(i=g.createElement("link"),yn(i,"link",r),un(i),g.head.appendChild(i)))}}function fE(r,i){ts.m(r,i);var d=da;if(d&&r){var g=i&&typeof i.as=="string"?i.as:"script",C='link[rel="modulepreload"][as="'+er(g)+'"][href="'+er(r)+'"]',E=C;switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":E=fa(r)}if(!lr.has(E)&&(r=m({rel:"modulepreload",href:r},i),lr.set(E,r),d.querySelector(C)===null)){switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(d.querySelector(To(E)))return}g=d.createElement("link"),yn(g,"link",r),un(g),d.head.appendChild(g)}}}function mE(r,i,d){ts.S(r,i,d);var g=da;if(g&&r){var C=Oi(g).hoistableStyles,E=ha(r);i=i||"default";var M=C.get(E);if(!M){var q={loading:0,preload:null};if(M=g.querySelector(jo(E)))q.loading=5;else{r=m({rel:"stylesheet",href:r,"data-precedence":i},d),(d=lr.get(E))&&ef(r,d);var te=M=g.createElement("link");un(te),yn(te,"link",r),te._p=new Promise(function(oe,pe){te.onload=oe,te.onerror=pe}),te.addEventListener("load",function(){q.loading|=1}),te.addEventListener("error",function(){q.loading|=2}),q.loading|=4,vc(M,i,g)}M={type:"stylesheet",instance:M,count:1,state:q},C.set(E,M)}}}function pE(r,i){ts.X(r,i);var d=da;if(d&&r){var g=Oi(d).hoistableScripts,C=fa(r),E=g.get(C);E||(E=d.querySelector(To(C)),E||(r=m({src:r,async:!0},i),(i=lr.get(C))&&tf(r,i),E=d.createElement("script"),un(E),yn(E,"link",r),d.head.appendChild(E)),E={type:"script",instance:E,count:1,state:null},g.set(C,E))}}function gE(r,i){ts.M(r,i);var d=da;if(d&&r){var g=Oi(d).hoistableScripts,C=fa(r),E=g.get(C);E||(E=d.querySelector(To(C)),E||(r=m({src:r,async:!0,type:"module"},i),(i=lr.get(C))&&tf(r,i),E=d.createElement("script"),un(E),yn(E,"link",r),d.head.appendChild(E)),E={type:"script",instance:E,count:1,state:null},g.set(C,E))}}function ky(r,i,d,g){var C=(C=ne.current)?yc(C):null;if(!C)throw Error(s(446));switch(r){case"meta":case"title":return null;case"style":return typeof d.precedence=="string"&&typeof d.href=="string"?(i=ha(d.href),d=Oi(C).hoistableStyles,g=d.get(i),g||(g={type:"style",instance:null,count:0,state:null},d.set(i,g)),g):{type:"void",instance:null,count:0,state:null};case"link":if(d.rel==="stylesheet"&&typeof d.href=="string"&&typeof d.precedence=="string"){r=ha(d.href);var E=Oi(C).hoistableStyles,M=E.get(r);if(M||(C=C.ownerDocument||C,M={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},E.set(r,M),(E=C.querySelector(jo(r)))&&!E._p&&(M.instance=E,M.state.loading=5),lr.has(r)||(d={rel:"preload",as:"style",href:d.href,crossOrigin:d.crossOrigin,integrity:d.integrity,media:d.media,hrefLang:d.hrefLang,referrerPolicy:d.referrerPolicy},lr.set(r,d),E||xE(C,r,d,M.state))),i&&g===null)throw Error(s(528,""));return M}if(i&&g!==null)throw Error(s(529,""));return null;case"script":return i=d.async,d=d.src,typeof d=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=fa(d),d=Oi(C).hoistableScripts,g=d.get(i),g||(g={type:"script",instance:null,count:0,state:null},d.set(i,g)),g):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,r))}}function ha(r){return'href="'+er(r)+'"'}function jo(r){return'link[rel="stylesheet"]['+r+"]"}function Ey(r){return m({},r,{"data-precedence":r.precedence,precedence:null})}function xE(r,i,d,g){r.querySelector('link[rel="preload"][as="style"]['+i+"]")?g.loading=1:(i=r.createElement("link"),g.preload=i,i.addEventListener("load",function(){return g.loading|=1}),i.addEventListener("error",function(){return g.loading|=2}),yn(i,"link",d),un(i),r.head.appendChild(i))}function fa(r){return'[src="'+er(r)+'"]'}function To(r){return"script[async]"+r}function jy(r,i,d){if(i.count++,i.instance===null)switch(i.type){case"style":var g=r.querySelector('style[data-href~="'+er(d.href)+'"]');if(g)return i.instance=g,un(g),g;var C=m({},d,{"data-href":d.href,"data-precedence":d.precedence,href:null,precedence:null});return g=(r.ownerDocument||r).createElement("style"),un(g),yn(g,"style",C),vc(g,d.precedence,r),i.instance=g;case"stylesheet":C=ha(d.href);var E=r.querySelector(jo(C));if(E)return i.state.loading|=4,i.instance=E,un(E),E;g=Ey(d),(C=lr.get(C))&&ef(g,C),E=(r.ownerDocument||r).createElement("link"),un(E);var M=E;return M._p=new Promise(function(q,te){M.onload=q,M.onerror=te}),yn(E,"link",g),i.state.loading|=4,vc(E,d.precedence,r),i.instance=E;case"script":return E=fa(d.src),(C=r.querySelector(To(E)))?(i.instance=C,un(C),C):(g=d,(C=lr.get(E))&&(g=m({},d),tf(g,C)),r=r.ownerDocument||r,C=r.createElement("script"),un(C),yn(C,"link",g),r.head.appendChild(C),i.instance=C);case"void":return null;default:throw Error(s(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(g=i.instance,i.state.loading|=4,vc(g,d.precedence,r));return i.instance}function vc(r,i,d){for(var g=d.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),C=g.length?g[g.length-1]:null,E=C,M=0;M<g.length;M++){var q=g[M];if(q.dataset.precedence===i)E=q;else if(E!==C)break}E?E.parentNode.insertBefore(r,E.nextSibling):(i=d.nodeType===9?d.head:d,i.insertBefore(r,i.firstChild))}function ef(r,i){r.crossOrigin==null&&(r.crossOrigin=i.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=i.referrerPolicy),r.title==null&&(r.title=i.title)}function tf(r,i){r.crossOrigin==null&&(r.crossOrigin=i.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=i.referrerPolicy),r.integrity==null&&(r.integrity=i.integrity)}var bc=null;function Ty(r,i,d){if(bc===null){var g=new Map,C=bc=new Map;C.set(d,g)}else C=bc,g=C.get(d),g||(g=new Map,C.set(d,g));if(g.has(r))return g;for(g.set(r,null),d=d.getElementsByTagName(r),C=0;C<d.length;C++){var E=d[C];if(!(E[Fa]||E[pn]||r==="link"&&E.getAttribute("rel")==="stylesheet")&&E.namespaceURI!=="http://www.w3.org/2000/svg"){var M=E.getAttribute(i)||"";M=r+M;var q=g.get(M);q?q.push(E):g.set(M,[E])}}return g}function Ny(r,i,d){r=r.ownerDocument||r,r.head.insertBefore(d,i==="title"?r.querySelector("head > title"):null)}function _E(r,i,d){if(d===1||i.itemProp!=null)return!1;switch(r){case"meta":case"title":return!0;case"style":if(typeof i.precedence!="string"||typeof i.href!="string"||i.href==="")break;return!0;case"link":if(typeof i.rel!="string"||typeof i.href!="string"||i.href===""||i.onLoad||i.onError)break;switch(i.rel){case"stylesheet":return r=i.disabled,typeof i.precedence=="string"&&r==null;default:return!0}case"script":if(i.async&&typeof i.async!="function"&&typeof i.async!="symbol"&&!i.onLoad&&!i.onError&&i.src&&typeof i.src=="string")return!0}return!1}function Ay(r){return!(r.type==="stylesheet"&&(r.state.loading&3)===0)}function yE(r,i,d,g){if(d.type==="stylesheet"&&(typeof g.media!="string"||matchMedia(g.media).matches!==!1)&&(d.state.loading&4)===0){if(d.instance===null){var C=ha(g.href),E=i.querySelector(jo(C));if(E){i=E._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(r.count++,r=Sc.bind(r),i.then(r,r)),d.state.loading|=4,d.instance=E,un(E);return}E=i.ownerDocument||i,g=Ey(g),(C=lr.get(C))&&ef(g,C),E=E.createElement("link"),un(E);var M=E;M._p=new Promise(function(q,te){M.onload=q,M.onerror=te}),yn(E,"link",g),d.instance=E}r.stylesheets===null&&(r.stylesheets=new Map),r.stylesheets.set(d,i),(i=d.state.preload)&&(d.state.loading&3)===0&&(r.count++,d=Sc.bind(r),i.addEventListener("load",d),i.addEventListener("error",d))}}var nf=0;function vE(r,i){return r.stylesheets&&r.count===0&&Cc(r,r.stylesheets),0<r.count||0<r.imgCount?function(d){var g=setTimeout(function(){if(r.stylesheets&&Cc(r,r.stylesheets),r.unsuspend){var E=r.unsuspend;r.unsuspend=null,E()}},6e4+i);0<r.imgBytes&&nf===0&&(nf=62500*eE());var C=setTimeout(function(){if(r.waitingForImages=!1,r.count===0&&(r.stylesheets&&Cc(r,r.stylesheets),r.unsuspend)){var E=r.unsuspend;r.unsuspend=null,E()}},(r.imgBytes>nf?50:800)+i);return r.unsuspend=d,function(){r.unsuspend=null,clearTimeout(g),clearTimeout(C)}}:null}function Sc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Cc(this,this.stylesheets);else if(this.unsuspend){var r=this.unsuspend;this.unsuspend=null,r()}}}var wc=null;function Cc(r,i){r.stylesheets=null,r.unsuspend!==null&&(r.count++,wc=new Map,i.forEach(bE,r),wc=null,Sc.call(r))}function bE(r,i){if(!(i.state.loading&4)){var d=wc.get(r);if(d)var g=d.get(null);else{d=new Map,wc.set(r,d);for(var C=r.querySelectorAll("link[data-precedence],style[data-precedence]"),E=0;E<C.length;E++){var M=C[E];(M.nodeName==="LINK"||M.getAttribute("media")!=="not all")&&(d.set(M.dataset.precedence,M),g=M)}g&&d.set(null,g)}C=i.instance,M=C.getAttribute("data-precedence"),E=d.get(M)||g,E===g&&d.set(null,C),d.set(M,C),this.count++,g=Sc.bind(this),C.addEventListener("load",g),C.addEventListener("error",g),E?E.parentNode.insertBefore(C,E.nextSibling):(r=r.nodeType===9?r.head:r,r.insertBefore(C,r.firstChild)),i.state.loading|=4}}var No={$$typeof:S,Provider:null,Consumer:null,_currentValue:K,_currentValue2:K,_threadCount:0};function SE(r,i,d,g,C,E,M,q,te){this.tag=1,this.containerInfo=r,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=rn(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=rn(0),this.hiddenUpdates=rn(null),this.identifierPrefix=g,this.onUncaughtError=C,this.onCaughtError=E,this.onRecoverableError=M,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=te,this.incompleteTransitions=new Map}function Dy(r,i,d,g,C,E,M,q,te,oe,pe,_e){return r=new SE(r,i,d,M,te,oe,pe,_e,q),i=1,E===!0&&(i|=24),E=$n(3,null,null,i),r.current=E,E.stateNode=r,i=Md(),i.refCount++,r.pooledCache=i,i.refCount++,E.memoizedState={element:g,isDehydrated:d,cache:i},zd(E),r}function Ly(r){return r?(r=Vi,r):Vi}function Ry(r,i,d,g,C,E){C=Ly(C),g.context===null?g.context=C:g.pendingContext=C,g=_s(i),g.payload={element:d},E=E===void 0?null:E,E!==null&&(g.callback=E),d=ys(r,g,i),d!==null&&(In(d,r,i),ao(d,r,i))}function Oy(r,i){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var d=r.retryLane;r.retryLane=d!==0&&d<i?d:i}}function rf(r,i){Oy(r,i),(r=r.alternate)&&Oy(r,i)}function My(r){if(r.tag===13||r.tag===31){var i=Xs(r,67108864);i!==null&&In(i,r,67108864),rf(r,67108864)}}function Iy(r){if(r.tag===13||r.tag===31){var i=Wn();i=Ju(i);var d=Xs(r,i);d!==null&&In(d,r,i),rf(r,i)}}var kc=!0;function wE(r,i,d,g){var C=H.T;H.T=null;var E=J.p;try{J.p=2,sf(r,i,d,g)}finally{J.p=E,H.T=C}}function CE(r,i,d,g){var C=H.T;H.T=null;var E=J.p;try{J.p=8,sf(r,i,d,g)}finally{J.p=E,H.T=C}}function sf(r,i,d,g){if(kc){var C=af(g);if(C===null)Vh(r,i,g,Ec,d),By(r,g);else if(EE(C,r,i,d,g))g.stopPropagation();else if(By(r,g),i&4&&-1<kE.indexOf(r)){for(;C!==null;){var E=Ri(C);if(E!==null)switch(E.tag){case 3:if(E=E.stateNode,E.current.memoizedState.isDehydrated){var M=Je(E.pendingLanes);if(M!==0){var q=E;for(q.pendingLanes|=2,q.entangledLanes|=2;M;){var te=1<<31-Ke(M);q.entanglements[1]|=te,M&=~te}jr(E),(xt&6)===0&&(lc=ze()+500,wo(0))}}break;case 31:case 13:q=Xs(E,2),q!==null&&In(q,E,2),uc(),rf(E,2)}if(E=af(g),E===null&&Vh(r,i,g,Ec,d),E===C)break;C=E}C!==null&&g.stopPropagation()}else Vh(r,i,g,null,d)}}function af(r){return r=od(r),of(r)}var Ec=null;function of(r){if(Ec=null,r=Li(r),r!==null){var i=o(r);if(i===null)r=null;else{var d=i.tag;if(d===13){if(r=c(i),r!==null)return r;r=null}else if(d===31){if(r=l(i),r!==null)return r;r=null}else if(d===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;r=null}else i!==r&&(r=null)}}return Ec=r,null}function Py(r){switch(r){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(_t()){case ue:return 2;case we:return 8;case Le:case He:return 32;case Xe:return 268435456;default:return 32}default:return 32}}var lf=!1,As=null,Ds=null,Ls=null,Ao=new Map,Do=new Map,Rs=[],kE="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function By(r,i){switch(r){case"focusin":case"focusout":As=null;break;case"dragenter":case"dragleave":Ds=null;break;case"mouseover":case"mouseout":Ls=null;break;case"pointerover":case"pointerout":Ao.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":Do.delete(i.pointerId)}}function Lo(r,i,d,g,C,E){return r===null||r.nativeEvent!==E?(r={blockedOn:i,domEventName:d,eventSystemFlags:g,nativeEvent:E,targetContainers:[C]},i!==null&&(i=Ri(i),i!==null&&My(i)),r):(r.eventSystemFlags|=g,i=r.targetContainers,C!==null&&i.indexOf(C)===-1&&i.push(C),r)}function EE(r,i,d,g,C){switch(i){case"focusin":return As=Lo(As,r,i,d,g,C),!0;case"dragenter":return Ds=Lo(Ds,r,i,d,g,C),!0;case"mouseover":return Ls=Lo(Ls,r,i,d,g,C),!0;case"pointerover":var E=C.pointerId;return Ao.set(E,Lo(Ao.get(E)||null,r,i,d,g,C)),!0;case"gotpointercapture":return E=C.pointerId,Do.set(E,Lo(Do.get(E)||null,r,i,d,g,C)),!0}return!1}function zy(r){var i=Li(r.target);if(i!==null){var d=o(i);if(d!==null){if(i=d.tag,i===13){if(i=c(d),i!==null){r.blockedOn=i,Zp(r.priority,function(){Iy(d)});return}}else if(i===31){if(i=l(d),i!==null){r.blockedOn=i,Zp(r.priority,function(){Iy(d)});return}}else if(i===3&&d.stateNode.current.memoizedState.isDehydrated){r.blockedOn=d.tag===3?d.stateNode.containerInfo:null;return}}}r.blockedOn=null}function jc(r){if(r.blockedOn!==null)return!1;for(var i=r.targetContainers;0<i.length;){var d=af(r.nativeEvent);if(d===null){d=r.nativeEvent;var g=new d.constructor(d.type,d);ad=g,d.target.dispatchEvent(g),ad=null}else return i=Ri(d),i!==null&&My(i),r.blockedOn=d,!1;i.shift()}return!0}function Hy(r,i,d){jc(r)&&d.delete(i)}function jE(){lf=!1,As!==null&&jc(As)&&(As=null),Ds!==null&&jc(Ds)&&(Ds=null),Ls!==null&&jc(Ls)&&(Ls=null),Ao.forEach(Hy),Do.forEach(Hy)}function Tc(r,i){r.blockedOn===i&&(r.blockedOn=null,lf||(lf=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,jE)))}var Nc=null;function $y(r){Nc!==r&&(Nc=r,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Nc===r&&(Nc=null);for(var i=0;i<r.length;i+=3){var d=r[i],g=r[i+1],C=r[i+2];if(typeof g!="function"){if(of(g||d)===null)continue;break}var E=Ri(d);E!==null&&(r.splice(i,3),i-=3,ih(E,{pending:!0,data:C,method:d.method,action:g},g,C))}}))}function ma(r){function i(te){return Tc(te,r)}As!==null&&Tc(As,r),Ds!==null&&Tc(Ds,r),Ls!==null&&Tc(Ls,r),Ao.forEach(i),Do.forEach(i);for(var d=0;d<Rs.length;d++){var g=Rs[d];g.blockedOn===r&&(g.blockedOn=null)}for(;0<Rs.length&&(d=Rs[0],d.blockedOn===null);)zy(d),d.blockedOn===null&&Rs.shift();if(d=(r.ownerDocument||r).$$reactFormReplay,d!=null)for(g=0;g<d.length;g+=3){var C=d[g],E=d[g+1],M=C[An]||null;if(typeof E=="function")M||$y(d);else if(M){var q=null;if(E&&E.hasAttribute("formAction")){if(C=E,M=E[An]||null)q=M.formAction;else if(of(C)!==null)continue}else q=M.action;typeof q=="function"?d[g+1]=q:(d.splice(g,3),g-=3),$y(d)}}}function Uy(){function r(E){E.canIntercept&&E.info==="react-transition"&&E.intercept({handler:function(){return new Promise(function(M){return C=M})},focusReset:"manual",scroll:"manual"})}function i(){C!==null&&(C(),C=null),g||setTimeout(d,20)}function d(){if(!g&&!navigation.transition){var E=navigation.currentEntry;E&&E.url!=null&&navigation.navigate(E.url,{state:E.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var g=!1,C=null;return navigation.addEventListener("navigate",r),navigation.addEventListener("navigatesuccess",i),navigation.addEventListener("navigateerror",i),setTimeout(d,100),function(){g=!0,navigation.removeEventListener("navigate",r),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),C!==null&&(C(),C=null)}}}function cf(r){this._internalRoot=r}Ac.prototype.render=cf.prototype.render=function(r){var i=this._internalRoot;if(i===null)throw Error(s(409));var d=i.current,g=Wn();Ry(d,g,r,i,null,null)},Ac.prototype.unmount=cf.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var i=r.containerInfo;Ry(r.current,2,null,r,null,null),uc(),i[Di]=null}};function Ac(r){this._internalRoot=r}Ac.prototype.unstable_scheduleHydration=function(r){if(r){var i=Jp();r={blockedOn:null,target:r,priority:i};for(var d=0;d<Rs.length&&i!==0&&i<Rs[d].priority;d++);Rs.splice(d,0,r),d===0&&zy(r)}};var Fy=t.version;if(Fy!=="19.2.4")throw Error(s(527,Fy,"19.2.4"));J.findDOMNode=function(r){var i=r._reactInternals;if(i===void 0)throw typeof r.render=="function"?Error(s(188)):(r=Object.keys(r).join(","),Error(s(268,r)));return r=f(i),r=r!==null?p(r):null,r=r===null?null:r.stateNode,r};var TE={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:H,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Dc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Dc.isDisabled&&Dc.supportsFiber)try{he=Dc.inject(TE),Re=Dc}catch{}}return Oo.createRoot=function(r,i){if(!a(r))throw Error(s(299));var d=!1,g="",C=Xx,E=Qx,M=Jx;return i!=null&&(i.unstable_strictMode===!0&&(d=!0),i.identifierPrefix!==void 0&&(g=i.identifierPrefix),i.onUncaughtError!==void 0&&(C=i.onUncaughtError),i.onCaughtError!==void 0&&(E=i.onCaughtError),i.onRecoverableError!==void 0&&(M=i.onRecoverableError)),i=Dy(r,1,!1,null,null,d,g,null,C,E,M,Uy),r[Di]=i.current,Fh(r),new cf(i)},Oo.hydrateRoot=function(r,i,d){if(!a(r))throw Error(s(299));var g=!1,C="",E=Xx,M=Qx,q=Jx,te=null;return d!=null&&(d.unstable_strictMode===!0&&(g=!0),d.identifierPrefix!==void 0&&(C=d.identifierPrefix),d.onUncaughtError!==void 0&&(E=d.onUncaughtError),d.onCaughtError!==void 0&&(M=d.onCaughtError),d.onRecoverableError!==void 0&&(q=d.onRecoverableError),d.formState!==void 0&&(te=d.formState)),i=Dy(r,1,!0,i,d??null,g,C,te,E,M,q,Uy),i.context=Ly(null),d=i.current,g=Wn(),g=Ju(g),C=_s(g),C.callback=null,ys(d,C,g),d=g,i.current.lanes=d,Ai(i,d),jr(i),r[Di]=i.current,Fh(r),new Ac(i)},Oo.version="19.2.4",Oo}var tv;function FE(){if(tv)return mf.exports;tv=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),mf.exports=UE(),mf.exports}var VE=FE();const GE=bu(VE),nv=e=>{let t;const n=new Set,s=(f,p)=>{const m=typeof f=="function"?f(t):f;if(!Object.is(m,t)){const _=t;t=p??(typeof m!="object"||m===null)?m:Object.assign({},t,m),n.forEach(y=>y(t,_))}},a=()=>t,l={setState:s,getState:a,getInitialState:()=>h,subscribe:f=>(n.add(f),()=>n.delete(f))},h=t=e(s,a,l);return l},WE=(e=>e?nv(e):nv),qE=e=>e;function KE(e,t=qE){const n=Hs.useSyncExternalStore(e.subscribe,Hs.useCallback(()=>t(e.getState()),[e,t]),Hs.useCallback(()=>t(e.getInitialState()),[e,t]));return Hs.useDebugValue(n),n}const rv=e=>{const t=WE(e),n=s=>KE(t,s);return Object.assign(n,t),n},Jn=(e=>e?rv(e):rv);async function je(e,t={}){const n=localStorage.getItem("openfox_token"),s={...t.headers instanceof Headers?Object.fromEntries(t.headers.entries()):t.headers,...n?{"x-session-token":n}:{}};return fetch(e,{...t,headers:s})}async function YE(e,t){try{return(await je(`/api/sessions/${e}/truncate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({messageIndex:t})})).ok}catch{return!1}}const We={GLOBAL_INSTRUCTIONS:"global_instructions",NOTIFICATION_SETTINGS:"notification_settings",DISPLAY_SHOW_THINKING:"display.showThinking",DISPLAY_SHOW_VERBOSE_TOOL_OUTPUT:"display.showVerboseToolOutput",DISPLAY_SHOW_STATS:"display.showStats",DISPLAY_SHOW_AGENT_DEFINITIONS:"display.showAgentDefinitions",DISPLAY_SHOW_WORKFLOW_BARS:"display.showWorkflowBars",DISPLAY_SHOW_SYNTAX_HIGHLIGHTING:"display.showSyntaxHighlighting",DISPLAY_THEME:"display.theme",DISPLAY_USER_PRESETS:"display.userPresets",LLM_DISABLE_XML_PROTECTION:"llm.disableXmlProtection",KEYBINDINGS:"keybindings"};function Lc(e,t){return n=>({loading:{...n.loading,[e]:t}})}function sv(e,t){return n=>({settings:{...n.settings,[e]:t},loading:{...n.loading,[e]:!1}})}const P0=[We.DISPLAY_SHOW_THINKING,We.DISPLAY_SHOW_VERBOSE_TOOL_OUTPUT,We.DISPLAY_SHOW_STATS,We.DISPLAY_SHOW_AGENT_DEFINITIONS,We.DISPLAY_SHOW_WORKFLOW_BARS,We.DISPLAY_SHOW_SYNTAX_HIGHLIGHTING];function wu(){return{showThinking:tn(e=>e.settings[We.DISPLAY_SHOW_THINKING]??"true")==="true",showVerboseToolOutput:tn(e=>e.settings[We.DISPLAY_SHOW_VERBOSE_TOOL_OUTPUT]??"true")==="true",showStats:tn(e=>e.settings[We.DISPLAY_SHOW_STATS]??"true")==="true",showAgentDefinitions:tn(e=>e.settings[We.DISPLAY_SHOW_AGENT_DEFINITIONS]??"true")==="true",showWorkflowBars:tn(e=>e.settings[We.DISPLAY_SHOW_WORKFLOW_BARS]??"true")==="true",showSyntaxHighlighting:tn(e=>e.settings[We.DISPLAY_SHOW_SYNTAX_HIGHLIGHTING]??"true")==="true"}}const tn=Jn(e=>({settings:{},loading:{},getSetting:async t=>{e(Lc(t,!0));try{const s=await(await je(`/api/settings/${t}`)).json();return e(sv(t,s.value??"")),s.value}catch{return e(Lc(t,!1)),null}},getSettings:async t=>{if(t.length!==0)try{const s=await(await je(`/api/settings?keys=${encodeURIComponent(t.join(","))}`)).json();e({settings:s,loading:Object.fromEntries(t.map(a=>[a,!1]))})}catch{e({loading:Object.fromEntries(t.map(n=>[n,!1]))})}},setSetting:async(t,n)=>{e(Lc(t,!0));try{const a=await(await je(`/api/settings/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:n})})).json();e(sv(t,a.value??""))}catch{e(Lc(t,!1))}}})),iv=Object.freeze(Object.defineProperty({__proto__:null,DISPLAY_SETTINGS_KEYS:P0,SETTINGS_KEYS:We,useDisplaySettings:wu,useSettingsStore:tn},Symbol.toStringTag,{value:"Module"}));function XE(){const[e,t]=O.useState({offsetTop:0,height:window.innerHeight,keyboardVisible:!1}),n=O.useRef(window.innerHeight);return O.useEffect(()=>{const s=window.visualViewport;if(!s)return;const a=()=>{const o=s.offsetTop,c=s.height,l=n.current-c>100;t({offsetTop:o,height:c,keyboardVisible:l})};return a(),s.addEventListener("resize",a),s.addEventListener("scroll",a),()=>{s.removeEventListener("resize",a),s.removeEventListener("scroll",a)}},[]),e}function QE(e,t){if(e instanceof RegExp)return{keys:!1,pattern:e};var n,s,a,o,c=[],l="",h=e.split("/");for(h[0]||h.shift();a=h.shift();)n=a[0],n==="*"?(c.push(n),l+=a[1]==="?"?"(?:/(.*))?":"/(.*)"):n===":"?(s=a.indexOf("?",1),o=a.indexOf(".",1),c.push(a.substring(1,~s?s:~o?o:a.length)),l+=~s&&!~o?"(?:/([^/]+?))?":"/([^/]+?)",~o&&(l+=(~s?"?":"")+"\\"+a.substring(o))):l+="/"+a;return{keys:c,pattern:new RegExp("^"+l+(t?"(?=$|/)":"/?$"),"i")}}var _f={exports:{}},yf={};/**
51
+ * @license React
52
+ * use-sync-external-store-shim.production.js
53
+ *
54
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
55
+ *
56
+ * This source code is licensed under the MIT license found in the
57
+ * LICENSE file in the root directory of this source tree.
58
+ */var av;function JE(){if(av)return yf;av=1;var e=Su();function t(m,_){return m===_&&(m!==0||1/m===1/_)||m!==m&&_!==_}var n=typeof Object.is=="function"?Object.is:t,s=e.useState,a=e.useEffect,o=e.useLayoutEffect,c=e.useDebugValue;function l(m,_){var y=_(),w=s({inst:{value:y,getSnapshot:_}}),k=w[0].inst,v=w[1];return o(function(){k.value=y,k.getSnapshot=_,h(k)&&v({inst:k})},[m,y,_]),a(function(){return h(k)&&v({inst:k}),m(function(){h(k)&&v({inst:k})})},[m]),c(y),y}function h(m){var _=m.getSnapshot;m=m.value;try{var y=_();return!n(m,y)}catch{return!0}}function f(m,_){return _()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:l;return yf.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:p,yf}var ov;function ZE(){return ov||(ov=1,_f.exports=JE()),_f.exports}var e2=ZE();const t2=BE.useInsertionEffect,n2=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",r2=n2?O.useLayoutEffect:O.useEffect,s2=t2||r2,B0=e=>{const t=O.useRef([e,(...n)=>t[0](...n)]).current;return s2(()=>{t[0]=e}),t[1]},i2="popstate",Vm="pushState",Gm="replaceState",a2="hashchange",lv=[i2,Vm,Gm,a2],o2=e=>{for(const t of lv)addEventListener(t,e);return()=>{for(const t of lv)removeEventListener(t,e)}},z0=(e,t)=>e2.useSyncExternalStore(o2,e,t),cv=()=>location.search,l2=({ssrSearch:e}={})=>z0(cv,e!=null?()=>e:cv),uv=()=>location.pathname,c2=({ssrPath:e}={})=>z0(uv,e!=null?()=>e:uv),u2=(e,{replace:t=!1,state:n=null}={})=>history[t?Gm:Vm](n,"",e),d2=(e={})=>[c2(e),u2],dv=Symbol.for("wouter_v3");if(typeof history<"u"&&typeof window[dv]>"u"){for(const e of[Vm,Gm]){const t=history[e];history[e]=function(){const n=t.apply(this,arguments),s=new Event(e);return s.arguments=arguments,dispatchEvent(s),n}}Object.defineProperty(window,dv,{value:!0})}const h2=(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())?"~"+t:t.slice(e.length)||"/",H0=(e="")=>e==="/"?"":e,f2=(e,t)=>e[0]==="~"?e.slice(1):H0(t)+e,m2=(e="",t)=>h2(hv(H0(e)),hv(t)),hv=e=>{try{return decodeURI(e)}catch{return e}},$0={hook:d2,searchHook:l2,parser:QE,base:"",ssrPath:void 0,ssrSearch:void 0,ssrContext:void 0,hrefs:e=>e,aroundNav:(e,t,n)=>e(t,n)},U0=O.createContext($0),Ia=()=>O.useContext(U0),F0={},V0=O.createContext(F0),p2=()=>O.useContext(V0),Cu=e=>{const[t,n]=e.hook(e);return[m2(e.base,t),B0((s,a)=>e.aroundNav(n,f2(s,e.base),a))]},wr=()=>Cu(Ia()),Wm=(e,t,n,s)=>{const{pattern:a,keys:o}=t instanceof RegExp?{keys:!1,pattern:t}:e(t||"*",s),c=a.exec(n)||[],[l,...h]=c;return l!==void 0?[!0,(()=>{const f=o!==!1?Object.fromEntries(o.map((m,_)=>[m,h[_]])):c.groups;let p={...h};return f&&Object.assign(p,f),p})(),...s?[l]:[]]:[!1,null]},qm=e=>Wm(Ia().parser,e,wr()[0]),g2=({children:e,...t})=>{var p,m,_;const n=Ia(),s=t.hook?$0:n;let a=s;const[o,c=t.ssrSearch??""]=((p=t.ssrPath)==null?void 0:p.split("?"))??[];o&&(t.ssrSearch=c,t.ssrPath=o),t.hrefs=t.hrefs??((m=t.hook)==null?void 0:m.hrefs),t.searchHook=t.searchHook??((_=t.hook)==null?void 0:_.searchHook);let l=O.useRef({}),h=l.current,f=h;for(let y in s){const w=y==="base"?s[y]+(t[y]??""):t[y]??s[y];h===f&&w!==f[y]&&(l.current=f={...f}),f[y]=w,(w!==s[y]||w!==a[y])&&(a=f)}return O.createElement(U0.Provider,{value:a,children:e})},fv=({children:e,component:t},n)=>t?O.createElement(t,{params:n}):typeof e=="function"?e(n):e,x2=e=>{let t=O.useRef(F0);const n=t.current;return t.current=Object.keys(e).length!==Object.keys(n).length||Object.entries(e).some(([s,a])=>a!==n[s])?e:n},Mo=({path:e,nest:t,match:n,...s})=>{const a=Ia(),[o]=Cu(a),[c,l,h]=n??Wm(a.parser,e,o,t),f=x2({...p2(),...l});if(!c)return null;const p=h?O.createElement(g2,{base:h},fv(s,f)):fv(s,f);return O.createElement(V0.Provider,{value:f,children:p})},Xn=O.forwardRef((e,t)=>{const n=Ia(),[s,a]=Cu(n),{to:o="",href:c=o,onClick:l,asChild:h,children:f,className:p,replace:m,state:_,transition:y,...w}=e,k=B0(b=>{b.ctrlKey||b.metaKey||b.altKey||b.shiftKey||b.button!==0||(l==null||l(b),b.defaultPrevented||(b.preventDefault(),a(c,e)))}),v=n.hrefs(c[0]==="~"?c.slice(1):n.base+c,n);return h&&O.isValidElement(f)?O.cloneElement(f,{onClick:k,href:v}):O.createElement("a",{...w,onClick:k,href:v,className:p!=null&&p.call?p(s===c):p,children:f,ref:t})}),G0=e=>Array.isArray(e)?e.flatMap(t=>G0(t&&t.type===O.Fragment?t.props.children:t)):[e],_2=({children:e,location:t})=>{const n=Ia(),[s]=Cu(n);for(const a of G0(e)){let o=0;if(O.isValidElement(a)&&(o=Wm(n.parser,a.props.path,t||s,a.props.nest))[0])return O.cloneElement(a,{match:o})}return null};function y2(e){return typeof e=="object"&&e!==null&&"type"in e&&"payload"in e}function W0(){if(typeof crypto<"u"&&crypto.randomUUID)try{return crypto.randomUUID()}catch{}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}class v2{constructor(t){me(this,"ws",null);me(this,"handlers",new Set);me(this,"statusHandler",null);me(this,"baseUrl");me(this,"isReconnecting",!1);me(this,"connectingPromise",null);me(this,"lastCloseCode",0);me(this,"reconnectAttempts",0);me(this,"manualReconnectScheduled",!1);this.baseUrl=t}getUrl(){const t=localStorage.getItem("openfox_token");if(t){const n=this.baseUrl.includes("?")?"&":"?";return`${this.baseUrl}${n}token=${encodeURIComponent(t)}`}return this.baseUrl}setToken(t){localStorage.setItem("openfox_token",t)}clearToken(){localStorage.removeItem("openfox_token")}hasToken(){return!!localStorage.getItem("openfox_token")}getLastCloseCode(){return this.lastCloseCode}onStatusChange(t){this.statusHandler=t}connect(){var t,n,s;return((t=this.ws)==null?void 0:t.readyState)===WebSocket.OPEN?Promise.resolve():(this.lastCloseCode=0,this.isReconnecting=!1,this.connectingPromise&&((n=this.ws)==null?void 0:n.readyState)===WebSocket.CONNECTING?this.connectingPromise:(this.lastCloseCode=0,this.isReconnecting=!1,this.connectingPromise&&((s=this.ws)==null?void 0:s.readyState)===WebSocket.CONNECTING?(console.warn("[WS CLIENT] Connection already in progress, returning existing promise"),this.connectingPromise):(this.connectingPromise=new Promise((a,o)=>{try{const c=this.getUrl();this.ws=new WebSocket(c);const l=setTimeout(()=>{var h;((h=this.ws)==null?void 0:h.readyState)===WebSocket.CONNECTING&&(this.ws.close(),o(new Error("Connection timeout")))},5e3);this.ws.onopen=()=>{var h;clearTimeout(l),this.isReconnecting=!1,this.connectingPromise=null,(h=this.statusHandler)==null||h.call(this,"connected"),a()},this.ws.onclose=h=>{var f,p,m;clearTimeout(l),this.lastCloseCode=h.code,((f=this.ws)==null?void 0:f.readyState)===WebSocket.CONNECTING?(this.connectingPromise=null,(p=this.statusHandler)==null||p.call(this,"disconnected"),o(new Error(`Connection closed: ${h.code}`))):(this.connectingPromise=null,(m=this.statusHandler)==null||m.call(this,"disconnected"),this.attemptReconnect())},this.ws.onerror=h=>{clearTimeout(l),console.error("WebSocket error:",h),this.connectingPromise=null,o(h)},this.ws.onmessage=h=>{try{const f=JSON.parse(h.data);y2(f)&&this.handlers.forEach(p=>p(f))}catch(f){console.error("Failed to parse WebSocket message:",f)}}}catch(c){this.connectingPromise=null,o(c)}}),this.connectingPromise)))}attemptReconnect(){var a;if(([1e3,1005,1006,4e3].includes(this.lastCloseCode)||this.lastCloseCode===0)&&this.hasToken()){console.warn("[WS] Auth failure or initial failure with token - not auto-reconnecting, awaiting user action");return}if(this.isReconnecting||this.manualReconnectScheduled)return;this.isReconnecting=!0,(a=this.statusHandler)==null||a.call(this,"reconnecting");const s=Math.min(1e3*Math.pow(2,this.reconnectAttempts||0),3e4);this.reconnectAttempts=(this.reconnectAttempts||0)+1,setTimeout(()=>{this.isReconnecting=!1,this.manualReconnectScheduled=!1,this.connect().catch(()=>{})},s)}reconnect(){this.manualReconnectScheduled=!0,this.isReconnecting=!1,this.lastCloseCode=0,this.connectingPromise=null,this.connect().catch(()=>{})}disconnect(){this.isReconnecting=!1,this.reconnectAttempts=0,this.ws&&(this.ws.close(),this.ws=null)}resetReconnectAttempts(){this.reconnectAttempts=0}send(t,n){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)throw new Error("WebSocket not connected");const s=W0(),a={id:s,type:t,payload:n};return this.ws.send(JSON.stringify(a)),s}subscribe(t){return this.handlers.add(t),()=>this.handlers.delete(t)}get isConnected(){var t;return((t=this.ws)==null?void 0:t.readyState)===WebSocket.OPEN}}const b2=window.location.protocol==="https:"?"wss:":"ws:";let lm=window.location.port;lm||(lm=window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"?"10469":window.location.protocol==="https:"?"443":"80");const S2=`${b2}//${window.location.hostname}:${lm}/ws`,Qt=new v2(S2),Vs=async(e,t,n)=>{try{const s=await je(t,{method:e,headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});return s.ok?{success:!0}:{success:!1,error:(await s.json()).error}}catch{return{success:!1,error:"Network error"}}},ku=async(e,t,n)=>{try{const s=await je(e,{method:"POST",body:n?JSON.stringify({destination:n}):void 0,headers:n?{"Content-Type":"application/json"}:void 0}),a=await s.json();return s.ok?(await t(),{success:!0}):{success:!1,error:a.error??"Failed to duplicate"}}catch{return{success:!1,error:"Network error"}}};function q0(e){let t=null;function n(){t===null&&(t=requestAnimationFrame(()=>{t=null,e()}))}return n}let Rc=[];const Rr=Jn()((e,t)=>{function n(){if(Rc.length===0)return;const a=Rc;Rc=[],e(o=>({logs:[...o.logs,...a]}))}const s=q0(n);return{workdir:null,status:null,logs:[],config:null,loading:!1,setWorkdir:a=>{t().workdir!==a&&(e({workdir:a,status:null,logs:[],config:null,loading:!0}),a&&(t().fetchStatus(),t().fetchConfig()))},fetchStatus:async()=>{const a=t().workdir;if(a)try{const c=await(await je(`/api/dev-server?workdir=${encodeURIComponent(a)}`)).json();e({status:c,loading:!1})}catch{e({loading:!1})}},fetchConfig:async()=>{const a=t().workdir;if(a)try{const c=await(await je(`/api/dev-server/config?workdir=${encodeURIComponent(a)}`)).json();e({config:c.config??null})}catch{}},fetchLogs:async()=>{const a=t().workdir;if(a)try{const l=(await(await je(`/api/dev-server/logs?workdir=${encodeURIComponent(a)}`)).json()).logs.map(h=>({stream:h.stream,content:h.content}));e({logs:l})}catch{}},start:async()=>{const a=t().workdir;if(a)try{const c=await(await je(`/api/dev-server/start?workdir=${encodeURIComponent(a)}`,{method:"POST"})).json();e({status:c,logs:[]})}catch{}},stop:async()=>{const a=t().workdir;if(a)try{const c=await(await je(`/api/dev-server/stop?workdir=${encodeURIComponent(a)}`,{method:"POST"})).json();e({status:c})}catch{}},restart:async()=>{const a=t().workdir;if(a)try{const c=await(await je(`/api/dev-server/restart?workdir=${encodeURIComponent(a)}`,{method:"POST"})).json();e({status:c,logs:[]})}catch{}},saveConfig:async a=>{const o=t().workdir;if(o)try{const l=await(await je(`/api/dev-server/config?workdir=${encodeURIComponent(o)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})).json();e({config:l.config??a}),t().fetchStatus()}catch{}},handleMessage:a=>{const o=t().workdir;if(o)switch(a.type){case"devServer.output":{const c=a.payload;if(c.workdir!==o)return;Rc.push({stream:c.stream,content:c.content}),s();break}case"devServer.state":{const c=a.payload;if(c.workdir!==o)return;e(l=>({status:l.status?{...l.status,state:c.state,errorMessage:c.errorMessage}:l.status}));break}}}}});function w2(e){return{...e.temperature!=null&&{temperature:e.temperature},...e.topP!=null&&{topP:e.topP},...e.topK!=null&&{topK:e.topK},...e.maxTokens!=null&&{maxTokens:e.maxTokens}}}async function mv(e,t,n){const s=await je(`/api/providers/${e}/models/${encodeURIComponent(t)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!s.ok){const a=await s.json();throw new Error(a.error??"Failed to update model")}return s.json()}function pv(e,t,n,s){return e.map(a=>a.id===t?{...a,models:a.models.map(o=>o.id===n?{...o,...s,source:"user"}:o)}:a)}const C2=3e4;function k2(e){switch(e){case"vllm":return"vLLM";case"sglang":return"SGLang";case"ollama":return"Ollama";case"llamacpp":return"llama.cpp";case"openai":return"OpenAI";case"anthropic":return"Anthropic";case"opencode-go":return"OpenCode Go";case"auto":return"Auto";case"unknown":return""}}const Lt=Jn((e,t)=>({version:null,model:null,maxContext:2e5,llmUrl:null,llmStatus:"unknown",backend:"unknown",providers:[],activeProviderId:null,defaultModelSelection:null,loading:!1,activating:!1,error:null,autoRefreshInterval:null,fetchConfig:async()=>{e({loading:!0,error:null});try{const n=await je("/api/config");if(!n.ok)throw new Error("Failed to fetch config");const s=await n.json();e({version:s.version,model:s.model,maxContext:s.maxContext,llmUrl:s.llmUrl,llmStatus:s.llmStatus,backend:s.backend,providers:s.providers??[],activeProviderId:s.activeProviderId??null,defaultModelSelection:s.defaultModelSelection??null,loading:!1})}catch(n){e({error:n instanceof Error?n.message:"Unknown error",loading:!1})}},refreshModel:async()=>{try{const n=await je("/api/model/refresh",{method:"POST"});if(!n.ok)throw new Error("Failed to refresh model");const s=await n.json(),o=Ce.getState().currentSession;if(o!=null&&o.providerId&&o.providerModel){e({llmStatus:s.llmStatus,backend:s.backend});return}e({model:s.model,llmStatus:s.llmStatus,backend:s.backend})}catch(n){console.error("Failed to refresh model:",n)}},activateProvider:async n=>{const{activeProviderId:s,providers:a}=t();if(n===s)return!0;e({activating:!0,error:null});try{const o=await je(`/api/providers/${n}/activate`,{method:"POST"});if(!o.ok){const l=await o.json();throw new Error(l.error??"Failed to activate provider")}const c=await o.json();return e({activeProviderId:c.activeProviderId,model:c.model,backend:c.backend,providers:a.map(l=>({...l,isActive:l.id===c.activeProviderId})),activating:!1}),!0}catch(o){return e({error:o instanceof Error?o.message:"Failed to switch provider",activating:!1}),!1}},syncFromSession:(n,s)=>{var l;const{providers:a,defaultModelSelection:o}=t();let c=s;if(!c){const h=o?o.split("/"):[],f=h[0],p=h.slice(1).join("/")??"";if(f===n&&p)c=p;else{const m=a.find(_=>_.id===n);c=((l=m==null?void 0:m.models[0])==null?void 0:l.id)??""}}e({activeProviderId:n,model:c,defaultModelSelection:`${n}/${c}`,providers:a.map(h=>({...h,isActive:h.id===n}))})},updateModelContext:async(n,s,a)=>{e({activating:!0,error:null});try{const o=await mv(n,s,{contextWindow:a}),{providers:c}=t();return e({providers:pv(c,n,s,{contextWindow:a}),activating:!1}),o.contextState&&Ce.getState().updateContextState(o.contextState),!0}catch(o){return e({error:o instanceof Error?o.message:"Failed to update model context",activating:!1}),!1}},updateModelSettings:async(n,s,a)=>{e({activating:!0,error:null});try{const o=await mv(n,s,a),{providers:c}=t(),l={...a.contextWindow!==void 0&&{contextWindow:a.contextWindow},...w2({temperature:a.temperature??void 0,topP:a.topP??void 0,topK:a.topK??void 0,maxTokens:a.maxTokens??void 0}),...a.supportsVision!==void 0&&{supportsVision:a.supportsVision}};return e({providers:pv(c,n,s,l),activating:!1}),o.contextState&&Ce.getState().updateContextState(o.contextState),!0}catch(o){return e({error:o instanceof Error?o.message:"Failed to update model settings",activating:!1}),!1}},refreshProviderModels:async n=>{e({activating:!0,error:null});try{const s=await je(`/api/providers/${n}/refresh`,{method:"POST"});if(!s.ok){const c=await s.json();throw new Error(c.error??"Failed to refresh models")}const a=await s.json(),{providers:o}=t();return e({providers:o.map(c=>c.id===n?{...c,models:a.models,status:a.status}:c),activating:!1}),!0}catch(s){return e({error:s instanceof Error?s.message:"Failed to refresh models",activating:!1}),!1}},startAutoRefresh:()=>{const{autoRefreshInterval:n,refreshModel:s}=t();if(n)return;const a=setInterval(()=>{s()},C2);e({autoRefreshInterval:a})},stopAutoRefresh:()=>{const{autoRefreshInterval:n}=t();n&&(clearInterval(n),e({autoRefreshInterval:null}))},getActiveProvider:()=>{const{providers:n,activeProviderId:s}=t();return n.find(a=>a.id===s)},getModelContext:n=>{const{providers:s,activeProviderId:a}=t(),o=s.find(l=>l.id===a);if(!o)return 2e5;const c=o.models.find(l=>l.id===n);return(c==null?void 0:c.contextWindow)??2e5}})),zt=Jn((e,t)=>({projects:[],currentProject:null,loading:!1,listProjects:async()=>{e({loading:!0});try{const s=await(await je("/api/projects")).json();e({projects:s.projects??[],loading:!1})}catch(n){console.error("Failed to load projects:",n),e({loading:!1})}},createProject:async(n,s)=>{try{const a=await je("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:n,workdir:s})});if(!a.ok){const c=await a.json().catch(()=>({}));return{error:{code:c.code||"UNKNOWN",path:c.path,message:c.error}}}const o=await a.json();return await t().listProjects(),o.project}catch{return null}},loadProject:async n=>{try{const s=await je(`/api/projects/${n}`);if(!s.ok)return null;const a=await s.json();return e({currentProject:a.project}),t().projects.length===0&&await t().listProjects(),a.project}catch{return null}},updateProject:async(n,s)=>{var a;try{const o=await je(`/api/projects/${n}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!o.ok)return null;const c=await o.json();return((a=t().currentProject)==null?void 0:a.id)===n&&e({currentProject:c.project}),await t().listProjects(),c.project}catch{return null}},deleteProject:async n=>{var s;try{return(await je(`/api/projects/${n}`,{method:"DELETE"})).ok?(await t().listProjects(),((s=t().currentProject)==null?void 0:s.id)===n&&e({currentProject:null}),!0):!1}catch{return!1}},toggleStar:async(n,s)=>{var a;try{const o=await je(`/api/projects/${n}/star`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isStarred:s})});if(!o.ok)return!1;if(((a=t().currentProject)==null?void 0:a.id)===n){const c=await o.json();e({currentProject:c.project})}return await t().listProjects(),!0}catch{return!1}},clearProject:()=>{e({currentProject:null})}}));let Oc=[];const Yo=Jn()((e,t)=>{function n(){if(Oc.length===0)return;const a=Oc;Oc=[],e(o=>{const c={...o.logs};for(const l of a){const h=c[l.processId]??[];c[l.processId]=[...h,{offset:h.length,content:l.content,timestamp:Date.now(),stream:l.stream}]}return{logs:c}})}const s=q0(n);return{processes:[],logs:{},loading:!1,setProcesses:a=>e({processes:a}),addProcess:a=>e(o=>({processes:[...o.processes,a]})),updateProcess:(a,o)=>e(c=>({processes:c.processes.map(l=>l.id===a?{...l,...o}:l)})),removeProcess:a=>e(o=>({processes:o.processes.filter(c=>c.id!==a),logs:Object.fromEntries(Object.entries(o.logs).filter(([c])=>c!==a))})),stopProcess:async(a,o)=>{try{(await je(`/api/sessions/${o}/background-process/${a}/stop`,{method:"POST"})).ok&&t().removeProcess(a)}catch{}},appendLog:(a,o,c)=>{Oc.push({processId:a,stream:o,content:c}),s()},setLogs:(a,o)=>e(c=>({logs:{...c.logs,[a]:o}})),clearLogs:a=>e(o=>({logs:{...o.logs,[a]:[]}})),handleMessage:(a,o)=>{switch(a){case"backgroundProcess.started":{const{processId:c,name:l,pid:h,status:f}=o;e(p=>({processes:[...p.processes,{id:c,sessionId:"",name:l,command:"",cwd:"",pid:h,status:f,exitCode:null,createdAt:Date.now(),startedAt:Date.now(),endedAt:null}]}));break}case"backgroundProcess.output":{const c=o.processId,l=o.stream,h=o.content;t().appendLog(c,l,h);break}case"backgroundProcess.exited":{const c=o.processId,l=o.exitCode;e(h=>({processes:h.processes.map(f=>f.id===c?{...f,status:"exited",exitCode:l}:f)}));break}case"backgroundProcess.removed":{const c=o.processId;t().removeProcess(c);break}}}}}),E2=[{key:"complete",label:"Task Complete",description:"When an agent finishes its work"},{key:"waiting_for_user",label:"Waiting for Input",description:"When the agent needs your input"},{key:"phase_done",label:"Phase Done",description:"When a build phase completes successfully"},{key:"phase_blocked",label:"Phase Blocked",description:"When a build phase is blocked and needs intervention"},{key:"new_message",label:"New Message",description:"When a new assistant message starts arriving"}],j2=[{url:"/sounds/notification.mp3",label:"Notification"},{url:"/sounds/waiting-for-user.mp3",label:"Waiting for User"},{url:"/sounds/achievement.mp3",label:"Achievement"},{url:"/sounds/intervention.mp3",label:"Intervention"},{url:"/sounds/typing.mp3",label:"Typing"}],K0={complete:"/sounds/notification.mp3",waiting_for_user:"/sounds/waiting-for-user.mp3",phase_done:"/sounds/achievement.mp3",phase_blocked:"/sounds/intervention.mp3",new_message:"/sounds/typing.mp3"},$s={soundEnabled:!0,browserNotification:!1,customSoundUrl:null},Y0={soundEnabled:!1,browserNotification:!1,customSoundUrl:null},cm={soundEnabled:!0,browserNotificationEnabled:!1,events:{complete:{...$s},waiting_for_user:{...$s},phase_done:{...$s},phase_blocked:{...$s},new_message:{...Y0}},agentOverrides:{}};function X0(e,t,n){var o;const s=e.events[t];if(!n)return s;const a=(o=e.agentOverrides[n])==null?void 0:o[t];return a?{soundEnabled:a.soundEnabled??s.soundEnabled,browserNotification:a.browserNotification??s.browserNotification,customSoundUrl:a.customSoundUrl!==void 0?a.customSoundUrl:s.customSoundUrl}:s}const gi=Jn((e,t)=>({settings:cm,loaded:!1,load:()=>{tn.getState().getSetting(We.NOTIFICATION_SETTINGS);const s=tn.subscribe(o=>{const c=o.settings[We.NOTIFICATION_SETTINGS];if(c!==void 0)try{const l=JSON.parse(c);e({settings:gv(l),loaded:!0})}catch{e({loaded:!0})}}),a=tn.getState().settings[We.NOTIFICATION_SETTINGS];if(a)try{const o=JSON.parse(a);e({settings:gv(o),loaded:!0})}catch{e({loaded:!0})}return s},update:n=>{e({settings:n}),vf(n)},updateEvent:(n,s)=>{const a=t().settings,o={...a,events:{...a.events,[n]:{...a.events[n],...s}}};e({settings:o}),vf(o)},updateAgentOverride:(n,s,a)=>{var h;const o=t().settings,c={...o.agentOverrides};if(a===null){if(c[n]){const f={...c[n]};delete f[s],Object.keys(f).length===0?delete c[n]:c[n]=f}}else c[n]={...c[n],[s]:{...((h=c[n])==null?void 0:h[s])??{},...a}};const l={...o,agentOverrides:c};e({settings:l}),vf(l)}}));function vf(e){tn.getState().setSetting(We.NOTIFICATION_SETTINGS,JSON.stringify(e))}function gv(e){var t,n,s,a,o;return{soundEnabled:e.soundEnabled??cm.soundEnabled,browserNotificationEnabled:e.browserNotificationEnabled??cm.browserNotificationEnabled,events:{complete:{...$s,...(t=e.events)==null?void 0:t.complete},waiting_for_user:{...$s,...(n=e.events)==null?void 0:n.waiting_for_user},phase_done:{...$s,...(s=e.events)==null?void 0:s.phase_done},phase_blocked:{...$s,...(a=e.events)==null?void 0:a.phase_blocked},new_message:{...Y0,...(o=e.events)==null?void 0:o.new_message}},agentOverrides:e.agentOverrides??{}}}const xv=new Map;function T2(e){let t=xv.get(e);return t||(t=new Audio(e),t.volume=.5,xv.set(e,t)),t}let Q0=typeof Notification<"u"?Notification.permission:"denied";function N2(){return typeof Notification>"u"?Promise.resolve("denied"):Notification.requestPermission().then(e=>(Q0=e,e))}const A2={complete:"Task Complete",waiting_for_user:"Waiting for Input",phase_done:"Phase Complete",phase_blocked:"Phase Blocked",new_message:"New Message"},D2={complete:"The agent has finished its work.",waiting_for_user:"The agent needs your input to continue.",phase_done:"The build phase completed successfully.",phase_blocked:"The build phase is blocked and needs intervention.",new_message:"A new assistant message is arriving."};function L2(e){typeof Notification>"u"||Q0==="granted"&&(document.hasFocus()||new Notification(A2[e],{body:D2[e],icon:"/fox.svg",tag:`openfox-${e}`}))}function ul(e,t){const{settings:n}=gi.getState(),s=X0(n,e,t);if(n.soundEnabled&&s.soundEnabled){const a=s.customSoundUrl??K0[e],o=T2(a);o.currentTime=0,o.play().catch(()=>{})}n.browserNotificationEnabled&&s.browserNotification&&L2(e)}const R2=e=>ul("complete",e),O2=e=>ul("phase_done",e),M2=e=>ul("phase_blocked",e),_v=e=>ul("waiting_for_user",e),I2=e=>ul("new_message",e);let Io=!1,Tr=null;const bf=new Set,Sf=new Set,Mc=new Map,Xt={messageId:null,deltaContent:"",thinkingContent:"",toolOutput:[]};let ja=null,wn=null;function wf(){ja===null&&(ja=requestAnimationFrame(()=>{ja=null,wn==null||wn()}))}function ui(){ja!==null&&(cancelAnimationFrame(ja),ja=null)}function Ft(e,t){return t!==null&&e.sessionId===t}function P2(e,t,n){return e.id!==void 0||Ft(e,t)||n===!0&&e.sessionId!==void 0}function B2(e,t){return e.includes(t)?e:[...e,t]}function Po(e,t){return e.filter(n=>n!==t)}function z2(e,t){const n=e.find(o=>o.id===t.id),s=t.messageCount??t.messages.length,a=n?{...n,projectId:t.projectId,workdir:t.workdir,mode:t.mode,phase:t.phase,isRunning:t.isRunning&&n.isRunning!==!1,messageCount:s,criteriaCount:t.criteria.length,criteriaCompleted:t.criteria.filter(o=>o.status.type==="passed").length}:{id:t.id,projectId:t.projectId,workdir:t.workdir,mode:t.mode,phase:t.phase,isRunning:t.isRunning,createdAt:"",updatedAt:"",criteriaCount:t.criteria.length,criteriaCompleted:t.criteria.filter(o=>o.status.type==="passed").length,messageCount:s};return n?e.map(o=>o.id===t.id?a:o):[a,...e]}function yv(e,t,n){return e.map(s=>{const a=(n==null?void 0:n.id)===s.id?n:null,o=t.find(c=>c.id===s.id);return{...s,title:s.title??(o==null?void 0:o.title),mode:(a==null?void 0:a.mode)??(o==null?void 0:o.mode)??s.mode,phase:(a==null?void 0:a.phase)??(o==null?void 0:o.phase)??s.phase,isRunning:s.isRunning&&(o==null?void 0:o.isRunning)!==!1,messageCount:s.messageCount,recentUserPrompts:s.recentUserPrompts}})}const vv=new Map;function Wo(e,t){var o;const n=t===((o=e.currentSession)==null?void 0:o.id)?e.currentSession:null,s=e.sessions.find(c=>c.id===t),a=(n==null?void 0:n.mode)??(s==null?void 0:s.mode);return a==="planner"?"planner":a==="builder"?"build":"planner"}function H2(e,t){if(e.type==="chat.done"){const n=e.payload,s=Wo(t,e.sessionId),a=n.agentType??s;n.reason==="complete"&&R2(a),n.reason==="waiting_for_user"&&_v(a);return}if(e.type==="chat.path_confirmation"){const n=Wo(t,e.sessionId);_v(n);return}if(e.type==="task.completed"){const n=Wo(t,e.sessionId);O2(n);return}if(e.type==="phase.changed"&&e.sessionId){const n=e.payload,s=vv.get(e.sessionId)??null;if(vv.set(e.sessionId,n.phase),s===n.phase)return;const a=Wo(t,e.sessionId);n.phase==="blocked"&&M2(a)}}const Ce=Jn((e,t)=>(wn=()=>{const n=Xt;if(!n.messageId)return;const s=n.deltaContent.length>0,a=n.thinkingContent.length>0,o=n.toolOutput.length>0;if(!s&&!a&&!o)return;const c=n.deltaContent,l=n.thinkingContent,h=n.toolOutput;n.deltaContent="",n.thinkingContent="",n.toolOutput=[],e(f=>{var m;const p=f.streamingMessage;if(p&&p.id===n.messageId){const _={...p};if(s&&(_.content=_.content+c),a&&(_.thinkingContent=(_.thinkingContent??"")+l),o){const y=new Set;_.toolCalls=(m=_.toolCalls)==null?void 0:m.map(k=>{const v=h.filter(b=>b.callId===k.id);return v.length===0?k:(y.add(k.id),{...k,streamingOutput:[...k.streamingOutput??[],...v.map(b=>({stream:b.stream,content:b.content,timestamp:Date.now()}))]})});const w=h.filter(k=>!y.has(k.callId));w.length>0&&Xt.toolOutput.push(...w)}return{streamingMessage:_}}if(o){const _=new Set,y=f.messages.map(k=>{var b;if(k.id!==n.messageId)return k;const v=(b=k.toolCalls)==null?void 0:b.map(x=>{const S=h.filter(j=>j.callId===x.id);return S.length===0?x:(_.add(x.id),{...x,streamingOutput:[...x.streamingOutput??[],...S.map(j=>({stream:j.stream,content:j.content,timestamp:Date.now()}))]})});return{...k,toolCalls:v}}),w=h.filter(k=>!_.has(k.callId));return w.length>0&&Xt.toolOutput.push(...w),{messages:y}}return f})},{connectionStatus:"disconnected",showPasswordModal:!1,passwordModalRetry:!1,sessions:[],currentSession:null,unreadSessionIds:[],messages:[],streamingMessageId:null,streamingMessage:null,currentTodos:[],contextState:null,subAgentContextStates:{},pendingPathConfirmations:[],pendingQuestion:null,visionFallbackByMessage:{},gitStatus:null,queuedMessages:[],abortInProgress:!1,error:null,sessionsHasMore:!0,sessionsPaginationLoading:!1,pendingSessionCreate:!1,connect:async()=>{if(t().connectionStatus==="connected")return;e({connectionStatus:"reconnecting"});let s=!1;try{s=(await(await je("/api/auth")).json()).requiresAuth}catch{}if(s&&!Qt.hasToken()){e({showPasswordModal:!0,passwordModalRetry:!1,connectionStatus:"reconnecting"});return}Qt.onStatusChange(a=>{var o;if(e({connectionStatus:a}),a==="connected"){t().listSessions(void 0),zt.getState().listProjects();const c=(o=t().currentSession)==null?void 0:o.id;c&&t().loadSession(c)}});try{if(await Qt.connect(),!Io){Io=!0;const a=t().handleServerMessage;Tr=Qt.subscribe(a)}}catch(a){console.error("Failed to connect:",a);const o=Qt.getLastCloseCode();if(!Qt.hasToken()&&(o===1006||o===4e3)){e({showPasswordModal:!0,passwordModalRetry:!0,connectionStatus:"reconnecting"});return}Tr&&(Tr(),Tr=null),Io=!1,e({connectionStatus:"disconnected"})}},reconnect:()=>{Qt.disconnect(),Tr&&(Tr(),Tr=null),Io=!1,e({connectionStatus:"disconnected"}),t().connect()},disconnect:()=>{Qt.disconnect(),Tr&&(Tr(),Tr=null),Io=!1,e({connectionStatus:"disconnected",showPasswordModal:!1})},submitPassword:async n=>{try{const s=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:n})});if(!s.ok){e({showPasswordModal:!0,passwordModalRetry:!0,connectionStatus:"reconnecting"});return}const{token:a}=await s.json();Qt.setToken(a),e({showPasswordModal:!1}),t().connect();const{listProjects:o}=zt.getState(),{fetchConfig:c}=Lt.getState();o(),c(),t().connect()}catch{e({showPasswordModal:!0,passwordModalRetry:!0,connectionStatus:"reconnecting"})}},cancelPassword:()=>{Qt.clearToken(),e({showPasswordModal:!1,connectionStatus:"disconnected"})},createSession:async(n,s)=>{if(t().pendingSessionCreate)return null;try{e({pendingSessionCreate:!0});const o=await je("/api/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:n,title:s})});if(!o.ok)return e({pendingSessionCreate:!1}),null;const c=await o.json();return Qt.send("session.load",{sessionId:c.session.id}),c.session}catch{return e({pendingSessionCreate:!1}),null}},loadSession:async n=>{if(!Sf.has(n)){Sf.add(n);try{const s=t().currentSession;!s||s.id!==n?(ui(),e({currentSession:null,unreadSessionIds:Po(t().unreadSessionIds,n),subAgentContextStates:{},messages:[],streamingMessageId:null,streamingMessage:null,currentTodos:[],contextState:null,pendingPathConfirmations:[],queuedMessages:[],abortInProgress:!1,error:null,pendingSessionCreate:!1})):e({unreadSessionIds:Po(t().unreadSessionIds,n)});const a=await je(`/api/sessions/${n}`);if(!a.ok)return;const o=await a.json();e({currentSession:o.session,messages:o.messages??[],contextState:o.contextState,queuedMessages:o.queueState??[]}),Qt.send("session.load",{sessionId:n});try{const c=await je(`/api/sessions/${n}/background-processes`);if(c.ok){const l=await c.json();Yo.getState().setProcesses(l.processes??[])}}catch{}}catch{}finally{Sf.delete(n)}}},listSessions:async(n,s=20)=>{const a=n??"global";if(Mc.has(a))return console.warn("[STORE] listSessions skipped (already listing):",a),Mc.get(a);const o=(async()=>{try{const c=new URLSearchParams;c.set("limit",String(s)),n&&c.set("projectId",n);const h=await(await je(`/api/sessions?${c.toString()}`)).json(),f=h.sessions??[];e(p=>({sessions:yv(f,p.sessions,p.currentSession),sessionsHasMore:n?h.hasMore??!1:!0}))}catch{}finally{Mc.delete(a)}})();return Mc.set(a,o),o},loadMoreSessions:async n=>{const s=t();if(!(s.sessionsPaginationLoading||!s.sessionsHasMore)){e({sessionsPaginationLoading:!0});try{const a=new URLSearchParams;a.set("limit","20"),a.set("offset",String(s.sessions.length)),a.set("projectId",n);const c=await(await je(`/api/sessions?${a.toString()}`)).json(),l=c.sessions??[];e(h=>({sessions:[...h.sessions,...l.map(f=>{const p=h.sessions.find(m=>m.id===f.id);return(p==null?void 0:p.isRunning)===!1?{...f,isRunning:!1}:f})],sessionsHasMore:c.hasMore??!1,sessionsPaginationLoading:!1}))}catch{e({sessionsPaginationLoading:!1})}}},deleteSession:async n=>{var s;try{return(await je(`/api/sessions/${n}`,{method:"DELETE"})).ok?(await t().listSessions(),((s=t().currentSession)==null?void 0:s.id)===n&&t().clearSession(),!0):!1}catch{return!1}},renameSession:async(n,s)=>{var a;try{const o=await je(`/api/sessions/${n}/title`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:s})});if(!o.ok)return!1;if(await t().listSessions(),((a=t().currentSession)==null?void 0:a.id)===n){const l=await o.json();l.session&&e({currentSession:l.session})}return!0}catch{return!1}},deleteAllSessions:async n=>{try{return(await je(`/api/projects/${n}/sessions`,{method:"DELETE"})).ok?(await t().listSessions(),!0):!1}catch{return!1}},clearSession:()=>{ui(),e(n=>({currentSession:null,messages:[],streamingMessageId:null,streamingMessage:null,currentTodos:[],contextState:null,pendingSessionCreate:!1,unreadSessionIds:n.currentSession?Po(n.unreadSessionIds,n.currentSession.id):n.unreadSessionIds}))},sendMessage:async(n,s,a)=>{var c;const o=(c=t().currentSession)==null?void 0:c.id;if(o){e({streamingMessageId:null});try{const h=await(await je(`/api/sessions/${o}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:n,attachments:s,messageKind:a==null?void 0:a.messageKind})})).json();h.queueState&&e({queuedMessages:h.queueState})}catch(l){console.error("Error sending message:",l)}}},stopGeneration:async()=>{var s;const n=(s=t().currentSession)==null?void 0:s.id;if(n&&!t().abortInProgress){ui(),wn==null||wn(),e({abortInProgress:!0});try{await je(`/api/sessions/${n}/stop`,{method:"POST"})}catch(a){console.error("Error stopping generation:",a)}}},continueGeneration:async()=>{var s;const n=(s=t().currentSession)==null?void 0:s.id;if(n){e({streamingMessageId:null});try{await je(`/api/sessions/${n}/continue`,{method:"POST"})}catch(a){console.error("Error continuing generation:",a)}}},launchRunner:(n,s,a)=>{e({streamingMessageId:null});const o={};n!=null&&n.trim()&&(o.content=n),s&&s.length>0&&(o.attachments=s),a&&(o.workflowId=a),Qt.send("runner.launch",o)},switchMode:async n=>{var a;const s=(a=t().currentSession)==null?void 0:a.id;if(s)try{const o=await je(`/api/sessions/${s}/mode`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:n})});if(!o.ok){console.error("Failed to switch mode:",await o.json());return}const c=await o.json();c.session&&e({currentSession:c.session})}catch(o){console.error("Error switching mode:",o)}},switchDangerLevel:async n=>{var a;const s=(a=t().currentSession)==null?void 0:a.id;if(s)try{const o=await je(`/api/sessions/${s}/danger-level`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({dangerLevel:n})});if(!o.ok){console.error("Failed to switch danger level:",await o.json());return}const c=await o.json();c.session&&e({currentSession:c.session})}catch(o){console.error("Error switching danger level:",o)}},acceptAndBuild:(n,s,a)=>{var l;e({streamingMessageId:null});const o={};n&&(o.workflowId=n),s!=null&&s.trim()&&(o.content=s),a&&a.length>0&&(o.attachments=a);const c=(l=t().currentSession)==null?void 0:l.id;c&&je(`/api/sessions/${c}/mode`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:"builder"})}).then(()=>{Qt.send("runner.launch",o)})},editCriteria:async n=>{var a;const s=(a=t().currentSession)==null?void 0:a.id;if(s)try{const o=await je(`/api/sessions/${s}/criteria`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({criteria:n})});o.ok||console.error("Failed to update criteria:",await o.json())}catch(o){console.error("Error updating criteria:",o)}},compactContext:()=>{Qt.send("context.compact",{})},setSessionProvider:async(n,s)=>{var a,o;try{const c=(a=t().currentSession)==null?void 0:a.id;if(!c)return null;const l=await je(`/api/sessions/${c}/provider`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerId:n,...s?{model:s}:{}})});if(!l.ok)return null;const h=await l.json();if(e({currentSession:h.session,messages:h.messages??[],contextState:h.contextState}),(o=h.session)!=null&&o.providerId){const f=Lt.getState();f.providers.find(m=>m.id===h.session.providerId)&&f.syncFromSession(h.session.providerId,h.session.providerModel??"")}return h.session}catch{return null}},updateContextState:n=>{e({contextState:n})},updateSubAgentContextState:(n,s)=>{e(a=>({subAgentContextStates:{...a.subAgentContextStates,[n]:s}}))},clearSubAgentContextState:n=>{e(s=>{const a={...s.subAgentContextStates};return delete a[n],{subAgentContextStates:a}})},confirmPath:async(n,s,a=!1)=>{var c;const o=(c=t().currentSession)==null?void 0:c.id;if(o)try{await je(`/api/sessions/${o}/confirm-path`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({callId:n,approved:s,alwaysAllow:a})})}catch(l){console.error("Error confirming path:",l)}},answerQuestion:async(n,s)=>{var o;const a=(o=t().currentSession)==null?void 0:o.id;if(a){try{await je(`/api/sessions/${a}/answer`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({callId:n,answer:s})})}catch(c){console.error("Error answering question:",c)}e({pendingQuestion:null})}},queueAsap:async(n,s,a)=>{var c;const o=(c=t().currentSession)==null?void 0:c.id;if(o)try{const h=await(await je(`/api/sessions/${o}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:n,attachments:s,messageKind:a})})).json();h.queueState&&e({queuedMessages:h.queueState})}catch(l){console.error("Error queueing ASAP message:",l)}},queueCompletion:async(n,s,a)=>{var c;const o=(c=t().currentSession)==null?void 0:c.id;if(o)try{const h=await(await je(`/api/sessions/${o}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:n,attachments:s,messageKind:a})})).json();h.queueState&&e({queuedMessages:h.queueState})}catch(l){console.error("Error queueing completion message:",l)}},cancelQueued:async n=>{var a;const s=(a=t().currentSession)==null?void 0:a.id;if(s)try{const c=await(await je(`/api/sessions/${s}/queue/${n}`,{method:"DELETE"})).json();c.queueState&&e({queuedMessages:c.queueState})}catch(o){console.error("Error canceling queued message:",o)}},clearError:()=>{e({error:null})},resetPendingSessionCreate:()=>{e({pendingSessionCreate:!1})},handleServerMessage:n=>{var c,l,h,f,p,m,_,y,w,k,v,b,x,S,j,N,T,D,A,B,R,$,F,W,Y;const s=t();H2(n,s);const a=((c=s.currentSession)==null?void 0:c.id)??null,o=()=>{const P=n.sessionId;!P||P===a||e(H=>({unreadSessionIds:B2(H.unreadSessionIds,P)}))};switch(n.type){case"session.state":{const P=n.payload;if(!P2(n,a,s.pendingSessionCreate))break;ui();const H=P.messages.find(K=>K.isStreaming)??null,J=t().pendingSessionCreate===!0;if(e({currentSession:P.session,sessions:z2(t().sessions,P.session),unreadSessionIds:Po(t().unreadSessionIds,P.session.id),messages:P.messages,streamingMessageId:(H==null?void 0:H.id)??null,streamingMessage:H,currentTodos:[],pendingPathConfirmations:P.pendingConfirmations??[],error:null,...J?{pendingSessionCreate:P.session.id}:{}}),P.session.providerId){const K=Lt.getState();K.providers.find(L=>L.id===P.session.providerId)&&K.syncFromSession(P.session.providerId,P.session.providerModel??"")}break}case"session.list":{const P=n.payload;e(H=>({sessions:yv(P.sessions,H.sessions,H.currentSession)}));break}case"session.deleted":{const P=n.payload;e(H=>({unreadSessionIds:Po(H.unreadSessionIds,P.sessionId)})),t().listSessions();break}case"session.deletedAll":{t().listSessions();break}case"session.running":{const P=n.payload,H=n.sessionId,J=(l=t().currentSession)==null?void 0:l.id,K=H&&H!==J;e(I=>({sessions:I.sessions.map(L=>L.id===H?{...L,isRunning:P.isRunning}:L)})),K||e(I=>({currentSession:I.currentSession?{...I.currentSession,isRunning:P.isRunning}:null,...P.isRunning?{}:{abortInProgress:!1,queuedMessages:[]}}));break}case"chat.message":{if(!Ft(n,((h=t().currentSession)==null?void 0:h.id)??null)){o();break}const P=n.payload;e(H=>{var K;if(H.messages.some(I=>I.id===P.message.id))return H;const J=P.message.role==="user";return console.warn("[Message Count] chat.message received:",{messageId:P.message.id,role:P.message.role,isUserMessage:J,willCount:J,currentCount:(K=H.sessions.find(I=>I.id===n.sessionId))==null?void 0:K.messageCount}),{messages:[...H.messages,P.message],sessions:H.sessions.map(I=>I.id===n.sessionId&&J?{...I,messageCount:I.messageCount+1}:I),streamingMessageId:P.message.isStreaming?P.message.id:H.streamingMessageId,streamingMessage:P.message.isStreaming?P.message:H.streamingMessage}});break}case"chat.message_updated":{if(!Ft(n,((f=t().currentSession)==null?void 0:f.id)??null)){o();break}const P=n.payload,H=P.updates.isStreaming===!1&&t().streamingMessageId===P.messageId;H&&(ui(),wn==null||wn()),e(J=>{const K=J.streamingMessage,I=H;if(K&&K.id===P.messageId){const L={...K,...P.updates};return{messages:J.messages.map(z=>z.id===P.messageId?L:z),streamingMessageId:I?null:J.streamingMessageId,streamingMessage:I?null:{...K,...P.updates}}}return{messages:J.messages.map(L=>L.id===P.messageId?{...L,...P.updates}:L),streamingMessageId:I?null:J.streamingMessageId}});break}case"chat.delta":{if(!Ft(n,((p=t().currentSession)==null?void 0:p.id)??null)){o();break}const P=n.payload;if(!bf.has(P.messageId)){bf.add(P.messageId);const H=Wo(t(),n.sessionId);I2(H)}Xt.messageId=P.messageId,Xt.deltaContent+=P.content,wf();break}case"chat.thinking":{if(!Ft(n,((m=t().currentSession)==null?void 0:m.id)??null)){o();break}const P=n.payload;Xt.messageId=P.messageId,Xt.thinkingContent+=P.content,wf();break}case"chat.tool_preparing":{if(!Ft(n,((_=t().currentSession)==null?void 0:_.id)??null)){o();break}const P=n.payload,H=t().streamingMessage;if(!H||H.id!==P.messageId||((y=H.toolCalls)==null?void 0:y.find((K,I)=>I===P.index)))return;e(K=>{const I=K.streamingMessage.preparingToolCalls??[],L=I.findIndex(V=>V.index===P.index);let z;return L>=0?z=I.map((V,U)=>U===L?{...V,arguments:P.arguments}:V):z=[...I,{index:P.index,name:P.name,...P.arguments?{arguments:P.arguments}:{}}],{streamingMessage:{...K.streamingMessage,preparingToolCalls:z}}});break}case"chat.tool_call":{if(!Ft(n,((w=t().currentSession)==null?void 0:w.id)??null)){o();break}const P=n.payload,H=J=>{var L;const K=(L=J.preparingToolCalls)==null?void 0:L.filter((z,V)=>{var U;return z.name===P.tool?(U=J.preparingToolCalls)==null?void 0:U.slice(0,V).some(Z=>Z.name===P.tool):!0}),I=Xt.toolOutput.filter(z=>z.callId===P.callId);return I.length>0&&(Xt.toolOutput=Xt.toolOutput.filter(z=>z.callId!==P.callId)),{...J,toolCalls:[...J.toolCalls??[],{id:P.callId,name:P.tool,arguments:P.args,startedAt:Date.now(),...I.length>0?{streamingOutput:I.map(z=>({stream:z.stream,content:z.content,timestamp:Date.now()}))}:{}}],...K&&K.length>0?{preparingToolCalls:K}:{preparingToolCalls:void 0}}};e(J=>{const K=J.streamingMessage;return K&&K.id===P.messageId?{streamingMessage:H(K)}:{messages:J.messages.map(I=>I.id===P.messageId?H(I):I)}});break}case"chat.tool_output":{if(!Ft(n,((k=t().currentSession)==null?void 0:k.id)??null)){o();break}const P=n.payload;Xt.messageId=P.messageId,Xt.toolOutput.push({messageId:P.messageId,callId:P.callId,stream:P.stream,content:P.output}),wf();break}case"chat.tool_result":{if(!Ft(n,((v=t().currentSession)==null?void 0:v.id)??null)){o();break}const P=n.payload,H=J=>{var I;const K=(I=J.toolCalls)==null?void 0:I.map(L=>L.id===P.callId?{...L,result:P.result}:L);return{...J,toolCalls:K}};e(J=>{const K=J.streamingMessage;return K&&K.id===P.messageId?{streamingMessage:H(K)}:{messages:J.messages.map(I=>I.id===P.messageId?H(I):I)}});break}case"chat.vision_fallback":{if(!Ft(n,((b=t().currentSession)==null?void 0:b.id)??null)){o();break}const P=n.payload;e(H=>{const J=`${P.messageId}-${P.attachmentId}`,K={...H.visionFallbackByMessage};return K[J]={type:P.type,attachmentId:P.attachmentId,filename:P.filename,description:P.description},{visionFallbackByMessage:K}});break}case"chat.todo":{if(!Ft(n,((x=t().currentSession)==null?void 0:x.id)??null)){o();break}const P=n.payload;e({currentTodos:P.todos});break}case"chat.summary":{if(!Ft(n,((S=t().currentSession)==null?void 0:S.id)??null)){o();break}const P=n.payload;e(H=>({currentSession:H.currentSession?{...H.currentSession,summary:P.summary}:null}));break}case"chat.progress":{if(!Ft(n,((j=t().currentSession)==null?void 0:j.id)??null)){o();break}const P=n.payload;console.warn("Progress:",P.message,P.phase);break}case"chat.format_retry":{if(!Ft(n,((N=t().currentSession)==null?void 0:N.id)??null)){o();break}const P=n.payload;console.warn("Format retry:",P.attempt,"/",P.maxAttempts);break}case"chat.done":{if(!Ft(n,((T=t().currentSession)==null?void 0:T.id)??null)){o();break}ui(),wn==null||wn();const P=n.payload,H=P.stats;Xt.messageId=null,Xt.deltaContent="",Xt.thinkingContent="",Xt.toolOutput=[],bf.delete(P.messageId),e(J=>{const K=J.streamingMessage,I=K&&K.id===P.messageId?{...K,isStreaming:!1,stats:H??K.stats}:null;return{messages:J.messages.map(L=>L.id===P.messageId?I??{...L,isStreaming:!1,stats:H??L.stats,completeReason:P.reason}:L),streamingMessageId:null,streamingMessage:null,visionFallbackByMessage:{}}});break}case"chat.error":{if(!Ft(n,((D=t().currentSession)==null?void 0:D.id)??null)){o();break}ui(),wn==null||wn();const P=n.payload;console.error("Chat error:",P.error,"recoverable:",P.recoverable),P.recoverable||(Xt.messageId=null,Xt.deltaContent="",Xt.thinkingContent="",Xt.toolOutput=[]),e(H=>({error:{code:"CHAT_ERROR",message:P.error},streamingMessageId:P.recoverable?H.streamingMessageId:null,...P.recoverable?{}:{messages:H.streamingMessage?H.messages.map(J=>J.id===H.streamingMessage.id?H.streamingMessage:J):H.messages,streamingMessage:null}}));break}case"chat.path_confirmation":{if(!Ft(n,((A=t().currentSession)==null?void 0:A.id)??null)){o();break}const P=n.payload,H={callId:P.callId,tool:P.tool,paths:P.paths,workdir:P.workdir,reason:P.reason};e(J=>({pendingPathConfirmations:[...J.pendingPathConfirmations,H]}));break}case"chat.ask_user":{if(!Ft(n,((B=t().currentSession)==null?void 0:B.id)??null)){o();return}const P=n.payload;e({pendingQuestion:{callId:P.callId,question:P.question}});break}case"mode.changed":{if(!Ft(n,((R=t().currentSession)==null?void 0:R.id)??null)){o();break}const P=n.payload;e(H=>({currentSession:H.currentSession?{...H.currentSession,mode:P.mode}:null}));break}case"phase.changed":{const P=n.payload,H=n.sessionId,J=($=t().currentSession)==null?void 0:$.id,K=H&&H!==J;e(I=>({sessions:I.sessions.map(L=>L.id===H?{...L,phase:P.phase}:L)})),K||e(I=>({currentSession:I.currentSession?{...I.currentSession,phase:P.phase}:null}));break}case"criteria.updated":{if(!Ft(n,((F=t().currentSession)==null?void 0:F.id)??null)){o();break}const P=n.payload;e(H=>({currentSession:H.currentSession?{...H.currentSession,criteria:P.criteria}:null}));break}case"context.state":{const P=n.payload,H=Ft(n,((W=t().currentSession)==null?void 0:W.id)??null);P.subAgentId?H&&t().updateSubAgentContextState(P.subAgentId,P.context):H?e({contextState:P.context}):o();break}case"session.name_generated":{const P=n.payload,H=n.sessionId,J=(Y=t().currentSession)==null?void 0:Y.id;e(K=>{const I=K.sessions.map(z=>z.id===H?{...z,title:P.name,updatedAt:new Date().toISOString()}:z),L=J===H?K.currentSession?{...K.currentSession,title:P.name,updatedAt:new Date().toISOString()}:null:K.currentSession;return{sessions:I,currentSession:L}});break}case"queue.state":{const P=n.payload;e({queuedMessages:P.messages??[]});break}case"git.status":{const P=n.payload;e({gitStatus:{branch:P.branch,diff:P.diff}});break}case"devServer.output":case"devServer.state":{Rr.getState().handleMessage(n);break}case"backgroundProcess.started":case"backgroundProcess.output":case"backgroundProcess.exited":case"backgroundProcess.removed":{Yo.getState().handleMessage(n.type,n.payload);break}case"error":{const P=n.payload;console.error("Server error:",P),e({error:{code:P.code,message:P.message},streamingMessageId:null});break}}}}));function Km(){return Ce(e=>{var t;return((t=e.currentSession)==null?void 0:t.isRunning)??!1})}function $2(){return Ce(e=>e.queuedMessages)}function U2(){return Ce(e=>e.abortInProgress)}function F2(){const e=Ce(s=>s.connect),t=Ce(s=>s.connectionStatus),n=gi(s=>s.load);return O.useEffect(()=>{e()},[e]),O.useEffect(()=>{t==="connected"&&n()},[t,n]),{connectionStatus:t}}const V2="modulepreload",G2=function(e){return"/"+e},bv={},Q=function(t,n,s){let a=Promise.resolve();if(n&&n.length>0){let c=function(f){return Promise.all(f.map(p=>Promise.resolve(p).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),h=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));a=c(n.map(f=>{if(f=G2(f),f in bv)return;bv[f]=!0;const p=f.endsWith(".css"),m=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${m}`))return;const _=document.createElement("link");if(_.rel=p?"stylesheet":V2,p||(_.as="script"),_.crossOrigin="",_.href=f,h&&_.setAttribute("nonce",h),document.head.appendChild(_),p)return new Promise((y,w)=>{_.addEventListener("load",y),_.addEventListener("error",()=>w(new Error(`Unable to preload CSS for ${f}`)))})}))}function o(c){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=c,window.dispatchEvent(l),!l.defaultPrevented)throw c}return a.then(c=>{for(const l of c||[])l.status==="rejected"&&o(l.reason);return t().catch(o)})},J0=[{key:"color-bg-primary",category:"background",label:"Primary Background",defaultValue:"13 17 23"},{key:"color-bg-secondary",category:"background",label:"Secondary Background",defaultValue:"22 27 34"},{key:"color-bg-tertiary",category:"background",label:"Tertiary Background",defaultValue:"33 38 45"},{key:"color-primary",category:"surface",label:"Primary Surface",defaultValue:"10 10 10"},{key:"color-secondary",category:"surface",label:"Secondary Surface",defaultValue:"20 20 20"},{key:"color-text-primary",category:"text",label:"Primary Text",defaultValue:"139 148 158"},{key:"color-text-secondary",category:"text",label:"Secondary Text",defaultValue:"139 148 158"},{key:"color-text-muted",category:"text",label:"Muted Text",defaultValue:"72 79 88"},{key:"color-accent-primary",category:"accent",label:"Primary Accent",defaultValue:"88 166 255"},{key:"color-accent-success",category:"accent",label:"Success Accent",defaultValue:"63 185 80"},{key:"color-accent-warning",category:"accent",label:"Warning Accent",defaultValue:"210 153 34"},{key:"color-accent-error",category:"accent",label:"Error Accent",defaultValue:"248 81 73"},{key:"color-border",category:"border",label:"Border",defaultValue:"48 53 60"}],Or=[{id:"dark",name:"Dark",tokens:{"color-bg-primary":"13 17 23","color-bg-secondary":"22 27 34","color-bg-tertiary":"33 38 45","color-primary":"10 10 10","color-secondary":"20 20 20","color-text-primary":"255 255 255","color-text-secondary":"139 148 158","color-text-muted":"72 79 88","color-accent-primary":"88 166 255","color-accent-success":"63 185 80","color-accent-warning":"210 153 34","color-accent-error":"248 81 73","color-border":"48 53 60"}},{id:"light",name:"Light",tokens:{"color-bg-primary":"255 255 255","color-bg-secondary":"250 251 252","color-bg-tertiary":"243 244 246","color-primary":"245 245 245","color-secondary":"229 229 229","color-text-primary":"15 23 42","color-text-secondary":"30 41 59","color-text-muted":"100 116 139","color-accent-primary":"37 99 235","color-accent-success":"22 163 74","color-accent-warning":"217 119 6","color-accent-error":"220 38 38","color-border":"203 213 225"}},{id:"monokai",name:"Monokai",tokens:{"color-bg-primary":"39 40 34","color-bg-secondary":"30 31 28","color-bg-tertiary":"62 61 50","color-primary":"30 31 28","color-secondary":"45 46 39","color-text-primary":"248 248 242","color-text-secondary":"207 207 194","color-text-muted":"117 113 94","color-accent-primary":"102 217 239","color-accent-success":"166 226 46","color-accent-warning":"230 219 116","color-accent-error":"249 38 114","color-border":"73 72 62"}},{id:"dracula",name:"Dracula",tokens:{"color-bg-primary":"40 42 54","color-bg-secondary":"33 34 44","color-bg-tertiary":"68 71 90","color-primary":"30 31 41","color-secondary":"44 46 61","color-text-primary":"248 248 242","color-text-secondary":"230 230 230","color-text-muted":"98 114 164","color-accent-primary":"189 147 249","color-accent-success":"80 250 123","color-accent-warning":"255 184 108","color-accent-error":"255 85 85","color-border":"68 71 90"}},{id:"nord",name:"Nord",tokens:{"color-bg-primary":"46 52 64","color-bg-secondary":"59 66 82","color-bg-tertiary":"67 76 94","color-primary":"46 52 64","color-secondary":"59 66 82","color-text-primary":"236 239 244","color-text-secondary":"229 233 240","color-text-muted":"76 86 106","color-accent-primary":"129 161 193","color-accent-success":"163 190 140","color-accent-warning":"235 203 139","color-accent-error":"191 97 106","color-border":"76 86 106"}}];function Sv(){try{const e=localStorage.getItem("openfox:userPresets");if(e)return JSON.parse(e)}catch{}return[]}const Jt=Jn((e,t)=>({currentPreset:"dark",basePreset:"",customTokens:{},isCustom:!1,isCustomizing:!1,userPresets:Sv(),applySavedTheme:()=>{const{getSavedTheme:n,applyPreset:s,applyTokens:a}=t(),o=n();if(o)try{const c=JSON.parse(o);c.preset&&c.tokens?(s(c.preset),e({basePreset:c.preset}),a(c.tokens)):c.preset?s(c.preset):c.tokens&&a(c.tokens)}catch{s("dark")}else s("dark")},applyPreset:n=>{Or.find(a=>a.id===n)&&(e({currentPreset:n,basePreset:"",customTokens:{},isCustom:!1,isCustomizing:!1}),t().applyTheme())},startCustomizing:()=>{var a;const{currentPreset:n}=t(),s=((a=Or.find(o=>o.id===n))==null?void 0:a.tokens)??{};e({basePreset:n,customTokens:{...s},isCustom:!0,isCustomizing:!0})},setCustomToken:(n,s)=>{e(a=>({customTokens:{...a.customTokens,[n]:s}})),t().applyTheme()},cancelCustomizing:()=>{t().applyPreset(t().basePreset||t().currentPreset)},saveCustomTheme:()=>{const{customTokens:n}=t();t().saveTheme(JSON.stringify({tokens:n})).catch(()=>{}),e({isCustomizing:!1})},applyTokens:n=>{e({customTokens:n,isCustom:!0,isCustomizing:!1}),t().applyTheme()},getActiveTheme:()=>{var c,l;const{basePreset:n,customTokens:s,isCustom:a}=t();if(a&&n)return{...((c=Or.find(f=>f.id===n))==null?void 0:c.tokens)??{},...s};if(a)return{...J0.reduce((h,f)=>({...h,[f.key]:f.defaultValue}),{}),...s};const o=Or.find(h=>h.id===t().currentPreset);return(o==null?void 0:o.tokens)??((l=Or[0])==null?void 0:l.tokens)??{}},applyTheme:()=>{if(typeof document>"u")return;const n=t().getActiveTheme(),s=document.documentElement;Object.entries(n).forEach(([a,o])=>{s.style.setProperty(`--${a}`,o)})},getSavedTheme:()=>{try{const n=localStorage.getItem("openfox:theme");if(!n)return null;if(n[0]!=="{")return JSON.stringify({preset:n});const s=JSON.parse(n);if(s.preset)return JSON.stringify({preset:s.preset});if(s.tokens)return JSON.stringify({tokens:s.tokens})}catch{return null}return null},saveTheme:async n=>{localStorage.setItem("openfox:theme",n);const{useSettingsStore:s}=await Q(async()=>{const{useSettingsStore:a}=await Promise.resolve().then(()=>iv);return{useSettingsStore:a}},void 0);await s.getState().setSetting(We.DISPLAY_THEME,n)},clearCustomTheme:()=>{localStorage.removeItem("openfox:theme"),e({isCustom:!1,isCustomizing:!1,basePreset:""})},reset:()=>{e({currentPreset:"dark",basePreset:"",customTokens:{},isCustom:!1,isCustomizing:!1,userPresets:[]})},addUserPreset:n=>{const{basePreset:s,customTokens:a,currentPreset:o}=t(),c={id:"custom-"+Date.now(),name:n,basePreset:s||o,tokens:{...a}},l=[...t().userPresets,c];e({userPresets:l}),t().saveUserPresets()},applyUserPreset:n=>{const s=t().userPresets[n];s&&(e({currentPreset:s.basePreset,basePreset:s.basePreset,customTokens:{...s.tokens},isCustom:!0,isCustomizing:!1}),t().applyTheme(),t().saveTheme(JSON.stringify({preset:s.basePreset,tokens:s.tokens})).catch(()=>{}))},deleteUserPreset:n=>{const s=t().userPresets.filter((a,o)=>o!==n);e({userPresets:s}),t().saveUserPresets()},loadUserPresets:()=>{e({userPresets:Sv()})},saveUserPresets:()=>{localStorage.setItem("openfox:userPresets",JSON.stringify(t().userPresets)),Q(async()=>{const{useSettingsStore:n}=await Promise.resolve().then(()=>iv);return{useSettingsStore:n}},void 0).then(({useSettingsStore:n})=>{n.getState().setSetting(We.DISPLAY_USER_PRESETS,JSON.stringify(t().userPresets)).catch(()=>{})})}}));function W2({canLoad:e,projectId:t,currentProjectId:n}){const s=zt(c=>c.loadProject),a=Ce(c=>c.listSessions),o=Ce(c=>c.clearSession);O.useEffect(()=>{e&&t&&(n!==t&&s(t),a(t),o())},[e,t,n,s,a,o])}function q2({canLoad:e,projectId:t,sessionId:n,currentProjectId:s,currentSessionId:a}){const o=Ce(f=>f.loadSession),c=zt(f=>f.loadProject),l=Ce(f=>f.listSessions),h=Ce(f=>f.pendingSessionCreate);O.useEffect(()=>{e&&t&&s!==t&&c(t)},[e,t,s,c]),O.useEffect(()=>{e&&n&&a!==n&&o(n),e&&t&&l(t)},[e,n,a,o,l,h,t])}function K2({className:e="w-5 h-5"}){return u.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}function Z0({className:e="w-3.5 h-3.5"}){return u.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M14 5l7 7m0 0l-7 7m7-7H3"})})}function Y2({className:e="w-5 h-5"}){return u.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.172 7l-6.586 6.586a2 2 0 102.828 2.828l6.414-6.586a4 4 0 00-5.656-5.656l-6.415 6.585a6 6 0 108.486 8.486L20.5 13"})})}function X2({className:e="w-3 h-3 text-text-muted"}){return u.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"})})}function Q2({className:e="w-4 h-4"}){return u.jsx("svg",{className:e,viewBox:"0 0 16 16",fill:"currentColor",children:u.jsx("path",{d:"M9.5 3.25a2.25 2.25 0 1 1 3 2.122V6A2.5 2.5 0 0 1 10 8.5H6a1 1 0 0 0-1 1v1.128a2.251 2.251 0 1 1-1.5 0V5.372a2.25 2.25 0 1 1 1.5 0v1.836A2.493 2.493 0 0 1 6 7h4a1 1 0 0 0 1-1v-.628A2.25 2.25 0 0 1 9.5 3.25Zm-6 0a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Zm8.25-.75a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5ZM4.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z"})})}function Mr({className:e="w-3.5 h-3.5 text-text-muted"}){return u.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}function Ir({className:e="w-3 h-3 text-text-muted",rotate:t}){return u.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,style:t!==void 0?{transform:`rotate(${t}deg)`}:void 0,children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})}function J2({className:e="w-4 h-4"}){return u.jsxs("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[u.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",strokeWidth:"2"}),u.jsx("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1",strokeWidth:"2"})]})}function Ym({className:e="w-3.5 h-3.5"}){return u.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})}function Z2({className:e="w-3 h-3"}){return u.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})}function Xm({className:e="w-4 h-4"}){return u.jsxs("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:[u.jsx("circle",{cx:"12",cy:"5",r:"2"}),u.jsx("circle",{cx:"12",cy:"12",r:"2"}),u.jsx("circle",{cx:"12",cy:"19",r:"2"})]})}function Eu({className:e="w-3.5 h-3.5"}){return u.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})})}function Qm({className:e="w-5 h-5 text-accent-primary"}){return u.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{d:"M10 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z"})})}function ej({className:e="w-4 h-4"}){return u.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 9V4.5M9 9H4.5M9 9L3.75 3.75M9 15v4.5M9 15H4.5M9 15l-5.25 5.25M15 9h4.5M15 9V4.5M15 9l5.25-5.25M15 15h4.5M15 15v4.5m0-4.5l5.25 5.25"})})}function tj({className:e="w-4 h-4"}){return u.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4"})})}function nj({className:e="w-4 h-4"}){return u.jsx("svg",{className:e,viewBox:"0 0 16 16",fill:"currentColor",children:u.jsx("path",{d:"M8 0a8.2 8.2 0 0 1 .701.031C9.444.095 9.99.645 10.16 1.29l.288 1.107c.018.066.079.158.212.224.231.114.454.243.668.386.123.082.233.09.299.071l1.1-.303c.652-.18 1.37.008 1.755.653a8.043 8.043 0 0 1 .683 1.18c.227.568.096 1.26-.378 1.726l-.812.804a.312.312 0 0 0-.081.283c.024.166.04.335.04.507s-.016.341-.04.507a.312.312 0 0 0 .08.283l.813.804c.474.466.605 1.158.378 1.726a8.07 8.07 0 0 1-.683 1.18c-.385.645-1.103.833-1.755.653l-1.1-.303c-.066-.019-.176-.011-.299.071a5.1 5.1 0 0 1-.668.386c-.133.066-.194.158-.211.224l-.29 1.107c-.168.645-.714 1.196-1.458 1.26a8.094 8.094 0 0 1-1.402 0c-.744-.064-1.29-.615-1.458-1.26l-.29-1.107a.426.426 0 0 0-.211-.224 5.11 5.11 0 0 1-.668-.386c-.123-.082-.233-.09-.299-.071l-1.1.303c-.652.18-1.37-.008-1.755-.653a8.044 8.044 0 0 1-.683-1.18c-.227-.568-.096-1.26.378-1.726l.812-.804a.312.312 0 0 0 .081-.283A5.18 5.18 0 0 1 2.3 8c0-.172.016-.341.04-.507a.312.312 0 0 0-.08-.283l-.813-.804C.973 5.94.842 5.248 1.069 4.68c.181-.452.395-.882.683-1.18.385-.645 1.103-.833 1.755-.653l1.1.303c.066.019.176.011.299-.071.214-.143.437-.272.668-.386a.426.426 0 0 0 .211-.224l.29-1.107C6.009.645 6.556.095 7.299.03 7.53.01 7.764 0 8 0Zm0 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5Z"})})}function rj({className:e="w-3 h-3"}){return u.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}function sj({className:e="w-4 h-4"}){return u.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1"})})}function wv({className:e="w-4 h-4"}){return u.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})}function eS({className:e="w-[18px] h-[18px]"}){return u.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[u.jsx("circle",{cx:"12",cy:"5",r:"1.5",fill:"currentColor",stroke:"none"}),u.jsx("circle",{cx:"12",cy:"12",r:"1.5",fill:"currentColor",stroke:"none"}),u.jsx("circle",{cx:"12",cy:"19",r:"1.5",fill:"currentColor",stroke:"none"})]})}function ij({className:e="w-4 h-4"}){return u.jsxs("svg",{className:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[u.jsx("path",{d:"M6.5 3.5H3a1 1 0 0 0-1 1V13a1 1 0 0 0 1 1h8.5a1 1 0 0 0 1-1V9.5"}),u.jsx("path",{d:"M9.5 2h4.5v4.5"}),u.jsx("path",{d:"M14 2L7.5 8.5"})]})}function aj({className:e="w-3 h-3",color:t}){return u.jsx("svg",{className:e,fill:t??"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{d:"M8 5v14l11-7z"})})}function Da({className:e="w-3 h-3 text-accent-primary"}){return u.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})})}function oj({className:e="w-5 h-5"}){return u.jsx("svg",{className:e,viewBox:"0 0 20 20",fill:"currentColor",children:u.jsx("path",{fillRule:"evenodd",d:"M10 3a1 1 0 011 1v5h5a1 1 0 110 2h-5v5a1 1 0 11-2 0v-5H4a1 1 0 110-2h5V4a1 1 0 011-1z",clipRule:"evenodd"})})}function tS({className:e="w-4 h-4"}){return u.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})}function lj({className:e="w-4 h-4"}){return u.jsxs("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}function cj({className:e="w-3 h-3 text-blue-400 animate-spin flex-shrink-0"}){return u.jsxs("svg",{"aria-label":"Session running",className:e,viewBox:"0 0 24 24",fill:"none",children:[u.jsx("title",{children:"Running"}),u.jsx("circle",{className:"opacity-30",cx:"12",cy:"12",r:"9",stroke:"currentColor",strokeWidth:"3"}),u.jsx("path",{d:"M21 12a9 9 0 00-9-9",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})]})}function uj({className:e="w-3.5 h-3.5 text-text-muted"}){return u.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{d:"M10.788 3.21c.448-1.077 1.976-1.077 2.424 0l2.082 5.007 5.404.433c1.164.093 1.636 1.545.749 2.305l-4.117 3.527 1.257 5.273c.271 1.136-.964 2.033-1.96 1.425L12 18.354 7.373 21.18c-.996.608-2.231-.29-1.96-1.425l1.257-5.273-4.117-3.527c-.887-.76-.415-2.212.749-2.305l5.404-.433 2.082-5.006z"})})}function dj({className:e="w-3.5 h-3.5 text-text-muted"}){return u.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11.049 2.927c.3-.921 1.603-.921 1.902 0l1.519 4.674a1 1 0 00.95.69h4.915c.969 0 1.371 1.24.588 1.81l-3.976 2.888a1 1 0 00-.363 1.118l1.518 4.674c.3.922-.755 1.688-1.538 1.118l-3.976-2.888a1 1 0 00-1.176 0l-3.976 2.888c-.783.57-1.838-.197-1.538-1.118l1.518-4.674a1 1 0 00-.363-1.118l-3.976-2.888c-.784-.57-.38-1.81.588-1.81h4.914a1 1 0 00.951-.69l1.519-4.674z"})})}function nS({className:e="w-4 h-4"}){return u.jsx("svg",{className:e,viewBox:"0 0 16 16",fill:"currentColor",children:u.jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1"})})}function hj({className:e="w-3.5 h-3.5 shrink-0",color:t}){return u.jsx("svg",{className:e,fill:"none",stroke:t,viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})})}function fj({className:e="w-4 h-4"}){return u.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[u.jsx("polyline",{points:"4 17 10 11 4 5"}),u.jsx("line",{x1:"12",y1:"19",x2:"20",y2:"19"})]})}function ju({className:e="w-3.5 h-3.5"}){return u.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})}function Jm(){return u.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})}function mj({className:e="w-4 h-4"}){return u.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}function um({className:e="w-2.5 h-2.5"}){return u.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}function Zm({className:e="w-4 h-4"}){return u.jsx("svg",{className:e,viewBox:"0 0 20 20",fill:"currentColor",children:u.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})}function rS({className:e="w-4 h-4"}){return u.jsx("svg",{className:e,viewBox:"0 0 16 16",fill:"currentColor",children:u.jsx("path",{d:"M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.55.55 0 0 1 0-.708z"})})}function pj({className:e="w-3.5 h-3.5 text-text-muted"}){return u.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"})})}function gj({className:e="w-3.5 h-3.5 text-text-muted"}){return u.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"})})}function Cv({className:e="w-3.5 h-3.5 text-text-muted"}){return u.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})})}function dm(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function kv(e,t){const n=Qt.ws;!n||n.readyState!==WebSocket.OPEN||n.send(JSON.stringify({id:dm(),type:e,payload:t}))}const _r=Jn((e,t)=>({isOpen:!1,sessions:[],workdir:null,setOpen:n=>e({isOpen:n}),toggleOpen:()=>e(n=>({isOpen:!n.isOpen})),setWorkdir:n=>e({workdir:n}),fetchSessions:async n=>{if(!n){e({sessions:[]});return}try{const s=await je(`/api/terminals?projectId=${encodeURIComponent(n)}`);if(s.ok){const a=await s.json();e({sessions:a});const o=Qt.ws;if(o&&o.readyState===WebSocket.OPEN)for(const c of a)o.send(JSON.stringify({id:dm(),type:"terminal.subscribe",payload:{sessionId:c.id}}))}}catch(s){console.error("Failed to fetch terminals:",s)}},createSession:async(n,s)=>{try{const a=await je("/api/terminals",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workdir:n??t().workdir??void 0,projectId:s})});if(a.ok){const o=await a.json();e(l=>({sessions:[...l.sessions,o]}));const c=Qt.ws;c&&c.readyState===WebSocket.OPEN&&c.send(JSON.stringify({id:dm(),type:"terminal.subscribe",payload:{sessionId:o.id}}))}}catch(a){console.error("Failed to create terminal:",a)}},writeSession:(n,s)=>{kv("terminal.write",{sessionId:n,data:s})},resizeSession:(n,s,a)=>{kv("terminal.resize",{sessionId:n,cols:s,rows:a})},killSession:async n=>{try{(await je(`/api/terminals/${n}`,{method:"DELETE"})).ok&&e(a=>({sessions:a.sessions.filter(o=>o.id!==n)}))}catch(s){console.error("Failed to kill terminal:",s)}},handleMessage:n=>{switch(n.type){case"terminal.exit":{const{sessionId:s}=n.payload||{};s&&e(a=>{const o=a.sessions.filter(c=>c.id!==s);return o.length===0&&a.isOpen?{sessions:[],isOpen:!1}:{sessions:o}});break}}}}));Qt.subscribe(e=>{var t;(t=e.type)!=null&&t.startsWith("terminal.")&&_r.getState().handleMessage(e)});const wa={terminalToggle:{type:"double-press",key:"Control",threshold:300},quickAction:{type:"double-press",key:"Shift",threshold:300},agentSwitching:[{type:"chord",key:"1",modifiers:["ctrl"]},{type:"chord",key:"2",modifiers:["ctrl"]},{type:"chord",key:"3",modifiers:["ctrl"]},{type:"chord",key:"4",modifiers:["ctrl"]}]};function hm(e){if(!e)return structuredClone(wa);try{const t=JSON.parse(e);return{terminalToggle:t.terminalToggle??structuredClone(wa.terminalToggle),quickAction:t.quickAction??structuredClone(wa.quickAction),agentSwitching:t.agentSwitching??structuredClone(wa.agentSwitching)}}catch{return structuredClone(wa)}}function Ev(e){return e.code.startsWith("Digit")?e.code.slice(-1):e.code.startsWith("Key")?e.code.slice(3).toLowerCase():e.key}function sS(e){if(e.type==="double-press")return`Double ${e.key==="Control"?"Ctrl":e.key==="Shift"?"Shift":e.key==="Alt"?"Alt":e.key==="Meta"?"Meta":e.key}`;const t=e.modifiers.map(s=>{switch(s){case"ctrl":return"Ctrl";case"meta":return"⌘";case"alt":return"Alt";case"shift":return"Shift"}}),n=e.key.length===1?e.key.toUpperCase():e.key;return[...t,n].join("+")}function xj(e){return e.type==="double-press"}function iS(e){return e.type==="chord"}function _j(e,t){return t.length===1&&/^[a-z]$/i.test(t)?e.code===`Key${t.toUpperCase()}`:t.length===1&&/^[0-9]$/.test(t)?e.code===`Digit${t}`:e.key.toLowerCase()===t.toLowerCase()}function aS(e,t){const n=t.modifiers.includes("ctrl"),s=t.modifiers.includes("meta"),a=t.modifiers.includes("alt"),o=t.modifiers.includes("shift");return _j(e,t.key)&&e.ctrlKey===n&&e.metaKey===s&&e.altKey===a&&e.shiftKey===o}function ep(){const e=tn(t=>t.settings[We.KEYBINDINGS]);return hm(e)}function yj(e,t,n){const s=O.useRef(0),a=O.useRef(t);a.current=t,O.useEffect(()=>{if(!e)return;const o=e.threshold??300,c=l=>{if(l.key!==e.key)return;const h=e.key==="Control",f=e.key==="Shift",p=e.key==="Alt",m=e.key==="Meta";if(!h&&l.ctrlKey||!f&&l.shiftKey||!p&&l.altKey||!m&&l.metaKey)return;const _=Date.now();_-s.current<o?(l.preventDefault(),l.stopPropagation(),a.current(),s.current=0):s.current=_};return window.addEventListener("keydown",c,n!=null&&n.capture?!0:void 0),()=>window.removeEventListener("keydown",c,n!=null&&n.capture?!0:void 0)},[e,n==null?void 0:n.capture])}function vj(e,t){const n=O.useRef(t);n.current=t,O.useEffect(()=>{if(!e)return;const s=a=>{aS(a,e)&&(a.preventDefault(),n.current())};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[e])}function oS(e,t,n){yj(e&&xj(e)?e:void 0,t,n),vj(e&&iS(e)?e:void 0,t)}function bj(e,t,n){const s=O.useRef(n);s.current=n,O.useEffect(()=>{const a=o=>{for(let c=0;c<e.length;c++){const l=e[c];if(!l)continue;const h=t[c];if(h&&iS(l)&&aS(o,l)){o.preventDefault(),s.current(h.id);return}}};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[e,t])}var Pa=I0();const Tu=O.forwardRef(({icon:e,iconSize:t="w-3.5 h-3.5",className:n="",...s},a)=>u.jsx("button",{ref:a,type:"button",className:`p-1 rounded text-text-muted hover:text-text-primary hover:bg-bg-primary transition-colors ${n}`,...s,children:u.jsx("svg",{className:t,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:e})})}));Tu.displayName="IconButton";const Sj="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z",La=O.forwardRef((e,t)=>u.jsx(Tu,{ref:t,icon:Sj,title:"Edit",...e}));La.displayName="EditButton";const wj="M6 18L18 6M6 6l12 12",tp=O.forwardRef((e,t)=>u.jsx(Tu,{ref:t,icon:wj,...e}));tp.displayName="CloseButton";const Cj={sm:"max-w-sm",md:"max-w-md",lg:"max-w-2xl",xl:"max-w-4xl",full:"max-w-[95vw] h-[90vh] flex-1"};function Nt({label:e,title:t,size:n="md",minHeight:s,children:a,footer:o,className:c,onClose:l,isOpen:h,closeOnBackdropClick:f=!0,closeOnEscape:p=!0,showCloseButton:m=!0}){const[_,y]=O.useState(!1),w=h!==void 0,k=w?h:_,v=O.useCallback(()=>{w||y(!0)},[w]),b=O.useCallback(()=>{w||y(!1),l==null||l()},[w,l]);O.useEffect(()=>{if(!k||!p)return;const S=j=>{j.key==="Escape"&&(j.stopPropagation(),b())};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[k,b,p]);const x=e&&(typeof e=="string"?u.jsx("button",{type:"button",onClick:v,className:c,children:e}):u.jsx("span",{onClick:v,className:c,style:{cursor:"pointer"},children:e}));return u.jsxs(u.Fragment,{children:[x,k&&(typeof document<"u"?Pa.createPortal(u.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[u.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:f?b:void 0}),u.jsxs("div",{className:`relative w-full ${Cj[n]} max-h-[90vh] bg-bg-secondary border border-border rounded shadow-xl flex flex-col`,children:[(t||m)&&u.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[t&&u.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:t}),m&&u.jsx(tp,{onClick:b,className:"ml-auto","aria-label":"Close"})]}),u.jsx("div",{className:"p-4 overflow-y-auto flex-1 min-h-0",style:s?{minHeight:s}:void 0,children:a}),o&&u.jsx("div",{className:"px-4 py-3 border-t border-border",children:o})]})]}),document.body):null)]})}const rt=O.forwardRef(({variant:e="secondary",size:t="md",className:n="",children:s,...a},o)=>{const c="rounded font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed",l={primary:"bg-accent-primary/25 text-text-primary hover:bg-accent-primary/40",secondary:"bg-bg-tertiary text-text-primary hover:bg-border",danger:"bg-accent-error text-white hover:bg-accent-error/80"},h={sm:"px-1.5 py-1 text-xs",md:"px-3 py-1.5 text-sm",lg:"px-4 py-2 text-base"};return u.jsx("button",{ref:o,className:`${c} ${l[e]} ${h[t]} ${n}`,...a,children:s})});rt.displayName="Button";function kj({value:e,defaultUrl:t,disabled:n,onChange:s}){const a=e??t;return u.jsxs("div",{className:"relative",children:[u.jsx("select",{value:a,disabled:n,onChange:o=>{const c=o.target.value;s(c===t?null:c)},className:"appearance-none bg-bg-tertiary border border-border rounded px-1.5 pr-5 text-xs focus:outline-none focus:ring-1 focus:ring-accent-primary disabled:opacity-40 cursor-pointer",style:{width:"60px"},children:j2.map(({url:o,label:c})=>u.jsx("option",{value:o,title:c,children:c.split(" ")[0]},o))}),u.jsx(Ir,{className:"absolute right-0.5 top-1/2 -translate-y-1/2 w-3 h-3 pointer-events-none text-text-muted"})]})}const jv=[{key:"general",label:"General"},{key:"build",label:"Agent"},{key:"sub-agent",label:"Sub-agent"}];function Ej(){const e=gi(h=>h.settings),t=gi(h=>h.update),n=gi(h=>h.updateEvent),s=gi(h=>h.updateAgentOverride),a=gi(h=>h.load);O.useEffect(()=>{a()},[a]);const o=async()=>{await N2()==="granted"&&t({...e,browserNotificationEnabled:!0})},c=(h,f,p,m)=>{h==="general"?n(f,{[p]:m}):s(h,f,{[p]:m})},l=(h,f,p)=>{h==="general"?n(f,{customSoundUrl:p}):s(h,f,{customSoundUrl:p})};return u.jsxs("div",{className:"space-y-6",children:[u.jsxs("div",{className:"space-y-3",children:[u.jsx("h3",{className:"text-sm font-medium text-text-primary",children:"Master Controls"}),u.jsx(Tv,{label:"Sound notifications",description:"Play sounds when events occur",checked:e.soundEnabled,onChange:h=>t({...e,soundEnabled:h})}),u.jsx(Tv,{label:"Browser notifications",description:"Show desktop notifications when the window is not focused",checked:e.browserNotificationEnabled,onChange:h=>{h&&typeof Notification<"u"&&Notification.permission!=="granted"?o():t({...e,browserNotificationEnabled:h})}}),typeof Notification<"u"&&Notification.permission==="denied"&&e.browserNotificationEnabled&&u.jsx("p",{className:"text-xs text-accent-error ml-6",children:"Browser notifications are blocked. Please enable them in your browser settings."})]}),u.jsxs("div",{className:"space-y-3",children:[u.jsx("h3",{className:"text-sm font-medium text-text-primary",children:"Notification Settings"}),u.jsx("div",{className:"border border-border rounded overflow-hidden",children:u.jsxs("table",{className:"w-full text-sm",children:[u.jsx("thead",{className:"sticky top-0 bg-bg-tertiary",children:u.jsxs("tr",{className:"border-b border-border",children:[u.jsx("th",{className:"text-left px-3 py-2 text-text-primary font-medium w-40",children:"Event"}),jv.map(h=>u.jsx("th",{className:"text-center px-2 py-2 text-text-primary font-medium",children:h.label},h.key))]})}),u.jsx("tbody",{children:E2.map(h=>u.jsxs("tr",{className:"border-b border-border last:border-b-0 hover:bg-bg-secondary/50",children:[u.jsx("td",{className:"px-3 py-2",children:u.jsx("div",{className:"text-text-primary text-xs",children:h.label})}),jv.map(f=>{const p=X0(e,h.key,f.key==="general"?void 0:f.key),m=K0[h.key];return u.jsx("td",{className:"px-2 py-2 align-top",children:u.jsxs("div",{className:"flex flex-col items-center gap-1",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("label",{className:"flex items-center gap-1 text-text-secondary",children:u.jsx("input",{type:"checkbox",checked:p.soundEnabled,onChange:_=>c(f.key,h.key,"soundEnabled",_.target.checked),disabled:!e.soundEnabled,className:"rounded border-border",title:"Sound"})}),u.jsx("label",{className:"flex items-center gap-1 text-text-secondary",children:u.jsx("input",{type:"checkbox",checked:p.browserNotification,onChange:_=>c(f.key,h.key,"browserNotification",_.target.checked),disabled:!e.browserNotificationEnabled,className:"rounded border-border",title:"Browser"})})]}),p.soundEnabled&&e.soundEnabled&&u.jsx(kj,{value:p.customSoundUrl,defaultUrl:m,disabled:!e.soundEnabled,onChange:_=>l(f.key,h.key,_)})]})},f.key)})]},h.key))})]})})]})]})}function Tv({label:e,description:t,checked:n,onChange:s}){return u.jsxs("label",{className:"flex items-start gap-3 cursor-pointer group",children:[u.jsx("div",{className:"pt-0.5",children:u.jsx("div",{className:`relative w-9 h-5 rounded-full transition-colors ${n?"bg-accent-primary":"bg-bg-tertiary border border-border"}`,onClick:a=>{a.preventDefault(),s(!n)},children:u.jsx("div",{className:`absolute top-0.5 w-4 h-4 rounded-full bg-white shadow transition-transform ${n?"translate-x-4":"translate-x-0.5"}`})})}),u.jsxs("div",{children:[u.jsx("div",{className:"text-sm text-text-primary group-hover:text-accent-primary transition-colors",children:e}),u.jsx("div",{className:"text-xs text-text-muted",children:t})]})]})}async function np(e,t,n){t({loading:!0});try{const a=await(await je(e)).json();t({defaults:a.defaults??[],userItems:a.userItems??[],...n?{projectItems:a.projectItems??[]}:{},loading:!1})}catch{t({loading:!1})}}const Nr=Jn((e,t)=>({defaults:[],userItems:[],projectItems:[],loading:!1,fetchSkills:async()=>{await np("/api/skills",e,!0)},toggleSkill:async n=>{try{const a=await(await je(`/api/skills/${n}/toggle`,{method:"POST"})).json();e(o=>({defaults:o.defaults.map(c=>c.id===n?{...c,enabled:a.enabled}:c),userItems:o.userItems.map(c=>c.id===n?{...c,enabled:a.enabled}:c)}))}catch{}},fetchSkill:async n=>{try{const s=await je(`/api/skills/${n}`);return s.ok?await s.json():null}catch{return null}},fetchDefaultContent:async n=>{try{const s=await je(`/api/skills/defaults/${n}`);return s.ok?await s.json():null}catch{return null}},createSkill:async(n,s)=>{const a=await Vs("POST","/api/skills",{...n,destination:s});return a.success&&await t().fetchSkills(),a},updateSkill:async(n,s)=>{const a=await Vs("PUT",`/api/skills/${n}`,s);return a.success&&await t().fetchSkills(),a},deleteSkill:async n=>{try{const s=await je(`/api/skills/${n}`,{method:"DELETE"}),a=await s.json();return s.ok?(e(o=>({userItems:o.userItems.filter(c=>c.id!==n)})),{success:!0}):{success:!1,error:a.error??"Failed to delete"}}catch{return{success:!1,error:"Network error"}}},duplicateSkill:async(n,s)=>ku(`/api/skills/${n}/duplicate`,()=>t().fetchSkills(),s)}));function rp(){const[e,t]=O.useState({id:null,type:null}),n=O.useCallback(o=>t({id:o,type:"delete"}),[]),s=O.useCallback(()=>t({id:null,type:null}),[]),a=O.useCallback((o,c)=>e.id===o&&e.type===c,[e.id,e.type]);return{requestDelete:n,clearConfirm:s,isConfirming:a}}function sp({onConfirm:e,onCancel:t}){return u.jsxs("div",{className:"flex items-center gap-1",children:[u.jsx("button",{onClick:e,className:"px-1.5 py-0.5 rounded text-xs hover:opacity-90 transition-colors bg-accent-error/20 text-accent-error hover:bg-accent-error/30",children:"Delete"}),u.jsx("button",{onClick:t,className:"px-1.5 py-0.5 rounded text-text-muted text-xs hover:bg-bg-primary transition-colors",children:"Cancel"})]})}function ip({onClick:e}){return u.jsx("button",{onClick:e,className:"p-1.5 rounded hover:bg-bg-primary text-text-muted hover:text-accent-error transition-colors",title:"Delete",children:u.jsx(ju,{})})}function tl({onClick:e}){return u.jsx("button",{onClick:e,className:"p-1.5 rounded hover:bg-bg-primary text-text-muted hover:text-text-primary transition-colors",title:"Duplicate",children:u.jsx(Ym,{})})}function Si({label:e,value:t,onChange:n,placeholder:s,readOnly:a,hint:o,mono:c}){return u.jsxs("div",{children:[u.jsxs("label",{className:"block text-xs text-text-secondary mb-1",children:[e,o&&u.jsx("span",{className:"text-text-muted ml-1",children:o})]}),u.jsx("input",{value:t,onChange:l=>n(l.target.value),readOnly:a,placeholder:s,className:`w-full px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm focus:outline-none focus:ring-1 focus:ring-accent-primary ${c?"font-mono":""} ${a?"opacity-60":""}`})]})}function jj({onCancel:e,onSave:t,saving:n,saveDisabled:s}){return u.jsxs("div",{className:"flex justify-end gap-2 pt-2 border-t border-border",children:[u.jsx(rt,{variant:"secondary",onClick:e,children:"Cancel"}),u.jsx(rt,{variant:"primary",onClick:t,disabled:n||s,children:n?"Saving...":"Save"})]})}function ap({message:e}){return u.jsx("div",{className:"text-accent-error text-sm px-3 py-2 bg-accent-error/10 rounded",children:e})}function lS({label:e="Custom",children:t}){return u.jsxs("div",{children:[u.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:e}),u.jsx("div",{className:"space-y-2",children:t})]})}function cS({description:e,onNew:t,newLabel:n="+ New"}){return u.jsxs("div",{className:"flex items-center justify-between mb-4",children:[u.jsx("p",{className:"text-text-secondary text-sm",children:e}),u.jsx("div",{className:"flex items-center gap-2 flex-shrink-0 ml-3",children:u.jsx(rt,{variant:"primary",size:"sm",onClick:t,children:n})})]})}function uS({isBuiltIn:e,isConfirmingDelete:t,onView:n,onEdit:s,onDuplicate:a,onDelete:o,children:c}){return u.jsxs("div",{className:"flex items-center justify-between p-3 rounded border border-border bg-bg-tertiary",children:[u.jsx("div",{className:"min-w-0 flex-1 mr-3",children:c}),u.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[e&&n&&u.jsx("button",{onClick:n,className:"p-1.5 rounded text-text-muted hover:text-text-primary hover:bg-bg-primary transition-colors",title:"View",children:u.jsx(Eu,{})}),u.jsx(tl,{onClick:a}),!e&&s&&u.jsx(La,{onClick:s}),!e&&(t?u.jsx(sp,{onConfirm:()=>{o==null||o()},onCancel:()=>{}}):u.jsx(ip,{onClick:()=>o==null?void 0:o()}))]})]})}function Tj({id:e,name:t,description:n,isBuiltIn:s,isConfirmingDelete:a,onView:o,onEdit:c,onDuplicate:l,onDelete:h}){return u.jsxs(uS,{isBuiltIn:s,isConfirmingDelete:a,onView:o,onEdit:c,onDuplicate:l,onDelete:h,children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("span",{className:"text-text-primary text-sm font-medium",children:t}),u.jsx("span",{className:"text-text-muted text-xs font-mono",children:e})]}),n&&u.jsx("p",{className:"text-text-muted text-xs truncate",children:n})]})}function dS({loading:e,hasItems:t,loadingLabel:n,emptyLabel:s,children:a}){return e&&!t?u.jsx("div",{className:"text-text-muted text-sm",children:n}):t?u.jsx("div",{className:"space-y-4",children:a}):s?u.jsx("div",{className:"text-text-muted text-sm",children:s}):null}function hS({name:e,id:t,nameLabel:n="Name",idLabel:s="ID",namePlaceholder:a="My Item",idPlaceholder:o="my-item",nameHint:c,readOnlyId:l=!1,readOnlyHint:h="(read-only)",onNameChange:f,onIdChange:p}){return u.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[u.jsx(Si,{label:n,value:e,onChange:f,placeholder:a,hint:c}),u.jsx(Si,{label:s,value:t,onChange:p,readOnly:l,placeholder:o,hint:l?h:void 0,mono:!0})]})}function fS(e={}){const{initialData:t={}}=e,[n,s]=O.useState("list"),[a,o]=O.useState(null),[c,l]=O.useState(""),[h,f]=O.useState(!1),[p,m]=O.useState(t),_=O.useCallback(()=>{m(t),l(""),o(null)},[t]),y=O.useCallback(b=>{s(b),b==="list"&&_()},[_]),w=O.useCallback(b=>{m(x=>typeof b=="function"?b(x):b)},[]),k=O.useCallback((b,x={})=>{o(b),s("edit"),m({...x}),l("")},[]),v=O.useCallback(()=>{o(null),s("edit"),m(t),l("")},[t]);return{view:n,editingId:a,formError:c,saving:h,formData:p,setView:y,setEditingId:o,setFormError:l,setFormData:w,setSaving:f,resetForm:_,startEditing:k,startNew:v}}function op(){return u.jsxs("div",{className:"flex items-start gap-2 px-3 py-2 bg-accent-warning/10 border border-accent-warning/30 rounded text-xs",children:[u.jsx("span",{children:"⚠️"}),u.jsx("p",{className:"text-text-secondary",children:"Editing this value now will have the side-effect of invalidating KV-cache, causing your next message in current sessions to take a long time to process. Consider doing this between sessions."})]})}function Nv({skill:e,isBuiltIn:t,isConfirmingDelete:n,onView:s,onEdit:a,onDuplicate:o,onDelete:c}){return u.jsx(Tj,{id:e.id,name:e.name,description:e.description,isBuiltIn:t,isConfirmingDelete:n,onView:s,onEdit:a,onDuplicate:o,onDelete:c})}function Nj({isOpen:e}){const t=Nr(H=>H.defaults),n=Nr(H=>H.userItems),s=Nr(H=>H.projectItems),a=Nr(H=>H.loading),o=Nr(H=>H.fetchSkills),c=Nr(H=>H.fetchSkill),l=Nr(H=>H.fetchDefaultContent),h=Nr(H=>H.createSkill),f=Nr(H=>H.updateSkill),p=Nr(H=>H.deleteSkill),{view:m,editingId:_,formError:y,saving:w,formData:k,setView:v,setEditingId:b,setFormError:x,setFormData:S,setSaving:j}=fS(),{clearConfirm:N}=rp();O.useEffect(()=>{e&&(o(),v("list"),b(null),N())},[e,o,N]);const T=(H,J,K,I)=>{S({name:I??H.metadata.name,id:K??H.metadata.id,description:H.metadata.description??"",version:H.metadata.version??"1.0.0",prompt:H.prompt,isReadOnly:J,destination:"user"})},D=async H=>{if(t.some(K=>K.id===H)){const K=await l(H);if(!K)return;T(K,!0),b(H),x(""),v("edit")}else{const K=await c(H);if(!K)return;T(K,!0),b(H),x(""),v("edit")}},A=async H=>{const K=t.some(L=>L.id===H)?await l(H):await c(H);if(!K)return;const I=`${H}-copy-${Date.now()}`;T(K,!1,I,`${K.metadata.name} (copy)`),b(null),x(""),v("edit")},B=()=>{S({name:"",id:"",description:"",version:"1.0.0",prompt:"",isReadOnly:!1,destination:"user"}),v("edit")},R=async H=>{const J=await c(H);J&&(T(J,!1),b(H),x(""),v("edit"))},$=async H=>{await p(H),N()},F=async()=>{const H=_??k.id;if(!H||!k.name||!k.prompt){x("Name, ID, and prompt are required.");return}j(!0),x("");const J={metadata:{id:H,name:k.name,description:k.description,version:k.version},prompt:k.prompt},K=_?await f(_,J):await h(J,k.destination);if(j(!1),!K.success){x(K.error??"Failed to save skill.");return}v("list")},W=H=>{S(J=>({...J,name:H})),_||S(J=>({...J,id:H.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}))},Y=k.isReadOnly;if(m==="edit")return u.jsxs("div",{className:"flex flex-col h-full",children:[u.jsxs("div",{className:"flex justify-between items-center mb-3",children:[u.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:Y?k.name:_?"Edit Skill":"New Skill"}),u.jsx("button",{onClick:()=>v("list"),className:"text-text-muted hover:text-text-primary",children:"Cancel"})]}),y&&u.jsx(ap,{message:y}),u.jsxs("div",{className:"space-y-3 mb-3",children:[u.jsx(hS,{name:k.name,id:k.id,nameLabel:"Name",idLabel:"ID",namePlaceholder:"My Skill",idPlaceholder:"my-skill",readOnlyId:!0,onNameChange:W,onIdChange:()=>{}}),u.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[u.jsx(Si,{label:"Description",value:k.description,onChange:H=>S(J=>({...J,description:H})),placeholder:"What this skill does...",readOnly:Y}),u.jsx(Si,{label:"Version",value:k.version,onChange:H=>S(J=>({...J,version:H})),placeholder:"1.0.0",readOnly:Y})]})]}),u.jsxs("div",{className:"flex-1 min-h-[120px] border-t border-border pt-3 flex flex-col",children:[u.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Prompt"}),u.jsx("textarea",{value:k.prompt,onChange:H=>S(J=>({...J,prompt:H.target.value})),readOnly:Y,placeholder:"The system prompt for this skill...",className:"h-80 w-full px-3 py-2 bg-bg-tertiary border border-border rounded text-sm font-mono resize-y focus:outline-none focus:ring-1 focus:ring-accent-primary"})]}),!_&&u.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[u.jsx("label",{className:"text-xs text-text-secondary",children:"Save to:"}),u.jsxs("select",{value:k.destination,onChange:H=>S(J=>({...J,destination:H.target.value})),className:"px-2 py-1 bg-bg-tertiary border border-border rounded text-xs focus:outline-none focus:ring-1 focus:ring-accent-primary",children:[u.jsx("option",{value:"user",children:"Global config"}),u.jsx("option",{value:"project",children:"Project (.openfox/)"})]})]}),u.jsx(op,{}),u.jsxs("div",{className:"flex justify-end gap-2 pt-3 border-t border-border flex-shrink-0",children:[u.jsx(rt,{variant:"secondary",onClick:()=>v("list"),children:"Cancel"}),Y?u.jsx(rt,{variant:"primary",onClick:()=>{S(H=>({...H,name:H.name+" (copy)",id:`${_}-copy-${Date.now()}`,isReadOnly:!1})),b(null)},children:"Duplicate & Customize"}):u.jsx(rt,{variant:"primary",onClick:F,disabled:w||!k.name||!k.id||!k.prompt,children:w?"Saving...":"Save"})]})]});function P({items:H}){return H.map(J=>u.jsx(Nv,{skill:J,isBuiltIn:!1,isConfirmingDelete:!1,onView:()=>D(J.id),onEdit:()=>R(J.id),onDuplicate:()=>A(J.id),onDelete:()=>$(J.id)},J.id))}return u.jsxs("div",{children:[u.jsx(cS,{description:"Skills provide domain-specific knowledge that agents can load on demand.",onNew:B}),u.jsxs(dS,{loading:a,hasItems:t.length>0||n.length>0,loadingLabel:"Loading skills...",emptyLabel:"No skills created yet.",children:[t.length>0&&u.jsxs("div",{children:[u.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:"Built-in"}),u.jsx("div",{className:"space-y-2",children:t.map(H=>u.jsx(Nv,{skill:H,isBuiltIn:!0,isConfirmingDelete:!1,onView:()=>D(H.id),onDuplicate:()=>A(H.id)},H.id))})]}),n.length>0&&u.jsx(lS,{children:u.jsx(P,{items:n})}),s.length>0&&u.jsxs("div",{className:"mt-4",children:[u.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:"Project"}),u.jsx("div",{className:"space-y-2",children:u.jsx(P,{items:s})})]})]})]})}function Aj(e){const t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(t){const n=parseInt(t[1]??"0",16),s=parseInt(t[2]??"0",16),a=parseInt(t[3]??"0",16);return`${n} ${s} ${a}`}return e}function pi(e){const t=e.split(" ").map(n=>parseInt(n,10));return t.length===3&&t.every(n=>!isNaN(n))?`#${t.map(n=>(n??0).toString(16).padStart(2,"0")).join("")}`:e}function Dj({isOpen:e,isNew:t,basePresetId:n,presetName:s,initialTokens:a,onClose:o,onSave:c}){const[l,h]=O.useState(a),[f,p]=O.useState(s);O.useEffect(()=>{h(a),p(s)},[a,s]);const m=(v,b)=>{const x=b.startsWith("#")?Aj(b):b;h(S=>({...S,[v]:x}))},_=()=>{c(f.trim()||"Untitled",{...l})},y=J0.reduce((v,b)=>{const x=b.category;return v[x]||(v[x]=[]),v[x].push(b),v},{}),w={background:"Backgrounds",surface:"Surfaces",text:"Text",accent:"Accents",border:"Border"},k=Or.find(v=>v.id===n);return u.jsx(Nt,{isOpen:e,onClose:o,size:"lg",title:t?"New Theme":"Edit Theme",closeOnBackdropClick:!0,closeOnEscape:!0,footer:u.jsxs("div",{className:"flex gap-2 justify-end",children:[u.jsx("button",{type:"button",onClick:o,className:"px-4 py-2 border border-border rounded text-sm text-text-primary hover:bg-bg-tertiary transition-colors",children:"Cancel"}),u.jsx("button",{type:"button",onClick:_,className:"px-4 py-2 bg-accent-primary text-white rounded hover:bg-accent-primary/80 transition-colors text-sm",children:"Save"})]}),children:u.jsxs("div",{className:"space-y-4",children:[u.jsxs("div",{children:[u.jsx("label",{className:"text-xs text-text-muted block mb-1",children:"Name"}),u.jsx("input",{type:"text",value:f,onChange:v=>p(v.target.value),className:"w-full px-3 py-2 bg-bg-tertiary border border-border rounded text-sm text-text-primary focus:outline-none focus:ring-1 focus:ring-accent-primary"})]}),!t&&u.jsxs("div",{className:"text-xs text-text-muted",children:["Based on ",u.jsx("span",{className:"text-text-primary",children:k==null?void 0:k.name})]}),Object.entries(y).map(([v,b])=>u.jsxs("div",{className:"space-y-3",children:[u.jsx("h4",{className:"text-xs font-medium text-text-muted uppercase",children:w[v]??v}),u.jsx("div",{className:"grid grid-cols-2 gap-3",children:b.map(x=>u.jsxs("div",{className:"flex flex-col gap-1",children:[u.jsx("label",{htmlFor:x.key,className:"text-xs text-text-muted",children:x.label}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("input",{type:"color",id:x.key,value:pi(l[x.key]??x.defaultValue),onChange:S=>m(x.key,S.target.value),className:"w-8 h-8 rounded cursor-pointer border border-border bg-transparent"}),u.jsx("input",{type:"text",value:l[x.key]??x.defaultValue,onChange:S=>m(x.key,S.target.value),className:"flex-1 px-2 py-1 bg-bg-tertiary border border-border rounded text-xs text-text-primary font-mono focus:outline-none focus:ring-1 focus:ring-accent-primary"})]})]},x.key))})]},v))]})})}function Lj(){const[e,t]=O.useState(null),n=Jt(x=>x.currentPreset),s=Jt(x=>x.isCustom),a=Jt(x=>x.basePreset),o=Jt(x=>x.userPresets),c=Jt(x=>x.applyPreset),l=Jt(x=>x.applyUserPreset),h=Jt(x=>x.deleteUserPreset),f=Jt(x=>x.saveTheme),p=x=>{c(x),f(JSON.stringify({preset:x})).catch(()=>{})},m=x=>{l(x)},_=x=>{const S=Or.find(j=>j.id===x);S&&t({type:"new",presetIndex:o.length,basePresetId:x,presetName:S.name+" Copy",tokens:{...S.tokens}})},y=x=>{const S=o[x];if(!S)return;const j=Or.find(T=>T.id===S.basePreset),N=j?{...j.tokens,...S.tokens}:S.tokens;t({type:"edit",presetIndex:x,basePresetId:S.basePreset,presetName:S.name,tokens:N})},w=(x,S)=>{if(!e)return;const j=[...o];if(e.type==="new"){const N={id:"custom-"+Date.now(),name:x,basePreset:e.basePresetId,tokens:S};j.push(N);const T=j.length-1;Jt.setState({userPresets:j}),Jt.getState().saveUserPresets(),Jt.getState().applyUserPreset(T)}else{const N=j[e.presetIndex];N&&(j[e.presetIndex]={...N,name:x,tokens:S}),Jt.setState({userPresets:j}),Jt.getState().saveUserPresets(),Jt.getState().applyUserPreset(e.presetIndex)}t(null)},k=()=>{t(null)},v=(x,S)=>{x.stopPropagation(),h(S)},b=s?a:n;return u.jsxs("div",{className:"space-y-4",children:[u.jsx("h3",{className:"text-sm font-medium text-text-primary",children:"Theme"}),u.jsx("div",{className:"grid grid-cols-5 gap-2",children:Or.map(x=>u.jsxs("div",{className:"relative group",children:[u.jsxs("button",{type:"button",onClick:()=>p(x.id),className:`w-full flex flex-col items-center gap-2 px-3 py-3 rounded-lg border transition-colors ${b===x.id&&!s?"border-accent-primary bg-bg-tertiary text-text-primary":"border-border bg-bg-secondary text-text-muted hover:border-text-muted"}`,children:[u.jsx("div",{className:"w-8 h-8 rounded border flex items-center justify-center",style:{backgroundColor:pi(x.tokens["color-bg-primary"]??"#000"),borderColor:pi(x.tokens["color-border"]??"#000")},children:u.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:pi(x.tokens["color-text-primary"]??"#fff")}})}),u.jsx("span",{className:"text-xs",children:x.name})]}),u.jsx("button",{type:"button",onClick:S=>{S.stopPropagation(),_(x.id)},className:"absolute top-1 right-1 w-6 h-6 rounded bg-bg-tertiary border border-border flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity z-10 hover:border-text-muted",title:"Create custom theme based on this",children:u.jsx("span",{className:"text-xs",children:"✎"})})]},x.id))}),o.length>0&&u.jsxs(u.Fragment,{children:[u.jsx("h4",{className:"text-xs font-medium text-text-muted uppercase",children:"My Themes"}),u.jsx("div",{className:"grid grid-cols-5 gap-2",children:o.map((x,S)=>{const j=Or.find(T=>T.id===x.basePreset),N=j?{...j.tokens,...x.tokens}:x.tokens;return u.jsxs("div",{className:"relative group",children:[u.jsxs("button",{type:"button",onClick:()=>m(S),className:`w-full flex flex-col items-center gap-2 px-3 py-3 rounded-lg border transition-colors ${s&&a===x.basePreset&&b===x.basePreset?"border-accent-primary bg-bg-tertiary text-text-primary":"border-border bg-bg-secondary text-text-muted hover:border-text-muted"}`,children:[u.jsx("div",{className:"w-8 h-8 rounded border flex items-center justify-center",style:{backgroundColor:pi(N["color-bg-primary"]??"#000"),borderColor:pi(N["color-border"]??"#000")},children:u.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:pi(N["color-text-primary"]??"#fff")}})}),u.jsx("span",{className:"text-xs truncate w-full text-center",children:x.name})]}),u.jsx("button",{type:"button",onClick:T=>{T.stopPropagation(),y(S)},className:"absolute top-1 right-1 w-6 h-6 rounded bg-bg-tertiary border border-border flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity z-10 hover:border-text-muted",title:"Edit",children:u.jsx("span",{className:"text-xs",children:"✎"})}),u.jsx("button",{type:"button",onClick:T=>v(T,S),className:"absolute -top-1 -left-1 w-5 h-5 rounded-full bg-accent-error text-white flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity z-20",children:u.jsx(Zm,{className:"w-3 h-3"})})]},x.id)})})]}),e&&u.jsx(Dj,{isOpen:!0,isNew:e.type==="new",presetIndex:e.presetIndex,basePresetId:e.basePresetId,presetName:e.presetName,initialTokens:e.tokens,onClose:k,onSave:w})]})}function Nu(){const e=tn(a=>a.settings),t=tn(a=>a.loading),n=tn(a=>a.getSetting),s=tn(a=>a.setSetting);return{settings:e,loading:t,getSetting:n,setSetting:s}}function Rj({isOpen:e,onClose:t}){const[n,s]=O.useState("instructions");return u.jsx(Nt,{isOpen:e,onClose:t,title:"Settings",size:"xl",minHeight:"500px",children:u.jsxs("div",{className:"flex flex-col h-full",children:[u.jsxs("div",{className:"flex border-b border-border mb-4 -mt-1",children:[u.jsx(pa,{label:"Instructions",active:n==="instructions",onClick:()=>s("instructions")}),u.jsx(pa,{label:"Skills",active:n==="skills",onClick:()=>s("skills")}),u.jsx(pa,{label:"Notifications",active:n==="notifications",onClick:()=>s("notifications")}),u.jsx(pa,{label:"Display",active:n==="display",onClick:()=>s("display")}),u.jsx(pa,{label:"Shortcuts",active:n==="keybindings",onClick:()=>s("keybindings")}),u.jsx(pa,{label:"Advanced",active:n==="advanced",onClick:()=>s("advanced")})]}),n==="instructions"&&u.jsx(zj,{isOpen:e}),n==="skills"&&u.jsx(Nj,{isOpen:e}),n==="notifications"&&u.jsx("div",{className:"max-h-[60vh] overflow-y-auto",children:u.jsx(Ej,{})}),n==="display"&&u.jsx(Ij,{}),n==="keybindings"&&u.jsx(Pj,{}),n==="advanced"&&u.jsx(Oj,{onClose:t})]})})}function Oj({onClose:e}){const[,t]=wr(),{settings:n,loading:s,getSetting:a,setSetting:o}=Nu(),c=n[We.LLM_DISABLE_XML_PROTECTION]==="true",l=s[We.LLM_DISABLE_XML_PROTECTION]??!1;O.useEffect(()=>{a(We.LLM_DISABLE_XML_PROTECTION)},[a]);const h=async()=>{const p=String(!c);await o(We.LLM_DISABLE_XML_PROTECTION,p)};function f(){e(),t("/onboarding")}return l?u.jsx("div",{className:"text-sm text-text-muted",children:"Loading..."}):u.jsxs("div",{className:"space-y-6",children:[u.jsx("div",{children:u.jsxs("label",{className:"flex items-center justify-between cursor-pointer",children:[u.jsxs("div",{children:[u.jsx("div",{className:"text-sm font-medium text-text-primary",children:"Disable XML Tool Call Protection"}),u.jsx("div",{className:"text-xs text-text-muted mt-0.5",children:"Allow the model to output XML tool call format instead of JSON function calls. Some third-party providers may require this."})]}),u.jsx("button",{type:"button",onClick:h,className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${c?"bg-accent-primary":"bg-bg-tertiary"}`,children:u.jsx("span",{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${c?"translate-x-6":"translate-x-1"}`})})]})}),u.jsx("hr",{className:"border-border"}),u.jsxs("div",{children:[u.jsx("h3",{className:"text-sm font-medium text-text-primary mb-1",children:"Onboarding"}),u.jsx("p",{className:"text-sm text-text-muted mb-4",children:"Reset your OpenFox setup and go through the initial configuration again."}),u.jsx(rt,{variant:"secondary",onClick:f,children:"Launch Onboarding"})]})]})}function Mj(){return u.jsx(Lj,{})}function Ij(){const{settings:e,loading:t,getSetting:n,setSetting:s}=Nu(),a=t[We.DISPLAY_SHOW_THINKING]??!1,o=[{key:We.DISPLAY_SHOW_THINKING,label:"Show thinking blocks",description:"Display AI reasoning content in the feed"},{key:We.DISPLAY_SHOW_VERBOSE_TOOL_OUTPUT,label:"Show expanded tool output",description:"Always show full tool call details instead of compact view"},{key:We.DISPLAY_SHOW_STATS,label:"Show stats bar",description:"Display model, tokens, and timing information"},{key:We.DISPLAY_SHOW_AGENT_DEFINITIONS,label:"Show agent definitions",description:"Display agent definition injections in the feed"},{key:We.DISPLAY_SHOW_WORKFLOW_BARS,label:"Show workflow bars",description:"Display workflow start and end markers"},{key:We.DISPLAY_SHOW_SYNTAX_HIGHLIGHTING,label:"Show syntax highlighting",description:"Nicer formatting, but very slow - does not affect red/green diff coloring"}],c=Object.fromEntries(o.map(p=>[p.key,e[p.key]??"true"])),[l,h]=O.useState(()=>Object.fromEntries(o.map(p=>[p.key,c[p.key]==="true"])));O.useEffect(()=>{o.forEach(p=>n(p.key))},[n]),O.useEffect(()=>{h(Object.fromEntries(o.map(p=>[p.key,c[p.key]==="true"])))},[JSON.stringify(c)]);const f=async p=>{const m=String(!l[p]);h(_=>({..._,[p]:!_[p]})),await s(p,m)};return a?u.jsx("div",{className:"text-sm text-text-muted",children:"Loading..."}):u.jsxs("div",{className:"space-y-6",children:[u.jsx(Mj,{}),u.jsxs("div",{children:[u.jsx("h3",{className:"text-sm font-medium text-text-primary mb-4",children:"Feed Display"}),u.jsx("div",{className:"space-y-4",children:o.map(({key:p,label:m,description:_})=>u.jsxs("label",{className:"flex items-center justify-between cursor-pointer",children:[u.jsxs("div",{children:[u.jsx("div",{className:"text-sm text-text-primary",children:m}),u.jsx("div",{className:"text-xs text-text-muted",children:_})]}),u.jsx("button",{type:"button",onClick:()=>f(p),className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${l[p]?"bg-accent-primary":"bg-bg-tertiary"}`,children:u.jsx("span",{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${l[p]?"translate-x-6":"translate-x-1"}`})})]},p))})]})]})}function Pj(){const{settings:e,loading:t,getSetting:n,setSetting:s}=Nu(),a=e[We.KEYBINDINGS],o=t[We.KEYBINDINGS]??!1,c=hm(a),[l,h]=O.useState(null);O.useEffect(()=>{n(We.KEYBINDINGS)},[n]);const f=[{id:"terminalToggle",label:"Toggle Terminal",binding:c.terminalToggle},{id:"quickAction",label:"Quick Action",binding:c.quickAction},...c.agentSwitching.map((y,w)=>({id:`agentSwitching.${w}`,label:`Switch to Agent ${w+1}`,binding:y}))],p=y=>{h(y)},m=O.useCallback(y=>{if(!l)return;const w=hm(a),k=structuredClone(w);if(l.startsWith("agentSwitching.")){const v=parseInt(l.split(".")[1],10);k.agentSwitching[v]=y}else l==="terminalToggle"?k.terminalToggle=y:l==="quickAction"&&(k.quickAction=y);h(null),s(We.KEYBINDINGS,JSON.stringify(k))},[l,a,s]),_=()=>{s(We.KEYBINDINGS,JSON.stringify(wa))};return u.jsxs("div",{className:"space-y-4",children:[u.jsxs("div",{className:"flex items-center justify-between mb-2",children:[u.jsx("h3",{className:"text-sm font-medium text-text-primary",children:"Keyboard Shortcuts"}),u.jsx("button",{type:"button",onClick:_,disabled:o,className:"text-xs text-text-muted hover:text-text-primary px-2 py-1 rounded hover:bg-bg-tertiary transition-colors disabled:opacity-30",children:"Reset to defaults"})]}),o?u.jsx("div",{className:"text-sm text-text-muted",children:"Loading..."}):u.jsx("div",{className:"space-y-1",children:f.map(y=>u.jsx(Bj,{label:y.label,binding:y.binding,isRecording:l===y.id,onStartRecording:()=>p(y.id),onBindingRecorded:m,onCancelRecording:()=>h(null)},y.id))})]})}function Bj({label:e,binding:t,isRecording:n,onStartRecording:s,onBindingRecorded:a,onCancelRecording:o}){const c=O.useRef(null),l=O.useRef(0),h=O.useRef("");return O.useEffect(()=>{if(!n)return;const f=new Set(["Control","Shift","Alt","Meta"]);let p=[];const m=y=>{if(y.preventDefault(),y.stopPropagation(),y.key==="Escape"){o();return}if(f.has(y.key)){y.ctrlKey&&!p.includes("ctrl")&&p.push("ctrl"),y.metaKey&&!p.includes("meta")&&p.push("meta"),y.altKey&&!p.includes("alt")&&p.push("alt"),y.shiftKey&&!p.includes("shift")&&p.push("shift");return}if(p.length>0||y.ctrlKey||y.metaKey||y.altKey||y.shiftKey){const v=[...p];y.ctrlKey&&!v.includes("ctrl")&&v.push("ctrl"),y.metaKey&&!v.includes("meta")&&v.push("meta"),y.altKey&&!v.includes("alt")&&v.push("alt"),y.shiftKey&&!v.includes("shift")&&v.push("shift"),a({type:"chord",key:Ev(y),modifiers:v});return}const w=Date.now(),k=Ev(y);if(k===h.current&&w-l.current<400){a({type:"double-press",key:k,threshold:300});return}l.current=w,h.current=k},_=y=>{y.key==="Control"&&(p=p.filter(w=>w!=="ctrl")),y.key==="Shift"&&(p=p.filter(w=>w!=="shift")),y.key==="Alt"&&(p=p.filter(w=>w!=="alt")),y.key==="Meta"&&(p=p.filter(w=>w!=="meta"))};return window.addEventListener("keydown",m,!0),window.addEventListener("keyup",_,!0),()=>{window.removeEventListener("keydown",m,!0),window.removeEventListener("keyup",_,!0)}},[n,a,o]),u.jsxs("div",{ref:c,className:`flex items-center justify-between px-3 py-2 rounded transition-colors ${n?"bg-accent-primary/10 ring-1 ring-accent-primary":"hover:bg-bg-tertiary"}`,children:[u.jsx("span",{className:"text-sm text-text-primary",children:e}),u.jsx("div",{className:"flex items-center gap-2",children:n?u.jsx("span",{className:"text-xs text-accent-primary font-medium animate-pulse",children:"Press shortcut..."}):u.jsx("button",{type:"button",onClick:s,className:"px-2 py-0.5 text-xs font-mono bg-bg-tertiary text-text-secondary rounded border border-border hover:border-accent-primary hover:text-accent-primary transition-colors",children:sS(t)})})]})}function pa({label:e,active:t,onClick:n}){return u.jsx("button",{onClick:n,className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${t?"border-accent-primary text-accent-primary":"border-transparent text-text-muted hover:text-text-secondary hover:border-border"}`,children:e})}function zj({isOpen:e}){const{settings:t,loading:n,getSetting:s,setSetting:a}=Nu(),o=t[We.GLOBAL_INSTRUCTIONS]??"",c=n[We.GLOBAL_INSTRUCTIONS]??!1,[l,h]=O.useState(o),[f,p]=O.useState(!1),[m,_]=O.useState(!1);O.useEffect(()=>{e&&s(We.GLOBAL_INSTRUCTIONS)},[e,s]),O.useEffect(()=>{h(o),p(!1)},[o]);const y=async()=>{_(!0),await a(We.GLOBAL_INSTRUCTIONS,l),_(!1),p(!1)},w=()=>{h(o),p(!1)},k=c||m;return u.jsxs("div",{className:"space-y-4",children:[u.jsxs("div",{children:[u.jsx("label",{className:"block text-sm font-medium text-text-primary mb-2",children:"Global Instructions"}),u.jsx("p",{className:"text-sm text-text-muted mb-2",children:"These instructions are injected into every prompt, regardless of project."}),u.jsx("textarea",{value:l,onChange:v=>{h(v.target.value),p(!0)},placeholder:"Enter global instructions that apply to all projects...",className:"w-full min-h-80 px-3 py-2 bg-bg-tertiary border border-border rounded text-sm font-mono resize-y focus:outline-none focus:ring-1 focus:ring-accent-primary",disabled:k})]}),f&&u.jsx(op,{}),u.jsxs("div",{className:"flex justify-end gap-2",children:[u.jsx(rt,{variant:"secondary",onClick:w,disabled:!f,children:"Discard"}),u.jsx(rt,{variant:"primary",onClick:y,disabled:!f||k,children:m?"Saving...":"Save"})]})]})}var Cf={exports:{}},Av;function Hj(){return Av||(Av=1,(function(e,t){(function(n,s){e.exports=s()})(globalThis,(()=>(()=>{var n={4567:function(c,l,h){var f=this&&this.__decorate||function(x,S,j,N){var T,D=arguments.length,A=D<3?S:N===null?N=Object.getOwnPropertyDescriptor(S,j):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(x,S,j,N);else for(var B=x.length-1;B>=0;B--)(T=x[B])&&(A=(D<3?T(A):D>3?T(S,j,A):T(S,j))||A);return D>3&&A&&Object.defineProperty(S,j,A),A},p=this&&this.__param||function(x,S){return function(j,N){S(j,N,x)}};Object.defineProperty(l,"__esModule",{value:!0}),l.AccessibilityManager=void 0;const m=h(9042),_=h(9924),y=h(844),w=h(4725),k=h(2585),v=h(3656);let b=l.AccessibilityManager=class extends y.Disposable{constructor(x,S,j,N){super(),this._terminal=x,this._coreBrowserService=j,this._renderService=N,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let T=0;T<this._terminal.rows;T++)this._rowElements[T]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[T]);if(this._topBoundaryFocusListener=T=>this._handleBoundaryFocus(T,0),this._bottomBoundaryFocusListener=T=>this._handleBoundaryFocus(T,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new _.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((T=>this._handleResize(T.rows)))),this.register(this._terminal.onRender((T=>this._refreshRows(T.start,T.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((T=>this._handleChar(T)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
59
+ `)))),this.register(this._terminal.onA11yTab((T=>this._handleTab(T)))),this.register(this._terminal.onKey((T=>this._handleKey(T.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,v.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,y.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(x){for(let S=0;S<x;S++)this._handleChar(" ")}_handleChar(x){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==x&&(this._charsToAnnounce+=x):this._charsToAnnounce+=x,x===`
60
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=m.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(x){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(x)||this._charsToConsume.push(x)}_refreshRows(x,S){this._liveRegionDebouncer.refresh(x,S,this._terminal.rows)}_renderRows(x,S){const j=this._terminal.buffer,N=j.lines.length.toString();for(let T=x;T<=S;T++){const D=j.lines.get(j.ydisp+T),A=[],B=(D==null?void 0:D.translateToString(!0,void 0,void 0,A))||"",R=(j.ydisp+T+1).toString(),$=this._rowElements[T];$&&(B.length===0?($.innerText=" ",this._rowColumns.set($,[0,1])):($.textContent=B,this._rowColumns.set($,A)),$.setAttribute("aria-posinset",R),$.setAttribute("aria-setsize",N))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(x,S){const j=x.target,N=this._rowElements[S===0?1:this._rowElements.length-2];if(j.getAttribute("aria-posinset")===(S===0?"1":`${this._terminal.buffer.lines.length}`)||x.relatedTarget!==N)return;let T,D;if(S===0?(T=j,D=this._rowElements.pop(),this._rowContainer.removeChild(D)):(T=this._rowElements.shift(),D=j,this._rowContainer.removeChild(T)),T.removeEventListener("focus",this._topBoundaryFocusListener),D.removeEventListener("focus",this._bottomBoundaryFocusListener),S===0){const A=this._createAccessibilityTreeNode();this._rowElements.unshift(A),this._rowContainer.insertAdjacentElement("afterbegin",A)}else{const A=this._createAccessibilityTreeNode();this._rowElements.push(A),this._rowContainer.appendChild(A)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(S===0?-1:1),this._rowElements[S===0?1:this._rowElements.length-2].focus(),x.preventDefault(),x.stopImmediatePropagation()}_handleSelectionChange(){var B;if(this._rowElements.length===0)return;const x=document.getSelection();if(!x)return;if(x.isCollapsed)return void(this._rowContainer.contains(x.anchorNode)&&this._terminal.clearSelection());if(!x.anchorNode||!x.focusNode)return void console.error("anchorNode and/or focusNode are null");let S={node:x.anchorNode,offset:x.anchorOffset},j={node:x.focusNode,offset:x.focusOffset};if((S.node.compareDocumentPosition(j.node)&Node.DOCUMENT_POSITION_PRECEDING||S.node===j.node&&S.offset>j.offset)&&([S,j]=[j,S]),S.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(S={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(S.node))return;const N=this._rowElements.slice(-1)[0];if(j.node.compareDocumentPosition(N)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(j={node:N,offset:((B=N.textContent)==null?void 0:B.length)??0}),!this._rowContainer.contains(j.node))return;const T=({node:R,offset:$})=>{const F=R instanceof Text?R.parentNode:R;let W=parseInt(F==null?void 0:F.getAttribute("aria-posinset"),10)-1;if(isNaN(W))return console.warn("row is invalid. Race condition?"),null;const Y=this._rowColumns.get(F);if(!Y)return console.warn("columns is null. Race condition?"),null;let P=$<Y.length?Y[$]:Y.slice(-1)[0]+1;return P>=this._terminal.cols&&(++W,P=0),{row:W,column:P}},D=T(S),A=T(j);if(D&&A){if(D.row>A.row||D.row===A.row&&D.column>=A.column)throw new Error("invalid range");this._terminal.select(D.column,D.row,(A.row-D.row)*this._terminal.cols-D.column+A.column)}}_handleResize(x){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let S=this._rowContainer.children.length;S<this._terminal.rows;S++)this._rowElements[S]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[S]);for(;this._rowElements.length>x;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const x=this._coreBrowserService.mainDocument.createElement("div");return x.setAttribute("role","listitem"),x.tabIndex=-1,this._refreshRowDimensions(x),x}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let x=0;x<this._terminal.rows;x++)this._refreshRowDimensions(this._rowElements[x])}}_refreshRowDimensions(x){x.style.height=`${this._renderService.dimensions.css.cell.height}px`}};l.AccessibilityManager=b=f([p(1,k.IInstantiationService),p(2,w.ICoreBrowserService),p(3,w.IRenderService)],b)},3614:(c,l)=>{function h(_){return _.replace(/\r?\n/g,"\r")}function f(_,y){return y?"\x1B[200~"+_+"\x1B[201~":_}function p(_,y,w,k){_=f(_=h(_),w.decPrivateModes.bracketedPasteMode&&k.rawOptions.ignoreBracketedPasteMode!==!0),w.triggerDataEvent(_,!0),y.value=""}function m(_,y,w){const k=w.getBoundingClientRect(),v=_.clientX-k.left-10,b=_.clientY-k.top-10;y.style.width="20px",y.style.height="20px",y.style.left=`${v}px`,y.style.top=`${b}px`,y.style.zIndex="1000",y.focus()}Object.defineProperty(l,"__esModule",{value:!0}),l.rightClickHandler=l.moveTextAreaUnderMouseCursor=l.paste=l.handlePasteEvent=l.copyHandler=l.bracketTextForPaste=l.prepareTextForTerminal=void 0,l.prepareTextForTerminal=h,l.bracketTextForPaste=f,l.copyHandler=function(_,y){_.clipboardData&&_.clipboardData.setData("text/plain",y.selectionText),_.preventDefault()},l.handlePasteEvent=function(_,y,w,k){_.stopPropagation(),_.clipboardData&&p(_.clipboardData.getData("text/plain"),y,w,k)},l.paste=p,l.moveTextAreaUnderMouseCursor=m,l.rightClickHandler=function(_,y,w,k,v){m(_,y,w),v&&k.rightClickSelect(_),y.value=k.selectionText,y.select()}},7239:(c,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ColorContrastCache=void 0;const f=h(1505);l.ColorContrastCache=class{constructor(){this._color=new f.TwoKeyMap,this._css=new f.TwoKeyMap}setCss(p,m,_){this._css.set(p,m,_)}getCss(p,m){return this._css.get(p,m)}setColor(p,m,_){this._color.set(p,m,_)}getColor(p,m){return this._color.get(p,m)}clear(){this._color.clear(),this._css.clear()}}},3656:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.addDisposableDomListener=void 0,l.addDisposableDomListener=function(h,f,p,m){h.addEventListener(f,p,m);let _=!1;return{dispose:()=>{_||(_=!0,h.removeEventListener(f,p,m))}}}},3551:function(c,l,h){var f=this&&this.__decorate||function(b,x,S,j){var N,T=arguments.length,D=T<3?x:j===null?j=Object.getOwnPropertyDescriptor(x,S):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(b,x,S,j);else for(var A=b.length-1;A>=0;A--)(N=b[A])&&(D=(T<3?N(D):T>3?N(x,S,D):N(x,S))||D);return T>3&&D&&Object.defineProperty(x,S,D),D},p=this&&this.__param||function(b,x){return function(S,j){x(S,j,b)}};Object.defineProperty(l,"__esModule",{value:!0}),l.Linkifier=void 0;const m=h(3656),_=h(8460),y=h(844),w=h(2585),k=h(4725);let v=l.Linkifier=class extends y.Disposable{get currentLink(){return this._currentLink}constructor(b,x,S,j,N){super(),this._element=b,this._mouseService=x,this._renderService=S,this._bufferService=j,this._linkProviderService=N,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new _.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new _.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,y.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,y.toDisposable)((()=>{var T;this._lastMouseEvent=void 0,(T=this._activeProviderReplies)==null||T.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,m.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,m.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,m.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,m.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(b){this._lastMouseEvent=b;const x=this._positionFromMouseEvent(b,this._element,this._mouseService);if(!x)return;this._isMouseOut=!1;const S=b.composedPath();for(let j=0;j<S.length;j++){const N=S[j];if(N.classList.contains("xterm"))break;if(N.classList.contains("xterm-hover"))return}this._lastBufferCell&&x.x===this._lastBufferCell.x&&x.y===this._lastBufferCell.y||(this._handleHover(x),this._lastBufferCell=x)}_handleHover(b){if(this._activeLine!==b.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(b,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,b)||(this._clearCurrentLink(),this._askForLink(b,!0))}_askForLink(b,x){var j,N;this._activeProviderReplies&&x||((j=this._activeProviderReplies)==null||j.forEach((T=>{T==null||T.forEach((D=>{D.link.dispose&&D.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=b.y);let S=!1;for(const[T,D]of this._linkProviderService.linkProviders.entries())x?(N=this._activeProviderReplies)!=null&&N.get(T)&&(S=this._checkLinkProviderResult(T,b,S)):D.provideLinks(b.y,(A=>{var R,$;if(this._isMouseOut)return;const B=A==null?void 0:A.map((F=>({link:F})));(R=this._activeProviderReplies)==null||R.set(T,B),S=this._checkLinkProviderResult(T,b,S),(($=this._activeProviderReplies)==null?void 0:$.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(b.y,this._activeProviderReplies)}))}_removeIntersectingLinks(b,x){const S=new Set;for(let j=0;j<x.size;j++){const N=x.get(j);if(N)for(let T=0;T<N.length;T++){const D=N[T],A=D.link.range.start.y<b?0:D.link.range.start.x,B=D.link.range.end.y>b?this._bufferService.cols:D.link.range.end.x;for(let R=A;R<=B;R++){if(S.has(R)){N.splice(T--,1);break}S.add(R)}}}}_checkLinkProviderResult(b,x,S){var T;if(!this._activeProviderReplies)return S;const j=this._activeProviderReplies.get(b);let N=!1;for(let D=0;D<b;D++)this._activeProviderReplies.has(D)&&!this._activeProviderReplies.get(D)||(N=!0);if(!N&&j){const D=j.find((A=>this._linkAtPosition(A.link,x)));D&&(S=!0,this._handleNewLink(D))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!S)for(let D=0;D<this._activeProviderReplies.size;D++){const A=(T=this._activeProviderReplies.get(D))==null?void 0:T.find((B=>this._linkAtPosition(B.link,x)));if(A){S=!0,this._handleNewLink(A);break}}return S}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(b){if(!this._currentLink)return;const x=this._positionFromMouseEvent(b,this._element,this._mouseService);x&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,x)&&this._currentLink.link.activate(b,this._currentLink.link.text)}_clearCurrentLink(b,x){this._currentLink&&this._lastMouseEvent&&(!b||!x||this._currentLink.link.range.start.y>=b&&this._currentLink.link.range.end.y<=x)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,y.disposeArray)(this._linkCacheDisposables))}_handleNewLink(b){if(!this._lastMouseEvent)return;const x=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);x&&this._linkAtPosition(b.link,x)&&(this._currentLink=b,this._currentLink.state={decorations:{underline:b.link.decorations===void 0||b.link.decorations.underline,pointerCursor:b.link.decorations===void 0||b.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,b.link,this._lastMouseEvent),b.link.decorations={},Object.defineProperties(b.link.decorations,{pointerCursor:{get:()=>{var S,j;return(j=(S=this._currentLink)==null?void 0:S.state)==null?void 0:j.decorations.pointerCursor},set:S=>{var j;(j=this._currentLink)!=null&&j.state&&this._currentLink.state.decorations.pointerCursor!==S&&(this._currentLink.state.decorations.pointerCursor=S,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",S))}},underline:{get:()=>{var S,j;return(j=(S=this._currentLink)==null?void 0:S.state)==null?void 0:j.decorations.underline},set:S=>{var j,N,T;(j=this._currentLink)!=null&&j.state&&((T=(N=this._currentLink)==null?void 0:N.state)==null?void 0:T.decorations.underline)!==S&&(this._currentLink.state.decorations.underline=S,this._currentLink.state.isHovered&&this._fireUnderlineEvent(b.link,S))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((S=>{if(!this._currentLink)return;const j=S.start===0?0:S.start+1+this._bufferService.buffer.ydisp,N=this._bufferService.buffer.ydisp+1+S.end;if(this._currentLink.link.range.start.y>=j&&this._currentLink.link.range.end.y<=N&&(this._clearCurrentLink(j,N),this._lastMouseEvent)){const T=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);T&&this._askForLink(T,!1)}}))))}_linkHover(b,x,S){var j;(j=this._currentLink)!=null&&j.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(x,!0),this._currentLink.state.decorations.pointerCursor&&b.classList.add("xterm-cursor-pointer")),x.hover&&x.hover(S,x.text)}_fireUnderlineEvent(b,x){const S=b.range,j=this._bufferService.buffer.ydisp,N=this._createLinkUnderlineEvent(S.start.x-1,S.start.y-j-1,S.end.x,S.end.y-j-1,void 0);(x?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(N)}_linkLeave(b,x,S){var j;(j=this._currentLink)!=null&&j.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(x,!1),this._currentLink.state.decorations.pointerCursor&&b.classList.remove("xterm-cursor-pointer")),x.leave&&x.leave(S,x.text)}_linkAtPosition(b,x){const S=b.range.start.y*this._bufferService.cols+b.range.start.x,j=b.range.end.y*this._bufferService.cols+b.range.end.x,N=x.y*this._bufferService.cols+x.x;return S<=N&&N<=j}_positionFromMouseEvent(b,x,S){const j=S.getCoords(b,x,this._bufferService.cols,this._bufferService.rows);if(j)return{x:j[0],y:j[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(b,x,S,j,N){return{x1:b,y1:x,x2:S,y2:j,cols:this._bufferService.cols,fg:N}}};l.Linkifier=v=f([p(1,k.IMouseService),p(2,k.IRenderService),p(3,w.IBufferService),p(4,k.ILinkProviderService)],v)},9042:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.tooMuchOutput=l.promptLabel=void 0,l.promptLabel="Terminal input",l.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(c,l,h){var f=this&&this.__decorate||function(k,v,b,x){var S,j=arguments.length,N=j<3?v:x===null?x=Object.getOwnPropertyDescriptor(v,b):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(k,v,b,x);else for(var T=k.length-1;T>=0;T--)(S=k[T])&&(N=(j<3?S(N):j>3?S(v,b,N):S(v,b))||N);return j>3&&N&&Object.defineProperty(v,b,N),N},p=this&&this.__param||function(k,v){return function(b,x){v(b,x,k)}};Object.defineProperty(l,"__esModule",{value:!0}),l.OscLinkProvider=void 0;const m=h(511),_=h(2585);let y=l.OscLinkProvider=class{constructor(k,v,b){this._bufferService=k,this._optionsService=v,this._oscLinkService=b}provideLinks(k,v){var B;const b=this._bufferService.buffer.lines.get(k-1);if(!b)return void v(void 0);const x=[],S=this._optionsService.rawOptions.linkHandler,j=new m.CellData,N=b.getTrimmedLength();let T=-1,D=-1,A=!1;for(let R=0;R<N;R++)if(D!==-1||b.hasContent(R)){if(b.loadCell(R,j),j.hasExtendedAttrs()&&j.extended.urlId){if(D===-1){D=R,T=j.extended.urlId;continue}A=j.extended.urlId!==T}else D!==-1&&(A=!0);if(A||D!==-1&&R===N-1){const $=(B=this._oscLinkService.getLinkData(T))==null?void 0:B.uri;if($){const F={start:{x:D+1,y:k},end:{x:R+(A||R!==N-1?0:1),y:k}};let W=!1;if(!(S!=null&&S.allowNonHttpProtocols))try{const Y=new URL($);["http:","https:"].includes(Y.protocol)||(W=!0)}catch{W=!0}W||x.push({text:$,range:F,activate:(Y,P)=>S?S.activate(Y,P,F):w(0,P),hover:(Y,P)=>{var H;return(H=S==null?void 0:S.hover)==null?void 0:H.call(S,Y,P,F)},leave:(Y,P)=>{var H;return(H=S==null?void 0:S.leave)==null?void 0:H.call(S,Y,P,F)}})}A=!1,j.hasExtendedAttrs()&&j.extended.urlId?(D=R,T=j.extended.urlId):(D=-1,T=-1)}}v(x)}};function w(k,v){if(confirm(`Do you want to navigate to ${v}?
61
+
62
+ WARNING: This link could potentially be dangerous`)){const b=window.open();if(b){try{b.opener=null}catch{}b.location.href=v}else console.warn("Opening link blocked as opener could not be cleared")}}l.OscLinkProvider=y=f([p(0,_.IBufferService),p(1,_.IOptionsService),p(2,_.IOscLinkService)],y)},6193:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.RenderDebouncer=void 0,l.RenderDebouncer=class{constructor(h,f){this._renderCallback=h,this._coreBrowserService=f,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(h){return this._refreshCallbacks.push(h),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(h,f,p){this._rowCount=p,h=h!==void 0?h:0,f=f!==void 0?f:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,h):h,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,f):f,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();const h=Math.max(this._rowStart,0),f=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(h,f),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const h of this._refreshCallbacks)h(0);this._refreshCallbacks=[]}}},3236:(c,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Terminal=void 0;const f=h(3614),p=h(3656),m=h(3551),_=h(9042),y=h(3730),w=h(1680),k=h(3107),v=h(5744),b=h(2950),x=h(1296),S=h(428),j=h(4269),N=h(5114),T=h(8934),D=h(3230),A=h(9312),B=h(4725),R=h(6731),$=h(8055),F=h(8969),W=h(8460),Y=h(844),P=h(6114),H=h(8437),J=h(2584),K=h(7399),I=h(5941),L=h(9074),z=h(2585),V=h(5435),U=h(4567),ee=h(779);class Z extends F.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(X={}){super(X),this.browser=P,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new Y.MutableDisposable),this._onCursorMove=this.register(new W.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new W.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new W.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new W.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new W.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new W.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new W.EventEmitter),this._onBlur=this.register(new W.EventEmitter),this._onA11yCharEmitter=this.register(new W.EventEmitter),this._onA11yTabEmitter=this.register(new W.EventEmitter),this._onWillOpen=this.register(new W.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(L.DecorationService),this._instantiationService.setService(z.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(ee.LinkProviderService),this._instantiationService.setService(B.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(y.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((G,le)=>this.refresh(G,le)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((G=>this._reportWindowsOptions(G)))),this.register(this._inputHandler.onColor((G=>this._handleColorEvent(G)))),this.register((0,W.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,W.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,W.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,W.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((G=>this._afterResize(G.cols,G.rows)))),this.register((0,Y.toDisposable)((()=>{var G,le;this._customKeyEventHandler=void 0,(le=(G=this.element)==null?void 0:G.parentNode)==null||le.removeChild(this.element)})))}_handleColorEvent(X){if(this._themeService)for(const G of X){let le,se="";switch(G.index){case 256:le="foreground",se="10";break;case 257:le="background",se="11";break;case 258:le="cursor",se="12";break;default:le="ansi",se="4;"+G.index}switch(G.type){case 0:const ve=$.color.toColorRGB(le==="ansi"?this._themeService.colors.ansi[G.index]:this._themeService.colors[le]);this.coreService.triggerDataEvent(`${J.C0.ESC}]${se};${(0,I.toRgbString)(ve)}${J.C1_ESCAPED.ST}`);break;case 1:if(le==="ansi")this._themeService.modifyColors((be=>be.ansi[G.index]=$.channels.toColor(...G.color)));else{const be=le;this._themeService.modifyColors((Oe=>Oe[be]=$.channels.toColor(...G.color)))}break;case 2:this._themeService.restoreColor(G.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(X){X?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(U.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(X){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(J.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var X;return(X=this.textarea)==null?void 0:X.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(J.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const X=this.buffer.ybase+this.buffer.y,G=this.buffer.lines.get(X);if(!G)return;const le=Math.min(this.buffer.x,this.cols-1),se=this._renderService.dimensions.css.cell.height,ve=G.getWidth(le),be=this._renderService.dimensions.css.cell.width*ve,Oe=this.buffer.y*this._renderService.dimensions.css.cell.height,Be=le*this._renderService.dimensions.css.cell.width;this.textarea.style.left=Be+"px",this.textarea.style.top=Oe+"px",this.textarea.style.width=be+"px",this.textarea.style.height=se+"px",this.textarea.style.lineHeight=se+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,p.addDisposableDomListener)(this.element,"copy",(G=>{this.hasSelection()&&(0,f.copyHandler)(G,this._selectionService)})));const X=G=>(0,f.handlePasteEvent)(G,this.textarea,this.coreService,this.optionsService);this.register((0,p.addDisposableDomListener)(this.textarea,"paste",X)),this.register((0,p.addDisposableDomListener)(this.element,"paste",X)),P.isFirefox?this.register((0,p.addDisposableDomListener)(this.element,"mousedown",(G=>{G.button===2&&(0,f.rightClickHandler)(G,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,p.addDisposableDomListener)(this.element,"contextmenu",(G=>{(0,f.rightClickHandler)(G,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),P.isLinux&&this.register((0,p.addDisposableDomListener)(this.element,"auxclick",(G=>{G.button===1&&(0,f.moveTextAreaUnderMouseCursor)(G,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,p.addDisposableDomListener)(this.textarea,"keyup",(X=>this._keyUp(X)),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"keydown",(X=>this._keyDown(X)),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"keypress",(X=>this._keyPress(X)),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionupdate",(X=>this._compositionHelper.compositionupdate(X)))),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,p.addDisposableDomListener)(this.textarea,"input",(X=>this._inputEvent(X)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(X){var le;if(!X)throw new Error("Terminal requires a parent element.");if(X.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((le=this.element)==null?void 0:le.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=X.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),X.appendChild(this.element);const G=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),G.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,p.addDisposableDomListener)(this.screenElement,"mousemove",(se=>this.updateCursorStyle(se)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),G.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",_.promptLabel),P.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(N.CoreBrowserService,this.textarea,X.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(B.ICoreBrowserService,this._coreBrowserService),this.register((0,p.addDisposableDomListener)(this.textarea,"focus",(se=>this._handleTextAreaFocus(se)))),this.register((0,p.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(S.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(B.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(R.ThemeService),this._instantiationService.setService(B.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(j.CharacterJoinerService),this._instantiationService.setService(B.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(D.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(B.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((se=>this._onRender.fire(se)))),this.onResize((se=>this._renderService.resize(se.cols,se.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(b.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(T.MouseService),this._instantiationService.setService(B.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(m.Linkifier,this.screenElement)),this.element.appendChild(G);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(w.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((se=>this.scrollLines(se.amount,se.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),this.register(this.onCursorMove((()=>{this._renderService.handleCursorMove(),this._syncTextArea()}))),this.register(this.onResize((()=>this._renderService.handleResize(this.cols,this.rows)))),this.register(this.onBlur((()=>this._renderService.handleBlur()))),this.register(this.onFocus((()=>this._renderService.handleFocus()))),this.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(A.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(B.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((se=>this.scrollLines(se.amount,se.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((se=>this._renderService.handleSelectionChanged(se.start,se.end,se.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((se=>{this.textarea.value=se,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((se=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,p.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(k.BufferDecorationRenderer,this.screenElement)),this.register((0,p.addDisposableDomListener)(this.element,"mousedown",(se=>this._selectionService.handleMouseDown(se)))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(U.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(se=>this._handleScreenReaderModeOptionChange(se)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(v.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(se=>{!this._overviewRulerRenderer&&se&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(v.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(x.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const X=this,G=this.element;function le(be){const Oe=X._mouseService.getMouseReportCoords(be,X.screenElement);if(!Oe)return!1;let Be,Pe;switch(be.overrideType||be.type){case"mousemove":Pe=32,be.buttons===void 0?(Be=3,be.button!==void 0&&(Be=be.button<3?be.button:3)):Be=1&be.buttons?0:4&be.buttons?1:2&be.buttons?2:3;break;case"mouseup":Pe=0,Be=be.button<3?be.button:3;break;case"mousedown":Pe=1,Be=be.button<3?be.button:3;break;case"wheel":if(X._customWheelEventHandler&&X._customWheelEventHandler(be)===!1||X.viewport.getLinesScrolled(be)===0)return!1;Pe=be.deltaY<0?0:1,Be=4;break;default:return!1}return!(Pe===void 0||Be===void 0||Be>4)&&X.coreMouseService.triggerMouseEvent({col:Oe.col,row:Oe.row,x:Oe.x,y:Oe.y,button:Be,action:Pe,ctrl:be.ctrlKey,alt:be.altKey,shift:be.shiftKey})}const se={mouseup:null,wheel:null,mousedrag:null,mousemove:null},ve={mouseup:be=>(le(be),be.buttons||(this._document.removeEventListener("mouseup",se.mouseup),se.mousedrag&&this._document.removeEventListener("mousemove",se.mousedrag)),this.cancel(be)),wheel:be=>(le(be),this.cancel(be,!0)),mousedrag:be=>{be.buttons&&le(be)},mousemove:be=>{be.buttons||le(be)}};this.register(this.coreMouseService.onProtocolChange((be=>{be?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(be)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&be?se.mousemove||(G.addEventListener("mousemove",ve.mousemove),se.mousemove=ve.mousemove):(G.removeEventListener("mousemove",se.mousemove),se.mousemove=null),16&be?se.wheel||(G.addEventListener("wheel",ve.wheel,{passive:!1}),se.wheel=ve.wheel):(G.removeEventListener("wheel",se.wheel),se.wheel=null),2&be?se.mouseup||(se.mouseup=ve.mouseup):(this._document.removeEventListener("mouseup",se.mouseup),se.mouseup=null),4&be?se.mousedrag||(se.mousedrag=ve.mousedrag):(this._document.removeEventListener("mousemove",se.mousedrag),se.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,p.addDisposableDomListener)(G,"mousedown",(be=>{if(be.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(be))return le(be),se.mouseup&&this._document.addEventListener("mouseup",se.mouseup),se.mousedrag&&this._document.addEventListener("mousemove",se.mousedrag),this.cancel(be)}))),this.register((0,p.addDisposableDomListener)(G,"wheel",(be=>{if(!se.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(be)===!1)return!1;if(!this.buffer.hasScrollback){const Oe=this.viewport.getLinesScrolled(be);if(Oe===0)return;const Be=J.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(be.deltaY<0?"A":"B");let Pe="";for(let Ve=0;Ve<Math.abs(Oe);Ve++)Pe+=Be;return this.coreService.triggerDataEvent(Pe,!0),this.cancel(be,!0)}return this.viewport.handleWheel(be)?this.cancel(be):void 0}}),{passive:!1})),this.register((0,p.addDisposableDomListener)(G,"touchstart",(be=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(be),this.cancel(be)}),{passive:!0})),this.register((0,p.addDisposableDomListener)(G,"touchmove",(be=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(be)?void 0:this.cancel(be)}),{passive:!1}))}refresh(X,G){var le;(le=this._renderService)==null||le.refreshRows(X,G)}updateCursorStyle(X){var G;(G=this._selectionService)!=null&&G.shouldColumnSelect(X)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(X,G,le=0){var se;le===1?(super.scrollLines(X,G,le),this.refresh(0,this.rows-1)):(se=this.viewport)==null||se.scrollLines(X)}paste(X){(0,f.paste)(X,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(X){this._customKeyEventHandler=X}attachCustomWheelEventHandler(X){this._customWheelEventHandler=X}registerLinkProvider(X){return this._linkProviderService.registerLinkProvider(X)}registerCharacterJoiner(X){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const G=this._characterJoinerService.register(X);return this.refresh(0,this.rows-1),G}deregisterCharacterJoiner(X){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(X)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(X){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+X)}registerDecoration(X){return this._decorationService.registerDecoration(X)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(X,G,le){this._selectionService.setSelection(X,G,le)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var X;(X=this._selectionService)==null||X.clearSelection()}selectAll(){var X;(X=this._selectionService)==null||X.selectAll()}selectLines(X,G){var le;(le=this._selectionService)==null||le.selectLines(X,G)}_keyDown(X){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1)return!1;const G=this.browser.isMac&&this.options.macOptionIsMeta&&X.altKey;if(!G&&!this._compositionHelper.keydown(X))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;G||X.key!=="Dead"&&X.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const le=(0,K.evaluateKeyboardEvent)(X,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(X),le.type===3||le.type===2){const se=this.rows-1;return this.scrollLines(le.type===2?-se:se),this.cancel(X,!0)}return le.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,X)||(le.cancel&&this.cancel(X,!0),!le.key||!!(X.key&&!X.ctrlKey&&!X.altKey&&!X.metaKey&&X.key.length===1&&X.key.charCodeAt(0)>=65&&X.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(le.key!==J.C0.ETX&&le.key!==J.C0.CR||(this.textarea.value=""),this._onKey.fire({key:le.key,domEvent:X}),this._showCursor(),this.coreService.triggerDataEvent(le.key,!0),!this.optionsService.rawOptions.screenReaderMode||X.altKey||X.ctrlKey?this.cancel(X,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(X,G){const le=X.isMac&&!this.options.macOptionIsMeta&&G.altKey&&!G.ctrlKey&&!G.metaKey||X.isWindows&&G.altKey&&G.ctrlKey&&!G.metaKey||X.isWindows&&G.getModifierState("AltGraph");return G.type==="keypress"?le:le&&(!G.keyCode||G.keyCode>47)}_keyUp(X){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1||((function(G){return G.keyCode===16||G.keyCode===17||G.keyCode===18})(X)||this.focus(),this.updateCursorStyle(X),this._keyPressHandled=!1)}_keyPress(X){let G;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1)return!1;if(this.cancel(X),X.charCode)G=X.charCode;else if(X.which===null||X.which===void 0)G=X.keyCode;else{if(X.which===0||X.charCode===0)return!1;G=X.which}return!(!G||(X.altKey||X.ctrlKey||X.metaKey)&&!this._isThirdLevelShift(this.browser,X)||(G=String.fromCharCode(G),this._onKey.fire({key:G,domEvent:X}),this._showCursor(),this.coreService.triggerDataEvent(G,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(X){if(X.data&&X.inputType==="insertText"&&(!X.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const G=X.data;return this.coreService.triggerDataEvent(G,!0),this.cancel(X),!0}return!1}resize(X,G){X!==this.cols||G!==this.rows?super.resize(X,G):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(X,G){var le,se;(le=this._charSizeService)==null||le.measure(),(se=this.viewport)==null||se.syncScrollArea(!0)}clear(){var X;if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let G=1;G<this.rows;G++)this.buffer.lines.push(this.buffer.getBlankLine(H.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(X=this.viewport)==null||X.reset(),this.refresh(0,this.rows-1)}}reset(){var G,le;this.options.rows=this.rows,this.options.cols=this.cols;const X=this._customKeyEventHandler;this._setup(),super.reset(),(G=this._selectionService)==null||G.reset(),this._decorationService.reset(),(le=this.viewport)==null||le.reset(),this._customKeyEventHandler=X,this.refresh(0,this.rows-1)}clearTextureAtlas(){var X;(X=this._renderService)==null||X.clearTextureAtlas()}_reportFocus(){var X;(X=this.element)!=null&&X.classList.contains("focus")?this.coreService.triggerDataEvent(J.C0.ESC+"[I"):this.coreService.triggerDataEvent(J.C0.ESC+"[O")}_reportWindowsOptions(X){if(this._renderService)switch(X){case V.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const G=this._renderService.dimensions.css.canvas.width.toFixed(0),le=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${J.C0.ESC}[4;${le};${G}t`);break;case V.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const se=this._renderService.dimensions.css.cell.width.toFixed(0),ve=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${J.C0.ESC}[6;${ve};${se}t`)}}cancel(X,G){if(this.options.cancelEvents||G)return X.preventDefault(),X.stopPropagation(),!1}}l.Terminal=Z},9924:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.TimeBasedDebouncer=void 0,l.TimeBasedDebouncer=class{constructor(h,f=1e3){this._renderCallback=h,this._debounceThresholdMS=f,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(h,f,p){this._rowCount=p,h=h!==void 0?h:0,f=f!==void 0?f:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,h):h,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,f):f;const m=Date.now();if(m-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=m,this._innerRefresh();else if(!this._additionalRefreshRequested){const _=m-this._lastRefreshMs,y=this._debounceThresholdMS-_;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),y)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const h=Math.max(this._rowStart,0),f=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(h,f)}}},1680:function(c,l,h){var f=this&&this.__decorate||function(b,x,S,j){var N,T=arguments.length,D=T<3?x:j===null?j=Object.getOwnPropertyDescriptor(x,S):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(b,x,S,j);else for(var A=b.length-1;A>=0;A--)(N=b[A])&&(D=(T<3?N(D):T>3?N(x,S,D):N(x,S))||D);return T>3&&D&&Object.defineProperty(x,S,D),D},p=this&&this.__param||function(b,x){return function(S,j){x(S,j,b)}};Object.defineProperty(l,"__esModule",{value:!0}),l.Viewport=void 0;const m=h(3656),_=h(4725),y=h(8460),w=h(844),k=h(2585);let v=l.Viewport=class extends w.Disposable{constructor(b,x,S,j,N,T,D,A){super(),this._viewportElement=b,this._scrollArea=x,this._bufferService=S,this._optionsService=j,this._charSizeService=N,this._renderService=T,this._coreBrowserService=D,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new y.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,m.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((B=>this._activeBuffer=B.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((B=>this._renderDimensions=B))),this._handleThemeChange(A.colors),this.register(A.onChangeColors((B=>this._handleThemeChange(B)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(b){this._viewportElement.style.backgroundColor=b.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(b){if(b)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const x=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==x&&(this._lastRecordedBufferHeight=x,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const b=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==b&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=b),this._refreshAnimationFrame=null}syncScrollArea(b=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(b);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(b)}_handleScroll(b){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const x=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:x,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const b=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(b*(this._smoothScrollState.target-this._smoothScrollState.origin)),b<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(b,x){const S=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(x<0&&this._viewportElement.scrollTop!==0||x>0&&S<this._lastRecordedBufferHeight)||(b.cancelable&&b.preventDefault(),!1)}handleWheel(b){const x=this._getPixelsScrolled(b);return x!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+x:this._smoothScrollState.target+=x,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=x,this._bubbleScroll(b,x))}scrollLines(b){if(b!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const x=b*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+x,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:b,suppressScrollEvent:!1})}_getPixelsScrolled(b){if(b.deltaY===0||b.shiftKey)return 0;let x=this._applyScrollModifier(b.deltaY,b);return b.deltaMode===WheelEvent.DOM_DELTA_LINE?x*=this._currentRowHeight:b.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(x*=this._currentRowHeight*this._bufferService.rows),x}getBufferElements(b,x){var A;let S,j="";const N=[],T=x??this._bufferService.buffer.lines.length,D=this._bufferService.buffer.lines;for(let B=b;B<T;B++){const R=D.get(B);if(!R)continue;const $=(A=D.get(B+1))==null?void 0:A.isWrapped;if(j+=R.translateToString(!$),!$||B===D.length-1){const F=document.createElement("div");F.textContent=j,N.push(F),j.length>0&&(S=F),j=""}}return{bufferElements:N,cursorElement:S}}getLinesScrolled(b){if(b.deltaY===0||b.shiftKey)return 0;let x=this._applyScrollModifier(b.deltaY,b);return b.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(x/=this._currentRowHeight+0,this._wheelPartialScroll+=x,x=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):b.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(x*=this._bufferService.rows),x}_applyScrollModifier(b,x){const S=this._optionsService.rawOptions.fastScrollModifier;return S==="alt"&&x.altKey||S==="ctrl"&&x.ctrlKey||S==="shift"&&x.shiftKey?b*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:b*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(b){this._lastTouchY=b.touches[0].pageY}handleTouchMove(b){const x=this._lastTouchY-b.touches[0].pageY;return this._lastTouchY=b.touches[0].pageY,x!==0&&(this._viewportElement.scrollTop+=x,this._bubbleScroll(b,x))}};l.Viewport=v=f([p(2,k.IBufferService),p(3,k.IOptionsService),p(4,_.ICharSizeService),p(5,_.IRenderService),p(6,_.ICoreBrowserService),p(7,_.IThemeService)],v)},3107:function(c,l,h){var f=this&&this.__decorate||function(k,v,b,x){var S,j=arguments.length,N=j<3?v:x===null?x=Object.getOwnPropertyDescriptor(v,b):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(k,v,b,x);else for(var T=k.length-1;T>=0;T--)(S=k[T])&&(N=(j<3?S(N):j>3?S(v,b,N):S(v,b))||N);return j>3&&N&&Object.defineProperty(v,b,N),N},p=this&&this.__param||function(k,v){return function(b,x){v(b,x,k)}};Object.defineProperty(l,"__esModule",{value:!0}),l.BufferDecorationRenderer=void 0;const m=h(4725),_=h(844),y=h(2585);let w=l.BufferDecorationRenderer=class extends _.Disposable{constructor(k,v,b,x,S){super(),this._screenElement=k,this._bufferService=v,this._coreBrowserService=b,this._decorationService=x,this._renderService=S,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange((()=>this._doRefreshDecorations()))),this.register(this._renderService.onDimensionsChange((()=>{this._dimensionsChanged=!0,this._queueRefresh()}))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt}))),this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh()))),this.register(this._decorationService.onDecorationRemoved((j=>this._removeDecoration(j)))),this.register((0,_.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(const k of this._decorationService.decorations)this._renderDecoration(k);this._dimensionsChanged=!1}_renderDecoration(k){this._refreshStyle(k),this._dimensionsChanged&&this._refreshXPosition(k)}_createElement(k){var x;const v=this._coreBrowserService.mainDocument.createElement("div");v.classList.add("xterm-decoration"),v.classList.toggle("xterm-decoration-top-layer",((x=k==null?void 0:k.options)==null?void 0:x.layer)==="top"),v.style.width=`${Math.round((k.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,v.style.height=(k.options.height||1)*this._renderService.dimensions.css.cell.height+"px",v.style.top=(k.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",v.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const b=k.options.x??0;return b&&b>this._bufferService.cols&&(v.style.display="none"),this._refreshXPosition(k,v),v}_refreshStyle(k){const v=k.marker.line-this._bufferService.buffers.active.ydisp;if(v<0||v>=this._bufferService.rows)k.element&&(k.element.style.display="none",k.onRenderEmitter.fire(k.element));else{let b=this._decorationElements.get(k);b||(b=this._createElement(k),k.element=b,this._decorationElements.set(k,b),this._container.appendChild(b),k.onDispose((()=>{this._decorationElements.delete(k),b.remove()}))),b.style.top=v*this._renderService.dimensions.css.cell.height+"px",b.style.display=this._altBufferIsActive?"none":"block",k.onRenderEmitter.fire(b)}}_refreshXPosition(k,v=k.element){if(!v)return;const b=k.options.x??0;(k.options.anchor||"left")==="right"?v.style.right=b?b*this._renderService.dimensions.css.cell.width+"px":"":v.style.left=b?b*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(k){var v;(v=this._decorationElements.get(k))==null||v.remove(),this._decorationElements.delete(k),k.dispose()}};l.BufferDecorationRenderer=w=f([p(1,y.IBufferService),p(2,m.ICoreBrowserService),p(3,y.IDecorationService),p(4,m.IRenderService)],w)},5871:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ColorZoneStore=void 0,l.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(h){if(h.options.overviewRulerOptions){for(const f of this._zones)if(f.color===h.options.overviewRulerOptions.color&&f.position===h.options.overviewRulerOptions.position){if(this._lineIntersectsZone(f,h.marker.line))return;if(this._lineAdjacentToZone(f,h.marker.line,h.options.overviewRulerOptions.position))return void this._addLineToZone(f,h.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=h.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=h.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=h.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=h.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:h.options.overviewRulerOptions.color,position:h.options.overviewRulerOptions.position,startBufferLine:h.marker.line,endBufferLine:h.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(h){this._linePadding=h}_lineIntersectsZone(h,f){return f>=h.startBufferLine&&f<=h.endBufferLine}_lineAdjacentToZone(h,f,p){return f>=h.startBufferLine-this._linePadding[p||"full"]&&f<=h.endBufferLine+this._linePadding[p||"full"]}_addLineToZone(h,f){h.startBufferLine=Math.min(h.startBufferLine,f),h.endBufferLine=Math.max(h.endBufferLine,f)}}},5744:function(c,l,h){var f=this&&this.__decorate||function(S,j,N,T){var D,A=arguments.length,B=A<3?j:T===null?T=Object.getOwnPropertyDescriptor(j,N):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate(S,j,N,T);else for(var R=S.length-1;R>=0;R--)(D=S[R])&&(B=(A<3?D(B):A>3?D(j,N,B):D(j,N))||B);return A>3&&B&&Object.defineProperty(j,N,B),B},p=this&&this.__param||function(S,j){return function(N,T){j(N,T,S)}};Object.defineProperty(l,"__esModule",{value:!0}),l.OverviewRulerRenderer=void 0;const m=h(5871),_=h(4725),y=h(844),w=h(2585),k={full:0,left:0,center:0,right:0},v={full:0,left:0,center:0,right:0},b={full:0,left:0,center:0,right:0};let x=l.OverviewRulerRenderer=class extends y.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(S,j,N,T,D,A,B){var $;super(),this._viewportElement=S,this._screenElement=j,this._bufferService=N,this._decorationService=T,this._renderService=D,this._optionsService=A,this._coreBrowserService=B,this._colorZoneStore=new m.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),($=this._viewportElement.parentElement)==null||$.insertBefore(this._canvas,this._viewportElement);const R=this._canvas.getContext("2d");if(!R)throw new Error("Ctx cannot be null");this._ctx=R,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,y.toDisposable)((()=>{var F;(F=this._canvas)==null||F.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"}))),this.register(this._bufferService.onScroll((()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){const S=Math.floor(this._canvas.width/3),j=Math.ceil(this._canvas.width/3);v.full=this._canvas.width,v.left=S,v.center=j,v.right=S,this._refreshDrawHeightConstants(),b.full=0,b.left=0,b.center=v.left,b.right=v.left+v.center}_refreshDrawHeightConstants(){k.full=Math.round(2*this._coreBrowserService.dpr);const S=this._canvas.height/this._bufferService.buffer.lines.length,j=Math.round(Math.max(Math.min(S,12),6)*this._coreBrowserService.dpr);k.left=j,k.center=j,k.right=j}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*k.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*k.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*k.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*k.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(const j of this._decorationService.decorations)this._colorZoneStore.addDecoration(j);this._ctx.lineWidth=1;const S=this._colorZoneStore.zones;for(const j of S)j.position!=="full"&&this._renderColorZone(j);for(const j of S)j.position==="full"&&this._renderColorZone(j);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(S){this._ctx.fillStyle=S.color,this._ctx.fillRect(b[S.position||"full"],Math.round((this._canvas.height-1)*(S.startBufferLine/this._bufferService.buffers.active.lines.length)-k[S.position||"full"]/2),v[S.position||"full"],Math.round((this._canvas.height-1)*((S.endBufferLine-S.startBufferLine)/this._bufferService.buffers.active.lines.length)+k[S.position||"full"]))}_queueRefresh(S,j){this._shouldUpdateDimensions=S||this._shouldUpdateDimensions,this._shouldUpdateAnchor=j||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};l.OverviewRulerRenderer=x=f([p(2,w.IBufferService),p(3,w.IDecorationService),p(4,_.IRenderService),p(5,w.IOptionsService),p(6,_.ICoreBrowserService)],x)},2950:function(c,l,h){var f=this&&this.__decorate||function(k,v,b,x){var S,j=arguments.length,N=j<3?v:x===null?x=Object.getOwnPropertyDescriptor(v,b):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(k,v,b,x);else for(var T=k.length-1;T>=0;T--)(S=k[T])&&(N=(j<3?S(N):j>3?S(v,b,N):S(v,b))||N);return j>3&&N&&Object.defineProperty(v,b,N),N},p=this&&this.__param||function(k,v){return function(b,x){v(b,x,k)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CompositionHelper=void 0;const m=h(4725),_=h(2585),y=h(2584);let w=l.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(k,v,b,x,S,j){this._textarea=k,this._compositionView=v,this._bufferService=b,this._optionsService=x,this._coreService=S,this._renderService=j,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(k){this._compositionView.textContent=k.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(k){if(this._isComposing||this._isSendingComposition){if(k.keyCode===229||k.keyCode===16||k.keyCode===17||k.keyCode===18)return!1;this._finalizeComposition(!1)}return k.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(k){if(this._compositionView.classList.remove("active"),this._isComposing=!1,k){const v={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let b;this._isSendingComposition=!1,v.start+=this._dataAlreadySent.length,b=this._isComposing?this._textarea.value.substring(v.start,v.end):this._textarea.value.substring(v.start),b.length>0&&this._coreService.triggerDataEvent(b,!0)}}),0)}else{this._isSendingComposition=!1;const v=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(v,!0)}}_handleAnyTextareaChanges(){const k=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const v=this._textarea.value,b=v.replace(k,"");this._dataAlreadySent=b,v.length>k.length?this._coreService.triggerDataEvent(b,!0):v.length<k.length?this._coreService.triggerDataEvent(`${y.C0.DEL}`,!0):v.length===k.length&&v!==k&&this._coreService.triggerDataEvent(v,!0)}}),0)}updateCompositionElements(k){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const v=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),b=this._renderService.dimensions.css.cell.height,x=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,S=v*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=S+"px",this._compositionView.style.top=x+"px",this._compositionView.style.height=b+"px",this._compositionView.style.lineHeight=b+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const j=this._compositionView.getBoundingClientRect();this._textarea.style.left=S+"px",this._textarea.style.top=x+"px",this._textarea.style.width=Math.max(j.width,1)+"px",this._textarea.style.height=Math.max(j.height,1)+"px",this._textarea.style.lineHeight=j.height+"px"}k||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};l.CompositionHelper=w=f([p(2,_.IBufferService),p(3,_.IOptionsService),p(4,_.ICoreService),p(5,m.IRenderService)],w)},9806:(c,l)=>{function h(f,p,m){const _=m.getBoundingClientRect(),y=f.getComputedStyle(m),w=parseInt(y.getPropertyValue("padding-left")),k=parseInt(y.getPropertyValue("padding-top"));return[p.clientX-_.left-w,p.clientY-_.top-k]}Object.defineProperty(l,"__esModule",{value:!0}),l.getCoords=l.getCoordsRelativeToElement=void 0,l.getCoordsRelativeToElement=h,l.getCoords=function(f,p,m,_,y,w,k,v,b){if(!w)return;const x=h(f,p,m);return x?(x[0]=Math.ceil((x[0]+(b?k/2:0))/k),x[1]=Math.ceil(x[1]/v),x[0]=Math.min(Math.max(x[0],1),_+(b?1:0)),x[1]=Math.min(Math.max(x[1],1),y),x):void 0}},9504:(c,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.moveToCellSequence=void 0;const f=h(2584);function p(v,b,x,S){const j=v-m(v,x),N=b-m(b,x),T=Math.abs(j-N)-(function(D,A,B){let R=0;const $=D-m(D,B),F=A-m(A,B);for(let W=0;W<Math.abs($-F);W++){const Y=_(D,A)==="A"?-1:1,P=B.buffer.lines.get($+Y*W);P!=null&&P.isWrapped&&R++}return R})(v,b,x);return k(T,w(_(v,b),S))}function m(v,b){let x=0,S=b.buffer.lines.get(v),j=S==null?void 0:S.isWrapped;for(;j&&v>=0&&v<b.rows;)x++,S=b.buffer.lines.get(--v),j=S==null?void 0:S.isWrapped;return x}function _(v,b){return v>b?"A":"B"}function y(v,b,x,S,j,N){let T=v,D=b,A="";for(;T!==x||D!==S;)T+=j?1:-1,j&&T>N.cols-1?(A+=N.buffer.translateBufferLineToString(D,!1,v,T),T=0,v=0,D++):!j&&T<0&&(A+=N.buffer.translateBufferLineToString(D,!1,0,v+1),T=N.cols-1,v=T,D--);return A+N.buffer.translateBufferLineToString(D,!1,v,T)}function w(v,b){const x=b?"O":"[";return f.C0.ESC+x+v}function k(v,b){v=Math.floor(v);let x="";for(let S=0;S<v;S++)x+=b;return x}l.moveToCellSequence=function(v,b,x,S){const j=x.buffer.x,N=x.buffer.y;if(!x.buffer.hasScrollback)return(function(A,B,R,$,F,W){return p(B,$,F,W).length===0?"":k(y(A,B,A,B-m(B,F),!1,F).length,w("D",W))})(j,N,0,b,x,S)+p(N,b,x,S)+(function(A,B,R,$,F,W){let Y;Y=p(B,$,F,W).length>0?$-m($,F):B;const P=$,H=(function(J,K,I,L,z,V){let U;return U=p(I,L,z,V).length>0?L-m(L,z):K,J<I&&U<=L||J>=I&&U<L?"C":"D"})(A,B,R,$,F,W);return k(y(A,Y,R,P,H==="C",F).length,w(H,W))})(j,N,v,b,x,S);let T;if(N===b)return T=j>v?"D":"C",k(Math.abs(j-v),w(T,S));T=N>b?"D":"C";const D=Math.abs(N-b);return k((function(A,B){return B.cols-A})(N>b?v:j,x)+(D-1)*x.cols+1+((N>b?j:v)-1),w(T,S))}},1296:function(c,l,h){var f=this&&this.__decorate||function(W,Y,P,H){var J,K=arguments.length,I=K<3?Y:H===null?H=Object.getOwnPropertyDescriptor(Y,P):H;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(W,Y,P,H);else for(var L=W.length-1;L>=0;L--)(J=W[L])&&(I=(K<3?J(I):K>3?J(Y,P,I):J(Y,P))||I);return K>3&&I&&Object.defineProperty(Y,P,I),I},p=this&&this.__param||function(W,Y){return function(P,H){Y(P,H,W)}};Object.defineProperty(l,"__esModule",{value:!0}),l.DomRenderer=void 0;const m=h(3787),_=h(2550),y=h(2223),w=h(6171),k=h(6052),v=h(4725),b=h(8055),x=h(8460),S=h(844),j=h(2585),N="xterm-dom-renderer-owner-",T="xterm-rows",D="xterm-fg-",A="xterm-bg-",B="xterm-focus",R="xterm-selection";let $=1,F=l.DomRenderer=class extends S.Disposable{constructor(W,Y,P,H,J,K,I,L,z,V,U,ee,Z){super(),this._terminal=W,this._document=Y,this._element=P,this._screenElement=H,this._viewportElement=J,this._helperContainer=K,this._linkifier2=I,this._charSizeService=z,this._optionsService=V,this._bufferService=U,this._coreBrowserService=ee,this._themeService=Z,this._terminalClass=$++,this._rowElements=[],this._selectionRenderModel=(0,k.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new x.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(T),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(R),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,w.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((ne=>this._injectCss(ne)))),this._injectCss(this._themeService.colors),this._rowFactory=L.createInstance(m.DomRendererRowFactory,document),this._element.classList.add(N+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((ne=>this._handleLinkHover(ne)))),this.register(this._linkifier2.onHideLinkUnderline((ne=>this._handleLinkLeave(ne)))),this.register((0,S.toDisposable)((()=>{this._element.classList.remove(N+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new _.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){const W=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*W,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*W),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/W),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/W),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(const P of this._rowElements)P.style.width=`${this.dimensions.css.canvas.width}px`,P.style.height=`${this.dimensions.css.cell.height}px`,P.style.lineHeight=`${this.dimensions.css.cell.height}px`,P.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const Y=`${this._terminalSelector} .${T} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=Y,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(W){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let Y=`${this._terminalSelector} .${T} { color: ${W.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;Y+=`${this._terminalSelector} .${T} .xterm-dim { color: ${b.color.multiplyOpacity(W.foreground,.5).css};}`,Y+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;const P=`blink_underline_${this._terminalClass}`,H=`blink_bar_${this._terminalClass}`,J=`blink_block_${this._terminalClass}`;Y+=`@keyframes ${P} { 50% { border-bottom-style: hidden; }}`,Y+=`@keyframes ${H} { 50% { box-shadow: none; }}`,Y+=`@keyframes ${J} { 0% { background-color: ${W.cursor.css}; color: ${W.cursorAccent.css}; } 50% { background-color: inherit; color: ${W.cursor.css}; }}`,Y+=`${this._terminalSelector} .${T}.${B} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${P} 1s step-end infinite;}${this._terminalSelector} .${T}.${B} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${H} 1s step-end infinite;}${this._terminalSelector} .${T}.${B} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${J} 1s step-end infinite;}${this._terminalSelector} .${T} .xterm-cursor.xterm-cursor-block { background-color: ${W.cursor.css}; color: ${W.cursorAccent.css};}${this._terminalSelector} .${T} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${W.cursor.css} !important; color: ${W.cursorAccent.css} !important;}${this._terminalSelector} .${T} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${W.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${T} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${W.cursor.css} inset;}${this._terminalSelector} .${T} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${W.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,Y+=`${this._terminalSelector} .${R} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${R} div { position: absolute; background-color: ${W.selectionBackgroundOpaque.css};}${this._terminalSelector} .${R} div { position: absolute; background-color: ${W.selectionInactiveBackgroundOpaque.css};}`;for(const[K,I]of W.ansi.entries())Y+=`${this._terminalSelector} .${D}${K} { color: ${I.css}; }${this._terminalSelector} .${D}${K}.xterm-dim { color: ${b.color.multiplyOpacity(I,.5).css}; }${this._terminalSelector} .${A}${K} { background-color: ${I.css}; }`;Y+=`${this._terminalSelector} .${D}${y.INVERTED_DEFAULT_COLOR} { color: ${b.color.opaque(W.background).css}; }${this._terminalSelector} .${D}${y.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${b.color.multiplyOpacity(b.color.opaque(W.background),.5).css}; }${this._terminalSelector} .${A}${y.INVERTED_DEFAULT_COLOR} { background-color: ${W.foreground.css}; }`,this._themeStyleElement.textContent=Y}_setDefaultSpacing(){const W=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${W}px`,this._rowFactory.defaultSpacing=W}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(W,Y){for(let P=this._rowElements.length;P<=Y;P++){const H=this._document.createElement("div");this._rowContainer.appendChild(H),this._rowElements.push(H)}for(;this._rowElements.length>Y;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(W,Y){this._refreshRowElements(W,Y),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(B),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(B),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(W,Y,P){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(W,Y,P),this.renderRows(0,this._bufferService.rows-1),!W||!Y)return;this._selectionRenderModel.update(this._terminal,W,Y,P);const H=this._selectionRenderModel.viewportStartRow,J=this._selectionRenderModel.viewportEndRow,K=this._selectionRenderModel.viewportCappedStartRow,I=this._selectionRenderModel.viewportCappedEndRow;if(K>=this._bufferService.rows||I<0)return;const L=this._document.createDocumentFragment();if(P){const z=W[0]>Y[0];L.appendChild(this._createSelectionElement(K,z?Y[0]:W[0],z?W[0]:Y[0],I-K+1))}else{const z=H===K?W[0]:0,V=K===J?Y[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement(K,z,V));const U=I-K-1;if(L.appendChild(this._createSelectionElement(K+1,0,this._bufferService.cols,U)),K!==I){const ee=J===I?Y[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement(I,0,ee))}}this._selectionContainer.appendChild(L)}_createSelectionElement(W,Y,P,H=1){const J=this._document.createElement("div"),K=Y*this.dimensions.css.cell.width;let I=this.dimensions.css.cell.width*(P-Y);return K+I>this.dimensions.css.canvas.width&&(I=this.dimensions.css.canvas.width-K),J.style.height=H*this.dimensions.css.cell.height+"px",J.style.top=W*this.dimensions.css.cell.height+"px",J.style.left=`${K}px`,J.style.width=`${I}px`,J}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(const W of this._rowElements)W.replaceChildren()}renderRows(W,Y){const P=this._bufferService.buffer,H=P.ybase+P.y,J=Math.min(P.x,this._bufferService.cols-1),K=this._optionsService.rawOptions.cursorBlink,I=this._optionsService.rawOptions.cursorStyle,L=this._optionsService.rawOptions.cursorInactiveStyle;for(let z=W;z<=Y;z++){const V=z+P.ydisp,U=this._rowElements[z],ee=P.lines.get(V);if(!U||!ee)break;U.replaceChildren(...this._rowFactory.createRow(ee,V,V===H,I,L,J,K,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${N}${this._terminalClass}`}_handleLinkHover(W){this._setCellUnderline(W.x1,W.x2,W.y1,W.y2,W.cols,!0)}_handleLinkLeave(W){this._setCellUnderline(W.x1,W.x2,W.y1,W.y2,W.cols,!1)}_setCellUnderline(W,Y,P,H,J,K){P<0&&(W=0),H<0&&(Y=0);const I=this._bufferService.rows-1;P=Math.max(Math.min(P,I),0),H=Math.max(Math.min(H,I),0),J=Math.min(J,this._bufferService.cols);const L=this._bufferService.buffer,z=L.ybase+L.y,V=Math.min(L.x,J-1),U=this._optionsService.rawOptions.cursorBlink,ee=this._optionsService.rawOptions.cursorStyle,Z=this._optionsService.rawOptions.cursorInactiveStyle;for(let ne=P;ne<=H;++ne){const X=ne+L.ydisp,G=this._rowElements[ne],le=L.lines.get(X);if(!G||!le)break;G.replaceChildren(...this._rowFactory.createRow(le,X,X===z,ee,Z,V,U,this.dimensions.css.cell.width,this._widthCache,K?ne===P?W:0:-1,K?(ne===H?Y:J)-1:-1))}}};l.DomRenderer=F=f([p(7,j.IInstantiationService),p(8,v.ICharSizeService),p(9,j.IOptionsService),p(10,j.IBufferService),p(11,v.ICoreBrowserService),p(12,v.IThemeService)],F)},3787:function(c,l,h){var f=this&&this.__decorate||function(T,D,A,B){var R,$=arguments.length,F=$<3?D:B===null?B=Object.getOwnPropertyDescriptor(D,A):B;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")F=Reflect.decorate(T,D,A,B);else for(var W=T.length-1;W>=0;W--)(R=T[W])&&(F=($<3?R(F):$>3?R(D,A,F):R(D,A))||F);return $>3&&F&&Object.defineProperty(D,A,F),F},p=this&&this.__param||function(T,D){return function(A,B){D(A,B,T)}};Object.defineProperty(l,"__esModule",{value:!0}),l.DomRendererRowFactory=void 0;const m=h(2223),_=h(643),y=h(511),w=h(2585),k=h(8055),v=h(4725),b=h(4269),x=h(6171),S=h(3734);let j=l.DomRendererRowFactory=class{constructor(T,D,A,B,R,$,F){this._document=T,this._characterJoinerService=D,this._optionsService=A,this._coreBrowserService=B,this._coreService=R,this._decorationService=$,this._themeService=F,this._workCell=new y.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(T,D,A){this._selectionStart=T,this._selectionEnd=D,this._columnSelectMode=A}createRow(T,D,A,B,R,$,F,W,Y,P,H){const J=[],K=this._characterJoinerService.getJoinedCharacters(D),I=this._themeService.colors;let L,z=T.getNoBgTrimmedLength();A&&z<$+1&&(z=$+1);let V=0,U="",ee=0,Z=0,ne=0,X=!1,G=0,le=!1,se=0;const ve=[],be=P!==-1&&H!==-1;for(let Oe=0;Oe<z;Oe++){T.loadCell(Oe,this._workCell);let Be=this._workCell.getWidth();if(Be===0)continue;let Pe=!1,Ve=Oe,Ae=this._workCell;if(K.length>0&&Oe===K[0][0]){Pe=!0;const st=K.shift();Ae=new b.JoinedCellData(this._workCell,T.translateToString(!0,st[0],st[1]),st[1]-st[0]),Ve=st[1]-1,Be=Ae.getWidth()}const dt=this._isCellInSelection(Oe,D),lt=A&&Oe===$,ye=be&&Oe>=P&&Oe<=H;let Ne=!1;this._decorationService.forEachDecorationAtCell(Oe,D,void 0,(st=>{Ne=!0}));let fe=Ae.getChars()||_.WHITESPACE_CELL_CHAR;if(fe===" "&&(Ae.isUnderline()||Ae.isOverline())&&(fe=" "),se=Be*W-Y.get(fe,Ae.isBold(),Ae.isItalic()),L){if(V&&(dt&&le||!dt&&!le&&Ae.bg===ee)&&(dt&&le&&I.selectionForeground||Ae.fg===Z)&&Ae.extended.ext===ne&&ye===X&&se===G&&!lt&&!Pe&&!Ne){Ae.isInvisible()?U+=_.WHITESPACE_CELL_CHAR:U+=fe,V++;continue}V&&(L.textContent=U),L=this._document.createElement("span"),V=0,U=""}else L=this._document.createElement("span");if(ee=Ae.bg,Z=Ae.fg,ne=Ae.extended.ext,X=ye,G=se,le=dt,Pe&&$>=Oe&&$<=Ve&&($=Oe),!this._coreService.isCursorHidden&&lt&&this._coreService.isCursorInitialized){if(ve.push("xterm-cursor"),this._coreBrowserService.isFocused)F&&ve.push("xterm-cursor-blink"),ve.push(B==="bar"?"xterm-cursor-bar":B==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(R)switch(R){case"outline":ve.push("xterm-cursor-outline");break;case"block":ve.push("xterm-cursor-block");break;case"bar":ve.push("xterm-cursor-bar");break;case"underline":ve.push("xterm-cursor-underline")}}if(Ae.isBold()&&ve.push("xterm-bold"),Ae.isItalic()&&ve.push("xterm-italic"),Ae.isDim()&&ve.push("xterm-dim"),U=Ae.isInvisible()?_.WHITESPACE_CELL_CHAR:Ae.getChars()||_.WHITESPACE_CELL_CHAR,Ae.isUnderline()&&(ve.push(`xterm-underline-${Ae.extended.underlineStyle}`),U===" "&&(U=" "),!Ae.isUnderlineColorDefault()))if(Ae.isUnderlineColorRGB())L.style.textDecorationColor=`rgb(${S.AttributeData.toColorRGB(Ae.getUnderlineColor()).join(",")})`;else{let st=Ae.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Ae.isBold()&&st<8&&(st+=8),L.style.textDecorationColor=I.ansi[st].css}Ae.isOverline()&&(ve.push("xterm-overline"),U===" "&&(U=" ")),Ae.isStrikethrough()&&ve.push("xterm-strikethrough"),ye&&(L.style.textDecoration="underline");let De=Ae.getFgColor(),ze=Ae.getFgColorMode(),_t=Ae.getBgColor(),ue=Ae.getBgColorMode();const we=!!Ae.isInverse();if(we){const st=De;De=_t,_t=st;const he=ze;ze=ue,ue=he}let Le,He,Xe,It=!1;switch(this._decorationService.forEachDecorationAtCell(Oe,D,void 0,(st=>{st.options.layer!=="top"&&It||(st.backgroundColorRGB&&(ue=50331648,_t=st.backgroundColorRGB.rgba>>8&16777215,Le=st.backgroundColorRGB),st.foregroundColorRGB&&(ze=50331648,De=st.foregroundColorRGB.rgba>>8&16777215,He=st.foregroundColorRGB),It=st.options.layer==="top")})),!It&&dt&&(Le=this._coreBrowserService.isFocused?I.selectionBackgroundOpaque:I.selectionInactiveBackgroundOpaque,_t=Le.rgba>>8&16777215,ue=50331648,It=!0,I.selectionForeground&&(ze=50331648,De=I.selectionForeground.rgba>>8&16777215,He=I.selectionForeground)),It&&ve.push("xterm-decoration-top"),ue){case 16777216:case 33554432:Xe=I.ansi[_t],ve.push(`xterm-bg-${_t}`);break;case 50331648:Xe=k.channels.toColor(_t>>16,_t>>8&255,255&_t),this._addStyle(L,`background-color:#${N((_t>>>0).toString(16),"0",6)}`);break;default:we?(Xe=I.foreground,ve.push(`xterm-bg-${m.INVERTED_DEFAULT_COLOR}`)):Xe=I.background}switch(Le||Ae.isDim()&&(Le=k.color.multiplyOpacity(Xe,.5)),ze){case 16777216:case 33554432:Ae.isBold()&&De<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(De+=8),this._applyMinimumContrast(L,Xe,I.ansi[De],Ae,Le,void 0)||ve.push(`xterm-fg-${De}`);break;case 50331648:const st=k.channels.toColor(De>>16&255,De>>8&255,255&De);this._applyMinimumContrast(L,Xe,st,Ae,Le,He)||this._addStyle(L,`color:#${N(De.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(L,Xe,I.foreground,Ae,Le,He)||we&&ve.push(`xterm-fg-${m.INVERTED_DEFAULT_COLOR}`)}ve.length&&(L.className=ve.join(" "),ve.length=0),lt||Pe||Ne?L.textContent=U:V++,se!==this.defaultSpacing&&(L.style.letterSpacing=`${se}px`),J.push(L),Oe=Ve}return L&&V&&(L.textContent=U),J}_applyMinimumContrast(T,D,A,B,R,$){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,x.treatGlyphAsBackgroundColor)(B.getCode()))return!1;const F=this._getContrastCache(B);let W;if(R||$||(W=F.getColor(D.rgba,A.rgba)),W===void 0){const Y=this._optionsService.rawOptions.minimumContrastRatio/(B.isDim()?2:1);W=k.color.ensureContrastRatio(R||D,$||A,Y),F.setColor((R||D).rgba,($||A).rgba,W??null)}return!!W&&(this._addStyle(T,`color:${W.css}`),!0)}_getContrastCache(T){return T.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(T,D){T.setAttribute("style",`${T.getAttribute("style")||""}${D};`)}_isCellInSelection(T,D){const A=this._selectionStart,B=this._selectionEnd;return!(!A||!B)&&(this._columnSelectMode?A[0]<=B[0]?T>=A[0]&&D>=A[1]&&T<B[0]&&D<=B[1]:T<A[0]&&D>=A[1]&&T>=B[0]&&D<=B[1]:D>A[1]&&D<B[1]||A[1]===B[1]&&D===A[1]&&T>=A[0]&&T<B[0]||A[1]<B[1]&&D===B[1]&&T<B[0]||A[1]<B[1]&&D===A[1]&&T>=A[0])}};function N(T,D,A){for(;T.length<A;)T=D+T;return T}l.DomRendererRowFactory=j=f([p(1,v.ICharacterJoinerService),p(2,w.IOptionsService),p(3,v.ICoreBrowserService),p(4,w.ICoreService),p(5,w.IDecorationService),p(6,v.IThemeService)],j)},2550:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.WidthCache=void 0,l.WidthCache=class{constructor(h,f){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=h.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const p=h.createElement("span");p.classList.add("xterm-char-measure-element");const m=h.createElement("span");m.classList.add("xterm-char-measure-element"),m.style.fontWeight="bold";const _=h.createElement("span");_.classList.add("xterm-char-measure-element"),_.style.fontStyle="italic";const y=h.createElement("span");y.classList.add("xterm-char-measure-element"),y.style.fontWeight="bold",y.style.fontStyle="italic",this._measureElements=[p,m,_,y],this._container.appendChild(p),this._container.appendChild(m),this._container.appendChild(_),this._container.appendChild(y),f.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(h,f,p,m){h===this._font&&f===this._fontSize&&p===this._weight&&m===this._weightBold||(this._font=h,this._fontSize=f,this._weight=p,this._weightBold=m,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${p}`,this._measureElements[1].style.fontWeight=`${m}`,this._measureElements[2].style.fontWeight=`${p}`,this._measureElements[3].style.fontWeight=`${m}`,this.clear())}get(h,f,p){let m=0;if(!f&&!p&&h.length===1&&(m=h.charCodeAt(0))<256){if(this._flat[m]!==-9999)return this._flat[m];const w=this._measure(h,0);return w>0&&(this._flat[m]=w),w}let _=h;f&&(_+="B"),p&&(_+="I");let y=this._holey.get(_);if(y===void 0){let w=0;f&&(w|=1),p&&(w|=2),y=this._measure(h,w),y>0&&this._holey.set(_,y)}return y}_measure(h,f){const p=this._measureElements[f];return p.textContent=h.repeat(32),p.offsetWidth/32}}},2223:(c,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.TEXT_BASELINE=l.DIM_OPACITY=l.INVERTED_DEFAULT_COLOR=void 0;const f=h(6114);l.INVERTED_DEFAULT_COLOR=257,l.DIM_OPACITY=.5,l.TEXT_BASELINE=f.isFirefox||f.isLegacyEdge?"bottom":"ideographic"},6171:(c,l)=>{function h(p){return 57508<=p&&p<=57558}function f(p){return p>=128512&&p<=128591||p>=127744&&p<=128511||p>=128640&&p<=128767||p>=9728&&p<=9983||p>=9984&&p<=10175||p>=65024&&p<=65039||p>=129280&&p<=129535||p>=127462&&p<=127487}Object.defineProperty(l,"__esModule",{value:!0}),l.computeNextVariantOffset=l.createRenderDimensions=l.treatGlyphAsBackgroundColor=l.allowRescaling=l.isEmoji=l.isRestrictedPowerlineGlyph=l.isPowerlineGlyph=l.throwIfFalsy=void 0,l.throwIfFalsy=function(p){if(!p)throw new Error("value must not be falsy");return p},l.isPowerlineGlyph=h,l.isRestrictedPowerlineGlyph=function(p){return 57520<=p&&p<=57527},l.isEmoji=f,l.allowRescaling=function(p,m,_,y){return m===1&&_>Math.ceil(1.5*y)&&p!==void 0&&p>255&&!f(p)&&!h(p)&&!(function(w){return 57344<=w&&w<=63743})(p)},l.treatGlyphAsBackgroundColor=function(p){return h(p)||(function(m){return 9472<=m&&m<=9631})(p)},l.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},l.computeNextVariantOffset=function(p,m,_=0){return(p-(2*Math.round(m)-_))%(2*Math.round(m))}},6052:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.createSelectionRenderModel=void 0;class h{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(p,m,_,y=!1){if(this.selectionStart=m,this.selectionEnd=_,!m||!_||m[0]===_[0]&&m[1]===_[1])return void this.clear();const w=p.buffers.active.ydisp,k=m[1]-w,v=_[1]-w,b=Math.max(k,0),x=Math.min(v,p.rows-1);b>=p.rows||x<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=y,this.viewportStartRow=k,this.viewportEndRow=v,this.viewportCappedStartRow=b,this.viewportCappedEndRow=x,this.startCol=m[0],this.endCol=_[0])}isCellSelected(p,m,_){return!!this.hasSelection&&(_-=p.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?m>=this.startCol&&_>=this.viewportCappedStartRow&&m<this.endCol&&_<=this.viewportCappedEndRow:m<this.startCol&&_>=this.viewportCappedStartRow&&m>=this.endCol&&_<=this.viewportCappedEndRow:_>this.viewportStartRow&&_<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&_===this.viewportStartRow&&m>=this.startCol&&m<this.endCol||this.viewportStartRow<this.viewportEndRow&&_===this.viewportEndRow&&m<this.endCol||this.viewportStartRow<this.viewportEndRow&&_===this.viewportStartRow&&m>=this.startCol)}}l.createSelectionRenderModel=function(){return new h}},456:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.SelectionModel=void 0,l.SelectionModel=class{constructor(h){this._bufferService=h,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){const h=this.selectionStart[0]+this.selectionStartLength;return h>this._bufferService.cols?h%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(h/this._bufferService.cols)-1]:[h%this._bufferService.cols,this.selectionStart[1]+Math.floor(h/this._bufferService.cols)]:[h,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const h=this.selectionStart[0]+this.selectionStartLength;return h>this._bufferService.cols?[h%this._bufferService.cols,this.selectionStart[1]+Math.floor(h/this._bufferService.cols)]:[Math.max(h,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const h=this.selectionStart,f=this.selectionEnd;return!(!h||!f)&&(h[1]>f[1]||h[1]===f[1]&&h[0]>f[0])}handleTrim(h){return this.selectionStart&&(this.selectionStart[1]-=h),this.selectionEnd&&(this.selectionEnd[1]-=h),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(c,l,h){var f=this&&this.__decorate||function(x,S,j,N){var T,D=arguments.length,A=D<3?S:N===null?N=Object.getOwnPropertyDescriptor(S,j):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(x,S,j,N);else for(var B=x.length-1;B>=0;B--)(T=x[B])&&(A=(D<3?T(A):D>3?T(S,j,A):T(S,j))||A);return D>3&&A&&Object.defineProperty(S,j,A),A},p=this&&this.__param||function(x,S){return function(j,N){S(j,N,x)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CharSizeService=void 0;const m=h(2585),_=h(8460),y=h(844);let w=l.CharSizeService=class extends y.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(x,S,j){super(),this._optionsService=j,this.width=0,this.height=0,this._onCharSizeChange=this.register(new _.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new b(this._optionsService))}catch{this._measureStrategy=this.register(new v(x,S,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const x=this._measureStrategy.measure();x.width===this.width&&x.height===this.height||(this.width=x.width,this.height=x.height,this._onCharSizeChange.fire())}};l.CharSizeService=w=f([p(2,m.IOptionsService)],w);class k extends y.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(S,j){S!==void 0&&S>0&&j!==void 0&&j>0&&(this._result.width=S,this._result.height=j)}}class v extends k{constructor(S,j,N){super(),this._document=S,this._parentElement=j,this._optionsService=N,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class b extends k{constructor(S){super(),this._optionsService=S,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const j=this._ctx.measureText("W");if(!("width"in j&&"fontBoundingBoxAscent"in j&&"fontBoundingBoxDescent"in j))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const S=this._ctx.measureText("W");return this._validateAndSet(S.width,S.fontBoundingBoxAscent+S.fontBoundingBoxDescent),this._result}}},4269:function(c,l,h){var f=this&&this.__decorate||function(b,x,S,j){var N,T=arguments.length,D=T<3?x:j===null?j=Object.getOwnPropertyDescriptor(x,S):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(b,x,S,j);else for(var A=b.length-1;A>=0;A--)(N=b[A])&&(D=(T<3?N(D):T>3?N(x,S,D):N(x,S))||D);return T>3&&D&&Object.defineProperty(x,S,D),D},p=this&&this.__param||function(b,x){return function(S,j){x(S,j,b)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CharacterJoinerService=l.JoinedCellData=void 0;const m=h(3734),_=h(643),y=h(511),w=h(2585);class k extends m.AttributeData{constructor(x,S,j){super(),this.content=0,this.combinedData="",this.fg=x.fg,this.bg=x.bg,this.combinedData=S,this._width=j}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(x){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}l.JoinedCellData=k;let v=l.CharacterJoinerService=class mS{constructor(x){this._bufferService=x,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new y.CellData}register(x){const S={id:this._nextCharacterJoinerId++,handler:x};return this._characterJoiners.push(S),S.id}deregister(x){for(let S=0;S<this._characterJoiners.length;S++)if(this._characterJoiners[S].id===x)return this._characterJoiners.splice(S,1),!0;return!1}getJoinedCharacters(x){if(this._characterJoiners.length===0)return[];const S=this._bufferService.buffer.lines.get(x);if(!S||S.length===0)return[];const j=[],N=S.translateToString(!0);let T=0,D=0,A=0,B=S.getFg(0),R=S.getBg(0);for(let $=0;$<S.getTrimmedLength();$++)if(S.loadCell($,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==B||this._workCell.bg!==R){if($-T>1){const F=this._getJoinedRanges(N,A,D,S,T);for(let W=0;W<F.length;W++)j.push(F[W])}T=$,A=D,B=this._workCell.fg,R=this._workCell.bg}D+=this._workCell.getChars().length||_.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-T>1){const $=this._getJoinedRanges(N,A,D,S,T);for(let F=0;F<$.length;F++)j.push($[F])}return j}_getJoinedRanges(x,S,j,N,T){const D=x.substring(S,j);let A=[];try{A=this._characterJoiners[0].handler(D)}catch(B){console.error(B)}for(let B=1;B<this._characterJoiners.length;B++)try{const R=this._characterJoiners[B].handler(D);for(let $=0;$<R.length;$++)mS._mergeRanges(A,R[$])}catch(R){console.error(R)}return this._stringRangesToCellRanges(A,N,T),A}_stringRangesToCellRanges(x,S,j){let N=0,T=!1,D=0,A=x[N];if(A){for(let B=j;B<this._bufferService.cols;B++){const R=S.getWidth(B),$=S.getString(B).length||_.WHITESPACE_CELL_CHAR.length;if(R!==0){if(!T&&A[0]<=D&&(A[0]=B,T=!0),A[1]<=D){if(A[1]=B,A=x[++N],!A)break;A[0]<=D?(A[0]=B,T=!0):T=!1}D+=$}}A&&(A[1]=this._bufferService.cols)}}static _mergeRanges(x,S){let j=!1;for(let N=0;N<x.length;N++){const T=x[N];if(j){if(S[1]<=T[0])return x[N-1][1]=S[1],x;if(S[1]<=T[1])return x[N-1][1]=Math.max(S[1],T[1]),x.splice(N,1),x;x.splice(N,1),N--}else{if(S[1]<=T[0])return x.splice(N,0,S),x;if(S[1]<=T[1])return T[0]=Math.min(S[0],T[0]),x;S[0]<T[1]&&(T[0]=Math.min(S[0],T[0]),j=!0)}}return j?x[x.length-1][1]=S[1]:x.push(S),x}};l.CharacterJoinerService=v=f([p(0,w.IBufferService)],v)},5114:(c,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CoreBrowserService=void 0;const f=h(844),p=h(8460),m=h(3656);class _ extends f.Disposable{constructor(k,v,b){super(),this._textarea=k,this._window=v,this.mainDocument=b,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new y(this._window),this._onDprChange=this.register(new p.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new p.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((x=>this._screenDprMonitor.setWindow(x)))),this.register((0,p.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("blur",(()=>this._isFocused=!1))}get window(){return this._window}set window(k){this._window!==k&&(this._window=k,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask((()=>this._cachedIsFocused=void 0))),this._cachedIsFocused}}l.CoreBrowserService=_;class y extends f.Disposable{constructor(k){super(),this._parentWindow=k,this._windowResizeListener=this.register(new f.MutableDisposable),this._onDprChange=this.register(new p.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,f.toDisposable)((()=>this.clearListener())))}setWindow(k){this._parentWindow=k,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,m.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var k;this._outerListener&&((k=this._resolutionMediaMatchList)==null||k.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(c,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.LinkProviderService=void 0;const f=h(844);class p extends f.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,f.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(_){return this.linkProviders.push(_),{dispose:()=>{const y=this.linkProviders.indexOf(_);y!==-1&&this.linkProviders.splice(y,1)}}}}l.LinkProviderService=p},8934:function(c,l,h){var f=this&&this.__decorate||function(w,k,v,b){var x,S=arguments.length,j=S<3?k:b===null?b=Object.getOwnPropertyDescriptor(k,v):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(w,k,v,b);else for(var N=w.length-1;N>=0;N--)(x=w[N])&&(j=(S<3?x(j):S>3?x(k,v,j):x(k,v))||j);return S>3&&j&&Object.defineProperty(k,v,j),j},p=this&&this.__param||function(w,k){return function(v,b){k(v,b,w)}};Object.defineProperty(l,"__esModule",{value:!0}),l.MouseService=void 0;const m=h(4725),_=h(9806);let y=l.MouseService=class{constructor(w,k){this._renderService=w,this._charSizeService=k}getCoords(w,k,v,b,x){return(0,_.getCoords)(window,w,k,v,b,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,x)}getMouseReportCoords(w,k){const v=(0,_.getCoordsRelativeToElement)(window,w,k);if(this._charSizeService.hasValidSize)return v[0]=Math.min(Math.max(v[0],0),this._renderService.dimensions.css.canvas.width-1),v[1]=Math.min(Math.max(v[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(v[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(v[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(v[0]),y:Math.floor(v[1])}}};l.MouseService=y=f([p(0,m.IRenderService),p(1,m.ICharSizeService)],y)},3230:function(c,l,h){var f=this&&this.__decorate||function(x,S,j,N){var T,D=arguments.length,A=D<3?S:N===null?N=Object.getOwnPropertyDescriptor(S,j):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(x,S,j,N);else for(var B=x.length-1;B>=0;B--)(T=x[B])&&(A=(D<3?T(A):D>3?T(S,j,A):T(S,j))||A);return D>3&&A&&Object.defineProperty(S,j,A),A},p=this&&this.__param||function(x,S){return function(j,N){S(j,N,x)}};Object.defineProperty(l,"__esModule",{value:!0}),l.RenderService=void 0;const m=h(6193),_=h(4725),y=h(8460),w=h(844),k=h(7226),v=h(2585);let b=l.RenderService=class extends w.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(x,S,j,N,T,D,A,B){super(),this._rowCount=x,this._charSizeService=N,this._renderer=this.register(new w.MutableDisposable),this._pausedResizeTask=new k.DebouncedIdleTask,this._observerDisposable=this.register(new w.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new y.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new y.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new y.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new y.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new m.RenderDebouncer(((R,$)=>this._renderRows(R,$)),A),this.register(this._renderDebouncer),this.register(A.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(D.onResize((()=>this._fullRefresh()))),this.register(D.buffers.onBufferActivate((()=>{var R;return(R=this._renderer.value)==null?void 0:R.clear()}))),this.register(j.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(T.onDecorationRegistered((()=>this._fullRefresh()))),this.register(T.onDecorationRemoved((()=>this._fullRefresh()))),this.register(j.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(D.cols,D.rows),this._fullRefresh()}))),this.register(j.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(D.buffer.y,D.buffer.y,!0)))),this.register(B.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(A.window,S),this.register(A.onWindowChange((R=>this._registerIntersectionObserver(R,S))))}_registerIntersectionObserver(x,S){if("IntersectionObserver"in x){const j=new x.IntersectionObserver((N=>this._handleIntersectionChange(N[N.length-1])),{threshold:0});j.observe(S),this._observerDisposable.value=(0,w.toDisposable)((()=>j.disconnect()))}}_handleIntersectionChange(x){this._isPaused=x.isIntersecting===void 0?x.intersectionRatio===0:!x.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(x,S,j=!1){this._isPaused?this._needsFullRefresh=!0:(j||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(x,S,this._rowCount))}_renderRows(x,S){this._renderer.value&&(x=Math.min(x,this._rowCount-1),S=Math.min(S,this._rowCount-1),this._renderer.value.renderRows(x,S),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:x,end:S}),this._onRender.fire({start:x,end:S}),this._isNextRenderRedrawOnly=!0)}resize(x,S){this._rowCount=S,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(x){this._renderer.value=x,this._renderer.value&&(this._renderer.value.onRequestRedraw((S=>this.refreshRows(S.start,S.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(x){return this._renderDebouncer.addRefreshCallback(x)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var x,S;this._renderer.value&&((S=(x=this._renderer.value).clearTextureAtlas)==null||S.call(x),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(x,S){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var j;return(j=this._renderer.value)==null?void 0:j.handleResize(x,S)})):this._renderer.value.handleResize(x,S),this._fullRefresh())}handleCharSizeChanged(){var x;(x=this._renderer.value)==null||x.handleCharSizeChanged()}handleBlur(){var x;(x=this._renderer.value)==null||x.handleBlur()}handleFocus(){var x;(x=this._renderer.value)==null||x.handleFocus()}handleSelectionChanged(x,S,j){var N;this._selectionState.start=x,this._selectionState.end=S,this._selectionState.columnSelectMode=j,(N=this._renderer.value)==null||N.handleSelectionChanged(x,S,j)}handleCursorMove(){var x;(x=this._renderer.value)==null||x.handleCursorMove()}clear(){var x;(x=this._renderer.value)==null||x.clear()}};l.RenderService=b=f([p(2,v.IOptionsService),p(3,_.ICharSizeService),p(4,v.IDecorationService),p(5,v.IBufferService),p(6,_.ICoreBrowserService),p(7,_.IThemeService)],b)},9312:function(c,l,h){var f=this&&this.__decorate||function(A,B,R,$){var F,W=arguments.length,Y=W<3?B:$===null?$=Object.getOwnPropertyDescriptor(B,R):$;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")Y=Reflect.decorate(A,B,R,$);else for(var P=A.length-1;P>=0;P--)(F=A[P])&&(Y=(W<3?F(Y):W>3?F(B,R,Y):F(B,R))||Y);return W>3&&Y&&Object.defineProperty(B,R,Y),Y},p=this&&this.__param||function(A,B){return function(R,$){B(R,$,A)}};Object.defineProperty(l,"__esModule",{value:!0}),l.SelectionService=void 0;const m=h(9806),_=h(9504),y=h(456),w=h(4725),k=h(8460),v=h(844),b=h(6114),x=h(4841),S=h(511),j=h(2585),N=" ",T=new RegExp(N,"g");let D=l.SelectionService=class extends v.Disposable{constructor(A,B,R,$,F,W,Y,P,H){super(),this._element=A,this._screenElement=B,this._linkifier=R,this._bufferService=$,this._coreService=F,this._mouseService=W,this._optionsService=Y,this._renderService=P,this._coreBrowserService=H,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new S.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new k.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new k.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new k.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new k.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=J=>this._handleMouseMove(J),this._mouseUpListener=J=>this._handleMouseUp(J),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((J=>this._handleTrim(J))),this.register(this._bufferService.buffers.onBufferActivate((J=>this._handleBufferActivate(J)))),this.enable(),this._model=new y.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,v.toDisposable)((()=>{this._removeMouseDownListeners()})))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){const A=this._model.finalSelectionStart,B=this._model.finalSelectionEnd;return!(!A||!B||A[0]===B[0]&&A[1]===B[1])}get selectionText(){const A=this._model.finalSelectionStart,B=this._model.finalSelectionEnd;if(!A||!B)return"";const R=this._bufferService.buffer,$=[];if(this._activeSelectionMode===3){if(A[0]===B[0])return"";const F=A[0]<B[0]?A[0]:B[0],W=A[0]<B[0]?B[0]:A[0];for(let Y=A[1];Y<=B[1];Y++){const P=R.translateBufferLineToString(Y,!0,F,W);$.push(P)}}else{const F=A[1]===B[1]?B[0]:void 0;$.push(R.translateBufferLineToString(A[1],!0,A[0],F));for(let W=A[1]+1;W<=B[1]-1;W++){const Y=R.lines.get(W),P=R.translateBufferLineToString(W,!0);Y!=null&&Y.isWrapped?$[$.length-1]+=P:$.push(P)}if(A[1]!==B[1]){const W=R.lines.get(B[1]),Y=R.translateBufferLineToString(B[1],!0,0,B[0]);W&&W.isWrapped?$[$.length-1]+=Y:$.push(Y)}}return $.map((F=>F.replace(T," "))).join(b.isWindows?`\r
63
+ `:`
64
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(A){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),b.isLinux&&A&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(A){const B=this._getMouseBufferCoords(A),R=this._model.finalSelectionStart,$=this._model.finalSelectionEnd;return!!(R&&$&&B)&&this._areCoordsInSelection(B,R,$)}isCellInSelection(A,B){const R=this._model.finalSelectionStart,$=this._model.finalSelectionEnd;return!(!R||!$)&&this._areCoordsInSelection([A,B],R,$)}_areCoordsInSelection(A,B,R){return A[1]>B[1]&&A[1]<R[1]||B[1]===R[1]&&A[1]===B[1]&&A[0]>=B[0]&&A[0]<R[0]||B[1]<R[1]&&A[1]===R[1]&&A[0]<R[0]||B[1]<R[1]&&A[1]===B[1]&&A[0]>=B[0]}_selectWordAtCursor(A,B){var F,W;const R=(W=(F=this._linkifier.currentLink)==null?void 0:F.link)==null?void 0:W.range;if(R)return this._model.selectionStart=[R.start.x-1,R.start.y-1],this._model.selectionStartLength=(0,x.getRangeLength)(R,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const $=this._getMouseBufferCoords(A);return!!$&&(this._selectWordAt($,B),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(A,B){this._model.clearSelection(),A=Math.max(A,0),B=Math.min(B,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,A],this._model.selectionEnd=[this._bufferService.cols,B],this.refresh(),this._onSelectionChange.fire()}_handleTrim(A){this._model.handleTrim(A)&&this.refresh()}_getMouseBufferCoords(A){const B=this._mouseService.getCoords(A,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(B)return B[0]--,B[1]--,B[1]+=this._bufferService.buffer.ydisp,B}_getMouseEventScrollAmount(A){let B=(0,m.getCoordsRelativeToElement)(this._coreBrowserService.window,A,this._screenElement)[1];const R=this._renderService.dimensions.css.canvas.height;return B>=0&&B<=R?0:(B>R&&(B-=R),B=Math.min(Math.max(B,-50),50),B/=50,B/Math.abs(B)+Math.round(14*B))}shouldForceSelection(A){return b.isMac?A.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:A.shiftKey}handleMouseDown(A){if(this._mouseDownTimeStamp=A.timeStamp,(A.button!==2||!this.hasSelection)&&A.button===0){if(!this._enabled){if(!this.shouldForceSelection(A))return;A.stopPropagation()}A.preventDefault(),this._dragScrollAmount=0,this._enabled&&A.shiftKey?this._handleIncrementalClick(A):A.detail===1?this._handleSingleClick(A):A.detail===2?this._handleDoubleClick(A):A.detail===3&&this._handleTripleClick(A),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval((()=>this._dragScroll()),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(A){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(A))}_handleSingleClick(A){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(A)?3:0,this._model.selectionStart=this._getMouseBufferCoords(A),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const B=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);B&&B.length!==this._model.selectionStart[0]&&B.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(A){this._selectWordAtCursor(A,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(A){const B=this._getMouseBufferCoords(A);B&&(this._activeSelectionMode=2,this._selectLineAt(B[1]))}shouldColumnSelect(A){return A.altKey&&!(b.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(A){if(A.stopImmediatePropagation(),!this._model.selectionStart)return;const B=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(A),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(A),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const R=this._bufferService.buffer;if(this._model.selectionEnd[1]<R.lines.length){const $=R.lines.get(this._model.selectionEnd[1]);$&&$.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}B&&B[0]===this._model.selectionEnd[0]&&B[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});const A=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(A.ydisp+this._bufferService.rows,A.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=A.ydisp),this.refresh()}}_handleMouseUp(A){const B=A.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&B<500&&A.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const R=this._mouseService.getCoords(A,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(R&&R[0]!==void 0&&R[1]!==void 0){const $=(0,_.moveToCellSequence)(R[0]-1,R[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent($,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const A=this._model.finalSelectionStart,B=this._model.finalSelectionEnd,R=!(!A||!B||A[0]===B[0]&&A[1]===B[1]);R?A&&B&&(this._oldSelectionStart&&this._oldSelectionEnd&&A[0]===this._oldSelectionStart[0]&&A[1]===this._oldSelectionStart[1]&&B[0]===this._oldSelectionEnd[0]&&B[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(A,B,R)):this._oldHasSelection&&this._fireOnSelectionChange(A,B,R)}_fireOnSelectionChange(A,B,R){this._oldSelectionStart=A,this._oldSelectionEnd=B,this._oldHasSelection=R,this._onSelectionChange.fire()}_handleBufferActivate(A){this.clearSelection(),this._trimListener.dispose(),this._trimListener=A.activeBuffer.lines.onTrim((B=>this._handleTrim(B)))}_convertViewportColToCharacterIndex(A,B){let R=B;for(let $=0;B>=$;$++){const F=A.loadCell($,this._workCell).getChars().length;this._workCell.getWidth()===0?R--:F>1&&B!==$&&(R+=F-1)}return R}setSelection(A,B,R){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[A,B],this._model.selectionStartLength=R,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(A){this._isClickInSelection(A)||(this._selectWordAtCursor(A,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(A,B,R=!0,$=!0){if(A[0]>=this._bufferService.cols)return;const F=this._bufferService.buffer,W=F.lines.get(A[1]);if(!W)return;const Y=F.translateBufferLineToString(A[1],!1);let P=this._convertViewportColToCharacterIndex(W,A[0]),H=P;const J=A[0]-P;let K=0,I=0,L=0,z=0;if(Y.charAt(P)===" "){for(;P>0&&Y.charAt(P-1)===" ";)P--;for(;H<Y.length&&Y.charAt(H+1)===" ";)H++}else{let ee=A[0],Z=A[0];W.getWidth(ee)===0&&(K++,ee--),W.getWidth(Z)===2&&(I++,Z++);const ne=W.getString(Z).length;for(ne>1&&(z+=ne-1,H+=ne-1);ee>0&&P>0&&!this._isCharWordSeparator(W.loadCell(ee-1,this._workCell));){W.loadCell(ee-1,this._workCell);const X=this._workCell.getChars().length;this._workCell.getWidth()===0?(K++,ee--):X>1&&(L+=X-1,P-=X-1),P--,ee--}for(;Z<W.length&&H+1<Y.length&&!this._isCharWordSeparator(W.loadCell(Z+1,this._workCell));){W.loadCell(Z+1,this._workCell);const X=this._workCell.getChars().length;this._workCell.getWidth()===2?(I++,Z++):X>1&&(z+=X-1,H+=X-1),H++,Z++}}H++;let V=P+J-K+L,U=Math.min(this._bufferService.cols,H-P+K+I-L-z);if(B||Y.slice(P,H).trim()!==""){if(R&&V===0&&W.getCodePoint(0)!==32){const ee=F.lines.get(A[1]-1);if(ee&&W.isWrapped&&ee.getCodePoint(this._bufferService.cols-1)!==32){const Z=this._getWordAt([this._bufferService.cols-1,A[1]-1],!1,!0,!1);if(Z){const ne=this._bufferService.cols-Z.start;V-=ne,U+=ne}}}if($&&V+U===this._bufferService.cols&&W.getCodePoint(this._bufferService.cols-1)!==32){const ee=F.lines.get(A[1]+1);if(ee!=null&&ee.isWrapped&&ee.getCodePoint(0)!==32){const Z=this._getWordAt([0,A[1]+1],!1,!1,!0);Z&&(U+=Z.length)}}return{start:V,length:U}}}_selectWordAt(A,B){const R=this._getWordAt(A,B);if(R){for(;R.start<0;)R.start+=this._bufferService.cols,A[1]--;this._model.selectionStart=[R.start,A[1]],this._model.selectionStartLength=R.length}}_selectToWordAt(A){const B=this._getWordAt(A,!0);if(B){let R=A[1];for(;B.start<0;)B.start+=this._bufferService.cols,R--;if(!this._model.areSelectionValuesReversed())for(;B.start+B.length>this._bufferService.cols;)B.length-=this._bufferService.cols,R++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?B.start:B.start+B.length,R]}}_isCharWordSeparator(A){return A.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(A.getChars())>=0}_selectLineAt(A){const B=this._bufferService.buffer.getWrappedRangeForLine(A),R={start:{x:0,y:B.first},end:{x:this._bufferService.cols-1,y:B.last}};this._model.selectionStart=[0,B.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,x.getRangeLength)(R,this._bufferService.cols)}};l.SelectionService=D=f([p(3,j.IBufferService),p(4,j.ICoreService),p(5,w.IMouseService),p(6,j.IOptionsService),p(7,w.IRenderService),p(8,w.ICoreBrowserService)],D)},4725:(c,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ILinkProviderService=l.IThemeService=l.ICharacterJoinerService=l.ISelectionService=l.IRenderService=l.IMouseService=l.ICoreBrowserService=l.ICharSizeService=void 0;const f=h(8343);l.ICharSizeService=(0,f.createDecorator)("CharSizeService"),l.ICoreBrowserService=(0,f.createDecorator)("CoreBrowserService"),l.IMouseService=(0,f.createDecorator)("MouseService"),l.IRenderService=(0,f.createDecorator)("RenderService"),l.ISelectionService=(0,f.createDecorator)("SelectionService"),l.ICharacterJoinerService=(0,f.createDecorator)("CharacterJoinerService"),l.IThemeService=(0,f.createDecorator)("ThemeService"),l.ILinkProviderService=(0,f.createDecorator)("LinkProviderService")},6731:function(c,l,h){var f=this&&this.__decorate||function(D,A,B,R){var $,F=arguments.length,W=F<3?A:R===null?R=Object.getOwnPropertyDescriptor(A,B):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")W=Reflect.decorate(D,A,B,R);else for(var Y=D.length-1;Y>=0;Y--)($=D[Y])&&(W=(F<3?$(W):F>3?$(A,B,W):$(A,B))||W);return F>3&&W&&Object.defineProperty(A,B,W),W},p=this&&this.__param||function(D,A){return function(B,R){A(B,R,D)}};Object.defineProperty(l,"__esModule",{value:!0}),l.ThemeService=l.DEFAULT_ANSI_COLORS=void 0;const m=h(7239),_=h(8055),y=h(8460),w=h(844),k=h(2585),v=_.css.toColor("#ffffff"),b=_.css.toColor("#000000"),x=_.css.toColor("#ffffff"),S=_.css.toColor("#000000"),j={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};l.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const D=[_.css.toColor("#2e3436"),_.css.toColor("#cc0000"),_.css.toColor("#4e9a06"),_.css.toColor("#c4a000"),_.css.toColor("#3465a4"),_.css.toColor("#75507b"),_.css.toColor("#06989a"),_.css.toColor("#d3d7cf"),_.css.toColor("#555753"),_.css.toColor("#ef2929"),_.css.toColor("#8ae234"),_.css.toColor("#fce94f"),_.css.toColor("#729fcf"),_.css.toColor("#ad7fa8"),_.css.toColor("#34e2e2"),_.css.toColor("#eeeeec")],A=[0,95,135,175,215,255];for(let B=0;B<216;B++){const R=A[B/36%6|0],$=A[B/6%6|0],F=A[B%6];D.push({css:_.channels.toCss(R,$,F),rgba:_.channels.toRgba(R,$,F)})}for(let B=0;B<24;B++){const R=8+10*B;D.push({css:_.channels.toCss(R,R,R),rgba:_.channels.toRgba(R,R,R)})}return D})());let N=l.ThemeService=class extends w.Disposable{get colors(){return this._colors}constructor(D){super(),this._optionsService=D,this._contrastCache=new m.ColorContrastCache,this._halfContrastCache=new m.ColorContrastCache,this._onChangeColors=this.register(new y.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:v,background:b,cursor:x,cursorAccent:S,selectionForeground:void 0,selectionBackgroundTransparent:j,selectionBackgroundOpaque:_.color.blend(b,j),selectionInactiveBackgroundTransparent:j,selectionInactiveBackgroundOpaque:_.color.blend(b,j),ansi:l.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",(()=>this._contrastCache.clear()))),this.register(this._optionsService.onSpecificOptionChange("theme",(()=>this._setTheme(this._optionsService.rawOptions.theme))))}_setTheme(D={}){const A=this._colors;if(A.foreground=T(D.foreground,v),A.background=T(D.background,b),A.cursor=T(D.cursor,x),A.cursorAccent=T(D.cursorAccent,S),A.selectionBackgroundTransparent=T(D.selectionBackground,j),A.selectionBackgroundOpaque=_.color.blend(A.background,A.selectionBackgroundTransparent),A.selectionInactiveBackgroundTransparent=T(D.selectionInactiveBackground,A.selectionBackgroundTransparent),A.selectionInactiveBackgroundOpaque=_.color.blend(A.background,A.selectionInactiveBackgroundTransparent),A.selectionForeground=D.selectionForeground?T(D.selectionForeground,_.NULL_COLOR):void 0,A.selectionForeground===_.NULL_COLOR&&(A.selectionForeground=void 0),_.color.isOpaque(A.selectionBackgroundTransparent)&&(A.selectionBackgroundTransparent=_.color.opacity(A.selectionBackgroundTransparent,.3)),_.color.isOpaque(A.selectionInactiveBackgroundTransparent)&&(A.selectionInactiveBackgroundTransparent=_.color.opacity(A.selectionInactiveBackgroundTransparent,.3)),A.ansi=l.DEFAULT_ANSI_COLORS.slice(),A.ansi[0]=T(D.black,l.DEFAULT_ANSI_COLORS[0]),A.ansi[1]=T(D.red,l.DEFAULT_ANSI_COLORS[1]),A.ansi[2]=T(D.green,l.DEFAULT_ANSI_COLORS[2]),A.ansi[3]=T(D.yellow,l.DEFAULT_ANSI_COLORS[3]),A.ansi[4]=T(D.blue,l.DEFAULT_ANSI_COLORS[4]),A.ansi[5]=T(D.magenta,l.DEFAULT_ANSI_COLORS[5]),A.ansi[6]=T(D.cyan,l.DEFAULT_ANSI_COLORS[6]),A.ansi[7]=T(D.white,l.DEFAULT_ANSI_COLORS[7]),A.ansi[8]=T(D.brightBlack,l.DEFAULT_ANSI_COLORS[8]),A.ansi[9]=T(D.brightRed,l.DEFAULT_ANSI_COLORS[9]),A.ansi[10]=T(D.brightGreen,l.DEFAULT_ANSI_COLORS[10]),A.ansi[11]=T(D.brightYellow,l.DEFAULT_ANSI_COLORS[11]),A.ansi[12]=T(D.brightBlue,l.DEFAULT_ANSI_COLORS[12]),A.ansi[13]=T(D.brightMagenta,l.DEFAULT_ANSI_COLORS[13]),A.ansi[14]=T(D.brightCyan,l.DEFAULT_ANSI_COLORS[14]),A.ansi[15]=T(D.brightWhite,l.DEFAULT_ANSI_COLORS[15]),D.extendedAnsi){const B=Math.min(A.ansi.length-16,D.extendedAnsi.length);for(let R=0;R<B;R++)A.ansi[R+16]=T(D.extendedAnsi[R],l.DEFAULT_ANSI_COLORS[R+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(D){this._restoreColor(D),this._onChangeColors.fire(this.colors)}_restoreColor(D){if(D!==void 0)switch(D){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[D]=this._restoreColors.ansi[D]}else for(let A=0;A<this._restoreColors.ansi.length;++A)this._colors.ansi[A]=this._restoreColors.ansi[A]}modifyColors(D){D(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function T(D,A){if(D!==void 0)try{return _.css.toColor(D)}catch{}return A}l.ThemeService=N=f([p(0,k.IOptionsService)],N)},6349:(c,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CircularList=void 0;const f=h(8460),p=h(844);class m extends p.Disposable{constructor(y){super(),this._maxLength=y,this.onDeleteEmitter=this.register(new f.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new f.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new f.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(y){if(this._maxLength===y)return;const w=new Array(y);for(let k=0;k<Math.min(y,this.length);k++)w[k]=this._array[this._getCyclicIndex(k)];this._array=w,this._maxLength=y,this._startIndex=0}get length(){return this._length}set length(y){if(y>this._length)for(let w=this._length;w<y;w++)this._array[w]=void 0;this._length=y}get(y){return this._array[this._getCyclicIndex(y)]}set(y,w){this._array[this._getCyclicIndex(y)]=w}push(y){this._array[this._getCyclicIndex(this._length)]=y,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(y,w,...k){if(w){for(let v=y;v<this._length-w;v++)this._array[this._getCyclicIndex(v)]=this._array[this._getCyclicIndex(v+w)];this._length-=w,this.onDeleteEmitter.fire({index:y,amount:w})}for(let v=this._length-1;v>=y;v--)this._array[this._getCyclicIndex(v+k.length)]=this._array[this._getCyclicIndex(v)];for(let v=0;v<k.length;v++)this._array[this._getCyclicIndex(y+v)]=k[v];if(k.length&&this.onInsertEmitter.fire({index:y,amount:k.length}),this._length+k.length>this._maxLength){const v=this._length+k.length-this._maxLength;this._startIndex+=v,this._length=this._maxLength,this.onTrimEmitter.fire(v)}else this._length+=k.length}trimStart(y){y>this._length&&(y=this._length),this._startIndex+=y,this._length-=y,this.onTrimEmitter.fire(y)}shiftElements(y,w,k){if(!(w<=0)){if(y<0||y>=this._length)throw new Error("start argument out of range");if(y+k<0)throw new Error("Cannot shift elements in list beyond index 0");if(k>0){for(let b=w-1;b>=0;b--)this.set(y+b+k,this.get(y+b));const v=y+w+k-this._length;if(v>0)for(this._length+=v;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let v=0;v<w;v++)this.set(y+v+k,this.get(y+v))}}_getCyclicIndex(y){return(this._startIndex+y)%this._maxLength}}l.CircularList=m},1439:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.clone=void 0,l.clone=function h(f,p=5){if(typeof f!="object")return f;const m=Array.isArray(f)?[]:{};for(const _ in f)m[_]=p<=1?f[_]:f[_]&&h(f[_],p-1);return m}},8055:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.contrastRatio=l.toPaddedHex=l.rgba=l.rgb=l.css=l.color=l.channels=l.NULL_COLOR=void 0;let h=0,f=0,p=0,m=0;var _,y,w,k,v;function b(S){const j=S.toString(16);return j.length<2?"0"+j:j}function x(S,j){return S<j?(j+.05)/(S+.05):(S+.05)/(j+.05)}l.NULL_COLOR={css:"#00000000",rgba:0},(function(S){S.toCss=function(j,N,T,D){return D!==void 0?`#${b(j)}${b(N)}${b(T)}${b(D)}`:`#${b(j)}${b(N)}${b(T)}`},S.toRgba=function(j,N,T,D=255){return(j<<24|N<<16|T<<8|D)>>>0},S.toColor=function(j,N,T,D){return{css:S.toCss(j,N,T,D),rgba:S.toRgba(j,N,T,D)}}})(_||(l.channels=_={})),(function(S){function j(N,T){return m=Math.round(255*T),[h,f,p]=v.toChannels(N.rgba),{css:_.toCss(h,f,p,m),rgba:_.toRgba(h,f,p,m)}}S.blend=function(N,T){if(m=(255&T.rgba)/255,m===1)return{css:T.css,rgba:T.rgba};const D=T.rgba>>24&255,A=T.rgba>>16&255,B=T.rgba>>8&255,R=N.rgba>>24&255,$=N.rgba>>16&255,F=N.rgba>>8&255;return h=R+Math.round((D-R)*m),f=$+Math.round((A-$)*m),p=F+Math.round((B-F)*m),{css:_.toCss(h,f,p),rgba:_.toRgba(h,f,p)}},S.isOpaque=function(N){return(255&N.rgba)==255},S.ensureContrastRatio=function(N,T,D){const A=v.ensureContrastRatio(N.rgba,T.rgba,D);if(A)return _.toColor(A>>24&255,A>>16&255,A>>8&255)},S.opaque=function(N){const T=(255|N.rgba)>>>0;return[h,f,p]=v.toChannels(T),{css:_.toCss(h,f,p),rgba:T}},S.opacity=j,S.multiplyOpacity=function(N,T){return m=255&N.rgba,j(N,m*T/255)},S.toColorRGB=function(N){return[N.rgba>>24&255,N.rgba>>16&255,N.rgba>>8&255]}})(y||(l.color=y={})),(function(S){let j,N;try{const T=document.createElement("canvas");T.width=1,T.height=1;const D=T.getContext("2d",{willReadFrequently:!0});D&&(j=D,j.globalCompositeOperation="copy",N=j.createLinearGradient(0,0,1,1))}catch{}S.toColor=function(T){if(T.match(/#[\da-f]{3,8}/i))switch(T.length){case 4:return h=parseInt(T.slice(1,2).repeat(2),16),f=parseInt(T.slice(2,3).repeat(2),16),p=parseInt(T.slice(3,4).repeat(2),16),_.toColor(h,f,p);case 5:return h=parseInt(T.slice(1,2).repeat(2),16),f=parseInt(T.slice(2,3).repeat(2),16),p=parseInt(T.slice(3,4).repeat(2),16),m=parseInt(T.slice(4,5).repeat(2),16),_.toColor(h,f,p,m);case 7:return{css:T,rgba:(parseInt(T.slice(1),16)<<8|255)>>>0};case 9:return{css:T,rgba:parseInt(T.slice(1),16)>>>0}}const D=T.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(D)return h=parseInt(D[1]),f=parseInt(D[2]),p=parseInt(D[3]),m=Math.round(255*(D[5]===void 0?1:parseFloat(D[5]))),_.toColor(h,f,p,m);if(!j||!N)throw new Error("css.toColor: Unsupported css format");if(j.fillStyle=N,j.fillStyle=T,typeof j.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(j.fillRect(0,0,1,1),[h,f,p,m]=j.getImageData(0,0,1,1).data,m!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:_.toRgba(h,f,p,m),css:T}}})(w||(l.css=w={})),(function(S){function j(N,T,D){const A=N/255,B=T/255,R=D/255;return .2126*(A<=.03928?A/12.92:Math.pow((A+.055)/1.055,2.4))+.7152*(B<=.03928?B/12.92:Math.pow((B+.055)/1.055,2.4))+.0722*(R<=.03928?R/12.92:Math.pow((R+.055)/1.055,2.4))}S.relativeLuminance=function(N){return j(N>>16&255,N>>8&255,255&N)},S.relativeLuminance2=j})(k||(l.rgb=k={})),(function(S){function j(T,D,A){const B=T>>24&255,R=T>>16&255,$=T>>8&255;let F=D>>24&255,W=D>>16&255,Y=D>>8&255,P=x(k.relativeLuminance2(F,W,Y),k.relativeLuminance2(B,R,$));for(;P<A&&(F>0||W>0||Y>0);)F-=Math.max(0,Math.ceil(.1*F)),W-=Math.max(0,Math.ceil(.1*W)),Y-=Math.max(0,Math.ceil(.1*Y)),P=x(k.relativeLuminance2(F,W,Y),k.relativeLuminance2(B,R,$));return(F<<24|W<<16|Y<<8|255)>>>0}function N(T,D,A){const B=T>>24&255,R=T>>16&255,$=T>>8&255;let F=D>>24&255,W=D>>16&255,Y=D>>8&255,P=x(k.relativeLuminance2(F,W,Y),k.relativeLuminance2(B,R,$));for(;P<A&&(F<255||W<255||Y<255);)F=Math.min(255,F+Math.ceil(.1*(255-F))),W=Math.min(255,W+Math.ceil(.1*(255-W))),Y=Math.min(255,Y+Math.ceil(.1*(255-Y))),P=x(k.relativeLuminance2(F,W,Y),k.relativeLuminance2(B,R,$));return(F<<24|W<<16|Y<<8|255)>>>0}S.blend=function(T,D){if(m=(255&D)/255,m===1)return D;const A=D>>24&255,B=D>>16&255,R=D>>8&255,$=T>>24&255,F=T>>16&255,W=T>>8&255;return h=$+Math.round((A-$)*m),f=F+Math.round((B-F)*m),p=W+Math.round((R-W)*m),_.toRgba(h,f,p)},S.ensureContrastRatio=function(T,D,A){const B=k.relativeLuminance(T>>8),R=k.relativeLuminance(D>>8);if(x(B,R)<A){if(R<B){const W=j(T,D,A),Y=x(B,k.relativeLuminance(W>>8));if(Y<A){const P=N(T,D,A);return Y>x(B,k.relativeLuminance(P>>8))?W:P}return W}const $=N(T,D,A),F=x(B,k.relativeLuminance($>>8));if(F<A){const W=j(T,D,A);return F>x(B,k.relativeLuminance(W>>8))?$:W}return $}},S.reduceLuminance=j,S.increaseLuminance=N,S.toChannels=function(T){return[T>>24&255,T>>16&255,T>>8&255,255&T]}})(v||(l.rgba=v={})),l.toPaddedHex=b,l.contrastRatio=x},8969:(c,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CoreTerminal=void 0;const f=h(844),p=h(2585),m=h(4348),_=h(7866),y=h(744),w=h(7302),k=h(6975),v=h(8460),b=h(1753),x=h(1480),S=h(7994),j=h(9282),N=h(5435),T=h(5981),D=h(2660);let A=!1;class B extends f.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new v.EventEmitter),this._onScroll.event(($=>{var F;(F=this._onScrollApi)==null||F.fire($.position)}))),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options($){for(const F in $)this.optionsService.options[F]=$[F]}constructor($){super(),this._windowsWrappingHeuristics=this.register(new f.MutableDisposable),this._onBinary=this.register(new v.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new v.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new v.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new v.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new v.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new v.EventEmitter),this._instantiationService=new m.InstantiationService,this.optionsService=this.register(new w.OptionsService($)),this._instantiationService.setService(p.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(y.BufferService)),this._instantiationService.setService(p.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(_.LogService)),this._instantiationService.setService(p.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(k.CoreService)),this._instantiationService.setService(p.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(b.CoreMouseService)),this._instantiationService.setService(p.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(x.UnicodeService)),this._instantiationService.setService(p.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(S.CharsetService),this._instantiationService.setService(p.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(D.OscLinkService),this._instantiationService.setService(p.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new N.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,v.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,v.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,v.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,v.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],(()=>this._handleWindowsPtyOptionChange()))),this.register(this._bufferService.onScroll((F=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this.register(this._inputHandler.onScroll((F=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this._writeBuffer=this.register(new T.WriteBuffer(((F,W)=>this._inputHandler.parse(F,W)))),this.register((0,v.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write($,F){this._writeBuffer.write($,F)}writeSync($,F){this._logService.logLevel<=p.LogLevelEnum.WARN&&!A&&(this._logService.warn("writeSync is unreliable and will be removed soon."),A=!0),this._writeBuffer.writeSync($,F)}input($,F=!0){this.coreService.triggerDataEvent($,F)}resize($,F){isNaN($)||isNaN(F)||($=Math.max($,y.MINIMUM_COLS),F=Math.max(F,y.MINIMUM_ROWS),this._bufferService.resize($,F))}scroll($,F=!1){this._bufferService.scroll($,F)}scrollLines($,F,W){this._bufferService.scrollLines($,F,W)}scrollPages($){this.scrollLines($*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine($){const F=$-this._bufferService.buffer.ydisp;F!==0&&this.scrollLines(F)}registerEscHandler($,F){return this._inputHandler.registerEscHandler($,F)}registerDcsHandler($,F){return this._inputHandler.registerDcsHandler($,F)}registerCsiHandler($,F){return this._inputHandler.registerCsiHandler($,F)}registerOscHandler($,F){return this._inputHandler.registerOscHandler($,F)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let $=!1;const F=this.optionsService.rawOptions.windowsPty;F&&F.buildNumber!==void 0&&F.buildNumber!==void 0?$=F.backend==="conpty"&&F.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&($=!0),$?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const $=[];$.push(this.onLineFeed(j.updateWindowsModeWrappedState.bind(null,this._bufferService))),$.push(this.registerCsiHandler({final:"H"},(()=>((0,j.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,f.toDisposable)((()=>{for(const F of $)F.dispose()}))}}}l.CoreTerminal=B},8460:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.runAndSubscribe=l.forwardEvent=l.EventEmitter=void 0,l.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=h=>(this._listeners.push(h),{dispose:()=>{if(!this._disposed){for(let f=0;f<this._listeners.length;f++)if(this._listeners[f]===h)return void this._listeners.splice(f,1)}}})),this._event}fire(h,f){const p=[];for(let m=0;m<this._listeners.length;m++)p.push(this._listeners[m]);for(let m=0;m<p.length;m++)p[m].call(void 0,h,f)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},l.forwardEvent=function(h,f){return h((p=>f.fire(p)))},l.runAndSubscribe=function(h,f){return f(void 0),h((p=>f(p)))}},5435:function(c,l,h){var f=this&&this.__decorate||function(K,I,L,z){var V,U=arguments.length,ee=U<3?I:z===null?z=Object.getOwnPropertyDescriptor(I,L):z;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")ee=Reflect.decorate(K,I,L,z);else for(var Z=K.length-1;Z>=0;Z--)(V=K[Z])&&(ee=(U<3?V(ee):U>3?V(I,L,ee):V(I,L))||ee);return U>3&&ee&&Object.defineProperty(I,L,ee),ee},p=this&&this.__param||function(K,I){return function(L,z){I(L,z,K)}};Object.defineProperty(l,"__esModule",{value:!0}),l.InputHandler=l.WindowsOptionsReportType=void 0;const m=h(2584),_=h(7116),y=h(2015),w=h(844),k=h(482),v=h(8437),b=h(8460),x=h(643),S=h(511),j=h(3734),N=h(2585),T=h(1480),D=h(6242),A=h(6351),B=h(5941),R={"(":0,")":1,"*":2,"+":3,"-":1,".":2},$=131072;function F(K,I){if(K>24)return I.setWinLines||!1;switch(K){case 1:return!!I.restoreWin;case 2:return!!I.minimizeWin;case 3:return!!I.setWinPosition;case 4:return!!I.setWinSizePixels;case 5:return!!I.raiseWin;case 6:return!!I.lowerWin;case 7:return!!I.refreshWin;case 8:return!!I.setWinSizeChars;case 9:return!!I.maximizeWin;case 10:return!!I.fullscreenWin;case 11:return!!I.getWinState;case 13:return!!I.getWinPosition;case 14:return!!I.getWinSizePixels;case 15:return!!I.getScreenSizePixels;case 16:return!!I.getCellSizePixels;case 18:return!!I.getWinSizeChars;case 19:return!!I.getScreenSizeChars;case 20:return!!I.getIconTitle;case 21:return!!I.getWinTitle;case 22:return!!I.pushTitle;case 23:return!!I.popTitle;case 24:return!!I.setWinLines}return!1}var W;(function(K){K[K.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",K[K.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(W||(l.WindowsOptionsReportType=W={}));let Y=0;class P extends w.Disposable{getAttrData(){return this._curAttrData}constructor(I,L,z,V,U,ee,Z,ne,X=new y.EscapeSequenceParser){super(),this._bufferService=I,this._charsetService=L,this._coreService=z,this._logService=V,this._optionsService=U,this._oscLinkService=ee,this._coreMouseService=Z,this._unicodeService=ne,this._parser=X,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new k.StringToUtf32,this._utf8Decoder=new k.Utf8ToUtf32,this._workCell=new S.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=v.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=v.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new b.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new b.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new b.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new b.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new b.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new b.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new b.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new b.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new b.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new b.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new b.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new b.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new b.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new H(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((G=>this._activeBuffer=G.activeBuffer))),this._parser.setCsiHandlerFallback(((G,le)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(G),params:le.toArray()})})),this._parser.setEscHandlerFallback((G=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(G)})})),this._parser.setExecuteHandlerFallback((G=>{this._logService.debug("Unknown EXECUTE code: ",{code:G})})),this._parser.setOscHandlerFallback(((G,le,se)=>{this._logService.debug("Unknown OSC code: ",{identifier:G,action:le,data:se})})),this._parser.setDcsHandlerFallback(((G,le,se)=>{le==="HOOK"&&(se=se.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(G),action:le,payload:se})})),this._parser.setPrintHandler(((G,le,se)=>this.print(G,le,se))),this._parser.registerCsiHandler({final:"@"},(G=>this.insertChars(G))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(G=>this.scrollLeft(G))),this._parser.registerCsiHandler({final:"A"},(G=>this.cursorUp(G))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(G=>this.scrollRight(G))),this._parser.registerCsiHandler({final:"B"},(G=>this.cursorDown(G))),this._parser.registerCsiHandler({final:"C"},(G=>this.cursorForward(G))),this._parser.registerCsiHandler({final:"D"},(G=>this.cursorBackward(G))),this._parser.registerCsiHandler({final:"E"},(G=>this.cursorNextLine(G))),this._parser.registerCsiHandler({final:"F"},(G=>this.cursorPrecedingLine(G))),this._parser.registerCsiHandler({final:"G"},(G=>this.cursorCharAbsolute(G))),this._parser.registerCsiHandler({final:"H"},(G=>this.cursorPosition(G))),this._parser.registerCsiHandler({final:"I"},(G=>this.cursorForwardTab(G))),this._parser.registerCsiHandler({final:"J"},(G=>this.eraseInDisplay(G,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(G=>this.eraseInDisplay(G,!0))),this._parser.registerCsiHandler({final:"K"},(G=>this.eraseInLine(G,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(G=>this.eraseInLine(G,!0))),this._parser.registerCsiHandler({final:"L"},(G=>this.insertLines(G))),this._parser.registerCsiHandler({final:"M"},(G=>this.deleteLines(G))),this._parser.registerCsiHandler({final:"P"},(G=>this.deleteChars(G))),this._parser.registerCsiHandler({final:"S"},(G=>this.scrollUp(G))),this._parser.registerCsiHandler({final:"T"},(G=>this.scrollDown(G))),this._parser.registerCsiHandler({final:"X"},(G=>this.eraseChars(G))),this._parser.registerCsiHandler({final:"Z"},(G=>this.cursorBackwardTab(G))),this._parser.registerCsiHandler({final:"`"},(G=>this.charPosAbsolute(G))),this._parser.registerCsiHandler({final:"a"},(G=>this.hPositionRelative(G))),this._parser.registerCsiHandler({final:"b"},(G=>this.repeatPrecedingCharacter(G))),this._parser.registerCsiHandler({final:"c"},(G=>this.sendDeviceAttributesPrimary(G))),this._parser.registerCsiHandler({prefix:">",final:"c"},(G=>this.sendDeviceAttributesSecondary(G))),this._parser.registerCsiHandler({final:"d"},(G=>this.linePosAbsolute(G))),this._parser.registerCsiHandler({final:"e"},(G=>this.vPositionRelative(G))),this._parser.registerCsiHandler({final:"f"},(G=>this.hVPosition(G))),this._parser.registerCsiHandler({final:"g"},(G=>this.tabClear(G))),this._parser.registerCsiHandler({final:"h"},(G=>this.setMode(G))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(G=>this.setModePrivate(G))),this._parser.registerCsiHandler({final:"l"},(G=>this.resetMode(G))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(G=>this.resetModePrivate(G))),this._parser.registerCsiHandler({final:"m"},(G=>this.charAttributes(G))),this._parser.registerCsiHandler({final:"n"},(G=>this.deviceStatus(G))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(G=>this.deviceStatusPrivate(G))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(G=>this.softReset(G))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(G=>this.setCursorStyle(G))),this._parser.registerCsiHandler({final:"r"},(G=>this.setScrollRegion(G))),this._parser.registerCsiHandler({final:"s"},(G=>this.saveCursor(G))),this._parser.registerCsiHandler({final:"t"},(G=>this.windowOptions(G))),this._parser.registerCsiHandler({final:"u"},(G=>this.restoreCursor(G))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(G=>this.insertColumns(G))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(G=>this.deleteColumns(G))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(G=>this.selectProtected(G))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(G=>this.requestMode(G,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(G=>this.requestMode(G,!1))),this._parser.setExecuteHandler(m.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(m.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(m.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(m.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(m.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(m.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(m.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(m.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(m.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(m.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(m.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(m.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new D.OscHandler((G=>(this.setTitle(G),this.setIconName(G),!0)))),this._parser.registerOscHandler(1,new D.OscHandler((G=>this.setIconName(G)))),this._parser.registerOscHandler(2,new D.OscHandler((G=>this.setTitle(G)))),this._parser.registerOscHandler(4,new D.OscHandler((G=>this.setOrReportIndexedColor(G)))),this._parser.registerOscHandler(8,new D.OscHandler((G=>this.setHyperlink(G)))),this._parser.registerOscHandler(10,new D.OscHandler((G=>this.setOrReportFgColor(G)))),this._parser.registerOscHandler(11,new D.OscHandler((G=>this.setOrReportBgColor(G)))),this._parser.registerOscHandler(12,new D.OscHandler((G=>this.setOrReportCursorColor(G)))),this._parser.registerOscHandler(104,new D.OscHandler((G=>this.restoreIndexedColor(G)))),this._parser.registerOscHandler(110,new D.OscHandler((G=>this.restoreFgColor(G)))),this._parser.registerOscHandler(111,new D.OscHandler((G=>this.restoreBgColor(G)))),this._parser.registerOscHandler(112,new D.OscHandler((G=>this.restoreCursorColor(G)))),this._parser.registerEscHandler({final:"7"},(()=>this.saveCursor())),this._parser.registerEscHandler({final:"8"},(()=>this.restoreCursor())),this._parser.registerEscHandler({final:"D"},(()=>this.index())),this._parser.registerEscHandler({final:"E"},(()=>this.nextLine())),this._parser.registerEscHandler({final:"H"},(()=>this.tabSet())),this._parser.registerEscHandler({final:"M"},(()=>this.reverseIndex())),this._parser.registerEscHandler({final:"="},(()=>this.keypadApplicationMode())),this._parser.registerEscHandler({final:">"},(()=>this.keypadNumericMode())),this._parser.registerEscHandler({final:"c"},(()=>this.fullReset())),this._parser.registerEscHandler({final:"n"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"o"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"|"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"}"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"~"},(()=>this.setgLevel(1))),this._parser.registerEscHandler({intermediates:"%",final:"@"},(()=>this.selectDefaultCharset())),this._parser.registerEscHandler({intermediates:"%",final:"G"},(()=>this.selectDefaultCharset()));for(const G in _.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:G},(()=>this.selectCharset("("+G))),this._parser.registerEscHandler({intermediates:")",final:G},(()=>this.selectCharset(")"+G))),this._parser.registerEscHandler({intermediates:"*",final:G},(()=>this.selectCharset("*"+G))),this._parser.registerEscHandler({intermediates:"+",final:G},(()=>this.selectCharset("+"+G))),this._parser.registerEscHandler({intermediates:"-",final:G},(()=>this.selectCharset("-"+G))),this._parser.registerEscHandler({intermediates:".",final:G},(()=>this.selectCharset("."+G))),this._parser.registerEscHandler({intermediates:"/",final:G},(()=>this.selectCharset("/"+G)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((G=>(this._logService.error("Parsing error: ",G),G))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new A.DcsHandler(((G,le)=>this.requestStatusString(G,le))))}_preserveStack(I,L,z,V){this._parseStack.paused=!0,this._parseStack.cursorStartX=I,this._parseStack.cursorStartY=L,this._parseStack.decodedLength=z,this._parseStack.position=V}_logSlowResolvingAsync(I){this._logService.logLevel<=N.LogLevelEnum.WARN&&Promise.race([I,new Promise(((L,z)=>setTimeout((()=>z("#SLOW_TIMEOUT")),5e3)))]).catch((L=>{if(L!=="#SLOW_TIMEOUT")throw L;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(I,L){let z,V=this._activeBuffer.x,U=this._activeBuffer.y,ee=0;const Z=this._parseStack.paused;if(Z){if(z=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,L))return this._logSlowResolvingAsync(z),z;V=this._parseStack.cursorStartX,U=this._parseStack.cursorStartY,this._parseStack.paused=!1,I.length>$&&(ee=this._parseStack.position+$)}if(this._logService.logLevel<=N.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof I=="string"?` "${I}"`:` "${Array.prototype.map.call(I,(G=>String.fromCharCode(G))).join("")}"`),typeof I=="string"?I.split("").map((G=>G.charCodeAt(0))):I),this._parseBuffer.length<I.length&&this._parseBuffer.length<$&&(this._parseBuffer=new Uint32Array(Math.min(I.length,$))),Z||this._dirtyRowTracker.clearRange(),I.length>$)for(let G=ee;G<I.length;G+=$){const le=G+$<I.length?G+$:I.length,se=typeof I=="string"?this._stringDecoder.decode(I.substring(G,le),this._parseBuffer):this._utf8Decoder.decode(I.subarray(G,le),this._parseBuffer);if(z=this._parser.parse(this._parseBuffer,se))return this._preserveStack(V,U,se,G),this._logSlowResolvingAsync(z),z}else if(!Z){const G=typeof I=="string"?this._stringDecoder.decode(I,this._parseBuffer):this._utf8Decoder.decode(I,this._parseBuffer);if(z=this._parser.parse(this._parseBuffer,G))return this._preserveStack(V,U,G,0),this._logSlowResolvingAsync(z),z}this._activeBuffer.x===V&&this._activeBuffer.y===U||this._onCursorMove.fire();const ne=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),X=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);X<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(X,this._bufferService.rows-1),Math.min(ne,this._bufferService.rows-1))}print(I,L,z){let V,U;const ee=this._charsetService.charset,Z=this._optionsService.rawOptions.screenReaderMode,ne=this._bufferService.cols,X=this._coreService.decPrivateModes.wraparound,G=this._coreService.modes.insertMode,le=this._curAttrData;let se=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&z-L>0&&se.getWidth(this._activeBuffer.x-1)===2&&se.setCellFromCodepoint(this._activeBuffer.x-1,0,1,le);let ve=this._parser.precedingJoinState;for(let be=L;be<z;++be){if(V=I[be],V<127&&ee){const Ve=ee[String.fromCharCode(V)];Ve&&(V=Ve.charCodeAt(0))}const Oe=this._unicodeService.charProperties(V,ve);U=T.UnicodeService.extractWidth(Oe);const Be=T.UnicodeService.extractShouldJoin(Oe),Pe=Be?T.UnicodeService.extractWidth(ve):0;if(ve=Oe,Z&&this._onA11yChar.fire((0,k.stringFromCodePoint)(V)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+U-Pe>ne){if(X){const Ve=se;let Ae=this._activeBuffer.x-Pe;for(this._activeBuffer.x=Pe,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),se=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),Pe>0&&se instanceof v.BufferLine&&se.copyCellsFrom(Ve,Ae,0,Pe,!1);Ae<ne;)Ve.setCellFromCodepoint(Ae++,0,1,le)}else if(this._activeBuffer.x=ne-1,U===2)continue}if(Be&&this._activeBuffer.x){const Ve=se.getWidth(this._activeBuffer.x-1)?1:2;se.addCodepointToCell(this._activeBuffer.x-Ve,V,U);for(let Ae=U-Pe;--Ae>=0;)se.setCellFromCodepoint(this._activeBuffer.x++,0,0,le)}else if(G&&(se.insertCells(this._activeBuffer.x,U-Pe,this._activeBuffer.getNullCell(le)),se.getWidth(ne-1)===2&&se.setCellFromCodepoint(ne-1,x.NULL_CELL_CODE,x.NULL_CELL_WIDTH,le)),se.setCellFromCodepoint(this._activeBuffer.x++,V,U,le),U>0)for(;--U;)se.setCellFromCodepoint(this._activeBuffer.x++,0,0,le)}this._parser.precedingJoinState=ve,this._activeBuffer.x<ne&&z-L>0&&se.getWidth(this._activeBuffer.x)===0&&!se.hasContent(this._activeBuffer.x)&&se.setCellFromCodepoint(this._activeBuffer.x,0,1,le),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(I,L){return I.final!=="t"||I.prefix||I.intermediates?this._parser.registerCsiHandler(I,L):this._parser.registerCsiHandler(I,(z=>!F(z.params[0],this._optionsService.rawOptions.windowOptions)||L(z)))}registerDcsHandler(I,L){return this._parser.registerDcsHandler(I,new A.DcsHandler(L))}registerEscHandler(I,L){return this._parser.registerEscHandler(I,L)}registerOscHandler(I,L){return this._parser.registerOscHandler(I,new D.OscHandler(L))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var I;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((I=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&I.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);L.hasWidth(this._activeBuffer.x)&&!L.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const I=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-I),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(I=this._bufferService.cols-1){this._activeBuffer.x=Math.min(I,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(I,L){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=I,this._activeBuffer.y=this._activeBuffer.scrollTop+L):(this._activeBuffer.x=I,this._activeBuffer.y=L),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(I,L){this._restrictCursor(),this._setCursor(this._activeBuffer.x+I,this._activeBuffer.y+L)}cursorUp(I){const L=this._activeBuffer.y-this._activeBuffer.scrollTop;return L>=0?this._moveCursor(0,-Math.min(L,I.params[0]||1)):this._moveCursor(0,-(I.params[0]||1)),!0}cursorDown(I){const L=this._activeBuffer.scrollBottom-this._activeBuffer.y;return L>=0?this._moveCursor(0,Math.min(L,I.params[0]||1)):this._moveCursor(0,I.params[0]||1),!0}cursorForward(I){return this._moveCursor(I.params[0]||1,0),!0}cursorBackward(I){return this._moveCursor(-(I.params[0]||1),0),!0}cursorNextLine(I){return this.cursorDown(I),this._activeBuffer.x=0,!0}cursorPrecedingLine(I){return this.cursorUp(I),this._activeBuffer.x=0,!0}cursorCharAbsolute(I){return this._setCursor((I.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(I){return this._setCursor(I.length>=2?(I.params[1]||1)-1:0,(I.params[0]||1)-1),!0}charPosAbsolute(I){return this._setCursor((I.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(I){return this._moveCursor(I.params[0]||1,0),!0}linePosAbsolute(I){return this._setCursor(this._activeBuffer.x,(I.params[0]||1)-1),!0}vPositionRelative(I){return this._moveCursor(0,I.params[0]||1),!0}hVPosition(I){return this.cursorPosition(I),!0}tabClear(I){const L=I.params[0];return L===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:L===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(I){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let L=I.params[0]||1;for(;L--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(I){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let L=I.params[0]||1;for(;L--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(I){const L=I.params[0];return L===1&&(this._curAttrData.bg|=536870912),L!==2&&L!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(I,L,z,V=!1,U=!1){const ee=this._activeBuffer.lines.get(this._activeBuffer.ybase+I);ee.replaceCells(L,z,this._activeBuffer.getNullCell(this._eraseAttrData()),U),V&&(ee.isWrapped=!1)}_resetBufferLine(I,L=!1){const z=this._activeBuffer.lines.get(this._activeBuffer.ybase+I);z&&(z.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),L),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+I),z.isWrapped=!1)}eraseInDisplay(I,L=!1){let z;switch(this._restrictCursor(this._bufferService.cols),I.params[0]){case 0:for(z=this._activeBuffer.y,this._dirtyRowTracker.markDirty(z),this._eraseInBufferLine(z++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,L);z<this._bufferService.rows;z++)this._resetBufferLine(z,L);this._dirtyRowTracker.markDirty(z);break;case 1:for(z=this._activeBuffer.y,this._dirtyRowTracker.markDirty(z),this._eraseInBufferLine(z,0,this._activeBuffer.x+1,!0,L),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(z+1).isWrapped=!1);z--;)this._resetBufferLine(z,L);this._dirtyRowTracker.markDirty(0);break;case 2:for(z=this._bufferService.rows,this._dirtyRowTracker.markDirty(z-1);z--;)this._resetBufferLine(z,L);this._dirtyRowTracker.markDirty(0);break;case 3:const V=this._activeBuffer.lines.length-this._bufferService.rows;V>0&&(this._activeBuffer.lines.trimStart(V),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-V,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-V,0),this._onScroll.fire(0))}return!0}eraseInLine(I,L=!1){switch(this._restrictCursor(this._bufferService.cols),I.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,L);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,L);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,L)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(I){this._restrictCursor();let L=I.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const z=this._activeBuffer.ybase+this._activeBuffer.y,V=this._bufferService.rows-1-this._activeBuffer.scrollBottom,U=this._bufferService.rows-1+this._activeBuffer.ybase-V+1;for(;L--;)this._activeBuffer.lines.splice(U-1,1),this._activeBuffer.lines.splice(z,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(I){this._restrictCursor();let L=I.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const z=this._activeBuffer.ybase+this._activeBuffer.y;let V;for(V=this._bufferService.rows-1-this._activeBuffer.scrollBottom,V=this._bufferService.rows-1+this._activeBuffer.ybase-V;L--;)this._activeBuffer.lines.splice(z,1),this._activeBuffer.lines.splice(V,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(I){this._restrictCursor();const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.insertCells(this._activeBuffer.x,I.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(I){this._restrictCursor();const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.deleteCells(this._activeBuffer.x,I.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(I){let L=I.params[0]||1;for(;L--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(I){let L=I.params[0]||1;for(;L--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(v.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(I){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=I.params[0]||1;for(let z=this._activeBuffer.scrollTop;z<=this._activeBuffer.scrollBottom;++z){const V=this._activeBuffer.lines.get(this._activeBuffer.ybase+z);V.deleteCells(0,L,this._activeBuffer.getNullCell(this._eraseAttrData())),V.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(I){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=I.params[0]||1;for(let z=this._activeBuffer.scrollTop;z<=this._activeBuffer.scrollBottom;++z){const V=this._activeBuffer.lines.get(this._activeBuffer.ybase+z);V.insertCells(0,L,this._activeBuffer.getNullCell(this._eraseAttrData())),V.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(I){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=I.params[0]||1;for(let z=this._activeBuffer.scrollTop;z<=this._activeBuffer.scrollBottom;++z){const V=this._activeBuffer.lines.get(this._activeBuffer.ybase+z);V.insertCells(this._activeBuffer.x,L,this._activeBuffer.getNullCell(this._eraseAttrData())),V.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(I){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=I.params[0]||1;for(let z=this._activeBuffer.scrollTop;z<=this._activeBuffer.scrollBottom;++z){const V=this._activeBuffer.lines.get(this._activeBuffer.ybase+z);V.deleteCells(this._activeBuffer.x,L,this._activeBuffer.getNullCell(this._eraseAttrData())),V.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(I){this._restrictCursor();const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(I.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(I){const L=this._parser.precedingJoinState;if(!L)return!0;const z=I.params[0]||1,V=T.UnicodeService.extractWidth(L),U=this._activeBuffer.x-V,ee=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(U),Z=new Uint32Array(ee.length*z);let ne=0;for(let G=0;G<ee.length;){const le=ee.codePointAt(G)||0;Z[ne++]=le,G+=le>65535?2:1}let X=ne;for(let G=1;G<z;++G)Z.copyWithin(X,0,ne),X+=ne;return this.print(Z,0,X),!0}sendDeviceAttributesPrimary(I){return I.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(m.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(m.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(I){return I.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(m.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(m.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(I.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(m.C0.ESC+"[>83;40003;0c")),!0}_is(I){return(this._optionsService.rawOptions.termName+"").indexOf(I)===0}setMode(I){for(let L=0;L<I.length;L++)switch(I.params[L]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(I){for(let L=0;L<I.length;L++)switch(I.params[L]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,_.DEFAULT_CHARSET),this._charsetService.setgCharset(1,_.DEFAULT_CHARSET),this._charsetService.setgCharset(2,_.DEFAULT_CHARSET),this._charsetService.setgCharset(3,_.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(I){for(let L=0;L<I.length;L++)switch(I.params[L]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(I){for(let L=0;L<I.length;L++)switch(I.params[L]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),I.params[L]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(I,L){const z=this._coreService.decPrivateModes,{activeProtocol:V,activeEncoding:U}=this._coreMouseService,ee=this._coreService,{buffers:Z,cols:ne}=this._bufferService,{active:X,alt:G}=Z,le=this._optionsService.rawOptions,se=Be=>Be?1:2,ve=I.params[0];return be=ve,Oe=L?ve===2?4:ve===4?se(ee.modes.insertMode):ve===12?3:ve===20?se(le.convertEol):0:ve===1?se(z.applicationCursorKeys):ve===3?le.windowOptions.setWinLines?ne===80?2:ne===132?1:0:0:ve===6?se(z.origin):ve===7?se(z.wraparound):ve===8?3:ve===9?se(V==="X10"):ve===12?se(le.cursorBlink):ve===25?se(!ee.isCursorHidden):ve===45?se(z.reverseWraparound):ve===66?se(z.applicationKeypad):ve===67?4:ve===1e3?se(V==="VT200"):ve===1002?se(V==="DRAG"):ve===1003?se(V==="ANY"):ve===1004?se(z.sendFocus):ve===1005?4:ve===1006?se(U==="SGR"):ve===1015?4:ve===1016?se(U==="SGR_PIXELS"):ve===1048?1:ve===47||ve===1047||ve===1049?se(X===G):ve===2004?se(z.bracketedPasteMode):0,ee.triggerDataEvent(`${m.C0.ESC}[${L?"":"?"}${be};${Oe}$y`),!0;var be,Oe}_updateAttrColor(I,L,z,V,U){return L===2?(I|=50331648,I&=-16777216,I|=j.AttributeData.fromColorRGB([z,V,U])):L===5&&(I&=-50331904,I|=33554432|255&z),I}_extractColor(I,L,z){const V=[0,0,-1,0,0,0];let U=0,ee=0;do{if(V[ee+U]=I.params[L+ee],I.hasSubParams(L+ee)){const Z=I.getSubParams(L+ee);let ne=0;do V[1]===5&&(U=1),V[ee+ne+1+U]=Z[ne];while(++ne<Z.length&&ne+ee+1+U<V.length);break}if(V[1]===5&&ee+U>=2||V[1]===2&&ee+U>=5)break;V[1]&&(U=1)}while(++ee+L<I.length&&ee+U<V.length);for(let Z=2;Z<V.length;++Z)V[Z]===-1&&(V[Z]=0);switch(V[0]){case 38:z.fg=this._updateAttrColor(z.fg,V[1],V[3],V[4],V[5]);break;case 48:z.bg=this._updateAttrColor(z.bg,V[1],V[3],V[4],V[5]);break;case 58:z.extended=z.extended.clone(),z.extended.underlineColor=this._updateAttrColor(z.extended.underlineColor,V[1],V[3],V[4],V[5])}return ee}_processUnderline(I,L){L.extended=L.extended.clone(),(!~I||I>5)&&(I=1),L.extended.underlineStyle=I,L.fg|=268435456,I===0&&(L.fg&=-268435457),L.updateExtended()}_processSGR0(I){I.fg=v.DEFAULT_ATTR_DATA.fg,I.bg=v.DEFAULT_ATTR_DATA.bg,I.extended=I.extended.clone(),I.extended.underlineStyle=0,I.extended.underlineColor&=-67108864,I.updateExtended()}charAttributes(I){if(I.length===1&&I.params[0]===0)return this._processSGR0(this._curAttrData),!0;const L=I.length;let z;const V=this._curAttrData;for(let U=0;U<L;U++)z=I.params[U],z>=30&&z<=37?(V.fg&=-50331904,V.fg|=16777216|z-30):z>=40&&z<=47?(V.bg&=-50331904,V.bg|=16777216|z-40):z>=90&&z<=97?(V.fg&=-50331904,V.fg|=16777224|z-90):z>=100&&z<=107?(V.bg&=-50331904,V.bg|=16777224|z-100):z===0?this._processSGR0(V):z===1?V.fg|=134217728:z===3?V.bg|=67108864:z===4?(V.fg|=268435456,this._processUnderline(I.hasSubParams(U)?I.getSubParams(U)[0]:1,V)):z===5?V.fg|=536870912:z===7?V.fg|=67108864:z===8?V.fg|=1073741824:z===9?V.fg|=2147483648:z===2?V.bg|=134217728:z===21?this._processUnderline(2,V):z===22?(V.fg&=-134217729,V.bg&=-134217729):z===23?V.bg&=-67108865:z===24?(V.fg&=-268435457,this._processUnderline(0,V)):z===25?V.fg&=-536870913:z===27?V.fg&=-67108865:z===28?V.fg&=-1073741825:z===29?V.fg&=2147483647:z===39?(V.fg&=-67108864,V.fg|=16777215&v.DEFAULT_ATTR_DATA.fg):z===49?(V.bg&=-67108864,V.bg|=16777215&v.DEFAULT_ATTR_DATA.bg):z===38||z===48||z===58?U+=this._extractColor(I,U,V):z===53?V.bg|=1073741824:z===55?V.bg&=-1073741825:z===59?(V.extended=V.extended.clone(),V.extended.underlineColor=-1,V.updateExtended()):z===100?(V.fg&=-67108864,V.fg|=16777215&v.DEFAULT_ATTR_DATA.fg,V.bg&=-67108864,V.bg|=16777215&v.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",z);return!0}deviceStatus(I){switch(I.params[0]){case 5:this._coreService.triggerDataEvent(`${m.C0.ESC}[0n`);break;case 6:const L=this._activeBuffer.y+1,z=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${m.C0.ESC}[${L};${z}R`)}return!0}deviceStatusPrivate(I){if(I.params[0]===6){const L=this._activeBuffer.y+1,z=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${m.C0.ESC}[?${L};${z}R`)}return!0}softReset(I){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=v.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(I){const L=I.params[0]||1;switch(L){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const z=L%2==1;return this._optionsService.options.cursorBlink=z,!0}setScrollRegion(I){const L=I.params[0]||1;let z;return(I.length<2||(z=I.params[1])>this._bufferService.rows||z===0)&&(z=this._bufferService.rows),z>L&&(this._activeBuffer.scrollTop=L-1,this._activeBuffer.scrollBottom=z-1,this._setCursor(0,0)),!0}windowOptions(I){if(!F(I.params[0],this._optionsService.rawOptions.windowOptions))return!0;const L=I.length>1?I.params[1]:0;switch(I.params[0]){case 14:L!==2&&this._onRequestWindowsOptionsReport.fire(W.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(W.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${m.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:L!==0&&L!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),L!==0&&L!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:L!==0&&L!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),L!==0&&L!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(I){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(I){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(I){return this._windowTitle=I,this._onTitleChange.fire(I),!0}setIconName(I){return this._iconName=I,!0}setOrReportIndexedColor(I){const L=[],z=I.split(";");for(;z.length>1;){const V=z.shift(),U=z.shift();if(/^\d+$/.exec(V)){const ee=parseInt(V);if(J(ee))if(U==="?")L.push({type:0,index:ee});else{const Z=(0,B.parseColor)(U);Z&&L.push({type:1,index:ee,color:Z})}}}return L.length&&this._onColor.fire(L),!0}setHyperlink(I){const L=I.split(";");return!(L.length<2)&&(L[1]?this._createHyperlink(L[0],L[1]):!L[0]&&this._finishHyperlink())}_createHyperlink(I,L){this._getCurrentLinkId()&&this._finishHyperlink();const z=I.split(":");let V;const U=z.findIndex((ee=>ee.startsWith("id=")));return U!==-1&&(V=z[U].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:V,uri:L}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(I,L){const z=I.split(";");for(let V=0;V<z.length&&!(L>=this._specialColors.length);++V,++L)if(z[V]==="?")this._onColor.fire([{type:0,index:this._specialColors[L]}]);else{const U=(0,B.parseColor)(z[V]);U&&this._onColor.fire([{type:1,index:this._specialColors[L],color:U}])}return!0}setOrReportFgColor(I){return this._setOrReportSpecialColor(I,0)}setOrReportBgColor(I){return this._setOrReportSpecialColor(I,1)}setOrReportCursorColor(I){return this._setOrReportSpecialColor(I,2)}restoreIndexedColor(I){if(!I)return this._onColor.fire([{type:2}]),!0;const L=[],z=I.split(";");for(let V=0;V<z.length;++V)if(/^\d+$/.exec(z[V])){const U=parseInt(z[V]);J(U)&&L.push({type:2,index:U})}return L.length&&this._onColor.fire(L),!0}restoreFgColor(I){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(I){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(I){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,_.DEFAULT_CHARSET),!0}selectCharset(I){return I.length!==2?(this.selectDefaultCharset(),!0):(I[0]==="/"||this._charsetService.setgCharset(R[I[0]],_.CHARSETS[I[1]]||_.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const I=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,I,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=v.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=v.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(I){return this._charsetService.setgLevel(I),!0}screenAlignmentPattern(){const I=new S.CellData;I.content=4194373,I.fg=this._curAttrData.fg,I.bg=this._curAttrData.bg,this._setCursor(0,0);for(let L=0;L<this._bufferService.rows;++L){const z=this._activeBuffer.ybase+this._activeBuffer.y+L,V=this._activeBuffer.lines.get(z);V&&(V.fill(I),V.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(I,L){const z=this._bufferService.buffer,V=this._optionsService.rawOptions;return(U=>(this._coreService.triggerDataEvent(`${m.C0.ESC}${U}${m.C0.ESC}\\`),!0))(I==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:I==='"p'?'P1$r61;1"p':I==="r"?`P1$r${z.scrollTop+1};${z.scrollBottom+1}r`:I==="m"?"P1$r0m":I===" q"?`P1$r${{block:2,underline:4,bar:6}[V.cursorStyle]-(V.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(I,L){this._dirtyRowTracker.markRangeDirty(I,L)}}l.InputHandler=P;let H=class{constructor(K){this._bufferService=K,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(K){K<this.start?this.start=K:K>this.end&&(this.end=K)}markRangeDirty(K,I){K>I&&(Y=K,K=I,I=Y),K<this.start&&(this.start=K),I>this.end&&(this.end=I)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function J(K){return 0<=K&&K<256}H=f([p(0,N.IBufferService)],H)},844:(c,l)=>{function h(f){for(const p of f)p.dispose();f.length=0}Object.defineProperty(l,"__esModule",{value:!0}),l.getDisposeArrayDisposable=l.disposeArray=l.toDisposable=l.MutableDisposable=l.Disposable=void 0,l.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const f of this._disposables)f.dispose();this._disposables.length=0}register(f){return this._disposables.push(f),f}unregister(f){const p=this._disposables.indexOf(f);p!==-1&&this._disposables.splice(p,1)}},l.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(f){var p;this._isDisposed||f===this._value||((p=this._value)==null||p.dispose(),this._value=f)}clear(){this.value=void 0}dispose(){var f;this._isDisposed=!0,(f=this._value)==null||f.dispose(),this._value=void 0}},l.toDisposable=function(f){return{dispose:f}},l.disposeArray=h,l.getDisposeArrayDisposable=function(f){return{dispose:()=>h(f)}}},1505:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.FourKeyMap=l.TwoKeyMap=void 0;class h{constructor(){this._data={}}set(p,m,_){this._data[p]||(this._data[p]={}),this._data[p][m]=_}get(p,m){return this._data[p]?this._data[p][m]:void 0}clear(){this._data={}}}l.TwoKeyMap=h,l.FourKeyMap=class{constructor(){this._data=new h}set(f,p,m,_,y){this._data.get(f,p)||this._data.set(f,p,new h),this._data.get(f,p).set(m,_,y)}get(f,p,m,_){var y;return(y=this._data.get(f,p))==null?void 0:y.get(m,_)}clear(){this._data.clear()}}},6114:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.isChromeOS=l.isLinux=l.isWindows=l.isIphone=l.isIpad=l.isMac=l.getSafariVersion=l.isSafari=l.isLegacyEdge=l.isFirefox=l.isNode=void 0,l.isNode=typeof process<"u"&&"title"in process;const h=l.isNode?"node":navigator.userAgent,f=l.isNode?"node":navigator.platform;l.isFirefox=h.includes("Firefox"),l.isLegacyEdge=h.includes("Edge"),l.isSafari=/^((?!chrome|android).)*safari/i.test(h),l.getSafariVersion=function(){if(!l.isSafari)return 0;const p=h.match(/Version\/(\d+)/);return p===null||p.length<2?0:parseInt(p[1])},l.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(f),l.isIpad=f==="iPad",l.isIphone=f==="iPhone",l.isWindows=["Windows","Win16","Win32","WinCE"].includes(f),l.isLinux=f.indexOf("Linux")>=0,l.isChromeOS=/\bCrOS\b/.test(h)},6106:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.SortedList=void 0;let h=0;l.SortedList=class{constructor(f){this._getKey=f,this._array=[]}clear(){this._array.length=0}insert(f){this._array.length!==0?(h=this._search(this._getKey(f)),this._array.splice(h,0,f)):this._array.push(f)}delete(f){if(this._array.length===0)return!1;const p=this._getKey(f);if(p===void 0||(h=this._search(p),h===-1)||this._getKey(this._array[h])!==p)return!1;do if(this._array[h]===f)return this._array.splice(h,1),!0;while(++h<this._array.length&&this._getKey(this._array[h])===p);return!1}*getKeyIterator(f){if(this._array.length!==0&&(h=this._search(f),!(h<0||h>=this._array.length)&&this._getKey(this._array[h])===f))do yield this._array[h];while(++h<this._array.length&&this._getKey(this._array[h])===f)}forEachByKey(f,p){if(this._array.length!==0&&(h=this._search(f),!(h<0||h>=this._array.length)&&this._getKey(this._array[h])===f))do p(this._array[h]);while(++h<this._array.length&&this._getKey(this._array[h])===f)}values(){return[...this._array].values()}_search(f){let p=0,m=this._array.length-1;for(;m>=p;){let _=p+m>>1;const y=this._getKey(this._array[_]);if(y>f)m=_-1;else{if(!(y<f)){for(;_>0&&this._getKey(this._array[_-1])===f;)_--;return _}p=_+1}}return p}}},7226:(c,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DebouncedIdleTask=l.IdleTaskQueue=l.PriorityTaskQueue=void 0;const f=h(6114);class p{constructor(){this._tasks=[],this._i=0}enqueue(y){this._tasks.push(y),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(y){this._idleCallback=void 0;let w=0,k=0,v=y.timeRemaining(),b=0;for(;this._i<this._tasks.length;){if(w=Date.now(),this._tasks[this._i]()||this._i++,w=Math.max(1,Date.now()-w),k=Math.max(w,k),b=y.timeRemaining(),1.5*k>b)return v-w<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(v-w))}ms`),void this._start();v=b}this.clear()}}class m extends p{_requestCallback(y){return setTimeout((()=>y(this._createDeadline(16))))}_cancelCallback(y){clearTimeout(y)}_createDeadline(y){const w=Date.now()+y;return{timeRemaining:()=>Math.max(0,w-Date.now())}}}l.PriorityTaskQueue=m,l.IdleTaskQueue=!f.isNode&&"requestIdleCallback"in window?class extends p{_requestCallback(_){return requestIdleCallback(_)}_cancelCallback(_){cancelIdleCallback(_)}}:m,l.DebouncedIdleTask=class{constructor(){this._queue=new l.IdleTaskQueue}set(_){this._queue.clear(),this._queue.enqueue(_)}flush(){this._queue.flush()}}},9282:(c,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.updateWindowsModeWrappedState=void 0;const f=h(643);l.updateWindowsModeWrappedState=function(p){const m=p.buffer.lines.get(p.buffer.ybase+p.buffer.y-1),_=m==null?void 0:m.get(p.cols-1),y=p.buffer.lines.get(p.buffer.ybase+p.buffer.y);y&&_&&(y.isWrapped=_[f.CHAR_DATA_CODE_INDEX]!==f.NULL_CELL_CODE&&_[f.CHAR_DATA_CODE_INDEX]!==f.WHITESPACE_CELL_CODE)}},3734:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ExtendedAttrs=l.AttributeData=void 0;class h{constructor(){this.fg=0,this.bg=0,this.extended=new f}static toColorRGB(m){return[m>>>16&255,m>>>8&255,255&m]}static fromColorRGB(m){return(255&m[0])<<16|(255&m[1])<<8|255&m[2]}clone(){const m=new h;return m.fg=this.fg,m.bg=this.bg,m.extended=this.extended.clone(),m}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}l.AttributeData=h;class f{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(m){this._ext=m}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(m){this._ext&=-469762049,this._ext|=m<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(m){this._ext&=-67108864,this._ext|=67108863&m}get urlId(){return this._urlId}set urlId(m){this._urlId=m}get underlineVariantOffset(){const m=(3758096384&this._ext)>>29;return m<0?4294967288^m:m}set underlineVariantOffset(m){this._ext&=536870911,this._ext|=m<<29&3758096384}constructor(m=0,_=0){this._ext=0,this._urlId=0,this._ext=m,this._urlId=_}clone(){return new f(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}l.ExtendedAttrs=f},9092:(c,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Buffer=l.MAX_BUFFER_SIZE=void 0;const f=h(6349),p=h(7226),m=h(3734),_=h(8437),y=h(4634),w=h(511),k=h(643),v=h(4863),b=h(7116);l.MAX_BUFFER_SIZE=4294967295,l.Buffer=class{constructor(x,S,j){this._hasScrollback=x,this._optionsService=S,this._bufferService=j,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=_.DEFAULT_ATTR_DATA.clone(),this.savedCharset=b.DEFAULT_CHARSET,this.markers=[],this._nullCell=w.CellData.fromCharData([0,k.NULL_CELL_CHAR,k.NULL_CELL_WIDTH,k.NULL_CELL_CODE]),this._whitespaceCell=w.CellData.fromCharData([0,k.WHITESPACE_CELL_CHAR,k.WHITESPACE_CELL_WIDTH,k.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new p.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new f.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(x){return x?(this._nullCell.fg=x.fg,this._nullCell.bg=x.bg,this._nullCell.extended=x.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new m.ExtendedAttrs),this._nullCell}getWhitespaceCell(x){return x?(this._whitespaceCell.fg=x.fg,this._whitespaceCell.bg=x.bg,this._whitespaceCell.extended=x.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new m.ExtendedAttrs),this._whitespaceCell}getBlankLine(x,S){return new _.BufferLine(this._bufferService.cols,this.getNullCell(x),S)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const x=this.ybase+this.y-this.ydisp;return x>=0&&x<this._rows}_getCorrectBufferLength(x){if(!this._hasScrollback)return x;const S=x+this._optionsService.rawOptions.scrollback;return S>l.MAX_BUFFER_SIZE?l.MAX_BUFFER_SIZE:S}fillViewportRows(x){if(this.lines.length===0){x===void 0&&(x=_.DEFAULT_ATTR_DATA);let S=this._rows;for(;S--;)this.lines.push(this.getBlankLine(x))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new f.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(x,S){const j=this.getNullCell(_.DEFAULT_ATTR_DATA);let N=0;const T=this._getCorrectBufferLength(S);if(T>this.lines.maxLength&&(this.lines.maxLength=T),this.lines.length>0){if(this._cols<x)for(let A=0;A<this.lines.length;A++)N+=+this.lines.get(A).resize(x,j);let D=0;if(this._rows<S)for(let A=this._rows;A<S;A++)this.lines.length<S+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new _.BufferLine(x,j)):this.ybase>0&&this.lines.length<=this.ybase+this.y+D+1?(this.ybase--,D++,this.ydisp>0&&this.ydisp--):this.lines.push(new _.BufferLine(x,j)));else for(let A=this._rows;A>S;A--)this.lines.length>S+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(T<this.lines.maxLength){const A=this.lines.length-T;A>0&&(this.lines.trimStart(A),this.ybase=Math.max(this.ybase-A,0),this.ydisp=Math.max(this.ydisp-A,0),this.savedY=Math.max(this.savedY-A,0)),this.lines.maxLength=T}this.x=Math.min(this.x,x-1),this.y=Math.min(this.y,S-1),D&&(this.y+=D),this.savedX=Math.min(this.savedX,x-1),this.scrollTop=0}if(this.scrollBottom=S-1,this._isReflowEnabled&&(this._reflow(x,S),this._cols>x))for(let D=0;D<this.lines.length;D++)N+=+this.lines.get(D).resize(x,j);this._cols=x,this._rows=S,this._memoryCleanupQueue.clear(),N>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let x=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,x=!1);let S=0;for(;this._memoryCleanupPosition<this.lines.length;)if(S+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),S>100)return!0;return x}get _isReflowEnabled(){const x=this._optionsService.rawOptions.windowsPty;return x&&x.buildNumber?this._hasScrollback&&x.backend==="conpty"&&x.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(x,S){this._cols!==x&&(x>this._cols?this._reflowLarger(x,S):this._reflowSmaller(x,S))}_reflowLarger(x,S){const j=(0,y.reflowLargerGetLinesToRemove)(this.lines,this._cols,x,this.ybase+this.y,this.getNullCell(_.DEFAULT_ATTR_DATA));if(j.length>0){const N=(0,y.reflowLargerCreateNewLayout)(this.lines,j);(0,y.reflowLargerApplyNewLayout)(this.lines,N.layout),this._reflowLargerAdjustViewport(x,S,N.countRemoved)}}_reflowLargerAdjustViewport(x,S,j){const N=this.getNullCell(_.DEFAULT_ATTR_DATA);let T=j;for(;T-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<S&&this.lines.push(new _.BufferLine(x,N))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-j,0)}_reflowSmaller(x,S){const j=this.getNullCell(_.DEFAULT_ATTR_DATA),N=[];let T=0;for(let D=this.lines.length-1;D>=0;D--){let A=this.lines.get(D);if(!A||!A.isWrapped&&A.getTrimmedLength()<=x)continue;const B=[A];for(;A.isWrapped&&D>0;)A=this.lines.get(--D),B.unshift(A);const R=this.ybase+this.y;if(R>=D&&R<D+B.length)continue;const $=B[B.length-1].getTrimmedLength(),F=(0,y.reflowSmallerGetNewLineLengths)(B,this._cols,x),W=F.length-B.length;let Y;Y=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+W):Math.max(0,this.lines.length-this.lines.maxLength+W);const P=[];for(let z=0;z<W;z++){const V=this.getBlankLine(_.DEFAULT_ATTR_DATA,!0);P.push(V)}P.length>0&&(N.push({start:D+B.length+T,newLines:P}),T+=P.length),B.push(...P);let H=F.length-1,J=F[H];J===0&&(H--,J=F[H]);let K=B.length-W-1,I=$;for(;K>=0;){const z=Math.min(I,J);if(B[H]===void 0)break;if(B[H].copyCellsFrom(B[K],I-z,J-z,z,!0),J-=z,J===0&&(H--,J=F[H]),I-=z,I===0){K--;const V=Math.max(K,0);I=(0,y.getWrappedLineTrimmedLength)(B,V,this._cols)}}for(let z=0;z<B.length;z++)F[z]<x&&B[z].setCell(F[z],j);let L=W-Y;for(;L-- >0;)this.ybase===0?this.y<S-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+T)-S&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+W,this.ybase+S-1)}if(N.length>0){const D=[],A=[];for(let H=0;H<this.lines.length;H++)A.push(this.lines.get(H));const B=this.lines.length;let R=B-1,$=0,F=N[$];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+T);let W=0;for(let H=Math.min(this.lines.maxLength-1,B+T-1);H>=0;H--)if(F&&F.start>R+W){for(let J=F.newLines.length-1;J>=0;J--)this.lines.set(H--,F.newLines[J]);H++,D.push({index:R+1,amount:F.newLines.length}),W+=F.newLines.length,F=N[++$]}else this.lines.set(H,A[R--]);let Y=0;for(let H=D.length-1;H>=0;H--)D[H].index+=Y,this.lines.onInsertEmitter.fire(D[H]),Y+=D[H].amount;const P=Math.max(0,B+T-this.lines.maxLength);P>0&&this.lines.onTrimEmitter.fire(P)}}translateBufferLineToString(x,S,j=0,N){const T=this.lines.get(x);return T?T.translateToString(S,j,N):""}getWrappedRangeForLine(x){let S=x,j=x;for(;S>0&&this.lines.get(S).isWrapped;)S--;for(;j+1<this.lines.length&&this.lines.get(j+1).isWrapped;)j++;return{first:S,last:j}}setupTabStops(x){for(x!=null?this.tabs[x]||(x=this.prevStop(x)):(this.tabs={},x=0);x<this._cols;x+=this._optionsService.rawOptions.tabStopWidth)this.tabs[x]=!0}prevStop(x){for(x==null&&(x=this.x);!this.tabs[--x]&&x>0;);return x>=this._cols?this._cols-1:x<0?0:x}nextStop(x){for(x==null&&(x=this.x);!this.tabs[++x]&&x<this._cols;);return x>=this._cols?this._cols-1:x<0?0:x}clearMarkers(x){this._isClearing=!0;for(let S=0;S<this.markers.length;S++)this.markers[S].line===x&&(this.markers[S].dispose(),this.markers.splice(S--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let x=0;x<this.markers.length;x++)this.markers[x].dispose(),this.markers.splice(x--,1);this._isClearing=!1}addMarker(x){const S=new v.Marker(x);return this.markers.push(S),S.register(this.lines.onTrim((j=>{S.line-=j,S.line<0&&S.dispose()}))),S.register(this.lines.onInsert((j=>{S.line>=j.index&&(S.line+=j.amount)}))),S.register(this.lines.onDelete((j=>{S.line>=j.index&&S.line<j.index+j.amount&&S.dispose(),S.line>j.index&&(S.line-=j.amount)}))),S.register(S.onDispose((()=>this._removeMarker(S)))),S}_removeMarker(x){this._isClearing||this.markers.splice(this.markers.indexOf(x),1)}}},8437:(c,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferLine=l.DEFAULT_ATTR_DATA=void 0;const f=h(3734),p=h(511),m=h(643),_=h(482);l.DEFAULT_ATTR_DATA=Object.freeze(new f.AttributeData);let y=0;class w{constructor(v,b,x=!1){this.isWrapped=x,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*v);const S=b||p.CellData.fromCharData([0,m.NULL_CELL_CHAR,m.NULL_CELL_WIDTH,m.NULL_CELL_CODE]);for(let j=0;j<v;++j)this.setCell(j,S);this.length=v}get(v){const b=this._data[3*v+0],x=2097151&b;return[this._data[3*v+1],2097152&b?this._combined[v]:x?(0,_.stringFromCodePoint)(x):"",b>>22,2097152&b?this._combined[v].charCodeAt(this._combined[v].length-1):x]}set(v,b){this._data[3*v+1]=b[m.CHAR_DATA_ATTR_INDEX],b[m.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[v]=b[1],this._data[3*v+0]=2097152|v|b[m.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*v+0]=b[m.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|b[m.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(v){return this._data[3*v+0]>>22}hasWidth(v){return 12582912&this._data[3*v+0]}getFg(v){return this._data[3*v+1]}getBg(v){return this._data[3*v+2]}hasContent(v){return 4194303&this._data[3*v+0]}getCodePoint(v){const b=this._data[3*v+0];return 2097152&b?this._combined[v].charCodeAt(this._combined[v].length-1):2097151&b}isCombined(v){return 2097152&this._data[3*v+0]}getString(v){const b=this._data[3*v+0];return 2097152&b?this._combined[v]:2097151&b?(0,_.stringFromCodePoint)(2097151&b):""}isProtected(v){return 536870912&this._data[3*v+2]}loadCell(v,b){return y=3*v,b.content=this._data[y+0],b.fg=this._data[y+1],b.bg=this._data[y+2],2097152&b.content&&(b.combinedData=this._combined[v]),268435456&b.bg&&(b.extended=this._extendedAttrs[v]),b}setCell(v,b){2097152&b.content&&(this._combined[v]=b.combinedData),268435456&b.bg&&(this._extendedAttrs[v]=b.extended),this._data[3*v+0]=b.content,this._data[3*v+1]=b.fg,this._data[3*v+2]=b.bg}setCellFromCodepoint(v,b,x,S){268435456&S.bg&&(this._extendedAttrs[v]=S.extended),this._data[3*v+0]=b|x<<22,this._data[3*v+1]=S.fg,this._data[3*v+2]=S.bg}addCodepointToCell(v,b,x){let S=this._data[3*v+0];2097152&S?this._combined[v]+=(0,_.stringFromCodePoint)(b):2097151&S?(this._combined[v]=(0,_.stringFromCodePoint)(2097151&S)+(0,_.stringFromCodePoint)(b),S&=-2097152,S|=2097152):S=b|4194304,x&&(S&=-12582913,S|=x<<22),this._data[3*v+0]=S}insertCells(v,b,x){if((v%=this.length)&&this.getWidth(v-1)===2&&this.setCellFromCodepoint(v-1,0,1,x),b<this.length-v){const S=new p.CellData;for(let j=this.length-v-b-1;j>=0;--j)this.setCell(v+b+j,this.loadCell(v+j,S));for(let j=0;j<b;++j)this.setCell(v+j,x)}else for(let S=v;S<this.length;++S)this.setCell(S,x);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,x)}deleteCells(v,b,x){if(v%=this.length,b<this.length-v){const S=new p.CellData;for(let j=0;j<this.length-v-b;++j)this.setCell(v+j,this.loadCell(v+b+j,S));for(let j=this.length-b;j<this.length;++j)this.setCell(j,x)}else for(let S=v;S<this.length;++S)this.setCell(S,x);v&&this.getWidth(v-1)===2&&this.setCellFromCodepoint(v-1,0,1,x),this.getWidth(v)!==0||this.hasContent(v)||this.setCellFromCodepoint(v,0,1,x)}replaceCells(v,b,x,S=!1){if(S)for(v&&this.getWidth(v-1)===2&&!this.isProtected(v-1)&&this.setCellFromCodepoint(v-1,0,1,x),b<this.length&&this.getWidth(b-1)===2&&!this.isProtected(b)&&this.setCellFromCodepoint(b,0,1,x);v<b&&v<this.length;)this.isProtected(v)||this.setCell(v,x),v++;else for(v&&this.getWidth(v-1)===2&&this.setCellFromCodepoint(v-1,0,1,x),b<this.length&&this.getWidth(b-1)===2&&this.setCellFromCodepoint(b,0,1,x);v<b&&v<this.length;)this.setCell(v++,x)}resize(v,b){if(v===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const x=3*v;if(v>this.length){if(this._data.buffer.byteLength>=4*x)this._data=new Uint32Array(this._data.buffer,0,x);else{const S=new Uint32Array(x);S.set(this._data),this._data=S}for(let S=this.length;S<v;++S)this.setCell(S,b)}else{this._data=this._data.subarray(0,x);const S=Object.keys(this._combined);for(let N=0;N<S.length;N++){const T=parseInt(S[N],10);T>=v&&delete this._combined[T]}const j=Object.keys(this._extendedAttrs);for(let N=0;N<j.length;N++){const T=parseInt(j[N],10);T>=v&&delete this._extendedAttrs[T]}}return this.length=v,4*x*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const v=new Uint32Array(this._data.length);return v.set(this._data),this._data=v,1}return 0}fill(v,b=!1){if(b)for(let x=0;x<this.length;++x)this.isProtected(x)||this.setCell(x,v);else{this._combined={},this._extendedAttrs={};for(let x=0;x<this.length;++x)this.setCell(x,v)}}copyFrom(v){this.length!==v.length?this._data=new Uint32Array(v._data):this._data.set(v._data),this.length=v.length,this._combined={};for(const b in v._combined)this._combined[b]=v._combined[b];this._extendedAttrs={};for(const b in v._extendedAttrs)this._extendedAttrs[b]=v._extendedAttrs[b];this.isWrapped=v.isWrapped}clone(){const v=new w(0);v._data=new Uint32Array(this._data),v.length=this.length;for(const b in this._combined)v._combined[b]=this._combined[b];for(const b in this._extendedAttrs)v._extendedAttrs[b]=this._extendedAttrs[b];return v.isWrapped=this.isWrapped,v}getTrimmedLength(){for(let v=this.length-1;v>=0;--v)if(4194303&this._data[3*v+0])return v+(this._data[3*v+0]>>22);return 0}getNoBgTrimmedLength(){for(let v=this.length-1;v>=0;--v)if(4194303&this._data[3*v+0]||50331648&this._data[3*v+2])return v+(this._data[3*v+0]>>22);return 0}copyCellsFrom(v,b,x,S,j){const N=v._data;if(j)for(let D=S-1;D>=0;D--){for(let A=0;A<3;A++)this._data[3*(x+D)+A]=N[3*(b+D)+A];268435456&N[3*(b+D)+2]&&(this._extendedAttrs[x+D]=v._extendedAttrs[b+D])}else for(let D=0;D<S;D++){for(let A=0;A<3;A++)this._data[3*(x+D)+A]=N[3*(b+D)+A];268435456&N[3*(b+D)+2]&&(this._extendedAttrs[x+D]=v._extendedAttrs[b+D])}const T=Object.keys(v._combined);for(let D=0;D<T.length;D++){const A=parseInt(T[D],10);A>=b&&(this._combined[A-b+x]=v._combined[A])}}translateToString(v,b,x,S){b=b??0,x=x??this.length,v&&(x=Math.min(x,this.getTrimmedLength())),S&&(S.length=0);let j="";for(;b<x;){const N=this._data[3*b+0],T=2097151&N,D=2097152&N?this._combined[b]:T?(0,_.stringFromCodePoint)(T):m.WHITESPACE_CELL_CHAR;if(j+=D,S)for(let A=0;A<D.length;++A)S.push(b);b+=N>>22||1}return S&&S.push(b),j}}l.BufferLine=w},4841:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.getRangeLength=void 0,l.getRangeLength=function(h,f){if(h.start.y>h.end.y)throw new Error(`Buffer range end (${h.end.x}, ${h.end.y}) cannot be before start (${h.start.x}, ${h.start.y})`);return f*(h.end.y-h.start.y)+(h.end.x-h.start.x+1)}},4634:(c,l)=>{function h(f,p,m){if(p===f.length-1)return f[p].getTrimmedLength();const _=!f[p].hasContent(m-1)&&f[p].getWidth(m-1)===1,y=f[p+1].getWidth(0)===2;return _&&y?m-1:m}Object.defineProperty(l,"__esModule",{value:!0}),l.getWrappedLineTrimmedLength=l.reflowSmallerGetNewLineLengths=l.reflowLargerApplyNewLayout=l.reflowLargerCreateNewLayout=l.reflowLargerGetLinesToRemove=void 0,l.reflowLargerGetLinesToRemove=function(f,p,m,_,y){const w=[];for(let k=0;k<f.length-1;k++){let v=k,b=f.get(++v);if(!b.isWrapped)continue;const x=[f.get(k)];for(;v<f.length&&b.isWrapped;)x.push(b),b=f.get(++v);if(_>=k&&_<v){k+=x.length-1;continue}let S=0,j=h(x,S,p),N=1,T=0;for(;N<x.length;){const A=h(x,N,p),B=A-T,R=m-j,$=Math.min(B,R);x[S].copyCellsFrom(x[N],T,j,$,!1),j+=$,j===m&&(S++,j=0),T+=$,T===A&&(N++,T=0),j===0&&S!==0&&x[S-1].getWidth(m-1)===2&&(x[S].copyCellsFrom(x[S-1],m-1,j++,1,!1),x[S-1].setCell(m-1,y))}x[S].replaceCells(j,m,y);let D=0;for(let A=x.length-1;A>0&&(A>S||x[A].getTrimmedLength()===0);A--)D++;D>0&&(w.push(k+x.length-D),w.push(D)),k+=x.length-1}return w},l.reflowLargerCreateNewLayout=function(f,p){const m=[];let _=0,y=p[_],w=0;for(let k=0;k<f.length;k++)if(y===k){const v=p[++_];f.onDeleteEmitter.fire({index:k-w,amount:v}),k+=v-1,w+=v,y=p[++_]}else m.push(k);return{layout:m,countRemoved:w}},l.reflowLargerApplyNewLayout=function(f,p){const m=[];for(let _=0;_<p.length;_++)m.push(f.get(p[_]));for(let _=0;_<m.length;_++)f.set(_,m[_]);f.length=p.length},l.reflowSmallerGetNewLineLengths=function(f,p,m){const _=[],y=f.map(((b,x)=>h(f,x,p))).reduce(((b,x)=>b+x));let w=0,k=0,v=0;for(;v<y;){if(y-v<m){_.push(y-v);break}w+=m;const b=h(f,k,p);w>b&&(w-=b,k++);const x=f[k].getWidth(w-1)===2;x&&w--;const S=x?m-1:m;_.push(S),v+=S}return _},l.getWrappedLineTrimmedLength=h},5295:(c,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferSet=void 0;const f=h(8460),p=h(844),m=h(9092);class _ extends p.Disposable{constructor(w,k){super(),this._optionsService=w,this._bufferService=k,this._onBufferActivate=this.register(new f.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.resize(this._bufferService.cols,this._bufferService.rows)))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",(()=>this.setupTabStops())))}reset(){this._normal=new m.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new m.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(w){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(w),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(w,k){this._normal.resize(w,k),this._alt.resize(w,k),this.setupTabStops(w)}setupTabStops(w){this._normal.setupTabStops(w),this._alt.setupTabStops(w)}}l.BufferSet=_},511:(c,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CellData=void 0;const f=h(482),p=h(643),m=h(3734);class _ extends m.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new m.ExtendedAttrs,this.combinedData=""}static fromCharData(w){const k=new _;return k.setFromCharData(w),k}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,f.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(w){this.fg=w[p.CHAR_DATA_ATTR_INDEX],this.bg=0;let k=!1;if(w[p.CHAR_DATA_CHAR_INDEX].length>2)k=!0;else if(w[p.CHAR_DATA_CHAR_INDEX].length===2){const v=w[p.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=v&&v<=56319){const b=w[p.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=b&&b<=57343?this.content=1024*(v-55296)+b-56320+65536|w[p.CHAR_DATA_WIDTH_INDEX]<<22:k=!0}else k=!0}else this.content=w[p.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|w[p.CHAR_DATA_WIDTH_INDEX]<<22;k&&(this.combinedData=w[p.CHAR_DATA_CHAR_INDEX],this.content=2097152|w[p.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}l.CellData=_},643:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.WHITESPACE_CELL_CODE=l.WHITESPACE_CELL_WIDTH=l.WHITESPACE_CELL_CHAR=l.NULL_CELL_CODE=l.NULL_CELL_WIDTH=l.NULL_CELL_CHAR=l.CHAR_DATA_CODE_INDEX=l.CHAR_DATA_WIDTH_INDEX=l.CHAR_DATA_CHAR_INDEX=l.CHAR_DATA_ATTR_INDEX=l.DEFAULT_EXT=l.DEFAULT_ATTR=l.DEFAULT_COLOR=void 0,l.DEFAULT_COLOR=0,l.DEFAULT_ATTR=256|l.DEFAULT_COLOR<<9,l.DEFAULT_EXT=0,l.CHAR_DATA_ATTR_INDEX=0,l.CHAR_DATA_CHAR_INDEX=1,l.CHAR_DATA_WIDTH_INDEX=2,l.CHAR_DATA_CODE_INDEX=3,l.NULL_CELL_CHAR="",l.NULL_CELL_WIDTH=1,l.NULL_CELL_CODE=0,l.WHITESPACE_CELL_CHAR=" ",l.WHITESPACE_CELL_WIDTH=1,l.WHITESPACE_CELL_CODE=32},4863:(c,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Marker=void 0;const f=h(8460),p=h(844);class m{get id(){return this._id}constructor(y){this.line=y,this.isDisposed=!1,this._disposables=[],this._id=m._nextId++,this._onDispose=this.register(new f.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,p.disposeArray)(this._disposables),this._disposables.length=0)}register(y){return this._disposables.push(y),y}}l.Marker=m,m._nextId=1},7116:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DEFAULT_CHARSET=l.CHARSETS=void 0,l.CHARSETS={},l.DEFAULT_CHARSET=l.CHARSETS.B,l.CHARSETS[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"␤",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"},l.CHARSETS.A={"#":"£"},l.CHARSETS.B=void 0,l.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},l.CHARSETS.C=l.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},l.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},l.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},l.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},l.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},l.CHARSETS.E=l.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},l.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},l.CHARSETS.H=l.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},l.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(c,l)=>{var h,f,p;Object.defineProperty(l,"__esModule",{value:!0}),l.C1_ESCAPED=l.C1=l.C0=void 0,(function(m){m.NUL="\0",m.SOH="",m.STX="",m.ETX="",m.EOT="",m.ENQ="",m.ACK="",m.BEL="\x07",m.BS="\b",m.HT=" ",m.LF=`
65
+ `,m.VT="\v",m.FF="\f",m.CR="\r",m.SO="",m.SI="",m.DLE="",m.DC1="",m.DC2="",m.DC3="",m.DC4="",m.NAK="",m.SYN="",m.ETB="",m.CAN="",m.EM="",m.SUB="",m.ESC="\x1B",m.FS="",m.GS="",m.RS="",m.US="",m.SP=" ",m.DEL=""})(h||(l.C0=h={})),(function(m){m.PAD="€",m.HOP="",m.BPH="‚",m.NBH="ƒ",m.IND="„",m.NEL="…",m.SSA="†",m.ESA="‡",m.HTS="ˆ",m.HTJ="‰",m.VTS="Š",m.PLD="‹",m.PLU="Œ",m.RI="",m.SS2="Ž",m.SS3="",m.DCS="",m.PU1="‘",m.PU2="’",m.STS="“",m.CCH="”",m.MW="•",m.SPA="–",m.EPA="—",m.SOS="˜",m.SGCI="™",m.SCI="š",m.CSI="›",m.ST="œ",m.OSC="",m.PM="ž",m.APC="Ÿ"})(f||(l.C1=f={})),(function(m){m.ST=`${h.ESC}\\`})(p||(l.C1_ESCAPED=p={}))},7399:(c,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.evaluateKeyboardEvent=void 0;const f=h(2584),p={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};l.evaluateKeyboardEvent=function(m,_,y,w){const k={type:0,cancel:!1,key:void 0},v=(m.shiftKey?1:0)|(m.altKey?2:0)|(m.ctrlKey?4:0)|(m.metaKey?8:0);switch(m.keyCode){case 0:m.key==="UIKeyInputUpArrow"?k.key=_?f.C0.ESC+"OA":f.C0.ESC+"[A":m.key==="UIKeyInputLeftArrow"?k.key=_?f.C0.ESC+"OD":f.C0.ESC+"[D":m.key==="UIKeyInputRightArrow"?k.key=_?f.C0.ESC+"OC":f.C0.ESC+"[C":m.key==="UIKeyInputDownArrow"&&(k.key=_?f.C0.ESC+"OB":f.C0.ESC+"[B");break;case 8:k.key=m.ctrlKey?"\b":f.C0.DEL,m.altKey&&(k.key=f.C0.ESC+k.key);break;case 9:if(m.shiftKey){k.key=f.C0.ESC+"[Z";break}k.key=f.C0.HT,k.cancel=!0;break;case 13:k.key=m.altKey?f.C0.ESC+f.C0.CR:f.C0.CR,k.cancel=!0;break;case 27:k.key=f.C0.ESC,m.altKey&&(k.key=f.C0.ESC+f.C0.ESC),k.cancel=!0;break;case 37:if(m.metaKey)break;v?(k.key=f.C0.ESC+"[1;"+(v+1)+"D",k.key===f.C0.ESC+"[1;3D"&&(k.key=f.C0.ESC+(y?"b":"[1;5D"))):k.key=_?f.C0.ESC+"OD":f.C0.ESC+"[D";break;case 39:if(m.metaKey)break;v?(k.key=f.C0.ESC+"[1;"+(v+1)+"C",k.key===f.C0.ESC+"[1;3C"&&(k.key=f.C0.ESC+(y?"f":"[1;5C"))):k.key=_?f.C0.ESC+"OC":f.C0.ESC+"[C";break;case 38:if(m.metaKey)break;v?(k.key=f.C0.ESC+"[1;"+(v+1)+"A",y||k.key!==f.C0.ESC+"[1;3A"||(k.key=f.C0.ESC+"[1;5A")):k.key=_?f.C0.ESC+"OA":f.C0.ESC+"[A";break;case 40:if(m.metaKey)break;v?(k.key=f.C0.ESC+"[1;"+(v+1)+"B",y||k.key!==f.C0.ESC+"[1;3B"||(k.key=f.C0.ESC+"[1;5B")):k.key=_?f.C0.ESC+"OB":f.C0.ESC+"[B";break;case 45:m.shiftKey||m.ctrlKey||(k.key=f.C0.ESC+"[2~");break;case 46:k.key=v?f.C0.ESC+"[3;"+(v+1)+"~":f.C0.ESC+"[3~";break;case 36:k.key=v?f.C0.ESC+"[1;"+(v+1)+"H":_?f.C0.ESC+"OH":f.C0.ESC+"[H";break;case 35:k.key=v?f.C0.ESC+"[1;"+(v+1)+"F":_?f.C0.ESC+"OF":f.C0.ESC+"[F";break;case 33:m.shiftKey?k.type=2:m.ctrlKey?k.key=f.C0.ESC+"[5;"+(v+1)+"~":k.key=f.C0.ESC+"[5~";break;case 34:m.shiftKey?k.type=3:m.ctrlKey?k.key=f.C0.ESC+"[6;"+(v+1)+"~":k.key=f.C0.ESC+"[6~";break;case 112:k.key=v?f.C0.ESC+"[1;"+(v+1)+"P":f.C0.ESC+"OP";break;case 113:k.key=v?f.C0.ESC+"[1;"+(v+1)+"Q":f.C0.ESC+"OQ";break;case 114:k.key=v?f.C0.ESC+"[1;"+(v+1)+"R":f.C0.ESC+"OR";break;case 115:k.key=v?f.C0.ESC+"[1;"+(v+1)+"S":f.C0.ESC+"OS";break;case 116:k.key=v?f.C0.ESC+"[15;"+(v+1)+"~":f.C0.ESC+"[15~";break;case 117:k.key=v?f.C0.ESC+"[17;"+(v+1)+"~":f.C0.ESC+"[17~";break;case 118:k.key=v?f.C0.ESC+"[18;"+(v+1)+"~":f.C0.ESC+"[18~";break;case 119:k.key=v?f.C0.ESC+"[19;"+(v+1)+"~":f.C0.ESC+"[19~";break;case 120:k.key=v?f.C0.ESC+"[20;"+(v+1)+"~":f.C0.ESC+"[20~";break;case 121:k.key=v?f.C0.ESC+"[21;"+(v+1)+"~":f.C0.ESC+"[21~";break;case 122:k.key=v?f.C0.ESC+"[23;"+(v+1)+"~":f.C0.ESC+"[23~";break;case 123:k.key=v?f.C0.ESC+"[24;"+(v+1)+"~":f.C0.ESC+"[24~";break;default:if(!m.ctrlKey||m.shiftKey||m.altKey||m.metaKey)if(y&&!w||!m.altKey||m.metaKey)!y||m.altKey||m.ctrlKey||m.shiftKey||!m.metaKey?m.key&&!m.ctrlKey&&!m.altKey&&!m.metaKey&&m.keyCode>=48&&m.key.length===1?k.key=m.key:m.key&&m.ctrlKey&&(m.key==="_"&&(k.key=f.C0.US),m.key==="@"&&(k.key=f.C0.NUL)):m.keyCode===65&&(k.type=1);else{const b=p[m.keyCode],x=b==null?void 0:b[m.shiftKey?1:0];if(x)k.key=f.C0.ESC+x;else if(m.keyCode>=65&&m.keyCode<=90){const S=m.ctrlKey?m.keyCode-64:m.keyCode+32;let j=String.fromCharCode(S);m.shiftKey&&(j=j.toUpperCase()),k.key=f.C0.ESC+j}else if(m.keyCode===32)k.key=f.C0.ESC+(m.ctrlKey?f.C0.NUL:" ");else if(m.key==="Dead"&&m.code.startsWith("Key")){let S=m.code.slice(3,4);m.shiftKey||(S=S.toLowerCase()),k.key=f.C0.ESC+S,k.cancel=!0}}else m.keyCode>=65&&m.keyCode<=90?k.key=String.fromCharCode(m.keyCode-64):m.keyCode===32?k.key=f.C0.NUL:m.keyCode>=51&&m.keyCode<=55?k.key=String.fromCharCode(m.keyCode-51+27):m.keyCode===56?k.key=f.C0.DEL:m.keyCode===219?k.key=f.C0.ESC:m.keyCode===220?k.key=f.C0.FS:m.keyCode===221&&(k.key=f.C0.GS)}return k}},482:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Utf8ToUtf32=l.StringToUtf32=l.utf32ToString=l.stringFromCodePoint=void 0,l.stringFromCodePoint=function(h){return h>65535?(h-=65536,String.fromCharCode(55296+(h>>10))+String.fromCharCode(h%1024+56320)):String.fromCharCode(h)},l.utf32ToString=function(h,f=0,p=h.length){let m="";for(let _=f;_<p;++_){let y=h[_];y>65535?(y-=65536,m+=String.fromCharCode(55296+(y>>10))+String.fromCharCode(y%1024+56320)):m+=String.fromCharCode(y)}return m},l.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(h,f){const p=h.length;if(!p)return 0;let m=0,_=0;if(this._interim){const y=h.charCodeAt(_++);56320<=y&&y<=57343?f[m++]=1024*(this._interim-55296)+y-56320+65536:(f[m++]=this._interim,f[m++]=y),this._interim=0}for(let y=_;y<p;++y){const w=h.charCodeAt(y);if(55296<=w&&w<=56319){if(++y>=p)return this._interim=w,m;const k=h.charCodeAt(y);56320<=k&&k<=57343?f[m++]=1024*(w-55296)+k-56320+65536:(f[m++]=w,f[m++]=k)}else w!==65279&&(f[m++]=w)}return m}},l.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(h,f){const p=h.length;if(!p)return 0;let m,_,y,w,k=0,v=0,b=0;if(this.interim[0]){let j=!1,N=this.interim[0];N&=(224&N)==192?31:(240&N)==224?15:7;let T,D=0;for(;(T=63&this.interim[++D])&&D<4;)N<<=6,N|=T;const A=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,B=A-D;for(;b<B;){if(b>=p)return 0;if(T=h[b++],(192&T)!=128){b--,j=!0;break}this.interim[D++]=T,N<<=6,N|=63&T}j||(A===2?N<128?b--:f[k++]=N:A===3?N<2048||N>=55296&&N<=57343||N===65279||(f[k++]=N):N<65536||N>1114111||(f[k++]=N)),this.interim.fill(0)}const x=p-4;let S=b;for(;S<p;){for(;!(!(S<x)||128&(m=h[S])||128&(_=h[S+1])||128&(y=h[S+2])||128&(w=h[S+3]));)f[k++]=m,f[k++]=_,f[k++]=y,f[k++]=w,S+=4;if(m=h[S++],m<128)f[k++]=m;else if((224&m)==192){if(S>=p)return this.interim[0]=m,k;if(_=h[S++],(192&_)!=128){S--;continue}if(v=(31&m)<<6|63&_,v<128){S--;continue}f[k++]=v}else if((240&m)==224){if(S>=p)return this.interim[0]=m,k;if(_=h[S++],(192&_)!=128){S--;continue}if(S>=p)return this.interim[0]=m,this.interim[1]=_,k;if(y=h[S++],(192&y)!=128){S--;continue}if(v=(15&m)<<12|(63&_)<<6|63&y,v<2048||v>=55296&&v<=57343||v===65279)continue;f[k++]=v}else if((248&m)==240){if(S>=p)return this.interim[0]=m,k;if(_=h[S++],(192&_)!=128){S--;continue}if(S>=p)return this.interim[0]=m,this.interim[1]=_,k;if(y=h[S++],(192&y)!=128){S--;continue}if(S>=p)return this.interim[0]=m,this.interim[1]=_,this.interim[2]=y,k;if(w=h[S++],(192&w)!=128){S--;continue}if(v=(7&m)<<18|(63&_)<<12|(63&y)<<6|63&w,v<65536||v>1114111)continue;f[k++]=v}}return k}}},225:(c,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.UnicodeV6=void 0;const f=h(1480),p=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],m=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let _;l.UnicodeV6=class{constructor(){if(this.version="6",!_){_=new Uint8Array(65536),_.fill(1),_[0]=0,_.fill(0,1,32),_.fill(0,127,160),_.fill(2,4352,4448),_[9001]=2,_[9002]=2,_.fill(2,11904,42192),_[12351]=1,_.fill(2,44032,55204),_.fill(2,63744,64256),_.fill(2,65040,65050),_.fill(2,65072,65136),_.fill(2,65280,65377),_.fill(2,65504,65511);for(let y=0;y<p.length;++y)_.fill(0,p[y][0],p[y][1]+1)}}wcwidth(y){return y<32?0:y<127?1:y<65536?_[y]:(function(w,k){let v,b=0,x=k.length-1;if(w<k[0][0]||w>k[x][1])return!1;for(;x>=b;)if(v=b+x>>1,w>k[v][1])b=v+1;else{if(!(w<k[v][0]))return!0;x=v-1}return!1})(y,m)?0:y>=131072&&y<=196605||y>=196608&&y<=262141?2:1}charProperties(y,w){let k=this.wcwidth(y),v=k===0&&w!==0;if(v){const b=f.UnicodeService.extractWidth(w);b===0?v=!1:b>k&&(k=b)}return f.UnicodeService.createPropertyValue(0,k,v)}}},5981:(c,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.WriteBuffer=void 0;const f=h(8460),p=h(844);class m extends p.Disposable{constructor(y){super(),this._action=y,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new f.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(y,w){if(w!==void 0&&this._syncCalls>w)return void(this._syncCalls=0);if(this._pendingData+=y.length,this._writeBuffer.push(y),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let k;for(this._isSyncWriting=!0;k=this._writeBuffer.shift();){this._action(k);const v=this._callbacks.shift();v&&v()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(y,w){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=y.length,this._writeBuffer.push(y),this._callbacks.push(w),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=y.length,this._writeBuffer.push(y),this._callbacks.push(w)}_innerWrite(y=0,w=!0){const k=y||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const v=this._writeBuffer[this._bufferOffset],b=this._action(v,w);if(b){const S=j=>Date.now()-k>=12?setTimeout((()=>this._innerWrite(0,j))):this._innerWrite(k,j);return void b.catch((j=>(queueMicrotask((()=>{throw j})),Promise.resolve(!1)))).then(S)}const x=this._callbacks[this._bufferOffset];if(x&&x(),this._bufferOffset++,this._pendingData-=v.length,Date.now()-k>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout((()=>this._innerWrite()))):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}l.WriteBuffer=m},5941:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.toRgbString=l.parseColor=void 0;const h=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,f=/^[\da-f]+$/;function p(m,_){const y=m.toString(16),w=y.length<2?"0"+y:y;switch(_){case 4:return y[0];case 8:return w;case 12:return(w+w).slice(0,3);default:return w+w}}l.parseColor=function(m){if(!m)return;let _=m.toLowerCase();if(_.indexOf("rgb:")===0){_=_.slice(4);const y=h.exec(_);if(y){const w=y[1]?15:y[4]?255:y[7]?4095:65535;return[Math.round(parseInt(y[1]||y[4]||y[7]||y[10],16)/w*255),Math.round(parseInt(y[2]||y[5]||y[8]||y[11],16)/w*255),Math.round(parseInt(y[3]||y[6]||y[9]||y[12],16)/w*255)]}}else if(_.indexOf("#")===0&&(_=_.slice(1),f.exec(_)&&[3,6,9,12].includes(_.length))){const y=_.length/3,w=[0,0,0];for(let k=0;k<3;++k){const v=parseInt(_.slice(y*k,y*k+y),16);w[k]=y===1?v<<4:y===2?v:y===3?v>>4:v>>8}return w}},l.toRgbString=function(m,_=16){const[y,w,k]=m;return`rgb:${p(y,_)}/${p(w,_)}/${p(k,_)}`}},5770:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.PAYLOAD_LIMIT=void 0,l.PAYLOAD_LIMIT=1e7},6351:(c,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DcsHandler=l.DcsParser=void 0;const f=h(482),p=h(8742),m=h(5770),_=[];l.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=_,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=_}registerHandler(w,k){this._handlers[w]===void 0&&(this._handlers[w]=[]);const v=this._handlers[w];return v.push(k),{dispose:()=>{const b=v.indexOf(k);b!==-1&&v.splice(b,1)}}}clearHandler(w){this._handlers[w]&&delete this._handlers[w]}setHandlerFallback(w){this._handlerFb=w}reset(){if(this._active.length)for(let w=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;w>=0;--w)this._active[w].unhook(!1);this._stack.paused=!1,this._active=_,this._ident=0}hook(w,k){if(this.reset(),this._ident=w,this._active=this._handlers[w]||_,this._active.length)for(let v=this._active.length-1;v>=0;v--)this._active[v].hook(k);else this._handlerFb(this._ident,"HOOK",k)}put(w,k,v){if(this._active.length)for(let b=this._active.length-1;b>=0;b--)this._active[b].put(w,k,v);else this._handlerFb(this._ident,"PUT",(0,f.utf32ToString)(w,k,v))}unhook(w,k=!0){if(this._active.length){let v=!1,b=this._active.length-1,x=!1;if(this._stack.paused&&(b=this._stack.loopPosition-1,v=k,x=this._stack.fallThrough,this._stack.paused=!1),!x&&v===!1){for(;b>=0&&(v=this._active[b].unhook(w),v!==!0);b--)if(v instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=b,this._stack.fallThrough=!1,v;b--}for(;b>=0;b--)if(v=this._active[b].unhook(!1),v instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=b,this._stack.fallThrough=!0,v}else this._handlerFb(this._ident,"UNHOOK",w);this._active=_,this._ident=0}};const y=new p.Params;y.addParam(0),l.DcsHandler=class{constructor(w){this._handler=w,this._data="",this._params=y,this._hitLimit=!1}hook(w){this._params=w.length>1||w.params[0]?w.clone():y,this._data="",this._hitLimit=!1}put(w,k,v){this._hitLimit||(this._data+=(0,f.utf32ToString)(w,k,v),this._data.length>m.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(w){let k=!1;if(this._hitLimit)k=!1;else if(w&&(k=this._handler(this._data,this._params),k instanceof Promise))return k.then((v=>(this._params=y,this._data="",this._hitLimit=!1,v)));return this._params=y,this._data="",this._hitLimit=!1,k}}},2015:(c,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.EscapeSequenceParser=l.VT500_TRANSITION_TABLE=l.TransitionTable=void 0;const f=h(844),p=h(8742),m=h(6242),_=h(6351);class y{constructor(b){this.table=new Uint8Array(b)}setDefault(b,x){this.table.fill(b<<4|x)}add(b,x,S,j){this.table[x<<8|b]=S<<4|j}addMany(b,x,S,j){for(let N=0;N<b.length;N++)this.table[x<<8|b[N]]=S<<4|j}}l.TransitionTable=y;const w=160;l.VT500_TRANSITION_TABLE=(function(){const v=new y(4095),b=Array.apply(null,Array(256)).map(((D,A)=>A)),x=(D,A)=>b.slice(D,A),S=x(32,127),j=x(0,24);j.push(25),j.push.apply(j,x(28,32));const N=x(0,14);let T;for(T in v.setDefault(1,0),v.addMany(S,0,2,0),N)v.addMany([24,26,153,154],T,3,0),v.addMany(x(128,144),T,3,0),v.addMany(x(144,152),T,3,0),v.add(156,T,0,0),v.add(27,T,11,1),v.add(157,T,4,8),v.addMany([152,158,159],T,0,7),v.add(155,T,11,3),v.add(144,T,11,9);return v.addMany(j,0,3,0),v.addMany(j,1,3,1),v.add(127,1,0,1),v.addMany(j,8,0,8),v.addMany(j,3,3,3),v.add(127,3,0,3),v.addMany(j,4,3,4),v.add(127,4,0,4),v.addMany(j,6,3,6),v.addMany(j,5,3,5),v.add(127,5,0,5),v.addMany(j,2,3,2),v.add(127,2,0,2),v.add(93,1,4,8),v.addMany(S,8,5,8),v.add(127,8,5,8),v.addMany([156,27,24,26,7],8,6,0),v.addMany(x(28,32),8,0,8),v.addMany([88,94,95],1,0,7),v.addMany(S,7,0,7),v.addMany(j,7,0,7),v.add(156,7,0,0),v.add(127,7,0,7),v.add(91,1,11,3),v.addMany(x(64,127),3,7,0),v.addMany(x(48,60),3,8,4),v.addMany([60,61,62,63],3,9,4),v.addMany(x(48,60),4,8,4),v.addMany(x(64,127),4,7,0),v.addMany([60,61,62,63],4,0,6),v.addMany(x(32,64),6,0,6),v.add(127,6,0,6),v.addMany(x(64,127),6,0,0),v.addMany(x(32,48),3,9,5),v.addMany(x(32,48),5,9,5),v.addMany(x(48,64),5,0,6),v.addMany(x(64,127),5,7,0),v.addMany(x(32,48),4,9,5),v.addMany(x(32,48),1,9,2),v.addMany(x(32,48),2,9,2),v.addMany(x(48,127),2,10,0),v.addMany(x(48,80),1,10,0),v.addMany(x(81,88),1,10,0),v.addMany([89,90,92],1,10,0),v.addMany(x(96,127),1,10,0),v.add(80,1,11,9),v.addMany(j,9,0,9),v.add(127,9,0,9),v.addMany(x(28,32),9,0,9),v.addMany(x(32,48),9,9,12),v.addMany(x(48,60),9,8,10),v.addMany([60,61,62,63],9,9,10),v.addMany(j,11,0,11),v.addMany(x(32,128),11,0,11),v.addMany(x(28,32),11,0,11),v.addMany(j,10,0,10),v.add(127,10,0,10),v.addMany(x(28,32),10,0,10),v.addMany(x(48,60),10,8,10),v.addMany([60,61,62,63],10,0,11),v.addMany(x(32,48),10,9,12),v.addMany(j,12,0,12),v.add(127,12,0,12),v.addMany(x(28,32),12,0,12),v.addMany(x(32,48),12,9,12),v.addMany(x(48,64),12,0,11),v.addMany(x(64,127),12,12,13),v.addMany(x(64,127),10,12,13),v.addMany(x(64,127),9,12,13),v.addMany(j,13,13,13),v.addMany(S,13,13,13),v.add(127,13,0,13),v.addMany([27,156,24,26],13,14,0),v.add(w,0,2,0),v.add(w,8,5,8),v.add(w,6,0,6),v.add(w,11,0,11),v.add(w,13,13,13),v})();class k extends f.Disposable{constructor(b=l.VT500_TRANSITION_TABLE){super(),this._transitions=b,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new p.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(x,S,j)=>{},this._executeHandlerFb=x=>{},this._csiHandlerFb=(x,S)=>{},this._escHandlerFb=x=>{},this._errorHandlerFb=x=>x,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,f.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new m.OscParser),this._dcsParser=this.register(new _.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(b,x=[64,126]){let S=0;if(b.prefix){if(b.prefix.length>1)throw new Error("only one byte as prefix supported");if(S=b.prefix.charCodeAt(0),S&&60>S||S>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(b.intermediates){if(b.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let N=0;N<b.intermediates.length;++N){const T=b.intermediates.charCodeAt(N);if(32>T||T>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");S<<=8,S|=T}}if(b.final.length!==1)throw new Error("final must be a single byte");const j=b.final.charCodeAt(0);if(x[0]>j||j>x[1])throw new Error(`final must be in range ${x[0]} .. ${x[1]}`);return S<<=8,S|=j,S}identToString(b){const x=[];for(;b;)x.push(String.fromCharCode(255&b)),b>>=8;return x.reverse().join("")}setPrintHandler(b){this._printHandler=b}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(b,x){const S=this._identifier(b,[48,126]);this._escHandlers[S]===void 0&&(this._escHandlers[S]=[]);const j=this._escHandlers[S];return j.push(x),{dispose:()=>{const N=j.indexOf(x);N!==-1&&j.splice(N,1)}}}clearEscHandler(b){this._escHandlers[this._identifier(b,[48,126])]&&delete this._escHandlers[this._identifier(b,[48,126])]}setEscHandlerFallback(b){this._escHandlerFb=b}setExecuteHandler(b,x){this._executeHandlers[b.charCodeAt(0)]=x}clearExecuteHandler(b){this._executeHandlers[b.charCodeAt(0)]&&delete this._executeHandlers[b.charCodeAt(0)]}setExecuteHandlerFallback(b){this._executeHandlerFb=b}registerCsiHandler(b,x){const S=this._identifier(b);this._csiHandlers[S]===void 0&&(this._csiHandlers[S]=[]);const j=this._csiHandlers[S];return j.push(x),{dispose:()=>{const N=j.indexOf(x);N!==-1&&j.splice(N,1)}}}clearCsiHandler(b){this._csiHandlers[this._identifier(b)]&&delete this._csiHandlers[this._identifier(b)]}setCsiHandlerFallback(b){this._csiHandlerFb=b}registerDcsHandler(b,x){return this._dcsParser.registerHandler(this._identifier(b),x)}clearDcsHandler(b){this._dcsParser.clearHandler(this._identifier(b))}setDcsHandlerFallback(b){this._dcsParser.setHandlerFallback(b)}registerOscHandler(b,x){return this._oscParser.registerHandler(b,x)}clearOscHandler(b){this._oscParser.clearHandler(b)}setOscHandlerFallback(b){this._oscParser.setHandlerFallback(b)}setErrorHandler(b){this._errorHandler=b}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(b,x,S,j,N){this._parseStack.state=b,this._parseStack.handlers=x,this._parseStack.handlerPos=S,this._parseStack.transition=j,this._parseStack.chunkPos=N}parse(b,x,S){let j,N=0,T=0,D=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,D=this._parseStack.chunkPos+1;else{if(S===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const A=this._parseStack.handlers;let B=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(S===!1&&B>-1){for(;B>=0&&(j=A[B](this._params),j!==!0);B--)if(j instanceof Promise)return this._parseStack.handlerPos=B,j}this._parseStack.handlers=[];break;case 4:if(S===!1&&B>-1){for(;B>=0&&(j=A[B](),j!==!0);B--)if(j instanceof Promise)return this._parseStack.handlerPos=B,j}this._parseStack.handlers=[];break;case 6:if(N=b[this._parseStack.chunkPos],j=this._dcsParser.unhook(N!==24&&N!==26,S),j)return j;N===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(N=b[this._parseStack.chunkPos],j=this._oscParser.end(N!==24&&N!==26,S),j)return j;N===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,D=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let A=D;A<x;++A){switch(N=b[A],T=this._transitions.table[this.currentState<<8|(N<160?N:w)],T>>4){case 2:for(let W=A+1;;++W){if(W>=x||(N=b[W])<32||N>126&&N<w){this._printHandler(b,A,W),A=W-1;break}if(++W>=x||(N=b[W])<32||N>126&&N<w){this._printHandler(b,A,W),A=W-1;break}if(++W>=x||(N=b[W])<32||N>126&&N<w){this._printHandler(b,A,W),A=W-1;break}if(++W>=x||(N=b[W])<32||N>126&&N<w){this._printHandler(b,A,W),A=W-1;break}}break;case 3:this._executeHandlers[N]?this._executeHandlers[N]():this._executeHandlerFb(N),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:A,code:N,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const B=this._csiHandlers[this._collect<<8|N];let R=B?B.length-1:-1;for(;R>=0&&(j=B[R](this._params),j!==!0);R--)if(j instanceof Promise)return this._preserveStack(3,B,R,T,A),j;R<0&&this._csiHandlerFb(this._collect<<8|N,this._params),this.precedingJoinState=0;break;case 8:do switch(N){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(N-48)}while(++A<x&&(N=b[A])>47&&N<60);A--;break;case 9:this._collect<<=8,this._collect|=N;break;case 10:const $=this._escHandlers[this._collect<<8|N];let F=$?$.length-1:-1;for(;F>=0&&(j=$[F](),j!==!0);F--)if(j instanceof Promise)return this._preserveStack(4,$,F,T,A),j;F<0&&this._escHandlerFb(this._collect<<8|N),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|N,this._params);break;case 13:for(let W=A+1;;++W)if(W>=x||(N=b[W])===24||N===26||N===27||N>127&&N<w){this._dcsParser.put(b,A,W),A=W-1;break}break;case 14:if(j=this._dcsParser.unhook(N!==24&&N!==26),j)return this._preserveStack(6,[],0,T,A),j;N===27&&(T|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let W=A+1;;W++)if(W>=x||(N=b[W])<32||N>127&&N<w){this._oscParser.put(b,A,W),A=W-1;break}break;case 6:if(j=this._oscParser.end(N!==24&&N!==26),j)return this._preserveStack(5,[],0,T,A),j;N===27&&(T|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&T}}}l.EscapeSequenceParser=k},6242:(c,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.OscHandler=l.OscParser=void 0;const f=h(5770),p=h(482),m=[];l.OscParser=class{constructor(){this._state=0,this._active=m,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(_,y){this._handlers[_]===void 0&&(this._handlers[_]=[]);const w=this._handlers[_];return w.push(y),{dispose:()=>{const k=w.indexOf(y);k!==-1&&w.splice(k,1)}}}clearHandler(_){this._handlers[_]&&delete this._handlers[_]}setHandlerFallback(_){this._handlerFb=_}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=m}reset(){if(this._state===2)for(let _=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;_>=0;--_)this._active[_].end(!1);this._stack.paused=!1,this._active=m,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||m,this._active.length)for(let _=this._active.length-1;_>=0;_--)this._active[_].start();else this._handlerFb(this._id,"START")}_put(_,y,w){if(this._active.length)for(let k=this._active.length-1;k>=0;k--)this._active[k].put(_,y,w);else this._handlerFb(this._id,"PUT",(0,p.utf32ToString)(_,y,w))}start(){this.reset(),this._state=1}put(_,y,w){if(this._state!==3){if(this._state===1)for(;y<w;){const k=_[y++];if(k===59){this._state=2,this._start();break}if(k<48||57<k)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+k-48}this._state===2&&w-y>0&&this._put(_,y,w)}}end(_,y=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let w=!1,k=this._active.length-1,v=!1;if(this._stack.paused&&(k=this._stack.loopPosition-1,w=y,v=this._stack.fallThrough,this._stack.paused=!1),!v&&w===!1){for(;k>=0&&(w=this._active[k].end(_),w!==!0);k--)if(w instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=k,this._stack.fallThrough=!1,w;k--}for(;k>=0;k--)if(w=this._active[k].end(!1),w instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=k,this._stack.fallThrough=!0,w}else this._handlerFb(this._id,"END",_);this._active=m,this._id=-1,this._state=0}}},l.OscHandler=class{constructor(_){this._handler=_,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(_,y,w){this._hitLimit||(this._data+=(0,p.utf32ToString)(_,y,w),this._data.length>f.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(_){let y=!1;if(this._hitLimit)y=!1;else if(_&&(y=this._handler(this._data),y instanceof Promise))return y.then((w=>(this._data="",this._hitLimit=!1,w)));return this._data="",this._hitLimit=!1,y}}},8742:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Params=void 0;const h=2147483647;class f{static fromArray(m){const _=new f;if(!m.length)return _;for(let y=Array.isArray(m[0])?1:0;y<m.length;++y){const w=m[y];if(Array.isArray(w))for(let k=0;k<w.length;++k)_.addSubParam(w[k]);else _.addParam(w)}return _}constructor(m=32,_=32){if(this.maxLength=m,this.maxSubParamsLength=_,_>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(m),this.length=0,this._subParams=new Int32Array(_),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(m),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const m=new f(this.maxLength,this.maxSubParamsLength);return m.params.set(this.params),m.length=this.length,m._subParams.set(this._subParams),m._subParamsLength=this._subParamsLength,m._subParamsIdx.set(this._subParamsIdx),m._rejectDigits=this._rejectDigits,m._rejectSubDigits=this._rejectSubDigits,m._digitIsSub=this._digitIsSub,m}toArray(){const m=[];for(let _=0;_<this.length;++_){m.push(this.params[_]);const y=this._subParamsIdx[_]>>8,w=255&this._subParamsIdx[_];w-y>0&&m.push(Array.prototype.slice.call(this._subParams,y,w))}return m}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(m){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(m<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=m>h?h:m}}addSubParam(m){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(m<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=m>h?h:m,this._subParamsIdx[this.length-1]++}}hasSubParams(m){return(255&this._subParamsIdx[m])-(this._subParamsIdx[m]>>8)>0}getSubParams(m){const _=this._subParamsIdx[m]>>8,y=255&this._subParamsIdx[m];return y-_>0?this._subParams.subarray(_,y):null}getSubParamsAll(){const m={};for(let _=0;_<this.length;++_){const y=this._subParamsIdx[_]>>8,w=255&this._subParamsIdx[_];w-y>0&&(m[_]=this._subParams.slice(y,w))}return m}addDigit(m){let _;if(this._rejectDigits||!(_=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const y=this._digitIsSub?this._subParams:this.params,w=y[_-1];y[_-1]=~w?Math.min(10*w+m,h):m}}l.Params=f},5741:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.AddonManager=void 0,l.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let h=this._addons.length-1;h>=0;h--)this._addons[h].instance.dispose()}loadAddon(h,f){const p={instance:f,dispose:f.dispose,isDisposed:!1};this._addons.push(p),f.dispose=()=>this._wrappedAddonDispose(p),f.activate(h)}_wrappedAddonDispose(h){if(h.isDisposed)return;let f=-1;for(let p=0;p<this._addons.length;p++)if(this._addons[p]===h){f=p;break}if(f===-1)throw new Error("Could not dispose an addon that has not been loaded");h.isDisposed=!0,h.dispose.apply(h.instance),this._addons.splice(f,1)}}},8771:(c,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferApiView=void 0;const f=h(3785),p=h(511);l.BufferApiView=class{constructor(m,_){this._buffer=m,this.type=_}init(m){return this._buffer=m,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(m){const _=this._buffer.lines.get(m);if(_)return new f.BufferLineApiView(_)}getNullCell(){return new p.CellData}}},3785:(c,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferLineApiView=void 0;const f=h(511);l.BufferLineApiView=class{constructor(p){this._line=p}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(p,m){if(!(p<0||p>=this._line.length))return m?(this._line.loadCell(p,m),m):this._line.loadCell(p,new f.CellData)}translateToString(p,m,_){return this._line.translateToString(p,m,_)}}},8285:(c,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferNamespaceApi=void 0;const f=h(8771),p=h(8460),m=h(844);class _ extends m.Disposable{constructor(w){super(),this._core=w,this._onBufferChange=this.register(new p.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new f.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new f.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate((()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}l.BufferNamespaceApi=_},7975:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ParserApi=void 0,l.ParserApi=class{constructor(h){this._core=h}registerCsiHandler(h,f){return this._core.registerCsiHandler(h,(p=>f(p.toArray())))}addCsiHandler(h,f){return this.registerCsiHandler(h,f)}registerDcsHandler(h,f){return this._core.registerDcsHandler(h,((p,m)=>f(p,m.toArray())))}addDcsHandler(h,f){return this.registerDcsHandler(h,f)}registerEscHandler(h,f){return this._core.registerEscHandler(h,f)}addEscHandler(h,f){return this.registerEscHandler(h,f)}registerOscHandler(h,f){return this._core.registerOscHandler(h,f)}addOscHandler(h,f){return this.registerOscHandler(h,f)}}},7090:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.UnicodeApi=void 0,l.UnicodeApi=class{constructor(h){this._core=h}register(h){this._core.unicodeService.register(h)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(h){this._core.unicodeService.activeVersion=h}}},744:function(c,l,h){var f=this&&this.__decorate||function(v,b,x,S){var j,N=arguments.length,T=N<3?b:S===null?S=Object.getOwnPropertyDescriptor(b,x):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(v,b,x,S);else for(var D=v.length-1;D>=0;D--)(j=v[D])&&(T=(N<3?j(T):N>3?j(b,x,T):j(b,x))||T);return N>3&&T&&Object.defineProperty(b,x,T),T},p=this&&this.__param||function(v,b){return function(x,S){b(x,S,v)}};Object.defineProperty(l,"__esModule",{value:!0}),l.BufferService=l.MINIMUM_ROWS=l.MINIMUM_COLS=void 0;const m=h(8460),_=h(844),y=h(5295),w=h(2585);l.MINIMUM_COLS=2,l.MINIMUM_ROWS=1;let k=l.BufferService=class extends _.Disposable{get buffer(){return this.buffers.active}constructor(v){super(),this.isUserScrolling=!1,this._onResize=this.register(new m.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new m.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(v.rawOptions.cols||0,l.MINIMUM_COLS),this.rows=Math.max(v.rawOptions.rows||0,l.MINIMUM_ROWS),this.buffers=this.register(new y.BufferSet(v,this))}resize(v,b){this.cols=v,this.rows=b,this.buffers.resize(v,b),this._onResize.fire({cols:v,rows:b})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(v,b=!1){const x=this.buffer;let S;S=this._cachedBlankLine,S&&S.length===this.cols&&S.getFg(0)===v.fg&&S.getBg(0)===v.bg||(S=x.getBlankLine(v,b),this._cachedBlankLine=S),S.isWrapped=b;const j=x.ybase+x.scrollTop,N=x.ybase+x.scrollBottom;if(x.scrollTop===0){const T=x.lines.isFull;N===x.lines.length-1?T?x.lines.recycle().copyFrom(S):x.lines.push(S.clone()):x.lines.splice(N+1,0,S.clone()),T?this.isUserScrolling&&(x.ydisp=Math.max(x.ydisp-1,0)):(x.ybase++,this.isUserScrolling||x.ydisp++)}else{const T=N-j+1;x.lines.shiftElements(j+1,T-1,-1),x.lines.set(N,S.clone())}this.isUserScrolling||(x.ydisp=x.ybase),this._onScroll.fire(x.ydisp)}scrollLines(v,b,x){const S=this.buffer;if(v<0){if(S.ydisp===0)return;this.isUserScrolling=!0}else v+S.ydisp>=S.ybase&&(this.isUserScrolling=!1);const j=S.ydisp;S.ydisp=Math.max(Math.min(S.ydisp+v,S.ybase),0),j!==S.ydisp&&(b||this._onScroll.fire(S.ydisp))}};l.BufferService=k=f([p(0,w.IOptionsService)],k)},7994:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CharsetService=void 0,l.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(h){this.glevel=h,this.charset=this._charsets[h]}setgCharset(h,f){this._charsets[h]=f,this.glevel===h&&(this.charset=f)}}},1753:function(c,l,h){var f=this&&this.__decorate||function(S,j,N,T){var D,A=arguments.length,B=A<3?j:T===null?T=Object.getOwnPropertyDescriptor(j,N):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate(S,j,N,T);else for(var R=S.length-1;R>=0;R--)(D=S[R])&&(B=(A<3?D(B):A>3?D(j,N,B):D(j,N))||B);return A>3&&B&&Object.defineProperty(j,N,B),B},p=this&&this.__param||function(S,j){return function(N,T){j(N,T,S)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CoreMouseService=void 0;const m=h(2585),_=h(8460),y=h(844),w={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:S=>S.button!==4&&S.action===1&&(S.ctrl=!1,S.alt=!1,S.shift=!1,!0)},VT200:{events:19,restrict:S=>S.action!==32},DRAG:{events:23,restrict:S=>S.action!==32||S.button!==3},ANY:{events:31,restrict:S=>!0}};function k(S,j){let N=(S.ctrl?16:0)|(S.shift?4:0)|(S.alt?8:0);return S.button===4?(N|=64,N|=S.action):(N|=3&S.button,4&S.button&&(N|=64),8&S.button&&(N|=128),S.action===32?N|=32:S.action!==0||j||(N|=3)),N}const v=String.fromCharCode,b={DEFAULT:S=>{const j=[k(S,!1)+32,S.col+32,S.row+32];return j[0]>255||j[1]>255||j[2]>255?"":`\x1B[M${v(j[0])}${v(j[1])}${v(j[2])}`},SGR:S=>{const j=S.action===0&&S.button!==4?"m":"M";return`\x1B[<${k(S,!0)};${S.col};${S.row}${j}`},SGR_PIXELS:S=>{const j=S.action===0&&S.button!==4?"m":"M";return`\x1B[<${k(S,!0)};${S.x};${S.y}${j}`}};let x=l.CoreMouseService=class extends y.Disposable{constructor(S,j){super(),this._bufferService=S,this._coreService=j,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new _.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const N of Object.keys(w))this.addProtocol(N,w[N]);for(const N of Object.keys(b))this.addEncoding(N,b[N]);this.reset()}addProtocol(S,j){this._protocols[S]=j}addEncoding(S,j){this._encodings[S]=j}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(S){if(!this._protocols[S])throw new Error(`unknown protocol "${S}"`);this._activeProtocol=S,this._onProtocolChange.fire(this._protocols[S].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(S){if(!this._encodings[S])throw new Error(`unknown encoding "${S}"`);this._activeEncoding=S}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(S){if(S.col<0||S.col>=this._bufferService.cols||S.row<0||S.row>=this._bufferService.rows||S.button===4&&S.action===32||S.button===3&&S.action!==32||S.button!==4&&(S.action===2||S.action===3)||(S.col++,S.row++,S.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,S,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(S))return!1;const j=this._encodings[this._activeEncoding](S);return j&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(j):this._coreService.triggerDataEvent(j,!0)),this._lastEvent=S,!0}explainEvents(S){return{down:!!(1&S),up:!!(2&S),drag:!!(4&S),move:!!(8&S),wheel:!!(16&S)}}_equalEvents(S,j,N){if(N){if(S.x!==j.x||S.y!==j.y)return!1}else if(S.col!==j.col||S.row!==j.row)return!1;return S.button===j.button&&S.action===j.action&&S.ctrl===j.ctrl&&S.alt===j.alt&&S.shift===j.shift}};l.CoreMouseService=x=f([p(0,m.IBufferService),p(1,m.ICoreService)],x)},6975:function(c,l,h){var f=this&&this.__decorate||function(x,S,j,N){var T,D=arguments.length,A=D<3?S:N===null?N=Object.getOwnPropertyDescriptor(S,j):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(x,S,j,N);else for(var B=x.length-1;B>=0;B--)(T=x[B])&&(A=(D<3?T(A):D>3?T(S,j,A):T(S,j))||A);return D>3&&A&&Object.defineProperty(S,j,A),A},p=this&&this.__param||function(x,S){return function(j,N){S(j,N,x)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CoreService=void 0;const m=h(1439),_=h(8460),y=h(844),w=h(2585),k=Object.freeze({insertMode:!1}),v=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let b=l.CoreService=class extends y.Disposable{constructor(x,S,j){super(),this._bufferService=x,this._logService=S,this._optionsService=j,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new _.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new _.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new _.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new _.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,m.clone)(k),this.decPrivateModes=(0,m.clone)(v)}reset(){this.modes=(0,m.clone)(k),this.decPrivateModes=(0,m.clone)(v)}triggerDataEvent(x,S=!1){if(this._optionsService.rawOptions.disableStdin)return;const j=this._bufferService.buffer;S&&this._optionsService.rawOptions.scrollOnUserInput&&j.ybase!==j.ydisp&&this._onRequestScrollToBottom.fire(),S&&this._onUserInput.fire(),this._logService.debug(`sending data "${x}"`,(()=>x.split("").map((N=>N.charCodeAt(0))))),this._onData.fire(x)}triggerBinaryEvent(x){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${x}"`,(()=>x.split("").map((S=>S.charCodeAt(0))))),this._onBinary.fire(x))}};l.CoreService=b=f([p(0,w.IBufferService),p(1,w.ILogService),p(2,w.IOptionsService)],b)},9074:(c,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DecorationService=void 0;const f=h(8055),p=h(8460),m=h(844),_=h(6106);let y=0,w=0;class k extends m.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new _.SortedList((x=>x==null?void 0:x.marker.line)),this._onDecorationRegistered=this.register(new p.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new p.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,m.toDisposable)((()=>this.reset())))}registerDecoration(x){if(x.marker.isDisposed)return;const S=new v(x);if(S){const j=S.marker.onDispose((()=>S.dispose()));S.onDispose((()=>{S&&(this._decorations.delete(S)&&this._onDecorationRemoved.fire(S),j.dispose())})),this._decorations.insert(S),this._onDecorationRegistered.fire(S)}return S}reset(){for(const x of this._decorations.values())x.dispose();this._decorations.clear()}*getDecorationsAtCell(x,S,j){let N=0,T=0;for(const D of this._decorations.getKeyIterator(S))N=D.options.x??0,T=N+(D.options.width??1),x>=N&&x<T&&(!j||(D.options.layer??"bottom")===j)&&(yield D)}forEachDecorationAtCell(x,S,j,N){this._decorations.forEachByKey(S,(T=>{y=T.options.x??0,w=y+(T.options.width??1),x>=y&&x<w&&(!j||(T.options.layer??"bottom")===j)&&N(T)}))}}l.DecorationService=k;class v extends m.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=f.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=f.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(x){super(),this.options=x,this.onRenderEmitter=this.register(new p.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new p.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=x.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(c,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.InstantiationService=l.ServiceCollection=void 0;const f=h(2585),p=h(8343);class m{constructor(...y){this._entries=new Map;for(const[w,k]of y)this.set(w,k)}set(y,w){const k=this._entries.get(y);return this._entries.set(y,w),k}forEach(y){for(const[w,k]of this._entries.entries())y(w,k)}has(y){return this._entries.has(y)}get(y){return this._entries.get(y)}}l.ServiceCollection=m,l.InstantiationService=class{constructor(){this._services=new m,this._services.set(f.IInstantiationService,this)}setService(_,y){this._services.set(_,y)}getService(_){return this._services.get(_)}createInstance(_,...y){const w=(0,p.getServiceDependencies)(_).sort(((b,x)=>b.index-x.index)),k=[];for(const b of w){const x=this._services.get(b.id);if(!x)throw new Error(`[createInstance] ${_.name} depends on UNKNOWN service ${b.id}.`);k.push(x)}const v=w.length>0?w[0].index:y.length;if(y.length!==v)throw new Error(`[createInstance] First service dependency of ${_.name} at position ${v+1} conflicts with ${y.length} static arguments`);return new _(...y,...k)}}},7866:function(c,l,h){var f=this&&this.__decorate||function(v,b,x,S){var j,N=arguments.length,T=N<3?b:S===null?S=Object.getOwnPropertyDescriptor(b,x):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(v,b,x,S);else for(var D=v.length-1;D>=0;D--)(j=v[D])&&(T=(N<3?j(T):N>3?j(b,x,T):j(b,x))||T);return N>3&&T&&Object.defineProperty(b,x,T),T},p=this&&this.__param||function(v,b){return function(x,S){b(x,S,v)}};Object.defineProperty(l,"__esModule",{value:!0}),l.traceCall=l.setTraceLogger=l.LogService=void 0;const m=h(844),_=h(2585),y={trace:_.LogLevelEnum.TRACE,debug:_.LogLevelEnum.DEBUG,info:_.LogLevelEnum.INFO,warn:_.LogLevelEnum.WARN,error:_.LogLevelEnum.ERROR,off:_.LogLevelEnum.OFF};let w,k=l.LogService=class extends m.Disposable{get logLevel(){return this._logLevel}constructor(v){super(),this._optionsService=v,this._logLevel=_.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),w=this}_updateLogLevel(){this._logLevel=y[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(v){for(let b=0;b<v.length;b++)typeof v[b]=="function"&&(v[b]=v[b]())}_log(v,b,x){this._evalLazyOptionalParams(x),v.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+b,...x)}trace(v,...b){var x;this._logLevel<=_.LogLevelEnum.TRACE&&this._log(((x=this._optionsService.options.logger)==null?void 0:x.trace.bind(this._optionsService.options.logger))??console.log,v,b)}debug(v,...b){var x;this._logLevel<=_.LogLevelEnum.DEBUG&&this._log(((x=this._optionsService.options.logger)==null?void 0:x.debug.bind(this._optionsService.options.logger))??console.log,v,b)}info(v,...b){var x;this._logLevel<=_.LogLevelEnum.INFO&&this._log(((x=this._optionsService.options.logger)==null?void 0:x.info.bind(this._optionsService.options.logger))??console.info,v,b)}warn(v,...b){var x;this._logLevel<=_.LogLevelEnum.WARN&&this._log(((x=this._optionsService.options.logger)==null?void 0:x.warn.bind(this._optionsService.options.logger))??console.warn,v,b)}error(v,...b){var x;this._logLevel<=_.LogLevelEnum.ERROR&&this._log(((x=this._optionsService.options.logger)==null?void 0:x.error.bind(this._optionsService.options.logger))??console.error,v,b)}};l.LogService=k=f([p(0,_.IOptionsService)],k),l.setTraceLogger=function(v){w=v},l.traceCall=function(v,b,x){if(typeof x.value!="function")throw new Error("not supported");const S=x.value;x.value=function(...j){if(w.logLevel!==_.LogLevelEnum.TRACE)return S.apply(this,j);w.trace(`GlyphRenderer#${S.name}(${j.map((T=>JSON.stringify(T))).join(", ")})`);const N=S.apply(this,j);return w.trace(`GlyphRenderer#${S.name} return`,N),N}}},7302:(c,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.OptionsService=l.DEFAULT_OPTIONS=void 0;const f=h(8460),p=h(844),m=h(6114);l.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:m.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const _=["normal","bold","100","200","300","400","500","600","700","800","900"];class y extends p.Disposable{constructor(k){super(),this._onOptionChange=this.register(new f.EventEmitter),this.onOptionChange=this._onOptionChange.event;const v={...l.DEFAULT_OPTIONS};for(const b in k)if(b in v)try{const x=k[b];v[b]=this._sanitizeAndValidateOption(b,x)}catch(x){console.error(x)}this.rawOptions=v,this.options={...v},this._setupOptions(),this.register((0,p.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(k,v){return this.onOptionChange((b=>{b===k&&v(this.rawOptions[k])}))}onMultipleOptionChange(k,v){return this.onOptionChange((b=>{k.indexOf(b)!==-1&&v()}))}_setupOptions(){const k=b=>{if(!(b in l.DEFAULT_OPTIONS))throw new Error(`No option with key "${b}"`);return this.rawOptions[b]},v=(b,x)=>{if(!(b in l.DEFAULT_OPTIONS))throw new Error(`No option with key "${b}"`);x=this._sanitizeAndValidateOption(b,x),this.rawOptions[b]!==x&&(this.rawOptions[b]=x,this._onOptionChange.fire(b))};for(const b in this.rawOptions){const x={get:k.bind(this,b),set:v.bind(this,b)};Object.defineProperty(this.options,b,x)}}_sanitizeAndValidateOption(k,v){switch(k){case"cursorStyle":if(v||(v=l.DEFAULT_OPTIONS[k]),!(function(b){return b==="block"||b==="underline"||b==="bar"})(v))throw new Error(`"${v}" is not a valid value for ${k}`);break;case"wordSeparator":v||(v=l.DEFAULT_OPTIONS[k]);break;case"fontWeight":case"fontWeightBold":if(typeof v=="number"&&1<=v&&v<=1e3)break;v=_.includes(v)?v:l.DEFAULT_OPTIONS[k];break;case"cursorWidth":v=Math.floor(v);case"lineHeight":case"tabStopWidth":if(v<1)throw new Error(`${k} cannot be less than 1, value: ${v}`);break;case"minimumContrastRatio":v=Math.max(1,Math.min(21,Math.round(10*v)/10));break;case"scrollback":if((v=Math.min(v,4294967295))<0)throw new Error(`${k} cannot be less than 0, value: ${v}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(v<=0)throw new Error(`${k} cannot be less than or equal to 0, value: ${v}`);break;case"rows":case"cols":if(!v&&v!==0)throw new Error(`${k} must be numeric, value: ${v}`);break;case"windowsPty":v=v??{}}return v}}l.OptionsService=y},2660:function(c,l,h){var f=this&&this.__decorate||function(y,w,k,v){var b,x=arguments.length,S=x<3?w:v===null?v=Object.getOwnPropertyDescriptor(w,k):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(y,w,k,v);else for(var j=y.length-1;j>=0;j--)(b=y[j])&&(S=(x<3?b(S):x>3?b(w,k,S):b(w,k))||S);return x>3&&S&&Object.defineProperty(w,k,S),S},p=this&&this.__param||function(y,w){return function(k,v){w(k,v,y)}};Object.defineProperty(l,"__esModule",{value:!0}),l.OscLinkService=void 0;const m=h(2585);let _=l.OscLinkService=class{constructor(y){this._bufferService=y,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(y){const w=this._bufferService.buffer;if(y.id===void 0){const j=w.addMarker(w.ybase+w.y),N={data:y,id:this._nextId++,lines:[j]};return j.onDispose((()=>this._removeMarkerFromLink(N,j))),this._dataByLinkId.set(N.id,N),N.id}const k=y,v=this._getEntryIdKey(k),b=this._entriesWithId.get(v);if(b)return this.addLineToLink(b.id,w.ybase+w.y),b.id;const x=w.addMarker(w.ybase+w.y),S={id:this._nextId++,key:this._getEntryIdKey(k),data:k,lines:[x]};return x.onDispose((()=>this._removeMarkerFromLink(S,x))),this._entriesWithId.set(S.key,S),this._dataByLinkId.set(S.id,S),S.id}addLineToLink(y,w){const k=this._dataByLinkId.get(y);if(k&&k.lines.every((v=>v.line!==w))){const v=this._bufferService.buffer.addMarker(w);k.lines.push(v),v.onDispose((()=>this._removeMarkerFromLink(k,v)))}}getLinkData(y){var w;return(w=this._dataByLinkId.get(y))==null?void 0:w.data}_getEntryIdKey(y){return`${y.id};;${y.uri}`}_removeMarkerFromLink(y,w){const k=y.lines.indexOf(w);k!==-1&&(y.lines.splice(k,1),y.lines.length===0&&(y.data.id!==void 0&&this._entriesWithId.delete(y.key),this._dataByLinkId.delete(y.id)))}};l.OscLinkService=_=f([p(0,m.IBufferService)],_)},8343:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.createDecorator=l.getServiceDependencies=l.serviceRegistry=void 0;const h="di$target",f="di$dependencies";l.serviceRegistry=new Map,l.getServiceDependencies=function(p){return p[f]||[]},l.createDecorator=function(p){if(l.serviceRegistry.has(p))return l.serviceRegistry.get(p);const m=function(_,y,w){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(k,v,b){v[h]===v?v[f].push({id:k,index:b}):(v[f]=[{id:k,index:b}],v[h]=v)})(m,_,w)};return m.toString=()=>p,l.serviceRegistry.set(p,m),m}},2585:(c,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.IDecorationService=l.IUnicodeService=l.IOscLinkService=l.IOptionsService=l.ILogService=l.LogLevelEnum=l.IInstantiationService=l.ICharsetService=l.ICoreService=l.ICoreMouseService=l.IBufferService=void 0;const f=h(8343);var p;l.IBufferService=(0,f.createDecorator)("BufferService"),l.ICoreMouseService=(0,f.createDecorator)("CoreMouseService"),l.ICoreService=(0,f.createDecorator)("CoreService"),l.ICharsetService=(0,f.createDecorator)("CharsetService"),l.IInstantiationService=(0,f.createDecorator)("InstantiationService"),(function(m){m[m.TRACE=0]="TRACE",m[m.DEBUG=1]="DEBUG",m[m.INFO=2]="INFO",m[m.WARN=3]="WARN",m[m.ERROR=4]="ERROR",m[m.OFF=5]="OFF"})(p||(l.LogLevelEnum=p={})),l.ILogService=(0,f.createDecorator)("LogService"),l.IOptionsService=(0,f.createDecorator)("OptionsService"),l.IOscLinkService=(0,f.createDecorator)("OscLinkService"),l.IUnicodeService=(0,f.createDecorator)("UnicodeService"),l.IDecorationService=(0,f.createDecorator)("DecorationService")},1480:(c,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.UnicodeService=void 0;const f=h(8460),p=h(225);class m{static extractShouldJoin(y){return(1&y)!=0}static extractWidth(y){return y>>1&3}static extractCharKind(y){return y>>3}static createPropertyValue(y,w,k=!1){return(16777215&y)<<3|(3&w)<<1|(k?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new f.EventEmitter,this.onChange=this._onChange.event;const y=new p.UnicodeV6;this.register(y),this._active=y.version,this._activeProvider=y}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(y){if(!this._providers[y])throw new Error(`unknown Unicode version "${y}"`);this._active=y,this._activeProvider=this._providers[y],this._onChange.fire(y)}register(y){this._providers[y.version]=y}wcwidth(y){return this._activeProvider.wcwidth(y)}getStringCellWidth(y){let w=0,k=0;const v=y.length;for(let b=0;b<v;++b){let x=y.charCodeAt(b);if(55296<=x&&x<=56319){if(++b>=v)return w+this.wcwidth(x);const N=y.charCodeAt(b);56320<=N&&N<=57343?x=1024*(x-55296)+N-56320+65536:w+=this.wcwidth(N)}const S=this.charProperties(x,k);let j=m.extractWidth(S);m.extractShouldJoin(S)&&(j-=m.extractWidth(k)),w+=j,k=S}return w}charProperties(y,w){return this._activeProvider.charProperties(y,w)}}l.UnicodeService=m}},s={};function a(c){var l=s[c];if(l!==void 0)return l.exports;var h=s[c]={exports:{}};return n[c].call(h.exports,h,h.exports,a),h.exports}var o={};return(()=>{var c=o;Object.defineProperty(c,"__esModule",{value:!0}),c.Terminal=void 0;const l=a(9042),h=a(3236),f=a(844),p=a(5741),m=a(8285),_=a(7975),y=a(7090),w=["cols","rows"];class k extends f.Disposable{constructor(b){super(),this._core=this.register(new h.Terminal(b)),this._addonManager=this.register(new p.AddonManager),this._publicOptions={...this._core.options};const x=j=>this._core.options[j],S=(j,N)=>{this._checkReadonlyOptions(j),this._core.options[j]=N};for(const j in this._core.options){const N={get:x.bind(this,j),set:S.bind(this,j)};Object.defineProperty(this._publicOptions,j,N)}}_checkReadonlyOptions(b){if(w.includes(b))throw new Error(`Option "${b}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new _.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new y.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new m.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const b=this._core.coreService.decPrivateModes;let x="none";switch(this._core.coreMouseService.activeProtocol){case"X10":x="x10";break;case"VT200":x="vt200";break;case"DRAG":x="drag";break;case"ANY":x="any"}return{applicationCursorKeysMode:b.applicationCursorKeys,applicationKeypadMode:b.applicationKeypad,bracketedPasteMode:b.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:x,originMode:b.origin,reverseWraparoundMode:b.reverseWraparound,sendFocusMode:b.sendFocus,wraparoundMode:b.wraparound}}get options(){return this._publicOptions}set options(b){for(const x in b)this._publicOptions[x]=b[x]}blur(){this._core.blur()}focus(){this._core.focus()}input(b,x=!0){this._core.input(b,x)}resize(b,x){this._verifyIntegers(b,x),this._core.resize(b,x)}open(b){this._core.open(b)}attachCustomKeyEventHandler(b){this._core.attachCustomKeyEventHandler(b)}attachCustomWheelEventHandler(b){this._core.attachCustomWheelEventHandler(b)}registerLinkProvider(b){return this._core.registerLinkProvider(b)}registerCharacterJoiner(b){return this._checkProposedApi(),this._core.registerCharacterJoiner(b)}deregisterCharacterJoiner(b){this._checkProposedApi(),this._core.deregisterCharacterJoiner(b)}registerMarker(b=0){return this._verifyIntegers(b),this._core.registerMarker(b)}registerDecoration(b){return this._checkProposedApi(),this._verifyPositiveIntegers(b.x??0,b.width??0,b.height??0),this._core.registerDecoration(b)}hasSelection(){return this._core.hasSelection()}select(b,x,S){this._verifyIntegers(b,x,S),this._core.select(b,x,S)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(b,x){this._verifyIntegers(b,x),this._core.selectLines(b,x)}dispose(){super.dispose()}scrollLines(b){this._verifyIntegers(b),this._core.scrollLines(b)}scrollPages(b){this._verifyIntegers(b),this._core.scrollPages(b)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(b){this._verifyIntegers(b),this._core.scrollToLine(b)}clear(){this._core.clear()}write(b,x){this._core.write(b,x)}writeln(b,x){this._core.write(b),this._core.write(`\r
66
+ `,x)}paste(b){this._core.paste(b)}refresh(b,x){this._verifyIntegers(b,x),this._core.refresh(b,x)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(b){this._addonManager.loadAddon(this,b)}static get strings(){return l}_verifyIntegers(...b){for(const x of b)if(x===1/0||isNaN(x)||x%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...b){for(const x of b)if(x&&(x===1/0||isNaN(x)||x%1!=0||x<0))throw new Error("This API only accepts positive integers")}}c.Terminal=k})(),o})()))})(Cf)),Cf.exports}var $j=Hj();/**
67
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
68
+ * @license MIT
69
+ *
70
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
71
+ * @license MIT
72
+ *
73
+ * Originally forked from (with the author's permission):
74
+ * Fabrice Bellard's javascript vt100 for jslinux:
75
+ * http://bellard.org/jslinux/
76
+ * Copyright (c) 2011 Fabrice Bellard
77
+ */var Uj=2,Fj=1,Vj=class{activate(t){this._terminal=t}dispose(){}fit(){let t=this.proposeDimensions();if(!t||!this._terminal||isNaN(t.cols)||isNaN(t.rows))return;let n=this._terminal._core;(this._terminal.rows!==t.rows||this._terminal.cols!==t.cols)&&(n._renderService.clear(),this._terminal.resize(t.cols,t.rows))}proposeDimensions(){var _;if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let t=this._terminal._core._renderService.dimensions;if(t.css.cell.width===0||t.css.cell.height===0)return;let n=this._terminal.options.scrollback===0?0:((_=this._terminal.options.overviewRuler)==null?void 0:_.width)||14,s=window.getComputedStyle(this._terminal.element.parentElement),a=parseInt(s.getPropertyValue("height")),o=Math.max(0,parseInt(s.getPropertyValue("width"))),c=window.getComputedStyle(this._terminal.element),l={top:parseInt(c.getPropertyValue("padding-top")),bottom:parseInt(c.getPropertyValue("padding-bottom")),right:parseInt(c.getPropertyValue("padding-right")),left:parseInt(c.getPropertyValue("padding-left"))},h=l.top+l.bottom,f=l.right+l.left,p=a-h,m=o-f-n;return{cols:Math.max(Uj,Math.floor(m/t.css.cell.width)),rows:Math.max(Fj,Math.floor(p/t.css.cell.height))}}};function Gj({sessionId:e,onClose:t,onEscape:n,autoFocus:s}){const a=O.useRef(null),o=O.useRef(e),c=O.useRef(null),l=O.useRef(null),h=_r(p=>p.writeSession),f=_r(p=>p.resizeSession);return O.useEffect(()=>{o.current=e},[e]),O.useEffect(()=>{if(!n)return;const p=m=>{m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),n())};return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[n]),O.useEffect(()=>{if(!a.current)return;const p=new $j.Terminal({fontFamily:'"JetBrains Mono", monospace',fontSize:13,theme:{background:"#1a1a1a",foreground:"#e0e0e0",cursor:"#ffffff",cursorAccent:"#1a1a1a"},cursorBlink:!0,cursorStyle:"bar",convertEol:!0}),m=new Vj;p.loadAddon(m),c.current={term:p,fitAddon:m},a.current.addEventListener("keydown",k=>{k.key==="Escape"&&n&&(k.preventDefault(),k.stopPropagation(),n())}),p.open(a.current);const _=a.current.querySelector(".xterm");_&&(_.style.padding="8px"),m.fit(),s&&setTimeout(()=>{p.focus()},150);const y=new ResizeObserver(()=>{l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{requestAnimationFrame(()=>{var v;m.fit&&m.fit();const k=(v=c.current)==null?void 0:v.term;k&&k.cols>0&&k.rows>0&&f(o.current,k.cols,k.rows)})},100)});y.observe(a.current),p.onData(k=>{if(k==="\x1B"&&n){n();return}h(o.current,k)}),p.onKey(k=>{k.key==="\x1B"&&n&&(k.domEvent.stopPropagation(),n())});const w=Qt.subscribe(k=>{const v=k.payload;if(k.type==="terminal.output"&&(v==null?void 0:v.sessionId)===o.current){const b=v==null?void 0:v.data;b&&p.write(b)}});return()=>{w(),y.disconnect(),l.current&&clearTimeout(l.current),p.dispose(),c.current=null}},[e,h,f]),u.jsxs("div",{className:"flex flex-col h-full bg-[#1a1a1a]",children:[u.jsxs("div",{className:"flex-shrink-0 flex items-center justify-between px-2 py-1 bg-[#252525] border-b border-[#333]",children:[u.jsx("div",{}),u.jsx("button",{onClick:t,className:"p-1 rounded hover:bg-[#333] text-[#888] hover:text-[#ccc] transition-colors",title:"Close terminal",children:u.jsx(rS,{})})]}),u.jsx("div",{ref:a,className:"flex-1 relative overflow-hidden",tabIndex:0,onKeyDown:p=>{p.key==="Escape"&&n&&(p.preventDefault(),p.stopPropagation(),n())}})]})}const pS="openfox-chat-textarea";function gS(){const e=document.getElementById(pS);e&&e.focus()}function Wj(e){return e===1?"grid-cols-1":e===2?"grid-cols-1 lg:grid-cols-2":"grid-cols-1 lg:grid-cols-2 xl:grid-cols-3"}function qj({isOpen:e,onClose:t}){const n=_r(w=>w.createSession),s=_r(w=>w.killSession),a=_r(w=>w.sessions),o=_r(w=>w.setWorkdir),c=_r(w=>w.fetchSessions),l=zt(w=>w.currentProject),[h,f]=O.useState(!0),p=O.useRef(null),m=O.useRef(!1),_=O.useRef(!1),y=O.useCallback(()=>{t()},[t]);return O.useEffect(()=>{l!=null&&l.workdir&&o(l.workdir)},[l==null?void 0:l.workdir,o]),O.useEffect(()=>{e?(f(!0),c(l==null?void 0:l.id).finally(()=>f(!1))):gS()},[e,c,l==null?void 0:l.id]),O.useEffect(()=>{e&&a.length===0&&!h&&!_.current&&(_.current=!0,n(void 0,l==null?void 0:l.id))},[e,a.length,h,n,l==null?void 0:l.id]),O.useEffect(()=>{e?(m.current=!0,setTimeout(()=>{var w;(w=p.current)==null||w.focus(),setTimeout(()=>{m.current=!1},200)},100)):_.current=!1},[e]),O.useEffect(()=>{if(!e)return;const w=k=>{m.current||k.key==="Escape"&&(k.preventDefault(),t())};return window.addEventListener("keydown",w),()=>window.removeEventListener("keydown",w)},[e,t]),e?u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"fixed inset-x-0 top-[50vh] bottom-0 z-[100] bg-black/40",style:{pointerEvents:"auto"},onClick:y}),u.jsxs("div",{ref:p,tabIndex:-1,className:"fixed inset-x-0 top-0 z-[100] h-[50vh] bg-bg-primary border-b border-border flex flex-col animate-slide-down outline-none",onClick:w=>w.stopPropagation(),onKeyDown:w=>{w.key==="Escape"&&(w.preventDefault(),y())},children:[u.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border",children:[u.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:"Terminal"}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("button",{onClick:()=>n(void 0,l==null?void 0:l.id),className:"p-2 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"New terminal",children:u.jsx(oj,{})}),u.jsx("button",{onClick:t,className:"p-2 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Close (Esc)",children:u.jsx(Zm,{})})]})]}),u.jsx("div",{className:"flex-1 min-h-0 p-2 overflow-auto",children:h?u.jsx("div",{className:"flex items-center justify-center h-full text-text-muted",children:"Loading..."}):a.length===0?u.jsx("div",{className:"flex items-center justify-center h-full text-text-muted",children:u.jsxs("div",{className:"text-center",children:[u.jsx("p",{className:"mb-4",children:"No terminal sessions"}),u.jsx("button",{onClick:()=>n(void 0,l==null?void 0:l.id),className:"px-4 py-2 bg-accent-primary/25 text-text-primary rounded hover:bg-accent-primary/40 transition-colors",children:"Create Terminal"})]})}):u.jsx("div",{className:`grid ${Wj(a.length)} gap-2 h-full auto-rows-fr`,children:a.map(w=>u.jsx(Gj,{sessionId:w.id,onClose:()=>s(w.id),onEscape:y,autoFocus:a.length===1},w.id))})})]})]}):null}function dl({items:e,trigger:t,minWidth:n="120px",isOpen:s,onOpenChange:a}){const[o,c]=O.useState(!1),l=s!==void 0,h=l?s:o,f=R=>{if(l){const $=typeof R=="function"?R(o):R;a==null||a($)}else c(R)},[p,m]=O.useState(null),_=O.useRef(null),y=O.useRef(null),[w,k]=O.useState(0),v=O.useRef(0),b=O.useRef(e),x=O.useCallback(()=>{if(!_.current)return;const R=_.current.getBoundingClientRect(),$=200,W=window.innerHeight-R.bottom<$;m({top:W?R.top-$-4:R.bottom+4,left:R.left,alignToTop:W})},[]);O.useEffect(()=>{b.current=e},[e]),O.useEffect(()=>{function R($){if(y.current){const F=$.target;y.current.contains(F)||f(!1)}}return h&&document.addEventListener("mousedown",R),()=>{document.removeEventListener("mousedown",R)}},[h]),O.useEffect(()=>{h&&x()},[h,x]),O.useEffect(()=>{if(!h)return;setTimeout(()=>{var $;($=y.current)==null||$.focus()},0);function R($){const F=b.current,W=F.filter(P=>!S(P)),Y=j(v.current,F);switch($.key){case"ArrowDown":if($.preventDefault(),$.stopPropagation(),Y<W.length-1){const P=N(v.current+1,F);v.current=P,k(P)}break;case"ArrowUp":if($.preventDefault(),$.stopPropagation(),Y>0){const P=T(v.current-1,F);v.current=P,k(P)}break;case"Enter":$.preventDefault(),$.stopPropagation(),D(v.current,F);break;case"Escape":$.preventDefault(),$.stopPropagation(),f(!1);break}}return window.addEventListener("keydown",R,!0),()=>window.removeEventListener("keydown",R,!0)},[h,e]);function S(R){var W;const $=R.label;return $?String(((W=$.props)==null?void 0:W.className)??"").includes("cursor-default"):!1}function j(R,$){let F=0;for(let W=0;W<R;W++){const Y=$[W];Y&&!S(Y)&&F++}return F}function N(R,$){for(let F=R;F<$.length;F++){const W=$[F];if(W&&!S(W))return F}return R}function T(R,$){for(let F=R;F>=0;F--){const W=$[F];if(W&&!S(W))return F}return R}function D(R,$){var W;const F=$[R];!F||S(F)||((W=F.onClick)==null||W.call(F),F.href&&(window.history.pushState(null,"",F.href),window.dispatchEvent(new PopStateEvent("popstate"))),f(!1))}O.useEffect(()=>{h&&(k(e.findIndex(R=>!S(R))),v.current=e.findIndex(R=>!S(R)))},[h,e]);const A=R=>{R.stopPropagation(),h||x(),f(!h)},B=p&&u.jsx("div",{ref:y,"data-testid":"session-dropdown-menu",className:`fixed bg-bg-secondary border border-border rounded shadow-lg z-50 ${p.alignToTop?"mb-1":"mt-1"}`,style:{top:p.top,left:p.left,minWidth:n},tabIndex:-1,children:e.map((R,$)=>{const W=!S(R)&&$===w,Y=u.jsxs(u.Fragment,{children:[R.icon&&u.jsx("span",{className:"w-4 h-4 flex-shrink-0",children:R.icon}),R.label]});return R.href?u.jsx(Xn,{href:R.href,onClick:P=>{var H;(H=R.onClick)==null||H.call(R,P),f(!1)},onAuxClick:()=>f(!1),className:`w-full px-3 py-2 text-left text-sm flex items-center gap-2 transition-colors ${R.danger?"text-accent-error hover:bg-accent-error/10":W?"bg-accent-primary/20 text-text-primary":"hover:bg-bg-tertiary text-text-primary"} ${$!==e.length-1?"border-b border-border":""}`,children:Y},$):u.jsx("button",{onClick:P=>{var H;(H=R.onClick)==null||H.call(R,P),R.closeOnClick!==!1&&f(!1)},className:`w-full px-3 py-2 text-left text-sm flex items-center gap-2 transition-colors ${R.danger?"text-accent-error hover:bg-accent-error/10":W?"bg-accent-primary/20 text-text-primary":"hover:bg-bg-tertiary text-text-primary"} ${$!==e.length-1?"border-b border-border":""}`,children:Y},$)})});return u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"relative",children:u.jsx("div",{ref:_,onClick:A,children:t})}),h&&Pa.createPortal(B,document.body)]})}function xS(e){const t=new Date(e),s=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][t.getDay()],a=t.getFullYear(),o=String(t.getMonth()+1).padStart(2,"0"),c=String(t.getDate()).padStart(2,"0");return`${s} ${a}/${o}/${c}`}function Au(e){const t=new Date(e),n=String(t.getHours()).padStart(2,"0"),s=String(t.getMinutes()).padStart(2,"0");return`${n}:${s}`}function Kj(e){const t=new Date(e),n=new Date,s=new Date(n.getFullYear(),n.getMonth(),n.getDate()),a=new Date(t.getFullYear(),t.getMonth(),t.getDate()),o=Math.floor((s.getTime()-a.getTime())/(1e3*60*60*24)),c=Au(e);if(o===0)return`today ${c}`;if(o===1)return`yesterday ${c}`;if(o<7)return`${o} days ago ${c}`;{const l=t.getFullYear(),h=String(t.getMonth()+1).padStart(2,"0"),f=String(t.getDate()).padStart(2,"0");return`${l}/${h}/${f} ${c}`}}function _S(e){const t=new Date(e);return{year:t.getFullYear(),month:String(t.getMonth()+1).padStart(2,"0"),day:String(t.getDate()).padStart(2,"0")}}function Yj(e){const{year:t,month:n,day:s}=_S(e);return`${t}-${n}-${s}`}function yS(e){const t=new Map;for(const a of e){const o=Yj(a.updatedAt);t.has(o)||t.set(o,[]),t.get(o).push(a)}for(const[a,o]of t)o.sort((c,l)=>{const h=new Date(c.updatedAt).getTime();return new Date(l.updatedAt).getTime()-h});const n=Array.from(t.keys()).sort((a,o)=>o.localeCompare(a)),s=new Map;for(const a of n)s.set(a,t.get(a));return s}function Xj({items:e,trigger:t,isActive:n=!1}){const[s,a]=O.useState(!1),o=O.useRef(null);return O.useEffect(()=>{function c(l){o.current&&!o.current.contains(l.target)&&a(!1)}if(s)return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[s]),u.jsxs("div",{className:"relative",ref:o,children:[u.jsxs("button",{type:"button",onClick:()=>a(!s),className:`flex items-center gap-1 px-1.5 py-0.5 rounded transition-colors ${n?"bg-bg-tertiary":"hover:bg-bg-tertiary"}`,children:[typeof t=="string"?u.jsx("span",{className:"text-sm text-text-secondary font-medium",children:t}):t,u.jsx(Ir,{className:"w-3 h-3 text-text-muted flex-shrink-0 transition-transform",rotate:s?180:0})]}),s&&e.length>0&&u.jsx("div",{className:"absolute top-full left-0 mt-1 w-56 bg-bg-secondary border border-border rounded-lg shadow-lg overflow-hidden z-50",children:e.map((c,l)=>{const h=c.label&&typeof c.label=="object"&&c.label.type===Xn?c.label:null;if(h){const f=h.props.href||"";return u.jsxs(Xn,{href:f,className:"flex items-center gap-2 px-3 py-2 text-sm border-b border-border hover:bg-bg-tertiary transition-colors",children:[c.icon,h.props.children]},l)}return c.href?u.jsxs("a",{href:c.href,className:"flex items-center gap-2 px-3 py-2 text-sm border-b border-border hover:bg-bg-tertiary transition-colors",children:[c.icon,c.label]},l):u.jsxs("button",{type:"button",onClick:()=>{var f;(f=c.onClick)==null||f.call(c),a(!1)},className:"flex items-center gap-2 px-3 py-2 text-sm w-full text-left border-b border-border hover:bg-bg-tertiary transition-colors",children:[c.icon,c.label]},l)})})]})}function Qj({projects:e,currentProject:t}){const n=zt(c=>c.loadProject),s=zt(c=>c.toggleStar),o=O.useMemo(()=>{const c=e.filter(h=>h.isStarred).sort((h,f)=>h.name.localeCompare(f.name)),l=e.filter(h=>!h.isStarred).sort((h,f)=>h.name.localeCompare(f.name));return[...c,...l]},[e]).map(c=>({label:u.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[u.jsx("span",{className:"truncate flex-1",children:c.name}),u.jsx("button",{onClick:l=>{l.stopPropagation(),l.preventDefault(),l.nativeEvent.stopImmediatePropagation(),s(c.id,!c.isStarred)},className:"flex-shrink-0 p-1 hover:bg-bg-tertiary rounded transition-colors",title:c.isStarred?"Unstar project":"Star project",children:c.isStarred?u.jsx(uj,{className:"w-3.5 h-3.5 text-yellow-500"}):u.jsx(dj,{className:"w-3.5 h-3.5 text-text-muted hover:text-yellow-500"})})]}),icon:c.id===t.id?u.jsx(Mr,{}):void 0,href:`/p/${c.id}`,closeOnClick:!0,onClick:()=>{n(c.id)}}));return u.jsx(dl,{items:o,trigger:u.jsxs("button",{className:"text-text-secondary hover:text-text-primary hover:underline text-sm truncate flex items-center gap-1",title:t.name,children:[t.name,u.jsx(Ir,{})]}),minWidth:"250px"})}function Jj({currentProject:e,sessions:t,currentSession:n,projectIdFromUrl:s}){if(!(e!=null&&e.id)||e.id!==s)return null;const a=t.filter(c=>c.projectId===e.id).sort((c,l)=>new Date(l.updatedAt).getTime()-new Date(c.updatedAt).getTime()).slice(0,5),o=[{label:u.jsxs(Xn,{href:`/p/${e.id}/new`,className:"flex items-center gap-2",children:[u.jsx(Da,{className:"w-3 h-3 text-accent-primary"}),u.jsx("span",{className:"text-sm",children:"New Session"})]})},...a.map(c=>({label:u.jsx(Xn,{href:`/p/${e.id}/s/${c.id}`,className:"flex items-center gap-2 truncate text-sm",children:u.jsx("span",{children:c.title??c.id.slice(0,8)})}),icon:c.id===(n==null?void 0:n.id)?u.jsx(Mr,{className:"w-3 h-3"}):void 0})),{label:u.jsxs(Xn,{href:"/",className:"flex items-center gap-2 text-text-muted hover:text-text-primary",children:[u.jsx(X2,{className:"w-3 h-3"}),u.jsx("span",{className:"text-sm",children:"Projects"})]})}];return u.jsx(Xj,{items:o,trigger:u.jsx("span",{className:"text-sm text-text-secondary font-medium",children:e.name})})}function Zj({sessions:e,currentProject:t,currentSession:n,isOpen:s,onOpenChange:a}){var p;const o=Ce(m=>m.loadSession),c=e.filter(m=>m.projectId===t.id).slice(0,15),l=yS(c),h=O.useMemo(()=>{const m=[];m.push({label:u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(Da,{className:"w-4 h-4 text-accent-primary"}),u.jsx("span",{className:"text-sm",children:"New session"})]}),href:`/p/${t.id}/new`,onClick:()=>{}});for(const[_,y]of l){const w=y[0];if(w){m.push({label:u.jsx("div",{className:"px-3 py-2 text-text-muted text-xs font-medium cursor-default",children:xS(w.updatedAt)}),onClick:()=>{}});for(const k of y)m.push({label:u.jsxs("div",{className:"min-w-[160px]",children:[u.jsx("div",{className:"truncate text-sm",children:k.title??k.id.slice(0,8)}),u.jsx("div",{className:"text-text-muted text-xs",children:Au(k.updatedAt)})]}),icon:k.id===(n==null?void 0:n.id)?u.jsx(Mr,{}):void 0,href:`/p/${t.id}/s/${k.id}`,onClick:()=>{o(k.id)}})}}return m},[t.id,l,n==null?void 0:n.id]),f=n?((p=n.metadata)==null?void 0:p.title)??n.id.slice(0,8):"No session selected";return u.jsx(dl,{items:h,isOpen:s,onOpenChange:a,trigger:u.jsxs("button",{className:"text-text-secondary hover:text-text-primary hover:underline text-sm truncate flex items-center gap-1",title:f,"data-testid":"header-session-dropdown",children:[f,u.jsx(Ir,{})]}),minWidth:"280px"})}function eT({onMenuClick:e,onCriteriaToggle:t}){const[n,s]=O.useState(!1),[a,o]=O.useState(!1),[c,l]=O.useState(!!document.fullscreenElement);O.useEffect(()=>{const j=()=>l(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",j),()=>document.removeEventListener("fullscreenchange",j)},[]);const[h]=wr(),f=h.startsWith("/p/"),p=/^\/p\/[^/]+\/s\/[^/]+$/.test(h),m=Ce(j=>j.currentSession),_=Ce(j=>j.sessions),y=zt(j=>j.currentProject),w=zt(j=>j.projects),k=Lt(j=>j.startAutoRefresh),v=Lt(j=>j.stopAutoRefresh),b=_r(j=>j.setOpen),x=_r(j=>j.isOpen);O.useEffect(()=>{const j=()=>o(!0);return window.addEventListener("open-session-dropdown",j),()=>window.removeEventListener("open-session-dropdown",j)},[]);const S=ep();return oS(S.terminalToggle,()=>{_r.getState().toggleOpen()},{capture:!0}),O.useEffect(()=>(k(),()=>v()),[k,v]),u.jsxs("header",{className:"h-8 bg-secondary border-b border-border flex items-center justify-between px-2",children:[u.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[e&&f&&u.jsx("button",{onClick:e,className:"flex-shrink-0 p-2.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Toggle session list",children:u.jsx(wv,{})}),u.jsx(Xn,{href:"/",className:"text-accent-primary font-semibold text-sm hover:underline flex-shrink-0 hidden md:inline",children:"OpenFox"}),y&&u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"hidden md:inline text-text-muted flex-shrink-0",children:"/"}),u.jsx("span",{className:"hidden md:inline",children:u.jsx(Qj,{projects:w,currentProject:y})}),u.jsx("span",{className:"md:hidden",children:u.jsx(Jj,{currentProject:y,sessions:_,currentSession:m,projectIdFromUrl:f&&h.split("/")[2]||null},y==null?void 0:y.id)}),u.jsx("span",{className:"hidden md:inline text-text-muted flex-shrink-0",children:"/"}),u.jsx("span",{className:"hidden md:inline",children:u.jsx(Zj,{sessions:_,currentProject:y,currentSession:m,isOpen:a,onOpenChange:o})})]})]}),u.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[p&&u.jsx("button",{onClick:()=>{var j,N,T;document.fullscreenElement?(j=document.exitFullscreen)==null||j.call(document):(T=(N=document.documentElement).requestFullscreen)==null||T.call(N)},className:"max-sm:block hidden p-2 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:c?"Exit fullscreen":"Enter fullscreen",children:c?u.jsx(ej,{}):u.jsx(tj,{})}),f&&u.jsx("button",{onClick:()=>b(!x),className:`p-2.5 rounded hover:bg-bg-tertiary transition-colors ${x?"text-accent-primary":"text-text-muted hover:text-text-primary"}`,title:"Toggle terminal (double Ctrl)",children:u.jsx(fj,{})}),u.jsx("button",{onClick:()=>s(!0),className:"p-2.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Settings",children:u.jsx(lj,{})}),u.jsx("button",{onClick:()=>{localStorage.removeItem("openfox_token"),window.location.reload()},className:"p-2.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Logout",children:u.jsx(sj,{})}),t&&p&&u.jsx("button",{onClick:t,className:"p-2.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Toggle summary sidebar",children:u.jsx(wv,{})})]}),u.jsx(Rj,{isOpen:n,onClose:()=>s(!1)}),u.jsx(qj,{isOpen:x,onClose:()=>b(!1)})]})}function tT({onCancel:e,onSave:t,saving:n,saveDisabled:s,cancelLabel:a="Cancel",saveLabel:o=n?"Saving...":"Save"}){return u.jsxs("div",{className:"flex justify-end gap-2 flex-shrink-0",children:[u.jsx(rt,{variant:"secondary",onClick:e,children:a}),u.jsx(rt,{variant:"primary",onClick:t,disabled:s??n,children:o})]})}function nT({isOpen:e,onClose:t,project:n}){const s=zt(S=>S.updateProject),[a,o]=O.useState(n.customInstructions??""),[c,l]=O.useState(n.dangerLevel??""),[h,f]=O.useState(!1),[p,m]=O.useState(!1),[_,y]=O.useState(!1),w=h||p;O.useEffect(()=>{o(n.customInstructions??""),l(n.dangerLevel??""),f(!1),m(!1)},[n]);const k=S=>{o(S.target.value),f(!0)},v=S=>{l(S),m(!0)},b=async()=>{y(!0);const S=c===""?null:c;await s(n.id,{customInstructions:a||null,dangerLevel:S}),y(!1),f(!1),m(!1),t()},x=()=>{o(n.customInstructions??""),l(n.dangerLevel??""),f(!1),m(!1),t()};return u.jsx(Nt,{isOpen:e,onClose:x,title:`${n.name} Settings`,size:"lg",footer:u.jsx(tT,{onCancel:x,onSave:b,saving:_,saveDisabled:!w||_}),children:u.jsxs("div",{className:"flex flex-col gap-5 -mt-1",children:[u.jsxs("div",{children:[u.jsx("label",{className:"block text-sm font-medium text-text-primary mb-1 flex-shrink-0",children:"Default Danger Level"}),u.jsx("p",{className:"text-sm text-text-muted mb-3",children:"Default danger level for new sessions in this project. Existing sessions are not affected."}),u.jsxs("div",{className:"flex items-center gap-1 px-1.5 py-1 rounded bg-bg-tertiary/50 w-fit",children:[u.jsx("button",{type:"button",onClick:()=>v(""),className:`px-3 py-1 text-sm font-medium rounded transition-colors ${c===""?"bg-bg-tertiary text-text-primary border border-border":"text-text-muted hover:text-text-primary hover:bg-bg-tertiary"}`,title:"Use global default (Normal)",children:"Default"}),u.jsx("button",{type:"button",onClick:()=>v("normal"),className:`px-3 py-1 text-sm font-medium rounded transition-colors ${c==="normal"?"bg-accent-success/20 text-accent-success border border-accent-success/30":"text-text-muted hover:text-text-primary hover:bg-bg-tertiary"}`,title:"Normal mode - requires path confirmation",children:"Normal"}),u.jsx("button",{type:"button",onClick:()=>v("dangerous"),className:`px-3 py-1 text-sm font-medium rounded transition-colors ${c==="dangerous"?"bg-red-500/20 text-red-400 border border-red-500/30":"text-text-muted hover:text-text-primary hover:bg-bg-tertiary"}`,title:"Dangerous mode - bypasses all confirmations",children:"Dangerous"})]})]}),u.jsxs("div",{children:[u.jsx("label",{className:"block text-sm font-medium text-text-primary mb-1 flex-shrink-0",children:"Project Path"}),u.jsx("p",{className:"text-sm text-text-muted font-mono",children:n.workdir})]}),u.jsxs("div",{className:"flex-1 min-h-[150px] pb-4",children:[u.jsx("label",{className:"block text-sm font-medium text-text-primary mb-1 flex-shrink-0",children:"Project Instructions"}),u.jsx("p",{className:"text-sm text-text-muted mb-3 flex-shrink-0",children:"These instructions are injected into prompts when working in this project. They are applied after global instructions but before AGENTS.md files."}),u.jsx("textarea",{value:a,onChange:k,placeholder:"Enter project-specific instructions...",className:"w-full h-full px-3 py-2 mb-3 bg-bg-tertiary border border-border rounded text-sm font-mono resize-none focus:outline-none focus:ring-1 focus:ring-accent-primary",disabled:_})]}),h&&u.jsx(op,{})]})})}const rT={sm:"w-3 h-3",md:"w-4 h-4",lg:"w-5 h-5",xl:"w-6 h-6"},sT="M6 18L18 6M6 6l12 12";function hl({onClick:e,className:t="",size:n="md",variant:s="default"}){const a=s==="overlay"?"bg-accent-error text-white rounded-full flex items-center justify-center hover:bg-accent-error/80 transition-colors":s==="sidebar"?"flex-shrink-0 p-2.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors":s==="modal"?"text-text-muted hover:text-text-primary transition-colors":"hover:text-white transition-colors";return u.jsx(Tu,{onClick:e,icon:sT,iconSize:rT[n],className:`${a} ${t}`,title:"Close"})}function vS({projectId:e,isOpen:t=!0,onClose:n}){const[,s]=wr(),[a,o]=O.useState(!1),c=Ce(N=>N.sessions),l=Ce(N=>N.currentSession),h=Ce(N=>N.unreadSessionIds),f=Ce(N=>N.deleteSession),p=Ce(N=>N.deleteAllSessions),m=Ce(N=>N.loadMoreSessions),_=Ce(N=>N.sessionsHasMore),y=Ce(N=>N.sessionsPaginationLoading),w=zt(N=>N.currentProject),k=O.useRef(null),v=O.useCallback(()=>{_&&!y&&w&&m(w.id)},[_,y,w,m]);O.useEffect(()=>{if(!k.current||!_)return;const N=new IntersectionObserver(T=>{const D=T[0];D&&D.isIntersecting&&v()},{threshold:.1});return N.observe(k.current),()=>N.disconnect()},[_,v]);const b=c.filter(N=>N.projectId===(w==null?void 0:w.id)),x=(N,T)=>{T==null||T.stopPropagation(),confirm("Delete this session?")&&(f(N),(l==null?void 0:l.id)===N&&s(`/p/${e}`))},S=(N,T)=>{T==null||T.stopPropagation();const D=c.find(R=>R.id===N),A=(D==null?void 0:D.title)??N.slice(0,6),B=prompt("Rename session:",A);if(B!==null&&B.trim()!==""){const R=Ce.getState().renameSession;R(N,B.trim())}},j=()=>{confirm("Delete all sessions in this project? This cannot be undone.")&&(p(e),s(`/p/${e}`))};return u.jsxs(u.Fragment,{children:[t&&n&&u.jsx("div",{className:"md:hidden fixed inset-0 bg-black/50 z-40",onClick:n}),u.jsxs("aside",{className:`
78
+ ${t?"md:w-[300px] md:shrink-0":"md:w-0 md:shrink-0 md:overflow-hidden"}
79
+ md:relative md:h-auto md:translate-x-0
80
+
81
+ fixed z-50 h-[calc(100vh-32px)]
82
+ w-[300px] bg-secondary border-r border-border flex flex-col
83
+ transition-all duration-300 ease-in-out
84
+ ${t?"translate-x-0":"-translate-x-full"}
85
+ `,children:[u.jsxs("div",{className:"p-4 border-b border-border flex gap-2",children:[u.jsx(Xn,{href:`/p/${e}/new`,className:"flex-1 block text-center rounded font-medium transition-colors bg-accent-primary/25 text-text-primary hover:bg-accent-primary/40 px-3 py-1.5 text-sm","data-testid":"sidebar-new-session-button",children:"+ New Session"}),u.jsx(dl,{items:[{label:"Edit project settings",onClick:()=>o(!0)},{label:"Delete all sessions",onClick:j,danger:!0}],trigger:u.jsx("button",{className:"flex-shrink-0 p-2.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Options",children:u.jsx(Xm,{})})}),n&&u.jsx(hl,{onClick:n,className:"md:hidden",variant:"sidebar",size:"md"})]}),w&&u.jsx(nT,{isOpen:a,onClose:()=>o(!1),project:w}),u.jsx("div",{className:"flex-1 overflow-y-auto",children:b.length===0?u.jsx("div",{className:"p-4 text-center text-text-muted text-xs",children:"No sessions"}):u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"divide-y divide-border",children:iT(b,l,h,x,S,e)}),y&&u.jsx("div",{className:"p-4 text-center text-text-muted text-xs",children:"Loading more..."}),u.jsx("div",{ref:k,className:"h-px"})]})})]})]})}function iT(e,t,n,s,a,o){const c=yS(e);return Array.from(c).map(([l,h])=>{const f=h[0];return f?u.jsxs("div",{children:[u.jsx("div",{className:"px-4 py-2 bg-bg-tertiary/30 text-text-muted text-xs font-medium",children:xS(f.updatedAt)}),h.map(p=>{const m=(t==null?void 0:t.id)===p.id,_=n.includes(p.id),y=p.isRunning;return u.jsx("div",{className:`w-full px-4 py-3 text-left hover:bg-bg-tertiary/50 transition-colors group ${m?"bg-bg-tertiary":""}`,children:u.jsxs(Xn,{href:`/p/${o}/s/${p.id}`,className:`block ${m?"text-accent-primary":"text-text-primary"} hover:text-accent-primary`,children:[u.jsxs("div",{className:"flex justify-between items-center mb-1",children:[u.jsx("span",{className:`font-medium truncate text-sm ${m?"text-accent-primary":"text-text-primary"}`,children:p.title??p.id.slice(0,6)}),u.jsx(dl,{items:[{label:"Rename session",onClick:w=>a(p.id,w)},{label:"Delete session",onClick:w=>s(p.id,w),danger:!0}],trigger:u.jsx("button",{onClick:w=>w.preventDefault(),className:"p-1.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-all",title:"Options",children:u.jsx(Xm,{})})})]}),u.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[y?u.jsx(cj,{}):_&&!m?u.jsx("span",{"aria-label":"Unread activity",title:"Unread activity",className:"w-2 h-2 rounded-full bg-amber-400 flex-shrink-0"}):null,u.jsx("span",{className:"text-text-muted text-xs flex-shrink-0",children:Au(p.updatedAt)}),u.jsxs("span",{className:"text-text-muted text-xs flex-shrink-0",children:[p.messageCount," messages"]})]})]})},p.id)})]},l):null})}const Dv=["⠋","⠙","⠹","⠸","⠼","⠴"];function aT(){var l;const e=zt(h=>h.currentProject),t=Ce(h=>h.currentSession),n=Km(),s=!1,a=O.useRef(0),o=O.useRef(null);O.useEffect(()=>(n?(o.current=window.setInterval(()=>{a.current=(a.current+1)%Dv.length,c()},150),c()):(o.current&&(clearInterval(o.current),o.current=null),c()),()=>{o.current&&(clearInterval(o.current),o.current=null)}),[n,e,t,s]);const c=()=>{var m;const f=(m=t==null?void 0:t.metadata)==null?void 0:m.title,p=n?`${Dv[a.current]} `:"";e&&f?document.title=`${p}${e.name} - ${f} | OpenFox`:e?document.title=`${p}${e.name} | OpenFox`:document.title=`${p}OpenFox`};return typeof window<"u"&&((l=t==null?void 0:t.metadata)!=null&&l.title)&&window.document.documentElement.setAttribute("data-session-title",t.metadata.title),null}function bS(e,t=28){if(e.length<=t)return e;const n=e.split("/").filter(Boolean);if(n.length<=2)return e;const s=n[0],a=n[n.length-1],o=n.slice(1,-1).join("/"),c=t-s.length-a.length-3;if(c<0)return e;const l=o.slice(0,Math.floor(c/2)),h=o.slice(-Math.ceil(c/2));return`/${s}/${l}...${h}/${a}`}function oT({isOpen:e,onClose:t,projectName:n,onConfirm:s}){const a=()=>{s(),t()};return u.jsx(Nt,{isOpen:e,onClose:t,title:"Delete Project",size:"sm",children:u.jsxs("div",{className:"space-y-4",children:[u.jsxs("p",{className:"text-text-secondary",children:["This will permanently delete the project"," ",u.jsx("span",{className:"font-semibold text-text-primary",children:n})," and all its sessions from OpenFox. The project files on disk will remain untouched."]}),u.jsxs("div",{className:"flex justify-end gap-2",children:[u.jsx(rt,{variant:"secondary",onClick:t,children:"Cancel"}),u.jsx(rt,{variant:"danger",onClick:a,children:"Delete"})]})]})})}const Du=O.forwardRef(({className:e="",...t},n)=>u.jsx("input",{ref:n,className:`bg-bg-tertiary border border-border rounded px-3 py-2 text-text-primary placeholder-text-muted focus:outline-none focus:ring-2 focus:ring-accent-primary/50 focus:border-accent-primary ${e}`,...t}));Du.displayName="Input";function lT(e){return!e||e.trim()===""?{valid:!1,error:"Project name cannot be empty"}:/^[a-zA-Z0-9._-]+$/.test(e)?{valid:!0}:{valid:!1,error:"Project name can only contain letters, numbers, hyphens, underscores, and dots"}}function SS({isOpen:e,onClose:t,path:n,onRetry:s}){const[a,o]=O.useState(!1),[c,l]=O.useState(null),[h,f]=O.useState(null);O.useEffect(()=>{e&&p()},[e]);const p=async()=>{try{const j=await(await je("/api/projects/check-permissions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:n})})).json();f({sudoAvailable:j.sudoAvailable,userInGroup:j.userInGroup,groupHasWrite:j.groupHasWrite,groupName:j.groupName||null})}catch{f({sudoAvailable:!1,userInGroup:!1,groupHasWrite:!1,groupName:null})}},m=O.useCallback(async S=>{o(!0),l(null);try{const N=await(await je("/api/projects/fix-permissions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:n,action:S})})).json();N.success?(s(),t()):N.sudoAvailable?l("Failed to fix permissions: "+(N.error||"Unknown error")):l(`Passwordless sudo is not available. Please fix permissions manually:
86
+
87
+ `+(S==="group"?`sudo chmod g+w "${n}"`:"sudo usermod -aG <group> $USER"))}catch(j){l("Failed to fix permissions: "+(j instanceof Error?j.message:"Unknown error"))}finally{o(!1)}},[n,s,t]),_=(h==null?void 0:h.userInGroup)??!1,y=(h==null?void 0:h.groupHasWrite)??!1,w=(h==null?void 0:h.sudoAvailable)??!1,k=(h==null?void 0:h.groupName)??"",v=_&&!y,b=!_&&y,x=!_&&!y;return u.jsx(Nt,{isOpen:e,onClose:t,title:"Permission Denied",size:"sm",children:u.jsxs("div",{className:"space-y-4",children:[u.jsxs("div",{className:"text-sm text-text-secondary",children:[u.jsx("p",{children:v?u.jsxs(u.Fragment,{children:["The group ",u.jsx("strong",{children:k})," doesn't have write access:"]}):b?u.jsxs(u.Fragment,{children:["You're not a member of group ",u.jsx("strong",{children:k}),":"]}):u.jsxs(u.Fragment,{children:["You're not a member of group ",u.jsx("strong",{children:k})," and it doesn't have write access:"]})}),u.jsx("p",{className:"mt-2 font-mono text-xs bg-bg-tertiary p-2 rounded break-all",children:n})]}),c?u.jsx("div",{className:"p-3 bg-accent-error/10 border border-accent-error/30 rounded text-sm text-accent-error whitespace-pre-wrap",children:c}):h?u.jsxs("div",{className:"flex flex-col gap-2",children:[v&&u.jsxs(u.Fragment,{children:[u.jsx(rt,{type:"button",variant:"primary",onClick:()=>m("group"),disabled:a||!w,className:"w-full",children:a?"Granting access...":"Extend group permissions"}),u.jsx("div",{className:"text-xs text-text-secondary",children:"Or manually execute:"}),u.jsxs("code",{className:"text-xs text-text-muted p-2 bg-bg-tertiary rounded break-all",children:['sudo chmod g+w "',n,'"']})]}),b&&u.jsxs(u.Fragment,{children:[u.jsx(rt,{type:"button",variant:"primary",onClick:()=>m("join_group"),disabled:a||!w,className:"w-full",children:a?"Joining group...":"Join group"}),u.jsx("div",{className:"text-xs text-text-secondary",children:"Or manually execute:"}),u.jsxs("code",{className:"text-xs text-text-muted p-2 bg-bg-tertiary rounded break-all",children:["sudo usermod -aG ",k," $USER"]})]}),x&&u.jsxs(u.Fragment,{children:[u.jsx(rt,{type:"button",variant:"primary",onClick:()=>m("join_group_and_group"),disabled:a||!w,className:"w-full",children:a?"Joining group...":"Join group & grant write permissions"}),u.jsx("div",{className:"text-xs text-text-secondary",children:"Or manually execute:"}),u.jsxs("code",{className:"text-xs text-text-muted p-2 bg-bg-tertiary rounded break-all",children:["sudo usermod -aG ",k," $USER",u.jsx("br",{}),'sudo chmod g+w "',n,'"']})]}),!w&&!c&&u.jsxs("div",{className:"text-xs text-text-secondary",children:[u.jsx("p",{children:"Passwordless sudo is not available. Please fix permissions manually:"}),u.jsxs("code",{className:"block mt-1 p-2 bg-bg-tertiary rounded break-all",children:['sudo chmod g+w "',n,'"']})]}),u.jsx("div",{className:"flex justify-end",children:u.jsx(rt,{type:"button",variant:"secondary",onClick:t,disabled:a,children:"Cancel"})})]}):null]})})}function cT({isOpen:e,onClose:t}){const[,n]=wr(),[s,a]=O.useState(""),[o,c]=O.useState(null),[l,h]=O.useState(!1),[f,p]=O.useState(""),[m,_]=O.useState(null),y=O.useRef(null);O.useEffect(()=>{e&&(je("/api/config").then(j=>j.json()).then(j=>{j.workdir&&p(j.workdir)}),a(""),c(null),h(!1),_(null),setTimeout(()=>{var j;(j=y.current)==null||j.focus()},100))},[e]);const w=O.useCallback(async j=>{j.preventDefault();const N=lT(s);if(!N.valid){c(N.error);return}const T=`${f}/${s}`;await b(T)},[s,n,t,f]),k=O.useCallback(()=>{_(null)},[]),v=O.useCallback(async()=>{const j=`${f}/${s}`;await b(j)},[f,s,n,t,_,c,h]);async function b(j){h(!0),c(null),_(null);try{const N=await je("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:s,workdir:j})});if(!N.ok){const A=await N.json().catch(()=>({}));if(A.code==="EACCES"){_(j),h(!1);return}throw new Error(A.error||"Failed to create project")}const D=(await N.json()).project;t(),n(`/p/${D.id}`)}catch(N){c(N instanceof Error?N.message:"Failed to create project"),h(!1)}}const x=O.useCallback(()=>{a(""),c(null),t()},[t]),S=s?`${f}/${s}`:"";return u.jsxs(u.Fragment,{children:[u.jsx(Nt,{isOpen:e,onClose:x,title:"Create New Project",size:"sm",children:u.jsxs("form",{onSubmit:w,className:"space-y-4",children:[u.jsxs("div",{children:[u.jsx("label",{htmlFor:"project-name",className:"block text-sm font-medium text-text-secondary mb-2",children:"Project Name"}),u.jsx(Du,{ref:y,id:"project-name",value:s,onChange:j=>{a(j.target.value),c(null)},placeholder:"my-project",disabled:l,"data-testid":"create-project-name-input",className:"w-full"}),s&&u.jsxs("div",{className:"mt-2 text-xs text-text-muted",children:["Full path: ",u.jsx("span",{className:"font-mono",children:S})]}),o&&u.jsx("div",{className:"mt-3 p-3 bg-accent-error/10 border border-accent-error/30 rounded text-sm text-accent-error",children:o})]}),u.jsxs("div",{className:"flex justify-end gap-2",children:[u.jsx(rt,{type:"button",variant:"secondary",onClick:x,disabled:l,children:"Cancel"}),u.jsx(rt,{type:"submit",variant:"primary",disabled:l||!s.trim(),"data-testid":"create-project-submit-button",className:"min-w-[100px]",children:l?u.jsxs("span",{className:"flex items-center gap-2",children:[u.jsx(Da,{className:"h-4 w-4"}),"Creating..."]}):"Create"})]})]})}),m&&u.jsx(SS,{isOpen:!!m,onClose:k,path:m,onRetry:v})]})}const uT={sm:"w-4 h-4",md:"w-8 h-8",lg:"w-12 h-12"};function fl({size:e="md",className:t=""}){return u.jsx("div",{className:`animate-spin border-2 border-accent-primary border-t-transparent rounded-full ${uT[e]} ${t}`})}function dT({text:e,...t}){return u.jsxs("div",{className:"text-center",children:[u.jsx(fl,{...t,className:"mx-auto mb-4"}),e&&u.jsx("div",{className:"text-text-secondary",children:e})]})}function wS({onSelect:e,onClose:t,initialPath:n}){const[s,a]=O.useState(null),[o,c]=O.useState(!0),[l,h]=O.useState(""),[f,p]=O.useState(-1),m=O.useRef(null),_=O.useRef([]),y=O.useCallback(async x=>{c(!0),h(""),p(-1);try{const S=x?`/api/directories?path=${encodeURIComponent(x)}`:"/api/directories",N=await(await je(S)).json();a(N)}catch(S){console.error("Failed to load directories:",S)}finally{c(!1)}},[]);O.useEffect(()=>{y(n)},[n,y]);const w=((s==null?void 0:s.current)??"").split("/").filter(Boolean).map((x,S,j)=>({name:x,path:"/"+j.slice(0,S+1).join("/")})),k=(s==null?void 0:s.directories.filter(x=>l===""||x.name.toLowerCase().includes(l.toLowerCase())))??[],v=[...s!=null&&s.parent?[{type:"parent",path:s.parent,name:".."}]:[],...k.map(x=>({type:"dir",path:x.path,name:x.name}))];O.useEffect(()=>{p(l?0:-1)},[l,k.length]),O.useEffect(()=>{var x;f>=0&&_.current[f]&&((x=_.current[f])==null||x.scrollIntoView({block:"nearest"}))},[f]);const b=x=>{var S;if(x.key==="ArrowDown")x.preventDefault(),p(j=>Math.min(j+1,v.length-1));else if(x.key==="ArrowUp")x.preventDefault(),p(j=>Math.max(j-1,0));else if(x.key==="Enter"){if(x.preventDefault(),f>=0&&v[f]){const j=v[f];j.type,y(j.path)}}else x.key==="Escape"&&(h(""),(S=m.current)==null||S.focus())};return u.jsxs(Nt,{isOpen:!0,onClose:t,title:"Select Folder",size:"lg",children:[s&&u.jsx("div",{className:"px-3 py-2 bg-bg-tertiary/30 -mx-4 -mt-4 mb-4 border-b border-border",children:u.jsxs("div",{className:"flex items-center text-xs overflow-x-auto",children:[w.map((x,S)=>u.jsxs("span",{className:"flex items-center shrink-0",children:[u.jsx("span",{className:"text-text-muted",children:"/"}),u.jsx("button",{onClick:()=>y(x.path),className:`px-1 ${S===w.length-1?"text-accent-primary font-medium":"text-text-secondary hover:text-accent-primary"}`,children:x.name})]},x.path)),w.length===0&&u.jsx("button",{onClick:()=>y("/"),className:"text-text-muted hover:text-accent-primary",children:"/"})]})}),u.jsx("div",{className:"px-4 mb-3",children:u.jsxs("div",{className:"relative",children:[u.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-text-muted pointer-events-none flex items-center justify-center",children:u.jsx(Jm,{})}),u.jsx(Du,{autoFocus:!0,ref:m,value:l,onChange:x=>h(x.target.value),onKeyDown:b,placeholder:"Filter directories...",className:"w-full pl-9"})]})}),u.jsx("div",{className:"flex-1 overflow-y-auto -mx-4",children:o?u.jsx("div",{className:"p-8 text-center",children:u.jsx(fl,{size:"sm"})}):v.length===0?u.jsx("div",{className:"p-8 text-center text-text-muted text-sm",children:l?"No matching directories":"No subdirectories"}):u.jsx("div",{className:"divide-y divide-border",children:v.map((x,S)=>u.jsxs("button",{ref:j=>{_.current[S]=j},onClick:()=>y(x.path),onDoubleClick:()=>e(x.path),className:`w-full p-3 flex items-center gap-3 text-left transition-colors ${S===f?"bg-accent-primary/20 text-accent-primary":"hover:bg-bg-tertiary/50"}`,children:[x.type==="parent"?u.jsx(K2,{className:"w-5 h-5 text-text-muted"}):u.jsx(Qm,{className:"w-5 h-5"}),u.jsx("span",{className:"flex-1",children:x.name}),S===f&&u.jsx("span",{className:"text-xs text-text-muted",children:"⏎ navigate · dbl-click select"})]},x.path))})}),u.jsxs("div",{className:"flex flex-col gap-2 pt-4 border-t border-border mt-4 -mx-4 -mb-4 p-4",children:[(s==null?void 0:s.current)&&u.jsx("button",{onClick:()=>e(s.current),className:"w-full px-4 py-2 bg-accent-primary text-text-primary rounded-lg font-medium hover:bg-accent-primary/90 transition-colors",children:"Select this folder"}),u.jsx("button",{onClick:t,className:"w-full text-center text-text-muted hover:text-text-secondary text-sm",children:"Cancel"})]})]})}function hT({isOpen:e,onClose:t}){const[,n]=wr(),[s,a]=O.useState(!1),[o,c]=O.useState(null),[l,h]=O.useState(!1),f=zt(R=>R.projects),p=zt(R=>R.createProject),m=zt(R=>R.listProjects),_=zt(R=>R.deleteProject),[y,w]=O.useState(null),[k,v]=O.useState(null),[b,x]=O.useState(null);O.useEffect(()=>{je("/api/config").then(R=>R.json()).then(R=>{R.workdir&&c(R.workdir)})},[]),O.useEffect(()=>{e&&m()},[e,m]);const S=R=>{n(`/p/${R}`),t()},j=(R,$)=>{$.stopPropagation(),w(R)},N=()=>{y&&(_(y.id),w(null))},T=async R=>{const $=R.split("/").filter(Boolean).pop()??"",F=await p($,R);return m(),v(R),D(F)?(x(F.error.path||R),!1):!0};function D(R){return R!=null&&typeof R=="object"&&"error"in R&&R.error!=null&&typeof R.error=="object"&&"code"in R.error&&R.error.code==="EACCES"}const A=O.useCallback(()=>{x(null)},[]),B=O.useCallback(async()=>{if(x(null),k){const R=k.split("/").filter(Boolean).pop()??"",$=await p(R,k);m(),v(k),D($)&&x($.error.path||k)}},[k,p,m,x]);return O.useEffect(()=>{if(k){const R=f.find($=>$.workdir===k);R&&(n(`/p/${R.id}`),t(),v(null))}},[f,k,n,t]),e?u.jsxs(Nt,{isOpen:e,onClose:t,title:"Open Project",size:"xl",footer:u.jsx("div",{className:"flex justify-end gap-2",children:u.jsx(rt,{variant:"secondary",onClick:t,children:"Close"})}),children:[u.jsxs("div",{className:"flex flex-col sm:flex-row flex-1 -m-4",children:[u.jsxs("div",{className:"w-full sm:w-1/2 border-b sm:border-b-0 sm:border-r border-border flex flex-col max-h-[40vh] sm:max-h-[50vh]",children:[u.jsx("div",{className:"p-3 border-b border-border bg-bg-tertiary/30 shrink-0",children:u.jsx("h3",{className:"font-medium text-sm text-text-secondary",children:"Recent Projects"})}),u.jsx("div",{className:"flex-1 overflow-y-auto",children:f.length===0?u.jsxs("div",{className:"p-6 text-center text-text-muted text-sm",children:[u.jsx("p",{className:"mb-2",children:"No recent projects"}),u.jsx("p",{className:"text-xs",children:'Click "Create new project" to add one'})]}):u.jsx("div",{className:"divide-y divide-border",children:f.map(R=>u.jsxs("div",{className:"group flex items-center gap-3 p-3 hover:bg-bg-tertiary/50 transition-colors",children:[u.jsxs("button",{onClick:()=>S(R.id),className:"flex-1 flex items-center gap-3 text-left",children:[u.jsx(Qm,{className:"w-5 h-5 text-accent-primary"}),u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsx("div",{className:"font-medium truncate",children:R.name}),u.jsx("div",{className:"text-xs text-text-muted truncate",children:bS(R.workdir,32)})]})]}),u.jsx("button",{onClick:$=>j(R,$),className:"text-accent-error/70 hover:text-accent-error p-1",title:"Delete project",children:u.jsx(ju,{className:"w-4 h-4"})})]},R.id))})})]}),u.jsx("div",{className:"w-full sm:w-1/2 flex flex-col items-center justify-center p-6 sm:p-8 text-center",children:u.jsxs("div",{className:"flex flex-col gap-3 w-full max-w-sm",children:[u.jsx(rt,{variant:"primary",onClick:()=>h(!0),children:"Select existing project"}),u.jsx(rt,{variant:"secondary",onClick:()=>a(!0),"data-testid":"open-project-create-button",children:"Create new project"})]})})]}),s&&u.jsx(cT,{isOpen:s,onClose:()=>a(!1)}),y&&u.jsx(oT,{isOpen:!0,onClose:()=>w(null),projectName:y.name,onConfirm:N}),l&&u.jsx(wS,{initialPath:o??void 0,onSelect:R=>{T(R).then($=>{$&&h(!1)})},onClose:()=>h(!1)}),b&&u.jsx(SS,{isOpen:!0,onClose:A,path:b,onRetry:B})]}):null}function fT(){const[e,t]=O.useState(!1),n=Ce(m=>m.sessions),s=zt(m=>m.projects),a=zt(m=>m.loading),o=zt(m=>m.listProjects),c=Ce(m=>m.listSessions),l=Ce(m=>m.connectionStatus);O.useEffect(()=>{l==="connected"&&(o(),c())},[l,o,c]);const h=[...s].sort((m,_)=>{const y=n.filter(b=>b.workdir.startsWith(m.workdir)),w=n.filter(b=>b.workdir.startsWith(_.workdir)),k=y.length>0?new Date(y.reduce((b,x)=>new Date(x.updatedAt)>new Date(b.updatedAt)?x:b).updatedAt).getTime():new Date(m.updatedAt).getTime();return(w.length>0?new Date(w.reduce((b,x)=>new Date(x.updatedAt)>new Date(b.updatedAt)?x:b).updatedAt).getTime():new Date(_.updatedAt).getTime())-k}),f=m=>{const _=s.find(y=>y.id===m);return _?n.filter(y=>y.workdir.startsWith(_.workdir)).sort((y,w)=>new Date(w.updatedAt).getTime()-new Date(y.updatedAt).getTime()).slice(0,5):[]},p=()=>{t(!0)};return u.jsxs("div",{className:"flex-1 flex flex-col overflow-y-auto bg-primary",children:[u.jsxs("div",{className:"max-w-5xl mx-auto w-full p-4 md:p-8",children:[u.jsxs("div",{className:"mb-6 md:mb-8 flex items-center justify-between",children:[u.jsxs("div",{children:[u.jsx("h1",{className:"text-3xl font-bold text-accent-primary",children:"OpenFox"}),u.jsx("p",{className:"text-text-secondary",children:"Local LLM-powered coding assistant with contract-driven execution"})]}),u.jsx(rt,{variant:"primary",onClick:p,children:"Open Project"})]}),h.map(m=>{const _=f(m.id);return u.jsx("div",{className:"mb-6 md:mb-8",children:u.jsxs("div",{className:"bg-bg-secondary border border-border rounded-lg overflow-hidden",children:[u.jsxs("div",{className:"p-3 md:p-4 border-b border-border flex items-center justify-between gap-2",children:[u.jsxs(Xn,{href:`/p/${m.id}`,className:"flex items-center gap-2 cursor-pointer hover:opacity-80 transition-opacity flex-1",children:[u.jsx(Qm,{className:"w-5 h-5 text-accent-primary flex-shrink-0"}),u.jsx("span",{className:"text-text-primary font-semibold",children:m.name})]}),u.jsx(Xn,{href:`/p/${m.id}/new`,className:"rounded font-medium transition-colors bg-accent-primary/25 text-text-primary hover:bg-accent-primary/40 px-1.5 py-1 text-xs",children:"+ New Session"})]}),u.jsx("div",{className:"divide-y divide-border",children:_.length>0?_.map(y=>{const w=s.find(v=>y.workdir.startsWith(v.workdir)),k=w?`/p/${w.id}/s/${y.id}`:"#";return u.jsx(Xn,{href:k,className:"block p-3 md:p-4 hover:bg-bg-tertiary/50 cursor-pointer transition-colors",children:u.jsxs("div",{className:"flex items-center justify-between gap-2",children:[u.jsx("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:u.jsx("div",{className:"flex-1 min-w-0",children:u.jsx("div",{className:"text-sm text-text-muted truncate",children:y.title??y.id.slice(0,8)})})}),u.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[u.jsx("span",{className:"text-text-muted text-xs",children:Kj(y.updatedAt)}),u.jsxs("span",{className:"text-text-muted text-xs",children:[y.messageCount," msgs"]})]})]})},y.id)}):u.jsx("div",{className:"p-3 md:p-4 text-text-muted text-sm",children:"No sessions yet"})})]})},m.id)}),h.length===0&&!a&&u.jsx("div",{className:"text-center py-12 text-text-muted",children:"No projects yet. Open a project to get started."}),a&&u.jsx("div",{className:"flex justify-center py-12",children:u.jsx(fl,{})})]}),e&&u.jsx(hT,{isOpen:e,onClose:()=>t(!1)})]})}function mT(){const[,e]=qm("/p/:projectId/new"),[,t]=wr(),n=e==null?void 0:e.projectId,s=Ce(c=>c.createSession),a=Ce(c=>c.resetPendingSessionCreate),o=O.useCallback(async()=>{if(!n)return;const c=await s(n);c?(t(`/p/${n}/s/${c.id}`),a()):(t(`/p/${n}`),a())},[n,s,t,a]);return O.useEffect(()=>{o()},[o]),u.jsx("div",{className:"flex-1 flex items-center justify-center",children:u.jsx(fl,{})})}function pT(){const e=zt(t=>t.currentProject);return u.jsx("div",{className:"h-full flex flex-col items-center justify-center p-8 text-center",children:u.jsxs("div",{className:"max-w-md",children:[u.jsx("h2",{className:"text-xl font-semibold text-text-primary mb-2",children:(e==null?void 0:e.name)??"Project"}),u.jsx("p",{className:"text-text-secondary mb-6",children:"No session selected"}),u.jsxs("div",{className:"flex flex-col gap-3",children:[e&&u.jsx(Xn,{href:`/p/${e.id}/new`,"data-testid":"create-new-session-button",className:"block w-full rounded font-medium transition-colors bg-accent-primary/25 text-text-primary hover:bg-accent-primary/40 px-3 py-2 text-center",children:"Create New Session"}),u.jsx("p",{className:"text-sm text-text-muted",children:"Or select an existing session from the sidebar"})]})]})})}const Bo=e=>Math.round(e*10)/10;function fm(e){return{providerId:e.providerId,providerName:e.providerName,backend:e.backend,model:e.model}}function gT(e){return`${e.providerId}::${e.model}`}function xT(e){return`${e.providerName} > ${e.model}`}function Lv(e){let t=0,n=0,s=0,a=0,o=0,c=0;const l=[],h=[];let f=0;for(const[_,y]of e.entries()){const w=y.stats,k=fm(w);t+=w.totalTime,n+=w.toolTime,s+=w.prefillTokens,a+=w.generationTokens;const v=w.prefillSpeed>0?w.prefillTokens/w.prefillSpeed:0,b=w.generationSpeed>0?w.generationTokens/w.generationSpeed:0;o+=v,c+=b,l.push({messageId:y.id,timestamp:y.timestamp,...k,mode:w.mode,responseIndex:_+1,prefillTokens:w.prefillTokens,generationTokens:w.generationTokens,prefillSpeed:w.prefillSpeed,generationSpeed:w.generationSpeed,totalTime:w.totalTime,aiTime:w.totalTime-w.toolTime,toolTime:w.toolTime});const x=w.llmCalls??[];for(const S of x)f+=1,h.push({messageId:y.id,timestamp:S.timestamp??y.timestamp,providerId:S.providerId,providerName:S.providerName,backend:S.backend,model:S.model,mode:w.mode,responseIndex:_+1,sessionCallIndex:f,callIndex:S.callIndex,promptTokens:S.promptTokens,completionTokens:S.completionTokens,ttft:S.ttft,completionTime:S.completionTime,prefillSpeed:S.prefillSpeed,generationSpeed:S.generationSpeed,totalTime:S.totalTime,...S.temperature!==void 0&&{temperature:S.temperature},...S.topP!==void 0&&{topP:S.topP},...S.topK!==void 0&&{topK:S.topK},...S.maxTokens!==void 0&&{maxTokens:S.maxTokens}})}const p=o>0?Bo(s/o):0,m=c>0?Bo(a/c):0;return{totalTime:Bo(t),aiTime:Bo(t-n),toolTime:Bo(n),prefillTokens:s,generationTokens:a,avgPrefillSpeed:p,avgGenerationSpeed:m,responseCount:e.length,llmCallCount:h.length,dataPoints:l,callDataPoints:h}}function _T(e){const t=e.filter(a=>a.stats!==void 0&&a.stats!==null).sort((a,o)=>new Date(a.timestamp).getTime()-new Date(o.timestamp).getTime());if(t.length===0)return null;const n=new Map;for(const a of t){const o=gT(fm(a.stats)),c=n.get(o)??[];n.set(o,[...c,a])}const s=Array.from(n.entries()).map(([a,o])=>{const c=fm(o[0].stats),l=Lv(o);return{...c,key:a,label:xT(c),...l}});return{...Lv(t),modelGroups:s}}function yT(e){return O.useMemo(()=>_T(e),[e])}function CS(){var a;const e=Ce(o=>o.gitStatus),t=Ce(o=>o.currentSession),[n,s]=O.useState(!0);return O.useEffect(()=>{t!=null&&t.workdir&&s(!1)},[t==null?void 0:t.workdir]),{branch:(e==null?void 0:e.branch)??null,diff:{files:((a=e==null?void 0:e.diff)==null?void 0:a.files)??[],loading:n,error:null}}}function eu(e){return e.toLocaleString("en-US").replace(/,/g," ")}function Rv(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function vT(e){if(e<60)return`${e.toFixed(1)}s`;const t=Math.floor(e/60),n=Math.round(e%60);return`${t}m${n}s`}const Ov=["▁","▂","▃","▄","▅","▆","▇","█"];function bT(e,t,n){if(n===t)return 4;const s=(e-t)/(n-t);return Math.min(7,Math.max(0,Math.round(s*7)))}function ST(e,t){if(e===t){const a=Math.max(Math.abs(e)*.05,1);return{minY:e-a,maxY:t+a}}const n=t-e,s=Math.max(n*.1,.1);return{minY:e-s,maxY:t+s}}function wT(e,t){if(e.length===0||t<=0)return{blocks:"",minX:0,maxX:0,minY:0,maxY:0};const n=[...e].sort((m,_)=>m.x-_.x),s=n[0].x,a=n[n.length-1].x,o=Math.min(...n.map(m=>m.y)),c=Math.max(...n.map(m=>m.y)),{minY:l,maxY:h}=ST(o,c),f=Array.from({length:t},()=>" "),p=new Map;for(const m of n){const _=a===s?0:Math.round((m.x-s)/(a-s)*(t-1)),y=p.get(_)??[];p.set(_,[...y,m.y])}for(const[m,_]of p){const y=Math.max(..._);f[m]=Ov[bT(y,l,h)]??Ov[0]}return{blocks:f.join(""),minX:s,maxX:a,minY:l,maxY:h}}function Mv(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function Iv({data:e,width:t=60,height:n=78,label:s,xLabel:a,yLabel:o,showAxes:c=!0,formatY:l=Mv,formatX:h=Mv}){const f=O.useMemo(()=>{const p=wT(e,t),m=Math.max(t*6,240),_=10,y=8,k=[...e].sort((S,j)=>S.x-j.x).map(S=>{const j=p.maxX===p.minX?m/2:_+(S.x-p.minX)/(p.maxX-p.minX)*(m-_*2),N=p.maxY===p.minY?n/2:y+(p.maxY-S.y)/(p.maxY-p.minY)*(n-y*2);return{...S,cx:j,cy:N,leftPercent:j/m*100,topPercent:N/n*100}}),v=k.map((S,j)=>`${j===0?"M":"L"} ${S.cx.toFixed(1)} ${S.cy.toFixed(1)}`).join(" "),x=[p.maxY,(p.maxY+p.minY)/2,p.minY].map(S=>({value:S,y:p.maxY===p.minY?n/2:y+(p.maxY-S)/(p.maxY-p.minY)*(n-y*2)}));return{...p,chartWidth:m,points:k,path:v,gridLines:x}},[e,n,t]);return e.length===0?u.jsxs("div",{className:"font-mono text-text-muted text-xs",children:[s&&u.jsx("div",{className:"mb-1",children:s}),u.jsx("div",{children:"No data"})]}):u.jsxs("div",{className:"font-mono text-xs",children:[s&&u.jsx("div",{className:"text-text-secondary mb-2",children:s}),u.jsxs("div",{className:"flex gap-3",children:[c&&u.jsx("div",{className:"w-12 h-[78px] flex flex-col justify-between text-right text-text-muted",children:f.gridLines.map(p=>u.jsx("span",{children:l(p.value)},`${p.value}-${p.y}`))}),u.jsx("div",{className:"flex-1 min-w-0",children:u.jsxs("div",{className:"relative h-[78px]",children:[u.jsxs("svg",{viewBox:`0 0 ${f.chartWidth} ${n}`,className:"w-full h-[78px] overflow-visible",preserveAspectRatio:"none","aria-hidden":"true",children:[f.gridLines.map(p=>u.jsx("line",{x1:"0",x2:f.chartWidth,y1:p.y,y2:p.y,stroke:"currentColor",strokeDasharray:"3 4",className:"text-border/60"},`grid-${p.y}`)),f.points.map(p=>u.jsx("line",{x1:p.cx,x2:p.cx,y1:n-4,y2:p.cy,stroke:"currentColor",className:"text-border/40"},`guide-${p.cx}-${p.cy}`)),f.points.length>1&&u.jsx("path",{d:f.path,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-accent-primary/45"})]}),f.points.map(p=>u.jsx("div",{className:"absolute -translate-x-1/2 -translate-y-1/2",style:{left:`${p.leftPercent}%`,top:`${p.topPercent}%`},title:`${h(p.x)} -> ${l(p.y)}`,children:u.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-accent-primary/20 flex items-center justify-center",children:u.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-accent-primary"})})},`point-${p.x}-${p.y}`))]})})]}),c&&u.jsxs("div",{className:"flex items-start gap-3 text-text-muted mt-1",children:[u.jsx("span",{className:"w-12"}),u.jsxs("span",{className:"flex-1 flex justify-between",children:[u.jsx("span",{children:h(f.minX)}),u.jsx("span",{children:a}),u.jsx("span",{children:h(f.maxX)})]})]}),o&&c&&u.jsx("div",{className:"text-text-muted mt-1 text-center",children:o})]})}function CT({data:e,prefillLabel:t="Prefill Speed (tok/s) by Response",generationLabel:n="Generation Speed (tok/s) by Response",xLabel:s="response",width:a=60}){const o=e.map(l=>({x:l.x,y:l.ppSpeed})),c=e.map(l=>({x:l.x,y:l.tgSpeed}));return u.jsxs("div",{className:"space-y-5",children:[u.jsx(Iv,{data:o,width:a,label:t,xLabel:s}),u.jsx(Iv,{data:c,width:a,label:n,xLabel:s})]})}function kT(e){const t=new Map;for(const n of e.callDataPoints){const s=t.get(n.messageId)??[];t.set(n.messageId,[...s,n])}return e.dataPoints.map(n=>{const s=[...t.get(n.messageId)??[]].sort((a,o)=>a.callIndex-o.callIndex);return{...n,callCount:s.length,calls:s,isExpandable:s.length>1}})}function ET(e){return{mode:"responses",xLabel:"response",prefillLabel:"Prefill Speed (tok/s) by Response",generationLabel:"Generation Speed (tok/s) by Response",points:e.dataPoints.map(t=>({x:t.responseIndex,ppSpeed:t.prefillSpeed,tgSpeed:t.generationSpeed}))}}function jT(e){return{mode:"calls",xLabel:"context",prefillLabel:"Prefill Speed (tok/s) vs Context",generationLabel:"Generation Speed (tok/s) vs Context",points:e.callDataPoints.map(t=>({x:t.promptTokens,ppSpeed:t.prefillSpeed,tgSpeed:t.generationSpeed}))}}function TT(e){return e.callDataPoints.length>0?jT(e):ET(e)}function kf(e){if(e<60)return`${e.toFixed(1)}s`;const t=Math.floor(e/60),n=e%60;return`${t}m ${n.toFixed(0)}s`}function wi(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toString()}function qo(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function NT(e){if(e.length===0)return"0 ctx";const t=Math.min(...e),n=Math.max(...e);return t===n?`${wi(t)} ctx`:`${wi(t)}-${wi(n)} ctx`}function tu(e){return`${qo(e)} t/s`}function kS(e){try{return new Date(e).toLocaleTimeString("en-US",{hour12:!1})}catch{return e}}function AT(e){return{exportedAt:new Date().toISOString(),providerId:e.providerId,providerName:e.providerName,backend:e.backend,model:e.model,label:e.label,summary:{totalTime:e.totalTime,aiTime:e.aiTime,toolTime:e.toolTime,prefillTokens:e.prefillTokens,generationTokens:e.generationTokens,avgPrefillSpeed:e.avgPrefillSpeed,avgGenerationSpeed:e.avgGenerationSpeed,responseCount:e.responseCount,llmCallCount:e.llmCallCount},responses:e.dataPoints.map(t=>({responseIndex:t.responseIndex,timestamp:t.timestamp,mode:t.mode,prefillTokens:t.prefillTokens,generationTokens:t.generationTokens,prefillSpeed:t.prefillSpeed,generationSpeed:t.generationSpeed,totalTime:t.totalTime,aiTime:t.aiTime,toolTime:t.toolTime})),llmCalls:e.callDataPoints.map(t=>({sessionCallIndex:t.sessionCallIndex,responseIndex:t.responseIndex,callIndex:t.callIndex,timestamp:t.timestamp,mode:t.mode,promptTokens:t.promptTokens,completionTokens:t.completionTokens,ttft:t.ttft,completionTime:t.completionTime,prefillSpeed:t.prefillSpeed,generationSpeed:t.generationSpeed,totalTime:t.totalTime}))}}function DT({isOpen:e,onClose:t,stats:n}){const s=O.useRef(null),[a,o]=O.useState({}),[c,l]=O.useState(()=>{var w;return((w=n.modelGroups[0])==null?void 0:w.key)??""});O.useEffect(()=>{var w;n.modelGroups.some(k=>k.key===c)||l(((w=n.modelGroups[0])==null?void 0:w.key)??"")},[c,n.modelGroups]);const h=O.useMemo(()=>n.modelGroups.find(w=>w.key===c)??n.modelGroups[0],[c,n.modelGroups]),f=O.useMemo(()=>h?kT(h):[],[h]),p=O.useMemo(()=>h?TT(h):{mode:"responses",xLabel:"response",prefillLabel:"",generationLabel:"",points:[]},[h]),m=O.useCallback(w=>{o(k=>({...k,[w]:!k[w]}))},[]),_=O.useCallback(()=>{if(!h)return;const w=AT(h);navigator.clipboard.writeText(JSON.stringify(w,null,2)).catch(k=>console.error("Failed to copy:",k))},[h]),y=O.useCallback(async()=>{if(s.current)try{const w=(await Q(async()=>{const{default:b}=await import("./html2canvas.esm-QH1iLAAe.js");return{default:b}},[])).default,k=await w(s.current,{backgroundColor:"#1a1a1a",scale:2}),v=document.createElement("a");v.download=`openfox-stats-${new Date().toISOString().slice(0,10)}.png`,v.href=k.toDataURL("image/png"),v.click()}catch(w){console.error("Failed to export PNG:",w),_()}},[_]);return u.jsx(Nt,{isOpen:e,onClose:t,title:"Session Stats",size:"lg",children:u.jsxs("div",{ref:s,className:"space-y-6",children:[u.jsx("section",{children:u.jsx("div",{className:"flex flex-wrap gap-2",children:n.modelGroups.map(w=>u.jsx("button",{onClick:()=>l(w.key),className:`px-3 py-1.5 rounded border text-xs transition-colors ${w.key===(h==null?void 0:h.key)?"border-accent-primary bg-accent-primary/10 text-accent-primary":"border-border text-text-muted hover:text-text-primary hover:bg-bg-tertiary/40"}`,title:w.label,children:w.label},w.key))})}),h&&u.jsxs("section",{children:[u.jsx("h3",{className:"text-sm font-semibold text-text-secondary mb-3 uppercase tracking-wide",children:"Summary"}),u.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-4",children:[u.jsx(ns,{label:"AI Time",value:kf(h.aiTime)}),u.jsx(ns,{label:"Total Time",value:kf(h.totalTime)}),u.jsx(ns,{label:"Tool Time",value:kf(h.toolTime)}),u.jsx(ns,{label:"Responses",value:h.responseCount.toString()}),u.jsx(ns,{label:"LLM Calls",value:h.llmCallCount.toString()})]}),u.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mt-3",children:[u.jsx(ns,{label:"Prefill Tokens",value:wi(h.prefillTokens),subValue:`@ ${qo(h.avgPrefillSpeed)} tok/s`}),u.jsx(ns,{label:"Gen Tokens",value:wi(h.generationTokens),subValue:`@ ${qo(h.avgGenerationSpeed)} tok/s`}),u.jsx(ns,{label:"Avg PP Speed",value:`${qo(h.avgPrefillSpeed)}`,subValue:"tok/s"}),u.jsx(ns,{label:"Avg TG Speed",value:`${qo(h.avgGenerationSpeed)}`,subValue:"tok/s"})]})]}),h&&p.points.length>1&&u.jsxs("section",{children:[u.jsxs("div",{className:"flex items-center justify-between mb-3",children:[u.jsx("h3",{className:"text-sm font-semibold text-text-secondary uppercase tracking-wide",children:"Performance Progression"}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("button",{onClick:_,className:"px-2 py-1 text-xs text-text-muted hover:text-text-primary hover:bg-bg-tertiary rounded transition-colors",children:"Copy JSON"}),u.jsx("button",{onClick:y,className:"px-2 py-1 text-xs text-text-muted hover:text-text-primary hover:bg-bg-tertiary rounded transition-colors",children:"Save PNG"})]})]}),u.jsx("div",{className:"bg-bg-tertiary/50 rounded p-4",children:u.jsx(CT,{data:p.points,width:50,prefillLabel:p.prefillLabel,generationLabel:p.generationLabel,xLabel:p.xLabel})})]}),h&&u.jsxs("section",{children:[u.jsxs("h3",{className:"text-sm font-semibold text-text-secondary mb-3 uppercase tracking-wide",children:["Response Log (",h.responseCount," responses)"]}),u.jsx("div",{className:"overflow-y-auto bg-bg-tertiary/30 rounded",children:u.jsxs("table",{className:"w-full table-fixed border-separate border-spacing-0 text-xs",children:[u.jsxs("colgroup",{children:[u.jsx("col",{className:"w-[7%]"}),u.jsx("col",{className:"w-[14%]"}),u.jsx("col",{className:"w-[10%]"}),u.jsx("col",{className:"w-[14%]"}),u.jsx("col",{className:"w-[14%]"}),u.jsx("col",{className:"w-[14%]"}),u.jsx("col",{className:"w-[11%]"}),u.jsx("col",{className:"w-[2%]"})]}),u.jsx("thead",{children:u.jsxs("tr",{className:"text-[10px] uppercase tracking-wide text-text-muted/80",children:[u.jsx("th",{className:"px-3 py-2 text-center font-medium",children:"#"}),u.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"At"}),u.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"Time"}),u.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"Context"}),u.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"PP t/s"}),u.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"TG t/s"}),u.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"Calls"}),u.jsx("th",{className:"px-2 py-2"})]})}),u.jsx("tbody",{children:f.map((w,k)=>u.jsxs(O.Fragment,{children:[u.jsx(LT,{row:w,index:k,isExpanded:a[w.messageId]??!1,onToggle:w.isExpandable?()=>m(w.messageId):void 0}),(a[w.messageId]??!1)&&w.calls.map((v,b)=>u.jsx(RT,{dataPoint:v,index:b},`${v.messageId}-${v.callIndex}`))]},w.messageId))})]})})]})]})})}function ns({label:e,value:t,subValue:n}){return u.jsxs("div",{className:"bg-bg-tertiary/50 rounded p-3",children:[u.jsx("div",{className:"text-text-muted text-xs mb-1",children:e}),u.jsx("div",{className:"text-text-primary text-lg font-semibold",children:t}),n&&u.jsx("div",{className:"text-text-muted text-xs",children:n})]})}function LT({row:e,index:t,isExpanded:n,onToggle:s}){const a=e.calls.length>0?NT(e.calls.map(o=>o.promptTokens)):`${wi(e.prefillTokens)} ctx`;return u.jsxs("tr",{onClick:s,className:`${t%2===0?"bg-bg-tertiary/20":""} ${s?"cursor-pointer hover:bg-bg-tertiary/35 transition-colors":""}`,children:[u.jsx("td",{className:"px-3 py-2 text-center text-text-muted align-middle",children:e.responseIndex}),u.jsx("td",{className:"px-2 py-2 text-center text-text-muted font-mono align-middle whitespace-nowrap",children:kS(e.timestamp)}),u.jsxs("td",{className:"px-2 py-2 text-center text-text-muted align-middle whitespace-nowrap",children:[e.totalTime.toFixed(1),"s"]}),u.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:a.replace(/ ctx$/,"")}),u.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:tu(e.prefillSpeed)}),u.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:tu(e.generationSpeed)}),u.jsx("td",{className:"px-2 py-2 text-center text-text-muted font-mono align-middle whitespace-nowrap",children:e.callCount}),u.jsx("td",{className:"px-2 py-2 text-center text-text-muted align-middle whitespace-nowrap",children:e.isExpandable?n?"v":">":""})]})}function RT({dataPoint:e,index:t}){const n=e.temperature!==void 0||e.topP!==void 0||e.topK!==void 0||e.maxTokens!==void 0;return u.jsxs(u.Fragment,{children:[u.jsxs("tr",{className:`${t%2===0?"bg-bg-tertiary/10":"bg-bg-tertiary/5"}`,children:[u.jsxs("td",{className:"px-3 py-2 pl-6 text-center text-text-muted align-middle border-l border-border/60",children:["c",e.callIndex]}),u.jsx("td",{className:"px-2 py-2 text-center text-text-muted font-mono align-middle whitespace-nowrap",children:kS(e.timestamp)}),u.jsxs("td",{className:"px-2 py-2 text-center text-text-muted align-middle whitespace-nowrap",children:[e.totalTime.toFixed(1),"s"]}),u.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:wi(e.promptTokens)}),u.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:tu(e.prefillSpeed)}),u.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:tu(e.generationSpeed)}),u.jsx("td",{className:"px-2 py-2 text-center text-text-muted font-mono align-middle whitespace-nowrap",children:e.callIndex}),u.jsx("td",{className:"px-2 py-2"})]}),n&&u.jsx("tr",{className:`${t%2===0?"bg-bg-tertiary/5":"bg-bg-tertiary/[2.5%]"}`,children:u.jsx("td",{colSpan:8,className:"px-6 py-1.5 border-l border-border/60",children:u.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-1 text-[10px] text-text-muted",children:[e.temperature!==void 0&&u.jsxs("span",{children:["temp: ",e.temperature.toFixed(2)]}),e.topP!==void 0&&u.jsxs("span",{children:["topP: ",e.topP.toFixed(2)]}),e.topK!==void 0&&u.jsxs("span",{children:["topK: ",e.topK]}),e.maxTokens!==void 0&&u.jsxs("span",{children:["maxTok: ",e.maxTokens]})]})})})]})}const OT={pending:{icon:"○",color:"text-text-muted",label:"Pending"},in_progress:{icon:"●",color:"text-accent-warning",label:"In Progress",animate:!0},completed:{icon:"◉",color:"text-purple-400",label:"Completed"},passed:{icon:"✓",color:"text-accent-success",label:"Passed"},failed:{icon:"✗",color:"text-accent-error",label:"Failed"}},MT=O.memo(function({criteria:t}){if(t.length===0)return u.jsx("div",{className:"text-text-muted text-sm text-center py-2",children:"No criteria yet"});const n={pending:0,in_progress:0,completed:0,passed:0,failed:0};for(const a of t){const o=a.status.type;o in n&&n[o]++}const s=Object.keys(n).filter(a=>n[a]>0);return u.jsxs("div",{className:"space-y-1",children:[u.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[u.jsx("span",{className:"font-semibold text-text-primary",children:"Total:"}),u.jsx("span",{className:"text-text-secondary",children:t.length})]}),u.jsx("div",{className:"space-y-1",children:s.map(a=>{const o=OT[a];return u.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[u.jsx("span",{className:`${o.color} ${o.animate?"animate-pulse":""} text-sm leading-tight`,children:o.icon}),u.jsxs("span",{className:"text-text-muted",children:[o.label,":"]}),u.jsx("span",{className:"text-text-primary font-medium",children:n[a]})]},a)})})]})});function IT({isOpen:e,onClose:t}){const n=Rr(k=>k.config),s=Rr(k=>k.saveConfig),[a,o]=O.useState(""),[c,l]=O.useState(""),[h,f]=O.useState(!1),[p,m]=O.useState(!1),[_,y]=O.useState(!1);O.useEffect(()=>{e&&(o((n==null?void 0:n.command)??""),l((n==null?void 0:n.url)??""),f((n==null?void 0:n.hotReload)??!1),m((n==null?void 0:n.disableInspect)??!1))},[e,n]);const w=async()=>{!a.trim()||!c.trim()||(y(!0),await s({command:a.trim(),url:c.trim(),hotReload:h,disableInspect:p}),y(!1),t())};return u.jsx(Nt,{isOpen:e,onClose:t,title:"Dev Server Config",size:"sm",children:u.jsxs("div",{className:"space-y-4",children:[u.jsxs("div",{children:[u.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Command"}),u.jsx("input",{className:"input w-full",type:"text",value:a,onChange:k=>o(k.target.value),placeholder:"npm run dev"})]}),u.jsxs("div",{children:[u.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Dev URL"}),u.jsx("input",{className:"input w-full",type:"text",value:c,onChange:k=>l(k.target.value),placeholder:"http://localhost:3000"})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("input",{type:"checkbox",id:"hotReload",checked:h,onChange:k=>f(k.target.checked),className:"rounded border-border bg-bg-tertiary"}),u.jsx("label",{htmlFor:"hotReload",className:"text-xs text-text-secondary",children:"Hot Reload"})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("input",{type:"checkbox",id:"disableInspect",checked:p,onChange:k=>m(k.target.checked),className:"rounded border-border bg-bg-tertiary"}),u.jsx("label",{htmlFor:"disableInspect",className:"text-xs text-text-secondary",children:"Disable inspect feedback"})]}),u.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[u.jsx("button",{className:"btn btn-secondary",onClick:t,children:"Cancel"}),u.jsx("button",{className:"btn btn-primary",onClick:w,disabled:_||!a.trim()||!c.trim(),children:_?"Saving...":"Save"})]})]})})}const Pv={30:"text-black",31:"text-red-400",32:"text-accent-success",33:"text-accent-warning",34:"text-blue-400",35:"text-purple-400",36:"text-cyan-400",37:"text-gray-300",90:"text-gray-500",91:"text-red-500",92:"text-green-500",93:"text-yellow-400",94:"text-blue-500",95:"text-pink-400",96:"text-cyan-500",97:"text-white"},PT={40:"bg-black",41:"bg-red-900",42:"bg-green-900",43:"bg-yellow-900",44:"bg-blue-900",45:"bg-purple-900",46:"bg-cyan-900",47:"bg-gray-700"},Bv={1:"font-bold",2:"opacity-75",4:"underline",7:"bg-bg-secondary"},BT="text-text-primary";function zT(e){const t=[],n=new RegExp("\x1B\\[([0-9;]+)m","g");let s=0,a="text-text-primary",o;try{for(;(o=n.exec(e))!==null;){if(o.index>s){const f=e.slice(s,o.index);f&&t.push({text:f,className:a})}const c=o[1];if(!c)continue;const l=c.split(";").map(Number);if(l.length===0||l[0]===0){a="text-text-primary";continue}const h=[];for(const f of l)if(f>=30&&f<=37){const p=Pv[f];p&&h.push(p)}else if(f>=40&&f<=47){const p=PT[f];p&&h.push(p)}else if(f>=90&&f<=97){const p=Pv[f];p&&h.push(p)}else if(f in Bv){const p=Bv[f];p&&h.push(p)}else f===39?h.push(BT):f===49&&(a=a.split(" ").filter(p=>!p.startsWith("bg-")).join(" "));h.length>0&&(a=h.join(" ")),s=n.lastIndex}if(s<e.length){const c=e.slice(s);c&&t.push({text:c,className:a})}return t}catch(c){return console.warn("ANSI parsing failed, stripping codes:",c),[{text:HT(e),className:"text-text-primary"}]}}function HT(e){return e.replace(new RegExp("\x1B\\[([0-9;]+)m","g"),"")}function nu(e){const t=zT(e),n=[];return t.forEach((s,a)=>{const o=s.text.split(`
88
+ `);o.forEach((c,l)=>{n.push(Hs.createElement("span",{key:`${a}-${l}`,className:s.className,style:{display:"inline-block",whiteSpace:"pre-wrap"}},c)),l<o.length-1&&n.push(Hs.createElement("br",{key:`${a}-${l}-br`}))})}),n.length===1?n[0]:n}function ES({logs:e,preRef:t,preClassName:n="text-sm font-mono"}){return u.jsx("pre",{ref:t,className:n,children:e.length===0?u.jsx("span",{className:"text-text-muted",children:"No output yet"}):e.map((s,a)=>u.jsx("span",{className:s.stream==="stderr"?"text-accent-warning":"",children:nu(s.content)},a))})}const jS=O.memo(function({title:t,logs:n,onClose:s,preClassName:a}){const o=O.useRef(null);return O.useEffect(()=>{o.current&&(o.current.scrollTop=o.current.scrollHeight)},[n]),u.jsx(Nt,{isOpen:!0,onClose:s,title:t,size:"full",children:u.jsx(ES,{logs:n,preRef:o,preClassName:a})})}),$T=O.memo(function({logs:t,anchorRef:n,isHiding:s,onExpand:a,onClose:o}){const[c,l]=O.useState(null),h=O.useRef(null);return O.useEffect(()=>{var p;const f=(p=n.current)==null?void 0:p.getBoundingClientRect();f&&l({bottom:window.innerHeight-f.bottom,right:window.innerWidth-f.right,width:f.width,height:f.height})},[n]),O.useEffect(()=>{h.current&&(h.current.scrollTop=h.current.scrollHeight)},[t]),c?u.jsxs("div",{className:"relative",children:[u.jsx("pre",{ref:h,className:"fixed z-50 text-sm font-mono text-text-primary bg-bg-primary p-2 rounded border border-border overflow-auto transition-all duration-150 ease-out select-text",style:{bottom:c.bottom,right:c.right,width:c.width*2,maxHeight:c.height*3,transformOrigin:"bottom right",transform:s?"scale(0.01)":"scale(1)",opacity:s?0:1},children:t.map((f,p)=>u.jsx("span",{className:f.stream==="stderr"?"text-accent-warning":"",children:nu(f.content)},p))}),u.jsx("button",{onClick:()=>{o(),a()},className:"fixed z-50 px-2 py-1 rounded text-xs font-medium bg-accent-primary/30 text-text-primary hover:bg-accent-primary/50 transition-colors duration-150",style:{bottom:c.bottom+8,right:c.right+8},children:"Expand"})]}):null}),UT=O.memo(function({workdir:t}){const n=Rr(F=>F.setWorkdir),s=Rr(F=>F.status),a=Rr(F=>F.config),o=Rr(F=>F.logs),c=Rr(F=>F.start),l=Rr(F=>F.stop),h=Rr(F=>F.fetchLogs),f=Ce(F=>F.currentSession),[p,m]=O.useState(!1),[_,y]=O.useState(!1),[w,k]=O.useState(!1),[v,b]=O.useState(!1),x=O.useRef(null),S=O.useRef(null),j=O.useRef(null),N=O.useRef(null),T=O.useRef(null),D=()=>{const F=s==null?void 0:s.inspectProxyPort;if(!F){s!=null&&s.url&&window.open(s.url,"_blank");return}const W=`${window.location.protocol}//${window.location.hostname}:${F}`,Y=window.open(W,"_blank");if(Y){T.current=Y;const P=()=>{var J;!T.current||T.current.closed||(T.current.postMessage({type:"setFoxSessionId",sessionId:(f==null?void 0:f.id)??null},"*"),T.current.postMessage({type:"setFoxSessionTitle",sessionTitle:((J=f==null?void 0:f.metadata)==null?void 0:J.title)??null},"*"),T.current.postMessage({type:"setFoxInspectEnabled",enabled:!(a!=null&&a.disableInspect)},"*"))},H=setInterval(()=>{P(),(!T.current||T.current.closed)&&clearInterval(H)},500);setTimeout(()=>clearInterval(H),5e3)}},A=(s==null?void 0:s.state)??"off",B=a!==null,R=A==="running"||A==="warning";O.useEffect(()=>{n(t??null)},[t,n]),O.useEffect(()=>{R&&h()},[R,h]),O.useEffect(()=>{j.current&&R&&(j.current.scrollTop=j.current.scrollHeight)},[o,R]);const $=()=>{R?l():c()};return u.jsxs("div",{className:"mt-2 pt-3 border-t border-border space-y-3",children:[u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("span",{className:`inline-block w-2.5 h-2.5 rounded-full flex-shrink-0 ${A==="running"?"bg-accent-success":A==="warning"?"bg-accent-warning":A==="error"?"bg-accent-error":"bg-text-muted"}`}),u.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:"Dev Server"})]}),u.jsx("button",{onClick:()=>m(!0),className:"p-1.5 rounded hover:bg-bg-tertiary transition-colors text-text-muted",title:"Configure dev server",children:u.jsx(nj,{})})]}),B?u.jsxs(u.Fragment,{children:[A==="running"||A==="warning"?u.jsxs("div",{className:"flex gap-2",children:[u.jsxs("button",{onClick:$,className:"flex-1 flex items-center justify-center gap-1.5 rounded font-medium text-sm px-3 py-1.5 bg-bg-tertiary text-text-primary hover:bg-border transition-colors",children:[u.jsx(nS,{}),"Stop"]}),(s==null?void 0:s.url)&&u.jsxs("button",{onClick:()=>D(),className:"flex-1 flex items-center justify-center gap-1.5 rounded font-medium text-sm px-3 py-1.5 bg-accent-primary/25 text-text-primary hover:bg-accent-primary/40 transition-colors",title:s.url,children:[u.jsx(ij,{}),"Open"]})]}):u.jsx("button",{onClick:$,className:"w-full rounded font-medium text-sm px-3 py-1.5 bg-accent-primary/25 text-text-primary hover:bg-accent-primary/40 transition-colors",children:"Start"}),R&&u.jsxs("div",{ref:N,className:"relative",onMouseEnter:()=>{S.current&&clearTimeout(S.current),x.current=setTimeout(()=>{k(!0),b(!1)},500)},onMouseLeave:()=>{x.current&&clearTimeout(x.current),b(!0),S.current=setTimeout(()=>k(!1),150)},children:[u.jsx(ES,{logs:o,preRef:j,preClassName:"text-sm bg-bg-primary p-2 rounded overflow-auto max-h-[200px] border border-border"}),(w||v)&&N.current&&Pa.createPortal(u.jsx($T,{logs:o,anchorRef:N,isHiding:v,onExpand:()=>y(!0),onClose:()=>k(!1)}),document.body)]})]}):u.jsx("button",{onClick:()=>m(!0),className:"w-full rounded font-medium text-sm px-3 py-1.5 bg-bg-tertiary text-text-muted hover:bg-border transition-colors",children:"Configure"}),u.jsx(IT,{isOpen:p,onClose:()=>m(!1)}),_&&u.jsx(jS,{title:"Dev Server Logs",logs:o,onClose:()=>y(!1)})]})}),FT=O.memo(function({sessionId:t}){var y;const n=Yo(w=>w.processes),s=Yo(w=>w.stopProcess),[a,o]=O.useState(null),[c,l]=O.useState([]),h=n.filter(w=>w.status!=="exited"),f=h.filter(w=>w.status==="running").length;if(n.length===0)return null;const p=w=>{switch(w){case"running":return"bg-accent-success";case"starting":return"bg-accent-warning";case"stopping":return"bg-accent-warning";case"exited":return"bg-text-muted";default:return"bg-text-muted"}},m=w=>{const k=Yo.getState().logs[w]??[];l(k.map(v=>({content:v.content,stream:v.stream}))),o(w)},_=w=>{t&&s(w,t)};return u.jsxs("div",{className:"mt-2 pt-3 border-t border-border space-y-3",children:[u.jsx("div",{className:"flex items-center justify-between",children:u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("span",{className:"inline-block w-2.5 h-2.5 rounded-full flex-shrink-0 bg-accent-primary"}),u.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:"Background"}),u.jsxs("span",{className:"text-xs text-text-muted",children:["(",f," running)"]})]})}),u.jsx("div",{className:"space-y-2",children:h.map(w=>u.jsx("div",{className:"border border-border rounded p-2",children:u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[u.jsx("span",{className:`inline-block w-2 h-2 rounded-full flex-shrink-0 ${p(w.status)}`}),u.jsx("span",{className:"text-sm text-text-primary truncate",title:w.name,children:w.name}),u.jsxs("span",{className:"text-xs text-text-muted",children:["[",w.status,"]"]})]}),u.jsxs("div",{className:"flex gap-1 ml-2",children:[u.jsx("button",{onClick:()=>m(w.id),className:"px-2 py-1 text-xs rounded bg-bg-tertiary hover:bg-border text-text-secondary transition-colors",title:"View logs",children:"Logs"}),u.jsx("button",{onClick:()=>_(w.id),className:"px-2 py-1 text-xs rounded bg-bg-tertiary hover:bg-accent-error/20 text-text-secondary hover:text-accent-error transition-colors",title:"Stop process",children:"Stop"})]})]})},w.id))}),a&&u.jsx(jS,{title:((y=h.find(w=>w.id===a))==null?void 0:y.name)??"",logs:c,onClose:()=>{o(null),l([])}})]})});function VT({isOpen:e,onClose:t,versionInfo:n}){const[s,a]=O.useState("ready"),[o,c]=O.useState(""),[l,h]=O.useState(n);O.useEffect(()=>{if(e){if(n){h(n);return}fetch("/api/auto-update/check").then(p=>p.json()).then(p=>h({current:p.current,latest:p.latest})).catch(()=>{})}},[e]),O.useEffect(()=>{if(!e||s!=="updating")return;const p=setInterval(()=>{c(m=>m.length>=3?"":m+".")},400);return()=>clearInterval(p)},[e,s]);const f=O.useCallback(async()=>{a("updating");const p=(l==null?void 0:l.current)==="1.0.0"&&(l==null?void 0:l.latest)==="1.1.0";if(await je("/api/auto-update",{method:"POST"}),p){setTimeout(()=>{a("reloading"),localStorage.setItem("openfox_updated_to",(l==null?void 0:l.latest)??"unknown"),localStorage.setItem("update_pending","true"),setTimeout(()=>window.location.reload(),1e3)},5e3);return}let m=!1,_=!1;const y=setInterval(async()=>{try{(await fetch("/api/health")).ok&&m&&(_=!0,clearInterval(y),a("reloading"),localStorage.setItem("openfox_updated_to",(l==null?void 0:l.latest)??"unknown"),localStorage.setItem("update_pending","true"),window.location.reload())}catch{m=!0}},2e3);setTimeout(()=>{_||clearInterval(y)},3e5)},[l==null?void 0:l.current,l==null?void 0:l.latest]);return O.useEffect(()=>{e&&(a("ready"),c(""))},[e]),u.jsxs(Nt,{isOpen:e,onClose:s==="updating"?void 0:t,title:"New OpenFox Version Available",size:"sm",closeOnBackdropClick:s!=="updating",showCloseButton:s!=="updating",children:[u.jsxs("div",{className:"flex flex-col gap-4",children:[l&&u.jsxs("div",{className:"flex justify-between text-sm",children:[u.jsx("span",{className:"text-text-muted",children:"Current version"}),u.jsx("span",{className:"text-text-primary font-mono",children:l.current})]}),l&&u.jsxs("div",{className:"flex justify-between text-sm pb-2",children:[u.jsx("span",{className:"text-text-muted",children:"Latest version"}),u.jsx("span",{className:"text-accent-primary font-mono font-semibold",children:l.latest})]}),s==="updating"&&u.jsxs("div",{className:"flex flex-col gap-2 mt-2",children:[u.jsx("div",{className:"h-1.5 bg-bg-tertiary rounded-full overflow-hidden",children:u.jsx("div",{className:"h-full bg-accent-primary animate-pulse w-full"})}),u.jsxs("p",{className:"text-xs text-text-muted text-center",children:["Updating",o]})]}),s==="reloading"&&u.jsxs("div",{className:"flex flex-col gap-2 mt-2",children:[u.jsx("div",{className:"h-1.5 bg-bg-tertiary rounded-full overflow-hidden",children:u.jsx("div",{className:"h-full bg-accent-primary animate-pulse w-full"})}),u.jsxs("p",{className:"text-xs text-text-muted text-center",children:["Update complete, reloading",o]})]})]}),s==="ready"&&u.jsx("button",{onClick:f,className:"w-full px-3 py-2 text-sm rounded bg-accent-primary hover:brightness-110 transition-all text-white font-medium",children:"Update OpenFox"}),s==="ready"&&u.jsx("div",{className:"flex justify-center mt-2",children:u.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 bg-accent-warning/10 border border-accent-warning/30 rounded text-xs",children:[u.jsx("span",{children:"⚠️"}),u.jsx("p",{className:"text-text-secondary",children:"Server will restart to apply this update. Sessions in progress will be interrupted."})]})})]})}function GT({file:e}){const t=bS(e.path,28),n=e.status==="added"?"text-accent-success":e.status==="deleted"?"text-accent-error":"text-accent-primary",s=e.status==="added"?`+${e.additions}`:e.status==="deleted"?`-${e.deletions}`:e.additions>0||e.deletions>0?`+${e.additions}, -${e.deletions}`:"";return u.jsxs("div",{className:"flex items-center justify-between gap-1 py-0.5 text-xs min-w-0",children:[u.jsx("span",{className:`truncate ${n}`,title:e.path,children:t}),s&&u.jsx("span",{className:`shrink-0 font-mono${e.status==="added"?" text-accent-success":e.status==="deleted"?" text-accent-error":" text-text-muted"}`,children:s})]})}function WT(){const{diff:e}=CS();return e.loading?u.jsx("div",{className:"mt-3",children:u.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-text-muted",children:[u.jsx("span",{className:"w-3 h-3 border border-border border-t-accent-primary rounded-full animate-spin"}),u.jsx("span",{children:"Checking changes..."})]})}):e.files.length===0?u.jsx("div",{className:"mt-3",children:u.jsx("p",{className:"text-xs text-text-muted text-center",children:"No changes"})}):u.jsx("div",{className:"mt-3 max-h-[150px] overflow-y-auto",children:u.jsx("div",{className:"pr-1",children:e.files.map((t,n)=>u.jsx(GT,{file:t},n))})})}function zv({summary:e,messages:t,workdir:n}){const[s,a]=O.useState(!1),[o,c]=O.useState(!1),[l,h]=O.useState(!1),[f,p]=O.useState(!1),m=yT(t),{branch:_}=CS(),y=Lt(v=>v.version),w=Ce(v=>v.currentSession),k=O.useCallback(async()=>{c(!0);try{const v=await fetch("/api/auto-update/check");if(v.ok){const b=await v.json();h(b.isUpdateAvailable)}}catch{}finally{c(!1)}},[]);return O.useEffect(()=>{k()},[k]),O.useEffect(()=>{if(new URLSearchParams(window.location.search).get("test-update")==="1"){h(!0),p(!0);const b=new URL(window.location.href);b.searchParams.delete("test-update"),window.history.replaceState({},"",b.toString())}},[]),u.jsxs("div",{className:"flex flex-col h-full",children:[m&&u.jsxs("div",{className:"mb-4",children:[u.jsx("button",{onClick:()=>a(!0),className:"w-full flex items-center justify-center px-3 py-2 rounded bg-bg-tertiary hover:bg-bg-secondary transition-colors",title:"View detailed response and call-level stats",children:u.jsxs("div",{className:"flex items-center gap-2 text-sm text-text-muted",children:[u.jsx("span",{className:"text-text-secondary",children:vT(m.aiTime)}),u.jsx("span",{className:"w-px h-3 bg-border"}),u.jsx("span",{className:"text-text-secondary",children:Rv(m.avgPrefillSpeed)}),u.jsx("span",{children:"pp"}),u.jsx("span",{className:"w-px h-3 bg-border"}),u.jsx("span",{className:"text-text-secondary",children:Rv(m.avgGenerationSpeed)}),u.jsx("span",{children:"tg"})]})}),u.jsx(DT,{isOpen:s,onClose:()=>a(!1),stats:m})]}),u.jsxs("div",{className:"flex flex-col flex-1 overflow-y-auto",children:[u.jsx("div",{className:"flex items-center justify-between mb-2",children:u.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:"Summary"})}),e?u.jsx("p",{className:"text-sm text-text-primary leading-relaxed",children:e}):u.jsx("div",{className:"text-text-muted text-sm text-center py-2",children:"No summary yet"}),u.jsxs("div",{className:"mt-4",children:[u.jsx("h3",{className:"text-sm font-semibold text-text-primary mb-2",children:"Progress"}),u.jsx(MT,{criteria:(w==null?void 0:w.criteria)??[]})]})]}),_&&u.jsxs("div",{className:"mt-4 flex items-center gap-2 text-sm",children:[u.jsx(Q2,{}),u.jsx("span",{className:"truncate text-text-secondary",title:_,children:_})]}),u.jsx(WT,{}),u.jsx(UT,{workdir:n}),u.jsx(FT,{sessionId:w==null?void 0:w.id}),y&&u.jsxs("div",{className:"mt-4 pt-4 border-t border-border text-center text-xs text-text-muted",children:[u.jsxs("div",{className:"flex items-center justify-center gap-1",children:[u.jsx("a",{href:"https://github.com/co-l/openfox",target:"_blank",rel:"noopener noreferrer",className:"hover:text-accent-primary transition-colors",children:"OpenFox"})," - ",u.jsxs("span",{className:"font-mono",children:["v",y]}),u.jsx("button",{onClick:()=>k(),disabled:o,className:"p-0.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors disabled:opacity-50",title:"Check for updates",children:u.jsx(tS,{className:`w-3 h-3 ${o?"animate-spin":""}`})})]}),l&&u.jsx("button",{onClick:()=>p(!0),className:"text-accent-primary hover:underline mt-1",children:"Update OpenFox →"})]}),u.jsx(VT,{isOpen:f,onClose:()=>p(!1),versionInfo:null})]})}function qT({children:e,criteriaSidebarOpen:t=!0,onCriteriaSidebarToggle:n,messages:s}){const a=Ce(o=>o.currentSession);return u.jsxs("div",{className:"relative h-full overflow-hidden",children:[t&&u.jsx("div",{className:"fixed md:hidden inset-0 bg-secondary/50 z-40",onClick:n}),u.jsxs("div",{className:"flex h-full",children:[u.jsx("div",{className:"flex-1 min-w-0 flex flex-col overflow-hidden bg-secondary",children:e}),t?u.jsx("aside",{className:"hidden md:block w-[320px] shrink-0 border-l border-border p-4 overflow-y-auto bg-secondary",children:u.jsx(zv,{summary:(a==null?void 0:a.summary)??null,messages:s,workdir:a==null?void 0:a.workdir})}):u.jsx("aside",{className:"hidden md:block w-0 shrink-0 overflow-hidden border-l-0"}),u.jsx("aside",{className:`
89
+ md:hidden
90
+ p-4 overflow-y-auto bg-secondary
91
+ transition-all duration-300 ease-in-out
92
+ fixed right-0 top-[32px] h-[calc(100vh-32px)] z-50
93
+ ${t?"w-[320px] translate-x-0 border-l border-border":"w-[320px] translate-x-full"}
94
+ `,children:u.jsx(zv,{summary:(a==null?void 0:a.summary)??null,messages:s,workdir:a==null?void 0:a.workdir})})]})]})}function KT(e,t){return t||e>85?"bg-accent-error":e>60?"bg-accent-warning":"bg-accent-success"}function TS({percent:e,dangerZone:t=!1,size:n="md",className:s=""}){const a=n==="sm"?"w-12":"w-20",o=n==="sm"?"h-1":"h-1.5";return u.jsx("div",{className:`${o} bg-bg-tertiary rounded-full overflow-hidden ${a} ${s}`,children:u.jsx("div",{className:`h-full transition-all duration-300 ${KT(e,t)}`,style:{width:`${Math.min(e,100)}%`}})})}function YT({dangerZone:e,size:t="md"}){return e?u.jsx("span",{className:"text-accent-error animate-pulse text-[10px] font-medium",children:"Low!"}):null}function Hv(e,t){return t||e>85?"text-accent-error":e>60?"text-accent-warning":"text-text-muted"}function XT(){const e=Ce(m=>m.contextState),t=Ce(m=>m.currentSession),n=Ce(m=>m.compactContext),[s,a]=O.useState(!1);if(!e||!t)return null;const{currentTokens:o,maxTokens:c,compactionCount:l,dangerZone:h}=e,f=Math.round(o/c*100),p=t.isRunning;return u.jsx("div",{className:"flex-shrink-0 px-4 py-1.5 border-b border-border bg-secondary",children:u.jsxs("div",{className:"flex items-center justify-between gap-4",children:[u.jsx("div",{className:"flex-1"}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsxs("span",{className:Hv(f,h),children:[eu(o)," / ",eu(c)]}),u.jsxs("span",{className:Hv(f,h),children:["(",f,"%)"]}),u.jsx(TS,{percent:f,dangerZone:h}),u.jsx(YT,{dangerZone:h}),l>0&&u.jsxs("span",{className:"text-[10px] text-text-muted bg-bg-tertiary px-1 py-0.5 rounded",children:[l,"x"]})]}),u.jsx("div",{className:"flex-1 flex justify-end",children:u.jsxs("div",{className:"relative",children:[u.jsx("button",{onClick:()=>a(!s),className:"p-1 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"More options",children:u.jsx(eS,{})}),s&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>a(!1)}),u.jsx("div",{className:"absolute right-0 top-full mt-1.5 z-50 bg-bg-secondary border border-border rounded-lg shadow-xl py-1 min-w-[160px]",children:u.jsx("button",{onClick:()=>{p||n(),a(!1)},disabled:p,className:"w-full px-3 py-1.5 text-left text-sm hover:bg-bg-tertiary transition-colors disabled:opacity-40 disabled:cursor-not-allowed",title:p?"Cannot compact while running":"Compact context",children:u.jsx("span",{className:h?"text-accent-error":"",children:"Compact"})})})]})]})})]})})}function QT({stats:e,onClose:t}){var n;return u.jsx(Nt,{isOpen:!0,onClose:t,title:"Turn Stats",size:"md",children:u.jsxs("div",{className:"space-y-4",children:[u.jsx("div",{className:"flex items-center gap-3",children:u.jsxs("p",{className:"text-xs text-text-muted",children:[e.model," · ",e.mode]})}),u.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[u.jsx(Ic,{label:"Total Time",value:`${e.totalTime.toFixed(1)}s`}),u.jsx(Ic,{label:"Prefill",value:e.prefillTokens>=1e3?`${(e.prefillTokens/1e3).toFixed(1)}k`:String(e.prefillTokens)}),u.jsx(Ic,{label:"Generated",value:e.generationTokens>=1e3?`${(e.generationTokens/1e3).toFixed(1)}k`:String(e.generationTokens)}),u.jsx(Ic,{label:"LLM Calls",value:String(((n=e.llmCalls)==null?void 0:n.length)??1)})]}),e.llmCalls&&e.llmCalls.length>0&&u.jsxs("div",{children:[u.jsx("h4",{className:"text-sm font-medium text-text-secondary mb-2",children:"LLM Calls"}),e.llmCalls.map((s,a)=>u.jsxs("div",{className:"bg-bg-tertiary/30 rounded p-3 mb-2",children:[u.jsxs("div",{className:"flex items-center justify-between mb-2",children:[u.jsxs("span",{className:"text-xs text-text-muted",children:["Call ",a+1]}),u.jsxs("span",{className:"text-xs text-text-muted",children:[s.ttft.toFixed(2),"s TTFT · ",s.completionTime.toFixed(2),"s gen"]})]}),u.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[u.jsxs("div",{children:[u.jsx("span",{className:"text-text-muted",children:"Tokens:"})," ",u.jsxs("span",{className:"text-text-primary",children:[s.promptTokens," → ",s.completionTokens]})]}),u.jsxs("div",{className:"flex flex-wrap gap-x-2 gap-y-1",children:[s.temperature!==void 0&&u.jsx(Pc,{label:"temp",value:s.temperature.toFixed(2)}),s.topP!==void 0&&u.jsx(Pc,{label:"topP",value:s.topP.toFixed(2)}),s.topK!==void 0&&u.jsx(Pc,{label:"topK",value:String(s.topK)}),s.maxTokens!==void 0&&u.jsx(Pc,{label:"maxTok",value:String(s.maxTokens)})]})]})]},a))]})]})})}function Ic({label:e,value:t}){return u.jsxs("div",{className:"bg-bg-tertiary/50 rounded p-3",children:[u.jsx("div",{className:"text-xs text-text-muted",children:e}),u.jsx("div",{className:"text-lg font-semibold text-text-primary",children:t})]})}function Pc({label:e,value:t}){return u.jsxs("span",{className:"bg-bg-tertiary px-1.5 py-0.5 rounded text-text-primary",children:[u.jsxs("span",{className:"text-text-muted",children:[e,":"]})," ",t]})}const Rt=Jn((e,t)=>({defaults:[],userItems:[],projectItems:[],activeWorkflowId:"default",loading:!1,templateVariables:[],fetchTemplateVariables:async()=>{try{const s=await(await je("/api/workflows/template-variables")).json();e({templateVariables:s.variables??[]})}catch{}},fetchWorkflows:async()=>{e({loading:!0});try{const s=await(await je("/api/workflows")).json();e({defaults:s.defaults??[],userItems:s.userItems??[],projectItems:s.projectItems??[],activeWorkflowId:s.activeWorkflowId??"default",loading:!1})}catch{e({loading:!1})}},fetchWorkflow:async n=>{try{const s=await je(`/api/workflows/${n}`);return s.ok?await s.json():null}catch{return null}},fetchDefaultContent:async n=>{try{const s=await je(`/api/workflows/defaults/${n}`);return s.ok?await s.json():null}catch{return null}},createWorkflow:async(n,s)=>{const a=await Vs("POST","/api/workflows",{...n,destination:s});return a.success&&await t().fetchWorkflows(),a},updateWorkflow:async(n,s)=>{const a=await Vs("PUT",`/api/workflows/${n}`,s);return a.success&&await t().fetchWorkflows(),a},deleteWorkflow:async n=>{try{const s=await je(`/api/workflows/${n}`,{method:"DELETE"}),a=await s.json();return s.ok?(e(o=>({userItems:o.userItems.filter(c=>c.id!==n)})),{success:!0}):{success:!1,error:a.error??"Failed to delete"}}catch{return{success:!1,error:"Network error"}}},duplicateWorkflow:async(n,s)=>ku(`/api/workflows/${n}/duplicate`,()=>t().fetchWorkflows(),s)}));function JT(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const ZT=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,eN=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,tN={};function $v(e,t){return(tN.jsx?eN:ZT).test(e)}const nN=/[ \t\n\f\r]/g;function rN(e){return typeof e=="object"?e.type==="text"?Uv(e.value):!1:Uv(e)}function Uv(e){return e.replace(nN,"")===""}let ml=class{constructor(t,n,s){this.normal=n,this.property=t,s&&(this.space=s)}};ml.prototype.normal={};ml.prototype.property={};ml.prototype.space=void 0;function NS(e,t){const n={},s={};for(const a of e)Object.assign(n,a.property),Object.assign(s,a.normal);return new ml(n,s,t)}function mm(e){return e.toLowerCase()}let Bn=class{constructor(t,n){this.attribute=n,this.property=t}};Bn.prototype.attribute="";Bn.prototype.booleanish=!1;Bn.prototype.boolean=!1;Bn.prototype.commaOrSpaceSeparated=!1;Bn.prototype.commaSeparated=!1;Bn.prototype.defined=!1;Bn.prototype.mustUseProperty=!1;Bn.prototype.number=!1;Bn.prototype.overloadedBoolean=!1;Bn.prototype.property="";Bn.prototype.spaceSeparated=!1;Bn.prototype.space=void 0;let sN=0;const tt=ji(),Zt=ji(),pm=ji(),ke=ji(),Et=ji(),Ta=ji(),Kn=ji();function ji(){return 2**++sN}const gm=Object.freeze(Object.defineProperty({__proto__:null,boolean:tt,booleanish:Zt,commaOrSpaceSeparated:Kn,commaSeparated:Ta,number:ke,overloadedBoolean:pm,spaceSeparated:Et},Symbol.toStringTag,{value:"Module"})),Ef=Object.keys(gm);let lp=class extends Bn{constructor(t,n,s,a){let o=-1;if(super(t,n),Fv(this,"space",a),typeof s=="number")for(;++o<Ef.length;){const c=Ef[o];Fv(this,Ef[o],(s&gm[c])===gm[c])}}};lp.prototype.defined=!0;function Fv(e,t,n){n&&(e[t]=n)}function Ba(e){const t={},n={};for(const[s,a]of Object.entries(e.properties)){const o=new lp(s,e.transform(e.attributes||{},s),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(o.mustUseProperty=!0),t[s]=o,n[mm(s)]=s,n[mm(o.attribute)]=s}return new ml(t,n,e.space)}const AS=Ba({properties:{ariaActiveDescendant:null,ariaAtomic:Zt,ariaAutoComplete:null,ariaBusy:Zt,ariaChecked:Zt,ariaColCount:ke,ariaColIndex:ke,ariaColSpan:ke,ariaControls:Et,ariaCurrent:null,ariaDescribedBy:Et,ariaDetails:null,ariaDisabled:Zt,ariaDropEffect:Et,ariaErrorMessage:null,ariaExpanded:Zt,ariaFlowTo:Et,ariaGrabbed:Zt,ariaHasPopup:null,ariaHidden:Zt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Et,ariaLevel:ke,ariaLive:null,ariaModal:Zt,ariaMultiLine:Zt,ariaMultiSelectable:Zt,ariaOrientation:null,ariaOwns:Et,ariaPlaceholder:null,ariaPosInSet:ke,ariaPressed:Zt,ariaReadOnly:Zt,ariaRelevant:null,ariaRequired:Zt,ariaRoleDescription:Et,ariaRowCount:ke,ariaRowIndex:ke,ariaRowSpan:ke,ariaSelected:Zt,ariaSetSize:ke,ariaSort:null,ariaValueMax:ke,ariaValueMin:ke,ariaValueNow:ke,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function DS(e,t){return t in e?e[t]:t}function LS(e,t){return DS(e,t.toLowerCase())}const iN=Ba({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ta,acceptCharset:Et,accessKey:Et,action:null,allow:null,allowFullScreen:tt,allowPaymentRequest:tt,allowUserMedia:tt,alt:null,as:null,async:tt,autoCapitalize:null,autoComplete:Et,autoFocus:tt,autoPlay:tt,blocking:Et,capture:null,charSet:null,checked:tt,cite:null,className:Et,cols:ke,colSpan:null,content:null,contentEditable:Zt,controls:tt,controlsList:Et,coords:ke|Ta,crossOrigin:null,data:null,dateTime:null,decoding:null,default:tt,defer:tt,dir:null,dirName:null,disabled:tt,download:pm,draggable:Zt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:tt,formTarget:null,headers:Et,height:ke,hidden:pm,high:ke,href:null,hrefLang:null,htmlFor:Et,httpEquiv:Et,id:null,imageSizes:null,imageSrcSet:null,inert:tt,inputMode:null,integrity:null,is:null,isMap:tt,itemId:null,itemProp:Et,itemRef:Et,itemScope:tt,itemType:Et,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:tt,low:ke,manifest:null,max:null,maxLength:ke,media:null,method:null,min:null,minLength:ke,multiple:tt,muted:tt,name:null,nonce:null,noModule:tt,noValidate:tt,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:tt,optimum:ke,pattern:null,ping:Et,placeholder:null,playsInline:tt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:tt,referrerPolicy:null,rel:Et,required:tt,reversed:tt,rows:ke,rowSpan:ke,sandbox:Et,scope:null,scoped:tt,seamless:tt,selected:tt,shadowRootClonable:tt,shadowRootDelegatesFocus:tt,shadowRootMode:null,shape:null,size:ke,sizes:null,slot:null,span:ke,spellCheck:Zt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ke,step:null,style:null,tabIndex:ke,target:null,title:null,translate:null,type:null,typeMustMatch:tt,useMap:null,value:Zt,width:ke,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Et,axis:null,background:null,bgColor:null,border:ke,borderColor:null,bottomMargin:ke,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:tt,declare:tt,event:null,face:null,frame:null,frameBorder:null,hSpace:ke,leftMargin:ke,link:null,longDesc:null,lowSrc:null,marginHeight:ke,marginWidth:ke,noResize:tt,noHref:tt,noShade:tt,noWrap:tt,object:null,profile:null,prompt:null,rev:null,rightMargin:ke,rules:null,scheme:null,scrolling:Zt,standby:null,summary:null,text:null,topMargin:ke,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ke,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:tt,disableRemotePlayback:tt,prefix:null,property:null,results:ke,security:null,unselectable:null},space:"html",transform:LS}),aN=Ba({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:Kn,accentHeight:ke,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ke,amplitude:ke,arabicForm:null,ascent:ke,attributeName:null,attributeType:null,azimuth:ke,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ke,by:null,calcMode:null,capHeight:ke,className:Et,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:ke,diffuseConstant:ke,direction:null,display:null,dur:null,divisor:ke,dominantBaseline:null,download:tt,dx:null,dy:null,edgeMode:null,editable:null,elevation:ke,enableBackground:null,end:null,event:null,exponent:ke,externalResourcesRequired:null,fill:null,fillOpacity:ke,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:Ta,g2:Ta,glyphName:Ta,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ke,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ke,horizOriginX:ke,horizOriginY:ke,id:null,ideographic:ke,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ke,k:ke,k1:ke,k2:ke,k3:ke,k4:ke,kernelMatrix:Kn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ke,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:ke,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:ke,overlineThickness:ke,paintOrder:null,panose1:null,path:null,pathLength:ke,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Et,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ke,pointsAtY:ke,pointsAtZ:ke,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Kn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Kn,rev:Kn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Kn,requiredFeatures:Kn,requiredFonts:Kn,requiredFormats:Kn,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:ke,specularExponent:ke,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ke,strikethroughThickness:ke,string:null,stroke:null,strokeDashArray:Kn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ke,strokeOpacity:ke,strokeWidth:null,style:null,surfaceScale:ke,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Kn,tabIndex:ke,tableValues:null,target:null,targetX:ke,targetY:ke,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Kn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ke,underlineThickness:ke,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ke,values:null,vAlphabetic:ke,vMathematical:ke,vectorEffect:null,vHanging:ke,vIdeographic:ke,version:null,vertAdvY:ke,vertOriginX:ke,vertOriginY:ke,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ke,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:DS}),RS=Ba({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),OS=Ba({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:LS}),MS=Ba({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),oN={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},lN=/[A-Z]/g,Vv=/-[a-z]/g,cN=/^data[-\w.:]+$/i;function uN(e,t){const n=mm(t);let s=t,a=Bn;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&cN.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(Vv,hN);s="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!Vv.test(o)){let c=o.replace(lN,dN);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}a=lp}return new a(s,t)}function dN(e){return"-"+e.toLowerCase()}function hN(e){return e.charAt(1).toUpperCase()}const fN=NS([AS,iN,RS,OS,MS],"html"),cp=NS([AS,aN,RS,OS,MS],"svg");function mN(e){return e.join(" ").trim()}var ga={},jf,Gv;function pN(){if(Gv)return jf;Gv=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g,h=`
95
+ `,f="/",p="*",m="",_="comment",y="declaration";function w(v,b){if(typeof v!="string")throw new TypeError("First argument must be a string");if(!v)return[];b=b||{};var x=1,S=1;function j(Y){var P=Y.match(t);P&&(x+=P.length);var H=Y.lastIndexOf(h);S=~H?Y.length-H:S+Y.length}function N(){var Y={line:x,column:S};return function(P){return P.position=new T(Y),B(),P}}function T(Y){this.start=Y,this.end={line:x,column:S},this.source=b.source}T.prototype.content=v;function D(Y){var P=new Error(b.source+":"+x+":"+S+": "+Y);if(P.reason=Y,P.filename=b.source,P.line=x,P.column=S,P.source=v,!b.silent)throw P}function A(Y){var P=Y.exec(v);if(P){var H=P[0];return j(H),v=v.slice(H.length),P}}function B(){A(n)}function R(Y){var P;for(Y=Y||[];P=$();)P!==!1&&Y.push(P);return Y}function $(){var Y=N();if(!(f!=v.charAt(0)||p!=v.charAt(1))){for(var P=2;m!=v.charAt(P)&&(p!=v.charAt(P)||f!=v.charAt(P+1));)++P;if(P+=2,m===v.charAt(P-1))return D("End of comment missing");var H=v.slice(2,P-2);return S+=2,j(H),v=v.slice(P),S+=2,Y({type:_,comment:H})}}function F(){var Y=N(),P=A(s);if(P){if($(),!A(a))return D("property missing ':'");var H=A(o),J=Y({type:y,property:k(P[0].replace(e,m)),value:H?k(H[0].replace(e,m)):m});return A(c),J}}function W(){var Y=[];R(Y);for(var P;P=F();)P!==!1&&(Y.push(P),R(Y));return Y}return B(),W()}function k(v){return v?v.replace(l,m):m}return jf=w,jf}var Wv;function gN(){if(Wv)return ga;Wv=1;var e=ga&&ga.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(ga,"__esModule",{value:!0}),ga.default=n;const t=e(pN());function n(s,a){let o=null;if(!s||typeof s!="string")return o;const c=(0,t.default)(s),l=typeof a=="function";return c.forEach(h=>{if(h.type!=="declaration")return;const{property:f,value:p}=h;l?a(f,p,h):p&&(o=o||{},o[f]=p)}),o}return ga}var zo={},qv;function xN(){if(qv)return zo;qv=1,Object.defineProperty(zo,"__esModule",{value:!0}),zo.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(f){return!f||n.test(f)||e.test(f)},c=function(f,p){return p.toUpperCase()},l=function(f,p){return"".concat(p,"-")},h=function(f,p){return p===void 0&&(p={}),o(f)?f:(f=f.toLowerCase(),p.reactCompat?f=f.replace(a,l):f=f.replace(s,l),f.replace(t,c))};return zo.camelCase=h,zo}var Ho,Kv;function _N(){if(Kv)return Ho;Kv=1;var e=Ho&&Ho.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(gN()),n=xN();function s(a,o){var c={};return!a||typeof a!="string"||(0,t.default)(a,function(l,h){l&&h&&(c[(0,n.camelCase)(l,o)]=h)}),c}return s.default=s,Ho=s,Ho}var yN=_N();const vN=bu(yN),IS=PS("end"),up=PS("start");function PS(e){return t;function t(n){const s=n&&n.position&&n.position[e]||{};if(typeof s.line=="number"&&s.line>0&&typeof s.column=="number"&&s.column>0)return{line:s.line,column:s.column,offset:typeof s.offset=="number"&&s.offset>-1?s.offset:void 0}}}function bN(e){const t=up(e),n=IS(e);if(t&&n)return{start:t,end:n}}function Xo(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Yv(e.position):"start"in e||"end"in e?Yv(e):"line"in e||"column"in e?xm(e):""}function xm(e){return Xv(e&&e.line)+":"+Xv(e&&e.column)}function Yv(e){return xm(e&&e.start)+"-"+xm(e&&e.end)}function Xv(e){return e&&typeof e=="number"?e:1}class En extends Error{constructor(t,n,s){super(),typeof n=="string"&&(s=n,n=void 0);let a="",o={},c=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?a=t:!o.cause&&t&&(c=!0,a=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof s=="string"){const h=s.indexOf(":");h===-1?o.ruleId=s:(o.source=s.slice(0,h),o.ruleId=s.slice(h+1))}if(!o.place&&o.ancestors&&o.ancestors){const h=o.ancestors[o.ancestors.length-1];h&&(o.place=h.position)}const l=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=l?l.line:void 0,this.name=Xo(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=c&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}En.prototype.file="";En.prototype.name="";En.prototype.reason="";En.prototype.message="";En.prototype.stack="";En.prototype.column=void 0;En.prototype.line=void 0;En.prototype.ancestors=void 0;En.prototype.cause=void 0;En.prototype.fatal=void 0;En.prototype.place=void 0;En.prototype.ruleId=void 0;En.prototype.source=void 0;const dp={}.hasOwnProperty,SN=new Map,wN=/[A-Z]/g,CN=new Set(["table","tbody","thead","tfoot","tr"]),kN=new Set(["td","th"]),BS="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function EN(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let s;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");s=ON(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");s=RN(n,t.jsx,t.jsxs)}const a={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:s,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?cp:fN,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=zS(a,e,void 0);return o&&typeof o!="string"?o:a.create(e,a.Fragment,{children:o||void 0},void 0)}function zS(e,t,n){if(t.type==="element")return jN(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return TN(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return AN(e,t,n);if(t.type==="mdxjsEsm")return NN(e,t);if(t.type==="root")return DN(e,t,n);if(t.type==="text")return LN(e,t)}function jN(e,t,n){const s=e.schema;let a=s;t.tagName.toLowerCase()==="svg"&&s.space==="html"&&(a=cp,e.schema=a),e.ancestors.push(t);const o=$S(e,t.tagName,!1),c=MN(e,t);let l=fp(e,t);return CN.has(t.tagName)&&(l=l.filter(function(h){return typeof h=="string"?!rN(h):!0})),HS(e,c,o,t),hp(c,l),e.ancestors.pop(),e.schema=s,e.create(t,o,c,n)}function TN(e,t){if(t.data&&t.data.estree&&e.evaluater){const s=t.data.estree.body[0];return s.type,e.evaluater.evaluateExpression(s.expression)}nl(e,t.position)}function NN(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);nl(e,t.position)}function AN(e,t,n){const s=e.schema;let a=s;t.name==="svg"&&s.space==="html"&&(a=cp,e.schema=a),e.ancestors.push(t);const o=t.name===null?e.Fragment:$S(e,t.name,!0),c=IN(e,t),l=fp(e,t);return HS(e,c,o,t),hp(c,l),e.ancestors.pop(),e.schema=s,e.create(t,o,c,n)}function DN(e,t,n){const s={};return hp(s,fp(e,t)),e.create(t,e.Fragment,s,n)}function LN(e,t){return t.value}function HS(e,t,n,s){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=s)}function hp(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function RN(e,t,n){return s;function s(a,o,c,l){const f=Array.isArray(c.children)?n:t;return l?f(o,c,l):f(o,c)}}function ON(e,t){return n;function n(s,a,o,c){const l=Array.isArray(o.children),h=up(s);return t(a,o,c,l,{columnNumber:h?h.column-1:void 0,fileName:e,lineNumber:h?h.line:void 0},void 0)}}function MN(e,t){const n={};let s,a;for(a in t.properties)if(a!=="children"&&dp.call(t.properties,a)){const o=PN(e,a,t.properties[a]);if(o){const[c,l]=o;e.tableCellAlignToStyle&&c==="align"&&typeof l=="string"&&kN.has(t.tagName)?s=l:n[c]=l}}if(s){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return n}function IN(e,t){const n={};for(const s of t.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const o=s.data.estree.body[0];o.type;const c=o.expression;c.type;const l=c.properties[0];l.type,Object.assign(n,e.evaluater.evaluateExpression(l.argument))}else nl(e,t.position);else{const a=s.name;let o;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&e.evaluater){const l=s.value.data.estree.body[0];l.type,o=e.evaluater.evaluateExpression(l.expression)}else nl(e,t.position);else o=s.value===null?!0:s.value;n[a]=o}return n}function fp(e,t){const n=[];let s=-1;const a=e.passKeys?new Map:SN;for(;++s<t.children.length;){const o=t.children[s];let c;if(e.passKeys){const h=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(h){const f=a.get(h)||0;c=h+"-"+f,a.set(h,f+1)}}const l=zS(e,o,c);l!==void 0&&n.push(l)}return n}function PN(e,t,n){const s=uN(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=s.commaSeparated?JT(n):mN(n)),s.property==="style"){let a=typeof n=="object"?n:BN(e,String(n));return e.stylePropertyNameCase==="css"&&(a=zN(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&s.space?oN[s.property]||s.property:s.attribute,n]}}function BN(e,t){try{return vN(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const s=n,a=new En("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=BS+"#cannot-parse-style-attribute",a}}function $S(e,t,n){let s;if(!n)s={type:"Literal",value:t};else if(t.includes(".")){const a=t.split(".");let o=-1,c;for(;++o<a.length;){const l=$v(a[o])?{type:"Identifier",name:a[o]}:{type:"Literal",value:a[o]};c=c?{type:"MemberExpression",object:c,property:l,computed:!!(o&&l.type==="Literal"),optional:!1}:l}s=c}else s=$v(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(s.type==="Literal"){const a=s.value;return dp.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(s);nl(e)}function nl(e,t){const n=new En("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=BS+"#cannot-handle-mdx-estrees-without-createevaluater",n}function zN(e){const t={};let n;for(n in e)dp.call(e,n)&&(t[HN(n)]=e[n]);return t}function HN(e){let t=e.replace(wN,$N);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function $N(e){return"-"+e.toLowerCase()}const Tf={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},UN={};function mp(e,t){const n=UN,s=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return US(e,s,a)}function US(e,t,n){if(FN(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Qv(e.children,t,n)}return Array.isArray(e)?Qv(e,t,n):""}function Qv(e,t,n){const s=[];let a=-1;for(;++a<e.length;)s[a]=US(e[a],t,n);return s.join("")}function FN(e){return!!(e&&typeof e=="object")}const Jv=document.createElement("i");function pp(e){const t="&"+e+";";Jv.innerHTML=t;const n=Jv.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Qn(e,t,n,s){const a=e.length;let o=0,c;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,n=n>0?n:0,s.length<1e4)c=Array.from(s),c.unshift(t,n),e.splice(...c);else for(n&&e.splice(t,n);o<s.length;)c=s.slice(o,o+1e4),c.unshift(t,0),e.splice(...c),o+=1e4,t+=1e4}function ur(e,t){return e.length>0?(Qn(e,e.length,0,t),e):t}const Zv={}.hasOwnProperty;function FS(e){const t={};let n=-1;for(;++n<e.length;)VN(t,e[n]);return t}function VN(e,t){let n;for(n in t){const a=(Zv.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let c;if(o)for(c in o){Zv.call(a,c)||(a[c]=[]);const l=o[c];GN(a[c],Array.isArray(l)?l:l?[l]:[])}}}function GN(e,t){let n=-1;const s=[];for(;++n<t.length;)(t[n].add==="after"?e:s).push(t[n]);Qn(e,0,0,s)}function VS(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function br(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Nn=Gs(/[A-Za-z]/),kn=Gs(/[\dA-Za-z]/),WN=Gs(/[#-'*+\--9=?A-Z^-~]/);function ru(e){return e!==null&&(e<32||e===127)}const _m=Gs(/\d/),qN=Gs(/[\dA-Fa-f]/),KN=Gs(/[!-/:-@[-`{-~]/);function Ue(e){return e!==null&&e<-2}function kt(e){return e!==null&&(e<0||e===32)}function ot(e){return e===-2||e===-1||e===32}const Lu=Gs(new RegExp("\\p{P}|\\p{S}","u")),ki=Gs(/\s/);function Gs(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function za(e){const t=[];let n=-1,s=0,a=0;for(;++n<e.length;){const o=e.charCodeAt(n);let c="";if(o===37&&kn(e.charCodeAt(n+1))&&kn(e.charCodeAt(n+2)))a=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(c=String.fromCharCode(o));else if(o>55295&&o<57344){const l=e.charCodeAt(n+1);o<56320&&l>56319&&l<57344?(c=String.fromCharCode(o,l),a=1):c="�"}else c=String.fromCharCode(o);c&&(t.push(e.slice(s,n),encodeURIComponent(c)),s=n+a+1,c=""),a&&(n+=a,a=0)}return t.join("")+e.slice(s)}function mt(e,t,n,s){const a=s?s-1:Number.POSITIVE_INFINITY;let o=0;return c;function c(h){return ot(h)?(e.enter(n),l(h)):t(h)}function l(h){return ot(h)&&o++<a?(e.consume(h),l):(e.exit(n),t(h))}}const YN={tokenize:XN};function XN(e){const t=e.attempt(this.parser.constructs.contentInitial,s,a);let n;return t;function s(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),mt(e,t,"linePrefix")}function a(l){return e.enter("paragraph"),o(l)}function o(l){const h=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=h),n=h,c(l)}function c(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return Ue(l)?(e.consume(l),e.exit("chunkText"),o):(e.consume(l),c)}}const QN={tokenize:JN},eb={tokenize:ZN};function JN(e){const t=this,n=[];let s=0,a,o,c;return l;function l(S){if(s<n.length){const j=n[s];return t.containerState=j[1],e.attempt(j[0].continuation,h,f)(S)}return f(S)}function h(S){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&x();const j=t.events.length;let N=j,T;for(;N--;)if(t.events[N][0]==="exit"&&t.events[N][1].type==="chunkFlow"){T=t.events[N][1].end;break}b(s);let D=j;for(;D<t.events.length;)t.events[D][1].end={...T},D++;return Qn(t.events,N+1,0,t.events.slice(j)),t.events.length=D,f(S)}return l(S)}function f(S){if(s===n.length){if(!a)return _(S);if(a.currentConstruct&&a.currentConstruct.concrete)return w(S);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(eb,p,m)(S)}function p(S){return a&&x(),b(s),_(S)}function m(S){return t.parser.lazy[t.now().line]=s!==n.length,c=t.now().offset,w(S)}function _(S){return t.containerState={},e.attempt(eb,y,w)(S)}function y(S){return s++,n.push([t.currentConstruct,t.containerState]),_(S)}function w(S){if(S===null){a&&x(),b(0),e.consume(S);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:o}),k(S)}function k(S){if(S===null){v(e.exit("chunkFlow"),!0),b(0),e.consume(S);return}return Ue(S)?(e.consume(S),v(e.exit("chunkFlow")),s=0,t.interrupt=void 0,l):(e.consume(S),k)}function v(S,j){const N=t.sliceStream(S);if(j&&N.push(null),S.previous=o,o&&(o.next=S),o=S,a.defineSkip(S.start),a.write(N),t.parser.lazy[S.start.line]){let T=a.events.length;for(;T--;)if(a.events[T][1].start.offset<c&&(!a.events[T][1].end||a.events[T][1].end.offset>c))return;const D=t.events.length;let A=D,B,R;for(;A--;)if(t.events[A][0]==="exit"&&t.events[A][1].type==="chunkFlow"){if(B){R=t.events[A][1].end;break}B=!0}for(b(s),T=D;T<t.events.length;)t.events[T][1].end={...R},T++;Qn(t.events,A+1,0,t.events.slice(D)),t.events.length=T}}function b(S){let j=n.length;for(;j-- >S;){const N=n[j];t.containerState=N[1],N[0].exit.call(t,e)}n.length=S}function x(){a.write([null]),o=void 0,a=void 0,t.containerState._closeFlow=void 0}}function ZN(e,t,n){return mt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ra(e){if(e===null||kt(e)||ki(e))return 1;if(Lu(e))return 2}function Ru(e,t,n){const s=[];let a=-1;for(;++a<e.length;){const o=e[a].resolveAll;o&&!s.includes(o)&&(t=o(t,n),s.push(o))}return t}const ym={name:"attention",resolveAll:eA,tokenize:tA};function eA(e,t){let n=-1,s,a,o,c,l,h,f,p;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(s=n;s--;)if(e[s][0]==="exit"&&e[s][1].type==="attentionSequence"&&e[s][1]._open&&t.sliceSerialize(e[s][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[s][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[s][1].end.offset-e[s][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;h=e[s][1].end.offset-e[s][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const m={...e[s][1].end},_={...e[n][1].start};tb(m,-h),tb(_,h),c={type:h>1?"strongSequence":"emphasisSequence",start:m,end:{...e[s][1].end}},l={type:h>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:_},o={type:h>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[n][1].start}},a={type:h>1?"strong":"emphasis",start:{...c.start},end:{...l.end}},e[s][1].end={...c.start},e[n][1].start={...l.end},f=[],e[s][1].end.offset-e[s][1].start.offset&&(f=ur(f,[["enter",e[s][1],t],["exit",e[s][1],t]])),f=ur(f,[["enter",a,t],["enter",c,t],["exit",c,t],["enter",o,t]]),f=ur(f,Ru(t.parser.constructs.insideSpan.null,e.slice(s+1,n),t)),f=ur(f,[["exit",o,t],["enter",l,t],["exit",l,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(p=2,f=ur(f,[["enter",e[n][1],t],["exit",e[n][1],t]])):p=0,Qn(e,s-1,n-s+3,f),n=s+f.length-p-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function tA(e,t){const n=this.parser.constructs.attentionMarkers.null,s=this.previous,a=Ra(s);let o;return c;function c(h){return o=h,e.enter("attentionSequence"),l(h)}function l(h){if(h===o)return e.consume(h),l;const f=e.exit("attentionSequence"),p=Ra(h),m=!p||p===2&&a||n.includes(h),_=!a||a===2&&p||n.includes(s);return f._open=!!(o===42?m:m&&(a||!_)),f._close=!!(o===42?_:_&&(p||!m)),t(h)}}function tb(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const nA={name:"autolink",tokenize:rA};function rA(e,t,n){let s=0;return a;function a(y){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(y){return Nn(y)?(e.consume(y),c):y===64?n(y):f(y)}function c(y){return y===43||y===45||y===46||kn(y)?(s=1,l(y)):f(y)}function l(y){return y===58?(e.consume(y),s=0,h):(y===43||y===45||y===46||kn(y))&&s++<32?(e.consume(y),l):(s=0,f(y))}function h(y){return y===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):y===null||y===32||y===60||ru(y)?n(y):(e.consume(y),h)}function f(y){return y===64?(e.consume(y),p):WN(y)?(e.consume(y),f):n(y)}function p(y){return kn(y)?m(y):n(y)}function m(y){return y===46?(e.consume(y),s=0,p):y===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):_(y)}function _(y){if((y===45||kn(y))&&s++<63){const w=y===45?_:m;return e.consume(y),w}return n(y)}}const pl={partial:!0,tokenize:sA};function sA(e,t,n){return s;function s(o){return ot(o)?mt(e,a,"linePrefix")(o):a(o)}function a(o){return o===null||Ue(o)?t(o):n(o)}}const GS={continuation:{tokenize:aA},exit:oA,name:"blockQuote",tokenize:iA};function iA(e,t,n){const s=this;return a;function a(c){if(c===62){const l=s.containerState;return l.open||(e.enter("blockQuote",{_container:!0}),l.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(c),e.exit("blockQuoteMarker"),o}return n(c)}function o(c){return ot(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(c))}}function aA(e,t,n){const s=this;return a;function a(c){return ot(c)?mt(e,o,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):o(c)}function o(c){return e.attempt(GS,t,n)(c)}}function oA(e){e.exit("blockQuote")}const WS={name:"characterEscape",tokenize:lA};function lA(e,t,n){return s;function s(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),a}function a(o){return KN(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const qS={name:"characterReference",tokenize:cA};function cA(e,t,n){const s=this;let a=0,o,c;return l;function l(m){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),h}function h(m){return m===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(m),e.exit("characterReferenceMarkerNumeric"),f):(e.enter("characterReferenceValue"),o=31,c=kn,p(m))}function f(m){return m===88||m===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(m),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,c=qN,p):(e.enter("characterReferenceValue"),o=7,c=_m,p(m))}function p(m){if(m===59&&a){const _=e.exit("characterReferenceValue");return c===kn&&!pp(s.sliceSerialize(_))?n(m):(e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return c(m)&&a++<o?(e.consume(m),p):n(m)}}const nb={partial:!0,tokenize:dA},rb={concrete:!0,name:"codeFenced",tokenize:uA};function uA(e,t,n){const s=this,a={partial:!0,tokenize:N};let o=0,c=0,l;return h;function h(T){return f(T)}function f(T){const D=s.events[s.events.length-1];return o=D&&D[1].type==="linePrefix"?D[2].sliceSerialize(D[1],!0).length:0,l=T,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),p(T)}function p(T){return T===l?(c++,e.consume(T),p):c<3?n(T):(e.exit("codeFencedFenceSequence"),ot(T)?mt(e,m,"whitespace")(T):m(T))}function m(T){return T===null||Ue(T)?(e.exit("codeFencedFence"),s.interrupt?t(T):e.check(nb,k,j)(T)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),_(T))}function _(T){return T===null||Ue(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),m(T)):ot(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),mt(e,y,"whitespace")(T)):T===96&&T===l?n(T):(e.consume(T),_)}function y(T){return T===null||Ue(T)?m(T):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),w(T))}function w(T){return T===null||Ue(T)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),m(T)):T===96&&T===l?n(T):(e.consume(T),w)}function k(T){return e.attempt(a,j,v)(T)}function v(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),b}function b(T){return o>0&&ot(T)?mt(e,x,"linePrefix",o+1)(T):x(T)}function x(T){return T===null||Ue(T)?e.check(nb,k,j)(T):(e.enter("codeFlowValue"),S(T))}function S(T){return T===null||Ue(T)?(e.exit("codeFlowValue"),x(T)):(e.consume(T),S)}function j(T){return e.exit("codeFenced"),t(T)}function N(T,D,A){let B=0;return R;function R(P){return T.enter("lineEnding"),T.consume(P),T.exit("lineEnding"),$}function $(P){return T.enter("codeFencedFence"),ot(P)?mt(T,F,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):F(P)}function F(P){return P===l?(T.enter("codeFencedFenceSequence"),W(P)):A(P)}function W(P){return P===l?(B++,T.consume(P),W):B>=c?(T.exit("codeFencedFenceSequence"),ot(P)?mt(T,Y,"whitespace")(P):Y(P)):A(P)}function Y(P){return P===null||Ue(P)?(T.exit("codeFencedFence"),D(P)):A(P)}}}function dA(e,t,n){const s=this;return a;function a(c){return c===null?n(c):(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),o)}function o(c){return s.parser.lazy[s.now().line]?n(c):t(c)}}const Nf={name:"codeIndented",tokenize:fA},hA={partial:!0,tokenize:mA};function fA(e,t,n){const s=this;return a;function a(f){return e.enter("codeIndented"),mt(e,o,"linePrefix",5)(f)}function o(f){const p=s.events[s.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?c(f):n(f)}function c(f){return f===null?h(f):Ue(f)?e.attempt(hA,c,h)(f):(e.enter("codeFlowValue"),l(f))}function l(f){return f===null||Ue(f)?(e.exit("codeFlowValue"),c(f)):(e.consume(f),l)}function h(f){return e.exit("codeIndented"),t(f)}}function mA(e,t,n){const s=this;return a;function a(c){return s.parser.lazy[s.now().line]?n(c):Ue(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),a):mt(e,o,"linePrefix",5)(c)}function o(c){const l=s.events[s.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(c):Ue(c)?a(c):n(c)}}const pA={name:"codeText",previous:xA,resolve:gA,tokenize:_A};function gA(e){let t=e.length-4,n=3,s,a;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(s=n;++s<t;)if(e[s][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(s=n-1,t++;++s<=t;)a===void 0?s!==t&&e[s][1].type!=="lineEnding"&&(a=s):(s===t||e[s][1].type==="lineEnding")&&(e[a][1].type="codeTextData",s!==a+2&&(e[a][1].end=e[s-1][1].end,e.splice(a+2,s-a-2),t-=s-a-2,s=a+2),a=void 0);return e}function xA(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function _A(e,t,n){let s=0,a,o;return c;function c(m){return e.enter("codeText"),e.enter("codeTextSequence"),l(m)}function l(m){return m===96?(e.consume(m),s++,l):(e.exit("codeTextSequence"),h(m))}function h(m){return m===null?n(m):m===32?(e.enter("space"),e.consume(m),e.exit("space"),h):m===96?(o=e.enter("codeTextSequence"),a=0,p(m)):Ue(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),h):(e.enter("codeTextData"),f(m))}function f(m){return m===null||m===32||m===96||Ue(m)?(e.exit("codeTextData"),h(m)):(e.consume(m),f)}function p(m){return m===96?(e.consume(m),a++,p):a===s?(e.exit("codeTextSequence"),e.exit("codeText"),t(m)):(o.type="codeTextData",f(m))}}class yA{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const s=n??Number.POSITIVE_INFINITY;return s<this.left.length?this.left.slice(t,s):t>this.left.length?this.right.slice(this.right.length-s+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(t,n,s){const a=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return s&&$o(this.left,s),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),$o(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),$o(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);$o(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);$o(this.left,n.reverse())}}}function $o(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function KS(e){const t={};let n=-1,s,a,o,c,l,h,f;const p=new yA(e);for(;++n<p.length;){for(;n in t;)n=t[n];if(s=p.get(n),n&&s[1].type==="chunkFlow"&&p.get(n-1)[1].type==="listItemPrefix"&&(h=s[1]._tokenizer.events,o=0,o<h.length&&h[o][1].type==="lineEndingBlank"&&(o+=2),o<h.length&&h[o][1].type==="content"))for(;++o<h.length&&h[o][1].type!=="content";)h[o][1].type==="chunkText"&&(h[o][1]._isInFirstContentOfListItem=!0,o++);if(s[0]==="enter")s[1].contentType&&(Object.assign(t,vA(p,n)),n=t[n],f=!0);else if(s[1]._container){for(o=n,a=void 0;o--;)if(c=p.get(o),c[1].type==="lineEnding"||c[1].type==="lineEndingBlank")c[0]==="enter"&&(a&&(p.get(a)[1].type="lineEndingBlank"),c[1].type="lineEnding",a=o);else if(!(c[1].type==="linePrefix"||c[1].type==="listItemIndent"))break;a&&(s[1].end={...p.get(a)[1].start},l=p.slice(a,n),l.unshift(s),p.splice(a,n-a+1,l))}}return Qn(e,0,Number.POSITIVE_INFINITY,p.slice(0)),!f}function vA(e,t){const n=e.get(t)[1],s=e.get(t)[2];let a=t-1;const o=[];let c=n._tokenizer;c||(c=s.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(c._contentTypeTextTrailing=!0));const l=c.events,h=[],f={};let p,m,_=-1,y=n,w=0,k=0;const v=[k];for(;y;){for(;e.get(++a)[1]!==y;);o.push(a),y._tokenizer||(p=s.sliceStream(y),y.next||p.push(null),m&&c.defineSkip(y.start),y._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(p),y._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),m=y,y=y.next}for(y=n;++_<l.length;)l[_][0]==="exit"&&l[_-1][0]==="enter"&&l[_][1].type===l[_-1][1].type&&l[_][1].start.line!==l[_][1].end.line&&(k=_+1,v.push(k),y._tokenizer=void 0,y.previous=void 0,y=y.next);for(c.events=[],y?(y._tokenizer=void 0,y.previous=void 0):v.pop(),_=v.length;_--;){const b=l.slice(v[_],v[_+1]),x=o.pop();h.push([x,x+b.length-1]),e.splice(x,2,b)}for(h.reverse(),_=-1;++_<h.length;)f[w+h[_][0]]=w+h[_][1],w+=h[_][1]-h[_][0]-1;return f}const bA={resolve:wA,tokenize:CA},SA={partial:!0,tokenize:kA};function wA(e){return KS(e),e}function CA(e,t){let n;return s;function s(l){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(l)}function a(l){return l===null?o(l):Ue(l)?e.check(SA,c,o)(l):(e.consume(l),a)}function o(l){return e.exit("chunkContent"),e.exit("content"),t(l)}function c(l){return e.consume(l),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,a}}function kA(e,t,n){const s=this;return a;function a(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),mt(e,o,"linePrefix")}function o(c){if(c===null||Ue(c))return n(c);const l=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(c):e.interrupt(s.parser.constructs.flow,n,t)(c)}}function YS(e,t,n,s,a,o,c,l,h){const f=h||Number.POSITIVE_INFINITY;let p=0;return m;function m(b){return b===60?(e.enter(s),e.enter(a),e.enter(o),e.consume(b),e.exit(o),_):b===null||b===32||b===41||ru(b)?n(b):(e.enter(s),e.enter(c),e.enter(l),e.enter("chunkString",{contentType:"string"}),k(b))}function _(b){return b===62?(e.enter(o),e.consume(b),e.exit(o),e.exit(a),e.exit(s),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),y(b))}function y(b){return b===62?(e.exit("chunkString"),e.exit(l),_(b)):b===null||b===60||Ue(b)?n(b):(e.consume(b),b===92?w:y)}function w(b){return b===60||b===62||b===92?(e.consume(b),y):y(b)}function k(b){return!p&&(b===null||b===41||kt(b))?(e.exit("chunkString"),e.exit(l),e.exit(c),e.exit(s),t(b)):p<f&&b===40?(e.consume(b),p++,k):b===41?(e.consume(b),p--,k):b===null||b===32||b===40||ru(b)?n(b):(e.consume(b),b===92?v:k)}function v(b){return b===40||b===41||b===92?(e.consume(b),k):k(b)}}function XS(e,t,n,s,a,o){const c=this;let l=0,h;return f;function f(y){return e.enter(s),e.enter(a),e.consume(y),e.exit(a),e.enter(o),p}function p(y){return l>999||y===null||y===91||y===93&&!h||y===94&&!l&&"_hiddenFootnoteSupport"in c.parser.constructs?n(y):y===93?(e.exit(o),e.enter(a),e.consume(y),e.exit(a),e.exit(s),t):Ue(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),p):(e.enter("chunkString",{contentType:"string"}),m(y))}function m(y){return y===null||y===91||y===93||Ue(y)||l++>999?(e.exit("chunkString"),p(y)):(e.consume(y),h||(h=!ot(y)),y===92?_:m)}function _(y){return y===91||y===92||y===93?(e.consume(y),l++,m):m(y)}}function QS(e,t,n,s,a,o){let c;return l;function l(_){return _===34||_===39||_===40?(e.enter(s),e.enter(a),e.consume(_),e.exit(a),c=_===40?41:_,h):n(_)}function h(_){return _===c?(e.enter(a),e.consume(_),e.exit(a),e.exit(s),t):(e.enter(o),f(_))}function f(_){return _===c?(e.exit(o),h(c)):_===null?n(_):Ue(_)?(e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),mt(e,f,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),p(_))}function p(_){return _===c||_===null||Ue(_)?(e.exit("chunkString"),f(_)):(e.consume(_),_===92?m:p)}function m(_){return _===c||_===92?(e.consume(_),p):p(_)}}function Qo(e,t){let n;return s;function s(a){return Ue(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,s):ot(a)?mt(e,s,n?"linePrefix":"lineSuffix")(a):t(a)}}const EA={name:"definition",tokenize:TA},jA={partial:!0,tokenize:NA};function TA(e,t,n){const s=this;let a;return o;function o(y){return e.enter("definition"),c(y)}function c(y){return XS.call(s,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(y)}function l(y){return a=br(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),y===58?(e.enter("definitionMarker"),e.consume(y),e.exit("definitionMarker"),h):n(y)}function h(y){return kt(y)?Qo(e,f)(y):f(y)}function f(y){return YS(e,p,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(y)}function p(y){return e.attempt(jA,m,m)(y)}function m(y){return ot(y)?mt(e,_,"whitespace")(y):_(y)}function _(y){return y===null||Ue(y)?(e.exit("definition"),s.parser.defined.push(a),t(y)):n(y)}}function NA(e,t,n){return s;function s(l){return kt(l)?Qo(e,a)(l):n(l)}function a(l){return QS(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function o(l){return ot(l)?mt(e,c,"whitespace")(l):c(l)}function c(l){return l===null||Ue(l)?t(l):n(l)}}const AA={name:"hardBreakEscape",tokenize:DA};function DA(e,t,n){return s;function s(o){return e.enter("hardBreakEscape"),e.consume(o),a}function a(o){return Ue(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const LA={name:"headingAtx",resolve:RA,tokenize:OA};function RA(e,t){let n=e.length-2,s=3,a,o;return e[s][1].type==="whitespace"&&(s+=2),n-2>s&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(s===n-1||n-4>s&&e[n-2][1].type==="whitespace")&&(n-=s+1===n?2:4),n>s&&(a={type:"atxHeadingText",start:e[s][1].start,end:e[n][1].end},o={type:"chunkText",start:e[s][1].start,end:e[n][1].end,contentType:"text"},Qn(e,s,n-s+1,[["enter",a,t],["enter",o,t],["exit",o,t],["exit",a,t]])),e}function OA(e,t,n){let s=0;return a;function a(p){return e.enter("atxHeading"),o(p)}function o(p){return e.enter("atxHeadingSequence"),c(p)}function c(p){return p===35&&s++<6?(e.consume(p),c):p===null||kt(p)?(e.exit("atxHeadingSequence"),l(p)):n(p)}function l(p){return p===35?(e.enter("atxHeadingSequence"),h(p)):p===null||Ue(p)?(e.exit("atxHeading"),t(p)):ot(p)?mt(e,l,"whitespace")(p):(e.enter("atxHeadingText"),f(p))}function h(p){return p===35?(e.consume(p),h):(e.exit("atxHeadingSequence"),l(p))}function f(p){return p===null||p===35||kt(p)?(e.exit("atxHeadingText"),l(p)):(e.consume(p),f)}}const MA=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],sb=["pre","script","style","textarea"],IA={concrete:!0,name:"htmlFlow",resolveTo:zA,tokenize:HA},PA={partial:!0,tokenize:UA},BA={partial:!0,tokenize:$A};function zA(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function HA(e,t,n){const s=this;let a,o,c,l,h;return f;function f(U){return p(U)}function p(U){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(U),m}function m(U){return U===33?(e.consume(U),_):U===47?(e.consume(U),o=!0,k):U===63?(e.consume(U),a=3,s.interrupt?t:L):Nn(U)?(e.consume(U),c=String.fromCharCode(U),v):n(U)}function _(U){return U===45?(e.consume(U),a=2,y):U===91?(e.consume(U),a=5,l=0,w):Nn(U)?(e.consume(U),a=4,s.interrupt?t:L):n(U)}function y(U){return U===45?(e.consume(U),s.interrupt?t:L):n(U)}function w(U){const ee="CDATA[";return U===ee.charCodeAt(l++)?(e.consume(U),l===ee.length?s.interrupt?t:F:w):n(U)}function k(U){return Nn(U)?(e.consume(U),c=String.fromCharCode(U),v):n(U)}function v(U){if(U===null||U===47||U===62||kt(U)){const ee=U===47,Z=c.toLowerCase();return!ee&&!o&&sb.includes(Z)?(a=1,s.interrupt?t(U):F(U)):MA.includes(c.toLowerCase())?(a=6,ee?(e.consume(U),b):s.interrupt?t(U):F(U)):(a=7,s.interrupt&&!s.parser.lazy[s.now().line]?n(U):o?x(U):S(U))}return U===45||kn(U)?(e.consume(U),c+=String.fromCharCode(U),v):n(U)}function b(U){return U===62?(e.consume(U),s.interrupt?t:F):n(U)}function x(U){return ot(U)?(e.consume(U),x):R(U)}function S(U){return U===47?(e.consume(U),R):U===58||U===95||Nn(U)?(e.consume(U),j):ot(U)?(e.consume(U),S):R(U)}function j(U){return U===45||U===46||U===58||U===95||kn(U)?(e.consume(U),j):N(U)}function N(U){return U===61?(e.consume(U),T):ot(U)?(e.consume(U),N):S(U)}function T(U){return U===null||U===60||U===61||U===62||U===96?n(U):U===34||U===39?(e.consume(U),h=U,D):ot(U)?(e.consume(U),T):A(U)}function D(U){return U===h?(e.consume(U),h=null,B):U===null||Ue(U)?n(U):(e.consume(U),D)}function A(U){return U===null||U===34||U===39||U===47||U===60||U===61||U===62||U===96||kt(U)?N(U):(e.consume(U),A)}function B(U){return U===47||U===62||ot(U)?S(U):n(U)}function R(U){return U===62?(e.consume(U),$):n(U)}function $(U){return U===null||Ue(U)?F(U):ot(U)?(e.consume(U),$):n(U)}function F(U){return U===45&&a===2?(e.consume(U),H):U===60&&a===1?(e.consume(U),J):U===62&&a===4?(e.consume(U),z):U===63&&a===3?(e.consume(U),L):U===93&&a===5?(e.consume(U),I):Ue(U)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(PA,V,W)(U)):U===null||Ue(U)?(e.exit("htmlFlowData"),W(U)):(e.consume(U),F)}function W(U){return e.check(BA,Y,V)(U)}function Y(U){return e.enter("lineEnding"),e.consume(U),e.exit("lineEnding"),P}function P(U){return U===null||Ue(U)?W(U):(e.enter("htmlFlowData"),F(U))}function H(U){return U===45?(e.consume(U),L):F(U)}function J(U){return U===47?(e.consume(U),c="",K):F(U)}function K(U){if(U===62){const ee=c.toLowerCase();return sb.includes(ee)?(e.consume(U),z):F(U)}return Nn(U)&&c.length<8?(e.consume(U),c+=String.fromCharCode(U),K):F(U)}function I(U){return U===93?(e.consume(U),L):F(U)}function L(U){return U===62?(e.consume(U),z):U===45&&a===2?(e.consume(U),L):F(U)}function z(U){return U===null||Ue(U)?(e.exit("htmlFlowData"),V(U)):(e.consume(U),z)}function V(U){return e.exit("htmlFlow"),t(U)}}function $A(e,t,n){const s=this;return a;function a(c){return Ue(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),o):n(c)}function o(c){return s.parser.lazy[s.now().line]?n(c):t(c)}}function UA(e,t,n){return s;function s(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(pl,t,n)}}const FA={name:"htmlText",tokenize:VA};function VA(e,t,n){const s=this;let a,o,c;return l;function l(L){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(L),h}function h(L){return L===33?(e.consume(L),f):L===47?(e.consume(L),N):L===63?(e.consume(L),S):Nn(L)?(e.consume(L),A):n(L)}function f(L){return L===45?(e.consume(L),p):L===91?(e.consume(L),o=0,w):Nn(L)?(e.consume(L),x):n(L)}function p(L){return L===45?(e.consume(L),y):n(L)}function m(L){return L===null?n(L):L===45?(e.consume(L),_):Ue(L)?(c=m,J(L)):(e.consume(L),m)}function _(L){return L===45?(e.consume(L),y):m(L)}function y(L){return L===62?H(L):L===45?_(L):m(L)}function w(L){const z="CDATA[";return L===z.charCodeAt(o++)?(e.consume(L),o===z.length?k:w):n(L)}function k(L){return L===null?n(L):L===93?(e.consume(L),v):Ue(L)?(c=k,J(L)):(e.consume(L),k)}function v(L){return L===93?(e.consume(L),b):k(L)}function b(L){return L===62?H(L):L===93?(e.consume(L),b):k(L)}function x(L){return L===null||L===62?H(L):Ue(L)?(c=x,J(L)):(e.consume(L),x)}function S(L){return L===null?n(L):L===63?(e.consume(L),j):Ue(L)?(c=S,J(L)):(e.consume(L),S)}function j(L){return L===62?H(L):S(L)}function N(L){return Nn(L)?(e.consume(L),T):n(L)}function T(L){return L===45||kn(L)?(e.consume(L),T):D(L)}function D(L){return Ue(L)?(c=D,J(L)):ot(L)?(e.consume(L),D):H(L)}function A(L){return L===45||kn(L)?(e.consume(L),A):L===47||L===62||kt(L)?B(L):n(L)}function B(L){return L===47?(e.consume(L),H):L===58||L===95||Nn(L)?(e.consume(L),R):Ue(L)?(c=B,J(L)):ot(L)?(e.consume(L),B):H(L)}function R(L){return L===45||L===46||L===58||L===95||kn(L)?(e.consume(L),R):$(L)}function $(L){return L===61?(e.consume(L),F):Ue(L)?(c=$,J(L)):ot(L)?(e.consume(L),$):B(L)}function F(L){return L===null||L===60||L===61||L===62||L===96?n(L):L===34||L===39?(e.consume(L),a=L,W):Ue(L)?(c=F,J(L)):ot(L)?(e.consume(L),F):(e.consume(L),Y)}function W(L){return L===a?(e.consume(L),a=void 0,P):L===null?n(L):Ue(L)?(c=W,J(L)):(e.consume(L),W)}function Y(L){return L===null||L===34||L===39||L===60||L===61||L===96?n(L):L===47||L===62||kt(L)?B(L):(e.consume(L),Y)}function P(L){return L===47||L===62||kt(L)?B(L):n(L)}function H(L){return L===62?(e.consume(L),e.exit("htmlTextData"),e.exit("htmlText"),t):n(L)}function J(L){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),K}function K(L){return ot(L)?mt(e,I,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):I(L)}function I(L){return e.enter("htmlTextData"),c(L)}}const gp={name:"labelEnd",resolveAll:KA,resolveTo:YA,tokenize:XA},GA={tokenize:QA},WA={tokenize:JA},qA={tokenize:ZA};function KA(e){let t=-1;const n=[];for(;++t<e.length;){const s=e[t][1];if(n.push(e[t]),s.type==="labelImage"||s.type==="labelLink"||s.type==="labelEnd"){const a=s.type==="labelImage"?4:2;s.type="data",t+=a}}return e.length!==n.length&&Qn(e,0,e.length,n),e}function YA(e,t){let n=e.length,s=0,a,o,c,l;for(;n--;)if(a=e[n][1],o){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(c){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(o=n,a.type!=="labelLink")){s=2;break}}else a.type==="labelEnd"&&(c=n);const h={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},f={type:"label",start:{...e[o][1].start},end:{...e[c][1].end}},p={type:"labelText",start:{...e[o+s+2][1].end},end:{...e[c-2][1].start}};return l=[["enter",h,t],["enter",f,t]],l=ur(l,e.slice(o+1,o+s+3)),l=ur(l,[["enter",p,t]]),l=ur(l,Ru(t.parser.constructs.insideSpan.null,e.slice(o+s+4,c-3),t)),l=ur(l,[["exit",p,t],e[c-2],e[c-1],["exit",f,t]]),l=ur(l,e.slice(c+1)),l=ur(l,[["exit",h,t]]),Qn(e,o,e.length,l),e}function XA(e,t,n){const s=this;let a=s.events.length,o,c;for(;a--;)if((s.events[a][1].type==="labelImage"||s.events[a][1].type==="labelLink")&&!s.events[a][1]._balanced){o=s.events[a][1];break}return l;function l(_){return o?o._inactive?m(_):(c=s.parser.defined.includes(br(s.sliceSerialize({start:o.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(_),e.exit("labelMarker"),e.exit("labelEnd"),h):n(_)}function h(_){return _===40?e.attempt(GA,p,c?p:m)(_):_===91?e.attempt(WA,p,c?f:m)(_):c?p(_):m(_)}function f(_){return e.attempt(qA,p,m)(_)}function p(_){return t(_)}function m(_){return o._balanced=!0,n(_)}}function QA(e,t,n){return s;function s(m){return e.enter("resource"),e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),a}function a(m){return kt(m)?Qo(e,o)(m):o(m)}function o(m){return m===41?p(m):YS(e,c,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function c(m){return kt(m)?Qo(e,h)(m):p(m)}function l(m){return n(m)}function h(m){return m===34||m===39||m===40?QS(e,f,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):p(m)}function f(m){return kt(m)?Qo(e,p)(m):p(m)}function p(m){return m===41?(e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),e.exit("resource"),t):n(m)}}function JA(e,t,n){const s=this;return a;function a(l){return XS.call(s,e,o,c,"reference","referenceMarker","referenceString")(l)}function o(l){return s.parser.defined.includes(br(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?t(l):n(l)}function c(l){return n(l)}}function ZA(e,t,n){return s;function s(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),a}function a(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):n(o)}}const eD={name:"labelStartImage",resolveAll:gp.resolveAll,tokenize:tD};function tD(e,t,n){const s=this;return a;function a(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),o}function o(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),c):n(l)}function c(l){return l===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(l):t(l)}}const nD={name:"labelStartLink",resolveAll:gp.resolveAll,tokenize:rD};function rD(e,t,n){const s=this;return a;function a(c){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelLink"),o}function o(c){return c===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(c):t(c)}}const Af={name:"lineEnding",tokenize:sD};function sD(e,t){return n;function n(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),mt(e,t,"linePrefix")}}const Xc={name:"thematicBreak",tokenize:iD};function iD(e,t,n){let s=0,a;return o;function o(f){return e.enter("thematicBreak"),c(f)}function c(f){return a=f,l(f)}function l(f){return f===a?(e.enter("thematicBreakSequence"),h(f)):s>=3&&(f===null||Ue(f))?(e.exit("thematicBreak"),t(f)):n(f)}function h(f){return f===a?(e.consume(f),s++,h):(e.exit("thematicBreakSequence"),ot(f)?mt(e,l,"whitespace")(f):l(f))}}const Pn={continuation:{tokenize:cD},exit:dD,name:"list",tokenize:lD},aD={partial:!0,tokenize:hD},oD={partial:!0,tokenize:uD};function lD(e,t,n){const s=this,a=s.events[s.events.length-1];let o=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,c=0;return l;function l(y){const w=s.containerState.type||(y===42||y===43||y===45?"listUnordered":"listOrdered");if(w==="listUnordered"?!s.containerState.marker||y===s.containerState.marker:_m(y)){if(s.containerState.type||(s.containerState.type=w,e.enter(w,{_container:!0})),w==="listUnordered")return e.enter("listItemPrefix"),y===42||y===45?e.check(Xc,n,f)(y):f(y);if(!s.interrupt||y===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),h(y)}return n(y)}function h(y){return _m(y)&&++c<10?(e.consume(y),h):(!s.interrupt||c<2)&&(s.containerState.marker?y===s.containerState.marker:y===41||y===46)?(e.exit("listItemValue"),f(y)):n(y)}function f(y){return e.enter("listItemMarker"),e.consume(y),e.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||y,e.check(pl,s.interrupt?n:p,e.attempt(aD,_,m))}function p(y){return s.containerState.initialBlankLine=!0,o++,_(y)}function m(y){return ot(y)?(e.enter("listItemPrefixWhitespace"),e.consume(y),e.exit("listItemPrefixWhitespace"),_):n(y)}function _(y){return s.containerState.size=o+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(y)}}function cD(e,t,n){const s=this;return s.containerState._closeFlow=void 0,e.check(pl,a,o);function a(l){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,mt(e,t,"listItemIndent",s.containerState.size+1)(l)}function o(l){return s.containerState.furtherBlankLines||!ot(l)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,c(l)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(oD,t,c)(l))}function c(l){return s.containerState._closeFlow=!0,s.interrupt=void 0,mt(e,e.attempt(Pn,t,n),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function uD(e,t,n){const s=this;return mt(e,a,"listItemIndent",s.containerState.size+1);function a(o){const c=s.events[s.events.length-1];return c&&c[1].type==="listItemIndent"&&c[2].sliceSerialize(c[1],!0).length===s.containerState.size?t(o):n(o)}}function dD(e){e.exit(this.containerState.type)}function hD(e,t,n){const s=this;return mt(e,a,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(o){const c=s.events[s.events.length-1];return!ot(o)&&c&&c[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const ib={name:"setextUnderline",resolveTo:fD,tokenize:mD};function fD(e,t){let n=e.length,s,a,o;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){s=n;break}e[n][1].type==="paragraph"&&(a=n)}else e[n][1].type==="content"&&e.splice(n,1),!o&&e[n][1].type==="definition"&&(o=n);const c={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",o?(e.splice(a,0,["enter",c,t]),e.splice(o+1,0,["exit",e[s][1],t]),e[s][1].end={...e[o][1].end}):e[s][1]=c,e.push(["exit",c,t]),e}function mD(e,t,n){const s=this;let a;return o;function o(f){let p=s.events.length,m;for(;p--;)if(s.events[p][1].type!=="lineEnding"&&s.events[p][1].type!=="linePrefix"&&s.events[p][1].type!=="content"){m=s.events[p][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||m)?(e.enter("setextHeadingLine"),a=f,c(f)):n(f)}function c(f){return e.enter("setextHeadingLineSequence"),l(f)}function l(f){return f===a?(e.consume(f),l):(e.exit("setextHeadingLineSequence"),ot(f)?mt(e,h,"lineSuffix")(f):h(f))}function h(f){return f===null||Ue(f)?(e.exit("setextHeadingLine"),t(f)):n(f)}}const pD={tokenize:gD};function gD(e){const t=this,n=e.attempt(pl,s,e.attempt(this.parser.constructs.flowInitial,a,mt(e,e.attempt(this.parser.constructs.flow,a,e.attempt(bA,a)),"linePrefix")));return n;function s(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function a(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const xD={resolveAll:ZS()},_D=JS("string"),yD=JS("text");function JS(e){return{resolveAll:ZS(e==="text"?vD:void 0),tokenize:t};function t(n){const s=this,a=this.parser.constructs[e],o=n.attempt(a,c,l);return c;function c(p){return f(p)?o(p):l(p)}function l(p){if(p===null){n.consume(p);return}return n.enter("data"),n.consume(p),h}function h(p){return f(p)?(n.exit("data"),o(p)):(n.consume(p),h)}function f(p){if(p===null)return!0;const m=a[p];let _=-1;if(m)for(;++_<m.length;){const y=m[_];if(!y.previous||y.previous.call(s,s.previous))return!0}return!1}}}function ZS(e){return t;function t(n,s){let a=-1,o;for(;++a<=n.length;)o===void 0?n[a]&&n[a][1].type==="data"&&(o=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==o+2&&(n[o][1].end=n[a-1][1].end,n.splice(o+2,a-o-2),a=o+2),o=void 0);return e?e(n,s):n}}function vD(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const s=e[n-1][1],a=t.sliceStream(s);let o=a.length,c=-1,l=0,h;for(;o--;){const f=a[o];if(typeof f=="string"){for(c=f.length;f.charCodeAt(c-1)===32;)l++,c--;if(c)break;c=-1}else if(f===-2)h=!0,l++;else if(f!==-1){o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){const f={type:n===e.length||h||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?c:s.start._bufferIndex+c,_index:s.start._index+o,line:s.end.line,column:s.end.column-l,offset:s.end.offset-l},end:{...s.end}};s.end={...f.start},s.start.offset===s.end.offset?Object.assign(s,f):(e.splice(n,0,["enter",f,t],["exit",f,t]),n+=2)}n++}return e}const bD={42:Pn,43:Pn,45:Pn,48:Pn,49:Pn,50:Pn,51:Pn,52:Pn,53:Pn,54:Pn,55:Pn,56:Pn,57:Pn,62:GS},SD={91:EA},wD={[-2]:Nf,[-1]:Nf,32:Nf},CD={35:LA,42:Xc,45:[ib,Xc],60:IA,61:ib,95:Xc,96:rb,126:rb},kD={38:qS,92:WS},ED={[-5]:Af,[-4]:Af,[-3]:Af,33:eD,38:qS,42:ym,60:[nA,FA],91:nD,92:[AA,WS],93:gp,95:ym,96:pA},jD={null:[ym,xD]},TD={null:[42,95]},ND={null:[]},AD=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:TD,contentInitial:SD,disable:ND,document:bD,flow:CD,flowInitial:wD,insideSpan:jD,string:kD,text:ED},Symbol.toStringTag,{value:"Module"}));function DD(e,t,n){let s={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const a={},o=[];let c=[],l=[];const h={attempt:D(N),check:D(T),consume:x,enter:S,exit:j,interrupt:D(T,{interrupt:!0})},f={code:null,containerState:{},defineSkip:k,events:[],now:w,parser:e,previous:null,sliceSerialize:_,sliceStream:y,write:m};let p=t.tokenize.call(f,h);return t.resolveAll&&o.push(t),f;function m($){return c=ur(c,$),v(),c[c.length-1]!==null?[]:(A(t,0),f.events=Ru(o,f.events,f),f.events)}function _($,F){return RD(y($),F)}function y($){return LD(c,$)}function w(){const{_bufferIndex:$,_index:F,line:W,column:Y,offset:P}=s;return{_bufferIndex:$,_index:F,line:W,column:Y,offset:P}}function k($){a[$.line]=$.column,R()}function v(){let $;for(;s._index<c.length;){const F=c[s._index];if(typeof F=="string")for($=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===$&&s._bufferIndex<F.length;)b(F.charCodeAt(s._bufferIndex));else b(F)}}function b($){p=p($)}function x($){Ue($)?(s.line++,s.column=1,s.offset+=$===-3?2:1,R()):$!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===c[s._index].length&&(s._bufferIndex=-1,s._index++)),f.previous=$}function S($,F){const W=F||{};return W.type=$,W.start=w(),f.events.push(["enter",W,f]),l.push(W),W}function j($){const F=l.pop();return F.end=w(),f.events.push(["exit",F,f]),F}function N($,F){A($,F.from)}function T($,F){F.restore()}function D($,F){return W;function W(Y,P,H){let J,K,I,L;return Array.isArray(Y)?V(Y):"tokenize"in Y?V([Y]):z(Y);function z(ne){return X;function X(G){const le=G!==null&&ne[G],se=G!==null&&ne.null,ve=[...Array.isArray(le)?le:le?[le]:[],...Array.isArray(se)?se:se?[se]:[]];return V(ve)(G)}}function V(ne){return J=ne,K=0,ne.length===0?H:U(ne[K])}function U(ne){return X;function X(G){return L=B(),I=ne,ne.partial||(f.currentConstruct=ne),ne.name&&f.parser.constructs.disable.null.includes(ne.name)?Z():ne.tokenize.call(F?Object.assign(Object.create(f),F):f,h,ee,Z)(G)}}function ee(ne){return $(I,L),P}function Z(ne){return L.restore(),++K<J.length?U(J[K]):H}}}function A($,F){$.resolveAll&&!o.includes($)&&o.push($),$.resolve&&Qn(f.events,F,f.events.length-F,$.resolve(f.events.slice(F),f)),$.resolveTo&&(f.events=$.resolveTo(f.events,f))}function B(){const $=w(),F=f.previous,W=f.currentConstruct,Y=f.events.length,P=Array.from(l);return{from:Y,restore:H};function H(){s=$,f.previous=F,f.currentConstruct=W,f.events.length=Y,l=P,R()}}function R(){s.line in a&&s.column<2&&(s.column=a[s.line],s.offset+=a[s.line]-1)}}function LD(e,t){const n=t.start._index,s=t.start._bufferIndex,a=t.end._index,o=t.end._bufferIndex;let c;if(n===a)c=[e[n].slice(s,o)];else{if(c=e.slice(n,a),s>-1){const l=c[0];typeof l=="string"?c[0]=l.slice(s):c.shift()}o>0&&c.push(e[a].slice(0,o))}return c}function RD(e,t){let n=-1;const s=[];let a;for(;++n<e.length;){const o=e[n];let c;if(typeof o=="string")c=o;else switch(o){case-5:{c="\r";break}case-4:{c=`
96
+ `;break}case-3:{c=`\r
97
+ `;break}case-2:{c=t?" ":" ";break}case-1:{if(!t&&a)continue;c=" ";break}default:c=String.fromCharCode(o)}a=o===-2,s.push(c)}return s.join("")}function OD(e){const s={constructs:FS([AD,...(e||{}).extensions||[]]),content:a(YN),defined:[],document:a(QN),flow:a(pD),lazy:{},string:a(_D),text:a(yD)};return s;function a(o){return c;function c(l){return DD(s,o,l)}}}function MD(e){for(;!KS(e););return e}const ab=/[\0\t\n\r]/g;function ID(){let e=1,t="",n=!0,s;return a;function a(o,c,l){const h=[];let f,p,m,_,y;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(c||void 0).decode(o)),m=0,t="",n&&(o.charCodeAt(0)===65279&&m++,n=void 0);m<o.length;){if(ab.lastIndex=m,f=ab.exec(o),_=f&&f.index!==void 0?f.index:o.length,y=o.charCodeAt(_),!f){t=o.slice(m);break}if(y===10&&m===_&&s)h.push(-3),s=void 0;else switch(s&&(h.push(-5),s=void 0),m<_&&(h.push(o.slice(m,_)),e+=_-m),y){case 0:{h.push(65533),e++;break}case 9:{for(p=Math.ceil(e/4)*4,h.push(-2);e++<p;)h.push(-1);break}case 10:{h.push(-4),e=1;break}default:s=!0,e=1}m=_+1}return l&&(s&&h.push(-5),t&&h.push(t),h.push(null)),h}}const PD=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function BD(e){return e.replace(PD,zD)}function zD(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),o=a===120||a===88;return VS(n.slice(o?2:1),o?16:10)}return pp(n)||e}const e1={}.hasOwnProperty;function HD(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),$D(n)(MD(OD(n).document().write(ID()(e,t,!0))))}function $D(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(lt),autolinkProtocol:B,autolinkEmail:B,atxHeading:o(Pe),blockQuote:o(se),characterEscape:B,characterReference:B,codeFenced:o(ve),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:o(ve,c),codeText:o(be,c),codeTextData:B,data:B,codeFlowValue:B,definition:o(Oe),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:o(Be),hardBreakEscape:o(Ve),hardBreakTrailing:o(Ve),htmlFlow:o(Ae,c),htmlFlowData:B,htmlText:o(Ae,c),htmlTextData:B,image:o(dt),label:c,link:o(lt),listItem:o(Ne),listItemValue:_,listOrdered:o(ye,m),listUnordered:o(ye),paragraph:o(fe),reference:U,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:o(Pe),strong:o(De),thematicBreak:o(_t)},exit:{atxHeading:h(),atxHeadingSequence:N,autolink:h(),autolinkEmail:le,autolinkProtocol:G,blockQuote:h(),characterEscapeValue:R,characterReferenceMarkerHexadecimal:Z,characterReferenceMarkerNumeric:Z,characterReferenceValue:ne,characterReference:X,codeFenced:h(v),codeFencedFence:k,codeFencedFenceInfo:y,codeFencedFenceMeta:w,codeFlowValue:R,codeIndented:h(b),codeText:h(P),codeTextData:R,data:R,definition:h(),definitionDestinationString:j,definitionLabelString:x,definitionTitleString:S,emphasis:h(),hardBreakEscape:h(F),hardBreakTrailing:h(F),htmlFlow:h(W),htmlFlowData:R,htmlText:h(Y),htmlTextData:R,image:h(J),label:I,labelText:K,lineEnding:$,link:h(H),listItem:h(),listOrdered:h(),listUnordered:h(),paragraph:h(),referenceString:ee,resourceDestinationString:L,resourceTitleString:z,resource:V,setextHeading:h(A),setextHeadingLineSequence:D,setextHeadingText:T,strong:h(),thematicBreak:h()}};t1(t,(e||{}).mdastExtensions||[]);const n={};return s;function s(ue){let we={type:"root",children:[]};const Le={stack:[we],tokenStack:[],config:t,enter:l,exit:f,buffer:c,resume:p,data:n},He=[];let Xe=-1;for(;++Xe<ue.length;)if(ue[Xe][1].type==="listOrdered"||ue[Xe][1].type==="listUnordered")if(ue[Xe][0]==="enter")He.push(Xe);else{const It=He.pop();Xe=a(ue,It,Xe)}for(Xe=-1;++Xe<ue.length;){const It=t[ue[Xe][0]];e1.call(It,ue[Xe][1].type)&&It[ue[Xe][1].type].call(Object.assign({sliceSerialize:ue[Xe][2].sliceSerialize},Le),ue[Xe][1])}if(Le.tokenStack.length>0){const It=Le.tokenStack[Le.tokenStack.length-1];(It[1]||ob).call(Le,void 0,It[0])}for(we.position={start:Ms(ue.length>0?ue[0][1].start:{line:1,column:1,offset:0}),end:Ms(ue.length>0?ue[ue.length-2][1].end:{line:1,column:1,offset:0})},Xe=-1;++Xe<t.transforms.length;)we=t.transforms[Xe](we)||we;return we}function a(ue,we,Le){let He=we-1,Xe=-1,It=!1,st,he,Re,qe;for(;++He<=Le;){const Ke=ue[He];switch(Ke[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ke[0]==="enter"?Xe++:Xe--,qe=void 0;break}case"lineEndingBlank":{Ke[0]==="enter"&&(st&&!qe&&!Xe&&!Re&&(Re=He),qe=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:qe=void 0}if(!Xe&&Ke[0]==="enter"&&Ke[1].type==="listItemPrefix"||Xe===-1&&Ke[0]==="exit"&&(Ke[1].type==="listUnordered"||Ke[1].type==="listOrdered")){if(st){let nn=He;for(he=void 0;nn--;){const Ht=ue[nn];if(Ht[1].type==="lineEnding"||Ht[1].type==="lineEndingBlank"){if(Ht[0]==="exit")continue;he&&(ue[he][1].type="lineEndingBlank",It=!0),Ht[1].type="lineEnding",he=nn}else if(!(Ht[1].type==="linePrefix"||Ht[1].type==="blockQuotePrefix"||Ht[1].type==="blockQuotePrefixWhitespace"||Ht[1].type==="blockQuoteMarker"||Ht[1].type==="listItemIndent"))break}Re&&(!he||Re<he)&&(st._spread=!0),st.end=Object.assign({},he?ue[he][1].start:Ke[1].end),ue.splice(he||He,0,["exit",st,Ke[2]]),He++,Le++}if(Ke[1].type==="listItemPrefix"){const nn={type:"listItem",_spread:!1,start:Object.assign({},Ke[1].start),end:void 0};st=nn,ue.splice(He,0,["enter",nn,Ke[2]]),He++,Le++,Re=void 0,qe=!0}}}return ue[we][1]._spread=It,Le}function o(ue,we){return Le;function Le(He){l.call(this,ue(He),He),we&&we.call(this,He)}}function c(){this.stack.push({type:"fragment",children:[]})}function l(ue,we,Le){this.stack[this.stack.length-1].children.push(ue),this.stack.push(ue),this.tokenStack.push([we,Le||void 0]),ue.position={start:Ms(we.start),end:void 0}}function h(ue){return we;function we(Le){ue&&ue.call(this,Le),f.call(this,Le)}}function f(ue,we){const Le=this.stack.pop(),He=this.tokenStack.pop();if(He)He[0].type!==ue.type&&(we?we.call(this,ue,He[0]):(He[1]||ob).call(this,ue,He[0]));else throw new Error("Cannot close `"+ue.type+"` ("+Xo({start:ue.start,end:ue.end})+"): it’s not open");Le.position.end=Ms(ue.end)}function p(){return mp(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function _(ue){if(this.data.expectingFirstListItemValue){const we=this.stack[this.stack.length-2];we.start=Number.parseInt(this.sliceSerialize(ue),10),this.data.expectingFirstListItemValue=void 0}}function y(){const ue=this.resume(),we=this.stack[this.stack.length-1];we.lang=ue}function w(){const ue=this.resume(),we=this.stack[this.stack.length-1];we.meta=ue}function k(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function v(){const ue=this.resume(),we=this.stack[this.stack.length-1];we.value=ue.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function b(){const ue=this.resume(),we=this.stack[this.stack.length-1];we.value=ue.replace(/(\r?\n|\r)$/g,"")}function x(ue){const we=this.resume(),Le=this.stack[this.stack.length-1];Le.label=we,Le.identifier=br(this.sliceSerialize(ue)).toLowerCase()}function S(){const ue=this.resume(),we=this.stack[this.stack.length-1];we.title=ue}function j(){const ue=this.resume(),we=this.stack[this.stack.length-1];we.url=ue}function N(ue){const we=this.stack[this.stack.length-1];if(!we.depth){const Le=this.sliceSerialize(ue).length;we.depth=Le}}function T(){this.data.setextHeadingSlurpLineEnding=!0}function D(ue){const we=this.stack[this.stack.length-1];we.depth=this.sliceSerialize(ue).codePointAt(0)===61?1:2}function A(){this.data.setextHeadingSlurpLineEnding=void 0}function B(ue){const Le=this.stack[this.stack.length-1].children;let He=Le[Le.length-1];(!He||He.type!=="text")&&(He=ze(),He.position={start:Ms(ue.start),end:void 0},Le.push(He)),this.stack.push(He)}function R(ue){const we=this.stack.pop();we.value+=this.sliceSerialize(ue),we.position.end=Ms(ue.end)}function $(ue){const we=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Le=we.children[we.children.length-1];Le.position.end=Ms(ue.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(we.type)&&(B.call(this,ue),R.call(this,ue))}function F(){this.data.atHardBreak=!0}function W(){const ue=this.resume(),we=this.stack[this.stack.length-1];we.value=ue}function Y(){const ue=this.resume(),we=this.stack[this.stack.length-1];we.value=ue}function P(){const ue=this.resume(),we=this.stack[this.stack.length-1];we.value=ue}function H(){const ue=this.stack[this.stack.length-1];if(this.data.inReference){const we=this.data.referenceType||"shortcut";ue.type+="Reference",ue.referenceType=we,delete ue.url,delete ue.title}else delete ue.identifier,delete ue.label;this.data.referenceType=void 0}function J(){const ue=this.stack[this.stack.length-1];if(this.data.inReference){const we=this.data.referenceType||"shortcut";ue.type+="Reference",ue.referenceType=we,delete ue.url,delete ue.title}else delete ue.identifier,delete ue.label;this.data.referenceType=void 0}function K(ue){const we=this.sliceSerialize(ue),Le=this.stack[this.stack.length-2];Le.label=BD(we),Le.identifier=br(we).toLowerCase()}function I(){const ue=this.stack[this.stack.length-1],we=this.resume(),Le=this.stack[this.stack.length-1];if(this.data.inReference=!0,Le.type==="link"){const He=ue.children;Le.children=He}else Le.alt=we}function L(){const ue=this.resume(),we=this.stack[this.stack.length-1];we.url=ue}function z(){const ue=this.resume(),we=this.stack[this.stack.length-1];we.title=ue}function V(){this.data.inReference=void 0}function U(){this.data.referenceType="collapsed"}function ee(ue){const we=this.resume(),Le=this.stack[this.stack.length-1];Le.label=we,Le.identifier=br(this.sliceSerialize(ue)).toLowerCase(),this.data.referenceType="full"}function Z(ue){this.data.characterReferenceType=ue.type}function ne(ue){const we=this.sliceSerialize(ue),Le=this.data.characterReferenceType;let He;Le?(He=VS(we,Le==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):He=pp(we);const Xe=this.stack[this.stack.length-1];Xe.value+=He}function X(ue){const we=this.stack.pop();we.position.end=Ms(ue.end)}function G(ue){R.call(this,ue);const we=this.stack[this.stack.length-1];we.url=this.sliceSerialize(ue)}function le(ue){R.call(this,ue);const we=this.stack[this.stack.length-1];we.url="mailto:"+this.sliceSerialize(ue)}function se(){return{type:"blockquote",children:[]}}function ve(){return{type:"code",lang:null,meta:null,value:""}}function be(){return{type:"inlineCode",value:""}}function Oe(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Be(){return{type:"emphasis",children:[]}}function Pe(){return{type:"heading",depth:0,children:[]}}function Ve(){return{type:"break"}}function Ae(){return{type:"html",value:""}}function dt(){return{type:"image",title:null,url:"",alt:null}}function lt(){return{type:"link",title:null,url:"",children:[]}}function ye(ue){return{type:"list",ordered:ue.type==="listOrdered",start:null,spread:ue._spread,children:[]}}function Ne(ue){return{type:"listItem",spread:ue._spread,checked:null,children:[]}}function fe(){return{type:"paragraph",children:[]}}function De(){return{type:"strong",children:[]}}function ze(){return{type:"text",value:""}}function _t(){return{type:"thematicBreak"}}}function Ms(e){return{line:e.line,column:e.column,offset:e.offset}}function t1(e,t){let n=-1;for(;++n<t.length;){const s=t[n];Array.isArray(s)?t1(e,s):UD(e,s)}}function UD(e,t){let n;for(n in t)if(e1.call(t,n))switch(n){case"canContainEols":{const s=t[n];s&&e[n].push(...s);break}case"transforms":{const s=t[n];s&&e[n].push(...s);break}case"enter":case"exit":{const s=t[n];s&&Object.assign(e[n],s);break}}}function ob(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Xo({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Xo({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Xo({start:t.start,end:t.end})+") is still open")}function FD(e){const t=this;t.parser=n;function n(s){return HD(s,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function VD(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function GD(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
98
+ `}]}function WD(e,t){const n=t.value?t.value+`
99
+ `:"",s={},a=t.lang?t.lang.split(/\s+/):[];a.length>0&&(s.className=["language-"+a[0]]);let o={type:"element",tagName:"code",properties:s,children:[{type:"text",value:n}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o=e.applyData(t,o),o={type:"element",tagName:"pre",properties:{},children:[o]},e.patch(t,o),o}function qD(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function KD(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function YD(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(t.identifier).toUpperCase(),a=za(s.toLowerCase()),o=e.footnoteOrder.indexOf(s);let c,l=e.footnoteCounts.get(s);l===void 0?(l=0,e.footnoteOrder.push(s),c=e.footnoteOrder.length):c=o+1,l+=1,e.footnoteCounts.set(s,l);const h={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+a,id:n+"fnref-"+a+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(c)}]};e.patch(t,h);const f={type:"element",tagName:"sup",properties:{},children:[h]};return e.patch(t,f),e.applyData(t,f)}function XD(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function QD(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function n1(e,t){const n=t.referenceType;let s="]";if(n==="collapsed"?s+="[]":n==="full"&&(s+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+s}];const a=e.all(t),o=a[0];o&&o.type==="text"?o.value="["+o.value:a.unshift({type:"text",value:"["});const c=a[a.length-1];return c&&c.type==="text"?c.value+=s:a.push({type:"text",value:s}),a}function JD(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return n1(e,t);const a={src:za(s.url||""),alt:t.alt};s.title!==null&&s.title!==void 0&&(a.title=s.title);const o={type:"element",tagName:"img",properties:a,children:[]};return e.patch(t,o),e.applyData(t,o)}function ZD(e,t){const n={src:za(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const s={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,s),e.applyData(t,s)}function eL(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const s={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,s),e.applyData(t,s)}function tL(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return n1(e,t);const a={href:za(s.url||"")};s.title!==null&&s.title!==void 0&&(a.title=s.title);const o={type:"element",tagName:"a",properties:a,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}function nL(e,t){const n={href:za(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const s={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function rL(e,t,n){const s=e.all(t),a=n?sL(n):r1(t),o={},c=[];if(typeof t.checked=="boolean"){const p=s[0];let m;p&&p.type==="element"&&p.tagName==="p"?m=p:(m={type:"element",tagName:"p",properties:{},children:[]},s.unshift(m)),m.children.length>0&&m.children.unshift({type:"text",value:" "}),m.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let l=-1;for(;++l<s.length;){const p=s[l];(a||l!==0||p.type!=="element"||p.tagName!=="p")&&c.push({type:"text",value:`
100
+ `}),p.type==="element"&&p.tagName==="p"&&!a?c.push(...p.children):c.push(p)}const h=s[s.length-1];h&&(a||h.type!=="element"||h.tagName!=="p")&&c.push({type:"text",value:`
101
+ `});const f={type:"element",tagName:"li",properties:o,children:c};return e.patch(t,f),e.applyData(t,f)}function sL(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let s=-1;for(;!t&&++s<n.length;)t=r1(n[s])}return t}function r1(e){const t=e.spread;return t??e.children.length>1}function iL(e,t){const n={},s=e.all(t);let a=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++a<s.length;){const c=s[a];if(c.type==="element"&&c.tagName==="li"&&c.properties&&Array.isArray(c.properties.className)&&c.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const o={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(s,!0)};return e.patch(t,o),e.applyData(t,o)}function aL(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function oL(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function lL(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function cL(e,t){const n=e.all(t),s=n.shift(),a=[];if(s){const c={type:"element",tagName:"thead",properties:{},children:e.wrap([s],!0)};e.patch(t.children[0],c),a.push(c)}if(n.length>0){const c={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},l=up(t.children[1]),h=IS(t.children[t.children.length-1]);l&&h&&(c.position={start:l,end:h}),a.push(c)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(a,!0)};return e.patch(t,o),e.applyData(t,o)}function uL(e,t,n){const s=n?n.children:void 0,o=(s?s.indexOf(t):1)===0?"th":"td",c=n&&n.type==="table"?n.align:void 0,l=c?c.length:t.children.length;let h=-1;const f=[];for(;++h<l;){const m=t.children[h],_={},y=c?c[h]:void 0;y&&(_.align=y);let w={type:"element",tagName:o,properties:_,children:[]};m&&(w.children=e.all(m),e.patch(m,w),w=e.applyData(m,w)),f.push(w)}const p={type:"element",tagName:"tr",properties:{},children:e.wrap(f,!0)};return e.patch(t,p),e.applyData(t,p)}function dL(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const lb=9,cb=32;function hL(e){const t=String(e),n=/\r?\n|\r/g;let s=n.exec(t),a=0;const o=[];for(;s;)o.push(ub(t.slice(a,s.index),a>0,!0),s[0]),a=s.index+s[0].length,s=n.exec(t);return o.push(ub(t.slice(a),a>0,!1)),o.join("")}function ub(e,t,n){let s=0,a=e.length;if(t){let o=e.codePointAt(s);for(;o===lb||o===cb;)s++,o=e.codePointAt(s)}if(n){let o=e.codePointAt(a-1);for(;o===lb||o===cb;)a--,o=e.codePointAt(a-1)}return a>s?e.slice(s,a):""}function fL(e,t){const n={type:"text",value:hL(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function mL(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const pL={blockquote:VD,break:GD,code:WD,delete:qD,emphasis:KD,footnoteReference:YD,heading:XD,html:QD,imageReference:JD,image:ZD,inlineCode:eL,linkReference:tL,link:nL,listItem:rL,list:iL,paragraph:aL,root:oL,strong:lL,table:cL,tableCell:dL,tableRow:uL,text:fL,thematicBreak:mL,toml:Bc,yaml:Bc,definition:Bc,footnoteDefinition:Bc};function Bc(){}const s1=-1,Ou=0,Jo=1,su=2,xp=3,_p=4,yp=5,vp=6,i1=7,a1=8,db=typeof self=="object"?self:globalThis,gL=(e,t)=>{const n=(a,o)=>(e.set(o,a),a),s=a=>{if(e.has(a))return e.get(a);const[o,c]=t[a];switch(o){case Ou:case s1:return n(c,a);case Jo:{const l=n([],a);for(const h of c)l.push(s(h));return l}case su:{const l=n({},a);for(const[h,f]of c)l[s(h)]=s(f);return l}case xp:return n(new Date(c),a);case _p:{const{source:l,flags:h}=c;return n(new RegExp(l,h),a)}case yp:{const l=n(new Map,a);for(const[h,f]of c)l.set(s(h),s(f));return l}case vp:{const l=n(new Set,a);for(const h of c)l.add(s(h));return l}case i1:{const{name:l,message:h}=c;return n(new db[l](h),a)}case a1:return n(BigInt(c),a);case"BigInt":return n(Object(BigInt(c)),a);case"ArrayBuffer":return n(new Uint8Array(c).buffer,c);case"DataView":{const{buffer:l}=new Uint8Array(c);return n(new DataView(l),c)}}return n(new db[o](c),a)};return s},hb=e=>gL(new Map,e)(0),xa="",{toString:xL}={},{keys:_L}=Object,Uo=e=>{const t=typeof e;if(t!=="object"||!e)return[Ou,t];const n=xL.call(e).slice(8,-1);switch(n){case"Array":return[Jo,xa];case"Object":return[su,xa];case"Date":return[xp,xa];case"RegExp":return[_p,xa];case"Map":return[yp,xa];case"Set":return[vp,xa];case"DataView":return[Jo,n]}return n.includes("Array")?[Jo,n]:n.includes("Error")?[i1,n]:[su,n]},zc=([e,t])=>e===Ou&&(t==="function"||t==="symbol"),yL=(e,t,n,s)=>{const a=(c,l)=>{const h=s.push(c)-1;return n.set(l,h),h},o=c=>{if(n.has(c))return n.get(c);let[l,h]=Uo(c);switch(l){case Ou:{let p=c;switch(h){case"bigint":l=a1,p=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+h);p=null;break;case"undefined":return a([s1],c)}return a([l,p],c)}case Jo:{if(h){let _=c;return h==="DataView"?_=new Uint8Array(c.buffer):h==="ArrayBuffer"&&(_=new Uint8Array(c)),a([h,[..._]],c)}const p=[],m=a([l,p],c);for(const _ of c)p.push(o(_));return m}case su:{if(h)switch(h){case"BigInt":return a([h,c.toString()],c);case"Boolean":case"Number":case"String":return a([h,c.valueOf()],c)}if(t&&"toJSON"in c)return o(c.toJSON());const p=[],m=a([l,p],c);for(const _ of _L(c))(e||!zc(Uo(c[_])))&&p.push([o(_),o(c[_])]);return m}case xp:return a([l,c.toISOString()],c);case _p:{const{source:p,flags:m}=c;return a([l,{source:p,flags:m}],c)}case yp:{const p=[],m=a([l,p],c);for(const[_,y]of c)(e||!(zc(Uo(_))||zc(Uo(y))))&&p.push([o(_),o(y)]);return m}case vp:{const p=[],m=a([l,p],c);for(const _ of c)(e||!zc(Uo(_)))&&p.push(o(_));return m}}const{message:f}=c;return a([l,{name:h,message:f}],c)};return o},fb=(e,{json:t,lossy:n}={})=>{const s=[];return yL(!(t||n),!!t,new Map,s)(e),s},iu=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?hb(fb(e,t)):structuredClone(e):(e,t)=>hb(fb(e,t));function vL(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function bL(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function SL(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||vL,s=e.options.footnoteBackLabel||bL,a=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",c=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let h=-1;for(;++h<e.footnoteOrder.length;){const f=e.footnoteById.get(e.footnoteOrder[h]);if(!f)continue;const p=e.all(f),m=String(f.identifier).toUpperCase(),_=za(m.toLowerCase());let y=0;const w=[],k=e.footnoteCounts.get(m);for(;k!==void 0&&++y<=k;){w.length>0&&w.push({type:"text",value:" "});let x=typeof n=="string"?n:n(h,y);typeof x=="string"&&(x={type:"text",value:x}),w.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+_+(y>1?"-"+y:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(h,y),className:["data-footnote-backref"]},children:Array.isArray(x)?x:[x]})}const v=p[p.length-1];if(v&&v.type==="element"&&v.tagName==="p"){const x=v.children[v.children.length-1];x&&x.type==="text"?x.value+=" ":v.children.push({type:"text",value:" "}),v.children.push(...w)}else p.push(...w);const b={type:"element",tagName:"li",properties:{id:t+"fn-"+_},children:e.wrap(p,!0)};e.patch(f,b),l.push(b)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...iu(c),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:`
102
+ `},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:`
103
+ `}]}}const Mu=(function(e){if(e==null)return EL;if(typeof e=="function")return Iu(e);if(typeof e=="object")return Array.isArray(e)?wL(e):CL(e);if(typeof e=="string")return kL(e);throw new Error("Expected function, string, or object as test")});function wL(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Mu(e[n]);return Iu(s);function s(...a){let o=-1;for(;++o<t.length;)if(t[o].apply(this,a))return!0;return!1}}function CL(e){const t=e;return Iu(n);function n(s){const a=s;let o;for(o in e)if(a[o]!==t[o])return!1;return!0}}function kL(e){return Iu(t);function t(n){return n&&n.type===e}}function Iu(e){return t;function t(n,s,a){return!!(jL(n)&&e.call(this,n,typeof s=="number"?s:void 0,a||void 0))}}function EL(){return!0}function jL(e){return e!==null&&typeof e=="object"&&"type"in e}const o1=[],TL=!0,vm=!1,NL="skip";function l1(e,t,n,s){let a;typeof t=="function"&&typeof n!="function"?(s=n,n=t):a=t;const o=Mu(a),c=s?-1:1;l(e,void 0,[])();function l(h,f,p){const m=h&&typeof h=="object"?h:{};if(typeof m.type=="string"){const y=typeof m.tagName=="string"?m.tagName:typeof m.name=="string"?m.name:void 0;Object.defineProperty(_,"name",{value:"node ("+(h.type+(y?"<"+y+">":""))+")"})}return _;function _(){let y=o1,w,k,v;if((!t||o(h,f,p[p.length-1]||void 0))&&(y=AL(n(h,p)),y[0]===vm))return y;if("children"in h&&h.children){const b=h;if(b.children&&y[0]!==NL)for(k=(s?b.children.length:-1)+c,v=p.concat(b);k>-1&&k<b.children.length;){const x=b.children[k];if(w=l(x,k,v)(),w[0]===vm)return w;k=typeof w[1]=="number"?w[1]:k+c}}return y}}}function AL(e){return Array.isArray(e)?e:typeof e=="number"?[TL,e]:e==null?o1:[e]}function bp(e,t,n,s){let a,o,c;typeof t=="function"&&typeof n!="function"?(o=void 0,c=t,a=n):(o=t,c=n,a=s),l1(e,o,l,a);function l(h,f){const p=f[f.length-1],m=p?p.children.indexOf(h):void 0;return c(h,m,p)}}const bm={}.hasOwnProperty,DL={};function LL(e,t){const n=t||DL,s=new Map,a=new Map,o=new Map,c={...pL,...n.handlers},l={all:f,applyData:OL,definitionById:s,footnoteById:a,footnoteCounts:o,footnoteOrder:[],handlers:c,one:h,options:n,patch:RL,wrap:IL};return bp(e,function(p){if(p.type==="definition"||p.type==="footnoteDefinition"){const m=p.type==="definition"?s:a,_=String(p.identifier).toUpperCase();m.has(_)||m.set(_,p)}}),l;function h(p,m){const _=p.type,y=l.handlers[_];if(bm.call(l.handlers,_)&&y)return y(l,p,m);if(l.options.passThrough&&l.options.passThrough.includes(_)){if("children"in p){const{children:k,...v}=p,b=iu(v);return b.children=l.all(p),b}return iu(p)}return(l.options.unknownHandler||ML)(l,p,m)}function f(p){const m=[];if("children"in p){const _=p.children;let y=-1;for(;++y<_.length;){const w=l.one(_[y],p);if(w){if(y&&_[y-1].type==="break"&&(!Array.isArray(w)&&w.type==="text"&&(w.value=mb(w.value)),!Array.isArray(w)&&w.type==="element")){const k=w.children[0];k&&k.type==="text"&&(k.value=mb(k.value))}Array.isArray(w)?m.push(...w):m.push(w)}}}return m}}function RL(e,t){e.position&&(t.position=bN(e))}function OL(e,t){let n=t;if(e&&e.data){const s=e.data.hName,a=e.data.hChildren,o=e.data.hProperties;if(typeof s=="string")if(n.type==="element")n.tagName=s;else{const c="children"in n?n.children:[n];n={type:"element",tagName:s,properties:{},children:c}}n.type==="element"&&o&&Object.assign(n.properties,iu(o)),"children"in n&&n.children&&a!==null&&a!==void 0&&(n.children=a)}return n}function ML(e,t){const n=t.data||{},s="value"in t&&!(bm.call(n,"hProperties")||bm.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function IL(e,t){const n=[];let s=-1;for(t&&n.push({type:"text",value:`
104
+ `});++s<e.length;)s&&n.push({type:"text",value:`
105
+ `}),n.push(e[s]);return t&&e.length>0&&n.push({type:"text",value:`
106
+ `}),n}function mb(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function pb(e,t){const n=LL(e,t),s=n.one(e,void 0),a=SL(n),o=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return a&&o.children.push({type:"text",value:`
107
+ `},a),o}function PL(e,t){return e&&"run"in e?async function(n,s){const a=pb(n,{file:s,...t});await e.run(a,s)}:function(n,s){return pb(n,{file:s,...e||t})}}function gb(e){if(e)throw e}var Df,xb;function BL(){if(xb)return Df;xb=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,s=Object.getOwnPropertyDescriptor,a=function(f){return typeof Array.isArray=="function"?Array.isArray(f):t.call(f)==="[object Array]"},o=function(f){if(!f||t.call(f)!=="[object Object]")return!1;var p=e.call(f,"constructor"),m=f.constructor&&f.constructor.prototype&&e.call(f.constructor.prototype,"isPrototypeOf");if(f.constructor&&!p&&!m)return!1;var _;for(_ in f);return typeof _>"u"||e.call(f,_)},c=function(f,p){n&&p.name==="__proto__"?n(f,p.name,{enumerable:!0,configurable:!0,value:p.newValue,writable:!0}):f[p.name]=p.newValue},l=function(f,p){if(p==="__proto__")if(e.call(f,p)){if(s)return s(f,p).value}else return;return f[p]};return Df=function h(){var f,p,m,_,y,w,k=arguments[0],v=1,b=arguments.length,x=!1;for(typeof k=="boolean"&&(x=k,k=arguments[1]||{},v=2),(k==null||typeof k!="object"&&typeof k!="function")&&(k={});v<b;++v)if(f=arguments[v],f!=null)for(p in f)m=l(k,p),_=l(f,p),k!==_&&(x&&_&&(o(_)||(y=a(_)))?(y?(y=!1,w=m&&a(m)?m:[]):w=m&&o(m)?m:{},c(k,{name:p,newValue:h(x,w,_)})):typeof _<"u"&&c(k,{name:p,newValue:_}));return k},Df}var zL=BL();const Lf=bu(zL);function Sm(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function HL(){const e=[],t={run:n,use:s};return t;function n(...a){let o=-1;const c=a.pop();if(typeof c!="function")throw new TypeError("Expected function as last argument, not "+c);l(null,...a);function l(h,...f){const p=e[++o];let m=-1;if(h){c(h);return}for(;++m<a.length;)(f[m]===null||f[m]===void 0)&&(f[m]=a[m]);a=f,p?$L(p,l)(...f):c(null,...f)}}function s(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),t}}function $L(e,t){let n;return s;function s(...c){const l=e.length>c.length;let h;l&&c.push(a);try{h=e.apply(this,c)}catch(f){const p=f;if(l&&n)throw p;return a(p)}l||(h&&h.then&&typeof h.then=="function"?h.then(o,a):h instanceof Error?a(h):o(h))}function a(c,...l){n||(n=!0,t(c,...l))}function o(c){a(null,c)}}const Lr={basename:UL,dirname:FL,extname:VL,join:GL,sep:"/"};function UL(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');gl(e);let n=0,s=-1,a=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(o){n=a+1;break}}else s<0&&(o=!0,s=a+1);return s<0?"":e.slice(n,s)}if(t===e)return"";let c=-1,l=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(o){n=a+1;break}}else c<0&&(o=!0,c=a+1),l>-1&&(e.codePointAt(a)===t.codePointAt(l--)?l<0&&(s=a):(l=-1,s=c));return n===s?s=c:s<0&&(s=e.length),e.slice(n,s)}function FL(e){if(gl(e),e.length===0)return".";let t=-1,n=e.length,s;for(;--n;)if(e.codePointAt(n)===47){if(s){t=n;break}}else s||(s=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function VL(e){gl(e);let t=e.length,n=-1,s=0,a=-1,o=0,c;for(;t--;){const l=e.codePointAt(t);if(l===47){if(c){s=t+1;break}continue}n<0&&(c=!0,n=t+1),l===46?a<0?a=t:o!==1&&(o=1):a>-1&&(o=-1)}return a<0||n<0||o===0||o===1&&a===n-1&&a===s+1?"":e.slice(a,n)}function GL(...e){let t=-1,n;for(;++t<e.length;)gl(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":WL(n)}function WL(e){gl(e);const t=e.codePointAt(0)===47;let n=qL(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function qL(e,t){let n="",s=0,a=-1,o=0,c=-1,l,h;for(;++c<=e.length;){if(c<e.length)l=e.codePointAt(c);else{if(l===47)break;l=47}if(l===47){if(!(a===c-1||o===1))if(a!==c-1&&o===2){if(n.length<2||s!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(h=n.lastIndexOf("/"),h!==n.length-1){h<0?(n="",s=0):(n=n.slice(0,h),s=n.length-1-n.lastIndexOf("/")),a=c,o=0;continue}}else if(n.length>0){n="",s=0,a=c,o=0;continue}}t&&(n=n.length>0?n+"/..":"..",s=2)}else n.length>0?n+="/"+e.slice(a+1,c):n=e.slice(a+1,c),s=c-a-1;a=c,o=0}else l===46&&o>-1?o++:o=-1}return n}function gl(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const KL={cwd:YL};function YL(){return"/"}function wm(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function XL(e){if(typeof e=="string")e=new URL(e);else if(!wm(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return QL(e)}function QL(e){if(e.hostname!==""){const s=new TypeError('File URL host must be "localhost" or empty on darwin');throw s.code="ERR_INVALID_FILE_URL_HOST",s}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const s=t.codePointAt(n+2);if(s===70||s===102){const a=new TypeError("File URL path must not include encoded / characters");throw a.code="ERR_INVALID_FILE_URL_PATH",a}}return decodeURIComponent(t)}const Rf=["history","path","basename","stem","extname","dirname"];class c1{constructor(t){let n;t?wm(t)?n={path:t}:typeof t=="string"||JL(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":KL.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<Rf.length;){const o=Rf[s];o in n&&n[o]!==void 0&&n[o]!==null&&(this[o]=o==="history"?[...n[o]]:n[o])}let a;for(a in n)Rf.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?Lr.basename(this.path):void 0}set basename(t){Mf(t,"basename"),Of(t,"basename"),this.path=Lr.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Lr.dirname(this.path):void 0}set dirname(t){_b(this.basename,"dirname"),this.path=Lr.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Lr.extname(this.path):void 0}set extname(t){if(Of(t,"extname"),_b(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Lr.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){wm(t)&&(t=XL(t)),Mf(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Lr.basename(this.path,this.extname):void 0}set stem(t){Mf(t,"stem"),Of(t,"stem"),this.path=Lr.join(this.dirname||"",t+(this.extname||""))}fail(t,n,s){const a=this.message(t,n,s);throw a.fatal=!0,a}info(t,n,s){const a=this.message(t,n,s);return a.fatal=void 0,a}message(t,n,s){const a=new En(t,n,s);return this.path&&(a.name=this.path+":"+a.name,a.file=this.path),a.fatal=!1,this.messages.push(a),a}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Of(e,t){if(e&&e.includes(Lr.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Lr.sep+"`")}function Mf(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function _b(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function JL(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const ZL=(function(e){const s=this.constructor.prototype,a=s[e],o=function(){return a.apply(o,arguments)};return Object.setPrototypeOf(o,s),o}),eR={}.hasOwnProperty;class Sp extends ZL{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=HL()}copy(){const t=new Sp;let n=-1;for(;++n<this.attachers.length;){const s=this.attachers[n];t.use(...s)}return t.data(Lf(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Bf("data",this.frozen),this.namespace[t]=n,this):eR.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Bf("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...s]=this.attachers[this.freezeIndex];if(s[0]===!1)continue;s[0]===!0&&(s[0]=void 0);const a=n.call(t,...s);typeof a=="function"&&this.transformers.use(a)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Hc(t),s=this.parser||this.Parser;return If("parse",s),s(String(n),n)}process(t,n){const s=this;return this.freeze(),If("process",this.parser||this.Parser),Pf("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(o,c){const l=Hc(t),h=s.parse(l);s.run(h,l,function(p,m,_){if(p||!m||!_)return f(p);const y=m,w=s.stringify(y,_);rR(w)?_.value=w:_.result=w,f(p,_)});function f(p,m){p||!m?c(p):o?o(m):n(void 0,m)}}}processSync(t){let n=!1,s;return this.freeze(),If("processSync",this.parser||this.Parser),Pf("processSync",this.compiler||this.Compiler),this.process(t,a),vb("processSync","process",n),s;function a(o,c){n=!0,gb(o),s=c}}run(t,n,s){yb(t),this.freeze();const a=this.transformers;return!s&&typeof n=="function"&&(s=n,n=void 0),s?o(void 0,s):new Promise(o);function o(c,l){const h=Hc(n);a.run(t,h,f);function f(p,m,_){const y=m||t;p?l(p):c?c(y):s(void 0,y,_)}}}runSync(t,n){let s=!1,a;return this.run(t,n,o),vb("runSync","run",s),a;function o(c,l){gb(c),a=l,s=!0}}stringify(t,n){this.freeze();const s=Hc(n),a=this.compiler||this.Compiler;return Pf("stringify",a),yb(t),a(t,s)}use(t,...n){const s=this.attachers,a=this.namespace;if(Bf("use",this.frozen),t!=null)if(typeof t=="function")h(t,n);else if(typeof t=="object")Array.isArray(t)?l(t):c(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function o(f){if(typeof f=="function")h(f,[]);else if(typeof f=="object")if(Array.isArray(f)){const[p,...m]=f;h(p,m)}else c(f);else throw new TypeError("Expected usable value, not `"+f+"`")}function c(f){if(!("plugins"in f)&&!("settings"in f))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(f.plugins),f.settings&&(a.settings=Lf(!0,a.settings,f.settings))}function l(f){let p=-1;if(f!=null)if(Array.isArray(f))for(;++p<f.length;){const m=f[p];o(m)}else throw new TypeError("Expected a list of plugins, not `"+f+"`")}function h(f,p){let m=-1,_=-1;for(;++m<s.length;)if(s[m][0]===f){_=m;break}if(_===-1)s.push([f,...p]);else if(p.length>0){let[y,...w]=p;const k=s[_][1];Sm(k)&&Sm(y)&&(y=Lf(!0,k,y)),s[_]=[f,y,...w]}}}}const tR=new Sp().freeze();function If(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Pf(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Bf(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function yb(e){if(!Sm(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function vb(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Hc(e){return nR(e)?e:new c1(e)}function nR(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function rR(e){return typeof e=="string"||sR(e)}function sR(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const iR="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",bb=[],Sb={allowDangerousHtml:!0},aR=/^(https?|ircs?|mailto|xmpp)$/i,oR=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function lR(e){const t=cR(e),n=uR(e);return dR(t.runSync(t.parse(n),n),e)}function cR(e){const t=e.rehypePlugins||bb,n=e.remarkPlugins||bb,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Sb}:Sb;return tR().use(FD).use(n).use(PL,s).use(t)}function uR(e){const t=e.children||"",n=new c1;return typeof t=="string"&&(n.value=t),n}function dR(e,t){const n=t.allowedElements,s=t.allowElement,a=t.components,o=t.disallowedElements,c=t.skipHtml,l=t.unwrapDisallowed,h=t.urlTransform||hR;for(const p of oR)Object.hasOwn(t,p.from)&&(""+p.from+(p.to?"use `"+p.to+"` instead":"remove it")+iR+p.id,void 0);return bp(e,f),EN(e,{Fragment:u.Fragment,components:a,ignoreInvalidStyle:!0,jsx:u.jsx,jsxs:u.jsxs,passKeys:!0,passNode:!0});function f(p,m,_){if(p.type==="raw"&&_&&typeof m=="number")return c?_.children.splice(m,1):_.children[m]={type:"text",value:p.value},m;if(p.type==="element"){let y;for(y in Tf)if(Object.hasOwn(Tf,y)&&Object.hasOwn(p.properties,y)){const w=p.properties[y],k=Tf[y];(k===null||k.includes(p.tagName))&&(p.properties[y]=h(String(w||""),y,p))}}if(p.type==="element"){let y=n?!n.includes(p.tagName):o?o.includes(p.tagName):!1;if(!y&&s&&typeof m=="number"&&(y=!s(p,m,_)),y&&_&&typeof m=="number")return l&&p.children?_.children.splice(m,1,...p.children):_.children.splice(m,1),m}}}function hR(e){const t=e.indexOf(":"),n=e.indexOf("?"),s=e.indexOf("#"),a=e.indexOf("/");return t===-1||a!==-1&&t>a||n!==-1&&t>n||s!==-1&&t>s||aR.test(e.slice(0,t))?e:""}function wb(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let s=0,a=n.indexOf(t);for(;a!==-1;)s++,a=n.indexOf(t,a+t.length);return s}function fR(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function mR(e,t,n){const a=Mu((n||{}).ignore||[]),o=pR(t);let c=-1;for(;++c<o.length;)l1(e,"text",l);function l(f,p){let m=-1,_;for(;++m<p.length;){const y=p[m],w=_?_.children:void 0;if(a(y,w?w.indexOf(y):void 0,_))return;_=y}if(_)return h(f,p)}function h(f,p){const m=p[p.length-1],_=o[c][0],y=o[c][1];let w=0;const v=m.children.indexOf(f);let b=!1,x=[];_.lastIndex=0;let S=_.exec(f.value);for(;S;){const j=S.index,N={index:S.index,input:S.input,stack:[...p,f]};let T=y(...S,N);if(typeof T=="string"&&(T=T.length>0?{type:"text",value:T}:void 0),T===!1?_.lastIndex=j+1:(w!==j&&x.push({type:"text",value:f.value.slice(w,j)}),Array.isArray(T)?x.push(...T):T&&x.push(T),w=j+S[0].length,b=!0),!_.global)break;S=_.exec(f.value)}return b?(w<f.value.length&&x.push({type:"text",value:f.value.slice(w)}),m.children.splice(v,1,...x)):x=[f],v+x.length}}function pR(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let s=-1;for(;++s<n.length;){const a=n[s];t.push([gR(a[0]),xR(a[1])])}return t}function gR(e){return typeof e=="string"?new RegExp(fR(e),"g"):e}function xR(e){return typeof e=="function"?e:function(){return e}}const zf="phrasing",Hf=["autolink","link","image","label"];function _R(){return{transforms:[kR],enter:{literalAutolink:vR,literalAutolinkEmail:$f,literalAutolinkHttp:$f,literalAutolinkWww:$f},exit:{literalAutolink:CR,literalAutolinkEmail:wR,literalAutolinkHttp:bR,literalAutolinkWww:SR}}}function yR(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:zf,notInConstruct:Hf},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:zf,notInConstruct:Hf},{character:":",before:"[ps]",after:"\\/",inConstruct:zf,notInConstruct:Hf}]}}function vR(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function $f(e){this.config.enter.autolinkProtocol.call(this,e)}function bR(e){this.config.exit.autolinkProtocol.call(this,e)}function SR(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function wR(e){this.config.exit.autolinkEmail.call(this,e)}function CR(e){this.exit(e)}function kR(e){mR(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,ER],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),jR]],{ignore:["link","linkReference"]})}function ER(e,t,n,s,a){let o="";if(!u1(a)||(/^w/i.test(t)&&(n=t+n,t="",o="http://"),!TR(n)))return!1;const c=NR(n+s);if(!c[0])return!1;const l={type:"link",title:null,url:o+t+c[0],children:[{type:"text",value:t+c[0]}]};return c[1]?[l,{type:"text",value:c[1]}]:l}function jR(e,t,n,s){return!u1(s,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function TR(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function NR(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],s=n.indexOf(")");const a=wb(e,"(");let o=wb(e,")");for(;s!==-1&&a>o;)e+=n.slice(0,s+1),n=n.slice(s+1),s=n.indexOf(")"),o++;return[e,n]}function u1(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||ki(n)||Lu(n))&&(!t||n!==47)}d1.peek=BR;function AR(){this.buffer()}function DR(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function LR(){this.buffer()}function RR(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function OR(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=br(this.sliceSerialize(e)).toLowerCase(),n.label=t}function MR(e){this.exit(e)}function IR(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=br(this.sliceSerialize(e)).toLowerCase(),n.label=t}function PR(e){this.exit(e)}function BR(){return"["}function d1(e,t,n,s){const a=n.createTracker(s);let o=a.move("[^");const c=n.enter("footnoteReference"),l=n.enter("reference");return o+=a.move(n.safe(n.associationId(e),{after:"]",before:o})),l(),c(),o+=a.move("]"),o}function zR(){return{enter:{gfmFootnoteCallString:AR,gfmFootnoteCall:DR,gfmFootnoteDefinitionLabelString:LR,gfmFootnoteDefinition:RR},exit:{gfmFootnoteCallString:OR,gfmFootnoteCall:MR,gfmFootnoteDefinitionLabelString:IR,gfmFootnoteDefinition:PR}}}function HR(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:d1},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(s,a,o,c){const l=o.createTracker(c);let h=l.move("[^");const f=o.enter("footnoteDefinition"),p=o.enter("label");return h+=l.move(o.safe(o.associationId(s),{before:h,after:"]"})),p(),h+=l.move("]:"),s.children&&s.children.length>0&&(l.shift(4),h+=l.move((t?`
108
+ `:" ")+o.indentLines(o.containerFlow(s,l.current()),t?h1:$R))),f(),h}}function $R(e,t,n){return t===0?e:h1(e,t,n)}function h1(e,t,n){return(n?"":" ")+e}const UR=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];f1.peek=qR;function FR(){return{canContainEols:["delete"],enter:{strikethrough:GR},exit:{strikethrough:WR}}}function VR(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:UR}],handlers:{delete:f1}}}function GR(e){this.enter({type:"delete",children:[]},e)}function WR(e){this.exit(e)}function f1(e,t,n,s){const a=n.createTracker(s),o=n.enter("strikethrough");let c=a.move("~~");return c+=n.containerPhrasing(e,{...a.current(),before:c,after:"~"}),c+=a.move("~~"),o(),c}function qR(){return"~"}function KR(e){return e.length}function YR(e,t){const n=t||{},s=(n.align||[]).concat(),a=n.stringLength||KR,o=[],c=[],l=[],h=[];let f=0,p=-1;for(;++p<e.length;){const k=[],v=[];let b=-1;for(e[p].length>f&&(f=e[p].length);++b<e[p].length;){const x=XR(e[p][b]);if(n.alignDelimiters!==!1){const S=a(x);v[b]=S,(h[b]===void 0||S>h[b])&&(h[b]=S)}k.push(x)}c[p]=k,l[p]=v}let m=-1;if(typeof s=="object"&&"length"in s)for(;++m<f;)o[m]=Cb(s[m]);else{const k=Cb(s);for(;++m<f;)o[m]=k}m=-1;const _=[],y=[];for(;++m<f;){const k=o[m];let v="",b="";k===99?(v=":",b=":"):k===108?v=":":k===114&&(b=":");let x=n.alignDelimiters===!1?1:Math.max(1,h[m]-v.length-b.length);const S=v+"-".repeat(x)+b;n.alignDelimiters!==!1&&(x=v.length+x+b.length,x>h[m]&&(h[m]=x),y[m]=x),_[m]=S}c.splice(1,0,_),l.splice(1,0,y),p=-1;const w=[];for(;++p<c.length;){const k=c[p],v=l[p];m=-1;const b=[];for(;++m<f;){const x=k[m]||"";let S="",j="";if(n.alignDelimiters!==!1){const N=h[m]-(v[m]||0),T=o[m];T===114?S=" ".repeat(N):T===99?N%2?(S=" ".repeat(N/2+.5),j=" ".repeat(N/2-.5)):(S=" ".repeat(N/2),j=S):j=" ".repeat(N)}n.delimiterStart!==!1&&!m&&b.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&x==="")&&(n.delimiterStart!==!1||m)&&b.push(" "),n.alignDelimiters!==!1&&b.push(S),b.push(x),n.alignDelimiters!==!1&&b.push(j),n.padding!==!1&&b.push(" "),(n.delimiterEnd!==!1||m!==f-1)&&b.push("|")}w.push(n.delimiterEnd===!1?b.join("").replace(/ +$/,""):b.join(""))}return w.join(`
109
+ `)}function XR(e){return e==null?"":String(e)}function Cb(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function QR(e,t,n,s){const a=n.enter("blockquote"),o=n.createTracker(s);o.move("> "),o.shift(2);const c=n.indentLines(n.containerFlow(e,o.current()),JR);return a(),c}function JR(e,t,n){return">"+(n?"":" ")+e}function ZR(e,t){return kb(e,t.inConstruct,!0)&&!kb(e,t.notInConstruct,!1)}function kb(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let s=-1;for(;++s<t.length;)if(e.includes(t[s]))return!0;return!1}function Eb(e,t,n,s){let a=-1;for(;++a<n.unsafe.length;)if(n.unsafe[a].character===`
110
+ `&&ZR(n.stack,n.unsafe[a]))return/[ \t]/.test(s.before)?"":" ";return`\\
111
+ `}function e3(e,t){const n=String(e);let s=n.indexOf(t),a=s,o=0,c=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;s!==-1;)s===a?++o>c&&(c=o):o=1,a=s+t.length,s=n.indexOf(t,a);return c}function t3(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function n3(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function r3(e,t,n,s){const a=n3(n),o=e.value||"",c=a==="`"?"GraveAccent":"Tilde";if(t3(e,n)){const m=n.enter("codeIndented"),_=n.indentLines(o,s3);return m(),_}const l=n.createTracker(s),h=a.repeat(Math.max(e3(o,a)+1,3)),f=n.enter("codeFenced");let p=l.move(h);if(e.lang){const m=n.enter(`codeFencedLang${c}`);p+=l.move(n.safe(e.lang,{before:p,after:" ",encode:["`"],...l.current()})),m()}if(e.lang&&e.meta){const m=n.enter(`codeFencedMeta${c}`);p+=l.move(" "),p+=l.move(n.safe(e.meta,{before:p,after:`
112
+ `,encode:["`"],...l.current()})),m()}return p+=l.move(`
113
+ `),o&&(p+=l.move(o+`
114
+ `)),p+=l.move(h),f(),p}function s3(e,t,n){return(n?"":" ")+e}function wp(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function i3(e,t,n,s){const a=wp(n),o=a==='"'?"Quote":"Apostrophe",c=n.enter("definition");let l=n.enter("label");const h=n.createTracker(s);let f=h.move("[");return f+=h.move(n.safe(n.associationId(e),{before:f,after:"]",...h.current()})),f+=h.move("]: "),l(),!e.url||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),f+=h.move("<"),f+=h.move(n.safe(e.url,{before:f,after:">",...h.current()})),f+=h.move(">")):(l=n.enter("destinationRaw"),f+=h.move(n.safe(e.url,{before:f,after:e.title?" ":`
115
+ `,...h.current()}))),l(),e.title&&(l=n.enter(`title${o}`),f+=h.move(" "+a),f+=h.move(n.safe(e.title,{before:f,after:a,...h.current()})),f+=h.move(a),l()),c(),f}function a3(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function rl(e){return"&#x"+e.toString(16).toUpperCase()+";"}function au(e,t,n){const s=Ra(e),a=Ra(t);return s===void 0?a===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:s===1?a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}m1.peek=o3;function m1(e,t,n,s){const a=a3(n),o=n.enter("emphasis"),c=n.createTracker(s),l=c.move(a);let h=c.move(n.containerPhrasing(e,{after:a,before:l,...c.current()}));const f=h.charCodeAt(0),p=au(s.before.charCodeAt(s.before.length-1),f,a);p.inside&&(h=rl(f)+h.slice(1));const m=h.charCodeAt(h.length-1),_=au(s.after.charCodeAt(0),m,a);_.inside&&(h=h.slice(0,-1)+rl(m));const y=c.move(a);return o(),n.attentionEncodeSurroundingInfo={after:_.outside,before:p.outside},l+h+y}function o3(e,t,n){return n.options.emphasis||"*"}function l3(e,t){let n=!1;return bp(e,function(s){if("value"in s&&/\r?\n|\r/.test(s.value)||s.type==="break")return n=!0,vm}),!!((!e.depth||e.depth<3)&&mp(e)&&(t.options.setext||n))}function c3(e,t,n,s){const a=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(s);if(l3(e,n)){const p=n.enter("headingSetext"),m=n.enter("phrasing"),_=n.containerPhrasing(e,{...o.current(),before:`
116
+ `,after:`
117
+ `});return m(),p(),_+`
118
+ `+(a===1?"=":"-").repeat(_.length-(Math.max(_.lastIndexOf("\r"),_.lastIndexOf(`
119
+ `))+1))}const c="#".repeat(a),l=n.enter("headingAtx"),h=n.enter("phrasing");o.move(c+" ");let f=n.containerPhrasing(e,{before:"# ",after:`
120
+ `,...o.current()});return/^[\t ]/.test(f)&&(f=rl(f.charCodeAt(0))+f.slice(1)),f=f?c+" "+f:c,n.options.closeAtx&&(f+=" "+c),h(),l(),f}p1.peek=u3;function p1(e){return e.value||""}function u3(){return"<"}g1.peek=d3;function g1(e,t,n,s){const a=wp(n),o=a==='"'?"Quote":"Apostrophe",c=n.enter("image");let l=n.enter("label");const h=n.createTracker(s);let f=h.move("![");return f+=h.move(n.safe(e.alt,{before:f,after:"]",...h.current()})),f+=h.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),f+=h.move("<"),f+=h.move(n.safe(e.url,{before:f,after:">",...h.current()})),f+=h.move(">")):(l=n.enter("destinationRaw"),f+=h.move(n.safe(e.url,{before:f,after:e.title?" ":")",...h.current()}))),l(),e.title&&(l=n.enter(`title${o}`),f+=h.move(" "+a),f+=h.move(n.safe(e.title,{before:f,after:a,...h.current()})),f+=h.move(a),l()),f+=h.move(")"),c(),f}function d3(){return"!"}x1.peek=h3;function x1(e,t,n,s){const a=e.referenceType,o=n.enter("imageReference");let c=n.enter("label");const l=n.createTracker(s);let h=l.move("![");const f=n.safe(e.alt,{before:h,after:"]",...l.current()});h+=l.move(f+"]["),c();const p=n.stack;n.stack=[],c=n.enter("reference");const m=n.safe(n.associationId(e),{before:h,after:"]",...l.current()});return c(),n.stack=p,o(),a==="full"||!f||f!==m?h+=l.move(m+"]"):a==="shortcut"?h=h.slice(0,-1):h+=l.move("]"),h}function h3(){return"!"}_1.peek=f3;function _1(e,t,n){let s=e.value||"",a="`",o=-1;for(;new RegExp("(^|[^`])"+a+"([^`]|$)").test(s);)a+="`";for(/[^ \r\n]/.test(s)&&(/^[ \r\n]/.test(s)&&/[ \r\n]$/.test(s)||/^`|`$/.test(s))&&(s=" "+s+" ");++o<n.unsafe.length;){const c=n.unsafe[o],l=n.compilePattern(c);let h;if(c.atBreak)for(;h=l.exec(s);){let f=h.index;s.charCodeAt(f)===10&&s.charCodeAt(f-1)===13&&f--,s=s.slice(0,f)+" "+s.slice(h.index+1)}}return a+s+a}function f3(){return"`"}function y1(e,t){const n=mp(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}v1.peek=m3;function v1(e,t,n,s){const a=wp(n),o=a==='"'?"Quote":"Apostrophe",c=n.createTracker(s);let l,h;if(y1(e,n)){const p=n.stack;n.stack=[],l=n.enter("autolink");let m=c.move("<");return m+=c.move(n.containerPhrasing(e,{before:m,after:">",...c.current()})),m+=c.move(">"),l(),n.stack=p,m}l=n.enter("link"),h=n.enter("label");let f=c.move("[");return f+=c.move(n.containerPhrasing(e,{before:f,after:"](",...c.current()})),f+=c.move("]("),h(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(h=n.enter("destinationLiteral"),f+=c.move("<"),f+=c.move(n.safe(e.url,{before:f,after:">",...c.current()})),f+=c.move(">")):(h=n.enter("destinationRaw"),f+=c.move(n.safe(e.url,{before:f,after:e.title?" ":")",...c.current()}))),h(),e.title&&(h=n.enter(`title${o}`),f+=c.move(" "+a),f+=c.move(n.safe(e.title,{before:f,after:a,...c.current()})),f+=c.move(a),h()),f+=c.move(")"),l(),f}function m3(e,t,n){return y1(e,n)?"<":"["}b1.peek=p3;function b1(e,t,n,s){const a=e.referenceType,o=n.enter("linkReference");let c=n.enter("label");const l=n.createTracker(s);let h=l.move("[");const f=n.containerPhrasing(e,{before:h,after:"]",...l.current()});h+=l.move(f+"]["),c();const p=n.stack;n.stack=[],c=n.enter("reference");const m=n.safe(n.associationId(e),{before:h,after:"]",...l.current()});return c(),n.stack=p,o(),a==="full"||!f||f!==m?h+=l.move(m+"]"):a==="shortcut"?h=h.slice(0,-1):h+=l.move("]"),h}function p3(){return"["}function Cp(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function g3(e){const t=Cp(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function x3(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function S1(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function _3(e,t,n,s){const a=n.enter("list"),o=n.bulletCurrent;let c=e.ordered?x3(n):Cp(n);const l=e.ordered?c==="."?")":".":g3(n);let h=t&&n.bulletLastUsed?c===n.bulletLastUsed:!1;if(!e.ordered){const p=e.children?e.children[0]:void 0;if((c==="*"||c==="-")&&p&&(!p.children||!p.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(h=!0),S1(n)===c&&p){let m=-1;for(;++m<e.children.length;){const _=e.children[m];if(_&&_.type==="listItem"&&_.children&&_.children[0]&&_.children[0].type==="thematicBreak"){h=!0;break}}}}h&&(c=l),n.bulletCurrent=c;const f=n.containerFlow(e,s);return n.bulletLastUsed=c,n.bulletCurrent=o,a(),f}function y3(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function v3(e,t,n,s){const a=y3(n);let o=n.bulletCurrent||Cp(n);t&&t.type==="list"&&t.ordered&&(o=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+o);let c=o.length+1;(a==="tab"||a==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(c=Math.ceil(c/4)*4);const l=n.createTracker(s);l.move(o+" ".repeat(c-o.length)),l.shift(c);const h=n.enter("listItem"),f=n.indentLines(n.containerFlow(e,l.current()),p);return h(),f;function p(m,_,y){return _?(y?"":" ".repeat(c))+m:(y?o:o+" ".repeat(c-o.length))+m}}function b3(e,t,n,s){const a=n.enter("paragraph"),o=n.enter("phrasing"),c=n.containerPhrasing(e,s);return o(),a(),c}const S3=Mu(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function w3(e,t,n,s){return(e.children.some(function(c){return S3(c)})?n.containerPhrasing:n.containerFlow).call(n,e,s)}function C3(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}w1.peek=k3;function w1(e,t,n,s){const a=C3(n),o=n.enter("strong"),c=n.createTracker(s),l=c.move(a+a);let h=c.move(n.containerPhrasing(e,{after:a,before:l,...c.current()}));const f=h.charCodeAt(0),p=au(s.before.charCodeAt(s.before.length-1),f,a);p.inside&&(h=rl(f)+h.slice(1));const m=h.charCodeAt(h.length-1),_=au(s.after.charCodeAt(0),m,a);_.inside&&(h=h.slice(0,-1)+rl(m));const y=c.move(a+a);return o(),n.attentionEncodeSurroundingInfo={after:_.outside,before:p.outside},l+h+y}function k3(e,t,n){return n.options.strong||"*"}function E3(e,t,n,s){return n.safe(e.value,s)}function j3(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function T3(e,t,n){const s=(S1(n)+(n.options.ruleSpaces?" ":"")).repeat(j3(n));return n.options.ruleSpaces?s.slice(0,-1):s}const C1={blockquote:QR,break:Eb,code:r3,definition:i3,emphasis:m1,hardBreak:Eb,heading:c3,html:p1,image:g1,imageReference:x1,inlineCode:_1,link:v1,linkReference:b1,list:_3,listItem:v3,paragraph:b3,root:w3,strong:w1,text:E3,thematicBreak:T3};function N3(){return{enter:{table:A3,tableData:jb,tableHeader:jb,tableRow:L3},exit:{codeText:R3,table:D3,tableData:Uf,tableHeader:Uf,tableRow:Uf}}}function A3(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function D3(e){this.exit(e),this.data.inTable=void 0}function L3(e){this.enter({type:"tableRow",children:[]},e)}function Uf(e){this.exit(e)}function jb(e){this.enter({type:"tableCell",children:[]},e)}function R3(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,O3));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function O3(e,t){return t==="|"?t:e}function M3(e){const t=e||{},n=t.tableCellPadding,s=t.tablePipeAlign,a=t.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
121
+ `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:_,table:c,tableCell:h,tableRow:l}};function c(y,w,k,v){return f(p(y,k,v),y.align)}function l(y,w,k,v){const b=m(y,k,v),x=f([b]);return x.slice(0,x.indexOf(`
122
+ `))}function h(y,w,k,v){const b=k.enter("tableCell"),x=k.enter("phrasing"),S=k.containerPhrasing(y,{...v,before:o,after:o});return x(),b(),S}function f(y,w){return YR(y,{align:w,alignDelimiters:s,padding:n,stringLength:a})}function p(y,w,k){const v=y.children;let b=-1;const x=[],S=w.enter("table");for(;++b<v.length;)x[b]=m(v[b],w,k);return S(),x}function m(y,w,k){const v=y.children;let b=-1;const x=[],S=w.enter("tableRow");for(;++b<v.length;)x[b]=h(v[b],y,w,k);return S(),x}function _(y,w,k){let v=C1.inlineCode(y,w,k);return k.stack.includes("tableCell")&&(v=v.replace(/\|/g,"\\$&")),v}}function I3(){return{exit:{taskListCheckValueChecked:Tb,taskListCheckValueUnchecked:Tb,paragraph:B3}}}function P3(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:z3}}}function Tb(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function B3(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const s=n.children[0];if(s&&s.type==="text"){const a=t.children;let o=-1,c;for(;++o<a.length;){const l=a[o];if(l.type==="paragraph"){c=l;break}}c===n&&(s.value=s.value.slice(1),s.value.length===0?n.children.shift():n.position&&s.position&&typeof s.position.start.offset=="number"&&(s.position.start.column++,s.position.start.offset++,n.position.start=Object.assign({},s.position.start)))}}this.exit(e)}function z3(e,t,n,s){const a=e.children[0],o=typeof e.checked=="boolean"&&a&&a.type==="paragraph",c="["+(e.checked?"x":" ")+"] ",l=n.createTracker(s);o&&l.move(c);let h=C1.listItem(e,t,n,{...s,...l.current()});return o&&(h=h.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,f)),h;function f(p){return p+c}}function H3(){return[_R(),zR(),FR(),N3(),I3()]}function $3(e){return{extensions:[yR(),HR(e),VR(),M3(e),P3()]}}const U3={tokenize:K3,partial:!0},k1={tokenize:Y3,partial:!0},E1={tokenize:X3,partial:!0},j1={tokenize:Q3,partial:!0},F3={tokenize:J3,partial:!0},T1={name:"wwwAutolink",tokenize:W3,previous:A1},N1={name:"protocolAutolink",tokenize:q3,previous:D1},us={name:"emailAutolink",tokenize:G3,previous:L1},Pr={};function V3(){return{text:Pr}}let di=48;for(;di<123;)Pr[di]=us,di++,di===58?di=65:di===91&&(di=97);Pr[43]=us;Pr[45]=us;Pr[46]=us;Pr[95]=us;Pr[72]=[us,N1];Pr[104]=[us,N1];Pr[87]=[us,T1];Pr[119]=[us,T1];function G3(e,t,n){const s=this;let a,o;return c;function c(m){return!Cm(m)||!L1.call(s,s.previous)||kp(s.events)?n(m):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),l(m))}function l(m){return Cm(m)?(e.consume(m),l):m===64?(e.consume(m),h):n(m)}function h(m){return m===46?e.check(F3,p,f)(m):m===45||m===95||kn(m)?(o=!0,e.consume(m),h):p(m)}function f(m){return e.consume(m),a=!0,h}function p(m){return o&&a&&Nn(s.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(m)):n(m)}}function W3(e,t,n){const s=this;return a;function a(c){return c!==87&&c!==119||!A1.call(s,s.previous)||kp(s.events)?n(c):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(U3,e.attempt(k1,e.attempt(E1,o),n),n)(c))}function o(c){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(c)}}function q3(e,t,n){const s=this;let a="",o=!1;return c;function c(m){return(m===72||m===104)&&D1.call(s,s.previous)&&!kp(s.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),a+=String.fromCodePoint(m),e.consume(m),l):n(m)}function l(m){if(Nn(m)&&a.length<5)return a+=String.fromCodePoint(m),e.consume(m),l;if(m===58){const _=a.toLowerCase();if(_==="http"||_==="https")return e.consume(m),h}return n(m)}function h(m){return m===47?(e.consume(m),o?f:(o=!0,h)):n(m)}function f(m){return m===null||ru(m)||kt(m)||ki(m)||Lu(m)?n(m):e.attempt(k1,e.attempt(E1,p),n)(m)}function p(m){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(m)}}function K3(e,t,n){let s=0;return a;function a(c){return(c===87||c===119)&&s<3?(s++,e.consume(c),a):c===46&&s===3?(e.consume(c),o):n(c)}function o(c){return c===null?n(c):t(c)}}function Y3(e,t,n){let s,a,o;return c;function c(f){return f===46||f===95?e.check(j1,h,l)(f):f===null||kt(f)||ki(f)||f!==45&&Lu(f)?h(f):(o=!0,e.consume(f),c)}function l(f){return f===95?s=!0:(a=s,s=void 0),e.consume(f),c}function h(f){return a||s||!o?n(f):t(f)}}function X3(e,t){let n=0,s=0;return a;function a(c){return c===40?(n++,e.consume(c),a):c===41&&s<n?o(c):c===33||c===34||c===38||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===60||c===63||c===93||c===95||c===126?e.check(j1,t,o)(c):c===null||kt(c)||ki(c)?t(c):(e.consume(c),a)}function o(c){return c===41&&s++,e.consume(c),a}}function Q3(e,t,n){return s;function s(l){return l===33||l===34||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===63||l===95||l===126?(e.consume(l),s):l===38?(e.consume(l),o):l===93?(e.consume(l),a):l===60||l===null||kt(l)||ki(l)?t(l):n(l)}function a(l){return l===null||l===40||l===91||kt(l)||ki(l)?t(l):s(l)}function o(l){return Nn(l)?c(l):n(l)}function c(l){return l===59?(e.consume(l),s):Nn(l)?(e.consume(l),c):n(l)}}function J3(e,t,n){return s;function s(o){return e.consume(o),a}function a(o){return kn(o)?n(o):t(o)}}function A1(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||kt(e)}function D1(e){return!Nn(e)}function L1(e){return!(e===47||Cm(e))}function Cm(e){return e===43||e===45||e===46||e===95||kn(e)}function kp(e){let t=e.length,n=!1;for(;t--;){const s=e[t][1];if((s.type==="labelLink"||s.type==="labelImage")&&!s._balanced){n=!0;break}if(s._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const Z3={tokenize:o5,partial:!0};function e5(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:s5,continuation:{tokenize:i5},exit:a5}},text:{91:{name:"gfmFootnoteCall",tokenize:r5},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:t5,resolveTo:n5}}}}function t5(e,t,n){const s=this;let a=s.events.length;const o=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let c;for(;a--;){const h=s.events[a][1];if(h.type==="labelImage"){c=h;break}if(h.type==="gfmFootnoteCall"||h.type==="labelLink"||h.type==="label"||h.type==="image"||h.type==="link")break}return l;function l(h){if(!c||!c._balanced)return n(h);const f=br(s.sliceSerialize({start:c.end,end:s.now()}));return f.codePointAt(0)!==94||!o.includes(f.slice(1))?n(h):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),t(h))}}function n5(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const s={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},e[e.length-1][1].start)},c={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},l=[e[n+1],e[n+2],["enter",s,t],e[n+3],e[n+4],["enter",a,t],["exit",a,t],["enter",o,t],["enter",c,t],["exit",c,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",s,t]];return e.splice(n,e.length-n+1,...l),e}function r5(e,t,n){const s=this,a=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let o=0,c;return l;function l(m){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),h}function h(m){return m!==94?n(m):(e.enter("gfmFootnoteCallMarker"),e.consume(m),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",f)}function f(m){if(o>999||m===93&&!c||m===null||m===91||kt(m))return n(m);if(m===93){e.exit("chunkString");const _=e.exit("gfmFootnoteCallString");return a.includes(br(s.sliceSerialize(_)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(m)}return kt(m)||(c=!0),o++,e.consume(m),m===92?p:f}function p(m){return m===91||m===92||m===93?(e.consume(m),o++,f):f(m)}}function s5(e,t,n){const s=this,a=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let o,c=0,l;return h;function h(w){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionLabelMarker"),f}function f(w){return w===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",p):n(w)}function p(w){if(c>999||w===93&&!l||w===null||w===91||kt(w))return n(w);if(w===93){e.exit("chunkString");const k=e.exit("gfmFootnoteDefinitionLabelString");return o=br(s.sliceSerialize(k)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),_}return kt(w)||(l=!0),c++,e.consume(w),w===92?m:p}function m(w){return w===91||w===92||w===93?(e.consume(w),c++,p):p(w)}function _(w){return w===58?(e.enter("definitionMarker"),e.consume(w),e.exit("definitionMarker"),a.includes(o)||a.push(o),mt(e,y,"gfmFootnoteDefinitionWhitespace")):n(w)}function y(w){return t(w)}}function i5(e,t,n){return e.check(pl,t,e.attempt(Z3,t,n))}function a5(e){e.exit("gfmFootnoteDefinition")}function o5(e,t,n){const s=this;return mt(e,a,"gfmFootnoteDefinitionIndent",5);function a(o){const c=s.events[s.events.length-1];return c&&c[1].type==="gfmFootnoteDefinitionIndent"&&c[2].sliceSerialize(c[1],!0).length===4?t(o):n(o)}}function l5(e){let n=(e||{}).singleTilde;const s={name:"strikethrough",tokenize:o,resolveAll:a};return n==null&&(n=!0),{text:{126:s},insideSpan:{null:[s]},attentionMarkers:{null:[126]}};function a(c,l){let h=-1;for(;++h<c.length;)if(c[h][0]==="enter"&&c[h][1].type==="strikethroughSequenceTemporary"&&c[h][1]._close){let f=h;for(;f--;)if(c[f][0]==="exit"&&c[f][1].type==="strikethroughSequenceTemporary"&&c[f][1]._open&&c[h][1].end.offset-c[h][1].start.offset===c[f][1].end.offset-c[f][1].start.offset){c[h][1].type="strikethroughSequence",c[f][1].type="strikethroughSequence";const p={type:"strikethrough",start:Object.assign({},c[f][1].start),end:Object.assign({},c[h][1].end)},m={type:"strikethroughText",start:Object.assign({},c[f][1].end),end:Object.assign({},c[h][1].start)},_=[["enter",p,l],["enter",c[f][1],l],["exit",c[f][1],l],["enter",m,l]],y=l.parser.constructs.insideSpan.null;y&&Qn(_,_.length,0,Ru(y,c.slice(f+1,h),l)),Qn(_,_.length,0,[["exit",m,l],["enter",c[h][1],l],["exit",c[h][1],l],["exit",p,l]]),Qn(c,f-1,h-f+3,_),h=f+_.length-2;break}}for(h=-1;++h<c.length;)c[h][1].type==="strikethroughSequenceTemporary"&&(c[h][1].type="data");return c}function o(c,l,h){const f=this.previous,p=this.events;let m=0;return _;function _(w){return f===126&&p[p.length-1][1].type!=="characterEscape"?h(w):(c.enter("strikethroughSequenceTemporary"),y(w))}function y(w){const k=Ra(f);if(w===126)return m>1?h(w):(c.consume(w),m++,y);if(m<2&&!n)return h(w);const v=c.exit("strikethroughSequenceTemporary"),b=Ra(w);return v._open=!b||b===2&&!!k,v._close=!k||k===2&&!!b,l(w)}}}class c5{constructor(){this.map=[]}add(t,n,s){u5(this,t,n,s)}consume(t){if(this.map.sort(function(o,c){return o[0]-c[0]}),this.map.length===0)return;let n=this.map.length;const s=[];for(;n>0;)n-=1,s.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];s.push(t.slice()),t.length=0;let a=s.pop();for(;a;){for(const o of a)t.push(o);a=s.pop()}this.map.length=0}}function u5(e,t,n,s){let a=0;if(!(n===0&&s.length===0)){for(;a<e.map.length;){if(e.map[a][0]===t){e.map[a][1]+=n,e.map[a][2].push(...s);return}a+=1}e.map.push([t,n,s])}}function d5(e,t){let n=!1;const s=[];for(;t<e.length;){const a=e[t];if(n){if(a[0]==="enter")a[1].type==="tableContent"&&s.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(a[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const o=s.length-1;s[o]=s[o]==="left"?"center":"right"}}else if(a[1].type==="tableDelimiterRow")break}else a[0]==="enter"&&a[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return s}function h5(){return{flow:{null:{name:"table",tokenize:f5,resolveAll:m5}}}}function f5(e,t,n){const s=this;let a=0,o=0,c;return l;function l(R){let $=s.events.length-1;for(;$>-1;){const Y=s.events[$][1].type;if(Y==="lineEnding"||Y==="linePrefix")$--;else break}const F=$>-1?s.events[$][1].type:null,W=F==="tableHead"||F==="tableRow"?T:h;return W===T&&s.parser.lazy[s.now().line]?n(R):W(R)}function h(R){return e.enter("tableHead"),e.enter("tableRow"),f(R)}function f(R){return R===124||(c=!0,o+=1),p(R)}function p(R){return R===null?n(R):Ue(R)?o>1?(o=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),y):n(R):ot(R)?mt(e,p,"whitespace")(R):(o+=1,c&&(c=!1,a+=1),R===124?(e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),c=!0,p):(e.enter("data"),m(R)))}function m(R){return R===null||R===124||kt(R)?(e.exit("data"),p(R)):(e.consume(R),R===92?_:m)}function _(R){return R===92||R===124?(e.consume(R),m):m(R)}function y(R){return s.interrupt=!1,s.parser.lazy[s.now().line]?n(R):(e.enter("tableDelimiterRow"),c=!1,ot(R)?mt(e,w,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):w(R))}function w(R){return R===45||R===58?v(R):R===124?(c=!0,e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),k):N(R)}function k(R){return ot(R)?mt(e,v,"whitespace")(R):v(R)}function v(R){return R===58?(o+=1,c=!0,e.enter("tableDelimiterMarker"),e.consume(R),e.exit("tableDelimiterMarker"),b):R===45?(o+=1,b(R)):R===null||Ue(R)?j(R):N(R)}function b(R){return R===45?(e.enter("tableDelimiterFiller"),x(R)):N(R)}function x(R){return R===45?(e.consume(R),x):R===58?(c=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(R),e.exit("tableDelimiterMarker"),S):(e.exit("tableDelimiterFiller"),S(R))}function S(R){return ot(R)?mt(e,j,"whitespace")(R):j(R)}function j(R){return R===124?w(R):R===null||Ue(R)?!c||a!==o?N(R):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(R)):N(R)}function N(R){return n(R)}function T(R){return e.enter("tableRow"),D(R)}function D(R){return R===124?(e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),D):R===null||Ue(R)?(e.exit("tableRow"),t(R)):ot(R)?mt(e,D,"whitespace")(R):(e.enter("data"),A(R))}function A(R){return R===null||R===124||kt(R)?(e.exit("data"),D(R)):(e.consume(R),R===92?B:A)}function B(R){return R===92||R===124?(e.consume(R),A):A(R)}}function m5(e,t){let n=-1,s=!0,a=0,o=[0,0,0,0],c=[0,0,0,0],l=!1,h=0,f,p,m;const _=new c5;for(;++n<e.length;){const y=e[n],w=y[1];y[0]==="enter"?w.type==="tableHead"?(l=!1,h!==0&&(Nb(_,t,h,f,p),p=void 0,h=0),f={type:"table",start:Object.assign({},w.start),end:Object.assign({},w.end)},_.add(n,0,[["enter",f,t]])):w.type==="tableRow"||w.type==="tableDelimiterRow"?(s=!0,m=void 0,o=[0,0,0,0],c=[0,n+1,0,0],l&&(l=!1,p={type:"tableBody",start:Object.assign({},w.start),end:Object.assign({},w.end)},_.add(n,0,[["enter",p,t]])),a=w.type==="tableDelimiterRow"?2:p?3:1):a&&(w.type==="data"||w.type==="tableDelimiterMarker"||w.type==="tableDelimiterFiller")?(s=!1,c[2]===0&&(o[1]!==0&&(c[0]=c[1],m=$c(_,t,o,a,void 0,m),o=[0,0,0,0]),c[2]=n)):w.type==="tableCellDivider"&&(s?s=!1:(o[1]!==0&&(c[0]=c[1],m=$c(_,t,o,a,void 0,m)),o=c,c=[o[1],n,0,0])):w.type==="tableHead"?(l=!0,h=n):w.type==="tableRow"||w.type==="tableDelimiterRow"?(h=n,o[1]!==0?(c[0]=c[1],m=$c(_,t,o,a,n,m)):c[1]!==0&&(m=$c(_,t,c,a,n,m)),a=0):a&&(w.type==="data"||w.type==="tableDelimiterMarker"||w.type==="tableDelimiterFiller")&&(c[3]=n)}for(h!==0&&Nb(_,t,h,f,p),_.consume(t.events),n=-1;++n<t.events.length;){const y=t.events[n];y[0]==="enter"&&y[1].type==="table"&&(y[1]._align=d5(t.events,n))}return e}function $c(e,t,n,s,a,o){const c=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",l="tableContent";n[0]!==0&&(o.end=Object.assign({},Ca(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const h=Ca(t.events,n[1]);if(o={type:c,start:Object.assign({},h),end:Object.assign({},h)},e.add(n[1],0,[["enter",o,t]]),n[2]!==0){const f=Ca(t.events,n[2]),p=Ca(t.events,n[3]),m={type:l,start:Object.assign({},f),end:Object.assign({},p)};if(e.add(n[2],0,[["enter",m,t]]),s!==2){const _=t.events[n[2]],y=t.events[n[3]];if(_[1].end=Object.assign({},y[1].end),_[1].type="chunkText",_[1].contentType="text",n[3]>n[2]+1){const w=n[2]+1,k=n[3]-n[2]-1;e.add(w,k,[])}}e.add(n[3]+1,0,[["exit",m,t]])}return a!==void 0&&(o.end=Object.assign({},Ca(t.events,a)),e.add(a,0,[["exit",o,t]]),o=void 0),o}function Nb(e,t,n,s,a){const o=[],c=Ca(t.events,n);a&&(a.end=Object.assign({},c),o.push(["exit",a,t])),s.end=Object.assign({},c),o.push(["exit",s,t]),e.add(n+1,0,o)}function Ca(e,t){const n=e[t],s=n[0]==="enter"?"start":"end";return n[1][s]}const p5={name:"tasklistCheck",tokenize:x5};function g5(){return{text:{91:p5}}}function x5(e,t,n){const s=this;return a;function a(h){return s.previous!==null||!s._gfmTasklistFirstContentOfListItem?n(h):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(h),e.exit("taskListCheckMarker"),o)}function o(h){return kt(h)?(e.enter("taskListCheckValueUnchecked"),e.consume(h),e.exit("taskListCheckValueUnchecked"),c):h===88||h===120?(e.enter("taskListCheckValueChecked"),e.consume(h),e.exit("taskListCheckValueChecked"),c):n(h)}function c(h){return h===93?(e.enter("taskListCheckMarker"),e.consume(h),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),l):n(h)}function l(h){return Ue(h)?t(h):ot(h)?e.check({tokenize:_5},t,n)(h):n(h)}}function _5(e,t,n){return mt(e,s,"whitespace");function s(a){return a===null?n(a):t(a)}}function y5(e){return FS([V3(),e5(),l5(e),h5(),g5()])}const v5={};function b5(e){const t=this,n=e||v5,s=t.data(),a=s.micromarkExtensions||(s.micromarkExtensions=[]),o=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),c=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);a.push(y5(n)),o.push(H3()),c.push($3(n))}var km=Object.defineProperty,S5=Object.getOwnPropertyDescriptor,w5=Object.getOwnPropertyNames,C5=Object.prototype.hasOwnProperty,Ep=(e,t)=>{let n={};for(var s in e)km(n,s,{get:e[s],enumerable:!0});return km(n,Symbol.toStringTag,{value:"Module"}),n},k5=(e,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(var a=w5(t),o=0,c=a.length,l;o<c;o++)l=a[o],!C5.call(e,l)&&l!==n&&km(e,l,{get:(h=>t[h]).bind(null,l),enumerable:!(s=S5(t,l))||s.enumerable});return e},R1=(e,t,n)=>(k5(e,t,"default"),n);const Pu=[{id:"abap",name:"ABAP",import:(()=>Q(()=>import("./abap-BdImnpbu.js"),[]))},{id:"actionscript-3",name:"ActionScript",import:(()=>Q(()=>import("./actionscript-3-CoDkCxhg.js"),[]))},{id:"ada",name:"Ada",import:(()=>Q(()=>import("./ada-bCR0ucgS.js"),[]))},{id:"angular-html",name:"Angular HTML",import:(()=>Q(()=>import("./angular-html-DA-rfuFy.js").then(e=>e.f),__vite__mapDeps([0,1,2,3])))},{id:"angular-ts",name:"Angular TypeScript",import:(()=>Q(()=>import("./angular-ts-BrjP3tb8.js"),__vite__mapDeps([4,0,1,2,3,5])))},{id:"apache",name:"Apache Conf",import:(()=>Q(()=>import("./apache-Pmp26Uib.js"),[]))},{id:"apex",name:"Apex",import:(()=>Q(()=>import("./apex-Dqspr-GT.js"),[]))},{id:"apl",name:"APL",import:(()=>Q(()=>import("./apl-CORt7UWP.js"),__vite__mapDeps([6,1,2,3,7,8,9])))},{id:"applescript",name:"AppleScript",import:(()=>Q(()=>import("./applescript-Co6uUVPk.js"),[]))},{id:"ara",name:"Ara",import:(()=>Q(()=>import("./ara-BRHolxvo.js"),[]))},{id:"asciidoc",name:"AsciiDoc",aliases:["adoc"],import:(()=>Q(()=>import("./asciidoc-Ve4PFQV2.js"),[]))},{id:"asm",name:"Assembly",import:(()=>Q(()=>import("./asm-D_Q5rh1f.js"),[]))},{id:"astro",name:"Astro",import:(()=>Q(()=>import("./astro-HNnZUWAn.js"),__vite__mapDeps([10,9,2,11,3,12,13])))},{id:"awk",name:"AWK",import:(()=>Q(()=>import("./awk-DMzUqQB5.js"),[]))},{id:"ballerina",name:"Ballerina",import:(()=>Q(()=>import("./ballerina-BFfxhgS-.js"),[]))},{id:"bat",name:"Batch File",aliases:["batch"],import:(()=>Q(()=>import("./bat-BkioyH1T.js"),[]))},{id:"beancount",name:"Beancount",import:(()=>Q(()=>import("./beancount-k_qm7-4y.js"),[]))},{id:"berry",name:"Berry",aliases:["be"],import:(()=>Q(()=>import("./berry-uYugtg8r.js"),[]))},{id:"bibtex",name:"BibTeX",import:(()=>Q(()=>import("./bibtex-CHM0blh-.js"),[]))},{id:"bicep",name:"Bicep",import:(()=>Q(()=>import("./bicep-Bmn6On1c.js"),[]))},{id:"bird2",name:"BIRD2 Configuration",aliases:["bird"],import:(()=>Q(()=>import("./bird2-BIv1doCn.js"),[]))},{id:"blade",name:"Blade",import:(()=>Q(()=>import("./blade-2xfisSek.js"),__vite__mapDeps([14,15,1,2,3,7,8,16,9])))},{id:"bsl",name:"1C (Enterprise)",aliases:["1c"],import:(()=>Q(()=>import("./bsl-BO_Y6i37.js"),__vite__mapDeps([17,18])))},{id:"c",name:"C",import:(()=>Q(()=>import("./c-BIGW1oBm.js"),[]))},{id:"c3",name:"C3",import:(()=>Q(()=>import("./c3-MRO5bC_T.js"),[]))},{id:"cadence",name:"Cadence",aliases:["cdc"],import:(()=>Q(()=>import("./cadence-Bv_4Rxtq.js"),[]))},{id:"cairo",name:"Cairo",import:(()=>Q(()=>import("./cairo-KRGpt6FW.js"),__vite__mapDeps([19,20])))},{id:"clarity",name:"Clarity",import:(()=>Q(()=>import("./clarity-D53aC0YG.js"),[]))},{id:"clojure",name:"Clojure",aliases:["clj"],import:(()=>Q(()=>import("./clojure-P80f7IUj.js"),[]))},{id:"cmake",name:"CMake",import:(()=>Q(()=>import("./cmake-D1j8_8rp.js"),[]))},{id:"cobol",name:"COBOL",import:(()=>Q(()=>import("./cobol-nBiQ_Alo.js"),__vite__mapDeps([21,1,2,3,8])))},{id:"codeowners",name:"CODEOWNERS",import:(()=>Q(()=>import("./codeowners-Bp6g37R7.js"),[]))},{id:"codeql",name:"CodeQL",aliases:["ql"],import:(()=>Q(()=>import("./codeql-DsOJ9woJ.js"),[]))},{id:"coffee",name:"CoffeeScript",aliases:["coffeescript"],import:(()=>Q(()=>import("./coffee-Ch7k5sss.js"),__vite__mapDeps([22,2])))},{id:"common-lisp",name:"Common Lisp",aliases:["lisp"],import:(()=>Q(()=>import("./common-lisp-Cg-RD9OK.js"),[]))},{id:"coq",name:"Coq",import:(()=>Q(()=>import("./coq-DkFqJrB1.js"),[]))},{id:"cpp",name:"C++",aliases:["c++"],import:(()=>Q(()=>import("./cpp-UfJy6YNI.js"),__vite__mapDeps([23,24,25,26,16])))},{id:"crystal",name:"Crystal",import:(()=>Q(()=>import("./crystal-DGywbUpC.js"),__vite__mapDeps([27,1,2,3,16,26,28])))},{id:"csharp",name:"C#",aliases:["c#","cs"],import:(()=>Q(()=>import("./csharp-DSvCPggb.js"),[]))},{id:"css",name:"CSS",import:(()=>Q(()=>import("./css-CLj8gQPS.js"),[]))},{id:"csv",name:"CSV",import:(()=>Q(()=>import("./csv-fuZLfV_i.js"),[]))},{id:"cue",name:"CUE",import:(()=>Q(()=>import("./cue-D82EKSYY.js"),[]))},{id:"cypher",name:"Cypher",aliases:["cql"],import:(()=>Q(()=>import("./cypher-COkxafJQ.js"),[]))},{id:"d",name:"D",import:(()=>Q(()=>import("./d-85-TOEBH.js"),[]))},{id:"dart",name:"Dart",import:(()=>Q(()=>import("./dart-bE4Kk8sk.js"),[]))},{id:"dax",name:"DAX",import:(()=>Q(()=>import("./dax-CEL-wOlO.js"),[]))},{id:"desktop",name:"Desktop",import:(()=>Q(()=>import("./desktop-BmXAJ9_W.js"),[]))},{id:"diff",name:"Diff",import:(()=>Q(()=>import("./diff-D97Zzqfu.js"),[]))},{id:"docker",name:"Dockerfile",aliases:["dockerfile"],import:(()=>Q(()=>import("./docker-BcOcwvcX.js"),[]))},{id:"dotenv",name:"dotEnv",import:(()=>Q(()=>import("./dotenv-Da5cRb03.js"),[]))},{id:"dream-maker",name:"Dream Maker",import:(()=>Q(()=>import("./dream-maker-BtqSS_iP.js"),[]))},{id:"edge",name:"Edge",import:(()=>Q(()=>import("./edge-FbVlp4U3.js"),__vite__mapDeps([29,11,1,2,3,15])))},{id:"elixir",name:"Elixir",import:(()=>Q(()=>import("./elixir-CkH2-t6x.js"),__vite__mapDeps([30,1,2,3])))},{id:"elm",name:"Elm",import:(()=>Q(()=>import("./elm-DbKCFpqz.js"),__vite__mapDeps([31,25,26])))},{id:"emacs-lisp",name:"Emacs Lisp",aliases:["elisp"],import:(()=>Q(()=>import("./emacs-lisp-CXvaQtF9.js"),[]))},{id:"erb",name:"ERB",import:(()=>Q(()=>import("./erb-Dm6A9KJ5.js"),__vite__mapDeps([32,1,2,3,33,34,7,8,16,35,11,36,13,23,24,25,26,28,37,38])))},{id:"erlang",name:"Erlang",aliases:["erl"],import:(()=>Q(()=>import("./erlang-DsQrWhSR.js"),__vite__mapDeps([39,40])))},{id:"fennel",name:"Fennel",import:(()=>Q(()=>import("./fennel-BYunw83y.js"),[]))},{id:"fish",name:"Fish",import:(()=>Q(()=>import("./fish-BvzEVeQv.js"),[]))},{id:"fluent",name:"Fluent",aliases:["ftl"],import:(()=>Q(()=>import("./fluent-C4IJs8-o.js"),[]))},{id:"fortran-fixed-form",name:"Fortran (Fixed Form)",aliases:["f","for","f77"],import:(()=>Q(()=>import("./fortran-fixed-form-CkoXwp7k.js"),__vite__mapDeps([41,42])))},{id:"fortran-free-form",name:"Fortran (Free Form)",aliases:["f90","f95","f03","f08","f18"],import:(()=>Q(()=>import("./fortran-free-form-BxgE0vQu.js"),[]))},{id:"fsharp",name:"F#",aliases:["f#","fs"],import:(()=>Q(()=>import("./fsharp-CXgrBDvD.js"),__vite__mapDeps([43,40])))},{id:"gdresource",name:"GDResource",aliases:["tscn","tres"],import:(()=>Q(()=>import("./gdresource-BOOCDP_w.js"),__vite__mapDeps([44,45,46])))},{id:"gdscript",name:"GDScript",aliases:["gd"],import:(()=>Q(()=>import("./gdscript-C5YyOfLZ.js"),[]))},{id:"gdshader",name:"GDShader",import:(()=>Q(()=>import("./gdshader-DkwncUOv.js"),[]))},{id:"genie",name:"Genie",import:(()=>Q(()=>import("./genie-D0YGMca9.js"),[]))},{id:"gherkin",name:"Gherkin",import:(()=>Q(()=>import("./gherkin-DyxjwDmM.js"),[]))},{id:"git-commit",name:"Git Commit Message",import:(()=>Q(()=>import("./git-commit-F4YmCXRG.js"),__vite__mapDeps([47,48])))},{id:"git-rebase",name:"Git Rebase Message",import:(()=>Q(()=>import("./git-rebase-r7XF79zn.js"),__vite__mapDeps([49,28])))},{id:"gleam",name:"Gleam",import:(()=>Q(()=>import("./gleam-BspZqrRM.js"),[]))},{id:"glimmer-js",name:"Glimmer JS",aliases:["gjs"],import:(()=>Q(()=>import("./glimmer-js-ByusRIyA.js"),__vite__mapDeps([50,2,11,3,1])))},{id:"glimmer-ts",name:"Glimmer TS",aliases:["gts"],import:(()=>Q(()=>import("./glimmer-ts-BfAWNZQY.js"),__vite__mapDeps([51,11,3,2,1])))},{id:"glsl",name:"GLSL",import:(()=>Q(()=>import("./glsl-DplSGwfg.js"),__vite__mapDeps([25,26])))},{id:"gn",name:"GN",import:(()=>Q(()=>import("./gn-n2N0HUVH.js"),[]))},{id:"gnuplot",name:"Gnuplot",import:(()=>Q(()=>import("./gnuplot-DdkO51Og.js"),[]))},{id:"go",name:"Go",import:(()=>Q(()=>import("./go-C27-OAKa.js"),[]))},{id:"graphql",name:"GraphQL",aliases:["gql"],import:(()=>Q(()=>import("./graphql-ChdNCCLP.js"),__vite__mapDeps([35,2,11,36,13])))},{id:"groovy",name:"Groovy",import:(()=>Q(()=>import("./groovy-gcz8RCvz.js"),[]))},{id:"hack",name:"Hack",import:(()=>Q(()=>import("./hack-DbPARsA_.js"),__vite__mapDeps([52,1,2,3,16])))},{id:"haml",name:"Ruby Haml",import:(()=>Q(()=>import("./haml-D5jkg6IW.js"),__vite__mapDeps([34,2,3])))},{id:"handlebars",name:"Handlebars",aliases:["hbs"],import:(()=>Q(()=>import("./handlebars-BpdQsYii.js"),__vite__mapDeps([53,1,2,3,38])))},{id:"haskell",name:"Haskell",aliases:["hs"],import:(()=>Q(()=>import("./haskell-Df6bDoY_.js"),[]))},{id:"haxe",name:"Haxe",import:(()=>Q(()=>import("./haxe-CzTSHFRz.js"),[]))},{id:"hcl",name:"HashiCorp HCL",import:(()=>Q(()=>import("./hcl-BWvSN4gD.js"),[]))},{id:"hjson",name:"Hjson",import:(()=>Q(()=>import("./hjson-D5-asLiD.js"),[]))},{id:"hlsl",name:"HLSL",import:(()=>Q(()=>import("./hlsl-D3lLCCz7.js"),[]))},{id:"html",name:"HTML",import:(()=>Q(()=>import("./html-pp8916En.js"),__vite__mapDeps([1,2,3])))},{id:"html-derivative",name:"HTML (Derivative)",import:(()=>Q(()=>import("./html-derivative-DlHx6ybY.js"),__vite__mapDeps([15,1,2,3])))},{id:"http",name:"HTTP",import:(()=>Q(()=>import("./http-jrhK8wxY.js"),__vite__mapDeps([54,28,9,7,8,35,2,11,36,13])))},{id:"hurl",name:"Hurl",import:(()=>Q(()=>import("./hurl-irOxFIW8.js"),__vite__mapDeps([55,35,2,11,36,13,7,8,56])))},{id:"hxml",name:"HXML",import:(()=>Q(()=>import("./hxml-Bvhsp5Yf.js"),__vite__mapDeps([57,58])))},{id:"hy",name:"Hy",import:(()=>Q(()=>import("./hy-DFXneXwc.js"),[]))},{id:"imba",name:"Imba",import:(()=>Q(()=>import("./imba-DGztddWO.js"),[]))},{id:"ini",name:"INI",aliases:["properties"],import:(()=>Q(()=>import("./ini-BEwlwnbL.js"),[]))},{id:"java",name:"Java",import:(()=>Q(()=>import("./java-CylS5w8V.js"),[]))},{id:"javascript",name:"JavaScript",aliases:["js","cjs","mjs"],import:(()=>Q(()=>import("./javascript-wDzz0qaB.js"),[]))},{id:"jinja",name:"Jinja",import:(()=>Q(()=>import("./jinja-f2NsQr07.js"),__vite__mapDeps([59,1,2,3])))},{id:"jison",name:"Jison",import:(()=>Q(()=>import("./jison-wvAkD_A8.js"),__vite__mapDeps([60,2])))},{id:"json",name:"JSON",import:(()=>Q(()=>import("./json-Cp-IABpG.js"),[]))},{id:"json5",name:"JSON5",import:(()=>Q(()=>import("./json5-C9tS-k6U.js"),[]))},{id:"jsonc",name:"JSON with Comments",import:(()=>Q(()=>import("./jsonc-Des-eS-w.js"),[]))},{id:"jsonl",name:"JSON Lines",import:(()=>Q(()=>import("./jsonl-DcaNXYhu.js"),[]))},{id:"jsonnet",name:"Jsonnet",import:(()=>Q(()=>import("./jsonnet-DFQXde-d.js"),[]))},{id:"jssm",name:"JSSM",aliases:["fsl"],import:(()=>Q(()=>import("./jssm-C2t-YnRu.js"),[]))},{id:"jsx",name:"JSX",import:(()=>Q(()=>import("./jsx-g9-lgVsj.js"),[]))},{id:"julia",name:"Julia",aliases:["jl"],import:(()=>Q(()=>import("./julia-D7OTSIA_.js"),__vite__mapDeps([61,23,24,25,26,16,20,2,62])))},{id:"just",name:"Just",import:(()=>Q(()=>import("./just-CUsbIsdP.js"),__vite__mapDeps([63,28,2,11,64,1,3,7,8,16,20,33,34,35,36,13,23,24,25,26,37,38])))},{id:"kdl",name:"KDL",import:(()=>Q(()=>import("./kdl-DV7GczEv.js"),[]))},{id:"kotlin",name:"Kotlin",aliases:["kt","kts"],import:(()=>Q(()=>import("./kotlin-BdnUsdx6.js"),[]))},{id:"kusto",name:"Kusto",aliases:["kql"],import:(()=>Q(()=>import("./kusto-wEQ09or8.js"),[]))},{id:"latex",name:"LaTeX",import:(()=>Q(()=>import("./latex-CaSxy8MP.js"),__vite__mapDeps([65,66,62])))},{id:"lean",name:"Lean 4",aliases:["lean4"],import:(()=>Q(()=>import("./lean-BZvkOJ9d.js"),[]))},{id:"less",name:"Less",import:(()=>Q(()=>import("./less-B1dDrJ26.js"),[]))},{id:"liquid",name:"Liquid",import:(()=>Q(()=>import("./liquid-C0sCDyMI.js"),__vite__mapDeps([67,1,2,3,9])))},{id:"llvm",name:"LLVM IR",import:(()=>Q(()=>import("./llvm-DjAJT7YJ.js"),[]))},{id:"log",name:"Log file",import:(()=>Q(()=>import("./log-2UxHyX5q.js"),[]))},{id:"logo",name:"Logo",import:(()=>Q(()=>import("./logo-BtOb2qkB.js"),[]))},{id:"lua",name:"Lua",import:(()=>Q(()=>import("./lua-BaeVxFsk.js"),__vite__mapDeps([37,26])))},{id:"luau",name:"Luau",import:(()=>Q(()=>import("./luau-KW6xsasC.js"),[]))},{id:"make",name:"Makefile",aliases:["makefile"],import:(()=>Q(()=>import("./make-CHLpvVh8.js"),[]))},{id:"markdown",name:"Markdown",aliases:["md"],import:(()=>Q(()=>import("./markdown-Cvjx9yec.js"),[]))},{id:"marko",name:"Marko",import:(()=>Q(()=>import("./marko-DjSrsDqO.js"),__vite__mapDeps([68,3,69,5,11])))},{id:"matlab",name:"MATLAB",import:(()=>Q(()=>import("./matlab-D7o27uSR.js"),[]))},{id:"mdc",name:"MDC",import:(()=>Q(()=>import("./mdc-DTYItulj.js"),__vite__mapDeps([70,40,38,15,1,2,3])))},{id:"mdx",name:"MDX",import:(()=>Q(()=>import("./mdx-Cmh6b_Ma.js"),[]))},{id:"mermaid",name:"Mermaid",aliases:["mmd"],import:(()=>Q(()=>import("./mermaid-mWjccvbQ.js"),[]))},{id:"mipsasm",name:"MIPS Assembly",aliases:["mips"],import:(()=>Q(()=>import("./mipsasm-CKIfxQSi.js"),[]))},{id:"mojo",name:"Mojo",import:(()=>Q(()=>import("./mojo-rZm6bMo-.js"),[]))},{id:"moonbit",name:"MoonBit",aliases:["mbt","mbti"],import:(()=>Q(()=>import("./moonbit-_H4v1dQx.js"),[]))},{id:"move",name:"Move",import:(()=>Q(()=>import("./move-IF9eRakj.js"),[]))},{id:"narrat",name:"Narrat Language",aliases:["nar"],import:(()=>Q(()=>import("./narrat-DRg8JJMk.js"),[]))},{id:"nextflow",name:"Nextflow",aliases:["nf"],import:(()=>Q(()=>import("./nextflow-C-mBbutL.js"),__vite__mapDeps([71,72])))},{id:"nextflow-groovy",name:"Nextflow Groovy",import:(()=>Q(()=>import("./nextflow-groovy-vE_lwT2v.js"),[]))},{id:"nginx",name:"Nginx",import:(()=>Q(()=>import("./nginx-BpAMiNFr.js"),__vite__mapDeps([73,37,26])))},{id:"nim",name:"Nim",import:(()=>Q(()=>import("./nim-BIad80T-.js"),__vite__mapDeps([74,26,1,2,3,7,8,25,40])))},{id:"nix",name:"Nix",import:(()=>Q(()=>import("./nix-CwoSXNpI.js"),[]))},{id:"nushell",name:"nushell",aliases:["nu"],import:(()=>Q(()=>import("./nushell-Cz2AlsmD.js"),[]))},{id:"objective-c",name:"Objective-C",aliases:["objc"],import:(()=>Q(()=>import("./objective-c-DXmwc3jG.js"),[]))},{id:"objective-cpp",name:"Objective-C++",import:(()=>Q(()=>import("./objective-cpp-CLxacb5B.js"),[]))},{id:"ocaml",name:"OCaml",import:(()=>Q(()=>import("./ocaml-C0hk2d4L.js"),[]))},{id:"odin",name:"Odin",import:(()=>Q(()=>import("./odin-BBf5iR-q.js"),[]))},{id:"openscad",name:"OpenSCAD",aliases:["scad"],import:(()=>Q(()=>import("./openscad-C4EeE6gA.js"),[]))},{id:"pascal",name:"Pascal",import:(()=>Q(()=>import("./pascal-D93ZcfNL.js"),[]))},{id:"perl",name:"Perl",import:(()=>Q(()=>import("./perl-B9cMNwum.js"),__vite__mapDeps([64,1,2,3,7,8,16])))},{id:"php",name:"PHP",import:(()=>Q(()=>import("./php-Csjmro_R.js"),__vite__mapDeps([75,1,2,3,7,8,16,9])))},{id:"pkl",name:"Pkl",import:(()=>Q(()=>import("./pkl-u5AG7uiY.js"),[]))},{id:"plsql",name:"PL/SQL",import:(()=>Q(()=>import("./plsql-ChMvpjG-.js"),[]))},{id:"po",name:"Gettext PO",aliases:["pot","potx"],import:(()=>Q(()=>import("./po-BTJTHyun.js"),[]))},{id:"polar",name:"Polar",import:(()=>Q(()=>import("./polar-C0HS_06l.js"),[]))},{id:"postcss",name:"PostCSS",import:(()=>Q(()=>import("./postcss-CXtECtnM.js"),[]))},{id:"powerquery",name:"PowerQuery",import:(()=>Q(()=>import("./powerquery-CEu0bR-o.js"),[]))},{id:"powershell",name:"PowerShell",aliases:["ps","ps1"],import:(()=>Q(()=>import("./powershell-Dpen1YoG.js"),[]))},{id:"prisma",name:"Prisma",import:(()=>Q(()=>import("./prisma-Dd19v3D-.js"),[]))},{id:"prolog",name:"Prolog",import:(()=>Q(()=>import("./prolog-CbFg5uaA.js"),[]))},{id:"proto",name:"Protocol Buffer 3",aliases:["protobuf"],import:(()=>Q(()=>import("./proto-C7zT0LnQ.js"),[]))},{id:"pug",name:"Pug",aliases:["jade"],import:(()=>Q(()=>import("./pug-DKIMFp6K.js"),__vite__mapDeps([76,2,3,1])))},{id:"puppet",name:"Puppet",import:(()=>Q(()=>import("./puppet-BMWR74SV.js"),[]))},{id:"purescript",name:"PureScript",import:(()=>Q(()=>import("./purescript-CklMAg4u.js"),[]))},{id:"python",name:"Python",aliases:["py"],import:(()=>Q(()=>import("./python-B6aJPvgy.js"),[]))},{id:"qml",name:"QML",import:(()=>Q(()=>import("./qml-3beO22l8.js"),__vite__mapDeps([77,2])))},{id:"qmldir",name:"QML Directory",import:(()=>Q(()=>import("./qmldir-C8lEn-DE.js"),[]))},{id:"qss",name:"Qt Style Sheets",import:(()=>Q(()=>import("./qss-IeuSbFQv.js"),[]))},{id:"r",name:"R",import:(()=>Q(()=>import("./r-Dspwwk_N.js"),[]))},{id:"racket",name:"Racket",import:(()=>Q(()=>import("./racket-BqYA7rlc.js"),[]))},{id:"raku",name:"Raku",aliases:["perl6"],import:(()=>Q(()=>import("./raku-DXvB9xmW.js"),[]))},{id:"razor",name:"ASP.NET Razor",import:(()=>Q(()=>import("./razor-BjBPvh-w.js"),__vite__mapDeps([78,1,2,3,79])))},{id:"reg",name:"Windows Registry Script",import:(()=>Q(()=>import("./reg-C-SQnVFl.js"),[]))},{id:"regexp",name:"RegExp",aliases:["regex"],import:(()=>Q(()=>import("./regexp-CDVJQ6XC.js"),[]))},{id:"rel",name:"Rel",import:(()=>Q(()=>import("./rel-C3B-1QV4.js"),[]))},{id:"riscv",name:"RISC-V",import:(()=>Q(()=>import("./riscv-BM1_JUlF.js"),[]))},{id:"ron",name:"RON",import:(()=>Q(()=>import("./ron-D8l8udqQ.js"),[]))},{id:"rosmsg",name:"ROS Interface",import:(()=>Q(()=>import("./rosmsg-BJDFO7_C.js"),[]))},{id:"rst",name:"reStructuredText",import:(()=>Q(()=>import("./rst-CpCqk9r5.js"),__vite__mapDeps([80,15,1,2,3,23,24,25,26,16,20,28,38,81,33,34,7,8,35,11,36,13,37])))},{id:"ruby",name:"Ruby",aliases:["rb"],import:(()=>Q(()=>import("./ruby-DyJCeAvU.js"),__vite__mapDeps([33,1,2,3,34,7,8,16,35,11,36,13,23,24,25,26,28,37,38])))},{id:"rust",name:"Rust",aliases:["rs"],import:(()=>Q(()=>import("./rust-B1yitclQ.js"),[]))},{id:"sas",name:"SAS",import:(()=>Q(()=>import("./sas-DEy46yEz.js"),__vite__mapDeps([82,16])))},{id:"sass",name:"Sass",import:(()=>Q(()=>import("./sass-Cj5Yp3dK.js"),[]))},{id:"scala",name:"Scala",import:(()=>Q(()=>import("./scala-C151Ov-r.js"),[]))},{id:"scheme",name:"Scheme",import:(()=>Q(()=>import("./scheme-C98Dy4si.js"),[]))},{id:"scss",name:"SCSS",import:(()=>Q(()=>import("./scss-D5BDwBP9.js"),__vite__mapDeps([5,3])))},{id:"sdbl",name:"1C (Query)",aliases:["1c-query"],import:(()=>Q(()=>import("./sdbl-DVxCFoDh.js"),[]))},{id:"shaderlab",name:"ShaderLab",aliases:["shader"],import:(()=>Q(()=>import("./shaderlab-Dg9Lc6iA.js"),__vite__mapDeps([83,84])))},{id:"shellscript",name:"Shell",aliases:["bash","sh","shell","zsh"],import:(()=>Q(()=>import("./shellscript-Yzrsuije.js"),[]))},{id:"shellsession",name:"Shell Session",aliases:["console"],import:(()=>Q(()=>import("./shellsession-BADoaaVG.js"),__vite__mapDeps([85,28])))},{id:"smalltalk",name:"Smalltalk",import:(()=>Q(()=>import("./smalltalk-BERRCDM3.js"),[]))},{id:"solidity",name:"Solidity",import:(()=>Q(()=>import("./solidity-rGO070M0.js"),[]))},{id:"soy",name:"Closure Templates",aliases:["closure-templates"],import:(()=>Q(()=>import("./soy-8wufbnw4.js"),__vite__mapDeps([86,1,2,3])))},{id:"sparql",name:"SPARQL",import:(()=>Q(()=>import("./sparql-rVzFXLq3.js"),__vite__mapDeps([87,88])))},{id:"splunk",name:"Splunk Query Language",aliases:["spl"],import:(()=>Q(()=>import("./splunk-BtCnVYZw.js"),[]))},{id:"sql",name:"SQL",import:(()=>Q(()=>import("./sql-CRqJ_cUM.js"),[]))},{id:"ssh-config",name:"SSH Config",import:(()=>Q(()=>import("./ssh-config-_ykCGR6B.js"),[]))},{id:"stata",name:"Stata",import:(()=>Q(()=>import("./stata-DI20mbqo.js"),__vite__mapDeps([89,16])))},{id:"stylus",name:"Stylus",aliases:["styl"],import:(()=>Q(()=>import("./stylus-BEDo0Tqx.js"),[]))},{id:"surrealql",name:"SurrealQL",aliases:["surql"],import:(()=>Q(()=>import("./surrealql-Bq5Q-fJD.js"),__vite__mapDeps([90,2])))},{id:"svelte",name:"Svelte",import:(()=>Q(()=>import("./svelte-Cy7k_4gC.js"),__vite__mapDeps([91,2,11,3,12])))},{id:"swift",name:"Swift",import:(()=>Q(()=>import("./swift-D82vCrfD.js"),[]))},{id:"system-verilog",name:"SystemVerilog",import:(()=>Q(()=>import("./system-verilog-CnnmHF94.js"),[]))},{id:"systemd",name:"Systemd Units",import:(()=>Q(()=>import("./systemd-4A_iFExJ.js"),[]))},{id:"talonscript",name:"TalonScript",aliases:["talon"],import:(()=>Q(()=>import("./talonscript-CkByrt1z.js"),[]))},{id:"tasl",name:"Tasl",import:(()=>Q(()=>import("./tasl-QIJgUcNo.js"),[]))},{id:"tcl",name:"Tcl",import:(()=>Q(()=>import("./tcl-dwOrl1Do.js"),[]))},{id:"templ",name:"Templ",import:(()=>Q(()=>import("./templ-DhtptRzy.js"),__vite__mapDeps([92,93,2,3])))},{id:"terraform",name:"Terraform",aliases:["tf","tfvars"],import:(()=>Q(()=>import("./terraform-BETggiCN.js"),[]))},{id:"tex",name:"TeX",import:(()=>Q(()=>import("./tex-idrVyKtj.js"),__vite__mapDeps([66,62])))},{id:"toml",name:"TOML",import:(()=>Q(()=>import("./toml-vGWfd6FD.js"),[]))},{id:"ts-tags",name:"TypeScript with Tags",aliases:["lit"],import:(()=>Q(()=>import("./ts-tags-D351s5mN.js"),__vite__mapDeps([94,11,3,2,25,26,1,16,7,8])))},{id:"tsv",name:"TSV",import:(()=>Q(()=>import("./tsv-B_m7g4N7.js"),[]))},{id:"tsx",name:"TSX",import:(()=>Q(()=>import("./tsx-COt5Ahok.js"),[]))},{id:"turtle",name:"Turtle",import:(()=>Q(()=>import("./turtle-BsS91CYL.js"),[]))},{id:"twig",name:"Twig",import:(()=>Q(()=>import("./twig-CW1WmMYd.js"),__vite__mapDeps([95,3,2,5,75,1,7,8,16,9,20,33,34,35,11,36,13,23,24,25,26,28,37,38])))},{id:"typescript",name:"TypeScript",aliases:["ts","cts","mts"],import:(()=>Q(()=>import("./typescript-BPQ3VLAy.js"),[]))},{id:"typespec",name:"TypeSpec",aliases:["tsp"],import:(()=>Q(()=>import("./typespec-CAFt9gP4.js"),[]))},{id:"typst",name:"Typst",aliases:["typ"],import:(()=>Q(()=>import("./typst-DHCkPAjA.js"),[]))},{id:"v",name:"V",import:(()=>Q(()=>import("./v-BcVCzyr7.js"),[]))},{id:"vala",name:"Vala",import:(()=>Q(()=>import("./vala-CsfeWuGM.js"),[]))},{id:"vb",name:"Visual Basic",aliases:["cmd"],import:(()=>Q(()=>import("./vb-D17OF-Vu.js"),[]))},{id:"verilog",name:"Verilog",import:(()=>Q(()=>import("./verilog-BQ8w6xss.js"),[]))},{id:"vhdl",name:"VHDL",import:(()=>Q(()=>import("./vhdl-CeAyd5Ju.js"),[]))},{id:"viml",name:"Vim Script",aliases:["vim","vimscript"],import:(()=>Q(()=>import("./viml-CJc9bBzg.js"),[]))},{id:"vue",name:"Vue",import:(()=>Q(()=>import("./vue-D2xRrEX4.js"),__vite__mapDeps([96,3,2,11,9,1,15])))},{id:"vue-html",name:"Vue HTML",import:(()=>Q(()=>import("./vue-html-AaS7Mt5G.js"),__vite__mapDeps([97,2])))},{id:"vue-vine",name:"Vue Vine",import:(()=>Q(()=>import("./vue-vine-BoDAl6tE.js"),__vite__mapDeps([98,3,5,69,99,12,2])))},{id:"vyper",name:"Vyper",aliases:["vy"],import:(()=>Q(()=>import("./vyper-CDx5xZoG.js"),[]))},{id:"wasm",name:"WebAssembly",import:(()=>Q(()=>import("./wasm-MzD3tlZU.js"),[]))},{id:"wenyan",name:"Wenyan",aliases:["文言"],import:(()=>Q(()=>import("./wenyan-BV7otONQ.js"),[]))},{id:"wgsl",name:"WGSL",import:(()=>Q(()=>import("./wgsl-Dx-B1_4e.js"),[]))},{id:"wikitext",name:"Wikitext",aliases:["mediawiki","wiki"],import:(()=>Q(()=>import("./wikitext-BhOHFoWU.js"),[]))},{id:"wit",name:"WebAssembly Interface Types",import:(()=>Q(()=>import("./wit-5i3qLPDT.js"),[]))},{id:"wolfram",name:"Wolfram",aliases:["wl"],import:(()=>Q(()=>import("./wolfram-lXgVvXCa.js"),[]))},{id:"xml",name:"XML",import:(()=>Q(()=>import("./xml-sdJ4AIDG.js"),__vite__mapDeps([7,8])))},{id:"xsl",name:"XSL",import:(()=>Q(()=>import("./xsl-CtQFsRM5.js"),__vite__mapDeps([100,7,8])))},{id:"yaml",name:"YAML",aliases:["yml"],import:(()=>Q(()=>import("./yaml-Buea-lGh.js"),[]))},{id:"zenscript",name:"ZenScript",import:(()=>Q(()=>import("./zenscript-DVFEvuxE.js"),[]))},{id:"zig",name:"Zig",import:(()=>Q(()=>import("./zig-VOosw3JB.js"),[]))}],jp=Object.fromEntries(Pu.map(e=>[e.id,e.import])),Tp=Object.fromEntries(Pu.flatMap(e=>{var t;return((t=e.aliases)==null?void 0:t.map(n=>[n,e.import]))||[]})),Np={...jp,...Tp},Ap=[{id:"andromeeda",displayName:"Andromeeda",type:"dark",import:(()=>Q(()=>import("./andromeeda-C4gqWexZ.js"),[]))},{id:"aurora-x",displayName:"Aurora X",type:"dark",import:(()=>Q(()=>import("./aurora-x-D-2ljcwZ.js"),[]))},{id:"ayu-dark",displayName:"Ayu Dark",type:"dark",import:(()=>Q(()=>import("./ayu-dark-DYE7WIF3.js"),[]))},{id:"ayu-light",displayName:"Ayu Light",type:"light",import:(()=>Q(()=>import("./ayu-light-BA47KaF1.js"),[]))},{id:"ayu-mirage",displayName:"Ayu Mirage",type:"dark",import:(()=>Q(()=>import("./ayu-mirage-32ctXXKs.js"),[]))},{id:"catppuccin-frappe",displayName:"Catppuccin Frappé",type:"dark",import:(()=>Q(()=>import("./catppuccin-frappe-DFWUc33u.js"),[]))},{id:"catppuccin-latte",displayName:"Catppuccin Latte",type:"light",import:(()=>Q(()=>import("./catppuccin-latte-C9dUb6Cb.js"),[]))},{id:"catppuccin-macchiato",displayName:"Catppuccin Macchiato",type:"dark",import:(()=>Q(()=>import("./catppuccin-macchiato-DQyhUUbL.js"),[]))},{id:"catppuccin-mocha",displayName:"Catppuccin Mocha",type:"dark",import:(()=>Q(()=>import("./catppuccin-mocha-D87Tk5Gz.js"),[]))},{id:"dark-plus",displayName:"Dark Plus",type:"dark",import:(()=>Q(()=>import("./dark-plus-C3mMm8J8.js"),[]))},{id:"dracula",displayName:"Dracula Theme",type:"dark",import:(()=>Q(()=>import("./dracula-BzJJZx-M.js"),[]))},{id:"dracula-soft",displayName:"Dracula Theme Soft",type:"dark",import:(()=>Q(()=>import("./dracula-soft-BXkSAIEj.js"),[]))},{id:"everforest-dark",displayName:"Everforest Dark",type:"dark",import:(()=>Q(()=>import("./everforest-dark-BgDCqdQA.js"),[]))},{id:"everforest-light",displayName:"Everforest Light",type:"light",import:(()=>Q(()=>import("./everforest-light-C8M2exoo.js"),[]))},{id:"github-dark",displayName:"GitHub Dark",type:"dark",import:(()=>Q(()=>import("./github-dark-DHJKELXO.js"),[]))},{id:"github-dark-default",displayName:"GitHub Dark Default",type:"dark",import:(()=>Q(()=>import("./github-dark-default-Cuk6v7N8.js"),[]))},{id:"github-dark-dimmed",displayName:"GitHub Dark Dimmed",type:"dark",import:(()=>Q(()=>import("./github-dark-dimmed-DH5Ifo-i.js"),[]))},{id:"github-dark-high-contrast",displayName:"GitHub Dark High Contrast",type:"dark",import:(()=>Q(()=>import("./github-dark-high-contrast-E3gJ1_iC.js"),[]))},{id:"github-light",displayName:"GitHub Light",type:"light",import:(()=>Q(()=>import("./github-light-DAi9KRSo.js"),[]))},{id:"github-light-default",displayName:"GitHub Light Default",type:"light",import:(()=>Q(()=>import("./github-light-default-D7oLnXFd.js"),[]))},{id:"github-light-high-contrast",displayName:"GitHub Light High Contrast",type:"light",import:(()=>Q(()=>import("./github-light-high-contrast-BfjtVDDH.js"),[]))},{id:"gruvbox-dark-hard",displayName:"Gruvbox Dark Hard",type:"dark",import:(()=>Q(()=>import("./gruvbox-dark-hard-CFHQjOhq.js"),[]))},{id:"gruvbox-dark-medium",displayName:"Gruvbox Dark Medium",type:"dark",import:(()=>Q(()=>import("./gruvbox-dark-medium-GsRaNv29.js"),[]))},{id:"gruvbox-dark-soft",displayName:"Gruvbox Dark Soft",type:"dark",import:(()=>Q(()=>import("./gruvbox-dark-soft-CVdnzihN.js"),[]))},{id:"gruvbox-light-hard",displayName:"Gruvbox Light Hard",type:"light",import:(()=>Q(()=>import("./gruvbox-light-hard-CH1njM8p.js"),[]))},{id:"gruvbox-light-medium",displayName:"Gruvbox Light Medium",type:"light",import:(()=>Q(()=>import("./gruvbox-light-medium-DRw_LuNl.js"),[]))},{id:"gruvbox-light-soft",displayName:"Gruvbox Light Soft",type:"light",import:(()=>Q(()=>import("./gruvbox-light-soft-hJgmCMqR.js"),[]))},{id:"horizon",displayName:"Horizon",type:"dark",import:(()=>Q(()=>import("./horizon-BUw7H-hv.js"),[]))},{id:"horizon-bright",displayName:"Horizon Bright",type:"light",import:(()=>Q(()=>import("./horizon-bright-CUuTKBJd.js"),[]))},{id:"houston",displayName:"Houston",type:"dark",import:(()=>Q(()=>import("./houston-DnULxvSX.js"),[]))},{id:"kanagawa-dragon",displayName:"Kanagawa Dragon",type:"dark",import:(()=>Q(()=>import("./kanagawa-dragon-CkXjmgJE.js"),[]))},{id:"kanagawa-lotus",displayName:"Kanagawa Lotus",type:"light",import:(()=>Q(()=>import("./kanagawa-lotus-CfQXZHmo.js"),[]))},{id:"kanagawa-wave",displayName:"Kanagawa Wave",type:"dark",import:(()=>Q(()=>import("./kanagawa-wave-DWedfzmr.js"),[]))},{id:"laserwave",displayName:"LaserWave",type:"dark",import:(()=>Q(()=>import("./laserwave-DUszq2jm.js"),[]))},{id:"light-plus",displayName:"Light Plus",type:"light",import:(()=>Q(()=>import("./light-plus-B7mTdjB0.js"),[]))},{id:"material-theme",displayName:"Material Theme",type:"dark",import:(()=>Q(()=>import("./material-theme-D5KoaKCx.js"),[]))},{id:"material-theme-darker",displayName:"Material Theme Darker",type:"dark",import:(()=>Q(()=>import("./material-theme-darker-BfHTSMKl.js"),[]))},{id:"material-theme-lighter",displayName:"Material Theme Lighter",type:"light",import:(()=>Q(()=>import("./material-theme-lighter-B0m2ddpp.js"),[]))},{id:"material-theme-ocean",displayName:"Material Theme Ocean",type:"dark",import:(()=>Q(()=>import("./material-theme-ocean-CyktbL80.js"),[]))},{id:"material-theme-palenight",displayName:"Material Theme Palenight",type:"dark",import:(()=>Q(()=>import("./material-theme-palenight-Csfq5Kiy.js"),[]))},{id:"min-dark",displayName:"Min Dark",type:"dark",import:(()=>Q(()=>import("./min-dark-CafNBF8u.js"),[]))},{id:"min-light",displayName:"Min Light",type:"light",import:(()=>Q(()=>import("./min-light-CTRr51gU.js"),[]))},{id:"monokai",displayName:"Monokai",type:"dark",import:(()=>Q(()=>import("./monokai-D4h5O-jR.js"),[]))},{id:"night-owl",displayName:"Night Owl",type:"dark",import:(()=>Q(()=>import("./night-owl-C39BiMTA.js"),[]))},{id:"night-owl-light",displayName:"Night Owl Light",type:"light",import:(()=>Q(()=>import("./night-owl-light-CMTm3GFP.js"),[]))},{id:"nord",displayName:"Nord",type:"dark",import:(()=>Q(()=>import("./nord-Ddv68eIx.js"),[]))},{id:"one-dark-pro",displayName:"One Dark Pro",type:"dark",import:(()=>Q(()=>import("./one-dark-pro-DVMEJ2y_.js"),[]))},{id:"one-light",displayName:"One Light",type:"light",import:(()=>Q(()=>import("./one-light-C3Wv6jpd.js"),[]))},{id:"plastic",displayName:"Plastic",type:"dark",import:(()=>Q(()=>import("./plastic-3e1v2bzS.js"),[]))},{id:"poimandres",displayName:"Poimandres",type:"dark",import:(()=>Q(()=>import("./poimandres-CS3Unz2-.js"),[]))},{id:"red",displayName:"Red",type:"dark",import:(()=>Q(()=>import("./red-bN70gL4F.js"),[]))},{id:"rose-pine",displayName:"Rosé Pine",type:"dark",import:(()=>Q(()=>import("./rose-pine-qdsjHGoJ.js"),[]))},{id:"rose-pine-dawn",displayName:"Rosé Pine Dawn",type:"light",import:(()=>Q(()=>import("./rose-pine-dawn-DHQR4-dF.js"),[]))},{id:"rose-pine-moon",displayName:"Rosé Pine Moon",type:"dark",import:(()=>Q(()=>import("./rose-pine-moon-D4_iv3hh.js"),[]))},{id:"slack-dark",displayName:"Slack Dark",type:"dark",import:(()=>Q(()=>import("./slack-dark-BthQWCQV.js"),[]))},{id:"slack-ochin",displayName:"Slack Ochin",type:"light",import:(()=>Q(()=>import("./slack-ochin-DqwNpetd.js"),[]))},{id:"snazzy-light",displayName:"Snazzy Light",type:"light",import:(()=>Q(()=>import("./snazzy-light-Bw305WKR.js"),[]))},{id:"solarized-dark",displayName:"Solarized Dark",type:"dark",import:(()=>Q(()=>import("./solarized-dark-DXbdFlpD.js"),[]))},{id:"solarized-light",displayName:"Solarized Light",type:"light",import:(()=>Q(()=>import("./solarized-light-L9t79GZl.js"),[]))},{id:"synthwave-84",displayName:"Synthwave '84",type:"dark",import:(()=>Q(()=>import("./synthwave-84-CbfX1IO0.js"),[]))},{id:"tokyo-night",displayName:"Tokyo Night",type:"dark",import:(()=>Q(()=>import("./tokyo-night-hegEt444.js"),[]))},{id:"vesper",displayName:"Vesper",type:"dark",import:(()=>Q(()=>import("./vesper-DRje8inN.js"),[]))},{id:"vitesse-black",displayName:"Vitesse Black",type:"dark",import:(()=>Q(()=>import("./vitesse-black-Bkuqu6BP.js"),[]))},{id:"vitesse-dark",displayName:"Vitesse Dark",type:"dark",import:(()=>Q(()=>import("./vitesse-dark-D0r3Knsf.js"),[]))},{id:"vitesse-light",displayName:"Vitesse Light",type:"light",import:(()=>Q(()=>import("./vitesse-light-CVO1_9PV.js"),[]))}],Dp=Object.fromEntries(Ap.map(e=>[e.id,e.import]));var Lp=class extends Error{constructor(t){super(t),this.name="ShikiError"}};function E5(){return 2147483648}function j5(){return typeof performance<"u"?performance.now():Date.now()}const T5=(e,t)=>e+(t-e%t)%t;async function N5(e){let t,n;const s={};function a(y){n=y,s.HEAPU8=new Uint8Array(y),s.HEAPU32=new Uint32Array(y)}function o(y,w,k){s.HEAPU8.copyWithin(y,w,w+k)}function c(y){try{return t.grow(y-n.byteLength+65535>>>16),a(t.buffer),1}catch{}}function l(y){const w=s.HEAPU8.length;y=y>>>0;const k=E5();if(y>k)return!1;for(let v=1;v<=4;v*=2){let b=w*(1+.2/v);b=Math.min(b,y+100663296);const x=Math.min(k,T5(Math.max(y,b),65536));if(c(x))return!0}return!1}const h=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function f(y,w,k=1024){const v=w+k;let b=w;for(;y[b]&&!(b>=v);)++b;if(b-w>16&&y.buffer&&h)return h.decode(y.subarray(w,b));let x="";for(;w<b;){let S=y[w++];if(!(S&128)){x+=String.fromCharCode(S);continue}const j=y[w++]&63;if((S&224)===192){x+=String.fromCharCode((S&31)<<6|j);continue}const N=y[w++]&63;if((S&240)===224?S=(S&15)<<12|j<<6|N:S=(S&7)<<18|j<<12|N<<6|y[w++]&63,S<65536)x+=String.fromCharCode(S);else{const T=S-65536;x+=String.fromCharCode(55296|T>>10,56320|T&1023)}}return x}function p(y,w){return y?f(s.HEAPU8,y,w):""}const m={emscripten_get_now:j5,emscripten_memcpy_big:o,emscripten_resize_heap:l,fd_write:()=>0};async function _(){const w=await e({env:m,wasi_snapshot_preview1:m});t=w.memory,a(t.buffer),Object.assign(s,w),s.UTF8ToString=p}return await _(),s}var A5=Object.defineProperty,D5=(e,t,n)=>t in e?A5(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,on=(e,t,n)=>D5(e,typeof t!="symbol"?t+"":t,n);let hn=null;function L5(e){throw new Lp(e.UTF8ToString(e.getLastOnigError()))}class Bu{constructor(t){on(this,"utf16Length"),on(this,"utf8Length"),on(this,"utf16Value"),on(this,"utf8Value"),on(this,"utf16OffsetToUtf8"),on(this,"utf8OffsetToUtf16");const n=t.length,s=Bu._utf8ByteLength(t),a=s!==n,o=a?new Uint32Array(n+1):null;a&&(o[n]=s);const c=a?new Uint32Array(s+1):null;a&&(c[s]=n);const l=new Uint8Array(s);let h=0;for(let f=0;f<n;f++){const p=t.charCodeAt(f);let m=p,_=!1;if(p>=55296&&p<=56319&&f+1<n){const y=t.charCodeAt(f+1);y>=56320&&y<=57343&&(m=(p-55296<<10)+65536|y-56320,_=!0)}a&&(o[f]=h,_&&(o[f+1]=h),m<=127?c[h+0]=f:m<=2047?(c[h+0]=f,c[h+1]=f):m<=65535?(c[h+0]=f,c[h+1]=f,c[h+2]=f):(c[h+0]=f,c[h+1]=f,c[h+2]=f,c[h+3]=f)),m<=127?l[h++]=m:m<=2047?(l[h++]=192|(m&1984)>>>6,l[h++]=128|(m&63)>>>0):m<=65535?(l[h++]=224|(m&61440)>>>12,l[h++]=128|(m&4032)>>>6,l[h++]=128|(m&63)>>>0):(l[h++]=240|(m&1835008)>>>18,l[h++]=128|(m&258048)>>>12,l[h++]=128|(m&4032)>>>6,l[h++]=128|(m&63)>>>0),_&&f++}this.utf16Length=n,this.utf8Length=s,this.utf16Value=t,this.utf8Value=l,this.utf16OffsetToUtf8=o,this.utf8OffsetToUtf16=c}static _utf8ByteLength(t){let n=0;for(let s=0,a=t.length;s<a;s++){const o=t.charCodeAt(s);let c=o,l=!1;if(o>=55296&&o<=56319&&s+1<a){const h=t.charCodeAt(s+1);h>=56320&&h<=57343&&(c=(o-55296<<10)+65536|h-56320,l=!0)}c<=127?n+=1:c<=2047?n+=2:c<=65535?n+=3:n+=4,l&&s++}return n}createString(t){const n=t.omalloc(this.utf8Length);return t.HEAPU8.set(this.utf8Value,n),n}}const zu=class Ar{constructor(t){if(on(this,"id",++Ar.LAST_ID),on(this,"_onigBinding"),on(this,"content"),on(this,"utf16Length"),on(this,"utf8Length"),on(this,"utf16OffsetToUtf8"),on(this,"utf8OffsetToUtf16"),on(this,"ptr"),!hn)throw new Lp("Must invoke loadWasm first.");this._onigBinding=hn,this.content=t;const n=new Bu(t);this.utf16Length=n.utf16Length,this.utf8Length=n.utf8Length,this.utf16OffsetToUtf8=n.utf16OffsetToUtf8,this.utf8OffsetToUtf16=n.utf8OffsetToUtf16,this.utf8Length<1e4&&!Ar._sharedPtrInUse?(Ar._sharedPtr||(Ar._sharedPtr=hn.omalloc(1e4)),Ar._sharedPtrInUse=!0,hn.HEAPU8.set(n.utf8Value,Ar._sharedPtr),this.ptr=Ar._sharedPtr):this.ptr=n.createString(hn)}convertUtf8OffsetToUtf16(t){return this.utf8OffsetToUtf16?t<0?0:t>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[t]:t}convertUtf16OffsetToUtf8(t){return this.utf16OffsetToUtf8?t<0?0:t>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[t]:t}dispose(){this.ptr===Ar._sharedPtr?Ar._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};on(zu,"LAST_ID",0);on(zu,"_sharedPtr",0);on(zu,"_sharedPtrInUse",!1);let O1=zu;class R5{constructor(t){if(on(this,"_onigBinding"),on(this,"_ptr"),!hn)throw new Lp("Must invoke loadWasm first.");const n=[],s=[];for(let l=0,h=t.length;l<h;l++){const f=new Bu(t[l]);n[l]=f.createString(hn),s[l]=f.utf8Length}const a=hn.omalloc(4*t.length);hn.HEAPU32.set(n,a/4);const o=hn.omalloc(4*t.length);hn.HEAPU32.set(s,o/4);const c=hn.createOnigScanner(a,o,t.length);for(let l=0,h=t.length;l<h;l++)hn.ofree(n[l]);hn.ofree(o),hn.ofree(a),c===0&&L5(hn),this._onigBinding=hn,this._ptr=c}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(t,n,s){let a=0;if(typeof s=="number"&&(a=s),typeof t=="string"){t=new O1(t);const o=this._findNextMatchSync(t,n,!1,a);return t.dispose(),o}return this._findNextMatchSync(t,n,!1,a)}_findNextMatchSync(t,n,s,a){const o=this._onigBinding,c=o.findNextOnigScannerMatch(this._ptr,t.id,t.ptr,t.utf8Length,t.convertUtf16OffsetToUtf8(n),a);if(c===0)return null;const l=o.HEAPU32;let h=c/4;const f=l[h++],p=l[h++],m=[];for(let _=0;_<p;_++){const y=t.convertUtf8OffsetToUtf16(l[h++]),w=t.convertUtf8OffsetToUtf16(l[h++]);m[_]={start:y,end:w,length:w-y}}return{index:f,captureIndices:m}}}function O5(e){return typeof e.instantiator=="function"}function M5(e){return typeof e.default=="function"}function I5(e){return typeof e.data<"u"}function P5(e){return typeof Response<"u"&&e instanceof Response}function B5(e){var t;return typeof ArrayBuffer<"u"&&(e instanceof ArrayBuffer||ArrayBuffer.isView(e))||typeof Buffer<"u"&&((t=Buffer.isBuffer)==null?void 0:t.call(Buffer,e))||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer||typeof Uint32Array<"u"&&e instanceof Uint32Array}let Uc;function Rp(e){if(Uc)return Uc;async function t(){hn=await N5(async n=>{let s=e;return s=await s,typeof s=="function"&&(s=await s(n)),typeof s=="function"&&(s=await s(n)),O5(s)?s=await s.instantiator(n):M5(s)?s=await s.default(n):(I5(s)&&(s=s.data),P5(s)?typeof WebAssembly.instantiateStreaming=="function"?s=await z5(s)(n):s=await H5(s)(n):B5(s)?s=await Ff(s)(n):s instanceof WebAssembly.Module?s=await Ff(s)(n):"default"in s&&s.default instanceof WebAssembly.Module&&(s=await Ff(s.default)(n))),"instance"in s&&(s=s.instance),"exports"in s&&(s=s.exports),s})}return Uc=t(),Uc}function Ff(e){return t=>WebAssembly.instantiate(e,t)}function z5(e){return t=>WebAssembly.instantiateStreaming(e,t)}function H5(e){return async t=>{const n=await e.arrayBuffer();return WebAssembly.instantiate(n,t)}}let M1;function $5(e){M1=e}function U5(){return M1}async function I1(e){return e&&await Rp(e),{createScanner(t){return new R5(t.map(n=>typeof n=="string"?n:n.source))},createString(t){return new O1(t)}}}const F5=Object.freeze(Object.defineProperty({__proto__:null,createOnigurumaEngine:I1,getDefaultWasmLoader:U5,loadWasm:Rp,setDefaultWasmLoader:$5},Symbol.toStringTag,{value:"Module"}));var P1=Ep({});R1(P1,F5);var Tt=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function V5(e){return Op(e)}function Op(e){return Array.isArray(e)?G5(e):e instanceof RegExp?e:typeof e=="object"?W5(e):e}function G5(e){let t=[];for(let n=0,s=e.length;n<s;n++)t[n]=Op(e[n]);return t}function W5(e){let t={};for(let n in e)t[n]=Op(e[n]);return t}function B1(e,...t){return t.forEach(n=>{for(let s in n)e[s]=n[s]}),e}function z1(e){const t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");return t===0?e:~t===e.length-1?z1(e.substring(0,e.length-1)):e.substr(~t+1)}var Vf=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,Fc=class{static hasCaptures(e){return e===null?!1:(Vf.lastIndex=0,Vf.test(e))}static replaceCaptures(e,t,n){return e.replace(Vf,(s,a,o,c)=>{let l=n[parseInt(a||o,10)];if(l){let h=t.substring(l.start,l.end);for(;h[0]===".";)h=h.substring(1);switch(c){case"downcase":return h.toLowerCase();case"upcase":return h.toUpperCase();default:return h}}else return s})}};function H1(e,t){return e<t?-1:e>t?1:0}function $1(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,s=t.length;if(n===s){for(let a=0;a<n;a++){let o=H1(e[a],t[a]);if(o!==0)return o}return 0}return n-s}function Ab(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 U1(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var F1=class{constructor(e){me(this,"cache",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}},ou=class{constructor(e,t,n){me(this,"_cachedMatchRoot",new F1(e=>this._root.match(e)));this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(Y5(e),t)}static createFromParsedTheme(e,t){return Q5(e,t)}getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;const t=e.scopeName,s=this._cachedMatchRoot.get(t).find(a=>q5(e.parent,a.parentScopes));return s?new V1(s.fontStyle,s.foreground,s.background):null}},Gf=class Qc{constructor(t,n){this.parent=t,this.scopeName=n}static push(t,n){for(const s of n)t=new Qc(t,s);return t}static from(...t){let n=null;for(let s=0;s<t.length;s++)n=new Qc(n,t[s]);return n}push(t){return new Qc(this,t)}getSegments(){let t=this;const n=[];for(;t;)n.push(t.scopeName),t=t.parent;return n.reverse(),n}toString(){return this.getSegments().join(" ")}extends(t){return this===t?!0:this.parent===null?!1:this.parent.extends(t)}getExtensionIfDefined(t){const n=[];let s=this;for(;s&&s!==t;)n.push(s.scopeName),s=s.parent;return s===t?n.reverse():void 0}};function q5(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let s=t[n],a=!1;if(s===">"){if(n===t.length-1)return!1;s=t[++n],a=!0}for(;e&&!K5(e.scopeName,s);){if(a)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function K5(e,t){return t===e||e.startsWith(t)&&e[t.length]==="."}var V1=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function Y5(e){if(!e)return[];if(!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],s=0;for(let a=0,o=t.length;a<o;a++){let c=t[a];if(!c.settings)continue;let l;if(typeof c.scope=="string"){let m=c.scope;m=m.replace(/^[,]+/,""),m=m.replace(/[,]+$/,""),l=m.split(",")}else Array.isArray(c.scope)?l=c.scope:l=[""];let h=-1;if(typeof c.settings.fontStyle=="string"){h=0;let m=c.settings.fontStyle.split(" ");for(let _=0,y=m.length;_<y;_++)switch(m[_]){case"italic":h=h|1;break;case"bold":h=h|2;break;case"underline":h=h|4;break;case"strikethrough":h=h|8;break}}let f=null;typeof c.settings.foreground=="string"&&Ab(c.settings.foreground)&&(f=c.settings.foreground);let p=null;typeof c.settings.background=="string"&&Ab(c.settings.background)&&(p=c.settings.background);for(let m=0,_=l.length;m<_;m++){let w=l[m].trim().split(" "),k=w[w.length-1],v=null;w.length>1&&(v=w.slice(0,w.length-1),v.reverse()),n[s++]=new X5(k,v,a,h,f,p)}}return n}var X5=class{constructor(e,t,n,s,a,o){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=s,this.foreground=a,this.background=o}},Cn=(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))(Cn||{});function Q5(e,t){e.sort((h,f)=>{let p=H1(h.scope,f.scope);return p!==0||(p=$1(h.parentScopes,f.parentScopes),p!==0)?p:h.index-f.index});let n=0,s="#000000",a="#ffffff";for(;e.length>=1&&e[0].scope==="";){let h=e.shift();h.fontStyle!==-1&&(n=h.fontStyle),h.foreground!==null&&(s=h.foreground),h.background!==null&&(a=h.background)}let o=new J5(t),c=new V1(n,o.getId(s),o.getId(a)),l=new eO(new Em(0,null,-1,0,0),[]);for(let h=0,f=e.length;h<f;h++){let p=e[h];l.insert(0,p.scope,p.parentScopes,p.fontStyle,o.getId(p.foreground),o.getId(p.background))}return new ou(o,c,l)}var J5=class{constructor(e){me(this,"_isFrozen");me(this,"_lastColorId");me(this,"_id2color");me(this,"_color2id");if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(e===null)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw new Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},Z5=Object.freeze([]),Em=class G1{constructor(t,n,s,a,o){me(this,"scopeDepth");me(this,"parentScopes");me(this,"fontStyle");me(this,"foreground");me(this,"background");this.scopeDepth=t,this.parentScopes=n||Z5,this.fontStyle=s,this.foreground=a,this.background=o}clone(){return new G1(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(t){let n=[];for(let s=0,a=t.length;s<a;s++)n[s]=t[s].clone();return n}acceptOverwrite(t,n,s,a){this.scopeDepth>t?console.log("how did this happen?"):this.scopeDepth=t,n!==-1&&(this.fontStyle=n),s!==0&&(this.foreground=s),a!==0&&(this.background=a)}},eO=class jm{constructor(t,n=[],s={}){me(this,"_rulesWithParentScopes");this._mainRule=t,this._children=s,this._rulesWithParentScopes=n}static _cmpBySpecificity(t,n){if(t.scopeDepth!==n.scopeDepth)return n.scopeDepth-t.scopeDepth;let s=0,a=0;for(;t.parentScopes[s]===">"&&s++,n.parentScopes[a]===">"&&a++,!(s>=t.parentScopes.length||a>=n.parentScopes.length);){const o=n.parentScopes[a].length-t.parentScopes[s].length;if(o!==0)return o;s++,a++}return n.parentScopes.length-t.parentScopes.length}match(t){if(t!==""){let s=t.indexOf("."),a,o;if(s===-1?(a=t,o=""):(a=t.substring(0,s),o=t.substring(s+1)),this._children.hasOwnProperty(a))return this._children[a].match(o)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(jm._cmpBySpecificity),n}insert(t,n,s,a,o,c){if(n===""){this._doInsertHere(t,s,a,o,c);return}let l=n.indexOf("."),h,f;l===-1?(h=n,f=""):(h=n.substring(0,l),f=n.substring(l+1));let p;this._children.hasOwnProperty(h)?p=this._children[h]:(p=new jm(this._mainRule.clone(),Em.cloneArr(this._rulesWithParentScopes)),this._children[h]=p),p.insert(t+1,f,s,a,o,c)}_doInsertHere(t,n,s,a,o){if(n===null){this._mainRule.acceptOverwrite(t,s,a,o);return}for(let c=0,l=this._rulesWithParentScopes.length;c<l;c++){let h=this._rulesWithParentScopes[c];if($1(h.parentScopes,n)===0){h.acceptOverwrite(t,s,a,o);return}}s===-1&&(s=this._mainRule.fontStyle),a===0&&(a=this._mainRule.foreground),o===0&&(o=this._mainRule.background),this._rulesWithParentScopes.push(new Em(t,n,s,a,o))}},Oa=class cr{static toBinaryStr(t){return t.toString(2).padStart(32,"0")}static print(t){const n=cr.getLanguageId(t),s=cr.getTokenType(t),a=cr.getFontStyle(t),o=cr.getForeground(t),c=cr.getBackground(t);console.log({languageId:n,tokenType:s,fontStyle:a,foreground:o,background:c})}static getLanguageId(t){return(t&255)>>>0}static getTokenType(t){return(t&768)>>>8}static containsBalancedBrackets(t){return(t&1024)!==0}static getFontStyle(t){return(t&30720)>>>11}static getForeground(t){return(t&16744448)>>>15}static getBackground(t){return(t&4278190080)>>>24}static set(t,n,s,a,o,c,l){let h=cr.getLanguageId(t),f=cr.getTokenType(t),p=cr.containsBalancedBrackets(t)?1:0,m=cr.getFontStyle(t),_=cr.getForeground(t),y=cr.getBackground(t);return n!==0&&(h=n),s!==8&&(f=s),a!==null&&(p=a?1:0),o!==-1&&(m=o),c!==0&&(_=c),l!==0&&(y=l),(h<<0|f<<8|p<<10|m<<11|_<<15|y<<24)>>>0}};function lu(e,t){const n=[],s=tO(e);let a=s.next();for(;a!==null;){let h=0;if(a.length===2&&a.charAt(1)===":"){switch(a.charAt(0)){case"R":h=1;break;case"L":h=-1;break;default:console.log(`Unknown priority ${a} in scope selector`)}a=s.next()}let f=c();if(n.push({matcher:f,priority:h}),a!==",")break;a=s.next()}return n;function o(){if(a==="-"){a=s.next();const h=o();return f=>!!h&&!h(f)}if(a==="("){a=s.next();const h=l();return a===")"&&(a=s.next()),h}if(Db(a)){const h=[];do h.push(a),a=s.next();while(Db(a));return f=>t(h,f)}return null}function c(){const h=[];let f=o();for(;f;)h.push(f),f=o();return p=>h.every(m=>m(p))}function l(){const h=[];let f=c();for(;f&&(h.push(f),a==="|"||a===",");){do a=s.next();while(a==="|"||a===",");f=c()}return p=>h.some(m=>m(p))}}function Db(e){return!!e&&!!e.match(/[\w\.:]+/)}function tO(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;const s=n[0];return n=t.exec(e),s}}}function W1(e){typeof e.dispose=="function"&&e.dispose()}var sl=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},nO=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},rO=class{constructor(){me(this,"_references",[]);me(this,"_seenReferenceKeys",new Set);me(this,"visitedRule",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))}},sO=class{constructor(e,t){me(this,"seenFullScopeRequests",new Set);me(this,"seenPartialScopeRequests",new Set);me(this,"Q");this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new sl(this.initialScopeName)]}processQueue(){const e=this.Q;this.Q=[];const t=new rO;for(const n of e)iO(n,this.initialScopeName,this.repo,t);for(const n of t.references)if(n instanceof sl){if(this.seenFullScopeRequests.has(n.scopeName))continue;this.seenFullScopeRequests.add(n.scopeName),this.Q.push(n)}else{if(this.seenFullScopeRequests.has(n.scopeName)||this.seenPartialScopeRequests.has(n.toKey()))continue;this.seenPartialScopeRequests.add(n.toKey()),this.Q.push(n)}}};function iO(e,t,n,s){const a=n.lookup(e.scopeName);if(!a){if(e.scopeName===t)throw new Error(`No grammar provided for <${t}>`);return}const o=n.lookup(t);e instanceof sl?Jc({baseGrammar:o,selfGrammar:a},s):Tm(e.ruleName,{baseGrammar:o,selfGrammar:a,repository:a.repository},s);const c=n.injections(e.scopeName);if(c)for(const l of c)s.add(new sl(l))}function Tm(e,t,n){if(t.repository&&t.repository[e]){const s=t.repository[e];cu([s],t,n)}}function Jc(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&cu(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&cu(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function cu(e,t,n){for(const s of e){if(n.visitedRule.has(s))continue;n.visitedRule.add(s);const a=s.repository?B1({},t.repository,s.repository):t.repository;Array.isArray(s.patterns)&&cu(s.patterns,{...t,repository:a},n);const o=s.include;if(!o)continue;const c=q1(o);switch(c.kind){case 0:Jc({...t,selfGrammar:t.baseGrammar},n);break;case 1:Jc(t,n);break;case 2:Tm(c.ruleName,{...t,repository:a},n);break;case 3:case 4:const l=c.scopeName===t.selfGrammar.scopeName?t.selfGrammar:c.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(l){const h={baseGrammar:t.baseGrammar,selfGrammar:l,repository:a};c.kind===4?Tm(c.ruleName,h,n):Jc(h,n)}else c.kind===4?n.add(new nO(c.scopeName,c.ruleName)):n.add(new sl(c.scopeName));break}}}var aO=class{constructor(){me(this,"kind",0)}},oO=class{constructor(){me(this,"kind",1)}},lO=class{constructor(e){me(this,"kind",2);this.ruleName=e}},cO=class{constructor(e){me(this,"kind",3);this.scopeName=e}},uO=class{constructor(e,t){me(this,"kind",4);this.scopeName=e,this.ruleName=t}};function q1(e){if(e==="$base")return new aO;if(e==="$self")return new oO;const t=e.indexOf("#");if(t===-1)return new cO(e);if(t===0)return new lO(e.substring(1));{const n=e.substring(0,t),s=e.substring(t+1);return new uO(n,s)}}var dO=/\\(\d+)/,Lb=/\\(\d+)/g,hO=-1,K1=-2;var xl=class{constructor(e,t,n,s){me(this,"$location");me(this,"id");me(this,"_nameIsCapturing");me(this,"_name");me(this,"_contentNameIsCapturing");me(this,"_contentName");this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=Fc.hasCaptures(this._name),this._contentName=s||null,this._contentNameIsCapturing=Fc.hasCaptures(this._contentName)}get debugName(){const e=this.$location?`${z1(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return!this._nameIsCapturing||this._name===null||e===null||t===null?this._name:Fc.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:Fc.replaceCaptures(this._contentName,e,t)}},fO=class extends xl{constructor(t,n,s,a,o){super(t,n,s,a);me(this,"retokenizeCapturedWithRuleId");this.retokenizeCapturedWithRuleId=o}dispose(){}collectPatterns(t,n){throw new Error("Not supported!")}compile(t,n){throw new Error("Not supported!")}compileAG(t,n,s,a){throw new Error("Not supported!")}},mO=class extends xl{constructor(t,n,s,a,o){super(t,n,s,null);me(this,"_match");me(this,"captures");me(this,"_cachedCompiledPatterns");this._match=new il(a,this.id),this.captures=o,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(t,n){n.push(this._match)}compile(t,n){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,n,s,a){return this._getCachedCompiledPatterns(t).compileAG(t,s,a)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new al,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Rb=class extends xl{constructor(t,n,s,a,o){super(t,n,s,a);me(this,"hasMissingPatterns");me(this,"patterns");me(this,"_cachedCompiledPatterns");this.patterns=o.patterns,this.hasMissingPatterns=o.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(t,n){for(const s of this.patterns)t.getRule(s).collectPatterns(t,n)}compile(t,n){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,n,s,a){return this._getCachedCompiledPatterns(t).compileAG(t,s,a)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new al,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Nm=class extends xl{constructor(t,n,s,a,o,c,l,h,f,p){super(t,n,s,a);me(this,"_begin");me(this,"beginCaptures");me(this,"_end");me(this,"endHasBackReferences");me(this,"endCaptures");me(this,"applyEndPatternLast");me(this,"hasMissingPatterns");me(this,"patterns");me(this,"_cachedCompiledPatterns");this._begin=new il(o,this.id),this.beginCaptures=c,this._end=new il(l||"￿",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=h,this.applyEndPatternLast=f||!1,this.patterns=p.patterns,this.hasMissingPatterns=p.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(t,n){return this._end.resolveBackReferences(t,n)}collectPatterns(t,n){n.push(this._begin)}compile(t,n){return this._getCachedCompiledPatterns(t,n).compile(t)}compileAG(t,n,s,a){return this._getCachedCompiledPatterns(t,n).compileAG(t,s,a)}_getCachedCompiledPatterns(t,n){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new al;for(const s of this.patterns)t.getRule(s).collectPatterns(t,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,n):this._cachedCompiledPatterns.setSource(0,n)),this._cachedCompiledPatterns}},uu=class extends xl{constructor(t,n,s,a,o,c,l,h,f){super(t,n,s,a);me(this,"_begin");me(this,"beginCaptures");me(this,"whileCaptures");me(this,"_while");me(this,"whileHasBackReferences");me(this,"hasMissingPatterns");me(this,"patterns");me(this,"_cachedCompiledPatterns");me(this,"_cachedCompiledWhilePatterns");this._begin=new il(o,this.id),this.beginCaptures=c,this.whileCaptures=h,this._while=new il(l,K1),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=f.patterns,this.hasMissingPatterns=f.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(t,n){return this._while.resolveBackReferences(t,n)}collectPatterns(t,n){n.push(this._begin)}compile(t,n){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,n,s,a){return this._getCachedCompiledPatterns(t).compileAG(t,s,a)}_getCachedCompiledPatterns(t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new al;for(const n of this.patterns)t.getRule(n).collectPatterns(t,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(t,n){return this._getCachedCompiledWhilePatterns(t,n).compile(t)}compileWhileAG(t,n,s,a){return this._getCachedCompiledWhilePatterns(t,n).compileAG(t,s,a)}_getCachedCompiledWhilePatterns(t,n){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new al,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,n||"￿"),this._cachedCompiledWhilePatterns}},Y1=class Sn{static createCaptureRule(t,n,s,a,o){return t.registerRule(c=>new fO(n,c,s,a,o))}static getCompiledRuleId(t,n,s){return t.id||n.registerRule(a=>{if(t.id=a,t.match)return new mO(t.$vscodeTextmateLocation,t.id,t.name,t.match,Sn._compileCaptures(t.captures,n,s));if(typeof t.begin>"u"){t.repository&&(s=B1({},s,t.repository));let o=t.patterns;return typeof o>"u"&&t.include&&(o=[{include:t.include}]),new Rb(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,Sn._compilePatterns(o,n,s))}return t.while?new uu(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,Sn._compileCaptures(t.beginCaptures||t.captures,n,s),t.while,Sn._compileCaptures(t.whileCaptures||t.captures,n,s),Sn._compilePatterns(t.patterns,n,s)):new Nm(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,Sn._compileCaptures(t.beginCaptures||t.captures,n,s),t.end,Sn._compileCaptures(t.endCaptures||t.captures,n,s),t.applyEndPatternLast,Sn._compilePatterns(t.patterns,n,s))}),t.id}static _compileCaptures(t,n,s){let a=[];if(t){let o=0;for(const c in t){if(c==="$vscodeTextmateLocation")continue;const l=parseInt(c,10);l>o&&(o=l)}for(let c=0;c<=o;c++)a[c]=null;for(const c in t){if(c==="$vscodeTextmateLocation")continue;const l=parseInt(c,10);let h=0;t[c].patterns&&(h=Sn.getCompiledRuleId(t[c],n,s)),a[l]=Sn.createCaptureRule(n,t[c].$vscodeTextmateLocation,t[c].name,t[c].contentName,h)}}return a}static _compilePatterns(t,n,s){let a=[];if(t)for(let o=0,c=t.length;o<c;o++){const l=t[o];let h=-1;if(l.include){const f=q1(l.include);switch(f.kind){case 0:case 1:h=Sn.getCompiledRuleId(s[l.include],n,s);break;case 2:let p=s[f.ruleName];p&&(h=Sn.getCompiledRuleId(p,n,s));break;case 3:case 4:const m=f.scopeName,_=f.kind===4?f.ruleName:null,y=n.getExternalGrammar(m,s);if(y)if(_){let w=y.repository[_];w&&(h=Sn.getCompiledRuleId(w,n,y.repository))}else h=Sn.getCompiledRuleId(y.repository.$self,n,y.repository);break}}else h=Sn.getCompiledRuleId(l,n,s);if(h!==-1){const f=n.getRule(h);let p=!1;if((f instanceof Rb||f instanceof Nm||f instanceof uu)&&f.hasMissingPatterns&&f.patterns.length===0&&(p=!0),p)continue;a.push(h)}}return{patterns:a,hasMissingPatterns:(t?t.length:0)!==a.length}}},il=class X1{constructor(t,n){me(this,"source");me(this,"ruleId");me(this,"hasAnchor");me(this,"hasBackReferences");me(this,"_anchorCache");if(t&&typeof t=="string"){const s=t.length;let a=0,o=[],c=!1;for(let l=0;l<s;l++)if(t.charAt(l)==="\\"&&l+1<s){const f=t.charAt(l+1);f==="z"?(o.push(t.substring(a,l)),o.push("$(?!\\n)(?<!\\n)"),a=l+2):(f==="A"||f==="G")&&(c=!0),l++}this.hasAnchor=c,a===0?this.source=t:(o.push(t.substring(a,s)),this.source=o.join(""))}else this.hasAnchor=!1,this.source=t;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=n,typeof this.source=="string"?this.hasBackReferences=dO.test(this.source):this.hasBackReferences=!1}clone(){return new X1(this.source,this.ruleId)}setSource(t){this.source!==t&&(this.source=t,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(t,n){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let s=n.map(a=>t.substring(a.start,a.end));return Lb.lastIndex=0,this.source.replace(Lb,(a,o)=>U1(s[parseInt(o,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let t=[],n=[],s=[],a=[],o,c,l,h;for(o=0,c=this.source.length;o<c;o++)l=this.source.charAt(o),t[o]=l,n[o]=l,s[o]=l,a[o]=l,l==="\\"&&o+1<c&&(h=this.source.charAt(o+1),h==="A"?(t[o+1]="￿",n[o+1]="￿",s[o+1]="A",a[o+1]="A"):h==="G"?(t[o+1]="￿",n[o+1]="G",s[o+1]="￿",a[o+1]="G"):(t[o+1]=h,n[o+1]=h,s[o+1]=h,a[o+1]=h),o++);return{A0_G0:t.join(""),A0_G1:n.join(""),A1_G0:s.join(""),A1_G1:a.join("")}}resolveAnchors(t,n){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:t?n?this._anchorCache.A1_G1:this._anchorCache.A1_G0:n?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},al=class{constructor(){me(this,"_items");me(this,"_hasAnchors");me(this,"_cached");me(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(n=>n.source);this._cached=new Ob(e,t,this._items.map(n=>n.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){let s=this._items.map(a=>a.resolveAnchors(t,n));return new Ob(e,s,this._items.map(a=>a.ruleId))}},Ob=class{constructor(e,t,n){me(this,"scanner");this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(" - "+this.rules[t]+": "+this.regExps[t]);return e.join(`
123
+ `)}findNextMatchSync(e,t,n){const s=this.scanner.findNextMatchSync(e,t,n);return s?{ruleId:this.rules[s.index],captureIndices:s.captureIndices}:null}},Wf=class{constructor(e,t){this.languageId=e,this.tokenType=t}},os,pO=(os=class{constructor(t,n){me(this,"_defaultAttributes");me(this,"_embeddedLanguagesMatcher");me(this,"_getBasicScopeAttributes",new F1(t=>{const n=this._scopeToLanguage(t),s=this._toStandardTokenType(t);return new Wf(n,s)}));this._defaultAttributes=new Wf(t,8),this._embeddedLanguagesMatcher=new gO(Object.entries(n||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?os._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}_scopeToLanguage(t){return this._embeddedLanguagesMatcher.match(t)||0}_toStandardTokenType(t){const n=t.match(os.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!")}},me(os,"_NULL_SCOPE_METADATA",new Wf(0,0)),me(os,"STANDARD_TOKEN_TYPE_REGEXP",/\b(comment|string|regex|meta\.embedded)\b/),os),gO=class{constructor(e){me(this,"values");me(this,"scopesRegExp");if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);const t=e.map(([n,s])=>U1(n));t.sort(),t.reverse(),this.scopesRegExp=new RegExp(`^((${t.join(")|(")}))($|\\.)`,"")}}match(e){if(!this.scopesRegExp)return;const t=e.match(this.scopesRegExp);if(t)return this.values.get(t[1])}},Mb=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function Q1(e,t,n,s,a,o,c,l){const h=t.content.length;let f=!1,p=-1;if(c){const y=xO(e,t,n,s,a,o);a=y.stack,s=y.linePos,n=y.isFirstLine,p=y.anchorPosition}const m=Date.now();for(;!f;){if(l!==0&&Date.now()-m>l)return new Mb(a,!0);_()}return new Mb(a,!1);function _(){const y=_O(e,t,n,s,a,p);if(!y){o.produce(a,h),f=!0;return}const w=y.captureIndices,k=y.matchedRuleId,v=w&&w.length>0?w[0].end>s:!1;if(k===hO){const b=a.getRule(e);o.produce(a,w[0].start),a=a.withContentNameScopesList(a.nameScopesList),Ko(e,t,n,a,o,b.endCaptures,w),o.produce(a,w[0].end);const x=a;if(a=a.parent,p=x.getAnchorPos(),!v&&x.getEnterPos()===s){a=x,o.produce(a,h),f=!0;return}}else{const b=e.getRule(k);o.produce(a,w[0].start);const x=a,S=b.getName(t.content,w),j=a.contentNameScopesList.pushAttributed(S,e);if(a=a.push(k,s,p,w[0].end===h,null,j,j),b instanceof Nm){const N=b;Ko(e,t,n,a,o,N.beginCaptures,w),o.produce(a,w[0].end),p=w[0].end;const T=N.getContentName(t.content,w),D=j.pushAttributed(T,e);if(a=a.withContentNameScopesList(D),N.endHasBackReferences&&(a=a.withEndRule(N.getEndWithResolvedBackReferences(t.content,w))),!v&&x.hasSameRuleAs(a)){a=a.pop(),o.produce(a,h),f=!0;return}}else if(b instanceof uu){const N=b;Ko(e,t,n,a,o,N.beginCaptures,w),o.produce(a,w[0].end),p=w[0].end;const T=N.getContentName(t.content,w),D=j.pushAttributed(T,e);if(a=a.withContentNameScopesList(D),N.whileHasBackReferences&&(a=a.withEndRule(N.getWhileWithResolvedBackReferences(t.content,w))),!v&&x.hasSameRuleAs(a)){a=a.pop(),o.produce(a,h),f=!0;return}}else if(Ko(e,t,n,a,o,b.captures,w),o.produce(a,w[0].end),a=a.pop(),!v){a=a.safePop(),o.produce(a,h),f=!0;return}}w[0].end>s&&(s=w[0].end,n=!1)}}function xO(e,t,n,s,a,o){let c=a.beginRuleCapturedEOL?0:-1;const l=[];for(let h=a;h;h=h.pop()){const f=h.getRule(e);f instanceof uu&&l.push({rule:f,stack:h})}for(let h=l.pop();h;h=l.pop()){const{ruleScanner:f,findOptions:p}=bO(h.rule,e,h.stack.endRule,n,s===c),m=f.findNextMatchSync(t,s,p);if(m){if(m.ruleId!==K1){a=h.stack.pop();break}m.captureIndices&&m.captureIndices.length&&(o.produce(h.stack,m.captureIndices[0].start),Ko(e,t,n,h.stack,o,h.rule.whileCaptures,m.captureIndices),o.produce(h.stack,m.captureIndices[0].end),c=m.captureIndices[0].end,m.captureIndices[0].end>s&&(s=m.captureIndices[0].end,n=!1))}else{a=h.stack.pop();break}}return{stack:a,linePos:s,anchorPosition:c,isFirstLine:n}}function _O(e,t,n,s,a,o){const c=yO(e,t,n,s,a,o),l=e.getInjections();if(l.length===0)return c;const h=vO(l,e,t,n,s,a,o);if(!h)return c;if(!c)return h;const f=c.captureIndices[0].start,p=h.captureIndices[0].start;return p<f||h.priorityMatch&&p===f?h:c}function yO(e,t,n,s,a,o){const c=a.getRule(e),{ruleScanner:l,findOptions:h}=J1(c,e,a.endRule,n,s===o),f=l.findNextMatchSync(t,s,h);return f?{captureIndices:f.captureIndices,matchedRuleId:f.ruleId}:null}function vO(e,t,n,s,a,o,c){let l=Number.MAX_VALUE,h=null,f,p=0;const m=o.contentNameScopesList.getScopeNames();for(let _=0,y=e.length;_<y;_++){const w=e[_];if(!w.matcher(m))continue;const k=t.getRule(w.ruleId),{ruleScanner:v,findOptions:b}=J1(k,t,null,s,a===c),x=v.findNextMatchSync(n,a,b);if(!x)continue;const S=x.captureIndices[0].start;if(!(S>=l)&&(l=S,h=x.captureIndices,f=x.ruleId,p=w.priority,l===a))break}return h?{priorityMatch:p===-1,captureIndices:h,matchedRuleId:f}:null}function J1(e,t,n,s,a){return{ruleScanner:e.compileAG(t,n,s,a),findOptions:0}}function bO(e,t,n,s,a){return{ruleScanner:e.compileWhileAG(t,n,s,a),findOptions:0}}function Ko(e,t,n,s,a,o,c){if(o.length===0)return;const l=t.content,h=Math.min(o.length,c.length),f=[],p=c[0].end;for(let m=0;m<h;m++){const _=o[m];if(_===null)continue;const y=c[m];if(y.length===0)continue;if(y.start>p)break;for(;f.length>0&&f[f.length-1].endPos<=y.start;)a.produceFromScopes(f[f.length-1].scopes,f[f.length-1].endPos),f.pop();if(f.length>0?a.produceFromScopes(f[f.length-1].scopes,y.start):a.produce(s,y.start),_.retokenizeCapturedWithRuleId){const k=_.getName(l,c),v=s.contentNameScopesList.pushAttributed(k,e),b=_.getContentName(l,c),x=v.pushAttributed(b,e),S=s.push(_.retokenizeCapturedWithRuleId,y.start,-1,!1,null,v,x),j=e.createOnigString(l.substring(0,y.end));Q1(e,j,n&&y.start===0,y.start,S,a,!1,0),W1(j);continue}const w=_.getName(l,c);if(w!==null){const v=(f.length>0?f[f.length-1].scopes:s.contentNameScopesList).pushAttributed(w,e);f.push(new SO(v,y.end))}}for(;f.length>0;)a.produceFromScopes(f[f.length-1].scopes,f[f.length-1].endPos),f.pop()}var SO=class{constructor(e,t){me(this,"scopes");me(this,"endPos");this.scopes=e,this.endPos=t}};function wO(e,t,n,s,a,o,c,l){return new kO(e,t,n,s,a,o,c,l)}function Ib(e,t,n,s,a){const o=lu(t,du),c=Y1.getCompiledRuleId(n,s,a.repository);for(const l of o)e.push({debugSelector:t,matcher:l.matcher,ruleId:c,grammar:a,priority:l.priority})}function du(e,t){if(t.length<e.length)return!1;let n=0;return e.every(s=>{for(let a=n;a<t.length;a++)if(CO(t[a],s))return n=a+1,!0;return!1})}function CO(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 kO=class{constructor(e,t,n,s,a,o,c,l){me(this,"_rootId");me(this,"_lastRuleId");me(this,"_ruleId2desc");me(this,"_includedGrammars");me(this,"_grammarRepository");me(this,"_grammar");me(this,"_injections");me(this,"_basicScopeAttributesProvider");me(this,"_tokenTypeMatchers");if(this._rootScopeName=e,this.balancedBracketSelectors=o,this._onigLib=l,this._basicScopeAttributesProvider=new pO(n,s),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=c,this._grammar=Pb(t,null),this._injections=null,this._tokenTypeMatchers=[],a)for(const h of Object.keys(a)){const f=lu(h,du);for(const p of f)this._tokenTypeMatchers.push({matcher:p.matcher,type:a[h]})}}get themeProvider(){return this._grammarRepository}dispose(){for(const e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){const e={lookup:a=>a===this._rootScopeName?this._grammar:this.getExternalGrammar(a),injections:a=>this._grammarRepository.injections(a)},t=[],n=this._rootScopeName,s=e.lookup(n);if(s){const a=s.injections;if(a)for(let c in a)Ib(t,c,a[c],this,s);const o=this._grammarRepository.injections(n);o&&o.forEach(c=>{const l=this.getExternalGrammar(c);if(l){const h=l.injectionSelector;h&&Ib(t,h,l,this,l)}})}return t.sort((a,o)=>a.priority-o.priority),t}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(e){const t=++this._lastRuleId,n=e(t);return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[e]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){const n=this._grammarRepository.lookup(e);if(n)return this._includedGrammars[e]=Pb(n,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,n=0){const s=this._tokenize(e,t,!1,n);return{tokens:s.lineTokens.getResult(s.ruleStack,s.lineLength),ruleStack:s.ruleStack,stoppedEarly:s.stoppedEarly}}tokenizeLine2(e,t,n=0){const s=this._tokenize(e,t,!0,n);return{tokens:s.lineTokens.getBinaryResult(s.ruleStack,s.lineLength),ruleStack:s.ruleStack,stoppedEarly:s.stoppedEarly}}_tokenize(e,t,n,s){this._rootId===-1&&(this._rootId=Y1.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let a;if(!t||t===Am.NULL){a=!0;const f=this._basicScopeAttributesProvider.getDefaultAttributes(),p=this.themeProvider.getDefaults(),m=Oa.set(0,f.languageId,f.tokenType,null,p.fontStyle,p.foregroundId,p.backgroundId),_=this.getRule(this._rootId).getName(null,null);let y;_?y=Zo.createRootAndLookUpScopeName(_,m,this):y=Zo.createRoot("unknown",m),t=new Am(null,this._rootId,-1,-1,!1,null,y,y)}else a=!1,t.reset();e=e+`
124
+ `;const o=this.createOnigString(e),c=o.content.length,l=new jO(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),h=Q1(this,o,a,0,t,l,!0,s);return W1(o),{lineLength:c,lineTokens:l,ruleStack:h.stack,stoppedEarly:h.stoppedEarly}}};function Pb(e,t){return e=V5(e),e.repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var Zo=class Dr{constructor(t,n,s){this.parent=t,this.scopePath=n,this.tokenAttributes=s}static fromExtension(t,n){let s=t,a=(t==null?void 0:t.scopePath)??null;for(const o of n)a=Gf.push(a,o.scopeNames),s=new Dr(s,a,o.encodedTokenAttributes);return s}static createRoot(t,n){return new Dr(null,new Gf(null,t),n)}static createRootAndLookUpScopeName(t,n,s){const a=s.getMetadataForScope(t),o=new Gf(null,t),c=s.themeProvider.themeMatch(o),l=Dr.mergeAttributes(n,a,c);return new Dr(null,o,l)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(t){return Dr.equals(this,t)}static equals(t,n){do{if(t===n||!t&&!n)return!0;if(!t||!n||t.scopeName!==n.scopeName||t.tokenAttributes!==n.tokenAttributes)return!1;t=t.parent,n=n.parent}while(!0)}static mergeAttributes(t,n,s){let a=-1,o=0,c=0;return s!==null&&(a=s.fontStyle,o=s.foregroundId,c=s.backgroundId),Oa.set(t,n.languageId,n.tokenType,null,a,o,c)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(" ")===-1)return Dr._pushAttributed(this,t,n);const s=t.split(/ /g);let a=this;for(const o of s)a=Dr._pushAttributed(a,o,n);return a}static _pushAttributed(t,n,s){const a=s.getMetadataForScope(n),o=t.scopePath.push(n),c=s.themeProvider.themeMatch(o),l=Dr.mergeAttributes(t.tokenAttributes,a,c);return new Dr(t,o,l)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(t){var a;const n=[];let s=this;for(;s&&s!==t;)n.push({encodedTokenAttributes:s.tokenAttributes,scopeNames:s.scopePath.getExtensionIfDefined(((a=s.parent)==null?void 0:a.scopePath)??null)}),s=s.parent;return s===t?n.reverse():void 0}},dr,Am=(dr=class{constructor(t,n,s,a,o,c,l,h){me(this,"_stackElementBrand");me(this,"_enterPos");me(this,"_anchorPos");me(this,"depth");this.parent=t,this.ruleId=n,this.beginRuleCapturedEOL=o,this.endRule=c,this.nameScopesList=l,this.contentNameScopesList=h,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=s,this._anchorPos=a}equals(t){return t===null?!1:dr._equals(this,t)}static _equals(t,n){return t===n?!0:this._structuralEquals(t,n)?Zo.equals(t.contentNameScopesList,n.contentNameScopesList):!1}static _structuralEquals(t,n){do{if(t===n||!t&&!n)return!0;if(!t||!n||t.depth!==n.depth||t.ruleId!==n.ruleId||t.endRule!==n.endRule)return!1;t=t.parent,n=n.parent}while(!0)}clone(){return this}static _reset(t){for(;t;)t._enterPos=-1,t._anchorPos=-1,t=t.parent}reset(){dr._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,s,a,o,c,l){return new dr(this,t,n,s,a,o,c,l)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(t){return t.getRule(this.ruleId)}toString(){const t=[];return this._writeString(t,0),"["+t.join(",")+"]"}_writeString(t,n){var s,a;return this.parent&&(n=this.parent._writeString(t,n)),t[n++]=`(${this.ruleId}, ${(s=this.nameScopesList)==null?void 0:s.toString()}, ${(a=this.contentNameScopesList)==null?void 0:a.toString()})`,n}withContentNameScopesList(t){return this.contentNameScopesList===t?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,t)}withEndRule(t){return this.endRule===t?this:new dr(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(t){let n=this;for(;n&&n._enterPos===t._enterPos;){if(n.ruleId===t.ruleId)return!0;n=n.parent}return!1}toStateStackFrame(){var t,n,s;return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:((n=this.nameScopesList)==null?void 0:n.getExtensionIfDefined(((t=this.parent)==null?void 0:t.nameScopesList)??null))??[],contentNameScopesList:((s=this.contentNameScopesList)==null?void 0:s.getExtensionIfDefined(this.nameScopesList))??[]}}static pushFrame(t,n){const s=Zo.fromExtension((t==null?void 0:t.nameScopesList)??null,n.nameScopesList);return new dr(t,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,s,Zo.fromExtension(s,n.contentNameScopesList))}},me(dr,"NULL",new dr(null,0,0,0,!1,null,null,null)),dr),EO=class{constructor(e,t){me(this,"balancedBracketScopes");me(this,"unbalancedBracketScopes");me(this,"allowAny",!1);this.balancedBracketScopes=e.flatMap(n=>n==="*"?(this.allowAny=!0,[]):lu(n,du).map(s=>s.matcher)),this.unbalancedBracketScopes=t.flatMap(n=>lu(n,du).map(s=>s.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(e){for(const t of this.unbalancedBracketScopes)if(t(e))return!1;for(const t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},jO=class{constructor(e,t,n,s){me(this,"_emitBinaryTokens");me(this,"_lineText");me(this,"_tokens");me(this,"_binaryTokens");me(this,"_lastTokenEndIndex");me(this,"_tokenTypeOverrides");this.balancedBracketSelectors=s,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 s;if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let a=(e==null?void 0:e.tokenAttributes)??0,o=!1;if((s=this.balancedBracketSelectors)!=null&&s.matchesAlways&&(o=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const c=(e==null?void 0:e.getScopeNames())??[];for(const l of this._tokenTypeOverrides)l.matcher(c)&&(a=Oa.set(a,0,l.type,null,-1,0,0));this.balancedBracketSelectors&&(o=this.balancedBracketSelectors.match(c))}if(o&&(a=Oa.set(a,0,8,o,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===a){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(a),this._lastTokenEndIndex=t;return}const n=(e==null?void 0:e.getScopeNames())??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:n}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);const n=new Uint32Array(this._binaryTokens.length);for(let s=0,a=this._binaryTokens.length;s<a;s++)n[s]=this._binaryTokens[s];return n}},TO=class{constructor(e,t){me(this,"_grammars",new Map);me(this,"_rawGrammars",new Map);me(this,"_injectionGrammars",new Map);me(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,s,a){if(!this._grammars.has(e)){let o=this._rawGrammars.get(e);if(!o)return null;this._grammars.set(e,wO(e,o,t,n,s,a,this,this._onigLib))}return this._grammars.get(e)}},NO=class{constructor(t){me(this,"_options");me(this,"_syncRegistry");me(this,"_ensureGrammarCache");this._options=t,this._syncRegistry=new TO(ou.createFromRawTheme(t.theme,t.colorMap),t.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(t,n){this._syncRegistry.setTheme(ou.createFromRawTheme(t,n))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(t,n,s){return this.loadGrammarWithConfiguration(t,n,{embeddedLanguages:s})}loadGrammarWithConfiguration(t,n,s){return this._loadGrammar(t,n,s.embeddedLanguages,s.tokenTypes,new EO(s.balancedBracketSelectors||[],s.unbalancedBracketSelectors||[]))}loadGrammar(t){return this._loadGrammar(t,0,null,null,null)}_loadGrammar(t,n,s,a,o){const c=new sO(this._syncRegistry,t);for(;c.Q.length>0;)c.Q.map(l=>this._loadSingleGrammar(l.scopeName)),c.processQueue();return this._grammarForScopeName(t,n,s,a,o)}_loadSingleGrammar(t){this._ensureGrammarCache.has(t)||(this._doLoadSingleGrammar(t),this._ensureGrammarCache.set(t,!0))}_doLoadSingleGrammar(t){const n=this._options.loadGrammar(t);if(n){const s=typeof this._options.getInjections=="function"?this._options.getInjections(t):void 0;this._syncRegistry.addGrammar(n,s)}}addGrammar(t,n=[],s=0,a=null){return this._syncRegistry.addGrammar(t,n),this._grammarForScopeName(t.scopeName,s,a)}_grammarForScopeName(t,n=0,s=null,a=null,o=null){return this._syncRegistry.grammarForScopeName(t,n,s,a,o)}},Dm=Am.NULL;function hu(e,t){const n=typeof e=="string"?{}:{...e.colorReplacements},s=typeof e=="string"?e:e.name;for(const[a,o]of Object.entries((t==null?void 0:t.colorReplacements)||{}))typeof o=="string"?n[a]=o:a===s&&Object.assign(n,o);return n}function Us(e,t){return e&&((t==null?void 0:t[e==null?void 0:e.toLowerCase()])||e)}function AO(e){return Array.isArray(e)?e:[e]}async function Z1(e){return Promise.resolve(typeof e=="function"?e():e).then(t=>t.default||t)}function Hu(e){return!e||["plaintext","txt","text","plain"].includes(e)}function ew(e){return e==="ansi"||Hu(e)}function $u(e){return e==="none"}function tw(e){return $u(e)}const DO=/(\r?\n)/g;function Uu(e,t=!1){var o;if(e.length===0)return[["",0]];const n=e.split(DO);let s=0;const a=[];for(let c=0;c<n.length;c+=2){const l=t?n[c]+(n[c+1]||""):n[c];a.push([l,s]),s+=n[c].length,s+=((o=n[c+1])==null?void 0:o.length)||0}return a}const Bb={light:"#333333",dark:"#bbbbbb"},zb={light:"#fffffe",dark:"#1e1e1e"},Hb="__shiki_resolved";function Mp(e){var l,h,f,p,m;if(e!=null&&e[Hb])return e;const t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||(t.type="dark"),t.colorReplacements={...t.colorReplacements},t.settings||(t.settings=[]);let{bg:n,fg:s}=t;if(!n||!s){const _=t.settings?t.settings.find(y=>!y.name&&!y.scope):void 0;(l=_==null?void 0:_.settings)!=null&&l.foreground&&(s=_.settings.foreground),(h=_==null?void 0:_.settings)!=null&&h.background&&(n=_.settings.background),!s&&((f=t==null?void 0:t.colors)!=null&&f["editor.foreground"])&&(s=t.colors["editor.foreground"]),!n&&((p=t==null?void 0:t.colors)!=null&&p["editor.background"])&&(n=t.colors["editor.background"]),s||(s=t.type==="light"?Bb.light:Bb.dark),n||(n=t.type==="light"?zb.light:zb.dark),t.fg=s,t.bg=n}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let a=0;const o=new Map;function c(_){var w;if(o.has(_))return o.get(_);a+=1;const y=`#${a.toString(16).padStart(8,"0").toLowerCase()}`;return(w=t.colorReplacements)!=null&&w[`#${y}`]?c(_):(o.set(_,y),y)}t.settings=t.settings.map(_=>{var v,b;const y=((v=_.settings)==null?void 0:v.foreground)&&!_.settings.foreground.startsWith("#"),w=((b=_.settings)==null?void 0:b.background)&&!_.settings.background.startsWith("#");if(!y&&!w)return _;const k={..._,settings:{..._.settings}};if(y){const x=c(_.settings.foreground);t.colorReplacements[x]=_.settings.foreground,k.settings.foreground=x}if(w){const x=c(_.settings.background);t.colorReplacements[x]=_.settings.background,k.settings.background=x}return k});for(const _ of Object.keys(t.colors||{}))if((_==="editor.foreground"||_==="editor.background"||_.startsWith("terminal.ansi"))&&!((m=t.colors[_])!=null&&m.startsWith("#"))){const y=c(t.colors[_]);t.colorReplacements[y]=t.colors[_],t.colors[_]=y}return Object.defineProperty(t,Hb,{enumerable:!1,writable:!1,value:!0}),t}async function nw(e){return[...new Set((await Promise.all(e.filter(t=>!ew(t)).map(async t=>await Z1(t).then(n=>Array.isArray(n)?n:[n])))).flat())]}async function rw(e){return(await Promise.all(e.map(async t=>tw(t)?null:Mp(await Z1(t))))).filter(t=>!!t)}function sw(e,t){if(!t)return e;if(t[e]){const n=new Set([e]);for(;t[e];){if(e=t[e],n.has(e))throw new Tt(`Circular alias \`${[...n].join(" -> ")} -> ${e}\``);n.add(e)}}return e}var LO=class extends NO{constructor(t,n,s,a={}){super(t);me(this,"_resolver");me(this,"_themes");me(this,"_langs");me(this,"_alias");me(this,"_resolvedThemes",new Map);me(this,"_resolvedGrammars",new Map);me(this,"_langMap",new Map);me(this,"_langGraph",new Map);me(this,"_textmateThemeCache",new WeakMap);me(this,"_loadedThemesCache",null);me(this,"_loadedLanguagesCache",null);this._resolver=t,this._themes=n,this._langs=s,this._alias=a,this._themes.map(o=>this.loadTheme(o)),this.loadLanguages(this._langs)}getTheme(t){return typeof t=="string"?this._resolvedThemes.get(t):this.loadTheme(t)}loadTheme(t){const n=Mp(t);return n.name&&(this._resolvedThemes.set(n.name,n),this._loadedThemesCache=null),n}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(t){let n=this._textmateThemeCache.get(t);n||(n=ou.createFromRawTheme(t),this._textmateThemeCache.set(t,n)),this._syncRegistry.setTheme(n)}getGrammar(t){return t=sw(t,this._alias),this._resolvedGrammars.get(t)}loadLanguage(t){var o,c,l,h;if(this.getGrammar(t.name))return;const n=new Set([...this._langMap.values()].filter(f=>{var p;return(p=f.embeddedLangsLazy)==null?void 0:p.includes(t.name)}));this._resolver.addLanguage(t);const s={balancedBracketSelectors:t.balancedBracketSelectors||["*"],unbalancedBracketSelectors:t.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(t.scopeName,t);const a=this.loadGrammarWithConfiguration(t.scopeName,1,s);if(a.name=t.name,this._resolvedGrammars.set(t.name,a),t.aliases&&t.aliases.forEach(f=>{this._alias[f]=t.name}),this._loadedLanguagesCache=null,n.size)for(const f of n)this._resolvedGrammars.delete(f.name),this._loadedLanguagesCache=null,(c=(o=this._syncRegistry)==null?void 0:o._injectionGrammars)==null||c.delete(f.scopeName),(h=(l=this._syncRegistry)==null?void 0:l._grammars)==null||h.delete(f.scopeName),this.loadLanguage(this._langMap.get(f.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(t){for(const a of t)this.resolveEmbeddedLanguages(a);const n=[...this._langGraph.entries()],s=n.filter(([a,o])=>!o);if(s.length){const a=n.filter(([o,c])=>{var l;return c?(l=c.embeddedLanguages||c.embeddedLangs)==null?void 0:l.some(h=>s.map(([f])=>f).includes(h)):!1}).filter(o=>!s.includes(o));throw new Tt(`Missing languages ${s.map(([o])=>`\`${o}\``).join(", ")}, required by ${a.map(([o])=>`\`${o}\``).join(", ")}`)}for(const[a,o]of n)this._resolver.addLanguage(o);for(const[a,o]of n)this.loadLanguage(o)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(t){this._langMap.set(t.name,t),this._langGraph.set(t.name,t);const n=t.embeddedLanguages??t.embeddedLangs;if(n)for(const s of n)this._langGraph.set(s,this._langMap.get(s))}},RO=class{constructor(e,t){me(this,"_langs",new Map);me(this,"_scopeToLang",new Map);me(this,"_injections",new Map);me(this,"_onigLib");this._onigLib={createOnigScanner:n=>e.createScanner(n),createOnigString:n=>e.createString(n)},t.forEach(n=>this.addLanguage(n))}get onigLib(){return this._onigLib}getLangRegistration(e){return this._langs.get(e)}loadGrammar(e){return this._scopeToLang.get(e)}addLanguage(e){this._langs.set(e.name,e),e.aliases&&e.aliases.forEach(t=>{this._langs.set(t,e)}),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach(t=>{this._injections.get(t)||this._injections.set(t,[]),this._injections.get(t).push(e.scopeName)})}getInjections(e){const t=e.split(".");let n=[];for(let s=1;s<=t.length;s++){const a=t.slice(0,s).join(".");n=[...n,...this._injections.get(a)||[]]}return n}};let Fo=0;function OO(e){Fo+=1,e.warnings!==!1&&Fo>=10&&Fo%10===0&&console.warn(`[Shiki] ${Fo} 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 Tt("`engine` option is required for synchronous mode");const n=(e.langs||[]).flat(1),s=(e.themes||[]).flat(1).map(Mp),a=new LO(new RO(e.engine,n),s,n,e.langAlias);let o;function c(x){return sw(x,e.langAlias)}function l(x){v();const S=a.getGrammar(typeof x=="string"?x:x.name);if(!S)throw new Tt(`Language \`${x}\` not found, you may need to load it first`);return S}function h(x){if(x==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};v();const S=a.getTheme(x);if(!S)throw new Tt(`Theme \`${x}\` not found, you may need to load it first`);return S}function f(x){v();const S=h(x);return o!==x&&(a.setTheme(S),o=x),{theme:S,colorMap:a.getColorMap()}}function p(){return v(),a.getLoadedThemes()}function m(){return v(),a.getLoadedLanguages()}function _(...x){v(),a.loadLanguages(x.flat(1))}async function y(...x){return _(await nw(x))}function w(...x){v();for(const S of x.flat(1))a.loadTheme(S)}async function k(...x){return v(),w(await rw(x))}function v(){if(t)throw new Tt("Shiki instance has been disposed")}function b(){t||(t=!0,a.dispose(),Fo-=1)}return{setTheme:f,getTheme:h,getLanguage:l,getLoadedThemes:p,getLoadedLanguages:m,resolveLangAlias:c,loadLanguage:y,loadLanguageSync:_,loadTheme:k,loadThemeSync:w,dispose:b,[Symbol.dispose]:b}}async function MO(e){e.engine||console.warn("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");const[t,n,s]=await Promise.all([rw(e.themes||[]),nw(e.langs||[]),e.engine]);return OO({...e,themes:t,langs:n,engine:s})}const iw=new WeakMap;function Fu(e,t){iw.set(e,t)}function ol(e){return iw.get(e)}var Vu=class aw{constructor(...t){me(this,"_stacks",{});me(this,"lang");if(t.length===2){const[n,s]=t;this.lang=s,this._stacks=n}else{const[n,s,a]=t;this.lang=s,this._stacks={[a]:n}}}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 aw(Object.fromEntries(AO(n).map(s=>[s,Dm])),t)}getInternalStack(t=this.theme){return this._stacks[t]}getScopes(t=this.theme){return IO(this._stacks[t])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}};function IO(e){const t=[],n=new Set;function s(a){var c;if(n.has(a))return;n.add(a);const o=(c=a==null?void 0:a.nameScopesList)==null?void 0:c.scopeName;o&&t.push(o),a.parent&&s(a.parent)}return s(e),t}function PO(e,t){if(!(e instanceof Vu))throw new Tt("Invalid grammar state");return e.getInternalStack(t)}const BO=/,/,zO=/ /;function ow(e,t,n={}){const{theme:s=e.getLoadedThemes()[0]}=n;if(Hu(e.resolveLangAlias(n.lang||"text"))||$u(s))return Uu(t).map(l=>[{content:l[0],offset:l[1]}]);const{theme:a,colorMap:o}=e.setTheme(s),c=e.getLanguage(n.lang||"text");if(n.grammarState){if(n.grammarState.lang!==c.name)throw new Tt(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${c.name}"`);if(!n.grammarState.themes.includes(a.name))throw new Tt(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${a.name}"`)}return $O(t,c,a,o,n)}function HO(...e){if(e.length===2)return ol(e[1]);const[t,n,s={}]=e,{lang:a="text",theme:o=t.getLoadedThemes()[0]}=s;if(Hu(a)||$u(o))throw new Tt("Plain language does not have grammar state");if(a==="ansi")throw new Tt("ANSI language does not have grammar state");const{theme:c,colorMap:l}=t.setTheme(o),h=t.getLanguage(a);return new Vu(Ip(n,h,c,l,s).stateStack,h.name,c.name)}function $O(e,t,n,s,a){const o=Ip(e,t,n,s,a),c=new Vu(o.stateStack,t.name,n.name);return Fu(o.tokens,c),o.tokens}function Ip(e,t,n,s,a){const o=hu(n,a),{tokenizeMaxLineLength:c=0,tokenizeTimeLimit:l=500}=a,h=Uu(e);let f=a.grammarState?PO(a.grammarState,n.name)??Dm:a.grammarContextCode!=null?Ip(a.grammarContextCode,t,n,s,{...a,grammarState:void 0,grammarContextCode:void 0}).stateStack:Dm,p=[];const m=[];for(let _=0,y=h.length;_<y;_++){const[w,k]=h[_];if(w===""){p=[],m.push([]);continue}if(c>0&&w.length>=c){p=[],m.push([{content:w,offset:k,color:"",fontStyle:0}]);continue}let v,b,x;a.includeExplanation&&(v=t.tokenizeLine(w,f,l),b=v.tokens,x=0);const S=t.tokenizeLine2(w,f,l),j=S.tokens.length/2;for(let N=0;N<j;N++){const T=S.tokens[2*N],D=N+1<j?S.tokens[2*N+2]:w.length;if(T===D)continue;const A=S.tokens[2*N+1],B=Us(s[Oa.getForeground(A)],o),R=Oa.getFontStyle(A),$={content:w.substring(T,D),offset:k+T,color:B,fontStyle:R};if(a.includeExplanation){const F=[];if(a.includeExplanation!=="scopeName")for(const Y of n.settings){let P;switch(typeof Y.scope){case"string":P=Y.scope.split(BO).map(H=>H.trim());break;case"object":P=Y.scope;break;default:continue}F.push({settings:Y,selectors:P.map(H=>H.split(zO))})}$.explanation=[];let W=0;for(;T+W<D;){const Y=b[x],P=w.substring(Y.startIndex,Y.endIndex);W+=P.length,$.explanation.push({content:P,scopes:a.includeExplanation==="scopeName"?UO(Y.scopes):FO(F,Y.scopes)}),x+=1}}p.push($)}m.push(p),p=[],f=S.ruleStack}return{tokens:m,stateStack:f}}function UO(e){return e.map(t=>({scopeName:t}))}function FO(e,t){const n=[];for(let s=0,a=t.length;s<a;s++){const o=t[s];n[s]={scopeName:o,themeMatches:GO(e,o,t.slice(0,s))}}return n}function $b(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]==="."}function VO(e,t,n){if(!$b(e.at(-1),t))return!1;let s=e.length-2,a=n.length-1;for(;s>=0&&a>=0;)$b(e[s],n[a])&&(s-=1),a-=1;return s===-1}function GO(e,t,n){const s=[];for(const{selectors:a,settings:o}of e)for(const c of a)if(VO(c,t,n)){s.push(o);break}return s}function lw(e,t,n,s=ow){const a=Object.entries(n.themes).filter(f=>f[1]).map(f=>({color:f[0],theme:f[1]})),o=a.map(f=>{const p=s(e,t,{...n,theme:f.theme});return{tokens:p,state:ol(p),theme:typeof f.theme=="string"?f.theme:f.theme.name}}),c=WO(...o.map(f=>f.tokens)),l=c[0].map((f,p)=>f.map((m,_)=>{const y={content:m.content,variants:{},offset:m.offset};return"includeExplanation"in n&&n.includeExplanation&&(y.explanation=m.explanation),c.forEach((w,k)=>{const{content:v,explanation:b,offset:x,...S}=w[p][_];y.variants[a[k].color]=S}),y})),h=o[0].state?new Vu(Object.fromEntries(o.map(f=>{var p;return[f.theme,(p=f.state)==null?void 0:p.getInternalStack(f.theme)]})),o[0].state.lang):void 0;return h&&Fu(l,h),l}function WO(...e){const t=e.map(()=>[]),n=e.length;for(let s=0;s<e[0].length;s++){const a=e.map(h=>h[s]),o=t.map(()=>[]);t.forEach((h,f)=>h.push(o[f]));const c=a.map(()=>0),l=a.map(h=>h[0]);for(;l.every(h=>h);){const h=Math.min(...l.map(f=>f.content.length));for(let f=0;f<n;f++){const p=l[f];p.content.length===h?(o[f].push(p),c[f]+=1,l[f]=a[f][c[f]]):(o[f].push({...p,content:p.content.slice(0,h)}),l[f]={...p,content:p.content.slice(h),offset:p.offset+h})}}}return t}const qO=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];class _l{constructor(t,n,s){this.normal=n,this.property=t,s&&(this.space=s)}}_l.prototype.normal={};_l.prototype.property={};_l.prototype.space=void 0;function cw(e,t){const n={},s={};for(const a of e)Object.assign(n,a.property),Object.assign(s,a.normal);return new _l(n,s,t)}function Lm(e){return e.toLowerCase()}class zn{constructor(t,n){this.attribute=n,this.property=t}}zn.prototype.attribute="";zn.prototype.booleanish=!1;zn.prototype.boolean=!1;zn.prototype.commaOrSpaceSeparated=!1;zn.prototype.commaSeparated=!1;zn.prototype.defined=!1;zn.prototype.mustUseProperty=!1;zn.prototype.number=!1;zn.prototype.overloadedBoolean=!1;zn.prototype.property="";zn.prototype.spaceSeparated=!1;zn.prototype.space=void 0;let KO=0;const nt=Ti(),en=Ti(),Rm=Ti(),Ee=Ti(),jt=Ti(),Na=Ti(),Yn=Ti();function Ti(){return 2**++KO}const Om=Object.freeze(Object.defineProperty({__proto__:null,boolean:nt,booleanish:en,commaOrSpaceSeparated:Yn,commaSeparated:Na,number:Ee,overloadedBoolean:Rm,spaceSeparated:jt},Symbol.toStringTag,{value:"Module"})),qf=Object.keys(Om);class Pp extends zn{constructor(t,n,s,a){let o=-1;if(super(t,n),Ub(this,"space",a),typeof s=="number")for(;++o<qf.length;){const c=qf[o];Ub(this,qf[o],(s&Om[c])===Om[c])}}}Pp.prototype.defined=!0;function Ub(e,t,n){n&&(e[t]=n)}function Ha(e){const t={},n={};for(const[s,a]of Object.entries(e.properties)){const o=new Pp(s,e.transform(e.attributes||{},s),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(o.mustUseProperty=!0),t[s]=o,n[Lm(s)]=s,n[Lm(o.attribute)]=s}return new _l(t,n,e.space)}const uw=Ha({properties:{ariaActiveDescendant:null,ariaAtomic:en,ariaAutoComplete:null,ariaBusy:en,ariaChecked:en,ariaColCount:Ee,ariaColIndex:Ee,ariaColSpan:Ee,ariaControls:jt,ariaCurrent:null,ariaDescribedBy:jt,ariaDetails:null,ariaDisabled:en,ariaDropEffect:jt,ariaErrorMessage:null,ariaExpanded:en,ariaFlowTo:jt,ariaGrabbed:en,ariaHasPopup:null,ariaHidden:en,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:jt,ariaLevel:Ee,ariaLive:null,ariaModal:en,ariaMultiLine:en,ariaMultiSelectable:en,ariaOrientation:null,ariaOwns:jt,ariaPlaceholder:null,ariaPosInSet:Ee,ariaPressed:en,ariaReadOnly:en,ariaRelevant:null,ariaRequired:en,ariaRoleDescription:jt,ariaRowCount:Ee,ariaRowIndex:Ee,ariaRowSpan:Ee,ariaSelected:en,ariaSetSize:Ee,ariaSort:null,ariaValueMax:Ee,ariaValueMin:Ee,ariaValueNow:Ee,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function dw(e,t){return t in e?e[t]:t}function hw(e,t){return dw(e,t.toLowerCase())}const YO=Ha({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Na,acceptCharset:jt,accessKey:jt,action:null,allow:null,allowFullScreen:nt,allowPaymentRequest:nt,allowUserMedia:nt,alt:null,as:null,async:nt,autoCapitalize:null,autoComplete:jt,autoFocus:nt,autoPlay:nt,blocking:jt,capture:null,charSet:null,checked:nt,cite:null,className:jt,cols:Ee,colSpan:null,content:null,contentEditable:en,controls:nt,controlsList:jt,coords:Ee|Na,crossOrigin:null,data:null,dateTime:null,decoding:null,default:nt,defer:nt,dir:null,dirName:null,disabled:nt,download:Rm,draggable:en,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:nt,formTarget:null,headers:jt,height:Ee,hidden:Rm,high:Ee,href:null,hrefLang:null,htmlFor:jt,httpEquiv:jt,id:null,imageSizes:null,imageSrcSet:null,inert:nt,inputMode:null,integrity:null,is:null,isMap:nt,itemId:null,itemProp:jt,itemRef:jt,itemScope:nt,itemType:jt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:nt,low:Ee,manifest:null,max:null,maxLength:Ee,media:null,method:null,min:null,minLength:Ee,multiple:nt,muted:nt,name:null,nonce:null,noModule:nt,noValidate:nt,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:nt,optimum:Ee,pattern:null,ping:jt,placeholder:null,playsInline:nt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:nt,referrerPolicy:null,rel:jt,required:nt,reversed:nt,rows:Ee,rowSpan:Ee,sandbox:jt,scope:null,scoped:nt,seamless:nt,selected:nt,shadowRootClonable:nt,shadowRootDelegatesFocus:nt,shadowRootMode:null,shape:null,size:Ee,sizes:null,slot:null,span:Ee,spellCheck:en,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Ee,step:null,style:null,tabIndex:Ee,target:null,title:null,translate:null,type:null,typeMustMatch:nt,useMap:null,value:en,width:Ee,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:jt,axis:null,background:null,bgColor:null,border:Ee,borderColor:null,bottomMargin:Ee,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:nt,declare:nt,event:null,face:null,frame:null,frameBorder:null,hSpace:Ee,leftMargin:Ee,link:null,longDesc:null,lowSrc:null,marginHeight:Ee,marginWidth:Ee,noResize:nt,noHref:nt,noShade:nt,noWrap:nt,object:null,profile:null,prompt:null,rev:null,rightMargin:Ee,rules:null,scheme:null,scrolling:en,standby:null,summary:null,text:null,topMargin:Ee,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Ee,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:nt,disableRemotePlayback:nt,prefix:null,property:null,results:Ee,security:null,unselectable:null},space:"html",transform:hw}),XO=Ha({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:Yn,accentHeight:Ee,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Ee,amplitude:Ee,arabicForm:null,ascent:Ee,attributeName:null,attributeType:null,azimuth:Ee,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Ee,by:null,calcMode:null,capHeight:Ee,className:jt,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:Ee,diffuseConstant:Ee,direction:null,display:null,dur:null,divisor:Ee,dominantBaseline:null,download:nt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Ee,enableBackground:null,end:null,event:null,exponent:Ee,externalResourcesRequired:null,fill:null,fillOpacity:Ee,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:Na,g2:Na,glyphName:Na,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Ee,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Ee,horizOriginX:Ee,horizOriginY:Ee,id:null,ideographic:Ee,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Ee,k:Ee,k1:Ee,k2:Ee,k3:Ee,k4:Ee,kernelMatrix:Yn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Ee,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:Ee,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:Ee,overlineThickness:Ee,paintOrder:null,panose1:null,path:null,pathLength:Ee,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:jt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Ee,pointsAtY:Ee,pointsAtZ:Ee,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Yn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Yn,rev:Yn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Yn,requiredFeatures:Yn,requiredFonts:Yn,requiredFormats:Yn,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:Ee,specularExponent:Ee,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Ee,strikethroughThickness:Ee,string:null,stroke:null,strokeDashArray:Yn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Ee,strokeOpacity:Ee,strokeWidth:null,style:null,surfaceScale:Ee,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Yn,tabIndex:Ee,tableValues:null,target:null,targetX:Ee,targetY:Ee,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Yn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Ee,underlineThickness:Ee,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Ee,values:null,vAlphabetic:Ee,vMathematical:Ee,vectorEffect:null,vHanging:Ee,vIdeographic:Ee,version:null,vertAdvY:Ee,vertOriginX:Ee,vertOriginY:Ee,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Ee,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:dw}),fw=Ha({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),mw=Ha({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:hw}),pw=Ha({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),QO=/[A-Z]/g,Fb=/-[a-z]/g,JO=/^data[-\w.:]+$/i;function ZO(e,t){const n=Lm(t);let s=t,a=zn;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&JO.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(Fb,t4);s="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!Fb.test(o)){let c=o.replace(QO,e4);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}a=Pp}return new a(s,t)}function e4(e){return"-"+e.toLowerCase()}function t4(e){return e.charAt(1).toUpperCase()}const n4=cw([uw,YO,fw,mw,pw],"html"),gw=cw([uw,XO,fw,mw,pw],"svg"),Vb={}.hasOwnProperty;function r4(e,t){const n=t||{};function s(a,...o){let c=s.invalid;const l=s.handlers;if(a&&Vb.call(a,e)){const h=String(a[e]);c=Vb.call(l,h)?l[h]:s.unknown}if(c)return c.call(this,a,...o)}return s.handlers=n.handlers||{},s.invalid=n.invalid,s.unknown=n.unknown,s}const s4=/["&'<>`]/g,i4=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,a4=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,o4=/[|\\{}()[\]^$+*?.]/g,Gb=new WeakMap;function l4(e,t){if(e=e.replace(t.subset?c4(t.subset):s4,s),t.subset||t.escapeOnly)return e;return e.replace(i4,n).replace(a4,s);function n(a,o,c){return t.format((a.charCodeAt(0)-55296)*1024+a.charCodeAt(1)-56320+65536,c.charCodeAt(o+2),t)}function s(a,o,c){return t.format(a.charCodeAt(0),c.charCodeAt(o+1),t)}}function c4(e){let t=Gb.get(e);return t||(t=u4(e),Gb.set(e,t)),t}function u4(e){const t=[];let n=-1;for(;++n<e.length;)t.push(e[n].replace(o4,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}const d4=/[\dA-Fa-f]/;function h4(e,t,n){const s="&#x"+e.toString(16).toUpperCase();return n&&t&&!d4.test(String.fromCharCode(t))?s:s+";"}const f4=/\d/;function m4(e,t,n){const s="&#"+String(e);return n&&t&&!f4.test(String.fromCharCode(t))?s:s+";"}const p4=["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"],Kf={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:"€"},g4=["cent","copy","divide","gt","lt","not","para","times"],xw={}.hasOwnProperty,Mm={};let Vc;for(Vc in Kf)xw.call(Kf,Vc)&&(Mm[Kf[Vc]]=Vc);const x4=/[^\dA-Za-z]/;function _4(e,t,n,s){const a=String.fromCharCode(e);if(xw.call(Mm,a)){const o=Mm[a],c="&"+o;return n&&p4.includes(o)&&!g4.includes(o)&&(!s||t&&t!==61&&x4.test(String.fromCharCode(t)))?c:c+";"}return""}function y4(e,t,n){let s=h4(e,t,n.omitOptionalSemicolons),a;if((n.useNamedReferences||n.useShortestReferences)&&(a=_4(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!a)&&n.useShortestReferences){const o=m4(e,t,n.omitOptionalSemicolons);o.length<s.length&&(s=o)}return a&&(!n.useShortestReferences||a.length<s.length)?a:s}function Aa(e,t){return l4(e,Object.assign({format:y4},t))}const v4=/^>|^->|<!--|-->|--!>|<!-$/g,b4=[">"],S4=["<",">"];function w4(e,t,n,s){return s.settings.bogusComments?"<?"+Aa(e.value,Object.assign({},s.settings.characterReferences,{subset:b4}))+">":"<!--"+e.value.replace(v4,a)+"-->";function a(o){return Aa(o,Object.assign({},s.settings.characterReferences,{subset:S4}))}}function C4(e,t,n,s){return"<!"+(s.settings.upperDoctype?"DOCTYPE":"doctype")+(s.settings.tightDoctype?"":" ")+"html>"}function Wb(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let s=0,a=n.indexOf(t);for(;a!==-1;)s++,a=n.indexOf(t,a+t.length);return s}function k4(e,t){const n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}function E4(e){return e.join(" ").trim()}const j4=/[ \t\n\f\r]/g;function Bp(e){return typeof e=="object"?e.type==="text"?qb(e.value):!1:qb(e)}function qb(e){return e.replace(j4,"")===""}const cn=yw(1),_w=yw(-1),T4=[];function yw(e){return t;function t(n,s,a){const o=n?n.children:T4;let c=(s||0)+e,l=o[c];if(!a)for(;l&&Bp(l);)c+=e,l=o[c];return l}}const N4={}.hasOwnProperty;function vw(e){return t;function t(n,s,a){return N4.call(e,n.tagName)&&e[n.tagName](n,s,a)}}const zp=vw({body:D4,caption:Yf,colgroup:Yf,dd:M4,dt:O4,head:Yf,html:A4,li:R4,optgroup:I4,option:P4,p:L4,rp:Kb,rt:Kb,tbody:z4,td:Yb,tfoot:H4,th:Yb,thead:B4,tr:$4});function Yf(e,t,n){const s=cn(n,t,!0);return!s||s.type!=="comment"&&!(s.type==="text"&&Bp(s.value.charAt(0)))}function A4(e,t,n){const s=cn(n,t);return!s||s.type!=="comment"}function D4(e,t,n){const s=cn(n,t);return!s||s.type!=="comment"}function L4(e,t,n){const s=cn(n,t);return s?s.type==="element"&&(s.tagName==="address"||s.tagName==="article"||s.tagName==="aside"||s.tagName==="blockquote"||s.tagName==="details"||s.tagName==="div"||s.tagName==="dl"||s.tagName==="fieldset"||s.tagName==="figcaption"||s.tagName==="figure"||s.tagName==="footer"||s.tagName==="form"||s.tagName==="h1"||s.tagName==="h2"||s.tagName==="h3"||s.tagName==="h4"||s.tagName==="h5"||s.tagName==="h6"||s.tagName==="header"||s.tagName==="hgroup"||s.tagName==="hr"||s.tagName==="main"||s.tagName==="menu"||s.tagName==="nav"||s.tagName==="ol"||s.tagName==="p"||s.tagName==="pre"||s.tagName==="section"||s.tagName==="table"||s.tagName==="ul"):!n||!(n.type==="element"&&(n.tagName==="a"||n.tagName==="audio"||n.tagName==="del"||n.tagName==="ins"||n.tagName==="map"||n.tagName==="noscript"||n.tagName==="video"))}function R4(e,t,n){const s=cn(n,t);return!s||s.type==="element"&&s.tagName==="li"}function O4(e,t,n){const s=cn(n,t);return!!(s&&s.type==="element"&&(s.tagName==="dt"||s.tagName==="dd"))}function M4(e,t,n){const s=cn(n,t);return!s||s.type==="element"&&(s.tagName==="dt"||s.tagName==="dd")}function Kb(e,t,n){const s=cn(n,t);return!s||s.type==="element"&&(s.tagName==="rp"||s.tagName==="rt")}function I4(e,t,n){const s=cn(n,t);return!s||s.type==="element"&&s.tagName==="optgroup"}function P4(e,t,n){const s=cn(n,t);return!s||s.type==="element"&&(s.tagName==="option"||s.tagName==="optgroup")}function B4(e,t,n){const s=cn(n,t);return!!(s&&s.type==="element"&&(s.tagName==="tbody"||s.tagName==="tfoot"))}function z4(e,t,n){const s=cn(n,t);return!s||s.type==="element"&&(s.tagName==="tbody"||s.tagName==="tfoot")}function H4(e,t,n){return!cn(n,t)}function $4(e,t,n){const s=cn(n,t);return!s||s.type==="element"&&s.tagName==="tr"}function Yb(e,t,n){const s=cn(n,t);return!s||s.type==="element"&&(s.tagName==="td"||s.tagName==="th")}const U4=vw({body:G4,colgroup:W4,head:V4,html:F4,tbody:q4});function F4(e){const t=cn(e,-1);return!t||t.type!=="comment"}function V4(e){const t=new Set;for(const s of e.children)if(s.type==="element"&&(s.tagName==="base"||s.tagName==="title")){if(t.has(s.tagName))return!1;t.add(s.tagName)}const n=e.children[0];return!n||n.type==="element"}function G4(e){const t=cn(e,-1,!0);return!t||t.type!=="comment"&&!(t.type==="text"&&Bp(t.value.charAt(0)))&&!(t.type==="element"&&(t.tagName==="meta"||t.tagName==="link"||t.tagName==="script"||t.tagName==="style"||t.tagName==="template"))}function W4(e,t,n){const s=_w(n,t),a=cn(e,-1,!0);return n&&s&&s.type==="element"&&s.tagName==="colgroup"&&zp(s,n.children.indexOf(s),n)?!1:!!(a&&a.type==="element"&&a.tagName==="col")}function q4(e,t,n){const s=_w(n,t),a=cn(e,-1);return n&&s&&s.type==="element"&&(s.tagName==="thead"||s.tagName==="tbody")&&zp(s,n.children.indexOf(s),n)?!1:!!(a&&a.type==="element"&&a.tagName==="tr")}const Gc={name:[[`
125
+ \f\r &/=>`.split(""),`
126
+ \f\r "&'/=>\``.split("")],[`\0
127
+ \f\r "&'/<=>`.split(""),`\0
128
+ \f\r "&'/<=>\``.split("")]],unquoted:[[`
129
+ \f\r &>`.split(""),`\0
130
+ \f\r "&'<=>\``.split("")],[`\0
131
+ \f\r "&'<=>\``.split(""),`\0
132
+ \f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function K4(e,t,n,s){const a=s.schema,o=a.space==="svg"?!1:s.settings.omitOptionalTags;let c=a.space==="svg"?s.settings.closeEmptyElements:s.settings.voids.includes(e.tagName.toLowerCase());const l=[];let h;a.space==="html"&&e.tagName==="svg"&&(s.schema=gw);const f=Y4(s,e.properties),p=s.all(a.space==="html"&&e.tagName==="template"?e.content:e);return s.schema=a,p&&(c=!1),(f||!o||!U4(e,t,n))&&(l.push("<",e.tagName,f?" "+f:""),c&&(a.space==="svg"||s.settings.closeSelfClosing)&&(h=f.charAt(f.length-1),(!s.settings.tightSelfClosing||h==="/"||h&&h!=='"'&&h!=="'")&&l.push(" "),l.push("/")),l.push(">")),l.push(p),!c&&(!o||!zp(e,t,n))&&l.push("</"+e.tagName+">"),l.join("")}function Y4(e,t){const n=[];let s=-1,a;if(t){for(a in t)if(t[a]!==null&&t[a]!==void 0){const o=X4(e,a,t[a]);o&&n.push(o)}}for(;++s<n.length;){const o=e.settings.tightAttributes?n[s].charAt(n[s].length-1):void 0;s!==n.length-1&&o!=='"'&&o!=="'"&&(n[s]+=" ")}return n.join("")}function X4(e,t,n){const s=ZO(e.schema,t),a=e.settings.allowParseErrors&&e.schema.space==="html"?0:1,o=e.settings.allowDangerousCharacters?0:1;let c=e.quote,l;if(s.overloadedBoolean&&(n===s.attribute||n==="")?n=!0:(s.boolean||s.overloadedBoolean)&&(typeof n!="string"||n===s.attribute||n==="")&&(n=!!n),n==null||n===!1||typeof n=="number"&&Number.isNaN(n))return"";const h=Aa(s.attribute,Object.assign({},e.settings.characterReferences,{subset:Gc.name[a][o]}));return n===!0||(n=Array.isArray(n)?(s.commaSeparated?k4:E4)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?h:(e.settings.preferUnquoted&&(l=Aa(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:Gc.unquoted[a][o]}))),l!==n&&(e.settings.quoteSmart&&Wb(n,c)>Wb(n,e.alternative)&&(c=e.alternative),l=c+Aa(n,Object.assign({},e.settings.characterReferences,{subset:(c==="'"?Gc.single:Gc.double)[a][o],attribute:!0}))+c),h+(l&&"="+l))}const Q4=["<","&"];function bw(e,t,n,s){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?e.value:Aa(e.value,Object.assign({},s.settings.characterReferences,{subset:Q4}))}function J4(e,t,n,s){return s.settings.allowDangerousHtml?e.value:bw(e,t,n,s)}function Z4(e,t,n,s){return s.all(e)}const eM=r4("type",{invalid:tM,unknown:nM,handlers:{comment:w4,doctype:C4,element:K4,raw:J4,root:Z4,text:bw}});function tM(e){throw new Error("Expected node, not `"+e+"`")}function nM(e){const t=e;throw new Error("Cannot compile unknown node `"+t.type+"`")}const rM={},sM={},iM=[];function aM(e,t){const n=t||rM,s=n.quote||'"',a=s==='"'?"'":'"';if(s!=='"'&&s!=="'")throw new Error("Invalid quote `"+s+"`, expected `'` or `\"`");return{one:oM,all:lM,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||qO,characterReferences:n.characterReferences||sM,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?gw:n4,quote:s,alternative:a}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)}function oM(e,t,n){return eM(e,t,n,this)}function lM(e){const t=[],n=e&&e.children||iM;let s=-1;for(;++s<n.length;)t[s]=this.one(n[s],s,e);return t.join("")}const Xb=/\s+/g;function Sw(e,t){var s;if(!t)return e;e.properties||(e.properties={}),(s=e.properties).class||(s.class=[]),typeof e.properties.class=="string"&&(e.properties.class=e.properties.class.split(Xb)),Array.isArray(e.properties.class)||(e.properties.class=[]);const n=Array.isArray(t)?t:t.split(Xb);for(const a of n)a&&!e.properties.class.includes(a)&&e.properties.class.push(a);return e}const cM=/:?lang=["']([^"']+)["']/g,uM=/(?:```|~~~)([\w-]+)/g,dM=/\\begin\{([\w-]+)\}/g,hM=/<script\s+(?:type|lang)=["']([^"']+)["']/gi;function fM(e){const t=Uu(e,!0).map(([a])=>a);function n(a){if(a===e.length)return{line:t.length-1,character:t.at(-1).length};let o=a,c=0;for(const l of t){if(o<l.length)break;o-=l.length,c++}return{line:c,character:o}}function s(a,o){let c=0;for(let l=0;l<a;l++)c+=t[l].length;return c+=o,c}return{lines:t,indexToPos:n,posToIndex:s}}function mM(e,t,n){const s=new Set;for(const o of e.matchAll(cM)){const c=o[1].toLowerCase().trim();c&&s.add(c)}for(const o of e.matchAll(uM)){const c=o[1].toLowerCase().trim();c&&s.add(c)}for(const o of e.matchAll(dM)){const c=o[1].toLowerCase().trim();c&&s.add(c)}for(const o of e.matchAll(hM)){const c=o[1].toLowerCase().trim(),l=c.includes("/")?c.split("/").pop():c;l&&s.add(l)}if(!n)return[...s];const a=n.getBundledLanguages();return[...s].filter(o=>o&&a[o])}const pM=["color","background-color"];function gM(e,t){let n=0;const s=[];for(const a of t)a>n&&s.push({...e,content:e.content.slice(n,a),offset:e.offset+n}),n=a;return n<e.content.length&&s.push({...e,content:e.content.slice(n),offset:e.offset+n}),s}function xM(e,t){const n=[...t instanceof Set?t:new Set(t)].sort((s,a)=>s-a);return n.length?e.map(s=>s.flatMap(a=>{const o=n.filter(c=>a.offset<c&&c<a.offset+a.content.length).map(c=>c-a.offset).sort((c,l)=>c-l);return o.length?gM(a,o):a})):e}function _M(e,t,n,s,a="css-vars"){const o={content:e.content,explanation:e.explanation,offset:e.offset},c=t.map(p=>fu(e.variants[p])),l=new Set(c.flatMap(p=>Object.keys(p))),h={},f=(p,m)=>{const _=m==="color"?"":m==="background-color"?"-bg":`-${m}`;return n+t[p]+(m==="color"?"":_)};return c.forEach((p,m)=>{for(const _ of l){const y=p[_]||"inherit";if(m===0&&s&&pM.includes(_))if(s==="light-dark()"&&c.length>1){const w=t.findIndex(v=>v==="light"),k=t.findIndex(v=>v==="dark");if(w===-1||k===-1)throw new Tt('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');h[_]=`light-dark(${c[w][_]||"inherit"}, ${c[k][_]||"inherit"})`,a==="css-vars"&&(h[f(m,_)]=y)}else h[_]=y;else a==="css-vars"&&(h[f(m,_)]=y)}}),o.htmlStyle=h,o}function fu(e){const t={};if(e.color&&(t.color=e.color),e.bgColor&&(t["background-color"]=e.bgColor),e.fontStyle){e.fontStyle&Cn.Italic&&(t["font-style"]="italic"),e.fontStyle&Cn.Bold&&(t["font-weight"]="bold");const n=[];e.fontStyle&Cn.Underline&&n.push("underline"),e.fontStyle&Cn.Strikethrough&&n.push("line-through"),n.length&&(t["text-decoration"]=n.join(" "))}return t}function Im(e){return typeof e=="string"?e:Object.entries(e).map(([t,n])=>`${t}:${n}`).join(";")}function yM(){const e=new WeakMap;function t(n){if(!e.has(n.meta)){let o=function(l){if(typeof l=="number"){if(l<0||l>n.source.length)throw new Tt(`Invalid decoration offset: ${l}. Code length: ${n.source.length}`);return{...a.indexToPos(l),offset:l}}else{const h=a.lines[l.line];if(h===void 0)throw new Tt(`Invalid decoration position ${JSON.stringify(l)}. Lines length: ${a.lines.length}`);let f=l.character;if(f<0&&(f=h.length+f),f<0||f>h.length)throw new Tt(`Invalid decoration position ${JSON.stringify(l)}. Line ${l.line} length: ${h.length}`);return{...l,character:f,offset:a.posToIndex(l.line,f)}}};var s=o;const a=fM(n.source),c=(n.options.decorations||[]).map(l=>({...l,start:o(l.start),end:o(l.end)}));vM(c),e.set(n.meta,{decorations:c,converter:a,source:n.source})}return e.get(n.meta)}return{name:"shiki:decorations",tokens(n){var s;if((s=this.options.decorations)!=null&&s.length)return xM(n,t(this).decorations.flatMap(a=>[a.start.offset,a.end.offset]))},code(n){var p;if(!((p=this.options.decorations)!=null&&p.length))return;const s=t(this),a=[...n.children].filter(m=>m.type==="element"&&m.tagName==="span");if(a.length!==s.converter.lines.length)throw new Tt(`Number of lines in code element (${a.length}) does not match the number of lines in the source (${s.converter.lines.length}). Failed to apply decorations.`);function o(m,_,y,w){const k=a[m];let v="",b=-1,x=-1;if(_===0&&(b=0),y===0&&(x=0),y===Number.POSITIVE_INFINITY&&(x=k.children.length),b===-1||x===-1)for(let j=0;j<k.children.length;j++)v+=ww(k.children[j]),b===-1&&v.length===_&&(b=j+1),x===-1&&v.length===y&&(x=j+1);if(b===-1)throw new Tt(`Failed to find start index for decoration ${JSON.stringify(w.start)}`);if(x===-1)throw new Tt(`Failed to find end index for decoration ${JSON.stringify(w.end)}`);const S=k.children.slice(b,x);if(!w.alwaysWrap&&S.length===k.children.length)l(k,w,"line");else if(!w.alwaysWrap&&S.length===1&&S[0].type==="element")l(S[0],w,"token");else{const j={type:"element",tagName:"span",properties:{},children:S};l(j,w,"wrapper"),k.children.splice(b,S.length,j)}}function c(m,_){a[m]=l(a[m],_,"line")}function l(m,_,y){var v;const w=_.properties||{},k=_.transform||(b=>b);return m.tagName=_.tagName||"span",m.properties={...m.properties,...w,class:m.properties.class},(v=_.properties)!=null&&v.class&&Sw(m,_.properties.class),m=k(m,y)||m,m}const h=[],f=s.decorations.sort((m,_)=>_.start.offset-m.start.offset||m.end.offset-_.end.offset);for(const m of f){const{start:_,end:y}=m;if(_.line===y.line)o(_.line,_.character,y.character,m);else if(_.line<y.line){o(_.line,_.character,Number.POSITIVE_INFINITY,m);for(let w=_.line+1;w<y.line;w++)h.unshift(()=>c(w,m));o(y.line,0,y.character,m)}}h.forEach(m=>m())}}}function vM(e){for(let t=0;t<e.length;t++){const n=e[t];if(n.start.offset>n.end.offset)throw new Tt(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let s=t+1;s<e.length;s++){const a=e[s],o=n.start.offset<=a.start.offset&&a.start.offset<n.end.offset,c=n.start.offset<a.end.offset&&a.end.offset<=n.end.offset,l=a.start.offset<=n.start.offset&&n.start.offset<a.end.offset,h=a.start.offset<n.end.offset&&n.end.offset<=a.end.offset;if(o||c||l||h){if(o&&c||l&&h||l&&n.start.offset===n.end.offset||c&&a.start.offset===a.end.offset)continue;throw new Tt(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(a.start)} intersect.`)}}}}function ww(e){return e.type==="text"?e.value:e.type==="element"?e.children.map(ww).join(""):""}const bM=[yM()];function mu(e){const t=SM(e.transformers||[]);return[...t.pre,...t.normal,...t.post,...bM]}function SM(e){const t=[],n=[],s=[];for(const a of e)switch(a.enforce){case"pre":t.push(a);break;case"post":n.push(a);break;default:s.push(a)}return{pre:t,post:n,normal:s}}var _i=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],Xf={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",8:"hidden",9:"strikethrough"};function wM(e,t){const n=e.indexOf("\x1B",t);if(n!==-1&&e[n+1]==="["){const s=e.indexOf("m",n);if(s!==-1)return{sequence:e.substring(n+2,s).split(";"),startPosition:n,position:s+1}}return{position:e.length}}function Qb(e){const t=e.shift();if(t==="2"){const n=e.splice(0,3).map(s=>Number.parseInt(s));return n.length!==3||n.some(s=>Number.isNaN(s))?void 0:{type:"rgb",rgb:n}}else if(t==="5"){const n=e.shift();if(n)return{type:"table",index:Number(n)}}}function CM(e){const t=[];for(;e.length>0;){const n=e.shift();if(!n)continue;const s=Number.parseInt(n);if(!Number.isNaN(s))if(s===0)t.push({type:"resetAll"});else if(s<=9)Xf[s]&&t.push({type:"setDecoration",value:Xf[s]});else if(s<=29){const a=Xf[s-20];a&&(t.push({type:"resetDecoration",value:a}),a==="dim"&&t.push({type:"resetDecoration",value:"bold"}))}else if(s<=37)t.push({type:"setForegroundColor",value:{type:"named",name:_i[s-30]}});else if(s===38){const a=Qb(e);a&&t.push({type:"setForegroundColor",value:a})}else if(s===39)t.push({type:"resetForegroundColor"});else if(s<=47)t.push({type:"setBackgroundColor",value:{type:"named",name:_i[s-40]}});else if(s===48){const a=Qb(e);a&&t.push({type:"setBackgroundColor",value:a})}else s===49?t.push({type:"resetBackgroundColor"}):s===53?t.push({type:"setDecoration",value:"overline"}):s===55?t.push({type:"resetDecoration",value:"overline"}):s>=90&&s<=97?t.push({type:"setForegroundColor",value:{type:"named",name:_i[s-90+8]}}):s>=100&&s<=107&&t.push({type:"setBackgroundColor",value:{type:"named",name:_i[s-100+8]}})}return t}function kM(){let e=null,t=null,n=new Set;return{parse(s){const a=[];let o=0;do{const c=wM(s,o),l=c.sequence?s.substring(o,c.startPosition):s.substring(o);if(l.length>0&&a.push({value:l,foreground:e,background:t,decorations:new Set(n)}),c.sequence){const h=CM(c.sequence);for(const f of h)f.type==="resetAll"?(e=null,t=null,n.clear()):f.type==="resetForegroundColor"?e=null:f.type==="resetBackgroundColor"?t=null:f.type==="resetDecoration"&&n.delete(f.value);for(const f of h)f.type==="setForegroundColor"?e=f.value:f.type==="setBackgroundColor"?t=f.value:f.type==="setDecoration"&&n.add(f.value)}o=c.position}while(o<s.length);return a}}}var EM={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 jM(e=EM){function t(l){return e[l]}function n(l){return`#${l.map(h=>Math.max(0,Math.min(h,255)).toString(16).padStart(2,"0")).join("")}`}let s;function a(){if(s)return s;s=[];for(let f=0;f<_i.length;f++)s.push(t(_i[f]));let l=[0,95,135,175,215,255];for(let f=0;f<6;f++)for(let p=0;p<6;p++)for(let m=0;m<6;m++)s.push(n([l[f],l[p],l[m]]));let h=8;for(let f=0;f<24;f++,h+=10)s.push(n([h,h,h]));return s}function o(l){return a()[l]}function c(l){switch(l.type){case"named":return t(l.name);case"rgb":return n(l.rgb);case"table":return o(l.index)}}return{value:c}}const TM=/#([0-9a-f]{3,8})/i,NM=/var\((--[\w-]+-ansi-[\w-]+)\)/,AM={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 DM(e,t,n){const s=hu(e,n),a=Uu(t),o=jM(Object.fromEntries(_i.map(l=>{var f;const h=`terminal.ansi${l[0].toUpperCase()}${l.substring(1)}`;return[l,((f=e.colors)==null?void 0:f[h])||AM[l]]}))),c=kM();return a.map(l=>c.parse(l[0]).map(h=>{let f,p;h.decorations.has("reverse")?(f=h.background?o.value(h.background):e.bg,p=h.foreground?o.value(h.foreground):e.fg):(f=h.foreground?o.value(h.foreground):e.fg,p=h.background?o.value(h.background):void 0),f=Us(f,s),p=Us(p,s),h.decorations.has("dim")&&(f=LM(f));let m=Cn.None;return h.decorations.has("bold")&&(m|=Cn.Bold),h.decorations.has("italic")&&(m|=Cn.Italic),h.decorations.has("underline")&&(m|=Cn.Underline),h.decorations.has("strikethrough")&&(m|=Cn.Strikethrough),{content:h.value,offset:l[1],color:f,bgColor:p,fontStyle:m}}))}function LM(e){const t=e.match(TM);if(t){const s=t[1];if(s.length===8){const a=Math.round(Number.parseInt(s.slice(6,8),16)/2).toString(16).padStart(2,"0");return`#${s.slice(0,6)}${a}`}else{if(s.length===6)return`#${s}80`;if(s.length===4){const a=s[0],o=s[1],c=s[2],l=s[3];return`#${a}${a}${o}${o}${c}${c}${Math.round(Number.parseInt(`${l}${l}`,16)/2).toString(16).padStart(2,"0")}`}else if(s.length===3){const a=s[0],o=s[1],c=s[2];return`#${a}${a}${o}${o}${c}${c}80`}}}const n=e.match(NM);return n?`var(${n[1]}-dim)`:e}function Pm(e,t,n={}){const s=e.resolveLangAlias(n.lang||"text"),{theme:a=e.getLoadedThemes()[0]}=n;if(!Hu(s)&&!$u(a)&&s==="ansi"){const{theme:o}=e.setTheme(a);return DM(o,t,n)}return ow(e,t,n)}function pu(e,t,n){let s,a,o,c,l,h;if("themes"in n){const{defaultColor:f="light",cssVariablePrefix:p="--shiki-",colorsRendering:m="css-vars"}=n,_=Object.entries(n.themes).filter(b=>b[1]).map(b=>({color:b[0],theme:b[1]})).sort((b,x)=>b.color===f?-1:x.color===f?1:0);if(_.length===0)throw new Tt("`themes` option must not be empty");const y=lw(e,t,n,Pm);if(h=ol(y),f&&f!=="light-dark()"&&!_.some(b=>b.color===f))throw new Tt(`\`themes\` option must contain the defaultColor key \`${f}\``);const w=_.map(b=>e.getTheme(b.theme)),k=_.map(b=>b.color);o=y.map(b=>b.map(x=>_M(x,k,p,f,m))),h&&Fu(o,h);const v=_.map(b=>hu(b.theme,n));a=Jb(_,w,v,p,f,"fg",m),s=Jb(_,w,v,p,f,"bg",m),c=`shiki-themes ${w.map(b=>b.name).join(" ")}`,l=f?void 0:[a,s].join(";")}else if("theme"in n){const f=hu(n.theme,n);o=Pm(e,t,n);const p=e.getTheme(n.theme);s=Us(p.bg,f),a=Us(p.fg,f),c=p.name,h=ol(o)}else throw new Tt("Invalid options, either `theme` or `themes` must be provided");return{tokens:o,fg:a,bg:s,themeName:c,rootStyle:l,grammarState:h}}function Jb(e,t,n,s,a,o,c){return e.map((l,h)=>{const f=Us(t[h][o],n[h])||"inherit",p=`${s+l.color}${o==="bg"?"-bg":""}:${f}`;if(h===0&&a){if(a==="light-dark()"&&e.length>1){const m=e.findIndex(y=>y.color==="light"),_=e.findIndex(y=>y.color==="dark");if(m===-1||_===-1)throw new Tt('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');return`light-dark(${Us(t[m][o],n[m])||"inherit"}, ${Us(t[_][o],n[_])||"inherit"});${p}`}return f}return c==="css-vars"?p:null}).filter(l=>!!l).join(";")}const Cw=/^\s+$/,RM=/^(\s*)(.*?)(\s*)$/;function gu(e,t,n,s={meta:{},options:n,codeToHast:(a,o)=>gu(e,a,o),codeToTokens:(a,o)=>pu(e,a,o)}){var w,k;let a=t;for(const v of mu(n))a=((w=v.preprocess)==null?void 0:w.call(s,a,n))||a;let{tokens:o,fg:c,bg:l,themeName:h,rootStyle:f,grammarState:p}=pu(e,a,n);const{mergeWhitespaces:m=!0,mergeSameStyleTokens:_=!1}=n;m===!0?o=MM(o):m==="never"&&(o=IM(o)),_&&(o=PM(o));const y={...s,get source(){return a}};for(const v of mu(n))o=((k=v.tokens)==null?void 0:k.call(y,o))||o;return OM(o,{...n,fg:c,bg:l,themeName:h,rootStyle:n.rootStyle===!1?!1:n.rootStyle??f},y,p)}function OM(e,t,n,s=ol(e)){var k,v,b,x;const a=mu(t),o=[],c={type:"root",children:[]},{structure:l="classic",tabindex:h="0"}=t,f={class:`shiki ${t.themeName||""}`};t.rootStyle!==!1&&(t.rootStyle!=null?f.style=t.rootStyle:f.style=`background-color:${t.bg};color:${t.fg}`),h!==!1&&h!=null&&(f.tabindex=h.toString());for(const[S,j]of Object.entries(t.meta||{}))S.startsWith("_")||(f[S]=j);let p={type:"element",tagName:"pre",properties:f,children:[],data:t.data},m={type:"element",tagName:"code",properties:{},children:o};const _=[],y={...n,structure:l,addClassToHast:Sw,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 _}};if(e.forEach((S,j)=>{var D,A;j&&(l==="inline"?c.children.push({type:"element",tagName:"br",properties:{},children:[]}):l==="classic"&&o.push({type:"text",value:`
133
+ `}));let N={type:"element",tagName:"span",properties:{class:"line"},children:[]},T=0;for(const B of S){let R={type:"element",tagName:"span",properties:{...B.htmlAttrs},children:[{type:"text",value:B.content}]};const $=Im(B.htmlStyle||fu(B));$&&(R.properties.style=$);for(const F of a)R=((D=F==null?void 0:F.span)==null?void 0:D.call(y,R,j+1,T,N,B))||R;l==="inline"?c.children.push(R):l==="classic"&&N.children.push(R),T+=B.content.length}if(l==="classic"){for(const B of a)N=((A=B==null?void 0:B.line)==null?void 0:A.call(y,N,j+1))||N;_.push(N),o.push(N)}else l==="inline"&&_.push(N)}),l==="classic"){for(const S of a)m=((k=S==null?void 0:S.code)==null?void 0:k.call(y,m))||m;p.children.push(m);for(const S of a)p=((v=S==null?void 0:S.pre)==null?void 0:v.call(y,p))||p;c.children.push(p)}else if(l==="inline"){const S=[];let j={type:"element",tagName:"span",properties:{class:"line"},children:[]};for(const T of c.children)T.type==="element"&&T.tagName==="br"?(S.push(j),j={type:"element",tagName:"span",properties:{class:"line"},children:[]}):(T.type==="element"||T.type==="text")&&j.children.push(T);S.push(j);let N={type:"element",tagName:"code",properties:{},children:S};for(const T of a)N=((b=T==null?void 0:T.code)==null?void 0:b.call(y,N))||N;c.children=[];for(let T=0;T<N.children.length;T++){T>0&&c.children.push({type:"element",tagName:"br",properties:{},children:[]});const D=N.children[T];D.type==="element"&&c.children.push(...D.children)}}let w=c;for(const S of a)w=((x=S==null?void 0:S.root)==null?void 0:x.call(y,w))||w;return s&&Fu(w,s),w}function MM(e){return e.map(t=>{const n=[];let s="",a;return t.forEach((o,c)=>{const l=!(o.fontStyle&&(o.fontStyle&Cn.Underline||o.fontStyle&Cn.Strikethrough));l&&Cw.test(o.content)&&t[c+1]?(a===void 0&&(a=o.offset),s+=o.content):s?(l?n.push({...o,offset:a,content:s+o.content}):n.push({content:s,offset:a},o),a=void 0,s=""):n.push(o)}),n})}function IM(e){return e.map(t=>t.flatMap(n=>{if(Cw.test(n.content))return n;const s=n.content.match(RM);if(!s)return n;const[,a,o,c]=s;if(!a&&!c)return n;const l=[{...n,offset:n.offset+a.length,content:o}];return a&&l.unshift({content:a,offset:n.offset}),c&&l.push({content:c,offset:n.offset+a.length+o.length}),l}))}function PM(e){return e.map(t=>{const n=[];for(const s of t){if(n.length===0){n.push({...s});continue}const a=n.at(-1),o=Im(a.htmlStyle||fu(a)),c=Im(s.htmlStyle||fu(s)),l=a.fontStyle&&(a.fontStyle&Cn.Underline||a.fontStyle&Cn.Strikethrough),h=s.fontStyle&&(s.fontStyle&Cn.Underline||s.fontStyle&Cn.Strikethrough);!l&&!h&&o===c?a.content+=s.content:n.push({...s})}return n})}const BM=aM;function zM(e,t,n){var o;const s={meta:{},options:n,codeToHast:(c,l)=>gu(e,c,l),codeToTokens:(c,l)=>pu(e,c,l)};let a=BM(gu(e,t,n,s));for(const c of mu(n))a=((o=c.postprocess)==null?void 0:o.call(s,a,n))||a;return a}async function HM(e){const t=await MO(e);return{getLastGrammarState:(...n)=>HO(t,...n),codeToTokensBase:(n,s)=>Pm(t,n,s),codeToTokensWithThemes:(n,s)=>lw(t,n,s),codeToTokens:(n,s)=>pu(t,n,s),codeToHast:(n,s)=>gu(t,n,s),codeToHtml:(n,s)=>zM(t,n,s),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}function $M(e){const t=e.langs,n=e.themes,s=e.engine;async function a(o){function c(m){var _;if(typeof m=="string"){if(m=((_=o.langAlias)==null?void 0:_[m])||m,ew(m))return[];const y=t[m];if(!y)throw new Tt(`Language \`${m}\` is not included in this bundle. You may want to load it from external source.`);return y}return m}function l(m){if(tw(m))return"none";if(typeof m=="string"){const _=n[m];if(!_)throw new Tt(`Theme \`${m}\` is not included in this bundle. You may want to load it from external source.`);return _}return m}const h=(o.themes??[]).map(m=>l(m)),f=(o.langs??[]).map(m=>c(m)),p=await HM({engine:o.engine??s(),...o,themes:h,langs:f});return{...p,loadLanguage(...m){return p.loadLanguage(...m.map(c))},loadTheme(...m){return p.loadTheme(...m.map(l))},getBundledLanguages(){return t},getBundledThemes(){return n}}}return a}function UM(e){let t;async function n(s={}){if(t){const a=await t;return await Promise.all([a.loadTheme(...s.themes||[]),a.loadLanguage(...s.langs||[])]),a}else{t=e({...s,themes:[],langs:[]});const a=await t;return await Promise.all([a.loadTheme(...s.themes||[]),a.loadLanguage(...s.langs||[])]),a}}return n}function FM(e,t){const n=UM(e);async function s(a,o){var h;const c=await n({langs:[o.lang],themes:"theme"in o?[o.theme]:Object.values(o.themes)}),l=await((h=t==null?void 0:t.guessEmbeddedLanguages)==null?void 0:h.call(t,a,o.lang,c));return l&&await c.loadLanguage(...l),c}return{getSingletonHighlighter(a){return n(a)},async codeToHtml(a,o){return(await s(a,o)).codeToHtml(a,o)},async codeToHast(a,o){return(await s(a,o)).codeToHast(a,o)},async codeToTokens(a,o){return(await s(a,o)).codeToTokens(a,o)},async codeToTokensBase(a,o){return(await s(a,o)).codeToTokensBase(a,o)},async codeToTokensWithThemes(a,o){return(await s(a,o)).codeToTokensWithThemes(a,o)},async getLastGrammarState(a,o){return(await n({langs:[o.lang],themes:[o.theme]})).getLastGrammarState(a,o)}}}var VM=Ep({bundledLanguages:()=>Np,bundledLanguagesAlias:()=>Tp,bundledLanguagesBase:()=>jp,bundledLanguagesInfo:()=>Pu,bundledThemes:()=>Dp,bundledThemesInfo:()=>Ap,codeToHast:()=>Ew,codeToHtml:()=>kw,codeToTokens:()=>jw,codeToTokensBase:()=>Tw,codeToTokensWithThemes:()=>Nw,createHighlighter:()=>Gu,getLastGrammarState:()=>Dw,getSingletonHighlighter:()=>Aw});const Gu=$M({langs:Np,themes:Dp,engine:()=>(0,P1.createOnigurumaEngine)(Q(()=>import("./wasm-CG6Dc4jp.js"),[]))}),{codeToHtml:kw,codeToHast:Ew,codeToTokens:jw,codeToTokensBase:Tw,codeToTokensWithThemes:Nw,getSingletonHighlighter:Aw,getLastGrammarState:Dw}=FM(Gu,{guessEmbeddedLanguages:mM}),Zb=4294967295;var GM=class{constructor(e,t={}){me(this,"patterns");me(this,"options");me(this,"regexps");this.patterns=e,this.options=t;const{forgiving:n=!1,cache:s,regexConstructor:a}=t;if(!a)throw new Error("Option `regexConstructor` is not provided");this.regexps=e.map(o=>{if(typeof o!="string")return o;const c=s==null?void 0:s.get(o);if(c){if(c instanceof RegExp)return c;if(n)return null;throw c}try{const l=a(o);return s==null||s.set(o,l),l}catch(l){if(s==null||s.set(o,l),n)return null;throw l}})}findNextMatchSync(e,t,n){const s=typeof e=="string"?e:e.content,a=[];function o(c,l,h=0){return{index:c,captureIndices:l.indices.map(f=>f==null?{start:Zb,end:Zb,length:0}:{start:f[0]+h,end:f[1]+h,length:f[1]-f[0]})}}for(let c=0;c<this.regexps.length;c++){const l=this.regexps[c];if(l)try{l.lastIndex=t;const h=l.exec(s);if(!h)continue;if(h.index===t)return o(c,h,0);a.push([c,h,0])}catch(h){if(this.options.forgiving)continue;throw h}}if(a.length){const c=Math.min(...a.map(l=>l[1].index));for(const[l,h,f]of a)if(h.index===c)return o(l,h,f)}return null}};function $a(e){if([...e].length!==1)throw new Error(`Expected "${e}" to be a single code point`);return e.codePointAt(0)}function WM(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}const Hp=new Set(["alnum","alpha","ascii","blank","cntrl","digit","graph","lower","print","punct","space","upper","word","xdigit"]),fn=String.raw;function Ua(e,t){if(e==null)throw new Error(t??"Value expected");return e}const Lw=fn`\[\^?`,Rw=`c.? | C(?:-.?)?|${fn`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${fn`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${fn`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${fn`o\{[^\}]*\}?`}|${fn`\d{1,3}`}`,$p=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,Wc=new RegExp(fn`
134
+ \\ (?:
135
+ ${Rw}
136
+ | [gk]<[^>]*>?
137
+ | [gk]'[^']*'?
138
+ | .
139
+ )
140
+ | \( (?:
141
+ \? (?:
142
+ [:=!>({]
143
+ | <[=!]
144
+ | <[^>]*>
145
+ | '[^']*'
146
+ | ~\|?
147
+ | #(?:[^)\\]|\\.?)*
148
+ | [^:)]*[:)]
149
+ )?
150
+ | \*[^\)]*\)?
151
+ )?
152
+ | (?:${$p.source})+
153
+ | ${Lw}
154
+ | .
155
+ `.replace(/\s+/g,""),"gsu"),Qf=new RegExp(fn`
156
+ \\ (?:
157
+ ${Rw}
158
+ | .
159
+ )
160
+ | \[:(?:\^?\p{Alpha}+|\^):\]
161
+ | ${Lw}
162
+ | &&
163
+ | .
164
+ `.replace(/\s+/g,""),"gsu");function qM(e,t={}){const n={flags:"",...t,rules:{captureGroup:!1,singleline:!1,...t.rules}};if(typeof e!="string")throw new Error("String expected as pattern");const s=hI(n.flags),a=[s.extended],o={captureGroup:n.rules.captureGroup,getCurrentModX(){return a.at(-1)},numOpenGroups:0,popModX(){a.pop()},pushModX(m){a.push(m)},replaceCurrentModX(m){a[a.length-1]=m},singleline:n.rules.singleline};let c=[],l;for(Wc.lastIndex=0;l=Wc.exec(e);){const m=KM(o,e,l[0],Wc.lastIndex);m.tokens?c.push(...m.tokens):m.token&&c.push(m.token),m.lastIndex!==void 0&&(Wc.lastIndex=m.lastIndex)}const h=[];let f=0;c.filter(m=>m.type==="GroupOpen").forEach(m=>{m.kind==="capturing"?m.number=++f:m.raw==="("&&h.push(m)}),f||h.forEach((m,_)=>{m.kind="capturing",m.number=_+1});const p=f||h.length;return{tokens:c.map(m=>m.type==="EscapedNumber"?mI(m,p):m).flat(),flags:s}}function KM(e,t,n,s){const[a,o]=n;if(n==="["||n==="[^"){const c=YM(t,n,s);return{tokens:c.tokens,lastIndex:c.lastIndex}}if(a==="\\"){if("AbBGyYzZ".includes(o))return{token:e0(n,n)};if(/^\\g[<']/.test(n)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(n))throw new Error(`Invalid group name "${n}"`);return{token:iI(n)}}if(/^\\k[<']/.test(n)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(n))throw new Error(`Invalid group name "${n}"`);return{token:Mw(n)}}if(o==="K")return{token:Iw("keep",n)};if(o==="N"||o==="R")return{token:yi("newline",n,{negate:o==="N"})};if(o==="O")return{token:yi("any",n)};if(o==="X")return{token:yi("text_segment",n)};const c=Ow(n,{inCharClass:!1});return Array.isArray(c)?{tokens:c}:{token:c}}if(a==="("){if(o==="*")return{token:cI(n)};if(n==="(?{")throw new Error(`Unsupported callout "${n}"`);if(n.startsWith("(?#")){if(t[s]!==")")throw new Error('Unclosed comment group "(?#"');return{lastIndex:s+1}}if(/^\(\?[-imx]+[:)]$/.test(n))return{token:lI(n,e)};if(e.pushModX(e.getCurrentModX()),e.numOpenGroups++,n==="("&&!e.captureGroup||n==="(?:")return{token:ka("group",n)};if(n==="(?>")return{token:ka("atomic",n)};if(n==="(?="||n==="(?!"||n==="(?<="||n==="(?<!")return{token:ka(n[2]==="<"?"lookbehind":"lookahead",n,{negate:n.endsWith("!")})};if(n==="("&&e.captureGroup||n.startsWith("(?<")&&n.endsWith(">")||n.startsWith("(?'")&&n.endsWith("'"))return{token:ka("capturing",n,{...n!=="("&&{name:n.slice(3,-1)}})};if(n.startsWith("(?~")){if(n==="(?~|")throw new Error(`Unsupported absence function kind "${n}"`);return{token:ka("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:nI(n)}}if(e.getCurrentModX()){if(n==="#"){const c=t.indexOf(`
165
+ `,s);return{lastIndex:c===-1?t.length:c}}if(/^\s$/.test(n)){const c=/\s+/y;return c.lastIndex=s,{lastIndex:c.exec(t)?c.lastIndex:s}}}if(n===".")return{token:yi("dot",n)};if(n==="^"||n==="$"){const c=e.singleline?{"^":fn`\A`,$:fn`\Z`}[n]:n;return{token:e0(c,n)}}return n==="|"?{token:QM(n)}:$p.test(n)?{tokens:pI(n)}:{token:ls($a(n),n)}}function YM(e,t,n){const s=[t0(t[1]==="^",t)];let a=1,o;for(Qf.lastIndex=n;o=Qf.exec(e);){const c=o[0];if(c[0]==="["&&c[1]!==":")a++,s.push(t0(c[1]==="^",c));else if(c==="]"){if(s.at(-1).type==="CharacterClassOpen")s.push(ls(93,c));else if(a--,s.push(JM(c)),!a)break}else{const l=XM(c);Array.isArray(l)?s.push(...l):s.push(l)}}return{tokens:s,lastIndex:Qf.lastIndex||e.length}}function XM(e){if(e[0]==="\\")return Ow(e,{inCharClass:!0});if(e[0]==="["){const t=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(e);if(!t||!Hp.has(t.groups.name))throw new Error(`Invalid POSIX class "${e}"`);return yi("posix",e,{value:t.groups.name,negate:!!t.groups.negate})}return e==="-"?ZM(e):e==="&&"?eI(e):ls($a(e),e)}function Ow(e,{inCharClass:t}){const n=e[1];if(n==="c"||n==="C")return oI(e);if("dDhHsSwW".includes(n))return uI(e);if(e.startsWith(fn`\o{`))throw new Error(`Incomplete, invalid, or unsupported octal code point "${e}"`);if(/^\\[pP]\{/.test(e)){if(e.length===3)throw new Error(`Incomplete or invalid Unicode property "${e}"`);return dI(e)}if(new RegExp("^\\\\x[89A-Fa-f]\\p{AHex}","u").test(e))try{const s=e.split(/\\x/).slice(1).map(c=>parseInt(c,16)),a=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}).decode(new Uint8Array(s)),o=new TextEncoder;return[...a].map(c=>{const l=[...o.encode(c)].map(h=>`\\x${h.toString(16)}`).join("");return ls($a(c),l)})}catch{throw new Error(`Multibyte code "${e}" incomplete or invalid in Oniguruma`)}if(n==="u"||n==="x")return ls(fI(e),e);if(n0.has(n))return ls(n0.get(n),e);if(/\d/.test(n))return tI(t,e);if(e==="\\")throw new Error(fn`Incomplete escape "\"`);if(n==="M")throw new Error(`Unsupported meta "${e}"`);if([...e].length===2)return ls(e.codePointAt(1),e);throw new Error(`Unexpected escape "${e}"`)}function QM(e){return{type:"Alternator",raw:e}}function e0(e,t){return{type:"Assertion",kind:e,raw:t}}function Mw(e){return{type:"Backreference",raw:e}}function ls(e,t){return{type:"Character",value:e,raw:t}}function JM(e){return{type:"CharacterClassClose",raw:e}}function ZM(e){return{type:"CharacterClassHyphen",raw:e}}function eI(e){return{type:"CharacterClassIntersector",raw:e}}function t0(e,t){return{type:"CharacterClassOpen",negate:e,raw:t}}function yi(e,t,n={}){return{type:"CharacterSet",kind:e,...n,raw:t}}function Iw(e,t,n={}){return e==="keep"?{type:"Directive",kind:e,raw:t}:{type:"Directive",kind:e,flags:Ua(n.flags),raw:t}}function tI(e,t){return{type:"EscapedNumber",inCharClass:e,raw:t}}function nI(e){return{type:"GroupClose",raw:e}}function ka(e,t,n={}){return{type:"GroupOpen",kind:e,...n,raw:t}}function rI(e,t,n,s){return{type:"NamedCallout",kind:e,tag:t,arguments:n,raw:s}}function sI(e,t,n,s){return{type:"Quantifier",kind:e,min:t,max:n,raw:s}}function iI(e){return{type:"Subroutine",raw:e}}const aI=new Set(["COUNT","CMP","ERROR","FAIL","MAX","MISMATCH","SKIP","TOTAL_COUNT"]),n0=new Map([["a",7],["b",8],["e",27],["f",12],["n",10],["r",13],["t",9],["v",11]]);function oI(e){const t=e[1]==="c"?e[2]:e[3];if(!t||!/[A-Za-z]/.test(t))throw new Error(`Unsupported control character "${e}"`);return ls($a(t.toUpperCase())-64,e)}function lI(e,t){let{on:n,off:s}=/^\(\?(?<on>[imx]*)(?:-(?<off>[-imx]*))?/.exec(e).groups;s??(s="");const a=(t.getCurrentModX()||n.includes("x"))&&!s.includes("x"),o=s0(n),c=s0(s),l={};if(o&&(l.enable=o),c&&(l.disable=c),e.endsWith(")"))return t.replaceCurrentModX(a),Iw("flags",e,{flags:l});if(e.endsWith(":"))return t.pushModX(a),t.numOpenGroups++,ka("group",e,{...(o||c)&&{flags:l}});throw new Error(`Unexpected flag modifier "${e}"`)}function cI(e){const t=/\(\*(?<name>[A-Za-z_]\w*)?(?:\[(?<tag>(?:[A-Za-z_]\w*)?)\])?(?:\{(?<args>[^}]*)\})?\)/.exec(e);if(!t)throw new Error(`Incomplete or invalid named callout "${e}"`);const{name:n,tag:s,args:a}=t.groups;if(!n)throw new Error(`Invalid named callout "${e}"`);if(s==="")throw new Error(`Named callout tag with empty value not allowed "${e}"`);const o=a?a.split(",").filter(p=>p!=="").map(p=>/^[+-]?\d+$/.test(p)?+p:p):[],[c,l,h]=o,f=aI.has(n)?n.toLowerCase():"custom";switch(f){case"fail":case"mismatch":case"skip":if(o.length>0)throw new Error(`Named callout arguments not allowed "${o}"`);break;case"error":if(o.length>1)throw new Error(`Named callout allows only one argument "${o}"`);if(typeof c=="string")throw new Error(`Named callout argument must be a number "${c}"`);break;case"max":if(!o.length||o.length>2)throw new Error(`Named callout must have one or two arguments "${o}"`);if(typeof c=="string"&&!/^[A-Za-z_]\w*$/.test(c))throw new Error(`Named callout argument one must be a tag or number "${c}"`);if(o.length===2&&(typeof l=="number"||!/^[<>X]$/.test(l)))throw new Error(`Named callout optional argument two must be '<', '>', or 'X' "${l}"`);break;case"count":case"total_count":if(o.length>1)throw new Error(`Named callout allows only one argument "${o}"`);if(o.length===1&&(typeof c=="number"||!/^[<>X]$/.test(c)))throw new Error(`Named callout optional argument must be '<', '>', or 'X' "${c}"`);break;case"cmp":if(o.length!==3)throw new Error(`Named callout must have three arguments "${o}"`);if(typeof c=="string"&&!/^[A-Za-z_]\w*$/.test(c))throw new Error(`Named callout argument one must be a tag or number "${c}"`);if(typeof l=="number"||!/^(?:[<>!=]=|[<>])$/.test(l))throw new Error(`Named callout argument two must be '==', '!=', '>', '<', '>=', or '<=' "${l}"`);if(typeof h=="string"&&!/^[A-Za-z_]\w*$/.test(h))throw new Error(`Named callout argument three must be a tag or number "${h}"`);break;case"custom":throw new Error(`Undefined callout name "${n}"`);default:throw new Error(`Unexpected named callout kind "${f}"`)}return rI(f,s??null,(a==null?void 0:a.split(","))??null,e)}function r0(e){let t=null,n,s;if(e[0]==="{"){const{minStr:a,maxStr:o}=/^\{(?<minStr>\d*)(?:,(?<maxStr>\d*))?/.exec(e).groups,c=1e5;if(+a>c||o&&+o>c)throw new Error("Quantifier value unsupported in Oniguruma");if(n=+a,s=o===void 0?+a:o===""?1/0:+o,n>s&&(t="possessive",[n,s]=[s,n]),e.endsWith("?")){if(t==="possessive")throw new Error('Unsupported possessive interval quantifier chain with "?"');t="lazy"}else t||(t="greedy")}else n=e[0]==="+"?1:0,s=e[0]==="?"?1:1/0,t=e[1]==="+"?"possessive":e[1]==="?"?"lazy":"greedy";return sI(t,n,s,e)}function uI(e){const t=e[1].toLowerCase();return yi({d:"digit",h:"hex",s:"space",w:"word"}[t],e,{negate:e[1]!==t})}function dI(e){const{p:t,neg:n,value:s}=/^\\(?<p>[pP])\{(?<neg>\^?)(?<value>[^}]+)/.exec(e).groups;return yi("property",e,{value:s,negate:t==="P"&&!n||t==="p"&&!!n})}function s0(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 hI(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 s=e[n];if(!"imxDPSWy".includes(s))throw new Error(`Invalid flag "${s}"`);if(s==="y"){if(!/^y{[gw]}/.test(e.slice(n)))throw new Error('Invalid or unspecified flag "y" mode');t.textSegmentMode=e[n+2]==="g"?"grapheme":"word",n+=3;continue}t[{i:"ignoreCase",m:"dotAll",x:"extended",D:"digitIsAscii",P:"posixIsAscii",S:"spaceIsAscii",W:"wordIsAscii"}[s]]=!0}return t}function fI(e){if(new RegExp("^(?:\\\\u(?!\\p{AHex}{4})|\\\\x(?!\\p{AHex}{1,2}|\\{\\p{AHex}{1,8}\\}))","u").test(e))throw new Error(`Incomplete or invalid escape "${e}"`);const t=e[2]==="{"?new RegExp("^\\\\x\\{\\s*(?<hex>\\p{AHex}+)","u").exec(e).groups.hex:e.slice(2);return parseInt(t,16)}function mI(e,t){const{raw:n,inCharClass:s}=e,a=n.slice(1);if(!s&&(a!=="0"&&a.length===1||a[0]!=="0"&&+a<=t))return[Mw(n)];const o=[],c=a.match(/^[0-7]+|\d/g);for(let l=0;l<c.length;l++){const h=c[l];let f;if(l===0&&h!=="8"&&h!=="9"){if(f=parseInt(h,8),f>127)throw new Error(fn`Octal encoded byte above 177 unsupported "${n}"`)}else f=$a(h);o.push(ls(f,(l===0?"\\":"")+h))}return o}function pI(e){const t=[],n=new RegExp($p,"gy");let s;for(;s=n.exec(e);){const a=s[0];if(a[0]==="{"){const o=/^\{(?<min>\d+),(?<max>\d+)\}\??$/.exec(a);if(o){const{min:c,max:l}=o.groups;if(+c>+l&&a.endsWith("?")){n.lastIndex--,t.push(r0(a.slice(0,-1)));continue}}}t.push(r0(a))}return t}function Pw(e,t){if(!Array.isArray(e.body))throw new Error("Expected node with body array");if(e.body.length!==1)return!1;const n=e.body[0];return!t||Object.keys(t).every(s=>t[s]===n[s])}function gI(e){return xI.has(e.type)}const xI=new Set(["AbsenceFunction","Backreference","CapturingGroup","Character","CharacterClass","CharacterSet","Group","Quantifier","Subroutine"]);function Bw(e,t={}){const n={flags:"",normalizeUnknownPropertyNames:!1,skipBackrefValidation:!1,skipLookbehindValidation:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}},s=qM(e,{flags:n.flags,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline}}),a=(_,y)=>{const w=s.tokens[o.nextIndex];switch(o.parent=_,o.nextIndex++,w.type){case"Alternator":return Ei();case"Assertion":return _I(w);case"Backreference":return yI(w,o);case"Character":return Wu(w.value,{useLastValid:!!y.isCheckingRangeEnd});case"CharacterClassHyphen":return vI(w,o,y);case"CharacterClassOpen":return bI(w,o,y);case"CharacterSet":return SI(w,o);case"Directive":return TI(w.kind,{flags:w.flags});case"GroupOpen":return wI(w,o,y);case"NamedCallout":return AI(w.kind,w.tag,w.arguments);case"Quantifier":return CI(w,o);case"Subroutine":return kI(w,o);default:throw new Error(`Unexpected token type "${w.type}"`)}},o={capturingGroups:[],hasNumberedRef:!1,namedGroupsByName:new Map,nextIndex:0,normalizeUnknownPropertyNames:n.normalizeUnknownPropertyNames,parent:null,skipBackrefValidation:n.skipBackrefValidation,skipLookbehindValidation:n.skipLookbehindValidation,skipPropertyNameValidation:n.skipPropertyNameValidation,subroutines:[],tokens:s.tokens,unicodePropertyMap:n.unicodePropertyMap,walk:a},c=LI(NI(s.flags));let l=c.body[0];for(;o.nextIndex<s.tokens.length;){const _=a(l,{});_.type==="Alternative"?(c.body.push(_),l=_):l.body.push(_)}const{capturingGroups:h,hasNumberedRef:f,namedGroupsByName:p,subroutines:m}=o;if(f&&p.size&&!n.rules.captureGroup)throw new Error("Numbered backref/subroutine not allowed when using named capture");for(const{ref:_}of m)if(typeof _=="number"){if(_>h.length)throw new Error("Subroutine uses a group number that's not defined");_&&(h[_-1].isSubroutined=!0)}else if(p.has(_)){if(p.get(_).length>1)throw new Error(fn`Subroutine uses a duplicate group name "\g<${_}>"`);p.get(_)[0].isSubroutined=!0}else throw new Error(fn`Subroutine uses a group name that's not defined "\g<${_}>"`);return c}function _I({kind:e}){return Bm(Ua({"^":"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===fn`\B`||e===fn`\Y`})}function yI({raw:e},t){const n=/^\\k[<']/.test(e),s=n?e.slice(3,-1):e.slice(1),a=(o,c=!1)=>{const l=t.capturingGroups.length;let h=!1;if(o>l)if(t.skipBackrefValidation)h=!0;else throw new Error(`Not enough capturing groups defined to the left "${e}"`);return t.hasNumberedRef=!0,zm(c?l+1-o:o,{orphan:h})};if(n){const o=/^(?<sign>-?)0*(?<num>[1-9]\d*)$/.exec(s);if(o)return a(+o.groups.num,!!o.groups.sign);if(/[-+]/.test(s))throw new Error(`Invalid backref name "${e}"`);if(!t.namedGroupsByName.has(s))throw new Error(`Group name not defined to the left "${e}"`);return zm(s)}return a(+s)}function vI(e,t,n){const{tokens:s,walk:a}=t,o=t.parent,c=o.body.at(-1),l=s[t.nextIndex];if(!n.isCheckingRangeEnd&&c&&c.type!=="CharacterClass"&&c.type!=="CharacterClassRange"&&l&&l.type!=="CharacterClassOpen"&&l.type!=="CharacterClassClose"&&l.type!=="CharacterClassIntersector"){const h=a(o,{...n,isCheckingRangeEnd:!0});if(c.type==="Character"&&h.type==="Character")return o.body.pop(),jI(c,h);throw new Error("Invalid character class range")}return Wu($a("-"))}function bI({negate:e},t,n){const{tokens:s,walk:a}=t,o=[Zc()],c=s[t.nextIndex];let l=o0(c);for(;l.type!=="CharacterClassClose";){if(l.type==="CharacterClassIntersector")o.push(Zc()),t.nextIndex++;else{const f=o.at(-1);f.body.push(a(f,n))}l=o0(s[t.nextIndex],c)}const h=Zc({negate:e});return o.length===1?h.body=o[0].body:(h.kind="intersection",h.body=o.map(f=>f.body.length===1?f.body[0]:f)),t.nextIndex++,h}function SI({kind:e,negate:t,value:n},s){const{normalizeUnknownPropertyNames:a,skipPropertyNameValidation:o,unicodePropertyMap:c}=s;if(e==="property"){const l=qu(n);if(Hp.has(l)&&!(c!=null&&c.has(l)))e="posix",n=l;else return Ea(n,{negate:t,normalizeUnknownPropertyNames:a,skipPropertyNameValidation:o,unicodePropertyMap:c})}return e==="posix"?DI(n,{negate:t}):Hm(e,{negate:t})}function wI(e,t,n){const{tokens:s,capturingGroups:a,namedGroupsByName:o,skipLookbehindValidation:c,walk:l}=t,h=RI(e),f=h.type==="AbsenceFunction",p=a0(h),m=p&&h.negate;if(h.type==="CapturingGroup"&&(a.push(h),h.name&&WM(o,h.name,[]).push(h)),f&&n.isInAbsenceFunction)throw new Error("Nested absence function not supported by Oniguruma");let _=l0(s[t.nextIndex]);for(;_.type!=="GroupClose";){if(_.type==="Alternator")h.body.push(Ei()),t.nextIndex++;else{const y=h.body.at(-1),w=l(y,{...n,isInAbsenceFunction:n.isInAbsenceFunction||f,isInLookbehind:n.isInLookbehind||p,isInNegLookbehind:n.isInNegLookbehind||m});if(y.body.push(w),(p||n.isInLookbehind)&&!c){const k="Lookbehind includes a pattern not allowed by Oniguruma";if(m||n.isInNegLookbehind){if(i0(w)||w.type==="CapturingGroup")throw new Error(k)}else if(i0(w)||a0(w)&&w.negate)throw new Error(k)}}_=l0(s[t.nextIndex])}return t.nextIndex++,h}function CI({kind:e,min:t,max:n},s){const a=s.parent,o=a.body.at(-1);if(!o||!gI(o))throw new Error("Quantifier requires a repeatable token");const c=Hw(e,t,n,o);return a.body.pop(),c}function kI({raw:e},t){const{capturingGroups:n,subroutines:s}=t;let a=e.slice(3,-1);const o=/^(?<sign>[-+]?)0*(?<num>[1-9]\d*)$/.exec(a);if(o){const l=+o.groups.num,h=n.length;if(t.hasNumberedRef=!0,a={"":l,"+":h+l,"-":h+1-l}[o.groups.sign],a<1)throw new Error("Invalid subroutine number")}else a==="0"&&(a=0);const c=$w(a);return s.push(c),c}function EI(e,t){return{type:"AbsenceFunction",kind:e,body:yl(t==null?void 0:t.body)}}function Ei(e){return{type:"Alternative",body:Uw(e==null?void 0:e.body)}}function Bm(e,t){const n={type:"Assertion",kind:e};return(e==="word_boundary"||e==="text_segment_boundary")&&(n.negate=!!(t!=null&&t.negate)),n}function zm(e,t){const n=!!(t!=null&&t.orphan);return{type:"Backreference",ref:e,...n&&{orphan:n}}}function zw(e,t){const n={name:void 0,isSubroutined:!1,...t};if(n.name!==void 0&&!OI(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:yl(t==null?void 0:t.body)}}function Wu(e,t){const n={useLastValid:!1,...t};if(e>1114111){const s=e.toString(16);if(n.useLastValid)e=1114111;else throw e>1310719?new Error(`Invalid code point out of range "\\x{${s}}"`):new Error(`Invalid code point out of range in JS "\\x{${s}}"`)}return{type:"Character",value:e}}function Zc(e){const t={kind:"union",negate:!1,...e};return{type:"CharacterClass",kind:t.kind,negate:t.negate,body:Uw(e==null?void 0:e.body)}}function jI(e,t){if(t.value<e.value)throw new Error("Character class range out of order");return{type:"CharacterClassRange",min:e,max:t}}function Hm(e,t){const n=!!(t!=null&&t.negate),s={type:"CharacterSet",kind:e};return(e==="digit"||e==="hex"||e==="newline"||e==="space"||e==="word")&&(s.negate=n),(e==="text_segment"||e==="newline"&&!n)&&(s.variableLength=!0),s}function TI(e,t={}){if(e==="keep")return{type:"Directive",kind:e};if(e==="flags")return{type:"Directive",kind:e,flags:Ua(t.flags)};throw new Error(`Unexpected directive kind "${e}"`)}function NI(e){return{type:"Flags",...e}}function yr(e){const t=e==null?void 0:e.atomic,n=e==null?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:yl(e==null?void 0:e.body)}}function xi(e){const t={behind:!1,negate:!1,...e};return{type:"LookaroundAssertion",kind:t.behind?"lookbehind":"lookahead",negate:t.negate,body:yl(e==null?void 0:e.body)}}function AI(e,t,n){return{type:"NamedCallout",kind:e,tag:t,arguments:n}}function DI(e,t){const n=!!(t!=null&&t.negate);if(!Hp.has(e))throw new Error(`Invalid POSIX class "${e}"`);return{type:"CharacterSet",kind:"posix",value:e,negate:n}}function Hw(e,t,n,s){if(t>n)throw new Error("Invalid reversed quantifier range");return{type:"Quantifier",kind:e,min:t,max:n,body:s}}function LI(e,t){return{type:"Regex",body:yl(t==null?void 0:t.body),flags:e}}function $w(e){return{type:"Subroutine",ref:e}}function Ea(e,t){var a;const n={negate:!1,normalizeUnknownPropertyNames:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t};let s=(a=n.unicodePropertyMap)==null?void 0:a.get(qu(e));if(!s){if(n.normalizeUnknownPropertyNames)s=MI(e);else if(n.unicodePropertyMap&&!n.skipPropertyNameValidation)throw new Error(fn`Invalid Unicode property "\p{${e}}"`)}return{type:"CharacterSet",kind:"property",value:s??e,negate:n.negate}}function RI({flags:e,kind:t,name:n,negate:s,number:a}){switch(t){case"absence_repeater":return EI("repeater");case"atomic":return yr({atomic:!0});case"capturing":return zw(a,{name:n});case"group":return yr({flags:e});case"lookahead":case"lookbehind":return xi({behind:t==="lookbehind",negate:s});default:throw new Error(`Unexpected group kind "${t}"`)}}function yl(e){if(e===void 0)e=[Ei()];else if(!Array.isArray(e)||!e.length||!e.every(t=>t.type==="Alternative"))throw new Error("Invalid body; expected array of one or more Alternative nodes");return e}function Uw(e){if(e===void 0)e=[];else if(!Array.isArray(e)||!e.every(t=>!!t.type))throw new Error("Invalid body; expected array of nodes");return e}function i0(e){return e.type==="LookaroundAssertion"&&e.kind==="lookahead"}function a0(e){return e.type==="LookaroundAssertion"&&e.kind==="lookbehind"}function OI(e){return/^[\p{Alpha}\p{Pc}][^)]*$/u.test(e)}function MI(e){return e.trim().replace(/[- _]+/g,"_").replace(/[A-Z][a-z]+(?=[A-Z])/g,"$&_").replace(/[A-Za-z]+/g,t=>t[0].toUpperCase()+t.slice(1).toLowerCase())}function qu(e){return e.replace(/[- _]+/g,"").toLowerCase()}function o0(e,t){const n=t;return Ua(e,`Unclosed character class${(n==null?void 0:n.type)==="Character"&&n.value===93&&n.raw==="]"?' (started with "]")':""}`)}function l0(e){return Ua(e,"Unclosed group")}function el(e,t,n=null){function s(o,c){for(let l=0;l<o.length;l++){const h=a(o[l],c,l,o);l=Math.max(-1,l+h)}}function a(o,c=null,l=null,h=null){var b,x;let f=0,p=!1;const m={node:o,parent:c,key:l,container:h,root:e,remove(){qc(h).splice(Math.max(0,_a(l)+f),1),f--,p=!0},removeAllNextSiblings(){return qc(h).splice(_a(l)+1)},removeAllPrevSiblings(){const S=_a(l)+f;return f-=S,qc(h).splice(0,Math.max(0,S))},replaceWith(S,j={}){const N=!!j.traverse;h?h[Math.max(0,_a(l)+f)]=S:Ua(c,"Can't replace root node")[l]=S,N&&a(S,c,l,h),p=!0},replaceWithMultiple(S,j={}){const N=!!j.traverse;if(qc(h).splice(Math.max(0,_a(l)+f),1,...S),f+=S.length-1,N){let T=0;for(let D=0;D<S.length;D++)T+=a(S[D],c,_a(l)+D+T,h)}p=!0},skip(){p=!0}},{type:_}=o,y=t["*"],w=t[_],k=typeof y=="function"?y:y==null?void 0:y.enter,v=typeof w=="function"?w:w==null?void 0:w.enter;if(k==null||k(m,n),v==null||v(m,n),!p)switch(_){case"AbsenceFunction":case"Alternative":case"CapturingGroup":case"CharacterClass":case"Group":case"LookaroundAssertion":s(o.body,o);break;case"Assertion":case"Backreference":case"Character":case"CharacterSet":case"Directive":case"Flags":case"NamedCallout":case"Subroutine":break;case"CharacterClassRange":a(o.min,o,"min"),a(o.max,o,"max");break;case"Quantifier":a(o.body,o,"body");break;case"Regex":s(o.body,o),a(o.flags,o,"flags");break;default:throw new Error(`Unexpected node type "${_}"`)}return(b=w==null?void 0:w.exit)==null||b.call(w,m,n),(x=y==null?void 0:y.exit)==null||x.call(y,m,n),f}return a(e),e}function qc(e){if(!Array.isArray(e))throw new Error("Container expected");return e}function _a(e){if(typeof e!="number")throw new Error("Numeric key expected");return e}const II=String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`;function PI(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function BI(e,t,n,s){return e.slice(0,t)+s+e.slice(t+n.length)}const fr=Object.freeze({DEFAULT:"DEFAULT",CHAR_CLASS:"CHAR_CLASS"});function Up(e,t,n,s){const a=new RegExp(String.raw`${t}|(?<$skip>\[\^?|\\?.)`,"gsu"),o=[!1];let c=0,l="";for(const h of e.matchAll(a)){const{0:f,groups:{$skip:p}}=h;if(!p&&(!s||s===fr.DEFAULT==!c)){n instanceof Function?l+=n(h,{context:c?fr.CHAR_CLASS:fr.DEFAULT,negated:o[o.length-1]}):l+=n;continue}f[0]==="["?(c++,o.push(f[1]==="^")):f==="]"&&c&&(c--,o.pop()),l+=f}return l}function Fw(e,t,n,s){Up(e,t,n,s)}function zI(e,t,n=0,s){if(!new RegExp(t,"su").test(e))return null;const a=new RegExp(`${t}|(?<$skip>\\\\?.)`,"gsu");a.lastIndex=n;let o=0,c;for(;c=a.exec(e);){const{0:l,groups:{$skip:h}}=c;if(!h&&(!s||s===fr.DEFAULT==!o))return c;l==="["?o++:l==="]"&&o&&o--,a.lastIndex==c.index&&a.lastIndex++}return null}function Kc(e,t,n){return!!zI(e,t,0,n)}function HI(e,t){const n=/\\?./gsu;n.lastIndex=t;let s=e.length,a=0,o=1,c;for(;c=n.exec(e);){const[l]=c;if(l==="[")a++;else if(a)l==="]"&&a--;else if(l==="(")o++;else if(l===")"&&(o--,!o)){s=c.index;break}}return e.slice(t,s)}const c0=new RegExp(String.raw`(?<noncapturingStart>${II})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`,"gsu");function $I(e,t){const n=(t==null?void 0:t.hiddenCaptures)??[];let s=(t==null?void 0:t.captureTransfers)??new Map;if(!/\(\?>/.test(e))return{pattern:e,captureTransfers:s,hiddenCaptures:n};const a="(?>",o="(?:(?=(",c=[0],l=[];let h=0,f=0,p=NaN,m;do{m=!1;let _=0,y=0,w=!1,k;for(c0.lastIndex=Number.isNaN(p)?0:p+o.length;k=c0.exec(e);){const{0:v,index:b,groups:{capturingStart:x,noncapturingStart:S}}=k;if(v==="[")_++;else if(_)v==="]"&&_--;else if(v===a&&!w)p=b,w=!0;else if(w&&S)y++;else if(x)w?y++:(h++,c.push(h+f));else if(v===")"&&w){if(!y){f++;const j=h+f;if(e=`${e.slice(0,p)}${o}${e.slice(p+a.length,b)}))<$$${j}>)${e.slice(b+1)}`,m=!0,l.push(j),PI(n,j),s.size){const N=new Map;s.forEach((T,D)=>{N.set(D>=j?D+1:D,T.map(A=>A>=j?A+1:A))}),s=N}break}y--}}}while(m);return n.push(...l),e=Up(e,String.raw`\\(?<backrefNum>[1-9]\d*)|<\$\$(?<wrappedBackrefNum>\d+)>`,({0:_,groups:{backrefNum:y,wrappedBackrefNum:w}})=>{if(y){const k=+y;if(k>c.length-1)throw new Error(`Backref "${_}" greater than number of captures`);return`\\${c[k]}`}return`\\${w}`},fr.DEFAULT),{pattern:e,captureTransfers:s,hiddenCaptures:n}}const Vw=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,Jf=new RegExp(String.raw`
166
+ \\(?: \d+
167
+ | c[A-Za-z]
168
+ | [gk]<[^>]+>
169
+ | [pPu]\{[^\}]+\}
170
+ | u[A-Fa-f\d]{4}
171
+ | x[A-Fa-f\d]{2}
172
+ )
173
+ | \((?: \? (?: [:=!>]
174
+ | <(?:[=!]|[^>]+>)
175
+ | [A-Za-z\-]+:
176
+ | \(DEFINE\)
177
+ ))?
178
+ | (?<qBase>${Vw})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?)
179
+ | \\?.
180
+ `.replace(/\s+/g,""),"gsu");function UI(e){if(!new RegExp(`${Vw}\\+`).test(e))return{pattern:e};const t=[];let n=null,s=null,a="",o=0,c;for(Jf.lastIndex=0;c=Jf.exec(e);){const{0:l,index:h,groups:{qBase:f,qMod:p,invalidQ:m}}=c;if(l==="[")o||(s=h),o++;else if(l==="]")o?o--:s=null;else if(!o)if(p==="+"&&a&&!a.startsWith("(")){if(m)throw new Error(`Invalid quantifier "${l}"`);let _=-1;if(/^\{\d+\}$/.test(f))e=BI(e,h+f.length,p,"");else{if(a===")"||a==="]"){const y=a===")"?n:s;if(y===null)throw new Error(`Invalid unmatched "${a}"`);e=`${e.slice(0,y)}(?>${e.slice(y,h)}${f})${e.slice(h+l.length)}`}else e=`${e.slice(0,h-a.length)}(?>${a}${f})${e.slice(h+l.length)}`;_+=4}Jf.lastIndex+=_}else l[0]==="("?t.push(h):l===")"&&(n=t.length?t.pop():null);a=l}return{pattern:e}}const hr=String.raw,FI=hr`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`,$m=hr`\(\?R=(?<rDepth>[^\)]+)\)|${FI}`,Ku=hr`\(\?<(?![=!])(?<captureName>[^>]+)>`,Gw=hr`${Ku}|(?<unnamed>\()(?!\?)`,hi=new RegExp(hr`${Ku}|${$m}|\(\?|\\?.`,"gsu"),Zf="Cannot use multiple overlapping recursions";function VI(e,t){const{hiddenCaptures:n,mode:s}={hiddenCaptures:[],mode:"plugin",...t};let a=(t==null?void 0:t.captureTransfers)??new Map;if(!new RegExp($m,"su").test(e))return{pattern:e,captureTransfers:a,hiddenCaptures:n};if(s==="plugin"&&Kc(e,hr`\(\?\(DEFINE\)`,fr.DEFAULT))throw new Error("DEFINE groups cannot be used with recursion");const o=[],c=Kc(e,hr`\\[1-9]`,fr.DEFAULT),l=new Map,h=[];let f=!1,p=0,m=0,_;for(hi.lastIndex=0;_=hi.exec(e);){const{0:y,groups:{captureName:w,rDepth:k,gRNameOrNum:v,gRDepth:b}}=_;if(y==="[")p++;else if(p)y==="]"&&p--;else if(k){if(u0(k),f)throw new Error(Zf);if(c)throw new Error(`${s==="external"?"Backrefs":"Numbered backrefs"} cannot be used with global recursion`);const x=e.slice(0,_.index),S=e.slice(hi.lastIndex);if(Kc(S,$m,fr.DEFAULT))throw new Error(Zf);const j=+k-1;e=d0(x,S,j,!1,n,o,m),a=f0(a,x,j,o.length,0,m);break}else if(v){u0(b);let x=!1;for(const F of h)if(F.name===v||F.num===+v){if(x=!0,F.hasRecursedWithin)throw new Error(Zf);break}if(!x)throw new Error(hr`Recursive \g cannot be used outside the referenced group "${s==="external"?v:hr`\g<${v}&R=${b}>`}"`);const S=l.get(v),j=HI(e,S);if(c&&Kc(j,hr`${Ku}|\((?!\?)`,fr.DEFAULT))throw new Error(`${s==="external"?"Backrefs":"Numbered backrefs"} cannot be used with recursion of capturing groups`);const N=e.slice(S,_.index),T=j.slice(N.length+y.length),D=o.length,A=+b-1,B=d0(N,T,A,!0,n,o,m);a=f0(a,N,A,o.length-D,D,m);const R=e.slice(0,S),$=e.slice(S+j.length);e=`${R}${B}${$}`,hi.lastIndex+=B.length-y.length-N.length-T.length,h.forEach(F=>F.hasRecursedWithin=!0),f=!0}else if(w)m++,l.set(String(m),hi.lastIndex),l.set(w,hi.lastIndex),h.push({num:m,name:w});else if(y[0]==="("){const x=y==="(";x&&(m++,l.set(String(m),hi.lastIndex)),h.push(x?{num:m}:{})}else y===")"&&h.pop()}return n.push(...o),{pattern:e,captureTransfers:a,hiddenCaptures:n}}function u0(e){const t=`Max depth must be integer between 2 and 100; used ${e}`;if(!/^[1-9]\d*$/.test(e))throw new Error(t);if(e=+e,e<2||e>100)throw new Error(t)}function d0(e,t,n,s,a,o,c){const l=new Set;s&&Fw(e+t,Ku,({groups:{captureName:f}})=>{l.add(f)},fr.DEFAULT);const h=[n,s?l:null,a,o,c];return`${e}${h0(`(?:${e}`,"forward",...h)}(?:)${h0(`${t})`,"backward",...h)}${t}`}function h0(e,t,n,s,a,o,c){const h=p=>t==="forward"?p+2:n-p+2-1;let f="";for(let p=0;p<n;p++){const m=h(p);f+=Up(e,hr`${Gw}|\\k<(?<backref>[^>]+)>`,({0:_,groups:{captureName:y,unnamed:w,backref:k}})=>{if(k&&s&&!s.has(k))return _;const v=`_$${m}`;if(w||y){const b=c+o.length+1;return o.push(b),GI(a,b),w?_:`(?<${y}${v}>`}return hr`\k<${k}${v}>`},fr.DEFAULT)}return f}function GI(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function f0(e,t,n,s,a,o){if(e.size&&s){let c=0;Fw(t,Gw,()=>c++,fr.DEFAULT);const l=o-c+a,h=new Map;return e.forEach((f,p)=>{const m=(s-c*n)/n,_=c*n,y=p>l+c?p+s:p,w=[];for(const k of f)if(k<=l)w.push(k);else if(k>l+c+m)w.push(k+s);else if(k<=l+c)for(let v=0;v<=n;v++)w.push(k+c*v);else for(let v=0;v<=n;v++)w.push(k+_+m*v);h.set(y,w)}),h}return e}var ln=String.fromCodePoint,Qe=String.raw,Sr={},Yu=globalThis.RegExp;Sr.flagGroups=(()=>{try{new Yu("(?i:)")}catch{return!1}return!0})();Sr.unicodeSets=(()=>{try{new Yu("[[]]","v")}catch{return!1}return!0})();Sr.bugFlagVLiteralHyphenIsRange=Sr.unicodeSets?(()=>{try{new Yu(Qe`[\d\-a]`,"v")}catch{return!0}return!1})():!1;Sr.bugNestedClassIgnoresNegation=Sr.unicodeSets&&new Yu("[[^a]]","v").test("a");function xu(e,{enable:t,disable:n}){return{dotAll:!(n!=null&&n.dotAll)&&!!(t!=null&&t.dotAll||e.dotAll),ignoreCase:!(n!=null&&n.ignoreCase)&&!!(t!=null&&t.ignoreCase||e.ignoreCase)}}function ll(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}function Um(e,t){return m0[e]>=m0[t]}function WI(e,t){if(e==null)throw new Error(t??"Value expected");return e}var m0={ES2025:2025,ES2024:2024,ES2018:2018},qI={auto:"auto",ES2025:"ES2025",ES2024:"ES2024",ES2018:"ES2018"};function Ww(e={}){if({}.toString.call(e)!=="[object Object]")throw new Error("Unexpected options");if(e.target!==void 0&&!qI[e.target])throw new Error(`Unexpected target "${e.target}"`);const t={accuracy:"default",avoidSubclass:!1,flags:"",global:!1,hasIndices:!1,lazyCompileLength:1/0,target:"auto",verbose:!1,...e,rules:{allowOrphanBackrefs:!1,asciiWordBoundaries:!1,captureGroup:!1,recursionLimit:20,singleline:!1,...e.rules}};return t.target==="auto"&&(t.target=Sr.flagGroups?"ES2025":Sr.unicodeSets?"ES2024":"ES2018"),t}var KI="[ -\r ]",YI=new Set([ln(304),ln(305)]),rs=Qe`[\p{L}\p{M}\p{N}\p{Pc}]`;function qw(e){if(YI.has(e))return[e];const t=new Set,n=e.toLowerCase(),s=n.toUpperCase(),a=JI.get(n),o=XI.get(n),c=QI.get(n);return[...s].length===1&&t.add(s),c&&t.add(c),a&&t.add(a),t.add(n),o&&t.add(o),[...t]}var Fp=new Map(`C Other
181
+ Cc Control cntrl
182
+ Cf Format
183
+ Cn Unassigned
184
+ Co Private_Use
185
+ Cs Surrogate
186
+ L Letter
187
+ LC Cased_Letter
188
+ Ll Lowercase_Letter
189
+ Lm Modifier_Letter
190
+ Lo Other_Letter
191
+ Lt Titlecase_Letter
192
+ Lu Uppercase_Letter
193
+ M Mark Combining_Mark
194
+ Mc Spacing_Mark
195
+ Me Enclosing_Mark
196
+ Mn Nonspacing_Mark
197
+ N Number
198
+ Nd Decimal_Number digit
199
+ Nl Letter_Number
200
+ No Other_Number
201
+ P Punctuation punct
202
+ Pc Connector_Punctuation
203
+ Pd Dash_Punctuation
204
+ Pe Close_Punctuation
205
+ Pf Final_Punctuation
206
+ Pi Initial_Punctuation
207
+ Po Other_Punctuation
208
+ Ps Open_Punctuation
209
+ S Symbol
210
+ Sc Currency_Symbol
211
+ Sk Modifier_Symbol
212
+ Sm Math_Symbol
213
+ So Other_Symbol
214
+ Z Separator
215
+ Zl Line_Separator
216
+ Zp Paragraph_Separator
217
+ Zs Space_Separator
218
+ ASCII
219
+ ASCII_Hex_Digit AHex
220
+ Alphabetic Alpha
221
+ Any
222
+ Assigned
223
+ Bidi_Control Bidi_C
224
+ Bidi_Mirrored Bidi_M
225
+ Case_Ignorable CI
226
+ Cased
227
+ Changes_When_Casefolded CWCF
228
+ Changes_When_Casemapped CWCM
229
+ Changes_When_Lowercased CWL
230
+ Changes_When_NFKC_Casefolded CWKCF
231
+ Changes_When_Titlecased CWT
232
+ Changes_When_Uppercased CWU
233
+ Dash
234
+ Default_Ignorable_Code_Point DI
235
+ Deprecated Dep
236
+ Diacritic Dia
237
+ Emoji
238
+ Emoji_Component EComp
239
+ Emoji_Modifier EMod
240
+ Emoji_Modifier_Base EBase
241
+ Emoji_Presentation EPres
242
+ Extended_Pictographic ExtPict
243
+ Extender Ext
244
+ Grapheme_Base Gr_Base
245
+ Grapheme_Extend Gr_Ext
246
+ Hex_Digit Hex
247
+ IDS_Binary_Operator IDSB
248
+ IDS_Trinary_Operator IDST
249
+ ID_Continue IDC
250
+ ID_Start IDS
251
+ Ideographic Ideo
252
+ Join_Control Join_C
253
+ Logical_Order_Exception LOE
254
+ Lowercase Lower
255
+ Math
256
+ Noncharacter_Code_Point NChar
257
+ Pattern_Syntax Pat_Syn
258
+ Pattern_White_Space Pat_WS
259
+ Quotation_Mark QMark
260
+ Radical
261
+ Regional_Indicator RI
262
+ Sentence_Terminal STerm
263
+ Soft_Dotted SD
264
+ Terminal_Punctuation Term
265
+ Unified_Ideograph UIdeo
266
+ Uppercase Upper
267
+ Variation_Selector VS
268
+ White_Space space
269
+ XID_Continue XIDC
270
+ XID_Start XIDS`.split(/\s/).map(e=>[qu(e),e])),XI=new Map([["s",ln(383)],[ln(383),"s"]]),QI=new Map([[ln(223),ln(7838)],[ln(107),ln(8490)],[ln(229),ln(8491)],[ln(969),ln(8486)]]),JI=new Map([Is(453),Is(456),Is(459),Is(498),...em(8072,8079),...em(8088,8095),...em(8104,8111),Is(8124),Is(8140),Is(8188)]),ZI=new Map([["alnum",Qe`[\p{Alpha}\p{Nd}]`],["alpha",Qe`\p{Alpha}`],["ascii",Qe`\p{ASCII}`],["blank",Qe`[\p{Zs}\t]`],["cntrl",Qe`\p{Cc}`],["digit",Qe`\p{Nd}`],["graph",Qe`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],["lower",Qe`\p{Lower}`],["print",Qe`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],["punct",Qe`[\p{P}\p{S}]`],["space",Qe`\p{space}`],["upper",Qe`\p{Upper}`],["word",Qe`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],["xdigit",Qe`\p{AHex}`]]);function eP(e,t){const n=[];for(let s=e;s<=t;s++)n.push(s);return n}function Is(e){const t=ln(e);return[t.toLowerCase(),t]}function em(e,t){return eP(e,t).map(n=>Is(n))}var Kw=new Set(["Lower","Lowercase","Upper","Uppercase","Ll","Lowercase_Letter","Lt","Titlecase_Letter","Lu","Uppercase_Letter"]);function tP(e,t){const n={accuracy:"default",asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:"ES2025",...t};Yw(e);const s={accuracy:n.accuracy,asciiWordBoundaries:n.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:Um(n.bestEffortTarget,"ES2024"),passedLookbehind:!1,strategy:null,subroutineRefMap:new Map,supportedGNodes:new Set,digitIsAscii:e.flags.digitIsAscii,spaceIsAscii:e.flags.spaceIsAscii,wordIsAscii:e.flags.wordIsAscii};el(e,nP,s);const a={dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},o={currentFlags:a,prevFlags:null,globalFlags:a,groupOriginByCopy:new Map,groupsByName:new Map,multiplexCapturesToLeftByRef:new Map,openRefs:new Map,reffedNodesByReferencer:new Map,subroutineRefMap:s.subroutineRefMap};el(e,rP,o);const c={groupsByName:o.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:o.reffedNodesByReferencer};return el(e,sP,c),e._originMap=o.groupOriginByCopy,e._strategy=s.strategy,e}var nP={AbsenceFunction({node:e,parent:t,replaceWith:n}){const{body:s,kind:a}=e;if(a==="repeater"){const o=yr();o.body[0].body.push(xi({negate:!0,body:s}),Ea("Any"));const c=yr();c.body[0].body.push(Hw("greedy",0,1/0,o)),n(Vt(c,t),{traverse:!0})}else throw new Error('Unsupported absence function "(?~|"')},Alternative:{enter({node:e,parent:t,key:n},{flagDirectivesByAlt:s}){const a=e.body.filter(o=>o.kind==="flags");for(let o=n+1;o<t.body.length;o++){const c=t.body[o];ll(s,c,[]).push(...a)}},exit({node:e},{flagDirectivesByAlt:t}){var n;if((n=t.get(e))!=null&&n.length){const s=Qw(t.get(e));if(s){const a=yr({flags:s});a.body[0].body=e.body,e.body=[Vt(a,e)]}}}},Assertion({node:e,parent:t,key:n,container:s,root:a,remove:o,replaceWith:c},l){const{kind:h,negate:f}=e,{asciiWordBoundaries:p,avoidSubclass:m,supportedGNodes:_,wordIsAscii:y}=l;if(h==="text_segment_boundary")throw new Error(`Unsupported text segment boundary "\\${f?"Y":"y"}"`);if(h==="line_end")c(Vt(xi({body:[Ei({body:[Bm("string_end")]}),Ei({body:[Wu(10)]})]}),t));else if(h==="line_start")c(Vt(ss(Qe`(?<=\A|\n(?!\z))`,{skipLookbehindValidation:!0}),t));else if(h==="search_start")if(_.has(e))a.flags.sticky=!0,o();else{const w=s[n-1];if(w&&uP(w))c(Vt(xi({negate:!0}),t));else{if(m)throw new Error(Qe`Uses "\G" in a way that requires a subclass`);c(Ps(Bm("string_start"),t)),l.strategy="clip_search"}}else if(!(h==="string_end"||h==="string_start"))if(h==="string_end_newline")c(Vt(ss(Qe`(?=\n?\z)`),t));else if(h==="word_boundary"){if(!y&&!p){const w=`(?:(?<=${rs})(?!${rs})|(?<!${rs})(?=${rs}))`,k=`(?:(?<=${rs})(?=${rs})|(?<!${rs})(?!${rs}))`;c(Vt(ss(f?k:w),t))}}else throw new Error(`Unexpected assertion kind "${h}"`)},Backreference({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n=="string"&&!nm(n)&&(n=tm(n,t),e.ref=n)},CapturingGroup({node:e},{jsGroupNameMap:t,subroutineRefMap:n}){let{name:s}=e;s&&!nm(s)&&(s=tm(s,t),e.name=s),n.set(e.number,e),s&&n.set(s,e)},CharacterClassRange({node:e,parent:t,replaceWith:n}){if(t.kind==="intersection"){const s=Zc({body:[e]});n(Vt(s,t),{traverse:!0})}},CharacterSet({node:e,parent:t,replaceWith:n},{accuracy:s,minTargetEs2024:a,digitIsAscii:o,spaceIsAscii:c,wordIsAscii:l}){const{kind:h,negate:f,value:p}=e;if(o&&(h==="digit"||p==="digit")){n(Ps(Hm("digit",{negate:f}),t));return}if(c&&(h==="space"||p==="space")){n(Vt(rm(ss(KI),f),t));return}if(l&&(h==="word"||p==="word")){n(Ps(Hm("word",{negate:f}),t));return}if(h==="any")n(Ps(Ea("Any"),t));else if(h==="digit")n(Ps(Ea("Nd",{negate:f}),t));else if(h!=="dot")if(h==="text_segment"){if(s==="strict")throw new Error(Qe`Use of "\X" requires non-strict accuracy`);const m="\\p{Emoji}(?:\\p{EMod}|\\uFE0F\\u20E3?|[\\x{E0020}-\\x{E007E}]+\\x{E007F})?",_=Qe`\p{RI}{2}|${m}(?:\u200D${m})*`;n(Vt(ss(Qe`(?>\r\n|${a?Qe`\p{RGI_Emoji}`:_}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),t))}else if(h==="hex")n(Ps(Ea("AHex",{negate:f}),t));else if(h==="newline")n(Vt(ss(f?`[^
271
+ ]`:`(?>\r
272
+ ?|[
273
+ \v\f…\u2028\u2029])`),t));else if(h==="posix")if(!a&&(p==="graph"||p==="print")){if(s==="strict")throw new Error(`POSIX class "${p}" requires min target ES2024 or non-strict accuracy`);let m={graph:"!-~",print:" -~"}[p];f&&(m=`\0-${ln(m.codePointAt(0)-1)}${ln(m.codePointAt(2)+1)}-􏿿`),n(Vt(ss(`[${m}]`),t))}else n(Vt(rm(ss(ZI.get(p)),f),t));else if(h==="property")Fp.has(qu(p))||(e.key="sc");else if(h==="space")n(Ps(Ea("space",{negate:f}),t));else if(h==="word")n(Vt(rm(ss(rs),f),t));else throw new Error(`Unexpected character set kind "${h}"`)},Directive({node:e,parent:t,root:n,remove:s,replaceWith:a,removeAllPrevSiblings:o,removeAllNextSiblings:c}){const{kind:l,flags:h}=e;if(l==="flags")if(!h.enable&&!h.disable)s();else{const f=yr({flags:h});f.body[0].body=c(),a(Vt(f,t),{traverse:!0})}else if(l==="keep"){const f=n.body[0],m=n.body.length===1&&Pw(f,{type:"Group"})&&f.body[0].body.length===1?f.body[0]:n;if(t.parent!==m||m.body.length>1)throw new Error(Qe`Uses "\K" in a way that's unsupported`);const _=xi({behind:!0});_.body[0].body=o(),a(Vt(_,t))}else throw new Error(`Unexpected directive kind "${l}"`)},Flags({node:e,parent:t}){if(e.posixIsAscii)throw new Error('Unsupported flag "P"');if(e.textSegmentMode==="word")throw new Error('Unsupported flag "y{w}"');["digitIsAscii","extended","posixIsAscii","spaceIsAscii","wordIsAscii","textSegmentMode"].forEach(n=>delete e[n]),Object.assign(e,{global:!1,hasIndices:!1,multiline:!1,sticky:e.sticky??!1}),t.options={disable:{x:!0,n:!0},force:{v:!0}}},Group({node:e}){if(!e.flags)return;const{enable:t,disable:n}=e.flags;t!=null&&t.extended&&delete t.extended,n!=null&&n.extended&&delete n.extended,t!=null&&t.dotAll&&(n!=null&&n.dotAll)&&delete t.dotAll,t!=null&&t.ignoreCase&&(n!=null&&n.ignoreCase)&&delete t.ignoreCase,t&&!Object.keys(t).length&&delete e.flags.enable,n&&!Object.keys(n).length&&delete e.flags.disable,!e.flags.enable&&!e.flags.disable&&delete e.flags},LookaroundAssertion({node:e},t){const{kind:n}=e;n==="lookbehind"&&(t.passedLookbehind=!0)},NamedCallout({node:e,parent:t,replaceWith:n}){const{kind:s}=e;if(s==="fail")n(Vt(xi({negate:!0}),t));else throw new Error(`Unsupported named callout "(*${s.toUpperCase()}"`)},Quantifier({node:e}){if(e.body.type==="Quantifier"){const t=yr();t.body[0].body.push(e.body),e.body=Vt(t,e)}},Regex:{enter({node:e},{supportedGNodes:t}){const n=[];let s=!1,a=!1;for(const o of e.body)if(o.body.length===1&&o.body[0].kind==="search_start")o.body.pop();else{const c=Zw(o.body);c?(s=!0,Array.isArray(c)?n.push(...c):n.push(c)):a=!0}s&&!a&&n.forEach(o=>t.add(o))},exit(e,{accuracy:t,passedLookbehind:n,strategy:s}){if(t==="strict"&&n&&s)throw new Error(Qe`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n=="string"&&!nm(n)&&(n=tm(n,t),e.ref=n)}},rP={Backreference({node:e},{multiplexCapturesToLeftByRef:t,reffedNodesByReferencer:n}){const{orphan:s,ref:a}=e;s||n.set(e,[...t.get(a).map(({node:o})=>o)])},CapturingGroup:{enter({node:e,parent:t,replaceWith:n,skip:s},{groupOriginByCopy:a,groupsByName:o,multiplexCapturesToLeftByRef:c,openRefs:l,reffedNodesByReferencer:h}){const f=a.get(e);if(f&&l.has(e.number)){const m=Ps(p0(e.number),t);h.set(m,l.get(e.number)),n(m);return}l.set(e.number,e),c.set(e.number,[]),e.name&&ll(c,e.name,[]);const p=c.get(e.name??e.number);for(let m=0;m<p.length;m++){const _=p[m];if(f===_.node||f&&f===_.origin||e===_.origin){p.splice(m,1);break}}if(c.get(e.number).push({node:e,origin:f}),e.name&&c.get(e.name).push({node:e,origin:f}),e.name){const m=ll(o,e.name,new Map);let _=!1;if(f)_=!0;else for(const y of m.values())if(!y.hasDuplicateNameToRemove){_=!0;break}o.get(e.name).set(e,{node:e,hasDuplicateNameToRemove:_})}},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=xu(t.currentFlags,e.flags))},exit(e,t){t.currentFlags=t.prevFlags}},Subroutine({node:e,parent:t,replaceWith:n},s){const{isRecursive:a,ref:o}=e;if(a){let p=t;for(;(p=p.parent)&&!(p.type==="CapturingGroup"&&(p.name===o||p.number===o)););s.reffedNodesByReferencer.set(e,p);return}const c=s.subroutineRefMap.get(o),l=o===0,h=l?p0(0):Xw(c,s.groupOriginByCopy,null);let f=h;if(!l){const p=Qw(oP(c,_=>_.type==="Group"&&!!_.flags)),m=p?xu(s.globalFlags,p):s.globalFlags;iP(m,s.currentFlags)||(f=yr({flags:lP(m)}),f.body[0].body.push(h))}n(Vt(f,t),{traverse:!l})}},sP={Backreference({node:e,parent:t,replaceWith:n},s){if(e.orphan){s.highestOrphanBackref=Math.max(s.highestOrphanBackref,e.ref);return}const o=s.reffedNodesByReferencer.get(e).filter(c=>aP(c,e));if(!o.length)n(Vt(xi({negate:!0}),t));else if(o.length>1){const c=yr({atomic:!0,body:o.reverse().map(l=>Ei({body:[zm(l.number)]}))});n(Vt(c,t))}else e.ref=o[0].number},CapturingGroup({node:e},t){e.number=++t.numCapturesToLeft,e.name&&t.groupsByName.get(e.name).get(e).hasDuplicateNameToRemove&&delete e.name},Regex:{exit({node:e},t){const n=Math.max(t.highestOrphanBackref-t.numCapturesToLeft,0);for(let s=0;s<n;s++){const a=zw();e.body.at(-1).body.push(a)}}},Subroutine({node:e},t){!e.isRecursive||e.ref===0||(e.ref=t.reffedNodesByReferencer.get(e).number)}};function Yw(e){el(e,{"*"({node:t,parent:n}){t.parent=n}})}function iP(e,t){return e.dotAll===t.dotAll&&e.ignoreCase===t.ignoreCase}function aP(e,t){let n=t;do{if(n.type==="Regex")return!1;if(n.type==="Alternative")continue;if(n===e)return!1;const s=Jw(n.parent);for(const a of s){if(a===n)break;if(a===e||eC(a,e))return!0}}while(n=n.parent);throw new Error("Unexpected path")}function Xw(e,t,n,s){const a=Array.isArray(e)?[]:{};for(const[o,c]of Object.entries(e))o==="parent"?a.parent=Array.isArray(n)?s:n:c&&typeof c=="object"?a[o]=Xw(c,t,a,n):(o==="type"&&c==="CapturingGroup"&&t.set(a,t.get(e)??e),a[o]=c);return a}function p0(e){const t=$w(e);return t.isRecursive=!0,t}function oP(e,t){const n=[];for(;e=e.parent;)(!t||t(e))&&n.push(e);return n}function tm(e,t){if(t.has(e))return t.get(e);const n=`$${t.size}_${e.replace(/^[^$_\p{IDS}]|[^$\u200C\u200D\p{IDC}]/ug,"_")}`;return t.set(e,n),n}function Qw(e){const t=["dotAll","ignoreCase"],n={enable:{},disable:{}};return e.forEach(({flags:s})=>{t.forEach(a=>{var o,c;(o=s.enable)!=null&&o[a]&&(delete n.disable[a],n.enable[a]=!0),(c=s.disable)!=null&&c[a]&&(n.disable[a]=!0)})}),Object.keys(n.enable).length||delete n.enable,Object.keys(n.disable).length||delete n.disable,n.enable||n.disable?n:null}function lP({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 Jw(e){if(!e)throw new Error("Node expected");const{body:t}=e;return Array.isArray(t)?t:t?[t]:null}function Zw(e){const t=e.find(n=>n.kind==="search_start"||dP(n,{negate:!1})||!cP(n));if(!t)return null;if(t.kind==="search_start")return t;if(t.type==="LookaroundAssertion")return t.body[0].body[0];if(t.type==="CapturingGroup"||t.type==="Group"){const n=[];for(const s of t.body){const a=Zw(s.body);if(!a)return null;Array.isArray(a)?n.push(...a):n.push(a)}return n}return null}function eC(e,t){const n=Jw(e)??[];for(const s of n)if(s===t||eC(s,t))return!0;return!1}function cP({type:e}){return e==="Assertion"||e==="Directive"||e==="LookaroundAssertion"}function uP(e){const t=["Character","CharacterClass","CharacterSet"];return t.includes(e.type)||e.type==="Quantifier"&&e.min&&t.includes(e.body.type)}function dP(e,t){const n={negate:null,...t};return e.type==="LookaroundAssertion"&&(n.negate===null||e.negate===n.negate)&&e.body.length===1&&Pw(e.body[0],{type:"Assertion",kind:"search_start"})}function nm(e){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e)}function ss(e,t){const s=Bw(e,{...t,unicodePropertyMap:Fp}).body;return s.length>1||s[0].body.length>1?yr({body:s}):s[0].body[0]}function rm(e,t){return e.negate=t,e}function Ps(e,t){return e.parent=t,e}function Vt(e,t){return Yw(e),e.parent=t,e}function hP(e,t){const n=Ww(t),s=Um(n.target,"ES2024"),a=Um(n.target,"ES2025"),o=n.rules.recursionLimit;if(!Number.isInteger(o)||o<2||o>20)throw new Error("Invalid recursionLimit; use 2-20");let c=null,l=null;if(!a){const y=[e.flags.ignoreCase];el(e,fP,{getCurrentModI:()=>y.at(-1),popModI(){y.pop()},pushModI(w){y.push(w)},setHasCasedChar(){y.at(-1)?c=!0:l=!0}})}const h={dotAll:e.flags.dotAll,ignoreCase:!!((e.flags.ignoreCase||c)&&!l)};let f=e;const p={accuracy:n.accuracy,appliedGlobalFlags:h,captureMap:new Map,currentFlags:{dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},inCharClass:!1,lastNode:f,originMap:e._originMap,recursionLimit:o,useAppliedIgnoreCase:!!(!a&&c&&l),useFlagMods:a,useFlagV:s,verbose:n.verbose};function m(y){return p.lastNode=f,f=y,WI(mP[y.type],`Unexpected node type "${y.type}"`)(y,p,m)}const _={pattern:e.body.map(m).join("|"),flags:m(e.flags),options:{...e.options}};return s||(delete _.options.force.v,_.options.disable.v=!0,_.options.unicodeSetsPlugin=null),_._captureTransfers=new Map,_._hiddenCaptures=[],p.captureMap.forEach((y,w)=>{y.hidden&&_._hiddenCaptures.push(w),y.transferTo&&ll(_._captureTransfers,y.transferTo,[]).push(w)}),_}var fP={"*":{enter({node:e},t){if(x0(e)){const n=t.getCurrentModI();t.pushModI(e.flags?xu({ignoreCase:n},e.flags).ignoreCase:n)}},exit({node:e},t){x0(e)&&t.popModI()}},Backreference(e,t){t.setHasCasedChar()},Character({node:e},t){Vp(ln(e.value))&&t.setHasCasedChar()},CharacterClassRange({node:e,skip:t},n){t(),tC(e,{firstOnly:!0}).length&&n.setHasCasedChar()},CharacterSet({node:e},t){e.kind==="property"&&Kw.has(e.value)&&t.setHasCasedChar()}},mP={Alternative({body:e},t,n){return e.map(n).join("")},Assertion({kind:e,negate:t}){if(e==="string_end")return"$";if(e==="string_start")return"^";if(e==="word_boundary")return t?Qe`\B`:Qe`\b`;throw new Error(`Unexpected assertion kind "${e}"`)},Backreference({ref:e},t){if(typeof e!="number")throw new Error("Unexpected named backref in transformed AST");if(!t.useFlagMods&&t.accuracy==="strict"&&t.currentFlags.ignoreCase&&!t.captureMap.get(e).ignoreCase)throw new Error("Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy");return"\\"+e},CapturingGroup(e,t,n){const{body:s,name:a,number:o}=e,c={ignoreCase:t.currentFlags.ignoreCase},l=t.originMap.get(e);return l&&(c.hidden=!0,o>l.number&&(c.transferTo=l.number)),t.captureMap.set(o,c),`(${a?`?<${a}>`:""}${s.map(n).join("|")})`},Character({value:e},t){const n=ln(e),s=ya(e,{escDigit:t.lastNode.type==="Backreference",inCharClass:t.inCharClass,useFlagV:t.useFlagV});if(s!==n)return s;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&Vp(n)){const a=qw(n);return t.inCharClass?a.join(""):a.length>1?`[${a.join("")}]`:a[0]}return n},CharacterClass(e,t,n){const{kind:s,negate:a,parent:o}=e;let{body:c}=e;if(s==="intersection"&&!t.useFlagV)throw new Error("Use of character class intersection requires min target ES2024");Sr.bugFlagVLiteralHyphenIsRange&&t.useFlagV&&c.some(_0)&&(c=[Wu(45),...c.filter(f=>!_0(f))]);const l=()=>`[${a?"^":""}${c.map(n).join(s==="intersection"?"&&":"")}]`;if(!t.inCharClass){if((!t.useFlagV||Sr.bugNestedClassIgnoresNegation)&&!a){const p=c.filter(m=>m.type==="CharacterClass"&&m.kind==="union"&&m.negate);if(p.length){const m=yr(),_=m.body[0];return m.parent=o,_.parent=m,c=c.filter(y=>!p.includes(y)),e.body=c,c.length?(e.parent=_,_.body.push(e)):m.body.pop(),p.forEach(y=>{const w=Ei({body:[y]});y.parent=w,w.parent=m,m.body.push(w)}),n(m)}}t.inCharClass=!0;const f=l();return t.inCharClass=!1,f}const h=c[0];if(s==="union"&&!a&&h&&((!t.useFlagV||!t.verbose)&&o.kind==="union"&&!(Sr.bugFlagVLiteralHyphenIsRange&&t.useFlagV)||!t.verbose&&o.kind==="intersection"&&c.length===1&&h.type!=="CharacterClassRange"))return c.map(n).join("");if(!t.useFlagV&&o.type==="CharacterClass")throw new Error("Uses nested character class in a way that requires min target ES2024");return l()},CharacterClassRange(e,t){const n=e.min.value,s=e.max.value,a={escDigit:!1,inCharClass:!0,useFlagV:t.useFlagV},o=ya(n,a),c=ya(s,a),l=new Set;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase){const h=tC(e);yP(h).forEach(p=>{l.add(Array.isArray(p)?`${ya(p[0],a)}-${ya(p[1],a)}`:ya(p,a))})}return`${o}-${c}${[...l].join("")}`},CharacterSet({kind:e,negate:t,value:n,key:s},a){if(e==="dot")return a.currentFlags.dotAll?a.appliedGlobalFlags.dotAll||a.useFlagMods?".":"[^]":Qe`[^\n]`;if(e==="digit")return t?Qe`\D`:Qe`\d`;if(e==="property"){if(a.useAppliedIgnoreCase&&a.currentFlags.ignoreCase&&Kw.has(n))throw new Error(`Unicode property "${n}" can't be case-insensitive when other chars have specific case`);return`${t?Qe`\P`:Qe`\p`}{${s?`${s}=`:""}${n}}`}if(e==="word")return t?Qe`\W`:Qe`\w`;throw new Error(`Unexpected character set kind "${e}"`)},Flags(e,t){return(t.appliedGlobalFlags.ignoreCase?"i":"")+(e.dotAll?"s":"")+(e.sticky?"y":"")},Group({atomic:e,body:t,flags:n,parent:s},a,o){const c=a.currentFlags;n&&(a.currentFlags=xu(c,n));const l=t.map(o).join("|"),h=!a.verbose&&t.length===1&&s.type!=="Quantifier"&&!e&&(!a.useFlagMods||!n)?l:`(?${vP(e,n,a.useFlagMods)}${l})`;return a.currentFlags=c,h},LookaroundAssertion({body:e,kind:t,negate:n},s,a){return`(?${`${t==="lookahead"?"":"<"}${n?"!":"="}`}${e.map(a).join("|")})`},Quantifier(e,t,n){return n(e.body)+bP(e)},Subroutine({isRecursive:e,ref:t},n){if(!e)throw new Error("Unexpected non-recursive subroutine in transformed AST");const s=n.recursionLimit;return t===0?`(?R=${s})`:Qe`\g<${t}&R=${s}>`}},pP=new Set(["$","(",")","*","+",".","?","[","\\","]","^","{","|","}"]),gP=new Set(["-","\\","]","^","["]),xP=new Set(["(",")","-","/","[","\\","]","^","{","|","}","!","#","$","%","&","*","+",",",".",":",";","<","=",">","?","@","`","~"]),g0=new Map([[9,Qe`\t`],[10,Qe`\n`],[11,Qe`\v`],[12,Qe`\f`],[13,Qe`\r`],[8232,Qe`\u2028`],[8233,Qe`\u2029`],[65279,Qe`\uFEFF`]]),_P=new RegExp("^\\p{Cased}$","u");function Vp(e){return _P.test(e)}function tC(e,t){const n=!!(t!=null&&t.firstOnly),s=e.min.value,a=e.max.value,o=[];if(s<65&&(a===65535||a>=131071)||s===65536&&a>=131071)return o;for(let c=s;c<=a;c++){const l=ln(c);if(!Vp(l))continue;const h=qw(l).filter(f=>{const p=f.codePointAt(0);return p<s||p>a});if(h.length&&(o.push(...h),n))break}return o}function ya(e,{escDigit:t,inCharClass:n,useFlagV:s}){if(g0.has(e))return g0.get(e);if(e<32||e>126&&e<160||e>262143||t&&SP(e))return e>255?`\\u{${e.toString(16).toUpperCase()}}`:`\\x${e.toString(16).toUpperCase().padStart(2,"0")}`;const a=n?s?xP:gP:pP,o=ln(e);return(a.has(o)?"\\":"")+o}function yP(e){const t=e.map(a=>a.codePointAt(0)).sort((a,o)=>a-o),n=[];let s=null;for(let a=0;a<t.length;a++)t[a+1]===t[a]+1?s??(s=t[a]):s===null?n.push(t[a]):(n.push([s,t[a]]),s=null);return n}function vP(e,t,n){if(e)return">";let s="";if(t&&n){const{enable:a,disable:o}=t;s=(a!=null&&a.ignoreCase?"i":"")+(a!=null&&a.dotAll?"s":"")+(o?"-":"")+(o!=null&&o.ignoreCase?"i":"")+(o!=null&&o.dotAll?"s":"")}return`${s}:`}function bP({kind:e,max:t,min:n}){let s;return!n&&t===1?s="?":!n&&t===1/0?s="*":n===1&&t===1/0?s="+":n===t?s=`{${n}}`:s=`{${n},${t===1/0?"":t}}`,s+{greedy:"",lazy:"?",possessive:"+"}[e]}function x0({type:e}){return e==="CapturingGroup"||e==="Group"||e==="LookaroundAssertion"}function SP(e){return e>47&&e<58}function _0({type:e,value:t}){return e==="Character"&&t===45}var Bs,as,vi,zs,bi,cl,Fm,Fs,wP=(Fs=class extends RegExp{constructor(n,s,a){var t=(...Ez)=>(super(...Ez),ci(this,cl),ci(this,Bs,new Map),ci(this,as,null),ci(this,vi),ci(this,zs,null),ci(this,bi,null),me(this,"rawOptions",{}),this);const o=!!(a!=null&&a.lazyCompile);if(n instanceof RegExp){if(a)throw new Error("Cannot provide options when copying a regexp");const c=n;t(c,s),xr(this,vi,c.source),c instanceof Fs&&(xr(this,Bs,Tn(c,Bs)),xr(this,zs,Tn(c,zs)),xr(this,bi,Tn(c,bi)),this.rawOptions=c.rawOptions)}else{const c={hiddenCaptures:[],strategy:null,transfers:[],...a};t(o?"":n,s),xr(this,vi,n),xr(this,Bs,kP(c.hiddenCaptures,c.transfers)),xr(this,bi,c.strategy),this.rawOptions=a??{}}o||xr(this,as,this)}get source(){return Tn(this,vi)||"(?:)"}exec(n){if(!Tn(this,as)){const{lazyCompile:o,...c}=this.rawOptions;xr(this,as,new Fs(Tn(this,vi),this.flags,c))}const s=this.global||this.sticky,a=this.lastIndex;if(Tn(this,bi)==="clip_search"&&s&&a){this.lastIndex=0;const o=df(this,cl,Fm).call(this,n.slice(a));return o&&(CP(o,a,n,this.hasIndices),this.lastIndex+=a),o}return df(this,cl,Fm).call(this,n)}},Bs=new WeakMap,as=new WeakMap,vi=new WeakMap,zs=new WeakMap,bi=new WeakMap,cl=new WeakSet,Fm=function(n){Tn(this,as).lastIndex=this.lastIndex;const s=Gy(Fs.prototype,this,"exec").call(Tn(this,as),n);if(this.lastIndex=Tn(this,as).lastIndex,!s||!Tn(this,Bs).size)return s;const a=[...s];s.length=1;let o;this.hasIndices&&(o=[...s.indices],s.indices.length=1);const c=[0];for(let l=1;l<a.length;l++){const{hidden:h,transferTo:f}=Tn(this,Bs).get(l)??{};if(h?c.push(null):(c.push(s.length),s.push(a[l]),this.hasIndices&&s.indices.push(o[l])),f&&a[l]!==void 0){const p=c[f];if(!p)throw new Error(`Invalid capture transfer to "${p}"`);if(s[p]=a[l],this.hasIndices&&(s.indices[p]=o[l]),s.groups){Tn(this,zs)||xr(this,zs,EP(this.source));const m=Tn(this,zs).get(f);m&&(s.groups[m]=a[l],this.hasIndices&&(s.indices.groups[m]=o[l]))}}}return s},Fs);function CP(e,t,n,s){if(e.index+=t,e.input=n,s){const a=e.indices;for(let c=0;c<a.length;c++){const l=a[c];l&&(a[c]=[l[0]+t,l[1]+t])}const o=a.groups;o&&Object.keys(o).forEach(c=>{const l=o[c];l&&(o[c]=[l[0]+t,l[1]+t])})}}function kP(e,t){const n=new Map;for(const s of e)n.set(s,{hidden:!0});for(const[s,a]of t)for(const o of a)ll(n,o,{}).transferTo=s;return n}function EP(e){const t=/(?<capture>\((?:\?<(?![=!])(?<name>[^>]+)>|(?!\?)))|\\?./gsu,n=new Map;let s=0,a=0,o;for(;o=t.exec(e);){const{0:c,groups:{capture:l,name:h}}=o;c==="["?s++:s?c==="]"&&s--:l&&(a++,h&&n.set(a,h))}return n}function jP(e,t){const n=TP(e,t);return n.options?new wP(n.pattern,n.flags,n.options):new RegExp(n.pattern,n.flags)}function TP(e,t){const n=Ww(t),s=Bw(e,{flags:n.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline},skipBackrefValidation:n.rules.allowOrphanBackrefs,unicodePropertyMap:Fp}),a=tP(s,{accuracy:n.accuracy,asciiWordBoundaries:n.rules.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,bestEffortTarget:n.target}),o=hP(a,n),c=VI(o.pattern,{captureTransfers:o._captureTransfers,hiddenCaptures:o._hiddenCaptures,mode:"external"}),l=UI(c.pattern),h=$I(l.pattern,{captureTransfers:c.captureTransfers,hiddenCaptures:c.hiddenCaptures}),f={pattern:h.pattern,flags:`${n.hasIndices?"d":""}${n.global?"g":""}${o.flags}${o.options.disable.v?"u":"v"}`};if(n.avoidSubclass){if(n.lazyCompileLength!==1/0)throw new Error("Lazy compilation requires subclass")}else{const p=h.hiddenCaptures.sort((w,k)=>w-k),m=Array.from(h.captureTransfers),_=a._strategy,y=f.pattern.length>=n.lazyCompileLength;(p.length||m.length||_||y)&&(f.options={...p.length&&{hiddenCaptures:p},...m.length&&{transfers:m},..._&&{strategy:_},...y&&{lazyCompile:y}})}return f}function nC(e,t){return jP(e,{global:!0,hasIndices:!0,lazyCompileLength:3e3,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...t})}function NP(e={}){const t={target:"auto",cache:new Map,...e};return t.regexConstructor||(t.regexConstructor=n=>nC(n,{target:t.target})),{createScanner(n){return new GM(n,t)},createString(n){return{content:n}}}}R1(Ep({bundledLanguages:()=>Np,bundledLanguagesAlias:()=>Tp,bundledLanguagesBase:()=>jp,bundledLanguagesInfo:()=>Pu,bundledThemes:()=>Dp,bundledThemesInfo:()=>Ap,codeToHast:()=>Ew,codeToHtml:()=>kw,codeToTokens:()=>jw,codeToTokensBase:()=>Tw,codeToTokensWithThemes:()=>Nw,createHighlighter:()=>Gu,createJavaScriptRegexEngine:()=>NP,createOnigurumaEngine:()=>I1,defaultJavaScriptRegexConstructor:()=>nC,getLastGrammarState:()=>Dw,getSingletonHighlighter:()=>Aw,loadWasm:()=>Rp}),VM);let sm=null;const AP=["typescript","javascript","tsx","jsx","python","bash","json","css","html","sql","yaml","markdown","diff","rust","go","java","c","cpp","ruby","toml","scss","graphql","docker","powershell"],DP=["github-dark-default","vitesse-light","monokai","dracula","nord"],LP={dark:"github-dark-default",light:"vitesse-light",monokai:"monokai",dracula:"dracula",nord:"nord"};function RP(){return{name:"line-numbers",line(e,t){e.properties["data-line"]=String(t+1)}}}async function OP(){return sm||(sm=Gu({themes:DP,langs:AP})),sm}async function rC(e,t,n="github-dark-default"){return(await OP()).codeToHtml(e,{lang:t,theme:n,transformers:[RP()]})}const MP={ts:"typescript",tsx:"tsx",js:"javascript",jsx:"jsx",py:"python",rb:"ruby",rs:"rust",go:"go",java:"java",c:"c",cpp:"cpp",h:"c",hpp:"cpp",cs:"csharp",php:"php",swift:"swift",kt:"kotlin",scala:"scala",sh:"bash",bash:"bash",zsh:"bash",fish:"bash",ps1:"powershell",sql:"sql",html:"html",htm:"html",css:"css",scss:"scss",sass:"sass",less:"less",json:"json",yaml:"yaml",yml:"yaml",xml:"xml",md:"markdown",markdown:"markdown",toml:"toml",ini:"ini",conf:"ini",dockerfile:"docker",makefile:"makefile",cmake:"cmake",graphql:"graphql",gql:"graphql",vue:"vue",svelte:"svelte"};function Xu(e){var a;if(!e)return"text";const t=e.split("/").pop()??"",n=t.toLowerCase();if(n==="dockerfile")return"docker";if(n==="makefile")return"makefile";if(n==="cmakelists.txt")return"cmake";const s=(a=t.split(".").pop())==null?void 0:a.toLowerCase();return s?MP[s]??"text":"text"}function sC(){const e=Jt(n=>n.currentPreset);return Jt(n=>n.isCustom)?"github-dark-default":LP[e]??"github-dark-default"}function iC(e=2e3){const[t,n]=O.useState(!1),s=O.useCallback(async a=>{try{if(navigator.clipboard&&window.isSecureContext)await navigator.clipboard.writeText(a);else{const o=document.createElement("textarea");o.value=a,o.style.position="fixed",o.style.left="-9999px",document.body.appendChild(o),o.select(),document.execCommand("copy"),document.body.removeChild(o)}n(!0),setTimeout(()=>n(!1),e)}catch(o){console.error("Failed to copy:",o)}},[e]);return{copied:t,copy:s}}function IP({language:e,codeString:t,showSyntaxHighlighting:n}){const{copied:s,copy:a}=iC(),[o,c]=O.useState(null),l=sC();return O.useEffect(()=>{if(!n)return;let h=!1;return rC(t,e,l).then(f=>{h||c(f)}),()=>{h=!0}},[t,e,l,n]),u.jsxs("div",{className:"relative group my-1.5 rounded overflow-hidden",children:[u.jsxs("div",{className:"absolute bottom-0 right-0 flex items-center gap-2 px-2 py-1 text-xs text-text-muted/70 bg-bg-tertiary/60 rounded-tl rounded-tr z-10",children:[u.jsx("span",{children:e}),u.jsx("button",{type:"button",onClick:h=>{h.preventDefault(),h.stopPropagation(),a(t)},className:"opacity-0 group-hover:opacity-100 transition-opacity hover:text-text-primary p-0.5",title:"Copy code",children:s?u.jsx(Mr,{}):u.jsx(Ym,{})})]}),n&&o?u.jsx("div",{className:"min-w-0",dangerouslySetInnerHTML:{__html:o}}):u.jsx("div",{className:"overflow-x-auto",children:u.jsx("pre",{className:"my-0 px-4 py-3 overflow-x-auto font-mono text-sm whitespace-pre-wrap break-word",children:u.jsx("code",{className:`language-${e}`,children:t})})})]})}function PP(e,t){const n=e?"text-text-muted":"text-sky-400",s=e?"text-text-secondary":"text-amber-400";return{code({className:a,children:o,...c}){const l=/language-(\w+)/.exec(a||"");if(!l&&!String(o).includes(`
274
+ `)){const m=e?"text-text-muted":"text-accent-secondary";return u.jsx("code",{className:`bg-bg-tertiary px-1 py-0.5 rounded ${m} font-mono text-xs`,...c,children:o})}const f=(l==null?void 0:l[1])||"text",p=String(o).replace(/\n$/,"");return u.jsx(IP,{language:f,codeString:p,showSyntaxHighlighting:t})},p({children:a}){const o=e?"text-text-muted":"text-text-primary";return u.jsx("p",{className:`${o} mb-1.5 last:mb-0 leading-tight`,children:a})},ul({children:a}){return u.jsx("ul",{className:"list-disc list-inside mb-1.5 space-y-0.5",children:a})},ol({children:a}){return u.jsx("ol",{className:"list-decimal list-inside mb-1.5 space-y-0.5",children:a})},li({children:a}){const o=e?"text-text-muted":"text-text-primary";return u.jsx("li",{className:`${o} text-sm list-item`,children:a})},h1({children:a}){return u.jsx("h1",{className:`text-base font-bold mb-1.5 mt-2 first:mt-0 ${n}`,children:a})},h2({children:a}){return u.jsx("h2",{className:`text-sm font-bold mb-1.5 mt-2 first:mt-0 ${n}`,children:a})},h3({children:a}){return u.jsx("h3",{className:`text-sm font-bold mb-1.5 mt-1.5 first:mt-0 ${n}`,children:a})},h4({children:a}){return u.jsx("h4",{className:`text-sm font-bold mb-1.5 mt-1.5 first:mt-0 ${n}`,children:a})},strong({children:a}){return u.jsx("strong",{className:`font-bold ${s}`,children:a})},em({children:a}){return u.jsx("em",{className:e?"italic text-text-secondary":"italic",children:a})},a({href:a,children:o}){return u.jsx("a",{href:a,className:"text-accent-primary hover:underline text-sm",target:"_blank",rel:"noopener noreferrer",children:o})},blockquote({children:a}){const o=e?"text-text-muted":"text-text-secondary";return u.jsx("blockquote",{className:`border-l-2 border-accent-primary pl-2 my-1.5 ${o} italic text-sm`,children:a})},table({children:a}){return u.jsx("div",{className:"overflow-x-auto my-1.5",children:u.jsx("table",{className:"min-w-full border border-border",children:a})})},th({children:a}){return u.jsx("th",{className:"border border-border bg-bg-tertiary px-2 py-1 text-left font-semibold text-sm",children:a})},td({children:a}){return u.jsx("td",{className:"border border-border px-2 py-1 text-sm",children:a})},hr(){return u.jsx("hr",{className:"border-border my-2"})},input({checked:a,...o}){return u.jsx("input",{type:"checkbox",checked:a,disabled:!0,className:"mr-1.5 w-3.5 h-3.5",...o})}}}const cs=O.memo(function({content:t,className:n="",muted:s=!1}){const{showSyntaxHighlighting:a}=wu(),o=O.useMemo(()=>{let l=BP(t);return l=zP(l),l},[t]),c=O.useMemo(()=>PP(s,a),[s,a]);return u.jsx("div",{className:`markdown-content [&_li>p]:inline ${n}`,children:u.jsx(lR,{remarkPlugins:[b5],components:c,children:o})})});function BP(e){let t=e.replace(/^(\s*)•\s/gm,"$1- ");return t=t.replace(/^(\d+)\.\s*\n(?=\S)/gm,"$1. "),t=t.replace(/^\|\s*$/gm,""),t=t.replace(/^\d+:\s/gm,""),t}function zP(e){const t=/```/g,n=e.match(t);if(((n==null?void 0:n.length)??0)%2===1){const a=e.lastIndexOf("```");return e.slice(a+3).includes(`
275
+ `),e+"\n```"}return e}const HP=O.memo(function({content:t,variant:n="default"}){return n==="labeled"?u.jsxs("div",{className:"text-text-muted text-sm italic feed-item",children:[u.jsx("span",{className:"text-purple-400",children:"thinking:"}),u.jsx("div",{className:"ml-1.5 mt-0.5",children:u.jsx(cs,{content:t})})]}):u.jsx("div",{className:"text-text-muted text-sm italic bg-secondary rounded p-1.5 feed-item",children:u.jsx(cs,{content:t,muted:!0})})});function aC({tool:e,className:t="w-4 h-4 text-text-muted flex-shrink-0"}){return e==="glob"||e==="grep"?u.jsx("svg",{className:t,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}):e==="run_command"||e==="bash"?u.jsx("svg",{className:t,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})}):u.jsx("svg",{className:t,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})})}const Ma=O.memo(function({code:t,language:n,variant:s,showLineNumbers:a=!1,startLine:o=1}){const[c,l]=O.useState(null),h=sC();if(O.useEffect(()=>{let p=!1;return rC(t,n,h).then(m=>{p||l(m)}),()=>{p=!0}},[t,n,h]),!c){const p=s==="inline"?"span":s==="block-nowrap"?"div":"pre";return u.jsx(p,{className:"language-",children:u.jsx("code",{className:"language-",children:t})})}if(s==="inline")return u.jsx("span",{dangerouslySetInnerHTML:{__html:c}});const f=a?"":"shiki-plain";return u.jsx("div",{className:f,style:{"--shiki-start":o},dangerouslySetInnerHTML:{__html:c}})});function oC({src:e,alt:t,isOpen:n,onClose:s}){return n?u.jsx(Nt,{isOpen:n,onClose:s,title:"",size:"full",children:u.jsx("div",{className:"flex items-center justify-center h-full",children:u.jsx("img",{src:e,alt:t,className:"max-w-full max-h-[80vh] object-contain rounded-lg shadow-2xl"})})}):null}const _u=O.memo(function({type:t,children:n}){const s=t==="removed"?"diff-removed-bg diff-removed-border":"diff-added-bg diff-added-border",a=t==="removed"?"line-through decoration-red-400/30":"";return u.jsx("div",{className:`border-l-[3px] ${s}`,children:u.jsx("div",{className:`min-w-0 py-1 ${a}`,children:u.jsx("div",{className:"shiki-compact shiki-transparent-bg",children:n})})})}),$P=O.memo(function({oldString:t,newString:n,filePath:s}){const a=O.useMemo(()=>Xu(s),[s]),o=t.length>0,c=n.length>0;return!o&&!c?u.jsx("div",{className:"text-xs text-text-muted italic p-2",children:"No changes"}):u.jsxs("div",{className:"rounded overflow-hidden border border-border",children:[o&&u.jsx(_u,{type:"removed",children:u.jsx(Ma,{code:t,language:a,variant:"block",showLineNumbers:!0})}),c&&u.jsx(_u,{type:"added",children:u.jsx(Ma,{code:n,language:a,variant:"block",showLineNumbers:!0})})]})}),UP=O.memo(function({content:t,filePath:n}){const s=O.useMemo(()=>Xu(n),[n]);return u.jsx("div",{className:"rounded overflow-hidden border border-border max-h-[45vh] overflow-y-auto",children:u.jsx(_u,{type:"added",children:u.jsx(Ma,{code:t,language:s,variant:"block",showLineNumbers:!0})})})}),FP=O.memo(function({regions:t,filePath:n}){const s=O.useMemo(()=>Xu(n),[n]);return t.length===0?u.jsx("div",{className:"text-xs text-text-muted italic p-2",children:"No changes"}):u.jsx("div",{className:"space-y-2",children:t.map((a,o)=>u.jsx(GP,{region:a,language:s},o))})});function VP(e){const t=[];function n(s,a,o){const c=t[t.length-1];c&&c.type===s&&c.startLine+c.lines.length===a?c.lines.push(o):t.push({type:s,startLine:a,lines:[o]})}for(const s of e.beforeContext)n("context",s.lineNumber,s.content);for(const s of e.edits){const a=s.oldContent.split(`
276
+ `);for(let c=0;c<a.length;c++)n("removed",s.startLine+c,a[c]);const o=s.newContent.split(`
277
+ `);for(let c=0;c<o.length;c++)n("added",s.startLine+c,o[c])}for(const s of e.afterContext)n("context",s.lineNumber,s.content);return t}const GP=O.memo(function({region:t,language:n}){const s=VP(t);return u.jsx("div",{className:"rounded overflow-hidden border border-border font-mono text-sm",children:s.map((a,o)=>u.jsx(WP,{section:a,language:n},o))})}),WP=O.memo(function({section:t,language:n}){const s=t.lines.join(`
278
+ `);return t.type==="context"?u.jsx("div",{children:u.jsx("div",{className:"min-w-0 py-1",children:u.jsx("div",{className:"shiki-compact shiki-transparent-bg",children:u.jsx(Ma,{code:s,language:n,variant:"block",showLineNumbers:!0,startLine:t.startLine})})})}):u.jsx(_u,{type:t.type,children:u.jsx(Ma,{code:s,language:n,variant:"block",showLineNumbers:!0,startLine:t.startLine})})});function y0(e){return e.split(`
279
+ `).filter(t=>!t.startsWith(`
280
+ [`)&&!t.startsWith("[")).map(t=>t.replace(/^\d+: /,"")).join(`
281
+ `)}const qP=O.memo(function({result:t,metadata:n,filePath:s,heightExpanded:a=!1}){const[o,c]=O.useState(!1),l=O.useMemo(()=>Xu(s),[s]),h=n==null?void 0:n.mimeType,f=n==null?void 0:n.base64Data;if(h!=null&&h.startsWith("image/")&&f){const k=`data:${h};base64,${f}`;return u.jsxs(u.Fragment,{children:[u.jsx("div",{className:`rounded overflow-hidden border border-border ${a?"":"max-h-[45vh]"} flex items-center justify-center cursor-pointer hover:border-accent-primary transition-colors`,onClick:()=>c(!0),children:u.jsx("img",{src:k,alt:s,className:"max-w-full max-h-[45vh] object-contain"})}),u.jsx(oC,{src:k,alt:s,isOpen:o,onClose:()=>c(!1)})]})}if(!t)return u.jsx("div",{className:"text-xs text-text-muted italic p-2",children:"Empty file"});const p=t;if(l==="markdown"){const k=y0(p);return u.jsx("div",{className:`rounded overflow-hidden border border-border ${a?"":"max-h-[45vh]"} overflow-y-auto p-2`,children:u.jsx(cs,{content:k})})}const m=y0(p),_=p.split(`
282
+ `)[0],y=_==null?void 0:_.match(/^(\d+): /),w=y?parseInt(y[1],10):1;return u.jsx("div",{className:`rounded overflow-hidden border border-border ${a?"":"max-h-[45vh]"} overflow-y-auto`,children:u.jsx(Ma,{code:m,language:l,variant:"block",showLineNumbers:!0,startLine:w})})}),KP={error:{icon:"✗",color:"text-accent-error",bg:"bg-red-500/10",border:"border-red-500/30"},warning:{icon:"⚠",color:"text-accent-warning",bg:"bg-yellow-500/10",border:"border-yellow-500/30"},info:{icon:"ℹ",color:"text-accent-info",bg:"bg-blue-500/10",border:"border-blue-500/30"},hint:{icon:"💡",color:"text-text-muted",bg:"bg-gray-500/10",border:"border-gray-500/30"}},v0=O.memo(function({diagnostics:t}){if(t.length===0)return null;const n=t.filter(o=>o.severity==="error"),s=t.filter(o=>o.severity==="warning"),a=t.filter(o=>o.severity==="info"||o.severity==="hint");return u.jsxs("div",{className:"rounded border border-border overflow-hidden mt-2",children:[u.jsxs("div",{className:"flex items-center gap-3 px-2 py-1.5 bg-bg-tertiary border-b border-border",children:[u.jsx("span",{className:"text-xs font-medium text-text-secondary",children:"LSP Diagnostics"}),n.length>0&&u.jsxs("span",{className:"text-xs text-accent-error font-medium",children:[n.length," error",n.length!==1?"s":""]}),s.length>0&&u.jsxs("span",{className:"text-xs text-accent-warning font-medium",children:[s.length," warning",s.length!==1?"s":""]}),a.length>0&&u.jsxs("span",{className:"text-xs text-text-muted",children:[a.length," info"]})]}),u.jsx("div",{className:"max-h-48 overflow-y-auto",children:t.map((o,c)=>{const l=KP[o.severity];return u.jsxs("div",{className:`flex items-start gap-2 px-2 py-1.5 ${l.bg} border-b border-border last:border-b-0`,children:[u.jsx("span",{className:`${l.color} text-xs flex-shrink-0 w-4 text-center`,children:l.icon}),u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsxs("span",{className:"text-[10px] text-text-muted font-mono",children:["Ln ",o.range.start.line+1,":",o.range.start.character+1]}),o.code&&u.jsxs("span",{className:"text-[10px] text-text-muted font-mono",children:["[",o.code,"]"]})]}),u.jsx("div",{className:"text-xs text-text-primary break-words",children:o.message})]})]},c)})})]})}),YP=O.memo(function({command:t,timeout:n,startedAt:s,streamingOutput:a,status:o,result:c,error:l,durationMs:h}){const f=O.useRef(null),[p,m]=O.useState(0);O.useEffect(()=>{f.current&&o==="pending"&&(f.current.scrollTop=f.current.scrollHeight)},[a,o]),O.useEffect(()=>{if(o!=="pending"||!s)return;const k=setInterval(()=>{m(Date.now()-s)},100);return()=>clearInterval(k)},[o,s]);const _=n/1e3,y=o==="pending"?p/1e3:(h??0)/1e3,w=o==="pending"?(a==null?void 0:a.map(k=>k.content).join(""))??"":c??"";return u.jsxs("div",{className:"space-y-2",children:[u.jsxs("div",{className:"flex items-center justify-between gap-4",children:[u.jsxs("div",{className:"flex items-center gap-2 text-xs flex-1 min-w-0",children:[u.jsx("span",{className:"text-text-muted flex-shrink-0",children:"$"}),u.jsx("code",{className:"text-text-primary break-all",children:t})]}),u.jsxs("div",{className:"flex items-center gap-2 text-xs text-text-muted flex-shrink-0",children:[o==="pending"&&u.jsx("span",{className:"animate-pulse text-accent-warning",children:"running"}),o==="interrupted"&&u.jsx("span",{className:"text-red-400",children:"interrupted"}),u.jsxs("span",{className:o==="pending"?"text-text-secondary":"text-text-muted",children:[y.toFixed(1),"s / ",_,"s"]})]})]}),o==="pending"&&u.jsx("div",{className:"h-1 bg-bg-tertiary rounded overflow-hidden",children:u.jsx("div",{className:"h-full bg-accent-warning transition-all duration-100",style:{width:`${Math.min(100,p/n*100)}%`}})}),(w||o==="pending")&&u.jsx("pre",{ref:f,className:`text-xs bg-bg-primary p-2 rounded max-h-64 overflow-y-auto ${o==="pending"?"border border-accent-warning/30":""}`,style:{overflowX:"hidden",whiteSpace:"normal"},children:o==="pending"&&a?a.map((k,v)=>u.jsx("span",{className:k.stream==="stderr"?"text-accent-warning":"",children:nu(k.content)},v)):nu(w)}),o==="error"&&l&&u.jsx("div",{className:"text-xs text-accent-error bg-accent-error/10 p-2 rounded",children:l}),o!=="pending"&&h!==void 0&&u.jsxs("div",{className:"text-[10px] text-text-muted",children:["Completed in ",(h/1e3).toFixed(2),"s"]})]})});function XP(e){switch(e){case"sensitive_file":return{title:"Sensitive File Access",description:"Accessing files that may contain secrets"};case"both":return{title:"Sensitive File Access",description:"Accessing sensitive files outside project"};case"dangerous_command":return{title:"Dangerous Command",description:"Running potentially dangerous command"};case"git_no_verify":return{title:"Git --no-verify",description:"Bypassing git hooks/pre-commit checks"};case"outside_workdir":default:return{title:"Path Access Request",description:"Accessing paths outside project directory"}}}function QP({confirmation:e}){const t=Ce(m=>m.confirmPath),n=Ce(m=>m.currentSession),s=Ce(m=>m.switchDangerLevel),{title:a,description:o}=XP(e.reason),c=e.reason==="sensitive_file"||e.reason==="both",l=c?"border-red-500/50":"border-amber-500/50",h=c?"bg-red-500/10":"bg-amber-500/10",f=e.reason==="git_no_verify",p=()=>{n!=null&&n.id&&s("dangerous"),t(e.callId,!0,!1)};return u.jsxs("div",{className:`border ${l} ${h} rounded p-3 my-2`,children:[u.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[u.jsx(um,{}),u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsx("div",{className:`text-sm font-medium ${c?"text-red-400":"text-amber-400"}`,children:a}),u.jsx("div",{className:"text-xs text-text-muted",children:o})]})]}),u.jsxs("div",{className:"text-xs text-text-muted mb-2",children:[u.jsx("span",{className:"font-medium",children:e.tool})," wants to access:"]}),u.jsx("div",{className:"bg-bg-primary rounded p-2 mb-3 max-h-24 overflow-y-auto",children:u.jsx("ul",{className:"space-y-0.5",children:e.paths.map((m,_)=>u.jsx("li",{className:`text-xs font-mono ${c?"text-red-300":"text-amber-300"} break-all`,children:m},_))})}),u.jsxs("div",{className:"flex gap-2",children:[u.jsx("button",{onClick:()=>t(e.callId,!1),className:"flex-1 px-3 py-1.5 text-xs font-medium rounded bg-bg-tertiary hover:bg-bg-tertiary/80 text-text-secondary border border-border transition-colors",children:"Deny"}),u.jsx("button",{onClick:()=>t(e.callId,!0,!1),className:"flex-1 px-3 py-1.5 text-xs font-medium rounded bg-accent-primary hover:bg-accent-primary/80 text-text-primary transition-colors",children:"Allow"}),u.jsx("button",{onClick:p,className:`flex-1 px-3 py-1.5 text-xs font-medium rounded transition-colors ${f?"hidden":"bg-red-600 hover:bg-red-700 text-white"}`,title:"Enable dangerous mode and allow this request",children:"Allow Everything"})]})]})}function JP(e,t){if(e==="read_file"){const s=String(t.path??""),a=t.offset,o=t.limit,c=[];return a!==void 0&&a!==1&&c.push(`offset=${a}`),o!==void 0&&c.push(`limit=${o}`),c.length>0?`${s} [${c.join(", ")}]`:s}if(e==="write_file"||e==="edit_file")return String(t.path??"");if(e==="run_command"||e==="bash")return String(t.command??"");if(e==="return_value"){const s=String(t.content??"");return s.length>60?s.slice(0,60)+"...":s}const n=JSON.stringify(t);return n.length>50?n.slice(0,50)+"...":n}function b0(e,t,n){return JP(e,t)}function ZP(e){return JSON.stringify(e,null,2)}const e6={pending:{icon:"●",color:"text-accent-warning",animate:!0},success:{icon:"✓",color:"text-accent-success",animate:!1},error:{icon:"✗",color:"text-accent-error",animate:!1},interrupted:{icon:"✗",color:"text-red-400",animate:!1}},t6=O.memo(function({tool:t,args:n,status:s,variant:a="compact",forceCompact:o,result:c,error:l,durationMs:h,diagnostics:f,editContext:p,startedAt:m,streamingOutput:_,metadata:y,callId:w}){const k=t==="edit_file"||t==="write_file",v=t==="run_command"&&s==="pending",b=t==="read_file",S=o?!1:k||v||t==="return_value",[j,N]=O.useState(S),T=e6[s],D=Ce(B=>B.pendingPathConfirmations),A=s==="pending"&&w?D.find(B=>B.callId===w)??null:null;return a==="compact"?u.jsxs("div",{className:"flex items-center gap-1.5 text-xs bg-secondary rounded px-2 py-1.5",children:[u.jsx(aC,{tool:t}),u.jsx("span",{className:"text-accent-primary font-medium",children:t}),u.jsx("span",{className:"text-text-muted truncate flex-1",children:b0(t,n)}),u.jsx("span",{className:`${T.color} ${T.animate?"animate-pulse":""}`,children:s==="pending"?"...":"done"})]}):u.jsxs("div",{className:"border border-border rounded overflow-hidden my-1 min-w-0",children:[u.jsxs("button",{className:"w-full flex items-center gap-1.5 p-2 bg-secondary hover:bg-secondary/80 text-left",onClick:()=>N(!j),children:[u.jsx("span",{className:`${T.color} ${T.animate?"animate-pulse":""}`,children:T.icon}),u.jsx("span",{className:"font-mono text-accent-primary text-sm",children:t}),u.jsx("span",{className:"text-text-muted text-xs flex-1 truncate",children:b0(t,n)}),u.jsx("span",{className:"text-text-muted text-xs",children:j?"▼":"▶"})]}),A&&u.jsx(QP,{confirmation:A}),(j||b)&&u.jsxs("div",{className:"p-2 bg-primary border-t border-border space-y-2 min-w-0",children:[t==="run_command"&&u.jsx(YP,{command:String(n.command??""),timeout:n.timeout??12e4,startedAt:m,streamingOutput:_,status:s,result:c,error:l,durationMs:h}),t==="edit_file"&&s==="success"&&u.jsxs(u.Fragment,{children:[p&&p.regions.length>0?u.jsx(FP,{regions:p.regions,filePath:String(n.path??"")}):u.jsx($P,{oldString:String(n.old_string??""),newString:String(n.new_string??""),filePath:String(n.path??"")}),f&&f.length>0&&u.jsx(v0,{diagnostics:f})]}),t==="write_file"&&s==="success"&&u.jsxs(u.Fragment,{children:[u.jsx(UP,{content:String(n.content??""),filePath:String(n.path??"")}),f&&f.length>0&&u.jsx(v0,{diagnostics:f})]}),t==="read_file"&&s==="success"&&u.jsx(qP,{result:c,metadata:y,filePath:String(n.path??""),heightExpanded:j}),t==="return_value"&&(()=>{const B=(_==null?void 0:_.map($=>$.content).join(""))??"",R=s==="pending"&&B?B:String(n.content??"");return u.jsxs("div",{children:[u.jsx("div",{className:"text-[10px] text-accent-primary font-medium mb-1 uppercase tracking-wide",children:"Sub-Agent Summary"}),u.jsx("div",{className:"text-xs prose prose-invert prose-sm max-w-none",children:u.jsx(cs,{content:R})})]})})(),t!=="edit_file"&&t!=="write_file"&&t!=="run_command"&&t!=="read_file"&&t!=="return_value"&&u.jsxs(u.Fragment,{children:[u.jsxs("div",{children:[u.jsx("div",{className:"text-[10px] text-text-muted mb-0.5",children:"Arguments:"}),u.jsx("pre",{className:"text-xs bg-bg-primary p-1.5 rounded overflow-x-auto",children:ZP(n)})]}),s==="success"&&c!==void 0&&u.jsxs("div",{children:[u.jsxs("div",{className:"text-[10px] text-text-muted mb-0.5",children:["Result",h!==void 0&&` (${h}ms)`,":"]}),u.jsx("pre",{className:"text-xs bg-bg-primary p-1.5 rounded overflow-x-auto max-h-32",children:c||"No output"})]})]}),s==="success"&&(t==="edit_file"||t==="write_file"||t==="read_file")&&h!==void 0&&u.jsxs("div",{className:"text-[10px] text-text-muted",children:["Completed in ",h,"ms"]}),s==="error"&&l&&t!=="run_command"&&u.jsxs("div",{children:[u.jsx("div",{className:"text-[10px] text-accent-error mb-0.5",children:"Error:"}),u.jsx("pre",{className:"text-xs bg-bg-primary p-1.5 rounded text-accent-error",children:l})]})]})]})}),n6={read_file:"Reading file",write_file:"Writing file",edit_file:"Editing file",run_command:"Running command",glob:"Searching files",grep:"Searching content",ask_user:"Asking user",criterion:"Managing criterion",todo_write:"Updating tasks"};function r6(e){return n6[e]??`Preparing ${e}`}function s6(e){try{const t=e.replace(/\s*\}\s*$/,""),n=JSON.parse(t);if(typeof n.command=="string")return n.command}catch{const t=e.match(/"command"\s*:\s*"([^"]*)/);if(t&&t[1])return t[1]}return null}const i6=O.memo(function({name:t,arguments:n}){let a=r6(t)+"...";if(t==="run_command"&&n){const o=s6(n);o&&(a=o)}return u.jsx("div",{className:"border border-border rounded overflow-hidden my-1 min-w-0 animate-pulse",children:u.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-bg-tertiary",children:[u.jsx("span",{className:"text-accent-warning animate-pulse",children:"..."}),u.jsx(aC,{tool:t}),u.jsx("span",{className:"font-mono text-accent-primary text-sm",children:t}),t==="run_command"&&n?u.jsx("code",{className:"text-text-muted text-xs flex-1 truncate",children:a}):u.jsx("span",{className:"text-text-muted text-xs flex-1",children:a})]})})}),a6={pending:{icon:"○",color:"text-text-muted"},in_progress:{icon:"●",color:"text-accent-warning",animate:!0},completed:{icon:"✓",color:"text-accent-success"}},o6=O.memo(function({todos:t}){return Array.isArray(t)?t.length===0?u.jsx("div",{className:"text-xs text-text-muted italic my-1",children:"No tasks"}):u.jsxs("div",{className:"my-1 rounded border border-border bg-bg-tertiary overflow-hidden",children:[u.jsx("div",{className:"px-2 py-1.5 border-b border-border bg-bg-secondary",children:u.jsx("span",{className:"text-xs font-medium text-text-muted",children:"Tasks"})}),u.jsx("div",{children:t.map((n,s)=>{const a=a6[n.status];return u.jsxs("div",{className:`flex items-start gap-2 px-2 py-1.5 ${s>0?"border-t border-border":""}`,children:[u.jsx("span",{className:`${(a==null?void 0:a.color)??"text-text-muted"} ${a!=null&&a.animate?"animate-pulse":""} text-sm leading-tight`,children:(a==null?void 0:a.icon)??"○"}),u.jsx("span",{className:`text-sm leading-tight ${n.status==="completed"?"text-text-muted":"text-text-primary"}`,children:n.content})]},s)})})]}):u.jsx("div",{className:"text-xs text-accent-warning italic my-1",children:"⚠️ Invalid todos data"})}),S0={add:{icon:"○",color:"text-text-muted"},update:{icon:"○",color:"text-text-muted"},remove:{icon:"○",color:"text-text-muted"},complete:{icon:"◉",color:"text-purple-400"},pass:{icon:"✓",color:"text-accent-success"},fail:{icon:"✗",color:"text-accent-error"},get:{icon:"○",color:"text-text-muted"}},lC=O.memo(function({toolCalls:t,criteria:n}){if(t.length===0)return null;const s=new Map((n==null?void 0:n.map(o=>[o.id,o]))??[]),a=t.find(o=>{var c,l;return o.arguments.action==="get"&&((c=o.result)==null?void 0:c.success)&&((l=o.result)==null?void 0:l.output)});return u.jsxs("div",{className:"my-1 rounded border border-border bg-secondary overflow-hidden",children:[u.jsx("div",{className:"px-2 py-1.5 border-b border-border bg-secondary",children:u.jsx("span",{className:"text-xs font-medium text-text-muted",children:"Acceptance Criteria"})}),u.jsx("div",{className:"bg-primary",children:a?(()=>{const o=a.result.output;if(o==="No criteria defined yet.")return u.jsxs("div",{className:"flex items-start gap-2 px-2 py-1.5",children:[u.jsx("span",{className:"text-text-muted text-sm leading-tight flex-shrink-0",children:"○"}),u.jsx("div",{className:"flex-1 min-w-0 text-text-muted text-sm",children:"No criteria defined yet."})]});try{return JSON.parse(o).map((l,h)=>u.jsxs("div",{className:`flex items-start gap-2 px-2 py-1.5 ${h>0?"border-t border-border":""}`,children:[u.jsx("span",{className:"text-text-muted text-sm leading-tight flex-shrink-0",children:"○"}),u.jsx("div",{className:"flex-1 min-w-0",children:u.jsx(cs,{content:`[${l.id}] ${l.description}`})})]},l.id??h))}catch{return t.map((c,l)=>u.jsx(w0,{tc:c,index:l,criteriaMap:s},c.id??l))}})():t.map((o,c)=>u.jsx(w0,{tc:o,index:c,criteriaMap:s},o.id??c))})]})});function w0({tc:e,index:t,criteriaMap:n}){const s=e.arguments.action,a=s&&S0[s]?S0[s]:{icon:"○",color:"text-text-muted"},o=e.arguments,c=s==="remove",l=o.id,h=o.description,f=l?n.get(l):void 0,p=h??(f==null?void 0:f.description)??(c&&l?`[${l}]`:"Criterion updated"),m=o.reason,_=s==="fail";return u.jsxs("div",{className:`flex items-start gap-2 px-2 py-1.5 ${t>0?"border-t border-border":""}`,children:[u.jsx("span",{className:`${a.color} text-sm leading-tight flex-shrink-0`,children:a.icon}),u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsx("div",{className:c?"line-through text-text-muted":"",children:u.jsx(cs,{content:p})}),m&&u.jsxs("div",{className:`mt-1 text-sm ${_?"text-accent-error":"text-text-muted"}`,children:[u.jsx("span",{className:"text-text-muted",children:"└ "}),'"',m,'"']})]})]})}function l6(e){return e==="criterion"}const c6="#6b7280";function yu(e,t){var n;return((n=e.find(s=>s.id===t))==null?void 0:n.color)??c6}const Ot=Jn(e=>{const t=async()=>{await np("/api/agents",e,!0)};return{defaults:[],userItems:[],projectItems:[],loading:!1,fetchAgents:t,fetchAgent:async n=>{try{const s=await je(`/api/agents/${n}`);return s.ok?await s.json():null}catch{return null}},fetchDefaultContent:async n=>{try{const s=await je(`/api/agents/defaults/${n}`);return s.ok?await s.json():null}catch{return null}},createAgent:async(n,s)=>{const a=await Vs("POST","/api/agents",{...n,destination:s});return a.success&&await t(),a},updateAgent:async(n,s)=>{const a=await Vs("PUT",`/api/agents/${n}`,s);return a.success&&await t(),a},deleteAgent:async n=>{try{const s=await je(`/api/agents/${n}`,{method:"DELETE"}),a=await s.json();return s.ok?(e(o=>({userItems:o.userItems.filter(c=>c.id!==n)})),{success:!0}):{success:!1,error:a.error??"Failed to delete"}}catch{return{success:!1,error:"Network error"}}},duplicateAgent:async(n,s)=>ku(`/api/agents/${n}/duplicate`,t,s)}});function u6(e){const t=[];let n=[];const s=()=>{n.length>0&&(t.push({type:"criteria_group",toolCalls:n}),n=[])};for(const a of e)a.type==="tool_call"&&l6(a.toolCall.name)?n.push(a.toolCall):(s(),t.push(a));return s(),t}function d6(e,t){if(e.segments&&e.segments.length>0)return h6(e.segments,e.toolCalls??[],e.preparingToolCalls??[],e.stats,t);const n=[];if(e.thinkingContent&&n.push({type:"thinking",content:e.thinkingContent}),e.content&&n.push({type:"text",content:e.content}),e.toolCalls)for(const s of e.toolCalls)n.push({type:"tool_call",toolCall:s});if(e.preparingToolCalls)for(const s of e.preparingToolCalls)n.push({type:"preparing_tool_call",preparing:s});return t&&e.stats&&n.push({type:"stats",stats:e.stats}),n}function h6(e,t,n,s,a){const o=[],c=new Map(t.map(l=>[l.id,l]));for(const l of e)switch(l.type){case"text":o.push({type:"text",content:l.content});break;case"thinking":l.content&&l.content.trim().length>0&&o.push({type:"thinking",content:l.content});break;case"tool_call":{const h=c.get(l.toolCallId);h&&o.push({type:"tool_call",toolCall:h});break}}for(const l of n)o.push({type:"preparing_tool_call",preparing:l});return a&&s&&o.push({type:"stats",stats:s}),o}const Gp=O.memo(function({message:t,showStats:n=!0,showThinking:s=!0,showVerboseToolOutput:a=!0}){const o=Ce(_=>{var y;return(y=_.currentSession)==null?void 0:y.criteria}),c=Ot(_=>_.defaults),l=Ot(_=>_.userItems),h=[...c,...l],f=d6(t,n),p=s?f:f.filter(_=>_.type!=="thinking"),m=u6(p);return m.length===0?null:u.jsx("div",{className:"feed-item",children:u.jsxs("div",{className:"min-w-0",children:[m.map((_,y)=>{var w,k;switch(_.type){case"thinking":return u.jsx(HP,{content:_.content},y);case"text":return u.jsx("div",{className:"prose prose-sm prose-invert max-w-none",children:u.jsx(cs,{content:_.content})},y);case"preparing_tool_call":return u.jsx(i6,{name:_.preparing.name,arguments:_.preparing.arguments},`preparing-${_.preparing.index}`);case"tool_call":{const v=_.toolCall,b=v.result;if(v.name==="todo_write"){const j=v.arguments.todos,N=Array.isArray(j)?j:[];return u.jsx(o6,{todos:N},y)}const x=(w=b==null?void 0:b.output)==null?void 0:w.includes("[interrupted by user]"),S=b?x?"interrupted":b.success?"success":"error":"pending";return u.jsx(t6,{tool:v.name,args:v.arguments,status:S,variant:"expandable",forceCompact:!a,result:b==null?void 0:b.output,error:b==null?void 0:b.error,durationMs:b==null?void 0:b.durationMs,diagnostics:b==null?void 0:b.diagnostics,editContext:b==null?void 0:b.editContext,startedAt:v.startedAt,streamingOutput:v.streamingOutput,metadata:b==null?void 0:b.metadata,callId:v.id},y)}case"criteria_group":return u.jsx(lC,{toolCalls:_.toolCalls,criteria:o},y);case"stats":{const v=_.stats;if(!v||"error"in v)return null;const b=((k=v.model.split("/").pop())==null?void 0:k.split("-").slice(0,2).join("-"))??v.model,x=yu(h,v.mode),S=N=>N>=1e3?`${(N/1e3).toFixed(1)}k`:N.toString(),j=N=>N>=1e3?`${(N/1e3).toFixed(1)}k`:N.toFixed(1);return u.jsxs("div",{className:"flex items-center justify-center gap-1.5 text-[10px] text-text-muted mt-3",children:[u.jsx("span",{className:"flex-1 h-px bg-border"}),u.jsx("span",{className:"text-text-secondary",children:b}),u.jsx("span",{className:"text-text-muted",children:"·"}),u.jsx("span",{style:{color:x},children:v.mode}),u.jsx("span",{className:"text-text-muted",children:"·"}),u.jsxs("span",{children:[v.totalTime.toFixed(1),"s"]}),v.toolTime>0&&u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"text-text-muted",children:"·"}),u.jsxs("span",{children:[v.toolTime.toFixed(1),"s tools"]})]}),u.jsx("span",{className:"text-text-muted",children:"·"}),u.jsxs("span",{children:[S(v.prefillTokens)," @ ",j(v.prefillSpeed)," pp"]}),u.jsx("span",{className:"text-text-muted",children:"·"}),u.jsxs("span",{children:[S(v.generationTokens)," @ ",j(v.generationSpeed)," tg"]}),u.jsx("span",{className:"text-text-muted",children:"·"}),u.jsx("button",{type:"button",className:"text-text-muted hover:text-text-secondary transition-colors",title:"View detailed stats",onClick:()=>{const N=new CustomEvent("open-turn-stats",{detail:{stats:v}});window.dispatchEvent(N)},children:u.jsx(rj,{className:"w-3 h-3"})}),u.jsx("span",{className:"flex-1 h-px bg-border"})]},y)}}}),t.partial&&u.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] text-accent-warning mt-1",children:[u.jsx(um,{}),u.jsx("span",{children:"Aborted"})]}),t.completeReason==="truncated"&&u.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] text-amber-400/80 mt-1",children:[u.jsx(um,{}),u.jsx("span",{children:"Response was truncated — the model ran out of output tokens."})]})]})})});function vu(e,t){const n=parseInt(e.slice(1,3),16),s=parseInt(e.slice(3,5),16),a=parseInt(e.slice(5,7),16);return`rgba(${n},${s},${a},${t})`}function f6(e){if(e<60)return`${e}s`;const t=Math.floor(e/60),n=Math.round(e%60);return n>0?`${t}m ${n}s`:`${t}m`}function m6(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}const p6=O.memo(function({data:t}){var c;const n=Rt(l=>l.defaults),s=Rt(l=>l.userItems),o=((c=[...n,...s].find(l=>l.id===t.workflowId))==null?void 0:c.color)??t.workflowColor??"#8b949e";return u.jsxs("div",{className:"feed-item rounded p-3 border",style:{borderColor:vu(o,.3),backgroundColor:vu(o,.08)},children:[u.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[u.jsx(hj,{color:o}),u.jsx("span",{className:"text-sm font-medium",style:{color:o},children:t.workflowName??"Task Completed"})]}),u.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-5 gap-2",children:[u.jsx(Vo,{label:"Iterations",value:String(t.iterations)}),u.jsx(Vo,{label:"Total time",value:f6(t.totalTimeSeconds)}),u.jsx(Vo,{label:"Tool calls",value:String(t.totalToolCalls)}),u.jsx(Vo,{label:"Tokens",value:m6(t.totalTokensGenerated)}),u.jsx(Vo,{label:"Speed",value:t.avgGenerationSpeed>0?`${t.avgGenerationSpeed} tok/s`:"-"})]})]})});function Vo({label:e,value:t}){return u.jsxs("div",{className:"bg-bg-primary/50 rounded px-2 py-1",children:[u.jsx("div",{className:"text-sm text-text-muted",children:e}),u.jsx("div",{className:"text-sm text-text-primary font-medium",children:t})]})}const g6=O.memo(function({data:t}){var c;const n=Rt(l=>l.defaults),s=Rt(l=>l.userItems),o=((c=[...n,...s].find(l=>l.id===t.workflowId))==null?void 0:c.color)??t.workflowColor??"#6b7280";return u.jsxs("div",{className:"feed-item flex items-center gap-2 px-3 py-2 rounded border",style:{borderColor:vu(o,.3),backgroundColor:vu(o,.08)},children:[u.jsx(aj,{className:"w-3 h-3 shrink-0",color:o}),u.jsx("span",{className:"text-sm font-medium",style:{color:o},children:t.workflowName}),u.jsx("span",{className:"text-text-muted text-sm",children:"started"})]})});function x6({attachments:e,messageId:t}){const[n,s]=O.useState(null),a=Ce(p=>p.visionFallbackByMessage),o=Ce(p=>p.messages),c=O.useMemo(()=>{const p=o.findIndex(m=>m.id===t);if(p===-1)return null;for(let m=p+1;m<o.length;m++){const _=o[m];if(_&&_.role==="assistant")return _.id}return null},[o,t]),l=p=>{s(p)},h=()=>{s(null)},f=p=>{const m=`${t}-${p}`;if(a[m])return a[m];if(c){const _=`${c}-${p}`;return a[_]}return null};return e.length===0?null:u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"mt-3 flex flex-wrap gap-3",children:e.map(p=>{const m=f(p.id);return u.jsxs("div",{className:"relative inline-block",children:[u.jsxs("button",{onClick:()=>l(p.data),className:"group relative inline-block",title:p.filename,disabled:(m==null?void 0:m.type)==="start",children:[u.jsx("img",{src:p.data,alt:p.filename,className:"max-w-[256px] max-h-[256px] object-contain rounded-lg border border-border hover:border-accent-primary transition-colors cursor-pointer"}),(m==null?void 0:m.type)==="start"&&u.jsx("div",{className:"absolute inset-0 bg-black/60 flex items-center justify-center rounded-lg",children:u.jsx("span",{className:"text-xs text-text-primary animate-pulse",children:"Describing image..."})})]}),(m==null?void 0:m.type)==="done"&&m.description&&u.jsxs("div",{className:"mt-2 p-2 bg-bg-tertiary rounded text-xs text-text-secondary max-w-[256px]",children:[m.description.slice(0,200),m.description.length>200?"...":""]})]},p.id)})}),n&&u.jsx(oC,{src:n,alt:"Attached image",isOpen:!0,onClose:h})]})}function _6({isOpen:e,onClose:t,promptContext:n}){const[s,a]=O.useState({systemPrompt:!1,messages:!0,tools:!0,requestOptions:!0,injectedFiles:!0,userMessage:!0}),o=c=>{a(l=>({...l,[c]:!l[c]}))};return u.jsx(Nt,{isOpen:e,onClose:t,title:"Prompt Inspector",size:"lg",children:u.jsxs("div",{className:"space-y-4",children:[u.jsx(va,{title:"User Message",expanded:s.userMessage??!0,onToggle:()=>o("userMessage"),children:u.jsx("pre",{className:"text-sm text-text-secondary whitespace-pre-wrap bg-bg-tertiary rounded p-3 max-h-48 overflow-auto",children:n.userMessage||"(empty)"})}),n.messages.length>0&&u.jsx(va,{title:`Prompt Messages (${n.messages.length})`,expanded:s.messages??!0,onToggle:()=>o("messages"),children:u.jsx("div",{className:"space-y-2",children:n.messages.map((c,l)=>u.jsxs("div",{className:"border border-border rounded overflow-hidden",children:[u.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 bg-bg-tertiary/50 text-xs text-text-muted",children:[u.jsx("span",{className:"font-mono text-text-primary",children:c.role}),u.jsx("span",{className:"rounded bg-bg-tertiary px-1.5 py-0.5",children:c.source}),c.toolCallId&&u.jsx("span",{className:"font-mono",children:c.toolCallId}),c.attachments&&c.attachments.length>0&&u.jsxs("span",{className:"rounded bg-bg-tertiary px-1.5 py-0.5",children:[c.attachments.length," attachment",c.attachments.length===1?"":"s"]})]}),c.attachments&&c.attachments.length>0&&u.jsx("div",{className:"border-b border-border px-3 py-2 text-xs text-text-muted",children:c.attachments.map(h=>h.filename).join(", ")}),u.jsx("pre",{className:"text-xs text-text-secondary whitespace-pre-wrap bg-bg-tertiary rounded-b p-3 max-h-64 overflow-auto font-mono",children:c.content||"(empty)"})]},`${c.role}-${l}`))})}),u.jsx(va,{title:`Tools (${n.tools.length})`,expanded:s.tools??!0,onToggle:()=>o("tools"),children:u.jsxs("div",{className:"space-y-2",children:[n.tools.length===0&&u.jsx("div",{className:"text-sm text-text-muted",children:"No tools sent with this request."}),n.tools.map((c,l)=>u.jsxs("div",{className:"bg-bg-tertiary rounded p-3 space-y-2",children:[u.jsxs("div",{className:"flex items-center justify-between gap-3",children:[u.jsx("span",{className:"font-mono text-sm text-text-primary",children:c.name}),u.jsx("span",{className:"text-xs text-text-muted",children:"parameters"})]}),u.jsx("div",{className:"text-sm text-text-secondary",children:c.description}),u.jsx("pre",{className:"text-xs text-text-secondary whitespace-pre-wrap max-h-48 overflow-auto font-mono",children:JSON.stringify(c.parameters,null,2)})]},`${c.name}-${l}`))]})}),u.jsx(va,{title:"Request Options",expanded:s.requestOptions??!0,onToggle:()=>o("requestOptions"),children:u.jsx("pre",{className:"text-xs text-text-secondary whitespace-pre-wrap bg-bg-tertiary rounded p-3 max-h-48 overflow-auto font-mono lowercase",children:JSON.stringify(n.requestOptions,null,2)})}),n.injectedFiles.length>0&&u.jsx(va,{title:`Injected Files (${n.injectedFiles.length})`,expanded:s.injectedFiles??!0,onToggle:()=>o("injectedFiles"),children:u.jsx("div",{className:"space-y-2",children:n.injectedFiles.map((c,l)=>u.jsx(y6,{file:c,expanded:s[`file-${l}`]??!1,onToggle:()=>o(`file-${l}`)},l))})}),u.jsx(va,{title:"System Prompt",expanded:s.systemPrompt??!1,onToggle:()=>o("systemPrompt"),badge:`${Math.round(n.systemPrompt.length/1e3)}K chars`,children:u.jsx("pre",{className:"text-xs text-text-secondary whitespace-pre-wrap bg-bg-tertiary rounded p-3 max-h-96 overflow-auto font-mono",children:n.systemPrompt})})]})})}function y6({file:e,expanded:t,onToggle:n}){return u.jsxs("div",{className:"bg-bg-tertiary rounded overflow-hidden",children:[u.jsxs("button",{onClick:n,className:"w-full flex items-center gap-2 p-2 hover:bg-bg-primary/30 transition-colors",children:[u.jsx(Ir,{className:`w-3 h-3 text-text-muted transition-transform ${t?"rotate-90":""}`}),u.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${e.source==="global"?"bg-purple-500/20 text-purple-400":e.source==="project"?"bg-blue-500/20 text-blue-400":"bg-green-500/20 text-green-400"}`,children:e.source}),u.jsx("span",{className:"text-sm text-text-primary font-mono truncate flex-1 text-left",children:e.path}),e.content&&u.jsxs("span",{className:"text-xs text-text-muted",children:[Math.round(e.content.length/1e3),"K chars"]})]}),t&&e.content&&u.jsx("div",{className:"border-t border-border/50 p-2",children:u.jsx("pre",{className:"text-xs text-text-secondary whitespace-pre-wrap max-h-64 overflow-auto font-mono",children:e.content})})]})}function va({title:e,expanded:t,onToggle:n,badge:s,children:a}){return u.jsxs("div",{className:"border border-border rounded overflow-hidden",children:[u.jsx("button",{onClick:n,className:"w-full flex items-center justify-between p-3 bg-bg-tertiary/50 hover:bg-bg-tertiary transition-colors",children:u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(Ir,{className:`w-4 h-4 text-text-muted transition-transform ${t?"rotate-90":""}`}),u.jsx("span",{className:"font-medium text-text-primary",children:e}),s&&u.jsx("span",{className:"text-xs text-text-muted bg-bg-tertiary px-1.5 py-0.5 rounded",children:s})]})}),t&&u.jsx("div",{className:"p-3 border-t border-border",children:a})]})}function v6({content:e,promptContext:t,align:n="right",messageIndex:s,sessionId:a}){const[o,c]=O.useState(!1),[l,h]=O.useState(!1),[f,p]=O.useState(!1),[m,_]=O.useState(!1),y=O.useRef(null),w=Ce(x=>x.loadSession);O.useEffect(()=>{const x=S=>{y.current&&!y.current.contains(S.target)&&c(!1)};return o&&document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[o]);const k=async()=>{try{if(navigator.clipboard)await navigator.clipboard.writeText(e);else{const x=document.createElement("textarea");x.value=e,x.style.position="fixed",x.style.left="-999999px",document.body.appendChild(x),x.select(),document.execCommand("copy"),document.body.removeChild(x)}p(!0),c(!1),window.setTimeout(()=>p(!1),1500)}catch(x){console.error("Failed to copy:",x)}},v=async()=>{if(!a||s===void 0||!window.confirm("Delete all messages after this point?"))return;_(!0),c(!1),await YE(a,s)&&w(a),_(!1)},b=n==="right";return u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:`flex items-start gap-1.5 ${b?"":"order-first"}`,children:[f&&u.jsx(Mr,{className:"w-4 h-4 text-accent-success"}),u.jsxs("div",{ref:y,className:"relative",children:[u.jsx("button",{onClick:()=>c(!o),className:"p-1 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary",title:"Message options",children:u.jsx(Xm,{})}),o&&u.jsxs("div",{className:`absolute top-full mt-1 bg-bg-secondary border border-border rounded shadow-xl z-50 py-1 min-w-36 ${b?"right-0":"left-0"}`,children:[u.jsxs("button",{onClick:k,className:"w-full px-3 py-1.5 text-left text-sm text-text-primary hover:bg-bg-tertiary flex items-center gap-2",children:[u.jsx(Ym,{className:"w-4 h-4"}),"Copy"]}),a&&s!==void 0&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"border-t border-border my-1"}),u.jsxs("button",{onClick:v,disabled:m,className:"w-full px-3 py-1.5 text-left text-sm text-red-400 hover:bg-bg-tertiary flex items-center gap-2 disabled:opacity-50",children:[u.jsx(ju,{className:"w-4 h-4"}),m?"Deleting...":"Delete after"]})]}),t&&u.jsxs("button",{onClick:()=>{h(!0),c(!1)},className:"w-full px-3 py-1.5 text-left text-sm text-text-primary hover:bg-bg-tertiary flex items-center gap-2",children:[u.jsx(Eu,{className:"w-4 h-4"}),"Inspect"]})]})]})]}),t&&u.jsx(_6,{isOpen:l,onClose:()=>h(!1),promptContext:t})]})}function b6({message:e}){const[t,n]=O.useState(!1);if(e.messageKind!=="auto-prompt")return null;const s=e.metadata,a=(s==null?void 0:s.color)??"#6b7280",o=(s==null?void 0:s.name)??"Agent",c=(s==null?void 0:s.type)??"agent",h={agent:"definition injected",workflow:"instructions",compaction:"prompt injected",subagent:"instructions"}[c]??"injected",f=c==="workflow"||c==="subagent";return u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"flex items-center justify-center gap-1.5 text-[10px] text-text-muted font-mono mt-3 mb-4",children:[u.jsx("span",{className:"flex-1 h-px bg-border"}),u.jsx("span",{className:`w-1.5 h-1.5 rounded-full flex-shrink-0 ${f?"":"cursor-pointer"}`,style:{backgroundColor:a},onClick:()=>!f&&n(!0)}),u.jsx("span",{className:f?"":"cursor-pointer hover:text-text-secondary transition-colors",style:{color:a},onClick:()=>!f&&n(!0),children:o}),u.jsx("span",{children:"·"}),u.jsx("span",{className:f?"":"cursor-pointer hover:text-text-secondary transition-colors",onClick:()=>!f&&n(!0),children:h}),u.jsx("span",{className:"flex-1 h-px bg-border"})]}),f&&u.jsx("div",{className:"flex justify-center feed-item mb-4",children:u.jsx("div",{className:"max-w-[75%] rounded p-3 bg-bg-tertiary/50 text-text-secondary text-sm",style:{borderLeft:`3px solid ${a}`},children:u.jsx("pre",{className:"whitespace-pre-wrap font-mono text-xs",children:e.content})})}),u.jsx(Nt,{isOpen:t,onClose:()=>n(!1),title:`${o} Prompt`,size:"lg",children:u.jsxs("div",{className:"space-y-4",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("span",{className:"w-3 h-3 rounded-full",style:{backgroundColor:a}}),u.jsx("span",{className:"text-sm text-text-primary font-medium",children:o}),u.jsxs("span",{className:"text-xs text-text-muted",children:["(",c,")"]})]}),u.jsx("div",{className:"h-full min-h-96",children:u.jsx("pre",{className:"text-sm text-text-secondary whitespace-pre-wrap bg-bg-tertiary rounded p-4 h-full min-h-96 overflow-auto font-mono",children:e.content})})]})})]})}function S6({message:e,promptContext:t,messageIndex:n,sessionId:s}){const a=e.messageKind==="auto-prompt",o=e.messageKind==="command",c=e.isSystemGenerated;return u.jsxs("div",{className:"flex justify-end items-start gap-1.5 feed-item",children:[!c&&u.jsx(v6,{content:e.content,promptContext:t,align:"right",messageIndex:n,sessionId:s}),u.jsxs("div",{className:`max-w-[75%] rounded p-2 ${c?o?"bg-teal-500/10 border border-teal-500/30":a?"bg-slate-500/10 border border-slate-500/30":"bg-amber-500/10 border border-amber-500/30":"bg-accent-primary/15 text-text-primary"}`,children:[c&&u.jsx("span",{className:`text-[10px] block mb-0.5 ${o?"text-teal-400":a?"text-slate-400":"text-amber-400"}`,children:o?"Command":a?"Auto":"System"}),u.jsx("div",{className:`whitespace-pre-wrap text-sm ${c?`${o?"text-teal-200":a?"text-slate-200":"text-amber-200 italic"}`:""}`,children:e.content}),e.attachments&&e.attachments.length>0&&u.jsx(x6,{attachments:e.attachments,messageId:e.id})]})]})}function w6({message:e}){const t=tn(s=>s.settings[We.LLM_DISABLE_XML_PROTECTION])!=="true",n=async()=>{await tn.getState().setSetting(We.LLM_DISABLE_XML_PROTECTION,t?"true":"false")};return u.jsx("div",{className:"flex justify-end feed-item",children:u.jsxs("div",{className:"max-w-[75%] rounded p-2 bg-amber-500/10 border border-amber-500/30",children:[u.jsx("span",{className:"text-[10px] block mb-0.5 text-amber-400",children:"System"}),u.jsx("div",{className:"whitespace-pre-wrap text-sm text-amber-200 italic",children:e.content}),u.jsx("button",{onClick:n,className:"mt-2 text-xs text-amber-400 hover:text-amber-300 underline",children:t?"Disable XML protection":"Enable XML protection"})]})})}const cC=O.memo(function({message:t,isLastAssistantMessage:n=!1,promptContext:s,messageIndex:a,sessionId:o}){const c=t.role==="user",l=t.role==="assistant",h=t.role==="system",f=t.role==="tool";if(l)return u.jsx(Gp,{message:t,showStats:n});if(h&&t.isCompacted)return u.jsxs("div",{className:"feed-item bg-bg-tertiary/50 border border-border rounded p-2",children:[u.jsx("div",{className:"text-text-muted text-xs mb-0.5",children:"[Compacted]"}),u.jsx("div",{className:"text-text-secondary text-xs whitespace-pre-wrap",children:t.content.replace(`[COMPACTED HISTORY]
283
+ `,"")})]});if(f)return u.jsxs("div",{className:"feed-item bg-bg-tertiary/30 border-l-2 border-accent-primary rounded-r p-2",children:[u.jsxs("div",{className:"text-accent-primary text-xs mb-0.5",children:["Tool: ",t.toolName]}),u.jsxs("pre",{className:"text-text-secondary text-xs whitespace-pre-wrap overflow-x-auto max-h-32",children:[t.content.slice(0,500),t.content.length>500&&"..."]})]});if(t.messageKind==="workflow-started")try{const p=JSON.parse(t.content);return u.jsx(g6,{data:p})}catch{}if(t.messageKind==="task-completed")try{const p=JSON.parse(t.content);return u.jsx(p6,{data:p})}catch{}return t.messageKind==="context-reset"?u.jsxs("div",{className:"flex items-center gap-4 mb-6 text-text-muted text-xs uppercase tracking-wide",children:[u.jsx("div",{className:"flex-1 border-t border-border"}),u.jsx("span",{children:t.content}),u.jsx("div",{className:"flex-1 border-t border-border"})]}):t.messageKind==="auto-prompt"&&t.isSystemGenerated?u.jsx(b6,{message:t}):t.messageKind==="correction"&&t.isSystemGenerated?u.jsx(w6,{message:t}):c?u.jsx(S6,{message:t,promptContext:s,messageIndex:a,sessionId:o}):u.jsx("div",{className:"flex justify-start feed-item",children:u.jsx("div",{className:"max-w-[75%] rounded p-2 bg-bg-tertiary text-text-primary",children:u.jsx(cs,{content:t.content})})})}),uC=(e,t)=>{const n=O.useRef(!0),s=O.useRef(null),[a,o]=O.useState(!0),c=()=>{const l=e.current;l&&(l.scrollTop=l.scrollHeight)};return O.useEffect(()=>{const l=e.current;if(!l)return;const h=y=>{if(y.deltaY>0){requestAnimationFrame(()=>requestAnimationFrame(()=>{l.scrollHeight-l.scrollTop-l.offsetHeight<100&&(n.current=!0,o(!0))}));return}n.current=!1,o(!1)},f=y=>{y.touches[0]&&(s.current=y.touches[0].clientY)},p=y=>{if(s.current===null)return;const w=y.touches[0];if(!w)return;if(w.clientY-s.current>0){n.current=!1,o(!1);return}requestAnimationFrame(()=>requestAnimationFrame(()=>{l.scrollHeight-l.scrollTop-l.offsetHeight<100&&(n.current=!0,o(!0))}))},m=new MutationObserver(()=>{n.current&&requestAnimationFrame(c)}),_=setInterval(()=>{n.current&&c()},1e3);return l.addEventListener("wheel",h,{passive:!0}),l.addEventListener("touchstart",f,{passive:!0}),l.addEventListener("touchmove",p,{passive:!0}),m.observe(l,{childList:!0,subtree:!0,characterData:!0}),()=>{l.removeEventListener("wheel",h),l.removeEventListener("touchstart",f),l.removeEventListener("touchmove",p),m.disconnect(),clearInterval(_)}},[t==null?void 0:t.id]),{force_scroll_to_bottom:()=>{n.current=!0,o(!0),c()},isAutoScrollActive:a,setAutoScroll:l=>{n.current=l,o(l),l&&c()}}},C6={verifier:"Verification",code_reviewer:"Code Review",test_generator:"Test Generation",debugger:"Debug"};function k6(e){return{backgroundColor:`${e}20`,color:e,borderColor:`${e}4d`}}function C0(e,t){return t||e>85?"text-accent-error":e>60?"text-accent-warning":"text-text-muted"}function E6({contextState:e}){const{currentTokens:t,maxTokens:n,compactionCount:s,dangerZone:a}=e,o=Math.round(t/n*100);return u.jsxs("div",{className:"flex items-center gap-1.5 text-[10px]",children:[u.jsxs("span",{className:C0(o,a),children:[eu(t),"/",eu(n)]}),u.jsxs("span",{className:C0(o,a),children:["(",o,"%)"]}),u.jsx(TS,{percent:o,dangerZone:a,size:"sm"}),a&&u.jsx("span",{className:"text-accent-error animate-pulse",children:"Low!"}),s>0&&u.jsxs("span",{className:"text-text-muted bg-bg-tertiary px-1 rounded",children:[s,"x"]})]})}const j6=O.memo(function({messages:t,subAgentType:n,subAgentId:s,isStreaming:a}){const o=O.useRef(null),c=O.useRef(null),[l,h]=O.useState(!1),f=Ot(D=>D.defaults),p=Ot(D=>D.userItems),m=[...f,...p],_=Ce(D=>D.subAgentContextStates[s]),{showThinking:y,showVerboseToolOutput:w}=wu(),{isAutoScrollActive:k,setAutoScroll:v}=uC(c,null);O.useEffect(()=>{a||v(!0)},[a]);const b=O.useCallback(()=>{const D=!l;h(D),D&&setTimeout(()=>{var A;(A=o.current)==null||A.scrollIntoView({block:"start",behavior:"smooth"})},220)},[l]),x=m.find(D=>D.id===n),S=(x==null?void 0:x.name)??C6[n]??n,j=yu(m,n),N=k6(j),T=t.filter(D=>D.role!=="tool");return u.jsxs("div",{ref:o,className:"feed-item border border-border rounded overflow-hidden bg-secondary",children:[u.jsxs("div",{className:"w-full flex items-center justify-between px-2 py-1 border-b relative",style:N,children:[u.jsx("span",{className:"text-xs font-medium",children:S}),u.jsx("div",{className:"absolute left-1/2 -translate-x-1/2",children:_&&u.jsx(E6,{contextState:_})}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsxs("button",{type:"button",className:"text-sm text-text-muted hover:text-text-primary flex items-center gap-1.5",onClick:()=>v(!k),children:[u.jsx("span",{className:`w-1 h-1 rounded-full ${k?"bg-accent-success":"border border-text-muted"}`}),"live"]}),u.jsxs("button",{type:"button",className:"text-[10px] px-1.5 py-0.5 rounded bg-bg-tertiary",onClick:b,children:[l?"▼":"▶"," Expand"]})]})]}),u.jsx("div",{ref:c,className:`${l?"max-h-[calc(100vh-10rem)]":"max-h-80"} overflow-y-auto p-2 transition-[max-height] duration-200`,children:T.map(D=>D.role==="assistant"?u.jsx(Gp,{message:D,showStats:!0,showThinking:y,showVerboseToolOutput:w},D.id):u.jsx(cC,{message:D,isLastAssistantMessage:!1},D.id))})]})});function T6(e){const t={};let n=null;for(const s of e){if(s.role==="user"&&!s.isSystemGenerated){n=s.id;continue}s.role==="assistant"&&s.promptContext&&n&&t[n]===void 0&&(t[n]=s.promptContext)}return t}const N6=O.memo(function({displayItems:t,scrollContainerRef:n,highlightedMessageId:s}){const a=Ce($=>{var F;return(F=$.currentSession)==null?void 0:F.criteria}),o=Ce($=>{var F;return(F=$.currentSession)==null?void 0:F.id}),c=Ce($=>{var F;return(F=$.currentSession)==null?void 0:F.mode}),l=Ce($=>{var F;return(F=$.currentSession)==null?void 0:F.phase}),h=Ce($=>$.messages),f=Ce($=>$.error),p=Ce($=>$.clearError),m=Ce($=>$.acceptAndBuild),_=Km(),{showThinking:y,showVerboseToolOutput:w,showStats:k,showAgentDefinitions:v,showWorkflowBars:b}=wu(),x=Rt($=>$.defaults),S=Rt($=>$.userItems),j=[...x,...S],N=O.useMemo(()=>T6(h),[h]),T=c==="planner",D=((a==null?void 0:a.length)??0)>0,A=l==="done",B=t.some($=>$.type==="message"&&$.message.role==="assistant"),R=T&&D&&!_&&B&&!A;return u.jsxs("div",{ref:n,"data-testid":"chat-scroll-container",className:"flex-1 min-w-0 overflow-y-auto relative bg-primary",children:[u.jsx("div",{className:"pt-4",children:t.map(($,F)=>{if($.type==="context-divider")return u.jsxs("div",{"data-item-index":F,className:"flex items-center gap-2 feed-item px-2 md:px-4",children:[u.jsx("div",{className:"flex-1 border-t border-border"}),u.jsx("span",{className:"text-[10px] text-text-muted font-medium px-2",children:"Earlier context summarized"}),u.jsx("div",{className:"flex-1 border-t border-border"})]},F);if($.type==="subagent"){const H=$.messages.some(J=>J.isStreaming);return u.jsx("div",{"data-item-index":F,className:"px-2 md:px-4",children:u.jsx(j6,{messages:$.messages,subAgentType:$.subAgentType,subAgentId:$.subAgentId,isStreaming:H})},F)}if($.type==="criteria-batch")return u.jsx("div",{"data-item-index":F,className:"feed-item px-2 md:px-4",children:u.jsx(lC,{toolCalls:$.toolCalls,criteria:a})},F);const W=$.message;if(W.role==="assistant")return u.jsx("div",{"data-item-index":F,className:"px-2 md:px-4",children:u.jsx(Gp,{message:W,showStats:k,showThinking:y,showVerboseToolOutput:w})},F);const Y=!v&&W.messageKind==="auto-prompt",P=!b&&(W.messageKind==="workflow-started"||W.messageKind==="task-completed");return Y||P?null:u.jsx("div",{"data-item-index":F,className:"px-2 md:px-4",children:u.jsx("div",{"data-message-id":W.id,className:s===W.id?"rounded animate-highlight-fade":void 0,children:u.jsx(cC,{message:W,messageIndex:F,sessionId:o,isLastAssistantMessage:!1,promptContext:W.role==="user"?N[W.id]:void 0})})},F)})}),u.jsxs("div",{className:"px-2 md:px-4 pb-4",children:[f&&u.jsx("div",{className:"feed-item bg-red-500/10 border border-red-500/50 rounded p-2",children:u.jsxs("div",{className:"flex items-start justify-between gap-2",children:[u.jsxs("div",{children:[u.jsx("div",{className:"text-red-400 text-sm font-medium",children:f.code}),u.jsx("div",{className:"text-red-300 text-xs mt-0.5",children:f.message})]}),u.jsx(hl,{onClick:p,className:"text-red-400 hover:text-red-300 p-0.5",size:"sm"})]})}),R&&u.jsx("div",{className:"flex justify-center gap-2 feed-item flex-wrap",children:j.map($=>{const F=$.color??"#3b82f6",W=parseInt(F.slice(1,3),16),Y=parseInt(F.slice(3,5),16),P=parseInt(F.slice(5,7),16),H=`rgba(${W},${Y},${P},0.12)`,J=`rgba(${W},${Y},${P},0.22)`,K=`rgba(${W},${Y},${P},0.25)`;return u.jsxs("button",{onClick:()=>m($.id),"data-testid":"workflow-run-button",className:"px-4 py-1.5 rounded text-sm font-medium transition-colors",style:{backgroundColor:H,color:F,border:`1px solid ${K}`},onMouseEnter:I=>{I.currentTarget.style.backgroundColor=J},onMouseLeave:I=>{I.currentTarget.style.backgroundColor=H},children:["▶ ",$.name]},$.id)})})]})]})});function A6(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_|_$/g,"")}function D6({agent:e,isBuiltIn:t,isConfirmingDelete:n,onView:s,onEdit:a,onDuplicate:o,onDelete:c}){return u.jsxs(uS,{isBuiltIn:t,isConfirmingDelete:n,onView:s,onEdit:a,onDuplicate:o,onDelete:c,children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("span",{className:"w-2.5 h-2.5 rounded-full flex-shrink-0",style:{backgroundColor:e.color??"#6b7280"}}),u.jsx("span",{className:"text-text-primary text-sm font-medium",children:e.name}),u.jsx("span",{className:"text-text-muted text-xs font-mono",children:e.id}),t&&u.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium bg-bg-primary text-text-muted",children:"Built-in"})]}),e.description&&u.jsx("p",{className:"text-text-secondary text-xs mt-0.5 truncate",children:e.description}),u.jsxs("div",{className:"flex flex-wrap gap-1 mt-1",children:[e.allowedTools.slice(0,5).map(l=>u.jsx("span",{className:"text-[10px] font-mono text-text-muted bg-bg-primary px-1 py-0.5 rounded",children:l},l)),e.allowedTools.length>5&&u.jsxs("span",{className:"text-[10px] text-text-muted",children:["+",e.allowedTools.length-5," more"]})]})]})}function k0({title:e,agents:t,subagents:n,isBuiltIn:s,onView:a,onDuplicate:o,onEdit:c,onDelete:l}){if(t.length===0&&n.length===0)return null;const h=f=>u.jsx(D6,{agent:f,isBuiltIn:s,isConfirmingDelete:!1,onView:()=>a(f.id),onEdit:s?void 0:()=>c==null?void 0:c(f.id),onDuplicate:()=>o(f.id),onDelete:s?void 0:()=>l==null?void 0:l(f.id)},f.id);return u.jsxs("div",{children:[u.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:e}),u.jsxs("div",{className:"space-y-2",children:[t.map(h),n.length>0&&u.jsxs("div",{className:"mt-3",children:[u.jsx("div",{className:"text-xs text-text-muted uppercase tracking-wider mb-1.5",children:"Sub-agents"}),u.jsx("div",{className:"space-y-2",children:n.map(h)})]})]})]})}function L6({isOpen:e,onClose:t,initialEditId:n}){const s=Ot(fe=>fe.defaults),a=Ot(fe=>fe.userItems),o=Ot(fe=>fe.loading),c=Ot(fe=>fe.fetchAgents),l=Ot(fe=>fe.fetchAgent),h=Ot(fe=>fe.fetchDefaultContent),f=Ot(fe=>fe.createAgent),p=Ot(fe=>fe.updateAgent),m=Ot(fe=>fe.deleteAgent),[_,y]=O.useState("list"),[w,k]=O.useState(null),[v,b]=O.useState(!1),[x,S]=O.useState(""),[j,N]=O.useState(""),[T,D]=O.useState(""),[A,B]=O.useState(!0),[R,$]=O.useState([]),[F,W]=O.useState("#6b7280"),[Y,P]=O.useState(""),[H,J]=O.useState(""),[K,I]=O.useState(!1),[L,z]=O.useState([]);function V(fe){const De=new Map;for(const ze of fe){const _t=ze.indexOf(":");if(_t===-1)De.set(ze,new Set);else{const ue=ze.slice(0,_t),Le=ze.slice(_t+1).split(",").filter(Boolean);De.set(ue,new Set(Le))}}return De}function U(fe){const De=[];for(const[ze,_t]of fe)_t.size===0?De.push(ze):De.push(`${ze}:${[..._t].join(",")}`);return De}const ee=V(R),Z=(fe,De)=>{const ze=new Map(ee),_t=ze.get(fe)||new Set,ue=new Set(_t);ue.has(De)?ue.delete(De):ue.add(De),ue.size===0?ze.set(fe,new Set):ze.set(fe,ue),$(U(ze))},ne=fe=>{const De=new Map(ee);De.has(fe)?De.delete(fe):De.set(fe,new Set),$(U(De))},X=fe=>{S(fe.metadata.name),N(fe.metadata.id),D(fe.metadata.description),B(fe.metadata.subagent),$(fe.metadata.allowedTools),W(fe.metadata.color??"#6b7280"),P(fe.prompt),J("")},G=(fe,De,ze)=>{S(fe.metadata.name+" (copy)"),N(`${De}-copy-${Date.now()}`),D(fe.metadata.description),B(fe.metadata.subagent),$(fe.metadata.allowedTools),W(fe.metadata.color??"#6b7280"),P(fe.prompt),J(""),k(null),b(!1),y("edit")},le=(fe,De)=>{X(fe),k(De),b(!0),y("edit")};O.useEffect(()=>{e&&(c(),je("/api/tools").then(fe=>fe.json()).then(fe=>z(fe.tools||[])).catch(()=>z([])),n?s.some(De=>De.id===n)?h(n).then(De=>{De&&G(De,n)}):l(n).then(De=>{De&&(X(De),k(n),b(!1),y("edit"))}):(y("list"),k(null),b(!1)))},[e,c,l,h,n]);const se=async fe=>{if(s.some(ze=>ze.id===fe)){const ze=await h(fe);if(!ze)return;le(ze,fe)}else{const ze=await l(fe);if(!ze)return;le(ze,fe)}},ve=async fe=>{const De=await h(fe);De&&G(De,fe)},be=()=>{k(null),S(""),N(""),D(""),B(!0),$(["read_file"]),W("#6b7280"),P(""),J(""),b(!1),y("edit")},Oe=async fe=>{const De=await l(fe);De&&(X(De),k(fe),b(!1),y("edit"))},Be=async fe=>{await m(fe)},Pe=async()=>{const fe=w??j;if(!fe||!x||!Y){J("Name and prompt are required.");return}I(!0),J("");const De={metadata:{id:fe,name:x,description:T,subagent:A,allowedTools:R,color:F},prompt:Y},ze=w?await p(w,De):await f(De);if(I(!1),!ze.success){J(ze.error??"Failed to save agent.");return}n?t():y("list")},Ve=()=>{n?t():(y("list"),b(!1))},Ae=fe=>{S(fe),w||N(A6(fe))},dt=s.filter(fe=>fe.subagent),lt=s.filter(fe=>!fe.subagent),ye=a.filter(fe=>fe.subagent),Ne=a.filter(fe=>!fe.subagent);return _==="edit"?u.jsx(Nt,{isOpen:e,onClose:Ve,title:v?`${x}`:w?"Edit Agent":"New Agent",size:"xl",children:u.jsxs("div",{className:"flex flex-col h-full",children:[u.jsxs("div",{className:"space-y-3",children:[H&&u.jsx(ap,{message:H}),u.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[u.jsx(Si,{label:"Name",value:x,onChange:Ae,placeholder:"My Agent",readOnly:v}),u.jsx(Si,{label:"ID",value:j,onChange:N,readOnly:!0,placeholder:"my_agent",hint:"(read-only)",mono:!0})]}),u.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[u.jsx(Si,{label:"Description",value:T,onChange:D,placeholder:"What this agent does",readOnly:v}),u.jsxs("div",{children:[u.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Type"}),u.jsxs("div",{className:"flex items-center gap-3 h-[34px]",children:[u.jsx("button",{onClick:()=>!v&&B(!0),className:`px-2.5 py-1 rounded text-xs font-medium transition-colors ${A?"bg-accent-primary/25 text-accent-primary":"bg-bg-tertiary text-text-muted hover:text-text-secondary"} ${v?"pointer-events-none opacity-60":""}`,children:"Sub-agent"}),u.jsx("button",{onClick:()=>!v&&B(!1),className:`px-2.5 py-1 rounded text-xs font-medium transition-colors ${A?"bg-bg-tertiary text-text-muted hover:text-text-secondary":"bg-accent-primary/25 text-accent-primary"} ${v?"pointer-events-none opacity-60":""}`,children:"Top-level"}),u.jsxs("div",{className:"flex items-center gap-1.5 ml-auto",children:[u.jsx("label",{className:"text-xs text-text-secondary",children:"Color"}),u.jsx("input",{type:"color",value:F,onChange:fe=>!v&&W(fe.target.value),disabled:v,className:"w-6 h-6 rounded cursor-pointer border border-border bg-transparent"})]})]})]})]}),u.jsxs("div",{children:[u.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Tools"}),u.jsx("div",{className:"flex flex-wrap gap-1.5 p-2 bg-bg-tertiary border border-border rounded max-h-32 overflow-y-auto",children:L.map(fe=>{const De=ee.has(fe.name),ze=fe.actions.length>0,_t=ee.get(fe.name)||new Set,ue=u.jsxs("button",{className:`px-1.5 py-0.5 rounded text-xs font-mono transition-colors flex items-center gap-1 ${De?"bg-accent-primary/25 text-accent-primary":"bg-bg-primary text-text-muted"}`,children:[u.jsx("span",{children:fe.name}),ze&&u.jsx("span",{className:`text-[10px] ${De&&_t.size>0?"text-accent-primary":"text-text-muted"}`,children:"*"})]},fe.name);return ze?v?u.jsxs("button",{className:"px-1.5 py-0.5 rounded text-xs font-mono flex items-center gap-1 bg-bg-primary text-text-muted pointer-events-none opacity-60",children:[u.jsx("span",{children:fe.name}),u.jsx("span",{className:"text-[10px]",children:"*"})]},fe.name):u.jsx(dl,{trigger:ue,minWidth:"160px",items:[...fe.actions.map(we=>({label:u.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",htmlFor:`${fe.name}-${we}`,children:[u.jsx("input",{type:"checkbox",id:`${fe.name}-${we}`,checked:_t.has(we),onChange:()=>Z(fe.name,we),disabled:v,className:"w-3 h-3 rounded accent-accent-primary"}),u.jsx("span",{children:we})]}),closeOnClick:!1})),{label:De?"Deselect all":"Select all",closeOnClick:!1,onClick:()=>{if(De)ne(fe.name);else{const we=new Map(ee);we.set(fe.name,new Set(fe.actions)),$(U(we))}}}]},fe.name):u.jsx("button",{onClick:()=>!v&&ne(fe.name),className:`px-1.5 py-0.5 rounded text-xs font-mono transition-colors flex items-center gap-1 ${De?"bg-accent-primary/25 text-accent-primary":"bg-bg-primary text-text-muted hover:text-text-secondary"} ${v?"pointer-events-none":"cursor-pointer"}`,children:u.jsx("span",{children:fe.name})},fe.name)})})]})]}),u.jsxs("div",{className:"flex-1 min-h-[150px] border-t border-border pt-3 flex flex-col",children:[u.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Prompt"}),u.jsx("textarea",{value:Y,onChange:fe=>!v&&P(fe.target.value),readOnly:v,placeholder:"Instructions for this agent...",className:`h-80 w-full px-3 py-2 bg-bg-tertiary border border-border rounded text-sm font-mono resize-y focus:outline-none focus:ring-1 focus:ring-accent-primary ${v?"opacity-60":""}`})]}),u.jsx(jj,{onCancel:Ve,onSave:Pe,saving:K,saveDisabled:!x||!Y||v}),v&&u.jsx("div",{className:"flex justify-end mt-2",children:u.jsx(rt,{variant:"primary",onClick:()=>{S(x+" (copy)"),N(`${w}-copy-${Date.now()}`),k(null),b(!1)},children:"Duplicate & Customize"})})]})}):u.jsxs(Nt,{isOpen:e,onClose:t,title:"Agents",size:"lg",children:[u.jsxs("div",{className:"flex items-center justify-between mb-4",children:[u.jsx("p",{className:"text-text-secondary text-sm",children:"Agents define behavior, tools, and prompts for top-level modes and sub-agents."}),u.jsx("div",{className:"flex items-center gap-2 flex-shrink-0 ml-3",children:u.jsx(rt,{variant:"primary",size:"sm",onClick:be,children:"+ New"})})]}),o&&s.length===0&&a.length===0?u.jsx("div",{className:"text-text-muted text-sm",children:"Loading agents..."}):s.length===0&&a.length===0?u.jsx("div",{className:"text-text-muted text-sm",children:"No agents defined."}):u.jsxs("div",{className:"space-y-4",children:[s.length>0&&u.jsx(k0,{title:"Built-in",agents:lt,subagents:dt,isBuiltIn:!0,onView:se,onDuplicate:ve}),a.length>0&&u.jsx(k0,{title:"Custom",agents:Ne,subagents:ye,isBuiltIn:!1,onView:se,onDuplicate:ve,onEdit:Oe,onDelete:Be})]})]})}function R6(){const e=Ce(x=>{var S;return(S=x.currentSession)==null?void 0:S.mode}),t=Ce(x=>x.switchMode),n=Ot(x=>x.defaults),s=Ot(x=>x.userItems),a=Ot(x=>x.fetchAgents),o=[...n,...s],[c,l]=O.useState(!1),[h,f]=O.useState(!1),[p,m]=O.useState(null),_=O.useRef(null);O.useEffect(()=>{a()},[a]),O.useEffect(()=>{function x(S){_.current&&!_.current.contains(S.target)&&l(!1)}return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[]);const y=ep();if(!e)return null;const w=o.filter(x=>!x.subagent),k=w.find(x=>x.id===e),v=(k==null?void 0:k.name)??e,b=yu(o,e);return u.jsxs("div",{className:"relative",ref:_,children:[u.jsxs("button",{type:"button",onClick:()=>l(!c),className:"flex items-center gap-1 px-1.5 py-0.5 rounded hover:bg-bg-tertiary transition-colors",title:"Switch agent",children:[u.jsx("span",{className:"text-sm font-medium",style:{color:b},children:v}),u.jsx(Ir,{className:`w-3 h-3 text-text-muted transition-transform ${c?"rotate-180":""}`})]}),c&&w.length>0&&u.jsxs("div",{className:"absolute bottom-full left-0 mb-1 w-56 bg-bg-secondary border border-border rounded-lg shadow-lg overflow-hidden z-50",children:[w.map((x,S)=>{const j=x.id===e,N=yu(o,x.id),T=y.agentSwitching[S],D=T?sS(T):null;return u.jsxs("div",{className:`flex items-center gap-2 px-3 py-2 text-sm transition-colors group ${j?"bg-bg-tertiary":"hover:bg-bg-tertiary cursor-pointer"}`,children:[u.jsxs("button",{type:"button",onClick:()=>{j||t(x.id),l(!1)},className:"flex-1 text-left flex items-center gap-2 min-w-0",children:[u.jsx("span",{className:"font-medium truncate",style:{color:N},children:x.name}),j&&u.jsx(Mr,{className:"w-3.5 h-3.5 text-text-muted shrink-0"})]}),D&&u.jsx("span",{className:"shrink-0 px-1.5 py-0.5 text-[10px] bg-bg-tertiary text-text-muted rounded",children:D})]},x.id)}),u.jsx("div",{className:"border-t border-border p-1",children:u.jsx("button",{type:"button",onClick:()=>{l(!1),f(!0)},className:"w-full text-left px-3 py-1.5 rounded text-sm text-text-muted hover:text-text-primary hover:bg-bg-tertiary transition-colors",children:"Manage Agents..."})})]}),u.jsx(L6,{isOpen:h,onClose:()=>{f(!1),m(null)},initialEditId:p})]})}function O6(){const e=Ce(s=>s.currentSession),t=Ce(s=>s.switchDangerLevel);if(!e)return null;const n=e.dangerLevel??"normal";return u.jsxs("div",{className:"flex items-center gap-1 px-1.5 py-0.5 rounded bg-bg-tertiary/50",children:[u.jsx("button",{type:"button",onClick:()=>t("normal"),className:`px-2 py-0.5 text-xs font-medium rounded transition-colors ${n==="normal"?"bg-accent-success/20 text-accent-success":"text-text-muted hover:text-text-primary hover:bg-bg-tertiary"}`,title:"Normal mode - requires path confirmation",children:"Normal"}),u.jsx("button",{type:"button",onClick:()=>t("dangerous"),className:`px-2 py-0.5 text-xs font-medium rounded transition-colors ${n==="dangerous"?"bg-red-500/20 text-red-400":"text-text-muted hover:text-text-primary hover:bg-bg-tertiary"}`,title:"Dangerous mode - bypasses all confirmations",children:"Dangerous"})]})}function M6({question:e}){const t=Ce(c=>c.answerQuestion),[n,s]=O.useState(""),a=()=>{t(e.callId,n)},o=c=>{c.key==="Enter"&&!c.shiftKey&&(c.preventDefault(),a())};return u.jsx(Nt,{isOpen:!0,onClose:()=>{},size:"sm",closeOnBackdropClick:!1,closeOnEscape:!1,showCloseButton:!1,children:u.jsxs("div",{className:"space-y-4",children:[u.jsx("p",{className:"text-sm text-text-primary",children:e.question}),u.jsx("textarea",{value:n,onChange:c=>s(c.target.value),onKeyDown:o,placeholder:"Type your answer here...",className:"w-full min-h-[120px] px-3 py-2 bg-bg-tertiary border border-border rounded text-sm text-text-primary placeholder:text-text-muted focus:outline-none focus:ring-2 focus:ring-accent-primary/50 resize-y",autoFocus:!0}),u.jsxs("div",{className:"flex justify-end gap-2",children:[u.jsx(rt,{variant:"secondary",size:"sm",onClick:()=>t(e.callId,""),children:"Skip"}),u.jsx(rt,{variant:"primary",size:"sm",onClick:a,children:"Send Answer"})]})]})})}function I6(){const e=Ce(s=>s.connectionStatus),t=Ce(s=>s.reconnect);if(e==="connected")return null;const n=e==="reconnecting";return u.jsxs("div",{className:`
284
+ flex items-center justify-between px-4 py-2
285
+ text-sm font-medium
286
+ ${n?"bg-amber-500/15 border-b border-amber-500/30 text-amber-300":"bg-red-500/15 border-b border-red-500/30 text-red-300"}
287
+ `,children:[u.jsx("div",{className:"flex items-center gap-2",children:n?u.jsxs(u.Fragment,{children:[u.jsxs("span",{className:"flex gap-1",children:[u.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-pulse"}),u.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-pulse",style:{animationDelay:"150ms"}}),u.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-pulse",style:{animationDelay:"300ms"}})]}),u.jsx("span",{children:"Reconnecting to server..."})]}):u.jsxs(u.Fragment,{children:[u.jsx(mj,{}),u.jsx("span",{children:"Connection lost"})]})}),u.jsx("button",{onClick:()=>t(),disabled:n,className:`
288
+ px-3 py-1 rounded text-xs font-medium
289
+ transition-colors
290
+ ${n?"bg-amber-500/20 text-amber-400 cursor-not-allowed opacity-50":"bg-red-500/20 text-red-300 hover:bg-red-500/30 hover:text-red-200"}
291
+ `,children:n?"Reconnecting...":"Reconnect"})]})}function P6({attachment:e,onRemove:t}){const n=s=>s<1024?`${s} B`:s<1048576?`${(s/1024).toFixed(1)} KB`:`${(s/1048576).toFixed(1)} MB`;return u.jsxs("div",{className:"relative inline-flex flex-col items-center p-2 bg-bg-tertiary rounded-lg border border-border",children:[u.jsx(hl,{onClick:()=>t(e.id),className:"absolute -top-2 -right-2",size:"sm",variant:"overlay","aria-label":`Remove ${e.filename}`}),u.jsx("img",{src:e.data,alt:e.filename,className:"w-16 h-16 object-cover rounded-md bg-bg-secondary"}),u.jsx("div",{className:"mt-1 text-xs text-text-muted text-center max-w-16 truncate",title:e.filename,children:e.filename}),u.jsx("div",{className:"text-[10px] text-text-muted",children:n(e.size)})]})}function B6({history:e,selectedIndex:t,onSelect:n,onEscape:s,onNavigate:a}){const o=O.useRef(null),c=O.useRef(null);O.useEffect(()=>{c.current&&o.current&&c.current.scrollIntoView({block:"nearest",behavior:"smooth"})},[t]);const l=f=>{switch(f.key){case"Enter":f.preventDefault(),e[t]&&n(e[t].content);break;case"Escape":f.preventDefault(),s();break;case"ArrowUp":f.preventDefault(),a("up");break;case"ArrowDown":f.preventDefault(),a("down");break}},h=f=>{n(f)};return u.jsx("div",{ref:o,role:"list",className:"mb-2 p-2 bg-bg-secondary border border-border rounded-lg overflow-y-auto max-h-64",onKeyDown:l,children:e.map((f,p)=>u.jsxs("div",{ref:p===t?c:null,role:"listitem",onClick:()=>h(f.content),className:`
292
+ p-2 rounded cursor-pointer transition-colors
293
+ ${p===t?"bg-accent-primary/20 border border-accent-primary":"hover:bg-bg-tertiary"}
294
+ `,children:[u.jsxs("div",{className:"text-xs text-text-muted font-mono",children:[f.formattedTimestamp,f.sessionName&&u.jsxs(u.Fragment,{children:[" | ",u.jsx("span",{className:"text-accent-primary font-medium",children:f.sessionName})]})]}),u.jsx("div",{className:"text-sm text-text-primary mt-1",children:f.trimmedContent})]},f.id))})}function z6(){const e=U2(),t=e?"bg-amber-400":"bg-accent-primary";return u.jsxs("div",{className:"flex items-center gap-3 text-xs text-text-muted py-2",children:[u.jsxs("div",{className:"flex items-center gap-1.5",children:[u.jsxs("span",{className:"flex gap-0.5",children:[u.jsx("span",{className:`w-1 h-1 rounded-full animate-bounce ${t}`,style:{animationDelay:"0ms"}}),u.jsx("span",{className:`w-1 h-1 rounded-full animate-bounce ${t}`,style:{animationDelay:"150ms"}}),u.jsx("span",{className:`w-1 h-1 rounded-full animate-bounce ${t}`,style:{animationDelay:"300ms"}})]}),u.jsx("span",{className:"text-text-secondary",children:e?"Running... (abort in progress)":"Running"})]}),!e&&u.jsx("span",{className:"text-text-muted",children:"esc to interrupt"})]})}const an=Jn((e,t)=>({defaults:[],userItems:[],projectItems:[],loading:!1,fetchCommands:async()=>{await np("/api/commands",e,!0)},fetchCommand:async n=>{try{const s=await je(`/api/commands/${n}`);return s.ok?await s.json():null}catch{return null}},fetchDefaultContent:async n=>{try{const s=await je(`/api/commands/defaults/${n}`);return s.ok?await s.json():null}catch{return null}},createCommand:async(n,s)=>{const a=await Vs("POST","/api/commands",{...n,destination:s});return a.success&&await t().fetchCommands(),a},updateCommand:async(n,s)=>{const a=await Vs("PUT",`/api/commands/${n}`,s);return a.success&&await t().fetchCommands(),a},deleteCommand:async n=>{try{const s=await je(`/api/commands/${n}`,{method:"DELETE"}),a=await s.json();return s.ok?(e(o=>({userItems:o.userItems.filter(c=>c.id!==n)})),{success:!0}):{success:!1,error:a.error??"Failed to delete"}}catch{return{success:!1,error:"Network error"}}},duplicateCommand:async(n,s)=>ku(`/api/commands/${n}/duplicate`,()=>t().fetchCommands(),s)})),H6={maxWidth:1920,maxHeight:1920,quality:.85,maxSizeBytes:1048576};async function $6(e,t={}){const n={...H6,...t};if(!e.type.startsWith("image/"))throw new Error("File is not an image");if(!["image/png","image/jpeg","image/gif"].includes(e.type))throw new Error(`Unsupported image format: ${e.type}. Only PNG, JPG, and GIF are supported.`);if(e.size<=n.maxSizeBytes){const a=await e.arrayBuffer(),o=K6(a),c=`data:${e.type};base64,${o}`,l=await dC(c);return{dataUrl:c,mimeType:e.type,size:e.size,width:l.width,height:l.height}}return await U6(e,n)}async function U6(e,t){const n=await V6(e),s=await dC(n),{width:a,height:o}=F6(s.width,s.height,t.maxWidth,t.maxHeight),c=G6();c.width=a,c.height=o;const l=c.getContext("2d");if(!l)throw new Error("Failed to get canvas context");l.imageSmoothingEnabled=!0,l.imageSmoothingQuality="high",l.drawImage(s,0,0,a,o);let h=t.quality,f="";for(let m=0;m<10&&(f=c.toDataURL(e.type.startsWith("image/gif")?"image/png":e.type,h),!(E0(f)<=t.maxSizeBytes||h<=.3));m++)h-=.1;const p=E0(f);return{dataUrl:f,mimeType:e.type.startsWith("image/gif")?"image/png":e.type,size:p,width:a,height:o}}function F6(e,t,n,s){const a=e/t;return e>t&&e>n?{width:n,height:Math.round(n/a)}:t>e&&t>s?{width:Math.round(s*a),height:s}:{width:e,height:t}}function V6(e){return new Promise((t,n)=>{const s=q6(),a=new s;a.onload=()=>t(a.result),a.onerror=()=>n(new Error("Failed to read file")),a.readAsDataURL(e)})}function dC(e){return new Promise((t,n)=>{const s=W6(),a=new s;a.onload=()=>t(a),a.onerror=()=>n(new Error("Failed to load image")),a.src=e})}function G6(){var t;const e=Wp();if(!((t=e.document)!=null&&t.createElement))throw new Error("Image compression requires browser canvas APIs");return e.document.createElement("canvas")}function W6(){const e=Wp();if(!e.Image)throw new Error("Image compression requires browser image APIs");return e.Image}function q6(){const e=Wp();if(!e.FileReader)throw new Error("Image compression requires browser file APIs");return e.FileReader}function Wp(){return globalThis}function K6(e){const t=new Uint8Array(e);let n="";for(let s=0;s<t.byteLength;s++){const a=t[s];a!==void 0&&(n+=String.fromCharCode(a))}return btoa(n)}function E0(e){const n=e.split(",")[1];return n?Math.round(n.length*3/4):0}function Y6(e){return["image/png","image/jpeg","image/gif"].includes(e.type)}function X6(e,t=50*1024*1024){return e.size>t?{valid:!1,error:`Image file is too large (${j0(e.size)}). Maximum size is ${j0(t)}.`}:{valid:!0}}function j0(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}async function im(e,t,n,s={}){const{maxSizeBytes:a=50*1024*1024,filename:o}=s;if(!Y6(e)){n(`Unsupported file type: ${e.type}. Only PNG, JPG, and GIF are supported.`);return}const c=X6(e,a);if(!c.valid){n(c.error??"Image file is too large");return}try{const l=await $6(e,{maxWidth:1920,maxHeight:1920,quality:.85,maxSizeBytes:1048576}),h={id:W0(),filename:o??e.name,mimeType:l.mimeType,size:l.size,data:l.dataUrl};t(h)}catch(l){const h=l instanceof Error?l.message??"Failed to process image":"Failed to process image";n(h)}}function Q6({content:e,children:t,position:n="top",delay:s=200}){const[a,o]=O.useState(!1),[c,l]=O.useState({top:0,left:0}),h=O.useRef(void 0),f=O.useRef(null);O.useEffect(()=>()=>{h.current&&clearTimeout(h.current)},[]);const p=()=>{h.current=setTimeout(()=>{if(f.current){const y=f.current.getBoundingClientRect();l({top:y.top,left:y.left+y.width/2})}o(!0)},s)},m=()=>{h.current&&clearTimeout(h.current),o(!1)},_=(()=>{switch(n){case"top":return{top:c.top-8,left:c.left,tx:"-50%",ty:"-100%"};case"bottom":return{top:c.top+8,left:c.left,tx:"-50%",ty:"0%"};case"left":return{top:c.top,left:c.left-8,tx:"-100%",ty:"-50%"};case"right":return{top:c.top,left:c.left+8,tx:"0%",ty:"-50%"}}})();return u.jsxs(u.Fragment,{children:[u.jsx("span",{ref:f,className:"inline-flex",onMouseEnter:p,onMouseLeave:m,onFocus:p,onBlur:m,children:t}),a&&Pa.createPortal(u.jsx("div",{className:"fixed z-[9999] px-4 py-3 text-sm text-text-primary bg-bg-secondary border border-border rounded-lg shadow-xl max-w-sm break-words pointer-events-none",style:{top:_.top,left:_.left,transform:`translate(${_.tx}, ${_.ty})`},children:e}),document.body)]})}function am(e){return{contextWindow:e.contextWindow,temperature:e.temperature??null,topP:e.topP??null,topK:e.topK??null,maxTokens:e.maxTokens??null,supportsVision:e.supportsVision??null}}function J6({label:e,children:t}){return u.jsxs("div",{className:"space-y-3",children:[u.jsx("h4",{className:"text-sm font-medium text-text-secondary border-b border-border/50 pb-1",children:e}),t]})}function Go({label:e,value:t,onChange:n,min:s,max:a,step:o=1,helpText:c,defaultValue:l,profileDefault:h,tooltip:f}){const[p,m]=O.useState((t==null?void 0:t.toString())??""),[_,y]=O.useState(t===null);O.useEffect(()=>{m((t==null?void 0:t.toString())??""),y(t===null)},[t]);const w=b=>{if(m(b),b==="")n(null);else{const x=parseFloat(b);isNaN(x)||n(x)}},k=()=>{_?(y(!1),l!==void 0&&(m(l.toString()),n(l))):(y(!0),n(null))},v=u.jsxs("label",{className:"flex items-center gap-2 text-sm font-medium text-text-secondary mb-1",children:[f&&u.jsx(Q6,{content:f,children:u.jsx("span",{className:"inline-flex items-center justify-center w-4 h-4 text-xs text-text-muted hover:text-text-secondary cursor-help rounded-full border border-border/50",children:"?"})}),e,u.jsx("button",{type:"button",onClick:k,className:`text-xs px-1.5 py-0.5 rounded border ${_?"border-accent-primary/50 bg-accent-primary/10 text-accent-primary":"border-border text-text-muted hover:text-text-secondary"}`,title:_?"Click to set a custom value":"Click to use default",children:_?"default":"custom"})]});return u.jsxs("div",{children:[v,u.jsx("input",{type:"number",min:s,max:a,step:o,value:p,readOnly:_,onChange:b=>w(b.target.value),onClick:()=>_&&k(),placeholder:_?`${h!==void 0?h:"Using default"} (click to edit)`:"",className:`w-full bg-bg-tertiary border border-border rounded px-3 py-2 text-text-primary focus:outline-none focus:border-accent-primary ${_?"opacity-50 cursor-pointer":""}`}),c&&u.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[u.jsx("p",{className:"text-xs text-text-muted",children:c}),h!==void 0&&u.jsxs("span",{className:"text-xs text-text-muted/60",children:["(default: ",h,")"]})]}),!c&&h!==void 0&&u.jsxs("p",{className:"text-xs text-text-muted mt-1",children:["Profile default: ",h]})]})}function Z6({isOpen:e,onClose:t,providerId:n,model:s}){const[a,o]=O.useState(()=>am(s)),[c,l]=O.useState(!1),h=Lt(m=>m.updateModelSettings);O.useEffect(()=>{o(am(s))},[s]);const f=async()=>{if(a.contextWindow<1024||a.contextWindow>1e7)return;l(!0);const m=a.temperature!==(s.temperature??null)||a.topP!==(s.topP??null)||a.topK!==(s.topK??null)||a.maxTokens!==(s.maxTokens??null)||a.supportsVision!==(s.supportsVision??null);await h(n,s.id,{contextWindow:a.contextWindow,...m&&{temperature:a.temperature,topP:a.topP,topK:a.topK,maxTokens:a.maxTokens,supportsVision:a.supportsVision??void 0}}),l(!1),t()},p=()=>{o(am(s)),t()};return e?u.jsx(Nt,{isOpen:e,onClose:t,title:"Model Properties",size:"lg",footer:u.jsxs("div",{className:"flex justify-end gap-2",children:[u.jsx(rt,{variant:"secondary",onClick:p,disabled:c,children:"Cancel"}),u.jsx(rt,{variant:"primary",onClick:f,disabled:c||a.contextWindow<1024||a.contextWindow>1e7,children:c?"Saving...":"Save"})]}),children:u.jsxs("div",{className:"space-y-4",children:[u.jsxs("div",{children:[u.jsx("label",{className:"block text-sm font-medium text-text-secondary mb-1",children:"Model Name"}),u.jsx("p",{className:"text-text-primary bg-bg-tertiary px-3 py-2 rounded font-mono text-sm break-all",children:s.id})]}),u.jsx(Go,{label:"Context Window",value:a.contextWindow,onChange:m=>m!==null&&o(_=>({..._,contextWindow:m})),min:1024,max:1e7,helpText:"Range: 1,024 - 10,000,000 tokens"}),u.jsxs(J6,{label:"Sampling Parameters",children:[u.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[u.jsx(Go,{label:"Temperature",value:a.temperature,onChange:m=>o(_=>({..._,temperature:m})),min:0,max:2,step:.1,helpText:"0.0 - 2.0",defaultValue:1,profileDefault:s.defaultTemperature,tooltip:"How random the response is. Low (0.1-0.3) = precise and predictable. High (0.7-1.5) = creative and varied."}),u.jsx(Go,{label:"Top P",value:a.topP,onChange:m=>o(_=>({..._,topP:m})),min:0,max:1,step:.05,helpText:"0.0 - 1.0",defaultValue:1,profileDefault:s.defaultTopP,tooltip:"How to pick the next word. Low (0.5-0.8) = stick to obvious choices. High (0.95-1.0) = allow surprising words."})]}),u.jsx(Go,{label:"Top K",value:a.topK,onChange:m=>o(_=>({..._,topK:m})),min:1,max:200,helpText:"1 - 200 (leave as default if not supported)",profileDefault:s.defaultTopK,tooltip:"Restricts word choices to the top K most likely ones. Low (10-20) = focused. High (50-200) = diverse. Not all backends support this."})]}),u.jsx(Go,{label:"Max Tokens",value:a.maxTokens,onChange:m=>o(_=>({..._,maxTokens:m})),min:256,max:32e3,helpText:"Maximum tokens to generate per response",profileDefault:s.defaultMaxTokens,tooltip:"Longest response length. Higher values let the model write more, but use up your context window faster."}),u.jsxs("div",{children:[u.jsxs("label",{className:"flex items-center gap-2 text-sm font-medium text-text-secondary mb-1",children:[u.jsx("input",{type:"checkbox",checked:a.supportsVision??!1,onChange:m=>o(_=>({..._,supportsVision:m.target.checked})),className:"rounded border-border bg-bg-tertiary text-accent-primary focus:ring-accent-primary focus:ring-offset-0"}),"Vision Enabled"]}),u.jsx("p",{className:"text-xs text-text-muted",children:"Allow sending images directly to this model. Disable if the model doesn't support vision."})]}),u.jsxs("div",{children:[u.jsx("label",{className:"block text-sm font-medium text-text-secondary mb-1",children:"Source"}),u.jsxs("p",{className:"text-text-primary bg-bg-tertiary px-3 py-2 rounded text-sm",children:[s.source==="backend"&&"Auto-detected from backend",s.source==="user"&&"Manually set",s.source==="default"&&"Default value"]})]})]})}):null}function eB(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(0)}K`:`${e}`}function tB(){var J;const[,e]=wr(),t=Ce(K=>K.currentSession),n=Ce(K=>K.setSessionProvider),[s,a]=O.useState(!1),[o,c]=O.useState([]),[l,h]=O.useState(null),f=O.useRef(null),[p,m]=O.useState(null),_=O.useRef(new Set),y=Lt(K=>K.providers),w=Lt(K=>K.activeProviderId),k=Lt(K=>K.defaultModelSelection);Lt(K=>K.backend);const v=Lt(K=>K.activating),b=Lt(K=>K.activateProvider),x=Lt(K=>K.refreshModel),S=Lt(K=>K.refreshProviderModels);O.useEffect(()=>{function K(I){f.current&&!f.current.contains(I.target)&&(a(!1),c([]),_.current=new Set)}return document.addEventListener("mousedown",K),()=>document.removeEventListener("mousedown",K)},[]),O.useEffect(()=>{if(s){const K=y.map(I=>I.id);c(K),K.forEach(I=>{_.current.has(I)||(_.current.add(I),B(I))})}},[s,y]);const j=y.find(K=>K.id===w),N=(j==null?void 0:j.status)==="disconnected",T=k?k.split("/").pop()??null:null,D=T?((J=T.split("/").pop())==null?void 0:J.replace(/-/g," "))??T:"detecting...",A=(K,I)=>k?k===`${K}/${I}`:!1,B=async K=>{h(K);try{await S(K)}catch{}finally{h(null)}},R=K=>{o.includes(K.id)?c(o.filter(I=>I!==K.id)):(c([...o,K.id]),B(K.id))},$=async K=>{if(K.id===w){R(K);return}t?(n(K.id,void 0),Lt.getState().syncFromSession(K.id,""),a(!1),c([])):await b(K.id)&&(a(!1),c([]))},F=K=>{R(K)},W=async(K,I)=>{K.stopPropagation(),_.current.delete(I),await S(I),await B(I)},Y=(K,I)=>{m({providerId:K,model:I})},P=()=>{m(null)},H=async(K,I)=>{if(t){n(K,I),Lt.getState().syncFromSession(K,I),c([]),a(!1);return}h("activating");try{Lt.getState().syncFromSession(K,I),c([]),a(!1);const L=await je(`/api/providers/${K}/activate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:I})});if(L.ok){const z=await L.json();Lt.getState().syncFromSession(z.activeProviderId,z.model)}}catch{}finally{h(null)}};return y.length===0?u.jsxs("button",{type:"button",onClick:()=>x(),className:"flex items-center gap-1 px-1.5 py-0.5 rounded hover:bg-bg-tertiary transition-colors group",title:N?"LLM server is offline. Click to retry.":T??"Click to refresh model",children:[N?u.jsx("span",{className:"text-sm text-accent-error animate-pulse",children:"LLM offline"}):u.jsx("span",{className:"text-sm text-accent-primary",children:D}),u.jsx("span",{className:"text-text-muted opacity-0 group-hover:opacity-100 transition-opacity",children:"↻"})]}):u.jsxs("div",{className:"relative",ref:f,children:[u.jsxs("button",{type:"button",onClick:()=>a(!s),className:"flex items-center gap-1 px-1.5 py-0.5 rounded hover:bg-bg-tertiary transition-colors group",title:"Click to switch provider or model",children:[N?u.jsx("span",{className:"text-sm text-accent-error animate-pulse",children:"offline"}):u.jsx("span",{className:"text-sm text-accent-primary",children:D}),u.jsx(Ir,{className:"w-3 h-3 text-text-muted transition-transform",rotate:s?180:0})]}),s&&u.jsxs("div",{className:"absolute bottom-full right-0 mb-1 w-72 bg-bg-secondary border border-border rounded-lg shadow-lg z-50 overflow-hidden max-h-[80vh] overflow-y-auto",children:[u.jsx("div",{className:"py-1",children:y.map(K=>{var I;return u.jsxs("div",{children:[u.jsxs("div",{className:`px-3 py-2 flex items-center justify-between ${K.id===w?"bg-bg-tertiary":"hover:bg-bg-tertiary"} ${v?"opacity-50 cursor-wait":"cursor-pointer"}`,children:[u.jsxs("div",{onClick:()=>!v&&$(K),className:"flex flex-col min-w-0 flex-1 cursor-pointer",children:[u.jsx("span",{className:`text-sm font-medium truncate ${K.id===w?"text-accent-primary":"text-text-primary"}`,children:K.name}),u.jsx("span",{className:"text-xs text-text-muted truncate",children:K.backend!=="auto"&&k2(K.backend)})]}),u.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[K.id===w?u.jsx("span",{className:"text-accent-success",title:"Active",children:u.jsx(Mr,{className:"w-4 h-4"})}):u.jsx("span",{className:"w-4"}),u.jsx("button",{type:"button",onClick:L=>{L.stopPropagation(),W(L,K.id)},className:"p-0.5 hover:bg-bg-tertiary rounded transition-colors",title:"Refresh models",children:u.jsx(tS,{className:`w-4 h-4 ${l===K.id?"animate-spin":""} ${K.id===w?"text-accent-primary":"text-text-muted"}`})}),u.jsx("button",{type:"button",onClick:L=>{L.stopPropagation(),F(K)},className:"p-0.5 hover:bg-bg-tertiary rounded transition-colors",title:"Show models",children:u.jsx(Ir,{className:`w-4 h-4 transition-transform ${o.includes(K.id)?"rotate-180":""} ${K.id===w?"text-accent-primary":"text-text-muted"}`})})]})]}),o.includes(K.id)&&u.jsx("div",{className:"bg-bg-primary border-t border-border max-h-40 overflow-y-auto",children:l===K.id?u.jsx("div",{className:"px-4 py-2 text-xs text-text-muted",children:"Loading models..."}):(I=K.models)!=null&&I.length?K.models.map(L=>{var z;return u.jsxs("button",{type:"button",onClick:()=>H(K.id,L.id),disabled:l==="activating",className:`w-full px-4 py-1.5 text-left hover:bg-bg-tertiary transition-colors text-sm flex items-center justify-between group ${l==="activating"?"opacity-50 cursor-wait":""} ${A(K.id,L.id)?"text-accent-primary":"text-text-secondary"}`,children:[u.jsx("span",{className:"truncate flex-1",children:((z=L.id.split("/").pop())==null?void 0:z.replace(/-/g," "))??L.id}),u.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[u.jsx("span",{className:"text-xs text-text-muted",children:eB(L.contextWindow)}),u.jsx("button",{type:"button",onClick:V=>{V.stopPropagation(),Y(K.id,L)},className:"opacity-0 group-hover:opacity-100 p-0.5 hover:bg-bg-tertiary rounded transition-opacity",title:"Edit model context",children:u.jsx(Z2,{className:"w-3 h-3 text-text-muted"})})]}),A(K.id,L.id)&&u.jsx("span",{className:"text-accent-success flex-shrink-0 ml-1",children:u.jsx(Mr,{className:"w-3.5 h-3.5"})})]},L.id)}):u.jsx("div",{className:"px-4 py-2 text-xs text-text-muted",children:"No models available"})})]},K.id)})}),u.jsx("div",{className:"border-t border-border px-3 py-2",children:u.jsx("button",{onClick:()=>e("/onboarding"),className:"text-xs text-accent-primary hover:underline",children:"Manage providers"})})]}),p&&u.jsx(Z6,{isOpen:!0,onClose:P,providerId:p.providerId,model:p.model})]})}function nB(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function rB({onClick:e}){return u.jsx("button",{type:"button",onClick:e,className:"p-1.5 rounded text-text-muted hover:text-text-primary hover:bg-bg-primary transition-colors",title:"View",children:u.jsx(Eu,{})})}function hC({isOpen:e,onClose:t,initialEditId:n}){const s=an(ye=>ye.defaults),a=an(ye=>ye.userItems),o=an(ye=>ye.projectItems),c=an(ye=>ye.loading),l=an(ye=>ye.fetchCommands),h=an(ye=>ye.fetchCommand),f=an(ye=>ye.fetchDefaultContent),p=an(ye=>ye.createCommand),m=an(ye=>ye.updateCommand),_=an(ye=>ye.deleteCommand),[y,w]=O.useState(null),[k,v]=O.useState(null),{view:b,editingId:x,formError:S,saving:j,formData:N,setView:T,setEditingId:D,setFormError:A,setFormData:B,setSaving:R}=fS(),{requestDelete:$,clearConfirm:F,isConfirming:W}=rp(),Y=O.useRef(!1),P=Ot(ye=>ye.defaults),H=Ot(ye=>ye.userItems),J=Ot(ye=>ye.fetchAgents),I=[...P,...H].filter(ye=>!ye.subagent),L=O.useRef(l),z=O.useRef(J),V=O.useRef(h),U=O.useRef(f),ee=O.useRef(n),Z=O.useRef(T),ne=O.useRef(D),X=O.useRef(A),G=O.useRef(F);O.useEffect(()=>{L.current=l,z.current=J,V.current=h,U.current=f,ee.current=n,Z.current=T,ne.current=D,X.current=A,G.current=F}),O.useEffect(()=>{if(e)if(L.current(),z.current(),Y.current||(G.current(),Y.current=!0),ee.current){const ye=s.some(Ne=>Ne.id===ee.current);Z.current("edit"),ne.current(ee.current),X.current(""),ye?U.current(ee.current).then(Ne=>{Ne&&B({name:Ne.metadata.name+" (copy)",id:`${ee.current}-copy-${Date.now()}`,prompt:Ne.prompt,agentMode:Ne.metadata.agentMode??"",isDefault:!0,destination:"user"})}):V.current(ee.current).then(Ne=>{Ne&&B({name:Ne.metadata.name,id:Ne.metadata.id,prompt:Ne.prompt,agentMode:Ne.metadata.agentMode??"",isDefault:!1,destination:"user"})})}else Z.current("list"),ne.current(null);else Y.current=!1},[e]);const le=async ye=>{w(ye);const Ne=await f(ye);v((Ne==null?void 0:Ne.prompt)??null)},se=async ye=>{if(s.some(fe=>fe.id===ye)){const fe=await f(ye);fe&&(D(null),B({name:`${fe.metadata.name} (copy)`,id:`${ye}-copy-${Date.now()}`,prompt:fe.prompt,agentMode:fe.metadata.agentMode??"",isDefault:!0,destination:"user"}),A(""),T("edit"))}else{const fe=await h(ye);fe&&(D(null),B({name:`${fe.metadata.name} (copy)`,id:`${ye}-copy-${Date.now()}`,prompt:fe.prompt,agentMode:fe.metadata.agentMode??"",isDefault:!1,destination:"user"}),A(""),T("edit"))}},ve=()=>{B({name:"",id:"",prompt:"",agentMode:"",isDefault:!1,destination:"user"}),D(null),T("edit")},be=async ye=>{const Ne=await h(ye);Ne&&(D(ye),B({name:Ne.metadata.name,id:Ne.metadata.id,prompt:Ne.prompt,agentMode:Ne.metadata.agentMode??"",isDefault:!1,destination:"user"}),A(""),T("edit"))},Oe=async ye=>{await _(ye),F()},Be=async()=>{const ye=x??N.id;if(!ye||!N.name||!N.prompt){A("Name and message are required.");return}R(!0),A("");const Ne={metadata:{id:ye,name:N.name,...N.agentMode?{agentMode:N.agentMode}:{}},prompt:N.prompt},fe=x?await m(x,Ne):await p(Ne,N.destination);if(R(!1),!fe.success){A(fe.error??"Failed to save command.");return}n?t():T("list")},Pe=()=>{n?t():(T("list"),w(null),v(null))},Ve=ye=>{B(Ne=>({...Ne,name:ye})),(!x||N.isDefault)&&B(Ne=>({...Ne,id:nB(ye)}))},Ae=()=>{w(null),v(null),T("list")},dt=()=>{y&&(w(null),T("edit"),D(y),f(y).then(ye=>{ye&&B({name:`${ye.metadata.name} (copy)`,id:`${y}-copy-${Date.now()}`,prompt:ye.prompt,agentMode:ye.metadata.agentMode??"",isDefault:!0,destination:"user"})}))};if(y){const ye=s.find(Ne=>Ne.id===y);return u.jsx(Nt,{isOpen:e,onClose:Ae,title:`Default: ${(ye==null?void 0:ye.name)??y}`,size:"xl",children:u.jsxs("div",{className:"flex flex-col h-full",children:[u.jsxs("div",{className:"space-y-3 mb-3",children:[u.jsxs("div",{className:"flex items-center gap-2 text-xs text-text-muted",children:[u.jsx("span",{className:"px-1.5 py-0.5 rounded bg-bg-tertiary text-text-secondary",children:"Built-in"}),u.jsx("span",{className:"font-mono",children:y})]}),u.jsxs("div",{children:[u.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Name"}),u.jsx("div",{className:"px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm",children:ye==null?void 0:ye.name})]}),u.jsxs("div",{children:[u.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Agent Mode"}),u.jsx("div",{className:"px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm text-text-muted",children:(ye==null?void 0:ye.agentMode)||"None"})]})]}),u.jsxs("div",{className:"flex-1 min-h-[120px] border-t border-border pt-3 flex flex-col",children:[u.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Message"}),u.jsx("textarea",{value:k??"",readOnly:!0,placeholder:"...",className:"flex-1 w-full px-3 py-2 bg-bg-tertiary border border-border rounded text-sm font-mono resize-none opacity-60"})]}),u.jsxs("div",{className:"flex justify-end gap-2 pt-3 mt-3 border-t border-border flex-shrink-0",children:[u.jsx(rt,{variant:"secondary",onClick:Ae,children:"Close"}),u.jsx(rt,{variant:"primary",onClick:dt,children:"Duplicate & Customize"})]})]})})}if(b==="edit")return u.jsx(Nt,{isOpen:e,onClose:Pe,title:x?"Edit Command":"New Command",size:"xl",children:u.jsxs("div",{className:"flex flex-col h-full",children:[S&&u.jsx(ap,{message:S}),u.jsxs("div",{className:"space-y-3 mb-3",children:[u.jsx(hS,{name:N.name,id:N.id,nameLabel:"Name",idLabel:"ID",namePlaceholder:"My Command",idPlaceholder:"my-command",readOnlyId:!!x&&!N.isDefault,onNameChange:Ve,onIdChange:ye=>B(Ne=>({...Ne,id:ye}))}),u.jsxs("div",{children:[u.jsxs("label",{className:"block text-xs text-text-secondary mb-1",children:["Agent Mode ",u.jsx("span",{className:"text-text-muted",children:"(optional)"})]}),u.jsxs("select",{value:N.agentMode,onChange:ye=>B(Ne=>({...Ne,agentMode:ye.target.value})),className:"w-full px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm focus:outline-none focus:ring-1 focus:ring-accent-primary",children:[u.jsx("option",{value:"",children:"None (keep current mode)"}),I.map(ye=>u.jsx("option",{value:ye.id,children:ye.name},ye.id))]})]}),!x&&u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("label",{className:"text-xs text-text-secondary",children:"Save to:"}),u.jsxs("select",{value:N.destination,onChange:ye=>B(Ne=>({...Ne,destination:ye.target.value})),className:"px-2 py-1 bg-bg-tertiary border border-border rounded text-xs focus:outline-none focus:ring-1 focus:ring-accent-primary",children:[u.jsx("option",{value:"user",children:"Global config"}),u.jsx("option",{value:"project",children:"Project (.openfox/)"})]})]})]}),u.jsxs("div",{className:"flex-1 min-h-[120px] border-t border-border pt-3 flex flex-col",children:[u.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Message"}),u.jsx("textarea",{value:N.prompt,onChange:ye=>B(Ne=>({...Ne,prompt:ye.target.value})),placeholder:"The message that will be sent when this command is triggered...",className:"h-80 w-full px-3 py-2 bg-bg-tertiary border border-border rounded text-sm font-mono resize-y focus:outline-none focus:ring-1 focus:ring-accent-primary"})]}),u.jsxs("div",{className:"flex justify-end gap-2 pt-3 mt-3 border-t border-border flex-shrink-0",children:[u.jsx(rt,{variant:"secondary",onClick:Pe,children:"Cancel"}),u.jsx(rt,{variant:"primary",onClick:Be,disabled:j||!N.name||!N.prompt,children:j?"Saving...":"Save"})]})]})});const lt=ye=>ye.map(Ne=>u.jsxs("div",{className:"flex items-center justify-between p-3 rounded border border-border bg-bg-tertiary",children:[u.jsx("div",{className:"min-w-0 flex-1 mr-3",children:u.jsx("div",{className:"flex items-center gap-2",children:u.jsx("span",{className:"text-text-primary text-sm font-medium",children:Ne.name})})}),u.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[u.jsx(La,{onClick:()=>be(Ne.id)}),u.jsx(tl,{onClick:()=>se(Ne.id)}),W(Ne.id,"delete")?u.jsx(sp,{onConfirm:()=>Oe(Ne.id),onCancel:F}):u.jsx(ip,{onClick:()=>$(Ne.id)})]})]},Ne.id));return u.jsxs(Nt,{isOpen:e,onClose:t,title:"Commands",size:"lg",children:[u.jsx(cS,{description:"Commands are pre-defined messages you can send with a single click.",onNew:ve}),u.jsxs(dS,{loading:c,hasItems:s.length>0||a.length>0||o.length>0,loadingLabel:"Loading commands...",emptyLabel:"No commands created yet.",children:[s.length>0&&u.jsxs("div",{children:[u.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:"Built-in"}),u.jsx("div",{className:"space-y-2",children:s.map(ye=>u.jsxs("div",{className:"flex items-center justify-between p-3 rounded border border-border bg-bg-tertiary",children:[u.jsx("div",{className:"min-w-0 flex-1 mr-3",children:u.jsx("span",{className:"text-text-primary text-sm font-medium",children:ye.name})}),u.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[u.jsx(rB,{onClick:()=>le(ye.id)}),u.jsx(tl,{onClick:()=>se(ye.id)})]})]},ye.id))})]}),a.length>0&&u.jsx(lS,{children:lt(a)}),o.length>0&&u.jsxs("div",{className:"mt-4",children:[u.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:"Project"}),u.jsx("div",{className:"space-y-2",children:lt(o)})]})]})]})}function sB(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function iB(e){let t=1;for(;e.some(n=>n.id===`s${t}`);)t++;return`s${t}`}const aB=[{value:"agent",label:"Agent"},{value:"sub_agent",label:"Sub-Agent"},{value:"shell",label:"Shell"}],fC={all_criteria_passed:"All passed",all_criteria_completed_or_passed:"All completed",any_criteria_blocked:"Blocked",has_pending_criteria:"Pending/Failed",step_result:"Result",always:"Always"},mC=[{value:"all_criteria_passed",label:"All criteria passed"},{value:"all_criteria_completed_or_passed",label:"All criteria completed or passed"},{value:"any_criteria_blocked",label:"Any criteria blocked (retry limit)"},{value:"has_pending_criteria",label:"Has pending or failed criteria"},{value:"step_result",label:"Step result is..."},{value:"always",label:"Always (fallback)"}],fi=150,is=54,ba=80,qn=30,Sa=70,T0=100,mi=50,Yc=50,N0=4;function qp(e,t){if(e.type==="agent"){const n=t.find(s=>s.id===e.toolMode);return{name:(n==null?void 0:n.name)??(e.toolMode||"Agent"),color:(n==null?void 0:n.color)||"#3b82f6"}}if(e.type==="sub_agent"){const n=t.find(s=>s.id===e.subAgentType);return{name:(n==null?void 0:n.name)??(e.subAgentType||"Sub-Agent"),color:(n==null?void 0:n.color)||"#a855f7"}}return{name:"Shell",color:"#22c55e"}}function oB(e,t,n,s){const a=Yc+mi+fi+T0+fi+mi+Yc,o=a/2,c=Yc+mi+fi/2,l=Yc+mi+fi+T0+fi/2,h=[],f=[],p=new Map,m=e.filter(Y=>Y.type==="agent"||Y.type==="shell"),_=e.filter(Y=>Y.type==="sub_agent"),y=_.length>0,w=y?c:o,k=m.length>0?l:o,v=mi+qn/2;if(h.push({id:"$start",type:"terminal",label:"Start",cx:w,cy:v,w:ba,h:qn}),p.set("$start",{cx:w,cy:v,w:ba,h:qn}),e.length===0){const Y=v+qn/2+Sa*2+qn/2;return h.push({id:"$done",type:"terminal",label:"Done",cx:w,cy:Y,w:ba,h:qn}),p.set("$done",{cx:w,cy:Y,w:ba,h:qn}),{nodes:h,edges:f,width:a,height:Y+qn/2+mi,posMap:p}}const b=v+qn/2+Sa,x=(Y,P)=>{Y.forEach((H,J)=>{const K=b+J*(is+Sa)+is/2,{name:I,color:L}=qp(H,s);h.push({id:H.id,type:"step",label:I,color:L,cx:P,cy:K,w:fi,h:is}),p.set(H.id,{cx:P,cy:K,w:fi,h:is})})};x(m,w),x(_,k);const S=m.length>0?b+(m.length-1)*(is+Sa)+is/2:v,j=y?b+(_.length-1)*(is+Sa)+is/2:v,N=Math.max(S,j)+is/2+Sa+qn/2;h.push({id:"$done",type:"terminal",label:"Done",cx:w,cy:N,w:ba,h:qn}),p.set("$done",{cx:w,cy:N,w:ba,h:qn});const T=[];t&&p.has(t)&&T.push({from:"$start",to:t,label:n,edgeKey:"start",direction:"down",backEdgeIndex:0});let D=0;for(const Y of e)Y.transitions.forEach((P,H)=>{if(!P.goto||!p.has(P.goto))return;const J=p.get(Y.id),K=p.get(P.goto),I=P.when.type==="step_result"?`${P.when.result}`:fC[P.when.type]??P.when.type,L=Y.id===P.goto;let z;L?z="back":K.cy>J.cy+1?z="down":K.cy<J.cy-1?z="back":z="same",T.push({from:Y.id,to:P.goto,label:I,edgeKey:`${Y.id}:${H}`,direction:z,backEdgeIndex:z==="back"?D++:0})});const A=new Map,B=new Map,R=new Map,$=new Map;for(const Y of T)Y.direction==="down"&&(A.set(Y.from,(A.get(Y.from)??0)+1),B.set(Y.to,(B.get(Y.to)??0)+1));const F=new Map,W=new Map;for(const Y of T){if(Y.direction!=="same")continue;const P=[Y.from,Y.to].sort().join("|");F.set(P,(F.get(P)??0)+1)}for(const Y of T){if(Y.direction==="back"||Y.direction==="same"){let z=0;if(Y.direction==="same"){const V=[Y.from,Y.to].sort().join("|");z=W.get(V)??0,W.set(V,z+1)}f.push({...Y,fromPort:0,toPort:0,sameEdgeIndex:z});continue}const P=A.get(Y.from)??1,H=B.get(Y.to)??1,J=R.get(Y.from)??0,K=$.get(Y.to)??0;R.set(Y.from,J+1),$.set(Y.to,K+1);const I=P===1?0:-.6+1.2*J/(P-1),L=H===1?0:-.6+1.2*K/(H-1);f.push({...Y,fromPort:I,toPort:L,sameEdgeIndex:0})}return{nodes:h,edges:f,width:a,height:N+qn/2+mi,posMap:p}}function lB({steps:e,entryStep:t,selectedNodeId:n,selectedEdgeKey:s,startConditionLabel:a,agentTypes:o,isReadOnly:c,onSelectNode:l,onSelectEdge:h,onRemoveStep:f,onCreateTransition:p,onReconnectTo:m,onReconnectFrom:_,onDeleteTransition:y}){const w=O.useRef(null),k=O.useRef(!1),[v,b]=O.useState(null),[x,S]=O.useState(null),[j,N]=O.useState(null),{nodes:T,edges:D,width:A,height:B,posMap:R}=O.useMemo(()=>oB(e,t,a,o),[e,t,a,o]),$=O.useCallback(Z=>{var se;const ne=w.current;if(!ne)return{x:0,y:0};const X=ne.createSVGPoint();X.x=Z.clientX,X.y=Z.clientY;const G=(se=ne.getScreenCTM())==null?void 0:se.inverse();if(!G)return{x:0,y:0};const le=X.matrixTransform(G);return{x:le.x,y:le.y}},[]),F=O.useCallback(Z=>!Z||!x||Z==="$start"?!1:x.type==="reconnect-from"?Z!=="$done":!0,[x]),W=O.useCallback((Z,ne)=>{if(c)return;Z.stopPropagation(),Z.preventDefault();const X=$(Z);S({type:"new",fromNodeId:ne,mouseX:X.x,mouseY:X.y})},[$,c]),Y=O.useCallback((Z,ne)=>{if(c)return;Z.stopPropagation(),Z.preventDefault();const X=$(Z);S({type:"reconnect-to",fromNodeId:ne.from,edgeKey:ne.edgeKey,mouseX:X.x,mouseY:X.y})},[$,c]),P=O.useCallback((Z,ne)=>{if(c)return;Z.stopPropagation(),Z.preventDefault();const X=$(Z);S({type:"reconnect-from",fromNodeId:ne.from,fixedTargetId:ne.to,edgeKey:ne.edgeKey,mouseX:X.x,mouseY:X.y})},[$,c]),H=O.useCallback(Z=>{if(!x)return;const ne=$(Z);S(X=>X?{...X,mouseX:ne.x,mouseY:ne.y}:null)},[x,$]),J=O.useCallback(()=>{x&&(k.current=!0,j&&F(j)&&(x.type==="new"?p(x.fromNodeId,j):x.type==="reconnect-to"?m(x.edgeKey,j):x.type==="reconnect-from"&&_(x.edgeKey,j)),S(null),N(null))},[x,j,F,p,m,_]),K=O.useCallback(()=>{if(k.current){k.current=!1;return}l(null),h(null)},[l,h]);O.useEffect(()=>{if(c)return;const Z=ne=>{ne.target instanceof HTMLInputElement||ne.target instanceof HTMLTextAreaElement||ne.target instanceof HTMLSelectElement||(ne.key==="Delete"||ne.key==="Backspace")&&s&&s!=="start"&&(ne.preventDefault(),y(s),h(null))};return document.addEventListener("keydown",Z),()=>document.removeEventListener("keydown",Z)},[c,s,y,h]);const I=Z=>{const ne=R.get(Z.from),X=R.get(Z.to);if(!ne||!X)return null;let G,le,se,ve="middle",be,Oe;if(Z.direction==="down"){const Be=ne.cx+Z.fromPort*(ne.w/2-10),Pe=ne.cy+ne.h/2,Ve=X.cx+Z.toPort*(X.w/2-10),Ae=X.cy-X.h/2,dt=Ae-Pe,lt=Ve-Be;G=`M ${Be} ${Pe} C ${Be} ${Pe+dt*.4}, ${Ve-lt*.2} ${Ae-dt*.1}, ${Ve} ${Ae}`,le=Be+(Ve-Be)*.5,se=Pe+dt*.6,be={x:Be,y:Pe},Oe={x:Ve,y:Ae}}else if(Z.direction==="back"){const Be=Z.from===Z.to,Pe=ne.cx>=A/2,Ve=Z.backEdgeIndex*16,Ae=Pe?A-20-Ve:20+Ve;if(Be){const dt=ne.cx>=A/2,lt=30+Z.backEdgeIndex*14,ye=ne.cy-ne.h/2,Ne=dt?ne.cx+ne.w/2:ne.cx-ne.w/2,fe=dt?Ne+lt:Ne-lt,De=ne.cx+(dt?ne.w/4:-ne.w/4),ze=ye-20-Z.backEdgeIndex*10;G=`M ${Ne} ${ne.cy} C ${fe} ${ne.cy}, ${fe} ${ze}, ${De} ${ye}`,le=fe+10,se=ze+4,ve="middle",be={x:Ne,y:ne.cy},Oe={x:De,y:ye}}else{const dt=Pe?ne.cx+ne.w/2:ne.cx-ne.w/2,lt=X.cx+(Pe?X.w/4:-X.w/4),ye=Math.min(ne.cy,X.cy)-X.h/2-18-Z.backEdgeIndex*14;G=`M ${dt} ${ne.cy} L ${Ae} ${ne.cy} L ${Ae} ${ye} L ${lt} ${ye} L ${lt} ${X.cy-X.h/2}`,le=Ae,se=(ne.cy+ye)/2,ve=Pe?"start":"end",be={x:dt,y:ne.cy},Oe={x:lt,y:X.cy-X.h/2}}}else{const Be=X.cx>ne.cx,Pe=Z.sameEdgeIndex===0?-12:12,Ve=Be?ne.cx+ne.w/2:ne.cx-ne.w/2,Ae=Be?X.cx-X.w/2:X.cx+X.w/2,dt=ne.cy+Pe,lt=X.cy+Pe,ye=(Ve+Ae)/2;G=`M ${Ve} ${dt} C ${ye} ${dt}, ${ye} ${lt}, ${Ae} ${lt}`,le=ye,se=(dt+lt)/2-6,be={x:Ve,y:dt},Oe={x:Ae,y:lt}}return{path:G,labelX:le,labelY:se,labelAnchor:ve,fromPt:be,toPt:Oe}},L=(Z,ne)=>{const X=I(Z);if(!X)return null;const{path:G,labelX:le,labelY:se,labelAnchor:ve}=X,be=s===Z.edgeKey,Oe=Z.label&&!(Z.from==="$start"&&Z.label==="Always");return u.jsxs("g",{children:[u.jsx("path",{d:G,fill:"none",stroke:"transparent",strokeWidth:14,className:"cursor-pointer",onClick:Be=>{Be.stopPropagation(),h(be?null:Z.edgeKey)}}),u.jsx("path",{d:G,fill:"none",stroke:be?"#58a6ff":"#484f58",strokeWidth:be?2.2:1.2,markerEnd:be?"url(#arrow-selected)":"url(#arrow)",pointerEvents:"none"}),Oe&&u.jsx("text",{x:le+(ve==="start"?5:ve==="end"?-5:0),y:se+3,textAnchor:ve,className:"text-[8px]",fill:be?"#79c0ff":"#8b949e",style:{paintOrder:"stroke",stroke:"#0d1117",strokeWidth:3,strokeLinejoin:"round"},pointerEvents:"none",children:Z.label})]},ne)},z=()=>{if(!s||x)return null;const Z=D.find(se=>se.edgeKey===s);if(!Z)return null;const ne=I(Z);if(!ne)return null;const{fromPt:X,toPt:G}=ne,le=6;return u.jsxs(u.Fragment,{children:[Z.edgeKey!=="start"&&u.jsx("circle",{cx:X.x,cy:X.y,r:le,fill:"#58a6ff",fillOpacity:.25,stroke:"#58a6ff",strokeWidth:2,strokeOpacity:.8,className:"cursor-grab",onMouseDown:se=>P(se,Z)}),u.jsx("circle",{cx:G.x,cy:G.y,r:le,fill:"#58a6ff",fillOpacity:.25,stroke:"#58a6ff",strokeWidth:2,strokeOpacity:.8,className:"cursor-grab",onMouseDown:se=>Y(se,Z)})]})},V=()=>{if(!x)return null;let Z,ne,X,G;if(x.type==="reconnect-from"){const ve=R.get(x.fixedTargetId);if(!ve)return null;Z=x.mouseX,ne=x.mouseY,X=ve.cx,G=ve.cy-ve.h/2}else{const ve=R.get(x.fromNodeId);if(!ve)return null;Z=ve.cx,ne=ve.cy+ve.h/2,X=x.mouseX,G=x.mouseY}const le=G-ne,se=Math.abs(le)>10?`M ${Z} ${ne} C ${Z} ${ne+le*.4}, ${X} ${G-le*.4}, ${X} ${G}`:`M ${Z} ${ne} L ${X} ${G}`;return u.jsx("path",{d:se,fill:"none",stroke:"#58a6ff",strokeWidth:2,strokeDasharray:"6 3",strokeOpacity:.7,pointerEvents:"none"})},U=Z=>{const ne=Z.cy+Z.h/2,X=(x==null?void 0:x.fromNodeId)===Z.id;return u.jsx("circle",{cx:Z.cx,cy:ne,r:N0,fill:X?"#58a6ff":"#1c2128",stroke:X?"#58a6ff":"#484f58",strokeWidth:1.5,strokeOpacity:X?1:.5,className:"cursor-crosshair",onMouseDown:G=>W(G,Z.id)})},ee=Z=>{const ne=Z.cy-Z.h/2,X=x&&j===Z.id&&F(Z.id);return u.jsx("circle",{cx:Z.cx,cy:ne,r:N0,fill:X?"#3fb950":"#1c2128",stroke:X?"#3fb950":"#484f58",strokeWidth:1.5,strokeOpacity:X?1:.5})};return u.jsxs("svg",{ref:w,viewBox:`0 0 ${A} ${B}`,className:"block w-full",preserveAspectRatio:"xMidYMin meet",onMouseMove:H,onMouseUp:J,onClick:K,children:[u.jsxs("defs",{children:[u.jsx("marker",{id:"arrow",viewBox:"0 0 10 7",refX:"10",refY:"3.5",markerWidth:"7",markerHeight:"5",orient:"auto",children:u.jsx("polygon",{points:"0 0, 10 3.5, 0 7",fill:"#484f58"})}),u.jsx("marker",{id:"arrow-selected",viewBox:"0 0 10 7",refX:"10",refY:"3.5",markerWidth:"7",markerHeight:"5",orient:"auto",children:u.jsx("polygon",{points:"0 0, 10 3.5, 0 7",fill:"#58a6ff"})})]}),D.map((Z,ne)=>L(Z,ne)),T.map(Z=>{const ne=n===Z.id,X=Z.cx-Z.w/2,G=Z.cy-Z.h/2,le=v===Z.id,se=x&&j===Z.id&&F(Z.id);if(Z.type==="terminal"){const be=Z.id==="$start",Oe=be?"#58a6ff":"#3fb950",Be=be,Pe=!be;return u.jsxs("g",{onClick:Ve=>{Ve.stopPropagation(),be&&!c&&h("start")},className:be&&!c?"cursor-pointer":void 0,children:[se&&u.jsx("rect",{x:X-3,y:G-3,width:Z.w+6,height:Z.h+6,rx:Z.h/2+3,fill:"none",stroke:"#3fb950",strokeOpacity:.6,strokeWidth:2}),be&&s==="start"&&u.jsx("rect",{x:X-3,y:G-3,width:Z.w+6,height:Z.h+6,rx:Z.h/2+3,fill:"none",stroke:"#58a6ff",strokeOpacity:.5,strokeWidth:2}),u.jsx("rect",{x:X,y:G,width:Z.w,height:Z.h,rx:Z.h/2,fill:Oe,fillOpacity:.08,stroke:Oe,strokeOpacity:.4,strokeWidth:1.5}),u.jsx("text",{x:Z.cx,y:Z.cy+4,textAnchor:"middle",fill:Oe,className:"text-[10px] font-medium",pointerEvents:"none",children:Z.label}),Be&&U(Z),Pe&&ee(Z)]},Z.id)}const ve=Z.color??"#6b7280";return u.jsxs("g",{onClick:be=>{be.stopPropagation(),c||l(ne?null:Z.id)},onMouseEnter:()=>b(Z.id),onMouseLeave:()=>b(null),className:c?void 0:"cursor-pointer",children:[se&&u.jsx("rect",{x:X-3,y:G-3,width:Z.w+6,height:Z.h+6,rx:12,fill:"none",stroke:"#3fb950",strokeOpacity:.6,strokeWidth:2}),ne&&u.jsx("rect",{x:X-3,y:G-3,width:Z.w+6,height:Z.h+6,rx:12,fill:"none",stroke:"#58a6ff",strokeOpacity:.5,strokeWidth:2}),u.jsx("rect",{x:X,y:G,width:Z.w,height:Z.h,rx:10,fill:ve,fillOpacity:.08,stroke:ve,strokeOpacity:.6,strokeWidth:ne?2:1.5}),u.jsx("text",{x:Z.cx,y:Z.cy+4,textAnchor:"middle",fill:"#c9d1d9",className:"text-[11px] font-medium",pointerEvents:"none",children:Z.label}),!c&&U(Z),!c&&ee(Z),le&&!x&&!c&&u.jsxs("g",{onClick:be=>{be.stopPropagation(),f(Z.id)},className:"cursor-pointer",children:[u.jsx("circle",{cx:X+Z.w-2,cy:G+2,r:8,fill:"#0d1117",fillOpacity:.9,stroke:"#f85149",strokeOpacity:.5,strokeWidth:1}),u.jsx("line",{x1:X+Z.w-5,y1:G-1,x2:X+Z.w+1,y2:G+5,stroke:"#f85149",strokeWidth:1.5,strokeLinecap:"round"}),u.jsx("line",{x1:X+Z.w+1,y1:G-1,x2:X+Z.w-5,y2:G+5,stroke:"#f85149",strokeWidth:1.5,strokeLinecap:"round"})]})]},Z.id)}),x&&T.map(Z=>F(Z.id)?u.jsx("rect",{x:Z.cx-Z.w/2-8,y:Z.cy-Z.h/2-8,width:Z.w+16,height:Z.h+16,fill:"transparent",rx:12,onMouseEnter:()=>N(Z.id),onMouseLeave:()=>N(null),onMouseUp:ne=>{ne.stopPropagation(),J()}},`drop-${Z.id}`):null),V(),z()]})}const vr="w-full px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm focus:outline-none focus:ring-1 focus:ring-accent-primary",Ci="w-full px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm focus:outline-none focus:ring-1 focus:ring-accent-primary",vn="block text-[11px] text-text-secondary mb-0.5";function cB({fromLabel:e,toLabel:t,condition:n,fromStep:s,agentTypes:a,onUpdateCondition:o,onDelete:c}){const l=s&&(s.type==="sub_agent"||s.type==="agent")?a.find(f=>f.id===(s.type==="sub_agent"?s.subAgentType:s.toolMode)):void 0,h=(l==null?void 0:l.results)&&l.results.length>0;return u.jsxs("div",{className:"space-y-3 text-sm",children:[u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold bg-blue-500/15 text-blue-300",children:"Transition"}),u.jsx("button",{onClick:c,className:"p-1 rounded text-text-muted hover:text-accent-error text-xs",children:"Delete"})]}),u.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-text-secondary",children:[u.jsx("span",{className:"font-medium text-text-primary",children:e}),u.jsx(Z0,{}),u.jsx("span",{className:"font-medium text-text-primary",children:t})]}),u.jsxs("div",{children:[u.jsx("label",{className:vn,children:"Condition"}),u.jsx("select",{value:n.type,onChange:f=>{o(f.target.value==="step_result"?{type:"step_result",result:"success"}:{type:f.target.value})},className:Ci,children:mC.map(f=>u.jsx("option",{value:f.value,children:f.label},f.value))})]}),n.type==="step_result"&&u.jsxs("div",{children:[u.jsx("label",{className:vn,children:"Result"}),h?u.jsx("select",{value:n.result??l.results[0],onChange:f=>{o({type:"step_result",result:f.target.value})},className:Ci,children:l.results.map(f=>u.jsx("option",{value:f,children:f},f))}):u.jsx("input",{type:"text",value:n.result??"success",onChange:f=>o({type:"step_result",result:f.target.value}),placeholder:"e.g. success, passed, failed",className:vr})]}),u.jsx("p",{className:"text-text-muted text-[10px]",children:"Drag handles to reconnect. Press Delete to remove."})]})}function om({variables:e,onInsert:t}){return e.length===0?null:u.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:e.map(n=>u.jsx("button",{type:"button",onClick:()=>t(n.name),title:n.description,className:"px-1.5 py-0.5 rounded text-[10px] font-mono bg-bg-primary border border-border text-text-secondary hover:text-accent-primary hover:border-accent-primary/40 transition-colors",children:`{{${n.name}}}`},n.name))})}function uB({step:e,isEntry:t,agentTypes:n,transitionCount:s,templateVariables:a,onUpdate:o,onRemove:c,onSetEntry:l}){const{color:h,name:f}=qp(e,n);return u.jsxs("div",{className:"space-y-3 text-sm",children:[u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold",style:{backgroundColor:h+"20",color:h},children:f}),t&&u.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold bg-accent-primary/15 text-accent-primary",children:"Entry"})]}),u.jsxs("div",{className:"flex items-center gap-1",children:[!t&&u.jsx("button",{onClick:l,className:"p-1 rounded text-text-muted hover:text-accent-primary text-xs",children:"Set entry"}),u.jsx("button",{onClick:c,className:"p-1 rounded text-text-muted hover:text-accent-error text-xs",children:"Delete"})]})]}),u.jsxs("div",{children:[u.jsx("label",{className:vn,children:"Type"}),u.jsx("select",{value:e.type,onChange:p=>{const m=p.target.value,_=m==="sub_agent"?"verification":"build";if(m==="agent"){const y=n.find(w=>!w.subagent);o({...e,type:m,phase:_,toolMode:(y==null?void 0:y.id)??"builder",name:(y==null?void 0:y.name)??"Agent"})}else if(m==="sub_agent"){const y=n.find(w=>w.subagent);o({...e,type:m,phase:_,subAgentType:(y==null?void 0:y.id)??"",name:(y==null?void 0:y.name)??"Sub-Agent"})}else o({...e,type:m,phase:_,name:"Shell"})},className:Ci,children:aB.map(p=>u.jsx("option",{value:p.value,children:p.label},p.value))})]}),e.type==="agent"&&u.jsxs("div",{children:[u.jsx("label",{className:vn,children:"Agent Type"}),u.jsx("select",{value:e.toolMode??"builder",onChange:p=>{const m=n.find(_=>_.id===p.target.value);o({...e,toolMode:p.target.value,name:(m==null?void 0:m.name)??p.target.value})},className:Ci,children:n.filter(p=>!p.subagent).map(p=>u.jsx("option",{value:p.id,children:p.name},p.id))})]}),e.type==="sub_agent"&&u.jsxs("div",{children:[u.jsx("label",{className:vn,children:"Sub-Agent Type"}),u.jsxs("select",{value:e.subAgentType??"",onChange:p=>{const m=n.find(_=>_.id===p.target.value);o({...e,subAgentType:p.target.value,name:(m==null?void 0:m.name)??p.target.value})},className:Ci,children:[u.jsx("option",{value:"",children:"— select —"}),n.filter(p=>p.subagent).map(p=>u.jsx("option",{value:p.id,children:p.name},p.id))]})]}),(e.type==="agent"||e.type==="sub_agent")&&u.jsxs(u.Fragment,{children:[u.jsxs("div",{children:[u.jsx("label",{className:vn,children:"Prompt"}),u.jsx("textarea",{value:e.prompt??"",onChange:p=>o({...e,prompt:p.target.value||void 0}),rows:6,className:`${vr} resize-y text-xs`,placeholder:"Injected on first entry..."}),u.jsx(om,{variables:a,onInsert:p=>o({...e,prompt:(e.prompt??"")+`{{${p}}}`})})]}),u.jsxs("div",{children:[u.jsx("label",{className:vn,children:"Nudge Prompt"}),u.jsx("textarea",{value:e.nudgePrompt??"",onChange:p=>o({...e,nudgePrompt:p.target.value||void 0}),rows:6,className:`${vr} resize-y text-xs`,placeholder:"Injected on re-entry..."}),u.jsx(om,{variables:a,onInsert:p=>o({...e,nudgePrompt:(e.nudgePrompt??"")+`{{${p}}}`})})]})]}),e.type==="shell"&&u.jsxs(u.Fragment,{children:[u.jsxs("div",{children:[u.jsx("label",{className:vn,children:"Command"}),u.jsx("textarea",{value:e.command??"",onChange:p=>o({...e,command:p.target.value}),rows:3,className:`${vr} font-mono text-xs resize-y`,placeholder:"cd {{workdir}} && npm run lint"}),u.jsx(om,{variables:a,onInsert:p=>o({...e,command:(e.command??"")+`{{${p}}}`})})]}),u.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[u.jsxs("div",{children:[u.jsx("label",{className:vn,children:"Timeout (ms)"}),u.jsx("input",{type:"number",value:e.timeout??6e4,onChange:p=>o({...e,timeout:Number(p.target.value)}),className:`${vr} font-mono text-xs`})]}),u.jsxs("div",{children:[u.jsx("label",{className:vn,children:"Success Codes"}),u.jsx("input",{value:(e.successExitCodes??[0]).join(", "),onChange:p=>o({...e,successExitCodes:p.target.value.split(",").map(m=>Number(m.trim())).filter(m=>!isNaN(m))}),className:`${vr} font-mono text-xs`})]})]})]}),u.jsx("div",{className:"pt-1 border-t border-border/50",children:u.jsxs("p",{className:"text-text-muted text-[10px]",children:[s," outgoing transition",s!==1?"s":""," — drag from the bottom port to connect."]})})]})}const A0=[];function pC({isOpen:e,onClose:t,initialEditId:n}){const s=Rt(ge=>ge.defaults),a=Rt(ge=>ge.userItems),o=Rt(ge=>ge.loading),c=Rt(ge=>ge.templateVariables),l=Rt(ge=>ge.fetchWorkflows),h=Rt(ge=>ge.fetchWorkflow),f=Rt(ge=>ge.fetchDefaultContent),p=Rt(ge=>ge.fetchTemplateVariables),m=Rt(ge=>ge.createWorkflow),_=Rt(ge=>ge.updateWorkflow),y=Rt(ge=>ge.deleteWorkflow),{requestDelete:w,clearConfirm:k,isConfirming:v}=rp(),[b,x]=O.useState("list"),[S,j]=O.useState(null),[N,T]=O.useState(!1),[D,A]=O.useState(null),[B,R]=O.useState(null),[$,F]=O.useState(""),[W,Y]=O.useState(""),[P,H]=O.useState(""),[J,K]=O.useState("1.0.0"),[I,L]=O.useState("#3b82f6"),[z,V]=O.useState(""),[U,ee]=O.useState(50),[Z,ne]=O.useState(A0),[X,G]=O.useState({type:"always"}),[le,se]=O.useState(""),[ve,be]=O.useState(!1),[Oe,Be]=O.useState([]),[Pe]=O.useState(null);O.useEffect(()=>{e&&(l(),p(),je("/api/agents").then(ge=>ge.json()).then(ge=>Be(ge.agents??[])).catch(()=>{}),A(null),R(null),n?s.some(Se=>Se.id===n)?f(n).then(Se=>{Se&&(F(Se.metadata.name+" (copy)"),Y(`${n}-copy-${Date.now()}`),H(Se.metadata.description),K(Se.metadata.version),L(Se.metadata.color??"#3b82f6"),V(Se.entryStep),ee(Se.settings.maxIterations),ne(Se.steps),G(Se.startCondition??{type:"always"}),se(""),j(null),T(!1),x("edit"))}):h(n).then(Se=>{Se&&(F(Se.metadata.name),Y(Se.metadata.id),H(Se.metadata.description),K(Se.metadata.version),L(Se.metadata.color??"#3b82f6"),V(Se.entryStep),ee(Se.settings.maxIterations),ne(Se.steps),G(Se.startCondition??{type:"always"}),se(""),j(n),T(!1),x("edit"))}):(x("list"),j(null),T(!1)))},[e,l,h,f,p,n]);const Ve=async ge=>{const Se=await h(ge);Se&&(j(ge),F(Se.metadata.name),Y(Se.metadata.id),H(Se.metadata.description),K(Se.metadata.version),L(Se.metadata.color??"#3b82f6"),V(Se.entryStep),ee(Se.settings.maxIterations),ne(Se.steps),G(Se.startCondition??{type:"always"}),se(""),A(null),R(null),x("edit"))},Ae=async()=>{var ht;const ge=S??W;if(!ge||!$)return se("Name is required."),!1;if(Z.length===0)return se("Add at least one step."),!1;let Se=z;if(!Se||!Z.some(Ge=>Ge.id===Se)){if(Se=((ht=Z.find(Ge=>Ge.id))==null?void 0:ht.id)??"",!Se)return se("All steps need an ID."),!1;V(Se)}be(!0),se("");const Te={metadata:{id:ge,name:$,description:P,version:J||"1.0.0",color:I},entryStep:Se,settings:{maxIterations:U},steps:Z,startCondition:X},Je=S?await _(S,Te):await m(Te);return be(!1),Je.success?(S||j(ge),!0):(se(Je.error??"Failed to save."),!1)},dt=async()=>{await Ae()},lt=async()=>{await Ae()&&(n?t():x("list"))},ye=()=>{n?t():x("list")},Ne=ge=>{F(ge),S||Y(sB(ge))},fe=async ge=>{if(s.some(Te=>Te.id===ge)){const Te=await f(ge);if(!Te)return;F(Te.metadata.name),Y(Te.metadata.id),H(Te.metadata.description),K(Te.metadata.version),L(Te.metadata.color??"#3b82f6"),V(Te.entryStep),ee(Te.settings.maxIterations),ne(Te.steps),G(Te.startCondition??{type:"always"}),se(""),j(ge),T(!0)}else{const Te=await h(ge);if(!Te)return;F(Te.metadata.name),Y(Te.metadata.id),H(Te.metadata.description),K(Te.metadata.version),L(Te.metadata.color??"#3b82f6"),V(Te.entryStep),ee(Te.settings.maxIterations),ne(Te.steps),G(Te.startCondition??{type:"always"}),se(""),j(ge),T(!0)}x("edit")},De=async ge=>{const Te=s.some(Je=>Je.id===ge)?await f(ge):await h(ge);Te&&(F(Te.metadata.name+" (copy)"),Y(`${ge}-copy-${Date.now()}`),H(Te.metadata.description),K(Te.metadata.version),L(Te.metadata.color??"#3b82f6"),V(Te.entryStep),ee(Te.settings.maxIterations),ne(Te.steps),G(Te.startCondition??{type:"always"}),se(""),j(null),T(!1),x("edit"))},ze=()=>{j(null),F(""),Y(""),H(""),K("1.0.0"),L("#3b82f6"),V(""),ee(50),ne(structuredClone(A0)),G({type:"always"}),se(""),A(null),R(null),T(!1),x("edit")},_t=async ge=>{await y(ge),k()},ue=O.useCallback(ge=>{A(ge),R(null)},[]),we=O.useCallback(ge=>{R(ge),A(null)},[]),Le=D!==null?Number(D):-1,He=Le>=0?Z[Le]??null:null,Xe=O.useCallback(ge=>{ne(Se=>Se.map((Te,Je)=>Je===Le?ge:Te))},[Le]),It=X.type==="step_result"?`${X.result}`:fC[X.type]??X.type,st=()=>{const ge=Z.length,Se=iB(Z),Te=Oe.find(Je=>!Je.subagent);ne([...Z,{id:Se,name:(Te==null?void 0:Te.name)??"Agent",type:"agent",phase:"build",toolMode:(Te==null?void 0:Te.id)??"builder",transitions:[]}]),z||V(Se),ue(String(ge))},he=O.useCallback((ge,Se)=>{ge==="$start"?(V(Se),we("start")):ne(Te=>{const Je=Te.find(Ge=>Ge.id===ge),ht=Je?Je.transitions.length:0;return we(`${ge}:${ht}`),Te.map(Ge=>Ge.id===ge?{...Ge,transitions:[...Ge.transitions,{when:{type:"always"},goto:Se}]}:Ge)})},[we]),Re=O.useCallback((ge,Se)=>{if(ge==="start")V(Se);else{const Te=ge.lastIndexOf(":"),Je=ge.slice(0,Te),ht=parseInt(ge.slice(Te+1));ne(Ge=>Ge.map(mn=>mn.id===Je?{...mn,transitions:mn.transitions.map((Gt,rn)=>rn===ht?{...Gt,goto:Se}:Gt)}:mn))}},[]),qe=O.useCallback((ge,Se)=>{const Te=ge.lastIndexOf(":"),Je=ge.slice(0,Te),ht=parseInt(ge.slice(Te+1));ne(Ge=>{const mn=Ge.find(rn=>rn.id===Je);if(!mn)return Ge;const Gt=mn.transitions[ht];return Gt?Ge.map(rn=>rn.id===Je?{...rn,transitions:rn.transitions.filter((Ai,Qu)=>Qu!==ht)}:rn.id===Se?{...rn,transitions:[...rn.transitions,Gt]}:rn):Ge}),R(null)},[]),Ke=O.useCallback(ge=>{if(ge==="start")V("");else{const Se=ge.lastIndexOf(":"),Te=ge.slice(0,Se),Je=parseInt(ge.slice(Se+1));ne(ht=>ht.map(Ge=>Ge.id===Te?{...Ge,transitions:Ge.transitions.filter((mn,Gt)=>Gt!==Je)}:Ge))}R(null)},[]),nn=O.useCallback((ge,Se)=>{if(ge==="start")G(Se);else{const Te=ge.lastIndexOf(":"),Je=ge.slice(0,Te),ht=parseInt(ge.slice(Te+1));ne(Ge=>Ge.map(mn=>mn.id===Je?{...mn,transitions:mn.transitions.map((Gt,rn)=>rn===ht?{...Gt,when:Se}:Gt)}:mn))}},[]),Ht=ge=>qp(ge,Oe).name,Ni=()=>{if(!B)return null;if(B==="start"){const Gt=Z.find(rn=>rn.id===z);return{type:"start",fromLabel:"Start",toLabel:Gt?Ht(Gt):"(none)",condition:X}}const ge=B.lastIndexOf(":"),Se=B.slice(0,ge),Te=parseInt(B.slice(ge+1)),Je=Z.find(Gt=>Gt.id===Se);if(!Je)return null;const ht=Je.transitions[Te];if(!ht)return null;const Ge=Z.find(Gt=>Gt.id===ht.goto),mn=ht.goto==="$done"?"Done":Ge?Ht(Ge):ht.goto;return{type:"step",fromLabel:Ht(Je),toLabel:mn,condition:ht.when}};if(b==="edit"){const ge=Ni();return u.jsxs(Nt,{isOpen:e,onClose:ye,title:N?$:S?"Edit Workflow":"New Workflow",size:"full",children:[le&&u.jsx("div",{className:"text-accent-error text-sm px-3 py-2 bg-accent-error/10 rounded mb-3",children:le}),u.jsxs("div",{className:"flex items-end gap-3 mb-3 pb-3 border-b border-border flex-wrap",children:[u.jsxs("div",{className:"min-w-[140px]",children:[u.jsx("label",{className:vn,children:"Name"}),u.jsx("input",{value:$,onChange:Se=>Ne(Se.target.value),placeholder:"Workflow name",className:`${vr} ${N?"opacity-50":""}`,readOnly:N})]}),u.jsxs("div",{className:"min-w-[100px]",children:[u.jsx("label",{className:vn,children:"ID"}),u.jsx("input",{value:W,readOnly:!0,className:`${vr} font-mono opacity-50`})]}),u.jsxs("div",{className:"flex-1 min-w-[140px]",children:[u.jsx("label",{className:vn,children:"Description"}),u.jsx("input",{value:P,onChange:Se=>!N&&H(Se.target.value),readOnly:N,placeholder:"What does this workflow do?",className:`${vr} ${N?"opacity-50":""}`})]}),u.jsxs("div",{className:"w-20",children:[u.jsx("label",{className:vn,children:"Max Iter."}),u.jsx("input",{type:"number",value:U,onChange:Se=>!N&&ee(Number(Se.target.value)),readOnly:N,className:`${vr} font-mono ${N?"opacity-50":""}`})]}),u.jsxs("div",{children:[u.jsx("label",{className:vn,children:"Color"}),u.jsx("input",{type:"color",value:I,onChange:Se=>!N&&L(Se.target.value),disabled:N,className:`w-8 h-8 rounded border border-border bg-transparent ${N?"opacity-50":"cursor-pointer"}`})]})]}),u.jsxs("div",{className:"flex gap-3",style:{height:"calc(90vh - 220px)",minHeight:300},children:[u.jsxs("div",{className:"flex-1 min-w-0 bg-bg-primary/50 border border-border rounded-lg flex flex-col overflow-hidden",children:[u.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-border/50 shrink-0",children:[u.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wider font-medium",children:"Flow"}),!N&&u.jsx("button",{onClick:st,className:"text-[11px] text-accent-primary hover:text-accent-primary/80",children:"+ Add Step"})]}),u.jsxs("div",{className:"flex-1 min-h-0 p-2 overflow-auto",children:[u.jsx(lB,{steps:Z,entryStep:z,selectedNodeId:(He==null?void 0:He.id)??null,selectedEdgeKey:B,startConditionLabel:It,agentTypes:Oe,isReadOnly:N,onSelectNode:Se=>{if(Se===null){ue(null);return}const Te=Z.findIndex(Je=>Je.id===Se);ue(Te>=0?String(Te):null)},onSelectEdge:we,onRemoveStep:Se=>{var Je;const Te=Z.findIndex(ht=>ht.id===Se);if(ne(ht=>ht.filter(Ge=>Ge.id!==Se)),Le===Te&&ue(null),z===Se){const ht=Z.filter(Ge=>Ge.id!==Se);V(((Je=ht[0])==null?void 0:Je.id)??"")}},onCreateTransition:he,onReconnectTo:Re,onReconnectFrom:qe,onDeleteTransition:Ke}),Z.length===0&&u.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-text-muted",children:[u.jsx("p",{className:"text-xs mb-2",children:"No steps yet"}),u.jsx("button",{onClick:st,className:"px-3 py-1.5 rounded bg-accent-primary/10 text-accent-primary text-xs hover:bg-accent-primary/20",children:"+ Add your first step"})]})]})]}),u.jsxs("div",{className:"w-[300px] shrink-0 border border-border rounded-lg bg-bg-secondary flex flex-col overflow-hidden",children:[u.jsx("div",{className:"px-3 py-1.5 border-b border-border shrink-0",children:u.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wider font-medium",children:"Properties"})}),u.jsx("div",{className:"p-3 overflow-y-auto flex-1 min-h-0",children:N&&(ge||He)?u.jsx("p",{className:"text-text-muted text-xs text-center py-8",children:'View only — click "Duplicate & Customize" to edit.'}):ge?ge.type==="start"?u.jsxs("div",{className:"space-y-3 text-sm",children:[u.jsx("div",{className:"flex items-center gap-2",children:u.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold bg-blue-500/20 text-blue-300",children:"Start"})}),z&&u.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-text-secondary",children:[u.jsx("span",{className:"text-text-primary font-medium",children:"Start"}),u.jsx(Z0,{}),u.jsx("span",{className:"text-text-primary font-medium",children:ge.toLabel})]}),u.jsxs("div",{children:[u.jsx("label",{className:vn,children:"Activation Condition"}),u.jsx("select",{value:X.type,onChange:Se=>G(Se.target.value==="step_result"?{type:"step_result",result:"success"}:{type:Se.target.value}),className:Ci,children:mC.map(Se=>u.jsx("option",{value:Se.value,children:Se.label},Se.value))})]}),X.type==="step_result"&&u.jsxs("div",{children:[u.jsx("label",{className:vn,children:"Result"}),z&&(()=>{const Se=Z.find(Ge=>Ge.id===z),Te=Se&&(Se.type==="sub_agent"||Se.type==="agent")?Oe.find(Ge=>Ge.id===(Se.type==="sub_agent"?Se.subAgentType:Se.toolMode)):void 0,Je=(Te==null?void 0:Te.results)&&Te.results.length>0,ht=(Te==null?void 0:Te.results)??[];return Je?u.jsx("select",{value:X.result??ht[0],onChange:Ge=>G({type:"step_result",result:Ge.target.value}),className:Ci,children:ht.map(Ge=>u.jsx("option",{value:Ge,children:Ge},Ge))}):u.jsx("input",{type:"text",value:X.result??"success",onChange:Ge=>G({type:"step_result",result:Ge.target.value}),placeholder:"e.g. success, passed, failed",className:vr})})()]}),u.jsx("p",{className:"text-text-muted text-[10px]",children:"Workflow only proceeds when this condition is met. Drag the target handle to change entry step."})]}):u.jsx(cB,{fromLabel:ge.fromLabel,toLabel:ge.toLabel,condition:ge.condition,fromStep:ge.type==="step"?Z.find(Se=>Se.id===ge.fromLabel):void 0,agentTypes:Oe,onUpdateCondition:Se=>nn(B,Se),onDelete:()=>Ke(B)}):He?u.jsx(uB,{step:He,isEntry:He.id===z,agentTypes:Oe,transitionCount:He.transitions.length,templateVariables:c,onUpdate:Xe,onRemove:()=>{var Se;if(He&&(ne(Z.filter((Te,Je)=>Je!==Le)),ue(null),z===He.id)){const Te=Z.filter((Je,ht)=>ht!==Le);V(((Se=Te[0])==null?void 0:Se.id)??"")}},onSetEntry:()=>V(He.id)}):u.jsxs("p",{className:"text-text-muted text-xs text-center py-8",children:["Click a node or edge to edit.",u.jsx("br",{}),"Drag from a port to connect."]})})]})]}),u.jsxs("div",{className:"flex justify-end gap-2 pt-3 mt-3 border-t border-border",children:[u.jsx(rt,{variant:"secondary",onClick:ye,children:"Close"}),N?u.jsx(rt,{variant:"primary",onClick:()=>{F($+" (copy)"),Y(`${S}-copy-${Date.now()}`),j(null),T(!1)},children:"Duplicate & Customize"}):u.jsxs(u.Fragment,{children:[u.jsx(rt,{variant:"secondary",onClick:dt,disabled:ve||!$,children:ve?"Saving...":"Save"}),u.jsx(rt,{variant:"primary",onClick:lt,disabled:ve||!$,children:"Save & Close"})]})]})]})}return u.jsxs(Nt,{isOpen:e,onClose:t,title:"Workflows",size:"lg",children:[u.jsxs("div",{className:"flex items-center justify-between mb-4",children:[u.jsx("p",{className:"text-text-secondary text-sm",children:"Workflows define the orchestrator's step sequence when running tasks."}),u.jsx("div",{className:"flex items-center gap-2 flex-shrink-0 ml-3",children:u.jsx(rt,{variant:"primary",size:"sm",onClick:ze,children:"+ New"})})]}),o&&s.length===0&&a.length===0?u.jsx("div",{className:"text-text-muted text-sm",children:"Loading workflows..."}):s.length===0&&a.length===0?u.jsx("div",{className:"text-text-muted text-sm",children:"No workflows installed."}):u.jsxs("div",{className:"space-y-4",children:[s.length>0&&u.jsxs("div",{children:[u.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:"Built-in"}),u.jsx("div",{className:"space-y-2",children:s.map(ge=>u.jsxs("div",{className:"flex items-center justify-between p-3 rounded border border-border bg-bg-tertiary",children:[u.jsxs("div",{className:"min-w-0 flex-1 mr-3",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("span",{className:"text-text-primary text-sm font-medium",children:ge.name}),u.jsxs("span",{className:"text-text-muted text-xs",children:["v",ge.version]})]}),u.jsx("p",{className:"text-text-secondary text-xs mt-0.5 truncate",children:ge.description})]}),u.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[u.jsx("button",{onClick:()=>fe(ge.id),className:"p-1.5 rounded text-text-muted hover:text-text-primary hover:bg-bg-primary transition-colors",title:"View",children:u.jsx(Eu,{})}),u.jsx(tl,{onClick:()=>De(ge.id)})]})]},ge.id))})]}),a.length>0&&u.jsxs("div",{children:[u.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:"Custom"}),u.jsx("div",{className:"space-y-2",children:a.map(ge=>u.jsxs("div",{className:"flex items-center justify-between p-3 rounded border border-border bg-bg-tertiary",children:[u.jsxs("div",{className:"min-w-0 flex-1 mr-3",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("span",{className:"text-text-primary text-sm font-medium",children:ge.name}),u.jsxs("span",{className:"text-text-muted text-xs",children:["v",ge.version]})]}),u.jsx("p",{className:"text-text-secondary text-xs mt-0.5 truncate",children:ge.description})]}),u.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[u.jsx(tl,{onClick:()=>De(ge.id)}),u.jsx(La,{onClick:()=>Ve(ge.id)}),v(ge.id,"delete")?u.jsx(sp,{onConfirm:()=>_t(ge.id),onCancel:()=>{}}):u.jsx(ip,{onClick:()=>w(ge.id)})]})]},ge.id))})]})]})]})}function dB(e,t){const n=e.startCondition;if(!n||n.type==="always")return!0;switch(n.type){case"has_pending_criteria":return t.some(s=>s.status.type!=="passed");case"all_criteria_passed":return t.length===0||t.every(s=>s.status.type==="passed");case"all_criteria_completed_or_passed":return t.every(s=>s.status.type==="completed"||s.status.type==="passed");case"any_criteria_blocked":return t.some(s=>s.status.type==="failed"&&s.attempts.filter(a=>a.status==="failed").length>=4);case"step_result":return null;default:return null}}function hB({onSendCommand:e,onSelectWorkflow:t,onOpenCommandsManager:n,onOpenWorkflowsManager:s,onAttach:a,textareaContent:o,attachments:c,criteria:l}){const[h,f]=O.useState(!1),[p,m]=O.useState("commands"),[_,y]=O.useState(""),[w,k]=O.useState(0),[v,b]=O.useState(null),[x,S]=O.useState(null),j=O.useRef(null),N=O.useRef(null),T=an(V=>V.defaults),D=an(V=>V.userItems),A=an(V=>V.fetchCommands),B=Rt(V=>V.defaults),R=Rt(V=>V.userItems),$=Rt(V=>V.fetchWorkflows),F=[...T,...D],W=[...B,...R];O.useEffect(()=>{h&&(p==="commands"?A():p==="workflows"&&$())},[h,p,A,$]),O.useEffect(()=>{h&&(y(""),k(0),requestAnimationFrame(()=>{var V;return(V=j.current)==null?void 0:V.focus()}))},[h,p]),O.useEffect(()=>{if(!h)return;const V=U=>{var ee;(ee=N.current)!=null&&ee.contains(U.target)||f(!1)};return document.addEventListener("mousedown",V),()=>document.removeEventListener("mousedown",V)},[h]);const Y=V=>{switch(V.key){case"ArrowDown":V.preventDefault(),k(U=>{const Z=(p==="commands"?F:W).filter(ne=>{const X=_.toLowerCase();return!X||ne.name.toLowerCase().includes(X)});return Math.min(U+1,Z.length-1)});break;case"ArrowUp":V.preventDefault(),k(U=>Math.max(U-1,0));break;case"Enter":V.preventDefault();break;case"Escape":V.preventDefault(),f(!1);break}},P=V=>{y(V),k(0)},H=F.filter(V=>!_||V.name.toLowerCase().includes(_.toLowerCase())),J=W.filter(V=>!_||V.name.toLowerCase().includes(_.toLowerCase())),K=async V=>{const U=await an.getState().fetchCommand(V);U&&e(U.prompt,U.metadata.agentMode,o,c),f(!1)},I=V=>{t(V),f(!1)},L=(V,U)=>{U.stopPropagation(),f(!1),b(V)},z=(V,U)=>{U.stopPropagation(),f(!1),S(V)};return u.jsxs("div",{ref:N,className:"relative",children:[u.jsx("button",{type:"button",onClick:()=>f(!h),className:"px-1.5 py-2 rounded-r bg-bg-secondary text-text-muted hover:text-text-primary hover:bg-bg-tertiary transition-colors border-l border-border/50",title:"More options",children:u.jsx(eS,{className:"w-4 h-4"})}),h&&u.jsxs("div",{className:"absolute bottom-full right-0 mb-1 w-80 bg-bg-secondary border border-border rounded-lg shadow-xl z-50 overflow-hidden",children:[u.jsxs("div",{className:"flex border-b border-border",children:[u.jsx("button",{type:"button",onClick:()=>{m("commands"),y(""),k(0)},className:`flex-1 px-4 py-2 text-sm font-medium transition-colors ${p==="commands"?"text-accent-primary border-b-2 border-accent-primary":"text-text-muted hover:text-text-primary"}`,children:"Commands"}),u.jsx("button",{type:"button",onClick:()=>{m("workflows"),y(""),k(0)},className:`flex-1 px-4 py-2 text-sm font-medium transition-colors ${p==="workflows"?"text-accent-primary border-b-2 border-accent-primary":"text-text-muted hover:text-text-primary"}`,children:"Workflows"}),u.jsx("button",{type:"button",onClick:()=>m("attach"),className:`flex-1 px-4 py-2 text-sm font-medium transition-colors ${p==="attach"?"text-accent-primary border-b-2 border-accent-primary":"text-text-muted hover:text-text-primary"}`,children:"Attach"})]}),p!=="attach"&&u.jsx("div",{className:"p-2 border-b border-border",children:u.jsx("input",{ref:j,value:_,onChange:V=>P(V.target.value),onKeyDown:Y,placeholder:p==="commands"?"Search commands...":"Search workflows...",className:"w-full px-2 py-1 bg-bg-tertiary border border-border rounded text-sm focus:outline-none focus:ring-1 focus:ring-accent-primary"})}),u.jsx("div",{className:"overflow-y-auto max-h-64 p-1",children:p==="commands"?H.length===0?u.jsx("div",{className:"px-3 py-2 text-text-muted text-sm",children:F.length===0?"No commands yet":"No matches"}):H.map((V,U)=>u.jsxs("div",{className:`flex items-center gap-1 px-3 py-2 rounded transition-colors group ${U===w?"bg-accent-primary/20":"hover:bg-bg-tertiary"}`,children:[u.jsx("button",{type:"button",onClick:()=>K(V.id),className:"flex-1 text-left",children:u.jsx("div",{className:"text-sm text-text-primary font-medium",children:V.name})}),u.jsx(La,{className:"opacity-0 group-hover:opacity-100",onClick:ee=>L(V.id,ee)})]},V.id)):p==="workflows"?J.length===0?u.jsx("div",{className:"px-3 py-2 text-text-muted text-sm",children:W.length===0?"No workflows yet":"No matches"}):J.map((V,U)=>{const ee=dB(V,l),Z=V.color??"#3b82f6";return u.jsxs("div",{className:`flex items-center gap-2 px-3 py-2 rounded transition-colors group ${U===w?"bg-accent-primary/20":"hover:bg-bg-tertiary"}`,children:[u.jsxs("button",{type:"button",onClick:()=>I(V.id),className:"flex-1 text-left flex items-center gap-2",children:[u.jsx("span",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{backgroundColor:Z}}),u.jsx("span",{className:"text-sm text-text-primary font-medium flex-1",children:V.name}),ee!==null&&u.jsx("span",{className:"w-1.5 h-1.5 rounded-full flex-shrink-0",style:{backgroundColor:ee?"#22c55e":"#6b7280"},title:ee?"Entry condition met":"Entry condition not met"})]}),u.jsx(La,{className:"opacity-0 group-hover:opacity-100",onClick:ne=>z(V.id,ne)})]},V.id)}):u.jsxs("div",{className:"p-4 flex flex-col items-center gap-3",children:[u.jsxs("button",{type:"button",onClick:()=>{a(),f(!1)},className:"flex items-center gap-2 px-4 py-2 rounded bg-bg-tertiary hover:bg-accent-primary/20 text-text-primary transition-colors",children:[u.jsx(Y2,{className:"w-4 h-4"}),u.jsx("span",{className:"text-sm font-medium",children:"Attach image"})]}),u.jsx("span",{className:"text-xs text-text-muted",children:"or drag & drop into chat"})]})}),p!=="attach"&&u.jsx("div",{className:"border-t border-border p-1",children:u.jsx("button",{type:"button",onClick:()=>{f(!1),p==="commands"?n():s()},className:"w-full text-left px-3 py-1.5 rounded text-sm text-text-muted hover:text-text-primary hover:bg-bg-tertiary transition-colors",children:p==="commands"?"Manage Commands...":"Manage Workflows..."})})]}),u.jsx(hC,{isOpen:!!v,onClose:()=>b(null),initialEditId:v}),u.jsx(pC,{isOpen:!!x,onClose:()=>S(null),initialEditId:x})]})}function gC(e,t){if(!t)return!0;const n=t.toLowerCase().split(/\s+/),s=e.toLowerCase().split(/\s+/);return n.every(a=>{for(const o of s){let c=0;for(let l=0;l<o.length&&c<a.length;l++)o[l]===a[c]&&c++;if(c===a.length)return!0}return!1})}function xC(e,t,n,s,a){switch(e.key){case"ArrowDown":e.preventDefault(),n(o=>Math.min(o+1,t));break;case"ArrowUp":e.preventDefault(),n(o=>Math.max(o-1,0));break;case"Enter":e.preventDefault(),s();break;case"Escape":e.preventDefault(),a();break}}function fB(e){const t=e.match(/^\/p\/([^/]+)/);return t==null?void 0:t[1]}function mB({isOpen:e,onClose:t,onCloseComplete:n,onSelectCommand:s,onSelectWorkflow:a,onCloseCompleteAction:o,textareaContent:c,onSearchMessages:l,onToggleAutoScroll:h,isAutoScrollActive:f}){const[,p]=wr(),m=an(ee=>ee.fetchCommands),_=Rt(ee=>ee.fetchWorkflows),y=Ot(ee=>ee.fetchAgents),w=an(ee=>ee.defaults),k=an(ee=>ee.userItems),v=an(ee=>ee.projectItems),b=Rt(ee=>ee.defaults),x=Rt(ee=>ee.userItems),S=Rt(ee=>ee.projectItems),j=Ot(ee=>ee.defaults),N=Ot(ee=>ee.userItems),T=Ot(ee=>ee.projectItems),D=Ce(ee=>{var Z;return(Z=ee.currentSession)==null?void 0:Z.mode}),A=Ce(ee=>{var Z;return((Z=ee.currentSession)==null?void 0:Z.dangerLevel)??"normal"}),B=Ce(ee=>ee.switchMode),R=Ce(ee=>ee.switchDangerLevel),$=Ce(ee=>{var Z;return(Z=ee.currentSession)==null?void 0:Z.projectId}),F=O.useRef(void 0),[W,Y]=O.useState(""),[P,H]=O.useState(0),J=O.useRef(null),K=O.useRef(!1);O.useEffect(()=>{e&&(K.current=!0)},[e]),O.useEffect(()=>{if(e){m(),_(),y(),Y(""),H(0);const ee=setTimeout(()=>{var Z;return(Z=J.current)==null?void 0:Z.focus()},50);return()=>clearTimeout(ee)}},[e,m,_,y]),O.useEffect(()=>{var ee;!e&&K.current&&(n==null||n(),(ee=F.current)==null||ee.call(F),F.current=void 0)},[e,n]);const I=(ee,Z)=>{const ne=new Set(Z.map(X=>X.id));return[...ee.filter(X=>!ne.has(X.id)),...Z]},z=[{id:"create-session",name:"New Session",prefix:"Action > Create",action:()=>{const ee=$??fB(window.location.pathname);ee&&p(`/p/${ee}/new`)}},{id:"navigate-session",name:"Another Session",prefix:"Action > Navigate to",action:()=>{F.current=o,t()}},{id:"search-messages",name:"Messages",prefix:"Action > Search",action:()=>{t(),l==null||l()}},{id:"toggle-autoscroll",name:f?"Auto-scroll Off":"Auto-scroll On",prefix:"Action > Toggle",action:()=>{t(),h==null||h(!f)}},...I(I(j,N),T).filter(ee=>!ee.subagent&&ee.id!==D).map(ee=>({id:ee.id,name:ee.name,prefix:"Agent > Switch to",action:()=>B(ee.id)})),...I(I(w,k),v).map(ee=>({id:ee.id,name:ee.name,prefix:"Command > Launch",action:()=>s(ee.id,c)})),...I(I(b,x),S).map(ee=>({id:ee.id,name:ee.name,prefix:"Workflow > Run",action:()=>a(ee.id)})),...["normal","dangerous"].filter(ee=>ee!==A).map(ee=>({id:ee,name:ee.charAt(0).toUpperCase()+ee.slice(1),prefix:"Mode > Switch to",action:()=>R(ee)}))].filter(ee=>gC(`${ee.prefix} ${ee.name}`,W)),V=z.length-1,U=ee=>{xC(ee,V,H,()=>{var Z;(Z=z[P])==null||Z.action(),t()},t)};return e?Pa.createPortal(u.jsxs("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[15vh] p-4",children:[u.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),u.jsxs("div",{className:"relative w-full max-w-md bg-bg-secondary border border-border rounded shadow-xl",children:[u.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-border",children:[u.jsx("input",{ref:J,type:"text",value:W,onChange:ee=>{Y(ee.target.value),H(0)},onKeyDown:U,placeholder:"Search...",className:"flex-1 bg-transparent text-sm focus:outline-none placeholder:text-text-muted"}),u.jsx(tp,{onClick:t,className:"shrink-0","aria-label":"Close"})]}),u.jsx("div",{className:"overflow-y-auto max-h-[60vh] p-2",children:z.length===0?u.jsx("div",{className:"px-3 py-4 text-center text-text-muted text-sm",children:w.length+k.length+b.length+x.length>0?"No matches":"No agents, commands, or workflows yet"}):z.map((ee,Z)=>u.jsxs("button",{type:"button",onClick:()=>{ee.action(),t()},className:`w-full text-left px-3 py-2 rounded text-sm transition-colors ${Z===P?"bg-accent-primary/20 text-text-primary":"text-text-secondary hover:bg-bg-tertiary hover:text-text-primary"}`,children:[u.jsxs("span",{className:"text-text-muted font-normal",children:[ee.prefix," "]}),u.jsx("span",{children:ee.name})]},ee.id))})]})]}),document.body):null}function pB(e){const t=new Date(e),n=new Date;if(t.getDate()===n.getDate()&&t.getMonth()===n.getMonth()&&t.getFullYear()===n.getFullYear())return t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1});const a=t.getFullYear(),o=String(t.getMonth()+1).padStart(2,"0"),c=String(t.getDate()).padStart(2,"0"),l=String(t.getHours()).padStart(2,"0"),h=String(t.getMinutes()).padStart(2,"0");return`${a}/${o}/${c} ${l}:${h}`}function gB(e){var t;if(e.type==="message")return e.message.timestamp;if(e.type==="subagent")return(t=e.messages[0])==null?void 0:t.timestamp}function xB(e){var t,n;if(e.type==="message"){const s=e.message;if(s.role==="assistant"){const a=(t=s.content)==null?void 0:t.trim();return((n=s.thinkingContent)==null?void 0:n.trim())&&!a?"italic text-text-muted":""}if(s.role==="user")return"font-bold"}return""}function _B(e){var n,s;if(e.type!=="message")return u.jsx(Cv,{className:"w-3.5 h-3.5"});const t=e.message;return t.role==="assistant"?(n=t.thinkingContent)!=null&&n.trim()&&!((s=t.content)!=null&&s.trim())?u.jsx(gj,{className:"w-3.5 h-3.5"}):u.jsx(Cv,{className:"w-3.5 h-3.5"}):u.jsx(pj,{className:"w-3.5 h-3.5"})}function D0(e){var t;if(e.type==="message"){const n=e.message,s=n.content||"",a=s.replace(/<[^>]+>/g,"").replace(/\s+/g," ").trim();if(n.messageKind==="workflow-started")try{return`Workflow: ${JSON.parse(s).workflowName}`}catch{return"Workflow started"}if(n.messageKind==="task-completed")return"Task completed";if(n.messageKind==="auto-prompt")return"Auto-prompt";if(n.messageKind==="correction")return"Correction";if(n.messageKind==="context-reset")return"Context reset";if(n.messageKind==="command")return"Command executed";if(n.role==="assistant")return a?a.slice(0,200):(t=n.thinkingContent)!=null&&t.trim()?n.thinkingContent.slice(0,200):"";const o=a.slice(0,200);return o.length<a.length?`${o}...`:o}return e.type==="subagent"?`Sub-agent: ${e.subAgentType}`:e.type==="criteria-batch"?"Acceptance Criteria":""}function yB({isOpen:e,onClose:t,displayItems:n,onNavigate:s}){const[a,o]=O.useState(""),[c,l]=O.useState(0),h=O.useRef(null),f=O.useRef(null),p=O.useMemo(()=>n.filter(v=>{var b,x;return!(v.type==="context-divider"||v.type==="message"&&v.message.role==="assistant"&&!((b=v.message.content)!=null&&b.trim())&&!((x=v.message.thinkingContent)!=null&&x.trim()))}),[n]),m=O.useMemo(()=>a?p.filter(v=>{const b=D0(v);return gC(b,a)}):p,[p,a]),_=m.length-1;O.useEffect(()=>{if(e){o(""),l(0);const v=setTimeout(()=>{var b;return(b=h.current)==null?void 0:b.focus()},50);return()=>clearTimeout(v)}},[e]),O.useEffect(()=>{e&&f.current&&(f.current.scrollTop=f.current.scrollHeight)},[e]);const y=v=>{xC(v,_,l,()=>{const b=m[c];if(b){const x=n.indexOf(b);x>=0&&s(x),t()}},t)},w=v=>{const b=n.indexOf(v);b>=0&&s(b),t()},k=v=>n.indexOf(v);return e?Pa.createPortal(u.jsxs("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[15vh] p-4",children:[u.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),u.jsxs("div",{className:"relative w-full max-w-lg bg-bg-secondary border border-border rounded shadow-xl",children:[u.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-border",children:[u.jsx(Jm,{}),u.jsx("input",{ref:h,type:"text",value:a,onChange:v=>{o(v.target.value),l(0)},onKeyDown:y,placeholder:"Search timeline...",className:"flex-1 bg-transparent text-sm focus:outline-none placeholder:text-text-muted"}),u.jsx("button",{type:"button",onClick:t,className:"p-0.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors","aria-label":"Close",children:u.jsx(Zm,{className:"w-4 h-4"})})]}),u.jsx("div",{ref:f,className:"overflow-y-auto max-h-[60vh] p-2",children:m.length===0?u.jsx("div",{className:"px-3 py-4 text-center text-text-muted text-sm",children:p.length>0?"No matches":"No messages yet"}):m.map((v,b)=>{const x=k(v),S=_B(v),j=D0(v),N=xB(v),T=gB(v),D=v.type==="message"&&v.message.role==="user";return u.jsx("button",{type:"button",onClick:()=>w(v),className:`w-full text-left px-3 py-2 rounded text-sm transition-colors ${b===c?"bg-accent-primary/20 text-text-primary":D?"bg-accent-primary/5 text-text-secondary hover:bg-accent-primary/10 hover:text-text-primary":"text-text-secondary hover:bg-bg-tertiary hover:text-text-primary"}`,children:u.jsxs("div",{className:"flex items-start justify-between gap-2",children:[u.jsxs("div",{className:"flex items-center gap-1.5 min-w-0 flex-1",children:[u.jsx("span",{className:"flex-shrink-0",children:S}),u.jsx("span",{className:`truncate flex-1 ${N}`,children:j})]}),T&&u.jsx("span",{className:"text-text-muted text-xs shrink-0",children:pB(T)})]})},`${x}-${v.type}`)})})]})]}),document.body):null}function vB(e){return e==="criterion"}function bB(e){var t,n;return e.role!=="assistant"||e.subAgentId||(t=e.content)!=null&&t.trim()||(n=e.thinkingContent)!=null&&n.trim()||!e.toolCalls||e.toolCalls.length===0?!1:e.toolCalls.every(s=>vB(s.name))}function SB(e,t=[]){const n=[];let s=null,a=[],o,c=1;const l=new Map,h=new Map,f=[];for(const y of t)y.type==="message"?l.set(y.message.id,y):y.type==="subagent"?h.set(y.subAgentId,y):y.type==="criteria-batch"&&f.push(y);let p=0;const m=()=>{if(a.length>0){const y=f[p];y&&y.type==="criteria-batch"&&y.toolCalls.length===a.length&&y.toolCalls.every((k,v)=>{var b;return k.id===((b=a[v])==null?void 0:b.id)})?n.push(y):n.push({type:"criteria-batch",toolCalls:[...a]}),p++,a=[]}},_=()=>{if(!s)return;const y=s,w=h.get(y.subAgentId);w&&w.type==="subagent"&&w.messages.length===y.messages.length&&w.messages.every((v,b)=>v===y.messages[b])?n.push(w):n.push({type:"subagent",subAgentId:y.subAgentId,subAgentType:y.subAgentType,messages:y.messages}),s=null};for(const y of e)if(y.role!=="tool"){if(y.contextWindowId&&o&&y.contextWindowId!==o&&(m(),_(),c++,n.push({type:"context-divider",windowSequence:c})),o=y.contextWindowId,bB(y)){_();for(const w of y.toolCalls)a.push(w);continue}if(m(),y.subAgentId&&y.subAgentType)s&&s.subAgentId===y.subAgentId?s.messages.push(y):(_(),s={subAgentId:y.subAgentId,subAgentType:y.subAgentType,messages:[y]});else{_();const w=l.get(y.id);w&&w.type==="message"&&w.message===y?n.push(w):n.push({type:"message",message:y})}}return m(),_(),n}function wB(e){const{year:t,month:n,day:s}=_S(e);return`${t}/${n}/${s} ${Au(e)}`}function CB(e,t){return e.length<=t?e:e.substring(0,t)+"..."}const kB=10,EB=150;function jB(e){const t=[];if(e.recentUserPrompts)for(const n of e.recentUserPrompts)t.push({id:n.id,content:n.content,timestamp:n.timestamp,sessionId:e.id,sessionName:e.title||e.id});return t}function TB(e){return[...e].sort((s,a)=>new Date(a.timestamp).getTime()-new Date(s.timestamp).getTime()).slice(0,kB).reverse().map(s=>({id:s.id,content:s.content,timestamp:s.timestamp,formattedTimestamp:wB(s.timestamp),trimmedContent:CB(s.content,EB),sessionId:s.sessionId,sessionName:s.sessionName}))}function NB(e,t,n){const s=[],a=e.filter(o=>o.role==="user"&&!o.isSystemGenerated&&o.messageKind!=="auto-prompt");for(const o of a)s.push({id:o.id,content:o.content,timestamp:o.timestamp,sessionId:n??"",sessionName:"This session"});for(const o of t)n&&o.id===n||s.push(...jB(o));return TB(s)}function AB(e,t=[],n=null){const[s,a]=O.useState(0),[o,c]=O.useState(!1),l=O.useMemo(()=>NB(e,t,n),[e,t,n]),h=O.useCallback(()=>{l.length>0&&(a(l.length-1),c(!0))},[l.length]),f=O.useCallback(()=>{c(!1),a(0)},[]),p=O.useCallback(()=>{a(y=>l.length===0?y:y===0?l.length-1:y-1)},[l.length]),m=O.useCallback(()=>{a(y=>l.length===0?y:y===l.length-1?0:y+1)},[l.length]),_=O.useCallback(()=>{if(l.length===0||!o)return null;const y=l[s];return(y==null?void 0:y.content)??null},[l,s,o]);return{history:l,selectedIndex:s,showHistory:o,openHistory:h,closeHistory:f,navigateUp:p,navigateDown:m,selectCurrent:_}}function DB({criteriaSidebarOpen:e,onCriteriaSidebarToggle:t}={}){const n=e??!0,[s,a]=O.useState(""),[o,c]=O.useState([]),[l,h]=O.useState(!1),[f,p]=O.useState(null),[m,_]=O.useState(!1),[y,w]=O.useState(!1),[k,v]=O.useState(!1),[b,x]=O.useState(!1),[S,j]=O.useState(null),N=O.useRef(null),T=O.useRef(null),D=O.useRef(null),A=Ce(he=>he.currentSession),B=Ce(he=>he.messages),R=Ce(he=>he.streamingMessage),$=Ce(he=>he.sessions),F=Ce(he=>he.pendingQuestion),W=Km(),Y=Ce(he=>he.sendMessage),P=Ce(he=>he.acceptAndBuild),H=Ce(he=>he.stopGeneration),J=Ce(he=>he.launchRunner),K=Ce(he=>he.cancelQueued),I=$2(),L=Ot(he=>he.defaults),z=Ot(he=>he.userItems),V=[...L,...z].filter(he=>!he.subagent),{history:U,selectedIndex:ee,showHistory:Z,openHistory:ne,closeHistory:X,navigateUp:G,navigateDown:le,selectCurrent:se}=AB(B,$,A==null?void 0:A.id);O.useEffect(()=>{const he=Re=>{j(Re.detail.stats)};return window.addEventListener("open-turn-stats",he),()=>window.removeEventListener("open-turn-stats",he)},[]),O.useEffect(()=>{Rt.getState().fetchWorkflows()},[]);const ve=O.useMemo(()=>R?B.map(he=>he.id===R.id?R:he):B,[B,R]),be=O.useRef([]),Oe=O.useMemo(()=>{const he=SB(ve,be.current);return be.current=he,he},[ve]),{force_scroll_to_bottom:Be,isAutoScrollActive:Pe,setAutoScroll:Ve}=uC(N,A),Ae=O.useCallback(he=>{var qe;Ve(!1);const Re=document.querySelector(`[data-item-index="${he}"]`);Re&&(Re.scrollIntoView({behavior:"smooth",block:"start"}),(qe=Re.closest('[data-testid="chat-scroll-container"]'))==null||qe.scrollBy(0,-80))},[Ve]),dt=O.useRef(0),lt=O.useCallback(()=>{const he=T.current;if(!he)return;const Re=s.length>=dt.current;dt.current=s.length,Re||(he.style.height="auto"),he.style.height=`${Math.min(200,he.scrollHeight)}px`},[s]);O.useEffect(()=>{if(!(A!=null&&A.id))return;const he=`openfox:draft:${A.id}`,Re=localStorage.getItem(he);Re!==null&&a(Re)},[A==null?void 0:A.id]),O.useEffect(()=>{var he;(he=T.current)==null||he.focus(),lt()},[A==null?void 0:A.id,lt]),O.useEffect(()=>{if(!(A!=null&&A.id))return;const he=`openfox:draft:${A.id}`,Re=setTimeout(()=>{s?localStorage.setItem(he,s):localStorage.removeItem(he)},500);return()=>clearTimeout(Re)},[A==null?void 0:A.id,s]),O.useEffect(()=>{lt()},[s,lt]),O.useEffect(()=>{const he=Re=>{const qe=k||m||y||b||S;Re.key==="Escape"&&W&&!qe&&H(),Re.key==="ScrollLock"&&Ve(!Pe)};return window.addEventListener("keydown",he),()=>window.removeEventListener("keydown",he)},[W,H,Pe,k,m,y,b,S]);const ye=ep();oS(ye.quickAction,()=>{v(!0)}),bj(ye.agentSwitching,V,he=>{Ce.getState().switchMode(he)}),O.useEffect(()=>{const he=T.current;if(!he)return;const Re=async qe=>{var nn;if(document.activeElement!==he)return;const Ke=(nn=qe.clipboardData)==null?void 0:nn.items;if(Ke){for(const Ht of Array.from(Ke))if(Ht.type.startsWith("image/")){qe.preventDefault();const Ni=Ht.getAsFile();if(!Ni)continue;await im(Ni,ge=>c(Se=>[...Se,ge]),p,{filename:"pasted-image"})}}};return he.addEventListener("paste",Re),()=>he.removeEventListener("paste",Re)},[]);const Ne=()=>{a(""),c([]),A!=null&&A.id&&localStorage.removeItem(`openfox:draft:${A.id}`)},fe=async he=>{he.preventDefault(),!(!s.trim()&&o.length===0)&&(Be(),Y(s,o.length>0?o:void 0),Ne())},De=he=>{if(Z)switch(he.key){case"Enter":{he.preventDefault();const Re=se();Re&&(a(Re),X());return}case"Escape":he.preventDefault(),X(),W&&H();return;case"ArrowUp":he.preventDefault(),G();return;case"ArrowDown":he.preventDefault(),le();return}if(he.key==="ArrowUp"&&s.trim()===""&&!Z){he.preventDefault(),ne();return}he.key==="Enter"&&!he.shiftKey&&(he.preventDefault(),fe(he))},ze=O.useCallback(async he=>{const Re=he.target.files;if(!(!Re||Re.length===0)){p(null);for(const qe of Array.from(Re))await im(qe,Ke=>c(nn=>[...nn,Ke]),p);D.current&&(D.current.value="")}},[]),_t=O.useCallback(he=>{he.preventDefault(),he.stopPropagation(),h(!0)},[]),ue=O.useCallback(he=>{he.preventDefault(),he.stopPropagation(),h(!1)},[]),we=O.useCallback(async he=>{he.preventDefault(),he.stopPropagation(),h(!1),p(null);const Re=he.dataTransfer.files;if(!(!Re||Re.length===0))for(const qe of Array.from(Re))await im(qe,Ke=>c(nn=>[...nn,Ke]),p)},[]),Le=O.useCallback(he=>{c(Re=>Re.filter(qe=>qe.id!==he))},[]),He=O.useCallback(()=>{var he;(he=D.current)==null||he.click()},[]),Xe=(A==null?void 0:A.mode)==="planner",It=(A==null?void 0:A.mode)==="builder",st=he=>{const Re=s.trim()?s:void 0,qe=o.length>0?o:void 0;Xe?P(he,Re,qe):It&&J(Re,qe,he),Ne()};return u.jsxs(u.Fragment,{children:[u.jsxs(qT,{criteriaSidebarOpen:n,onCriteriaSidebarToggle:t,messages:ve,children:[F&&u.jsx(M6,{question:F}),u.jsx(XT,{}),S&&u.jsx(QT,{stats:S,onClose:()=>j(null)}),u.jsx(I6,{}),u.jsx(N6,{displayItems:Oe,scrollContainerRef:N,highlightedMessageId:null}),u.jsxs("form",{onSubmit:fe,className:"relative p-2 md:p-4 bg-secondary",children:[W&&u.jsx("div",{className:"absolute -top-8 left-2 md:left-4 z-10",children:u.jsx(z6,{})}),u.jsxs("div",{className:"absolute -top-8 right-2 md:right-4 z-10 flex items-center gap-2",children:[u.jsxs("button",{type:"button",className:"text-sm text-text-muted hover:text-text-primary flex items-center gap-1.5 px-2 py-0.5 rounded hover:bg-bg-tertiary transition-colors",onClick:()=>Ve(!Pe),children:[Pe?u.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-accent-success"}):u.jsx(Ir,{className:"w-3 h-3 text-text-muted"}),Pe?"live":"scroll to bottom"]}),u.jsxs("button",{type:"button",onClick:()=>x(!0),className:"text-sm text-text-muted hover:text-text-primary flex items-center gap-1.5 px-2 py-0.5 rounded hover:bg-bg-tertiary transition-colors","aria-label":"Browse history",children:[u.jsx(Jm,{}),"Browse history"]})]}),u.jsx("input",{ref:D,type:"file",accept:".png,.jpg,.jpeg,.gif",onChange:ze,className:"hidden",multiple:!0}),f&&u.jsx("div",{className:"mb-2 p-2 bg-red-500/10 border border-red-500/50 rounded text-red-300 text-sm",children:f}),o.length>0&&u.jsx("div",{className:"mb-3 flex flex-wrap gap-2",children:o.map(he=>u.jsx(P6,{attachment:he,onRemove:Le},he.id))}),Z&&u.jsx(B6,{history:U,selectedIndex:ee,onSelect:he=>{a(he),X()},onEscape:X,onNavigate:he=>{he==="up"?G():le()}}),(I==null?void 0:I.length)>0&&u.jsx("div",{className:"mb-2 flex flex-wrap gap-1.5",children:I.map(he=>u.jsxs("div",{className:`inline-flex items-center gap-1.5 px-2 py-1 rounded text-xs ${he.mode==="asap"?"bg-amber-500/15 text-amber-300 border border-amber-500/30":"bg-blue-500/15 text-blue-300 border border-blue-500/30"}`,children:[u.jsxs("span",{className:"font-medium",children:[he.mode==="asap"?"ASAP":"Queue",":"]}),u.jsx("span",{className:"truncate max-w-[200px]",children:he.content}),u.jsx(hl,{onClick:()=>K(he.queueId),size:"sm"})]},he.queueId))}),u.jsxs("div",{className:`flex items-end gap-3 p-3 rounded transition-colors ${l?"bg-accent-primary/10":"bg-primary"}`,onDragOver:_t,onDragLeave:ue,onDrop:we,children:[u.jsx("textarea",{id:pS,ref:T,value:s,onChange:he=>{a(he.target.value),Z&&X()},onKeyDown:De,placeholder:"What would you like to build?","data-testid":"chat-input-textarea",className:"flex-1 bg-transparent text-sm placeholder:text-text-muted resize-none overflow-y-auto focus:outline-none",style:{minHeight:"24px",maxHeight:"200px"},spellCheck:!1}),u.jsxs("div",{className:"flex items-center self-center gap-1.5",children:[W&&u.jsxs("button",{type:"button",onClick:()=>H(),"data-testid":"chat-stop-button",className:"flex items-center gap-1 px-4 py-1.5 rounded bg-accent-error/20 text-sm text-accent-error font-medium hover:bg-accent-error/30 transition-colors whitespace-nowrap",children:[u.jsx(nS,{}),"Abort"]}),u.jsxs("div",{className:"flex items-center",children:[u.jsx("button",{type:"button",onClick:()=>{var he;!s.trim()&&o.length===0||((he=N.current)==null||he.scrollTo({top:N.current.scrollHeight,behavior:"smooth"}),Y(s,o),Ne())},disabled:!s.trim()&&o.length===0,"data-testid":"chat-send-button",className:"px-4 py-1.5 rounded-l bg-accent-primary/20 text-sm text-accent-primary font-medium hover:bg-accent-primary/30 disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:"Send"}),u.jsx(hB,{onSendCommand:(he,Re,qe,Ke)=>{var Ht;Re&&(A==null?void 0:A.mode)!==Re&&Ce.getState().switchMode(Re);const nn=qe&&qe.trim()?`${qe.trim()}
295
+
296
+ ${he}`:he;(Ht=N.current)==null||Ht.scrollTo({top:N.current.scrollHeight,behavior:"smooth"}),Y(nn,Ke!=null&&Ke.length?Ke:void 0,{messageKind:"command",isSystemGenerated:!0}),Ne()},onSelectWorkflow:st,onOpenCommandsManager:()=>_(!0),onOpenWorkflowsManager:()=>w(!0),onAttach:He,textareaContent:s,attachments:o.length>0?o:void 0,criteria:(A==null?void 0:A.criteria)??[]})]})]})]}),u.jsxs("div",{className:"mt-3 flex items-center justify-between",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(R6,{}),u.jsx(O6,{})]}),u.jsx(tB,{})]})]}),u.jsx(hC,{isOpen:m,onClose:()=>_(!1)}),u.jsx(pC,{isOpen:y,onClose:()=>w(!1)}),u.jsx(mB,{isOpen:k,onClose:()=>v(!1),onSearchMessages:()=>x(!0),isAutoScrollActive:Pe,onToggleAutoScroll:Ve,textareaContent:s,onCloseComplete:gS,onCloseCompleteAction:()=>window.dispatchEvent(new CustomEvent("open-session-dropdown")),onSelectCommand:async(he,Re)=>{const qe=await an.getState().fetchCommand(he);if(qe){const Ke=Re!=null&&Re.trim()?`${Re.trim()}
297
+
298
+ ${qe.prompt}`:qe.prompt;qe.metadata.agentMode&&Ce.getState().switchMode(qe.metadata.agentMode),Y(Ke,o!=null&&o.length?o:void 0,{messageKind:"command",isSystemGenerated:!0}),Ne()}},onSelectWorkflow:he=>{const Re=s.trim()||void 0,qe=o.length>0?o:void 0;(A==null?void 0:A.mode)==="planner"?Ce.getState().acceptAndBuild(he,Re,qe):Ce.getState().launchRunner(Re,qe,he),Ne()}})]}),b&&u.jsx(yB,{isOpen:b,onClose:()=>x(!1),displayItems:Oe,onNavigate:Ae})]})}O.memo(function({item:t}){const[n,s]=O.useState(!1);return t.type==="start"?u.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 bg-amber-500/10 border border-amber-500/30 rounded text-amber-300 text-sm",children:[u.jsx("span",{className:"animate-pulse",children:"●"}),u.jsx("span",{children:"Delegating image to fallback vision model..."}),t.filename&&u.jsxs("span",{className:"text-amber-400/70",children:["(",t.filename,")"]})]}):u.jsxs("div",{className:"flex items-start gap-2 px-3 py-2 bg-accent-success/10 border border-accent-success/30 rounded",children:[u.jsx("span",{className:"text-accent-success",children:"✓"}),u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsxs("div",{className:"flex items-center justify-between gap-2",children:[u.jsx("span",{className:"text-accent-success text-sm",children:"Image description done"}),u.jsx("button",{type:"button",onClick:()=>s(!n),className:"text-xs text-accent-primary hover:text-accent-primary/80 transition-colors",children:n?"Hide":"Show"})]}),n&&t.description&&u.jsx("div",{className:"mt-2 text-xs prose prose-invert prose-sm max-w-none",children:u.jsx(cs,{content:t.description})})]})]})});function L0({isOpen:e,isRetry:t,onSubmit:n,onCancel:s}){const[a,o]=O.useState(""),c=O.useRef(null);O.useEffect(()=>{e&&(o(""),setTimeout(()=>{var h;return(h=c.current)==null?void 0:h.focus()},100))},[e]);const l=h=>{h.preventDefault(),a.trim()&&n(a)};return u.jsx(Nt,{isOpen:e,onClose:s,title:t?"Invalid Password":"Password Required",size:"sm",children:u.jsxs("form",{onSubmit:l,className:"space-y-4",children:[u.jsx("p",{className:"text-text-secondary text-sm",children:t?"The password you entered was incorrect. Please try again.":"This server requires a password to connect."}),u.jsx(Du,{ref:c,type:"password",value:a,onChange:h=>o(h.target.value),placeholder:"Enter password",autoFocus:!0}),u.jsxs("div",{className:"flex justify-end gap-2",children:[u.jsx(rt,{type:"button",variant:"secondary",onClick:s,children:"Cancel"}),u.jsx(rt,{type:"submit",disabled:!a.trim(),children:t?"Try Again":"Connect"})]})]})})}const LB=[8e3,11434,8080],RB=[{name:"OpenCode Go",url:"https://opencode.ai/zen/go/v1",backend:"opencode-go"}];function R0(e){switch(e){case"vllm":return"vLLM";case"sglang":return"SGLang";case"ollama":return"Ollama";case"llamacpp":return"llama.cpp";case"openai":return"OpenAI";case"anthropic":return"Anthropic";case"opencode-go":return"OpenCode Go";case"auto":return"Auto";case"unknown":return"Unknown";default:return e}}function OB({currentStep:e,totalSteps:t,labels:n,onStepClick:s}){return u.jsx("div",{className:"flex justify-center py-6",children:u.jsx("div",{className:"flex items-center",children:Array.from({length:t},(a,o)=>{const c=o+1,l=c<e,h=c===e;return u.jsxs("div",{className:"flex items-center",children:[u.jsx("button",{onClick:()=>s==null?void 0:s(c),className:`size-8 rounded-full flex items-center justify-center text-sm font-medium transition-colors shrink-0 ${l?"bg-accent-primary text-text-primary hover:opacity-80":h?"bg-accent-primary text-text-primary":"bg-bg-tertiary text-text-muted"}`,children:l?"✓":c}),u.jsx("button",{onClick:()=>s==null?void 0:s(c),className:`ml-2 mr-4 text-sm whitespace-nowrap hidden sm:block ${h?"text-text-primary font-medium":"text-text-muted hover:text-text-secondary"}`,children:n[o]}),o<t-1&&u.jsx("div",{className:`w-12 sm:w-20 h-0.5 mr-4 ${l?"bg-accent-primary":"bg-border"}`})]},o)})})})}function MB({onNext:e}){const[t,n]=O.useState([]),[s,a]=O.useState([]),[o,c]=O.useState(!1),[l,h]=O.useState(""),[f,p]=O.useState(""),[m,_]=O.useState(""),[y,w]=O.useState("auto"),[k,v]=O.useState(!1),[b,x]=O.useState(null),[S,j]=O.useState(null),[N,T]=O.useState(null),[D,A]=O.useState("");O.useEffect(()=>{B()},[]);async function B(){try{const P=await je("/api/providers");if(P.ok){const J=(await P.json()).providers.map(K=>({id:K.id,name:K.name,url:K.url,backend:K.backend,model:null,apiKey:K.apiKey}));n(J),a(J)}}catch{}}async function R(P){v(!0),x(null);const H=y!=="auto";try{const K=await(await je("/api/providers/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:P,skipBackendDetection:H})})).json();K.success?(H||w(K.backend??"auto"),x({success:!0,model:K.model??void 0})):x({success:!1,error:K.error??"Connection failed"})}catch(J){x({success:!1,error:J instanceof Error?J.message:"Connection failed"})}v(!1)}function $(){if(!f)return;const P=l||`Provider ${s.length+1}`,H={id:`temp-${Date.now()}`,name:P,url:f,backend:b!=null&&b.success?y:"auto",model:b!=null&&b.success?b.model??null:null,apiKey:m||void 0};a([...s,H]),h(""),p(""),_(""),x(null)}function F(P){j(P),t.some(J=>J.id===P)?je(`/api/providers/${P}`,{method:"DELETE"}).then(()=>{a(s.filter(J=>J.id!==P)),n(t.filter(J=>J.id!==P)),j(null)}).catch(()=>{j(null)}):(a(s.filter(J=>J.id!==P)),j(null))}async function W(){for(const H of s)(H.id.startsWith("temp-")||!t.some(J=>J.id===H.id))&&((await je("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:H.name,url:H.url,backend:H.backend,model:H.model,apiKey:H.apiKey})})).ok||console.error("Failed to add provider",H));const P=s.filter(H=>!H.id.startsWith("temp-"));e({providers:P})}const Y=s.length>0;return u.jsxs("div",{className:"max-w-xl mx-auto",children:[u.jsx("h2",{className:"text-2xl font-bold text-text-primary mb-2",children:"LLM Providers"}),u.jsx("p",{className:"text-text-secondary mb-8",children:"Manage your LLM server connections"}),u.jsxs("div",{className:"space-y-4",children:[s.length>0?u.jsx("div",{className:"space-y-2",children:s.map(P=>u.jsxs("div",{className:"flex items-center justify-between bg-bg-secondary rounded-lg p-4 border border-border",children:[u.jsxs("div",{className:"flex-1",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("span",{className:"px-2 py-0.5 bg-accent-primary/25 text-accent-primary rounded text-xs font-medium",children:R0(P.backend)}),N===P.id?u.jsx("input",{type:"text",value:D,onChange:H=>A(H.target.value),onKeyDown:H=>{H.key==="Enter"&&(a(s.map(J=>J.id===P.id?{...J,name:D}:J)),T(null)),H.key==="Escape"&&T(null)},onBlur:()=>{a(s.map(H=>H.id===P.id?{...H,name:D}:H)),T(null)},className:"px-2 py-0.5 bg-bg-primary border border-accent-primary rounded text-text-primary text-sm focus:outline-none",autoFocus:!0}):u.jsx("span",{className:"text-text-primary font-medium cursor-pointer hover:text-accent-primary",onClick:()=>{T(P.id),A(P.name)},title:"Click to edit",children:P.name})]}),u.jsx("p",{className:"text-text-muted text-sm mt-1",children:P.url}),P.model&&u.jsxs("p",{className:"text-text-secondary text-xs mt-0.5",children:["Model: ",P.model]})]}),u.jsx("button",{onClick:()=>F(P.id),disabled:S===P.id,className:"p-2 text-text-muted hover:text-red-500 transition-colors disabled:opacity-50",title:"Remove provider",children:u.jsx(ju,{})})]},P.id))}):u.jsx("div",{className:"bg-bg-secondary rounded-lg p-8 text-center border border-border",children:u.jsx("p",{className:"text-text-muted",children:"No providers configured yet"})}),o?u.jsxs("form",{onSubmit:P=>{P.preventDefault(),f&&$()},className:"space-y-4 p-4 bg-bg-tertiary rounded-lg",children:[u.jsxs("div",{children:[u.jsx("label",{className:"block text-sm text-text-secondary mb-2",children:"Service Presets"}),u.jsx("div",{className:"grid grid-cols-2 gap-2",children:RB.map(P=>u.jsx("button",{type:"button",onClick:()=>{h(P.name),p(P.url),w(P.backend),x(null)},className:`p-2 rounded border text-center text-sm transition-colors ${f===P.url?"border-accent-primary bg-accent-primary/10 text-accent-primary":"border-border hover:border-text-muted text-text-secondary"}`,children:P.name},P.name))})]}),u.jsxs("div",{children:[u.jsx("label",{className:"block text-sm text-text-secondary mb-2",children:"Local Presets"}),u.jsx("div",{className:"grid grid-cols-3 gap-2",children:LB.map(P=>u.jsxs("button",{type:"button",onClick:()=>{h(""),p(`http://localhost:${P}`),w("auto"),x(null)},className:`p-2 rounded border text-center text-sm transition-colors ${f===`http://localhost:${P}`?"border-accent-primary bg-accent-primary/10 text-accent-primary":"border-border hover:border-text-muted text-text-secondary"}`,children:["localhost:",P]},P))})]}),u.jsxs("div",{children:[u.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"Or enter address manually"}),u.jsx("input",{type:"text",name:"url",value:f,onChange:P=>{p(P.target.value),x(null)},onKeyDown:P=>{P.key==="Enter"&&(P.preventDefault(),R(f))},placeholder:"http://localhost:8000","data-testid":"onboarding-provider-url-input",className:"w-full px-4 py-2 bg-bg-secondary border border-border rounded-lg text-text-primary placeholder-text-muted focus:outline-none focus:border-accent-primary"})]}),u.jsxs("div",{children:[u.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"Provider name (optional)"}),u.jsx("input",{type:"text",name:"name",value:l,onChange:P=>h(P.target.value),onKeyDown:P=>{P.key==="Enter"&&(P.preventDefault(),$())},placeholder:"My LLM Server",className:"w-full px-4 py-2 bg-bg-secondary border border-border rounded-lg text-text-primary placeholder-text-muted focus:outline-none focus:border-accent-primary"})]}),u.jsxs("div",{children:[u.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"API key (optional)"}),u.jsx("input",{type:"password",name:"apiKey",value:m,onChange:P=>_(P.target.value),placeholder:"sk-...",className:"w-full px-4 py-2 bg-bg-secondary border border-border rounded-lg text-text-primary placeholder-text-muted focus:outline-none focus:border-accent-primary"})]}),b&&u.jsx("div",{className:`p-3 rounded-lg ${b.success?"bg-accent-primary/10":"bg-red-500/10"}`,children:b.success?u.jsxs("p",{className:"text-accent-primary font-medium",children:["✓ Connected to ",R0(y),b.model&&` (${b.model})`]}):u.jsx("p",{className:"text-red-500",children:b.error})}),u.jsxs("div",{className:"flex gap-2",children:[u.jsx("button",{type:"button",onClick:()=>R(f),disabled:!f||k,"data-testid":"onboarding-test-connection-button",className:"flex-1 px-4 py-2 bg-bg-secondary border border-border rounded-lg hover:border-text-muted disabled:opacity-50",children:k?u.jsx(Da,{className:"w-4 h-4"}):"Test Connection"}),u.jsx("button",{type:"submit",disabled:!f,"data-testid":"onboarding-add-provider-submit-button",className:"flex-1 px-4 py-2 bg-accent-primary text-text-primary rounded-lg hover:bg-accent-primary/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors font-medium",children:b!=null&&b.success?"Add Provider ✓":"Add Provider"})]}),u.jsx("button",{type:"button",onClick:()=>{c(!1),h(""),p(""),x(null)},className:"w-full text-center text-text-muted hover:text-text-secondary text-sm",children:"Cancel"})]}):u.jsxs("button",{onClick:()=>c(!0),"data-testid":"onboarding-add-provider-button",className:"w-full flex items-center justify-center gap-2 px-4 py-3 bg-bg-secondary border border-dashed border-border rounded-lg text-text-secondary hover:text-text-primary hover:border-text-muted transition-colors",children:[u.jsx(Da,{className:"w-4 h-4"}),"Add Provider"]}),u.jsx("button",{onClick:W,disabled:!Y,"data-testid":"onboarding-continue-button",className:"w-full mt-6 px-6 py-3 bg-accent-primary text-text-primary rounded-lg font-medium hover:bg-accent-primary/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:"Continue"})]})]})}function IB({onNext:e}){const[t,n]=O.useState(""),[s,a]=O.useState(!1);return O.useEffect(()=>{je("/api/config").then(o=>o.json()).then(o=>{o.workdir?n(o.workdir):fetch("/api/directories?path="+encodeURIComponent("/home")).then(c=>c.json()).then(c=>{c.current&&n(c.current)}).catch(()=>{})}).catch(()=>{fetch("/api/directories?path="+encodeURIComponent("/home")).then(o=>o.json()).then(o=>{o.current&&n(o.current)}).catch(()=>{})})},[]),u.jsxs("div",{className:"max-w-xl mx-auto",children:[u.jsx("h2",{className:"text-2xl font-bold text-text-primary mb-2",children:"Your Projects Folder"}),u.jsx("p",{className:"text-text-secondary mb-8",children:"Where should OpenFox create project folders?"}),u.jsxs("div",{className:"space-y-4",children:[u.jsxs("div",{children:[u.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"Workspace directory"}),u.jsxs("div",{className:"flex gap-2",children:[u.jsx("input",{type:"text",value:t,onChange:o=>n(o.target.value),placeholder:"/home/user/projects","data-testid":"onboarding-workdir-input",className:"flex-1 px-4 py-2 bg-bg-secondary border border-border rounded-lg text-text-primary placeholder-text-muted focus:outline-none focus:border-accent-primary"}),u.jsx("button",{onClick:()=>a(!0),className:"px-4 py-2 bg-bg-secondary border border-border rounded-lg hover:border-text-muted",children:"Browse"})]})]}),s&&u.jsx(wS,{initialPath:t||void 0,onSelect:o=>{n(o),a(!1)},onClose:()=>a(!1)}),u.jsx("button",{onClick:()=>e({workdir:t}),disabled:!t,"data-testid":"onboarding-workdir-continue-button",className:"w-full mt-6 px-6 py-3 bg-accent-primary text-text-primary rounded-lg font-medium hover:bg-accent-primary/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:"Continue"})]})]})}function PB({onNext:e}){const[t,n]=O.useState(!1),[s,a]=O.useState("http://localhost:11434"),[o,c]=O.useState("qwen3.5:0.8b"),{copied:l,copy:h}=iC();O.useEffect(()=>{je("/api/config").then(p=>p.json()).then(p=>{p.visionFallback&&(n(p.visionFallback.enabled),a(p.visionFallback.url),c(p.visionFallback.model))}).catch(()=>{})},[]);function f(p){if(p){e({});return}e({visionFallback:{enabled:t,url:s,model:o,timeout:120}})}return u.jsxs("div",{className:"max-w-xl mx-auto",children:[u.jsx("h2",{className:"text-2xl font-bold text-text-primary mb-2",children:"Vision (Optional)"}),u.jsx("p",{className:"text-text-secondary mb-8",children:"Configure a vision model for non-vision models"}),u.jsxs("div",{className:"space-y-6",children:[u.jsxs("div",{className:"bg-bg-secondary rounded-lg p-4 border border-border",children:[u.jsx("p",{className:"text-text-secondary text-sm mb-2",children:"To enable vision support, you need an Ollama server with a vision model:"}),u.jsx("a",{href:"https://ollama.com/download",target:"_blank",rel:"noopener noreferrer",className:"text-accent-primary hover:underline text-sm",children:"Download Ollama"}),u.jsxs("div",{className:"mt-3 p-2 bg-bg-primary rounded border border-border flex items-center justify-between gap-2",children:[u.jsx("code",{className:"text-text-secondary text-xs",children:"ollama pull qwen3.5:0.8b"}),u.jsx("button",{onClick:()=>h("ollama pull qwen3.5:0.8b"),className:"text-text-muted hover:text-text-primary transition-colors",title:"Copy",children:l?u.jsx(Mr,{className:"w-4 h-4 text-accent-primary"}):u.jsx(J2,{className:"w-4 h-4"})})]})]}),u.jsxs("label",{className:"flex items-center gap-3 cursor-pointer",children:[u.jsx("input",{type:"checkbox",checked:t,onChange:p=>n(p.target.checked),className:"w-5 h-5 rounded border-border bg-bg-secondary text-accent-primary focus:ring-accent-primary"}),u.jsx("span",{className:"text-text-primary",children:"Enable vision fallback for non-vision models"})]}),t&&u.jsxs("div",{className:"space-y-4 pl-8",children:[u.jsxs("div",{children:[u.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"Vision server URL"}),u.jsx("input",{type:"text",value:s,onChange:p=>a(p.target.value),placeholder:"http://localhost:11434",className:"w-full px-4 py-2 bg-bg-secondary border border-border rounded-lg text-text-primary placeholder-text-muted focus:outline-none focus:border-accent-primary"})]}),u.jsxs("div",{children:[u.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"Vision model name"}),u.jsx("input",{type:"text",value:o,onChange:p=>c(p.target.value),placeholder:"qwen3.5:0.8b",className:"w-full px-4 py-2 bg-bg-secondary border border-border rounded-lg text-text-primary placeholder-text-muted focus:outline-none focus:border-accent-primary"})]})]}),u.jsxs("div",{className:"flex items-center justify-between pt-4",children:[u.jsx("button",{onClick:()=>f(!0),"data-testid":"onboarding-skip-button",className:"text-text-muted hover:text-text-secondary text-sm underline",children:"Skip for now"}),u.jsx("button",{onClick:()=>f(!1),className:"px-6 py-3 bg-accent-primary text-text-primary rounded-lg font-medium hover:bg-accent-primary/90 transition-colors",children:"Finish Setup"})]})]})]})}function BB({onComplete:e}){const[t,n]=O.useState(1),[s,a]=O.useState(!1),[o,c]=O.useState({});async function l(m){c(_=>({..._,providers:m.providers})),n(2)}async function h(m){c(_=>({..._,...m})),n(3)}async function f(m){a(!0);try{if(!(await je("/api/init/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workdir:o.workdir,visionFallback:m.visionFallback})})).ok)throw new Error("Failed to save config");e()}catch(_){console.error("Failed to save onboarding data:",_),a(!1)}}const p=m=>{n(m)};return u.jsxs("div",{className:"w-full max-w-xl mx-auto px-6 py-16 relative",children:[u.jsx(hl,{onClick:e,className:"absolute top-4 right-4 p-2",variant:"modal",size:"xl"}),u.jsx(OB,{currentStep:t,totalSteps:3,labels:["LLM Server","Projects Folder","Vision"],onStepClick:p}),u.jsx("div",{className:"max-w-xl mx-auto",children:s?u.jsxs("div",{className:"text-center",children:[u.jsx(Da,{className:"w-6 h-6"}),u.jsx("p",{className:"mt-4 text-text-secondary",children:"Saving your settings..."})]}):u.jsxs(u.Fragment,{children:[t===1&&u.jsx(MB,{onNext:l}),t===2&&u.jsx(IB,{onNext:h}),t===3&&u.jsx(PB,{onNext:f})]})})]})}const O0="openfox_updated_to",M0="update_pending";function zB(){const[e,t]=O.useState(!1),n=localStorage.getItem(O0),s=localStorage.getItem(M0);O.useEffect(()=>{if(!n||!s)return;const o=setTimeout(()=>t(!0),3e4);return()=>clearTimeout(o)},[n,s]);const a=()=>{localStorage.removeItem(O0),localStorage.removeItem(M0),t(!0)};return e||s!=="true"||!n?null:u.jsxs("div",{className:"fixed bottom-20 left-1/2 -translate-x-1/2 z-[100] flex items-center gap-3 px-4 py-2.5 bg-bg-secondary border border-border rounded-lg shadow-xl animate-slide-down",role:"status","aria-live":"polite",children:[u.jsx("div",{className:"flex items-center justify-center w-5 h-5 rounded-full bg-accent-primary/20",children:u.jsx(Mr,{className:"w-3 h-3 text-accent-primary"})}),u.jsxs("div",{className:"flex flex-col",children:[u.jsx("span",{className:"text-sm font-medium text-text-primary",children:"OpenFox updated successfully"}),u.jsxs("span",{className:"text-xs text-text-muted",children:["Now running ",n]})]}),u.jsx("button",{onClick:a,className:"ml-2 p-1 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors","aria-label":"Dismiss",children:u.jsx(rS,{className:"w-3.5 h-3.5"})})]})}typeof window<"u"&&(Jt.getState().loadUserPresets(),Jt.getState().applySavedTheme());function Kp(){return typeof window>"u"?!1:localStorage.getItem("openfox_token")!==null}function _C(){return u.jsx("div",{className:"flex-1 flex items-center justify-center",children:u.jsx(fl,{})})}function HB({sidebarOpen:e,onSidebarToggle:t}){const[,n]=qm("/p/:projectId"),s=n==null?void 0:n.projectId,a=Ce(h=>h.connectionStatus),o=zt(h=>h.currentProject),c=Kp();return W2({canLoad:a==="connected"||c,projectId:s,currentProjectId:o==null?void 0:o.id}),!o||o.id!==s?u.jsx(_C,{}):u.jsxs(u.Fragment,{children:[u.jsx(vS,{projectId:s,isOpen:e,onClose:t}),u.jsx("div",{className:"flex-1 min-w-0 bg-primary",children:u.jsx(pT,{})})]})}function $B({sidebarOpen:e,onSidebarToggle:t,rightSidebarOpen:n,onRightSidebarToggle:s}){const[,a]=qm("/p/:projectId/s/:sessionId"),o=a==null?void 0:a.projectId,c=a==null?void 0:a.sessionId,[,l]=wr(),h=Ce(k=>k.connectionStatus),f=Ce(k=>k.currentSession),p=Ce(k=>k.error),m=Ce(k=>k.clearError),_=zt(k=>k.currentProject),y=Kp();return q2({canLoad:h==="connected"||y,projectId:o,sessionId:c,currentProjectId:_==null?void 0:_.id,currentSessionId:f==null?void 0:f.id}),O.useEffect(()=>{(p==null?void 0:p.code)==="NOT_FOUND"&&o&&(m(),l(`/p/${o}`))},[p,o,m,l]),!_||_.id!==o?u.jsx(_C,{}):u.jsxs(u.Fragment,{children:[u.jsx(vS,{projectId:o,isOpen:e,onClose:t}),u.jsx("div",{className:"flex-1 min-w-0 bg-primary",children:u.jsx(DB,{criteriaSidebarOpen:n,onCriteriaSidebarToggle:s})})]})}function UB(){const e=Lt(n=>n.fetchConfig);function t(){e(),window.history.back()}return u.jsx("div",{className:"flex-1 overflow-y-auto",children:u.jsx(BB,{onComplete:t})})}function FB(){const{connectionStatus:e}=F2(),t=Lt(P=>P.fetchConfig),n=Lt(P=>P.refreshProviderModels),s=Lt(P=>P.providers),a=Lt(P=>P.activeProviderId),[,o]=wr(),c=Kp(),[l,h]=O.useState(!1);O.useEffect(()=>{(e==="connected"||c)&&t().then(()=>{h(!0),tn.getState().getSettings([...P0,We.DISPLAY_THEME,We.DISPLAY_USER_PRESETS])})},[e,c,t]),O.useEffect(()=>{l&&a&&n(a).then(()=>{const P=Lt.getState().defaultModelSelection;(P?P.split("/")[0]:null)!==a&&t()})},[l,a,n,t]);const f=tn(P=>P.settings);O.useEffect(()=>{l&&s.length===0&&o("/onboarding")},[l,s.length]),O.useEffect(()=>{const{applyPreset:P,applyTokens:H}=Jt.getState(),J=f[We.DISPLAY_THEME],K=f[We.DISPLAY_USER_PRESETS];if(K&&localStorage.setItem("openfox:userPresets",K),J){localStorage.setItem("openfox:theme",J);try{const I=JSON.parse(J);I.preset&&I.tokens?(P(I.preset),Jt.setState({basePreset:I.preset}),H(I.tokens)):I.preset?P(I.preset):I.tokens&&H(I.tokens)}catch{P("dark")}}else P("dark")},[f[We.DISPLAY_THEME],f[We.DISPLAY_USER_PRESETS]]);const p=()=>{const P=localStorage.getItem("openfox:leftSidebar");return P!==null?P==="true":!0},m=()=>{const P=localStorage.getItem("openfox:rightSidebar");return P!==null?P==="true":!0},[_,y]=O.useState(p),[w,k]=O.useState(m),[v,b]=O.useState(!1),[x,S]=O.useState(!1),[j,N]=O.useState(!1),T=XE();O.useEffect(()=>{const P=()=>{N(window.innerWidth<768)};return P(),window.addEventListener("resize",P),()=>window.removeEventListener("resize",P)},[]);const D=j?v:_,A=j?x:w,B=()=>{j?b(!v):y(!_)},R=()=>{j?S(!x):k(!w)};O.useEffect(()=>{j||localStorage.setItem("openfox:leftSidebar",String(_))},[_,j]),O.useEffect(()=>{j||localStorage.setItem("openfox:rightSidebar",String(w))},[w,j]),O.useEffect(()=>{(e==="connected"||c)&&t()},[e,t,c]);const $=Ce(P=>P.showPasswordModal),F=Ce(P=>P.passwordModalRetry),W=Ce(P=>P.submitPassword),Y=Ce(P=>P.cancelPassword);return e!=="connected"&&!$&&!c?u.jsxs(u.Fragment,{children:[u.jsx(L0,{isOpen:!0,isRetry:F,onSubmit:W,onCancel:Y}),u.jsx("div",{className:"h-screen flex items-center justify-center",children:u.jsx(dT,{text:"Connecting to server..."})})]}):u.jsxs(u.Fragment,{children:[u.jsx(L0,{isOpen:$,isRetry:F,onSubmit:W,onCancel:Y}),u.jsxs("div",{className:"flex flex-col",style:{height:j?`calc(${T.offsetTop}px + ${T.height}px)`:"100vh"},children:[u.jsx(aT,{}),u.jsx(eT,{onMenuClick:B,onCriteriaToggle:R}),u.jsx("div",{className:"flex-1 flex overflow-hidden",children:u.jsxs(_2,{children:[u.jsx(Mo,{path:"/onboarding",children:u.jsx(UB,{})}),u.jsx(Mo,{path:"/p/:projectId/s/:sessionId",children:u.jsx($B,{sidebarOpen:D,onSidebarToggle:B,rightSidebarOpen:A,onRightSidebarToggle:R})}),u.jsx(Mo,{path:"/p/:projectId/new",children:u.jsx(mT,{})}),u.jsx(Mo,{path:"/p/:projectId",children:u.jsx(HB,{sidebarOpen:D,onSidebarToggle:B})}),u.jsx(Mo,{path:"/",children:u.jsx(fT,{})})]})})]}),u.jsx(zB,{})]})}GE.createRoot(document.getElementById("root")).render(u.jsx(Hs.StrictMode,{children:u.jsx(FB,{})}));