@deepseekcode/cli 1.0.27 → 1.0.29

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 (399) hide show
  1. package/dist/cli.js +1441 -1299
  2. package/package.json +1 -1
  3. package/web/dist/assets/AutomationView-BJSLQ2Ka.js +1 -0
  4. package/web/dist/assets/ChannelConfigView-DG4_15oh.js +8 -0
  5. package/web/dist/assets/{ConnectorsView-Dadj20jv.js → ConnectorsView-ByedXSa-.js} +1 -1
  6. package/web/dist/assets/{FileTreeView-DLRQZmLP.js → FileTreeView-DPA2dhx_.js} +1 -1
  7. package/web/dist/assets/{HookConfigView-DE0NCrV9.js → HookConfigView-BJnvqm3N.js} +1 -1
  8. package/web/dist/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
  9. package/web/dist/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
  10. package/web/dist/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
  11. package/web/dist/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
  12. package/web/dist/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
  13. package/web/dist/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
  14. package/web/dist/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
  15. package/web/dist/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
  16. package/web/dist/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
  17. package/web/dist/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
  18. package/web/dist/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
  19. package/web/dist/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
  20. package/web/dist/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
  21. package/web/dist/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
  22. package/web/dist/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
  23. package/web/dist/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
  24. package/web/dist/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
  25. package/web/dist/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
  26. package/web/dist/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
  27. package/web/dist/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
  28. package/web/dist/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
  29. package/web/dist/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
  30. package/web/dist/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
  31. package/web/dist/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
  32. package/web/dist/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
  33. package/web/dist/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
  34. package/web/dist/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
  35. package/web/dist/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
  36. package/web/dist/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
  37. package/web/dist/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
  38. package/web/dist/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
  39. package/web/dist/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
  40. package/web/dist/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
  41. package/web/dist/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
  42. package/web/dist/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
  43. package/web/dist/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
  44. package/web/dist/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
  45. package/web/dist/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
  46. package/web/dist/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
  47. package/web/dist/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
  48. package/web/dist/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
  49. package/web/dist/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
  50. package/web/dist/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
  51. package/web/dist/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
  52. package/web/dist/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
  53. package/web/dist/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
  54. package/web/dist/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
  55. package/web/dist/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
  56. package/web/dist/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
  57. package/web/dist/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
  58. package/web/dist/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
  59. package/web/dist/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
  60. package/web/dist/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
  61. package/web/dist/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
  62. package/web/dist/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
  63. package/web/dist/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
  64. package/web/dist/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
  65. package/web/dist/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
  66. package/web/dist/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
  67. package/web/dist/assets/ModelsView-BBbmRxwR.js +1 -0
  68. package/web/dist/assets/{PluginsView-DBF_BvKL.js → PluginsView-DxIWxsB-.js} +1 -1
  69. package/web/dist/assets/SessionGrid-D-1XpCZg.js +39 -0
  70. package/web/dist/assets/SettingsPanel-ivpxRR6O.js +4 -0
  71. package/web/dist/assets/{SkillsView-BAorWQAI.js → SkillsView-Cpr_kpor.js} +1 -1
  72. package/web/dist/assets/{TemplatesTab-DEblm2pS.js → TemplatesTab-Cvyxqayr.js} +1 -1
  73. package/web/dist/assets/{TerminalView-Cnnipr8e.js → TerminalView-DTN8hmcS.js} +1 -1
  74. package/web/dist/assets/{ThreeScene-5Zi32o_j.js → ThreeScene-CukEnQe-.js} +1 -1
  75. package/web/dist/assets/{ToolsView-lOHdaw4V.js → ToolsView-D_FET-NB.js} +1 -1
  76. package/web/dist/assets/abap-BdImnpbu.js +1 -0
  77. package/web/dist/assets/actionscript-3-B3316cI-.js +1 -0
  78. package/web/dist/assets/ada-bCR0ucgS.js +1 -0
  79. package/web/dist/assets/ahk-CsyLZFj1.js +1 -0
  80. package/web/dist/assets/ahk2-8Zs4aa1G.js +1 -0
  81. package/web/dist/assets/andromeeda-C4gqWexZ.js +1 -0
  82. package/web/dist/assets/angular-html-DA-rfuFy.js +1 -0
  83. package/web/dist/assets/angular-ts-BrjP3tb8.js +1 -0
  84. package/web/dist/assets/apache-Pmp26Uib.js +1 -0
  85. package/web/dist/assets/apex-DhZFqWV2.js +1 -0
  86. package/web/dist/assets/apl-CORt7UWP.js +1 -0
  87. package/web/dist/assets/applescript-Co6uUVPk.js +1 -0
  88. package/web/dist/assets/ara-BRHolxvo.js +1 -0
  89. package/web/dist/assets/asciidoc-CSVQ5wI8.js +1 -0
  90. package/web/dist/assets/asm-D_Q5rh1f.js +1 -0
  91. package/web/dist/assets/astro-HNnZUWAn.js +1 -0
  92. package/web/dist/assets/aurora-x-D-2ljcwZ.js +1 -0
  93. package/web/dist/assets/awk-DMzUqQB5.js +1 -0
  94. package/web/dist/assets/ayu-dark-DYE7WIF3.js +1 -0
  95. package/web/dist/assets/ayu-light-BA47KaF1.js +1 -0
  96. package/web/dist/assets/ayu-mirage-32ctXXKs.js +1 -0
  97. package/web/dist/assets/ballerina-BFfxhgS-.js +1 -0
  98. package/web/dist/assets/bat-CickPsom.js +1 -0
  99. package/web/dist/assets/beancount-k_qm7-4y.js +1 -0
  100. package/web/dist/assets/berry-uYugtg8r.js +1 -0
  101. package/web/dist/assets/bibtex-CHM0blh-.js +1 -0
  102. package/web/dist/assets/bicep-Bmn6On1c.js +1 -0
  103. package/web/dist/assets/bird2-Bx8U0n9b.js +1 -0
  104. package/web/dist/assets/blade-2xfisSek.js +1 -0
  105. package/web/dist/assets/bsl-DlhNcFeZ.js +1 -0
  106. package/web/dist/assets/c-BIGW1oBm.js +1 -0
  107. package/web/dist/assets/c3-Dp5svz6Z.js +1 -0
  108. package/web/dist/assets/cadence-Bv_4Rxtq.js +1 -0
  109. package/web/dist/assets/cairo-KRGpt6FW.js +1 -0
  110. package/web/dist/assets/catppuccin-frappe-CZL1YF0i.js +1 -0
  111. package/web/dist/assets/catppuccin-latte-DH-8KZSZ.js +1 -0
  112. package/web/dist/assets/catppuccin-macchiato-B7yYVSCf.js +1 -0
  113. package/web/dist/assets/catppuccin-mocha-Ct7hS0mc.js +1 -0
  114. package/web/dist/assets/chapel-DTp_pixX.js +1 -0
  115. package/web/dist/assets/clarity-Dn5IMItf.js +1 -0
  116. package/web/dist/assets/clojure-P80f7IUj.js +1 -0
  117. package/web/dist/assets/cmake-D1j8_8rp.js +1 -0
  118. package/web/dist/assets/cobol-nBiQ_Alo.js +1 -0
  119. package/web/dist/assets/codeowners-Bp6g37R7.js +1 -0
  120. package/web/dist/assets/codeql-DsOJ9woJ.js +1 -0
  121. package/web/dist/assets/coffee-Ch7k5sss.js +1 -0
  122. package/web/dist/assets/common-lisp-Cg-RD9OK.js +1 -0
  123. package/web/dist/assets/coq-C7JzOVbR.js +1 -0
  124. package/web/dist/assets/cpp-BMRokrvK.js +1 -0
  125. package/web/dist/assets/crystal-DGywbUpC.js +1 -0
  126. package/web/dist/assets/csharp-DSvCPggb.js +1 -0
  127. package/web/dist/assets/css-CLj8gQPS.js +1 -0
  128. package/web/dist/assets/csv-fuZLfV_i.js +1 -0
  129. package/web/dist/assets/cue-D82EKSYY.js +1 -0
  130. package/web/dist/assets/cypher-COkxafJQ.js +1 -0
  131. package/web/dist/assets/d-85-TOEBH.js +1 -0
  132. package/web/dist/assets/dark-plus-C3mMm8J8.js +1 -0
  133. package/web/dist/assets/dart-bE4Kk8sk.js +1 -0
  134. package/web/dist/assets/dax-CEL-wOlO.js +1 -0
  135. package/web/dist/assets/desktop-BmXAJ9_W.js +1 -0
  136. package/web/dist/assets/diff-D97Zzqfu.js +1 -0
  137. package/web/dist/assets/docker-BcOcwvcX.js +1 -0
  138. package/web/dist/assets/dotenv-Da5cRb03.js +1 -0
  139. package/web/dist/assets/dracula-BzJJZx-M.js +1 -0
  140. package/web/dist/assets/dracula-soft-BXkSAIEj.js +1 -0
  141. package/web/dist/assets/dream-maker-BtqSS_iP.js +1 -0
  142. package/web/dist/assets/edge-FbVlp4U3.js +1 -0
  143. package/web/dist/assets/elixir-CkH2-t6x.js +1 -0
  144. package/web/dist/assets/elm-DbKCFpqz.js +1 -0
  145. package/web/dist/assets/emacs-lisp-C_m_b--Z.js +1 -0
  146. package/web/dist/assets/erb-DXfck5VN.js +1 -0
  147. package/web/dist/assets/erlang-DsQrWhSR.js +1 -0
  148. package/web/dist/assets/everforest-dark-BgDCqdQA.js +1 -0
  149. package/web/dist/assets/everforest-light-C8M2exoo.js +1 -0
  150. package/web/dist/assets/fennel-BYunw83y.js +1 -0
  151. package/web/dist/assets/fish-BvzEVeQv.js +1 -0
  152. package/web/dist/assets/fluent-C4IJs8-o.js +1 -0
  153. package/web/dist/assets/fortran-fixed-form-CkoXwp7k.js +1 -0
  154. package/web/dist/assets/fortran-free-form-BxgE0vQu.js +1 -0
  155. package/web/dist/assets/fsharp-CXgrBDvD.js +1 -0
  156. package/web/dist/assets/gdresource-TyuKm33G.js +1 -0
  157. package/web/dist/assets/gdscript-DqcFQ5yU.js +1 -0
  158. package/web/dist/assets/gdshader-DkwncUOv.js +1 -0
  159. package/web/dist/assets/genie-D0YGMca9.js +1 -0
  160. package/web/dist/assets/gherkin-DyxjwDmM.js +1 -0
  161. package/web/dist/assets/git-commit-F4YmCXRG.js +1 -0
  162. package/web/dist/assets/git-rebase-r7XF79zn.js +1 -0
  163. package/web/dist/assets/github-dark-DHJKELXO.js +1 -0
  164. package/web/dist/assets/github-dark-default-Cuk6v7N8.js +1 -0
  165. package/web/dist/assets/github-dark-dimmed-DH5Ifo-i.js +1 -0
  166. package/web/dist/assets/github-dark-high-contrast-E3gJ1_iC.js +1 -0
  167. package/web/dist/assets/github-light-DAi9KRSo.js +1 -0
  168. package/web/dist/assets/github-light-default-D7oLnXFd.js +1 -0
  169. package/web/dist/assets/github-light-high-contrast-BfjtVDDH.js +1 -0
  170. package/web/dist/assets/gleam-BspZqrRM.js +1 -0
  171. package/web/dist/assets/glimmer-js-ByusRIyA.js +1 -0
  172. package/web/dist/assets/glimmer-ts-BfAWNZQY.js +1 -0
  173. package/web/dist/assets/glsl-DplSGwfg.js +1 -0
  174. package/web/dist/assets/gn-n2N0HUVH.js +1 -0
  175. package/web/dist/assets/gnuplot-DdkO51Og.js +1 -0
  176. package/web/dist/assets/go-C27-OAKa.js +1 -0
  177. package/web/dist/assets/graphql-ChdNCCLP.js +1 -0
  178. package/web/dist/assets/groovy-gcz8RCvz.js +1 -0
  179. package/web/dist/assets/gruvbox-dark-hard-CFHQjOhq.js +1 -0
  180. package/web/dist/assets/gruvbox-dark-medium-GsRaNv29.js +1 -0
  181. package/web/dist/assets/gruvbox-dark-soft-CVdnzihN.js +1 -0
  182. package/web/dist/assets/gruvbox-light-hard-CH1njM8p.js +1 -0
  183. package/web/dist/assets/gruvbox-light-medium-DRw_LuNl.js +1 -0
  184. package/web/dist/assets/gruvbox-light-soft-hJgmCMqR.js +1 -0
  185. package/web/dist/assets/hack-BWmVpMyf.js +1 -0
  186. package/web/dist/assets/haml-D5jkg6IW.js +1 -0
  187. package/web/dist/assets/handlebars-BpdQsYii.js +1 -0
  188. package/web/dist/assets/haskell-Df6bDoY_.js +1 -0
  189. package/web/dist/assets/haxe-CfZj7gIn.js +1 -0
  190. package/web/dist/assets/hcl-BWvSN4gD.js +1 -0
  191. package/web/dist/assets/hjson-D5-asLiD.js +1 -0
  192. package/web/dist/assets/hlsl-D3lLCCz7.js +1 -0
  193. package/web/dist/assets/horizon-BUw7H-hv.js +1 -0
  194. package/web/dist/assets/horizon-bright-CUuTKBJd.js +1 -0
  195. package/web/dist/assets/houston-DnULxvSX.js +1 -0
  196. package/web/dist/assets/html-derivative-DlHx6ybY.js +1 -0
  197. package/web/dist/assets/html-pp8916En.js +1 -0
  198. package/web/dist/assets/http-jrhK8wxY.js +1 -0
  199. package/web/dist/assets/hurl-irOxFIW8.js +1 -0
  200. package/web/dist/assets/hxml-2-FPmUDs.js +1 -0
  201. package/web/dist/assets/hy-DFXneXwc.js +1 -0
  202. package/web/dist/assets/{icons-DLsYqrD5.js → icons-Cu8fYt4q.js} +1 -1
  203. package/web/dist/assets/imba-DGztddWO.js +1 -0
  204. package/web/dist/assets/index-C7rIgpwO.js +484 -0
  205. package/web/dist/assets/index-CYAcRfnc.css +1 -0
  206. package/web/dist/assets/ini-BEwlwnbL.js +1 -0
  207. package/web/dist/assets/java-CylS5w8V.js +1 -0
  208. package/web/dist/assets/javascript-wDzz0qaB.js +1 -0
  209. package/web/dist/assets/jinja-f2NsQr07.js +1 -0
  210. package/web/dist/assets/jison-wvAkD_A8.js +1 -0
  211. package/web/dist/assets/json-Cp-IABpG.js +1 -0
  212. package/web/dist/assets/json5-C9tS-k6U.js +1 -0
  213. package/web/dist/assets/jsonc-Des-eS-w.js +1 -0
  214. package/web/dist/assets/jsonl-DcaNXYhu.js +1 -0
  215. package/web/dist/assets/jsonnet-DFQXde-d.js +1 -0
  216. package/web/dist/assets/jssm-C2t-YnRu.js +1 -0
  217. package/web/dist/assets/jsx-g9-lgVsj.js +1 -0
  218. package/web/dist/assets/julia-5Bft2YPA.js +1 -0
  219. package/web/dist/assets/just-Cwhn7H3k.js +1 -0
  220. package/web/dist/assets/kanagawa-dragon-BuwD2xS4.js +1 -0
  221. package/web/dist/assets/kanagawa-lotus-C3DzagqV.js +1 -0
  222. package/web/dist/assets/kanagawa-wave-DFGoQZhC.js +1 -0
  223. package/web/dist/assets/kdl-DV7GczEv.js +1 -0
  224. package/web/dist/assets/kotlin-BdnUsdx6.js +1 -0
  225. package/web/dist/assets/kusto-wEQ09or8.js +1 -0
  226. package/web/dist/assets/laserwave-DUszq2jm.js +1 -0
  227. package/web/dist/assets/latex-D5pSuvFb.js +1 -0
  228. package/web/dist/assets/lean-BZvkOJ9d.js +1 -0
  229. package/web/dist/assets/less-B1dDrJ26.js +1 -0
  230. package/web/dist/assets/light-plus-B7mTdjB0.js +1 -0
  231. package/web/dist/assets/liquid-C0sCDyMI.js +1 -0
  232. package/web/dist/assets/llvm-BZoOZj88.js +1 -0
  233. package/web/dist/assets/log-2UxHyX5q.js +1 -0
  234. package/web/dist/assets/logo-BtOb2qkB.js +1 -0
  235. package/web/dist/assets/lua-BaeVxFsk.js +1 -0
  236. package/web/dist/assets/luau-BnpPk5vE.js +1 -0
  237. package/web/dist/assets/make-CHLpvVh8.js +1 -0
  238. package/web/dist/assets/{markdown-tZ6sw2sR.js → markdown-Bym7wmT0.js} +8 -8
  239. package/web/dist/assets/markdown-Cvjx9yec.js +1 -0
  240. package/web/dist/assets/marko-DjSrsDqO.js +1 -0
  241. package/web/dist/assets/material-theme-D5KoaKCx.js +1 -0
  242. package/web/dist/assets/material-theme-darker-BfHTSMKl.js +1 -0
  243. package/web/dist/assets/material-theme-lighter-B0m2ddpp.js +1 -0
  244. package/web/dist/assets/material-theme-ocean-CyktbL80.js +1 -0
  245. package/web/dist/assets/material-theme-palenight-Csfq5Kiy.js +1 -0
  246. package/web/dist/assets/matlab-D7o27uSR.js +1 -0
  247. package/web/dist/assets/mdc-D1_yUvq7.js +1 -0
  248. package/web/dist/assets/mdx-Cmh6b_Ma.js +1 -0
  249. package/web/dist/assets/mermaid-CQcHuHx7.js +1 -0
  250. package/web/dist/assets/min-dark-CafNBF8u.js +1 -0
  251. package/web/dist/assets/min-light-CTRr51gU.js +1 -0
  252. package/web/dist/assets/mipsasm-CKIfxQSi.js +1 -0
  253. package/web/dist/assets/mojo-DJz3ZmWd.js +1 -0
  254. package/web/dist/assets/monokai-BRVnQi9A.js +1 -0
  255. package/web/dist/assets/moonbit-CHtswR0a.js +1 -0
  256. package/web/dist/assets/move-el3G9tDJ.js +1 -0
  257. package/web/dist/assets/narrat-DRg8JJMk.js +1 -0
  258. package/web/dist/assets/nextflow-C-mBbutL.js +1 -0
  259. package/web/dist/assets/nextflow-groovy-vE_lwT2v.js +1 -0
  260. package/web/dist/assets/nginx-BpAMiNFr.js +1 -0
  261. package/web/dist/assets/night-owl-C39BiMTA.js +1 -0
  262. package/web/dist/assets/night-owl-light-CMTm3GFP.js +1 -0
  263. package/web/dist/assets/nim-BIad80T-.js +1 -0
  264. package/web/dist/assets/nix-CwoSXNpI.js +1 -0
  265. package/web/dist/assets/nord-Ddv68eIx.js +1 -0
  266. package/web/dist/assets/nsis-BlV79W_Q.js +1 -0
  267. package/web/dist/assets/nushell-D3jzshHO.js +1 -0
  268. package/web/dist/assets/objective-c-DXmwc3jG.js +1 -0
  269. package/web/dist/assets/objective-cpp-CLxacb5B.js +1 -0
  270. package/web/dist/assets/ocaml-C0hk2d4L.js +1 -0
  271. package/web/dist/assets/odin-BBf5iR-q.js +1 -0
  272. package/web/dist/assets/one-dark-pro-DVMEJ2y_.js +1 -0
  273. package/web/dist/assets/one-light-C3Wv6jpd.js +1 -0
  274. package/web/dist/assets/openscad-C4EeE6gA.js +1 -0
  275. package/web/dist/assets/org-DM6o9KBp.js +1 -0
  276. package/web/dist/assets/{panels-wDJMsvra.js → panels-BEKHl5l-.js} +1 -1
  277. package/web/dist/assets/pascal-D93ZcfNL.js +1 -0
  278. package/web/dist/assets/perl-B9cMNwum.js +1 -0
  279. package/web/dist/assets/php-Csjmro_R.js +1 -0
  280. package/web/dist/assets/pkl-u5AG7uiY.js +1 -0
  281. package/web/dist/assets/plastic-3e1v2bzS.js +1 -0
  282. package/web/dist/assets/plsql-ChMvpjG-.js +1 -0
  283. package/web/dist/assets/po-BTJTHyun.js +1 -0
  284. package/web/dist/assets/poimandres-CS3Unz2-.js +1 -0
  285. package/web/dist/assets/polar-C0HS_06l.js +1 -0
  286. package/web/dist/assets/postcss-CXtECtnM.js +1 -0
  287. package/web/dist/assets/powerquery-CEu0bR-o.js +1 -0
  288. package/web/dist/assets/powershell-BmBUJMz7.js +1 -0
  289. package/web/dist/assets/prisma-Vru482bI.js +1 -0
  290. package/web/dist/assets/prolog-CbFg5uaA.js +1 -0
  291. package/web/dist/assets/proto-C7zT0LnQ.js +1 -0
  292. package/web/dist/assets/pug-DKIMFp6K.js +1 -0
  293. package/web/dist/assets/puppet-BMWR74SV.js +1 -0
  294. package/web/dist/assets/purescript-CklMAg4u.js +1 -0
  295. package/web/dist/assets/python-B6aJPvgy.js +1 -0
  296. package/web/dist/assets/qml-3beO22l8.js +1 -0
  297. package/web/dist/assets/qmldir-C8lEn-DE.js +1 -0
  298. package/web/dist/assets/qss-IeuSbFQv.js +1 -0
  299. package/web/dist/assets/r-Cf5RLm7j.js +1 -0
  300. package/web/dist/assets/racket-BqYA7rlc.js +1 -0
  301. package/web/dist/assets/raku-DXvB9xmW.js +1 -0
  302. package/web/dist/assets/razor-BjBPvh-w.js +1 -0
  303. package/web/dist/assets/rbs-CpoqiR4B.js +1 -0
  304. package/web/dist/assets/{react-vendor-BRkWBfPR.js → react-vendor-D76F8wnc.js} +1 -1
  305. package/web/dist/assets/red-hvxz__6c.js +1 -0
  306. package/web/dist/assets/reg-C-SQnVFl.js +1 -0
  307. package/web/dist/assets/regexp-CDVJQ6XC.js +1 -0
  308. package/web/dist/assets/rel-C3B-1QV4.js +1 -0
  309. package/web/dist/assets/riscv-BM1_JUlF.js +1 -0
  310. package/web/dist/assets/ron-D8l8udqQ.js +1 -0
  311. package/web/dist/assets/rose-pine-5qJOZa0Y.js +1 -0
  312. package/web/dist/assets/rose-pine-dawn-zx0QlTCp.js +1 -0
  313. package/web/dist/assets/rose-pine-moon-C9pEdX9L.js +1 -0
  314. package/web/dist/assets/rosmsg-BJDFO7_C.js +1 -0
  315. package/web/dist/assets/rst-bs7f0vWN.js +1 -0
  316. package/web/dist/assets/ruby-C0TQ7zu5.js +1 -0
  317. package/web/dist/assets/rust-B1yitclQ.js +1 -0
  318. package/web/dist/assets/sas-DEy46yEz.js +1 -0
  319. package/web/dist/assets/sass-Cj5Yp3dK.js +1 -0
  320. package/web/dist/assets/scala-CqE71os6.js +1 -0
  321. package/web/dist/assets/scheme-C98Dy4si.js +1 -0
  322. package/web/dist/assets/scss-D5BDwBP9.js +1 -0
  323. package/web/dist/assets/sdbl-DVxCFoDh.js +1 -0
  324. package/web/dist/assets/shaderlab-Dg9Lc6iA.js +1 -0
  325. package/web/dist/assets/shellscript-Yzrsuije.js +1 -0
  326. package/web/dist/assets/shellsession-BADoaaVG.js +1 -0
  327. package/web/dist/assets/slack-dark-BthQWCQV.js +1 -0
  328. package/web/dist/assets/slack-ochin-DqwNpetd.js +1 -0
  329. package/web/dist/assets/smalltalk-BOQMe2GC.js +1 -0
  330. package/web/dist/assets/smithy-cds9vsN8.js +1 -0
  331. package/web/dist/assets/snazzy-light-Bw305WKR.js +1 -0
  332. package/web/dist/assets/solarized-dark-CpvCGNkr.js +1 -0
  333. package/web/dist/assets/solarized-light-Dlz6yCKv.js +1 -0
  334. package/web/dist/assets/solidity-DijEV5ha.js +1 -0
  335. package/web/dist/assets/soy-8wufbnw4.js +1 -0
  336. package/web/dist/assets/sparql-rVzFXLq3.js +1 -0
  337. package/web/dist/assets/splunk-BtCnVYZw.js +1 -0
  338. package/web/dist/assets/sql-CRqJ_cUM.js +1 -0
  339. package/web/dist/assets/ssh-config-_ykCGR6B.js +1 -0
  340. package/web/dist/assets/stata-DI20mbqo.js +1 -0
  341. package/web/dist/assets/{state-B80cA8v4.js → state-CZakZ3-m.js} +1 -1
  342. package/web/dist/assets/sttLanguages-BNRptAQA.js +1 -0
  343. package/web/dist/assets/stylus-BEDo0Tqx.js +1 -0
  344. package/web/dist/assets/surrealql-Cjom0U5J.js +1 -0
  345. package/web/dist/assets/svelte-Cy7k_4gC.js +1 -0
  346. package/web/dist/assets/swift-C2oV4EkX.js +1 -0
  347. package/web/dist/assets/synthwave-84-CbfX1IO0.js +1 -0
  348. package/web/dist/assets/system-verilog-0hqHdDBg.js +1 -0
  349. package/web/dist/assets/systemd-4A_iFExJ.js +1 -0
  350. package/web/dist/assets/talonscript-CkByrt1z.js +1 -0
  351. package/web/dist/assets/tasl-QIJgUcNo.js +1 -0
  352. package/web/dist/assets/tcl-dwOrl1Do.js +1 -0
  353. package/web/dist/assets/templ-DhtptRzy.js +1 -0
  354. package/web/dist/assets/terraform-BETggiCN.js +1 -0
  355. package/web/dist/assets/tex-D96PA37w.js +1 -0
  356. package/web/dist/assets/tokyo-night-hegEt444.js +1 -0
  357. package/web/dist/assets/toml-vGWfd6FD.js +1 -0
  358. package/web/dist/assets/ts-tags-D351s5mN.js +1 -0
  359. package/web/dist/assets/tsv-B_m7g4N7.js +1 -0
  360. package/web/dist/assets/tsx-COt5Ahok.js +1 -0
  361. package/web/dist/assets/turtle-BsS91CYL.js +1 -0
  362. package/web/dist/assets/twig-27uCiNez.js +1 -0
  363. package/web/dist/assets/typescript-BPQ3VLAy.js +1 -0
  364. package/web/dist/assets/typespec-CAFt9gP4.js +1 -0
  365. package/web/dist/assets/typst-BUadGCkm.js +1 -0
  366. package/web/dist/assets/v-BGw2Nkan.js +1 -0
  367. package/web/dist/assets/vala-CsfeWuGM.js +1 -0
  368. package/web/dist/assets/vb-Cu-pLBUe.js +1 -0
  369. package/web/dist/assets/verilog-nZwndyjY.js +1 -0
  370. package/web/dist/assets/vesper-DRje8inN.js +1 -0
  371. package/web/dist/assets/vhdl-CeAyd5Ju.js +1 -0
  372. package/web/dist/assets/viml-CJc9bBzg.js +1 -0
  373. package/web/dist/assets/vitesse-black-Bkuqu6BP.js +1 -0
  374. package/web/dist/assets/vitesse-dark-D0r3Knsf.js +1 -0
  375. package/web/dist/assets/vitesse-light-CVO1_9PV.js +1 -0
  376. package/web/dist/assets/vue-BqiEGhQt.js +1 -0
  377. package/web/dist/assets/vue-html-AaS7Mt5G.js +1 -0
  378. package/web/dist/assets/vue-vine-BoDAl6tE.js +1 -0
  379. package/web/dist/assets/vyper-CDx5xZoG.js +1 -0
  380. package/web/dist/assets/wasm-CG6Dc4jp.js +1 -0
  381. package/web/dist/assets/wasm-MzD3tlZU.js +1 -0
  382. package/web/dist/assets/wenyan-BV7otONQ.js +1 -0
  383. package/web/dist/assets/wgsl-Dx-B1_4e.js +1 -0
  384. package/web/dist/assets/wikitext-BhOHFoWU.js +1 -0
  385. package/web/dist/assets/wit-5i3qLPDT.js +1 -0
  386. package/web/dist/assets/wolfram-lXgVvXCa.js +1 -0
  387. package/web/dist/assets/xml-sdJ4AIDG.js +1 -0
  388. package/web/dist/assets/xsl-CtQFsRM5.js +1 -0
  389. package/web/dist/assets/yaml-Buea-lGh.js +1 -0
  390. package/web/dist/assets/zenscript-DVFEvuxE.js +1 -0
  391. package/web/dist/assets/zig-VOosw3JB.js +1 -0
  392. package/web/dist/index.html +7 -7
  393. package/web/dist/assets/AutomationView-ClGqJM46.js +0 -1
  394. package/web/dist/assets/ChannelConfigView-BcGUdK94.js +0 -8
  395. package/web/dist/assets/ModelsView-DVTuTql9.js +0 -1
  396. package/web/dist/assets/SessionGrid-ByIAFTc2.js +0 -38
  397. package/web/dist/assets/SettingsPanel-CHRy0Xqj.js +0 -4
  398. package/web/dist/assets/index-Bht_ARrv.css +0 -1
  399. package/web/dist/assets/index-DEninW1j.js +0 -70
@@ -1,70 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ModelsView-DVTuTql9.js","assets/markdown-tZ6sw2sR.js","assets/icons-DLsYqrD5.js","assets/react-vendor-BRkWBfPR.js","assets/state-B80cA8v4.js","assets/panels-wDJMsvra.js","assets/ToolsView-lOHdaw4V.js","assets/SkillsView-BAorWQAI.js","assets/TemplatesTab-DEblm2pS.js","assets/HookConfigView-DE0NCrV9.js","assets/FileTreeView-DLRQZmLP.js","assets/TerminalView-Cnnipr8e.js","assets/terminal-DgJRGhIz.js","assets/TerminalView-C1Mzzh8g.css","assets/SessionGrid-ByIAFTc2.js","assets/SettingsPanel-CHRy0Xqj.js","assets/ChannelConfigView-BcGUdK94.js","assets/ConnectorsView-Dadj20jv.js","assets/AutomationView-ClGqJM46.js","assets/PluginsView-DBF_BvKL.js"])))=>i.map(i=>d[i]);
2
- var CS=Object.defineProperty;var _S=(a,t,s)=>t in a?CS(a,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[t]=s;var Fe=(a,t,s)=>_S(a,typeof t!="symbol"?t+"":t,s);import{r as TS,j as m,M as NS,d as ES}from"./markdown-tZ6sw2sR.js";import{r as AS,g as Uf,a as _,F as Fi,C as bb,b as vb,d as ba,P as of,e as jS,X as ss,L as Ln,f as xb,h as mc,G as Sb,i as kb,S as RS,j as If,M as MS,k as hc,l as gc,m as wb,n as OS,o as Cb,A as BS,p as $f,q as DS,s as LS,t as zS,u as _b,v as US,w as IS,x as $S,y as Hf,E as Ug,D as mo,z as ec,B as HS,H as yc,I as tc,J as Tb,K as Nb,N as PS,O as Eb,Q as Ig,T as FS,U as GS,V as qS,Y as lf,Z as ao,_ as WS,$ as Pf,a0 as VS,a1 as KS,a2 as YS,a3 as $g,a4 as ZS,a5 as Hg,a6 as QS,a7 as XS,a8 as JS,a9 as Ab,aa as e0,ab as t0,ac as n0,ad as s0,ae as a0,af as i0,ag as r0,ah as o0,ai as l0,aj as c0,ak as u0,al as d0,am as jb,an as f0,ao as p0,W as m0}from"./icons-DLsYqrD5.js";import{r as h0}from"./react-vendor-BRkWBfPR.js";import{r as g0,c as Ut}from"./state-B80cA8v4.js";import{P as Rb,a as cf,b as Mb}from"./panels-wDJMsvra.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))i(o);new MutationObserver(o=>{for(const c of o)if(c.type==="childList")for(const u of c.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&i(u)}).observe(document,{childList:!0,subtree:!0});function s(o){const c={};return o.integrity&&(c.integrity=o.integrity),o.referrerPolicy&&(c.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?c.credentials="include":o.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function i(o){if(o.ep)return;o.ep=!0;const c=s(o);fetch(o.href,c)}})();var Rd={exports:{}},qr={},Md={exports:{}},Od={};/**
3
- * @license React
4
- * scheduler.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 Pg;function y0(){return Pg||(Pg=1,(function(a){function t(L,Z){var W=L.length;L.push(Z);e:for(;0<W;){var Be=W-1>>>1,Le=L[Be];if(0<o(Le,Z))L[Be]=Z,L[W]=Le,W=Be;else break e}}function s(L){return L.length===0?null:L[0]}function i(L){if(L.length===0)return null;var Z=L[0],W=L.pop();if(W!==Z){L[0]=W;e:for(var Be=0,Le=L.length,ze=Le>>>1;Be<ze;){var Ee=2*(Be+1)-1,ke=L[Ee],st=Ee+1,lt=L[st];if(0>o(ke,W))st<Le&&0>o(lt,ke)?(L[Be]=lt,L[st]=W,Be=st):(L[Be]=ke,L[Ee]=W,Be=Ee);else if(st<Le&&0>o(lt,W))L[Be]=lt,L[st]=W,Be=st;else break e}}return Z}function o(L,Z){var W=L.sortIndex-Z.sortIndex;return W!==0?W:L.id-Z.id}if(a.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;a.unstable_now=function(){return c.now()}}else{var u=Date,d=u.now();a.unstable_now=function(){return u.now()-d}}var p=[],g=[],y=1,b=null,x=3,S=!1,k=!1,C=!1,T=!1,E=typeof setTimeout=="function"?setTimeout:null,A=typeof clearTimeout=="function"?clearTimeout:null,B=typeof setImmediate<"u"?setImmediate:null;function M(L){for(var Z=s(g);Z!==null;){if(Z.callback===null)i(g);else if(Z.startTime<=L)i(g),Z.sortIndex=Z.expirationTime,t(p,Z);else break;Z=s(g)}}function j(L){if(C=!1,M(L),!k)if(s(p)!==null)k=!0,J||(J=!0,de());else{var Z=s(g);Z!==null&&he(j,Z.startTime-L)}}var J=!1,Y=-1,te=5,se=-1;function ge(){return T?!0:!(a.unstable_now()-se<te)}function Ke(){if(T=!1,J){var L=a.unstable_now();se=L;var Z=!0;try{e:{k=!1,C&&(C=!1,A(Y),Y=-1),S=!0;var W=x;try{t:{for(M(L),b=s(p);b!==null&&!(b.expirationTime>L&&ge());){var Be=b.callback;if(typeof Be=="function"){b.callback=null,x=b.priorityLevel;var Le=Be(b.expirationTime<=L);if(L=a.unstable_now(),typeof Le=="function"){b.callback=Le,M(L),Z=!0;break t}b===s(p)&&i(p),M(L)}else i(p);b=s(p)}if(b!==null)Z=!0;else{var ze=s(g);ze!==null&&he(j,ze.startTime-L),Z=!1}}break e}finally{b=null,x=W,S=!1}Z=void 0}}finally{Z?de():J=!1}}}var de;if(typeof B=="function")de=function(){B(Ke)};else if(typeof MessageChannel<"u"){var K=new MessageChannel,ne=K.port2;K.port1.onmessage=Ke,de=function(){ne.postMessage(null)}}else de=function(){E(Ke,0)};function he(L,Z){Y=E(function(){L(a.unstable_now())},Z)}a.unstable_IdlePriority=5,a.unstable_ImmediatePriority=1,a.unstable_LowPriority=4,a.unstable_NormalPriority=3,a.unstable_Profiling=null,a.unstable_UserBlockingPriority=2,a.unstable_cancelCallback=function(L){L.callback=null},a.unstable_forceFrameRate=function(L){0>L||125<L?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):te=0<L?Math.floor(1e3/L):5},a.unstable_getCurrentPriorityLevel=function(){return x},a.unstable_next=function(L){switch(x){case 1:case 2:case 3:var Z=3;break;default:Z=x}var W=x;x=Z;try{return L()}finally{x=W}},a.unstable_requestPaint=function(){T=!0},a.unstable_runWithPriority=function(L,Z){switch(L){case 1:case 2:case 3:case 4:case 5:break;default:L=3}var W=x;x=L;try{return Z()}finally{x=W}},a.unstable_scheduleCallback=function(L,Z,W){var Be=a.unstable_now();switch(typeof W=="object"&&W!==null?(W=W.delay,W=typeof W=="number"&&0<W?Be+W:Be):W=Be,L){case 1:var Le=-1;break;case 2:Le=250;break;case 5:Le=1073741823;break;case 4:Le=1e4;break;default:Le=5e3}return Le=W+Le,L={id:y++,callback:Z,priorityLevel:L,startTime:W,expirationTime:Le,sortIndex:-1},W>Be?(L.sortIndex=W,t(g,L),s(p)===null&&L===s(g)&&(C?(A(Y),Y=-1):C=!0,he(j,W-Be))):(L.sortIndex=Le,t(p,L),k||S||(k=!0,J||(J=!0,de()))),L},a.unstable_shouldYield=ge,a.unstable_wrapCallback=function(L){var Z=x;return function(){var W=x;x=Z;try{return L.apply(this,arguments)}finally{x=W}}}})(Od)),Od}var Fg;function b0(){return Fg||(Fg=1,Md.exports=y0()),Md.exports}/**
11
- * @license React
12
- * react-dom-client.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 Gg;function v0(){if(Gg)return qr;Gg=1;var a=b0(),t=AS(),s=h0();function i(e){var n="https://react.dev/errors/"+e;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var r=2;r<arguments.length;r++)n+="&args[]="+encodeURIComponent(arguments[r])}return"Minified React error #"+e+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function c(e){var n=e,r=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do n=e,(n.flags&4098)!==0&&(r=n.return),e=n.return;while(e)}return n.tag===3?r:null}function u(e){if(e.tag===13){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function d(e){if(e.tag===31){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function p(e){if(c(e)!==e)throw Error(i(188))}function g(e){var n=e.alternate;if(!n){if(n=c(e),n===null)throw Error(i(188));return n!==e?null:e}for(var r=e,l=n;;){var f=r.return;if(f===null)break;var h=f.alternate;if(h===null){if(l=f.return,l!==null){r=l;continue}break}if(f.child===h.child){for(h=f.child;h;){if(h===r)return p(f),e;if(h===l)return p(f),n;h=h.sibling}throw Error(i(188))}if(r.return!==l.return)r=f,l=h;else{for(var v=!1,w=f.child;w;){if(w===r){v=!0,r=f,l=h;break}if(w===l){v=!0,l=f,r=h;break}w=w.sibling}if(!v){for(w=h.child;w;){if(w===r){v=!0,r=h,l=f;break}if(w===l){v=!0,l=h,r=f;break}w=w.sibling}if(!v)throw Error(i(189))}}if(r.alternate!==l)throw Error(i(190))}if(r.tag!==3)throw Error(i(188));return r.stateNode.current===r?e:n}function y(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e;for(e=e.child;e!==null;){if(n=y(e),n!==null)return n;e=e.sibling}return null}var b=Object.assign,x=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),T=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),A=Symbol.for("react.consumer"),B=Symbol.for("react.context"),M=Symbol.for("react.forward_ref"),j=Symbol.for("react.suspense"),J=Symbol.for("react.suspense_list"),Y=Symbol.for("react.memo"),te=Symbol.for("react.lazy"),se=Symbol.for("react.activity"),ge=Symbol.for("react.memo_cache_sentinel"),Ke=Symbol.iterator;function de(e){return e===null||typeof e!="object"?null:(e=Ke&&e[Ke]||e["@@iterator"],typeof e=="function"?e:null)}var K=Symbol.for("react.client.reference");function ne(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===K?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case C:return"Fragment";case E:return"Profiler";case T:return"StrictMode";case j:return"Suspense";case J:return"SuspenseList";case se:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case k:return"Portal";case B:return e.displayName||"Context";case A:return(e._context.displayName||"Context")+".Consumer";case M:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Y:return n=e.displayName||null,n!==null?n:ne(e.type)||"Memo";case te:n=e._payload,e=e._init;try{return ne(e(n))}catch{}}return null}var he=Array.isArray,L=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W={pending:!1,data:null,method:null,action:null},Be=[],Le=-1;function ze(e){return{current:e}}function Ee(e){0>Le||(e.current=Be[Le],Be[Le]=null,Le--)}function ke(e,n){Le++,Be[Le]=e.current,e.current=n}var st=ze(null),lt=ze(null),Zt=ze(null),dn=ze(null);function fn(e,n){switch(ke(Zt,n),ke(lt,e),ke(st,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?og(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=og(n),e=lg(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Ee(st),ke(st,e)}function wn(){Ee(st),Ee(lt),Ee(Zt)}function os(e){e.memoizedState!==null&&ke(dn,e);var n=st.current,r=lg(n,e.type);n!==r&&(ke(lt,e),ke(st,r))}function ls(e){lt.current===e&&(Ee(st),Ee(lt)),dn.current===e&&(Ee(dn),Hr._currentValue=W)}var cs,Is;function at(e){if(cs===void 0)try{throw Error()}catch(r){var n=r.stack.trim().match(/\n( *(at )?)/);cs=n&&n[1]||"",Is=-1<r.stack.indexOf(`
19
- at`)?" (<anonymous>)":-1<r.stack.indexOf("@")?"@unknown:0:0":""}return`
20
- `+cs+e+Is}var Q=!1;function We(e,n){if(!e||Q)return"";Q=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(n){var V=function(){throw Error()};if(Object.defineProperty(V.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(V,[])}catch(H){var I=H}Reflect.construct(e,[],V)}else{try{V.call()}catch(H){I=H}e.call(V.prototype)}}else{try{throw Error()}catch(H){I=H}(V=e())&&typeof V.catch=="function"&&V.catch(function(){})}}catch(H){if(H&&I&&typeof H.stack=="string")return[H.stack,I.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var f=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");f&&f.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var h=l.DetermineComponentFrameRoot(),v=h[0],w=h[1];if(v&&w){var N=v.split(`
21
- `),U=w.split(`
22
- `);for(f=l=0;l<N.length&&!N[l].includes("DetermineComponentFrameRoot");)l++;for(;f<U.length&&!U[f].includes("DetermineComponentFrameRoot");)f++;if(l===N.length||f===U.length)for(l=N.length-1,f=U.length-1;1<=l&&0<=f&&N[l]!==U[f];)f--;for(;1<=l&&0<=f;l--,f--)if(N[l]!==U[f]){if(l!==1||f!==1)do if(l--,f--,0>f||N[l]!==U[f]){var G=`
23
- `+N[l].replace(" at new "," at ");return e.displayName&&G.includes("<anonymous>")&&(G=G.replace("<anonymous>",e.displayName)),G}while(1<=l&&0<=f);break}}}finally{Q=!1,Error.prepareStackTrace=r}return(r=e?e.displayName||e.name:"")?at(r):""}function we(e,n){switch(e.tag){case 26:case 27:case 5:return at(e.type);case 16:return at("Lazy");case 13:return e.child!==n&&n!==null?at("Suspense Fallback"):at("Suspense");case 19:return at("SuspenseList");case 0:case 15:return We(e.type,!1);case 11:return We(e.type.render,!1);case 1:return We(e.type,!0);case 31:return at("Activity");default:return""}}function be(e){try{var n="",r=null;do n+=we(e,r),r=e,e=e.return;while(e);return n}catch(l){return`
24
- Error generating stack: `+l.message+`
25
- `+l.stack}}var ie=Object.prototype.hasOwnProperty,Ae=a.unstable_scheduleCallback,ct=a.unstable_cancelCallback,Ot=a.unstable_shouldYield,_t=a.unstable_requestPaint,tt=a.unstable_now,nn=a.unstable_getCurrentPriorityLevel,$s=a.unstable_ImmediatePriority,Va=a.unstable_UserBlockingPriority,Hs=a.unstable_NormalPriority,Co=a.unstable_LowPriority,Vt=a.unstable_IdlePriority,kc=a.log,pn=a.unstable_setDisableYieldValue,Ps=null,Kt=null;function mn(e){if(typeof kc=="function"&&pn(e),Kt&&typeof Kt.setStrictMode=="function")try{Kt.setStrictMode(Ps,e)}catch{}}var It=Math.clz32?Math.clz32:wc,_o=Math.log,To=Math.LN2;function wc(e){return e>>>=0,e===0?32:31-(_o(e)/To|0)|0}var Ka=256,Ya=262144,us=4194304;function Un(e){var n=e&42;if(n!==0)return n;switch(e&-e){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 e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Za(e,n,r){var l=e.pendingLanes;if(l===0)return 0;var f=0,h=e.suspendedLanes,v=e.pingedLanes;e=e.warmLanes;var w=l&134217727;return w!==0?(l=w&~h,l!==0?f=Un(l):(v&=w,v!==0?f=Un(v):r||(r=w&~e,r!==0&&(f=Un(r))))):(w=l&~h,w!==0?f=Un(w):v!==0?f=Un(v):r||(r=l&~e,r!==0&&(f=Un(r)))),f===0?0:n!==0&&n!==f&&(n&h)===0&&(h=f&-f,r=n&-n,h>=r||h===32&&(r&4194048)!==0)?n:f}function Fs(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function Qa(e,n){switch(e){case 1:case 2:case 4:case 8:case 64:return n+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 n+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 No(){var e=us;return us<<=1,(us&62914560)===0&&(us=4194304),e}function Xa(e){for(var n=[],r=0;31>r;r++)n.push(e);return n}function ds(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Eo(e,n,r,l,f,h){var v=e.pendingLanes;e.pendingLanes=r,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=r,e.entangledLanes&=r,e.errorRecoveryDisabledLanes&=r,e.shellSuspendCounter=0;var w=e.entanglements,N=e.expirationTimes,U=e.hiddenUpdates;for(r=v&~r;0<r;){var G=31-It(r),V=1<<G;w[G]=0,N[G]=-1;var I=U[G];if(I!==null)for(U[G]=null,G=0;G<I.length;G++){var H=I[G];H!==null&&(H.lane&=-536870913)}r&=~V}l!==0&&fs(e,l,0),h!==0&&f===0&&e.tag!==0&&(e.suspendedLanes|=h&~(v&~n))}function fs(e,n,r){e.pendingLanes|=n,e.suspendedLanes&=~n;var l=31-It(n);e.entangledLanes|=n,e.entanglements[l]=e.entanglements[l]|1073741824|r&261930}function Ao(e,n){var r=e.entangledLanes|=n;for(e=e.entanglements;r;){var l=31-It(r),f=1<<l;f&n|e[l]&n&&(e[l]|=n),r&=~f}}function Ja(e,n){var r=n&-n;return r=(r&42)!==0?1:Sa(r),(r&(e.suspendedLanes|n))!==0?0:r}function Sa(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=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:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Qi(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Xi(){var e=Z.p;return e!==0?e:(e=window.event,e===void 0?32:Rg(e.type))}function Ji(e,n){var r=Z.p;try{return Z.p=e,n()}finally{Z.p=r}}var In=Math.random().toString(36).slice(2),Tt="__reactFiber$"+In,$t="__reactProps$"+In,Vn="__reactContainer$"+In,ka="__reactEvents$"+In,Cc="__reactListeners$"+In,_c="__reactHandles$"+In,jo="__reactResources$"+In,wa="__reactMarker$"+In;function er(e){delete e[Tt],delete e[$t],delete e[ka],delete e[Cc],delete e[_c]}function Gs(e){var n=e[Tt];if(n)return n;for(var r=e.parentNode;r;){if(n=r[Vn]||r[Tt]){if(r=n.alternate,n.child!==null||r!==null&&r.child!==null)for(e=hg(e);e!==null;){if(r=e[Tt])return r;e=hg(e)}return n}e=r,r=e.parentNode}return null}function ps(e){if(e=e[Tt]||e[Vn]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function Ca(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(i(33))}function Kn(e){var n=e[jo];return n||(n=e[jo]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function Nt(e){e[wa]=!0}var O=new Set,F={};function X(e,n){pe(e,n),pe(e+"Capture",n)}function pe(e,n){for(F[e]=n,e=0;e<n.length;e++)O.add(n[e])}var ve=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]*$"),Ve={},it={};function Bt(e){return ie.call(it,e)?!0:ie.call(Ve,e)?!1:ve.test(e)?it[e]=!0:(Ve[e]=!0,!1)}function ut(e,n,r){if(Bt(n))if(r===null)e.removeAttribute(n);else{switch(typeof r){case"undefined":case"function":case"symbol":e.removeAttribute(n);return;case"boolean":var l=n.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){e.removeAttribute(n);return}}e.setAttribute(n,""+r)}}function je(e,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttribute(n,""+r)}}function Yt(e,n,r,l){if(l===null)e.removeAttribute(r);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(r);return}e.setAttributeNS(n,r,""+l)}}function Qt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function tr(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function nr(e,n,r){var l=Object.getOwnPropertyDescriptor(e.constructor.prototype,n);if(!e.hasOwnProperty(n)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var f=l.get,h=l.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return f.call(this)},set:function(v){r=""+v,h.call(this,v)}}),Object.defineProperty(e,n,{enumerable:l.enumerable}),{getValue:function(){return r},setValue:function(v){r=""+v},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function Cn(e){if(!e._valueTracker){var n=tr(e)?"checked":"value";e._valueTracker=nr(e,n,""+e[n])}}function Ro(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var r=n.getValue(),l="";return e&&(l=tr(e)?e.checked?"true":"false":e.value),e=l,e!==r?(n.setValue(e),!0):!1}function _n(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var ms=/[\n"\\]/g;function Xt(e){return e.replace(ms,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function sr(e,n,r,l,f,h,v,w){e.name="",v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"?e.type=v:e.removeAttribute("type"),n!=null?v==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+Qt(n)):e.value!==""+Qt(n)&&(e.value=""+Qt(n)):v!=="submit"&&v!=="reset"||e.removeAttribute("value"),n!=null?Tc(e,v,Qt(n)):r!=null?Tc(e,v,Qt(r)):l!=null&&e.removeAttribute("value"),f==null&&h!=null&&(e.defaultChecked=!!h),f!=null&&(e.checked=f&&typeof f!="function"&&typeof f!="symbol"),w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?e.name=""+Qt(w):e.removeAttribute("name")}function tp(e,n,r,l,f,h,v,w){if(h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"&&(e.type=h),n!=null||r!=null){if(!(h!=="submit"&&h!=="reset"||n!=null)){Cn(e);return}r=r!=null?""+Qt(r):"",n=n!=null?""+Qt(n):r,w||n===e.value||(e.value=n),e.defaultValue=n}l=l??f,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=w?e.checked:!!l,e.defaultChecked=!!l,v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(e.name=v),Cn(e)}function Tc(e,n,r){n==="number"&&_n(e.ownerDocument)===e||e.defaultValue===""+r||(e.defaultValue=""+r)}function ei(e,n,r,l){if(e=e.options,n){n={};for(var f=0;f<r.length;f++)n["$"+r[f]]=!0;for(r=0;r<e.length;r++)f=n.hasOwnProperty("$"+e[r].value),e[r].selected!==f&&(e[r].selected=f),f&&l&&(e[r].defaultSelected=!0)}else{for(r=""+Qt(r),n=null,f=0;f<e.length;f++){if(e[f].value===r){e[f].selected=!0,l&&(e[f].defaultSelected=!0);return}n!==null||e[f].disabled||(n=e[f])}n!==null&&(n.selected=!0)}}function np(e,n,r){if(n!=null&&(n=""+Qt(n),n!==e.value&&(e.value=n),r==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=r!=null?""+Qt(r):""}function sp(e,n,r,l){if(n==null){if(l!=null){if(r!=null)throw Error(i(92));if(he(l)){if(1<l.length)throw Error(i(93));l=l[0]}r=l}r==null&&(r=""),n=r}r=Qt(n),e.defaultValue=r,l=e.textContent,l===r&&l!==""&&l!==null&&(e.value=l),Cn(e)}function ti(e,n){if(n){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=n;return}}e.textContent=n}var vv=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 ap(e,n,r){var l=n.indexOf("--")===0;r==null||typeof r=="boolean"||r===""?l?e.setProperty(n,""):n==="float"?e.cssFloat="":e[n]="":l?e.setProperty(n,r):typeof r!="number"||r===0||vv.has(n)?n==="float"?e.cssFloat=r:e[n]=(""+r).trim():e[n]=r+"px"}function ip(e,n,r){if(n!=null&&typeof n!="object")throw Error(i(62));if(e=e.style,r!=null){for(var l in r)!r.hasOwnProperty(l)||n!=null&&n.hasOwnProperty(l)||(l.indexOf("--")===0?e.setProperty(l,""):l==="float"?e.cssFloat="":e[l]="");for(var f in n)l=n[f],n.hasOwnProperty(f)&&r[f]!==l&&ap(e,f,l)}else for(var h in n)n.hasOwnProperty(h)&&ap(e,h,n[h])}function Nc(e){if(e.indexOf("-")===-1)return!1;switch(e){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 xv=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"]]),Sv=/^[\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 Mo(e){return Sv.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function hs(){}var Ec=null;function Ac(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ni=null,si=null;function rp(e){var n=ps(e);if(n&&(e=n.stateNode)){var r=e[$t]||null;e:switch(e=n.stateNode,n.type){case"input":if(sr(e,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name),n=r.name,r.type==="radio"&&n!=null){for(r=e;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll('input[name="'+Xt(""+n)+'"][type="radio"]'),n=0;n<r.length;n++){var l=r[n];if(l!==e&&l.form===e.form){var f=l[$t]||null;if(!f)throw Error(i(90));sr(l,f.value,f.defaultValue,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name)}}for(n=0;n<r.length;n++)l=r[n],l.form===e.form&&Ro(l)}break e;case"textarea":np(e,r.value,r.defaultValue);break e;case"select":n=r.value,n!=null&&ei(e,!!r.multiple,n,!1)}}}var jc=!1;function op(e,n,r){if(jc)return e(n,r);jc=!0;try{var l=e(n);return l}finally{if(jc=!1,(ni!==null||si!==null)&&(vl(),ni&&(n=ni,e=si,si=ni=null,rp(n),e)))for(n=0;n<e.length;n++)rp(e[n])}}function ar(e,n){var r=e.stateNode;if(r===null)return null;var l=r[$t]||null;if(l===null)return null;r=l[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(e=e.type,l=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!l;break e;default:e=!1}if(e)return null;if(r&&typeof r!="function")throw Error(i(231,n,typeof r));return r}var gs=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Rc=!1;if(gs)try{var ir={};Object.defineProperty(ir,"passive",{get:function(){Rc=!0}}),window.addEventListener("test",ir,ir),window.removeEventListener("test",ir,ir)}catch{Rc=!1}var qs=null,Mc=null,Oo=null;function lp(){if(Oo)return Oo;var e,n=Mc,r=n.length,l,f="value"in qs?qs.value:qs.textContent,h=f.length;for(e=0;e<r&&n[e]===f[e];e++);var v=r-e;for(l=1;l<=v&&n[r-l]===f[h-l];l++);return Oo=f.slice(e,1<l?1-l:void 0)}function Bo(e){var n=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&n===13&&(e=13)):e=n,e===10&&(e=13),32<=e||e===13?e:0}function Do(){return!0}function cp(){return!1}function sn(e){function n(r,l,f,h,v){this._reactName=r,this._targetInst=f,this.type=l,this.nativeEvent=h,this.target=v,this.currentTarget=null;for(var w in e)e.hasOwnProperty(w)&&(r=e[w],this[w]=r?r(h):h[w]);return this.isDefaultPrevented=(h.defaultPrevented!=null?h.defaultPrevented:h.returnValue===!1)?Do:cp,this.isPropagationStopped=cp,this}return b(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=Do)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=Do)},persist:function(){},isPersistent:Do}),n}var _a={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Lo=sn(_a),rr=b({},_a,{view:0,detail:0}),kv=sn(rr),Oc,Bc,or,zo=b({},rr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Lc,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==or&&(or&&e.type==="mousemove"?(Oc=e.screenX-or.screenX,Bc=e.screenY-or.screenY):Bc=Oc=0,or=e),Oc)},movementY:function(e){return"movementY"in e?e.movementY:Bc}}),up=sn(zo),wv=b({},zo,{dataTransfer:0}),Cv=sn(wv),_v=b({},rr,{relatedTarget:0}),Dc=sn(_v),Tv=b({},_a,{animationName:0,elapsedTime:0,pseudoElement:0}),Nv=sn(Tv),Ev=b({},_a,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Av=sn(Ev),jv=b({},_a,{data:0}),dp=sn(jv),Rv={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Mv={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"},Ov={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Bv(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=Ov[e])?!!n[e]:!1}function Lc(){return Bv}var Dv=b({},rr,{key:function(e){if(e.key){var n=Rv[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=Bo(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Mv[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Lc,charCode:function(e){return e.type==="keypress"?Bo(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Bo(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Lv=sn(Dv),zv=b({},zo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),fp=sn(zv),Uv=b({},rr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Lc}),Iv=sn(Uv),$v=b({},_a,{propertyName:0,elapsedTime:0,pseudoElement:0}),Hv=sn($v),Pv=b({},zo,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Fv=sn(Pv),Gv=b({},_a,{newState:0,oldState:0}),qv=sn(Gv),Wv=[9,13,27,32],zc=gs&&"CompositionEvent"in window,lr=null;gs&&"documentMode"in document&&(lr=document.documentMode);var Vv=gs&&"TextEvent"in window&&!lr,pp=gs&&(!zc||lr&&8<lr&&11>=lr),mp=" ",hp=!1;function gp(e,n){switch(e){case"keyup":return Wv.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function yp(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ai=!1;function Kv(e,n){switch(e){case"compositionend":return yp(n);case"keypress":return n.which!==32?null:(hp=!0,mp);case"textInput":return e=n.data,e===mp&&hp?null:e;default:return null}}function Yv(e,n){if(ai)return e==="compositionend"||!zc&&gp(e,n)?(e=lp(),Oo=Mc=qs=null,ai=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return pp&&n.locale!=="ko"?null:n.data;default:return null}}var Zv={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 bp(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!Zv[e.type]:n==="textarea"}function vp(e,n,r,l){ni?si?si.push(l):si=[l]:ni=l,n=Tl(n,"onChange"),0<n.length&&(r=new Lo("onChange","change",null,r,l),e.push({event:r,listeners:n}))}var cr=null,ur=null;function Qv(e){tg(e,0)}function Uo(e){var n=Ca(e);if(Ro(n))return e}function xp(e,n){if(e==="change")return n}var Sp=!1;if(gs){var Uc;if(gs){var Ic="oninput"in document;if(!Ic){var kp=document.createElement("div");kp.setAttribute("oninput","return;"),Ic=typeof kp.oninput=="function"}Uc=Ic}else Uc=!1;Sp=Uc&&(!document.documentMode||9<document.documentMode)}function wp(){cr&&(cr.detachEvent("onpropertychange",Cp),ur=cr=null)}function Cp(e){if(e.propertyName==="value"&&Uo(ur)){var n=[];vp(n,ur,e,Ac(e)),op(Qv,n)}}function Xv(e,n,r){e==="focusin"?(wp(),cr=n,ur=r,cr.attachEvent("onpropertychange",Cp)):e==="focusout"&&wp()}function Jv(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Uo(ur)}function ex(e,n){if(e==="click")return Uo(n)}function tx(e,n){if(e==="input"||e==="change")return Uo(n)}function nx(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var hn=typeof Object.is=="function"?Object.is:nx;function dr(e,n){if(hn(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;var r=Object.keys(e),l=Object.keys(n);if(r.length!==l.length)return!1;for(l=0;l<r.length;l++){var f=r[l];if(!ie.call(n,f)||!hn(e[f],n[f]))return!1}return!0}function _p(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Tp(e,n){var r=_p(e);e=0;for(var l;r;){if(r.nodeType===3){if(l=e+r.textContent.length,e<=n&&l>=n)return{node:r,offset:n-e};e=l}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=_p(r)}}function Np(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?Np(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function Ep(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=_n(e.document);n instanceof e.HTMLIFrameElement;){try{var r=typeof n.contentWindow.location.href=="string"}catch{r=!1}if(r)e=n.contentWindow;else break;n=_n(e.document)}return n}function $c(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}var sx=gs&&"documentMode"in document&&11>=document.documentMode,ii=null,Hc=null,fr=null,Pc=!1;function Ap(e,n,r){var l=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;Pc||ii==null||ii!==_n(l)||(l=ii,"selectionStart"in l&&$c(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),fr&&dr(fr,l)||(fr=l,l=Tl(Hc,"onSelect"),0<l.length&&(n=new Lo("onSelect","select",null,n,r),e.push({event:n,listeners:l}),n.target=ii)))}function Ta(e,n){var r={};return r[e.toLowerCase()]=n.toLowerCase(),r["Webkit"+e]="webkit"+n,r["Moz"+e]="moz"+n,r}var ri={animationend:Ta("Animation","AnimationEnd"),animationiteration:Ta("Animation","AnimationIteration"),animationstart:Ta("Animation","AnimationStart"),transitionrun:Ta("Transition","TransitionRun"),transitionstart:Ta("Transition","TransitionStart"),transitioncancel:Ta("Transition","TransitionCancel"),transitionend:Ta("Transition","TransitionEnd")},Fc={},jp={};gs&&(jp=document.createElement("div").style,"AnimationEvent"in window||(delete ri.animationend.animation,delete ri.animationiteration.animation,delete ri.animationstart.animation),"TransitionEvent"in window||delete ri.transitionend.transition);function Na(e){if(Fc[e])return Fc[e];if(!ri[e])return e;var n=ri[e],r;for(r in n)if(n.hasOwnProperty(r)&&r in jp)return Fc[e]=n[r];return e}var Rp=Na("animationend"),Mp=Na("animationiteration"),Op=Na("animationstart"),ax=Na("transitionrun"),ix=Na("transitionstart"),rx=Na("transitioncancel"),Bp=Na("transitionend"),Dp=new Map,Gc="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(" ");Gc.push("scrollEnd");function $n(e,n){Dp.set(e,n),X(n,[e])}var Io=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Tn=[],oi=0,qc=0;function $o(){for(var e=oi,n=qc=oi=0;n<e;){var r=Tn[n];Tn[n++]=null;var l=Tn[n];Tn[n++]=null;var f=Tn[n];Tn[n++]=null;var h=Tn[n];if(Tn[n++]=null,l!==null&&f!==null){var v=l.pending;v===null?f.next=f:(f.next=v.next,v.next=f),l.pending=f}h!==0&&Lp(r,f,h)}}function Ho(e,n,r,l){Tn[oi++]=e,Tn[oi++]=n,Tn[oi++]=r,Tn[oi++]=l,qc|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function Wc(e,n,r,l){return Ho(e,n,r,l),Po(e)}function Ea(e,n){return Ho(e,null,null,n),Po(e)}function Lp(e,n,r){e.lanes|=r;var l=e.alternate;l!==null&&(l.lanes|=r);for(var f=!1,h=e.return;h!==null;)h.childLanes|=r,l=h.alternate,l!==null&&(l.childLanes|=r),h.tag===22&&(e=h.stateNode,e===null||e._visibility&1||(f=!0)),e=h,h=h.return;return e.tag===3?(h=e.stateNode,f&&n!==null&&(f=31-It(r),e=h.hiddenUpdates,l=e[f],l===null?e[f]=[n]:l.push(n),n.lane=r|536870912),h):null}function Po(e){if(50<Br)throw Br=0,td=null,Error(i(185));for(var n=e.return;n!==null;)e=n,n=e.return;return e.tag===3?e.stateNode:null}var li={};function ox(e,n,r,l){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function gn(e,n,r,l){return new ox(e,n,r,l)}function Vc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ys(e,n){var r=e.alternate;return r===null?(r=gn(e.tag,n,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=n,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&65011712,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,n=e.dependencies,r.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r.refCleanup=e.refCleanup,r}function zp(e,n){e.flags&=65011714;var r=e.alternate;return r===null?(e.childLanes=0,e.lanes=n,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=r.childLanes,e.lanes=r.lanes,e.child=r.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=r.memoizedProps,e.memoizedState=r.memoizedState,e.updateQueue=r.updateQueue,e.type=r.type,n=r.dependencies,e.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),e}function Fo(e,n,r,l,f,h){var v=0;if(l=e,typeof e=="function")Vc(e)&&(v=1);else if(typeof e=="string")v=fS(e,r,st.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case se:return e=gn(31,r,n,f),e.elementType=se,e.lanes=h,e;case C:return Aa(r.children,f,h,n);case T:v=8,f|=24;break;case E:return e=gn(12,r,n,f|2),e.elementType=E,e.lanes=h,e;case j:return e=gn(13,r,n,f),e.elementType=j,e.lanes=h,e;case J:return e=gn(19,r,n,f),e.elementType=J,e.lanes=h,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case B:v=10;break e;case A:v=9;break e;case M:v=11;break e;case Y:v=14;break e;case te:v=16,l=null;break e}v=29,r=Error(i(130,e===null?"null":typeof e,"")),l=null}return n=gn(v,r,n,f),n.elementType=e,n.type=l,n.lanes=h,n}function Aa(e,n,r,l){return e=gn(7,e,l,n),e.lanes=r,e}function Kc(e,n,r){return e=gn(6,e,null,n),e.lanes=r,e}function Up(e){var n=gn(18,null,null,0);return n.stateNode=e,n}function Yc(e,n,r){return n=gn(4,e.children!==null?e.children:[],e.key,n),n.lanes=r,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}var Ip=new WeakMap;function Nn(e,n){if(typeof e=="object"&&e!==null){var r=Ip.get(e);return r!==void 0?r:(n={value:e,source:n,stack:be(n)},Ip.set(e,n),n)}return{value:e,source:n,stack:be(n)}}var ci=[],ui=0,Go=null,pr=0,En=[],An=0,Ws=null,Yn=1,Zn="";function bs(e,n){ci[ui++]=pr,ci[ui++]=Go,Go=e,pr=n}function $p(e,n,r){En[An++]=Yn,En[An++]=Zn,En[An++]=Ws,Ws=e;var l=Yn;e=Zn;var f=32-It(l)-1;l&=~(1<<f),r+=1;var h=32-It(n)+f;if(30<h){var v=f-f%5;h=(l&(1<<v)-1).toString(32),l>>=v,f-=v,Yn=1<<32-It(n)+f|r<<f|l,Zn=h+e}else Yn=1<<h|r<<f|l,Zn=e}function Zc(e){e.return!==null&&(bs(e,1),$p(e,1,0))}function Qc(e){for(;e===Go;)Go=ci[--ui],ci[ui]=null,pr=ci[--ui],ci[ui]=null;for(;e===Ws;)Ws=En[--An],En[An]=null,Zn=En[--An],En[An]=null,Yn=En[--An],En[An]=null}function Hp(e,n){En[An++]=Yn,En[An++]=Zn,En[An++]=Ws,Yn=n.id,Zn=n.overflow,Ws=e}var Ht=null,ht=null,Pe=!1,Vs=null,jn=!1,Xc=Error(i(519));function Ks(e){var n=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw mr(Nn(n,e)),Xc}function Pp(e){var n=e.stateNode,r=e.type,l=e.memoizedProps;switch(n[Tt]=e,n[$t]=l,r){case"dialog":Ie("cancel",n),Ie("close",n);break;case"iframe":case"object":case"embed":Ie("load",n);break;case"video":case"audio":for(r=0;r<Lr.length;r++)Ie(Lr[r],n);break;case"source":Ie("error",n);break;case"img":case"image":case"link":Ie("error",n),Ie("load",n);break;case"details":Ie("toggle",n);break;case"input":Ie("invalid",n),tp(n,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Ie("invalid",n);break;case"textarea":Ie("invalid",n),sp(n,l.value,l.defaultValue,l.children)}r=l.children,typeof r!="string"&&typeof r!="number"&&typeof r!="bigint"||n.textContent===""+r||l.suppressHydrationWarning===!0||ig(n.textContent,r)?(l.popover!=null&&(Ie("beforetoggle",n),Ie("toggle",n)),l.onScroll!=null&&Ie("scroll",n),l.onScrollEnd!=null&&Ie("scrollend",n),l.onClick!=null&&(n.onclick=hs),n=!0):n=!1,n||Ks(e,!0)}function Fp(e){for(Ht=e.return;Ht;)switch(Ht.tag){case 5:case 31:case 13:jn=!1;return;case 27:case 3:jn=!0;return;default:Ht=Ht.return}}function di(e){if(e!==Ht)return!1;if(!Pe)return Fp(e),Pe=!0,!1;var n=e.tag,r;if((r=n!==3&&n!==27)&&((r=n===5)&&(r=e.type,r=!(r!=="form"&&r!=="button")||gd(e.type,e.memoizedProps)),r=!r),r&&ht&&Ks(e),Fp(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(317));ht=mg(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(317));ht=mg(e)}else n===27?(n=ht,la(e.type)?(e=Sd,Sd=null,ht=e):ht=n):ht=Ht?Mn(e.stateNode.nextSibling):null;return!0}function ja(){ht=Ht=null,Pe=!1}function Jc(){var e=Vs;return e!==null&&(ln===null?ln=e:ln.push.apply(ln,e),Vs=null),e}function mr(e){Vs===null?Vs=[e]:Vs.push(e)}var eu=ze(null),Ra=null,vs=null;function Ys(e,n,r){ke(eu,n._currentValue),n._currentValue=r}function xs(e){e._currentValue=eu.current,Ee(eu)}function tu(e,n,r){for(;e!==null;){var l=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,l!==null&&(l.childLanes|=n)):l!==null&&(l.childLanes&n)!==n&&(l.childLanes|=n),e===r)break;e=e.return}}function nu(e,n,r,l){var f=e.child;for(f!==null&&(f.return=e);f!==null;){var h=f.dependencies;if(h!==null){var v=f.child;h=h.firstContext;e:for(;h!==null;){var w=h;h=f;for(var N=0;N<n.length;N++)if(w.context===n[N]){h.lanes|=r,w=h.alternate,w!==null&&(w.lanes|=r),tu(h.return,r,e),l||(v=null);break e}h=w.next}}else if(f.tag===18){if(v=f.return,v===null)throw Error(i(341));v.lanes|=r,h=v.alternate,h!==null&&(h.lanes|=r),tu(v,r,e),v=null}else v=f.child;if(v!==null)v.return=f;else for(v=f;v!==null;){if(v===e){v=null;break}if(f=v.sibling,f!==null){f.return=v.return,v=f;break}v=v.return}f=v}}function fi(e,n,r,l){e=null;for(var f=n,h=!1;f!==null;){if(!h){if((f.flags&524288)!==0)h=!0;else if((f.flags&262144)!==0)break}if(f.tag===10){var v=f.alternate;if(v===null)throw Error(i(387));if(v=v.memoizedProps,v!==null){var w=f.type;hn(f.pendingProps.value,v.value)||(e!==null?e.push(w):e=[w])}}else if(f===dn.current){if(v=f.alternate,v===null)throw Error(i(387));v.memoizedState.memoizedState!==f.memoizedState.memoizedState&&(e!==null?e.push(Hr):e=[Hr])}f=f.return}e!==null&&nu(n,e,r,l),n.flags|=262144}function qo(e){for(e=e.firstContext;e!==null;){if(!hn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ma(e){Ra=e,vs=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Pt(e){return Gp(Ra,e)}function Wo(e,n){return Ra===null&&Ma(e),Gp(e,n)}function Gp(e,n){var r=n._currentValue;if(n={context:n,memoizedValue:r,next:null},vs===null){if(e===null)throw Error(i(308));vs=n,e.dependencies={lanes:0,firstContext:n},e.flags|=524288}else vs=vs.next=n;return r}var lx=typeof AbortController<"u"?AbortController:function(){var e=[],n=this.signal={aborted:!1,addEventListener:function(r,l){e.push(l)}};this.abort=function(){n.aborted=!0,e.forEach(function(r){return r()})}},cx=a.unstable_scheduleCallback,ux=a.unstable_NormalPriority,Et={$$typeof:B,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function su(){return{controller:new lx,data:new Map,refCount:0}}function hr(e){e.refCount--,e.refCount===0&&cx(ux,function(){e.controller.abort()})}var gr=null,au=0,pi=0,mi=null;function dx(e,n){if(gr===null){var r=gr=[];au=0,pi=od(),mi={status:"pending",value:void 0,then:function(l){r.push(l)}}}return au++,n.then(qp,qp),n}function qp(){if(--au===0&&gr!==null){mi!==null&&(mi.status="fulfilled");var e=gr;gr=null,pi=0,mi=null;for(var n=0;n<e.length;n++)(0,e[n])()}}function fx(e,n){var r=[],l={status:"pending",value:null,reason:null,then:function(f){r.push(f)}};return e.then(function(){l.status="fulfilled",l.value=n;for(var f=0;f<r.length;f++)(0,r[f])(n)},function(f){for(l.status="rejected",l.reason=f,f=0;f<r.length;f++)(0,r[f])(void 0)}),l}var Wp=L.S;L.S=function(e,n){Ah=tt(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&dx(e,n),Wp!==null&&Wp(e,n)};var Oa=ze(null);function iu(){var e=Oa.current;return e!==null?e:mt.pooledCache}function Vo(e,n){n===null?ke(Oa,Oa.current):ke(Oa,n.pool)}function Vp(){var e=iu();return e===null?null:{parent:Et._currentValue,pool:e}}var hi=Error(i(460)),ru=Error(i(474)),Ko=Error(i(542)),Yo={then:function(){}};function Kp(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Yp(e,n,r){switch(r=e[r],r===void 0?e.push(n):r!==n&&(n.then(hs,hs),n=r),n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,Qp(e),e;default:if(typeof n.status=="string")n.then(hs,hs);else{if(e=mt,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=n,e.status="pending",e.then(function(l){if(n.status==="pending"){var f=n;f.status="fulfilled",f.value=l}},function(l){if(n.status==="pending"){var f=n;f.status="rejected",f.reason=l}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,Qp(e),e}throw Da=n,hi}}function Ba(e){try{var n=e._init;return n(e._payload)}catch(r){throw r!==null&&typeof r=="object"&&typeof r.then=="function"?(Da=r,hi):r}}var Da=null;function Zp(){if(Da===null)throw Error(i(459));var e=Da;return Da=null,e}function Qp(e){if(e===hi||e===Ko)throw Error(i(483))}var gi=null,yr=0;function Zo(e){var n=yr;return yr+=1,gi===null&&(gi=[]),Yp(gi,e,n)}function br(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function Qo(e,n){throw n.$$typeof===x?Error(i(525)):(e=Object.prototype.toString.call(n),Error(i(31,e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)))}function Xp(e){function n(D,R){if(e){var z=D.deletions;z===null?(D.deletions=[R],D.flags|=16):z.push(R)}}function r(D,R){if(!e)return null;for(;R!==null;)n(D,R),R=R.sibling;return null}function l(D){for(var R=new Map;D!==null;)D.key!==null?R.set(D.key,D):R.set(D.index,D),D=D.sibling;return R}function f(D,R){return D=ys(D,R),D.index=0,D.sibling=null,D}function h(D,R,z){return D.index=z,e?(z=D.alternate,z!==null?(z=z.index,z<R?(D.flags|=67108866,R):z):(D.flags|=67108866,R)):(D.flags|=1048576,R)}function v(D){return e&&D.alternate===null&&(D.flags|=67108866),D}function w(D,R,z,q){return R===null||R.tag!==6?(R=Kc(z,D.mode,q),R.return=D,R):(R=f(R,z),R.return=D,R)}function N(D,R,z,q){var me=z.type;return me===C?G(D,R,z.props.children,q,z.key):R!==null&&(R.elementType===me||typeof me=="object"&&me!==null&&me.$$typeof===te&&Ba(me)===R.type)?(R=f(R,z.props),br(R,z),R.return=D,R):(R=Fo(z.type,z.key,z.props,null,D.mode,q),br(R,z),R.return=D,R)}function U(D,R,z,q){return R===null||R.tag!==4||R.stateNode.containerInfo!==z.containerInfo||R.stateNode.implementation!==z.implementation?(R=Yc(z,D.mode,q),R.return=D,R):(R=f(R,z.children||[]),R.return=D,R)}function G(D,R,z,q,me){return R===null||R.tag!==7?(R=Aa(z,D.mode,q,me),R.return=D,R):(R=f(R,z),R.return=D,R)}function V(D,R,z){if(typeof R=="string"&&R!==""||typeof R=="number"||typeof R=="bigint")return R=Kc(""+R,D.mode,z),R.return=D,R;if(typeof R=="object"&&R!==null){switch(R.$$typeof){case S:return z=Fo(R.type,R.key,R.props,null,D.mode,z),br(z,R),z.return=D,z;case k:return R=Yc(R,D.mode,z),R.return=D,R;case te:return R=Ba(R),V(D,R,z)}if(he(R)||de(R))return R=Aa(R,D.mode,z,null),R.return=D,R;if(typeof R.then=="function")return V(D,Zo(R),z);if(R.$$typeof===B)return V(D,Wo(D,R),z);Qo(D,R)}return null}function I(D,R,z,q){var me=R!==null?R.key:null;if(typeof z=="string"&&z!==""||typeof z=="number"||typeof z=="bigint")return me!==null?null:w(D,R,""+z,q);if(typeof z=="object"&&z!==null){switch(z.$$typeof){case S:return z.key===me?N(D,R,z,q):null;case k:return z.key===me?U(D,R,z,q):null;case te:return z=Ba(z),I(D,R,z,q)}if(he(z)||de(z))return me!==null?null:G(D,R,z,q,null);if(typeof z.then=="function")return I(D,R,Zo(z),q);if(z.$$typeof===B)return I(D,R,Wo(D,z),q);Qo(D,z)}return null}function H(D,R,z,q,me){if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return D=D.get(z)||null,w(R,D,""+q,me);if(typeof q=="object"&&q!==null){switch(q.$$typeof){case S:return D=D.get(q.key===null?z:q.key)||null,N(R,D,q,me);case k:return D=D.get(q.key===null?z:q.key)||null,U(R,D,q,me);case te:return q=Ba(q),H(D,R,z,q,me)}if(he(q)||de(q))return D=D.get(z)||null,G(R,D,q,me,null);if(typeof q.then=="function")return H(D,R,z,Zo(q),me);if(q.$$typeof===B)return H(D,R,z,Wo(R,q),me);Qo(R,q)}return null}function re(D,R,z,q){for(var me=null,Ye=null,le=R,Me=R=0,He=null;le!==null&&Me<z.length;Me++){le.index>Me?(He=le,le=null):He=le.sibling;var Ze=I(D,le,z[Me],q);if(Ze===null){le===null&&(le=He);break}e&&le&&Ze.alternate===null&&n(D,le),R=h(Ze,R,Me),Ye===null?me=Ze:Ye.sibling=Ze,Ye=Ze,le=He}if(Me===z.length)return r(D,le),Pe&&bs(D,Me),me;if(le===null){for(;Me<z.length;Me++)le=V(D,z[Me],q),le!==null&&(R=h(le,R,Me),Ye===null?me=le:Ye.sibling=le,Ye=le);return Pe&&bs(D,Me),me}for(le=l(le);Me<z.length;Me++)He=H(le,D,Me,z[Me],q),He!==null&&(e&&He.alternate!==null&&le.delete(He.key===null?Me:He.key),R=h(He,R,Me),Ye===null?me=He:Ye.sibling=He,Ye=He);return e&&le.forEach(function(pa){return n(D,pa)}),Pe&&bs(D,Me),me}function ye(D,R,z,q){if(z==null)throw Error(i(151));for(var me=null,Ye=null,le=R,Me=R=0,He=null,Ze=z.next();le!==null&&!Ze.done;Me++,Ze=z.next()){le.index>Me?(He=le,le=null):He=le.sibling;var pa=I(D,le,Ze.value,q);if(pa===null){le===null&&(le=He);break}e&&le&&pa.alternate===null&&n(D,le),R=h(pa,R,Me),Ye===null?me=pa:Ye.sibling=pa,Ye=pa,le=He}if(Ze.done)return r(D,le),Pe&&bs(D,Me),me;if(le===null){for(;!Ze.done;Me++,Ze=z.next())Ze=V(D,Ze.value,q),Ze!==null&&(R=h(Ze,R,Me),Ye===null?me=Ze:Ye.sibling=Ze,Ye=Ze);return Pe&&bs(D,Me),me}for(le=l(le);!Ze.done;Me++,Ze=z.next())Ze=H(le,D,Me,Ze.value,q),Ze!==null&&(e&&Ze.alternate!==null&&le.delete(Ze.key===null?Me:Ze.key),R=h(Ze,R,Me),Ye===null?me=Ze:Ye.sibling=Ze,Ye=Ze);return e&&le.forEach(function(wS){return n(D,wS)}),Pe&&bs(D,Me),me}function pt(D,R,z,q){if(typeof z=="object"&&z!==null&&z.type===C&&z.key===null&&(z=z.props.children),typeof z=="object"&&z!==null){switch(z.$$typeof){case S:e:{for(var me=z.key;R!==null;){if(R.key===me){if(me=z.type,me===C){if(R.tag===7){r(D,R.sibling),q=f(R,z.props.children),q.return=D,D=q;break e}}else if(R.elementType===me||typeof me=="object"&&me!==null&&me.$$typeof===te&&Ba(me)===R.type){r(D,R.sibling),q=f(R,z.props),br(q,z),q.return=D,D=q;break e}r(D,R);break}else n(D,R);R=R.sibling}z.type===C?(q=Aa(z.props.children,D.mode,q,z.key),q.return=D,D=q):(q=Fo(z.type,z.key,z.props,null,D.mode,q),br(q,z),q.return=D,D=q)}return v(D);case k:e:{for(me=z.key;R!==null;){if(R.key===me)if(R.tag===4&&R.stateNode.containerInfo===z.containerInfo&&R.stateNode.implementation===z.implementation){r(D,R.sibling),q=f(R,z.children||[]),q.return=D,D=q;break e}else{r(D,R);break}else n(D,R);R=R.sibling}q=Yc(z,D.mode,q),q.return=D,D=q}return v(D);case te:return z=Ba(z),pt(D,R,z,q)}if(he(z))return re(D,R,z,q);if(de(z)){if(me=de(z),typeof me!="function")throw Error(i(150));return z=me.call(z),ye(D,R,z,q)}if(typeof z.then=="function")return pt(D,R,Zo(z),q);if(z.$$typeof===B)return pt(D,R,Wo(D,z),q);Qo(D,z)}return typeof z=="string"&&z!==""||typeof z=="number"||typeof z=="bigint"?(z=""+z,R!==null&&R.tag===6?(r(D,R.sibling),q=f(R,z),q.return=D,D=q):(r(D,R),q=Kc(z,D.mode,q),q.return=D,D=q),v(D)):r(D,R)}return function(D,R,z,q){try{yr=0;var me=pt(D,R,z,q);return gi=null,me}catch(le){if(le===hi||le===Ko)throw le;var Ye=gn(29,le,null,D.mode);return Ye.lanes=q,Ye.return=D,Ye}finally{}}}var La=Xp(!0),Jp=Xp(!1),Zs=!1;function ou(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function lu(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Qs(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Xs(e,n,r){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(et&2)!==0){var f=l.pending;return f===null?n.next=n:(n.next=f.next,f.next=n),l.pending=n,n=Po(e),Lp(e,null,r),n}return Ho(e,l,n,r),Po(e)}function vr(e,n,r){if(n=n.updateQueue,n!==null&&(n=n.shared,(r&4194048)!==0)){var l=n.lanes;l&=e.pendingLanes,r|=l,n.lanes=r,Ao(e,r)}}function cu(e,n){var r=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,r===l)){var f=null,h=null;if(r=r.firstBaseUpdate,r!==null){do{var v={lane:r.lane,tag:r.tag,payload:r.payload,callback:null,next:null};h===null?f=h=v:h=h.next=v,r=r.next}while(r!==null);h===null?f=h=n:h=h.next=n}else f=h=n;r={baseState:l.baseState,firstBaseUpdate:f,lastBaseUpdate:h,shared:l.shared,callbacks:l.callbacks},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=n:e.next=n,r.lastBaseUpdate=n}var uu=!1;function xr(){if(uu){var e=mi;if(e!==null)throw e}}function Sr(e,n,r,l){uu=!1;var f=e.updateQueue;Zs=!1;var h=f.firstBaseUpdate,v=f.lastBaseUpdate,w=f.shared.pending;if(w!==null){f.shared.pending=null;var N=w,U=N.next;N.next=null,v===null?h=U:v.next=U,v=N;var G=e.alternate;G!==null&&(G=G.updateQueue,w=G.lastBaseUpdate,w!==v&&(w===null?G.firstBaseUpdate=U:w.next=U,G.lastBaseUpdate=N))}if(h!==null){var V=f.baseState;v=0,G=U=N=null,w=h;do{var I=w.lane&-536870913,H=I!==w.lane;if(H?($e&I)===I:(l&I)===I){I!==0&&I===pi&&(uu=!0),G!==null&&(G=G.next={lane:0,tag:w.tag,payload:w.payload,callback:null,next:null});e:{var re=e,ye=w;I=n;var pt=r;switch(ye.tag){case 1:if(re=ye.payload,typeof re=="function"){V=re.call(pt,V,I);break e}V=re;break e;case 3:re.flags=re.flags&-65537|128;case 0:if(re=ye.payload,I=typeof re=="function"?re.call(pt,V,I):re,I==null)break e;V=b({},V,I);break e;case 2:Zs=!0}}I=w.callback,I!==null&&(e.flags|=64,H&&(e.flags|=8192),H=f.callbacks,H===null?f.callbacks=[I]:H.push(I))}else H={lane:I,tag:w.tag,payload:w.payload,callback:w.callback,next:null},G===null?(U=G=H,N=V):G=G.next=H,v|=I;if(w=w.next,w===null){if(w=f.shared.pending,w===null)break;H=w,w=H.next,H.next=null,f.lastBaseUpdate=H,f.shared.pending=null}}while(!0);G===null&&(N=V),f.baseState=N,f.firstBaseUpdate=U,f.lastBaseUpdate=G,h===null&&(f.shared.lanes=0),sa|=v,e.lanes=v,e.memoizedState=V}}function em(e,n){if(typeof e!="function")throw Error(i(191,e));e.call(n)}function tm(e,n){var r=e.callbacks;if(r!==null)for(e.callbacks=null,e=0;e<r.length;e++)em(r[e],n)}var yi=ze(null),Xo=ze(0);function nm(e,n){e=As,ke(Xo,e),ke(yi,n),As=e|n.baseLanes}function du(){ke(Xo,As),ke(yi,yi.current)}function fu(){As=Xo.current,Ee(yi),Ee(Xo)}var yn=ze(null),Rn=null;function Js(e){var n=e.alternate;ke(wt,wt.current&1),ke(yn,e),Rn===null&&(n===null||yi.current!==null||n.memoizedState!==null)&&(Rn=e)}function pu(e){ke(wt,wt.current),ke(yn,e),Rn===null&&(Rn=e)}function sm(e){e.tag===22?(ke(wt,wt.current),ke(yn,e),Rn===null&&(Rn=e)):ea()}function ea(){ke(wt,wt.current),ke(yn,yn.current)}function bn(e){Ee(yn),Rn===e&&(Rn=null),Ee(wt)}var wt=ze(0);function Jo(e){for(var n=e;n!==null;){if(n.tag===13){var r=n.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||vd(r)||xd(r)))return n}else if(n.tag===19&&(n.memoizedProps.revealOrder==="forwards"||n.memoizedProps.revealOrder==="backwards"||n.memoizedProps.revealOrder==="unstable_legacy-backwards"||n.memoizedProps.revealOrder==="together")){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var Ss=0,Re=null,dt=null,At=null,el=!1,bi=!1,za=!1,tl=0,kr=0,vi=null,px=0;function St(){throw Error(i(321))}function mu(e,n){if(n===null)return!1;for(var r=0;r<n.length&&r<e.length;r++)if(!hn(e[r],n[r]))return!1;return!0}function hu(e,n,r,l,f,h){return Ss=h,Re=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,L.H=e===null||e.memoizedState===null?$m:ju,za=!1,h=r(l,f),za=!1,bi&&(h=im(n,r,l,f)),am(e),h}function am(e){L.H=_r;var n=dt!==null&&dt.next!==null;if(Ss=0,At=dt=Re=null,el=!1,kr=0,vi=null,n)throw Error(i(300));e===null||jt||(e=e.dependencies,e!==null&&qo(e)&&(jt=!0))}function im(e,n,r,l){Re=e;var f=0;do{if(bi&&(vi=null),kr=0,bi=!1,25<=f)throw Error(i(301));if(f+=1,At=dt=null,e.updateQueue!=null){var h=e.updateQueue;h.lastEffect=null,h.events=null,h.stores=null,h.memoCache!=null&&(h.memoCache.index=0)}L.H=Hm,h=n(r,l)}while(bi);return h}function mx(){var e=L.H,n=e.useState()[0];return n=typeof n.then=="function"?wr(n):n,e=e.useState()[0],(dt!==null?dt.memoizedState:null)!==e&&(Re.flags|=1024),n}function gu(){var e=tl!==0;return tl=0,e}function yu(e,n,r){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~r}function bu(e){if(el){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}el=!1}Ss=0,At=dt=Re=null,bi=!1,kr=tl=0,vi=null}function Jt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return At===null?Re.memoizedState=At=e:At=At.next=e,At}function Ct(){if(dt===null){var e=Re.alternate;e=e!==null?e.memoizedState:null}else e=dt.next;var n=At===null?Re.memoizedState:At.next;if(n!==null)At=n,dt=e;else{if(e===null)throw Re.alternate===null?Error(i(467)):Error(i(310));dt=e,e={memoizedState:dt.memoizedState,baseState:dt.baseState,baseQueue:dt.baseQueue,queue:dt.queue,next:null},At===null?Re.memoizedState=At=e:At=At.next=e}return At}function nl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function wr(e){var n=kr;return kr+=1,vi===null&&(vi=[]),e=Yp(vi,e,n),n=Re,(At===null?n.memoizedState:At.next)===null&&(n=n.alternate,L.H=n===null||n.memoizedState===null?$m:ju),e}function sl(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return wr(e);if(e.$$typeof===B)return Pt(e)}throw Error(i(438,String(e)))}function vu(e){var n=null,r=Re.updateQueue;if(r!==null&&(n=r.memoCache),n==null){var l=Re.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(n={data:l.data.map(function(f){return f.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),r===null&&(r=nl(),Re.updateQueue=r),r.memoCache=n,r=n.data[n.index],r===void 0)for(r=n.data[n.index]=Array(e),l=0;l<e;l++)r[l]=ge;return n.index++,r}function ks(e,n){return typeof n=="function"?n(e):n}function al(e){var n=Ct();return xu(n,dt,e)}function xu(e,n,r){var l=e.queue;if(l===null)throw Error(i(311));l.lastRenderedReducer=r;var f=e.baseQueue,h=l.pending;if(h!==null){if(f!==null){var v=f.next;f.next=h.next,h.next=v}n.baseQueue=f=h,l.pending=null}if(h=e.baseState,f===null)e.memoizedState=h;else{n=f.next;var w=v=null,N=null,U=n,G=!1;do{var V=U.lane&-536870913;if(V!==U.lane?($e&V)===V:(Ss&V)===V){var I=U.revertLane;if(I===0)N!==null&&(N=N.next={lane:0,revertLane:0,gesture:null,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null}),V===pi&&(G=!0);else if((Ss&I)===I){U=U.next,I===pi&&(G=!0);continue}else V={lane:0,revertLane:U.revertLane,gesture:null,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null},N===null?(w=N=V,v=h):N=N.next=V,Re.lanes|=I,sa|=I;V=U.action,za&&r(h,V),h=U.hasEagerState?U.eagerState:r(h,V)}else I={lane:V,revertLane:U.revertLane,gesture:U.gesture,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null},N===null?(w=N=I,v=h):N=N.next=I,Re.lanes|=V,sa|=V;U=U.next}while(U!==null&&U!==n);if(N===null?v=h:N.next=w,!hn(h,e.memoizedState)&&(jt=!0,G&&(r=mi,r!==null)))throw r;e.memoizedState=h,e.baseState=v,e.baseQueue=N,l.lastRenderedState=h}return f===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function Su(e){var n=Ct(),r=n.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=e;var l=r.dispatch,f=r.pending,h=n.memoizedState;if(f!==null){r.pending=null;var v=f=f.next;do h=e(h,v.action),v=v.next;while(v!==f);hn(h,n.memoizedState)||(jt=!0),n.memoizedState=h,n.baseQueue===null&&(n.baseState=h),r.lastRenderedState=h}return[h,l]}function rm(e,n,r){var l=Re,f=Ct(),h=Pe;if(h){if(r===void 0)throw Error(i(407));r=r()}else r=n();var v=!hn((dt||f).memoizedState,r);if(v&&(f.memoizedState=r,jt=!0),f=f.queue,Cu(cm.bind(null,l,f,e),[e]),f.getSnapshot!==n||v||At!==null&&At.memoizedState.tag&1){if(l.flags|=2048,xi(9,{destroy:void 0},lm.bind(null,l,f,r,n),null),mt===null)throw Error(i(349));h||(Ss&127)!==0||om(l,n,r)}return r}function om(e,n,r){e.flags|=16384,e={getSnapshot:n,value:r},n=Re.updateQueue,n===null?(n=nl(),Re.updateQueue=n,n.stores=[e]):(r=n.stores,r===null?n.stores=[e]:r.push(e))}function lm(e,n,r,l){n.value=r,n.getSnapshot=l,um(n)&&dm(e)}function cm(e,n,r){return r(function(){um(n)&&dm(e)})}function um(e){var n=e.getSnapshot;e=e.value;try{var r=n();return!hn(e,r)}catch{return!0}}function dm(e){var n=Ea(e,2);n!==null&&cn(n,e,2)}function ku(e){var n=Jt();if(typeof e=="function"){var r=e;if(e=r(),za){mn(!0);try{r()}finally{mn(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ks,lastRenderedState:e},n}function fm(e,n,r,l){return e.baseState=r,xu(e,dt,typeof l=="function"?l:ks)}function hx(e,n,r,l,f){if(ol(e))throw Error(i(485));if(e=n.action,e!==null){var h={payload:f,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(v){h.listeners.push(v)}};L.T!==null?r(!0):h.isTransition=!1,l(h),r=n.pending,r===null?(h.next=n.pending=h,pm(n,h)):(h.next=r.next,n.pending=r.next=h)}}function pm(e,n){var r=n.action,l=n.payload,f=e.state;if(n.isTransition){var h=L.T,v={};L.T=v;try{var w=r(f,l),N=L.S;N!==null&&N(v,w),mm(e,n,w)}catch(U){wu(e,n,U)}finally{h!==null&&v.types!==null&&(h.types=v.types),L.T=h}}else try{h=r(f,l),mm(e,n,h)}catch(U){wu(e,n,U)}}function mm(e,n,r){r!==null&&typeof r=="object"&&typeof r.then=="function"?r.then(function(l){hm(e,n,l)},function(l){return wu(e,n,l)}):hm(e,n,r)}function hm(e,n,r){n.status="fulfilled",n.value=r,gm(n),e.state=r,n=e.pending,n!==null&&(r=n.next,r===n?e.pending=null:(r=r.next,n.next=r,pm(e,r)))}function wu(e,n,r){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do n.status="rejected",n.reason=r,gm(n),n=n.next;while(n!==l)}e.action=null}function gm(e){e=e.listeners;for(var n=0;n<e.length;n++)(0,e[n])()}function ym(e,n){return n}function bm(e,n){if(Pe){var r=mt.formState;if(r!==null){e:{var l=Re;if(Pe){if(ht){t:{for(var f=ht,h=jn;f.nodeType!==8;){if(!h){f=null;break t}if(f=Mn(f.nextSibling),f===null){f=null;break t}}h=f.data,f=h==="F!"||h==="F"?f:null}if(f){ht=Mn(f.nextSibling),l=f.data==="F!";break e}}Ks(l)}l=!1}l&&(n=r[0])}}return r=Jt(),r.memoizedState=r.baseState=n,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ym,lastRenderedState:n},r.queue=l,r=zm.bind(null,Re,l),l.dispatch=r,l=ku(!1),h=Au.bind(null,Re,!1,l.queue),l=Jt(),f={state:n,dispatch:null,action:e,pending:null},l.queue=f,r=hx.bind(null,Re,f,h,r),f.dispatch=r,l.memoizedState=e,[n,r,!1]}function vm(e){var n=Ct();return xm(n,dt,e)}function xm(e,n,r){if(n=xu(e,n,ym)[0],e=al(ks)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var l=wr(n)}catch(v){throw v===hi?Ko:v}else l=n;n=Ct();var f=n.queue,h=f.dispatch;return r!==n.memoizedState&&(Re.flags|=2048,xi(9,{destroy:void 0},gx.bind(null,f,r),null)),[l,h,e]}function gx(e,n){e.action=n}function Sm(e){var n=Ct(),r=dt;if(r!==null)return xm(n,r,e);Ct(),n=n.memoizedState,r=Ct();var l=r.queue.dispatch;return r.memoizedState=e,[n,l,!1]}function xi(e,n,r,l){return e={tag:e,create:r,deps:l,inst:n,next:null},n=Re.updateQueue,n===null&&(n=nl(),Re.updateQueue=n),r=n.lastEffect,r===null?n.lastEffect=e.next=e:(l=r.next,r.next=e,e.next=l,n.lastEffect=e),e}function km(){return Ct().memoizedState}function il(e,n,r,l){var f=Jt();Re.flags|=e,f.memoizedState=xi(1|n,{destroy:void 0},r,l===void 0?null:l)}function rl(e,n,r,l){var f=Ct();l=l===void 0?null:l;var h=f.memoizedState.inst;dt!==null&&l!==null&&mu(l,dt.memoizedState.deps)?f.memoizedState=xi(n,h,r,l):(Re.flags|=e,f.memoizedState=xi(1|n,h,r,l))}function wm(e,n){il(8390656,8,e,n)}function Cu(e,n){rl(2048,8,e,n)}function yx(e){Re.flags|=4;var n=Re.updateQueue;if(n===null)n=nl(),Re.updateQueue=n,n.events=[e];else{var r=n.events;r===null?n.events=[e]:r.push(e)}}function Cm(e){var n=Ct().memoizedState;return yx({ref:n,nextImpl:e}),function(){if((et&2)!==0)throw Error(i(440));return n.impl.apply(void 0,arguments)}}function _m(e,n){return rl(4,2,e,n)}function Tm(e,n){return rl(4,4,e,n)}function Nm(e,n){if(typeof n=="function"){e=e();var r=n(e);return function(){typeof r=="function"?r():n(null)}}if(n!=null)return e=e(),n.current=e,function(){n.current=null}}function Em(e,n,r){r=r!=null?r.concat([e]):null,rl(4,4,Nm.bind(null,n,e),r)}function _u(){}function Am(e,n){var r=Ct();n=n===void 0?null:n;var l=r.memoizedState;return n!==null&&mu(n,l[1])?l[0]:(r.memoizedState=[e,n],e)}function jm(e,n){var r=Ct();n=n===void 0?null:n;var l=r.memoizedState;if(n!==null&&mu(n,l[1]))return l[0];if(l=e(),za){mn(!0);try{e()}finally{mn(!1)}}return r.memoizedState=[l,n],l}function Tu(e,n,r){return r===void 0||(Ss&1073741824)!==0&&($e&261930)===0?e.memoizedState=n:(e.memoizedState=r,e=Rh(),Re.lanes|=e,sa|=e,r)}function Rm(e,n,r,l){return hn(r,n)?r:yi.current!==null?(e=Tu(e,r,l),hn(e,n)||(jt=!0),e):(Ss&42)===0||(Ss&1073741824)!==0&&($e&261930)===0?(jt=!0,e.memoizedState=r):(e=Rh(),Re.lanes|=e,sa|=e,n)}function Mm(e,n,r,l,f){var h=Z.p;Z.p=h!==0&&8>h?h:8;var v=L.T,w={};L.T=w,Au(e,!1,n,r);try{var N=f(),U=L.S;if(U!==null&&U(w,N),N!==null&&typeof N=="object"&&typeof N.then=="function"){var G=fx(N,l);Cr(e,n,G,Sn(e))}else Cr(e,n,l,Sn(e))}catch(V){Cr(e,n,{then:function(){},status:"rejected",reason:V},Sn())}finally{Z.p=h,v!==null&&w.types!==null&&(v.types=w.types),L.T=v}}function bx(){}function Nu(e,n,r,l){if(e.tag!==5)throw Error(i(476));var f=Om(e).queue;Mm(e,f,n,W,r===null?bx:function(){return Bm(e),r(l)})}function Om(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:W,baseState:W,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ks,lastRenderedState:W},next:null};var r={};return n.next={memoizedState:r,baseState:r,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ks,lastRenderedState:r},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function Bm(e){var n=Om(e);n.next===null&&(n=e.alternate.memoizedState),Cr(e,n.next.queue,{},Sn())}function Eu(){return Pt(Hr)}function Dm(){return Ct().memoizedState}function Lm(){return Ct().memoizedState}function vx(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var r=Sn();e=Qs(r);var l=Xs(n,e,r);l!==null&&(cn(l,n,r),vr(l,n,r)),n={cache:su()},e.payload=n;return}n=n.return}}function xx(e,n,r){var l=Sn();r={lane:l,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},ol(e)?Um(n,r):(r=Wc(e,n,r,l),r!==null&&(cn(r,e,l),Im(r,n,l)))}function zm(e,n,r){var l=Sn();Cr(e,n,r,l)}function Cr(e,n,r,l){var f={lane:l,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null};if(ol(e))Um(n,f);else{var h=e.alternate;if(e.lanes===0&&(h===null||h.lanes===0)&&(h=n.lastRenderedReducer,h!==null))try{var v=n.lastRenderedState,w=h(v,r);if(f.hasEagerState=!0,f.eagerState=w,hn(w,v))return Ho(e,n,f,0),mt===null&&$o(),!1}catch{}finally{}if(r=Wc(e,n,f,l),r!==null)return cn(r,e,l),Im(r,n,l),!0}return!1}function Au(e,n,r,l){if(l={lane:2,revertLane:od(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},ol(e)){if(n)throw Error(i(479))}else n=Wc(e,r,l,2),n!==null&&cn(n,e,2)}function ol(e){var n=e.alternate;return e===Re||n!==null&&n===Re}function Um(e,n){bi=el=!0;var r=e.pending;r===null?n.next=n:(n.next=r.next,r.next=n),e.pending=n}function Im(e,n,r){if((r&4194048)!==0){var l=n.lanes;l&=e.pendingLanes,r|=l,n.lanes=r,Ao(e,r)}}var _r={readContext:Pt,use:sl,useCallback:St,useContext:St,useEffect:St,useImperativeHandle:St,useLayoutEffect:St,useInsertionEffect:St,useMemo:St,useReducer:St,useRef:St,useState:St,useDebugValue:St,useDeferredValue:St,useTransition:St,useSyncExternalStore:St,useId:St,useHostTransitionStatus:St,useFormState:St,useActionState:St,useOptimistic:St,useMemoCache:St,useCacheRefresh:St};_r.useEffectEvent=St;var $m={readContext:Pt,use:sl,useCallback:function(e,n){return Jt().memoizedState=[e,n===void 0?null:n],e},useContext:Pt,useEffect:wm,useImperativeHandle:function(e,n,r){r=r!=null?r.concat([e]):null,il(4194308,4,Nm.bind(null,n,e),r)},useLayoutEffect:function(e,n){return il(4194308,4,e,n)},useInsertionEffect:function(e,n){il(4,2,e,n)},useMemo:function(e,n){var r=Jt();n=n===void 0?null:n;var l=e();if(za){mn(!0);try{e()}finally{mn(!1)}}return r.memoizedState=[l,n],l},useReducer:function(e,n,r){var l=Jt();if(r!==void 0){var f=r(n);if(za){mn(!0);try{r(n)}finally{mn(!1)}}}else f=n;return l.memoizedState=l.baseState=f,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:f},l.queue=e,e=e.dispatch=xx.bind(null,Re,e),[l.memoizedState,e]},useRef:function(e){var n=Jt();return e={current:e},n.memoizedState=e},useState:function(e){e=ku(e);var n=e.queue,r=zm.bind(null,Re,n);return n.dispatch=r,[e.memoizedState,r]},useDebugValue:_u,useDeferredValue:function(e,n){var r=Jt();return Tu(r,e,n)},useTransition:function(){var e=ku(!1);return e=Mm.bind(null,Re,e.queue,!0,!1),Jt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,r){var l=Re,f=Jt();if(Pe){if(r===void 0)throw Error(i(407));r=r()}else{if(r=n(),mt===null)throw Error(i(349));($e&127)!==0||om(l,n,r)}f.memoizedState=r;var h={value:r,getSnapshot:n};return f.queue=h,wm(cm.bind(null,l,h,e),[e]),l.flags|=2048,xi(9,{destroy:void 0},lm.bind(null,l,h,r,n),null),r},useId:function(){var e=Jt(),n=mt.identifierPrefix;if(Pe){var r=Zn,l=Yn;r=(l&~(1<<32-It(l)-1)).toString(32)+r,n="_"+n+"R_"+r,r=tl++,0<r&&(n+="H"+r.toString(32)),n+="_"}else r=px++,n="_"+n+"r_"+r.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:Eu,useFormState:bm,useActionState:bm,useOptimistic:function(e){var n=Jt();n.memoizedState=n.baseState=e;var r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=r,n=Au.bind(null,Re,!0,r),r.dispatch=n,[e,n]},useMemoCache:vu,useCacheRefresh:function(){return Jt().memoizedState=vx.bind(null,Re)},useEffectEvent:function(e){var n=Jt(),r={impl:e};return n.memoizedState=r,function(){if((et&2)!==0)throw Error(i(440));return r.impl.apply(void 0,arguments)}}},ju={readContext:Pt,use:sl,useCallback:Am,useContext:Pt,useEffect:Cu,useImperativeHandle:Em,useInsertionEffect:_m,useLayoutEffect:Tm,useMemo:jm,useReducer:al,useRef:km,useState:function(){return al(ks)},useDebugValue:_u,useDeferredValue:function(e,n){var r=Ct();return Rm(r,dt.memoizedState,e,n)},useTransition:function(){var e=al(ks)[0],n=Ct().memoizedState;return[typeof e=="boolean"?e:wr(e),n]},useSyncExternalStore:rm,useId:Dm,useHostTransitionStatus:Eu,useFormState:vm,useActionState:vm,useOptimistic:function(e,n){var r=Ct();return fm(r,dt,e,n)},useMemoCache:vu,useCacheRefresh:Lm};ju.useEffectEvent=Cm;var Hm={readContext:Pt,use:sl,useCallback:Am,useContext:Pt,useEffect:Cu,useImperativeHandle:Em,useInsertionEffect:_m,useLayoutEffect:Tm,useMemo:jm,useReducer:Su,useRef:km,useState:function(){return Su(ks)},useDebugValue:_u,useDeferredValue:function(e,n){var r=Ct();return dt===null?Tu(r,e,n):Rm(r,dt.memoizedState,e,n)},useTransition:function(){var e=Su(ks)[0],n=Ct().memoizedState;return[typeof e=="boolean"?e:wr(e),n]},useSyncExternalStore:rm,useId:Dm,useHostTransitionStatus:Eu,useFormState:Sm,useActionState:Sm,useOptimistic:function(e,n){var r=Ct();return dt!==null?fm(r,dt,e,n):(r.baseState=e,[e,r.queue.dispatch])},useMemoCache:vu,useCacheRefresh:Lm};Hm.useEffectEvent=Cm;function Ru(e,n,r,l){n=e.memoizedState,r=r(l,n),r=r==null?n:b({},n,r),e.memoizedState=r,e.lanes===0&&(e.updateQueue.baseState=r)}var Mu={enqueueSetState:function(e,n,r){e=e._reactInternals;var l=Sn(),f=Qs(l);f.payload=n,r!=null&&(f.callback=r),n=Xs(e,f,l),n!==null&&(cn(n,e,l),vr(n,e,l))},enqueueReplaceState:function(e,n,r){e=e._reactInternals;var l=Sn(),f=Qs(l);f.tag=1,f.payload=n,r!=null&&(f.callback=r),n=Xs(e,f,l),n!==null&&(cn(n,e,l),vr(n,e,l))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var r=Sn(),l=Qs(r);l.tag=2,n!=null&&(l.callback=n),n=Xs(e,l,r),n!==null&&(cn(n,e,r),vr(n,e,r))}};function Pm(e,n,r,l,f,h,v){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,h,v):n.prototype&&n.prototype.isPureReactComponent?!dr(r,l)||!dr(f,h):!0}function Fm(e,n,r,l){e=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(r,l),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(r,l),n.state!==e&&Mu.enqueueReplaceState(n,n.state,null)}function Ua(e,n){var r=n;if("ref"in n){r={};for(var l in n)l!=="ref"&&(r[l]=n[l])}if(e=e.defaultProps){r===n&&(r=b({},r));for(var f in e)r[f]===void 0&&(r[f]=e[f])}return r}function Gm(e){Io(e)}function qm(e){console.error(e)}function Wm(e){Io(e)}function ll(e,n){try{var r=e.onUncaughtError;r(n.value,{componentStack:n.stack})}catch(l){setTimeout(function(){throw l})}}function Vm(e,n,r){try{var l=e.onCaughtError;l(r.value,{componentStack:r.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(f){setTimeout(function(){throw f})}}function Ou(e,n,r){return r=Qs(r),r.tag=3,r.payload={element:null},r.callback=function(){ll(e,n)},r}function Km(e){return e=Qs(e),e.tag=3,e}function Ym(e,n,r,l){var f=r.type.getDerivedStateFromError;if(typeof f=="function"){var h=l.value;e.payload=function(){return f(h)},e.callback=function(){Vm(n,r,l)}}var v=r.stateNode;v!==null&&typeof v.componentDidCatch=="function"&&(e.callback=function(){Vm(n,r,l),typeof f!="function"&&(aa===null?aa=new Set([this]):aa.add(this));var w=l.stack;this.componentDidCatch(l.value,{componentStack:w!==null?w:""})})}function Sx(e,n,r,l,f){if(r.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(n=r.alternate,n!==null&&fi(n,r,f,!0),r=yn.current,r!==null){switch(r.tag){case 31:case 13:return Rn===null?xl():r.alternate===null&&kt===0&&(kt=3),r.flags&=-257,r.flags|=65536,r.lanes=f,l===Yo?r.flags|=16384:(n=r.updateQueue,n===null?r.updateQueue=new Set([l]):n.add(l),ad(e,l,f)),!1;case 22:return r.flags|=65536,l===Yo?r.flags|=16384:(n=r.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([l])},r.updateQueue=n):(r=n.retryQueue,r===null?n.retryQueue=new Set([l]):r.add(l)),ad(e,l,f)),!1}throw Error(i(435,r.tag))}return ad(e,l,f),xl(),!1}if(Pe)return n=yn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=f,l!==Xc&&(e=Error(i(422),{cause:l}),mr(Nn(e,r)))):(l!==Xc&&(n=Error(i(423),{cause:l}),mr(Nn(n,r))),e=e.current.alternate,e.flags|=65536,f&=-f,e.lanes|=f,l=Nn(l,r),f=Ou(e.stateNode,l,f),cu(e,f),kt!==4&&(kt=2)),!1;var h=Error(i(520),{cause:l});if(h=Nn(h,r),Or===null?Or=[h]:Or.push(h),kt!==4&&(kt=2),n===null)return!0;l=Nn(l,r),r=n;do{switch(r.tag){case 3:return r.flags|=65536,e=f&-f,r.lanes|=e,e=Ou(r.stateNode,l,e),cu(r,e),!1;case 1:if(n=r.type,h=r.stateNode,(r.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||h!==null&&typeof h.componentDidCatch=="function"&&(aa===null||!aa.has(h))))return r.flags|=65536,f&=-f,r.lanes|=f,f=Km(f),Ym(f,e,r,l),cu(r,f),!1}r=r.return}while(r!==null);return!1}var Bu=Error(i(461)),jt=!1;function Ft(e,n,r,l){n.child=e===null?Jp(n,null,r,l):La(n,e.child,r,l)}function Zm(e,n,r,l,f){r=r.render;var h=n.ref;if("ref"in l){var v={};for(var w in l)w!=="ref"&&(v[w]=l[w])}else v=l;return Ma(n),l=hu(e,n,r,v,h,f),w=gu(),e!==null&&!jt?(yu(e,n,f),ws(e,n,f)):(Pe&&w&&Zc(n),n.flags|=1,Ft(e,n,l,f),n.child)}function Qm(e,n,r,l,f){if(e===null){var h=r.type;return typeof h=="function"&&!Vc(h)&&h.defaultProps===void 0&&r.compare===null?(n.tag=15,n.type=h,Xm(e,n,h,l,f)):(e=Fo(r.type,null,l,n,n.mode,f),e.ref=n.ref,e.return=n,n.child=e)}if(h=e.child,!Pu(e,f)){var v=h.memoizedProps;if(r=r.compare,r=r!==null?r:dr,r(v,l)&&e.ref===n.ref)return ws(e,n,f)}return n.flags|=1,e=ys(h,l),e.ref=n.ref,e.return=n,n.child=e}function Xm(e,n,r,l,f){if(e!==null){var h=e.memoizedProps;if(dr(h,l)&&e.ref===n.ref)if(jt=!1,n.pendingProps=l=h,Pu(e,f))(e.flags&131072)!==0&&(jt=!0);else return n.lanes=e.lanes,ws(e,n,f)}return Du(e,n,r,l,f)}function Jm(e,n,r,l){var f=l.children,h=e!==null?e.memoizedState:null;if(e===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((n.flags&128)!==0){if(h=h!==null?h.baseLanes|r:r,e!==null){for(l=n.child=e.child,f=0;l!==null;)f=f|l.lanes|l.childLanes,l=l.sibling;l=f&~h}else l=0,n.child=null;return eh(e,n,h,r,l)}if((r&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},e!==null&&Vo(n,h!==null?h.cachePool:null),h!==null?nm(n,h):du(),sm(n);else return l=n.lanes=536870912,eh(e,n,h!==null?h.baseLanes|r:r,r,l)}else h!==null?(Vo(n,h.cachePool),nm(n,h),ea(),n.memoizedState=null):(e!==null&&Vo(n,null),du(),ea());return Ft(e,n,f,r),n.child}function Tr(e,n){return e!==null&&e.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function eh(e,n,r,l,f){var h=iu();return h=h===null?null:{parent:Et._currentValue,pool:h},n.memoizedState={baseLanes:r,cachePool:h},e!==null&&Vo(n,null),du(),sm(n),e!==null&&fi(e,n,l,!0),n.childLanes=f,null}function cl(e,n){return n=dl({mode:n.mode,children:n.children},e.mode),n.ref=e.ref,e.child=n,n.return=e,n}function th(e,n,r){return La(n,e.child,null,r),e=cl(n,n.pendingProps),e.flags|=2,bn(n),n.memoizedState=null,e}function kx(e,n,r){var l=n.pendingProps,f=(n.flags&128)!==0;if(n.flags&=-129,e===null){if(Pe){if(l.mode==="hidden")return e=cl(n,l),n.lanes=536870912,Tr(null,e);if(pu(n),(e=ht)?(e=pg(e,jn),e=e!==null&&e.data==="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:Ws!==null?{id:Yn,overflow:Zn}:null,retryLane:536870912,hydrationErrors:null},r=Up(e),r.return=n,n.child=r,Ht=n,ht=null)):e=null,e===null)throw Ks(n);return n.lanes=536870912,null}return cl(n,l)}var h=e.memoizedState;if(h!==null){var v=h.dehydrated;if(pu(n),f)if(n.flags&256)n.flags&=-257,n=th(e,n,r);else if(n.memoizedState!==null)n.child=e.child,n.flags|=128,n=null;else throw Error(i(558));else if(jt||fi(e,n,r,!1),f=(r&e.childLanes)!==0,jt||f){if(l=mt,l!==null&&(v=Ja(l,r),v!==0&&v!==h.retryLane))throw h.retryLane=v,Ea(e,v),cn(l,e,v),Bu;xl(),n=th(e,n,r)}else e=h.treeContext,ht=Mn(v.nextSibling),Ht=n,Pe=!0,Vs=null,jn=!1,e!==null&&Hp(n,e),n=cl(n,l),n.flags|=4096;return n}return e=ys(e.child,{mode:l.mode,children:l.children}),e.ref=n.ref,n.child=e,e.return=n,e}function ul(e,n){var r=n.ref;if(r===null)e!==null&&e.ref!==null&&(n.flags|=4194816);else{if(typeof r!="function"&&typeof r!="object")throw Error(i(284));(e===null||e.ref!==r)&&(n.flags|=4194816)}}function Du(e,n,r,l,f){return Ma(n),r=hu(e,n,r,l,void 0,f),l=gu(),e!==null&&!jt?(yu(e,n,f),ws(e,n,f)):(Pe&&l&&Zc(n),n.flags|=1,Ft(e,n,r,f),n.child)}function nh(e,n,r,l,f,h){return Ma(n),n.updateQueue=null,r=im(n,l,r,f),am(e),l=gu(),e!==null&&!jt?(yu(e,n,h),ws(e,n,h)):(Pe&&l&&Zc(n),n.flags|=1,Ft(e,n,r,h),n.child)}function sh(e,n,r,l,f){if(Ma(n),n.stateNode===null){var h=li,v=r.contextType;typeof v=="object"&&v!==null&&(h=Pt(v)),h=new r(l,h),n.memoizedState=h.state!==null&&h.state!==void 0?h.state:null,h.updater=Mu,n.stateNode=h,h._reactInternals=n,h=n.stateNode,h.props=l,h.state=n.memoizedState,h.refs={},ou(n),v=r.contextType,h.context=typeof v=="object"&&v!==null?Pt(v):li,h.state=n.memoizedState,v=r.getDerivedStateFromProps,typeof v=="function"&&(Ru(n,r,v,l),h.state=n.memoizedState),typeof r.getDerivedStateFromProps=="function"||typeof h.getSnapshotBeforeUpdate=="function"||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(v=h.state,typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount(),v!==h.state&&Mu.enqueueReplaceState(h,h.state,null),Sr(n,l,h,f),xr(),h.state=n.memoizedState),typeof h.componentDidMount=="function"&&(n.flags|=4194308),l=!0}else if(e===null){h=n.stateNode;var w=n.memoizedProps,N=Ua(r,w);h.props=N;var U=h.context,G=r.contextType;v=li,typeof G=="object"&&G!==null&&(v=Pt(G));var V=r.getDerivedStateFromProps;G=typeof V=="function"||typeof h.getSnapshotBeforeUpdate=="function",w=n.pendingProps!==w,G||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(w||U!==v)&&Fm(n,h,l,v),Zs=!1;var I=n.memoizedState;h.state=I,Sr(n,l,h,f),xr(),U=n.memoizedState,w||I!==U||Zs?(typeof V=="function"&&(Ru(n,r,V,l),U=n.memoizedState),(N=Zs||Pm(n,r,N,l,I,U,v))?(G||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount()),typeof h.componentDidMount=="function"&&(n.flags|=4194308)):(typeof h.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=l,n.memoizedState=U),h.props=l,h.state=U,h.context=v,l=N):(typeof h.componentDidMount=="function"&&(n.flags|=4194308),l=!1)}else{h=n.stateNode,lu(e,n),v=n.memoizedProps,G=Ua(r,v),h.props=G,V=n.pendingProps,I=h.context,U=r.contextType,N=li,typeof U=="object"&&U!==null&&(N=Pt(U)),w=r.getDerivedStateFromProps,(U=typeof w=="function"||typeof h.getSnapshotBeforeUpdate=="function")||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(v!==V||I!==N)&&Fm(n,h,l,N),Zs=!1,I=n.memoizedState,h.state=I,Sr(n,l,h,f),xr();var H=n.memoizedState;v!==V||I!==H||Zs||e!==null&&e.dependencies!==null&&qo(e.dependencies)?(typeof w=="function"&&(Ru(n,r,w,l),H=n.memoizedState),(G=Zs||Pm(n,r,G,l,I,H,N)||e!==null&&e.dependencies!==null&&qo(e.dependencies))?(U||typeof h.UNSAFE_componentWillUpdate!="function"&&typeof h.componentWillUpdate!="function"||(typeof h.componentWillUpdate=="function"&&h.componentWillUpdate(l,H,N),typeof h.UNSAFE_componentWillUpdate=="function"&&h.UNSAFE_componentWillUpdate(l,H,N)),typeof h.componentDidUpdate=="function"&&(n.flags|=4),typeof h.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof h.componentDidUpdate!="function"||v===e.memoizedProps&&I===e.memoizedState||(n.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||v===e.memoizedProps&&I===e.memoizedState||(n.flags|=1024),n.memoizedProps=l,n.memoizedState=H),h.props=l,h.state=H,h.context=N,l=G):(typeof h.componentDidUpdate!="function"||v===e.memoizedProps&&I===e.memoizedState||(n.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||v===e.memoizedProps&&I===e.memoizedState||(n.flags|=1024),l=!1)}return h=l,ul(e,n),l=(n.flags&128)!==0,h||l?(h=n.stateNode,r=l&&typeof r.getDerivedStateFromError!="function"?null:h.render(),n.flags|=1,e!==null&&l?(n.child=La(n,e.child,null,f),n.child=La(n,null,r,f)):Ft(e,n,r,f),n.memoizedState=h.state,e=n.child):e=ws(e,n,f),e}function ah(e,n,r,l){return ja(),n.flags|=256,Ft(e,n,r,l),n.child}var Lu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function zu(e){return{baseLanes:e,cachePool:Vp()}}function Uu(e,n,r){return e=e!==null?e.childLanes&~r:0,n&&(e|=xn),e}function ih(e,n,r){var l=n.pendingProps,f=!1,h=(n.flags&128)!==0,v;if((v=h)||(v=e!==null&&e.memoizedState===null?!1:(wt.current&2)!==0),v&&(f=!0,n.flags&=-129),v=(n.flags&32)!==0,n.flags&=-33,e===null){if(Pe){if(f?Js(n):ea(),(e=ht)?(e=pg(e,jn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:Ws!==null?{id:Yn,overflow:Zn}:null,retryLane:536870912,hydrationErrors:null},r=Up(e),r.return=n,n.child=r,Ht=n,ht=null)):e=null,e===null)throw Ks(n);return xd(e)?n.lanes=32:n.lanes=536870912,null}var w=l.children;return l=l.fallback,f?(ea(),f=n.mode,w=dl({mode:"hidden",children:w},f),l=Aa(l,f,r,null),w.return=n,l.return=n,w.sibling=l,n.child=w,l=n.child,l.memoizedState=zu(r),l.childLanes=Uu(e,v,r),n.memoizedState=Lu,Tr(null,l)):(Js(n),Iu(n,w))}var N=e.memoizedState;if(N!==null&&(w=N.dehydrated,w!==null)){if(h)n.flags&256?(Js(n),n.flags&=-257,n=$u(e,n,r)):n.memoizedState!==null?(ea(),n.child=e.child,n.flags|=128,n=null):(ea(),w=l.fallback,f=n.mode,l=dl({mode:"visible",children:l.children},f),w=Aa(w,f,r,null),w.flags|=2,l.return=n,w.return=n,l.sibling=w,n.child=l,La(n,e.child,null,r),l=n.child,l.memoizedState=zu(r),l.childLanes=Uu(e,v,r),n.memoizedState=Lu,n=Tr(null,l));else if(Js(n),xd(w)){if(v=w.nextSibling&&w.nextSibling.dataset,v)var U=v.dgst;v=U,l=Error(i(419)),l.stack="",l.digest=v,mr({value:l,source:null,stack:null}),n=$u(e,n,r)}else if(jt||fi(e,n,r,!1),v=(r&e.childLanes)!==0,jt||v){if(v=mt,v!==null&&(l=Ja(v,r),l!==0&&l!==N.retryLane))throw N.retryLane=l,Ea(e,l),cn(v,e,l),Bu;vd(w)||xl(),n=$u(e,n,r)}else vd(w)?(n.flags|=192,n.child=e.child,n=null):(e=N.treeContext,ht=Mn(w.nextSibling),Ht=n,Pe=!0,Vs=null,jn=!1,e!==null&&Hp(n,e),n=Iu(n,l.children),n.flags|=4096);return n}return f?(ea(),w=l.fallback,f=n.mode,N=e.child,U=N.sibling,l=ys(N,{mode:"hidden",children:l.children}),l.subtreeFlags=N.subtreeFlags&65011712,U!==null?w=ys(U,w):(w=Aa(w,f,r,null),w.flags|=2),w.return=n,l.return=n,l.sibling=w,n.child=l,Tr(null,l),l=n.child,w=e.child.memoizedState,w===null?w=zu(r):(f=w.cachePool,f!==null?(N=Et._currentValue,f=f.parent!==N?{parent:N,pool:N}:f):f=Vp(),w={baseLanes:w.baseLanes|r,cachePool:f}),l.memoizedState=w,l.childLanes=Uu(e,v,r),n.memoizedState=Lu,Tr(e.child,l)):(Js(n),r=e.child,e=r.sibling,r=ys(r,{mode:"visible",children:l.children}),r.return=n,r.sibling=null,e!==null&&(v=n.deletions,v===null?(n.deletions=[e],n.flags|=16):v.push(e)),n.child=r,n.memoizedState=null,r)}function Iu(e,n){return n=dl({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function dl(e,n){return e=gn(22,e,null,n),e.lanes=0,e}function $u(e,n,r){return La(n,e.child,null,r),e=Iu(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function rh(e,n,r){e.lanes|=n;var l=e.alternate;l!==null&&(l.lanes|=n),tu(e.return,n,r)}function Hu(e,n,r,l,f,h){var v=e.memoizedState;v===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:l,tail:r,tailMode:f,treeForkCount:h}:(v.isBackwards=n,v.rendering=null,v.renderingStartTime=0,v.last=l,v.tail=r,v.tailMode=f,v.treeForkCount=h)}function oh(e,n,r){var l=n.pendingProps,f=l.revealOrder,h=l.tail;l=l.children;var v=wt.current,w=(v&2)!==0;if(w?(v=v&1|2,n.flags|=128):v&=1,ke(wt,v),Ft(e,n,l,r),l=Pe?pr:0,!w&&e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&rh(e,r,n);else if(e.tag===19)rh(e,r,n);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break e;for(;e.sibling===null;){if(e.return===null||e.return===n)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(f){case"forwards":for(r=n.child,f=null;r!==null;)e=r.alternate,e!==null&&Jo(e)===null&&(f=r),r=r.sibling;r=f,r===null?(f=n.child,n.child=null):(f=r.sibling,r.sibling=null),Hu(n,!1,f,r,h,l);break;case"backwards":case"unstable_legacy-backwards":for(r=null,f=n.child,n.child=null;f!==null;){if(e=f.alternate,e!==null&&Jo(e)===null){n.child=f;break}e=f.sibling,f.sibling=r,r=f,f=e}Hu(n,!0,r,null,h,l);break;case"together":Hu(n,!1,null,null,void 0,l);break;default:n.memoizedState=null}return n.child}function ws(e,n,r){if(e!==null&&(n.dependencies=e.dependencies),sa|=n.lanes,(r&n.childLanes)===0)if(e!==null){if(fi(e,n,r,!1),(r&n.childLanes)===0)return null}else return null;if(e!==null&&n.child!==e.child)throw Error(i(153));if(n.child!==null){for(e=n.child,r=ys(e,e.pendingProps),n.child=r,r.return=n;e.sibling!==null;)e=e.sibling,r=r.sibling=ys(e,e.pendingProps),r.return=n;r.sibling=null}return n.child}function Pu(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&qo(e)))}function wx(e,n,r){switch(n.tag){case 3:fn(n,n.stateNode.containerInfo),Ys(n,Et,e.memoizedState.cache),ja();break;case 27:case 5:os(n);break;case 4:fn(n,n.stateNode.containerInfo);break;case 10:Ys(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,pu(n),null;break;case 13:var l=n.memoizedState;if(l!==null)return l.dehydrated!==null?(Js(n),n.flags|=128,null):(r&n.child.childLanes)!==0?ih(e,n,r):(Js(n),e=ws(e,n,r),e!==null?e.sibling:null);Js(n);break;case 19:var f=(e.flags&128)!==0;if(l=(r&n.childLanes)!==0,l||(fi(e,n,r,!1),l=(r&n.childLanes)!==0),f){if(l)return oh(e,n,r);n.flags|=128}if(f=n.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),ke(wt,wt.current),l)break;return null;case 22:return n.lanes=0,Jm(e,n,r,n.pendingProps);case 24:Ys(n,Et,e.memoizedState.cache)}return ws(e,n,r)}function lh(e,n,r){if(e!==null)if(e.memoizedProps!==n.pendingProps)jt=!0;else{if(!Pu(e,r)&&(n.flags&128)===0)return jt=!1,wx(e,n,r);jt=(e.flags&131072)!==0}else jt=!1,Pe&&(n.flags&1048576)!==0&&$p(n,pr,n.index);switch(n.lanes=0,n.tag){case 16:e:{var l=n.pendingProps;if(e=Ba(n.elementType),n.type=e,typeof e=="function")Vc(e)?(l=Ua(e,l),n.tag=1,n=sh(null,n,e,l,r)):(n.tag=0,n=Du(null,n,e,l,r));else{if(e!=null){var f=e.$$typeof;if(f===M){n.tag=11,n=Zm(null,n,e,l,r);break e}else if(f===Y){n.tag=14,n=Qm(null,n,e,l,r);break e}}throw n=ne(e)||e,Error(i(306,n,""))}}return n;case 0:return Du(e,n,n.type,n.pendingProps,r);case 1:return l=n.type,f=Ua(l,n.pendingProps),sh(e,n,l,f,r);case 3:e:{if(fn(n,n.stateNode.containerInfo),e===null)throw Error(i(387));l=n.pendingProps;var h=n.memoizedState;f=h.element,lu(e,n),Sr(n,l,null,r);var v=n.memoizedState;if(l=v.cache,Ys(n,Et,l),l!==h.cache&&nu(n,[Et],r,!0),xr(),l=v.element,h.isDehydrated)if(h={element:l,isDehydrated:!1,cache:v.cache},n.updateQueue.baseState=h,n.memoizedState=h,n.flags&256){n=ah(e,n,l,r);break e}else if(l!==f){f=Nn(Error(i(424)),n),mr(f),n=ah(e,n,l,r);break e}else{switch(e=n.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(ht=Mn(e.firstChild),Ht=n,Pe=!0,Vs=null,jn=!0,r=Jp(n,null,l,r),n.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling}else{if(ja(),l===f){n=ws(e,n,r);break e}Ft(e,n,l,r)}n=n.child}return n;case 26:return ul(e,n),e===null?(r=vg(n.type,null,n.pendingProps,null))?n.memoizedState=r:Pe||(r=n.type,e=n.pendingProps,l=Nl(Zt.current).createElement(r),l[Tt]=n,l[$t]=e,Gt(l,r,e),Nt(l),n.stateNode=l):n.memoizedState=vg(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return os(n),e===null&&Pe&&(l=n.stateNode=gg(n.type,n.pendingProps,Zt.current),Ht=n,jn=!0,f=ht,la(n.type)?(Sd=f,ht=Mn(l.firstChild)):ht=f),Ft(e,n,n.pendingProps.children,r),ul(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&Pe&&((f=l=ht)&&(l=Jx(l,n.type,n.pendingProps,jn),l!==null?(n.stateNode=l,Ht=n,ht=Mn(l.firstChild),jn=!1,f=!0):f=!1),f||Ks(n)),os(n),f=n.type,h=n.pendingProps,v=e!==null?e.memoizedProps:null,l=h.children,gd(f,h)?l=null:v!==null&&gd(f,v)&&(n.flags|=32),n.memoizedState!==null&&(f=hu(e,n,mx,null,null,r),Hr._currentValue=f),ul(e,n),Ft(e,n,l,r),n.child;case 6:return e===null&&Pe&&((e=r=ht)&&(r=eS(r,n.pendingProps,jn),r!==null?(n.stateNode=r,Ht=n,ht=null,e=!0):e=!1),e||Ks(n)),null;case 13:return ih(e,n,r);case 4:return fn(n,n.stateNode.containerInfo),l=n.pendingProps,e===null?n.child=La(n,null,l,r):Ft(e,n,l,r),n.child;case 11:return Zm(e,n,n.type,n.pendingProps,r);case 7:return Ft(e,n,n.pendingProps,r),n.child;case 8:return Ft(e,n,n.pendingProps.children,r),n.child;case 12:return Ft(e,n,n.pendingProps.children,r),n.child;case 10:return l=n.pendingProps,Ys(n,n.type,l.value),Ft(e,n,l.children,r),n.child;case 9:return f=n.type._context,l=n.pendingProps.children,Ma(n),f=Pt(f),l=l(f),n.flags|=1,Ft(e,n,l,r),n.child;case 14:return Qm(e,n,n.type,n.pendingProps,r);case 15:return Xm(e,n,n.type,n.pendingProps,r);case 19:return oh(e,n,r);case 31:return kx(e,n,r);case 22:return Jm(e,n,r,n.pendingProps);case 24:return Ma(n),l=Pt(Et),e===null?(f=iu(),f===null&&(f=mt,h=su(),f.pooledCache=h,h.refCount++,h!==null&&(f.pooledCacheLanes|=r),f=h),n.memoizedState={parent:l,cache:f},ou(n),Ys(n,Et,f)):((e.lanes&r)!==0&&(lu(e,n),Sr(n,null,null,r),xr()),f=e.memoizedState,h=n.memoizedState,f.parent!==l?(f={parent:l,cache:l},n.memoizedState=f,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=f),Ys(n,Et,l)):(l=h.cache,Ys(n,Et,l),l!==f.cache&&nu(n,[Et],r,!0))),Ft(e,n,n.pendingProps.children,r),n.child;case 29:throw n.pendingProps}throw Error(i(156,n.tag))}function Cs(e){e.flags|=4}function Fu(e,n,r,l,f){if((n=(e.mode&32)!==0)&&(n=!1),n){if(e.flags|=16777216,(f&335544128)===f)if(e.stateNode.complete)e.flags|=8192;else if(Dh())e.flags|=8192;else throw Da=Yo,ru}else e.flags&=-16777217}function ch(e,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Cg(n))if(Dh())e.flags|=8192;else throw Da=Yo,ru}function fl(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?No():536870912,e.lanes|=n,Ci|=n)}function Nr(e,n){if(!Pe)switch(e.tailMode){case"hidden":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?e.tail=null:r.sibling=null;break;case"collapsed":r=e.tail;for(var l=null;r!==null;)r.alternate!==null&&(l=r),r=r.sibling;l===null?n||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function gt(e){var n=e.alternate!==null&&e.alternate.child===e.child,r=0,l=0;if(n)for(var f=e.child;f!==null;)r|=f.lanes|f.childLanes,l|=f.subtreeFlags&65011712,l|=f.flags&65011712,f.return=e,f=f.sibling;else for(f=e.child;f!==null;)r|=f.lanes|f.childLanes,l|=f.subtreeFlags,l|=f.flags,f.return=e,f=f.sibling;return e.subtreeFlags|=l,e.childLanes=r,n}function Cx(e,n,r){var l=n.pendingProps;switch(Qc(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return gt(n),null;case 1:return gt(n),null;case 3:return r=n.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),n.memoizedState.cache!==l&&(n.flags|=2048),xs(Et),wn(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(di(n)?Cs(n):e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,Jc())),gt(n),null;case 26:var f=n.type,h=n.memoizedState;return e===null?(Cs(n),h!==null?(gt(n),ch(n,h)):(gt(n),Fu(n,f,null,l,r))):h?h!==e.memoizedState?(Cs(n),gt(n),ch(n,h)):(gt(n),n.flags&=-16777217):(e=e.memoizedProps,e!==l&&Cs(n),gt(n),Fu(n,f,e,l,r)),null;case 27:if(ls(n),r=Zt.current,f=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==l&&Cs(n);else{if(!l){if(n.stateNode===null)throw Error(i(166));return gt(n),null}e=st.current,di(n)?Pp(n):(e=gg(f,l,r),n.stateNode=e,Cs(n))}return gt(n),null;case 5:if(ls(n),f=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==l&&Cs(n);else{if(!l){if(n.stateNode===null)throw Error(i(166));return gt(n),null}if(h=st.current,di(n))Pp(n);else{var v=Nl(Zt.current);switch(h){case 1:h=v.createElementNS("http://www.w3.org/2000/svg",f);break;case 2:h=v.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;default:switch(f){case"svg":h=v.createElementNS("http://www.w3.org/2000/svg",f);break;case"math":h=v.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;case"script":h=v.createElement("div"),h.innerHTML="<script><\/script>",h=h.removeChild(h.firstChild);break;case"select":h=typeof l.is=="string"?v.createElement("select",{is:l.is}):v.createElement("select"),l.multiple?h.multiple=!0:l.size&&(h.size=l.size);break;default:h=typeof l.is=="string"?v.createElement(f,{is:l.is}):v.createElement(f)}}h[Tt]=n,h[$t]=l;e:for(v=n.child;v!==null;){if(v.tag===5||v.tag===6)h.appendChild(v.stateNode);else if(v.tag!==4&&v.tag!==27&&v.child!==null){v.child.return=v,v=v.child;continue}if(v===n)break e;for(;v.sibling===null;){if(v.return===null||v.return===n)break e;v=v.return}v.sibling.return=v.return,v=v.sibling}n.stateNode=h;e:switch(Gt(h,f,l),f){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&Cs(n)}}return gt(n),Fu(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,r),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==l&&Cs(n);else{if(typeof l!="string"&&n.stateNode===null)throw Error(i(166));if(e=Zt.current,di(n)){if(e=n.stateNode,r=n.memoizedProps,l=null,f=Ht,f!==null)switch(f.tag){case 27:case 5:l=f.memoizedProps}e[Tt]=n,e=!!(e.nodeValue===r||l!==null&&l.suppressHydrationWarning===!0||ig(e.nodeValue,r)),e||Ks(n,!0)}else e=Nl(e).createTextNode(l),e[Tt]=n,n.stateNode=e}return gt(n),null;case 31:if(r=n.memoizedState,e===null||e.memoizedState!==null){if(l=di(n),r!==null){if(e===null){if(!l)throw Error(i(318));if(e=n.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(557));e[Tt]=n}else ja(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;gt(n),e=!1}else r=Jc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),e=!0;if(!e)return n.flags&256?(bn(n),n):(bn(n),null);if((n.flags&128)!==0)throw Error(i(558))}return gt(n),null;case 13:if(l=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(f=di(n),l!==null&&l.dehydrated!==null){if(e===null){if(!f)throw Error(i(318));if(f=n.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(i(317));f[Tt]=n}else ja(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;gt(n),f=!1}else f=Jc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=f),f=!0;if(!f)return n.flags&256?(bn(n),n):(bn(n),null)}return bn(n),(n.flags&128)!==0?(n.lanes=r,n):(r=l!==null,e=e!==null&&e.memoizedState!==null,r&&(l=n.child,f=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(f=l.alternate.memoizedState.cachePool.pool),h=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(h=l.memoizedState.cachePool.pool),h!==f&&(l.flags|=2048)),r!==e&&r&&(n.child.flags|=8192),fl(n,n.updateQueue),gt(n),null);case 4:return wn(),e===null&&dd(n.stateNode.containerInfo),gt(n),null;case 10:return xs(n.type),gt(n),null;case 19:if(Ee(wt),l=n.memoizedState,l===null)return gt(n),null;if(f=(n.flags&128)!==0,h=l.rendering,h===null)if(f)Nr(l,!1);else{if(kt!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(h=Jo(e),h!==null){for(n.flags|=128,Nr(l,!1),e=h.updateQueue,n.updateQueue=e,fl(n,e),n.subtreeFlags=0,e=r,r=n.child;r!==null;)zp(r,e),r=r.sibling;return ke(wt,wt.current&1|2),Pe&&bs(n,l.treeForkCount),n.child}e=e.sibling}l.tail!==null&&tt()>yl&&(n.flags|=128,f=!0,Nr(l,!1),n.lanes=4194304)}else{if(!f)if(e=Jo(h),e!==null){if(n.flags|=128,f=!0,e=e.updateQueue,n.updateQueue=e,fl(n,e),Nr(l,!0),l.tail===null&&l.tailMode==="hidden"&&!h.alternate&&!Pe)return gt(n),null}else 2*tt()-l.renderingStartTime>yl&&r!==536870912&&(n.flags|=128,f=!0,Nr(l,!1),n.lanes=4194304);l.isBackwards?(h.sibling=n.child,n.child=h):(e=l.last,e!==null?e.sibling=h:n.child=h,l.last=h)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=tt(),e.sibling=null,r=wt.current,ke(wt,f?r&1|2:r&1),Pe&&bs(n,l.treeForkCount),e):(gt(n),null);case 22:case 23:return bn(n),fu(),l=n.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(n.flags|=8192):l&&(n.flags|=8192),l?(r&536870912)!==0&&(n.flags&128)===0&&(gt(n),n.subtreeFlags&6&&(n.flags|=8192)):gt(n),r=n.updateQueue,r!==null&&fl(n,r.retryQueue),r=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(r=e.memoizedState.cachePool.pool),l=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(l=n.memoizedState.cachePool.pool),l!==r&&(n.flags|=2048),e!==null&&Ee(Oa),null;case 24:return r=null,e!==null&&(r=e.memoizedState.cache),n.memoizedState.cache!==r&&(n.flags|=2048),xs(Et),gt(n),null;case 25:return null;case 30:return null}throw Error(i(156,n.tag))}function _x(e,n){switch(Qc(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return xs(Et),wn(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return ls(n),null;case 31:if(n.memoizedState!==null){if(bn(n),n.alternate===null)throw Error(i(340));ja()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(bn(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(i(340));ja()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return Ee(wt),null;case 4:return wn(),null;case 10:return xs(n.type),null;case 22:case 23:return bn(n),fu(),e!==null&&Ee(Oa),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return xs(Et),null;case 25:return null;default:return null}}function uh(e,n){switch(Qc(n),n.tag){case 3:xs(Et),wn();break;case 26:case 27:case 5:ls(n);break;case 4:wn();break;case 31:n.memoizedState!==null&&bn(n);break;case 13:bn(n);break;case 19:Ee(wt);break;case 10:xs(n.type);break;case 22:case 23:bn(n),fu(),e!==null&&Ee(Oa);break;case 24:xs(Et)}}function Er(e,n){try{var r=n.updateQueue,l=r!==null?r.lastEffect:null;if(l!==null){var f=l.next;r=f;do{if((r.tag&e)===e){l=void 0;var h=r.create,v=r.inst;l=h(),v.destroy=l}r=r.next}while(r!==f)}}catch(w){ot(n,n.return,w)}}function ta(e,n,r){try{var l=n.updateQueue,f=l!==null?l.lastEffect:null;if(f!==null){var h=f.next;l=h;do{if((l.tag&e)===e){var v=l.inst,w=v.destroy;if(w!==void 0){v.destroy=void 0,f=n;var N=r,U=w;try{U()}catch(G){ot(f,N,G)}}}l=l.next}while(l!==h)}}catch(G){ot(n,n.return,G)}}function dh(e){var n=e.updateQueue;if(n!==null){var r=e.stateNode;try{tm(n,r)}catch(l){ot(e,e.return,l)}}}function fh(e,n,r){r.props=Ua(e.type,e.memoizedProps),r.state=e.memoizedState;try{r.componentWillUnmount()}catch(l){ot(e,n,l)}}function Ar(e,n){try{var r=e.ref;if(r!==null){switch(e.tag){case 26:case 27:case 5:var l=e.stateNode;break;case 30:l=e.stateNode;break;default:l=e.stateNode}typeof r=="function"?e.refCleanup=r(l):r.current=l}}catch(f){ot(e,n,f)}}function Qn(e,n){var r=e.ref,l=e.refCleanup;if(r!==null)if(typeof l=="function")try{l()}catch(f){ot(e,n,f)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof r=="function")try{r(null)}catch(f){ot(e,n,f)}else r.current=null}function ph(e){var n=e.type,r=e.memoizedProps,l=e.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":r.autoFocus&&l.focus();break e;case"img":r.src?l.src=r.src:r.srcSet&&(l.srcset=r.srcSet)}}catch(f){ot(e,e.return,f)}}function Gu(e,n,r){try{var l=e.stateNode;Vx(l,e.type,r,n),l[$t]=n}catch(f){ot(e,e.return,f)}}function mh(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&la(e.type)||e.tag===4}function qu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||mh(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&la(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Wu(e,n,r){var l=e.tag;if(l===5||l===6)e=e.stateNode,n?(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r).insertBefore(e,n):(n=r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,n.appendChild(e),r=r._reactRootContainer,r!=null||n.onclick!==null||(n.onclick=hs));else if(l!==4&&(l===27&&la(e.type)&&(r=e.stateNode,n=null),e=e.child,e!==null))for(Wu(e,n,r),e=e.sibling;e!==null;)Wu(e,n,r),e=e.sibling}function pl(e,n,r){var l=e.tag;if(l===5||l===6)e=e.stateNode,n?r.insertBefore(e,n):r.appendChild(e);else if(l!==4&&(l===27&&la(e.type)&&(r=e.stateNode),e=e.child,e!==null))for(pl(e,n,r),e=e.sibling;e!==null;)pl(e,n,r),e=e.sibling}function hh(e){var n=e.stateNode,r=e.memoizedProps;try{for(var l=e.type,f=n.attributes;f.length;)n.removeAttributeNode(f[0]);Gt(n,l,r),n[Tt]=e,n[$t]=r}catch(h){ot(e,e.return,h)}}var _s=!1,Rt=!1,Vu=!1,gh=typeof WeakSet=="function"?WeakSet:Set,zt=null;function Tx(e,n){if(e=e.containerInfo,md=Bl,e=Ep(e),$c(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var l=r.getSelection&&r.getSelection();if(l&&l.rangeCount!==0){r=l.anchorNode;var f=l.anchorOffset,h=l.focusNode;l=l.focusOffset;try{r.nodeType,h.nodeType}catch{r=null;break e}var v=0,w=-1,N=-1,U=0,G=0,V=e,I=null;t:for(;;){for(var H;V!==r||f!==0&&V.nodeType!==3||(w=v+f),V!==h||l!==0&&V.nodeType!==3||(N=v+l),V.nodeType===3&&(v+=V.nodeValue.length),(H=V.firstChild)!==null;)I=V,V=H;for(;;){if(V===e)break t;if(I===r&&++U===f&&(w=v),I===h&&++G===l&&(N=v),(H=V.nextSibling)!==null)break;V=I,I=V.parentNode}V=H}r=w===-1||N===-1?null:{start:w,end:N}}else r=null}r=r||{start:0,end:0}}else r=null;for(hd={focusedElem:e,selectionRange:r},Bl=!1,zt=n;zt!==null;)if(n=zt,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,zt=e;else for(;zt!==null;){switch(n=zt,h=n.alternate,e=n.flags,n.tag){case 0:if((e&4)!==0&&(e=n.updateQueue,e=e!==null?e.events:null,e!==null))for(r=0;r<e.length;r++)f=e[r],f.ref.impl=f.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&h!==null){e=void 0,r=n,f=h.memoizedProps,h=h.memoizedState,l=r.stateNode;try{var re=Ua(r.type,f);e=l.getSnapshotBeforeUpdate(re,h),l.__reactInternalSnapshotBeforeUpdate=e}catch(ye){ot(r,r.return,ye)}}break;case 3:if((e&1024)!==0){if(e=n.stateNode.containerInfo,r=e.nodeType,r===9)bd(e);else if(r===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":bd(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(i(163))}if(e=n.sibling,e!==null){e.return=n.return,zt=e;break}zt=n.return}}function yh(e,n,r){var l=r.flags;switch(r.tag){case 0:case 11:case 15:Ns(e,r),l&4&&Er(5,r);break;case 1:if(Ns(e,r),l&4)if(e=r.stateNode,n===null)try{e.componentDidMount()}catch(v){ot(r,r.return,v)}else{var f=Ua(r.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(f,n,e.__reactInternalSnapshotBeforeUpdate)}catch(v){ot(r,r.return,v)}}l&64&&dh(r),l&512&&Ar(r,r.return);break;case 3:if(Ns(e,r),l&64&&(e=r.updateQueue,e!==null)){if(n=null,r.child!==null)switch(r.child.tag){case 27:case 5:n=r.child.stateNode;break;case 1:n=r.child.stateNode}try{tm(e,n)}catch(v){ot(r,r.return,v)}}break;case 27:n===null&&l&4&&hh(r);case 26:case 5:Ns(e,r),n===null&&l&4&&ph(r),l&512&&Ar(r,r.return);break;case 12:Ns(e,r);break;case 31:Ns(e,r),l&4&&xh(e,r);break;case 13:Ns(e,r),l&4&&Sh(e,r),l&64&&(e=r.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(r=Dx.bind(null,r),tS(e,r))));break;case 22:if(l=r.memoizedState!==null||_s,!l){n=n!==null&&n.memoizedState!==null||Rt,f=_s;var h=Rt;_s=l,(Rt=n)&&!h?Es(e,r,(r.subtreeFlags&8772)!==0):Ns(e,r),_s=f,Rt=h}break;case 30:break;default:Ns(e,r)}}function bh(e){var n=e.alternate;n!==null&&(e.alternate=null,bh(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&er(n)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var yt=null,an=!1;function Ts(e,n,r){for(r=r.child;r!==null;)vh(e,n,r),r=r.sibling}function vh(e,n,r){if(Kt&&typeof Kt.onCommitFiberUnmount=="function")try{Kt.onCommitFiberUnmount(Ps,r)}catch{}switch(r.tag){case 26:Rt||Qn(r,n),Ts(e,n,r),r.memoizedState?r.memoizedState.count--:r.stateNode&&(r=r.stateNode,r.parentNode.removeChild(r));break;case 27:Rt||Qn(r,n);var l=yt,f=an;la(r.type)&&(yt=r.stateNode,an=!1),Ts(e,n,r),Ur(r.stateNode),yt=l,an=f;break;case 5:Rt||Qn(r,n);case 6:if(l=yt,f=an,yt=null,Ts(e,n,r),yt=l,an=f,yt!==null)if(an)try{(yt.nodeType===9?yt.body:yt.nodeName==="HTML"?yt.ownerDocument.body:yt).removeChild(r.stateNode)}catch(h){ot(r,n,h)}else try{yt.removeChild(r.stateNode)}catch(h){ot(r,n,h)}break;case 18:yt!==null&&(an?(e=yt,dg(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,r.stateNode),Mi(e)):dg(yt,r.stateNode));break;case 4:l=yt,f=an,yt=r.stateNode.containerInfo,an=!0,Ts(e,n,r),yt=l,an=f;break;case 0:case 11:case 14:case 15:ta(2,r,n),Rt||ta(4,r,n),Ts(e,n,r);break;case 1:Rt||(Qn(r,n),l=r.stateNode,typeof l.componentWillUnmount=="function"&&fh(r,n,l)),Ts(e,n,r);break;case 21:Ts(e,n,r);break;case 22:Rt=(l=Rt)||r.memoizedState!==null,Ts(e,n,r),Rt=l;break;default:Ts(e,n,r)}}function xh(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Mi(e)}catch(r){ot(n,n.return,r)}}}function Sh(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Mi(e)}catch(r){ot(n,n.return,r)}}function Nx(e){switch(e.tag){case 31:case 13:case 19:var n=e.stateNode;return n===null&&(n=e.stateNode=new gh),n;case 22:return e=e.stateNode,n=e._retryCache,n===null&&(n=e._retryCache=new gh),n;default:throw Error(i(435,e.tag))}}function ml(e,n){var r=Nx(e);n.forEach(function(l){if(!r.has(l)){r.add(l);var f=Lx.bind(null,e,l);l.then(f,f)}})}function rn(e,n){var r=n.deletions;if(r!==null)for(var l=0;l<r.length;l++){var f=r[l],h=e,v=n,w=v;e:for(;w!==null;){switch(w.tag){case 27:if(la(w.type)){yt=w.stateNode,an=!1;break e}break;case 5:yt=w.stateNode,an=!1;break e;case 3:case 4:yt=w.stateNode.containerInfo,an=!0;break e}w=w.return}if(yt===null)throw Error(i(160));vh(h,v,f),yt=null,an=!1,h=f.alternate,h!==null&&(h.return=null),f.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)kh(n,e),n=n.sibling}var Hn=null;function kh(e,n){var r=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:rn(n,e),on(e),l&4&&(ta(3,e,e.return),Er(3,e),ta(5,e,e.return));break;case 1:rn(n,e),on(e),l&512&&(Rt||r===null||Qn(r,r.return)),l&64&&_s&&(e=e.updateQueue,e!==null&&(l=e.callbacks,l!==null&&(r=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=r===null?l:r.concat(l))));break;case 26:var f=Hn;if(rn(n,e),on(e),l&512&&(Rt||r===null||Qn(r,r.return)),l&4){var h=r!==null?r.memoizedState:null;if(l=e.memoizedState,r===null)if(l===null)if(e.stateNode===null){e:{l=e.type,r=e.memoizedProps,f=f.ownerDocument||f;t:switch(l){case"title":h=f.getElementsByTagName("title")[0],(!h||h[wa]||h[Tt]||h.namespaceURI==="http://www.w3.org/2000/svg"||h.hasAttribute("itemprop"))&&(h=f.createElement(l),f.head.insertBefore(h,f.querySelector("head > title"))),Gt(h,l,r),h[Tt]=e,Nt(h),l=h;break e;case"link":var v=kg("link","href",f).get(l+(r.href||""));if(v){for(var w=0;w<v.length;w++)if(h=v[w],h.getAttribute("href")===(r.href==null||r.href===""?null:r.href)&&h.getAttribute("rel")===(r.rel==null?null:r.rel)&&h.getAttribute("title")===(r.title==null?null:r.title)&&h.getAttribute("crossorigin")===(r.crossOrigin==null?null:r.crossOrigin)){v.splice(w,1);break t}}h=f.createElement(l),Gt(h,l,r),f.head.appendChild(h);break;case"meta":if(v=kg("meta","content",f).get(l+(r.content||""))){for(w=0;w<v.length;w++)if(h=v[w],h.getAttribute("content")===(r.content==null?null:""+r.content)&&h.getAttribute("name")===(r.name==null?null:r.name)&&h.getAttribute("property")===(r.property==null?null:r.property)&&h.getAttribute("http-equiv")===(r.httpEquiv==null?null:r.httpEquiv)&&h.getAttribute("charset")===(r.charSet==null?null:r.charSet)){v.splice(w,1);break t}}h=f.createElement(l),Gt(h,l,r),f.head.appendChild(h);break;default:throw Error(i(468,l))}h[Tt]=e,Nt(h),l=h}e.stateNode=l}else wg(f,e.type,e.stateNode);else e.stateNode=Sg(f,l,e.memoizedProps);else h!==l?(h===null?r.stateNode!==null&&(r=r.stateNode,r.parentNode.removeChild(r)):h.count--,l===null?wg(f,e.type,e.stateNode):Sg(f,l,e.memoizedProps)):l===null&&e.stateNode!==null&&Gu(e,e.memoizedProps,r.memoizedProps)}break;case 27:rn(n,e),on(e),l&512&&(Rt||r===null||Qn(r,r.return)),r!==null&&l&4&&Gu(e,e.memoizedProps,r.memoizedProps);break;case 5:if(rn(n,e),on(e),l&512&&(Rt||r===null||Qn(r,r.return)),e.flags&32){f=e.stateNode;try{ti(f,"")}catch(re){ot(e,e.return,re)}}l&4&&e.stateNode!=null&&(f=e.memoizedProps,Gu(e,f,r!==null?r.memoizedProps:f)),l&1024&&(Vu=!0);break;case 6:if(rn(n,e),on(e),l&4){if(e.stateNode===null)throw Error(i(162));l=e.memoizedProps,r=e.stateNode;try{r.nodeValue=l}catch(re){ot(e,e.return,re)}}break;case 3:if(jl=null,f=Hn,Hn=El(n.containerInfo),rn(n,e),Hn=f,on(e),l&4&&r!==null&&r.memoizedState.isDehydrated)try{Mi(n.containerInfo)}catch(re){ot(e,e.return,re)}Vu&&(Vu=!1,wh(e));break;case 4:l=Hn,Hn=El(e.stateNode.containerInfo),rn(n,e),on(e),Hn=l;break;case 12:rn(n,e),on(e);break;case 31:rn(n,e),on(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,ml(e,l)));break;case 13:rn(n,e),on(e),e.child.flags&8192&&e.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(gl=tt()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,ml(e,l)));break;case 22:f=e.memoizedState!==null;var N=r!==null&&r.memoizedState!==null,U=_s,G=Rt;if(_s=U||f,Rt=G||N,rn(n,e),Rt=G,_s=U,on(e),l&8192)e:for(n=e.stateNode,n._visibility=f?n._visibility&-2:n._visibility|1,f&&(r===null||N||_s||Rt||Ia(e)),r=null,n=e;;){if(n.tag===5||n.tag===26){if(r===null){N=r=n;try{if(h=N.stateNode,f)v=h.style,typeof v.setProperty=="function"?v.setProperty("display","none","important"):v.display="none";else{w=N.stateNode;var V=N.memoizedProps.style,I=V!=null&&V.hasOwnProperty("display")?V.display:null;w.style.display=I==null||typeof I=="boolean"?"":(""+I).trim()}}catch(re){ot(N,N.return,re)}}}else if(n.tag===6){if(r===null){N=n;try{N.stateNode.nodeValue=f?"":N.memoizedProps}catch(re){ot(N,N.return,re)}}}else if(n.tag===18){if(r===null){N=n;try{var H=N.stateNode;f?fg(H,!0):fg(N.stateNode,!1)}catch(re){ot(N,N.return,re)}}}else if((n.tag!==22&&n.tag!==23||n.memoizedState===null||n===e)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break e;for(;n.sibling===null;){if(n.return===null||n.return===e)break e;r===n&&(r=null),n=n.return}r===n&&(r=null),n.sibling.return=n.return,n=n.sibling}l&4&&(l=e.updateQueue,l!==null&&(r=l.retryQueue,r!==null&&(l.retryQueue=null,ml(e,r))));break;case 19:rn(n,e),on(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,ml(e,l)));break;case 30:break;case 21:break;default:rn(n,e),on(e)}}function on(e){var n=e.flags;if(n&2){try{for(var r,l=e.return;l!==null;){if(mh(l)){r=l;break}l=l.return}if(r==null)throw Error(i(160));switch(r.tag){case 27:var f=r.stateNode,h=qu(e);pl(e,h,f);break;case 5:var v=r.stateNode;r.flags&32&&(ti(v,""),r.flags&=-33);var w=qu(e);pl(e,w,v);break;case 3:case 4:var N=r.stateNode.containerInfo,U=qu(e);Wu(e,U,N);break;default:throw Error(i(161))}}catch(G){ot(e,e.return,G)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function wh(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var n=e;wh(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),e=e.sibling}}function Ns(e,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)yh(e,n.alternate,n),n=n.sibling}function Ia(e){for(e=e.child;e!==null;){var n=e;switch(n.tag){case 0:case 11:case 14:case 15:ta(4,n,n.return),Ia(n);break;case 1:Qn(n,n.return);var r=n.stateNode;typeof r.componentWillUnmount=="function"&&fh(n,n.return,r),Ia(n);break;case 27:Ur(n.stateNode);case 26:case 5:Qn(n,n.return),Ia(n);break;case 22:n.memoizedState===null&&Ia(n);break;case 30:Ia(n);break;default:Ia(n)}e=e.sibling}}function Es(e,n,r){for(r=r&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var l=n.alternate,f=e,h=n,v=h.flags;switch(h.tag){case 0:case 11:case 15:Es(f,h,r),Er(4,h);break;case 1:if(Es(f,h,r),l=h,f=l.stateNode,typeof f.componentDidMount=="function")try{f.componentDidMount()}catch(U){ot(l,l.return,U)}if(l=h,f=l.updateQueue,f!==null){var w=l.stateNode;try{var N=f.shared.hiddenCallbacks;if(N!==null)for(f.shared.hiddenCallbacks=null,f=0;f<N.length;f++)em(N[f],w)}catch(U){ot(l,l.return,U)}}r&&v&64&&dh(h),Ar(h,h.return);break;case 27:hh(h);case 26:case 5:Es(f,h,r),r&&l===null&&v&4&&ph(h),Ar(h,h.return);break;case 12:Es(f,h,r);break;case 31:Es(f,h,r),r&&v&4&&xh(f,h);break;case 13:Es(f,h,r),r&&v&4&&Sh(f,h);break;case 22:h.memoizedState===null&&Es(f,h,r),Ar(h,h.return);break;case 30:break;default:Es(f,h,r)}n=n.sibling}}function Ku(e,n){var r=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(r=e.memoizedState.cachePool.pool),e=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(e=n.memoizedState.cachePool.pool),e!==r&&(e!=null&&e.refCount++,r!=null&&hr(r))}function Yu(e,n){e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&hr(e))}function Pn(e,n,r,l){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Ch(e,n,r,l),n=n.sibling}function Ch(e,n,r,l){var f=n.flags;switch(n.tag){case 0:case 11:case 15:Pn(e,n,r,l),f&2048&&Er(9,n);break;case 1:Pn(e,n,r,l);break;case 3:Pn(e,n,r,l),f&2048&&(e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&hr(e)));break;case 12:if(f&2048){Pn(e,n,r,l),e=n.stateNode;try{var h=n.memoizedProps,v=h.id,w=h.onPostCommit;typeof w=="function"&&w(v,n.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(N){ot(n,n.return,N)}}else Pn(e,n,r,l);break;case 31:Pn(e,n,r,l);break;case 13:Pn(e,n,r,l);break;case 23:break;case 22:h=n.stateNode,v=n.alternate,n.memoizedState!==null?h._visibility&2?Pn(e,n,r,l):jr(e,n):h._visibility&2?Pn(e,n,r,l):(h._visibility|=2,Si(e,n,r,l,(n.subtreeFlags&10256)!==0||!1)),f&2048&&Ku(v,n);break;case 24:Pn(e,n,r,l),f&2048&&Yu(n.alternate,n);break;default:Pn(e,n,r,l)}}function Si(e,n,r,l,f){for(f=f&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var h=e,v=n,w=r,N=l,U=v.flags;switch(v.tag){case 0:case 11:case 15:Si(h,v,w,N,f),Er(8,v);break;case 23:break;case 22:var G=v.stateNode;v.memoizedState!==null?G._visibility&2?Si(h,v,w,N,f):jr(h,v):(G._visibility|=2,Si(h,v,w,N,f)),f&&U&2048&&Ku(v.alternate,v);break;case 24:Si(h,v,w,N,f),f&&U&2048&&Yu(v.alternate,v);break;default:Si(h,v,w,N,f)}n=n.sibling}}function jr(e,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var r=e,l=n,f=l.flags;switch(l.tag){case 22:jr(r,l),f&2048&&Ku(l.alternate,l);break;case 24:jr(r,l),f&2048&&Yu(l.alternate,l);break;default:jr(r,l)}n=n.sibling}}var Rr=8192;function ki(e,n,r){if(e.subtreeFlags&Rr)for(e=e.child;e!==null;)_h(e,n,r),e=e.sibling}function _h(e,n,r){switch(e.tag){case 26:ki(e,n,r),e.flags&Rr&&e.memoizedState!==null&&pS(r,Hn,e.memoizedState,e.memoizedProps);break;case 5:ki(e,n,r);break;case 3:case 4:var l=Hn;Hn=El(e.stateNode.containerInfo),ki(e,n,r),Hn=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=Rr,Rr=16777216,ki(e,n,r),Rr=l):ki(e,n,r));break;default:ki(e,n,r)}}function Th(e){var n=e.alternate;if(n!==null&&(e=n.child,e!==null)){n.child=null;do n=e.sibling,e.sibling=null,e=n;while(e!==null)}}function Mr(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var r=0;r<n.length;r++){var l=n[r];zt=l,Eh(l,e)}Th(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Nh(e),e=e.sibling}function Nh(e){switch(e.tag){case 0:case 11:case 15:Mr(e),e.flags&2048&&ta(9,e,e.return);break;case 3:Mr(e);break;case 12:Mr(e);break;case 22:var n=e.stateNode;e.memoizedState!==null&&n._visibility&2&&(e.return===null||e.return.tag!==13)?(n._visibility&=-3,hl(e)):Mr(e);break;default:Mr(e)}}function hl(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var r=0;r<n.length;r++){var l=n[r];zt=l,Eh(l,e)}Th(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:ta(8,n,n.return),hl(n);break;case 22:r=n.stateNode,r._visibility&2&&(r._visibility&=-3,hl(n));break;default:hl(n)}e=e.sibling}}function Eh(e,n){for(;zt!==null;){var r=zt;switch(r.tag){case 0:case 11:case 15:ta(8,r,n);break;case 23:case 22:if(r.memoizedState!==null&&r.memoizedState.cachePool!==null){var l=r.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:hr(r.memoizedState.cache)}if(l=r.child,l!==null)l.return=r,zt=l;else e:for(r=e;zt!==null;){l=zt;var f=l.sibling,h=l.return;if(bh(l),l===r){zt=null;break e}if(f!==null){f.return=h,zt=f;break e}zt=h}}}var Ex={getCacheForType:function(e){var n=Pt(Et),r=n.data.get(e);return r===void 0&&(r=e(),n.data.set(e,r)),r},cacheSignal:function(){return Pt(Et).controller.signal}},Ax=typeof WeakMap=="function"?WeakMap:Map,et=0,mt=null,Ue=null,$e=0,rt=0,vn=null,na=!1,wi=!1,Zu=!1,As=0,kt=0,sa=0,$a=0,Qu=0,xn=0,Ci=0,Or=null,ln=null,Xu=!1,gl=0,Ah=0,yl=1/0,bl=null,aa=null,Dt=0,ia=null,_i=null,js=0,Ju=0,ed=null,jh=null,Br=0,td=null;function Sn(){return(et&2)!==0&&$e!==0?$e&-$e:L.T!==null?od():Xi()}function Rh(){if(xn===0)if(($e&536870912)===0||Pe){var e=Ya;Ya<<=1,(Ya&3932160)===0&&(Ya=262144),xn=e}else xn=536870912;return e=yn.current,e!==null&&(e.flags|=32),xn}function cn(e,n,r){(e===mt&&(rt===2||rt===9)||e.cancelPendingCommit!==null)&&(Ti(e,0),ra(e,$e,xn,!1)),ds(e,r),((et&2)===0||e!==mt)&&(e===mt&&((et&2)===0&&($a|=r),kt===4&&ra(e,$e,xn,!1)),Xn(e))}function Mh(e,n,r){if((et&6)!==0)throw Error(i(327));var l=!r&&(n&127)===0&&(n&e.expiredLanes)===0||Fs(e,n),f=l?Mx(e,n):sd(e,n,!0),h=l;do{if(f===0){wi&&!l&&ra(e,n,0,!1);break}else{if(r=e.current.alternate,h&&!jx(r)){f=sd(e,n,!1),h=!1;continue}if(f===2){if(h=n,e.errorRecoveryDisabledLanes&h)var v=0;else v=e.pendingLanes&-536870913,v=v!==0?v:v&536870912?536870912:0;if(v!==0){n=v;e:{var w=e;f=Or;var N=w.current.memoizedState.isDehydrated;if(N&&(Ti(w,v).flags|=256),v=sd(w,v,!1),v!==2){if(Zu&&!N){w.errorRecoveryDisabledLanes|=h,$a|=h,f=4;break e}h=ln,ln=f,h!==null&&(ln===null?ln=h:ln.push.apply(ln,h))}f=v}if(h=!1,f!==2)continue}}if(f===1){Ti(e,0),ra(e,n,0,!0);break}e:{switch(l=e,h=f,h){case 0:case 1:throw Error(i(345));case 4:if((n&4194048)!==n)break;case 6:ra(l,n,xn,!na);break e;case 2:ln=null;break;case 3:case 5:break;default:throw Error(i(329))}if((n&62914560)===n&&(f=gl+300-tt(),10<f)){if(ra(l,n,xn,!na),Za(l,0,!0)!==0)break e;js=n,l.timeoutHandle=cg(Oh.bind(null,l,r,ln,bl,Xu,n,xn,$a,Ci,na,h,"Throttled",-0,0),f);break e}Oh(l,r,ln,bl,Xu,n,xn,$a,Ci,na,h,null,-0,0)}}break}while(!0);Xn(e)}function Oh(e,n,r,l,f,h,v,w,N,U,G,V,I,H){if(e.timeoutHandle=-1,V=n.subtreeFlags,V&8192||(V&16785408)===16785408){V={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:hs},_h(n,h,V);var re=(h&62914560)===h?gl-tt():(h&4194048)===h?Ah-tt():0;if(re=mS(V,re),re!==null){js=h,e.cancelPendingCommit=re(Hh.bind(null,e,n,h,r,l,f,v,w,N,G,V,null,I,H)),ra(e,h,v,!U);return}}Hh(e,n,h,r,l,f,v,w,N)}function jx(e){for(var n=e;;){var r=n.tag;if((r===0||r===11||r===15)&&n.flags&16384&&(r=n.updateQueue,r!==null&&(r=r.stores,r!==null)))for(var l=0;l<r.length;l++){var f=r[l],h=f.getSnapshot;f=f.value;try{if(!hn(h(),f))return!1}catch{return!1}}if(r=n.child,n.subtreeFlags&16384&&r!==null)r.return=n,n=r;else{if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function ra(e,n,r,l){n&=~Qu,n&=~$a,e.suspendedLanes|=n,e.pingedLanes&=~n,l&&(e.warmLanes|=n),l=e.expirationTimes;for(var f=n;0<f;){var h=31-It(f),v=1<<h;l[h]=-1,f&=~v}r!==0&&fs(e,r,n)}function vl(){return(et&6)===0?(Dr(0),!1):!0}function nd(){if(Ue!==null){if(rt===0)var e=Ue.return;else e=Ue,vs=Ra=null,bu(e),gi=null,yr=0,e=Ue;for(;e!==null;)uh(e.alternate,e),e=e.return;Ue=null}}function Ti(e,n){var r=e.timeoutHandle;r!==-1&&(e.timeoutHandle=-1,Zx(r)),r=e.cancelPendingCommit,r!==null&&(e.cancelPendingCommit=null,r()),js=0,nd(),mt=e,Ue=r=ys(e.current,null),$e=n,rt=0,vn=null,na=!1,wi=Fs(e,n),Zu=!1,Ci=xn=Qu=$a=sa=kt=0,ln=Or=null,Xu=!1,(n&8)!==0&&(n|=n&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=n;0<l;){var f=31-It(l),h=1<<f;n|=e[f],l&=~h}return As=n,$o(),r}function Bh(e,n){Re=null,L.H=_r,n===hi||n===Ko?(n=Zp(),rt=3):n===ru?(n=Zp(),rt=4):rt=n===Bu?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,vn=n,Ue===null&&(kt=1,ll(e,Nn(n,e.current)))}function Dh(){var e=yn.current;return e===null?!0:($e&4194048)===$e?Rn===null:($e&62914560)===$e||($e&536870912)!==0?e===Rn:!1}function Lh(){var e=L.H;return L.H=_r,e===null?_r:e}function zh(){var e=L.A;return L.A=Ex,e}function xl(){kt=4,na||($e&4194048)!==$e&&yn.current!==null||(wi=!0),(sa&134217727)===0&&($a&134217727)===0||mt===null||ra(mt,$e,xn,!1)}function sd(e,n,r){var l=et;et|=2;var f=Lh(),h=zh();(mt!==e||$e!==n)&&(bl=null,Ti(e,n)),n=!1;var v=kt;e:do try{if(rt!==0&&Ue!==null){var w=Ue,N=vn;switch(rt){case 8:nd(),v=6;break e;case 3:case 2:case 9:case 6:yn.current===null&&(n=!0);var U=rt;if(rt=0,vn=null,Ni(e,w,N,U),r&&wi){v=0;break e}break;default:U=rt,rt=0,vn=null,Ni(e,w,N,U)}}Rx(),v=kt;break}catch(G){Bh(e,G)}while(!0);return n&&e.shellSuspendCounter++,vs=Ra=null,et=l,L.H=f,L.A=h,Ue===null&&(mt=null,$e=0,$o()),v}function Rx(){for(;Ue!==null;)Uh(Ue)}function Mx(e,n){var r=et;et|=2;var l=Lh(),f=zh();mt!==e||$e!==n?(bl=null,yl=tt()+500,Ti(e,n)):wi=Fs(e,n);e:do try{if(rt!==0&&Ue!==null){n=Ue;var h=vn;t:switch(rt){case 1:rt=0,vn=null,Ni(e,n,h,1);break;case 2:case 9:if(Kp(h)){rt=0,vn=null,Ih(n);break}n=function(){rt!==2&&rt!==9||mt!==e||(rt=7),Xn(e)},h.then(n,n);break e;case 3:rt=7;break e;case 4:rt=5;break e;case 7:Kp(h)?(rt=0,vn=null,Ih(n)):(rt=0,vn=null,Ni(e,n,h,7));break;case 5:var v=null;switch(Ue.tag){case 26:v=Ue.memoizedState;case 5:case 27:var w=Ue;if(v?Cg(v):w.stateNode.complete){rt=0,vn=null;var N=w.sibling;if(N!==null)Ue=N;else{var U=w.return;U!==null?(Ue=U,Sl(U)):Ue=null}break t}}rt=0,vn=null,Ni(e,n,h,5);break;case 6:rt=0,vn=null,Ni(e,n,h,6);break;case 8:nd(),kt=6;break e;default:throw Error(i(462))}}Ox();break}catch(G){Bh(e,G)}while(!0);return vs=Ra=null,L.H=l,L.A=f,et=r,Ue!==null?0:(mt=null,$e=0,$o(),kt)}function Ox(){for(;Ue!==null&&!Ot();)Uh(Ue)}function Uh(e){var n=lh(e.alternate,e,As);e.memoizedProps=e.pendingProps,n===null?Sl(e):Ue=n}function Ih(e){var n=e,r=n.alternate;switch(n.tag){case 15:case 0:n=nh(r,n,n.pendingProps,n.type,void 0,$e);break;case 11:n=nh(r,n,n.pendingProps,n.type.render,n.ref,$e);break;case 5:bu(n);default:uh(r,n),n=Ue=zp(n,As),n=lh(r,n,As)}e.memoizedProps=e.pendingProps,n===null?Sl(e):Ue=n}function Ni(e,n,r,l){vs=Ra=null,bu(n),gi=null,yr=0;var f=n.return;try{if(Sx(e,f,n,r,$e)){kt=1,ll(e,Nn(r,e.current)),Ue=null;return}}catch(h){if(f!==null)throw Ue=f,h;kt=1,ll(e,Nn(r,e.current)),Ue=null;return}n.flags&32768?(Pe||l===1?e=!0:wi||($e&536870912)!==0?e=!1:(na=e=!0,(l===2||l===9||l===3||l===6)&&(l=yn.current,l!==null&&l.tag===13&&(l.flags|=16384))),$h(n,e)):Sl(n)}function Sl(e){var n=e;do{if((n.flags&32768)!==0){$h(n,na);return}e=n.return;var r=Cx(n.alternate,n,As);if(r!==null){Ue=r;return}if(n=n.sibling,n!==null){Ue=n;return}Ue=n=e}while(n!==null);kt===0&&(kt=5)}function $h(e,n){do{var r=_x(e.alternate,e);if(r!==null){r.flags&=32767,Ue=r;return}if(r=e.return,r!==null&&(r.flags|=32768,r.subtreeFlags=0,r.deletions=null),!n&&(e=e.sibling,e!==null)){Ue=e;return}Ue=e=r}while(e!==null);kt=6,Ue=null}function Hh(e,n,r,l,f,h,v,w,N){e.cancelPendingCommit=null;do kl();while(Dt!==0);if((et&6)!==0)throw Error(i(327));if(n!==null){if(n===e.current)throw Error(i(177));if(h=n.lanes|n.childLanes,h|=qc,Eo(e,r,h,v,w,N),e===mt&&(Ue=mt=null,$e=0),_i=n,ia=e,js=r,Ju=h,ed=f,jh=l,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,zx(Hs,function(){return Wh(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||l){l=L.T,L.T=null,f=Z.p,Z.p=2,v=et,et|=4;try{Tx(e,n,r)}finally{et=v,Z.p=f,L.T=l}}Dt=1,Ph(),Fh(),Gh()}}function Ph(){if(Dt===1){Dt=0;var e=ia,n=_i,r=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||r){r=L.T,L.T=null;var l=Z.p;Z.p=2;var f=et;et|=4;try{kh(n,e);var h=hd,v=Ep(e.containerInfo),w=h.focusedElem,N=h.selectionRange;if(v!==w&&w&&w.ownerDocument&&Np(w.ownerDocument.documentElement,w)){if(N!==null&&$c(w)){var U=N.start,G=N.end;if(G===void 0&&(G=U),"selectionStart"in w)w.selectionStart=U,w.selectionEnd=Math.min(G,w.value.length);else{var V=w.ownerDocument||document,I=V&&V.defaultView||window;if(I.getSelection){var H=I.getSelection(),re=w.textContent.length,ye=Math.min(N.start,re),pt=N.end===void 0?ye:Math.min(N.end,re);!H.extend&&ye>pt&&(v=pt,pt=ye,ye=v);var D=Tp(w,ye),R=Tp(w,pt);if(D&&R&&(H.rangeCount!==1||H.anchorNode!==D.node||H.anchorOffset!==D.offset||H.focusNode!==R.node||H.focusOffset!==R.offset)){var z=V.createRange();z.setStart(D.node,D.offset),H.removeAllRanges(),ye>pt?(H.addRange(z),H.extend(R.node,R.offset)):(z.setEnd(R.node,R.offset),H.addRange(z))}}}}for(V=[],H=w;H=H.parentNode;)H.nodeType===1&&V.push({element:H,left:H.scrollLeft,top:H.scrollTop});for(typeof w.focus=="function"&&w.focus(),w=0;w<V.length;w++){var q=V[w];q.element.scrollLeft=q.left,q.element.scrollTop=q.top}}Bl=!!md,hd=md=null}finally{et=f,Z.p=l,L.T=r}}e.current=n,Dt=2}}function Fh(){if(Dt===2){Dt=0;var e=ia,n=_i,r=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||r){r=L.T,L.T=null;var l=Z.p;Z.p=2;var f=et;et|=4;try{yh(e,n.alternate,n)}finally{et=f,Z.p=l,L.T=r}}Dt=3}}function Gh(){if(Dt===4||Dt===3){Dt=0,_t();var e=ia,n=_i,r=js,l=jh;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?Dt=5:(Dt=0,_i=ia=null,qh(e,e.pendingLanes));var f=e.pendingLanes;if(f===0&&(aa=null),Qi(r),n=n.stateNode,Kt&&typeof Kt.onCommitFiberRoot=="function")try{Kt.onCommitFiberRoot(Ps,n,void 0,(n.current.flags&128)===128)}catch{}if(l!==null){n=L.T,f=Z.p,Z.p=2,L.T=null;try{for(var h=e.onRecoverableError,v=0;v<l.length;v++){var w=l[v];h(w.value,{componentStack:w.stack})}}finally{L.T=n,Z.p=f}}(js&3)!==0&&kl(),Xn(e),f=e.pendingLanes,(r&261930)!==0&&(f&42)!==0?e===td?Br++:(Br=0,td=e):Br=0,Dr(0)}}function qh(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,hr(n)))}function kl(){return Ph(),Fh(),Gh(),Wh()}function Wh(){if(Dt!==5)return!1;var e=ia,n=Ju;Ju=0;var r=Qi(js),l=L.T,f=Z.p;try{Z.p=32>r?32:r,L.T=null,r=ed,ed=null;var h=ia,v=js;if(Dt=0,_i=ia=null,js=0,(et&6)!==0)throw Error(i(331));var w=et;if(et|=4,Nh(h.current),Ch(h,h.current,v,r),et=w,Dr(0,!1),Kt&&typeof Kt.onPostCommitFiberRoot=="function")try{Kt.onPostCommitFiberRoot(Ps,h)}catch{}return!0}finally{Z.p=f,L.T=l,qh(e,n)}}function Vh(e,n,r){n=Nn(r,n),n=Ou(e.stateNode,n,2),e=Xs(e,n,2),e!==null&&(ds(e,2),Xn(e))}function ot(e,n,r){if(e.tag===3)Vh(e,e,r);else for(;n!==null;){if(n.tag===3){Vh(n,e,r);break}else if(n.tag===1){var l=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(aa===null||!aa.has(l))){e=Nn(r,e),r=Km(2),l=Xs(n,r,2),l!==null&&(Ym(r,l,n,e),ds(l,2),Xn(l));break}}n=n.return}}function ad(e,n,r){var l=e.pingCache;if(l===null){l=e.pingCache=new Ax;var f=new Set;l.set(n,f)}else f=l.get(n),f===void 0&&(f=new Set,l.set(n,f));f.has(r)||(Zu=!0,f.add(r),e=Bx.bind(null,e,n,r),n.then(e,e))}function Bx(e,n,r){var l=e.pingCache;l!==null&&l.delete(n),e.pingedLanes|=e.suspendedLanes&r,e.warmLanes&=~r,mt===e&&($e&r)===r&&(kt===4||kt===3&&($e&62914560)===$e&&300>tt()-gl?(et&2)===0&&Ti(e,0):Qu|=r,Ci===$e&&(Ci=0)),Xn(e)}function Kh(e,n){n===0&&(n=No()),e=Ea(e,n),e!==null&&(ds(e,n),Xn(e))}function Dx(e){var n=e.memoizedState,r=0;n!==null&&(r=n.retryLane),Kh(e,r)}function Lx(e,n){var r=0;switch(e.tag){case 31:case 13:var l=e.stateNode,f=e.memoizedState;f!==null&&(r=f.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(i(314))}l!==null&&l.delete(n),Kh(e,r)}function zx(e,n){return Ae(e,n)}var wl=null,Ei=null,id=!1,Cl=!1,rd=!1,oa=0;function Xn(e){e!==Ei&&e.next===null&&(Ei===null?wl=Ei=e:Ei=Ei.next=e),Cl=!0,id||(id=!0,Ix())}function Dr(e,n){if(!rd&&Cl){rd=!0;do for(var r=!1,l=wl;l!==null;){if(e!==0){var f=l.pendingLanes;if(f===0)var h=0;else{var v=l.suspendedLanes,w=l.pingedLanes;h=(1<<31-It(42|e)+1)-1,h&=f&~(v&~w),h=h&201326741?h&201326741|1:h?h|2:0}h!==0&&(r=!0,Xh(l,h))}else h=$e,h=Za(l,l===mt?h:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(h&3)===0||Fs(l,h)||(r=!0,Xh(l,h));l=l.next}while(r);rd=!1}}function Ux(){Yh()}function Yh(){Cl=id=!1;var e=0;oa!==0&&Yx()&&(e=oa);for(var n=tt(),r=null,l=wl;l!==null;){var f=l.next,h=Zh(l,n);h===0?(l.next=null,r===null?wl=f:r.next=f,f===null&&(Ei=r)):(r=l,(e!==0||(h&3)!==0)&&(Cl=!0)),l=f}Dt!==0&&Dt!==5||Dr(e),oa!==0&&(oa=0)}function Zh(e,n){for(var r=e.suspendedLanes,l=e.pingedLanes,f=e.expirationTimes,h=e.pendingLanes&-62914561;0<h;){var v=31-It(h),w=1<<v,N=f[v];N===-1?((w&r)===0||(w&l)!==0)&&(f[v]=Qa(w,n)):N<=n&&(e.expiredLanes|=w),h&=~w}if(n=mt,r=$e,r=Za(e,e===n?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,r===0||e===n&&(rt===2||rt===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&ct(l),e.callbackNode=null,e.callbackPriority=0;if((r&3)===0||Fs(e,r)){if(n=r&-r,n===e.callbackPriority)return n;switch(l!==null&&ct(l),Qi(r)){case 2:case 8:r=Va;break;case 32:r=Hs;break;case 268435456:r=Vt;break;default:r=Hs}return l=Qh.bind(null,e),r=Ae(r,l),e.callbackPriority=n,e.callbackNode=r,n}return l!==null&&l!==null&&ct(l),e.callbackPriority=2,e.callbackNode=null,2}function Qh(e,n){if(Dt!==0&&Dt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var r=e.callbackNode;if(kl()&&e.callbackNode!==r)return null;var l=$e;return l=Za(e,e===mt?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(Mh(e,l,n),Zh(e,tt()),e.callbackNode!=null&&e.callbackNode===r?Qh.bind(null,e):null)}function Xh(e,n){if(kl())return null;Mh(e,n,!0)}function Ix(){Qx(function(){(et&6)!==0?Ae($s,Ux):Yh()})}function od(){if(oa===0){var e=pi;e===0&&(e=Ka,Ka<<=1,(Ka&261888)===0&&(Ka=256)),oa=e}return oa}function Jh(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Mo(""+e)}function eg(e,n){var r=n.ownerDocument.createElement("input");return r.name=n.name,r.value=n.value,e.id&&r.setAttribute("form",e.id),n.parentNode.insertBefore(r,n),e=new FormData(e),r.parentNode.removeChild(r),e}function $x(e,n,r,l,f){if(n==="submit"&&r&&r.stateNode===f){var h=Jh((f[$t]||null).action),v=l.submitter;v&&(n=(n=v[$t]||null)?Jh(n.formAction):v.getAttribute("formAction"),n!==null&&(h=n,v=null));var w=new Lo("action","action",null,l,f);e.push({event:w,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(oa!==0){var N=v?eg(f,v):new FormData(f);Nu(r,{pending:!0,data:N,method:f.method,action:h},null,N)}}else typeof h=="function"&&(w.preventDefault(),N=v?eg(f,v):new FormData(f),Nu(r,{pending:!0,data:N,method:f.method,action:h},h,N))},currentTarget:f}]})}}for(var ld=0;ld<Gc.length;ld++){var cd=Gc[ld],Hx=cd.toLowerCase(),Px=cd[0].toUpperCase()+cd.slice(1);$n(Hx,"on"+Px)}$n(Rp,"onAnimationEnd"),$n(Mp,"onAnimationIteration"),$n(Op,"onAnimationStart"),$n("dblclick","onDoubleClick"),$n("focusin","onFocus"),$n("focusout","onBlur"),$n(ax,"onTransitionRun"),$n(ix,"onTransitionStart"),$n(rx,"onTransitionCancel"),$n(Bp,"onTransitionEnd"),pe("onMouseEnter",["mouseout","mouseover"]),pe("onMouseLeave",["mouseout","mouseover"]),pe("onPointerEnter",["pointerout","pointerover"]),pe("onPointerLeave",["pointerout","pointerover"]),X("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),X("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),X("onBeforeInput",["compositionend","keypress","textInput","paste"]),X("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),X("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),X("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Lr="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(" "),Fx=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Lr));function tg(e,n){n=(n&4)!==0;for(var r=0;r<e.length;r++){var l=e[r],f=l.event;l=l.listeners;e:{var h=void 0;if(n)for(var v=l.length-1;0<=v;v--){var w=l[v],N=w.instance,U=w.currentTarget;if(w=w.listener,N!==h&&f.isPropagationStopped())break e;h=w,f.currentTarget=U;try{h(f)}catch(G){Io(G)}f.currentTarget=null,h=N}else for(v=0;v<l.length;v++){if(w=l[v],N=w.instance,U=w.currentTarget,w=w.listener,N!==h&&f.isPropagationStopped())break e;h=w,f.currentTarget=U;try{h(f)}catch(G){Io(G)}f.currentTarget=null,h=N}}}}function Ie(e,n){var r=n[ka];r===void 0&&(r=n[ka]=new Set);var l=e+"__bubble";r.has(l)||(ng(n,e,2,!1),r.add(l))}function ud(e,n,r){var l=0;n&&(l|=4),ng(r,e,l,n)}var _l="_reactListening"+Math.random().toString(36).slice(2);function dd(e){if(!e[_l]){e[_l]=!0,O.forEach(function(r){r!=="selectionchange"&&(Fx.has(r)||ud(r,!1,e),ud(r,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[_l]||(n[_l]=!0,ud("selectionchange",!1,n))}}function ng(e,n,r,l){switch(Rg(n)){case 2:var f=yS;break;case 8:f=bS;break;default:f=Td}r=f.bind(null,n,r,e),f=void 0,!Rc||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(f=!0),l?f!==void 0?e.addEventListener(n,r,{capture:!0,passive:f}):e.addEventListener(n,r,!0):f!==void 0?e.addEventListener(n,r,{passive:f}):e.addEventListener(n,r,!1)}function fd(e,n,r,l,f){var h=l;if((n&1)===0&&(n&2)===0&&l!==null)e:for(;;){if(l===null)return;var v=l.tag;if(v===3||v===4){var w=l.stateNode.containerInfo;if(w===f)break;if(v===4)for(v=l.return;v!==null;){var N=v.tag;if((N===3||N===4)&&v.stateNode.containerInfo===f)return;v=v.return}for(;w!==null;){if(v=Gs(w),v===null)return;if(N=v.tag,N===5||N===6||N===26||N===27){l=h=v;continue e}w=w.parentNode}}l=l.return}op(function(){var U=h,G=Ac(r),V=[];e:{var I=Dp.get(e);if(I!==void 0){var H=Lo,re=e;switch(e){case"keypress":if(Bo(r)===0)break e;case"keydown":case"keyup":H=Lv;break;case"focusin":re="focus",H=Dc;break;case"focusout":re="blur",H=Dc;break;case"beforeblur":case"afterblur":H=Dc;break;case"click":if(r.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":H=up;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":H=Cv;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":H=Iv;break;case Rp:case Mp:case Op:H=Nv;break;case Bp:H=Hv;break;case"scroll":case"scrollend":H=kv;break;case"wheel":H=Fv;break;case"copy":case"cut":case"paste":H=Av;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":H=fp;break;case"toggle":case"beforetoggle":H=qv}var ye=(n&4)!==0,pt=!ye&&(e==="scroll"||e==="scrollend"),D=ye?I!==null?I+"Capture":null:I;ye=[];for(var R=U,z;R!==null;){var q=R;if(z=q.stateNode,q=q.tag,q!==5&&q!==26&&q!==27||z===null||D===null||(q=ar(R,D),q!=null&&ye.push(zr(R,q,z))),pt)break;R=R.return}0<ye.length&&(I=new H(I,re,null,r,G),V.push({event:I,listeners:ye}))}}if((n&7)===0){e:{if(I=e==="mouseover"||e==="pointerover",H=e==="mouseout"||e==="pointerout",I&&r!==Ec&&(re=r.relatedTarget||r.fromElement)&&(Gs(re)||re[Vn]))break e;if((H||I)&&(I=G.window===G?G:(I=G.ownerDocument)?I.defaultView||I.parentWindow:window,H?(re=r.relatedTarget||r.toElement,H=U,re=re?Gs(re):null,re!==null&&(pt=c(re),ye=re.tag,re!==pt||ye!==5&&ye!==27&&ye!==6)&&(re=null)):(H=null,re=U),H!==re)){if(ye=up,q="onMouseLeave",D="onMouseEnter",R="mouse",(e==="pointerout"||e==="pointerover")&&(ye=fp,q="onPointerLeave",D="onPointerEnter",R="pointer"),pt=H==null?I:Ca(H),z=re==null?I:Ca(re),I=new ye(q,R+"leave",H,r,G),I.target=pt,I.relatedTarget=z,q=null,Gs(G)===U&&(ye=new ye(D,R+"enter",re,r,G),ye.target=z,ye.relatedTarget=pt,q=ye),pt=q,H&&re)t:{for(ye=Gx,D=H,R=re,z=0,q=D;q;q=ye(q))z++;q=0;for(var me=R;me;me=ye(me))q++;for(;0<z-q;)D=ye(D),z--;for(;0<q-z;)R=ye(R),q--;for(;z--;){if(D===R||R!==null&&D===R.alternate){ye=D;break t}D=ye(D),R=ye(R)}ye=null}else ye=null;H!==null&&sg(V,I,H,ye,!1),re!==null&&pt!==null&&sg(V,pt,re,ye,!0)}}e:{if(I=U?Ca(U):window,H=I.nodeName&&I.nodeName.toLowerCase(),H==="select"||H==="input"&&I.type==="file")var Ye=xp;else if(bp(I))if(Sp)Ye=tx;else{Ye=Jv;var le=Xv}else H=I.nodeName,!H||H.toLowerCase()!=="input"||I.type!=="checkbox"&&I.type!=="radio"?U&&Nc(U.elementType)&&(Ye=xp):Ye=ex;if(Ye&&(Ye=Ye(e,U))){vp(V,Ye,r,G);break e}le&&le(e,I,U),e==="focusout"&&U&&I.type==="number"&&U.memoizedProps.value!=null&&Tc(I,"number",I.value)}switch(le=U?Ca(U):window,e){case"focusin":(bp(le)||le.contentEditable==="true")&&(ii=le,Hc=U,fr=null);break;case"focusout":fr=Hc=ii=null;break;case"mousedown":Pc=!0;break;case"contextmenu":case"mouseup":case"dragend":Pc=!1,Ap(V,r,G);break;case"selectionchange":if(sx)break;case"keydown":case"keyup":Ap(V,r,G)}var Me;if(zc)e:{switch(e){case"compositionstart":var He="onCompositionStart";break e;case"compositionend":He="onCompositionEnd";break e;case"compositionupdate":He="onCompositionUpdate";break e}He=void 0}else ai?gp(e,r)&&(He="onCompositionEnd"):e==="keydown"&&r.keyCode===229&&(He="onCompositionStart");He&&(pp&&r.locale!=="ko"&&(ai||He!=="onCompositionStart"?He==="onCompositionEnd"&&ai&&(Me=lp()):(qs=G,Mc="value"in qs?qs.value:qs.textContent,ai=!0)),le=Tl(U,He),0<le.length&&(He=new dp(He,e,null,r,G),V.push({event:He,listeners:le}),Me?He.data=Me:(Me=yp(r),Me!==null&&(He.data=Me)))),(Me=Vv?Kv(e,r):Yv(e,r))&&(He=Tl(U,"onBeforeInput"),0<He.length&&(le=new dp("onBeforeInput","beforeinput",null,r,G),V.push({event:le,listeners:He}),le.data=Me)),$x(V,e,U,r,G)}tg(V,n)})}function zr(e,n,r){return{instance:e,listener:n,currentTarget:r}}function Tl(e,n){for(var r=n+"Capture",l=[];e!==null;){var f=e,h=f.stateNode;if(f=f.tag,f!==5&&f!==26&&f!==27||h===null||(f=ar(e,r),f!=null&&l.unshift(zr(e,f,h)),f=ar(e,n),f!=null&&l.push(zr(e,f,h))),e.tag===3)return l;e=e.return}return[]}function Gx(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function sg(e,n,r,l,f){for(var h=n._reactName,v=[];r!==null&&r!==l;){var w=r,N=w.alternate,U=w.stateNode;if(w=w.tag,N!==null&&N===l)break;w!==5&&w!==26&&w!==27||U===null||(N=U,f?(U=ar(r,h),U!=null&&v.unshift(zr(r,U,N))):f||(U=ar(r,h),U!=null&&v.push(zr(r,U,N)))),r=r.return}v.length!==0&&e.push({event:n,listeners:v})}var qx=/\r\n?/g,Wx=/\u0000|\uFFFD/g;function ag(e){return(typeof e=="string"?e:""+e).replace(qx,`
26
- `).replace(Wx,"")}function ig(e,n){return n=ag(n),ag(e)===n}function ft(e,n,r,l,f,h){switch(r){case"children":typeof l=="string"?n==="body"||n==="textarea"&&l===""||ti(e,l):(typeof l=="number"||typeof l=="bigint")&&n!=="body"&&ti(e,""+l);break;case"className":je(e,"class",l);break;case"tabIndex":je(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":je(e,r,l);break;case"style":ip(e,l,h);break;case"data":if(n!=="object"){je(e,"data",l);break}case"src":case"href":if(l===""&&(n!=="a"||r!=="href")){e.removeAttribute(r);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(r);break}l=Mo(""+l),e.setAttribute(r,l);break;case"action":case"formAction":if(typeof l=="function"){e.setAttribute(r,"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 h=="function"&&(r==="formAction"?(n!=="input"&&ft(e,n,"name",f.name,f,null),ft(e,n,"formEncType",f.formEncType,f,null),ft(e,n,"formMethod",f.formMethod,f,null),ft(e,n,"formTarget",f.formTarget,f,null)):(ft(e,n,"encType",f.encType,f,null),ft(e,n,"method",f.method,f,null),ft(e,n,"target",f.target,f,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(r);break}l=Mo(""+l),e.setAttribute(r,l);break;case"onClick":l!=null&&(e.onclick=hs);break;case"onScroll":l!=null&&Ie("scroll",e);break;case"onScrollEnd":l!=null&&Ie("scrollend",e);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(i(61));if(r=l.__html,r!=null){if(f.children!=null)throw Error(i(60));e.innerHTML=r}}break;case"multiple":e.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":e.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){e.removeAttribute("xlink:href");break}r=Mo(""+l),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",r);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(r,""+l):e.removeAttribute(r);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":l&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(r,""):e.removeAttribute(r);break;case"capture":case"download":l===!0?e.setAttribute(r,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(r,l):e.removeAttribute(r);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?e.setAttribute(r,l):e.removeAttribute(r);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?e.removeAttribute(r):e.setAttribute(r,l);break;case"popover":Ie("beforetoggle",e),Ie("toggle",e),ut(e,"popover",l);break;case"xlinkActuate":Yt(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":Yt(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":Yt(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":Yt(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":Yt(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":Yt(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":Yt(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":Yt(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":Yt(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":ut(e,"is",l);break;case"innerText":case"textContent":break;default:(!(2<r.length)||r[0]!=="o"&&r[0]!=="O"||r[1]!=="n"&&r[1]!=="N")&&(r=xv.get(r)||r,ut(e,r,l))}}function pd(e,n,r,l,f,h){switch(r){case"style":ip(e,l,h);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(i(61));if(r=l.__html,r!=null){if(f.children!=null)throw Error(i(60));e.innerHTML=r}}break;case"children":typeof l=="string"?ti(e,l):(typeof l=="number"||typeof l=="bigint")&&ti(e,""+l);break;case"onScroll":l!=null&&Ie("scroll",e);break;case"onScrollEnd":l!=null&&Ie("scrollend",e);break;case"onClick":l!=null&&(e.onclick=hs);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!F.hasOwnProperty(r))e:{if(r[0]==="o"&&r[1]==="n"&&(f=r.endsWith("Capture"),n=r.slice(2,f?r.length-7:void 0),h=e[$t]||null,h=h!=null?h[r]:null,typeof h=="function"&&e.removeEventListener(n,h,f),typeof l=="function")){typeof h!="function"&&h!==null&&(r in e?e[r]=null:e.hasAttribute(r)&&e.removeAttribute(r)),e.addEventListener(n,l,f);break e}r in e?e[r]=l:l===!0?e.setAttribute(r,""):ut(e,r,l)}}}function Gt(e,n,r){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ie("error",e),Ie("load",e);var l=!1,f=!1,h;for(h in r)if(r.hasOwnProperty(h)){var v=r[h];if(v!=null)switch(h){case"src":l=!0;break;case"srcSet":f=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,n));default:ft(e,n,h,v,r,null)}}f&&ft(e,n,"srcSet",r.srcSet,r,null),l&&ft(e,n,"src",r.src,r,null);return;case"input":Ie("invalid",e);var w=h=v=f=null,N=null,U=null;for(l in r)if(r.hasOwnProperty(l)){var G=r[l];if(G!=null)switch(l){case"name":f=G;break;case"type":v=G;break;case"checked":N=G;break;case"defaultChecked":U=G;break;case"value":h=G;break;case"defaultValue":w=G;break;case"children":case"dangerouslySetInnerHTML":if(G!=null)throw Error(i(137,n));break;default:ft(e,n,l,G,r,null)}}tp(e,h,w,N,U,v,f,!1);return;case"select":Ie("invalid",e),l=v=h=null;for(f in r)if(r.hasOwnProperty(f)&&(w=r[f],w!=null))switch(f){case"value":h=w;break;case"defaultValue":v=w;break;case"multiple":l=w;default:ft(e,n,f,w,r,null)}n=h,r=v,e.multiple=!!l,n!=null?ei(e,!!l,n,!1):r!=null&&ei(e,!!l,r,!0);return;case"textarea":Ie("invalid",e),h=f=l=null;for(v in r)if(r.hasOwnProperty(v)&&(w=r[v],w!=null))switch(v){case"value":l=w;break;case"defaultValue":f=w;break;case"children":h=w;break;case"dangerouslySetInnerHTML":if(w!=null)throw Error(i(91));break;default:ft(e,n,v,w,r,null)}sp(e,l,f,h);return;case"option":for(N in r)if(r.hasOwnProperty(N)&&(l=r[N],l!=null))switch(N){case"selected":e.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:ft(e,n,N,l,r,null)}return;case"dialog":Ie("beforetoggle",e),Ie("toggle",e),Ie("cancel",e),Ie("close",e);break;case"iframe":case"object":Ie("load",e);break;case"video":case"audio":for(l=0;l<Lr.length;l++)Ie(Lr[l],e);break;case"image":Ie("error",e),Ie("load",e);break;case"details":Ie("toggle",e);break;case"embed":case"source":case"link":Ie("error",e),Ie("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(U in r)if(r.hasOwnProperty(U)&&(l=r[U],l!=null))switch(U){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,n));default:ft(e,n,U,l,r,null)}return;default:if(Nc(n)){for(G in r)r.hasOwnProperty(G)&&(l=r[G],l!==void 0&&pd(e,n,G,l,r,void 0));return}}for(w in r)r.hasOwnProperty(w)&&(l=r[w],l!=null&&ft(e,n,w,l,r,null))}function Vx(e,n,r,l){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var f=null,h=null,v=null,w=null,N=null,U=null,G=null;for(H in r){var V=r[H];if(r.hasOwnProperty(H)&&V!=null)switch(H){case"checked":break;case"value":break;case"defaultValue":N=V;default:l.hasOwnProperty(H)||ft(e,n,H,null,l,V)}}for(var I in l){var H=l[I];if(V=r[I],l.hasOwnProperty(I)&&(H!=null||V!=null))switch(I){case"type":h=H;break;case"name":f=H;break;case"checked":U=H;break;case"defaultChecked":G=H;break;case"value":v=H;break;case"defaultValue":w=H;break;case"children":case"dangerouslySetInnerHTML":if(H!=null)throw Error(i(137,n));break;default:H!==V&&ft(e,n,I,H,l,V)}}sr(e,v,w,N,U,G,h,f);return;case"select":H=v=w=I=null;for(h in r)if(N=r[h],r.hasOwnProperty(h)&&N!=null)switch(h){case"value":break;case"multiple":H=N;default:l.hasOwnProperty(h)||ft(e,n,h,null,l,N)}for(f in l)if(h=l[f],N=r[f],l.hasOwnProperty(f)&&(h!=null||N!=null))switch(f){case"value":I=h;break;case"defaultValue":w=h;break;case"multiple":v=h;default:h!==N&&ft(e,n,f,h,l,N)}n=w,r=v,l=H,I!=null?ei(e,!!r,I,!1):!!l!=!!r&&(n!=null?ei(e,!!r,n,!0):ei(e,!!r,r?[]:"",!1));return;case"textarea":H=I=null;for(w in r)if(f=r[w],r.hasOwnProperty(w)&&f!=null&&!l.hasOwnProperty(w))switch(w){case"value":break;case"children":break;default:ft(e,n,w,null,l,f)}for(v in l)if(f=l[v],h=r[v],l.hasOwnProperty(v)&&(f!=null||h!=null))switch(v){case"value":I=f;break;case"defaultValue":H=f;break;case"children":break;case"dangerouslySetInnerHTML":if(f!=null)throw Error(i(91));break;default:f!==h&&ft(e,n,v,f,l,h)}np(e,I,H);return;case"option":for(var re in r)if(I=r[re],r.hasOwnProperty(re)&&I!=null&&!l.hasOwnProperty(re))switch(re){case"selected":e.selected=!1;break;default:ft(e,n,re,null,l,I)}for(N in l)if(I=l[N],H=r[N],l.hasOwnProperty(N)&&I!==H&&(I!=null||H!=null))switch(N){case"selected":e.selected=I&&typeof I!="function"&&typeof I!="symbol";break;default:ft(e,n,N,I,l,H)}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 ye in r)I=r[ye],r.hasOwnProperty(ye)&&I!=null&&!l.hasOwnProperty(ye)&&ft(e,n,ye,null,l,I);for(U in l)if(I=l[U],H=r[U],l.hasOwnProperty(U)&&I!==H&&(I!=null||H!=null))switch(U){case"children":case"dangerouslySetInnerHTML":if(I!=null)throw Error(i(137,n));break;default:ft(e,n,U,I,l,H)}return;default:if(Nc(n)){for(var pt in r)I=r[pt],r.hasOwnProperty(pt)&&I!==void 0&&!l.hasOwnProperty(pt)&&pd(e,n,pt,void 0,l,I);for(G in l)I=l[G],H=r[G],!l.hasOwnProperty(G)||I===H||I===void 0&&H===void 0||pd(e,n,G,I,l,H);return}}for(var D in r)I=r[D],r.hasOwnProperty(D)&&I!=null&&!l.hasOwnProperty(D)&&ft(e,n,D,null,l,I);for(V in l)I=l[V],H=r[V],!l.hasOwnProperty(V)||I===H||I==null&&H==null||ft(e,n,V,I,l,H)}function rg(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Kx(){if(typeof performance.getEntriesByType=="function"){for(var e=0,n=0,r=performance.getEntriesByType("resource"),l=0;l<r.length;l++){var f=r[l],h=f.transferSize,v=f.initiatorType,w=f.duration;if(h&&w&&rg(v)){for(v=0,w=f.responseEnd,l+=1;l<r.length;l++){var N=r[l],U=N.startTime;if(U>w)break;var G=N.transferSize,V=N.initiatorType;G&&rg(V)&&(N=N.responseEnd,v+=G*(N<w?1:(w-U)/(N-U)))}if(--l,n+=8*(h+v)/(f.duration/1e3),e++,10<e)break}}if(0<e)return n/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var md=null,hd=null;function Nl(e){return e.nodeType===9?e:e.ownerDocument}function og(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function lg(e,n){if(e===0)switch(n){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&n==="foreignObject"?0:e}function gd(e,n){return e==="textarea"||e==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.children=="bigint"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var yd=null;function Yx(){var e=window.event;return e&&e.type==="popstate"?e===yd?!1:(yd=e,!0):(yd=null,!1)}var cg=typeof setTimeout=="function"?setTimeout:void 0,Zx=typeof clearTimeout=="function"?clearTimeout:void 0,ug=typeof Promise=="function"?Promise:void 0,Qx=typeof queueMicrotask=="function"?queueMicrotask:typeof ug<"u"?function(e){return ug.resolve(null).then(e).catch(Xx)}:cg;function Xx(e){setTimeout(function(){throw e})}function la(e){return e==="head"}function dg(e,n){var r=n,l=0;do{var f=r.nextSibling;if(e.removeChild(r),f&&f.nodeType===8)if(r=f.data,r==="/$"||r==="/&"){if(l===0){e.removeChild(f),Mi(n);return}l--}else if(r==="$"||r==="$?"||r==="$~"||r==="$!"||r==="&")l++;else if(r==="html")Ur(e.ownerDocument.documentElement);else if(r==="head"){r=e.ownerDocument.head,Ur(r);for(var h=r.firstChild;h;){var v=h.nextSibling,w=h.nodeName;h[wa]||w==="SCRIPT"||w==="STYLE"||w==="LINK"&&h.rel.toLowerCase()==="stylesheet"||r.removeChild(h),h=v}}else r==="body"&&Ur(e.ownerDocument.body);r=f}while(r);Mi(n)}function fg(e,n){var r=e;e=0;do{var l=r.nextSibling;if(r.nodeType===1?n?(r._stashedDisplay=r.style.display,r.style.display="none"):(r.style.display=r._stashedDisplay||"",r.getAttribute("style")===""&&r.removeAttribute("style")):r.nodeType===3&&(n?(r._stashedText=r.nodeValue,r.nodeValue=""):r.nodeValue=r._stashedText||""),l&&l.nodeType===8)if(r=l.data,r==="/$"){if(e===0)break;e--}else r!=="$"&&r!=="$?"&&r!=="$~"&&r!=="$!"||e++;r=l}while(r)}function bd(e){var n=e.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var r=n;switch(n=n.nextSibling,r.nodeName){case"HTML":case"HEAD":case"BODY":bd(r),er(r);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(r.rel.toLowerCase()==="stylesheet")continue}e.removeChild(r)}}function Jx(e,n,r,l){for(;e.nodeType===1;){var f=r;if(e.nodeName.toLowerCase()!==n.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[wa])switch(n){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(h=e.getAttribute("rel"),h==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(h!==f.rel||e.getAttribute("href")!==(f.href==null||f.href===""?null:f.href)||e.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin)||e.getAttribute("title")!==(f.title==null?null:f.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(h=e.getAttribute("src"),(h!==(f.src==null?null:f.src)||e.getAttribute("type")!==(f.type==null?null:f.type)||e.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin))&&h&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(n==="input"&&e.type==="hidden"){var h=f.name==null?null:""+f.name;if(f.type==="hidden"&&e.getAttribute("name")===h)return e}else return e;if(e=Mn(e.nextSibling),e===null)break}return null}function eS(e,n,r){if(n==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!r||(e=Mn(e.nextSibling),e===null))return null;return e}function pg(e,n){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Mn(e.nextSibling),e===null))return null;return e}function vd(e){return e.data==="$?"||e.data==="$~"}function xd(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function tS(e,n){var r=e.ownerDocument;if(e.data==="$~")e._reactRetry=n;else if(e.data!=="$?"||r.readyState!=="loading")n();else{var l=function(){n(),r.removeEventListener("DOMContentLoaded",l)};r.addEventListener("DOMContentLoaded",l),e._reactRetry=l}}function Mn(e){for(;e!=null;e=e.nextSibling){var n=e.nodeType;if(n===1||n===3)break;if(n===8){if(n=e.data,n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"||n==="F!"||n==="F")break;if(n==="/$"||n==="/&")return null}}return e}var Sd=null;function mg(e){e=e.nextSibling;for(var n=0;e;){if(e.nodeType===8){var r=e.data;if(r==="/$"||r==="/&"){if(n===0)return Mn(e.nextSibling);n--}else r!=="$"&&r!=="$!"&&r!=="$?"&&r!=="$~"&&r!=="&"||n++}e=e.nextSibling}return null}function hg(e){e=e.previousSibling;for(var n=0;e;){if(e.nodeType===8){var r=e.data;if(r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"){if(n===0)return e;n--}else r!=="/$"&&r!=="/&"||n++}e=e.previousSibling}return null}function gg(e,n,r){switch(n=Nl(r),e){case"html":if(e=n.documentElement,!e)throw Error(i(452));return e;case"head":if(e=n.head,!e)throw Error(i(453));return e;case"body":if(e=n.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function Ur(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);er(e)}var On=new Map,yg=new Set;function El(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Rs=Z.d;Z.d={f:nS,r:sS,D:aS,C:iS,L:rS,m:oS,X:cS,S:lS,M:uS};function nS(){var e=Rs.f(),n=vl();return e||n}function sS(e){var n=ps(e);n!==null&&n.tag===5&&n.type==="form"?Bm(n):Rs.r(e)}var Ai=typeof document>"u"?null:document;function bg(e,n,r){var l=Ai;if(l&&typeof n=="string"&&n){var f=Xt(n);f='link[rel="'+e+'"][href="'+f+'"]',typeof r=="string"&&(f+='[crossorigin="'+r+'"]'),yg.has(f)||(yg.add(f),e={rel:e,crossOrigin:r,href:n},l.querySelector(f)===null&&(n=l.createElement("link"),Gt(n,"link",e),Nt(n),l.head.appendChild(n)))}}function aS(e){Rs.D(e),bg("dns-prefetch",e,null)}function iS(e,n){Rs.C(e,n),bg("preconnect",e,n)}function rS(e,n,r){Rs.L(e,n,r);var l=Ai;if(l&&e&&n){var f='link[rel="preload"][as="'+Xt(n)+'"]';n==="image"&&r&&r.imageSrcSet?(f+='[imagesrcset="'+Xt(r.imageSrcSet)+'"]',typeof r.imageSizes=="string"&&(f+='[imagesizes="'+Xt(r.imageSizes)+'"]')):f+='[href="'+Xt(e)+'"]';var h=f;switch(n){case"style":h=ji(e);break;case"script":h=Ri(e)}On.has(h)||(e=b({rel:"preload",href:n==="image"&&r&&r.imageSrcSet?void 0:e,as:n},r),On.set(h,e),l.querySelector(f)!==null||n==="style"&&l.querySelector(Ir(h))||n==="script"&&l.querySelector($r(h))||(n=l.createElement("link"),Gt(n,"link",e),Nt(n),l.head.appendChild(n)))}}function oS(e,n){Rs.m(e,n);var r=Ai;if(r&&e){var l=n&&typeof n.as=="string"?n.as:"script",f='link[rel="modulepreload"][as="'+Xt(l)+'"][href="'+Xt(e)+'"]',h=f;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":h=Ri(e)}if(!On.has(h)&&(e=b({rel:"modulepreload",href:e},n),On.set(h,e),r.querySelector(f)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(r.querySelector($r(h)))return}l=r.createElement("link"),Gt(l,"link",e),Nt(l),r.head.appendChild(l)}}}function lS(e,n,r){Rs.S(e,n,r);var l=Ai;if(l&&e){var f=Kn(l).hoistableStyles,h=ji(e);n=n||"default";var v=f.get(h);if(!v){var w={loading:0,preload:null};if(v=l.querySelector(Ir(h)))w.loading=5;else{e=b({rel:"stylesheet",href:e,"data-precedence":n},r),(r=On.get(h))&&kd(e,r);var N=v=l.createElement("link");Nt(N),Gt(N,"link",e),N._p=new Promise(function(U,G){N.onload=U,N.onerror=G}),N.addEventListener("load",function(){w.loading|=1}),N.addEventListener("error",function(){w.loading|=2}),w.loading|=4,Al(v,n,l)}v={type:"stylesheet",instance:v,count:1,state:w},f.set(h,v)}}}function cS(e,n){Rs.X(e,n);var r=Ai;if(r&&e){var l=Kn(r).hoistableScripts,f=Ri(e),h=l.get(f);h||(h=r.querySelector($r(f)),h||(e=b({src:e,async:!0},n),(n=On.get(f))&&wd(e,n),h=r.createElement("script"),Nt(h),Gt(h,"link",e),r.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},l.set(f,h))}}function uS(e,n){Rs.M(e,n);var r=Ai;if(r&&e){var l=Kn(r).hoistableScripts,f=Ri(e),h=l.get(f);h||(h=r.querySelector($r(f)),h||(e=b({src:e,async:!0,type:"module"},n),(n=On.get(f))&&wd(e,n),h=r.createElement("script"),Nt(h),Gt(h,"link",e),r.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},l.set(f,h))}}function vg(e,n,r,l){var f=(f=Zt.current)?El(f):null;if(!f)throw Error(i(446));switch(e){case"meta":case"title":return null;case"style":return typeof r.precedence=="string"&&typeof r.href=="string"?(n=ji(r.href),r=Kn(f).hoistableStyles,l=r.get(n),l||(l={type:"style",instance:null,count:0,state:null},r.set(n,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(r.rel==="stylesheet"&&typeof r.href=="string"&&typeof r.precedence=="string"){e=ji(r.href);var h=Kn(f).hoistableStyles,v=h.get(e);if(v||(f=f.ownerDocument||f,v={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},h.set(e,v),(h=f.querySelector(Ir(e)))&&!h._p&&(v.instance=h,v.state.loading=5),On.has(e)||(r={rel:"preload",as:"style",href:r.href,crossOrigin:r.crossOrigin,integrity:r.integrity,media:r.media,hrefLang:r.hrefLang,referrerPolicy:r.referrerPolicy},On.set(e,r),h||dS(f,e,r,v.state))),n&&l===null)throw Error(i(528,""));return v}if(n&&l!==null)throw Error(i(529,""));return null;case"script":return n=r.async,r=r.src,typeof r=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=Ri(r),r=Kn(f).hoistableScripts,l=r.get(n),l||(l={type:"script",instance:null,count:0,state:null},r.set(n,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,e))}}function ji(e){return'href="'+Xt(e)+'"'}function Ir(e){return'link[rel="stylesheet"]['+e+"]"}function xg(e){return b({},e,{"data-precedence":e.precedence,precedence:null})}function dS(e,n,r,l){e.querySelector('link[rel="preload"][as="style"]['+n+"]")?l.loading=1:(n=e.createElement("link"),l.preload=n,n.addEventListener("load",function(){return l.loading|=1}),n.addEventListener("error",function(){return l.loading|=2}),Gt(n,"link",r),Nt(n),e.head.appendChild(n))}function Ri(e){return'[src="'+Xt(e)+'"]'}function $r(e){return"script[async]"+e}function Sg(e,n,r){if(n.count++,n.instance===null)switch(n.type){case"style":var l=e.querySelector('style[data-href~="'+Xt(r.href)+'"]');if(l)return n.instance=l,Nt(l),l;var f=b({},r,{"data-href":r.href,"data-precedence":r.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),Nt(l),Gt(l,"style",f),Al(l,r.precedence,e),n.instance=l;case"stylesheet":f=ji(r.href);var h=e.querySelector(Ir(f));if(h)return n.state.loading|=4,n.instance=h,Nt(h),h;l=xg(r),(f=On.get(f))&&kd(l,f),h=(e.ownerDocument||e).createElement("link"),Nt(h);var v=h;return v._p=new Promise(function(w,N){v.onload=w,v.onerror=N}),Gt(h,"link",l),n.state.loading|=4,Al(h,r.precedence,e),n.instance=h;case"script":return h=Ri(r.src),(f=e.querySelector($r(h)))?(n.instance=f,Nt(f),f):(l=r,(f=On.get(h))&&(l=b({},r),wd(l,f)),e=e.ownerDocument||e,f=e.createElement("script"),Nt(f),Gt(f,"link",l),e.head.appendChild(f),n.instance=f);case"void":return null;default:throw Error(i(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(l=n.instance,n.state.loading|=4,Al(l,r.precedence,e));return n.instance}function Al(e,n,r){for(var l=r.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=l.length?l[l.length-1]:null,h=f,v=0;v<l.length;v++){var w=l[v];if(w.dataset.precedence===n)h=w;else if(h!==f)break}h?h.parentNode.insertBefore(e,h.nextSibling):(n=r.nodeType===9?r.head:r,n.insertBefore(e,n.firstChild))}function kd(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function wd(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var jl=null;function kg(e,n,r){if(jl===null){var l=new Map,f=jl=new Map;f.set(r,l)}else f=jl,l=f.get(r),l||(l=new Map,f.set(r,l));if(l.has(e))return l;for(l.set(e,null),r=r.getElementsByTagName(e),f=0;f<r.length;f++){var h=r[f];if(!(h[wa]||h[Tt]||e==="link"&&h.getAttribute("rel")==="stylesheet")&&h.namespaceURI!=="http://www.w3.org/2000/svg"){var v=h.getAttribute(n)||"";v=e+v;var w=l.get(v);w?w.push(h):l.set(v,[h])}}return l}function wg(e,n,r){e=e.ownerDocument||e,e.head.insertBefore(r,n==="title"?e.querySelector("head > title"):null)}function fS(e,n,r){if(r===1||n.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;switch(n.rel){case"stylesheet":return e=n.disabled,typeof n.precedence=="string"&&e==null;default:return!0}case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function Cg(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function pS(e,n,r,l){if(r.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(r.state.loading&4)===0){if(r.instance===null){var f=ji(l.href),h=n.querySelector(Ir(f));if(h){n=h._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=Rl.bind(e),n.then(e,e)),r.state.loading|=4,r.instance=h,Nt(h);return}h=n.ownerDocument||n,l=xg(l),(f=On.get(f))&&kd(l,f),h=h.createElement("link"),Nt(h);var v=h;v._p=new Promise(function(w,N){v.onload=w,v.onerror=N}),Gt(h,"link",l),r.instance=h}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(r,n),(n=r.state.preload)&&(r.state.loading&3)===0&&(e.count++,r=Rl.bind(e),n.addEventListener("load",r),n.addEventListener("error",r))}}var Cd=0;function mS(e,n){return e.stylesheets&&e.count===0&&Ol(e,e.stylesheets),0<e.count||0<e.imgCount?function(r){var l=setTimeout(function(){if(e.stylesheets&&Ol(e,e.stylesheets),e.unsuspend){var h=e.unsuspend;e.unsuspend=null,h()}},6e4+n);0<e.imgBytes&&Cd===0&&(Cd=62500*Kx());var f=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Ol(e,e.stylesheets),e.unsuspend)){var h=e.unsuspend;e.unsuspend=null,h()}},(e.imgBytes>Cd?50:800)+n);return e.unsuspend=r,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(f)}}:null}function Rl(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Ol(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Ml=null;function Ol(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Ml=new Map,n.forEach(hS,e),Ml=null,Rl.call(e))}function hS(e,n){if(!(n.state.loading&4)){var r=Ml.get(e);if(r)var l=r.get(null);else{r=new Map,Ml.set(e,r);for(var f=e.querySelectorAll("link[data-precedence],style[data-precedence]"),h=0;h<f.length;h++){var v=f[h];(v.nodeName==="LINK"||v.getAttribute("media")!=="not all")&&(r.set(v.dataset.precedence,v),l=v)}l&&r.set(null,l)}f=n.instance,v=f.getAttribute("data-precedence"),h=r.get(v)||l,h===l&&r.set(null,f),r.set(v,f),this.count++,l=Rl.bind(this),f.addEventListener("load",l),f.addEventListener("error",l),h?h.parentNode.insertBefore(f,h.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(f,e.firstChild)),n.state.loading|=4}}var Hr={$$typeof:B,Provider:null,Consumer:null,_currentValue:W,_currentValue2:W,_threadCount:0};function gS(e,n,r,l,f,h,v,w,N){this.tag=1,this.containerInfo=e,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=Xa(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Xa(0),this.hiddenUpdates=Xa(null),this.identifierPrefix=l,this.onUncaughtError=f,this.onCaughtError=h,this.onRecoverableError=v,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=N,this.incompleteTransitions=new Map}function _g(e,n,r,l,f,h,v,w,N,U,G,V){return e=new gS(e,n,r,v,N,U,G,V,w),n=1,h===!0&&(n|=24),h=gn(3,null,null,n),e.current=h,h.stateNode=e,n=su(),n.refCount++,e.pooledCache=n,n.refCount++,h.memoizedState={element:l,isDehydrated:r,cache:n},ou(h),e}function Tg(e){return e?(e=li,e):li}function Ng(e,n,r,l,f,h){f=Tg(f),l.context===null?l.context=f:l.pendingContext=f,l=Qs(n),l.payload={element:r},h=h===void 0?null:h,h!==null&&(l.callback=h),r=Xs(e,l,n),r!==null&&(cn(r,e,n),vr(r,e,n))}function Eg(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var r=e.retryLane;e.retryLane=r!==0&&r<n?r:n}}function _d(e,n){Eg(e,n),(e=e.alternate)&&Eg(e,n)}function Ag(e){if(e.tag===13||e.tag===31){var n=Ea(e,67108864);n!==null&&cn(n,e,67108864),_d(e,67108864)}}function jg(e){if(e.tag===13||e.tag===31){var n=Sn();n=Sa(n);var r=Ea(e,n);r!==null&&cn(r,e,n),_d(e,n)}}var Bl=!0;function yS(e,n,r,l){var f=L.T;L.T=null;var h=Z.p;try{Z.p=2,Td(e,n,r,l)}finally{Z.p=h,L.T=f}}function bS(e,n,r,l){var f=L.T;L.T=null;var h=Z.p;try{Z.p=8,Td(e,n,r,l)}finally{Z.p=h,L.T=f}}function Td(e,n,r,l){if(Bl){var f=Nd(l);if(f===null)fd(e,n,l,Dl,r),Mg(e,l);else if(xS(f,e,n,r,l))l.stopPropagation();else if(Mg(e,l),n&4&&-1<vS.indexOf(e)){for(;f!==null;){var h=ps(f);if(h!==null)switch(h.tag){case 3:if(h=h.stateNode,h.current.memoizedState.isDehydrated){var v=Un(h.pendingLanes);if(v!==0){var w=h;for(w.pendingLanes|=2,w.entangledLanes|=2;v;){var N=1<<31-It(v);w.entanglements[1]|=N,v&=~N}Xn(h),(et&6)===0&&(yl=tt()+500,Dr(0))}}break;case 31:case 13:w=Ea(h,2),w!==null&&cn(w,h,2),vl(),_d(h,2)}if(h=Nd(l),h===null&&fd(e,n,l,Dl,r),h===f)break;f=h}f!==null&&l.stopPropagation()}else fd(e,n,l,null,r)}}function Nd(e){return e=Ac(e),Ed(e)}var Dl=null;function Ed(e){if(Dl=null,e=Gs(e),e!==null){var n=c(e);if(n===null)e=null;else{var r=n.tag;if(r===13){if(e=u(n),e!==null)return e;e=null}else if(r===31){if(e=d(n),e!==null)return e;e=null}else if(r===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;e=null}else n!==e&&(e=null)}}return Dl=e,null}function Rg(e){switch(e){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(nn()){case $s:return 2;case Va:return 8;case Hs:case Co:return 32;case Vt:return 268435456;default:return 32}default:return 32}}var Ad=!1,ca=null,ua=null,da=null,Pr=new Map,Fr=new Map,fa=[],vS="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 Mg(e,n){switch(e){case"focusin":case"focusout":ca=null;break;case"dragenter":case"dragleave":ua=null;break;case"mouseover":case"mouseout":da=null;break;case"pointerover":case"pointerout":Pr.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":Fr.delete(n.pointerId)}}function Gr(e,n,r,l,f,h){return e===null||e.nativeEvent!==h?(e={blockedOn:n,domEventName:r,eventSystemFlags:l,nativeEvent:h,targetContainers:[f]},n!==null&&(n=ps(n),n!==null&&Ag(n)),e):(e.eventSystemFlags|=l,n=e.targetContainers,f!==null&&n.indexOf(f)===-1&&n.push(f),e)}function xS(e,n,r,l,f){switch(n){case"focusin":return ca=Gr(ca,e,n,r,l,f),!0;case"dragenter":return ua=Gr(ua,e,n,r,l,f),!0;case"mouseover":return da=Gr(da,e,n,r,l,f),!0;case"pointerover":var h=f.pointerId;return Pr.set(h,Gr(Pr.get(h)||null,e,n,r,l,f)),!0;case"gotpointercapture":return h=f.pointerId,Fr.set(h,Gr(Fr.get(h)||null,e,n,r,l,f)),!0}return!1}function Og(e){var n=Gs(e.target);if(n!==null){var r=c(n);if(r!==null){if(n=r.tag,n===13){if(n=u(r),n!==null){e.blockedOn=n,Ji(e.priority,function(){jg(r)});return}}else if(n===31){if(n=d(r),n!==null){e.blockedOn=n,Ji(e.priority,function(){jg(r)});return}}else if(n===3&&r.stateNode.current.memoizedState.isDehydrated){e.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Ll(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var r=Nd(e.nativeEvent);if(r===null){r=e.nativeEvent;var l=new r.constructor(r.type,r);Ec=l,r.target.dispatchEvent(l),Ec=null}else return n=ps(r),n!==null&&Ag(n),e.blockedOn=r,!1;n.shift()}return!0}function Bg(e,n,r){Ll(e)&&r.delete(n)}function SS(){Ad=!1,ca!==null&&Ll(ca)&&(ca=null),ua!==null&&Ll(ua)&&(ua=null),da!==null&&Ll(da)&&(da=null),Pr.forEach(Bg),Fr.forEach(Bg)}function zl(e,n){e.blockedOn===n&&(e.blockedOn=null,Ad||(Ad=!0,a.unstable_scheduleCallback(a.unstable_NormalPriority,SS)))}var Ul=null;function Dg(e){Ul!==e&&(Ul=e,a.unstable_scheduleCallback(a.unstable_NormalPriority,function(){Ul===e&&(Ul=null);for(var n=0;n<e.length;n+=3){var r=e[n],l=e[n+1],f=e[n+2];if(typeof l!="function"){if(Ed(l||r)===null)continue;break}var h=ps(r);h!==null&&(e.splice(n,3),n-=3,Nu(h,{pending:!0,data:f,method:r.method,action:l},l,f))}}))}function Mi(e){function n(N){return zl(N,e)}ca!==null&&zl(ca,e),ua!==null&&zl(ua,e),da!==null&&zl(da,e),Pr.forEach(n),Fr.forEach(n);for(var r=0;r<fa.length;r++){var l=fa[r];l.blockedOn===e&&(l.blockedOn=null)}for(;0<fa.length&&(r=fa[0],r.blockedOn===null);)Og(r),r.blockedOn===null&&fa.shift();if(r=(e.ownerDocument||e).$$reactFormReplay,r!=null)for(l=0;l<r.length;l+=3){var f=r[l],h=r[l+1],v=f[$t]||null;if(typeof h=="function")v||Dg(r);else if(v){var w=null;if(h&&h.hasAttribute("formAction")){if(f=h,v=h[$t]||null)w=v.formAction;else if(Ed(f)!==null)continue}else w=v.action;typeof w=="function"?r[l+1]=w:(r.splice(l,3),l-=3),Dg(r)}}}function Lg(){function e(h){h.canIntercept&&h.info==="react-transition"&&h.intercept({handler:function(){return new Promise(function(v){return f=v})},focusReset:"manual",scroll:"manual"})}function n(){f!==null&&(f(),f=null),l||setTimeout(r,20)}function r(){if(!l&&!navigation.transition){var h=navigation.currentEntry;h&&h.url!=null&&navigation.navigate(h.url,{state:h.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,f=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(r,100),function(){l=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),f!==null&&(f(),f=null)}}}function jd(e){this._internalRoot=e}Il.prototype.render=jd.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(i(409));var r=n.current,l=Sn();Ng(r,l,e,n,null,null)},Il.prototype.unmount=jd.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;Ng(e.current,2,null,e,null,null),vl(),n[Vn]=null}};function Il(e){this._internalRoot=e}Il.prototype.unstable_scheduleHydration=function(e){if(e){var n=Xi();e={blockedOn:null,target:e,priority:n};for(var r=0;r<fa.length&&n!==0&&n<fa[r].priority;r++);fa.splice(r,0,e),r===0&&Og(e)}};var zg=t.version;if(zg!=="19.2.7")throw Error(i(527,zg,"19.2.7"));Z.findDOMNode=function(e){var n=e._reactInternals;if(n===void 0)throw typeof e.render=="function"?Error(i(188)):(e=Object.keys(e).join(","),Error(i(268,e)));return e=g(n),e=e!==null?y(e):null,e=e===null?null:e.stateNode,e};var kS={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:L,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var $l=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!$l.isDisabled&&$l.supportsFiber)try{Ps=$l.inject(kS),Kt=$l}catch{}}return qr.createRoot=function(e,n){if(!o(e))throw Error(i(299));var r=!1,l="",f=Gm,h=qm,v=Wm;return n!=null&&(n.unstable_strictMode===!0&&(r=!0),n.identifierPrefix!==void 0&&(l=n.identifierPrefix),n.onUncaughtError!==void 0&&(f=n.onUncaughtError),n.onCaughtError!==void 0&&(h=n.onCaughtError),n.onRecoverableError!==void 0&&(v=n.onRecoverableError)),n=_g(e,1,!1,null,null,r,l,null,f,h,v,Lg),e[Vn]=n.current,dd(e),new jd(n)},qr.hydrateRoot=function(e,n,r){if(!o(e))throw Error(i(299));var l=!1,f="",h=Gm,v=qm,w=Wm,N=null;return r!=null&&(r.unstable_strictMode===!0&&(l=!0),r.identifierPrefix!==void 0&&(f=r.identifierPrefix),r.onUncaughtError!==void 0&&(h=r.onUncaughtError),r.onCaughtError!==void 0&&(v=r.onCaughtError),r.onRecoverableError!==void 0&&(w=r.onRecoverableError),r.formState!==void 0&&(N=r.formState)),n=_g(e,1,!0,n,r??null,l,f,N,h,v,w,Lg),n.context=Tg(null),r=n.current,l=Sn(),l=Sa(l),f=Qs(l),f.callback=null,Xs(r,f,l),r=l,n.current.lanes=r,ds(n,r),Xn(n),e[Vn]=n.current,dd(e),new Il(n)},qr.version="19.2.7",qr}var qg;function x0(){if(qg)return Rd.exports;qg=1;function a(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(t){console.error(t)}}return a(),Rd.exports=v0(),Rd.exports}var S0=x0();const k0=Uf(S0),w0="modulepreload",C0=function(a){return"/"+a},Wg={},un=function(t,s,i){let o=Promise.resolve();if(s&&s.length>0){let u=function(g){return Promise.all(g.map(y=>Promise.resolve(y).then(b=>({status:"fulfilled",value:b}),b=>({status:"rejected",reason:b}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),p=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));o=u(s.map(g=>{if(g=C0(g),g in Wg)return;Wg[g]=!0;const y=g.endsWith(".css"),b=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${g}"]${b}`))return;const x=document.createElement("link");if(x.rel=y?"stylesheet":w0,y||(x.as="script"),x.crossOrigin="",x.href=g,p&&x.setAttribute("nonce",p),document.head.appendChild(x),y)return new Promise((S,k)=>{x.addEventListener("load",S),x.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${g}`)))})}))}function c(u){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=u,window.dispatchEvent(d),!d.defaultPrevented)throw u}return o.then(u=>{for(const d of u||[])d.status==="rejected"&&c(d.reason);return t().catch(c)})},xe=a=>typeof a=="string",Wr=()=>{let a,t;const s=new Promise((i,o)=>{a=i,t=o});return s.resolve=a,s.reject=t,s},Vg=a=>a==null?"":String(a),_0=(a,t,s)=>{a.forEach(i=>{t[i]&&(s[i]=t[i])})},T0=/###/g,Kg=a=>a&&a.includes("###")?a.replace(T0,"."):a,Yg=a=>!a||xe(a),io=(a,t,s)=>{const i=xe(t)?t.split("."):t;let o=0;for(;o<i.length-1;){if(Yg(a))return{};const c=Kg(i[o]);!a[c]&&s&&(a[c]=new s),Object.prototype.hasOwnProperty.call(a,c)?a=a[c]:a={},++o}return Yg(a)?{}:{obj:a,k:Kg(i[o])}},Zg=(a,t,s)=>{const{obj:i,k:o}=io(a,t,Object);if(i!==void 0||t.length===1){i[o]=s;return}let c=t[t.length-1],u=t.slice(0,t.length-1),d=io(a,u,Object);for(;d.obj===void 0&&u.length;)c=`${u[u.length-1]}.${c}`,u=u.slice(0,u.length-1),d=io(a,u,Object),d!=null&&d.obj&&typeof d.obj[`${d.k}.${c}`]<"u"&&(d.obj=void 0);d.obj[`${d.k}.${c}`]=s},N0=(a,t,s,i)=>{const{obj:o,k:c}=io(a,t,Object);o[c]=o[c]||[],o[c].push(s)},nc=(a,t)=>{const{obj:s,k:i}=io(a,t);if(s&&Object.prototype.hasOwnProperty.call(s,i))return s[i]},E0=(a,t,s)=>{const i=nc(a,s);return i!==void 0?i:nc(t,s)},Ob=(a,t,s)=>{for(const i in t)i!=="__proto__"&&i!=="constructor"&&(Object.prototype.hasOwnProperty.call(a,i)?xe(a[i])||a[i]instanceof String||xe(t[i])||t[i]instanceof String?s&&(a[i]=t[i]):Ob(a[i],t[i],s):a[i]=t[i]);return a},Ms=a=>a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),A0={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"},j0=a=>xe(a)?a.replace(/[&<>"'\/]/g,t=>A0[t]):a;class R0{constructor(t){this.capacity=t,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(t){const s=this.regExpMap.get(t);if(s!==void 0)return s;const i=new RegExp(t);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(t,i),this.regExpQueue.push(t),i}}const M0=[" ",",","?","!",";"],O0=new R0(20),B0=(a,t,s)=>{t=t||"",s=s||"";const i=M0.filter(u=>!t.includes(u)&&!s.includes(u));if(i.length===0)return!0;const o=O0.getRegExp(`(${i.map(u=>u==="?"?"\\?":u).join("|")})`);let c=!o.test(a);if(!c){const u=a.indexOf(s);u>0&&!o.test(a.substring(0,u))&&(c=!0)}return c},uf=(a,t,s=".")=>{if(!a)return;if(a[t])return Object.prototype.hasOwnProperty.call(a,t)?a[t]:void 0;const i=t.split(s);let o=a;for(let c=0;c<i.length;){if(!o||typeof o!="object")return;let u,d="";for(let p=c;p<i.length;++p)if(p!==c&&(d+=s),d+=i[p],u=o[d],u!==void 0){if(["string","number","boolean"].includes(typeof u)&&p<i.length-1)continue;c+=p-c+1;break}o=u}return o},ho=a=>a==null?void 0:a.replace(/_/g,"-"),D0={type:"logger",log(a){this.output("log",a)},warn(a){this.output("warn",a)},error(a){this.output("error",a)},output(a,t){var s,i;(i=(s=console==null?void 0:console[a])==null?void 0:s.apply)==null||i.call(s,console,t)}};class sc{constructor(t,s={}){this.init(t,s)}init(t,s={}){this.prefix=s.prefix||"i18next:",this.logger=t||D0,this.options=s,this.debug=s.debug}log(...t){return this.forward(t,"log","",!0)}warn(...t){return this.forward(t,"warn","",!0)}error(...t){return this.forward(t,"error","")}deprecate(...t){return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}forward(t,s,i,o){return o&&!this.debug?null:(t=t.map(c=>xe(c)?c.replace(/[\r\n\x00-\x1F\x7F]/g," "):c),xe(t[0])&&(t[0]=`${i}${this.prefix} ${t[0]}`),this.logger[s](t))}create(t){return new sc(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new sc(this.logger,t)}}var ts=new sc;class bc{constructor(){this.observers={}}on(t,s){return t.split(" ").forEach(i=>{this.observers[i]||(this.observers[i]=new Map);const o=this.observers[i].get(s)||0;this.observers[i].set(s,o+1)}),this}off(t,s){if(this.observers[t]){if(!s){delete this.observers[t];return}this.observers[t].delete(s)}}once(t,s){const i=(...o)=>{s(...o),this.off(t,i)};return this.on(t,i),this}emit(t,...s){this.observers[t]&&Array.from(this.observers[t].entries()).forEach(([o,c])=>{for(let u=0;u<c;u++)o(...s)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([o,c])=>{for(let u=0;u<c;u++)o(t,...s)})}}class Qg extends bc{constructor(t,s={ns:["translation"],defaultNS:"translation"}){super(),this.data=t||{},this.options=s,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.includes(t)||this.options.ns.push(t)}removeNamespaces(t){const s=this.options.ns.indexOf(t);s>-1&&this.options.ns.splice(s,1)}getResource(t,s,i,o={}){var g,y;const c=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator,u=o.ignoreJSONStructure!==void 0?o.ignoreJSONStructure:this.options.ignoreJSONStructure;let d;t.includes(".")?d=t.split("."):(d=[t,s],i&&(Array.isArray(i)?d.push(...i):xe(i)&&c?d.push(...i.split(c)):d.push(i)));const p=nc(this.data,d);return!p&&!s&&!i&&t.includes(".")&&(t=d[0],s=d[1],i=d.slice(2).join(".")),p||!u||!xe(i)?p:uf((y=(g=this.data)==null?void 0:g[t])==null?void 0:y[s],i,c)}addResource(t,s,i,o,c={silent:!1}){const u=c.keySeparator!==void 0?c.keySeparator:this.options.keySeparator;let d=[t,s];i&&(d=d.concat(u?i.split(u):i)),t.includes(".")&&(d=t.split("."),o=s,s=d[1]),this.addNamespaces(s),Zg(this.data,d,o),c.silent||this.emit("added",t,s,i,o)}addResources(t,s,i,o={silent:!1}){for(const c in i)(xe(i[c])||Array.isArray(i[c]))&&this.addResource(t,s,c,i[c],{silent:!0});o.silent||this.emit("added",t,s,i)}addResourceBundle(t,s,i,o,c,u={silent:!1,skipCopy:!1}){let d=[t,s];t.includes(".")&&(d=t.split("."),o=i,i=s,s=d[1]),this.addNamespaces(s);let p=nc(this.data,d)||{};u.skipCopy||(i=JSON.parse(JSON.stringify(i))),o?Ob(p,i,c):p={...p,...i},Zg(this.data,d,p),u.silent||this.emit("added",t,s,i)}removeResourceBundle(t,s){this.hasResourceBundle(t,s)&&delete this.data[t][s],this.removeNamespaces(s),this.emit("removed",t,s)}hasResourceBundle(t,s){return this.getResource(t,s)!==void 0}getResourceBundle(t,s){return s||(s=this.options.defaultNS),this.getResource(t,s)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const s=this.getDataByLanguage(t);return!!(s&&Object.keys(s)||[]).find(o=>s[o]&&Object.keys(s[o]).length>0)}toJSON(){return this.data}}var Bb={processors:{},addPostProcessor(a){this.processors[a.name]=a},handle(a,t,s,i,o){return a.forEach(c=>{var u;t=((u=this.processors[c])==null?void 0:u.process(t,s,i,o))??t}),t}};const Db=Symbol("i18next/PATH_KEY");function L0(){const a=[],t=Object.create(null);let s;return t.get=(i,o)=>{var c;return(c=s==null?void 0:s.revoke)==null||c.call(s),o===Db?a:(a.push(o),s=Proxy.revocable(i,t),s.proxy)},Proxy.revocable(Object.create(null),t).proxy}function Hi(a,t){const{[Db]:s}=a(L0()),i=(t==null?void 0:t.keySeparator)??".",o=(t==null?void 0:t.nsSeparator)??":",c=(t==null?void 0:t.enableSelector)==="strict";if(s.length>1&&o){const u=t==null?void 0:t.ns,d=c?Array.isArray(u)?u:u?[u]:null:Array.isArray(u)?u:null;if(d&&(c?d:d.length>1?d.slice(1):[]).includes(s[0]))return`${s[0]}${o}${s.slice(1).join(i)}`}return s.join(i)}const Bd=a=>!xe(a)&&typeof a!="boolean"&&typeof a!="number";class ac extends bc{constructor(t,s={}){super(),_0(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=s,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=ts.create("translator"),this.checkedLoadedFor={}}changeLanguage(t){t&&(this.language=t)}exists(t,s={interpolation:{}}){const i={...s};if(t==null)return!1;const o=this.resolve(t,i);if((o==null?void 0:o.res)===void 0)return!1;const c=Bd(o.res);return!(i.returnObjects===!1&&c)}extractFromKey(t,s){let i=s.nsSeparator!==void 0?s.nsSeparator:this.options.nsSeparator;i===void 0&&(i=":");const o=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator;let c=s.ns||this.options.defaultNS||[];const u=i&&t.includes(i),d=!this.options.userDefinedKeySeparator&&!s.keySeparator&&!this.options.userDefinedNsSeparator&&!s.nsSeparator&&!B0(t,i,o);if(u&&!d){const p=t.match(this.interpolator.nestingRegexp);if(p&&p.length>0)return{key:t,namespaces:xe(c)?[c]:c};const g=t.split(i);(i!==o||i===o&&this.options.ns.includes(g[0]))&&(c=g.shift()),t=g.join(o)}return{key:t,namespaces:xe(c)?[c]:c}}translate(t,s,i){let o=typeof s=="object"?{...s}:s;if(typeof o!="object"&&this.options.overloadTranslationOptionHandler&&(o=this.options.overloadTranslationOptionHandler(arguments)),typeof o=="object"&&(o={...o}),o||(o={}),t==null)return"";typeof t=="function"&&(t=Hi(t,{...this.options,...o})),Array.isArray(t)||(t=[String(t)]),t=t.map(K=>typeof K=="function"?Hi(K,{...this.options,...o}):String(K));const c=o.returnDetails!==void 0?o.returnDetails:this.options.returnDetails,u=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator,{key:d,namespaces:p}=this.extractFromKey(t[t.length-1],o),g=p[p.length-1];let y=o.nsSeparator!==void 0?o.nsSeparator:this.options.nsSeparator;y===void 0&&(y=":");const b=o.lng||this.language,x=o.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((b==null?void 0:b.toLowerCase())==="cimode")return x?c?{res:`${g}${y}${d}`,usedKey:d,exactUsedKey:d,usedLng:b,usedNS:g,usedParams:this.getUsedParamsDetails(o)}:`${g}${y}${d}`:c?{res:d,usedKey:d,exactUsedKey:d,usedLng:b,usedNS:g,usedParams:this.getUsedParamsDetails(o)}:d;const S=this.resolve(t,o);let k=S==null?void 0:S.res;const C=(S==null?void 0:S.usedKey)||d,T=(S==null?void 0:S.exactUsedKey)||d,E=["[object Number]","[object Function]","[object RegExp]"],A=o.joinArrays!==void 0?o.joinArrays:this.options.joinArrays,B=!this.i18nFormat||this.i18nFormat.handleAsObject,M=o.count!==void 0&&!xe(o.count),j=ac.hasDefaultValue(o),J=M?this.pluralResolver.getSuffix(b,o.count,o):"",Y=o.ordinal&&M?this.pluralResolver.getSuffix(b,o.count,{ordinal:!1}):"",te=M&&!o.ordinal&&o.count===0,se=te&&o[`defaultValue${this.options.pluralSeparator}zero`]||o[`defaultValue${J}`]||o[`defaultValue${Y}`]||o.defaultValue;let ge=k;B&&!k&&j&&(ge=se);const Ke=Bd(ge),de=Object.prototype.toString.apply(ge);if(B&&ge&&Ke&&!E.includes(de)&&!(xe(A)&&Array.isArray(ge))){if(!o.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const K=this.options.returnedObjectHandler?this.options.returnedObjectHandler(C,ge,{...o,ns:p}):`key '${d} (${this.language})' returned an object instead of string.`;return c?(S.res=K,S.usedParams=this.getUsedParamsDetails(o),S):K}if(u){const K=Array.isArray(ge),ne=K?[]:{},he=K?T:C;for(const L in ge)if(Object.prototype.hasOwnProperty.call(ge,L)){const Z=`${he}${u}${L}`;j&&!k?ne[L]=this.translate(Z,{...o,defaultValue:Bd(se)?se[L]:void 0,joinArrays:!1,ns:p}):ne[L]=this.translate(Z,{...o,joinArrays:!1,ns:p}),ne[L]===Z&&(ne[L]=ge[L])}k=ne}}else if(B&&xe(A)&&Array.isArray(k))k=k.join(A),k&&(k=this.extendTranslation(k,t,o,i));else{let K=!1,ne=!1;!this.isValidLookup(k)&&j&&(K=!0,k=se),this.isValidLookup(k)||(ne=!0,k=d);const L=(o.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&ne?void 0:k,Z=j&&se!==k&&this.options.updateMissing;if(ne||K||Z){if(this.logger.log(Z?"updateKey":"missingKey",b,g,M&&!Z?`${d}${this.pluralResolver.getSuffix(b,o.count,o)}`:d,Z?se:k),u){const ze=this.resolve(d,{...o,keySeparator:!1});ze&&ze.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let W=[];const Be=this.languageUtils.getFallbackCodes(this.options.fallbackLng,o.lng||this.language);if(this.options.saveMissingTo==="fallback"&&Be&&Be[0])for(let ze=0;ze<Be.length;ze++)W.push(Be[ze]);else this.options.saveMissingTo==="all"?W=this.languageUtils.toResolveHierarchy(o.lng||this.language):W.push(o.lng||this.language);const Le=(ze,Ee,ke)=>{var lt;const st=j&&ke!==k?ke:L;this.options.missingKeyHandler?this.options.missingKeyHandler(ze,g,Ee,st,Z,o):(lt=this.backendConnector)!=null&&lt.saveMissing&&this.backendConnector.saveMissing(ze,g,Ee,st,Z,o),this.emit("missingKey",ze,g,Ee,k)};this.options.saveMissing&&(this.options.saveMissingPlurals&&M?W.forEach(ze=>{const Ee=this.pluralResolver.getSuffixes(ze,o);te&&o[`defaultValue${this.options.pluralSeparator}zero`]&&!Ee.includes(`${this.options.pluralSeparator}zero`)&&Ee.push(`${this.options.pluralSeparator}zero`),Ee.forEach(ke=>{Le([ze],d+ke,o[`defaultValue${ke}`]||se)})}):Le(W,d,se))}k=this.extendTranslation(k,t,o,S,i),ne&&k===d&&this.options.appendNamespaceToMissingKey&&(k=`${g}${y}${d}`),(ne||K)&&this.options.parseMissingKeyHandler&&(k=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${g}${y}${d}`:d,K?k:void 0,o))}return c?(S.res=k,S.usedParams=this.getUsedParamsDetails(o),S):k}extendTranslation(t,s,i,o,c){var p,g;if((p=this.i18nFormat)!=null&&p.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...i},i.lng||this.language||o.usedLng,o.usedNS,o.usedKey,{resolved:o});else if(!i.skipInterpolation){i.interpolation&&this.interpolator.init({...i,interpolation:{...this.options.interpolation,...i.interpolation}});const y=xe(t)&&(((g=i==null?void 0:i.interpolation)==null?void 0:g.skipOnVariables)!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let b;if(y){const S=t.match(this.interpolator.nestingRegexp);b=S&&S.length}let x=i.replace&&!xe(i.replace)?i.replace:i;if(this.options.interpolation.defaultVariables&&(x={...this.options.interpolation.defaultVariables,...x}),t=this.interpolator.interpolate(t,x,i.lng||this.language||o.usedLng,i),y){const S=t.match(this.interpolator.nestingRegexp),k=S&&S.length;b<k&&(i.nest=!1)}!i.lng&&o&&o.res&&(i.lng=this.language||o.usedLng),i.nest!==!1&&(t=this.interpolator.nest(t,(...S)=>(c==null?void 0:c[0])===S[0]&&!i.context?(this.logger.warn(`It seems you are nesting recursively key: ${S[0]} in key: ${s[0]}`),null):this.translate(...S,s),i)),i.interpolation&&this.interpolator.reset()}const u=i.postProcess||this.options.postProcess,d=xe(u)?[u]:u;return t!=null&&(d!=null&&d.length)&&i.applyPostProcessor!==!1&&(t=Bb.handle(d,t,s,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...o,usedParams:this.getUsedParamsDetails(i)},...i}:i,this)),t}resolve(t,s={}){let i,o,c,u,d;return xe(t)&&(t=[t]),Array.isArray(t)&&(t=t.map(p=>typeof p=="function"?Hi(p,{...this.options,...s}):p)),t.forEach(p=>{if(this.isValidLookup(i))return;const g=this.extractFromKey(p,s),y=g.key;o=y;let b=g.namespaces;this.options.fallbackNS&&(b=b.concat(this.options.fallbackNS));const x=s.count!==void 0&&!xe(s.count),S=x&&!s.ordinal&&s.count===0,k=s.context!==void 0&&(xe(s.context)||typeof s.context=="number")&&s.context!=="",C=s.lngs?s.lngs:this.languageUtils.toResolveHierarchy(s.lng||this.language,s.fallbackLng);b.forEach(T=>{var E,A;this.isValidLookup(i)||(d=T,!this.checkedLoadedFor[`${C[0]}-${T}`]&&((E=this.utils)!=null&&E.hasLoadedNamespace)&&!((A=this.utils)!=null&&A.hasLoadedNamespace(d))&&(this.checkedLoadedFor[`${C[0]}-${T}`]=!0,this.logger.warn(`key "${o}" for languages "${C.join(", ")}" won't get resolved as namespace "${d}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),C.forEach(B=>{var J;if(this.isValidLookup(i))return;u=B;const M=[y];if((J=this.i18nFormat)!=null&&J.addLookupKeys)this.i18nFormat.addLookupKeys(M,y,B,T,s);else{let Y;x&&(Y=this.pluralResolver.getSuffix(B,s.count,s));const te=`${this.options.pluralSeparator}zero`,se=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(x&&(s.ordinal&&Y.startsWith(se)&&M.push(y+Y.replace(se,this.options.pluralSeparator)),M.push(y+Y),S&&M.push(y+te)),k){const ge=`${y}${this.options.contextSeparator||"_"}${s.context}`;M.push(ge),x&&(s.ordinal&&Y.startsWith(se)&&M.push(ge+Y.replace(se,this.options.pluralSeparator)),M.push(ge+Y),S&&M.push(ge+te))}}let j;for(;j=M.pop();)this.isValidLookup(i)||(c=j,i=this.getResource(B,T,j,s))}))})}),{res:i,usedKey:o,exactUsedKey:c,usedLng:u,usedNS:d}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,s,i,o={}){var c;return(c=this.i18nFormat)!=null&&c.getResource?this.i18nFormat.getResource(t,s,i,o):this.resourceStore.getResource(t,s,i,o)}getUsedParamsDetails(t={}){const s=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],i=t.replace&&!xe(t.replace);let o=i?t.replace:t;if(i&&typeof t.count<"u"&&(o={...o,count:t.count}),this.options.interpolation.defaultVariables&&(o={...this.options.interpolation.defaultVariables,...o}),!i){o={...o};for(const c of s)delete o[c]}return o}static hasDefaultValue(t){const s="defaultValue";for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)&&i.startsWith(s)&&t[i]!==void 0)return!0;return!1}}class Xg{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=ts.create("languageUtils")}getScriptPartFromCode(t){if(t=ho(t),!t||!t.includes("-"))return null;const s=t.split("-");return s.length===2||(s.pop(),s[s.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(s.join("-"))}getLanguagePartFromCode(t){if(t=ho(t),!t||!t.includes("-"))return t;const s=t.split("-");return this.formatLanguageCode(s[0])}formatLanguageCode(t){if(xe(t)&&t.includes("-")){let s;try{s=Intl.getCanonicalLocales(t)[0]}catch{}return s&&this.options.lowerCaseLng&&(s=s.toLowerCase()),s||(this.options.lowerCaseLng?t.toLowerCase():t)}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.includes(t)}getBestMatchFromCodes(t){if(!t)return null;let s;return t.forEach(i=>{if(s)return;const o=this.formatLanguageCode(i);(!this.options.supportedLngs||this.isSupportedCode(o))&&(s=o)}),!s&&this.options.supportedLngs&&t.forEach(i=>{if(s)return;const o=this.getScriptPartFromCode(i);if(this.isSupportedCode(o))return s=o;const c=this.getLanguagePartFromCode(i);if(this.isSupportedCode(c))return s=c;s=this.options.supportedLngs.find(u=>u===c?!0:!u.includes("-")&&!c.includes("-")?!1:!!(u.includes("-")&&!c.includes("-")&&u.slice(0,u.indexOf("-"))===c||u.startsWith(c)&&c.length>1))}),s||(s=this.getFallbackCodes(this.options.fallbackLng)[0]),s}getFallbackCodes(t,s){if(!t)return[];if(typeof t=="function"&&(t=t(s)),xe(t)&&(t=[t]),Array.isArray(t))return t;if(!s)return t.default||[];let i=t[s];return i||(i=t[this.getScriptPartFromCode(s)]),i||(i=t[this.formatLanguageCode(s)]),i||(i=t[this.getLanguagePartFromCode(s)]),i||(i=t.default),i||[]}toResolveHierarchy(t,s){const i=this.getFallbackCodes((s===!1?[]:s)||this.options.fallbackLng||[],t),o=[],c=u=>{u&&(this.isSupportedCode(u)?o.push(u):this.logger.warn(`rejecting language code not found in supportedLngs: ${u}`))};return xe(t)&&(t.includes("-")||t.includes("_"))?(this.options.load!=="languageOnly"&&c(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&c(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&c(this.getLanguagePartFromCode(t))):xe(t)&&c(this.formatLanguageCode(t)),i.forEach(u=>{o.includes(u)||c(this.formatLanguageCode(u))}),o}}const Jg={zero:0,one:1,two:2,few:3,many:4,other:5},ey={select:a=>a===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class z0{constructor(t,s={}){this.languageUtils=t,this.options=s,this.logger=ts.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(t,s={}){const i=ho(t==="dev"?"en":t),o=s.ordinal?"ordinal":"cardinal",c=JSON.stringify({cleanedCode:i,type:o});if(c in this.pluralRulesCache)return this.pluralRulesCache[c];let u;try{u=new Intl.PluralRules(i,{type:o})}catch{if(typeof Intl>"u")return this.logger.error("No Intl support, please use an Intl polyfill!"),ey;if(!t.match(/-|_/))return ey;const p=this.languageUtils.getLanguagePartFromCode(t);u=this.getRule(p,s)}return this.pluralRulesCache[c]=u,u}needsPlural(t,s={}){let i=this.getRule(t,s);return i||(i=this.getRule("dev",s)),(i==null?void 0:i.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(t,s,i={}){return this.getSuffixes(t,i).map(o=>`${s}${o}`)}getSuffixes(t,s={}){let i=this.getRule(t,s);return i||(i=this.getRule("dev",s)),i?i.resolvedOptions().pluralCategories.sort((o,c)=>Jg[o]-Jg[c]).map(o=>`${this.options.prepend}${s.ordinal?`ordinal${this.options.prepend}`:""}${o}`):[]}getSuffix(t,s,i={}){const o=this.getRule(t,i);return o?`${this.options.prepend}${i.ordinal?`ordinal${this.options.prepend}`:""}${o.select(s)}`:(this.logger.warn(`no plural rule found for: ${t}`),this.getSuffix("dev",s,i))}}const ty=(a,t,s,i=".",o=!0)=>{let c=E0(a,t,s);return!c&&o&&xe(s)&&(c=uf(a,s,i),c===void 0&&(c=uf(t,s,i))),c},U0=a=>a.replace(/\$/g,"$$$$");class ny{constructor(t={}){var s;this.logger=ts.create("interpolator"),this.options=t,this.format=((s=t==null?void 0:t.interpolation)==null?void 0:s.format)||(i=>i),this.init(t)}init(t={}){t.interpolation||(t.interpolation={escapeValue:!0});const{escape:s,escapeValue:i,useRawValueToEscape:o,prefix:c,prefixEscaped:u,suffix:d,suffixEscaped:p,formatSeparator:g,unescapeSuffix:y,unescapePrefix:b,nestingPrefix:x,nestingPrefixEscaped:S,nestingSuffix:k,nestingSuffixEscaped:C,nestingOptionsSeparator:T,maxReplaces:E,alwaysFormat:A}=t.interpolation;this.escape=s!==void 0?s:j0,this.escapeValue=i!==void 0?i:!0,this.useRawValueToEscape=o!==void 0?o:!1,this.prefix=c?Ms(c):u||"{{",this.suffix=d?Ms(d):p||"}}",this.formatSeparator=g||",",this.unescapePrefix=y?"":b?Ms(b):"-",this.unescapeSuffix=this.unescapePrefix?"":y?Ms(y):"",this.nestingPrefix=x?Ms(x):S||Ms("$t("),this.nestingSuffix=k?Ms(k):C||Ms(")"),this.nestingOptionsSeparator=T||",",this.maxReplaces=E||1e3,this.alwaysFormat=A!==void 0?A:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=(s,i)=>(s==null?void 0:s.source)===i?(s.lastIndex=0,s):new RegExp(i,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(t,s,i,o){var S;let c,u,d;const p=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},g=k=>{if(!k.includes(this.formatSeparator)){const A=ty(s,p,k,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(A,void 0,i,{...o,...s,interpolationkey:k}):A}const C=k.split(this.formatSeparator),T=C.shift().trim(),E=C.join(this.formatSeparator).trim();return this.format(ty(s,p,T,this.options.keySeparator,this.options.ignoreJSONStructure),E,i,{...o,...s,interpolationkey:T})};this.resetRegExp(),!this.escapeValue&&typeof t=="string"&&/\$t\([^)]*\{[^}]*\{\{/.test(t)&&this.logger.warn("nesting options string contains interpolated variables with escapeValue: false — if any of those values are attacker-controlled they can inject additional nesting options (e.g. redirect lng/ns). Sanitise untrusted input before passing it to t(), or keep escapeValue: true.");const y=(o==null?void 0:o.missingInterpolationHandler)||this.options.missingInterpolationHandler,b=((S=o==null?void 0:o.interpolation)==null?void 0:S.skipOnVariables)!==void 0?o.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:k=>k},{regex:this.regexp,safeValue:k=>this.escapeValue?this.escape(k):k}].forEach(k=>{for(d=0;c=k.regex.exec(t);){const C=c[1].trim();if(u=g(C),u===void 0)if(typeof y=="function"){const E=y(t,c,o);u=xe(E)?E:""}else if(o&&Object.prototype.hasOwnProperty.call(o,C))u="";else if(b){u=c[0];continue}else this.logger.warn(`missed to pass in variable ${C} for interpolating ${t}`),u="";else!xe(u)&&!this.useRawValueToEscape&&(u=Vg(u));const T=k.safeValue(u);if(t=t.replace(c[0],U0(T)),b?(k.regex.lastIndex+=T.length,k.regex.lastIndex-=c[0].length):k.regex.lastIndex=0,d++,d>=this.maxReplaces)break}}),t}nest(t,s,i={}){let o,c,u;const d=(p,g)=>{const y=this.nestingOptionsSeparator;if(!p.includes(y))return p;const b=p.split(new RegExp(`${Ms(y)}[ ]*{`));let x=`{${b[1]}`;p=b[0],x=this.interpolate(x,u);const S=x.match(/'/g),k=x.match(/"/g);(((S==null?void 0:S.length)??0)%2===0&&!k||((k==null?void 0:k.length)??0)%2!==0)&&(x=x.replace(/'/g,'"'));try{u=JSON.parse(x),g&&(u={...g,...u})}catch(C){return this.logger.warn(`failed parsing options string in nesting for key ${p}`,C),`${p}${y}${x}`}return u.defaultValue&&u.defaultValue.includes(this.prefix)&&delete u.defaultValue,p};for(;o=this.nestingRegexp.exec(t);){let p=[];u={...i},u=u.replace&&!xe(u.replace)?u.replace:u,u.applyPostProcessor=!1,delete u.defaultValue;const g=/{.*}/s.test(o[1])?o[1].lastIndexOf("}")+1:o[1].indexOf(this.formatSeparator);if(g!==-1&&(p=o[1].slice(g).split(this.formatSeparator).map(y=>y.trim()).filter(Boolean),o[1]=o[1].slice(0,g)),c=s(d.call(this,o[1].trim(),u),u),c&&o[0]===t&&!xe(c))return c;xe(c)||(c=Vg(c)),c||(this.logger.warn(`missed to resolve ${o[1]} for nesting ${t}`),c=""),p.length&&(c=p.reduce((y,b)=>this.format(y,b,i.lng,{...i,interpolationkey:o[1].trim()}),c.trim())),t=t.replace(o[0],c),this.regexp.lastIndex=0}return t}}const I0=a=>{let t=a.toLowerCase().trim();const s={};if(a.includes("(")){const i=a.split("(");t=i[0].toLowerCase().trim();const o=i[1].slice(0,-1);t==="currency"&&!o.includes(":")?s.currency||(s.currency=o.trim()):t==="relativetime"&&!o.includes(":")?s.range||(s.range=o.trim()):o.split(";").forEach(u=>{if(u){const[d,...p]=u.split(":"),g=p.join(":").trim().replace(/^'+|'+$/g,""),y=d.trim();s[y]||(s[y]=g),g==="false"&&(s[y]=!1),g==="true"&&(s[y]=!0),isNaN(g)||(s[y]=parseInt(g,10))}})}return{formatName:t,formatOptions:s}},sy=a=>{const t={};return(s,i,o)=>{let c=o;o&&o.interpolationkey&&o.formatParams&&o.formatParams[o.interpolationkey]&&o[o.interpolationkey]&&(c={...c,[o.interpolationkey]:void 0});const u=i+JSON.stringify(c);let d=t[u];return d||(d=a(ho(i),o),t[u]=d),d(s)}},$0=a=>(t,s,i)=>a(ho(s),i)(t);class H0{constructor(t={}){this.logger=ts.create("formatter"),this.options=t,this.init(t)}init(t,s={interpolation:{}}){this.formatSeparator=s.interpolation.formatSeparator||",";const i=s.cacheInBuiltFormats?sy:$0;this.formats={number:i((o,c)=>{const u=new Intl.NumberFormat(o,{...c});return d=>u.format(d)}),currency:i((o,c)=>{const u=new Intl.NumberFormat(o,{...c,style:"currency"});return d=>u.format(d)}),datetime:i((o,c)=>{const u=new Intl.DateTimeFormat(o,{...c});return d=>u.format(d)}),relativetime:i((o,c)=>{const u=new Intl.RelativeTimeFormat(o,{...c});return d=>u.format(d,c.range||"day")}),list:i((o,c)=>{const u=new Intl.ListFormat(o,{...c});return d=>u.format(d)})}}add(t,s){this.formats[t.toLowerCase().trim()]=s}addCached(t,s){this.formats[t.toLowerCase().trim()]=sy(s)}format(t,s,i,o={}){if(!s||t==null)return t;const c=s.split(this.formatSeparator),u=[];for(let p=0;p<c.length;p++){let g=c[p];for(;g.indexOf("(")>-1&&!g.includes(")")&&p+1<c.length;)g=`${g}${this.formatSeparator}${c[++p]}`;u.push(g)}return u.reduce((p,g)=>{var x;const{formatName:y,formatOptions:b}=I0(g);if(this.formats[y]){let S=p;try{const k=((x=o==null?void 0:o.formatParams)==null?void 0:x[o.interpolationkey])||{},C=k.locale||k.lng||o.locale||o.lng||i;S=this.formats[y](p,C,{...b,...o,...k})}catch(k){this.logger.warn(k)}return S}else this.logger.warn(`there was no format function for ${y}`);return p},t)}}const P0=(a,t)=>{a.pending[t]!==void 0&&(delete a.pending[t],a.pendingCount--)};class F0 extends bc{constructor(t,s,i,o={}){var c,u;super(),this.backend=t,this.store=s,this.services=i,this.languageUtils=i.languageUtils,this.options=o,this.logger=ts.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=o.maxParallelReads||10,this.readingCalls=0,this.maxRetries=o.maxRetries>=0?o.maxRetries:5,this.retryTimeout=o.retryTimeout>=1?o.retryTimeout:350,this.state={},this.queue=[],(u=(c=this.backend)==null?void 0:c.init)==null||u.call(c,i,o.backend,o)}queueLoad(t,s,i,o){const c={},u={},d={},p={};return t.forEach(g=>{let y=!0;s.forEach(b=>{const x=`${g}|${b}`;!i.reload&&this.store.hasResourceBundle(g,b)?this.state[x]=2:this.state[x]<0||(this.state[x]===1?u[x]===void 0&&(u[x]=!0):(this.state[x]=1,y=!1,u[x]===void 0&&(u[x]=!0),c[x]===void 0&&(c[x]=!0),p[b]===void 0&&(p[b]=!0)))}),y||(d[g]=!0)}),(Object.keys(c).length||Object.keys(u).length)&&this.queue.push({pending:u,pendingCount:Object.keys(u).length,loaded:{},errors:[],callback:o}),{toLoad:Object.keys(c),pending:Object.keys(u),toLoadLanguages:Object.keys(d),toLoadNamespaces:Object.keys(p)}}loaded(t,s,i){const o=t.split("|"),c=o[0],u=o[1];s&&this.emit("failedLoading",c,u,s),!s&&i&&this.store.addResourceBundle(c,u,i,void 0,void 0,{skipCopy:!0}),this.state[t]=s?-1:2,s&&i&&(this.state[t]=0);const d={};this.queue.forEach(p=>{N0(p.loaded,[c],u),P0(p,t),s&&p.errors.push(s),p.pendingCount===0&&!p.done&&(Object.keys(p.loaded).forEach(g=>{d[g]||(d[g]={});const y=p.loaded[g];y.length&&y.forEach(b=>{d[g][b]===void 0&&(d[g][b]=!0)})}),p.done=!0,p.errors.length?p.callback(p.errors):p.callback())}),this.emit("loaded",d),this.queue=this.queue.filter(p=>!p.done)}read(t,s,i,o=0,c=this.retryTimeout,u){if(!t.length)return u(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:s,fcName:i,tried:o,wait:c,callback:u});return}this.readingCalls++;const d=(g,y)=>{if(this.readingCalls--,this.waitingReads.length>0){const b=this.waitingReads.shift();this.read(b.lng,b.ns,b.fcName,b.tried,b.wait,b.callback)}if(g&&y&&o<this.maxRetries){setTimeout(()=>{this.read(t,s,i,o+1,c*2,u)},c);return}u(g,y)},p=this.backend[i].bind(this.backend);if(p.length===2){try{const g=p(t,s);g&&typeof g.then=="function"?g.then(y=>d(null,y)).catch(d):d(null,g)}catch(g){d(g)}return}return p(t,s,d)}prepareLoading(t,s,i={},o){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),o&&o();xe(t)&&(t=this.languageUtils.toResolveHierarchy(t)),xe(s)&&(s=[s]);const c=this.queueLoad(t,s,i,o);if(!c.toLoad.length)return c.pending.length||o(),null;c.toLoad.forEach(u=>{this.loadOne(u)})}load(t,s,i){this.prepareLoading(t,s,{},i)}reload(t,s,i){this.prepareLoading(t,s,{reload:!0},i)}loadOne(t,s=""){const i=t.split("|"),o=i[0],c=i[1];this.read(o,c,"read",void 0,void 0,(u,d)=>{u&&this.logger.warn(`${s}loading namespace ${c} for language ${o} failed`,u),!u&&d&&this.logger.log(`${s}loaded namespace ${c} for language ${o}`,d),this.loaded(t,u,d)})}saveMissing(t,s,i,o,c,u={},d=()=>{}){var p,g,y,b,x;if((g=(p=this.services)==null?void 0:p.utils)!=null&&g.hasLoadedNamespace&&!((b=(y=this.services)==null?void 0:y.utils)!=null&&b.hasLoadedNamespace(s))){this.logger.warn(`did not save key "${i}" as the namespace "${s}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(i==null||i==="")){if((x=this.backend)!=null&&x.create){const S={...u,isUpdate:c},k=this.backend.create.bind(this.backend);if(k.length<6)try{let C;k.length===5?C=k(t,s,i,o,S):C=k(t,s,i,o),C&&typeof C.then=="function"?C.then(T=>d(null,T)).catch(d):d(null,C)}catch(C){d(C)}else k(t,s,i,o,d,S)}!t||!t[0]||this.store.addResource(t[0],s,i,o)}}}const Dd=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",enableSelector:!1,partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:a=>{let t={};if(typeof a[1]=="object"&&(t=a[1]),xe(a[1])&&(t.defaultValue=a[1]),xe(a[2])&&(t.tDescription=a[2]),typeof a[2]=="object"||typeof a[3]=="object"){const s=a[3]||a[2];Object.keys(s).forEach(i=>{t[i]=s[i]})}return t},interpolation:{escapeValue:!0,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),ay=a=>(xe(a.ns)&&(a.ns=[a.ns]),xe(a.fallbackLng)&&(a.fallbackLng=[a.fallbackLng]),xe(a.fallbackNS)&&(a.fallbackNS=[a.fallbackNS]),a.supportedLngs&&!a.supportedLngs.includes("cimode")&&(a.supportedLngs=a.supportedLngs.concat(["cimode"])),a),Hl=()=>{},G0=a=>{Object.getOwnPropertyNames(Object.getPrototypeOf(a)).forEach(s=>{typeof a[s]=="function"&&(a[s]=a[s].bind(a))})};class ro extends bc{constructor(t={},s){if(super(),this.options=ay(t),this.services={},this.logger=ts,this.modules={external:[]},G0(this),s&&!this.isInitialized&&!t.isClone){if(!this.options.initAsync)return this.init(t,s),this;setTimeout(()=>{this.init(t,s)},0)}}init(t={},s){this.isInitializing=!0,typeof t=="function"&&(s=t,t={}),t.defaultNS==null&&t.ns&&(xe(t.ns)?t.defaultNS=t.ns:t.ns.includes("translation")||(t.defaultNS=t.ns[0]));const i=Dd();this.options={...i,...this.options,...ay(t)},this.options.interpolation={...i.interpolation,...this.options.interpolation},t.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=t.keySeparator),t.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=t.nsSeparator),typeof this.options.overloadTranslationOptionHandler!="function"&&(this.options.overloadTranslationOptionHandler=i.overloadTranslationOptionHandler);const o=g=>g?typeof g=="function"?new g:g:null;if(!this.options.isClone){this.modules.logger?ts.init(o(this.modules.logger),this.options):ts.init(null,this.options);let g;this.modules.formatter?g=this.modules.formatter:g=H0;const y=new Xg(this.options);this.store=new Qg(this.options.resources,this.options);const b=this.services;b.logger=ts,b.resourceStore=this.store,b.languageUtils=y,b.pluralResolver=new z0(y,{prepend:this.options.pluralSeparator}),g&&(b.formatter=o(g),b.formatter.init&&b.formatter.init(b,this.options),this.options.interpolation.format=b.formatter.format.bind(b.formatter)),b.interpolator=new ny(this.options),b.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},b.backendConnector=new F0(o(this.modules.backend),b.resourceStore,b,this.options),b.backendConnector.on("*",(x,...S)=>{this.emit(x,...S)}),this.modules.languageDetector&&(b.languageDetector=o(this.modules.languageDetector),b.languageDetector.init&&b.languageDetector.init(b,this.options.detection,this.options)),this.modules.i18nFormat&&(b.i18nFormat=o(this.modules.i18nFormat),b.i18nFormat.init&&b.i18nFormat.init(this)),this.translator=new ac(this.services,this.options),this.translator.on("*",(x,...S)=>{this.emit(x,...S)}),this.modules.external.forEach(x=>{x.init&&x.init(this)})}if(this.format=this.options.interpolation.format,s||(s=Hl),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const g=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);g.length>0&&g[0]!=="dev"&&(this.options.lng=g[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(g=>{this[g]=(...y)=>this.store[g](...y)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(g=>{this[g]=(...y)=>(this.store[g](...y),this)});const d=Wr(),p=()=>{const g=(y,b)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),d.resolve(b),s(y,b)};if((this.languages||this.isLanguageChangingTo)&&!this.isInitialized)return g(null,this.t.bind(this));this.changeLanguage(this.options.lng,g)};return this.options.resources||!this.options.initAsync?p():setTimeout(p,0),d}loadResources(t,s=Hl){var c,u;let i=s;const o=xe(t)?t:this.language;if(typeof t=="function"&&(i=t),!this.options.resources||this.options.partialBundledLanguages){if((o==null?void 0:o.toLowerCase())==="cimode"&&(!this.options.preload||this.options.preload.length===0))return i();const d=[],p=g=>{if(!g||g==="cimode")return;this.services.languageUtils.toResolveHierarchy(g).forEach(b=>{b!=="cimode"&&(d.includes(b)||d.push(b))})};o?p(o):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(y=>p(y)),(u=(c=this.options.preload)==null?void 0:c.forEach)==null||u.call(c,g=>p(g)),this.services.backendConnector.load(d,this.options.ns,g=>{!g&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),i(g)})}else i(null)}reloadResources(t,s,i){const o=Wr();return typeof t=="function"&&(i=t,t=void 0),typeof s=="function"&&(i=s,s=void 0),t||(t=this.languages),s||(s=this.options.ns),i||(i=Hl),this.services.backendConnector.reload(t,s,c=>{o.resolve(),i(c)}),o}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&Bb.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!["cimode","dev"].includes(t)){for(let s=0;s<this.languages.length;s++){const i=this.languages[s];if(!["cimode","dev"].includes(i)&&this.store.hasLanguageSomeTranslations(i)){this.resolvedLanguage=i;break}}!this.resolvedLanguage&&!this.languages.includes(t)&&this.store.hasLanguageSomeTranslations(t)&&(this.resolvedLanguage=t,this.languages.unshift(t))}}changeLanguage(t,s){this.isLanguageChangingTo=t;const i=Wr();this.emit("languageChanging",t);const o=d=>{this.language=d,this.languages=this.services.languageUtils.toResolveHierarchy(d),this.resolvedLanguage=void 0,this.setResolvedLanguage(d)},c=(d,p)=>{p?this.isLanguageChangingTo===t&&(o(p),this.translator.changeLanguage(p),this.isLanguageChangingTo=void 0,this.emit("languageChanged",p),this.logger.log("languageChanged",p)):this.isLanguageChangingTo=void 0,i.resolve((...g)=>this.t(...g)),s&&s(d,(...g)=>this.t(...g))},u=d=>{var y,b;!t&&!d&&this.services.languageDetector&&(d=[]);const p=xe(d)?d:d&&d[0],g=this.store.hasLanguageSomeTranslations(p)?p:this.services.languageUtils.getBestMatchFromCodes(xe(d)?[d]:d);g&&(this.language||o(g),this.translator.language||this.translator.changeLanguage(g),(b=(y=this.services.languageDetector)==null?void 0:y.cacheUserLanguage)==null||b.call(y,g)),this.loadResources(g,x=>{c(x,g)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?u(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(u):this.services.languageDetector.detect(u):u(t),i}getFixedT(t,s,i,o){const c=o==null?void 0:o.scopeNs,u=(d,p,...g)=>{let y;typeof p!="object"?y=this.options.overloadTranslationOptionHandler([d,p].concat(g)):y={...p},y.lng=y.lng||u.lng,y.lngs=y.lngs||u.lngs;const b=y.ns!==void 0&&y.ns!==null;y.ns=y.ns||u.ns,y.keyPrefix!==""&&(y.keyPrefix=y.keyPrefix||i||u.keyPrefix);const x={...this.options,...y};Array.isArray(c)&&!b&&(x.ns=c),typeof y.keyPrefix=="function"&&(y.keyPrefix=Hi(y.keyPrefix,x));const S=this.options.keySeparator||".";let k;return y.keyPrefix&&Array.isArray(d)?k=d.map(C=>(typeof C=="function"&&(C=Hi(C,x)),`${y.keyPrefix}${S}${C}`)):(typeof d=="function"&&(d=Hi(d,x)),k=y.keyPrefix?`${y.keyPrefix}${S}${d}`:d),this.t(k,y)};return xe(t)?u.lng=t:u.lngs=t,u.ns=s,u.keyPrefix=i,u}t(...t){var s;return(s=this.translator)==null?void 0:s.translate(...t)}exists(...t){var s;return(s=this.translator)==null?void 0:s.exists(...t)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t,s={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const i=s.lng||this.resolvedLanguage||this.languages[0],o=this.options?this.options.fallbackLng:!1,c=this.languages[this.languages.length-1];if(i.toLowerCase()==="cimode")return!0;const u=(d,p)=>{const g=this.services.backendConnector.state[`${d}|${p}`];return g===-1||g===0||g===2};if(s.precheck){const d=s.precheck(this,u);if(d!==void 0)return d}return!!(this.hasResourceBundle(i,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||u(i,t)&&(!o||u(c,t)))}loadNamespaces(t,s){const i=Wr();return this.options.ns?(xe(t)&&(t=[t]),t.forEach(o=>{this.options.ns.includes(o)||this.options.ns.push(o)}),this.loadResources(o=>{i.resolve(),s&&s(o)}),i):(s&&s(),Promise.resolve())}loadLanguages(t,s){const i=Wr();xe(t)&&(t=[t]);const o=this.options.preload||[],c=t.filter(u=>!o.includes(u)&&this.services.languageUtils.isSupportedCode(u));return c.length?(this.options.preload=o.concat(c),this.loadResources(u=>{i.resolve(),s&&s(u)}),i):(s&&s(),Promise.resolve())}dir(t){var o,c;if(t||(t=this.resolvedLanguage||(((o=this.languages)==null?void 0:o.length)>0?this.languages[0]:this.language)),!t)return"rtl";try{const u=new Intl.Locale(t);if(u&&u.getTextInfo){const d=u.getTextInfo();if(d&&d.direction)return d.direction}}catch{}const s=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],i=((c=this.services)==null?void 0:c.languageUtils)||new Xg(Dd());return t.toLowerCase().indexOf("-latn")>1?"ltr":s.includes(i.getLanguagePartFromCode(t))||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(t={},s){const i=new ro(t,s);return i.createInstance=ro.createInstance,i}cloneInstance(t={},s=Hl){const i=t.forkResourceStore;i&&delete t.forkResourceStore;const o={...this.options,...t,isClone:!0},c=new ro(o);if((t.debug!==void 0||t.prefix!==void 0)&&(c.logger=c.logger.clone(t)),["store","services","language"].forEach(d=>{c[d]=this[d]}),c.services={...this.services},c.services.utils={hasLoadedNamespace:c.hasLoadedNamespace.bind(c)},i){const d=Object.keys(this.store.data).reduce((p,g)=>(p[g]={...this.store.data[g]},p[g]=Object.keys(p[g]).reduce((y,b)=>(y[b]={...p[g][b]},y),p[g]),p),{});c.store=new Qg(d,o),c.services.resourceStore=c.store}if(t.interpolation){const p={...Dd().interpolation,...this.options.interpolation,...t.interpolation},g={...o,interpolation:p};c.services.interpolator=new ny(g)}return c.translator=new ac(c.services,o),c.translator.on("*",(d,...p)=>{c.emit(d,...p)}),c.init(o,s),c.translator.options=o,c.translator.backendConnector.services.utils={hasLoadedNamespace:c.hasLoadedNamespace.bind(c)},c}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const Lt=ro.createInstance();Lt.createInstance;Lt.dir;Lt.init;Lt.loadResources;Lt.reloadResources;Lt.use;Lt.changeLanguage;Lt.getFixedT;Lt.t;Lt.exists;Lt.setDefaultNamespace;Lt.hasLoadedNamespace;Lt.loadNamespaces;Lt.loadLanguages;const q0=(a,t,s,i)=>{var c,u,d,p;const o=[s,{code:t,...i||{}}];if((u=(c=a==null?void 0:a.services)==null?void 0:c.logger)!=null&&u.forward)return a.services.logger.forward(o,"warn","react-i18next::",!0);Ga(o[0])&&(o[0]=`react-i18next:: ${o[0]}`),(p=(d=a==null?void 0:a.services)==null?void 0:d.logger)!=null&&p.warn?a.services.logger.warn(...o):console!=null&&console.warn&&console.warn(...o)},iy={},df=(a,t,s,i)=>{Ga(s)&&iy[s]||(Ga(s)&&(iy[s]=new Date),q0(a,t,s,i))},Lb=(a,t)=>()=>{if(a.isInitialized)t();else{const s=()=>{setTimeout(()=>{a.off("initialized",s)},0),t()};a.on("initialized",s)}},ff=(a,t,s)=>{a.loadNamespaces(t,Lb(a,s))},ry=(a,t,s,i)=>{if(Ga(s)&&(s=[s]),a.options.preload&&a.options.preload.indexOf(t)>-1)return ff(a,s,i);s.forEach(o=>{a.options.ns.indexOf(o)<0&&a.options.ns.push(o)}),a.loadLanguages(t,Lb(a,i))},W0=(a,t,s={})=>!t.languages||!t.languages.length?(df(t,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:t.languages}),!0):t.hasLoadedNamespace(a,{lng:s.lng,precheck:(i,o)=>{if(s.bindI18n&&s.bindI18n.indexOf("languageChanging")>-1&&i.services.backendConnector.backend&&i.isLanguageChangingTo&&!o(i.isLanguageChangingTo,a))return!1}}),Ga=a=>typeof a=="string",V0=a=>typeof a=="object"&&a!==null,K0=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,Y0={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},Z0=a=>Y0[a],Q0=a=>a.replace(K0,Z0);let pf={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:Q0,transDefaultProps:void 0};const X0=(a={})=>{pf={...pf,...a}},J0=()=>pf;let zb;const ek=a=>{zb=a},tk=()=>zb,nk={type:"3rdParty",init(a){X0(a.options.react),ek(a)}},sk=_.createContext();class ak{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(s=>{this.usedNamespaces[s]||(this.usedNamespaces[s]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}var ik=g0();const rk=(a,t)=>{if(Ga(t))return t;if(V0(t)&&Ga(t.defaultValue))return t.defaultValue;if(typeof a=="function")return"";if(Array.isArray(a)){const s=a[a.length-1];return typeof s=="function"?"":s}return a},ok={t:rk,ready:!1},lk=()=>()=>{},Je=(a,t={})=>{var se,ge,Ke;const{i18n:s}=t,{i18n:i,defaultNS:o}=_.useContext(sk)||{},c=s||i||tk();c&&!c.reportNamespaces&&(c.reportNamespaces=new ak),c||df(c,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const u=_.useMemo(()=>{var de;return{...J0(),...(de=c==null?void 0:c.options)==null?void 0:de.react,...t}},[c,t]),{useSuspense:d,keyPrefix:p}=u,g=a||o||((se=c==null?void 0:c.options)==null?void 0:se.defaultNS),y=Ga(g)?[g]:g||["translation"],b=_.useMemo(()=>y,y);(Ke=(ge=c==null?void 0:c.reportNamespaces)==null?void 0:ge.addUsedNamespaces)==null||Ke.call(ge,b);const x=_.useRef(0),S=_.useCallback(de=>{if(!c)return lk;const{bindI18n:K,bindI18nStore:ne}=u,he=()=>{x.current+=1,de()};return K&&c.on(K,he),ne&&c.store.on(ne,he),()=>{K&&K.split(" ").forEach(L=>c.off(L,he)),ne&&ne.split(" ").forEach(L=>c.store.off(L,he))}},[c,u]),k=_.useRef(),C=_.useCallback(()=>{if(!c)return ok;const de=!!(c.isInitialized||c.initializedStoreOnce)&&b.every(W=>W0(W,c,u)),K=t.lng||c.language,ne=x.current,he=k.current;if(he&&he.ready===de&&he.lng===K&&he.keyPrefix===p&&he.revision===ne)return he;const Z={t:c.getFixedT(K,u.nsMode==="fallback"?b:b[0],p,{scopeNs:b}),ready:de,lng:K,keyPrefix:p,revision:ne};return k.current=Z,Z},[c,b,p,u,t.lng]),[T,E]=_.useState(0),{t:A,ready:B}=ik.useSyncExternalStore(S,C,C);_.useEffect(()=>{if(c&&!B&&!d){const de=()=>E(K=>K+1);t.lng?ry(c,t.lng,b,de):ff(c,b,de)}},[c,t.lng,b,B,d,T]);const M=c||{},j=_.useRef(null),J=_.useRef(),Y=de=>{const K=Object.getOwnPropertyDescriptors(de);K.__original&&delete K.__original;const ne=Object.create(Object.getPrototypeOf(de),K);if(!Object.prototype.hasOwnProperty.call(ne,"__original"))try{Object.defineProperty(ne,"__original",{value:de,writable:!1,enumerable:!1,configurable:!1})}catch{}return ne},te=_.useMemo(()=>{const de=M,K=de==null?void 0:de.language;let ne=de;de&&(j.current&&j.current.__original===de?J.current!==K?(ne=Y(de),j.current=ne,J.current=K):ne=j.current:(ne=Y(de),j.current=ne,J.current=K));const he=!B&&!d?(...Z)=>(df(c,"USE_T_BEFORE_READY","useTranslation: t was called before ready. When using useSuspense: false, make sure to check the ready flag before using t."),A(...Z)):A,L=[he,ne,B];return L.t=he,L.i18n=ne,L.ready=B,L},[A,M,B,M.resolvedLanguage,M.language,M.languages]);if(c&&d&&!B)throw new Promise(de=>{const K=()=>de();t.lng?ry(c,t.lng,b,K):ff(c,b,K)});return te},ck={};function uk(a,t){let s;try{s=a()}catch{return}return{getItem:o=>{var c;const u=p=>p===null?null:JSON.parse(p,void 0),d=(c=s.getItem(o))!=null?c:null;return d instanceof Promise?d.then(u):u(d)},setItem:(o,c)=>s.setItem(o,JSON.stringify(c,void 0)),removeItem:o=>s.removeItem(o)}}const go=a=>t=>{try{const s=a(t);return s instanceof Promise?s:{then(i){return go(i)(s)},catch(i){return this}}}catch(s){return{then(i){return this},catch(i){return go(i)(s)}}}},dk=(a,t)=>(s,i,o)=>{let c={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:T=>T,version:0,merge:(T,E)=>({...E,...T}),...t},u=!1;const d=new Set,p=new Set;let g;try{g=c.getStorage()}catch{}if(!g)return a((...T)=>{console.warn(`[zustand persist middleware] Unable to update item '${c.name}', the given storage is currently unavailable.`),s(...T)},i,o);const y=go(c.serialize),b=()=>{const T=c.partialize({...i()});let E;const A=y({state:T,version:c.version}).then(B=>g.setItem(c.name,B)).catch(B=>{E=B});if(E)throw E;return A},x=o.setState;o.setState=(T,E)=>{x(T,E),b()};const S=a((...T)=>{s(...T),b()},i,o);let k;const C=()=>{var T;if(!g)return;u=!1,d.forEach(A=>A(i()));const E=((T=c.onRehydrateStorage)==null?void 0:T.call(c,i()))||void 0;return go(g.getItem.bind(g))(c.name).then(A=>{if(A)return c.deserialize(A)}).then(A=>{if(A)if(typeof A.version=="number"&&A.version!==c.version){if(c.migrate)return c.migrate(A.state,A.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return A.state}).then(A=>{var B;return k=c.merge(A,(B=i())!=null?B:S),s(k,!0),b()}).then(()=>{E==null||E(k,void 0),u=!0,p.forEach(A=>A(k))}).catch(A=>{E==null||E(void 0,A)})};return o.persist={setOptions:T=>{c={...c,...T},T.getStorage&&(g=T.getStorage())},clearStorage:()=>{g==null||g.removeItem(c.name)},getOptions:()=>c,rehydrate:()=>C(),hasHydrated:()=>u,onHydrate:T=>(d.add(T),()=>{d.delete(T)}),onFinishHydration:T=>(p.add(T),()=>{p.delete(T)})},C(),k||S},fk=(a,t)=>(s,i,o)=>{let c={storage:uk(()=>localStorage),partialize:C=>C,version:0,merge:(C,T)=>({...T,...C}),...t},u=!1;const d=new Set,p=new Set;let g=c.storage;if(!g)return a((...C)=>{console.warn(`[zustand persist middleware] Unable to update item '${c.name}', the given storage is currently unavailable.`),s(...C)},i,o);const y=()=>{const C=c.partialize({...i()});return g.setItem(c.name,{state:C,version:c.version})},b=o.setState;o.setState=(C,T)=>{b(C,T),y()};const x=a((...C)=>{s(...C),y()},i,o);o.getInitialState=()=>x;let S;const k=()=>{var C,T;if(!g)return;u=!1,d.forEach(A=>{var B;return A((B=i())!=null?B:x)});const E=((T=c.onRehydrateStorage)==null?void 0:T.call(c,(C=i())!=null?C:x))||void 0;return go(g.getItem.bind(g))(c.name).then(A=>{if(A)if(typeof A.version=="number"&&A.version!==c.version){if(c.migrate)return[!0,c.migrate(A.state,A.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,A.state];return[!1,void 0]}).then(A=>{var B;const[M,j]=A;if(S=c.merge(j,(B=i())!=null?B:x),s(S,!0),M)return y()}).then(()=>{E==null||E(S,void 0),S=i(),u=!0,p.forEach(A=>A(S))}).catch(A=>{E==null||E(void 0,A)})};return o.persist={setOptions:C=>{c={...c,...C},C.storage&&(g=C.storage)},clearStorage:()=>{g==null||g.removeItem(c.name)},getOptions:()=>c,rehydrate:()=>k(),hasHydrated:()=>u,onHydrate:C=>(d.add(C),()=>{d.delete(C)}),onFinishHydration:C=>(p.add(C),()=>{p.delete(C)})},c.skipHydration||k(),S||x},pk=(a,t)=>"getStorage"in t||"serialize"in t||"deserialize"in t?((ck?"production":void 0)!=="production"&&console.warn("[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."),dk(a,t)):fk(a,t),xa=pk;let oy=!1;function ns(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():(oy||(oy=!0,console.warn("[uuid] crypto.randomUUID unavailable (non-secure context) — using Math.random fallback")),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,a=>{const t=Math.random()*16|0;return(a==="x"?t:t&3|8).toString(16)}))}const mk=4e3,Pa=new Map;function ly(a,t){const s=Pa.get(a);s&&clearTimeout(s),!(t<=0)&&Pa.set(a,setTimeout(()=>{Pa.delete(a),Ls.setState(i=>({toasts:i.toasts.filter(o=>o.id!==a)}))},t))}const Ls=Ut(a=>({toasts:[],addToast:(t,s,i)=>{const o=i??mk;a(c=>{const u=c.toasts.find(g=>g.type===t&&g.message===s);if(u)return ly(u.id,o),{toasts:c.toasts.map(g=>g.id===u.id?{...g,count:g.count+1,createdAt:Date.now()}:g)};const d=`toast-${Date.now()}-${Math.random().toString(36).slice(2,7)}`;ly(d,o);const p={id:d,type:t,message:s,duration:o,createdAt:Date.now(),count:1};return{toasts:[...c.toasts,p].slice(-10)}})},dismissToast:t=>{const s=Pa.get(t);s&&(clearTimeout(s),Pa.delete(t)),a(i=>({toasts:i.toasts.filter(o=>o.id!==t)}))},clearAll:()=>{for(const t of Pa.values())clearTimeout(t);Pa.clear(),a({toasts:[]})}})),_e={info:(a,t)=>Ls.getState().addToast("info",a,t),success:(a,t)=>Ls.getState().addToast("success",a,t),warning:(a,t)=>Ls.getState().addToast("warning",a,t),error:(a,t)=>Ls.getState().addToast("error",a,t??6e3)},zi=24;function Zl(a){if(a.preview){const o=String(a.preview).replace(/\s+/g," ").trim();return o.length>zi?o.slice(0,zi)+"…":o}const t=Ce.getState().getMessages(a.id);if(!t||t.length===0)return"";const s=t.find(o=>o.type==="user"&&!o.deleted)||t.find(o=>!o.deleted)||t[0],i=String((s==null?void 0:s.content)||"").replace(/\s+/g," ").trim();return i?i.length>zi?i.slice(0,zi)+"…":i:""}function Ub(a,t){if(!t)return!1;const s=a.replace(/\s+/g," ").replace(/\.\.\.$/,"");return s?!t.startsWith(s):!0}const hk=3e4;function Ff(a){let t=0;function s(u,d){try{return localStorage.setItem(u,JSON.stringify(d)),t=0,!0}catch{return!1}}return{getItem:u=>{const d=localStorage.getItem(u);if(!d)return null;try{const p=JSON.parse(d);return p&&typeof p=="object"&&"state"in p?p:{state:p,version:0}}catch{return null}},setItem:(u,d)=>{var y;if(s(u,d))return;let p=d;for(const b of a.trims??[]){try{p=b(p)}catch{continue}if(s(u,p))return}const g=Date.now();if(g-t>hk){t=g;const b=new Error(`localStorage 配额已满或不可用(${a.key}),已降级为仅内存持久化,刷新页面将丢失部分历史。`);console.warn(`[${a.key}] 持久化失败:`,b);try{(y=a.onFailure)==null||y.call(a,b)}catch{}}},removeItem:u=>{try{localStorage.removeItem(u)}catch{}}}}const mf=6,Ib=50,cy=50;let uy=0,dy=0;function gk(){const a=Date.now();a!==dy&&(dy=a,uy=0);const t=(++uy).toString(36),s=Math.random().toString(36).slice(2,6);return`s_${a.toString(36)}${t}${s}`}const yk=100,Vr=2e3,Kr=(a,t)=>a&&(a.length>t?`${a.slice(0,t)}…`:a),$b=a=>{const{logs:t,...s}=a;return{...s,description:Kr(s.description,Vr),result:Kr(s.result,Vr),error:Kr(s.error,Vr),stepPrompt:Kr(s.stepPrompt,Vr),context:s.context?Object.fromEntries(Object.entries(s.context).map(([i,o])=>[i,Kr(o,Vr)??""])):void 0,children:s.children?s.children.map($b):void 0}},Ql=a=>[...a].sort((t,s)=>(s.lastActiveAt??s.createdAt??0)-(t.lastActiveAt??t.createdAt??0));function Ld(a,t){const s=new Set(a.map(d=>d.id)),i=[],o=new Set,c=Math.max(0,Ib-a.length);let u=0;for(const d of Ql(t)){if(s.has(d.id)){i.push(d);continue}if(u>=c){o.add(d.id);continue}i.push(d),u++}return{history:i,droppedIds:o}}function fy(a,t,s,i){return i.size===0?{sessions:a,tasksBySession:t,sessionWorkspaceDirs:s}:{sessions:a.filter(o=>!i.has(o.id)),tasksBySession:Object.fromEntries(Object.entries(t).filter(([o])=>!i.has(o))),sessionWorkspaceDirs:Object.fromEntries(Object.entries(s).filter(([o])=>!i.has(o)))}}const Te=Ut()(xa((a,t)=>({sessions:[],activeSessionId:null,sessionTabs:[],layout:"single",sessionWorkspaceDirs:{},tasksBySession:{},historySessions:[],addSession:s=>a(i=>({sessions:[s,...i.sessions].slice(0,cy),activeSessionId:s.id})),removeSession:s=>a(i=>{var o;return{sessions:i.sessions.filter(c=>c.id!==s),activeSessionId:i.activeSessionId===s?((o=i.sessions[0])==null?void 0:o.id)||null:i.activeSessionId}}),updateSession:(s,i)=>a(o=>({sessions:o.sessions.map(c=>c.id===s?{...c,...i}:c)})),setActiveSession:s=>a({activeSessionId:s}),setSessionWorkspaceDir:(s,i)=>a(o=>({sessionWorkspaceDirs:{...o.sessionWorkspaceDirs,[s]:i}})),getSessionWorkspaceDir:s=>t().sessionWorkspaceDirs[s]||"",addSessionTab:(s,i)=>{const o=t();if(o.sessionTabs.length>=mf){const k=o.sessionTabs.reduce((C,T)=>C.createdAt<T.createdAt?C:T);t().closeSessionTab(k.id)}const c=gk(),u=i&&i.split(/[\\/]/).filter(Boolean).pop()||void 0,d={id:c,title:s||`对话 ${o.sessionTabs.length+1}`,createdAt:Date.now(),lastActiveAt:Date.now(),project:u,status:"done"},p={id:c,title:s||`对话 ${o.sessionTabs.length+1}`,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),messageCount:0},g={...o.sessionWorkspaceDirs};i&&(g[c]=i);const y={...o.tasksBySession};y[c]||(y[c]=[]);const b=Ql([d,...o.sessionTabs]),x=Ld(b,[d,...o.historySessions.filter(k=>k.id!==c)]),S=fy([...o.sessions,p].slice(-cy),y,g,x.droppedIds);return a({sessionTabs:b,sessions:S.sessions,sessionWorkspaceDirs:S.sessionWorkspaceDirs,tasksBySession:S.tasksBySession,activeSessionId:c,historySessions:x.history}),c},closeSessionTab:s=>{var y;const i=t(),o=i.sessionTabs.find(b=>b.id===s),c=i.sessionTabs.filter(b=>b.id!==s);if(c.length===0)return;let u=i.historySessions;o&&(u=[o,...u.filter(b=>b.id!==s)]);const d=Ld(c,u),p=fy(i.sessions,i.tasksBySession,i.sessionWorkspaceDirs,d.droppedIds),g=c[c.length-1];a({sessionTabs:c,historySessions:d.history,sessions:p.sessions,tasksBySession:p.tasksBySession,sessionWorkspaceDirs:p.sessionWorkspaceDirs,activeSessionId:i.activeSessionId===s?g?g.id:((y=c[0])==null?void 0:y.id)||null:i.activeSessionId})},renameSessionTab:(s,i)=>a(o=>({sessionTabs:o.sessionTabs.map(c=>c.id===s?{...c,title:i}:c),sessions:o.sessions.map(c=>c.id===s?{...c,title:i,updatedAt:new Date().toISOString()}:c),historySessions:o.historySessions.map(c=>c.id===s?{...c,title:i}:c)})),getActiveSessionTab:()=>{const s=t();return s.sessionTabs.find(i=>i.id===s.activeSessionId)||null},getVisibleSessionTabs:()=>{const s=t(),i=s.sessionTabs.find(o=>o.id===s.activeSessionId);return i?[i]:s.sessionTabs.slice(0,1)},addSessionTask:(s,i,o,c)=>a(u=>{const d=u.tasksBySession[s]||[],p={id:`session-task-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,title:i.trim(),completed:!1,createdAt:Date.now(),backendId:o,description:c};return{tasksBySession:{...u.tasksBySession,[s]:[...d,p]}}}),toggleSessionTask:(s,i)=>a(o=>{const c=o.tasksBySession[s]||[];return{tasksBySession:{...o.tasksBySession,[s]:c.map(u=>u.id===i?{...u,completed:!u.completed}:u)}}}),removeSessionTask:(s,i)=>a(o=>({tasksBySession:{...o.tasksBySession,[s]:(o.tasksBySession[s]||[]).filter(c=>c.id!==i)}})),updateSessionTask:(s,i,o)=>a(c=>{const u=c.tasksBySession[s]||[];return{tasksBySession:{...c.tasksBySession,[s]:u.map(d=>d.id===i?{...d,title:o.trim()}:d)}}}),getSessionTasks:s=>t().tasksBySession[s]||[],setSessionTasks:(s,i)=>a(o=>({tasksBySession:{...o.tasksBySession,[s]:i}})),updateTaskPlanStatus:(s,i,o)=>a(c=>{const u=c.tasksBySession[s]||[];return{tasksBySession:{...c.tasksBySession,[s]:u.map(d=>d.id===i?{...d,...o}:d)}}}),autoNameSession:(s,i)=>{const c=t().sessionTabs.find(p=>p.id===s);if(!c||!/^对话 \d+$/.test(c.title))return;const u=i.replace(/\s+/g," ").trim(),d=u.slice(0,20)+(u.length>20?"...":"");d&&t().renameSessionTab(s,d)},updateSessionStatus:(s,i)=>a(o=>({sessionTabs:o.sessionTabs.map(c=>c.id===s?{...c,status:i}:c)})),touchSession:(s,i)=>a(o=>{const c=Date.now();let u;if(i){const p=i.replace(/\s+/g," ").trim();u=p.length>zi?p.slice(0,zi)+"…":p}const d=p=>({...p,lastActiveAt:c,...u&&!p.preview?{preview:u}:{}});return{sessionTabs:Ql(o.sessionTabs.map(p=>p.id===s?d(p):p)),sessions:o.sessions.map(p=>p.id===s?{...p,updatedAt:new Date(c).toISOString()}:p),historySessions:o.historySessions.map(p=>p.id===s?d(p):p)}}),getHistorySessions:()=>t().historySessions,restoreHistorySession:s=>{const i=t(),o=i.historySessions.find(p=>p.id===s);if(!o)return;const c=i.historySessions.filter(p=>p.id!==s);if(i.sessionTabs.some(p=>p.id===s)){a({historySessions:c,activeSessionId:s});return}let u=i.sessionTabs;if(u.length>=mf){const p=u.reduce((g,y)=>g.createdAt<y.createdAt?g:y);u=u.filter(g=>g.id!==p.id),c.unshift(p)}const d=Ql([o,...u]);a({sessionTabs:d,historySessions:Ld(d,c).history,activeSessionId:s})},clearHistorySessions:()=>a({historySessions:[]}),removeHistorySession:s=>a(i=>({historySessions:i.historySessions.filter(o=>o.id!==s)}))}),{name:"deepseekcode-session-storage",storage:Ff({key:"sessionStore",trims:[a=>({...a,state:{...a.state,tasksBySession:Object.fromEntries(Object.entries(a.state.tasksBySession).map(([t,s])=>[t,s.map(i=>({id:i.id,title:i.title,completed:i.completed,createdAt:i.createdAt,planStatus:i.planStatus,backendId:i.backendId,backendStatus:i.backendStatus,agentType:i.agentType,progress:i.progress}))]))}}),a=>{const t=new Set([...a.state.sessionTabs.map(s=>s.id),...a.state.historySessions.map(s=>s.id)]);return a.state.activeSessionId&&t.add(a.state.activeSessionId),{...a,state:{...a.state,tasksBySession:Object.fromEntries(Object.entries(a.state.tasksBySession).filter(([s])=>t.has(s)))}}},a=>({...a,state:{...a.state,tasksBySession:{}}})],onFailure:()=>{try{Ls.getState().addToast("warning","会话数据保存失败:浏览器本地存储已满或不可用。当前数据仅保留在内存中,刷新页面将丢失,建议清理旧会话或导出数据。",8e3)}catch{}}}),partialize:a=>{const t=new Set;for(const o of a.sessionTabs)t.add(o.id);for(const o of a.historySessions)t.add(o.id);a.activeSessionId&&t.add(a.activeSessionId);const s=a.sessions.filter(o=>t.has(o.id)),i={};for(const[o,c]of Object.entries(a.tasksBySession))t.has(o)&&(i[o]=c.slice(0,yk).map($b));return{sessions:s,sessionTabs:a.sessionTabs,activeSessionId:a.activeSessionId,layout:a.layout,sessionWorkspaceDirs:a.sessionWorkspaceDirs,tasksBySession:i,historySessions:a.historySessions}}})),bk="deepseekcode-chat-store",vk=500,xk=3e4,Sk=2e4,ic=4e3;let es=null,zd=0,oo=null;const lo=(a,t)=>!a||a.length<=t?a:a.slice(0,t)+"…",py=a=>({...a,args:typeof a.args=="string"?lo(a.args,ic)??a.args:a.args,result:typeof a.result=="string"?lo(a.result,ic)??a.result:a.result}),kk=a=>{const t={...a,thinkingBlocks:void 0,content:lo(a.content,Sk)??a.content};return a.steps&&(t.steps=a.steps.map(s=>{var i;return{...s,thought:lo(s.thought,ic),result:lo(s.result,ic),toolCalls:(i=s.toolCalls)==null?void 0:i.map(py)}})),a.toolCalls&&(t.toolCalls=a.toolCalls.map(py)),t},wk=[a=>{const t=Te.getState(),s=new Set;for(const o of t.sessionTabs)s.add(o.id);for(const o of t.historySessions)s.add(o.id);t.activeSessionId&&s.add(t.activeSessionId);const i={};for(const[o,c]of Object.entries(a.state.messagesBySession||{}))s.has(o)&&Array.isArray(c)&&c.length>0&&(i[o]=c);return{...a,state:{...a.state,messagesBySession:i}}},a=>{const t={};for(const[s,i]of Object.entries(a.state.messagesBySession||{}))t[s]=(Array.isArray(i)?i:[]).slice(-60).map(kk);return{...a,state:{...a.state,messagesBySession:t}}},a=>{const t=Te.getState().activeSessionId||"",s=(a.state.messagesBySession||{})[t]||[],i=(Array.isArray(s)?s:[]).slice(-30).map(o=>({id:o.id,type:o.type,content:o.content,timestamp:o.timestamp,...o.thinking?{thinking:o.thinking}:{}}));return{...a,state:{...a.state,messagesBySession:t?{[t]:i}:{}}}}];function Hb(a,t){const s=c=>{try{return localStorage.setItem(a,JSON.stringify(c)),zd=0,!0}catch{return!1}};if(s(t))return;let i=t;for(const c of wk){try{i=c(i)}catch{continue}if(s(i))return}const o=Date.now();if(o-zd>xk){zd=o,console.error("[chatStore] localStorage 持久化失败,刷新页面将丢失历史消息:",new Error("quota exceeded or storage unavailable"));try{Ls.getState().addToast("warning","聊天记录保存失败:浏览器本地存储已满或不可用。刷新页面将丢失历史消息,建议导出会话或清理旧会话。",8e3)}catch{}}}function Ck(){es&&(clearTimeout(es),es=null);const a=oo;oo=null,a&&Hb(a.name,a.value)}const _k={getItem:a=>{const t=localStorage.getItem(a);if(!t)return null;try{const s=JSON.parse(t);return s&&typeof s=="object"&&"state"in s?s:{state:s,version:0}}catch{return null}},setItem:(a,t)=>{oo={name:a,value:t},es&&clearTimeout(es),es=setTimeout(()=>{es=null,oo=null,Hb(a,t)},vk)},removeItem:a=>{oo=null,es&&(clearTimeout(es),es=null);try{localStorage.removeItem(a)}catch{}}};if(typeof window<"u"){const a=()=>Ck();window.addEventListener("pagehide",a),window.addEventListener("beforeunload",a)}function my(a,t,s){const i=a.thinkingBlocks?a.thinkingBlocks.map(o=>({...o})):a.thinking?[{index:Number.MIN_SAFE_INTEGER,text:a.thinking}]:[];if(typeof s=="number"){const o=i.find(c=>c.index===s);o?o.text+=t:i.push({index:s,text:t})}else if(i.length>0){const o=i.length-1,c=i[o];c?i[o]={...c,text:c.text+t}:i.push({index:0,text:t})}else i.push({index:0,text:t});return i.sort((o,c)=>o.index-c.index),{...a,thinkingBlocks:i,thinking:i.map(o=>o.text).join("")}}const Ce=Ut()(xa((a,t)=>({messagesBySession:{},generatingSessions:[],pausedSessions:[],sessionInputs:{},getMessages:s=>t().messagesBySession[s]||[],replaceMessages:(s,i)=>a(o=>({messagesBySession:{...o.messagesBySession,[s]:i.slice(-200)}})),addMessage:(s,i)=>a(o=>{const u=[...o.messagesBySession[s]||[],i].slice(-200);return{messagesBySession:{...o.messagesBySession,[s]:u}}}),updateLastMessage:(s,i)=>a(o=>{const c=(o.messagesBySession[s]||[]).map((u,d,p)=>d===p.length-1&&u.type==="assistant"?{...u,content:i}:u);return{messagesBySession:{...o.messagesBySession,[s]:c}}}),appendToLastMessage:(s,i)=>a(o=>{const c=o.messagesBySession[s];if(!c||c.length===0)return o;const u=c.length-1,d=c[u];if(d&&d.type==="assistant"){const p=c.slice();return p[u]={...d,content:d.content+i},{messagesBySession:{...o.messagesBySession,[s]:p}}}return{messagesBySession:{...o.messagesBySession,[s]:[...c,{id:ns(),type:"assistant",content:i,timestamp:Date.now()}].slice(-200)}}}),setThinking:(s,i)=>a(o=>{const c=(o.messagesBySession[s]||[]).map((u,d,p)=>{var y;if(d!==p.length-1||u.type!=="assistant")return u;const g=(y=u.steps)==null?void 0:y.findIndex(b=>b.status==="running");if(g!==void 0&&g!==-1&&u.steps&&u.steps[g]){const b=u.steps.map((x,S)=>S===g?{...x,thought:i}:x);return{...u,steps:b}}return{...u,thinking:i,thinkingBlocks:i?[{index:0,text:i}]:[]}});return{messagesBySession:{...o.messagesBySession,[s]:c}}}),appendToLastMessageThinking:(s,i,o)=>a(c=>{var x,S;const u=c.messagesBySession[s];if(!u||u.length===0)return c;const d=u.length-1,p=u[d];if(!p||p.type!=="assistant")return{messagesBySession:{...c.messagesBySession,[s]:[...u,my({id:ns(),type:"assistant",content:"",timestamp:Date.now()},i,o)].slice(-200)}};let g;const y=(x=p.steps)==null?void 0:x.findIndex(k=>k.status==="running");if(y!==void 0&&y!==-1&&((S=p.steps)!=null&&S[y])){const k=p.steps.slice(),C=k[y];k[y]={...C,thought:(C.thought||"")+i},g={...p,steps:k}}else if(p.steps&&p.steps.length>0){const k=p.steps.length-1,C=p.steps.slice(),T=C[k];C[k]={...T,thought:(T.thought||"")+i},g={...p,steps:C}}else g=my(p,i,o);const b=u.slice();return b[d]=g,{messagesBySession:{...c.messagesBySession,[s]:b}}}),addStep:(s,i)=>a(o=>{const c=(o.messagesBySession[s]||[]).map((u,d,p)=>{var x,S;if(d!==p.length-1||u.type!=="assistant")return u;const g=(x=u.toolCalls)==null?void 0:x.filter(k=>{var C;return!((C=u.steps)!=null&&C.some(T=>{var E;return(E=T.toolCalls)==null?void 0:E.some(A=>A.id===k.id)}))}),y={...i};g!=null&&g.length&&(y.toolCalls=[...y.toolCalls||[],...g]);let b=u.thinking||"";return b.trim().length>0&&(y.thought=(y.thought||"")+b,b=""),{...u,thinking:b,thinkingBlocks:[],toolCalls:g!=null&&g.length?(S=u.toolCalls)==null?void 0:S.filter(k=>!g.some(C=>C.id===k.id)):u.toolCalls,steps:[...u.steps||[],y]}});return{messagesBySession:{...o.messagesBySession,[s]:c}}}),updateStep:(s,i,o)=>a(c=>{const u=(c.messagesBySession[s]||[]).map((d,p,g)=>{if(p!==g.length-1||!d.steps)return d;const y=d.steps.findIndex(x=>x.id===i);if(y===-1)return d;const b=d.steps.map((x,S)=>S===y?{...x,...o}:x);return{...d,steps:b}});return{messagesBySession:{...c.messagesBySession,[s]:u}}}),addToolCall:(s,i)=>a(o=>{const c=(o.messagesBySession[s]||[]).map((u,d,p)=>{var y;if(d!==p.length-1||u.type!=="assistant")return u;const g=(y=u.steps)==null?void 0:y.findIndex(b=>b.status==="running");if(g!==void 0&&g!==-1&&u.steps&&u.steps[g]){const b=u.steps.map((x,S)=>S===g?{...x,toolCalls:[...x.toolCalls||[],i]}:x);return{...u,steps:b}}if(u.steps&&u.steps.length>0){const b=u.steps.length-1,x=u.steps.map((S,k)=>k===b?{...S,toolCalls:[...S.toolCalls||[],i]}:S);return{...u,steps:x}}return{...u,toolCalls:[...u.toolCalls||[],i]}});return{messagesBySession:{...o.messagesBySession,[s]:c}}}),updateToolCall:(s,i,o)=>a(c=>{const u=p=>{if(!p)return null;const g=p.findIndex(y=>y.id===i);return g===-1?null:p.map((y,b)=>b===g?{...y,...o}:y)},d=(c.messagesBySession[s]||[]).map((p,g,y)=>{var S,k;if(g!==y.length-1||p.type!=="assistant")return p;const b=(S=p.steps)==null?void 0:S.findIndex(C=>C.status==="running");if(b!==void 0&&b!==-1&&p.steps&&p.steps[b]){const C=u((k=p.steps[b])==null?void 0:k.toolCalls);if(C){const T=p.steps.map((E,A)=>A===b?{...E,toolCalls:C}:E);return{...p,steps:T}}}if(p.steps){let C=!1;const T=p.steps.map(E=>{if(C)return E;const A=u(E.toolCalls);return A?(C=!0,{...E,toolCalls:A}):E});if(C)return{...p,steps:T}}const x=u(p.toolCalls);return x?{...p,toolCalls:x}:p});return{messagesBySession:{...c.messagesBySession,[s]:d}}}),appendToLastToolCallArgs:(s,i,o,c)=>a(u=>{const d=y=>{let b=y.args;if(typeof b=="string")b=b+o;else if(typeof b=="object"&&b!==null){const x=o.trim();if(x.startsWith("{")&&x.endsWith("}"))try{const S=JSON.parse(x);typeof b=="string"?b={...S}:b={...b,...S}}catch{b=JSON.stringify(b).slice(0,-1)+","+x.slice(1)}else typeof b=="string"?b=b+x:b=JSON.stringify(b)+x}else b=o;return{...y,args:b}},p=y=>{if(!y)return null;const b=y.findIndex(x=>c!==void 0&&x.index===c||x.id===i);return b===-1?null:y.map((x,S)=>S===b?d(x):x)},g=(u.messagesBySession[s]||[]).map((y,b,x)=>{var C,T;if(b!==x.length-1||y.type!=="assistant")return y;const S=(C=y.steps)==null?void 0:C.findIndex(E=>E.status==="running");if(S!==void 0&&S!==-1&&y.steps&&y.steps[S]){const E=p((T=y.steps[S])==null?void 0:T.toolCalls);if(E){const A=y.steps.map((B,M)=>M===S?{...B,toolCalls:E}:B);return{...y,steps:A}}}if(y.steps){let E=!1;const A=y.steps.map(B=>{if(E)return B;const M=p(B.toolCalls);return M?(E=!0,{...B,toolCalls:M}):B});if(E)return{...y,steps:A}}const k=p(y.toolCalls);return k?{...y,toolCalls:k}:y});return{messagesBySession:{...u.messagesBySession,[s]:g}}}),startGeneration:s=>a(i=>({generatingSessions:i.generatingSessions.includes(s)?i.generatingSessions:[...i.generatingSessions,s]})),endGeneration:(s,i)=>a(o=>{var g,y,b;const c=o.messagesBySession[s]||[],u=Date.now(),d=c.map(x=>{var T,E;let S=!1;const k=(T=x.steps)==null?void 0:T.map(A=>{if(!A.toolCalls)return A;const B=A.toolCalls.map(M=>M.status!=="running"?M:(S=!0,{...M,status:"error",result:"生成已结束(工具执行超时或连接中断)",duration:Math.floor((u-(M.timestamp||u))/1e3)}));return B!==A.toolCalls?{...A,toolCalls:B}:A}),C=(E=x.toolCalls)==null?void 0:E.map(A=>A.status!=="running"?A:(S=!0,{...A,status:"error",result:"生成已结束(工具执行超时或连接中断)",duration:Math.floor((u-(A.timestamp||u))/1e3)}));return S?{...x,steps:k,toolCalls:C}:x}),p=d[d.length-1];if(p&&p.type==="assistant"&&!p.content&&!p.thinking&&!((g=p.thinkingBlocks)!=null&&g.length)&&!((y=p.steps)!=null&&y.length)&&!((b=p.toolCalls)!=null&&b.length)&&!p.hookApproval){const{[s]:x,...S}=o.messagesBySession;return{generatingSessions:o.generatingSessions.filter(k=>k!==s),pausedSessions:o.pausedSessions.filter(k=>k!==s),messagesBySession:{...S,[s]:d.slice(0,-1)}}}return{generatingSessions:o.generatingSessions.filter(x=>x!==s),pausedSessions:o.pausedSessions.filter(x=>x!==s),messagesBySession:{...o.messagesBySession,[s]:d}}}),pauseGeneration:s=>a(i=>({pausedSessions:i.pausedSessions.includes(s)?i.pausedSessions:[...i.pausedSessions,s]})),resumeGeneration:s=>a(i=>({pausedSessions:i.pausedSessions.filter(o=>o!==s)})),clearMessages:s=>a(i=>{const{[s]:o,...c}=i.messagesBySession;return{messagesBySession:c}}),removeSession:s=>a(i=>{const{[s]:o,...c}=i.messagesBySession,{[s]:u,...d}=i.sessionInputs;return{messagesBySession:c,sessionInputs:d,generatingSessions:i.generatingSessions.filter(p=>p!==s)}}),setSessionInput:(s,i)=>a(o=>({sessionInputs:{...o.sessionInputs,[s]:i}})),getSessionInput:s=>t().sessionInputs[s]||"",attachHookApproval:(s,i)=>a(o=>{const c=o.messagesBySession[s]||[];if(c.length===0){const g={id:`hook-approval-${i.approvalId||Date.now()}`,type:"assistant",content:"",timestamp:Date.now(),hookApproval:i};return{messagesBySession:{...o.messagesBySession,[s]:[g]}}}const u=c.length-1,d=c[u];if(d&&d.type==="assistant"){const g=c.slice();return g[u]={...d,hookApproval:i},{messagesBySession:{...o.messagesBySession,[s]:g}}}const p={id:`hook-approval-${i.approvalId||Date.now()}`,type:"assistant",content:"",timestamp:Date.now(),hookApproval:i};return{messagesBySession:{...o.messagesBySession,[s]:[...c,p].slice(-200)}}}),updateHookApprovalStatus:(s,i,o)=>a(c=>{const u=c.messagesBySession[s];if(!u)return c;const d=u.map(p=>{var g;return((g=p.hookApproval)==null?void 0:g.approvalId)===i?{...p,hookApproval:{...p.hookApproval,status:o}}:p});return{messagesBySession:{...c.messagesBySession,[s]:d}}}),setMessageFileJob:(s,i)=>a(o=>{const c=o.messagesBySession[s]||[];if(c.length===0){const g={id:`filejob-${i.jobId}`,type:"assistant",content:"",timestamp:Date.now(),fileJob:i};return{messagesBySession:{...o.messagesBySession,[s]:[g]}}}const u=c.length-1,d=c[u];if(d&&d.type==="assistant"){const g=c.slice();return g[u]={...d,fileJob:d.fileJob?{...d.fileJob,...i,attachments:i.attachments??d.fileJob.attachments,jobId:d.fileJob.jobId,updatedAt:Date.now()}:{...i,updatedAt:Date.now()}},{messagesBySession:{...o.messagesBySession,[s]:g}}}const p={id:`filejob-${i.jobId}`,type:"assistant",content:"",timestamp:Date.now(),fileJob:i};return{messagesBySession:{...o.messagesBySession,[s]:[...c,p].slice(-200)}}}),attachErrorCard:(s,i)=>a(o=>{const c=o.messagesBySession[s];if(!c||c.length===0)return o;const u=c.length-1,d=c[u];if(d&&d.type==="assistant"){const p=c.slice();return p[u]={...d,errorCard:i},{messagesBySession:{...o.messagesBySession,[s]:p}}}return o}),setTurnSummary:(s,i)=>a(o=>{const c=o.messagesBySession[s];if(!c||c.length===0)return o;const u=c.length-1,d=c[u];if(!d||d.type!=="assistant")return o;const p=c.slice();return p[u]={...d,summary:i},{messagesBySession:{...o.messagesBySession,[s]:p}}}),applyTombstone:(s,i)=>a(o=>{const c=o.messagesBySession[s];if(!c||c.length===0)return o;const u=new Set(i),d=c.map(p=>u.has(p.id)?{...p,deleted:!0}:p);return{messagesBySession:{...o.messagesBySession,[s]:d}}}),isGenerating:s=>t().generatingSessions.includes(s),isPaused:s=>t().pausedSessions.includes(s)}),{name:bk,storage:_k,partialize:a=>({messagesBySession:a.messagesBySession,sessionInputs:a.sessionInputs})})),Tk=Ut(a=>({isOpen:!1,status:"idle",port:null,wsUrl:null,errorMessage:null,openTerminal:()=>a({isOpen:!0}),closeTerminal:()=>a({isOpen:!1}),toggleTerminal:()=>a(t=>({isOpen:!t.isOpen})),setStarting:()=>a({status:"starting",errorMessage:null}),setRunning:(t,s)=>a({status:"running",port:t,wsUrl:s}),setStopping:()=>a({status:"stopping"}),setIdle:()=>a({status:"idle",port:null,wsUrl:null,errorMessage:null}),setError:t=>a({status:"error",errorMessage:t})})),hy={bg:"#0d1117",surface:"#161b22",border:"#30363d",text:"#c9d1d9",muted:"#8b949e",accentBlue:"#58a6ff",accentGreen:"#238636",accentRed:"#f85149",accentYellow:"#d29922",accentPurple:"#a855f7"},Vj=["off","low","medium","high","extra_high","max"],Nk=8,qa=Ut()(xa(a=>({theme:"light",themePresetId:"linear",language:"zh-CN",fontSize:14,streamingEnabled:!0,workspaceDir:"",recentDirs:[],effort:"medium",customTheme:hy,customThemeEnabled:!1,developerView:!1,setTheme:t=>a({theme:t}),setThemePreset:t=>a({themePresetId:t,customThemeEnabled:!1}),setLanguage:t=>a({language:t}),setFontSize:t=>a({fontSize:t}),setStreamingEnabled:t=>a({streamingEnabled:t}),setCustomTheme:t=>a(s=>({customTheme:{...s.customTheme,...t}})),setCustomThemeEnabled:t=>a({customThemeEnabled:t}),resetCustomTheme:()=>a({customTheme:hy}),setDeveloperView:t=>a({developerView:t}),setWorkspaceDir:t=>a(s=>{const i=t.trim();if(!i)return{workspaceDir:""};const o=[i,...s.recentDirs.filter(c=>c!==i)].slice(0,Nk);return{workspaceDir:i,recentDirs:o}}),setEffort:t=>a({effort:t})}),{name:"deepseekcode-settings-storage",version:5,migrate:(a,t)=>{const s=a;return t<2&&s&&typeof s=="object"&&((s.themePresetId==="github"||s.themePresetId==="mimo")&&(s.themePresetId="linear"),s.theme==="dark"&&(s.theme="light")),t<3&&s&&typeof s=="object"&&(s.recentDirs=Array.isArray(s.recentDirs)?s.recentDirs:[]),t<4&&s&&typeof s=="object"&&(delete s.yolo,delete s.autoSwarm,delete s.workspaceGuardBypass),t<5&&s&&typeof s=="object"&&(s.developerView=s.developerView===!0),s}}));var Xe;(function(a){a.assertEqual=o=>{};function t(o){}a.assertIs=t;function s(o){throw new Error}a.assertNever=s,a.arrayToEnum=o=>{const c={};for(const u of o)c[u]=u;return c},a.getValidEnumValues=o=>{const c=a.objectKeys(o).filter(d=>typeof o[o[d]]!="number"),u={};for(const d of c)u[d]=o[d];return a.objectValues(u)},a.objectValues=o=>a.objectKeys(o).map(function(c){return o[c]}),a.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{const c=[];for(const u in o)Object.prototype.hasOwnProperty.call(o,u)&&c.push(u);return c},a.find=(o,c)=>{for(const u of o)if(c(u))return u},a.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function i(o,c=" | "){return o.map(u=>typeof u=="string"?`'${u}'`:u).join(c)}a.joinValues=i,a.jsonStringifyReplacer=(o,c)=>typeof c=="bigint"?c.toString():c})(Xe||(Xe={}));var gy;(function(a){a.mergeShapes=(t,s)=>({...t,...s})})(gy||(gy={}));const oe=Xe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ha=a=>{switch(typeof a){case"undefined":return oe.undefined;case"string":return oe.string;case"number":return Number.isNaN(a)?oe.nan:oe.number;case"boolean":return oe.boolean;case"function":return oe.function;case"bigint":return oe.bigint;case"symbol":return oe.symbol;case"object":return Array.isArray(a)?oe.array:a===null?oe.null:a.then&&typeof a.then=="function"&&a.catch&&typeof a.catch=="function"?oe.promise:typeof Map<"u"&&a instanceof Map?oe.map:typeof Set<"u"&&a instanceof Set?oe.set:typeof Date<"u"&&a instanceof Date?oe.date:oe.object;default:return oe.unknown}},ee=Xe.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Us extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i]},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i]};const s=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,s):this.__proto__=s,this.name="ZodError",this.issues=t}format(t){const s=t||function(c){return c.message},i={_errors:[]},o=c=>{for(const u of c.issues)if(u.code==="invalid_union")u.unionErrors.map(o);else if(u.code==="invalid_return_type")o(u.returnTypeError);else if(u.code==="invalid_arguments")o(u.argumentsError);else if(u.path.length===0)i._errors.push(s(u));else{let d=i,p=0;for(;p<u.path.length;){const g=u.path[p];p===u.path.length-1?(d[g]=d[g]||{_errors:[]},d[g]._errors.push(s(u))):d[g]=d[g]||{_errors:[]},d=d[g],p++}}};return o(this),i}static assert(t){if(!(t instanceof Us))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Xe.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=s=>s.message){const s={},i=[];for(const o of this.issues)if(o.path.length>0){const c=o.path[0];s[c]=s[c]||[],s[c].push(t(o))}else i.push(t(o));return{formErrors:i,fieldErrors:s}}get formErrors(){return this.flatten()}}Us.create=a=>new Us(a);const hf=(a,t)=>{let s;switch(a.code){case ee.invalid_type:a.received===oe.undefined?s="Required":s=`Expected ${a.expected}, received ${a.received}`;break;case ee.invalid_literal:s=`Invalid literal value, expected ${JSON.stringify(a.expected,Xe.jsonStringifyReplacer)}`;break;case ee.unrecognized_keys:s=`Unrecognized key(s) in object: ${Xe.joinValues(a.keys,", ")}`;break;case ee.invalid_union:s="Invalid input";break;case ee.invalid_union_discriminator:s=`Invalid discriminator value. Expected ${Xe.joinValues(a.options)}`;break;case ee.invalid_enum_value:s=`Invalid enum value. Expected ${Xe.joinValues(a.options)}, received '${a.received}'`;break;case ee.invalid_arguments:s="Invalid function arguments";break;case ee.invalid_return_type:s="Invalid function return type";break;case ee.invalid_date:s="Invalid date";break;case ee.invalid_string:typeof a.validation=="object"?"includes"in a.validation?(s=`Invalid input: must include "${a.validation.includes}"`,typeof a.validation.position=="number"&&(s=`${s} at one or more positions greater than or equal to ${a.validation.position}`)):"startsWith"in a.validation?s=`Invalid input: must start with "${a.validation.startsWith}"`:"endsWith"in a.validation?s=`Invalid input: must end with "${a.validation.endsWith}"`:Xe.assertNever(a.validation):a.validation!=="regex"?s=`Invalid ${a.validation}`:s="Invalid";break;case ee.too_small:a.type==="array"?s=`Array must contain ${a.exact?"exactly":a.inclusive?"at least":"more than"} ${a.minimum} element(s)`:a.type==="string"?s=`String must contain ${a.exact?"exactly":a.inclusive?"at least":"over"} ${a.minimum} character(s)`:a.type==="number"?s=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="bigint"?s=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="date"?s=`Date must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(a.minimum))}`:s="Invalid input";break;case ee.too_big:a.type==="array"?s=`Array must contain ${a.exact?"exactly":a.inclusive?"at most":"less than"} ${a.maximum} element(s)`:a.type==="string"?s=`String must contain ${a.exact?"exactly":a.inclusive?"at most":"under"} ${a.maximum} character(s)`:a.type==="number"?s=`Number must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="bigint"?s=`BigInt must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="date"?s=`Date must be ${a.exact?"exactly":a.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(a.maximum))}`:s="Invalid input";break;case ee.custom:s="Invalid input";break;case ee.invalid_intersection_types:s="Intersection results could not be merged";break;case ee.not_multiple_of:s=`Number must be a multiple of ${a.multipleOf}`;break;case ee.not_finite:s="Number must be finite";break;default:s=t.defaultError,Xe.assertNever(a)}return{message:s}};let Ek=hf;function Ak(){return Ek}const jk=a=>{const{data:t,path:s,errorMaps:i,issueData:o}=a,c=[...s,...o.path||[]],u={...o,path:c};if(o.message!==void 0)return{...o,path:c,message:o.message};let d="";const p=i.filter(g=>!!g).slice().reverse();for(const g of p)d=g(u,{data:t,defaultError:d}).message;return{...o,path:c,message:d}};function ae(a,t){const s=Ak(),i=jk({issueData:t,data:a.data,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,s,s===hf?void 0:hf].filter(o=>!!o)});a.common.issues.push(i)}class tn{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,s){const i=[];for(const o of s){if(o.status==="aborted")return Ne;o.status==="dirty"&&t.dirty(),i.push(o.value)}return{status:t.value,value:i}}static async mergeObjectAsync(t,s){const i=[];for(const o of s){const c=await o.key,u=await o.value;i.push({key:c,value:u})}return tn.mergeObjectSync(t,i)}static mergeObjectSync(t,s){const i={};for(const o of s){const{key:c,value:u}=o;if(c.status==="aborted"||u.status==="aborted")return Ne;c.status==="dirty"&&t.dirty(),u.status==="dirty"&&t.dirty(),c.value!=="__proto__"&&(typeof u.value<"u"||o.alwaysSet)&&(i[c.value]=u.value)}return{status:t.value,value:i}}}const Ne=Object.freeze({status:"aborted"}),to=a=>({status:"dirty",value:a}),zn=a=>({status:"valid",value:a}),yy=a=>a.status==="aborted",by=a=>a.status==="dirty",Gi=a=>a.status==="valid",rc=a=>typeof Promise<"u"&&a instanceof Promise;var ce;(function(a){a.errToObj=t=>typeof t=="string"?{message:t}:t||{},a.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(ce||(ce={}));class rs{constructor(t,s,i,o){this._cachedPath=[],this.parent=t,this.data=s,this._path=i,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const vy=(a,t)=>{if(Gi(t))return{success:!0,data:t.value};if(!a.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const s=new Us(a.common.issues);return this._error=s,this._error}}};function Oe(a){if(!a)return{};const{errorMap:t,invalid_type_error:s,required_error:i,description:o}=a;if(t&&(s||i))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(u,d)=>{const{message:p}=a;return u.code==="invalid_enum_value"?{message:p??d.defaultError}:typeof d.data>"u"?{message:p??i??d.defaultError}:u.code!=="invalid_type"?{message:d.defaultError}:{message:p??s??d.defaultError}},description:o}}class qe{get description(){return this._def.description}_getType(t){return ha(t.data)}_getOrReturnCtx(t,s){return s||{common:t.parent.common,data:t.data,parsedType:ha(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new tn,ctx:{common:t.parent.common,data:t.data,parsedType:ha(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const s=this._parse(t);if(rc(s))throw new Error("Synchronous parse encountered promise.");return s}_parseAsync(t){const s=this._parse(t);return Promise.resolve(s)}parse(t,s){const i=this.safeParse(t,s);if(i.success)return i.data;throw i.error}safeParse(t,s){const i={common:{issues:[],async:(s==null?void 0:s.async)??!1,contextualErrorMap:s==null?void 0:s.errorMap},path:(s==null?void 0:s.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:ha(t)},o=this._parseSync({data:t,path:i.path,parent:i});return vy(i,o)}"~validate"(t){var i,o;const s={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:ha(t)};if(!this["~standard"].async)try{const c=this._parseSync({data:t,path:[],parent:s});return Gi(c)?{value:c.value}:{issues:s.common.issues}}catch(c){(o=(i=c==null?void 0:c.message)==null?void 0:i.toLowerCase())!=null&&o.includes("encountered")&&(this["~standard"].async=!0),s.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:s}).then(c=>Gi(c)?{value:c.value}:{issues:s.common.issues})}async parseAsync(t,s){const i=await this.safeParseAsync(t,s);if(i.success)return i.data;throw i.error}async safeParseAsync(t,s){const i={common:{issues:[],contextualErrorMap:s==null?void 0:s.errorMap,async:!0},path:(s==null?void 0:s.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:ha(t)},o=this._parse({data:t,path:i.path,parent:i}),c=await(rc(o)?o:Promise.resolve(o));return vy(i,c)}refine(t,s){const i=o=>typeof s=="string"||typeof s>"u"?{message:s}:typeof s=="function"?s(o):s;return this._refinement((o,c)=>{const u=t(o),d=()=>c.addIssue({code:ee.custom,...i(o)});return typeof Promise<"u"&&u instanceof Promise?u.then(p=>p?!0:(d(),!1)):u?!0:(d(),!1)})}refinement(t,s){return this._refinement((i,o)=>t(i)?!0:(o.addIssue(typeof s=="function"?s(i,o):s),!1))}_refinement(t){return new Vi({schema:this,typeName:Se.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:s=>this["~validate"](s)}}optional(){return ya.create(this,this._def)}nullable(){return Ki.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return as.create(this)}promise(){return dc.create(this,this._def)}or(t){return lc.create([this,t],this._def)}and(t){return cc.create(this,t,this._def)}transform(t){return new Vi({...Oe(this._def),schema:this,typeName:Se.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const s=typeof t=="function"?t:()=>t;return new Sf({...Oe(this._def),innerType:this,defaultValue:s,typeName:Se.ZodDefault})}brand(){return new Jk({typeName:Se.ZodBranded,type:this,...Oe(this._def)})}catch(t){const s=typeof t=="function"?t:()=>t;return new kf({...Oe(this._def),innerType:this,catchValue:s,typeName:Se.ZodCatch})}describe(t){const s=this.constructor;return new s({...this._def,description:t})}pipe(t){return Gf.create(this,t)}readonly(){return wf.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Rk=/^c[^\s-]{8,}$/i,Mk=/^[0-9a-z]+$/,Ok=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Bk=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Dk=/^[a-z0-9_-]{21}$/i,Lk=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,zk=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Uk=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ik="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Ud;const $k=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Hk=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Pk=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Fk=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Gk=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,qk=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Pb="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Wk=new RegExp(`^${Pb}$`);function Fb(a){let t="[0-5]\\d";a.precision?t=`${t}\\.\\d{${a.precision}}`:a.precision==null&&(t=`${t}(\\.\\d+)?`);const s=a.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${s}`}function Vk(a){return new RegExp(`^${Fb(a)}$`)}function Kk(a){let t=`${Pb}T${Fb(a)}`;const s=[];return s.push(a.local?"Z?":"Z"),a.offset&&s.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${s.join("|")})`,new RegExp(`^${t}$`)}function Yk(a,t){return!!((t==="v4"||!t)&&$k.test(a)||(t==="v6"||!t)&&Pk.test(a))}function Zk(a,t){if(!Lk.test(a))return!1;try{const[s]=a.split(".");if(!s)return!1;const i=s.replace(/-/g,"+").replace(/_/g,"/").padEnd(s.length+(4-s.length%4)%4,"="),o=JSON.parse(atob(i));return!(typeof o!="object"||o===null||"typ"in o&&(o==null?void 0:o.typ)!=="JWT"||!o.alg||t&&o.alg!==t)}catch{return!1}}function Qk(a,t){return!!((t==="v4"||!t)&&Hk.test(a)||(t==="v6"||!t)&&Fk.test(a))}class zs extends qe{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==oe.string){const c=this._getOrReturnCtx(t);return ae(c,{code:ee.invalid_type,expected:oe.string,received:c.parsedType}),Ne}const i=new tn;let o;for(const c of this._def.checks)if(c.kind==="min")t.data.length<c.value&&(o=this._getOrReturnCtx(t,o),ae(o,{code:ee.too_small,minimum:c.value,type:"string",inclusive:!0,exact:!1,message:c.message}),i.dirty());else if(c.kind==="max")t.data.length>c.value&&(o=this._getOrReturnCtx(t,o),ae(o,{code:ee.too_big,maximum:c.value,type:"string",inclusive:!0,exact:!1,message:c.message}),i.dirty());else if(c.kind==="length"){const u=t.data.length>c.value,d=t.data.length<c.value;(u||d)&&(o=this._getOrReturnCtx(t,o),u?ae(o,{code:ee.too_big,maximum:c.value,type:"string",inclusive:!0,exact:!0,message:c.message}):d&&ae(o,{code:ee.too_small,minimum:c.value,type:"string",inclusive:!0,exact:!0,message:c.message}),i.dirty())}else if(c.kind==="email")Uk.test(t.data)||(o=this._getOrReturnCtx(t,o),ae(o,{validation:"email",code:ee.invalid_string,message:c.message}),i.dirty());else if(c.kind==="emoji")Ud||(Ud=new RegExp(Ik,"u")),Ud.test(t.data)||(o=this._getOrReturnCtx(t,o),ae(o,{validation:"emoji",code:ee.invalid_string,message:c.message}),i.dirty());else if(c.kind==="uuid")Bk.test(t.data)||(o=this._getOrReturnCtx(t,o),ae(o,{validation:"uuid",code:ee.invalid_string,message:c.message}),i.dirty());else if(c.kind==="nanoid")Dk.test(t.data)||(o=this._getOrReturnCtx(t,o),ae(o,{validation:"nanoid",code:ee.invalid_string,message:c.message}),i.dirty());else if(c.kind==="cuid")Rk.test(t.data)||(o=this._getOrReturnCtx(t,o),ae(o,{validation:"cuid",code:ee.invalid_string,message:c.message}),i.dirty());else if(c.kind==="cuid2")Mk.test(t.data)||(o=this._getOrReturnCtx(t,o),ae(o,{validation:"cuid2",code:ee.invalid_string,message:c.message}),i.dirty());else if(c.kind==="ulid")Ok.test(t.data)||(o=this._getOrReturnCtx(t,o),ae(o,{validation:"ulid",code:ee.invalid_string,message:c.message}),i.dirty());else if(c.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),ae(o,{validation:"url",code:ee.invalid_string,message:c.message}),i.dirty()}else c.kind==="regex"?(c.regex.lastIndex=0,c.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),ae(o,{validation:"regex",code:ee.invalid_string,message:c.message}),i.dirty())):c.kind==="trim"?t.data=t.data.trim():c.kind==="includes"?t.data.includes(c.value,c.position)||(o=this._getOrReturnCtx(t,o),ae(o,{code:ee.invalid_string,validation:{includes:c.value,position:c.position},message:c.message}),i.dirty()):c.kind==="toLowerCase"?t.data=t.data.toLowerCase():c.kind==="toUpperCase"?t.data=t.data.toUpperCase():c.kind==="startsWith"?t.data.startsWith(c.value)||(o=this._getOrReturnCtx(t,o),ae(o,{code:ee.invalid_string,validation:{startsWith:c.value},message:c.message}),i.dirty()):c.kind==="endsWith"?t.data.endsWith(c.value)||(o=this._getOrReturnCtx(t,o),ae(o,{code:ee.invalid_string,validation:{endsWith:c.value},message:c.message}),i.dirty()):c.kind==="datetime"?Kk(c).test(t.data)||(o=this._getOrReturnCtx(t,o),ae(o,{code:ee.invalid_string,validation:"datetime",message:c.message}),i.dirty()):c.kind==="date"?Wk.test(t.data)||(o=this._getOrReturnCtx(t,o),ae(o,{code:ee.invalid_string,validation:"date",message:c.message}),i.dirty()):c.kind==="time"?Vk(c).test(t.data)||(o=this._getOrReturnCtx(t,o),ae(o,{code:ee.invalid_string,validation:"time",message:c.message}),i.dirty()):c.kind==="duration"?zk.test(t.data)||(o=this._getOrReturnCtx(t,o),ae(o,{validation:"duration",code:ee.invalid_string,message:c.message}),i.dirty()):c.kind==="ip"?Yk(t.data,c.version)||(o=this._getOrReturnCtx(t,o),ae(o,{validation:"ip",code:ee.invalid_string,message:c.message}),i.dirty()):c.kind==="jwt"?Zk(t.data,c.alg)||(o=this._getOrReturnCtx(t,o),ae(o,{validation:"jwt",code:ee.invalid_string,message:c.message}),i.dirty()):c.kind==="cidr"?Qk(t.data,c.version)||(o=this._getOrReturnCtx(t,o),ae(o,{validation:"cidr",code:ee.invalid_string,message:c.message}),i.dirty()):c.kind==="base64"?Gk.test(t.data)||(o=this._getOrReturnCtx(t,o),ae(o,{validation:"base64",code:ee.invalid_string,message:c.message}),i.dirty()):c.kind==="base64url"?qk.test(t.data)||(o=this._getOrReturnCtx(t,o),ae(o,{validation:"base64url",code:ee.invalid_string,message:c.message}),i.dirty()):Xe.assertNever(c);return{status:i.value,value:t.data}}_regex(t,s,i){return this.refinement(o=>t.test(o),{validation:s,code:ee.invalid_string,...ce.errToObj(i)})}_addCheck(t){return new zs({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...ce.errToObj(t)})}url(t){return this._addCheck({kind:"url",...ce.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...ce.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...ce.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...ce.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...ce.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...ce.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...ce.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...ce.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...ce.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...ce.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...ce.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...ce.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(t==null?void 0:t.offset)??!1,local:(t==null?void 0:t.local)??!1,...ce.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...ce.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...ce.errToObj(t)})}regex(t,s){return this._addCheck({kind:"regex",regex:t,...ce.errToObj(s)})}includes(t,s){return this._addCheck({kind:"includes",value:t,position:s==null?void 0:s.position,...ce.errToObj(s==null?void 0:s.message)})}startsWith(t,s){return this._addCheck({kind:"startsWith",value:t,...ce.errToObj(s)})}endsWith(t,s){return this._addCheck({kind:"endsWith",value:t,...ce.errToObj(s)})}min(t,s){return this._addCheck({kind:"min",value:t,...ce.errToObj(s)})}max(t,s){return this._addCheck({kind:"max",value:t,...ce.errToObj(s)})}length(t,s){return this._addCheck({kind:"length",value:t,...ce.errToObj(s)})}nonempty(t){return this.min(1,ce.errToObj(t))}trim(){return new zs({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new zs({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new zs({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const s of this._def.checks)s.kind==="min"&&(t===null||s.value>t)&&(t=s.value);return t}get maxLength(){let t=null;for(const s of this._def.checks)s.kind==="max"&&(t===null||s.value<t)&&(t=s.value);return t}}zs.create=a=>new zs({checks:[],typeName:Se.ZodString,coerce:(a==null?void 0:a.coerce)??!1,...Oe(a)});function Xk(a,t){const s=(a.toString().split(".")[1]||"").length,i=(t.toString().split(".")[1]||"").length,o=s>i?s:i,c=Number.parseInt(a.toFixed(o).replace(".","")),u=Number.parseInt(t.toFixed(o).replace(".",""));return c%u/10**o}class qi extends qe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==oe.number){const c=this._getOrReturnCtx(t);return ae(c,{code:ee.invalid_type,expected:oe.number,received:c.parsedType}),Ne}let i;const o=new tn;for(const c of this._def.checks)c.kind==="int"?Xe.isInteger(t.data)||(i=this._getOrReturnCtx(t,i),ae(i,{code:ee.invalid_type,expected:"integer",received:"float",message:c.message}),o.dirty()):c.kind==="min"?(c.inclusive?t.data<c.value:t.data<=c.value)&&(i=this._getOrReturnCtx(t,i),ae(i,{code:ee.too_small,minimum:c.value,type:"number",inclusive:c.inclusive,exact:!1,message:c.message}),o.dirty()):c.kind==="max"?(c.inclusive?t.data>c.value:t.data>=c.value)&&(i=this._getOrReturnCtx(t,i),ae(i,{code:ee.too_big,maximum:c.value,type:"number",inclusive:c.inclusive,exact:!1,message:c.message}),o.dirty()):c.kind==="multipleOf"?Xk(t.data,c.value)!==0&&(i=this._getOrReturnCtx(t,i),ae(i,{code:ee.not_multiple_of,multipleOf:c.value,message:c.message}),o.dirty()):c.kind==="finite"?Number.isFinite(t.data)||(i=this._getOrReturnCtx(t,i),ae(i,{code:ee.not_finite,message:c.message}),o.dirty()):Xe.assertNever(c);return{status:o.value,value:t.data}}gte(t,s){return this.setLimit("min",t,!0,ce.toString(s))}gt(t,s){return this.setLimit("min",t,!1,ce.toString(s))}lte(t,s){return this.setLimit("max",t,!0,ce.toString(s))}lt(t,s){return this.setLimit("max",t,!1,ce.toString(s))}setLimit(t,s,i,o){return new qi({...this._def,checks:[...this._def.checks,{kind:t,value:s,inclusive:i,message:ce.toString(o)}]})}_addCheck(t){return new qi({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:ce.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ce.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ce.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ce.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ce.toString(t)})}multipleOf(t,s){return this._addCheck({kind:"multipleOf",value:t,message:ce.toString(s)})}finite(t){return this._addCheck({kind:"finite",message:ce.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ce.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ce.toString(t)})}get minValue(){let t=null;for(const s of this._def.checks)s.kind==="min"&&(t===null||s.value>t)&&(t=s.value);return t}get maxValue(){let t=null;for(const s of this._def.checks)s.kind==="max"&&(t===null||s.value<t)&&(t=s.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Xe.isInteger(t.value))}get isFinite(){let t=null,s=null;for(const i of this._def.checks){if(i.kind==="finite"||i.kind==="int"||i.kind==="multipleOf")return!0;i.kind==="min"?(s===null||i.value>s)&&(s=i.value):i.kind==="max"&&(t===null||i.value<t)&&(t=i.value)}return Number.isFinite(s)&&Number.isFinite(t)}}qi.create=a=>new qi({checks:[],typeName:Se.ZodNumber,coerce:(a==null?void 0:a.coerce)||!1,...Oe(a)});class yo extends qe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==oe.bigint)return this._getInvalidInput(t);let i;const o=new tn;for(const c of this._def.checks)c.kind==="min"?(c.inclusive?t.data<c.value:t.data<=c.value)&&(i=this._getOrReturnCtx(t,i),ae(i,{code:ee.too_small,type:"bigint",minimum:c.value,inclusive:c.inclusive,message:c.message}),o.dirty()):c.kind==="max"?(c.inclusive?t.data>c.value:t.data>=c.value)&&(i=this._getOrReturnCtx(t,i),ae(i,{code:ee.too_big,type:"bigint",maximum:c.value,inclusive:c.inclusive,message:c.message}),o.dirty()):c.kind==="multipleOf"?t.data%c.value!==BigInt(0)&&(i=this._getOrReturnCtx(t,i),ae(i,{code:ee.not_multiple_of,multipleOf:c.value,message:c.message}),o.dirty()):Xe.assertNever(c);return{status:o.value,value:t.data}}_getInvalidInput(t){const s=this._getOrReturnCtx(t);return ae(s,{code:ee.invalid_type,expected:oe.bigint,received:s.parsedType}),Ne}gte(t,s){return this.setLimit("min",t,!0,ce.toString(s))}gt(t,s){return this.setLimit("min",t,!1,ce.toString(s))}lte(t,s){return this.setLimit("max",t,!0,ce.toString(s))}lt(t,s){return this.setLimit("max",t,!1,ce.toString(s))}setLimit(t,s,i,o){return new yo({...this._def,checks:[...this._def.checks,{kind:t,value:s,inclusive:i,message:ce.toString(o)}]})}_addCheck(t){return new yo({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ce.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ce.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ce.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ce.toString(t)})}multipleOf(t,s){return this._addCheck({kind:"multipleOf",value:t,message:ce.toString(s)})}get minValue(){let t=null;for(const s of this._def.checks)s.kind==="min"&&(t===null||s.value>t)&&(t=s.value);return t}get maxValue(){let t=null;for(const s of this._def.checks)s.kind==="max"&&(t===null||s.value<t)&&(t=s.value);return t}}yo.create=a=>new yo({checks:[],typeName:Se.ZodBigInt,coerce:(a==null?void 0:a.coerce)??!1,...Oe(a)});class gf extends qe{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==oe.boolean){const i=this._getOrReturnCtx(t);return ae(i,{code:ee.invalid_type,expected:oe.boolean,received:i.parsedType}),Ne}return zn(t.data)}}gf.create=a=>new gf({typeName:Se.ZodBoolean,coerce:(a==null?void 0:a.coerce)||!1,...Oe(a)});class oc extends qe{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==oe.date){const c=this._getOrReturnCtx(t);return ae(c,{code:ee.invalid_type,expected:oe.date,received:c.parsedType}),Ne}if(Number.isNaN(t.data.getTime())){const c=this._getOrReturnCtx(t);return ae(c,{code:ee.invalid_date}),Ne}const i=new tn;let o;for(const c of this._def.checks)c.kind==="min"?t.data.getTime()<c.value&&(o=this._getOrReturnCtx(t,o),ae(o,{code:ee.too_small,message:c.message,inclusive:!0,exact:!1,minimum:c.value,type:"date"}),i.dirty()):c.kind==="max"?t.data.getTime()>c.value&&(o=this._getOrReturnCtx(t,o),ae(o,{code:ee.too_big,message:c.message,inclusive:!0,exact:!1,maximum:c.value,type:"date"}),i.dirty()):Xe.assertNever(c);return{status:i.value,value:new Date(t.data.getTime())}}_addCheck(t){return new oc({...this._def,checks:[...this._def.checks,t]})}min(t,s){return this._addCheck({kind:"min",value:t.getTime(),message:ce.toString(s)})}max(t,s){return this._addCheck({kind:"max",value:t.getTime(),message:ce.toString(s)})}get minDate(){let t=null;for(const s of this._def.checks)s.kind==="min"&&(t===null||s.value>t)&&(t=s.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const s of this._def.checks)s.kind==="max"&&(t===null||s.value<t)&&(t=s.value);return t!=null?new Date(t):null}}oc.create=a=>new oc({checks:[],coerce:(a==null?void 0:a.coerce)||!1,typeName:Se.ZodDate,...Oe(a)});class xy extends qe{_parse(t){if(this._getType(t)!==oe.symbol){const i=this._getOrReturnCtx(t);return ae(i,{code:ee.invalid_type,expected:oe.symbol,received:i.parsedType}),Ne}return zn(t.data)}}xy.create=a=>new xy({typeName:Se.ZodSymbol,...Oe(a)});class Sy extends qe{_parse(t){if(this._getType(t)!==oe.undefined){const i=this._getOrReturnCtx(t);return ae(i,{code:ee.invalid_type,expected:oe.undefined,received:i.parsedType}),Ne}return zn(t.data)}}Sy.create=a=>new Sy({typeName:Se.ZodUndefined,...Oe(a)});class ky extends qe{_parse(t){if(this._getType(t)!==oe.null){const i=this._getOrReturnCtx(t);return ae(i,{code:ee.invalid_type,expected:oe.null,received:i.parsedType}),Ne}return zn(t.data)}}ky.create=a=>new ky({typeName:Se.ZodNull,...Oe(a)});class yf extends qe{constructor(){super(...arguments),this._any=!0}_parse(t){return zn(t.data)}}yf.create=a=>new yf({typeName:Se.ZodAny,...Oe(a)});class bf extends qe{constructor(){super(...arguments),this._unknown=!0}_parse(t){return zn(t.data)}}bf.create=a=>new bf({typeName:Se.ZodUnknown,...Oe(a)});class va extends qe{_parse(t){const s=this._getOrReturnCtx(t);return ae(s,{code:ee.invalid_type,expected:oe.never,received:s.parsedType}),Ne}}va.create=a=>new va({typeName:Se.ZodNever,...Oe(a)});class wy extends qe{_parse(t){if(this._getType(t)!==oe.undefined){const i=this._getOrReturnCtx(t);return ae(i,{code:ee.invalid_type,expected:oe.void,received:i.parsedType}),Ne}return zn(t.data)}}wy.create=a=>new wy({typeName:Se.ZodVoid,...Oe(a)});class as extends qe{_parse(t){const{ctx:s,status:i}=this._processInputParams(t),o=this._def;if(s.parsedType!==oe.array)return ae(s,{code:ee.invalid_type,expected:oe.array,received:s.parsedType}),Ne;if(o.exactLength!==null){const u=s.data.length>o.exactLength.value,d=s.data.length<o.exactLength.value;(u||d)&&(ae(s,{code:u?ee.too_big:ee.too_small,minimum:d?o.exactLength.value:void 0,maximum:u?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),i.dirty())}if(o.minLength!==null&&s.data.length<o.minLength.value&&(ae(s,{code:ee.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),i.dirty()),o.maxLength!==null&&s.data.length>o.maxLength.value&&(ae(s,{code:ee.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),i.dirty()),s.common.async)return Promise.all([...s.data].map((u,d)=>o.type._parseAsync(new rs(s,u,s.path,d)))).then(u=>tn.mergeArray(i,u));const c=[...s.data].map((u,d)=>o.type._parseSync(new rs(s,u,s.path,d)));return tn.mergeArray(i,c)}get element(){return this._def.type}min(t,s){return new as({...this._def,minLength:{value:t,message:ce.toString(s)}})}max(t,s){return new as({...this._def,maxLength:{value:t,message:ce.toString(s)}})}length(t,s){return new as({...this._def,exactLength:{value:t,message:ce.toString(s)}})}nonempty(t){return this.min(1,t)}}as.create=(a,t)=>new as({type:a,minLength:null,maxLength:null,exactLength:null,typeName:Se.ZodArray,...Oe(t)});function Li(a){if(a instanceof Mt){const t={};for(const s in a.shape){const i=a.shape[s];t[s]=ya.create(Li(i))}return new Mt({...a._def,shape:()=>t})}else return a instanceof as?new as({...a._def,type:Li(a.element)}):a instanceof ya?ya.create(Li(a.unwrap())):a instanceof Ki?Ki.create(Li(a.unwrap())):a instanceof Wa?Wa.create(a.items.map(t=>Li(t))):a}class Mt extends qe{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),s=Xe.objectKeys(t);return this._cached={shape:t,keys:s},this._cached}_parse(t){if(this._getType(t)!==oe.object){const g=this._getOrReturnCtx(t);return ae(g,{code:ee.invalid_type,expected:oe.object,received:g.parsedType}),Ne}const{status:i,ctx:o}=this._processInputParams(t),{shape:c,keys:u}=this._getCached(),d=[];if(!(this._def.catchall instanceof va&&this._def.unknownKeys==="strip"))for(const g in o.data)u.includes(g)||d.push(g);const p=[];for(const g of u){const y=c[g],b=o.data[g];p.push({key:{status:"valid",value:g},value:y._parse(new rs(o,b,o.path,g)),alwaysSet:g in o.data})}if(this._def.catchall instanceof va){const g=this._def.unknownKeys;if(g==="passthrough")for(const y of d)p.push({key:{status:"valid",value:y},value:{status:"valid",value:o.data[y]}});else if(g==="strict")d.length>0&&(ae(o,{code:ee.unrecognized_keys,keys:d}),i.dirty());else if(g!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const g=this._def.catchall;for(const y of d){const b=o.data[y];p.push({key:{status:"valid",value:y},value:g._parse(new rs(o,b,o.path,y)),alwaysSet:y in o.data})}}return o.common.async?Promise.resolve().then(async()=>{const g=[];for(const y of p){const b=await y.key,x=await y.value;g.push({key:b,value:x,alwaysSet:y.alwaysSet})}return g}).then(g=>tn.mergeObjectSync(i,g)):tn.mergeObjectSync(i,p)}get shape(){return this._def.shape()}strict(t){return ce.errToObj,new Mt({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(s,i)=>{var c,u;const o=((u=(c=this._def).errorMap)==null?void 0:u.call(c,s,i).message)??i.defaultError;return s.code==="unrecognized_keys"?{message:ce.errToObj(t).message??o}:{message:o}}}:{}})}strip(){return new Mt({...this._def,unknownKeys:"strip"})}passthrough(){return new Mt({...this._def,unknownKeys:"passthrough"})}extend(t){return new Mt({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Mt({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Se.ZodObject})}setKey(t,s){return this.augment({[t]:s})}catchall(t){return new Mt({...this._def,catchall:t})}pick(t){const s={};for(const i of Xe.objectKeys(t))t[i]&&this.shape[i]&&(s[i]=this.shape[i]);return new Mt({...this._def,shape:()=>s})}omit(t){const s={};for(const i of Xe.objectKeys(this.shape))t[i]||(s[i]=this.shape[i]);return new Mt({...this._def,shape:()=>s})}deepPartial(){return Li(this)}partial(t){const s={};for(const i of Xe.objectKeys(this.shape)){const o=this.shape[i];t&&!t[i]?s[i]=o:s[i]=o.optional()}return new Mt({...this._def,shape:()=>s})}required(t){const s={};for(const i of Xe.objectKeys(this.shape))if(t&&!t[i])s[i]=this.shape[i];else{let c=this.shape[i];for(;c instanceof ya;)c=c._def.innerType;s[i]=c}return new Mt({...this._def,shape:()=>s})}keyof(){return Gb(Xe.objectKeys(this.shape))}}Mt.create=(a,t)=>new Mt({shape:()=>a,unknownKeys:"strip",catchall:va.create(),typeName:Se.ZodObject,...Oe(t)});Mt.strictCreate=(a,t)=>new Mt({shape:()=>a,unknownKeys:"strict",catchall:va.create(),typeName:Se.ZodObject,...Oe(t)});Mt.lazycreate=(a,t)=>new Mt({shape:a,unknownKeys:"strip",catchall:va.create(),typeName:Se.ZodObject,...Oe(t)});class lc extends qe{_parse(t){const{ctx:s}=this._processInputParams(t),i=this._def.options;function o(c){for(const d of c)if(d.result.status==="valid")return d.result;for(const d of c)if(d.result.status==="dirty")return s.common.issues.push(...d.ctx.common.issues),d.result;const u=c.map(d=>new Us(d.ctx.common.issues));return ae(s,{code:ee.invalid_union,unionErrors:u}),Ne}if(s.common.async)return Promise.all(i.map(async c=>{const u={...s,common:{...s.common,issues:[]},parent:null};return{result:await c._parseAsync({data:s.data,path:s.path,parent:u}),ctx:u}})).then(o);{let c;const u=[];for(const p of i){const g={...s,common:{...s.common,issues:[]},parent:null},y=p._parseSync({data:s.data,path:s.path,parent:g});if(y.status==="valid")return y;y.status==="dirty"&&!c&&(c={result:y,ctx:g}),g.common.issues.length&&u.push(g.common.issues)}if(c)return s.common.issues.push(...c.ctx.common.issues),c.result;const d=u.map(p=>new Us(p));return ae(s,{code:ee.invalid_union,unionErrors:d}),Ne}}get options(){return this._def.options}}lc.create=(a,t)=>new lc({options:a,typeName:Se.ZodUnion,...Oe(t)});function vf(a,t){const s=ha(a),i=ha(t);if(a===t)return{valid:!0,data:a};if(s===oe.object&&i===oe.object){const o=Xe.objectKeys(t),c=Xe.objectKeys(a).filter(d=>o.indexOf(d)!==-1),u={...a,...t};for(const d of c){const p=vf(a[d],t[d]);if(!p.valid)return{valid:!1};u[d]=p.data}return{valid:!0,data:u}}else if(s===oe.array&&i===oe.array){if(a.length!==t.length)return{valid:!1};const o=[];for(let c=0;c<a.length;c++){const u=a[c],d=t[c],p=vf(u,d);if(!p.valid)return{valid:!1};o.push(p.data)}return{valid:!0,data:o}}else return s===oe.date&&i===oe.date&&+a==+t?{valid:!0,data:a}:{valid:!1}}class cc extends qe{_parse(t){const{status:s,ctx:i}=this._processInputParams(t),o=(c,u)=>{if(yy(c)||yy(u))return Ne;const d=vf(c.value,u.value);return d.valid?((by(c)||by(u))&&s.dirty(),{status:s.value,value:d.data}):(ae(i,{code:ee.invalid_intersection_types}),Ne)};return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then(([c,u])=>o(c,u)):o(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}}cc.create=(a,t,s)=>new cc({left:a,right:t,typeName:Se.ZodIntersection,...Oe(s)});class Wa extends qe{_parse(t){const{status:s,ctx:i}=this._processInputParams(t);if(i.parsedType!==oe.array)return ae(i,{code:ee.invalid_type,expected:oe.array,received:i.parsedType}),Ne;if(i.data.length<this._def.items.length)return ae(i,{code:ee.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ne;!this._def.rest&&i.data.length>this._def.items.length&&(ae(i,{code:ee.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),s.dirty());const c=[...i.data].map((u,d)=>{const p=this._def.items[d]||this._def.rest;return p?p._parse(new rs(i,u,i.path,d)):null}).filter(u=>!!u);return i.common.async?Promise.all(c).then(u=>tn.mergeArray(s,u)):tn.mergeArray(s,c)}get items(){return this._def.items}rest(t){return new Wa({...this._def,rest:t})}}Wa.create=(a,t)=>{if(!Array.isArray(a))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Wa({items:a,typeName:Se.ZodTuple,rest:null,...Oe(t)})};class uc extends qe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:s,ctx:i}=this._processInputParams(t);if(i.parsedType!==oe.object)return ae(i,{code:ee.invalid_type,expected:oe.object,received:i.parsedType}),Ne;const o=[],c=this._def.keyType,u=this._def.valueType;for(const d in i.data)o.push({key:c._parse(new rs(i,d,i.path,d)),value:u._parse(new rs(i,i.data[d],i.path,d)),alwaysSet:d in i.data});return i.common.async?tn.mergeObjectAsync(s,o):tn.mergeObjectSync(s,o)}get element(){return this._def.valueType}static create(t,s,i){return s instanceof qe?new uc({keyType:t,valueType:s,typeName:Se.ZodRecord,...Oe(i)}):new uc({keyType:zs.create(),valueType:t,typeName:Se.ZodRecord,...Oe(s)})}}class Cy extends qe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:s,ctx:i}=this._processInputParams(t);if(i.parsedType!==oe.map)return ae(i,{code:ee.invalid_type,expected:oe.map,received:i.parsedType}),Ne;const o=this._def.keyType,c=this._def.valueType,u=[...i.data.entries()].map(([d,p],g)=>({key:o._parse(new rs(i,d,i.path,[g,"key"])),value:c._parse(new rs(i,p,i.path,[g,"value"]))}));if(i.common.async){const d=new Map;return Promise.resolve().then(async()=>{for(const p of u){const g=await p.key,y=await p.value;if(g.status==="aborted"||y.status==="aborted")return Ne;(g.status==="dirty"||y.status==="dirty")&&s.dirty(),d.set(g.value,y.value)}return{status:s.value,value:d}})}else{const d=new Map;for(const p of u){const g=p.key,y=p.value;if(g.status==="aborted"||y.status==="aborted")return Ne;(g.status==="dirty"||y.status==="dirty")&&s.dirty(),d.set(g.value,y.value)}return{status:s.value,value:d}}}}Cy.create=(a,t,s)=>new Cy({valueType:t,keyType:a,typeName:Se.ZodMap,...Oe(s)});class bo extends qe{_parse(t){const{status:s,ctx:i}=this._processInputParams(t);if(i.parsedType!==oe.set)return ae(i,{code:ee.invalid_type,expected:oe.set,received:i.parsedType}),Ne;const o=this._def;o.minSize!==null&&i.data.size<o.minSize.value&&(ae(i,{code:ee.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),s.dirty()),o.maxSize!==null&&i.data.size>o.maxSize.value&&(ae(i,{code:ee.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),s.dirty());const c=this._def.valueType;function u(p){const g=new Set;for(const y of p){if(y.status==="aborted")return Ne;y.status==="dirty"&&s.dirty(),g.add(y.value)}return{status:s.value,value:g}}const d=[...i.data.values()].map((p,g)=>c._parse(new rs(i,p,i.path,g)));return i.common.async?Promise.all(d).then(p=>u(p)):u(d)}min(t,s){return new bo({...this._def,minSize:{value:t,message:ce.toString(s)}})}max(t,s){return new bo({...this._def,maxSize:{value:t,message:ce.toString(s)}})}size(t,s){return this.min(t,s).max(t,s)}nonempty(t){return this.min(1,t)}}bo.create=(a,t)=>new bo({valueType:a,minSize:null,maxSize:null,typeName:Se.ZodSet,...Oe(t)});class _y extends qe{get schema(){return this._def.getter()}_parse(t){const{ctx:s}=this._processInputParams(t);return this._def.getter()._parse({data:s.data,path:s.path,parent:s})}}_y.create=(a,t)=>new _y({getter:a,typeName:Se.ZodLazy,...Oe(t)});class xf extends qe{_parse(t){if(t.data!==this._def.value){const s=this._getOrReturnCtx(t);return ae(s,{received:s.data,code:ee.invalid_literal,expected:this._def.value}),Ne}return{status:"valid",value:t.data}}get value(){return this._def.value}}xf.create=(a,t)=>new xf({value:a,typeName:Se.ZodLiteral,...Oe(t)});function Gb(a,t){return new Wi({values:a,typeName:Se.ZodEnum,...Oe(t)})}class Wi extends qe{_parse(t){if(typeof t.data!="string"){const s=this._getOrReturnCtx(t),i=this._def.values;return ae(s,{expected:Xe.joinValues(i),received:s.parsedType,code:ee.invalid_type}),Ne}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const s=this._getOrReturnCtx(t),i=this._def.values;return ae(s,{received:s.data,code:ee.invalid_enum_value,options:i}),Ne}return zn(t.data)}get options(){return this._def.values}get enum(){const t={};for(const s of this._def.values)t[s]=s;return t}get Values(){const t={};for(const s of this._def.values)t[s]=s;return t}get Enum(){const t={};for(const s of this._def.values)t[s]=s;return t}extract(t,s=this._def){return Wi.create(t,{...this._def,...s})}exclude(t,s=this._def){return Wi.create(this.options.filter(i=>!t.includes(i)),{...this._def,...s})}}Wi.create=Gb;class Ty extends qe{_parse(t){const s=Xe.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(t);if(i.parsedType!==oe.string&&i.parsedType!==oe.number){const o=Xe.objectValues(s);return ae(i,{expected:Xe.joinValues(o),received:i.parsedType,code:ee.invalid_type}),Ne}if(this._cache||(this._cache=new Set(Xe.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const o=Xe.objectValues(s);return ae(i,{received:i.data,code:ee.invalid_enum_value,options:o}),Ne}return zn(t.data)}get enum(){return this._def.values}}Ty.create=(a,t)=>new Ty({values:a,typeName:Se.ZodNativeEnum,...Oe(t)});class dc extends qe{unwrap(){return this._def.type}_parse(t){const{ctx:s}=this._processInputParams(t);if(s.parsedType!==oe.promise&&s.common.async===!1)return ae(s,{code:ee.invalid_type,expected:oe.promise,received:s.parsedType}),Ne;const i=s.parsedType===oe.promise?s.data:Promise.resolve(s.data);return zn(i.then(o=>this._def.type.parseAsync(o,{path:s.path,errorMap:s.common.contextualErrorMap})))}}dc.create=(a,t)=>new dc({type:a,typeName:Se.ZodPromise,...Oe(t)});class Vi extends qe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Se.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:s,ctx:i}=this._processInputParams(t),o=this._def.effect||null,c={addIssue:u=>{ae(i,u),u.fatal?s.abort():s.dirty()},get path(){return i.path}};if(c.addIssue=c.addIssue.bind(c),o.type==="preprocess"){const u=o.transform(i.data,c);if(i.common.async)return Promise.resolve(u).then(async d=>{if(s.value==="aborted")return Ne;const p=await this._def.schema._parseAsync({data:d,path:i.path,parent:i});return p.status==="aborted"?Ne:p.status==="dirty"||s.value==="dirty"?to(p.value):p});{if(s.value==="aborted")return Ne;const d=this._def.schema._parseSync({data:u,path:i.path,parent:i});return d.status==="aborted"?Ne:d.status==="dirty"||s.value==="dirty"?to(d.value):d}}if(o.type==="refinement"){const u=d=>{const p=o.refinement(d,c);if(i.common.async)return Promise.resolve(p);if(p instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return d};if(i.common.async===!1){const d=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return d.status==="aborted"?Ne:(d.status==="dirty"&&s.dirty(),u(d.value),{status:s.value,value:d.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(d=>d.status==="aborted"?Ne:(d.status==="dirty"&&s.dirty(),u(d.value).then(()=>({status:s.value,value:d.value}))))}if(o.type==="transform")if(i.common.async===!1){const u=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!Gi(u))return Ne;const d=o.transform(u.value,c);if(d instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:s.value,value:d}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(u=>Gi(u)?Promise.resolve(o.transform(u.value,c)).then(d=>({status:s.value,value:d})):Ne);Xe.assertNever(o)}}Vi.create=(a,t,s)=>new Vi({schema:a,typeName:Se.ZodEffects,effect:t,...Oe(s)});Vi.createWithPreprocess=(a,t,s)=>new Vi({schema:t,effect:{type:"preprocess",transform:a},typeName:Se.ZodEffects,...Oe(s)});class ya extends qe{_parse(t){return this._getType(t)===oe.undefined?zn(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}ya.create=(a,t)=>new ya({innerType:a,typeName:Se.ZodOptional,...Oe(t)});class Ki extends qe{_parse(t){return this._getType(t)===oe.null?zn(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Ki.create=(a,t)=>new Ki({innerType:a,typeName:Se.ZodNullable,...Oe(t)});class Sf extends qe{_parse(t){const{ctx:s}=this._processInputParams(t);let i=s.data;return s.parsedType===oe.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:s.path,parent:s})}removeDefault(){return this._def.innerType}}Sf.create=(a,t)=>new Sf({innerType:a,typeName:Se.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Oe(t)});class kf extends qe{_parse(t){const{ctx:s}=this._processInputParams(t),i={...s,common:{...s.common,issues:[]}},o=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return rc(o)?o.then(c=>({status:"valid",value:c.status==="valid"?c.value:this._def.catchValue({get error(){return new Us(i.common.issues)},input:i.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Us(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}}kf.create=(a,t)=>new kf({innerType:a,typeName:Se.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Oe(t)});class Ny extends qe{_parse(t){if(this._getType(t)!==oe.nan){const i=this._getOrReturnCtx(t);return ae(i,{code:ee.invalid_type,expected:oe.nan,received:i.parsedType}),Ne}return{status:"valid",value:t.data}}}Ny.create=a=>new Ny({typeName:Se.ZodNaN,...Oe(a)});class Jk extends qe{_parse(t){const{ctx:s}=this._processInputParams(t),i=s.data;return this._def.type._parse({data:i,path:s.path,parent:s})}unwrap(){return this._def.type}}class Gf extends qe{_parse(t){const{status:s,ctx:i}=this._processInputParams(t);if(i.common.async)return(async()=>{const c=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return c.status==="aborted"?Ne:c.status==="dirty"?(s.dirty(),to(c.value)):this._def.out._parseAsync({data:c.value,path:i.path,parent:i})})();{const o=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return o.status==="aborted"?Ne:o.status==="dirty"?(s.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:i.path,parent:i})}}static create(t,s){return new Gf({in:t,out:s,typeName:Se.ZodPipeline})}}class wf extends qe{_parse(t){const s=this._def.innerType._parse(t),i=o=>(Gi(o)&&(o.value=Object.freeze(o.value)),o);return rc(s)?s.then(o=>i(o)):i(s)}unwrap(){return this._def.innerType}}wf.create=(a,t)=>new wf({innerType:a,typeName:Se.ZodReadonly,...Oe(t)});var Se;(function(a){a.ZodString="ZodString",a.ZodNumber="ZodNumber",a.ZodNaN="ZodNaN",a.ZodBigInt="ZodBigInt",a.ZodBoolean="ZodBoolean",a.ZodDate="ZodDate",a.ZodSymbol="ZodSymbol",a.ZodUndefined="ZodUndefined",a.ZodNull="ZodNull",a.ZodAny="ZodAny",a.ZodUnknown="ZodUnknown",a.ZodNever="ZodNever",a.ZodVoid="ZodVoid",a.ZodArray="ZodArray",a.ZodObject="ZodObject",a.ZodUnion="ZodUnion",a.ZodDiscriminatedUnion="ZodDiscriminatedUnion",a.ZodIntersection="ZodIntersection",a.ZodTuple="ZodTuple",a.ZodRecord="ZodRecord",a.ZodMap="ZodMap",a.ZodSet="ZodSet",a.ZodFunction="ZodFunction",a.ZodLazy="ZodLazy",a.ZodLiteral="ZodLiteral",a.ZodEnum="ZodEnum",a.ZodEffects="ZodEffects",a.ZodNativeEnum="ZodNativeEnum",a.ZodOptional="ZodOptional",a.ZodNullable="ZodNullable",a.ZodDefault="ZodDefault",a.ZodCatch="ZodCatch",a.ZodPromise="ZodPromise",a.ZodBranded="ZodBranded",a.ZodPipeline="ZodPipeline",a.ZodReadonly="ZodReadonly"})(Se||(Se={}));const ue=zs.create,qt=qi.create,qb=gf.create,Ui=yf.create,ko=bf.create;va.create;const vo=as.create,nt=Mt.create,ew=lc.create;cc.create;Wa.create;const tw=uc.create,qf=xf.create,nw=Wi.create;dc.create;ya.create;Ki.create;function P(a){return{schema:ko(),...a}}const vc=[];let Ey=new Set;function kn(a){for(const t of a){if(Ey.has(t.type))throw new Error(`[protocol] duplicate event type: ${t.type}`);Ey.add(t.type),vc.push(t)}return a}function Pl(a){return vc.find(t=>t.type===a)}new Proxy({},{get:(a,t)=>{var s;return typeof t=="string"?(s=Pl(t))==null?void 0:s.schema:void 0},has:(a,t)=>{var s;return typeof t=="string"?!!((s=Pl(t))!=null&&s.schema):!1},ownKeys:()=>vc.map(a=>a.type),getOwnPropertyDescriptor:(a,t)=>{var s;return typeof t=="string"&&Pl(t)?{enumerable:!0,configurable:!0,value:(s=Pl(t))==null?void 0:s.schema}:void 0}});kn([P({type:"connected",description:"WebSocket 已连接",category:"session",emittedBy:["server"],handledByCli:!0,handledByWeb:!0}),P({type:"session_created",description:"新会话已创建",category:"session",emittedBy:["server","core"],handledByCli:!0,handledByWeb:!0,note:"CLI/Web 均已处理(Web: systemHandlers session_created)",schema:nt({id:ue(),title:ue().optional()}).partial()}),P({type:"session_resumed",description:"会话从存储中恢复",category:"session",emittedBy:["core","server"],handledByCli:!0,handledByWeb:!0,note:"CLI/Web 均已处理(Web: systemHandlers session_resumed)",schema:nt({id:ue()}).partial()}),P({type:"auth_required",description:"需要认证",category:"session",emittedBy:["server"],handledByCli:!0,handledByWeb:!0,note:"CLI 已处理(2026-07-18)"}),P({type:"auth_success",description:"认证成功",category:"session",emittedBy:["server"],handledByCli:!0,handledByWeb:!0,note:"CLI 已处理(2026-07-18)"}),P({type:"auth_failed",description:"认证失败",category:"session",emittedBy:["server"],handledByCli:!0,handledByWeb:!0,note:"CLI 已处理(2026-07-18)"}),P({type:"message_ack",description:"消息确认",category:"session",emittedBy:["client"],handledByCli:!1,handledByWeb:!1,note:"CLI 发送给服务器的入站事件,无需 handler"}),P({type:"workspace_changed",description:"工作空间已切换",category:"session",emittedBy:["server"],handledByCli:!0,handledByWeb:!0,schema:nt({workspaceDir:ue()}).partial()}),P({type:"session_switched",description:"会话已切换",category:"session",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已处理(2026-07-18); Web 已处理(切换 activeSessionId)",schema:nt({id:ue()}).partial()}),P({type:"disconnected",description:"连接断开",category:"session",emittedBy:["server"],handledByCli:!0,handledByWeb:!0})]);kn([P({type:"start",description:"AI 开始生成",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"content",description:"生成内容增量",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,schema:nt({content:ue()}).partial()}),P({type:"thinking",description:"思考过程增量",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,schema:nt({thinking:ue()}).partial()}),P({type:"tool_call",description:"工具调用流式增量",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"tool_result",description:"工具执行结果",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"tool_execution_start",description:"工具执行阶段开始(无流事件时段开始)",category:"stream",emittedBy:["core"],handledByCli:!1,handledByWeb:!1,note:"纯 core 内部遥测:供运行时暂停/恢复 stall 心跳与全局看门狗;CLI/Web 无 handler(前端无需展示),仅 queryEngine 消费"}),P({type:"tool_execution_end",description:"工具执行阶段结束(恢复 stall 心跳与全局看门狗)",category:"stream",emittedBy:["core"],handledByCli:!1,handledByWeb:!1,note:"配合 tool_execution_start:防止 180s 心跳把合法长等待误判为流挂起而 abort + 重放整轮工具调用;CLI/Web 无 handler"}),P({type:"tool_diff",description:"工具执行中的参数 diff 增量(P0-2 diffConsumer 生产者推送)",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"step_start",description:"步骤开始",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"step_thinking",description:"步骤思考",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"step_action",description:"步骤动作",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"step_complete",description:"步骤完成",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"turn_summary",description:"回合结束摘要(思考时长+工具计数+头条)",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI/Web 渲染为折叠摘要行(Thought for Ns, ran N …)"}),P({type:"cache_stats",description:"本轮 run 前缀缓存命中统计(命中/未命中 token、命中率、调用次数)",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"run 结束时由 queryEngine 发送;CLI/Web 在模型名旁展示命中率",schema:nt({cacheHitTokens:qt(),cacheMissTokens:qt(),cacheHitRate:qt().optional(),cacheStatsCalls:qt()}).partial()}),P({type:"web_search",description:"模型内置联网搜索状态(DeepSeek Responses web_search_call:searching/completed/failed)",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"由服务端执行搜索,客户端仅展示状态(🔍搜索中 → ✅完成)",schema:nt({state:ue()}).partial()}),P({type:"progress",description:"通用进度(当前未使用)",category:"stream",emittedBy:["none"],handledByCli:!1,handledByWeb:!1,deprecated:!0,note:"已定义但从未发送;SendMessageTool 的 progress 是消息类型而非 WS 事件"}),P({type:"complete",description:"生成完成",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"error",description:"生成错误",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,schema:nt({message:ue()}).partial()}),P({type:"generation_paused",description:"生成已暂停",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"generation_resumed",description:"生成已恢复",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"stall_detected",description:"流级卡死检测(自动重试/通知)",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"由 StreamHeartbeat 或 StallDetector 触发;CLI/Web 显示重试进度"}),P({type:"task_interrupted",description:"任务中断(服务重启/异常退出)",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"服务启动扫描时将 running activeRun 标记为 interrupted 后触发;提示用户使用 /continue 恢复生成,或用 /resume 切换会话"}),P({type:"step_prompt",description:"步骤提示(Web 路由用)",category:"stream",emittedBy:["none"],handledByCli:!1,handledByWeb:!0,note:"Web 路由的内部事件,不通过 WS 发送"})]);kn([P({type:"plan_start",description:"计划开始",category:"plan",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"由 EnterPlanMode 工具 emit"}),P({type:"plan_thinking",description:"计划思考",category:"plan",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"plan_tasks",description:"计划任务列表生成",category:"plan",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"由 ExitPlanMode 工具 emit(解析计划内容为任务列表);CLI handler 解析 data.tasks",schema:nt({tasks:vo(Ui())}).partial()}),P({type:"plan_task_start",description:"计划任务开始",category:"plan",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"plan_task_update",description:"计划任务更新",category:"plan",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"plan_task_result",description:"计划任务结果",category:"plan",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"plan_complete",description:"计划完成",category:"plan",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"由 ExitPlanMode 工具 emit(携带 currentPlan/proposedPlan)"}),P({type:"plan_error",description:"计划错误",category:"plan",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"plan_mode_change",description:"计划模式切换",category:"plan",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已添加 handler(2026-07-01);Web planHandlers 已处理(2026-08-07)"}),P({type:"plan_mode_enter",description:"进入计划模式(CLI 遗留)",category:"plan",emittedBy:["none"],handledByCli:!0,handledByWeb:!0,deprecated:!0,note:"兼容遗留代码,应改用 plan_mode_change"}),P({type:"plan_mode_exit",description:"退出计划模式(CLI 遗留)",category:"plan",emittedBy:["none"],handledByCli:!0,handledByWeb:!0,deprecated:!0,note:"兼容遗留代码,应改用 plan_mode_change"}),P({type:"plan_confirm",description:"计划等待确认",category:"plan",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已处理(2026-07-18); Web planHandlers 已处理(2026-08-07)"}),P({type:"plan_waiting",description:"计划等待用户输入",category:"plan",emittedBy:["none"],handledByCli:!0,handledByWeb:!1,note:"核心未发射(仅 CLI 兼容订阅),已从 emittedBy 移除 core"}),P({type:"plan_continue",description:"计划继续执行",category:"plan",emittedBy:["none"],handledByCli:!0,handledByWeb:!1,note:"核心未发射(仅 CLI 兼容订阅),已从 emittedBy 移除 core"}),P({type:"plan_settled",description:"计划已定稿",category:"plan",emittedBy:["none"],handledByCli:!0,handledByWeb:!1,note:"核心未发射(仅 CLI 兼容订阅),已从 emittedBy 移除 core"}),P({type:"plan_cleared",description:"计划已清除",category:"plan",emittedBy:["none"],handledByCli:!0,handledByWeb:!1,note:"核心未发射(仅 CLI 兼容订阅),已从 emittedBy 移除 core"}),P({type:"user_exit_plan_mode",description:"用户手动退出计划模式",category:"plan",emittedBy:["client"],handledByCli:!1,handledByWeb:!1,note:"入站事件(CLI→服务器),客户端无需 handler"}),P({type:"plan_task_complete",description:"计划任务完成(单个)",category:"plan",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"core TaskUpdateTool 在 completed/failed 时 emit,data 携带 id/title/status/result/error;CLI 与 Web 均更新看板并输出通知(toast / 状态区)",schema:nt({id:ue(),title:ue(),status:ue(),result:ue().optional(),error:ue().optional()}).partial()}),P({type:"plan_subagent_start",description:"Plan 设计子代理启动",category:"plan",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"PlanSubAgentTool 启动只读设计子代理时 emit;data 携带 scope/agentId/planSlug/title",schema:nt({scope:ue(),agentId:ue(),planSlug:ue().optional(),title:ue().optional()}).partial()}),P({type:"plan_subagent_done",description:"Plan 设计子代理完成",category:"plan",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"PlanSubAgentTool 子代理完成(成功或失败)时 emit;data 携带 scope/agentId/status/designDocPath/error",schema:nt({scope:ue(),agentId:ue(),status:ue(),designDocPath:ue().optional(),error:ue().optional()}).partial()})]);kn([P({type:"token_update",description:"Token 用量更新",category:"context",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"context_compressed",description:"上下文已压缩",category:"context",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"compaction_progress",description:"压缩进度更新",category:"context",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"context_analysis",description:"上下文分布分析",category:"context",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已处理(2026-07-18); Web 有 handler 但路由不可达"}),P({type:"threshold_warning",description:"Token 阈值警告",category:"context",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已处理(2026-07-18); Web 有 handler 但路由不可达"}),P({type:"threshold_error",description:"Token 阈值错误",category:"context",emittedBy:["none"],handledByCli:!1,handledByWeb:!1,deprecated:!0,note:"功能存在但被 context_blocked 覆盖,事件未使用"}),P({type:"context_blocked",description:"上下文已满,生成被阻止",category:"context",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已处理(2026-07-18); Web 有 handler 但路由不可达"}),P({type:"blocking_limit",description:"已达到阻止极限",category:"context",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已处理(2026-07-18); Web 有 handler 但路由不可达"}),P({type:"compaction_started",description:"压缩任务已启动(phase/trigger)",category:"context",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"compaction_finished",description:"压缩任务结束(done/failed/aborted)",category:"context",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"tool_retry",description:"工具重试",category:"context",emittedBy:["none"],handledByCli:!1,handledByWeb:!0,deprecated:!0,note:"重试信息已含于 tool_result/error,Web handler 保留但路由不可达"}),P({type:"model_fallback",description:"模型回退",category:"context",emittedBy:["none"],handledByCli:!1,handledByWeb:!0,deprecated:!0,note:"降级信息已含于 degradation_update,Web handler 保留但路由不可达"}),P({type:"usage",description:"Token 用量",category:"context",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"context_breakdown",description:"上下文容量分类占比(系统提示词/消息/工具/技能/MCP),供 Web 底部上下文条抽屉展示",category:"context",emittedBy:["core"],handledByCli:!1,handledByWeb:!0,note:"每轮 query 上下文组装后估算各组件 token,Web 端点状态栏上下文条上拉展示"})]);kn([P({type:"workflow_started",description:"工作流已启动",category:"workflow",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"data.nodes 携带 LLM 合成完整节点清单(含 type/children/priority,前端可分层渲染)",schema:nt({workflowId:ue().optional(),title:ue().optional(),goalId:ue().optional(),totalNodes:qt().optional(),nodes:vo(Ui()).optional()}).partial()}),P({type:"workflow_event",description:"工作流事件",category:"workflow",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"workflow_progress",description:"工作流进度",category:"workflow",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"nodeStatuses: 逐节点状态全量映射(断线重连可重建视图)",schema:nt({runId:ue().optional(),status:ue().optional(),completedNodes:qt().optional(),totalNodes:qt().optional(),tokensUsed:qt().optional(),tokensRemaining:qt().optional(),currentNodeId:ue().optional(),nodeStatuses:tw(ue(),ue()).optional()}).partial()}),P({type:"workflow_finished",description:"工作流完成",category:"workflow",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,schema:nt({runId:ue().optional(),status:ue().optional(),output:Ui().optional(),error:ue().optional()}).partial()}),P({type:"workflow_error",description:"工作流错误",category:"workflow",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"workflow_checkpoint",description:"工作流检查点",category:"workflow",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"workflow_node_start",description:"工作流节点开始",category:"workflow",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,schema:nt({nodeId:ue().optional(),title:ue().optional(),type:ue().optional()}).partial()}),P({type:"workflow_node_complete",description:"工作流节点完成",category:"workflow",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"durationMs: 节点耗时;attempts: retry 重试次数(retry 原语节点)",schema:nt({nodeId:ue().optional(),title:ue().optional(),status:ue().optional(),result:Ui().optional(),error:ue().optional(),durationMs:qt().optional(),attempts:qt().optional()}).partial()}),P({type:"workflow_node_retry",description:"工作流节点重试(retry 原语每次重试发出)",category:"workflow",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"attempt > 1 时发出;reason 为上一次尝试的失败原因",schema:nt({nodeId:ue().optional(),childId:ue().optional(),attempt:qt().optional(),maxAttempts:qt().optional(),reason:ue().optional()}).partial()}),P({type:"workflow_paused",description:"工作流已暂停",category:"workflow",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"workflow_resumed",description:"工作流已恢复",category:"workflow",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"workflow_cancelled",description:"工作流已取消",category:"workflow",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"workflow_recovered",description:"工作流已恢复(从故障)",category:"workflow",emittedBy:["none"],handledByCli:!1,handledByWeb:!1,deprecated:!0,note:"已被 workflow_resumed 覆盖,核心从未发送"}),P({type:"workflow_handoff",description:"ReAct 转交 workflow(范式切换)",category:"workflow",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"workflow_plan_ready",description:"范式路由:合成的 workflow IR 就绪,等待用户确认 start/cancel/change",category:"workflow",emittedBy:["core"],handledByCli:!1,handledByWeb:!0,note:"漂移修复:queryEngine 确认门此前已在发射但未注册;Web 在 PlanCard 展示确认门"}),P({type:"workflow_status",description:"workflow run 状态查询响应(状态对账:连接/重连后拉取终态)",category:"workflow",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"2026-08-14: 配合 get_workflow_status 请求,修复一次性事件流漏终态导致的 UI 卡死;runs[].nodeStatuses 为逐节点状态映射",schema:nt({runs:vo(Ui()).optional()}).partial()})]);kn([P({type:"task_update",description:"任务更新",category:"task",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已添加 handler(2026-07-01)"}),P({type:"task_output",description:"任务输出",category:"task",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已添加 handler(2026-07-01)"}),P({type:"task_finished",description:"任务完成",category:"task",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已添加 handler(2026-07-01)"}),P({type:"task_error",description:"任务错误",category:"task",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已添加 handler(2026-07-01)"}),P({type:"filejob_start",description:"文件处理任务开始(解析/渲染)",category:"task",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"对话内嵌文件处理面板;Web 已处理,CLI 已处理(2026-08-07 状态行)"}),P({type:"filejob_progress",description:"文件处理进度更新",category:"task",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"解析/渲染进度百分比",schema:nt({progress:qt()}).partial()}),P({type:"filejob_result",description:"文件处理完成(结果文件列表)",category:"task",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"携带 RenderedFileResult[]",schema:vo(Ui())}),P({type:"filejob_error",description:"文件处理失败",category:"task",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"脱敏错误详情"})]);kn([P({type:"goal_created",description:"目标已创建",category:"goal",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"2026-07-21: Web handled via goal_tasks/goal_task_update"}),P({type:"goal_tasks",description:"目标任务列表(批量初始化看板)",category:"goal",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"2026-07-21: 统一看板数据源"}),P({type:"goal_task_update",description:"目标任务更新",category:"goal",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"2026-07-21: Web 已添加 handler"}),P({type:"goal_update",description:"目标元信息更新(retitle / 看板整体刷新)",category:"goal",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"漂移修复:goalManager.retitle / GoalTool 此前已在发射但未注册;tasks 为空数组时 Web 清空看板"}),P({type:"goal_completed",description:"目标已完成(workflow 终态自动推导)",category:"goal",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"2026-08-14: 此前 goals.complete() 无任何调用点,goal 工作流跑完后 goal 永远停在 active —— 新增终态事件供两端对账"})]);kn([P({type:"hook_ask",description:"Hook 审批请求",category:"hook",emittedBy:["server"],handledByCli:!0,handledByWeb:!0}),P({type:"hook_allow",description:"Hook 允许响应",category:"hook",emittedBy:["client"],handledByCli:!1,handledByWeb:!1,note:"入站事件(CLI→服务器),无需 handler"}),P({type:"hook_deny",description:"Hook 拒绝响应",category:"hook",emittedBy:["client"],handledByCli:!1,handledByWeb:!1,note:"入站事件(CLI→服务器),无需 handler"}),P({type:"hook_response_ack",description:"Hook 响应确认",category:"hook",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已添加 handler(2026-07-01); Web systemHandlers 已处理(2026-08-07)"}),P({type:"ask_user_question",description:"向用户提问",category:"hook",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"question_answer_ack",description:"提问回答确认",category:"hook",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"Web useWebSocket 已处理(dismiss 提问弹窗)"}),P({type:"hook_auto_ack",description:"Hook 自动模式确认",category:"hook",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"Web 已处理(2026-08-07 toast 提示)"})]);kn([P({type:"mcp_update",description:"MCP 状态更新",category:"mcp",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已添加 handler(2026-07-01)"})]);kn([P({type:"doctor_result",description:"诊断完成",category:"diagnostic",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"degradation",description:"降级状态更新(遗留)",category:"diagnostic",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"degradation_update",description:"降级状态更新",category:"diagnostic",emittedBy:["core"],handledByCli:!0,handledByWeb:!0})]);kn([P({type:"commands_list",description:"命令列表(服务器→客户端)",category:"system",emittedBy:["core","server"],handledByCli:!0,handledByWeb:!0,note:"CLI 已处理(setDynamicCommands); Web systemHandlers 已处理(2026-08-07)"}),P({type:"ping",description:"心跳 Ping",category:"system",emittedBy:["client"],handledByCli:!1,handledByWeb:!1,note:"由 Server 的 WS 层自动处理"}),P({type:"pong",description:"心跳 Pong",category:"system",emittedBy:["server"],handledByCli:!1,handledByWeb:!1,note:"由 Client 的 WS 层自动处理"}),P({type:"log",description:"服务端日志",category:"system",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"notification",description:"通知消息",category:"system",emittedBy:["server"],handledByCli:!0,handledByWeb:!0}),P({type:"channel_message",description:"频道入站消息(转发到 Web UI)",category:"system",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已处理(2026-07-18); Web 已处理(2026-08-07 通知)"}),P({type:"channel_status",description:"频道连接状态变更",category:"system",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已处理(2026-07-18); Web 已处理(channelsStore)"}),P({type:"channel_error",description:"频道运行时错误",category:"system",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已处理(2026-07-18); Web 已处理(2026-08-07 通知)"}),P({type:"todo_update",description:"待办事项更新",category:"system",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"todo_item_done",description:"待办项完成",category:"system",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"运行时可能发送"}),P({type:"todo_progress",description:"待办进度",category:"system",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"运行时可能发送"}),P({type:"tombstone",description:"消息已删除/墓碑",category:"system",emittedBy:["none"],handledByCli:!1,handledByWeb:!1,deprecated:!0,note:"Web/CLI 本地消息删除渲染概念,无 WS 发射端"}),P({type:"status",description:"状态更新(modelName/connected/statusText)",category:"system",emittedBy:["core","server"],handledByCli:!0,handledByWeb:!0,schema:nt({modelName:ue(),connected:qb(),statusText:ue()}).partial()}),P({type:"model_name",description:"当前模型名称",category:"system",emittedBy:["core","server"],handledByCli:!0,handledByWeb:!0,schema:nt({model:ue()}).partial()}),P({type:"models_updated",description:"模型列表已更新(models.dev 快照刷新后广播)",category:"system",emittedBy:["server"],handledByCli:!1,handledByWeb:!1,note:"漂移修复:app.ts 模型端点写入后全量广播,但此前未注册;两端尚未接 handler,先做类型层登记"}),P({type:"throttle",description:"速率限制状态",category:"system",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"Web 已处理(2026-08-07 toast 提示)"}),P({type:"code_review_ready",description:"代码审查结果就绪",category:"system",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"Web 已处理(2026-08-07 toast 提示)"}),P({type:"pdca_phase",description:"PDCA 循环阶段",category:"system",emittedBy:["none"],handledByCli:!0,handledByWeb:!1,deprecated:!0,note:"已退役:5-phase light pipeline 被 WorkflowRuntime 取代"}),P({type:"command_start",description:"命令开始(Web 路由用)",category:"system",emittedBy:["none"],handledByCli:!1,handledByWeb:!0,deprecated:!0,note:"Web systemHandler 有 case 但核心无发送方,保留兼容"}),P({type:"command_complete",description:"命令完成(Web 路由用)",category:"system",emittedBy:["none"],handledByCli:!1,handledByWeb:!0,deprecated:!0,note:"Web systemHandler 有 case 但核心无发送方,保留兼容"}),P({type:"command_error",description:"命令错误(Web 路由用)",category:"system",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"core index.ts:1270 真实 emit;CLI useStreamHandlers:741 与 Web systemHandlers 均已处理"})]);kn([P({type:"tool.approval_required",description:"工具调用需要审批(无人值守运行触发,未放行即拒绝)",category:"inbox",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"无人值守/定时运行时写操作需审批的通知;Inbox 审批队列已移除,CLI/Web 仅提示状态"})]);kn([P({type:"automation.update",description:"自动化任务新增/更新/删除/状态变更",category:"automation",emittedBy:["server"],handledByCli:!0,handledByWeb:!0,note:"REST /api/automations 已可用;Web 自动化视图消费"}),P({type:"automation.run",description:"自动化触发运行(started/finished/error)",category:"automation",emittedBy:["core","server"],handledByCli:!0,handledByWeb:!0,note:"CLI 状态提示;Web RunDetail 消费"})]);const sw=/^[a-z][a-z0-9._-]*$/,fc=ue().min(1).max(128).regex(sw,"command id must match ^[a-z][a-z0-9._-]*$");nt({id:ue().min(1).max(128),command:fc,payload:ko().optional(),timeoutMs:qt().int().positive().max(3e5).optional(),sender:ue().max(128).optional()});nt({success:qb(),requestId:ue(),command:fc,result:ko().optional(),error:ue().optional(),durationMs:qt().min(0).optional()});const aw=nt({capability:fc,command:fc,description:ue().max(500).optional(),provider:ue().max(128).optional()});nt({version:qf("1"),capabilities:vo(aw)});const iw="1",rw=["ready","select","inspect","screenshot","highlight","command","event"],ow=nt({version:qf(iw),type:nw(rw),requestId:ue().min(1).max(128),payload:ko().optional()}).passthrough();nt({type:ue().min(1).max(128).regex(/^[a-z][a-z0-9._-]*$/,"event type must match ^[a-z][a-z0-9._-]*$"),payload:ko().optional(),source:ue().max(128).optional(),timestamp:qt().nonnegative().optional()});const lw="workspace_event";nt({type:qf(lw),sessionId:ue().optional(),data:ew([ue(),ow]).optional(),traceId:ue().optional()});const cw=vc.map(a=>({eventType:a.type,description:a.description,category:a.category,emittedBy:a.emittedBy,handledByCli:a.handledByCli,handledByWeb:a.handledByWeb,...a.deprecated!==void 0?{deprecated:a.deprecated}:{},...a.note!==void 0?{note:a.note}:{}}));function Bn(a){return a==="auto-plan"?"plan":a==="auto-act"?"act":a==="auto-goal"?"goal":a}function Ii(a){return a==="auto-plan"||a==="auto-act"||a==="auto-goal"}function uw(a){switch(a){case"plan":return"auto-plan";case"auto-plan":return"plan";case"act":return"auto-act";case"auto-act":return"act";case"goal":return"auto-goal";case"auto-goal":return"goal"}}const Kj=["plan","act","goal"];function Cf(a,t){return t?a==="plan"?"auto-plan":a==="act"?"auto-act":"auto-goal":a}function dw(a){const t=["plan","act","goal"],s=t.indexOf(Bn(a)),i=t[(s+1)%t.length]??"act";return Cf(i,Ii(a))}const fw={plan:{label:"Plan",accent:"blue"},"auto-plan":{label:"Auto-Plan",accent:"cyan"},act:{label:"Act",accent:"green"},"auto-act":{label:"Auto-Act",accent:"yellow"},goal:{label:"Goal",accent:"magenta"},"auto-goal":{label:"Auto-Goal",accent:"red"}},Yj={low:{label:"Low",accent:"green"},medium:{label:"Medium",accent:"cyan"},high:{label:"High",accent:"yellow"},critical:{label:"Critical",accent:"red"}},Zj={allow:{label:"Allow"},deny:{label:"Deny"},allow_session:{label:"Allow session"},auto:{label:"Auto mode"}};function pw(a){return a==="plan"||a==="auto-plan"||a==="act"||a==="auto-act"||a==="goal"||a==="auto-goal"?a:"auto-act"}function Yr(a){return a>=1e6?`${(a/1e6).toFixed(1)}M`:a>=1e3?`${Math.round(a/1e3)}K`:String(a)}function mw(a){return a<=0?"":a>=100?`${Math.round(a)}t/s`:`${a.toFixed(1)}t/s`}function Wb(a){if(a<=0)return"";if(a>=60){const t=Math.floor(a/60),s=a%60;return`${t}m${s}s`}return`${a}s`}function hw(a,t){switch(a){case"bash":case"shell":case"PowerShell":return`ran ${t} shell command${t>1?"s":""}`;case"read_file":return`read ${t} file${t>1?"s":""}`;case"write_file":return`wrote ${t} file${t>1?"s":""}`;case"edit_file":return`edited ${t} file${t>1?"s":""}`;default:return`ran ${t} ${a}${t>1?"s":""}`}}function Qj(a){const t=Object.entries(a.toolCounts).filter(([,o])=>o>0).sort((o,c)=>c[1]-o[1]),s=a.headline||`Thought for ${Wb(Math.max(1,Math.round(a.durationMs/1e3)))}`,i=t.map(([o,c])=>hw(o,c));return i.length>0?`${s}, ${i.join(", ")}`:s}function gw(a,t){const s=a.toLowerCase();return/\b(rm|del|delete|drop|truncate|format|mkfs)\b/.test(s)?"critical":/\b(bash|shell|exec|cmd|powershell|terminal)\b/.test(s)?/\b(rm\s+-rf|sudo|chmod\s+777|curl.*\|\s*(ba)?sh|wget.*-O|>\/dev\/|mkfs)\b/i.test(t)?"critical":"high":/\b(write|edit|save|upload|deploy|publish)\b/i.test(s)||/\b(install|uninstall|npm|pip|cargo|gem|apt|brew|choco|yum|dnf)\b/i.test(s)?"high":/\b(git|commit|push|merge|rebase)\b/i.test(s)?/\b(push|force|hard\s*reset|rebase)\b/i.test(t)?"high":"medium":/\b(http|fetch|curl|wget|api|request|download)\b/i.test(s)?"medium":/\b(read|open|list|ls|dir|cat|view|search|find|grep|glob)\b/i.test(s)?"low":"medium"}function yw(a,t){if(t==null)return null;if(/\b(bash|shell|exec|cmd|powershell|terminal)\b/i.test(a))return t||null;if(/\b(write|edit|save|create)\b/i.test(a)){const s=t.match(/(?:file_path|path|file)["\s:=]+([^\s",}]+)/i);return s?`${s[1]}
27
- ${t.slice(0,200)}`:t.slice(0,200)||null}return t&&t.length>0?t.length>200?`${t.slice(0,200)}...`:t:null}const Xj=["openai-chat-completions","openai-completions","openai-responses","anthropic-messages"];cw.map(a=>a.eventType);function bw(){return`err-${Date.now()}-${Math.random().toString(36).slice(2,7)}`}const $i=Ut(a=>({errors:[],push:(t,s,i,o,c)=>{let u="";return a(d=>{const p=d.errors.find(b=>!b.dismissed&&!b.action&&b.level===t&&b.title===s);if(p)return u=p.id,{errors:d.errors.map(b=>b.id===p.id?{...b,count:b.count+1,timestamp:Date.now()}:b)};const g=bw();u=g;const y={id:g,level:t,title:s,detail:i,action:o,timestamp:Date.now(),dismissed:!1,durationMs:c,count:1};return{errors:[...d.errors.slice(-49),y]}}),u},dismiss:t=>a(s=>({errors:s.errors.map(i=>i.id===t?{...i,dismissed:!0}:i)})),clearAll:()=>a({errors:[]})})),qn={info:(a,t,s)=>$i.getState().push("info",a,t,void 0,s),warn:(a,t,s)=>$i.getState().push("warning",a,t,void 0,s),error:(a,t,s)=>$i.getState().push("error",a,t,void 0,s),critical:(a,t,s)=>$i.getState().push("critical",a,t,void 0,s)},Zr=20,Wf=()=>{const a=window.location.protocol==="https:"?"wss:":"ws:",t=window.location.hostname,s=window.location.port,i=s?String(Number(s)+1):"",o=i?`${t}:${i}`:t;return`${a}//${o}/ws`},vw=Wf(),Ay="dscode_client_id";function xw(){try{const a=localStorage.getItem(Ay);if(a)return a;const t=`web-${typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():Math.random().toString(36).slice(2,10)}`;return localStorage.setItem(Ay,t),t}catch{return`web-${Math.random().toString(36).slice(2,10)}`}}class Sw{constructor(t){Fe(this,"ws",null);Fe(this,"url");Fe(this,"clientId",xw());Fe(this,"messageHandlers",new Set);Fe(this,"openHandlers",new Set);Fe(this,"closeHandlers",new Set);Fe(this,"errorHandlers",new Set);Fe(this,"reconnectAttempts",0);Fe(this,"reconnectHandlers",new Set);Fe(this,"reconnectSuccessHandlers",new Set);Fe(this,"reconnectGiveUpHandlers",new Set);Fe(this,"isManualClose",!1);Fe(this,"authenticated",!1);Fe(this,"sessionId",null);Fe(this,"heartbeatInterval",null);Fe(this,"reconnectTimer",null);Fe(this,"lastPongTime",0);Fe(this,"HEARTBEAT_INTERVAL",15e3);Fe(this,"HEARTBEAT_TIMEOUT",45e3);this.url=t||vw}setSessionId(t){this.sessionId=t}getSessionId(){return this.sessionId}getReconnectState(){var t;return{attempts:this.reconnectAttempts,maxAttempts:Zr,reconnecting:this.reconnectAttempts>0&&((t=this.ws)==null?void 0:t.readyState)!==WebSocket.OPEN}}onReconnectAttempt(t){return this.reconnectHandlers.add(t),()=>this.reconnectHandlers.delete(t)}onReconnectSuccess(t){return this.reconnectSuccessHandlers.add(t),()=>this.reconnectSuccessHandlers.delete(t)}onReconnectGiveUp(t){return this.reconnectGiveUpHandlers.add(t),()=>this.reconnectGiveUpHandlers.delete(t)}connect(){var i,o;if(((i=this.ws)==null?void 0:i.readyState)===WebSocket.OPEN||((o=this.ws)==null?void 0:o.readyState)===WebSocket.CONNECTING)return;this.isManualClose=!1;const t=new URLSearchParams;this.sessionId&&t.set("sessionId",this.sessionId),t.set("clientId",this.clientId);const s=t.toString()?`${this.url}?${t.toString()}`:this.url;this.ws=new WebSocket(s),this.ws.binaryType="arraybuffer",this.ws.onopen=()=>{var u;console.log("WebSocket connected");const c=this.reconnectAttempts>0;this.reconnectAttempts=0,this.lastPongTime=Date.now(),c&&this.reconnectSuccessHandlers.forEach(d=>d()),((u=this.ws)==null?void 0:u.readyState)===WebSocket.OPEN&&this.ws.send(JSON.stringify({type:"ping"})),this.startHeartbeat(),this.openHandlers.forEach(d=>d())},this.ws.onclose=()=>{console.log("WebSocket closed"),this.stopHeartbeat(),this.closeHandlers.forEach(c=>c()),this.isManualClose||this.scheduleReconnect()},this.ws.onerror=c=>{qn.error("WebSocket connection error",c.message||"Connection failed"),this.errorHandlers.forEach(u=>u())},this.ws.onmessage=c=>{this._onMessage(c)}}async _onMessage(t){var s,i;try{let o;if(t.data instanceof Blob?o=await t.data.text():t.data instanceof ArrayBuffer?o=new TextDecoder().decode(t.data):typeof t.data=="string"?o=t.data:o=String(t.data),o=o.trim(),!o)return;const c=JSON.parse(o);if(console.log("[WS←]",c.type,c.sessionId,JSON.stringify(c.data||c.message||"").slice(0,200)),(c.type==="pong"||c.type==="ping")&&(this.lastPongTime=Date.now(),c.type==="pong"))return;c.seq!==void 0&&c.seq>=0&&this.send({type:"message_ack",data:JSON.stringify({seq:c.seq})}),this.messageHandlers.forEach(u=>u(c))}catch(o){const c=((i=(s=t.data)==null?void 0:s.constructor)==null?void 0:i.name)||typeof t.data;let u;if(t.data instanceof Blob?u=`[Blob ${t.data.size} bytes]`:t.data instanceof ArrayBuffer?u=`[ArrayBuffer ${t.data.byteLength} bytes]`:u=String(t.data).slice(0,500),typeof t.data=="string"&&t.data.trim()){const d=t.data.trim();try{this.messageHandlers.forEach(p=>p({type:"log",data:JSON.stringify({level:"info",message:d})}));return}catch{}}qn.error("Failed to parse WebSocket message",`type=${c} data=${u} error=${o}`)}}startHeartbeat(){this.stopHeartbeat(),this.lastPongTime=Date.now(),this.heartbeatInterval=setInterval(()=>{var t,s;if(Date.now()-this.lastPongTime>this.HEARTBEAT_TIMEOUT){console.warn("[WS] Heartbeat timeout, reconnecting..."),this.stopHeartbeat(),this.isManualClose=!0,(t=this.ws)==null||t.close(),this.ws=null,this.scheduleReconnect();return}((s=this.ws)==null?void 0:s.readyState)===WebSocket.OPEN&&this.send({type:"ping"})},this.HEARTBEAT_INTERVAL)}stopHeartbeat(){this.heartbeatInterval&&(clearInterval(this.heartbeatInterval),this.heartbeatInterval=null)}scheduleReconnect(){if(this.reconnectAttempts++,this.reconnectAttempts>Zr){console.error(`[WS] Max reconnect attempts (${Zr}) reached — giving up.`),qn.error("WebSocket",`Connection lost — max reconnect attempts (${Zr}) reached. Refresh the page to try again.`),this.reconnectGiveUpHandlers.forEach(o=>o());return}const t=Math.min(3e3*Math.pow(2,this.reconnectAttempts),3e4),s=Math.random()*1e3-500,i=Math.max(100,Math.round(t+s));console.log(`[WS] Reconnecting... Attempt ${this.reconnectAttempts}, delay=${i}ms`),this.reconnectHandlers.forEach(o=>o(this.reconnectAttempts,Zr)),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},i)}disconnect(){var t;this.isManualClose=!0,this.reconnectAttempts=0,this.stopHeartbeat(),this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),(t=this.ws)==null||t.close(),this.ws=null}send(t){var s,i;if(((s=this.ws)==null?void 0:s.readyState)===WebSocket.OPEN){const o=JSON.stringify(t);console.log("[WS→]",t.type,t.sessionId,o.slice(0,200)),this.ws.send(o)}else console.warn("[WS] NOT CONNECTED — dropping:",t.type,t.sessionId,"readyState=",(i=this.ws)==null?void 0:i.readyState)}onMessage(t){return this.messageHandlers.add(t),()=>this.messageHandlers.delete(t)}onOpen(t){return this.openHandlers.add(t),()=>this.openHandlers.delete(t)}onClose(t){return this.closeHandlers.add(t),()=>this.closeHandlers.delete(t)}onError(t){return this.errorHandlers.add(t),()=>this.errorHandlers.delete(t)}get isConnected(){var t;return((t=this.ws)==null?void 0:t.readyState)===WebSocket.OPEN}setToken(t){try{sessionStorage.setItem("auth_token",t)}catch{}}get isAuthenticated(){return this.authenticated}setAuthenticated(t){this.authenticated=t}}const fe=new Sw;function jy(a,t){return`ext:${a}:${t.toLowerCase()}`}const Ds=Ut()(xa((a,t)=>({pendingApprovals:[],autoMode:!0,sessionAllowList:[],showConfigHint:!0,addApproval:s=>a(i=>({pendingApprovals:[...i.pendingApprovals,s]})),removeApproval:s=>a(i=>({pendingApprovals:i.pendingApprovals.filter(o=>o.approvalId!==s)})),clearApprovals:()=>a({pendingApprovals:[]}),setAutoMode:s=>a({autoMode:s}),addToSessionAllowList:(s,i)=>a(o=>{const c=i?jy(s,i):s;return o.sessionAllowList.includes(c)?o:{sessionAllowList:[...o.sessionAllowList,c]}}),isSessionAllowed:(s,i)=>{const o=t().sessionAllowList;return i?o.includes(jy(s,i)):o.includes(s)},setShowConfigHint:s=>a({showConfigHint:s})}),{name:"deepseekcode-hook-approval",partialize:a=>({autoMode:a.autoMode,showConfigHint:a.showConfigHint})}));function kw(a){if(!a)return 0;const t=(a.match(/[\u4e00-\u9fff]/g)||[]).length,s=a.length-t;return Math.ceil(t*1.5+s*.25)}const De=Ut((a,t)=>({currentUsage:{promptTokens:0,completionTokens:0,totalTokens:0,estimatedCost:0},maxContextTokens:1e6,degradation:null,compactingUntil:0,lastCompactInfo:null,compactionProgress:null,cacheStats:null,showTokenInfo:!1,model:"",modelRef:"",history:[],_hasBackendData:!1,tokenRate:0,sessionBaseTotal:0,workflowTokens:0,_lastTotal:0,_lastTotalTs:0,contextDistribution:null,thresholdWarning:null,retryState:null,contextBreakdown:null,setContextDistribution:s=>a({contextDistribution:s}),setContextBreakdown:s=>a({contextBreakdown:s}),setThresholdWarning:s=>a({thresholdWarning:s}),setRetryState:s=>a({retryState:s}),updateUsage:s=>a(i=>{const o=s.totalTokens??i.currentUsage.totalTokens,c=Date.now(),u=i._lastTotal,d=i._lastTotalTs;let p=i.tokenRate;if(d>0&&u>0&&c>d&&o>u){const g=o-u,y=(c-d)/1e3,b=g/y;p=p>0?p*.6+b*.4:b}return{currentUsage:{...i.currentUsage,...s},_hasBackendData:!0,tokenRate:p,_lastTotal:o,_lastTotalTs:c}}),setModel:s=>a({model:s}),setModelRef:s=>a({modelRef:s}),addWorkflowTokens:s=>a(i=>({workflowTokens:i.workflowTokens+(Number(s)||0)})),setMaxContextTokens:s=>a({maxContextTokens:s}),setDegradation:s=>a({degradation:s}),setCompacting:s=>a({compactingUntil:Date.now()+3e3,lastCompactInfo:s}),setCompactionProgress:s=>a({compactionProgress:s}),setCacheStats:s=>a({cacheStats:s}),accumulateCacheStats:(s,i)=>a(o=>{const c=o.cacheStats,u=((c==null?void 0:c.cacheHitTokens)??0)+s,d=((c==null?void 0:c.cacheMissTokens)??0)+i;return{cacheStats:{cacheHitTokens:u,cacheMissTokens:d,cacheHitRate:u+d>0?u/(u+d):void 0,cacheStatsCalls:((c==null?void 0:c.cacheStatsCalls)??0)+1}}}),setShowTokenInfo:s=>a({showTokenInfo:s}),addToHistory:s=>a(i=>({history:[...i.history.slice(-100),{timestamp:Date.now(),usage:s}]})),estimateTokens:s=>kw(s),recalculateFromMessages:s=>{if(!s||s.length===0){a({currentUsage:{promptTokens:0,completionTokens:0,totalTokens:0,estimatedCost:0},_hasBackendData:!1});return}if(t()._hasBackendData)return;const i=t().estimateTokens;let o=0,c=0;for(const p of s){let g=p.content||"";if(p.thinking&&(g+=" "+p.thinking),p.steps)for(const b of p.steps)b.thought&&(g+=" "+b.thought),b.action&&(g+=" "+b.action),b.result&&(g+=" "+b.result);if(p.toolCalls)for(const b of p.toolCalls)b.args&&(g+=" "+(typeof b.args=="string"?b.args:JSON.stringify(b.args)));const y=i(g);p.type==="user"?o+=y:c+=y}const u=o+c,d=o/1e6*.15+c/1e6*.6;a({currentUsage:{promptTokens:o,completionTokens:c,totalTokens:u,estimatedCost:d}})},resetUsage:()=>a(s=>({currentUsage:{promptTokens:0,completionTokens:0,totalTokens:0,estimatedCost:0},_hasBackendData:!1,sessionBaseTotal:s.currentUsage.totalTokens,workflowTokens:0,tokenRate:0,_lastTotal:0,_lastTotalTs:0,contextDistribution:null,thresholdWarning:null,contextBreakdown:null}))})),Vb="";function Xl(a){return`${Vb}${a}`}class ww{constructor(t){Fe(this,"baseUrl");this.baseUrl=t}async request(t,s={}){try{const i=sessionStorage.getItem("auth_token")??localStorage.getItem("auth_token"),o={"Content-Type":"application/json",...s.headers};i&&(o.Authorization=`Bearer ${i}`);const c=await fetch(`${this.baseUrl}${t}`,{headers:o,...s}),u=await c.json();return c.ok?u&&typeof u.success=="boolean"?{success:u.success,data:u.data,error:u.error}:{success:!0,data:u}:{success:!1,error:u.error||`HTTP ${c.status}`,data:u.data}}catch(i){return{success:!1,error:i instanceof Error?i.message:"Network error"}}}get(t){return this.request(t,{method:"GET"})}post(t,s){return this.request(t,{method:"POST",body:s?JSON.stringify(s):void 0})}put(t,s){return this.request(t,{method:"PUT",body:s?JSON.stringify(s):void 0})}delete(t,s){return this.request(t,{method:"DELETE",body:s?JSON.stringify(s):void 0})}patch(t,s){return this.request(t,{method:"PATCH",body:s?JSON.stringify(s):void 0})}}const $=new ww(Vb),Ge={providers:{presets:()=>$.get("/api/providers/presets"),refresh:()=>$.post("/api/providers/refresh"),testConnection:(a,t)=>$.post("/api/providers/test-connection",{baseUrl:a,apiKey:t})},models:{list:async()=>{var t;const a=await $.get("/api/models");return a.success&&((t=a.data)!=null&&t.models)&&(a.data.models=a.data.models.map(s=>({...s,isGlobalDefault:s.isDefault===!0}))),a},get:a=>$.get(`/api/models/${a}`),create:a=>$.post("/api/models",a),update:(a,t,s)=>$.post("/api/models/update",{provider:a,modelId:t,...s}),delete:(a,t)=>$.post("/api/models/delete",{provider:a,modelId:t}),test:a=>$.post(`/api/models/${a}/test`),fetch:(a,t,s)=>$.post("/api/models/fetch",{baseUrl:a,apiKey:t,fullPath:s}),byProvider:(a,t)=>{const s=new URLSearchParams({provider:a});return t&&s.set("q",t),$.get(`/api/models/by-provider?${s.toString()}`)},catalogSearch:a=>{const t=new URLSearchParams;a.q&&t.set("q",a.q),a.toolCall&&t.set("toolCall","1"),a.reasoning&&t.set("reasoning","1"),a.minContext&&t.set("minContext",String(a.minContext)),a.limit&&t.set("limit",String(a.limit));const s=t.toString();return $.get(`/api/models/catalog${s?`?${s}`:""}`)},toggle:(a,t)=>$.post("/api/models/toggle",{provider:a,modelId:t}),setDefaults:a=>$.post("/api/models/defaults",a)},tools:{list:()=>$.get("/api/tools"),get:a=>$.get(`/api/tools/${a}`),update:(a,t)=>$.put(`/api/tools/${a}`,t),toggle:(a,t)=>$.post(`/api/tools/${a}/toggle`,{enabled:t})},connectors:{list:()=>$.get("/api/connectors"),get:a=>$.get(`/api/connectors/${encodeURIComponent(a)}`),toggle:(a,t,s)=>$.post(`/api/connectors/${encodeURIComponent(a)}/toggle`,{enabled:t,env:s}),addCustom:a=>$.post("/api/connectors/custom",a),removeCustom:a=>$.delete(`/api/connectors/custom/${encodeURIComponent(a)}`)},skills:{list:()=>$.get("/api/skills"),get:a=>$.get(`/api/skills/${a}`),create:a=>$.post("/api/skills",a),update:(a,t)=>$.put(`/api/skills/${a}`,t),toggle:(a,t)=>$.post(`/api/skills/${a}/toggle`,{enabled:t}),delete:a=>$.delete(`/api/skills/${a}`),import:a=>$.post("/api/skills/import",a),marketplaces:{list:()=>$.get("/api/skills/marketplaces"),add:a=>$.post("/api/skills/marketplaces",a),remove:a=>$.delete(`/api/skills/marketplaces/${a}`),get:a=>$.get(`/api/skills/marketplaces/${a}`),refresh:a=>$.post(`/api/skills/marketplaces/${a}/refresh`,{}),install:(a,t)=>$.post(`/api/skills/marketplaces/${a}/install`,{skillId:t})},workshop:{list:a=>$.get(`/api/skills/workshop${a?`?status=${a}`:""}`),propose:a=>$.post("/api/skills/workshop",a),apply:a=>$.post(`/api/skills/workshop/${a}/apply`,{}),reject:a=>$.post(`/api/skills/workshop/${a}/reject`,{})},config:{get:a=>$.get(`/api/skills/${a}/config`),update:(a,t)=>$.put(`/api/skills/${a}/config`,t)}},files:{list:a=>$.get(`/api/files${a?`?path=${encodeURIComponent(a)}`:""}`),read:a=>$.get(`/api/files/read?path=${encodeURIComponent(a)}`),create:(a,t)=>$.post("/api/files",{path:a,content:t}),update:(a,t)=>$.put("/api/files/write",{path:a,content:t}),delete:a=>$.delete(`/api/files?path=${encodeURIComponent(a)}`),download:async a=>{try{const t={},s=sessionStorage.getItem("auth_token")??localStorage.getItem("auth_token");s&&(t.Authorization=`Bearer ${s}`);const i=await fetch(Xl(`/api/files/download?path=${encodeURIComponent(a)}`),{headers:t});if(!i.ok){let d=`HTTP ${i.status}`;try{const p=await i.json();p!=null&&p.error&&(d=p.error)}catch{}return{success:!1,error:d}}const o=await i.blob(),c=URL.createObjectURL(o),u=document.createElement("a");return u.href=c,u.download=a.split(/[\\/]/).pop()||"download",u.click(),URL.revokeObjectURL(c),{success:!0}}catch(t){return{success:!1,error:t instanceof Error?t.message:"Download failed"}}},upload:async(a,t)=>{try{const s=await Cw(a);return $.post("/api/files/upload",{path:t,content:s,base64:!0})}catch(s){return{success:!1,error:s instanceof Error?s.message:"Upload failed"}}}},dirs:{list:a=>$.get(`/api/dirs${a?`?path=${encodeURIComponent(a)}`:""}`)},sessions:{list:()=>$.get("/api/sessions"),get:a=>$.get(`/api/sessions/${a}`),create:a=>$.post("/api/sessions",{title:a}),delete:a=>$.delete(`/api/sessions/${a}`),resume:a=>$.get(`/api/sessions/${encodeURIComponent(a)}/resume`)},trajectory:{events:async(a,t=0,s=500)=>{var u,d;const i=encodeURIComponent(a),o=await $.get(`/api/plugins/http/trajectory/api/events?sessionId=${i}&cursor=${t}&limit=${s}`);if(o.success&&Array.isArray((u=o.data)==null?void 0:u.events))return{success:!0,data:{events:o.data.events,hasMore:!!o.data.hasMore||o.data.events.length===s}};const c=await $.get(`/api/plugins/http/trajectory/api/trajectory?sid=${i}&off=${t}&lim=${s}`);if(c.success&&Array.isArray((d=c.data)==null?void 0:d.events)){const p=c.data.events,g=c.data.nextOffset??t+p.length,y=c.data.total??g;return{success:!0,data:{events:p,hasMore:g<y&&p.length>0}}}return{success:!1,error:o.error||c.error||"轨迹插件不可用"}}},tasks:{list:a=>$.get(a?`/api/tasks?sessionId=${encodeURIComponent(a)}`:"/api/tasks"),get:a=>$.get(`/api/tasks/${a}`),create:a=>$.post("/api/tasks",a),update:(a,t)=>$.put(`/api/tasks/${a}`,t),updateStatus:(a,t)=>$.patch(`/api/tasks/${a}/status`,{status:t}),delete:a=>$.delete(`/api/tasks/${a}`),clearCompleted:()=>$.delete("/api/tasks")},config:{provider:{get:()=>$.get("/api/config/provider"),save:a=>$.post("/api/config/provider",a),delete:a=>$.post("/api/config/provider/remove",{provider:a}),setDefault:a=>$.post("/api/config/provider",{provider:a,setDefault:!0})},files:{list:()=>$.get("/api/config/files"),read:a=>$.get(`/api/config/files/read?file=${encodeURIComponent(a)}`),write:(a,t)=>$.put("/api/config/files/write",{file:a,content:t})},context:{get:()=>$.get("/api/config/context"),save:a=>$.post("/api/config/context",a)}},git:{status:()=>$.get("/api/git/status"),branches:()=>$.get("/api/git/branches"),commit:a=>$.post("/api/git/commit",a),push:()=>$.post("/api/git/push"),checkout:a=>$.post("/api/git/checkout",{branch:a}),prStatus:()=>$.get("/api/repos/pr")},fileJob:{parse:a=>$.post("/api/filejob/parse",{files:a}),parsePaths:a=>$.post("/api/filejob/parse",{paths:a}),importPaths:a=>$.post("/api/filejob/import",{paths:a}),render:a=>$.post("/api/filejob/render",a)},system:{status:()=>$.get("/api/system/status"),restart:()=>$.post("/api/system/restart"),shutdown:()=>$.post("/api/system/shutdown")},observability:{summary:()=>$.get("/api/observability/summary"),costs:()=>$.get("/api/observability/costs"),listRuns:()=>$.get("/api/observability/runs"),getRun:a=>$.get(`/api/observability/runs/${encodeURIComponent(a)}`),getRunEvents:(a,t=0,s=50)=>$.get(`/api/observability/runs/${encodeURIComponent(a)}/events?page=${t}&size=${s}`)},templates:{list:()=>$.get("/api/templates"),get:a=>$.get(`/api/templates/${encodeURIComponent(a)}`),create:a=>$.post("/api/templates",a),update:(a,t)=>$.put(`/api/templates/${encodeURIComponent(a)}`,t),remove:a=>$.delete(`/api/templates/${encodeURIComponent(a)}`),versions:a=>$.get(`/api/templates/${encodeURIComponent(a)}/versions`),getVersion:(a,t)=>$.get(`/api/templates/${encodeURIComponent(a)}/versions/${t}`),render:(a,t)=>$.post(`/api/templates/${encodeURIComponent(a)}/render`,{inputs:t}),createFromRun:(a,t)=>$.post("/api/templates",{sourceRunId:a,generalize:(t==null?void 0:t.generalize)===!0,name:t==null?void 0:t.name,message:t==null?void 0:t.message})},workflows:{list:()=>$.get("/api/workflows"),start:a=>$.post("/api/workflows",a),get:a=>$.get(`/api/workflows/${encodeURIComponent(a)}`),synthesize:a=>$.post("/api/workflows/synthesize",{message:a})},plans:{list:()=>$.get("/api/plans"),read:a=>$.get(`/api/plans/${encodeURIComponent(a)}`),delete:a=>$.delete(`/api/plans/${encodeURIComponent(a)}`)},logs:{list:()=>$.get("/api/logs"),read:(a,t)=>$.get(`/api/logs/read?file=${encodeURIComponent(a)}${t?`&maxLines=${t}`:""}`),downloadUrl:a=>`/api/logs/download?file=${encodeURIComponent(a)}`},stt:{status:()=>$.get("/api/stt/status"),transcribe:(a,t,s="wav")=>$.post("/api/stt/transcribe",{language:a,audio:t,format:s}),install:a=>$.post("/api/stt/install",{backend:a}),installStatus:()=>$.get("/api/stt/install/status"),cancelInstall:()=>$.post("/api/stt/install/cancel")},hooks:{list:()=>$.get("/api/hooks/rules"),get:a=>$.get(`/api/hooks/rules/${encodeURIComponent(a)}`),create:a=>$.post("/api/hooks/rules",a),update:(a,t)=>$.put(`/api/hooks/rules/${encodeURIComponent(a)}`,t),delete:a=>$.delete(`/api/hooks/rules/${encodeURIComponent(a)}`),batchDelete:a=>$.post("/api/hooks/rules/batch-delete",{names:a}),toggle:(a,t)=>$.patch(`/api/hooks/rules/${encodeURIComponent(a)}/toggle`,{enabled:t}),batchToggle:(a,t)=>$.post("/api/hooks/rules/batch-toggle",{names:a,enabled:t}),dryRun:a=>$.post("/api/hooks/dry-run",a),stats:()=>$.get("/api/hooks/stats"),events:()=>$.get("/api/hooks/events"),agents:()=>$.get("/api/hooks/agents"),export:()=>$.get("/api/hooks/export"),import:a=>$.post("/api/hooks/import",a)},channels:{list:()=>$.get("/api/channels"),types:()=>$.get("/api/channels/types"),create:a=>$.post("/api/channels",a),update:(a,t)=>$.put(`/api/channels/${encodeURIComponent(a)}`,t),delete:a=>$.delete(`/api/channels/${encodeURIComponent(a)}`),toggle:(a,t)=>$.patch(`/api/channels/${encodeURIComponent(a)}/toggle`,{enabled:t}),test:a=>$.post(`/api/channels/${encodeURIComponent(a)}/test`),wechat:{qrcode:(a,t)=>$.get(`/api/channels/${encodeURIComponent(a)}/wechat/qrcode?token=${encodeURIComponent(t)}`),qrcodeStatus:(a,t,s)=>$.get(`/api/channels/${encodeURIComponent(a)}/wechat/qrcode/status?token=${encodeURIComponent(t)}&qrcode=${encodeURIComponent(s)}`)},weixin:{bind:()=>$.get("/api/weixin/bind"),bindStatus:a=>$.get(`/api/weixin/bind/status?qrcode=${encodeURIComponent(a)}`)}},automations:{list:()=>$.get("/api/automations"),create:a=>$.post("/api/automations",a),update:(a,t)=>$.put(`/api/automations/${encodeURIComponent(a)}`,t),remove:a=>$.delete(`/api/automations/${encodeURIComponent(a)}`),toggle:(a,t)=>$.post(`/api/automations/${encodeURIComponent(a)}/toggle`,{enabled:t}),run:a=>$.post(`/api/automations/${encodeURIComponent(a)}/run`),runs:a=>$.get(`/api/automations/${encodeURIComponent(a)}/runs`),addPermission:(a,t,s)=>$.post(`/api/automations/${encodeURIComponent(a)}/permissions`,{tool:t,target:s}),revokePermission:(a,t)=>$.delete(`/api/automations/${encodeURIComponent(a)}/permissions`,{entry:t})}};function Cw(a){return new Promise((t,s)=>{const i=new FileReader;i.onload=()=>{const o=i.result,c=o.indexOf(",");t(c>=0?o.slice(c+1):o)},i.onerror=()=>s(i.error||new Error("Failed to read file")),i.readAsDataURL(a)})}const Id=a=>a==="normal"?"act":a;let Fl=0;const _w=a=>a==="normal"?"normal":a==="auto"?"auto-act":pw(typeof a=="string"?a:void 0),Qr=a=>a==="normal"?"act":Ii(a)?"auto":Bn(a),Pi=Ut()(xa((a,t)=>({mode:"auto-act",currentPlanContent:null,modeHistory:[],thinkingStatusBySession:{},prePlanMode:null,setMode:s=>{const i=t().mode;if(i===s)return;a(g=>({mode:s,modeHistory:[...g.modeHistory,{previousMode:i,newMode:s,description:`Mode changed: ${i} -> ${s}`,timestamp:Date.now()}]})),Ds.getState().setAutoMode(s!=="normal"&&Ii(s));const o=Qr(i),c=Qr(s),u=i==="normal"?"act":Bn(i),d=s==="normal"?"act":Bn(s);if(u===d&&o===c)return;try{const g=Te.getState().activeSessionId||fe.getSessionId();g&&fe.send({type:"plan_mode_change",sessionId:g,data:JSON.stringify({previousMode:Qr(i),newMode:Qr(s),frontendMode:s,timestamp:Date.now()})})}catch(g){console.warn("[ExecutionModeStore] Failed to notify mode change via WS:",g)}const p=++Fl;Ge.models.list().then(g=>{var C;if(p!==Fl||!g.success||!((C=g.data)!=null&&C.models))return;const y=g.data.models.filter(T=>T.enabled!==!1),b=Bn(Id(s)),x=y.find(T=>T.defaultFor===b),S=y.find(T=>T.isDefault||T.defaultFor==="global"),k=x||S||y[0];k&&(De.getState().setModel(k.id),De.getState().setModelRef(`${k.provider}:${k.id}`))}).catch(g=>{console.warn("[ExecutionModeStore] Failed to refresh models:",g)})},applyBackendMode:s=>{const i=t().mode;if(i===s)return;a(c=>({mode:s,prePlanMode:s!=="plan"?null:c.prePlanMode,modeHistory:[...c.modeHistory,{previousMode:i,newMode:s,description:`Backend mode changed: ${i} -> ${s}`,timestamp:Date.now()}]})),Ds.getState().setAutoMode(s!=="normal"&&Ii(s));const o=++Fl;Ge.models.list().then(c=>{var b;if(o!==Fl||!c.success||!((b=c.data)!=null&&b.models))return;const u=c.data.models.filter(x=>x.enabled!==!1),d=Bn(Id(s)),p=u.find(x=>x.defaultFor===d),g=u.find(x=>x.isDefault||x.defaultFor==="global"),y=p||g||u[0];y&&(De.getState().setModel(y.id),De.getState().setModelRef(`${y.provider}:${y.id}`))}).catch(c=>{console.warn("[ExecutionModeStore] Failed to refresh models after backend mode change:",c)})},toggleMode:()=>{const s=t().mode,i=s==="normal"?"act":dw(s);t().setMode(i)},setBaseMode:s=>{const i=t().mode,o=i!=="normal"&&Ii(i);t().setMode(Cf(s,o))},setAuto:s=>{t().setMode(Cf(Bn(Id(t().mode)),s))},toggleAuto:()=>{const s=t().mode;t().setMode(s==="normal"?"auto-act":uw(s))},enterPlanMode:(s,i)=>{const o=t().mode,c=o!=="normal"&&Bn(o)!=="plan"?o:t().prePlanMode,u=o!=="normal"&&Bn(o)==="goal"?"goal":"plan";a(d=>({mode:u,prePlanMode:c,modeHistory:[...d.modeHistory,{previousMode:o,newMode:u,description:`Enter ${u} mode: ${i}`,timestamp:Date.now()}]})),Ds.getState().setAutoMode(!1)},exitPlanMode:(s,i)=>{const o=t().mode,c=t().prePlanMode,u=c&&(c==="normal"||Bn(c)!=="plan")?c:"act";a(d=>({mode:u,prePlanMode:null,modeHistory:[...d.modeHistory,{previousMode:o,newMode:u,description:`Exit to ${u} mode: ${i}`,timestamp:Date.now()}]})),Ds.getState().setAutoMode(u!=="normal"&&Ii(u))},enterGoalMode:(s,i)=>{const o=t().mode;a(c=>({mode:"goal",modeHistory:[...c.modeHistory,{previousMode:o,newMode:"goal",description:`Enter Goal mode: ${i}`,timestamp:Date.now()}]})),Ds.getState().setAutoMode(!1);try{const c=Te.getState().activeSessionId||fe.getSessionId()||void 0;fe.send({type:"plan_mode_change",sessionId:c,data:JSON.stringify({previousMode:Qr(o),newMode:"goal",frontendMode:"goal",goalDescription:i,timestamp:Date.now()})})}catch(c){console.warn("[ExecutionModeStore] Failed to notify goal mode change via WS:",c)}},exitGoalMode:()=>{const s=t().mode;a(i=>({mode:"act",modeHistory:[...i.modeHistory,{previousMode:s,newMode:"act",description:"Exit Goal mode",timestamp:Date.now()}]})),Ds.getState().setAutoMode(!1)},setPlanContent:s=>a({currentPlanContent:s}),setThinkingStatus:(s,i)=>a(o=>({thinkingStatusBySession:{...o.thinkingStatusBySession,[s]:i}})),getThinkingStatus:s=>t().thinkingStatusBySession[s]||"",reset:()=>a({mode:"auto-act",currentPlanContent:null,modeHistory:[],thinkingStatusBySession:{},prePlanMode:null})}),{name:"deepseekcode-plan-storage",version:1,migrate:a=>a,merge:(a,t)=>{const s=a??{};return{...t,...s,mode:_w(s.mode)}},partialize:a=>({mode:a.mode,currentPlanContent:a.currentPlanContent,modeHistory:a.modeHistory})}));function Kb(a){var t,s,i="";if(typeof a=="string"||typeof a=="number")i+=a;else if(typeof a=="object")if(Array.isArray(a)){var o=a.length;for(t=0;t<o;t++)a[t]&&(s=Kb(a[t]))&&(i&&(i+=" "),i+=s)}else for(s in a)a[s]&&(i&&(i+=" "),i+=s);return i}function Tw(){for(var a,t,s=0,i="",o=arguments.length;s<o;s++)(a=arguments[s])&&(t=Kb(a))&&(i&&(i+=" "),i+=t);return i}function vt(...a){return Tw(a)}const $d=200,Ry=(a,t)=>({runId:t,sessionId:a,status:"RUNNING",completedPhases:0,totalPhases:0,completedEffects:0,totalEffects:0,tokensUsed:0,tokensRemaining:0,updatedAt:Date.now()}),Gn=()=>Date.now(),is=(a,t)=>{const s=String(a||"").toLowerCase();return t||s==="done"||s==="success"||s==="completed"||s==="complete"?"completed":s==="running"||s==="in_progress"||s==="started"?"running":s==="failed"||s==="error"?"failed":s==="skipped"||s==="cancelled"||s==="canceled"?"skipped":"pending"},My=a=>a.id||`${a.type||"event"}-${a.timestamp||Gn()}-${Math.random().toString(36).slice(2,8)}`;function Hd(a){if(!Array.isArray(a)||a.length===0)return{totalPhases:0,completedNodes:0};const t=a.length,s=a.filter(i=>i.status==="completed"||i.status==="skipped"||i.status==="failed").length;return{totalPhases:t,completedNodes:s}}const Qe=Ut()(xa((a,t)=>({bySession:{},byRun:{},agentsBySession:{},tasksBySession:{},eventsBySession:{},plansBySession:{},upsert:(s,i)=>a(o=>{const c=i.runId,u=o.byRun[c]||o.bySession[s]||Ry(s,c),d={...u.agentNodes||{}};i.agentNode&&(d[i.agentNode.nodeId]=i.agentNode);const{agentNode:p,...g}=i,y={...u,...g,agentNodes:d,sessionId:s,runId:c,updatedAt:Gn()},b={...o.agentsBySession[s]||{}};p&&(b[p.nodeId]={...b[p.nodeId]||{},id:p.nodeId,sessionId:s,name:p.role,role:p.role,source:"workflow",runId:c,phase:p.phase,status:p.status,tokens:p.tokens,error:p.error,updatedAt:p.updatedAt||Gn()});const x=i.lastEventType||i.status||"workflow_update",k=[{id:My({type:x}),sessionId:s,type:x,source:"workflow",timestamp:Gn(),status:y.status,runId:c,agentId:p==null?void 0:p.nodeId,message:y.error,data:g},...o.eventsBySession[s]||[]].slice(0,$d);return{bySession:{...o.bySession,[s]:y},byRun:{...o.byRun,[c]:y},agentsBySession:{...o.agentsBySession,[s]:b},eventsBySession:{...o.eventsBySession,[s]:k}}}),fail:(s,i,o)=>t().upsert(s,{runId:i,status:"ERROR",error:o,lastEventType:"workflow_error"}),getForSession:s=>t().bySession[s],setPlan:(s,i)=>a(o=>({plansBySession:{...o.plansBySession,[s]:i}})),clearPlan:s=>a(i=>{if(!i.plansBySession[s])return{};const o={...i.plansBySession};return delete o[s],{plansBySession:o}}),getPlanForSession:s=>t().plansBySession[s],setNodes:(s,i,o)=>a(c=>{const u=c.byRun[i],d=u||c.bySession[s]||Ry(s,i),p=o.map(x=>{var S;return((S=d.nodes)==null?void 0:S.find(k=>k.id===x.id))||x}),{totalPhases:g,completedNodes:y}=Hd(p),b={...d,runId:i,sessionId:s,nodes:p,totalPhases:g||d.totalPhases,completedPhases:u?y||d.completedPhases:y,updatedAt:Gn()};return{bySession:{...c.bySession,[s]:b},byRun:{...c.byRun,[i]:b}}}),setNodeStatus:(s,i,o,c)=>a(u=>{const d=u.byRun[i],p=d||u.bySession[s];if(!p)return{};const g=(p.nodes||[]).map(S=>S.id===o?{...S,...c}:S),{totalPhases:y,completedNodes:b}=Hd(g),x={...p,nodes:g,totalPhases:y||p.totalPhases,completedPhases:d?b||p.completedPhases:b,updatedAt:Gn()};return{bySession:{...u.bySession,[s]:x},byRun:{...u.byRun,[i]:x}}}),finalizeNodes:(s,i,o)=>a(c=>{const u=c.byRun[i]||c.bySession[s];if(!u||!Array.isArray(u.nodes))return{};const d=u.nodes.map(b=>b.status==="pending"||b.status==="ready"||b.status==="blocked"?{...b,status:"skipped"}:b),{totalPhases:p,completedNodes:g}=Hd(d),y={...u,nodes:d,completedPhases:g||u.completedPhases,totalPhases:p||u.totalPhases,updatedAt:Gn()};return{bySession:{...c.bySession,[s]:y},byRun:{...c.byRun,[i]:y}}}),upsertAgent:(s,i)=>a(o=>{var d;const c=(d=o.agentsBySession[s])==null?void 0:d[i.id],u={id:i.id,sessionId:s,name:i.name||i.role||(c==null?void 0:c.name)||i.id,role:i.role||(c==null?void 0:c.role)||i.name||i.id,source:i.source||(c==null?void 0:c.source)||"agent",status:i.status||(c==null?void 0:c.status)||"idle",runId:i.runId??(c==null?void 0:c.runId),phase:i.phase??(c==null?void 0:c.phase),taskId:i.taskId??(c==null?void 0:c.taskId),currentTask:i.currentTask??(c==null?void 0:c.currentTask),tokens:i.tokens??(c==null?void 0:c.tokens),error:i.error??(c==null?void 0:c.error),updatedAt:i.updatedAt||Gn()};return{agentsBySession:{...o.agentsBySession,[s]:{...o.agentsBySession[s]||{},[i.id]:u}}}}),upsertTask:(s,i)=>a(o=>{var g;const c=(g=o.tasksBySession[s])==null?void 0:g[i.id],u=Gn(),d=i.status||(c==null?void 0:c.status)||"pending",p={id:i.id,sessionId:s,title:i.title||(c==null?void 0:c.title)||i.description||i.id,status:d,source:i.source||(c==null?void 0:c.source)||"task",description:i.description??(c==null?void 0:c.description),agentType:i.agentType??(c==null?void 0:c.agentType),progress:i.progress??(c==null?void 0:c.progress),result:i.result??(c==null?void 0:c.result),error:i.error??(c==null?void 0:c.error),runId:i.runId??(c==null?void 0:c.runId),dependencies:i.dependencies??(c==null?void 0:c.dependencies),startedAt:i.startedAt??(c==null?void 0:c.startedAt)??(d==="running"?u:void 0),completedAt:i.completedAt??(c==null?void 0:c.completedAt)??(d==="completed"||d==="failed"?u:void 0),createdAt:i.createdAt||(c==null?void 0:c.createdAt)||u,updatedAt:i.updatedAt||u,raw:i.raw??(c==null?void 0:c.raw)};return{tasksBySession:{...o.tasksBySession,[s]:{...o.tasksBySession[s]||{},[i.id]:p}}}}),setTasks:(s,i,o="plan")=>a(c=>{const u=c.tasksBySession[s]||{},d=Object.fromEntries(Object.entries(u).filter(([,y])=>y.source!==o)),p=Gn(),g=Object.fromEntries(i.map((y,b)=>{const x=u[y.id],S=y.status||(x==null?void 0:x.status)||"pending",k={id:y.id,sessionId:s,title:y.title||(x==null?void 0:x.title)||y.description||`Task ${b+1}`,status:S,source:y.source||o,description:y.description??(x==null?void 0:x.description),agentType:y.agentType??(x==null?void 0:x.agentType),progress:y.progress??(x==null?void 0:x.progress),result:y.result??(x==null?void 0:x.result),error:y.error??(x==null?void 0:x.error),runId:y.runId??(x==null?void 0:x.runId),dependencies:y.dependencies??(x==null?void 0:x.dependencies),startedAt:y.startedAt??(x==null?void 0:x.startedAt),completedAt:y.completedAt??(x==null?void 0:x.completedAt),createdAt:y.createdAt||(x==null?void 0:x.createdAt)||p+b,updatedAt:y.updatedAt||p,raw:y.raw??(x==null?void 0:x.raw)};return[k.id,k]}));return{tasksBySession:{...c.tasksBySession,[s]:{...d,...g}}}}),recordEvent:(s,i)=>a(o=>{const c={id:My(i),sessionId:s,type:i.type,source:i.source||"system",timestamp:i.timestamp||Gn(),title:i.title,message:i.message,status:i.status,runId:i.runId,agentId:i.agentId,taskId:i.taskId,data:i.data};return{eventsBySession:{...o.eventsBySession,[s]:[c,...o.eventsBySession[s]||[]].slice(0,$d)}}}),getAgentsForSession:s=>Object.values(t().agentsBySession[s]||{}).sort((i,o)=>o.updatedAt-i.updatedAt),getTasksForSession:s=>Object.values(t().tasksBySession[s]||{}).sort((i,o)=>{const c={running:0,pending:1,failed:2,completed:3,skipped:4};return c[i.status]-c[o.status]||i.createdAt-o.createdAt}),getEventsForSession:s=>t().eventsBySession[s]||[],getAgentTree:s=>{const i=Object.values(t().agentsBySession[s]||{}),o=new Map(i.map(p=>[p.id,p])),c=i.filter(p=>!p.parentId||!o.has(p.parentId)),u=p=>i.filter(g=>g.parentId===p),d=p=>({agent:p,children:u(p.id).map(d),isRunning:p.status==="running",tokensUsed:p.tokens||0});return c.map(d)},getRunningAgentCount:s=>Object.values(t().agentsBySession[s]||{}).filter(o=>o.status==="running").length}),{name:"deepseekcode-workflow-store",storage:Ff({key:"workflowStore",trims:[a=>({...a,state:{...a.state,eventsBySession:Object.fromEntries(Object.entries(a.state.eventsBySession).map(([t,s])=>[t,s.slice(-50)])),tasksBySession:Object.fromEntries(Object.entries(a.state.tasksBySession).map(([t,s])=>[t,Object.fromEntries(Object.entries(s).map(([i,o])=>[i,{...o,result:o.result?String(o.result).slice(0,1e3):void 0,error:o.error?String(o.error).slice(0,1e3):void 0}]))]))}}),a=>({...a,state:{...a.state,eventsBySession:{}}}),a=>({...a,state:{...a.state,tasksBySession:{},agentsBySession:{}}})],onFailure:()=>{try{Ls.getState().addToast("warning","任务看板数据保存失败:浏览器本地存储已满或不可用。当前数据仅保留在内存中,刷新页面将丢失。",8e3)}catch{}}}),partialize:a=>({bySession:a.bySession,byRun:a.byRun,agentsBySession:a.agentsBySession,plansBySession:a.plansBySession,tasksBySession:Object.fromEntries(Object.entries(a.tasksBySession).map(([t,s])=>[t,Object.fromEntries(Object.entries(s).map(([i,o])=>{const{raw:c,...u}=o;return[i,u]}))])),eventsBySession:Object.fromEntries(Object.entries(a.eventsBySession).map(([t,s])=>[t,s.slice(-$d).map(i=>{const{data:o,...c}=i;return c})]))})}));var Nw=TS();const Ew=Uf(Nw);Prism.languages.javascript=Prism.languages.extend("clike",{"class-name":[Prism.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/});Prism.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:Prism.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/});Prism.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}});Prism.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}});Prism.languages.markup&&(Prism.languages.markup.tag.addInlined("script","javascript"),Prism.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript"));Prism.languages.js=Prism.languages.javascript;var Oy={},By;function Aw(){return By||(By=1,(function(a){a.languages.typescript=a.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),a.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete a.languages.typescript.parameter,delete a.languages.typescript["literal-property"];var t=a.languages.extend("typescript",{});delete t["class-name"],a.languages.typescript["class-name"].inside=t,a.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:t}}}}),a.languages.ts=a.languages.typescript})(Prism)),Oy}Aw();(function(a){var t=a.util.clone(a.languages.javascript),s=/(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source,i=/(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source,o=/(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/.source;function c(p,g){return p=p.replace(/<S>/g,function(){return s}).replace(/<BRACES>/g,function(){return i}).replace(/<SPREAD>/g,function(){return o}),RegExp(p,g)}o=c(o).source,a.languages.jsx=a.languages.extend("markup",t),a.languages.jsx.tag.pattern=c(/<\/?(?:[\w.:-]+(?:<S>+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\/?)?>/.source),a.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,a.languages.jsx.tag.inside["attr-value"].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,a.languages.jsx.tag.inside.tag.inside["class-name"]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,a.languages.jsx.tag.inside.comment=t.comment,a.languages.insertBefore("inside","attr-name",{spread:{pattern:c(/<SPREAD>/.source),inside:a.languages.jsx}},a.languages.jsx.tag),a.languages.insertBefore("inside","special-attr",{script:{pattern:c(/=<BRACES>/.source),alias:"language-javascript",inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:"punctuation"},rest:a.languages.jsx}}},a.languages.jsx.tag);var u=function(p){return p?typeof p=="string"?p:typeof p.content=="string"?p.content:p.content.map(u).join(""):""},d=function(p){for(var g=[],y=0;y<p.length;y++){var b=p[y],x=!1;if(typeof b!="string"&&(b.type==="tag"&&b.content[0]&&b.content[0].type==="tag"?b.content[0].content[0].content==="</"?g.length>0&&g[g.length-1].tagName===u(b.content[0].content[1])&&g.pop():b.content[b.content.length-1].content==="/>"||g.push({tagName:u(b.content[0].content[1]),openedBraces:0}):g.length>0&&b.type==="punctuation"&&b.content==="{"?g[g.length-1].openedBraces++:g.length>0&&g[g.length-1].openedBraces>0&&b.type==="punctuation"&&b.content==="}"?g[g.length-1].openedBraces--:x=!0),(x||typeof b=="string")&&g.length>0&&g[g.length-1].openedBraces===0){var S=u(b);y<p.length-1&&(typeof p[y+1]=="string"||p[y+1].type==="plain-text")&&(S+=u(p[y+1]),p.splice(y+1,1)),y>0&&(typeof p[y-1]=="string"||p[y-1].type==="plain-text")&&(S=u(p[y-1])+S,p.splice(y-1,1),y--),p[y]=new a.Token("plain-text",S,null,S)}b.content&&typeof b.content!="string"&&d(b.content)}};a.hooks.add("after-tokenize",function(p){p.language!=="jsx"&&p.language!=="tsx"||d(p.tokens)})})(Prism);(function(a){var t=a.util.clone(a.languages.typescript);a.languages.tsx=a.languages.extend("jsx",t),delete a.languages.tsx.parameter,delete a.languages.tsx["literal-property"];var s=a.languages.tsx.tag;s.pattern=RegExp(/(^|[^\w$]|(?=<\/))/.source+"(?:"+s.pattern.source+")",s.pattern.flags),s.lookbehind=!0})(Prism);(function(a){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;a.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+t.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+t.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},a.languages.css.atrule.inside.rest=a.languages.css;var s=a.languages.markup;s&&(s.tag.addInlined("style","css"),s.tag.addAttribute("style","css"))})(Prism);Prism.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}};Prism.languages.webmanifest=Prism.languages.json;(function(a){var t="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",s={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},i={bash:s,environment:{pattern:RegExp("\\$"+t),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+t),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};a.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+t),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:i},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:s}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:i},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:i.entity}}],environment:{pattern:RegExp("\\$?"+t),alias:"constant"},variable:i.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},s.inside=a.languages.bash;for(var o=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],c=i.variable[1].inside,u=0;u<o.length;u++)c[o[u]]=a.languages.bash[o[u]];a.languages.sh=a.languages.bash,a.languages.shell=a.languages.bash})(Prism);var Dy={},Ly;function jw(){return Ly||(Ly=1,Prism.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest=Prism.languages.python,Prism.languages.py=Prism.languages.python),Dy}jw();(function(a){var t=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function s(y){return y=y.replace(/<inner>/g,function(){return t}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+y+")")}var i=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,o=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return i}),c=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;a.languages.markdown=a.languages.extend("markup",{}),a.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:a.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+o+c+"(?:"+o+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+o+c+")(?:"+o+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(i),inside:a.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+o+")"+c+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+o+"$"),inside:{"table-header":{pattern:RegExp(i),alias:"important",inside:a.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:s(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:s(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:s(/(~~?)(?:(?!~)<inner>)+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:s(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(y){["url","bold","italic","strike","code-snippet"].forEach(function(b){y!==b&&(a.languages.markdown[y].inside.content.inside[b]=a.languages.markdown[b])})}),a.hooks.add("after-tokenize",function(y){if(y.language!=="markdown"&&y.language!=="md")return;function b(x){if(!(!x||typeof x=="string"))for(var S=0,k=x.length;S<k;S++){var C=x[S];if(C.type!=="code"){b(C.content);continue}var T=C.content[1],E=C.content[3];if(T&&E&&T.type==="code-language"&&E.type==="code-block"&&typeof T.content=="string"){var A=T.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp");A=(/[a-z][\w-]*/i.exec(A)||[""])[0].toLowerCase();var B="language-"+A;E.alias?typeof E.alias=="string"?E.alias=[E.alias,B]:E.alias.push(B):E.alias=[B]}}}b(y.tokens)}),a.hooks.add("wrap",function(y){if(y.type==="code-block"){for(var b="",x=0,S=y.classes.length;x<S;x++){var k=y.classes[x],C=/language-(.+)/.exec(k);if(C){b=C[1];break}}var T=a.languages[b];if(T)y.content=a.highlight(g(y.content),T,b);else if(b&&b!=="none"&&a.plugins.autoloader){var E="md-"+new Date().valueOf()+"-"+Math.floor(Math.random()*1e16);y.attributes.id=E,a.plugins.autoloader.loadLanguages(b,function(){var A=document.getElementById(E);A&&(A.innerHTML=a.highlight(A.textContent,a.languages[b],b))})}}});var u=RegExp(a.languages.markup.tag.pattern.source,"gi"),d={amp:"&",lt:"<",gt:">",quot:'"'},p=String.fromCodePoint||String.fromCharCode;function g(y){var b=y.replace(u,"");return b=b.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,function(x,S){if(S=S.toLowerCase(),S[0]==="#"){var k;return S[1]==="x"?k=parseInt(S.slice(2),16):k=Number(S.slice(1)),p(k)}else{var C=d[S];return C||x}}),b}a.languages.md=a.languages.markdown})(Prism);(function(a){var t=/[*&][^\s[\]{},]+/,s=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,i="(?:"+s.source+"(?:[ ]+"+t.source+")?|"+t.source+"(?:[ ]+"+s.source+")?)",o=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source.replace(/<PLAIN>/g,function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source}),c=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function u(d,p){p=(p||"").replace(/m/g,"")+"m";var g=/([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<<prop>>/g,function(){return i}).replace(/<<value>>/g,function(){return d});return RegExp(g,p)}a.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<<prop>>/g,function(){return i})),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source.replace(/<<prop>>/g,function(){return i}).replace(/<<key>>/g,function(){return"(?:"+o+"|"+c+")"})),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:u(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:u(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:u(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:u(c),lookbehind:!0,greedy:!0},number:{pattern:u(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:s,important:t,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},a.languages.yml=a.languages.yaml})(Prism);Prism.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/};function Yb(a){window.dispatchEvent(new CustomEvent("preview-file",{detail:{path:a}}))}const Rw={js:"JavaScript",ts:"TypeScript",jsx:"JSX",tsx:"TSX",py:"Python",python:"Python",bash:"Bash",shell:"Shell",css:"CSS",json:"JSON",yaml:"YAML",yml:"YAML",sql:"SQL",md:"Markdown",markdown:"Markdown",xml:"XML",html:"HTML"};function Mw({language:a,code:t}){const{t:s}=Je(),[i,o]=_.useState(!1),c=_.useRef(null);_.useEffect(()=>{if(c.current)try{Ew.highlightElement(c.current)}catch{}},[t,a]);const u=async()=>{try{await navigator.clipboard.writeText(t),o(!0),setTimeout(()=>o(!1),2e3)}catch(p){console.error("Failed to copy:",p)}},d=Rw[a]||a.toUpperCase();return m.jsxs("div",{className:"relative group rounded-lg overflow-hidden border border-dark-border my-2",children:[m.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 bg-dark-surface border-b border-dark-border",children:[m.jsx("span",{className:"text-xs text-dark-muted font-mono",children:d}),m.jsx("button",{onClick:u,className:"flex items-center gap-1 text-xs px-2 py-1 rounded hover:bg-dark-hover transition-colors",children:i?m.jsxs(m.Fragment,{children:[m.jsx(bb,{size:12,className:"text-accent-green"}),m.jsx("span",{className:"text-accent-green",children:s("common.copied")})]}):m.jsxs(m.Fragment,{children:[m.jsx(vb,{size:12}),m.jsx("span",{children:s("common.copy")})]})})]}),m.jsx("pre",{className:"bg-dark-bg p-3 overflow-x-auto custom-scrollbar text-sm",children:m.jsx("code",{ref:c,className:`language-${a}`,children:t})})]})}const zy=80;function Ow({path:a,title:t}){const{t:s}=Je(),i=a.split(/[\\/]/).pop()||a;return m.jsxs("button",{type:"button",className:"inline-flex items-center gap-2 mx-0.5 my-1 rounded-lg border border-dark-border bg-dark-surface px-2.5 py-1.5 text-left align-middle transition-colors hover:border-accent-blue/40 hover:bg-dark-hover",title:a,onClick:()=>Yb(a),children:[m.jsx("span",{className:"grid w-6 h-6 shrink-0 place-items-center rounded-md bg-accent-blue/10 text-accent-blue",children:m.jsx(Fi,{size:13})}),m.jsxs("span",{className:"min-w-0 flex flex-col leading-tight",children:[m.jsx("b",{className:"text-xs font-semibold text-dark-text truncate max-w-[14rem]",children:t||i}),t&&t!==i&&m.jsx("span",{className:"text-[10px] font-mono text-dark-muted truncate max-w-[14rem]",children:i})]}),m.jsx("span",{className:"ml-1 shrink-0 text-[11px] font-medium text-accent-blue",children:s("commonUi.openFile")})]})}function Uy(a){return typeof a=="string"&&a.startsWith("artifact:")}function Bw(a){const t=a.slice(9);try{return decodeURIComponent(t)}catch{return t}}function Iy(a){return typeof a=="string"&&a.startsWith("dscfile:")}function Dw(a){const t=a.slice(8);try{return decodeURIComponent(t)}catch{return t}}function Lw(a){return a.replace(/%/g,"%25")}const zw=/((?:[A-Za-z]:[\\/])?[\w@.()[\]{}$%-]+(?:[\\/][\w@.()[\]{}$%-]+)+)/;function Uw(a){if(a.length<3||a.length>400||/^[a-z][a-z0-9+.-]*:\/\//i.test(a)||/^www\./i.test(a)||/^\/\//.test(a))return!1;const t=a.split(/[\\/]/);if(t.length>=2&&t.every(o=>/^\d+$/.test(o)))return!1;const s=(t[t.length-1]||"").replace(/[.,;:!?)\]}]+$/g,"");return s?/^(?:[A-Za-z]:|~|\.{1,2})[\\/]/.test(a)||/\.[A-Za-z0-9]{1,12}$/.test(s):!1}function Iw(a){const t=a.match(/^(.*?)([.,;:!?)\]}]+)$/);if(!t)return{path:a,tail:""};const s=t[1]??"",i=t[2]??"";if(i==="."){const o=s.split(/[\\/]/).pop()||"";if(!/\.[A-Za-z0-9]{1,12}$/.test(o))return{path:a,tail:""}}return{path:s,tail:i}}function $w({path:a}){return m.jsxs("button",{type:"button",onClick:()=>Yb(a),title:a,className:"inline-flex max-w-full items-center gap-1 align-baseline rounded px-1 font-mono text-[0.9em] text-accent-blue underline decoration-accent-blue/40 underline-offset-2 hover:bg-accent-blue/10 hover:decoration-accent-blue transition-colors cursor-pointer",children:[m.jsx(Fi,{size:10,className:"shrink-0"}),m.jsx("span",{className:"break-all",children:a})]})}function Hw(){const a=new Set(["code","inlineCode","html","link","linkReference","image","imageReference"]);function t(i){const o=i.split(zw);if(o.length<=1)return[{type:"text",value:i}];const c=[];return o.forEach((u,d)=>{if(d%2===1){const{path:p,tail:g}=Iw(u);if(p&&Uw(p)){c.push({type:"link",url:`dscfile:${Lw(p)}`,title:null,children:[{type:"text",value:p}]}),g&&c.push({type:"text",value:g});return}}c.push({type:"text",value:u})}),c}function s(i){if(!i||typeof i!="object"||a.has(i.type))return;const o=i.children;if(!Array.isArray(o))return;const c=[];for(const u of o)u&&u.type==="text"&&typeof u.value=="string"?c.push(...t(u.value)):(s(u),c.push(u));i.children=c}return function(o){s(o)}}const Pw=[Hw];function Fw({content:a,className:t=""}){const[s,i]=_.useState(a),o=_.useRef(0),c=_.useRef(null),u=_.useRef(a);u.current=a,_.useEffect(()=>{if(a===s)return;const p=Date.now(),g=p-o.current;g>=zy?(i(a),o.current=p):c.current||(c.current=setTimeout(()=>{c.current=null,i(u.current),o.current=Date.now()},zy-g))},[a]),_.useEffect(()=>()=>{c.current&&clearTimeout(c.current)},[]);const d=(s||"").replace(/\\n/g,`
28
- `).replace(/\n{3,}/g,`
29
-
30
- `);return m.jsx("div",{className:`markdown-content ${t}`,style:{wordBreak:"break-word"},children:m.jsx(NS,{remarkPlugins:Pw,urlTransform:p=>Uy(p)||Iy(p)?p:ES(p),components:{code({className:p,children:g,...y}){const b=/language-(\w+)/.exec(p||""),x=String(g).replace(/\n$/,"");return b&&b[1]?m.jsx(Mw,{language:b[1],code:x}):m.jsx("code",{className:"bg-dark-hover px-1.5 py-0.5 rounded text-sm font-mono text-accent-blue",...y,children:g})},a({href:p,children:g}){if(Uy(p)){const y=Array.isArray(g)?g.join(""):String(g??"");return m.jsx(Ow,{path:Bw(p),title:y})}return Iy(p)?m.jsx($w,{path:Dw(p)}):m.jsx("a",{href:p,target:"_blank",rel:"noopener noreferrer",className:"text-accent-blue hover:underline",children:g})},table({children:p}){return m.jsx("div",{className:"overflow-x-auto custom-scrollbar my-2",children:m.jsx("table",{className:"w-full border-collapse border border-dark-border",children:p})})},th({children:p}){return m.jsx("th",{className:"border border-dark-border px-3 py-2 text-left bg-dark-hover font-medium",children:p})},td({children:p}){return m.jsx("td",{className:"border border-dark-border px-3 py-2",children:p})},p({children:p}){return m.jsx("p",{className:"mb-0.5 leading-snug last:mb-0",children:p})},blockquote({children:p}){return m.jsx("blockquote",{className:"border-l-4 border-accent-blue pl-3 my-1 text-dark-muted italic",children:p})},h1({children:p}){return m.jsx("h1",{className:"text-2xl font-bold mt-3 mb-1 text-dark-text border-b border-dark-border pb-1",children:p})},h2({children:p}){return m.jsx("h2",{className:"text-xl font-semibold mt-3 mb-1 text-dark-text border-b border-dark-border pb-1",children:p})},h3({children:p}){return m.jsx("h3",{className:"text-lg font-semibold mt-2 mb-1 text-dark-text",children:p})}},children:d})})}const Gw="dsc:host-ready",qw="dsc:host-context",Ww="dsc:plugin-ready",Zb=_.memo(function({contribution:t,hostContext:s}){const i=_.useRef(null),o=_.useRef(JSON.stringify(s??{})),c=_.useCallback(()=>{const u=i.current,d=u==null?void 0:u.getAttribute("src");if(!(!(u!=null&&u.contentWindow)||!d))try{u.contentWindow.postMessage({__dsc:!0,type:qw,context:s??{}},new URL(d,window.location.origin).origin)}catch{}},[s]);return _.useEffect(()=>{const u=d=>{const p=i.current;if(!p)return;const g=p.getAttribute("src")??"";let y;try{y=new URL(g,window.location.origin).origin}catch{return}if(d.origin!==y)return;const b=d.data;!b||b.__dsc!==!0||b.type===Ww&&c()};return window.addEventListener("message",u),()=>window.removeEventListener("message",u)},[c]),_.useEffect(()=>{const u=JSON.stringify(s??{});u!==o.current&&(o.current=u,c())},[s,c]),m.jsx("div",{className:"flex-1 min-h-0 w-full bg-dark-bg","data-plugin-tab":t.pluginId,children:m.jsx("iframe",{ref:i,title:t.title,src:t.url,className:"w-full h-full border-0",sandbox:"allow-scripts allow-same-origin","data-plugin-ready":Gw})})}),Vw=Object.freeze(Object.defineProperty({__proto__:null,PluginTabContainer:Zb},Symbol.toStringTag,{value:"Module"})),Pd=Ut()(xa(a=>({hidden:{},pinned:{},hide:t=>a(s=>({hidden:{...s.hidden,[t]:!0}})),show:t=>a(s=>{const i={...s.hidden};return delete i[t],{hidden:i}}),togglePin:t=>a(s=>{const i=!s.pinned[t],o={...s.hidden};return i&&delete o[t],{pinned:{...s.pinned,[t]:i},hidden:o}}),reset:()=>a({hidden:{},pinned:{}})}),{name:"deepseekcode-widget-store",storage:Ff({key:"widgetStore",trims:[]}),partialize:a=>({hidden:a.hidden,pinned:a.pinned})})),wo=_.memo(function({id:t,title:s,icon:i,action:o,children:c,defaultOpen:u=!0}){const{t:d}=Je(),p=Pd(S=>S.pinned[t]),g=Pd(S=>S.togglePin),y=Pd(S=>S.hide),[b,x]=_.useState(u);return m.jsxs("div",{className:"rounded-lg border border-dark-border bg-dark-surface overflow-hidden",children:[m.jsxs("div",{className:"flex items-center gap-0.5 px-2 py-1.5",children:[m.jsxs("button",{type:"button",onClick:()=>x(S=>!S),className:"flex-1 min-w-0 flex items-center gap-1.5 text-left transition-colors","aria-expanded":b,title:d(b?"widgets.card.collapse":"widgets.card.expand"),children:[m.jsx(ba,{size:11,className:vt("text-dark-muted shrink-0 transition-transform duration-200",!b&&"-rotate-90")}),i,m.jsx("span",{className:"text-[11px] font-semibold text-dark-text truncate",children:s}),!p&&m.jsx("span",{className:"text-[8px] text-dark-muted/50 border border-dark-border rounded px-1 py-px shrink-0",children:d("widgets.card.auto")})]}),o,m.jsx("button",{type:"button",onClick:()=>g(t),className:vt("p-1 rounded transition-colors shrink-0",p?"text-accent-blue":"text-dark-muted/40 hover:text-dark-muted hover:bg-dark-hover"),title:d(p?"widgets.card.unpin":"widgets.card.pinKeep"),"aria-label":d(p?"widgets.card.unpin":"widgets.card.pin"),children:p?m.jsx(of,{size:11}):m.jsx(jS,{size:11})}),m.jsx("button",{type:"button",onClick:()=>y(t),className:"p-1 rounded text-dark-muted/40 hover:text-dark-muted hover:bg-dark-hover transition-colors shrink-0",title:d("widgets.card.close"),"aria-label":d("widgets.card.close"),children:m.jsx(ss,{size:11})})]}),b&&m.jsx("div",{className:"px-2.5 pb-2.5",children:c})]})}),Kw=_.memo(function({sessionId:t}){const{t:s}=Je(),i=Qe(u=>t?u.getPlanForSession(t):void 0);if(!i||!i.confirm)return null;const o=i.nodes??[],c=u=>{Qe.getState().clearPlan(t),fe.send({type:"workflow_confirm",sessionId:t,data:JSON.stringify({planId:i.planId,action:u})})};return m.jsx(wo,{id:"plan-card",title:s("widgets.plan.title"),icon:m.jsx(Sb,{size:13,className:"text-accent-purple shrink-0"}),children:m.jsxs("div",{className:"space-y-2",children:[m.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] text-dark-text",children:[m.jsx(Ln,{size:11,className:"animate-spin text-accent-blue shrink-0"}),m.jsx("span",{className:"truncate flex-1",children:i.title||s("widgets.plan.fallbackTitle")}),m.jsx("span",{className:"text-[10px] text-dark-muted tabular-nums shrink-0",children:s("widgets.plan.stepCount",{count:o.length})})]}),o.length>0&&m.jsxs("ol",{className:"space-y-0.5",children:[o.slice(0,8).map((u,d)=>m.jsxs("li",{className:"flex items-start gap-1.5 text-[11px] text-dark-muted",children:[m.jsx("span",{className:"w-4 h-4 rounded-full grid place-items-center bg-dark-border/60 text-dark-muted text-[9px] font-semibold shrink-0 mt-0.5",children:d+1}),m.jsx("span",{className:"min-w-0 flex-1 leading-snug break-words",children:u.title})]},u.id)),o.length>8&&m.jsx("li",{className:"text-[10px] text-dark-muted/60 pl-6",children:s("widgets.plan.moreSteps",{count:o.length-8})})]}),m.jsxs("div",{className:"flex items-center gap-1.5 pt-1 border-t border-dark-border/60",children:[m.jsxs("button",{type:"button",onClick:()=>c("start"),className:"flex-1 flex items-center justify-center gap-1 px-2 py-1 rounded border border-accent-blue/40 bg-accent-blue/10 text-[10px] text-accent-blue hover:bg-accent-blue/20 transition-colors",children:[m.jsx(xb,{size:10})," ",s("widgets.plan.start")]}),m.jsxs("button",{type:"button",onClick:()=>c("change"),className:"flex-1 flex items-center justify-center gap-1 px-2 py-1 rounded border border-dark-border text-[10px] text-dark-text hover:bg-dark-hover transition-colors",title:s("widgets.plan.changeHint"),children:[m.jsx(mc,{size:10})," ",s("widgets.plan.change")]}),m.jsxs("button",{type:"button",onClick:()=>c("cancel"),className:"flex items-center justify-center gap-1 px-2 py-1 rounded border border-dark-border text-[10px] text-dark-text hover:bg-dark-hover transition-colors",title:s("widgets.plan.cancelTitle"),children:[m.jsx(ss,{size:10})," ",s("widgets.plan.cancel")]})]})]})})}),Yw=["RUNNING","RESUMING"];function Zw(a){switch(a){case"running":return m.jsx(Ln,{size:12,className:"animate-spin text-accent-blue shrink-0"});case"completed":return m.jsx(gc,{size:12,className:"text-accent-green shrink-0"});case"failed":return m.jsx(hc,{size:12,className:"text-accent-red shrink-0"});case"skipped":return m.jsx(MS,{size:12,className:"text-dark-muted shrink-0"});case"blocked":return m.jsx(kb,{size:12,className:"text-dark-muted shrink-0"});default:return m.jsx(If,{size:12,className:"text-dark-muted/70 shrink-0"})}}function Qw(a,t){switch(a){case"running":return t("widgets.workflow.statusRunning");case"completed":return t("widgets.workflow.statusCompleted");case"failed":return t("widgets.workflow.statusFailed");case"skipped":return t("widgets.workflow.statusSkipped");case"blocked":return t("widgets.workflow.statusBlocked");default:return t("widgets.workflow.statusPending")}}const Xw=_.memo(function({sessionId:t}){const{t:s}=Je(),i=Qe(b=>t?b.getForSession(t):void 0),o=i==null?void 0:i.nodes;if(!o||o.length===0)return null;const c=o.length,u=o.filter(b=>b.status==="completed"||b.status==="skipped"||b.status==="failed").length,d=o.filter(b=>b.status==="running").length,p=o.filter(b=>b.status==="failed").length,g=Math.round(u/c*100),y=Yw.includes(String(i==null?void 0:i.status));return m.jsx(wo,{id:"workflow-strip",title:(i==null?void 0:i.title)||s("widgets.workflow.fallbackTitle"),icon:m.jsx(Sb,{size:13,className:"text-accent-blue shrink-0"}),action:m.jsxs("span",{className:"text-[10px] text-dark-muted tabular-nums shrink-0 px-1",children:[u,"/",c]}),children:m.jsxs("div",{className:"space-y-2",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("div",{className:"flex-1 h-1.5 bg-dark-surface rounded-full overflow-hidden",children:m.jsx("div",{className:vt("h-full rounded-full transition-all duration-500",p>0?"bg-accent-red":d>0?"bg-accent-blue":"bg-accent-green"),style:{width:`${g}%`}})}),m.jsxs("span",{className:"text-[10px] text-dark-muted tabular-nums shrink-0",children:[g,"%"]})]}),m.jsx("ul",{className:"space-y-0.5",children:o.map(b=>m.jsxs("li",{className:"flex items-start gap-1.5 py-0.5",children:[m.jsx("span",{className:"mt-0.5 shrink-0",children:Zw(b.status)}),m.jsxs("span",{className:vt("min-w-0 flex-1 text-[11px] leading-snug break-words",b.status==="completed"&&"text-dark-muted/70",b.status==="failed"&&"text-accent-red/90",b.status==="running"&&"text-dark-text font-medium",(b.status==="pending"||b.status==="ready")&&"text-dark-muted"),title:b.error||b.title,children:[b.title,m.jsx("span",{className:"ml-1 text-[8px] text-dark-muted/50 align-middle",children:Qw(b.status,s)})]})]},b.id))}),(y||(i==null?void 0:i.status)==="PAUSED")&&m.jsx("div",{className:"flex items-center gap-1.5 pt-1 border-t border-dark-border/60",children:m.jsx(Jw,{sessionId:t,runId:i.runId,status:String(i==null?void 0:i.status)})})]})})});function Jw({sessionId:a,runId:t,status:s}){const{t:i}=Je(),o=s==="PAUSED";return m.jsxs(m.Fragment,{children:[m.jsxs("button",{type:"button",onClick:()=>fe.send(o?{type:"workflow_resume",sessionId:a,runId:t}:{type:"workflow_pause",sessionId:a,runId:t}),className:"flex items-center gap-1 px-2 py-0.5 rounded border border-dark-border text-[10px] text-dark-text hover:bg-dark-hover transition-colors",children:[o?m.jsx(xb,{size:10,className:"text-accent-green"}):m.jsx(kb,{size:10,className:"text-accent-blue"}),i(o?"widgets.workflow.resume":"widgets.workflow.pause")]}),m.jsxs("button",{type:"button",onClick:()=>fe.send({type:"workflow_cancel",sessionId:a,runId:t}),className:"flex items-center gap-1 px-2 py-0.5 rounded border border-dark-border text-[10px] text-dark-text hover:bg-dark-hover transition-colors",children:[m.jsx(RS,{size:9,className:"text-accent-red"}),i("widgets.workflow.cancel")]})]})}const e1=_.memo(function({sessionId:t}){const{t:s}=Je();return Qe(o=>t?o.getTasksForSession(t).length:0)===0?null:m.jsx(wo,{id:"task-board",title:s("widgets.taskBoard.title"),icon:m.jsx(wb,{size:13,className:"text-accent-blue shrink-0"}),children:m.jsx(cC,{sessionId:t})})}),t1=_.memo(function({messages:t,onPreview:s}){const{t:i}=Je(),o=_.useMemo(()=>sv(t),[t]);return o.length===0?null:m.jsx(wo,{id:"artifacts",title:`${i("chat.sidebarArtifacts")} (${o.length})`,icon:m.jsx(Cb,{size:13,className:"text-accent-blue shrink-0"}),action:m.jsx("button",{type:"button",onClick:()=>{const c=o[0];c&&s(c.path)},className:"p-1 rounded text-dark-muted hover:bg-dark-hover hover:text-dark-text transition-colors shrink-0",title:i("chat.sidebarOpenFolder"),"aria-label":i("chat.sidebarOpenFolder"),children:m.jsx(OS,{size:12})}),children:m.jsx("div",{className:"space-y-0.5",children:o.map(c=>{const u=Ef(c.path);return m.jsxs("button",{type:"button",onClick:()=>s(c.path),className:"w-full flex items-center gap-2 px-1.5 py-1.5 rounded-lg text-left transition-colors group hover:bg-dark-hover",title:c.path,children:[m.jsx("span",{className:vt("w-1.5 h-6 rounded-full shrink-0",c.source==="filejob"?"bg-accent-green":"bg-accent-blue")}),m.jsx(oC,{kind:u,size:15}),m.jsxs("span",{className:"flex-1 min-w-0",children:[m.jsx("span",{className:"block text-xs text-dark-text truncate",children:c.name}),m.jsx("span",{className:"block text-[10px] font-mono text-dark-muted truncate",children:c.path})]}),m.jsx("span",{className:"shrink-0 text-[10.5px] font-medium text-dark-muted opacity-0 group-hover:opacity-100 transition-opacity",children:i("chat.sidebarOpen")})]},c.path)})})})}),n1=["Orchestrator","Explorer","Architect","Coder","Tester","Reviewer","Debug","Documenter","Evaluator"];function s1(a){return a==="running"||a==="scheduled"?m.jsx(Ln,{size:11,className:"animate-spin text-accent-blue shrink-0"}):a==="completed"?m.jsx(gc,{size:11,className:"text-accent-green shrink-0"}):a==="failed"?m.jsx(hc,{size:11,className:"text-accent-red shrink-0"}):m.jsx(If,{size:11,className:"text-dark-muted shrink-0"})}const a1=(a,t)=>t(a==="running"||a==="scheduled"?"widgets.agentFlow.statusRunning":a==="completed"?"widgets.agentFlow.statusCompleted":a==="failed"?"widgets.agentFlow.statusFailed":"widgets.agentFlow.statusIdle"),$y=a=>a.toLowerCase(),i1=_.memo(function({sessionId:t}){const{t:s}=Je(),i=Qe(g=>t?g.getAgentsForSession(t):[]),o=Qe(g=>t?g.getEventsForSession(t).filter(y=>y.source==="agent"||y.source==="plan").slice(0,30):[]),[c,u]=_.useState(!1),d=_.useMemo(()=>{if(i.length===0)return[];const g=new Map(i.map(x=>[$y(x.name),x])),y=n1.map(x=>g.get($y(x))).filter(Boolean),b=i.filter(x=>!y.some(S=>S.id===x.id));return[...y,...b]},[i]),p=d.filter(g=>g.status==="running"||g.status==="scheduled").length;return d.length===0?null:m.jsx(wo,{id:"agent-flow",title:"Agent",icon:m.jsx(BS,{size:13,className:"text-accent-purple shrink-0"}),action:p>0?m.jsx("span",{className:"w-1.5 h-1.5 bg-accent-blue rounded-full animate-pulse shrink-0"}):void 0,children:m.jsxs("div",{className:"space-y-1",children:[d.slice(0,8).map(g=>m.jsxs("div",{className:"flex items-center gap-1.5 py-0.5",children:[s1(g.status),m.jsxs("span",{className:vt("min-w-0 flex-1 text-[11px] leading-snug break-words",g.status==="running"||g.status==="scheduled"?"text-dark-text":"text-dark-muted"),children:[g.name,g.currentTask&&m.jsxs("span",{className:"text-dark-muted/70",children:[" · ",g.currentTask]})]}),m.jsx("span",{className:"text-[8px] text-dark-muted/50 shrink-0",children:a1(g.status,s)})]},g.id)),d.length>8&&m.jsx("div",{className:"text-[10px] text-dark-muted text-center pt-0.5",children:s("widgets.agentFlow.moreAgents",{count:d.length-8})}),o.length>0&&m.jsxs(m.Fragment,{children:[m.jsxs("button",{type:"button",onClick:()=>u(g=>!g),className:"w-full flex items-center gap-1 pt-1 text-[10px] text-dark-muted hover:text-dark-text transition-colors",children:[m.jsx(ba,{size:10,className:vt("transition-transform",c&&"rotate-180")}),s("widgets.agentFlow.eventLog",{count:o.length})]}),c&&m.jsx("div",{className:"space-y-1 pt-1 max-h-32 overflow-y-auto custom-scrollbar",children:o.map(g=>m.jsxs("div",{className:"px-1.5 py-1 rounded border border-dark-border bg-dark-surface text-[9px] text-dark-muted",children:[m.jsx("span",{className:"font-medium text-dark-text",children:g.title||g.type}),g.message&&m.jsx("span",{className:"block text-dark-muted/80 truncate",children:g.message})]},g.id))})]})]})})});function r1({sessionId:a}){const[t,s]=_.useState([]);return _.useEffect(()=>{let i=!1;return $.get("/api/plugins/ui").then(o=>{var c;i||s((((c=o==null?void 0:o.data)==null?void 0:c.ui)??[]).filter(u=>u.mount==="inline"))}).catch(()=>{}),()=>{i=!0}},[]),t.length===0?null:m.jsx(m.Fragment,{children:t.map(i=>m.jsx("div",{className:"rounded-xl border border-dark-border bg-dark-surface overflow-hidden",style:{height:220},"data-plugin-inline":i.pluginId,children:m.jsx(Zb,{contribution:i,hostContext:{sessionId:a,wsUrl:Wf()}})},i.id))})}const o1=_.memo(function({sessionId:t,messages:s,onPreview:i}){return m.jsx("div",{className:"flex-1 overflow-y-auto min-h-0 custom-scrollbar",children:m.jsxs("div",{className:"p-2 space-y-2",children:[m.jsx(Kw,{sessionId:t}),m.jsx(Xw,{sessionId:t}),m.jsx(i1,{sessionId:t}),m.jsx(e1,{sessionId:t}),m.jsx(t1,{messages:s,onPreview:i}),m.jsx(r1,{sessionId:t})]})})});function Hy(a,t){var s,i,o;return{artifactMatch:!!((s=t.artifact)!=null&&s.kind&&((i=a.artifactKinds)!=null&&i.includes(t.artifact.kind))),capabilityMatch:!!((o=t.requiredCapabilities)!=null&&o.includes(a.capability)),priority:a.priority??0}}function l1(a,t){return a.artifactMatch!==t.artifactMatch?a.artifactMatch?1:-1:a.capabilityMatch!==t.capabilityMatch?a.capabilityMatch?1:-1:a.priority-t.priority}function c1(a,t){const s=a.filter(c=>c.slots.includes(t.slotId));if(s.length===0)return;if(t.preferredComponentId){const c=s.find(u=>u.id===t.preferredComponentId);if(c)return c}let i=s[0],o=Hy(i,t);for(let c=1;c<s.length;c+=1){const u=Hy(s[c],t);l1(u,o)>0&&(i=s[c],o=u)}return i}const Fd=/^[a-z][a-z0-9._-]*$/;class Ha extends Error{}class u1{constructor(){Fe(this,"defs",new Map);Fe(this,"listeners",new Set);Fe(this,"versionCounter",0)}getVersion(){return this.versionCounter}onChange(t){return this.listeners.add(t),()=>this.listeners.delete(t)}register(t){return this.assertValid(t),this.defs.set(t.id,t),this.notify(),()=>this.unregister(t.id)}unregister(t){const s=this.defs.delete(t);return s&&this.notify(),s}get(t){return this.defs.get(t)}has(t){return this.defs.has(t)}list(){return[...this.defs.values()].sort((s,i)=>(i.priority??0)-(s.priority??0))}listForSlot(t){return this.list().filter(s=>s.slots.includes(t))}resolve(t){return c1(this.list(),t)}capabilities(){return[...new Set(this.list().map(t=>t.capability))]}clear(){this.defs.size!==0&&(this.defs.clear(),this.notify())}get size(){return this.defs.size}notify(){this.versionCounter+=1;for(const t of[...this.listeners])try{t()}catch(s){console.error("[workspace] registry listener error:",s)}}assertValid(t){var s;if(!t||typeof t!="object")throw new Ha("[workspace] component def must be an object");if(!Fd.test(t.id))throw new Ha(`[workspace] invalid component id: ${JSON.stringify(t.id)} (expected ${Fd})`);if(this.defs.has(t.id))throw new Ha(`[workspace] duplicate component id: "${t.id}"`);if(!Fd.test(t.capability))throw new Ha(`[workspace] invalid capability id: ${JSON.stringify(t.capability)}`);if(!Array.isArray(t.slots)||t.slots.length===0||t.slots.some(i=>typeof i!="string"||i.length===0))throw new Ha(`[workspace] component "${t.id}" must declare at least one non-empty slot`);if(typeof t.component!="function"&&typeof((s=t.component)==null?void 0:s.render)!="function")throw new Ha(`[workspace] component "${t.id}" has no renderable component`);if(t.priority!==void 0&&(typeof t.priority!="number"||!Number.isFinite(t.priority)))throw new Ha(`[workspace] component "${t.id}" priority must be a finite number`)}}const Vf=new u1,Py=32;function Gd(a){if(typeof a!="object"||a===null)return!1;const t=a;return t.type==="slot"||t.type==="split"||t.type==="stack"}function Qb(a,t=0){if(!Gd(a))return["layout root must be a slot/split/stack node"];const s=[],i=(o,c,u)=>{if(u>Py){s.push(`${c}: exceeds max nesting depth ${Py}`);return}switch(o.type){case"slot":{(typeof o.id!="string"||o.id.length===0)&&s.push(`${c}: slot requires a non-empty id`);break}case"split":{o.direction!=="horizontal"&&o.direction!=="vertical"&&s.push(`${c}: split requires direction "horizontal"|"vertical"`),!Array.isArray(o.children)||o.children.length<2?s.push(`${c}: split requires at least 2 children`):o.sizes!==void 0&&(!Array.isArray(o.sizes)||o.sizes.length!==o.children.length?s.push(`${c}: split sizes must match children count`):o.sizes.some(d=>typeof d!="number"||!Number.isFinite(d)||d<=0)&&s.push(`${c}: split sizes must be positive finite numbers`)),Array.isArray(o.children)&&o.children.forEach((d,p)=>{Gd(d)?i(d,`${c}.children[${p}]`,u+1):s.push(`${c}.children[${p}]: invalid node`)});break}case"stack":{!Array.isArray(o.children)||o.children.length<1?s.push(`${c}: stack requires at least 1 child`):o.children.forEach((d,p)=>{Gd(d)?i(d,`${c}.children[${p}]`,u+1):s.push(`${c}.children[${p}]: invalid node`)});break}}};return i(a,"$",t),s}class d1{constructor(t={}){Fe(this,"listeners",new Map);Fe(this,"onError");this.onError=t.onError??((s,i)=>{console.error(`[workspace] EventBus handler error for "${String(i)}":`,s)})}on(t,s){let i=this.listeners.get(t);return i||(i=new Set,this.listeners.set(t,i)),i.add(s),()=>this.off(t,s)}once(t,s){const i=o=>{this.off(t,i),s(o)};return this.on(t,i)}off(t,s){const i=this.listeners.get(t);i&&(i.delete(s),i.size===0&&this.listeners.delete(t))}emit(t,s){const i=this.listeners.get(t);if(!(!i||i.size===0))for(const o of[...i])try{o(s)}catch(c){this.onError(c,String(t),o)}}listenerCount(t){var i;if(t!==void 0)return((i=this.listeners.get(t))==null?void 0:i.size)??0;let s=0;for(const o of this.listeners.values())s+=o.size;return s}clear(){this.listeners.clear()}}const f1=/^[a-z][a-z0-9._-]*$/;function qd(a){return typeof a=="string"&&f1.test(a)}const Gl="";let Fy=0;function p1(a="cmd"){const t=typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).slice(2)}`;return Fy+=1,`${a}-${Fy}-${t}`}const m1=1e4;class h1{constructor(t={}){Fe(this,"handlers",new Map);Fe(this,"capabilityToCommand",new Map);Fe(this,"pending",new Map);Fe(this,"defaultTimeoutMs");Fe(this,"onError");this.defaultTimeoutMs=t.defaultTimeoutMs??m1,this.onError=t.onError??((s,i)=>{console.error(`[workspace] CommandBus handler error for "${i}":`,s)})}register(t,s,i={}){if(!qd(t))throw new Error(`[workspace] invalid command id: ${JSON.stringify(t)}`);const o=i.scope??Gl;if(o!==Gl&&!qd(o))throw new Error(`[workspace] invalid command scope: ${JSON.stringify(o)}`);let c=this.handlers.get(t);if(c||(c=new Map,this.handlers.set(t,c)),c.has(o))throw new Error(`[workspace] duplicate command handler: "${t}"${o?` (scope: ${o})`:""}`);if(i.capability!==void 0){if(!qd(i.capability))throw new Error(`[workspace] invalid capability id: ${JSON.stringify(i.capability)}`);if(this.capabilityToCommand.has(i.capability))throw new Error(`[workspace] duplicate capability mapping: "${i.capability}"`);this.capabilityToCommand.set(i.capability,t)}c.set(o,s);let u=!1;return()=>{if(u)return;u=!0;const d=this.handlers.get(t);d&&(d.delete(o),d.size===0&&this.handlers.delete(t)),i.capability!==void 0&&this.capabilityToCommand.delete(i.capability)}}has(t){return this.handlers.has(t)}listCommands(){return[...this.handlers.keys()]}resolveCapability(t){return this.capabilityToCommand.get(t)}capabilities(){return[...this.capabilityToCommand.entries()].map(([t,s])=>({capability:t,command:s}))}async execute(t,s,i={}){const o=i.requestId??p1(),c=this.resolveHandler(t,i.scope);if(!c)return{success:!1,requestId:o,command:t,error:`unknown command: "${t}"`,durationMs:0};const u=i.timeoutMs??this.defaultTimeoutMs,d=Date.now(),p=`command "${t}" timed out after ${u}ms`;return await new Promise(g=>{const y=setTimeout(()=>{this.pending.delete(o),g({success:!1,requestId:o,command:t,error:p,durationMs:Date.now()-d})},u);this.pending.set(o,{resolve:g,timer:y,startedAt:d,command:t}),Promise.resolve().then(()=>c(s,{requestId:o,command:t})).then(b=>{this.settle(o,{success:!0,requestId:o,command:t,result:b,durationMs:Date.now()-d})},b=>{this.onError(b,t),this.settle(o,{success:!1,requestId:o,command:t,error:b instanceof Error?b.message:String(b),durationMs:Date.now()-d})})})}handle(t){return this.execute(t.command,t.payload,{timeoutMs:t.timeoutMs,requestId:t.id,scope:t.scope})}resolveHandler(t,s){const i=this.handlers.get(t);if(i){if(s&&s!==Gl){const o=i.get(s);if(o)return o}return i.get(Gl)}}cancel(t,s="cancelled"){const i=this.pending.get(t);return i?(this.pending.delete(t),i.timer&&clearTimeout(i.timer),i.resolve({success:!1,requestId:t,command:i.command,error:s,durationMs:Date.now()-i.startedAt}),!0):!1}pendingCount(){return this.pending.size}settle(t,s){const i=this.pending.get(t);i&&(this.pending.delete(t),i.timer&&clearTimeout(i.timer),i.resolve(s))}}const g1=/^[a-zA-Z]:[\\/]/,y1=/\0/;function b1(a){if(typeof a!="string"||a.length===0||y1.test(a)||g1.test(a)||a.startsWith("/")||a.startsWith("\\"))return!1;const t=a.replace(/\\/g,"/").split("/");let s=0;for(const i of t)if(!(i===""||i==="."))if(i===".."){if(s-=1,s<0)return!1}else s+=1;return!0}function Gy(a,t=""){if(!b1(a))throw new Error(`[workspace] unsafe path rejected: ${JSON.stringify(a)}`);const s=a.replace(/\\/g,"/").split("/"),i=[];for(const u of s)u===""||u==="."||(u===".."?i.pop():i.push(u));const o=i.join("/");return t?`${t.replace(/[\\/]+$/,"")}/${o}`:o}class v1{diff(t,s,i={}){let o;typeof i=="function"?(o=i,i={}):"callback"in i&&(o=i.callback);const c=this.castInput(t,i),u=this.castInput(s,i),d=this.removeEmpty(this.tokenize(c,i)),p=this.removeEmpty(this.tokenize(u,i));return this.diffWithOptionsObj(d,p,i,o)}diffWithOptionsObj(t,s,i,o){var c;const u=A=>{if(A=this.postProcess(A,i),o){setTimeout(function(){o(A)},0);return}else return A},d=s.length,p=t.length;let g=1,y=d+p;i.maxEditLength!=null&&(y=Math.min(y,i.maxEditLength));const b=(c=i.timeout)!==null&&c!==void 0?c:1/0,x=Date.now()+b,S=[{oldPos:-1,lastComponent:void 0}];let k=this.extractCommon(S[0],s,t,0,i);if(S[0].oldPos+1>=p&&k+1>=d)return u(this.buildValues(S[0].lastComponent,s,t));let C=-1/0,T=1/0;const E=()=>{for(let A=Math.max(C,-g);A<=Math.min(T,g);A+=2){let B;const M=S[A-1],j=S[A+1];M&&(S[A-1]=void 0);let J=!1;if(j){const te=j.oldPos-A;J=j&&0<=te&&te<d}const Y=M&&M.oldPos+1<p;if(!J&&!Y){S[A]=void 0;continue}if(!Y||J&&M.oldPos<j.oldPos?B=this.addToPath(j,!0,!1,0,i):B=this.addToPath(M,!1,!0,1,i),k=this.extractCommon(B,s,t,A,i),B.oldPos+1>=p&&k+1>=d)return u(this.buildValues(B.lastComponent,s,t))||!0;S[A]=B,B.oldPos+1>=p&&(T=Math.min(T,A-1)),k+1>=d&&(C=Math.max(C,A+1))}g++};if(o)(function A(){setTimeout(function(){if(g>y||Date.now()>x)return o(void 0);E()||A()},0)})();else for(;g<=y&&Date.now()<=x;){const A=E();if(A)return A}}addToPath(t,s,i,o,c){const u=t.lastComponent;return u&&!c.oneChangePerToken&&u.added===s&&u.removed===i?{oldPos:t.oldPos+o,lastComponent:{count:u.count+1,added:s,removed:i,previousComponent:u.previousComponent}}:{oldPos:t.oldPos+o,lastComponent:{count:1,added:s,removed:i,previousComponent:u}}}extractCommon(t,s,i,o,c){const u=s.length,d=i.length;let p=t.oldPos,g=p-o,y=0;for(;g+1<u&&p+1<d&&this.equals(i[p+1],s[g+1],c);)g++,p++,y++,c.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return y&&!c.oneChangePerToken&&(t.lastComponent={count:y,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=p,g}equals(t,s,i){return i.comparator?i.comparator(t,s):t===s||!!i.ignoreCase&&t.toLowerCase()===s.toLowerCase()}removeEmpty(t){const s=[];for(let i=0;i<t.length;i++)t[i]&&s.push(t[i]);return s}castInput(t,s){return t}tokenize(t,s){return Array.from(t)}join(t){return t.join("")}postProcess(t,s){return t}get useLongestToken(){return!1}buildValues(t,s,i){const o=[];let c;for(;t;)o.push(t),c=t.previousComponent,delete t.previousComponent,t=c;o.reverse();const u=o.length;let d=0,p=0,g=0;for(;d<u;d++){const y=o[d];if(y.removed)y.value=this.join(i.slice(g,g+y.count)),g+=y.count;else{if(!y.added&&this.useLongestToken){let b=s.slice(p,p+y.count);b=b.map(function(x,S){const k=i[g+S];return k.length>x.length?k:x}),y.value=this.join(b)}else y.value=this.join(s.slice(p,p+y.count));p+=y.count,y.added||(g+=y.count)}}return o}}class x1 extends v1{constructor(){super(...arguments),this.tokenize=k1}equals(t,s,i){return i.ignoreWhitespace?((!i.newlineIsToken||!t.includes(`
31
- `))&&(t=t.trim()),(!i.newlineIsToken||!s.includes(`
32
- `))&&(s=s.trim())):i.ignoreNewlineAtEof&&!i.newlineIsToken&&(t.endsWith(`
33
- `)&&(t=t.slice(0,-1)),s.endsWith(`
34
- `)&&(s=s.slice(0,-1))),super.equals(t,s,i)}}const S1=new x1;function _f(a,t,s){return S1.diff(a,t,s)}function k1(a,t){t.stripTrailingCr&&(a=a.replace(/\r\n/g,`
35
- `));const s=[],i=a.split(/(\n|\r\n)/);i[i.length-1]||i.pop();for(let o=0;o<i.length;o++){const c=i[o];o%2&&!t.newlineIsToken?s[s.length-1]+=c:s.push(c)}return s}function w1(a){for(let t=0;t<a.length;t++)if(a[t]<" "||a[t]>"~"||a[t]==='"'||a[t]==="\\")return!0;return!1}function ma(a){if(!w1(a))return a;let t='"';const s=new TextEncoder().encode(a);let i=0;for(;i<s.length;){const o=s[i];o===7?t+="\\a":o===8?t+="\\b":o===9?t+="\\t":o===10?t+="\\n":o===11?t+="\\v":o===12?t+="\\f":o===13?t+="\\r":o===34?t+='\\"':o===92?t+="\\\\":o>=32&&o<=126?t+=String.fromCharCode(o):t+="\\"+o.toString(8).padStart(3,"0"),i++}return t+='"',t}const qy={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function C1(a,t,s,i,o,c,u){let d;d={},typeof d.context>"u"&&(d.context=4);const p=d.context;if(d.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(d.callback){const{callback:y}=d;_f(s,i,Object.assign(Object.assign({},d),{callback:b=>{const x=g(b);y(x)}}))}else return g(_f(s,i,d));function g(y){if(!y)return;y.push({value:"",lines:[]});function b(A){return A.map(function(B){return" "+B})}const x=[];let S=0,k=0,C=[],T=1,E=1;for(let A=0;A<y.length;A++){const B=y[A],M=B.lines||_1(B.value);if(B.lines=M,B.added||B.removed){if(!S){const j=y[A-1];S=T,k=E,j&&(C=p>0?b(j.lines.slice(-p)):[],S-=C.length,k-=C.length)}for(const j of M)C.push((B.added?"+":"-")+j);B.added?E+=M.length:T+=M.length}else{if(S)if(M.length<=p*2&&A<y.length-2)for(const j of b(M))C.push(j);else{const j=Math.min(M.length,p);for(const Y of b(M.slice(0,j)))C.push(Y);const J={oldStart:S,oldLines:T-S+j,newStart:k,newLines:E-k+j,lines:C};x.push(J),S=0,k=0,C=[]}T+=M.length,E+=M.length}}for(const A of x)for(let B=0;B<A.lines.length;B++)A.lines[B].endsWith(`
36
- `)?A.lines[B]=A.lines[B].slice(0,-1):(A.lines.splice(B+1,0,"\"),B++);return{oldFileName:a,newFileName:t,oldHeader:o,newHeader:c,hunks:x}}}function Xb(a,t){var s,i,o,c,u,d;if(t||(t=qy),Array.isArray(a)){if(a.length>1&&!t.includeFileHeaders&&!a.every(y=>y.isGit))throw new Error("Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)");return a.map(y=>Xb(y,t)).join(`
37
- `)}const p=[];if(a.isGit){if(t=qy,!a.oldFileName)throw new Error("oldFileName must be specified for Git patches");if(!a.newFileName)throw new Error("newFileName must be specified for Git patches");let y=a.oldFileName,b=a.newFileName;a.isCreate&&y==="/dev/null"?y=b.replace(/^b\//,"a/"):a.isDelete&&b==="/dev/null"&&(b=y.replace(/^a\//,"b/")),p.push("diff --git "+ma(y)+" "+ma(b)),a.isDelete&&p.push("deleted file mode "+((s=a.oldMode)!==null&&s!==void 0?s:"100644")),a.isCreate&&p.push("new file mode "+((i=a.newMode)!==null&&i!==void 0?i:"100644")),a.oldMode&&a.newMode&&!a.isDelete&&!a.isCreate&&(p.push("old mode "+a.oldMode),p.push("new mode "+a.newMode)),a.isRename&&(p.push("rename from "+ma(((o=a.oldFileName)!==null&&o!==void 0?o:"").replace(/^a\//,""))),p.push("rename to "+ma(((c=a.newFileName)!==null&&c!==void 0?c:"").replace(/^b\//,"")))),a.isCopy&&(p.push("copy from "+ma(((u=a.oldFileName)!==null&&u!==void 0?u:"").replace(/^a\//,""))),p.push("copy to "+ma(((d=a.newFileName)!==null&&d!==void 0?d:"").replace(/^b\//,""))))}else t.includeIndex&&a.oldFileName==a.newFileName&&a.oldFileName!==void 0&&p.push("Index: "+a.oldFileName),t.includeUnderline&&p.push("===================================================================");const g=a.hunks.length>0;t.includeFileHeaders&&a.oldFileName!==void 0&&a.newFileName!==void 0&&(!a.isGit||g)&&(p.push("--- "+ma(a.oldFileName)+(a.oldHeader?" "+a.oldHeader:"")),p.push("+++ "+ma(a.newFileName)+(a.newHeader?" "+a.newHeader:"")));for(let y=0;y<a.hunks.length;y++){const b=a.hunks[y],x=b.oldLines===0?b.oldStart-1:b.oldStart,S=b.newLines===0?b.newStart-1:b.newStart;p.push("@@ -"+x+","+b.oldLines+" +"+S+","+b.newLines+" @@");for(const k of b.lines)p.push(k)}return p.join(`
38
- `)+`
39
- `}function Wd(a,t,s,i,o,c,u){{const d=C1(a,t,s,i,o,c);return d?Xb(d,void 0):void 0}}function _1(a){const t=a.endsWith(`
40
- `),s=a.split(`
41
- `).map(i=>i+`
42
- `);return t?s.pop():s.push(s.pop().slice(0,-1)),s}function T1(a,t){const s=a?new Map(a.files.map(d=>[d.path,d.content])):new Map,i=new Map(t.files.map(d=>[d.path,d.content])),c=[...new Set([...s.keys(),...i.keys()])].sort().map(d=>{const p=s.get(d)??"",g=i.get(d)??"",y=s.has(d),b=i.has(d);if(!y&&b){const C=g.length===0?0:(g.match(/\n/g)??[]).length;return{path:d,change:"added",addedLines:C,removedLines:0,patch:Wd(d,d,"",g)}}if(y&&!b){const C=p.length===0?0:(p.match(/\n/g)??[]).length;return{path:d,change:"removed",addedLines:0,removedLines:C,patch:Wd(d,d,p,"")}}if(p===g)return{path:d,change:"unchanged",addedLines:0,removedLines:0};const x=_f(p,g);let S=0,k=0;for(const C of x){const T=(C.value.match(/\n/g)??[]).length;C.added?S+=T:C.removed&&(k+=T)}return{path:d,change:"modified",addedLines:S,removedLines:k,patch:Wd(d,d,p,g)}}),u=c.filter(d=>d.change!=="unchanged");return{fromId:(a==null?void 0:a.id)??null,toId:t.id,files:c,totalAdded:u.reduce((d,p)=>d+p.addedLines,0),totalRemoved:u.reduce((d,p)=>d+p.removedLines,0),changedFileCount:u.length}}const Jb=_.createContext(null);function Kf(){const a=_.useContext(Jb);if(!a)throw new Error("[workspace] useArtifactContext must be used inside <ArtifactProvider>");return a}let Wy=0;function N1(){return Wy+=1,`v${Wy}-${Date.now().toString(36)}`}function E1({children:a,initial:t,versionStore:s}){const[i,o]=_.useState((t==null?void 0:t.artifactId)??null),[c,u]=_.useState((t==null?void 0:t.kind)??"unknown"),[d,p]=_.useState((t==null?void 0:t.files)??{}),[g,y]=_.useState((t==null?void 0:t.versions)??[]),[b,x]=_.useState((t==null?void 0:t.previewUrl)??null),S=_.useCallback((B,M)=>{const j=Gy(B);p(J=>({...J,[j]:M}))},[]),k=_.useCallback(B=>{const M=Gy(B);p(j=>{if(!(M in j))return j;const J={...j};return delete J[M],J})},[]),C=_.useCallback(B=>{if(Object.keys(d).length===0)return null;const M={id:N1(),createdAt:Date.now(),files:Object.entries(d).map(([j,J])=>({path:j,content:J})),message:B};return y(j=>[...j,M]),s&&i&&s.persistVersion(i,M).then(j=>{j.ok||console.warn("[workspace] failed to persist version snapshot",j.error)}),M},[d,i,s]),T=_.useCallback(B=>{const M=g.find(j=>j.id===B);return M?(p(Object.fromEntries(M.files.map(j=>[j.path,j.content]))),!0):!1},[g]),E=_.useCallback((B,M)=>{const j=g.find(Y=>Y.id===M);if(!j)return null;const J=B===null?null:g.find(Y=>Y.id===B)??null;return T1(J,j)},[g]),A=_.useMemo(()=>({artifactId:i,kind:c,files:d,versions:g,previewUrl:b,setArtifactId:o,setKind:u,saveFile:S,deleteFile:k,addVersion:C,restoreVersion:T,diffVersions:E,setPreviewUrl:x}),[i,c,d,g,b,S,k,C,T,E]);return m.jsx(Jb.Provider,{value:A,children:a})}const Oi=Ut()(a=>({layout:null,device:"desktop",activeSlot:null,setLayout:t=>a({layout:t}),setDevice:t=>a({device:t}),setActiveSlot:t=>a({activeSlot:t})})),ev=_.createContext(null);function A1(){const a=_.useContext(ev);if(!a)throw new Error("[workspace] useViewContext must be used inside <ViewProvider>");return a}function j1({children:a,layout:t,syncOnMount:s=!0}){const i=Oi(y=>y.layout),o=Oi(y=>y.device),c=Oi(y=>y.activeSlot),u=Oi(y=>y.setLayout),d=Oi(y=>y.setDevice),p=Oi(y=>y.setActiveSlot);_.useEffect(()=>{s&&t!==void 0&&t!==i&&u(t)},[]);const g=_.useMemo(()=>({layout:t??i,device:o,activeSlot:c,setLayout:u,setDevice:d,setActiveSlot:p}),[t,i,o,c,u,d,p]);return m.jsx(ev.Provider,{value:g,children:a})}const tv=_.createContext(null);function R1(){const a=_.useContext(tv);if(!a)throw new Error("[workspace] useSessionContext must be used inside <SessionProvider>");return a}function M1({children:a,initial:t}){const[s,i]=_.useState((t==null?void 0:t.conversationId)??null),[o,c]=_.useState((t==null?void 0:t.task)??""),[u,d]=_.useState((t==null?void 0:t.toolCalls)??[]),p=_.useCallback(b=>{d(x=>[...x,b])},[]),g=_.useCallback((b,x)=>{d(S=>S.map(k=>k.id===b?{...k,...x}:k))},[]),y=_.useMemo(()=>({conversationId:s,task:o,toolCalls:u,setConversationId:i,setTask:c,appendToolCall:p,updateToolCall:g}),[s,o,u,p,g]);return m.jsx(tv.Provider,{value:y,children:a})}class O1{constructor(){Fe(this,"providers",new Map)}register(t,s,i){if(this.providers.has(t))throw new Error(`[workspace] duplicate context provider: "${t}"`);return this.providers.set(t,{provider:s,value:i}),()=>this.unregister(t)}unregister(t){return this.providers.delete(t)}get(t){var s;return(s=this.providers.get(t))==null?void 0:s.provider}valueOf(t){var s;return(s=this.providers.get(t))==null?void 0:s.value}entries(){return[...this.providers.entries()].map(([t,s])=>[t,s.provider,s.value])}clear(){this.providers.clear()}}const B1=new O1,nv=_.createContext(null);function D1(){const a=_.useContext(nv);if(!a)throw new Error("[workspace] useWorkspace must be used inside <WorkspaceProvider>");return a}function L1({children:a,registry:t=Vf,layout:s,artifact:i,session:o,mountExtraContexts:c=!0}){const u=_.useRef(null);u.current===null&&(u.current={registry:t,eventBus:new d1,commandBus:new h1,registryVersion:0});const[d,p]=_.useState(0);_.useEffect(()=>t.onChange(()=>p(x=>x+1)),[t]);const g=_.useMemo(()=>({...u.current,registryVersion:d}),[d]),y=_.useMemo(()=>c?B1.entries():[],[c]);let b=a;for(const[x,S,k]of y)b=m.jsx(S,{value:k,children:b},x);return m.jsx(nv.Provider,{value:g,children:m.jsx(E1,{initial:i,children:m.jsx(j1,{layout:s,children:m.jsx(M1,{initial:o,children:b})})})})}function xc(){const a=D1(),t=Kf(),s=A1(),i=R1();return _.useMemo(()=>({...a,artifact:t,view:s,session:i}),[a,t,s,i])}function z1({label:a}){return m.jsx("div",{className:"flex h-full w-full items-center justify-center text-xs text-dark-muted","data-testid":"workspace-slot-loading",children:a?`Loading ${a}…`:"Loading…"})}function U1({slotId:a}){return m.jsxs("div",{className:"flex h-full w-full items-center justify-center border border-dashed border-dark-border text-xs text-dark-muted","data-testid":`workspace-empty-slot-${a}`,children:["No component for slot “",a,"”"]})}function Sc({message:a}){return m.jsx("div",{className:"flex h-full w-full items-center justify-center bg-red-950/30 p-3 text-xs text-red-300","data-testid":"workspace-slot-error",children:a})}class I1 extends _.Component{constructor(){super(...arguments);Fe(this,"state",{error:null})}static getDerivedStateFromError(s){return{error:s}}componentDidCatch(s,i){console.error("[workspace] slot component crashed:",s,i.componentStack)}render(){return this.state.error?this.props.fallback?this.props.fallback(this.state.error):Sc({message:this.state.error.message}):this.props.children}}function $1({slotId:a,componentId:t,requiredCapabilities:s,preferredComponentId:i}){const{registry:o,artifact:c}=xc(),u=(t?o.get(t):void 0)??o.resolve({slotId:a,artifact:c.artifactId?{kind:c.kind}:null,requiredCapabilities:s,preferredComponentId:i});return m.jsx(H1,{slotId:a,def:u})}function H1({slotId:a,def:t}){const{eventBus:s,commandBus:i,artifact:o}=xc(),c=t==null?void 0:t.component;return _.useEffect(()=>{var u;if((u=t==null?void 0:t.lifecycle)!=null&&u.mount)return t.lifecycle.mount({artifactId:o.artifactId??void 0,eventBus:s,commandBus:i}),()=>{var d,p;return(p=(d=t.lifecycle)==null?void 0:d.unmount)==null?void 0:p.call(d,{artifactId:o.artifactId??void 0,eventBus:s,commandBus:i})}},[t,s,i,o.artifactId]),!t||!c?m.jsx(U1,{slotId:a}):m.jsx(I1,{children:m.jsx(_.Suspense,{fallback:m.jsx(z1,{label:t.id}),children:m.jsx(c,{slotId:a,defId:t.id})})})}function P1({layout:a}){if(!a)return m.jsx("div",{className:"flex h-full w-full items-center justify-center text-xs text-dark-muted","data-testid":"workspace-empty",children:"Workspace is empty — no layout configured"});const t=Qb(a);return t.length>0?m.jsx(Sc,{message:`Invalid workspace layout: ${t.join("; ")}`}):m.jsx(Tf,{node:a})}function Tf({node:a}){switch(a.type){case"slot":return m.jsx($1,{slotId:a.id,componentId:a.componentId});case"split":return m.jsxs(Rb,{direction:a.direction==="horizontal"?"horizontal":"vertical",className:"h-full w-full overflow-hidden",children:[a.children.map((t,s)=>{var i;return m.jsx(cf,{defaultSize:((i=a.sizes)==null?void 0:i[s])??50,className:"min-h-0 min-w-0",children:m.jsx(Tf,{node:t})},s)}),a.children.slice(0,-1).map((t,s)=>m.jsx(Mb,{className:"w-px bg-dark-border transition-colors hover:bg-accent-blue data-[resize-handle-state=hover]:bg-accent-blue data-[resize-handle-state=drag]:bg-accent-blue"},`h-${s}`))]});case"stack":return m.jsx("div",{className:"flex h-full w-full flex-col overflow-hidden",children:a.children.map((t,s)=>m.jsx("div",{className:"min-h-0 min-w-0 flex-1 border-b border-dark-border last:border-b-0",children:m.jsx(Tf,{node:t})},s))});default:return m.jsx(Sc,{message:`Unknown layout node: ${JSON.stringify(a)}`})}}const F1="1",G1=["ready","select","inspect","screenshot","highlight","command","event"];function q1(a){return typeof a=="string"&&G1.includes(a)}function W1(a){if(typeof a!="object"||a===null||Array.isArray(a))return{ok:!1,error:"workspace message must be a plain object"};const t=a;return t.version!==F1?{ok:!1,error:`unsupported workspace protocol version: ${JSON.stringify(t.version)}`}:q1(t.type)?typeof t.requestId!="string"||t.requestId.length===0?{ok:!1,error:"workspace message requires a non-empty requestId"}:{ok:!0,data:{version:t.version,type:t.type,requestId:t.requestId,payload:t.payload}}:{ok:!1,error:`unknown workspace message type: ${JSON.stringify(t.type)}`}}function V1({layout:a=null,registry:t=Vf,artifact:s,session:i,onRegister:o,toolbar:c,statusBar:u,onLayoutError:d}){_.useEffect(()=>{if(o)return o(t)},[]);const p=a?Qb(a):[];return p.length>0?(d==null||d(p),m.jsx("div",{className:"flex h-full w-full flex-col bg-dark-surface","data-testid":"workspace-runtime",children:m.jsx(Sc,{message:`Invalid workspace layout: ${p.join("; ")}`})})):m.jsx("div",{className:"flex h-full w-full flex-col overflow-hidden bg-dark-surface","data-testid":"workspace-runtime",children:m.jsxs(L1,{registry:t,layout:a,artifact:s,session:i,children:[c&&m.jsx("div",{className:"shrink-0 border-b border-dark-border",children:c}),m.jsx("div",{className:"min-h-0 min-w-0 flex-1",children:m.jsx(P1,{layout:a})}),u&&m.jsx("div",{className:"shrink-0 border-t border-dark-border",children:u})]})})}const co="demo.ping",Nf="demo.pong",K1=`<!doctype html>
43
- <html>
44
- <head><meta charset="utf-8"><title>Demo Artifact</title></head>
45
- <body style="font-family:system-ui;padding:24px;background:#0f172a;color:#e2e8f0">
46
- <h2>AI 生成的工作台工件</h2>
47
- <p>这个页面运行在 <code>sandbox="allow-scripts allow-forms allow-modals"</code> 的 iframe 中。</p>
48
- <button id="say" onclick="parent.postMessage({version:'1',type:'event',requestId:'demo-1',payload:{event:'preview.interaction',data:{clicked:true}}},'*')">点击向宿主发送事件</button>
49
- <script>document.getElementById('say').textContent='✓ 已就绪(blob: opaque origin)'<\/script>
50
- </body>
51
- </html>`;function Vy({slotId:a,defId:t}){const{eventBus:s,commandBus:i}=xc(),o=Kf(),[c,u]=_.useState(0),[d,p]=_.useState(null);return _.useEffect(()=>{const g=s.on(co,()=>u(x=>x+1));let y;t==="panel-b"&&(y=i.register(Nf,()=>(p(new Date().toISOString()),{pong:!0,slotId:a})));let b;return t==="panel-a"&&(b=setTimeout(()=>s.emit(co,{from:t}),0)),()=>{g(),y==null||y(),b&&clearTimeout(b)}},[s,i,t,a]),m.jsxs("div",{className:"flex h-full w-full flex-col gap-2 p-3","data-testid":`test-panel-${t}`,children:[m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsx("span",{className:"text-xs font-semibold text-dark-text",children:t}),m.jsxs("span",{className:"text-[10px] text-dark-muted",children:["slot: ",a]})]}),m.jsxs("div",{className:"flex items-center gap-2 text-xs text-dark-muted",children:[m.jsx("span",{"data-testid":`ping-count-${t}`,children:c}),m.jsx("button",{type:"button",onClick:()=>s.emit(co,{from:t}),className:"rounded bg-accent-blue/10 px-2 py-0.5 text-accent-blue hover:bg-accent-blue/20",children:"emit ping"}),t==="panel-b"&&m.jsx("button",{type:"button",onClick:()=>{const g=URL.createObjectURL(new Blob([K1],{type:"text/html"}));o.setArtifactId("demo/index.html"),o.setKind("web"),o.setPreviewUrl(g)},className:"rounded bg-accent-green/10 px-2 py-0.5 text-accent-green hover:bg-accent-green/20","data-testid":"demo-preview-button",children:"preview demo"})]}),d&&m.jsxs("div",{className:"text-[10px] text-emerald-400","data-testid":`pong-${t}`,children:["pong @ ",d]})]})}function Y1(a=Vf){const t=a.register({id:"panel-a",capability:"demo.panel.a",component:Vy,slots:["left"],priority:10,metadata:{label:"Panel A"},lifecycle:{mount:()=>{},unmount:()=>{}}}),s=a.register({id:"panel-b",capability:"demo.panel.b",component:Vy,slots:["right"],priority:10,metadata:{label:"Panel B"},aiManifest:{description:"Demo panel that responds to demo.pong commands",commands:[Nf],capabilities:[{capability:"demo.panel.b.pong",command:Nf,description:"Ping back from panel-b",parameters:[{name:"from",type:"string",description:"who is pinging",required:!1}]}],events:{listen:[co],emit:[co]}}});return()=>{t(),s()}}const Z1={select:"preview.element.select",inspect:"preview.element.inspect",screenshot:"preview.element.screenshot",highlight:"preview.element.highlight"};function Q1(a,t){const s=t??{},i=typeof s.selector=="string"&&s.selector.trim()!==""?s.selector:void 0,o=typeof s.elementId=="string"&&s.elementId.trim()!==""?s.elementId:void 0;return!i&&!o?{ok:!1,error:`interactive "${a}" message requires a non-empty selector or elementId`}:{ok:!0,elementRef:{selector:i,elementId:o}}}function X1(a,t){var o,c,u,d,p,g,y,b,x;const s=W1(a);if(!s.ok)return(o=t.onError)==null||o.call(t,s.error),!1;const i=s.data;switch(i.type){case"ready":return(c=t.onReady)==null||c.call(t,i),!0;case"event":{const S=i.payload??{};return typeof S.event!="string"?((u=t.onError)==null||u.call(t,`iframe event message requires payload.event string, got ${JSON.stringify(S.event)}`),!1):((d=t.onEvent)==null||d.call(t,S.event,S.data,i),!0)}case"command":{const S=i.payload??{};return typeof S.command!="string"?((p=t.onError)==null||p.call(t,`iframe command message requires payload.command string, got ${JSON.stringify(S.command)}`),!1):((g=t.onCommand)==null||g.call(t,S.command,S.payload,i),!0)}case"select":case"inspect":case"screenshot":case"highlight":{const S=Q1(i.type,i.payload);return S.ok?((b=t.onEvent)==null||b.call(t,Z1[i.type],{...i.payload??{},elementRef:S.elementRef},i),!0):((y=t.onError)==null||y.call(t,S.error),!1)}default:return(x=t.onError)==null||x.call(t,`unsupported message type: ${JSON.stringify(i.type)}`),!1}}function J1(a,t){const s=_.useRef(t);s.current=t;const i=o=>{var u;const c=(u=a.current)==null?void 0:u.contentWindow;c&&c.postMessage(o,"*")};return _.useEffect(()=>{const o=c=>{var b;const u=(b=a.current)==null?void 0:b.contentWindow;if(u&&c.source!==u||u===void 0&&c.source!==null)return;const{eventBus:d,onCommand:p,onReady:g,onError:y}=s.current;X1(c.data,{onEvent:(x,S)=>d.emit(x,S),onCommand:p??(()=>{}),onReady:g,onError:y})};return window.addEventListener("message",o),()=>window.removeEventListener("message",o)},[a]),{post:i}}function eC(a,t){const s=(a.split(".").pop()||"").toLowerCase();return t==="web"||s==="html"||s==="htm"?"html":["png","jpg","jpeg","gif","svg","webp","ico","bmp"].includes(s)||t==="document"?"image":"text"}function tC({slotId:a}){const{artifactId:t,kind:s,previewUrl:i}=Kf(),{eventBus:o}=xc(),[c,u]=_.useState(null),[d,p]=_.useState(null),[g,y]=_.useState(null),b=_.useRef(null),x=t??null,S=x?eC(x,s):"text";return J1(b,{eventBus:o,onError:k=>y(k)}),_.useEffect(()=>{if(S!=="html"||!x)return;if(i&&i.startsWith("blob:")){p(i),y(null);return}let k=!1;return y(null),u(null),(async()=>{try{const C=await Ge.files.read(x);if(k)return;if(!C.success||C.data===void 0){y(C.error||"failed to read artifact");return}const T=new Blob([String(C.data)],{type:"text/html"}),E=URL.createObjectURL(T);u(String(C.data)),p(E)}catch(C){k||y(C instanceof Error?C.message:String(C))}})(),()=>{k=!0,d&&URL.revokeObjectURL(d)}},[S,x,i]),m.jsxs("div",{className:"flex h-full w-full min-h-0 flex-col","data-testid":`web-preview-${a}`,children:[m.jsxs("div",{className:"shrink-0 flex items-center gap-2 border-b border-dark-border/60 px-2 py-1 text-[10px] text-dark-muted",children:[m.jsx("span",{className:"truncate font-mono",children:x??"no artifact"}),m.jsx("span",{className:"ml-auto shrink-0 uppercase",children:S})]}),g&&m.jsx("div",{className:"m-2 rounded border border-accent-red/30 bg-accent-red/5 px-2 py-1.5 text-[11px] text-accent-red",children:g}),m.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:x?S==="html"&&d?m.jsx("iframe",{ref:b,title:`preview-${x}`,sandbox:"allow-scripts allow-forms allow-modals",src:d,className:"h-full w-full border-0 bg-white","data-testid":"web-preview-iframe"}):S==="image"?m.jsx("img",{src:i??void 0,alt:x,className:"mx-auto max-h-full max-w-full object-contain","data-testid":"web-preview-image"}):m.jsx("pre",{className:"whitespace-pre-wrap break-all p-3 font-mono text-[11px] leading-relaxed text-dark-text",children:c??(i?`Loading ${x}…`:`Preview ${x}`)}):m.jsx("div",{className:"grid h-full place-items-center p-4 text-center text-xs text-dark-muted/70",children:"Select an artifact to preview it here."})})]})}function nC(a){return a.register({id:"web-preview",capability:"preview.artifact",component:tC,slots:["preview"],priority:10,metadata:{label:"Preview"},aiManifest:{description:"Renders the current artifact (HTML in a sandboxed iframe, images, text)",commands:[],events:{listen:[],emit:[]}}})}const sC=["write_file","edit_file","file_write","file_edit","file_create","file_append","notebook_edit","notebook_write","apply_patch","git_apply_patch","git_commit","FileEditTool","FileWriteTool","EditTool","NotebookEditTool","Write","Edit","WriteTool","FileCreateTool"],aC=/(?:^|[_\W])(write|edit|save|create|update|modify|patch|output|export|render|generate|build)(?:[_\W]|$)/i,iC=/(?:^|[_\W])(read|open|cat|view|list|ls|dir|find|grep|glob|search)(?:[_\W]|$)/i;function Yi(a){return sC.includes(a)?!0:aC.test(a)&&!iC.test(a)}function rC(a){let t=null;if(typeof a=="string")try{const s=JSON.parse(a);s&&typeof s=="object"&&!Array.isArray(s)&&(t=s)}catch{return}else a&&typeof a=="object"&&!Array.isArray(a)&&(t=a);if(t)return t.filePath||t.path||t.file||t.file_path||t.outputPath||t.output}function uo(a){const t=a.split(/[\\/]/);return t[t.length-1]||a}function Ef(a){const t=(a.split(".").pop()||"").toLowerCase();return["png","jpg","jpeg","gif","svg","webp","ico","bmp"].includes(t)?"image":["md","markdown","mdown"].includes(t)?"markdown":["ts","tsx","js","jsx","json","css","html","htm","py","sh","yaml","yml","go","rs","toml","sql","java","c","cpp","h","rb","php"].includes(t)?"code":"file"}function oC({kind:a,size:t=14}){return a==="image"?m.jsx(LS,{size:t,className:"text-dark-muted shrink-0"}):a==="markdown"?m.jsx(Fi,{size:t,className:"text-dark-muted shrink-0"}):a==="code"?m.jsx(zS,{size:t,className:"text-dark-muted shrink-0"}):m.jsx(_b,{size:t,className:"text-dark-muted shrink-0"})}function sv(a){var s;const t=new Map;for(const i of a){if((s=i.fileJob)!=null&&s.result)for(const o of i.fileJob.result)o.path&&!t.has(o.path)&&t.set(o.path,{path:o.path,name:o.fileName||uo(o.path),source:"filejob"});for(const o of i.toolCalls??[]){if(o.status==="error")continue;const c=rC(o.args);c&&Yi(o.name)&&!t.has(c)&&t.set(c,{path:c,name:uo(c),source:"toolcall"})}}return Array.from(t.values())}function lC({status:a}){return a==="running"?m.jsx(Ln,{size:12,className:"animate-spin text-accent-blue shrink-0 mt-0.5"}):a==="completed"?m.jsx(gc,{size:12,className:"text-accent-green shrink-0 mt-0.5"}):a==="failed"?m.jsx($f,{size:12,className:"text-accent-red shrink-0 mt-0.5"}):a==="skipped"?m.jsx(DS,{size:12,className:"text-dark-muted shrink-0 mt-0.5"}):m.jsx(If,{size:12,className:"text-dark-muted shrink-0 mt-0.5"})}function cC({sessionId:a}){const{t}=Je(),s=Qe(y=>a?y.getTasksForSession(a):[]),i=Qe(y=>a?y.getRunningAgentCount(a):0),o=Qe(y=>a?y.getForSession(a):void 0),u=Ce(y=>a?y.isGenerating(a):!1)||i>0||(o==null?void 0:o.status)==="RUNNING"||(o==null?void 0:o.status)==="RESUMING",d=_.useMemo(()=>a?Qe.getState().getEventsForSession(a).filter(b=>b.type==="tool_call"||b.title).length:0,[a,s.length,i,o==null?void 0:o.updatedAt]);if(s.length===0)return u?m.jsxs("div",{className:"flex items-center gap-2 text-xs text-dark-muted py-0.5",children:[m.jsx(Ln,{size:13,className:"animate-spin text-accent-blue shrink-0"}),m.jsx("span",{className:"truncate",children:i>0?t("chat.sidebarWorkingWithAgents",{n:i}):d>0?t("chat.sidebarWorkingToolcalls",{n:d}):t("chat.sidebarWorking")})]}):m.jsx("p",{className:"text-[11px] leading-relaxed text-dark-muted/70",children:t("chat.sidebarIdle")});const p=s.slice(0,12),g=s.length-p.length;return m.jsxs("div",{className:"space-y-1.5",children:[p.map(y=>m.jsxs("div",{className:"flex items-start gap-2 text-xs",children:[m.jsx(lC,{status:y.status}),m.jsxs("span",{className:vt("min-w-0 flex-1 leading-snug break-words",y.status==="completed"&&"text-dark-muted/70 line-through decoration-dark-muted/40",y.status==="failed"&&"text-accent-red/90"),children:[y.title,y.status==="running"&&y.progress!==void 0&&m.jsx("span",{className:"block mt-1",children:m.jsx("span",{className:"block w-full h-1 bg-dark-surface rounded-full overflow-hidden",children:m.jsx("span",{className:"block h-full bg-accent-blue rounded-full transition-all duration-500",style:{width:`${Math.max(0,Math.min(100,y.progress))}%`}})})})]})]},y.id)),g>0&&m.jsxs("p",{className:"text-[10px] text-dark-muted/70",children:["+",g," ",t("chat.sidebarMoreTasks")]}),u&&m.jsx("p",{className:"text-[10px] text-dark-muted/70 pt-0.5",children:i>0?t("chat.sidebarRunningAgents",{n:i}):t("chat.sidebarToolcallsSoFar",{n:d})})]})}function av({sessionId:a,messages:t,previewFile:s,onPreview:i,onClosePreview:o}){const{t:c}=Je(),[u,d]=_.useState(null),[p,g]=_.useState(!1),[y,b]=_.useState(null),x=_.useCallback(async T=>{g(!0),b(null),d(null);try{const E=await Ge.files.read(T);E.success&&E.data!==void 0&&E.data!==null?d(String(E.data)):b(E.error||c("chat.fileReadError"))}catch(E){b(E instanceof Error?E.message:c("chat.fileReadError"))}finally{g(!1)}},[c]);_.useEffect(()=>{if(!s){d(null),g(!1),b(null);return}if(Ef(s)==="file"){d(null),g(!1),b(null);return}x(s)},[s,x]);const S=_.useCallback(async T=>{const E=await Ge.files.download(T);E.success||_e.error(E.error||c("chat.fileReadError"))},[c]),k=_.useCallback(async T=>{try{await navigator.clipboard.writeText(T),_e.success(c("chat.copiedPath"))}catch{_e.error(c("chat.copyPathFailed"))}},[c]),C=s?Ef(s):"file";return m.jsx("div",{className:"flex-1 min-h-0 min-w-0 flex flex-col overflow-hidden",children:s?m.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[m.jsx("div",{className:"shrink-0 px-2 py-2 border-b border-dark-border/60",children:m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx("button",{onClick:o,className:"p-1 rounded hover:bg-dark-hover transition-colors text-dark-muted shrink-0",title:c("chat.backToArtifacts"),"aria-label":c("chat.backToArtifacts"),children:m.jsx(Hf,{size:15})}),m.jsxs("div",{className:"min-w-0 flex-1",children:[m.jsxs("div",{className:"flex items-center gap-1 text-xs font-semibold text-dark-text truncate",children:[m.jsx("span",{className:"text-dark-muted font-normal shrink-0",children:c("chat.artifactPanel")}),m.jsx("span",{className:"text-dark-muted/50 shrink-0",children:"/"}),m.jsx("span",{className:"truncate",children:uo(s)})]}),m.jsx("div",{className:"text-[10px] font-mono text-dark-muted truncate mt-0.5",title:s,children:s})]}),m.jsx("button",{onClick:()=>void k(s),className:"p-1 rounded text-dark-muted hover:bg-dark-hover hover:text-dark-text transition-colors shrink-0",title:c("chat.copyPath"),"aria-label":c("chat.copyPath"),children:m.jsx(vb,{size:14})}),m.jsx("a",{href:Xl(`/api/files/read?path=${encodeURIComponent(s)}`),target:"_blank",rel:"noopener noreferrer",className:"p-1 rounded text-dark-muted hover:bg-dark-hover hover:text-dark-text transition-colors shrink-0",title:c("chat.openInNewTab"),"aria-label":c("chat.openInNewTab"),children:m.jsx(Ug,{size:14})}),m.jsx("button",{onClick:()=>void S(s),className:"p-1 rounded text-dark-muted hover:bg-dark-hover hover:text-dark-text transition-colors shrink-0",title:c("fileJob.download"),"aria-label":c("fileJob.download"),children:m.jsx(mo,{size:14})})]})}),m.jsx("div",{className:"flex-1 overflow-y-auto min-h-0 custom-scrollbar p-3",children:p?m.jsx("div",{className:"flex items-center justify-center py-10 text-dark-muted",children:m.jsx(Ln,{size:18,className:"animate-spin text-accent-blue"})}):y?m.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-accent-red/30 bg-accent-red/5 px-3 py-2.5 text-xs text-accent-red",children:[m.jsx(hc,{size:14,className:"shrink-0 mt-0.5"}),m.jsx("span",{className:"break-words",children:y})]}):C==="image"?m.jsx("img",{src:Xl(`/api/files/download?path=${encodeURIComponent(s)}`),alt:uo(s),className:"max-w-full h-auto rounded-lg border border-dark-border"}):C==="markdown"&&u!=null?m.jsx(Fw,{content:u}):C==="code"?m.jsx("pre",{className:"text-[11px] leading-relaxed font-mono whitespace-pre-wrap break-all text-dark-text",children:u??""}):m.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 py-12 px-4 text-center",children:[m.jsx("span",{className:"grid w-16 h-16 shrink-0 place-items-center rounded-2xl bg-dark-surface border border-dark-border shadow-sm",children:m.jsx(_b,{size:30,className:"text-accent-blue"})}),m.jsxs("div",{className:"min-w-0 w-full max-w-sm",children:[m.jsx("div",{className:"text-sm font-semibold text-dark-text break-all leading-snug",children:uo(s)}),m.jsx("div",{className:"mt-1.5 text-[11px] font-mono text-dark-muted break-all leading-relaxed",title:s,children:s})]}),m.jsx("p",{className:"text-[11px] text-dark-muted/70 leading-relaxed max-w-xs",children:c("chat.filePreviewHint")}),m.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[m.jsxs("a",{href:Xl(`/api/files/read?path=${encodeURIComponent(s)}`),target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 rounded-lg bg-accent-blue/10 text-accent-blue px-3 py-1.5 text-xs font-medium hover:bg-accent-blue/20 transition-colors",title:c("chat.openInNewTab"),children:[m.jsx(Ug,{size:13}),c("chat.openInNewTab")]}),m.jsxs("button",{onClick:()=>void S(s),className:"inline-flex items-center gap-1 rounded-lg bg-dark-surface border border-dark-border text-dark-text px-3 py-1.5 text-xs hover:bg-dark-hover transition-colors",title:c("fileJob.download"),children:[m.jsx(mo,{size:13}),c("fileJob.download")]})]})]})})]}):m.jsx(o1,{sessionId:a,messages:t,onPreview:i})})}function uC({sessionId:a,messages:t,previewFile:s,onPreview:i,onClosePreview:o,isMaximized:c,onToggleMaximize:u}){const{t:d}=Je(),p=_.useMemo(()=>sv(t),[t]),[g,y]=_.useState("artifacts"),b=_.useMemo(()=>({type:"split",direction:"horizontal",children:[{type:"slot",id:"left"},{type:"split",direction:"vertical",children:[{type:"slot",id:"right"},{type:"slot",id:"preview"}]}]}),[]);return m.jsxs("div",{className:"w-full h-full border-l border-dark-border bg-dark-surface flex flex-col overflow-hidden",children:[m.jsxs("div",{className:"shrink-0 px-3 py-2.5 border-b border-dark-border bg-dark-surface flex items-center gap-2",children:[m.jsx(Cb,{size:14,className:"text-accent-blue shrink-0"}),m.jsx("span",{className:"text-xs font-semibold text-dark-text truncate",children:d(g==="workspace"?"chat.workspaceTitle":"chat.artifactPanel")}),m.jsxs("div",{className:"ml-auto flex items-center gap-0.5",children:[g==="artifacts"&&!s&&p.length>0&&m.jsx("span",{className:"text-[10px] text-dark-muted tabular-nums",children:p.length}),m.jsx("button",{onClick:()=>y(x=>x==="workspace"?"artifacts":"workspace"),className:"p-1 rounded text-dark-muted hover:bg-dark-hover hover:text-dark-text transition-colors shrink-0",title:d(g==="workspace"?"chat.artifactsToggle":"chat.workspaceToggle"),"aria-label":d(g==="workspace"?"chat.artifactsToggle":"chat.workspaceToggle"),"data-testid":"sidebar-view-toggle",children:m.jsx(US,{size:14})}),u&&m.jsx("button",{onClick:u,className:"p-1 rounded text-dark-muted hover:bg-dark-hover hover:text-dark-text transition-colors shrink-0",title:d(c?"chat.sidebarRestore":"chat.sidebarMaximize"),"aria-label":d(c?"chat.sidebarRestore":"chat.sidebarMaximize"),children:c?m.jsx(IS,{size:14}):m.jsx($S,{size:14})})]})]}),g==="workspace"?m.jsx(V1,{layout:b,onRegister:x=>{const S=[Y1(x),nC(x)];return()=>S.forEach(k=>k())}}):m.jsx(av,{sessionId:a,messages:t,previewFile:s,onPreview:i,onClosePreview:o}),m.jsx("div",{className:"shrink-0 px-3 py-2 border-t border-dark-border/60",children:m.jsx("p",{className:"text-[10px] text-dark-muted/60 leading-relaxed",children:d(g==="workspace"?"chat.workspaceHint":"chat.artifactHint")})})]})}_.createContext(null);function Yf({isOpen:a,onClose:t,title:s,children:i,size:o="md",className:c}){if(_.useEffect(()=>{const d=p=>{p.key==="Escape"&&(p.preventDefault(),p.stopPropagation(),t())};return a&&(document.addEventListener("keydown",d),document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",d),document.body.style.overflow=""}},[a,t]),!a)return null;const u={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-xl","2xl":"max-w-3xl","3xl":"max-w-5xl"};return m.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center overflow-hidden p-4",children:[m.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),m.jsxs("div",{className:vt("relative w-full mx-4 bg-dark-surface border border-dark-border rounded-xl shadow-2xl animate-fade-in","max-h-[calc(100vh-2rem)] flex flex-col overflow-hidden",u[o],c),children:[s&&m.jsxs("div",{className:"flex shrink-0 items-center justify-between px-6 py-4 border-b border-dark-border",children:[m.jsx("h2",{className:"text-lg font-semibold text-dark-text",children:s}),m.jsx("button",{onClick:t,"aria-label":"Close",className:"p-1 rounded-lg text-dark-muted hover:text-dark-text hover:bg-dark-hover transition-colors",children:m.jsx(ss,{className:"w-5 h-5","aria-hidden":"true"})})]}),m.jsx("div",{className:"min-h-0 overflow-y-auto custom-scrollbar p-6",children:i})]})]})}function Jj({isOpen:a,onClose:t,onConfirm:s,title:i,message:o,confirmText:c,cancelText:u,variant:d="default"}){const{t:p}=Je(),g=()=>{s(),t()};return m.jsxs(Yf,{isOpen:a,onClose:t,title:i??p("common.confirm"),size:"sm",children:[m.jsx("p",{className:"text-dark-muted mb-6",children:o}),m.jsxs("div",{className:"flex gap-3 justify-end",children:[m.jsx("button",{onClick:t,className:"px-4 py-2 rounded-lg border border-dark-border text-dark-text hover:bg-dark-hover transition-colors",children:u??p("common.cancel")}),m.jsx("button",{onClick:g,className:vt("px-4 py-2 rounded-lg text-white transition-colors",d==="danger"?"bg-accent-red hover:bg-accent-red/90":"bg-accent-blue hover:bg-accent-blue/90"),children:c??p("common.confirm")})]})]})}function Ky({children:a,variant:t="default",size:s="md",className:i}){const o={default:"bg-dark-border text-dark-muted",success:"bg-accent-green/20 text-accent-green",warning:"bg-accent-yellow/20 text-accent-yellow",error:"bg-accent-red/20 text-accent-red",info:"bg-accent-blue/20 text-accent-blue"},c={sm:"px-1.5 py-0.5 text-[10px]",md:"px-2 py-0.5 text-xs"};return m.jsx("span",{className:vt("inline-flex items-center rounded-full font-medium",o[t],c[s],i),children:a})}const dC={string:"templates.typeString",number:"templates.typeNumber",select:"templates.typeSelect",boolean:"templates.typeBoolean",folder:"templates.typeFolder",connector:"templates.typeConnector"};function fC({template:a,onCancel:t,onSubmit:s,submitLabel:i,busy:o=!1}){const{t:c}=Je(),u=i??c("templates.launch"),d=a.inputs??[],p=_.useMemo(()=>{const C={};for(const T of d)T.default!==void 0&&T.default!==null&&(C[T.name]=T.default);return C},[d]),[g,y]=_.useState(p),[b,x]=_.useState({});if(d.length===0)return m.jsxs("div",{className:"space-y-4",children:[m.jsx("div",{className:"text-sm text-dark-muted",children:c("templates.noInputsNeeded")}),m.jsx("div",{className:"text-xs text-dark-muted/80 break-all",children:a.description||"—"}),m.jsxs("div",{className:"flex justify-end gap-3",children:[m.jsx("button",{onClick:t,className:"px-4 py-2 rounded-lg border border-dark-border text-dark-text hover:bg-dark-hover transition-colors",children:c("templates.cancel")}),m.jsx("button",{onClick:()=>s({}),disabled:o,className:"px-4 py-2 rounded-lg bg-accent-blue text-white hover:bg-accent-blue/90 disabled:opacity-50 transition-colors",children:o?c("templates.starting"):u})]})]});const S=(C,T)=>{y(E=>({...E,[C]:T})),x(E=>{if(!E[C])return E;const A={...E};return delete A[C],A})},k=()=>{const C={},T={};for(const E of d){let A=g[E.name];typeof A=="string"&&(A=A.trim());const B=A==null||A==="";if(E.required&&B){C[E.name]=c("templates.requiredError");continue}if(!B)if(E.type==="number"){const M=Number(A);if(!Number.isFinite(M)){C[E.name]=c("templates.numberError");continue}T[E.name]=M}else T[E.name]=A}if(Object.keys(C).length>0){x(C);return}s(T)};return m.jsxs("div",{className:"space-y-4",children:[m.jsx("div",{className:"text-sm text-dark-muted",children:a.description||""}),d.map(C=>m.jsxs("div",{children:[m.jsxs("label",{className:"flex items-center gap-1.5 text-sm text-dark-text mb-1.5",children:[m.jsx("span",{children:C.label||C.name}),C.required&&m.jsx("span",{className:"text-accent-red",children:"*"}),C.type!=="boolean"&&m.jsx("span",{className:"text-[10px] text-dark-muted/70",children:c(dC[C.type])})]}),pC(C,g[C.name],S,c("templates.selectNone")),C.description&&m.jsx("div",{className:"mt-1 text-xs text-dark-muted/70",children:C.description}),b[C.name]&&m.jsx("div",{className:"mt-1 text-xs text-accent-red",children:b[C.name]})]},C.name)),m.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[m.jsx("button",{onClick:t,className:"px-4 py-2 rounded-lg border border-dark-border text-dark-text hover:bg-dark-hover transition-colors",children:c("templates.cancel")}),m.jsx("button",{onClick:k,disabled:o,className:"px-4 py-2 rounded-lg bg-accent-blue text-white hover:bg-accent-blue/90 disabled:opacity-50 transition-colors",children:o?c("templates.starting"):u})]})]})}function pC(a,t,s,i){const o="w-full px-3 py-2 rounded-lg bg-dark-bg border border-dark-border text-sm text-dark-text focus:outline-none focus:ring-1 focus:ring-accent-blue placeholder:text-dark-muted/50";switch(a.type){case"select":return m.jsxs("select",{value:typeof t=="string"?t:a.default||"",onChange:c=>s(a.name,c.target.value),className:o,children:[!a.required&&m.jsx("option",{value:"",children:i}),(a.options||[]).map(c=>m.jsx("option",{value:c,children:c},c))]});case"boolean":return m.jsx("button",{type:"button",onClick:()=>s(a.name,t!==!0),className:vt("h-6 w-11 rounded-full transition-colors relative flex items-center px-0.5",t===!0?"bg-accent-blue":"bg-dark-border"),"aria-pressed":t===!0,children:m.jsx("span",{className:vt("h-5 w-5 rounded-full bg-white transition-transform",t===!0&&"translate-x-5")})});case"number":return m.jsx("input",{type:"number",value:typeof t=="number"||typeof t=="string"?t:"",onChange:c=>s(a.name,c.target.value),placeholder:typeof a.default=="number"?String(a.default):"0",className:o});default:return m.jsx("input",{type:"text",value:typeof t=="string"?t:"",onChange:c=>s(a.name,c.target.value),placeholder:typeof a.default=="string"?a.default:"",className:o})}}function mC({collapsed:a=!1,onDirect:t,onStartTemplate:s,onManageTemplates:i}){const{t:o}=Je(),[c,u]=_.useState(!1),[d,p]=_.useState({kind:"list"}),[g,y]=_.useState([]),[b,x]=_.useState(!1),[S,k]=_.useState(""),[C,T]=_.useState({top:0,left:0}),E=_.useRef(null),A=_.useCallback(()=>{p({kind:"list"}),u(!0)},[]);_.useEffect(()=>{var te;if(!c)return;const Y=(te=E.current)==null?void 0:te.getBoundingClientRect();Y&&T({top:Y.bottom+6,left:Math.max(8,Y.left)})},[c,a]),_.useEffect(()=>{if(!c||d.kind!=="list")return;let Y=!1;return x(!0),k(""),Ge.templates.list().then(te=>{Y||(te.success&&te.data?y(te.data):k(te.error||o("templates.loadFailed")))}).catch(()=>{Y||k(o("templates.loadFailed"))}).finally(()=>{Y||x(!1)}),()=>{Y=!0}},[c,d.kind]);const B=_.useMemo(()=>{const Y=new Map;for(const te of g){const se=te.category||o("templates.uncategorized"),ge=Y.get(se)||[];ge.push(te),Y.set(se,ge)}return[...Y.entries()]},[g,o]),M=async Y=>{const te=await Ge.templates.get(Y.id);te.success&&te.data?p({kind:"form",template:te.data}):k(te.error||o("templates.loadFailed"))},j=Y=>{d.kind==="form"&&(s(d.template,Y),u(!1),p({kind:"list"}))},J={top:C.top,left:C.left,width:Math.min(360,typeof window<"u"?window.innerWidth-16:360)};return m.jsxs("div",{ref:E,className:"relative",children:[m.jsx("div",{className:"flex",children:a?m.jsx("button",{onClick:A,className:"btn btn-primary w-full !px-0 aspect-square",title:o("templates.newSession"),"aria-label":o("templates.newSession"),children:m.jsx(ec,{size:16,"aria-hidden":"true"})}):m.jsxs(m.Fragment,{children:[m.jsxs("button",{onClick:t,className:"btn btn-primary flex-1 !px-3 py-2 rounded-l-lg",children:[m.jsx(ec,{size:15,"aria-hidden":"true"}),o("templates.newSession")]}),m.jsx("button",{onClick:()=>c?u(!1):A(),className:"px-2.5 rounded-r-lg bg-accent-blue text-white border-l border-white/25 hover:opacity-95 flex items-center",title:o("templates.newFromTemplateTitle"),"aria-label":o("templates.chooseTemplateAria"),children:m.jsx(ba,{size:13,"aria-hidden":"true"})})]})}),c&&m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>u(!1)}),m.jsx("div",{className:"fixed z-50 bg-dark-surface border border-dark-border rounded-xl shadow-2xl p-1.5 max-h-[70vh] overflow-y-auto custom-scrollbar",style:J,children:d.kind==="form"?m.jsxs("div",{className:"p-2",children:[m.jsxs("button",{onClick:()=>p({kind:"list"}),className:"mb-2 inline-flex items-center gap-1 text-xs text-dark-muted hover:text-dark-text transition-colors",children:[m.jsx(HS,{className:"w-3.5 h-3.5"})," ",o("templates.backToList")]}),m.jsx("div",{className:"text-sm font-medium text-dark-text mb-3",children:d.template.name}),m.jsx(fC,{template:d.template,onCancel:()=>p({kind:"list"}),onSubmit:j,submitLabel:o("templates.launch")})]}):m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"px-2 py-1 text-[10.5px] uppercase tracking-[0.06em] text-dark-muted/70 font-semibold",children:o("templates.startSessionHeader")}),m.jsxs("button",{onClick:()=>{u(!1),t()},className:"w-full flex items-center gap-2.5 px-2 py-2 rounded-lg hover:bg-dark-hover text-left",children:[m.jsx("span",{className:"w-6 h-6 rounded-md bg-accent-blue/10 border border-accent-blue/30 grid place-items-center text-accent-blue shrink-0",children:m.jsx(yc,{className:"w-3.5 h-3.5"})}),m.jsxs("span",{className:"min-w-0",children:[m.jsx("span",{className:"block text-[13px] font-medium text-dark-text",children:o("templates.directChat")}),m.jsx("span",{className:"block text-[11px] text-dark-muted truncate",children:o("templates.directChatHint")})]})]}),b&&m.jsxs("div",{className:"flex items-center gap-2 px-2 py-3 text-xs text-dark-muted",children:[m.jsx(Ln,{className:"w-3.5 h-3.5 animate-spin"})," ",o("templates.loadingTemplates")]}),S&&!b&&m.jsx("div",{className:"px-2 py-2 text-xs text-accent-red",children:S}),!b&&!S&&B.length===0&&m.jsx("div",{className:"px-2 py-2 text-xs text-dark-muted",children:o("templates.noTemplatesYet")}),B.map(([Y,te])=>m.jsxs("div",{className:"mt-1",children:[m.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[m.jsx(tc,{className:"w-3 h-3 text-dark-muted/70"}),m.jsx("span",{className:"text-[10px] uppercase tracking-[0.06em] text-dark-muted/70 font-semibold",children:Y}),m.jsx(Ky,{size:"sm",children:te.length})]}),te.map(se=>m.jsxs("button",{onClick:()=>void M(se),className:"w-full flex items-center gap-2.5 px-2 py-2 rounded-lg hover:bg-dark-hover text-left",children:[m.jsx("span",{className:"w-6 h-6 rounded-md bg-dark-border/60 border border-dark-border grid place-items-center text-dark-muted shrink-0",children:m.jsx(tc,{className:"w-3.5 h-3.5"})}),m.jsxs("span",{className:"min-w-0 flex-1",children:[m.jsxs("span",{className:"flex items-center gap-1.5",children:[m.jsx("span",{className:"block text-[13px] font-medium text-dark-text truncate",children:se.name}),m.jsxs(Ky,{size:"sm",variant:"info",children:["v",se.version]})]}),se.description&&m.jsx("span",{className:"block text-[11px] text-dark-muted truncate",children:se.description})]})]},se.id))]},Y)),m.jsx("div",{className:"border-t border-dark-border mt-1 pt-1",children:m.jsx("button",{onClick:()=>{u(!1),i()},className:"w-full px-2 py-1.5 rounded-lg hover:bg-dark-hover text-left text-[12.5px] text-dark-muted",children:o("templates.libraryMenu")})})]})})]})]})}function Af(a,t=Date.now(),s){const i=typeof a=="number"?a:new Date(a).getTime();if(!Number.isFinite(i))return"";const o=t-i;if(o<6e4)return s?s("time.justNow"):"刚刚";const c=Math.floor(o/6e4);if(c<60)return s?s("time.minutesAgo",{count:c}):`${c}分钟前`;const u=Math.floor(c/60);if(u<24)return s?s("time.hoursAgo",{count:u}):`${u}小时前`;const d=Math.floor(u/24);if(d<7)return s?s("time.daysAgo",{count:d}):`${d}天前`;const p=new Date(i);return`${p.getFullYear()}-${String(p.getMonth()+1).padStart(2,"0")}-${String(p.getDate()).padStart(2,"0")}`}const Xr=10;function hC({isOpen:a,onClose:t,onSwitchSession:s}){const{t:i}=Je(),o=Te(E=>E.sessionTabs),c=Te(E=>E.historySessions),u=Te(E=>E.activeSessionId),d=Ce(E=>E.generatingSessions),[p,g]=_.useState(0),y=_.useMemo(()=>{const E=new Map;for(const A of o)E.set(A.id,A);for(const A of c)E.has(A.id)||E.set(A.id,A);return[...E.values()].sort((A,B)=>(B.lastActiveAt??B.createdAt??0)-(A.lastActiveAt??A.createdAt??0))},[o,c]),b=Math.max(1,Math.ceil(y.length/Xr)),x=Math.min(p,b-1),S=_.useMemo(()=>{const E=new Map,A=x*Xr;for(const B of y.slice(A,A+Xr)){const M=B.project||"default",j=E.get(M)||[];j.push(B),E.set(M,j)}return Array.from(E.entries())},[y,x]),k=y.length===0?0:x*Xr+1,C=Math.min((x+1)*Xr,y.length),T=E=>d.includes(E.id)?"running":E.status||"done";return m.jsx(Yf,{isOpen:a,onClose:t,title:i("chat.sessionPickerTitle"),size:"lg",children:m.jsxs("div",{className:"flex flex-col gap-3",children:[m.jsx("div",{className:"max-h-[320px] overflow-y-auto custom-scrollbar rounded-lg border border-dark-border bg-dark-bg p-1.5",children:y.length===0?m.jsx("div",{className:"px-3 py-6 text-center text-xs text-dark-muted/60",children:i("chat.noSessions")}):S.map(([E,A])=>m.jsxs("div",{children:[m.jsxs("div",{className:"flex items-center gap-1 px-2 py-1 text-[10px] text-dark-muted/70",children:[m.jsx(Tb,{size:10,"aria-hidden":"true",className:"shrink-0 opacity-60"}),m.jsx("span",{className:"truncate",children:E==="default"?i("nav.mySessions"):E}),m.jsx("span",{className:"ml-auto text-[9px] text-dark-muted/40",children:A.length})]}),m.jsx("div",{className:"space-y-0.5",children:A.map(B=>{const M=B.id===u,j=T(B),J=Af(B.lastActiveAt??B.createdAt,Date.now(),i),Y=Zl(B),te=Ub(B.title,Y);return m.jsxs("button",{onClick:()=>{s(B.id),t()},title:i("chat.clickToOpenSession"),className:`group flex w-full cursor-pointer items-center gap-2 rounded-lg px-2.5 py-[7px] text-left text-[13px] transition-colors ${M?"bg-accent-blue/10 font-medium text-accent-blue":"text-dark-muted hover:bg-dark-hover/60 hover:text-dark-text"}`,children:[m.jsx(yc,{size:13,"aria-hidden":"true",className:"shrink-0 opacity-60"}),m.jsxs("span",{className:"min-w-0 flex-1",children:[m.jsxs("span",{className:"flex items-center gap-1.5",children:[m.jsx("span",{className:"min-w-0 flex-1 truncate",children:B.title}),j==="running"&&m.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-accent-red animate-pulse",title:i("nav.sessionRunning")}),j==="waiting"&&m.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-accent-yellow",title:i("nav.sessionWaiting")}),j==="failed"&&m.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-accent-red",title:i("nav.sessionFailed")}),j==="done"&&m.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-accent-green",title:i("nav.sessionDone")})]}),m.jsxs("span",{className:"mt-0.5 flex items-center gap-2 text-[11px] leading-tight text-dark-muted/60",children:[te&&m.jsx("span",{className:"min-w-0 flex-1 truncate",children:Y}),m.jsx("span",{className:`shrink-0 ${te?"":"ml-auto"}`,children:J})]})]})]},B.id)})})]},E))}),m.jsxs("div",{className:"flex items-center justify-between text-xs text-dark-muted",children:[m.jsx("span",{children:i("common.pageInfo",{start:k,end:C,total:y.length})}),m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsxs("button",{onClick:()=>g(E=>Math.max(0,E-1)),disabled:x===0,className:"flex items-center gap-0.5 rounded-md border border-dark-border px-2 py-1 text-dark-muted transition-colors hover:bg-dark-hover hover:text-dark-text disabled:cursor-not-allowed disabled:opacity-40",children:[m.jsx(Hf,{size:13,"aria-hidden":"true"}),i("common.prevPage")]}),m.jsxs("span",{className:"min-w-[48px] text-center font-mono",children:[x+1,"/",b]}),m.jsxs("button",{onClick:()=>g(E=>Math.min(b-1,E+1)),disabled:x>=b-1,className:"flex items-center gap-0.5 rounded-md border border-dark-border px-2 py-1 text-dark-muted transition-colors hover:bg-dark-hover hover:text-dark-text disabled:cursor-not-allowed disabled:opacity-40",children:[i("common.nextPage"),m.jsx(Nb,{size:13,"aria-hidden":"true"})]})]})]})]})})}function gC(){return{activities:{},order:[],taskTitles:{},artifacts:[]}}const en=Ut()(a=>({bySession:{},applyEvent:(t,s)=>a(i=>{const o=i.bySession[t]??gC();switch(s.type){case"activity_started":return o.activities[s.activity.id]?i:{...i,bySession:{...i.bySession,[t]:{...o,activities:{...o.activities,[s.activity.id]:s.activity},order:[...o.order,s.activity.id]}}};case"activity_updated":{const c=o.activities[s.activityId];return c?{...i,bySession:{...i.bySession,[t]:{...o,activities:{...o.activities,[s.activityId]:{...c,...s.patch}}}}}:i}case"activity_finalized":{const c=o.activities[s.activityId];return c?{...i,bySession:{...i.bySession,[t]:{...o,activities:{...o.activities,[s.activityId]:{...c,status:s.status,endedAt:s.endedAt}}}}}:i}case"artifact_produced":return o.artifacts.some(c=>c.id===s.artifact.id)?i:{...i,bySession:{...i.bySession,[t]:{...o,artifacts:[...o.artifacts,s.artifact]}}};case"task_title_set":return{...i,bySession:{...i.bySession,[t]:{...o,taskTitles:{...o.taskTitles,[s.messageId]:s.title}}}};case"next_action_set":return{...i,bySession:{...i.bySession,[t]:{...o,nextAction:s.text??void 0}}};default:return i}}),resetSession:t=>a(s=>{if(!s.bySession[t])return s;const i={...s.bySession};return delete i[t],{bySession:i}}),finalizeSession:(t,s)=>a(i=>{const o=i.bySession[t];if(!o)return i;const c=Date.now(),u=["pending","running","paused","waiting_user"];let d=!1;const p={};for(const[g,y]of Object.entries(o.activities))u.includes(y.status)?(p[g]={...y,status:s,endedAt:c},d=!0):p[g]=y;return d?{...i,bySession:{...i.bySession,[t]:{...o,activities:p}}}:i}),markStatus:(t,s,i)=>a(o=>{const c=o.bySession[t];if(!c)return o;let u=!1;const d={};for(const[p,g]of Object.entries(c.activities))s.includes(g.status)?(d[p]={...g,status:i},u=!0):d[p]=g;return u?{...o,bySession:{...o.bySession,[t]:{...c,activities:d}}}:o})}));function eR(a,t,s){if(!t)return[];const i=a.bySession[t];if(!i)return[];const o=[];for(const c of i.order){const u=i.activities[c];u&&u.messageId===s&&o.push(u)}return o.sort((c,u)=>c.blockRange[0]-u.blockRange[0])}function yC(a,t){if(!t)return;const s=a.bySession[t];if(s)for(let i=s.order.length-1;i>=0;i--){const o=s.order[i];if(!o)continue;const c=s.activities[o];if(c&&(c.status==="running"||c.status==="waiting_user"||c.status==="paused"||c.status==="blocked"))return c}}function bC(a,t,s){var i;if(!(!t||!s))return(i=a.bySession[t])==null?void 0:i.taskTitles[s]}function vC(a){const t=en(i=>{var o;return a?(o=i.bySession[a])==null?void 0:o.taskTitles:void 0}),s=Ce(i=>a?i.messagesBySession[a]??[]:[]);if(!a||!t)return null;for(let i=s.length-1;i>=0;i--){const o=s[i];if(!o||o.type!=="assistant")continue;const c=t[o.id];if(c)return c}return null}const Vd=["templates","plugins","connectors","skills","channels"],Bi=Ut()(xa(a=>({pinned:Vd,moreExpanded:!1,morePinned:!1,togglePin:t=>a(s=>({pinned:s.pinned.includes(t)?s.pinned.filter(i=>i!==t):[...s.pinned,t]})),setMoreExpanded:t=>a({moreExpanded:t}),toggleMorePinned:()=>a(t=>({morePinned:!t.morePinned}))}),{name:"deepseekcode-nav-storage",merge:(a,t)=>{var o;const s=a??{},i=(o=s.pinned)!=null&&o.length?[...s.pinned,...Vd.filter(c=>!s.pinned.includes(c))]:Vd;return{...t,...s,pinned:i}}})),ql=10;function xC({sessionId:a,fallback:t}){const s=vC(a);return m.jsx("span",{className:"min-w-0 flex-1 truncate",title:s??t,children:s??t})}const Yy=["chat","plan","agentflow"],Zy=_.memo(function({collapsed:t,onToggleCollapse:s,tabs:i,activeTab:o,onTabChange:c,isConnected:u,onNewSession:d,onStartTemplate:p,onManageTemplates:g,onSwitchSession:y,onCloseSession:b,onRenameSession:x,getTabTitle:S}){const{t:k}=Je(),C=Te(Q=>Q.sessionTabs),T=Te(Q=>Q.activeSessionId),E=Te(Q=>Q.historySessions),A=Te(Q=>Q.restoreHistorySession),B=Te(Q=>Q.removeHistorySession),[M,j]=_.useState(!1),[J,Y]=_.useState(!1),[te,se]=_.useState(null),[ge,Ke]=_.useState(""),[de,K]=_.useState(""),ne=_.useRef(null),he=Bi(Q=>Q.pinned),L=Bi(Q=>Q.moreExpanded),Z=Bi(Q=>Q.morePinned),W=Bi(Q=>Q.togglePin),Be=Bi(Q=>Q.setMoreExpanded),Le=Bi(Q=>Q.toggleMorePinned),ze=_.useMemo(()=>he.filter(Q=>!Yy.includes(Q)).map(Q=>i.find(We=>We.id===Q)).filter(Q=>!!Q),[i,he]),Ee=_.useMemo(()=>i.filter(Q=>!Yy.includes(Q.id)&&!he.includes(Q.id)),[i,he]),ke=_.useCallback((Q,We)=>{se(Q),Ke(We),setTimeout(()=>{var we;return(we=ne.current)==null?void 0:we.select()},50)},[]),st=_.useCallback(()=>{te&&ge.trim()&&x(te,ge.trim()),se(null)},[te,ge,x]),lt=_.useCallback((Q,We)=>{var Ot;const we=Ce.getState().getMessages(Q),be=[];be.push(`# ${We||k("nav.chat")}`),be.push(""),be.push(`> ${k("chat.exportMd")} · ${new Date().toLocaleString()}`),be.push(""),be.push("---"),be.push(""),(!we||we.length===0)&&(be.push(k("chat.noSessions")),be.push(""));for(const _t of we){if(_t.deleted)continue;const tt=_t.type==="user"?k("chat.you"):k("chat.assistantLabel");if(be.push(`## ${tt} · ${new Date(_t.timestamp).toLocaleString()}`),be.push(""),_t.thinking&&_t.thinking.trim()&&(be.push("<details>"),be.push(`<summary>💭 ${k("chat.thoughtProcess")}</summary>`),be.push(""),be.push(_t.thinking.trim()),be.push(""),be.push("</details>"),be.push("")),_t.content&&_t.content.trim()&&(be.push(_t.content.trim()),be.push("")),_t.steps&&_t.steps.length>0){be.push(`**${k("chat.runningSteps")}:**`),be.push("");for(const nn of _t.steps){if(be.push(`- **${nn.title}**${nn.status?` (\`${nn.status}\`)`:""}`),nn.thought&&be.push(` - 💭 ${nn.thought}`),(Ot=nn.toolCalls)!=null&&Ot.length)for(const $s of nn.toolCalls)be.push(` - 🛠 \`${$s.name}\``);nn.result&&be.push(` - ${nn.result}`)}be.push("")}be.push("---"),be.push("")}const ie=new Blob([be.join(`
52
- `)],{type:"text/markdown;charset=utf-8"}),Ae=URL.createObjectURL(ie),ct=document.createElement("a");ct.href=Ae,ct.download=`${(We||"session").replace(/[\\/:*?"<>|]/g,"_").slice(0,80)}.md`,ct.click(),URL.revokeObjectURL(Ae)},[k]),Zt=_.useCallback(Q=>{A(Q),fe.setSessionId(Q)},[A]),dn=_.useCallback(Q=>{y(Q),o!=="chat"&&c("chat")},[y,c,o]),fn=_.useCallback(Q=>{!C.some(we=>we.id===Q)?(Zt(Q),o!=="chat"&&c("chat")):dn(Q)},[C,Zt,dn,o,c]),wn=Ce(Q=>Q.generatingSessions),os=_.useCallback(Q=>wn.includes(Q.id)?"running":Q.status||"done",[wn]),ls=_.useMemo(()=>{const Q=new Map,We=de.trim().toLowerCase(),be=[...We?C.filter(Ae=>{const ct=Zl(Ae);return Ae.title.toLowerCase().includes(We)||(Ae.project||"").toLowerCase().includes(We)||(ct||"").toLowerCase().includes(We)}):C].sort((Ae,ct)=>(ct.lastActiveAt??ct.createdAt??0)-(Ae.lastActiveAt??Ae.createdAt??0));let ie=be;if(be.length>ql){const Ae=be.slice(0,ql),ct=be.find(Ot=>Ot.id===T);ct&&!Ae.some(Ot=>Ot.id===ct.id)?ie=[ct,...Ae.filter(Ot=>Ot.id!==ct.id)].slice(0,ql):ie=Ae}for(const Ae of ie){const ct=Ae.project||"default",Ot=Q.get(ct)||[];Ot.push(Ae),Q.set(ct,Ot)}return Array.from(Q.entries())},[C,T,de]),cs=_.useMemo(()=>{const Q=new Set(C.map(We=>We.id));return C.length+E.filter(We=>!Q.has(We.id)).length},[C,E]),Is=(Q,We)=>{const we=o===Q.id,be=Q.iconComponent,ie=k(We?"nav.unpin":"nav.pin");return t?m.jsx("button",{onClick:()=>c(Q.id),className:`flex h-9 w-9 items-center justify-center rounded-lg transition-colors ${we?"bg-accent-blue/10 text-accent-blue":"text-dark-muted hover:bg-dark-hover hover:text-dark-text"}`,title:S(Q.id,Q.title),"aria-label":S(Q.id,Q.title),"aria-current":we?"page":void 0,children:be&&m.jsx(be,{size:17,"aria-hidden":"true"})},Q.id):m.jsxs("button",{onClick:()=>c(Q.id),className:"side-nav-item group","data-active":we,"aria-current":we?"page":void 0,children:[be&&m.jsx(be,{size:15,"aria-hidden":"true",className:"shrink-0"}),m.jsx("span",{className:"truncate",children:S(Q.id,Q.title)}),m.jsx("span",{role:"button",tabIndex:0,onClick:Ae=>{Ae.stopPropagation(),W(Q.id)},onKeyDown:Ae=>{(Ae.key==="Enter"||Ae.key===" ")&&(Ae.stopPropagation(),W(Q.id))},className:"ml-auto shrink-0 rounded p-0.5 text-dark-muted/60 opacity-0 transition-all hover:bg-dark-bg hover:text-dark-text group-hover:opacity-100",title:ie,"aria-label":ie,children:m.jsx(of,{size:11,"aria-hidden":"true",className:We?"fill-current text-accent-blue":""})})]},Q.id)},at=Q=>{if(Ee.length===0)return null;const We=`${k("nav.moreOptions")} (${Ee.length})`,we=k(Z?"nav.unpinMore":"nav.pinMore"),be=t?m.jsx("button",{onClick:()=>Be(!L),className:`flex h-9 w-9 items-center justify-center rounded-lg transition-colors ${L?"bg-dark-hover text-dark-text":"text-dark-muted hover:bg-dark-hover hover:text-dark-text"}`,title:We,"aria-label":We,"aria-expanded":L,children:m.jsx(lf,{size:17,"aria-hidden":"true"})},"more"):m.jsxs("div",{className:"group flex items-center",children:[m.jsxs("button",{onClick:()=>Be(!L),className:`side-nav-item flex-1 ${L?"bg-dark-hover text-dark-text":""}`,"data-active":!1,"aria-expanded":L,children:[m.jsx(lf,{size:15,"aria-hidden":"true",className:"shrink-0"}),m.jsx("span",{className:"truncate",children:k("nav.moreOptions")}),m.jsx("span",{className:"ml-auto rounded bg-dark-bg px-1.5 py-px text-[10px] text-dark-muted/70",children:Ee.length}),m.jsx(ba,{size:13,"aria-hidden":"true",className:`shrink-0 text-dark-muted/70 transition-transform duration-150 ${L?"rotate-180":""}`})]}),m.jsx("span",{role:"button",tabIndex:0,onClick:Ae=>{Ae.stopPropagation(),Le()},onKeyDown:Ae=>{(Ae.key==="Enter"||Ae.key===" ")&&(Ae.stopPropagation(),Le())},className:"mr-1 shrink-0 rounded p-0.5 text-dark-muted/60 opacity-0 transition-all hover:bg-dark-bg hover:text-dark-text group-hover:opacity-100",title:we,"aria-label":we,children:m.jsx(of,{size:11,"aria-hidden":"true",className:Z?"fill-current text-accent-blue":""})})]},"more"),ie=L&&m.jsx("div",{className:`mt-0.5 space-y-0.5 ${t?"flex flex-col items-center":""}`,children:Ee.map(Ae=>Is(Ae,!1))});return m.jsxs("div",{className:`${Q?"mt-1 border-t border-dark-border/40 pt-1":"mt-1.5 border-t border-dark-border/40 pt-1.5"}`,children:[be,ie]},"more-section")};return m.jsxs("div",{className:"workbench-sidebar flex h-full flex-col",children:[m.jsxs("div",{className:`flex h-14 shrink-0 items-center gap-2.5 border-b border-dark-border/70 bg-dark-bg/20 ${t?"justify-center px-2":"px-4"}`,children:[m.jsx("img",{src:"/logo.svg",alt:"deepseekcode",className:"h-7 w-7 shadow-sm"}),!t&&m.jsx("span",{className:"flex-1 truncate text-[15px] font-semibold tracking-tight text-dark-text",children:"deepseekcode"}),m.jsx("button",{onClick:s,className:`rounded-md p-1.5 text-dark-muted transition-colors hover:bg-dark-hover hover:text-dark-text ${t?"hidden":""}`,title:k("nav.collapseSidebar"),"aria-label":k("nav.collapseSidebar"),children:m.jsx(PS,{size:16,"aria-hidden":"true"})})]}),m.jsx("div",{className:t?"p-2":"px-3 pt-3",children:p&&g?m.jsx(mC,{collapsed:t,onDirect:d,onStartTemplate:p,onManageTemplates:g}):m.jsxs("button",{onClick:d,className:"btn btn-primary w-full shadow-[0_8px_20px_rgb(var(--color-accent-blue)/0.14)]",children:[m.jsx(ec,{size:15,"aria-hidden":"true"}),k("chat.newSession")]})}),m.jsxs("div",{className:"flex-1 overflow-y-auto custom-scrollbar px-3 pb-2 min-h-0",children:[m.jsxs("nav",{className:"sticky top-0 z-10 border-b border-dark-border/50 bg-dark-surface pt-2",children:[(ze.length>0||Z)&&m.jsxs("div",{className:`space-y-0.5 ${t?"flex flex-col items-center":""}`,children:[ze.map(Q=>Is(Q,!0)),Z&&at(!0)]}),!Z&&at(!1)]}),!t&&m.jsxs("div",{className:"pt-2",children:[m.jsxs("div",{className:"mb-2 flex items-center gap-2 rounded-lg border border-dark-border/70 bg-dark-bg/45 px-2.5 py-1.5 focus-within:border-accent-blue/45",children:[m.jsx(Eb,{size:13,className:"shrink-0 text-dark-muted","aria-hidden":"true"}),m.jsx("input",{value:de,onChange:Q=>K(Q.target.value),className:"min-w-0 flex-1 bg-transparent text-xs text-dark-text placeholder:text-dark-muted/55 focus:outline-none",placeholder:k("nav.searchSessionsPlaceholder"),"aria-label":k("nav.searchSessions")}),de&&m.jsx("button",{onClick:()=>K(""),className:"rounded p-0.5 text-dark-muted hover:bg-dark-hover hover:text-dark-text","aria-label":k("nav.clearSessionSearch"),children:m.jsx(ss,{size:11,"aria-hidden":"true"})})]}),m.jsxs("div",{className:"side-group-label flex items-center justify-between",children:[m.jsx("span",{children:k("nav.sessions")}),E.length>0&&m.jsxs("button",{onClick:()=>j(Q=>!Q),className:"flex items-center gap-0.5 rounded px-1 py-0.5 text-dark-muted/70 transition-colors hover:text-dark-text",title:k("chat.sessionHistory"),"aria-expanded":M,children:[m.jsx(Ig,{size:11,"aria-hidden":"true"}),m.jsx(ba,{size:11,"aria-hidden":"true",className:`transition-transform ${M?"":"-rotate-90"}`})]})]}),m.jsxs("div",{className:"space-y-1.5",children:[ls.map(([Q,We])=>m.jsxs("div",{children:[m.jsxs("div",{className:"flex items-center gap-1 px-2 py-0.5 text-[10px] text-dark-muted/70",children:[m.jsx(Tb,{size:10,"aria-hidden":"true",className:"shrink-0 opacity-60"}),m.jsx("span",{className:"truncate",children:Q==="default"?k("nav.mySessions"):Q}),m.jsx("span",{className:"ml-auto text-[9px] text-dark-muted/40",children:We.length})]}),m.jsx("div",{className:"space-y-0.5",children:We.map(we=>{const be=we.id===T,ie=te===we.id,Ae=os(we),ct=Af(we.lastActiveAt??we.createdAt,Date.now(),k),Ot=Zl(we),_t=Ub(we.title,Ot);return m.jsxs("div",{onClick:()=>!ie&&dn(we.id),onDoubleClick:()=>ke(we.id,we.title),className:`group flex cursor-pointer items-center gap-2 rounded-lg px-2.5 py-[6px] text-[13px] transition-colors ${be?"bg-dark-hover font-medium text-dark-text":"text-dark-muted hover:bg-dark-hover/60 hover:text-dark-text"}`,children:[m.jsx(yc,{size:13,"aria-hidden":"true",className:"shrink-0 opacity-60"}),ie?m.jsx("input",{ref:ne,value:ge,onChange:tt=>Ke(tt.target.value),onBlur:st,onKeyDown:tt=>{tt.key==="Enter"?st():tt.key==="Escape"&&se(null)},onClick:tt=>tt.stopPropagation(),className:"min-w-0 flex-1 rounded border border-accent-blue bg-dark-bg px-1 py-0.5 text-xs text-dark-text outline-none",autoFocus:!0}):m.jsxs("span",{className:"min-w-0 flex-1",children:[m.jsxs("span",{className:"flex items-center gap-1.5",children:[m.jsx(xC,{sessionId:we.id,fallback:we.title}),Ae==="running"&&m.jsxs("span",{className:"pixel-spinner shrink-0 text-accent-red",title:k("nav.sessionRunning"),"aria-hidden":"true",children:[m.jsx("span",{}),m.jsx("span",{}),m.jsx("span",{}),m.jsx("span",{})]}),Ae==="waiting"&&m.jsx("span",{className:"h-2 w-2 shrink-0 rounded-[1px] bg-accent-yellow",title:k("nav.sessionWaiting")}),Ae==="failed"&&m.jsx("span",{className:"h-2 w-2 shrink-0 rounded-[1px] bg-accent-red",title:k("nav.sessionFailed")}),Ae==="done"&&m.jsxs("span",{className:"pixel-grid shrink-0 text-accent-green",title:k("nav.sessionDone"),"aria-hidden":"true",children:[m.jsx("span",{}),m.jsx("span",{}),m.jsx("span",{}),m.jsx("span",{})]})]}),m.jsxs("span",{className:"mt-0.5 flex items-center gap-2 text-[11px] leading-tight text-dark-muted/50",children:[_t&&m.jsx("span",{className:"min-w-0 flex-1 truncate",children:Ot}),m.jsx("span",{className:`shrink-0 ${_t?"":"ml-auto"}`,children:ct})]})]}),!ie&&m.jsxs(m.Fragment,{children:[m.jsx("button",{onClick:tt=>{tt.stopPropagation(),ke(we.id,we.title)},className:"shrink-0 rounded p-0.5 opacity-0 transition-all hover:bg-dark-bg group-hover:opacity-100",title:k("chat.renameSession"),"aria-label":k("chat.renameSession"),children:m.jsx(FS,{size:11,"aria-hidden":"true"})}),m.jsx("button",{onClick:tt=>{tt.stopPropagation(),lt(we.id,we.title)},className:"shrink-0 rounded p-0.5 opacity-0 transition-all hover:bg-dark-bg group-hover:opacity-100",title:k("chat.exportMd"),"aria-label":k("chat.exportMd"),children:m.jsx(mo,{size:11,"aria-hidden":"true"})}),C.length>1&&m.jsx("button",{onClick:tt=>{tt.stopPropagation(),b(we.id)},className:"shrink-0 rounded p-0.5 opacity-0 transition-all hover:bg-dark-bg group-hover:opacity-100","aria-label":k("a11y.close"),children:m.jsx(ss,{size:12,"aria-hidden":"true"})})]})]},we.id)})})]},Q)),ls.length===0&&m.jsx("div",{className:"px-2.5 py-2 text-xs text-dark-muted/60",children:k("chat.noSessions")})]}),cs>ql&&m.jsxs("button",{onClick:()=>Y(!0),className:"mt-1.5 flex w-full items-center justify-center gap-1 rounded-lg border border-dashed border-dark-border px-2 py-1.5 text-xs text-dark-muted transition-colors hover:bg-dark-hover hover:text-dark-text",title:k("chat.viewAllSessions"),children:[m.jsx(GS,{size:12,"aria-hidden":"true"}),k("chat.viewAllSessions"),m.jsxs("span",{className:"text-dark-muted/50",children:["(",cs,")"]})]}),M&&E.length>0&&m.jsx("div",{className:"mt-1 space-y-0.5 border-t border-dark-border/50 pt-1",children:E.slice(0,10).map(Q=>{const We=Zl(Q);return m.jsxs("div",{onClick:()=>Zt(Q.id),className:"group flex cursor-pointer items-center gap-2 rounded-lg px-2.5 py-1.5 text-xs text-dark-muted transition-colors hover:bg-dark-hover/60 hover:text-dark-text",children:[m.jsx(Ig,{size:11,"aria-hidden":"true",className:"shrink-0 opacity-50"}),m.jsxs("span",{className:"min-w-0 flex-1",children:[m.jsx("span",{className:"block truncate",children:Q.title}),We&&m.jsx("span",{className:"block truncate text-[10px] text-dark-muted/50",children:We})]}),m.jsx("span",{className:"shrink-0 text-[10px] text-dark-muted/50",children:Af(Q.lastActiveAt??Q.createdAt,Date.now(),k)}),m.jsx("button",{onClick:we=>{we.stopPropagation(),B(Q.id)},className:"shrink-0 rounded p-0.5 opacity-0 transition-all hover:bg-dark-bg group-hover:opacity-100","aria-label":k("chat.removeFromHistory"),children:m.jsx(ss,{size:11,"aria-hidden":"true"})})]},Q.id)})})]})]}),m.jsxs("div",{className:`shrink-0 border-t border-dark-border/70 ${t?"p-2":"p-3"}`,children:[t&&m.jsx("button",{onClick:s,className:"mb-2 flex w-full items-center justify-center rounded-md p-1.5 text-dark-muted transition-colors hover:bg-dark-hover hover:text-dark-text",title:k("nav.expandSidebar"),"aria-label":k("nav.expandSidebar"),children:m.jsx(qS,{size:16,"aria-hidden":"true"})}),m.jsxs("div",{className:`flex items-center gap-2 text-xs text-dark-muted ${t?"justify-center":"px-1.5"}`,role:"status","aria-label":k("a11y.connectionStatus"),children:[m.jsx("span",{className:`h-2 w-2 shrink-0 rounded-[1px] ${u?"bg-accent-green":"bg-accent-red"}`,"aria-hidden":"true"}),!t&&m.jsx("span",{className:"truncate",children:k(u?"chat.connected":"chat.disconnected")})]})]}),m.jsx(hC,{isOpen:J,onClose:()=>Y(!1),onSwitchSession:fn})]})}),SC={info:"bg-accent-blue",warn:"bg-accent-yellow",error:"bg-accent-red",success:"bg-accent-green",tool:"bg-accent-purple"};function kC(a){return a==null||a===""?"-":new Date(a).toLocaleString()}function wC(){const{t:a}=Je(),[t,s]=_.useState([]),[i,o]=_.useState(!0),[c,u]=_.useState(null),[d,p]=_.useState(null),[g,y]=_.useState(!1),b=_.useCallback(async()=>{o(!0);try{const C=await Ge.logs.list();C.success&&Array.isArray(C.data)&&s(C.data)}catch(C){console.error("Failed to load log files:",C)}o(!1)},[]);_.useEffect(()=>{b()},[b]);const x=_.useCallback(async C=>{if(!C.previewable)return;u(C),y(!0);const T=await Ge.logs.read(C.name,500);T.success&&T.data&&p(T.data),y(!1)},[]),S=_.useCallback(()=>{u(null),p(null)},[]),k=C=>C<1024?`${C} B`:C<1024*1024?`${(C/1024).toFixed(1)} KB`:`${(C/(1024*1024)).toFixed(1)} MB`;return c&&d?m.jsxs("div",{className:"flex flex-col min-h-0 h-full",children:[m.jsxs("div",{className:"flex items-center gap-2 mb-2 shrink-0",children:[m.jsx("button",{onClick:S,className:"p-1 rounded hover:bg-dark-hover transition-colors",title:a("logs.backToList"),children:m.jsx(Hf,{size:16})}),m.jsx("span",{className:"text-sm font-medium text-dark-text truncate flex-1",children:c.name}),m.jsxs("a",{href:Ge.logs.downloadUrl(c.name),download:c.name,className:"flex items-center gap-1 px-2 py-1 text-xs bg-accent-blue text-white rounded hover:opacity-90 transition-opacity",children:[m.jsx(mo,{size:12}),a("logs.download")]})]}),g?m.jsx("div",{className:"flex-1 flex items-center justify-center",children:m.jsx(Ln,{size:20,className:"animate-spin text-accent-blue"})}):m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"text-[10px] text-dark-muted mb-1 shrink-0",children:[k(d.size)," · ",a("logs.totalLines",{count:d.totalLines}),d.startLine>1&&` ${a("logs.showingLatest",{count:d.totalLines-d.startLine+1})}`]}),m.jsx("div",{className:`flex-1 overflow-y-auto min-h-0 font-mono text-[11px] leading-relaxed whitespace-pre-wrap break-all
53
- bg-dark-bg border border-dark-border rounded p-3 custom-scrollbar`,style:{scrollbarWidth:"thin",scrollbarColor:"#30363d transparent"},children:d.content||m.jsx("span",{className:"text-dark-muted italic",children:a("logs.emptyFile")})})]})]}):m.jsxs("div",{className:"flex flex-col min-h-0 h-full",children:[m.jsxs("div",{className:"flex items-center justify-between mb-2 shrink-0",children:[m.jsx("span",{className:"text-xs font-medium text-dark-text",children:a("logs.files")}),m.jsx("button",{onClick:b,className:"px-2 py-1 text-[10px] bg-dark-hover rounded hover:bg-dark-border transition-colors",disabled:i,children:a(i?"logs.refreshing":"logs.refresh")})]}),i?m.jsx("div",{className:"flex items-center justify-center py-8",children:m.jsx(Ln,{size:16,className:"animate-spin text-accent-blue"})}):t.length===0?m.jsxs("div",{className:"text-center py-8 text-dark-muted",children:[m.jsx(Fi,{size:32,className:"mx-auto mb-1 opacity-50"}),m.jsx("p",{className:"text-xs",children:a("logs.noFiles")})]}):m.jsx("div",{className:"flex-1 overflow-y-auto min-h-0 space-y-1 custom-scrollbar",children:t.map(C=>m.jsxs("div",{className:"flex items-center gap-2 p-2 rounded hover:bg-dark-hover transition-colors group",children:[m.jsx(Fi,{size:14,className:"text-accent-blue shrink-0"}),m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsx("div",{className:"text-xs text-dark-text truncate",children:C.name}),m.jsxs("div",{className:"text-[10px] text-dark-muted",children:[k(C.size)," · ",kC(C.modified)]})]}),m.jsxs("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[C.previewable&&m.jsx("button",{onClick:()=>x(C),className:"p-1.5 rounded hover:bg-dark-border transition-colors",title:a("logs.preview"),children:m.jsx(WS,{size:14})}),m.jsx("a",{href:Ge.logs.downloadUrl(C.name),download:C.name,className:"p-1.5 rounded hover:bg-dark-border transition-colors block",title:a("logs.download"),children:m.jsx(mo,{size:14})})]})]},C.name))})]})}const Qy=_.memo(_.forwardRef(function({logs:t},s){const{t:i}=Je();return m.jsx("div",{ref:s,className:"flex-1 overflow-y-auto min-h-0 font-mono text-xs space-y-0.5 custom-scrollbar",children:t.length===0?m.jsxs("div",{className:"text-center text-dark-muted py-12",children:[m.jsx(ao,{size:48,className:"mx-auto mb-2 opacity-50"}),m.jsx("p",{children:i("logs.noLogs")})]}):t.map(o=>m.jsxs("div",{className:`p-2 rounded hover:bg-dark-surface transition-colors ${o.level==="error"?"bg-accent-red/10":o.level==="warn"?"bg-accent-yellow/10":o.level==="success"?"bg-accent-green/10":""}`,children:[m.jsx("span",{className:"text-dark-muted text-xs",children:new Date(o.timestamp).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit",second:"2-digit"})})," ",m.jsx("span",{className:`px-1.5 py-0.5 rounded text-white text-xs ${SC[o.level]}`,children:o.level.toUpperCase()})," ",m.jsxs("span",{className:"text-dark-muted text-xs",children:["[",o.source,"]"]})," ",m.jsx("span",{className:"text-dark-text whitespace-pre-wrap break-all",children:o.message})]},o.id))})})),CC=_.memo(function({logs:t,onClear:s,compact:i}){const{t:o}=Je(),[c,u]=_.useState("stream"),d=_.useRef(null),p=_.useRef(!0),g=_.useCallback(()=>{const b=d.current;return b?b.scrollHeight-b.scrollTop-b.clientHeight<50:!0},[]),y=_.useCallback(()=>{const b=d.current;b&&(b.scrollTop=b.scrollHeight)},[]);return _.useEffect(()=>{const b=d.current;if(!b)return;const x=()=>{p.current=g()};return b.addEventListener("scroll",x,{passive:!0}),()=>b.removeEventListener("scroll",x)},[g]),_.useEffect(()=>{p.current&&y()},[t,y]),_.useEffect(()=>{const b=d.current;if(!b)return;let x=b.clientHeight;const S=new ResizeObserver(()=>{const k=b.clientHeight;k>0&&x===0&&y(),x=k});return S.observe(b),()=>S.disconnect()},[y]),i?m.jsxs("div",{className:"flex flex-col min-h-0 flex-1 p-2",children:[m.jsxs("div",{className:"flex items-center justify-between mb-2 shrink-0",children:[m.jsxs("h2",{className:"flex items-center gap-2 text-xs font-semibold",children:[m.jsx(ao,{size:14,className:"text-accent-blue"}),o("logs.title"),m.jsxs("span",{className:"text-sm font-normal text-dark-muted",children:["(",t.length,")"]})]}),m.jsx("button",{onClick:s,className:"bg-dark-surface border border-dark-border rounded hover:bg-dark-hover transition-colors px-2 py-1 text-[10px]",children:o("logs.clear")})]}),m.jsx(Qy,{ref:d,logs:t})]}):m.jsxs("div",{className:"flex flex-col min-h-0 flex-1 overflow-hidden p-4",children:[m.jsx("div",{className:"flex items-center justify-between mb-3 shrink-0",children:m.jsxs("h2",{className:"flex items-center gap-2 text-lg font-semibold",children:[m.jsx(ao,{size:18,className:"text-accent-blue"}),o("logs.backendLogs")]})}),m.jsx("div",{className:"flex gap-1 mb-3 shrink-0 border-b border-dark-border",children:[["stream",o("logs.streamTab"),ao],["files",o("logs.files"),Fi]].map(([b,x,S])=>m.jsxs("button",{onClick:()=>u(b),className:`flex items-center gap-1.5 px-4 py-2 text-sm rounded-t transition-colors border-b-2 ${c===b?"border-accent-blue text-accent-blue bg-accent-blue/5":"border-transparent text-dark-muted hover:text-dark-text hover:bg-dark-hover"}`,children:[m.jsx(S,{size:14}),x,b==="stream"&&t.length>0&&m.jsxs("span",{className:"ml-1 text-[10px] text-dark-muted",children:["(",t.length,")"]})]},b))}),c==="stream"&&m.jsxs("div",{className:"flex flex-col flex-1 min-h-0",children:[m.jsx("div",{className:"flex items-center justify-end mb-2 shrink-0",children:m.jsx("button",{onClick:s,className:"bg-dark-surface border border-dark-border rounded hover:bg-dark-hover transition-colors px-3 py-1.5 text-sm",children:o("logs.clear")})}),m.jsx(Qy,{ref:d,logs:t})]}),c==="files"&&m.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:m.jsx("div",{className:"border border-dark-border rounded-lg p-3 bg-dark-surface h-full",children:m.jsx(wC,{})})})]})}),_C=a=>{if(a==null||a==="")return{};if(typeof a!="string")return a;try{return JSON.parse(a)}catch{return a}},Jr=(a,t="")=>typeof a=="string"?a:String((a==null?void 0:a.content)||(a==null?void 0:a.message)||(a==null?void 0:a.text)||(a==null?void 0:a.error)||t||""),TC=a=>Array.isArray(a)?a:Array.isArray(a==null?void 0:a.tasks)?a.tasks:Array.isArray(a==null?void 0:a.items)?a.items:Array.isArray(a==null?void 0:a.planTasks)?a.planTasks:[],Kd=(a,t,s=0)=>{const i=String(a.id||a.taskId||a.backendId||`plan-task-${s+1}`),o=is(a.status||a.planStatus,a.completed),c=Date.now()+s;return{id:i,sessionId:t,title:String(a.title||a.name||a.content||a.description||`Task ${s+1}`),description:a.description||a.details||a.content,status:o,source:"plan",agentType:a.agentType||a.agent||a.role,progress:a.progress!=null?Number(a.progress):void 0,result:a.result,error:a.error,dependencies:Array.isArray(a.dependencies)?a.dependencies.map(String):void 0,startedAt:a.startedAt?Number(a.startedAt):o==="running"?c:void 0,completedAt:a.completedAt?Number(a.completedAt):o==="completed"||o==="failed"?c:void 0,createdAt:a.createdAt&&Number(a.createdAt)||c,updatedAt:c,raw:a}},Xy=(a,t,s=0)=>{const i=String(a.id||a.taskId||a.backendId||`goal-task-${s+1}`),o=is(a.status),c=Date.now()+s;return{id:i,sessionId:t,title:String(a.title||a.name||a.content||a.description||`Task ${s+1}`),description:a.description||a.details||a.content,status:o,source:"goal",agentType:a.agentType||a.agent||a.role,progress:a.progress!=null?Number(a.progress):void 0,result:a.result,error:a.error,dependencies:Array.isArray(a.parentIds)?a.parentIds.map(String):void 0,startedAt:a.startedAt?Number(a.startedAt):o==="running"?c:void 0,completedAt:a.completedAt?Number(a.completedAt):o==="completed"||o==="failed"?c:void 0,createdAt:a.createdAt&&Number(a.createdAt)||c,updatedAt:a.updatedAt?Number(a.updatedAt):c,raw:a}},NC=(a,t)=>{const s=String((t==null?void 0:t.taskId)||(t==null?void 0:t.id)||"");if(!s)return;const i=Qe.getState().getTasksForSession(a).find(d=>d.id===s),o=Te.getState().getSessionTasks(a).find(d=>d.id===s||d.backendId===s),c=t!=null&&t.status?is(t.status):(i==null?void 0:i.status)||"pending",u={id:s,sessionId:a,title:(t==null?void 0:t.title)||(i==null?void 0:i.title)||(o==null?void 0:o.title)||s,description:(t==null?void 0:t.description)??(i==null?void 0:i.description)??(o==null?void 0:o.description),status:c,source:"goal",agentType:(t==null?void 0:t.agentType)||(i==null?void 0:i.agentType),progress:(t==null?void 0:t.progress)!=null?Number(t.progress):i==null?void 0:i.progress,result:(t==null?void 0:t.result)??(i==null?void 0:i.result),error:(t==null?void 0:t.error)??(i==null?void 0:i.error),startedAt:c==="running"?Date.now():i==null?void 0:i.startedAt,completedAt:c==="completed"||c==="failed"?Date.now():i==null?void 0:i.completedAt,createdAt:(i==null?void 0:i.createdAt)||Date.now(),updatedAt:Date.now(),raw:t};return Qe.getState().upsertTask(a,u),jf(a,u),u},no=a=>({id:a.id,title:a.title,completed:a.status==="completed",createdAt:a.createdAt,description:a.description,planStatus:a.status,agentType:a.agentType,dependencies:a.dependencies,result:a.result,error:a.error,startedAt:a.startedAt,completedAt:a.completedAt,progress:a.progress}),jf=(a,t)=>{const s=Te.getState(),i=s.getSessionTasks(a),o=no(t);if(i.some(c=>c.id===t.id||c.backendId===t.id)){s.updateTaskPlanStatus(a,t.id,o);return}s.setSessionTasks(a,[...i,o])},Wl=a=>{const t=Ce.getState(),s=t.getMessages(a),i=s[s.length-1];(!i||i.type!=="assistant")&&t.addMessage(a,{id:`plan-${Date.now()}`,type:"assistant",content:"",timestamp:Date.now()})};function Yd(a,t,s){const i=Pi.getState(),o=Ce.getState(),c=Qe.getState(),u=_C(t);switch(a){case"plan_start":{o.startGeneration(s),Wl(s);const d=Jr(u,"Plan started");d&&i.setThinkingStatus(s,d),c.recordEvent(s,{type:a,source:"plan",title:"Plan started",message:d,status:"running",data:u});break}case"plan_thinking":{const d=Jr(u,"Analyzing request...");i.setThinkingStatus(s,d),Wl(s),o.setThinking(s,d),c.recordEvent(s,{type:a,source:"plan",title:"Plan thinking",message:d,status:"running",data:u});break}case"plan_complete":{const d=(u==null?void 0:u.plan)||(u==null?void 0:u.content)||(u==null?void 0:u.result)||(u==null?void 0:u.markdown);if(d){i.setPlanContent(String(d)),Wl(s);const p=o.getMessages(s),g=p[p.length-1];(g==null?void 0:g.type)==="assistant"&&!g.content.trim()&&o.updateLastMessage(s,String(d))}else{const p=[...o.getMessages(s)].reverse().find(g=>g.type==="assistant");p!=null&&p.content&&i.setPlanContent(p.content)}o.endGeneration(s),c.recordEvent(s,{type:a,source:"plan",title:"Plan complete",message:Jr(u,"Plan complete"),status:"completed",data:u});break}case"plan_error":{const d=Jr(u,"Plan failed");Wl(s),o.updateLastMessage(s,`Plan failed: ${d}`),o.endGeneration(s,d),c.recordEvent(s,{type:a,source:"plan",title:"Plan failed",message:d,status:"failed",data:u});break}case"plan_tasks":{const d=TC(u).map((p,g)=>Kd(p,s,g));c.setTasks(s,d,"plan"),Te.getState().setSessionTasks(s,d.map(no)),c.recordEvent(s,{type:a,source:"plan",title:"Plan tasks updated",message:`${d.length} tasks`,status:"pending",data:u});break}case"plan_task_start":case"plan_task_update":case"plan_task_result":{const d=Kd(u,s),p=a==="plan_task_start"?"running":is(a==="plan_task_result"?u.status||(u.error?"failed":"completed"):u.status||u.planStatus),g={...d,status:p,startedAt:d.startedAt||(p==="running"?Date.now():void 0),completedAt:d.completedAt||(p==="completed"||p==="failed"?Date.now():void 0)};c.upsertTask(s,g),jf(s,g),c.recordEvent(s,{type:a,source:"plan",title:g.title,message:g.result||g.error||g.description,status:g.status,taskId:g.id,data:u});break}case"plan_task_complete":{const d=Kd(u,s),p=String(u.status||"")==="failed"||!!u.error,y={...d,status:p?"failed":"completed",completedAt:d.completedAt||Date.now()};c.upsertTask(s,y),jf(s,y),c.recordEvent(s,{type:a,source:"plan",title:y.title,message:y.result||y.error||y.description,status:y.status,taskId:y.id,data:u});const b=y.title||`task ${y.id}`;p?_e.error(`✘ ${b} 失败`,6e3):_e.success(`✓ ${b} 完成`,4e3);break}case"plan_subagent_start":{const d=(u==null?void 0:u.scope)||(u==null?void 0:u.agentId)||"design sub-agent";c.recordEvent(s,{type:a,source:"plan",title:`设计子代理: ${d}`,message:(u==null?void 0:u.title)||"Reading codebase and designing implementation details...",status:"running",data:u});break}case"plan_subagent_done":{const d=(u==null?void 0:u.scope)||(u==null?void 0:u.agentId)||"design sub-agent",p=(u==null?void 0:u.status)==="error"||(u==null?void 0:u.status)==="timeout"||(u==null?void 0:u.status)==="max_iterations"||!!(u!=null&&u.error);c.recordEvent(s,{type:a,source:"plan",title:`设计子代理: ${d}`,message:p?`设计失败: ${(u==null?void 0:u.error)||(u==null?void 0:u.status)||"error"}`:u!=null&&u.designDocPath?`设计完成 → ${u.designDocPath}`:"设计完成",status:p?"failed":"completed",data:u});break}case"step_prompt":{const d=Jr(u),p=(u==null?void 0:u.taskId)||(u==null?void 0:u.id);p&&c.upsertTask(s,{id:String(p),title:u.title||u.step||String(p),status:"running",source:"plan",description:d}),c.recordEvent(s,{type:a,source:"plan",title:(u==null?void 0:u.step)||"Step prompt",message:d,status:"running",taskId:p?String(p):void 0,data:u});break}case"plan_mode_change":{const d=(u==null?void 0:u.frontendMode)||(u==null?void 0:u.newMode),p=u==null?void 0:u.planPath;d==="normal"?i.applyBackendMode("normal"):d==="auto"?i.setAuto(!0):(d==="plan"||d==="act"||d==="goal"||d==="auto-plan"||d==="auto-act"||d==="auto-goal")&&i.applyBackendMode(d);const g=p?` [plan: ${p}]`:"";c.recordEvent(s,{type:a,source:"system",title:"Mode changed",message:`${(u==null?void 0:u.previousMode)||"unknown"} -> ${d||"unknown"}${g}`,status:(u==null?void 0:u.success)===!1?"failed":"completed",data:u});break}case"goal_created":{c.recordEvent(s,{type:a,source:"goal",title:(u==null?void 0:u.goalTitle)||(u==null?void 0:u.title)||"Goal created",message:u!=null&&u.goalId?`Goal ${u.goalId}`:"Goal created",status:"pending",data:u});break}case"goal_tasks":{const d=Array.isArray(u==null?void 0:u.tasks)?u.tasks.map((p,g)=>Xy(p,s,g)):[];c.setTasks(s,d,"goal"),Te.getState().setSessionTasks(s,d.map(no)),c.recordEvent(s,{type:a,source:"goal",title:(u==null?void 0:u.goalTitle)||"Goal tasks",message:`${d.length} tasks`,status:"pending",data:u});break}case"goal_task_update":{const d=String((u==null?void 0:u.taskId)||(u==null?void 0:u.id)||""),p=NC(s,u);c.recordEvent(s,{type:a,source:"goal",title:(p==null?void 0:p.title)||d||"Goal task update",message:(u==null?void 0:u.result)||(u==null?void 0:u.error)||(u!=null&&u.status?`status: ${u.status}`:"updated"),status:p==null?void 0:p.status,taskId:d||void 0,data:u});break}case"goal_update":{const d=Array.isArray(u==null?void 0:u.tasks)?u.tasks.map((p,g)=>Xy(p,s,g)):[];c.setTasks(s,d,"goal"),Te.getState().setSessionTasks(s,d.map(no)),c.recordEvent(s,{type:a,source:"goal",title:(u==null?void 0:u.goalTitle)||(u==null?void 0:u.title)||"Goal update",message:(u==null?void 0:u.status)||(u!=null&&u.id?`Goal ${u.id}`:"Goal updated"),status:u!=null&&u.status?is(u.status):void 0,data:u});break}case"goal_completed":{const d=String((u==null?void 0:u.goalId)||""),p=c.getTasksForSession(s).filter(g=>g.source==="goal");if(p.length>0){const g=p.map(y=>y.status==="pending"||y.status==="running"?{...y,status:"completed",completedAt:Date.now(),updatedAt:Date.now()}:y);c.setTasks(s,g,"goal"),Te.getState().setSessionTasks(s,g.map(no))}c.recordEvent(s,{type:a,source:"goal",title:u!=null&&u.goalTitle?`Goal 完成: ${String(u.goalTitle).slice(0,60)}`:"Goal completed",message:u!=null&&u.result?String(u.result).slice(0,200):d?`Goal ${d} completed`:"Goal completed",status:"completed",data:u});break}}}const EC={confirm:"确认",cancel:"取消",save:"保存",saving:"保存中...",delete:"删除",close:"关闭",refresh:"刷新",retry:"重试",loading:"加载中...",collapse:"折叠",expand:"展开",collapse_short:"收起",clear:"清空",noData:"暂无数据",noResults:"暂无结果",unknown:"未知",unknownError:"未知错误",connecting:"连接中…",back:"返回",send:"发送",copy:"复制",copied:"已复制",search:"搜索...",filter:"全部",pageInfo:"显示 {{start}}-{{end}} 条,共 {{total}} 条",prevPage:"上一页",nextPage:"下一页",enabled:"已启用",disabled:"已禁用",online:"在线",offline:"离线",busy:"忙碌",away:"离开",default:"默认"},AC={chat:"对话",terminal:"终端",files:"文件",models:"模型",tools:"工具",skills:"技能",templates:"预设",hooks:"Hooks",agentFlow:"Agent Flow",settings:"设置",logs:"日志",channels:"频道",sessions:"会话",groupWorkspace:"工作台",groupConfig:"配置",groupSystem:"系统",collapseSidebar:"收起侧栏",expandSidebar:"展开侧栏",moreOptions:"更多",scheduled:"定时任务",plugins:"插件",mySessions:"我的会话",sessionRunning:"运行中",sessionWaiting:"待确认",sessionFailed:"失败",sessionDone:"已完成",connectors:"连接器",pin:"置顶",unpin:"取消置顶",pinMore:"置顶「更多」",unpinMore:"取消置顶「更多」"},jC={newSession:"新建会话",noSessions:"暂无会话",renameSession:"重命名会话",exportMd:"导出为 Markdown",you:"你",thinkingEllipsis:"思考中…",messageRail:"消息导航",messageIndex:"对话索引",backToBottom:"回到最新消息",generatingPlaceholder:"AI 正在生成中…",defaultSessionTitle:"对话 {{n}}",welcome:"欢迎使用 deepseekcode",welcomeDesc:"我可以帮你编写代码、分析项目、自动化任务。试试发送一条消息吧!",suggestionCode:"代码编写",suggestionCodePrompt:"用 Python 实现快速排序,并解释它的时间复杂度",suggestionAnalyze:"代码分析",suggestionAnalyzePrompt:"分析当前项目的目录结构,告诉我它是如何组织的",suggestionAutomate:"自动化任务",suggestionAutomatePrompt:"帮我写一个脚本,自动整理当前目录下的文件",quickCommands:"查看快捷命令",refFiles:"引用文件",inputPlaceholder:"输入消息... Shift+Enter 换行,/ 命令,@ 引用文件,↑ 历史",charTokens:"{{chars}} 字符 · ~{{tokens}} tokens",nearLimit:"接近上限",shiftEnter:"Shift+Enter 换行",escHint:"Esc 暂停 · 双击 Esc 停止",resume:"恢复",resumeGen:"恢复生成",stop:"终止",stopGen:"终止生成",pause:"暂停",pauseGen:"暂停生成",sendBtn:"发送",voiceInput:"语音输入",voiceListening:"正在聆听...",voiceTranscribing:"识别中...",voiceUnsupported:"当前浏览器不支持语音输入",voiceError:"语音识别出错,请重试",connected:"已连接",disconnected:"未连接",sessionHistory:"会话历史",noHistory:"暂无历史会话",clearHistory:"清空历史",clearHistoryTitle:"清空历史",restoreSession:"点击恢复「{{title}}」",removeFromHistory:"从历史移除",viewAllSessions:"更多会话",allSessions:"全部会话",sessionPickerTitle:"选择会话",clickToOpenSession:"打开会话",workingDir:"工作目录",switchDir:"切换",clickToSwitchDir:"点击切换工作目录",switchDirPrompt:"请输入新的工作目录路径:",addTask:"添加",addTaskPlaceholder:"添加任务...",noTasks:"暂无任务,在上方输入添加",taskBoardDragHint:"下拉展开 · 上推收起 · 点击切换",doubleClickEdit:"双击编辑",deleteTask:"删除任务",backgroundLogs:"后台日志",effort:"推理力度",effortOff:"关闭思考",effortLow:"低",effortMedium:"中",effortHigh:"高",effortExtraHigh:"超高",effortMax:"最高",noWorkspaceDir:"未设置工作目录",recentDirs:"最近记录",noRecentDirs:"暂无最近目录",chooseOtherDir:"选择其他目录…",dirPickerTitle:"选择工作目录",dirPickerEnterPath:"输入完整路径后回车跳转",dirPickerGo:"跳转",dirPickerUp:"上一级",dirPickerNoDirs:"无子目录",dirPickerConfirm:"选择此目录",dirPickerLoadError:"目录读取失败",artifactPanel:"AI 输出物",workspaceTitle:"工作台",workspaceToggle:"切换到工作台",artifactsToggle:"切换到输出物",workspaceHint:"工作台为 AI Agent 工作区:组件按动态布局加载,可响应事件与命令。",artifactEmpty:"暂无输出文件。点击聊天中的文件 / 路径链接即可在右侧预览。",artifactHint:"点击聊天中的文件 / 路径链接即可在右侧预览;拖拽边缘可调整宽度,右上角可最大化",previewInPanel:"预览",backToArtifacts:"返回清单",openInNewTab:"新标签页打开",copyPath:"复制路径",copiedPath:"已复制路径",copyPathFailed:"复制失败",filePreviewHint:"该文件类型不支持内嵌预览,可下载或在新标签页中打开。",sidebarProgress:"进度",sidebarArtifacts:"AI 输出物",sidebarOpen:"打开",sidebarOpenFolder:"打开首个输出文件",sidebarExpandAll:"展开全部",sidebarMaximize:"最大化",sidebarRestore:"恢复大小",sidebarWorking:"正在处理…",sidebarWorkingWithAgents:"正在处理({{n}} 个 Agent 运行中)…",sidebarWorkingToolcalls:"正在处理(已调用 {{n}} 次工具)…",sidebarIdle:"多步骤任务运行时,进度会显示在这里:计划、工具调用、审批与产出文件。",sidebarMoreTasks:"更多任务",sidebarRunningAgents:"{{n}} 个 Agent 运行中",sidebarToolcallsSoFar:"已调用 {{n}} 次工具",tokenPrompt:"提示词",tokenCompletion:"补全",tokenTotal:"总计",totalChars:"总字符数",avgTokens:"平均 token/条",estimatedCost:"预估成本: ${{cost}}",contextTrimming:"上下文裁剪",keepMore:"保留更多",trimMore:"裁剪更多",trimContext:"裁剪上下文 (保留 ~{{n}} 条消息)",currentMessages:"当前 {{n}} 条消息",totalCharsInfo:"· 共 {{n}} 字符",contextManager:"上下文管理",showContext:"显示上下文信息",taskBoard:"任务看板",morePending:"还有 {{n}} 个待处理任务...",moreCompleted:"还有 {{n}} 个已完成任务...",dependencyCount:"🔗 依赖 {{n}} 个任务",contextSuggestions:"展开 ({{n}}条建议)",collapseSuggestions:"收起",toolRequest:"工具请求: ",toolResult:"工具结果: ",memory:"记忆: ",filesCount:"({{n}}文件)",saveTokens:"可节省 ~{{n}}",ignoreSuggestion:"忽略此建议",fileMention:"@ 引用文件",fileMentionSearch:'@ 搜索: "{{query}}"',fileMentionHelp:"↑↓ 选择 · Enter 插入 · Esc 关闭",fileBrowser:"文件浏览器",fileSaved:"文件已保存",fileReadError:"读取文件失败",fileSaveError:"保存失败",fileModified:"● 已修改",selectFilePreview:"选择文件以预览或编辑",kbdHint:"命令面板",clickToSwitchMode:"点击切换模式 (Plan → Goal → Act)",selectModel:"选择模型",clickToSelectModel:"选择模型 / 推理力度",noEnabledModels:"暂无可用模型",globalDefault:"全局默认",planDefault:"Plan 默认",actDefault:"Act 默认",goalDefault:"Goal 默认",followGlobalDefault:"跟随全局默认",followGlobalDefaultHint:"清除本模式默认,回退到全局默认",noGlobalDefault:"未设置全局默认",browseMoreModels:"浏览 Provider 更多模型…",backToModels:"返回模型列表",selectProvider:"选择 Provider",searchModels:"搜索模型…",loadingModels:"加载模型列表…",noModelsFound:"未找到匹配的模型",noProviderModels:"该 Provider 暂无可用的模型列表",noConfiguredProviders:"暂未配置 Provider",addAndSwitch:"添加并切换",alreadyAdded:"已添加",addingModel:"添加中…",currentModel:"当前模型",loadModelsFailed:"获取模型列表失败",addModelFailed:"添加模型失败",switchModelFailed:"切换模型失败",modelsSourceProviderApi:"实时从 Provider API 获取",modelsSourceCatalog:"来自模型目录 (models.dev)",assistantLabel:"DeepSeekCode",thoughtProcess:"思维过程",runningSteps:"执行中",stepCount:"步",stepCountPlural:"步",copyMessage:"复制",regenerate:"重新生成",deleteMessage:"删除消息",historyCount:"{{n}} 条",startChatHint:"请先开始对话",panelTitle:"面板",messageDeleted:"消息已删除",thinking:"思考中"},RC={title:"键盘快捷键",commandPalette:"打开命令面板",clearLogs:"清空日志",help:"显示快捷键帮助",submit:"提交输入",newline:"换行",closeDialog:"关闭弹窗 / 暂停生成",slashCommand:"快捷命令",fileRef:"引用文件",stopGen:"终止生成(连按两次 Esc)"},MC={placeholder:"搜索命令或跳转面板...",navGroup:"导航",commandGroup:"命令",empty:"没有匹配的命令",hint:"↑↓ 选择 · Enter 执行 · Esc 关闭",running:"执行中..."},OC={openMenu:"打开菜单",closeMenu:"关闭菜单",close:"关闭",expand:"展开",collapse:"折叠",delete:"删除",remove:"移除",send:"发送消息",newSession:"新建会话",messageInput:"消息输入框",connectionStatus:"连接状态",loading:"加载中",toggleAgentFlow:"切换 Agent 信息流",commandPalette:"命令面板",shortcutsHelp:"快捷键帮助"},BC={mode:"模式",planMode:"Plan 模式 — 只读分析",planModeDesc:"在 Plan 模式下,AI 将使用只读工具分析需求和代码,不会修改任何文件。",planModeHint:"分析完成后,请切换到 Act 模式执行具体实现。",switchToAct:"切换到 Act 模式执行",actMode:"Act 模式",actModeDesc:"在 Act 模式下,AI 可以读取、修改文件并执行命令。",actModeHint:"需要先分析需求?切换到 Plan 模式进行只读探索。",switchToPlan:"切换到 Plan 模式分析",readOnlyMode:"只读模式",planTitle:"Plan Mode:只读探索,不能修改代码",actTitle:"Act Mode:可以读写和执行",switchToPlanMode:"切换到规划模式",switchToActMode:"切换到执行模式",autoMode:"自动模式:自动批准工具调用",goalMode:"Goal 模式",planModeShort:"只读分析与规划,不修改文件",actModeShort:"读写文件并执行命令",goalModeShort:"围绕目标持续推进直到完成",autoApprove:"Auto 自动批准",autoApproveShort:"自动批准所有工具调用",planContent:"Plan 文件内容",analyzing:"正在分析需求...",modePlanTitle:"Plan 模式 — 只读探索",modePlanDesc:"只读模式。AI 只能读取文件和分析代码,不能进行任何修改。分析完成后使用 ExitPlanMode 切换到 Act 模式执行。",modeActTitle:"Act 模式 — 执行",modeActDesc:"读写模式。AI 可以读取、修改文件并执行命令。低风险操作自动放行,高风险操作需要确认。",modeGoalTitle:"Goal 模式 — 目标任务",modeGoalDesc:"面向目标的执行模式。AI 在活跃任务范围内可以读写和执行,超出范围的操作需要确认。",modeNormalTitle:"Normal 模式 — 标准交互",modeNormalDesc:"标准交互模式。所有工具正常使用,写操作和命令执行需要用户确认。",readOnlyBadge:"🔒 只读",autoApproveBadge:"✅ 自动审批",toPlanMode:"切换到 Plan 模式",toActMode:"切换到 Act 模式",modeCycleHint:"模式切换: Plan → Act → Goal 循环,Auto 为独立开关"},DC={title:"设置",theme:"主题",themeDark:"🌙 深色",themeLight:"☀️ 浅色",themeAuto:"🔄 自动",themePresets:"主题预设",themePresetLinear:"极简 Linear",themePresetLinearDesc:"中性灰 + 单一强调色 — 极简专业",themePresetGithub:"GitHub 默认",themePresetGithubDesc:"中性暗/亮色 — 简洁专业",themePresetCherry:"Cherry Studio",themePresetCherryDesc:"蓝色渐变 — 清爽科技感",themePresetOcean:"海洋 Ocean",themePresetOceanDesc:"深蓝/青色 — 冷静专业",themePresetMint:"薄荷 Mint",themePresetMintDesc:"青绿/薄荷 — 清新爽朗",themePresetLavender:"薰衣草 Lavender",themePresetLavenderDesc:"柔紫 — 优雅精致",themePresetMidnight:"午夜 Midnight",themePresetMidnightDesc:"深海军蓝 — 极简高对比",themePresetSunset:"日落 Sunset",themePresetSunsetDesc:"暖橙/金色 — 活力充沛",themePresetForest:"森林 Forest",themePresetForestDesc:"自然绿 — 大地色系宁静",themePresetCandy:"糖果 Candy",themePresetCandyDesc:"明亮多彩 — 活泼生动",themePresetNord:"Nord",themePresetNordDesc:"北极蓝 — 流行精心设计",customOverrides:"自定义覆盖",customOverridesHint:"调整单个颜色以覆盖当前主题预设",customColors:"自定义配色",colorBg:"背景色",colorSurface:"面板色",colorBorder:"边框色",colorText:"文字色",colorMuted:"次要文字",colorAccentBlue:"强调蓝",colorAccentGreen:"强调绿",colorAccentRed:"强调红",colorAccentYellow:"强调黄",colorAccentPurple:"强调紫",resetColors:"重置为默认配色",about:"关于",aboutDesc:"基于 Web 的 AI 编码助手界面",language:"语言",languageZh:"中文",languageEn:"English",display:"界面",developerView:"开发者视图(显示原始工具调用)",developerViewHint:"默认显示 AI 活动摘要;开启后显示原始工具日志",capabilities:{title:"Agent 能力管理",loadFailed:"能力配置加载失败",toggleFailed:"切换失败"},contextOffload:{title:"Context Offload(工具结果外置)",desc:"大体积工具输出不再整体进入上下文,而是存入磁盘 artifact 存储,上下文中只保留摘要与句柄;AI 需要细节时通过 artifact_query / artifact_read 按需取回。可显著降低长会话的 token 占用并提升缓存命中率。",enableLabel:"启用工具结果外置",currently:"当前生效",maxTotalMb:"存储总容量上限(MB)",ttlDays:"保留天数",outboundBytes:"外置触发阈值(字节,工具输出超过即外置)",turnBudget:"单轮上下文增长预算(token)",dir:"存储目录",optional:"可选,留空使用默认",stats:"当前已存储 {{count}} 个 artifact,共 {{size}} MB",saved:"Context Offload 设置已保存",saveFailed:"保存失败",invalidNumber:"数字字段必须为正整数",envHint:"标有 ⚠ env 的字段被同名环境变量覆盖,修改环境变量后重启生效"}},LC={title:"模型配置",providerConfig:"Provider 配置",configured:"已配置",notConfigured:"未配置",modelsCount:"{{n}} 个模型 · {{apiType}}",clickToConfig:"点击配置 →",apiKeyHint:"已配置 API Key,输入新 Key 将覆盖旧配置。",apiKeyPlaceholder:"输入新 Key 以覆盖...",apiKeyDefaultPlaceholder:"sk-...",enterApiKey:"请输入 API Key",removeConfirm:'确定要移除 "{{providerKey}}" 的配置吗?这将删除其 API Key 和模型。',loadFailed:"加载模型失败",saveFailed:"保存失败",overallStatus:"总体状态",healthy:"健康",degraded:"降级",abnormal:"异常",healthRate:"健康率",onlineInstances:"在线实例",totalRequests:"总请求数",configuredModels:"已配置模型",addModel:"添加模型",provider_qwen:"通义千问 (Qwen)",provider_glm:"智谱 (GLM)",provider_baichuan:"百川 (Baichuan)",provider_minimax:"MiniMax / 海螺",provider_doubao:"豆包 (Doubao)",provider_hunyuan:"腾讯混元 (Hunyuan)",provider_spark:"讯飞星火 (Spark)",provider_custom:"Custom (自定义)",globalShort:"全局",setDefaultProvider:"设为默认 Provider",deleteProviderConfirm:'确定要删除 "{{key}}" 的配置吗?',deleteProvider:"删除 Provider",catalogTitle:"models.dev 模型目录搜索",catalogSearchPlaceholder:"搜索全厂商模型,如 gpt-4o / deepseek / claude ...(匹配模型 id / 名称 / 厂商)",catalogOnlyToolCall:"仅工具调用",catalogOnlyReasoning:"仅推理模型",searching:"搜索中...",catalogNoResults:"无匹配模型,换个关键词试试",badgeReasoning:"推理",badgeToolCall:"工具",badgeMultimodal:"多模态",ctxLimit:"上下文 {{k}}K",outLimit:"输出 {{k}}K",catalogAddTitle:"添加到模型 ID 输入框",add:"添加",catalogSourceHint:"数据源:models.dev 模型目录(内置快照,离线可用)。点击「添加」将模型 ID 写入「模型 ID」输入框。"},zC={title:"工具列表",searchTools:"搜索工具...",disabled:"禁用",enabled:"启用",params:"参数",loadFailed:"加载工具失败",noTools:"暂无工具",loading:"加载中...",retry:"重试",refresh:"刷新",all:"全部",invalidData:"服务端返回的工具数据格式异常"},UC={title:"技能管理",list:"技能列表",noSkills:"暂无技能",loadFailed:"加载技能失败",loadFailedFallback:"加载失败",enable:"启用",disable:"禁用",enabled:"已启用",disabled:"已关闭",new:"新建技能",import:"导入",importTitle:"导入技能",edit:"编辑",save:"保存",cancel:"取消",retry:"重试",refresh:"刷新",tags:"标签",none:"无",source:"来源",localSkill:"本地技能",systemPrompt:"系统提示词",selectSkill:"选择一个技能",fieldId:"ID",fieldName:"名称",fieldCategory:"分类",fieldTrigger:"触发词",fieldTools:"所需工具",description:"描述",saving:"保存中",chooseFile:"选择技能文件",importHint:"支持 .skill.md 文件",marketplace:"技能市场",marketplaceDesc:"从远程市场浏览并安装技能",marketplaceTitle:"技能市场",addMarketplace:"添加市场",addMarketplaceTitle:"添加技能市场",marketplaceUrl:"市场地址",marketplaceUrlPlaceholder:"GitHub 仓库 / index.json 链接 / 本地技能文件夹,如 https://github.com/obra/superpowers 或 D:\\agent\\agentic-awesome-skills",marketplaceName:"市场名称(可选)",marketplaceHint:"支持 GitHub 仓库(自动扫描 skills/ 目录)、返回 index.json 的 URL、或本机技能文件夹(完全离线,直接浏览/安装磁盘上的技能库)。GitHub 无法访问时可设置 DEEPSEEKCODE_GITHUB_MIRROR 镜像加速。",marketFilterPlaceholder:"在当前市场搜索技能...",marketCategoryAll:"全部分类",riskCritical:"高危",riskUnknown:"风险未知",refreshMarketplace:"刷新",removeMarketplace:"移除市场",installSkill:"安装",installed:"已安装",installFail:"安装失败",loadMarketplaceFail:"加载技能市场失败",noMarketplaces:"暂无市场,先添加一个",noSkillsInMarket:"该市场暂无技能",marketplaceError:"市场索引加载失败:{{error}}",retryMarket:"重试",presets:"内置市场",marketplaces:"已添加的市场",skillCount:"{{count}} 个技能",installedSkills:"已安装技能",addFail:"添加市场失败",installing:"安装中...",adding:"添加中...",marketplaceTab:"技能市场",mineTab:"我的技能",installedTab:"已安装",workshopTab:"技能工坊",workshopHint:"技能提案:从会话/手动生成,审核后一键应用为技能",workshopPropose:"新建提案",workshopName:"技能名 (skill-name) 如 format-json",workshopTrigger:"触发关键词(可选)",workshopDescription:"一句话描述",workshopContent:"技能正文(系统提示 / 工作流指令)",workshopSubmit:"提交提案",workshopApply:"应用",workshopEmpty:"暂无技能提案",workshopFormRequired:"技能名和正文为必填",uninstall:"卸载",uninstallConfirm:"确定卸载已安装技能「{{name}}」?",uninstalling:"卸载中...",uninstallFail:"卸载失败",pagePrev:"上一页",pageNext:"下一页",pageOf:"第 {{page}} / {{total}} 页",emptyInstalled:"还没有已安装的市场技能",emptyInstalledHint:"前往「技能市场」浏览并下载安装",browseMarket:"去市场逛逛",use:"使用",useHint:"使用此技能:将 $技能名 插入输入框,补充任务描述后发送",pickTitle:"选择技能",pickPlaceholder:"搜索技能...",pickEmpty:"没有可用的技能",pickUse:"点击使用"},IC={permissionRequest:"权限申请",hookApproval:"Hook 拦截审批",hookConfirm:"Hook 请求确认",morePending:"还有 {{n}} 项待审批",tool:"工具:",reason:"原因:",needConfirm:"需要用户确认此操作",allow:"允许",deny:"拒绝",allowAlways:"本次会话始终允许",allowAlwaysDesc:"当前会话中不再询问此工具",autoMode:"自动模式",autoModeLabel:"自动模式(全部允许)",autoModeDesc:"自动批准所有 Hook 请求",moreOptions:"更多选项",highRiskWarning:"此操作可能造成不可逆的影响,请仔细确认",mediumRiskConfirm:"请确认此操作为预期行为",alreadyAllowed:"已允许:",alreadyDenied:"已拒绝:",risk_critical:"破坏性操作 - 可能删除数据",risk_critical_cmd:"高危命令 - 包含系统级操作",risk_high_shell:"Shell 命令执行",risk_high_file:"文件写入操作",risk_high_pkg:"包管理操作",risk_git_force:"Git 强制操作",risk_git:"Git 操作",risk_network:"网络请求",risk_low:"只读操作",risk_default:"工具调用",hookConfigTitle:"自定义 Hook 配置说明",hookConfigDesc:"你可以在项目根目录的 .agent/hooks.json 文件中添加或修改 Hook 拦截规则。",hookConfigDetail:"Hook 支持 SHELL(外部脚本)和 HTTP(REST 端点)两种类型,可以在工具执行前(PRE_TOOL_USE)或执行后(POST_TOOL_USE)触发。",hookConfigBuiltin:"内置了 BashSafetyHook(危险命令拦截)、FileWriteAuditHook(文件写入审计)、ToolUsageStatsHook(工具调用统计)三套 Hook。设置 enabled: false 可禁用任意 Hook。",optionAllow:"允许 — 执行此操作",optionAllowHint:"点击或按 Enter 确认",optionDeny:"拒绝 — 取消此操作",optionDenyHint:"点击或按 Esc 取消",optionAllowAlways:"本次会话始终允许",optionAllowAlwaysHint:"不再询问 {{tool}}",optionAllowPathHint:"不再询问该外部路径",timeoutWaitUser:"等待用户输入(无超时)",optionAutoMode:"自动模式 — 全部允许",optionAutoModeHint:"之后所有 Hook 将自动批准",shortcutHint:"快捷键: 1-4 选择 · Enter 允许 · Esc 拒绝",lastItem:"最后一项",modalHint:"请在弹窗中处理此审批请求",clickToSelect:"点击选择 · 1/2/3/4 键盘快捷键",verbRunCommand:"运行命令",verbWriteFile:"写入文件",verbEditFile:"编辑文件",verbReadFile:"读取文件",verbDeleteFile:"删除文件",verbFindFiles:"查找文件",verbSearchContents:"搜索内容",verbFetchUrl:"请求网络",verbSearchWeb:"搜索网络",verbGit:"Git 操作",verbInstall:"安装依赖",verbSendMessage:"发送消息",verbRunTool:"执行操作",scopeLocal:"作用于当前工作区",scopeExternal:"外部路径",showAllLines:"展开全部 {{n}} 行",showAll:"显示完整内容",showLess:"收起",importMergeConfirm:`合并到现有配置吗?
54
- "确定"=合并 / "取消"=替换`,configTitle:"Hook 配置",configDesc:"在工具执行、任务流转等生命周期事件上挂载拦截器,实现审批与自定义逻辑",import:"导入",export:"导出",newRule:"新增规则",ruleList:"规则列表",ruleCount:"{{n}} 条",implShell:"Shell 脚本",implShellDesc:"执行外部脚本,stdin 接收 JSON,stdout 返回决策",implHttp:"HTTP 端点",implHttpDesc:"POST JSON 到外部端点",implPromptDesc:"发送单轮 Prompt 给 LLM 做风险评估",implAgentDesc:"启动只读子代理做深度调查",stepBasicTitle:"基本信息",stepBasicDesc:"名称、描述、事件",stepImplTitle:"实现配置",stepImplDesc:"执行方式与参数",stepAdvancedTitle:"高级选项",stepAdvancedDesc:"优先级、过滤、测试",editRule:"编辑: {{name}}",addRule:"添加 Hook 规则",fieldName:"名称 *",fieldDescription:"描述",descriptionPlaceholder:"这个 Hook 的作用...",fieldEvents:"事件 *",eventsSelected:"{{n}} 已选",searchEventsPlaceholder:"搜索事件...",toggleAllEvents:"全选/取消",fieldImplType:"实现类型 *",fieldCommand:"命令 *",fieldPromptTemplate:"Prompt 模板 *",promptTemplatePlaceholder:"你是一个安全审计专家,请分析以下工具调用...",selectAgentPlaceholder:"选择 Agent...",agentReadOnlyHint:"Agent 将以只读模式运行(Read/Grep/Glob),不会修改文件",fieldPriority:"优先级",fieldTimeout:"超时 (ms)",labelEnabled:"启用",failOpenLabel:"Fail-open(超时放行)",fieldToolFilter:"工具过滤(正则,可选)",dryRunResultTitle:"Dry-run 结果",dryRunDecision:"决策: ",dryRunReason:"原因: ",dryRunOutput:"输出: ",dryRunButton:"试运行 (Dry Run)",prevStep:"上一步",nextStep:"下一步",saveChanges:"保存修改",createRule:"创建规则",noRules:"暂无 Hook 规则",noRulesHint:'点击右上角"新增规则"创建第一个 Hook',batchDeleteConfirm:"确认删除 {{n}} 条规则?",selectedItems:"已选 {{n}} 项",enableAll:"全部启用",disableAll:"全部禁用",colName:"名称",colEvents:"事件",colType:"类型",colStatus:"状态",colActions:"操作",clickToDisable:"点击禁用",clickToEnable:"点击启用",actionEdit:"编辑",deleteRuleConfirm:'删除规则 "{{name}}"?',statTotal:"总规则数"},$C={pending:"等待",thinking:"思考",action:"执行",result:"结果",running:"运行中",error:"错误",completed:"完成",params:"参数"},HC={linesTotal:"… (共 {{n}} 行)",expandAll:"展开全部 ({{n}} 行)",collapse:"收起"},PC={quickCommands:"快捷命令",search:'搜索: "{{filter}}"',help:"↑↓ 选择 · Enter 执行 · Esc 关闭",backend:"后端",backendCommand:"后端命令",chat_desc:"切换到对话面板",chat_result:"已切换到对话面板",terminal_desc:"切换到终端面板",terminal_result:"已切换到终端面板",files_desc:"切换到文件面板",files_result:"已切换到文件面板",models_desc:"切换到模型面板",models_result:"已切换到模型面板",tools_desc:"列出可用工具",tools_result:"已切换到工具面板",skills_desc:"列出可用技能",skills_result:"已切换到技能面板",settings_desc:"切换到设置面板",settings_result:"已切换到设置面板",logs_desc:"切换到日志面板",logs_result:"已切换到日志面板",new_desc:"创建新会话",new_result:"新会话已创建",clear_desc:"清空当前会话消息",clear_result:"消息已清空",theme_desc:"切换主题 (dark/light/auto)",theme_error:"用法: /theme <dark|light|auto>",theme_result:"主题已切换为 ",theme_preset_result:"主题预设已切换为 ",theme_preset_unavailable:"主题预设切换不可用",toggle_terminal_desc:"切换底部终端面板显示",toggle_terminal_result:"终端面板已切换",logs_clear_desc:"清空日志",logs_clear_result:"日志已清空",doctor_desc:"系统自诊断 (Config/API Key/Network/Docker/Disk)",compact_desc:"压缩当前会话上下文",help_desc:"显示所有快捷命令",token_desc:"显示 token 使用量和 API 费用统计",review_desc:"代码审查 — 检查变更的正确性、安全性和代码质量",security_review_desc:"安全审查 — OWASP Top 10 + 命令注入/路径遍历/权限提升",memory_desc:"管理 AI 持久记忆 (list/add/delete/clear)",ps_desc:"查看和管理后台任务、子代理和 shell 进程",model_desc:"查看或切换 AI 模型",status_desc:"显示当前会话状态 (会话ID/消息数/模型/工作目录)",config_desc:"管理应用程序配置 (get/set/list/delete)",exit_desc:"退出应用",exit_result:"正在关闭服务...",benchmark_desc:"运行 DeepSeekCode 能力评测 (simple/medium/complex/full/list)",goal_desc:"设置多步工作目标",goal_list_desc:"列出活跃目标",goal_status_desc:"查看目标进度",workflow_list_desc:"列出工作流运行记录",workflow_status_desc:"查看工作流状态",workflow_checkpoints_desc:"列出工作流检查点",mcp_desc:"列出或重新加载 MCP 服务器",sessions_desc:"列出会话",resume_desc:"按 ID 恢复会话",permissions_desc:"显示权限规则和待审批项",init_desc:"生成 agent.md 项目指导文件",self_test_desc:"运行工具能力自测并生成报告",context_desc:"显示上下文分析报告",version_desc:"显示版本信息","check-update_desc":"检查可用更新",upgrade_desc:"升级到最新版本",acceptance_desc:"运行或检查验收工作流 (quick/full/list/report)",diff_desc:"查看未提交的 Git 变更",summary_desc:"总结当前会话内容",effort_desc:"显示或设置推理力度 (low|medium|high)",export_desc:"导出当前会话为 JSON",rename_desc:"重命名当前会话",hooks_desc:"显示活跃钩子配置",cost_desc:"显示预估会话成本",sent_command:"已发送命令 ",noActiveSession:"无活跃会话",unknownCommand:"未知命令 {{cmd}} — 输入 /help 查看可用命令"},FC={pageError:"页面出现错误",unknownError:"发生了未知错误,请尝试刷新页面",refreshPage:"刷新页面",genEnded:"生成已结束(工具执行超时或连接中断)"},GC={backendConnected:"后端已连接",backendDisconnected:"后端连接断开,正在重连...",paused:"已暂停,再按 ESC 终止",terminated:"已终止 (ESC×2)",contextCompressed:"上下文压缩: {{original}} → {{compressed}} 条消息, 释放 {{saved}} tokens",errorPrefix:"❌ 错误: {{error}}",uncaughtError:"未捕获错误:",uncaughtRejection:"未捕获的 Promise 拒绝: ",unknownReason:"未知原因",diagnosing:"⏳ 诊断中...",runDiagnostic:"🔍 运行诊断",inspectorOn:"开启检查模式 (Ctrl+Shift+Alt+C)",inspectorOff:"关闭检查模式"},qC={title:"频道管理",subtitle:"接入外部 IM 平台,通过微信、飞书、钉钉等与 AI 交互",newChannel:"新建频道",editChannel:"编辑频道",table:{name:"频道名称",type:"类型",appId:"App ID",status:"连接状态",enabled:"启用",actions:"操作",emptyHint:"点击右上角「新建频道」接入微信、飞书或钉钉"},status:{connected:"已连接",disconnected:"未连接",connecting:"连接中",error:"错误"},empty:"还没有配置任何频道",emptyHint:"点击「新建频道」添加一个 IM 平台机器人",form:{basicInfo:"基础信息",name:"频道名称",namePlaceholder:"例如:公司群机器人",type:"频道类型",credentials:"凭证信息",appId:"App ID / 企业ID",appIdPlaceholder:"填写应用 AppID",appSecret:"App Secret",appSecretPlaceholder:"填写应用密钥",token:"Token / Bot Token",tokenPlaceholder:"填写机器人 Token",encodingAESKey:"EncodingAESKey",encodingAESKeyPlaceholder:"仅微信需要,可选",enabled:"启用频道",wechatQrHint:"保存后可使用微信扫码登录",feishuWsHint:"飞书使用 WebSocket 连接,自动接收消息",namePlaceholderDev:"例如:研发群机器人",typeLocked:"频道类型创建后不可修改",leaveBlankUnchanged:"留空不修改",leaveBlankMeansUnchanged:"留空表示不修改",appSecretValue:"应用密钥",tokenCallback:"回调校验 Token",optionalShort:"选填",encodingAesOptional:"选填,消息加解密密钥",wechatIlinkHint:"微信 iLink 机器人通过扫码授权,凭证可留空,保存后扫码登录即可。",wechatIlinkHintList:"微信 iLink 机器人通过扫码授权,凭证可留空,保存后在列表点击「扫码登录」。",enabledOffHint:"关闭后停止收发消息"},actions:{scanQr:"扫码",edit:"编辑",delete:"删除",deleteConfirm:"确定要删除此频道?",test:"测试连接",save:"保存频道",cancel:"取消",refresh:"刷新",qrLogin:"扫码登录",deleteConfirmNamed:"确认删除频道「{{name}}」?",deleteConfirmShort:"确认删除该频道?"},errors:{loadFailed:"加载频道列表失败",createFailed:"创建频道失败",updateFailed:"更新频道失败",deleteFailed:"删除频道失败",notFound:"频道未找到",notImplemented:"尚未实现",nameRequired:"频道名称不能为空"},qr:{title:"微信扫码登录",generating:"二维码生成中...",waiting:"请使用微信扫描二维码",scanned:"已扫描,请在手机上确认",confirmed:"登录成功",expired:"二维码已失效",expiredHint:"点击重试重新生成二维码",error:"获取二维码失败",openInNewTab:"在新标签页打开"},typeLabels:{wechat:"微信",feishu:"飞书",dingtalk:"钉钉",telegram:"Telegram",discord:"Discord",slack:"Slack",signal:"Signal",whatsapp:"WhatsApp",line:"LINE",qqbot:"QQ Bot",matrix:"Matrix",mattermost:"Mattermost",msteams:"Teams",googlechat:"Google Chat",irc:"IRC"},viewSubtitle:"接入微信、飞书、钉钉,用户可通过频道发送任务并实时接收进度与结果",experimentalLabel:"实验性",experimentalShort:"实验",experimentalTip:"实验性实现,功能不完整",experimentalDesc:"此频道为基础适配器封装,支持基础消息收发,部分高级功能可能不完整",pluginMissingLabel:"插件未安装",pluginMissingTip:"该频道类型的插件未安装或未激活,无法启动实例",pluginMissingWarning:"该频道类型的插件未安装或未激活,实例无法启动。请到「插件」页安装并激活{{name}}插件后重试。",selectTypeHint:"请从左侧选择一个频道类型",instancesCount:"{{n}} 个配置实例",notConfiguredYet:"尚未配置",createInstance:"新建实例",createShort:"新建",selectInstance:"选择实例",emptyWithType:"还没有配置 {{type}}",wechatBindHint:"点击下方按钮,用微信扫码即可自动完成绑定",startWithCreate:"点击上方「新建实例」开始配置",scanToBind:"扫码绑定",qrLoginReauth:"扫码登录 / 重新授权",editConfig:"编辑配置",createConfig:"新建配置",save:"保存",saving:"保存中...",unknownError:"未知错误",retry:"重试",bindSuccess:"绑定成功",bindTitle:"扫码绑定 · {{name}}",startUsing:"开始使用",clickToRefresh:"点击刷新",connectedReady:"「{{name}}」已连接,可开始使用",createdConnectedReady:"微信频道已创建并连接,可开始使用",waitingAuthorize:"请使用微信扫描二维码授权机器人",scannedConfirming:"已扫描,请在手机上确认...",confirmedClosing:"机器人已授权并启动,即将自动关闭",connectingIlink:"正在连接 iLink 服务...",openInNewTabFallback:"在新标签页打开(备用)",toastReauthSuccess:"微信「{{name}}」重新授权成功,频道已连接",toastBindSuccess:"微信绑定成功,频道已自动创建并连接",pollFailedRefresh:"轮询状态失败次数过多,请刷新二维码重试",pollFailedToast:"微信绑定状态轮询失败,请刷新二维码重试",qrDataMissing:"二维码数据缺失: {{data}}",fetchWechatQrFailed:"获取微信二维码失败:{{error}}",sidebar:{title:"频道列表",configuredCount:"{{n}} 个已配置",clickToConfigure:"点击下方频道开始配置",configuredMissing:"已配置 · 插件未安装",unconfigured:"未配置",partialConnected:"{{connected}}/{{count}} 已连接",waitingPlugin:"等待安装插件"},categories:{im:"即时通讯",international:"国际主流",eastAsia:"东亚",collaboration:"协作平台",classic:"经典协议",other:"其他",builtin:"内置",plugins:"插件扩展"}},WC={stageUploaded:"等待处理",stageParsing:"正在解析数据文件",stageMapping:"模板映射",stageRendering:"正在生成文件",stageComplete:"文件处理完成",stageError:"文件处理失败",parsing:"正在解析 {{file}} …",parsedSummary:"{{rows}} 行 · {{fields}} 个字段",mappingTitle:"模板 ↔ 数据字段映射",templatePlaceholder:"模板占位符",dataField:"数据字段",mappingMore:"另有 {{n}} 个映射",rendering:"正在逐条生成 {{current}}/{{total}} …",download:"下载",downloadFailed:"下载失败",error:"处理失败",roleData:"数据文件",roleTemplate:"模板文件",attach:"上传文件或图片,支持多选",dropHint:"松开以添加附件",unsupportedType:"不支持的文件类型: {{name}}",fileTooLarge:"文件过大: {{name}}(≤50MB)",duplicateFile:"重复文件: {{name}}",maxAttachments:"单次最多 {{n}} 个文件",uploadFailed:"上传失败",stillUploading:"附件正在上传中,请稍候…",importFailed:"Import files failed"},VC={reconnecting:"重连中 {{attempt}}/{{max}}",hint:"正在重新连接后端…"},KC={title:"Full access(自动批准)已开启",desc:"Agent 可不经确认直接编辑文件和执行命令,存在数据丢失风险。",dismiss:"本次关闭",neverShow:"不再显示"},YC={panelTitle:"环境与变更",noRepo:"非 Git 仓库",notGitDesc:"当前工作目录不是 Git 仓库,无法展示变更统计。",refresh:"刷新",changes:"变更统计",clean:"工作区干净",branch:"分支",upstream:"相对上游",commit:"提交",push:"推送",commitConfirm:"提交",commitPlaceholder:"提交信息(Agent 生成草稿,可编辑)…",commitSuccess:"提交成功",commitFailed:"提交失败",pushSuccess:"推送成功",pushFailed:"推送失败",checkoutSuccess:"已切换到 {{branch}}",checkoutFailed:"切换失败",prReady:"PR 检查状态正常",prUnavailable:"Pull request status unavailable(未关联远端)",prLoading:"加载 PR 状态…",environment:"环境信息",ok:"操作成功",loading:"加载中…",emptyCommitMsg:"请输入提交信息"},ZC={retry:"重试",details:"详情",modelSettings:"模型设置"},QC={comingSoon:"即将上线"},XC={lspGroup:"语言服务器 (LSP)",mcpGroup:"MCP 服务器",notInstalled:"未安装",installed:"已安装",ready:"已连接",connecting:"连接中",installing:"安装中…",error:"错误",disabled:"已禁用",toolCount:"{{count}} 个工具",docs:"文档",official:"官方",cloud:"云端",local:"本地",needCredentials:"此连接器需要凭据才能启动:",connect:"连接",missing:"未配置",envConfigured:"已配置",searchPlaceholder:"搜索连接器(名称、id、描述)…",all:"全部",noResults:"没有匹配的连接器。",custom:"自定义",addCustom:"添加自定义",customTitle:"添加自定义 MCP 服务器(来自 awesome-mcp-servers 或自建)",customName:"名称 (id)",customCommand:"启动命令",customArgs:"参数(空格分隔)",customEnv:"环境变量(KEY=value,逗号分隔)",customUrl:"MCP 端点 URL",customHeaders:"请求头(KEY=value,逗号分隔)",customLocal:"本地命令",customFormRequired:"名称和启动命令/URL 必填。",removeCustom:"删除此自定义连接器",add:"添加"},JC={justNow:"刚刚",minutesAgo:"{{count}}分钟前",hoursAgo:"{{count}}小时前",daysAgo:"{{count}}天前"},e_={title:"语音输入(英语 whisper / 中文 FunASR)",stopTitle:"停止录音并转写",langToggle:"切换识别语言:英语(whisper)/ 中文(FunASR)",noSpeech:"未识别到语音内容,请重试",backendMissing:"语音服务未就绪,已打开设置页引导安装",setup:{title:"语音服务",envCard:"运行环境检测",envChecking:"检测中…",recheck:"重新检测",pythonOk:"Python {{version}} 已就绪",pythonMissing:"未检测到 Python,请先安装 Python 3.10+",pythonGuide:"下载安装 Python",pipOk:"pip 可用",pipMissing:"pip 缺失,请先安装 pip 后再安装语音引擎",pipGuide:"执行以下命令修复 pip(再失败可参考 get-pip.py 官方方案):",whisperTitle:"Whisper · 英语",whisperDesc:"英语语音识别",funasrTitle:"FunASR · 中文",funasrDesc:"中文语音识别",installed:"已安装",notInstalled:"未安装",install:"一键安装",installing:"安装中…",cancel:"取消安装",installDone:"安装完成,可回到聊天页使用语音输入",installFailed:"安装失败",installTimeout:"安装超时",installCancelled:"安装已取消",jobInProgress:"已有安装任务进行中,正在接管进度",manualCommand:"手动安装命令",copyCommand:"复制命令",copySuccess:"已复制到剪贴板",copyFailed:"复制失败",torchHint:"中文引擎需安装 torch,体积较大,请耐心等待",logWaiting:"正在准备安装…",chooseHint:"环境已就绪,请选择上方引擎进行安装",defaultEngine:"默认识别引擎",defaultEngineHint:"选择语音输入默认使用的引擎,可在聊天输入框随时切换",inUse:"使用中",engineNotInstalledHint:"该引擎尚未安装,选中后录音时会引导安装"}},t_={verb:{researching:"分析代码",coding:"修改代码",validating:"运行验证",summarizing:"整理结果"},title:{withFile:"{{verb}} {{file}}",withCount:"{{verb}} · {{count}} 项"},evidenceMore:"等 {{count}} 项",toolCallCount:"{{count}} 次工具调用",toolNamesMore:"等 {{count}} 个工具",waitingUser:"等待你的回答",blocked:"被阻塞:{{reason}}",paused:"已暂停,可恢复",viewAndAnswer:"查看并回答",evidence:"执行明细",phase:{analysis:"分析",implementation:"实现",optimization:"优化"}},n_={next:"下一步",idle:"空闲"},s_={title:"定时自动化",refresh:"刷新",new:"新建",namePlaceholder:"名称(如:每早 9 点汇总 Git 状态)",instructionsPlaceholder:"指令(agent 每次触发时执行的内容)",cronPlaceholder:"cron(5 段,如 0 9 * * *)",create:"创建",cronDaily9:"每天 9:00",cronWeekday9:"工作日 9:00",cronEvery30Min:"每 30 分钟",empty:"还没有定时自动化。新建一个,让 agent 无人值守干活。",enable:"启用",disable:"停用",runNow:"手动触发",delete:"删除",historyTitle:"运行历史",noRuns:"暂无运行记录",permissionsTitle:"作用域放行(tool target)",permissionsEmpty:"无。未放行的写操作需人工批准,超时后自动拒绝。",permissionPlaceholder:"如:write_file docs/report.md",add:"添加"},a_="上下文容量",i_="系统提示词",r_="系统工具",o_="MCP 工具",l_="技能",c_="消息",u_="其他",d_="分类占比",f_="按后端上下文组装顺序(上→下):系统提示词 → 系统工具 → MCP 工具 → 技能 → 消息 → 其他(估算差额)",p_="按组装顺序 ↓",m_="平均缓存命中率",h_="万",g_="亿",y_="Token 分布",b_="用户消息",v_="助理消息",x_="工具请求",S_="工具结果",k_="⚠️ 重复读取: {{pct}}%",w_="{{pct}}% 保留",C_="上次压缩: {{orig}}→{{comp}} · {{saved}} tok",__="缓存命中 {{hit}} / 未命中 {{miss}}({{calls}} 次调用)",T_="本轮 run 进行中,等待 provider 上报缓存统计",N_="暂无缓存统计(provider 未返回 prompt_cache_hit/miss 字段)",E_="查看上下文容量详情",A_="模板库",j_="保存为模板",R_="已选 {{n}}",M_="↑↓ 选择 · Enter 插入(可连续多选)· Esc 关闭",O_="搜索文件中...",B_="未找到匹配的文件",D_="已选 {{n}} 个文件",L_="Enter 插入 · 可连续多选",z_="完成引用",U_="其他(我来说明)",I_="推进",$_="不选具体项,按你的最佳判断继续",H_="输入自定义答案",P_="(直接继续)",F_="(自定义)",G_="输入您的回答...",q_="提交",W_="✓ 已回答",V_="(用户未回答)",K_="(用户未输入)",Y_="批量确认",Z_="请回答",Q_="待回答",X_="⏱ {{seconds}}s 后未回答将自动按推荐项继续",J_="确认答案",eT="未回答",tT="有 {{count}} 题未回答,将记为「未回答」。点击上方题号可回到对应题目修改。",nT="提交全部答案",sT="返回修改",aT="上一题",iT="下一题",rT="查看提交",oT="完成本题 ({{count}} 项)",lT="确认本题",cT="Enter 提交,Shift+Enter 换行",uT="点击选项勾选,再点击「完成本题」提交本题;「推进」表示按 AI 判断继续",dT="点击选项勾选,再点击「提交所选」提交;「推进」表示按 AI 判断继续",fT="点击选项完成本题自动进入下一题,或点击「确认本题」提交当前高亮项",pT="提交所选 ({{count}} 项)",mT="提交中...",hT="点击选项立即提交,或点击下方「提交」确认当前选项",gT="折叠抽屉,查看消息",yT="展开抽屉,做出选择",bT="打开 ›",vT="定时任务(如每晚跑测试数据)将在这里管理。",xT="插件管理入口。可启停文件处理技能等扩展能力。",ST="功能开发中…",kT="文本",wT="{{done}}/{{total}} 行",CT="{{n}} 行失败",_T="+{{n}} 行",TT={title:"文件浏览器",searchPlaceholder:"搜索...",refresh:"刷新",collapse:"折叠",uploadTo:"上传到 {{dir}}",uploadToRoot:"上传到工作区根目录",setUploadDirHint:"点击设为上传目录并展开",download:"下载",close:"关闭",modified:"已修改",saving:"保存中...",save:"保存",saved:"文件已保存",saveFail:"保存失败",readFail:"读取文件失败",downloadFail:"下载失败",downloadStarted:"已开始下载",uploadedCount:"已上传 {{count}} 个文件",uploadFailedCount:"{{count}} 个文件上传失败",selectFileHint:"选择文件以预览或编辑"},NT={title:"日志",backendLogs:"后台日志",streamTab:"实时日志流",files:"日志文件",clear:"清空",refresh:"刷新",refreshing:"刷新中...",noLogs:"暂无实时日志",noFiles:"暂无日志文件",preview:"预览",download:"下载",backToList:"返回文件列表",emptyFile:"(空文件)",totalLines:"{{count}} 行",showingLatest:"(显示最新 {{count}} 行)"},ET="搜索会话...",AT="搜索会话",jT="清除会话搜索",RT={installedTab:"已安装 ({{count}})",availableTab:"可安装 ({{count}})",searchPlaceholder:"搜索插件(名称 / id / 描述 / 标签)",clear:"清除",allCategories:"全部",marketFilterAll:"全部来源",marketFilterBuiltin:"内置",prevPage:"上一页",nextPage:"下一页",pageInfo:"第 {{page}} / {{pages}} 页 · 共 {{count}} 条",noMatch:"无匹配插件",emptyInstalled:"暂无插件 — 到「可安装」页从市场安装",emptyMarket:"市场暂无可用插件",applyProviderTitle:"把插件 provider preset 写入 ProviderConfigStore(用户授权)",activate:"激活",deactivate:"停用",uninstall:"卸载",installActivate:"安装并激活",installOnly:"仅安装",uninstallTitle:"卸载插件",uninstallConfirm:"确定要卸载 {{id}} 吗?插件文件将被删除(bundled 除外)。"},MT="中",OT={starterTitle:"新模板",starterNodeTitle:"任务",starterNodeDesc:"描述任务",sourceSaved:"沉淀",sourceScript:"脚本",sourceHandwritten:"手写",roleExplore:"探索",rolePlan:"规划",roleExecute:"执行",roleVerify:"校验",roleSummarize:"总结",roleGeneric:"通用",noNodes:"此模板暂无节点。",filterAll:"全部",noMatchTemplates:"没有匹配的模板",emptyTemplates:"暂无模板。完成动态工作流后保存为模板,或由 AI 起草。",aiPromptRequired:"描述不能为空",aiDraftFailed:"AI 起草失败,请重试或改用手写",nameRequired:"模板名称不能为空",jsonParseFailed:"JSON 解析失败:{{error}}",invalidDefinition:"definition 必须是含 nodes 数组的 WorkflowDefinition",createFailed:"创建失败",loadFailed:"加载模板失败",uncategorized:"其他",savedVersion:"已保存(v{{version}})",saveFailed:"保存失败",renderFailed:"渲染失败",selectTemplateHint:"从左侧选择一个模板查看 / 编辑",selectTemplateHintSub:"内置预设开箱即用;也可以把一次工作流运行「保存为模板」沉淀复用。",loading:"加载…",deleteTemplate:"删除模板",categoryLabel:"分类(category)",descriptionLabel:"描述(description)",nodeCount:"{{n}} 个节点",topologyHint:"拓扑:串行 / 并行依赖",inputCount:"{{n}} 个输入参数",workflowNodes:"工作流节点",sortedByDeps:"按依赖拓扑排序",launchWithTemplate:"用模板新建会话",testRun:"试跑",versionHistory:"版本历史",advancedJson:"高级(JSON)",refresh:"刷新",inputsSchemaLabel:"inputs(参数 schema,JSON)— 修改后保存会升版本",definitionLabel:"definition(WorkflowDefinition,JSON)",saveChanges:"保存修改",versionSnapshotLabel:"不可变版本快照(versions/{v}.json)",noVersions:"暂无版本记录",viewingVersion:"当前查看中",libraryTitle:"模板库",newTemplate:"新建模板",newShort:"新建",searchPlaceholder:"搜索模板…",paramCount:"{{n}} 参数",viewing:"查看中",view:"查看",launchModalTitle:"用「{{name}}」新建会话",previewModalTitle:"试跑「{{name}}」",launch:"启动",renderPreview:"渲染预览",renderSuccess:"渲染成功 — 产物 definition 可直接启动",nameLabel:"名称 *",namePlaceholder:"如:Triage Inbox",categoryField:"分类",descriptionField:"描述",aiDraftTab:"让 AI 起草",manualJsonTab:"手写 JSON",aiPromptLabel:"用一句话描述要做什么(AI 会拆成带角色的工作流节点)",aiPromptPlaceholder:"如:审查当前仓库代码的安全/性能/正确性,输出分级报告,全程只读",aiWorking:"AI 拆解中…",generateWorkflow:"生成工作流",aiTimeHint:"约 30-60s(推理模型可能更久),生成后可手动微调",newInputsLabel:"inputs(参数 schema,JSON,用 <<input:name>> 引用)",inputsExamplePlaceholder:'[{ "name": "folder", "label": "目录", "type": "folder", "required": true }]',cancel:"取消",create:"创建",deleteConfirm:"确定删除模板「{{name}}」?该操作不可恢复。",delete:"删除",typeString:"文本",typeNumber:"数字",typeSelect:"选择",typeBoolean:"开关",typeFolder:"目录",typeConnector:"连接器",noInputsNeeded:"该模板无需参数,直接启动。",starting:"启动中…",requiredError:"必填",numberError:"请输入数字",selectNone:"(不选)",newSession:"新建会话",newFromTemplateTitle:"用模板新建",chooseTemplateAria:"选择模板新建会话",backToList:"返回模板列表",startSessionHeader:"开始一个会话",directChat:"直接对话",directChatHint:"不选模板,AI 现场拆解任务(动态工作流)",loadingTemplates:"加载模板…",noTemplatesYet:"暂无已保存模板。",libraryMenu:"模板库…"},BT={autoFollowOn:"跟随输出:开",autoFollowOff:"跟随输出:关"},DT={title:"测试与观测",evalIntro:"运行能力评估测试,验证系统功能是否正常。",running:"运行中...",evalTriggered:"{{label}} 已触发,请在对话中查看结果",evalQuickDesc:"验收检查 (无需 LLM)",evalFullDesc:"真实 LLM 调用 (耗时)",evalListDesc:"列出所有评测任务",historyTitle:"运行历史",refresh:"刷新"},LT={taskBoard:{title:"任务看板"},card:{collapse:"折叠",expand:"展开",auto:"自动",unpin:"取消固定",pinKeep:"固定(不自动收起)",pin:"固定",close:"关闭此小组件"},workflow:{fallbackTitle:"工作流",statusRunning:"运行中",statusCompleted:"完成",statusFailed:"失败",statusSkipped:"跳过",statusBlocked:"等待",statusPending:"待执行",resume:"恢复",pause:"暂停",cancel:"取消"},agentFlow:{statusRunning:"运行中",statusCompleted:"完成",statusFailed:"失败",statusIdle:"空闲",moreAgents:"+{{count}} 个 Agent",eventLog:"事件日志({{count}})"},plan:{title:"AI 计划",fallbackTitle:"工作流计划",stepCount:"{{count}} 步",moreSteps:"+{{count}} 步",start:"开始执行",change:"更换流程",changeHint:"取消此方案,换个说法重新描述",cancelTitle:"取消工作流",cancel:"取消"}},Jy={common:EC,nav:AC,chat:jC,shortcuts:RC,palette:MC,a11y:OC,plan:BC,settings:DC,models:LC,tools:zC,skills:UC,hook:IC,step:$C,toolCall:HC,slashCommands:PC,error:FC,toast:GC,channels:qC,fileJob:WC,reconnect:VC,autoAccess:KC,git:YC,errorCard:ZC,placeholder:QC,connectors:XC,time:JC,stt:e_,activity:t_,taskbar:n_,automation:s_,contextCapacity:a_,ctxSystemPrompt:i_,ctxSystemTools:r_,ctxMcpTools:o_,ctxSkills:l_,ctxMessages:c_,ctxOther:u_,categoryBreakdown:d_,assemblyOrderHint:f_,byAssemblyOrder:p_,avgCacheHitRate:m_,unitWan:h_,unitYi:g_,tokenDistribution:y_,distUserMessages:b_,distAssistantMessages:v_,distToolRequest:x_,distToolResult:S_,duplicateReads:k_,keepPercent:w_,lastCompactInfo:C_,cacheHitTitle:__,cacheWaitingRun:T_,cacheNoStats:N_,viewContextDetail:E_,templateLibrary:A_,saveAsTemplate:j_,selectedCountShort:R_,fileMentionHelpMulti:M_,searchingFiles:O_,noMatchingFiles:B_,selectedFilesCount:D_,enterInsertMulti:L_,finishMention:z_,askOtherLabel:U_,askProceedLabel:I_,askProceedDesc:$_,askCustomDesc:H_,askDirectTag:P_,askCustomTag:F_,askAnswerPlaceholder:G_,askSubmit:q_,askAnswered:W_,askUnansweredValue:V_,askEmptyInputValue:K_,askBatchTitle:Y_,askSingleTitle:Z_,askPendingBadge:Q_,askAutoContinue:X_,askReviewTitle:J_,askNotAnswered:eT,askUnansweredWarning:tT,askSubmitAll:nT,askBackToEdit:sT,askPrevQuestion:aT,askNextQuestion:iT,askViewSubmit:rT,askFinishQuestion:oT,askConfirmQuestion:lT,askEnterHint:cT,askMultiHintBatch:uT,askMultiHintSingle:dT,askSingleHintBatch:fT,askSubmitSelected:pT,askSubmitting:mT,askSingleHintSingle:hT,drawerCollapseTitle:gT,drawerExpandTitle:yT,openFile:bT,placeholderScheduledDesc:vT,placeholderPluginsDesc:xT,featureInProgress:ST,kindText:kT,rowsDone:wT,rowsFailed:CT,moreRows:_T,fileTree:TT,logs:NT,searchSessionsPlaceholder:ET,searchSessions:AT,clearSessionSearch:jT,plugins:RT,langZh:MT,templates:OT,terminal:BT,testing:DT,widgets:LT},zT={confirm:"Confirm",cancel:"Cancel",save:"Save",saving:"Saving...",delete:"Delete",close:"Close",refresh:"Refresh",retry:"Retry",loading:"Loading...",collapse:"Collapse",expand:"Expand",collapse_short:"Collapse",clear:"Clear",noData:"No data",noResults:"No results",unknown:"Unknown",unknownError:"Unknown error",connecting:"Connecting…",back:"Back",send:"Send",copy:"Copy",copied:"Copied",search:"Search...",filter:"All",pageInfo:"Showing {{start}}-{{end}} of {{total}}",prevPage:"Previous",nextPage:"Next",enabled:"Enabled",disabled:"Disabled",online:"Online",offline:"Offline",busy:"Busy",away:"Away",default:"Default"},UT={chat:"Chat",terminal:"Terminal",files:"Files",models:"Models",tools:"Tools",skills:"Skills",templates:"Presets",hooks:"Hooks",agentFlow:"Agent Flow",settings:"Settings",logs:"Logs",channels:"Channels",sessions:"Sessions",groupWorkspace:"Workspace",groupConfig:"Configuration",groupSystem:"System",collapseSidebar:"Collapse sidebar",expandSidebar:"Expand sidebar",moreOptions:"More",scheduled:"Scheduled",plugins:"Plugins",mySessions:"My sessions",sessionRunning:"Running",sessionWaiting:"Awaiting confirmation",sessionFailed:"Failed",sessionDone:"Completed",connectors:"Connectors",pin:"Pin to top",unpin:"Unpin",pinMore:"Pin 'More' to top",unpinMore:"Unpin 'More'"},IT={newSession:"New Session",noSessions:"No sessions yet",renameSession:"Rename session",exportMd:"Export as Markdown",you:"You",thinkingEllipsis:"Thinking…",messageRail:"Message navigation",messageIndex:"Conversation index",backToBottom:"Back to latest",generatingPlaceholder:"AI is generating…",defaultSessionTitle:"Chat {{n}}",welcome:"Welcome to deepseekcode",welcomeDesc:"I can help you write code, analyze projects, and automate tasks. Try sending a message!",suggestionCode:"Code Writing",suggestionCodePrompt:"Implement quicksort in Python and explain its time complexity",suggestionAnalyze:"Code Analysis",suggestionAnalyzePrompt:"Analyze the current project structure and explain how it is organized",suggestionAutomate:"Automation",suggestionAutomatePrompt:"Write a script to organize the files in the current directory",quickCommands:"View quick commands",refFiles:"Reference files",inputPlaceholder:"Type a message... Shift+Enter for newline, / commands, @ file refs, ↑ history",charTokens:"{{chars}} chars · ~{{tokens}} tokens",nearLimit:"Near limit",shiftEnter:"Shift+Enter newline",escHint:"Esc to pause · Double-Esc to stop",resume:"Resume",resumeGen:"Resume generation",stop:"Stop",stopGen:"Stop generation",pause:"Pause",pauseGen:"Pause generation",sendBtn:"Send",voiceInput:"Voice Input",voiceListening:"Listening...",voiceTranscribing:"Transcribing...",voiceUnsupported:"Voice input is not supported in this browser",voiceError:"Voice recognition error, please try again",connected:"Connected",disconnected:"Disconnected",sessionHistory:"Session History",noHistory:"No history sessions",clearHistory:"Clear history",clearHistoryTitle:"Clear history",restoreSession:'Click to restore "{{title}}"',removeFromHistory:"Remove from history",viewAllSessions:"More sessions",allSessions:"All sessions",sessionPickerTitle:"Select session",clickToOpenSession:"Open session",workingDir:"Working Directory",switchDir:"Switch",clickToSwitchDir:"Click to switch working directory",switchDirPrompt:"Enter new working directory path:",addTask:"Add",addTaskPlaceholder:"Add task...",noTasks:"No tasks, add one above",taskBoardDragHint:"Drag down to expand · drag up to collapse · click to toggle",doubleClickEdit:"Double-click to edit",deleteTask:"Delete task",backgroundLogs:"Background Logs",effort:"Effort",effortOff:"Thinking off",effortLow:"Low",effortMedium:"Medium",effortHigh:"High",effortExtraHigh:"Extra high",effortMax:"Max",noWorkspaceDir:"No working directory",recentDirs:"Recent directories",noRecentDirs:"No recent directories",chooseOtherDir:"Choose another directory…",dirPickerTitle:"Select working directory",dirPickerEnterPath:"Type a full path and press Enter",dirPickerGo:"Go",dirPickerUp:"Up",dirPickerNoDirs:"No subdirectories",dirPickerConfirm:"Select this directory",dirPickerLoadError:"Failed to load directory",artifactPanel:"AI Outputs",workspaceTitle:"Workspace",workspaceToggle:"Switch to workspace",artifactsToggle:"Switch to outputs",workspaceHint:"AI Agent workspace: components load into a dynamic layout and respond to events and commands.",artifactEmpty:"No output files yet. Click a file/path link in the chat to preview it here.",artifactHint:"Click a file/path link in the chat to preview it here — drag the panel edge to resize, or use the maximize button in the corner",previewInPanel:"Preview",backToArtifacts:"Back to list",openInNewTab:"Open in new tab",copyPath:"Copy path",copiedPath:"Path copied",copyPathFailed:"Failed to copy",filePreviewHint:"This file type can't be previewed inline — download it or open it in a new tab.",sidebarProgress:"Progress",sidebarArtifacts:"AI Outputs",sidebarOpen:"Open",sidebarOpenFolder:"Open first output file",sidebarExpandAll:"Expand all",sidebarMaximize:"Maximize",sidebarRestore:"Restore size",sidebarWorking:"Working on this…",sidebarWorkingWithAgents:"Working ({{n}} agent(s) running)…",sidebarWorkingToolcalls:"Working ({{n}} tool call(s))…",sidebarIdle:"Progress for multi-step tasks shows up here: planning, tool calls, approvals, and produced files.",sidebarMoreTasks:"more tasks",sidebarRunningAgents:"{{n}} agent(s) running",sidebarToolcallsSoFar:"{{n}} tool call(s) so far",tokenPrompt:"Prompt",tokenCompletion:"Completion",tokenTotal:"Total",totalChars:"Total chars",avgTokens:"Avg tokens/msg",estimatedCost:"Est. cost: ${{cost}}",contextTrimming:"Context Trimming",keepMore:"Keep more",trimMore:"Trim more",trimContext:"Trim context (keep ~{{n}} messages)",currentMessages:"{{n}} messages",totalCharsInfo:"· {{n}} chars total",contextManager:"Context Manager",showContext:"Show context info",taskBoard:"Task Board",morePending:"{{n}} more pending...",moreCompleted:"{{n}} more completed...",dependencyCount:"🔗 {{n}} dependencies",contextSuggestions:"Expand ({{n}} suggestions)",collapseSuggestions:"Collapse",toolRequest:"Tool request: ",toolResult:"Tool result: ",memory:"Memory: ",filesCount:"({{n}} files)",saveTokens:"Save ~{{n}}",ignoreSuggestion:"Ignore suggestion",fileMention:"@ Reference file",fileMentionSearch:'@ Search: "{{query}}"',fileMentionHelp:"↑↓ Select · Enter Insert · Esc Close",fileBrowser:"File Browser",fileSaved:"File saved",fileReadError:"Failed to read file",fileSaveError:"Save failed",fileModified:"● Modified",selectFilePreview:"Select a file to preview or edit",kbdHint:"command palette",clickToSwitchMode:"Click to toggle mode (Plan → Goal → Act)",selectModel:"Select model",clickToSelectModel:"Select model / reasoning effort",noEnabledModels:"No enabled models",globalDefault:"Global default",planDefault:"Plan default",actDefault:"Act default",goalDefault:"Goal default",followGlobalDefault:"Follow global default",followGlobalDefaultHint:"Clear this mode's default and fall back to the global default",noGlobalDefault:"No global default",browseMoreModels:"Browse more models…",backToModels:"Back to models",selectProvider:"Select provider",searchModels:"Search models…",loadingModels:"Loading models…",noModelsFound:"No matching models",noProviderModels:"No models available for this provider",noConfiguredProviders:"No providers configured",addAndSwitch:"Add & switch",alreadyAdded:"Added",addingModel:"Adding…",currentModel:"Current",loadModelsFailed:"Failed to load models",addModelFailed:"Failed to add model",switchModelFailed:"Failed to switch model",modelsSourceProviderApi:"Fetched live from provider API",modelsSourceCatalog:"From model catalog (models.dev)",assistantLabel:"DeepSeekCode",thoughtProcess:"Thought process",runningSteps:"Running",stepCount:"step",stepCountPlural:"steps",copyMessage:"Copy",regenerate:"Regenerate",deleteMessage:"Delete message",historyCount:"{{n}} items",startChatHint:"Start a conversation first",panelTitle:"Panel",messageDeleted:"Message deleted",thinking:"Thinking"},$T={title:"Keyboard Shortcuts",commandPalette:"Open command palette",clearLogs:"Clear logs",help:"Show shortcuts help",submit:"Submit input",newline:"New line",closeDialog:"Close dialog / pause generation",slashCommand:"Quick commands",fileRef:"Reference files",stopGen:"Stop generation (double Esc)"},HT={placeholder:"Search commands or jump to panel...",navGroup:"Navigation",commandGroup:"Commands",empty:"No matching commands",hint:"↑↓ Select · Enter Run · Esc Close",running:"Running..."},PT={openMenu:"Open menu",closeMenu:"Close menu",close:"Close",expand:"Expand",collapse:"Collapse",delete:"Delete",remove:"Remove",send:"Send message",newSession:"New session",messageInput:"Message input",connectionStatus:"Connection status",loading:"Loading",toggleAgentFlow:"Toggle agent flow",commandPalette:"Command palette",shortcutsHelp:"Shortcuts help"},FT={mode:"Mode",planMode:"Plan Mode — Read-only analysis",planModeDesc:"In Plan mode, AI uses read-only tools to analyze requirements and code without modifying any files.",planModeHint:"After analysis, switch to Act mode to implement changes.",switchToAct:"Switch to Act mode",actMode:"Act Mode",actModeDesc:"In Act mode, AI can read, modify files, and execute commands.",actModeHint:"Need to analyze first? Switch to Plan mode for read-only exploration.",switchToPlan:"Switch to Plan mode",readOnlyMode:"Read-only",planTitle:"Plan Mode: Read-only exploration, cannot modify code",actTitle:"Act Mode: Full read/write access",switchToPlanMode:"Switch to plan mode",switchToActMode:"Switch to act mode",autoMode:"Auto mode: auto-approve tool calls",goalMode:"Goal Mode",planModeShort:"Read-only analysis and planning",actModeShort:"Read/write files and run commands",goalModeShort:"Keep working toward the goal until done",autoApprove:"Auto Approve",autoApproveShort:"Auto-approve all tool calls",planContent:"Plan file content",analyzing:"Analyzing requirements...",modePlanTitle:"Plan Mode — Read-only exploration",modePlanDesc:"Read-only mode. AI can only read files and analyze code; no modifications are allowed. After analysis, use ExitPlanMode to switch to Act mode.",modeActTitle:"Act Mode — Execute",modeActDesc:"Read-write mode. AI can read, modify files, and execute commands. Low-risk operations are auto-approved; high-risk ones require confirmation.",modeGoalTitle:"Goal Mode — Goal-driven tasks",modeGoalDesc:"Goal-oriented execution mode. AI can read/write and execute within the active task scope; out-of-scope operations require confirmation.",modeNormalTitle:"Normal Mode — Standard interaction",modeNormalDesc:"Standard interaction mode. All tools work normally; writes and command execution require user confirmation.",readOnlyBadge:"🔒 Read-only",autoApproveBadge:"✅ Auto-approve",toPlanMode:"Switch to Plan Mode",toActMode:"Switch to Act Mode",modeCycleHint:"Mode cycle: Plan → Act → Goal; Auto is an independent toggle"},GT={title:"Settings",theme:"Theme",themeDark:"🌙 Dark",themeLight:"☀️ Light",themeAuto:"🔄 Auto",themePresets:"Theme Presets",themePresetLinear:"Linear (minimal)",themePresetLinearDesc:"Neutral grays with a single accent — clean and focused",themePresetGithub:"GitHub",themePresetGithubDesc:"Neutral dark/light — clean and professional",themePresetCherry:"Cherry Studio",themePresetCherryDesc:"Blue gradient inspired — clean tech feel",themePresetOcean:"Ocean",themePresetOceanDesc:"Deep blue/cyan — calm and professional",themePresetMint:"Mint",themePresetMintDesc:"Teal/mint green — fresh and refreshing",themePresetLavender:"Lavender",themePresetLavenderDesc:"Soft purple — elegant and sophisticated",themePresetMidnight:"Midnight",themePresetMidnightDesc:"Deep navy — minimal and high contrast",themePresetSunset:"Sunset",themePresetSunsetDesc:"Warm orange/golden — energetic",themePresetForest:"Forest",themePresetForestDesc:"Natural green — earthy and calm",themePresetCandy:"Candy",themePresetCandyDesc:"Bright multi-color — vibrant and lively",themePresetNord:"Nord",themePresetNordDesc:"Arctic blue — popular well-designed palette",customOverrides:"Custom Overrides",customOverridesHint:"Tweak individual colors to override the active preset",customColors:"Custom Colors",colorBg:"Background",colorSurface:"Surface",colorBorder:"Border",colorText:"Text",colorMuted:"Muted Text",colorAccentBlue:"Accent Blue",colorAccentGreen:"Accent Green",colorAccentRed:"Accent Red",colorAccentYellow:"Accent Yellow",colorAccentPurple:"Accent Purple",resetColors:"Reset to default",about:"About",aboutDesc:"Web-based AI coding assistant interface",language:"Language",languageZh:"中文",languageEn:"English",display:"Display",developerView:"Developer view (show raw tool calls)",developerViewHint:"Shows the AI activity feed by default; enable to see raw tool logs",capabilities:{title:"Agent Capabilities",loadFailed:"Failed to load capabilities",toggleFailed:"Toggle failed"},contextOffload:{title:"Context Offload (Artifact Store)",desc:"Large tool outputs are stored on disk as artifacts instead of living in the context forever. Only a summary + handle stays in context; the AI retrieves details on demand via artifact_query / artifact_read. This significantly reduces token usage in long sessions and improves cache hit rate.",enableLabel:"Enable tool-result offloading",currently:"currently",maxTotalMb:"Max total storage (MB)",ttlDays:"Retention (days)",outboundBytes:"Spill threshold (bytes; outputs larger are offloaded)",turnBudget:"Per-turn context growth budget (tokens)",dir:"Storage directory",optional:"optional, defaults to config dir",stats:"{{count}} artifacts stored, {{size}} MB total",saved:"Context Offload settings saved",saveFailed:"Failed to save",invalidNumber:"Number fields must be positive integers",envHint:"Fields marked ⚠ env are overridden by environment variables of the same name"}},qT={title:"Model Configuration",providerConfig:"Provider Config",configured:"Configured",notConfigured:"Not configured",modelsCount:"{{n}} models · {{apiType}}",clickToConfig:"Click to configure →",apiKeyHint:"API Key configured. Enter new key to overwrite.",apiKeyPlaceholder:"Enter new key to overwrite...",apiKeyDefaultPlaceholder:"sk-...",enterApiKey:"Please enter API Key",removeConfirm:'Are you sure you want to remove "{{providerKey}}" configuration? This will delete its API Key and models.',loadFailed:"Failed to load models",saveFailed:"Save failed",overallStatus:"Overall Status",healthy:"Healthy",degraded:"Degraded",abnormal:"Abnormal",healthRate:"Health Rate",onlineInstances:"Online Instances",totalRequests:"Total Requests",configuredModels:"Configured Models",addModel:"Add Model",provider_qwen:"Qwen (Tongyi Qianwen)",provider_glm:"GLM (Zhipu)",provider_baichuan:"Baichuan",provider_minimax:"MiniMax / Hailuo",provider_doubao:"Doubao",provider_hunyuan:"Tencent Hunyuan",provider_spark:"iFlytek Spark",provider_custom:"Custom",globalShort:"Global",setDefaultProvider:"Set as default provider",deleteProviderConfirm:'Delete the configuration for "{{key}}"?',deleteProvider:"Delete provider",catalogTitle:"models.dev Catalog Search",catalogSearchPlaceholder:"Search models across providers, e.g. gpt-4o / deepseek / claude... (matches model id, name, or provider)",catalogOnlyToolCall:"Tool call only",catalogOnlyReasoning:"Reasoning only",searching:"Searching...",catalogNoResults:"No matching models — try another keyword",badgeReasoning:"Reasoning",badgeToolCall:"Tools",badgeMultimodal:"Multimodal",ctxLimit:"Context {{k}}K",outLimit:"Output {{k}}K",catalogAddTitle:"Add to model ID input",add:"Add",catalogSourceHint:'Source: models.dev model catalog (built-in snapshot, works offline). Click "Add" to write the model ID into the Model ID input.'},WT={title:"Tool List",searchTools:"Search tools...",disabled:"Disable",enabled:"Enable",params:"Parameters",loadFailed:"Failed to load tools",noTools:"No tools available",loading:"Loading...",retry:"Retry",refresh:"Refresh",all:"All",invalidData:"Invalid tool data format returned by server"},VT={title:"Skills Manager",list:"Skill List",noSkills:"No skills available",loadFailed:"Failed to load skills",loadFailedFallback:"Load failed",enable:"Enable",disable:"Disable",enabled:"Enabled",disabled:"Disabled",new:"New Skill",import:"Import",importTitle:"Import Skill",edit:"Edit",save:"Save",cancel:"Cancel",retry:"Retry",refresh:"Refresh",tags:"Tags",none:"None",source:"Source",localSkill:"Local skill",systemPrompt:"System Prompt",selectSkill:"Select a skill",fieldId:"ID",fieldName:"Name",fieldCategory:"Category",fieldTrigger:"Trigger",fieldTools:"Tools",description:"Description",saving:"Saving",chooseFile:"Choose skill file",importHint:"Supports `.skill.md` files.",marketplace:"Marketplace",marketplaceDesc:"Browse and install skills from remote marketplaces",marketplaceTitle:"Skill Marketplace",addMarketplace:"Add Marketplace",addMarketplaceTitle:"Add Skill Marketplace",marketplaceUrl:"Marketplace URL",marketplaceUrlPlaceholder:"GitHub repo / index.json link / local skills folder, e.g. https://github.com/obra/superpowers or D:\\agent\\agentic-awesome-skills",marketplaceName:"Marketplace name (optional)",marketplaceHint:"Supports GitHub repos (auto-scans skills/ dir), an index.json URL, or a local skills folder (fully offline — browse & install from disk). If GitHub is unreachable, set the DEEPSEEKCODE_GITHUB_MIRROR env var to a mirror prefix.",marketFilterPlaceholder:"Search skills in this marketplace...",marketCategoryAll:"All categories",riskCritical:"High risk",riskUnknown:"Risk unknown",refreshMarketplace:"Refresh",removeMarketplace:"Remove",installSkill:"Install",installed:"Installed",installFail:"Install failed",loadMarketplaceFail:"Failed to load skill marketplace",noMarketplaces:"No marketplaces yet — add one",noSkillsInMarket:"No skills in this marketplace",marketplaceError:"Marketplace index failed to load: {{error}}",retryMarket:"Retry",presets:"Built-in marketplaces",marketplaces:"Added marketplaces",skillCount:"{{count}} skills",installedSkills:"Installed skills",addFail:"Failed to add marketplace",installing:"Installing...",adding:"Adding...",marketplaceTab:"Marketplace",mineTab:"My Skills",installedTab:"Installed",workshopTab:"Workshop",workshopHint:"Skill proposals: generated from sessions or manually, apply as skills after review",workshopPropose:"New Proposal",workshopName:"Skill name (skill-name) e.g. format-json",workshopTrigger:"Trigger keywords (optional)",workshopDescription:"One-line description",workshopContent:"Skill body (system prompt / workflow instructions)",workshopSubmit:"Submit",workshopApply:"Apply",workshopEmpty:"No skill proposals yet",workshopFormRequired:"Skill name and content are required",uninstall:"Uninstall",uninstallConfirm:'Uninstall installed skill "{{name}}"?',uninstalling:"Uninstalling...",uninstallFail:"Uninstall failed",pagePrev:"Prev",pageNext:"Next",pageOf:"Page {{page}} / {{total}}",emptyInstalled:"No marketplace skills installed yet",emptyInstalledHint:"Head to the Marketplace tab to browse and install",browseMarket:"Go to Marketplace",use:"Use",useHint:"Insert $skill into the input box, then add your task and send",pickTitle:"Pick a Skill",pickPlaceholder:"Search skills...",pickEmpty:"No usable skills",pickUse:"Use it"},KT={permissionRequest:"Permission Request",hookApproval:"Hook Interception Approval",hookConfirm:"Hook Request Confirmation",morePending:"{{n}} more pending",tool:"Tool: ",reason:"Reason: ",needConfirm:"Requires user confirmation",allow:"Allow",deny:"Deny",allowAlways:"Always allow this session",allowAlwaysDesc:"Don't ask again for this tool in current session",autoMode:"Auto Mode",autoModeLabel:"Auto mode (allow all)",autoModeDesc:"Auto-approve all hook requests",moreOptions:"More options",highRiskWarning:"This action may cause irreversible effects, please confirm carefully",mediumRiskConfirm:"Please confirm this is the intended action",alreadyAllowed:"Allowed: ",alreadyDenied:"Denied: ",risk_critical:"Destructive operation - may delete data",risk_critical_cmd:"High-risk command - system-level operations",risk_high_shell:"Shell command execution",risk_high_file:"File write operation",risk_high_pkg:"Package management operation",risk_git_force:"Git force operation",risk_git:"Git operation",risk_network:"Network request",risk_low:"Read-only operation",risk_default:"Tool call",hookConfigTitle:"Custom Hook Configuration",hookConfigDesc:"You can add or modify hook interception rules in the .agent/hooks.json file in the project root directory.",hookConfigDetail:"Hooks support SHELL (external scripts) and HTTP (REST endpoints) types, and can be triggered before (PRE_TOOL_USE) or after (POST_TOOL_USE) tool execution.",hookConfigBuiltin:"Built-in hooks: BashSafetyHook (dangerous command interception), FileWriteAuditHook (file write audit), ToolUsageStatsHook (tool usage statistics). Set enabled: false to disable any hook.",optionAllow:"Allow — execute this operation",optionAllowHint:"Click or press Enter to confirm",optionDeny:"Deny — cancel this operation",optionDenyHint:"Click or press Esc to cancel",optionAllowAlways:"Allow always this session",optionAllowAlwaysHint:"Don't ask again for {{tool}}",optionAllowPathHint:"Don't ask again for this external path",timeoutWaitUser:"waiting for user (no timeout)",optionAutoMode:"Auto mode — allow all hooks",optionAutoModeHint:"All future hooks will be auto-approved",shortcutHint:"Shortcuts: 1-4 select · Enter allow · Esc deny",lastItem:"Last item",modalHint:"Please handle this approval request in the popup modal",clickToSelect:"Click to select · 1/2/3/4 keyboard shortcuts",verbRunCommand:"Run command",verbWriteFile:"Write file",verbEditFile:"Edit file",verbReadFile:"Read file",verbDeleteFile:"Delete file",verbFindFiles:"Find files",verbSearchContents:"Search contents",verbFetchUrl:"Fetch URL",verbSearchWeb:"Search web",verbGit:"Git operation",verbInstall:"Install package",verbSendMessage:"Send message",verbRunTool:"Run operation",scopeLocal:"acts on this workspace",scopeExternal:"external path",showAllLines:"Show all {{n}} lines",showAll:"Show the full message",showLess:"Show less",importMergeConfirm:`Merge into the existing configuration?
55
- "OK" = merge / "Cancel" = replace`,configTitle:"Hook Configuration",configDesc:"Attach interceptors to lifecycle events such as tool execution and task transitions for approvals and custom logic",import:"Import",export:"Export",newRule:"New Rule",ruleList:"Rules",ruleCount:"{{n}} rules",implShell:"Shell script",implShellDesc:"Run an external script; receives JSON via stdin and returns a decision via stdout",implHttp:"HTTP endpoint",implHttpDesc:"POST JSON to an external endpoint",implPromptDesc:"Send a single-turn prompt to the LLM for risk assessment",implAgentDesc:"Launch a read-only sub-agent for deep investigation",stepBasicTitle:"Basic Info",stepBasicDesc:"Name, description, events",stepImplTitle:"Implementation",stepImplDesc:"Execution type and parameters",stepAdvancedTitle:"Advanced",stepAdvancedDesc:"Priority, filters, testing",editRule:"Edit: {{name}}",addRule:"Add Hook Rule",fieldName:"Name *",fieldDescription:"Description",descriptionPlaceholder:"What this hook does...",fieldEvents:"Events *",eventsSelected:"{{n}} selected",searchEventsPlaceholder:"Search events...",toggleAllEvents:"Select all / none",fieldImplType:"Implementation type *",fieldCommand:"Command *",fieldPromptTemplate:"Prompt template *",promptTemplatePlaceholder:"You are a security audit expert. Please analyze the following tool call...",selectAgentPlaceholder:"Select agent...",agentReadOnlyHint:"The agent runs in read-only mode (Read/Grep/Glob) and cannot modify files",fieldPriority:"Priority",fieldTimeout:"Timeout (ms)",labelEnabled:"Enabled",failOpenLabel:"Fail-open (allow on timeout)",fieldToolFilter:"Tool filter (regex, optional)",dryRunResultTitle:"Dry-run result",dryRunDecision:"Decision: ",dryRunReason:"Reason: ",dryRunOutput:"Output: ",dryRunButton:"Dry Run",prevStep:"Previous",nextStep:"Next",saveChanges:"Save Changes",createRule:"Create Rule",noRules:"No hook rules yet",noRulesHint:'Click "New Rule" in the top-right corner to create your first hook',batchDeleteConfirm:"Delete {{n}} selected rules?",selectedItems:"{{n}} selected",enableAll:"Enable all",disableAll:"Disable all",colName:"Name",colEvents:"Events",colType:"Type",colStatus:"Status",colActions:"Actions",clickToDisable:"Click to disable",clickToEnable:"Click to enable",actionEdit:"Edit",deleteRuleConfirm:'Delete rule "{{name}}"?',statTotal:"Total rules"},YT={pending:"Waiting",thinking:"Thinking",action:"Action",result:"Result",running:"Running",error:"Error",completed:"Completed",params:"Parameters"},ZT={linesTotal:"… ({{n}} lines total)",expandAll:"Expand all ({{n}} lines)",collapse:"Collapse"},QT={quickCommands:"Quick Commands",search:'Search: "{{filter}}"',help:"↑↓ Select · Enter Execute · Esc Close",backend:"Backend",backendCommand:"Backend command",chat_desc:"Switch to chat panel",chat_result:"Switched to chat panel",terminal_desc:"Switch to terminal panel",terminal_result:"Switched to terminal panel",files_desc:"Switch to file panel",files_result:"Switched to file panel",models_desc:"Switch to model panel",models_result:"Switched to model panel",tools_desc:"List available tools",tools_result:"Switched to tool panel",skills_desc:"List available skills",skills_result:"Switched to skills panel",settings_desc:"Switch to settings panel",settings_result:"Switched to settings panel",logs_desc:"Switch to logs panel",logs_result:"Switched to logs panel",new_desc:"Create new session",new_result:"New session created",clear_desc:"Clear current session messages",clear_result:"Messages cleared",theme_desc:"Toggle theme (dark/light/auto)",theme_error:"Usage: /theme <dark|light|auto|{{presets}}>",theme_result:"Theme switched to ",theme_preset_result:"Theme preset switched to ",theme_preset_unavailable:"Theme preset switching not available",toggle_terminal_desc:"Toggle terminal panel display",toggle_terminal_result:"Terminal panel toggled",logs_clear_desc:"Clear logs",logs_clear_result:"Logs cleared",doctor_desc:"System diagnostics (Config/API Key/Network/Docker/Disk)",compact_desc:"Compact current session context",help_desc:"Show all quick commands",token_desc:"Show token usage and API cost statistics",review_desc:"Code review — check correctness, security, and code quality",security_review_desc:"Security review — OWASP Top 10 + command injection/path traversal/privilege escalation",memory_desc:"Manage AI persistent memory (list/add/delete/clear)",ps_desc:"View and manage background tasks, sub-agents, and shell processes",model_desc:"View or switch AI models",status_desc:"Show current session status (session ID/message count/model/working directory)",config_desc:"Manage application configuration (get/set/list/delete)",exit_desc:"Exit application",exit_result:"Shutting down...",benchmark_desc:"Run DeepSeekCode capability benchmark (simple/medium/complex/full/list)",goal_desc:"Set a goal for multi-step work",goal_list_desc:"List active goals",goal_status_desc:"Show goal progress",workflow_list_desc:"List workflow runs",workflow_status_desc:"Show workflow status",workflow_checkpoints_desc:"List workflow checkpoints",mcp_desc:"List or reload MCP servers",sessions_desc:"List sessions",resume_desc:"Resume a session by id",permissions_desc:"Show permission rules and pending approvals",init_desc:"Generate agent.md project guidance file",self_test_desc:"Run tool capability self-test and generate a report",context_desc:"Show context analysis report",version_desc:"Show version information","check-update_desc":"Check for available updates",upgrade_desc:"Upgrade to the latest version",acceptance_desc:"Run or inspect acceptance workflows (quick/full/list/report)",diff_desc:"View uncommitted git changes in the workspace",summary_desc:"Summarize the current session conversation",effort_desc:"Show or set reasoning effort level (low|medium|high)",export_desc:"Export the current conversation as JSON",rename_desc:"Rename the current session",hooks_desc:"Show active hook configurations",cost_desc:"Show estimated session cost and duration",sent_command:"Command sent: ",noActiveSession:"No active session",unknownCommand:"Unknown command {{cmd}} — type /help to see available commands"},XT={pageError:"Page error",unknownError:"An unknown error occurred, please try refreshing the page",refreshPage:"Refresh page",genEnded:"Generation ended (tool execution timeout or connection lost)"},JT={backendConnected:"Backend connected",backendDisconnected:"Backend disconnected, reconnecting...",paused:"Paused, press ESC again to stop",terminated:"Stopped (ESC×2)",contextCompressed:"Context compressed: {{original}} → {{compressed}} messages, saved {{saved}} tokens",errorPrefix:"❌ Error: {{error}}",uncaughtError:"Uncaught error: ",uncaughtRejection:"Uncaught Promise rejection: ",unknownReason:"Unknown reason",diagnosing:"⏳ Diagnosing...",runDiagnostic:"🔍 Run Diagnostic",inspectorOn:"Enable inspector (Ctrl+Shift+Alt+C)",inspectorOff:"Disable inspector"},eN={title:"Channel Management",subtitle:"Connect external IM platforms to interact with AI via WeChat, Feishu, DingTalk, etc.",newChannel:"New Channel",editChannel:"Edit Channel",table:{name:"Channel Name",type:"Type",appId:"App ID",status:"Status",enabled:"Enabled",actions:"Actions",emptyHint:'Click "New Channel" in the top right to connect WeChat, Feishu or DingTalk'},status:{connected:"Connected",disconnected:"Disconnected",connecting:"Connecting",error:"Error"},empty:"No channels configured yet",emptyHint:'Click "New Channel" to add an IM platform bot',form:{basicInfo:"Basic Info",name:"Channel Name",namePlaceholder:"e.g. Office Group Bot",type:"Channel Type",credentials:"Credentials",appId:"App ID",appIdPlaceholder:"Enter App ID",appSecret:"App Secret",appSecretPlaceholder:"Enter App Secret",token:"Token",tokenPlaceholder:"Enter Bot Token",encodingAESKey:"EncodingAESKey",encodingAESKeyPlaceholder:"WeChat only, optional",enabled:"Enable Channel",wechatQrHint:"Save first, then scan QR code to login",feishuWsHint:"Feishu uses WebSocket to receive messages automatically",namePlaceholderDev:"e.g. Dev Group Bot",typeLocked:"Channel type cannot be changed after creation",leaveBlankUnchanged:"Leave blank to keep unchanged",leaveBlankMeansUnchanged:"Leave blank to keep unchanged",appSecretValue:"App secret",tokenCallback:"Callback verification token",optionalShort:"Optional",encodingAesOptional:"Optional, message encryption/decryption key",wechatIlinkHint:"The WeChat iLink bot authorizes via QR scan; credentials can be left empty — just save and scan to log in.",wechatIlinkHintList:'The WeChat iLink bot authorizes via QR scan; credentials can be left empty — after saving, click "QR Login" in the list.',enabledOffHint:"Sending and receiving messages stops when disabled"},actions:{scanQr:"Scan QR",edit:"Edit",delete:"Delete",deleteConfirm:"Are you sure you want to delete this channel?",test:"Test Connection",save:"Save Channel",cancel:"Cancel",refresh:"Refresh",qrLogin:"QR Login",deleteConfirmNamed:'Delete channel "{{name}}"?',deleteConfirmShort:"Delete this channel?"},errors:{loadFailed:"Failed to load channels",createFailed:"Failed to create channel",updateFailed:"Failed to update channel",deleteFailed:"Failed to delete channel",notFound:"Channel not found",notImplemented:"Not implemented",nameRequired:"Channel name is required"},qr:{title:"WeChat QR Login",generating:"Generating QR code...",waiting:"Scan the QR code with WeChat",scanned:"Scanned, please confirm on your phone",confirmed:"Login successful",expired:"QR code expired",expiredHint:"Click retry to generate a new QR code",error:"Failed to get QR code",openInNewTab:"Open in new tab"},typeLabels:{wechat:"WeChat",feishu:"Feishu",dingtalk:"DingTalk",telegram:"Telegram",discord:"Discord",slack:"Slack",signal:"Signal",whatsapp:"WhatsApp",line:"LINE",qqbot:"QQ Bot",matrix:"Matrix",mattermost:"Mattermost",msteams:"Teams",googlechat:"Google Chat",irc:"IRC"},viewSubtitle:"Connect WeChat, Feishu and DingTalk so users can send tasks via channels and receive progress and results in real time",experimentalLabel:"Experimental",experimentalShort:"Exp",experimentalTip:"Experimental implementation, features may be incomplete",experimentalDesc:"This channel is a basic adapter wrapper supporting basic message send/receive; some advanced features may be incomplete",pluginMissingLabel:"Plugin missing",pluginMissingTip:"The plugin for this channel type is not installed or activated; instances cannot start",pluginMissingWarning:'The plugin for this channel type is not installed or activated, so instances cannot start. Go to the "Plugins" page, install and activate the{{name}}plugin, then retry.',selectTypeHint:"Select a channel type on the left",instancesCount:"{{n}} configured instances",notConfiguredYet:"Not configured yet",createInstance:"New Instance",createShort:"New",selectInstance:"Select Instance",emptyWithType:"No {{type}} configured yet",wechatBindHint:"Click the button below and scan the QR code with WeChat to bind automatically",startWithCreate:'Click "New Instance" above to start configuration',scanToBind:"Scan to Bind",qrLoginReauth:"QR Login / Re-authorize",editConfig:"Edit Config",createConfig:"New Config",save:"Save",saving:"Saving...",unknownError:"Unknown error",retry:"Retry",bindSuccess:"Bound successfully",bindTitle:"Scan to Bind · {{name}}",startUsing:"Start Using",clickToRefresh:"Click to refresh",connectedReady:'"{{name}}" is connected and ready to use',createdConnectedReady:"WeChat channel created and connected, ready to use",waitingAuthorize:"Scan the QR code with WeChat to authorize the bot",scannedConfirming:"Scanned, please confirm on your phone...",confirmedClosing:"Bot authorized and started, closing automatically soon",connectingIlink:"Connecting to iLink service...",openInNewTabFallback:"Open in new tab (fallback)",toastReauthSuccess:'WeChat "{{name}}" re-authorized successfully, channel connected',toastBindSuccess:"WeChat bound successfully, channel created and connected automatically",pollFailedRefresh:"Too many polling failures, please refresh the QR code and retry",pollFailedToast:"Failed to poll WeChat binding status, please refresh the QR code and retry",qrDataMissing:"QR code data missing: {{data}}",fetchWechatQrFailed:"Failed to get WeChat QR code: {{error}}",sidebar:{title:"Channels",configuredCount:"{{n}} configured",clickToConfigure:"Click a channel below to start configuration",configuredMissing:"Configured · plugin missing",unconfigured:"Not configured",partialConnected:"{{connected}}/{{count}} connected",waitingPlugin:"Waiting for plugin installation"},categories:{im:"Instant Messaging",international:"International",eastAsia:"East Asia",collaboration:"Collaboration Platforms",classic:"Classic Protocols",other:"Others",builtin:"Built-in",plugins:"Plugin Extensions"}},tN={stageUploaded:"Pending",stageParsing:"Parsing data file",stageMapping:"Template mapping",stageRendering:"Generating file",stageComplete:"File processing complete",stageError:"File processing failed",parsing:"Parsing {{file}}…",parsedSummary:"{{rows}} rows · {{fields}} fields",mappingTitle:"Template ↔ data field mapping",templatePlaceholder:"Template placeholder",dataField:"Data field",mappingMore:"{{n}} more mappings",rendering:"Generating {{current}}/{{total}}…",download:"Download",downloadFailed:"Download failed",error:"Processing failed",roleData:"Data file",roleTemplate:"Template file",attach:"Upload files or images (multi-select supported)",dropHint:"Drop to add attachments",unsupportedType:"Unsupported file type: {{name}}",fileTooLarge:"File too large: {{name}} (≤50MB)",duplicateFile:"Duplicate file: {{name}}",maxAttachments:"Up to {{n}} files at a time",uploadFailed:"Upload failed",stillUploading:"Attachments are still uploading, please wait…",importFailed:"Import files failed"},nN={reconnecting:"Reconnecting {{attempt}}/{{max}}",hint:"Reconnecting to backend…"},sN={title:"Full access (auto-approve) is on",desc:"The agent can edit files and run commands without confirmation. Risk of data loss.",dismiss:"Dismiss for now",neverShow:"Don't show again"},aN={panelTitle:"Environment & Changes",noRepo:"Not a Git repo",notGitDesc:"The current working directory is not a Git repository; change stats are unavailable.",refresh:"Refresh",changes:"Changes",clean:"Working tree clean",branch:"Branch",upstream:"Ahead of upstream",commit:"Commit",push:"Push",commitConfirm:"Commit",commitPlaceholder:"Commit message (drafted by agent, editable)…",commitSuccess:"Committed",commitFailed:"Commit failed",pushSuccess:"Pushed",pushFailed:"Push failed",checkoutSuccess:"Switched to {{branch}}",checkoutFailed:"Checkout failed",prReady:"PR checks passing",prUnavailable:"Pull request status unavailable (no remote)",prLoading:"Loading PR status…",environment:"Environment",ok:"Done",loading:"Loading…",emptyCommitMsg:"Please enter a commit message"},iN={retry:"Retry",details:"Details",modelSettings:"Model settings"},rN={comingSoon:"Coming soon"},oN={lspGroup:"Language Servers (LSP)",mcpGroup:"MCP Servers",notInstalled:"Not installed",installed:"Installed",ready:"Ready",connecting:"Connecting",installing:"Installing…",error:"Error",disabled:"Disabled",toolCount:"{{count}} tools",docs:"Docs",official:"Official",cloud:"Cloud",local:"Local",needCredentials:"This connector needs credentials to start:",connect:"Connect",missing:"missing",envConfigured:"credentials set",searchPlaceholder:"Search connectors (name, id, description)…",all:"All",noResults:"No connectors match your search/filter.",custom:"Custom",addCustom:"Add custom",customTitle:"Add custom MCP server (from awesome-mcp-servers or your own)",customName:"Name (id)",customCommand:"Command",customArgs:"Args (space separated)",customEnv:"Env (KEY=value, comma separated)",customUrl:"MCP endpoint URL",customHeaders:"Headers (KEY=value, comma separated)",customLocal:"Local command",customFormRequired:"Name and command/URL are required.",removeCustom:"Remove this custom connector",add:"Add"},lN={justNow:"just now",minutesAgo:"{{count}}m ago",hoursAgo:"{{count}}h ago",daysAgo:"{{count}}d ago"},cN={title:"Voice input (English: whisper / Chinese: FunASR)",stopTitle:"Stop recording and transcribe",langToggle:"Switch recognition language: English (whisper) / Chinese (FunASR)",noSpeech:"No speech detected, please try again",backendMissing:"STT service not ready — opened settings to guide installation",setup:{title:"Voice Service",envCard:"Environment check",envChecking:"Checking…",recheck:"Re-check",pythonOk:"Python {{version}} ready",pythonMissing:"Python not detected. Please install Python 3.10+ first",pythonGuide:"Download Python",pipOk:"pip available",pipMissing:"pip is missing. Install pip first, then install the speech engine",pipGuide:"Run the command below to repair pip (see get-pip.py docs if it fails):",whisperTitle:"Whisper · English",whisperDesc:"English speech recognition",funasrTitle:"FunASR · Chinese",funasrDesc:"Chinese speech recognition",installed:"Installed",notInstalled:"Not installed",install:"Install",installing:"Installing…",cancel:"Cancel install",installDone:"Install complete — voice input is ready",installFailed:"Install failed",installTimeout:"Install timed out",installCancelled:"Install cancelled",jobInProgress:"An install task is already running, taking over its progress",manualCommand:"Manual install command",copyCommand:"Copy",copySuccess:"Copied to clipboard",copyFailed:"Copy failed",torchHint:"Chinese engine requires torch — large download, please wait",logWaiting:"Preparing install…",chooseHint:"Environment ready — pick an engine above to install",defaultEngine:"Default recognition engine",defaultEngineHint:"Choose the default engine for voice input. You can switch anytime in the chat input.",inUse:"In use",engineNotInstalledHint:"This engine is not installed yet. Recording will guide you to install it."}},uN={verb:{researching:"Analyzing code",coding:"Editing code",validating:"Running checks",summarizing:"Wrapping up"},title:{withFile:"{{verb}} {{file}}",withCount:"{{verb}} · {{count}} items"},evidenceMore:"+ {{count}} more",toolCallCount:"{{count}} tool calls",toolNamesMore:"+{{count}} more tools",waitingUser:"Waiting for your answer",blocked:"Blocked: {{reason}}",paused:"Paused — resumable",viewAndAnswer:"View & answer",evidence:"Execution details",phase:{analysis:"Analysis",implementation:"Implement",optimization:"Optimize"}},dN={next:"Next",idle:"Idle"},fN={title:"Scheduled Automations",refresh:"Refresh",new:"New",namePlaceholder:"Name (e.g. summarize Git status every morning at 9)",instructionsPlaceholder:"Instructions (what the agent executes on each trigger)",cronPlaceholder:"cron (5 fields, e.g. 0 9 * * *)",create:"Create",cronDaily9:"Daily at 9:00",cronWeekday9:"Weekdays at 9:00",cronEvery30Min:"Every 30 minutes",empty:"No scheduled automations yet. Create one to let the agent work unattended.",enable:"Enable",disable:"Disable",runNow:"Trigger manually",delete:"Delete",historyTitle:"Run History",noRuns:"No runs recorded yet",permissionsTitle:"Scoped allow rules (tool target)",permissionsEmpty:"None. Write operations not allowed here require manual approval and are auto-rejected after timeout.",permissionPlaceholder:"e.g. write_file docs/report.md",add:"Add"},pN="Context capacity",mN="System prompt",hN="System tools",gN="MCP tools",yN="Skills",bN="Messages",vN="Other",xN="Category breakdown",SN="In backend context assembly order (top→bottom): system prompt → system tools → MCP tools → skills → messages → other (estimated gap)",kN="By assembly order ↓",wN="Avg cache hit rate",CN="×10K",_N="×100M",TN="Token distribution",NN="User messages",EN="Assistant messages",AN="Tool requests",jN="Tool results",RN="⚠️ Duplicate reads: {{pct}}%",MN="{{pct}}% kept",ON="Last compact: {{orig}}→{{comp}} · {{saved}} tok",BN="Cache hit {{hit}} / miss {{miss}} ({{calls}} calls)",DN="Run in progress — waiting for provider cache stats",LN="No cache stats yet (provider did not report prompt_cache_hit/miss fields)",zN="View context capacity details",UN="Template library",IN="Save as template",$N="Selected {{n}}",HN="↑↓ Select · Enter insert (multi-select) · Esc close",PN="Searching files...",FN="No matching files",GN="{{n}} files selected",qN="Enter to insert · multi-select supported",WN="Done",VN="Other (I'll explain)",KN="Proceed",YN="Don't pick a specific option — continue with your best judgment",ZN="Enter a custom answer",QN="(continue directly)",XN="(custom)",JN="Type your answer...",eE="Submit",tE="✓ Answered",nE="(not answered)",sE="(no input)",aE="Batch confirmation",iE="Please answer",rE="Pending",oE="⏱ Auto-continue with the recommended option in {{seconds}}s if unanswered",lE="Review answers",cE="Not answered",uE='{{count}} question(s) unanswered — they will be recorded as "Not answered". Click a question number above to go back and edit.',dE="Submit all answers",fE="Back to edit",pE="Previous",mE="Next",hE="Review & submit",gE="Finish question ({{count}} selected)",yE="Confirm this question",bE="Enter to submit, Shift+Enter for newline",vE='Click options to check them, then click "Finish question" to submit; "Proceed" means continue by AI judgment',xE='Click options to check them, then click "Submit selected" to submit; "Proceed" means continue by AI judgment',SE='Click an option to answer and move on, or click "Confirm this question" to submit the highlighted option',kE="Submit selected ({{count}})",wE="Submitting...",CE='Click an option to submit immediately, or click "Submit" below to confirm the current option',_E="Collapse drawer to view messages",TE="Expand drawer to make a choice",NE="Open ›",EE="Scheduled tasks (e.g. nightly test-data runs) will be managed here.",AE="Manage plugins. Enable or disable extensions such as file-processing skills.",jE="Feature under development…",RE="Text",ME="{{done}}/{{total}} rows",OE="{{n}} rows failed",BE="+{{n}} rows",DE={title:"Files",searchPlaceholder:"Search...",refresh:"Refresh",collapse:"Collapse",uploadTo:"Upload to {{dir}}",uploadToRoot:"Upload to workspace root",setUploadDirHint:"Click to set as upload directory and expand",download:"Download",close:"Close",modified:"Modified",saving:"Saving...",save:"Save",saved:"File saved",saveFail:"Save failed",readFail:"Failed to read file",downloadFail:"Download failed",downloadStarted:"Download started",uploadedCount:"Uploaded {{count}} files",uploadFailedCount:"Failed to upload {{count}} files",selectFileHint:"Select a file to preview or edit"},LE={title:"Logs",backendLogs:"Backend Logs",streamTab:"Live Stream",files:"Log Files",clear:"Clear",refresh:"Refresh",refreshing:"Refreshing...",noLogs:"No live logs",noFiles:"No log files",preview:"Preview",download:"Download",backToList:"Back to file list",emptyFile:"(empty file)",totalLines:"{{count}} lines",showingLatest:"(showing latest {{count}} lines)"},zE="Search sessions...",UE="Search sessions",IE="Clear session search",$E={installedTab:"Installed ({{count}})",availableTab:"Available ({{count}})",searchPlaceholder:"Search plugins (name / id / description / tags)",clear:"Clear",allCategories:"All",marketFilterAll:"All sources",marketFilterBuiltin:"Built-in",prevPage:"Prev",nextPage:"Next",pageInfo:"Page {{page}} / {{pages}} · {{count}} items",noMatch:"No matching plugins",emptyInstalled:'No plugins yet — install from the market on the "Available" tab',emptyMarket:"No plugins available in the market",applyProviderTitle:"Write the plugin's provider preset into ProviderConfigStore (user-authorized)",activate:"Activate",deactivate:"Deactivate",uninstall:"Uninstall",installActivate:"Install & Activate",installOnly:"Install only",uninstallTitle:"Uninstall Plugin",uninstallConfirm:"Uninstall {{id}}? Plugin files will be deleted (except bundled)."},HE="ZH",PE={starterTitle:"New template",starterNodeTitle:"Task",starterNodeDesc:"Describe the task",sourceSaved:"Distilled",sourceScript:"Script",sourceHandwritten:"Handwritten",roleExplore:"Explore",rolePlan:"Plan",roleExecute:"Execute",roleVerify:"Verify",roleSummarize:"Summarize",roleGeneric:"Generic",noNodes:"This template has no nodes yet.",filterAll:"All",noMatchTemplates:"No matching templates",emptyTemplates:"No templates yet. Save a dynamic workflow run as a template, or draft one with AI.",aiPromptRequired:"Description cannot be empty",aiDraftFailed:"AI drafting failed. Please try again or write the JSON manually.",nameRequired:"Template name cannot be empty",jsonParseFailed:"Failed to parse JSON: {{error}}",invalidDefinition:"definition must be a WorkflowDefinition containing a nodes array",createFailed:"Failed to create template",loadFailed:"Failed to load template",uncategorized:"Other",savedVersion:"Saved (v{{version}})",saveFailed:"Failed to save",renderFailed:"Render failed",selectTemplateHint:"Select a template on the left to view or edit",selectTemplateHintSub:"Built-in presets work out of the box; you can also save a workflow run as a template to reuse it later.",loading:"Loading…",deleteTemplate:"Delete template",categoryLabel:"Category (category)",descriptionLabel:"Description (description)",nodeCount:"{{n}} nodes",topologyHint:"Topology: serial / parallel dependencies",inputCount:"{{n}} input parameters",workflowNodes:"Workflow nodes",sortedByDeps:"Sorted by dependency topology",launchWithTemplate:"New session from template",testRun:"Test run",versionHistory:"Version history",advancedJson:"Advanced (JSON)",refresh:"Refresh",inputsSchemaLabel:"inputs (parameter schema, JSON) — saving changes bumps the version",definitionLabel:"definition (WorkflowDefinition, JSON)",saveChanges:"Save changes",versionSnapshotLabel:"Immutable version snapshots (versions/{v}.json)",noVersions:"No versions yet",viewingVersion:"Currently viewing",libraryTitle:"Template library",newTemplate:"New template",newShort:"New",searchPlaceholder:"Search templates…",paramCount:"{{n}} params",viewing:"Viewing",view:"View",launchModalTitle:'New session from "{{name}}"',previewModalTitle:'Test run "{{name}}"',launch:"Launch",renderPreview:"Render preview",renderSuccess:"Rendered successfully — the resulting definition can be launched directly",nameLabel:"Name *",namePlaceholder:"e.g. Triage Inbox",categoryField:"Category",descriptionField:"Description",aiDraftTab:"Draft with AI",manualJsonTab:"Write JSON manually",aiPromptLabel:"Describe in one sentence what you want (the AI will break it down into role-based workflow nodes)",aiPromptPlaceholder:"e.g. Review the current repo's code for security/performance/correctness and produce a graded report, read-only throughout",aiWorking:"AI is breaking down the task…",generateWorkflow:"Generate workflow",aiTimeHint:"Takes about 30–60s (reasoning models may take longer); you can tweak the result manually afterwards",newInputsLabel:"inputs (parameter schema, JSON; referenced via <<input:name>>)",inputsExamplePlaceholder:'[{ "name": "folder", "label": "Folder", "type": "folder", "required": true }]',cancel:"Cancel",create:"Create",deleteConfirm:'Delete template "{{name}}"? This action cannot be undone.',delete:"Delete",typeString:"Text",typeNumber:"Number",typeSelect:"Select",typeBoolean:"Toggle",typeFolder:"Folder",typeConnector:"Connector",noInputsNeeded:"This template needs no parameters — start directly.",starting:"Starting…",requiredError:"Required",numberError:"Please enter a number",selectNone:"(none)",newSession:"New session",newFromTemplateTitle:"New from template",chooseTemplateAria:"Choose a template to start a session",backToList:"Back to template list",startSessionHeader:"Start a session",directChat:"Direct chat",directChatHint:"No template — the AI breaks down the task on the fly (dynamic workflow)",loadingTemplates:"Loading templates…",noTemplatesYet:"No saved templates yet.",libraryMenu:"Template library…"},FE={autoFollowOn:"Follow output: on",autoFollowOff:"Follow output: off"},GE={title:"Testing & Observability",evalIntro:"Run capability evaluation tests to verify that system features work correctly.",running:"Running...",evalTriggered:"{{label}} triggered. Check the conversation for results.",evalQuickDesc:"Acceptance checks (no LLM required)",evalFullDesc:"Real LLM calls (slow)",evalListDesc:"List all evaluation tasks",historyTitle:"Run History",refresh:"Refresh"},qE={taskBoard:{title:"Task Board"},card:{collapse:"Collapse",expand:"Expand",auto:"Auto",unpin:"Unpin",pinKeep:"Pin (won't auto-hide)",pin:"Pin",close:"Close this widget"},workflow:{fallbackTitle:"Workflow",statusRunning:"Running",statusCompleted:"Done",statusFailed:"Failed",statusSkipped:"Skipped",statusBlocked:"Waiting",statusPending:"Pending",resume:"Resume",pause:"Pause",cancel:"Cancel"},agentFlow:{statusRunning:"Running",statusCompleted:"Done",statusFailed:"Failed",statusIdle:"Idle",moreAgents:"+{{count}} agents",eventLog:"Event log ({{count}})"},plan:{title:"AI Plan",fallbackTitle:"Workflow plan",stepCount:"{{count}} steps",moreSteps:"+{{count}} steps",start:"Start execution",change:"Change flow",changeHint:"Discard this plan and rephrase your request",cancelTitle:"Cancel workflow",cancel:"Cancel"}},eb={common:zT,nav:UT,chat:IT,shortcuts:$T,palette:HT,a11y:PT,plan:FT,settings:GT,models:qT,tools:WT,skills:VT,hook:KT,step:YT,toolCall:ZT,slashCommands:QT,error:XT,toast:JT,channels:eN,fileJob:tN,reconnect:nN,autoAccess:sN,git:aN,errorCard:iN,placeholder:rN,connectors:oN,time:lN,stt:cN,activity:uN,taskbar:dN,automation:fN,contextCapacity:pN,ctxSystemPrompt:mN,ctxSystemTools:hN,ctxMcpTools:gN,ctxSkills:yN,ctxMessages:bN,ctxOther:vN,categoryBreakdown:xN,assemblyOrderHint:SN,byAssemblyOrder:kN,avgCacheHitRate:wN,unitWan:CN,unitYi:_N,tokenDistribution:TN,distUserMessages:NN,distAssistantMessages:EN,distToolRequest:AN,distToolResult:jN,duplicateReads:RN,keepPercent:MN,lastCompactInfo:ON,cacheHitTitle:BN,cacheWaitingRun:DN,cacheNoStats:LN,viewContextDetail:zN,templateLibrary:UN,saveAsTemplate:IN,selectedCountShort:$N,fileMentionHelpMulti:HN,searchingFiles:PN,noMatchingFiles:FN,selectedFilesCount:GN,enterInsertMulti:qN,finishMention:WN,askOtherLabel:VN,askProceedLabel:KN,askProceedDesc:YN,askCustomDesc:ZN,askDirectTag:QN,askCustomTag:XN,askAnswerPlaceholder:JN,askSubmit:eE,askAnswered:tE,askUnansweredValue:nE,askEmptyInputValue:sE,askBatchTitle:aE,askSingleTitle:iE,askPendingBadge:rE,askAutoContinue:oE,askReviewTitle:lE,askNotAnswered:cE,askUnansweredWarning:uE,askSubmitAll:dE,askBackToEdit:fE,askPrevQuestion:pE,askNextQuestion:mE,askViewSubmit:hE,askFinishQuestion:gE,askConfirmQuestion:yE,askEnterHint:bE,askMultiHintBatch:vE,askMultiHintSingle:xE,askSingleHintBatch:SE,askSubmitSelected:kE,askSubmitting:wE,askSingleHintSingle:CE,drawerCollapseTitle:_E,drawerExpandTitle:TE,openFile:NE,placeholderScheduledDesc:EE,placeholderPluginsDesc:AE,featureInProgress:jE,kindText:RE,rowsDone:ME,rowsFailed:OE,moreRows:BE,fileTree:DE,logs:LE,searchSessionsPlaceholder:zE,searchSessions:UE,clearSessionSearch:IE,plugins:$E,langZh:HE,templates:PE,terminal:FE,testing:GE,widgets:qE},WE=qa.getState().language||"zh-CN";Lt.use(nk).init({resources:{"zh-CN":{translation:Jy,hook:Jy.hook},en:{translation:eb,hook:eb.hook}},lng:WE,fallbackLng:"zh-CN",interpolation:{escapeValue:!1}});qa.subscribe((a,t)=>{a.language!==t.language&&Lt.changeLanguage(a.language)});function Rf(a){let t=null;if(typeof a=="string")try{const s=JSON.parse(a);s&&typeof s=="object"&&!Array.isArray(s)&&(t=s)}catch{return}else a&&typeof a=="object"&&!Array.isArray(a)&&(t=a);if(t)return t.filePath||t.path||t.file||t.file_path}const iv=/(?:^|\s|\/|\\)(test|tests|lint|build|tsc|vitest|jest|pytest|typecheck|check)(?:\s|\.|"|'|`|$)/i,rv=/bash|shell|run|exec|terminal|command/i,VE=/read|grep|glob|search|list|find|open|view|web_search|fetch/i;function Mf(a){return a.some(t=>Yi(t.name))?"coding":a.some(t=>rv.test(t.name))&&a.some(t=>{const s=typeof t.args=="string"?t.args:JSON.stringify(t.args??"");return iv.test(s)})?"validating":a.some(t=>VE.test(t.name))?"researching":"summarizing"}function Of(a){return a.some(t=>Yi(t.name))?"implementation":a.some(t=>rv.test(t.name))&&a.some(t=>{const s=typeof t.args=="string"?t.args:JSON.stringify(t.args??"");return iv.test(s)})?"optimization":"analysis"}function Bf(a){return Lt.t(`activity.verb.${a}`)}function ov(a){const t=a.replace(/\\/g,"/");return t.slice(t.lastIndexOf("/")+1)||a}function lv(a,t){const s=Bf(a);for(const i of t){const o=Rf(i.args);if(o)return Lt.t("activity.title.withFile",{verb:s,file:ov(o)})}return t.length>1?Lt.t("activity.title.withCount",{verb:s,count:t.length}):s}const KE=1500,YE=3,ZE=3,tb=24;let Jl=!1,ga=[],pc=0,Fa=null;function Df(){return pc>=ZE}function nb(){Fa==null||Fa.abort(),Fa=null;const a=ga;ga=[],Jl=!1,pc=0;for(const t of a)t.resolve(null)}function QE(a){const t=a.replace(/[\r\n]+/g," ").replace(/^["'「『]+|["'」』。.,,、]+$/g,"").trim();return t?t.length>tb?`${t.slice(0,tb-1)}…`:t:null}async function XE(a){var i,o,c;const t=new AbortController;Fa=t;const s=setTimeout(()=>t.abort(),KE);try{const u=[`行为类型: ${a.kind}`,a.files.length>0?`涉及文件: ${a.files.map(ov).join(", ")}`:"",`工具调用数: ${a.toolCount}`].filter(Boolean).join(`
56
- `),d=await fetch("/v1/chat/completions",{method:"POST",headers:{"content-type":"application/json"},signal:t.signal,body:JSON.stringify({messages:[{role:"system",content:"你是标题生成器。根据给定的行为类型、涉及文件和工具数,生成一句不超过 16 字的中文活动标题(动词开头,不要标点结尾,不要引号)。只输出标题本身。"},{role:"user",content:u}],max_tokens:60,temperature:.3,stream:!1})});if(!d.ok)return null;const g=(c=(o=(i=(await d.json()).choices)==null?void 0:i[0])==null?void 0:o.message)==null?void 0:c.content;return typeof g=="string"?QE(g):null}catch{return null}finally{clearTimeout(s),Fa===t&&(Fa=null)}}async function cv(){if(Jl)return;const a=ga.shift();if(a){Jl=!0;try{const t=await XE(a.req);t?(pc=0,a.resolve(t)):(pc+=1,a.resolve(null))}finally{if(Jl=!1,ga.length>0&&!Df())cv();else if(Df()){const t=ga;ga=[];for(const s of t)s.resolve(null)}}}}function JE(a){return Df()||ga.length>=YE?Promise.resolve(null):new Promise(t=>{ga.push({req:a,resolve:t}),cv()})}const eA=new Set(["content","thinking","tool_call","tool_result"]),tA=/api ?key|unauthorized|401|no such file|not found|eacces|permission denied|file (?:does not exist|not exist)|missing (?:api key|file|dependency)|command not found|is not a function|ENOENT/i;function nA(a){return tA.test(a)?"blocked":"failed"}const sA=6;function aA(a,t){const s=a[a.length-1];if(!s)return!1;const i=Yi(s.name),o=/bash|shell|run|exec|terminal/i.test(t);return i&&o||!i&&o&&Yi(t)}class iA{constructor(){Fe(this,"sessions",new Map)}session(t){let s=this.sessions.get(t);return s||(s={messageId:null,batch:null,lastBlockIndex:Number.NEGATIVE_INFINITY,seq:0},this.sessions.set(t,s)),s}currentMessageId(t){const s=this.session(t);if(s.messageId)return s.messageId;const i=Ce.getState().messagesBySession[t]||[],o=i[i.length-1];return(o==null?void 0:o.id)??null}resetSession(t){this.sessions.delete(t),en.getState().resetSession(t)}onWsEvent(t,s,i,o){if(!(o&&eA.has(s)))switch(s){case"start":this.onStart(t);break;case"thinking":this.onThinking(t,i);break;case"content":this.onContent(t);break;case"tool_call":this.onToolCall(t,i);break;case"tool_result":this.onToolResult(t,i);break;case"turn_summary":this.onTurnSummary(t,i);break;case"ask_user_question":case"hook_ask":this.onWaitingUser(t);break;case"generation_paused":en.getState().markStatus(t,["running","waiting_user"],"paused");break;case"generation_resumed":en.getState().markStatus(t,["paused"],"running");break;case"error":this.finalizeAll(t,"failed"),nb();break;case"complete":this.finalizeAll(t,"completed"),nb();break}}onStart(t){const s=this.session(t),i=Ce.getState().messagesBySession[t]||[],o=i[i.length-1];s.messageId=(o==null?void 0:o.id)??null,s.batch=null,s.seq=0,s.lastBlockIndex=Number.NEGATIVE_INFINITY}onThinking(t,s){const i=this.session(t);if(!i.batch||i.batch.toolCallIds.length===0){this.advanceBlockIndex(i,s);return}const o=this.parseIndex(s);typeof o=="number"&&o>i.lastBlockIndex&&this.sealBatch(i.batch),this.advanceBlockIndex(i,s)}onContent(t){const s=this.session(t);s.batch&&this.sealBatch(s.batch)}onToolCall(t,s){const i=this.session(t),o=this.parseObj(s);if(!o)return;const c=typeof o.id=="string"?o.id:void 0,u=typeof o.index=="number"?o.index:void 0,d=typeof o.name=="string"?o.name:"Unknown",p=o.args??o.arguments??"",g=this.currentMessageId(t)??`session:${t}`;let y=i.batch;if(!y||y.messageId!==g||y.sealed){y&&!y.sealed&&y.toolCallIds.length>0&&this.finalizeBatch(t,y,y.hadError?this.errorStatus(y):"completed"),i.seq+=1;const E=`${g}:act:${i.seq}`,A=Mf([{name:d,args:p}]),B=Of([{name:d,args:p}]),M=Date.now(),j=u??(i.lastBlockIndex===Number.NEGATIVE_INFINITY?0:i.lastBlockIndex+1);y={sessionId:t,messageId:g,activityId:E,kind:A,phase:B,tools:[],toolCallIds:[],toolIndexByKey:new Map,pending:new Set,hadError:!1,blockRange:[j,j],startedAt:M,sealed:!1},i.batch=y,en.getState().applyEvent(t,{type:"activity_started",activity:{id:E,sessionId:t,messageId:g,kind:A,phase:B,status:"running",title:Bf(A),titleSource:"rule",toolCallIds:[],blockRange:y.blockRange,startedAt:M}})}if(!y.sealed&&y.toolCallIds.length>=sA&&aA(y.tools,d)){this.finalizeBatch(t,y,y.hadError?"failed":"completed"),i.batch=null,this.onToolCall(t,s);return}const b=u!==void 0?`idx:${u}`:c??null;if(b!==null&&y.toolIndexByKey.has(b)){const E=y.toolIndexByKey.get(b),A=y.tools[E];let B=!1;A&&(A.name==="Unknown"&&d!=="Unknown"&&(A.name=d,B=!0),!A.args&&p&&(A.args=p,B=!0));const M=y.toolCallIds[E];c&&M&&M.startsWith("tc-")&&(y.toolCallIds[E]=c,y.pending.delete(M),y.pending.add(c),B=!0),B&&en.getState().applyEvent(t,{type:"activity_updated",activityId:y.activityId,patch:{toolCallIds:[...y.toolCallIds]}});return}const x={name:d,args:p};y.tools.push(x),b!==null&&y.toolIndexByKey.set(b,y.tools.length-1);const S=c??`tc-${y.toolCallIds.length}-${y.activityId}`;y.toolCallIds.push(S),y.pending.add(S),u!==void 0&&(y.blockRange=[Math.min(y.blockRange[0],u),Math.max(y.blockRange[1],u)],i.lastBlockIndex=Math.max(i.lastBlockIndex,u));const k=Mf(y.tools),C=Of(y.tools),T=en.getState();if(T.applyEvent(t,{type:"activity_updated",activityId:y.activityId,patch:{kind:k,phase:C,toolCallIds:[...y.toolCallIds],...k!==y.kind?{title:Bf(k)}:{}}}),y.kind=k,y.phase=C,Yi(d)){const E=Rf(p);E&&T.applyEvent(t,{type:"artifact_produced",artifact:{id:`${y.activityId}:${E}`,path:E,action:"modified",activityId:y.activityId}})}}onToolResult(t,s){const i=this.session(t);if(!i.batch)return;const o=this.parseObj(s);if(!o)return;const c=i.batch,u=typeof o.id=="string"?o.id:void 0,d=typeof o.index=="number"?o.index:void 0;if(!(u!==void 0&&c.toolCallIds.includes(u)||u===void 0&&d!==void 0&&d>=c.blockRange[0]&&d<=c.blockRange[1]))return;if(u!==void 0)c.pending.delete(u);else{const b=[...c.pending][0];b&&c.pending.delete(b)}const g=o.result;typeof g=="string"&&g.startsWith("Error:")&&(c.hadError=!0,c.lastError=String(g).slice(0,200)),c.sealed&&c.pending.size===0&&this.finalizeBatch(t,c,c.hadError?"failed":"completed")}onTurnSummary(t,s){const i=this.parseObj(s);if(!i)return;const o=typeof i.headline=="string"?i.headline:void 0;if(!o)return;const c=this.currentMessageId(t);c&&en.getState().applyEvent(t,{type:"task_title_set",messageId:c,title:o})}onWaitingUser(t){const s=en.getState(),i=s.bySession[t];if(i)for(let o=i.order.length-1;o>=0;o--){const c=i.order[o];if(!c)continue;const u=i.activities[c];if(u&&u.status==="running"){s.applyEvent(t,{type:"activity_updated",activityId:u.id,patch:{status:"waiting_user"}});return}}}finalizeAll(t,s){const i=this.session(t);i.batch&&(this.finalizeBatch(t,i.batch,i.batch.hadError?this.errorStatus(i.batch):s),i.batch=null),en.getState().finalizeSession(t,s)}errorStatus(t){return t.lastError?nA(t.lastError):"failed"}sealBatch(t){!t||t.sealed||(t.sealed=!0,this.finalizeBatch(t.sessionId,t,t.hadError?this.errorStatus(t):"completed"))}finalizeBatch(t,s,i){if(!s)return;const o=en.getState(),c=s.kind,u=s.tools,d=lv(c,u);if(o.applyEvent(t,{type:"activity_finalized",activityId:s.activityId,status:i,endedAt:Date.now()}),o.applyEvent(t,{type:"activity_updated",activityId:s.activityId,patch:{title:d,titleSource:"inferred",...(i==="failed"||i==="blocked")&&s.lastError?{blockedReason:s.lastError}:{}}}),i==="completed"&&u.length>=2){const p=u.map(g=>Rf(g.args)).filter(g=>typeof g=="string");JE({kind:c,files:p,toolCount:u.length}).then(g=>{g&&en.getState().applyEvent(t,{type:"activity_updated",activityId:s.activityId,patch:{title:g,titleSource:"llm"}})})}}parseObj(t){if(t&&typeof t=="object"&&!Array.isArray(t))return t;if(typeof t=="string")try{const s=JSON.parse(t);return s&&typeof s=="object"&&!Array.isArray(s)?s:null}catch{return null}return null}parseIndex(t){const s=this.parseObj(t),i=s==null?void 0:s.index;return typeof i=="number"?i:void 0}advanceBlockIndex(t,s){const i=this.parseIndex(s);typeof i=="number"&&(t.lastBlockIndex=Math.max(t.lastBlockIndex,i))}}const rA=new iA;function tR(a,t){const s=[];for(const u of t.thinkingBlocks??[])s.push({index:u.index,kind:"thinking"});for(const u of t.toolCalls??[])s.push({index:u.index??Number.MAX_SAFE_INTEGER,kind:"tool",tc:u});s.sort((u,d)=>u.index-d.index);const i=[];let o=[];for(const u of s)u.kind==="thinking"?o.length>0&&(i.push(o),o=[]):u.tc&&o.push(u.tc);if(o.length>0&&i.push(o),i.length===0)return[];const c=t.timestamp??Date.now();return i.map((u,d)=>{const p=Mf(u),g=u.map(C=>C.index??Number.MAX_SAFE_INTEGER),y=Math.min(...g),b=Math.max(...g),x=u.some(C=>C.status==="error"),S=Math.min(...u.map(C=>C.timestamp),c),k=Math.max(...u.map(C=>C.timestamp+(C.duration??0)*1e3),c);return{id:`${t.id}:act:${d+1}`,sessionId:a,messageId:t.id,kind:p,phase:Of(u),status:x?"failed":"completed",title:lv(p,u),titleSource:"inferred",toolCallIds:u.map(C=>C.id),blockRange:y===Number.MAX_SAFE_INTEGER?[d,d]:[y,b===Number.MAX_SAFE_INTEGER?y:b],startedAt:S,endedAt:k}})}function oA(a){const t=a.toLowerCase();let s="unknown";return t.includes("401")||t.includes("unauthorized")||t.includes("invalid api key")||/api ?key.*invalid/.test(t)?s="auth":t.includes("429")||t.includes("rate limit")||t.includes("quota")||t.includes("insufficient_quota")?s="rate_limit":t.includes("timeout")||t.includes("timed out")||t.includes("timedout")?s="timeout":t.includes("network")||t.includes("econnrefused")||t.includes("fetch failed")||t.includes("socket")||t.includes("websocket")?s="network":t.includes("tool")||t.includes("bash")||t.includes("command failed")?s="tool":(t.includes("model")||t.includes("api")||t.includes("provider")||t.includes("response"))&&(s="model"),{id:`error-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,category:s,summary:lA(a,s),detail:a,retryable:s!=="auth",timestamp:Date.now()}}function lA(a,t){const s={auth:"API Key 无效或已失效(401 Unauthorized)",rate_limit:"请求频率超限或配额不足(429)",timeout:"请求超时",network:"网络连接异常",tool:"工具执行失败",model:"模型调用失败",unknown:"发生未知错误"},i=(a.split(`
57
- `)[0]||"").trim().slice(0,120);return i?`${s[t]}: ${i}`:s[t]}function cA(a,t,s,i){var c,u;const o=Ce.getState();if(!(i&&(a==="content"||a==="thinking"||a==="tool_call"||a==="tool_result"))){switch(a){case"start":o.startGeneration(s),o.addMessage(s,{id:ns(),type:"assistant",content:"",timestamp:Date.now()}),Te.getState().touchSession(s);break;case"content":{let d=String(t||"");try{const g=JSON.parse(t);d=g.text||g.content||d}catch{}const p=d.replace(/\[FINISH\]/g,"");p&&o.appendToLastMessage(s,p)}break;case"thinking":{let d=String(t||""),p;try{const g=JSON.parse(t);d=g.text||g.content||d,p=typeof g.index=="number"?g.index:void 0}catch{}d&&o.appendToLastMessageThinking(s,d,p)}break;case"tool_call":try{const d=JSON.parse(t||"{}"),p=d.id||ns(),g=typeof d.index=="number"?d.index:void 0,y=d.args||d.arguments||"",b=o.messagesBySession[s]||[],x=b[b.length-1],S=[...((c=x==null?void 0:x.steps)==null?void 0:c.flatMap(C=>C.toolCalls||[]))||[],...(x==null?void 0:x.toolCalls)||[]],k=S.find(C=>g!==void 0&&C.index===g||C.id===p);if(k)o.updateToolCall(s,k.id??p,{args:y,...p&&k.id&&k.id!==p?{id:p}:{}});else if(g===void 0&&d.name){const C=S.filter(E=>E.name===d.name&&E.status==="running"),T=C[C.length-1];T?o.updateToolCall(s,T.id,{args:y,...p&&T.id!==p?{id:p}:{}}):o.addToolCall(s,{id:p,index:g,name:d.name||"Unknown",args:y,status:"running",timestamp:Date.now()})}else o.addToolCall(s,{id:p,index:g,name:d.name||"Unknown",args:y,status:"running",timestamp:Date.now()})}catch(d){console.warn("Failed to parse tool call",String(d))}break;case"tool_result":try{const d=JSON.parse(t||"{}"),g=Ce.getState().messagesBySession[s]||[],y=[];for(const C of g){const T=C.steps||[];for(const E of T)E.toolCalls&&y.push(...E.toolCalls);C.toolCalls&&y.push(...C.toolCalls)}const b=d.toolName,x=d.id,S=typeof d.index=="number"?d.index:void 0;let k;if(x&&(k=y.find(C=>C.id===x)),!k&&S!==void 0&&(k=y.find(C=>C.index===S&&C.name===b)),!k){const C=y.filter(T=>T.name===b&&T.status==="running");C.sort((T,E)=>(T.timestamp||0)-(E.timestamp||0)),k=C[0]}if(!k){const C=y.filter(T=>T.name===b&&T.status==="error"&&T.result==="生成已结束(工具执行超时或连接中断)");C.sort((T,E)=>(E.timestamp||0)-(T.timestamp||0)),k=C[0]}if(k){const C=Math.floor((Date.now()-(k.timestamp||Date.now()))/1e3),T=typeof d.result=="string"&&d.result.startsWith("Error:");o.updateToolCall(s,k.id,{status:T?"error":"completed",result:d.result,duration:C,...d.diff!==void 0?{diff:String(d.diff)}:{},...d.noTruncate===!0?{noTruncate:!0}:{}})}}catch(d){console.warn("Failed to parse tool result",String(d))}break;case"tool_diff":try{const d=JSON.parse(t||"{}"),g=Ce.getState().messagesBySession[s]||[],y=[];for(const S of g){const k=S.steps||[];for(const C of k)C.toolCalls&&y.push(...C.toolCalls);S.toolCalls&&y.push(...S.toolCalls)}const b=y.filter(S=>S.name===d.toolName&&S.status==="running");b.sort((S,k)=>(S.timestamp||0)-(k.timestamp||0));const x=b[0];x&&typeof d.diff=="string"&&o.updateToolCall(s,x.id,{diff:d.diff})}catch(d){console.warn("Failed to parse tool diff",String(d))}break;case"turn_summary":{try{const d=JSON.parse(t||"{}"),p={};if(d.toolCounts&&typeof d.toolCounts=="object"&&!Array.isArray(d.toolCounts))for(const[g,y]of Object.entries(d.toolCounts)){const b=Number(y);Number.isFinite(b)&&b>0&&(p[g]=b)}o.setTurnSummary(s,{thoughtMs:Number(d.thoughtMs??d.durationMs??0)||0,durationMs:Number(d.durationMs??d.thoughtMs??0)||0,toolCounts:p,...typeof d.headline=="string"&&d.headline?{headline:d.headline}:{}})}catch(d){console.warn("Failed to parse turn_summary",String(d))}break}case"web_search":try{const d=JSON.parse(t||"{}"),p=d.callId||`web-search-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,g=typeof d.index=="number"?d.index:void 0,y=d.status==="searching"||d.status==="in_progress",b=d.status==="failed",x=o.messagesBySession[s]||[],S=x[x.length-1],C=[...((u=S==null?void 0:S.steps)==null?void 0:u.flatMap(T=>T.toolCalls||[]))||[],...(S==null?void 0:S.toolCalls)||[]].find(T=>T.id===p||g!==void 0&&T.index===g&&T.name==="web_search");C?y||o.updateToolCall(s,C.id,{status:b?"error":"completed",result:b?"❌ 联网搜索失败":d.searchUrl?`✅ 搜索完成:${d.searchUrl}`:"✅ 搜索完成"}):o.addToolCall(s,{id:p,index:g,name:"web_search",args:"{}",status:y?"running":"completed",result:y?void 0:b?"❌ 联网搜索失败":d.searchUrl?`✅ 搜索完成:${d.searchUrl}`:"✅ 搜索完成",timestamp:Date.now()})}catch(d){console.warn("Failed to parse web_search",String(d))}break;case"cache_stats":try{const d=JSON.parse(t||"{}");De.getState().setCacheStats({cacheHitTokens:Number(d.cacheHitTokens)||0,cacheMissTokens:Number(d.cacheMissTokens)||0,cacheHitRate:d.cacheHitRate!==void 0?Number(d.cacheHitRate):void 0,cacheStatsCalls:Number(d.cacheStatsCalls)||0})}catch(d){console.warn("Failed to parse cache_stats",String(d))}break;case"complete":o.endGeneration(s);{const d=Ce.getState().messagesBySession[s]||[];d.length>0&&De.getState().recalculateFromMessages(d)}Te.getState().touchSession(s);break;case"generation_paused":o.pauseGeneration(s);break;case"generation_resumed":o.resumeGeneration(s);break;case"compaction_progress":try{const d=JSON.parse(t||"{}");De.getState().setCompactionProgress({stage:d.stage||"",percent:d.percent||0,message:d.message||""})}catch(d){console.error("Failed to parse compaction_progress:",d)}break;case"context_compressed":try{const d=JSON.parse(t||"{}"),p=`Context compressed: ${d.originalCount} -> ${d.compressedCount} msgs, freed ${d.tokensSaved} tokens`;o.appendToLastMessage(s,`
58
-
59
- ---
60
- ${p}
61
-
62
- `),_e.info(p,5e3),De.getState().setCompacting({originalCount:d.originalCount||0,compressedCount:d.compressedCount||0,tokensSaved:d.tokensSaved||0}),De.getState().setCompactionProgress(null)}catch(d){console.error("Failed to parse context_compressed:",d)}break;case"error":{o.endGeneration(s);const d=typeof t=="string"?t:String(t||"Error occurred"),p=oA(d),g=o.messagesBySession[s]||[],y=g[g.length-1];y&&y.type==="assistant"&&!y.errorCard?o.attachErrorCard(s,p):o.addMessage(s,{id:ns(),type:"assistant",content:"",timestamp:Date.now(),errorCard:p}),Te.getState().touchSession(s);break}case"context_analysis":try{const d=JSON.parse(t||"{}");d&&d.total!==void 0&&De.getState().setContextDistribution(d)}catch(d){console.error("Failed to parse context_analysis:",d)}break;case"threshold_warning":try{const d=JSON.parse(t||"{}");De.getState().setThresholdWarning(d);const p=d.percentLeft!==void 0?d.percentLeft:0;p<=5?console.warn(`Context nearly full (${p}% remaining)`):p<=15&&console.info(`Context running low (${p}% remaining)`)}catch(d){console.error("Failed to parse threshold_warning:",d)}break;case"blocking_limit":try{const d=JSON.parse(t||"{}");De.getState().setThresholdWarning(d),console.error(d.message||"Context blocked")}catch(d){console.error("Failed to parse blocking_limit:",d)}break;case"context_blocked":try{const d=JSON.parse(t||"{}");De.getState().setThresholdWarning(d),console.error(d.message||"Context is full — generation blocked")}catch(d){console.error("Failed to parse context_blocked:",d)}break;case"tool_retry":try{const d=JSON.parse(t||"{}");De.getState().setRetryState({active:d.attempt<(d.maxRetries||3),attempt:d.attempt||0,maxRetries:d.maxRetries||3,errorCategory:d.errorCategory||"unknown",toolName:d.toolName})}catch(d){console.error("Failed to parse tool_retry:",d)}break;case"model_fallback":try{const d=JSON.parse(t||"{}");console.warn(`Model fallback: ${d.fromModel||"?"} → ${d.toModel||"?"}`)}catch(d){console.error("Failed to parse model_fallback:",d)}break;case"tombstone":try{const p=JSON.parse(t||"{}").messageIds||[];p.length>0&&o.applyTombstone(s,p)}catch(d){console.warn("Failed to parse tombstone",String(d))}break;case"stall_detected":try{const d=JSON.parse(t||"{}"),p=d.attempt||0,g=d.maxRetries||3,y=d.reason||"no response from model";d.recovering?_e.warning(`⚠ Generation stalled (${y}) — retrying ${p}/${g}`,8e3):_e.error(`⚠ Generation stalled (${y}) — giving up`,1e4)}catch(d){console.warn("Failed to parse stall_detected",String(d))}break}rA.onWsEvent(s,a,t,i)}}const Zf=Ut()((a,t)=>({backendCommands:[],loaded:!1,setBackendCommands:s=>{a({backendCommands:s,loaded:!0})},getAllCommands:()=>t().backendCommands}));async function uA(a="",t){try{let s=`${a}/api/commands`;t&&(s+=`?lang=${encodeURIComponent(t)}`);const i=await fetch(s);if(!i.ok)return[];const o=await i.json(),c=Array.isArray(o==null?void 0:o.data)?o.data:[];return Zf.getState().setBackendCommands(c),c}catch{return[]}}function Zd(a,t,s,i,o){var c,u,d;switch(a){case"token_update":try{const g=typeof t=="string"?JSON.parse(t):t||{};if(g.source==="workflow"){De.getState().addWorkflowTokens(Number(g.workflowNodeTokens)||0);break}g.totalTokens>0&&De.getState().updateUsage({promptTokens:g.promptTokens||0,completionTokens:g.completionTokens||0,totalTokens:g.totalTokens||0});const y=g.promptCacheHitTokens??g.prompt_cache_hit_tokens,b=g.promptCacheMissTokens??g.prompt_cache_miss_tokens;(y!==void 0||b!==void 0)&&De.getState().accumulateCacheStats(Number(y)||0,Number(b)||0),g.model&&De.getState().setModel(g.model)}catch{}break;case"context_breakdown":try{const g=typeof t=="string"?JSON.parse(t):t||{};De.getState().setContextBreakdown({systemPromptTokens:Number(g.systemPromptTokens)||0,messagesTokens:Number(g.messagesTokens)||0,toolContentTokens:Number(g.toolContentTokens)||0,toolDefTokens:Number(g.toolDefTokens)||0,mcpToolTokens:Number(g.mcpToolTokens)||0,skillTokens:Number(g.skillTokens)||0,dynamicTokens:Number(g.dynamicTokens)||0,total:Number(g.total)||0})}catch{}break;case"model_name":try{const g=o&&typeof o.model=="string"&&o.model||(typeof t=="string"?t:(t==null?void 0:t.model)||"");g&&De.getState().setModel(g);const y=o&&typeof o.modelRef=="string"&&o.modelRef||(typeof t=="object"&&t!==null&&typeof t.modelRef=="string"?t.modelRef:"");y&&De.getState().setModelRef(y)}catch{}break;case"auth_required":let p=localStorage.getItem("auth_token");p||(p="default-token",localStorage.setItem("auth_token",p)),fe.setToken(p),fe.setAuthenticated(!1),fe.send({type:"auth",token:p});break;case"auth_success":fe.setAuthenticated(!0),fe.send({type:"subscribe_logs"});{const g=qa.getState();uA("",(c=g.language)!=null&&c.startsWith("zh")?"zh":"en");const y=g.workspaceDir;y&&fe.send({type:"workspace",message:y})}break;case"auth_failed":qn.error("Auth failed",String(t));break;case"log":try{const g=typeof t=="string"?JSON.parse(t):t,y={id:`log-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,level:g.level||"info",source:g.source||"System",message:g.message||"",timestamp:g.timestamp||Date.now()};i.setLogs(b=>[...b,y].slice(-500)),i.activeTab!=="logs"&&i.setUnreadLogs(b=>b+1)}catch(g){console.warn("Failed to parse log entry",String(g))}break;case"commands_list":try{const g=JSON.parse(t||"[]");Zf.getState().setBackendCommands(Array.isArray(g)?g:[])}catch(g){console.warn("Failed to parse commands list",String(g))}break;case"command_start":break;case"command_complete":try{const y=((typeof t=="string"?JSON.parse(t):t||{}).result||"").toString();_e.success(y.length>120?y.slice(0,120)+"...":y||"Command completed",4e3)}catch{}break;case"command_error":try{const g=typeof t=="string"?JSON.parse(t):t||{};_e.error((g.error||"Command failed").toString(),6e3)}catch{}break;case"ping":fe.send({type:"pong",data:Date.now().toString()});break;case"workspace_changed":try{const g=JSON.parse(t||"{}");g.newDir&&qa.getState().setWorkspaceDir(g.newDir)}catch{}break;case"degradation_update":try{const g=typeof t=="string"?JSON.parse(t):t||{},y=g.active,b=g.mode||"normal",x=Number(g.retryCount)||0,S=Number(g.maxRetries)||0,k=g.message||"",T={normal:"normal",retrying:"retrying",alternative:"alternative model",degraded:"degraded",verifying:"verifying",verified_fail:"verify failed"}[b]||b;if(De.getState().setDegradation({active:y,retryCount:x,maxRetries:S,mode:b,message:k,label:T}),y){const E=x>0?` (${x}/${S})`:"";_e.warning(k||`API Degraded: ${T}${E}`,8e3),i.setLogs(A=>[...A,{id:`deg-${Date.now()}`,level:"warn",source:"Infrastructure",message:`Degradation: ${T} | ${k||"no details"}`,timestamp:Date.now()}].slice(-500))}else _e.success("API Normal")}catch(g){console.warn("Degradation update parse error",String(g))}break;case"doctor_result":try{const g=typeof t=="string"?JSON.parse(t):t||{},y=g.overallStatus||g.status||"unknown",b=g.healthRate,x=g.issues||[],k={healthy:"healthy",degraded:"degraded",unhealthy:"unhealthy",unknown:"unknown"}[y]||y,C=typeof b=="number"?` (${Math.round(b*100)}%)`:"";if(y==="healthy")_e.success(`Doctor: ${k}${C}`);else if(_e.warning(`Doctor: ${k}${C}`,1e4),x&&x.length>0)for(const T of x)i.setLogs(E=>[...E,{id:`doctor-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,level:"warn",source:"Doctor",message:typeof T=="string"?T:T.message||JSON.stringify(T),timestamp:Date.now()}].slice(-500))}catch(g){console.warn("Doctor result parse error",String(g))}break;case"session_created":{try{const g=typeof t=="string"?JSON.parse(t):t||{};g.id&&(fe.setSessionId(g.id),Te.getState().updateSession(g.id,g))}catch{}typeof t=="string"&&t&&qn.info(`Session event: ${a}`);break}case"session_resumed":{try{const g=typeof t=="string"?JSON.parse(t):t||{};if((u=g.session)!=null&&u.id&&(fe.setSessionId(g.session.id),Te.getState().updateSession(g.session.id,g.session)),g.messages&&Array.isArray(g.messages)){const y=((d=g.session)==null?void 0:d.id)||s;Ce.getState().replaceMessages(y,g.messages.map(S=>({id:S.id||`msg-${S.timestamp||Date.now()}`,type:S.type==="user"?"user":"assistant",content:S.content||"",timestamp:S.timestamp||Date.now(),thinking:S.thinking||void 0})));const b=g.messages.find(S=>S.type==="user"&&!S.deleted),x=typeof(b==null?void 0:b.content)=="string"?b.content.replace(/\s+/g," ").trim():"";Te.getState().touchSession(y,x||void 0)}}catch(g){console.warn("Failed to process session_resumed",String(g))}typeof t=="string"&&t&&qn.info(`Session event: ${a}`);break}case"mcp_update":try{const g=typeof t=="string"?JSON.parse(t):t||{},y=g.server||g.name||"MCP",b=g.action||g.status||"updated";qn.info(`MCP ${y}: ${b}`)}catch{}break}}function nR(a,t){switch(gw(a,t)){case"critical":return{level:"CRITICAL",reasonKey:"risk_critical"};case"high":return{level:"HIGH",reasonKey:/rm\s+-rf|sudo|chmod\s+777|curl.*\|\s*(ba)?sh|wget.*-O|>\/dev\/|mkfs/i.test(t)?"risk_critical_cmd":/write|edit|save|upload|deploy|publish/i.test(a)?"risk_high_file":/install|uninstall|npm|pip|cargo|gem|apt|brew|choco|yum|dnf/i.test(a)?"risk_high_pkg":"risk_high_shell"};case"low":return{level:"LOW",reasonKey:"risk_low"};default:return{level:"MEDIUM",reasonKey:/git|commit|push|merge|rebase/i.test(a)?"risk_git":"risk_network"}}}const sR={CRITICAL:{bg:"bg-red-900/20",border:"border-red-500/40",text:"text-red-400",badge:"bg-red-500/20 text-red-400 border-red-500/30",icon:"🚨"},HIGH:{bg:"bg-orange-900/15",border:"border-orange-500/30",text:"text-orange-400",badge:"bg-orange-500/20 text-orange-400 border-orange-500/30",icon:"⚠️"},MEDIUM:{bg:"bg-yellow-900/10",border:"border-yellow-500/25",text:"text-yellow-400",badge:"bg-yellow-500/15 text-yellow-400 border-yellow-500/25",icon:"📋"},LOW:{bg:"bg-blue-900/10",border:"border-blue-500/25",text:"text-blue-400",badge:"bg-blue-500/15 text-blue-400 border-blue-500/25",icon:"✅"}};function aR(a,t){return yw(a,t)}function dA(a){try{const t=JSON.parse(a),s=t.payload&&typeof t.payload=="object"?t.payload:t,i=s.resolvedPath;if(typeof i=="string"&&i)return i;const o=s.requestedPath;return typeof o=="string"&&o?o:null}catch{return null}}function fA(a,t){try{const s=typeof a=="string"?JSON.parse(a):a||{},i=Ds.getState(),{approvalId:o,toolName:c,askPayload:u,timeoutMs:d,timeoutAction:p}=s,g=dA(String(u||""));if(i.isSessionAllowed(c,g??void 0)){fe.send({type:"hook_allow",data:JSON.stringify({approvalId:o})});return}if(i.autoMode&&c!=="exit_plan_mode"){fe.send({type:"hook_allow",data:JSON.stringify({approvalId:o})});return}Ce.getState().addMessage(t,{id:`hook-approval-${o||Date.now()}`,type:"assistant",content:"",timestamp:Date.now(),hookApproval:{approvalId:o||"",toolName:c||"unknown",askPayload:u||"",status:"pending",timestamp:Date.now(),timeoutMs:typeof d=="number"?d:void 0,timeoutAction:p==="allow"||p==="deny"?p:void 0}}),i.addApproval({approvalId:o||"",toolName:c||"unknown",askPayload:u||"",timestamp:Date.now(),timeoutMs:typeof d=="number"?d:void 0,timeoutAction:p==="allow"||p==="deny"?p:void 0}),window.dispatchEvent(new CustomEvent("hook-approval-required"))}catch{}}function Qd(a,t){try{const s=typeof a=="string"?JSON.parse(a):a||{};typeof s.sessionId=="string"&&s.sessionId&&(t=s.sessionId);const i=Te.getState(),o=Qe.getState(),{action:c,taskId:u,data:d}=s;if(c==="created"&&d){const p={id:u||`task-${Date.now()}`,title:d.title||"",completed:d.status==="COMPLETED",createdAt:Date.parse(d.createdAt)||Date.now(),backendId:u,backendStatus:d.status,description:d.description},g=i.tasksBySession[t]||[];i.setSessionTasks(t,[...g,p]),o.upsertTask(t,{id:p.id,title:p.title,description:p.description,status:is(d.status),source:"task",progress:d.progress!=null?Number(d.progress):void 0,raw:s})}else if((c==="updated"||c==="status_changed")&&d)i.updateTaskPlanStatus(t,u,{backendStatus:d.status,progress:d.progress}),o.upsertTask(t,{id:u,title:d.title||u,description:d.description,status:is(d.status),source:"task",progress:d.progress!=null?Number(d.progress):void 0,raw:s});else if(c==="deleted"){const p=i.tasksBySession[t]||[];i.setSessionTasks(t,p.filter(g=>g.id!==u&&g.backendId!==u))}else if(s&&!c&&(s.id||s.taskId)){const p=String(s.id||s.taskId),g=s,y=String(g.status||"").toUpperCase()==="COMPLETED",b={id:p,title:String(g.title||g.name||p),completed:y,createdAt:Date.parse(g.createdAt)||Date.now(),backendId:p,backendStatus:g.status,description:g.description,progress:g.progress!=null?Number(g.progress):void 0},x=i.getSessionTasks(t);x.some(S=>S.id===p||S.backendId===p)?i.updateTaskPlanStatus(t,p,{backendStatus:g.status,progress:b.progress,completed:y}):i.setSessionTasks(t,[...x,b]),o.upsertTask(t,{id:p,title:b.title,description:b.description,status:is(g.status),source:"task",progress:b.progress,raw:s})}o.recordEvent(t,{type:"task_update",source:"task",title:(d==null?void 0:d.title)||s&&(s.title||s.id||s.taskId)||u||"Task update",message:c||"updated",status:(d==null?void 0:d.status)||(s==null?void 0:s.status),taskId:u||(s==null?void 0:s.id)||(s==null?void 0:s.taskId),data:s})}catch{}}function pA(a,t,s,i){try{const o=JSON.parse(t||"{}"),c=i(s,a,o);if(c){const u=Ce.getState();switch(a){case"step_start":u.updateStep(s,c.id,{title:o.step||c.title,description:o.description||c.description,status:o.status==="start"?"running":o.status||"running"});break;case"step_thinking":u.updateStep(s,c.id,{thought:o.thought});break;case"step_action":u.updateStep(s,c.id,{action:o.action});break;case"step_complete":u.updateStep(s,c.id,{status:o.status??"success",result:o.result});break}}}catch(o){console.warn("Failed to parse "+a,String(o))}}function mA(a,t){var s,i;try{const o=typeof a=="string"?JSON.parse(a):a||{};let c=[];if(Array.isArray(o)?c=o:(s=o.tasks)!=null&&s.length?c=o.tasks:(i=o.items)!=null&&i.length&&(c=o.items),c.length>0&&t){const u=Te.getState(),d=Qe.getState();c.forEach(p=>{const g=p.content||p.title||p.name||"";if(g.trim()){if(!u.getSessionTasks(t).find(k=>k.title===g.trim())&&(u.addSessionTask(t,g.trim()),p.completed||p.status==="completed"||p.status==="COMPLETED"||p.status==="done"||p.activeForm==="completed")){const T=u.getSessionTasks(t).find(E=>E.title===g.trim());T&&u.toggleSessionTask(t,T.id)}const x=String(p.id||p.taskId||g.trim()),S=p.completed||p.status==="completed"||p.status==="COMPLETED"||p.status==="done"||p.activeForm==="completed";d.upsertTask(t,{id:x,title:g.trim(),description:p.description,status:is(p.status,S),source:"todo",raw:p})}}),d.recordEvent(t,{type:"todo_update",source:"todo",title:"Todo list updated",message:`${c.length} items`,status:"updated",data:o})}}catch{}}function hA(a,t){try{const s=typeof a=="string"?JSON.parse(a):a||{},i=s.questionId||"",o=s.question||"";if(!i||!o)return;const c=Array.isArray(s.questions)?s.questions.map(p=>({question:String(p.question||""),header:p.header?String(p.header):void 0,options:Array.isArray(p.options)?p.options:void 0,multiSelect:p.multiSelect===!0})).filter(p=>p.question):[{question:o,header:s.header||void 0,options:Array.isArray(s.options)?s.options:void 0,multiSelect:s.multiSelect===!0}],u=window;u.__answeredQuestionIds=u.__answeredQuestionIds||new Set,u.__pendingQuestions=u.__pendingQuestions||{};const d={questionId:i,question:o,header:s.header||void 0,options:Array.isArray(s.options)?s.options:void 0,multiSelect:s.multiSelect===!0,autoResolutionMs:typeof s.autoResolutionMs=="number"?s.autoResolutionMs:void 0,questions:c,sessionId:t};u.__pendingQuestions[t]=d,u.__pendingQuestion=d,window.dispatchEvent(new CustomEvent("ask-question-required",{detail:t}))}catch{}}function gA(a,t){try{const s=typeof a=="string"?JSON.parse(a):a||{},i=s.title||s.name||"";if(i&&t){const c=Te.getState().getSessionTasks(t).find(u=>u.title===i&&!u.completed);c&&Te.getState().toggleSessionTask(t,c.id),Qe.getState().upsertTask(t,{id:(c==null?void 0:c.id)||i,title:i,status:"completed",source:"todo"}),Qe.getState().recordEvent(t,{type:"todo_item_done",source:"todo",title:i,status:"completed",taskId:(c==null?void 0:c.id)||i,data:s})}}catch{}}function sb(a){if(!a)return null;try{return JSON.parse(a)}catch{return null}}const ab=Ut((a,t)=>({automations:[],runsByAutomation:{},loading:!1,error:null,fetchAutomations:async()=>{const s=await Ge.automations.list();s.success&&s.data?a({automations:s.data}):a({error:s.error||"加载自动化失败"})},createAutomation:async s=>{const i=await Ge.automations.create(s);return i.success&&i.data?(await t().fetchAutomations(),i.data):(a({error:i.error||"创建自动化失败"}),null)},deleteAutomation:async s=>{const i=await Ge.automations.remove(s);return i.success?(await t().fetchAutomations(),!0):(a({error:i.error||"删除失败"}),!1)},toggleAutomation:async(s,i)=>{const o=await Ge.automations.toggle(s,i);o.success?await t().fetchAutomations():a({error:o.error||"切换失败"})},runAutomation:async s=>{const i=await Ge.automations.run(s);i.success?(await t().fetchRuns(s),await t().fetchAutomations()):a({error:i.error||"触发失败"})},fetchRuns:async s=>{const i=await Ge.automations.runs(s);i.success&&i.data&&a(o=>({runsByAutomation:{...o.runsByAutomation,[s]:i.data}}))},onAutomationUpdate:s=>{a(i=>({automations:i.automations.some(c=>c.id===s.id)?i.automations.map(c=>c.id===s.id?s:c):[...i.automations,s]}))},onAutomationRun:s=>{a(i=>({runsByAutomation:{...i.runsByAutomation,[s.automationId]:[s,...i.runsByAutomation[s.automationId]||[]].slice(0,50)}}))}})),ib={automationUpdate:a=>{const t=sb(a);t!=null&&t.automation&&ab.getState().onAutomationUpdate(t.automation)},automationRun:a=>{const t=sb(a);t!=null&&t.run&&ab.getState().onAutomationRun(t.run)}};function yA(a,t,s){let i={};if(t&&typeof t=="object")i=t;else try{i=JSON.parse(String(t||"{}"))}catch{}const o=String(i.jobId||`fjob-${Date.now()}`),c=i.stage||(a==="filejob_result"?"complete":a==="filejob_error"?"error":"uploaded"),u={jobId:o,stage:c,parseProgress:i.parseProgress,parsedFiles:i.parsedFiles,mapping:i.mapping,renderProgress:i.renderProgress,currentRow:i.currentRow,totalRows:i.totalRows,result:i.result,error:i.error,errorDetail:i.errorDetail};i.attachments&&(u.attachments=i.attachments),Ce.getState().setMessageFileJob(s,u)}const bA=Ut((a,t)=>({channels:[],availableTypes:[],loading:!1,error:null,formOpen:!1,editing:null,qrOpen:!1,qrChannel:null,selectedType:null,loadTypes:async()=>{const s=await Ge.channels.types(),i=s.success&&Array.isArray(s.data)?s.data:[];a({availableTypes:i})},load:async()=>{a({loading:!0,error:null});const s=await Ge.channels.list(),i=s.success&&Array.isArray(s.data)?s.data:[];if(a({loading:!1,channels:i,...s.success&&!Array.isArray(s.data)?{error:"服务端返回的频道数据格式异常"}:s.success?{}:{error:s.error??"Failed to load"}}),!t().selectedType&&i.length>0){const c=i[0].type;a({selectedType:c})}},create:async s=>{const i=await Ge.channels.create(s);return i.success?(await t().load(),a({formOpen:!1,editing:null}),!0):(a({error:i.error??"Create failed"}),!1)},update:async(s,i)=>{const o=await Ge.channels.update(s,i);return o.success?(await t().load(),a({formOpen:!1,editing:null}),!0):(a({error:o.error??"Update failed"}),!1)},remove:async s=>{const i=await Ge.channels.delete(s);return i.success?(a(o=>({channels:o.channels.filter(c=>c.id!==s)})),!0):(a({error:i.error??"Delete failed"}),!1)},toggle:async(s,i)=>(await Ge.channels.toggle(s,i)).success?(a(c=>({channels:c.channels.map(u=>u.id===s?{...u,enabled:i}:u)})),!0):(await t().load(),!1),openForm:s=>a({formOpen:!0,editing:s??null,error:null}),closeForm:()=>a({formOpen:!1,editing:null,error:null}),openQr:s=>a({qrOpen:!0,qrChannel:s??null}),closeQr:()=>{a({qrOpen:!1,qrChannel:null}),t().load()},clearError:()=>a({error:null}),selectType:s=>a({selectedType:s,error:null}),updateChannelStatus:s=>{a(i=>({channels:i.channels.map(o=>o.id===s.channelId?{...o,connected:s.connected,_state:s.state}:o)}))}})),vA=["start","content","thinking","tool_call","tool_result","tool_diff","turn_summary","web_search","cache_stats","complete","generation_paused","generation_resumed","error","context_compressed","compaction_progress","tombstone","context_analysis","threshold_warning","blocking_limit","tool_retry","model_fallback","context_blocked","stall_detected"],Lf=(a,t=[])=>{if(!a)return t;if(Array.isArray(a))return a.forEach(o=>Lf(o,t)),t;if(typeof a!="object")return t;const s=a,i=s.content;return typeof i=="string"&&i.trim()&&t.push(i.trim()),Object.entries(s).forEach(([o,c])=>{o!=="content"&&o!=="structuredOutput"&&Lf(c,t)}),t},xA=a=>{const t=Lf(a);return t[t.length-1]||""};function SA({activeTab:a,setLogs:t,setUnreadLogs:s}){const i=Ce,o=_.useCallback(y=>{if(!y)return{};if(typeof y=="object")return y;if(typeof y!="string")return{};try{return JSON.parse(y)}catch{return{}}},[]),c=_.useCallback((y,b,x)=>{const S=o(b),k=Qe.getState(),C=Ce.getState();if(y==="workflow_plan_ready"&&S.planId){k.setPlan(x,{planId:String(S.planId),title:typeof S.title=="string"&&S.title?String(S.title):"工作流计划",reason:typeof S.reason=="string"?String(S.reason):void 0,confirm:S.confirm===!0,nodes:Array.isArray(S.nodes)?S.nodes:void 0,createdAt:Date.now()});return}if(y==="workflow_confirm_ack"){k.clearPlan(x);return}const T=S.runId||"";if(!T)return;if(y==="workflow_error"){k.fail(x,T,S.error||"Workflow failed"),(C.isGenerating(x)||C.isPaused(x))&&C.endGeneration(x,S.error||"Workflow failed");return}const E=y==="workflow_finished"?S.status||"COMPLETED":y==="workflow_started"?S.status||"RUNNING":y==="workflow_paused"?S.status||"PAUSED":y==="workflow_resumed"?S.status||"RESUMING":y==="workflow_cancelled"?S.status||"CANCELLED":y==="workflow_recovered"?S.status||"RUNNING":S.status||void 0,A=S.type||y,B=S.data&&typeof S.data=="object"?S.data:{},M=String(S.kind||B.kind||""),j=S.nodeId||S.node_id||B.nodeId||B.node_id,J=S.role||S.agentRole||S.agent_role||B.role||B.agentRole||B.agent_role,Y=S.phase||S.phaseId||B.phase||B.phaseId,te=S.effectId||B.effectId||j,se=S.toolName||S.tool_name||B.toolName||B.tool_name,ge=S.error||B.error,Ke=["effect.scheduled","effect.completed","effect.failed"].includes(A)&&j&&M!=="tool",de=["effect.scheduled","effect.completed","effect.failed"].includes(A)&&M==="tool"&&(se||j),K=j?k.getAgentsForSession(x).find(ne=>ne.id===String(j)):void 0;if(k.upsert(x,{runId:T,status:E,title:typeof S.title=="string"&&S.title?String(S.title):void 0,completedPhases:Number(S.completedPhases||0),totalPhases:Number(S.totalPhases||0),completedEffects:Number(S.completedEffects||0),totalEffects:Number(S.totalEffects||0),tokensUsed:Number(S.tokensUsed||0),tokensRemaining:Number(S.tokensRemaining||0),lastEventType:A,agentNode:Ke?{nodeId:String(j),role:String(J||(K==null?void 0:K.role)||(K==null?void 0:K.name)||"agent"),phase:Y?String(Y):K==null?void 0:K.phase,status:A==="effect.failed"?"failed":A==="effect.completed"?"completed":"scheduled",tokens:S.tokensUsed!=null?Number(S.tokensUsed):B.tokens!=null&&typeof B.tokens=="number"?Number(B.tokens):void 0,error:ge?String(ge):void 0,updatedAt:Date.now()}:void 0}),de){const ne=A==="effect.failed"?"failed":A==="effect.completed"?"completed":"running",he=String(te||`${T}-${se||j}`);k.upsertTask(x,{id:he,title:String(se||j),description:j?String(j):void 0,status:ne,source:"workflow",runId:T,result:B.artifactRef?String(B.artifactRef):void 0,error:ge?String(ge):void 0,raw:S}),k.recordEvent(x,{type:A,source:"workflow",title:String(se||j),status:ne,runId:T,taskId:he,message:ge?String(ge):void 0,data:S})}if((y==="workflow_started"||y==="workflow_handoff")&&Array.isArray(S.nodes)?k.setNodes(x,T,S.nodes):y==="workflow_node_start"&&j?k.setNodeStatus(x,T,String(j),{status:"running"}):y==="workflow_node_complete"&&j&&k.setNodeStatus(x,T,String(j),{status:String(B.status||S.status||"completed"),result:B.result!=null?String(B.result):void 0,error:ge?String(ge):void 0}),y==="workflow_started")k.clearPlan(x),C.startGeneration(x);else if(y==="workflow_finished"){k.finalizeNodes(x,T,String(E||"COMPLETED"));const ne=xA(S.output);if(ne){const he=C.getMessages(x),L=he[he.length-1];(L==null?void 0:L.type)==="assistant"?C.appendToLastMessage(x,ne):C.addMessage(x,{id:ns(),type:"assistant",content:ne,timestamp:Date.now()})}C.endGeneration(x)}else E==="PAUSED"?C.pauseGeneration(x):(E==="RUNNING"||E==="RESUMING")&&C.resumeGeneration(x)},[o]),u=_.useCallback((y,b)=>{const x=o(y),S=Array.isArray(x.runs)?x.runs:[];if(S.length===0)return;const k=S.slice().sort((A,B)=>String(B.updatedAt||"").localeCompare(String(A.updatedAt||"")))[0],C=String(k.status||"").toUpperCase();if(!C)return;const T=Qe.getState(),E=String(k.runId||"");T.upsert(b,{runId:E,status:C,title:k.workflowId?`workflow: ${String(k.workflowId)}`:void 0,totalPhases:Number(k.totalNodes||0),completedPhases:Number(k.completedNodes||0),lastEventType:"workflow_status",error:k.error?String(k.error):void 0}),["COMPLETED","FAILED","ERROR","CANCELLED","CANCELED","PAUSED"].includes(C)&&T.recordEvent(b,{type:"workflow_status",source:"workflow",title:`Workflow ${C}`,message:k.output?String(k.output).slice(0,200):k.error?String(k.error):void 0,status:C==="COMPLETED"?"completed":"failed",runId:E,data:k})},[o]),d=_.useCallback(y=>{var k;const x=i.getState().messagesBySession[y]||[],S=x[x.length-1];return(k=S==null?void 0:S.steps)==null?void 0:k[S.steps.length-1]},[i]),p=_.useCallback((y,b,x)=>{const S=d(y),k=b==="step_complete",C=S&&(S.status==="success"||S.status==="error");if(!S||C&&!k){const T=(x==null?void 0:x.step)||b.replace("step_","").replace("_"," ");return i.getState().addStep(y,{id:`step-${Date.now()}`,title:T,description:(x==null?void 0:x.description)||"Executing...",status:"running",timestamp:Date.now()}),d(y)}return S},[d,i]),g=_.useCallback(y=>{var k,C;const b=y.type,x=y.data;if(b==="model_name"){Zd(b,x,y.sessionId||"",{activeTab:a,setLogs:t,setUnreadLogs:s},y);return}if(b==="models_updated"||b==="models.updated"){window.dispatchEvent(new CustomEvent("models-updated"));return}if(b==="workspace_changed"){Zd(b,x,y.sessionId||"",{activeTab:a,setLogs:t,setUnreadLogs:s});return}if(b==="question_answer_ack"){const T=o(x),E=T==null?void 0:T.questionId;if(E){const A=window;A.__answeredQuestionIds=A.__answeredQuestionIds||new Set,A.__answeredQuestionIds.add(E);const B=A.__pendingQuestions||{};for(const M of Object.keys(B))((k=B[M])==null?void 0:k.questionId)===E&&delete B[M];((C=A.__pendingQuestion)==null?void 0:C.questionId)===E&&(A.__pendingQuestion=null)}window.dispatchEvent(new CustomEvent("ask-question-dismiss",{detail:T==null?void 0:T.questionId}));return}const S=y.sessionId||"";if(!S){if(b==="task_update"||b==="task_finished"||b==="task_error"){const T=o(x);T&&typeof T.sessionId=="string"&&T.sessionId&&Qd(x,T.sessionId)}return}if(b==="hook_ask"){fA(x,S);return}if(b==="ask_user_question"){hA(x,S);return}if(b==="task_update"){Qd(x,S);return}if(b==="task_output"){try{i.getState().appendToLastMessage(S,String(x||""))}catch{}return}if(b==="task_finished"||b==="task_error"){b==="task_error"?qn.error("Task error",String(x)):Qd(x,S);return}if(b==="filejob_start"||b==="filejob_progress"||b==="filejob_result"||b==="filejob_error"){yA(b,x,S);return}if(b.startsWith("step_")){pA(b,x,S,p);return}if(b.startsWith("plan_")){try{Yd(b,x,S)}catch(T){qn.error(`Failed to handle ${b}`,String(T))}return}if(b.startsWith("goal_")){try{Yd(b,x,S)}catch(T){qn.error(`Failed to handle ${b}`,String(T))}return}if(b==="step_prompt"){try{Yd(b,x,S)}catch(T){qn.error(`Failed to handle ${b}`,String(T))}return}if(b==="todo_update"){mA(x,S);return}if(b==="todo_item_done"){gA(x,S);return}if(b!=="todo_progress"){if(b==="automation.update"){ib.automationUpdate(x);return}if(b==="automation.run"){ib.automationRun(x);return}if(b!=="tool.approval_required"){if(["workflow_started","workflow_event","workflow_progress","workflow_finished","workflow_error","workflow_checkpoint","workflow_node_start","workflow_node_complete","workflow_paused","workflow_resumed","workflow_cancelled","workflow_handoff","workflow_plan_ready","workflow_confirm_ack","workflow_recovered"].includes(b)){c(b,x,S);return}if(b==="workflow_status"){u(x,S);return}if(vA.includes(b)){cA(b,x,S,y.nodeId);return}if(b==="channel_status"){try{const T=JSON.parse(x||"{}");bA.getState().updateChannelStatus(T)}catch{}return}if(b==="channel_message"||b==="channel_error"){try{const T=typeof x=="string"?JSON.parse(x):x||{},E=T.channel||T.platform||"Channel";if(b==="channel_error")_e.error(`${E}: ${T.error||T.message||"channel error"}`);else{const A=T.from||T.sender||"",B=T.text||T.content||T.message||"";B&&_e.info(`📨 ${E}${A?` · ${A}`:""}: ${String(B).slice(0,120)}`)}}catch{}return}if(b==="session_switched"){try{const T=typeof x=="string"?JSON.parse(x):x||{},E=T.id||T.sessionId||(typeof x=="string"?x:"");E&&Te.getState().setActiveSession(String(E))}catch{}return}if(b==="task_interrupted"){try{const T=typeof x=="string"?JSON.parse(x):x||{},E=T.title||T.taskId||"Task";_e.warning(`⏸ ${E} interrupted — 使用 /continue 恢复生成`,1e4)}catch{_e.warning("A running task was interrupted",1e4)}return}if(b==="code_review_ready"){try{const T=typeof x=="string"?JSON.parse(x):x||{},E=T.title||T.skillId||"Code Review",A=T.summary||"";_e.success(`🔍 ${E} ready${A?`: ${String(A).slice(0,120)}`:""}`,8e3)}catch{_e.success("🔍 Code review ready",8e3)}return}if(b==="hook_auto_ack"){try{const T=typeof x=="string"?JSON.parse(x):x||{};_e.info(`Hook auto-approved: ${T.tool||T.name||"tool"}`,4e3)}catch{}return}if(b==="throttle"){try{const T=typeof x=="string"?JSON.parse(x):x||{},E=T.limit||T.remaining!=null?` (${T.remaining} left)`:"";_e.warning(`⚠ Rate limited${E}`,6e3)}catch{}return}if(["token_update","context_breakdown","auth_required","auth_success","auth_failed","log","commands_list","ping","degradation_update","doctor_result","session_created","session_resumed","mcp_update","hook_response_ack"].includes(b)){Zd(b,x,S,{activeTab:a,setLogs:t,setUnreadLogs:s});return}}}},[a,p,c,u,o,t,s]);_.useEffect(()=>{fe.connect();const y=fe.onMessage(g),b=fe.onClose(()=>{const S=Ce.getState();for(const k of S.generatingSessions)S.endGeneration(k,"WebSocket disconnected")}),x=fe.onOpen(()=>{var k;const S=((k=fe.getSessionId)==null?void 0:k.call(fe))||Te.getState().activeSessionId;if(S){fe.send({type:"get_workflow_status",sessionId:S,data:JSON.stringify({sessionId:S})});const C=Pi.getState().mode;fe.send({type:"plan_mode_change",sessionId:S,data:JSON.stringify({mode:C})})}});return()=>{y(),b(),x()}},[g])}const fo={linear:{id:"linear",nameKey:"settings.themePresetLinear",descriptionKey:"settings.themePresetLinearDesc",dark:{bg:"#0a0a0c",surface:"#121215",border:"#26262b",text:"#e4e4e7",muted:"#8e8e96",accentBlue:"#7c83f8",accentGreen:"#4ade80",accentRed:"#f87171",accentYellow:"#fbbf24",accentPurple:"#c084fc"},light:{bg:"#ffffff",surface:"#f6f6f7",border:"#e4e4e8",text:"#18181b",muted:"#71717a",accentBlue:"#5e6ad2",accentGreen:"#16a34a",accentRed:"#dc2626",accentYellow:"#b45309",accentPurple:"#7c3aed"}},mimo:{id:"mimo",nameKey:"settings.themePresetMimo",descriptionKey:"settings.themePresetMimoDesc",dark:{bg:"#fcfaf8",surface:"#f6f1ea",border:"#e7dfd5",text:"#26251e",muted:"#5a574f",accentBlue:"#26251e",accentGreen:"#1f7a4d",accentRed:"#b84f42",accentYellow:"#a16b2d",accentPurple:"#7a5c8f"},light:{bg:"#ffffff",surface:"#f8f4ef",border:"#e2d8cd",text:"#24221c",muted:"#605b52",accentBlue:"#26251e",accentGreen:"#1f7a4d",accentRed:"#b84f42",accentYellow:"#a16b2d",accentPurple:"#7a5c8f"}},github:{id:"github",nameKey:"settings.themePresetGithub",descriptionKey:"settings.themePresetGithubDesc",dark:{bg:"#0d1117",surface:"#161b22",border:"#30363d",text:"#c9d1d9",muted:"#8b949e",accentBlue:"#58a6ff",accentGreen:"#238636",accentRed:"#f85149",accentYellow:"#d29922",accentPurple:"#a855f7"},light:{bg:"#ffffff",surface:"#f6f8fa",border:"#d0d7de",text:"#24292f",muted:"#57606a",accentBlue:"#0969da",accentGreen:"#1a7f37",accentRed:"#cf222e",accentYellow:"#9a6700",accentPurple:"#8250df"}},cherry:{id:"cherry",nameKey:"settings.themePresetCherry",descriptionKey:"settings.themePresetCherryDesc",dark:{bg:"#0f1419",surface:"#1a2332",border:"#2d3f50",text:"#e1e8ed",muted:"#8899aa",accentBlue:"#01a9ff",accentGreen:"#00c853",accentRed:"#ff5252",accentYellow:"#ffab00",accentPurple:"#7c4dff"},light:{bg:"#f5f9ff",surface:"#ffffff",border:"#cce0ff",text:"#1a2332",muted:"#5c6f87",accentBlue:"#0160ff",accentGreen:"#00a844",accentRed:"#e53935",accentYellow:"#f9a825",accentPurple:"#651fff"}},ocean:{id:"ocean",nameKey:"settings.themePresetOcean",descriptionKey:"settings.themePresetOceanDesc",dark:{bg:"#0b1e2e",surface:"#122b3d",border:"#1e4057",text:"#d4e6f5",muted:"#7a9bb5",accentBlue:"#00bcd4",accentGreen:"#26a69a",accentRed:"#ef5350",accentYellow:"#ffca28",accentPurple:"#ab47bc"},light:{bg:"#edf7fc",surface:"#ffffff",border:"#b3d9e8",text:"#0b1e2e",muted:"#4f7a94",accentBlue:"#00838f",accentGreen:"#00897b",accentRed:"#d32f2f",accentYellow:"#f57f17",accentPurple:"#8e24aa"}},mint:{id:"mint",nameKey:"settings.themePresetMint",descriptionKey:"settings.themePresetMintDesc",dark:{bg:"#0d1f1c",surface:"#162d28",border:"#264b41",text:"#d1f0e8",muted:"#7dafa3",accentBlue:"#26c6da",accentGreen:"#66bb6a",accentRed:"#ef5350",accentYellow:"#ffd54f",accentPurple:"#ad8aff"},light:{bg:"#edf7f4",surface:"#ffffff",border:"#b8d9cf",text:"#0d1f1c",muted:"#4a7f72",accentBlue:"#0097a7",accentGreen:"#388e3c",accentRed:"#d32f2f",accentYellow:"#f9a825",accentPurple:"#7c4dff"}},lavender:{id:"lavender",nameKey:"settings.themePresetLavender",descriptionKey:"settings.themePresetLavenderDesc",dark:{bg:"#1a1428",surface:"#261f38",border:"#3c3354",text:"#e2daf2",muted:"#9387b5",accentBlue:"#86bef5",accentGreen:"#81c784",accentRed:"#ef9a9a",accentYellow:"#ffe082",accentPurple:"#ce93d8"},light:{bg:"#f5f0ff",surface:"#ffffff",border:"#d4c8e8",text:"#1a1428",muted:"#6c5b8a",accentBlue:"#1565c0",accentGreen:"#2e7d32",accentRed:"#c62828",accentYellow:"#f57f17",accentPurple:"#7b1fa2"}},midnight:{id:"midnight",nameKey:"settings.themePresetMidnight",descriptionKey:"settings.themePresetMidnightDesc",dark:{bg:"#0a0e1a",surface:"#111726",border:"#1e2740",text:"#c8d2e8",muted:"#6a7596",accentBlue:"#4fc3f7",accentGreen:"#4caf50",accentRed:"#e57373",accentYellow:"#ffd54f",accentPurple:"#b39ddb"},light:{bg:"#eef1f7",surface:"#ffffff",border:"#c0c9dc",text:"#0a0e1a",muted:"#4f5a78",accentBlue:"#0288d1",accentGreen:"#2e7d32",accentRed:"#d32f2f",accentYellow:"#f57f17",accentPurple:"#5e35b1"}},sunset:{id:"sunset",nameKey:"settings.themePresetSunset",descriptionKey:"settings.themePresetSunsetDesc",dark:{bg:"#1e1410",surface:"#2a1d16",border:"#443124",text:"#f0dfcf",muted:"#b8957a",accentBlue:"#5fa5e8",accentGreen:"#81c784",accentRed:"#ff7043",accentYellow:"#ffb74d",accentPurple:"#e0a0e0"},light:{bg:"#fff6f0",surface:"#ffffff",border:"#f0d5c0",text:"#2a1d16",muted:"#8a6e5a",accentBlue:"#1976d2",accentGreen:"#388e3c",accentRed:"#e64a19",accentYellow:"#ef6c00",accentPurple:"#8e24aa"}},forest:{id:"forest",nameKey:"settings.themePresetForest",descriptionKey:"settings.themePresetForestDesc",dark:{bg:"#0e1a12",surface:"#172a1d",border:"#2a4733",text:"#d1e8d6",muted:"#7da684",accentBlue:"#5bb8e8",accentGreen:"#66bb6a",accentRed:"#ef9a9a",accentYellow:"#e6c35c",accentPurple:"#ae8ad9"},light:{bg:"#f0f7f0",surface:"#ffffff",border:"#b8d9be",text:"#0e1a12",muted:"#477a50",accentBlue:"#1565c0",accentGreen:"#2e7d32",accentRed:"#c62828",accentYellow:"#827717",accentPurple:"#6a1b9a"}},candy:{id:"candy",nameKey:"settings.themePresetCandy",descriptionKey:"settings.themePresetCandyDesc",dark:{bg:"#16101a",surface:"#22182a",border:"#3d284a",text:"#f0def5",muted:"#b28dc2",accentBlue:"#5fc3f5",accentGreen:"#81e080",accentRed:"#ff6b6b",accentYellow:"#ffd93d",accentPurple:"#e066ff"},light:{bg:"#faf0ff",surface:"#ffffff",border:"#e0cce8",text:"#1a0a24",muted:"#7a5c8a",accentBlue:"#1976d2",accentGreen:"#388e3c",accentRed:"#d32f2f",accentYellow:"#f9a825",accentPurple:"#8e24aa"}},nord:{id:"nord",nameKey:"settings.themePresetNord",descriptionKey:"settings.themePresetNordDesc",dark:{bg:"#2e3440",surface:"#3b4252",border:"#4c566a",text:"#eceff4",muted:"#81a1c1",accentBlue:"#88c0d0",accentGreen:"#a3be8c",accentRed:"#bf616a",accentYellow:"#ebcb8b",accentPurple:"#b48ead"},light:{bg:"#f5f7fa",surface:"#ffffff",border:"#d8dee9",text:"#2e3440",muted:"#5e6d85",accentBlue:"#5e81ac",accentGreen:"#6f9e6f",accentRed:"#bf616a",accentYellow:"#b48d56",accentPurple:"#8f6f9e"}}},zf="linear";function rb(a,t,s){const i=fo[a]||fo[zf];if(!i)return{bg:"#fcfaf8",surface:"#f6f1ea",border:"#e7dfd5",text:"#26251e",muted:"#5a574f",accentBlue:"#26251e",accentGreen:"#1f7a4d",accentRed:"#b84f42",accentYellow:"#a16b2d",accentPurple:"#7a5c8f"};const o={...t==="dark"?i.dark:i.light};return s&&Object.assign(o,s),o}const Jn=a=>{const t=parseInt(a.slice(1,3),16),s=parseInt(a.slice(3,5),16),i=parseInt(a.slice(5,7),16);return`${t} ${s} ${i}`},kA=(a,t,s)=>{const i=[parseInt(a.slice(1,3),16),parseInt(a.slice(3,5),16),parseInt(a.slice(5,7),16)],o=[parseInt(t.slice(1,3),16),parseInt(t.slice(3,5),16),parseInt(t.slice(5,7),16)];return i.map((c,u)=>Math.round(c+((o[u]??c)-c)*s)).join(" ")};function ob(a,t,s,i,o){s.classList.toggle("dark",a==="dark"),s.classList.toggle("light",a==="light"),s.style.setProperty("--color-bg",Jn(t.bg)),s.style.setProperty("--color-surface",Jn(t.surface)),s.style.setProperty("--color-border",Jn(t.border)),s.style.setProperty("--color-text",Jn(t.text)),s.style.setProperty("--color-muted",Jn(t.muted)),s.style.setProperty("--color-accent-blue",Jn(t.accentBlue)),s.style.setProperty("--color-accent-green",Jn(t.accentGreen)),s.style.setProperty("--color-accent-red",Jn(t.accentRed)),s.style.setProperty("--color-accent-yellow",Jn(t.accentYellow)),s.style.setProperty("--color-accent-purple",Jn(t.accentPurple)),s.style.setProperty("--color-hover",kA(t.surface,t.text,.06)),i&&i.setAttribute("content",t.bg),o&&o.setAttribute("content",a)}function wA({theme:a,themePresetId:t,customTheme:s,customThemeEnabled:i}){_.useEffect(()=>{const o=document.documentElement,c=document.querySelector('meta[name="theme-color"]'),u=document.querySelector('meta[name="color-scheme"]'),d=a==="dark"?"dark":a==="light"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",p=i?s:void 0,g=rb(t||zf,d,p);if(ob(d,g,o,c,u),a==="auto"){const y=window.matchMedia("(prefers-color-scheme: dark)"),b=()=>{const x=y.matches?"dark":"light",S=rb(t||zf,x,p);ob(x,S,o,c,u)};return y.addEventListener("change",b),()=>y.removeEventListener("change",b)}},[a,t,s,i])}function CA({message:a,onRetry:t}){const{t:s}=Je();return m.jsx("div",{className:"flex items-center justify-center h-full w-full bg-dark-bg",children:m.jsxs("div",{className:"max-w-md p-8 text-center",children:[m.jsx("div",{className:"flex justify-center mb-4",children:m.jsx("div",{className:"w-16 h-16 rounded-full bg-accent-red/10 flex items-center justify-center",children:m.jsx(Pf,{size:32,className:"text-accent-red"})})}),m.jsx("h2",{className:"text-xl font-semibold text-dark-text mb-2",children:s("error.pageError")}),m.jsx("p",{className:"text-sm text-dark-muted mb-6",children:a||s("error.unknownError")}),m.jsxs("div",{className:"flex items-center justify-center gap-3",children:[m.jsxs("button",{onClick:t,className:"flex items-center gap-2 px-4 py-2 bg-accent-blue text-white rounded-lg hover:opacity-90 transition-opacity",children:[m.jsx(mc,{size:16}),s("common.retry")]}),m.jsx("button",{onClick:()=>window.location.reload(),className:"px-4 py-2 bg-dark-hover text-dark-text rounded-lg hover:bg-dark-border transition-colors",children:s("error.refreshPage")})]})]})})}class lb extends _.Component{constructor(s){super(s);Fe(this,"handleRetry",()=>{this.setState({hasError:!1,error:null})});this.state={hasError:!1,error:null}}static getDerivedStateFromError(s){return{hasError:!0,error:s}}componentDidCatch(s,i){console.error("[ErrorBoundary] Caught error:",s,i)}render(){var s;return this.state.hasError?this.props.fallback?this.props.fallback:m.jsx(CA,{message:(s=this.state.error)==null?void 0:s.message,onRetry:this.handleRetry}):this.props.children}}const _A=10;function TA(a,t=_A){return a.filter(s=>s&&!!s.id&&(s.messageCount??0)>0).sort((s,i)=>String(i.updatedAt||"").localeCompare(String(s.updatedAt||""))).slice(0,t).map(s=>{const i=new Date(s.createdAt).getTime()||Date.now(),o=new Date(s.updatedAt).getTime()||i;return{id:s.id,title:s.title||s.id,createdAt:i,lastActiveAt:o,messageCount:s.messageCount??0,...s.preview?{preview:s.preview}:{}}})}function cb(a,t){const s=(t==null?void 0:t.wan)??"万",i=(t==null?void 0:t.yi)??"亿";if(a>=1e8)return`${(a/1e8).toFixed(1)}${i}`;if(a>=1e4){const o=a/1e4;return`${o>=100?o.toFixed(0):o.toFixed(1)}${s}`}return String(Math.round(a))}function NA(a){return`${a>=10?a.toFixed(0):a.toFixed(1)}%`}const EA=_.memo(function({open:t,onClose:s}){const{t:i}=Je(),o=De(M=>M.currentUsage),c=De(M=>M.maxContextTokens),u=De(M=>M.contextBreakdown),d=De(M=>M.cacheStats),p=De(M=>M.estimateTokens),g=Ce(M=>M.messagesBySession),y=Te(M=>M.activeSessionId),b=y?g[y]||[]:[];_.useEffect(()=>{if(!t)return;const M=j=>{j.key==="Escape"&&s()};return window.addEventListener("keydown",M),()=>window.removeEventListener("keydown",M)},[t,s]);const x=_.useMemo(()=>{if(u)return null;let M=0,j=0;for(const J of b){let Y=J.content||"",te="";if(J.thinking&&(Y+=" "+J.thinking),J.steps)for(const se of J.steps)se.thought&&(Y+=" "+se.thought),se.action&&(te+=" "+se.action),se.result&&(te+=" "+se.result);if(J.toolCalls)for(const se of J.toolCalls)te+=" "+(typeof se.args=="string"?se.args:JSON.stringify(se.args));M+=p(Y),j+=p(te)}return{messagesTokens:M,toolTokens:j,total:M+j}},[u,b,p]),k=_.useMemo(()=>{const M=u,j=M?M.messagesTokens:(x==null?void 0:x.messagesTokens)??0,J=M?M.toolContentTokens+M.toolDefTokens:(x==null?void 0:x.toolTokens)??0,Y=M?M.systemPromptTokens:0,te=M?M.skillTokens:0,se=M?M.mcpToolTokens:0,ge=M?M.dynamicTokens:0,Ke=M?M.total:(x==null?void 0:x.total)??0,de=Math.max(0,o.totalTokens-Ke)+ge,K=Math.max(o.totalTokens,Ke,1);return[{key:"system",label:i("chat.ctxSystemPrompt"),tokens:Y,color:"bg-dark-text/70"},{key:"tools",label:i("chat.ctxSystemTools"),tokens:J,color:"bg-accent-purple"},{key:"mcp",label:i("chat.ctxMcpTools"),tokens:se,color:"bg-accent-cyan"},{key:"skills",label:i("chat.ctxSkills"),tokens:te,color:"bg-accent-yellow"},{key:"messages",label:i("chat.ctxMessages"),tokens:j,color:"bg-accent-blue"},{key:"other",label:i("chat.ctxOther"),tokens:de,color:"bg-dark-muted/60"}].map(ne=>({...ne,pct:ne.tokens/K*100}))},[u,x,o.totalTokens,i]).filter(M=>M.pct>=.05||M.tokens>0),C=o.totalTokens,T=c>0?Math.min(100,C/c*100):0,E=T>=90?"bg-accent-red":T>=70?"bg-accent-yellow":"bg-dark-text/70",A=T>=90?"text-accent-red":T>=70?"text-accent-yellow":"text-dark-text",B=d&&d.cacheStatsCalls>0&&d.cacheHitRate!==void 0?d.cacheHitRate:null;return t?m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"fixed inset-0 z-40 bg-black/40 backdrop-blur-[1px]",onClick:s,"aria-hidden":"true"}),m.jsx("div",{className:"fixed inset-x-0 bottom-9 z-50 mx-auto max-w-lg px-2 pb-2",children:m.jsxs("div",{className:"animate-slide-up rounded-t-xl rounded-b-md border border-dark-border bg-dark-surface/95 backdrop-blur shadow-[0_-12px_40px_-10px_rgba(0,0,0,0.6)] overflow-hidden",children:[m.jsxs("div",{className:"flex items-center justify-between px-4 pt-3 pb-2",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(VS,{size:15,className:A}),m.jsx("span",{className:"text-sm font-semibold text-dark-text",children:i("chat.contextCapacity")})]}),m.jsx("button",{type:"button","aria-label":i("a11y.close"),onClick:s,className:"p-1 rounded-md text-dark-muted hover:text-dark-text hover:bg-dark-hover transition-colors",children:m.jsx(ss,{size:15})})]}),m.jsxs("div",{className:"px-4 pb-1",children:[m.jsxs("div",{className:"flex items-baseline gap-2",children:[m.jsxs("span",{className:"text-xl font-bold font-mono text-dark-text",children:[cb(C,{wan:i("chat.unitWan"),yi:i("chat.unitYi")}),m.jsxs("span",{className:"text-dark-muted text-sm font-normal",children:[" / ",cb(c,{wan:i("chat.unitWan"),yi:i("chat.unitYi")})]})]}),m.jsxs("span",{className:`text-xs font-mono ${A}`,children:["(",T.toFixed(1),"%)"]})]}),m.jsx("div",{className:"mt-1.5 h-1.5 bg-dark-border/70 rounded-full overflow-hidden",children:m.jsx("div",{className:`h-full rounded-full transition-all duration-500 ${E}`,style:{width:`${T}%`}})})]}),m.jsxs("div",{className:"flex items-center justify-between px-4 pt-2 pb-1",children:[m.jsx("span",{className:"text-[11px] font-medium text-dark-muted",children:i("chat.categoryBreakdown")}),m.jsx("span",{className:"text-[10px] text-dark-muted/50 select-none",title:i("chat.assemblyOrderHint"),children:i("chat.byAssemblyOrder")})]}),m.jsx("div",{className:"px-4 pb-2 space-y-1.5",children:k.map(M=>m.jsxs("div",{"data-row-key":M.key,className:"flex items-center gap-2",children:[m.jsx("span",{className:"text-[11px] text-dark-muted w-16 shrink-0",children:M.label}),m.jsx("div",{className:"flex-1 h-1.5 bg-dark-border/70 rounded-full overflow-hidden",children:m.jsx("div",{className:`h-full ${M.color} rounded-full`,style:{width:`${Math.max(.5,M.pct)}%`}})}),m.jsx("span",{className:"text-[11px] font-mono text-dark-text w-12 text-right shrink-0",children:NA(M.pct)})]},M.key))}),m.jsxs("div",{className:"mx-4 mb-3 mt-1 flex items-center justify-between rounded-md bg-dark-bg/70 px-3 py-1.5",children:[m.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-dark-muted",children:[m.jsx(KS,{size:11}),i("chat.avgCacheHitRate")]}),B!==null?m.jsxs("span",{className:`text-[11px] font-mono font-semibold ${B>=.5?"text-accent-green":"text-accent-yellow"}`,children:[(B*100).toFixed(0),"%"]}):m.jsx("span",{className:"text-[11px] font-mono text-dark-muted/60",children:"–"})]})]})})]}):null});function uv(a){const t=a.trim();if(!t)return{model:""};const s=t.indexOf("/"),i=t.indexOf(":"),o=s>=0&&(i<0||s<i)?s:i;if(o>0){const c=t.slice(0,o).trim(),u=t.slice(o+1).trim();if(c&&u)return{provider:c,model:u}}return{model:t}}function iR(a){return uv(a).provider??""}function AA(a,t){const s=uv(t),i=a||s.model;return s.provider&&i?`${s.provider} · ${i}`:i}function rR(a){const t=new Map;for(const s of a){const i=s.provider||"default",o=t.get(i);o?o.push(s):t.set(i,[s])}return Array.from(t.entries())}const jA=_.memo(function(t){const{t:s}=Je(),i=De(W=>W.currentUsage),o=De(W=>W.maxContextTokens),c=De(W=>W.model),u=De(W=>W.modelRef),d=De(W=>W.tokenRate),p=De(W=>W.compactingUntil),g=De(W=>W.lastCompactInfo),y=De(W=>W.degradation),b=De(W=>W.compactionProgress),x=De(W=>W.cacheStats),S=Te(W=>W.activeSessionId),k=Ce(W=>S?W.isGenerating(S):!1),C=Qe(W=>S?W.bySession[S]:void 0),T=Qe(W=>S?W.getRunningAgentCount(S):0),E=Pi(W=>W.mode),A=Ds(W=>W.autoMode),[B,M]=_.useState(0),j=_.useRef(0),[J,Y]=_.useState(!1),[te,se]=_.useState(null);_.useEffect(()=>{const W=fe.onReconnectAttempt((Ee,ke)=>se({attempt:Ee,max:ke})),Be=fe.onReconnectSuccess(()=>se(null)),Le=fe.onReconnectGiveUp(()=>se(null)),ze=fe.onOpen(()=>se(null));return()=>{W(),Be(),Le(),ze()}},[]),_.useEffect(()=>{if(k&&!j.current&&(j.current=Date.now()),!k){j.current=0,M(0);return}const W=setInterval(()=>M(Math.floor((Date.now()-j.current)/1e3)),1e3);return()=>clearInterval(W)},[k]);const ge=i.totalTokens,Ke=o>0?Math.min(100,Math.round(i.totalTokens/o*100)):0,de=mw(d),K=E==="normal"?"act":E,ne=fw[K],he=AA(c,u),L=Bn(K),Z=L==="plan"?"brand":L==="goal"?"purple":"green";return m.jsxs("div",{className:"h-9 border-t border-dark-border bg-dark-bg flex items-center px-3 gap-2 shrink-0 select-none text-xs overflow-hidden",children:[m.jsx("span",{className:"font-semibold text-dark-text whitespace-nowrap",children:"DeepSeekCode"}),m.jsx("span",{className:"status-pill","data-tone":Z,children:ne.label}),A&&m.jsx("span",{className:"status-pill","data-tone":"yellow",children:"Auto"}),te&&m.jsxs("span",{className:"status-pill","data-tone":"yellow",title:s("reconnect.hint"),"data-testid":"reconnect-pill",children:[m.jsx(mc,{size:10,className:"animate-spin"}),s("reconnect.reconnecting",{attempt:te.attempt,max:te.max})]}),m.jsx("span",{className:"text-dark-muted truncate max-w-[14rem]",title:he||void 0,children:he||s("common.connecting")}),m.jsxs("span",{className:"inline-flex items-center text-[11px] whitespace-nowrap shrink-0",title:x&&x.cacheStatsCalls>0?s("chat.cacheHitTitle",{hit:Yr(x.cacheHitTokens),miss:Yr(x.cacheMissTokens),calls:x.cacheStatsCalls}):s(k?"chat.cacheWaitingRun":"chat.cacheNoStats"),children:[m.jsx("span",{className:"text-dark-muted",children:"cache"})," ",x&&x.cacheStatsCalls>0?m.jsx("span",{className:x.cacheHitRate!==void 0&&x.cacheHitRate>=.5?"text-accent-green":"text-accent-yellow",children:x.cacheHitRate!==void 0?`${(x.cacheHitRate*100).toFixed(0)}%`:"n/a"}):k?m.jsx("span",{className:"text-dark-muted/60",children:"–"}):m.jsx("span",{className:"text-dark-muted/60",children:"n/a"})]}),m.jsxs("button",{type:"button",onClick:()=>Y(!0),title:s("chat.viewContextDetail"),className:"group inline-flex items-center gap-1.5 shrink-0 -mx-1 px-1 rounded transition-colors cursor-pointer hover:bg-dark-hover/60",children:[m.jsxs("span",{className:"hidden md:inline-flex items-center gap-1 text-dark-muted whitespace-nowrap",children:[m.jsx("span",{className:"text-dark-text",children:Yr(ge)}),m.jsx("span",{className:"text-dark-muted/60",children:"/"}),m.jsx("span",{children:Yr(o)})]}),m.jsxs("span",{className:"inline-flex items-center gap-1",children:[m.jsx("span",{className:"w-16 lg:w-20 h-1.5 bg-dark-border/70 rounded-full overflow-hidden inline-flex",children:m.jsx("span",{className:`h-full transition-all rounded-full ${Ke>=90?"bg-accent-red":Ke>=70?"bg-accent-yellow":"bg-dark-text/70"}`,style:{width:`${Ke}%`}})}),m.jsxs("span",{className:Ke>=90?"text-accent-red font-bold":Ke>=70?"text-accent-yellow":"",children:[Ke,"%"]})]}),m.jsx(YS,{size:12,className:"text-dark-muted/50 group-hover:text-dark-text transition-colors"})]}),k&&m.jsxs(m.Fragment,{children:[m.jsxs("span",{className:"text-dark-text flex items-center gap-1 whitespace-nowrap",children:[m.jsx(Ln,{size:12,className:"animate-spin"}),Wb(B)]}),de&&m.jsx("span",{className:"text-accent-purple whitespace-nowrap",children:de})]}),T>0&&m.jsxs("span",{className:"text-dark-text whitespace-nowrap",children:[T," agent",T>1?"s":""]}),m.jsx("div",{className:"flex-1"}),C&&m.jsxs("span",{className:"hidden xl:flex items-center gap-2 text-[11px] text-dark-text whitespace-nowrap",children:[m.jsx("span",{className:"text-dark-muted",children:"wf"}),m.jsx("span",{className:"font-mono",children:C.status}),m.jsxs("span",{children:[C.completedPhases,"/",C.totalPhases||0]}),m.jsx("span",{className:"text-dark-muted",children:Yr(C.tokensUsed)})]}),b&&m.jsxs("span",{className:"hidden lg:flex items-center gap-2 text-[11px] text-dark-text whitespace-nowrap",children:[m.jsx("span",{children:"compact"}),m.jsxs("span",{children:[b.percent,"%"]}),m.jsx("span",{className:"w-20 h-1.5 bg-dark-border/70 rounded-full overflow-hidden",children:m.jsx("span",{className:"h-full bg-dark-text/70 rounded-full block",style:{width:`${b.percent}%`}})})]}),!b&&Date.now()<p&&g&&m.jsxs("span",{className:"hidden lg:inline text-dark-muted text-[11px] whitespace-nowrap",children:[g.originalCount," ","->"," ",g.compressedCount]}),(y==null?void 0:y.active)&&m.jsxs("span",{className:"text-accent-yellow text-[11px] whitespace-nowrap",children:[y.label," ",y.retryCount>0?`${y.retryCount}/${y.maxRetries}`:""]}),m.jsx(EA,{open:J,onClose:()=>Y(!1)})]})}),RA=_.memo(function({sessionId:t}){const{t:s}=Je(),i=Ce(S=>{if(!t)return;const k=S.messagesBySession[t]??[];for(let C=k.length-1;C>=0;C--){const T=k[C];if(T&&T.type==="assistant")return T.id}}),o=en(S=>yC(S,t)),c=en(S=>bC(S,t,i)),u=Ce(S=>{if(!t)return;const k=S.messagesBySession[t]??[];for(let C=k.length-1;C>=0;C--){const T=k[C];if(T&&T.type==="user")return T.content}}),d=Ce(S=>t?S.generatingSessions.includes(t):!1),p=Qe(S=>t?S.getForSession(t):void 0),g=c||(u?u.replace(/\s+/g," ").trim().slice(0,20):void 0),y=_.useMemo(()=>{const S=p==null?void 0:p.nodes;if(!S)return;const k=S.find(C=>C.status==="pending"||C.status==="scheduled"||C.status==="running");return k==null?void 0:k.title},[p==null?void 0:p.nodes]);if(!t||!g&&!o&&!y&&!d)return null;const b=(o==null?void 0:o.status)==="waiting_user"?"text-accent-yellow":(o==null?void 0:o.status)==="blocked"?"text-accent-red":(o==null?void 0:o.status)==="paused"?"text-dark-300":(o==null?void 0:o.status)==="failed"?"text-accent-red":"text-accent-blue",x=(o==null?void 0:o.status)==="waiting_user"?"bg-accent-yellow":(o==null?void 0:o.status)==="blocked"?"bg-accent-red":(o==null?void 0:o.status)==="paused"?"bg-dark-300":(o==null?void 0:o.status)==="failed"?"bg-accent-red":(o==null?void 0:o.status)==="running"?"bg-accent-blue animate-pulse":"bg-accent-blue";return m.jsxs("div",{className:"h-7 shrink-0 flex items-center gap-2.5 px-3 border-b border-dark-border bg-dark-bg/80 text-[11px] select-none","data-testid":"task-status-bar",children:[g&&m.jsx("span",{className:"min-w-0 truncate font-medium text-dark-text","data-testid":"taskbar-title",children:g}),o&&m.jsxs("span",{title:(o==null?void 0:o.status)==="blocked"?o.blockedReason:void 0,className:`flex min-w-0 items-center gap-1.5 shrink-0 ${b}`,"data-testid":"taskbar-current",children:[m.jsx("span",{className:`inline-block w-1.5 h-1.5 shrink-0 rounded-full ${x}`}),m.jsx("span",{className:"truncate max-w-[18rem]",children:o.title})]}),y&&m.jsxs("span",{className:"shrink-0 min-w-0 truncate text-dark-muted","data-testid":"taskbar-next",children:[s("taskbar.next"),": ",y]}),!o&&d&&m.jsxs("span",{className:"shrink-0 text-dark-muted",children:[s("chat.thinking"),"…"]})]})}),Fn=Ut()((a,t)=>({status:null,branches:null,loading:!1,refreshing:!1,lastAction:null,busy:!1,refreshStatus:async()=>{const s=await Ge.git.status();return s.success&&s.data?(a({status:s.data}),s.data):(a({status:{available:!1,error:s.error||"Failed to load git status"}}),null)},refreshBranches:async()=>{const s=await Ge.git.branches();s.success&&s.data?a({branches:s.data}):a({branches:null})},refreshAll:async()=>{if(!t().refreshing){a({refreshing:!0,loading:t().status===null});try{await t().refreshStatus(),await t().refreshBranches()}finally{a({refreshing:!1,loading:!1})}}},commit:async s=>{a({busy:!0});const i=await Ge.git.commit({message:s});return a({busy:!1,lastAction:i.success&&i.data?i.data:{ok:!1,error:i.error||"Commit failed"}}),t().refreshStatus(),t().lastAction},push:async()=>{a({busy:!0});const s=await Ge.git.push();return a({busy:!1,lastAction:s.success&&s.data?s.data:{ok:!1,error:s.error||"Push failed"}}),t().refreshStatus(),t().lastAction},checkout:async s=>{a({busy:!0});const i=await Ge.git.checkout(s);return a({busy:!1,lastAction:i.success&&i.data?i.data:{ok:!1,error:i.error||"Checkout failed"}}),t().refreshAll(),t().lastAction}})),Xd="dsc-git-commit-draft",MA=_.memo(function(){const{t}=Je(),s=Fn(j=>j.status),i=Fn(j=>j.branches),o=Fn(j=>j.busy),c=Fn(j=>j.lastAction),u=qa(j=>j.workspaceDir),[d,p]=_.useState(!1),[g,y]=_.useState(""),[b,x]=_.useState(!1),[S,k]=_.useState(null),C=_.useRef(null);_.useEffect(()=>{Fn.getState().refreshAll();const j=setInterval(()=>{document.visibilityState==="visible"&&Fn.getState().refreshStatus()},3e4);return()=>clearInterval(j)},[]),_.useEffect(()=>{const j=localStorage.getItem(Xd);j&&y(j)},[]);const T=_.useCallback(async()=>{try{const j=await Ge.git.prStatus();j.success&&k(j.data||{available:!1,message:""})}catch{}},[]);_.useEffect(()=>{T()},[T]),_.useEffect(()=>{if(!d)return;const j=J=>{C.current&&!C.current.contains(J.target)&&p(!1)};return document.addEventListener("mousedown",j),()=>document.removeEventListener("mousedown",j)},[d]);const E=_.useCallback(async()=>{const j=g.trim();if(!j){_e.warning(t("git.emptyCommitMsg"));return}const Y=await Fn.getState().commit(j);Y.ok?(_e.success(t("git.commitSuccess")),x(!1),localStorage.removeItem(Xd),y("")):_e.error(Y.error||t("git.commitFailed"))},[g,t]),A=_.useCallback(async()=>{const J=await Fn.getState().push();J.ok?_e.success(t("git.pushSuccess")):_e.error(J.error||t("git.pushFailed"))},[t]),B=_.useCallback(async j=>{const Y=await Fn.getState().checkout(j);Y.ok?_e.success(t("git.checkoutSuccess",{branch:j})):_e.error(Y.error||t("git.checkoutFailed"))},[t]),M=s&&s.available===!1;return m.jsxs("div",{ref:C,className:"relative",children:[m.jsxs("button",{onClick:()=>p(j=>!j),className:vt("flex items-center gap-1.5 rounded-lg px-2 py-1.5 text-xs transition-colors",d?"bg-dark-hover text-dark-text":"text-dark-muted hover:bg-dark-hover hover:text-dark-text"),title:t("git.panelTitle"),"aria-expanded":d,children:[m.jsx($g,{size:13,className:vt(M?"text-dark-muted/50":"text-accent-blue")}),m.jsx("span",{className:"max-w-[120px] truncate font-mono",children:M?t("git.noRepo"):(s==null?void 0:s.branch)||"—"}),(s==null?void 0:s.dirty)&&m.jsxs("span",{className:"hidden sm:flex items-center gap-1 text-[10px] font-mono tabular-nums",children:[m.jsxs("span",{className:"text-accent-green",children:["+",s.totalAdded??0]}),m.jsxs("span",{className:"text-accent-red",children:["−",s.totalRemoved??0]})]}),m.jsx(ba,{size:11,className:vt("transition-transform",d&&"rotate-180")})]}),d&&m.jsxs("div",{className:"absolute right-0 top-full z-40 mt-1.5 w-[380px] max-w-[90vw] rounded-xl border border-dark-border bg-dark-surface shadow-2xl overflow-hidden",children:[m.jsxs("div",{className:"flex items-center gap-2 px-3.5 py-2.5 border-b border-dark-border bg-dark-surface",children:[m.jsx($g,{size:14,className:"text-accent-blue"}),m.jsx("span",{className:"text-xs font-medium text-dark-text",children:t("git.panelTitle")}),m.jsx("div",{className:"flex-1"}),m.jsx("button",{onClick:()=>void Fn.getState().refreshAll(),className:"rounded p-1 text-dark-muted hover:text-dark-text hover:bg-dark-hover transition-colors",title:t("git.refresh"),children:m.jsx(mc,{size:12,className:vt(Fn.getState().refreshing&&"animate-spin")})})]}),M?m.jsxs("div",{className:"px-3.5 py-4 text-center",children:[m.jsx(ZS,{size:20,className:"mx-auto mb-2 text-dark-muted/50"}),m.jsx("div",{className:"text-xs text-dark-muted",children:t("git.notGitDesc")}),m.jsx("div",{className:"mt-1 text-[10px] font-mono text-dark-muted/60 break-all",children:u})]}):s?m.jsxs("div",{className:"p-3.5 space-y-3 max-h-[60vh] overflow-y-auto custom-scrollbar",children:[m.jsxs("div",{children:[m.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[m.jsx("span",{className:"text-[11px] text-dark-muted",children:t("git.changes")}),m.jsxs("span",{className:"text-[11px] font-mono tabular-nums",children:[m.jsxs("span",{className:"text-accent-green",children:["+",s.totalAdded??0]}),m.jsx("span",{className:"text-dark-muted/40",children:" / "}),m.jsxs("span",{className:"text-accent-red",children:["−",s.totalRemoved??0]})]})]}),m.jsxs("div",{className:"space-y-0.5 max-h-40 overflow-y-auto custom-scrollbar",children:[(s.changes||[]).slice(0,30).map(j=>m.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] font-mono",children:[m.jsx("span",{className:vt("w-6 shrink-0 rounded px-1 text-center text-[9px]",j.status.includes("?")?"bg-accent-purple/15 text-accent-purple":j.status===j.status.toUpperCase()&&j.status.trim()?"bg-accent-green/15 text-accent-green":"bg-accent-yellow/15 text-accent-yellow"),children:j.status}),m.jsx("span",{className:"flex-1 truncate text-dark-text",children:j.path}),m.jsxs("span",{className:"shrink-0 text-[10px] tabular-nums text-dark-muted/60",children:[j.added>0&&m.jsxs("span",{className:"text-accent-green",children:["+",j.added]}),j.removed>0&&m.jsxs("span",{className:"text-accent-red",children:["−",j.removed]})]})]},j.path)),(s.changes||[]).length===0&&m.jsx("div",{className:"py-2 text-center text-[11px] text-dark-muted/60",children:t("git.clean")})]})]}),m.jsxs("div",{children:[m.jsx("div",{className:"text-[11px] text-dark-muted mb-1",children:t("git.branch")}),m.jsx("div",{className:"flex flex-wrap gap-1",children:((i==null?void 0:i.branches)||[s.branch||""]).slice(0,8).map(j=>m.jsx("button",{onClick:()=>j!==s.branch&&B(j),disabled:j===s.branch,className:vt("rounded-md px-2 py-1 text-[11px] font-mono transition-colors",j===s.branch?"bg-accent-blue/10 text-accent-blue cursor-default":"bg-dark-bg border border-dark-border text-dark-muted hover:border-accent-blue/40 hover:text-dark-text"),children:j},j))}),(s.ahead??0)>0||(s.behind??0)>0?m.jsxs("div",{className:"mt-1 text-[10px] text-dark-muted/70",children:[(s.ahead??0)>0&&m.jsxs("span",{className:"text-accent-green",children:["↑ ",s.ahead," "]}),(s.behind??0)>0&&m.jsxs("span",{className:"text-accent-yellow",children:["↓ ",s.behind]}),t("git.upstream")]}):null]}),m.jsx("div",{children:b?m.jsxs("div",{className:"space-y-1.5",children:[m.jsx("textarea",{value:g,onChange:j=>{y(j.target.value),localStorage.setItem(Xd,j.target.value)},placeholder:t("git.commitPlaceholder"),rows:2,className:"w-full rounded-md border border-dark-border bg-dark-bg px-2.5 py-1.5 text-xs text-dark-text placeholder-dark-muted/50 resize-none focus:outline-none focus:border-accent-blue/50"}),m.jsxs("div",{className:"flex gap-1.5",children:[m.jsxs("button",{onClick:E,disabled:o||!g.trim(),className:"flex flex-1 items-center justify-center gap-1 rounded-md bg-accent-green/15 text-accent-green px-2.5 py-1.5 text-xs hover:bg-accent-green/25 transition-colors disabled:opacity-40",children:[o?m.jsx(Ln,{size:12,className:"animate-spin"}):m.jsx(Hg,{size:12}),t("git.commitConfirm")]}),m.jsx("button",{onClick:()=>x(!1),className:"rounded-md px-2.5 py-1.5 text-xs text-dark-muted hover:bg-dark-hover transition-colors",children:t("common.cancel")})]})]}):m.jsxs("div",{className:"flex gap-1.5",children:[m.jsxs("button",{onClick:()=>x(!0),disabled:o,className:"flex flex-1 items-center justify-center gap-1.5 rounded-md bg-accent-blue/10 text-accent-blue px-2.5 py-1.5 text-xs hover:bg-accent-blue/20 transition-colors disabled:opacity-50",children:[m.jsx(Hg,{size:13}),t("git.commit")]}),m.jsxs("button",{onClick:A,disabled:o||!s.dirty,className:"flex items-center justify-center gap-1.5 rounded-md bg-dark-bg border border-dark-border text-dark-muted px-2.5 py-1.5 text-xs hover:border-accent-green/40 hover:text-accent-green transition-colors disabled:opacity-40",children:[m.jsx(QS,{size:13}),t("git.push")]})]})}),m.jsxs("div",{className:"flex items-center gap-1.5 rounded-md bg-dark-bg border border-dark-border px-2.5 py-2",children:[m.jsx(XS,{size:13,className:"text-accent-purple shrink-0"}),m.jsx("span",{className:"text-[11px] text-dark-muted truncate",children:S?S.available?t("git.prReady"):S.message||t("git.prUnavailable"):t("git.prLoading")})]}),m.jsxs("div",{className:"rounded-md bg-dark-bg border border-dark-border px-2.5 py-2 space-y-0.5",children:[m.jsx("div",{className:"text-[10px] text-dark-muted",children:t("git.environment")}),m.jsx("div",{className:"text-[11px] font-mono text-dark-text/80 break-all",children:u||"—"}),s.lastCommit&&m.jsxs("div",{className:"text-[10px] font-mono text-dark-muted/60 truncate",children:[s.lastCommit.hash.slice(0,7)," ",s.lastCommit.subject]})]}),c&&m.jsxs("div",{className:vt("flex items-center gap-1.5 text-[11px]",c.ok?"text-accent-green":"text-accent-red"),children:[c.ok?m.jsx(gc,{size:12}):m.jsx(hc,{size:12}),m.jsx("span",{className:"truncate",children:c.ok?t("git.ok"):c.error||""})]})]}):m.jsx("div",{className:"px-3.5 py-4 text-center text-xs text-dark-muted",children:t("git.loading")})]})]})});function OA({onOpenTemplates:a,onSaveAsTemplate:t,saveAsBusy:s}){const{t:i}=Je(),[o,c]=_.useState(!1),u=_.useRef(null);return _.useEffect(()=>{if(!o)return;const d=p=>{u.current&&!u.current.contains(p.target)&&c(!1)};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[o]),m.jsxs("div",{ref:u,className:"relative",children:[m.jsx("button",{onClick:()=>c(d=>!d),className:"p-1.5 rounded-lg text-dark-muted hover:bg-dark-hover hover:text-dark-text transition-colors",title:i("nav.moreOptions"),"aria-label":i("nav.moreOptions"),"aria-expanded":o,children:m.jsx(lf,{size:16,"aria-hidden":"true"})}),o&&m.jsxs("div",{className:"absolute right-0 top-full z-40 mt-1.5 w-44 rounded-xl border border-dark-border bg-dark-surface shadow-2xl overflow-hidden py-1",children:[m.jsxs("button",{onClick:()=>{c(!1),a()},className:"w-full flex items-center gap-2 px-3 py-2 text-xs text-dark-text hover:bg-dark-hover transition-colors",children:[m.jsx(tc,{size:13,className:"text-dark-muted shrink-0"})," ",i("chat.templateLibrary")]}),m.jsxs("button",{onClick:()=>{c(!1),t()},disabled:s,className:"w-full flex items-center gap-2 px-3 py-2 text-xs text-dark-text hover:bg-dark-hover transition-colors disabled:opacity-40",children:[s?m.jsx(Ln,{size:13,className:"animate-spin shrink-0"}):m.jsx(JS,{size:13,className:"text-dark-muted shrink-0"}),i("chat.saveAsTemplate")]})]})]})}const BA={info:Ab,success:bb,warning:Pf,error:$f},DA={info:"text-accent-blue",success:"text-accent-green",warning:"text-accent-yellow",error:"text-accent-red"},LA=_.memo(function(){const{toasts:t,dismissToast:s}=Ls();return t.length===0?null:m.jsx("div",{className:"fixed bottom-20 right-4 z-[100] flex flex-col gap-2 max-w-sm",children:t.slice(-3).map(i=>{const o=BA[i.type];return m.jsxs("div",{className:"toast-card animate-fade-in-up",role:"status",children:[m.jsx(o,{size:16,className:`shrink-0 mt-0.5 ${DA[i.type]}`}),m.jsxs("span",{className:"text-xs flex-1 text-dark-text leading-relaxed",children:[i.message,i.count>1&&m.jsxs("span",{className:"toast-card-count ml-1.5",children:["×",i.count]})]}),m.jsx("button",{onClick:()=>s(i.id),className:"shrink-0 p-0.5 rounded text-dark-muted/70 hover:text-dark-text hover:bg-dark-hover/60 transition-colors","aria-label":"Dismiss",children:m.jsx(ss,{size:12})})]},i.id)})})}),zA={critical:{icon:e0,text:"text-accent-red"},error:{icon:$f,text:"text-accent-red"},warning:{icon:Pf,text:"text-accent-yellow"},info:{icon:Ab,text:"text-accent-blue"}},UA={info:6e3,warning:1e4},IA=_.memo(function(){const t=$i(o=>o.errors),s=$i(o=>o.dismiss),i=t.filter(o=>!o.dismissed);return _.useEffect(()=>{const o=i.filter(c=>!c.action).map(c=>{const u=c.durationMs??UA[c.level];return u?setTimeout(()=>s(c.id),u):null}).filter(c=>c!==null);return()=>o.forEach(clearTimeout)},[i,s]),i.length===0?null:m.jsx("div",{className:"fixed bottom-4 right-4 z-[110] flex flex-col gap-2 max-w-sm",children:i.map(o=>{const c=zA[o.level],u=c.icon;return m.jsx($A,{entry:o,icon:u,config:c,onDismiss:()=>s(o.id)},o.id)})})});function $A({entry:a,icon:t,config:s,onDismiss:i}){const[o,c]=_.useState(!1);return m.jsxs("div",{className:"toast-card animate-fade-in-up",role:"alert",children:[m.jsx(t,{size:16,className:`shrink-0 mt-0.5 ${s.text}`}),m.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[m.jsxs("span",{className:`text-xs leading-relaxed ${s.text}`,children:[a.title,a.count!=null&&a.count>1&&m.jsxs("span",{className:"toast-card-count ml-1.5",children:["×",a.count]})]}),o&&a.detail&&m.jsx("div",{className:"mt-1.5 text-[11px] text-dark-muted whitespace-pre-wrap break-words leading-relaxed border-t border-dark-border/50 pt-1.5",children:a.detail}),a.action&&m.jsx("button",{onClick:a.action.onClick,className:"mt-1.5 self-start text-[11px] px-2 py-0.5 rounded-md bg-dark-hover hover:bg-dark-border transition-colors text-dark-text",children:a.action.label})]}),m.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[a.detail&&m.jsx("button",{onClick:()=>c(!o),className:"p-0.5 rounded text-dark-muted/70 hover:text-dark-text hover:bg-dark-hover/60 transition-colors","aria-label":o?"Collapse":"Expand",children:o?m.jsx(ba,{size:12}):m.jsx(Nb,{size:12})}),m.jsx("button",{onClick:i,className:"p-0.5 rounded text-dark-muted/70 hover:text-dark-text hover:bg-dark-hover/60 transition-colors","aria-label":"Dismiss",children:m.jsx(ss,{size:12})})]})]})}function HA(a){const{t}=Je(),{setActiveTab:s,createNewSession:i,clearMessages:o,setTheme:c,setThemePreset:u,toggleTerminal:d,setLogs:p,setUnreadLogs:g}=a,y=Zf(K=>K.backendCommands),b=Array.isArray(y)?y:[],[x,S]=_.useState(!1),[k,C]=_.useState(""),[T,E]=_.useState(0),A=_.useRef(null),B=_.useCallback((K,ne)=>{const he=Te.getState().activeSessionId;return he?(fe.setSessionId(he),fe.send({type:"command_execute",sessionId:he,data:JSON.stringify({command:`/${K}`,args:ne||""})}),{success:!0,message:t("slashCommands.sent_command")+`/${K}`}):{success:!1,message:t("slashCommands.noActiveSession")}},[t]),M=_.useMemo(()=>[{id:"chat",name:"chat",description:t("slashCommands.chat_desc"),icon:"💬",local:!0,action:()=>(s("chat"),{success:!0,message:t("slashCommands.chat_result")})},{id:"terminal",name:"terminal",description:t("slashCommands.terminal_desc"),icon:"💻",local:!0,action:()=>(s("terminal"),{success:!0,message:t("slashCommands.terminal_result")})},{id:"files",name:"files",description:t("slashCommands.files_desc"),icon:"📁",local:!0,action:()=>(s("files"),{success:!0,message:t("slashCommands.files_result")})},{id:"models",name:"models",description:t("slashCommands.models_desc"),icon:"🧠",local:!0,action:()=>(s("models"),{success:!0,message:t("slashCommands.models_result")})},{id:"tools",name:"tools",description:t("slashCommands.tools_desc"),icon:"🔧",local:!0,action:()=>(s("tools"),{success:!0,message:t("slashCommands.tools_result")})},{id:"skills",name:"skills",description:t("slashCommands.skills_desc"),icon:"🎯",local:!0,action:()=>(s("skills"),{success:!0,message:t("slashCommands.skills_result")})},{id:"settings",name:"settings",description:t("slashCommands.settings_desc"),icon:"⚙️",local:!0,action:()=>(s("settings"),{success:!0,message:t("slashCommands.settings_result")})},{id:"logs",name:"logs",description:t("slashCommands.logs_desc"),icon:"📜",local:!0,action:()=>(s("logs"),g(0),{success:!0,message:t("slashCommands.logs_result")})},{id:"new",name:"new",description:t("slashCommands.new_desc"),icon:"✨",local:!0,action:()=>(i(),{success:!0,message:t("slashCommands.new_result")})},{id:"clear",name:"clear",description:t("slashCommands.clear_desc"),icon:"🗑️",local:!0,action:()=>(o(),{success:!0,message:t("slashCommands.clear_result")})},{id:"theme",name:"theme",description:t("slashCommands.theme_desc"),args:"<dark|light|auto|preset-name>",icon:"🎨",local:!0,action:K=>{const ne=K.trim().toLowerCase();if(["dark","light","auto"].includes(ne))return c(ne),{success:!0,message:t("slashCommands.theme_result")+ne};if(fo[ne])return u?(u(ne),{success:!0,message:t("slashCommands.theme_preset_result")+fo[ne].nameKey}):{success:!1,message:t("slashCommands.theme_preset_unavailable")};const he=Object.keys(fo).join("|");return{success:!1,message:t("slashCommands.theme_error",{presets:he})}}},{id:"terminal-toggle",name:"terminal-toggle",description:t("slashCommands.toggle_terminal_desc"),icon:"🔲",local:!0,action:()=>(d(),{success:!0,message:t("slashCommands.toggle_terminal_result")})},{id:"clear-logs",name:"clear-logs",description:t("slashCommands.logs_clear_desc"),icon:"📭",local:!0,action:()=>(p([]),g(0),{success:!0,message:t("slashCommands.logs_clear_result")})},{id:"doctor",name:"doctor",description:t("slashCommands.doctor_desc"),icon:"🩺",local:!1,action:()=>B("doctor")},{id:"compact",name:"compact",description:t("slashCommands.compact_desc"),args:"[aggressive|summary]",icon:"🗜️",local:!1,action:K=>B("compact",K)},{id:"help",name:"help",description:t("slashCommands.help_desc"),icon:"❓",local:!1,action:()=>B("help")},{id:"cost",name:"cost",description:t("slashCommands.token_desc"),args:"[detail|reset]",icon:"💰",local:!1,action:K=>B("cost",K)},{id:"model",name:"model",description:t("slashCommands.model_desc"),args:"[model-name]",icon:"🤖",local:!1,action:K=>B("model",K)},{id:"status",name:"status",description:t("slashCommands.status_desc"),icon:"📊",local:!1,action:()=>B("status")},{id:"config",name:"config",description:t("slashCommands.config_desc"),args:"<get|set|list|delete> [key] [value]",icon:"🔧",local:!1,action:K=>B("config",K)},{id:"exit",name:"exit",description:t("slashCommands.exit_desc"),icon:"🚪",local:!1,action:()=>{const K=Te.getState().activeSessionId;return K&&(fe.setSessionId(K),fe.send({type:"exit",sessionId:K})),{success:!0,message:t("slashCommands.exit_result")}}},{id:"test",name:"test",description:t("slashCommands.benchmark_desc"),args:"[simple|medium|complex|full|list]",icon:"🧪",local:!1,action:K=>B("test",K)}],[s,i,o,c,u,d,p,g,B,t]),j=_.useMemo(()=>b.map(K=>{const ne=t(`slashCommands.${K.name}_desc`,K.description||K.usage||"");return{id:`backend-${K.name}`,name:K.name,description:ne,icon:"🔌",local:!1,action:he=>{const L=Te.getState().activeSessionId;return L?(fe.setSessionId(L),fe.send({type:"command_execute",sessionId:L,data:JSON.stringify({command:`/${K.name}`,args:he||""})}),{success:!0,message:t("slashCommands.sent_command")+`/${K.name}`}):{success:!1,message:t("slashCommands.noActiveSession")}}}}),[b,t]),J=_.useMemo(()=>{const K=new Set;return[...M,...j].filter(ne=>K.has(ne.name)?!1:(K.add(ne.name),!0))},[M,j]),Y=_.useMemo(()=>{if(!k)return J;const K=k.toLowerCase();return J.filter(ne=>ne.name.toLowerCase().includes(K)||ne.description.toLowerCase().includes(K))},[J,k]),te=_.useCallback(()=>{S(!0),C(""),E(0)},[]),se=_.useCallback(()=>{S(!1),C(""),E(0)},[]),ge=_.useCallback(()=>{E(K=>K>=Y.length-1?0:K+1)},[Y.length]),Ke=_.useCallback(()=>{E(K=>K<=0?Y.length-1:K-1)},[Y.length]),de=_.useCallback((K,ne)=>{const he=K.action(ne);return se(),he},[se]);return _.useEffect(()=>{if(x&&A.current){const K=A.current.querySelector(`[data-index="${T}"]`);K&&K.scrollIntoView({block:"nearest"})}},[T,x]),{isOpen:x,filter:k,setFilter:C,selectedIndex:T,setSelectedIndex:E,filteredCommands:Y,allCommands:J,openMenu:te,closeMenu:se,selectNext:ge,selectPrev:Ke,executeCommand:de,containerRef:A,commands:M}}function oR(a){const t=a.trim();if(!t.startsWith("/"))return null;const i=t.slice(1).split(/\s+/),o=i[0]||"",c=i.slice(1).join(" ");return{command:o,args:c}}function PA({open:a,onClose:t,options:s}){const{t:i}=Je(),{filter:o,setFilter:c,filteredCommands:u,selectedIndex:d,setSelectedIndex:p,selectNext:g,selectPrev:y,executeCommand:b,openMenu:x,closeMenu:S}=HA(s),k=_.useRef(null),C=_.useRef(null),[T,E]=_.useState(!1);if(_.useEffect(()=>{a?(x(),E(!1),setTimeout(()=>{var M;return(M=k.current)==null?void 0:M.focus()},0)):S()},[a,x,S]),_.useEffect(()=>{if(!a||!C.current)return;const M=C.current.querySelector(`[data-cmd-index="${d}"]`);M&&M.scrollIntoView({block:"nearest"})},[d,a]),!a)return null;const A=M=>{M.local||(E(!0),_e.info(i("palette.running")));const j=b(M,"");M.local&&(j!=null&&j.message)&&_e.success(j.message),t()},B=M=>{if(M.key==="ArrowDown")M.preventDefault(),g();else if(M.key==="ArrowUp")M.preventDefault(),y();else if(M.key==="Enter"){M.preventDefault();const j=u[d];j&&A(j)}else M.key==="Escape"&&(M.preventDefault(),t())};return m.jsx("div",{className:"fixed inset-0 z-[100] flex items-start justify-center bg-black/50 backdrop-blur-sm pt-[12vh] px-4 animate-fade-in",onClick:t,role:"dialog","aria-modal":"true","aria-label":i("a11y.commandPalette"),children:m.jsxs("div",{className:"w-full max-w-xl bg-dark-surface border border-dark-border rounded-xl shadow-2xl overflow-hidden",onClick:M=>M.stopPropagation(),children:[m.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-dark-border",children:[m.jsx(Eb,{size:16,className:"text-dark-muted shrink-0","aria-hidden":"true"}),m.jsx("input",{ref:k,value:o,onChange:M=>{c(M.target.value),p(0)},onKeyDown:B,placeholder:i("palette.placeholder"),"aria-label":i("palette.placeholder"),className:"flex-1 bg-transparent text-sm text-dark-text placeholder-dark-muted outline-none"}),T&&m.jsx("span",{className:"text-[10px] text-accent-blue animate-pulse-soft shrink-0",children:i("palette.running")})]}),m.jsx("div",{ref:C,className:"max-h-[50vh] overflow-y-auto custom-scrollbar py-1",children:u.length===0?m.jsx("div",{className:"px-4 py-8 text-center text-sm text-dark-muted",children:i("palette.empty")}):u.map((M,j)=>m.jsxs("button",{"data-cmd-index":j,onClick:()=>A(M),onMouseEnter:()=>p(j),className:`w-full px-4 py-2.5 flex items-center gap-3 text-left transition-colors ${j===d?"bg-accent-blue/10 border-l-2 border-accent-blue":"border-l-2 border-transparent hover:bg-dark-hover"}`,children:[m.jsx("span",{className:"text-lg shrink-0","aria-hidden":"true",children:M.icon}),m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsxs("span",{className:"text-sm font-medium text-dark-text",children:["/",M.name]}),M.args&&m.jsx("span",{className:"text-xs text-dark-muted",children:M.args}),!M.local&&m.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-accent-blue/20 text-accent-blue shrink-0",children:i("slashCommands.backend")})]}),m.jsx("div",{className:"text-xs text-dark-muted truncate",children:M.description})]}),j===d&&m.jsx(t0,{size:14,className:"text-dark-muted shrink-0","aria-hidden":"true"})]},M.id))}),m.jsx("div",{className:"px-4 py-2 border-t border-dark-border text-[10px] text-dark-muted bg-dark-bg",children:i("palette.hint")})]})})}function Os({keys:a,label:t}){return m.jsxs("div",{className:"flex items-center justify-between py-2 border-b border-dark-border/50 last:border-0",children:[m.jsx("span",{className:"text-sm text-dark-text",children:t}),m.jsx("span",{className:"flex items-center gap-1",children:a.map(s=>m.jsx("kbd",{className:"px-2 py-0.5 text-xs font-mono bg-dark-bg rounded border border-dark-border text-dark-muted",children:s},s))})]})}function FA({open:a,onClose:t}){const{t:s}=Je(),i=navigator.platform.toLowerCase().includes("mac")?"⌘":"Ctrl";return m.jsx(Yf,{isOpen:a,onClose:t,title:s("shortcuts.title"),size:"md",children:m.jsxs("div",{className:"space-y-0.5",children:[m.jsx(Os,{keys:[i,"K"],label:s("shortcuts.commandPalette")}),m.jsx(Os,{keys:[i,"L"],label:s("shortcuts.clearLogs")}),m.jsx(Os,{keys:[i,"/"],label:s("shortcuts.help")}),m.jsx(Os,{keys:[i,"Enter"],label:s("shortcuts.submit")}),m.jsx(Os,{keys:["Shift","Enter"],label:s("shortcuts.newline")}),m.jsx(Os,{keys:["/"],label:s("shortcuts.slashCommand")}),m.jsx(Os,{keys:["@"],label:s("shortcuts.fileRef")}),m.jsx(Os,{keys:["Esc"],label:s("shortcuts.closeDialog")}),m.jsx(Os,{keys:["Esc","Esc"],label:s("shortcuts.stopGen")})]})})}function GA({isOpen:a,onClose:t,title:s,collapsedSummary:i,badge:o,children:c,maxHeight:u="45vh",onExpandedChange:d,className:p}){const{t:g}=Je(),[y,b]=_.useState(!0);_.useEffect(()=>{a&&b(!0)},[a]),_.useEffect(()=>{d==null||d(y)},[y,d]);const x=_.useCallback(()=>{b(S=>!S)},[]);return a?m.jsxs("div",{className:vt("shrink-0 bg-dark-surface/95 backdrop-blur border-t border-dark-border shadow-[0_-10px_30px_-15px_rgba(0,0,0,0.5)]",p),children:[m.jsxs("div",{role:"button","aria-expanded":y,tabIndex:0,onClick:x,onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),x())},title:g(y?"commonUi.drawerCollapseTitle":"commonUi.drawerExpandTitle"),className:vt("flex items-center gap-2 px-4 py-2 cursor-pointer select-none transition-colors","hover:bg-dark-hover/60"),children:[m.jsx("span",{className:vt("shrink-0 text-dark-muted transition-transform duration-200",!y&&"rotate-180"),children:m.jsx(ba,{size:16})}),m.jsxs("div",{className:"min-w-0 flex-1 flex items-center gap-2",children:[m.jsx("span",{className:"text-sm font-semibold text-dark-text truncate",children:s}),o,!y&&i&&m.jsx("span",{className:"min-w-0 flex items-center gap-1.5 text-xs text-dark-muted truncate",children:i})]}),m.jsx("button",{type:"button","aria-label":g("common.close"),onClick:S=>{S.stopPropagation(),t()},className:"shrink-0 p-1 rounded-md text-dark-muted hover:text-dark-text hover:bg-dark-hover transition-colors",children:m.jsx(ss,{size:15})})]}),y&&m.jsx("div",{className:"animate-slide-up border-t border-dark-border/60 overflow-y-auto custom-scrollbar p-4",style:{maxHeight:u},children:c})]}):null}const qA=_.lazy(()=>un(()=>import("./ModelsView-DVTuTql9.js"),__vite__mapDeps([0,1,2,3,4,5])).then(a=>({default:a.ModelsView}))),WA=_.lazy(()=>un(()=>import("./ToolsView-lOHdaw4V.js"),__vite__mapDeps([6,1,2,3,4,5])).then(a=>({default:a.ToolsView}))),VA=_.lazy(()=>un(()=>import("./SkillsView-BAorWQAI.js"),__vite__mapDeps([7,1,2,3,4,5])).then(a=>({default:a.SkillsView}))),KA=_.lazy(()=>un(()=>import("./TemplatesTab-DEblm2pS.js"),__vite__mapDeps([8,1,2,3,4,5])).then(a=>({default:a.TemplatesTab}))),YA=_.lazy(()=>un(()=>import("./HookConfigView-DE0NCrV9.js"),__vite__mapDeps([9,1,2,4,3,5])).then(a=>({default:a.HookConfigView}))),ZA=_.lazy(()=>un(()=>import("./FileTreeView-DLRQZmLP.js"),__vite__mapDeps([10,1,2,3,4,5])).then(a=>({default:a.FileTreeView}))),QA=_.lazy(()=>un(()=>import("./TerminalView-Cnnipr8e.js"),__vite__mapDeps([11,1,2,12,3,4,5,13])).then(a=>({default:a.TerminalView}))),XA=_.lazy(()=>un(()=>import("./SessionGrid-ByIAFTc2.js"),__vite__mapDeps([14,1,2,3,4,5])).then(a=>({default:a.SessionGrid}))),JA=_.lazy(()=>un(()=>import("./SettingsPanel-CHRy0Xqj.js"),__vite__mapDeps([15,1,2,3,4,5])).then(a=>({default:a.SettingsPanel}))),ej=_.lazy(()=>un(()=>import("./ChannelConfigView-BcGUdK94.js"),__vite__mapDeps([16,1,2,3,4,5])).then(a=>({default:a.ChannelConfigView}))),tj=_.lazy(()=>un(()=>import("./ConnectorsView-Dadj20jv.js"),__vite__mapDeps([17,1,2,3,4,5])).then(a=>({default:a.ConnectorsView}))),nj=_.lazy(()=>un(()=>import("./AutomationView-ClGqJM46.js"),__vite__mapDeps([18,1,2,3,4,5])).then(a=>({default:a.AutomationView}))),sj=_.lazy(()=>un(()=>import("./PluginsView-DBF_BvKL.js"),__vite__mapDeps([19,1,2,3,4,5])).then(a=>({default:a.PluginsView}))),aj=_.lazy(()=>un(()=>Promise.resolve().then(()=>Vw),void 0).then(a=>({default:a.PluginTabContainer}))),ij=()=>m.jsx("div",{className:"flex-1 flex items-center justify-center bg-dark-bg",children:m.jsx("div",{className:"w-5 h-5 border-2 border-accent-blue border-t-transparent rounded-full animate-spin"})}),Qf=[{id:"chat",labelKey:"nav.chat",icon:yc},{id:"terminal",labelKey:"nav.terminal",icon:n0},{id:"files",labelKey:"nav.files",icon:s0},{id:"models",labelKey:"nav.models",icon:a0},{id:"tools",labelKey:"nav.tools",icon:i0},{id:"skills",labelKey:"nav.skills",icon:r0},{id:"templates",labelKey:"nav.templates",icon:tc},{id:"hooks",labelKey:"nav.hooks",icon:o0},{id:"channels",labelKey:"nav.channels",icon:l0},{id:"connectors",labelKey:"nav.connectors",icon:c0},{id:"scheduled",labelKey:"nav.scheduled",icon:u0},{id:"logs",labelKey:"nav.logs",icon:ao},{id:"settings",labelKey:"nav.settings",icon:d0},{id:"plugins",labelKey:"nav.plugins",icon:jb}],Jd=Object.fromEntries(Qf.map(a=>[a.id,a.labelKey])),rj=Qf.map(a=>({id:a.id,title:a.labelKey})),ub=Object.fromEntries(Qf.map(a=>[a.id,a.icon]));function oj(){const[a,t]=_.useState("chat"),[s,i]=_.useState(!1),[o,c]=_.useState([]),[,u]=_.useState(0),[d,p]=_.useState(!1),[g,y]=_.useState(!1),[b,x]=_.useState(!1),[S,k]=_.useState(null),[C,T]=_.useState(!1),[E,A]=_.useState(!1),[B,M]=_.useState({}),[j,J]=_.useState(!1),[Y,te]=_.useState(null),[se,ge]=_.useState(!1),Ke=_.useRef(null),de=_.useRef(null),[K,ne]=_.useState(()=>localStorage.getItem("dsc-sidebar-collapsed")==="1"),he=_.useCallback(()=>{ne(O=>(localStorage.setItem("dsc-sidebar-collapsed",O?"0":"1"),!O))},[]),L=_.useCallback(()=>{J(O=>!O),ge(!1)},[]),Z=_.useCallback(()=>{const O=Ke.current;O&&(se?O.resize(de.current??20):(de.current=O.getSize(),O.resize(68)),ge(F=>!F))},[se]);_.useEffect(()=>{const O=window.matchMedia("(min-width: 1400px)"),F=X=>{X.matches||J(!1)};return O.addEventListener("change",F),()=>O.removeEventListener("change",F)},[]);const{t:W,i18n:Be}=Je(),{toggleTerminal:Le}=Tk(),{theme:ze,setTheme:Ee,setThemePreset:ke,language:st,workspaceDir:lt,setWorkspaceDir:Zt,effort:dn}=qa(),fn=Ds();_.useEffect(()=>{st&&Be.language!==st&&Be.changeLanguage(st)},[st,Be]);const wn=_.useMemo(()=>rj.filter(O=>!(O.id==="terminal"&&S===!1)),[S]),[os,ls]=_.useState([]);_.useEffect(()=>{let O=!1;return $.get("/api/plugins/ui").then(F=>{var X;O||ls((((X=F==null?void 0:F.data)==null?void 0:X.ui)??[]).filter(pe=>pe.mount==="tab"))}).catch(()=>{}),()=>{O=!0}},[]);const cs=O=>`plugin:${O.pluginId}:${O.id}`,Is=_.useMemo(()=>[...wn.map(O=>({...O,iconComponent:ub[O.id]})),...os.map(O=>({id:cs(O),title:O.title,icon:O.icon,iconComponent:ub[O.icon??""]??jb}))],[wn,os]),at=_.useCallback(O=>{_.startTransition(()=>{t(O)})},[]),[Q,We]=_.useState(null),we=_.useCallback(O=>{We({section:O,nonce:Date.now()})},[]);_.useEffect(()=>{const O=X=>{const pe=X.message||W("common.unknownError"),ve=X.filename||"global";ve.includes("chrome-extension://")||ve.includes("moz-extension://")||c(Ve=>[...Ve,{id:`error-${Date.now()}-${ns()}`,level:"error",source:"Browser",message:`${W("toast.uncaughtError")}${pe}`,timestamp:Date.now()}].slice(-500))},F=X=>{var ve;const pe=((ve=X.reason)==null?void 0:ve.message)||X.reason||W("toast.unknownReason");c(Ve=>[...Ve,{id:`rejection-${Date.now()}-${ns()}`,level:"error",source:"Promise",message:`${W("toast.uncaughtRejection")}${pe}`,timestamp:Date.now()}].slice(-500))};return window.addEventListener("error",O),window.addEventListener("unhandledrejection",F),()=>{window.removeEventListener("error",O),window.removeEventListener("unhandledrejection",F)}},[W]);const{sessionTabs:be,activeSessionId:ie,setActiveSession:Ae,addSessionTab:ct,closeSessionTab:Ot,renameSessionTab:_t,getVisibleSessionTabs:tt,autoNameSession:nn,touchSession:$s}=Te(),Va=ie?B[ie]??!0:!0,Hs=Qe(O=>ie?Object.keys(O.tasksBySession[ie]||{}).length:0),Co=_.useCallback(()=>{M(O=>ie?{...O,[ie]:!(O[ie]??!0)}:O)},[ie]),[Vt,kc]=_.useState(()=>typeof window<"u"&&window.innerWidth<768);_.useEffect(()=>{const O=window.matchMedia("(max-width: 767px)"),F=X=>kc(X.matches);return O.addEventListener("change",F),()=>O.removeEventListener("change",F)},[]);const pn=Qe(O=>ie?O.getForSession(ie):void 0),Ps=_.useRef(null),Kt=_.useRef(null);_.useEffect(()=>{if(Vt)return;const O=pn&&["RUNNING","RESUMING","PAUSED"].includes(String(pn.status)),F=Hs>0;O&&pn&&Ps.current!==pn.runId?(Ps.current=pn.runId,J(!0)):F&&Kt.current!==ie&&(Kt.current=ie??null,J(!0))},[pn==null?void 0:pn.runId,pn==null?void 0:pn.status,Hs,ie,Vt]);const mn=en(O=>{var F;return ie?((F=O.bySession[ie])==null?void 0:F.artifacts.length)??0:0}),It=_.useRef({sessionId:null,count:0});_.useEffect(()=>{const O=It.current;if(ie!==O.sessionId){It.current={sessionId:ie??null,count:mn};return}!Vt&&mn>O.count&&J(!0),It.current={sessionId:ie??null,count:Math.max(mn,O.count)}},[mn,ie,Vt]);const{clearMessages:_o}=Ce(),To=Ce(O=>ie?O.messagesBySession[ie]||[]:[]),{customTheme:wc,customThemeEnabled:Ka,themePresetId:Ya}=qa();wA({theme:ze,themePresetId:Ya,customTheme:wc,customThemeEnabled:Ka}),SA({activeTab:a,setLogs:c,setUnreadLogs:u}),_.useEffect(()=>{$.get("/api/terminal/status").then(O=>k(O.success&&O.data?O.data.ttydAvailable!==!1:!1)).catch(()=>k(!1))},[]),_.useEffect(()=>{const O=F=>{const X=F.detail,pe=typeof X=="string"?X:X==null?void 0:X.tab,ve=typeof X=="string"||X==null?void 0:X.section;pe&&pe!==a&&at(pe),pe==="settings"&&ve&&we(ve)};return window.addEventListener("switch-tab",O),()=>window.removeEventListener("switch-tab",O)},[a,at,we]),_.useEffect(()=>{const O=F=>{var pe;const X=(pe=F.detail)==null?void 0:pe.path;X&&(te(X),J(!0))};return window.addEventListener("preview-file",O),()=>window.removeEventListener("preview-file",O)},[]);const us=_.useCallback(()=>{const O=window.location.hash.replace(/^#\/?/,"");if(!O)return;const[F,X]=O.split("/");F&&F in Jd&&at(F),F==="settings"&&X==="stt"&&we("stt")},[at,we]);_.useEffect(()=>(us(),window.addEventListener("hashchange",us),()=>window.removeEventListener("hashchange",us)),[us]);const Un=_.useRef(s);_.useEffect(()=>{const O=fe.onOpen(()=>{Un.current=!0,i(!0),_e.success(W("toast.backendConnected"))}),F=fe.onClose(()=>{const X=Un.current;Un.current=!1,i(!1),X&&_e.warning(W("toast.backendDisconnected"))});return()=>{O(),F()}},[W]);const Za=_.useCallback(async()=>{try{const O=await Ge.sessions.list();if(!O.success||!Array.isArray(O.data))return!1;const F=TA(O.data);if(F.length===0)return!1;const X=F[0],pe=ve=>({id:ve.id,title:ve.title,createdAt:ve.createdAt,lastActiveAt:ve.lastActiveAt,preview:ve.preview,status:"done"});return Te.setState(ve=>{const Ve=ve.sessionTabs.some(je=>je.id===X.id)?ve.sessionTabs:[pe(X),...ve.sessionTabs].slice(0,mf),it=new Set(Ve.map(je=>je.id));let Bt=[...F.map(pe).filter(je=>!it.has(je.id)),...ve.historySessions.filter(je=>!F.some(Yt=>Yt.id===je.id))].slice(0,Math.max(0,Ib-Ve.length));const ut=[...F.map(je=>({id:je.id,title:je.title,createdAt:new Date(je.createdAt).toISOString(),updatedAt:new Date(je.lastActiveAt??je.createdAt).toISOString(),messageCount:je.messageCount??0})),...ve.sessions.filter(je=>!F.some(Yt=>Yt.id===je.id))];return{sessionTabs:Ve,historySessions:Bt,sessions:ut,activeSessionId:X.id}}),!0}catch{return!1}},[]);_.useEffect(()=>{if(Te.getState().sessionTabs.length>0)return;let O=!1;return Za().then(F=>{O||F||ct(W("chat.defaultSessionTitle",{n:1}))}),()=>{O=!0}},[]),_.useEffect(()=>{const O=()=>y(!0);return window.addEventListener("hook-approval-required",O),()=>window.removeEventListener("hook-approval-required",O)},[]);const Fs=_.useRef(ie);_.useEffect(()=>{Fs.current=ie},[ie]);const Qa=_.useCallback(O=>{var pe,ve,Ve;if(!O)return!1;const F=window,X=(pe=F.__pendingQuestions)==null?void 0:pe[O];return X?(ve=F.__answeredQuestionIds)!=null&&ve.has(X.questionId)?(delete F.__pendingQuestions[O],((Ve=F.__pendingQuestion)==null?void 0:Ve.questionId)===X.questionId&&(F.__pendingQuestion=null),!1):(F.__pendingQuestion=X,x(!0),!0):!1},[]);_.useEffect(()=>{const O=F=>{const X=F.detail||Fs.current;Qa(X)};return window.addEventListener("ask-question-required",O),()=>window.removeEventListener("ask-question-required",O)},[Qa]),_.useEffect(()=>{ie&&Qa(ie)},[ie,Qa]);const No=_.useCallback(()=>{var X;const O=window,F=O.__pendingQuestion;if(F!=null&&F.questionId){O.__answeredQuestionIds=O.__answeredQuestionIds||new Set,O.__answeredQuestionIds.add(F.questionId);const pe=O.__pendingQuestions||{};for(const ve of Object.keys(pe))((X=pe[ve])==null?void 0:X.questionId)===F.questionId&&delete pe[ve];O.__pendingQuestion=null}x(!1)},[]);_.useEffect(()=>{fn.autoMode&&fn.pendingApprovals.length>0&&y(!1),fn.pendingApprovals.length>0&&!fn.autoMode&&y(!0)},[fn.autoMode,fn.pendingApprovals.length]);const Xa=_.useRef(0);_.useEffect(()=>{const O=F=>{var ut,je;if(F.key!=="Escape"||F.defaultPrevented)return;const X=(ut=F.target)==null?void 0:ut.tagName;if(X==="INPUT"||X==="TEXTAREA"||(je=F.target)!=null&&je.isContentEditable)return;const pe=Ce.getState(),Ve=Te.getState().activeSessionId;if(!Ve||!pe.isGenerating(Ve))return;F.preventDefault();const it=Date.now(),Bt=Xa.current;Xa.current=it,Bt>0&&it-Bt<500?(fe.send({type:"stop",sessionId:Ve}),_e.info(W("toast.terminated"))):(fe.send({type:"pause",sessionId:Ve}),_e.info(W("toast.paused")))};return window.addEventListener("keydown",O),()=>window.removeEventListener("keydown",O)},[W]);const[ds,Eo]=_.useState(!1),fs=_.useCallback(()=>{_.startTransition(()=>{const O=ct(void 0,lt);fe.setSessionId(O),Pi.getState().setMode("auto-act"),at("chat")})},[ct,lt,at]),Ao=_.useCallback(O=>{_.startTransition(()=>{const F=Te.getState();let X=F.activeSessionId;X||(X=F.addSessionTab(void 0,lt),fe.setSessionId(X)),Ce.getState().setSessionInput(X,`$${O.id} `),at("chat")})},[lt,at]),Ja=_.useCallback(()=>at("templates"),[at]),Sa=_.useCallback(async(O,F)=>{var Bt;const X=await Ge.templates.render(O.id,F);if(!X.success||!X.data){_e.error(X.error||"模板渲染失败");return}const pe=X.data,ve=ct(O.name,lt);fe.setSessionId(ve),Pi.getState().setMode("auto-act"),at("chat");const Ve=`wf-${Date.now()}-${ns()}`;Qe.getState().upsert(ve,{runId:Ve,status:"RUNNING",completedPhases:0,totalPhases:((Bt=pe.nodes)==null?void 0:Bt.length)??0,completedEffects:0,totalEffects:0,tokensUsed:0,tokensRemaining:0,lastEventType:"workflow_start"});const it=await Ge.workflows.start({sessionId:ve,runId:Ve,workflow:pe,message:`[模板] ${O.name}`});if(!it.success||!it.data){_e.error(it.error||"工作流启动失败"),Qe.getState().fail(ve,Ve,it.error||"启动失败");return}if(it.data.status==="FAILED"){const ut=it.data.error||"模板定义无效";_e.error(`工作流启动失败: ${ut}`),Qe.getState().fail(ve,Ve,ut)}},[ct,lt,at]),Qi=_.useCallback(async()=>{if(ds||!ie)return;const O=Qe.getState().getForSession(ie),F=O==null?void 0:O.runId;if(!F){_e.info("当前会话没有可保存的工作流运行");return}Eo(!0),_e.info("正在泛化为模板…");try{const X=await Ge.templates.createFromRun(F,{generalize:!0});X.success&&X.data?X.data.degraded?_e.warning(`已保存为模板「${X.data.name}」(v${X.data.version}),但 LLM 泛化失败,已原样保存${X.data.degradeReason?`:${X.data.degradeReason}`:""}`):_e.success(`已保存为模板「${X.data.name}」(v${X.data.version})`):_e.error(X.error||"保存模板失败")}finally{Eo(!1)}},[ie,ds]),Xi=_.useRef(0),Ji=_.useCallback(async O=>{if(!O)return;const F=++Xi.current;try{const X=await Ge.sessions.resume(O);if(F!==Xi.current||!X.success||!X.data)return;const pe=X.data;pe.session&&Te.getState().updateSession(O,pe.session);const ve=pe.messages||[];if(ve.length>0){const Ve=ve.flatMap(ut=>ut.type!=="user"&&ut.type!=="assistant"&&ut.type!=="system"?[]:[{id:ut.id||`msg-${ut.timestamp||Date.now()}`,type:ut.type,content:ut.content||"",timestamp:ut.timestamp||Date.now(),thinking:ut.thinking||void 0}]);Ce.getState().replaceMessages(O,Ve);const it=ve.find(ut=>ut.type==="user"),Bt=typeof(it==null?void 0:it.content)=="string"?it.content.replace(/\s+/g," ").trim():"";Te.getState().touchSession(O,Bt||void 0)}}catch{}},[]),In=_.useCallback(O=>{Ae(O),fe.setSessionId(O)},[Ae]),Tt=_.useCallback(O=>{Ot(O)},[Ot]),$t=_.useCallback((O,F)=>{_t(O,F)},[_t]),Vn=_.useCallback(()=>{ie&&_o(ie)},[ie,_o]);_.useEffect(()=>{if(!ie)return;const O=Ce.getState().messagesBySession[ie];O&&O.length>0&&De.getState().recalculateFromMessages(O)},[ie]),_.useEffect(()=>{if(!ie)return;Ce.getState().getMessages(ie).length===0&&Ji(ie)},[ie,Ji]);const ka=_.useCallback(async(O,F,X,pe,ve)=>{if(!F.trim())return;Ce.getState().isGenerating(O)&&(console.warn(`[sendMessage] Session ${O} stuck in generating state — force-ending`),Ce.getState().endGeneration(O,"Force-ended: new message"));const it=Pi.getState();Ce.getState().resumeGeneration(O),fe.setSessionId(O),Ce.getState().getMessages(O).some(Cn=>Cn.type==="user")?$s(O):(nn(O,F.trim()),$s(O,F.trim()));let je=F.trim();if(X&&X.length>0){const Cn=[],Ro=[...X].sort((_n,ms)=>ms.length-_n.length);for(const _n of Ro){je=je.split(`@${_n}`).join("").trim();try{const ms=await Ge.files.read(_n),Xt=ms.success&&ms.data?ms.data:null;if(Xt){const sr=_n.split(".").pop()||"";Cn.push(`<context ref="${_n}">
63
- \`\`\`${sr}
64
- ${Xt}
65
- \`\`\`
66
- </context>`)}}catch(ms){console.warn(`Failed to read @-referenced file: ${_n}`,ms)}}Cn.length>0&&(je=Cn.join(`
67
-
68
- `)+`
69
-
70
- `+je.trim(),je=je.trim())}ve!=null&&ve.skipAddUserMessage||Ce.getState().addMessage(O,{id:`msg-${Date.now()}`,type:"user",content:je,timestamp:Date.now()});const Yt=it.mode,Qt=Bn(Yt==="normal"?"act":Yt),tr=dn==="off"?!1:void 0,nr=pe&&pe.length>0?JSON.stringify({images:pe}):void 0;if(Qt==="plan")fe.send({type:"plan",sessionId:O,message:je,effort:dn,thinking:tr,data:nr});else if(Qt==="goal"){const Cn=`wf-${Date.now()}-${ns()}`;Ce.getState().startGeneration(O),Qe.getState().upsert(O,{runId:Cn,status:"RUNNING",completedPhases:0,totalPhases:0,completedEffects:0,totalEffects:0,tokensUsed:0,tokensRemaining:0,lastEventType:"workflow_start"}),fe.send({type:"workflow_start",sessionId:O,runId:Cn,message:je,projectId:lt,memoryEnabled:!0,checkpointPolicy:"phase-and-token",data:nr})}else fe.send({type:"chat",sessionId:O,message:je,effort:dn,thinking:tr,data:nr})},[nn,$s,lt,dn]),Cc=_.useCallback((O,F)=>{var Bt,ut;const X=Ce.getState(),pe=X.getMessages(O),ve=pe.findIndex(je=>je.id===F);if(ve===-1)return;let Ve=-1;for(let je=ve-1;je>=0;je--)if(((Bt=pe[je])==null?void 0:Bt.type)==="user"){Ve=je;break}if(Ve===-1)return;const it=pe[Ve];(ut=it==null?void 0:it.content)!=null&&ut.trim()&&(X.replaceMessages(O,pe.slice(0,Ve+1)),ka(O,it.content,void 0,void 0,{skipAddUserMessage:!0}))},[ka]),_c=_.useCallback((O,F)=>{Ce.getState().applyTombstone(O,[F]),_e.success(W("chat.messageDeleted"))},[W]),jo=_.useCallback(O=>{const F=Qe.getState().getForSession(O);F&&!["COMPLETED","CANCELLED","ERROR","FAILED"].includes(F.status)?fe.send({type:"workflow_cancel",sessionId:O,runId:F.runId}):fe.send({type:"stop",sessionId:O}),Ce.getState().endGeneration(O)},[]),wa=_.useCallback(O=>{const F=Qe.getState().getForSession(O);F&&["RUNNING","RESUMING"].includes(F.status)?fe.send({type:"workflow_pause",sessionId:O,runId:F.runId}):fe.send({type:"pause",sessionId:O}),Ce.getState().pauseGeneration(O)},[]),er=_.useCallback(O=>{const F=Qe.getState().getForSession(O);F&&F.status==="PAUSED"?fe.send({type:"workflow_resume",sessionId:O,runId:F.runId}):fe.send({type:"resume",sessionId:O}),Ce.getState().resumeGeneration(O)},[]),Gs=_.useCallback(O=>{const F=O.trim();if(!F||F===lt)return;Zt(F),fe.send({type:"workspace",message:F}),Te.getState().sessionTabs.forEach(pe=>{Ce.getState().clearMessages(pe.id)}),Te.setState({sessionTabs:[],sessions:[],sessionWorkspaceDirs:{},activeSessionId:null}),setTimeout(()=>{Te.getState().addSessionTab(W("chat.defaultSessionTitle",{n:1}),F)},0)},[lt,Zt,W]),ps=()=>{c([]),u(0)},Ca=_.useMemo(()=>({setActiveTab:at,createNewSession:fs,clearMessages:Vn,setTheme:Ee,setThemePreset:ke,toggleTerminal:Le,setLogs:c,setUnreadLogs:u}),[at,fs,Vn,Ee,ke,Le]);_.useEffect(()=>{const O=F=>{var Ve,it;const X=F.ctrlKey||F.metaKey,pe=(Ve=F.target)==null?void 0:Ve.tagName,ve=pe==="INPUT"||pe==="TEXTAREA"||((it=F.target)==null?void 0:it.isContentEditable);if(F.key==="Escape"){if(C){F.preventDefault(),T(!1);return}if(E){F.preventDefault(),A(!1);return}if(d){F.preventDefault(),p(!1);return}return}if(X)if(F.key==="k"||F.key==="K")F.preventDefault(),A(!1),T(Bt=>!Bt);else if(F.key==="l"||F.key==="L"){if(ve)return;F.preventDefault(),ps(),_e.success(W("slashCommands.logs_clear_result"))}else F.key==="/"&&(F.preventDefault(),T(!1),A(Bt=>!Bt))};return window.addEventListener("keydown",O),()=>window.removeEventListener("keydown",O)},[C,E,d,W]);const Kn=(O,F)=>Jd[O]?W(Jd[O]):F,Nt=O=>{switch(O){case"chat":{const F=tt(),X=be.find(pe=>pe.id===ie);return m.jsxs("div",{className:"chat-workspace flex flex-col flex-1 min-h-0",children:[m.jsxs("div",{className:"chat-toolbar flex h-12 items-center gap-2 px-3.5 shrink-0 select-none",children:[m.jsxs("div",{className:"min-w-0 flex-1",children:[m.jsx("div",{className:"chat-toolbar-title",children:(X==null?void 0:X.title)||W("nav.chat")}),m.jsxs("div",{className:"chat-toolbar-meta",children:[m.jsx("span",{className:"ui-status-dot","data-status":s?"online":"error"}),W(s?"chat.connected":"chat.disconnected")]})]}),m.jsx("div",{className:"flex-1"}),m.jsx(MA,{}),m.jsx(OA,{onOpenTemplates:Ja,onSaveAsTemplate:()=>void Qi(),saveAsBusy:ds}),Hs>0&&m.jsx("button",{onClick:Vt?Co:L,className:`ui-icon-button transition-colors ${Vt?Va?"bg-accent-blue/10 text-accent-blue":"text-dark-muted hover:bg-dark-hover hover:text-dark-text":j?"bg-accent-blue/10 text-accent-blue":"text-dark-muted hover:bg-dark-hover hover:text-dark-text"}`,title:Vt?"Task Board":"任务看板(右侧)","aria-label":Vt?"Task Board":"任务看板(右侧)","aria-expanded":Vt?Va:j,children:m.jsx(wb,{size:16,"aria-hidden":"true"})}),m.jsx("button",{onClick:L,className:`ui-icon-button transition-colors ${j?"bg-accent-blue/10 text-accent-blue":"text-dark-muted hover:bg-dark-hover hover:text-dark-text"}`,title:"右侧面板","aria-label":"切换右侧面板","aria-expanded":j,children:m.jsx(p0,{size:16,"aria-hidden":"true"})})]}),m.jsx(RA,{sessionId:ie??void 0}),m.jsx(XA,{tabs:F,activeSessionId:ie,onSend:ka,onStop:jo,onPause:wa,onResume:er,activeTab:a,setActiveTab:at,createNewSession:fs,clearMessages:Vn,setTheme:Ee,setThemePreset:ke,toggleTerminal:Le,setLogs:c,setUnreadLogs:u,showTaskBoard:Va&&Vt,onToggleTaskBoard:Co,onRegenerate:Cc,onDeleteMessage:_c,hookDrawerOpen:g,onCloseHookDrawer:()=>y(!1),questionDrawerOpen:b,onCloseQuestionDrawer:No,workspaceDir:lt,onWorkspaceSelect:Gs})]})}case"terminal":return m.jsx(QA,{});case"files":return m.jsx(ZA,{});case"models":return m.jsx(qA,{});case"tools":return m.jsx(WA,{});case"skills":return m.jsx(VA,{onUseSkill:Ao});case"templates":return m.jsx(KA,{onLaunch:Sa});case"hooks":return m.jsx(YA,{});case"channels":return m.jsx(ej,{});case"connectors":return m.jsx(tj,{});case"scheduled":return m.jsx(nj,{});case"logs":return m.jsx(CC,{logs:o,onClear:ps});case"settings":return m.jsx(JA,{onNavigate:at,focusSection:Q});case"plugins":return m.jsx(sj,{});default:if(O.startsWith("plugin:")){const F=os.find(X=>cs(X)===O);if(F)return m.jsx(aj,{contribution:F,hostContext:{sessionId:ie,theme:ze,workspaceDir:lt,wsUrl:Wf()}})}return null}};return m.jsxs(lb,{children:[m.jsxs("div",{className:"app-shell h-screen w-full flex bg-dark-bg text-dark-text overflow-hidden",children:[m.jsx("aside",{className:`workbench-sidebar hidden md:block shrink-0 border-r border-dark-border/70 transition-[width] duration-200 ease-in-out overflow-hidden ${K?"w-14":"w-60"}`,children:m.jsx(Zy,{collapsed:K,onToggleCollapse:he,tabs:Is,activeTab:a,onTabChange:at,isConnected:s,onNewSession:fs,onStartTemplate:Sa,onManageTemplates:Ja,onSwitchSession:In,onCloseSession:Tt,onRenameSession:$t,getTabTitle:Kn})}),d&&m.jsxs("div",{className:"md:hidden fixed inset-0 z-50",children:[m.jsx("div",{className:"absolute inset-0 bg-black/40 backdrop-blur-[2px]",onClick:()=>p(!1)}),m.jsx("aside",{className:"absolute left-0 top-0 h-full w-64 bg-dark-surface border-r border-dark-border shadow-2xl animate-slide-in",children:m.jsx(Zy,{collapsed:!1,onToggleCollapse:()=>p(!1),tabs:Is,activeTab:a,onTabChange:O=>{at(O),p(!1)},isConnected:s,onNewSession:()=>{fs(),p(!1)},onStartTemplate:Sa,onManageTemplates:()=>{Ja(),p(!1)},onSwitchSession:O=>{In(O),p(!1)},onCloseSession:Tt,onRenameSession:$t,getTabTitle:Kn})})]}),m.jsxs("div",{className:"flex-1 flex flex-col min-w-0 min-h-0",children:[m.jsxs("header",{className:"md:hidden h-12 bg-dark-surface border-b border-dark-border flex items-center gap-1 px-2 shrink-0",children:[m.jsx("button",{className:"ui-icon-button",onClick:()=>p(!0),"aria-label":W("a11y.openMenu"),children:m.jsx(f0,{size:18,"aria-hidden":"true"})}),m.jsx("span",{className:"text-sm font-semibold truncate",children:Kn(a,"")}),m.jsx("div",{className:"flex-1"}),a==="chat"&&m.jsx("button",{onClick:fs,className:"ui-icon-button","aria-label":W("chat.newSession"),children:m.jsx(ec,{size:18,"aria-hidden":"true"})})]}),m.jsx("div",{className:"flex-1 flex overflow-hidden min-h-0",children:m.jsxs(Rb,{direction:"horizontal",children:[m.jsx(cf,{id:"chat-main",minSize:30,className:"min-w-0",children:m.jsx("div",{className:"flex h-full flex-col min-w-0 min-h-0",children:m.jsx(_.Suspense,{fallback:m.jsx(ij,{}),children:m.jsx(lb,{children:Nt(a)})})})}),a==="chat"&&j&&!Vt&&m.jsx(Mb,{className:"w-1 bg-dark-border hover:bg-accent-blue transition-colors cursor-col-resize"}),a==="chat"&&j&&!Vt&&m.jsx(cf,{id:"rightrail",ref:Ke,defaultSize:20,minSize:14,maxSize:70,className:"min-w-0",children:m.jsx(uC,{sessionId:ie??"",messages:To,previewFile:Y,onPreview:te,onClosePreview:()=>te(null),isMaximized:se,onToggleMaximize:Z})})]})}),a==="chat"&&j&&Vt&&m.jsx(GA,{isOpen:!0,onClose:()=>J(!1),title:"输出物 · 任务",maxHeight:"60vh",children:m.jsx("div",{className:"h-[52vh]",children:m.jsx(av,{sessionId:ie??"",messages:To,previewFile:Y,onPreview:te,onClosePreview:()=>te(null)})})}),m.jsx(jA,{activeTab:a})]})]}),m.jsx(PA,{open:C,onClose:()=>T(!1),options:Ca}),m.jsx(FA,{open:E,onClose:()=>A(!1)}),m.jsx(LA,{}),m.jsx(IA,{})]})}let Vl=new Set;function lj(a){function t(){s(window)}function s(y){y&&typeof y.addEventListener=="function"&&(y.addEventListener("click",c,!0),y.addEventListener("mousedown",u,!0),y.addEventListener("mouseover",u,!0),y.addEventListener("mouseup",u,!0),y.addEventListener("pointerdown",d,!0),y.addEventListener("pointerover",p,!0),y.addEventListener("pointerup",g,!0))}function i(){o(window),Vl.forEach(y=>{try{o(y.contentWindow)}catch{}}),Vl=new Set}function o(y){y&&typeof y.removeEventListener=="function"&&(y.removeEventListener("click",c,!0),y.removeEventListener("mousedown",u,!0),y.removeEventListener("mouseover",u,!0),y.removeEventListener("mouseup",u,!0),y.removeEventListener("pointerdown",d,!0),y.removeEventListener("pointerover",p,!0),y.removeEventListener("pointerup",g,!0))}function c(y){var b;y.preventDefault(),y.stopPropagation(),i(),(b=a.onClick)===null||b===void 0||b.call(a,y.target)}function u(y){y.preventDefault(),y.stopPropagation()}function d(y){y.preventDefault(),y.stopPropagation()}function p(y){var b;y.preventDefault(),y.stopPropagation();const x=y.target;if(x.tagName==="IFRAME"){const S=x;try{if(!Vl.has(S)){const k=S.contentWindow;s(k),Vl.add(S)}}catch{}}(b=a.onPointerOver)===null||b===void 0||b.call(a,y.target)}function g(y){y.preventDefault(),y.stopPropagation()}return t(),i}const cj=a=>typeof(a==null?void 0:a.type)=="string",dv=a=>{var t;return typeof((t=a==null?void 0:a.type)===null||t===void 0?void 0:t.$$typeof)=="symbol"},uj=a=>{var t;return((t=a==null?void 0:a.type)===null||t===void 0?void 0:t.$$typeof)===Symbol.for("react.forward_ref")},dj=a=>{const t=Object.keys(a).find(s=>s.startsWith("__reactInternalInstance$")||s.startsWith("__reactFiber$"));if(t)return a[t]},Xf=a=>{if(!a)return;const t=dj(a);return t||Xf(a.parentElement)},fj=a=>{let t=a.return;for(;t;){if(!dv(t))return t;t=t.return}return null},fv=a=>{const t=a==null?void 0:a.type;if(!t)return;const{displayName:s,name:i}=t;if(typeof s=="string")return s;if(typeof i=="string")return i},pj=a=>{var t,s;if(!a)return;const i=(t=a._debugSource)!==null&&t!==void 0?t:(s=a._debugOwner)===null||s===void 0?void 0:s._debugSource;if(!i)return;const{fileName:o,lineNumber:c,columnNumber:u}=i;if(o&&c)return{lineNumber:String(c),columnNumber:String(u??1),absolutePath:o.match(/^<.*>$/)?o.replace(/^<|>$/g,""):o}},mj=a=>{if(!(a!=null&&a.pendingProps))return;const{"data-inspector-line":t,"data-inspector-column":s,"data-inspector-relative-path":i}=a.pendingProps;if(t&&s&&i)return{lineNumber:t,columnNumber:s,relativePath:i}},Jf=a=>{const t=[pj(a),mj(a)].filter(Boolean);if(t.length)return Object.assign({},...t)},pv=a=>{if(!a)return;const t=fj(a);if(!t)return;const s=cj(t),i=!t.child.sibling;let o=!s&&i?t:a;const c=o;for(;o;){if(Jf(o))return o;o=o.return}return c},db=a=>{const t=Xf(a),s=pv(t);return Jf(s)},hj=a=>{var t,s;let i=a,o;for(;i;){let c=(t=i.return)!==null&&t!==void 0?t:void 0,u;for(;dv(c);)uj(c)&&(u=c),c=(s=c==null?void 0:c.return)!==null&&s!==void 0?s:void 0;if(u&&(i=u),fv(i)&&(o||(o=i),Jf(i)))return i;i=c}return o},fb=a=>{const t=Xf(a),s=pv(t),i=hj(s),o=fv(i),c=a.nodeName.toLowerCase(),u=o?`${c} in <${o}>`:c;return{fiber:s,name:o,title:u}};function pb(a){return a.getBoundingClientRect()}function gj(a){const t=window.getComputedStyle(a);return{borderLeft:Number.parseInt(t.borderLeftWidth,10),borderRight:Number.parseInt(t.borderRightWidth,10),borderTop:Number.parseInt(t.borderTopWidth,10),borderBottom:Number.parseInt(t.borderBottomWidth,10),marginLeft:Number.parseInt(t.marginLeft,10),marginRight:Number.parseInt(t.marginRight,10),marginTop:Number.parseInt(t.marginTop,10),marginBottom:Number.parseInt(t.marginBottom,10),paddingLeft:Number.parseInt(t.paddingLeft,10),paddingRight:Number.parseInt(t.paddingRight,10),paddingTop:Number.parseInt(t.paddingTop,10),paddingBottom:Number.parseInt(t.paddingBottom,10)}}var ef,mb;function yj(){return mb||(mb=1,ef="/__open-stack-frame-in-editor"),ef}var bj=yj();const hb=Uf(bj),vj=a=>"codeInfo"in a?a.codeInfo:a,xj=a=>{if(!a)return;const t=vj(a),{lineNumber:s,columnNumber:i,relativePath:o,absolutePath:c}=t,u=!!o,d=u?o:c;if(!d){console.error("[react-dev-inspector] Cannot open editor without source fileName",t);return}const p={fileName:d,lineNumber:s,colNumber:i},g=u?`${hb}/relative`:hb;fetch(`${g}?${new URLSearchParams(p)}`)},tf=typeof navigator<"u"?navigator.userAgent.toLowerCase().indexOf("firefox")>0:!1;function nf(a,t,s,i){a.addEventListener?a.addEventListener(t,s,i):a.attachEvent&&a.attachEvent("on".concat(t),s)}function eo(a,t,s,i){a.removeEventListener?a.removeEventListener(t,s,i):a.detachEvent&&a.detachEvent("on".concat(t),s)}function mv(a,t){const s=t.slice(0,t.length-1);for(let i=0;i<s.length;i++)s[i]=a[s[i].toLowerCase()];return s}function hv(a){typeof a!="string"&&(a=""),a=a.replace(/\s/g,"");const t=a.split(",");let s=t.lastIndexOf("");for(;s>=0;)t[s-1]+=",",t.splice(s,1),s=t.lastIndexOf("");return t}function Sj(a,t){const s=a.length>=t.length?a:t,i=a.length>=t.length?t:a;let o=!0;for(let c=0;c<s.length;c++)i.indexOf(s[c])===-1&&(o=!1);return o}const xo={backspace:8,"⌫":8,tab:9,clear:12,enter:13,"↩":13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,arrowup:38,arrowdown:40,arrowleft:37,arrowright:39,del:46,delete:46,ins:45,insert:45,home:36,end:35,pageup:33,pagedown:34,capslock:20,num_0:96,num_1:97,num_2:98,num_3:99,num_4:100,num_5:101,num_6:102,num_7:103,num_8:104,num_9:105,num_multiply:106,num_add:107,num_enter:108,num_subtract:109,num_decimal:110,num_divide:111,"⇪":20,",":188,".":190,"/":191,"`":192,"-":tf?173:189,"=":tf?61:187,";":tf?59:186,"'":222,"{":219,"}":221,"[":219,"]":221,"\\":220},Wn={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":91,cmd:91,meta:91,command:91},so={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},Wt={16:!1,18:!1,17:!1,91:!1},xt={};for(let a=1;a<20;a++)xo["f".concat(a)]=111+a;let bt=[],po=null,gv="all";const Bs=new Map,Zi=a=>xo[a.toLowerCase()]||Wn[a.toLowerCase()]||a.toUpperCase().charCodeAt(0),kj=a=>Object.keys(xo).find(t=>xo[t]===a),wj=a=>Object.keys(Wn).find(t=>Wn[t]===a);function yv(a){gv=a||"all"}function So(){return gv||"all"}function Cj(){return bt.slice(0)}function _j(){return bt.map(a=>kj(a)||wj(a)||String.fromCharCode(a))}function Tj(){const a=[];return Object.keys(xt).forEach(t=>{xt[t].forEach(s=>{let{key:i,scope:o,mods:c,shortcut:u}=s;a.push({scope:o,shortcut:u,mods:c,keys:i.split("+").map(d=>Zi(d))})})}),a}function Nj(a){const t=a.target||a.srcElement,{tagName:s}=t;let i=!0;const o=s==="INPUT"&&!["checkbox","radio","range","button","file","reset","submit","color"].includes(t.type);return(t.isContentEditable||(o||s==="TEXTAREA"||s==="SELECT")&&!t.readOnly)&&(i=!1),i}function Ej(a){return typeof a=="string"&&(a=Zi(a)),bt.indexOf(a)!==-1}function Aj(a,t){let s,i;a||(a=So());for(const o in xt)if(Object.prototype.hasOwnProperty.call(xt,o))for(s=xt[o],i=0;i<s.length;)s[i].scope===a?s.splice(i,1).forEach(u=>{let{element:d}=u;return ep(d)}):i++;So()===a&&yv(t||"all")}function jj(a){let t=a.keyCode||a.which||a.charCode;a.key&&a.key.toLowerCase()==="capslock"&&(t=Zi(a.key));const s=bt.indexOf(t);if(s>=0&&bt.splice(s,1),a.key&&a.key.toLowerCase()==="meta"&&bt.splice(0,bt.length),(t===93||t===224)&&(t=91),t in Wt){Wt[t]=!1;for(const i in Wn)Wn[i]===t&&(Dn[i]=!1)}}function bv(a){if(typeof a>"u")Object.keys(xt).forEach(o=>{Array.isArray(xt[o])&&xt[o].forEach(c=>Kl(c)),delete xt[o]}),ep(null);else if(Array.isArray(a))a.forEach(o=>{o.key&&Kl(o)});else if(typeof a=="object")a.key&&Kl(a);else if(typeof a=="string"){for(var t=arguments.length,s=new Array(t>1?t-1:0),i=1;i<t;i++)s[i-1]=arguments[i];let[o,c]=s;typeof o=="function"&&(c=o,o=""),Kl({key:a,scope:o,method:c,splitKey:"+"})}}const Kl=a=>{let{key:t,scope:s,method:i,splitKey:o="+"}=a;hv(t).forEach(u=>{const d=u.split(o),p=d.length,g=d[p-1],y=g==="*"?"*":Zi(g);if(!xt[y])return;s||(s=So());const b=p>1?mv(Wn,d):[],x=[];xt[y]=xt[y].filter(S=>{const C=(i?S.method===i:!0)&&S.scope===s&&Sj(S.mods,b);return C&&x.push(S.element),!C}),x.forEach(S=>ep(S))})};function gb(a,t,s,i){if(t.element!==i)return;let o;if(t.scope===s||t.scope==="all"){o=t.mods.length>0;for(const c in Wt)Object.prototype.hasOwnProperty.call(Wt,c)&&(!Wt[c]&&t.mods.indexOf(+c)>-1||Wt[c]&&t.mods.indexOf(+c)===-1)&&(o=!1);(t.mods.length===0&&!Wt[16]&&!Wt[18]&&!Wt[17]&&!Wt[91]||o||t.shortcut==="*")&&(t.keys=[],t.keys=t.keys.concat(bt),t.method(a,t)===!1&&(a.preventDefault?a.preventDefault():a.returnValue=!1,a.stopPropagation&&a.stopPropagation(),a.cancelBubble&&(a.cancelBubble=!0)))}}function yb(a,t){const s=xt["*"];let i=a.keyCode||a.which||a.charCode;if(a.key&&a.key.toLowerCase()==="capslock"||!Dn.filter.call(this,a))return;if((i===93||i===224)&&(i=91),bt.indexOf(i)===-1&&i!==229&&bt.push(i),["metaKey","ctrlKey","altKey","shiftKey"].forEach(d=>{const p=so[d];a[d]&&bt.indexOf(p)===-1?bt.push(p):!a[d]&&bt.indexOf(p)>-1?bt.splice(bt.indexOf(p),1):d==="metaKey"&&a[d]&&(bt=bt.filter(g=>g in so||g===i))}),i in Wt){Wt[i]=!0;for(const d in Wn)if(Object.prototype.hasOwnProperty.call(Wn,d)){const p=so[Wn[d]];Dn[d]=a[p]}if(!s)return}for(const d in Wt)Object.prototype.hasOwnProperty.call(Wt,d)&&(Wt[d]=a[so[d]]);a.getModifierState&&!(a.altKey&&!a.ctrlKey)&&a.getModifierState("AltGraph")&&(bt.indexOf(17)===-1&&bt.push(17),bt.indexOf(18)===-1&&bt.push(18),Wt[17]=!0,Wt[18]=!0);const o=So();if(s)for(let d=0;d<s.length;d++)s[d].scope===o&&(a.type==="keydown"&&s[d].keydown||a.type==="keyup"&&s[d].keyup)&&gb(a,s[d],o,t);if(!(i in xt))return;const c=xt[i],u=c.length;for(let d=0;d<u;d++)if((a.type==="keydown"&&c[d].keydown||a.type==="keyup"&&c[d].keyup)&&c[d].key){const p=c[d],{splitKey:g}=p,y=p.key.split(g),b=[];for(let x=0;x<y.length;x++)b.push(Zi(y[x]));b.sort().join("")===bt.sort().join("")&&gb(a,p,o,t)}}function Dn(a,t,s){bt=[];const i=hv(a);let o=[],c="all",u=document,d=0,p=!1,g=!0,y="+",b=!1,x=!1;for(s===void 0&&typeof t=="function"&&(s=t),Object.prototype.toString.call(t)==="[object Object]"&&(t.scope&&(c=t.scope),t.element&&(u=t.element),t.keyup&&(p=t.keyup),t.keydown!==void 0&&(g=t.keydown),t.capture!==void 0&&(b=t.capture),typeof t.splitKey=="string"&&(y=t.splitKey),t.single===!0&&(x=!0)),typeof t=="string"&&(c=t),x&&bv(a,c);d<i.length;d++)a=i[d].split(y),o=[],a.length>1&&(o=mv(Wn,a)),a=a[a.length-1],a=a==="*"?"*":Zi(a),a in xt||(xt[a]=[]),xt[a].push({keyup:p,keydown:g,scope:c,mods:o,shortcut:i[d],method:s,key:i[d],splitKey:y,element:u});if(typeof u<"u"&&window){if(!Bs.has(u)){const S=function(){let C=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.event;return yb(C,u)},k=function(){let C=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.event;yb(C,u),jj(C)};Bs.set(u,{keydownListener:S,keyupListenr:k,capture:b}),nf(u,"keydown",S,b),nf(u,"keyup",k,b)}if(!po){const S=()=>{bt=[]};po={listener:S,capture:b},nf(window,"focus",S,b)}}}function Rj(a){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"all";Object.keys(xt).forEach(s=>{xt[s].filter(o=>o.scope===t&&o.shortcut===a).forEach(o=>{o&&o.method&&o.method()})})}function ep(a){const t=Object.values(xt).flat();if(t.findIndex(i=>{let{element:o}=i;return o===a})<0){const{keydownListener:i,keyupListenr:o,capture:c}=Bs.get(a)||{};i&&o&&(eo(a,"keyup",o,c),eo(a,"keydown",i,c),Bs.delete(a))}if((t.length<=0||Bs.size<=0)&&(Object.keys(Bs).forEach(o=>{const{keydownListener:c,keyupListenr:u,capture:d}=Bs.get(o)||{};c&&u&&(eo(o,"keyup",u,d),eo(o,"keydown",c,d),Bs.delete(o))}),Bs.clear(),Object.keys(xt).forEach(o=>delete xt[o]),po)){const{listener:o,capture:c}=po;eo(window,"focus",o,c),po=null}}const sf={getPressedKeyString:_j,setScope:yv,getScope:So,deleteScope:Aj,getPressedKeyCodes:Cj,getAllKeyCodes:Tj,isPressed:Ej,filter:Nj,trigger:Rj,unbind:bv,keyMap:xo,modifier:Wn,modifierMap:so};for(const a in sf)Object.prototype.hasOwnProperty.call(sf,a)&&(Dn[a]=sf[a]);if(typeof window<"u"){const a=window.hotkeys;Dn.noConflict=t=>(t&&window.hotkeys===Dn&&(window.hotkeys=a),Dn),window.hotkeys=Dn}var af;const Mj=typeof window<"u"&&(!((af=window==null?void 0:window.document)===null||af===void 0)&&af.createElement)?_.useLayoutEffect:_.useEffect,Di=a=>{const t=_.useRef(a);t.current=_.useMemo(()=>a,[a]);const s=_.useRef();return s.current||(s.current=(function(...i){var o;return(o=t.current)===null||o===void 0?void 0:o.apply(this,i)})),s.current},Oj=({disable:a})=>{const t=_.useRef({x:0,y:0}),s=i=>{t.current.x=i.clientX,t.current.y=i.clientY};return _.useEffect(()=>(a||document.addEventListener("mousemove",s,!0),()=>{document.removeEventListener("mousemove",s,!0)}),[a]),t};class Bj{constructor(t,s){Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"border",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"padding",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.node=t.createElement("div"),this.border=t.createElement("div"),this.padding=t.createElement("div"),this.content=t.createElement("div"),this.border.style.borderColor=Yl.border,this.padding.style.borderColor=Yl.padding,this.content.style.backgroundColor=Yl.background,Object.assign(this.node.style,{borderColor:Yl.margin,pointerEvents:"none",position:"fixed"}),this.node.style.zIndex="10000000",this.node.appendChild(this.border),this.border.appendChild(this.padding),this.padding.appendChild(this.content),s.prepend(this.node)}remove(){this.node.parentNode&&this.node.parentNode.removeChild(this.node)}update(t,s){rf(s,"margin",this.node),rf(s,"border",this.border),rf(s,"padding",this.padding),Object.assign(this.content.style,{height:`${t.height-s.borderTop-s.borderBottom-s.paddingTop-s.paddingBottom}px`,width:`${t.width-s.borderLeft-s.borderRight-s.paddingLeft-s.paddingRight}px`}),Object.assign(this.node.style,{top:`${t.top-s.marginTop}px`,left:`${t.left-s.marginLeft}px`})}}class Dj{constructor(t,s){Object.defineProperty(this,"tip",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"nameSpan",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"titleDiv",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"infoDiv",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"dimSpan",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.tip=t.createElement("div"),Object.assign(this.tip.style,{display:"flex",flexFlow:"row nowrap",alignItems:"center",backgroundColor:"#333740",borderRadius:"2px",fontFamily:'"SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace',fontWeight:"bold",padding:"6px 8px",pointerEvents:"none",position:"fixed",fontSize:"12px",whiteSpace:"nowrap"}),this.nameSpan=t.createElement("span"),this.tip.appendChild(this.nameSpan),Object.assign(this.nameSpan.style,{display:"flex",flexDirection:"column",borderRight:"1px solid #aaaaaa",paddingRight:"0.8rem",marginRight:"0.8rem"}),this.titleDiv=t.createElement("div"),this.nameSpan.appendChild(this.titleDiv),Object.assign(this.titleDiv.style,{color:"#ee78e6",fontSize:"16px"}),this.infoDiv=t.createElement("div"),this.nameSpan.appendChild(this.infoDiv),Object.assign(this.infoDiv.style,{color:"#ee78e6",fontSize:"14px"}),this.dimSpan=t.createElement("span"),this.tip.appendChild(this.dimSpan),Object.assign(this.dimSpan.style,{color:"#d7d7d7"}),this.tip.style.zIndex="10000000",s.appendChild(this.tip)}remove(){this.tip.parentNode&&this.tip.parentNode.removeChild(this.tip)}updateText(t,s,i,o){this.titleDiv.textContent=t,this.infoDiv.textContent=s??"",this.dimSpan.textContent=`${Math.round(i)}px × ${Math.round(o)}px`}updatePosition(t,s){const i=this.tip.getBoundingClientRect(),o=zj(t,s,{width:i.width,height:i.height});Object.assign(this.tip.style,o.style)}}class Lj{constructor(){Object.defineProperty(this,"window",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tipBoundsWindow",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tip",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"rects",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"removeCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0});const t=window.__REACT_DEVTOOLS_TARGET_WINDOW__||window;this.window=t;const s=window.__REACT_DEVTOOLS_TARGET_WINDOW__||window;this.tipBoundsWindow=s;const i=t.document;this.container=i.createElement("div"),this.container.style.zIndex="10000000",this.tip=new Dj(i,this.container),this.rects=[],this.removeCallback=()=>{},i.body.appendChild(this.container)}remove(){this.tip.remove(),this.rects.forEach(t=>{t.remove()}),this.rects.length=0,this.container.parentNode&&this.container.parentNode.removeChild(this.container),this.removeCallback()}setRemoveCallback(t){this.removeCallback=t.bind(this)}inspect(t,s,i){var o;const c=t.filter(p=>p.nodeType===Node.ELEMENT_NODE);for(;this.rects.length>c.length;){const p=this.rects.pop();p==null||p.remove()}if(c.length===0)return;for(;this.rects.length<c.length;)this.rects.push(new Bj(this.window.document,this.container));const u={top:Number.POSITIVE_INFINITY,right:Number.NEGATIVE_INFINITY,bottom:Number.NEGATIVE_INFINITY,left:Number.POSITIVE_INFINITY};if(c.forEach((p,g)=>{const y=pb(p,this.window),b=gj(p);u.top=Math.min(u.top,y.top-b.marginTop),u.right=Math.max(u.right,y.left+y.width+b.marginRight),u.bottom=Math.max(u.bottom,y.top+y.height+b.marginBottom),u.left=Math.min(u.left,y.left-b.marginLeft),this.rects[g].update(y,b)}),!s){s=c[0].nodeName.toLowerCase();const p=c[0],g=(o=p.ownerDocument.defaultView)===null||o===void 0?void 0:o.__REACT_DEVTOOLS_GLOBAL_HOOK__;if(g!=null&&g.rendererInterfaces){let y=null;for(const b of g.rendererInterfaces.values()){const x=b.getFiberIDForNative(p,!0);if(x!==null){y=b.getDisplayNameForFiberID(x,!0);break}}y&&(s+=` (in ${y})`)}}this.tip.updateText(s,i,u.right-u.left,u.bottom-u.top);const d=pb(this.tipBoundsWindow.document.documentElement,this.window);this.tip.updatePosition({top:u.top,left:u.left,height:u.bottom-u.top,width:u.right-u.left},{top:d.top+this.tipBoundsWindow.scrollY,left:d.left+this.tipBoundsWindow.scrollX,height:this.tipBoundsWindow.innerHeight,width:this.tipBoundsWindow.innerWidth})}}function zj(a,t,s){const i=Math.max(s.height,20),o=Math.max(s.width,60),c=5;let u;a.top+a.height+i<=t.top+t.height?a.top+a.height<t.top+0?u=t.top+c:u=a.top+a.height+c:a.top-i<=t.top+t.height?a.top-i-c<t.top+c?u=t.top+c:u=a.top-i-c:u=t.top+t.height-i-c;let d=a.left+c;return a.left<t.left&&(d=t.left+c),a.left+o>t.left+t.width&&(d=t.left+t.width-o-c),{style:{top:`${u}px`,left:`${d}px`}}}function rf(a,t,s){Object.assign(s.style,{borderTopWidth:`${a[`${t}Top`]}px`,borderLeftWidth:`${a[`${t}Left`]}px`,borderRightWidth:`${a[`${t}Right`]}px`,borderBottomWidth:`${a[`${t}Bottom`]}px`,borderStyle:"solid"})}const Yl={background:"rgba(120, 170, 210, 0.7)",padding:"rgba(77, 200, 0, 0.3)",margin:"rgba(255, 155, 0, 0.3)",border:"rgba(255, 200, 50, 0.3)"},Uj=()=>{var a;return!((a=navigator.platform)===null||a===void 0)&&a.startsWith("Mac")?["Ctrl","Shift","Command","C"]:["Ctrl","Shift","Alt","C"]},Ij=a=>{const{keys:t,onHoverElement:s,onClickElement:i,onInspectElement:o,active:c,onActiveChange:u,disableLaunchEditor:d,disable:p=!0,children:g}=a,[y,b]=_.useState(c??!1);Mj(()=>{c!==void 0&&b(c)},[c]),_.useEffect(()=>(y?E():A(),A),[y]);const x=t===null?null:(t??[]).join("+"),S=_.useRef(),k=Oj({disable:p}),C=Di(()=>{u==null||u(!0),c===void 0&&b(!0)}),T=Di(()=>{u==null||u(!1),c===void 0&&b(!1)}),E=Di(()=>{if(S.current||p)return;const j=new Lj;S.current=j,Dn("esc",T);const J=lj({onPointerOver:B,onClick:M});j.setRemoveCallback(J);const Y=k.current,te=document.elementFromPoint(Y.x,Y.y);te&&B(te)}),A=Di(()=>{var j;(j=S.current)===null||j===void 0||j.remove(),S.current=void 0,Dn.unbind("esc",T)}),B=Di(j=>{var J;const Y=S.current,te=db(j),se=te==null?void 0:te.relativePath,ge=te==null?void 0:te.absolutePath,{fiber:Ke,name:de,title:K}=fb(j);(J=Y==null?void 0:Y.inspect)===null||J===void 0||J.call(Y,[j],K,se??ge),s==null||s({element:j,fiber:Ke,codeInfo:te,name:de})}),M=Di(j=>{T();const J=db(j),{fiber:Y,name:te}=fb(j);i==null||i({element:j,fiber:Y,codeInfo:J,name:te}),Y&&J&&(o==null||o({element:j,fiber:Y,codeInfo:J,name:te}),!o&&!d&&xj(J))});return _.useEffect(()=>{const j=()=>{S.current?T():C()},J=x===null||p?null:x||Uj().join("+");if(J)return Dn(J,j),()=>{Dn.unbind(J,j)}},[x,p]),m.jsx(m.Fragment,{children:g??null})};function $j(){const[a,t]=_.useState(!1),{t:s}=Je();return _.useEffect(()=>{const i=o=>{o.ctrlKey&&o.shiftKey&&o.altKey&&(o.key==="c"||o.key==="C")&&(o.preventDefault(),t(c=>!c))};return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[]),m.jsxs(m.Fragment,{children:[m.jsx(Ij,{active:a,onActiveChange:t}),m.jsx("button",{onClick:()=>t(i=>!i),title:s(a?"toast.inspectorOff":"toast.inspectorOn"),style:{position:"fixed",bottom:"20px",right:"20px",zIndex:99999,width:"44px",height:"44px",borderRadius:"50%",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"20px",boxShadow:"0 2px 12px rgba(0,0,0,0.25)",transition:"all 0.2s ease",background:a?"#22c55e":"#1e293b",color:"#fff"},children:m.jsxs("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[m.jsx("circle",{cx:"12",cy:"12",r:"3"}),m.jsx("path",{d:"M22 12c0 5.52-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2s10 4.48 10 10z"}),m.jsx("path",{d:"M12 2v20"}),m.jsx("path",{d:"M2 12h20"})]})})]})}k0.createRoot(document.getElementById("root")).render(m.jsxs(m0.StrictMode,{children:[m.jsx($j,{}),m.jsx(oj,{})]}));export{iR as A,Ky as B,Jj as C,v1 as D,rR as E,AA as F,Vj as G,HA as H,fC as I,oR as J,GA as K,Yj as L,Yf as M,aR as N,Te as O,Xj as P,Zj as Q,sR as R,Wb as S,Qe as T,fo as U,zf as V,Kj as W,bA as X,ab as Y,un as _,Ge as a,Pi as b,Bn as c,vt as d,Tk as e,qa as f,$ as g,Ew as h,Yi as i,Rf as j,dA as k,nR as l,Ds as m,en as n,Yb as o,Ce as p,Fw as q,tR as r,eR as s,_e as t,Je as u,Qj as v,fe as w,fw as x,Ii as y,De as z};