@deepseekcode/cli 1.0.27 → 1.0.28
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.
- package/dist/cli.js +1364 -1271
- package/package.json +1 -1
- package/web/dist/assets/AutomationView-CpFBgFvV.js +1 -0
- package/web/dist/assets/ChannelConfigView-DGK82bWj.js +8 -0
- package/web/dist/assets/{ConnectorsView-Dadj20jv.js → ConnectorsView-5kzDUnd8.js} +1 -1
- package/web/dist/assets/{FileTreeView-DLRQZmLP.js → FileTreeView-BQfRRAXr.js} +1 -1
- package/web/dist/assets/{HookConfigView-DE0NCrV9.js → HookConfigView-CdQVgzog.js} +1 -1
- package/web/dist/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- package/web/dist/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- package/web/dist/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- package/web/dist/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- package/web/dist/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- package/web/dist/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- package/web/dist/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- package/web/dist/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- package/web/dist/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- package/web/dist/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- package/web/dist/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- package/web/dist/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- package/web/dist/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- package/web/dist/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- package/web/dist/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- package/web/dist/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- package/web/dist/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- package/web/dist/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- package/web/dist/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- package/web/dist/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- package/web/dist/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- package/web/dist/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- package/web/dist/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- package/web/dist/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- package/web/dist/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- package/web/dist/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- package/web/dist/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- package/web/dist/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- package/web/dist/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- package/web/dist/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- package/web/dist/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- package/web/dist/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- package/web/dist/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- package/web/dist/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- package/web/dist/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- package/web/dist/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- package/web/dist/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- package/web/dist/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- package/web/dist/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- package/web/dist/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- package/web/dist/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- package/web/dist/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- package/web/dist/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- package/web/dist/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- package/web/dist/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- package/web/dist/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- package/web/dist/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- package/web/dist/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- package/web/dist/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- package/web/dist/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- package/web/dist/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- package/web/dist/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- package/web/dist/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- package/web/dist/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- package/web/dist/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- package/web/dist/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- package/web/dist/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- package/web/dist/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- package/web/dist/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- package/web/dist/assets/ModelsView-Dpwx3f-Q.js +1 -0
- package/web/dist/assets/{PluginsView-DBF_BvKL.js → PluginsView-bQipmAy8.js} +1 -1
- package/web/dist/assets/SessionGrid-DFVjPnhc.js +39 -0
- package/web/dist/assets/SettingsPanel-CpmNWZmn.js +4 -0
- package/web/dist/assets/{SkillsView-BAorWQAI.js → SkillsView-DLGgMIsT.js} +1 -1
- package/web/dist/assets/{TemplatesTab-DEblm2pS.js → TemplatesTab-4085BhAx.js} +1 -1
- package/web/dist/assets/{TerminalView-Cnnipr8e.js → TerminalView-BVZAuLTB.js} +1 -1
- package/web/dist/assets/{ThreeScene-5Zi32o_j.js → ThreeScene-CukEnQe-.js} +1 -1
- package/web/dist/assets/{ToolsView-lOHdaw4V.js → ToolsView-DeCt1EIB.js} +1 -1
- package/web/dist/assets/abap-BdImnpbu.js +1 -0
- package/web/dist/assets/actionscript-3-B3316cI-.js +1 -0
- package/web/dist/assets/ada-bCR0ucgS.js +1 -0
- package/web/dist/assets/ahk-CsyLZFj1.js +1 -0
- package/web/dist/assets/ahk2-8Zs4aa1G.js +1 -0
- package/web/dist/assets/andromeeda-C4gqWexZ.js +1 -0
- package/web/dist/assets/angular-html-DA-rfuFy.js +1 -0
- package/web/dist/assets/angular-ts-BrjP3tb8.js +1 -0
- package/web/dist/assets/apache-Pmp26Uib.js +1 -0
- package/web/dist/assets/apex-DhZFqWV2.js +1 -0
- package/web/dist/assets/apl-CORt7UWP.js +1 -0
- package/web/dist/assets/applescript-Co6uUVPk.js +1 -0
- package/web/dist/assets/ara-BRHolxvo.js +1 -0
- package/web/dist/assets/asciidoc-CSVQ5wI8.js +1 -0
- package/web/dist/assets/asm-D_Q5rh1f.js +1 -0
- package/web/dist/assets/astro-HNnZUWAn.js +1 -0
- package/web/dist/assets/aurora-x-D-2ljcwZ.js +1 -0
- package/web/dist/assets/awk-DMzUqQB5.js +1 -0
- package/web/dist/assets/ayu-dark-DYE7WIF3.js +1 -0
- package/web/dist/assets/ayu-light-BA47KaF1.js +1 -0
- package/web/dist/assets/ayu-mirage-32ctXXKs.js +1 -0
- package/web/dist/assets/ballerina-BFfxhgS-.js +1 -0
- package/web/dist/assets/bat-CickPsom.js +1 -0
- package/web/dist/assets/beancount-k_qm7-4y.js +1 -0
- package/web/dist/assets/berry-uYugtg8r.js +1 -0
- package/web/dist/assets/bibtex-CHM0blh-.js +1 -0
- package/web/dist/assets/bicep-Bmn6On1c.js +1 -0
- package/web/dist/assets/bird2-Bx8U0n9b.js +1 -0
- package/web/dist/assets/blade-2xfisSek.js +1 -0
- package/web/dist/assets/bsl-DlhNcFeZ.js +1 -0
- package/web/dist/assets/c-BIGW1oBm.js +1 -0
- package/web/dist/assets/c3-Dp5svz6Z.js +1 -0
- package/web/dist/assets/cadence-Bv_4Rxtq.js +1 -0
- package/web/dist/assets/cairo-KRGpt6FW.js +1 -0
- package/web/dist/assets/catppuccin-frappe-CZL1YF0i.js +1 -0
- package/web/dist/assets/catppuccin-latte-DH-8KZSZ.js +1 -0
- package/web/dist/assets/catppuccin-macchiato-B7yYVSCf.js +1 -0
- package/web/dist/assets/catppuccin-mocha-Ct7hS0mc.js +1 -0
- package/web/dist/assets/chapel-DTp_pixX.js +1 -0
- package/web/dist/assets/clarity-Dn5IMItf.js +1 -0
- package/web/dist/assets/clojure-P80f7IUj.js +1 -0
- package/web/dist/assets/cmake-D1j8_8rp.js +1 -0
- package/web/dist/assets/cobol-nBiQ_Alo.js +1 -0
- package/web/dist/assets/codeowners-Bp6g37R7.js +1 -0
- package/web/dist/assets/codeql-DsOJ9woJ.js +1 -0
- package/web/dist/assets/coffee-Ch7k5sss.js +1 -0
- package/web/dist/assets/common-lisp-Cg-RD9OK.js +1 -0
- package/web/dist/assets/coq-C7JzOVbR.js +1 -0
- package/web/dist/assets/cpp-BMRokrvK.js +1 -0
- package/web/dist/assets/crystal-DGywbUpC.js +1 -0
- package/web/dist/assets/csharp-DSvCPggb.js +1 -0
- package/web/dist/assets/css-CLj8gQPS.js +1 -0
- package/web/dist/assets/csv-fuZLfV_i.js +1 -0
- package/web/dist/assets/cue-D82EKSYY.js +1 -0
- package/web/dist/assets/cypher-COkxafJQ.js +1 -0
- package/web/dist/assets/d-85-TOEBH.js +1 -0
- package/web/dist/assets/dark-plus-C3mMm8J8.js +1 -0
- package/web/dist/assets/dart-bE4Kk8sk.js +1 -0
- package/web/dist/assets/dax-CEL-wOlO.js +1 -0
- package/web/dist/assets/desktop-BmXAJ9_W.js +1 -0
- package/web/dist/assets/diff-D97Zzqfu.js +1 -0
- package/web/dist/assets/docker-BcOcwvcX.js +1 -0
- package/web/dist/assets/dotenv-Da5cRb03.js +1 -0
- package/web/dist/assets/dracula-BzJJZx-M.js +1 -0
- package/web/dist/assets/dracula-soft-BXkSAIEj.js +1 -0
- package/web/dist/assets/dream-maker-BtqSS_iP.js +1 -0
- package/web/dist/assets/edge-FbVlp4U3.js +1 -0
- package/web/dist/assets/elixir-CkH2-t6x.js +1 -0
- package/web/dist/assets/elm-DbKCFpqz.js +1 -0
- package/web/dist/assets/emacs-lisp-C_m_b--Z.js +1 -0
- package/web/dist/assets/erb-DXfck5VN.js +1 -0
- package/web/dist/assets/erlang-DsQrWhSR.js +1 -0
- package/web/dist/assets/everforest-dark-BgDCqdQA.js +1 -0
- package/web/dist/assets/everforest-light-C8M2exoo.js +1 -0
- package/web/dist/assets/fennel-BYunw83y.js +1 -0
- package/web/dist/assets/fish-BvzEVeQv.js +1 -0
- package/web/dist/assets/fluent-C4IJs8-o.js +1 -0
- package/web/dist/assets/fortran-fixed-form-CkoXwp7k.js +1 -0
- package/web/dist/assets/fortran-free-form-BxgE0vQu.js +1 -0
- package/web/dist/assets/fsharp-CXgrBDvD.js +1 -0
- package/web/dist/assets/gdresource-TyuKm33G.js +1 -0
- package/web/dist/assets/gdscript-DqcFQ5yU.js +1 -0
- package/web/dist/assets/gdshader-DkwncUOv.js +1 -0
- package/web/dist/assets/genie-D0YGMca9.js +1 -0
- package/web/dist/assets/gherkin-DyxjwDmM.js +1 -0
- package/web/dist/assets/git-commit-F4YmCXRG.js +1 -0
- package/web/dist/assets/git-rebase-r7XF79zn.js +1 -0
- package/web/dist/assets/github-dark-DHJKELXO.js +1 -0
- package/web/dist/assets/github-dark-default-Cuk6v7N8.js +1 -0
- package/web/dist/assets/github-dark-dimmed-DH5Ifo-i.js +1 -0
- package/web/dist/assets/github-dark-high-contrast-E3gJ1_iC.js +1 -0
- package/web/dist/assets/github-light-DAi9KRSo.js +1 -0
- package/web/dist/assets/github-light-default-D7oLnXFd.js +1 -0
- package/web/dist/assets/github-light-high-contrast-BfjtVDDH.js +1 -0
- package/web/dist/assets/gleam-BspZqrRM.js +1 -0
- package/web/dist/assets/glimmer-js-ByusRIyA.js +1 -0
- package/web/dist/assets/glimmer-ts-BfAWNZQY.js +1 -0
- package/web/dist/assets/glsl-DplSGwfg.js +1 -0
- package/web/dist/assets/gn-n2N0HUVH.js +1 -0
- package/web/dist/assets/gnuplot-DdkO51Og.js +1 -0
- package/web/dist/assets/go-C27-OAKa.js +1 -0
- package/web/dist/assets/graphql-ChdNCCLP.js +1 -0
- package/web/dist/assets/groovy-gcz8RCvz.js +1 -0
- package/web/dist/assets/gruvbox-dark-hard-CFHQjOhq.js +1 -0
- package/web/dist/assets/gruvbox-dark-medium-GsRaNv29.js +1 -0
- package/web/dist/assets/gruvbox-dark-soft-CVdnzihN.js +1 -0
- package/web/dist/assets/gruvbox-light-hard-CH1njM8p.js +1 -0
- package/web/dist/assets/gruvbox-light-medium-DRw_LuNl.js +1 -0
- package/web/dist/assets/gruvbox-light-soft-hJgmCMqR.js +1 -0
- package/web/dist/assets/hack-BWmVpMyf.js +1 -0
- package/web/dist/assets/haml-D5jkg6IW.js +1 -0
- package/web/dist/assets/handlebars-BpdQsYii.js +1 -0
- package/web/dist/assets/haskell-Df6bDoY_.js +1 -0
- package/web/dist/assets/haxe-CfZj7gIn.js +1 -0
- package/web/dist/assets/hcl-BWvSN4gD.js +1 -0
- package/web/dist/assets/hjson-D5-asLiD.js +1 -0
- package/web/dist/assets/hlsl-D3lLCCz7.js +1 -0
- package/web/dist/assets/horizon-BUw7H-hv.js +1 -0
- package/web/dist/assets/horizon-bright-CUuTKBJd.js +1 -0
- package/web/dist/assets/houston-DnULxvSX.js +1 -0
- package/web/dist/assets/html-derivative-DlHx6ybY.js +1 -0
- package/web/dist/assets/html-pp8916En.js +1 -0
- package/web/dist/assets/http-jrhK8wxY.js +1 -0
- package/web/dist/assets/hurl-irOxFIW8.js +1 -0
- package/web/dist/assets/hxml-2-FPmUDs.js +1 -0
- package/web/dist/assets/hy-DFXneXwc.js +1 -0
- package/web/dist/assets/{icons-DLsYqrD5.js → icons-Cu8fYt4q.js} +1 -1
- package/web/dist/assets/imba-DGztddWO.js +1 -0
- package/web/dist/assets/index-Bg6EQpr3.js +484 -0
- package/web/dist/assets/index-CYAcRfnc.css +1 -0
- package/web/dist/assets/ini-BEwlwnbL.js +1 -0
- package/web/dist/assets/java-CylS5w8V.js +1 -0
- package/web/dist/assets/javascript-wDzz0qaB.js +1 -0
- package/web/dist/assets/jinja-f2NsQr07.js +1 -0
- package/web/dist/assets/jison-wvAkD_A8.js +1 -0
- package/web/dist/assets/json-Cp-IABpG.js +1 -0
- package/web/dist/assets/json5-C9tS-k6U.js +1 -0
- package/web/dist/assets/jsonc-Des-eS-w.js +1 -0
- package/web/dist/assets/jsonl-DcaNXYhu.js +1 -0
- package/web/dist/assets/jsonnet-DFQXde-d.js +1 -0
- package/web/dist/assets/jssm-C2t-YnRu.js +1 -0
- package/web/dist/assets/jsx-g9-lgVsj.js +1 -0
- package/web/dist/assets/julia-5Bft2YPA.js +1 -0
- package/web/dist/assets/just-Cwhn7H3k.js +1 -0
- package/web/dist/assets/kanagawa-dragon-BuwD2xS4.js +1 -0
- package/web/dist/assets/kanagawa-lotus-C3DzagqV.js +1 -0
- package/web/dist/assets/kanagawa-wave-DFGoQZhC.js +1 -0
- package/web/dist/assets/kdl-DV7GczEv.js +1 -0
- package/web/dist/assets/kotlin-BdnUsdx6.js +1 -0
- package/web/dist/assets/kusto-wEQ09or8.js +1 -0
- package/web/dist/assets/laserwave-DUszq2jm.js +1 -0
- package/web/dist/assets/latex-D5pSuvFb.js +1 -0
- package/web/dist/assets/lean-BZvkOJ9d.js +1 -0
- package/web/dist/assets/less-B1dDrJ26.js +1 -0
- package/web/dist/assets/light-plus-B7mTdjB0.js +1 -0
- package/web/dist/assets/liquid-C0sCDyMI.js +1 -0
- package/web/dist/assets/llvm-BZoOZj88.js +1 -0
- package/web/dist/assets/log-2UxHyX5q.js +1 -0
- package/web/dist/assets/logo-BtOb2qkB.js +1 -0
- package/web/dist/assets/lua-BaeVxFsk.js +1 -0
- package/web/dist/assets/luau-BnpPk5vE.js +1 -0
- package/web/dist/assets/make-CHLpvVh8.js +1 -0
- package/web/dist/assets/{markdown-tZ6sw2sR.js → markdown-Bym7wmT0.js} +8 -8
- package/web/dist/assets/markdown-Cvjx9yec.js +1 -0
- package/web/dist/assets/marko-DjSrsDqO.js +1 -0
- package/web/dist/assets/material-theme-D5KoaKCx.js +1 -0
- package/web/dist/assets/material-theme-darker-BfHTSMKl.js +1 -0
- package/web/dist/assets/material-theme-lighter-B0m2ddpp.js +1 -0
- package/web/dist/assets/material-theme-ocean-CyktbL80.js +1 -0
- package/web/dist/assets/material-theme-palenight-Csfq5Kiy.js +1 -0
- package/web/dist/assets/matlab-D7o27uSR.js +1 -0
- package/web/dist/assets/mdc-D1_yUvq7.js +1 -0
- package/web/dist/assets/mdx-Cmh6b_Ma.js +1 -0
- package/web/dist/assets/mermaid-CQcHuHx7.js +1 -0
- package/web/dist/assets/min-dark-CafNBF8u.js +1 -0
- package/web/dist/assets/min-light-CTRr51gU.js +1 -0
- package/web/dist/assets/mipsasm-CKIfxQSi.js +1 -0
- package/web/dist/assets/mojo-DJz3ZmWd.js +1 -0
- package/web/dist/assets/monokai-BRVnQi9A.js +1 -0
- package/web/dist/assets/moonbit-CHtswR0a.js +1 -0
- package/web/dist/assets/move-el3G9tDJ.js +1 -0
- package/web/dist/assets/narrat-DRg8JJMk.js +1 -0
- package/web/dist/assets/nextflow-C-mBbutL.js +1 -0
- package/web/dist/assets/nextflow-groovy-vE_lwT2v.js +1 -0
- package/web/dist/assets/nginx-BpAMiNFr.js +1 -0
- package/web/dist/assets/night-owl-C39BiMTA.js +1 -0
- package/web/dist/assets/night-owl-light-CMTm3GFP.js +1 -0
- package/web/dist/assets/nim-BIad80T-.js +1 -0
- package/web/dist/assets/nix-CwoSXNpI.js +1 -0
- package/web/dist/assets/nord-Ddv68eIx.js +1 -0
- package/web/dist/assets/nsis-BlV79W_Q.js +1 -0
- package/web/dist/assets/nushell-D3jzshHO.js +1 -0
- package/web/dist/assets/objective-c-DXmwc3jG.js +1 -0
- package/web/dist/assets/objective-cpp-CLxacb5B.js +1 -0
- package/web/dist/assets/ocaml-C0hk2d4L.js +1 -0
- package/web/dist/assets/odin-BBf5iR-q.js +1 -0
- package/web/dist/assets/one-dark-pro-DVMEJ2y_.js +1 -0
- package/web/dist/assets/one-light-C3Wv6jpd.js +1 -0
- package/web/dist/assets/openscad-C4EeE6gA.js +1 -0
- package/web/dist/assets/org-DM6o9KBp.js +1 -0
- package/web/dist/assets/{panels-wDJMsvra.js → panels-BEKHl5l-.js} +1 -1
- package/web/dist/assets/pascal-D93ZcfNL.js +1 -0
- package/web/dist/assets/perl-B9cMNwum.js +1 -0
- package/web/dist/assets/php-Csjmro_R.js +1 -0
- package/web/dist/assets/pkl-u5AG7uiY.js +1 -0
- package/web/dist/assets/plastic-3e1v2bzS.js +1 -0
- package/web/dist/assets/plsql-ChMvpjG-.js +1 -0
- package/web/dist/assets/po-BTJTHyun.js +1 -0
- package/web/dist/assets/poimandres-CS3Unz2-.js +1 -0
- package/web/dist/assets/polar-C0HS_06l.js +1 -0
- package/web/dist/assets/postcss-CXtECtnM.js +1 -0
- package/web/dist/assets/powerquery-CEu0bR-o.js +1 -0
- package/web/dist/assets/powershell-BmBUJMz7.js +1 -0
- package/web/dist/assets/prisma-Vru482bI.js +1 -0
- package/web/dist/assets/prolog-CbFg5uaA.js +1 -0
- package/web/dist/assets/proto-C7zT0LnQ.js +1 -0
- package/web/dist/assets/pug-DKIMFp6K.js +1 -0
- package/web/dist/assets/puppet-BMWR74SV.js +1 -0
- package/web/dist/assets/purescript-CklMAg4u.js +1 -0
- package/web/dist/assets/python-B6aJPvgy.js +1 -0
- package/web/dist/assets/qml-3beO22l8.js +1 -0
- package/web/dist/assets/qmldir-C8lEn-DE.js +1 -0
- package/web/dist/assets/qss-IeuSbFQv.js +1 -0
- package/web/dist/assets/r-Cf5RLm7j.js +1 -0
- package/web/dist/assets/racket-BqYA7rlc.js +1 -0
- package/web/dist/assets/raku-DXvB9xmW.js +1 -0
- package/web/dist/assets/razor-BjBPvh-w.js +1 -0
- package/web/dist/assets/rbs-CpoqiR4B.js +1 -0
- package/web/dist/assets/{react-vendor-BRkWBfPR.js → react-vendor-D76F8wnc.js} +1 -1
- package/web/dist/assets/red-hvxz__6c.js +1 -0
- package/web/dist/assets/reg-C-SQnVFl.js +1 -0
- package/web/dist/assets/regexp-CDVJQ6XC.js +1 -0
- package/web/dist/assets/rel-C3B-1QV4.js +1 -0
- package/web/dist/assets/riscv-BM1_JUlF.js +1 -0
- package/web/dist/assets/ron-D8l8udqQ.js +1 -0
- package/web/dist/assets/rose-pine-5qJOZa0Y.js +1 -0
- package/web/dist/assets/rose-pine-dawn-zx0QlTCp.js +1 -0
- package/web/dist/assets/rose-pine-moon-C9pEdX9L.js +1 -0
- package/web/dist/assets/rosmsg-BJDFO7_C.js +1 -0
- package/web/dist/assets/rst-bs7f0vWN.js +1 -0
- package/web/dist/assets/ruby-C0TQ7zu5.js +1 -0
- package/web/dist/assets/rust-B1yitclQ.js +1 -0
- package/web/dist/assets/sas-DEy46yEz.js +1 -0
- package/web/dist/assets/sass-Cj5Yp3dK.js +1 -0
- package/web/dist/assets/scala-CqE71os6.js +1 -0
- package/web/dist/assets/scheme-C98Dy4si.js +1 -0
- package/web/dist/assets/scss-D5BDwBP9.js +1 -0
- package/web/dist/assets/sdbl-DVxCFoDh.js +1 -0
- package/web/dist/assets/shaderlab-Dg9Lc6iA.js +1 -0
- package/web/dist/assets/shellscript-Yzrsuije.js +1 -0
- package/web/dist/assets/shellsession-BADoaaVG.js +1 -0
- package/web/dist/assets/slack-dark-BthQWCQV.js +1 -0
- package/web/dist/assets/slack-ochin-DqwNpetd.js +1 -0
- package/web/dist/assets/smalltalk-BOQMe2GC.js +1 -0
- package/web/dist/assets/smithy-cds9vsN8.js +1 -0
- package/web/dist/assets/snazzy-light-Bw305WKR.js +1 -0
- package/web/dist/assets/solarized-dark-CpvCGNkr.js +1 -0
- package/web/dist/assets/solarized-light-Dlz6yCKv.js +1 -0
- package/web/dist/assets/solidity-DijEV5ha.js +1 -0
- package/web/dist/assets/soy-8wufbnw4.js +1 -0
- package/web/dist/assets/sparql-rVzFXLq3.js +1 -0
- package/web/dist/assets/splunk-BtCnVYZw.js +1 -0
- package/web/dist/assets/sql-CRqJ_cUM.js +1 -0
- package/web/dist/assets/ssh-config-_ykCGR6B.js +1 -0
- package/web/dist/assets/stata-DI20mbqo.js +1 -0
- package/web/dist/assets/{state-B80cA8v4.js → state-CZakZ3-m.js} +1 -1
- package/web/dist/assets/sttLanguages-BNRptAQA.js +1 -0
- package/web/dist/assets/stylus-BEDo0Tqx.js +1 -0
- package/web/dist/assets/surrealql-Cjom0U5J.js +1 -0
- package/web/dist/assets/svelte-Cy7k_4gC.js +1 -0
- package/web/dist/assets/swift-C2oV4EkX.js +1 -0
- package/web/dist/assets/synthwave-84-CbfX1IO0.js +1 -0
- package/web/dist/assets/system-verilog-0hqHdDBg.js +1 -0
- package/web/dist/assets/systemd-4A_iFExJ.js +1 -0
- package/web/dist/assets/talonscript-CkByrt1z.js +1 -0
- package/web/dist/assets/tasl-QIJgUcNo.js +1 -0
- package/web/dist/assets/tcl-dwOrl1Do.js +1 -0
- package/web/dist/assets/templ-DhtptRzy.js +1 -0
- package/web/dist/assets/terraform-BETggiCN.js +1 -0
- package/web/dist/assets/tex-D96PA37w.js +1 -0
- package/web/dist/assets/tokyo-night-hegEt444.js +1 -0
- package/web/dist/assets/toml-vGWfd6FD.js +1 -0
- package/web/dist/assets/ts-tags-D351s5mN.js +1 -0
- package/web/dist/assets/tsv-B_m7g4N7.js +1 -0
- package/web/dist/assets/tsx-COt5Ahok.js +1 -0
- package/web/dist/assets/turtle-BsS91CYL.js +1 -0
- package/web/dist/assets/twig-27uCiNez.js +1 -0
- package/web/dist/assets/typescript-BPQ3VLAy.js +1 -0
- package/web/dist/assets/typespec-CAFt9gP4.js +1 -0
- package/web/dist/assets/typst-BUadGCkm.js +1 -0
- package/web/dist/assets/v-BGw2Nkan.js +1 -0
- package/web/dist/assets/vala-CsfeWuGM.js +1 -0
- package/web/dist/assets/vb-Cu-pLBUe.js +1 -0
- package/web/dist/assets/verilog-nZwndyjY.js +1 -0
- package/web/dist/assets/vesper-DRje8inN.js +1 -0
- package/web/dist/assets/vhdl-CeAyd5Ju.js +1 -0
- package/web/dist/assets/viml-CJc9bBzg.js +1 -0
- package/web/dist/assets/vitesse-black-Bkuqu6BP.js +1 -0
- package/web/dist/assets/vitesse-dark-D0r3Knsf.js +1 -0
- package/web/dist/assets/vitesse-light-CVO1_9PV.js +1 -0
- package/web/dist/assets/vue-BqiEGhQt.js +1 -0
- package/web/dist/assets/vue-html-AaS7Mt5G.js +1 -0
- package/web/dist/assets/vue-vine-BoDAl6tE.js +1 -0
- package/web/dist/assets/vyper-CDx5xZoG.js +1 -0
- package/web/dist/assets/wasm-CG6Dc4jp.js +1 -0
- package/web/dist/assets/wasm-MzD3tlZU.js +1 -0
- package/web/dist/assets/wenyan-BV7otONQ.js +1 -0
- package/web/dist/assets/wgsl-Dx-B1_4e.js +1 -0
- package/web/dist/assets/wikitext-BhOHFoWU.js +1 -0
- package/web/dist/assets/wit-5i3qLPDT.js +1 -0
- package/web/dist/assets/wolfram-lXgVvXCa.js +1 -0
- package/web/dist/assets/xml-sdJ4AIDG.js +1 -0
- package/web/dist/assets/xsl-CtQFsRM5.js +1 -0
- package/web/dist/assets/yaml-Buea-lGh.js +1 -0
- package/web/dist/assets/zenscript-DVFEvuxE.js +1 -0
- package/web/dist/assets/zig-VOosw3JB.js +1 -0
- package/web/dist/index.html +7 -7
- package/web/dist/assets/AutomationView-ClGqJM46.js +0 -1
- package/web/dist/assets/ChannelConfigView-BcGUdK94.js +0 -8
- package/web/dist/assets/ModelsView-DVTuTql9.js +0 -1
- package/web/dist/assets/SessionGrid-ByIAFTc2.js +0 -38
- package/web/dist/assets/SettingsPanel-CHRy0Xqj.js +0 -4
- package/web/dist/assets/index-Bht_ARrv.css +0 -1
- package/web/dist/assets/index-DEninW1j.js +0 -70
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ThreeScene-5Zi32o_j.js","assets/markdown-tZ6sw2sR.js","assets/icons-DLsYqrD5.js","assets/ThreeScene-DvOrMIoG.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{j as e}from"./markdown-tZ6sw2sR.js";import{a,af as cs,_ as ds,ak as ze,d as ge,K as ke,ae as sn,a1 as yt,aA as je,X as Se,aQ as pt,E as us,$ as Ne,l as mt,L as Te,u as wt,F as ht,aR as ft,aH as nn,D as rn,k as an,aS as xs,aw as ln,aT as Rt,aU as on,h as Fe,al as cn,i as ps,aV as dn,aW as un,aX as xn,b as pn,aq as mn,aY as hn,aG as fn,O as vt,aZ as bn,a0 as $t,B as gn,ap as kn,a_ as yn,n as ms,aN as jt,aM as wn,a6 as hs,ab as vn,a$ as jn,b0 as Nn,ag as Sn,b1 as Cn,f as En,S as _n,t as An,b2 as Me,y as Mn,b3 as zn,m as Tn,b4 as In,a2 as Rn,p as $n,q as Pn,j as Dn}from"./icons-DLsYqrD5.js";import{D as Ln,d as le,h as Pt,u as G,i as Bn,j as fs,o as bs,k as Oe,l as gs,w as ce,m as bt,b as ve,R as ks,a as xe,t as oe,n as Fn,s as On,r as qn,f as Ze,p as fe,q as Hn,v as Jn,_ as Wn,W as Un,x as Gn,y as gt,c as Ge,z as Le,A as Kn,E as Zn,F as Vn,G as Qn,M as Xn,H as Yn,J as er,K as ys,L as tr,N as sr,O as nr,Q as We,S as rr,T as ws}from"./index-DEninW1j.js";import{r as ar}from"./react-vendor-BRkWBfPR.js";import"./state-B80cA8v4.js";import"./panels-wDJMsvra.js";class lr extends Ln{tokenize(t){return t.slice()}join(t){return t}removeEmpty(t){return t}}const ir=new lr;function or(r,t,s){return ir.diff(r,t,s)}function Dt({value:r,max:t=100,size:s="md",variant:n="default",showLabel:l=!1,className:o}){const u=Math.min(Math.max(r/t*100,0),100),c={sm:"h-1",md:"h-2",lg:"h-3"},d={default:"bg-accent-blue",success:"bg-accent-green",warning:"bg-accent-yellow",error:"bg-accent-red"};return e.jsxs("div",{className:le("w-full",o),children:[e.jsx("div",{className:le("w-full bg-dark-border rounded-full overflow-hidden",c[s]),children:e.jsx("div",{className:le("h-full rounded-full transition-all duration-300",d[n]),style:{width:`${u}%`}})}),l&&e.jsxs("span",{className:"text-xs text-dark-muted mt-1",children:[Math.round(u),"%"]})]})}Prism.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]};Prism.languages.markup.tag.inside["attr-value"].inside.entity=Prism.languages.markup.entity;Prism.languages.markup.doctype.inside["internal-subset"].inside=Prism.languages.markup;Prism.hooks.add("wrap",function(r){r.type==="entity"&&(r.attributes.title=r.content.replace(/&/,"&"))});Object.defineProperty(Prism.languages.markup.tag,"addInlined",{value:function(t,s){var n={};n["language-"+s]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:Prism.languages[s]},n.cdata=/^<!\[CDATA\[|\]\]>$/i;var l={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:n}};l["language-"+s]={pattern:/[\s\S]+/,inside:Prism.languages[s]};var o={};o[t]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return t}),"i"),lookbehind:!0,greedy:!0,inside:l},Prism.languages.insertBefore("markup","cdata",o)}});Object.defineProperty(Prism.languages.markup.tag,"addAttribute",{value:function(r,t){Prism.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+r+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,"language-"+t],inside:Prism.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}});Prism.languages.html=Prism.languages.markup;Prism.languages.mathml=Prism.languages.markup;Prism.languages.svg=Prism.languages.markup;Prism.languages.xml=Prism.languages.extend("markup",{});Prism.languages.ssml=Prism.languages.xml;Prism.languages.atom=Prism.languages.xml;Prism.languages.rss=Prism.languages.xml;Prism.languages.go=Prism.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,lookbehind:!0,greedy:!0},keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,boolean:/\b(?:_|false|iota|nil|true)\b/,number:[/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i],operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,builtin:/\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/});Prism.languages.insertBefore("go","string",{char:{pattern:/'(?:\\.|[^'\\\r\n]){0,10}'/,greedy:!0}});delete Prism.languages.go["class-name"];var Lt={},Bt;function cr(){return Bt||(Bt=1,(function(r){for(var t=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|<self>)*\*\//.source,s=0;s<2;s++)t=t.replace(/<self>/g,function(){return t});t=t.replace(/<self>/g,function(){return/[^\s\S]/.source}),r.languages.rust={comment:[{pattern:RegExp(/(^|[^\\])/.source+t),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:"attr-name",inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:"punctuation"},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:"symbol"},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:"punctuation"},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:"function"},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:"class-name"},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:"namespace"},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:"namespace",inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:"property"},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?=?|[@?]/},r.languages.rust["closure-params"].inside.rest=r.languages.rust,r.languages.rust.attribute.inside.string=r.languages.rust.string})(Prism)),Lt}cr();var Ft={},Ot;function dr(){return Ot||(Ot=1,(function(r){var t=/\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/,s=/(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source,n={pattern:RegExp(/(^|[^\w.])/.source+s+/[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),lookbehind:!0,inside:{namespace:{pattern:/^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,inside:{punctuation:/\./}},punctuation:/\./}};r.languages.java=r.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,lookbehind:!0,greedy:!0},"class-name":[n,{pattern:RegExp(/(^|[^\w.])/.source+s+/[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),lookbehind:!0,inside:n.inside},{pattern:RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source+s+/[A-Z]\w*\b/.source),lookbehind:!0,inside:n.inside}],keyword:t,function:[r.languages.clike.function,{pattern:/(::\s*)[a-z_]\w*/,lookbehind:!0}],number:/\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,operator:{pattern:/(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,lookbehind:!0},constant:/\b[A-Z][A-Z_\d]+\b/}),r.languages.insertBefore("java","string",{"triple-quoted-string":{pattern:/"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,greedy:!0,alias:"string"},char:{pattern:/'(?:\\.|[^'\\\r\n]){1,6}'/,greedy:!0}}),r.languages.insertBefore("java","class-name",{annotation:{pattern:/(^|[^.])@\w+(?:\s*\.\s*\w+)*/,lookbehind:!0,alias:"punctuation"},generics:{pattern:/<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,inside:{"class-name":n,keyword:t,punctuation:/[<>(),.:]/,operator:/[?&|]/}},import:[{pattern:RegExp(/(\bimport\s+)/.source+s+/(?:[A-Z]\w*|\*)(?=\s*;)/.source),lookbehind:!0,inside:{namespace:n.inside.namespace,punctuation:/\./,operator:/\*/,"class-name":/\w+/}},{pattern:RegExp(/(\bimport\s+static\s+)/.source+s+/(?:\w+|\*)(?=\s*;)/.source),lookbehind:!0,alias:"static",inside:{namespace:n.inside.namespace,static:/\b\w+$/,punctuation:/\./,operator:/\*/,"class-name":/\w+/}}],namespace:{pattern:RegExp(/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!<keyword>)[a-z]\w*(?:\.[a-z]\w*)*\.?/.source.replace(/<keyword>/g,function(){return t.source})),lookbehind:!0,inside:{punctuation:/\./}}})})(Prism)),Ft}dr();Prism.languages.c=Prism.languages.extend("clike",{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/});Prism.languages.insertBefore("c","string",{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}});Prism.languages.insertBefore("c","string",{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:"property",inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},Prism.languages.c.string],char:Prism.languages.c.char,comment:Prism.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:"function"}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:"keyword"},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:Prism.languages.c}}}});Prism.languages.insertBefore("c","function",{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/});delete Prism.languages.c.boolean;var qt={},Ht;function ur(){return Ht||(Ht=1,(function(r){var t=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,s=/\b(?!<keyword>)\w+(?:\s*\.\s*\w+)*\b/.source.replace(/<keyword>/g,function(){return t.source});r.languages.cpp=r.languages.extend("c",{"class-name":[{pattern:RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!<keyword>)\w+/.source.replace(/<keyword>/g,function(){return t.source})),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:t,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),r.languages.insertBefore("cpp","string",{module:{pattern:RegExp(/(\b(?:import|module)\s+)/.source+"(?:"+/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source+"|"+/<mod-name>(?:\s*:\s*<mod-name>)?|:\s*<mod-name>/.source.replace(/<mod-name>/g,function(){return s})+")"),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}),r.languages.insertBefore("cpp","keyword",{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:r.languages.cpp}}}}),r.languages.insertBefore("cpp","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}}),r.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:r.languages.extend("cpp",{})}}),r.languages.insertBefore("inside","double-colon",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},r.languages.cpp["base-clause"])})(Prism)),qt}ur();(function(r){function t(s,n){return"___"+s.toUpperCase()+n+"___"}Object.defineProperties(r.languages["markup-templating"]={},{buildPlaceholders:{value:function(s,n,l,o){if(s.language===n){var u=s.tokenStack=[];s.code=s.code.replace(l,function(c){if(typeof o=="function"&&!o(c))return c;for(var d=u.length,i;s.code.indexOf(i=t(n,d))!==-1;)++d;return u[d]=c,i}),s.grammar=r.languages.markup}}},tokenizePlaceholders:{value:function(s,n){if(s.language!==n||!s.tokenStack)return;s.grammar=r.languages[n];var l=0,o=Object.keys(s.tokenStack);function u(c){for(var d=0;d<c.length&&!(l>=o.length);d++){var i=c[d];if(typeof i=="string"||i.content&&typeof i.content=="string"){var x=o[l],h=s.tokenStack[x],g=typeof i=="string"?i:i.content,k=t(n,x),b=g.indexOf(k);if(b>-1){++l;var w=g.substring(0,b),y=new r.Token(n,r.tokenize(h,s.grammar),"language-"+n,h),p=g.substring(b+k.length),E=[];w&&E.push.apply(E,u([w])),E.push(y),p&&E.push.apply(E,u([p])),typeof i=="string"?c.splice.apply(c,[d,1].concat(E)):i.content=E}}else i.content&&u(i.content)}return c}u(s.tokens)}}})})(Prism);var Jt={},Wt;function xr(){return Wt||(Wt=1,(function(r){var t=/\/\*[\s\S]*?\*\/|\/\/.*|#(?!\[).*/,s=[{pattern:/\b(?:false|true)\b/i,alias:"boolean"},{pattern:/(::\s*)\b[a-z_]\w*\b(?!\s*\()/i,greedy:!0,lookbehind:!0},{pattern:/(\b(?:case|const)\s+)\b[a-z_]\w*(?=\s*[;=])/i,greedy:!0,lookbehind:!0},/\b(?:null)\b/i,/\b[A-Z_][A-Z0-9_]*\b(?!\s*\()/],n=/\b0b[01]+(?:_[01]+)*\b|\b0o[0-7]+(?:_[0-7]+)*\b|\b0x[\da-f]+(?:_[\da-f]+)*\b|(?:\b\d+(?:_\d+)*\.?(?:\d+(?:_\d+)*)?|\B\.\d+)(?:e[+-]?\d+)?/i,l=/<?=>|\?\?=?|\.{3}|\??->|[!=]=?=?|::|\*\*=?|--|\+\+|&&|\|\||<<|>>|[?~]|[/^|%*&<>.+-]=?/,o=/[{}\[\](),:;]/;r.languages.php={delimiter:{pattern:/\?>$|^<\?(?:php(?=\s)|=)?/i,alias:"important"},comment:t,variable:/\$+(?:\w+\b|(?=\{))/,package:{pattern:/(namespace\s+|use\s+(?:function\s+)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,lookbehind:!0,inside:{punctuation:/\\/}},"class-name-definition":{pattern:/(\b(?:class|enum|interface|trait)\s+)\b[a-z_]\w*(?!\\)\b/i,lookbehind:!0,alias:"class-name"},"function-definition":{pattern:/(\bfunction\s+)[a-z_]\w*(?=\s*\()/i,lookbehind:!0,alias:"function"},keyword:[{pattern:/(\(\s*)\b(?:array|bool|boolean|float|int|integer|object|string)\b(?=\s*\))/i,alias:"type-casting",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|object|self|static|string)\b(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|never|object|self|static|string|void)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/\b(?:array(?!\s*\()|bool|float|int|iterable|mixed|object|string|void)\b/i,alias:"type-declaration",greedy:!0},{pattern:/(\|\s*)(?:false|null)\b|\b(?:false|null)(?=\s*\|)/i,alias:"type-declaration",greedy:!0,lookbehind:!0},{pattern:/\b(?:parent|self|static)(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(\byield\s+)from\b/i,lookbehind:!0},/\bclass\b/i,{pattern:/((?:^|[^\s>:]|(?:^|[^-])>|(?:^|[^:]):)\s*)\b(?:abstract|and|array|as|break|callable|case|catch|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|enum|eval|exit|extends|final|finally|fn|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|match|namespace|never|new|or|parent|print|private|protected|public|readonly|require|require_once|return|self|static|switch|throw|trait|try|unset|use|var|while|xor|yield|__halt_compiler)\b/i,lookbehind:!0}],"argument-name":{pattern:/([(,]\s*)\b[a-z_]\w*(?=\s*:(?!:))/i,lookbehind:!0},"class-name":[{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self|\s+static))\s+|\bcatch\s*\()\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/(\|\s*)\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/\b[a-z_]\w*(?!\\)\b(?=\s*\|)/i,greedy:!0},{pattern:/(\|\s*)(?:\\?\b[a-z_]\w*)+\b/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(?:\\?\b[a-z_]\w*)+\b(?=\s*\|)/i,alias:"class-name-fully-qualified",greedy:!0,inside:{punctuation:/\\/}},{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self\b|\s+static\b))\s+|\bcatch\s*\()(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*\$)/i,alias:"type-declaration",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-declaration"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*::)/i,alias:["class-name-fully-qualified","static-context"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/([(,?]\s*)[a-z_]\w*(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-hint"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b[a-z_]\w*(?!\\)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:["class-name-fully-qualified","return-type"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:s,function:{pattern:/(^|[^\\\w])\\?[a-z_](?:[\w\\]*\w)?(?=\s*\()/i,lookbehind:!0,inside:{punctuation:/\\/}},property:{pattern:/(->\s*)\w+/,lookbehind:!0},number:n,operator:l,punctuation:o};var u={pattern:/\{\$(?:\{(?:\{[^{}]+\}|[^{}]+)\}|[^{}])+\}|(^|[^\\{])\$+(?:\w+(?:\[[^\r\n\[\]]+\]|->\w+)?)/,lookbehind:!0,inside:r.languages.php},c=[{pattern:/<<<'([^']+)'[\r\n](?:.*[\r\n])*?\1;/,alias:"nowdoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<'[^']+'|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<'?|[';]$/}}}},{pattern:/<<<(?:"([^"]+)"[\r\n](?:.*[\r\n])*?\1;|([a-z_]\w*)[\r\n](?:.*[\r\n])*?\2;)/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<(?:"[^"]+"|[a-z_]\w*)|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<"?|[";]$/}},interpolation:u}},{pattern:/`(?:\\[\s\S]|[^\\`])*`/,alias:"backtick-quoted-string",greedy:!0},{pattern:/'(?:\\[\s\S]|[^\\'])*'/,alias:"single-quoted-string",greedy:!0},{pattern:/"(?:\\[\s\S]|[^\\"])*"/,alias:"double-quoted-string",greedy:!0,inside:{interpolation:u}}];r.languages.insertBefore("php","variable",{string:c,attribute:{pattern:/#\[(?:[^"'\/#]|\/(?![*/])|\/\/.*$|#(?!\[).*$|\/\*(?:[^*]|\*(?!\/))*\*\/|"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*')+\](?=\s*[a-z$#])/im,greedy:!0,inside:{"attribute-content":{pattern:/^(#\[)[\s\S]+(?=\]$)/,lookbehind:!0,inside:{comment:t,string:c,"attribute-class-name":[{pattern:/([^:]|^)\b[a-z_]\w*(?!\\)\b/i,alias:"class-name",greedy:!0,lookbehind:!0},{pattern:/([^:]|^)(?:\\?\b[a-z_]\w*)+/i,alias:["class-name","class-name-fully-qualified"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:s,number:n,operator:l,punctuation:o}},delimiter:{pattern:/^#\[|\]$/,alias:"punctuation"}}}}),r.hooks.add("before-tokenize",function(d){if(/<\?/.test(d.code)){var i=/<\?(?:[^"'/#]|\/(?![*/])|("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|(?:\/\/|#(?!\[))(?:[^?\n\r]|\?(?!>))*(?=$|\?>|[\r\n])|#\[|\/\*(?:[^*]|\*(?!\/))*(?:\*\/|$))*?(?:\?>|$)/g;r.languages["markup-templating"].buildPlaceholders(d,"php",i)}}),r.hooks.add("after-tokenize",function(d){r.languages["markup-templating"].tokenizePlaceholders(d,"php")})})(Prism)),Jt}xr();var Ut={},Gt;function pr(){return Gt||(Gt=1,(function(r){r.languages.ruby=r.languages.extend("clike",{comment:{pattern:/#.*|^=begin\s[\s\S]*?^=end/m,greedy:!0},"class-name":{pattern:/(\b(?:class|module)\s+|\bcatch\s+\()[\w.\\]+|\b[A-Z_]\w*(?=\s*\.\s*new\b)/,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:BEGIN|END|alias|and|begin|break|case|class|def|define_method|defined|do|each|else|elsif|end|ensure|extend|for|if|in|include|module|new|next|nil|not|or|prepend|private|protected|public|raise|redo|require|rescue|retry|return|self|super|then|throw|undef|unless|until|when|while|yield)\b/,operator:/\.{2,3}|&\.|===|<?=>|[!=]?~|(?:&&|\|\||<<|>>|\*\*|[+\-*/%<>!^&|=])=?|[?:]/,punctuation:/[(){}[\].,;]/}),r.languages.insertBefore("ruby","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}});var t={pattern:/((?:^|[^\\])(?:\\{2})*)#\{(?:[^{}]|\{[^{}]*\})*\}/,lookbehind:!0,inside:{content:{pattern:/^(#\{)[\s\S]+(?=\}$)/,lookbehind:!0,inside:r.languages.ruby},delimiter:{pattern:/^#\{|\}$/,alias:"punctuation"}}};delete r.languages.ruby.function;var s="(?:"+[/([^a-zA-Z0-9\s{(\[<=])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,/\((?:[^()\\]|\\[\s\S]|\((?:[^()\\]|\\[\s\S])*\))*\)/.source,/\{(?:[^{}\\]|\\[\s\S]|\{(?:[^{}\\]|\\[\s\S])*\})*\}/.source,/\[(?:[^\[\]\\]|\\[\s\S]|\[(?:[^\[\]\\]|\\[\s\S])*\])*\]/.source,/<(?:[^<>\\]|\\[\s\S]|<(?:[^<>\\]|\\[\s\S])*>)*>/.source].join("|")+")",n=/(?:"(?:\\.|[^"\\\r\n])*"|(?:\b[a-zA-Z_]\w*|[^\s\0-\x7F]+)[?!]?|\$.)/.source;r.languages.insertBefore("ruby","keyword",{"regex-literal":[{pattern:RegExp(/%r/.source+s+/[egimnosux]{0,6}/.source),greedy:!0,inside:{interpolation:t,regex:/[\s\S]+/}},{pattern:/(^|[^/])\/(?!\/)(?:\[[^\r\n\]]+\]|\\.|[^[/\\\r\n])+\/[egimnosux]{0,6}(?=\s*(?:$|[\r\n,.;})#]))/,lookbehind:!0,greedy:!0,inside:{interpolation:t,regex:/[\s\S]+/}}],variable:/[@$]+[a-zA-Z_]\w*(?:[?!]|\b)/,symbol:[{pattern:RegExp(/(^|[^:]):/.source+n),lookbehind:!0,greedy:!0},{pattern:RegExp(/([\r\n{(,][ \t]*)/.source+n+/(?=:(?!:))/.source),lookbehind:!0,greedy:!0}],"method-definition":{pattern:/(\bdef\s+)\w+(?:\s*\.\s*\w+)?/,lookbehind:!0,inside:{function:/\b\w+$/,keyword:/^self\b/,"class-name":/^\w+/,punctuation:/\./}}}),r.languages.insertBefore("ruby","string",{"string-literal":[{pattern:RegExp(/%[qQiIwWs]?/.source+s),greedy:!0,inside:{interpolation:t,string:/[\s\S]+/}},{pattern:/("|')(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|(?!\1)[^\\#\r\n])*\1/,greedy:!0,inside:{interpolation:t,string:/[\s\S]+/}},{pattern:/<<[-~]?([a-z_]\w*)[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?[a-z_]\w*|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?/}},interpolation:t,string:/[\s\S]+/}},{pattern:/<<[-~]?'([a-z_]\w*)'[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?'[a-z_]\w*'|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?'|'$/}},string:/[\s\S]+/}}],"command-literal":[{pattern:RegExp(/%x/.source+s),greedy:!0,inside:{interpolation:t,command:{pattern:/[\s\S]+/,alias:"string"}}},{pattern:/`(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|[^\\`#\r\n])*`/,greedy:!0,inside:{interpolation:t,command:{pattern:/[\s\S]+/,alias:"string"}}}]}),delete r.languages.ruby.string,r.languages.insertBefore("ruby","number",{builtin:/\b(?:Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Fixnum|Float|Hash|IO|Integer|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|Stat|String|Struct|Symbol|TMS|Thread|ThreadGroup|Time|TrueClass)\b/,constant:/\b[A-Z][A-Z0-9_]*(?:[?!]|\b)/}),r.languages.rb=r.languages.ruby})(Prism)),Ut}pr();const mr=.4;function Kt(r){const t=[];let s=0;for(;s<r.length;){const n=r[s];if(/[\p{L}\p{N}_]/u.test(n)){let l=s+1;for(;l<r.length&&/[\p{L}\p{N}_]/u.test(r[l]);)l++;t.push(r.slice(s,l)),s=l}else if(/\s/.test(n)){let l=s+1;for(;l<r.length&&/\s/.test(r[l]);)l++;t.push(r.slice(s,l)),s=l}else{const o=r.codePointAt(s)>65535?2:1;t.push(r.slice(s,s+o)),s+=o}}return t}function hr(r,t){const s=or(Kt(r),Kt(t)),n=r.length+t.length;let l=0;const o=[],u=[];let c=0,d=0;for(const i of s){const x=i.value.reduce((h,g)=>h+g.length,0);i.removed?(l+=x,o.push({start:c,end:c+x}),c+=x):i.added?(l+=x,u.push({start:d,end:d+x}),d+=x):(c+=x,d+=x)}return n>0&&l/n>mr?[[],[]]:[o,u]}function vs(r){const t=[];let s=null;for(const n of r.split(`
|
|
3
|
-
`)){if(n.startsWith("---")||n.startsWith("+++")||n.startsWith("index ")||n.startsWith("diff --git")||n.startsWith("==="))continue;const l=n.match(/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/);if(l){s&&t.push(s),s={oldStart:parseInt(l[1],10),oldLines:parseInt(l[2]??"1",10),newStart:parseInt(l[3],10),newLines:parseInt(l[4]??"1",10),lines:[]};continue}if(!n.startsWith("\\")){if(s&&(n.startsWith("+")||n.startsWith("-")||n.startsWith(" ")||n==="")){s.lines.push(n);continue}s&&n&&(t.push(s),s=null)}}return s&&t.push(s),t}function js(r){let t=r.oldStart,s=r.newStart;const n=[];for(const l of r.lines){const o=l[0]==="+"||l[0]==="-"?l[0]:" ",u=l.slice(1);let c=null,d=null;o==="-"?c=t++:(o==="+"||(c=t++),d=s++),n.push({marker:o,code:u,oldLine:c,newLine:d})}return n}const fr=a.memo(function({filePath:t,content:s,language:n}){if(!s&&!t)return null;const[l,o]=a.useState("unified"),[u,c]=a.useState(!1),d=br(t,n),i=(s==null?void 0:s.includes("@@"))||(s==null?void 0:s.includes("+++"))||(s==null?void 0:s.includes("---")),x=i?gr(s||""):null;return e.jsxs("div",{className:"mt-2 border border-dark-border rounded-lg overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-dark-surface border-b border-dark-border",children:[e.jsx("span",{className:"text-accent-purple text-xs",children:"📝"}),e.jsx("span",{className:"text-xs font-mono text-dark-fg truncate",children:t||"file"}),x&&e.jsxs("span",{className:"text-xs ml-2 flex gap-2",children:[e.jsxs("span",{className:"text-green-400",children:["+",x.additions]}),e.jsxs("span",{className:"text-red-400",children:["-",x.deletions]})]}),e.jsx("span",{className:"text-xs text-dark-muted ml-auto",children:d}),i&&e.jsxs("div",{className:"flex gap-0.5 ml-2",children:[e.jsx("button",{onClick:()=>o("unified"),className:`text-xs px-1.5 py-0.5 rounded ${l==="unified"?"bg-accent-blue/20 text-accent-blue":"text-dark-muted hover:text-dark-fg"}`,title:"Unified view",children:"Unified"}),e.jsx("button",{onClick:()=>o("side-by-side"),className:`text-xs px-1.5 py-0.5 rounded ${l==="side-by-side"?"bg-accent-blue/20 text-accent-blue":"text-dark-muted hover:text-dark-fg"}`,title:"Side-by-side view",children:"Side"})]}),e.jsx("button",{onClick:()=>c(!u),className:"text-xs text-dark-muted hover:text-dark-fg ml-1",children:u?"▶":"▼"})]}),!u&&e.jsxs("div",{className:"bg-dark-bg overflow-x-auto max-h-96 overflow-y-auto custom-scrollbar",children:[i?l==="unified"?vr(s||"",d):jr(s||"",d):e.jsx("pre",{className:"text-xs font-mono p-2 text-dark-fg whitespace-pre-wrap",children:s||"(no content)"}),x&&e.jsxs("div",{className:"sticky bottom-0 bg-dark-surface border-t border-dark-border px-3 py-1 flex gap-4 text-xs text-dark-muted",children:[e.jsxs("span",{className:"text-green-400",children:["+",x.additions," additions"]}),e.jsxs("span",{className:"text-red-400",children:["-",x.deletions," deletions"]}),e.jsxs("span",{children:[x.hunks," hunks"]})]})]})]})});function br(r,t){var l;if(t)return t;if(!r)return"plaintext";const s=(l=r.split(".").pop())==null?void 0:l.toLowerCase();return{ts:"typescript",tsx:"typescript",mts:"typescript",js:"javascript",jsx:"javascript",mjs:"javascript",cjs:"javascript",py:"python",go:"go",rs:"rust",cpp:"cpp",cxx:"cpp",hpp:"cpp",cc:"cpp",c:"cpp",h:"cpp",css:"css",scss:"css",html:"markup",htm:"markup",svg:"markup",xml:"xml",json:"json",yml:"yaml",yaml:"yaml",md:"markdown",sql:"sql",sh:"bash",bash:"bash",zsh:"bash",php:"php",rb:"ruby"}[s||""]||"plaintext"}function gr(r){const t=r.split(`
|
|
4
|
-
`);let s=0,n=0,l=0;for(const o of t)o.startsWith("@@")?l++:o.startsWith("+")&&!o.startsWith("+++")?s++:o.startsWith("-")&&!o.startsWith("---")&&n++;return{additions:s,deletions:n,hunks:l,filesChanged:1}}function kr(r){const t=[],s=(l,o)=>{if(!o)return;const u=t[t.length-1];u&&u.type===l?u.text+=o:t.push({type:l,text:o})},n=(l,o)=>{if(typeof l=="string"){s(o,l);return}const u=l.type||o;if(typeof l.content=="string"){s(u,l.content);return}for(const c of l.content)n(c,u)};for(const l of r)n(l,"");return t}function Ns(r,t){const s=Pt.languages[t];if(!s)return[{type:"",text:r}];try{return kr(Pt.tokenize(r,s))}catch{return[{type:"",text:r}]}}function yr(r,t){if(t.length===0)return r.map(l=>({...l,word:!1}));const s=[];let n=0;for(const l of r){const o=n,u=n+l.text.length;let c=0;for(const d of t){const i=Math.max(0,d.start-o),x=Math.min(l.text.length,d.end-o);x<=0||i>=l.text.length||(i>c&&s.push({type:l.type,text:l.text.slice(c,i),word:!1}),s.push({type:l.type,text:l.text.slice(i,x),word:!0}),c=x)}c<l.text.length&&s.push({type:l.type,text:l.text.slice(c),word:!1}),n=u}return s}function wr({code:r,marker:t,lang:s,ranges:n}){const l=t==="-"?[{type:"",text:r}]:Ns(r,s),o=yr(l,n),u=t==="+"?"bg-green-900/30":t==="-"?"bg-red-900/30":"",c=t==="+"?"bg-green-700/60":"bg-red-700/60";return e.jsx("span",{className:`flex-1 whitespace-pre-wrap px-2 ${u}`,children:o.length===0?" ":o.map((d,i)=>e.jsx("span",{className:[d.type?`token ${d.type}`:"",d.word&&t!==" "?c:""].join(" "),children:d.text},i))})}function vr(r,t){const s=vs(r);if(s.length===0)return e.jsx("pre",{className:"text-xs font-mono p-2 text-dark-fg whitespace-pre-wrap",children:r});const n=[];let l=0;for(const o of s){const u=js(o);n.push(e.jsxs("div",{className:"flex text-xs font-mono leading-snug bg-accent-blue/5 text-accent-blue font-bold px-2",style:{minHeight:"1.25rem"},children:[e.jsx("span",{className:"select-none shrink-0 text-right pr-1",children:"@"}),e.jsxs("span",{className:"flex-1 whitespace-pre-wrap",children:["@@ -",o.oldStart,",",o.oldLines," +",o.newStart,",",o.newLines," @@"]})]},l++));const c=new Map;for(let d=0;d<u.length;){if(u[d].marker!=="-"){d++;continue}const i=d;for(;d<u.length&&u[d].marker==="-";)d++;const x=d;for(;d<u.length&&u[d].marker==="+";)d++;const h=Math.min(x-i,d-x);for(let g=0;g<h;g++){const[k,b]=hr(u[i+g].code,u[x+g].code);c.set(i+g,k),c.set(x+g,b)}}for(let d=0;d<u.length;d++){const i=u[d],x=i.marker==="+",h=i.marker==="-",g=x?"bg-green-900/30":h?"bg-red-900/30":"",k=i.marker==="-"?i.oldLine:i.newLine;n.push(e.jsxs("div",{className:"flex text-xs font-mono leading-snug",style:{minHeight:"1.25rem"},children:[e.jsxs("span",{className:`select-none shrink-0 w-9 text-right pr-1 ${g} ${x?"text-green-400":h?"text-red-400":"text-dark-muted"}`,children:[i.marker===" "?"":i.marker,k??""]}),e.jsx(wr,{code:i.code,marker:i.marker,lang:t,ranges:c.get(d)??[]})]},l++))}}return e.jsx("div",{children:n})}function Zt({code:r,lang:t,kind:s}){if(r==="")return e.jsx("span",{className:"flex-1 px-2 border-r border-dark-border/30 font-mono text-xs leading-snug",style:{minHeight:"1.25rem"},children:" "});const n=s==="remove"?[{type:"",text:r}]:Ns(r,t),l=s==="add"?"bg-green-900/30":s==="remove"?"bg-red-900/30":"";return e.jsx("span",{className:`flex-1 px-2 border-r border-dark-border/30 font-mono text-xs leading-snug ${l}`,children:n.map((o,u)=>e.jsx("span",{className:o.type?`token ${o.type}`:"",children:o.text},u))})}function jr(r,t){const s=vs(r);if(s.length===0)return e.jsx("pre",{className:"text-xs font-mono p-2 text-dark-fg whitespace-pre-wrap",children:r});const n=[];for(const l of s){const o=js(l);n.push({left:`@@ -${l.oldStart},${l.oldLines} +${l.newStart},${l.newLines} @@`,right:"",type:"header"});let u=[],c=[];const d=()=>{(u.length>0||c.length>0)&&(Nr(n,u,c),u=[],c=[])};for(const i of o)i.marker==="-"?u.push(i.code):i.marker==="+"?c.push(i.code):(d(),n.push({left:i.code,right:i.code,type:"context"}));d()}return e.jsxs("div",{children:[e.jsxs("div",{className:"flex border-b border-dark-border text-xs font-bold text-dark-muted",children:[e.jsx("div",{className:"flex-1 px-2 py-0.5 border-r border-dark-border",children:"Old"}),e.jsx("div",{className:"flex-1 px-2 py-0.5",children:"New"})]}),n.map((l,o)=>l.type==="header"?e.jsx("div",{className:"bg-accent-blue/5 text-accent-blue font-bold font-mono text-xs leading-snug px-2",children:l.left},o):e.jsxs("div",{className:"flex",style:{minHeight:"1.25rem"},children:[e.jsx(Zt,{code:l.type==="replace"||l.type==="delete"?"- "+l.left:l.left,lang:t,kind:l.type==="replace"||l.type==="delete"?"remove":"context"}),e.jsx(Zt,{code:l.type==="replace"||l.type==="add"?"+ "+l.right:l.right,lang:t,kind:l.type==="replace"||l.type==="add"?"add":"context"})]},o))]})}function Nr(r,t,s){const n=Math.max(t.length,s.length);for(let l=0;l<n;l++){const o=l<t.length?t[l]??"":"",u=l<s.length?s[l]??"":"";r.push({left:o,right:u,type:l<t.length&&l<s.length?"replace":l<t.length?"delete":"add"})}}function Ss(r){const t=a.useRef(null),s=a.useRef(0);return a.useEffect(()=>{if(!r){s.current=0;return}s.current=Date.now();const n=t.current;if(!n)return;const l=()=>{const u=Math.floor((Date.now()-s.current)/1e3),c=u>=60?`${Math.floor(u/60)}m ${u%60}s`:`${u}s`;n.textContent=c};l();const o=setInterval(l,1e3);return()=>clearInterval(o)},[r]),t}function Sr(r){return typeof r=="string"?r:r&&typeof r=="object"?JSON.stringify(r,null,2):String(r??"")}const Vt=20,Cr=/\b(grep|search_contents)\b/i;function Er(r){return r===""?0:r.split(`
|
|
5
|
-
`).length}const Qt=a.memo(function({toolCall:t,defaultCollapsed:s=!0}){const{t:n}=G(),l=t.status==="running",o=Ss(l),u=t.result!==void 0&&t.result!==null,c=t.status==="error",d=Bn(t.name),i=u?Sr(t.result):"",x=u?Er(i):0,h=Cr.test(t.name),g=t.noTruncate!==!0&&h&&u&&!c&&x>Vt,[k,b]=a.useState(!1),w=g&&!k?i.split(`
|
|
6
|
-
`).slice(0,Vt).join(`
|
|
7
|
-
`)+`
|
|
8
|
-
${n("toolCall.linesTotal",{n:x})}`:i,y=t.diff||(d&&i&&(i.includes("@@")||i.includes("+++")||i.includes("---"))?i:void 0),p=fs(t.args),[E,F]=a.useState(s),C=t.duration??0,z=C>0?C>=60?`${Math.floor(C/60)}m ${C%60}s`:`${C}s`:"",D=l?"bg-accent-blue":c?"bg-accent-red":"bg-accent-green",j=l?"running":c?"error":"success";return e.jsxs("div",{className:"tl-row rounded-lg transition-colors hover:bg-dark-surface/40","data-testid":"toolcall-row",children:[e.jsx("span",{className:"tl-line","aria-hidden":"true"}),e.jsxs("div",{className:"relative flex items-center gap-2 px-2 py-1 cursor-pointer select-none",onClick:()=>F(!E),children:[e.jsx("span",{className:"flex h-3 w-3 shrink-0 items-center justify-center",children:l?e.jsx("span",{className:"inline-block h-3 w-3 rounded-full border-2 border-accent-blue border-r-transparent animate-spin"}):e.jsx("span",{className:`tl-node ${D}`,"data-status":j})}),e.jsx("span",{className:"text-dark-muted shrink-0",children:e.jsx(cs,{size:12,"aria-hidden":"true"})}),e.jsx("span",{className:`font-medium text-[13px] truncate ${l?"text-shimmer":"text-dark-text"}`,children:t.name}),d&&p&&!c&&e.jsxs("button",{type:"button",onClick:N=>{N.stopPropagation(),bs(p)},className:`flex items-center gap-1 max-w-[16rem] shrink truncate rounded-full border border-dark-border/70 px-2 py-0.5 text-[11px] font-mono text-accent-blue
|
|
9
|
-
hover:bg-dark-hover hover:border-accent-blue/40 transition-colors`,title:p,children:[e.jsx(ds,{size:10,className:"shrink-0"}),e.jsx("span",{className:"truncate",children:p})]}),l&&e.jsxs("span",{className:"text-[11px] text-accent-blue shrink-0 flex items-center gap-1 tabular-nums",children:[e.jsx(ze,{size:10}),e.jsx("span",{ref:o,children:"0s"})]}),!l&&z&&e.jsxs("span",{className:"text-[10px] text-dark-muted shrink-0 flex items-center gap-1 tabular-nums",children:[e.jsx(ze,{size:10}),e.jsx("span",{children:z})]}),e.jsx("span",{className:`ml-auto shrink-0 text-dark-muted/60 transition-transform ${E?"":"rotate-180"}`,children:e.jsx(ge,{size:13})})]}),!E&&e.jsxs("div",{className:"relative ml-[15px] pb-1 pl-3 border-l border-dark-border/25 space-y-1",children:[e.jsxs("div",{className:"py-0.5 px-2",children:[e.jsx("div",{className:"text-[10px] text-dark-muted mb-0.5",children:n("step.params")}),e.jsx("pre",{className:"text-[11px] font-mono bg-dark-bg border border-dark-border p-2 rounded overflow-x-auto max-h-24 overflow-y-auto custom-scrollbar",children:typeof t.args=="string"?t.args:JSON.stringify(t.args,null,2)})]}),u&&e.jsxs("div",{className:"py-0.5 px-2",children:[e.jsx("div",{className:`text-[10px] mb-0.5 ${c?"text-accent-red":"text-accent-green"}`,children:n(c?"step.error":"step.result")}),d&&(y||i)?e.jsx(fr,{filePath:p,content:y||i}):e.jsxs(e.Fragment,{children:[e.jsx("pre",{className:`text-[11px] font-mono bg-dark-bg border border-dark-border p-2 rounded overflow-x-auto max-h-48 overflow-y-auto custom-scrollbar whitespace-pre-wrap break-all ${c?"text-accent-red":"text-accent-green"}`,children:w}),g&&e.jsx("button",{type:"button","data-testid":"grep-result-toggle",onClick:()=>b(N=>!N),className:"mt-1 text-[10px] text-accent-blue hover:underline",children:k?n("toolCall.collapse"):n("toolCall.expandAll",{n:x})})]})]})]})]})}),Nt=a.memo(function({toolCalls:t,label:s,defaultCollapsed:n=!0}){const{t:l}=G(),[o,u]=a.useState(n),c=a.useMemo(()=>{const w=new Map;for(const y of t)w.set(y.name,(w.get(y.name)??0)+1);return[...w.entries()].sort((y,p)=>p[1]-y[1])},[t]),d=a.useMemo(()=>t.some(w=>w.status==="running")?"running":t.some(w=>w.status==="error")?"error":"completed",[t]);if(t.length===0)return null;if(t.length===1){const w=t[0];return e.jsx(Qt,{toolCall:w})}const x=c.slice(0,3),h=c.length-x.length,g=t.reduce((w,y)=>w+(y.duration??0),0),k=g>=60?`${Math.floor(g/60)}m ${g%60}s`:g>=1?`${g}s`:"",b=d==="running"?"bg-accent-blue":d==="error"?"bg-accent-red":"bg-accent-green";return e.jsxs("div",{className:"tl-row rounded-lg transition-colors hover:bg-dark-surface/40","data-testid":"toolcall-group",children:[e.jsx("span",{className:"tl-line","aria-hidden":"true"}),e.jsxs("div",{className:"relative flex items-center gap-2 px-2 py-1 cursor-pointer select-none",onClick:()=>u(!o),"data-testid":"toolcall-group-toggle",children:[e.jsx("span",{className:"flex h-3 w-3 shrink-0 items-center justify-center",children:d==="running"?e.jsx("span",{className:"inline-block w-3 h-3 rounded-full border-2 border-accent-blue border-r-transparent animate-spin"}):e.jsx("span",{className:`w-2 h-2 rounded-full ${b}`})}),e.jsx("span",{className:"text-dark-muted shrink-0",children:e.jsx(cs,{size:12,"aria-hidden":"true"})}),e.jsx("span",{className:"font-medium text-[13px] text-dark-text shrink-0","data-testid":"toolcall-group-count",children:l("activity.toolCallCount",{count:t.length})}),x.map(([w,y])=>e.jsxs("span",{className:"shrink-0 rounded-full bg-dark-muted/10 px-1.5 py-px text-[10.5px] font-mono text-dark-muted",children:[w," ×",y]},w)),h>0&&e.jsx("span",{className:"shrink-0 text-[10.5px] text-dark-muted",children:l("activity.toolNamesMore",{count:h})}),k&&e.jsx("span",{className:"shrink-0 text-[10px] text-dark-muted tabular-nums",children:k}),e.jsx("span",{className:`ml-auto shrink-0 text-dark-muted/60 transition-transform ${o?"":"rotate-180"}`,children:e.jsx(ge,{size:13})})]}),!o&&e.jsxs("div",{className:"relative ml-[15px] pb-1 pl-3 border-l border-dark-border/25 space-y-0.5",children:[e.jsx("div",{className:"px-2 pt-0.5 text-[10px] uppercase tracking-wide text-dark-muted/60",children:s??l("activity.evidence")}),t.map(w=>e.jsx(Qt,{toolCall:w},w.id))]})]})}),_r=a.memo(function({text:t,maxLength:s=300,preformatted:n=!1}){const{t:l}=G(),[o,u]=a.useState(!1);return t.length>s?e.jsxs("div",{children:[n?e.jsx("pre",{className:"text-xs font-mono bg-dark-bg p-1.5 rounded overflow-x-auto custom-scrollbar mt-1 text-accent-green",children:o?t:t.slice(0,s)+"..."}):e.jsx("div",{className:"text-dark-text leading-snug",children:o?t:t.slice(0,s)+"..."}),e.jsx("button",{onClick:d=>{d.stopPropagation(),u(!o)},className:"mt-1 text-[10px] px-2 py-0.5 rounded bg-dark-hover text-accent-blue hover:bg-dark-border transition-colors",children:l(o?"common.collapse_short":"common.expand")})]}):n?e.jsx("pre",{className:"text-xs font-mono bg-dark-bg p-1.5 rounded overflow-x-auto custom-scrollbar mt-1 text-accent-green",children:t}):e.jsx("div",{className:"text-dark-text leading-snug",children:t})}),Ar=a.memo(function({step:t,defaultCollapsed:s=!0}){const{t:n}=G(),[l,o]=a.useState(s),[u,c]=a.useState(!0),d=t.status==="running",i=Ss(d),x=t.description||t.thought||t.result||t.action||t.toolCalls&&t.toolCalls.length>0,h=t.duration??0,g=h>0?h>=60?`${Math.floor(h/60)}m ${h%60}s`:`${h}s`:"";return e.jsxs("div",{className:"tl-row rounded-lg transition-colors hover:bg-dark-surface/40","data-testid":"step-row",children:[e.jsx("span",{className:"tl-line","aria-hidden":"true"}),e.jsxs("div",{className:"relative flex items-center gap-2 px-2 py-1 cursor-pointer select-none",onClick:()=>x&&o(!l),children:[e.jsx("span",{className:"flex h-3 w-3 shrink-0 items-center justify-center",children:e.jsx("span",{className:"tl-node","data-status":t.status})}),e.jsx("span",{className:`text-[13px] truncate ${d?"text-shimmer":"text-dark-text"}`,children:t.title}),d&&e.jsxs("span",{className:"text-[11px] text-accent-blue shrink-0 flex items-center gap-1 tabular-nums",children:[e.jsx(ze,{size:10}),e.jsx("span",{ref:i,children:"0s"})]}),!d&&g&&e.jsxs("span",{className:"text-[10px] text-dark-muted shrink-0 flex items-center gap-1 tabular-nums",children:[e.jsx(ze,{size:10}),e.jsx("span",{children:g})]}),x&&e.jsx("span",{className:`ml-auto shrink-0 text-dark-muted/60 transition-transform ${l?"":"rotate-180"}`,children:e.jsx(ge,{size:13})})]}),!l&&x&&e.jsxs("div",{className:"relative ml-[15px] pb-1 pl-3 border-l border-dark-border/25 space-y-1",children:[t.description&&e.jsx("div",{className:"text-dark-muted py-0.5 px-2 text-xs",children:t.description}),t.thought&&e.jsxs("div",{className:"py-0.5 px-2 text-xs border-l-2 border-accent-purple/40 bg-accent-purple/5 rounded-r",children:[e.jsxs("div",{className:"flex items-center gap-1 text-accent-purple cursor-pointer hover:opacity-80 select-none",onClick:()=>c(!u),children:[u?e.jsx(ke,{size:12}):e.jsx(ge,{size:12}),e.jsx(sn,{size:12,"aria-hidden":"true"}),e.jsx("span",{children:n("step.thinking")}),u&&e.jsxs("span",{className:"text-[10px] text-dark-muted truncate max-w-[200px]",children:[t.thought.slice(0,80).replace(/\n/g," "),"..."]})]}),!u&&e.jsx("div",{className:"text-dark-muted italic whitespace-pre-wrap leading-snug mt-1",children:t.thought.replace(/\n\s*\n+/g,`
|
|
10
|
-
`)})]}),t.action&&e.jsxs("div",{className:"py-0.5 px-2 text-xs border-l-2 border-accent-yellow/40 bg-accent-yellow/5 rounded-r",children:[e.jsxs("div",{className:"flex items-center gap-1 text-accent-yellow mb-0.5",children:[e.jsx(yt,{size:12,"aria-hidden":"true"}),e.jsx("span",{children:n("step.action")})]}),e.jsx("div",{className:"text-dark-text leading-snug font-mono text-[11px]",children:t.action})]}),t.toolCalls&&t.toolCalls.length>0&&e.jsx("div",{className:"px-1 py-0.5",children:e.jsx(Nt,{toolCalls:t.toolCalls})}),t.result&&e.jsxs("div",{className:"py-0.5 px-2 text-xs border-l-2 border-accent-green/40 bg-accent-green/5 rounded-r",children:[e.jsxs("div",{className:"flex items-center gap-1 text-accent-green mb-0.5",children:[e.jsx(je,{size:12,"aria-hidden":"true"}),e.jsx("span",{children:n("step.result")})]}),e.jsx(_r,{text:t.result,maxLength:500})]})]})]})}),Mr=a.memo(function({steps:t,isGenerating:s}){const{t:n}=G(),[l,o]=a.useState(s),u=a.useRef(s);a.useEffect(()=>{u.current&&!s&&o(!1),u.current=s},[s]);const c=t.length,d=s||t.some(k=>k.status==="running"),i=[...t].reverse().find(k=>k.status==="running"),x=t[t.length-1],h=(i==null?void 0:i.title)||(x==null?void 0:x.title)||"",g=`${c} ${n(c===1?"chat.stepCount":"chat.stepCountPlural")}`;return e.jsxs("div",{className:"mb-1 rounded-lg border border-dark-border/50 transition-colors","data-testid":"turn-group",children:[e.jsxs("button",{className:"flex w-full items-center gap-2 px-2 py-1 text-left cursor-pointer select-none hover:bg-dark-surface/40",onClick:()=>o(!l),"data-testid":"turn-group-toggle",children:[e.jsx("span",{className:"shrink-0 text-dark-muted/60 transition-transform",children:l?e.jsx(ge,{size:13}):e.jsx(ke,{size:13})}),d?e.jsx("span",{className:"flex h-3 w-3 shrink-0 items-center justify-center",children:e.jsx("span",{className:"tl-node bg-accent-blue","data-status":"running"})}):e.jsx("span",{className:"w-2 h-2 shrink-0 rounded-full bg-accent-green"}),e.jsx("span",{className:`text-xs ${d?"text-shimmer":"text-dark-muted"}`,children:d?`${n("chat.runningSteps")} ${g}…`:g}),d&&h&&e.jsxs("span",{className:"min-w-0 flex-1 truncate pl-1 text-xs text-dark-muted/70",children:["· ",h]})]}),l&&e.jsx("div",{className:"ml-[15px] pb-1 pl-3 border-l border-dark-border/25 space-y-0.5",children:t.map(k=>e.jsx(Ar,{step:k},k.id))})]})});function Cs(r){const t=r??"";let s=t,n=null,l=null;try{const o=JSON.parse(t);if(o&&typeof o=="object")if("payload"in o){l=typeof o.toolName=="string"?o.toolName:null;const u=o.payload;typeof u=="string"?s=u:u&&typeof u=="object"?(n=u,s=JSON.stringify(u,null,2)):s=""}else Array.isArray(o)||(n=o)}catch{s=t}if(!n&&s.length>0&&/^[\s]*[{[]/.test(s))try{const o=JSON.parse(s);o&&typeof o=="object"&&!Array.isArray(o)&&(n=o)}catch{}return{toolName:l,payloadText:s,args:n}}const St=/\b(bash|shell|exec|cmd|powershell|terminal)\b/i,Es=/write_file|write|save|create|upload|deploy|publish/i,_s=/edit_file|edit|patch|apply|update|replace/i,As=/read_file|read|view|cat|open|list|dir\b/i,zr=/file_delete|delete|remove|unlink|\brm\b|\bdel\b/i,Tr=/\b(glob|find|locate)\b/i,Ir=/\b(grep|rg|search_contents)\b/i,Rr=/web_search|search_web|browse/i,Ms=/web_fetch|fetch|http|curl|wget|download|request|api/i,$r=/git|commit|merge|rebase|push|checkout/i,Pr=/install|uninstall|npm|pnpm|yarn|pip|cargo|gem|apt|brew|choco/i,Ct=/send_message|send_file|message|notify|post/i;function zs(r){const t=r.toLowerCase();return St.test(t)?"verbRunCommand":Rr.test(t)?"verbSearchWeb":Es.test(t)?"verbWriteFile":_s.test(t)?"verbEditFile":zr.test(t)?"verbDeleteFile":As.test(t)?"verbReadFile":Ir.test(t)?"verbSearchContents":Tr.test(t)?"verbFindFiles":Ms.test(t)?"verbFetchUrl":$r.test(t)?"verbGit":Pr.test(t)?"verbInstall":Ct.test(t)?"verbSendMessage":"verbRunTool"}function nt(r,t){const s=(r??"").replace(/\s+/g," ").trim();return s.length>t?`${s.slice(0,t-1)}…`:s}function Dr(r){if(!r)return null;for(const t of["file_path","filePath","path","file","target"]){const s=r[t];if(typeof s=="string"&&s.length>0)return s}return null}function Ts(r,t){const{payloadText:s,args:n}=Cs(t),l=r.toLowerCase();if(St.test(l))return"";const o=Dr(n);if(o)return o;const u=s.match(/(?:file_path|path|file)["\s:=]+([^\s",}]+)/i);if(u!=null&&u[1])return u[1];if(Ms.test(l)&&typeof(n==null?void 0:n.url)=="string"&&n.url)return nt(n.url,48);if(Ct.test(l)){const c=typeof(n==null?void 0:n.text)=="string"?n.text:typeof(n==null?void 0:n.message)=="string"?n.message:s;return nt(c,48)}return nt(s,48)}function Is(r,t){const{payloadText:s,args:n}=Cs(t),l=r.toLowerCase();if(St.test(l)){const o=typeof(n==null?void 0:n.command)=="string"?n.command:s;return o?{text:o,mono:!0}:null}if(Es.test(l)||_s.test(l)){const o=typeof(n==null?void 0:n.content)=="string"?n.content:typeof(n==null?void 0:n.data)=="string"?n.data:"";if(o)return{text:o,mono:!0};if(n){const u=Xt(n);if(u)return{text:u,mono:!0}}return s?{text:s,mono:!0}:null}if(Ct.test(l)){const o=typeof(n==null?void 0:n.text)=="string"?n.text:typeof(n==null?void 0:n.message)=="string"?n.message:s;return o?{text:o,mono:!1}:null}if(As.test(l))return null;if(n){const o=Xt(n);if(o)return{text:o,mono:!0}}return s?{text:s,mono:!0}:null}function Xt(r){return r?Object.entries(r).filter(([,t])=>t!=null).map(([t,s])=>{let n=typeof s=="string"?s:JSON.stringify(s);return n.length>96&&(n=`${n.slice(0,95)}…`),`${t}=${n.replace(/\n/g," ")}`}).join(" "):""}function Rs(r,t){const s=Oe(t);return s?{path:s,external:!0}:{key:"scopeLocal",external:!1}}function $s({pre:r,obj:t}){return e.jsxs("span",{className:"min-w-0 text-sm text-dark-muted",children:[e.jsx("span",{children:r}),t&&e.jsx("b",{className:"font-semibold text-dark-text",children:t})]})}const rt=5,at=420;function kt({text:r,mono:t=!0}){const{t:s}=G("hook"),[n,l]=a.useState(!1),o=r.split(`
|
|
11
|
-
`),u=o.length>rt||r.length>at;let c=r;!n&&u&&(c=o.slice(0,rt).join(`
|
|
12
|
-
`),c.length>at&&(c=`${c.slice(0,at).trimEnd()}…`));const d=n?s("showLess"):o.length>rt?s("showAllLines",{n:o.length}):s("showAll");return e.jsxs("div",{className:`rounded-lg border border-dark-border bg-dark-surface p-2.5 text-xs leading-relaxed break-all whitespace-pre-wrap ${t?"font-mono":""} text-dark-text`,children:[c,u&&e.jsx("button",{type:"button",onClick:()=>l(i=>!i),className:"mt-1 block text-[11px] text-accent-blue hover:underline",children:d})]})}const lt=15,Lr=a.memo(function({approval:t,onResolved:s}){const{t:n}=G("hook"),[l,o]=a.useState(!1),[u,c]=a.useState(lt),d=a.useRef(null),i=t.status==="pending",{level:x,reasonKey:h}=gs(t.toolName,t.askPayload),g=ks[x],k=Is(t.toolName,t.askPayload),b=Rs(t.toolName,t.askPayload),w=Oe(t.askPayload)!==null;a.useEffect(()=>{if(i)return c(lt),d.current=setInterval(()=>{c(N=>N<=1?(d.current&&clearInterval(d.current),0):N-1)},1e3),()=>{d.current&&clearInterval(d.current)}},[i,t.approvalId]),a.useEffect(()=>{const N=(t.timeoutMs??15e3)>0;u===0&&i&&!l&&N&&y()},[u]);const y=a.useCallback(()=>{!i||l||(o(!0),d.current&&clearInterval(d.current),ce.send({type:"hook_allow",data:JSON.stringify({approvalId:t.approvalId})}),s==null||s(t.approvalId,"approved"))},[i,l,t.approvalId,s]),p=a.useCallback(()=>{!i||l||(o(!0),d.current&&clearInterval(d.current),ce.send({type:"hook_deny",data:JSON.stringify({approvalId:t.approvalId})}),s==null||s(t.approvalId,"denied"))},[i,l,t.approvalId,s]),E=a.useCallback(()=>{if(!i||l)return;o(!0),d.current&&clearInterval(d.current);const N=bt.getState(),P=Oe(t.askPayload);P?(N.addToSessionAllowList(t.toolName,P),ce.send({type:"hook_allow",data:JSON.stringify({approvalId:t.approvalId,sessionAllow:!0})})):(N.addToSessionAllowList(t.toolName),ce.send({type:"hook_allow",data:JSON.stringify({approvalId:t.approvalId})})),s==null||s(t.approvalId,"approved")},[i,l,t.approvalId,t.toolName,t.askPayload,s]),F=a.useCallback(()=>{!i||l||(o(!0),d.current&&clearInterval(d.current),bt.getState().setAutoMode(!0),ve.getState().setAuto(!0),ce.send({type:"hook_allow",data:JSON.stringify({approvalId:t.approvalId})}),s==null||s(t.approvalId,"approved"))},[i,l,t.approvalId,s]);if(!i){const N=t.status==="approved";return e.jsx("div",{className:`flex items-center gap-2 px-3 py-2 rounded-lg text-xs ${N?"bg-accent-green/10 border border-accent-green/30 text-accent-green":"bg-accent-red/10 border border-accent-red/30 text-accent-red"}`,children:N?e.jsxs(e.Fragment,{children:[e.jsx(je,{size:14}),e.jsxs("span",{children:[n("alreadyAllowed"),t.toolName]})]}):e.jsxs(e.Fragment,{children:[e.jsx(Se,{size:14}),e.jsxs("span",{children:[n("alreadyDenied"),t.toolName]})]})})}const C=u/lt*100,z=u<=5,D=[{id:"allow",index:1,label:n("optionAllow"),hint:n("optionAllowHint"),action:y,kind:"primary"},{id:"allow_session",index:3,label:n("optionAllowAlways"),hint:w?n("optionAllowPathHint"):n("optionAllowAlwaysHint",{tool:t.toolName}),action:E,kind:"secondary"},{id:"auto_mode",index:4,label:n("optionAutoMode"),hint:n("optionAutoModeHint"),action:F,kind:"secondary"},{id:"deny",index:2,label:n("optionDeny"),hint:n("optionDenyHint"),action:p,kind:"danger"}],j={primary:"bg-accent-blue text-white hover:opacity-90 shadow-sm",secondary:"border border-dark-border bg-dark-bg text-dark-text hover:bg-dark-hover",danger:"text-dark-muted hover:bg-red-500/10 hover:text-red-400"};return e.jsxs("div",{className:`bg-dark-bg border rounded-xl overflow-hidden ${b.external?"border-amber-500/40":g.border}`,children:[e.jsxs("div",{className:`flex items-center gap-2 px-3 py-2 border-b ${g.bg} ${b.external?"border-amber-500/30":g.border}`,children:[e.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-bold border shrink-0 ${rc.badge}",children:[g.icon," ",x]}),e.jsx("span",{className:"flex-none w-6 h-6 rounded-md bg-accent-blue/10 text-accent-blue inline-flex items-center justify-center",children:e.jsx(pt,{size:13})}),e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx($s,{pre:n(zs(t.toolName)),obj:Ts(t.toolName,t.askPayload)})}),b.external&&b.path?e.jsxs("span",{className:"flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded bg-amber-500/10 text-amber-400 border border-amber-500/30 shrink-0",title:b.path,children:[e.jsx(us,{size:10}),b.path.length>32?`${b.path.slice(0,31)}…`:b.path]}):e.jsx("span",{className:"text-[10px] text-dark-muted/60 shrink-0",children:n("scopeLocal")}),e.jsxs("div",{className:"flex items-center gap-1.5 ml-1 shrink-0",children:[e.jsx(ze,{size:11,className:z?"text-accent-red":"text-dark-muted"}),e.jsxs("span",{className:`text-[11px] font-mono ${z?"text-accent-red animate-pulse":"text-dark-muted"}`,children:[u,"s"]}),e.jsx("div",{className:"w-10 h-1 bg-dark-border rounded-full overflow-hidden",children:e.jsx("div",{className:`h-full rounded-full transition-all duration-1000 ${z?"bg-accent-red":u<=8?"bg-accent-yellow":"bg-accent-green"}`,style:{width:`${C}%`}})})]})]}),e.jsxs("div",{className:"px-3 py-2.5 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"text-dark-muted shrink-0",children:n("tool")}),e.jsx("code",{className:"text-accent-blue font-mono text-xs bg-dark-surface px-1.5 py-0.5 rounded",children:t.toolName}),e.jsx("span",{className:"text-[10px] text-dark-muted/50",children:n(h)})]}),k&&e.jsx(kt,{text:k.text,mono:k.mono}),(x==="CRITICAL"||x==="HIGH")&&e.jsxs("div",{className:`flex items-center gap-1.5 text-[11px] px-2 py-1 rounded ${g.bg} ${g.text}`,children:[e.jsx(Ne,{size:12}),e.jsx("span",{children:n(x==="CRITICAL"?"highRiskWarning":"mediumRiskConfirm")})]}),e.jsx("div",{className:"flex flex-wrap items-center gap-1.5 pt-1",children:D.map(N=>e.jsxs("button",{onClick:N.action,disabled:l,className:`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md text-xs transition-colors disabled:opacity-50 ${j[N.kind]}`,children:[e.jsx("span",{className:`text-[9px] font-mono rounded px-0.5 ${N.kind==="primary"?"bg-white/20":"bg-dark-surface text-dark-muted"}`,children:N.index}),e.jsx("span",{children:N.label}),e.jsx("span",{className:`text-[10px] ${N.kind==="primary"?"text-white/70":"text-dark-muted/60"} hidden sm:inline`,children:N.hint})]},N.id))}),e.jsx("div",{className:"text-[10px] text-dark-muted/50 pt-0.5 border-t border-dark-border/50",children:n("clickToSelect")})]})]})}),Ue={xlsx:{icon:ft},xls:{icon:ft},csv:{icon:ht},docx:{icon:ht},text:{icon:wt}};function Yt(r){return!r&&r!==0?"—":r<1024?`${r} B`:r<1024*1024?`${(r/1024).toFixed(1)} KB`:`${(r/1024/1024).toFixed(2)} MB`}const Br=a.memo(function({job:t}){var g,k;const{t:s}=G(),{stage:n}=t,l=a.useCallback(b=>{switch(b){case"xlsx":case"xls":return"Excel";case"csv":return"CSV";case"docx":return"Word";default:return s("fileJob.kindText")}},[s]),o=a.useCallback(b=>{xe.files.download(b).then(w=>{w.success||oe.error(w.error||s("fileJob.downloadFailed"))})},[s]),u=a.useMemo(()=>t.attachments||[],[t.attachments]),c=a.useMemo(()=>t.parsedFiles||[],[t.parsedFiles]),d=a.useMemo(()=>t.mapping||[],[t.mapping]),i=a.useMemo(()=>t.result||[],[t.result]),x=t.renderProgress??(n==="rendering"?0:100),h=t.parseProgress??(n==="parsing"?0:100);return e.jsxs("div",{className:"mt-2 rounded-xl border border-dark-border bg-dark-surface/60 overflow-hidden max-w-2xl",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3.5 py-2.5 border-b border-dark-border/60 bg-dark-surface",children:[n==="complete"?e.jsx(mt,{size:15,className:"text-accent-green shrink-0"}):n==="error"?e.jsx(Ne,{size:15,className:"text-accent-red shrink-0"}):e.jsx(Te,{size:15,className:"text-accent-blue animate-spin shrink-0"}),e.jsx("span",{className:"text-[13px] font-medium text-dark-text",children:Fr(n,s)}),e.jsx("div",{className:"flex-1"}),e.jsx("span",{className:"text-[10px] font-mono text-dark-muted/60",children:t.jobId})]}),e.jsxs("div",{className:"px-3.5 py-3 space-y-3",children:[u.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2",children:u.map((b,w)=>{const p=(Ue[b.kind]||Ue.text).icon;return e.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-dark-border bg-dark-bg px-2.5 py-1.5",children:[e.jsx(p,{size:14,className:"text-accent-blue shrink-0"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-xs text-dark-text truncate max-w-[160px]",children:b.fileName}),e.jsxs("div",{className:"text-[10px] text-dark-muted",children:[Yt(b.size)," · ",l(b.kind),b.role&&b.role!=="unknown"&&e.jsxs("span",{className:le("ml-1",b.role==="data"?"text-accent-green":"text-accent-purple"),children:["· ",b.role==="data"?s("fileJob.roleData"):s("fileJob.roleTemplate")]})]})]})]},`${b.fileName}-${w}`)})}),n==="parsing"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-xs text-dark-muted",children:s("fileJob.parsing",{file:((g=u[0])==null?void 0:g.fileName)||((k=c[0])==null?void 0:k.fileName)||""})}),e.jsx(Dt,{value:h,size:"sm",showLabel:!0})]}),c.length>0&&n!=="error"&&e.jsxs("div",{className:"space-y-1.5",children:[c.map(b=>e.jsxs("div",{className:"flex items-center gap-2 text-xs text-dark-muted",children:[e.jsx(mt,{size:13,className:"text-accent-green shrink-0"}),e.jsx("span",{className:"truncate",children:b.fileName}),e.jsx("span",{className:"text-[10px] text-dark-muted/70",children:s("fileJob.parsedSummary",{rows:b.rowCount,fields:b.fields.length})})]},b.fileName)),c[0]&&e.jsxs("div",{className:"flex flex-wrap gap-1 pt-1",children:[c[0].fields.slice(0,12).map(b=>e.jsx("span",{className:"rounded bg-dark-bg border border-dark-border/60 px-1.5 py-0.5 text-[10px] font-mono text-dark-muted",children:b},b)),c[0].fields.length>12&&e.jsxs("span",{className:"text-[10px] text-dark-muted/60",children:["+",c[0].fields.length-12]})]})]}),d.length>0&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("div",{className:"text-[11px] text-dark-muted",children:s("fileJob.mappingTitle")}),e.jsx("div",{className:"overflow-hidden rounded-lg border border-dark-border",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-dark-bg text-dark-muted",children:[e.jsx("th",{className:"text-left px-2.5 py-1.5 font-medium",children:s("fileJob.templatePlaceholder")}),e.jsx("th",{className:"px-2 py-1.5"}),e.jsx("th",{className:"text-left px-2.5 py-1.5 font-medium",children:s("fileJob.dataField")})]})}),e.jsx("tbody",{children:d.slice(0,8).map(b=>e.jsxs("tr",{className:"border-t border-dark-border/50",children:[e.jsx("td",{className:"px-2.5 py-1.5 font-mono text-accent-purple",children:"{{"+b.placeholder+"}}"}),e.jsx("td",{className:"px-2 py-1.5 text-dark-muted",children:e.jsx(nn,{size:11})}),e.jsx("td",{className:"px-2.5 py-1.5 font-mono text-accent-blue",children:b.field})]},b.placeholder))})]})}),d.length>8&&e.jsx("div",{className:"text-[10px] text-dark-muted/60",children:s("fileJob.mappingMore",{n:d.length-8})})]}),n==="rendering"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-xs text-dark-muted",children:s("fileJob.rendering",{current:t.currentRow||0,total:t.totalRows||0})}),e.jsx(Dt,{value:x,size:"sm",variant:"warning",showLabel:!0})]}),i.length>0&&n==="complete"&&e.jsx("div",{className:"space-y-1.5",children:i.map(b=>{const y=(Ue[b.format]||Ue.text).icon,p=b.failedRows.length>0;return e.jsxs("div",{className:"rounded-lg border border-dark-border bg-dark-bg px-3 py-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(y,{size:15,className:"text-accent-green shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-xs text-dark-text truncate",children:b.fileName}),e.jsxs("div",{className:"text-[10px] text-dark-muted",children:[Yt(b.size)," · ",s("fileJob.rowsDone",{done:b.successCount,total:b.rowCount}),p&&e.jsxs("span",{className:"text-accent-red",children:[" · ",s("fileJob.rowsFailed",{n:b.failedRows.length})]})]})]}),e.jsxs("button",{onClick:()=>bs(b.path),className:"flex items-center gap-1 rounded-md bg-dark-surface border border-dark-border text-dark-muted px-2 py-1 text-[11px] hover:bg-dark-hover hover:text-dark-text transition-colors",title:s("chat.previewInPanel"),children:[e.jsx(ds,{size:12}),s("chat.previewInPanel")]}),e.jsxs("button",{onClick:()=>o(b.path),className:"flex items-center gap-1 rounded-md bg-accent-blue/10 text-accent-blue px-2 py-1 text-[11px] hover:bg-accent-blue/20 transition-colors",title:s("fileJob.download"),children:[e.jsx(rn,{size:12}),s("fileJob.download")]})]}),p&&e.jsxs("div",{className:"mt-1.5 space-y-0.5 border-t border-dark-border/50 pt-1.5",children:[b.failedRows.slice(0,3).map(E=>e.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] text-accent-red",children:[e.jsx(an,{size:10,className:"shrink-0"}),e.jsxs("span",{children:["#",E.index+1]}),e.jsx("span",{className:"truncate",children:E.error})]},E.index)),b.failedRows.length>3&&e.jsx("div",{className:"text-[10px] text-dark-muted/70",children:s("fileJob.moreRows",{n:b.failedRows.length-3})})]})]},b.path)})}),n==="error"&&e.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-accent-red/30 bg-accent-red/5 px-3 py-2.5",children:[e.jsx(Ne,{size:15,className:"text-accent-red shrink-0 mt-0.5"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-xs font-medium text-accent-red",children:t.error||s("fileJob.error")}),t.errorDetail&&e.jsx("div",{className:"mt-0.5 text-[11px] text-dark-muted break-words",children:t.errorDetail})]})]})]})]})});function Fr(r,t){switch(r){case"uploaded":return t("fileJob.stageUploaded");case"parsing":return t("fileJob.stageParsing");case"mapping":return t("fileJob.stageMapping");case"rendering":return t("fileJob.stageRendering");case"complete":return t("fileJob.stageComplete");case"error":return t("fileJob.stageError");default:return t("fileJob.stageUploaded")}}const es={auth:{icon:on,color:"text-accent-red"},rate_limit:{icon:Rt,color:"text-accent-yellow"},timeout:{icon:Rt,color:"text-accent-yellow"},network:{icon:ln,color:"text-accent-yellow"},model:{icon:xs,color:"text-accent-red"},tool:{icon:Ne,color:"text-accent-yellow"},unknown:{icon:Ne,color:"text-accent-red"}},Or=a.memo(function({error:t,onRetry:s}){const{t:n}=G(),[l,o]=a.useState(!1),u=es[t.category]||es.unknown,c=u.icon,d=()=>{window.dispatchEvent(new CustomEvent("switch-tab",{detail:"models"}))};return e.jsxs("div",{className:"mt-2 max-w-2xl overflow-hidden rounded-xl border border-accent-red/30 bg-dark-surface",children:[e.jsxs("div",{className:"flex items-start gap-3 px-3.5 py-3",children:[e.jsx(c,{size:18,className:le("shrink-0 mt-0.5",u.color)}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-[13px] font-medium text-dark-text",children:t.summary}),t.detail&&t.detail!==t.summary&&e.jsx("div",{className:"mt-0.5 text-[11px] text-dark-muted/80 break-words",children:t.detail.slice(0,160)}),e.jsxs("div",{className:"mt-1.5 flex items-center gap-2",children:[t.retryable&&s&&e.jsxs("button",{onClick:s,className:"flex items-center gap-1 rounded-md bg-accent-blue/10 text-accent-blue px-2 py-1 text-[11px] hover:bg-accent-blue/20 transition-colors",children:[e.jsx(Fe,{size:11}),n("errorCard.retry")]}),t.category==="auth"&&e.jsxs("button",{onClick:d,className:"flex items-center gap-1 rounded-md bg-dark-hover text-dark-text px-2 py-1 text-[11px] hover:bg-dark-border transition-colors",children:[e.jsx(cn,{size:11}),n("errorCard.modelSettings")]}),t.detail&&e.jsxs("button",{onClick:()=>o(i=>!i),className:"flex items-center gap-0.5 text-[11px] text-dark-muted hover:text-dark-text transition-colors",children:[e.jsx(ge,{size:11,className:le("transition-transform",l&&"rotate-180")}),n("errorCard.details")]})]})]})]}),l&&t.detail&&e.jsx("div",{className:"border-t border-dark-border/60 bg-dark-bg px-3.5 py-2.5 text-[11px] font-mono text-dark-muted break-words max-h-40 overflow-y-auto custom-scrollbar",children:t.detail})]})});function qr(r){const t=r.replace(/\\/g,"/");return t.slice(t.lastIndexOf("/")+1)||r}function Hr({status:r}){switch(r){case"completed":return e.jsx(je,{size:13,className:"shrink-0 text-accent-green","data-testid":"activity-status-completed"});case"failed":return e.jsx(Se,{size:13,className:"shrink-0 text-accent-red","data-testid":"activity-status-failed"});case"running":return e.jsx("span",{className:"tl-node bg-accent-blue","data-status":"running","data-testid":"activity-status-running"});case"waiting_user":return e.jsx(un,{size:13,className:"shrink-0 text-accent-yellow","data-testid":"activity-status-waiting"});case"blocked":return e.jsx(dn,{size:13,className:"shrink-0 text-accent-red","data-testid":"activity-status-blocked"});case"paused":return e.jsx(ps,{size:13,className:"shrink-0 text-dark-300","data-testid":"activity-status-paused"});default:return e.jsx("span",{className:"inline-block w-2 h-2 shrink-0 rounded-full bg-dark-border"})}}const Jr=a.memo(function({activity:t,toolCalls:s,onAnswer:n}){const{t:l}=G(),[o,u]=a.useState(t.status==="running"),c=a.useRef(t.status);a.useEffect(()=>{(c.current==="running"||c.current==="waiting_user"||c.current==="paused")&&(t.status==="completed"||t.status==="failed")&&u(!1),c.current=t.status},[t.status]);const d=a.useMemo(()=>{for(const b of s){const w=fs(b.args);if(w)return w}},[s]),i=t.endedAt?t.endedAt-t.startedAt:Date.now()-t.startedAt,x=i>=6e4?`${Math.round(i/6e4)}m`:i>=1500?`${Math.round(i/1e3)}s`:"",h=t.status==="waiting_user",g=t.status==="blocked",k=t.status==="paused";return e.jsxs("div",{className:`tl-row rounded-lg transition-colors ${h?"border border-accent-yellow/25 bg-accent-yellow/5":g?"border border-accent-red/25 bg-accent-red/5":"hover:bg-dark-surface/40"}`,"data-testid":"activity-row",children:[!h&&!g&&e.jsx("span",{className:"tl-line","aria-hidden":"true"}),e.jsxs("div",{className:"relative flex items-center gap-2 px-2 py-1 cursor-pointer select-none",onClick:()=>u(b=>!b),"data-testid":"activity-row-toggle",children:[e.jsx("span",{className:"flex h-3 w-3 shrink-0 items-center justify-center",children:e.jsx(Hr,{status:t.status})}),e.jsx("span",{className:`min-w-0 text-[13px] font-medium truncate ${t.status==="running"?"text-shimmer":"text-dark-text"}`,children:t.title}),t.phase!=="analysis"&&e.jsx("span",{className:"status-pill","data-tone":"neutral","data-testid":"activity-phase",children:l(`activity.phase.${t.phase}`)}),d&&e.jsx("span",{className:"shrink-0 max-w-[14rem] truncate rounded-full border border-dark-border/70 px-2 py-0.5 font-mono text-[10.5px] text-accent-blue",children:qr(d)}),s.length>1&&e.jsx("span",{className:"shrink-0 text-[10.5px] text-dark-muted",children:l("activity.evidenceMore",{count:s.length-1})}),x&&e.jsx("span",{className:"shrink-0 text-[10.5px] text-dark-muted",children:x}),h&&e.jsx("span",{className:"ml-auto shrink-0 text-[11px] text-accent-yellow",children:l("activity.waitingUser")}),g&&e.jsx("span",{className:"ml-auto shrink-0 text-[11px] text-accent-red",title:t.blockedReason?l("activity.blocked",{reason:t.blockedReason}):void 0,children:l("activity.blocked",{reason:t.blockedReason??""})}),k&&e.jsx("span",{className:"ml-auto shrink-0 text-[11px] text-dark-300",children:l("activity.paused")}),h&&n&&e.jsx("button",{type:"button",onClick:b=>{b.stopPropagation(),n(t.id)},className:"shrink-0 rounded border border-accent-yellow/40 px-1.5 py-0.5 text-[10.5px] text-accent-yellow hover:bg-accent-yellow/10",children:l("activity.viewAndAnswer")}),!h&&s.length>0&&e.jsx(ge,{size:12,className:`ml-auto shrink-0 text-dark-muted transition-transform ${o?"rotate-180":""}`})]}),o&&s.length>0&&e.jsx("div",{className:"relative ml-[15px] pb-1 pl-3 border-l border-dark-border/25",children:e.jsx(Nt,{toolCalls:s})})]})});function Wr({index:r,text:t,isStreaming:s,collapsed:n,onToggle:l}){const{t:o}=G();return e.jsxs("div",{children:[e.jsxs("button",{className:"flex items-center gap-1.5 cursor-pointer select-none py-0.5 text-xs",onClick:()=>l(r),"data-testid":"thinking-toggle",children:[e.jsx(ke,{size:12,className:`text-dark-muted transition-transform ${n?"":"rotate-90"}`}),e.jsx("span",{className:s?"text-shimmer":"text-dark-muted",children:s?`${o("chat.thinking")}…`:o("chat.thoughtProcess")})]}),!n&&e.jsx("div",{className:"mt-1 text-xs text-dark-muted whitespace-pre-wrap break-words border-l border-dark-border/25 pl-3 max-h-64 overflow-y-auto custom-scrollbar",children:t.replace(/\n{3,}/g,`
|
|
13
|
-
|
|
14
|
-
`)})]})}const Ur=a.memo(function({message:t,sessionId:s,isGenerating:n,onAnswer:l}){const o=Fn(y=>On(y,s,t.id)),u=a.useMemo(()=>o.length>0?o:!t.toolCalls||t.toolCalls.length===0?[]:qn(s??"",t),[o,t,s]),c=a.useMemo(()=>t.thinkingBlocks&&t.thinkingBlocks.length>0?t.thinkingBlocks:t.thinking?[{index:Number.MIN_SAFE_INTEGER,text:t.thinking}]:[],[t.thinkingBlocks,t.thinking]),[d,i]=a.useState({}),x=!n||!!t.content;a.useEffect(()=>{x&&i(y=>{const p={...y};for(const E of c)p[E.index]=!0;return p})},[x,c]);const h=a.useMemo(()=>{let y=Number.MIN_SAFE_INTEGER;for(const p of c)y=Math.max(y,p.index);for(const p of t.toolCalls??[])y=Math.max(y,p.index??Number.MIN_SAFE_INTEGER);return y},[c,t.toolCalls]),g=y=>n&&!t.content&&y===h,k=y=>{const p=d[y]??(!!t.content||!n);i(E=>({...E,[y]:!p}))},b=a.useMemo(()=>{const y=[];for(const p of c)y.push({key:`thinking-${p.index}`,index:p.index,kind:"thinking",block:p});for(const p of u)y.push({key:`activity-${p.id}`,index:p.blockRange[0],kind:"activity",activity:p});return y.sort((p,E)=>p.index-E.index),y},[c,u]),w=a.useMemo(()=>{const y={},p=t.toolCalls??[];for(const E of u)y[E.id]=E.toolCallIds.map(F=>p.find(C=>C.id===F)).filter(F=>!!F);return y},[u,t.toolCalls]);return b.length===0?null:e.jsx("div",{className:"mb-1 space-y-0.5","data-testid":"agent-activity-feed",children:b.map(y=>y.kind==="thinking"&&y.block?e.jsx(Wr,{index:y.block.index,text:y.block.text,isStreaming:g(y.block.index),collapsed:d[y.block.index]??(!!t.content||!n),onToggle:k},y.key):y.activity?e.jsx(Jr,{activity:y.activity,toolCalls:w[y.activity.id]??[],onAnswer:l},y.key):null)})}),Ps=5,Gr=30,Kr=["让我","我先","我现在","我发现","我注意到","我决定","我重新","我重试","我继续","我现在要","让我现在","let me","let's","i should","i need","i will","i'll","i am","i notice","i see","i try","i retry","i think","i continue","i re-","now i","first i","first, i"];function Zr(r){const t=r.charCodeAt(0);return t>=19968&&t<=40959}function Vr(r){let t="",s=!1;for(const n of r)n===" "||n===" "||n===" "?(s||(t+=" "),s=!0):(t+=n,s=!1);return t}function Qr(r){return r>=97&&r<=122||r>=48&&r<=57||r===95}function Ds(r){const t=Vr(r.trimStart().toLowerCase());return Kr.some(s=>{if(!t.startsWith(s))return!1;const n=t[s.length];return n===void 0||Zr(s)||s==="i re-"?!0:!Qr(n.charCodeAt(0))})}function Xr(r){if(!r)return!1;const t=r.split(/\r?\n/).slice(0,Gr);let s=0;for(const n of t)if(n.trim())if(Ds(n)){if(s++,s>=Ps)return!0}else return!1;return!1}function Yr(r,t){if(!r)return{body:r||"",absorbed:""};if(!Xr(r))return{body:r,absorbed:""};const s=r.split(/\r?\n/);let n=0,l=0;for(const u of s){if(!u.trim()){l++;continue}if(Ds(u)){n++,l++;continue}break}if(n<Ps)return{body:r,absorbed:""};let o=0;for(const u of s.slice(0,l)){if(o+=u.length,o>=r.length)break;r.startsWith(`\r
|
|
15
|
-
`,o)?o+=2:(r[o]===`
|
|
16
|
-
`||r[o]==="\r")&&(o+=1)}return{body:r.slice(o),absorbed:r.slice(0,o)}}function it({onClick:r,title:t,children:s,danger:n=!1}){return e.jsx("button",{onClick:r,title:t,"aria-label":t,className:`inline-flex items-center justify-center rounded p-1 transition-colors ${n?"text-dark-muted hover:text-accent-red hover:bg-accent-red/10":"text-dark-muted hover:text-dark-text hover:bg-dark-hover"}`,children:s})}function ts({message:r,sessionId:t,onRegenerate:s,onDeleteMessage:n}){const{t:l}=G(),[o,u]=a.useState(!1),c=a.useRef(null);a.useEffect(()=>()=>{c.current&&clearTimeout(c.current)},[]);const d=a.useCallback(async()=>{try{await navigator.clipboard.writeText(r.content||r.thinking||""),u(!0),c.current&&clearTimeout(c.current),c.current=setTimeout(()=>u(!1),2e3)}catch(i){console.error("Failed to copy message:",i)}},[r.content,r.thinking]);return t?e.jsxs(e.Fragment,{children:[e.jsx(it,{onClick:d,title:l("chat.copyMessage"),children:o?e.jsx(je,{size:12,className:"text-accent-green"}):e.jsx(pn,{size:12})}),r.type==="assistant"&&s&&e.jsx(it,{onClick:()=>s(r.id),title:l("chat.regenerate"),children:e.jsx(Fe,{size:12})}),n&&e.jsx(it,{onClick:()=>n(r.id),title:l("chat.deleteMessage"),danger:!0,children:e.jsx(mn,{size:12})})]}):null}function ss({ts:r,children:t}){const{i18n:s}=G(),n=s.language==="en"?"en-US":"zh-CN";return e.jsxs("div",{className:"absolute bottom-2 left-3 select-none z-10 flex items-center gap-0.5 text-[10.5px] leading-none whitespace-nowrap opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 transition-opacity duration-150",children:[e.jsx("span",{className:"pr-1 text-[10px] text-dark-muted/50",children:new Date(r).toLocaleTimeString(n,{hour:"2-digit",minute:"2-digit"})}),t]})}function ea(r,t){const s=[];for(const n of r)s.push({key:`thinking-${n.index}`,index:n.index,kind:"thinking",block:n});for(const n of t??[])s.push({key:`tool-${n.id}`,index:n.index??Number.MAX_SAFE_INTEGER,kind:"tool",toolCall:n});return s.sort((n,l)=>n.index-l.index),s}function ta({index:r,text:t,isStreaming:s,collapsed:n,onToggle:l}){const{t:o}=G();return e.jsxs("div",{children:[e.jsxs("button",{className:"flex items-center gap-1.5 cursor-pointer select-none py-0.5 text-xs",onClick:()=>l(r),"data-testid":"thinking-toggle",children:[e.jsx(ke,{size:12,className:`text-dark-muted transition-transform ${n?"":"rotate-90"}`}),e.jsx("span",{className:s?"text-shimmer":"text-dark-muted",children:s?`${o("chat.thinking")}…`:o("chat.thoughtProcess")})]}),!n&&e.jsx("div",{className:"mt-1 text-xs text-dark-muted whitespace-pre-wrap break-words border-l border-dark-border/25 pl-3 max-h-64 overflow-y-auto custom-scrollbar",children:t.replace(/\n{3,}/g,`
|
|
17
|
-
|
|
18
|
-
`)})]})}const sa=a.memo(function({message:t,sessionId:s,onRegenerate:n,onDeleteMessage:l}){var C,z,D;const{t:o}=G(),u=Ze(j=>j.developerView),c=fe(j=>{var P;if(!s||!j.generatingSessions.includes(s))return!1;const N=j.messagesBySession[s];return N?((P=N[N.length-1])==null?void 0:P.id)===t.id:!1}),d=a.useMemo(()=>t.thinkingBlocks&&t.thinkingBlocks.length>0?t.thinkingBlocks:t.thinking?[{index:Number.MIN_SAFE_INTEGER,text:t.thinking}]:[],[t.thinkingBlocks,t.thinking]),[i,x]=a.useState({}),h=!c||!!t.content;a.useEffect(()=>{h&&x(j=>{const N={...j};for(const P of d)N[P.index]=!0;return N})},[h,d]);const g=a.useMemo(()=>ea(d,t.toolCalls),[d,t.toolCalls]),k=a.useMemo(()=>{var P;if(!t.content)return"";if(!(!!t.thinking||(((P=t.thinkingBlocks)==null?void 0:P.length)??0)>0))return t.content;const{body:N}=Yr(t.content);return N||t.content},[t.content,t.thinking,t.thinkingBlocks]),b=a.useMemo(()=>{const j=[];for(const N of g)if(N.kind==="thinking"&&N.block)j.push({key:N.key,kind:"thinking",block:N.block});else if(N.kind==="tool"&&N.toolCall){const P=j[j.length-1];P&&P.kind==="tools"?P.toolCalls.push(N.toolCall):j.push({key:`tools-${N.key}`,kind:"tools",toolCalls:[N.toolCall]})}return j},[g]),w=a.useMemo(()=>{let j=Number.MIN_SAFE_INTEGER;for(const N of d)j=Math.max(j,N.index);for(const N of t.toolCalls??[])j=Math.max(j,N.index??Number.MIN_SAFE_INTEGER);return j},[d,t.toolCalls]),y=a.useCallback(j=>{const N=i[j]??(!!t.content||!c);x(P=>({...P,[j]:!N}))},[c,t.content,i]),p=t.type==="user",E=t.type==="system",F=a.useCallback((j,N)=>{if(!s)return;const A=fe.getState().getMessages(s),I=A.findIndex(V=>V.id===t.id);if(I===-1)return;const W=A[I];if(!W)return;const U={...W,hookApproval:W.hookApproval?{...W.hookApproval,status:N}:void 0},Z=[...A];Z[I]=U,fe.setState({messagesBySession:{...fe.getState().messagesBySession,[s]:Z}})},[s,t.id]);return t.deleted?null:p?e.jsxs("div",{className:"chat-msg","data-role":"user",children:[e.jsx("div",{className:"chat-avatar","aria-hidden":!0,children:e.jsx(xn,{size:14,strokeWidth:2.4})}),e.jsx("div",{className:"max-w-[78%] flex flex-col",children:e.jsxs("div",{className:"group relative inline-block self-end rounded-2xl border border-dark-border/40 bg-dark-surface px-4 py-2.5 text-dark-text shadow-sm",style:{borderBottomRightRadius:"0.375rem"},children:[e.jsx(ss,{ts:t.timestamp,children:e.jsx(ts,{message:t,sessionId:s,onRegenerate:n,onDeleteMessage:l})}),e.jsx("div",{className:"whitespace-pre-wrap break-words leading-relaxed text-[14.5px]",children:(C=t.content)==null?void 0:C.replace(/\n{3,}/g,`
|
|
19
|
-
|
|
20
|
-
`)})]})})]}):E?e.jsx("div",{className:"chat-msg","data-role":"system",children:e.jsx("div",{className:"text-[11px] text-dark-muted bg-dark-surface border border-dark-border/60 rounded-full px-3.5 py-1 max-w-[90%] text-center",children:t.content})}):e.jsxs("div",{className:"chat-msg","data-role":"assistant",children:[e.jsx("div",{className:"chat-avatar","aria-hidden":!0,children:e.jsx(xs,{size:14,strokeWidth:2.4})}),e.jsxs("div",{className:"chat-card group",children:[e.jsx(ss,{ts:t.timestamp,children:e.jsx(ts,{message:t,sessionId:s,onRegenerate:n,onDeleteMessage:l})}),t.steps&&t.steps.length>0&&!t.hookApproval?e.jsx(Mr,{steps:t.steps,isGenerating:c}):u?e.jsx(e.Fragment,{children:b.length>0&&!t.hookApproval&&e.jsx("div",{className:"mb-2 space-y-1",children:b.map(j=>j.kind==="thinking"?e.jsx(ta,{index:j.block.index,text:j.block.text,isStreaming:c&&!t.content&&j.block.index===w,collapsed:i[j.block.index]??(!!t.content||!c),onToggle:y},j.key):e.jsx(Nt,{toolCalls:j.toolCalls},j.key))})}):e.jsx(Ur,{message:t,sessionId:s,isGenerating:c}),t.content?e.jsx("div",{className:"leading-relaxed",children:e.jsx(Hn,{content:k.replace(/\n{3,}/g,`
|
|
21
|
-
|
|
22
|
-
`)})}):d.length===0&&!t.hookApproval&&((z=t.steps)!=null&&z.length)?null:d.length===0&&!t.hookApproval&&!((D=t.steps)!=null&&D.length)&&c?e.jsxs("div",{className:"flex items-center gap-2 py-1 text-xs text-dark-muted","data-testid":"thinking-typing",children:[e.jsxs("span",{className:"chat-typing-dots",children:[e.jsx("span",{}),e.jsx("span",{}),e.jsx("span",{})]}),e.jsxs("span",{children:[o("chat.thinking"),"…"]})]}):null,t.summary&&!c&&e.jsx("div",{className:"mt-1.5 text-[11px] text-dark-muted/70","data-testid":"turn-summary",children:Jn(t.summary)}),t.fileJob&&e.jsx("div",{className:"mt-3",children:e.jsx(Br,{job:t.fileJob})}),t.errorCard&&e.jsx("div",{className:"mt-3",children:e.jsx(Or,{error:t.errorCard,onRetry:s&&n?()=>n(t.id):void 0})}),t.hookApproval&&e.jsx("div",{className:"mt-3 border-l-2 border-accent-yellow/50 pl-3",children:e.jsx(Lr,{approval:t.hookApproval,onResolved:F})})]})]})});function na(r,t=28){const s=r.replace(/\s+/g," ").trim();return s.length>t?`${s.slice(0,t)}…`:s}const ra="cubic-bezier(0.34, 1.56, 0.64, 1)",aa=a.memo(function({items:t,activeId:s,onJump:n}){const{t:l}=G(),[o,u]=a.useState(!1),c=a.useRef(null),d=a.useCallback(()=>{c.current&&window.clearTimeout(c.current),u(!0)},[]),i=a.useCallback(()=>{c.current&&window.clearTimeout(c.current),c.current=window.setTimeout(()=>u(!1),180)},[]);return t.length===0?null:e.jsx("div",{role:"list","aria-label":l("chat.messageRail"),className:"pointer-events-none absolute right-4 top-1/2 z-30 hidden -translate-y-1/2 md:block",children:e.jsxs("div",{onMouseEnter:d,onMouseLeave:i,"data-testid":"rail-trigger",className:"pointer-events-auto relative flex items-center py-3",children:[e.jsxs("div",{"aria-hidden":!o,inert:!o,"data-testid":"rail-panel",className:`absolute right-full top-1/2 flex w-72 -translate-y-1/2 origin-right flex-col overflow-hidden rounded-xl border border-dark-border/70 bg-dark-bg/90 shadow-xl shadow-black/10 backdrop-blur-xl transition-all duration-300 ${o?"translate-x-0 scale-100 opacity-100":"pointer-events-none translate-x-4 scale-95 opacity-0"}`,style:{transitionTimingFunction:o?ra:"ease"},children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-dark-border/60 px-3 py-2",children:[e.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] font-semibold uppercase tracking-[0.08em] text-dark-muted",children:[e.jsx(hn,{size:12,className:"text-accent-blue","aria-hidden":"true"}),l("chat.messageIndex")]}),e.jsx("span",{className:"rounded-full bg-dark-hover px-1.5 py-0.5 text-[10px] font-medium tabular-nums text-dark-muted",children:t.length})]}),e.jsx("div",{className:"max-h-[55vh] overflow-y-auto p-1.5 custom-scrollbar",children:t.map((x,h)=>{const g=x.id===s;return e.jsxs("button",{type:"button",role:"listitem",onClick:()=>n(x.id),title:x.content,"aria-current":g?"true":void 0,tabIndex:o?0:-1,className:`group/item flex w-full items-start gap-2 rounded-lg px-2 py-1.5 text-left transition-all duration-200 ${o?"translate-x-0 opacity-100":"translate-x-2 opacity-0"} ${g?"bg-accent-blue/10":"hover:bg-dark-hover"}`,style:{transitionDelay:o?`${Math.min(h*24,264)}ms`:"0ms"},children:[e.jsx("span",{className:`mt-px flex h-4 w-4 shrink-0 items-center justify-center rounded text-[10px] font-semibold tabular-nums transition-colors duration-200 ${g?"bg-accent-blue text-white":"bg-dark-hover text-dark-muted group-hover/item:bg-dark-border/80 group-hover/item:text-dark-text"}`,children:h+1}),e.jsx("span",{className:"min-w-0 flex-1",children:e.jsx("span",{"data-testid":"rail-entry-content",className:`block break-words text-xs leading-snug line-clamp-2 group-hover/item:line-clamp-none transition-colors duration-200 ${g?"font-medium text-accent-blue":"text-dark-text/90"}`,children:x.content})}),e.jsx(ke,{size:12,"aria-hidden":"true",className:"mt-0.5 shrink-0 -translate-x-1 text-dark-muted/50 opacity-0 transition-all duration-200 group-hover/item:translate-x-0 group-hover/item:opacity-100"})]},x.id)})})]}),e.jsx("div",{"data-testid":"rail-dots",className:"flex flex-col items-end gap-1",children:t.map((x,h)=>{const g=na(x.content),k=x.id===s;return e.jsx("button",{type:"button",role:"listitem",onClick:()=>n(x.id),title:x.content,"aria-label":`${h+1}. ${g}`,"aria-current":k?"true":void 0,className:"group/dot pointer-events-auto flex h-6 w-5 items-center justify-center rounded-full transition-colors duration-200 hover:bg-dark-surface/80",children:e.jsx("span",{className:k?"h-2 w-2 rounded-full bg-accent-blue ring-2 ring-accent-blue/25 transition-all duration-300 ease-out group-hover/dot:scale-125":"h-1.5 w-1.5 rounded-full bg-dark-muted/35 transition-all duration-300 ease-out group-hover/dot:scale-150 group-hover/dot:bg-dark-muted"})},x.id)})})]})})}),la=a.lazy(()=>Wn(()=>import("./ThreeScene-5Zi32o_j.js"),__vite__mapDeps([0,1,2,3])));function ia(){try{const r=document.createElement("canvas");return!!(r.getContext("webgl2")??r.getContext("webgl"))}catch{return!1}}function oa(){return a.useMemo(ia,[])?e.jsxs("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 overflow-hidden [&_.threeui-background]:bg-transparent",children:[e.jsx(a.Suspense,{fallback:null,children:e.jsx(la,{})}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-b from-black/30 via-transparent to-black/40"})]}):null}const ca=a.memo(function({messages:t,isGenerating:s,sessionId:n,onSendSuggestion:l,onRegenerate:o,onDeleteMessage:u}){const{t:c}=G(),d=a.useRef(null),i=a.useRef(new Map),[x,h]=a.useState(!0),[g,k]=a.useState(null),[b,w]=a.useState(null),[y,p]=a.useState(0),E=a.useRef(null),F=a.useRef(!1),C=a.useRef(null),z=a.useRef(s);z.current=s;const D=a.useMemo(()=>t.filter(S=>!S.deleted),[t]),j=a.useMemo(()=>{if(!s)return!1;const S=D[D.length-1];return!(!S||S.type!=="assistant"||S.content||S.steps&&S.steps.length>0)},[s,D]),N=a.useMemo(()=>D.filter(S=>S.type==="user").map(S=>({id:S.id,content:S.content})),[D]),P=a.useMemo(()=>N.map(S=>S.id),[N]),A=a.useCallback(S=>{if(S){const J=S.dataset.mid;J&&i.current.set(J,S)}},[]);a.useEffect(()=>{const S=new Set(P);for(const J of i.current.keys())S.has(J)||i.current.delete(J)},[P]);const I=a.useCallback(()=>{const S=d.current;if(!S||P.length===0){k(null);return}const J=S.getBoundingClientRect(),O=J.top+J.height*.35;let Q=P[0]??null;for(const ee of P){const ne=i.current.get(ee);if(!(!ne||!ne.isConnected))if(ne.getBoundingClientRect().top<=O)Q=ee;else break}S.scrollHeight-S.scrollTop-S.clientHeight<50&&(Q=P[P.length-1]??Q),k(Q)},[P]),W=a.useCallback(()=>{const S=d.current;if(!S)return;const J=S.scrollHeight-S.scrollTop-S.clientHeight;F.current?J>=50&&(F.current=!1):h(J<50),I()},[I]);a.useEffect(()=>{I()},[t,I]);const U=a.useCallback(S=>{const J=d.current,O=i.current.get(S);if(!J||!O||!O.isConnected)return;h(!1),w(S),p(X=>X+1),E.current&&window.clearTimeout(E.current),E.current=window.setTimeout(()=>w(null),1600);const Q=J.getBoundingClientRect(),ee=O.getBoundingClientRect(),ne=J.scrollTop+(ee.top-Q.top)-J.clientHeight/2+ee.height/2;C.current&&window.clearTimeout(C.current),F.current=!0,J.scrollTo({top:Math.max(0,ne),behavior:"smooth"});const pe=()=>{F.current=!1};"onscrollend"in J&&J.addEventListener("scrollend",pe,{once:!0}),C.current=window.setTimeout(()=>{F.current=!1},1500)},[]);a.useEffect(()=>()=>{E.current&&window.clearTimeout(E.current),C.current&&window.clearTimeout(C.current)},[]);const Z=a.useCallback(()=>{C.current&&window.clearTimeout(C.current),F.current=!1;const S=d.current;S&&(S.scrollTop=S.scrollHeight)},[]),V=a.useCallback(()=>{C.current&&window.clearTimeout(C.current),F.current=!1,h(!0);const S=d.current;S&&S.scrollTo({top:S.scrollHeight,behavior:"smooth"})},[]);a.useEffect(()=>{s&&(h(!0),Z())},[s,Z]),a.useEffect(()=>{x&&Z()},[t,x,Z]);const me=a.useMemo(()=>[{icon:fn,label:c("chat.suggestionCode"),prompt:c("chat.suggestionCodePrompt")},{icon:vt,label:c("chat.suggestionAnalyze"),prompt:c("chat.suggestionAnalyzePrompt")},{icon:yt,label:c("chat.suggestionAutomate"),prompt:c("chat.suggestionAutomatePrompt")}],[c]);return e.jsxs("div",{className:"relative flex-1 min-h-0",children:[e.jsxs("div",{ref:d,onScroll:W,className:"h-full overflow-y-auto custom-scrollbar",children:[D.length===0?e.jsxs("div",{className:"relative flex min-h-[55vh] items-center justify-center px-4 py-10 sm:px-6",children:[e.jsx(oa,{}),e.jsxs("div",{className:"relative w-full max-w-2xl px-1 text-center",children:[e.jsx("div",{className:"chat-empty-orb",children:e.jsx("img",{src:"/logo.svg",alt:"deepseekcode",className:"relative h-10 w-10"})}),e.jsx("h2",{className:"text-xl font-semibold tracking-tight mb-2",children:c("chat.welcome")}),e.jsx("p",{className:"text-dark-muted text-sm mb-8",children:c("chat.welcomeDesc")}),l&&e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-2.5 text-left",children:me.map(S=>e.jsxs("button",{onClick:()=>l(S.prompt),className:"ui-card-interactive group w-full px-4 py-3.5 text-left",children:[e.jsx(S.icon,{size:16,"aria-hidden":"true",className:"text-accent-blue mb-2"}),e.jsx("div",{className:"text-[13px] font-medium text-dark-text",children:S.label}),e.jsx("div",{className:"mt-0.5 text-[11px] leading-snug text-dark-muted line-clamp-2",children:S.prompt})]},S.label))})]})]}):e.jsx("div",{className:"chat-stack flex flex-col pb-8 pt-5",children:D.map((S,J)=>{const O=D[J-1],Q=O?O.type===S.type?"mt-2":"mt-5":"";return e.jsxs("div",{"data-mid":S.id,ref:A,className:`relative w-full ${Q}`,children:[b===S.id&&e.jsx("div",{className:"animate-rail-flash pointer-events-none absolute inset-0"},y),e.jsx(sa,{message:S,sessionId:n,onRegenerate:o,onDeleteMessage:u})]},S.id)})}),s&&!j&&e.jsxs("div",{className:"mx-auto flex max-w-[46rem] items-center gap-2 px-4 py-3 text-xs text-dark-muted sm:px-6",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-accent-blue animate-blink"}),e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-accent-blue animate-blink",style:{animationDelay:"0.2s"}}),e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-accent-blue animate-blink",style:{animationDelay:"0.4s"}})]}),e.jsx("span",{children:c("chat.thinkingEllipsis")})]})]}),N.length>0&&e.jsx(aa,{items:N,activeId:g,onJump:U}),!x&&D.length>0&&e.jsx("button",{type:"button",onClick:V,title:c("chat.backToBottom"),"aria-label":c("chat.backToBottom"),className:"absolute bottom-5 right-5 z-20 flex h-8 w-8 animate-fade-in-up items-center justify-center rounded-full border border-dark-border/70 bg-dark-surface/90 text-dark-muted shadow-lg backdrop-blur transition-all duration-200 hover:scale-110 hover:text-dark-text hover:shadow-xl",children:e.jsx(ge,{size:15})})]})}),da={plan:"border-accent-blue/30 text-accent-blue bg-accent-blue/10","auto-plan":"border-accent-cyan/30 text-accent-cyan bg-accent-cyan/10",act:"border-accent-green/30 text-accent-green bg-accent-green/10","auto-act":"border-accent-yellow/30 text-accent-yellow bg-accent-yellow/10",goal:"border-accent-purple/30 text-accent-purple bg-accent-purple/10","auto-goal":"border-accent-red/30 text-accent-red bg-accent-red/10",normal:"border-accent-green/30 text-accent-green"},ua=a.memo(function(){const{t}=G(),s=ve(d=>d.mode),n=ve(d=>d.setBaseMode),l=ve(d=>d.toggleAuto),o=s==="normal"?"act":s,u=Ge(o),c=gt(o);return e.jsxs("div",{className:"flex items-center gap-1",children:[Un.map(d=>{const i=u===d,x=Gn[d],h=s!=="normal"&&i?da[s]??"border-dark-border text-dark-muted":"border-dark-border text-dark-muted hover:bg-dark-hover";return e.jsx("button",{type:"button",onClick:()=>n(d),className:le("px-2 py-0.5 rounded-full border text-xs whitespace-nowrap transition-colors cursor-pointer",h),title:t("chat.clickToSwitchMode"),"aria-pressed":i,children:x.label},d)}),e.jsxs("button",{type:"button",role:"switch","aria-checked":c,onClick:()=>l(),className:le("flex items-center gap-1 px-2 py-0.5 rounded-full border text-xs whitespace-nowrap transition-colors cursor-pointer",c?"border-accent-yellow/40 text-accent-yellow bg-accent-yellow/10":"border-dark-border text-dark-muted hover:bg-dark-hover"),title:t("plan.autoApprove"),children:[e.jsx(Fe,{size:11,className:le(c?"text-accent-yellow":"text-dark-muted")}),e.jsx("span",{children:t("plan.autoApprove")})]})]})}),ns={off:{labelKey:"chat.effortOff",color:"text-dark-muted"},low:{labelKey:"chat.effortLow",color:"text-accent-green"},medium:{labelKey:"chat.effortMedium",color:"text-accent-yellow"},high:{labelKey:"chat.effortHigh",color:"text-accent-red"},extra_high:{labelKey:"chat.effortExtraHigh",color:"text-accent-purple"},max:{labelKey:"chat.effortMax",color:"text-accent-blue"}},xa=a.memo(function(){const{t}=G(),s=Le(v=>v.model),n=Le(v=>v.modelRef),l=Le(v=>v.setModel),o=Le(v=>v.setModelRef),u=ve(v=>v.mode),c=Ze(v=>v.effort),d=Ze(v=>v.setEffort),[i,x]=a.useState([]),[h,g]=a.useState(!1),k=a.useRef(null),[b,w]=a.useState(!1),[y,p]=a.useState(""),[E,F]=a.useState(""),[C,z]=a.useState([]),[D,j]=a.useState(new Set),[N,P]=a.useState("none"),[A,I]=a.useState(!1),[W,U]=a.useState(null),[Z,V]=a.useState(null),me=a.useMemo(()=>Array.from(new Set(i.map(v=>v.provider))),[i]),S=a.useCallback(async()=>{try{const v=await xe.models.list();v.success&&v.data&&Array.isArray(v.data.models)&&x(v.data.models.filter(H=>H.enabled!==!1))}catch{}},[]),J=a.useCallback(()=>{var H,$;const v=Kn(n)||((H=i.find(ie=>ie.isGlobalDefault))==null?void 0:H.provider)||(($=i[0])==null?void 0:$.provider)||"";p(v),F(""),U(null),w(!0)},[n,i]),O=a.useCallback(()=>{w(!1),z([]),U(null)},[]),Q=a.useCallback(async(v,H)=>{if(v){I(!0),U(null);try{const $=await xe.models.byProvider(v,H||void 0);$.success&&$.data?(z($.data.models||[]),j(new Set($.data.existing||[])),P($.data.source)):(z([]),j(new Set),U($.error||t("chat.loadModelsFailed")))}catch{z([]),j(new Set),U(t("chat.loadModelsFailed"))}finally{I(!1)}}},[t]);a.useEffect(()=>{if(!b)return;const v=setTimeout(()=>{Q(y,E)},E?300:0);return()=>clearTimeout(v)},[b,y,E,Q]),a.useEffect(()=>{S()},[S]),a.useEffect(()=>{const v=()=>{S()};return window.addEventListener("models-updated",v),()=>window.removeEventListener("models-updated",v)},[S]);const ee=a.useCallback(()=>g(!1),[]);a.useEffect(()=>{if(!h)return;const v=$=>{k.current&&!k.current.contains($.target)&&ee()},H=$=>{$.key==="Escape"&&ee()};return document.addEventListener("mousedown",v),document.addEventListener("keydown",H),()=>{document.removeEventListener("mousedown",v),document.removeEventListener("keydown",H)}},[h,ee]);const ne=async v=>{ee();const H=Ge(u==="normal"?"act":u),$=`${v.provider}:${v.id}`,ie=H==="plan"?{plan:$}:H==="goal"?{goal:$}:{global:$,act:$};try{(await xe.models.setDefaults(ie)).success&&(l(v.id),o(`${v.provider}:${v.id}`),await S())}catch{}},pe=async v=>{const H=D.has(v.id),$=`${y}:${v.id}`;V(v.id);try{if(!H){const Ie=await xe.models.create({provider:y,model:{id:v.id,name:v.name||v.id}});if(!Ie.success){U(Ie.error||t("chat.addModelFailed"));return}}const ie=Ge(u==="normal"?"act":u),ue=ie==="plan"?{plan:$}:ie==="goal"?{goal:$}:{global:$,act:$},qe=await xe.models.setDefaults(ue);qe.success?(l(v.id),o($),O(),await S()):U(qe.error||t("chat.switchModelFailed"))}catch{U(t("chat.addModelFailed"))}finally{V(null)}},X=Ge(u==="normal"?"act":u),he=X==="plan"?"isPlanDefault":X==="goal"?"isGoalDefault":"isActDefault",re=v=>{const H=`${v.provider}:${v.id}`;if(n)return n===H;if(s===H)return!0;if(s!==v.id)return!1;const $=i.filter(ue=>ue.id===v.id);return $.length<=1?!0:($.find(ue=>ue[he]===!0)??$.find(ue=>ue.isGlobalDefault)??$[0])===v},ye=i.some(v=>v[he]===!0),de=i.find(v=>v.isGlobalDefault),_=async()=>{ee();const v=X==="plan"?{plan:null}:X==="goal"?{goal:null}:{act:null};try{(await xe.models.setDefaults(v)).success&&(de?(l(de.id),o(`${de.provider}:${de.id}`)):(l(""),o("")),await S())}catch{}},T=a.useMemo(()=>Zn(i),[i]),B=Vn(s,n),se=ns[c];return e.jsxs("div",{className:"relative",ref:k,children:[e.jsxs("button",{type:"button",onClick:()=>g(v=>!v),className:"flex items-center gap-1 px-2 py-0.5 rounded-full border border-dark-border text-dark-muted whitespace-nowrap transition-colors hover:bg-dark-hover cursor-pointer",title:B||t("chat.clickToSelectModel"),"aria-haspopup":"listbox","aria-expanded":h,children:[e.jsx(bn,{size:12,className:"shrink-0"}),e.jsx("span",{className:"font-medium max-w-[8rem] truncate",children:B||t("chat.selectModel")}),e.jsx("span",{className:"h-3 w-px bg-dark-border shrink-0","aria-hidden":"true"}),e.jsx($t,{size:12,className:`shrink-0 ${se.color}`}),e.jsx("span",{className:`text-xs font-medium ${se.color}`,children:t(se.labelKey)}),e.jsx(ge,{size:12,className:le("transition-transform",h&&"rotate-180")})]}),h&&e.jsxs("div",{role:"listbox","aria-label":t("chat.selectModel"),className:"absolute bottom-full left-0 mb-1 z-50 min-w-[260px] bg-dark-surface border border-dark-border rounded-lg shadow-xl overflow-hidden",children:[e.jsx("div",{className:"px-3 py-1.5 text-[10px] font-semibold uppercase tracking-wide text-dark-muted border-b border-dark-border",children:t("chat.selectModel")}),b?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"px-2 py-1.5 border-b border-dark-border flex items-center gap-1.5",children:[e.jsx("button",{type:"button",onClick:O,title:t("chat.backToModels"),"aria-label":t("chat.backToModels"),className:"p-1 rounded hover:bg-dark-hover text-dark-muted hover:text-dark-text shrink-0",children:e.jsx(gn,{size:12})}),me.length>1?e.jsx("select",{value:y,onChange:v=>p(v.target.value),"aria-label":t("chat.selectProvider"),className:"max-w-[9rem] min-w-0 bg-dark-surface text-dark-text text-xs px-1.5 py-1 rounded border border-dark-border focus:outline-none focus:border-accent-blue",children:me.map(v=>e.jsx("option",{value:v,children:v},v))}):e.jsx("span",{className:"flex-1 min-w-0 text-xs font-medium text-dark-text truncate",children:y||t("chat.noConfiguredProviders")}),e.jsx("input",{value:E,onChange:v=>F(v.target.value),placeholder:t("chat.searchModels"),"aria-label":t("chat.searchModels"),className:"flex-1 min-w-0 bg-dark-bg text-dark-text text-xs px-2 py-1 rounded border border-dark-border placeholder-dark-muted/60 focus:outline-none focus:border-accent-blue"})]}),e.jsx("div",{className:"py-1 max-h-[32vh] overflow-y-auto custom-scrollbar",children:A?e.jsxs("div",{className:"px-3 py-2 text-xs text-dark-muted flex items-center gap-1.5",children:[e.jsx(kn,{size:11,className:"animate-spin"}),t("chat.loadingModels")]}):W?e.jsx("div",{className:"px-3 py-2 text-xs text-accent-red",children:W}):y?C.length===0?e.jsx("div",{className:"px-3 py-2 text-xs text-dark-muted",children:t(E?"chat.noModelsFound":"chat.noProviderModels")}):e.jsxs(e.Fragment,{children:[N!=="none"&&e.jsx("div",{className:"px-3 pt-1.5 pb-0.5 text-[10px] text-dark-muted/70",children:t(N==="provider-api"?"chat.modelsSourceProviderApi":"chat.modelsSourceCatalog")}),C.map(v=>{const H=D.has(v.id),$=n===`${y}:${v.id}`;return e.jsxs("button",{type:"button",role:"option","aria-selected":$,onClick:()=>pe(v),className:"w-full flex items-center gap-2 px-3 py-1.5 text-left transition-colors hover:bg-dark-hover",children:[e.jsxs("span",{className:"flex-1 min-w-0",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-xs font-medium text-dark-text truncate",children:v.name||v.id}),$&&e.jsx("span",{className:"text-[10px] px-1 rounded bg-accent-green/20 text-accent-green shrink-0",children:t("chat.currentModel")})]}),e.jsx("span",{className:"block text-[10px] text-dark-muted truncate mt-0.5",children:v.id})]}),H?e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-accent-green/20 text-accent-green shrink-0",children:t("chat.alreadyAdded")}):e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-accent-blue/20 text-accent-blue shrink-0 whitespace-nowrap",children:Z===v.id?t("chat.addingModel"):t("chat.addAndSwitch")})]},v.id)})]}):e.jsx("div",{className:"px-3 py-2 text-xs text-dark-muted",children:t("chat.noConfiguredProviders")})})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"py-1 max-h-[32vh] overflow-y-auto custom-scrollbar",children:[ye&&e.jsx("button",{type:"button",role:"option","aria-selected":!1,onClick:_,title:t("chat.followGlobalDefaultHint"),className:"w-full flex items-center gap-2 px-3 py-2 text-left transition-colors hover:bg-dark-hover border-b border-dark-border/60",children:e.jsxs("span",{className:"flex-1 min-w-0",children:[e.jsxs("span",{className:"text-xs font-semibold text-accent-green flex items-center gap-1.5",children:[e.jsx(yn,{size:11}),t("chat.followGlobalDefault")]}),e.jsx("span",{className:"block text-[10px] text-dark-muted mt-0.5 truncate",children:de?de.name||de.id:t("chat.noGlobalDefault")})]})}),T.map(([v,H])=>e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-dark-border/60 bg-dark-bg/40",children:[e.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wide text-dark-muted truncate",children:v}),e.jsx("span",{className:"text-[10px] text-dark-muted/70",children:H.length})]}),H.map($=>{const ie=re($);return e.jsx("button",{type:"button",role:"option","aria-selected":ie,onClick:()=>ne($),className:le("w-full flex items-center gap-2 px-3 py-2 text-left transition-colors",ie?"bg-dark-hover":"hover:bg-dark-hover"),children:e.jsxs("span",{className:"flex-1 min-w-0",children:[e.jsxs("span",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:le("flex h-4 w-4 items-center justify-center rounded border transition-colors shrink-0",ie?"border-accent-green bg-accent-green/20 text-accent-green":"border-dark-border text-transparent"),children:e.jsx(je,{size:11,strokeWidth:3})}),e.jsx("span",{className:"text-xs font-semibold text-dark-text truncate",children:$.name||$.id})]}),e.jsxs("span",{className:"flex items-center gap-1 mt-0.5 flex-wrap",children:[e.jsx("span",{className:"text-[10px] text-dark-muted truncate",children:$.id}),$.isGlobalDefault&&e.jsx("span",{className:"text-[10px] px-1 rounded bg-accent-green/20 text-accent-green",children:t("chat.globalDefault")}),$.isPlanDefault&&e.jsx("span",{className:"text-[10px] px-1 rounded bg-accent-blue/20 text-accent-blue",children:t("chat.planDefault")}),$.isActDefault&&e.jsx("span",{className:"text-[10px] px-1 rounded bg-accent-yellow/20 text-accent-yellow",children:t("chat.actDefault")}),$.isGoalDefault&&e.jsx("span",{className:"text-[10px] px-1 rounded bg-accent-purple/20 text-accent-purple",children:t("chat.goalDefault")})]})]})},`${$.provider}:${$.id}`)})]},v)),i.length===0&&e.jsx("div",{className:"px-3 py-2 text-xs text-dark-muted",children:t("chat.noEnabledModels")})]}),e.jsxs("button",{type:"button",onClick:J,className:"w-full flex items-center gap-2 px-3 py-2 text-left border-t border-dark-border/60 text-[11px] font-medium text-accent-blue transition-colors hover:bg-dark-hover",children:[e.jsx(vt,{size:11}),t("chat.browseMoreModels")]})]}),e.jsx("div",{className:"border-t border-dark-border","aria-hidden":"true"}),e.jsxs("div",{className:"px-3 py-1.5 text-[10px] font-semibold uppercase tracking-wide text-dark-muted border-b border-dark-border flex items-center gap-1",children:[e.jsx($t,{size:11}),t("chat.effort")]}),e.jsx("div",{className:"py-1",children:Qn.map(v=>{const H=ns[v],$=v===c;return e.jsxs("button",{type:"button",role:"option","aria-selected":$,onClick:()=>{d(v),ee()},className:le("w-full flex items-center gap-2 px-3 py-1.5 text-left transition-colors",$?"bg-dark-hover":"hover:bg-dark-hover"),children:[e.jsx("span",{className:le("flex h-4 w-4 items-center justify-center rounded border transition-colors shrink-0",$?"border-accent-green bg-accent-green/20 text-accent-green":"border-dark-border text-transparent"),children:e.jsx(je,{size:11,strokeWidth:3})}),e.jsx("span",{className:`text-xs font-medium ${$?H.color:"text-dark-text"}`,children:t(H.labelKey)})]},v)})})]})]})});var pa=ar();function ma(r,t){if(!r)return t;const s=r.includes("\\")?"\\":"/";return r.endsWith(s)?r+t:r+s+t}function ha(r){const t=r.replace(/[\\/]+$/,""),s=Math.max(t.lastIndexOf("\\"),t.lastIndexOf("/"));return s===-1?t:t.slice(s+1)}function fa({initial:r,onClose:t,onConfirm:s}){const{t:n}=G(),[l,o]=a.useState(r),[u,c]=a.useState(null),[d,i]=a.useState([]),[x,h]=a.useState(!1),[g,k]=a.useState(""),[b,w]=a.useState(r),y=a.useRef(null),p=a.useCallback(async C=>{h(!0),k("");try{const z=await xe.dirs.list(C);if(!z.success||!z.data){k(z.error||n("chat.dirPickerLoadError"));return}o(z.data.path),c(z.data.parent),i(z.data.dirs||[]),w(z.data.path)}catch(z){k(z instanceof Error?z.message:n("chat.dirPickerLoadError"))}finally{h(!1)}},[n]);a.useEffect(()=>{p(r)},[r,p]),a.useEffect(()=>{var C;(C=y.current)==null||C.focus()},[]),a.useEffect(()=>{const C=z=>{z.key==="Escape"&&(z.preventDefault(),z.stopPropagation(),t())};return document.addEventListener("keydown",C),document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",C),document.body.style.overflow=""}},[t]);const E=a.useCallback(()=>{const C=b.trim();C&&p(C)},[b,p]),F=a.useCallback(()=>{u&&p(u)},[u,p]);return e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center overflow-hidden p-4",role:"dialog","aria-modal":"true",children:[e.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),e.jsxs("div",{className:"relative w-full max-w-lg mx-4 bg-dark-surface border border-dark-border rounded-xl shadow-2xl animate-fade-in flex flex-col max-h-[70vh]",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5 border-b border-dark-border shrink-0",children:[e.jsxs("span",{className:"flex items-center gap-2 text-[13px] font-semibold text-dark-text",children:[e.jsx(ms,{size:15,className:"text-accent-blue","aria-hidden":"true"}),n("chat.dirPickerTitle")]}),e.jsx("button",{type:"button",onClick:t,className:"rounded p-1 text-dark-muted hover:bg-dark-hover hover:text-dark-text transition-colors","aria-label":n("a11y.close"),children:e.jsx(Se,{size:15,"aria-hidden":"true"})})]}),e.jsxs("div",{className:"p-4 flex flex-col gap-3 min-h-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(wn,{size:13,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-dark-muted/60","aria-hidden":"true"}),e.jsx("input",{ref:y,value:b,onChange:C=>w(C.target.value),onKeyDown:C=>{C.key==="Enter"&&E()},placeholder:n("chat.dirPickerEnterPath"),spellCheck:!1,className:`w-full rounded-lg border border-dark-border bg-dark-bg pl-8 pr-2.5 py-1.5 text-xs font-mono text-dark-text
|
|
23
|
-
placeholder-dark-muted/50 focus:outline-none focus:border-accent-blue/50 focus:ring-2 focus:ring-accent-blue/10`})]}),e.jsx("button",{type:"button",onClick:E,disabled:x||!b.trim(),className:`shrink-0 rounded-lg border border-dark-border px-2.5 py-1.5 text-xs text-dark-muted
|
|
24
|
-
hover:bg-dark-hover hover:text-dark-text disabled:opacity-40 transition-colors`,children:n("chat.dirPickerGo")})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"flex-1 truncate font-mono text-[11px] text-dark-muted bg-dark-bg rounded-md px-2 py-1 border border-dark-border",title:l,children:l||n("chat.noWorkspaceDir")}),e.jsxs("button",{type:"button",onClick:()=>void F(),disabled:x||!l,className:`shrink-0 flex items-center gap-1 rounded-md border border-dark-border px-2 py-1 text-[11px] text-dark-muted
|
|
25
|
-
hover:bg-dark-hover hover:text-dark-text disabled:opacity-40 transition-colors`,children:[e.jsx(hs,{size:12,"aria-hidden":"true"}),n("chat.dirPickerUp")]})]}),e.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto custom-scrollbar rounded-lg border border-dark-border bg-dark-bg divide-y divide-dark-border/60",children:x?e.jsxs("div",{className:"flex items-center justify-center gap-2 py-6 text-xs text-dark-muted",children:[e.jsx(Te,{size:14,className:"animate-spin","aria-hidden":"true"}),n("chat.loading")]}):g?e.jsx("div",{className:"px-3 py-4 text-xs text-accent-red",children:g}):d.length===0?e.jsx("div",{className:"px-3 py-4 text-xs text-dark-muted/60 text-center",children:n("chat.dirPickerNoDirs")}):d.map(C=>{const z=ma(l,C);return e.jsxs("button",{type:"button",onClick:()=>void p(z),className:`w-full flex items-center gap-2 px-3 py-1.5 text-left text-xs text-dark-text
|
|
26
|
-
hover:bg-dark-hover transition-colors group`,children:[e.jsx(jt,{size:13,className:"shrink-0 text-accent-yellow/80 group-hover:text-accent-yellow","aria-hidden":"true"}),e.jsx("span",{className:"truncate",children:C}),e.jsx(ke,{size:12,className:"shrink-0 ml-auto text-dark-muted/40","aria-hidden":"true"})]},C)})}),e.jsx("button",{type:"button",onClick:()=>s(l),disabled:!l||x,className:`w-full rounded-lg bg-accent-blue/90 text-white text-xs font-medium py-2
|
|
27
|
-
hover:bg-accent-blue disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:n("chat.dirPickerConfirm")})]})]})]})}const ba=a.memo(function({workspaceDir:t,onSelect:s}){const{t:n}=G(),l=Ze(h=>h.recentDirs),[o,u]=a.useState(!1),[c,d]=a.useState(!1),i=a.useRef(null);a.useEffect(()=>{if(!o)return;const h=k=>{i.current&&!i.current.contains(k.target)&&u(!1)},g=k=>{k.key==="Escape"&&u(!1)};return document.addEventListener("mousedown",h),document.addEventListener("keydown",g),()=>{document.removeEventListener("mousedown",h),document.removeEventListener("keydown",g)}},[o]);const x=a.useCallback(h=>{var k;const g=((k=h==null?void 0:h.trim)==null?void 0:k.call(h))||"";g&&(u(!1),d(!1),s(g))},[s]);return e.jsxs("div",{className:"relative shrink-0",ref:i,children:[e.jsxs("button",{type:"button",onClick:()=>u(h=>!h),className:le("flex items-center gap-1 max-w-[180px] px-2 py-0.5 rounded-full border text-xs whitespace-nowrap transition-colors cursor-pointer",o?"border-accent-blue/40 text-accent-blue bg-accent-blue/10":"border-dark-border text-dark-muted hover:bg-dark-hover hover:text-dark-text"),title:n("chat.clickToSwitchDir"),"aria-label":n("chat.clickToSwitchDir"),"aria-expanded":o,"aria-haspopup":"menu",children:[e.jsx(ms,{size:12,className:"shrink-0 text-accent-blue/80","aria-hidden":"true"}),e.jsx("span",{className:"truncate font-mono text-[11px]",children:t?ha(t):n("chat.noWorkspaceDir")}),e.jsx(ge,{size:11,className:le("shrink-0 transition-transform",o&&"rotate-180"),"aria-hidden":"true"})]}),o&&e.jsxs("div",{role:"menu",className:"absolute bottom-full left-0 mb-2 w-72 max-w-[calc(100vw-1.5rem)] rounded-xl border border-dark-border bg-dark-surface shadow-2xl z-40 overflow-hidden animate-fade-in",children:[e.jsx("div",{className:"px-3 pt-2.5 pb-1 text-[10px] font-semibold uppercase tracking-wide text-dark-muted/50 select-none",children:n("chat.recentDirs")}),l.length===0?e.jsx("div",{className:"px-3 pb-2 text-[11px] text-dark-muted/50 select-none",children:n("chat.noRecentDirs")}):e.jsx("div",{className:"max-h-56 overflow-y-auto custom-scrollbar",children:l.map(h=>{const g=h===t;return e.jsxs("button",{type:"button",role:"menuitem",onClick:()=>x(h),className:le("w-full flex items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors group",g?"text-accent-blue bg-accent-blue/5":"text-dark-text hover:bg-dark-hover"),title:h,children:[e.jsx(jt,{size:12,className:le("shrink-0",g?"text-accent-blue":"text-accent-yellow/80 group-hover:text-accent-yellow"),"aria-hidden":"true"}),e.jsx("span",{className:"truncate font-mono text-[11px]",children:h}),g&&e.jsx("span",{className:"ml-auto shrink-0 text-[10px] text-accent-blue",children:"✓"})]},h)})}),e.jsx("div",{className:"border-t border-dark-border"}),e.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{u(!1),d(!0)},className:"w-full flex items-center gap-2 px-3 py-2 text-left text-xs text-accent-blue hover:bg-dark-hover transition-colors",children:[e.jsx(ke,{size:13,"aria-hidden":"true"}),n("chat.chooseOtherDir")]})]}),c&&pa.createPortal(e.jsx(fa,{initial:t||"",onClose:()=>d(!1),onConfirm:x}),document.body)]})});function ga({isOpen:r,files:t,selectedIndex:s,query:n,isSearching:l,onSelect:o,onHover:u,selectedCount:c=0,onFinish:d}){const{t:i}=G();return r?e.jsxs("div",{className:"absolute bottom-full left-0 right-0 mb-2 bg-dark-surface border border-dark-border rounded-lg shadow-xl overflow-hidden z-50",children:[e.jsxs("div",{className:"max-h-60 overflow-y-auto custom-scrollbar",children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-2 text-[11px] text-dark-muted border-b border-dark-border bg-dark-bg",children:[e.jsx("span",{className:"font-medium text-dark-text",children:n?`@${n}`:"@ file"}),e.jsxs("span",{className:"opacity-70 flex items-center gap-2",children:[c>0&&e.jsx("span",{className:"px-1.5 py-0.5 rounded-full bg-accent-blue/20 text-accent-blue font-medium",children:i("chat.selectedCountShort",{n:c})}),e.jsx("span",{children:i("chat.fileMentionHelpMulti")})]})]}),t.length===0?e.jsx("div",{className:"px-3 py-6 text-center text-dark-muted text-xs flex flex-col items-center gap-1",children:l?e.jsxs(e.Fragment,{children:[e.jsx(Te,{size:16,className:"animate-spin"}),e.jsx("span",{children:i("chat.searchingFiles")})]}):e.jsx("span",{children:i("chat.noMatchingFiles")})}):t.map((x,h)=>e.jsxs("button",{onClick:()=>o(x),onMouseEnter:()=>u(h),className:`w-full px-3 py-1.5 flex items-center gap-2 text-left text-xs transition-colors border-l-2 ${h===s?"bg-accent-blue/20 text-accent-blue border-accent-blue":"hover:bg-dark-hover text-dark-text border-transparent"}`,children:[x.type==="directory"?e.jsx(jt,{size:12,className:"text-accent-yellow shrink-0"}):e.jsx(wt,{size:12,className:"text-dark-muted shrink-0"}),e.jsx("span",{className:"truncate",children:x.name}),e.jsx("span",{className:"text-[10px] text-dark-muted truncate ml-auto",children:x.path})]},x.id||x.path))]}),d&&e.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-t border-dark-border bg-dark-bg",children:[e.jsx("span",{className:"text-[10px] text-dark-muted",children:c>0?i("chat.selectedFilesCount",{n:c}):i("chat.enterInsertMulti")}),e.jsx("button",{onClick:d,className:"px-3 py-1 text-[11px] rounded bg-accent-blue text-white hover:opacity-90 transition-opacity",children:i("chat.finishMention")})]})]}):null}function ka({open:r,onClose:t,onSelect:s}){const{t:n}=G(),[l,o]=a.useState([]),[u,c]=a.useState(!1),[d,i]=a.useState("");a.useEffect(()=>{r&&(i(""),c(!0),xe.skills.list().then(h=>{const g=Array.isArray(h.data)?h.data:[];o(g.filter(k=>k.enabled!==!1))}).catch(()=>o([])).finally(()=>c(!1)))},[r]);const x=a.useMemo(()=>{const h=d.trim().toLowerCase();return h?l.filter(g=>[g.id,g.name,g.description,g.category,...g.tags||[]].join(" ").toLowerCase().includes(h)):l},[l,d]);return e.jsx(Xn,{isOpen:r,onClose:t,title:n("skills.pickTitle"),size:"lg",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-dark-bg border border-dark-border focus-within:border-accent-blue",children:[e.jsx(vt,{size:14,className:"text-dark-muted shrink-0"}),e.jsx("input",{value:d,onChange:h=>i(h.target.value),placeholder:n("skills.pickPlaceholder"),autoFocus:!0,className:"flex-1 bg-transparent outline-none text-sm placeholder-dark-muted/60"}),u&&e.jsx(Fe,{size:13,className:"animate-spin text-dark-muted"})]}),u?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(Fe,{size:20,className:"animate-spin text-accent-blue"})}):x.length===0?e.jsx("div",{className:"text-center py-12 text-sm text-dark-muted",children:n("skills.pickEmpty")}):e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:x.map(h=>e.jsxs("button",{onClick:()=>s(h),className:"text-left rounded-lg border border-dark-border p-3 flex flex-col gap-1 transition-colors hover:border-accent-blue/50 hover:bg-dark-hover",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 min-w-0",children:[e.jsxs("span",{className:"font-medium text-sm truncate",children:[h.icon||"⭐"," ",h.name]}),e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-dark-bg border border-dark-border text-dark-muted shrink-0",children:h.injection||"lazy"})]}),e.jsxs("div",{className:"text-xs text-dark-muted truncate font-mono",children:["$",h.id]}),h.description&&e.jsx("div",{className:"text-xs text-dark-muted line-clamp-2",children:h.description}),e.jsxs("div",{className:"flex items-center justify-between gap-2 mt-1",children:[e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-dark-bg border border-dark-border text-dark-muted truncate",children:h.category||"—"}),e.jsxs("span",{className:"flex items-center gap-1 text-[11px] text-accent-blue shrink-0",children:[e.jsx(yt,{size:11}),n("skills.pickUse")]})]})]},h.id))})]})})}const ya=800,Be=/\[Pasted text #(\d+)(?:\s*\+\d+ lines?)?\]/g;let wa=0;const Ve=new Map;function va(r){const t=++wa;return Ve.set(t,r),t}function ja(r){Ve.delete(r)}function Na(r){return r.length>ya||Ls(r)>0}function Ls(r){return(r.match(/\r\n|\r|\n/g)||[]).length}function Sa(r){const t=va(r),s=Ls(r);return s===0?{id:t,label:`[Pasted text #${t}]`}:{id:t,label:`[Pasted text #${t} +${s} lines]`}}function Ca(r){return Be.lastIndex=0,r.replace(Be,(t,s)=>{const n=parseInt(s,10),l=Ve.get(n);return l!==void 0?l:t})}function Ea(r){Be.lastIndex=0;const t=[];let s;for(;(s=Be.exec(r))!==null;){const n=s[1];n!==void 0&&t.push(parseInt(n,10))}return Be.lastIndex=0,t}function _a(r){for(const t of r)Ve.delete(t)}function Aa(r){const t=r.match(/\[Pasted text #\d+(?:\s*\+\d+ lines?)?\]$/);return t?t[0]??null:null}function Ma(r){const t=r.match(/^\[Pasted text #\d+(?:\s*\+\d+ lines?)?\]/);return t?t[0]??null:null}function rs(r){const t=r.match(/#(\d+)/);t&&ja(parseInt(t[1]??"",10))}const Ke=16e3;function ot(){const r=["audio/webm;codecs=opus","audio/webm","audio/mp4"];if(typeof MediaRecorder>"u")return"";for(const t of r)if(MediaRecorder.isTypeSupported(t))return t;return""}async function za(r){if(r.sampleRate===Ke&&r.numberOfChannels===1)return r.getChannelData(0);const t=Math.max(1,Math.ceil(r.length*Ke/r.sampleRate)),s=new OfflineAudioContext(1,t,Ke),n=s.createBufferSource();return n.buffer=r,n.connect(s.destination),n.start(0),(await s.startRendering()).getChannelData(0)}function Ta(r,t){const s=new ArrayBuffer(44+r.length*2),n=new DataView(s),l=(u,c)=>{for(let d=0;d<c.length;d++)n.setUint8(u+d,c.charCodeAt(d))};l(0,"RIFF"),n.setUint32(4,36+r.length*2,!0),l(8,"WAVE"),l(12,"fmt "),n.setUint32(16,16,!0),n.setUint16(20,1,!0),n.setUint16(22,1,!0),n.setUint32(24,t,!0),n.setUint32(28,t*2,!0),n.setUint16(32,2,!0),n.setUint16(34,16,!0),l(36,"data"),n.setUint32(40,r.length*2,!0);let o=44;for(let u=0;u<r.length;u++){const c=Math.max(-1,Math.min(1,r[u]??0));n.setInt16(o,c<0?c*32768:c*32767,!0),o+=2}return s}function Ia(r){return new Promise((t,s)=>{const n=new FileReader;n.onload=()=>{const l=String(n.result||""),o=l.indexOf(",");t(o>=0?l.slice(o+1):l)},n.onerror=()=>s(n.error),n.readAsDataURL(r)})}function Ra(r){const[t,s]=a.useState("idle"),[n,l]=a.useState(0),o=a.useRef(null),u=a.useRef(null),c=a.useRef([]),d=a.useRef(null),i=a.useRef(0),x=a.useCallback(()=>{var w;(w=u.current)==null||w.getTracks().forEach(y=>y.stop()),u.current=null},[]),h=a.useCallback(()=>{d.current&&(clearInterval(d.current),d.current=null)},[]);a.useEffect(()=>()=>{h(),o.current&&o.current.state!=="inactive"&&o.current.stop(),x()},[h,x]);const g=a.useCallback(async()=>{if(t!=="idle")return;if(typeof MediaRecorder>"u")throw new Error("当前浏览器不支持语音输入(需要 MediaRecorder)。请使用 Chrome/Edge/Firefox 或桌面版。");let w;try{w=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,noiseSuppression:!0}})}catch(p){throw p instanceof DOMException&&p.name==="NotAllowedError"?new Error("麦克风权限被拒绝。请在浏览器地址栏允许麦克风权限后重试。"):new Error("无法访问麦克风:"+(p instanceof Error?p.message:String(p)))}u.current=w,c.current=[];const y=new MediaRecorder(w,ot()?{mimeType:ot()}:void 0);y.ondataavailable=p=>{p.data&&p.data.size>0&&c.current.push(p.data)},o.current=y,y.start(),i.current=Date.now(),l(0),s("recording"),d.current=setInterval(()=>l(Date.now()-i.current),100)},[t]),k=a.useCallback(async()=>{var p;const w=o.current;if(!w||w.state==="inactive")throw new Error("当前没有进行中的录音。");const y=new Promise(E=>{w.onstop=()=>E()});w.stop(),await y,h(),x(),o.current=null,s("transcribing");try{const E=new Blob(c.current,{type:ot()||"audio/webm"});c.current=[];const F=await E.arrayBuffer(),C=new AudioContext;let z;try{z=await C.decodeAudioData(F)}finally{C.close()}if(z.duration<.25)return s("idle"),"";const j=await za(z),N=Ta(j,Ke),P=await Ia(new Blob([N],{type:"audio/wav"})),A=await xe.stt.transcribe(r,P,"wav");if(!A.success)throw new Error(A.error||"语音转写失败");return((p=A.data)==null?void 0:p.text)??""}finally{s("idle")}},[r,h,x]),b=a.useCallback(()=>{const w=o.current;w&&w.state!=="inactive"&&w.stop(),o.current=null,c.current=[],h(),x(),s("idle")},[h,x]);return{state:t,elapsedMs:n,start:g,stop:k,cancel:b}}const $a=({isOpen:r,commands:t,selectedIndex:s,filter:n,onSelect:l,onHover:o,containerRef:u})=>{const{t:c}=G();return!r||t.length===0?null:e.jsxs("div",{ref:u,className:"absolute bottom-full left-0 right-0 mb-2 bg-dark-surface border border-dark-border rounded-lg shadow-xl overflow-hidden z-50 max-h-72 overflow-y-auto custom-scrollbar",children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-2 text-[11px] text-dark-muted border-b border-dark-border bg-dark-bg",children:[e.jsx("span",{className:"font-medium text-dark-text",children:n?`/${n}`:c("slashCommands.quickCommands")}),e.jsx("span",{className:"opacity-70",children:c("slashCommands.help")})]}),t.map((d,i)=>e.jsxs("button",{"data-index":i,onClick:()=>l(d),onMouseEnter:()=>o(i),className:`w-full px-3 py-2 flex items-start gap-3 text-left transition-colors border-l-2 ${i===s?"bg-accent-blue/10 border-accent-blue":"border-transparent hover:bg-dark-hover"}`,children:[e.jsx("span",{className:"text-lg leading-none shrink-0","aria-hidden":"true",children:d.icon}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-sm font-medium text-dark-text",children:["/",d.name]}),d.args&&e.jsx("span",{className:"text-xs text-dark-muted",children:d.args}),!d.local&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-accent-blue/20 text-accent-blue shrink-0",children:c("slashCommands.backend")})]}),e.jsx("div",{className:"text-xs text-dark-muted truncate",children:d.description})]}),i===s&&e.jsx(vn,{size:14,className:"text-dark-muted shrink-0 mt-0.5","aria-hidden":"true"})]},d.id))]})},Bs=["xlsx","xls","csv","docx","txt","md","mdx","rst","adoc","ts","tsx","js","jsx","mjs","cjs","mts","cts","json","jsonc","yaml","yml","toml","xml","html","css","scss","less","py","rb","go","rs","java","kt","swift","c","h","cpp","hpp","cc","cs","sh","bash","zsh","ps1","bat","cmd","sql","graphql","proto","vue","svelte","astro","env","gitignore","gitattributes","editorconfig"],Pa=new RegExp(`(?:\\.(${Bs.join("|")})|dockerfile|makefile)$`,"i"),Fs=["png","jpg","jpeg","webp","gif","bmp","svg"],Da=new RegExp(`\\.(${Fs.join("|")})$`,"i"),La=10*1024*1024,Ba=Bs.map(r=>`.${r}`).join(",")+",.Dockerfile,.Makefile,"+Fs.map(r=>`.${r}`).join(","),Fa=".deepseekcode/attachments",Oa=50*1024*1024,ct=10,qa=r=>/\.xlsx?$/i.test(r)?ft:/\.(csv|docx|txt|md|mdx|rst|adoc|json|jsonc|yaml|yml|toml|xml|html|css|scss|less|env|gitignore|gitattributes|editorconfig)$/i.test(r)?ht:/\.(ts|tsx|js|jsx|mjs|cjs|mts|cts|py|rb|go|rs|java|kt|swift|c|h|cpp|hpp|cc|cs|sh|bash|zsh|ps1|bat|cmd|sql|graphql|proto|vue|svelte|astro|dockerfile|makefile)$/i.test(r)?An:wt,dt=3e3,as=5,ut=50;function Ha(r,t){const s=r.slice(0,t),n=s.lastIndexOf("@");if(n===-1)return{active:!1,query:"",start:-1};const l=s.slice(n+1);return/^[\p{L}\p{N}_\-./]*$/u.test(l)?{active:!0,query:l,start:n}:{active:!1,query:"",start:-1}}function Ja(r,t){const s=r.lastIndexOf(`
|
|
28
|
-
`,t-1)+1,n=r.slice(s,t);return n.startsWith("/")?/\s/.test(n)?{active:!1,query:""}:{active:!0,query:n.slice(1)}:{active:!1,query:""}}const Wa=a.memo(function({sessionId:t,onSend:s,onStop:n,onPause:l,onResume:o,slashOptions:u,workspaceDir:c,onWorkspaceSelect:d}){const{t:i}=G(),x=fe(m=>{var f;return((f=m.sessionInputs)==null?void 0:f[t])??""}),h=fe(m=>m.setSessionInput),g=fe(m=>{var f;return((f=m.generatingSessions)==null?void 0:f.includes(t))??!1}),k=fe(m=>{var f;return((f=m.pausedSessions)==null?void 0:f.includes(t))??!1}),b=a.useRef(null),w=a.useRef(null),y=a.useRef(!1),[p,E]=a.useState([]),[F,C]=a.useState(!1),[z,D]=a.useState(!1),j=a.useCallback(m=>{h(t,m)},[t,h]),[N,P]=a.useState(()=>{try{return localStorage.getItem("dsc.stt.lang")==="zh"?"zh":"en"}catch{return"en"}}),A=a.useCallback(()=>{P(m=>{const f=m==="en"?"zh":"en";try{localStorage.setItem("dsc.stt.lang",f)}catch{}return f})},[]),I=Ra(N),W=a.useRef(null),U=a.useCallback(async()=>{var m;try{if(!W.current){const R=await xe.stt.status();R.success&&R.data&&(W.current=R.data)}const f=W.current;if(!f)return!0;if(f.service!=="ok"&&f.service!=="stopped")return oe.warning(i("stt.backendMissing")),window.dispatchEvent(new CustomEvent("switch-tab",{detail:{tab:"settings",section:"stt"}})),!1;const M=(m=f.backends)==null?void 0:m[N];return M&&!M.installed?(oe.warning(i("stt.backendMissing")),window.dispatchEvent(new CustomEvent("switch-tab",{detail:{tab:"settings",section:"stt"}})),!1):!0}catch{return!0}},[i,N]);a.useEffect(()=>{const m=()=>{W.current=null};return window.addEventListener("stt-backends-changed",m),()=>window.removeEventListener("stt-backends-changed",m)},[]),a.useEffect(()=>{const m=f=>{var R;const M=(R=f.detail)==null?void 0:R.lang;(M==="en"||M==="zh")&&P(M)};return window.addEventListener("stt-lang-changed",m),()=>window.removeEventListener("stt-lang-changed",m)},[]);const Z=a.useCallback(m=>{const f=b.current,M=(f==null?void 0:f.selectionStart)??x.length,R=x.slice(0,M)+m+x.slice(M);j(R),requestAnimationFrame(()=>{f==null||f.focus();const q=M+m.length;f&&(f.selectionStart=f.selectionEnd=q)})},[x,j]),V=a.useCallback(async()=>{if(I.state==="recording"){try{const f=await I.stop();f?Z(f):oe.info(i("stt.noSpeech"))}catch(f){oe.error(f instanceof Error?f.message:String(f))}return}if(!(I.state!=="idle"||!await U()))try{await I.start()}catch(f){oe.error(f instanceof Error?f.message:String(f))}},[I,Z,U,i]),me=Yn(u),{isOpen:S,filter:J,filteredCommands:O,selectedIndex:Q,setSelectedIndex:ee,selectNext:ne,selectPrev:pe,executeCommand:X,openMenu:he,closeMenu:re,setFilter:ye,allCommands:de,containerRef:_}=me,[T,B]=a.useState(!1),[se,v]=a.useState(""),[H,$]=a.useState([]),[ie,ue]=a.useState(0),[qe,Ie]=a.useState(!1),[qs,Re]=a.useState(0),Ce=a.useRef(-1),Ee=a.useRef(new Set),$e=a.useRef(null),He=a.useRef(null),Qe=a.useRef([]),we=a.useRef(!1);a.useEffect(()=>{Ee.current=new Set,we.current=!1,B(!1),v(""),$([]),Re(0),re()},[t,re]);const Et=a.useDeferredValue(x),_t=Le(m=>m.estimateTokens),Xe=a.useMemo(()=>_t(Et),[Et,_t]),At=a.useCallback(()=>{const m=b.current;m&&(m.style.height="auto",m.style.height=Math.min(m.scrollHeight,200)+"px")},[]);a.useEffect(()=>{At()},[x,p.length,At]);const Ye=a.useCallback(()=>{if($e.current)return Promise.resolve($e.current);if(He.current)return He.current;Ie(!0);const m=(async()=>{try{const f=await xe.files.list(),M=f.success&&f.data?f.data[0]:void 0;if(!M)return $e.current=[],[];const R=[],q=new Set,L=async(K,ae)=>{if(ae>as||R.length>=dt)return;const te=[];for(const Y of K||[]){if(R.length>=dt)return;const Ae=Y.path.replace(/\\/g,"/");q.has(Ae)||(q.add(Ae),Y.type==="file"?R.push({...Y,path:Ae}):Y.children&&Y.children.length>0?await L(Y.children,ae+1):ae<as&&te.push(Y))}if(te.length===0)return;const be=await Promise.all(te.map(async Y=>{var Ae;try{const st=await xe.files.list(Y.path.replace(/\\/g,"/"));return st.success&&st.data?((Ae=st.data[0])==null?void 0:Ae.children)||[]:[]}catch{return[]}}));for(const Y of be){if(R.length>=dt)return;await L(Y,ae+1)}};return await L(M.children,1),$e.current=R,R}catch{return $e.current=[],[]}finally{He.current=null,Ie(!1)}})();return He.current=m,m},[]),Mt=a.useCallback(async(m,f)=>{if(we.current){const K=Ce.current;if(K<0||f<K){we.current=!1,B(!1);return}const ae=m.slice(K,f);if(/\s/.test(ae)){we.current=!1,B(!1);return}Ce.current=K,v(ae),B(!0),ue(0);const te=await Ye();Qe.current=te;const be=ae.toLowerCase();$(te.filter(Y=>!be||Y.path.toLowerCase().includes(be)).slice(0,ut));return}const M=Ha(m,f);if(!M.active){T&&B(!1);return}Ce.current=M.start,v(M.query),B(!0),ue(0);const R=await Ye();Qe.current=R;const q=M.query.toLowerCase(),L=R.filter(K=>!q||K.path.toLowerCase().includes(q)).slice(0,ut);$(L)},[T,Ye]),Hs=a.useCallback(m=>{const f=m.target.value,M=m.target.selectionStart??f.length;j(f),Mt(f,M);const R=Ja(f,M);R.active?(S||he(),ye(R.query),ee(0)):S&&re()},[j,Mt,S,he,ye,ee,re]),et=a.useCallback(m=>{const f=b.current,M=x,R=Ce.current>=0?Ce.current:(f==null?void 0:f.selectionStart)??M.length,q=Math.min(M.length,R+1+se.length),L=`@${m.path} `,K=M.slice(0,R)+L+M.slice(q);Ee.current.add(m.path),j(K),B(!0),v(""),$(Qe.current.slice(0,ut)),ue(0),Re(Ee.current.size),Ce.current=R+L.length,we.current=!0,requestAnimationFrame(()=>{f==null||f.focus(),f&&(f.selectionStart=f.selectionEnd=R+L.length)})},[x,se,j]),Pe=a.useCallback(()=>{we.current=!1,B(!1),v(""),Re(0)},[]),tt=a.useCallback(m=>{if(!m.args){const L=X(m,"");L!=null&&L.message&&(L.success?oe.success(L.message):oe.error(L.message)),j("");return}const f=b.current,M=(f==null?void 0:f.selectionStart)??x.length,R=x.lastIndexOf(`
|
|
29
|
-
`,M-1)+1,q=x.slice(0,R)+`/${m.name} `+x.slice(M);j(q),re(),requestAnimationFrame(()=>{f==null||f.focus();const L=R+m.name.length+2;f&&(f.selectionStart=f.selectionEnd=L)})},[x,j,X,re]),Js=a.useCallback(m=>{const f=b.current,M=(f==null?void 0:f.selectionStart)??x.length,R=`$${m.id} `,q=x.slice(0,M)+R+x.slice(M);j(q),D(!1),we.current=!1,B(!1),v(""),requestAnimationFrame(()=>{f==null||f.focus();const L=M+R.length;f&&(f.selectionStart=f.selectionEnd=L)})},[x,j]),zt=a.useCallback(m=>new Promise((f,M)=>{const R=new FileReader;R.onload=()=>f(String(R.result??"")),R.onerror=()=>M(new Error("Failed to read image")),R.readAsDataURL(m)}),[]),_e=a.useCallback(m=>{const f=Array.from(m);E(M=>{const R=ct-M.length,q=M.slice();for(const L of f.slice(0,R)){const K=Da.test(L.name);if(!K&&!Pa.test(L.name)){oe.warning(i("fileJob.unsupportedType",{name:L.name}));continue}if(L.size>(K?La:Oa)){oe.error(i("fileJob.fileTooLarge",{name:L.name}));continue}if(q.some(te=>te.name===L.name)){oe.warning(i("fileJob.duplicateFile",{name:L.name}));continue}const ae={id:`att-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,file:L,name:L.name,size:L.size,uploading:!1};K&&zt(L).then(te=>{E(be=>be.map(Y=>Y.id===ae.id?{...Y,imageDataUri:te}:Y))}).catch(()=>{E(te=>te.filter(be=>be.id!==ae.id)),oe.error(i("fileJob.uploadFailed",{name:L.name}))}),q.push(ae)}return q.length>=ct&&oe.warning(i("fileJob.maxAttachments",{n:ct})),q})},[i,zt]),Ws=a.useCallback(m=>{m.target.files&&m.target.files.length>0&&(_e(m.target.files),m.target.value="")},[_e]),Us=a.useCallback(()=>{var m;(m=w.current)==null||m.click()},[]),Gs=a.useCallback(m=>{E(f=>f.filter(M=>M.id!==m))},[]),Ks=a.useCallback(m=>{m.preventDefault(),C(!0)},[]),Zs=a.useCallback(m=>{m.preventDefault(),C(!1)},[]),Vs=a.useCallback(m=>{m.preventDefault(),C(!1),m.dataTransfer.files&&m.dataTransfer.files.length>0&&_e(m.dataTransfer.files)},[_e]),Tt=a.useCallback(async()=>{var f;if(p.length===0)return"";const m=[];for(const M of p){if(M.imageDataUri)continue;if(M.path){m.push(`<attachment path="${M.path}" />`);continue}if(!M.file)continue;E(L=>L.map(K=>K.id===M.id?{...K,uploading:!0,error:void 0}:K));const R=`${Fa}/${M.name}`,q=await xe.files.upload(M.file,R);if(q.success&&((f=q.data)!=null&&f.path)){const L=q.data.path.replace(/\\/g,"/");E(K=>K.map(ae=>ae.id===M.id?{...ae,uploading:!1,path:L}:ae)),m.push(`<attachment path="${L}" />`)}else E(L=>L.map(K=>K.id===M.id?{...K,uploading:!1,error:q.error||i("fileJob.uploadFailed")}:K)),oe.error(`${M.name}: ${q.error||i("fileJob.uploadFailed")}`)}return m.length>0?`${m.join(`
|
|
30
|
-
`)}
|
|
31
|
-
|
|
32
|
-
`:""},[p,i]),Qs=a.useCallback(m=>{const f=m.clipboardData.getData("text/plain");if(m.clipboardData.files&&m.clipboardData.files.length>0){m.preventDefault(),_e(m.clipboardData.files);return}if(!f||!Na(f))return;m.preventDefault();const{label:M}=Sa(f),R=b.current;if(!R)return;const q=R.selectionStart,L=R.selectionEnd,K=R.value,ae=K.slice(0,q)+M+K.slice(L);j(ae),requestAnimationFrame(()=>{R.selectionStart=R.selectionEnd=q+M.length})},[j,_e]),Je=a.useCallback(async()=>{const m=Ca(x);_a(Ea(m)),we.current=!1,B(!1),re();const f=m.trim(),M=p.length>0;if(!f&&!M)return;const R=m.trim();if(R.startsWith("/")&&!M){const te=er(R);if(te){const be=de.find(Y=>Y.name===te.command);if(be){const Y=X(be,te.args);Y!=null&&Y.message&&(Y.success?oe.success(Y.message):oe.error(Y.message)),j(""),E([]),Ee.current=new Set,Re(0);return}oe.error(i("slashCommands.unknownCommand",{cmd:`/${te.command}`}));return}}const q=Array.from(Ee.current).filter(te=>m.includes(`@${te}`));let L="";if(M){if(p.some(te=>te.uploading)){oe.warning(i("fileJob.stillUploading"));return}L=await Tt()}const K=(L+m).trim();if(!K&&!M)return;const ae=p.filter(te=>te.imageDataUri).map(te=>te.imageDataUri);s(K||L.trim(),q.length>0?q:void 0,ae.length>0?ae:void 0),j(""),E([]),Ee.current=new Set,Re(0)},[x,p,s,j,Tt,i,re,de,X]),Xs=a.useCallback(m=>{if(!m.nativeEvent.isComposing){if((m.key==="Backspace"||m.key==="Delete")&&!m.ctrlKey&&!m.metaKey&&!m.altKey&&!m.shiftKey){const f=b.current;if(f&&f.selectionStart===f.selectionEnd){const M=f.selectionStart,R=f.value;if(m.key==="Backspace"&&M>0){const q=Aa(R.slice(0,M));if(q){m.preventDefault(),j(R.slice(0,M-q.length)+R.slice(M)),rs(q),requestAnimationFrame(()=>{f.focus();const L=M-q.length;f.selectionStart=f.selectionEnd=L});return}}else if(m.key==="Delete"&&M<R.length){const q=Ma(R.slice(M));if(q){m.preventDefault(),j(R.slice(0,M)+R.slice(M+q.length)),rs(q),requestAnimationFrame(()=>{f.focus(),f.selectionStart=f.selectionEnd=M});return}}}}if(T&&H.length>0){if(m.key==="ArrowDown"){m.preventDefault(),ue(f=>(f+1)%H.length);return}if(m.key==="ArrowUp"){m.preventDefault(),ue(f=>(f-1+H.length)%H.length);return}if(m.key==="Enter"&&!m.shiftKey&&!m.ctrlKey&&!m.metaKey){const f=H[ie];f&&(m.preventDefault(),et(f));return}if(m.key==="Escape"){m.preventDefault(),Pe();return}}else if(T&&m.key==="Escape"){m.preventDefault(),Pe();return}if(S&&O.length>0){if(m.key==="ArrowDown"){m.preventDefault(),ne();return}if(m.key==="ArrowUp"){m.preventDefault(),pe();return}if(m.key==="Enter"&&!m.shiftKey&&!m.ctrlKey&&!m.metaKey){const f=O[Q];f&&(m.preventDefault(),tt(f));return}if(m.key==="Escape"){m.preventDefault(),re();return}}else if(S&&m.key==="Escape"){m.preventDefault(),re();return}if(m.key==="Escape"&&g){m.preventDefault(),k?o():l();return}if(m.key==="Enter"&&(m.ctrlKey||m.metaKey)){m.preventDefault(),Je();return}m.key==="Enter"&&!m.shiftKey&&(m.preventDefault(),Je())}},[g,k,Je,l,o,T,H,ie,et,Pe,S,O,Q,ne,pe,tt,re,j]),Ys=a.useCallback(()=>{y.current=!0},[]),en=a.useCallback(()=>{y.current=!1},[]),It=Xe>8e3,tn=x.trim().length>0||p.length>0;return e.jsxs("div",{className:"chat-composer-shell shrink-0 px-3 pb-3 pt-2 sm:px-4",onDragOver:Ks,onDragLeave:Zs,onDrop:Vs,children:[p.length>0&&e.jsx("div",{className:"mb-2 flex flex-wrap gap-1.5",children:p.map(m=>{const f=qa(m.name);return e.jsxs("div",{className:le("flex items-center gap-1.5 rounded-lg border px-2 py-1 text-xs transition-colors",m.error?"border-accent-red/40 bg-accent-red/5 text-accent-red":m.uploading?"border-accent-blue/40 bg-accent-blue/5 text-accent-blue":"border-dark-border bg-dark-surface text-dark-text"),children:[m.imageDataUri?e.jsx("img",{src:m.imageDataUri,alt:m.name,className:"h-6 w-6 rounded object-cover",title:i("fileJob.imagePreview")}):m.uploading?e.jsx(Te,{size:13,className:"animate-spin"}):e.jsx(f,{size:13}),e.jsx("span",{className:"max-w-[140px] truncate",children:m.name}),e.jsx("span",{className:"text-[10px] text-dark-muted",children:m.size>1024*1024?`${(m.size/1024/1024).toFixed(1)} MB`:`${Math.max(1,Math.round(m.size/1024))} KB`}),!m.uploading&&e.jsx("button",{onClick:()=>Gs(m.id),className:"rounded p-0.5 text-dark-muted hover:text-accent-red hover:bg-accent-red/10 transition-colors","aria-label":i("a11y.close"),children:e.jsx(Se,{size:11})})]},m.id)})}),F&&e.jsx("div",{className:"mb-2 rounded-xl border-2 border-dashed border-accent-blue/50 bg-accent-blue/5 py-3 text-center text-xs text-accent-blue",children:i("fileJob.dropHint")}),e.jsxs("div",{className:"chat-composer-card relative rounded-xl border transition-all duration-150",children:[T&&e.jsx("div",{onMouseDown:m=>m.preventDefault(),"aria-hidden":!T,children:e.jsx(ga,{isOpen:T,files:H,selectedIndex:ie,query:se,isSearching:qe,onSelect:et,onHover:ue,selectedCount:qs,onFinish:Pe})}),S&&e.jsx("div",{onMouseDown:m=>m.preventDefault(),"aria-hidden":!S,children:e.jsx($a,{isOpen:S,commands:O,selectedIndex:Q,filter:J,onSelect:tt,onHover:ee,containerRef:_})}),e.jsx("textarea",{ref:b,value:x,onChange:Hs,onKeyDown:Xs,onPaste:Qs,onBlur:()=>{T&&Pe(),re()},onCompositionStart:Ys,onCompositionEnd:en,placeholder:i(g?"chat.generatingPlaceholder":"chat.inputPlaceholder"),rows:1,disabled:g&&!k,"aria-label":"Message input",className:`w-full bg-transparent px-4 pt-3.5 pb-2 text-sm text-dark-text placeholder-dark-muted/60
|
|
33
|
-
resize-none focus:outline-none min-h-[44px] max-h-[40vh] leading-relaxed
|
|
34
|
-
disabled:opacity-50 disabled:cursor-not-allowed`}),e.jsxs("div",{className:"flex items-center gap-2 px-2.5 pb-2.5",children:[d&&e.jsx(ba,{workspaceDir:c,onSelect:d}),e.jsx(ua,{}),e.jsx("span",{className:"hidden sm:block",children:e.jsx(xa,{})}),e.jsx("div",{className:"flex-1"}),Xe>0&&x.length>0&&e.jsxs("span",{className:`text-[10px] tabular-nums ${It?"text-accent-red font-medium":"text-dark-muted/60"}`,children:["~",Xe," tokens",It?` · ${i("chat.nearLimit")}`:""]}),!g&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:A,disabled:I.state!=="idle",className:`flex h-8 items-center justify-center rounded-full px-2 text-[11px] font-semibold text-dark-muted transition-colors
|
|
35
|
-
hover:bg-dark-hover hover:text-dark-text disabled:opacity-40`,title:i("stt.langToggle"),"aria-label":i("stt.langToggle"),children:N==="en"?"EN":i("stt.langZh")}),e.jsx("button",{onClick:()=>void V(),disabled:I.state==="transcribing",className:le("flex h-8 w-8 items-center justify-center rounded-full text-dark-muted transition-colors",I.state==="recording"?"bg-accent-red/15 text-accent-red animate-pulse":"hover:bg-dark-hover hover:text-dark-text","disabled:opacity-40 disabled:cursor-not-allowed"),title:I.state==="recording"?i("stt.stopTitle"):i("stt.title"),"aria-label":I.state==="recording"?i("stt.stopTitle"):i("stt.title"),children:I.state==="transcribing"?e.jsx(Te,{size:15,className:"animate-spin","aria-hidden":"true"}):I.state==="recording"?e.jsx(jn,{size:15,"aria-hidden":"true"}):e.jsx(Nn,{size:15,"aria-hidden":"true"})}),I.state==="recording"&&e.jsxs("span",{className:"text-[10px] tabular-nums text-accent-red","aria-hidden":"true",children:[(I.elapsedMs/1e3).toFixed(0),"s"]})]}),!g&&e.jsx("button",{onClick:()=>D(!0),className:"flex h-8 w-8 items-center justify-center rounded-full text-dark-muted transition-colors hover:bg-dark-hover hover:text-dark-text",title:i("skills.pickTitle"),"aria-label":i("skills.pickTitle"),children:e.jsx(Sn,{size:15,"aria-hidden":"true"})}),!g&&e.jsx("button",{onClick:()=>void Us(),className:"flex h-8 w-8 items-center justify-center rounded-full text-dark-muted transition-colors hover:bg-dark-hover hover:text-dark-text",title:i("fileJob.attach"),"aria-label":i("fileJob.attach"),children:e.jsx(Cn,{size:15,"aria-hidden":"true"})}),e.jsx("input",{ref:w,type:"file",multiple:!0,accept:Ba,className:"hidden",onChange:Ws}),g?e.jsxs("div",{className:"flex items-center gap-1.5",children:[k?e.jsx("button",{onClick:o,className:"flex h-8 w-8 items-center justify-center rounded-full bg-accent-green text-white transition-all hover:opacity-85 active:scale-95",title:i("chat.resumeGen"),"aria-label":i("chat.resumeGen"),children:e.jsx(En,{size:14,"aria-hidden":"true"})}):e.jsx("button",{onClick:l,className:"flex h-8 w-8 items-center justify-center rounded-full bg-accent-yellow text-white transition-all hover:opacity-85 active:scale-95",title:i("chat.pauseGen"),"aria-label":i("chat.pauseGen"),children:e.jsx(ps,{size:14,"aria-hidden":"true"})}),e.jsx("button",{onClick:n,className:"flex h-8 w-8 items-center justify-center rounded-full bg-accent-red text-white transition-all hover:opacity-85 active:scale-95",title:i("chat.stopGen"),"aria-label":i("chat.stopGen"),children:e.jsx(_n,{size:13,"aria-hidden":"true"})})]}):e.jsx("button",{onClick:()=>void Je(),disabled:!tn,className:`flex h-8 w-8 items-center justify-center rounded-full bg-dark-text text-dark-bg transition-all
|
|
36
|
-
hover:opacity-80 active:scale-95 disabled:opacity-25 disabled:cursor-not-allowed`,title:i("chat.sendBtn"),"aria-label":i("chat.sendBtn"),children:e.jsx(hs,{size:15,"aria-hidden":"true"})})]})]}),e.jsxs("div",{className:"mt-1.5 hidden select-none items-center justify-center gap-3 text-[10px] text-dark-muted/55 sm:flex",children:[e.jsx("span",{children:i("chat.shiftEnter")}),e.jsx("span",{"aria-hidden":"true",children:"·"}),e.jsx("span",{children:i("chat.escHint")})]}),e.jsx(ka,{open:z,onClose:()=>D(!1),onSelect:Js})]})}),Ua=15e3,Ga=300;function Os(r){const{t}=G();return a.useMemo(()=>{const s=t("chat.askOtherLabel"),n=t("chat.askProceedLabel"),l=r.options||[],o=l.some(x=>x.label===s),u=l.some(x=>x.label===n),c=[...l];u||c.push({label:n,description:t("chat.askProceedDesc")}),o||c.push({label:s,description:t("chat.askCustomDesc")});const d=o?c.findIndex(x=>x.label===s):c.length-1,i=u?c.findIndex(x=>x.label===n):c.length-(o?1:2);return{allItems:c,otherIdx:d,proceedIdx:i,displayItems:c}},[r,t])}function ls({item:r,answered:t,selectedIdx:s,multiSelected:n,customInput:l,showCustomInput:o,onSelect:u,onToggleMulti:c,onProceed:d,onEnterCustom:i,onCancelCustom:x,onSubmitCustom:h,onCustomChange:g,inputRef:k}){const{t:b}=G(),{otherIdx:w,proceedIdx:y,displayItems:p}=Os(r),E=!!r.multiSelect,F=C=>{if(C===y){d();return}if(C===w){i();return}if(E){c(C);return}u(C)};return e.jsxs("div",{className:"flex flex-col gap-2 max-h-64 overflow-y-auto",children:[p.map((C,z)=>{const D=s===z,j=n.has(z),N=z===w;return e.jsxs("div",{children:[e.jsxs("button",{type:"button",className:`w-full text-left px-3 py-2 rounded-md text-sm transition-colors ${D?"bg-blue-50 dark:bg-blue-900/20 border border-blue-300 dark:border-blue-700":"bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 hover:bg-gray-100 dark:hover:bg-gray-750"}`,onClick:()=>F(z),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[E&&e.jsx("span",{className:`w-4 h-4 rounded border flex items-center justify-center text-[10px] ${j?"bg-blue-600 border-blue-600 text-white":"border-gray-400 dark:border-gray-500"}`,children:j&&e.jsx(je,{size:10})}),e.jsxs("span",{className:`font-medium ${D?"text-blue-700 dark:text-blue-300":"text-gray-800 dark:text-gray-200"}`,children:[E?"":`${z+1}. `,C.label]}),z===y&&e.jsx("span",{className:"text-xs text-emerald-600 dark:text-emerald-400",children:b("chat.askDirectTag")}),N&&e.jsx("span",{className:"text-xs text-gray-400",children:b("chat.askCustomTag")})]}),C.description&&e.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mt-0.5 ml-6",children:C.description})]}),N&&D&&o&&e.jsxs("div",{className:"mt-2 ml-4",children:[e.jsx("textarea",{ref:k,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500 resize-none",rows:3,value:l,onChange:P=>g(P.target.value),onKeyDown:P=>{P.key==="Enter"&&!P.shiftKey&&(P.preventDefault(),h()),P.key==="Escape"&&x()},placeholder:b("chat.askAnswerPlaceholder"),autoFocus:!0}),e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 px-3 py-1 text-xs font-medium text-white bg-blue-600 rounded-md hover:bg-blue-700",onClick:h,children:[e.jsx(Me,{size:12}),b("chat.askSubmit")]}),e.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 px-3 py-1 text-xs font-medium text-gray-600 dark:text-gray-400 bg-gray-100 dark:bg-gray-700 rounded-md hover:bg-gray-200 dark:hover:bg-gray-600",onClick:x,children:[e.jsx(Se,{size:12}),b("common.cancel")]})]})]})]},`opt-${z}`)}),t&&e.jsx("div",{className:"text-xs text-emerald-600 dark:text-emerald-400 font-medium",children:b("chat.askAnswered")})]})}function Ka({isOpen:r,onClose:t}){const{t:s}=G(),[n,l]=a.useState(null),[o,u]=a.useState(-1),[c,d]=a.useState(new Set),[i,x]=a.useState(""),[h,g]=a.useState(!1),[k,b]=a.useState(!1),[w,y]=a.useState(0),[p,E]=a.useState([]),[F,C]=a.useState(!1),z=a.useRef(null),D=a.useRef(null),j=a.useMemo(()=>n?n.questions&&n.questions.length>0?n.questions:[{question:n.question,header:n.header,options:n.options,multiSelect:n.multiSelect}]:[],[n]),N=j.length>1,P=a.useCallback(_=>{l(_),u(_.multiSelect?-1:0),d(new Set),x(""),g(!1),b(!1),y(0),C(!1);const T=_.questions&&_.questions.length>0?_.questions:[_];E(T.map(()=>null))},[]);a.useEffect(()=>{D.current=n}),a.useEffect(()=>{if(r){const _=window.__pendingQuestion;_&&P(_)}},[r,P]),a.useEffect(()=>{const _=T=>{var H;const B=T.detail,se=((H=D.current)==null?void 0:H.questionId)??null;if(B&&se&&B!==se)return;const v=se;b(!0),setTimeout(()=>{var ie;const $=((ie=D.current)==null?void 0:ie.questionId)??null;v&&$&&$!==v||(t(),l(null),b(!1))},Ga)};return window.addEventListener("ask-question-dismiss",_),()=>window.removeEventListener("ask-question-dismiss",_)},[t]),a.useEffect(()=>{if(!k)return;const _=setTimeout(()=>b(!1),Ua);return()=>clearTimeout(_)},[k]),a.useEffect(()=>{const _=()=>{const T=window.__pendingQuestion;T&&P(T)};return window.addEventListener("ask-question-required",_),()=>window.removeEventListener("ask-question-required",_)},[P]),a.useEffect(()=>{u(0),d(new Set),x(""),g(!1)},[w,F,n]);const A=j[w]||null,{allItems:I,otherIdx:W}=Os(A||{question:""}),U=a.useCallback((_,T)=>{k||!n||(b(!0),ce.send({type:"question_answer",sessionId:ce.getSessionId()??void 0,data:JSON.stringify({questionId:n.questionId,answer:_,selectedOptions:T})}))},[k,n]),Z=a.useCallback(()=>{k||!n||(b(!0),ce.send({type:"question_answer",sessionId:ce.getSessionId()??void 0,data:JSON.stringify({questionId:n.questionId,answers:j.map((_,T)=>p[T]||{answer:s("chat.askUnansweredValue")})})}))},[k,n,j,p,s]),V=a.useCallback((_,T,B)=>{E(se=>{const v=se.slice();return v[_]={answer:T,selectedOptions:B},v}),_<j.length-1?y(_+1):C(!0)},[j.length]),me=a.useCallback(_=>{if(k||!n)return;const T=I[_];T&&(u(_),U(T.label,[T.label]))},[k,n,I,U]),S=a.useCallback(()=>{if(k||!n||o<0)return;const _=I[o];_&&U(_.label,[_.label])},[k,n,o,I,U]),J=a.useCallback(()=>{if(k||o<0)return;const _=I[o];_&&V(w,_.label,[_.label])},[k,o,I,V,w]),O=a.useCallback(_=>{if(k)return;const T=I[_];T&&V(w,T.label,[T.label])},[k,I,V,w]),Q=a.useCallback(_=>{k||d(T=>{const B=new Set(T);return B.has(_)?B.delete(_):B.add(_),B})},[k]),ee=a.useCallback(()=>{if(k)return;const _=[...c].map(T=>{var B;return((B=I[T])==null?void 0:B.label)||""});N?V(w,_.join(", "),_):U(_.join(", "),_)},[k,c,I,N,V,w,U]),ne=a.useCallback(()=>{if(k)return;const _=s("chat.askProceedLabel");N?V(w,_,[_]):U(_,[_])},[k,N,V,w,U,s]),pe=a.useCallback(()=>{k||(u(W),g(!0),setTimeout(()=>{var _;return(_=z.current)==null?void 0:_.focus()},100))},[k,W]),X=a.useCallback(()=>{g(!1),x("")},[]),he=a.useCallback(()=>{if(k)return;const _=i||s("chat.askEmptyInputValue");N?V(w,_):U(_)},[k,i,N,V,w,U,s]),re=a.useCallback(()=>{k||!n||(b(!0),ce.send({type:"question_answer",sessionId:ce.getSessionId()??void 0,data:JSON.stringify({questionId:n.questionId,answers:j.map(()=>({answer:"(cancelled)"}))})}))},[k,n,j]),ye=a.useCallback(()=>{if(!k){if(N){if(h){g(!1),x("");return}if(F){C(!1),y(j.length-1);return}re();return}if(h){g(!1),x("");return}U("(cancelled)")}},[k,N,h,F,j.length,re,U]);if(!r||!n)return null;const de=p.filter(_=>!_).length;return e.jsx(ys,{isOpen:r,onClose:ye,title:n.header||s(N?"chat.askBatchTitle":"chat.askSingleTitle"),badge:e.jsxs("span",{className:"flex items-center gap-1 text-[11px] text-accent-blue shrink-0",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-accent-blue animate-pulse"}),s("chat.askPendingBadge"),N?` · ${p.filter(Boolean).length}/${j.length}`:""]}),collapsedSummary:e.jsx("span",{className:"truncate",children:(A==null?void 0:A.question)||n.question}),maxHeight:"50vh",children:N?e.jsxs("div",{className:"flex flex-col gap-4",children:[n.autoResolutionMs&&n.autoResolutionMs>0&&e.jsx("div",{className:"flex items-center gap-2 text-xs text-amber-600 dark:text-amber-400 bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-700 rounded-md px-3 py-1.5",children:s("chat.askAutoContinue",{seconds:Math.max(1,Math.round(n.autoResolutionMs/1e3))})}),e.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[j.map((_,T)=>{const B=!!p[T],se=!F&&w===T;return e.jsxs("button",{type:"button",onClick:()=>{y(T),C(!1)},className:`px-2 py-1 rounded-md text-xs font-medium transition-colors ${se?"bg-blue-600 text-white":B?"bg-emerald-50 dark:bg-emerald-900/20 text-emerald-700 dark:text-emerald-300":"bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400"}`,children:["Q",T+1," ",B?"✓":""]},`nav-${T}`)}),e.jsx("button",{type:"button",onClick:()=>C(!0),className:`px-2 py-1 rounded-md text-xs font-medium transition-colors ${F?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400"}`,children:s("chat.askSubmit")})]}),F?e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx("div",{className:"text-sm font-medium text-gray-800 dark:text-gray-200",children:s("chat.askReviewTitle")}),j.map((_,T)=>{const B=p[T];return e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"text-sm text-gray-700 dark:text-gray-300 leading-relaxed min-w-0",children:[e.jsxs("span",{className:"font-medium",children:[T+1,". "]}),_.question]}),e.jsx("div",{className:`text-xs shrink-0 max-w-[45%] text-right break-words ${B?"text-emerald-600 dark:text-emerald-400":"text-amber-600 dark:text-amber-400"}`,children:B?B.answer:s("chat.askNotAnswered")})]},`rev-${T}`)}),de>0&&e.jsxs("div",{className:"flex items-center gap-2 text-xs text-amber-600 dark:text-amber-400 bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-700 rounded-md px-3 py-2",children:[e.jsx(Ne,{size:14}),s("chat.askUnansweredWarning",{count:de})]}),e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 px-4 py-2 text-sm font-medium text-white bg-blue-600 rounded-md hover:bg-blue-700 disabled:opacity-50",onClick:Z,disabled:k,children:[e.jsx(Me,{size:14}),s("chat.askSubmitAll")]}),e.jsx("button",{type:"button",className:"inline-flex items-center gap-1 px-4 py-2 text-sm font-medium text-gray-600 dark:text-gray-400 bg-gray-100 dark:bg-gray-700 rounded-md hover:bg-gray-200 dark:hover:bg-gray-600",onClick:()=>{C(!1),y(j.length-1)},disabled:k,children:s("chat.askBackToEdit")})]})]}):A?e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("div",{className:"text-sm text-gray-700 dark:text-gray-300 leading-relaxed min-w-0",children:A.question}),e.jsxs("div",{className:"flex gap-1 shrink-0",children:[e.jsxs("button",{type:"button",className:"inline-flex items-center gap-0.5 px-2 py-1 text-xs text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-800 rounded-md hover:bg-gray-200 dark:hover:bg-gray-700 disabled:opacity-40",onClick:()=>{y(_=>Math.max(0,_-1)),C(!1)},disabled:w===0,children:[e.jsx(Mn,{size:12}),s("chat.askPrevQuestion")]}),w<j.length-1?e.jsxs("button",{type:"button",className:"inline-flex items-center gap-0.5 px-2 py-1 text-xs text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-800 rounded-md hover:bg-gray-200 dark:hover:bg-gray-700",onClick:()=>{y(_=>Math.min(j.length-1,_+1)),C(!1)},children:[s("chat.askNextQuestion"),e.jsx(ke,{size:12})]}):e.jsxs("button",{type:"button",className:"inline-flex items-center gap-0.5 px-2 py-1 text-xs font-medium text-blue-700 dark:text-blue-300 bg-blue-50 dark:bg-blue-900/20 rounded-md hover:bg-blue-100 dark:hover:bg-blue-900/30",onClick:()=>C(!0),children:[s("chat.askViewSubmit"),e.jsx(ke,{size:12})]})]})]}),e.jsx(ls,{item:A,answered:!!p[w],selectedIdx:o,multiSelected:c,customInput:i,showCustomInput:h,onSelect:O,onToggleMulti:Q,onProceed:ne,onEnterCustom:pe,onCancelCustom:X,onSubmitCustom:he,onCustomChange:x,inputRef:z}),!h&&e.jsx("div",{className:"flex items-center gap-2",children:A.multiSelect?e.jsxs("button",{type:"button",className:"inline-flex items-center gap-1.5 px-4 py-2 text-sm font-medium text-white bg-blue-600 rounded-md hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed",onClick:ee,disabled:k||c.size===0,children:[e.jsx(Me,{size:14}),s("chat.askFinishQuestion",{count:c.size})]}):e.jsxs("button",{type:"button",className:"inline-flex items-center gap-1.5 px-4 py-2 text-sm font-medium text-white bg-blue-600 rounded-md hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed",onClick:J,disabled:k||o<0,children:[e.jsx(Me,{size:14}),s("chat.askConfirmQuestion")]})}),e.jsx("div",{className:"text-xs text-gray-400 dark:text-gray-500",children:h?e.jsx("span",{children:s("chat.askEnterHint")}):A.multiSelect?e.jsx("span",{children:s("chat.askMultiHintBatch")}):e.jsx("span",{children:s("chat.askSingleHintBatch")})})]}):null]}):e.jsxs("div",{className:"flex flex-col gap-4",children:[n.autoResolutionMs&&n.autoResolutionMs>0&&e.jsx("div",{className:"flex items-center gap-2 text-xs text-amber-600 dark:text-amber-400 bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-700 rounded-md px-3 py-1.5",children:s("chat.askAutoContinue",{seconds:Math.max(1,Math.round(n.autoResolutionMs/1e3))})}),e.jsx("div",{className:"text-sm text-gray-700 dark:text-gray-300 leading-relaxed",children:n.question}),e.jsx(ls,{item:j[0],answered:!1,selectedIdx:o,multiSelected:c,customInput:i,showCustomInput:h,onSelect:me,onToggleMulti:Q,onProceed:ne,onEnterCustom:pe,onCancelCustom:X,onSubmitCustom:he,onCustomChange:x,inputRef:z}),!h&&e.jsx("div",{className:"flex items-center gap-2",children:n.multiSelect?e.jsxs("button",{type:"button",className:"inline-flex items-center gap-1.5 px-4 py-2 text-sm font-medium text-white bg-blue-600 rounded-md hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed",onClick:ee,disabled:k||c.size===0,children:[e.jsx(Me,{size:14}),s("chat.askSubmitSelected",{count:c.size})]}):e.jsxs("button",{type:"button",className:"inline-flex items-center gap-1.5 px-4 py-2 text-sm font-medium text-white bg-blue-600 rounded-md hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed",onClick:S,disabled:k||o<0,children:[e.jsx(Me,{size:14}),s("chat.askSubmit")]})}),e.jsx("div",{className:"text-xs text-gray-400 dark:text-gray-500",children:k?e.jsx("span",{children:s("chat.askSubmitting")}):h?e.jsx("span",{children:s("chat.askEnterHint")}):n.multiSelect?e.jsx("span",{children:s("chat.askMultiHintSingle")}):e.jsx("span",{children:s("chat.askSingleHintSingle")})})]})})}const De=15;function Za({isOpen:r,onCloseModal:t}){const{t:s}=G("hook"),n=bt(),l=n.pendingApprovals,o=n.autoMode,u=n.setAutoMode,[c,d]=a.useState(0),[i,x]=a.useState(!1),[h,g]=a.useState(De),[k,b]=a.useState(!0),w=a.useRef(null),y=a.useRef(!1);a.useEffect(()=>{if(l.length!==0){if(o){l.forEach(T=>{ce.send({type:"hook_allow",data:JSON.stringify({approvalId:T.approvalId})})}),n.clearApprovals();return}d(T=>Math.min(T,l.length-1))}},[l.length,o]);const p=l[c]??null,E=l.length>0&&p!==null,F=l.length,C=E?F-c-1:0;a.useEffect(()=>{if(!(!E||i||!r||!p))return g(De),w.current=setInterval(()=>{g(T=>T<=1?(w.current&&clearInterval(w.current),0):T-1)},1e3),()=>{w.current&&clearInterval(w.current)}},[E,i,r,p==null?void 0:p.approvalId]);const z=p?gs(p.toolName,p.askPayload):{level:"MEDIUM",reasonKey:"risk_default"},D=ks[z.level],j=tr[z.level==="CRITICAL"?"critical":z.level==="HIGH"?"high":z.level==="LOW"?"low":"medium"],N=p?Is(p.toolName,p.askPayload):null,P=p?sr(p.toolName,p.askPayload):null,A=p?{verb:zs(p.toolName),target:Ts(p.toolName,p.askPayload)}:null,I=p?Oe(p.askPayload)!==null:!1,W=p?Rs(p.toolName,p.askPayload):null,U=h/De*100,Z=h<=5,V=rr(De-h),me=a.useCallback((T,B)=>{const se=nr.getState().activeSessionId;se&&fe.getState().updateHookApprovalStatus(se,T,B)},[]),S=a.useCallback(T=>{p&&(T&&me(p.approvalId,T),x(!0),setTimeout(()=>{n.removeApproval(p.approvalId),d(0),x(!1),y.current=!1,g(De)},200))},[p==null?void 0:p.approvalId,n,me]),J=a.useCallback(()=>{!p||i||y.current||(y.current=!0,w.current&&clearInterval(w.current),ce.send({type:"hook_allow",data:JSON.stringify({approvalId:p.approvalId})}),S("approved"))},[p,S,i]),O=a.useCallback(()=>{!p||i||y.current||(y.current=!0,w.current&&clearInterval(w.current),ce.send({type:"hook_deny",data:JSON.stringify({approvalId:p.approvalId})}),S("denied"))},[p,S,i]),Q=a.useCallback(()=>{if(!p||i||y.current)return;y.current=!0,w.current&&clearInterval(w.current);const T=Oe(p.askPayload);T?(n.addToSessionAllowList(p.toolName,T),ce.send({type:"hook_allow",data:JSON.stringify({approvalId:p.approvalId,sessionAllow:!0})})):(n.addToSessionAllowList(p.toolName),ce.send({type:"hook_allow",data:JSON.stringify({approvalId:p.approvalId})})),S("approved")},[p,S,n,i]),ee=a.useCallback(()=>{!p||i||y.current||(y.current=!0,w.current&&clearInterval(w.current),u(!0),ve.getState().setAuto(!0),ce.send({type:"hook_allow",data:JSON.stringify({approvalId:p.approvalId})}),S("approved"))},[p,S,i,u]),ne=((p==null?void 0:p.timeoutMs)??15e3)>0,pe=(p==null?void 0:p.timeoutAction)==="deny"?O:J;if(a.useEffect(()=>{h===0&&r&&!i&&p&&ne&&pe()},[h,r,i,p,pe,ne]),a.useEffect(()=>{if(!r||!k)return;const T=B=>{const se=B.target;se&&typeof se.closest=="function"&&se.closest('input, textarea, select, [contenteditable="true"]')||(B.key==="Escape"?(B.preventDefault(),B.stopPropagation(),O()):B.key==="Enter"?(B.preventDefault(),J()):B.key==="1"?J():B.key==="2"?O():B.key==="3"?Q():B.key==="4"&&ee())};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[r,k,J,O,Q,ee]),!E||!p)return null;const X=s("optionAllowHint"),he=s("optionDenyHint"),re=I?s("optionAllowPathHint"):s("optionAllowAlwaysHint",{tool:p.toolName}),ye=s("optionAutoModeHint"),de=(N==null?void 0:N.text)??P??null,_=de?e.jsxs("span",{className:"flex items-center gap-1.5 min-w-0",children:[e.jsx("code",{className:"font-mono text-[11px] bg-dark-surface text-accent-blue px-1 py-0.5 rounded shrink-0",children:p.toolName}),e.jsx("span",{className:"truncate",children:de})]}):null;return e.jsx(ys,{isOpen:r,onClose:()=>t==null?void 0:t(),title:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(pt,{className:"w-4 h-4 text-yellow-400"}),e.jsx("span",{children:s("hookApproval")}),e.jsxs("span",{className:"text-xs text-dark-muted",children:["(",c+1,"/",F,")"]})]}),badge:e.jsxs("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-bold border shrink-0 ${D.badge}`,children:[D.icon," ",z.level]}),collapsedSummary:_,onExpandedChange:b,maxHeight:"50vh",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:`flex items-center gap-2 px-3 py-2 rounded-lg ${D.bg} border ${D.border}`,children:[e.jsxs("span",{className:`px-1.5 py-0.5 rounded text-xs font-bold border ${D.badge}`,children:[D.icon," ",z.level]}),e.jsx("span",{className:"text-xs text-dark-muted truncate",children:s(z.reasonKey)}),e.jsxs("div",{className:"flex items-center gap-1.5 ml-auto shrink-0",children:[e.jsx(ze,{size:12,className:Z?"text-accent-red":"text-dark-muted"}),e.jsx("span",{className:`text-xs font-mono ${Z?"text-accent-red animate-pulse":"text-dark-muted"}`,children:ne?`${h}s`:"∞"}),e.jsx("div",{className:"w-12 h-1.5 bg-dark-border rounded-full overflow-hidden",children:e.jsx("div",{className:`h-full rounded-full transition-all duration-700 ${Z?"bg-accent-red":h<=8?"bg-accent-yellow":"bg-accent-green"}`,style:{width:`${U}%`}})})]})]}),e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[e.jsx("span",{className:"flex-none w-7 h-7 rounded-lg bg-accent-blue/10 text-accent-blue inline-flex items-center justify-center",children:e.jsx(pt,{size:15})}),A&&e.jsx($s,{pre:s(A.verb),obj:A.target})]}),W&&(W.external&&W.path?e.jsxs("span",{className:"flex items-center gap-1 text-[11px] px-1.5 py-0.5 rounded bg-amber-500/10 text-amber-400 border border-amber-500/30 shrink-0",title:W.path,children:[e.jsx(us,{size:10}),s("scopeExternal"),": ",W.path.length>48?`${W.path.slice(0,47)}…`:W.path]}):e.jsx("span",{className:"text-[11px] text-dark-muted/60 shrink-0",children:s("scopeLocal")}))]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"text-dark-muted shrink-0",children:s("tool")}),e.jsx("code",{className:"text-accent-blue font-mono text-xs bg-dark-surface px-1.5 py-0.5 rounded truncate",children:p.toolName}),e.jsx("span",{className:"text-dark-muted/50",children:V}),e.jsx("span",{className:"text-dark-muted/50",children:j.label}),p.timeoutAction&&e.jsxs("span",{className:`text-xs ${p.timeoutAction==="deny"?"text-accent-red":"text-accent-green"}`,children:["timeout: ",ne?`${p.timeoutAction==="allow"?"auto-allow":"auto-deny"}${p.timeoutMs?` (${(p.timeoutMs/1e3).toFixed(0)}s)`:""}`:s("timeoutWaitUser")]})]}),N?e.jsx(kt,{text:N.text,mono:N.mono}):P?e.jsx(kt,{text:P}):null,(z.level==="CRITICAL"||z.level==="HIGH")&&e.jsxs("div",{className:`flex items-center gap-1.5 text-xs px-2 py-1.5 rounded ${D.bg} ${D.text}`,children:[e.jsx(Ne,{size:13}),e.jsx("span",{children:z.level==="CRITICAL"?s("highRiskWarning"):s("mediumRiskConfirm")})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("button",{onClick:J,disabled:i,className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-accent-blue text-white text-sm font-medium hover:opacity-90 shadow-sm transition-all disabled:opacity-50",children:[e.jsx("span",{className:"text-[10px] font-mono bg-white/20 rounded px-1",children:"1"}),e.jsx("span",{children:We.allow.label}),e.jsx("span",{className:"text-[11px] text-white/70 hidden sm:inline",children:X})]}),e.jsxs("button",{onClick:Q,disabled:i,className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-dark-border bg-dark-bg text-dark-text hover:bg-dark-hover text-sm transition-colors disabled:opacity-50",children:[e.jsx("span",{className:"text-[10px] font-mono text-dark-muted bg-dark-surface rounded px-1",children:"3"}),e.jsx("span",{children:We.allow_session.label}),e.jsx("span",{className:"text-[11px] text-dark-muted/60 hidden sm:inline",children:re})]}),e.jsxs("button",{onClick:ee,disabled:i,className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-dark-border bg-dark-bg text-dark-text hover:bg-dark-hover text-sm transition-colors disabled:opacity-50",children:[e.jsx("span",{className:"text-[10px] font-mono text-dark-muted bg-dark-surface rounded px-1",children:"4"}),e.jsx("span",{children:We.auto.label}),e.jsx("span",{className:"text-[11px] text-dark-muted/60 hidden sm:inline",children:ye})]}),e.jsx("span",{className:"flex-1"}),e.jsxs("button",{onClick:O,disabled:i,className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-dark-muted hover:bg-red-500/10 hover:text-red-400 text-sm transition-colors disabled:opacity-50",children:[e.jsx("span",{className:"text-[10px] font-mono text-dark-muted/60 rounded px-1",children:"2"}),e.jsx("span",{children:We.deny.label}),e.jsx("span",{className:"text-[11px] text-dark-muted/60 hidden sm:inline",children:he})]})]}),e.jsxs("div",{className:"flex items-center justify-between text-xs text-dark-muted/60",children:[e.jsx("span",{children:s("shortcutHint")}),e.jsx("span",{children:C>0?s("morePending",{n:C}):s("lastItem")})]})]})})}const xt="dsc-auto-access-banner-dismissed",Va=a.memo(function(){const{t}=G(),s=ve(c=>c.mode),[n,l]=a.useState(()=>localStorage.getItem(xt)==="1");a.useEffect(()=>{gt(s==="normal"?"act":s)||localStorage.getItem(xt)==="1"&&l(!1)},[s]);const o=a.useCallback(c=>{c&&localStorage.setItem(xt,"1"),l(!0)},[]);return!(s!=="normal"&>(s))||n?null:e.jsxs("div",{className:"flex items-center gap-1.5 px-4 py-1 text-[10.5px] leading-snug text-accent-yellow/75 bg-accent-yellow/[0.05] border-b border-accent-yellow/10 select-none",role:"note",title:t("autoAccess.desc"),children:[e.jsx(zn,{size:11,className:"shrink-0 text-accent-yellow/70"}),e.jsxs("div",{className:"min-w-0 flex-1 truncate",children:[e.jsx("span",{className:"font-medium",children:t("autoAccess.title")}),e.jsxs("span",{className:"text-accent-yellow/60",children:[" · ",t("autoAccess.desc")]})]}),e.jsx("button",{onClick:()=>o(!1),className:"shrink-0 rounded p-0.5 text-accent-yellow/50 hover:text-accent-yellow hover:bg-accent-yellow/10 transition-colors",title:t("autoAccess.dismiss"),"aria-label":t("autoAccess.dismiss"),children:e.jsx(Se,{size:11})}),e.jsx("button",{onClick:()=>o(!0),className:"shrink-0 rounded px-1 py-px text-[9.5px] text-accent-yellow/50 hover:text-accent-yellow hover:bg-accent-yellow/10 transition-colors whitespace-nowrap",children:t("autoAccess.neverShow")})]})}),is=24,os=240,Qa={pending:{color:"text-gray-400",bg:"bg-gray-500/10",label:"Pending"},running:{color:"text-blue-400",bg:"bg-blue-500/10",label:"Running"},completed:{color:"text-green-400",bg:"bg-green-500/10",label:"Done"},failed:{color:"text-red-400",bg:"bg-red-500/10",label:"Failed"},skipped:{color:"text-gray-500",bg:"bg-gray-500/5",label:"Skipped"}},Xa=({status:r})=>r==="running"?e.jsx(Te,{size:12,className:"animate-spin text-accent-blue"}):r==="completed"?e.jsx(mt,{size:12,className:"text-accent-green"}):r==="failed"?e.jsx($n,{size:12,className:"text-accent-red"}):r==="skipped"?e.jsx(Pn,{size:12,className:"text-dark-muted"}):e.jsx(Dn,{size:12,className:"text-dark-muted"}),Ya=a.memo(function({sessionId:t,defaultExpanded:s,onClose:n}){const{t:l}=G(),[o,u]=a.useState(s??!1),[c,d]=a.useState(null),i=ws(A=>A.getTasksForSession(t)),[x,h]=a.useState(null),g=a.useRef(null),k=a.useRef(!1),b=a.useRef(null),w=a.useCallback(A=>{var I;A.button===0&&(A.target.closest("[data-taskboard-close]")||(k.current=!1,g.current={y:A.clientY,expanded:o,bodyHeight:((I=b.current)==null?void 0:I.offsetHeight)??0},A.currentTarget.setPointerCapture(A.pointerId)))},[o]),y=a.useCallback(A=>{const I=g.current;I&&(Math.abs(A.clientY-I.y)>4&&(k.current=!0),h(A.clientY-I.y))},[]),p=a.useCallback(A=>{const I=g.current;if(!I)return;const W=A.clientY-I.y;I.expanded&&W<-is?u(!1):!I.expanded&&W>is&&u(!0),g.current=null,h(null),setTimeout(()=>{k.current=!1},0)},[]),E=a.useCallback(()=>{if(k.current){k.current=!1;return}u(A=>!A)},[]),F=a.useCallback(A=>{(A.key==="Enter"||A.key===" ")&&(A.preventDefault(),u(I=>!I))},[]),C=x!==null,z=a.useMemo(()=>{const A=g.current;return x===null||!A?null:A.expanded?Math.min(os,Math.max(0,A.bodyHeight+x)):Math.min(os,Math.max(0,x))},[x]),D=a.useMemo(()=>{const A=i.length,I=i.filter(V=>V.status==="completed").length,W=i.filter(V=>V.status==="running").length,U=i.filter(V=>V.status==="failed").length,Z=A>0?Math.round(I/A*100):0;return{total:A,completed:I,running:W,failed:U,progress:Z}},[i]),j=a.useMemo(()=>{const A={pending:[],running:[],completed:[],failed:[]};return i.forEach(I=>{const W=I.status==="skipped"?"pending":I.status;A[W].push(I)}),A},[i]),N=[...j.running,...j.failed,...j.pending.slice(0,5),...j.completed.slice(-3)],P=o||C;return i.length===0?null:e.jsxs("div",{className:"w-full shrink-0 mb-2 border border-dark-border rounded-lg bg-dark-bg/70 overflow-hidden",children:[e.jsxs("div",{role:"button",tabIndex:0,"aria-expanded":o,onClick:E,onKeyDown:F,onPointerDown:w,onPointerMove:y,onPointerUp:p,onPointerCancel:p,onLostPointerCapture:p,className:"w-full flex items-center justify-between px-2.5 py-1.5 hover:bg-dark-hover transition-colors cursor-pointer select-none touch-none",title:l("chat.taskBoardDragHint"),children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(Tn,{size:14,className:"text-accent-blue shrink-0"}),e.jsx("span",{className:"text-xs font-medium text-dark-text",children:"Task Board"}),e.jsxs("span",{className:"text-[10px] text-dark-muted shrink-0",children:[D.completed,"/",D.total]}),D.total>0&&e.jsx("div",{className:"w-16 h-1.5 bg-dark-surface rounded-full overflow-hidden",children:e.jsx("div",{className:`h-full rounded-full transition-all duration-500 ${D.running>0?"bg-accent-blue":D.failed>0?"bg-accent-red":"bg-accent-green"}`,style:{width:`${D.progress}%`}})}),D.running>0&&e.jsx("span",{className:"w-1.5 h-1.5 bg-accent-blue rounded-full animate-pulse shrink-0"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[n&&e.jsx("span",{role:"button",tabIndex:0,"data-taskboard-close":!0,onClick:A=>{A.stopPropagation(),n()},onKeyDown:A=>{A.key==="Enter"&&(A.stopPropagation(),n())},className:"p-0.5 rounded hover:bg-dark-hover transition-colors cursor-pointer",title:"Hide task drawer",children:e.jsx(Se,{size:12,className:"text-dark-muted"})}),e.jsx(In,{size:12,className:"text-dark-muted/40 shrink-0","aria-hidden":"true"}),o?e.jsx(Rn,{size:14,className:"text-dark-muted"}):e.jsx(ge,{size:14,className:"text-dark-muted"})]})]}),P&&e.jsx("div",{ref:b,className:"border-t border-dark-border",style:z!==null?{height:z,overflow:"hidden"}:void 0,children:i.length===0?e.jsx("div",{className:"text-xs text-dark-muted py-4 text-center",children:l("chat.noTasks")}):e.jsxs("div",{className:"px-2.5 py-2 max-h-[240px] overflow-y-auto custom-scrollbar space-y-1.5",children:[N.map(A=>e.jsx(tl,{task:A,isSelected:A.id===c,onClick:()=>d(c===A.id?null:A.id)},A.id)),j.pending.length>5&&e.jsxs("div",{className:"text-[10px] text-dark-muted text-center",children:[j.pending.length-5," more pending tasks"]}),j.completed.length>3&&e.jsxs("div",{className:"text-[10px] text-dark-muted text-center",children:[j.completed.length-3," more completed tasks"]})]})})]})}),el=(r,t)=>{if(!r)return"";const s=(t||Date.now())-r;return s<1e3?`${s}ms`:`${(s/1e3).toFixed(1)}s`},tl=a.memo(function({task:t,isSelected:s,onClick:n}){const l=Qa[t.status];return e.jsxs("div",{onClick:n,className:`rounded border p-2 cursor-pointer transition-all ${l.bg} border-dark-border
|
|
37
|
-
${s?"ring-1 ring-accent-blue":"hover:border-dark-muted/40"}
|
|
38
|
-
${t.status==="running"?"border-l-2 border-l-accent-blue":"border-l-2 border-l-transparent"}`,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Xa,{status:t.status}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-xs text-dark-text truncate",children:t.title}),e.jsx("span",{className:`text-[10px] ${l.color} shrink-0`,children:l.label})]}),e.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-dark-muted",children:[e.jsx("span",{children:t.agentType||t.source}),t.startedAt&&e.jsx("span",{children:el(t.startedAt,t.completedAt)})]})]})]}),t.status==="running"&&t.progress!==void 0&&e.jsx("div",{className:"mt-1.5",children:e.jsx("div",{className:"w-full h-1 bg-dark-bg rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-accent-blue rounded-full transition-all duration-500",style:{width:`${t.progress}%`}})})}),s&&e.jsxs("div",{className:"mt-2 pt-2 border-t border-dark-border space-y-1",children:[t.description&&e.jsx("p",{className:"text-[10px] text-dark-muted",children:t.description}),t.error&&e.jsx("p",{className:"text-[10px] text-red-400",children:t.error}),t.result&&e.jsx("p",{className:"text-[10px] text-green-400",children:t.result}),t.dependencies&&t.dependencies.length>0&&e.jsxs("p",{className:"text-[10px] text-dark-muted",children:[t.dependencies.length," dependencies"]})]})]})}),ol=a.memo(function({tabs:t,activeSessionId:s,onSend:n,onStop:l,onPause:o,onResume:u,activeTab:c,setActiveTab:d,createNewSession:i,clearMessages:x,setTheme:h,setThemePreset:g,toggleTerminal:k,setLogs:b,setUnreadLogs:w,showTaskBoard:y=!0,onToggleTaskBoard:p,onRegenerate:E,onDeleteMessage:F,hookDrawerOpen:C,onCloseHookDrawer:z,questionDrawerOpen:D,onCloseQuestionDrawer:j,workspaceDir:N,onWorkspaceSelect:P}){const A=a.useMemo(()=>({setActiveTab:d,createNewSession:i,clearMessages:x,setTheme:h,setThemePreset:g,toggleTerminal:k,setLogs:b,setUnreadLogs:w}),[d,i,x,h,g,k,b,w]),I=fe(O=>s?O.messagesBySession[s]||[]:[]),W=fe(O=>s?O.generatingSessions.includes(s):!1),U=fe(O=>s?O.pausedSessions.includes(s):!1),Z=t.find(O=>O.id===s)||null;a.useEffect(()=>{if(!s)return;let O=!1;return xe.tasks.list(s).then(Q=>{if(O||!Q.success||!Array.isArray(Q.data))return;const ee={PENDING:"pending",RUNNING:"running",COMPLETED:"completed",FAILED:"failed",CANCELLED:"skipped"},ne=Date.now(),pe=Q.data.filter(X=>X.sessionId===s).map(X=>{const he=new Date(X.createdAt).getTime()||ne,re=new Date(X.updatedAt).getTime()||ne;return{id:X.id,sessionId:s,title:X.title,status:ee[X.status]||"pending",source:"task",description:X.description,progress:X.progress,createdAt:he,updatedAt:re,raw:X}});ws.getState().setTasks(s,pe,"task")}).catch(()=>{}),()=>{O=!0}},[s]);const V=a.useCallback((O,Q)=>{s&&n(s,O,Q)},[n,s]),me=a.useCallback(O=>{s&&n(s,O)},[n,s]),S=a.useCallback(O=>{s&&E&&E(s,O)},[E,s]),J=a.useCallback(O=>{s&&F&&F(s,O)},[F,s]);return e.jsx("div",{className:"flex-1 flex min-h-0",children:e.jsxs("div",{className:"flex-1 flex flex-col min-w-0 min-h-0",children:[e.jsx(Va,{}),Z&&e.jsxs(e.Fragment,{children:[e.jsx(ca,{messages:I,isGenerating:W,isPaused:U,sessionId:Z.id,onSendSuggestion:me,onRegenerate:E?S:void 0,onDeleteMessage:F?J:void 0}),e.jsx(Za,{isOpen:!!C,onCloseModal:z}),e.jsx(Ka,{isOpen:!!D,onClose:j??(()=>{})}),y&&e.jsx(Ya,{sessionId:Z.id,defaultExpanded:!1,onClose:p},Z.id),e.jsx(Wa,{sessionId:Z.id,onSend:V,onStop:()=>l(Z.id),onPause:()=>o(Z.id),onResume:()=>u(Z.id),slashOptions:A,workspaceDir:N,onWorkspaceSelect:P})]})]})})});export{ol as SessionGrid};
|