@prismshadow/penguin-server 0.0.1
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/LICENSE +201 -0
- package/README.md +45 -0
- package/dist/api/types.d.ts +958 -0
- package/dist/api/types.js +1 -0
- package/dist/api/types.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +6867 -0
- package/dist/index.js.map +1 -0
- package/package.json +59 -0
- package/web-dist/assets/abap-BdImnpbu.js +1 -0
- package/web-dist/assets/actionscript-3-CoDkCxhg.js +1 -0
- package/web-dist/assets/ada-bCR0ucgS.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-Dqspr-GT.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-Ve4PFQV2.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-BkioyH1T.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-BIv1doCn.js +1 -0
- package/web-dist/assets/blade-2xfisSek.js +1 -0
- package/web-dist/assets/bsl-BO_Y6i37.js +1 -0
- package/web-dist/assets/c-BIGW1oBm.js +1 -0
- package/web-dist/assets/c3-MRO5bC_T.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-DFWUc33u.js +1 -0
- package/web-dist/assets/catppuccin-latte-C9dUb6Cb.js +1 -0
- package/web-dist/assets/catppuccin-macchiato-DQyhUUbL.js +1 -0
- package/web-dist/assets/catppuccin-mocha-D87Tk5Gz.js +1 -0
- package/web-dist/assets/clarity-D53aC0YG.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-DkFqJrB1.js +1 -0
- package/web-dist/assets/cpp-UfJy6YNI.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-CXvaQtF9.js +1 -0
- package/web-dist/assets/erb-Dm6A9KJ5.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-BOOCDP_w.js +1 -0
- package/web-dist/assets/gdscript-C5YyOfLZ.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-DbPARsA_.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-CzTSHFRz.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-Bvhsp5Yf.js +1 -0
- package/web-dist/assets/hy-DFXneXwc.js +1 -0
- package/web-dist/assets/imba-DGztddWO.js +1 -0
- package/web-dist/assets/index-7oqK2MPp.js +153 -0
- package/web-dist/assets/index-DGY2Myoq.js +51 -0
- package/web-dist/assets/index-SaWO9NKB.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-D7OTSIA_.js +1 -0
- package/web-dist/assets/just-CUsbIsdP.js +1 -0
- package/web-dist/assets/kanagawa-dragon-CkXjmgJE.js +1 -0
- package/web-dist/assets/kanagawa-lotus-CfQXZHmo.js +1 -0
- package/web-dist/assets/kanagawa-wave-DWedfzmr.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-CaSxy8MP.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-DjAJT7YJ.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-KW6xsasC.js +1 -0
- package/web-dist/assets/make-CHLpvVh8.js +1 -0
- 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-DTYItulj.js +1 -0
- package/web-dist/assets/mdx-Cmh6b_Ma.js +1 -0
- package/web-dist/assets/mermaid-mWjccvbQ.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-rZm6bMo-.js +1 -0
- package/web-dist/assets/monokai-D4h5O-jR.js +1 -0
- package/web-dist/assets/moonbit-_H4v1dQx.js +1 -0
- package/web-dist/assets/move-IF9eRakj.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/nushell-Cz2AlsmD.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/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-Dpen1YoG.js +1 -0
- package/web-dist/assets/prisma-Dd19v3D-.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-Dspwwk_N.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/red-bN70gL4F.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-dawn-DHQR4-dF.js +1 -0
- package/web-dist/assets/rose-pine-moon-D4_iv3hh.js +1 -0
- package/web-dist/assets/rose-pine-qdsjHGoJ.js +1 -0
- package/web-dist/assets/rosmsg-BJDFO7_C.js +1 -0
- package/web-dist/assets/rst-CpCqk9r5.js +1 -0
- package/web-dist/assets/ruby-DyJCeAvU.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-C151Ov-r.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-BERRCDM3.js +1 -0
- package/web-dist/assets/snazzy-light-Bw305WKR.js +1 -0
- package/web-dist/assets/solarized-dark-DXbdFlpD.js +1 -0
- package/web-dist/assets/solarized-light-L9t79GZl.js +1 -0
- package/web-dist/assets/solidity-rGO070M0.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/stylus-BEDo0Tqx.js +1 -0
- package/web-dist/assets/surrealql-Bq5Q-fJD.js +1 -0
- package/web-dist/assets/svelte-Cy7k_4gC.js +1 -0
- package/web-dist/assets/swift-D82vCrfD.js +1 -0
- package/web-dist/assets/synthwave-84-CbfX1IO0.js +1 -0
- package/web-dist/assets/system-verilog-CnnmHF94.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-idrVyKtj.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-CW1WmMYd.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-DHCkPAjA.js +1 -0
- package/web-dist/assets/v-BcVCzyr7.js +1 -0
- package/web-dist/assets/vala-CsfeWuGM.js +1 -0
- package/web-dist/assets/vb-D17OF-Vu.js +1 -0
- package/web-dist/assets/verilog-BQ8w6xss.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-D2xRrEX4.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 +16 -0
- package/web-dist/penguin-logo.svg +1 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
(function(){const a=document.createElement("link").relList;if(a&&a.supports&&a.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))i(o);new MutationObserver(o=>{for(const c of o)if(c.type==="childList")for(const d of c.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&i(d)}).observe(document,{childList:!0,subtree:!0});function r(o){const c={};return o.integrity&&(c.integrity=o.integrity),o.referrerPolicy&&(c.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?c.credentials="include":o.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function i(o){if(o.ep)return;o.ep=!0;const c=r(o);fetch(o.href,c)}})();function s1(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Kd={exports:{}},Ii={};var sx;function V2(){if(sx)return Ii;sx=1;var e=Symbol.for("react.transitional.element"),a=Symbol.for("react.fragment");function r(i,o,c){var d=null;if(c!==void 0&&(d=""+c),o.key!==void 0&&(d=""+o.key),"key"in o){c={};for(var f in o)f!=="key"&&(c[f]=o[f])}else c=o;return o=c.ref,{$$typeof:e,type:i,key:d,ref:o!==void 0?o:null,props:c}}return Ii.Fragment=a,Ii.jsx=r,Ii.jsxs=r,Ii}var ox;function Y2(){return ox||(ox=1,Kd.exports=V2()),Kd.exports}var s=Y2(),Wd={exports:{}},De={};var ux;function G2(){if(ux)return De;ux=1;var e=Symbol.for("react.transitional.element"),a=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),d=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),b=Symbol.iterator;function w(z){return z===null||typeof z!="object"?null:(z=b&&z[b]||z["@@iterator"],typeof z=="function"?z:null)}var N={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},A=Object.assign,j={};function T(z,B,C){this.props=z,this.context=B,this.refs=j,this.updater=C||N}T.prototype.isReactComponent={},T.prototype.setState=function(z,B){if(typeof z!="object"&&typeof z!="function"&&z!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,z,B,"setState")},T.prototype.forceUpdate=function(z){this.updater.enqueueForceUpdate(this,z,"forceUpdate")};function I(){}I.prototype=T.prototype;function M(z,B,C){this.props=z,this.context=B,this.refs=j,this.updater=C||N}var _=M.prototype=new I;_.constructor=M,A(_,T.prototype),_.isPureReactComponent=!0;var $=Array.isArray;function U(){}var Y={H:null,A:null,T:null,S:null},W=Object.prototype.hasOwnProperty;function J(z,B,C){var G=C.ref;return{$$typeof:e,type:z,key:B,ref:G!==void 0?G:null,props:C}}function P(z,B){return J(z.type,B,z.props)}function K(z){return typeof z=="object"&&z!==null&&z.$$typeof===e}function D(z){var B={"=":"=0",":":"=2"};return"$"+z.replace(/[=:]/g,function(C){return B[C]})}var O=/\/+/g;function te(z,B){return typeof z=="object"&&z!==null&&z.key!=null?D(""+z.key):B.toString(36)}function F(z){switch(z.status){case"fulfilled":return z.value;case"rejected":throw z.reason;default:switch(typeof z.status=="string"?z.then(U,U):(z.status="pending",z.then(function(B){z.status==="pending"&&(z.status="fulfilled",z.value=B)},function(B){z.status==="pending"&&(z.status="rejected",z.reason=B)})),z.status){case"fulfilled":return z.value;case"rejected":throw z.reason}}throw z}function L(z,B,C,G,re){var ue=typeof z;(ue==="undefined"||ue==="boolean")&&(z=null);var ge=!1;if(z===null)ge=!0;else switch(ue){case"bigint":case"string":case"number":ge=!0;break;case"object":switch(z.$$typeof){case e:case a:ge=!0;break;case g:return ge=z._init,L(ge(z._payload),B,C,G,re)}}if(ge)return re=re(z),ge=G===""?"."+te(z,0):G,$(re)?(C="",ge!=null&&(C=ge.replace(O,"$&/")+"/"),L(re,B,C,"",function(ye){return ye})):re!=null&&(K(re)&&(re=P(re,C+(re.key==null||z&&z.key===re.key?"":(""+re.key).replace(O,"$&/")+"/")+ge)),B.push(re)),1;ge=0;var we=G===""?".":G+":";if($(z))for(var Ne=0;Ne<z.length;Ne++)G=z[Ne],ue=we+te(G,Ne),ge+=L(G,B,C,ue,re);else if(Ne=w(z),typeof Ne=="function")for(z=Ne.call(z),Ne=0;!(G=z.next()).done;)G=G.value,ue=we+te(G,Ne++),ge+=L(G,B,C,ue,re);else if(ue==="object"){if(typeof z.then=="function")return L(F(z),B,C,G,re);throw B=String(z),Error("Objects are not valid as a React child (found: "+(B==="[object Object]"?"object with keys {"+Object.keys(z).join(", ")+"}":B)+"). If you meant to render a collection of children, use an array instead.")}return ge}function ae(z,B,C){if(z==null)return z;var G=[],re=0;return L(z,G,"","",function(ue){return B.call(C,ue,re++)}),G}function ne(z){if(z._status===-1){var B=z._result;B=B(),B.then(function(C){(z._status===0||z._status===-1)&&(z._status=1,z._result=C)},function(C){(z._status===0||z._status===-1)&&(z._status=2,z._result=C)}),z._status===-1&&(z._status=0,z._result=B)}if(z._status===1)return z._result.default;throw z._result}var xe=typeof reportError=="function"?reportError:function(z){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var B=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof z=="object"&&z!==null&&typeof z.message=="string"?String(z.message):String(z),error:z});if(!window.dispatchEvent(B))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",z);return}console.error(z)},R={map:ae,forEach:function(z,B,C){ae(z,function(){B.apply(this,arguments)},C)},count:function(z){var B=0;return ae(z,function(){B++}),B},toArray:function(z){return ae(z,function(B){return B})||[]},only:function(z){if(!K(z))throw Error("React.Children.only expected to receive a single React element child.");return z}};return De.Activity=y,De.Children=R,De.Component=T,De.Fragment=r,De.Profiler=o,De.PureComponent=M,De.StrictMode=i,De.Suspense=h,De.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Y,De.__COMPILER_RUNTIME={__proto__:null,c:function(z){return Y.H.useMemoCache(z)}},De.cache=function(z){return function(){return z.apply(null,arguments)}},De.cacheSignal=function(){return null},De.cloneElement=function(z,B,C){if(z==null)throw Error("The argument must be a React element, but you passed "+z+".");var G=A({},z.props),re=z.key;if(B!=null)for(ue in B.key!==void 0&&(re=""+B.key),B)!W.call(B,ue)||ue==="key"||ue==="__self"||ue==="__source"||ue==="ref"&&B.ref===void 0||(G[ue]=B[ue]);var ue=arguments.length-2;if(ue===1)G.children=C;else if(1<ue){for(var ge=Array(ue),we=0;we<ue;we++)ge[we]=arguments[we+2];G.children=ge}return J(z.type,re,G)},De.createContext=function(z){return z={$$typeof:d,_currentValue:z,_currentValue2:z,_threadCount:0,Provider:null,Consumer:null},z.Provider=z,z.Consumer={$$typeof:c,_context:z},z},De.createElement=function(z,B,C){var G,re={},ue=null;if(B!=null)for(G in B.key!==void 0&&(ue=""+B.key),B)W.call(B,G)&&G!=="key"&&G!=="__self"&&G!=="__source"&&(re[G]=B[G]);var ge=arguments.length-2;if(ge===1)re.children=C;else if(1<ge){for(var we=Array(ge),Ne=0;Ne<ge;Ne++)we[Ne]=arguments[Ne+2];re.children=we}if(z&&z.defaultProps)for(G in ge=z.defaultProps,ge)re[G]===void 0&&(re[G]=ge[G]);return J(z,ue,re)},De.createRef=function(){return{current:null}},De.forwardRef=function(z){return{$$typeof:f,render:z}},De.isValidElement=K,De.lazy=function(z){return{$$typeof:g,_payload:{_status:-1,_result:z},_init:ne}},De.memo=function(z,B){return{$$typeof:m,type:z,compare:B===void 0?null:B}},De.startTransition=function(z){var B=Y.T,C={};Y.T=C;try{var G=z(),re=Y.S;re!==null&&re(C,G),typeof G=="object"&&G!==null&&typeof G.then=="function"&&G.then(U,xe)}catch(ue){xe(ue)}finally{B!==null&&C.types!==null&&(B.types=C.types),Y.T=B}},De.unstable_useCacheRefresh=function(){return Y.H.useCacheRefresh()},De.use=function(z){return Y.H.use(z)},De.useActionState=function(z,B,C){return Y.H.useActionState(z,B,C)},De.useCallback=function(z,B){return Y.H.useCallback(z,B)},De.useContext=function(z){return Y.H.useContext(z)},De.useDebugValue=function(){},De.useDeferredValue=function(z,B){return Y.H.useDeferredValue(z,B)},De.useEffect=function(z,B){return Y.H.useEffect(z,B)},De.useEffectEvent=function(z){return Y.H.useEffectEvent(z)},De.useId=function(){return Y.H.useId()},De.useImperativeHandle=function(z,B,C){return Y.H.useImperativeHandle(z,B,C)},De.useInsertionEffect=function(z,B){return Y.H.useInsertionEffect(z,B)},De.useLayoutEffect=function(z,B){return Y.H.useLayoutEffect(z,B)},De.useMemo=function(z,B){return Y.H.useMemo(z,B)},De.useOptimistic=function(z,B){return Y.H.useOptimistic(z,B)},De.useReducer=function(z,B,C){return Y.H.useReducer(z,B,C)},De.useRef=function(z){return Y.H.useRef(z)},De.useState=function(z){return Y.H.useState(z)},De.useSyncExternalStore=function(z,B,C){return Y.H.useSyncExternalStore(z,B,C)},De.useTransition=function(){return Y.H.useTransition()},De.version="19.2.7",De}var cx;function gm(){return cx||(cx=1,Wd.exports=G2()),Wd.exports}var k=gm(),Xd={exports:{}},Ui={},Qd={exports:{}},Zd={};var dx;function K2(){return dx||(dx=1,(function(e){function a(L,ae){var ne=L.length;L.push(ae);e:for(;0<ne;){var xe=ne-1>>>1,R=L[xe];if(0<o(R,ae))L[xe]=ae,L[ne]=R,ne=xe;else break e}}function r(L){return L.length===0?null:L[0]}function i(L){if(L.length===0)return null;var ae=L[0],ne=L.pop();if(ne!==ae){L[0]=ne;e:for(var xe=0,R=L.length,z=R>>>1;xe<z;){var B=2*(xe+1)-1,C=L[B],G=B+1,re=L[G];if(0>o(C,ne))G<R&&0>o(re,C)?(L[xe]=re,L[G]=ne,xe=G):(L[xe]=C,L[B]=ne,xe=B);else if(G<R&&0>o(re,ne))L[xe]=re,L[G]=ne,xe=G;else break e}}return ae}function o(L,ae){var ne=L.sortIndex-ae.sortIndex;return ne!==0?ne:L.id-ae.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var d=Date,f=d.now();e.unstable_now=function(){return d.now()-f}}var h=[],m=[],g=1,y=null,b=3,w=!1,N=!1,A=!1,j=!1,T=typeof setTimeout=="function"?setTimeout:null,I=typeof clearTimeout=="function"?clearTimeout:null,M=typeof setImmediate<"u"?setImmediate:null;function _(L){for(var ae=r(m);ae!==null;){if(ae.callback===null)i(m);else if(ae.startTime<=L)i(m),ae.sortIndex=ae.expirationTime,a(h,ae);else break;ae=r(m)}}function $(L){if(A=!1,_(L),!N)if(r(h)!==null)N=!0,U||(U=!0,D());else{var ae=r(m);ae!==null&&F($,ae.startTime-L)}}var U=!1,Y=-1,W=5,J=-1;function P(){return j?!0:!(e.unstable_now()-J<W)}function K(){if(j=!1,U){var L=e.unstable_now();J=L;var ae=!0;try{e:{N=!1,A&&(A=!1,I(Y),Y=-1),w=!0;var ne=b;try{t:{for(_(L),y=r(h);y!==null&&!(y.expirationTime>L&&P());){var xe=y.callback;if(typeof xe=="function"){y.callback=null,b=y.priorityLevel;var R=xe(y.expirationTime<=L);if(L=e.unstable_now(),typeof R=="function"){y.callback=R,_(L),ae=!0;break t}y===r(h)&&i(h),_(L)}else i(h);y=r(h)}if(y!==null)ae=!0;else{var z=r(m);z!==null&&F($,z.startTime-L),ae=!1}}break e}finally{y=null,b=ne,w=!1}ae=void 0}}finally{ae?D():U=!1}}}var D;if(typeof M=="function")D=function(){M(K)};else if(typeof MessageChannel<"u"){var O=new MessageChannel,te=O.port2;O.port1.onmessage=K,D=function(){te.postMessage(null)}}else D=function(){T(K,0)};function F(L,ae){Y=T(function(){L(e.unstable_now())},ae)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(L){L.callback=null},e.unstable_forceFrameRate=function(L){0>L||125<L?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):W=0<L?Math.floor(1e3/L):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(L){switch(b){case 1:case 2:case 3:var ae=3;break;default:ae=b}var ne=b;b=ae;try{return L()}finally{b=ne}},e.unstable_requestPaint=function(){j=!0},e.unstable_runWithPriority=function(L,ae){switch(L){case 1:case 2:case 3:case 4:case 5:break;default:L=3}var ne=b;b=L;try{return ae()}finally{b=ne}},e.unstable_scheduleCallback=function(L,ae,ne){var xe=e.unstable_now();switch(typeof ne=="object"&&ne!==null?(ne=ne.delay,ne=typeof ne=="number"&&0<ne?xe+ne:xe):ne=xe,L){case 1:var R=-1;break;case 2:R=250;break;case 5:R=1073741823;break;case 4:R=1e4;break;default:R=5e3}return R=ne+R,L={id:g++,callback:ae,priorityLevel:L,startTime:ne,expirationTime:R,sortIndex:-1},ne>xe?(L.sortIndex=ne,a(m,L),r(h)===null&&L===r(m)&&(A?(I(Y),Y=-1):A=!0,F($,ne-xe))):(L.sortIndex=R,a(h,L),N||w||(N=!0,U||(U=!0,D()))),L},e.unstable_shouldYield=P,e.unstable_wrapCallback=function(L){var ae=b;return function(){var ne=b;b=ae;try{return L.apply(this,arguments)}finally{b=ne}}}})(Zd)),Zd}var fx;function W2(){return fx||(fx=1,Qd.exports=K2()),Qd.exports}var Jd={exports:{}},Ft={};var mx;function X2(){if(mx)return Ft;mx=1;var e=gm();function a(h){var m="https://react.dev/errors/"+h;if(1<arguments.length){m+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)m+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+h+"; visit "+m+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var i={d:{f:r,r:function(){throw Error(a(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},o=Symbol.for("react.portal");function c(h,m,g){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:y==null?null:""+y,children:h,containerInfo:m,implementation:g}}var d=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(h,m){if(h==="font")return"";if(typeof m=="string")return m==="use-credentials"?m:""}return Ft.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,Ft.createPortal=function(h,m){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!m||m.nodeType!==1&&m.nodeType!==9&&m.nodeType!==11)throw Error(a(299));return c(h,m,null,g)},Ft.flushSync=function(h){var m=d.T,g=i.p;try{if(d.T=null,i.p=2,h)return h()}finally{d.T=m,i.p=g,i.d.f()}},Ft.preconnect=function(h,m){typeof h=="string"&&(m?(m=m.crossOrigin,m=typeof m=="string"?m==="use-credentials"?m:"":void 0):m=null,i.d.C(h,m))},Ft.prefetchDNS=function(h){typeof h=="string"&&i.d.D(h)},Ft.preinit=function(h,m){if(typeof h=="string"&&m&&typeof m.as=="string"){var g=m.as,y=f(g,m.crossOrigin),b=typeof m.integrity=="string"?m.integrity:void 0,w=typeof m.fetchPriority=="string"?m.fetchPriority:void 0;g==="style"?i.d.S(h,typeof m.precedence=="string"?m.precedence:void 0,{crossOrigin:y,integrity:b,fetchPriority:w}):g==="script"&&i.d.X(h,{crossOrigin:y,integrity:b,fetchPriority:w,nonce:typeof m.nonce=="string"?m.nonce:void 0})}},Ft.preinitModule=function(h,m){if(typeof h=="string")if(typeof m=="object"&&m!==null){if(m.as==null||m.as==="script"){var g=f(m.as,m.crossOrigin);i.d.M(h,{crossOrigin:g,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0})}}else m==null&&i.d.M(h)},Ft.preload=function(h,m){if(typeof h=="string"&&typeof m=="object"&&m!==null&&typeof m.as=="string"){var g=m.as,y=f(g,m.crossOrigin);i.d.L(h,g,{crossOrigin:y,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0,type:typeof m.type=="string"?m.type:void 0,fetchPriority:typeof m.fetchPriority=="string"?m.fetchPriority:void 0,referrerPolicy:typeof m.referrerPolicy=="string"?m.referrerPolicy:void 0,imageSrcSet:typeof m.imageSrcSet=="string"?m.imageSrcSet:void 0,imageSizes:typeof m.imageSizes=="string"?m.imageSizes:void 0,media:typeof m.media=="string"?m.media:void 0})}},Ft.preloadModule=function(h,m){if(typeof h=="string")if(m){var g=f(m.as,m.crossOrigin);i.d.m(h,{as:typeof m.as=="string"&&m.as!=="script"?m.as:void 0,crossOrigin:g,integrity:typeof m.integrity=="string"?m.integrity:void 0})}else i.d.m(h)},Ft.requestFormReset=function(h){i.d.r(h)},Ft.unstable_batchedUpdates=function(h,m){return h(m)},Ft.useFormState=function(h,m,g){return d.H.useFormState(h,m,g)},Ft.useFormStatus=function(){return d.H.useHostTransitionStatus()},Ft.version="19.2.7",Ft}var hx;function o1(){if(hx)return Jd.exports;hx=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(a){console.error(a)}}return e(),Jd.exports=X2(),Jd.exports}var px;function Q2(){if(px)return Ui;px=1;var e=W2(),a=gm(),r=o1();function i(t){var n="https://react.dev/errors/"+t;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)n+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+t+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function c(t){var n=t,l=t;if(t.alternate)for(;n.return;)n=n.return;else{t=n;do n=t,(n.flags&4098)!==0&&(l=n.return),t=n.return;while(t)}return n.tag===3?l:null}function d(t){if(t.tag===13){var n=t.memoizedState;if(n===null&&(t=t.alternate,t!==null&&(n=t.memoizedState)),n!==null)return n.dehydrated}return null}function f(t){if(t.tag===31){var n=t.memoizedState;if(n===null&&(t=t.alternate,t!==null&&(n=t.memoizedState)),n!==null)return n.dehydrated}return null}function h(t){if(c(t)!==t)throw Error(i(188))}function m(t){var n=t.alternate;if(!n){if(n=c(t),n===null)throw Error(i(188));return n!==t?null:t}for(var l=t,u=n;;){var p=l.return;if(p===null)break;var x=p.alternate;if(x===null){if(u=p.return,u!==null){l=u;continue}break}if(p.child===x.child){for(x=p.child;x;){if(x===l)return h(p),t;if(x===u)return h(p),n;x=x.sibling}throw Error(i(188))}if(l.return!==u.return)l=p,u=x;else{for(var S=!1,E=p.child;E;){if(E===l){S=!0,l=p,u=x;break}if(E===u){S=!0,u=p,l=x;break}E=E.sibling}if(!S){for(E=x.child;E;){if(E===l){S=!0,l=x,u=p;break}if(E===u){S=!0,u=x,l=p;break}E=E.sibling}if(!S)throw Error(i(189))}}if(l.alternate!==u)throw Error(i(190))}if(l.tag!==3)throw Error(i(188));return l.stateNode.current===l?t:n}function g(t){var n=t.tag;if(n===5||n===26||n===27||n===6)return t;for(t=t.child;t!==null;){if(n=g(t),n!==null)return n;t=t.sibling}return null}var y=Object.assign,b=Symbol.for("react.element"),w=Symbol.for("react.transitional.element"),N=Symbol.for("react.portal"),A=Symbol.for("react.fragment"),j=Symbol.for("react.strict_mode"),T=Symbol.for("react.profiler"),I=Symbol.for("react.consumer"),M=Symbol.for("react.context"),_=Symbol.for("react.forward_ref"),$=Symbol.for("react.suspense"),U=Symbol.for("react.suspense_list"),Y=Symbol.for("react.memo"),W=Symbol.for("react.lazy"),J=Symbol.for("react.activity"),P=Symbol.for("react.memo_cache_sentinel"),K=Symbol.iterator;function D(t){return t===null||typeof t!="object"?null:(t=K&&t[K]||t["@@iterator"],typeof t=="function"?t:null)}var O=Symbol.for("react.client.reference");function te(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===O?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case A:return"Fragment";case T:return"Profiler";case j:return"StrictMode";case $:return"Suspense";case U:return"SuspenseList";case J:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case N:return"Portal";case M:return t.displayName||"Context";case I:return(t._context.displayName||"Context")+".Consumer";case _:var n=t.render;return t=t.displayName,t||(t=n.displayName||n.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Y:return n=t.displayName||null,n!==null?n:te(t.type)||"Memo";case W:n=t._payload,t=t._init;try{return te(t(n))}catch{}}return null}var F=Array.isArray,L=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ae=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ne={pending:!1,data:null,method:null,action:null},xe=[],R=-1;function z(t){return{current:t}}function B(t){0>R||(t.current=xe[R],xe[R]=null,R--)}function C(t,n){R++,xe[R]=t.current,t.current=n}var G=z(null),re=z(null),ue=z(null),ge=z(null);function we(t,n){switch(C(ue,n),C(re,t),C(G,null),n.nodeType){case 9:case 11:t=(t=n.documentElement)&&(t=t.namespaceURI)?Ag(t):0;break;default:if(t=n.tagName,n=n.namespaceURI)n=Ag(n),t=Rg(n,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}B(G),C(G,t)}function Ne(){B(G),B(re),B(ue)}function ye(t){t.memoizedState!==null&&C(ge,t);var n=G.current,l=Rg(n,t.type);n!==l&&(C(re,t),C(G,l))}function Me(t){re.current===t&&(B(G),B(re)),ge.current===t&&(B(ge),zi._currentValue=ne)}var Je,Kt;function Lt(t){if(Je===void 0)try{throw Error()}catch(l){var n=l.stack.trim().match(/\n( *(at )?)/);Je=n&&n[1]||"",Kt=-1<l.stack.indexOf(`
|
|
2
|
+
at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
+
`+Je+t+Kt}var qt=!1;function Tt(t,n){if(!t||qt)return"";qt=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={DetermineComponentFrameRoot:function(){try{if(n){var fe=function(){throw Error()};if(Object.defineProperty(fe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(fe,[])}catch(le){var Z=le}Reflect.construct(t,[],fe)}else{try{fe.call()}catch(le){Z=le}t.call(fe.prototype)}}else{try{throw Error()}catch(le){Z=le}(fe=t())&&typeof fe.catch=="function"&&fe.catch(function(){})}}catch(le){if(le&&Z&&typeof le.stack=="string")return[le.stack,Z.stack]}return[null,null]}};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var p=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");p&&p.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var x=u.DetermineComponentFrameRoot(),S=x[0],E=x[1];if(S&&E){var H=S.split(`
|
|
4
|
+
`),Q=E.split(`
|
|
5
|
+
`);for(p=u=0;u<H.length&&!H[u].includes("DetermineComponentFrameRoot");)u++;for(;p<Q.length&&!Q[p].includes("DetermineComponentFrameRoot");)p++;if(u===H.length||p===Q.length)for(u=H.length-1,p=Q.length-1;1<=u&&0<=p&&H[u]!==Q[p];)p--;for(;1<=u&&0<=p;u--,p--)if(H[u]!==Q[p]){if(u!==1||p!==1)do if(u--,p--,0>p||H[u]!==Q[p]){var oe=`
|
|
6
|
+
`+H[u].replace(" at new "," at ");return t.displayName&&oe.includes("<anonymous>")&&(oe=oe.replace("<anonymous>",t.displayName)),oe}while(1<=u&&0<=p);break}}}finally{qt=!1,Error.prepareStackTrace=l}return(l=t?t.displayName||t.name:"")?Lt(l):""}function fn(t,n){switch(t.tag){case 26:case 27:case 5:return Lt(t.type);case 16:return Lt("Lazy");case 13:return t.child!==n&&n!==null?Lt("Suspense Fallback"):Lt("Suspense");case 19:return Lt("SuspenseList");case 0:case 15:return Tt(t.type,!1);case 11:return Tt(t.type.render,!1);case 1:return Tt(t.type,!0);case 31:return Lt("Activity");default:return""}}function Jt(t){try{var n="",l=null;do n+=fn(t,l),l=t,t=t.return;while(t);return n}catch(u){return`
|
|
7
|
+
Error generating stack: `+u.message+`
|
|
8
|
+
`+u.stack}}var kt=Object.prototype.hasOwnProperty,Rt=e.unstable_scheduleCallback,en=e.unstable_cancelCallback,mn=e.unstable_shouldYield,Wt=e.unstable_requestPaint,ct=e.unstable_now,Vn=e.unstable_getCurrentPriorityLevel,se=e.unstable_ImmediatePriority,ie=e.unstable_UserBlockingPriority,he=e.unstable_NormalPriority,Se=e.unstable_LowPriority,Ae=e.unstable_IdlePriority,Xe=e.log,ce=e.unstable_setDisableYieldValue,ee=null,ve=null;function Re(t){if(typeof Xe=="function"&&ce(t),ve&&typeof ve.setStrictMode=="function")try{ve.setStrictMode(ee,t)}catch{}}var ze=Math.clz32?Math.clz32:hn,Ot=Math.log,It=Math.LN2;function hn(t){return t>>>=0,t===0?32:31-(Ot(t)/It|0)|0}var _t=256,bs=262144,ks=4194304;function pr(t){var n=t&42;if(n!==0)return n;switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function ws(t,n,l){var u=t.pendingLanes;if(u===0)return 0;var p=0,x=t.suspendedLanes,S=t.pingedLanes;t=t.warmLanes;var E=u&134217727;return E!==0?(u=E&~x,u!==0?p=pr(u):(S&=E,S!==0?p=pr(S):l||(l=E&~t,l!==0&&(p=pr(l))))):(E=u&~x,E!==0?p=pr(E):S!==0?p=pr(S):l||(l=u&~t,l!==0&&(p=pr(l)))),p===0?0:n!==0&&n!==p&&(n&x)===0&&(x=p&-p,l=n&-n,x>=l||x===32&&(l&4194048)!==0)?n:p}function Yl(t,n){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&n)===0}function _b(t,n){switch(t){case 1:case 2:case 4:case 8:case 64:return n+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function dh(){var t=ks;return ks<<=1,(ks&62914560)===0&&(ks=4194304),t}function Ou(t){for(var n=[],l=0;31>l;l++)n.push(t);return n}function Gl(t,n){t.pendingLanes|=n,n!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function zb(t,n,l,u,p,x){var S=t.pendingLanes;t.pendingLanes=l,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=l,t.entangledLanes&=l,t.errorRecoveryDisabledLanes&=l,t.shellSuspendCounter=0;var E=t.entanglements,H=t.expirationTimes,Q=t.hiddenUpdates;for(l=S&~l;0<l;){var oe=31-ze(l),fe=1<<oe;E[oe]=0,H[oe]=-1;var Z=Q[oe];if(Z!==null)for(Q[oe]=null,oe=0;oe<Z.length;oe++){var le=Z[oe];le!==null&&(le.lane&=-536870913)}l&=~fe}u!==0&&fh(t,u,0),x!==0&&p===0&&t.tag!==0&&(t.suspendedLanes|=x&~(S&~n))}function fh(t,n,l){t.pendingLanes|=n,t.suspendedLanes&=~n;var u=31-ze(n);t.entangledLanes|=n,t.entanglements[u]=t.entanglements[u]|1073741824|l&261930}function mh(t,n){var l=t.entangledLanes|=n;for(t=t.entanglements;l;){var u=31-ze(l),p=1<<u;p&n|t[u]&n&&(t[u]|=n),l&=~p}}function hh(t,n){var l=n&-n;return l=(l&42)!==0?1:Iu(l),(l&(t.suspendedLanes|n))!==0?0:l}function Iu(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function Uu(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function ph(){var t=ae.p;return t!==0?t:(t=window.event,t===void 0?32:ex(t.type))}function gh(t,n){var l=ae.p;try{return ae.p=t,n()}finally{ae.p=l}}var Oa=Math.random().toString(36).slice(2),Ut="__reactFiber$"+Oa,tn="__reactProps$"+Oa,Qr="__reactContainer$"+Oa,$u="__reactEvents$"+Oa,Db="__reactListeners$"+Oa,Lb="__reactHandles$"+Oa,xh="__reactResources$"+Oa,Kl="__reactMarker$"+Oa;function Bu(t){delete t[Ut],delete t[tn],delete t[$u],delete t[Db],delete t[Lb]}function Zr(t){var n=t[Ut];if(n)return n;for(var l=t.parentNode;l;){if(n=l[Qr]||l[Ut]){if(l=n.alternate,n.child!==null||l!==null&&l.child!==null)for(t=Ug(t);t!==null;){if(l=t[Ut])return l;t=Ug(t)}return n}t=l,l=t.parentNode}return null}function Jr(t){if(t=t[Ut]||t[Qr]){var n=t.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return t}return null}function Wl(t){var n=t.tag;if(n===5||n===26||n===27||n===6)return t.stateNode;throw Error(i(33))}function el(t){var n=t[xh];return n||(n=t[xh]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function zt(t){t[Kl]=!0}var yh=new Set,vh={};function gr(t,n){tl(t,n),tl(t+"Capture",n)}function tl(t,n){for(vh[t]=n,t=0;t<n.length;t++)yh.add(n[t])}var Ob=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),bh={},kh={};function Ib(t){return kt.call(kh,t)?!0:kt.call(bh,t)?!1:Ob.test(t)?kh[t]=!0:(bh[t]=!0,!1)}function Ss(t,n,l){if(Ib(n))if(l===null)t.removeAttribute(n);else{switch(typeof l){case"undefined":case"function":case"symbol":t.removeAttribute(n);return;case"boolean":var u=n.toLowerCase().slice(0,5);if(u!=="data-"&&u!=="aria-"){t.removeAttribute(n);return}}t.setAttribute(n,""+l)}}function js(t,n,l){if(l===null)t.removeAttribute(n);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(n);return}t.setAttribute(n,""+l)}}function ua(t,n,l,u){if(u===null)t.removeAttribute(l);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(l);return}t.setAttributeNS(n,l,""+u)}}function Tn(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function wh(t){var n=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function Ub(t,n,l){var u=Object.getOwnPropertyDescriptor(t.constructor.prototype,n);if(!t.hasOwnProperty(n)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var p=u.get,x=u.set;return Object.defineProperty(t,n,{configurable:!0,get:function(){return p.call(this)},set:function(S){l=""+S,x.call(this,S)}}),Object.defineProperty(t,n,{enumerable:u.enumerable}),{getValue:function(){return l},setValue:function(S){l=""+S},stopTracking:function(){t._valueTracker=null,delete t[n]}}}}function Hu(t){if(!t._valueTracker){var n=wh(t)?"checked":"value";t._valueTracker=Ub(t,n,""+t[n])}}function Sh(t){if(!t)return!1;var n=t._valueTracker;if(!n)return!0;var l=n.getValue(),u="";return t&&(u=wh(t)?t.checked?"true":"false":t.value),t=u,t!==l?(n.setValue(t),!0):!1}function Ns(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var $b=/[\n"\\]/g;function Mn(t){return t.replace($b,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function Pu(t,n,l,u,p,x,S,E){t.name="",S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"?t.type=S:t.removeAttribute("type"),n!=null?S==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+Tn(n)):t.value!==""+Tn(n)&&(t.value=""+Tn(n)):S!=="submit"&&S!=="reset"||t.removeAttribute("value"),n!=null?qu(t,S,Tn(n)):l!=null?qu(t,S,Tn(l)):u!=null&&t.removeAttribute("value"),p==null&&x!=null&&(t.defaultChecked=!!x),p!=null&&(t.checked=p&&typeof p!="function"&&typeof p!="symbol"),E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"?t.name=""+Tn(E):t.removeAttribute("name")}function jh(t,n,l,u,p,x,S,E){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(t.type=x),n!=null||l!=null){if(!(x!=="submit"&&x!=="reset"||n!=null)){Hu(t);return}l=l!=null?""+Tn(l):"",n=n!=null?""+Tn(n):l,E||n===t.value||(t.value=n),t.defaultValue=n}u=u??p,u=typeof u!="function"&&typeof u!="symbol"&&!!u,t.checked=E?t.checked:!!u,t.defaultChecked=!!u,S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"&&(t.name=S),Hu(t)}function qu(t,n,l){n==="number"&&Ns(t.ownerDocument)===t||t.defaultValue===""+l||(t.defaultValue=""+l)}function nl(t,n,l,u){if(t=t.options,n){n={};for(var p=0;p<l.length;p++)n["$"+l[p]]=!0;for(l=0;l<t.length;l++)p=n.hasOwnProperty("$"+t[l].value),t[l].selected!==p&&(t[l].selected=p),p&&u&&(t[l].defaultSelected=!0)}else{for(l=""+Tn(l),n=null,p=0;p<t.length;p++){if(t[p].value===l){t[p].selected=!0,u&&(t[p].defaultSelected=!0);return}n!==null||t[p].disabled||(n=t[p])}n!==null&&(n.selected=!0)}}function Nh(t,n,l){if(n!=null&&(n=""+Tn(n),n!==t.value&&(t.value=n),l==null)){t.defaultValue!==n&&(t.defaultValue=n);return}t.defaultValue=l!=null?""+Tn(l):""}function Ch(t,n,l,u){if(n==null){if(u!=null){if(l!=null)throw Error(i(92));if(F(u)){if(1<u.length)throw Error(i(93));u=u[0]}l=u}l==null&&(l=""),n=l}l=Tn(n),t.defaultValue=l,u=t.textContent,u===l&&u!==""&&u!==null&&(t.value=u),Hu(t)}function al(t,n){if(n){var l=t.firstChild;if(l&&l===t.lastChild&&l.nodeType===3){l.nodeValue=n;return}}t.textContent=n}var Bb=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Eh(t,n,l){var u=n.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?u?t.setProperty(n,""):n==="float"?t.cssFloat="":t[n]="":u?t.setProperty(n,l):typeof l!="number"||l===0||Bb.has(n)?n==="float"?t.cssFloat=l:t[n]=(""+l).trim():t[n]=l+"px"}function Th(t,n,l){if(n!=null&&typeof n!="object")throw Error(i(62));if(t=t.style,l!=null){for(var u in l)!l.hasOwnProperty(u)||n!=null&&n.hasOwnProperty(u)||(u.indexOf("--")===0?t.setProperty(u,""):u==="float"?t.cssFloat="":t[u]="");for(var p in n)u=n[p],n.hasOwnProperty(p)&&l[p]!==u&&Eh(t,p,u)}else for(var x in n)n.hasOwnProperty(x)&&Eh(t,x,n[x])}function Fu(t){if(t.indexOf("-")===-1)return!1;switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Hb=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Pb=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Cs(t){return Pb.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function ca(){}var Vu=null;function Yu(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var rl=null,ll=null;function Mh(t){var n=Jr(t);if(n&&(t=n.stateNode)){var l=t[tn]||null;e:switch(t=n.stateNode,n.type){case"input":if(Pu(t,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),n=l.name,l.type==="radio"&&n!=null){for(l=t;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+Mn(""+n)+'"][type="radio"]'),n=0;n<l.length;n++){var u=l[n];if(u!==t&&u.form===t.form){var p=u[tn]||null;if(!p)throw Error(i(90));Pu(u,p.value,p.defaultValue,p.defaultValue,p.checked,p.defaultChecked,p.type,p.name)}}for(n=0;n<l.length;n++)u=l[n],u.form===t.form&&Sh(u)}break e;case"textarea":Nh(t,l.value,l.defaultValue);break e;case"select":n=l.value,n!=null&&nl(t,!!l.multiple,n,!1)}}}var Gu=!1;function Ah(t,n,l){if(Gu)return t(n,l);Gu=!0;try{var u=t(n);return u}finally{if(Gu=!1,(rl!==null||ll!==null)&&(ho(),rl&&(n=rl,t=ll,ll=rl=null,Mh(n),t)))for(n=0;n<t.length;n++)Mh(t[n])}}function Xl(t,n){var l=t.stateNode;if(l===null)return null;var u=l[tn]||null;if(u===null)return null;l=u[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(u=!u.disabled)||(t=t.type,u=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!u;break e;default:t=!1}if(t)return null;if(l&&typeof l!="function")throw Error(i(231,n,typeof l));return l}var da=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ku=!1;if(da)try{var Ql={};Object.defineProperty(Ql,"passive",{get:function(){Ku=!0}}),window.addEventListener("test",Ql,Ql),window.removeEventListener("test",Ql,Ql)}catch{Ku=!1}var Ia=null,Wu=null,Es=null;function Rh(){if(Es)return Es;var t,n=Wu,l=n.length,u,p="value"in Ia?Ia.value:Ia.textContent,x=p.length;for(t=0;t<l&&n[t]===p[t];t++);var S=l-t;for(u=1;u<=S&&n[l-u]===p[x-u];u++);return Es=p.slice(t,1<u?1-u:void 0)}function Ts(t){var n=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&n===13&&(t=13)):t=n,t===10&&(t=13),32<=t||t===13?t:0}function Ms(){return!0}function _h(){return!1}function nn(t){function n(l,u,p,x,S){this._reactName=l,this._targetInst=p,this.type=u,this.nativeEvent=x,this.target=S,this.currentTarget=null;for(var E in t)t.hasOwnProperty(E)&&(l=t[E],this[E]=l?l(x):x[E]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?Ms:_h,this.isPropagationStopped=_h,this}return y(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=Ms)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=Ms)},persist:function(){},isPersistent:Ms}),n}var xr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},As=nn(xr),Zl=y({},xr,{view:0,detail:0}),qb=nn(Zl),Xu,Qu,Jl,Rs=y({},Zl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ju,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==Jl&&(Jl&&t.type==="mousemove"?(Xu=t.screenX-Jl.screenX,Qu=t.screenY-Jl.screenY):Qu=Xu=0,Jl=t),Xu)},movementY:function(t){return"movementY"in t?t.movementY:Qu}}),zh=nn(Rs),Fb=y({},Rs,{dataTransfer:0}),Vb=nn(Fb),Yb=y({},Zl,{relatedTarget:0}),Zu=nn(Yb),Gb=y({},xr,{animationName:0,elapsedTime:0,pseudoElement:0}),Kb=nn(Gb),Wb=y({},xr,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),Xb=nn(Wb),Qb=y({},xr,{data:0}),Dh=nn(Qb),Zb={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Jb={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},ek={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function tk(t){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(t):(t=ek[t])?!!n[t]:!1}function Ju(){return tk}var nk=y({},Zl,{key:function(t){if(t.key){var n=Zb[t.key]||t.key;if(n!=="Unidentified")return n}return t.type==="keypress"?(t=Ts(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?Jb[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ju,charCode:function(t){return t.type==="keypress"?Ts(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Ts(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),ak=nn(nk),rk=y({},Rs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Lh=nn(rk),lk=y({},Zl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ju}),ik=nn(lk),sk=y({},xr,{propertyName:0,elapsedTime:0,pseudoElement:0}),ok=nn(sk),uk=y({},Rs,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),ck=nn(uk),dk=y({},xr,{newState:0,oldState:0}),fk=nn(dk),mk=[9,13,27,32],ec=da&&"CompositionEvent"in window,ei=null;da&&"documentMode"in document&&(ei=document.documentMode);var hk=da&&"TextEvent"in window&&!ei,Oh=da&&(!ec||ei&&8<ei&&11>=ei),Ih=" ",Uh=!1;function $h(t,n){switch(t){case"keyup":return mk.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Bh(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var il=!1;function pk(t,n){switch(t){case"compositionend":return Bh(n);case"keypress":return n.which!==32?null:(Uh=!0,Ih);case"textInput":return t=n.data,t===Ih&&Uh?null:t;default:return null}}function gk(t,n){if(il)return t==="compositionend"||!ec&&$h(t,n)?(t=Rh(),Es=Wu=Ia=null,il=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return Oh&&n.locale!=="ko"?null:n.data;default:return null}}var xk={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Hh(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n==="input"?!!xk[t.type]:n==="textarea"}function Ph(t,n,l,u){rl?ll?ll.push(u):ll=[u]:rl=u,n=ko(n,"onChange"),0<n.length&&(l=new As("onChange","change",null,l,u),t.push({event:l,listeners:n}))}var ti=null,ni=null;function yk(t){jg(t,0)}function _s(t){var n=Wl(t);if(Sh(n))return t}function qh(t,n){if(t==="change")return n}var Fh=!1;if(da){var tc;if(da){var nc="oninput"in document;if(!nc){var Vh=document.createElement("div");Vh.setAttribute("oninput","return;"),nc=typeof Vh.oninput=="function"}tc=nc}else tc=!1;Fh=tc&&(!document.documentMode||9<document.documentMode)}function Yh(){ti&&(ti.detachEvent("onpropertychange",Gh),ni=ti=null)}function Gh(t){if(t.propertyName==="value"&&_s(ni)){var n=[];Ph(n,ni,t,Yu(t)),Ah(yk,n)}}function vk(t,n,l){t==="focusin"?(Yh(),ti=n,ni=l,ti.attachEvent("onpropertychange",Gh)):t==="focusout"&&Yh()}function bk(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return _s(ni)}function kk(t,n){if(t==="click")return _s(n)}function wk(t,n){if(t==="input"||t==="change")return _s(n)}function Sk(t,n){return t===n&&(t!==0||1/t===1/n)||t!==t&&n!==n}var pn=typeof Object.is=="function"?Object.is:Sk;function ai(t,n){if(pn(t,n))return!0;if(typeof t!="object"||t===null||typeof n!="object"||n===null)return!1;var l=Object.keys(t),u=Object.keys(n);if(l.length!==u.length)return!1;for(u=0;u<l.length;u++){var p=l[u];if(!kt.call(n,p)||!pn(t[p],n[p]))return!1}return!0}function Kh(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Wh(t,n){var l=Kh(t);t=0;for(var u;l;){if(l.nodeType===3){if(u=t+l.textContent.length,t<=n&&u>=n)return{node:l,offset:n-t};t=u}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=Kh(l)}}function Xh(t,n){return t&&n?t===n?!0:t&&t.nodeType===3?!1:n&&n.nodeType===3?Xh(t,n.parentNode):"contains"in t?t.contains(n):t.compareDocumentPosition?!!(t.compareDocumentPosition(n)&16):!1:!1}function Qh(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var n=Ns(t.document);n instanceof t.HTMLIFrameElement;){try{var l=typeof n.contentWindow.location.href=="string"}catch{l=!1}if(l)t=n.contentWindow;else break;n=Ns(t.document)}return n}function ac(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n&&(n==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||n==="textarea"||t.contentEditable==="true")}var jk=da&&"documentMode"in document&&11>=document.documentMode,sl=null,rc=null,ri=null,lc=!1;function Zh(t,n,l){var u=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;lc||sl==null||sl!==Ns(u)||(u=sl,"selectionStart"in u&&ac(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),ri&&ai(ri,u)||(ri=u,u=ko(rc,"onSelect"),0<u.length&&(n=new As("onSelect","select",null,n,l),t.push({event:n,listeners:u}),n.target=sl)))}function yr(t,n){var l={};return l[t.toLowerCase()]=n.toLowerCase(),l["Webkit"+t]="webkit"+n,l["Moz"+t]="moz"+n,l}var ol={animationend:yr("Animation","AnimationEnd"),animationiteration:yr("Animation","AnimationIteration"),animationstart:yr("Animation","AnimationStart"),transitionrun:yr("Transition","TransitionRun"),transitionstart:yr("Transition","TransitionStart"),transitioncancel:yr("Transition","TransitionCancel"),transitionend:yr("Transition","TransitionEnd")},ic={},Jh={};da&&(Jh=document.createElement("div").style,"AnimationEvent"in window||(delete ol.animationend.animation,delete ol.animationiteration.animation,delete ol.animationstart.animation),"TransitionEvent"in window||delete ol.transitionend.transition);function vr(t){if(ic[t])return ic[t];if(!ol[t])return t;var n=ol[t],l;for(l in n)if(n.hasOwnProperty(l)&&l in Jh)return ic[t]=n[l];return t}var ep=vr("animationend"),tp=vr("animationiteration"),np=vr("animationstart"),Nk=vr("transitionrun"),Ck=vr("transitionstart"),Ek=vr("transitioncancel"),ap=vr("transitionend"),rp=new Map,sc="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");sc.push("scrollEnd");function Yn(t,n){rp.set(t,n),gr(n,[t])}var zs=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},An=[],ul=0,oc=0;function Ds(){for(var t=ul,n=oc=ul=0;n<t;){var l=An[n];An[n++]=null;var u=An[n];An[n++]=null;var p=An[n];An[n++]=null;var x=An[n];if(An[n++]=null,u!==null&&p!==null){var S=u.pending;S===null?p.next=p:(p.next=S.next,S.next=p),u.pending=p}x!==0&&lp(l,p,x)}}function Ls(t,n,l,u){An[ul++]=t,An[ul++]=n,An[ul++]=l,An[ul++]=u,oc|=u,t.lanes|=u,t=t.alternate,t!==null&&(t.lanes|=u)}function uc(t,n,l,u){return Ls(t,n,l,u),Os(t)}function br(t,n){return Ls(t,null,null,n),Os(t)}function lp(t,n,l){t.lanes|=l;var u=t.alternate;u!==null&&(u.lanes|=l);for(var p=!1,x=t.return;x!==null;)x.childLanes|=l,u=x.alternate,u!==null&&(u.childLanes|=l),x.tag===22&&(t=x.stateNode,t===null||t._visibility&1||(p=!0)),t=x,x=x.return;return t.tag===3?(x=t.stateNode,p&&n!==null&&(p=31-ze(l),t=x.hiddenUpdates,u=t[p],u===null?t[p]=[n]:u.push(n),n.lane=l|536870912),x):null}function Os(t){if(50<Ci)throw Ci=0,yd=null,Error(i(185));for(var n=t.return;n!==null;)t=n,n=t.return;return t.tag===3?t.stateNode:null}var cl={};function Tk(t,n,l,u){this.tag=t,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=u,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function gn(t,n,l,u){return new Tk(t,n,l,u)}function cc(t){return t=t.prototype,!(!t||!t.isReactComponent)}function fa(t,n){var l=t.alternate;return l===null?(l=gn(t.tag,n,t.key,t.mode),l.elementType=t.elementType,l.type=t.type,l.stateNode=t.stateNode,l.alternate=t,t.alternate=l):(l.pendingProps=n,l.type=t.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=t.flags&65011712,l.childLanes=t.childLanes,l.lanes=t.lanes,l.child=t.child,l.memoizedProps=t.memoizedProps,l.memoizedState=t.memoizedState,l.updateQueue=t.updateQueue,n=t.dependencies,l.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},l.sibling=t.sibling,l.index=t.index,l.ref=t.ref,l.refCleanup=t.refCleanup,l}function ip(t,n){t.flags&=65011714;var l=t.alternate;return l===null?(t.childLanes=0,t.lanes=n,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=l.childLanes,t.lanes=l.lanes,t.child=l.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=l.memoizedProps,t.memoizedState=l.memoizedState,t.updateQueue=l.updateQueue,t.type=l.type,n=l.dependencies,t.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),t}function Is(t,n,l,u,p,x){var S=0;if(u=t,typeof t=="function")cc(t)&&(S=1);else if(typeof t=="string")S=z2(t,l,G.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case J:return t=gn(31,l,n,p),t.elementType=J,t.lanes=x,t;case A:return kr(l.children,p,x,n);case j:S=8,p|=24;break;case T:return t=gn(12,l,n,p|2),t.elementType=T,t.lanes=x,t;case $:return t=gn(13,l,n,p),t.elementType=$,t.lanes=x,t;case U:return t=gn(19,l,n,p),t.elementType=U,t.lanes=x,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case M:S=10;break e;case I:S=9;break e;case _:S=11;break e;case Y:S=14;break e;case W:S=16,u=null;break e}S=29,l=Error(i(130,t===null?"null":typeof t,"")),u=null}return n=gn(S,l,n,p),n.elementType=t,n.type=u,n.lanes=x,n}function kr(t,n,l,u){return t=gn(7,t,u,n),t.lanes=l,t}function dc(t,n,l){return t=gn(6,t,null,n),t.lanes=l,t}function sp(t){var n=gn(18,null,null,0);return n.stateNode=t,n}function fc(t,n,l){return n=gn(4,t.children!==null?t.children:[],t.key,n),n.lanes=l,n.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},n}var op=new WeakMap;function Rn(t,n){if(typeof t=="object"&&t!==null){var l=op.get(t);return l!==void 0?l:(n={value:t,source:n,stack:Jt(n)},op.set(t,n),n)}return{value:t,source:n,stack:Jt(n)}}var dl=[],fl=0,Us=null,li=0,_n=[],zn=0,Ua=null,ea=1,ta="";function ma(t,n){dl[fl++]=li,dl[fl++]=Us,Us=t,li=n}function up(t,n,l){_n[zn++]=ea,_n[zn++]=ta,_n[zn++]=Ua,Ua=t;var u=ea;t=ta;var p=32-ze(u)-1;u&=~(1<<p),l+=1;var x=32-ze(n)+p;if(30<x){var S=p-p%5;x=(u&(1<<S)-1).toString(32),u>>=S,p-=S,ea=1<<32-ze(n)+p|l<<p|u,ta=x+t}else ea=1<<x|l<<p|u,ta=t}function mc(t){t.return!==null&&(ma(t,1),up(t,1,0))}function hc(t){for(;t===Us;)Us=dl[--fl],dl[fl]=null,li=dl[--fl],dl[fl]=null;for(;t===Ua;)Ua=_n[--zn],_n[zn]=null,ta=_n[--zn],_n[zn]=null,ea=_n[--zn],_n[zn]=null}function cp(t,n){_n[zn++]=ea,_n[zn++]=ta,_n[zn++]=Ua,ea=n.id,ta=n.overflow,Ua=t}var $t=null,it=null,Fe=!1,$a=null,Dn=!1,pc=Error(i(519));function Ba(t){var n=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ii(Rn(n,t)),pc}function dp(t){var n=t.stateNode,l=t.type,u=t.memoizedProps;switch(n[Ut]=t,n[tn]=u,l){case"dialog":$e("cancel",n),$e("close",n);break;case"iframe":case"object":case"embed":$e("load",n);break;case"video":case"audio":for(l=0;l<Ti.length;l++)$e(Ti[l],n);break;case"source":$e("error",n);break;case"img":case"image":case"link":$e("error",n),$e("load",n);break;case"details":$e("toggle",n);break;case"input":$e("invalid",n),jh(n,u.value,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name,!0);break;case"select":$e("invalid",n);break;case"textarea":$e("invalid",n),Ch(n,u.value,u.defaultValue,u.children)}l=u.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||n.textContent===""+l||u.suppressHydrationWarning===!0||Tg(n.textContent,l)?(u.popover!=null&&($e("beforetoggle",n),$e("toggle",n)),u.onScroll!=null&&$e("scroll",n),u.onScrollEnd!=null&&$e("scrollend",n),u.onClick!=null&&(n.onclick=ca),n=!0):n=!1,n||Ba(t,!0)}function fp(t){for($t=t.return;$t;)switch($t.tag){case 5:case 31:case 13:Dn=!1;return;case 27:case 3:Dn=!0;return;default:$t=$t.return}}function ml(t){if(t!==$t)return!1;if(!Fe)return fp(t),Fe=!0,!1;var n=t.tag,l;if((l=n!==3&&n!==27)&&((l=n===5)&&(l=t.type,l=!(l!=="form"&&l!=="button")||zd(t.type,t.memoizedProps)),l=!l),l&&it&&Ba(t),fp(t),n===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(i(317));it=Ig(t)}else if(n===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(i(317));it=Ig(t)}else n===27?(n=it,er(t.type)?(t=Ud,Ud=null,it=t):it=n):it=$t?On(t.stateNode.nextSibling):null;return!0}function wr(){it=$t=null,Fe=!1}function gc(){var t=$a;return t!==null&&(sn===null?sn=t:sn.push.apply(sn,t),$a=null),t}function ii(t){$a===null?$a=[t]:$a.push(t)}var xc=z(null),Sr=null,ha=null;function Ha(t,n,l){C(xc,n._currentValue),n._currentValue=l}function pa(t){t._currentValue=xc.current,B(xc)}function yc(t,n,l){for(;t!==null;){var u=t.alternate;if((t.childLanes&n)!==n?(t.childLanes|=n,u!==null&&(u.childLanes|=n)):u!==null&&(u.childLanes&n)!==n&&(u.childLanes|=n),t===l)break;t=t.return}}function vc(t,n,l,u){var p=t.child;for(p!==null&&(p.return=t);p!==null;){var x=p.dependencies;if(x!==null){var S=p.child;x=x.firstContext;e:for(;x!==null;){var E=x;x=p;for(var H=0;H<n.length;H++)if(E.context===n[H]){x.lanes|=l,E=x.alternate,E!==null&&(E.lanes|=l),yc(x.return,l,t),u||(S=null);break e}x=E.next}}else if(p.tag===18){if(S=p.return,S===null)throw Error(i(341));S.lanes|=l,x=S.alternate,x!==null&&(x.lanes|=l),yc(S,l,t),S=null}else S=p.child;if(S!==null)S.return=p;else for(S=p;S!==null;){if(S===t){S=null;break}if(p=S.sibling,p!==null){p.return=S.return,S=p;break}S=S.return}p=S}}function hl(t,n,l,u){t=null;for(var p=n,x=!1;p!==null;){if(!x){if((p.flags&524288)!==0)x=!0;else if((p.flags&262144)!==0)break}if(p.tag===10){var S=p.alternate;if(S===null)throw Error(i(387));if(S=S.memoizedProps,S!==null){var E=p.type;pn(p.pendingProps.value,S.value)||(t!==null?t.push(E):t=[E])}}else if(p===ge.current){if(S=p.alternate,S===null)throw Error(i(387));S.memoizedState.memoizedState!==p.memoizedState.memoizedState&&(t!==null?t.push(zi):t=[zi])}p=p.return}t!==null&&vc(n,t,l,u),n.flags|=262144}function $s(t){for(t=t.firstContext;t!==null;){if(!pn(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function jr(t){Sr=t,ha=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function Bt(t){return mp(Sr,t)}function Bs(t,n){return Sr===null&&jr(t),mp(t,n)}function mp(t,n){var l=n._currentValue;if(n={context:n,memoizedValue:l,next:null},ha===null){if(t===null)throw Error(i(308));ha=n,t.dependencies={lanes:0,firstContext:n},t.flags|=524288}else ha=ha.next=n;return l}var Mk=typeof AbortController<"u"?AbortController:function(){var t=[],n=this.signal={aborted:!1,addEventListener:function(l,u){t.push(u)}};this.abort=function(){n.aborted=!0,t.forEach(function(l){return l()})}},Ak=e.unstable_scheduleCallback,Rk=e.unstable_NormalPriority,wt={$$typeof:M,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function bc(){return{controller:new Mk,data:new Map,refCount:0}}function si(t){t.refCount--,t.refCount===0&&Ak(Rk,function(){t.controller.abort()})}var oi=null,kc=0,pl=0,gl=null;function _k(t,n){if(oi===null){var l=oi=[];kc=0,pl=jd(),gl={status:"pending",value:void 0,then:function(u){l.push(u)}}}return kc++,n.then(hp,hp),n}function hp(){if(--kc===0&&oi!==null){gl!==null&&(gl.status="fulfilled");var t=oi;oi=null,pl=0,gl=null;for(var n=0;n<t.length;n++)(0,t[n])()}}function zk(t,n){var l=[],u={status:"pending",value:null,reason:null,then:function(p){l.push(p)}};return t.then(function(){u.status="fulfilled",u.value=n;for(var p=0;p<l.length;p++)(0,l[p])(n)},function(p){for(u.status="rejected",u.reason=p,p=0;p<l.length;p++)(0,l[p])(void 0)}),u}var pp=L.S;L.S=function(t,n){Z0=ct(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&_k(t,n),pp!==null&&pp(t,n)};var Nr=z(null);function wc(){var t=Nr.current;return t!==null?t:at.pooledCache}function Hs(t,n){n===null?C(Nr,Nr.current):C(Nr,n.pool)}function gp(){var t=wc();return t===null?null:{parent:wt._currentValue,pool:t}}var xl=Error(i(460)),Sc=Error(i(474)),Ps=Error(i(542)),qs={then:function(){}};function xp(t){return t=t.status,t==="fulfilled"||t==="rejected"}function yp(t,n,l){switch(l=t[l],l===void 0?t.push(n):l!==n&&(n.then(ca,ca),n=l),n.status){case"fulfilled":return n.value;case"rejected":throw t=n.reason,bp(t),t;default:if(typeof n.status=="string")n.then(ca,ca);else{if(t=at,t!==null&&100<t.shellSuspendCounter)throw Error(i(482));t=n,t.status="pending",t.then(function(u){if(n.status==="pending"){var p=n;p.status="fulfilled",p.value=u}},function(u){if(n.status==="pending"){var p=n;p.status="rejected",p.reason=u}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw t=n.reason,bp(t),t}throw Er=n,xl}}function Cr(t){try{var n=t._init;return n(t._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(Er=l,xl):l}}var Er=null;function vp(){if(Er===null)throw Error(i(459));var t=Er;return Er=null,t}function bp(t){if(t===xl||t===Ps)throw Error(i(483))}var yl=null,ui=0;function Fs(t){var n=ui;return ui+=1,yl===null&&(yl=[]),yp(yl,t,n)}function ci(t,n){n=n.props.ref,t.ref=n!==void 0?n:null}function Vs(t,n){throw n.$$typeof===b?Error(i(525)):(t=Object.prototype.toString.call(n),Error(i(31,t==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":t)))}function kp(t){function n(V,q){if(t){var X=V.deletions;X===null?(V.deletions=[q],V.flags|=16):X.push(q)}}function l(V,q){if(!t)return null;for(;q!==null;)n(V,q),q=q.sibling;return null}function u(V){for(var q=new Map;V!==null;)V.key!==null?q.set(V.key,V):q.set(V.index,V),V=V.sibling;return q}function p(V,q){return V=fa(V,q),V.index=0,V.sibling=null,V}function x(V,q,X){return V.index=X,t?(X=V.alternate,X!==null?(X=X.index,X<q?(V.flags|=67108866,q):X):(V.flags|=67108866,q)):(V.flags|=1048576,q)}function S(V){return t&&V.alternate===null&&(V.flags|=67108866),V}function E(V,q,X,de){return q===null||q.tag!==6?(q=dc(X,V.mode,de),q.return=V,q):(q=p(q,X),q.return=V,q)}function H(V,q,X,de){var je=X.type;return je===A?oe(V,q,X.props.children,de,X.key):q!==null&&(q.elementType===je||typeof je=="object"&&je!==null&&je.$$typeof===W&&Cr(je)===q.type)?(q=p(q,X.props),ci(q,X),q.return=V,q):(q=Is(X.type,X.key,X.props,null,V.mode,de),ci(q,X),q.return=V,q)}function Q(V,q,X,de){return q===null||q.tag!==4||q.stateNode.containerInfo!==X.containerInfo||q.stateNode.implementation!==X.implementation?(q=fc(X,V.mode,de),q.return=V,q):(q=p(q,X.children||[]),q.return=V,q)}function oe(V,q,X,de,je){return q===null||q.tag!==7?(q=kr(X,V.mode,de,je),q.return=V,q):(q=p(q,X),q.return=V,q)}function fe(V,q,X){if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return q=dc(""+q,V.mode,X),q.return=V,q;if(typeof q=="object"&&q!==null){switch(q.$$typeof){case w:return X=Is(q.type,q.key,q.props,null,V.mode,X),ci(X,q),X.return=V,X;case N:return q=fc(q,V.mode,X),q.return=V,q;case W:return q=Cr(q),fe(V,q,X)}if(F(q)||D(q))return q=kr(q,V.mode,X,null),q.return=V,q;if(typeof q.then=="function")return fe(V,Fs(q),X);if(q.$$typeof===M)return fe(V,Bs(V,q),X);Vs(V,q)}return null}function Z(V,q,X,de){var je=q!==null?q.key:null;if(typeof X=="string"&&X!==""||typeof X=="number"||typeof X=="bigint")return je!==null?null:E(V,q,""+X,de);if(typeof X=="object"&&X!==null){switch(X.$$typeof){case w:return X.key===je?H(V,q,X,de):null;case N:return X.key===je?Q(V,q,X,de):null;case W:return X=Cr(X),Z(V,q,X,de)}if(F(X)||D(X))return je!==null?null:oe(V,q,X,de,null);if(typeof X.then=="function")return Z(V,q,Fs(X),de);if(X.$$typeof===M)return Z(V,q,Bs(V,X),de);Vs(V,X)}return null}function le(V,q,X,de,je){if(typeof de=="string"&&de!==""||typeof de=="number"||typeof de=="bigint")return V=V.get(X)||null,E(q,V,""+de,je);if(typeof de=="object"&&de!==null){switch(de.$$typeof){case w:return V=V.get(de.key===null?X:de.key)||null,H(q,V,de,je);case N:return V=V.get(de.key===null?X:de.key)||null,Q(q,V,de,je);case W:return de=Cr(de),le(V,q,X,de,je)}if(F(de)||D(de))return V=V.get(X)||null,oe(q,V,de,je,null);if(typeof de.then=="function")return le(V,q,X,Fs(de),je);if(de.$$typeof===M)return le(V,q,X,Bs(q,de),je);Vs(q,de)}return null}function be(V,q,X,de){for(var je=null,Ye=null,ke=q,Oe=q=0,Pe=null;ke!==null&&Oe<X.length;Oe++){ke.index>Oe?(Pe=ke,ke=null):Pe=ke.sibling;var Ge=Z(V,ke,X[Oe],de);if(Ge===null){ke===null&&(ke=Pe);break}t&&ke&&Ge.alternate===null&&n(V,ke),q=x(Ge,q,Oe),Ye===null?je=Ge:Ye.sibling=Ge,Ye=Ge,ke=Pe}if(Oe===X.length)return l(V,ke),Fe&&ma(V,Oe),je;if(ke===null){for(;Oe<X.length;Oe++)ke=fe(V,X[Oe],de),ke!==null&&(q=x(ke,q,Oe),Ye===null?je=ke:Ye.sibling=ke,Ye=ke);return Fe&&ma(V,Oe),je}for(ke=u(ke);Oe<X.length;Oe++)Pe=le(ke,V,Oe,X[Oe],de),Pe!==null&&(t&&Pe.alternate!==null&&ke.delete(Pe.key===null?Oe:Pe.key),q=x(Pe,q,Oe),Ye===null?je=Pe:Ye.sibling=Pe,Ye=Pe);return t&&ke.forEach(function(lr){return n(V,lr)}),Fe&&ma(V,Oe),je}function Te(V,q,X,de){if(X==null)throw Error(i(151));for(var je=null,Ye=null,ke=q,Oe=q=0,Pe=null,Ge=X.next();ke!==null&&!Ge.done;Oe++,Ge=X.next()){ke.index>Oe?(Pe=ke,ke=null):Pe=ke.sibling;var lr=Z(V,ke,Ge.value,de);if(lr===null){ke===null&&(ke=Pe);break}t&&ke&&lr.alternate===null&&n(V,ke),q=x(lr,q,Oe),Ye===null?je=lr:Ye.sibling=lr,Ye=lr,ke=Pe}if(Ge.done)return l(V,ke),Fe&&ma(V,Oe),je;if(ke===null){for(;!Ge.done;Oe++,Ge=X.next())Ge=fe(V,Ge.value,de),Ge!==null&&(q=x(Ge,q,Oe),Ye===null?je=Ge:Ye.sibling=Ge,Ye=Ge);return Fe&&ma(V,Oe),je}for(ke=u(ke);!Ge.done;Oe++,Ge=X.next())Ge=le(ke,V,Oe,Ge.value,de),Ge!==null&&(t&&Ge.alternate!==null&&ke.delete(Ge.key===null?Oe:Ge.key),q=x(Ge,q,Oe),Ye===null?je=Ge:Ye.sibling=Ge,Ye=Ge);return t&&ke.forEach(function(F2){return n(V,F2)}),Fe&&ma(V,Oe),je}function nt(V,q,X,de){if(typeof X=="object"&&X!==null&&X.type===A&&X.key===null&&(X=X.props.children),typeof X=="object"&&X!==null){switch(X.$$typeof){case w:e:{for(var je=X.key;q!==null;){if(q.key===je){if(je=X.type,je===A){if(q.tag===7){l(V,q.sibling),de=p(q,X.props.children),de.return=V,V=de;break e}}else if(q.elementType===je||typeof je=="object"&&je!==null&&je.$$typeof===W&&Cr(je)===q.type){l(V,q.sibling),de=p(q,X.props),ci(de,X),de.return=V,V=de;break e}l(V,q);break}else n(V,q);q=q.sibling}X.type===A?(de=kr(X.props.children,V.mode,de,X.key),de.return=V,V=de):(de=Is(X.type,X.key,X.props,null,V.mode,de),ci(de,X),de.return=V,V=de)}return S(V);case N:e:{for(je=X.key;q!==null;){if(q.key===je)if(q.tag===4&&q.stateNode.containerInfo===X.containerInfo&&q.stateNode.implementation===X.implementation){l(V,q.sibling),de=p(q,X.children||[]),de.return=V,V=de;break e}else{l(V,q);break}else n(V,q);q=q.sibling}de=fc(X,V.mode,de),de.return=V,V=de}return S(V);case W:return X=Cr(X),nt(V,q,X,de)}if(F(X))return be(V,q,X,de);if(D(X)){if(je=D(X),typeof je!="function")throw Error(i(150));return X=je.call(X),Te(V,q,X,de)}if(typeof X.then=="function")return nt(V,q,Fs(X),de);if(X.$$typeof===M)return nt(V,q,Bs(V,X),de);Vs(V,X)}return typeof X=="string"&&X!==""||typeof X=="number"||typeof X=="bigint"?(X=""+X,q!==null&&q.tag===6?(l(V,q.sibling),de=p(q,X),de.return=V,V=de):(l(V,q),de=dc(X,V.mode,de),de.return=V,V=de),S(V)):l(V,q)}return function(V,q,X,de){try{ui=0;var je=nt(V,q,X,de);return yl=null,je}catch(ke){if(ke===xl||ke===Ps)throw ke;var Ye=gn(29,ke,null,V.mode);return Ye.lanes=de,Ye.return=V,Ye}}}var Tr=kp(!0),wp=kp(!1),Pa=!1;function jc(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Nc(t,n){t=t.updateQueue,n.updateQueue===t&&(n.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function qa(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function Fa(t,n,l){var u=t.updateQueue;if(u===null)return null;if(u=u.shared,(Ke&2)!==0){var p=u.pending;return p===null?n.next=n:(n.next=p.next,p.next=n),u.pending=n,n=Os(t),lp(t,null,l),n}return Ls(t,u,n,l),Os(t)}function di(t,n,l){if(n=n.updateQueue,n!==null&&(n=n.shared,(l&4194048)!==0)){var u=n.lanes;u&=t.pendingLanes,l|=u,n.lanes=l,mh(t,l)}}function Cc(t,n){var l=t.updateQueue,u=t.alternate;if(u!==null&&(u=u.updateQueue,l===u)){var p=null,x=null;if(l=l.firstBaseUpdate,l!==null){do{var S={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};x===null?p=x=S:x=x.next=S,l=l.next}while(l!==null);x===null?p=x=n:x=x.next=n}else p=x=n;l={baseState:u.baseState,firstBaseUpdate:p,lastBaseUpdate:x,shared:u.shared,callbacks:u.callbacks},t.updateQueue=l;return}t=l.lastBaseUpdate,t===null?l.firstBaseUpdate=n:t.next=n,l.lastBaseUpdate=n}var Ec=!1;function fi(){if(Ec){var t=gl;if(t!==null)throw t}}function mi(t,n,l,u){Ec=!1;var p=t.updateQueue;Pa=!1;var x=p.firstBaseUpdate,S=p.lastBaseUpdate,E=p.shared.pending;if(E!==null){p.shared.pending=null;var H=E,Q=H.next;H.next=null,S===null?x=Q:S.next=Q,S=H;var oe=t.alternate;oe!==null&&(oe=oe.updateQueue,E=oe.lastBaseUpdate,E!==S&&(E===null?oe.firstBaseUpdate=Q:E.next=Q,oe.lastBaseUpdate=H))}if(x!==null){var fe=p.baseState;S=0,oe=Q=H=null,E=x;do{var Z=E.lane&-536870913,le=Z!==E.lane;if(le?(He&Z)===Z:(u&Z)===Z){Z!==0&&Z===pl&&(Ec=!0),oe!==null&&(oe=oe.next={lane:0,tag:E.tag,payload:E.payload,callback:null,next:null});e:{var be=t,Te=E;Z=n;var nt=l;switch(Te.tag){case 1:if(be=Te.payload,typeof be=="function"){fe=be.call(nt,fe,Z);break e}fe=be;break e;case 3:be.flags=be.flags&-65537|128;case 0:if(be=Te.payload,Z=typeof be=="function"?be.call(nt,fe,Z):be,Z==null)break e;fe=y({},fe,Z);break e;case 2:Pa=!0}}Z=E.callback,Z!==null&&(t.flags|=64,le&&(t.flags|=8192),le=p.callbacks,le===null?p.callbacks=[Z]:le.push(Z))}else le={lane:Z,tag:E.tag,payload:E.payload,callback:E.callback,next:null},oe===null?(Q=oe=le,H=fe):oe=oe.next=le,S|=Z;if(E=E.next,E===null){if(E=p.shared.pending,E===null)break;le=E,E=le.next,le.next=null,p.lastBaseUpdate=le,p.shared.pending=null}}while(!0);oe===null&&(H=fe),p.baseState=H,p.firstBaseUpdate=Q,p.lastBaseUpdate=oe,x===null&&(p.shared.lanes=0),Wa|=S,t.lanes=S,t.memoizedState=fe}}function Sp(t,n){if(typeof t!="function")throw Error(i(191,t));t.call(n)}function jp(t,n){var l=t.callbacks;if(l!==null)for(t.callbacks=null,t=0;t<l.length;t++)Sp(l[t],n)}var vl=z(null),Ys=z(0);function Np(t,n){t=ja,C(Ys,t),C(vl,n),ja=t|n.baseLanes}function Tc(){C(Ys,ja),C(vl,vl.current)}function Mc(){ja=Ys.current,B(vl),B(Ys)}var xn=z(null),Ln=null;function Va(t){var n=t.alternate;C(xt,xt.current&1),C(xn,t),Ln===null&&(n===null||vl.current!==null||n.memoizedState!==null)&&(Ln=t)}function Ac(t){C(xt,xt.current),C(xn,t),Ln===null&&(Ln=t)}function Cp(t){t.tag===22?(C(xt,xt.current),C(xn,t),Ln===null&&(Ln=t)):Ya()}function Ya(){C(xt,xt.current),C(xn,xn.current)}function yn(t){B(xn),Ln===t&&(Ln=null),B(xt)}var xt=z(0);function Gs(t){for(var n=t;n!==null;){if(n.tag===13){var l=n.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||Od(l)||Id(l)))return n}else if(n.tag===19&&(n.memoizedProps.revealOrder==="forwards"||n.memoizedProps.revealOrder==="backwards"||n.memoizedProps.revealOrder==="unstable_legacy-backwards"||n.memoizedProps.revealOrder==="together")){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var ga=0,Le=null,et=null,St=null,Ks=!1,bl=!1,Mr=!1,Ws=0,hi=0,kl=null,Dk=0;function pt(){throw Error(i(321))}function Rc(t,n){if(n===null)return!1;for(var l=0;l<n.length&&l<t.length;l++)if(!pn(t[l],n[l]))return!1;return!0}function _c(t,n,l,u,p,x){return ga=x,Le=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,L.H=t===null||t.memoizedState===null?u0:Gc,Mr=!1,x=l(u,p),Mr=!1,bl&&(x=Tp(n,l,u,p)),Ep(t),x}function Ep(t){L.H=xi;var n=et!==null&&et.next!==null;if(ga=0,St=et=Le=null,Ks=!1,hi=0,kl=null,n)throw Error(i(300));t===null||jt||(t=t.dependencies,t!==null&&$s(t)&&(jt=!0))}function Tp(t,n,l,u){Le=t;var p=0;do{if(bl&&(kl=null),hi=0,bl=!1,25<=p)throw Error(i(301));if(p+=1,St=et=null,t.updateQueue!=null){var x=t.updateQueue;x.lastEffect=null,x.events=null,x.stores=null,x.memoCache!=null&&(x.memoCache.index=0)}L.H=c0,x=n(l,u)}while(bl);return x}function Lk(){var t=L.H,n=t.useState()[0];return n=typeof n.then=="function"?pi(n):n,t=t.useState()[0],(et!==null?et.memoizedState:null)!==t&&(Le.flags|=1024),n}function zc(){var t=Ws!==0;return Ws=0,t}function Dc(t,n,l){n.updateQueue=t.updateQueue,n.flags&=-2053,t.lanes&=~l}function Lc(t){if(Ks){for(t=t.memoizedState;t!==null;){var n=t.queue;n!==null&&(n.pending=null),t=t.next}Ks=!1}ga=0,St=et=Le=null,bl=!1,hi=Ws=0,kl=null}function Xt(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return St===null?Le.memoizedState=St=t:St=St.next=t,St}function yt(){if(et===null){var t=Le.alternate;t=t!==null?t.memoizedState:null}else t=et.next;var n=St===null?Le.memoizedState:St.next;if(n!==null)St=n,et=t;else{if(t===null)throw Le.alternate===null?Error(i(467)):Error(i(310));et=t,t={memoizedState:et.memoizedState,baseState:et.baseState,baseQueue:et.baseQueue,queue:et.queue,next:null},St===null?Le.memoizedState=St=t:St=St.next=t}return St}function Xs(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function pi(t){var n=hi;return hi+=1,kl===null&&(kl=[]),t=yp(kl,t,n),n=Le,(St===null?n.memoizedState:St.next)===null&&(n=n.alternate,L.H=n===null||n.memoizedState===null?u0:Gc),t}function Qs(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return pi(t);if(t.$$typeof===M)return Bt(t)}throw Error(i(438,String(t)))}function Oc(t){var n=null,l=Le.updateQueue;if(l!==null&&(n=l.memoCache),n==null){var u=Le.alternate;u!==null&&(u=u.updateQueue,u!==null&&(u=u.memoCache,u!=null&&(n={data:u.data.map(function(p){return p.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),l===null&&(l=Xs(),Le.updateQueue=l),l.memoCache=n,l=n.data[n.index],l===void 0)for(l=n.data[n.index]=Array(t),u=0;u<t;u++)l[u]=P;return n.index++,l}function xa(t,n){return typeof n=="function"?n(t):n}function Zs(t){var n=yt();return Ic(n,et,t)}function Ic(t,n,l){var u=t.queue;if(u===null)throw Error(i(311));u.lastRenderedReducer=l;var p=t.baseQueue,x=u.pending;if(x!==null){if(p!==null){var S=p.next;p.next=x.next,x.next=S}n.baseQueue=p=x,u.pending=null}if(x=t.baseState,p===null)t.memoizedState=x;else{n=p.next;var E=S=null,H=null,Q=n,oe=!1;do{var fe=Q.lane&-536870913;if(fe!==Q.lane?(He&fe)===fe:(ga&fe)===fe){var Z=Q.revertLane;if(Z===0)H!==null&&(H=H.next={lane:0,revertLane:0,gesture:null,action:Q.action,hasEagerState:Q.hasEagerState,eagerState:Q.eagerState,next:null}),fe===pl&&(oe=!0);else if((ga&Z)===Z){Q=Q.next,Z===pl&&(oe=!0);continue}else fe={lane:0,revertLane:Q.revertLane,gesture:null,action:Q.action,hasEagerState:Q.hasEagerState,eagerState:Q.eagerState,next:null},H===null?(E=H=fe,S=x):H=H.next=fe,Le.lanes|=Z,Wa|=Z;fe=Q.action,Mr&&l(x,fe),x=Q.hasEagerState?Q.eagerState:l(x,fe)}else Z={lane:fe,revertLane:Q.revertLane,gesture:Q.gesture,action:Q.action,hasEagerState:Q.hasEagerState,eagerState:Q.eagerState,next:null},H===null?(E=H=Z,S=x):H=H.next=Z,Le.lanes|=fe,Wa|=fe;Q=Q.next}while(Q!==null&&Q!==n);if(H===null?S=x:H.next=E,!pn(x,t.memoizedState)&&(jt=!0,oe&&(l=gl,l!==null)))throw l;t.memoizedState=x,t.baseState=S,t.baseQueue=H,u.lastRenderedState=x}return p===null&&(u.lanes=0),[t.memoizedState,u.dispatch]}function Uc(t){var n=yt(),l=n.queue;if(l===null)throw Error(i(311));l.lastRenderedReducer=t;var u=l.dispatch,p=l.pending,x=n.memoizedState;if(p!==null){l.pending=null;var S=p=p.next;do x=t(x,S.action),S=S.next;while(S!==p);pn(x,n.memoizedState)||(jt=!0),n.memoizedState=x,n.baseQueue===null&&(n.baseState=x),l.lastRenderedState=x}return[x,u]}function Mp(t,n,l){var u=Le,p=yt(),x=Fe;if(x){if(l===void 0)throw Error(i(407));l=l()}else l=n();var S=!pn((et||p).memoizedState,l);if(S&&(p.memoizedState=l,jt=!0),p=p.queue,Hc(_p.bind(null,u,p,t),[t]),p.getSnapshot!==n||S||St!==null&&St.memoizedState.tag&1){if(u.flags|=2048,wl(9,{destroy:void 0},Rp.bind(null,u,p,l,n),null),at===null)throw Error(i(349));x||(ga&127)!==0||Ap(u,n,l)}return l}function Ap(t,n,l){t.flags|=16384,t={getSnapshot:n,value:l},n=Le.updateQueue,n===null?(n=Xs(),Le.updateQueue=n,n.stores=[t]):(l=n.stores,l===null?n.stores=[t]:l.push(t))}function Rp(t,n,l,u){n.value=l,n.getSnapshot=u,zp(n)&&Dp(t)}function _p(t,n,l){return l(function(){zp(n)&&Dp(t)})}function zp(t){var n=t.getSnapshot;t=t.value;try{var l=n();return!pn(t,l)}catch{return!0}}function Dp(t){var n=br(t,2);n!==null&&on(n,t,2)}function $c(t){var n=Xt();if(typeof t=="function"){var l=t;if(t=l(),Mr){Re(!0);try{l()}finally{Re(!1)}}}return n.memoizedState=n.baseState=t,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:xa,lastRenderedState:t},n}function Lp(t,n,l,u){return t.baseState=l,Ic(t,et,typeof u=="function"?u:xa)}function Ok(t,n,l,u,p){if(to(t))throw Error(i(485));if(t=n.action,t!==null){var x={payload:p,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(S){x.listeners.push(S)}};L.T!==null?l(!0):x.isTransition=!1,u(x),l=n.pending,l===null?(x.next=n.pending=x,Op(n,x)):(x.next=l.next,n.pending=l.next=x)}}function Op(t,n){var l=n.action,u=n.payload,p=t.state;if(n.isTransition){var x=L.T,S={};L.T=S;try{var E=l(p,u),H=L.S;H!==null&&H(S,E),Ip(t,n,E)}catch(Q){Bc(t,n,Q)}finally{x!==null&&S.types!==null&&(x.types=S.types),L.T=x}}else try{x=l(p,u),Ip(t,n,x)}catch(Q){Bc(t,n,Q)}}function Ip(t,n,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(u){Up(t,n,u)},function(u){return Bc(t,n,u)}):Up(t,n,l)}function Up(t,n,l){n.status="fulfilled",n.value=l,$p(n),t.state=l,n=t.pending,n!==null&&(l=n.next,l===n?t.pending=null:(l=l.next,n.next=l,Op(t,l)))}function Bc(t,n,l){var u=t.pending;if(t.pending=null,u!==null){u=u.next;do n.status="rejected",n.reason=l,$p(n),n=n.next;while(n!==u)}t.action=null}function $p(t){t=t.listeners;for(var n=0;n<t.length;n++)(0,t[n])()}function Bp(t,n){return n}function Hp(t,n){if(Fe){var l=at.formState;if(l!==null){e:{var u=Le;if(Fe){if(it){t:{for(var p=it,x=Dn;p.nodeType!==8;){if(!x){p=null;break t}if(p=On(p.nextSibling),p===null){p=null;break t}}x=p.data,p=x==="F!"||x==="F"?p:null}if(p){it=On(p.nextSibling),u=p.data==="F!";break e}}Ba(u)}u=!1}u&&(n=l[0])}}return l=Xt(),l.memoizedState=l.baseState=n,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Bp,lastRenderedState:n},l.queue=u,l=i0.bind(null,Le,u),u.dispatch=l,u=$c(!1),x=Yc.bind(null,Le,!1,u.queue),u=Xt(),p={state:n,dispatch:null,action:t,pending:null},u.queue=p,l=Ok.bind(null,Le,p,x,l),p.dispatch=l,u.memoizedState=t,[n,l,!1]}function Pp(t){var n=yt();return qp(n,et,t)}function qp(t,n,l){if(n=Ic(t,n,Bp)[0],t=Zs(xa)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var u=pi(n)}catch(S){throw S===xl?Ps:S}else u=n;n=yt();var p=n.queue,x=p.dispatch;return l!==n.memoizedState&&(Le.flags|=2048,wl(9,{destroy:void 0},Ik.bind(null,p,l),null)),[u,x,t]}function Ik(t,n){t.action=n}function Fp(t){var n=yt(),l=et;if(l!==null)return qp(n,l,t);yt(),n=n.memoizedState,l=yt();var u=l.queue.dispatch;return l.memoizedState=t,[n,u,!1]}function wl(t,n,l,u){return t={tag:t,create:l,deps:u,inst:n,next:null},n=Le.updateQueue,n===null&&(n=Xs(),Le.updateQueue=n),l=n.lastEffect,l===null?n.lastEffect=t.next=t:(u=l.next,l.next=t,t.next=u,n.lastEffect=t),t}function Vp(){return yt().memoizedState}function Js(t,n,l,u){var p=Xt();Le.flags|=t,p.memoizedState=wl(1|n,{destroy:void 0},l,u===void 0?null:u)}function eo(t,n,l,u){var p=yt();u=u===void 0?null:u;var x=p.memoizedState.inst;et!==null&&u!==null&&Rc(u,et.memoizedState.deps)?p.memoizedState=wl(n,x,l,u):(Le.flags|=t,p.memoizedState=wl(1|n,x,l,u))}function Yp(t,n){Js(8390656,8,t,n)}function Hc(t,n){eo(2048,8,t,n)}function Uk(t){Le.flags|=4;var n=Le.updateQueue;if(n===null)n=Xs(),Le.updateQueue=n,n.events=[t];else{var l=n.events;l===null?n.events=[t]:l.push(t)}}function Gp(t){var n=yt().memoizedState;return Uk({ref:n,nextImpl:t}),function(){if((Ke&2)!==0)throw Error(i(440));return n.impl.apply(void 0,arguments)}}function Kp(t,n){return eo(4,2,t,n)}function Wp(t,n){return eo(4,4,t,n)}function Xp(t,n){if(typeof n=="function"){t=t();var l=n(t);return function(){typeof l=="function"?l():n(null)}}if(n!=null)return t=t(),n.current=t,function(){n.current=null}}function Qp(t,n,l){l=l!=null?l.concat([t]):null,eo(4,4,Xp.bind(null,n,t),l)}function Pc(){}function Zp(t,n){var l=yt();n=n===void 0?null:n;var u=l.memoizedState;return n!==null&&Rc(n,u[1])?u[0]:(l.memoizedState=[t,n],t)}function Jp(t,n){var l=yt();n=n===void 0?null:n;var u=l.memoizedState;if(n!==null&&Rc(n,u[1]))return u[0];if(u=t(),Mr){Re(!0);try{t()}finally{Re(!1)}}return l.memoizedState=[u,n],u}function qc(t,n,l){return l===void 0||(ga&1073741824)!==0&&(He&261930)===0?t.memoizedState=n:(t.memoizedState=l,t=eg(),Le.lanes|=t,Wa|=t,l)}function e0(t,n,l,u){return pn(l,n)?l:vl.current!==null?(t=qc(t,l,u),pn(t,n)||(jt=!0),t):(ga&42)===0||(ga&1073741824)!==0&&(He&261930)===0?(jt=!0,t.memoizedState=l):(t=eg(),Le.lanes|=t,Wa|=t,n)}function t0(t,n,l,u,p){var x=ae.p;ae.p=x!==0&&8>x?x:8;var S=L.T,E={};L.T=E,Yc(t,!1,n,l);try{var H=p(),Q=L.S;if(Q!==null&&Q(E,H),H!==null&&typeof H=="object"&&typeof H.then=="function"){var oe=zk(H,u);gi(t,n,oe,kn(t))}else gi(t,n,u,kn(t))}catch(fe){gi(t,n,{then:function(){},status:"rejected",reason:fe},kn())}finally{ae.p=x,S!==null&&E.types!==null&&(S.types=E.types),L.T=S}}function $k(){}function Fc(t,n,l,u){if(t.tag!==5)throw Error(i(476));var p=n0(t).queue;t0(t,p,n,ne,l===null?$k:function(){return a0(t),l(u)})}function n0(t){var n=t.memoizedState;if(n!==null)return n;n={memoizedState:ne,baseState:ne,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:xa,lastRenderedState:ne},next:null};var l={};return n.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:xa,lastRenderedState:l},next:null},t.memoizedState=n,t=t.alternate,t!==null&&(t.memoizedState=n),n}function a0(t){var n=n0(t);n.next===null&&(n=t.alternate.memoizedState),gi(t,n.next.queue,{},kn())}function Vc(){return Bt(zi)}function r0(){return yt().memoizedState}function l0(){return yt().memoizedState}function Bk(t){for(var n=t.return;n!==null;){switch(n.tag){case 24:case 3:var l=kn();t=qa(l);var u=Fa(n,t,l);u!==null&&(on(u,n,l),di(u,n,l)),n={cache:bc()},t.payload=n;return}n=n.return}}function Hk(t,n,l){var u=kn();l={lane:u,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},to(t)?s0(n,l):(l=uc(t,n,l,u),l!==null&&(on(l,t,u),o0(l,n,u)))}function i0(t,n,l){var u=kn();gi(t,n,l,u)}function gi(t,n,l,u){var p={lane:u,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(to(t))s0(n,p);else{var x=t.alternate;if(t.lanes===0&&(x===null||x.lanes===0)&&(x=n.lastRenderedReducer,x!==null))try{var S=n.lastRenderedState,E=x(S,l);if(p.hasEagerState=!0,p.eagerState=E,pn(E,S))return Ls(t,n,p,0),at===null&&Ds(),!1}catch{}if(l=uc(t,n,p,u),l!==null)return on(l,t,u),o0(l,n,u),!0}return!1}function Yc(t,n,l,u){if(u={lane:2,revertLane:jd(),gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},to(t)){if(n)throw Error(i(479))}else n=uc(t,l,u,2),n!==null&&on(n,t,2)}function to(t){var n=t.alternate;return t===Le||n!==null&&n===Le}function s0(t,n){bl=Ks=!0;var l=t.pending;l===null?n.next=n:(n.next=l.next,l.next=n),t.pending=n}function o0(t,n,l){if((l&4194048)!==0){var u=n.lanes;u&=t.pendingLanes,l|=u,n.lanes=l,mh(t,l)}}var xi={readContext:Bt,use:Qs,useCallback:pt,useContext:pt,useEffect:pt,useImperativeHandle:pt,useLayoutEffect:pt,useInsertionEffect:pt,useMemo:pt,useReducer:pt,useRef:pt,useState:pt,useDebugValue:pt,useDeferredValue:pt,useTransition:pt,useSyncExternalStore:pt,useId:pt,useHostTransitionStatus:pt,useFormState:pt,useActionState:pt,useOptimistic:pt,useMemoCache:pt,useCacheRefresh:pt};xi.useEffectEvent=pt;var u0={readContext:Bt,use:Qs,useCallback:function(t,n){return Xt().memoizedState=[t,n===void 0?null:n],t},useContext:Bt,useEffect:Yp,useImperativeHandle:function(t,n,l){l=l!=null?l.concat([t]):null,Js(4194308,4,Xp.bind(null,n,t),l)},useLayoutEffect:function(t,n){return Js(4194308,4,t,n)},useInsertionEffect:function(t,n){Js(4,2,t,n)},useMemo:function(t,n){var l=Xt();n=n===void 0?null:n;var u=t();if(Mr){Re(!0);try{t()}finally{Re(!1)}}return l.memoizedState=[u,n],u},useReducer:function(t,n,l){var u=Xt();if(l!==void 0){var p=l(n);if(Mr){Re(!0);try{l(n)}finally{Re(!1)}}}else p=n;return u.memoizedState=u.baseState=p,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:p},u.queue=t,t=t.dispatch=Hk.bind(null,Le,t),[u.memoizedState,t]},useRef:function(t){var n=Xt();return t={current:t},n.memoizedState=t},useState:function(t){t=$c(t);var n=t.queue,l=i0.bind(null,Le,n);return n.dispatch=l,[t.memoizedState,l]},useDebugValue:Pc,useDeferredValue:function(t,n){var l=Xt();return qc(l,t,n)},useTransition:function(){var t=$c(!1);return t=t0.bind(null,Le,t.queue,!0,!1),Xt().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,n,l){var u=Le,p=Xt();if(Fe){if(l===void 0)throw Error(i(407));l=l()}else{if(l=n(),at===null)throw Error(i(349));(He&127)!==0||Ap(u,n,l)}p.memoizedState=l;var x={value:l,getSnapshot:n};return p.queue=x,Yp(_p.bind(null,u,x,t),[t]),u.flags|=2048,wl(9,{destroy:void 0},Rp.bind(null,u,x,l,n),null),l},useId:function(){var t=Xt(),n=at.identifierPrefix;if(Fe){var l=ta,u=ea;l=(u&~(1<<32-ze(u)-1)).toString(32)+l,n="_"+n+"R_"+l,l=Ws++,0<l&&(n+="H"+l.toString(32)),n+="_"}else l=Dk++,n="_"+n+"r_"+l.toString(32)+"_";return t.memoizedState=n},useHostTransitionStatus:Vc,useFormState:Hp,useActionState:Hp,useOptimistic:function(t){var n=Xt();n.memoizedState=n.baseState=t;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=l,n=Yc.bind(null,Le,!0,l),l.dispatch=n,[t,n]},useMemoCache:Oc,useCacheRefresh:function(){return Xt().memoizedState=Bk.bind(null,Le)},useEffectEvent:function(t){var n=Xt(),l={impl:t};return n.memoizedState=l,function(){if((Ke&2)!==0)throw Error(i(440));return l.impl.apply(void 0,arguments)}}},Gc={readContext:Bt,use:Qs,useCallback:Zp,useContext:Bt,useEffect:Hc,useImperativeHandle:Qp,useInsertionEffect:Kp,useLayoutEffect:Wp,useMemo:Jp,useReducer:Zs,useRef:Vp,useState:function(){return Zs(xa)},useDebugValue:Pc,useDeferredValue:function(t,n){var l=yt();return e0(l,et.memoizedState,t,n)},useTransition:function(){var t=Zs(xa)[0],n=yt().memoizedState;return[typeof t=="boolean"?t:pi(t),n]},useSyncExternalStore:Mp,useId:r0,useHostTransitionStatus:Vc,useFormState:Pp,useActionState:Pp,useOptimistic:function(t,n){var l=yt();return Lp(l,et,t,n)},useMemoCache:Oc,useCacheRefresh:l0};Gc.useEffectEvent=Gp;var c0={readContext:Bt,use:Qs,useCallback:Zp,useContext:Bt,useEffect:Hc,useImperativeHandle:Qp,useInsertionEffect:Kp,useLayoutEffect:Wp,useMemo:Jp,useReducer:Uc,useRef:Vp,useState:function(){return Uc(xa)},useDebugValue:Pc,useDeferredValue:function(t,n){var l=yt();return et===null?qc(l,t,n):e0(l,et.memoizedState,t,n)},useTransition:function(){var t=Uc(xa)[0],n=yt().memoizedState;return[typeof t=="boolean"?t:pi(t),n]},useSyncExternalStore:Mp,useId:r0,useHostTransitionStatus:Vc,useFormState:Fp,useActionState:Fp,useOptimistic:function(t,n){var l=yt();return et!==null?Lp(l,et,t,n):(l.baseState=t,[t,l.queue.dispatch])},useMemoCache:Oc,useCacheRefresh:l0};c0.useEffectEvent=Gp;function Kc(t,n,l,u){n=t.memoizedState,l=l(u,n),l=l==null?n:y({},n,l),t.memoizedState=l,t.lanes===0&&(t.updateQueue.baseState=l)}var Wc={enqueueSetState:function(t,n,l){t=t._reactInternals;var u=kn(),p=qa(u);p.payload=n,l!=null&&(p.callback=l),n=Fa(t,p,u),n!==null&&(on(n,t,u),di(n,t,u))},enqueueReplaceState:function(t,n,l){t=t._reactInternals;var u=kn(),p=qa(u);p.tag=1,p.payload=n,l!=null&&(p.callback=l),n=Fa(t,p,u),n!==null&&(on(n,t,u),di(n,t,u))},enqueueForceUpdate:function(t,n){t=t._reactInternals;var l=kn(),u=qa(l);u.tag=2,n!=null&&(u.callback=n),n=Fa(t,u,l),n!==null&&(on(n,t,l),di(n,t,l))}};function d0(t,n,l,u,p,x,S){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(u,x,S):n.prototype&&n.prototype.isPureReactComponent?!ai(l,u)||!ai(p,x):!0}function f0(t,n,l,u){t=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(l,u),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(l,u),n.state!==t&&Wc.enqueueReplaceState(n,n.state,null)}function Ar(t,n){var l=n;if("ref"in n){l={};for(var u in n)u!=="ref"&&(l[u]=n[u])}if(t=t.defaultProps){l===n&&(l=y({},l));for(var p in t)l[p]===void 0&&(l[p]=t[p])}return l}function m0(t){zs(t)}function h0(t){console.error(t)}function p0(t){zs(t)}function no(t,n){try{var l=t.onUncaughtError;l(n.value,{componentStack:n.stack})}catch(u){setTimeout(function(){throw u})}}function g0(t,n,l){try{var u=t.onCaughtError;u(l.value,{componentStack:l.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(p){setTimeout(function(){throw p})}}function Xc(t,n,l){return l=qa(l),l.tag=3,l.payload={element:null},l.callback=function(){no(t,n)},l}function x0(t){return t=qa(t),t.tag=3,t}function y0(t,n,l,u){var p=l.type.getDerivedStateFromError;if(typeof p=="function"){var x=u.value;t.payload=function(){return p(x)},t.callback=function(){g0(n,l,u)}}var S=l.stateNode;S!==null&&typeof S.componentDidCatch=="function"&&(t.callback=function(){g0(n,l,u),typeof p!="function"&&(Xa===null?Xa=new Set([this]):Xa.add(this));var E=u.stack;this.componentDidCatch(u.value,{componentStack:E!==null?E:""})})}function Pk(t,n,l,u,p){if(l.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){if(n=l.alternate,n!==null&&hl(n,l,p,!0),l=xn.current,l!==null){switch(l.tag){case 31:case 13:return Ln===null?po():l.alternate===null&>===0&&(gt=3),l.flags&=-257,l.flags|=65536,l.lanes=p,u===qs?l.flags|=16384:(n=l.updateQueue,n===null?l.updateQueue=new Set([u]):n.add(u),kd(t,u,p)),!1;case 22:return l.flags|=65536,u===qs?l.flags|=16384:(n=l.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([u])},l.updateQueue=n):(l=n.retryQueue,l===null?n.retryQueue=new Set([u]):l.add(u)),kd(t,u,p)),!1}throw Error(i(435,l.tag))}return kd(t,u,p),po(),!1}if(Fe)return n=xn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=p,u!==pc&&(t=Error(i(422),{cause:u}),ii(Rn(t,l)))):(u!==pc&&(n=Error(i(423),{cause:u}),ii(Rn(n,l))),t=t.current.alternate,t.flags|=65536,p&=-p,t.lanes|=p,u=Rn(u,l),p=Xc(t.stateNode,u,p),Cc(t,p),gt!==4&&(gt=2)),!1;var x=Error(i(520),{cause:u});if(x=Rn(x,l),Ni===null?Ni=[x]:Ni.push(x),gt!==4&&(gt=2),n===null)return!0;u=Rn(u,l),l=n;do{switch(l.tag){case 3:return l.flags|=65536,t=p&-p,l.lanes|=t,t=Xc(l.stateNode,u,t),Cc(l,t),!1;case 1:if(n=l.type,x=l.stateNode,(l.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(Xa===null||!Xa.has(x))))return l.flags|=65536,p&=-p,l.lanes|=p,p=x0(p),y0(p,t,l,u),Cc(l,p),!1}l=l.return}while(l!==null);return!1}var Qc=Error(i(461)),jt=!1;function Ht(t,n,l,u){n.child=t===null?wp(n,null,l,u):Tr(n,t.child,l,u)}function v0(t,n,l,u,p){l=l.render;var x=n.ref;if("ref"in u){var S={};for(var E in u)E!=="ref"&&(S[E]=u[E])}else S=u;return jr(n),u=_c(t,n,l,S,x,p),E=zc(),t!==null&&!jt?(Dc(t,n,p),ya(t,n,p)):(Fe&&E&&mc(n),n.flags|=1,Ht(t,n,u,p),n.child)}function b0(t,n,l,u,p){if(t===null){var x=l.type;return typeof x=="function"&&!cc(x)&&x.defaultProps===void 0&&l.compare===null?(n.tag=15,n.type=x,k0(t,n,x,u,p)):(t=Is(l.type,null,u,n,n.mode,p),t.ref=n.ref,t.return=n,n.child=t)}if(x=t.child,!ld(t,p)){var S=x.memoizedProps;if(l=l.compare,l=l!==null?l:ai,l(S,u)&&t.ref===n.ref)return ya(t,n,p)}return n.flags|=1,t=fa(x,u),t.ref=n.ref,t.return=n,n.child=t}function k0(t,n,l,u,p){if(t!==null){var x=t.memoizedProps;if(ai(x,u)&&t.ref===n.ref)if(jt=!1,n.pendingProps=u=x,ld(t,p))(t.flags&131072)!==0&&(jt=!0);else return n.lanes=t.lanes,ya(t,n,p)}return Zc(t,n,l,u,p)}function w0(t,n,l,u){var p=u.children,x=t!==null?t.memoizedState:null;if(t===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),u.mode==="hidden"){if((n.flags&128)!==0){if(x=x!==null?x.baseLanes|l:l,t!==null){for(u=n.child=t.child,p=0;u!==null;)p=p|u.lanes|u.childLanes,u=u.sibling;u=p&~x}else u=0,n.child=null;return S0(t,n,x,l,u)}if((l&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},t!==null&&Hs(n,x!==null?x.cachePool:null),x!==null?Np(n,x):Tc(),Cp(n);else return u=n.lanes=536870912,S0(t,n,x!==null?x.baseLanes|l:l,l,u)}else x!==null?(Hs(n,x.cachePool),Np(n,x),Ya(),n.memoizedState=null):(t!==null&&Hs(n,null),Tc(),Ya());return Ht(t,n,p,l),n.child}function yi(t,n){return t!==null&&t.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function S0(t,n,l,u,p){var x=wc();return x=x===null?null:{parent:wt._currentValue,pool:x},n.memoizedState={baseLanes:l,cachePool:x},t!==null&&Hs(n,null),Tc(),Cp(n),t!==null&&hl(t,n,u,!0),n.childLanes=p,null}function ao(t,n){return n=lo({mode:n.mode,children:n.children},t.mode),n.ref=t.ref,t.child=n,n.return=t,n}function j0(t,n,l){return Tr(n,t.child,null,l),t=ao(n,n.pendingProps),t.flags|=2,yn(n),n.memoizedState=null,t}function qk(t,n,l){var u=n.pendingProps,p=(n.flags&128)!==0;if(n.flags&=-129,t===null){if(Fe){if(u.mode==="hidden")return t=ao(n,u),n.lanes=536870912,yi(null,t);if(Ac(n),(t=it)?(t=Og(t,Dn),t=t!==null&&t.data==="&"?t:null,t!==null&&(n.memoizedState={dehydrated:t,treeContext:Ua!==null?{id:ea,overflow:ta}:null,retryLane:536870912,hydrationErrors:null},l=sp(t),l.return=n,n.child=l,$t=n,it=null)):t=null,t===null)throw Ba(n);return n.lanes=536870912,null}return ao(n,u)}var x=t.memoizedState;if(x!==null){var S=x.dehydrated;if(Ac(n),p)if(n.flags&256)n.flags&=-257,n=j0(t,n,l);else if(n.memoizedState!==null)n.child=t.child,n.flags|=128,n=null;else throw Error(i(558));else if(jt||hl(t,n,l,!1),p=(l&t.childLanes)!==0,jt||p){if(u=at,u!==null&&(S=hh(u,l),S!==0&&S!==x.retryLane))throw x.retryLane=S,br(t,S),on(u,t,S),Qc;po(),n=j0(t,n,l)}else t=x.treeContext,it=On(S.nextSibling),$t=n,Fe=!0,$a=null,Dn=!1,t!==null&&cp(n,t),n=ao(n,u),n.flags|=4096;return n}return t=fa(t.child,{mode:u.mode,children:u.children}),t.ref=n.ref,n.child=t,t.return=n,t}function ro(t,n){var l=n.ref;if(l===null)t!==null&&t.ref!==null&&(n.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(i(284));(t===null||t.ref!==l)&&(n.flags|=4194816)}}function Zc(t,n,l,u,p){return jr(n),l=_c(t,n,l,u,void 0,p),u=zc(),t!==null&&!jt?(Dc(t,n,p),ya(t,n,p)):(Fe&&u&&mc(n),n.flags|=1,Ht(t,n,l,p),n.child)}function N0(t,n,l,u,p,x){return jr(n),n.updateQueue=null,l=Tp(n,u,l,p),Ep(t),u=zc(),t!==null&&!jt?(Dc(t,n,x),ya(t,n,x)):(Fe&&u&&mc(n),n.flags|=1,Ht(t,n,l,x),n.child)}function C0(t,n,l,u,p){if(jr(n),n.stateNode===null){var x=cl,S=l.contextType;typeof S=="object"&&S!==null&&(x=Bt(S)),x=new l(u,x),n.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,x.updater=Wc,n.stateNode=x,x._reactInternals=n,x=n.stateNode,x.props=u,x.state=n.memoizedState,x.refs={},jc(n),S=l.contextType,x.context=typeof S=="object"&&S!==null?Bt(S):cl,x.state=n.memoizedState,S=l.getDerivedStateFromProps,typeof S=="function"&&(Kc(n,l,S,u),x.state=n.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof x.getSnapshotBeforeUpdate=="function"||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(S=x.state,typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount(),S!==x.state&&Wc.enqueueReplaceState(x,x.state,null),mi(n,u,x,p),fi(),x.state=n.memoizedState),typeof x.componentDidMount=="function"&&(n.flags|=4194308),u=!0}else if(t===null){x=n.stateNode;var E=n.memoizedProps,H=Ar(l,E);x.props=H;var Q=x.context,oe=l.contextType;S=cl,typeof oe=="object"&&oe!==null&&(S=Bt(oe));var fe=l.getDerivedStateFromProps;oe=typeof fe=="function"||typeof x.getSnapshotBeforeUpdate=="function",E=n.pendingProps!==E,oe||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(E||Q!==S)&&f0(n,x,u,S),Pa=!1;var Z=n.memoizedState;x.state=Z,mi(n,u,x,p),fi(),Q=n.memoizedState,E||Z!==Q||Pa?(typeof fe=="function"&&(Kc(n,l,fe,u),Q=n.memoizedState),(H=Pa||d0(n,l,H,u,Z,Q,S))?(oe||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount()),typeof x.componentDidMount=="function"&&(n.flags|=4194308)):(typeof x.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=u,n.memoizedState=Q),x.props=u,x.state=Q,x.context=S,u=H):(typeof x.componentDidMount=="function"&&(n.flags|=4194308),u=!1)}else{x=n.stateNode,Nc(t,n),S=n.memoizedProps,oe=Ar(l,S),x.props=oe,fe=n.pendingProps,Z=x.context,Q=l.contextType,H=cl,typeof Q=="object"&&Q!==null&&(H=Bt(Q)),E=l.getDerivedStateFromProps,(Q=typeof E=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(S!==fe||Z!==H)&&f0(n,x,u,H),Pa=!1,Z=n.memoizedState,x.state=Z,mi(n,u,x,p),fi();var le=n.memoizedState;S!==fe||Z!==le||Pa||t!==null&&t.dependencies!==null&&$s(t.dependencies)?(typeof E=="function"&&(Kc(n,l,E,u),le=n.memoizedState),(oe=Pa||d0(n,l,oe,u,Z,le,H)||t!==null&&t.dependencies!==null&&$s(t.dependencies))?(Q||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(u,le,H),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(u,le,H)),typeof x.componentDidUpdate=="function"&&(n.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof x.componentDidUpdate!="function"||S===t.memoizedProps&&Z===t.memoizedState||(n.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||S===t.memoizedProps&&Z===t.memoizedState||(n.flags|=1024),n.memoizedProps=u,n.memoizedState=le),x.props=u,x.state=le,x.context=H,u=oe):(typeof x.componentDidUpdate!="function"||S===t.memoizedProps&&Z===t.memoizedState||(n.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||S===t.memoizedProps&&Z===t.memoizedState||(n.flags|=1024),u=!1)}return x=u,ro(t,n),u=(n.flags&128)!==0,x||u?(x=n.stateNode,l=u&&typeof l.getDerivedStateFromError!="function"?null:x.render(),n.flags|=1,t!==null&&u?(n.child=Tr(n,t.child,null,p),n.child=Tr(n,null,l,p)):Ht(t,n,l,p),n.memoizedState=x.state,t=n.child):t=ya(t,n,p),t}function E0(t,n,l,u){return wr(),n.flags|=256,Ht(t,n,l,u),n.child}var Jc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function ed(t){return{baseLanes:t,cachePool:gp()}}function td(t,n,l){return t=t!==null?t.childLanes&~l:0,n&&(t|=bn),t}function T0(t,n,l){var u=n.pendingProps,p=!1,x=(n.flags&128)!==0,S;if((S=x)||(S=t!==null&&t.memoizedState===null?!1:(xt.current&2)!==0),S&&(p=!0,n.flags&=-129),S=(n.flags&32)!==0,n.flags&=-33,t===null){if(Fe){if(p?Va(n):Ya(),(t=it)?(t=Og(t,Dn),t=t!==null&&t.data!=="&"?t:null,t!==null&&(n.memoizedState={dehydrated:t,treeContext:Ua!==null?{id:ea,overflow:ta}:null,retryLane:536870912,hydrationErrors:null},l=sp(t),l.return=n,n.child=l,$t=n,it=null)):t=null,t===null)throw Ba(n);return Id(t)?n.lanes=32:n.lanes=536870912,null}var E=u.children;return u=u.fallback,p?(Ya(),p=n.mode,E=lo({mode:"hidden",children:E},p),u=kr(u,p,l,null),E.return=n,u.return=n,E.sibling=u,n.child=E,u=n.child,u.memoizedState=ed(l),u.childLanes=td(t,S,l),n.memoizedState=Jc,yi(null,u)):(Va(n),nd(n,E))}var H=t.memoizedState;if(H!==null&&(E=H.dehydrated,E!==null)){if(x)n.flags&256?(Va(n),n.flags&=-257,n=ad(t,n,l)):n.memoizedState!==null?(Ya(),n.child=t.child,n.flags|=128,n=null):(Ya(),E=u.fallback,p=n.mode,u=lo({mode:"visible",children:u.children},p),E=kr(E,p,l,null),E.flags|=2,u.return=n,E.return=n,u.sibling=E,n.child=u,Tr(n,t.child,null,l),u=n.child,u.memoizedState=ed(l),u.childLanes=td(t,S,l),n.memoizedState=Jc,n=yi(null,u));else if(Va(n),Id(E)){if(S=E.nextSibling&&E.nextSibling.dataset,S)var Q=S.dgst;S=Q,u=Error(i(419)),u.stack="",u.digest=S,ii({value:u,source:null,stack:null}),n=ad(t,n,l)}else if(jt||hl(t,n,l,!1),S=(l&t.childLanes)!==0,jt||S){if(S=at,S!==null&&(u=hh(S,l),u!==0&&u!==H.retryLane))throw H.retryLane=u,br(t,u),on(S,t,u),Qc;Od(E)||po(),n=ad(t,n,l)}else Od(E)?(n.flags|=192,n.child=t.child,n=null):(t=H.treeContext,it=On(E.nextSibling),$t=n,Fe=!0,$a=null,Dn=!1,t!==null&&cp(n,t),n=nd(n,u.children),n.flags|=4096);return n}return p?(Ya(),E=u.fallback,p=n.mode,H=t.child,Q=H.sibling,u=fa(H,{mode:"hidden",children:u.children}),u.subtreeFlags=H.subtreeFlags&65011712,Q!==null?E=fa(Q,E):(E=kr(E,p,l,null),E.flags|=2),E.return=n,u.return=n,u.sibling=E,n.child=u,yi(null,u),u=n.child,E=t.child.memoizedState,E===null?E=ed(l):(p=E.cachePool,p!==null?(H=wt._currentValue,p=p.parent!==H?{parent:H,pool:H}:p):p=gp(),E={baseLanes:E.baseLanes|l,cachePool:p}),u.memoizedState=E,u.childLanes=td(t,S,l),n.memoizedState=Jc,yi(t.child,u)):(Va(n),l=t.child,t=l.sibling,l=fa(l,{mode:"visible",children:u.children}),l.return=n,l.sibling=null,t!==null&&(S=n.deletions,S===null?(n.deletions=[t],n.flags|=16):S.push(t)),n.child=l,n.memoizedState=null,l)}function nd(t,n){return n=lo({mode:"visible",children:n},t.mode),n.return=t,t.child=n}function lo(t,n){return t=gn(22,t,null,n),t.lanes=0,t}function ad(t,n,l){return Tr(n,t.child,null,l),t=nd(n,n.pendingProps.children),t.flags|=2,n.memoizedState=null,t}function M0(t,n,l){t.lanes|=n;var u=t.alternate;u!==null&&(u.lanes|=n),yc(t.return,n,l)}function rd(t,n,l,u,p,x){var S=t.memoizedState;S===null?t.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:u,tail:l,tailMode:p,treeForkCount:x}:(S.isBackwards=n,S.rendering=null,S.renderingStartTime=0,S.last=u,S.tail=l,S.tailMode=p,S.treeForkCount=x)}function A0(t,n,l){var u=n.pendingProps,p=u.revealOrder,x=u.tail;u=u.children;var S=xt.current,E=(S&2)!==0;if(E?(S=S&1|2,n.flags|=128):S&=1,C(xt,S),Ht(t,n,u,l),u=Fe?li:0,!E&&t!==null&&(t.flags&128)!==0)e:for(t=n.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&M0(t,l,n);else if(t.tag===19)M0(t,l,n);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===n)break e;for(;t.sibling===null;){if(t.return===null||t.return===n)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(p){case"forwards":for(l=n.child,p=null;l!==null;)t=l.alternate,t!==null&&Gs(t)===null&&(p=l),l=l.sibling;l=p,l===null?(p=n.child,n.child=null):(p=l.sibling,l.sibling=null),rd(n,!1,p,l,x,u);break;case"backwards":case"unstable_legacy-backwards":for(l=null,p=n.child,n.child=null;p!==null;){if(t=p.alternate,t!==null&&Gs(t)===null){n.child=p;break}t=p.sibling,p.sibling=l,l=p,p=t}rd(n,!0,l,null,x,u);break;case"together":rd(n,!1,null,null,void 0,u);break;default:n.memoizedState=null}return n.child}function ya(t,n,l){if(t!==null&&(n.dependencies=t.dependencies),Wa|=n.lanes,(l&n.childLanes)===0)if(t!==null){if(hl(t,n,l,!1),(l&n.childLanes)===0)return null}else return null;if(t!==null&&n.child!==t.child)throw Error(i(153));if(n.child!==null){for(t=n.child,l=fa(t,t.pendingProps),n.child=l,l.return=n;t.sibling!==null;)t=t.sibling,l=l.sibling=fa(t,t.pendingProps),l.return=n;l.sibling=null}return n.child}function ld(t,n){return(t.lanes&n)!==0?!0:(t=t.dependencies,!!(t!==null&&$s(t)))}function Fk(t,n,l){switch(n.tag){case 3:we(n,n.stateNode.containerInfo),Ha(n,wt,t.memoizedState.cache),wr();break;case 27:case 5:ye(n);break;case 4:we(n,n.stateNode.containerInfo);break;case 10:Ha(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,Ac(n),null;break;case 13:var u=n.memoizedState;if(u!==null)return u.dehydrated!==null?(Va(n),n.flags|=128,null):(l&n.child.childLanes)!==0?T0(t,n,l):(Va(n),t=ya(t,n,l),t!==null?t.sibling:null);Va(n);break;case 19:var p=(t.flags&128)!==0;if(u=(l&n.childLanes)!==0,u||(hl(t,n,l,!1),u=(l&n.childLanes)!==0),p){if(u)return A0(t,n,l);n.flags|=128}if(p=n.memoizedState,p!==null&&(p.rendering=null,p.tail=null,p.lastEffect=null),C(xt,xt.current),u)break;return null;case 22:return n.lanes=0,w0(t,n,l,n.pendingProps);case 24:Ha(n,wt,t.memoizedState.cache)}return ya(t,n,l)}function R0(t,n,l){if(t!==null)if(t.memoizedProps!==n.pendingProps)jt=!0;else{if(!ld(t,l)&&(n.flags&128)===0)return jt=!1,Fk(t,n,l);jt=(t.flags&131072)!==0}else jt=!1,Fe&&(n.flags&1048576)!==0&&up(n,li,n.index);switch(n.lanes=0,n.tag){case 16:e:{var u=n.pendingProps;if(t=Cr(n.elementType),n.type=t,typeof t=="function")cc(t)?(u=Ar(t,u),n.tag=1,n=C0(null,n,t,u,l)):(n.tag=0,n=Zc(null,n,t,u,l));else{if(t!=null){var p=t.$$typeof;if(p===_){n.tag=11,n=v0(null,n,t,u,l);break e}else if(p===Y){n.tag=14,n=b0(null,n,t,u,l);break e}}throw n=te(t)||t,Error(i(306,n,""))}}return n;case 0:return Zc(t,n,n.type,n.pendingProps,l);case 1:return u=n.type,p=Ar(u,n.pendingProps),C0(t,n,u,p,l);case 3:e:{if(we(n,n.stateNode.containerInfo),t===null)throw Error(i(387));u=n.pendingProps;var x=n.memoizedState;p=x.element,Nc(t,n),mi(n,u,null,l);var S=n.memoizedState;if(u=S.cache,Ha(n,wt,u),u!==x.cache&&vc(n,[wt],l,!0),fi(),u=S.element,x.isDehydrated)if(x={element:u,isDehydrated:!1,cache:S.cache},n.updateQueue.baseState=x,n.memoizedState=x,n.flags&256){n=E0(t,n,u,l);break e}else if(u!==p){p=Rn(Error(i(424)),n),ii(p),n=E0(t,n,u,l);break e}else for(t=n.stateNode.containerInfo,t.nodeType===9?t=t.body:t=t.nodeName==="HTML"?t.ownerDocument.body:t,it=On(t.firstChild),$t=n,Fe=!0,$a=null,Dn=!0,l=wp(n,null,u,l),n.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling;else{if(wr(),u===p){n=ya(t,n,l);break e}Ht(t,n,u,l)}n=n.child}return n;case 26:return ro(t,n),t===null?(l=Pg(n.type,null,n.pendingProps,null))?n.memoizedState=l:Fe||(l=n.type,t=n.pendingProps,u=wo(ue.current).createElement(l),u[Ut]=n,u[tn]=t,Pt(u,l,t),zt(u),n.stateNode=u):n.memoizedState=Pg(n.type,t.memoizedProps,n.pendingProps,t.memoizedState),null;case 27:return ye(n),t===null&&Fe&&(u=n.stateNode=$g(n.type,n.pendingProps,ue.current),$t=n,Dn=!0,p=it,er(n.type)?(Ud=p,it=On(u.firstChild)):it=p),Ht(t,n,n.pendingProps.children,l),ro(t,n),t===null&&(n.flags|=4194304),n.child;case 5:return t===null&&Fe&&((p=u=it)&&(u=b2(u,n.type,n.pendingProps,Dn),u!==null?(n.stateNode=u,$t=n,it=On(u.firstChild),Dn=!1,p=!0):p=!1),p||Ba(n)),ye(n),p=n.type,x=n.pendingProps,S=t!==null?t.memoizedProps:null,u=x.children,zd(p,x)?u=null:S!==null&&zd(p,S)&&(n.flags|=32),n.memoizedState!==null&&(p=_c(t,n,Lk,null,null,l),zi._currentValue=p),ro(t,n),Ht(t,n,u,l),n.child;case 6:return t===null&&Fe&&((t=l=it)&&(l=k2(l,n.pendingProps,Dn),l!==null?(n.stateNode=l,$t=n,it=null,t=!0):t=!1),t||Ba(n)),null;case 13:return T0(t,n,l);case 4:return we(n,n.stateNode.containerInfo),u=n.pendingProps,t===null?n.child=Tr(n,null,u,l):Ht(t,n,u,l),n.child;case 11:return v0(t,n,n.type,n.pendingProps,l);case 7:return Ht(t,n,n.pendingProps,l),n.child;case 8:return Ht(t,n,n.pendingProps.children,l),n.child;case 12:return Ht(t,n,n.pendingProps.children,l),n.child;case 10:return u=n.pendingProps,Ha(n,n.type,u.value),Ht(t,n,u.children,l),n.child;case 9:return p=n.type._context,u=n.pendingProps.children,jr(n),p=Bt(p),u=u(p),n.flags|=1,Ht(t,n,u,l),n.child;case 14:return b0(t,n,n.type,n.pendingProps,l);case 15:return k0(t,n,n.type,n.pendingProps,l);case 19:return A0(t,n,l);case 31:return qk(t,n,l);case 22:return w0(t,n,l,n.pendingProps);case 24:return jr(n),u=Bt(wt),t===null?(p=wc(),p===null&&(p=at,x=bc(),p.pooledCache=x,x.refCount++,x!==null&&(p.pooledCacheLanes|=l),p=x),n.memoizedState={parent:u,cache:p},jc(n),Ha(n,wt,p)):((t.lanes&l)!==0&&(Nc(t,n),mi(n,null,null,l),fi()),p=t.memoizedState,x=n.memoizedState,p.parent!==u?(p={parent:u,cache:u},n.memoizedState=p,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=p),Ha(n,wt,u)):(u=x.cache,Ha(n,wt,u),u!==p.cache&&vc(n,[wt],l,!0))),Ht(t,n,n.pendingProps.children,l),n.child;case 29:throw n.pendingProps}throw Error(i(156,n.tag))}function va(t){t.flags|=4}function id(t,n,l,u,p){if((n=(t.mode&32)!==0)&&(n=!1),n){if(t.flags|=16777216,(p&335544128)===p)if(t.stateNode.complete)t.flags|=8192;else if(rg())t.flags|=8192;else throw Er=qs,Sc}else t.flags&=-16777217}function _0(t,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!Gg(n))if(rg())t.flags|=8192;else throw Er=qs,Sc}function io(t,n){n!==null&&(t.flags|=4),t.flags&16384&&(n=t.tag!==22?dh():536870912,t.lanes|=n,Cl|=n)}function vi(t,n){if(!Fe)switch(t.tailMode){case"hidden":n=t.tail;for(var l=null;n!==null;)n.alternate!==null&&(l=n),n=n.sibling;l===null?t.tail=null:l.sibling=null;break;case"collapsed":l=t.tail;for(var u=null;l!==null;)l.alternate!==null&&(u=l),l=l.sibling;u===null?n||t.tail===null?t.tail=null:t.tail.sibling=null:u.sibling=null}}function st(t){var n=t.alternate!==null&&t.alternate.child===t.child,l=0,u=0;if(n)for(var p=t.child;p!==null;)l|=p.lanes|p.childLanes,u|=p.subtreeFlags&65011712,u|=p.flags&65011712,p.return=t,p=p.sibling;else for(p=t.child;p!==null;)l|=p.lanes|p.childLanes,u|=p.subtreeFlags,u|=p.flags,p.return=t,p=p.sibling;return t.subtreeFlags|=u,t.childLanes=l,n}function Vk(t,n,l){var u=n.pendingProps;switch(hc(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return st(n),null;case 1:return st(n),null;case 3:return l=n.stateNode,u=null,t!==null&&(u=t.memoizedState.cache),n.memoizedState.cache!==u&&(n.flags|=2048),pa(wt),Ne(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(t===null||t.child===null)&&(ml(n)?va(n):t===null||t.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,gc())),st(n),null;case 26:var p=n.type,x=n.memoizedState;return t===null?(va(n),x!==null?(st(n),_0(n,x)):(st(n),id(n,p,null,u,l))):x?x!==t.memoizedState?(va(n),st(n),_0(n,x)):(st(n),n.flags&=-16777217):(t=t.memoizedProps,t!==u&&va(n),st(n),id(n,p,t,u,l)),null;case 27:if(Me(n),l=ue.current,p=n.type,t!==null&&n.stateNode!=null)t.memoizedProps!==u&&va(n);else{if(!u){if(n.stateNode===null)throw Error(i(166));return st(n),null}t=G.current,ml(n)?dp(n):(t=$g(p,u,l),n.stateNode=t,va(n))}return st(n),null;case 5:if(Me(n),p=n.type,t!==null&&n.stateNode!=null)t.memoizedProps!==u&&va(n);else{if(!u){if(n.stateNode===null)throw Error(i(166));return st(n),null}if(x=G.current,ml(n))dp(n);else{var S=wo(ue.current);switch(x){case 1:x=S.createElementNS("http://www.w3.org/2000/svg",p);break;case 2:x=S.createElementNS("http://www.w3.org/1998/Math/MathML",p);break;default:switch(p){case"svg":x=S.createElementNS("http://www.w3.org/2000/svg",p);break;case"math":x=S.createElementNS("http://www.w3.org/1998/Math/MathML",p);break;case"script":x=S.createElement("div"),x.innerHTML="<script><\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof u.is=="string"?S.createElement("select",{is:u.is}):S.createElement("select"),u.multiple?x.multiple=!0:u.size&&(x.size=u.size);break;default:x=typeof u.is=="string"?S.createElement(p,{is:u.is}):S.createElement(p)}}x[Ut]=n,x[tn]=u;e:for(S=n.child;S!==null;){if(S.tag===5||S.tag===6)x.appendChild(S.stateNode);else if(S.tag!==4&&S.tag!==27&&S.child!==null){S.child.return=S,S=S.child;continue}if(S===n)break e;for(;S.sibling===null;){if(S.return===null||S.return===n)break e;S=S.return}S.sibling.return=S.return,S=S.sibling}n.stateNode=x;e:switch(Pt(x,p,u),p){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}u&&va(n)}}return st(n),id(n,n.type,t===null?null:t.memoizedProps,n.pendingProps,l),null;case 6:if(t&&n.stateNode!=null)t.memoizedProps!==u&&va(n);else{if(typeof u!="string"&&n.stateNode===null)throw Error(i(166));if(t=ue.current,ml(n)){if(t=n.stateNode,l=n.memoizedProps,u=null,p=$t,p!==null)switch(p.tag){case 27:case 5:u=p.memoizedProps}t[Ut]=n,t=!!(t.nodeValue===l||u!==null&&u.suppressHydrationWarning===!0||Tg(t.nodeValue,l)),t||Ba(n,!0)}else t=wo(t).createTextNode(u),t[Ut]=n,n.stateNode=t}return st(n),null;case 31:if(l=n.memoizedState,t===null||t.memoizedState!==null){if(u=ml(n),l!==null){if(t===null){if(!u)throw Error(i(318));if(t=n.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(i(557));t[Ut]=n}else wr(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;st(n),t=!1}else l=gc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=l),t=!0;if(!t)return n.flags&256?(yn(n),n):(yn(n),null);if((n.flags&128)!==0)throw Error(i(558))}return st(n),null;case 13:if(u=n.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(p=ml(n),u!==null&&u.dehydrated!==null){if(t===null){if(!p)throw Error(i(318));if(p=n.memoizedState,p=p!==null?p.dehydrated:null,!p)throw Error(i(317));p[Ut]=n}else wr(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;st(n),p=!1}else p=gc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=p),p=!0;if(!p)return n.flags&256?(yn(n),n):(yn(n),null)}return yn(n),(n.flags&128)!==0?(n.lanes=l,n):(l=u!==null,t=t!==null&&t.memoizedState!==null,l&&(u=n.child,p=null,u.alternate!==null&&u.alternate.memoizedState!==null&&u.alternate.memoizedState.cachePool!==null&&(p=u.alternate.memoizedState.cachePool.pool),x=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(x=u.memoizedState.cachePool.pool),x!==p&&(u.flags|=2048)),l!==t&&l&&(n.child.flags|=8192),io(n,n.updateQueue),st(n),null);case 4:return Ne(),t===null&&Td(n.stateNode.containerInfo),st(n),null;case 10:return pa(n.type),st(n),null;case 19:if(B(xt),u=n.memoizedState,u===null)return st(n),null;if(p=(n.flags&128)!==0,x=u.rendering,x===null)if(p)vi(u,!1);else{if(gt!==0||t!==null&&(t.flags&128)!==0)for(t=n.child;t!==null;){if(x=Gs(t),x!==null){for(n.flags|=128,vi(u,!1),t=x.updateQueue,n.updateQueue=t,io(n,t),n.subtreeFlags=0,t=l,l=n.child;l!==null;)ip(l,t),l=l.sibling;return C(xt,xt.current&1|2),Fe&&ma(n,u.treeForkCount),n.child}t=t.sibling}u.tail!==null&&ct()>fo&&(n.flags|=128,p=!0,vi(u,!1),n.lanes=4194304)}else{if(!p)if(t=Gs(x),t!==null){if(n.flags|=128,p=!0,t=t.updateQueue,n.updateQueue=t,io(n,t),vi(u,!0),u.tail===null&&u.tailMode==="hidden"&&!x.alternate&&!Fe)return st(n),null}else 2*ct()-u.renderingStartTime>fo&&l!==536870912&&(n.flags|=128,p=!0,vi(u,!1),n.lanes=4194304);u.isBackwards?(x.sibling=n.child,n.child=x):(t=u.last,t!==null?t.sibling=x:n.child=x,u.last=x)}return u.tail!==null?(t=u.tail,u.rendering=t,u.tail=t.sibling,u.renderingStartTime=ct(),t.sibling=null,l=xt.current,C(xt,p?l&1|2:l&1),Fe&&ma(n,u.treeForkCount),t):(st(n),null);case 22:case 23:return yn(n),Mc(),u=n.memoizedState!==null,t!==null?t.memoizedState!==null!==u&&(n.flags|=8192):u&&(n.flags|=8192),u?(l&536870912)!==0&&(n.flags&128)===0&&(st(n),n.subtreeFlags&6&&(n.flags|=8192)):st(n),l=n.updateQueue,l!==null&&io(n,l.retryQueue),l=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),u=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(u=n.memoizedState.cachePool.pool),u!==l&&(n.flags|=2048),t!==null&&B(Nr),null;case 24:return l=null,t!==null&&(l=t.memoizedState.cache),n.memoizedState.cache!==l&&(n.flags|=2048),pa(wt),st(n),null;case 25:return null;case 30:return null}throw Error(i(156,n.tag))}function Yk(t,n){switch(hc(n),n.tag){case 1:return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 3:return pa(wt),Ne(),t=n.flags,(t&65536)!==0&&(t&128)===0?(n.flags=t&-65537|128,n):null;case 26:case 27:case 5:return Me(n),null;case 31:if(n.memoizedState!==null){if(yn(n),n.alternate===null)throw Error(i(340));wr()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 13:if(yn(n),t=n.memoizedState,t!==null&&t.dehydrated!==null){if(n.alternate===null)throw Error(i(340));wr()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 19:return B(xt),null;case 4:return Ne(),null;case 10:return pa(n.type),null;case 22:case 23:return yn(n),Mc(),t!==null&&B(Nr),t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 24:return pa(wt),null;case 25:return null;default:return null}}function z0(t,n){switch(hc(n),n.tag){case 3:pa(wt),Ne();break;case 26:case 27:case 5:Me(n);break;case 4:Ne();break;case 31:n.memoizedState!==null&&yn(n);break;case 13:yn(n);break;case 19:B(xt);break;case 10:pa(n.type);break;case 22:case 23:yn(n),Mc(),t!==null&&B(Nr);break;case 24:pa(wt)}}function bi(t,n){try{var l=n.updateQueue,u=l!==null?l.lastEffect:null;if(u!==null){var p=u.next;l=p;do{if((l.tag&t)===t){u=void 0;var x=l.create,S=l.inst;u=x(),S.destroy=u}l=l.next}while(l!==p)}}catch(E){Ze(n,n.return,E)}}function Ga(t,n,l){try{var u=n.updateQueue,p=u!==null?u.lastEffect:null;if(p!==null){var x=p.next;u=x;do{if((u.tag&t)===t){var S=u.inst,E=S.destroy;if(E!==void 0){S.destroy=void 0,p=n;var H=l,Q=E;try{Q()}catch(oe){Ze(p,H,oe)}}}u=u.next}while(u!==x)}}catch(oe){Ze(n,n.return,oe)}}function D0(t){var n=t.updateQueue;if(n!==null){var l=t.stateNode;try{jp(n,l)}catch(u){Ze(t,t.return,u)}}}function L0(t,n,l){l.props=Ar(t.type,t.memoizedProps),l.state=t.memoizedState;try{l.componentWillUnmount()}catch(u){Ze(t,n,u)}}function ki(t,n){try{var l=t.ref;if(l!==null){switch(t.tag){case 26:case 27:case 5:var u=t.stateNode;break;case 30:u=t.stateNode;break;default:u=t.stateNode}typeof l=="function"?t.refCleanup=l(u):l.current=u}}catch(p){Ze(t,n,p)}}function na(t,n){var l=t.ref,u=t.refCleanup;if(l!==null)if(typeof u=="function")try{u()}catch(p){Ze(t,n,p)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(p){Ze(t,n,p)}else l.current=null}function O0(t){var n=t.type,l=t.memoizedProps,u=t.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":l.autoFocus&&u.focus();break e;case"img":l.src?u.src=l.src:l.srcSet&&(u.srcset=l.srcSet)}}catch(p){Ze(t,t.return,p)}}function sd(t,n,l){try{var u=t.stateNode;h2(u,t.type,l,n),u[tn]=n}catch(p){Ze(t,t.return,p)}}function I0(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&er(t.type)||t.tag===4}function od(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||I0(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&er(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function ud(t,n,l){var u=t.tag;if(u===5||u===6)t=t.stateNode,n?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(t,n):(n=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,n.appendChild(t),l=l._reactRootContainer,l!=null||n.onclick!==null||(n.onclick=ca));else if(u!==4&&(u===27&&er(t.type)&&(l=t.stateNode,n=null),t=t.child,t!==null))for(ud(t,n,l),t=t.sibling;t!==null;)ud(t,n,l),t=t.sibling}function so(t,n,l){var u=t.tag;if(u===5||u===6)t=t.stateNode,n?l.insertBefore(t,n):l.appendChild(t);else if(u!==4&&(u===27&&er(t.type)&&(l=t.stateNode),t=t.child,t!==null))for(so(t,n,l),t=t.sibling;t!==null;)so(t,n,l),t=t.sibling}function U0(t){var n=t.stateNode,l=t.memoizedProps;try{for(var u=t.type,p=n.attributes;p.length;)n.removeAttributeNode(p[0]);Pt(n,u,l),n[Ut]=t,n[tn]=l}catch(x){Ze(t,t.return,x)}}var ba=!1,Nt=!1,cd=!1,$0=typeof WeakSet=="function"?WeakSet:Set,Dt=null;function Gk(t,n){if(t=t.containerInfo,Rd=Mo,t=Qh(t),ac(t)){if("selectionStart"in t)var l={start:t.selectionStart,end:t.selectionEnd};else e:{l=(l=t.ownerDocument)&&l.defaultView||window;var u=l.getSelection&&l.getSelection();if(u&&u.rangeCount!==0){l=u.anchorNode;var p=u.anchorOffset,x=u.focusNode;u=u.focusOffset;try{l.nodeType,x.nodeType}catch{l=null;break e}var S=0,E=-1,H=-1,Q=0,oe=0,fe=t,Z=null;t:for(;;){for(var le;fe!==l||p!==0&&fe.nodeType!==3||(E=S+p),fe!==x||u!==0&&fe.nodeType!==3||(H=S+u),fe.nodeType===3&&(S+=fe.nodeValue.length),(le=fe.firstChild)!==null;)Z=fe,fe=le;for(;;){if(fe===t)break t;if(Z===l&&++Q===p&&(E=S),Z===x&&++oe===u&&(H=S),(le=fe.nextSibling)!==null)break;fe=Z,Z=fe.parentNode}fe=le}l=E===-1||H===-1?null:{start:E,end:H}}else l=null}l=l||{start:0,end:0}}else l=null;for(_d={focusedElem:t,selectionRange:l},Mo=!1,Dt=n;Dt!==null;)if(n=Dt,t=n.child,(n.subtreeFlags&1028)!==0&&t!==null)t.return=n,Dt=t;else for(;Dt!==null;){switch(n=Dt,x=n.alternate,t=n.flags,n.tag){case 0:if((t&4)!==0&&(t=n.updateQueue,t=t!==null?t.events:null,t!==null))for(l=0;l<t.length;l++)p=t[l],p.ref.impl=p.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&x!==null){t=void 0,l=n,p=x.memoizedProps,x=x.memoizedState,u=l.stateNode;try{var be=Ar(l.type,p);t=u.getSnapshotBeforeUpdate(be,x),u.__reactInternalSnapshotBeforeUpdate=t}catch(Te){Ze(l,l.return,Te)}}break;case 3:if((t&1024)!==0){if(t=n.stateNode.containerInfo,l=t.nodeType,l===9)Ld(t);else if(l===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":Ld(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((t&1024)!==0)throw Error(i(163))}if(t=n.sibling,t!==null){t.return=n.return,Dt=t;break}Dt=n.return}}function B0(t,n,l){var u=l.flags;switch(l.tag){case 0:case 11:case 15:wa(t,l),u&4&&bi(5,l);break;case 1:if(wa(t,l),u&4)if(t=l.stateNode,n===null)try{t.componentDidMount()}catch(S){Ze(l,l.return,S)}else{var p=Ar(l.type,n.memoizedProps);n=n.memoizedState;try{t.componentDidUpdate(p,n,t.__reactInternalSnapshotBeforeUpdate)}catch(S){Ze(l,l.return,S)}}u&64&&D0(l),u&512&&ki(l,l.return);break;case 3:if(wa(t,l),u&64&&(t=l.updateQueue,t!==null)){if(n=null,l.child!==null)switch(l.child.tag){case 27:case 5:n=l.child.stateNode;break;case 1:n=l.child.stateNode}try{jp(t,n)}catch(S){Ze(l,l.return,S)}}break;case 27:n===null&&u&4&&U0(l);case 26:case 5:wa(t,l),n===null&&u&4&&O0(l),u&512&&ki(l,l.return);break;case 12:wa(t,l);break;case 31:wa(t,l),u&4&&q0(t,l);break;case 13:wa(t,l),u&4&&F0(t,l),u&64&&(t=l.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(l=n2.bind(null,l),w2(t,l))));break;case 22:if(u=l.memoizedState!==null||ba,!u){n=n!==null&&n.memoizedState!==null||Nt,p=ba;var x=Nt;ba=u,(Nt=n)&&!x?Sa(t,l,(l.subtreeFlags&8772)!==0):wa(t,l),ba=p,Nt=x}break;case 30:break;default:wa(t,l)}}function H0(t){var n=t.alternate;n!==null&&(t.alternate=null,H0(n)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(n=t.stateNode,n!==null&&Bu(n)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var dt=null,an=!1;function ka(t,n,l){for(l=l.child;l!==null;)P0(t,n,l),l=l.sibling}function P0(t,n,l){if(ve&&typeof ve.onCommitFiberUnmount=="function")try{ve.onCommitFiberUnmount(ee,l)}catch{}switch(l.tag){case 26:Nt||na(l,n),ka(t,n,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:Nt||na(l,n);var u=dt,p=an;er(l.type)&&(dt=l.stateNode,an=!1),ka(t,n,l),Ai(l.stateNode),dt=u,an=p;break;case 5:Nt||na(l,n);case 6:if(u=dt,p=an,dt=null,ka(t,n,l),dt=u,an=p,dt!==null)if(an)try{(dt.nodeType===9?dt.body:dt.nodeName==="HTML"?dt.ownerDocument.body:dt).removeChild(l.stateNode)}catch(x){Ze(l,n,x)}else try{dt.removeChild(l.stateNode)}catch(x){Ze(l,n,x)}break;case 18:dt!==null&&(an?(t=dt,Dg(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,l.stateNode),Dl(t)):Dg(dt,l.stateNode));break;case 4:u=dt,p=an,dt=l.stateNode.containerInfo,an=!0,ka(t,n,l),dt=u,an=p;break;case 0:case 11:case 14:case 15:Ga(2,l,n),Nt||Ga(4,l,n),ka(t,n,l);break;case 1:Nt||(na(l,n),u=l.stateNode,typeof u.componentWillUnmount=="function"&&L0(l,n,u)),ka(t,n,l);break;case 21:ka(t,n,l);break;case 22:Nt=(u=Nt)||l.memoizedState!==null,ka(t,n,l),Nt=u;break;default:ka(t,n,l)}}function q0(t,n){if(n.memoizedState===null&&(t=n.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{Dl(t)}catch(l){Ze(n,n.return,l)}}}function F0(t,n){if(n.memoizedState===null&&(t=n.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{Dl(t)}catch(l){Ze(n,n.return,l)}}function Kk(t){switch(t.tag){case 31:case 13:case 19:var n=t.stateNode;return n===null&&(n=t.stateNode=new $0),n;case 22:return t=t.stateNode,n=t._retryCache,n===null&&(n=t._retryCache=new $0),n;default:throw Error(i(435,t.tag))}}function oo(t,n){var l=Kk(t);n.forEach(function(u){if(!l.has(u)){l.add(u);var p=a2.bind(null,t,u);u.then(p,p)}})}function rn(t,n){var l=n.deletions;if(l!==null)for(var u=0;u<l.length;u++){var p=l[u],x=t,S=n,E=S;e:for(;E!==null;){switch(E.tag){case 27:if(er(E.type)){dt=E.stateNode,an=!1;break e}break;case 5:dt=E.stateNode,an=!1;break e;case 3:case 4:dt=E.stateNode.containerInfo,an=!0;break e}E=E.return}if(dt===null)throw Error(i(160));P0(x,S,p),dt=null,an=!1,x=p.alternate,x!==null&&(x.return=null),p.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)V0(n,t),n=n.sibling}var Gn=null;function V0(t,n){var l=t.alternate,u=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:rn(n,t),ln(t),u&4&&(Ga(3,t,t.return),bi(3,t),Ga(5,t,t.return));break;case 1:rn(n,t),ln(t),u&512&&(Nt||l===null||na(l,l.return)),u&64&&ba&&(t=t.updateQueue,t!==null&&(u=t.callbacks,u!==null&&(l=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=l===null?u:l.concat(u))));break;case 26:var p=Gn;if(rn(n,t),ln(t),u&512&&(Nt||l===null||na(l,l.return)),u&4){var x=l!==null?l.memoizedState:null;if(u=t.memoizedState,l===null)if(u===null)if(t.stateNode===null){e:{u=t.type,l=t.memoizedProps,p=p.ownerDocument||p;t:switch(u){case"title":x=p.getElementsByTagName("title")[0],(!x||x[Kl]||x[Ut]||x.namespaceURI==="http://www.w3.org/2000/svg"||x.hasAttribute("itemprop"))&&(x=p.createElement(u),p.head.insertBefore(x,p.querySelector("head > title"))),Pt(x,u,l),x[Ut]=t,zt(x),u=x;break e;case"link":var S=Vg("link","href",p).get(u+(l.href||""));if(S){for(var E=0;E<S.length;E++)if(x=S[E],x.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&x.getAttribute("rel")===(l.rel==null?null:l.rel)&&x.getAttribute("title")===(l.title==null?null:l.title)&&x.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){S.splice(E,1);break t}}x=p.createElement(u),Pt(x,u,l),p.head.appendChild(x);break;case"meta":if(S=Vg("meta","content",p).get(u+(l.content||""))){for(E=0;E<S.length;E++)if(x=S[E],x.getAttribute("content")===(l.content==null?null:""+l.content)&&x.getAttribute("name")===(l.name==null?null:l.name)&&x.getAttribute("property")===(l.property==null?null:l.property)&&x.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&x.getAttribute("charset")===(l.charSet==null?null:l.charSet)){S.splice(E,1);break t}}x=p.createElement(u),Pt(x,u,l),p.head.appendChild(x);break;default:throw Error(i(468,u))}x[Ut]=t,zt(x),u=x}t.stateNode=u}else Yg(p,t.type,t.stateNode);else t.stateNode=Fg(p,u,t.memoizedProps);else x!==u?(x===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):x.count--,u===null?Yg(p,t.type,t.stateNode):Fg(p,u,t.memoizedProps)):u===null&&t.stateNode!==null&&sd(t,t.memoizedProps,l.memoizedProps)}break;case 27:rn(n,t),ln(t),u&512&&(Nt||l===null||na(l,l.return)),l!==null&&u&4&&sd(t,t.memoizedProps,l.memoizedProps);break;case 5:if(rn(n,t),ln(t),u&512&&(Nt||l===null||na(l,l.return)),t.flags&32){p=t.stateNode;try{al(p,"")}catch(be){Ze(t,t.return,be)}}u&4&&t.stateNode!=null&&(p=t.memoizedProps,sd(t,p,l!==null?l.memoizedProps:p)),u&1024&&(cd=!0);break;case 6:if(rn(n,t),ln(t),u&4){if(t.stateNode===null)throw Error(i(162));u=t.memoizedProps,l=t.stateNode;try{l.nodeValue=u}catch(be){Ze(t,t.return,be)}}break;case 3:if(No=null,p=Gn,Gn=So(n.containerInfo),rn(n,t),Gn=p,ln(t),u&4&&l!==null&&l.memoizedState.isDehydrated)try{Dl(n.containerInfo)}catch(be){Ze(t,t.return,be)}cd&&(cd=!1,Y0(t));break;case 4:u=Gn,Gn=So(t.stateNode.containerInfo),rn(n,t),ln(t),Gn=u;break;case 12:rn(n,t),ln(t);break;case 31:rn(n,t),ln(t),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,oo(t,u)));break;case 13:rn(n,t),ln(t),t.child.flags&8192&&t.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(co=ct()),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,oo(t,u)));break;case 22:p=t.memoizedState!==null;var H=l!==null&&l.memoizedState!==null,Q=ba,oe=Nt;if(ba=Q||p,Nt=oe||H,rn(n,t),Nt=oe,ba=Q,ln(t),u&8192)e:for(n=t.stateNode,n._visibility=p?n._visibility&-2:n._visibility|1,p&&(l===null||H||ba||Nt||Rr(t)),l=null,n=t;;){if(n.tag===5||n.tag===26){if(l===null){H=l=n;try{if(x=H.stateNode,p)S=x.style,typeof S.setProperty=="function"?S.setProperty("display","none","important"):S.display="none";else{E=H.stateNode;var fe=H.memoizedProps.style,Z=fe!=null&&fe.hasOwnProperty("display")?fe.display:null;E.style.display=Z==null||typeof Z=="boolean"?"":(""+Z).trim()}}catch(be){Ze(H,H.return,be)}}}else if(n.tag===6){if(l===null){H=n;try{H.stateNode.nodeValue=p?"":H.memoizedProps}catch(be){Ze(H,H.return,be)}}}else if(n.tag===18){if(l===null){H=n;try{var le=H.stateNode;p?Lg(le,!0):Lg(H.stateNode,!1)}catch(be){Ze(H,H.return,be)}}}else if((n.tag!==22&&n.tag!==23||n.memoizedState===null||n===t)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break e;for(;n.sibling===null;){if(n.return===null||n.return===t)break e;l===n&&(l=null),n=n.return}l===n&&(l=null),n.sibling.return=n.return,n=n.sibling}u&4&&(u=t.updateQueue,u!==null&&(l=u.retryQueue,l!==null&&(u.retryQueue=null,oo(t,l))));break;case 19:rn(n,t),ln(t),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,oo(t,u)));break;case 30:break;case 21:break;default:rn(n,t),ln(t)}}function ln(t){var n=t.flags;if(n&2){try{for(var l,u=t.return;u!==null;){if(I0(u)){l=u;break}u=u.return}if(l==null)throw Error(i(160));switch(l.tag){case 27:var p=l.stateNode,x=od(t);so(t,x,p);break;case 5:var S=l.stateNode;l.flags&32&&(al(S,""),l.flags&=-33);var E=od(t);so(t,E,S);break;case 3:case 4:var H=l.stateNode.containerInfo,Q=od(t);ud(t,Q,H);break;default:throw Error(i(161))}}catch(oe){Ze(t,t.return,oe)}t.flags&=-3}n&4096&&(t.flags&=-4097)}function Y0(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var n=t;Y0(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),t=t.sibling}}function wa(t,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)B0(t,n.alternate,n),n=n.sibling}function Rr(t){for(t=t.child;t!==null;){var n=t;switch(n.tag){case 0:case 11:case 14:case 15:Ga(4,n,n.return),Rr(n);break;case 1:na(n,n.return);var l=n.stateNode;typeof l.componentWillUnmount=="function"&&L0(n,n.return,l),Rr(n);break;case 27:Ai(n.stateNode);case 26:case 5:na(n,n.return),Rr(n);break;case 22:n.memoizedState===null&&Rr(n);break;case 30:Rr(n);break;default:Rr(n)}t=t.sibling}}function Sa(t,n,l){for(l=l&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var u=n.alternate,p=t,x=n,S=x.flags;switch(x.tag){case 0:case 11:case 15:Sa(p,x,l),bi(4,x);break;case 1:if(Sa(p,x,l),u=x,p=u.stateNode,typeof p.componentDidMount=="function")try{p.componentDidMount()}catch(Q){Ze(u,u.return,Q)}if(u=x,p=u.updateQueue,p!==null){var E=u.stateNode;try{var H=p.shared.hiddenCallbacks;if(H!==null)for(p.shared.hiddenCallbacks=null,p=0;p<H.length;p++)Sp(H[p],E)}catch(Q){Ze(u,u.return,Q)}}l&&S&64&&D0(x),ki(x,x.return);break;case 27:U0(x);case 26:case 5:Sa(p,x,l),l&&u===null&&S&4&&O0(x),ki(x,x.return);break;case 12:Sa(p,x,l);break;case 31:Sa(p,x,l),l&&S&4&&q0(p,x);break;case 13:Sa(p,x,l),l&&S&4&&F0(p,x);break;case 22:x.memoizedState===null&&Sa(p,x,l),ki(x,x.return);break;case 30:break;default:Sa(p,x,l)}n=n.sibling}}function dd(t,n){var l=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),t=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(t=n.memoizedState.cachePool.pool),t!==l&&(t!=null&&t.refCount++,l!=null&&si(l))}function fd(t,n){t=null,n.alternate!==null&&(t=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==t&&(n.refCount++,t!=null&&si(t))}function Kn(t,n,l,u){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)G0(t,n,l,u),n=n.sibling}function G0(t,n,l,u){var p=n.flags;switch(n.tag){case 0:case 11:case 15:Kn(t,n,l,u),p&2048&&bi(9,n);break;case 1:Kn(t,n,l,u);break;case 3:Kn(t,n,l,u),p&2048&&(t=null,n.alternate!==null&&(t=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==t&&(n.refCount++,t!=null&&si(t)));break;case 12:if(p&2048){Kn(t,n,l,u),t=n.stateNode;try{var x=n.memoizedProps,S=x.id,E=x.onPostCommit;typeof E=="function"&&E(S,n.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(H){Ze(n,n.return,H)}}else Kn(t,n,l,u);break;case 31:Kn(t,n,l,u);break;case 13:Kn(t,n,l,u);break;case 23:break;case 22:x=n.stateNode,S=n.alternate,n.memoizedState!==null?x._visibility&2?Kn(t,n,l,u):wi(t,n):x._visibility&2?Kn(t,n,l,u):(x._visibility|=2,Sl(t,n,l,u,(n.subtreeFlags&10256)!==0||!1)),p&2048&&dd(S,n);break;case 24:Kn(t,n,l,u),p&2048&&fd(n.alternate,n);break;default:Kn(t,n,l,u)}}function Sl(t,n,l,u,p){for(p=p&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var x=t,S=n,E=l,H=u,Q=S.flags;switch(S.tag){case 0:case 11:case 15:Sl(x,S,E,H,p),bi(8,S);break;case 23:break;case 22:var oe=S.stateNode;S.memoizedState!==null?oe._visibility&2?Sl(x,S,E,H,p):wi(x,S):(oe._visibility|=2,Sl(x,S,E,H,p)),p&&Q&2048&&dd(S.alternate,S);break;case 24:Sl(x,S,E,H,p),p&&Q&2048&&fd(S.alternate,S);break;default:Sl(x,S,E,H,p)}n=n.sibling}}function wi(t,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var l=t,u=n,p=u.flags;switch(u.tag){case 22:wi(l,u),p&2048&&dd(u.alternate,u);break;case 24:wi(l,u),p&2048&&fd(u.alternate,u);break;default:wi(l,u)}n=n.sibling}}var Si=8192;function jl(t,n,l){if(t.subtreeFlags&Si)for(t=t.child;t!==null;)K0(t,n,l),t=t.sibling}function K0(t,n,l){switch(t.tag){case 26:jl(t,n,l),t.flags&Si&&t.memoizedState!==null&&D2(l,Gn,t.memoizedState,t.memoizedProps);break;case 5:jl(t,n,l);break;case 3:case 4:var u=Gn;Gn=So(t.stateNode.containerInfo),jl(t,n,l),Gn=u;break;case 22:t.memoizedState===null&&(u=t.alternate,u!==null&&u.memoizedState!==null?(u=Si,Si=16777216,jl(t,n,l),Si=u):jl(t,n,l));break;default:jl(t,n,l)}}function W0(t){var n=t.alternate;if(n!==null&&(t=n.child,t!==null)){n.child=null;do n=t.sibling,t.sibling=null,t=n;while(t!==null)}}function ji(t){var n=t.deletions;if((t.flags&16)!==0){if(n!==null)for(var l=0;l<n.length;l++){var u=n[l];Dt=u,Q0(u,t)}W0(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)X0(t),t=t.sibling}function X0(t){switch(t.tag){case 0:case 11:case 15:ji(t),t.flags&2048&&Ga(9,t,t.return);break;case 3:ji(t);break;case 12:ji(t);break;case 22:var n=t.stateNode;t.memoizedState!==null&&n._visibility&2&&(t.return===null||t.return.tag!==13)?(n._visibility&=-3,uo(t)):ji(t);break;default:ji(t)}}function uo(t){var n=t.deletions;if((t.flags&16)!==0){if(n!==null)for(var l=0;l<n.length;l++){var u=n[l];Dt=u,Q0(u,t)}W0(t)}for(t=t.child;t!==null;){switch(n=t,n.tag){case 0:case 11:case 15:Ga(8,n,n.return),uo(n);break;case 22:l=n.stateNode,l._visibility&2&&(l._visibility&=-3,uo(n));break;default:uo(n)}t=t.sibling}}function Q0(t,n){for(;Dt!==null;){var l=Dt;switch(l.tag){case 0:case 11:case 15:Ga(8,l,n);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var u=l.memoizedState.cachePool.pool;u!=null&&u.refCount++}break;case 24:si(l.memoizedState.cache)}if(u=l.child,u!==null)u.return=l,Dt=u;else e:for(l=t;Dt!==null;){u=Dt;var p=u.sibling,x=u.return;if(H0(u),u===l){Dt=null;break e}if(p!==null){p.return=x,Dt=p;break e}Dt=x}}}var Wk={getCacheForType:function(t){var n=Bt(wt),l=n.data.get(t);return l===void 0&&(l=t(),n.data.set(t,l)),l},cacheSignal:function(){return Bt(wt).controller.signal}},Xk=typeof WeakMap=="function"?WeakMap:Map,Ke=0,at=null,Ue=null,He=0,Qe=0,vn=null,Ka=!1,Nl=!1,md=!1,ja=0,gt=0,Wa=0,_r=0,hd=0,bn=0,Cl=0,Ni=null,sn=null,pd=!1,co=0,Z0=0,fo=1/0,mo=null,Xa=null,Mt=0,Qa=null,El=null,Na=0,gd=0,xd=null,J0=null,Ci=0,yd=null;function kn(){return(Ke&2)!==0&&He!==0?He&-He:L.T!==null?jd():ph()}function eg(){if(bn===0)if((He&536870912)===0||Fe){var t=bs;bs<<=1,(bs&3932160)===0&&(bs=262144),bn=t}else bn=536870912;return t=xn.current,t!==null&&(t.flags|=32),bn}function on(t,n,l){(t===at&&(Qe===2||Qe===9)||t.cancelPendingCommit!==null)&&(Tl(t,0),Za(t,He,bn,!1)),Gl(t,l),((Ke&2)===0||t!==at)&&(t===at&&((Ke&2)===0&&(_r|=l),gt===4&&Za(t,He,bn,!1)),aa(t))}function tg(t,n,l){if((Ke&6)!==0)throw Error(i(327));var u=!l&&(n&127)===0&&(n&t.expiredLanes)===0||Yl(t,n),p=u?Jk(t,n):bd(t,n,!0),x=u;do{if(p===0){Nl&&!u&&Za(t,n,0,!1);break}else{if(l=t.current.alternate,x&&!Qk(l)){p=bd(t,n,!1),x=!1;continue}if(p===2){if(x=n,t.errorRecoveryDisabledLanes&x)var S=0;else S=t.pendingLanes&-536870913,S=S!==0?S:S&536870912?536870912:0;if(S!==0){n=S;e:{var E=t;p=Ni;var H=E.current.memoizedState.isDehydrated;if(H&&(Tl(E,S).flags|=256),S=bd(E,S,!1),S!==2){if(md&&!H){E.errorRecoveryDisabledLanes|=x,_r|=x,p=4;break e}x=sn,sn=p,x!==null&&(sn===null?sn=x:sn.push.apply(sn,x))}p=S}if(x=!1,p!==2)continue}}if(p===1){Tl(t,0),Za(t,n,0,!0);break}e:{switch(u=t,x=p,x){case 0:case 1:throw Error(i(345));case 4:if((n&4194048)!==n)break;case 6:Za(u,n,bn,!Ka);break e;case 2:sn=null;break;case 3:case 5:break;default:throw Error(i(329))}if((n&62914560)===n&&(p=co+300-ct(),10<p)){if(Za(u,n,bn,!Ka),ws(u,0,!0)!==0)break e;Na=n,u.timeoutHandle=_g(ng.bind(null,u,l,sn,mo,pd,n,bn,_r,Cl,Ka,x,"Throttled",-0,0),p);break e}ng(u,l,sn,mo,pd,n,bn,_r,Cl,Ka,x,null,-0,0)}}break}while(!0);aa(t)}function ng(t,n,l,u,p,x,S,E,H,Q,oe,fe,Z,le){if(t.timeoutHandle=-1,fe=n.subtreeFlags,fe&8192||(fe&16785408)===16785408){fe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ca},K0(n,x,fe);var be=(x&62914560)===x?co-ct():(x&4194048)===x?Z0-ct():0;if(be=L2(fe,be),be!==null){Na=x,t.cancelPendingCommit=be(cg.bind(null,t,n,x,l,u,p,S,E,H,oe,fe,null,Z,le)),Za(t,x,S,!Q);return}}cg(t,n,x,l,u,p,S,E,H)}function Qk(t){for(var n=t;;){var l=n.tag;if((l===0||l===11||l===15)&&n.flags&16384&&(l=n.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var u=0;u<l.length;u++){var p=l[u],x=p.getSnapshot;p=p.value;try{if(!pn(x(),p))return!1}catch{return!1}}if(l=n.child,n.subtreeFlags&16384&&l!==null)l.return=n,n=l;else{if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function Za(t,n,l,u){n&=~hd,n&=~_r,t.suspendedLanes|=n,t.pingedLanes&=~n,u&&(t.warmLanes|=n),u=t.expirationTimes;for(var p=n;0<p;){var x=31-ze(p),S=1<<x;u[x]=-1,p&=~S}l!==0&&fh(t,l,n)}function ho(){return(Ke&6)===0?(Ei(0),!1):!0}function vd(){if(Ue!==null){if(Qe===0)var t=Ue.return;else t=Ue,ha=Sr=null,Lc(t),yl=null,ui=0,t=Ue;for(;t!==null;)z0(t.alternate,t),t=t.return;Ue=null}}function Tl(t,n){var l=t.timeoutHandle;l!==-1&&(t.timeoutHandle=-1,x2(l)),l=t.cancelPendingCommit,l!==null&&(t.cancelPendingCommit=null,l()),Na=0,vd(),at=t,Ue=l=fa(t.current,null),He=n,Qe=0,vn=null,Ka=!1,Nl=Yl(t,n),md=!1,Cl=bn=hd=_r=Wa=gt=0,sn=Ni=null,pd=!1,(n&8)!==0&&(n|=n&32);var u=t.entangledLanes;if(u!==0)for(t=t.entanglements,u&=n;0<u;){var p=31-ze(u),x=1<<p;n|=t[p],u&=~x}return ja=n,Ds(),l}function ag(t,n){Le=null,L.H=xi,n===xl||n===Ps?(n=vp(),Qe=3):n===Sc?(n=vp(),Qe=4):Qe=n===Qc?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,vn=n,Ue===null&&(gt=1,no(t,Rn(n,t.current)))}function rg(){var t=xn.current;return t===null?!0:(He&4194048)===He?Ln===null:(He&62914560)===He||(He&536870912)!==0?t===Ln:!1}function lg(){var t=L.H;return L.H=xi,t===null?xi:t}function ig(){var t=L.A;return L.A=Wk,t}function po(){gt=4,Ka||(He&4194048)!==He&&xn.current!==null||(Nl=!0),(Wa&134217727)===0&&(_r&134217727)===0||at===null||Za(at,He,bn,!1)}function bd(t,n,l){var u=Ke;Ke|=2;var p=lg(),x=ig();(at!==t||He!==n)&&(mo=null,Tl(t,n)),n=!1;var S=gt;e:do try{if(Qe!==0&&Ue!==null){var E=Ue,H=vn;switch(Qe){case 8:vd(),S=6;break e;case 3:case 2:case 9:case 6:xn.current===null&&(n=!0);var Q=Qe;if(Qe=0,vn=null,Ml(t,E,H,Q),l&&Nl){S=0;break e}break;default:Q=Qe,Qe=0,vn=null,Ml(t,E,H,Q)}}Zk(),S=gt;break}catch(oe){ag(t,oe)}while(!0);return n&&t.shellSuspendCounter++,ha=Sr=null,Ke=u,L.H=p,L.A=x,Ue===null&&(at=null,He=0,Ds()),S}function Zk(){for(;Ue!==null;)sg(Ue)}function Jk(t,n){var l=Ke;Ke|=2;var u=lg(),p=ig();at!==t||He!==n?(mo=null,fo=ct()+500,Tl(t,n)):Nl=Yl(t,n);e:do try{if(Qe!==0&&Ue!==null){n=Ue;var x=vn;t:switch(Qe){case 1:Qe=0,vn=null,Ml(t,n,x,1);break;case 2:case 9:if(xp(x)){Qe=0,vn=null,og(n);break}n=function(){Qe!==2&&Qe!==9||at!==t||(Qe=7),aa(t)},x.then(n,n);break e;case 3:Qe=7;break e;case 4:Qe=5;break e;case 7:xp(x)?(Qe=0,vn=null,og(n)):(Qe=0,vn=null,Ml(t,n,x,7));break;case 5:var S=null;switch(Ue.tag){case 26:S=Ue.memoizedState;case 5:case 27:var E=Ue;if(S?Gg(S):E.stateNode.complete){Qe=0,vn=null;var H=E.sibling;if(H!==null)Ue=H;else{var Q=E.return;Q!==null?(Ue=Q,go(Q)):Ue=null}break t}}Qe=0,vn=null,Ml(t,n,x,5);break;case 6:Qe=0,vn=null,Ml(t,n,x,6);break;case 8:vd(),gt=6;break e;default:throw Error(i(462))}}e2();break}catch(oe){ag(t,oe)}while(!0);return ha=Sr=null,L.H=u,L.A=p,Ke=l,Ue!==null?0:(at=null,He=0,Ds(),gt)}function e2(){for(;Ue!==null&&!mn();)sg(Ue)}function sg(t){var n=R0(t.alternate,t,ja);t.memoizedProps=t.pendingProps,n===null?go(t):Ue=n}function og(t){var n=t,l=n.alternate;switch(n.tag){case 15:case 0:n=N0(l,n,n.pendingProps,n.type,void 0,He);break;case 11:n=N0(l,n,n.pendingProps,n.type.render,n.ref,He);break;case 5:Lc(n);default:z0(l,n),n=Ue=ip(n,ja),n=R0(l,n,ja)}t.memoizedProps=t.pendingProps,n===null?go(t):Ue=n}function Ml(t,n,l,u){ha=Sr=null,Lc(n),yl=null,ui=0;var p=n.return;try{if(Pk(t,p,n,l,He)){gt=1,no(t,Rn(l,t.current)),Ue=null;return}}catch(x){if(p!==null)throw Ue=p,x;gt=1,no(t,Rn(l,t.current)),Ue=null;return}n.flags&32768?(Fe||u===1?t=!0:Nl||(He&536870912)!==0?t=!1:(Ka=t=!0,(u===2||u===9||u===3||u===6)&&(u=xn.current,u!==null&&u.tag===13&&(u.flags|=16384))),ug(n,t)):go(n)}function go(t){var n=t;do{if((n.flags&32768)!==0){ug(n,Ka);return}t=n.return;var l=Vk(n.alternate,n,ja);if(l!==null){Ue=l;return}if(n=n.sibling,n!==null){Ue=n;return}Ue=n=t}while(n!==null);gt===0&&(gt=5)}function ug(t,n){do{var l=Yk(t.alternate,t);if(l!==null){l.flags&=32767,Ue=l;return}if(l=t.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!n&&(t=t.sibling,t!==null)){Ue=t;return}Ue=t=l}while(t!==null);gt=6,Ue=null}function cg(t,n,l,u,p,x,S,E,H){t.cancelPendingCommit=null;do xo();while(Mt!==0);if((Ke&6)!==0)throw Error(i(327));if(n!==null){if(n===t.current)throw Error(i(177));if(x=n.lanes|n.childLanes,x|=oc,zb(t,l,x,S,E,H),t===at&&(Ue=at=null,He=0),El=n,Qa=t,Na=l,gd=x,xd=p,J0=u,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,r2(he,function(){return pg(),null})):(t.callbackNode=null,t.callbackPriority=0),u=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||u){u=L.T,L.T=null,p=ae.p,ae.p=2,S=Ke,Ke|=4;try{Gk(t,n,l)}finally{Ke=S,ae.p=p,L.T=u}}Mt=1,dg(),fg(),mg()}}function dg(){if(Mt===1){Mt=0;var t=Qa,n=El,l=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||l){l=L.T,L.T=null;var u=ae.p;ae.p=2;var p=Ke;Ke|=4;try{V0(n,t);var x=_d,S=Qh(t.containerInfo),E=x.focusedElem,H=x.selectionRange;if(S!==E&&E&&E.ownerDocument&&Xh(E.ownerDocument.documentElement,E)){if(H!==null&&ac(E)){var Q=H.start,oe=H.end;if(oe===void 0&&(oe=Q),"selectionStart"in E)E.selectionStart=Q,E.selectionEnd=Math.min(oe,E.value.length);else{var fe=E.ownerDocument||document,Z=fe&&fe.defaultView||window;if(Z.getSelection){var le=Z.getSelection(),be=E.textContent.length,Te=Math.min(H.start,be),nt=H.end===void 0?Te:Math.min(H.end,be);!le.extend&&Te>nt&&(S=nt,nt=Te,Te=S);var V=Wh(E,Te),q=Wh(E,nt);if(V&&q&&(le.rangeCount!==1||le.anchorNode!==V.node||le.anchorOffset!==V.offset||le.focusNode!==q.node||le.focusOffset!==q.offset)){var X=fe.createRange();X.setStart(V.node,V.offset),le.removeAllRanges(),Te>nt?(le.addRange(X),le.extend(q.node,q.offset)):(X.setEnd(q.node,q.offset),le.addRange(X))}}}}for(fe=[],le=E;le=le.parentNode;)le.nodeType===1&&fe.push({element:le,left:le.scrollLeft,top:le.scrollTop});for(typeof E.focus=="function"&&E.focus(),E=0;E<fe.length;E++){var de=fe[E];de.element.scrollLeft=de.left,de.element.scrollTop=de.top}}Mo=!!Rd,_d=Rd=null}finally{Ke=p,ae.p=u,L.T=l}}t.current=n,Mt=2}}function fg(){if(Mt===2){Mt=0;var t=Qa,n=El,l=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||l){l=L.T,L.T=null;var u=ae.p;ae.p=2;var p=Ke;Ke|=4;try{B0(t,n.alternate,n)}finally{Ke=p,ae.p=u,L.T=l}}Mt=3}}function mg(){if(Mt===4||Mt===3){Mt=0,Wt();var t=Qa,n=El,l=Na,u=J0;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?Mt=5:(Mt=0,El=Qa=null,hg(t,t.pendingLanes));var p=t.pendingLanes;if(p===0&&(Xa=null),Uu(l),n=n.stateNode,ve&&typeof ve.onCommitFiberRoot=="function")try{ve.onCommitFiberRoot(ee,n,void 0,(n.current.flags&128)===128)}catch{}if(u!==null){n=L.T,p=ae.p,ae.p=2,L.T=null;try{for(var x=t.onRecoverableError,S=0;S<u.length;S++){var E=u[S];x(E.value,{componentStack:E.stack})}}finally{L.T=n,ae.p=p}}(Na&3)!==0&&xo(),aa(t),p=t.pendingLanes,(l&261930)!==0&&(p&42)!==0?t===yd?Ci++:(Ci=0,yd=t):Ci=0,Ei(0)}}function hg(t,n){(t.pooledCacheLanes&=n)===0&&(n=t.pooledCache,n!=null&&(t.pooledCache=null,si(n)))}function xo(){return dg(),fg(),mg(),pg()}function pg(){if(Mt!==5)return!1;var t=Qa,n=gd;gd=0;var l=Uu(Na),u=L.T,p=ae.p;try{ae.p=32>l?32:l,L.T=null,l=xd,xd=null;var x=Qa,S=Na;if(Mt=0,El=Qa=null,Na=0,(Ke&6)!==0)throw Error(i(331));var E=Ke;if(Ke|=4,X0(x.current),G0(x,x.current,S,l),Ke=E,Ei(0,!1),ve&&typeof ve.onPostCommitFiberRoot=="function")try{ve.onPostCommitFiberRoot(ee,x)}catch{}return!0}finally{ae.p=p,L.T=u,hg(t,n)}}function gg(t,n,l){n=Rn(l,n),n=Xc(t.stateNode,n,2),t=Fa(t,n,2),t!==null&&(Gl(t,2),aa(t))}function Ze(t,n,l){if(t.tag===3)gg(t,t,l);else for(;n!==null;){if(n.tag===3){gg(n,t,l);break}else if(n.tag===1){var u=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(Xa===null||!Xa.has(u))){t=Rn(l,t),l=x0(2),u=Fa(n,l,2),u!==null&&(y0(l,u,n,t),Gl(u,2),aa(u));break}}n=n.return}}function kd(t,n,l){var u=t.pingCache;if(u===null){u=t.pingCache=new Xk;var p=new Set;u.set(n,p)}else p=u.get(n),p===void 0&&(p=new Set,u.set(n,p));p.has(l)||(md=!0,p.add(l),t=t2.bind(null,t,n,l),n.then(t,t))}function t2(t,n,l){var u=t.pingCache;u!==null&&u.delete(n),t.pingedLanes|=t.suspendedLanes&l,t.warmLanes&=~l,at===t&&(He&l)===l&&(gt===4||gt===3&&(He&62914560)===He&&300>ct()-co?(Ke&2)===0&&Tl(t,0):hd|=l,Cl===He&&(Cl=0)),aa(t)}function xg(t,n){n===0&&(n=dh()),t=br(t,n),t!==null&&(Gl(t,n),aa(t))}function n2(t){var n=t.memoizedState,l=0;n!==null&&(l=n.retryLane),xg(t,l)}function a2(t,n){var l=0;switch(t.tag){case 31:case 13:var u=t.stateNode,p=t.memoizedState;p!==null&&(l=p.retryLane);break;case 19:u=t.stateNode;break;case 22:u=t.stateNode._retryCache;break;default:throw Error(i(314))}u!==null&&u.delete(n),xg(t,l)}function r2(t,n){return Rt(t,n)}var yo=null,Al=null,wd=!1,vo=!1,Sd=!1,Ja=0;function aa(t){t!==Al&&t.next===null&&(Al===null?yo=Al=t:Al=Al.next=t),vo=!0,wd||(wd=!0,i2())}function Ei(t,n){if(!Sd&&vo){Sd=!0;do for(var l=!1,u=yo;u!==null;){if(t!==0){var p=u.pendingLanes;if(p===0)var x=0;else{var S=u.suspendedLanes,E=u.pingedLanes;x=(1<<31-ze(42|t)+1)-1,x&=p&~(S&~E),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(l=!0,kg(u,x))}else x=He,x=ws(u,u===at?x:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(x&3)===0||Yl(u,x)||(l=!0,kg(u,x));u=u.next}while(l);Sd=!1}}function l2(){yg()}function yg(){vo=wd=!1;var t=0;Ja!==0&&g2()&&(t=Ja);for(var n=ct(),l=null,u=yo;u!==null;){var p=u.next,x=vg(u,n);x===0?(u.next=null,l===null?yo=p:l.next=p,p===null&&(Al=l)):(l=u,(t!==0||(x&3)!==0)&&(vo=!0)),u=p}Mt!==0&&Mt!==5||Ei(t),Ja!==0&&(Ja=0)}function vg(t,n){for(var l=t.suspendedLanes,u=t.pingedLanes,p=t.expirationTimes,x=t.pendingLanes&-62914561;0<x;){var S=31-ze(x),E=1<<S,H=p[S];H===-1?((E&l)===0||(E&u)!==0)&&(p[S]=_b(E,n)):H<=n&&(t.expiredLanes|=E),x&=~E}if(n=at,l=He,l=ws(t,t===n?l:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),u=t.callbackNode,l===0||t===n&&(Qe===2||Qe===9)||t.cancelPendingCommit!==null)return u!==null&&u!==null&&en(u),t.callbackNode=null,t.callbackPriority=0;if((l&3)===0||Yl(t,l)){if(n=l&-l,n===t.callbackPriority)return n;switch(u!==null&&en(u),Uu(l)){case 2:case 8:l=ie;break;case 32:l=he;break;case 268435456:l=Ae;break;default:l=he}return u=bg.bind(null,t),l=Rt(l,u),t.callbackPriority=n,t.callbackNode=l,n}return u!==null&&u!==null&&en(u),t.callbackPriority=2,t.callbackNode=null,2}function bg(t,n){if(Mt!==0&&Mt!==5)return t.callbackNode=null,t.callbackPriority=0,null;var l=t.callbackNode;if(xo()&&t.callbackNode!==l)return null;var u=He;return u=ws(t,t===at?u:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),u===0?null:(tg(t,u,n),vg(t,ct()),t.callbackNode!=null&&t.callbackNode===l?bg.bind(null,t):null)}function kg(t,n){if(xo())return null;tg(t,n,!0)}function i2(){y2(function(){(Ke&6)!==0?Rt(se,l2):yg()})}function jd(){if(Ja===0){var t=pl;t===0&&(t=_t,_t<<=1,(_t&261888)===0&&(_t=256)),Ja=t}return Ja}function wg(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:Cs(""+t)}function Sg(t,n){var l=n.ownerDocument.createElement("input");return l.name=n.name,l.value=n.value,t.id&&l.setAttribute("form",t.id),n.parentNode.insertBefore(l,n),t=new FormData(t),l.parentNode.removeChild(l),t}function s2(t,n,l,u,p){if(n==="submit"&&l&&l.stateNode===p){var x=wg((p[tn]||null).action),S=u.submitter;S&&(n=(n=S[tn]||null)?wg(n.formAction):S.getAttribute("formAction"),n!==null&&(x=n,S=null));var E=new As("action","action",null,u,p);t.push({event:E,listeners:[{instance:null,listener:function(){if(u.defaultPrevented){if(Ja!==0){var H=S?Sg(p,S):new FormData(p);Fc(l,{pending:!0,data:H,method:p.method,action:x},null,H)}}else typeof x=="function"&&(E.preventDefault(),H=S?Sg(p,S):new FormData(p),Fc(l,{pending:!0,data:H,method:p.method,action:x},x,H))},currentTarget:p}]})}}for(var Nd=0;Nd<sc.length;Nd++){var Cd=sc[Nd],o2=Cd.toLowerCase(),u2=Cd[0].toUpperCase()+Cd.slice(1);Yn(o2,"on"+u2)}Yn(ep,"onAnimationEnd"),Yn(tp,"onAnimationIteration"),Yn(np,"onAnimationStart"),Yn("dblclick","onDoubleClick"),Yn("focusin","onFocus"),Yn("focusout","onBlur"),Yn(Nk,"onTransitionRun"),Yn(Ck,"onTransitionStart"),Yn(Ek,"onTransitionCancel"),Yn(ap,"onTransitionEnd"),tl("onMouseEnter",["mouseout","mouseover"]),tl("onMouseLeave",["mouseout","mouseover"]),tl("onPointerEnter",["pointerout","pointerover"]),tl("onPointerLeave",["pointerout","pointerover"]),gr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),gr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),gr("onBeforeInput",["compositionend","keypress","textInput","paste"]),gr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),gr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),gr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ti="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),c2=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ti));function jg(t,n){n=(n&4)!==0;for(var l=0;l<t.length;l++){var u=t[l],p=u.event;u=u.listeners;e:{var x=void 0;if(n)for(var S=u.length-1;0<=S;S--){var E=u[S],H=E.instance,Q=E.currentTarget;if(E=E.listener,H!==x&&p.isPropagationStopped())break e;x=E,p.currentTarget=Q;try{x(p)}catch(oe){zs(oe)}p.currentTarget=null,x=H}else for(S=0;S<u.length;S++){if(E=u[S],H=E.instance,Q=E.currentTarget,E=E.listener,H!==x&&p.isPropagationStopped())break e;x=E,p.currentTarget=Q;try{x(p)}catch(oe){zs(oe)}p.currentTarget=null,x=H}}}}function $e(t,n){var l=n[$u];l===void 0&&(l=n[$u]=new Set);var u=t+"__bubble";l.has(u)||(Ng(n,t,2,!1),l.add(u))}function Ed(t,n,l){var u=0;n&&(u|=4),Ng(l,t,u,n)}var bo="_reactListening"+Math.random().toString(36).slice(2);function Td(t){if(!t[bo]){t[bo]=!0,yh.forEach(function(l){l!=="selectionchange"&&(c2.has(l)||Ed(l,!1,t),Ed(l,!0,t))});var n=t.nodeType===9?t:t.ownerDocument;n===null||n[bo]||(n[bo]=!0,Ed("selectionchange",!1,n))}}function Ng(t,n,l,u){switch(ex(n)){case 2:var p=U2;break;case 8:p=$2;break;default:p=qd}l=p.bind(null,n,l,t),p=void 0,!Ku||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(p=!0),u?p!==void 0?t.addEventListener(n,l,{capture:!0,passive:p}):t.addEventListener(n,l,!0):p!==void 0?t.addEventListener(n,l,{passive:p}):t.addEventListener(n,l,!1)}function Md(t,n,l,u,p){var x=u;if((n&1)===0&&(n&2)===0&&u!==null)e:for(;;){if(u===null)return;var S=u.tag;if(S===3||S===4){var E=u.stateNode.containerInfo;if(E===p)break;if(S===4)for(S=u.return;S!==null;){var H=S.tag;if((H===3||H===4)&&S.stateNode.containerInfo===p)return;S=S.return}for(;E!==null;){if(S=Zr(E),S===null)return;if(H=S.tag,H===5||H===6||H===26||H===27){u=x=S;continue e}E=E.parentNode}}u=u.return}Ah(function(){var Q=x,oe=Yu(l),fe=[];e:{var Z=rp.get(t);if(Z!==void 0){var le=As,be=t;switch(t){case"keypress":if(Ts(l)===0)break e;case"keydown":case"keyup":le=ak;break;case"focusin":be="focus",le=Zu;break;case"focusout":be="blur",le=Zu;break;case"beforeblur":case"afterblur":le=Zu;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":le=zh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":le=Vb;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":le=ik;break;case ep:case tp:case np:le=Kb;break;case ap:le=ok;break;case"scroll":case"scrollend":le=qb;break;case"wheel":le=ck;break;case"copy":case"cut":case"paste":le=Xb;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":le=Lh;break;case"toggle":case"beforetoggle":le=fk}var Te=(n&4)!==0,nt=!Te&&(t==="scroll"||t==="scrollend"),V=Te?Z!==null?Z+"Capture":null:Z;Te=[];for(var q=Q,X;q!==null;){var de=q;if(X=de.stateNode,de=de.tag,de!==5&&de!==26&&de!==27||X===null||V===null||(de=Xl(q,V),de!=null&&Te.push(Mi(q,de,X))),nt)break;q=q.return}0<Te.length&&(Z=new le(Z,be,null,l,oe),fe.push({event:Z,listeners:Te}))}}if((n&7)===0){e:{if(Z=t==="mouseover"||t==="pointerover",le=t==="mouseout"||t==="pointerout",Z&&l!==Vu&&(be=l.relatedTarget||l.fromElement)&&(Zr(be)||be[Qr]))break e;if((le||Z)&&(Z=oe.window===oe?oe:(Z=oe.ownerDocument)?Z.defaultView||Z.parentWindow:window,le?(be=l.relatedTarget||l.toElement,le=Q,be=be?Zr(be):null,be!==null&&(nt=c(be),Te=be.tag,be!==nt||Te!==5&&Te!==27&&Te!==6)&&(be=null)):(le=null,be=Q),le!==be)){if(Te=zh,de="onMouseLeave",V="onMouseEnter",q="mouse",(t==="pointerout"||t==="pointerover")&&(Te=Lh,de="onPointerLeave",V="onPointerEnter",q="pointer"),nt=le==null?Z:Wl(le),X=be==null?Z:Wl(be),Z=new Te(de,q+"leave",le,l,oe),Z.target=nt,Z.relatedTarget=X,de=null,Zr(oe)===Q&&(Te=new Te(V,q+"enter",be,l,oe),Te.target=X,Te.relatedTarget=nt,de=Te),nt=de,le&&be)t:{for(Te=d2,V=le,q=be,X=0,de=V;de;de=Te(de))X++;de=0;for(var je=q;je;je=Te(je))de++;for(;0<X-de;)V=Te(V),X--;for(;0<de-X;)q=Te(q),de--;for(;X--;){if(V===q||q!==null&&V===q.alternate){Te=V;break t}V=Te(V),q=Te(q)}Te=null}else Te=null;le!==null&&Cg(fe,Z,le,Te,!1),be!==null&&nt!==null&&Cg(fe,nt,be,Te,!0)}}e:{if(Z=Q?Wl(Q):window,le=Z.nodeName&&Z.nodeName.toLowerCase(),le==="select"||le==="input"&&Z.type==="file")var Ye=qh;else if(Hh(Z))if(Fh)Ye=wk;else{Ye=bk;var ke=vk}else le=Z.nodeName,!le||le.toLowerCase()!=="input"||Z.type!=="checkbox"&&Z.type!=="radio"?Q&&Fu(Q.elementType)&&(Ye=qh):Ye=kk;if(Ye&&(Ye=Ye(t,Q))){Ph(fe,Ye,l,oe);break e}ke&&ke(t,Z,Q),t==="focusout"&&Q&&Z.type==="number"&&Q.memoizedProps.value!=null&&qu(Z,"number",Z.value)}switch(ke=Q?Wl(Q):window,t){case"focusin":(Hh(ke)||ke.contentEditable==="true")&&(sl=ke,rc=Q,ri=null);break;case"focusout":ri=rc=sl=null;break;case"mousedown":lc=!0;break;case"contextmenu":case"mouseup":case"dragend":lc=!1,Zh(fe,l,oe);break;case"selectionchange":if(jk)break;case"keydown":case"keyup":Zh(fe,l,oe)}var Oe;if(ec)e:{switch(t){case"compositionstart":var Pe="onCompositionStart";break e;case"compositionend":Pe="onCompositionEnd";break e;case"compositionupdate":Pe="onCompositionUpdate";break e}Pe=void 0}else il?$h(t,l)&&(Pe="onCompositionEnd"):t==="keydown"&&l.keyCode===229&&(Pe="onCompositionStart");Pe&&(Oh&&l.locale!=="ko"&&(il||Pe!=="onCompositionStart"?Pe==="onCompositionEnd"&&il&&(Oe=Rh()):(Ia=oe,Wu="value"in Ia?Ia.value:Ia.textContent,il=!0)),ke=ko(Q,Pe),0<ke.length&&(Pe=new Dh(Pe,t,null,l,oe),fe.push({event:Pe,listeners:ke}),Oe?Pe.data=Oe:(Oe=Bh(l),Oe!==null&&(Pe.data=Oe)))),(Oe=hk?pk(t,l):gk(t,l))&&(Pe=ko(Q,"onBeforeInput"),0<Pe.length&&(ke=new Dh("onBeforeInput","beforeinput",null,l,oe),fe.push({event:ke,listeners:Pe}),ke.data=Oe)),s2(fe,t,Q,l,oe)}jg(fe,n)})}function Mi(t,n,l){return{instance:t,listener:n,currentTarget:l}}function ko(t,n){for(var l=n+"Capture",u=[];t!==null;){var p=t,x=p.stateNode;if(p=p.tag,p!==5&&p!==26&&p!==27||x===null||(p=Xl(t,l),p!=null&&u.unshift(Mi(t,p,x)),p=Xl(t,n),p!=null&&u.push(Mi(t,p,x))),t.tag===3)return u;t=t.return}return[]}function d2(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function Cg(t,n,l,u,p){for(var x=n._reactName,S=[];l!==null&&l!==u;){var E=l,H=E.alternate,Q=E.stateNode;if(E=E.tag,H!==null&&H===u)break;E!==5&&E!==26&&E!==27||Q===null||(H=Q,p?(Q=Xl(l,x),Q!=null&&S.unshift(Mi(l,Q,H))):p||(Q=Xl(l,x),Q!=null&&S.push(Mi(l,Q,H)))),l=l.return}S.length!==0&&t.push({event:n,listeners:S})}var f2=/\r\n?/g,m2=/\u0000|\uFFFD/g;function Eg(t){return(typeof t=="string"?t:""+t).replace(f2,`
|
|
9
|
+
`).replace(m2,"")}function Tg(t,n){return n=Eg(n),Eg(t)===n}function tt(t,n,l,u,p,x){switch(l){case"children":typeof u=="string"?n==="body"||n==="textarea"&&u===""||al(t,u):(typeof u=="number"||typeof u=="bigint")&&n!=="body"&&al(t,""+u);break;case"className":js(t,"class",u);break;case"tabIndex":js(t,"tabindex",u);break;case"dir":case"role":case"viewBox":case"width":case"height":js(t,l,u);break;case"style":Th(t,u,x);break;case"data":if(n!=="object"){js(t,"data",u);break}case"src":case"href":if(u===""&&(n!=="a"||l!=="href")){t.removeAttribute(l);break}if(u==null||typeof u=="function"||typeof u=="symbol"||typeof u=="boolean"){t.removeAttribute(l);break}u=Cs(""+u),t.setAttribute(l,u);break;case"action":case"formAction":if(typeof u=="function"){t.setAttribute(l,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof x=="function"&&(l==="formAction"?(n!=="input"&&tt(t,n,"name",p.name,p,null),tt(t,n,"formEncType",p.formEncType,p,null),tt(t,n,"formMethod",p.formMethod,p,null),tt(t,n,"formTarget",p.formTarget,p,null)):(tt(t,n,"encType",p.encType,p,null),tt(t,n,"method",p.method,p,null),tt(t,n,"target",p.target,p,null)));if(u==null||typeof u=="symbol"||typeof u=="boolean"){t.removeAttribute(l);break}u=Cs(""+u),t.setAttribute(l,u);break;case"onClick":u!=null&&(t.onclick=ca);break;case"onScroll":u!=null&&$e("scroll",t);break;case"onScrollEnd":u!=null&&$e("scrollend",t);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(i(61));if(l=u.__html,l!=null){if(p.children!=null)throw Error(i(60));t.innerHTML=l}}break;case"multiple":t.multiple=u&&typeof u!="function"&&typeof u!="symbol";break;case"muted":t.muted=u&&typeof u!="function"&&typeof u!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(u==null||typeof u=="function"||typeof u=="boolean"||typeof u=="symbol"){t.removeAttribute("xlink:href");break}l=Cs(""+u),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":u!=null&&typeof u!="function"&&typeof u!="symbol"?t.setAttribute(l,""+u):t.removeAttribute(l);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":u&&typeof u!="function"&&typeof u!="symbol"?t.setAttribute(l,""):t.removeAttribute(l);break;case"capture":case"download":u===!0?t.setAttribute(l,""):u!==!1&&u!=null&&typeof u!="function"&&typeof u!="symbol"?t.setAttribute(l,u):t.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":u!=null&&typeof u!="function"&&typeof u!="symbol"&&!isNaN(u)&&1<=u?t.setAttribute(l,u):t.removeAttribute(l);break;case"rowSpan":case"start":u==null||typeof u=="function"||typeof u=="symbol"||isNaN(u)?t.removeAttribute(l):t.setAttribute(l,u);break;case"popover":$e("beforetoggle",t),$e("toggle",t),Ss(t,"popover",u);break;case"xlinkActuate":ua(t,"http://www.w3.org/1999/xlink","xlink:actuate",u);break;case"xlinkArcrole":ua(t,"http://www.w3.org/1999/xlink","xlink:arcrole",u);break;case"xlinkRole":ua(t,"http://www.w3.org/1999/xlink","xlink:role",u);break;case"xlinkShow":ua(t,"http://www.w3.org/1999/xlink","xlink:show",u);break;case"xlinkTitle":ua(t,"http://www.w3.org/1999/xlink","xlink:title",u);break;case"xlinkType":ua(t,"http://www.w3.org/1999/xlink","xlink:type",u);break;case"xmlBase":ua(t,"http://www.w3.org/XML/1998/namespace","xml:base",u);break;case"xmlLang":ua(t,"http://www.w3.org/XML/1998/namespace","xml:lang",u);break;case"xmlSpace":ua(t,"http://www.w3.org/XML/1998/namespace","xml:space",u);break;case"is":Ss(t,"is",u);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=Hb.get(l)||l,Ss(t,l,u))}}function Ad(t,n,l,u,p,x){switch(l){case"style":Th(t,u,x);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(i(61));if(l=u.__html,l!=null){if(p.children!=null)throw Error(i(60));t.innerHTML=l}}break;case"children":typeof u=="string"?al(t,u):(typeof u=="number"||typeof u=="bigint")&&al(t,""+u);break;case"onScroll":u!=null&&$e("scroll",t);break;case"onScrollEnd":u!=null&&$e("scrollend",t);break;case"onClick":u!=null&&(t.onclick=ca);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!vh.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(p=l.endsWith("Capture"),n=l.slice(2,p?l.length-7:void 0),x=t[tn]||null,x=x!=null?x[l]:null,typeof x=="function"&&t.removeEventListener(n,x,p),typeof u=="function")){typeof x!="function"&&x!==null&&(l in t?t[l]=null:t.hasAttribute(l)&&t.removeAttribute(l)),t.addEventListener(n,u,p);break e}l in t?t[l]=u:u===!0?t.setAttribute(l,""):Ss(t,l,u)}}}function Pt(t,n,l){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":$e("error",t),$e("load",t);var u=!1,p=!1,x;for(x in l)if(l.hasOwnProperty(x)){var S=l[x];if(S!=null)switch(x){case"src":u=!0;break;case"srcSet":p=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,n));default:tt(t,n,x,S,l,null)}}p&&tt(t,n,"srcSet",l.srcSet,l,null),u&&tt(t,n,"src",l.src,l,null);return;case"input":$e("invalid",t);var E=x=S=p=null,H=null,Q=null;for(u in l)if(l.hasOwnProperty(u)){var oe=l[u];if(oe!=null)switch(u){case"name":p=oe;break;case"type":S=oe;break;case"checked":H=oe;break;case"defaultChecked":Q=oe;break;case"value":x=oe;break;case"defaultValue":E=oe;break;case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(i(137,n));break;default:tt(t,n,u,oe,l,null)}}jh(t,x,E,H,Q,S,p,!1);return;case"select":$e("invalid",t),u=S=x=null;for(p in l)if(l.hasOwnProperty(p)&&(E=l[p],E!=null))switch(p){case"value":x=E;break;case"defaultValue":S=E;break;case"multiple":u=E;default:tt(t,n,p,E,l,null)}n=x,l=S,t.multiple=!!u,n!=null?nl(t,!!u,n,!1):l!=null&&nl(t,!!u,l,!0);return;case"textarea":$e("invalid",t),x=p=u=null;for(S in l)if(l.hasOwnProperty(S)&&(E=l[S],E!=null))switch(S){case"value":u=E;break;case"defaultValue":p=E;break;case"children":x=E;break;case"dangerouslySetInnerHTML":if(E!=null)throw Error(i(91));break;default:tt(t,n,S,E,l,null)}Ch(t,u,p,x);return;case"option":for(H in l)l.hasOwnProperty(H)&&(u=l[H],u!=null)&&(H==="selected"?t.selected=u&&typeof u!="function"&&typeof u!="symbol":tt(t,n,H,u,l,null));return;case"dialog":$e("beforetoggle",t),$e("toggle",t),$e("cancel",t),$e("close",t);break;case"iframe":case"object":$e("load",t);break;case"video":case"audio":for(u=0;u<Ti.length;u++)$e(Ti[u],t);break;case"image":$e("error",t),$e("load",t);break;case"details":$e("toggle",t);break;case"embed":case"source":case"link":$e("error",t),$e("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(Q in l)if(l.hasOwnProperty(Q)&&(u=l[Q],u!=null))switch(Q){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,n));default:tt(t,n,Q,u,l,null)}return;default:if(Fu(n)){for(oe in l)l.hasOwnProperty(oe)&&(u=l[oe],u!==void 0&&Ad(t,n,oe,u,l,void 0));return}}for(E in l)l.hasOwnProperty(E)&&(u=l[E],u!=null&&tt(t,n,E,u,l,null))}function h2(t,n,l,u){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var p=null,x=null,S=null,E=null,H=null,Q=null,oe=null;for(le in l){var fe=l[le];if(l.hasOwnProperty(le)&&fe!=null)switch(le){case"checked":break;case"value":break;case"defaultValue":H=fe;default:u.hasOwnProperty(le)||tt(t,n,le,null,u,fe)}}for(var Z in u){var le=u[Z];if(fe=l[Z],u.hasOwnProperty(Z)&&(le!=null||fe!=null))switch(Z){case"type":x=le;break;case"name":p=le;break;case"checked":Q=le;break;case"defaultChecked":oe=le;break;case"value":S=le;break;case"defaultValue":E=le;break;case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(i(137,n));break;default:le!==fe&&tt(t,n,Z,le,u,fe)}}Pu(t,S,E,H,Q,oe,x,p);return;case"select":le=S=E=Z=null;for(x in l)if(H=l[x],l.hasOwnProperty(x)&&H!=null)switch(x){case"value":break;case"multiple":le=H;default:u.hasOwnProperty(x)||tt(t,n,x,null,u,H)}for(p in u)if(x=u[p],H=l[p],u.hasOwnProperty(p)&&(x!=null||H!=null))switch(p){case"value":Z=x;break;case"defaultValue":E=x;break;case"multiple":S=x;default:x!==H&&tt(t,n,p,x,u,H)}n=E,l=S,u=le,Z!=null?nl(t,!!l,Z,!1):!!u!=!!l&&(n!=null?nl(t,!!l,n,!0):nl(t,!!l,l?[]:"",!1));return;case"textarea":le=Z=null;for(E in l)if(p=l[E],l.hasOwnProperty(E)&&p!=null&&!u.hasOwnProperty(E))switch(E){case"value":break;case"children":break;default:tt(t,n,E,null,u,p)}for(S in u)if(p=u[S],x=l[S],u.hasOwnProperty(S)&&(p!=null||x!=null))switch(S){case"value":Z=p;break;case"defaultValue":le=p;break;case"children":break;case"dangerouslySetInnerHTML":if(p!=null)throw Error(i(91));break;default:p!==x&&tt(t,n,S,p,u,x)}Nh(t,Z,le);return;case"option":for(var be in l)Z=l[be],l.hasOwnProperty(be)&&Z!=null&&!u.hasOwnProperty(be)&&(be==="selected"?t.selected=!1:tt(t,n,be,null,u,Z));for(H in u)Z=u[H],le=l[H],u.hasOwnProperty(H)&&Z!==le&&(Z!=null||le!=null)&&(H==="selected"?t.selected=Z&&typeof Z!="function"&&typeof Z!="symbol":tt(t,n,H,Z,u,le));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Te in l)Z=l[Te],l.hasOwnProperty(Te)&&Z!=null&&!u.hasOwnProperty(Te)&&tt(t,n,Te,null,u,Z);for(Q in u)if(Z=u[Q],le=l[Q],u.hasOwnProperty(Q)&&Z!==le&&(Z!=null||le!=null))switch(Q){case"children":case"dangerouslySetInnerHTML":if(Z!=null)throw Error(i(137,n));break;default:tt(t,n,Q,Z,u,le)}return;default:if(Fu(n)){for(var nt in l)Z=l[nt],l.hasOwnProperty(nt)&&Z!==void 0&&!u.hasOwnProperty(nt)&&Ad(t,n,nt,void 0,u,Z);for(oe in u)Z=u[oe],le=l[oe],!u.hasOwnProperty(oe)||Z===le||Z===void 0&&le===void 0||Ad(t,n,oe,Z,u,le);return}}for(var V in l)Z=l[V],l.hasOwnProperty(V)&&Z!=null&&!u.hasOwnProperty(V)&&tt(t,n,V,null,u,Z);for(fe in u)Z=u[fe],le=l[fe],!u.hasOwnProperty(fe)||Z===le||Z==null&&le==null||tt(t,n,fe,Z,u,le)}function Mg(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function p2(){if(typeof performance.getEntriesByType=="function"){for(var t=0,n=0,l=performance.getEntriesByType("resource"),u=0;u<l.length;u++){var p=l[u],x=p.transferSize,S=p.initiatorType,E=p.duration;if(x&&E&&Mg(S)){for(S=0,E=p.responseEnd,u+=1;u<l.length;u++){var H=l[u],Q=H.startTime;if(Q>E)break;var oe=H.transferSize,fe=H.initiatorType;oe&&Mg(fe)&&(H=H.responseEnd,S+=oe*(H<E?1:(E-Q)/(H-Q)))}if(--u,n+=8*(x+S)/(p.duration/1e3),t++,10<t)break}}if(0<t)return n/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var Rd=null,_d=null;function wo(t){return t.nodeType===9?t:t.ownerDocument}function Ag(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Rg(t,n){if(t===0)switch(n){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&n==="foreignObject"?0:t}function zd(t,n){return t==="textarea"||t==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.children=="bigint"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var Dd=null;function g2(){var t=window.event;return t&&t.type==="popstate"?t===Dd?!1:(Dd=t,!0):(Dd=null,!1)}var _g=typeof setTimeout=="function"?setTimeout:void 0,x2=typeof clearTimeout=="function"?clearTimeout:void 0,zg=typeof Promise=="function"?Promise:void 0,y2=typeof queueMicrotask=="function"?queueMicrotask:typeof zg<"u"?function(t){return zg.resolve(null).then(t).catch(v2)}:_g;function v2(t){setTimeout(function(){throw t})}function er(t){return t==="head"}function Dg(t,n){var l=n,u=0;do{var p=l.nextSibling;if(t.removeChild(l),p&&p.nodeType===8)if(l=p.data,l==="/$"||l==="/&"){if(u===0){t.removeChild(p),Dl(n);return}u--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")u++;else if(l==="html")Ai(t.ownerDocument.documentElement);else if(l==="head"){l=t.ownerDocument.head,Ai(l);for(var x=l.firstChild;x;){var S=x.nextSibling,E=x.nodeName;x[Kl]||E==="SCRIPT"||E==="STYLE"||E==="LINK"&&x.rel.toLowerCase()==="stylesheet"||l.removeChild(x),x=S}}else l==="body"&&Ai(t.ownerDocument.body);l=p}while(l);Dl(n)}function Lg(t,n){var l=t;t=0;do{var u=l.nextSibling;if(l.nodeType===1?n?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(n?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),u&&u.nodeType===8)if(l=u.data,l==="/$"){if(t===0)break;t--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||t++;l=u}while(l)}function Ld(t){var n=t.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var l=n;switch(n=n.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":Ld(l),Bu(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}t.removeChild(l)}}function b2(t,n,l,u){for(;t.nodeType===1;){var p=l;if(t.nodeName.toLowerCase()!==n.toLowerCase()){if(!u&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(u){if(!t[Kl])switch(n){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(x=t.getAttribute("rel"),x==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(x!==p.rel||t.getAttribute("href")!==(p.href==null||p.href===""?null:p.href)||t.getAttribute("crossorigin")!==(p.crossOrigin==null?null:p.crossOrigin)||t.getAttribute("title")!==(p.title==null?null:p.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(x=t.getAttribute("src"),(x!==(p.src==null?null:p.src)||t.getAttribute("type")!==(p.type==null?null:p.type)||t.getAttribute("crossorigin")!==(p.crossOrigin==null?null:p.crossOrigin))&&x&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(n==="input"&&t.type==="hidden"){var x=p.name==null?null:""+p.name;if(p.type==="hidden"&&t.getAttribute("name")===x)return t}else return t;if(t=On(t.nextSibling),t===null)break}return null}function k2(t,n,l){if(n==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!l||(t=On(t.nextSibling),t===null))return null;return t}function Og(t,n){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!n||(t=On(t.nextSibling),t===null))return null;return t}function Od(t){return t.data==="$?"||t.data==="$~"}function Id(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function w2(t,n){var l=t.ownerDocument;if(t.data==="$~")t._reactRetry=n;else if(t.data!=="$?"||l.readyState!=="loading")n();else{var u=function(){n(),l.removeEventListener("DOMContentLoaded",u)};l.addEventListener("DOMContentLoaded",u),t._reactRetry=u}}function On(t){for(;t!=null;t=t.nextSibling){var n=t.nodeType;if(n===1||n===3)break;if(n===8){if(n=t.data,n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"||n==="F!"||n==="F")break;if(n==="/$"||n==="/&")return null}}return t}var Ud=null;function Ig(t){t=t.nextSibling;for(var n=0;t;){if(t.nodeType===8){var l=t.data;if(l==="/$"||l==="/&"){if(n===0)return On(t.nextSibling);n--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||n++}t=t.nextSibling}return null}function Ug(t){t=t.previousSibling;for(var n=0;t;){if(t.nodeType===8){var l=t.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(n===0)return t;n--}else l!=="/$"&&l!=="/&"||n++}t=t.previousSibling}return null}function $g(t,n,l){switch(n=wo(l),t){case"html":if(t=n.documentElement,!t)throw Error(i(452));return t;case"head":if(t=n.head,!t)throw Error(i(453));return t;case"body":if(t=n.body,!t)throw Error(i(454));return t;default:throw Error(i(451))}}function Ai(t){for(var n=t.attributes;n.length;)t.removeAttributeNode(n[0]);Bu(t)}var In=new Map,Bg=new Set;function So(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var Ca=ae.d;ae.d={f:S2,r:j2,D:N2,C:C2,L:E2,m:T2,X:A2,S:M2,M:R2};function S2(){var t=Ca.f(),n=ho();return t||n}function j2(t){var n=Jr(t);n!==null&&n.tag===5&&n.type==="form"?a0(n):Ca.r(t)}var Rl=typeof document>"u"?null:document;function Hg(t,n,l){var u=Rl;if(u&&typeof n=="string"&&n){var p=Mn(n);p='link[rel="'+t+'"][href="'+p+'"]',typeof l=="string"&&(p+='[crossorigin="'+l+'"]'),Bg.has(p)||(Bg.add(p),t={rel:t,crossOrigin:l,href:n},u.querySelector(p)===null&&(n=u.createElement("link"),Pt(n,"link",t),zt(n),u.head.appendChild(n)))}}function N2(t){Ca.D(t),Hg("dns-prefetch",t,null)}function C2(t,n){Ca.C(t,n),Hg("preconnect",t,n)}function E2(t,n,l){Ca.L(t,n,l);var u=Rl;if(u&&t&&n){var p='link[rel="preload"][as="'+Mn(n)+'"]';n==="image"&&l&&l.imageSrcSet?(p+='[imagesrcset="'+Mn(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(p+='[imagesizes="'+Mn(l.imageSizes)+'"]')):p+='[href="'+Mn(t)+'"]';var x=p;switch(n){case"style":x=_l(t);break;case"script":x=zl(t)}In.has(x)||(t=y({rel:"preload",href:n==="image"&&l&&l.imageSrcSet?void 0:t,as:n},l),In.set(x,t),u.querySelector(p)!==null||n==="style"&&u.querySelector(Ri(x))||n==="script"&&u.querySelector(_i(x))||(n=u.createElement("link"),Pt(n,"link",t),zt(n),u.head.appendChild(n)))}}function T2(t,n){Ca.m(t,n);var l=Rl;if(l&&t){var u=n&&typeof n.as=="string"?n.as:"script",p='link[rel="modulepreload"][as="'+Mn(u)+'"][href="'+Mn(t)+'"]',x=p;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=zl(t)}if(!In.has(x)&&(t=y({rel:"modulepreload",href:t},n),In.set(x,t),l.querySelector(p)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(_i(x)))return}u=l.createElement("link"),Pt(u,"link",t),zt(u),l.head.appendChild(u)}}}function M2(t,n,l){Ca.S(t,n,l);var u=Rl;if(u&&t){var p=el(u).hoistableStyles,x=_l(t);n=n||"default";var S=p.get(x);if(!S){var E={loading:0,preload:null};if(S=u.querySelector(Ri(x)))E.loading=5;else{t=y({rel:"stylesheet",href:t,"data-precedence":n},l),(l=In.get(x))&&$d(t,l);var H=S=u.createElement("link");zt(H),Pt(H,"link",t),H._p=new Promise(function(Q,oe){H.onload=Q,H.onerror=oe}),H.addEventListener("load",function(){E.loading|=1}),H.addEventListener("error",function(){E.loading|=2}),E.loading|=4,jo(S,n,u)}S={type:"stylesheet",instance:S,count:1,state:E},p.set(x,S)}}}function A2(t,n){Ca.X(t,n);var l=Rl;if(l&&t){var u=el(l).hoistableScripts,p=zl(t),x=u.get(p);x||(x=l.querySelector(_i(p)),x||(t=y({src:t,async:!0},n),(n=In.get(p))&&Bd(t,n),x=l.createElement("script"),zt(x),Pt(x,"link",t),l.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},u.set(p,x))}}function R2(t,n){Ca.M(t,n);var l=Rl;if(l&&t){var u=el(l).hoistableScripts,p=zl(t),x=u.get(p);x||(x=l.querySelector(_i(p)),x||(t=y({src:t,async:!0,type:"module"},n),(n=In.get(p))&&Bd(t,n),x=l.createElement("script"),zt(x),Pt(x,"link",t),l.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},u.set(p,x))}}function Pg(t,n,l,u){var p=(p=ue.current)?So(p):null;if(!p)throw Error(i(446));switch(t){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(n=_l(l.href),l=el(p).hoistableStyles,u=l.get(n),u||(u={type:"style",instance:null,count:0,state:null},l.set(n,u)),u):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){t=_l(l.href);var x=el(p).hoistableStyles,S=x.get(t);if(S||(p=p.ownerDocument||p,S={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(t,S),(x=p.querySelector(Ri(t)))&&!x._p&&(S.instance=x,S.state.loading=5),In.has(t)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},In.set(t,l),x||_2(p,t,l,S.state))),n&&u===null)throw Error(i(528,""));return S}if(n&&u!==null)throw Error(i(529,""));return null;case"script":return n=l.async,l=l.src,typeof l=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=zl(l),l=el(p).hoistableScripts,u=l.get(n),u||(u={type:"script",instance:null,count:0,state:null},l.set(n,u)),u):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,t))}}function _l(t){return'href="'+Mn(t)+'"'}function Ri(t){return'link[rel="stylesheet"]['+t+"]"}function qg(t){return y({},t,{"data-precedence":t.precedence,precedence:null})}function _2(t,n,l,u){t.querySelector('link[rel="preload"][as="style"]['+n+"]")?u.loading=1:(n=t.createElement("link"),u.preload=n,n.addEventListener("load",function(){return u.loading|=1}),n.addEventListener("error",function(){return u.loading|=2}),Pt(n,"link",l),zt(n),t.head.appendChild(n))}function zl(t){return'[src="'+Mn(t)+'"]'}function _i(t){return"script[async]"+t}function Fg(t,n,l){if(n.count++,n.instance===null)switch(n.type){case"style":var u=t.querySelector('style[data-href~="'+Mn(l.href)+'"]');if(u)return n.instance=u,zt(u),u;var p=y({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return u=(t.ownerDocument||t).createElement("style"),zt(u),Pt(u,"style",p),jo(u,l.precedence,t),n.instance=u;case"stylesheet":p=_l(l.href);var x=t.querySelector(Ri(p));if(x)return n.state.loading|=4,n.instance=x,zt(x),x;u=qg(l),(p=In.get(p))&&$d(u,p),x=(t.ownerDocument||t).createElement("link"),zt(x);var S=x;return S._p=new Promise(function(E,H){S.onload=E,S.onerror=H}),Pt(x,"link",u),n.state.loading|=4,jo(x,l.precedence,t),n.instance=x;case"script":return x=zl(l.src),(p=t.querySelector(_i(x)))?(n.instance=p,zt(p),p):(u=l,(p=In.get(x))&&(u=y({},l),Bd(u,p)),t=t.ownerDocument||t,p=t.createElement("script"),zt(p),Pt(p,"link",u),t.head.appendChild(p),n.instance=p);case"void":return null;default:throw Error(i(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(u=n.instance,n.state.loading|=4,jo(u,l.precedence,t));return n.instance}function jo(t,n,l){for(var u=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),p=u.length?u[u.length-1]:null,x=p,S=0;S<u.length;S++){var E=u[S];if(E.dataset.precedence===n)x=E;else if(x!==p)break}x?x.parentNode.insertBefore(t,x.nextSibling):(n=l.nodeType===9?l.head:l,n.insertBefore(t,n.firstChild))}function $d(t,n){t.crossOrigin==null&&(t.crossOrigin=n.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=n.referrerPolicy),t.title==null&&(t.title=n.title)}function Bd(t,n){t.crossOrigin==null&&(t.crossOrigin=n.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=n.referrerPolicy),t.integrity==null&&(t.integrity=n.integrity)}var No=null;function Vg(t,n,l){if(No===null){var u=new Map,p=No=new Map;p.set(l,u)}else p=No,u=p.get(l),u||(u=new Map,p.set(l,u));if(u.has(t))return u;for(u.set(t,null),l=l.getElementsByTagName(t),p=0;p<l.length;p++){var x=l[p];if(!(x[Kl]||x[Ut]||t==="link"&&x.getAttribute("rel")==="stylesheet")&&x.namespaceURI!=="http://www.w3.org/2000/svg"){var S=x.getAttribute(n)||"";S=t+S;var E=u.get(S);E?E.push(x):u.set(S,[x])}}return u}function Yg(t,n,l){t=t.ownerDocument||t,t.head.insertBefore(l,n==="title"?t.querySelector("head > title"):null)}function z2(t,n,l){if(l===1||n.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;return n.rel==="stylesheet"?(t=n.disabled,typeof n.precedence=="string"&&t==null):!0;case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function Gg(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function D2(t,n,l,u){if(l.type==="stylesheet"&&(typeof u.media!="string"||matchMedia(u.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var p=_l(u.href),x=n.querySelector(Ri(p));if(x){n=x._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(t.count++,t=Co.bind(t),n.then(t,t)),l.state.loading|=4,l.instance=x,zt(x);return}x=n.ownerDocument||n,u=qg(u),(p=In.get(p))&&$d(u,p),x=x.createElement("link"),zt(x);var S=x;S._p=new Promise(function(E,H){S.onload=E,S.onerror=H}),Pt(x,"link",u),l.instance=x}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(l,n),(n=l.state.preload)&&(l.state.loading&3)===0&&(t.count++,l=Co.bind(t),n.addEventListener("load",l),n.addEventListener("error",l))}}var Hd=0;function L2(t,n){return t.stylesheets&&t.count===0&&To(t,t.stylesheets),0<t.count||0<t.imgCount?function(l){var u=setTimeout(function(){if(t.stylesheets&&To(t,t.stylesheets),t.unsuspend){var x=t.unsuspend;t.unsuspend=null,x()}},6e4+n);0<t.imgBytes&&Hd===0&&(Hd=62500*p2());var p=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&To(t,t.stylesheets),t.unsuspend)){var x=t.unsuspend;t.unsuspend=null,x()}},(t.imgBytes>Hd?50:800)+n);return t.unsuspend=l,function(){t.unsuspend=null,clearTimeout(u),clearTimeout(p)}}:null}function Co(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)To(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Eo=null;function To(t,n){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Eo=new Map,n.forEach(O2,t),Eo=null,Co.call(t))}function O2(t,n){if(!(n.state.loading&4)){var l=Eo.get(t);if(l)var u=l.get(null);else{l=new Map,Eo.set(t,l);for(var p=t.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x<p.length;x++){var S=p[x];(S.nodeName==="LINK"||S.getAttribute("media")!=="not all")&&(l.set(S.dataset.precedence,S),u=S)}u&&l.set(null,u)}p=n.instance,S=p.getAttribute("data-precedence"),x=l.get(S)||u,x===u&&l.set(null,p),l.set(S,p),this.count++,u=Co.bind(this),p.addEventListener("load",u),p.addEventListener("error",u),x?x.parentNode.insertBefore(p,x.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(p,t.firstChild)),n.state.loading|=4}}var zi={$$typeof:M,Provider:null,Consumer:null,_currentValue:ne,_currentValue2:ne,_threadCount:0};function I2(t,n,l,u,p,x,S,E,H){this.tag=1,this.containerInfo=t,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Ou(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ou(0),this.hiddenUpdates=Ou(null),this.identifierPrefix=u,this.onUncaughtError=p,this.onCaughtError=x,this.onRecoverableError=S,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=H,this.incompleteTransitions=new Map}function Kg(t,n,l,u,p,x,S,E,H,Q,oe,fe){return t=new I2(t,n,l,S,H,Q,oe,fe,E),n=1,x===!0&&(n|=24),x=gn(3,null,null,n),t.current=x,x.stateNode=t,n=bc(),n.refCount++,t.pooledCache=n,n.refCount++,x.memoizedState={element:u,isDehydrated:l,cache:n},jc(x),t}function Wg(t){return t?(t=cl,t):cl}function Xg(t,n,l,u,p,x){p=Wg(p),u.context===null?u.context=p:u.pendingContext=p,u=qa(n),u.payload={element:l},x=x===void 0?null:x,x!==null&&(u.callback=x),l=Fa(t,u,n),l!==null&&(on(l,t,n),di(l,t,n))}function Qg(t,n){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var l=t.retryLane;t.retryLane=l!==0&&l<n?l:n}}function Pd(t,n){Qg(t,n),(t=t.alternate)&&Qg(t,n)}function Zg(t){if(t.tag===13||t.tag===31){var n=br(t,67108864);n!==null&&on(n,t,67108864),Pd(t,67108864)}}function Jg(t){if(t.tag===13||t.tag===31){var n=kn();n=Iu(n);var l=br(t,n);l!==null&&on(l,t,n),Pd(t,n)}}var Mo=!0;function U2(t,n,l,u){var p=L.T;L.T=null;var x=ae.p;try{ae.p=2,qd(t,n,l,u)}finally{ae.p=x,L.T=p}}function $2(t,n,l,u){var p=L.T;L.T=null;var x=ae.p;try{ae.p=8,qd(t,n,l,u)}finally{ae.p=x,L.T=p}}function qd(t,n,l,u){if(Mo){var p=Fd(u);if(p===null)Md(t,n,u,Ao,l),tx(t,u);else if(H2(p,t,n,l,u))u.stopPropagation();else if(tx(t,u),n&4&&-1<B2.indexOf(t)){for(;p!==null;){var x=Jr(p);if(x!==null)switch(x.tag){case 3:if(x=x.stateNode,x.current.memoizedState.isDehydrated){var S=pr(x.pendingLanes);if(S!==0){var E=x;for(E.pendingLanes|=2,E.entangledLanes|=2;S;){var H=1<<31-ze(S);E.entanglements[1]|=H,S&=~H}aa(x),(Ke&6)===0&&(fo=ct()+500,Ei(0))}}break;case 31:case 13:E=br(x,2),E!==null&&on(E,x,2),ho(),Pd(x,2)}if(x=Fd(u),x===null&&Md(t,n,u,Ao,l),x===p)break;p=x}p!==null&&u.stopPropagation()}else Md(t,n,u,null,l)}}function Fd(t){return t=Yu(t),Vd(t)}var Ao=null;function Vd(t){if(Ao=null,t=Zr(t),t!==null){var n=c(t);if(n===null)t=null;else{var l=n.tag;if(l===13){if(t=d(n),t!==null)return t;t=null}else if(l===31){if(t=f(n),t!==null)return t;t=null}else if(l===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;t=null}else n!==t&&(t=null)}}return Ao=t,null}function ex(t){switch(t){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Vn()){case se:return 2;case ie:return 8;case he:case Se:return 32;case Ae:return 268435456;default:return 32}default:return 32}}var Yd=!1,tr=null,nr=null,ar=null,Di=new Map,Li=new Map,rr=[],B2="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function tx(t,n){switch(t){case"focusin":case"focusout":tr=null;break;case"dragenter":case"dragleave":nr=null;break;case"mouseover":case"mouseout":ar=null;break;case"pointerover":case"pointerout":Di.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":Li.delete(n.pointerId)}}function Oi(t,n,l,u,p,x){return t===null||t.nativeEvent!==x?(t={blockedOn:n,domEventName:l,eventSystemFlags:u,nativeEvent:x,targetContainers:[p]},n!==null&&(n=Jr(n),n!==null&&Zg(n)),t):(t.eventSystemFlags|=u,n=t.targetContainers,p!==null&&n.indexOf(p)===-1&&n.push(p),t)}function H2(t,n,l,u,p){switch(n){case"focusin":return tr=Oi(tr,t,n,l,u,p),!0;case"dragenter":return nr=Oi(nr,t,n,l,u,p),!0;case"mouseover":return ar=Oi(ar,t,n,l,u,p),!0;case"pointerover":var x=p.pointerId;return Di.set(x,Oi(Di.get(x)||null,t,n,l,u,p)),!0;case"gotpointercapture":return x=p.pointerId,Li.set(x,Oi(Li.get(x)||null,t,n,l,u,p)),!0}return!1}function nx(t){var n=Zr(t.target);if(n!==null){var l=c(n);if(l!==null){if(n=l.tag,n===13){if(n=d(l),n!==null){t.blockedOn=n,gh(t.priority,function(){Jg(l)});return}}else if(n===31){if(n=f(l),n!==null){t.blockedOn=n,gh(t.priority,function(){Jg(l)});return}}else if(n===3&&l.stateNode.current.memoizedState.isDehydrated){t.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Ro(t){if(t.blockedOn!==null)return!1;for(var n=t.targetContainers;0<n.length;){var l=Fd(t.nativeEvent);if(l===null){l=t.nativeEvent;var u=new l.constructor(l.type,l);Vu=u,l.target.dispatchEvent(u),Vu=null}else return n=Jr(l),n!==null&&Zg(n),t.blockedOn=l,!1;n.shift()}return!0}function ax(t,n,l){Ro(t)&&l.delete(n)}function P2(){Yd=!1,tr!==null&&Ro(tr)&&(tr=null),nr!==null&&Ro(nr)&&(nr=null),ar!==null&&Ro(ar)&&(ar=null),Di.forEach(ax),Li.forEach(ax)}function _o(t,n){t.blockedOn===n&&(t.blockedOn=null,Yd||(Yd=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,P2)))}var zo=null;function rx(t){zo!==t&&(zo=t,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){zo===t&&(zo=null);for(var n=0;n<t.length;n+=3){var l=t[n],u=t[n+1],p=t[n+2];if(typeof u!="function"){if(Vd(u||l)===null)continue;break}var x=Jr(l);x!==null&&(t.splice(n,3),n-=3,Fc(x,{pending:!0,data:p,method:l.method,action:u},u,p))}}))}function Dl(t){function n(H){return _o(H,t)}tr!==null&&_o(tr,t),nr!==null&&_o(nr,t),ar!==null&&_o(ar,t),Di.forEach(n),Li.forEach(n);for(var l=0;l<rr.length;l++){var u=rr[l];u.blockedOn===t&&(u.blockedOn=null)}for(;0<rr.length&&(l=rr[0],l.blockedOn===null);)nx(l),l.blockedOn===null&&rr.shift();if(l=(t.ownerDocument||t).$$reactFormReplay,l!=null)for(u=0;u<l.length;u+=3){var p=l[u],x=l[u+1],S=p[tn]||null;if(typeof x=="function")S||rx(l);else if(S){var E=null;if(x&&x.hasAttribute("formAction")){if(p=x,S=x[tn]||null)E=S.formAction;else if(Vd(p)!==null)continue}else E=S.action;typeof E=="function"?l[u+1]=E:(l.splice(u,3),u-=3),rx(l)}}}function lx(){function t(x){x.canIntercept&&x.info==="react-transition"&&x.intercept({handler:function(){return new Promise(function(S){return p=S})},focusReset:"manual",scroll:"manual"})}function n(){p!==null&&(p(),p=null),u||setTimeout(l,20)}function l(){if(!u&&!navigation.transition){var x=navigation.currentEntry;x&&x.url!=null&&navigation.navigate(x.url,{state:x.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var u=!1,p=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(l,100),function(){u=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),p!==null&&(p(),p=null)}}}function Gd(t){this._internalRoot=t}Do.prototype.render=Gd.prototype.render=function(t){var n=this._internalRoot;if(n===null)throw Error(i(409));var l=n.current,u=kn();Xg(l,u,t,n,null,null)},Do.prototype.unmount=Gd.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var n=t.containerInfo;Xg(t.current,2,null,t,null,null),ho(),n[Qr]=null}};function Do(t){this._internalRoot=t}Do.prototype.unstable_scheduleHydration=function(t){if(t){var n=ph();t={blockedOn:null,target:t,priority:n};for(var l=0;l<rr.length&&n!==0&&n<rr[l].priority;l++);rr.splice(l,0,t),l===0&&nx(t)}};var ix=a.version;if(ix!=="19.2.7")throw Error(i(527,ix,"19.2.7"));ae.findDOMNode=function(t){var n=t._reactInternals;if(n===void 0)throw typeof t.render=="function"?Error(i(188)):(t=Object.keys(t).join(","),Error(i(268,t)));return t=m(n),t=t!==null?g(t):null,t=t===null?null:t.stateNode,t};var q2={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:L,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Lo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Lo.isDisabled&&Lo.supportsFiber)try{ee=Lo.inject(q2),ve=Lo}catch{}}return Ui.createRoot=function(t,n){if(!o(t))throw Error(i(299));var l=!1,u="",p=m0,x=h0,S=p0;return n!=null&&(n.unstable_strictMode===!0&&(l=!0),n.identifierPrefix!==void 0&&(u=n.identifierPrefix),n.onUncaughtError!==void 0&&(p=n.onUncaughtError),n.onCaughtError!==void 0&&(x=n.onCaughtError),n.onRecoverableError!==void 0&&(S=n.onRecoverableError)),n=Kg(t,1,!1,null,null,l,u,null,p,x,S,lx),t[Qr]=n.current,Td(t),new Gd(n)},Ui.hydrateRoot=function(t,n,l){if(!o(t))throw Error(i(299));var u=!1,p="",x=m0,S=h0,E=p0,H=null;return l!=null&&(l.unstable_strictMode===!0&&(u=!0),l.identifierPrefix!==void 0&&(p=l.identifierPrefix),l.onUncaughtError!==void 0&&(x=l.onUncaughtError),l.onCaughtError!==void 0&&(S=l.onCaughtError),l.onRecoverableError!==void 0&&(E=l.onRecoverableError),l.formState!==void 0&&(H=l.formState)),n=Kg(t,1,!0,n,l??null,u,p,H,x,S,E,lx),n.context=Wg(null),l=n.current,u=kn(),u=Iu(u),p=qa(u),p.callback=null,Fa(l,p,u),l=u,n.current.lanes=l,Gl(n,l),aa(n),t[Qr]=n.current,Td(t),new Do(n)},Ui.version="19.2.7",Ui}var gx;function Z2(){if(gx)return Xd.exports;gx=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(a){console.error(a)}}return e(),Xd.exports=Q2(),Xd.exports}var J2=Z2();const u1={appName:"PenguinHarness",nav:{chat:"对话",newChat:"新对话",agents:"智能体仓库",skills:"技能库",models:"模型仓库",usage:"成本中心",traces:"轨迹观测",benchmark:"评估中心",collapseSidebar:"收起侧栏",expandSidebar:"展开侧栏",collapseGroup:"折叠",expandGroup:"展开"},settings:{language:"语言",theme:"主题",themeLight:"浅色",themeDark:"深色",followSystem:"跟随系统",langZh:"中文",langEn:"English",fontSize:"字号",fontSmall:"小",fontMedium:"中",fontLarge:"大",accent:"主题色",accentNames:{neutral:"灰白",blue:"蓝",green:"绿",violet:"紫",rose:"红",amber:"橙"}},common:{save:"保存",cancel:"取消",create:"创建",delete:"删除",edit:"编辑",settings:"设置",confirm:"确认",close:"关闭",loading:"加载中…",loadMore:"加载更多",saved:"已保存",saving:"保存中…",none:"(无)",retry:"重试",unknownError:"请求失败,请稍后重试",requiredField:"此项必填",copied:"已复制",ownerOnly:"仅 owner 可修改"},auth:{loginTitle:"登录 PenguinHarness",username:"用户名",usernameHint:"2~32 位:小写字母开头,仅小写字母、数字与下划线",password:"密码",passwordHint:"至少 8 个字符",showPassword:"显示密码",hidePassword:"隐藏密码",login:"登录",logout:"登出",admin:"管理员",defaultAdminNote:"首次使用请以内置管理员登录:admin / admin123,登录后请尽快修改密码"},account:{changePassword:"修改密码",oldPassword:"当前密码",newPassword:"新密码",confirmPassword:"确认新密码",passwordMismatch:"两次输入的新密码不一致",initialPasswordBanner:"当前账号正在使用初始密码,建议尽快修改",changeNow:"去修改"},admin:{users:"用户管理",userId:"用户名",role:"角色",roleAdmin:"管理员",roleUser:"用户",createdAt:"创建时间",actions:"操作",createUser:"新增用户",initialPassword:"初始密码",initialPasswordFlag:"初始密码",defaultProjectNote:e=>`将自动创建默认 Project:${e}`,resetPassword:"重置密码",resetPasswordTitle:e=>`重置 ${e} 的密码`,resetPasswordNote:"重置后该用户的登录会话全部失效,需用新密码重新登录",deleteUser:"删除",deleteUserTitle:e=>`删除用户 ${e}`,deleteUserConfirm:e=>`将删除用户 ${e} 及其名下全部 Project(含数据目录),不可恢复。`},project:{switcher:"Project",create:"新建 Project",createTitle:"新建 Project",id:"Project id",idHint:"2~64 位:小写字母开头,仅小写字母、数字与下划线;创建后不可修改",idPrefixHint:"id 固定以「用户名-」为前缀,后接小写字母、数字或下划线;创建后不可修改",name:"显示名(可选,缺省为 Project id)",settings:"Project 设置",settingsTitle:"Project 设置",members:"成员",addMember:"添加成员",memberUsername:"用户名",memberRole:"角色",memberActions:"操作",removeMember:"移除",owner:"owner",member:"member",deleteProject:"删除 Project",deleteConfirm:"确认删除该 Project?项目目录将被递归删除,不可恢复。",deleteDefaultForbidden:"default_project 与 CLI 共用,不允许在 Web 端删除",deleteLastForbidden:"这是当前账号最后一个 Project,删除后将无 Project 可用;请先创建新的 Project",noCredentialTitle:"尚未配置模型 credential",noCredentialBody:"当前 Project 的默认模型尚未配置 API key,发起对话前请先前往模型页配置。",goToModels:"前往模型页",later:"稍后再说"},agent:{listTitle:"Agents",create:"创建 Agent",createTitle:"创建 Agent",id:"Agent id",idHint:"2~64 位:小写字母开头,仅小写字母、数字与下划线;创建后不可修改",name:"名称",nameHint:"留空则使用 Agent id 作为名称",description:"描述",activeSessions:"活跃 Session",sessionCount:e=>`${e} 个 Session`,toolCount:e=>`${e} 个工具`,vaultKeyCount:e=>`${e} 个密钥`,scheduleCount:e=>`${e} 个定时任务`,updatedAt:"最后修改",activity:e=>`近 ${e} 天 Session 活跃度`,settings:"Agent 设置",backToList:"返回 Agents",tabOverview:"概览",tabPrompt:"Prompt",tabRuntime:"运行参数",tabTools:"工具",tabVault:"密钥保险柜",tabSchedules:"定时任务",stateDir:"State 路径",agentsMd:"AGENTS.md",systemPrompt:"system_prompt 模板",placeholdersTitle:"可用占位符(点击插入)",insertPlaceholder:"插入到 system_prompt 光标处",placeholders:[["{{AGENTS_MD}}","注入 AGENTS.md 内容"],["{{VAULT_KEYS}}","注入密钥保险柜的键名小节(无键时为空)"],["{{PLATFORM}}","运行平台"],["{{OS_VERSION}}","操作系统版本"],["{{DATE}}","当前日期"],["{{CWD}}","Workspace 绝对路径"],["{{AGENT_ID}}","当前 Agent id"],["{{PROJECT_DIR}}","Project 目录绝对路径(Agent State/scratchpad 由此拼出)"],["{{SESSION_ID}}","当前 Session id"]],maxTurns:"max_turns(单 Task 最大轮次,-1 不限制)",maxTokens:"model.max_tokens",thinkingLevel:"model.thinking_level",thinkingLevelOptions:[["","不提交覆盖值,沿用当前生效的配置。"],["none","关闭扩展推理,响应最快。"],["low","开启较低强度的扩展推理。"],["medium","开启中等强度的扩展推理(新建 Agent 的缺省档位)。"],["high","开启较高强度的扩展推理,响应更慢。"],["xhigh","开启最高强度的扩展推理,部分模型上效果与 high 相同。"]],timeoutMs:"model.timeoutMs",timeoutMsHint:"单次 Request 超时,毫秒",compaction:"上下文压缩(compaction)",maxContextLength:"max_context_length",maxContextLengthHint:"触发压缩的上下文阈值",maxSessionTurns:"max_session_turns",maxSessionTurnsHint:"触发压缩的轮数阈值",compactionMode:"mode(压缩方式)",compactionModeOptions:[["","不提交覆盖值,沿用当前生效的配置。"],["summarize","先让模型为旧上下文生成摘要,再从摘要续接新的上下文窗口(缺省)。"],["discard","不生成摘要,直接丢弃旧上下文,下一轮从新窗口重新开始。"]],compactionPrompt:"prompt(摘要提示词)",maxTurnsInvalid:"max_turns 必须 > 0 或为 -1",timeoutInvalid:"timeoutMs 必须 > 0 或为 -1",toolFieldInvalid:(e,a)=>`${e}: ${a} 必须是 > 0 的整数或 -1`,builtinTools:"内置工具",toolName:"名称",toolPermission:"permission",permissionReadLabel:"Read-only",permissionReadDescription:"仅读取。审批模式为 read-only 时自动放行,无需确认。",permissionReadWriteLabel:"Read & write",permissionReadWriteDescription:"可修改。审批模式为 read-only 时需人工确认。",toolTimeout:"timeoutMs",toolMaxOutput:"maxOutputLength",mcpServers:"MCP Server(只读)",defaultValue:"(缺省)",deleteAgent:"删除 Agent",builtinUndeletable:"内置 Agent 不可被删除",deleteConfirm:e=>`确认删除 Agent「${e}」?其目录(含全部 Trace)将被递归删除,不可恢复。`,stateVersion:"Agent State 版本",transferTitle:"导出 / 导入",transferDesc:"导出当前 Agent State 快照包(tar.gz);导入整目录覆盖,并以包内版本为准。",exportSnapshot:"导出快照",importSnapshot:"导入快照",importing:"导入中…",importDone:e=>`导入完成,Agent State 版本 v${e}`,importConflictTitle:"版本冲突",importConflictBody:"快照包版本不高于当前版本,导入将覆盖现有 Agent State。确认继续?"},models:{title:"模型配置",addCustom:"添加自定义模型",addToGroup:"新增模型",editTitle:"模型配置",addTitle:"新增模型(OpenAI 协议)",addTitleVendor:"新增模型(按 id 自动路由)",addProtocolHint:"新增模型固定走 OpenAI Chat Completions 兼容协议(不按模型 id 自动路由),base URL 填其兼容端点",addAutoRouteHint:"该分组的新模型按上游 id 由 AgentHub 自动路由到厂商官方客户端:base URL 留空即官方端点,API key 留空按解析出的客户端读取环境变量",autoRouteNone:"该 id 无法被 AgentHub 自动路由:请核对 id,或改在 Custom / 自建分组下以 OpenAI 协议接入",addGroup:"新增分组",addGroupTitle:"新增分组",addGroupDesc:"自建分组与 Custom 同语义:组内模型走 OpenAI Chat Completions 兼容协议(base URL 必填,API key 留空读取 OPENAI_API_KEY)。分组由模型条目承载,保存首个模型后即出现。",groupNameLabel:"分组名",groupNameHint:"小写字母 / 数字开头,可含 - 与 _",groupNameInvalid:"分组名只能用小写字母、数字、- 与 _(首字符为字母或数字),长度不超过 32",groupNameExists:"该分组名已被内置分组或既有条目占用",groupEmptyHint:"该分组暂无模型,点「新增模型」添加",searchPlaceholder:"搜索模型:id / 名称 / 厂商",noSearchResults:"没有匹配的模型",modelCount:e=>`${e} 个模型`,modelId:"模型 ID",modelIdHint:"上游 API 使用的模型 id,如 gpt-5.5",displayName:"模型名称",displayNameHint:"留空则展示模型 ID",providerGroup:"分组",contextWindow:"上下文窗口",contextWindowUnit:"tokens",contextWindowHint:"留空表示未知",clientTypeLocked:e=>`协议:${e}(沿用原配置,不可修改)`,vision:"支持图片输入(视觉/多模态)",visionHint:"取消勾选后,对话中上传的图片将以文件路径转交,读图经 describe_image 由视觉模型代读",visionBadge:"视觉",visionModelBadge:"视觉代理",setVisionModel:"设为视觉代理模型",visionModelHint:"供不支持图片的模型经 describe_image 代读图片",priceUnitShort:"/M tok",testConnection:"测试连通性",testing:"测试中…",testOk:e=>`连通正常(${e} ms)`,testFailed:e=>`连通失败:${e}`,modelIdRenameHint:"改 id 后原配置与 API key 一并迁移",priceCacheRead:"缓存读取",priceCacheWrite:"缓存写入",priceOutput:"输出",pricing:"价格",priceUnit:"每百万 Token",currency:"币种",currencyUsd:"美元 $",currencyCny:"人民币 ¥",currencyHint:"价格按 1 美元 ≈ 7 人民币折算;存储始终为美元",firstModelDefault:"已自动设为默认模型",credential:"凭据",apiKey:"API key",apiKeyKeepHint:"留空保留现有 key",apiKeyEnvHint:e=>`留空则使用环境变量 ${e}`,useEnvVar:e=>`环境变量 ${e}`,keyConfigured:"已配置 key",clearApiKey:"清除已存 API key",baseUrl:"自定义 base URL",baseUrlHint:"留空使用厂商默认地址",baseUrlRequired:"必须填写 base URL",contextWindowDefaultHint:e=>`留空按 ${e} 计`,visionOnHint:"读图用 read_image:图片直接回灌模型",visionOffHint:"读图用 describe_image:图片交给视觉代理模型描述、只回文本;对话中上传的图片以文件路径转交",confirmDeleteTitle:"删除模型",confirmDelete:e=>`确定删除「${e}」?该模型的配置与 API key 将一并移除。`,groupApiKey:"统一配置 API key",groupApiKeyTitle:e=>`为「${e}」统一配置 API key`,groupApiKeyHint:e=>`将写入该分组下全部 ${e} 个模型;留空不改动。`,getApiKey:"获取 API key",getModelIds:"获取模型 id",groupKeyApplied:e=>`已为 ${e} 个模型配置 API key`,providerEnvNotes:{zhipu:"缺省端点为 Z.AI 国际版(api.z.ai);智谱开放平台(bigmodel.cn)的 key 需填 base URL https://open.bigmodel.cn/api/paas/v4",moonshot:"缺省端点为国内版(api.moonshot.cn);platform.kimi.com(国际)的 key 需填 base URL https://api.moonshot.ai/v1"},confirmVisionModelTitle:"设为视觉代理模型",confirmVisionModel:e=>`确定把「${e}」设为视觉代理模型?不支持图片的模型将由它经 describe_image 代读图片。`,confirmSaveTitle:"保存模型配置",confirmSave:e=>`确定保存对「${e}」的配置修改?`,confirmDefaultTitle:"设为默认模型",confirmDefault:e=>`确定把「${e}」设为默认模型?新建的 Session 将默认使用它。`,createdAt:"创建时间",default:"默认",setDefault:"设为默认模型",remove:"删除模型",saveAll:"保存全部",readOnlyHint:"member 只读;模型与 credential 修改仅 owner 可执行",empty:"尚未配置任何模型",noKey:"未配置 key",pendingSave:"(待保存)",modelIdExists:"该模型 id 已存在",pricingAllOrNone:"三项价格需一并填写",pricingInvalid:"必须为数字",contextWindowInvalid:"必须为数字"},vault:{desc:"本 Agent 专属的环境变量(存于 agent_state/.vault.toml):键值对注入其 shell 命令(exec_command)的子进程环境;键名会告知模型,值不进入模型上下文。子 Agent 使用各自的保险柜,不继承。",key:"键名",value:"值",valueMasked:"值(掩码)",add:"添加",addTitle:"添加环境变量",remove:"删除",deleteTitle:"删除环境变量",deleteConfirm:e=>`确认删除环境变量「${e}」?值不可恢复。`,empty:"尚未配置任何环境变量",readOnlyHint:"member 只读;Vault 修改仅 owner 可执行",keyHint:"字母、数字与下划线,不能以数字开头",keyInvalid:"键名不合法:仅字母、数字与下划线,且不能以数字开头",valueRequired:"值不能为空"},schedule:{desc:"定时任务(agent_state/schedule/*.toml):到点自动向目标 Session 发送 prompt;文件亦可手工编辑,Web 端修改后即时生效。",readOnlyHint:"member 只读;定时任务修改仅 owner 可执行",colName:"名称",colStatus:"状态",colPeriod:"周期",colTarget:"目标",colFireTimes:"下次 / 最近触发",colQueued:"排队",statusNames:{active:"生效",disabled:"停用",expired:"已过期",done:"已完成",missed:"已错过",invalid:"无效"},queued:"排队中",once:"一次性",newSession:"新建会话",invalidFiles:"解析失败的文件(已跳过调度)",empty:"尚未配置定时任务",enable:"启用",disable:"停用",addTitle:"新建定时任务",editTitle:e=>`编辑定时任务「${e}」`,name:"名称",nameHint:"即文件名(不含 .toml),创建后不可改",prompt:"Prompt",enabled:"启用",startAt:"开始时间",endAt:"结束时间(可选)",period:"周期",periodPlaceholder:"30m / 12h / 7d,留空为一次性",target:"目标",targetNew:"每次新建会话",targetSession:"绑定 Session",sessionId:"Session id",workspace:"Workspace(可选,留空自动创建)",model:"Model",modelDefault:"Project 默认",deleteTitle:"删除定时任务",deleteConfirm:e=>`确认删除定时任务「${e}」?`},skills:{pageTitle:"技能库",pageDesc:"内置 Skill 库:浏览、快捷调用,或安装到 Agent。",quickInvoke:"快捷调用",quickInvokeText:e=>`使用 ${e} 技能`,manageInstall:"管理安装",manageInstallTitle:e=>`管理安装:${e}`,install:"安装",installed:"已安装",uninstall:"卸载",skillCount:e=>`${e} 个技能`,usedByAgents:e=>e===0?"未被使用":`${e} 个 Agent 在用`,installedToast:(e,a)=>`已将 ${e} 安装到 ${a}`,uninstalledToast:(e,a)=>`已从 ${a} 卸载 ${e}`},chat:{newSessionMenu:"新建对话",chooseAgent:"选择 Agent",chooseModel:"选择模型",workspaceUseThis:"使用此目录",workspaceUp:"上级目录",workspaceNoSubdirs:"无子目录",workspaceAuto:"自动临时目录",workspaceClear:"改用自动临时目录",workspaceDirInvalid:"目录不存在或无法访问,已回退",draftSubtitle:"最擅长 AI 开发任务的自进化 Agent",sessionList:"Session",defaultSessionTitle:"新对话",model:"Model",workspace:"Workspace",workspaceHint:"留空自动创建临时目录;指定时必须是服务器上已存在的目录",approvalMode:"审批模式",approvalModeNames:{"allow-all":"全部放行","deny-all":"全部拒绝","read-only":"放行只读","always-ask":"总是询问"},approvalModes:{"allow-all":"全部放行(allow-all)","deny-all":"全部拒绝(deny-all)","read-only":"放行只读(read-only)","always-ask":"总是询问(always-ask)"},statusIdle:"空闲",statusRunning:"运行中",statusCompacting:"压缩中",pendingApprovals:e=>`${e} 个待审批`,inputPlaceholder:"输入消息,Enter 发送,Shift+Enter 换行,可粘贴图片",inputPlaceholderShort:"输入消息…",send:"发送",stop:"停止",compactingHint:"上下文压缩中,暂不接受新输入",compact:"压缩上下文",approve:"允许",deny:"拒绝",decisionAllow:"已批准",decisionDeny:"已拒绝",decisionManual:"手动",decisionAuto:"自动",thinking:"思考",subagent:"子会话",subagentRunning:"运行中",aborted:e=>`[已中断]${e?`:${e}`:""}`,reconnect:(e,a,r)=>{const i=e==="timeout"?"连接超时或网络中断":"响应不完整或无法解析",o=a==="gaveUp"?"已停止重试":a==="retried"?`已发起第 ${r} 次重试`:`正在发起第 ${r} 次重试…`;return`[重试] ${i},${o}`},imageAlt:"用户上传的图片",toolImageAlt:"工具输出的图片",imagesAsPathHint:"当前模型不支持直接查看图片:发送时图片将保存到会话临时目录,以文件路径转交(模型经 describe_image 查看)",infoPanel:"Session 信息",sessionStats:"统计",statTokens:"Token 累计",statCost:"成本",statElapsed:"用时",statInput:"输入 tokens",statOutput:"输出 tokens",statTps:"输出 TPS",noSessions:"还没有 Session",emptyStream:"发送一条消息开始对话",historyLoadFailed:"历史消息加载失败",sessionHealed:"Session 已自愈为新 id",statsLabel:"统计信息",removeImage:"移除图片",openWorkspace:"打开工作区",filesInMessage:e=>`${e} 个文件`,openPreview:"点击预览",showMoreFiles:e=>`显示其余 ${e} 个文件`,showLess:"收起",contextUsage:"上下文占用",contextUnknown:"上下文占用:压缩后待下次请求回报",slashHint:"输入 / 使用命令",mentionHint:"@ handoff 给其他 Agent",mentionRemove:"移除 @ 目标",skillsSelect:"技能",skillsSearchPlaceholder:"搜索技能",skillsNoMatch:"没有匹配的技能",skillsEmptyHint:"暂无已装技能,去技能库添加",skillsAutoMessage:e=>`使用 ${e.join("、")} 技能`,handoffFrom:e=>`由 ${e} 的对话交接而来`,handoffBack:e=>e?`回到原对话:${e}`:"回到原对话",scheduledFrom:e=>`由定时任务「${e}」触发`,sourceNames:{schedule:"定时",subagent:"子"},commandCompact:"/compact",emptyGreeting:"开始一段新对话",compactionRunning:e=>`压缩进行中(${e})…`,compactionDone:e=>e==="discard"?"[压缩] 完成,旧上下文已丢弃":"[压缩] 完成,已切换到摘要后的新上下文",compactionFailed:e=>`[压缩] ${e==="aborted"?"已中断":"失败"},保留当前上下文`,unknownTool:"(未知工具)",toolCall:"工具调用",workGroupTitle:"推理与工具",workRunning:"运行中",workDone:"运行完毕",workGroupSteps:e=>`${e} 步`,approvalWaiting:"待审批",copyCode:"复制代码",copyStats:"复制统计",copyReply:"复制回复",copyMessage:"复制消息",copied:"已复制",deleteSession:"删除对话",renameSession:"重命名对话",renameSessionLabel:"标题",deleteSessionConfirm:e=>`确定删除「${e}」?该对话的消息与 Trace 将被移除,且不可恢复。`,archiveSession:"归档",unarchiveSession:"取消归档",archivedGroup:e=>`已归档(${e})`,skillsBanner:e=>`使用技能:${e.join("、")}`},files:{title:"文件",upload:"上传",download:"下载",refresh:"刷新",root:"根目录",empty:"空目录",name:"名称",size:"大小",modified:"修改时间",previewUnsupported:"该类型不支持预览,请下载查看",uploaded:"已上传",loadFailed:"加载失败",previewTruncated:"内容过大,预览已截断,请下载查看完整文件",details:"详情",workspacePath:"Workspace 路径",htmlRendered:"渲染视图",htmlSource:"源码",backToList:"返回列表",resizeHandle:"拖拽调整宽度,双击恢复默认"},usage:{title:"成本与统计",today:"今日",last7d:"近 7 天",total:"累计",tokens:"Token",cost:"成本",requests:"Requests",from:"起始日期",to:"结束日期",colCacheRead:"cache_read",colCacheWrite:"cache_write",colOutput:"output",colCost:"成本",trendTitle:"近 30 天趋势",uncostedNote:"* 含未配置 pricing 的记录,成本为不完全统计",filterAllAgents:"全部 Agent",filterAllModels:"全部模型",chartAgentCalls:"各 Agent 调用次数",chartSuccessRate:"各模型成功率",chartTokenTrend:"Token 逐日变化",chartCostTrend:"成本逐日变化",empty:"暂无用量记录",successAborted:"已中断(不计入)",errors:"异常",errorsTotal:"总数",errorsUnexpected:"未预期",errorsExpected:"预期内",errorsTopCode:"最常见",errorsColTime:"时间",errorsColCode:"来源 · 错误码",errorsColKind:"类型",errorsColMessage:"消息",errorsEmpty:"暂无异常"},traces:{title:"轨迹观测",filterAll:"全部",filterModel:"model_msg",filterEvent:"event_msg",analysis:"轨迹观测",timeline:"执行时间线",laneLLM:"模型",laneTools:"工具",phaseApproval:"审批",phaseExec:"执行",kindThinking:"思考",kindModelReply:"模型回复",kindToolGen:"工具调用生成",legendToolExec:"工具调用执行",legendApprovalWait:"审批等待",task:e=>`第 ${e} 轮`,globalSummary:"全局统计",tasksLabel:"轮次",messages:"消息",truncatedNote:(e,a)=>`仅展示前 ${e} / ${a} 条消息`,zoom:"缩放",zoomReset:"双击复位缩放",zoomOut:"缩小",zoomIn:"放大",linkHint:"鼠标移到时间线段或消息行即可联动高亮,点击时间线段跳转到对应消息;图例可高亮同类;拖动下方滑块平移/缩放",filesTitle:"Trace 文件",selectSession:"在左侧选择一个 Session",toolCalls:"工具调用",taskInput:"本轮输入 tokens",taskOutput:"本轮输出 tokens",cacheHit:"命中缓存",hitRate:"命中率",toolFailRate:"失败率",compactions:"压缩次数",compactionRound:"压缩",usageTrend:"Token 用量趋势",selectFile:"在左侧选择一个 Trace 文件",empty:"该 Agent 暂无 Trace",colTime:"时间",colType:"类型",colSummary:"摘要",lines:e=>`${e} 行`,inProgress:"进行中",systemPrompt:"系统提示词",toolDefs:e=>`工具定义(${e})`},benchmark:{title:"评估中心",selectBenchmark:"在左侧选择一个 Benchmark",emptyAgent:"该 Agent 暂无 Benchmark",caseCount:e=>`${e} 题`,trendTitle:e=>`${e}随时间变化`,evaluations:"评估明细",noEvaluations:"暂无评估记录",summaryLabel:"评估说明",legendUnlabeled:"未标注模型",colTime:"时间",colVersion:"版本",colModel:"模型",colScore:"总分",colCost:"成本",colDuration:"耗时",colCase:"题目",colRun:"运行",colSession:"Session"},errors:{unauthorized:"登录已过期,请重新登录",networkError:"网络错误,请检查连接",modelCredentialMissing:e=>`模型 ${e} 还没有可用的 API key,请先在「模型」页为它配置`,noDefaultModel:"该 Project 还没有默认模型,请先在「模型」页添加模型并设为默认"}};let v=u1;function ew(e){v=e}const tw={appName:"PenguinHarness",nav:{chat:"Chat",newChat:"New chat",agents:"Agents",skills:"Skills",models:"Models",usage:"Costs",traces:"Trajectory",benchmark:"Evaluation Center",collapseSidebar:"Collapse sidebar",expandSidebar:"Expand sidebar",collapseGroup:"Collapse",expandGroup:"Expand"},settings:{language:"Language",theme:"Theme",themeLight:"Light",themeDark:"Dark",followSystem:"System",langZh:"中文",langEn:"English",fontSize:"Font size",fontSmall:"S",fontMedium:"M",fontLarge:"L",accent:"Accent",accentNames:{neutral:"Neutral",blue:"Blue",green:"Green",violet:"Violet",rose:"Rose",amber:"Amber"}},common:{save:"Save",cancel:"Cancel",create:"Create",delete:"Delete",edit:"Edit",settings:"Settings",confirm:"Confirm",close:"Close",loading:"Loading…",loadMore:"Load more",saved:"Saved",saving:"Saving…",none:"(none)",retry:"Retry",unknownError:"Request failed, please try again later",requiredField:"This field is required",copied:"Copied",ownerOnly:"Only the owner can modify this"},auth:{loginTitle:"Sign in to PenguinHarness",username:"Username",usernameHint:"2–32 chars: starts with a lowercase letter; lowercase letters, digits and underscores only",password:"Password",passwordHint:"At least 8 characters",showPassword:"Show password",hidePassword:"Hide password",login:"Sign in",logout:"Sign out",admin:"Admin",defaultAdminNote:"First run: sign in as the built-in admin (admin / admin123), then change the password soon"},account:{changePassword:"Change password",oldPassword:"Current password",newPassword:"New password",confirmPassword:"Confirm new password",passwordMismatch:"New passwords do not match",initialPasswordBanner:"This account is using its initial password. Please change it soon.",changeNow:"Change now"},admin:{users:"Users",userId:"Username",role:"Role",roleAdmin:"Admin",roleUser:"User",createdAt:"Created",actions:"Actions",createUser:"Add user",initialPassword:"Initial password",initialPasswordFlag:"initial password",defaultProjectNote:e=>`A default Project will be created: ${e}`,resetPassword:"Reset password",resetPasswordTitle:e=>`Reset password for ${e}`,resetPasswordNote:"All sign-in sessions of this user will be revoked; they must sign in with the new password",deleteUser:"Delete",deleteUserTitle:e=>`Delete user ${e}`,deleteUserConfirm:e=>`This deletes user ${e} and every Project they own (including data directories). This cannot be undone.`},project:{switcher:"Project",create:"New Project",createTitle:"New Project",id:"Project id",idHint:"2–64 chars: starts with a lowercase letter; lowercase letters, digits and underscores only. Cannot be changed later.",idPrefixHint:"The id is prefixed with your username and a hyphen; append lowercase letters, digits or underscores. Cannot be changed later.",name:"Display name (optional, defaults to the Project id)",settings:"Project settings",settingsTitle:"Project settings",members:"Members",addMember:"Add member",memberUsername:"Username",memberRole:"Role",memberActions:"Actions",removeMember:"Remove",owner:"owner",member:"member",deleteProject:"Delete Project",deleteConfirm:"Delete this Project? Its directory will be removed recursively and cannot be recovered.",deleteLastForbidden:"This is the last Project on this account; create another Project before deleting it",deleteDefaultForbidden:"default_project is shared with the CLI and cannot be deleted from the web",noCredentialTitle:"No model credential configured",noCredentialBody:"The default model of this Project has no API key yet. Configure it on the Models page before chatting.",goToModels:"Go to Models",later:"Later"},agent:{listTitle:"Agents",create:"Create Agent",createTitle:"Create Agent",id:"Agent id",idHint:"2–64 chars: starts with a lowercase letter; lowercase letters, digits and underscores only. Cannot be changed later.",name:"Name",nameHint:"Leave empty to use the Agent id as the name",description:"Description",activeSessions:"Active Sessions",sessionCount:e=>`${e} session${e===1?"":"s"}`,toolCount:e=>`${e} tool${e===1?"":"s"}`,vaultKeyCount:e=>`${e} vault key${e===1?"":"s"}`,scheduleCount:e=>`${e} scheduled task${e===1?"":"s"}`,updatedAt:"Last modified",activity:e=>`${e}-day session activity`,settings:"Agent settings",backToList:"Back to Agents",tabOverview:"Overview",tabPrompt:"Prompt",tabRuntime:"Runtime",tabTools:"Tools",tabVault:"Vault",tabSchedules:"Schedules",stateDir:"State path",agentsMd:"AGENTS.md",systemPrompt:"system_prompt template",placeholdersTitle:"Available placeholders (click to insert)",insertPlaceholder:"Insert at the system_prompt cursor",placeholders:[["{{AGENTS_MD}}","Injects the AGENTS.md content"],["{{VAULT_KEYS}}","Injects the vault key-name section (empty when no keys)"],["{{PLATFORM}}","Runtime platform"],["{{OS_VERSION}}","Operating system version"],["{{DATE}}","Current date"],["{{CWD}}","Absolute Workspace path"],["{{AGENT_ID}}","Current Agent id"],["{{PROJECT_DIR}}","Absolute Project directory (Agent State/scratchpad derive from it)"],["{{SESSION_ID}}","Current Session id"]],maxTurns:"max_turns (max turns per Task, -1 = unlimited)",maxTokens:"model.max_tokens",thinkingLevel:"model.thinking_level",thinkingLevelOptions:[["","Send no override — keep whatever is currently configured."],["none","Disables extended reasoning; the fastest responses."],["low","Enables a lower tier of extended reasoning."],["medium","Enables a medium tier of extended reasoning (the default tier for a newly created agent)."],["high","Enables a higher tier of extended reasoning; slower responses."],["xhigh","Enables the highest tier of extended reasoning; identical to high on some models."]],timeoutMs:"model.timeoutMs",timeoutMsHint:"Per-request timeout, ms",compaction:"Context compaction",maxContextLength:"max_context_length",maxContextLengthHint:"Context threshold that triggers compaction",maxSessionTurns:"max_session_turns",maxSessionTurnsHint:"Turn threshold that triggers compaction",compactionMode:"mode (compaction strategy)",compactionModeOptions:[["","Send no override — keep whatever is currently configured."],["summarize","Summarizes the old context with the model, then continues from that summary in a fresh window (default)."],["discard","Drops the old context without summarizing; the next turn starts fresh in a new window."]],compactionPrompt:"prompt (summarization prompt)",maxTurnsInvalid:"max_turns must be > 0 or -1",timeoutInvalid:"timeoutMs must be > 0 or -1",toolFieldInvalid:(e,a)=>`${e}: ${a} must be a positive integer or -1`,builtinTools:"Built-in tools",toolName:"Name",toolPermission:"permission",permissionReadLabel:"Read-only",permissionReadDescription:"Only reads. Auto-approved when the approval mode is read-only.",permissionReadWriteLabel:"Read & write",permissionReadWriteDescription:"Can modify things. Needs manual confirmation when the approval mode is read-only.",toolTimeout:"timeoutMs",toolMaxOutput:"maxOutputLength",mcpServers:"MCP Servers (read-only)",defaultValue:"(default)",deleteAgent:"Delete Agent",builtinUndeletable:"Built-in Agents cannot be deleted",deleteConfirm:e=>`Delete Agent "${e}"? Its directory (including all Traces) will be removed recursively and cannot be recovered.`,stateVersion:"Agent State version",transferTitle:"Export / import",transferDesc:"Export the current Agent State snapshot (tar.gz); importing overwrites the whole directory and adopts the version inside the package.",exportSnapshot:"Export snapshot",importSnapshot:"Import snapshot",importing:"Importing…",importDone:e=>`Import finished, Agent State version v${e}`,importConflictTitle:"Version conflict",importConflictBody:"The snapshot's version is not newer than the current one; importing will overwrite the existing Agent State. Continue?"},models:{title:"Models",addCustom:"Add custom model",addToGroup:"Add model",editTitle:"Model settings",addTitle:"Add model (OpenAI protocol)",addTitleVendor:"Add model (auto-routed by id)",addProtocolHint:"New models always use the OpenAI Chat Completions protocol (no auto-routing by model id); set the base URL to a compatible endpoint",addAutoRouteHint:"New models in this group are auto-routed by their upstream id to the vendor's official client: leave the base URL empty for the official endpoint, and an empty API key falls back to the resolved client's environment variable",autoRouteNone:"AgentHub cannot auto-route this id: double-check it, or add the model under Custom / a user-defined group with the OpenAI protocol",addGroup:"Add group",addGroupTitle:"Add group",addGroupDesc:"User-defined groups share Custom semantics: models use the OpenAI Chat Completions protocol (base URL required; an empty API key reads OPENAI_API_KEY). Groups live on model entries — the group appears once its first model is saved.",groupNameLabel:"Group name",groupNameHint:"Starts with a lowercase letter / digit; may contain - and _",groupNameInvalid:"Group names may only use lowercase letters, digits, - and _ (starting with a letter or digit), up to 32 characters",groupNameExists:"This name is taken by a built-in group or an existing entry",groupEmptyHint:"No models in this group yet; use “Add model” to create one",searchPlaceholder:"Search models: id / name / provider",noSearchResults:"No matching models",modelCount:e=>`${e} model${e===1?"":"s"}`,modelId:"Model ID",modelIdHint:"The upstream API model id, e.g. gpt-5.5",displayName:"Display name",displayNameHint:"Defaults to the model ID",providerGroup:"Group",contextWindow:"Context window",contextWindowUnit:"tokens",contextWindowHint:"Leave empty if unknown",clientTypeLocked:e=>`Protocol: ${e} (kept as configured; not editable)`,vision:"Supports image input (vision / multimodal)",visionHint:"When unchecked, chat images are passed as file paths and read via describe_image (vision model)",visionBadge:"Vision",visionModelBadge:"Proxy vision",setVisionModel:"Set as proxy vision model",visionModelHint:"Describes images via describe_image for models without vision",priceUnitShort:"/M tok",testConnection:"Test connection",testing:"Testing…",testOk:e=>`Connected (${e} ms)`,testFailed:e=>`Failed: ${e}`,modelIdRenameHint:"Renaming migrates the existing config and API key",priceCacheRead:"Cache read",priceCacheWrite:"Cache write",priceOutput:"Output",pricing:"Pricing",priceUnit:"per 1M tokens",currency:"Currency",currencyUsd:"USD $",currencyCny:"CNY ¥",currencyHint:"Prices convert at 1 USD ≈ 7 CNY; always stored in USD",firstModelDefault:"Set as the default model",credential:"Credential",apiKey:"API key",apiKeyKeepHint:"Leave empty to keep the current key",apiKeyEnvHint:e=>`Leave empty to use the ${e} env var`,useEnvVar:e=>`env ${e}`,keyConfigured:"Key configured",clearApiKey:"Clear stored API key",baseUrl:"Custom base URL",baseUrlHint:"Leave empty to use the provider default",baseUrlRequired:"A base URL is required",contextWindowDefaultHint:e=>`Defaults to ${e} if empty`,visionOnHint:"Images are read with read_image and fed to the model directly",visionOffHint:"Images are read with describe_image: described by the proxy vision model, text only; chat uploads are passed as file paths",confirmDeleteTitle:"Delete model",confirmDelete:e=>`Delete "${e}"? Its configuration and API key will be removed.`,groupApiKey:"Set API key for group",groupApiKeyTitle:e=>`Set the API key for ${e}`,groupApiKeyHint:e=>`Applies to all ${e} models in this group; leave empty to keep them unchanged.`,getApiKey:"Get API key",getModelIds:"Get model IDs",groupKeyApplied:e=>`API key set for ${e} models`,providerEnvNotes:{zhipu:"Defaults to the Z.AI global endpoint (api.z.ai); keys from bigmodel.cn need base URL https://open.bigmodel.cn/api/paas/v4",moonshot:"Defaults to the China endpoint (api.moonshot.cn); keys from platform.kimi.com need base URL https://api.moonshot.ai/v1"},confirmVisionModelTitle:"Set as proxy vision model",confirmVisionModel:e=>`Make "${e}" the proxy vision model? Models without vision will read images through it via describe_image.`,confirmSaveTitle:"Save model settings",confirmSave:e=>`Save the changes to "${e}"?`,confirmDefaultTitle:"Set as default model",confirmDefault:e=>`Make "${e}" the default model? New sessions will use it by default.`,createdAt:"Created",default:"Default",setDefault:"Set as default model",remove:"Delete model",saveAll:"Save all",readOnlyHint:"Members have read-only access; only owners can change models and credentials",empty:"No models configured yet",noKey:"No key",pendingSave:"(pending save)",modelIdExists:"This model id already exists",pricingAllOrNone:"Fill all three prices",pricingInvalid:"Must be a number",contextWindowInvalid:"Must be a number"},vault:{desc:"Environment variables owned by this Agent (stored in agent_state/.vault.toml), injected into the environment of its shell commands (exec_command); key names are shared with the model, values never enter the model context. Subagents use their own vaults and do not inherit this one.",key:"Name",value:"Value",valueMasked:"Value (masked)",add:"Add",addTitle:"Add variable",remove:"Remove",deleteTitle:"Delete variable",deleteConfirm:e=>`Delete variable "${e}"? Its value cannot be recovered.`,empty:"No variables configured yet",readOnlyHint:"Members are read-only; only the owner can edit the vault",keyHint:"Letters, digits and underscores; must not start with a digit",keyInvalid:"Invalid name: only letters, digits and underscores, not starting with a digit",valueRequired:"Value must not be empty"},schedule:{desc:"Scheduled tasks (agent_state/schedule/*.toml): the prompt is sent to the target Session on schedule; files can also be edited by hand, and changes made here take effect immediately.",readOnlyHint:"Members are read-only; only the owner can modify schedules",colName:"Name",colStatus:"Status",colPeriod:"Period",colTarget:"Target",colFireTimes:"Next / last fired",colQueued:"Queue",statusNames:{active:"Active",disabled:"Disabled",expired:"Expired",done:"Done",missed:"Missed",invalid:"Invalid"},queued:"Queued",once:"One-off",newSession:"New session",invalidFiles:"Files that failed to parse (skipped by the scheduler)",empty:"No scheduled tasks yet",enable:"Enable",disable:"Disable",addTitle:"New scheduled task",editTitle:e=>`Edit scheduled task "${e}"`,name:"Name",nameHint:"The file name (without .toml); cannot be changed later",prompt:"Prompt",enabled:"Enabled",startAt:"Start at",endAt:"End at (optional)",period:"Period",periodPlaceholder:"30m / 12h / 7d; leave empty for a one-off task",target:"Target",targetNew:"New session each time",targetSession:"Bound Session",sessionId:"Session id",workspace:"Workspace (optional, auto-created when empty)",model:"Model",modelDefault:"Project default",deleteTitle:"Delete scheduled task",deleteConfirm:e=>`Delete scheduled task "${e}"?`},skills:{pageTitle:"Skill library",pageDesc:"Built-in skill library: browse, quick-start a chat, or install to agents.",quickInvoke:"Quick start",quickInvokeText:e=>`use the ${e} skill`,manageInstall:"Manage installs",manageInstallTitle:e=>`Manage installs: ${e}`,install:"Install",installed:"Installed",uninstall:"Uninstall",skillCount:e=>e===1?"1 skill":`${e} skills`,usedByAgents:e=>e===0?"not used yet":e===1?"used by 1 agent":`used by ${e} agents`,installedToast:(e,a)=>`Installed ${e} to ${a}`,uninstalledToast:(e,a)=>`Uninstalled ${e} from ${a}`},chat:{newSessionMenu:"New chat",chooseAgent:"Choose agent",chooseModel:"Choose model",workspaceUseThis:"Use this dir",workspaceUp:"Parent dir",workspaceNoSubdirs:"No subdirectories",workspaceAuto:"Auto temp directory",workspaceClear:"Use auto temp directory instead",workspaceDirInvalid:"Directory does not exist or is inaccessible; reverted",draftSubtitle:"The self-evolving agent that excels at AI development tasks",sessionList:"Sessions",defaultSessionTitle:"New chat",model:"Model",workspace:"Workspace",workspaceHint:"Leave empty for an auto-created temp directory; if set, it must be an existing directory on the server",approvalMode:"Approval mode",approvalModeNames:{"allow-all":"Approve everything","deny-all":"Deny everything","read-only":"Approve read-only","always-ask":"Ask every time"},approvalModes:{"allow-all":"Approve everything (allow-all)","deny-all":"Deny everything (deny-all)","read-only":"Approve read-only (read-only)","always-ask":"Ask every time (always-ask)"},statusIdle:"Idle",statusRunning:"Running",statusCompacting:"Compacting",pendingApprovals:e=>`${e} pending approval${e>1?"s":""}`,inputPlaceholder:"Type a message. Enter to send, Shift+Enter for newline, paste images",inputPlaceholderShort:"Type a message…",send:"Send",stop:"Stop",compactingHint:"Compacting context, input is temporarily disabled",compact:"Compact context",approve:"Allow",deny:"Deny",decisionAllow:"Approved",decisionDeny:"Denied",decisionManual:"manual",decisionAuto:"auto",thinking:"Thinking",subagent:"Subagent",subagentRunning:"Running",aborted:e=>`[Aborted]${e?`: ${e}`:""}`,reconnect:(e,a,r)=>{const i=e==="timeout"?"Connection timed out":"Response incomplete or unparseable",o=a==="gaveUp"?"no further retries":a==="retried"?`retry #${r} sent`:`starting retry #${r}…`;return`[Retry] ${i}; ${o}`},imageAlt:"Image uploaded by user",toolImageAlt:"Image from tool output",imagesAsPathHint:"This model cannot view images directly: on send, images are saved to the session scratchpad and passed as file paths (viewed via describe_image)",infoPanel:"Session info",sessionStats:"Stats",statTokens:"Total Tokens",statCost:"Cost",statElapsed:"Elapsed",statInput:"Input tokens",statOutput:"Output tokens",statTps:"Output TPS",noSessions:"No Sessions yet",emptyStream:"Send a message to start the conversation",historyLoadFailed:"Failed to load history",sessionHealed:"Session healed with a new id",statsLabel:"Stats",removeImage:"Remove image",openWorkspace:"Open workspace",filesInMessage:e=>`${e} ${e===1?"file":"files"}`,openPreview:"Click to preview",showMoreFiles:e=>`Show ${e} more ${e===1?"file":"files"}`,showLess:"Show less",contextUsage:"Context usage",contextUnknown:"Context usage: unknown until the next request reports it",slashHint:"Type / for commands",mentionHint:"@ to handoff to another agent",mentionRemove:"Remove @ target",skillsSelect:"Skills",skillsSearchPlaceholder:"Search skills",skillsNoMatch:"No matching skills",skillsEmptyHint:"No skills installed yet — add some from the skill library",skillsAutoMessage:e=>e.length===1?`use the ${e[0]} skill`:`use the ${e.join(", ")} skills`,handoffFrom:e=>`Handed off from ${e}'s conversation`,handoffBack:e=>e?`Back to the original conversation: ${e}`:"Back to the original conversation",scheduledFrom:e=>`Triggered by scheduled task "${e}"`,sourceNames:{schedule:"Scheduled",subagent:"Sub"},commandCompact:"/compact",emptyGreeting:"Start a new conversation",compactionRunning:e=>`Compaction in progress (${e})…`,compactionDone:e=>e==="discard"?"[Compaction] done, old context discarded":"[Compaction] done, switched to the summarized context",compactionFailed:e=>`[Compaction] ${e==="aborted"?"aborted":"failed"}, keeping current context`,unknownTool:"(unknown tool)",toolCall:"Tool call",workGroupTitle:"Reasoning & tools",workRunning:"Running",workDone:"Done",workGroupSteps:e=>`${e} ${e===1?"step":"steps"}`,approvalWaiting:"awaiting approval",copyCode:"Copy code",copyStats:"Copy stats",copyReply:"Copy reply",copyMessage:"Copy message",copied:"Copied",deleteSession:"Delete chat",renameSession:"Rename chat",renameSessionLabel:"Title",deleteSessionConfirm:e=>`Delete "${e}"? Its messages and Trace will be removed permanently.`,archiveSession:"Archive",unarchiveSession:"Unarchive",archivedGroup:e=>`Archived (${e})`,skillsBanner:e=>`Using skill${e.length===1?"":"s"}: ${e.join(", ")}`},files:{title:"Files",upload:"Upload",download:"Download",refresh:"Refresh",root:"Workspace root",empty:"Empty directory",name:"Name",size:"Size",modified:"Modified",previewUnsupported:"Preview not supported for this type; download instead",uploaded:"Uploaded",loadFailed:"Failed to load",previewTruncated:"File too large; preview truncated, download for the full file",details:"Details",workspacePath:"Workspace path",htmlRendered:"Rendered",htmlSource:"Source",backToList:"Back to list",resizeHandle:"Drag to resize, double-click to reset"},usage:{title:"Costs & usage",today:"Today",last7d:"Last 7 days",total:"Total",tokens:"Tokens",cost:"Cost",requests:"Requests",from:"From",to:"To",colCacheRead:"cache_read",colCacheWrite:"cache_write",colOutput:"output",colCost:"Cost",trendTitle:"30-day trend",uncostedNote:"* Includes records without pricing; cost is a partial figure",filterAllAgents:"All Agents",filterAllModels:"All models",chartAgentCalls:"Calls per Agent",chartSuccessRate:"Model success rate",chartTokenTrend:"Daily token trend",chartCostTrend:"Daily cost trend",empty:"No usage records",successAborted:"Aborted (excluded)",errors:"Errors",errorsTotal:"Total",errorsUnexpected:"Unexpected",errorsExpected:"Expected",errorsTopCode:"Most common",errorsColTime:"Time",errorsColCode:"Source · code",errorsColKind:"Type",errorsColMessage:"Message",errorsEmpty:"No errors"},traces:{title:"Traces",filterAll:"All",filterModel:"model_msg",filterEvent:"event_msg",analysis:"Trajectory view",timeline:"Execution timeline",laneLLM:"Model",laneTools:"Tools",phaseApproval:"approval",phaseExec:"exec",kindThinking:"thinking",kindModelReply:"model reply",kindToolGen:"tool call gen",legendToolExec:"tool exec",legendApprovalWait:"approval wait",task:e=>`Turn ${e}`,globalSummary:"Overall",tasksLabel:"Turns",messages:"Messages",truncatedNote:(e,a)=>`Showing first ${e} / ${a} messages`,zoom:"Zoom",zoomReset:"Double-click to reset zoom",zoomOut:"Zoom out",zoomIn:"Zoom in",linkHint:"Hover a timeline segment or event row to cross-highlight, click a segment to jump to its message; legend highlights its kind; drag the bar below to pan/zoom",filesTitle:"Trace files",selectSession:"Select a Session on the left",toolCalls:"Tool calls",taskInput:"Input tokens this turn",taskOutput:"Output tokens this turn",cacheHit:"Cache hits",hitRate:"Hit rate",toolFailRate:"failure rate",compactions:"compactions",compactionRound:"Compaction",usageTrend:"Token usage trend",selectFile:"Select a Trace file on the left",empty:"No Traces for this Agent",colTime:"Time",colType:"Type",colSummary:"Summary",lines:e=>`${e} lines`,inProgress:"in progress",systemPrompt:"System prompt",toolDefs:e=>`Tool definitions (${e})`},benchmark:{title:"Evaluation Center",selectBenchmark:"Select a Benchmark on the left",emptyAgent:"No Benchmarks for this Agent",caseCount:e=>`${e} case${e===1?"":"s"}`,trendTitle:e=>`${e} over time`,evaluations:"Evaluations",noEvaluations:"No evaluations yet",summaryLabel:"Summary",legendUnlabeled:"unlabeled model",colTime:"Time",colVersion:"Version",colModel:"Model",colScore:"Score",colCost:"Cost",colDuration:"Duration",colCase:"Case",colRun:"Run",colSession:"Session"},errors:{unauthorized:"Session expired, please sign in again",networkError:"Network error, please check your connection",modelCredentialMissing:e=>`Model ${e} has no API key yet — configure it on the Models page first`,noDefaultModel:"This project has no default model yet — add one on the Models page first"}},c1="penguin.lang",d1=k.createContext(null);function nw(e){return e?.toLowerCase().startsWith("zh")?"zh":"en"}function aw(){return nw(navigator.language)}function rw(e){return e==="system"?aw():e}function lw(){const e=localStorage.getItem(c1);return e==="zh"||e==="en"||e==="system"?e:"system"}function iw({children:e}){const[a,r]=k.useState(lw),[,i]=k.useState(0),o=rw(a);ew(o==="en"?tw:u1),k.useEffect(()=>{if(a!=="system")return;const d=()=>i(f=>f+1);return window.addEventListener("languagechange",d),()=>window.removeEventListener("languagechange",d)},[a]);const c=k.useCallback(d=>{localStorage.setItem(c1,d),r(d)},[]);return s.jsx(d1.Provider,{value:{lang:a,locale:o,setLang:c},children:e})}function sw({children:e}){const{locale:a}=ia();return s.jsx("div",{className:"contents",children:e},a)}function ia(){const e=k.useContext(d1);if(!e)throw new Error("useLocale 必须在 LocaleProvider 内使用");return e}const xm=7,f1="penguin.theme",m1="penguin.fontScale",h1="penguin.accent",p1="penguin.currency",ow={sm:"16px",md:"18px",lg:"20px"},g1=k.createContext(null);function uw(){const e=localStorage.getItem(f1);return e==="light"||e==="dark"||e==="system"?e:"system"}function cw(){const e=localStorage.getItem(m1);return e==="sm"||e==="md"||e==="lg"?e:"md"}function dw(){const e=localStorage.getItem(h1);return e==="neutral"||e==="blue"||e==="green"||e==="violet"||e==="rose"||e==="amber"?e:"neutral"}function fw(){return localStorage.getItem(p1)==="CNY"?"CNY":"USD"}function mw(){return window.matchMedia("(prefers-color-scheme: dark)").matches}function hw({children:e}){const[a,r]=k.useState(uw),[i,o]=k.useState(mw),[c,d]=k.useState(cw),[f,h]=k.useState(dw),[m,g]=k.useState(fw),y=a==="system"?i:a==="dark";k.useEffect(()=>{document.documentElement.classList.toggle("dark",y)},[y]),k.useEffect(()=>{document.documentElement.style.fontSize=ow[c]},[c]),k.useEffect(()=>{f==="neutral"?delete document.documentElement.dataset.accent:document.documentElement.dataset.accent=f},[f]),k.useEffect(()=>{if(a!=="system")return;const j=window.matchMedia("(prefers-color-scheme: dark)"),T=I=>o(I.matches);return o(j.matches),j.addEventListener("change",T),()=>j.removeEventListener("change",T)},[a]);const b=k.useCallback(j=>{localStorage.setItem(f1,j),r(j)},[]),w=k.useCallback(j=>{localStorage.setItem(m1,j),d(j)},[]),N=k.useCallback(j=>{localStorage.setItem(h1,j),h(j)},[]),A=k.useCallback(j=>{localStorage.setItem(p1,j),g(j)},[]);return s.jsx(g1.Provider,{value:{mode:a,dark:y,setMode:b,fontScale:c,setFontScale:w,accent:f,setAccent:N,currency:m,setCurrency:A},children:e})}function Gr(){const e=k.useContext(g1);if(!e)throw new Error("useTheme 必须在 ThemeProvider 内使用");return e}const pw=[{value:"neutral",color:"#6b7280"},{value:"blue",color:"#2563eb"},{value:"green",color:"#15803d"},{value:"violet",color:"#7c3aed"},{value:"rose",color:"#be123c"},{value:"amber",color:"#b45309"}];class Ie extends Error{status;code;constructor(a,r,i){super(i),this.name="ApiError",this.status=a,this.code=r}}let x1=null;function xx(e){x1=e}function gw(e){return e.startsWith("/api/auth/")}async function Ce(e,a={}){let r=e;if(a.query){const c=new URLSearchParams;for(const[f,h]of Object.entries(a.query))h!==void 0&&c.set(f,String(h));const d=c.toString();d&&(r+=`?${d}`)}let i;try{i=await fetch(r,{method:a.method??"GET",credentials:"same-origin",...a.body!==void 0?{headers:{"Content-Type":"application/json"},body:JSON.stringify(a.body)}:{}})}catch{throw new Ie(0,"network_error",v.errors.networkError)}if(!i.ok){let c="http_error",d=v.common.unknownError;try{const f=await i.json();f.error?.code&&(c=f.error.code),f.error?.message&&(d=f.error.message)}catch{}throw i.status===401&&!gw(e)&&x1?.(),new Ie(i.status,c,d)}if(i.status===204)return;const o=await i.text();if(o)return JSON.parse(o)}const xw=e=>Ce("/api/auth/login",{method:"POST",body:e}),yw=()=>Ce("/api/auth/logout",{method:"POST",body:{}}),Df=()=>Ce("/api/me"),vw=e=>Ce("/api/me/password",{method:"PUT",body:e}),bw=()=>Ce("/api/me/prefs"),y1=e=>Ce("/api/me/prefs",{method:"PUT",body:e}),kw=()=>Ce("/api/admin/users"),ww=e=>Ce("/api/admin/users",{method:"POST",body:e}),Sw=(e,a)=>Ce(`/api/admin/users/${encodeURIComponent(e)}/password`,{method:"POST",body:a}),jw=e=>Ce(`/api/admin/users/${encodeURIComponent(e)}`,{method:"DELETE"}),Nw=()=>Ce("/api/projects"),Cw=e=>Ce("/api/projects",{method:"POST",body:e}),Ew=e=>Ce(`/api/projects/${encodeURIComponent(e)}`,{method:"DELETE"}),ef=e=>Ce(`/api/projects/${encodeURIComponent(e)}/members`),Tw=(e,a)=>Ce(`/api/projects/${encodeURIComponent(e)}/members`,{method:"POST",body:a}),Mw=(e,a)=>Ce(`/api/projects/${encodeURIComponent(e)}/members/${encodeURIComponent(a)}`,{method:"DELETE"}),ku=e=>Ce(`/api/projects/${encodeURIComponent(e)}/models`),Aw=(e,a)=>Ce(`/api/projects/${encodeURIComponent(e)}/models`,{method:"PUT",body:a}),Rw=(e,a)=>Ce(`/api/projects/${encodeURIComponent(e)}/models/test`,{method:"POST",body:a}),_w=(e,a)=>Ce(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(a)}/vault`),zw=(e,a,r)=>Ce(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(a)}/vault`,{method:"PUT",body:r}),Dw=e=>Ce(`/api/projects/${encodeURIComponent(e)}/agents`),Lw=(e,a)=>Ce(`/api/projects/${encodeURIComponent(e)}/agents`,{method:"POST",body:a}),Ow=(e,a)=>Ce(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(a)}/config`),Iw=(e,a,r)=>Ce(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(a)}/config`,{method:"PUT",body:r}),Uw=(e,a)=>Ce(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(a)}/traces`),$w=(e,a)=>Ce(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(a)}/sessions`),yx=(e,a="")=>Ce(`/api/projects/${encodeURIComponent(e)}/dirs?path=${encodeURIComponent(a)}`),Lf=(e,a,r)=>Ce(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(a)}/sessions`,{method:"POST",body:r}),Of=(e,a)=>Ce(`/api/sessions/${encodeURIComponent(e)}`,{method:"PATCH",body:a}),lu=e=>Ce(`/api/sessions/${encodeURIComponent(e)}`,{method:"DELETE"}),Bw=e=>Ce(`/api/sessions/${encodeURIComponent(e)}/messages`),iu=(e,a)=>Ce(`/api/sessions/${encodeURIComponent(e)}/tasks`,{method:"POST",body:a}),Hw=(e,a,r)=>Ce(`/api/sessions/${encodeURIComponent(e)}/approvals/${encodeURIComponent(a)}`,{method:"POST",body:r}),Pw=e=>Ce(`/api/sessions/${encodeURIComponent(e)}/abort`,{method:"POST",body:{}}),qw=e=>Ce(`/api/sessions/${encodeURIComponent(e)}/compact`,{method:"POST",body:{}}),Fw=(e,a,r,i,o,c)=>Ce(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(a)}/traces/${encodeURIComponent(r)}/${i}`,{query:{offset:o,limit:c}}),Vw=(e,a,r,i)=>Ce(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(a)}/traces/${encodeURIComponent(r)}/${i}/analysis`),v1=(e,a)=>Ce(`/api/projects/${encodeURIComponent(e)}/usage`,{query:{from:a.from,to:a.to,groupBy:a.groupBy,agentId:a.agentId,provider:a.provider,modelId:a.modelId}}),Yw=(e,a)=>Ce(`/api/projects/${e}/agents/${a}`,{method:"DELETE"}),Gw=(e,a)=>Ce(`/api/sessions/${e}/files`,{query:{path:a}}),zr=(e,a,r=!1)=>`/api/sessions/${e}/files/content?path=${encodeURIComponent(a)}${r?"&download=1":""}`,Kw=(e,a,r)=>Ce(`/api/sessions/${e}/files/content`,{method:"PUT",body:{dataBase64:r},query:{path:a}}),Ww=(e,a)=>Ce(`/api/sessions/${e}/files/stat`,{method:"POST",body:{paths:a}}),Xw=(e,a)=>Ce(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(a)}/schedules`),Qw=(e,a,r)=>Ce(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(a)}/schedules`,{method:"POST",body:r}),vx=(e,a,r,i)=>Ce(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(a)}/schedules/${encodeURIComponent(r)}`,{method:"PUT",body:i}),Zw=(e,a,r)=>Ce(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(a)}/schedules/${encodeURIComponent(r)}`,{method:"DELETE"}),Jw=()=>Ce("/api/skills"),ym=(e,a)=>Ce(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(a)}/skills`),eS=(e,a,r)=>Ce(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(a)}/skills`,{method:"POST",body:{names:r}}),tS=(e,a,r)=>Ce(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(a)}/skills/${encodeURIComponent(r)}`,{method:"DELETE"}),nS=(e,a)=>Ce(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(a)}/benchmarks`),aS=(e,a)=>`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(a)}/export`,rS=(e,a,r)=>Ce(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(a)}/import`,{method:"POST",body:r}),b1=k.createContext(null);function lS({children:e}){const[a,r]=k.useState(void 0);k.useEffect(()=>(xx(()=>r(null)),()=>xx(null)),[]),k.useEffect(()=>{let d=!1;return Df().then(f=>{d||r(f.user)}).catch(f=>{d||(f instanceof Ie&&f.status,r(null))}),()=>{d=!0}},[]);const i=k.useCallback(async(d,f)=>{const h=await xw({userId:d,password:f});r(h.user)},[]),o=k.useCallback(async()=>{try{await yw()}finally{r(null)}},[]),c=k.useCallback(async()=>{const d=await Df();r(d.user)},[]);return s.jsx(b1.Provider,{value:{user:a,login:i,logout:o,refresh:c},children:e})}function qn(){const e=k.useContext(b1);if(!e)throw new Error("useAuth 必须在 AuthProvider 内使用");return e}var vm=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,k1=/^[\\/]{2}/;function iS(e,a){return a+e.replace(/\\/g,"/")}var bx="popstate";function kx(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function sS(e={}){function a(i,o){let c=o.state?.masked,{pathname:d,search:f,hash:h}=c||i.location;return If("",{pathname:d,search:f,hash:h},o.state&&o.state.usr||null,o.state&&o.state.key||"default",c?{pathname:i.location.pathname,search:i.location.search,hash:i.location.hash}:void 0)}function r(i,o){return typeof o=="string"?o:ls(o)}return uS(a,r,null,e)}function ut(e,a){if(e===!1||e===null||typeof e>"u")throw new Error(a)}function Hn(e,a){if(!e){typeof console<"u"&&console.warn(a);try{throw new Error(a)}catch{}}}function oS(){return Math.random().toString(36).substring(2,10)}function wx(e,a){return{usr:e.state,key:e.key,idx:a,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function If(e,a,r=null,i,o){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof a=="string"?Pl(a):a,state:r,key:a&&a.key||i||oS(),mask:o}}function ls({pathname:e="/",search:a="",hash:r=""}){return a&&a!=="?"&&(e+=a.charAt(0)==="?"?a:"?"+a),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function Pl(e){let a={};if(e){let r=e.indexOf("#");r>=0&&(a.hash=e.substring(r),e=e.substring(0,r));let i=e.indexOf("?");i>=0&&(a.search=e.substring(i),e=e.substring(0,i)),e&&(a.pathname=e)}return a}function uS(e,a,r,i={}){let{window:o=document.defaultView,v5Compat:c=!1}=i,d=o.history,f="POP",h=null,m=g();m==null&&(m=0,d.replaceState({...d.state,idx:m},""));function g(){return(d.state||{idx:null}).idx}function y(){f="POP";let j=g(),T=j==null?null:j-m;m=j,h&&h({action:f,location:A.location,delta:T})}function b(j,T){f="PUSH";let I=kx(j)?j:If(A.location,j,T);m=g()+1;let M=wx(I,m),_=A.createHref(I.mask||I);try{d.pushState(M,"",_)}catch($){if($ instanceof DOMException&&$.name==="DataCloneError")throw $;o.location.assign(_)}c&&h&&h({action:f,location:A.location,delta:1})}function w(j,T){f="REPLACE";let I=kx(j)?j:If(A.location,j,T);m=g();let M=wx(I,m),_=A.createHref(I.mask||I);d.replaceState(M,"",_),c&&h&&h({action:f,location:A.location,delta:0})}function N(j){return cS(o,j)}let A={get action(){return f},get location(){return e(o,d)},listen(j){if(h)throw new Error("A history only accepts one active listener");return o.addEventListener(bx,y),h=j,()=>{o.removeEventListener(bx,y),h=null}},createHref(j){return a(o,j)},createURL:N,encodeLocation(j){let T=N(j);return{pathname:T.pathname,search:T.search,hash:T.hash}},push:b,replace:w,go(j){return d.go(j)}};return A}function cS(e,a,r=!1){let i="http://localhost";e&&(i=e.location.origin!=="null"?e.location.origin:e.location.href),ut(i,"No window.location.(origin|href) available to create URL");let o=typeof a=="string"?a:ls(a);return o=o.replace(/ $/,"%20"),!r&&k1.test(o)&&(o=i+o),new URL(o,i)}function w1(e,a,r="/"){return dS(e,a,r,!1)}function dS(e,a,r,i,o){let c=typeof a=="string"?Pl(a):a,d=_a(c.pathname||"/",r);if(d==null)return null;let f=fS(e),h=null,m=E1(d);for(let g=0;h==null&&g<f.length;++g)h=wS(f[g],m,i);return h}function fS(e){let a=S1(e);return mS(a),a}function S1(e,a=[],r=[],i="",o=!1){let c=(d,f,h=o,m)=>{let g={relativePath:m===void 0?d.path||"":m,caseSensitive:d.caseSensitive===!0,childrenIndex:f,route:d};if(g.relativePath.startsWith("/")){if(!g.relativePath.startsWith(i)&&h)return;ut(g.relativePath.startsWith(i),`Absolute route path "${g.relativePath}" nested under path "${i}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),g.relativePath=g.relativePath.slice(i.length)}let y=Qn([i,g.relativePath]),b=r.concat(g);d.children&&d.children.length>0&&(ut(d.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${y}".`),S1(d.children,a,b,y,h)),!(d.path==null&&!d.index)&&a.push({path:y,score:bS(y,d.index),routesMeta:b.map((w,N)=>{let[A,j]=C1(w.relativePath,w.caseSensitive,N===b.length-1);return{...w,matcher:A,compiledParams:j}})})};return e.forEach((d,f)=>{if(d.path===""||!d.path?.includes("?"))c(d,f);else for(let h of j1(d.path))c(d,f,!0,h)}),a}function j1(e){let a=e.split("/");if(a.length===0)return[];let[r,...i]=a,o=r.endsWith("?"),c=r.replace(/\?$/,"");if(i.length===0)return o?[c,""]:[c];let d=j1(i.join("/")),f=[];return f.push(...d.map(h=>h===""?c:[c,h].join("/"))),o&&f.push(...d),f.map(h=>e.startsWith("/")&&h===""?"/":h)}function mS(e){e.sort((a,r)=>a.score!==r.score?r.score-a.score:kS(a.routesMeta.map(i=>i.childrenIndex),r.routesMeta.map(i=>i.childrenIndex)))}var hS=/^:[\w-]+$/,pS=3,gS=2,xS=1,yS=10,vS=-2,Sx=e=>e==="*";function bS(e,a){let r=e.split("/"),i=r.length;return r.some(Sx)&&(i+=vS),a&&(i+=gS),r.filter(o=>!Sx(o)).reduce((o,c)=>o+(hS.test(c)?pS:c===""?xS:yS),i)}function kS(e,a){return e.length===a.length&&e.slice(0,-1).every((i,o)=>i===a[o])?e[e.length-1]-a[a.length-1]:0}function wS(e,a,r=!1){let{routesMeta:i}=e,o={},c="/",d=[];for(let f=0;f<i.length;++f){let h=i[f],m=f===i.length-1,g=c==="/"?a:a.slice(c.length)||"/",y={path:h.relativePath,caseSensitive:h.caseSensitive,end:m},b=h.matcher&&h.compiledParams?N1(y,g,h.matcher,h.compiledParams):is(y,g),w=h.route;if(!b&&m&&r&&!i[i.length-1].route.index&&(b=is({path:h.relativePath,caseSensitive:h.caseSensitive,end:!1},g)),!b)return null;Object.assign(o,b.params),d.push({params:o,pathname:Qn([c,b.pathname]),pathnameBase:NS(Qn([c,b.pathnameBase])),route:w}),b.pathnameBase!=="/"&&(c=Qn([c,b.pathnameBase]))}return d}function is(e,a){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,i]=C1(e.path,e.caseSensitive,e.end);return N1(e,a,r,i)}function N1(e,a,r,i){let o=a.match(r);if(!o)return null;let c=o[0],d=c.replace(/(.)\/+$/,"$1"),f=o.slice(1);return{params:i.reduce((m,{paramName:g,isOptional:y},b)=>{if(g==="*"){let N=f[b]||"";d=c.slice(0,c.length-N.length).replace(/(.)\/+$/,"$1")}const w=f[b];return y&&!w?m[g]=void 0:m[g]=(w||"").replace(/%2F/g,"/"),m},{}),pathname:c,pathnameBase:d,pattern:e}}function C1(e,a=!1,r=!0){Hn(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let i=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(d,f,h,m,g)=>{if(i.push({paramName:f,isOptional:h!=null}),h){let y=g.charAt(m+d.length);return y&&y!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(i.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,a?void 0:"i"),i]}function E1(e){try{return e.split("/").map(a=>decodeURIComponent(a).replace(/\//g,"%2F")).join("/")}catch(a){return Hn(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${a}).`),e}}function _a(e,a){if(a==="/")return e;if(!e.toLowerCase().startsWith(a.toLowerCase()))return null;let r=a.endsWith("/")?a.length-1:a.length,i=e.charAt(r);return i&&i!=="/"?null:e.slice(r)||"/"}function SS(e,a="/"){let{pathname:r,search:i="",hash:o=""}=typeof e=="string"?Pl(e):e,c;return r?(r=T1(r),r.startsWith("/")?c=jx(r.substring(1),"/"):c=jx(r,a)):c=a,{pathname:c,search:CS(i),hash:ES(o)}}function jx(e,a){let r=su(a).split("/");return e.split("/").forEach(o=>{o===".."?r.length>1&&r.pop():o!=="."&&r.push(o)}),r.length>1?r.join("/"):"/"}function tf(e,a,r,i){return`Cannot include a '${e}' character in a manually specified \`to.${a}\` field [${JSON.stringify(i)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function jS(e){return e.filter((a,r)=>r===0||a.route.path&&a.route.path.length>0)}function bm(e){let a=jS(e);return a.map((r,i)=>i===a.length-1?r.pathname:r.pathnameBase)}function wu(e,a,r,i=!1){let o;typeof e=="string"?o=Pl(e):(o={...e},ut(!o.pathname||!o.pathname.includes("?"),tf("?","pathname","search",o)),ut(!o.pathname||!o.pathname.includes("#"),tf("#","pathname","hash",o)),ut(!o.search||!o.search.includes("#"),tf("#","search","hash",o)));let c=e===""||o.pathname==="",d=c?"/":o.pathname,f;if(d==null)f=r;else{let y=a.length-1;if(!i&&d.startsWith("..")){let b=d.split("/");for(;b[0]==="..";)b.shift(),y-=1;o.pathname=b.join("/")}f=y>=0?a[y]:"/"}let h=SS(o,f),m=d&&d!=="/"&&d.endsWith("/"),g=(c||d===".")&&r.endsWith("/");return!h.pathname.endsWith("/")&&(m||g)&&(h.pathname+="/"),h}var T1=e=>e.replace(/[\\/]{2,}/g,"/"),Qn=e=>T1(e.join("/")),su=e=>e.replace(/\/+$/,""),NS=e=>su(e).replace(/^\/*/,"/"),CS=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,ES=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,TS=class{constructor(e,a,r,i=!1){this.status=e,this.statusText=a||"",this.internal=i,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function MS(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function AS(e){let a=e.map(r=>r.route.path).filter(Boolean);return Qn(a)||"/"}var M1=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function A1(e,a){let r=e;if(typeof r!="string"||!vm.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let i=r,o=!1;if(M1)try{let c=new URL(window.location.href),d=k1.test(r)?new URL(iS(r,c.protocol)):new URL(r),f=_a(d.pathname,a);d.origin===c.origin&&f!=null?r=f+d.search+d.hash:o=!0}catch{Hn(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:i,isExternal:o,to:r}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var R1=["POST","PUT","PATCH","DELETE"];new Set(R1);var RS=["GET",...R1];new Set(RS);var _S=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function zS(e){try{return _S.includes(new URL(e).protocol)}catch{return!1}}var ql=k.createContext(null);ql.displayName="DataRouter";var Su=k.createContext(null);Su.displayName="DataRouterState";var _1=k.createContext(!1);function DS(){return k.useContext(_1)}var z1=k.createContext({isTransitioning:!1});z1.displayName="ViewTransition";var LS=k.createContext(new Map);LS.displayName="Fetchers";var OS=k.createContext(null);OS.displayName="Await";var Cn=k.createContext(null);Cn.displayName="Navigation";var fs=k.createContext(null);fs.displayName="Location";var Fn=k.createContext({outlet:null,matches:[],isDataRoute:!1});Fn.displayName="Route";var km=k.createContext(null);km.displayName="RouteError";var D1="REACT_ROUTER_ERROR",IS="REDIRECT",US="ROUTE_ERROR_RESPONSE";function $S(e){if(e.startsWith(`${D1}:${IS}:{`))try{let a=JSON.parse(e.slice(28));if(typeof a=="object"&&a&&typeof a.status=="number"&&typeof a.statusText=="string"&&typeof a.location=="string"&&typeof a.reloadDocument=="boolean"&&typeof a.replace=="boolean")return a}catch{}}function BS(e){if(e.startsWith(`${D1}:${US}:{`))try{let a=JSON.parse(e.slice(40));if(typeof a=="object"&&a&&typeof a.status=="number"&&typeof a.statusText=="string")return new TS(a.status,a.statusText,a.data)}catch{}}function HS(e,{relative:a}={}){ut(Kr(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:i}=k.useContext(Cn),{hash:o,pathname:c,search:d}=ms(e,{relative:a}),f=c;return r!=="/"&&(f=c==="/"?r:Qn([r,c])),i.createHref({pathname:f,search:d,hash:o})}function Kr(){return k.useContext(fs)!=null}function En(){return ut(Kr(),"useLocation() may be used only in the context of a <Router> component."),k.useContext(fs).location}function PS(e){ut(Kr(),"useMatch() may be used only in the context of a <Router> component.");let{pathname:a}=En();return k.useMemo(()=>is(e,E1(a)),[a,e])}var L1="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function O1(e){k.useContext(Cn).static||k.useLayoutEffect(e)}function Jn(){let{isDataRoute:e}=k.useContext(Fn);return e?aj():qS()}function qS(){ut(Kr(),"useNavigate() may be used only in the context of a <Router> component.");let e=k.useContext(ql),{basename:a,navigator:r}=k.useContext(Cn),{matches:i}=k.useContext(Fn),{pathname:o}=En(),c=JSON.stringify(bm(i)),d=k.useRef(!1);return O1(()=>{d.current=!0}),k.useCallback((h,m={})=>{if(Hn(d.current,L1),!d.current)return;if(typeof h=="number"){r.go(h);return}let g=wu(h,JSON.parse(c),o,m.relative==="path");e==null&&a!=="/"&&(g.pathname=g.pathname==="/"?a:Qn([a,g.pathname])),(m.replace?r.replace:r.push)(g,m.state,m)},[a,r,c,o,e])}var FS=k.createContext(null);function VS(e){let a=k.useContext(Fn).outlet;return k.useMemo(()=>a&&k.createElement(FS.Provider,{value:e},a),[a,e])}function I1(){let{matches:e}=k.useContext(Fn);return e[e.length-1]?.params??{}}function ms(e,{relative:a}={}){let{matches:r}=k.useContext(Fn),{pathname:i}=En(),o=JSON.stringify(bm(r));return k.useMemo(()=>wu(e,JSON.parse(o),i,a==="path"),[e,o,i,a])}function YS(e,a){return U1(e,a)}function U1(e,a,r){ut(Kr(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:i}=k.useContext(Cn),{matches:o}=k.useContext(Fn),c=o[o.length-1],d=c?c.params:{},f=c?c.pathname:"/",h=c?c.pathnameBase:"/",m=c&&c.route;{let j=m&&m.path||"";B1(f,!m||j.endsWith("*")||j.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${f}" (under <Route path="${j}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
10
|
+
|
|
11
|
+
Please change the parent <Route path="${j}"> to <Route path="${j==="/"?"*":`${j}/*`}">.`)}let g=En(),y;if(a){let j=typeof a=="string"?Pl(a):a;ut(h==="/"||j.pathname?.startsWith(h),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${h}" but pathname "${j.pathname}" was given in the \`location\` prop.`),y=j}else y=g;let b=y.pathname||"/",w=b;if(h!=="/"){let j=h.replace(/^\//,"").split("/");w="/"+b.replace(/^\//,"").split("/").slice(j.length).join("/")}let N=r&&r.state.matches.length?r.state.matches.map(j=>Object.assign(j,{route:r.manifest[j.route.id]||j.route})):w1(e,{pathname:w});Hn(m||N!=null,`No routes matched location "${y.pathname}${y.search}${y.hash}" `),Hn(N==null||N[N.length-1].route.element!==void 0||N[N.length-1].route.Component!==void 0||N[N.length-1].route.lazy!==void 0,`Matched leaf route at location "${y.pathname}${y.search}${y.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let A=QS(N&&N.map(j=>Object.assign({},j,{params:Object.assign({},d,j.params),pathname:Qn([h,i.encodeLocation?i.encodeLocation(j.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:j.pathname]),pathnameBase:j.pathnameBase==="/"?h:Qn([h,i.encodeLocation?i.encodeLocation(j.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:j.pathnameBase])})),o,r);return a&&A?k.createElement(fs.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...y},navigationType:"POP"}},A):A}function GS(){let e=nj(),a=MS(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,i="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:i},c={padding:"2px 4px",backgroundColor:i},d=null;return console.error("Error handled by React Router default ErrorBoundary:",e),d=k.createElement(k.Fragment,null,k.createElement("p",null,"💿 Hey developer 👋"),k.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",k.createElement("code",{style:c},"ErrorBoundary")," or"," ",k.createElement("code",{style:c},"errorElement")," prop on your route.")),k.createElement(k.Fragment,null,k.createElement("h2",null,"Unexpected Application Error!"),k.createElement("h3",{style:{fontStyle:"italic"}},a),r?k.createElement("pre",{style:o},r):null,d)}var KS=k.createElement(GS,null),$1=class extends k.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,a){return a.location!==e.location||a.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:a.error,location:a.location,revalidation:e.revalidation||a.revalidation}}componentDidCatch(e,a){this.props.onError?this.props.onError(e,a):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const r=BS(e.digest);r&&(e=r)}let a=e!==void 0?k.createElement(Fn.Provider,{value:this.props.routeContext},k.createElement(km.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?k.createElement(WS,{error:e},a):a}};$1.contextType=_1;var nf=new WeakMap;function WS({children:e,error:a}){let{basename:r}=k.useContext(Cn);if(typeof a=="object"&&a&&"digest"in a&&typeof a.digest=="string"){let i=$S(a.digest);if(i){let o=nf.get(a);if(o)throw o;let c=A1(i.location,r),d=c.absoluteURL||c.to;if(zS(d))throw new Error("Invalid redirect location");if(M1&&!nf.get(a))if(c.isExternal||i.reloadDocument)window.location.href=d;else{const f=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(c.to,{replace:i.replace}));throw nf.set(a,f),f}return k.createElement("meta",{httpEquiv:"refresh",content:`0;url=${d}`})}}return e}function XS({routeContext:e,match:a,children:r}){let i=k.useContext(ql);return i&&i.static&&i.staticContext&&(a.route.errorElement||a.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=a.route.id),k.createElement(Fn.Provider,{value:e},r)}function QS(e,a=[],r){let i=r?.state;if(e==null){if(!i)return null;if(i.errors)e=i.matches;else if(a.length===0&&!i.initialized&&i.matches.length>0)e=i.matches;else return null}let o=e,c=i?.errors;if(c!=null){let g=o.findIndex(y=>y.route.id&&c?.[y.route.id]!==void 0);ut(g>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(c).join(",")}`),o=o.slice(0,Math.min(o.length,g+1))}let d=!1,f=-1;if(r&&i){d=i.renderFallback;for(let g=0;g<o.length;g++){let y=o[g];if((y.route.HydrateFallback||y.route.hydrateFallbackElement)&&(f=g),y.route.id){let{loaderData:b,errors:w}=i,N=y.route.loader&&!b.hasOwnProperty(y.route.id)&&(!w||w[y.route.id]===void 0);if(y.route.lazy||N){r.isStatic&&(d=!0),f>=0?o=o.slice(0,f+1):o=[o[0]];break}}}}let h=r?.onError,m=i&&h?(g,y)=>{h(g,{location:i.location,params:i.matches?.[0]?.params??{},pattern:AS(i.matches),errorInfo:y})}:void 0;return o.reduceRight((g,y,b)=>{let w,N=!1,A=null,j=null;i&&(w=c&&y.route.id?c[y.route.id]:void 0,A=y.route.errorElement||KS,d&&(f<0&&b===0?(B1("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),N=!0,j=null):f===b&&(N=!0,j=y.route.hydrateFallbackElement||null)));let T=a.concat(o.slice(0,b+1)),I=()=>{let M;return w?M=A:N?M=j:y.route.Component?M=k.createElement(y.route.Component,null):y.route.element?M=y.route.element:M=g,k.createElement(XS,{match:y,routeContext:{outlet:g,matches:T,isDataRoute:i!=null},children:M})};return i&&(y.route.ErrorBoundary||y.route.errorElement||b===0)?k.createElement($1,{location:i.location,revalidation:i.revalidation,component:A,error:w,children:I(),routeContext:{outlet:null,matches:T,isDataRoute:!0},onError:m}):I()},null)}function wm(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ZS(e){let a=k.useContext(ql);return ut(a,wm(e)),a}function JS(e){let a=k.useContext(Su);return ut(a,wm(e)),a}function ej(e){let a=k.useContext(Fn);return ut(a,wm(e)),a}function Sm(e){let a=ej(e),r=a.matches[a.matches.length-1];return ut(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function tj(){return Sm("useRouteId")}function nj(){let e=k.useContext(km),a=JS("useRouteError"),r=Sm("useRouteError");return e!==void 0?e:a.errors?.[r]}function aj(){let{router:e}=ZS("useNavigate"),a=Sm("useNavigate"),r=k.useRef(!1);return O1(()=>{r.current=!0}),k.useCallback(async(o,c={})=>{Hn(r.current,L1),r.current&&(typeof o=="number"?await e.navigate(o):await e.navigate(o,{fromRouteId:a,...c}))},[e,a])}var Nx={};function B1(e,a,r){!a&&!Nx[e]&&(Nx[e]=!0,Hn(!1,r))}k.memo(rj);function rj({routes:e,manifest:a,future:r,state:i,isStatic:o,onError:c}){return U1(e,void 0,{manifest:a,state:i,isStatic:o,onError:c})}function ss({to:e,replace:a,state:r,relative:i}){ut(Kr(),"<Navigate> may be used only in the context of a <Router> component.");let{static:o}=k.useContext(Cn);Hn(!o,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:c}=k.useContext(Fn),{pathname:d}=En(),f=Jn(),h=wu(e,bm(c),d,i==="path"),m=JSON.stringify(h);return k.useEffect(()=>{f(JSON.parse(m),{replace:a,state:r,relative:i})},[f,m,i,a,r]),null}function lj(e){return VS(e.context)}function un(e){ut(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function ij({basename:e="/",children:a=null,location:r,navigationType:i="POP",navigator:o,static:c=!1,useTransitions:d}){ut(!Kr(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let f=e.replace(/^\/*/,"/"),h=k.useMemo(()=>({basename:f,navigator:o,static:c,useTransitions:d,future:{}}),[f,o,c,d]);typeof r=="string"&&(r=Pl(r));let{pathname:m="/",search:g="",hash:y="",state:b=null,key:w="default",mask:N}=r,A=k.useMemo(()=>{let j=_a(m,f);return j==null?null:{location:{pathname:j,search:g,hash:y,state:b,key:w,mask:N},navigationType:i}},[f,m,g,y,b,w,i,N]);return Hn(A!=null,`<Router basename="${f}"> is not able to match the URL "${m}${g}${y}" because it does not start with the basename, so the <Router> won't render anything.`),A==null?null:k.createElement(Cn.Provider,{value:h},k.createElement(fs.Provider,{children:a,value:A}))}function sj({children:e,location:a}){return YS(Uf(e),a)}function Uf(e,a=[]){let r=[];return k.Children.forEach(e,(i,o)=>{if(!k.isValidElement(i))return;let c=[...a,o];if(i.type===k.Fragment){r.push.apply(r,Uf(i.props.children,c));return}ut(i.type===un,`[${typeof i.type=="string"?i.type:i.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),ut(!i.props.index||!i.props.children,"An index route cannot have child routes.");let d={id:i.props.id||c.join("-"),caseSensitive:i.props.caseSensitive,element:i.props.element,Component:i.props.Component,index:i.props.index,path:i.props.path,middleware:i.props.middleware,loader:i.props.loader,action:i.props.action,hydrateFallbackElement:i.props.hydrateFallbackElement,HydrateFallback:i.props.HydrateFallback,errorElement:i.props.errorElement,ErrorBoundary:i.props.ErrorBoundary,hasErrorBoundary:i.props.hasErrorBoundary===!0||i.props.ErrorBoundary!=null||i.props.errorElement!=null,shouldRevalidate:i.props.shouldRevalidate,handle:i.props.handle,lazy:i.props.lazy};i.props.children&&(d.children=Uf(i.props.children,c)),r.push(d)}),r}var Zo="get",Jo="application/x-www-form-urlencoded";function ju(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function oj(e){return ju(e)&&e.tagName.toLowerCase()==="button"}function uj(e){return ju(e)&&e.tagName.toLowerCase()==="form"}function cj(e){return ju(e)&&e.tagName.toLowerCase()==="input"}function dj(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function fj(e,a){return e.button===0&&(!a||a==="_self")&&!dj(e)}function $f(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((a,r)=>{let i=e[r];return a.concat(Array.isArray(i)?i.map(o=>[r,o]):[[r,i]])},[]))}function mj(e,a){let r=$f(e);return a&&a.forEach((i,o)=>{r.has(o)||a.getAll(o).forEach(c=>{r.append(o,c)})}),r}var Oo=null;function hj(){if(Oo===null)try{new FormData(document.createElement("form"),0),Oo=!1}catch{Oo=!0}return Oo}var pj=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function af(e){return e!=null&&!pj.has(e)?(Hn(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Jo}"`),null):e}function gj(e,a){let r,i,o,c,d;if(uj(e)){let f=e.getAttribute("action");i=f?_a(f,a):null,r=e.getAttribute("method")||Zo,o=af(e.getAttribute("enctype"))||Jo,c=new FormData(e)}else if(oj(e)||cj(e)&&(e.type==="submit"||e.type==="image")){let f=e.form;if(f==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let h=e.getAttribute("formaction")||f.getAttribute("action");if(i=h?_a(h,a):null,r=e.getAttribute("formmethod")||f.getAttribute("method")||Zo,o=af(e.getAttribute("formenctype"))||af(f.getAttribute("enctype"))||Jo,c=new FormData(f,e),!hj()){let{name:m,type:g,value:y}=e;if(g==="image"){let b=m?`${m}.`:"";c.append(`${b}x`,"0"),c.append(`${b}y`,"0")}else m&&c.append(m,y)}}else{if(ju(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=Zo,i=null,o=Jo,d=e}return c&&o==="text/plain"&&(d=c,c=void 0),{action:i,method:r.toLowerCase(),encType:o,formData:c,body:d}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function jm(e,a){if(e===!1||e===null||typeof e>"u")throw new Error(a)}function H1(e,a,r,i){let o=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r?o.pathname.endsWith("/")?o.pathname=`${o.pathname}_.${i}`:o.pathname=`${o.pathname}.${i}`:o.pathname==="/"?o.pathname=`_root.${i}`:a&&_a(o.pathname,a)==="/"?o.pathname=`${su(a)}/_root.${i}`:o.pathname=`${su(o.pathname)}.${i}`,o}async function xj(e,a){if(e.id in a)return a[e.id];try{let r=await import(e.module);return a[e.id]=r,r}catch(r){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function yj(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function vj(e,a,r){let i=await Promise.all(e.map(async o=>{let c=a.routes[o.route.id];if(c){let d=await xj(c,r);return d.links?d.links():[]}return[]}));return Sj(i.flat(1).filter(yj).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?{...o,rel:"prefetch",as:"style"}:{...o,rel:"prefetch"}))}function Cx(e,a,r,i,o,c){let d=(h,m)=>r[m]?h.route.id!==r[m].route.id:!0,f=(h,m)=>r[m].pathname!==h.pathname||r[m].route.path?.endsWith("*")&&r[m].params["*"]!==h.params["*"];return c==="assets"?a.filter((h,m)=>d(h,m)||f(h,m)):c==="data"?a.filter((h,m)=>{let g=i.routes[h.route.id];if(!g||!g.hasLoader)return!1;if(d(h,m)||f(h,m))return!0;if(h.route.shouldRevalidate){let y=h.route.shouldRevalidate({currentUrl:new URL(o.pathname+o.search+o.hash,window.origin),currentParams:r[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:h.params,defaultShouldRevalidate:!0});if(typeof y=="boolean")return y}return!0}):[]}function bj(e,a,{includeHydrateFallback:r}={}){return kj(e.map(i=>{let o=a.routes[i.route.id];if(!o)return[];let c=[o.module];return o.clientActionModule&&(c=c.concat(o.clientActionModule)),o.clientLoaderModule&&(c=c.concat(o.clientLoaderModule)),r&&o.hydrateFallbackModule&&(c=c.concat(o.hydrateFallbackModule)),o.imports&&(c=c.concat(o.imports)),c}).flat(1))}function kj(e){return[...new Set(e)]}function wj(e){let a={},r=Object.keys(e).sort();for(let i of r)a[i]=e[i];return a}function Sj(e,a){let r=new Set;return new Set(a),e.reduce((i,o)=>{let c=JSON.stringify(wj(o));return r.has(c)||(r.add(c),i.push({key:c,link:o})),i},[])}function Nm(){let e=k.useContext(ql);return jm(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function jj(){let e=k.useContext(Su);return jm(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Cm=k.createContext(void 0);Cm.displayName="FrameworkContext";function Nu(){let e=k.useContext(Cm);return jm(e,"You must render this element inside a <HydratedRouter> element"),e}function Nj(e,a){let r=k.useContext(Cm),[i,o]=k.useState(!1),[c,d]=k.useState(!1),{onFocus:f,onBlur:h,onMouseEnter:m,onMouseLeave:g,onTouchStart:y}=a,b=k.useRef(null);k.useEffect(()=>{if(e==="render"&&d(!0),e==="viewport"){let A=T=>{T.forEach(I=>{d(I.isIntersecting)})},j=new IntersectionObserver(A,{threshold:.5});return b.current&&j.observe(b.current),()=>{j.disconnect()}}},[e]),k.useEffect(()=>{if(i){let A=setTimeout(()=>{d(!0)},100);return()=>{clearTimeout(A)}}},[i]);let w=()=>{o(!0)},N=()=>{o(!1),d(!1)};return r?e!=="intent"?[c,b,{}]:[c,b,{onFocus:$i(f,w),onBlur:$i(h,N),onMouseEnter:$i(m,w),onMouseLeave:$i(g,N),onTouchStart:$i(y,w)}]:[!1,b,{}]}function $i(e,a){return r=>{e&&e(r),r.defaultPrevented||a(r)}}function Cj({page:e,...a}){let r=DS(),{nonce:i}=Nu(),{router:o}=Nm(),c=k.useMemo(()=>w1(o.routes,e,o.basename),[o.routes,e,o.basename]);return c?(a.nonce==null&&i&&(a={...a,nonce:i}),r?k.createElement(Tj,{page:e,matches:c,...a}):k.createElement(Mj,{page:e,matches:c,...a})):null}function Ej(e){let{manifest:a,routeModules:r}=Nu(),[i,o]=k.useState([]);return k.useEffect(()=>{let c=!1;return vj(e,a,r).then(d=>{c||o(d)}),()=>{c=!0}},[e,a,r]),i}function Tj({page:e,matches:a,...r}){let i=En(),{future:o}=Nu(),{basename:c}=Nm(),d=k.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let f=H1(e,c,o.v8_trailingSlashAwareDataRequests,"rsc"),h=!1,m=[];for(let g of a)typeof g.route.shouldRevalidate=="function"?h=!0:m.push(g.route.id);return h&&m.length>0&&f.searchParams.set("_routes",m.join(",")),[f.pathname+f.search]},[c,o.v8_trailingSlashAwareDataRequests,e,i,a]);return k.createElement(k.Fragment,null,d.map(f=>k.createElement("link",{key:f,rel:"prefetch",as:"fetch",href:f,...r})))}function Mj({page:e,matches:a,...r}){let i=En(),{future:o,manifest:c,routeModules:d}=Nu(),{basename:f}=Nm(),{loaderData:h,matches:m}=jj(),g=k.useMemo(()=>Cx(e,a,m,c,i,"data"),[e,a,m,c,i]),y=k.useMemo(()=>Cx(e,a,m,c,i,"assets"),[e,a,m,c,i]),b=k.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let A=new Set,j=!1;if(a.forEach(I=>{let M=c.routes[I.route.id];!M||!M.hasLoader||(!g.some(_=>_.route.id===I.route.id)&&I.route.id in h&&d[I.route.id]?.shouldRevalidate||M.hasClientLoader?j=!0:A.add(I.route.id))}),A.size===0)return[];let T=H1(e,f,o.v8_trailingSlashAwareDataRequests,"data");return j&&A.size>0&&T.searchParams.set("_routes",a.filter(I=>A.has(I.route.id)).map(I=>I.route.id).join(",")),[T.pathname+T.search]},[f,o.v8_trailingSlashAwareDataRequests,h,i,c,g,a,e,d]),w=k.useMemo(()=>bj(y,c),[y,c]),N=Ej(y);return k.createElement(k.Fragment,null,b.map(A=>k.createElement("link",{key:A,rel:"prefetch",as:"fetch",href:A,...r})),w.map(A=>k.createElement("link",{key:A,rel:"modulepreload",href:A,...r})),N.map(({key:A,link:j})=>k.createElement("link",{key:A,nonce:r.nonce,...j,crossOrigin:j.crossOrigin??r.crossOrigin})))}function Aj(...e){return a=>{e.forEach(r=>{typeof r=="function"?r(a):r!=null&&(r.current=a)})}}var Rj=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Rj&&(window.__reactRouterVersion="7.18.1")}catch{}function _j({basename:e,children:a,useTransitions:r,window:i}){let o=k.useRef();o.current==null&&(o.current=sS({window:i,v5Compat:!0}));let c=o.current,[d,f]=k.useState({action:c.action,location:c.location}),h=k.useCallback(m=>{r===!1?f(m):k.startTransition(()=>f(m))},[r]);return k.useLayoutEffect(()=>c.listen(h),[c,h]),k.createElement(ij,{basename:e,children:a,location:d.location,navigationType:d.action,navigator:c,useTransitions:r})}var Em=k.forwardRef(function({onClick:a,discover:r="render",prefetch:i="none",relative:o,reloadDocument:c,replace:d,mask:f,state:h,target:m,to:g,preventScrollReset:y,viewTransition:b,defaultShouldRevalidate:w,...N},A){let{basename:j,navigator:T,useTransitions:I}=k.useContext(Cn),M=typeof g=="string"&&vm.test(g),_=A1(g,j);g=_.to;let $=HS(g,{relative:o}),U=En(),Y=null;if(f){let F=wu(f,[],U.mask?U.mask.pathname:"/",!0);j!=="/"&&(F.pathname=F.pathname==="/"?j:Qn([j,F.pathname])),Y=T.createHref(F)}let[W,J,P]=Nj(i,N),K=Lj(g,{replace:d,mask:f,state:h,target:m,preventScrollReset:y,relative:o,viewTransition:b,defaultShouldRevalidate:w,useTransitions:I});function D(F){a&&a(F),F.defaultPrevented||K(F)}let O=!(_.isExternal||c),te=k.createElement("a",{...N,...P,href:(O?Y:void 0)||_.absoluteURL||$,onClick:O?D:a,ref:Aj(A,J),target:m,"data-discover":!M&&r==="render"?"true":void 0});return W&&!M?k.createElement(k.Fragment,null,te,k.createElement(Cj,{page:$})):te});Em.displayName="Link";var Tm=k.forwardRef(function({"aria-current":a="page",caseSensitive:r=!1,className:i="",end:o=!1,style:c,to:d,viewTransition:f,children:h,...m},g){let y=ms(d,{relative:m.relative}),b=En(),w=k.useContext(Su),{navigator:N,basename:A}=k.useContext(Cn),j=w!=null&&Bj(y)&&f===!0,T=N.encodeLocation?N.encodeLocation(y).pathname:y.pathname,I=b.pathname,M=w&&w.navigation&&w.navigation.location?w.navigation.location.pathname:null;r||(I=I.toLowerCase(),M=M?M.toLowerCase():null,T=T.toLowerCase()),M&&A&&(M=_a(M,A)||M);const _=T!=="/"&&T.endsWith("/")?T.length-1:T.length;let $=I===T||!o&&I.startsWith(T)&&I.charAt(_)==="/",U=M!=null&&(M===T||!o&&M.startsWith(T)&&M.charAt(T.length)==="/"),Y={isActive:$,isPending:U,isTransitioning:j},W=$?a:void 0,J;typeof i=="function"?J=i(Y):J=[i,$?"active":null,U?"pending":null,j?"transitioning":null].filter(Boolean).join(" ");let P=typeof c=="function"?c(Y):c;return k.createElement(Em,{...m,"aria-current":W,className:J,ref:g,style:P,to:d,viewTransition:f},typeof h=="function"?h(Y):h)});Tm.displayName="NavLink";var zj=k.forwardRef(({discover:e="render",fetcherKey:a,navigate:r,reloadDocument:i,replace:o,state:c,method:d=Zo,action:f,onSubmit:h,relative:m,preventScrollReset:g,viewTransition:y,defaultShouldRevalidate:b,...w},N)=>{let{useTransitions:A}=k.useContext(Cn),j=Uj(),T=$j(f,{relative:m}),I=d.toLowerCase()==="get"?"get":"post",M=typeof f=="string"&&vm.test(f),_=$=>{if(h&&h($),$.defaultPrevented)return;$.preventDefault();let U=$.nativeEvent.submitter,Y=U?.getAttribute("formmethod")||d,W=()=>j(U||$.currentTarget,{fetcherKey:a,method:Y,navigate:r,replace:o,state:c,relative:m,preventScrollReset:g,viewTransition:y,defaultShouldRevalidate:b});A&&r!==!1?k.startTransition(()=>W()):W()};return k.createElement("form",{ref:N,method:I,action:T,onSubmit:i?h:_,...w,"data-discover":!M&&e==="render"?"true":void 0})});zj.displayName="Form";function Dj(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function P1(e){let a=k.useContext(ql);return ut(a,Dj(e)),a}function Lj(e,{target:a,replace:r,mask:i,state:o,preventScrollReset:c,relative:d,viewTransition:f,defaultShouldRevalidate:h,useTransitions:m}={}){let g=Jn(),y=En(),b=ms(e,{relative:d});return k.useCallback(w=>{if(fj(w,a)){w.preventDefault();let N=r!==void 0?r:ls(y)===ls(b),A=()=>g(e,{replace:N,mask:i,state:o,preventScrollReset:c,relative:d,viewTransition:f,defaultShouldRevalidate:h});m?k.startTransition(()=>A()):A()}},[y,g,b,r,i,o,a,e,c,d,f,h,m])}function Mm(e){Hn(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let a=k.useRef($f(e)),r=k.useRef(!1),i=En(),o=k.useMemo(()=>mj(i.search,r.current?null:a.current),[i.search]),c=Jn(),d=k.useCallback((f,h)=>{const m=$f(typeof f=="function"?f(new URLSearchParams(o)):f);r.current=!0,c("?"+m,h)},[c,o]);return[o,d]}var Oj=0,Ij=()=>`__${String(++Oj)}__`;function Uj(){let{router:e}=P1("useSubmit"),{basename:a}=k.useContext(Cn),r=tj(),i=e.fetch,o=e.navigate;return k.useCallback(async(c,d={})=>{let{action:f,method:h,encType:m,formData:g,body:y}=gj(c,a);if(d.navigate===!1){let b=d.fetcherKey||Ij();await i(b,r,d.action||f,{defaultShouldRevalidate:d.defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:g,body:y,formMethod:d.method||h,formEncType:d.encType||m,flushSync:d.flushSync})}else await o(d.action||f,{defaultShouldRevalidate:d.defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:g,body:y,formMethod:d.method||h,formEncType:d.encType||m,replace:d.replace,state:d.state,fromRouteId:r,flushSync:d.flushSync,viewTransition:d.viewTransition})},[i,o,a,r])}function $j(e,{relative:a}={}){let{basename:r}=k.useContext(Cn),i=k.useContext(Fn);ut(i,"useFormAction must be used inside a RouteContext");let[o]=i.matches.slice(-1),c={...ms(e||".",{relative:a})},d=En();if(e==null){c.search=d.search;let f=new URLSearchParams(c.search),h=f.getAll("index");if(h.some(g=>g==="")){f.delete("index"),h.filter(y=>y).forEach(y=>f.append("index",y));let g=f.toString();c.search=g?`?${g}`:""}}return(!e||e===".")&&o.route.index&&(c.search=c.search?c.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(c.pathname=c.pathname==="/"?r:Qn([r,c.pathname])),ls(c)}function Bj(e,{relative:a}={}){let r=k.useContext(z1);ut(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:i}=P1("useViewTransitionState"),o=ms(e,{relative:a});if(!r.isTransitioning)return!1;let c=_a(r.currentLocation.pathname,i)||r.currentLocation.pathname,d=_a(r.nextLocation.pathname,i)||r.nextLocation.pathname;return is(o.pathname,d)!=null||is(o.pathname,c)!=null}const Ex="penguin.lastProjectId",Tx=e=>`penguin.lastAgentId.${e}`,q1=k.createContext(null);function Bf(e){return e.name??e.projectId}function za(e){return e.name??e.agentId}function Hj({children:e}){const[a,r]=k.useState([]),[i,o]=k.useState(!0),[c,d]=k.useState(null),[f,h]=k.useState([]),[m,g]=k.useState(!0),[y,b]=k.useState(null),w=k.useCallback(async()=>{o(!0);try{const I=await Nw();r(I.projects),d(M=>{const _=M??localStorage.getItem(Ex);return(I.projects.find(U=>U.projectId===_)??I.projects[0])?.projectId??null})}finally{o(!1)}},[]);k.useEffect(()=>{w()},[w]);const N=k.useCallback(I=>{I!==c&&(localStorage.setItem(Ex,I),d(I),b(null),h([]),g(!0),y1({lastProjectId:I}).catch(()=>{}))},[c]),A=k.useCallback(async()=>{if(c){g(!0);try{const I=await Dw(c);h(I.agents),b(M=>{const _=M??localStorage.getItem(Tx(c)),$=I.agents.find(Y=>Y.agentId===_),U=I.agents.find(Y=>Y.agentId==="default_agent")??I.agents[0]??null;return($??U)?.agentId??null})}finally{g(!1)}}},[c]);k.useEffect(()=>{h([]),A()},[A]);const j=k.useCallback(I=>{c&&localStorage.setItem(Tx(c),I),b(I)},[c]),T=k.useMemo(()=>{const I=a.find(_=>_.projectId===c)??null,M=f.find(_=>_.agentId===y)??null;return{projects:a,projectsLoading:i,currentProject:I,setCurrentProjectId:N,reloadProjects:w,agents:f,agentsLoading:m,currentAgent:M,setCurrentAgentId:j,reloadAgents:A}},[a,i,c,N,w,f,m,y,j,A]);return s.jsx(q1.Provider,{value:T,children:e})}function Yt(){const e=k.useContext(q1);if(!e)throw new Error("useProject 必须在 ProjectProvider 内使用");return e}function F1(e,a){const r=new EventSource(e);r.onmessage=o=>{try{a.onOmniMessage(JSON.parse(o.data))}catch{}},r.addEventListener("server_event",o=>{try{a.onServerEvent(JSON.parse(o.data))}catch{}}),a.onOpen&&(r.onopen=a.onOpen);const{onError:i}=a;return i&&(r.onerror=()=>i(r.readyState===EventSource.CLOSED)),{close:()=>r.close()}}function Pj(e,a){return F1(`/api/sessions/${encodeURIComponent(e)}/stream`,a)}function qj(e){return F1("/api/events",e)}const V1=k.createContext(null);function Fj({children:e}){const{currentProject:a,agents:r}=Yt(),i=a?.projectId??null,o=r.map(M=>M.agentId).join(","),[c,d]=k.useState([]),[f,h]=k.useState(!0),m=k.useRef(0),g=k.useCallback(async()=>{const M=o===""?[]:o.split(",");if(!i||M.length===0)return;const _=++m.current;h(!0);try{const $=await Promise.all(M.map(async U=>{try{return(await $w(i,U)).sessions}catch{return[]}}));if(_!==m.current)return;d($.flat())}finally{_===m.current&&h(!1)}},[i,o]);k.useEffect(()=>{d([]),g()},[g]);const y=k.useRef(g);y.current=g;const b=k.useRef(i);b.current=i,k.useEffect(()=>{const M=qj({onOmniMessage:()=>{},onServerEvent:_=>{_.type==="schedule_fired"&&_.projectId===b.current&&y.current()}});return()=>M.close()},[]);const w=k.useCallback(M=>{m.current+=1,d(_=>[M,..._.filter($=>$.sessionId!==M.sessionId)])},[]),N=k.useCallback(M=>{m.current+=1,d(_=>_.filter($=>$.sessionId!==M))},[]),A=k.useCallback(M=>{d(_=>_.map($=>$.sessionId===M.sessionId?M:$))},[]),j=k.useCallback((M,_)=>{d($=>{const U=$.find(Y=>Y.sessionId===M);return!U||U.status===_?$:$.map(Y=>Y.sessionId===M?{...Y,status:_}:Y)})},[]),T=k.useCallback((M,_)=>{d($=>$.map(U=>U.sessionId===M?{...U,title:_}:U))},[]),I=k.useMemo(()=>{const M=new Map;for(const _ of c){const $=M.get(_.agentId);$?$.push(_):M.set(_.agentId,[_])}return{sessions:c,byAgent:M,loading:f,reload:g,add:w,remove:N,replace:A,setStatus:j,setTitle:T}},[c,f,g,w,N,A,j,T]);return s.jsx(V1.Provider,{value:I,children:e})}function Cu(){const e=k.useContext(V1);if(!e)throw new Error("useSessions 必须在 SessionsProvider 内使用");return e}function Vj({open:e,side:a="left",title:r,onClose:i,children:o,widthClass:c}){return k.useEffect(()=>{if(!e)return;const d=f=>{f.key==="Escape"&&i()};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[e,i]),e?s.jsxs("div",{className:"fixed inset-0 z-50",children:[s.jsx("div",{className:"anim-fade absolute inset-0 bg-black/45",onMouseDown:i}),s.jsxs("div",{className:`absolute inset-y-0 flex w-[80vw] flex-col bg-white shadow-xl dark:bg-gray-900 ${c??"max-w-xs"} ${a==="left"?"anim-drawer-left left-0 border-r border-gray-200 dark:border-gray-800":"anim-drawer-right right-0 border-l border-gray-200 dark:border-gray-800"}`,children:[s.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-gray-200 px-4 py-3 dark:border-gray-800",children:[s.jsx("span",{className:"text-base font-semibold",children:r??""}),s.jsx("button",{type:"button","aria-label":v.common.close,onClick:i,className:"rounded-md p-1.5 text-gray-400 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-600 dark:hover:bg-gray-800 dark:hover:text-gray-300",children:s.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",children:s.jsx("path",{d:"M2 2l10 10M12 2L2 12",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),s.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto pb-[env(safe-area-inset-bottom)]",children:o})]})]}):null}function Da({button:e,open:a,setOpen:r,children:i,menuClass:o,className:c}){const d=k.useRef(null);return k.useEffect(()=>{if(!a)return;const f=m=>{d.current&&!d.current.contains(m.target)&&r(!1)},h=m=>{m.key==="Escape"&&r(!1)};return window.addEventListener("mousedown",f),window.addEventListener("keydown",h),()=>{window.removeEventListener("mousedown",f),window.removeEventListener("keydown",h)}},[a,r]),s.jsxs("div",{className:`relative ${c??""}`,ref:d,children:[e,a&&s.jsx("div",{className:`anim-pop absolute z-40 max-h-[70vh] overflow-y-auto rounded-md border border-gray-200 bg-white py-1 shadow-lg dark:border-gray-700 dark:bg-gray-900 ${o??"left-0 top-full mt-1 w-64 max-w-[calc(100vw-2rem)] origin-top-left"}`,children:i})]})}const Zi=5,Mx=Math.ceil(Zi/2);function Yj(e){let a=2166136261;for(let r=0;r<e.length;r++)a^=e.charCodeAt(r),a=Math.imul(a,16777619);return a>>>0}function Gj(e){return()=>{e|=0,e=e+1831565813|0;let a=Math.imul(e^e>>>15,1|e);return a=a+Math.imul(a^a>>>7,61|a)^a,((a^a>>>14)>>>0)/4294967296}}function Kj(e){const a=Array.from({length:Zi},()=>Array.from({length:Zi},()=>!1));for(let r=0;r<Mx;r++)for(let i=0;i<Zi;i++){const o=e()<(r===Mx-1?.4:.55);a[i][r]=o,a[i][Zi-1-r]=o}return a}function Vr({id:e,size:a=18,className:r}){const i=Gj(Yj(e||"agent")),o=Math.floor(i()*360),c=Kj(i),d=4,f=2,h=`hsl(${o} 52% 46%)`;return s.jsxs("svg",{width:a,height:a,viewBox:"0 0 24 24",className:r,"aria-hidden":!0,role:"img",children:[s.jsx("rect",{x:"0",y:"0",width:"24",height:"24",rx:"5",fill:`hsl(${o} 55% 50% / 0.14)`}),c.map((m,g)=>m.map((y,b)=>y?s.jsx("rect",{x:f+b*d,y:f+g*d,width:d,height:d,fill:h},`${g}-${b}`):null))]})}function Zt({open:e,size:a=14,className:r=""}){return s.jsx("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,className:`block shrink-0 transition-transform duration-200 ${e?"rotate-90":""} ${r}`,children:s.jsx("path",{d:"M9 5l7 7-7 7"})})}function Eu({text:e,className:a=""}){const r=k.useRef(null),[i,o]=k.useState(!1);return k.useLayoutEffect(()=>{const c=r.current;if(!c)return;const d=()=>o(c.scrollWidth>c.clientWidth+1);if(d(),typeof ResizeObserver>"u")return;const f=new ResizeObserver(d);return f.observe(c),()=>f.disconnect()},[e,a]),s.jsx("span",{ref:r,className:`truncate ${a}`,...i?{title:e}:{},children:e})}const Wj={gray:"bg-gray-100 text-gray-600 dark:bg-gray-800 dark:text-gray-300",brand:"bg-gray-200/80 text-gray-700 dark:bg-gray-700/60 dark:text-gray-200",green:"bg-emerald-50 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-300",amber:"bg-amber-50 text-amber-700 dark:bg-amber-950 dark:text-amber-300",red:"bg-red-50 text-red-700 dark:bg-red-950 dark:text-red-300"};function mt({tone:e="gray",children:a}){return s.jsx("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 text-[11px] font-semibold ${Wj[e]}`,children:a})}function Hf(e){switch(e){case"completed":return"green";case"aborted":return"amber";default:return"red"}}var hs=o1();const Bi=[];function bt({open:e,title:a,onClose:r,children:i,footer:o,widthClass:c}){return k.useEffect(()=>{if(!e)return;const d=Symbol("modal");Bi.push(d);const f=h=>{h.key==="Escape"&&Bi[Bi.length-1]===d&&r()};return window.addEventListener("keydown",f),()=>{window.removeEventListener("keydown",f);const h=Bi.lastIndexOf(d);h!==-1&&Bi.splice(h,1)}},[e,r]),e?hs.createPortal(s.jsx("div",{className:"anim-fade fixed inset-0 z-50 flex items-end justify-center bg-black/45 p-0 sm:items-center sm:p-4",onMouseDown:d=>{d.target===d.currentTarget&&r()},children:s.jsxs("div",{className:`anim-pop w-full ${c??"sm:max-w-md"} rounded-t-lg border border-gray-200 bg-white pb-[env(safe-area-inset-bottom)] shadow-xl sm:rounded-lg sm:pb-0 dark:border-gray-800 dark:bg-gray-900`,children:[s.jsxs("div",{className:"flex items-center justify-between border-b border-gray-200 px-4 py-3 dark:border-gray-800",children:[s.jsx("h2",{className:"text-base font-semibold",children:a}),s.jsx("button",{type:"button","aria-label":v.common.close,onClick:r,className:"rounded-md p-1.5 text-gray-400 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-600 dark:hover:bg-gray-800 dark:hover:text-gray-300",children:s.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",children:s.jsx("path",{d:"M2 2l10 10M12 2L2 12",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),s.jsx("div",{className:"max-h-[70vh] overflow-y-auto px-4 py-4",children:i}),o&&s.jsx("div",{className:"flex justify-end gap-2 border-t border-gray-200 px-4 py-3 dark:border-gray-800",children:o})]})}),document.body):null}const Xj={primary:"bg-[var(--accent-bg)] text-[var(--accent-fg)] border border-[var(--accent-bg)] transition-opacity hover:opacity-90 disabled:opacity-50",secondary:"bg-white text-gray-800 border border-gray-300 hover:bg-gray-50 dark:bg-gray-900 dark:text-gray-200 dark:border-gray-700 dark:hover:bg-gray-800",danger:"bg-white text-red-600 border border-gray-300 hover:border-red-300 hover:bg-red-50 dark:bg-gray-900 dark:text-red-400 dark:border-gray-700 dark:hover:bg-red-950",ghost:"bg-transparent text-gray-600 border border-transparent hover:bg-gray-100 hover:text-gray-900 dark:text-gray-300 dark:hover:bg-gray-800 dark:hover:text-gray-100"},Qj={sm:"px-2.5 py-1 text-xs rounded-md",md:"px-3 py-1.5 text-sm rounded-md",icon:"p-1.5 rounded-md"};function pe({variant:e="secondary",size:a="md",className:r,...i}){return s.jsx("button",{type:"button",className:`inline-flex items-center justify-center gap-1 font-medium transition-colors duration-150 disabled:cursor-not-allowed disabled:opacity-60 ${Xj[e]} ${Qj[a]} ${r??""}`,...i})}const Y1="w-full rounded-md border border-gray-300 bg-white text-gray-900 placeholder:text-gray-400 transition-[border-color,box-shadow] duration-200 hover:border-gray-400 focus:border-gray-500 focus:outline-none focus:ring-2 focus:ring-gray-400/30 disabled:cursor-not-allowed disabled:opacity-60 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-100 dark:placeholder:text-gray-500 dark:hover:border-gray-600 dark:focus:border-gray-400 dark:focus:ring-gray-500/30",Am={base:"px-3 py-2 text-base",sm:"px-2 py-1 text-xs"},Zj="!border-red-400 !bg-red-50 hover:!border-red-500 focus:!border-red-500 focus:!ring-red-400/30 dark:!border-red-800 dark:!bg-red-950/40 dark:hover:!border-red-700 dark:focus:!border-red-600";function qe({label:e,hint:a,error:r,invalid:i,size:o="base",className:c,...d}){const f=!!r||!!i,h=s.jsx("input",{className:`${Y1} ${Am[o]} ${f?Zj:""} ${c??""}`,"aria-invalid":f?!0:void 0,...d});return!e&&!a&&!r?h:s.jsxs("label",{className:"block",children:[e&&s.jsx("span",{className:"mb-1 block text-xs font-semibold text-gray-600 dark:text-gray-400",children:e}),h,r?s.jsx("span",{className:"mt-1 block text-xs text-red-600 dark:text-red-400",children:r}):a?s.jsx("span",{className:"mt-1 block text-xs text-gray-500 dark:text-gray-500",children:a}):null]})}const $l=k.forwardRef(function({label:a,hint:r,mono:i,size:o="base",className:c,...d},f){const h=s.jsx("textarea",{ref:f,className:`${Y1} px-3 py-2 ${o==="sm"?"text-xs leading-relaxed":"text-base"} ${i?"font-mono":""} ${c??""}`,...d});return!a&&!r?h:s.jsxs("label",{className:"block",children:[a&&s.jsx("span",{className:"mb-1 block text-xs font-semibold text-gray-600 dark:text-gray-400",children:a}),h,r&&s.jsx("span",{className:"mt-1 block text-xs text-gray-500 dark:text-gray-500",children:r})]})});function Ur({options:e,value:a,onChange:r,cols:i=3}){return s.jsx("div",{className:`grid ${i===2?"grid-cols-2":"grid-cols-3"} gap-0.5 rounded-md bg-gray-100 p-0.5 dark:bg-gray-800`,children:e.map(o=>s.jsx("button",{type:"button",onClick:()=>r(o.value),className:`rounded px-1 py-1 text-xs transition-colors duration-150 ${a===o.value?"bg-white font-medium text-gray-900 shadow-sm dark:bg-gray-600 dark:text-gray-100":"text-gray-500 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-200"}`,children:o.label},o.value))})}function ft({className:e}){return s.jsx("div",{className:`animate-pulse rounded bg-gray-200 dark:bg-gray-800 ${e??"h-4 w-full"}`})}function Wr({rows:e=3}){return s.jsx("div",{className:"space-y-2 p-2",children:Array.from({length:e},(a,r)=>s.jsx(ft,{className:"h-8 w-full"},r))})}function G1({className:e,children:a}){return s.jsx("div",{className:`rounded-md border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900 ${e??"p-4"}`,children:a??s.jsxs(s.Fragment,{children:[s.jsx(ft,{className:"h-3 w-20"}),s.jsx(ft,{className:"mt-2.5 h-6 w-28"}),s.jsx(ft,{className:"mt-2.5 h-3 w-24"})]})})}function ur(e,a){if(!(e instanceof Ie))return v.common.unknownError;switch(e.code){case"model_credential_missing":return a?.modelId?v.errors.modelCredentialMissing(a.modelId):e.message;case"no_default_model":return v.errors.noDefaultModel;default:return e.message}}function sa(e){k.useEffect(()=>{document.title=e?`${e} · ${v.appName}`:v.appName},[e])}function cr(e){const a=e.toFixed(1);return a.endsWith(".0")?a.slice(0,-2):a}function We(e){const a=Math.abs(e);return a<1e3?`${e}`:a<1e6?`${cr(e/1e3)}k`:`${cr(e/1e6)}M`}function At(e){if(e<1e3)return`${Math.round(e)}ms`;const a=e/1e3;return a<60?`${cr(a)}s`:`${Math.floor(a/60)}m${Math.round(a%60)}s`}function Pf(e,a){return a>0?e/(a/1e3):null}function ou(e){return e==null||!Number.isFinite(e)?"—":`${Math.abs(e)<1e3?cr(e):We(e)} tok/s`}function K1(e){return e==null||!Number.isFinite(e)?"—":`${Math.round(e*100)}%`}function Pn(e,a="USD"){if(e==null)return"—";const r=a==="CNY"?"¥":"$",i=a==="CNY"?e*7:e;if(i===0)return`${r}0`;const o=Math.abs(i),c=o>=100?0:o>=1?2:4;return`${r}${i.toFixed(c)}`}function uu(e){return Number.isInteger(e)?`${e}`:cr(e)}function qf(e){return e<1024?`${e}B`:e<1024*1024?`${cr(e/1024)}KB`:e<1024*1024*1024?`${cr(e/(1024*1024))}MB`:`${cr(e/(1024*1024*1024))}GB`}function $r(e){return e<10?`0${e}`:`${e}`}function Nn(e){const a=new Date(e);return Number.isNaN(a.getTime())?e:`${a.getFullYear()}-${$r(a.getMonth()+1)}-${$r(a.getDate())} ${$r(a.getHours())}:${$r(a.getMinutes())}`}function W1(e,a){const r=new Date(e);return Number.isNaN(r.getTime())?"":r.toLocaleString(a==="en"?"en-US":"zh-CN",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}function cu(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}function Jj(e,a){const r=new Date(e);if(Number.isNaN(r.getTime()))return e;const i=Math.round((cu(new Date)-cu(r))/864e5);return i<0?Nn(e):i===0?a==="en"?"today":"今天":i===1?a==="en"?"yesterday":"昨天":a==="en"?`${i} days ago`:`${i} 天前`}function e4(e,a){const r=new Date(e);if(Number.isNaN(r.getTime()))return e;const i=Math.round((cu(new Date)-cu(r))/864e5);return i<0?e:i===0?a==="en"?"updated today":"今天更新":i===1?a==="en"?"updated yesterday":"昨天更新":a==="en"?`updated ${i} days ago`:`${i} 天前更新`}function t4(e){const a=new Date(e);return Number.isNaN(a.getTime())?e:`${$r(a.getHours())}:${$r(a.getMinutes())}:${$r(a.getSeconds())}`}var n4=["partial_text","partial_thinking","partial_tool_call","partial_tool_call_output"];function Rm(e){return n4.includes(e.type??"")}function _m(e){return e.type==="event_msg"}function a4(){return{contextNow:0,contextStale:!1,contextAtLastStats:0,sessionTotal:0,subagentTotal:0,taskTokens:0,taskCacheRead:0,taskCacheWrite:0,taskOutput:0,taskMainOutput:0,taskLlmMs:0,pendingCompactionTokens:0,pendingCompactionCacheRead:0,pendingCompactionCacheWrite:0,pendingCompactionOutput:0,hasUsage:!1,sessionElapsedMs:0,compactionActive:!1}}function X1(e,a){e.taskCacheRead+=a.request.cache_read,e.taskCacheWrite+=a.request.cache_write,e.taskOutput+=a.request.output}function r4(e,a){if(e.sessionTotal=a.session.total,e.compactionActive){e.pendingCompactionTokens+=a.request.total,e.pendingCompactionCacheRead+=a.request.cache_read,e.pendingCompactionCacheWrite+=a.request.cache_write,e.pendingCompactionOutput+=a.request.output;return}e.taskTokens+=a.request.total,X1(e,a),e.contextNow=a.request.total,e.contextStale=!1,e.taskMainOutput+=a.request.output,e.hasUsage=!0}function l4(e){e.pendingCompactionTokens!==0&&(e.taskTokens+=e.pendingCompactionTokens,e.taskCacheRead+=e.pendingCompactionCacheRead,e.taskCacheWrite+=e.pendingCompactionCacheWrite,e.taskOutput+=e.pendingCompactionOutput,e.hasUsage=!0,zm(e))}function zm(e){e.pendingCompactionTokens=0,e.pendingCompactionCacheRead=0,e.pendingCompactionCacheWrite=0,e.pendingCompactionOutput=0}function i4(e,a){a>0&&(e.taskLlmMs+=a)}function s4(e,a){e.taskTokens+=a.request.total,X1(e,a),e.subagentTotal+=a.request.total,e.hasUsage=!0}function o4(e){e.compactionActive=!0}function u4(e,a){e.compactionActive=!1,a==="completed"&&(e.contextStale=!0)}function c4(e){e.taskTokens=0,e.taskCacheRead=0,e.taskCacheWrite=0,e.taskOutput=0,e.taskMainOutput=0,e.taskLlmMs=0,zm(e),e.hasUsage=!1,e.compactionActive=!1}function d4(e,a){if(e.sessionElapsedMs+=a,zm(e),!e.hasUsage)return e.taskTokens=0,null;const r={context:e.contextNow,contextDelta:e.contextNow-e.contextAtLastStats,tokens:e.sessionTotal+e.subagentTotal,tokensDelta:e.taskTokens,elapsedMs:e.sessionElapsedMs,elapsedDeltaMs:a,tokensByBucket:{cacheRead:e.taskCacheRead,cacheWrite:e.taskCacheWrite,output:e.taskOutput},outputTps:Pf(e.taskMainOutput,e.taskLlmMs)};return e.contextAtLastStats=e.contextNow,e.taskTokens=0,e.taskCacheRead=0,e.taskCacheWrite=0,e.taskOutput=0,e.taskMainOutput=0,e.taskLlmMs=0,e.hasUsage=!1,e.compactionActive=!1,r}function f4(e,a="统计信息"){const r=e.tokensByBucket;return`[${a}] 输入 tokens ${We(r.cacheRead+r.cacheWrite)}(已缓存 ${We(r.cacheRead)}) · 输出 tokens ${We(r.output)} · ${ou(e.outputTps)}`}function Q1(e,a){return{items:[],nested:e,stats:a4(),openText:null,openThinking:null,pendingText:null,pendingThinking:null,toolCards:new Map,subagents:new Map,localDecisions:a,pendingDecisions:new Map,pendingDecisionTs:new Map,lastTsMs:0,openRequestBeginMs:null,openApprovalWaitMs:0,reconnectRun:0,taskOpen:!1,taskStartLocalMs:0,taskFirstTsMs:0,taskLastTsMs:0,taskLastReqEndMs:null,nextItemId:1}}function Ff(e=new Set){return Q1(!1,e)}function Sn(e){return e.nextItemId++}function du(e,a,r=Date.now()){if(a.origin&&a.origin.length>0){S4(e,a,r);return}if(a.type==="model_msg"){if(e.stats.compactionActive){la(e,a.timestamp),rf(e,a.timestamp);return}if(Rm(a.payload)){la(e,a.timestamp),v4(e,a.payload,Aa(a.timestamp));return}b4(e,a.payload,a.timestamp,r),rf(e,a.timestamp);return}if(_m(a)){la(e,a.timestamp),k4(e,a.payload,Aa(a.timestamp)),rf(e,a.timestamp);return}}function Aa(e){const a=Date.parse(e);return Number.isFinite(a)?a:void 0}function rf(e,a){const r=Date.parse(a);Number.isFinite(r)&&(e.lastTsMs=r)}function m4(e,a,r=Date.now()){for(const i of a)du(e,i,r)}function h4(e,a=Date.now()){Dm(e,"live",a)}function p4(e){Dm(e,"history")}function g4(e,a){e.localDecisions.add(a)}function Bl(e,a){return`${e?.join("/")??""} ${a}`}function x4(e,a,r){let i=e;for(const o of a??[])if(i=i.subagents.get(o),!i)return null;return i.toolCards.get(r)??null}function la(e,a){if(!e.taskOpen||e.stats.compactionActive)return;const r=Date.parse(a);!Number.isFinite(r)||r<=e.taskLastTsMs||(e.taskLastTsMs=r)}function Ax(e,a,r){Dm(e,"history");const i=Kf(e);i&&(i.gaveUp=!0),e.reconnectRun=0,e.openRequestBeginMs=null,e.openApprovalWaitMs=0,e.taskOpen=!0,e.taskStartLocalMs=r;const o=Date.parse(a);e.taskFirstTsMs=Number.isFinite(o)?o:r,e.taskLastTsMs=e.taskFirstTsMs,e.taskLastReqEndMs=null,c4(e.stats)}function Dm(e,a,r){if(!e.taskOpen)return;e.taskOpen=!1,Z1(e);const i=e.taskLastReqEndMs??e.taskLastTsMs,o=Math.max(0,i-e.taskFirstTsMs);let c;e.taskLastReqEndMs!==null?c=o:a==="live"?c=Math.max((r??Date.now())-e.taskStartLocalMs,o):c=o;const d=d4(e.stats,c);if(e.nested)return;const f=y4(e);if(d===null&&f.text==="")return;const h={kind:"task_stats",id:Sn(e),stats:d,assistantText:f.text,...f.atMs!==void 0?{atMs:f.atMs}:{}};let m=e.items.length;for(;m>0&&e.items[m-1].kind==="compaction";)m--;e.items.splice(m,0,h)}function y4(e){const a=[];let r;for(let i=e.items.length-1;i>=0;i--){const o=e.items[i];if(o.kind==="task_stats")break;o.kind==="assistant_text"&&o.text.trim()&&(a.push(o.text),r===void 0&&(r=o.atMs))}return{text:a.reverse().join(`
|
|
12
|
+
|
|
13
|
+
`),...r!==void 0?{atMs:r}:{}}}function v4(e,a,r){switch(a.type){case"partial_text":{if(a.event_type==="start"){e.pendingText=null;const o={kind:"assistant_text",id:Sn(e),text:a.text??"",streaming:!0,...r!==void 0?{atMs:r}:{}};e.openText=o,e.items.push(o);return}const i=e.openText;if(!i)return;a.text&&(i.text+=a.text),a.event_type==="stop"&&(i.streaming=!1,a.stop_reason!==void 0&&(i.stopReason=a.stop_reason),e.pendingText=i,e.openText=null);return}case"partial_thinking":{if(a.event_type==="start"){e.pendingThinking=null;const o={kind:"thinking",id:Sn(e),thinking:a.thinking??"",streaming:!0};r!==void 0&&(o.startedAtMs=r),e.openThinking=o,e.items.push(o);return}const i=e.openThinking;if(!i)return;a.thinking&&(i.thinking+=a.thinking),a.event_type==="stop"&&(i.streaming=!1,a.stop_reason!==void 0&&(i.stopReason=a.stop_reason),Vf(i,r),e.pendingThinking=i,e.openThinking=null);return}case"partial_tool_call":{const i=e.toolCards.get(a.tool_call_id);if(i?.callComplete)return;if(a.event_type==="start"){if(i){i.name=a.name||i.name,i.argumentsText=a.arguments??"",i.callStreaming=!0,r!==void 0&&i.argStartedAtMs===void 0&&(i.argStartedAtMs=r);return}const o=Gf(e,{toolCallId:a.tool_call_id,name:a.name,argumentsText:a.arguments??"",callStreaming:!0});r!==void 0&&(o.argStartedAtMs=r);return}if(!i)return;a.name&&!i.name&&(i.name=a.name),a.arguments&&(i.argumentsText+=a.arguments),a.event_type==="stop"&&(i.callStreaming=!1,a.stop_reason!==void 0&&(i.callStopReason=a.stop_reason),r!==void 0&&(i.callStartedAtMs=r));return}case"partial_tool_call_output":{const i=e.toolCards.get(a.tool_call_id);if(!i||i.outputComplete)return;if(a.event_type==="start"){i.outputStreaming=!0,a.output&&(i.output+=a.output);return}if(!i.outputStreaming)return;a.output&&(i.output+=a.output),a.images&&a.images.length>0&&(i.images=a.images),a.event_type==="stop"&&(i.outputStreaming=!1,a.stop_reason!==void 0&&(i.outputStopReason=a.stop_reason),J1(i,r));return}}}function b4(e,a,r,i){switch(a.type){case"text":{if(a.role==="user"){if(a.text.startsWith("<context_summary>")){la(e,r);return}Ax(e,r,i);const f=Aa(r);e.items.push({kind:"user_text",id:Sn(e),text:a.text,...f!==void 0?{atMs:f}:{}});return}la(e,r);const o=e.pendingText??e.openText;if(o){o.text=a.text,o.streaming=!1;const f=Aa(r);f!==void 0&&(o.atMs=f),a.stop_reason!==void 0&&(o.stopReason=a.stop_reason),o===e.openText&&(e.openText=null),e.pendingText=null;return}const c=Aa(r),d={kind:"assistant_text",id:Sn(e),text:a.text,streaming:!1,...c!==void 0?{atMs:c}:{}};a.stop_reason!==void 0&&(d.stopReason=a.stop_reason),e.items.push(d);return}case"image_url":{Ax(e,r,i);const o=Aa(r);e.items.push({kind:"user_image",id:Sn(e),imageUrl:a.image_url,...o!==void 0?{atMs:o}:{}});return}case"thinking":{la(e,r);const o=Aa(r),c=e.pendingThinking??e.openThinking;if(c){c.thinking=a.thinking,c.streaming=!1,a.stop_reason!==void 0&&(c.stopReason=a.stop_reason),Vf(c,o),c===e.openThinking&&(e.openThinking=null),e.pendingThinking=null;return}const d={kind:"thinking",id:Sn(e),thinking:a.thinking,streaming:!1};a.stop_reason!==void 0&&(d.stopReason=a.stop_reason),e.lastTsMs>0&&(d.startedAtMs=e.lastTsMs),Vf(d,o),e.items.push(d);return}case"tool_call":{la(e,r);const o=Aa(r),c=e.toolCards.get(a.tool_call_id),d=c?.callComplete?void 0:c;if(d){d.name=a.name,d.argumentsText=a.arguments,d.callStreaming=!1,d.callComplete=!0,a.stop_reason!==void 0&&(d.callStopReason=a.stop_reason),o!==void 0&&(d.callStartedAtMs=o),Yf(e,d),Rx(d);return}c&&!c.outputComplete&&(c.outputComplete=!0,c.outputStreaming=!1,c.outputStopReason??="aborted");const f=Gf(e,{toolCallId:a.tool_call_id,name:a.name,argumentsText:a.arguments,callStreaming:!1});f.callComplete=!0,a.stop_reason!==void 0&&(f.callStopReason=a.stop_reason),o!==void 0&&(f.callStartedAtMs=o),Yf(e,f),e.lastTsMs>0&&(f.argStartedAtMs=e.lastTsMs),Rx(f);return}case"tool_call_output":{la(e,r);let o=e.toolCards.get(a.tool_call_id);o||(o=Gf(e,{toolCallId:a.tool_call_id,name:"",argumentsText:"",callStreaming:!1})),o.output=a.output,a.images&&a.images.length>0&&(o.images=a.images),o.outputStreaming=!1,o.outputComplete=!0,a.stop_reason!==void 0&&(o.outputStopReason=a.stop_reason),J1(o,Aa(r));return}case"inline_data":case"inline_thinking":la(e,r);return}}function Z1(e){for(const a of e.toolCards.values())a.callComplete&&!a.outputComplete&&(a.outputComplete=!0,a.outputStreaming=!1,a.outputStopReason??="aborted")}function Rx(e){!e.callStopReason||e.callStopReason==="completed"||e.outputComplete||(e.outputComplete=!0,e.outputStreaming=!1,e.outputStopReason??=e.callStopReason)}function Vf(e,a){a===void 0||e.startedAtMs===void 0||(e.durationMs=Math.max(0,a-e.startedAtMs))}function J1(e,a){if(a===void 0)return;const r=e.approvalAtMs??e.callStartedAtMs;if(r===void 0)return;const i=e.argStartedAtMs!==void 0&&e.callStartedAtMs!==void 0?Math.max(0,e.callStartedAtMs-e.argStartedAtMs):0;e.durationMs=i+Math.max(0,a-r)}function Yf(e,a){if(a.approvalWaitCounted)return;const{callStartedAtMs:r,approvalAtMs:i}=a;if(r===void 0||i===void 0)return;a.approvalWaitCounted=!0;const o=i-r;o>0&&(e.openApprovalWaitMs+=o)}function Gf(e,a){const r={kind:"tool_call",id:Sn(e),toolCallId:a.toolCallId,name:a.name,argumentsText:a.argumentsText,callStreaming:a.callStreaming,callComplete:!1,output:"",outputStreaming:!1,outputComplete:!1},i=e.pendingDecisions.get(a.toolCallId);if(i!==void 0){r.decision=i,r.decisionSource=e.localDecisions.has(a.toolCallId)?"manual":"remote",e.pendingDecisions.delete(a.toolCallId);const o=e.pendingDecisionTs.get(a.toolCallId);o!==void 0&&(r.approvalAtMs=o,e.pendingDecisionTs.delete(a.toolCallId))}return e.toolCards.set(a.toolCallId,r),e.items.push(r),r}function k4(e,a,r){switch(a.type){case"approval_decision":{const i=e.toolCards.get(a.tool_call_id);i?(i.decision=a.decision,i.decisionSource=e.localDecisions.has(a.tool_call_id)?"manual":"remote",r!==void 0&&i.approvalAtMs===void 0&&(i.approvalAtMs=r),Yf(e,i)):(e.pendingDecisions.set(a.tool_call_id,a.decision),r!==void 0&&e.pendingDecisionTs.set(a.tool_call_id,r));return}case"abort":{Z1(e);const i=Kf(e);i&&(i.gaveUp=!0),e.reconnectRun=0;const o={kind:"abort",id:Sn(e)};a.reason!=null&&(o.reason=a.reason),e.items.push(o);return}case"token_usage":r4(e.stats,a);return;case"compaction_begin":{o4(e.stats),e.items.push({kind:"compaction",id:Sn(e),reason:a.reason,mode:a.mode,running:!0});return}case"compaction_end":{u4(e.stats,a.status);const i=w4(e);if(i)i.running=!1,i.status=a.status;else{const o={kind:"compaction",id:Sn(e),reason:a.reason,mode:a.mode,running:!1,status:a.status};e.items.push(o)}return}case"request_begin":{const i=Kf(e);i&&(i.retrying=!0),e.stats.compactionActive||(e.openRequestBeginMs=r??null,e.openApprovalWaitMs=0);return}case"request_end":{if(e.stats.compactionActive)return;e.openRequestBeginMs!==null&&r!==void 0&&i4(e.stats,r-e.openRequestBeginMs-e.openApprovalWaitMs),e.openRequestBeginMs=null,e.openApprovalWaitMs=0,r!==void 0&&(e.taskLastReqEndMs=r),l4(e.stats),a.status==="timeout"||a.status==="malformed"?(e.reconnectRun+=1,e.items.push({kind:"reconnect",id:Sn(e),status:a.status,attempt:e.reconnectRun,retrying:!1})):e.reconnectRun=0;return}}}function w4(e){for(let a=e.items.length-1;a>=0;a--){const r=e.items[a];if(r.kind==="compaction"&&r.running)return r}return null}function Kf(e){for(let a=e.items.length-1;a>=0;a--){const r=e.items[a];if(r.kind==="reconnect")return!r.retrying&&!r.gaveUp?r:null}return null}function S4(e,a,r){const i=a.origin[0];_m(a)&&a.payload.type==="token_usage"&&s4(e.stats,a.payload),la(e,a.timestamp);let o=e.subagents.get(i);o||(o=Q1(!0,e.localDecisions),e.subagents.set(i,o),j4(e,i,o));const c=a.origin.slice(1),d={...a};c.length>0?d.origin=c:delete d.origin,du(o,d,r)}function j4(e,a,r){for(let i=e.items.length-1;i>=0;i--){const o=e.items[i];if(o.kind==="tool_call"&&o.name==="run_subagent"&&!o.subagent&&!o.outputComplete&&o.decision==="allow"){o.subagent=r,o.subagentSessionId=a;return}}e.items.push({kind:"subagent",id:Sn(e),sessionId:a,model:r})}function N4(e,a=100){const r=new Set;for(let i=Math.max(0,e.length-a);i<e.length;i++)r.add(JSON.stringify(e[i]));return r}function C4(e,a){return e.has(JSON.stringify(a))}function ev(e,a){if(a.origin&&a.origin.length>0){const i=e.subagents.get(a.origin[0]);if(!i)return;const o=a.origin.slice(1),c={...a};o.length>0?c.origin=o:delete c.origin,ev(i,c);return}if(a.type!=="model_msg"||Rm(a.payload))return;const r=a.payload;switch(r.type){case"text":{if(r.role!=="assistant")return;const i=e.pendingText??e.openText;i&&(lf(e,i),i===e.openText&&(e.openText=null),e.pendingText=null);return}case"thinking":{const i=e.pendingThinking??e.openThinking;i&&(lf(e,i),i===e.openThinking&&(e.openThinking=null),e.pendingThinking=null);return}case"tool_call":{const i=e.toolCards.get(r.tool_call_id);i&&!i.callComplete&&(lf(e,i),e.toolCards.delete(r.tool_call_id));return}case"tool_call_output":{const i=e.toolCards.get(r.tool_call_id);i&&!i.outputComplete&&(i.output="",i.outputStreaming=!1);return}default:return}}function lf(e,a){const r=e.items.indexOf(a);r>=0&&e.items.splice(r,1)}function fr({title:e,description:a,action:r}){return s.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 py-12 text-center",children:[s.jsx("p",{className:"text-sm font-medium text-gray-600 dark:text-gray-300",children:e}),a&&s.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-500",children:a}),r&&s.jsx("div",{className:"mt-2",children:r})]})}const E4={success:2500,error:6e3};let Ra=[],T4=1;const Wf=new Set;function Xf(){for(const e of Wf)e(Ra)}const M4=160;function tv(e){const a=Ra.find(r=>r.id===e);!a||a.leaving||(Ra=Ra.map(r=>r.id===e?{...r,leaving:!0}:r),Xf(),setTimeout(()=>{Ra=Ra.filter(r=>r.id!==e),Xf()},M4))}function nv(e,a){if(!a)return;const r=T4++;Ra=[...Ra,{id:r,kind:e,text:a}],Xf(),setTimeout(()=>tv(r),E4[e])}const fu=e=>nv("success",e),Xn=e=>nv("error",e),A4={success:"border-emerald-200 bg-emerald-50 text-emerald-800 dark:border-emerald-900 dark:bg-emerald-950 dark:text-emerald-200",error:"border-red-200 bg-red-50 text-red-800 dark:border-red-900 dark:bg-red-950 dark:text-red-200"};function R4(){const[e,a]=k.useState(Ra);return k.useEffect(()=>(Wf.add(a),()=>{Wf.delete(a)}),[]),e.length===0?null:hs.createPortal(s.jsx("div",{className:"pointer-events-none fixed inset-x-0 top-3 z-[100] flex flex-col items-center gap-2 px-4",children:e.map(r=>s.jsx("button",{type:"button",onClick:()=>tv(r.id),className:`pointer-events-auto max-w-lg break-words rounded-md border px-3 py-2 text-left text-sm shadow-lg ${r.leaving?"anim-toast-out":"anim-toast-in"} ${A4[r.kind]}`,children:r.text},r.id))}),document.body)}function _4(e,a){const r=a||{};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const z4=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,D4=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,L4={};function _x(e,a){return(L4.jsx?D4:z4).test(e)}const O4=/[ \t\n\f\r]/g;function I4(e){return typeof e=="object"?e.type==="text"?zx(e.value):!1:zx(e)}function zx(e){return e.replace(O4,"")===""}class ps{constructor(a,r,i){this.normal=r,this.property=a,i&&(this.space=i)}}ps.prototype.normal={};ps.prototype.property={};ps.prototype.space=void 0;function av(e,a){const r={},i={};for(const o of e)Object.assign(r,o.property),Object.assign(i,o.normal);return new ps(r,i,a)}function Qf(e){return e.toLowerCase()}class dn{constructor(a,r){this.attribute=r,this.property=a}}dn.prototype.attribute="";dn.prototype.booleanish=!1;dn.prototype.boolean=!1;dn.prototype.commaOrSpaceSeparated=!1;dn.prototype.commaSeparated=!1;dn.prototype.defined=!1;dn.prototype.mustUseProperty=!1;dn.prototype.number=!1;dn.prototype.overloadedBoolean=!1;dn.prototype.property="";dn.prototype.spaceSeparated=!1;dn.prototype.space=void 0;let U4=0;const _e=Xr(),Ct=Xr(),Zf=Xr(),me=Xr(),rt=Xr(),Br=Xr(),wn=Xr();function Xr(){return 2**++U4}const Jf=Object.freeze(Object.defineProperty({__proto__:null,boolean:_e,booleanish:Ct,commaOrSpaceSeparated:wn,commaSeparated:Br,number:me,overloadedBoolean:Zf,spaceSeparated:rt},Symbol.toStringTag,{value:"Module"})),sf=Object.keys(Jf);class Lm extends dn{constructor(a,r,i,o){let c=-1;if(super(a,r),Dx(this,"space",o),typeof i=="number")for(;++c<sf.length;){const d=sf[c];Dx(this,sf[c],(i&Jf[d])===Jf[d])}}}Lm.prototype.defined=!0;function Dx(e,a,r){r&&(e[a]=r)}function Fl(e){const a={},r={};for(const[i,o]of Object.entries(e.properties)){const c=new Lm(i,e.transform(e.attributes||{},i),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(i)&&(c.mustUseProperty=!0),a[i]=c,r[Qf(i)]=i,r[Qf(c.attribute)]=i}return new ps(a,r,e.space)}const rv=Fl({properties:{ariaActiveDescendant:null,ariaAtomic:Ct,ariaAutoComplete:null,ariaBusy:Ct,ariaChecked:Ct,ariaColCount:me,ariaColIndex:me,ariaColSpan:me,ariaControls:rt,ariaCurrent:null,ariaDescribedBy:rt,ariaDetails:null,ariaDisabled:Ct,ariaDropEffect:rt,ariaErrorMessage:null,ariaExpanded:Ct,ariaFlowTo:rt,ariaGrabbed:Ct,ariaHasPopup:null,ariaHidden:Ct,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:rt,ariaLevel:me,ariaLive:null,ariaModal:Ct,ariaMultiLine:Ct,ariaMultiSelectable:Ct,ariaOrientation:null,ariaOwns:rt,ariaPlaceholder:null,ariaPosInSet:me,ariaPressed:Ct,ariaReadOnly:Ct,ariaRelevant:null,ariaRequired:Ct,ariaRoleDescription:rt,ariaRowCount:me,ariaRowIndex:me,ariaRowSpan:me,ariaSelected:Ct,ariaSetSize:me,ariaSort:null,ariaValueMax:me,ariaValueMin:me,ariaValueNow:me,ariaValueText:null,role:null},transform(e,a){return a==="role"?a:"aria-"+a.slice(4).toLowerCase()}});function lv(e,a){return a in e?e[a]:a}function iv(e,a){return lv(e,a.toLowerCase())}const $4=Fl({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Br,acceptCharset:rt,accessKey:rt,action:null,allow:null,allowFullScreen:_e,allowPaymentRequest:_e,allowUserMedia:_e,alpha:_e,alt:null,as:null,async:_e,autoCapitalize:null,autoComplete:rt,autoFocus:_e,autoPlay:_e,blocking:rt,capture:null,charSet:null,checked:_e,cite:null,className:rt,closedBy:null,colorSpace:null,cols:me,colSpan:me,command:null,commandFor:null,content:null,contentEditable:Ct,controls:_e,controlsList:rt,coords:me|Br,crossOrigin:null,data:null,dateTime:null,decoding:null,default:_e,defer:_e,dir:null,dirName:null,disabled:_e,download:Zf,draggable:Ct,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:_e,formTarget:null,headers:rt,height:me,hidden:Zf,high:me,href:null,hrefLang:null,htmlFor:rt,httpEquiv:rt,id:null,imageSizes:null,imageSrcSet:null,inert:_e,inputMode:null,integrity:null,is:null,isMap:_e,itemId:null,itemProp:rt,itemRef:rt,itemScope:_e,itemType:rt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:_e,low:me,manifest:null,max:null,maxLength:me,media:null,method:null,min:null,minLength:me,multiple:_e,muted:_e,name:null,nonce:null,noModule:_e,noValidate:_e,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:_e,optimum:me,pattern:null,ping:rt,placeholder:null,playsInline:_e,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:_e,referrerPolicy:null,rel:rt,required:_e,reversed:_e,rows:me,rowSpan:me,sandbox:rt,scope:null,scoped:_e,seamless:_e,selected:_e,shadowRootClonable:_e,shadowRootCustomElementRegistry:_e,shadowRootDelegatesFocus:_e,shadowRootMode:null,shadowRootSerializable:_e,shape:null,size:me,sizes:null,slot:null,span:me,spellCheck:Ct,src:null,srcDoc:null,srcLang:null,srcSet:null,start:me,step:null,style:null,tabIndex:me,target:null,title:null,translate:null,type:null,typeMustMatch:_e,useMap:null,value:Ct,width:me,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:rt,axis:null,background:null,bgColor:null,border:me,borderColor:null,bottomMargin:me,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:_e,declare:_e,event:null,face:null,frame:null,frameBorder:null,hSpace:me,leftMargin:me,link:null,longDesc:null,lowSrc:null,marginHeight:me,marginWidth:me,noResize:_e,noHref:_e,noShade:_e,noWrap:_e,object:null,profile:null,prompt:null,rev:null,rightMargin:me,rules:null,scheme:null,scrolling:Ct,standby:null,summary:null,text:null,topMargin:me,valueType:null,version:null,vAlign:null,vLink:null,vSpace:me,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:_e,disablePictureInPicture:_e,disableRemotePlayback:_e,exportParts:Br,part:rt,prefix:null,property:null,results:me,security:null,unselectable:null},space:"html",transform:iv}),B4=Fl({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:wn,accentHeight:me,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:me,amplitude:me,arabicForm:null,ascent:me,attributeName:null,attributeType:null,azimuth:me,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:me,by:null,calcMode:null,capHeight:me,className:rt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:me,diffuseConstant:me,direction:null,display:null,dur:null,divisor:me,dominantBaseline:null,download:_e,dx:null,dy:null,edgeMode:null,editable:null,elevation:me,enableBackground:null,end:null,event:null,exponent:me,externalResourcesRequired:null,fill:null,fillOpacity:me,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Br,g2:Br,glyphName:Br,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:me,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:me,horizOriginX:me,horizOriginY:me,id:null,ideographic:me,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:me,k:me,k1:me,k2:me,k3:me,k4:me,kernelMatrix:wn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:me,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:me,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:me,overlineThickness:me,paintOrder:null,panose1:null,path:null,pathLength:me,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:rt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:me,pointsAtY:me,pointsAtZ:me,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:wn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:wn,rev:wn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:wn,requiredFeatures:wn,requiredFonts:wn,requiredFormats:wn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:me,specularExponent:me,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:me,strikethroughThickness:me,string:null,stroke:null,strokeDashArray:wn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:me,strokeOpacity:me,strokeWidth:null,style:null,surfaceScale:me,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:wn,tabIndex:me,tableValues:null,target:null,targetX:me,targetY:me,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:wn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:me,underlineThickness:me,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:me,values:null,vAlphabetic:me,vMathematical:me,vectorEffect:null,vHanging:me,vIdeographic:me,version:null,vertAdvY:me,vertOriginX:me,vertOriginY:me,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:me,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:lv}),sv=Fl({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,a){return"xlink:"+a.slice(5).toLowerCase()}}),ov=Fl({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:iv}),uv=Fl({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,a){return"xml:"+a.slice(3).toLowerCase()}}),H4={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},P4=/[A-Z]/g,Lx=/-[a-z]/g,q4=/^data[-\w.:]+$/i;function F4(e,a){const r=Qf(a);let i=a,o=dn;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&q4.test(a)){if(a.charAt(4)==="-"){const c=a.slice(5).replace(Lx,Y4);i="data"+c.charAt(0).toUpperCase()+c.slice(1)}else{const c=a.slice(4);if(!Lx.test(c)){let d=c.replace(P4,V4);d.charAt(0)!=="-"&&(d="-"+d),a="data"+d}}o=Lm}return new o(i,a)}function V4(e){return"-"+e.toLowerCase()}function Y4(e){return e.charAt(1).toUpperCase()}const G4=av([rv,$4,sv,ov,uv],"html"),Om=av([rv,B4,sv,ov,uv],"svg");function K4(e){return e.join(" ").trim()}var Ll={},of,Ox;function W4(){if(Ox)return of;Ox=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,a=/\n/g,r=/^\s*/,i=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,c=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,d=/^[;\s]*/,f=/^\s+|\s+$/g,h=`
|
|
14
|
+
`,m="/",g="*",y="",b="comment",w="declaration";function N(j,T){if(typeof j!="string")throw new TypeError("First argument must be a string");if(!j)return[];T=T||{};var I=1,M=1;function _(te){var F=te.match(a);F&&(I+=F.length);var L=te.lastIndexOf(h);M=~L?te.length-L:M+te.length}function $(){var te={line:I,column:M};return function(F){return F.position=new U(te),J(),F}}function U(te){this.start=te,this.end={line:I,column:M},this.source=T.source}U.prototype.content=j;function Y(te){var F=new Error(T.source+":"+I+":"+M+": "+te);if(F.reason=te,F.filename=T.source,F.line=I,F.column=M,F.source=j,!T.silent)throw F}function W(te){var F=te.exec(j);if(F){var L=F[0];return _(L),j=j.slice(L.length),F}}function J(){W(r)}function P(te){var F;for(te=te||[];F=K();)F!==!1&&te.push(F);return te}function K(){var te=$();if(!(m!=j.charAt(0)||g!=j.charAt(1))){for(var F=2;y!=j.charAt(F)&&(g!=j.charAt(F)||m!=j.charAt(F+1));)++F;if(F+=2,y===j.charAt(F-1))return Y("End of comment missing");var L=j.slice(2,F-2);return M+=2,_(L),j=j.slice(F),M+=2,te({type:b,comment:L})}}function D(){var te=$(),F=W(i);if(F){if(K(),!W(o))return Y("property missing ':'");var L=W(c),ae=te({type:w,property:A(F[0].replace(e,y)),value:L?A(L[0].replace(e,y)):y});return W(d),ae}}function O(){var te=[];P(te);for(var F;F=D();)F!==!1&&(te.push(F),P(te));return te}return J(),O()}function A(j){return j?j.replace(f,y):y}return of=N,of}var Ix;function X4(){if(Ix)return Ll;Ix=1;var e=Ll&&Ll.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Ll,"__esModule",{value:!0}),Ll.default=r;const a=e(W4());function r(i,o){let c=null;if(!i||typeof i!="string")return c;const d=(0,a.default)(i),f=typeof o=="function";return d.forEach(h=>{if(h.type!=="declaration")return;const{property:m,value:g}=h;f?o(m,g,h):g&&(c=c||{},c[m]=g)}),c}return Ll}var Hi={},Ux;function Q4(){if(Ux)return Hi;Ux=1,Object.defineProperty(Hi,"__esModule",{value:!0}),Hi.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,a=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,c=function(m){return!m||r.test(m)||e.test(m)},d=function(m,g){return g.toUpperCase()},f=function(m,g){return"".concat(g,"-")},h=function(m,g){return g===void 0&&(g={}),c(m)?m:(m=m.toLowerCase(),g.reactCompat?m=m.replace(o,f):m=m.replace(i,f),m.replace(a,d))};return Hi.camelCase=h,Hi}var Pi,$x;function Z4(){if($x)return Pi;$x=1;var e=Pi&&Pi.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},a=e(X4()),r=Q4();function i(o,c){var d={};return!o||typeof o!="string"||(0,a.default)(o,function(f,h){f&&h&&(d[(0,r.camelCase)(f,c)]=h)}),d}return i.default=i,Pi=i,Pi}var J4=Z4();const eN=s1(J4),cv=dv("end"),Im=dv("start");function dv(e){return a;function a(r){const i=r&&r.position&&r.position[e]||{};if(typeof i.line=="number"&&i.line>0&&typeof i.column=="number"&&i.column>0)return{line:i.line,column:i.column,offset:typeof i.offset=="number"&&i.offset>-1?i.offset:void 0}}}function tN(e){const a=Im(e),r=cv(e);if(a&&r)return{start:a,end:r}}function es(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Bx(e.position):"start"in e||"end"in e?Bx(e):"line"in e||"column"in e?em(e):""}function em(e){return Hx(e&&e.line)+":"+Hx(e&&e.column)}function Bx(e){return em(e&&e.start)+"-"+em(e&&e.end)}function Hx(e){return e&&typeof e=="number"?e:1}class Gt extends Error{constructor(a,r,i){super(),typeof r=="string"&&(i=r,r=void 0);let o="",c={},d=!1;if(r&&("line"in r&&"column"in r?c={place:r}:"start"in r&&"end"in r?c={place:r}:"type"in r?c={ancestors:[r],place:r.position}:c={...r}),typeof a=="string"?o=a:!c.cause&&a&&(d=!0,o=a.message,c.cause=a),!c.ruleId&&!c.source&&typeof i=="string"){const h=i.indexOf(":");h===-1?c.ruleId=i:(c.source=i.slice(0,h),c.ruleId=i.slice(h+1))}if(!c.place&&c.ancestors&&c.ancestors){const h=c.ancestors[c.ancestors.length-1];h&&(c.place=h.position)}const f=c.place&&"start"in c.place?c.place.start:c.place;this.ancestors=c.ancestors||void 0,this.cause=c.cause||void 0,this.column=f?f.column:void 0,this.fatal=void 0,this.file="",this.message=o,this.line=f?f.line:void 0,this.name=es(c.place)||"1:1",this.place=c.place||void 0,this.reason=this.message,this.ruleId=c.ruleId||void 0,this.source=c.source||void 0,this.stack=d&&c.cause&&typeof c.cause.stack=="string"?c.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Gt.prototype.file="";Gt.prototype.name="";Gt.prototype.reason="";Gt.prototype.message="";Gt.prototype.stack="";Gt.prototype.column=void 0;Gt.prototype.line=void 0;Gt.prototype.ancestors=void 0;Gt.prototype.cause=void 0;Gt.prototype.fatal=void 0;Gt.prototype.place=void 0;Gt.prototype.ruleId=void 0;Gt.prototype.source=void 0;const Um={}.hasOwnProperty,nN=new Map,aN=/[A-Z]/g,rN=new Set(["table","tbody","thead","tfoot","tr"]),lN=new Set(["td","th"]),fv="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function iN(e,a){if(!a||a.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=a.filePath||void 0;let i;if(a.development){if(typeof a.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");i=hN(r,a.jsxDEV)}else{if(typeof a.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof a.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");i=mN(r,a.jsx,a.jsxs)}const o={Fragment:a.Fragment,ancestors:[],components:a.components||{},create:i,elementAttributeNameCase:a.elementAttributeNameCase||"react",evaluater:a.createEvaluater?a.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:a.ignoreInvalidStyle||!1,passKeys:a.passKeys!==!1,passNode:a.passNode||!1,schema:a.space==="svg"?Om:G4,stylePropertyNameCase:a.stylePropertyNameCase||"dom",tableCellAlignToStyle:a.tableCellAlignToStyle!==!1},c=mv(o,e,void 0);return c&&typeof c!="string"?c:o.create(e,o.Fragment,{children:c||void 0},void 0)}function mv(e,a,r){if(a.type==="element")return sN(e,a,r);if(a.type==="mdxFlowExpression"||a.type==="mdxTextExpression")return oN(e,a);if(a.type==="mdxJsxFlowElement"||a.type==="mdxJsxTextElement")return cN(e,a,r);if(a.type==="mdxjsEsm")return uN(e,a);if(a.type==="root")return dN(e,a,r);if(a.type==="text")return fN(e,a)}function sN(e,a,r){const i=e.schema;let o=i;a.tagName.toLowerCase()==="svg"&&i.space==="html"&&(o=Om,e.schema=o),e.ancestors.push(a);const c=pv(e,a.tagName,!1),d=pN(e,a);let f=Bm(e,a);return rN.has(a.tagName)&&(f=f.filter(function(h){return typeof h=="string"?!I4(h):!0})),hv(e,d,c,a),$m(d,f),e.ancestors.pop(),e.schema=i,e.create(a,c,d,r)}function oN(e,a){if(a.data&&a.data.estree&&e.evaluater){const i=a.data.estree.body[0];return i.type,e.evaluater.evaluateExpression(i.expression)}os(e,a.position)}function uN(e,a){if(a.data&&a.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(a.data.estree);os(e,a.position)}function cN(e,a,r){const i=e.schema;let o=i;a.name==="svg"&&i.space==="html"&&(o=Om,e.schema=o),e.ancestors.push(a);const c=a.name===null?e.Fragment:pv(e,a.name,!0),d=gN(e,a),f=Bm(e,a);return hv(e,d,c,a),$m(d,f),e.ancestors.pop(),e.schema=i,e.create(a,c,d,r)}function dN(e,a,r){const i={};return $m(i,Bm(e,a)),e.create(a,e.Fragment,i,r)}function fN(e,a){return a.value}function hv(e,a,r,i){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(a.node=i)}function $m(e,a){if(a.length>0){const r=a.length>1?a:a[0];r&&(e.children=r)}}function mN(e,a,r){return i;function i(o,c,d,f){const m=Array.isArray(d.children)?r:a;return f?m(c,d,f):m(c,d)}}function hN(e,a){return r;function r(i,o,c,d){const f=Array.isArray(c.children),h=Im(i);return a(o,c,d,f,{columnNumber:h?h.column-1:void 0,fileName:e,lineNumber:h?h.line:void 0},void 0)}}function pN(e,a){const r={};let i,o;for(o in a.properties)if(o!=="children"&&Um.call(a.properties,o)){const c=xN(e,o,a.properties[o]);if(c){const[d,f]=c;e.tableCellAlignToStyle&&d==="align"&&typeof f=="string"&&lN.has(a.tagName)?i=f:r[d]=f}}if(i){const c=r.style||(r.style={});c[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return r}function gN(e,a){const r={};for(const i of a.attributes)if(i.type==="mdxJsxExpressionAttribute")if(i.data&&i.data.estree&&e.evaluater){const c=i.data.estree.body[0];c.type;const d=c.expression;d.type;const f=d.properties[0];f.type,Object.assign(r,e.evaluater.evaluateExpression(f.argument))}else os(e,a.position);else{const o=i.name;let c;if(i.value&&typeof i.value=="object")if(i.value.data&&i.value.data.estree&&e.evaluater){const f=i.value.data.estree.body[0];f.type,c=e.evaluater.evaluateExpression(f.expression)}else os(e,a.position);else c=i.value===null?!0:i.value;r[o]=c}return r}function Bm(e,a){const r=[];let i=-1;const o=e.passKeys?new Map:nN;for(;++i<a.children.length;){const c=a.children[i];let d;if(e.passKeys){const h=c.type==="element"?c.tagName:c.type==="mdxJsxFlowElement"||c.type==="mdxJsxTextElement"?c.name:void 0;if(h){const m=o.get(h)||0;d=h+"-"+m,o.set(h,m+1)}}const f=mv(e,c,d);f!==void 0&&r.push(f)}return r}function xN(e,a,r){const i=F4(e.schema,a);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=i.commaSeparated?_4(r):K4(r)),i.property==="style"){let o=typeof r=="object"?r:yN(e,String(r));return e.stylePropertyNameCase==="css"&&(o=vN(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&i.space?H4[i.property]||i.property:i.attribute,r]}}function yN(e,a){try{return eN(a,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const i=r,o=new Gt("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:i,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw o.file=e.filePath||void 0,o.url=fv+"#cannot-parse-style-attribute",o}}function pv(e,a,r){let i;if(!r)i={type:"Literal",value:a};else if(a.includes(".")){const o=a.split(".");let c=-1,d;for(;++c<o.length;){const f=_x(o[c])?{type:"Identifier",name:o[c]}:{type:"Literal",value:o[c]};d=d?{type:"MemberExpression",object:d,property:f,computed:!!(c&&f.type==="Literal"),optional:!1}:f}i=d}else i=_x(a)&&!/^[a-z]/.test(a)?{type:"Identifier",name:a}:{type:"Literal",value:a};if(i.type==="Literal"){const o=i.value;return Um.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(i);os(e)}function os(e,a){const r=new Gt("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:a,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=fv+"#cannot-handle-mdx-estrees-without-createevaluater",r}function vN(e){const a={};let r;for(r in e)Um.call(e,r)&&(a[bN(r)]=e[r]);return a}function bN(e){let a=e.replace(aN,kN);return a.slice(0,3)==="ms-"&&(a="-"+a),a}function kN(e){return"-"+e.toLowerCase()}const uf={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},wN={};function Hm(e,a){const r=wN,i=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,o=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return gv(e,i,o)}function gv(e,a,r){if(SN(e)){if("value"in e)return e.type==="html"&&!r?"":e.value;if(a&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Px(e.children,a,r)}return Array.isArray(e)?Px(e,a,r):""}function Px(e,a,r){const i=[];let o=-1;for(;++o<e.length;)i[o]=gv(e[o],a,r);return i.join("")}function SN(e){return!!(e&&typeof e=="object")}const qx=document.createElement("i");function Pm(e){const a="&"+e+";";qx.innerHTML=a;const r=qx.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===a?!1:r}function jn(e,a,r,i){const o=e.length;let c=0,d;if(a<0?a=-a>o?0:o+a:a=a>o?o:a,r=r>0?r:0,i.length<1e4)d=Array.from(i),d.unshift(a,r),e.splice(...d);else for(r&&e.splice(a,r);c<i.length;)d=i.slice(c,c+1e4),d.unshift(a,0),e.splice(...d),c+=1e4,a+=1e4}function Bn(e,a){return e.length>0?(jn(e,e.length,0,a),e):a}const Fx={}.hasOwnProperty;function xv(e){const a={};let r=-1;for(;++r<e.length;)jN(a,e[r]);return a}function jN(e,a){let r;for(r in a){const o=(Fx.call(e,r)?e[r]:void 0)||(e[r]={}),c=a[r];let d;if(c)for(d in c){Fx.call(o,d)||(o[d]=[]);const f=c[d];NN(o[d],Array.isArray(f)?f:f?[f]:[])}}}function NN(e,a){let r=-1;const i=[];for(;++r<a.length;)(a[r].add==="after"?e:i).push(a[r]);jn(e,0,0,i)}function yv(e,a){const r=Number.parseInt(e,a);return r<9||r===11||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function Zn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Qt=hr(/[A-Za-z]/),Vt=hr(/[\dA-Za-z]/),CN=hr(/[#-'*+\--9=?A-Z^-~]/);function mu(e){return e!==null&&(e<32||e===127)}const tm=hr(/\d/),EN=hr(/[\dA-Fa-f]/),TN=hr(/[!-/:-@[-`{-~]/);function Ee(e){return e!==null&&e<-2}function lt(e){return e!==null&&(e<0||e===32)}function Be(e){return e===-2||e===-1||e===32}const Tu=hr(new RegExp("\\p{P}|\\p{S}","u")),Yr=hr(/\s/);function hr(e){return a;function a(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function Vl(e){const a=[];let r=-1,i=0,o=0;for(;++r<e.length;){const c=e.charCodeAt(r);let d="";if(c===37&&Vt(e.charCodeAt(r+1))&&Vt(e.charCodeAt(r+2)))o=2;else if(c<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(c))||(d=String.fromCharCode(c));else if(c>55295&&c<57344){const f=e.charCodeAt(r+1);c<56320&&f>56319&&f<57344?(d=String.fromCharCode(c,f),o=1):d="�"}else d=String.fromCharCode(c);d&&(a.push(e.slice(i,r),encodeURIComponent(d)),i=r+o+1,d=""),o&&(r+=o,o=0)}return a.join("")+e.slice(i)}function Ve(e,a,r,i){const o=i?i-1:Number.POSITIVE_INFINITY;let c=0;return d;function d(h){return Be(h)?(e.enter(r),f(h)):a(h)}function f(h){return Be(h)&&c++<o?(e.consume(h),f):(e.exit(r),a(h))}}const MN={tokenize:AN};function AN(e){const a=e.attempt(this.parser.constructs.contentInitial,i,o);let r;return a;function i(f){if(f===null){e.consume(f);return}return e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),Ve(e,a,"linePrefix")}function o(f){return e.enter("paragraph"),c(f)}function c(f){const h=e.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=h),r=h,d(f)}function d(f){if(f===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(f);return}return Ee(f)?(e.consume(f),e.exit("chunkText"),c):(e.consume(f),d)}}const RN={tokenize:_N},Vx={tokenize:zN};function _N(e){const a=this,r=[];let i=0,o,c,d;return f;function f(M){if(i<r.length){const _=r[i];return a.containerState=_[1],e.attempt(_[0].continuation,h,m)(M)}return m(M)}function h(M){if(i++,a.containerState._closeFlow){a.containerState._closeFlow=void 0,o&&I();const _=a.events.length;let $=_,U;for(;$--;)if(a.events[$][0]==="exit"&&a.events[$][1].type==="chunkFlow"){U=a.events[$][1].end;break}T(i);let Y=_;for(;Y<a.events.length;)a.events[Y][1].end={...U},Y++;return jn(a.events,$+1,0,a.events.slice(_)),a.events.length=Y,m(M)}return f(M)}function m(M){if(i===r.length){if(!o)return b(M);if(o.currentConstruct&&o.currentConstruct.concrete)return N(M);a.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return a.containerState={},e.check(Vx,g,y)(M)}function g(M){return o&&I(),T(i),b(M)}function y(M){return a.parser.lazy[a.now().line]=i!==r.length,d=a.now().offset,N(M)}function b(M){return a.containerState={},e.attempt(Vx,w,N)(M)}function w(M){return i++,r.push([a.currentConstruct,a.containerState]),b(M)}function N(M){if(M===null){o&&I(),T(0),e.consume(M);return}return o=o||a.parser.flow(a.now()),e.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:c}),A(M)}function A(M){if(M===null){j(e.exit("chunkFlow"),!0),T(0),e.consume(M);return}return Ee(M)?(e.consume(M),j(e.exit("chunkFlow")),i=0,a.interrupt=void 0,f):(e.consume(M),A)}function j(M,_){const $=a.sliceStream(M);if(_&&$.push(null),M.previous=c,c&&(c.next=M),c=M,o.defineSkip(M.start),o.write($),a.parser.lazy[M.start.line]){let U=o.events.length;for(;U--;)if(o.events[U][1].start.offset<d&&(!o.events[U][1].end||o.events[U][1].end.offset>d))return;const Y=a.events.length;let W=Y,J,P;for(;W--;)if(a.events[W][0]==="exit"&&a.events[W][1].type==="chunkFlow"){if(J){P=a.events[W][1].end;break}J=!0}for(T(i),U=Y;U<a.events.length;)a.events[U][1].end={...P},U++;jn(a.events,W+1,0,a.events.slice(Y)),a.events.length=U}}function T(M){let _=r.length;for(;_-- >M;){const $=r[_];a.containerState=$[1],$[0].exit.call(a,e)}r.length=M}function I(){o.write([null]),c=void 0,o=void 0,a.containerState._closeFlow=void 0}}function zN(e,a,r){return Ve(e,e.attempt(this.parser.constructs.document,a,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Hl(e){if(e===null||lt(e)||Yr(e))return 1;if(Tu(e))return 2}function Mu(e,a,r){const i=[];let o=-1;for(;++o<e.length;){const c=e[o].resolveAll;c&&!i.includes(c)&&(a=c(a,r),i.push(c))}return a}const nm={name:"attention",resolveAll:DN,tokenize:LN};function DN(e,a){let r=-1,i,o,c,d,f,h,m,g;for(;++r<e.length;)if(e[r][0]==="enter"&&e[r][1].type==="attentionSequence"&&e[r][1]._close){for(i=r;i--;)if(e[i][0]==="exit"&&e[i][1].type==="attentionSequence"&&e[i][1]._open&&a.sliceSerialize(e[i][1]).charCodeAt(0)===a.sliceSerialize(e[r][1]).charCodeAt(0)){if((e[i][1]._close||e[r][1]._open)&&(e[r][1].end.offset-e[r][1].start.offset)%3&&!((e[i][1].end.offset-e[i][1].start.offset+e[r][1].end.offset-e[r][1].start.offset)%3))continue;h=e[i][1].end.offset-e[i][1].start.offset>1&&e[r][1].end.offset-e[r][1].start.offset>1?2:1;const y={...e[i][1].end},b={...e[r][1].start};Yx(y,-h),Yx(b,h),d={type:h>1?"strongSequence":"emphasisSequence",start:y,end:{...e[i][1].end}},f={type:h>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:b},c={type:h>1?"strongText":"emphasisText",start:{...e[i][1].end},end:{...e[r][1].start}},o={type:h>1?"strong":"emphasis",start:{...d.start},end:{...f.end}},e[i][1].end={...d.start},e[r][1].start={...f.end},m=[],e[i][1].end.offset-e[i][1].start.offset&&(m=Bn(m,[["enter",e[i][1],a],["exit",e[i][1],a]])),m=Bn(m,[["enter",o,a],["enter",d,a],["exit",d,a],["enter",c,a]]),m=Bn(m,Mu(a.parser.constructs.insideSpan.null,e.slice(i+1,r),a)),m=Bn(m,[["exit",c,a],["enter",f,a],["exit",f,a],["exit",o,a]]),e[r][1].end.offset-e[r][1].start.offset?(g=2,m=Bn(m,[["enter",e[r][1],a],["exit",e[r][1],a]])):g=0,jn(e,i-1,r-i+3,m),r=i+m.length-g-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="attentionSequence"&&(e[r][1].type="data");return e}function LN(e,a){const r=this.parser.constructs.attentionMarkers.null,i=this.previous,o=Hl(i);let c;return d;function d(h){return c=h,e.enter("attentionSequence"),f(h)}function f(h){if(h===c)return e.consume(h),f;const m=e.exit("attentionSequence"),g=Hl(h),y=!g||g===2&&o||r.includes(h),b=!o||o===2&&g||r.includes(i);return m._open=!!(c===42?y:y&&(o||!b)),m._close=!!(c===42?b:b&&(g||!y)),a(h)}}function Yx(e,a){e.column+=a,e.offset+=a,e._bufferIndex+=a}const ON={name:"autolink",tokenize:IN};function IN(e,a,r){let i=0;return o;function o(w){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),c}function c(w){return Qt(w)?(e.consume(w),d):w===64?r(w):m(w)}function d(w){return w===43||w===45||w===46||Vt(w)?(i=1,f(w)):m(w)}function f(w){return w===58?(e.consume(w),i=0,h):(w===43||w===45||w===46||Vt(w))&&i++<32?(e.consume(w),f):(i=0,m(w))}function h(w){return w===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.exit("autolink"),a):w===null||w===32||w===60||mu(w)?r(w):(e.consume(w),h)}function m(w){return w===64?(e.consume(w),g):CN(w)?(e.consume(w),m):r(w)}function g(w){return Vt(w)?y(w):r(w)}function y(w){return w===46?(e.consume(w),i=0,g):w===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.exit("autolink"),a):b(w)}function b(w){if((w===45||Vt(w))&&i++<63){const N=w===45?b:y;return e.consume(w),N}return r(w)}}const gs={partial:!0,tokenize:UN};function UN(e,a,r){return i;function i(c){return Be(c)?Ve(e,o,"linePrefix")(c):o(c)}function o(c){return c===null||Ee(c)?a(c):r(c)}}const vv={continuation:{tokenize:BN},exit:HN,name:"blockQuote",tokenize:$N};function $N(e,a,r){const i=this;return o;function o(d){if(d===62){const f=i.containerState;return f.open||(e.enter("blockQuote",{_container:!0}),f.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(d),e.exit("blockQuoteMarker"),c}return r(d)}function c(d){return Be(d)?(e.enter("blockQuotePrefixWhitespace"),e.consume(d),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),a):(e.exit("blockQuotePrefix"),a(d))}}function BN(e,a,r){const i=this;return o;function o(d){return Be(d)?Ve(e,c,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d):c(d)}function c(d){return e.attempt(vv,a,r)(d)}}function HN(e){e.exit("blockQuote")}const bv={name:"characterEscape",tokenize:PN};function PN(e,a,r){return i;function i(c){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(c),e.exit("escapeMarker"),o}function o(c){return TN(c)?(e.enter("characterEscapeValue"),e.consume(c),e.exit("characterEscapeValue"),e.exit("characterEscape"),a):r(c)}}const kv={name:"characterReference",tokenize:qN};function qN(e,a,r){const i=this;let o=0,c,d;return f;function f(y){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(y),e.exit("characterReferenceMarker"),h}function h(y){return y===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(y),e.exit("characterReferenceMarkerNumeric"),m):(e.enter("characterReferenceValue"),c=31,d=Vt,g(y))}function m(y){return y===88||y===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(y),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),c=6,d=EN,g):(e.enter("characterReferenceValue"),c=7,d=tm,g(y))}function g(y){if(y===59&&o){const b=e.exit("characterReferenceValue");return d===Vt&&!Pm(i.sliceSerialize(b))?r(y):(e.enter("characterReferenceMarker"),e.consume(y),e.exit("characterReferenceMarker"),e.exit("characterReference"),a)}return d(y)&&o++<c?(e.consume(y),g):r(y)}}const Gx={partial:!0,tokenize:VN},Kx={concrete:!0,name:"codeFenced",tokenize:FN};function FN(e,a,r){const i=this,o={partial:!0,tokenize:$};let c=0,d=0,f;return h;function h(U){return m(U)}function m(U){const Y=i.events[i.events.length-1];return c=Y&&Y[1].type==="linePrefix"?Y[2].sliceSerialize(Y[1],!0).length:0,f=U,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),g(U)}function g(U){return U===f?(d++,e.consume(U),g):d<3?r(U):(e.exit("codeFencedFenceSequence"),Be(U)?Ve(e,y,"whitespace")(U):y(U))}function y(U){return U===null||Ee(U)?(e.exit("codeFencedFence"),i.interrupt?a(U):e.check(Gx,A,_)(U)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),b(U))}function b(U){return U===null||Ee(U)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),y(U)):Be(U)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ve(e,w,"whitespace")(U)):U===96&&U===f?r(U):(e.consume(U),b)}function w(U){return U===null||Ee(U)?y(U):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),N(U))}function N(U){return U===null||Ee(U)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),y(U)):U===96&&U===f?r(U):(e.consume(U),N)}function A(U){return e.attempt(o,_,j)(U)}function j(U){return e.enter("lineEnding"),e.consume(U),e.exit("lineEnding"),T}function T(U){return c>0&&Be(U)?Ve(e,I,"linePrefix",c+1)(U):I(U)}function I(U){return U===null||Ee(U)?e.check(Gx,A,_)(U):(e.enter("codeFlowValue"),M(U))}function M(U){return U===null||Ee(U)?(e.exit("codeFlowValue"),I(U)):(e.consume(U),M)}function _(U){return e.exit("codeFenced"),a(U)}function $(U,Y,W){let J=0;return P;function P(F){return U.enter("lineEnding"),U.consume(F),U.exit("lineEnding"),K}function K(F){return U.enter("codeFencedFence"),Be(F)?Ve(U,D,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(F):D(F)}function D(F){return F===f?(U.enter("codeFencedFenceSequence"),O(F)):W(F)}function O(F){return F===f?(J++,U.consume(F),O):J>=d?(U.exit("codeFencedFenceSequence"),Be(F)?Ve(U,te,"whitespace")(F):te(F)):W(F)}function te(F){return F===null||Ee(F)?(U.exit("codeFencedFence"),Y(F)):W(F)}}}function VN(e,a,r){const i=this;return o;function o(d){return d===null?r(d):(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),c)}function c(d){return i.parser.lazy[i.now().line]?r(d):a(d)}}const cf={name:"codeIndented",tokenize:GN},YN={partial:!0,tokenize:KN};function GN(e,a,r){const i=this;return o;function o(m){return e.enter("codeIndented"),Ve(e,c,"linePrefix",5)(m)}function c(m){const g=i.events[i.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?d(m):r(m)}function d(m){return m===null?h(m):Ee(m)?e.attempt(YN,d,h)(m):(e.enter("codeFlowValue"),f(m))}function f(m){return m===null||Ee(m)?(e.exit("codeFlowValue"),d(m)):(e.consume(m),f)}function h(m){return e.exit("codeIndented"),a(m)}}function KN(e,a,r){const i=this;return o;function o(d){return i.parser.lazy[i.now().line]?r(d):Ee(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),o):Ve(e,c,"linePrefix",5)(d)}function c(d){const f=i.events[i.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?a(d):Ee(d)?o(d):r(d)}}const WN={name:"codeText",previous:QN,resolve:XN,tokenize:ZN};function XN(e){let a=e.length-4,r=3,i,o;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[a][1].type==="lineEnding"||e[a][1].type==="space")){for(i=r;++i<a;)if(e[i][1].type==="codeTextData"){e[r][1].type="codeTextPadding",e[a][1].type="codeTextPadding",r+=2,a-=2;break}}for(i=r-1,a++;++i<=a;)o===void 0?i!==a&&e[i][1].type!=="lineEnding"&&(o=i):(i===a||e[i][1].type==="lineEnding")&&(e[o][1].type="codeTextData",i!==o+2&&(e[o][1].end=e[i-1][1].end,e.splice(o+2,i-o-2),a-=i-o-2,i=o+2),o=void 0);return e}function QN(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function ZN(e,a,r){let i=0,o,c;return d;function d(y){return e.enter("codeText"),e.enter("codeTextSequence"),f(y)}function f(y){return y===96?(e.consume(y),i++,f):(e.exit("codeTextSequence"),h(y))}function h(y){return y===null?r(y):y===32?(e.enter("space"),e.consume(y),e.exit("space"),h):y===96?(c=e.enter("codeTextSequence"),o=0,g(y)):Ee(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),h):(e.enter("codeTextData"),m(y))}function m(y){return y===null||y===32||y===96||Ee(y)?(e.exit("codeTextData"),h(y)):(e.consume(y),m)}function g(y){return y===96?(e.consume(y),o++,g):o===i?(e.exit("codeTextSequence"),e.exit("codeText"),a(y)):(c.type="codeTextData",m(y))}}class JN{constructor(a){this.left=a?[...a]:[],this.right=[]}get(a){if(a<0||a>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+a+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return a<this.left.length?this.left[a]:this.right[this.right.length-a+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(a,r){const i=r??Number.POSITIVE_INFINITY;return i<this.left.length?this.left.slice(a,i):a>this.left.length?this.right.slice(this.right.length-i+this.left.length,this.right.length-a+this.left.length).reverse():this.left.slice(a).concat(this.right.slice(this.right.length-i+this.left.length).reverse())}splice(a,r,i){const o=r||0;this.setCursor(Math.trunc(a));const c=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return i&&qi(this.left,i),c.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(a){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(a)}pushMany(a){this.setCursor(Number.POSITIVE_INFINITY),qi(this.left,a)}unshift(a){this.setCursor(0),this.right.push(a)}unshiftMany(a){this.setCursor(0),qi(this.right,a.reverse())}setCursor(a){if(!(a===this.left.length||a>this.left.length&&this.right.length===0||a<0&&this.left.length===0))if(a<this.left.length){const r=this.left.splice(a,Number.POSITIVE_INFINITY);qi(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-a,Number.POSITIVE_INFINITY);qi(this.left,r.reverse())}}}function qi(e,a){let r=0;if(a.length<1e4)e.push(...a);else for(;r<a.length;)e.push(...a.slice(r,r+1e4)),r+=1e4}function wv(e){const a={};let r=-1,i,o,c,d,f,h,m;const g=new JN(e);for(;++r<g.length;){for(;r in a;)r=a[r];if(i=g.get(r),r&&i[1].type==="chunkFlow"&&g.get(r-1)[1].type==="listItemPrefix"&&(h=i[1]._tokenizer.events,c=0,c<h.length&&h[c][1].type==="lineEndingBlank"&&(c+=2),c<h.length&&h[c][1].type==="content"))for(;++c<h.length&&h[c][1].type!=="content";)h[c][1].type==="chunkText"&&(h[c][1]._isInFirstContentOfListItem=!0,c++);if(i[0]==="enter")i[1].contentType&&(Object.assign(a,e5(g,r)),r=a[r],m=!0);else if(i[1]._container){for(c=r,o=void 0;c--;)if(d=g.get(c),d[1].type==="lineEnding"||d[1].type==="lineEndingBlank")d[0]==="enter"&&(o&&(g.get(o)[1].type="lineEndingBlank"),d[1].type="lineEnding",o=c);else if(!(d[1].type==="linePrefix"||d[1].type==="listItemIndent"))break;o&&(i[1].end={...g.get(o)[1].start},f=g.slice(o,r),f.unshift(i),g.splice(o,r-o+1,f))}}return jn(e,0,Number.POSITIVE_INFINITY,g.slice(0)),!m}function e5(e,a){const r=e.get(a)[1],i=e.get(a)[2];let o=a-1;const c=[];let d=r._tokenizer;d||(d=i.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(d._contentTypeTextTrailing=!0));const f=d.events,h=[],m={};let g,y,b=-1,w=r,N=0,A=0;const j=[A];for(;w;){for(;e.get(++o)[1]!==w;);c.push(o),w._tokenizer||(g=i.sliceStream(w),w.next||g.push(null),y&&d.defineSkip(w.start),w._isInFirstContentOfListItem&&(d._gfmTasklistFirstContentOfListItem=!0),d.write(g),w._isInFirstContentOfListItem&&(d._gfmTasklistFirstContentOfListItem=void 0)),y=w,w=w.next}for(w=r;++b<f.length;)f[b][0]==="exit"&&f[b-1][0]==="enter"&&f[b][1].type===f[b-1][1].type&&f[b][1].start.line!==f[b][1].end.line&&(A=b+1,j.push(A),w._tokenizer=void 0,w.previous=void 0,w=w.next);for(d.events=[],w?(w._tokenizer=void 0,w.previous=void 0):j.pop(),b=j.length;b--;){const T=f.slice(j[b],j[b+1]),I=c.pop();h.push([I,I+T.length-1]),e.splice(I,2,T)}for(h.reverse(),b=-1;++b<h.length;)m[N+h[b][0]]=N+h[b][1],N+=h[b][1]-h[b][0]-1;return m}const t5={resolve:a5,tokenize:r5},n5={partial:!0,tokenize:l5};function a5(e){return wv(e),e}function r5(e,a){let r;return i;function i(f){return e.enter("content"),r=e.enter("chunkContent",{contentType:"content"}),o(f)}function o(f){return f===null?c(f):Ee(f)?e.check(n5,d,c)(f):(e.consume(f),o)}function c(f){return e.exit("chunkContent"),e.exit("content"),a(f)}function d(f){return e.consume(f),e.exit("chunkContent"),r.next=e.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,o}}function l5(e,a,r){const i=this;return o;function o(d){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),Ve(e,c,"linePrefix")}function c(d){if(d===null||Ee(d))return r(d);const f=i.events[i.events.length-1];return!i.parser.constructs.disable.null.includes("codeIndented")&&f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?a(d):e.interrupt(i.parser.constructs.flow,r,a)(d)}}function Sv(e,a,r,i,o,c,d,f,h){const m=h||Number.POSITIVE_INFINITY;let g=0;return y;function y(T){return T===60?(e.enter(i),e.enter(o),e.enter(c),e.consume(T),e.exit(c),b):T===null||T===32||T===41||mu(T)?r(T):(e.enter(i),e.enter(d),e.enter(f),e.enter("chunkString",{contentType:"string"}),A(T))}function b(T){return T===62?(e.enter(c),e.consume(T),e.exit(c),e.exit(o),e.exit(i),a):(e.enter(f),e.enter("chunkString",{contentType:"string"}),w(T))}function w(T){return T===62?(e.exit("chunkString"),e.exit(f),b(T)):T===null||T===60||Ee(T)?r(T):(e.consume(T),T===92?N:w)}function N(T){return T===60||T===62||T===92?(e.consume(T),w):w(T)}function A(T){return!g&&(T===null||T===41||lt(T))?(e.exit("chunkString"),e.exit(f),e.exit(d),e.exit(i),a(T)):g<m&&T===40?(e.consume(T),g++,A):T===41?(e.consume(T),g--,A):T===null||T===32||T===40||mu(T)?r(T):(e.consume(T),T===92?j:A)}function j(T){return T===40||T===41||T===92?(e.consume(T),A):A(T)}}function jv(e,a,r,i,o,c){const d=this;let f=0,h;return m;function m(w){return e.enter(i),e.enter(o),e.consume(w),e.exit(o),e.enter(c),g}function g(w){return f>999||w===null||w===91||w===93&&!h||w===94&&!f&&"_hiddenFootnoteSupport"in d.parser.constructs?r(w):w===93?(e.exit(c),e.enter(o),e.consume(w),e.exit(o),e.exit(i),a):Ee(w)?(e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),g):(e.enter("chunkString",{contentType:"string"}),y(w))}function y(w){return w===null||w===91||w===93||Ee(w)||f++>999?(e.exit("chunkString"),g(w)):(e.consume(w),h||(h=!Be(w)),w===92?b:y)}function b(w){return w===91||w===92||w===93?(e.consume(w),f++,y):y(w)}}function Nv(e,a,r,i,o,c){let d;return f;function f(b){return b===34||b===39||b===40?(e.enter(i),e.enter(o),e.consume(b),e.exit(o),d=b===40?41:b,h):r(b)}function h(b){return b===d?(e.enter(o),e.consume(b),e.exit(o),e.exit(i),a):(e.enter(c),m(b))}function m(b){return b===d?(e.exit(c),h(d)):b===null?r(b):Ee(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),Ve(e,m,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(b))}function g(b){return b===d||b===null||Ee(b)?(e.exit("chunkString"),m(b)):(e.consume(b),b===92?y:g)}function y(b){return b===d||b===92?(e.consume(b),g):g(b)}}function ts(e,a){let r;return i;function i(o){return Ee(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),r=!0,i):Be(o)?Ve(e,i,r?"linePrefix":"lineSuffix")(o):a(o)}}const i5={name:"definition",tokenize:o5},s5={partial:!0,tokenize:u5};function o5(e,a,r){const i=this;let o;return c;function c(w){return e.enter("definition"),d(w)}function d(w){return jv.call(i,e,f,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(w)}function f(w){return o=Zn(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),w===58?(e.enter("definitionMarker"),e.consume(w),e.exit("definitionMarker"),h):r(w)}function h(w){return lt(w)?ts(e,m)(w):m(w)}function m(w){return Sv(e,g,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(w)}function g(w){return e.attempt(s5,y,y)(w)}function y(w){return Be(w)?Ve(e,b,"whitespace")(w):b(w)}function b(w){return w===null||Ee(w)?(e.exit("definition"),i.parser.defined.push(o),a(w)):r(w)}}function u5(e,a,r){return i;function i(f){return lt(f)?ts(e,o)(f):r(f)}function o(f){return Nv(e,c,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function c(f){return Be(f)?Ve(e,d,"whitespace")(f):d(f)}function d(f){return f===null||Ee(f)?a(f):r(f)}}const c5={name:"hardBreakEscape",tokenize:d5};function d5(e,a,r){return i;function i(c){return e.enter("hardBreakEscape"),e.consume(c),o}function o(c){return Ee(c)?(e.exit("hardBreakEscape"),a(c)):r(c)}}const f5={name:"headingAtx",resolve:m5,tokenize:h5};function m5(e,a){let r=e.length-2,i=3,o,c;return e[i][1].type==="whitespace"&&(i+=2),r-2>i&&e[r][1].type==="whitespace"&&(r-=2),e[r][1].type==="atxHeadingSequence"&&(i===r-1||r-4>i&&e[r-2][1].type==="whitespace")&&(r-=i+1===r?2:4),r>i&&(o={type:"atxHeadingText",start:e[i][1].start,end:e[r][1].end},c={type:"chunkText",start:e[i][1].start,end:e[r][1].end,contentType:"text"},jn(e,i,r-i+1,[["enter",o,a],["enter",c,a],["exit",c,a],["exit",o,a]])),e}function h5(e,a,r){let i=0;return o;function o(g){return e.enter("atxHeading"),c(g)}function c(g){return e.enter("atxHeadingSequence"),d(g)}function d(g){return g===35&&i++<6?(e.consume(g),d):g===null||lt(g)?(e.exit("atxHeadingSequence"),f(g)):r(g)}function f(g){return g===35?(e.enter("atxHeadingSequence"),h(g)):g===null||Ee(g)?(e.exit("atxHeading"),a(g)):Be(g)?Ve(e,f,"whitespace")(g):(e.enter("atxHeadingText"),m(g))}function h(g){return g===35?(e.consume(g),h):(e.exit("atxHeadingSequence"),f(g))}function m(g){return g===null||g===35||lt(g)?(e.exit("atxHeadingText"),f(g)):(e.consume(g),m)}}const p5=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Wx=["pre","script","style","textarea"],g5={concrete:!0,name:"htmlFlow",resolveTo:v5,tokenize:b5},x5={partial:!0,tokenize:w5},y5={partial:!0,tokenize:k5};function v5(e){let a=e.length;for(;a--&&!(e[a][0]==="enter"&&e[a][1].type==="htmlFlow"););return a>1&&e[a-2][1].type==="linePrefix"&&(e[a][1].start=e[a-2][1].start,e[a+1][1].start=e[a-2][1].start,e.splice(a-2,2)),e}function b5(e,a,r){const i=this;let o,c,d,f,h;return m;function m(C){return g(C)}function g(C){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(C),y}function y(C){return C===33?(e.consume(C),b):C===47?(e.consume(C),c=!0,A):C===63?(e.consume(C),o=3,i.interrupt?a:R):Qt(C)?(e.consume(C),d=String.fromCharCode(C),j):r(C)}function b(C){return C===45?(e.consume(C),o=2,w):C===91?(e.consume(C),o=5,f=0,N):Qt(C)?(e.consume(C),o=4,i.interrupt?a:R):r(C)}function w(C){return C===45?(e.consume(C),i.interrupt?a:R):r(C)}function N(C){const G="CDATA[";return C===G.charCodeAt(f++)?(e.consume(C),f===G.length?i.interrupt?a:D:N):r(C)}function A(C){return Qt(C)?(e.consume(C),d=String.fromCharCode(C),j):r(C)}function j(C){if(C===null||C===47||C===62||lt(C)){const G=C===47,re=d.toLowerCase();return!G&&!c&&Wx.includes(re)?(o=1,i.interrupt?a(C):D(C)):p5.includes(d.toLowerCase())?(o=6,G?(e.consume(C),T):i.interrupt?a(C):D(C)):(o=7,i.interrupt&&!i.parser.lazy[i.now().line]?r(C):c?I(C):M(C))}return C===45||Vt(C)?(e.consume(C),d+=String.fromCharCode(C),j):r(C)}function T(C){return C===62?(e.consume(C),i.interrupt?a:D):r(C)}function I(C){return Be(C)?(e.consume(C),I):P(C)}function M(C){return C===47?(e.consume(C),P):C===58||C===95||Qt(C)?(e.consume(C),_):Be(C)?(e.consume(C),M):P(C)}function _(C){return C===45||C===46||C===58||C===95||Vt(C)?(e.consume(C),_):$(C)}function $(C){return C===61?(e.consume(C),U):Be(C)?(e.consume(C),$):M(C)}function U(C){return C===null||C===60||C===61||C===62||C===96?r(C):C===34||C===39?(e.consume(C),h=C,Y):Be(C)?(e.consume(C),U):W(C)}function Y(C){return C===h?(e.consume(C),h=null,J):C===null||Ee(C)?r(C):(e.consume(C),Y)}function W(C){return C===null||C===34||C===39||C===47||C===60||C===61||C===62||C===96||lt(C)?$(C):(e.consume(C),W)}function J(C){return C===47||C===62||Be(C)?M(C):r(C)}function P(C){return C===62?(e.consume(C),K):r(C)}function K(C){return C===null||Ee(C)?D(C):Be(C)?(e.consume(C),K):r(C)}function D(C){return C===45&&o===2?(e.consume(C),L):C===60&&o===1?(e.consume(C),ae):C===62&&o===4?(e.consume(C),z):C===63&&o===3?(e.consume(C),R):C===93&&o===5?(e.consume(C),xe):Ee(C)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(x5,B,O)(C)):C===null||Ee(C)?(e.exit("htmlFlowData"),O(C)):(e.consume(C),D)}function O(C){return e.check(y5,te,B)(C)}function te(C){return e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),F}function F(C){return C===null||Ee(C)?O(C):(e.enter("htmlFlowData"),D(C))}function L(C){return C===45?(e.consume(C),R):D(C)}function ae(C){return C===47?(e.consume(C),d="",ne):D(C)}function ne(C){if(C===62){const G=d.toLowerCase();return Wx.includes(G)?(e.consume(C),z):D(C)}return Qt(C)&&d.length<8?(e.consume(C),d+=String.fromCharCode(C),ne):D(C)}function xe(C){return C===93?(e.consume(C),R):D(C)}function R(C){return C===62?(e.consume(C),z):C===45&&o===2?(e.consume(C),R):D(C)}function z(C){return C===null||Ee(C)?(e.exit("htmlFlowData"),B(C)):(e.consume(C),z)}function B(C){return e.exit("htmlFlow"),a(C)}}function k5(e,a,r){const i=this;return o;function o(d){return Ee(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),c):r(d)}function c(d){return i.parser.lazy[i.now().line]?r(d):a(d)}}function w5(e,a,r){return i;function i(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(gs,a,r)}}const S5={name:"htmlText",tokenize:j5};function j5(e,a,r){const i=this;let o,c,d;return f;function f(R){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(R),h}function h(R){return R===33?(e.consume(R),m):R===47?(e.consume(R),$):R===63?(e.consume(R),M):Qt(R)?(e.consume(R),W):r(R)}function m(R){return R===45?(e.consume(R),g):R===91?(e.consume(R),c=0,N):Qt(R)?(e.consume(R),I):r(R)}function g(R){return R===45?(e.consume(R),w):r(R)}function y(R){return R===null?r(R):R===45?(e.consume(R),b):Ee(R)?(d=y,ae(R)):(e.consume(R),y)}function b(R){return R===45?(e.consume(R),w):y(R)}function w(R){return R===62?L(R):R===45?b(R):y(R)}function N(R){const z="CDATA[";return R===z.charCodeAt(c++)?(e.consume(R),c===z.length?A:N):r(R)}function A(R){return R===null?r(R):R===93?(e.consume(R),j):Ee(R)?(d=A,ae(R)):(e.consume(R),A)}function j(R){return R===93?(e.consume(R),T):A(R)}function T(R){return R===62?L(R):R===93?(e.consume(R),T):A(R)}function I(R){return R===null||R===62?L(R):Ee(R)?(d=I,ae(R)):(e.consume(R),I)}function M(R){return R===null?r(R):R===63?(e.consume(R),_):Ee(R)?(d=M,ae(R)):(e.consume(R),M)}function _(R){return R===62?L(R):M(R)}function $(R){return Qt(R)?(e.consume(R),U):r(R)}function U(R){return R===45||Vt(R)?(e.consume(R),U):Y(R)}function Y(R){return Ee(R)?(d=Y,ae(R)):Be(R)?(e.consume(R),Y):L(R)}function W(R){return R===45||Vt(R)?(e.consume(R),W):R===47||R===62||lt(R)?J(R):r(R)}function J(R){return R===47?(e.consume(R),L):R===58||R===95||Qt(R)?(e.consume(R),P):Ee(R)?(d=J,ae(R)):Be(R)?(e.consume(R),J):L(R)}function P(R){return R===45||R===46||R===58||R===95||Vt(R)?(e.consume(R),P):K(R)}function K(R){return R===61?(e.consume(R),D):Ee(R)?(d=K,ae(R)):Be(R)?(e.consume(R),K):J(R)}function D(R){return R===null||R===60||R===61||R===62||R===96?r(R):R===34||R===39?(e.consume(R),o=R,O):Ee(R)?(d=D,ae(R)):Be(R)?(e.consume(R),D):(e.consume(R),te)}function O(R){return R===o?(e.consume(R),o=void 0,F):R===null?r(R):Ee(R)?(d=O,ae(R)):(e.consume(R),O)}function te(R){return R===null||R===34||R===39||R===60||R===61||R===96?r(R):R===47||R===62||lt(R)?J(R):(e.consume(R),te)}function F(R){return R===47||R===62||lt(R)?J(R):r(R)}function L(R){return R===62?(e.consume(R),e.exit("htmlTextData"),e.exit("htmlText"),a):r(R)}function ae(R){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),ne}function ne(R){return Be(R)?Ve(e,xe,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):xe(R)}function xe(R){return e.enter("htmlTextData"),d(R)}}const qm={name:"labelEnd",resolveAll:T5,resolveTo:M5,tokenize:A5},N5={tokenize:R5},C5={tokenize:_5},E5={tokenize:z5};function T5(e){let a=-1;const r=[];for(;++a<e.length;){const i=e[a][1];if(r.push(e[a]),i.type==="labelImage"||i.type==="labelLink"||i.type==="labelEnd"){const o=i.type==="labelImage"?4:2;i.type="data",a+=o}}return e.length!==r.length&&jn(e,0,e.length,r),e}function M5(e,a){let r=e.length,i=0,o,c,d,f;for(;r--;)if(o=e[r][1],c){if(o.type==="link"||o.type==="labelLink"&&o._inactive)break;e[r][0]==="enter"&&o.type==="labelLink"&&(o._inactive=!0)}else if(d){if(e[r][0]==="enter"&&(o.type==="labelImage"||o.type==="labelLink")&&!o._balanced&&(c=r,o.type!=="labelLink")){i=2;break}}else o.type==="labelEnd"&&(d=r);const h={type:e[c][1].type==="labelLink"?"link":"image",start:{...e[c][1].start},end:{...e[e.length-1][1].end}},m={type:"label",start:{...e[c][1].start},end:{...e[d][1].end}},g={type:"labelText",start:{...e[c+i+2][1].end},end:{...e[d-2][1].start}};return f=[["enter",h,a],["enter",m,a]],f=Bn(f,e.slice(c+1,c+i+3)),f=Bn(f,[["enter",g,a]]),f=Bn(f,Mu(a.parser.constructs.insideSpan.null,e.slice(c+i+4,d-3),a)),f=Bn(f,[["exit",g,a],e[d-2],e[d-1],["exit",m,a]]),f=Bn(f,e.slice(d+1)),f=Bn(f,[["exit",h,a]]),jn(e,c,e.length,f),e}function A5(e,a,r){const i=this;let o=i.events.length,c,d;for(;o--;)if((i.events[o][1].type==="labelImage"||i.events[o][1].type==="labelLink")&&!i.events[o][1]._balanced){c=i.events[o][1];break}return f;function f(b){return c?c._inactive?y(b):(d=i.parser.defined.includes(Zn(i.sliceSerialize({start:c.end,end:i.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(b),e.exit("labelMarker"),e.exit("labelEnd"),h):r(b)}function h(b){return b===40?e.attempt(N5,g,d?g:y)(b):b===91?e.attempt(C5,g,d?m:y)(b):d?g(b):y(b)}function m(b){return e.attempt(E5,g,y)(b)}function g(b){return a(b)}function y(b){return c._balanced=!0,r(b)}}function R5(e,a,r){return i;function i(y){return e.enter("resource"),e.enter("resourceMarker"),e.consume(y),e.exit("resourceMarker"),o}function o(y){return lt(y)?ts(e,c)(y):c(y)}function c(y){return y===41?g(y):Sv(e,d,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(y)}function d(y){return lt(y)?ts(e,h)(y):g(y)}function f(y){return r(y)}function h(y){return y===34||y===39||y===40?Nv(e,m,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(y):g(y)}function m(y){return lt(y)?ts(e,g)(y):g(y)}function g(y){return y===41?(e.enter("resourceMarker"),e.consume(y),e.exit("resourceMarker"),e.exit("resource"),a):r(y)}}function _5(e,a,r){const i=this;return o;function o(f){return jv.call(i,e,c,d,"reference","referenceMarker","referenceString")(f)}function c(f){return i.parser.defined.includes(Zn(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?a(f):r(f)}function d(f){return r(f)}}function z5(e,a,r){return i;function i(c){return e.enter("reference"),e.enter("referenceMarker"),e.consume(c),e.exit("referenceMarker"),o}function o(c){return c===93?(e.enter("referenceMarker"),e.consume(c),e.exit("referenceMarker"),e.exit("reference"),a):r(c)}}const D5={name:"labelStartImage",resolveAll:qm.resolveAll,tokenize:L5};function L5(e,a,r){const i=this;return o;function o(f){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(f),e.exit("labelImageMarker"),c}function c(f){return f===91?(e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelImage"),d):r(f)}function d(f){return f===94&&"_hiddenFootnoteSupport"in i.parser.constructs?r(f):a(f)}}const O5={name:"labelStartLink",resolveAll:qm.resolveAll,tokenize:I5};function I5(e,a,r){const i=this;return o;function o(d){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(d),e.exit("labelMarker"),e.exit("labelLink"),c}function c(d){return d===94&&"_hiddenFootnoteSupport"in i.parser.constructs?r(d):a(d)}}const df={name:"lineEnding",tokenize:U5};function U5(e,a){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),Ve(e,a,"linePrefix")}}const eu={name:"thematicBreak",tokenize:$5};function $5(e,a,r){let i=0,o;return c;function c(m){return e.enter("thematicBreak"),d(m)}function d(m){return o=m,f(m)}function f(m){return m===o?(e.enter("thematicBreakSequence"),h(m)):i>=3&&(m===null||Ee(m))?(e.exit("thematicBreak"),a(m)):r(m)}function h(m){return m===o?(e.consume(m),i++,h):(e.exit("thematicBreakSequence"),Be(m)?Ve(e,f,"whitespace")(m):f(m))}}const cn={continuation:{tokenize:q5},exit:V5,name:"list",tokenize:P5},B5={partial:!0,tokenize:Y5},H5={partial:!0,tokenize:F5};function P5(e,a,r){const i=this,o=i.events[i.events.length-1];let c=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,d=0;return f;function f(w){const N=i.containerState.type||(w===42||w===43||w===45?"listUnordered":"listOrdered");if(N==="listUnordered"?!i.containerState.marker||w===i.containerState.marker:tm(w)){if(i.containerState.type||(i.containerState.type=N,e.enter(N,{_container:!0})),N==="listUnordered")return e.enter("listItemPrefix"),w===42||w===45?e.check(eu,r,m)(w):m(w);if(!i.interrupt||w===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),h(w)}return r(w)}function h(w){return tm(w)&&++d<10?(e.consume(w),h):(!i.interrupt||d<2)&&(i.containerState.marker?w===i.containerState.marker:w===41||w===46)?(e.exit("listItemValue"),m(w)):r(w)}function m(w){return e.enter("listItemMarker"),e.consume(w),e.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||w,e.check(gs,i.interrupt?r:g,e.attempt(B5,b,y))}function g(w){return i.containerState.initialBlankLine=!0,c++,b(w)}function y(w){return Be(w)?(e.enter("listItemPrefixWhitespace"),e.consume(w),e.exit("listItemPrefixWhitespace"),b):r(w)}function b(w){return i.containerState.size=c+i.sliceSerialize(e.exit("listItemPrefix"),!0).length,a(w)}}function q5(e,a,r){const i=this;return i.containerState._closeFlow=void 0,e.check(gs,o,c);function o(f){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,Ve(e,a,"listItemIndent",i.containerState.size+1)(f)}function c(f){return i.containerState.furtherBlankLines||!Be(f)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,d(f)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,e.attempt(H5,a,d)(f))}function d(f){return i.containerState._closeFlow=!0,i.interrupt=void 0,Ve(e,e.attempt(cn,a,r),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function F5(e,a,r){const i=this;return Ve(e,o,"listItemIndent",i.containerState.size+1);function o(c){const d=i.events[i.events.length-1];return d&&d[1].type==="listItemIndent"&&d[2].sliceSerialize(d[1],!0).length===i.containerState.size?a(c):r(c)}}function V5(e){e.exit(this.containerState.type)}function Y5(e,a,r){const i=this;return Ve(e,o,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(c){const d=i.events[i.events.length-1];return!Be(c)&&d&&d[1].type==="listItemPrefixWhitespace"?a(c):r(c)}}const Xx={name:"setextUnderline",resolveTo:G5,tokenize:K5};function G5(e,a){let r=e.length,i,o,c;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){i=r;break}e[r][1].type==="paragraph"&&(o=r)}else e[r][1].type==="content"&&e.splice(r,1),!c&&e[r][1].type==="definition"&&(c=r);const d={type:"setextHeading",start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[o][1].type="setextHeadingText",c?(e.splice(o,0,["enter",d,a]),e.splice(c+1,0,["exit",e[i][1],a]),e[i][1].end={...e[c][1].end}):e[i][1]=d,e.push(["exit",d,a]),e}function K5(e,a,r){const i=this;let o;return c;function c(m){let g=i.events.length,y;for(;g--;)if(i.events[g][1].type!=="lineEnding"&&i.events[g][1].type!=="linePrefix"&&i.events[g][1].type!=="content"){y=i.events[g][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||y)?(e.enter("setextHeadingLine"),o=m,d(m)):r(m)}function d(m){return e.enter("setextHeadingLineSequence"),f(m)}function f(m){return m===o?(e.consume(m),f):(e.exit("setextHeadingLineSequence"),Be(m)?Ve(e,h,"lineSuffix")(m):h(m))}function h(m){return m===null||Ee(m)?(e.exit("setextHeadingLine"),a(m)):r(m)}}const W5={tokenize:X5};function X5(e){const a=this,r=e.attempt(gs,i,e.attempt(this.parser.constructs.flowInitial,o,Ve(e,e.attempt(this.parser.constructs.flow,o,e.attempt(t5,o)),"linePrefix")));return r;function i(c){if(c===null){e.consume(c);return}return e.enter("lineEndingBlank"),e.consume(c),e.exit("lineEndingBlank"),a.currentConstruct=void 0,r}function o(c){if(c===null){e.consume(c);return}return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),a.currentConstruct=void 0,r}}const Q5={resolveAll:Ev()},Z5=Cv("string"),J5=Cv("text");function Cv(e){return{resolveAll:Ev(e==="text"?eC:void 0),tokenize:a};function a(r){const i=this,o=this.parser.constructs[e],c=r.attempt(o,d,f);return d;function d(g){return m(g)?c(g):f(g)}function f(g){if(g===null){r.consume(g);return}return r.enter("data"),r.consume(g),h}function h(g){return m(g)?(r.exit("data"),c(g)):(r.consume(g),h)}function m(g){if(g===null)return!0;const y=o[g];let b=-1;if(y)for(;++b<y.length;){const w=y[b];if(!w.previous||w.previous.call(i,i.previous))return!0}return!1}}}function Ev(e){return a;function a(r,i){let o=-1,c;for(;++o<=r.length;)c===void 0?r[o]&&r[o][1].type==="data"&&(c=o,o++):(!r[o]||r[o][1].type!=="data")&&(o!==c+2&&(r[c][1].end=r[o-1][1].end,r.splice(c+2,o-c-2),o=c+2),c=void 0);return e?e(r,i):r}}function eC(e,a){let r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type==="lineEnding")&&e[r-1][1].type==="data"){const i=e[r-1][1],o=a.sliceStream(i);let c=o.length,d=-1,f=0,h;for(;c--;){const m=o[c];if(typeof m=="string"){for(d=m.length;m.charCodeAt(d-1)===32;)f++,d--;if(d)break;d=-1}else if(m===-2)h=!0,f++;else if(m!==-1){c++;break}}if(a._contentTypeTextTrailing&&r===e.length&&(f=0),f){const m={type:r===e.length||h||f<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:c?d:i.start._bufferIndex+d,_index:i.start._index+c,line:i.end.line,column:i.end.column-f,offset:i.end.offset-f},end:{...i.end}};i.end={...m.start},i.start.offset===i.end.offset?Object.assign(i,m):(e.splice(r,0,["enter",m,a],["exit",m,a]),r+=2)}r++}return e}const tC={42:cn,43:cn,45:cn,48:cn,49:cn,50:cn,51:cn,52:cn,53:cn,54:cn,55:cn,56:cn,57:cn,62:vv},nC={91:i5},aC={[-2]:cf,[-1]:cf,32:cf},rC={35:f5,42:eu,45:[Xx,eu],60:g5,61:Xx,95:eu,96:Kx,126:Kx},lC={38:kv,92:bv},iC={[-5]:df,[-4]:df,[-3]:df,33:D5,38:kv,42:nm,60:[ON,S5],91:O5,92:[c5,bv],93:qm,95:nm,96:WN},sC={null:[nm,Q5]},oC={null:[42,95]},uC={null:[]},cC=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:oC,contentInitial:nC,disable:uC,document:tC,flow:rC,flowInitial:aC,insideSpan:sC,string:lC,text:iC},Symbol.toStringTag,{value:"Module"}));function dC(e,a,r){let i={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const o={},c=[];let d=[],f=[];const h={attempt:Y($),check:Y(U),consume:I,enter:M,exit:_,interrupt:Y(U,{interrupt:!0})},m={code:null,containerState:{},defineSkip:A,events:[],now:N,parser:e,previous:null,sliceSerialize:b,sliceStream:w,write:y};let g=a.tokenize.call(m,h);return a.resolveAll&&c.push(a),m;function y(K){return d=Bn(d,K),j(),d[d.length-1]!==null?[]:(W(a,0),m.events=Mu(c,m.events,m),m.events)}function b(K,D){return mC(w(K),D)}function w(K){return fC(d,K)}function N(){const{_bufferIndex:K,_index:D,line:O,column:te,offset:F}=i;return{_bufferIndex:K,_index:D,line:O,column:te,offset:F}}function A(K){o[K.line]=K.column,P()}function j(){let K;for(;i._index<d.length;){const D=d[i._index];if(typeof D=="string")for(K=i._index,i._bufferIndex<0&&(i._bufferIndex=0);i._index===K&&i._bufferIndex<D.length;)T(D.charCodeAt(i._bufferIndex));else T(D)}}function T(K){g=g(K)}function I(K){Ee(K)?(i.line++,i.column=1,i.offset+=K===-3?2:1,P()):K!==-1&&(i.column++,i.offset++),i._bufferIndex<0?i._index++:(i._bufferIndex++,i._bufferIndex===d[i._index].length&&(i._bufferIndex=-1,i._index++)),m.previous=K}function M(K,D){const O=D||{};return O.type=K,O.start=N(),m.events.push(["enter",O,m]),f.push(O),O}function _(K){const D=f.pop();return D.end=N(),m.events.push(["exit",D,m]),D}function $(K,D){W(K,D.from)}function U(K,D){D.restore()}function Y(K,D){return O;function O(te,F,L){let ae,ne,xe,R;return Array.isArray(te)?B(te):"tokenize"in te?B([te]):z(te);function z(ue){return ge;function ge(we){const Ne=we!==null&&ue[we],ye=we!==null&&ue.null,Me=[...Array.isArray(Ne)?Ne:Ne?[Ne]:[],...Array.isArray(ye)?ye:ye?[ye]:[]];return B(Me)(we)}}function B(ue){return ae=ue,ne=0,ue.length===0?L:C(ue[ne])}function C(ue){return ge;function ge(we){return R=J(),xe=ue,ue.partial||(m.currentConstruct=ue),ue.name&&m.parser.constructs.disable.null.includes(ue.name)?re():ue.tokenize.call(D?Object.assign(Object.create(m),D):m,h,G,re)(we)}}function G(ue){return K(xe,R),F}function re(ue){return R.restore(),++ne<ae.length?C(ae[ne]):L}}}function W(K,D){K.resolveAll&&!c.includes(K)&&c.push(K),K.resolve&&jn(m.events,D,m.events.length-D,K.resolve(m.events.slice(D),m)),K.resolveTo&&(m.events=K.resolveTo(m.events,m))}function J(){const K=N(),D=m.previous,O=m.currentConstruct,te=m.events.length,F=Array.from(f);return{from:te,restore:L};function L(){i=K,m.previous=D,m.currentConstruct=O,m.events.length=te,f=F,P()}}function P(){i.line in o&&i.column<2&&(i.column=o[i.line],i.offset+=o[i.line]-1)}}function fC(e,a){const r=a.start._index,i=a.start._bufferIndex,o=a.end._index,c=a.end._bufferIndex;let d;if(r===o)d=[e[r].slice(i,c)];else{if(d=e.slice(r,o),i>-1){const f=d[0];typeof f=="string"?d[0]=f.slice(i):d.shift()}c>0&&d.push(e[o].slice(0,c))}return d}function mC(e,a){let r=-1;const i=[];let o;for(;++r<e.length;){const c=e[r];let d;if(typeof c=="string")d=c;else switch(c){case-5:{d="\r";break}case-4:{d=`
|
|
15
|
+
`;break}case-3:{d=`\r
|
|
16
|
+
`;break}case-2:{d=a?" ":" ";break}case-1:{if(!a&&o)continue;d=" ";break}default:d=String.fromCharCode(c)}o=c===-2,i.push(d)}return i.join("")}function hC(e){const i={constructs:xv([cC,...(e||{}).extensions||[]]),content:o(MN),defined:[],document:o(RN),flow:o(W5),lazy:{},string:o(Z5),text:o(J5)};return i;function o(c){return d;function d(f){return dC(i,c,f)}}}function pC(e){for(;!wv(e););return e}const Qx=/[\0\t\n\r]/g;function gC(){let e=1,a="",r=!0,i;return o;function o(c,d,f){const h=[];let m,g,y,b,w;for(c=a+(typeof c=="string"?c.toString():new TextDecoder(d||void 0).decode(c)),y=0,a="",r&&(c.charCodeAt(0)===65279&&y++,r=void 0);y<c.length;){if(Qx.lastIndex=y,m=Qx.exec(c),b=m&&m.index!==void 0?m.index:c.length,w=c.charCodeAt(b),!m){a=c.slice(y);break}if(w===10&&y===b&&i)h.push(-3),i=void 0;else switch(i&&(h.push(-5),i=void 0),y<b&&(h.push(c.slice(y,b)),e+=b-y),w){case 0:{h.push(65533),e++;break}case 9:{for(g=Math.ceil(e/4)*4,h.push(-2);e++<g;)h.push(-1);break}case 10:{h.push(-4),e=1;break}default:i=!0,e=1}y=b+1}return f&&(i&&h.push(-5),a&&h.push(a),h.push(null)),h}}const xC=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function yC(e){return e.replace(xC,vC)}function vC(e,a,r){if(a)return a;if(r.charCodeAt(0)===35){const o=r.charCodeAt(1),c=o===120||o===88;return yv(r.slice(c?2:1),c?16:10)}return Pm(r)||e}const Tv={}.hasOwnProperty;function bC(e,a,r){return a&&typeof a=="object"&&(r=a,a=void 0),kC(r)(pC(hC(r).document().write(gC()(e,a,!0))))}function kC(e){const a={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:c(kt),autolinkProtocol:J,autolinkEmail:J,atxHeading:c(qt),blockQuote:c(ye),characterEscape:J,characterReference:J,codeFenced:c(Me),codeFencedFenceInfo:d,codeFencedFenceMeta:d,codeIndented:c(Me,d),codeText:c(Je,d),codeTextData:J,data:J,codeFlowValue:J,definition:c(Kt),definitionDestinationString:d,definitionLabelString:d,definitionTitleString:d,emphasis:c(Lt),hardBreakEscape:c(Tt),hardBreakTrailing:c(Tt),htmlFlow:c(fn,d),htmlFlowData:J,htmlText:c(fn,d),htmlTextData:J,image:c(Jt),label:d,link:c(kt),listItem:c(en),listItemValue:b,listOrdered:c(Rt,y),listUnordered:c(Rt),paragraph:c(mn),reference:C,referenceString:d,resourceDestinationString:d,resourceTitleString:d,setextHeading:c(qt),strong:c(Wt),thematicBreak:c(Vn)},exit:{atxHeading:h(),atxHeadingSequence:$,autolink:h(),autolinkEmail:Ne,autolinkProtocol:we,blockQuote:h(),characterEscapeValue:P,characterReferenceMarkerHexadecimal:re,characterReferenceMarkerNumeric:re,characterReferenceValue:ue,characterReference:ge,codeFenced:h(j),codeFencedFence:A,codeFencedFenceInfo:w,codeFencedFenceMeta:N,codeFlowValue:P,codeIndented:h(T),codeText:h(F),codeTextData:P,data:P,definition:h(),definitionDestinationString:_,definitionLabelString:I,definitionTitleString:M,emphasis:h(),hardBreakEscape:h(D),hardBreakTrailing:h(D),htmlFlow:h(O),htmlFlowData:P,htmlText:h(te),htmlTextData:P,image:h(ae),label:xe,labelText:ne,lineEnding:K,link:h(L),listItem:h(),listOrdered:h(),listUnordered:h(),paragraph:h(),referenceString:G,resourceDestinationString:R,resourceTitleString:z,resource:B,setextHeading:h(W),setextHeadingLineSequence:Y,setextHeadingText:U,strong:h(),thematicBreak:h()}};Mv(a,(e||{}).mdastExtensions||[]);const r={};return i;function i(se){let ie={type:"root",children:[]};const he={stack:[ie],tokenStack:[],config:a,enter:f,exit:m,buffer:d,resume:g,data:r},Se=[];let Ae=-1;for(;++Ae<se.length;)if(se[Ae][1].type==="listOrdered"||se[Ae][1].type==="listUnordered")if(se[Ae][0]==="enter")Se.push(Ae);else{const Xe=Se.pop();Ae=o(se,Xe,Ae)}for(Ae=-1;++Ae<se.length;){const Xe=a[se[Ae][0]];Tv.call(Xe,se[Ae][1].type)&&Xe[se[Ae][1].type].call(Object.assign({sliceSerialize:se[Ae][2].sliceSerialize},he),se[Ae][1])}if(he.tokenStack.length>0){const Xe=he.tokenStack[he.tokenStack.length-1];(Xe[1]||Zx).call(he,void 0,Xe[0])}for(ie.position={start:ir(se.length>0?se[0][1].start:{line:1,column:1,offset:0}),end:ir(se.length>0?se[se.length-2][1].end:{line:1,column:1,offset:0})},Ae=-1;++Ae<a.transforms.length;)ie=a.transforms[Ae](ie)||ie;return ie}function o(se,ie,he){let Se=ie-1,Ae=-1,Xe=!1,ce,ee,ve,Re;for(;++Se<=he;){const ze=se[Se];switch(ze[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ze[0]==="enter"?Ae++:Ae--,Re=void 0;break}case"lineEndingBlank":{ze[0]==="enter"&&(ce&&!Re&&!Ae&&!ve&&(ve=Se),Re=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Re=void 0}if(!Ae&&ze[0]==="enter"&&ze[1].type==="listItemPrefix"||Ae===-1&&ze[0]==="exit"&&(ze[1].type==="listUnordered"||ze[1].type==="listOrdered")){if(ce){let Ot=Se;for(ee=void 0;Ot--;){const It=se[Ot];if(It[1].type==="lineEnding"||It[1].type==="lineEndingBlank"){if(It[0]==="exit")continue;ee&&(se[ee][1].type="lineEndingBlank",Xe=!0),It[1].type="lineEnding",ee=Ot}else if(!(It[1].type==="linePrefix"||It[1].type==="blockQuotePrefix"||It[1].type==="blockQuotePrefixWhitespace"||It[1].type==="blockQuoteMarker"||It[1].type==="listItemIndent"))break}ve&&(!ee||ve<ee)&&(ce._spread=!0),ce.end=Object.assign({},ee?se[ee][1].start:ze[1].end),se.splice(ee||Se,0,["exit",ce,ze[2]]),Se++,he++}if(ze[1].type==="listItemPrefix"){const Ot={type:"listItem",_spread:!1,start:Object.assign({},ze[1].start),end:void 0};ce=Ot,se.splice(Se,0,["enter",Ot,ze[2]]),Se++,he++,ve=void 0,Re=!0}}}return se[ie][1]._spread=Xe,he}function c(se,ie){return he;function he(Se){f.call(this,se(Se),Se),ie&&ie.call(this,Se)}}function d(){this.stack.push({type:"fragment",children:[]})}function f(se,ie,he){this.stack[this.stack.length-1].children.push(se),this.stack.push(se),this.tokenStack.push([ie,he||void 0]),se.position={start:ir(ie.start),end:void 0}}function h(se){return ie;function ie(he){se&&se.call(this,he),m.call(this,he)}}function m(se,ie){const he=this.stack.pop(),Se=this.tokenStack.pop();if(Se)Se[0].type!==se.type&&(ie?ie.call(this,se,Se[0]):(Se[1]||Zx).call(this,se,Se[0]));else throw new Error("Cannot close `"+se.type+"` ("+es({start:se.start,end:se.end})+"): it’s not open");he.position.end=ir(se.end)}function g(){return Hm(this.stack.pop())}function y(){this.data.expectingFirstListItemValue=!0}function b(se){if(this.data.expectingFirstListItemValue){const ie=this.stack[this.stack.length-2];ie.start=Number.parseInt(this.sliceSerialize(se),10),this.data.expectingFirstListItemValue=void 0}}function w(){const se=this.resume(),ie=this.stack[this.stack.length-1];ie.lang=se}function N(){const se=this.resume(),ie=this.stack[this.stack.length-1];ie.meta=se}function A(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function j(){const se=this.resume(),ie=this.stack[this.stack.length-1];ie.value=se.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function T(){const se=this.resume(),ie=this.stack[this.stack.length-1];ie.value=se.replace(/(\r?\n|\r)$/g,"")}function I(se){const ie=this.resume(),he=this.stack[this.stack.length-1];he.label=ie,he.identifier=Zn(this.sliceSerialize(se)).toLowerCase()}function M(){const se=this.resume(),ie=this.stack[this.stack.length-1];ie.title=se}function _(){const se=this.resume(),ie=this.stack[this.stack.length-1];ie.url=se}function $(se){const ie=this.stack[this.stack.length-1];if(!ie.depth){const he=this.sliceSerialize(se).length;ie.depth=he}}function U(){this.data.setextHeadingSlurpLineEnding=!0}function Y(se){const ie=this.stack[this.stack.length-1];ie.depth=this.sliceSerialize(se).codePointAt(0)===61?1:2}function W(){this.data.setextHeadingSlurpLineEnding=void 0}function J(se){const he=this.stack[this.stack.length-1].children;let Se=he[he.length-1];(!Se||Se.type!=="text")&&(Se=ct(),Se.position={start:ir(se.start),end:void 0},he.push(Se)),this.stack.push(Se)}function P(se){const ie=this.stack.pop();ie.value+=this.sliceSerialize(se),ie.position.end=ir(se.end)}function K(se){const ie=this.stack[this.stack.length-1];if(this.data.atHardBreak){const he=ie.children[ie.children.length-1];he.position.end=ir(se.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&a.canContainEols.includes(ie.type)&&(J.call(this,se),P.call(this,se))}function D(){this.data.atHardBreak=!0}function O(){const se=this.resume(),ie=this.stack[this.stack.length-1];ie.value=se}function te(){const se=this.resume(),ie=this.stack[this.stack.length-1];ie.value=se}function F(){const se=this.resume(),ie=this.stack[this.stack.length-1];ie.value=se}function L(){const se=this.stack[this.stack.length-1];if(this.data.inReference){const ie=this.data.referenceType||"shortcut";se.type+="Reference",se.referenceType=ie,delete se.url,delete se.title}else delete se.identifier,delete se.label;this.data.referenceType=void 0}function ae(){const se=this.stack[this.stack.length-1];if(this.data.inReference){const ie=this.data.referenceType||"shortcut";se.type+="Reference",se.referenceType=ie,delete se.url,delete se.title}else delete se.identifier,delete se.label;this.data.referenceType=void 0}function ne(se){const ie=this.sliceSerialize(se),he=this.stack[this.stack.length-2];he.label=yC(ie),he.identifier=Zn(ie).toLowerCase()}function xe(){const se=this.stack[this.stack.length-1],ie=this.resume(),he=this.stack[this.stack.length-1];if(this.data.inReference=!0,he.type==="link"){const Se=se.children;he.children=Se}else he.alt=ie}function R(){const se=this.resume(),ie=this.stack[this.stack.length-1];ie.url=se}function z(){const se=this.resume(),ie=this.stack[this.stack.length-1];ie.title=se}function B(){this.data.inReference=void 0}function C(){this.data.referenceType="collapsed"}function G(se){const ie=this.resume(),he=this.stack[this.stack.length-1];he.label=ie,he.identifier=Zn(this.sliceSerialize(se)).toLowerCase(),this.data.referenceType="full"}function re(se){this.data.characterReferenceType=se.type}function ue(se){const ie=this.sliceSerialize(se),he=this.data.characterReferenceType;let Se;he?(Se=yv(ie,he==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Se=Pm(ie);const Ae=this.stack[this.stack.length-1];Ae.value+=Se}function ge(se){const ie=this.stack.pop();ie.position.end=ir(se.end)}function we(se){P.call(this,se);const ie=this.stack[this.stack.length-1];ie.url=this.sliceSerialize(se)}function Ne(se){P.call(this,se);const ie=this.stack[this.stack.length-1];ie.url="mailto:"+this.sliceSerialize(se)}function ye(){return{type:"blockquote",children:[]}}function Me(){return{type:"code",lang:null,meta:null,value:""}}function Je(){return{type:"inlineCode",value:""}}function Kt(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Lt(){return{type:"emphasis",children:[]}}function qt(){return{type:"heading",depth:0,children:[]}}function Tt(){return{type:"break"}}function fn(){return{type:"html",value:""}}function Jt(){return{type:"image",title:null,url:"",alt:null}}function kt(){return{type:"link",title:null,url:"",children:[]}}function Rt(se){return{type:"list",ordered:se.type==="listOrdered",start:null,spread:se._spread,children:[]}}function en(se){return{type:"listItem",spread:se._spread,checked:null,children:[]}}function mn(){return{type:"paragraph",children:[]}}function Wt(){return{type:"strong",children:[]}}function ct(){return{type:"text",value:""}}function Vn(){return{type:"thematicBreak"}}}function ir(e){return{line:e.line,column:e.column,offset:e.offset}}function Mv(e,a){let r=-1;for(;++r<a.length;){const i=a[r];Array.isArray(i)?Mv(e,i):wC(e,i)}}function wC(e,a){let r;for(r in a)if(Tv.call(a,r))switch(r){case"canContainEols":{const i=a[r];i&&e[r].push(...i);break}case"transforms":{const i=a[r];i&&e[r].push(...i);break}case"enter":case"exit":{const i=a[r];i&&Object.assign(e[r],i);break}}}function Zx(e,a){throw e?new Error("Cannot close `"+e.type+"` ("+es({start:e.start,end:e.end})+"): a different token (`"+a.type+"`, "+es({start:a.start,end:a.end})+") is open"):new Error("Cannot close document, a token (`"+a.type+"`, "+es({start:a.start,end:a.end})+") is still open")}function SC(e){const a=this;a.parser=r;function r(i){return bC(i,{...a.data("settings"),...e,extensions:a.data("micromarkExtensions")||[],mdastExtensions:a.data("fromMarkdownExtensions")||[]})}}function jC(e,a){const r={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(a),!0)};return e.patch(a,r),e.applyData(a,r)}function NC(e,a){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(a,r),[e.applyData(a,r),{type:"text",value:`
|
|
17
|
+
`}]}function CC(e,a){const r=a.value?a.value+`
|
|
18
|
+
`:"",i={},o=a.lang?a.lang.split(/\s+/):[];o.length>0&&(i.className=["language-"+o[0]]);let c={type:"element",tagName:"code",properties:i,children:[{type:"text",value:r}]};return a.meta&&(c.data={meta:a.meta}),e.patch(a,c),c=e.applyData(a,c),c={type:"element",tagName:"pre",properties:{},children:[c]},e.patch(a,c),c}function EC(e,a){const r={type:"element",tagName:"del",properties:{},children:e.all(a)};return e.patch(a,r),e.applyData(a,r)}function TC(e,a){const r={type:"element",tagName:"em",properties:{},children:e.all(a)};return e.patch(a,r),e.applyData(a,r)}function MC(e,a){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=String(a.identifier).toUpperCase(),o=Vl(i.toLowerCase()),c=e.footnoteOrder.indexOf(i);let d,f=e.footnoteCounts.get(i);f===void 0?(f=0,e.footnoteOrder.push(i),d=e.footnoteOrder.length):d=c+1,f+=1,e.footnoteCounts.set(i,f);const h={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+o,id:r+"fnref-"+o+(f>1?"-"+f:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(d)}]};e.patch(a,h);const m={type:"element",tagName:"sup",properties:{},children:[h]};return e.patch(a,m),e.applyData(a,m)}function AC(e,a){const r={type:"element",tagName:"h"+a.depth,properties:{},children:e.all(a)};return e.patch(a,r),e.applyData(a,r)}function RC(e,a){if(e.options.allowDangerousHtml){const r={type:"raw",value:a.value};return e.patch(a,r),e.applyData(a,r)}}function Av(e,a){const r=a.referenceType;let i="]";if(r==="collapsed"?i+="[]":r==="full"&&(i+="["+(a.label||a.identifier)+"]"),a.type==="imageReference")return[{type:"text",value:"!["+a.alt+i}];const o=e.all(a),c=o[0];c&&c.type==="text"?c.value="["+c.value:o.unshift({type:"text",value:"["});const d=o[o.length-1];return d&&d.type==="text"?d.value+=i:o.push({type:"text",value:i}),o}function _C(e,a){const r=String(a.identifier).toUpperCase(),i=e.definitionById.get(r);if(!i)return Av(e,a);const o={src:Vl(i.url||""),alt:a.alt};i.title!==null&&i.title!==void 0&&(o.title=i.title);const c={type:"element",tagName:"img",properties:o,children:[]};return e.patch(a,c),e.applyData(a,c)}function zC(e,a){const r={src:Vl(a.url)};a.alt!==null&&a.alt!==void 0&&(r.alt=a.alt),a.title!==null&&a.title!==void 0&&(r.title=a.title);const i={type:"element",tagName:"img",properties:r,children:[]};return e.patch(a,i),e.applyData(a,i)}function DC(e,a){const r={type:"text",value:a.value.replace(/\r?\n|\r/g," ")};e.patch(a,r);const i={type:"element",tagName:"code",properties:{},children:[r]};return e.patch(a,i),e.applyData(a,i)}function LC(e,a){const r=String(a.identifier).toUpperCase(),i=e.definitionById.get(r);if(!i)return Av(e,a);const o={href:Vl(i.url||"")};i.title!==null&&i.title!==void 0&&(o.title=i.title);const c={type:"element",tagName:"a",properties:o,children:e.all(a)};return e.patch(a,c),e.applyData(a,c)}function OC(e,a){const r={href:Vl(a.url)};a.title!==null&&a.title!==void 0&&(r.title=a.title);const i={type:"element",tagName:"a",properties:r,children:e.all(a)};return e.patch(a,i),e.applyData(a,i)}function IC(e,a,r){const i=e.all(a),o=r?UC(r):Rv(a),c={},d=[];if(typeof a.checked=="boolean"){const g=i[0];let y;g&&g.type==="element"&&g.tagName==="p"?y=g:(y={type:"element",tagName:"p",properties:{},children:[]},i.unshift(y)),y.children.length>0&&y.children.unshift({type:"text",value:" "}),y.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:a.checked,disabled:!0},children:[]}),c.className=["task-list-item"]}let f=-1;for(;++f<i.length;){const g=i[f];(o||f!==0||g.type!=="element"||g.tagName!=="p")&&d.push({type:"text",value:`
|
|
19
|
+
`}),g.type==="element"&&g.tagName==="p"&&!o?d.push(...g.children):d.push(g)}const h=i[i.length-1];h&&(o||h.type!=="element"||h.tagName!=="p")&&d.push({type:"text",value:`
|
|
20
|
+
`});const m={type:"element",tagName:"li",properties:c,children:d};return e.patch(a,m),e.applyData(a,m)}function UC(e){let a=!1;if(e.type==="list"){a=e.spread||!1;const r=e.children;let i=-1;for(;!a&&++i<r.length;)a=Rv(r[i])}return a}function Rv(e){const a=e.spread;return a??e.children.length>1}function $C(e,a){const r={},i=e.all(a);let o=-1;for(typeof a.start=="number"&&a.start!==1&&(r.start=a.start);++o<i.length;){const d=i[o];if(d.type==="element"&&d.tagName==="li"&&d.properties&&Array.isArray(d.properties.className)&&d.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}const c={type:"element",tagName:a.ordered?"ol":"ul",properties:r,children:e.wrap(i,!0)};return e.patch(a,c),e.applyData(a,c)}function BC(e,a){const r={type:"element",tagName:"p",properties:{},children:e.all(a)};return e.patch(a,r),e.applyData(a,r)}function HC(e,a){const r={type:"root",children:e.wrap(e.all(a))};return e.patch(a,r),e.applyData(a,r)}function PC(e,a){const r={type:"element",tagName:"strong",properties:{},children:e.all(a)};return e.patch(a,r),e.applyData(a,r)}function qC(e,a){const r=e.all(a),i=r.shift(),o=[];if(i){const d={type:"element",tagName:"thead",properties:{},children:e.wrap([i],!0)};e.patch(a.children[0],d),o.push(d)}if(r.length>0){const d={type:"element",tagName:"tbody",properties:{},children:e.wrap(r,!0)},f=Im(a.children[1]),h=cv(a.children[a.children.length-1]);f&&h&&(d.position={start:f,end:h}),o.push(d)}const c={type:"element",tagName:"table",properties:{},children:e.wrap(o,!0)};return e.patch(a,c),e.applyData(a,c)}function FC(e,a,r){const i=r?r.children:void 0,c=(i?i.indexOf(a):1)===0?"th":"td",d=r&&r.type==="table"?r.align:void 0,f=d?d.length:a.children.length;let h=-1;const m=[];for(;++h<f;){const y=a.children[h],b={},w=d?d[h]:void 0;w&&(b.align=w);let N={type:"element",tagName:c,properties:b,children:[]};y&&(N.children=e.all(y),e.patch(y,N),N=e.applyData(y,N)),m.push(N)}const g={type:"element",tagName:"tr",properties:{},children:e.wrap(m,!0)};return e.patch(a,g),e.applyData(a,g)}function VC(e,a){const r={type:"element",tagName:"td",properties:{},children:e.all(a)};return e.patch(a,r),e.applyData(a,r)}const Jx=9,ey=32;function YC(e){const a=String(e),r=/\r?\n|\r/g;let i=r.exec(a),o=0;const c=[];for(;i;)c.push(ty(a.slice(o,i.index),o>0,!0),i[0]),o=i.index+i[0].length,i=r.exec(a);return c.push(ty(a.slice(o),o>0,!1)),c.join("")}function ty(e,a,r){let i=0,o=e.length;if(a){let c=e.codePointAt(i);for(;c===Jx||c===ey;)i++,c=e.codePointAt(i)}if(r){let c=e.codePointAt(o-1);for(;c===Jx||c===ey;)o--,c=e.codePointAt(o-1)}return o>i?e.slice(i,o):""}function GC(e,a){const r={type:"text",value:YC(String(a.value))};return e.patch(a,r),e.applyData(a,r)}function KC(e,a){const r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(a,r),e.applyData(a,r)}const WC={blockquote:jC,break:NC,code:CC,delete:EC,emphasis:TC,footnoteReference:MC,heading:AC,html:RC,imageReference:_C,image:zC,inlineCode:DC,linkReference:LC,link:OC,listItem:IC,list:$C,paragraph:BC,root:HC,strong:PC,table:qC,tableCell:VC,tableRow:FC,text:GC,thematicBreak:KC,toml:Io,yaml:Io,definition:Io,footnoteDefinition:Io};function Io(){}const _v=-1,Au=0,ns=1,hu=2,Fm=3,Vm=4,Ym=5,Gm=6,zv=7,Dv=8,XC=typeof self=="object"?self:globalThis,ny=(e,a)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new XC[e](a)},QC=(e,a)=>{const r=(o,c)=>(e.set(c,o),o),i=o=>{if(e.has(o))return e.get(o);const[c,d]=a[o];switch(c){case Au:case _v:return r(d,o);case ns:{const f=r([],o);for(const h of d)f.push(i(h));return f}case hu:{const f=r({},o);for(const[h,m]of d)f[i(h)]=i(m);return f}case Fm:return r(new Date(d),o);case Vm:{const{source:f,flags:h}=d;return r(new RegExp(f,h),o)}case Ym:{const f=r(new Map,o);for(const[h,m]of d)f.set(i(h),i(m));return f}case Gm:{const f=r(new Set,o);for(const h of d)f.add(i(h));return f}case zv:{const{name:f,message:h}=d;return r(ny(f,h),o)}case Dv:return r(BigInt(d),o);case"BigInt":return r(Object(BigInt(d)),o);case"ArrayBuffer":return r(new Uint8Array(d).buffer,d);case"DataView":{const{buffer:f}=new Uint8Array(d);return r(new DataView(f),d)}}return r(ny(c,d),o)};return i},ay=e=>QC(new Map,e)(0),Or="",{toString:ZC}={},{keys:JC}=Object,Fi=e=>{const a=typeof e;if(a!=="object"||!e)return[Au,a];const r=ZC.call(e).slice(8,-1);switch(r){case"Array":return[ns,Or];case"Object":return[hu,Or];case"Date":return[Fm,Or];case"RegExp":return[Vm,Or];case"Map":return[Ym,Or];case"Set":return[Gm,Or];case"DataView":return[ns,r]}return r.includes("Array")?[ns,r]:r.includes("Error")?[zv,r]:[hu,r]},Uo=([e,a])=>e===Au&&(a==="function"||a==="symbol"),e3=(e,a,r,i)=>{const o=(d,f)=>{const h=i.push(d)-1;return r.set(f,h),h},c=d=>{if(r.has(d))return r.get(d);let[f,h]=Fi(d);switch(f){case Au:{let g=d;switch(h){case"bigint":f=Dv,g=d.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+h);g=null;break;case"undefined":return o([_v],d)}return o([f,g],d)}case ns:{if(h){let b=d;return h==="DataView"?b=new Uint8Array(d.buffer):h==="ArrayBuffer"&&(b=new Uint8Array(d)),o([h,[...b]],d)}const g=[],y=o([f,g],d);for(const b of d)g.push(c(b));return y}case hu:{if(h)switch(h){case"BigInt":return o([h,d.toString()],d);case"Boolean":case"Number":case"String":return o([h,d.valueOf()],d)}if(a&&"toJSON"in d)return c(d.toJSON());const g=[],y=o([f,g],d);for(const b of JC(d))(e||!Uo(Fi(d[b])))&&g.push([c(b),c(d[b])]);return y}case Fm:return o([f,isNaN(d.getTime())?Or:d.toISOString()],d);case Vm:{const{source:g,flags:y}=d;return o([f,{source:g,flags:y}],d)}case Ym:{const g=[],y=o([f,g],d);for(const[b,w]of d)(e||!(Uo(Fi(b))||Uo(Fi(w))))&&g.push([c(b),c(w)]);return y}case Gm:{const g=[],y=o([f,g],d);for(const b of d)(e||!Uo(Fi(b)))&&g.push(c(b));return y}}const{message:m}=d;return o([f,{name:h,message:m}],d)};return c},ry=(e,{json:a,lossy:r}={})=>{const i=[];return e3(!(a||r),!!a,new Map,i)(e),i},pu=typeof structuredClone=="function"?(e,a)=>a&&("json"in a||"lossy"in a)?ay(ry(e,a)):structuredClone(e):(e,a)=>ay(ry(e,a));function t3(e,a){const r=[{type:"text",value:"↩"}];return a>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(a)}]}),r}function n3(e,a){return"Back to reference "+(e+1)+(a>1?"-"+a:"")}function a3(e){const a=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||t3,i=e.options.footnoteBackLabel||n3,o=e.options.footnoteLabel||"Footnotes",c=e.options.footnoteLabelTagName||"h2",d=e.options.footnoteLabelProperties||{className:["sr-only"]},f=[];let h=-1;for(;++h<e.footnoteOrder.length;){const m=e.footnoteById.get(e.footnoteOrder[h]);if(!m)continue;const g=e.all(m),y=String(m.identifier).toUpperCase(),b=Vl(y.toLowerCase());let w=0;const N=[],A=e.footnoteCounts.get(y);for(;A!==void 0&&++w<=A;){N.length>0&&N.push({type:"text",value:" "});let I=typeof r=="string"?r:r(h,w);typeof I=="string"&&(I={type:"text",value:I}),N.push({type:"element",tagName:"a",properties:{href:"#"+a+"fnref-"+b+(w>1?"-"+w:""),dataFootnoteBackref:"",ariaLabel:typeof i=="string"?i:i(h,w),className:["data-footnote-backref"]},children:Array.isArray(I)?I:[I]})}const j=g[g.length-1];if(j&&j.type==="element"&&j.tagName==="p"){const I=j.children[j.children.length-1];I&&I.type==="text"?I.value+=" ":j.children.push({type:"text",value:" "}),j.children.push(...N)}else g.push(...N);const T={type:"element",tagName:"li",properties:{id:a+"fn-"+b},children:e.wrap(g,!0)};e.patch(m,T),f.push(T)}if(f.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:c,properties:{...pu(d),id:"footnote-label"},children:[{type:"text",value:o}]},{type:"text",value:`
|
|
21
|
+
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(f,!0)},{type:"text",value:`
|
|
22
|
+
`}]}}const Ru=(function(e){if(e==null)return s3;if(typeof e=="function")return _u(e);if(typeof e=="object")return Array.isArray(e)?r3(e):l3(e);if(typeof e=="string")return i3(e);throw new Error("Expected function, string, or object as test")});function r3(e){const a=[];let r=-1;for(;++r<e.length;)a[r]=Ru(e[r]);return _u(i);function i(...o){let c=-1;for(;++c<a.length;)if(a[c].apply(this,o))return!0;return!1}}function l3(e){const a=e;return _u(r);function r(i){const o=i;let c;for(c in e)if(o[c]!==a[c])return!1;return!0}}function i3(e){return _u(a);function a(r){return r&&r.type===e}}function _u(e){return a;function a(r,i,o){return!!(o3(r)&&e.call(this,r,typeof i=="number"?i:void 0,o||void 0))}}function s3(){return!0}function o3(e){return e!==null&&typeof e=="object"&&"type"in e}const Lv=[],u3=!0,am=!1,c3="skip";function Ov(e,a,r,i){let o;typeof a=="function"&&typeof r!="function"?(i=r,r=a):o=a;const c=Ru(o),d=i?-1:1;f(e,void 0,[])();function f(h,m,g){const y=h&&typeof h=="object"?h:{};if(typeof y.type=="string"){const w=typeof y.tagName=="string"?y.tagName:typeof y.name=="string"?y.name:void 0;Object.defineProperty(b,"name",{value:"node ("+(h.type+(w?"<"+w+">":""))+")"})}return b;function b(){let w=Lv,N,A,j;if((!a||c(h,m,g[g.length-1]||void 0))&&(w=d3(r(h,g)),w[0]===am))return w;if("children"in h&&h.children){const T=h;if(T.children&&w[0]!==c3)for(A=(i?T.children.length:-1)+d,j=g.concat(T);A>-1&&A<T.children.length;){const I=T.children[A];if(N=f(I,A,j)(),N[0]===am)return N;A=typeof N[1]=="number"?N[1]:A+d}}return w}}}function d3(e){return Array.isArray(e)?e:typeof e=="number"?[u3,e]:e==null?Lv:[e]}function Km(e,a,r,i){let o,c,d;typeof a=="function"&&typeof r!="function"?(c=void 0,d=a,o=r):(c=a,d=r,o=i),Ov(e,c,f,o);function f(h,m){const g=m[m.length-1],y=g?g.children.indexOf(h):void 0;return d(h,y,g)}}const rm={}.hasOwnProperty,f3={};function m3(e,a){const r=a||f3,i=new Map,o=new Map,c=new Map,d={...WC,...r.handlers},f={all:m,applyData:p3,definitionById:i,footnoteById:o,footnoteCounts:c,footnoteOrder:[],handlers:d,one:h,options:r,patch:h3,wrap:x3};return Km(e,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const y=g.type==="definition"?i:o,b=String(g.identifier).toUpperCase();y.has(b)||y.set(b,g)}}),f;function h(g,y){const b=g.type,w=f.handlers[b];if(rm.call(f.handlers,b)&&w)return w(f,g,y);if(f.options.passThrough&&f.options.passThrough.includes(b)){if("children"in g){const{children:A,...j}=g,T=pu(j);return T.children=f.all(g),T}return pu(g)}return(f.options.unknownHandler||g3)(f,g,y)}function m(g){const y=[];if("children"in g){const b=g.children;let w=-1;for(;++w<b.length;){const N=f.one(b[w],g);if(N){if(w&&b[w-1].type==="break"&&(!Array.isArray(N)&&N.type==="text"&&(N.value=ly(N.value)),!Array.isArray(N)&&N.type==="element")){const A=N.children[0];A&&A.type==="text"&&(A.value=ly(A.value))}Array.isArray(N)?y.push(...N):y.push(N)}}}return y}}function h3(e,a){e.position&&(a.position=tN(e))}function p3(e,a){let r=a;if(e&&e.data){const i=e.data.hName,o=e.data.hChildren,c=e.data.hProperties;if(typeof i=="string")if(r.type==="element")r.tagName=i;else{const d="children"in r?r.children:[r];r={type:"element",tagName:i,properties:{},children:d}}r.type==="element"&&c&&Object.assign(r.properties,pu(c)),"children"in r&&r.children&&o!==null&&o!==void 0&&(r.children=o)}return r}function g3(e,a){const r=a.data||{},i="value"in a&&!(rm.call(r,"hProperties")||rm.call(r,"hChildren"))?{type:"text",value:a.value}:{type:"element",tagName:"div",properties:{},children:e.all(a)};return e.patch(a,i),e.applyData(a,i)}function x3(e,a){const r=[];let i=-1;for(a&&r.push({type:"text",value:`
|
|
23
|
+
`});++i<e.length;)i&&r.push({type:"text",value:`
|
|
24
|
+
`}),r.push(e[i]);return a&&e.length>0&&r.push({type:"text",value:`
|
|
25
|
+
`}),r}function ly(e){let a=0,r=e.charCodeAt(a);for(;r===9||r===32;)a++,r=e.charCodeAt(a);return e.slice(a)}function iy(e,a){const r=m3(e,a),i=r.one(e,void 0),o=a3(r),c=Array.isArray(i)?{type:"root",children:i}:i||{type:"root",children:[]};return o&&c.children.push({type:"text",value:`
|
|
26
|
+
`},o),c}function y3(e,a){return e&&"run"in e?async function(r,i){const o=iy(r,{file:i,...a});await e.run(o,i)}:function(r,i){return iy(r,{file:i,...e||a})}}function sy(e){if(e)throw e}var ff,oy;function v3(){if(oy)return ff;oy=1;var e=Object.prototype.hasOwnProperty,a=Object.prototype.toString,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,o=function(m){return typeof Array.isArray=="function"?Array.isArray(m):a.call(m)==="[object Array]"},c=function(m){if(!m||a.call(m)!=="[object Object]")return!1;var g=e.call(m,"constructor"),y=m.constructor&&m.constructor.prototype&&e.call(m.constructor.prototype,"isPrototypeOf");if(m.constructor&&!g&&!y)return!1;var b;for(b in m);return typeof b>"u"||e.call(m,b)},d=function(m,g){r&&g.name==="__proto__"?r(m,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):m[g.name]=g.newValue},f=function(m,g){if(g==="__proto__")if(e.call(m,g)){if(i)return i(m,g).value}else return;return m[g]};return ff=function h(){var m,g,y,b,w,N,A=arguments[0],j=1,T=arguments.length,I=!1;for(typeof A=="boolean"&&(I=A,A=arguments[1]||{},j=2),(A==null||typeof A!="object"&&typeof A!="function")&&(A={});j<T;++j)if(m=arguments[j],m!=null)for(g in m)y=f(A,g),b=f(m,g),A!==b&&(I&&b&&(c(b)||(w=o(b)))?(w?(w=!1,N=y&&o(y)?y:[]):N=y&&c(y)?y:{},d(A,{name:g,newValue:h(I,N,b)})):typeof b<"u"&&d(A,{name:g,newValue:b}));return A},ff}var b3=v3();const mf=s1(b3);function lm(e){if(typeof e!="object"||e===null)return!1;const a=Object.getPrototypeOf(e);return(a===null||a===Object.prototype||Object.getPrototypeOf(a)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function k3(){const e=[],a={run:r,use:i};return a;function r(...o){let c=-1;const d=o.pop();if(typeof d!="function")throw new TypeError("Expected function as last argument, not "+d);f(null,...o);function f(h,...m){const g=e[++c];let y=-1;if(h){d(h);return}for(;++y<o.length;)(m[y]===null||m[y]===void 0)&&(m[y]=o[y]);o=m,g?w3(g,f)(...m):d(null,...m)}}function i(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return e.push(o),a}}function w3(e,a){let r;return i;function i(...d){const f=e.length>d.length;let h;f&&d.push(o);try{h=e.apply(this,d)}catch(m){const g=m;if(f&&r)throw g;return o(g)}f||(h&&h.then&&typeof h.then=="function"?h.then(c,o):h instanceof Error?o(h):c(h))}function o(d,...f){r||(r=!0,a(d,...f))}function c(d){o(null,d)}}const ra={basename:S3,dirname:j3,extname:N3,join:C3,sep:"/"};function S3(e,a){if(a!==void 0&&typeof a!="string")throw new TypeError('"ext" argument must be a string');xs(e);let r=0,i=-1,o=e.length,c;if(a===void 0||a.length===0||a.length>e.length){for(;o--;)if(e.codePointAt(o)===47){if(c){r=o+1;break}}else i<0&&(c=!0,i=o+1);return i<0?"":e.slice(r,i)}if(a===e)return"";let d=-1,f=a.length-1;for(;o--;)if(e.codePointAt(o)===47){if(c){r=o+1;break}}else d<0&&(c=!0,d=o+1),f>-1&&(e.codePointAt(o)===a.codePointAt(f--)?f<0&&(i=o):(f=-1,i=d));return r===i?i=d:i<0&&(i=e.length),e.slice(r,i)}function j3(e){if(xs(e),e.length===0)return".";let a=-1,r=e.length,i;for(;--r;)if(e.codePointAt(r)===47){if(i){a=r;break}}else i||(i=!0);return a<0?e.codePointAt(0)===47?"/":".":a===1&&e.codePointAt(0)===47?"//":e.slice(0,a)}function N3(e){xs(e);let a=e.length,r=-1,i=0,o=-1,c=0,d;for(;a--;){const f=e.codePointAt(a);if(f===47){if(d){i=a+1;break}continue}r<0&&(d=!0,r=a+1),f===46?o<0?o=a:c!==1&&(c=1):o>-1&&(c=-1)}return o<0||r<0||c===0||c===1&&o===r-1&&o===i+1?"":e.slice(o,r)}function C3(...e){let a=-1,r;for(;++a<e.length;)xs(e[a]),e[a]&&(r=r===void 0?e[a]:r+"/"+e[a]);return r===void 0?".":E3(r)}function E3(e){xs(e);const a=e.codePointAt(0)===47;let r=T3(e,!a);return r.length===0&&!a&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),a?"/"+r:r}function T3(e,a){let r="",i=0,o=-1,c=0,d=-1,f,h;for(;++d<=e.length;){if(d<e.length)f=e.codePointAt(d);else{if(f===47)break;f=47}if(f===47){if(!(o===d-1||c===1))if(o!==d-1&&c===2){if(r.length<2||i!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(h=r.lastIndexOf("/"),h!==r.length-1){h<0?(r="",i=0):(r=r.slice(0,h),i=r.length-1-r.lastIndexOf("/")),o=d,c=0;continue}}else if(r.length>0){r="",i=0,o=d,c=0;continue}}a&&(r=r.length>0?r+"/..":"..",i=2)}else r.length>0?r+="/"+e.slice(o+1,d):r=e.slice(o+1,d),i=d-o-1;o=d,c=0}else f===46&&c>-1?c++:c=-1}return r}function xs(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const M3={cwd:A3};function A3(){return"/"}function im(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function R3(e){if(typeof e=="string")e=new URL(e);else if(!im(e)){const a=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw a.code="ERR_INVALID_ARG_TYPE",a}if(e.protocol!=="file:"){const a=new TypeError("The URL must be of scheme file");throw a.code="ERR_INVALID_URL_SCHEME",a}return _3(e)}function _3(e){if(e.hostname!==""){const i=new TypeError('File URL host must be "localhost" or empty on darwin');throw i.code="ERR_INVALID_FILE_URL_HOST",i}const a=e.pathname;let r=-1;for(;++r<a.length;)if(a.codePointAt(r)===37&&a.codePointAt(r+1)===50){const i=a.codePointAt(r+2);if(i===70||i===102){const o=new TypeError("File URL path must not include encoded / characters");throw o.code="ERR_INVALID_FILE_URL_PATH",o}}return decodeURIComponent(a)}const hf=["history","path","basename","stem","extname","dirname"];class Iv{constructor(a){let r;a?im(a)?r={path:a}:typeof a=="string"||z3(a)?r={value:a}:r=a:r={},this.cwd="cwd"in r?"":M3.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let i=-1;for(;++i<hf.length;){const c=hf[i];c in r&&r[c]!==void 0&&r[c]!==null&&(this[c]=c==="history"?[...r[c]]:r[c])}let o;for(o in r)hf.includes(o)||(this[o]=r[o])}get basename(){return typeof this.path=="string"?ra.basename(this.path):void 0}set basename(a){gf(a,"basename"),pf(a,"basename"),this.path=ra.join(this.dirname||"",a)}get dirname(){return typeof this.path=="string"?ra.dirname(this.path):void 0}set dirname(a){uy(this.basename,"dirname"),this.path=ra.join(a||"",this.basename)}get extname(){return typeof this.path=="string"?ra.extname(this.path):void 0}set extname(a){if(pf(a,"extname"),uy(this.dirname,"extname"),a){if(a.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(a.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=ra.join(this.dirname,this.stem+(a||""))}get path(){return this.history[this.history.length-1]}set path(a){im(a)&&(a=R3(a)),gf(a,"path"),this.path!==a&&this.history.push(a)}get stem(){return typeof this.path=="string"?ra.basename(this.path,this.extname):void 0}set stem(a){gf(a,"stem"),pf(a,"stem"),this.path=ra.join(this.dirname||"",a+(this.extname||""))}fail(a,r,i){const o=this.message(a,r,i);throw o.fatal=!0,o}info(a,r,i){const o=this.message(a,r,i);return o.fatal=void 0,o}message(a,r,i){const o=new Gt(a,r,i);return this.path&&(o.name=this.path+":"+o.name,o.file=this.path),o.fatal=!1,this.messages.push(o),o}toString(a){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(a||void 0).decode(this.value)}}function pf(e,a){if(e&&e.includes(ra.sep))throw new Error("`"+a+"` cannot be a path: did not expect `"+ra.sep+"`")}function gf(e,a){if(!e)throw new Error("`"+a+"` cannot be empty")}function uy(e,a){if(!e)throw new Error("Setting `"+a+"` requires `path` to be set too")}function z3(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const D3=(function(e){const i=this.constructor.prototype,o=i[e],c=function(){return o.apply(c,arguments)};return Object.setPrototypeOf(c,i),c}),L3={}.hasOwnProperty;class Wm extends D3{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=k3()}copy(){const a=new Wm;let r=-1;for(;++r<this.attachers.length;){const i=this.attachers[r];a.use(...i)}return a.data(mf(!0,{},this.namespace)),a}data(a,r){return typeof a=="string"?arguments.length===2?(vf("data",this.frozen),this.namespace[a]=r,this):L3.call(this.namespace,a)&&this.namespace[a]||void 0:a?(vf("data",this.frozen),this.namespace=a,this):this.namespace}freeze(){if(this.frozen)return this;const a=this;for(;++this.freezeIndex<this.attachers.length;){const[r,...i]=this.attachers[this.freezeIndex];if(i[0]===!1)continue;i[0]===!0&&(i[0]=void 0);const o=r.call(a,...i);typeof o=="function"&&this.transformers.use(o)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(a){this.freeze();const r=$o(a),i=this.parser||this.Parser;return xf("parse",i),i(String(r),r)}process(a,r){const i=this;return this.freeze(),xf("process",this.parser||this.Parser),yf("process",this.compiler||this.Compiler),r?o(void 0,r):new Promise(o);function o(c,d){const f=$o(a),h=i.parse(f);i.run(h,f,function(g,y,b){if(g||!y||!b)return m(g);const w=y,N=i.stringify(w,b);U3(N)?b.value=N:b.result=N,m(g,b)});function m(g,y){g||!y?d(g):c?c(y):r(void 0,y)}}}processSync(a){let r=!1,i;return this.freeze(),xf("processSync",this.parser||this.Parser),yf("processSync",this.compiler||this.Compiler),this.process(a,o),dy("processSync","process",r),i;function o(c,d){r=!0,sy(c),i=d}}run(a,r,i){cy(a),this.freeze();const o=this.transformers;return!i&&typeof r=="function"&&(i=r,r=void 0),i?c(void 0,i):new Promise(c);function c(d,f){const h=$o(r);o.run(a,h,m);function m(g,y,b){const w=y||a;g?f(g):d?d(w):i(void 0,w,b)}}}runSync(a,r){let i=!1,o;return this.run(a,r,c),dy("runSync","run",i),o;function c(d,f){sy(d),o=f,i=!0}}stringify(a,r){this.freeze();const i=$o(r),o=this.compiler||this.Compiler;return yf("stringify",o),cy(a),o(a,i)}use(a,...r){const i=this.attachers,o=this.namespace;if(vf("use",this.frozen),a!=null)if(typeof a=="function")h(a,r);else if(typeof a=="object")Array.isArray(a)?f(a):d(a);else throw new TypeError("Expected usable value, not `"+a+"`");return this;function c(m){if(typeof m=="function")h(m,[]);else if(typeof m=="object")if(Array.isArray(m)){const[g,...y]=m;h(g,y)}else d(m);else throw new TypeError("Expected usable value, not `"+m+"`")}function d(m){if(!("plugins"in m)&&!("settings"in m))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");f(m.plugins),m.settings&&(o.settings=mf(!0,o.settings,m.settings))}function f(m){let g=-1;if(m!=null)if(Array.isArray(m))for(;++g<m.length;){const y=m[g];c(y)}else throw new TypeError("Expected a list of plugins, not `"+m+"`")}function h(m,g){let y=-1,b=-1;for(;++y<i.length;)if(i[y][0]===m){b=y;break}if(b===-1)i.push([m,...g]);else if(g.length>0){let[w,...N]=g;const A=i[b][1];lm(A)&&lm(w)&&(w=mf(!0,A,w)),i[b]=[m,w,...N]}}}}const O3=new Wm().freeze();function xf(e,a){if(typeof a!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function yf(e,a){if(typeof a!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function vf(e,a){if(a)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function cy(e){if(!lm(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function dy(e,a,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+a+"` instead")}function $o(e){return I3(e)?e:new Iv(e)}function I3(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function U3(e){return typeof e=="string"||$3(e)}function $3(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const B3="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",fy=[],my={allowDangerousHtml:!0},H3=/^(https?|ircs?|mailto|xmpp)$/i,P3=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function ys(e){const a=q3(e),r=F3(e);return V3(a.runSync(a.parse(r),r),e)}function q3(e){const a=e.rehypePlugins||fy,r=e.remarkPlugins||fy,i=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...my}:my;return O3().use(SC).use(r).use(y3,i).use(a)}function F3(e){const a=e.children||"",r=new Iv;return typeof a=="string"&&(r.value=a),r}function V3(e,a){const r=a.allowedElements,i=a.allowElement,o=a.components,c=a.disallowedElements,d=a.skipHtml,f=a.unwrapDisallowed,h=a.urlTransform||Y3;for(const g of P3)Object.hasOwn(a,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+B3+g.id,void 0);return Km(e,m),iN(e,{Fragment:s.Fragment,components:o,ignoreInvalidStyle:!0,jsx:s.jsx,jsxs:s.jsxs,passKeys:!0,passNode:!0});function m(g,y,b){if(g.type==="raw"&&b&&typeof y=="number")return d?b.children.splice(y,1):b.children[y]={type:"text",value:g.value},y;if(g.type==="element"){let w;for(w in uf)if(Object.hasOwn(uf,w)&&Object.hasOwn(g.properties,w)){const N=g.properties[w],A=uf[w];(A===null||A.includes(g.tagName))&&(g.properties[w]=h(String(N||""),w,g))}}if(g.type==="element"){let w=r?!r.includes(g.tagName):c?c.includes(g.tagName):!1;if(!w&&i&&typeof y=="number"&&(w=!i(g,y,b)),w&&b&&typeof y=="number")return f&&g.children?b.children.splice(y,1,...g.children):b.children.splice(y,1),y}}}function Y3(e){const a=e.indexOf(":"),r=e.indexOf("?"),i=e.indexOf("#"),o=e.indexOf("/");return a===-1||o!==-1&&a>o||r!==-1&&a>r||i!==-1&&a>i||H3.test(e.slice(0,a))?e:""}function hy(e,a){const r=String(e);if(typeof a!="string")throw new TypeError("Expected character");let i=0,o=r.indexOf(a);for(;o!==-1;)i++,o=r.indexOf(a,o+a.length);return i}function G3(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function K3(e,a,r){const o=Ru((r||{}).ignore||[]),c=W3(a);let d=-1;for(;++d<c.length;)Ov(e,"text",f);function f(m,g){let y=-1,b;for(;++y<g.length;){const w=g[y],N=b?b.children:void 0;if(o(w,N?N.indexOf(w):void 0,b))return;b=w}if(b)return h(m,g)}function h(m,g){const y=g[g.length-1],b=c[d][0],w=c[d][1];let N=0;const j=y.children.indexOf(m);let T=!1,I=[];b.lastIndex=0;let M=b.exec(m.value);for(;M;){const _=M.index,$={index:M.index,input:M.input,stack:[...g,m]};let U=w(...M,$);if(typeof U=="string"&&(U=U.length>0?{type:"text",value:U}:void 0),U===!1?b.lastIndex=_+1:(N!==_&&I.push({type:"text",value:m.value.slice(N,_)}),Array.isArray(U)?I.push(...U):U&&I.push(U),N=_+M[0].length,T=!0),!b.global)break;M=b.exec(m.value)}return T?(N<m.value.length&&I.push({type:"text",value:m.value.slice(N)}),y.children.splice(j,1,...I)):I=[m],j+I.length}}function W3(e){const a=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const r=!e[0]||Array.isArray(e[0])?e:[e];let i=-1;for(;++i<r.length;){const o=r[i];a.push([X3(o[0]),Q3(o[1])])}return a}function X3(e){return typeof e=="string"?new RegExp(G3(e),"g"):e}function Q3(e){return typeof e=="function"?e:function(){return e}}const bf="phrasing",kf=["autolink","link","image","label"];function Z3(){return{transforms:[lE],enter:{literalAutolink:eE,literalAutolinkEmail:wf,literalAutolinkHttp:wf,literalAutolinkWww:wf},exit:{literalAutolink:rE,literalAutolinkEmail:aE,literalAutolinkHttp:tE,literalAutolinkWww:nE}}}function J3(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:bf,notInConstruct:kf},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:bf,notInConstruct:kf},{character:":",before:"[ps]",after:"\\/",inConstruct:bf,notInConstruct:kf}]}}function eE(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function wf(e){this.config.enter.autolinkProtocol.call(this,e)}function tE(e){this.config.exit.autolinkProtocol.call(this,e)}function nE(e){this.config.exit.data.call(this,e);const a=this.stack[this.stack.length-1];a.type,a.url="http://"+this.sliceSerialize(e)}function aE(e){this.config.exit.autolinkEmail.call(this,e)}function rE(e){this.exit(e)}function lE(e){K3(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,iE],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),sE]],{ignore:["link","linkReference"]})}function iE(e,a,r,i,o){let c="";if(!Uv(o)||(/^w/i.test(a)&&(r=a+r,a="",c="http://"),!oE(r)))return!1;const d=uE(r+i);if(!d[0])return!1;const f={type:"link",title:null,url:c+a+d[0],children:[{type:"text",value:a+d[0]}]};return d[1]?[f,{type:"text",value:d[1]}]:f}function sE(e,a,r,i){return!Uv(i,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+a+"@"+r,children:[{type:"text",value:a+"@"+r}]}}function oE(e){const a=e.split(".");return!(a.length<2||a[a.length-1]&&(/_/.test(a[a.length-1])||!/[a-zA-Z\d]/.test(a[a.length-1]))||a[a.length-2]&&(/_/.test(a[a.length-2])||!/[a-zA-Z\d]/.test(a[a.length-2])))}function uE(e){const a=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!a)return[e,void 0];e=e.slice(0,a.index);let r=a[0],i=r.indexOf(")");const o=hy(e,"(");let c=hy(e,")");for(;i!==-1&&o>c;)e+=r.slice(0,i+1),r=r.slice(i+1),i=r.indexOf(")"),c++;return[e,r]}function Uv(e,a){const r=e.input.charCodeAt(e.index-1);return(e.index===0||Yr(r)||Tu(r))&&(!a||r!==47)}$v.peek=yE;function cE(){this.buffer()}function dE(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function fE(){this.buffer()}function mE(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function hE(e){const a=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Zn(this.sliceSerialize(e)).toLowerCase(),r.label=a}function pE(e){this.exit(e)}function gE(e){const a=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Zn(this.sliceSerialize(e)).toLowerCase(),r.label=a}function xE(e){this.exit(e)}function yE(){return"["}function $v(e,a,r,i){const o=r.createTracker(i);let c=o.move("[^");const d=r.enter("footnoteReference"),f=r.enter("reference");return c+=o.move(r.safe(r.associationId(e),{after:"]",before:c})),f(),d(),c+=o.move("]"),c}function vE(){return{enter:{gfmFootnoteCallString:cE,gfmFootnoteCall:dE,gfmFootnoteDefinitionLabelString:fE,gfmFootnoteDefinition:mE},exit:{gfmFootnoteCallString:hE,gfmFootnoteCall:pE,gfmFootnoteDefinitionLabelString:gE,gfmFootnoteDefinition:xE}}}function bE(e){let a=!1;return e&&e.firstLineBlank&&(a=!0),{handlers:{footnoteDefinition:r,footnoteReference:$v},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(i,o,c,d){const f=c.createTracker(d);let h=f.move("[^");const m=c.enter("footnoteDefinition"),g=c.enter("label");return h+=f.move(c.safe(c.associationId(i),{before:h,after:"]"})),g(),h+=f.move("]:"),i.children&&i.children.length>0&&(f.shift(4),h+=f.move((a?`
|
|
27
|
+
`:" ")+c.indentLines(c.containerFlow(i,f.current()),a?Bv:kE))),m(),h}}function kE(e,a,r){return a===0?e:Bv(e,a,r)}function Bv(e,a,r){return(r?"":" ")+e}const wE=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Hv.peek=EE;function SE(){return{canContainEols:["delete"],enter:{strikethrough:NE},exit:{strikethrough:CE}}}function jE(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:wE}],handlers:{delete:Hv}}}function NE(e){this.enter({type:"delete",children:[]},e)}function CE(e){this.exit(e)}function Hv(e,a,r,i){const o=r.createTracker(i),c=r.enter("strikethrough");let d=o.move("~~");return d+=r.containerPhrasing(e,{...o.current(),before:d,after:"~"}),d+=o.move("~~"),c(),d}function EE(){return"~"}function TE(e){return e.length}function ME(e,a){const r=a||{},i=(r.align||[]).concat(),o=r.stringLength||TE,c=[],d=[],f=[],h=[];let m=0,g=-1;for(;++g<e.length;){const A=[],j=[];let T=-1;for(e[g].length>m&&(m=e[g].length);++T<e[g].length;){const I=AE(e[g][T]);if(r.alignDelimiters!==!1){const M=o(I);j[T]=M,(h[T]===void 0||M>h[T])&&(h[T]=M)}A.push(I)}d[g]=A,f[g]=j}let y=-1;if(typeof i=="object"&&"length"in i)for(;++y<m;)c[y]=py(i[y]);else{const A=py(i);for(;++y<m;)c[y]=A}y=-1;const b=[],w=[];for(;++y<m;){const A=c[y];let j="",T="";A===99?(j=":",T=":"):A===108?j=":":A===114&&(T=":");let I=r.alignDelimiters===!1?1:Math.max(1,h[y]-j.length-T.length);const M=j+"-".repeat(I)+T;r.alignDelimiters!==!1&&(I=j.length+I+T.length,I>h[y]&&(h[y]=I),w[y]=I),b[y]=M}d.splice(1,0,b),f.splice(1,0,w),g=-1;const N=[];for(;++g<d.length;){const A=d[g],j=f[g];y=-1;const T=[];for(;++y<m;){const I=A[y]||"";let M="",_="";if(r.alignDelimiters!==!1){const $=h[y]-(j[y]||0),U=c[y];U===114?M=" ".repeat($):U===99?$%2?(M=" ".repeat($/2+.5),_=" ".repeat($/2-.5)):(M=" ".repeat($/2),_=M):_=" ".repeat($)}r.delimiterStart!==!1&&!y&&T.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&I==="")&&(r.delimiterStart!==!1||y)&&T.push(" "),r.alignDelimiters!==!1&&T.push(M),T.push(I),r.alignDelimiters!==!1&&T.push(_),r.padding!==!1&&T.push(" "),(r.delimiterEnd!==!1||y!==m-1)&&T.push("|")}N.push(r.delimiterEnd===!1?T.join("").replace(/ +$/,""):T.join(""))}return N.join(`
|
|
28
|
+
`)}function AE(e){return e==null?"":String(e)}function py(e){const a=typeof e=="string"?e.codePointAt(0):0;return a===67||a===99?99:a===76||a===108?108:a===82||a===114?114:0}function RE(e,a,r,i){const o=r.enter("blockquote"),c=r.createTracker(i);c.move("> "),c.shift(2);const d=r.indentLines(r.containerFlow(e,c.current()),_E);return o(),d}function _E(e,a,r){return">"+(r?"":" ")+e}function zE(e,a){return gy(e,a.inConstruct,!0)&&!gy(e,a.notInConstruct,!1)}function gy(e,a,r){if(typeof a=="string"&&(a=[a]),!a||a.length===0)return r;let i=-1;for(;++i<a.length;)if(e.includes(a[i]))return!0;return!1}function xy(e,a,r,i){let o=-1;for(;++o<r.unsafe.length;)if(r.unsafe[o].character===`
|
|
29
|
+
`&&zE(r.stack,r.unsafe[o]))return/[ \t]/.test(i.before)?"":" ";return`\\
|
|
30
|
+
`}function DE(e,a){const r=String(e);let i=r.indexOf(a),o=i,c=0,d=0;if(typeof a!="string")throw new TypeError("Expected substring");for(;i!==-1;)i===o?++c>d&&(d=c):c=1,o=i+a.length,i=r.indexOf(a,o);return d}function LE(e,a){return!!(a.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function OE(e){const a=e.options.fence||"`";if(a!=="`"&&a!=="~")throw new Error("Cannot serialize code with `"+a+"` for `options.fence`, expected `` ` `` or `~`");return a}function IE(e,a,r,i){const o=OE(r),c=e.value||"",d=o==="`"?"GraveAccent":"Tilde";if(LE(e,r)){const y=r.enter("codeIndented"),b=r.indentLines(c,UE);return y(),b}const f=r.createTracker(i),h=o.repeat(Math.max(DE(c,o)+1,3)),m=r.enter("codeFenced");let g=f.move(h);if(e.lang){const y=r.enter(`codeFencedLang${d}`);g+=f.move(r.safe(e.lang,{before:g,after:" ",encode:["`"],...f.current()})),y()}if(e.lang&&e.meta){const y=r.enter(`codeFencedMeta${d}`);g+=f.move(" "),g+=f.move(r.safe(e.meta,{before:g,after:`
|
|
31
|
+
`,encode:["`"],...f.current()})),y()}return g+=f.move(`
|
|
32
|
+
`),c&&(g+=f.move(c+`
|
|
33
|
+
`)),g+=f.move(h),m(),g}function UE(e,a,r){return(r?"":" ")+e}function Xm(e){const a=e.options.quote||'"';if(a!=='"'&&a!=="'")throw new Error("Cannot serialize title with `"+a+"` for `options.quote`, expected `\"`, or `'`");return a}function $E(e,a,r,i){const o=Xm(r),c=o==='"'?"Quote":"Apostrophe",d=r.enter("definition");let f=r.enter("label");const h=r.createTracker(i);let m=h.move("[");return m+=h.move(r.safe(r.associationId(e),{before:m,after:"]",...h.current()})),m+=h.move("]: "),f(),!e.url||/[\0- \u007F]/.test(e.url)?(f=r.enter("destinationLiteral"),m+=h.move("<"),m+=h.move(r.safe(e.url,{before:m,after:">",...h.current()})),m+=h.move(">")):(f=r.enter("destinationRaw"),m+=h.move(r.safe(e.url,{before:m,after:e.title?" ":`
|
|
34
|
+
`,...h.current()}))),f(),e.title&&(f=r.enter(`title${c}`),m+=h.move(" "+o),m+=h.move(r.safe(e.title,{before:m,after:o,...h.current()})),m+=h.move(o),f()),d(),m}function BE(e){const a=e.options.emphasis||"*";if(a!=="*"&&a!=="_")throw new Error("Cannot serialize emphasis with `"+a+"` for `options.emphasis`, expected `*`, or `_`");return a}function us(e){return"&#x"+e.toString(16).toUpperCase()+";"}function gu(e,a,r){const i=Hl(e),o=Hl(a);return i===void 0?o===void 0?r==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:o===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:i===1?o===void 0?{inside:!1,outside:!1}:o===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:o===void 0?{inside:!1,outside:!1}:o===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Pv.peek=HE;function Pv(e,a,r,i){const o=BE(r),c=r.enter("emphasis"),d=r.createTracker(i),f=d.move(o);let h=d.move(r.containerPhrasing(e,{after:o,before:f,...d.current()}));const m=h.charCodeAt(0),g=gu(i.before.charCodeAt(i.before.length-1),m,o);g.inside&&(h=us(m)+h.slice(1));const y=h.charCodeAt(h.length-1),b=gu(i.after.charCodeAt(0),y,o);b.inside&&(h=h.slice(0,-1)+us(y));const w=d.move(o);return c(),r.attentionEncodeSurroundingInfo={after:b.outside,before:g.outside},f+h+w}function HE(e,a,r){return r.options.emphasis||"*"}function PE(e,a){let r=!1;return Km(e,function(i){if("value"in i&&/\r?\n|\r/.test(i.value)||i.type==="break")return r=!0,am}),!!((!e.depth||e.depth<3)&&Hm(e)&&(a.options.setext||r))}function qE(e,a,r,i){const o=Math.max(Math.min(6,e.depth||1),1),c=r.createTracker(i);if(PE(e,r)){const g=r.enter("headingSetext"),y=r.enter("phrasing"),b=r.containerPhrasing(e,{...c.current(),before:`
|
|
35
|
+
`,after:`
|
|
36
|
+
`});return y(),g(),b+`
|
|
37
|
+
`+(o===1?"=":"-").repeat(b.length-(Math.max(b.lastIndexOf("\r"),b.lastIndexOf(`
|
|
38
|
+
`))+1))}const d="#".repeat(o),f=r.enter("headingAtx"),h=r.enter("phrasing");c.move(d+" ");let m=r.containerPhrasing(e,{before:"# ",after:`
|
|
39
|
+
`,...c.current()});return/^[\t ]/.test(m)&&(m=us(m.charCodeAt(0))+m.slice(1)),m=m?d+" "+m:d,r.options.closeAtx&&(m+=" "+d),h(),f(),m}qv.peek=FE;function qv(e){return e.value||""}function FE(){return"<"}Fv.peek=VE;function Fv(e,a,r,i){const o=Xm(r),c=o==='"'?"Quote":"Apostrophe",d=r.enter("image");let f=r.enter("label");const h=r.createTracker(i);let m=h.move("![");return m+=h.move(r.safe(e.alt,{before:m,after:"]",...h.current()})),m+=h.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=r.enter("destinationLiteral"),m+=h.move("<"),m+=h.move(r.safe(e.url,{before:m,after:">",...h.current()})),m+=h.move(">")):(f=r.enter("destinationRaw"),m+=h.move(r.safe(e.url,{before:m,after:e.title?" ":")",...h.current()}))),f(),e.title&&(f=r.enter(`title${c}`),m+=h.move(" "+o),m+=h.move(r.safe(e.title,{before:m,after:o,...h.current()})),m+=h.move(o),f()),m+=h.move(")"),d(),m}function VE(){return"!"}Vv.peek=YE;function Vv(e,a,r,i){const o=e.referenceType,c=r.enter("imageReference");let d=r.enter("label");const f=r.createTracker(i);let h=f.move("![");const m=r.safe(e.alt,{before:h,after:"]",...f.current()});h+=f.move(m+"]["),d();const g=r.stack;r.stack=[],d=r.enter("reference");const y=r.safe(r.associationId(e),{before:h,after:"]",...f.current()});return d(),r.stack=g,c(),o==="full"||!m||m!==y?h+=f.move(y+"]"):o==="shortcut"?h=h.slice(0,-1):h+=f.move("]"),h}function YE(){return"!"}Yv.peek=GE;function Yv(e,a,r){let i=e.value||"",o="`",c=-1;for(;new RegExp("(^|[^`])"+o+"([^`]|$)").test(i);)o+="`";for(/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^`|`$/.test(i))&&(i=" "+i+" ");++c<r.unsafe.length;){const d=r.unsafe[c],f=r.compilePattern(d);let h;if(d.atBreak)for(;h=f.exec(i);){let m=h.index;i.charCodeAt(m)===10&&i.charCodeAt(m-1)===13&&m--,i=i.slice(0,m)+" "+i.slice(h.index+1)}}return o+i+o}function GE(){return"`"}function Gv(e,a){const r=Hm(e);return!!(!a.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(r===e.url||"mailto:"+r===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}Kv.peek=KE;function Kv(e,a,r,i){const o=Xm(r),c=o==='"'?"Quote":"Apostrophe",d=r.createTracker(i);let f,h;if(Gv(e,r)){const g=r.stack;r.stack=[],f=r.enter("autolink");let y=d.move("<");return y+=d.move(r.containerPhrasing(e,{before:y,after:">",...d.current()})),y+=d.move(">"),f(),r.stack=g,y}f=r.enter("link"),h=r.enter("label");let m=d.move("[");return m+=d.move(r.containerPhrasing(e,{before:m,after:"](",...d.current()})),m+=d.move("]("),h(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(h=r.enter("destinationLiteral"),m+=d.move("<"),m+=d.move(r.safe(e.url,{before:m,after:">",...d.current()})),m+=d.move(">")):(h=r.enter("destinationRaw"),m+=d.move(r.safe(e.url,{before:m,after:e.title?" ":")",...d.current()}))),h(),e.title&&(h=r.enter(`title${c}`),m+=d.move(" "+o),m+=d.move(r.safe(e.title,{before:m,after:o,...d.current()})),m+=d.move(o),h()),m+=d.move(")"),f(),m}function KE(e,a,r){return Gv(e,r)?"<":"["}Wv.peek=WE;function Wv(e,a,r,i){const o=e.referenceType,c=r.enter("linkReference");let d=r.enter("label");const f=r.createTracker(i);let h=f.move("[");const m=r.containerPhrasing(e,{before:h,after:"]",...f.current()});h+=f.move(m+"]["),d();const g=r.stack;r.stack=[],d=r.enter("reference");const y=r.safe(r.associationId(e),{before:h,after:"]",...f.current()});return d(),r.stack=g,c(),o==="full"||!m||m!==y?h+=f.move(y+"]"):o==="shortcut"?h=h.slice(0,-1):h+=f.move("]"),h}function WE(){return"["}function Qm(e){const a=e.options.bullet||"*";if(a!=="*"&&a!=="+"&&a!=="-")throw new Error("Cannot serialize items with `"+a+"` for `options.bullet`, expected `*`, `+`, or `-`");return a}function XE(e){const a=Qm(e),r=e.options.bulletOther;if(!r)return a==="*"?"-":"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(r===a)throw new Error("Expected `bullet` (`"+a+"`) and `bulletOther` (`"+r+"`) to be different");return r}function QE(e){const a=e.options.bulletOrdered||".";if(a!=="."&&a!==")")throw new Error("Cannot serialize items with `"+a+"` for `options.bulletOrdered`, expected `.` or `)`");return a}function Xv(e){const a=e.options.rule||"*";if(a!=="*"&&a!=="-"&&a!=="_")throw new Error("Cannot serialize rules with `"+a+"` for `options.rule`, expected `*`, `-`, or `_`");return a}function ZE(e,a,r,i){const o=r.enter("list"),c=r.bulletCurrent;let d=e.ordered?QE(r):Qm(r);const f=e.ordered?d==="."?")":".":XE(r);let h=a&&r.bulletLastUsed?d===r.bulletLastUsed:!1;if(!e.ordered){const g=e.children?e.children[0]:void 0;if((d==="*"||d==="-")&&g&&(!g.children||!g.children[0])&&r.stack[r.stack.length-1]==="list"&&r.stack[r.stack.length-2]==="listItem"&&r.stack[r.stack.length-3]==="list"&&r.stack[r.stack.length-4]==="listItem"&&r.indexStack[r.indexStack.length-1]===0&&r.indexStack[r.indexStack.length-2]===0&&r.indexStack[r.indexStack.length-3]===0&&(h=!0),Xv(r)===d&&g){let y=-1;for(;++y<e.children.length;){const b=e.children[y];if(b&&b.type==="listItem"&&b.children&&b.children[0]&&b.children[0].type==="thematicBreak"){h=!0;break}}}}h&&(d=f),r.bulletCurrent=d;const m=r.containerFlow(e,i);return r.bulletLastUsed=d,r.bulletCurrent=c,o(),m}function JE(e){const a=e.options.listItemIndent||"one";if(a!=="tab"&&a!=="one"&&a!=="mixed")throw new Error("Cannot serialize items with `"+a+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return a}function eT(e,a,r,i){const o=JE(r);let c=r.bulletCurrent||Qm(r);a&&a.type==="list"&&a.ordered&&(c=(typeof a.start=="number"&&a.start>-1?a.start:1)+(r.options.incrementListMarker===!1?0:a.children.indexOf(e))+c);let d=c.length+1;(o==="tab"||o==="mixed"&&(a&&a.type==="list"&&a.spread||e.spread))&&(d=Math.ceil(d/4)*4);const f=r.createTracker(i);f.move(c+" ".repeat(d-c.length)),f.shift(d);const h=r.enter("listItem"),m=r.indentLines(r.containerFlow(e,f.current()),g);return h(),m;function g(y,b,w){return b?(w?"":" ".repeat(d))+y:(w?c:c+" ".repeat(d-c.length))+y}}function tT(e,a,r,i){const o=r.enter("paragraph"),c=r.enter("phrasing"),d=r.containerPhrasing(e,i);return c(),o(),d}const nT=Ru(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function aT(e,a,r,i){return(e.children.some(function(d){return nT(d)})?r.containerPhrasing:r.containerFlow).call(r,e,i)}function rT(e){const a=e.options.strong||"*";if(a!=="*"&&a!=="_")throw new Error("Cannot serialize strong with `"+a+"` for `options.strong`, expected `*`, or `_`");return a}Qv.peek=lT;function Qv(e,a,r,i){const o=rT(r),c=r.enter("strong"),d=r.createTracker(i),f=d.move(o+o);let h=d.move(r.containerPhrasing(e,{after:o,before:f,...d.current()}));const m=h.charCodeAt(0),g=gu(i.before.charCodeAt(i.before.length-1),m,o);g.inside&&(h=us(m)+h.slice(1));const y=h.charCodeAt(h.length-1),b=gu(i.after.charCodeAt(0),y,o);b.inside&&(h=h.slice(0,-1)+us(y));const w=d.move(o+o);return c(),r.attentionEncodeSurroundingInfo={after:b.outside,before:g.outside},f+h+w}function lT(e,a,r){return r.options.strong||"*"}function iT(e,a,r,i){return r.safe(e.value,i)}function sT(e){const a=e.options.ruleRepetition||3;if(a<3)throw new Error("Cannot serialize rules with repetition `"+a+"` for `options.ruleRepetition`, expected `3` or more");return a}function oT(e,a,r){const i=(Xv(r)+(r.options.ruleSpaces?" ":"")).repeat(sT(r));return r.options.ruleSpaces?i.slice(0,-1):i}const Zv={blockquote:RE,break:xy,code:IE,definition:$E,emphasis:Pv,hardBreak:xy,heading:qE,html:qv,image:Fv,imageReference:Vv,inlineCode:Yv,link:Kv,linkReference:Wv,list:ZE,listItem:eT,paragraph:tT,root:aT,strong:Qv,text:iT,thematicBreak:oT};function uT(){return{enter:{table:cT,tableData:yy,tableHeader:yy,tableRow:fT},exit:{codeText:mT,table:dT,tableData:Sf,tableHeader:Sf,tableRow:Sf}}}function cT(e){const a=e._align;this.enter({type:"table",align:a.map(function(r){return r==="none"?null:r}),children:[]},e),this.data.inTable=!0}function dT(e){this.exit(e),this.data.inTable=void 0}function fT(e){this.enter({type:"tableRow",children:[]},e)}function Sf(e){this.exit(e)}function yy(e){this.enter({type:"tableCell",children:[]},e)}function mT(e){let a=this.resume();this.data.inTable&&(a=a.replace(/\\([\\|])/g,hT));const r=this.stack[this.stack.length-1];r.type,r.value=a,this.exit(e)}function hT(e,a){return a==="|"?a:e}function pT(e){const a=e||{},r=a.tableCellPadding,i=a.tablePipeAlign,o=a.stringLength,c=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
40
|
+
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:b,table:d,tableCell:h,tableRow:f}};function d(w,N,A,j){return m(g(w,A,j),w.align)}function f(w,N,A,j){const T=y(w,A,j),I=m([T]);return I.slice(0,I.indexOf(`
|
|
41
|
+
`))}function h(w,N,A,j){const T=A.enter("tableCell"),I=A.enter("phrasing"),M=A.containerPhrasing(w,{...j,before:c,after:c});return I(),T(),M}function m(w,N){return ME(w,{align:N,alignDelimiters:i,padding:r,stringLength:o})}function g(w,N,A){const j=w.children;let T=-1;const I=[],M=N.enter("table");for(;++T<j.length;)I[T]=y(j[T],N,A);return M(),I}function y(w,N,A){const j=w.children;let T=-1;const I=[],M=N.enter("tableRow");for(;++T<j.length;)I[T]=h(j[T],w,N,A);return M(),I}function b(w,N,A){let j=Zv.inlineCode(w,N,A);return A.stack.includes("tableCell")&&(j=j.replace(/\|/g,"\\$&")),j}}function gT(){return{exit:{taskListCheckValueChecked:vy,taskListCheckValueUnchecked:vy,paragraph:yT}}}function xT(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:vT}}}function vy(e){const a=this.stack[this.stack.length-2];a.type,a.checked=e.type==="taskListCheckValueChecked"}function yT(e){const a=this.stack[this.stack.length-2];if(a&&a.type==="listItem"&&typeof a.checked=="boolean"){const r=this.stack[this.stack.length-1];r.type;const i=r.children[0];if(i&&i.type==="text"){const o=a.children;let c=-1,d;for(;++c<o.length;){const f=o[c];if(f.type==="paragraph"){d=f;break}}d===r&&(i.value=i.value.slice(1),i.value.length===0?r.children.shift():r.position&&i.position&&typeof i.position.start.offset=="number"&&(i.position.start.column++,i.position.start.offset++,r.position.start=Object.assign({},i.position.start)))}}this.exit(e)}function vT(e,a,r,i){const o=e.children[0],c=typeof e.checked=="boolean"&&o&&o.type==="paragraph",d="["+(e.checked?"x":" ")+"] ",f=r.createTracker(i);c&&f.move(d);let h=Zv.listItem(e,a,r,{...i,...f.current()});return c&&(h=h.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,m)),h;function m(g){return g+d}}function bT(){return[Z3(),vE(),SE(),uT(),gT()]}function kT(e){return{extensions:[J3(),bE(e),jE(),pT(e),xT()]}}const wT={tokenize:TT,partial:!0},Jv={tokenize:MT,partial:!0},eb={tokenize:AT,partial:!0},tb={tokenize:RT,partial:!0},ST={tokenize:_T,partial:!0},nb={name:"wwwAutolink",tokenize:CT,previous:rb},ab={name:"protocolAutolink",tokenize:ET,previous:lb},La={name:"emailAutolink",tokenize:NT,previous:ib},oa={};function jT(){return{text:oa}}let Dr=48;for(;Dr<123;)oa[Dr]=La,Dr++,Dr===58?Dr=65:Dr===91&&(Dr=97);oa[43]=La;oa[45]=La;oa[46]=La;oa[95]=La;oa[72]=[La,ab];oa[104]=[La,ab];oa[87]=[La,nb];oa[119]=[La,nb];function NT(e,a,r){const i=this;let o,c;return d;function d(y){return!sm(y)||!ib.call(i,i.previous)||Zm(i.events)?r(y):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(y))}function f(y){return sm(y)?(e.consume(y),f):y===64?(e.consume(y),h):r(y)}function h(y){return y===46?e.check(ST,g,m)(y):y===45||y===95||Vt(y)?(c=!0,e.consume(y),h):g(y)}function m(y){return e.consume(y),o=!0,h}function g(y){return c&&o&&Qt(i.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),a(y)):r(y)}}function CT(e,a,r){const i=this;return o;function o(d){return d!==87&&d!==119||!rb.call(i,i.previous)||Zm(i.events)?r(d):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(wT,e.attempt(Jv,e.attempt(eb,c),r),r)(d))}function c(d){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),a(d)}}function ET(e,a,r){const i=this;let o="",c=!1;return d;function d(y){return(y===72||y===104)&&lb.call(i,i.previous)&&!Zm(i.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),o+=String.fromCodePoint(y),e.consume(y),f):r(y)}function f(y){if(Qt(y)&&o.length<5)return o+=String.fromCodePoint(y),e.consume(y),f;if(y===58){const b=o.toLowerCase();if(b==="http"||b==="https")return e.consume(y),h}return r(y)}function h(y){return y===47?(e.consume(y),c?m:(c=!0,h)):r(y)}function m(y){return y===null||mu(y)||lt(y)||Yr(y)||Tu(y)?r(y):e.attempt(Jv,e.attempt(eb,g),r)(y)}function g(y){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),a(y)}}function TT(e,a,r){let i=0;return o;function o(d){return(d===87||d===119)&&i<3?(i++,e.consume(d),o):d===46&&i===3?(e.consume(d),c):r(d)}function c(d){return d===null?r(d):a(d)}}function MT(e,a,r){let i,o,c;return d;function d(m){return m===46||m===95?e.check(tb,h,f)(m):m===null||lt(m)||Yr(m)||m!==45&&Tu(m)?h(m):(c=!0,e.consume(m),d)}function f(m){return m===95?i=!0:(o=i,i=void 0),e.consume(m),d}function h(m){return o||i||!c?r(m):a(m)}}function AT(e,a){let r=0,i=0;return o;function o(d){return d===40?(r++,e.consume(d),o):d===41&&i<r?c(d):d===33||d===34||d===38||d===39||d===41||d===42||d===44||d===46||d===58||d===59||d===60||d===63||d===93||d===95||d===126?e.check(tb,a,c)(d):d===null||lt(d)||Yr(d)?a(d):(e.consume(d),o)}function c(d){return d===41&&i++,e.consume(d),o}}function RT(e,a,r){return i;function i(f){return f===33||f===34||f===39||f===41||f===42||f===44||f===46||f===58||f===59||f===63||f===95||f===126?(e.consume(f),i):f===38?(e.consume(f),c):f===93?(e.consume(f),o):f===60||f===null||lt(f)||Yr(f)?a(f):r(f)}function o(f){return f===null||f===40||f===91||lt(f)||Yr(f)?a(f):i(f)}function c(f){return Qt(f)?d(f):r(f)}function d(f){return f===59?(e.consume(f),i):Qt(f)?(e.consume(f),d):r(f)}}function _T(e,a,r){return i;function i(c){return e.consume(c),o}function o(c){return Vt(c)?r(c):a(c)}}function rb(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||lt(e)}function lb(e){return!Qt(e)}function ib(e){return!(e===47||sm(e))}function sm(e){return e===43||e===45||e===46||e===95||Vt(e)}function Zm(e){let a=e.length,r=!1;for(;a--;){const i=e[a][1];if((i.type==="labelLink"||i.type==="labelImage")&&!i._balanced){r=!0;break}if(i._gfmAutolinkLiteralWalkedInto){r=!1;break}}return e.length>0&&!r&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}const zT={tokenize:HT,partial:!0};function DT(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:UT,continuation:{tokenize:$T},exit:BT}},text:{91:{name:"gfmFootnoteCall",tokenize:IT},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:LT,resolveTo:OT}}}}function LT(e,a,r){const i=this;let o=i.events.length;const c=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let d;for(;o--;){const h=i.events[o][1];if(h.type==="labelImage"){d=h;break}if(h.type==="gfmFootnoteCall"||h.type==="labelLink"||h.type==="label"||h.type==="image"||h.type==="link")break}return f;function f(h){if(!d||!d._balanced)return r(h);const m=Zn(i.sliceSerialize({start:d.end,end:i.now()}));return m.codePointAt(0)!==94||!c.includes(m.slice(1))?r(h):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),a(h))}}function OT(e,a){let r=e.length;for(;r--;)if(e[r][1].type==="labelImage"&&e[r][0]==="enter"){e[r][1];break}e[r+1][1].type="data",e[r+3][1].type="gfmFootnoteCallLabelMarker";const i={type:"gfmFootnoteCall",start:Object.assign({},e[r+3][1].start),end:Object.assign({},e[e.length-1][1].end)},o={type:"gfmFootnoteCallMarker",start:Object.assign({},e[r+3][1].end),end:Object.assign({},e[r+3][1].end)};o.end.column++,o.end.offset++,o.end._bufferIndex++;const c={type:"gfmFootnoteCallString",start:Object.assign({},o.end),end:Object.assign({},e[e.length-1][1].start)},d={type:"chunkString",contentType:"string",start:Object.assign({},c.start),end:Object.assign({},c.end)},f=[e[r+1],e[r+2],["enter",i,a],e[r+3],e[r+4],["enter",o,a],["exit",o,a],["enter",c,a],["enter",d,a],["exit",d,a],["exit",c,a],e[e.length-2],e[e.length-1],["exit",i,a]];return e.splice(r,e.length-r+1,...f),e}function IT(e,a,r){const i=this,o=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let c=0,d;return f;function f(y){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(y),e.exit("gfmFootnoteCallLabelMarker"),h}function h(y){return y!==94?r(y):(e.enter("gfmFootnoteCallMarker"),e.consume(y),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",m)}function m(y){if(c>999||y===93&&!d||y===null||y===91||lt(y))return r(y);if(y===93){e.exit("chunkString");const b=e.exit("gfmFootnoteCallString");return o.includes(Zn(i.sliceSerialize(b)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(y),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),a):r(y)}return lt(y)||(d=!0),c++,e.consume(y),y===92?g:m}function g(y){return y===91||y===92||y===93?(e.consume(y),c++,m):m(y)}}function UT(e,a,r){const i=this,o=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let c,d=0,f;return h;function h(N){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(N),e.exit("gfmFootnoteDefinitionLabelMarker"),m}function m(N){return N===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(N),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",g):r(N)}function g(N){if(d>999||N===93&&!f||N===null||N===91||lt(N))return r(N);if(N===93){e.exit("chunkString");const A=e.exit("gfmFootnoteDefinitionLabelString");return c=Zn(i.sliceSerialize(A)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(N),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),b}return lt(N)||(f=!0),d++,e.consume(N),N===92?y:g}function y(N){return N===91||N===92||N===93?(e.consume(N),d++,g):g(N)}function b(N){return N===58?(e.enter("definitionMarker"),e.consume(N),e.exit("definitionMarker"),o.includes(c)||o.push(c),Ve(e,w,"gfmFootnoteDefinitionWhitespace")):r(N)}function w(N){return a(N)}}function $T(e,a,r){return e.check(gs,a,e.attempt(zT,a,r))}function BT(e){e.exit("gfmFootnoteDefinition")}function HT(e,a,r){const i=this;return Ve(e,o,"gfmFootnoteDefinitionIndent",5);function o(c){const d=i.events[i.events.length-1];return d&&d[1].type==="gfmFootnoteDefinitionIndent"&&d[2].sliceSerialize(d[1],!0).length===4?a(c):r(c)}}function PT(e){let r=(e||{}).singleTilde;const i={name:"strikethrough",tokenize:c,resolveAll:o};return r==null&&(r=!0),{text:{126:i},insideSpan:{null:[i]},attentionMarkers:{null:[126]}};function o(d,f){let h=-1;for(;++h<d.length;)if(d[h][0]==="enter"&&d[h][1].type==="strikethroughSequenceTemporary"&&d[h][1]._close){let m=h;for(;m--;)if(d[m][0]==="exit"&&d[m][1].type==="strikethroughSequenceTemporary"&&d[m][1]._open&&d[h][1].end.offset-d[h][1].start.offset===d[m][1].end.offset-d[m][1].start.offset){d[h][1].type="strikethroughSequence",d[m][1].type="strikethroughSequence";const g={type:"strikethrough",start:Object.assign({},d[m][1].start),end:Object.assign({},d[h][1].end)},y={type:"strikethroughText",start:Object.assign({},d[m][1].end),end:Object.assign({},d[h][1].start)},b=[["enter",g,f],["enter",d[m][1],f],["exit",d[m][1],f],["enter",y,f]],w=f.parser.constructs.insideSpan.null;w&&jn(b,b.length,0,Mu(w,d.slice(m+1,h),f)),jn(b,b.length,0,[["exit",y,f],["enter",d[h][1],f],["exit",d[h][1],f],["exit",g,f]]),jn(d,m-1,h-m+3,b),h=m+b.length-2;break}}for(h=-1;++h<d.length;)d[h][1].type==="strikethroughSequenceTemporary"&&(d[h][1].type="data");return d}function c(d,f,h){const m=this.previous,g=this.events;let y=0;return b;function b(N){return m===126&&g[g.length-1][1].type!=="characterEscape"?h(N):(d.enter("strikethroughSequenceTemporary"),w(N))}function w(N){const A=Hl(m);if(N===126)return y>1?h(N):(d.consume(N),y++,w);if(y<2&&!r)return h(N);const j=d.exit("strikethroughSequenceTemporary"),T=Hl(N);return j._open=!T||T===2&&!!A,j._close=!A||A===2&&!!T,f(N)}}}class qT{constructor(){this.map=[]}add(a,r,i){FT(this,a,r,i)}consume(a){if(this.map.sort(function(c,d){return c[0]-d[0]}),this.map.length===0)return;let r=this.map.length;const i=[];for(;r>0;)r-=1,i.push(a.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),a.length=this.map[r][0];i.push(a.slice()),a.length=0;let o=i.pop();for(;o;){for(const c of o)a.push(c);o=i.pop()}this.map.length=0}}function FT(e,a,r,i){let o=0;if(!(r===0&&i.length===0)){for(;o<e.map.length;){if(e.map[o][0]===a){e.map[o][1]+=r,e.map[o][2].push(...i);return}o+=1}e.map.push([a,r,i])}}function VT(e,a){let r=!1;const i=[];for(;a<e.length;){const o=e[a];if(r){if(o[0]==="enter")o[1].type==="tableContent"&&i.push(e[a+1][1].type==="tableDelimiterMarker"?"left":"none");else if(o[1].type==="tableContent"){if(e[a-1][1].type==="tableDelimiterMarker"){const c=i.length-1;i[c]=i[c]==="left"?"center":"right"}}else if(o[1].type==="tableDelimiterRow")break}else o[0]==="enter"&&o[1].type==="tableDelimiterRow"&&(r=!0);a+=1}return i}function YT(){return{flow:{null:{name:"table",tokenize:GT,resolveAll:KT}}}}function GT(e,a,r){const i=this;let o=0,c=0,d;return f;function f(P){let K=i.events.length-1;for(;K>-1;){const te=i.events[K][1].type;if(te==="lineEnding"||te==="linePrefix")K--;else break}const D=K>-1?i.events[K][1].type:null,O=D==="tableHead"||D==="tableRow"?U:h;return O===U&&i.parser.lazy[i.now().line]?r(P):O(P)}function h(P){return e.enter("tableHead"),e.enter("tableRow"),m(P)}function m(P){return P===124||(d=!0,c+=1),g(P)}function g(P){return P===null?r(P):Ee(P)?c>1?(c=0,i.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),w):r(P):Be(P)?Ve(e,g,"whitespace")(P):(c+=1,d&&(d=!1,o+=1),P===124?(e.enter("tableCellDivider"),e.consume(P),e.exit("tableCellDivider"),d=!0,g):(e.enter("data"),y(P)))}function y(P){return P===null||P===124||lt(P)?(e.exit("data"),g(P)):(e.consume(P),P===92?b:y)}function b(P){return P===92||P===124?(e.consume(P),y):y(P)}function w(P){return i.interrupt=!1,i.parser.lazy[i.now().line]?r(P):(e.enter("tableDelimiterRow"),d=!1,Be(P)?Ve(e,N,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):N(P))}function N(P){return P===45||P===58?j(P):P===124?(d=!0,e.enter("tableCellDivider"),e.consume(P),e.exit("tableCellDivider"),A):$(P)}function A(P){return Be(P)?Ve(e,j,"whitespace")(P):j(P)}function j(P){return P===58?(c+=1,d=!0,e.enter("tableDelimiterMarker"),e.consume(P),e.exit("tableDelimiterMarker"),T):P===45?(c+=1,T(P)):P===null||Ee(P)?_(P):$(P)}function T(P){return P===45?(e.enter("tableDelimiterFiller"),I(P)):$(P)}function I(P){return P===45?(e.consume(P),I):P===58?(d=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(P),e.exit("tableDelimiterMarker"),M):(e.exit("tableDelimiterFiller"),M(P))}function M(P){return Be(P)?Ve(e,_,"whitespace")(P):_(P)}function _(P){return P===124?N(P):P===null||Ee(P)?!d||o!==c?$(P):(e.exit("tableDelimiterRow"),e.exit("tableHead"),a(P)):$(P)}function $(P){return r(P)}function U(P){return e.enter("tableRow"),Y(P)}function Y(P){return P===124?(e.enter("tableCellDivider"),e.consume(P),e.exit("tableCellDivider"),Y):P===null||Ee(P)?(e.exit("tableRow"),a(P)):Be(P)?Ve(e,Y,"whitespace")(P):(e.enter("data"),W(P))}function W(P){return P===null||P===124||lt(P)?(e.exit("data"),Y(P)):(e.consume(P),P===92?J:W)}function J(P){return P===92||P===124?(e.consume(P),W):W(P)}}function KT(e,a){let r=-1,i=!0,o=0,c=[0,0,0,0],d=[0,0,0,0],f=!1,h=0,m,g,y;const b=new qT;for(;++r<e.length;){const w=e[r],N=w[1];w[0]==="enter"?N.type==="tableHead"?(f=!1,h!==0&&(by(b,a,h,m,g),g=void 0,h=0),m={type:"table",start:Object.assign({},N.start),end:Object.assign({},N.end)},b.add(r,0,[["enter",m,a]])):N.type==="tableRow"||N.type==="tableDelimiterRow"?(i=!0,y=void 0,c=[0,0,0,0],d=[0,r+1,0,0],f&&(f=!1,g={type:"tableBody",start:Object.assign({},N.start),end:Object.assign({},N.end)},b.add(r,0,[["enter",g,a]])),o=N.type==="tableDelimiterRow"?2:g?3:1):o&&(N.type==="data"||N.type==="tableDelimiterMarker"||N.type==="tableDelimiterFiller")?(i=!1,d[2]===0&&(c[1]!==0&&(d[0]=d[1],y=Bo(b,a,c,o,void 0,y),c=[0,0,0,0]),d[2]=r)):N.type==="tableCellDivider"&&(i?i=!1:(c[1]!==0&&(d[0]=d[1],y=Bo(b,a,c,o,void 0,y)),c=d,d=[c[1],r,0,0])):N.type==="tableHead"?(f=!0,h=r):N.type==="tableRow"||N.type==="tableDelimiterRow"?(h=r,c[1]!==0?(d[0]=d[1],y=Bo(b,a,c,o,r,y)):d[1]!==0&&(y=Bo(b,a,d,o,r,y)),o=0):o&&(N.type==="data"||N.type==="tableDelimiterMarker"||N.type==="tableDelimiterFiller")&&(d[3]=r)}for(h!==0&&by(b,a,h,m,g),b.consume(a.events),r=-1;++r<a.events.length;){const w=a.events[r];w[0]==="enter"&&w[1].type==="table"&&(w[1]._align=VT(a.events,r))}return e}function Bo(e,a,r,i,o,c){const d=i===1?"tableHeader":i===2?"tableDelimiter":"tableData",f="tableContent";r[0]!==0&&(c.end=Object.assign({},Ul(a.events,r[0])),e.add(r[0],0,[["exit",c,a]]));const h=Ul(a.events,r[1]);if(c={type:d,start:Object.assign({},h),end:Object.assign({},h)},e.add(r[1],0,[["enter",c,a]]),r[2]!==0){const m=Ul(a.events,r[2]),g=Ul(a.events,r[3]),y={type:f,start:Object.assign({},m),end:Object.assign({},g)};if(e.add(r[2],0,[["enter",y,a]]),i!==2){const b=a.events[r[2]],w=a.events[r[3]];if(b[1].end=Object.assign({},w[1].end),b[1].type="chunkText",b[1].contentType="text",r[3]>r[2]+1){const N=r[2]+1,A=r[3]-r[2]-1;e.add(N,A,[])}}e.add(r[3]+1,0,[["exit",y,a]])}return o!==void 0&&(c.end=Object.assign({},Ul(a.events,o)),e.add(o,0,[["exit",c,a]]),c=void 0),c}function by(e,a,r,i,o){const c=[],d=Ul(a.events,r);o&&(o.end=Object.assign({},d),c.push(["exit",o,a])),i.end=Object.assign({},d),c.push(["exit",i,a]),e.add(r+1,0,c)}function Ul(e,a){const r=e[a],i=r[0]==="enter"?"start":"end";return r[1][i]}const WT={name:"tasklistCheck",tokenize:QT};function XT(){return{text:{91:WT}}}function QT(e,a,r){const i=this;return o;function o(h){return i.previous!==null||!i._gfmTasklistFirstContentOfListItem?r(h):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(h),e.exit("taskListCheckMarker"),c)}function c(h){return lt(h)?(e.enter("taskListCheckValueUnchecked"),e.consume(h),e.exit("taskListCheckValueUnchecked"),d):h===88||h===120?(e.enter("taskListCheckValueChecked"),e.consume(h),e.exit("taskListCheckValueChecked"),d):r(h)}function d(h){return h===93?(e.enter("taskListCheckMarker"),e.consume(h),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),f):r(h)}function f(h){return Ee(h)?a(h):Be(h)?e.check({tokenize:ZT},a,r)(h):r(h)}}function ZT(e,a,r){return Ve(e,i,"whitespace");function i(o){return o===null?r(o):a(o)}}function JT(e){return xv([jT(),DT(),PT(e),YT(),XT()])}const eM={};function vs(e){const a=this,r=e||eM,i=a.data(),o=i.micromarkExtensions||(i.micromarkExtensions=[]),c=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),d=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);o.push(JT(r)),c.push(bT()),d.push(kT(r))}const Et={input:"M12 15V5m0 0L8 9m4-4l4 4M4 19h16",output:"M12 3v10m0 0l-4-4m4 4l4-4M4 19h16",cacheHit:"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zm0-5a4 4 0 1 0 0-8 4 4 0 0 0 0 8zm0-3a1 1 0 1 0 0-2 1 1 0 0 0 0 2z",toolCalls:"M14.7 6.3a4 4 0 0 0-5 5L4 17v3h3l5.7-5.7a4 4 0 0 0 5-5l-2.5 2.5-2-2 2.5-2.5z",tps:"M5 18a8 8 0 1 1 14 0M12 12l4-3",elapsed:"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zm0-14v5l3 2",cost:"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zm0-15v12m2.6-9.3c-.5-.8-1.5-1.2-2.6-1.2-1.5 0-2.7.8-2.7 2 0 2.7 5.4 1.3 5.4 4 0 1.2-1.2 2-2.7 2-1.2 0-2.2-.5-2.7-1.4",copy:"M9 9h9v9a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2V9zM7 15H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h7a2 2 0 0 1 2 2v1",check:"M5 13l4 4L19 7"},tM=/^\[attached image: (.+)\]$/,nM=/[/\\]scratchpad[/\\]([^/\\]+)[/\\]([A-Za-z0-9._-]+)$/;function aM(e){if(/^https?:\/\//i.test(e))return e;const a=nM.exec(e);return a?`/api/sessions/${encodeURIComponent(a[1])}/scratchpad/${encodeURIComponent(a[2])}`:null}function rM(e){if(!e.includes("[attached image: "))return{text:e,images:[]};const a=[],r=[];for(const i of e.split(`
|
|
42
|
+
`)){const o=tM.exec(i.trim()),c=o?aM(o[1]):null;c?r.push(c):a.push(i)}return{text:a.join(`
|
|
43
|
+
`).replace(/\n+$/,""),images:r}}function ht({d:e,size:a=13,className:r=""}){return s.jsx("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",className:`block shrink-0 ${r}`,"aria-hidden":!0,children:s.jsx("path",{d:e})})}function Hr({src:e,alt:a,className:r}){const[i,o]=k.useState(!1);return s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:"block cursor-zoom-in",onClick:()=>o(!0),children:s.jsx("img",{src:e,alt:a,className:r})}),i&&s.jsx(lM,{src:e,alt:a,onClose:()=>o(!1)})]})}function lM({src:e,alt:a,onClose:r}){return k.useEffect(()=>{const i=o=>{o.key==="Escape"&&r()};return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[r]),hs.createPortal(s.jsx("div",{className:"anim-fade fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-10",onMouseDown:i=>{i.target===i.currentTarget&&r()},children:s.jsxs("div",{className:"anim-pop relative",children:[s.jsx("button",{type:"button","aria-label":v.common.close,onClick:r,className:"absolute right-2 top-2 flex h-7 w-7 items-center justify-center rounded-full bg-black/50 text-white transition-colors duration-150 hover:bg-black/70",children:s.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",children:s.jsx("path",{d:"M2 2l10 10M12 2L2 12",strokeWidth:"1.5",strokeLinecap:"round"})})}),s.jsx("img",{src:e,alt:a,className:"max-h-[85vh] max-w-[88vw] rounded-lg border border-gray-200 bg-white dark:border-gray-700 dark:bg-gray-900"})]})}),document.body)}const iM=new Set(["txt","md","json","js","mjs","cjs","ts","tsx","jsx","py","sh","bash","yaml","yml","toml","css","html","htm","csv","log","xml","ini","conf","rs","go","java","c","h","cpp","hpp","sql","rb","php","png","jpg","jpeg","gif","webp","svg","pdf","doc","docx","xls","xlsx","ppt","pptx","zip","tar","gz","mp4","mp3","wav"]),sM=/^[a-z][a-z0-9+.-]*:\/\//i;function oM(e){const a=e.trim();if(a.length===0||a.length>200||/\s/.test(a)||sM.test(a)||a.startsWith("www."))return!1;const r=/\.([A-Za-z0-9]{1,8})$/.exec(a);if(!r)return!1;const i=r[1].toLowerCase();return/^\d+$/.test(i)?!1:iM.has(i)}const uM=512;function cM(e,a){const r=e.trim();if(r.length===0||r.length>uM||r.startsWith("~"))return null;const i=a!==null&&a.length>0?a:null,o=i?.includes("\\")??!1,c=o?"\\":"/",d=r.startsWith("/")||o&&(/^[A-Za-z]:/.test(r)||r.startsWith("\\"));let f=r;if(d){if(i===null||!r.startsWith(`${i}${c}`))return null;f=r.slice(i.length+c.length),c==="\\"&&(f=f.replaceAll("\\","/"))}const h=[];for(const m of f.split("/"))if(!(m===""||m===".")){if(m===".."){if(h.length===0)return null;h.pop();continue}h.push(m)}return h.length>0?h.join("/"):null}const ky=3;function dM(e){const a=[],r=new Set;for(const i of e.matchAll(/`([^`\n]+)`/g)){const o=i[1].trim();!oM(o)||r.has(o)||(r.add(o),a.push(o))}return a}function fM({path:e}){const a=e.lastIndexOf("/"),r=a>=0?e.slice(0,a+1):"",i=a>=0?e.slice(a+1):e;return s.jsxs("span",{className:"flex min-w-0 items-baseline font-mono text-sm",children:[r&&s.jsx("span",{className:"min-w-0 shrink-[9999] truncate text-gray-400 dark:text-gray-500",children:r}),s.jsx("span",{className:"min-w-0 truncate font-semibold text-gray-800 dark:text-gray-100",children:i})]})}function mM({text:e,workspace:a,statFiles:r,onOpenFile:i}){const o=k.useMemo(()=>{const y=[],b=new Set;for(const w of dM(e)){const N=cM(w,a);N===null||b.has(N)||(b.add(N),y.push(N))}return y},[e,a]),[c,d]=k.useState(null);k.useEffect(()=>{if(d(null),o.length===0)return;let y=!1;return r(o).then(b=>{y||d(o.filter(w=>b.has(w)))}).catch(()=>{}),()=>{y=!0}},[o,r]);const[f,h]=k.useState(!1);if(c===null||c.length===0)return null;const m=f?c:c.slice(0,ky),g=c.length-m.length;return s.jsxs("div",{className:"anim-msg my-3 overflow-hidden rounded-xl border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900",children:[s.jsxs("div",{className:"flex items-center gap-2 border-b border-gray-100 bg-gray-50 px-3 py-2 dark:border-gray-800/60 dark:bg-gray-800/40",children:[s.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7","aria-hidden":!0,className:"shrink-0 text-gray-400",children:s.jsx("path",{d:"M6 3h8l4 4v14H6zM14 3v4h4"})}),s.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:v.chat.filesInMessage(c.length)})]}),s.jsxs("div",{className:"divide-y divide-gray-100 dark:divide-gray-800/60",children:[m.map(y=>s.jsxs("button",{type:"button",title:y,onClick:()=>i(y),className:"group flex w-full cursor-pointer items-center gap-2 px-3 py-2 text-left transition-colors duration-150 hover:bg-gray-50 dark:hover:bg-gray-800/50",children:[s.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7","aria-hidden":!0,className:"shrink-0 text-gray-400",children:s.jsx("path",{d:"M6 3h8l4 4v14H6zM14 3v4h4"})}),s.jsx(fM,{path:y}),s.jsx("span",{className:"min-w-0 flex-1"}),s.jsx("span",{"aria-hidden":!0,className:"shrink-0 text-xs text-gray-400 transition-colors duration-150 group-hover:text-gray-600 dark:text-gray-500 dark:group-hover:text-gray-300",children:v.chat.openPreview})]},y)),(g>0||f)&&c.length>ky&&s.jsxs("button",{type:"button",onClick:()=>h(y=>!y),className:"flex w-full items-center gap-1.5 px-3 py-2 text-left text-xs text-gray-500 transition-colors duration-150 hover:bg-gray-50 dark:text-gray-400 dark:hover:bg-gray-800/50",children:[f?v.chat.showLess:v.chat.showMoreFiles(g),s.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,className:`transition-transform duration-200 ${f?"rotate-180":""}`,children:s.jsx("path",{d:"m6 9 6 6 6-6"})})]})]})]})}const hM={waiting:"M6 3h12M6 21h12M8 3v3.5L12 10l4-3.5V3M8 21v-3.5L12 14l4 3.5V21",done:"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zm-3.5-9.2 2.4 2.5 4.6-4.8",failed:"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zM9 9l6 6m0-6-6 6"},wy={running:"text-emerald-500 dark:text-emerald-400",waiting:"text-amber-500 dark:text-amber-400",done:"text-gray-400 dark:text-gray-500",failed:"text-red-500 dark:text-red-400"};function Jm({state:e,size:a=13,label:r}){return e==="running"?s.jsx("span",{...r?{title:r,"aria-label":r,role:"status"}:{"aria-hidden":!0},style:{width:a,height:a},className:`inline-block shrink-0 animate-spin rounded-full border-[1.5px] border-current border-t-transparent ${wy.running}`}):s.jsxs("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",...r?{role:"img","aria-label":r}:{"aria-hidden":!0},className:`block shrink-0 ${wy[e]}`,children:[r&&s.jsx("title",{children:r}),s.jsx("path",{d:hM[e]})]})}function om({sinceMs:e,offsetMs:a=0}){const[r,i]=k.useState(()=>Date.now());return k.useEffect(()=>{const o=setInterval(()=>i(Date.now()),1e3);return()=>clearInterval(o)},[]),e===void 0?s.jsx("span",{className:"animate-pulse",children:"…"}):s.jsx(s.Fragment,{children:At(Math.max(0,a)+Math.max(0,r-e))})}function pM({item:e}){const[a,r]=k.useState(!1),i=e.stopReason!==void 0&&e.stopReason!=="completed",o=e.streaming?"running":i?"failed":"done",c=e.streaming?v.chat.workRunning:i?e.stopReason:v.chat.workDone;return s.jsxs("div",{children:[s.jsxs("button",{type:"button",onClick:()=>r(d=>!d),"aria-expanded":a,className:"flex w-full items-center gap-2 px-3 py-1.5 text-left transition-colors duration-150 hover:bg-gray-50 dark:hover:bg-gray-800/50",children:[s.jsx(Jm,{state:o,label:c}),s.jsx("span",{className:"shrink-0 text-xs text-gray-500 dark:text-gray-400",children:v.chat.thinking}),s.jsx("span",{className:"shrink-0 font-mono text-xs text-gray-500 dark:text-gray-400",children:e.streaming?s.jsx(om,{sinceMs:e.startedAtMs}):e.durationMs!==void 0?At(e.durationMs):null}),i&&s.jsxs("span",{className:"font-mono text-xs text-gray-400",children:["[",e.stopReason,"]"]}),s.jsx("span",{className:"min-w-0 flex-1"}),s.jsx(Zt,{open:a,className:"text-gray-400"})]}),a&&s.jsx("div",{className:"md-body anim-fade mx-3 mb-2 rounded-md bg-gray-50 px-3 py-2 text-sm leading-relaxed text-gray-600 dark:bg-gray-900/60 dark:text-gray-400",children:s.jsx(ys,{remarkPlugins:[vs],children:e.thinking})})]})}function gM({onDecide:e}){const[a,r]=k.useState(!1),i=async o=>{r(!0);try{await e(o)}finally{r(!1)}};return s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(pe,{size:"sm",variant:"primary",disabled:a,onClick:()=>{i("allow")},children:v.chat.approve}),s.jsx(pe,{size:"sm",disabled:a,onClick:()=>{i("deny")},children:v.chat.deny})]})}function sb({sessionId:e,model:a,running:r,ctx:i}){const[o,c]=k.useState(r),d=k.useRef(!1),f=k.useRef(r),h={...i,...e?{origin:[...i.origin,e]}:{},taskRunning:r};return k.useEffect(()=>{f.current&&!r&&!d.current&&c(!1),f.current=r},[r]),s.jsxs("div",{className:"rounded-md border border-dashed border-gray-300 bg-gray-50/60 dark:border-gray-700 dark:bg-gray-900/40",children:[s.jsxs("button",{type:"button",onClick:()=>{d.current=!0,c(m=>!m)},className:"flex w-full items-center gap-2 rounded-t-md px-3 py-1.5 text-left text-xs text-gray-500 transition-colors duration-200 hover:bg-gray-100/70 dark:text-gray-400 dark:hover:bg-gray-800/50",children:[s.jsx(Zt,{open:o}),s.jsx("span",{className:"font-semibold text-gray-700 dark:text-gray-300",children:v.chat.subagent}),e&&s.jsx("span",{className:"truncate font-mono text-gray-400",children:e}),r&&s.jsxs("span",{className:"ml-auto flex items-center gap-1 text-gray-500 dark:text-gray-400",children:[s.jsx("span",{className:"inline-block h-2.5 w-2.5 animate-spin rounded-full border border-gray-400 border-t-transparent"}),v.chat.subagentRunning]})]}),o&&s.jsx("div",{className:"anim-fade border-t border-dashed border-gray-200 px-3 py-1 dark:border-gray-800",children:s.jsx(cb,{items:a.items,ctx:h})})]})}function xM(e,a){if(e==="exec_command"){const r=yM(a,"cmd");if(r!==null)return`$ ${r.replace(/\s+/g," ").trim()}`}return a.replace(/\s+/g," ").trim()}function yM(e,a){const r=`"${a}"`,i=e.indexOf(r);if(i===-1)return null;let o=i+r.length;for(;/\s/.test(e[o]??"");)o+=1;if(e[o]!==":")return null;for(o+=1;/\s/.test(e[o]??"");)o+=1;if(e[o]!=='"')return null;o+=1;let c="",d=!1;for(;o<e.length;o+=1){const f=e[o];if(d){c+=f==="n"?`
|
|
44
|
+
`:f==="t"?" ":f,d=!1;continue}if(f==="\\"){d=!0;continue}if(f==='"')return c;c+=f}return c}function vM({item:e,ctx:a}){const[r,i]=k.useState(!1),o=k.useRef(!1),c=a.pendingApprovals.get(Bl(a.origin,e.toolCallId)),d=e.subagentSessionId?[...a.origin,e.subagentSessionId].join("/"):null,f=d!==null&&[...a.pendingApprovals.keys()].some(N=>N.startsWith(`${d} `)||N.startsWith(`${d}/`));k.useEffect(()=>{f&&!o.current&&i(!0)},[f]);const h=xM(e.name,e.argumentsText),m=e.callComplete&&!e.outputComplete&&!c,g=e.argStartedAtMs!==void 0&&e.callStartedAtMs!==void 0?Math.max(0,e.callStartedAtMs-e.argStartedAtMs):0,y=e.callStopReason!==void 0&&e.callStopReason!=="completed"||e.outputStopReason!==void 0&&e.outputStopReason!=="completed",b=c?"waiting":m||e.callStreaming?"running":y?"failed":"done",w=c?v.chat.approvalWaiting:b==="running"?v.chat.workRunning:b==="done"?v.chat.workDone:e.outputStopReason??e.callStopReason;return s.jsxs("div",{children:[s.jsxs("button",{type:"button","aria-expanded":r,onClick:()=>{o.current=!0,i(N=>!N)},className:"flex w-full items-center gap-2 px-3 py-1.5 text-left transition-colors duration-150 hover:bg-gray-50 dark:hover:bg-gray-800/50",children:[s.jsx(Jm,{state:b,label:w}),s.jsx("span",{className:"shrink-0 truncate font-mono text-xs font-semibold text-gray-700 dark:text-gray-300",children:e.name||v.chat.unknownTool}),s.jsx("span",{className:"shrink-0 font-mono text-xs text-gray-500 dark:text-gray-400",children:e.durationMs!==void 0?At(e.durationMs):m?s.jsx(om,{sinceMs:e.approvalAtMs??e.callStartedAtMs,offsetMs:g}):c?g>0?At(g):null:e.callStreaming?e.argStartedAtMs!==void 0?s.jsx(om,{sinceMs:e.argStartedAtMs}):s.jsx("span",{className:"animate-pulse",children:"…"}):null}),c&&s.jsx("span",{className:"shrink-0 font-mono text-xs text-amber-600 dark:text-amber-400",children:v.chat.approvalWaiting}),e.callStopReason&&e.callStopReason!=="completed"&&s.jsx(mt,{tone:Hf(e.callStopReason),children:e.callStopReason}),e.outputStopReason&&e.outputStopReason!=="completed"&&s.jsx(mt,{tone:Hf(e.outputStopReason),children:e.outputStopReason}),e.decision&&s.jsxs(mt,{tone:e.decision==="allow"?"green":"red",children:[e.decision==="allow"?v.chat.decisionAllow:v.chat.decisionDeny," · ",e.decisionSource==="manual"?v.chat.decisionManual:v.chat.decisionAuto]}),s.jsx("span",{className:"min-w-0 flex-1"}),s.jsx(Zt,{open:r,className:"text-gray-400"})]}),c&&s.jsxs("div",{className:"border-t border-gray-100 bg-amber-50 px-3 py-2 dark:border-gray-800 dark:bg-amber-950/30",children:[s.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2",children:[s.jsx("span",{className:"shrink-0 rounded-md bg-white px-1.5 py-0.5 font-mono text-xs font-semibold text-gray-700 dark:bg-gray-900 dark:text-gray-300",children:e.name||v.chat.unknownTool}),s.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-xs text-gray-600 dark:text-gray-400",children:h})]}),s.jsx(gM,{onDecide:N=>a.onApprove(e.toolCallId,N,a.origin)})]}),e.subagent&&s.jsx("div",{className:"px-3 pb-2",children:s.jsx(sb,{sessionId:e.subagentSessionId??"",model:e.subagent,running:!e.outputComplete,ctx:a})}),r&&s.jsxs("div",{className:"anim-fade",children:[e.argumentsText&&s.jsx("pre",{className:"whitespace-pre-wrap break-all border-t border-gray-100 bg-gray-50 px-3 py-2 text-xs text-gray-600 dark:border-gray-800 dark:bg-gray-950/60 dark:text-gray-400",children:e.argumentsText}),(e.output||e.outputStreaming)&&s.jsxs("pre",{className:"max-h-72 overflow-auto whitespace-pre-wrap border-t border-gray-100 px-3 py-2 text-xs leading-5 text-gray-600 dark:border-gray-800 dark:text-gray-300",children:[e.output,e.outputStreaming&&s.jsx("span",{className:"animate-pulse",children:"▌"})]}),e.images&&e.images.length>0&&s.jsx("div",{className:"flex flex-wrap gap-2 border-t border-gray-100 px-3 py-2 dark:border-gray-800",children:e.images.map((N,A)=>s.jsx(Hr,{src:N,alt:v.chat.toolImageAlt,className:"max-h-40 max-w-full rounded-md border border-gray-200 dark:border-gray-700"},A))})]})]})}function bM({item:e}){if(e.running)return s.jsxs("div",{className:"anim-msg my-2 flex items-center gap-2 rounded-md border border-gray-200 bg-gray-50 px-3 py-2 text-xs text-gray-700 dark:border-gray-800 dark:bg-gray-900 dark:text-gray-300",children:[s.jsx("span",{className:"inline-block h-3 w-3 animate-spin rounded-full border-2 border-gray-400 border-t-transparent"}),v.chat.compactionRunning(e.mode)]});const a=e.status==="completed"?v.chat.compactionDone(e.mode):v.chat.compactionFailed(e.status??"failed");return s.jsx("p",{className:"my-1 font-mono text-xs text-gray-500 dark:text-gray-400",children:a})}function kM(e){return e.agentName&&e.agentName!==e.agentId?`${e.agentName} (@${e.agentId})`:`@${e.agentId}`}function wM({origin:e}){const a=Jn(),r=v.chat.handoffFrom(kM(e)),i="anim-msg my-2 flex w-fit items-center gap-2 rounded-md border border-gray-200 bg-gray-50 px-3 py-2 text-xs text-gray-600 dark:border-gray-800 dark:bg-gray-900 dark:text-gray-400";if(!e.sessionId)return s.jsx("p",{className:i,children:r});const o=e.sessionId;return s.jsxs("button",{type:"button",title:v.chat.handoffBack(e.sessionTitle),onClick:()=>a(`/chat/${o}`),className:`${i} transition-colors hover:bg-gray-100 hover:text-gray-800 dark:hover:bg-gray-800 dark:hover:text-gray-200`,children:[r,s.jsx("span",{"aria-hidden":!0,className:"text-gray-400 dark:text-gray-500",children:"→"})]})}function SM({origin:e}){return s.jsxs("p",{className:"anim-msg my-2 flex w-fit items-center gap-2 rounded-md border border-gray-200 bg-gray-50 px-3 py-2 text-xs text-gray-600 dark:border-gray-800 dark:bg-gray-900 dark:text-gray-400",children:[v.chat.scheduledFrom(e.name),e.firedAt&&s.jsx("span",{className:"text-gray-400 dark:text-gray-500",children:Nn(e.firedAt)})]})}const eh="M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2zM22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z";function jM(e,a){if(e.length===0)return a;const r=`<use_skills>
|
|
45
|
+
skills: ${e.join(", ")}
|
|
46
|
+
</use_skills>`;return a?`${r}
|
|
47
|
+
|
|
48
|
+
${a}`:r}function NM(e){const a=/^<use_skills>\nskills: ([^\n]+)\n<\/use_skills>/.exec(e);if(!a)return null;const r=a[1].split(",").map(i=>i.trim()).filter(i=>i.length>0);return r.length===0?null:{skills:r,rest:e.slice(a[0].length).replace(/^\n+/,"")}}function CM(e,a,r){return e==="zh"&&r?r:a}function zu(e,a){return e==="zh"?a.shortDescriptionZh||a.shortDescription||a.description:a.shortDescription||a.description}function EM(e,a,r){const i=r.trim().toLowerCase();return i?e.filter(o=>o.name.toLowerCase().includes(i)||zu(a,o).toLowerCase().includes(i)):e}function TM(e,a){return e.map(r=>({name:r.name,cmd:`/${r.name}`,desc:zu(a,r)}))}function MM({names:e}){return s.jsxs("p",{className:"anim-msg my-2 flex w-fit items-center gap-2 rounded-md border border-gray-200 bg-gray-50 px-3 py-2 text-xs text-gray-600 dark:border-gray-800 dark:bg-gray-900 dark:text-gray-400",children:[s.jsx(ht,{d:eh,className:"text-gray-400 dark:text-gray-500"}),v.chat.skillsBanner(e)]})}const AM=/^[\w-]*$/;function Sy(e,a){const r=e.slice(0,a),i=r.lastIndexOf("@");if(i<0||i>0&&!/\s/.test(r[i-1]))return null;const o=r.slice(i+1);if(!AM.test(o))return null;const c=/^[\w-]*/.exec(e.slice(a))[0];return{start:i,end:a+c.length,query:o}}function RM(e,a){const r=a.toLowerCase();return e.filter(i=>i.agentId.toLowerCase().startsWith(r)||(i.name??"").toLowerCase().startsWith(r))}function _M(e,a){const r=/^@([\w-]+)([\s\S]*)$/.exec(e);if(!r)return null;const i=a.find(o=>o.agentId===r[1]);return i?{agent:i,rest:r[2].trimStart()}:null}function ob(e){const a=e.agentName&&e.agentName!==e.agentId?` (${e.agentName})`:"",r=[`agent: ${e.agentId}${a}`];if(e.sessionId){const i=e.sessionTitle?` (${e.sessionTitle})`:"";r.push(`session: ${e.sessionId}${i}`)}return e.workspace&&r.push(`workspace: ${e.workspace}`),["<handoff_from>","This conversation was opened by @-mentioning you from another conversation; its origin is listed below and the user's message, if any, follows. When the request refers to an agent, session, or files without naming them, it means this origin.",...r,"</handoff_from>"].join(`
|
|
49
|
+
`)}function zM(e){const a=/^<handoff_from>\n([\s\S]*)\n<\/handoff_from>$/.exec(e.trim());if(!a)return null;const r={agentId:""};for(const i of a[1].split(`
|
|
50
|
+
`)){const o=/^(agent|session|workspace): (.+)$/.exec(i);if(!o)continue;const c=o[1],d=o[2];if(c==="workspace"){r.workspace=d;continue}const f=/^([\w-]+) \((.*)\)$/.exec(d),h=f?f[1]:d,m=f?.[2];c==="agent"?(r.agentId=h,m!==void 0&&(r.agentName=m)):(r.sessionId=h,m!==void 0&&(r.sessionTitle=m))}return r.agentId?r:null}function DM(e){const a=/^<scheduled_task>\n([\s\S]*?)\n<\/scheduled_task>/.exec(e);if(!a)return null;const r={name:"",firedAt:""};for(const i of a[1].split(`
|
|
51
|
+
`)){const o=/^(schedule|fired_at): (.+)$/.exec(i);o&&(o[1]==="schedule"?r.name=o[2]:r.firedAt=o[2])}return r.name?{origin:r,rest:e.slice(a[0].length).replace(/^\n+/,"")}:null}function Vi({icon:e,value:a,label:r}){return s.jsxs("span",{title:r,"aria-label":r,className:"flex items-center gap-1",children:[s.jsx(ht,{d:e}),a]})}function LM({stats:e,assistantText:a,cost:r,atMs:i}){const[o,c]=k.useState(!1),{currency:d}=Gr(),{locale:f}=ia(),h=e?.tokensByBucket,m=h?h.cacheRead+h.cacheWrite:0,g=()=>{const y=a?.trim()||e===null?a??"":f4(e);navigator.clipboard?.writeText(y).then(()=>{c(!0),setTimeout(()=>c(!1),1500)})};return s.jsxs("div",{className:"-mt-2 flex h-5 flex-wrap items-center justify-start gap-x-3 text-[11px] text-gray-400 opacity-0 transition-opacity duration-150 group-hover:opacity-100 focus-within:opacity-100 dark:text-gray-500",children:[i!==void 0&&s.jsx("span",{children:W1(i,f)}),e&&h&&s.jsxs(s.Fragment,{children:[s.jsx(Vi,{icon:Et.input,value:We(m),label:v.chat.statInput}),s.jsx(Vi,{icon:Et.output,value:We(h.output),label:v.chat.statOutput}),s.jsx(Vi,{icon:Et.tps,value:ou(e.outputTps),label:v.chat.statTps}),r!=null&&s.jsx(Vi,{icon:Et.cost,value:Pn(r,d),label:`${v.chat.statCost}(${d})`}),s.jsx(Vi,{icon:Et.elapsed,value:At(e.elapsedDeltaMs),label:v.chat.statElapsed})]}),s.jsx("button",{type:"button",title:o?v.chat.copied:v.chat.copyReply,"aria-label":v.chat.copyReply,onClick:g,className:"flex h-5 w-5 items-center justify-center rounded transition-colors duration-150 hover:bg-gray-100 hover:text-gray-600 dark:hover:bg-gray-800 dark:hover:text-gray-300",children:s.jsx(ht,{d:o?Et.check:Et.copy})})]})}const OM=1200;function jf({atMs:e,text:a,align:r="left"}){const{locale:i}=ia(),[o,c]=k.useState(!1),d=()=>{a!==void 0&&(navigator.clipboard.writeText(a),c(!0),setTimeout(()=>c(!1),OM))};return s.jsxs("div",{className:`flex h-5 items-center gap-2 opacity-0 transition-opacity duration-150 group-hover:opacity-100 focus-within:opacity-100 ${r==="right"?"justify-end":"justify-start"}`,children:[e!==void 0&&s.jsx("span",{className:"text-[11px] text-gray-400",children:W1(e,i)}),a!==void 0&&s.jsx("button",{type:"button",title:o?v.chat.copied:v.chat.copyMessage,"aria-label":v.chat.copyMessage,onClick:d,className:"rounded p-0.5 text-gray-400 transition-colors hover:bg-gray-100 hover:text-gray-600 dark:hover:bg-gray-800 dark:hover:text-gray-300",children:s.jsx(ht,{d:o?Et.check:Et.copy})})]})}function ub({item:e,ctx:a}){switch(e.kind){case"user_text":{const r=zM(e.text);if(r)return s.jsx(wM,{origin:r});const i=DM(e.text),o=i?i.rest:e.text,c=NM(o),{text:d,images:f}=rM(c?c.rest:o);return s.jsxs(s.Fragment,{children:[i&&s.jsx(SM,{origin:i.origin}),c&&s.jsx(MM,{names:c.skills}),d&&s.jsxs("div",{className:"anim-msg group my-4 flex flex-col items-end",children:[s.jsx("div",{className:"max-w-[88%] rounded-lg bg-gray-100 px-4 py-2.5 md:max-w-[75%] dark:bg-gray-800",children:s.jsx("p",{className:"whitespace-pre-wrap break-words text-base leading-relaxed text-gray-900 dark:text-gray-100",children:d})}),s.jsx(jf,{...e.atMs!==void 0?{atMs:e.atMs}:{},text:d,align:"right"})]}),f.map((h,m)=>s.jsxs("div",{className:"anim-msg group my-4 flex flex-col items-end",children:[s.jsx("div",{className:"max-w-[88%] rounded-lg bg-gray-100 p-1.5 md:max-w-[75%] dark:bg-gray-800",children:s.jsx(Hr,{src:h,alt:v.chat.imageAlt,className:"max-h-48 max-w-full rounded-md"})}),s.jsx(jf,{...e.atMs!==void 0?{atMs:e.atMs}:{},align:"right"})]},m))]})}case"user_image":return s.jsxs("div",{className:"anim-msg group my-4 flex flex-col items-end",children:[s.jsx("div",{className:"max-w-[88%] rounded-lg bg-gray-100 p-1.5 md:max-w-[75%] dark:bg-gray-800",children:s.jsx(Hr,{src:e.imageUrl,alt:v.chat.imageAlt,className:"max-h-48 max-w-full rounded-md"})}),s.jsx(jf,{...e.atMs!==void 0?{atMs:e.atMs}:{},align:"right"})]});case"assistant_text":return s.jsxs("div",{className:"md-body anim-msg my-3 text-base leading-relaxed text-gray-800 dark:text-gray-100",children:[s.jsx(ys,{remarkPlugins:[vs],children:e.text}),e.streaming&&s.jsx("span",{className:"animate-pulse text-gray-400",children:"▌"}),e.stopReason&&e.stopReason!=="completed"&&s.jsxs("span",{className:"ml-1 font-mono text-xs text-gray-400",children:["[",e.stopReason,"]"]}),!e.streaming&&a.onOpenFile&&a.statFiles&&s.jsx(mM,{text:e.text,workspace:a.workspace??null,statFiles:a.statFiles,onOpenFile:a.onOpenFile})]});case"thinking":return s.jsx(pM,{item:e});case"tool_call":return s.jsx(vM,{item:e,ctx:a});case"subagent":return s.jsx("div",{className:"anim-msg my-2",children:s.jsx(sb,{sessionId:e.sessionId,model:e.model,running:!1,ctx:a})});case"abort":return s.jsx("p",{className:"anim-msg my-1 font-mono text-xs text-gray-500 dark:text-gray-400",children:v.chat.aborted(e.reason)});case"reconnect":return s.jsx("p",{className:"anim-msg my-1 font-mono text-xs text-amber-600 dark:text-amber-500",children:v.chat.reconnect(e.status,e.gaveUp?"gaveUp":e.retrying?"retried":"waiting",e.attempt)});case"compaction":return s.jsx(bM,{item:e});case"task_stats":return s.jsx(LM,{stats:e.stats,assistantText:e.assistantText,cost:e.stats?a.taskCost?.(e.stats)??null:null,...e.atMs!==void 0?{atMs:e.atMs}:{}})}}function IM(e){let a=0,r=0;const i=[],o=(f,h)=>{h<=0||(f===void 0?r+=h:i.push([f,f+h]))};for(const f of e){if(f.kind==="thinking"){f.durationMs!==void 0&&o(f.startedAtMs,f.durationMs);continue}if(f.kind!=="tool_call"||(a+=1,f.durationMs===void 0))continue;const h=f.argStartedAtMs!==void 0&&f.callStartedAtMs!==void 0?Math.min(f.durationMs,Math.max(0,f.callStartedAtMs-f.argStartedAtMs)):0;o(f.argStartedAtMs,h),o(f.approvalAtMs??f.callStartedAtMs,f.durationMs-h)}i.sort((f,h)=>f[0]-h[0]);let c=null,d=0;for(const[f,h]of i)c===null||f>d?(c!==null&&(r+=d-c),c=f,d=h):h>d&&(d=h);return c!==null&&(r+=d-c),{steps:a,durationMs:r}}function UM(e){return e.kind==="thinking"||e.kind==="tool_call"}function $M(e,a){return e.kind==="thinking"?e.streaming:e.kind==="tool_call"?e.callStreaming||e.outputStreaming||e.callComplete&&!e.outputComplete?!0:a.pendingApprovals.has(Bl(a.origin,e.toolCallId)):!1}function BM(e,a){return e.some(r=>r.kind==="tool_call"&&a.pendingApprovals.has(Bl(a.origin,r.toolCallId)))}function HM({items:e,ctx:a,isLast:r}){const i=r&&a.taskRunning||e.some(y=>$M(y,a)),o=BM(e,a),[c,d]=k.useState(r),f=k.useRef(!1);k.useEffect(()=>{f.current||d(r)},[r]);const h=c||o,{steps:m,durationMs:g}=IM(e);return s.jsxs("div",{className:"anim-msg my-2 overflow-hidden rounded-md border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900",children:[s.jsxs("button",{type:"button","aria-expanded":h,onClick:()=>{f.current=!0,d(y=>!y)},className:"flex w-full items-center gap-2 bg-gray-50 px-3 py-2 text-left transition-colors duration-150 hover:bg-gray-100 dark:bg-gray-900/60 dark:hover:bg-gray-800/60",children:[s.jsx(Jm,{state:i?"running":"done",size:12}),s.jsx("span",{className:`shrink-0 text-[11px] font-semibold uppercase tracking-wide ${i?"text-emerald-600 dark:text-emerald-400":"text-gray-500 dark:text-gray-400"}`,children:i?v.chat.workRunning:v.chat.workDone}),m>0&&s.jsx("span",{className:"shrink-0 font-mono text-xs text-gray-400",children:v.chat.workGroupSteps(m)}),g>0&&s.jsx("span",{className:"shrink-0 font-mono text-xs text-gray-400",children:At(g)}),o&&!h&&s.jsx("span",{className:"shrink-0 rounded bg-amber-100 px-1 text-[10px] font-medium text-amber-700 dark:bg-amber-950/50 dark:text-amber-300",children:v.chat.approvalWaiting}),s.jsx("span",{className:"min-w-0 flex-1"}),s.jsx(Zt,{open:h,className:"text-gray-400"})]}),h&&s.jsx("div",{className:"anim-fade divide-y divide-gray-100 border-t border-gray-200 dark:divide-gray-800/60 dark:border-gray-800",children:e.map(y=>s.jsx(ub,{item:y,ctx:a},y.id))})]})}function PM(){let e=!0,a=null,r=null;return{get stick(){return e},wheel(i){i<0&&(e=!1)},touchStart(i){r=i},touchMove(i){r!==null&&i>r&&(e=!1),r=i},touchEnd(){r=null},scrolled(i){const o=i.scrollHeight-i.scrollTop-i.clientHeight,c=a;if(a=i.scrollTop,c===null){e=o<80;return}if(i.scrollTop<c&&o>1){e=!1;return}o<80&&(e=!0)}}}function cb({items:e,ctx:a}){const r=[];let i=[];const o=()=>{i.length>0&&(r.push({type:"group",items:i}),i=[])};for(const m of e)UM(m)?i.push(m):(o(),r.push({type:"single",item:m}));o();const c=(m,g)=>m.type==="group"?s.jsx(HM,{items:m.items,ctx:a,isLast:g===r.length-1},`wg-${m.items[0].id}`):s.jsx(ub,{item:m.item,ctx:a},m.item.id),d=[];let f=[];const h=()=>{if(f.length===0)return;const m=f[0].seg,g=m.type==="group"?m.items[0].id:m.item.id,y=f;f=[],d.push(s.jsx("div",{className:"group",children:y.map(b=>c(b.seg,b.i))},`turn-${g}`))};for(let m=0;m<r.length;m++){const g=r[m];if(g.type==="single"&&(g.item.kind==="user_text"||g.item.kind==="user_image")){h(),d.push(c(g,m));continue}f.push({seg:g,i:m}),g.type==="single"&&g.item.kind==="task_stats"&&h()}return h(),s.jsx(s.Fragment,{children:d})}function qM({items:e,version:a,ctx:r}){const i=k.useRef(null),o=k.useRef(null),c=o.current??=PM(),d=()=>{const f=i.current;f&&c.scrolled({scrollTop:f.scrollTop,scrollHeight:f.scrollHeight,clientHeight:f.clientHeight})};return k.useEffect(()=>{const f=i.current;f&&c.stick&&(f.scrollTop=f.scrollHeight)},[a,c]),s.jsx("div",{ref:i,onScroll:d,onWheel:f=>c.wheel(f.deltaY),onTouchStart:f=>{const h=f.touches[0];h&&c.touchStart(h.clientY)},onTouchMove:f=>{const h=f.touches[0];h&&c.touchMove(h.clientY)},onTouchEnd:()=>c.touchEnd(),className:"anim-fade h-full overflow-y-auto px-4 py-4 md:px-6",children:s.jsx("div",{className:"mx-auto max-w-3xl",children:e.length===0?s.jsx(fr,{title:v.chat.emptyStream}):s.jsx(cb,{items:e,ctx:r})})})}const FM=128e3;function db(e){const a=typeof e=="string"?Number(e):e;return typeof a=="number"&&Number.isFinite(a)&&a>0?a:FM}const VM=/[\s"'/]on[a-z]+\s*=/i,YM=/href\s*=/i;function GM(e){if(!e)return null;const a=e.trim();if(!/^<svg[\s>]/i.test(a))return null;const r=a.toLowerCase();return r.includes("<script")||r.includes("foreignobject")||YM.test(a)||VM.test(a)?null:a}function fb({icon:e,size:a=20,className:r=""}){const i=GM(e);return i?s.jsx("span",{"aria-hidden":!0,style:{width:a,height:a},className:`block shrink-0 [&>svg]:block [&>svg]:h-full [&>svg]:w-full ${r}`,dangerouslySetInnerHTML:{__html:i}}):s.jsx(ht,{d:eh,size:a,className:r})}const jy={anthropic:{path:s.jsx("path",{d:"M17.3041 3.541h-3.6718l6.696 16.918H24Zm-10.6082 0L0 20.459h3.7442l1.3693-3.5527h7.0052l1.3693 3.5528h3.7442L10.5363 3.5409Zm-.3712 10.2232 2.2914-5.9456 2.2914 5.9456Z"})},openai:{path:s.jsx("path",{d:"M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z"})},google:{path:s.jsx("path",{d:"M12 24A14.304 14.304 0 0 0 0 12 14.304 14.304 0 0 0 12 0a14.305 14.305 0 0 0 12 12 14.305 14.305 0 0 0-12 12"})},deepseek:{path:s.jsx("path",{d:"M23.748 4.482c-.254-.124-.364.113-.512.234-.051.039-.094.09-.137.136-.372.397-.806.657-1.373.626-.829-.046-1.537.214-2.163.848-.133-.782-.575-1.248-1.247-1.548-.352-.156-.708-.311-.955-.65-.172-.241-.219-.51-.305-.774-.055-.16-.11-.323-.293-.35-.2-.031-.278.136-.356.276-.313.572-.434 1.202-.422 1.84.027 1.436.633 2.58 1.838 3.393.137.093.172.187.129.323-.082.28-.18.552-.266.833-.055.179-.137.217-.328.14a5.526 5.526 0 0 1-1.736-1.18c-.857-.828-1.631-1.742-2.597-2.458a11.365 11.365 0 0 0-.689-.471c-.985-.957.13-1.743.388-1.836.27-.098.093-.432-.779-.428-.872.004-1.67.295-2.687.684a3.055 3.055 0 0 1-.465.137 9.597 9.597 0 0 0-2.883-.102c-1.885.21-3.39 1.102-4.497 2.623C.082 8.606-.231 10.684.152 12.85c.403 2.284 1.569 4.175 3.36 5.653 1.858 1.533 3.997 2.284 6.438 2.14 1.482-.085 3.133-.284 4.994-1.86.47.234.962.327 1.78.397.63.059 1.236-.03 1.705-.128.735-.156.684-.837.419-.961-2.155-1.004-1.682-.595-2.113-.926 1.096-1.296 2.746-2.642 3.392-7.003.05-.347.007-.565 0-.845-.004-.17.034-.237.23-.256a4.173 4.173 0 0 0 1.545-.475c1.396-.763 1.96-2.015 2.093-3.517.02-.23-.004-.467-.247-.588zM11.581 18c-2.089-1.642-3.102-2.183-3.52-2.16-.392.024-.321.471-.235.763.09.288.207.486.371.739.114.167.192.416-.113.603-.673.416-1.842-.14-1.897-.167-1.361-.802-2.5-1.86-3.301-3.307-.774-1.393-1.224-2.887-1.298-4.482-.02-.386.093-.522.477-.592a4.696 4.696 0 0 1 1.529-.039c2.132.312 3.946 1.265 5.468 2.774.868.86 1.525 1.887 2.202 2.891.72 1.066 1.494 2.082 2.48 2.914.348.292.625.514.891.677-.802.09-2.14.11-3.054-.615zm1-6.44a.306.306 0 0 1 .415-.287.302.302 0 0 1 .2.288.306.306 0 0 1-.31.307.303.303 0 0 1-.304-.308zm3.11 1.596c-.2.081-.399.151-.59.16a1.245 1.245 0 0 1-.798-.254c-.274-.23-.47-.358-.552-.758a1.73 1.73 0 0 1 .016-.588c.07-.327-.008-.537-.239-.727-.187-.156-.426-.199-.688-.199a.559.559 0 0 1-.254-.078c-.11-.054-.2-.19-.114-.358.028-.054.16-.186.191-.21.356-.202.767-.136 1.146.016.352.144.618.408 1.001.782.391.451.462.576.685.914.176.265.336.537.445.848.067.196-.02.354-.25.452z"})},zhipu:{path:s.jsx("path",{d:"M4.6 3.2h14.8a.9.9 0 0 1 .73 1.43L9.9 18.6h9.2a.9.9 0 0 1 0 1.8H4.6a.9.9 0 0 1-.73-1.43L14.1 5.4H4.6a1.1 1.1 0 0 1 0-2.2Z"})},moonshot:{path:s.jsx("path",{d:"m1.053 16.91 9.538 2.55a21 20.981 0 0 0 .06 2.031l5.956 1.592a12 11.99 0 0 1-15.554-6.172m-1.02-5.79 11.352 3.035a21 20.981 0 0 0-.469 2.01l10.817 2.89a12 11.99 0 0 1-1.845 2.004L.658 15.918a12 11.99 0 0 1-.625-4.796m1.593-5.146L13.573 9.17a21 20.981 0 0 0-1.01 1.874l11.297 3.02a21 20.981 0 0 1-.67 2.362l-11.55-3.087L.125 10.26a12 11.99 0 0 1 1.499-4.285ZM6.067 1.58l11.285 3.016a21 20.981 0 0 0-1.688 1.719l7.824 2.091a21 20.981 0 0 1 .513 2.664L2.107 5.218a12 11.99 0 0 1 3.96-3.638M21.68 4.866 7.222 1.003A12 11.99 0 0 1 21.68 4.866"})},openrouter:{path:s.jsx("path",{d:"M16.778 1.844v1.919q-.569-.026-1.138-.032-.708-.008-1.415.037c-1.93.126-4.023.728-6.149 2.237-2.911 2.066-2.731 1.95-4.14 2.75-.396.223-1.342.574-2.185.798-.841.225-1.753.333-1.751.333v4.229s.768.108 1.61.333c.842.224 1.789.575 2.185.799 1.41.798 1.228.683 4.14 2.75 2.126 1.509 4.22 2.11 6.148 2.236.88.058 1.716.041 2.555.005v1.918l7.222-4.168-7.222-4.17v2.176c-.86.038-1.611.065-2.278.021-1.364-.09-2.417-.357-3.979-1.465-2.244-1.593-2.866-2.027-3.68-2.508.889-.518 1.449-.906 3.822-2.59 1.56-1.109 2.614-1.377 3.978-1.466.667-.044 1.418-.017 2.278.02v2.176L24 6.014Z"})},siliconflow:{viewBox:"0 0 53.021 25.354",path:s.jsx("path",{d:"M50.7172 0H27.6622C26.3877 0 25.3586 1.03397 25.3586 2.30358V9.21911C25.3586 10.4935 24.3294 11.5227 23.055 11.5227H2.30357C1.02914 11.5227 0 12.5567 0 13.8263V23.0502C0 24.3246 1.03395 25.3538 2.30357 25.3538H25.3586C26.633 25.3538 27.6622 24.3198 27.6622 23.0502V16.1347C27.6622 14.8602 28.6913 13.8311 29.9657 13.8311H50.7172C51.9916 13.8311 53.0207 12.7971 53.0207 11.5275V2.30358C53.0207 1.02916 51.9868 0 50.7172 0Z"})},custom:{stroke:!0,path:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M12 2.8 20.5 7.4v9.2L12 21.2 3.5 16.6V7.4L12 2.8Z"}),s.jsx("path",{d:"M3.5 7.4 12 12l8.5-4.6M12 12v9.2"})]})}};function cs({provider:e,className:a}){const r=jy[e]??jy.custom;return s.jsx("svg",{viewBox:r.viewBox??"0 0 24 24",className:a,"aria-hidden":!0,...r.stroke?{fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinejoin:"round"}:{fill:"currentColor"},children:r.path})}var Ji="https://openrouter.ai/api/v1",tu="https://api.siliconflow.cn/v1",mr=[{id:"deepseek",label:"DeepSeek",envKey:"DEEPSEEK_API_KEY",envBaseUrlKey:"DEEPSEEK_BASE_URL",apiKeyUrl:"https://platform.deepseek.com/api_keys",modelsUrl:"https://api-docs.deepseek.com/quick_start/pricing"},{id:"openrouter",label:"OpenRouter",envKey:"OPENAI_API_KEY",envBaseUrlKey:"OPENAI_BASE_URL",apiKeyUrl:"https://openrouter.ai/workspaces/default/keys",modelsUrl:"https://openrouter.ai/models",gatewayBaseUrl:Ji},{id:"siliconflow",label:"SiliconFlow",envKey:"OPENAI_API_KEY",envBaseUrlKey:"OPENAI_BASE_URL",apiKeyUrl:"https://cloud.siliconflow.cn/me/account/ak",modelsUrl:"https://cloud.siliconflow.cn/models",gatewayBaseUrl:tu},{id:"google",label:"Google Gemini",envKey:"GEMINI_API_KEY",envBaseUrlKey:"GEMINI_BASE_URL",apiKeyUrl:"https://aistudio.google.com/api-keys",modelsUrl:"https://ai.google.dev/gemini-api/docs/models"},{id:"anthropic",label:"Anthropic",envKey:"ANTHROPIC_API_KEY",envBaseUrlKey:"ANTHROPIC_BASE_URL",apiKeyUrl:"https://platform.claude.com/settings/keys",modelsUrl:"https://docs.claude.com/en/docs/about-claude/models/overview"},{id:"openai",label:"OpenAI",envKey:"OPENAI_API_KEY",envBaseUrlKey:"OPENAI_BASE_URL",apiKeyUrl:"https://platform.openai.com/api-keys",modelsUrl:"https://platform.openai.com/docs/models"},{id:"zhipu",label:"Z.AI (GLM)",envKey:"ZAI_API_KEY",envBaseUrlKey:"ZAI_BASE_URL",apiKeyUrl:"https://open.bigmodel.cn/apikey/platform",modelsUrl:"https://docs.z.ai/guides/overview/pricing"},{id:"moonshot",label:"Moonshot (Kimi)",envKey:"MOONSHOT_API_KEY",envBaseUrlKey:"MOONSHOT_BASE_URL",apiKeyUrl:"https://platform.kimi.com/console/api-keys",modelsUrl:"https://platform.kimi.com/docs/pricing"},{id:"custom",label:"Custom",envKey:"OPENAI_API_KEY",envBaseUrlKey:"OPENAI_BASE_URL"}];function Lr(e,a,r){const i=o=>Math.round(o/7*1e6)/1e6;return vt(i(e),i(a),i(r))}function vt(e,a,r){return{unit:"usd_per_mtok",cache_read:e,cache_write:a,output:r}}var KM=[{modelId:"deepseek-v4-pro",displayName:"DeepSeek V4 Pro",provider:"deepseek",contextWindow:1e6,pricing:Lr(.025,3,6),supportsVision:!1},{modelId:"deepseek-v4-flash",displayName:"DeepSeek V4 Flash",provider:"deepseek",contextWindow:1e6,pricing:Lr(.02,1,2),supportsVision:!1},{modelId:"claude-opus-4-8",displayName:"Claude Opus 4.8",provider:"anthropic",contextWindow:1e6,pricing:vt(.5,6.25,25),supportsVision:!0},{modelId:"claude-opus-4-7",displayName:"Claude Opus 4.7",provider:"anthropic",contextWindow:1e6,pricing:vt(.5,6.25,25),supportsVision:!0},{modelId:"claude-sonnet-4-6",displayName:"Claude Sonnet 4.6",provider:"anthropic",contextWindow:1e6,pricing:vt(.3,3.75,15),supportsVision:!0},{modelId:"gpt-5.5",displayName:"GPT-5.5",provider:"openai",contextWindow:105e4,pricing:vt(.5,5,30),supportsVision:!0},{modelId:"gpt-5.5-pro",displayName:"GPT-5.5 Pro",provider:"openai",contextWindow:105e4,pricing:vt(30,30,180),supportsVision:!0},{modelId:"gpt-5.4",displayName:"GPT-5.4",provider:"openai",contextWindow:105e4,pricing:vt(.25,2.5,15),supportsVision:!0},{modelId:"gpt-5.4-mini",displayName:"GPT-5.4 mini",provider:"openai",contextWindow:4e5,pricing:vt(.075,.75,4.5),supportsVision:!0},{modelId:"gpt-5.4-nano",displayName:"GPT-5.4 nano",provider:"openai",contextWindow:4e5,pricing:vt(.02,.2,1.25),supportsVision:!0},{modelId:"gpt-5.4-pro",displayName:"GPT-5.4 Pro",provider:"openai",contextWindow:105e4,pricing:vt(30,30,180),supportsVision:!0},{modelId:"gemini-3.1-pro-preview",displayName:"Gemini 3.1 Pro (Preview)",provider:"google",contextWindow:1048576,pricing:vt(.2,2,12),supportsVision:!0},{modelId:"gemini-3.5-flash",displayName:"Gemini 3.5 Flash",provider:"google",contextWindow:1048576,pricing:vt(.15,1.5,9),supportsVision:!0},{modelId:"gemini-3-flash-preview",displayName:"Gemini 3 Flash (Preview)",provider:"google",contextWindow:1048576,pricing:vt(.05,.5,3),supportsVision:!0},{modelId:"gemini-3.1-flash-lite",displayName:"Gemini 3.1 Flash-Lite",provider:"google",contextWindow:1048576,pricing:vt(.025,.25,1.5),supportsVision:!0},{modelId:"glm-5.2",displayName:"GLM-5.2",provider:"zhipu",contextWindow:1e6,pricing:vt(.26,1.4,4.4),supportsVision:!1},{modelId:"glm-5.1",displayName:"GLM-5.1",provider:"zhipu",contextWindow:2e5,pricing:vt(.26,1.4,4.4),supportsVision:!1},{modelId:"glm-5",displayName:"GLM-5",provider:"zhipu",contextWindow:2e5,pricing:vt(.2,1,3.2),supportsVision:!1},{modelId:"kimi-k2.6",displayName:"Kimi K2.6",provider:"moonshot",contextWindow:262144,pricing:Lr(1.1,6.5,27),supportsVision:!0},{modelId:"kimi-k2.5",displayName:"Kimi K2.5",provider:"moonshot",contextWindow:262144,pricing:Lr(.7,4,21),supportsVision:!0},{modelId:"xiaomi/mimo-v2.5",displayName:"MiMo-V2.5",provider:"openrouter",contextWindow:1048576,pricing:vt(.0028,.14,.28),supportsVision:!0,clientType:"openai",baseUrl:Ji},{modelId:"tencent/hy3",displayName:"Hy3",provider:"openrouter",contextWindow:262144,pricing:vt(.035,.14,.58),supportsVision:!1,clientType:"openai",baseUrl:Ji},{modelId:"minimax/minimax-m3",displayName:"MiniMax M3",provider:"openrouter",contextWindow:1048576,pricing:vt(.06,.3,1.2),supportsVision:!0,clientType:"openai",baseUrl:Ji},{modelId:"stepfun/step-3.7-flash",displayName:"Step 3.7 Flash",provider:"openrouter",contextWindow:256e3,pricing:vt(.04,.2,1.15),supportsVision:!0,clientType:"openai",baseUrl:Ji},{modelId:"zai-org/GLM-5.2",displayName:"GLM-5.2",provider:"siliconflow",contextWindow:1e6,pricing:Lr(2,8,28),supportsVision:!1,clientType:"openai",baseUrl:tu},{modelId:"deepseek-ai/DeepSeek-V4-Pro",displayName:"DeepSeek V4 Pro",provider:"siliconflow",contextWindow:1e6,pricing:Lr(.1,12,24),supportsVision:!1,clientType:"openai",baseUrl:tu},{modelId:"meituan-longcat/LongCat-2.0",displayName:"LongCat 2.0",provider:"siliconflow",contextWindow:1e6,pricing:Lr(.1,5,20),supportsVision:!1,clientType:"openai",baseUrl:tu}];function th(e,a){return KM.find(r=>r.provider===e&&r.modelId===a)}function dr(e){return mr.find(a=>a.id===e)}function WM(e,a){const r=(a||e).toLowerCase(),i=o=>({envKey:`${o}_API_KEY`,envBaseUrlKey:`${o}_BASE_URL`});if(r.includes("gemini-3")||r.includes("gemini-embedding"))return i("GEMINI");if(r.includes("claude")&&(r.includes("4-7")||r.includes("4-8")||r.includes("-5")||r.includes("4-6")))return i("ANTHROPIC");if(r.includes("gpt-5.4")||r.includes("gpt-5.5"))return i("OPENAI");if(r.includes("glm-5"))return i("ZAI");if(r.includes("kimi-k2.5")||r.includes("kimi-k2.6"))return i("MOONSHOT");if(r.includes("deepseek-v4"))return i("DEEPSEEK");if(r.includes("openai"))return i("OPENAI")}function ot(e,a){return!!e&&!!a&&e.provider===a.provider&&e.modelId===a.modelId}function mb(e){return{id:e,label:e,envKey:"OPENAI_API_KEY",envBaseUrlKey:"OPENAI_BASE_URL"}}function hb(e,a){const r=a.trim().toLowerCase();if(!r)return!0;const i=mr.find(o=>o.id===e.provider);return e.modelId.toLowerCase().includes(r)||(e.displayName??"").toLowerCase().includes(r)||e.provider.toLowerCase().includes(r)||(i?.label??"").toLowerCase().includes(r)}function XM(e,a){const r=a.trim()!=="",i=e.filter(f=>hb(f,a)),o=mr.map(f=>({provider:f,rows:i.filter(h=>h.provider===f.id)})),d=[...new Set(i.map(f=>f.provider).filter(f=>!mr.some(h=>h.id===f)))].sort().map(f=>({provider:mb(f),rows:i.filter(h=>h.provider===f)}));return[...o,...d].filter(f=>f.rows.length>0||!r&&f.provider.id==="custom")}const QM=["always-ask","read-only","allow-all","deny-all"],Ny={"allow-all":"M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0zM12 9v4m0 4h.01","deny-all":"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zM5.64 5.64l12.72 12.72","read-only":"M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7zM15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0z","always-ask":"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zM9.1 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3m.07 4h.01"};function ZM({value:e,onChange:a,disabled:r,direction:i="up"}){const[o,c]=k.useState(!1);return s.jsx(Da,{open:o,setOpen:c,menuClass:i==="down"?"left-0 top-full mt-1 w-max max-w-[calc(100vw-2rem)] origin-top-left":"bottom-full left-0 mb-1 w-max max-w-[calc(100vw-2rem)] origin-bottom-left",button:s.jsxs("button",{type:"button","aria-label":v.chat.approvalMode,title:`${v.chat.approvalMode}:${v.chat.approvalModeNames[e]??e}`,disabled:r,onClick:()=>c(d=>!d),className:"flex h-8 max-w-44 shrink-0 items-center gap-1.5 rounded-md px-2 text-xs text-gray-500 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-800 disabled:cursor-not-allowed disabled:opacity-50 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-200",children:[s.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,className:"shrink-0",children:s.jsx("path",{d:Ny[e]})}),s.jsx("span",{className:"hidden min-w-0 truncate @md:block",children:v.chat.approvalModeNames[e]??e}),s.jsx("svg",{width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",className:"shrink-0","aria-hidden":!0,children:s.jsx("path",{d:"M3 4.5l3 3 3-3",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),children:QM.map(d=>s.jsxs("button",{type:"button",onClick:()=>{a(d),c(!1)},className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors duration-150 hover:bg-gray-100 dark:hover:bg-gray-800 ${d===e?"font-medium text-gray-900 dark:text-gray-100":"text-gray-600 dark:text-gray-400"}`,children:[s.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,className:"shrink-0 text-gray-400 dark:text-gray-500",children:s.jsx("path",{d:Ny[d]})}),s.jsx("span",{className:"min-w-0 flex-1 truncate whitespace-nowrap",children:v.chat.approvalModes[d]??d}),s.jsx("span",{className:"w-3 shrink-0 text-center",children:d===e?"✓":""})]},d))})}function um(e){return e.displayName??e.modelId}function JM({models:e,value:a,defaultModel:r,onChange:i,disabled:o}){const[c,d]=k.useState(!1),[f,h]=k.useState(""),m=e.find(b=>ot(b,a)),g=m?um(m):a?.modelId??"…",y=e.filter(b=>hb(b,f));return s.jsxs(Da,{open:c,setOpen:d,menuClass:"right-0 top-full mt-1 w-max min-w-56 max-w-[calc(100vw-2rem)] origin-top-right",button:s.jsxs("button",{type:"button",title:`${v.chat.chooseModel}:${g}`,"aria-label":v.chat.chooseModel,disabled:o||e.length===0,onClick:()=>{const b=!c;d(b),b&&h("")},className:"flex h-8 max-w-44 shrink-0 items-center gap-1.5 rounded-md px-2 text-xs text-gray-500 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-800 disabled:cursor-not-allowed disabled:opacity-50 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-200",children:[s.jsx(cs,{provider:m?.provider??a?.provider??"custom",className:"h-4 w-4 shrink-0"}),s.jsx("span",{className:"hidden min-w-0 truncate @md:block",children:g}),s.jsx("svg",{width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",className:"shrink-0","aria-hidden":!0,children:s.jsx("path",{d:"M3 4.5l3 3 3-3",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),children:[s.jsx("div",{className:"border-b border-gray-100 px-2 pb-1.5 pt-0.5 dark:border-gray-800",children:s.jsx("input",{autoFocus:!0,value:f,onChange:b=>h(b.target.value),placeholder:v.models.searchPlaceholder,"aria-label":v.models.searchPlaceholder,className:"w-full rounded border border-transparent bg-transparent px-1 py-0.5 text-xs text-gray-700 placeholder:text-gray-400 focus:outline-none dark:text-gray-200 dark:placeholder:text-gray-500"})}),s.jsxs("div",{className:"max-h-56 overflow-y-auto",children:[y.length===0&&s.jsx("p",{className:"px-3 py-1.5 text-xs text-gray-400",children:v.models.noSearchResults}),y.map(b=>s.jsxs("button",{type:"button",onClick:()=>{i({provider:b.provider,modelId:b.modelId}),d(!1)},className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors duration-150 hover:bg-gray-100 dark:hover:bg-gray-800 ${ot(b,a)?"font-medium text-gray-900 dark:text-gray-100":"text-gray-600 dark:text-gray-400"}`,children:[s.jsx(cs,{provider:b.provider,className:"h-4 w-4 shrink-0"}),s.jsx("span",{className:"min-w-0 flex-1 truncate",children:um(b)}),ot(b,r)&&s.jsx("span",{className:"shrink-0 text-xs text-gray-400 dark:text-gray-500",children:v.models.default}),s.jsx("span",{className:"w-3 shrink-0 text-center text-xs",children:ot(b,a)?"✓":""})]},`${b.provider}:${b.modelId}`))]})]})}function eA({skills:e,selected:a,onToggle:r,disabled:i,direction:o="up"}){const{locale:c}=ia(),[d,f]=k.useState(!1),[h,m]=k.useState(""),g=EM(e,c,h);return s.jsxs(Da,{open:d,setOpen:f,menuClass:o==="down"?"left-0 top-full mt-1 w-72 max-w-[calc(100vw-2rem)] origin-top-left":"bottom-full left-0 mb-1 w-72 max-w-[calc(100vw-2rem)] origin-bottom-left",button:s.jsxs("button",{type:"button","aria-label":v.chat.skillsSelect,title:v.chat.skillsSelect,disabled:i,onClick:()=>{const y=!d;f(y),y&&m("")},className:"flex h-8 max-w-44 shrink-0 items-center gap-1.5 rounded-md px-2 text-xs text-gray-500 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-800 disabled:cursor-not-allowed disabled:opacity-50 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-200",children:[s.jsx(ht,{d:eh,size:14,className:"shrink-0"}),s.jsx("span",{className:"hidden min-w-0 truncate @md:block",children:v.chat.skillsSelect}),a.length>0&&s.jsx("span",{className:"shrink-0 rounded-full bg-gray-200/80 px-1.5 py-px font-mono text-[10px] font-semibold text-gray-700 dark:bg-gray-700/60 dark:text-gray-200",children:a.length}),s.jsx("svg",{width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",className:"shrink-0","aria-hidden":!0,children:s.jsx("path",{d:"M3 4.5l3 3 3-3",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),children:[s.jsx("div",{className:"border-b border-gray-100 px-2 pb-1.5 pt-0.5 dark:border-gray-800",children:s.jsx("input",{autoFocus:!0,value:h,onChange:y=>m(y.target.value),placeholder:v.chat.skillsSearchPlaceholder,"aria-label":v.chat.skillsSearchPlaceholder,className:"w-full rounded border border-transparent bg-transparent px-1 py-0.5 text-xs text-gray-700 placeholder:text-gray-400 focus:outline-none dark:text-gray-200 dark:placeholder:text-gray-500"})}),s.jsx("div",{className:"max-h-56 overflow-y-auto",children:e.length===0?s.jsx("p",{className:"px-3 py-1.5 text-xs text-gray-400",children:v.chat.skillsEmptyHint}):g.length===0?s.jsx("p",{className:"px-3 py-1.5 text-xs text-gray-400",children:v.chat.skillsNoMatch}):g.map(y=>{const b=a.includes(y.name);return s.jsxs("button",{type:"button","aria-pressed":b,onClick:()=>r(y.name),className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors duration-150 hover:bg-gray-100 dark:hover:bg-gray-800 ${b?"font-medium text-gray-900 dark:text-gray-100":"text-gray-600 dark:text-gray-400"}`,children:[s.jsx(fb,{icon:y.icon,size:14,className:"shrink-0 text-gray-400 dark:text-gray-500"}),s.jsx("span",{className:"shrink-0 font-mono",children:y.name}),s.jsx("span",{className:"min-w-0 flex-1 truncate text-gray-400 dark:text-gray-500",children:zu(c,y)}),s.jsx("span",{className:"w-3 shrink-0 text-center",children:b?"✓":""})]},y.name)})})]})}function tA({now:e,window:a,unknown:r=!1}){const i=db(a),o=r?0:Math.min(1,e/i),c=r||o<=.8?"text-gray-400 dark:text-gray-500":o>.95?"text-red-500":"text-amber-500",d=5,f=2*Math.PI*d;return s.jsxs("span",{title:r?v.chat.contextUnknown:`${v.chat.contextUsage} ${Math.round(o*100)}%`,className:`flex shrink-0 items-center gap-1 font-mono ${c}`,children:[s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14","aria-hidden":!0,className:"block shrink-0",children:[s.jsx("circle",{cx:"7",cy:"7",r:d,fill:"none",stroke:"currentColor",strokeOpacity:"0.25",strokeWidth:"2"}),s.jsx("circle",{cx:"7",cy:"7",r:d,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeDasharray:`${f*o} ${f}`,transform:"rotate(-90 7 7)"})]}),r?"—":We(e),"/",We(i)]})}function pb({status:e,onSend:a,onStop:r,onCompact:i,modelRef:o,models:c,onChangeModel:d,defaultModel:f,contextWindow:h,contextNow:m,contextStale:g=!1,vision:y,approvalMode:b,onChangeApprovalMode:w,modeSaving:N,autoFocus:A,agents:j,skills:T,initialSkills:I,onSkillsChange:M,onHandoff:_,initialText:$,onTextChange:U,initialHandoffTargetId:Y,onHandoffTargetChange:W}){const{locale:J}=ia(),[P,K]=k.useState($??""),[D,O]=k.useState([]),[te,F]=k.useState(!1),[L,ae]=k.useState(0),[ne,xe]=k.useState(null),[R,z]=k.useState(I??[]),[B,C]=k.useState(0),[G,re]=k.useState(0),[ue,ge]=k.useState(null),we=k.useRef(null),[Ne]=k.useState(()=>window.matchMedia("(max-width: 767px)").matches),ye=e==="running",Me=e==="compacting",Je=!ye&&!Me&&!te&&(P.trim().length>0||D.length>0||ne!==null||R.length>0),Kt=k.useCallback(ce=>{const ee=R.includes(ce)?R.filter(ve=>ve!==ce):[...R,ce];z(ee),M?.(ee)},[R,M]),Lt=k.useMemo(()=>{const ce=()=>{K(""),U?.(""),requestAnimationFrame(Wt)};return[{cmd:"/compact",desc:v.chat.compact,run:()=>{ce(),i()}},...TM(T,J).map(ee=>({cmd:ee.cmd,desc:ee.desc,run:()=>{ce(),Kt(ee.name)}}))]},[i,U,T,J,Kt]),qt=P.trim(),Tt=P.trimStart().startsWith("/")&&!ye&&!Me?Lt.filter(ce=>ce.cmd.startsWith(qt)||qt==="/"):[],fn=Tt.length>0,Jt=Tt[Math.min(L,Tt.length-1)],kt=!ye&&!Me&&!fn?Sy(P,B):null,Rt=kt&&kt.start!==ue?RM(j,kt.query):[],en=Rt.length>0,mn=Rt[Math.min(G,Rt.length-1)],Wt=()=>{const ce=we.current;ce&&(ce.style.height="auto",ce.style.height=`${Math.min(ce.scrollHeight,176)}px`)};k.useEffect(()=>{Wt();const ce=we.current;if(ce&&ce.value.length>0){const ee=ce.value.length;ce.setSelectionRange(ee,ee),ce.scrollTop=ce.scrollHeight,C(ee)}},[]);const ct=k.useRef(!1);k.useEffect(()=>{if(!ct.current&&(ct.current=!0,T.length===0))return;const ce=R.filter(ee=>T.some(ve=>ve.name===ee));ce.length!==R.length&&(z(ce),M?.(ce))},[T,R,M]);const Vn=k.useRef(!1);k.useEffect(()=>{if(Vn.current||!Y||j.length===0)return;Vn.current=!0;const ce=j.find(ee=>ee.agentId===Y);ce&&xe(ce)},[j,Y]);const se=ce=>{const ee=we.current;if(!kt||!ee)return;let{start:ve,end:Re}=kt;ee.value[Re]===" "?Re++:ve>0&&ee.value[ve-1]===" "&&ve--;const ze=ee.value.slice(0,ve)+ee.value.slice(Re);ee.value=ze,ee.setSelectionRange(ve,ve),ee.focus(),xe(ce),W?.(ce.agentId),K(ze),U?.(ze),C(ve),re(0),Wt()},ie=async()=>{if(!Je)return;const ce=P.trim(),ee=ne?{agent:ne,rest:ce}:_M(ce,j),ve=ee?ee.rest:ce,Re=R.length>0&&ve===""?v.chat.skillsAutoMessage(R):ve,ze=jM(R,Re),Ot=[];ze&&Ot.push({type:"text",text:ze});for(const It of D)Ot.push({type:"image_url",imageUrl:It});F(!0);try{(ee?await _(ee.agent,Ot):await a(Ot))&&(K(""),O([]),xe(null),z([]),requestAnimationFrame(Wt))}finally{F(!1),we.current?.focus()}},he=ce=>{if(fn){if(ce.key==="ArrowDown"){ce.preventDefault(),ae(ee=>(ee+1)%Tt.length);return}if(ce.key==="ArrowUp"){ce.preventDefault(),ae(ee=>(ee-1+Tt.length)%Tt.length);return}if((ce.key==="Enter"&&!ce.shiftKey||ce.key==="Tab")&&!ce.nativeEvent.isComposing){ce.preventDefault(),Jt?.run();return}if(ce.key==="Escape"){K(""),U?.(""),requestAnimationFrame(Wt);return}}if(en){if(ce.key==="ArrowDown"){ce.preventDefault(),re(ee=>(ee+1)%Rt.length);return}if(ce.key==="ArrowUp"){ce.preventDefault(),re(ee=>(ee-1+Rt.length)%Rt.length);return}if((ce.key==="Enter"&&!ce.shiftKey||ce.key==="Tab")&&!ce.nativeEvent.isComposing){ce.preventDefault(),mn&&se(mn);return}if(ce.key==="Escape"){ge(kt?.start??null);return}}if(ce.key==="Backspace"&&ne!==null&&ce.currentTarget.selectionStart===0&&ce.currentTarget.selectionEnd===0){ce.preventDefault(),xe(null),W?.(null);return}ce.key==="Enter"&&!ce.shiftKey&&!ce.nativeEvent.isComposing&&(ce.preventDefault(),ie())},Se=ce=>{for(const ee of ce){if(!ee.type.startsWith("image/"))continue;const ve=new FileReader;ve.onload=()=>{typeof ve.result=="string"&&O(Re=>[...Re,ve.result])},ve.readAsDataURL(ee)}},Ae=ce=>{const ee=[];for(const ve of ce.clipboardData.items)if(ve.kind==="file"){const Re=ve.getAsFile();Re&&ee.push(Re)}ee.length>0&&(ce.preventDefault(),Se(ee))},Xe=ce=>{ce.target.files&&Se(ce.target.files),ce.target.value=""};return s.jsxs("div",{className:"relative",children:[fn&&s.jsx("div",{className:"anim-pop absolute bottom-full left-0 z-40 mb-1.5 w-80 max-w-[calc(100vw-2rem)] rounded-md border border-gray-200 bg-white py-1 shadow-lg dark:border-gray-700 dark:bg-gray-900",children:Tt.map((ce,ee)=>s.jsxs("button",{type:"button",onMouseEnter:()=>ae(ee),onClick:()=>ce.run(),className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm ${ce===Jt?"bg-gray-100 dark:bg-gray-800":""}`,children:[s.jsx("span",{className:"shrink-0 font-mono text-gray-800 dark:text-gray-200",children:ce.cmd}),s.jsx("span",{title:ce.desc,className:"min-w-0 flex-1 truncate text-xs text-gray-500 dark:text-gray-400",children:ce.desc})]},ce.cmd))}),en&&s.jsx("div",{className:"anim-pop absolute bottom-full left-0 z-40 mb-1.5 max-h-64 w-72 overflow-y-auto rounded-md border border-gray-200 bg-white py-1 shadow-lg dark:border-gray-700 dark:bg-gray-900",children:Rt.map((ce,ee)=>s.jsxs("button",{type:"button",onMouseEnter:()=>re(ee),onClick:()=>se(ce),className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm ${ce===mn?"bg-gray-100 dark:bg-gray-800":""}`,children:[s.jsxs("span",{className:"shrink-0 font-mono text-gray-800 dark:text-gray-200",children:["@",ce.agentId]}),ce.name&&ce.name!==ce.agentId&&s.jsx("span",{className:"min-w-0 truncate text-xs text-gray-500 dark:text-gray-400",children:ce.name})]},ce.agentId))}),D.length>0&&s.jsx("div",{className:"mb-2 flex flex-wrap gap-2",children:D.map((ce,ee)=>s.jsxs("div",{className:"anim-pop relative",children:[s.jsx(Hr,{src:ce,alt:v.chat.imageAlt,className:"h-16 w-16 rounded-md border border-gray-200 object-cover dark:border-gray-700"}),s.jsx("button",{type:"button","aria-label":v.chat.removeImage,onClick:()=>O(ve=>ve.filter((Re,ze)=>ze!==ee)),className:"absolute -right-1.5 -top-1.5 flex h-5 w-5 items-center justify-center rounded-full bg-gray-700 text-[10px] text-white transition-colors duration-150 hover:bg-gray-900",children:"×"})]},ee))}),!y&&D.length>0&&s.jsx("p",{className:"anim-fade mb-1 text-xs text-gray-400 dark:text-gray-500",children:v.chat.imagesAsPathHint}),s.jsxs("div",{className:"@container rounded-lg border border-gray-300 bg-white px-2.5 pb-2 pt-2 transition-[border-color,box-shadow] duration-200 focus-within:border-gray-500 focus-within:ring-2 focus-within:ring-gray-400/30 dark:border-gray-700 dark:bg-gray-900 dark:focus-within:border-gray-400",children:[ne!==null&&s.jsx("div",{className:"mb-1 flex flex-wrap items-center gap-1",children:s.jsxs("span",{className:"anim-pop flex max-w-48 items-center gap-0.5 rounded-md bg-gray-100 py-0.5 pl-2 pr-1 font-mono text-sm text-gray-800 dark:bg-gray-800 dark:text-gray-200",...ne.name&&ne.name!==ne.agentId?{title:ne.name}:{},children:[s.jsxs("span",{className:"truncate",children:["@",ne.agentId]}),s.jsx("button",{type:"button","aria-label":v.chat.mentionRemove,onClick:()=>{xe(null),W?.(null),we.current?.focus()},className:"shrink-0 rounded p-0.5 text-gray-400 transition-colors duration-150 hover:bg-gray-200 hover:text-gray-700 dark:hover:bg-gray-700 dark:hover:text-gray-200",children:"×"})]})}),s.jsx("textarea",{ref:we,rows:2,value:P,autoFocus:A,onChange:ce=>{const ee=ce.target.value,ve=ce.target.selectionStart??ee.length;K(ee),U?.(ee),C(ve),ae(0),re(0),ge(Re=>{if(Re===null)return null;const ze=Sy(ee,ve);return ze&&ze.start===Re?Re:null}),Wt()},onSelect:ce=>C(ce.currentTarget.selectionStart??0),onKeyDown:he,onPaste:Ae,placeholder:Ne?v.chat.inputPlaceholderShort:v.chat.inputPlaceholder,className:"block max-h-44 min-h-[60px] w-full resize-none bg-transparent px-1 py-0.5 text-base leading-6 placeholder:text-gray-400 focus:outline-none disabled:cursor-not-allowed disabled:opacity-60 dark:placeholder:text-gray-500"}),s.jsxs("div",{className:"mt-1 flex items-center gap-2 text-xs",children:[s.jsxs("label",{className:"flex h-8 w-8 shrink-0 cursor-pointer items-center justify-center rounded-md text-gray-400 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-600 dark:hover:bg-gray-800 dark:hover:text-gray-300",title:y?v.chat.imageAlt:v.chat.imagesAsPathHint,children:[s.jsx("input",{type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:Xe}),s.jsxs("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,className:"block",children:[s.jsx("rect",{x:"3",y:"5",width:"18",height:"14",rx:"3"}),s.jsx("path",{d:"M3 15l5-5 4 4 3-3 6 6"})]})]}),s.jsx(ZM,{value:b,onChange:w,disabled:N,direction:c&&d?"down":"up"}),s.jsx(eA,{skills:T,selected:R,onToggle:Kt,disabled:ye||Me||te,direction:c&&d?"down":"up"}),s.jsx("span",{className:"min-w-0 flex-1",children:s.jsxs("span",{title:`${v.chat.slashHint} · ${v.chat.mentionHint}`,className:"hidden truncate text-gray-300 @lg:block dark:text-gray-600",children:[v.chat.slashHint," · ",v.chat.mentionHint]})}),!d&&s.jsx(tA,{now:m,unknown:g,...h!==void 0?{window:h}:{}}),c&&d?s.jsx(JM,{models:c,value:o,...f!==void 0?{defaultModel:f}:{},onChange:d,disabled:te}):s.jsxs("span",{title:o?.modelId??"",className:"flex h-8 min-w-0 max-w-44 shrink items-center gap-1.5 px-1 text-gray-400 dark:text-gray-500",children:[s.jsx(cs,{provider:o?.provider??"custom",className:"h-4 w-4 shrink-0"}),s.jsx("span",{className:"hidden min-w-0 truncate @md:block",children:(()=>{const ce=c?.find(ee=>ot(ee,o));return ce?um(ce):o?.modelId??"…"})()})]}),ye?s.jsx("button",{type:"button",title:v.chat.stop,"aria-label":v.chat.stop,onClick:()=>{r()},className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-md bg-red-50 text-red-600 transition-colors duration-150 hover:bg-red-100 dark:bg-red-950/60 dark:text-red-400 dark:hover:bg-red-950",children:s.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14","aria-hidden":!0,className:"block",children:s.jsx("rect",{x:"2",y:"2",width:"10",height:"10",rx:"2",fill:"currentColor"})})}):s.jsx("button",{type:"button",title:v.chat.send,"aria-label":v.chat.send,disabled:!Je,onClick:()=>{ie()},className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-md bg-gray-900 text-white transition-colors duration-150 hover:bg-gray-700 disabled:cursor-not-allowed disabled:bg-gray-200 disabled:text-gray-400 dark:bg-gray-100 dark:text-gray-900 dark:hover:bg-gray-300 dark:disabled:bg-gray-800 dark:disabled:text-gray-600",children:s.jsx("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,className:"block",children:s.jsx("path",{d:"M12 19V5M5 12l7-7 7 7"})})})]})]})]})}function gb({className:e}){return s.jsx("img",{src:"/penguin-logo.svg",alt:"","aria-hidden":!0,draggable:!1,className:`select-none ${e??"h-9 w-9 rounded-lg"}`})}const nA=["always-ask","read-only","allow-all","deny-all"],nu=(e,a)=>`penguin.chatDraft.${e}.${a}`,xb=(e,a)=>`penguin.chatDraft.session.${e}.${a}`;function aA(e){if(!e)return{};try{const a=JSON.parse(e);if(typeof a!="object"||a===null)return{};const r=a,i={};if(typeof r.text=="string"&&(i.text=r.text),typeof r.agentId=="string"&&(i.agentId=r.agentId),typeof r.workspace=="string"&&(i.workspace=r.workspace),typeof r.modelRef=="object"&&r.modelRef!==null){const o=r.modelRef;typeof o.provider=="string"&&typeof o.modelId=="string"&&(i.modelRef={provider:o.provider,modelId:o.modelId})}if(typeof r.handoffAgentId=="string"&&(i.handoffAgentId=r.handoffAgentId),Array.isArray(r.skills)){const o=r.skills.filter(c=>typeof c=="string");o.length>0&&(i.skills=o)}return typeof r.approvalMode=="string"&&nA.includes(r.approvalMode)&&(i.approvalMode=r.approvalMode),i}catch{return{}}}function nh(e,a=localStorage){try{return aA(a.getItem(e))}catch{return{}}}function ah(e,a,r=localStorage){try{r.setItem(e,JSON.stringify(a))}catch{}}function xu(e,a=localStorage){try{a.removeItem(e)}catch{}}const rA=300;function lA({projectId:e,models:a}){const r=Jn(),i=En(),{agents:o,currentAgent:c,setCurrentAgentId:d}=Yt(),{add:f}=Cu(),h=qn().user?.userId??null,[m]=k.useState(()=>h?nh(nu(h,e)):{}),[g,y]=k.useState(m.agentId??c?.agentId??null),[b,w]=k.useState(m.workspace??""),[N,A]=k.useState(m.approvalMode??"allow-all"),[j,T]=k.useState(m.modelRef??null),[I,M]=k.useState(m.handoffAgentId??null),_=k.useRef(m.text??""),$=k.useRef(m.skills??[]),U=i.state?.agentId,Y=k.useRef(null);k.useEffect(()=>{if(o.length===0)return;const G=re=>!!re&&o.some(ue=>ue.agentId===re);if(U&&Y.current!==i.key&&(Y.current=i.key,G(U))){y(U);return}G(g)||y((o.find(re=>re.agentId==="default_agent")??o[0])?.agentId??null)},[o,g,i.key,U]),k.useEffect(()=>{if(!a||j&&a.models.some(re=>ot(re,j)))return;const G=a.models[0];T(a.defaultModel??(G?{provider:G.provider,modelId:G.modelId}:null))},[a,j]);const[W,J]=k.useState([]);k.useEffect(()=>{if(J(re=>re.length>0?[]:re),!g)return;let G=!1;return ym(e,g).then(re=>{G||J(re.skills)}).catch(()=>{}),()=>{G=!0}},[e,g]);const P=k.useRef(null),K=k.useCallback(()=>{P.current!==null&&(window.clearTimeout(P.current),P.current=null)},[]),D=k.useCallback(()=>{if(K(),!h)return;const G={text:_.current,workspace:b,approvalMode:N};g&&(G.agentId=g),j&&(G.modelRef=j),I&&(G.handoffAgentId=I),$.current.length>0&&(G.skills=$.current),ah(nu(h,e),G)},[K,h,e,g,b,N,j,I]),O=k.useRef(D);k.useEffect(()=>{O.current=D,D()},[D]);const te=k.useCallback(G=>{_.current=G,K(),P.current=window.setTimeout(()=>{P.current=null,O.current()},rA)},[K]),F=k.useCallback(G=>{$.current=G,O.current()},[]);k.useEffect(()=>()=>{P.current!==null&&(window.clearTimeout(P.current),O.current())},[]);const L=k.useCallback(()=>{K(),$.current=[],h&&xu(nu(h,e))},[K,h,e]),ae=G=>{y(G.agentId),d(G.agentId)},ne=k.useCallback(async G=>{if(!g)return!1;let re=null;try{const ue={approvalMode:N};j&&(ue.modelId=j.modelId,ue.provider=j.provider),b.trim()&&(ue.workspace=b.trim());const ge=await Lf(e,g,ue);re=ge.session.sessionId;const we=await iu(re,{input:G});return f(ge.session),L(),r(`/chat/${we.sessionId}`,{replace:!0}),!0}catch(ue){return re&&lu(re).catch(()=>{}),Xn(ur(ue,j?{modelId:j.modelId}:{})),!1}},[e,g,N,j,b,f,L,r]),xe=o.find(G=>G.agentId===g)??null,R=k.useCallback(async(G,re)=>{if(!xe)return!1;const ue={type:"text",text:ob({agentId:xe.agentId,...xe.name!==void 0?{agentName:xe.name}:{}})};let ge=null;try{const we=await Lf(e,G.agentId,{approvalMode:N});ge=we.session.sessionId;const Ne=await iu(ge,{input:[ue,...re]});return f(we.session),L(),r(`/chat/${Ne.sessionId}`),!0}catch(we){return ge&&lu(ge).catch(()=>{}),Xn(ur(we,a?.defaultModel?{modelId:a.defaultModel.modelId}:{})),!1}},[e,xe,N,f,L,r,a]),z=a?.models.find(G=>ot(G,j)),B=z?.contextWindow,C=z?.vision!==!1;return s.jsxs("div",{className:"anim-fade flex min-h-0 flex-1 flex-col overflow-y-auto px-3 md:px-4",children:[s.jsx("div",{className:"flex flex-1 flex-col justify-end pt-6",children:s.jsxs("div",{className:"mb-10 text-center",children:[s.jsx(gb,{className:"mx-auto mb-1 h-36 w-36 rounded-3xl"}),s.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-gray-900 dark:text-gray-100",children:v.appName}),s.jsx("p",{className:"mt-2 text-base text-gray-400 dark:text-gray-500",children:v.chat.draftSubtitle})]})}),s.jsxs("div",{className:"mx-auto w-full max-w-3xl",children:[s.jsx(pb,{status:"idle",onSend:ne,onStop:async()=>{},onCompact:async()=>{},modelRef:j,models:a?.models??[],onChangeModel:T,...a?.defaultModel!==void 0?{defaultModel:a.defaultModel}:{},...B!==void 0?{contextWindow:B}:{},contextNow:0,vision:C,approvalMode:N,onChangeApprovalMode:A,modeSaving:!1,autoFocus:!0,agents:o,skills:W,...m.skills&&m.skills.length>0?{initialSkills:m.skills}:{},onSkillsChange:F,onHandoff:R,initialText:m.text??"",onTextChange:te,...m.handoffAgentId?{initialHandoffTargetId:m.handoffAgentId}:{},onHandoffTargetChange:M}),s.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[s.jsx(iA,{agents:o,selected:xe,onSelect:ae}),s.jsx(sA,{projectId:e,workspace:b,onChange:w})]})]}),s.jsx("div",{className:"flex-1 pb-6"})]})}const yb="flex max-w-64 items-center gap-1.5 rounded-full border border-gray-300 bg-white py-1 pl-1.5 pr-2 text-xs text-gray-600 transition-colors duration-150 hover:bg-gray-50 hover:text-gray-900 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-300 dark:hover:bg-gray-800 dark:hover:text-gray-100";function iA({agents:e,selected:a,onSelect:r}){const[i,o]=k.useState(!1);return s.jsx(Da,{open:i,setOpen:o,menuClass:"left-0 top-full mt-1 w-72 max-w-[calc(100vw-2rem)] origin-top-left",button:s.jsxs("button",{type:"button",title:v.chat.chooseAgent,"aria-label":v.chat.chooseAgent,onClick:()=>o(!i),className:yb,children:[a?s.jsx(Vr,{id:a.agentId,size:16,className:"shrink-0 rounded"}):null,s.jsx("span",{className:"min-w-0 truncate",children:a?za(a):v.common.loading}),s.jsx(Zt,{open:i,size:12,className:"shrink-0 text-gray-400"})]}),children:s.jsxs("div",{className:"max-h-56 overflow-y-auto",children:[e.length===0&&s.jsx("p",{className:"px-3 py-1.5 text-xs text-gray-400",children:v.common.loading}),e.map(c=>{const d=c.agentId===a?.agentId;return s.jsxs("button",{type:"button","aria-pressed":d,onClick:()=>{r(c),o(!1)},className:"flex w-full items-center gap-2.5 px-3 py-1.5 text-left transition-colors duration-150 hover:bg-gray-100 dark:hover:bg-gray-800",children:[s.jsx(Vr,{id:c.agentId,size:20,className:"shrink-0 rounded"}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:`block truncate text-xs ${d?"font-medium text-gray-900 dark:text-gray-100":"text-gray-700 dark:text-gray-300"}`,children:za(c)}),c.description&&s.jsx("span",{className:"block truncate text-[11px] text-gray-400 dark:text-gray-500",children:c.description})]}),s.jsx("span",{className:"w-4 shrink-0 text-center text-xs text-gray-500 dark:text-gray-400",children:d?"✓":""})]},c.agentId)})]})})}function sA({projectId:e,workspace:a,onChange:r}){const[i,o]=k.useState(!1),c=k.useRef(!1),[d,f]=k.useState(null),[h,m]=k.useState(!1),[g,y]=k.useState(null),[b,w]=k.useState("");k.useEffect(()=>{w(d?.path??"")},[d]);const N=k.useCallback($=>{m(!0),y(null),yx(e,$).then(f).catch(U=>y(U instanceof Ie?U.message:v.common.unknownError)).finally(()=>m(!1))},[e]),A=()=>{const $=!i;if(o($),$&&!c.current){c.current=!0;const U=a.trim();N(U.startsWith("/")?U:"")}},j=async()=>{const $=b.trim();if(!$||$===d?.path){w(d?.path??"");return}try{f(await yx(e,$))}catch{Xn(v.chat.workspaceDirInvalid),w(d?.path??"")}},T=a.trim(),I=T?T.split("/").filter(Boolean).pop()??"/":v.chat.workspaceAuto,M=d?.parent??null,_=(d?.entries??[]).filter($=>!$.name.startsWith("."));return s.jsx(Da,{open:i,setOpen:o,menuClass:"left-0 top-full mt-1 w-80 max-w-[calc(100vw-2rem)] origin-top-left",button:s.jsxs("button",{type:"button",title:T?`${v.chat.workspace}:${T}`:v.chat.workspaceHint,"aria-label":v.chat.workspace,onClick:A,className:yb,children:[s.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",className:"ml-0.5 shrink-0 text-gray-400","aria-hidden":!0,children:s.jsx("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z",strokeWidth:"1.6",strokeLinejoin:"round"})}),s.jsx("span",{className:`min-w-0 truncate ${T?"font-mono":""}`,children:I}),s.jsx(Zt,{open:i,size:12,className:"shrink-0 text-gray-400"})]}),children:s.jsxs("div",{className:"space-y-1.5 px-2.5 pb-2.5 pt-2",children:[s.jsxs("div",{className:"rounded-md border border-gray-200 dark:border-gray-800",children:[s.jsxs("div",{className:"flex items-center gap-1.5 border-b border-gray-100 px-1.5 py-1 dark:border-gray-800",children:[s.jsx("input",{value:b,placeholder:"…","aria-label":v.chat.workspace,onChange:$=>w($.target.value),onBlur:()=>{j()},onKeyDown:$=>{$.key==="Enter"&&!$.nativeEvent.isComposing?($.preventDefault(),j()):$.key==="Escape"&&w(d?.path??"")},className:"min-w-0 flex-1 rounded border border-transparent bg-transparent px-1 py-0.5 font-mono text-xs text-gray-600 focus:border-gray-300 focus:outline-none dark:text-gray-300 dark:focus:border-gray-600"}),s.jsx("button",{type:"button",disabled:!d,onClick:()=>{d&&(r(d.path),o(!1))},className:"shrink-0 rounded border border-gray-300 px-1.5 py-0.5 text-xs text-gray-700 transition-colors duration-150 hover:bg-gray-100 disabled:opacity-50 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-800",children:v.chat.workspaceUseThis})]}),s.jsxs("ul",{className:"max-h-40 overflow-y-auto py-1",children:[M!==null&&s.jsx("li",{children:s.jsxs("button",{type:"button",onClick:()=>N(M),className:"flex w-full items-center gap-2 px-2.5 py-1.5 text-left font-mono text-xs text-gray-500 transition-colors duration-150 hover:bg-gray-100 dark:text-gray-400 dark:hover:bg-gray-800",children:["↰ ",v.chat.workspaceUp]})}),_.map($=>s.jsx("li",{children:s.jsxs("button",{type:"button",onClick:()=>N($.path),className:"flex w-full items-center gap-2 px-2.5 py-1.5 text-left font-mono text-xs text-gray-700 transition-colors duration-150 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-800",children:[s.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",className:"shrink-0 text-gray-400","aria-hidden":!0,children:s.jsx("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z",strokeWidth:"1.6",strokeLinejoin:"round"})}),s.jsx("span",{className:"min-w-0 flex-1 truncate",children:$.name})]})},$.path)),d&&_.length===0&&s.jsx("li",{className:"px-2.5 py-1.5 text-xs text-gray-400",children:v.chat.workspaceNoSubdirs}),h&&s.jsx("li",{className:"px-2.5 py-1.5 text-xs text-gray-400",children:v.common.loading}),g&&s.jsxs("li",{className:"flex items-center justify-between gap-2 px-2.5 py-1.5 text-xs text-red-500",children:[s.jsx("span",{className:"min-w-0 flex-1 truncate",title:g,children:g}),s.jsx("button",{type:"button",onClick:()=>N(""),className:"shrink-0 rounded border border-gray-300 px-1.5 py-0.5 text-xs text-gray-700 transition-colors duration-150 hover:bg-gray-100 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-800",children:v.common.retry})]})]})]}),T&&s.jsx("button",{type:"button",onClick:()=>{r(""),o(!1)},className:"text-xs text-gray-500 underline decoration-gray-300 underline-offset-2 transition-colors duration-150 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-200",children:v.chat.workspaceClear}),s.jsx("p",{className:"px-0.5 text-xs leading-5 text-gray-400 dark:text-gray-500",children:v.chat.workspaceHint})]})})}const cm={damping:1,response:.35},Cy={damping:.8,response:.3};function oA(e,a,r,i,o){const c=2*Math.PI/i.response,d=c*c,f=2*i.damping*c;let h=e,m=a,g=Math.min(o,64);for(;g>0;){const y=Math.min(g,8)/1e3,b=-d*(h-r)-f*m;m+=b*y,h+=m*y,g-=8}return[h,m]}function Ey(e,a,r){return Math.abs(e-r)<.5&&Math.abs(a)<5}function uA(e,a){let r=e,i=0,o=e,c=cm,d,f=0,h=0;const m=()=>{f&&cancelAnimationFrame(f),f=0,h=0,d=void 0},g=y=>{const b=h?y-h:16;if(h=y,[r,i]=oA(r,i,o,c,b),Ey(r,i,o)){r=o,i=0,f=0,h=0,a(r);const w=d;d=void 0,w?.();return}a(r),f=requestAnimationFrame(g)};return{get value(){return r},get velocity(){return i},animateTo(y,b,w){if(o=y,c=b,w?.velocity!==void 0&&(i=w.velocity),d=w?.onSettle,Ey(r,i,o)){r=o,i=0,a(r);const N=d;d=void 0,N?.();return}f||(f=requestAnimationFrame(g))},stop(){return m(),[r,i]},set(y){m(),r=y,i=0,a(r)},dispose:m}}function cA(e,a=.998){return e/1e3*a/(1-a)}function dA(e,a,r=.55){return e*a*r/(a+r*Math.abs(e))}function fA(e,a){let r=a[0];for(const i of a)Math.abs(i-e)<Math.abs(r-e)&&(r=i);return r}const mA=.92,hA=.6;function pA(){const[e,a]=k.useState(()=>window.matchMedia("(prefers-reduced-motion: reduce)").matches);return k.useEffect(()=>{const r=window.matchMedia("(prefers-reduced-motion: reduce)"),i=o=>a(o.matches);return r.addEventListener("change",i),()=>r.removeEventListener("change",i)},[]),e}function gA({open:e,snap:a,onSnapChange:r,onClose:i,title:o,children:c}){const[d,f]=k.useState(e),h=k.useRef(null),m=k.useRef(null),g=k.useRef(null),y=k.useRef(0),b=k.useRef(!1),w=k.useRef(!1),N=k.useRef(null),A=k.useRef([]),j=k.useRef({pointerY:0,sheetY:0}),T=k.useRef(e);T.current=e;const I=k.useRef(null),M=pA(),_=k.useCallback(K=>{const D=y.current||1;h.current&&(h.current.style.transform=`translate3d(0, ${K}px, 0)`),m.current&&(m.current.style.opacity=String(Math.min(1,Math.max(0,1-K/D))))},[]),$=k.useCallback(K=>{const D=y.current;return K==="full"?0:D*(1-hA/mA)},[]);k.useEffect(()=>{e&&f(!0)},[e]),k.useLayoutEffect(()=>{if(!d)return;const K=h.current;K&&(y.current=K.offsetHeight,g.current||(g.current=uA(y.current,_),g.current.set(y.current)))},[d,_]),k.useEffect(()=>{if(!d)return;const K=g.current;if(K)if(e){if(w.current=!1,b.current)return;const D=$(a);if(N.current!==null&&Math.abs(N.current-D)<1)return;if(N.current=D,M){K.set(D);return}K.animateTo(D,cm)}else{if(w.current=!0,N.current=y.current,M){f(!1);return}K.animateTo(y.current,cm,{onSettle:()=>f(!1)})}},[d,e,a,M,$]),k.useEffect(()=>{d||(g.current?.dispose(),g.current=null,N.current=null,b.current=!1,w.current=!1)},[d]),k.useEffect(()=>()=>g.current?.dispose(),[]),k.useEffect(()=>{if(!d)return;const K=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=K}},[d]),k.useEffect(()=>{if(!d||!e)return;const K=D=>{D.key==="Escape"&&i()};return window.addEventListener("keydown",K),()=>window.removeEventListener("keydown",K)},[d,e,i]),k.useEffect(()=>{if(d)return I.current=document.activeElement instanceof HTMLElement?document.activeElement:null,()=>I.current?.focus()},[d]),k.useEffect(()=>{if(!d)return;const K=()=>{const D=h.current;if(!D||(y.current=D.offsetHeight,b.current||w.current))return;const O=$(a);N.current=O,g.current?.set(O)};return window.addEventListener("resize",K),()=>window.removeEventListener("resize",K)},[d,a,$]);const U=K=>{if(w.current)return;const D=g.current;if(!D)return;K.currentTarget.setPointerCapture(K.pointerId);const[O]=D.stop();b.current=!0,j.current={pointerY:K.clientY,sheetY:O},A.current=[{y:K.clientY,t:performance.now()}]},Y=K=>{if(!b.current)return;const D=g.current;if(!D)return;const O=j.current.sheetY+(K.clientY-j.current.pointerY),te=y.current,F=O<0?-dA(-O,te):Math.min(O,te);D.set(F);const L=performance.now(),ae=A.current;for(ae.push({y:K.clientY,t:L});ae.length>2&&L-ae[0].t>100;)ae.shift()},W=K=>{b.current=!1;const D=g.current;if(!D)return;const O=y.current,te=$("half"),F=T.current?D.value+cA(K):O,L=fA(F,[0,te,O]);if(N.current=L,L===O){if(w.current=!0,M){f(!1),i();return}D.animateTo(O,Cy,{velocity:K,onSettle:()=>{f(!1),i()}});return}D.animateTo(L,Cy,{velocity:K});const ae=L===0?"full":"half";ae!==a&&r?.(ae)},J=()=>{if(!b.current)return;const K=A.current,D=K[K.length-1],O=K[0],te=D&&O?D.t-O.t:0;W(te>0?(D.y-O.y)/te*1e3:0)},P=()=>{b.current&&W(0)};return d?s.jsxs("div",{className:"fixed inset-0 z-50",role:"dialog","aria-modal":"true","aria-label":o,children:[s.jsx("div",{ref:m,className:`absolute inset-0 bg-black/45 ${M?"anim-fade":""}`,style:{opacity:0},onPointerDown:()=>i()}),s.jsxs("div",{ref:h,className:`absolute inset-x-0 bottom-0 flex h-[92dvh] flex-col overflow-hidden rounded-t-2xl border-t border-gray-200 bg-white shadow-2xl dark:border-gray-800 dark:bg-gray-900 ${M?"anim-fade":""}`,style:{transform:"translate3d(0, 100%, 0)"},children:[s.jsxs("div",{className:"shrink-0 cursor-grab touch-none select-none active:cursor-grabbing",onPointerDown:U,onPointerMove:Y,onPointerUp:J,onPointerCancel:P,onLostPointerCapture:P,children:[s.jsx("div",{className:"mx-auto mt-2 h-1 w-9 rounded-full bg-gray-300 dark:bg-gray-600"}),s.jsxs("div",{className:"flex items-center justify-between px-4 pb-2 pt-1.5",children:[s.jsx("span",{className:"text-base font-semibold",children:o??""}),s.jsx("button",{type:"button","aria-label":v.common.close,onClick:i,onPointerDown:K=>K.stopPropagation(),className:"rounded-md p-1.5 text-gray-400 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-600 dark:hover:bg-gray-800 dark:hover:text-gray-300",children:s.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",children:s.jsx("path",{d:"M2 2l10 10M12 2L2 12",strokeWidth:"1.5",strokeLinecap:"round"})})})]})]}),s.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain pb-[env(safe-area-inset-bottom)]",children:c})]})]}):null}const xA="modulepreload",yA=function(e){return"/"+e},Ty={},vA=function(a,r,i){let o=Promise.resolve();if(r&&r.length>0){let h=function(m){return Promise.all(m.map(g=>Promise.resolve(g).then(y=>({status:"fulfilled",value:y}),y=>({status:"rejected",reason:y}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),f=d?.nonce||d?.getAttribute("nonce");o=h(r.map(m=>{if(m=yA(m),m in Ty)return;Ty[m]=!0;const g=m.endsWith(".css"),y=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${y}`))return;const b=document.createElement("link");if(b.rel=g?"stylesheet":xA,g||(b.as="script"),b.crossOrigin="",b.href=m,f&&b.setAttribute("nonce",f),document.head.appendChild(b),g)return new Promise((w,N)=>{b.addEventListener("load",w),b.addEventListener("error",()=>N(new Error(`Unable to preload CSS for ${m}`)))})}))}function c(d){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=d,window.dispatchEvent(f),!f.defaultPrevented)throw d}return o.then(d=>{for(const f of d||[])f.status==="rejected"&&c(f.reason);return a().catch(c)})},bA=1500;function kA({code:e}){const[a,r]=k.useState(!1),i=()=>{navigator.clipboard.writeText(e),r(!0),setTimeout(()=>r(!1),bA)};return s.jsx("button",{type:"button",title:a?v.common.copied:v.chat.copyCode,"aria-label":v.chat.copyCode,onClick:i,className:"rounded p-0.5 text-gray-400 transition-colors hover:bg-gray-100 hover:text-gray-600 dark:hover:bg-gray-800 dark:hover:text-gray-300",children:s.jsx(ht,{d:a?Et.check:Et.copy})})}function wA({language:e,code:a,highlight:r=!0}){const[i,o]=k.useState(null);return k.useEffect(()=>{if(!r){o(null);return}let c=!0;return vA(()=>import("./index-7oqK2MPp.js"),[]).then(d=>d.codeToHtml(a,{lang:e||"text",themes:{light:"github-light",dark:"github-dark"}})).then(d=>{c&&o(d)}).catch(()=>{c&&o(null)}),()=>{c=!1}},[a,e,r]),s.jsxs("div",{className:"code-block my-2 overflow-hidden rounded-lg border border-gray-200 dark:border-gray-800",children:[s.jsxs("div",{className:"flex items-center justify-between border-b border-gray-200 bg-gray-50 px-3 py-1 dark:border-gray-800 dark:bg-gray-900",children:[s.jsx("span",{className:"font-mono text-xs lowercase text-gray-500 dark:text-gray-400",children:e||"text"}),s.jsx(kA,{code:a})]}),s.jsx("div",{className:"overflow-x-auto bg-white text-[13px] leading-relaxed dark:bg-gray-950",children:i?s.jsx("div",{dangerouslySetInnerHTML:{__html:i}}):s.jsx("pre",{className:"m-0 px-3 py-2.5 font-mono text-gray-800 dark:text-gray-200",children:s.jsx("code",{children:a})})})]})}const SA=new Set(["txt","md","json","js","mjs","cjs","ts","tsx","jsx","py","sh","bash","yaml","yml","toml","css","html","htm","csv","log","xml","ini","conf","rs","go","java","c","h","cpp","hpp","sql","rb","php","gitignore","env"]),jA=new Set(["png","jpg","jpeg","gif","webp","svg"]),NA=new Set(["html","htm"]),My=256*1024,Ay=64*1024,CA={html:"html",htm:"html",css:"css",js:"javascript",mjs:"javascript",cjs:"javascript",jsx:"jsx",ts:"typescript",tsx:"tsx",json:"json",md:"markdown",py:"python",rb:"ruby",php:"php",go:"go",rs:"rust",java:"java",c:"c",h:"c",cpp:"cpp",hpp:"cpp",sh:"shellscript",bash:"shellscript",yml:"yaml",yaml:"yaml",toml:"toml",ini:"ini",conf:"ini",xml:"xml",sql:"sql",log:"log"};function EA(e){return CA[e]??"text"}function Ry(e){const a=e.lastIndexOf(".");return a>=0?e.slice(a+1).toLowerCase():e.toLowerCase()}function Ho(e,a){return e===""?a:`${e}/${a}`}function _y(e){return e.includes("/")?e.slice(0,e.lastIndexOf("/")):""}const zy=/^[a-z][a-z0-9+.-]*:/i;function Dy(e,a){const r=a.startsWith("/")||e===""?[]:e.split("/");for(const i of a.split("/"))i===""||i==="."||(i===".."?r.pop():r.push(i));return r.join("/")}const Nf="<script>(function(){function mk(){var m={};return{getItem:function(k){return k in m?m[k]:null},setItem:function(k,v){m[k]=String(v)},removeItem:function(k){delete m[k]},clear:function(){m={}},key:function(i){return Object.keys(m)[i]||null},get length(){return Object.keys(m).length}}}['localStorage','sessionStorage'].forEach(function(n){try{window[n].length}catch(e){Object.defineProperty(window,n,{value:mk(),configurable:true})}})})();<\/script>";function TA(e){return/<head[^>]*>/i.test(e)?e.replace(/<head[^>]*>/i,a=>a+Nf):/<html[^>]*>/i.test(e)?e.replace(/<html[^>]*>/i,a=>a+Nf):Nf+e}function Ly({session:e,openRequest:a,active:r,onPreviewOpen:i}){const[o,c]=k.useState(""),[d,f]=k.useState(null),[h,m]=k.useState(null),[g,y]=k.useState(null),[b,w]=k.useState(null),[N,A]=k.useState(!1),[j,T]=k.useState(0),[I,M]=k.useState(!1),[_,$]=k.useState("rendered");k.useEffect(()=>{let D=!1;return m(null),Gw(e.sessionId,o).then(O=>{D||f(O)}).catch(O=>{D||m(O instanceof Ie?O.message:v.files.loadFailed)}),()=>{D=!0}},[e.sessionId,o,j]),k.useEffect(()=>{c(""),y(null),f(null),w(null)},[e.sessionId]);const U=k.useRef(r);k.useEffect(()=>{r&&!U.current&&T(D=>D+1),U.current=r},[r]);const Y=k.useRef(i);Y.current=i;const W=k.useCallback(async D=>{Y.current?.();const O=D.includes("/")?D.slice(D.lastIndexOf("/")+1):D,te=Ry(O);if($("rendered"),jA.has(te)){y({path:D,name:O,kind:"image"});return}if(te==="pdf"){y({path:D,name:O,kind:"pdf"});return}const F=NA.has(te),L=te==="md";if(!F&&!SA.has(te)){y({path:D,name:O,kind:"unsupported"});return}try{const ae=await fetch(zr(e.sessionId,D),{credentials:"same-origin"});if(!ae.ok)throw new Error(String(ae.status));const ne=await ae.text(),xe=ne.length>My;L&&ne.length>Ay&&$("source"),y({path:D,name:O,kind:F?"html":L?"md":"text",content:xe?ne.slice(0,My):ne,truncated:xe})}catch{y({path:D,name:O,kind:"unsupported"})}},[e.sessionId]);k.useEffect(()=>{if(!a)return;const D=a.path,O=D.includes("/")?D.slice(0,D.lastIndexOf("/")):"";c(O),T(te=>te+1),W(D)},[a,W]);const J=D=>{W(Ho(o,D))},P=D=>{const O=D.target.files;!O||O.length===0||(A(!0),w(null),m(null),(async()=>{try{for(const te of O){const F=await new Promise((L,ae)=>{const ne=new FileReader;ne.onload=()=>{const xe=ne.result;L(xe.slice(xe.indexOf(",")+1))},ne.onerror=()=>ae(new Error("read failed")),ne.readAsDataURL(te)});await Kw(e.sessionId,Ho(o,te.name),F)}w(v.files.uploaded),T(te=>te+1)}catch(te){m(te instanceof Ie?te.message:v.common.unknownError)}finally{A(!1)}})(),D.target.value="")},K=o===""?[]:o.split("/");return g!==null?s.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[s.jsxs("div",{className:"flex shrink-0 flex-wrap items-center gap-2 border-b border-gray-200 px-3 py-2 dark:border-gray-800",children:[s.jsxs("button",{type:"button",onClick:()=>{y(null),T(D=>D+1)},title:v.files.backToList,className:"flex shrink-0 items-center gap-1 rounded-md px-1.5 py-1 text-sm text-gray-500 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-800 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-200",children:[s.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:s.jsx("path",{d:"M15 18l-6-6 6-6"})}),v.files.backToList]}),s.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-sm font-semibold",title:g.path,children:g.name}),(g.kind==="html"||g.kind==="md")&&s.jsx("div",{className:"flex shrink-0 rounded-md bg-gray-100 p-0.5 dark:bg-gray-800",children:[["rendered",v.files.htmlRendered],["source",v.files.htmlSource]].map(([D,O])=>s.jsx("button",{type:"button",onClick:()=>$(D),className:`rounded px-2 py-0.5 text-xs transition-colors duration-150 ${_===D?"bg-white font-medium text-gray-900 shadow-sm dark:bg-gray-600 dark:text-gray-100":"text-gray-500 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-200"}`,children:O},D))}),s.jsx("a",{href:zr(e.sessionId,g.path,!0),download:g.name,className:"inline-flex shrink-0 items-center rounded-md border border-gray-300 bg-white px-2.5 py-1 text-sm font-medium transition-colors duration-150 hover:bg-gray-50 dark:border-gray-700 dark:bg-gray-900 dark:hover:bg-gray-800",children:v.files.download})]}),s.jsx("div",{className:"min-h-0 flex-1 overflow-auto p-3",children:g.kind==="image"?s.jsx("img",{src:zr(e.sessionId,g.path),alt:g.name,className:"max-w-full rounded-md border border-gray-200 dark:border-gray-800"}):g.kind==="pdf"?s.jsx("iframe",{src:zr(e.sessionId,g.path),title:g.name,className:"h-full min-h-[60vh] w-full rounded-md border border-gray-200 dark:border-gray-800"}):g.kind==="html"&&_==="rendered"?s.jsx("iframe",{srcDoc:TA(g.content??""),title:g.name,sandbox:"allow-scripts",className:"h-full min-h-[60vh] w-full rounded-md border border-gray-200 bg-white dark:border-gray-800"}):g.kind==="md"&&_==="rendered"?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"md-body text-base leading-relaxed text-gray-800 dark:text-gray-100",children:s.jsx(ys,{remarkPlugins:[vs],components:{img:({src:D,alt:O})=>s.jsx("img",{src:typeof D=="string"&&!zy.test(D)?zr(e.sessionId,Dy(_y(g.path),D)):D,alt:O??"",loading:"lazy",className:"max-w-full"}),a:({href:D,children:O})=>{if(typeof D!="string"||D.startsWith("#"))return s.jsx("a",{href:D,children:O});if(zy.test(D))return s.jsx("a",{href:D,target:"_blank",rel:"noreferrer",children:O});const te=Dy(_y(g.path),D);return s.jsx("a",{href:zr(e.sessionId,te),onClick:F=>{F.preventDefault(),W(te)},children:O})}},children:g.content??""})}),g.truncated&&s.jsxs("p",{className:"mt-1 text-xs text-gray-400",children:["… ",v.files.previewTruncated]})]}):g.kind==="text"||g.kind==="html"||g.kind==="md"?s.jsxs(s.Fragment,{children:[s.jsx(wA,{language:EA(Ry(g.name)),code:g.content??"",highlight:(g.content?.length??0)<=Ay}),g.truncated&&s.jsxs("p",{className:"mt-1 text-xs text-gray-400",children:["… ",v.files.previewTruncated]})]}):s.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:v.files.previewUnsupported})})]}):s.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[s.jsxs("div",{className:"flex shrink-0 flex-wrap items-center gap-1 border-b border-gray-200 px-3 py-2 dark:border-gray-800",children:[s.jsx("button",{type:"button",onClick:()=>{c("")},className:"rounded px-1.5 py-0.5 text-sm text-gray-600 transition-colors duration-150 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-800",children:v.files.root}),K.map((D,O)=>s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx("span",{className:"text-gray-300 dark:text-gray-700",children:"/"}),s.jsx("button",{type:"button",onClick:()=>c(K.slice(0,O+1).join("/")),className:"max-w-32 truncate rounded px-1 py-0.5 text-sm text-gray-600 transition-colors duration-150 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-800",children:D})]},O)),s.jsx("span",{className:"flex-1"}),s.jsx(Da,{open:I,setOpen:M,menuClass:"right-0 top-full mt-1 w-max max-w-72 origin-top-right",button:s.jsx(pe,{size:"sm",variant:I?"primary":"ghost",onClick:()=>M(D=>!D),children:v.files.details}),children:s.jsxs("div",{className:"px-3.5 py-2.5",children:[s.jsx("p",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:v.files.workspacePath}),s.jsx("p",{className:"mt-1 break-all font-mono text-xs leading-5",children:e.workspace})]})}),s.jsx(pe,{size:"sm",variant:"ghost",onClick:()=>T(D=>D+1),children:v.files.refresh}),s.jsxs("label",{className:"inline-flex cursor-pointer items-center rounded-md border border-transparent bg-transparent px-2.5 py-1 text-xs font-medium text-gray-600 transition-colors duration-150 focus-within:ring-2 focus-within:ring-gray-400/30 hover:bg-gray-100 hover:text-gray-900 dark:text-gray-300 dark:hover:bg-gray-800 dark:hover:text-gray-100",children:[s.jsx("input",{type:"file",multiple:!0,className:"sr-only",onChange:P,disabled:N}),N?v.common.saving:v.files.upload]})]}),s.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto",children:[h?s.jsx("p",{className:"px-3 py-3 text-sm text-red-600 dark:text-red-400",children:h}):d===null?s.jsx(Wr,{rows:6}):d.entries.length===0?s.jsx("p",{className:"px-3 py-3 text-sm text-gray-400",children:v.files.empty}):s.jsx("ul",{className:"divide-y divide-gray-100 dark:divide-gray-800/60",children:d.entries.map(D=>s.jsx("li",{children:s.jsxs("div",{className:"group flex items-center gap-2 px-3 py-1.5 transition-colors duration-150 hover:bg-gray-50 dark:hover:bg-gray-800/50",children:[s.jsxs("button",{type:"button",onClick:()=>D.kind==="dir"?c(Ho(o,D.name)):J(D.name),className:"flex min-w-0 flex-1 items-center gap-2 text-left",title:D.name,children:[s.jsx("span",{className:"shrink-0 text-gray-400","aria-hidden":!0,children:D.kind==="dir"?s.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",children:s.jsx("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"})}):s.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",children:s.jsx("path",{d:"M6 3h8l4 4v14H6zM14 3v4h4"})})}),s.jsx("span",{className:"min-w-0 flex-1 truncate text-sm",children:D.name})]}),s.jsx("span",{className:"shrink-0 font-mono text-xs text-gray-400 dark:text-gray-500",children:D.kind==="file"?qf(D.sizeBytes):""}),s.jsx("span",{className:"hidden shrink-0 font-mono text-xs text-gray-400 sm:block dark:text-gray-500",children:D.mtime?Nn(D.mtime):""}),D.kind==="file"&&s.jsx("a",{href:zr(e.sessionId,Ho(o,D.name),!0),download:D.name,title:v.files.download,className:"shrink-0 rounded p-1 text-gray-300 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-700 group-hover:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-200",children:s.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:s.jsx("path",{d:"M12 3v12m0 0l-4-4m4 4l4-4M4 21h16"})})})]})},D.name))}),b&&s.jsx("p",{className:"px-3 py-2 text-xs text-emerald-600 dark:text-emerald-400",children:b})]})]})}function MA(){return s.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor","aria-hidden":!0,children:s.jsx("path",{d:"M2 2l10 10M12 2L2 12",strokeWidth:"1.5",strokeLinecap:"round"})})}function AA({session:e,panel:a}){return a.isDocked?s.jsxs(s.Fragment,{children:[a.open&&s.jsx("div",{onMouseDown:a.startResize,onDoubleClick:a.resetWidth,title:v.files.resizeHandle,className:`w-1.5 shrink-0 cursor-col-resize transition-colors duration-150 hover:bg-brand-300/50 dark:hover:bg-brand-700/40 ${a.resizing?"bg-brand-400/60":"bg-transparent"}`}),s.jsx("div",{ref:a.panelRef,style:{width:a.open?a.width:0},inert:!a.open,className:`relative flex min-h-0 shrink-0 flex-col overflow-hidden border-l border-gray-200 dark:border-gray-800 ${a.resizing?"pointer-events-none":"transition-[width] duration-200"}`,children:s.jsxs("div",{style:{width:a.width},className:"flex h-full min-h-0 flex-col",children:[s.jsxs("div",{className:"flex shrink-0 items-center gap-1 px-3 pt-2",children:[s.jsx("h4",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:v.files.title}),s.jsx("button",{type:"button",onClick:()=>a.setOpen(!1),title:v.common.close,className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-gray-400 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-700 dark:hover:bg-gray-800 dark:hover:text-gray-200",children:s.jsx(MA,{})})]}),s.jsx("div",{className:"min-h-0 flex-1",children:s.jsx(Ly,{session:e,openRequest:a.openRequest,active:a.open})})]})})]}):s.jsx(gA,{open:a.open,snap:a.sheetSnap,onSnapChange:a.setSheetSnap,onClose:()=>a.setOpen(!1),title:v.files.title,children:s.jsx("div",{className:"flex h-full min-h-0 flex-col",children:s.jsx("div",{className:"min-h-0 flex-1",children:s.jsx(Ly,{session:e,openRequest:a.openRequest,active:a.open,onPreviewOpen:()=>a.setSheetSnap("full")})})})})}const Du=320,Oy="(min-width: 1024px)",dm="penguin.filesPanelWidth";function yu(e){return Math.max(Du,Math.min(720,Math.round(e*.5)))}function vb(e){return Math.min(yu(e),Math.max(Du,Math.round(e*.34)))}function RA(){const e=Number(localStorage.getItem(dm));return!Number.isFinite(e)||e<=0?vb(window.innerWidth):Math.min(yu(window.innerWidth),Math.max(Du,Math.round(e)))}function _A(e){const[a,r]=k.useState(!1),[i,o]=k.useState("half"),[c,d]=k.useState(null),f=k.useCallback(M=>{M&&o("half"),r(M)},[]),[h,m]=k.useState(RA),g=k.useRef(h),[y,b]=k.useState(!1),[w,N]=k.useState(()=>window.matchMedia(Oy).matches),A=k.useRef(null);k.useEffect(()=>{d(null)},[e]),k.useEffect(()=>{const M=window.matchMedia(Oy),_=$=>N($.matches);return M.addEventListener("change",_),()=>M.removeEventListener("change",_)},[]);const j=k.useCallback(M=>{o("full"),d({path:M})},[]);k.useEffect(()=>{if(!y)return;const M=$=>{const U=A.current?.getBoundingClientRect(),Y=U?U.right:window.innerWidth,W=Math.min(yu(window.innerWidth),Math.max(Du,Y-$.clientX));g.current=W,m(W)},_=()=>{b(!1),localStorage.setItem(dm,String(Math.round(g.current)))};return document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("mousemove",M),window.addEventListener("mouseup",_),()=>{document.body.style.cursor="",document.body.style.userSelect="",window.removeEventListener("mousemove",M),window.removeEventListener("mouseup",_)}},[y]);const T=k.useCallback(M=>{M.preventDefault(),b(!0)},[]),I=k.useCallback(()=>{const M=vb(window.innerWidth);g.current=M,m(M),localStorage.removeItem(dm)},[]);return k.useEffect(()=>{const M=()=>{m(_=>{const $=Math.min(_,yu(window.innerWidth));return $!==_&&(g.current=$),$})};return window.addEventListener("resize",M),()=>window.removeEventListener("resize",M)},[]),{open:a,setOpen:f,sheetSnap:i,setSheetSnap:o,browsePath:j,openRequest:c,isDocked:w,width:h,resizing:y,startResize:T,resetWidth:I,panelRef:A}}const zA=300;function DA(e){const a=qn().user?.userId??null,r=a&&e?xb(a,e):null,i=k.useMemo(()=>r?nh(r):{},[r]),o=k.useRef(i.text??""),c=k.useRef(i.handoffAgentId??null),d=k.useRef(i.skills??[]),f=k.useRef(null),h=k.useCallback(()=>{f.current!==null&&(window.clearTimeout(f.current),f.current=null)},[]),m=k.useCallback(()=>{if(h(),!r)return;const N=o.current,A=c.current,j=d.current;if(!N&&!A&&j.length===0){xu(r);return}const T={text:N};A&&(T.handoffAgentId=A),j.length>0&&(T.skills=j),ah(r,T)},[h,r]);k.useEffect(()=>(o.current=i.text??"",c.current=i.handoffAgentId??null,d.current=i.skills??[],()=>{f.current!==null&&(window.clearTimeout(f.current),f.current=null,m())}),[i,m]);const g=k.useCallback(N=>{o.current=N,h(),f.current=window.setTimeout(()=>{f.current=null,m()},zA)},[h,m]),y=k.useCallback(N=>{c.current=N,m()},[m]),b=k.useCallback(N=>{d.current=N,m()},[m]),w=k.useCallback(()=>{h(),d.current=[],r&&xu(r)},[h,r]);return{initial:i,onTextChange:g,onHandoffTargetChange:y,onSkillsChange:b,discard:w}}function LA(e){const a=e.now??(()=>Date.now()),r=new Set,i=new Map;let o=Ff(r),c=!1,d="buffering",f=[],h=null,m=0,g=!1;const y=()=>{i.size!==0&&(i.clear(),e.onPendingChange())},b=(j,T)=>{if(_m(j)&&j.payload.type==="approval_decision"&&i.delete(Bl(j.origin,j.payload.tool_call_id))&&e.onPendingChange(),T&&!Rm(j.payload)&&C4(T,j)){ev(o,j);return}du(o,j,a())},w=j=>{switch(j.type){case"approval_request":{const T=j.toolCall.payload.tool_call_id,I={toolCall:j.toolCall};if(j.origin&&(I.origin=j.origin),i.set(Bl(j.origin,T),I),!x4(o,j.origin,T)){const M={...j.toolCall};j.origin&&j.origin.length>0?M.origin=[...j.origin]:delete M.origin,du(o,M,a()),e.onModelChange()}e.onPendingChange();return}case"task_state":{h=j.state,e.onTaskState(j.state),j.state==="idle"&&(h4(o,a()),y(),e.onModelChange());return}case"resync_required":{N();return}case"hello":return}},N=async()=>{m+=1,d="buffering",f=[],y(),o=Ff(r),await A(m)},A=async j=>{try{const T=await e.loadMessages();if(c||j!==m)return;const I=o;m4(I,T,a());const M=N4(T,100),_=f;f=[];for(let $=0;$<_.length;$+=1){const U=_[$];if(U.kind==="omni"?b(U.msg,M):w(U.ev),c)return;if(j!==m){f.push(..._.slice($+1));return}}d="live",h==="idle"&&p4(I),g=!1,e.onError(null),e.onLoading(!1),e.onModelChange()}catch(T){if(c||j!==m)return;g=!0,e.onLoading(!1),e.onError(T instanceof Error?T.message:String(T))}};return{get model(){return o},get pendingApprovals(){return i},load:()=>(m+=1,A(m)),retry:async()=>{c||!g||(e.onError(null),e.onLoading(!0),m+=1,await A(m))},handleOmni:j=>{if(!c){if(d==="buffering"){f.push({kind:"omni",msg:j});return}b(j,null),e.onModelChange()}},handleServer:j=>{if(!c){if(j.type==="session_title"){e.onSessionTitle?.(j.sessionId,j.title);return}if(j.type==="session_created"){e.onSessionCreated?.(j.sessionId);return}if(d==="buffering"){j.type==="task_state"&&(h=j.state,e.onTaskState(j.state)),f.push({kind:"server",ev:j});return}w(j)}},markLocalDecision:j=>{g4(o,j)},resolveApproval:j=>{i.delete(j)&&e.onPendingChange()},dispose:()=>{c=!0}}}const OA=new Map;function IA(e,a,r,i){const[o,c]=k.useState(0),[d,f]=k.useState(!0),[h,m]=k.useState(a),[g,y]=k.useState(null),[b,w]=k.useState(0),N=k.useRef(r);N.current=r;const A=k.useRef(i);A.current=i;const j=k.useRef(null),T=k.useRef(null);T.current===null&&(T.current=Ff());const I=k.useRef(null),M=k.useCallback(()=>{I.current===null&&(I.current=requestAnimationFrame(()=>{I.current=null,c(Y=>Y+1)}))},[]);k.useEffect(()=>{if(!e){j.current?.dispose(),j.current=null,m("idle"),f(!1),y(null),w(J=>J+1),c(J=>J+1);return}c(J=>J+1),f(!0),y(null),m(a),w(J=>J+1);const Y=LA({loadMessages:async()=>(await Bw(e)).messages,onTaskState:m,onLoading:f,onError:y,onModelChange:M,onPendingChange:()=>w(J=>J+1),onSessionTitle:(J,P)=>N.current?.(J,P),onSessionCreated:()=>A.current?.()});j.current=Y;const W=Pj(e,{onOmniMessage:Y.handleOmni,onServerEvent:Y.handleServer,onError:J=>{J&&Df().catch(()=>{})}});return Y.load(),()=>{Y.dispose(),W.close(),I.current!==null&&(cancelAnimationFrame(I.current),I.current=null)}},[e]);const _=k.useCallback(Y=>{j.current?.markLocalDecision(Y)},[]),$=k.useCallback(Y=>{j.current?.resolveApproval(Y)},[]),U=k.useCallback(()=>{j.current?.retry()},[]);return{model:j.current?.model??T.current,version:o,loading:d,taskState:h,pendingApprovals:j.current?.pendingApprovals??OA,markLocalDecision:_,resolveApproval:$,error:g,retry:U}}const Po={tokens:"M4 6c0-1.7 3.6-3 8-3s8 1.3 8 3-3.6 3-8 3-8-1.3-8-3zm0 0v12c0 1.7 3.6 3 8 3s8-1.3 8-3V6M4 12c0 1.7 3.6 3 8 3s8-1.3 8-3",cost:"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zm0-15v12m2.6-9.3c-.5-.8-1.5-1.2-2.6-1.2-1.5 0-2.7.8-2.7 2 0 2.7 5.4 1.3 5.4 4 0 1.2-1.2 2-2.7 2-1.2 0-2.2-.5-2.7-1.4",elapsed:"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zm0-14v5l3 2",folder:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"};function Cf({icon:e,value:a,label:r}){return s.jsxs("span",{title:r,className:"flex shrink-0 items-center gap-1 font-mono text-xs text-gray-500 dark:text-gray-400",children:[s.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:s.jsx("path",{d:e})}),a]})}const Pr="new";function UA(){const e=Jn(),a=I1(),{currency:r}=Gr(),{currentProject:i,currentAgent:o,setCurrentAgentId:c,reloadAgents:d,agents:f}=Yt(),h=i?.projectId??null,m=o?.agentId??null,{sessions:g,loading:y,reload:b,add:w,replace:N,setStatus:A,setTitle:j}=Cu(),[T,I]=k.useState(null),[M,_]=k.useState(!1),[$,U]=k.useState(!1),[Y,W]=k.useState(!1),[J,P]=k.useState(!1),[K,D]=k.useState(null),O=a.sessionId??null,te=_A(O),F=O===Pr,L=F?null:g.find(ie=>ie.sessionId===O)??null,ae=L?{provider:L.provider,modelId:L.modelId}:null;sa(L?L.title??v.chat.defaultSessionTitle:v.nav.chat);const ne=IA(L?.sessionId??null,L?.status??"idle",j,()=>{b()}),{initial:xe,onTextChange:R,onHandoffTargetChange:z,onSkillsChange:B,discard:C}=DA(L?.sessionId??null),G=L?.sessionId??null,re=L?.agentId??null;k.useEffect(()=>{G&&re&&c(re)},[G,re,c]);const[ue,ge]=k.useState([]);k.useEffect(()=>{if(ge(he=>he.length>0?[]:he),!h||!re)return;let ie=!1;return ym(h,re).then(he=>{ie||ge(he.skills)}).catch(()=>{}),()=>{ie=!0}},[h,re]),k.useEffect(()=>{if(y||F||O&&g.some(he=>he.sessionId===O))return;const ie=g[0];e(ie?`/chat/${ie.sessionId}`:`/chat/${Pr}`,{replace:!0})},[y,F,O,g,e]),k.useEffect(()=>{L&&A(L.sessionId,ne.taskState)},[ne.taskState,L,A]);const we=k.useRef(ne.taskState);k.useEffect(()=>{const ie=we.current;we.current=ne.taskState,ie!=="idle"&&ne.taskState==="idle"&&(b(),d())},[ne.taskState,b,d]);const Ne=k.useRef(new Map);k.useEffect(()=>{I(null),_(!1),Ne.current=new Map},[O]);const ye=k.useCallback(async ie=>{const he=L?.sessionId??null,Se=Ne.current,Ae=he===null?[]:ie.filter(ce=>!Se.has(ce));if(he!==null&&Ae.length>0){const ce=Ww(he,Ae).then(ee=>new Set(ee.existing)).catch(()=>null);for(const ee of Ae)Se.set(ee,ce.then(ve=>{if(ve===null)return Se.delete(ee),!1;const Re=ve.has(ee);return Se.set(ee,Re),Re}))}const Xe=new Set;return await Promise.all(ie.map(async ce=>{const ee=Se.get(ce);(ee===!0||ee instanceof Promise&&await ee)&&Xe.add(ce)})),Xe},[L?.sessionId]);k.useEffect(()=>{if(!h||!L||ne.taskState!=="idle")return;let ie=!1;return v1(h,{groupBy:"session",agentId:L.agentId}).then(he=>{if(ie)return;const Se=he.groups.find(Ae=>Ae.key===L.sessionId);I(Se?.cost??null),_(Se?.hasUncosted??!1)}).catch(()=>{}),()=>{ie=!0}},[h,L,ne.taskState]),k.useEffect(()=>{if(!h)return;let ie=!1;return D(null),(async()=>{try{const he=await ku(h);if(ie)return;D(he);const{prefs:Se}=await bw();if(ie||Se.credentialGuideSeen)return;const Ae=he.models.find(ce=>ot(ce,he.defaultModel));(!he.defaultModel||!Ae?.credential?.apiKeyMasked)&&U(!0),y1({credentialGuideSeen:!0}).catch(()=>{})}catch{}})(),()=>{ie=!0}},[h]);const Me=k.useCallback(async(ie,he)=>{he!==ie&&(await b(),e(`/chat/${he}`,{replace:!0}))},[b,e]),Je=k.useCallback(async ie=>{if(!L)return!1;try{const he=await iu(L.sessionId,{input:ie});return C(),await Me(L.sessionId,he.sessionId),!0}catch(he){return Xn(ur(he,{modelId:L.modelId})),!1}},[L,C,Me]),Kt=k.useCallback(async(ie,he)=>{if(!h||!o||!L)return!1;const Se={type:"text",text:ob({agentId:o.agentId,...o.name!==void 0?{agentName:o.name}:{},sessionId:L.sessionId,workspace:L.workspace,...L.title!==void 0?{sessionTitle:L.title}:{}})};let Ae=null;try{const Xe=await Lf(h,ie.agentId,{approvalMode:L.approvalMode});Ae=Xe.session.sessionId;const ce=await iu(Ae,{input:[Se,...he]});return w(Xe.session),C(),e(`/chat/${ce.sessionId}`),!0}catch(Xe){return Ae&&lu(Ae).catch(()=>{}),Xn(ur(Xe,K?.defaultModel?{modelId:K.defaultModel.modelId}:{})),!1}},[h,o,L,w,C,e,K]),Lt=k.useCallback(async()=>{L&&await Pw(L.sessionId).catch(()=>{})},[L]),qt=k.useCallback(async(ie,he,Se)=>{if(!L)return;ne.markLocalDecision(ie);const Ae=Bl(Se,ie);try{await Hw(L.sessionId,ie,{decision:he}),ne.resolveApproval(Ae)}catch(Xe){Xe instanceof Ie&&Xe.status===404&&ne.resolveApproval(Ae)}},[L,ne]),Tt=k.useCallback(ie=>{!L||J||(P(!0),Of(L.sessionId,{approvalMode:ie}).then(he=>N(he.session)).catch(he=>{Xn(ur(he))}).finally(()=>P(!1)))},[L,J,N]),fn=k.useCallback(async()=>{if(L)try{const ie=await qw(L.sessionId);await Me(L.sessionId,ie.sessionId)}catch(ie){Xn(ur(ie,{modelId:L.modelId}))}},[L,Me]),Jt=k.useCallback(()=>{e(`/chat/${Pr}`)},[e]),kt=K?.models.find(ie=>ot(ie,ae))?.pricing,Rt={pendingApprovals:ne.pendingApprovals,onApprove:qt,origin:[],taskRunning:ne.taskState!=="idle",taskCost:ie=>{if(!kt)return null;const he=ie.tokensByBucket;return(he.cacheRead*kt.cacheRead+he.cacheWrite*kt.cacheWrite+he.output*kt.output)/1e6},onOpenFile:ie=>{te.setOpen(!0),te.browsePath(ie)},workspace:L?.workspace??null,statFiles:ye};if(!h||!m)return s.jsx("div",{className:"p-6",children:s.jsx(ft,{className:"h-6 w-64"})});const en=ne.model.stats.sessionTotal+ne.model.stats.subagentTotal,mn=K?.models.find(ie=>ot(ie,ae)),Wt=mn?.contextWindow,ct=mn?.vision!==!1,Vn=L!==null&&!ne.loading&&!ne.error&&ne.model.items.length===0,se=L&&s.jsx(pb,{status:ne.taskState,onSend:Je,onStop:Lt,onCompact:fn,modelRef:ae,...K!==null?{models:K.models}:{},...Wt!==void 0?{contextWindow:Wt}:{},contextNow:ne.model.stats.contextNow,contextStale:ne.model.stats.contextStale,vision:ct,approvalMode:L.approvalMode,onChangeApprovalMode:Tt,modeSaving:J,autoFocus:!0,agents:f,skills:ue,...xe.skills&&xe.skills.length>0?{initialSkills:xe.skills}:{},onSkillsChange:B,onHandoff:Kt,initialText:xe.text??"",onTextChange:R,...xe.handoffAgentId?{initialHandoffTargetId:xe.handoffAgentId}:{},onHandoffTargetChange:z});return s.jsxs("div",{className:"flex h-full flex-col bg-white dark:bg-gray-950",children:[L&&s.jsxs("div",{className:"flex shrink-0 items-center gap-2.5 border-b border-gray-200 px-3 py-2 md:px-4 dark:border-gray-800",children:[s.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[s.jsx("h1",{className:"flex min-w-0 text-[15px] font-semibold",children:s.jsx(Eu,{text:L.title??v.chat.defaultSessionTitle})}),ne.taskState==="running"&&s.jsxs("span",{className:"flex shrink-0 items-center gap-1.5 text-xs text-gray-500 dark:text-gray-400",children:[s.jsx("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-emerald-500"}),v.chat.statusRunning]})]}),s.jsxs("div",{className:"hidden items-center gap-3 sm:flex",children:[s.jsx(Cf,{icon:Po.tokens,value:We(en),label:`${v.chat.statTokens}(Token)`}),T!=null&&s.jsx(Cf,{icon:Po.cost,value:`${Pn(T,r)}${M?" *":""}`,label:`${v.chat.statCost}(${r})${M?` · ${v.usage.uncostedNote}`:""}`}),s.jsx(Cf,{icon:Po.elapsed,value:At(ne.model.stats.sessionElapsedMs),label:v.chat.statElapsed})]}),s.jsxs("button",{type:"button","aria-expanded":te.open,onClick:()=>te.setOpen(!te.open),title:v.chat.openWorkspace,className:`flex h-7 shrink-0 items-center gap-1.5 rounded-md px-2 text-xs font-medium transition-colors duration-150 ${te.open?"bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-200":"text-gray-500 hover:bg-gray-100 hover:text-gray-800 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-200"}`,children:[s.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7","aria-hidden":!0,children:s.jsx("path",{d:Po.folder})}),v.chat.openWorkspace]}),s.jsx(Da,{open:Y,setOpen:W,menuClass:"right-0 top-full mt-1 w-80 max-w-[calc(100vw-1.5rem)] origin-top-right",button:s.jsx("button",{type:"button",title:v.chat.infoPanel,onClick:()=>W(!Y),className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-gray-500 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-800 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-200",children:s.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[s.jsx("circle",{cx:"12",cy:"12",r:"9"}),s.jsx("path",{d:"M12 11v5m0-8h.01"})]})}),children:s.jsxs("div",{className:"space-y-3 px-3.5 py-2.5 text-sm",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:v.chat.model}),s.jsxs("p",{className:"truncate text-xs",children:[s.jsx("span",{className:"font-mono",children:L.modelId}),s.jsx("span",{className:"ml-1.5 text-gray-400 dark:text-gray-500",children:dr(L.provider)?.label??L.provider})]})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:v.chat.workspace}),s.jsx("p",{className:"break-all font-mono text-xs leading-5",children:L.workspace})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:v.models.createdAt}),s.jsx("p",{className:"font-mono text-xs",children:Nn(L.createdAt)})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:v.chat.sessionStats}),s.jsxs("p",{className:"font-mono text-xs",children:[v.chat.statTokens," ",We(en),T!=null&&` · ${v.chat.statCost} ${Pn(T,r)}`," ","· ",v.chat.statElapsed," ",At(ne.model.stats.sessionElapsedMs)]})]})]})})]}),s.jsxs("div",{className:"flex min-h-0 flex-1",children:[s.jsx("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:F?s.jsx(lA,{projectId:h,models:K},`draft:${h}`):s.jsx("div",{className:"anim-fade flex min-h-0 flex-1 flex-col",children:L?ne.error?s.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 p-6",children:[s.jsxs("p",{className:"text-sm text-red-600 dark:text-red-400",children:[v.chat.historyLoadFailed,":",ne.error]}),s.jsx(pe,{onClick:ne.retry,children:v.common.retry})]}):ne.loading?s.jsxs("div",{className:"space-y-3 p-6",children:[s.jsx(ft,{className:"h-5 w-1/3"}),s.jsx(ft,{className:"h-5 w-2/3"}),s.jsx(ft,{className:"h-5 w-1/2"})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"min-h-0 flex-1",children:Vn?s.jsx("div",{className:"flex h-full items-center justify-center px-4",children:s.jsx("p",{className:"text-lg font-medium text-gray-400 dark:text-gray-500",children:v.chat.emptyGreeting})}):s.jsx(qM,{items:ne.model.items,version:ne.version,ctx:Rt})}),s.jsx("div",{className:"shrink-0 border-t border-gray-200 bg-white px-3 pb-[calc(0.75rem+env(safe-area-inset-bottom))] pt-3 md:pb-3 dark:border-gray-800 dark:bg-gray-950",children:s.jsx("div",{className:"mx-auto max-w-3xl",children:se})})]}):y?s.jsx("div",{className:"space-y-3 p-6",children:s.jsx(ft,{className:"h-5 w-1/2"})}):s.jsx(fr,{title:v.chat.noSessions,action:s.jsx(pe,{onClick:Jt,children:v.nav.newChat})})},L?.sessionId??"empty")}),L&&s.jsx(AA,{session:L,panel:te})]}),s.jsx(bt,{open:$,title:v.project.noCredentialTitle,onClose:()=>U(!1),footer:s.jsxs(s.Fragment,{children:[s.jsx(pe,{onClick:()=>U(!1),children:v.project.later}),s.jsx(pe,{variant:"primary",onClick:()=>{U(!1),e("/models")},children:v.project.goToModels})]}),children:s.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:v.project.noCredentialBody})})]})}const bb=/^[a-z][a-z0-9_]{1,63}$/,Iy=/^[a-z][a-z0-9_]{1,31}$/,$A=/^[a-z0-9_]+$/,BA=64;function HA({open:e,onClose:a,onCreated:r}){const{user:i}=qn(),o=i&&!i.isAdmin?`${i.userId}-`:"",[c,d]=k.useState(""),[f,h]=k.useState(""),[m,g]=k.useState(null),[y,b]=k.useState(!1);k.useEffect(()=>{e&&(d(""),h(""),g(null))},[e]);const w=async()=>{const N=o+c.trim();if(!c.trim()){g(v.common.requiredField);return}if(!(o?$A.test(c.trim())&&N.length<=BA:bb.test(N))){g(o?v.project.idPrefixHint:v.project.idHint);return}b(!0),g(null);try{const j=await Cw({projectId:N,...f.trim()?{name:f.trim()}:{}});r(j.project.projectId)}catch(j){g(j instanceof Ie?j.message:v.common.unknownError)}finally{b(!1)}};return s.jsx(bt,{open:e,title:v.project.createTitle,onClose:a,footer:s.jsxs(s.Fragment,{children:[s.jsx(pe,{onClick:a,children:v.common.cancel}),s.jsx(pe,{variant:"primary",disabled:y,onClick:()=>{w()},children:v.common.create})]}),children:s.jsxs("div",{className:"space-y-3",children:[o?s.jsxs("div",{children:[s.jsx("span",{className:"mb-1 block text-xs font-semibold text-gray-600 dark:text-gray-400",children:v.project.id}),s.jsxs("div",{className:"flex items-stretch",children:[s.jsx("span",{className:"flex shrink-0 items-center rounded-l-md border border-r-0 border-gray-300 bg-gray-100 px-2 font-mono text-xs text-gray-500 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-400",children:o}),s.jsx(qe,{size:"sm",className:"rounded-l-none",value:c,onChange:N=>d(N.target.value),autoFocus:!0})]}),s.jsx("span",{className:"mt-1 block text-xs text-gray-500 dark:text-gray-500",children:v.project.idPrefixHint})]}):s.jsx(qe,{label:v.project.id,size:"sm",value:c,onChange:N=>d(N.target.value),hint:v.project.idHint,autoFocus:!0}),s.jsx(qe,{label:v.project.name,size:"sm",value:f,onChange:N=>h(N.target.value)}),m&&s.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:m})]})})}function PA({open:e,onClose:a}){const{user:r}=qn(),{currentProject:i,setCurrentProjectId:o,projects:c,reloadProjects:d}=Yt(),[f,h]=k.useState(null),[m,g]=k.useState(""),[y,b]=k.useState(null),[w,N]=k.useState(!1),A=i?.projectId,j=i?.role==="owner";if(k.useEffect(()=>{!e||!A||(h(null),b(null),N(!1),ef(A).then(_=>h(_.members)).catch(_=>b(_ instanceof Ie?_.message:v.common.unknownError)))},[e,A]),!i||!A)return null;const T=async()=>{if(m.trim()){b(null);try{await Tw(A,{userId:m.trim()}),g("");const _=await ef(A);h(_.members)}catch(_){b(_ instanceof Ie?_.message:v.common.unknownError)}}},I=async _=>{b(null);try{await Mw(A,_);const $=await ef(A);h($.members)}catch($){b($ instanceof Ie?$.message:v.common.unknownError)}},M=async()=>{b(null);try{await Ew(A),a();const _=c.find($=>$.projectId!==A);await d(),_&&o(_.projectId)}catch(_){b(_ instanceof Ie?_.message:v.common.unknownError)}};return s.jsx(bt,{open:e,title:v.project.settingsTitle,onClose:a,children:s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("p",{className:"mb-1 text-xs font-medium text-gray-500",children:v.project.switcher}),s.jsxs("p",{className:"text-sm",children:[Bf(i)," ",s.jsx("span",{className:"font-mono text-xs text-gray-400",children:A})]})]}),s.jsxs("div",{children:[s.jsx("p",{className:"mb-2 text-xs font-medium text-gray-500",children:v.project.members}),f===null?s.jsx("p",{className:"text-xs text-gray-400",children:v.common.loading}):s.jsx("div",{className:"overflow-x-auto rounded-md border border-gray-200 dark:border-gray-800",children:s.jsxs("table",{className:"w-full text-xs",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-gray-100 bg-gray-50 text-left text-gray-500 dark:border-gray-800 dark:bg-gray-900/60 dark:text-gray-400",children:[s.jsx("th",{className:"whitespace-nowrap px-2.5 py-1.5 font-medium",children:v.project.memberUsername}),s.jsx("th",{className:"whitespace-nowrap px-2.5 py-1.5 font-medium",children:v.project.memberRole}),s.jsx("th",{className:"w-20 whitespace-nowrap px-2.5 py-1.5 text-right font-medium",children:v.project.memberActions})]})}),s.jsxs("tbody",{className:"divide-y divide-gray-100 dark:divide-gray-800/60",children:[f.map(_=>s.jsxs("tr",{children:[s.jsx("td",{className:"whitespace-nowrap px-2.5 py-1.5",children:_.userId}),s.jsx("td",{className:"whitespace-nowrap px-2.5 py-1.5",children:s.jsx(mt,{tone:"gray",children:_.role})}),s.jsx("td",{className:"whitespace-nowrap px-2.5 py-1 text-right",children:j&&_.role!=="owner"&&_.userId!==r?.userId&&s.jsx(pe,{size:"sm",variant:"ghost",onClick:()=>{I(_.userId)},children:v.project.removeMember})})]},_.userId)),j&&s.jsxs("tr",{children:[s.jsx("td",{className:"px-2.5 py-1.5",children:s.jsx(qe,{placeholder:v.project.memberUsername,size:"sm",value:m,onChange:_=>g(_.target.value),onKeyDown:_=>{_.key==="Enter"&&T()}})}),s.jsx("td",{className:"whitespace-nowrap px-2.5 py-1.5",children:s.jsx(mt,{tone:"gray",children:"member"})}),s.jsx("td",{className:"whitespace-nowrap px-2.5 py-1 text-right",children:s.jsx(pe,{size:"sm",disabled:!m.trim(),onClick:()=>{T()},children:v.project.addMember})})]})]})]})})]}),j&&s.jsx("div",{className:"border-t border-gray-100 pt-3 dark:border-gray-800",children:A==="default_project"?s.jsx("p",{className:"text-xs text-gray-400",children:v.project.deleteDefaultForbidden}):c.length<=1?s.jsx("p",{className:"text-xs text-gray-400",children:v.project.deleteLastForbidden}):w?s.jsxs("div",{className:"space-y-2",children:[s.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:v.project.deleteConfirm}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(pe,{size:"sm",onClick:()=>N(!1),children:v.common.cancel}),s.jsx(pe,{size:"sm",variant:"danger",onClick:()=>{M()},children:v.common.confirm})]})]}):s.jsx(pe,{size:"sm",variant:"danger",onClick:()=>N(!0),children:v.project.deleteProject})}),y&&s.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:y})]})})}const qA="M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7-10-7-10-7zM12 9a3 3 0 1 0 0 6 3 3 0 0 0 0-6z",FA="M3 3l18 18M10.6 5.1A11 11 0 0 1 12 5c6.4 0 10 7 10 7a17.6 17.6 0 0 1-3.2 3.9M6.6 6.6C4 8.3 2 12 2 12s3.6 7 10 7a10 10 0 0 0 4.8-1.2M9.9 9.9a3 3 0 0 0 4.2 4.2";function qr({label:e,hint:a,error:r,invalid:i,size:o="base",className:c,...d}){const[f,h]=k.useState(!1),m=f?v.auth.hidePassword:v.auth.showPassword;return s.jsxs("label",{className:"block",children:[e&&s.jsx("span",{className:"mb-1 block text-xs font-semibold text-gray-600 dark:text-gray-400",children:e}),s.jsxs("div",{className:"relative",children:[s.jsx(qe,{...d,size:o,type:f?"text":"password",invalid:!!r||!!i,className:`${o==="sm"?"pr-8":"pr-10"} ${c??""}`}),s.jsx("button",{type:"button","aria-label":m,title:m,onClick:()=>h(g=>!g),className:`absolute inset-y-0 right-0 flex items-center justify-center text-gray-400 transition-colors duration-150 hover:text-gray-600 dark:hover:text-gray-300 ${o==="sm"?"w-8":"w-10"}`,children:s.jsx("svg",{width:o==="sm"?14:16,height:o==="sm"?14:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:s.jsx("path",{d:f?FA:qA})})})]}),r?s.jsx("span",{className:"mt-1 block text-xs text-red-600 dark:text-red-400",children:r}):a?s.jsx("span",{className:"mt-1 block text-xs text-gray-500 dark:text-gray-500",children:a}):null]})}function kb({open:e,onClose:a}){const{refresh:r}=qn(),[i,o]=k.useState(""),[c,d]=k.useState(""),[f,h]=k.useState(""),[m,g]=k.useState(null),[y,b]=k.useState(!1);k.useEffect(()=>{e&&(o(""),d(""),h(""),g(null))},[e]);const w=async()=>{if(!i||!c||!f){g(v.common.requiredField);return}if(c!==f){g(v.account.passwordMismatch);return}b(!0),g(null);try{await vw({oldPassword:i,newPassword:c}),await r(),a()}catch(N){g(N instanceof Ie?N.message:v.common.unknownError)}finally{b(!1)}};return s.jsx(bt,{open:e,title:v.account.changePassword,onClose:a,footer:s.jsxs(s.Fragment,{children:[s.jsx(pe,{onClick:a,disabled:y,children:v.common.cancel}),s.jsx(pe,{variant:"primary",disabled:y,onClick:()=>{w()},children:v.common.save})]}),children:s.jsxs("div",{className:"space-y-3",children:[s.jsx(qr,{label:v.account.oldPassword,size:"sm",value:i,onChange:N=>o(N.target.value),autoComplete:"current-password",autoFocus:!0}),s.jsx(qr,{label:v.account.newPassword,size:"sm",value:c,onChange:N=>d(N.target.value),autoComplete:"new-password",hint:v.auth.passwordHint}),s.jsx(qr,{label:v.account.confirmPassword,size:"sm",value:f,onChange:N=>h(N.target.value),autoComplete:"new-password"}),m&&s.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:m})]})})}function or({d:e,size:a=16}){return s.jsx("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:s.jsx("path",{d:e})})}function VA(){return s.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor","aria-hidden":!0,children:s.jsx("path",{d:"M3 4.5l3 3 3-3",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}const Ol={agents:"M12 3v3m-6 4a6 6 0 0 1 12 0v5a3 3 0 0 1-3 3H9a3 3 0 0 1-3-3v-5zm3 3h.01M15 13h.01",skills:"M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2zM22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z",models:"M7 7h10v10H7zM4 10h3m10 0h3M4 14h3m10 0h3M10 4v3m4-3v3m-4 10v3m4-3v3",usage:"M4 20V10m6 10V4m6 16v-7m4 7H2",traces:"M4 6h16M4 12h10M4 18h13",benchmark:"M7 4h10v5a5 5 0 0 1-10 0V4zM7 5H4v1a3 3 0 0 0 3 3m10-4h3v1a3 3 0 0 1-3 3M12 14v4m-4 0h8"},YA="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2zM15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0z",qo="block w-full px-3.5 py-2 text-left text-sm transition-colors duration-150 hover:bg-gray-100 dark:hover:bg-gray-800";function GA({session:e}){return e.status==="running"?s.jsx("span",{title:v.chat.statusRunning,className:"h-1.5 w-1.5 shrink-0 animate-pulse rounded-full bg-emerald-500"}):e.status==="compacting"?s.jsx("span",{title:v.chat.statusCompacting,className:"h-1.5 w-1.5 shrink-0 rounded-full bg-amber-500"}):null}function Uy({onNavigate:e,onCollapse:a}){const r=Jn(),{user:i,logout:o}=qn(),{mode:c,setMode:d,fontScale:f,setFontScale:h,accent:m,setAccent:g,currency:y,setCurrency:b}=Gr(),{lang:w,setLang:N}=ia(),{projects:A,currentProject:j,setCurrentProjectId:T,reloadProjects:I,agents:M,setCurrentAgentId:_}=Yt(),{byAgent:$,loading:U,remove:Y,replace:W}=Cu(),P=PS("/chat/:sessionId")?.params.sessionId??null,[K,D]=k.useState(!1),[O,te]=k.useState(!1),[F,L]=k.useState(!1),[ae,ne]=k.useState(!1),[xe,R]=k.useState(!1),[z,B]=k.useState(new Set),[C,G]=k.useState(new Set),[re,ue]=k.useState(null),[ge,we]=k.useState(!1),[Ne,ye]=k.useState(null),[Me,Je]=k.useState(null),[Kt,Lt]=k.useState(""),[qt,Tt]=k.useState(!1),[fn,Jt]=k.useState(null),kt=ee=>B(ve=>{const Re=new Set(ve);return Re.has(ee)?Re.delete(ee):Re.add(ee),Re}),Rt=ee=>G(ve=>{const Re=new Set(ve);return Re.has(ee)?Re.delete(ee):Re.add(ee),Re}),en=async ee=>{!ee.archived&&ee.sessionId===P&&G(ve=>new Set(ve).add(ee.agentId));try{const ve=await Of(ee.sessionId,{archived:!ee.archived});W(ve.session)}catch{}},mn=async()=>{if(!Me)return;const ee=Kt.trim();if(ee){Tt(!0),Jt(null);try{const ve=await Of(Me.sessionId,{title:ee});W(ve.session),Je(null)}catch(ve){Jt(ve instanceof Ie?ve.message:v.common.unknownError)}finally{Tt(!1)}}},Wt=async()=>{if(!re)return;we(!0),ye(null);const ee=re;try{if(await lu(ee.sessionId),Y(ee.sessionId),i&&xu(xb(i.userId,ee.sessionId)),ue(null),P===ee.sessionId){const ve=($.get(ee.agentId)??[]).filter(Re=>Re.sessionId!==ee.sessionId&&!Re.archived);r(ve[0]?`/chat/${ve[0].sessionId}`:"/chat")}}catch(ve){ye(ve instanceof Ie?ve.message:v.common.unknownError)}finally{we(!1)}},ct=ee=>{r(ee),e?.()},Vn=ee=>{ee&&_(ee),r(`/chat/${Pr}`,ee?{state:{agentId:ee}}:void 0),e?.()},se=(M.find(ee=>ee.agentId==="default_agent")??M[0])?.agentId,ie=ee=>{_(ee.agentId),ct(`/chat/${ee.sessionId}`)},he=[{to:"/agents",label:v.nav.agents,icon:Ol.agents},{to:"/skills",label:v.nav.skills,icon:Ol.skills},{to:"/models",label:v.nav.models,icon:Ol.models},{to:"/usage",label:v.nav.usage,icon:Ol.usage},{to:"/traces",label:v.nav.traces,icon:Ol.traces},{to:"/benchmark",label:v.nav.benchmark,icon:Ol.benchmark}],Se=[{value:"light",label:v.settings.themeLight},{value:"dark",label:v.settings.themeDark},{value:"system",label:v.settings.followSystem}],Ae=[{value:"en",label:v.settings.langEn},{value:"zh",label:v.settings.langZh},{value:"system",label:v.settings.followSystem}],Xe=[{value:"sm",label:v.settings.fontSmall},{value:"md",label:v.settings.fontMedium},{value:"lg",label:v.settings.fontLarge}],ce=[{value:"USD",label:v.models.currencyUsd},{value:"CNY",label:v.models.currencyCny}];return s.jsxs("div",{className:"flex h-full w-full flex-col",children:[s.jsxs("div",{className:"flex shrink-0 items-center gap-1 px-2 pt-2",children:[a&&s.jsx("button",{type:"button",title:v.nav.collapseSidebar,"aria-label":v.nav.collapseSidebar,onClick:a,className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-gray-400 transition-colors duration-150 hover:bg-gray-200/70 hover:text-gray-800 dark:text-gray-500 dark:hover:bg-gray-800 dark:hover:text-gray-200",children:s.jsx(or,{d:"M15 6l-6 6 6 6M4 4v16",size:18})}),s.jsxs(Da,{open:K,setOpen:D,className:"min-w-0 flex-1",menuClass:"left-0 right-0 top-full mt-1 origin-top",button:s.jsxs("button",{type:"button",onClick:()=>D(!K),className:"flex w-full items-center gap-1.5 rounded-md px-2 py-1.5 text-base font-semibold transition-colors duration-150 hover:bg-gray-200/70 dark:hover:bg-gray-800",children:[s.jsx("span",{className:"min-w-0 flex-1 truncate text-left",children:j?Bf(j):v.common.loading}),s.jsx("span",{className:"text-gray-400",children:s.jsx(VA,{})})]}),children:[A.map(ee=>s.jsxs("button",{type:"button",onClick:()=>{T(ee.projectId),D(!1)},className:`flex w-full items-center justify-between gap-2 px-3.5 py-2 text-left text-sm transition-colors duration-150 hover:bg-gray-100 dark:hover:bg-gray-800 ${ee.projectId===j?.projectId?"font-semibold":""}`,children:[s.jsx("span",{className:"truncate",children:Bf(ee)}),s.jsx(mt,{tone:"gray",children:ee.role})]},ee.projectId)),s.jsxs("div",{className:"mt-1.5 border-t border-gray-100 pt-1.5 dark:border-gray-800",children:[s.jsxs("button",{type:"button",className:qo,onClick:()=>{D(!1),L(!0)},children:["+ ",v.project.create]}),j&&s.jsx("button",{type:"button",className:qo,onClick:()=>{D(!1),ne(!0)},children:v.project.settings})]})]})]}),s.jsxs("nav",{className:"shrink-0 space-y-0.5 px-2 pt-2",children:[s.jsxs("button",{type:"button",onClick:()=>Vn(se),className:`flex w-full items-center gap-2 rounded-md px-2.5 py-1.5 text-sm font-medium transition-colors duration-150 ${P===Pr?"bg-gray-200/70 text-gray-900 dark:bg-gray-800 dark:text-gray-100":"text-gray-600 hover:bg-gray-200/50 hover:text-gray-900 dark:text-gray-400 dark:hover:bg-gray-800/70 dark:hover:text-gray-200"}`,children:[s.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:s.jsx(or,{d:"M12 20h9M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"})}),v.chat.newSessionMenu]}),he.map(ee=>s.jsxs(Tm,{to:ee.to,onClick:()=>e?.(),className:({isActive:ve})=>`flex items-center gap-2 rounded-md px-2.5 py-1.5 text-sm transition-colors duration-150 ${ve?"bg-gray-200/70 font-medium text-gray-900 dark:bg-gray-800 dark:text-gray-100":"text-gray-600 hover:bg-gray-200/50 hover:text-gray-900 dark:text-gray-400 dark:hover:bg-gray-800/70 dark:hover:text-gray-200"}`,children:[s.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:s.jsx(or,{d:ee.icon})}),ee.label]},ee.to))]}),s.jsx("div",{className:"mt-3 min-h-0 flex-1 overflow-y-auto border-t border-gray-200 px-2 pb-2 dark:border-gray-800",children:U&&M.length===0?s.jsx(Wr,{rows:5}):M.map(ee=>{const ve=$.get(ee.agentId)??[],Re=ve.filter(hn=>!hn.archived),ze=ve.filter(hn=>hn.archived),Ot=z.has(ee.agentId),It=C.has(ee.agentId);return s.jsxs("div",{className:"pt-2.5",children:[s.jsxs("div",{className:"flex items-center gap-0.5 px-1 pb-0.5",children:[s.jsxs("button",{type:"button",onClick:()=>kt(ee.agentId),"aria-label":Ot?v.nav.expandGroup:v.nav.collapseGroup,className:"flex min-w-0 flex-1 items-center gap-1 rounded px-1 py-0.5 text-left transition-colors duration-150 hover:bg-gray-200/50 dark:hover:bg-gray-800/50",children:[s.jsx(Vr,{id:ee.agentId,size:18,className:"shrink-0 rounded"}),s.jsx("span",{className:"min-w-0 truncate text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400",children:za(ee)}),s.jsx(Zt,{open:!Ot,size:12,className:"text-gray-400"}),s.jsx("span",{className:"min-w-0 flex-1"})]}),s.jsx("button",{type:"button",title:v.chat.newSessionMenu,"aria-label":v.chat.newSessionMenu,onClick:()=>Vn(ee.agentId),className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-gray-400 transition-colors duration-150 hover:bg-gray-200/70 hover:text-gray-800 dark:text-gray-500 dark:hover:bg-gray-800 dark:hover:text-gray-200",children:s.jsx(or,{d:"M12 5v14M5 12h14",size:18})}),s.jsx("button",{type:"button",title:v.agent.settings,onClick:()=>ct(`/agents/${ee.agentId}`),className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-gray-400 transition-colors duration-150 hover:bg-gray-200/70 hover:text-gray-800 dark:text-gray-500 dark:hover:bg-gray-800 dark:hover:text-gray-200",children:s.jsx(or,{d:YA,size:16})})]}),Ot?null:s.jsxs(s.Fragment,{children:[Re.length===0&&ze.length===0?s.jsx("p",{className:"px-2.5 py-1 text-xs text-gray-400 dark:text-gray-600",children:v.chat.noSessions}):s.jsx("ul",{className:"space-y-0.5",children:Re.map(hn=>s.jsx($y,{s:hn,active:hn.sessionId===P,onOpen:ie,onRename:_t=>{Jt(null),Lt(_t.title??""),Je(_t)},onDelete:_t=>{ye(null),ue(_t)},onToggleArchive:_t=>{en(_t)}},hn.sessionId))}),ze.length>0&&s.jsxs("div",{className:"mt-1",children:[s.jsxs("button",{type:"button",onClick:()=>Rt(ee.agentId),className:"flex w-full items-center gap-1 rounded px-1.5 py-1 text-left text-[11px] font-medium text-gray-400 transition-colors duration-150 hover:bg-gray-200/50 dark:text-gray-500 dark:hover:bg-gray-800/50",children:[s.jsx(Zt,{open:It,size:12}),v.chat.archivedGroup(ze.length)]}),It&&s.jsx("ul",{className:"space-y-0.5",children:ze.map(hn=>s.jsx($y,{s:hn,active:hn.sessionId===P,onOpen:ie,onRename:_t=>{Jt(null),Lt(_t.title??""),Je(_t)},onDelete:_t=>{ye(null),ue(_t)},onToggleArchive:_t=>{en(_t)}},hn.sessionId))})]})]})]},ee.agentId)})}),s.jsx("div",{className:"shrink-0 border-t border-gray-200 p-2 dark:border-gray-800",children:s.jsxs(Da,{open:O,setOpen:te,menuClass:"bottom-full left-0 right-0 mb-1 origin-bottom",button:s.jsxs("button",{type:"button",onClick:()=>te(!O),className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left transition-colors duration-150 hover:bg-gray-200/70 dark:hover:bg-gray-800",children:[s.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-gray-900 text-xs font-bold text-white dark:bg-gray-200 dark:text-gray-900",children:(i?.userId??"?").slice(0,1).toUpperCase()}),s.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:i?.userId}),i?.isAdmin&&s.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:v.auth.admin})]}),children:[s.jsxs("div",{className:"space-y-2.5 px-3 py-2",children:[s.jsx(Yi,{label:v.settings.theme,children:s.jsx(Ur,{options:Se,value:c,onChange:d})}),s.jsx(Yi,{label:v.settings.fontSize,children:s.jsx(Ur,{options:Xe,value:f,onChange:h})}),s.jsx(Yi,{label:v.settings.accent,children:s.jsx(KA,{value:m,onChange:g})}),s.jsx(Yi,{label:v.models.currency,children:s.jsx(Ur,{options:ce,value:y,onChange:b,cols:2})}),s.jsx(Yi,{label:v.settings.language,children:s.jsx(Ur,{options:Ae,value:w,onChange:N})})]}),s.jsxs("div",{className:"mt-1 border-t border-gray-100 pt-1 dark:border-gray-800",children:[s.jsx("button",{type:"button",className:qo,onClick:()=>{te(!1),R(!0)},children:v.account.changePassword}),i?.isAdmin&&s.jsx("button",{type:"button",className:qo,onClick:()=>{te(!1),ct("/admin/users")},children:v.admin.users}),s.jsx("button",{type:"button",className:"block w-full px-3.5 py-2 text-left text-sm text-red-600 transition-colors duration-150 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950/40",onClick:()=>{te(!1),o().then(()=>r("/login"))},children:v.auth.logout})]})]})}),s.jsx(kb,{open:xe,onClose:()=>R(!1)}),s.jsx(HA,{open:F,onClose:()=>L(!1),onCreated:ee=>{L(!1),I().then(()=>T(ee))}}),j&&s.jsx(PA,{open:ae,onClose:()=>ne(!1)}),s.jsxs(bt,{open:Me!==null,title:v.chat.renameSession,onClose:()=>qt?void 0:Je(null),footer:s.jsxs(s.Fragment,{children:[s.jsx(pe,{onClick:()=>Je(null),disabled:qt,children:v.common.cancel}),s.jsx(pe,{variant:"primary",disabled:qt||!Kt.trim(),onClick:()=>{mn()},children:v.common.save})]}),children:[s.jsx(qe,{label:v.chat.renameSessionLabel,value:Kt,autoFocus:!0,maxLength:120,onChange:ee=>Lt(ee.target.value),onKeyDown:ee=>{ee.key==="Enter"&&Kt.trim()&&!qt&&mn()}}),fn&&s.jsx("p",{className:"mt-2 text-xs text-red-600 dark:text-red-400",children:fn})]}),s.jsxs(bt,{open:re!==null,title:v.chat.deleteSession,onClose:()=>ge?void 0:ue(null),footer:s.jsxs(s.Fragment,{children:[s.jsx(pe,{onClick:()=>ue(null),disabled:ge,children:v.common.cancel}),s.jsx(pe,{variant:"danger",disabled:ge,onClick:()=>{Wt()},children:v.common.delete})]}),children:[s.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:re?v.chat.deleteSessionConfirm(re.title??v.chat.defaultSessionTitle):""}),Ne&&s.jsx("p",{className:"mt-2 text-xs text-red-600 dark:text-red-400",children:Ne})]})]})}function $y({s:e,active:a,onOpen:r,onRename:i,onDelete:o,onToggleArchive:c}){const d="flex h-6 w-6 shrink-0 items-center justify-center rounded text-gray-400 opacity-0 transition-all duration-150 focus-visible:opacity-100 group-hover:opacity-100";return s.jsx("li",{children:s.jsxs("div",{className:`group flex items-center rounded-md pr-1 transition-colors duration-150 ${a?"bg-gray-200/70 dark:bg-gray-800":"hover:bg-gray-200/50 dark:hover:bg-gray-800/70"}`,children:[s.jsxs("button",{type:"button",onClick:()=>r(e),className:"flex min-w-0 flex-1 items-center gap-1.5 px-2.5 py-1.5 text-left",children:[s.jsx(Eu,{text:e.title??v.chat.defaultSessionTitle,className:`min-w-0 flex-1 text-sm ${a?"font-medium text-gray-900 dark:text-gray-100":e.archived?"text-gray-400 dark:text-gray-500":"text-gray-700 dark:text-gray-300"}`}),e.source&&s.jsx(mt,{tone:"gray",children:v.chat.sourceNames[e.source]??e.source}),s.jsx(GA,{session:e}),e.pendingApprovalCount>0&&s.jsx("span",{title:v.chat.pendingApprovals(e.pendingApprovalCount),children:s.jsx(mt,{tone:"amber",children:e.pendingApprovalCount})})]}),s.jsxs("div",{className:"flex shrink-0 items-center",children:[s.jsx("button",{type:"button",title:v.chat.renameSession,"aria-label":v.chat.renameSession,onClick:()=>i(e),className:`${d} hover:bg-gray-300/60 hover:text-gray-700 dark:hover:bg-gray-700 dark:hover:text-gray-200`,children:s.jsx(or,{d:"M4 20h4L18.5 9.5a2.1 2.1 0 0 0-3-3L5 17v3zM14 7l3 3",size:14})}),s.jsx("button",{type:"button",title:e.archived?v.chat.unarchiveSession:v.chat.archiveSession,"aria-label":e.archived?v.chat.unarchiveSession:v.chat.archiveSession,onClick:()=>c(e),className:`${d} hover:bg-gray-300/60 hover:text-gray-700 dark:hover:bg-gray-700 dark:hover:text-gray-200`,children:s.jsx(or,{d:e.archived?"M3 8h18M5 8v11a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V8M4 8l1.5-3h13L20 8M12 17v-5m-2.5 2L12 11l2.5 3":"M3 8h18M5 8v11a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V8M4 8l1.5-3h13L20 8M9.5 13.5 12 16l2.5-2.5",size:14})}),s.jsx("button",{type:"button",title:v.chat.deleteSession,"aria-label":v.chat.deleteSession,onClick:()=>o(e),className:`${d} hover:bg-gray-300/60 hover:text-red-600 dark:hover:bg-gray-700 dark:hover:text-red-400`,children:s.jsx(or,{d:"M4 6h16M9 6V4.5A1.5 1.5 0 0 1 10.5 3h3A1.5 1.5 0 0 1 15 4.5V6M6 6v13a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V6M10 10.5v6M14 10.5v6",size:14})})]})]})})}function Yi({label:e,children:a}){return s.jsxs("div",{children:[s.jsx("p",{className:"mb-1 text-[11px] font-medium text-gray-500 dark:text-gray-400",children:e}),a]})}function KA({value:e,onChange:a}){return s.jsx("div",{className:"flex items-center gap-1.5",children:pw.map(r=>s.jsx("button",{type:"button",title:v.settings.accentNames[r.value],"aria-label":v.settings.accentNames[r.value],"aria-pressed":e===r.value,onClick:()=>a(r.value),className:`h-5 w-5 rounded-full border transition-transform duration-150 hover:scale-110 ${e===r.value?"border-gray-500 ring-2 ring-gray-400/50 dark:border-gray-300":"border-transparent"}`,style:{backgroundColor:r.color}},r.value))})}const WA=[{to:"/chat",label:"chat",icon:"M8 10h8M8 14h5M21 12a9 9 0 1 1-4.2-7.6L21 4v5h-5"},{to:"/agents",label:"agents",icon:"M12 3v3m-6 4a6 6 0 0 1 12 0v5a3 3 0 0 1-3 3H9a3 3 0 0 1-3-3v-5zm3 3h.01M15 13h.01"},{to:"/skills",label:"skills",icon:"M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2zM22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z"},{to:"/models",label:"models",icon:"M7 7h10v10H7zM4 10h3m10 0h3M4 14h3m10 0h3M10 4v3m4-3v3m-4 10v3m4-3v3"},{to:"/usage",label:"usage",icon:"M4 20V10m6 10V4m6 16v-7m4 7H2"},{to:"/traces",label:"traces",icon:"M4 6h16M4 12h10M4 18h13"}];function XA(){const{user:e}=qn(),[a,r]=k.useState(!1),[i,o]=k.useState(!1),[c,d]=k.useState(()=>localStorage.getItem("penguin.sidebarCollapsed")==="1"),f=()=>d(h=>{const m=!h;return localStorage.setItem("penguin.sidebarCollapsed",m?"1":"0"),m});return s.jsxs("div",{className:"flex h-full",children:[s.jsx("aside",{className:`hidden shrink-0 border-r border-gray-200 bg-gray-50 md:block dark:border-gray-800 dark:bg-gray-900 ${c?"w-12":"w-64 lg:w-72"}`,children:c?s.jsxs("div",{className:"flex h-full flex-col items-center gap-1 py-2.5",children:[s.jsx("button",{type:"button",title:v.nav.expandSidebar,"aria-label":v.nav.expandSidebar,onClick:f,className:"flex h-8 w-8 items-center justify-center rounded-md text-gray-500 transition-colors duration-150 hover:bg-gray-200/70 hover:text-gray-800 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-200",children:s.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:s.jsx("path",{d:"M9 6l6 6-6 6M20 4v16"})})}),s.jsx("nav",{className:"mt-1 flex flex-col items-center gap-1",children:WA.map(h=>s.jsx(Tm,{to:h.to,title:h.label,className:({isActive:m})=>`flex h-8 w-8 items-center justify-center rounded-md transition-colors duration-150 ${m?"bg-gray-200/70 text-gray-900 dark:bg-gray-800 dark:text-gray-100":"text-gray-500 hover:bg-gray-200/70 hover:text-gray-800 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-200"}`,children:s.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:s.jsx("path",{d:h.icon})})},h.to))}),s.jsx("button",{type:"button",title:`${e?.userId??""} · ${v.nav.expandSidebar}`,"aria-label":e?.userId??v.auth.admin,onClick:f,className:"mt-auto flex h-8 w-8 items-center justify-center rounded-full bg-gray-900 text-xs font-bold text-white dark:bg-gray-200 dark:text-gray-900",children:(e?.userId??"?").slice(0,1).toUpperCase()})]}):s.jsx(Uy,{onCollapse:f})}),s.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[s.jsxs("header",{className:"flex h-12 shrink-0 items-center gap-2 border-b border-gray-200 bg-white px-2 md:hidden dark:border-gray-800 dark:bg-gray-950",children:[s.jsx("button",{type:"button","aria-label":v.chat.sessionList,onClick:()=>r(!0),className:"flex h-9 w-9 items-center justify-center rounded-md text-gray-500 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-800 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-200",children:s.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round","aria-hidden":!0,children:s.jsx("path",{d:"M4 6h16M4 12h16M4 18h16"})})}),s.jsx("span",{className:"text-sm font-semibold",children:v.appName})]}),e?.passwordIsInitial&&s.jsxs("div",{className:"flex shrink-0 items-center justify-center gap-3 border-b border-amber-200 bg-amber-50 px-3 py-1.5 text-xs text-amber-800 dark:border-amber-900/60 dark:bg-amber-950/40 dark:text-amber-300",children:[s.jsx("span",{children:v.account.initialPasswordBanner}),s.jsx("button",{type:"button",className:"shrink-0 font-medium underline underline-offset-2 hover:text-amber-950 dark:hover:text-amber-100",onClick:()=>o(!0),children:v.account.changeNow})]}),s.jsx("main",{className:"min-h-0 flex-1 overflow-hidden",children:s.jsx(lj,{})})]}),s.jsx(kb,{open:i,onClose:()=>o(!1)}),s.jsx(Vj,{open:a,side:"left",title:v.appName,onClose:()=>r(!1),children:s.jsx("div",{className:"h-full bg-gray-50 dark:bg-gray-900",children:s.jsx(Uy,{onNavigate:()=>r(!1)})})})]})}const rh=1440,lh=900,fm=3,QA=3,By=rh/fm,Hy=lh/QA,Fo=28,Vo=14;function ZA(e){return()=>{e|=0,e=e+1831565813|0;let a=Math.imul(e^e>>>15,1|e);return a=a+Math.imul(a^a>>>7,61|a)^a,((a^a>>>14)>>>0)/4294967296}}function JA(e,a){return e.x1-Vo<=a.x2&&e.x2+Vo>=a.x1&&e.y1-Vo<=a.y2&&e.y2+Vo>=a.y1}function e6(e,a,r,i){return{x1:Math.min(e,r),y1:Math.min(a,i),x2:Math.max(e,r),y2:Math.max(a,i)}}const t6=[{cell:0,edge:"left"},{cell:1,edge:"top"},{cell:2,edge:"right"},{cell:3,edge:"left"},{cell:5,edge:"right"},{cell:6,edge:"bottom"},{cell:7,edge:"bottom"},{cell:8,edge:"right"}];function n6(){const e=ZA(12696599),a=[];for(const{cell:r,edge:i}of t6){const o=r%fm*By+Fo,c=Math.floor(r/fm)*Hy+Fo,d=o+By-2*Fo,f=c+Hy-2*Fo,h=[],m=(M,_,$,U)=>{const Y=$[0]>0?d-M:$[0]<0?M-o:$[1]>0?f-_:_-c;for(let W=Math.min(60+e()*150,Y);W>=40;W/=2){const J=Math.round(M+$[0]*W),P=Math.round(_+$[1]*W),K=e6(M,_,J,P);if(h.every((D,O)=>U.has(O)||!JA(K,D)))return h.push(K),[J,P]}return null},g=(M,_,$)=>($-M)*(.35+e()*.3)>M-_?1:-1,y=(M,_,$,U,Y,W,J)=>{let[P,K]=[M,_],D=$;const O=[`M${Math.round(P)},${Math.round(K)}`],te=[];for(let F=0;F<U;F+=1){const L=F===0?J:new Set([h.length-1]),ae=m(P,K,D,L);if(!ae)break;[P,K]=ae,O.push(`L${P},${K}`),te.push([P,K]),D=D[0]!==0?[0,g(K,c,f)]:[g(P,o,d),0]}return te.length>=2&&a.push({d:O.join(" "),end:te[te.length-1],dur:Y,delay:W}),te},b=.15+e()*.7,w=i==="left"?0:i==="right"?rh:Math.round(o+(d-o)*b),N=i==="top"?0:i==="bottom"?lh:Math.round(c+(f-c)*b),A=i==="left"?[1,0]:i==="right"?[-1,0]:i==="top"?[0,1]:[0,-1],j=12+e()*8,T=e()*3.2,I=y(w,N,A,3+Math.floor(e()*3),j,T,new Set);if(r%2===0&&I.length>=3){const[M,_]=I[1],[$,U]=I[2],Y=[-Math.sign($-M),-Math.sign(U-_)];y(M,_,Y,2,j,T+1.4,new Set([1,2]))}}return a}const a6=n6();function r6(){return s.jsx("svg",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 h-full w-full text-slate-500/25 dark:text-cyan-300/15",viewBox:`0 0 ${rh} ${lh}`,preserveAspectRatio:"xMidYMid slice",fill:"none",children:a6.map((e,a)=>s.jsxs("g",{style:{"--trace-dur":`${e.dur.toFixed(1)}s`},children:[s.jsx("path",{d:e.d,pathLength:1,stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round",className:"login-trace",style:{animationDelay:`${e.delay.toFixed(1)}s`}}),s.jsx("circle",{cx:e.end[0],cy:e.end[1],r:"3",fill:"currentColor",className:"login-via",style:{animationDelay:`${e.delay.toFixed(1)}s`}})]},a))})}function l6(){sa(v.auth.login);const{login:e}=qn(),{mode:a,setMode:r}=Gr(),{lang:i,setLang:o}=ia(),c=Jn(),[d,f]=k.useState(""),[h,m]=k.useState(""),[g,y]=k.useState(null),[b,w]=k.useState(!1),N=async()=>{if(!d.trim()||!h){y(v.common.requiredField);return}w(!0),y(null);try{await e(d.trim(),h),c("/chat",{replace:!0})}catch(T){y(T instanceof Ie?T.message:v.common.unknownError)}finally{w(!1)}},A=[{value:"light",label:v.settings.themeLight},{value:"dark",label:v.settings.themeDark},{value:"system",label:v.settings.followSystem}],j=[{value:"en",label:v.settings.langEn},{value:"zh",label:v.settings.langZh},{value:"system",label:v.settings.followSystem}];return s.jsxs("div",{className:"relative flex min-h-full items-center justify-center overflow-hidden p-4",children:[s.jsx(r6,{}),s.jsxs("div",{className:"absolute right-4 top-4 flex flex-col items-end gap-1.5 sm:flex-row sm:items-center sm:gap-2",children:[s.jsx("div",{"aria-label":v.settings.language,children:s.jsx(Ur,{options:j,value:i,onChange:o})}),s.jsx("div",{"aria-label":v.settings.theme,children:s.jsx(Ur,{options:A,value:a,onChange:r})})]}),s.jsxs("div",{className:"anim-rise relative w-full max-w-sm",children:[s.jsx(gb,{className:"mx-auto mb-3 h-16 w-16 rounded-2xl"}),s.jsx("h1",{className:"mb-6 text-center text-3xl font-semibold tracking-tight",children:v.appName}),s.jsxs("div",{className:"rounded-xl border border-gray-200 bg-white p-6 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[s.jsxs("form",{className:"space-y-4",onSubmit:T=>{T.preventDefault(),N()},children:[s.jsx(qe,{label:v.auth.username,value:d,onChange:T=>f(T.target.value),autoComplete:"username",autoFocus:!0}),s.jsx(qr,{label:v.auth.password,value:h,onChange:T=>m(T.target.value),autoComplete:"current-password"}),g&&s.jsx("p",{className:"rounded-md border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-700 dark:border-red-900 dark:bg-red-950/50 dark:text-red-300",children:g}),s.jsx(pe,{type:"submit",variant:"primary",className:"w-full justify-center py-2.5 text-sm font-semibold",disabled:b,children:v.auth.login})]}),s.jsx("p",{className:"mt-4 text-center text-xs text-gray-400 dark:text-gray-500",children:v.auth.defaultAdminNote})]})]})]})}const Gi=100,sr=30,Un=2;function i6({data:e,label:a,className:r=""}){const i=Math.max(1,...e),o=e.length>1?(Gi-2*Un)/(e.length-1):0,c=e.map((m,g)=>[Un+g*o,sr-Un-m/i*(sr-2*Un)]),d=`${Un},${sr-Un} ${Gi-Un},${sr-Un}`,f=c.length>1?c.map(([m,g])=>`${m},${g}`).join(" "):d,h=c.length>1?`${f} ${Gi-Un},${sr-Un} ${Un},${sr-Un}`:null;return s.jsxs("svg",{width:Gi,height:sr,viewBox:`0 0 ${Gi} ${sr}`,role:"img","aria-label":a,className:`text-emerald-600 dark:text-emerald-500 ${r}`,children:[s.jsx("title",{children:a}),h!==null&&s.jsx("polygon",{points:h,fill:"currentColor",fillOpacity:"0.12"}),s.jsx("polyline",{points:f,fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}const s6=new Set(["default_agent"]),Ea={newChat:"M12 5v14M5 12h14",settings:"M10.3 4.3a2 2 0 0 1 3.4 0l.5.8a2 2 0 0 0 1.8 1l1-.1a2 2 0 0 1 1.7 3l-.5.8a2 2 0 0 0 0 2l.5.8a2 2 0 0 1-1.7 3l-1-.1a2 2 0 0 0-1.8 1l-.5.8a2 2 0 0 1-3.4 0l-.5-.8a2 2 0 0 0-1.8-1l-1 .1a2 2 0 0 1-1.7-3l.5-.8a2 2 0 0 0 0-2l-.5-.8a2 2 0 0 1 1.7-3l1 .1a2 2 0 0 0 1.8-1zM12 10a2 2 0 1 0 0 4 2 2 0 0 0 0-4z",trash:"M4 7h16M9 7V5a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2m3 0l-1 13a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2L6 7m4 4v6m4-6v6",sessions:"M8 10h8M8 14h5M21 12a9 9 0 1 1-4-7.5",vaultKeys:"M15.5 7.5l3 3L22 7l-3-3M21 2l-9.6 9.6M13 15.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z",schedules:"M12 21a7 7 0 1 0 0-14 7 7 0 0 0 0 14zm0-10v3l2 1.5M5 3L2.5 5.5M19 3l2.5 2.5",usage:"M4 20V10m6 10V4m6 16v-7m4 7H2",traces:"M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7-10-7-10-7zM12 9a3 3 0 1 0 0 6 3 3 0 0 0 0-6z"};function o6(){const e=Jn();sa(v.nav.agents);const{locale:a}=ia(),{currentProject:r,agents:i,agentsLoading:o,reloadAgents:c,setCurrentAgentId:d}=Yt(),[f,h]=k.useState(!1),[m,g]=k.useState(""),[y,b]=k.useState(""),[w,N]=k.useState(""),[A,j]=k.useState(null),[T,I]=k.useState(!1),M=()=>{g(""),b(""),N(""),j(null),h(!0)},[_,$]=k.useState(null),[U,Y]=k.useState(null),W=r?.projectId,J=async()=>{if(!W)return;const D=m.trim();if(!D){j(v.common.requiredField);return}if(!bb.test(D)){j(v.agent.idHint);return}I(!0),j(null);try{const O={agentId:D};y.trim()&&(O.name=y.trim()),w.trim()&&(O.description=w.trim());const te=await Lw(W,O);h(!1),await c(),d(te.agent.agentId),e(`/agents/${te.agent.agentId}`)}catch(O){j(O instanceof Ie?O.message:v.common.unknownError)}finally{I(!1)}},P=D=>{d(D),e(`/chat/${Pr}`,{state:{agentId:D}})},K=async()=>{if(!(!W||!_)){I(!0),Y(null);try{await Yw(W,_.agentId),$(null),await c()}catch(D){Y(D instanceof Ie?D.message:v.common.unknownError)}finally{I(!1)}}};return s.jsxs("div",{className:"h-full overflow-y-auto p-4 md:p-6",children:[s.jsxs("div",{className:"mx-auto max-w-5xl",children:[s.jsxs("div",{className:"mb-4 flex items-center justify-between gap-2",children:[s.jsx("h1",{className:"text-xl font-semibold",children:v.agent.listTitle}),s.jsx(pe,{variant:"primary",onClick:M,children:v.agent.create})]}),o?s.jsx("div",{className:"space-y-3",children:Array.from({length:4},(D,O)=>s.jsxs(G1,{className:"flex flex-wrap items-center gap-x-6 gap-y-2 px-5 py-4",children:[s.jsxs("div",{className:"min-w-[14rem] flex-1",children:[s.jsx(ft,{className:"h-[18px] w-40"}),s.jsx(ft,{className:"mt-1.5 h-4 w-2/3"}),s.jsx(ft,{className:"mt-1.5 h-4 w-48"})]}),s.jsx(ft,{className:"hidden h-9 w-40 md:block"}),s.jsx(ft,{className:"h-8 w-52"})]},O))}):i.length===0?s.jsx(fr,{title:v.common.none}):s.jsx("div",{className:"space-y-3",children:i.map(D=>{const O=s6.has(D.agentId);return s.jsxs("div",{className:"flex flex-wrap items-center gap-x-6 gap-y-2 rounded-md border border-gray-200 bg-white px-5 py-4 dark:border-gray-800 dark:bg-gray-900",children:[s.jsxs("div",{className:"min-w-[14rem] flex-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Vr,{id:D.agentId,size:18,className:"shrink-0 rounded"}),s.jsx("span",{className:"min-w-0 truncate text-base font-bold",children:za(D)}),s.jsx("span",{className:"hidden shrink-0 font-mono text-xs text-gray-400 md:inline dark:text-gray-500",children:D.agentId}),s.jsxs(mt,{tone:"gray",children:["v",D.version]}),D.activeSessionCount>0&&s.jsxs(mt,{tone:"brand",children:[v.agent.activeSessions," ",D.activeSessionCount]})]}),s.jsx("p",{className:"mt-1.5 min-h-4 truncate text-xs text-gray-500 dark:text-gray-400",children:D.description??""}),s.jsxs("div",{className:"mt-1.5 flex items-center gap-x-2.5 text-xs text-gray-500 dark:text-gray-400",children:[s.jsxs("span",{className:"inline-flex min-w-[2.25rem] shrink-0 items-center gap-1 tabular-nums",title:v.agent.sessionCount(D.sessionCount),children:[s.jsx(ht,{d:Ea.sessions,size:12}),D.sessionCount]}),s.jsxs("span",{className:"inline-flex min-w-[2.25rem] shrink-0 items-center gap-1 tabular-nums",title:v.agent.toolCount(D.toolCount),children:[s.jsx(ht,{d:Et.toolCalls,size:12}),D.toolCount]}),s.jsxs("span",{className:"inline-flex min-w-[2.25rem] shrink-0 items-center gap-1 tabular-nums",title:v.agent.vaultKeyCount(D.vaultKeyCount),children:[s.jsx(ht,{d:Ea.vaultKeys,size:12}),D.vaultKeyCount]}),s.jsxs("span",{className:"inline-flex min-w-[2.25rem] shrink-0 items-center gap-1 tabular-nums",title:v.agent.scheduleCount(D.scheduleCount),children:[s.jsx(ht,{d:Ea.schedules,size:12}),D.scheduleCount]}),s.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1",title:`${v.agent.updatedAt} ${D.updatedAt?Nn(D.updatedAt):"—"}`,children:[s.jsx(ht,{d:Et.elapsed,size:12}),D.updatedAt?Jj(D.updatedAt,a):"—"]})]})]}),s.jsx(i6,{data:D.sessionActivity,label:v.agent.activity(D.sessionActivity.length||30),className:"hidden shrink-0 md:block"}),s.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[s.jsxs(pe,{size:"sm",variant:"primary",onClick:()=>P(D.agentId),children:[s.jsx(ht,{d:Ea.newChat}),v.chat.newSessionMenu]}),s.jsxs(pe,{size:"sm",onClick:()=>{d(D.agentId),e(`/agents/${D.agentId}`)},children:[s.jsx(ht,{d:Ea.settings,className:"text-gray-600 dark:text-gray-300"}),v.common.settings]}),s.jsx(pe,{size:"icon",title:v.nav.usage,"aria-label":v.nav.usage,onClick:()=>e(`/usage?agentId=${encodeURIComponent(D.agentId)}`),children:s.jsx(ht,{d:Ea.usage,size:15,className:"text-gray-600 dark:text-gray-300"})}),s.jsx(pe,{size:"icon",title:v.nav.traces,"aria-label":v.nav.traces,onClick:()=>e(`/traces?agentId=${encodeURIComponent(D.agentId)}`),children:s.jsx(ht,{d:Ea.traces,size:15,className:"text-gray-600 dark:text-gray-300"})}),O?s.jsx("span",{role:"img",title:v.agent.builtinUndeletable,"aria-label":v.agent.builtinUndeletable,className:"inline-flex cursor-not-allowed items-center justify-center rounded-md border border-transparent p-1.5 text-gray-300 dark:text-gray-600",children:s.jsx(ht,{d:Ea.trash,size:15})}):s.jsx(pe,{size:"icon",variant:"danger",title:v.agent.deleteAgent,"aria-label":v.agent.deleteAgent,onClick:()=>$({agentId:D.agentId,name:za(D)}),children:s.jsx(ht,{d:Ea.trash,size:15})})]})]},D.agentId)})})]}),s.jsx(bt,{open:f,title:v.agent.createTitle,onClose:()=>h(!1),footer:s.jsxs(s.Fragment,{children:[s.jsx(pe,{onClick:()=>h(!1),children:v.common.cancel}),s.jsx(pe,{variant:"primary",disabled:T,onClick:()=>{J()},children:v.common.create})]}),children:s.jsxs("div",{className:"space-y-3",children:[s.jsx(qe,{label:v.agent.id,size:"sm",value:m,onChange:D=>g(D.target.value),hint:v.agent.idHint,autoFocus:!0}),s.jsx(qe,{label:v.agent.name,size:"sm",value:y,onChange:D=>b(D.target.value),hint:v.agent.nameHint}),s.jsx($l,{label:v.agent.description,size:"sm",rows:3,value:w,onChange:D=>N(D.target.value)}),A&&s.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:A})]})}),s.jsxs(bt,{open:_!==null,title:v.agent.deleteAgent,onClose:()=>{$(null),Y(null)},footer:s.jsxs(s.Fragment,{children:[s.jsx(pe,{onClick:()=>{$(null),Y(null)},children:v.common.cancel}),s.jsx(pe,{variant:"danger",disabled:T,onClick:()=>{K()},children:v.common.confirm})]}),children:[s.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:_?v.agent.deleteConfirm(_.name):""}),U&&s.jsx("p",{className:"mt-2 text-xs text-red-600 dark:text-red-400",children:U})]})]})}function u6({items:e,active:a,onChange:r}){return s.jsx("div",{role:"tablist",className:"flex max-w-full gap-1 overflow-x-auto overflow-y-hidden border-b border-gray-200 dark:border-gray-800",children:e.map(i=>s.jsx("button",{type:"button",role:"tab","aria-selected":i.key===a,onClick:()=>r(i.key),className:`-mb-px whitespace-nowrap border-b-2 px-3 py-2 text-sm transition-colors duration-150 ${i.key===a?"border-gray-900 font-semibold text-gray-900 dark:border-gray-100 dark:text-gray-100":"border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-800 dark:text-gray-400 dark:hover:border-gray-700 dark:hover:text-gray-200"}`,children:i.label},i.key))})}const Py=4,qy=16;function c6({open:e,onClose:a,estimatedHeight:r,panelWidth:i}){const o=k.useRef(null),c=k.useRef(null),[d,f]=k.useState(null),h=k.useRef(a);return h.current=a,k.useLayoutEffect(()=>{if(!e||!o.current)return;const m=o.current.getBoundingClientRect(),g=window.innerHeight-m.bottom,y=m.top,b=Math.min(r,window.innerHeight*.7),w=g<b&&y>g,N=i,A=Math.max(qy,Math.min(m.left,window.innerWidth-N-qy));f({topPx:w?void 0:m.bottom+Py,bottomPx:w?window.innerHeight-m.top+Py:void 0,left:A,triggerWidth:m.width})},[e,r,i]),k.useEffect(()=>{if(!e)return;const m=w=>{const N=w.target;o.current?.contains(N)||c.current?.contains(N)||h.current()},g=w=>{w.key==="Escape"&&(w.stopPropagation(),h.current())},y=w=>{c.current?.contains(w.target)||h.current()},b=()=>h.current();return window.addEventListener("mousedown",m),window.addEventListener("keydown",g,!0),window.addEventListener("scroll",y,!0),window.addEventListener("resize",b),()=>{window.removeEventListener("mousedown",m),window.removeEventListener("keydown",g,!0),window.removeEventListener("scroll",y,!0),window.removeEventListener("resize",b)}},[e]),{triggerRef:o,panelRef:c,position:d}}const d6=288;function mm({options:e,value:a,onChange:r,placeholder:i,mono:o,label:c,fullWidth:d,size:f="base","aria-label":h}){const[m,g]=k.useState(!1),{triggerRef:y,panelRef:b,position:w}=c6({open:m,onClose:()=>g(!1),estimatedHeight:e.length*48+16,panelWidth:d6}),N=a!=null?e.find(j=>j.value===a):void 0,A=s.jsxs(s.Fragment,{children:[s.jsxs("button",{ref:y,type:"button","aria-label":h,"aria-haspopup":"listbox","aria-expanded":m,onClick:()=>g(j=>!j),className:"flex items-center gap-2 rounded-md border border-gray-300 bg-white text-gray-900 transition-[border-color,box-shadow] duration-200 hover:border-gray-400 focus:border-gray-500 focus:outline-none focus:ring-2 focus:ring-gray-400/30 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-100 dark:hover:border-gray-600 dark:focus:border-gray-400 dark:focus:ring-gray-500/30 "+Am[f]+(d?" w-full justify-between":""),children:[s.jsx("span",{className:`min-w-0 truncate ${o?"font-mono":""}`,children:N?.triggerLabel??i??"—"}),s.jsx("svg",{viewBox:"0 0 12 12",fill:"none",stroke:"currentColor","aria-hidden":!0,className:"size-3 shrink-0 text-gray-400",children:s.jsx("path",{d:"M3 4.5l3 3 3-3",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),m&&w&&hs.createPortal(s.jsx("div",{ref:b,role:"listbox",style:{position:"fixed",top:w.topPx,bottom:w.bottomPx,left:w.left,minWidth:w.triggerWidth},className:"anim-pop z-[60] max-h-[70vh] w-72 max-w-[calc(100vw-2rem)] overflow-y-auto rounded-md border border-gray-200 bg-white py-1 shadow-lg dark:border-gray-700 dark:bg-gray-900",children:e.map(j=>s.jsxs("button",{type:"button",role:"option","aria-selected":j.value===a,onClick:()=>{r(j.value),g(!1)},className:`block w-full px-3 py-1.5 text-left transition-colors duration-150 hover:bg-gray-100 dark:hover:bg-gray-800 ${j.value===a?"bg-gray-100 dark:bg-gray-800":""}`,children:[s.jsxs("span",{className:"flex items-center justify-between gap-2",children:[s.jsx("span",{className:`text-sm ${j.value===a?"font-medium text-gray-900 dark:text-gray-100":"text-gray-700 dark:text-gray-300"}`,children:j.label}),j.value===a&&s.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",className:"shrink-0 text-gray-500 dark:text-gray-400","aria-hidden":!0,children:s.jsx("path",{d:"M5 12l4 4L19 6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]}),s.jsx("span",{className:"mt-0.5 block text-xs text-gray-500 dark:text-gray-400",children:j.description})]},j.value))}),document.body)]});return c?s.jsxs("label",{className:"block",children:[s.jsx("span",{className:"mb-1 block text-xs font-semibold text-gray-600 dark:text-gray-400",children:c}),A]}):A}const f6=/^[A-Za-z_][A-Za-z0-9_]*$/;function m6({agentId:e}){const{currentProject:a}=Yt(),r=a?.projectId??null,i=a?.role==="owner",[o,c]=k.useState(null),[d,f]=k.useState(null),[h,m]=k.useState(null),[g,y]=k.useState(!1),[b,w]=k.useState(!1),[N,A]=k.useState(""),[j,T]=k.useState(""),[I,M]=k.useState(null),[_,$]=k.useState(null),U=k.useCallback(async()=>{if(!(!r||!e)){c(null),f(null);try{const D=await _w(r,e);c(D.entries)}catch(D){f(D instanceof Ie?D.message:v.common.unknownError)}}},[r,e]);k.useEffect(()=>{U()},[U]);const Y=async D=>{if(!r||!e)return v.common.unknownError;y(!0),m(null);try{const O=await zw(r,e,D);return c(O.entries),m(v.common.saved),null}catch(O){return O instanceof Ie?O.message:v.common.unknownError}finally{y(!1)}},W=D=>(o??[]).filter(O=>O.key!==D).map(O=>({key:O.key})),J=()=>{A(""),T(""),M(null),w(!0)},P=async()=>{const D=N.trim();if(!D){M(v.common.requiredField);return}if(!f6.test(D)){M(v.vault.keyInvalid);return}if(!j){M(v.vault.valueRequired);return}M(null);const O=await Y({entries:[...W(D),{key:D,value:j}]});if(O!==null){M(O);return}w(!1)},K=async()=>{if(_===null)return;f(null);const D=await Y({entries:W(_)});D!==null&&f(D),$(null)};return r?s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:v.vault.desc}),!i&&s.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:v.vault.readOnlyHint})]}),o===null?s.jsx(Wr,{rows:4}):o.length===0?s.jsx("p",{className:"py-2 text-xs text-gray-400 dark:text-gray-500",children:v.vault.empty}):s.jsx("div",{className:"overflow-x-auto overflow-y-clip rounded-md border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900",children:s.jsxs("table",{className:"w-full min-w-[420px] text-left text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-gray-200 bg-gray-50/80 text-xs text-gray-500 dark:border-gray-800 dark:bg-gray-900",children:[s.jsx("th",{className:"px-3 py-2.5",children:v.vault.key}),s.jsx("th",{className:"px-3 py-2.5",children:v.vault.valueMasked}),s.jsx("th",{className:"px-3 py-2.5"})]})}),s.jsx("tbody",{children:o.map(D=>s.jsxs("tr",{className:"border-b border-gray-100 transition-colors duration-150 last:border-b-0 hover:bg-gray-50 dark:border-gray-800/60 dark:hover:bg-gray-800/40",children:[s.jsx("td",{className:"px-3 py-2 font-mono text-xs",children:D.key}),s.jsx("td",{className:"px-3 py-2 font-mono text-xs text-gray-500 dark:text-gray-400",children:D.valueMasked}),s.jsx("td",{className:"px-3 py-2 text-right",children:i&&s.jsx(pe,{size:"sm",variant:"ghost",disabled:g,onClick:()=>$(D.key),children:v.vault.remove})})]},D.key))})]})}),i&&o!==null&&s.jsx(pe,{size:"sm",variant:"primary",disabled:g,onClick:J,children:v.vault.add}),s.jsx(bt,{open:b,title:v.vault.addTitle,onClose:()=>w(!1),footer:s.jsxs(s.Fragment,{children:[s.jsx(pe,{onClick:()=>w(!1),children:v.common.cancel}),s.jsx(pe,{variant:"primary",disabled:g,onClick:()=>{P()},children:v.vault.add})]}),children:s.jsxs("div",{className:"space-y-3",children:[s.jsx(qe,{size:"sm",label:v.vault.key,hint:v.vault.keyHint,value:N,onChange:D=>A(D.target.value),className:"font-mono",placeholder:"OPENAI_API_KEY",autoComplete:"off"}),s.jsx(qr,{size:"sm",label:v.vault.value,value:j,onChange:D=>T(D.target.value),className:"font-mono",autoComplete:"off",onKeyDown:D=>{D.key==="Enter"&&!g&&P()}}),I&&s.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:I})]})}),s.jsx(bt,{open:_!==null,title:v.vault.deleteTitle,onClose:()=>$(null),footer:s.jsxs(s.Fragment,{children:[s.jsx(pe,{onClick:()=>$(null),children:v.common.cancel}),s.jsx(pe,{variant:"danger",disabled:g,onClick:()=>{K()},children:v.common.confirm})]}),children:s.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:_!==null?v.vault.deleteConfirm(_):""})}),d&&s.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:d}),h&&s.jsx("p",{className:"text-xs text-emerald-600 dark:text-emerald-400",children:h})]}):null}function h6(e){const a=[];return k.Children.forEach(e,r=>{if(!k.isValidElement(r)||r.type!=="option")return;const i=r.props;a.push({value:i.value!==void 0?String(i.value):"",label:i.children??"",...i.disabled?{disabled:!0}:{}})}),a}const p6="flex w-full items-center gap-2 rounded-md border border-gray-300 bg-white text-left text-gray-900 transition-[border-color,box-shadow] duration-200 hover:border-gray-400 focus:border-gray-500 focus:outline-none focus:ring-2 focus:ring-gray-400/30 disabled:cursor-not-allowed disabled:opacity-60 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-100 dark:hover:border-gray-600 dark:focus:border-gray-400 dark:focus:ring-gray-500/30";function ds({label:e,hint:a,size:r="base",className:i,children:o,value:c,onChange:d,disabled:f}){const h=h6(o),m=String(c??""),g=h.find(M=>M.value===m),y=k.useRef(null),[b,w]=k.useState(!1),[N,A]=k.useState(null),j=()=>{const M=y.current;if(!M)return;const _=M.getBoundingClientRect(),$=window.innerHeight-_.bottom,U=$<240&&_.top>$;A({left:_.left,top:U?_.top:_.bottom,width:_.width,up:U})};k.useLayoutEffect(()=>{b&&j()},[b]),k.useEffect(()=>{if(!b)return;const M=Y=>{const W=Y.target;y.current?.contains(W)||W.closest?.("[data-select-menu]")||w(!1)},_=Y=>{Y.key==="Escape"&&w(!1)},$=Y=>{const W=Y.target;W instanceof Element&&W.closest("[data-select-menu]")||w(!1)},U=()=>w(!1);return document.addEventListener("mousedown",M),window.addEventListener("keydown",_),window.addEventListener("scroll",$,!0),window.addEventListener("resize",U),()=>{document.removeEventListener("mousedown",M),window.removeEventListener("keydown",_),window.removeEventListener("scroll",$,!0),window.removeEventListener("resize",U)}},[b]);const T=M=>{w(!1),d?.({target:{value:M}}),y.current?.focus()},I=s.jsxs(s.Fragment,{children:[s.jsxs("button",{ref:y,type:"button",disabled:f,"aria-haspopup":"listbox","aria-expanded":b,onClick:()=>w(M=>!M),className:`${p6} ${Am[r]} ${i??""}`,children:[s.jsx("span",{className:"min-w-0 flex-1 truncate",children:g?.label??h[0]?.label??""}),s.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",className:"shrink-0 text-gray-400","aria-hidden":!0,children:s.jsx("path",{d:"M3 4.5l3 3 3-3",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),b&&N&&hs.createPortal(s.jsx("ul",{"data-select-menu":!0,role:"listbox",className:"anim-pop fixed z-[60] max-h-60 overflow-y-auto rounded-md border border-gray-200 bg-white py-1 shadow-lg dark:border-gray-700 dark:bg-gray-900",style:{left:N.left,width:N.width,...N.up?{bottom:window.innerHeight-N.top+4}:{top:N.top+4}},children:h.map((M,_)=>s.jsx("li",{children:s.jsxs("button",{type:"button",role:"option","aria-selected":M.value===m,disabled:M.disabled,onClick:()=>T(M.value),className:`flex w-full items-center px-3 py-1.5 text-left text-sm transition-colors duration-150 disabled:opacity-50 ${M.value===m?"bg-gray-100 font-medium text-gray-900 dark:bg-gray-800 dark:text-gray-100":"text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-800"}`,children:[s.jsx("span",{className:"min-w-0 flex-1 truncate",children:M.label}),M.value===m&&s.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",className:"shrink-0 text-gray-500 dark:text-gray-400","aria-hidden":!0,children:s.jsx("path",{d:"M5 12l4 4L19 6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})},`${M.value}-${_}`))}),document.body)]});return!e&&!a?I:s.jsxs("label",{className:"block",children:[e&&s.jsx("span",{className:"mb-1 block text-xs font-semibold text-gray-600 dark:text-gray-400",children:e}),I,a&&s.jsx("span",{className:"mt-1 block text-xs text-gray-500 dark:text-gray-500",children:a})]})}const g6={active:"green",disabled:"gray",expired:"amber",done:"brand",missed:"amber",invalid:"red"};function Fy(e){if(!e)return"";const a=new Date(e);if(Number.isNaN(a.getTime()))return"";const r=i=>i<10?`0${i}`:`${i}`;return`${a.getFullYear()}-${r(a.getMonth()+1)}-${r(a.getDate())}T${r(a.getHours())}:${r(a.getMinutes())}`}const Ef=e=>JSON.stringify([e.provider??null,e.modelId]),x6=e=>{if(!e)return null;const[a,r]=JSON.parse(e);return a===null?{modelId:r}:{provider:a,modelId:r}},Vy=e=>e.provider===void 0?e.modelId:`${e.modelId} · ${dr(e.provider)?.label??e.provider}`,y6={editing:null,name:"",prompt:"",enabled:!0,startAt:"",endAt:"",period:"",target:"new",sessionId:"",workspace:"",model:null};function v6({agentId:e}){const{currentProject:a}=Yt(),r=a?.projectId??null,i=a?.role==="owner",[o,c]=k.useState(null),[d,f]=k.useState(null),[h,m]=k.useState(null),[g,y]=k.useState(!1),[b,w]=k.useState(null),[N,A]=k.useState(null),[j,T]=k.useState(null),[I,M]=k.useState([]),_=k.useCallback(async()=>{if(!(!r||!e)){c(null),f(null);try{c(await Xw(r,e))}catch(O){f(O instanceof Ie?O.message:v.common.unknownError)}}},[r,e]);k.useEffect(()=>{_()},[_]),k.useEffect(()=>{!r||!i||ku(r).then(O=>M(O.models)).catch(()=>M([]))},[r,i]);const $=O=>w(te=>te===null?te:{...te,...O}),U=O=>{A(null),w(O)},Y=async()=>{if(!r||b===null)return;A(null),m(null);const O=b.editing??b.name.trim();if(!O||!b.prompt.trim()||!b.startAt||b.target==="session"&&!b.sessionId.trim()){A(v.common.requiredField);return}const te={prompt:b.prompt,enabled:b.enabled,startAt:new Date(b.startAt).toISOString(),...b.period.trim()?{period:b.period.trim()}:{},...b.endAt?{endAt:new Date(b.endAt).toISOString()}:{},...b.target==="session"&&b.sessionId.trim()?{sessionId:b.sessionId.trim()}:{},...b.target==="new"&&b.workspace.trim()?{workspace:b.workspace.trim()}:{},...b.target==="new"&&b.model?{modelId:b.model.modelId,...b.model.provider!==void 0?{provider:b.model.provider}:{}}:{}};y(!0);try{b.editing!==null?await vx(r,e,b.editing,te):await Qw(r,e,{name:O,...te}),w(null),m(v.common.saved),await _()}catch(F){A(F instanceof Ie?F.message:v.common.unknownError)}finally{y(!1)}},W=async O=>{if(r){y(!0),f(null),m(null);try{await vx(r,e,O.name,{prompt:O.prompt,enabled:!O.enabled,startAt:O.startAt,...O.period!==void 0?{period:O.period}:{},...O.endAt!==void 0?{endAt:O.endAt}:{},...O.sessionId!==void 0?{sessionId:O.sessionId}:{},...O.workspace!==void 0?{workspace:O.workspace}:{},...O.modelId!==void 0?{modelId:O.modelId}:{},...O.provider!==void 0?{provider:O.provider}:{}}),m(v.common.saved),await _()}catch(te){f(te instanceof Ie?te.message:v.common.unknownError)}finally{y(!1)}}},J=O=>{U({editing:O.name,name:O.name,prompt:O.prompt,enabled:O.enabled,startAt:Fy(O.startAt),endAt:Fy(O.endAt),period:O.period??"",target:O.sessionId?"session":"new",sessionId:O.sessionId??"",workspace:O.workspace??"",model:O.modelId!==void 0?{modelId:O.modelId,...O.provider!==void 0?{provider:O.provider}:{}}:null})},P=async()=>{if(!(!r||j===null)){y(!0),f(null),m(null);try{await Zw(r,e,j),b?.editing===j&&w(null),await _()}catch(O){f(O instanceof Ie?O.message:v.common.unknownError)}finally{y(!1),T(null)}}};if(!r)return null;const K=o?.schedules??[],D=o?.invalidFiles??[];return s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:v.schedule.desc}),!i&&s.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:v.schedule.readOnlyHint})]}),o===null?s.jsx(Wr,{rows:4}):K.length===0?s.jsx("p",{className:"py-2 text-xs text-gray-400 dark:text-gray-500",children:v.schedule.empty}):s.jsx("div",{className:"overflow-x-auto overflow-y-clip rounded-md border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900",children:s.jsxs("table",{className:"w-full min-w-[640px] text-left text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-gray-200 bg-gray-50/80 text-xs text-gray-500 dark:border-gray-800 dark:bg-gray-900",children:[s.jsx("th",{className:"px-3 py-2.5",children:v.schedule.colName}),s.jsx("th",{className:"px-3 py-2.5",children:v.schedule.colStatus}),s.jsx("th",{className:"px-3 py-2.5",children:v.schedule.colPeriod}),s.jsx("th",{className:"px-3 py-2.5",children:v.schedule.colTarget}),s.jsx("th",{className:"px-3 py-2.5",children:v.schedule.colFireTimes}),s.jsx("th",{className:"px-3 py-2.5",children:v.schedule.colQueued}),i&&s.jsx("th",{className:"px-3 py-2.5"})]})}),s.jsx("tbody",{children:K.map(O=>s.jsxs("tr",{className:"border-b border-gray-100 transition-colors duration-150 last:border-b-0 hover:bg-gray-50 dark:border-gray-800/60 dark:hover:bg-gray-800/40",children:[s.jsx("td",{className:"px-3 py-2 font-mono text-xs",children:O.name}),s.jsx("td",{className:"px-3 py-2",children:s.jsx("span",{title:O.invalidReason,children:s.jsx(mt,{tone:g6[O.status],children:v.schedule.statusNames[O.status]??O.status})})}),s.jsx("td",{className:"px-3 py-2 text-xs text-gray-500 dark:text-gray-400",children:O.period!==void 0?s.jsx("span",{className:"font-mono",children:O.period}):v.schedule.once}),s.jsx("td",{className:"max-w-36 truncate px-3 py-2 text-xs text-gray-500 dark:text-gray-400",title:O.sessionId,children:O.sessionId!==void 0?s.jsx("span",{className:"font-mono",children:O.sessionId}):v.schedule.newSession}),s.jsxs("td",{className:"px-3 py-2 text-xs",children:[s.jsx("span",{className:"block text-gray-600 dark:text-gray-300",children:O.nextFireAt?Nn(O.nextFireAt):"—"}),s.jsx("span",{className:"block text-gray-400 dark:text-gray-500",children:O.lastFiredAt?Nn(O.lastFiredAt):"—"})]}),s.jsx("td",{className:"px-3 py-2",children:O.queued&&s.jsx(mt,{tone:"brand",children:v.schedule.queued})}),i&&s.jsxs("td",{className:"whitespace-nowrap px-3 py-2 text-right",children:[s.jsx(pe,{size:"sm",variant:"ghost",disabled:g,onClick:()=>{W(O)},children:O.enabled?v.schedule.disable:v.schedule.enable}),s.jsx(pe,{size:"sm",variant:"ghost",disabled:g,onClick:()=>J(O),children:v.common.edit}),s.jsx(pe,{size:"sm",variant:"ghost",disabled:g,onClick:()=>T(O.name),children:v.common.delete})]})]},O.name))})]})}),D.length>0&&s.jsxs("div",{className:"text-xs text-red-600 dark:text-red-400",children:[s.jsx("p",{className:"font-medium",children:v.schedule.invalidFiles}),s.jsx("ul",{className:"mt-0.5 space-y-0.5 font-mono",children:D.map(O=>s.jsxs("li",{children:[O.name,": ",O.error]},O.name))})]}),i&&o!==null&&s.jsx(pe,{size:"sm",variant:"primary",disabled:g,onClick:()=>U(y6),children:v.schedule.addTitle}),s.jsx(bt,{open:b!==null,title:b?.editing!=null?v.schedule.editTitle(b.editing):v.schedule.addTitle,onClose:()=>w(null),widthClass:"sm:max-w-lg",footer:s.jsxs(s.Fragment,{children:[s.jsx(pe,{onClick:()=>w(null),children:v.common.cancel}),s.jsx(pe,{variant:"primary",disabled:g,onClick:()=>{Y()},children:b?.editing!=null?v.common.save:v.common.create})]}),children:b!==null&&s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:[s.jsx(qe,{size:"sm",label:v.schedule.name,hint:v.schedule.nameHint,value:b.name,disabled:b.editing!==null,onChange:O=>$({name:O.target.value}),className:"font-mono",placeholder:"daily_report",autoComplete:"off"}),s.jsx(qe,{size:"sm",label:v.schedule.period,value:b.period,onChange:O=>$({period:O.target.value}),className:"font-mono",placeholder:v.schedule.periodPlaceholder,autoComplete:"off"}),s.jsx(qe,{size:"sm",label:v.schedule.startAt,type:"datetime-local",value:b.startAt,onChange:O=>$({startAt:O.target.value}),className:"font-mono"}),s.jsx(qe,{size:"sm",label:v.schedule.endAt,type:"datetime-local",value:b.endAt,onChange:O=>$({endAt:O.target.value}),className:"font-mono"}),s.jsxs(ds,{size:"sm",label:v.schedule.target,value:b.target,onChange:O=>$({target:O.target.value}),children:[s.jsx("option",{value:"new",children:v.schedule.targetNew}),s.jsx("option",{value:"session",children:v.schedule.targetSession})]}),b.target==="session"?s.jsx(qe,{size:"sm",label:v.schedule.sessionId,value:b.sessionId,onChange:O=>$({sessionId:O.target.value}),className:"font-mono",autoComplete:"off"}):s.jsxs(s.Fragment,{children:[s.jsxs(ds,{size:"sm",label:v.schedule.model,value:b.model?Ef(b.model):"",onChange:O=>$({model:x6(O.target.value)}),children:[s.jsx("option",{value:"",children:v.schedule.modelDefault}),b.model&&!I.some(O=>O.modelId===b.model.modelId&&O.provider===b.model.provider)&&s.jsx("option",{value:Ef(b.model),children:Vy(b.model)}),I.map(O=>s.jsx("option",{value:Ef({provider:O.provider,modelId:O.modelId}),children:Vy({provider:O.provider,modelId:O.modelId})},`${O.provider}:${O.modelId}`))]}),s.jsx(qe,{size:"sm",label:v.schedule.workspace,value:b.workspace,onChange:O=>$({workspace:O.target.value}),className:"font-mono",autoComplete:"off"})]})]}),s.jsx($l,{label:v.schedule.prompt,size:"sm",rows:4,value:b.prompt,onChange:O=>$({prompt:O.target.value})}),s.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-gray-600 dark:text-gray-300",children:[s.jsx("input",{type:"checkbox",checked:b.enabled,onChange:O=>$({enabled:O.target.checked})}),v.schedule.enabled]}),N&&s.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:N})]})}),s.jsx(bt,{open:j!==null,title:v.schedule.deleteTitle,onClose:()=>T(null),footer:s.jsxs(s.Fragment,{children:[s.jsx(pe,{onClick:()=>T(null),children:v.common.cancel}),s.jsx(pe,{variant:"danger",disabled:g,onClick:()=>{P()},children:v.common.confirm})]}),children:s.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:j!==null?v.schedule.deleteConfirm(j):""})}),d&&s.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:d}),h&&s.jsx("p",{className:"text-xs text-emerald-600 dark:text-emerald-400",children:h})]})}function Yy(e){return e.map(([a,r])=>({value:a,triggerLabel:a||v.agent.defaultValue,label:a||v.agent.defaultValue,description:r}))}function Ki(e){const a=e.trim();if(!a)return;const r=Number(a);return Number.isFinite(r)?r:void 0}function Ir(e){return e===void 0?"":String(e)}function b6(){const e=[{key:"overview",label:v.agent.tabOverview},{key:"prompt",label:v.agent.tabPrompt},{key:"runtime",label:v.agent.tabRuntime},{key:"tools",label:v.agent.tabTools},{key:"vault",label:v.agent.tabVault},{key:"schedules",label:v.agent.tabSchedules}],a=Jn(),i=I1().agentId??"";sa(v.agent.settings);const{currentProject:o,reloadAgents:c}=Yt(),d=o?.projectId??null,[f,h]=k.useState(null),[m,g]=k.useState("overview"),[y,b]=k.useState(null),[w,N]=k.useState(null),A=k.useCallback(()=>{!d||!i||(h(null),b(null),Ow(d,i).then(h).catch(I=>b(I instanceof Ie?I.message:v.common.unknownError)))},[d,i]);k.useEffect(()=>{A()},[A]);const j=k.useCallback(I=>{N(v.agent.importDone(I)),A(),c()},[A,c]),T=k.useCallback(async I=>{if(!(!d||!i)){b(null),N(null);try{const M=await Iw(d,i,I);h(M),N(v.common.saved),(I.config?.name!==void 0||I.config?.description!==void 0)&&c()}catch(M){b(M instanceof Ie?M.message:v.common.unknownError)}}},[d,i,c]);return d?y&&!f?s.jsx("p",{className:"p-6 text-sm text-red-600 dark:text-red-400",children:y}):f?s.jsx("div",{className:"no-scrollbar h-full overflow-y-auto p-4 md:p-6",children:s.jsxs("div",{className:"mx-auto max-w-3xl",children:[s.jsxs(pe,{variant:"ghost",size:"sm",onClick:()=>a("/agents"),className:"-ml-2 mb-3 text-gray-500 dark:text-gray-400",children:[s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[s.jsx("path",{d:"M15 18l-6-6 6-6"}),s.jsx("path",{d:"M9 12h12"})]}),v.agent.backToList]}),s.jsx("h1",{className:"mb-1 text-xl font-semibold",children:f.config.name??i}),s.jsx("p",{className:"mb-4 font-mono text-xs text-gray-400",children:i}),s.jsx(u6,{items:e,active:m,onChange:g}),s.jsxs("div",{className:"py-4",children:[m==="overview"&&s.jsx(k6,{data:f,agentId:i,onSave:T,onImported:j}),m==="prompt"&&s.jsx(w6,{data:f,onSave:T}),m==="runtime"&&s.jsx(S6,{data:f,onSave:T}),m==="tools"&&s.jsx(j6,{data:f,onSave:T}),m==="vault"&&s.jsx(m6,{agentId:i}),m==="schedules"&&s.jsx(v6,{agentId:i})]}),y&&s.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:y}),w&&s.jsx("p",{className:"text-xs text-emerald-600 dark:text-emerald-400",children:w})]})}):s.jsxs("div",{className:"space-y-3 p-6",children:[s.jsx(ft,{className:"h-6 w-64"}),s.jsx(ft,{className:"h-32 w-full"})]}):null}const Gy="inline-flex cursor-pointer items-center justify-center gap-1 rounded-md border border-gray-300 bg-white px-2.5 py-1 text-xs font-medium text-gray-800 transition-colors duration-150 hover:bg-gray-50 focus-within:ring-2 focus-within:ring-gray-400/30 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-200 dark:hover:bg-gray-800";function k6({data:e,agentId:a,onSave:r,onImported:i}){const{currentProject:o}=Yt(),c=o?.projectId??null,d=o?.role==="owner",[f,h]=k.useState(e.config.name??""),[m,g]=k.useState(e.config.description??""),[y,b]=k.useState(!1),[w,N]=k.useState(null),[A,j]=k.useState(null),T=()=>{const _={};f.trim()!==(e.config.name??"")&&(_.name=f.trim()),m.trim()!==(e.config.description??"")&&(_.description=m.trim()),Object.keys(_).length!==0&&r({config:_})},I=async(_,$)=>{if(c){b(!0),N(null);try{const U=await rS(c,a,{dataBase64:_,...$?{confirm:!0}:{}});j(null),i(U.version)}catch(U){U instanceof Ie&&U.status===409&&U.code==="version_conflict"?j(_):(j(null),N(U instanceof Ie?U.message:v.common.unknownError))}finally{b(!1)}}},M=_=>{const $=_.target.files?.[0];if(_.target.value="",!$)return;N(null);const U=new FileReader;U.onload=()=>{const Y=U.result;I(Y.slice(Y.indexOf(",")+1),!1)},U.onerror=()=>N(v.common.unknownError),U.readAsDataURL($)};return s.jsxs("div",{className:"space-y-4",children:[s.jsx(qe,{size:"sm",label:v.agent.name,value:f,onChange:_=>h(_.target.value)}),s.jsx($l,{label:v.agent.description,size:"sm",rows:3,value:m,onChange:_=>g(_.target.value)}),s.jsxs("div",{children:[s.jsx("p",{className:"mb-1 text-xs font-medium text-gray-500",children:v.agent.stateDir}),s.jsx("p",{className:"break-all font-mono text-xs text-gray-500 dark:text-gray-400",children:e.stateDir})]}),s.jsxs("div",{children:[s.jsx("p",{className:"mb-1 text-xs font-medium text-gray-500",children:v.agent.activeSessions}),s.jsx("p",{className:"text-sm",children:e.activeSessionCount})]}),s.jsxs("div",{children:[s.jsx("p",{className:"mb-1 text-xs font-medium text-gray-500",children:v.agent.stateVersion}),s.jsxs("p",{className:"font-mono text-sm",children:["v",e.config.version]})]}),s.jsxs("div",{children:[s.jsx("p",{className:"mb-1 text-xs font-medium text-gray-500",children:v.agent.transferTitle}),s.jsx("p",{className:"mb-2 text-xs text-gray-500 dark:text-gray-400",children:v.agent.transferDesc}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c&&s.jsx("a",{href:aS(c,a),download:!0,className:Gy,children:v.agent.exportSnapshot}),d&&s.jsxs("label",{className:`${Gy} ${y?"pointer-events-none opacity-60":""}`,children:[s.jsx("input",{type:"file",accept:".tar.gz,.tgz",className:"sr-only",disabled:y,onChange:M}),y?v.agent.importing:v.agent.importSnapshot]})]}),w&&s.jsx("p",{className:"mt-1.5 text-xs text-red-600 dark:text-red-400",children:w})]}),s.jsx(pe,{size:"sm",variant:"primary",onClick:T,children:v.common.save}),s.jsx(bt,{open:A!==null,title:v.agent.importConflictTitle,onClose:()=>j(null),footer:s.jsxs(s.Fragment,{children:[s.jsx(pe,{onClick:()=>j(null),children:v.common.cancel}),s.jsx(pe,{variant:"danger",disabled:y,onClick:()=>{A!==null&&I(A,!0)},children:v.common.confirm})]}),children:s.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:v.agent.importConflictBody})})]})}function w6({data:e,onSave:a}){const[r,i]=k.useState(e.agentsMd),[o,c]=k.useState(e.config.systemPrompt),d=k.useRef(null),f=()=>{const m={};r!==e.agentsMd&&(m.agentsMd=r),o!==e.config.systemPrompt&&(m.config={systemPrompt:o}),!(m.agentsMd===void 0&&m.config===void 0)&&a(m)},h=m=>{const g=d.current;if(g&&(g.focus(),document.execCommand?.("insertText",!1,m)))return;const y=g?g.selectionStart:o.length,b=g?g.selectionEnd:o.length;c(o.slice(0,y)+m+o.slice(b)),requestAnimationFrame(()=>{if(!g)return;g.focus();const w=y+m.length;g.setSelectionRange(w,w)})};return s.jsxs("div",{className:"space-y-4",children:[s.jsx($l,{label:v.agent.agentsMd,mono:!0,size:"sm",rows:14,value:r,onChange:m=>i(m.target.value)}),s.jsx($l,{ref:d,label:v.agent.systemPrompt,mono:!0,size:"sm",rows:12,value:o,onChange:m=>c(m.target.value)}),s.jsxs("div",{className:"rounded-md border border-gray-200 bg-gray-50 p-3 dark:border-gray-800 dark:bg-gray-900",children:[s.jsx("p",{className:"mb-2 text-xs font-semibold text-gray-500",children:v.agent.placeholdersTitle}),s.jsx("ul",{className:"space-y-1",children:v.agent.placeholders.map(([m,g])=>s.jsxs("li",{className:"flex items-center gap-3 text-xs",children:[s.jsx("button",{type:"button",onClick:()=>h(m),title:v.agent.insertPlaceholder,className:"shrink-0 rounded border border-gray-200 bg-white px-1.5 py-0.5 font-mono font-semibold text-gray-800 transition-colors duration-150 hover:border-gray-400 hover:bg-gray-100 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-200 dark:hover:border-gray-500 dark:hover:bg-gray-700",children:m}),s.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:g})]},m))})]}),s.jsx(pe,{size:"sm",variant:"primary",onClick:f,children:v.common.save})]})}function S6({data:e,onSave:a}){const r=e.config,[i,o]=k.useState(Ir(r.maxTurns)),[c,d]=k.useState(Ir(r.model?.maxTokens)),[f,h]=k.useState(r.model?.thinkingLevel??""),[m,g]=k.useState(Ir(r.model?.timeoutMs)),[y,b]=k.useState(Ir(r.compaction?.maxContextLength)),[w,N]=k.useState(Ir(r.compaction?.maxSessionTurns)),[A,j]=k.useState(r.compaction?.mode??""),[T,I]=k.useState(r.compaction?.prompt??""),[M,_]=k.useState(null),$=()=>{_(null);const W={},J=Ki(i);if(J!==void 0&&J!==r.maxTurns){if(J<=0&&J!==-1){_(v.agent.maxTurnsInvalid);return}W.maxTurns=J}const P={},K=Ki(c);K!==void 0&&K!==r.model?.maxTokens&&(P.maxTokens=K),f&&f!==(r.model?.thinkingLevel??"")&&(P.thinkingLevel=f);const D=Ki(m);if(D!==void 0&&D!==r.model?.timeoutMs){if(D<=0&&D!==-1){_(v.agent.timeoutInvalid);return}P.timeoutMs=D}Object.keys(P).length>0&&(W.model=P);const O={},te=Ki(y);te!==void 0&&te!==r.compaction?.maxContextLength&&(O.maxContextLength=te);const F=Ki(w);F!==void 0&&F!==r.compaction?.maxSessionTurns&&(O.maxSessionTurns=F),A&&A!==(r.compaction?.mode??"")&&(O.mode=A),T!==(r.compaction?.prompt??"")&&(O.prompt=T),Object.keys(O).length>0&&(W.compaction=O),Object.keys(W).length!==0&&a({config:W})},U=Yy(v.agent.thinkingLevelOptions),Y=Yy(v.agent.compactionModeOptions);return s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"overflow-hidden rounded-md border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900",children:[s.jsx("div",{className:"p-3",children:s.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:[s.jsx(qe,{label:v.agent.maxTurns,size:"sm",value:i,onChange:W=>o(W.target.value),inputMode:"numeric",className:"font-mono"}),s.jsx(qe,{label:v.agent.maxTokens,size:"sm",value:c,onChange:W=>d(W.target.value),inputMode:"numeric",className:"font-mono"}),s.jsx(mm,{label:v.agent.thinkingLevel,fullWidth:!0,size:"sm",value:f,onChange:h,options:U}),s.jsx(qe,{label:v.agent.timeoutMs,hint:v.agent.timeoutMsHint,size:"sm",value:m,onChange:W=>g(W.target.value),inputMode:"numeric",className:"font-mono"})]})}),s.jsx("div",{className:"border-t border-b border-gray-200 bg-gray-50/80 px-3 py-2 text-xs font-semibold text-gray-500 dark:border-gray-800 dark:bg-gray-900",children:v.agent.compaction}),s.jsx("div",{className:"p-3",children:s.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-3",children:[s.jsx(qe,{label:v.agent.maxContextLength,hint:v.agent.maxContextLengthHint,size:"sm",value:y,onChange:W=>b(W.target.value),inputMode:"numeric",className:"font-mono"}),s.jsx(qe,{label:v.agent.maxSessionTurns,hint:v.agent.maxSessionTurnsHint,size:"sm",value:w,onChange:W=>N(W.target.value),inputMode:"numeric",className:"font-mono"}),s.jsx(mm,{label:v.agent.compactionMode,fullWidth:!0,size:"sm",value:A,onChange:j,options:Y})]})}),s.jsx("div",{className:"border-t border-b border-gray-200 bg-gray-50/80 px-3 py-2 text-xs font-semibold text-gray-500 dark:border-gray-800 dark:bg-gray-900",children:v.agent.compactionPrompt}),s.jsx("div",{className:"p-3",children:s.jsx($l,{"aria-label":v.agent.compactionPrompt,mono:!0,size:"sm",rows:4,value:T,onChange:W=>I(W.target.value)})})]}),M&&s.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:M}),s.jsx(pe,{size:"sm",variant:"primary",onClick:$,children:v.common.save})]})}function j6({data:e,onSave:a}){const r=[{value:"r",triggerLabel:"r",label:v.agent.permissionReadLabel,description:v.agent.permissionReadDescription},{value:"rw",triggerLabel:"rw",label:v.agent.permissionReadWriteLabel,description:v.agent.permissionReadWriteDescription}],[i,o]=k.useState(()=>e.config.toolsBuiltin.map(m=>({base:{...m},timeoutMs:Ir(m.timeoutMs),maxOutputLength:Ir(m.maxOutputLength)}))),[c,d]=k.useState(null),f=(m,g)=>{o(y=>y.map((b,w)=>w===m?{...b,...g}:b))},h=()=>{d(null);const m=[];for(const g of i){const y={...g.base};delete y.timeoutMs,delete y.maxOutputLength;const b=g.timeoutMs.trim();if(b){const N=Number(b);if(!Number.isInteger(N)||N<=0&&N!==-1){d(v.agent.toolFieldInvalid(g.base.name,"timeoutMs"));return}y.timeoutMs=N}const w=g.maxOutputLength.trim();if(w){const N=Number(w);if(!Number.isInteger(N)||N<=0&&N!==-1){d(v.agent.toolFieldInvalid(g.base.name,"maxOutputLength"));return}y.maxOutputLength=N}m.push(y)}a({config:{toolsBuiltin:m}})};return s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"overflow-x-auto overflow-y-clip rounded-md border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900",children:s.jsxs("table",{className:"w-full min-w-[520px] text-left text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-gray-200 bg-gray-50/80 text-xs text-gray-500 dark:border-gray-800 dark:bg-gray-900",children:[s.jsx("th",{className:"px-3 py-2",children:v.agent.toolName}),s.jsx("th",{className:"px-3 py-2",children:v.agent.toolPermission}),s.jsx("th",{className:"px-3 py-2",children:v.agent.toolTimeout}),s.jsx("th",{className:"px-3 py-2",children:v.agent.toolMaxOutput})]})}),s.jsx("tbody",{children:i.map((m,g)=>s.jsxs("tr",{className:"border-b border-gray-100 dark:border-gray-800/60",children:[s.jsx("td",{className:"px-3 py-2 font-mono text-xs",children:m.base.name}),s.jsx("td",{className:"px-3 py-2",children:s.jsx(mm,{mono:!0,size:"sm","aria-label":v.agent.toolPermission,placeholder:v.agent.defaultValue,options:r,value:m.base.permission,onChange:y=>f(g,{base:{...m.base,permission:y}})})}),s.jsx("td",{className:"px-3 py-2",children:s.jsx(qe,{size:"sm",value:m.timeoutMs,inputMode:"numeric",className:"font-mono",onChange:y=>f(g,{timeoutMs:y.target.value})})}),s.jsx("td",{className:"px-3 py-2",children:s.jsx(qe,{size:"sm",value:m.maxOutputLength,inputMode:"numeric",className:"font-mono",onChange:y=>f(g,{maxOutputLength:y.target.value})})})]},m.base.name))})]})}),c&&s.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:c}),s.jsxs("div",{children:[s.jsx("p",{className:"mb-1 text-xs font-medium text-gray-500",children:v.agent.mcpServers}),s.jsx("pre",{className:"max-h-64 overflow-auto rounded-md border border-gray-200 bg-gray-50 p-3 text-xs dark:border-gray-800 dark:bg-gray-900",children:JSON.stringify(e.config.mcpServers,null,2)})]}),s.jsx(pe,{size:"sm",variant:"primary",onClick:h,children:v.common.save})]})}const N6="M22 2 11 13M22 2 15 22 11 13 2 9 22 2",C6="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3";function E6(){sa(v.nav.skills);const e=Jn(),{locale:a}=ia(),r=qn().user?.userId??null,{currentProject:i,agents:o,setCurrentAgentId:c}=Yt(),d=i?.projectId??null,[f,h]=k.useState(null),[m,g]=k.useState(null),[y,b]=k.useState(new Map),[w,N]=k.useState(new Set);k.useEffect(()=>{let M=!1;return g(null),Jw().then(_=>{M||h(_.groups)}).catch(_=>{M||g(ur(_))}),()=>{M=!0}},[]);const A=o.map(M=>M.agentId).join(",");k.useEffect(()=>{if(b(new Map),!d||A==="")return;let M=!1;const _=A.split(",");return Promise.all(_.map(async $=>{try{const U=await ym(d,$);return[$,new Set(U.skills.map(Y=>Y.name))]}catch{return[$,new Set]}})).then($=>{M||b(U=>{const Y=new Map($);for(const[W,J]of U)Y.set(W,J);return Y})}),()=>{M=!0}},[d,A]);const j=(M,_,$)=>b(U=>{const Y=new Map(U),W=new Set(Y.get(M)??[]);return $?W.add(_):W.delete(_),Y.set(M,W),Y}),T=async(M,_,$)=>{if(!d)return;j(M,_,$);const U=o.find(W=>W.agentId===M),Y=U?za(U):M;try{if($){const W=await eS(d,M,[_]);b(J=>new Map(J).set(M,new Set(W.skills.map(P=>P.name)))),fu(v.skills.installedToast(_,Y))}else await tS(d,M,_),fu(v.skills.uninstalledToast(_,Y))}catch(W){if(!$&&W instanceof Ie&&W.status===404)return;j(M,_,!$),Xn(ur(W))}},I=M=>{if(r&&d){const _=nu(r,d);ah(_,{...nh(_),agentId:"default_agent",text:v.skills.quickInvokeText(M),skills:[M],handoffAgentId:void 0})}c("default_agent"),e(`/chat/${Pr}`,{state:{agentId:"default_agent"}})};return s.jsx("div",{className:"h-full overflow-y-auto p-4 md:p-6",children:s.jsxs("div",{className:"mx-auto max-w-5xl",children:[s.jsx("h1",{className:"text-xl font-semibold",children:v.skills.pageTitle}),s.jsx("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:v.skills.pageDesc}),m?s.jsxs("div",{className:"mt-6 flex items-center gap-3",children:[s.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:m}),s.jsx(pe,{size:"sm",onClick:()=>window.location.reload(),children:v.common.retry})]}):f===null?s.jsx("div",{className:"mt-6 grid gap-2.5 md:grid-cols-2 xl:grid-cols-3",children:Array.from({length:4},(M,_)=>s.jsxs(G1,{className:"p-4",children:[s.jsx(ft,{className:"h-4 w-32"}),s.jsx(ft,{className:"mt-2 h-4 w-3/4"}),s.jsx(ft,{className:"mt-3 h-6 w-36"})]},_))}):s.jsx("div",{className:"mt-6 space-y-3",children:f.map(M=>{const _=!w.has(M.id);return s.jsxs("section",{className:"overflow-hidden rounded-md border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900",children:[s.jsxs("button",{type:"button","aria-expanded":_,onClick:()=>N($=>{const U=new Set($);return U.has(M.id)?U.delete(M.id):U.add(M.id),U}),className:"flex w-full items-center gap-2.5 bg-gray-50 px-3 py-2.5 text-left transition-colors duration-150 hover:bg-gray-100 dark:bg-gray-900/60 dark:hover:bg-gray-800/60",children:[s.jsx("span",{className:"min-w-0 truncate text-sm font-semibold",children:CM(a,M.title,M.titleZh)}),s.jsx("span",{className:"shrink-0 whitespace-nowrap font-mono text-xs text-gray-400",children:v.skills.skillCount(M.skills.length)}),s.jsx("span",{className:"min-w-0 flex-1"}),s.jsx(Zt,{open:_,className:"text-gray-400"})]}),s.jsx("div",{className:`grid transition-[grid-template-rows] duration-200 ease-out ${_?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,children:s.jsx("div",{className:"overflow-hidden",inert:!_,children:s.jsx("div",{className:`grid gap-2.5 border-t border-gray-200 p-2.5 transition-opacity duration-200 md:grid-cols-2 xl:grid-cols-3 dark:border-gray-800 ${_?"opacity-100":"opacity-0"}`,children:M.skills.map($=>s.jsx(T6,{skill:$,installed:y,onQuickInvoke:I,onToggleInstall:T},$.name))})})})]},M.id)})})]})})}function T6({skill:e,installed:a,onQuickInvoke:r,onToggleInstall:i}){const{locale:o}=ia(),{agents:c}=Yt(),[d,f]=k.useState(!1);let h=0;for(const b of a.values())b.has(e.name)&&(h+=1);const m=zu(o,e),g=e.description,y=[`v${e.version}`,e.updated?e4(e.updated,o):null,v.skills.usedByAgents(h)].filter(b=>b!==null).join(" · ");return s.jsxs("div",{className:"flex h-full flex-col rounded-md border border-gray-200 bg-white p-4 dark:border-gray-800 dark:bg-gray-900",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"flex h-12 w-12 shrink-0 items-center justify-center rounded-lg border border-gray-200 bg-gray-50 text-gray-600 dark:border-gray-700 dark:bg-gray-800/60 dark:text-gray-300",children:s.jsx(fb,{icon:e.icon,size:26})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block truncate font-mono text-[13px] font-semibold",title:e.name,children:e.name}),s.jsx("p",{className:"mt-0.5 truncate text-xs leading-5 text-gray-500 dark:text-gray-400",title:g,children:m})]})]}),s.jsxs("div",{className:"mt-auto flex items-center gap-1.5 pt-3",children:[s.jsx("span",{className:"min-w-0 flex-1 truncate text-[11px] text-gray-400 dark:text-gray-500",title:y,children:y}),s.jsx(pe,{size:"sm",className:"shrink-0 px-1.5","aria-label":`${v.skills.quickInvoke} ${e.name}`,title:v.skills.quickInvoke,onClick:()=>r(e.name),children:s.jsx(ht,{d:N6,size:15})}),s.jsx(pe,{size:"sm",variant:"primary",className:"shrink-0 px-1.5","aria-label":`${v.skills.manageInstall} ${e.name}`,title:v.skills.manageInstall,onClick:()=>f(!0),children:s.jsx(ht,{d:C6,size:15})})]}),d&&s.jsx(bt,{open:!0,title:v.skills.manageInstallTitle(e.name),onClose:()=>f(!1),children:s.jsxs("div",{className:"space-y-0.5",children:[c.length===0&&s.jsx("p",{className:"py-1.5 text-xs text-gray-400",children:v.common.loading}),c.map(b=>s.jsx(M6,{agentId:b.agentId,name:za(b),installed:a.get(b.agentId)?.has(e.name)??!1,onToggle:w=>{i(b.agentId,e.name,w)}},b.agentId))]})})]})}function M6({agentId:e,name:a,installed:r,onToggle:i}){return s.jsxs("div",{className:"flex items-center gap-2 rounded-md px-1.5 py-1.5 transition-colors duration-150 hover:bg-gray-50 dark:hover:bg-gray-800/60",children:[s.jsx(Vr,{id:e,size:22,className:"shrink-0 rounded"}),s.jsx("span",{className:"min-w-0 flex-1 truncate text-sm",title:e,children:a}),r?s.jsxs(pe,{size:"sm",variant:"ghost",className:"group shrink-0","aria-label":`${v.skills.uninstall} ${e}`,onClick:()=>i(!1),children:[s.jsx("span",{className:"group-hover:hidden",children:v.skills.installed}),s.jsx("span",{className:"hidden text-red-600 group-hover:inline dark:text-red-400",children:v.skills.uninstall})]}):s.jsx(pe,{size:"sm",className:"shrink-0","aria-label":`${v.skills.install} ${e}`,onClick:()=>i(!0),children:v.skills.install})]})}const wb={USD:"$",CNY:"¥"};function Ky(e){return Number.isFinite(e)?String(Math.round(e*1e6)/1e6):"0"}function hm(e){return Number.isFinite(e)?String(Math.round(e*1e4)/1e4):"0"}function Tf(e,a){const r=Number(e||"0"),i=a==="CNY"?r*xm:r;return`${wb[a]}${hm(i)}`}function Mf(e,a){const r=e.trim();if(!r)return"";const i=Number(r);return Number.isFinite(i)?hm(a==="CNY"?i*xm:i):r}function Af(e,a){const r=e.trim();if(!r)return"";const i=Number(r);return Number.isFinite(i)?Ky(a==="CNY"?i/xm:i):r}const Wy=128e3;function A6(e){return e.replace(/[^\d]/g,"")}function R6(e){const a=e.replace(/[^\d.]/g,""),r=a.indexOf(".");return r===-1?a:a.slice(0,r+1)+a.slice(r+1).replace(/\./g,"")}function $n(e){return{provider:e.provider,modelId:e.modelId}}function _6(e){const{editing:a,ref:r,action:i,defaultModel:o,visionModel:c}=e,d=a===null,f=!d&&!ot(a,r)?a:null,h=m=>ot(m,f)?r:m;return{defaultModel:i==="setDefault"||d&&!o?r:h(o),visionModel:i==="setVisionModel"?r:h(c)}}function au({text:e}){return s.jsx("span",{className:"mt-1 block text-xs text-red-600 dark:text-red-400",children:e})}function z6(e){return e.original!==null&&th(e.original.provider,e.original.modelId)!==void 0}function D6(e){return!e.clearApiKey&&(!!e.apiKeyInput.trim()||!!e.credential?.apiKeyMasked)}function Xy(e){const a={provider:e.provider,modelId:e.modelId,original:{provider:e.provider,modelId:e.modelId},vision:e.vision!==!1,contextWindow:e.contextWindow!==void 0?String(e.contextWindow):"",clientType:e.clientType??"",cacheRead:e.pricing?String(e.pricing.cacheRead):"",cacheWrite:e.pricing?String(e.pricing.cacheWrite):"",output:e.pricing?String(e.pricing.output):"",baseUrl:e.credential?.baseUrl??"",originalBaseUrl:e.credential?.baseUrl??"",apiKeyInput:"",clearApiKey:!1};return e.displayName!==void 0&&(a.displayName=e.displayName),e.envKey!==void 0&&(a.envKey=e.envKey),e.credential&&(a.credential=e.credential),a}function L6(e){const a={provider:e.provider,modelId:e.modelId};e.original&&!ot(e.original,$n(e))&&(a.renamedFrom=e.original),e.displayName?.trim()&&(a.displayName=e.displayName.trim());const r=Number(e.contextWindow.trim());e.contextWindow.trim()&&Number.isFinite(r)&&(a.contextWindow=r),e.clientType.trim()&&(a.clientType=e.clientType.trim()),e.vision||(a.vision=!1);const i=Number(e.cacheRead.trim()),o=Number(e.cacheWrite.trim()),c=Number(e.output.trim());e.cacheRead.trim()&&e.cacheWrite.trim()&&e.output.trim()&&Number.isFinite(i)&&Number.isFinite(o)&&Number.isFinite(c)&&(a.pricing={cacheRead:i,cacheWrite:o,output:c}),e.apiKeyInput.trim()&&(a.apiKey=e.apiKeyInput.trim()),e.clearApiKey&&(a.clearApiKey=!0);const d=e.baseUrl.trim();return d!==e.originalBaseUrl&&(a.baseUrl=d||null),a}function O6(){sa(v.models.title);const{currentProject:e}=Yt(),a=e?.projectId??null,r=e?.role==="owner",[i,o]=k.useState(null),[c,d]=k.useState(void 0),[f,h]=k.useState(void 0),[m,g]=k.useState(null),[y,b]=k.useState(null),[w,N]=k.useState(""),[A,j]=k.useState(new Set),[T,I]=k.useState(null),[M,_]=k.useState(!1),[$,U]=k.useState(""),[Y,W]=k.useState(null),[J,P]=k.useState(null),[K,D]=k.useState(!1),{currency:O}=Gr(),te=k.useCallback(async()=>{if(a){o(null),P(null);try{const R=await ku(a);o(R.models.map(Xy)),d(R.defaultModel),h(R.visionModel)}catch(R){P(R instanceof Ie?R.message:v.common.unknownError)}}},[a]);k.useEffect(()=>{te()},[te]);const F=async(R,z,B,C)=>{if(!a)return!1;D(!0);const G=B&&R.some(re=>ot($n(re),B)&&re.vision)?B:void 0;try{const re={models:R.map(L6)};z&&(re.defaultModel=z),G&&(re.visionModel=G);const ue=await Aw(a,re);return o(ue.models.map(Xy)),d(ue.defaultModel),h(ue.visionModel),fu(C??v.common.saved),!0}catch(re){return o(R),z!==void 0&&d(z),G!==void 0&&h(G),Xn(re instanceof Ie?re.message:v.common.unknownError),!1}finally{D(!1)}},L=k.useMemo(()=>i?XM(i,w):[],[i,w]),ae=()=>{const R=$.trim();if(!/^[a-z0-9][a-z0-9_-]{0,31}$/.test(R)){W(v.models.groupNameInvalid);return}if(mr.some(z=>z.id===R)||i?.some(z=>z.provider===R)){W(v.models.groupNameExists);return}_(!1),U(""),b(R)},ne=m!==null?i?.find(R=>ot($n(R),m)):void 0;if(!a)return null;const xe=R=>j(z=>{const B=new Set(z);return B.has(R)?B.delete(R):B.add(R),B});return s.jsxs("div",{className:"h-full overflow-y-auto p-4 md:p-6",children:[s.jsxs("div",{className:"mx-auto max-w-5xl",children:[s.jsxs("div",{className:"mb-4 flex flex-wrap items-center justify-between gap-2",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-xl font-semibold",children:v.models.title}),!r&&s.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:v.models.readOnlyHint})]}),s.jsx("div",{className:"flex min-w-0 max-w-full grow items-center gap-2 sm:grow-0",children:s.jsx("div",{className:"min-w-0 flex-1 sm:w-56 sm:flex-none",children:s.jsx(qe,{size:"sm",value:w,onChange:R=>N(R.target.value),placeholder:v.models.searchPlaceholder})})})]}),i===null?s.jsx(Wr,{rows:4}):i.length===0?s.jsx(fr,{title:v.models.empty,action:r&&s.jsx(pe,{onClick:()=>b("custom"),children:v.models.addCustom})}):L.length===0?s.jsx(fr,{title:v.models.noSearchResults}):s.jsxs("div",{className:"space-y-3",children:[L.map(R=>{const z=!A.has(R.provider.id);return s.jsxs("section",{className:"overflow-hidden rounded-md border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900",children:[s.jsxs("div",{className:"flex items-center gap-2 bg-gray-50 pr-2 transition-colors duration-150 hover:bg-gray-100 dark:bg-gray-900/60 dark:hover:bg-gray-800/60",children:[s.jsxs("button",{type:"button","aria-expanded":z,onClick:()=>xe(R.provider.id),className:"flex min-w-0 flex-1 items-center gap-2.5 px-3 py-2.5 text-left",children:[s.jsx(cs,{provider:R.provider.id,className:"h-5 w-5 shrink-0 text-gray-700 dark:text-gray-300"}),s.jsx("span",{className:"min-w-0 truncate text-sm font-semibold",children:R.provider.label}),s.jsx("span",{className:"shrink-0 whitespace-nowrap font-mono text-xs text-gray-400",children:v.models.modelCount(R.rows.length)})]}),r&&s.jsx("span",{className:"shrink-0",children:s.jsx(pe,{size:"sm",variant:"ghost",disabled:K,onClick:()=>b(R.provider.id),children:v.models.addToGroup})}),r&&R.provider.id!=="custom"&&s.jsx("span",{className:"hidden shrink-0 sm:block",children:s.jsx(pe,{size:"sm",variant:"ghost",disabled:K,onClick:()=>I(R.provider.id),children:v.models.groupApiKey})}),R.provider.apiKeyUrl&&s.jsxs("a",{href:R.provider.apiKeyUrl,target:"_blank",rel:"noreferrer noopener",className:"hidden shrink-0 whitespace-nowrap text-xs text-brand-600 underline-offset-2 hover:underline sm:inline dark:text-brand-300",children:[v.models.getApiKey," ↗"]}),s.jsx("button",{type:"button","aria-expanded":z,"aria-label":R.provider.label,onClick:()=>xe(R.provider.id),className:"shrink-0 p-1.5",children:s.jsx(Zt,{open:z,className:"text-gray-400"})})]}),s.jsx("div",{className:`grid transition-[grid-template-rows] duration-200 ease-out ${z?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,children:s.jsx("div",{className:"overflow-hidden",inert:!z,children:s.jsx("div",{className:`grid gap-2 border-t border-gray-200 p-2.5 transition-opacity duration-200 sm:grid-cols-2 lg:grid-cols-3 dark:border-gray-800 ${z?"opacity-100":"opacity-0"}`,children:R.rows.length===0?s.jsx("p",{className:"col-span-full py-1 text-center text-xs text-gray-400 dark:text-gray-500",children:v.models.groupEmptyHint}):R.rows.map(B=>s.jsx(I6,{row:B,currency:O,isDefault:ot($n(B),c),isVisionModel:ot($n(B),f),onOpen:()=>g($n(B))},`${B.provider}:${B.modelId}`))})})})]},R.provider.id)}),r&&w.trim()===""&&s.jsxs("button",{type:"button",onClick:()=>{U(""),W(null),_(!0)},className:"w-full rounded-md border border-dashed border-gray-300 px-3 py-2.5 text-sm text-gray-500 transition-colors hover:border-gray-400 hover:text-gray-700 dark:border-gray-700 dark:text-gray-400 dark:hover:border-gray-600 dark:hover:text-gray-200",children:["+ ",v.models.addGroup]})]}),J&&s.jsx("p",{className:"mt-3 text-xs text-red-600 dark:text-red-400",children:J})]}),i&&T&&s.jsx(H6,{provider:mr.find(R=>R.id===T)??mb(T),count:i.filter(R=>R.provider===T).length,onClose:()=>I(null),onSubmit:R=>{const z=T;I(null);const B=i.filter(G=>G.provider===z);if(B.length===0)return;const C=i.map(G=>G.provider===z?{...G,apiKeyInput:R,clearApiKey:!1}:G);F(C,c,f,v.models.groupKeyApplied(B.length))}}),M&&s.jsxs(bt,{open:!0,title:v.models.addGroupTitle,onClose:()=>_(!1),widthClass:"sm:max-w-sm",footer:s.jsxs(s.Fragment,{children:[s.jsx(pe,{onClick:()=>_(!1),children:v.common.cancel}),s.jsx(pe,{variant:"primary",onClick:ae,children:v.common.confirm})]}),children:[s.jsxs("label",{className:"block",children:[s.jsx(qe,{size:"sm",label:v.models.groupNameLabel,value:$,invalid:!!Y,onChange:R=>{U(R.target.value),W(null)},onKeyDown:R=>{R.key==="Enter"&&ae()},placeholder:v.models.groupNameHint,className:"font-mono",autoFocus:!0}),Y&&s.jsx(au,{text:Y})]}),s.jsx("p",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400",children:v.models.addGroupDesc})]}),i&&(y!==null||ne)&&s.jsx(B6,{projectId:a,row:y!==null?null:ne??null,addProvider:y??"custom",existingRefs:i.map($n),currency:O,canEdit:r,isDefault:ne!==void 0&&ot($n(ne),c),isVisionModel:ne!==void 0&&ot($n(ne),f),onClose:()=>{g(null),b(null)},onSubmit:(R,z)=>{const B=y!==null;if(g(null),b(null),z==="remove"){const re=R.original;F(i.filter(ue=>!ot($n(ue),re)),ot(re,c)?void 0:c,ot(re,f)?void 0:f);return}const C=B?[...i,R]:i.map(re=>ot($n(re),m)?R:re),G=_6({editing:B?null:m,ref:$n(R),action:z,defaultModel:c,visionModel:f});F(C,G.defaultModel,G.visionModel)}})]})}function I6({row:e,currency:a,isDefault:r,isVisionModel:i,onOpen:o}){const c=e.cacheRead||e.cacheWrite||e.output,d=[e.contextWindow?We(Number(e.contextWindow)):null,c?`${Tf(e.cacheRead,a)} / ${Tf(e.cacheWrite,a)} / ${Tf(e.output,a)}`:null,e.credential?.apiKeyMasked&&!e.clearApiKey?e.credential.apiKeyMasked:D6(e)?v.models.keyConfigured:v.models.noKey].filter(f=>f!==null);return s.jsxs("button",{type:"button",onClick:o,className:"flex w-full flex-col gap-0.5 rounded-md border border-gray-200 px-3 py-2.5 text-left transition-colors duration-150 hover:border-gray-300 hover:bg-gray-50 dark:border-gray-800 dark:hover:border-gray-700 dark:hover:bg-gray-800/40",children:[s.jsxs("span",{className:"flex flex-wrap items-center gap-1.5",children:[s.jsx("span",{className:"text-sm font-medium",children:e.displayName??e.modelId}),r&&s.jsx(mt,{tone:"brand",children:v.models.default}),e.vision&&s.jsx(mt,{tone:"green",children:v.models.visionBadge}),i&&s.jsx(mt,{tone:"amber",children:v.models.visionModelBadge})]}),e.displayName!==void 0&&s.jsx("span",{className:"truncate font-mono text-[11px] text-gray-500 dark:text-gray-400",children:e.modelId}),s.jsx("span",{className:"truncate text-[11px] text-gray-400 dark:text-gray-500",children:d.join(" · ")})]})}const U6={save:()=>v.models.confirmSaveTitle,setDefault:()=>v.models.confirmDefaultTitle,setVisionModel:()=>v.models.confirmVisionModelTitle,remove:()=>v.models.confirmDeleteTitle},$6={save:e=>v.models.confirmSave(e),setDefault:e=>v.models.confirmDefault(e),setVisionModel:e=>v.models.confirmVisionModel(e),remove:e=>v.models.confirmDelete(e)};function B6({projectId:e,row:a,addProvider:r,existingRefs:i,currency:o,canEdit:c,isDefault:d,isVisionModel:f,onClose:h,onSubmit:m}){const[g,y]=k.useState(()=>{if(a)return{...a,cacheRead:Mf(a.cacheRead,o),cacheWrite:Mf(a.cacheWrite,o),output:Mf(a.output,o)};const F=dr(r),L=F!==void 0&&F.id!=="custom"&&F.gatewayBaseUrl===void 0;return{provider:r,modelId:"",original:null,vision:!0,contextWindow:"",clientType:L?"":"openai",cacheRead:"",cacheWrite:"",output:"",baseUrl:F?.gatewayBaseUrl??"",originalBaseUrl:"",apiKeyInput:"",clearApiKey:!1}}),[b,w]=k.useState({}),[N,A]=k.useState(!1),[j,T]=k.useState(null),I=a===null,M=a!==null&&z6(a),_=F=>{y(L=>({...L,...F})),w(L=>{const ae={...L};for(const ne of Object.keys(F))delete ae[ne];return ae})},$=async()=>{A(!0);try{const F=g.apiKeyInput.trim(),L=g.baseUrl.trim(),ae={provider:g.provider,modelId:g.modelId.trim(),baseUrl:L||null};F?ae.apiKey=F:g.clearApiKey&&(ae.clearApiKey=!0),g.clientType.trim()&&(ae.clientType=g.clientType.trim());const ne=await Rw(e,ae);ne.ok?fu(v.models.testOk(ne.latencyMs??0)):Xn(v.models.testFailed(ne.message??""))}catch(F){Xn(v.models.testFailed(F instanceof Ie?F.message:v.common.unknownError))}finally{A(!1)}},U=()=>{const F=g.modelId.trim(),L={provider:g.provider,modelId:F},ae=g.baseUrl.trim(),ne={};F?!ot(L,g.original)&&i.some(C=>ot(C,L))&&(ne.modelId=v.models.modelIdExists):ne.modelId=v.common.requiredField;const xe=g.clientType.trim().toLowerCase().includes("openai")||g.provider==="custom"||dr(g.provider)===void 0;!M&&xe&&!ae&&(ne.baseUrl=v.models.baseUrlRequired);const R=[["cacheRead",g.cacheRead.trim()],["cacheWrite",g.cacheWrite.trim()],["output",g.output.trim()]],z=R.filter(([,C])=>C!=="").length;for(const[C,G]of R)G===""&&z>0?ne[C]=v.models.pricingAllOrNone:G!==""&&!Number.isFinite(Number(G))&&(ne[C]=v.models.pricingInvalid);const B=g.contextWindow.trim();return B&&!Number.isFinite(Number(B))&&(ne.contextWindow=v.models.contextWindowInvalid),Object.keys(ne).length>0?(w(ne),null):(w({}),{...g,modelId:F,contextWindow:!M&&!B?String(Wy):g.contextWindow,cacheRead:Af(g.cacheRead,o),cacheWrite:Af(g.cacheWrite,o),output:Af(g.output,o)})},Y=F=>{const L=U();L&&m(L,F)},W=dr(g.provider),J=WM(g.modelId.trim(),g.clientType.trim()||void 0)?.envKey,P=W!==void 0&&W.id!=="custom"&&W.gatewayBaseUrl===void 0,K=I&&P&&!g.clientType.trim()&&g.modelId.trim()!==""&&J===void 0,D=s.jsxs(s.Fragment,{children:[s.jsxs("label",{className:"block",children:[s.jsxs("span",{className:"mb-1 flex items-baseline justify-between gap-2",children:[s.jsx("span",{className:"text-xs font-semibold text-gray-600 dark:text-gray-400",children:v.models.modelId}),W?.modelsUrl&&s.jsxs("a",{href:W.modelsUrl,target:"_blank",rel:"noreferrer noopener",className:"shrink-0 text-xs text-brand-600 underline-offset-2 hover:underline dark:text-brand-300",children:[v.models.getModelIds," ↗"]})]}),s.jsx(qe,{size:"sm",value:g.modelId,disabled:!c,invalid:!!b.modelId,onChange:F=>_({modelId:F.target.value}),className:"font-mono",autoFocus:I,placeholder:v.models.modelIdHint}),b.modelId&&s.jsx(au,{text:b.modelId}),K&&s.jsx("span",{className:"mt-1 block text-xs text-amber-600 dark:text-amber-400",children:v.models.autoRouteNone})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[s.jsx(qe,{size:"sm",label:v.models.displayName,value:g.displayName??"",disabled:!c,onChange:F=>_({displayName:F.target.value}),placeholder:v.models.displayNameHint}),s.jsxs(ds,{size:"sm",label:v.models.providerGroup,value:g.provider,disabled:!c,onChange:F=>_({provider:F.target.value}),children:[mr.map(F=>s.jsx("option",{value:F.id,children:F.label},F.id)),[...new Set(i.map(F=>F.provider).concat(g.provider))].filter(F=>!mr.some(L=>L.id===F)).sort().map(F=>s.jsx("option",{value:F,children:F},F))]})]})]}),O=g.credential?.apiKeyMasked?v.models.apiKeyKeepHint:J?v.models.apiKeyEnvHint(J):v.models.apiKeyKeepHint,te=!g.credential?.apiKeyMasked&&J&&J===W?.envKey?v.models.providerEnvNotes[g.provider]:void 0;return s.jsxs(bt,{open:!0,title:I?P?v.models.addTitleVendor:v.models.addTitle:v.models.editTitle,onClose:h,widthClass:"sm:max-w-lg",footer:s.jsxs(s.Fragment,{children:[s.jsx(pe,{onClick:h,children:v.common.cancel}),c&&s.jsx(pe,{variant:"primary",onClick:()=>{U()&&(I?Y("save"):T("save"))},children:v.common.confirm})]}),children:[s.jsxs("div",{className:"space-y-3",children:[!I&&s.jsxs("div",{className:"flex items-center gap-2.5 rounded-md bg-gray-50 px-3 py-2 dark:bg-gray-800/60",children:[s.jsx(cs,{provider:g.provider,className:"h-6 w-6 shrink-0 text-gray-700 dark:text-gray-300"}),s.jsxs("div",{className:"flex min-w-0 flex-col",children:[s.jsxs("span",{className:"flex flex-wrap items-center gap-1.5 text-sm font-medium",children:[g.displayName??g.modelId,d&&s.jsx(mt,{tone:"brand",children:v.models.default}),g.vision&&s.jsx(mt,{tone:"green",children:v.models.visionBadge}),f&&s.jsx(mt,{tone:"amber",children:v.models.visionModelBadge})]}),g.displayName!==void 0&&s.jsx("span",{className:"truncate font-mono text-xs text-gray-500 dark:text-gray-400",children:g.modelId})]})]}),I&&s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:P?v.models.addAutoRouteHint:v.models.addProtocolHint}),D]}),c&&s.jsx("div",{className:"space-y-1.5",children:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx(pe,{size:"sm",disabled:N||!g.modelId.trim(),onClick:()=>{$()},children:N?v.models.testing:v.models.testConnection}),!I&&!d&&s.jsx(pe,{size:"sm",onClick:()=>T("setDefault"),children:v.models.setDefault}),!I&&g.vision&&!f&&s.jsx(pe,{size:"sm",title:v.models.visionModelHint,onClick:()=>T("setVisionModel"),children:v.models.setVisionModel}),!I&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"min-w-0 flex-1"}),s.jsx(pe,{size:"sm",variant:"danger",onClick:()=>T("remove"),children:v.models.remove})]})]})}),s.jsxs("label",{className:"block",children:[s.jsxs("span",{className:"mb-1 flex items-baseline justify-between gap-2",children:[s.jsx("span",{className:"text-xs font-semibold text-gray-600 dark:text-gray-400",children:v.models.apiKey}),W?.apiKeyUrl&&s.jsxs("a",{href:W.apiKeyUrl,target:"_blank",rel:"noreferrer noopener",className:"shrink-0 text-xs text-brand-600 underline-offset-2 hover:underline dark:text-brand-300",children:[v.models.getApiKey," ↗"]})]}),s.jsx(qe,{size:"sm",type:"password",value:g.apiKeyInput,disabled:!c,onChange:F=>_({apiKeyInput:F.target.value,clearApiKey:!1}),className:"font-mono",autoComplete:"off",autoFocus:!I,placeholder:O})]}),te&&s.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:te}),g.credential?.apiKeyMasked&&!g.apiKeyInput&&s.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-gray-500 dark:text-gray-400",children:[s.jsx("span",{className:"font-mono",children:g.credential.apiKeyMasked}),g.credential.createdAt&&s.jsxs("span",{className:"text-gray-400",children:[v.models.createdAt," ",Nn(g.credential.createdAt)]}),c&&s.jsxs("label",{className:"flex items-center gap-1.5",children:[s.jsx("input",{type:"checkbox",checked:g.clearApiKey,onChange:F=>_({clearApiKey:F.target.checked})}),v.models.clearApiKey]})]}),s.jsx(qe,{size:"sm",label:v.models.baseUrl,value:g.baseUrl,disabled:!c,onChange:F=>_({baseUrl:F.target.value}),className:"font-mono",placeholder:M?v.models.baseUrlHint:"https://…",...b.baseUrl?{error:b.baseUrl}:{}}),s.jsxs("label",{className:"block",children:[s.jsx("span",{className:"mb-1 block text-xs font-semibold text-gray-600 dark:text-gray-400",children:v.models.contextWindow}),s.jsxs("span",{className:"relative block",children:[s.jsx(qe,{size:"sm",value:g.contextWindow,inputMode:"numeric",disabled:!c,invalid:!!b.contextWindow,onChange:F=>_({contextWindow:A6(F.target.value)}),className:"pr-14 font-mono",placeholder:M?v.models.contextWindowHint:v.models.contextWindowDefaultHint(Wy)}),s.jsx("span",{className:"pointer-events-none absolute inset-y-0 right-2 flex items-center text-xs text-gray-400",children:v.models.contextWindowUnit})]}),b.contextWindow&&s.jsx(au,{text:b.contextWindow})]}),s.jsxs("div",{children:[s.jsx("p",{className:"mb-1.5 text-xs font-semibold text-gray-600 dark:text-gray-400",children:v.models.pricing}),s.jsx("div",{className:"grid grid-cols-3 items-start gap-2",children:[["cacheRead",v.models.priceCacheRead,g.cacheRead],["cacheWrite",v.models.priceCacheWrite,g.cacheWrite],["output",v.models.priceOutput,g.output]].map(([F,L,ae])=>s.jsxs("label",{className:"block",children:[s.jsx("span",{className:"mb-1 block text-xs text-gray-500 dark:text-gray-400",children:L}),s.jsxs("span",{className:"relative block",children:[s.jsx("span",{className:"pointer-events-none absolute inset-y-0 left-2 flex items-center text-xs text-gray-400",children:wb[o]}),s.jsx(qe,{size:"sm",value:ae,inputMode:"decimal",disabled:!c,invalid:!!b[F],onChange:ne=>_({[F]:R6(ne.target.value)}),className:"pl-4 pr-11 text-right font-mono"}),s.jsx("span",{className:"pointer-events-none absolute inset-y-0 right-2 flex items-center text-xs text-gray-400",children:v.models.priceUnitShort})]}),b[F]&&s.jsx(au,{text:b[F]})]},F))})]}),!I&&D,!I&&!M&&g.clientType&&g.clientType!=="openai"&&s.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:v.models.clientTypeLocked(g.clientType)}),!M&&s.jsxs("div",{children:[s.jsxs("label",{className:`flex items-center gap-2 text-sm ${c?"cursor-pointer":"cursor-not-allowed"}`,children:[s.jsx("input",{type:"checkbox",checked:g.vision,disabled:!c,onChange:F=>_({vision:F.target.checked}),className:c?"cursor-pointer":"cursor-not-allowed"}),v.models.vision]}),s.jsx("p",{className:"mt-1 text-xs text-gray-400",children:g.vision?v.models.visionOnHint:v.models.visionOffHint})]})]}),j&&s.jsx(bt,{open:!0,title:U6[j](),onClose:()=>T(null),footer:s.jsxs(s.Fragment,{children:[s.jsx(pe,{onClick:()=>T(null),children:v.common.cancel}),s.jsx(pe,{variant:j==="remove"?"danger":"primary",onClick:()=>{const F=j;T(null),Y(F)},children:v.common.confirm})]}),children:s.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300",children:$6[j](g.displayName??g.modelId)})})]})}function H6({provider:e,count:a,onClose:r,onSubmit:i}){const[o,c]=k.useState("");return s.jsx(bt,{open:!0,title:v.models.groupApiKeyTitle(e.label),onClose:r,footer:s.jsxs(s.Fragment,{children:[s.jsx(pe,{onClick:r,children:v.common.cancel}),s.jsx(pe,{variant:"primary",disabled:!o.trim(),onClick:()=>i(o.trim()),children:v.common.confirm})]}),children:s.jsxs("div",{className:"space-y-2",children:[s.jsx(qe,{size:"sm",label:v.models.apiKey,type:"password",value:o,onChange:d=>c(d.target.value),className:"font-mono",autoComplete:"off",autoFocus:!0,placeholder:v.models.apiKeyEnvHint(e.envKey)}),s.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:v.models.groupApiKeyHint(a)}),v.models.providerEnvNotes[e.id]&&s.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:v.models.providerEnvNotes[e.id]}),e.apiKeyUrl&&s.jsxs("a",{href:e.apiKeyUrl,target:"_blank",rel:"noreferrer noopener",className:"inline-block text-xs text-brand-600 underline-offset-2 hover:underline dark:text-brand-300",children:[v.models.getApiKey," ↗"]})]})})}const ru=200,Fr=46,vu=8,as=10,P6=22;function ih(e,a,r){const i=Math.max(0,r-Fr-vu),o=ru-as-P6,c=e>0?i/e:i;return{n:e,max:a,w:r,innerW:i,innerH:o,step:c,x:d=>Fr+c*d+c/2,y:d=>as+o*(1-(a>0?d/a:0))}}function q6(e,a){return a.map((r,i)=>`${i===0?"M":"L"}${e.x(i)},${e.y(r)}`).join(" ")}function F6(e,a){const r=a.length;if(r===0)return"";const i=e.y(0),o=[];for(let c=0;c<r;c++)o.push(`${c===0?"M":"L"}${e.x(c)},${e.y(a[c])}`);return o.push(`L${e.x(r-1)},${i}`),o.push(`L${e.x(0)},${i}`),o.push("Z"),o.join(" ")}function V6(e){return e<=0?[]:e===1?[0]:e===2?[0,1]:[0,Math.floor((e-1)/2),e-1]}const Y6=40;function G6(e,a){if(e<=0)return[];const r=a>0?Math.max(1,Math.ceil(Y6/a)):e,i=[];for(let o=0;o<e;o+=r)i.push(o);return i}function K6(e,a){return a>0?e/a:1}const Rf=25,W6=8;function X6(e,a){const r=Math.max(0,e-Fr-vu),i=2*Rf*a;return i<=r?{barW:Rf,chartW:e,scroll:!1}:{barW:Rf,chartW:Fr+i+vu,scroll:!0}}function Q6(e,a,r){const i=e.length;if(i===0)return[];if(a<=i*r)return e.map(()=>a/i);const o=new Set;for(;;){const c=a-o.size*r,d=e.reduce((m,g,y)=>o.has(y)?m:m+g,0),f=m=>d>0?e[m]/d*c:c/(i-o.size),h=e.findIndex((m,g)=>!o.has(g)&&f(g)<r);if(h<0)return e.map((m,g)=>o.has(g)?r:f(g));o.add(h)}}const Z6=["output","cacheWrite","cacheRead"];function J6(e,a){const r=Z6.map(h=>({key:h,value:a[h]})).filter(h=>h.value>0);if(r.length===0)return[];const i=[];let o=0;for(const h of r){const m=e.y(o);o+=h.value;const g=e.y(o);i.push({y:g,h:m-g})}const c=e.y(0),d=Q6(i.map(h=>h.h),c-e.y(o),W6);let f=c;return r.map((h,m)=>{const g=d[m],y={key:h.key,value:h.value,y:i[m].y,h:i[m].h,hitY:f-g,hitH:g};return f-=g,y})}const Sb=Math.PI*2,bu=e=>Math.round(e*100)/100;function Yo(e,a,r,i){const o=i-Math.PI/2;return[bu(e+r*Math.cos(o)),bu(a+r*Math.sin(o))]}function eR(e,a,r,i,o){if(o-i>=Sb-1e-9){const[g,y]=Yo(e,a,r,0),[b,w]=Yo(e,a,r,Math.PI);return`M${g},${y} A${r},${r} 0 1 1 ${b},${w} A${r},${r} 0 1 1 ${g},${y} Z`}const[c,d]=Yo(e,a,r,i),[f,h]=Yo(e,a,r,o),m=o-i>Math.PI?1:0;return`M${bu(e)},${bu(a)} L${c},${d} A${r},${r} 0 ${m} 1 ${f},${h} Z`}function tR(e,a,r,i){const o=e.reduce((f,h)=>f+Math.max(0,h),0);if(o<=0)return[];const c=[];let d=0;return e.forEach((f,h)=>{if(f<=0)return;const m=f/o,g=d+m*Sb;c.push({index:h,value:f,frac:m,start:d,end:g,path:eR(a,r,i,d,g)}),d=g}),c}const nR=160;function sh(){const e=k.useRef(null),[a,r]=k.useState(0);return k.useLayoutEffect(()=>{const i=e.current;if(!i)return;const o=()=>r(Math.floor(i.getBoundingClientRect().width));o();const c=new ResizeObserver(o);return c.observe(i),()=>c.disconnect()},[]),[e,a]}function oh({geom:e,fmtY:a,dates:r,hover:i,onHover:o,bubble:c,hitLayer:d,labels:f,hoverLine:h=!0,scrollToEnd:m=!1,children:g}){const{x:y,y:b,w,innerH:N,step:A,max:j}=e,T=[0,.25,.5,.75,1].map(_=>j*_),I=f??V6(r.length),M=k.useRef(null);return k.useLayoutEffect(()=>{const _=M.current;!m||!_||(_.scrollLeft=_.scrollWidth-_.clientWidth)},[m,w,r.length]),s.jsxs("div",{ref:M,className:"relative overflow-x-auto",children:[s.jsxs("svg",{viewBox:`0 0 ${w} ${ru}`,width:w,height:ru,className:"text-gray-600 dark:text-gray-400",role:"img",onMouseLeave:()=>o(null),children:[T.map((_,$)=>s.jsxs("g",{children:[s.jsx("line",{x1:Fr,x2:w-vu,y1:b(_),y2:b(_),className:"stroke-gray-200 dark:stroke-gray-800",strokeWidth:1}),s.jsx("text",{x:Fr-6,y:b(_)+3,textAnchor:"end",className:"fill-gray-400 dark:fill-gray-500",fontSize:9,children:a(_)})]},$)),h&&i!==null&&r[i]&&s.jsx("line",{x1:y(i),x2:y(i),y1:as,y2:as+N,className:"stroke-gray-300 dark:stroke-gray-700",strokeWidth:1}),g,I.map(_=>{const $=r[_];return $?s.jsx("text",{x:y(_),y:ru-6,textAnchor:"middle",className:"fill-gray-400 dark:fill-gray-500",fontSize:9,children:$.slice(5)},_):null}),d??r.map((_,$)=>s.jsx("rect",{x:Fr+A*$,y:as,width:A,height:N,fill:"transparent",className:"cursor-crosshair",onMouseEnter:()=>o($)},`hit-${$}`))]}),c&&i!==null&&r[i]&&s.jsx("div",{className:"pointer-events-none absolute top-0 rounded border border-gray-200 bg-white px-2 py-1 text-xs shadow-sm dark:border-gray-700 dark:bg-gray-900",style:{left:`${Math.max(0,Math.min(y(i)-30,w-nR))}px`},children:c(i)})]})}function aR({points:e,currency:a="USD"}){const[r,i]=k.useState(null),[o,c]=sh(),d=e.map(g=>g.cost??0),f=Math.max(1e-9,...d),h=ih(e.length,f,c),m=e.map(g=>g.date);return s.jsx("div",{ref:o,children:c>0&&s.jsx(oh,{geom:h,fmtY:g=>Pn(g,a),dates:m,hover:r,onHover:i,bubble:g=>{const y=e[g];return s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"text-gray-400",children:y.date}),s.jsx("p",{className:"font-mono",children:Pn(y.cost,a)})]})},children:s.jsxs("g",{children:[s.jsx("path",{d:F6(h,d),className:"fill-current",stroke:"none",opacity:r!==null?.06:.1}),s.jsx("path",{d:q6(h,d),fill:"none",stroke:"currentColor",strokeWidth:2,opacity:r!==null?.35:1}),e.map((g,y)=>s.jsx("circle",{cx:h.x(y),cy:h.y(g.cost??0),r:r===y?4:2.5,className:"fill-current",opacity:r!==null&&r!==y?.25:1},g.date))]})})})}const rs={cacheRead:"#7dd3fc",cacheWrite:"#0ea5e9",output:"#0369a1"},Qy=[{fill:"fill-violet-500 dark:fill-violet-400",swatch:"bg-violet-500 dark:bg-violet-400"},{fill:"fill-sky-500 dark:fill-sky-400",swatch:"bg-sky-500 dark:bg-sky-400"},{fill:"fill-amber-500 dark:fill-amber-400",swatch:"bg-amber-500 dark:bg-amber-400"},{fill:"fill-rose-500 dark:fill-rose-400",swatch:"bg-rose-500 dark:bg-rose-400"},{fill:"fill-emerald-500 dark:fill-emerald-400",swatch:"bg-emerald-500 dark:bg-emerald-400"},{fill:"fill-cyan-500 dark:fill-cyan-400",swatch:"bg-cyan-500 dark:bg-cyan-400"},{fill:"fill-fuchsia-500 dark:fill-fuchsia-400",swatch:"bg-fuchsia-500 dark:bg-fuchsia-400"}];function Zy(e){return Qy[e%Qy.length]}const Jy=[{text:"text-violet-500",swatch:"bg-violet-500"},{text:"text-amber-500 dark:text-amber-600",swatch:"bg-amber-500 dark:bg-amber-600"},{text:"text-sky-500 dark:text-sky-600",swatch:"bg-sky-500 dark:bg-sky-600"},{text:"text-rose-500",swatch:"bg-rose-500"}];function jb(e){return Jy[e%Jy.length]}function Lu({text:e}){return s.jsx("p",{className:"py-6 text-center text-xs text-gray-400",children:e??v.usage.empty})}function rR(e){return e==="cacheRead"?v.usage.colCacheRead:e==="cacheWrite"?v.usage.colCacheWrite:v.usage.colOutput}const Nb="opacity-25",Go=160,lR=75;function iR({data:e}){const[a,r]=k.useState(null),i=e.reduce((h,m)=>h+m.requests,0);if(e.length===0||i<=0)return s.jsx(Lu,{});const o=[...e].sort((h,m)=>m.requests-h.requests),c=tR(o.map(h=>h.requests),Go/2,Go/2,lR),d=h=>`${Math.round(h/i*100)}%`,f=h=>a!==null&&a!==h?Nb:"";return s.jsxs("div",{className:"flex items-center gap-3",onMouseLeave:()=>r(null),children:[s.jsx("svg",{viewBox:`0 0 ${Go} ${Go}`,className:"h-40 w-40 shrink-0",role:"img","aria-label":v.usage.chartAgentCalls,children:c.map(h=>{const m=o[h.index];return s.jsx("path",{d:h.path,onMouseEnter:()=>r(h.index),className:`cursor-pointer ${Zy(h.index).fill} transition-opacity duration-150 ${f(h.index)}`,children:s.jsx("title",{children:`${m.agentId} · ${m.requests} ${v.usage.requests} · ${d(m.requests)}`})},m.agentId)})}),s.jsx("ul",{className:"flex max-h-40 min-w-0 flex-1 flex-col gap-1 overflow-y-auto",children:o.map((h,m)=>s.jsxs("li",{onMouseEnter:()=>r(h.requests>0?m:null),title:`${h.agentId} · ${h.requests} ${v.usage.requests} · ${We(h.total)}`,className:`flex cursor-pointer items-center gap-1.5 text-[10px] transition-opacity duration-150 ${f(m)}`,children:[s.jsx("span",{className:`inline-block h-2 w-2 shrink-0 rounded-sm ${Zy(m).swatch}`}),s.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-gray-500 dark:text-gray-400",children:h.agentId}),s.jsx("span",{className:"shrink-0 font-mono tabular-nums text-gray-500 dark:text-gray-400",children:h.requests}),s.jsx("span",{className:"w-8 shrink-0 text-right font-mono tabular-nums text-gray-400 dark:text-gray-500",children:d(h.requests)})]},h.agentId))})]})}function sR({dimmed:e,onEnter:a,title:r,label:i,value:o,children:c}){return s.jsxs("div",{onMouseEnter:a,className:`flex cursor-pointer items-center gap-2 transition-opacity duration-150 ${e?Nb:""}`,title:r,children:[s.jsx("span",{className:"w-24 shrink-0 truncate font-mono text-[10px] text-gray-500 dark:text-gray-400",children:i}),c,s.jsx("span",{className:"w-10 shrink-0 text-right font-mono text-[10px] tabular-nums text-gray-500 dark:text-gray-400",children:o})]})}function oR(e){return th(e.provider,e.modelId)?.displayName??e.modelId}function uR(e){const a=[`${e.completed}/${e.total}`];e.failed>0&&a.push(`failed ${e.failed}`),e.timeout>0&&a.push(`timeout ${e.timeout}`),e.malformed>0&&a.push(`malformed ${e.malformed}`),e.aborted>0&&a.push(`${v.usage.successAborted} ${e.aborted}`);const r=dr(e.provider)?.label??e.provider;return`${e.modelId} · ${r} · ${a.join(" · ")}`}function cR({data:e}){const[a,r]=k.useState(null);return e.length===0?s.jsx(Lu,{}):s.jsx("div",{className:"flex flex-col gap-1.5",onMouseLeave:()=>r(null),children:e.map((i,o)=>{const c=K6(i.completed,i.total),d=Math.round(c*100);return s.jsx(sR,{dimmed:a!==null&&a!==o,onEnter:()=>r(o),title:uR(i),label:oR(i),value:`${d}%`,children:s.jsx("div",{className:"h-3 min-w-0 flex-1 overflow-hidden rounded-sm bg-gray-200 dark:bg-gray-800",children:s.jsx("div",{className:"h-full rounded-sm bg-sky-500 dark:bg-sky-400",style:{width:`${c*100}%`}})})},`${i.provider}:${i.modelId}`)})})}function dR({trend:e,legend:a}){const[r,i]=k.useState(null),[o,c]=sh();if(e.length===0)return s.jsx(Lu,{});const d=e.map(A=>A.cacheRead+A.cacheWrite+A.output),f=Math.max(1,...d),{barW:h,chartW:m,scroll:g}=X6(c,e.length),y=ih(e.length,f,m),b=e.map(A=>A.date),w=e.map(A=>J6(y,A)),N=(A,j)=>r!==null&&!(r.i===A&&r.key===j)||a!=null&&a!==j;return s.jsx("div",{ref:o,children:c>0&&s.jsx(oh,{geom:y,fmtY:A=>We(Math.round(A)),dates:b,hover:r?.i??null,labels:G6(e.length,y.step),hoverLine:!1,scrollToEnd:g,onHover:A=>{A===null&&i(null)},bubble:A=>{const j=e[A],T=r?.key;return T?s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"text-gray-400",children:j.date}),s.jsxs("p",{className:"font-mono",children:[rR(T)," ",We(j[T])]})]}):null},hitLayer:e.map((A,j)=>w[j].map(T=>s.jsx("rect",{x:y.x(j)-h/2,y:T.hitY,width:h,height:T.hitH,fill:"transparent",className:"cursor-pointer",onMouseEnter:()=>i({i:j,key:T.key}),onMouseLeave:()=>i(null)},`hit-${A.date}-${T.key}`))),children:e.map((A,j)=>w[j].map(T=>s.jsx("rect",{x:y.x(j)-h/2,y:T.y,width:h,height:T.h,fill:rs[T.key],className:"transition-opacity duration-150",opacity:N(j,T.key)?.2:1},`${A.date}-${T.key}`)))})})}function fR({active:e,onHover:a}){const r=[["cacheRead",v.usage.colCacheRead],["cacheWrite",v.usage.colCacheWrite],["output",v.usage.colOutput]];return s.jsx("div",{className:"flex flex-wrap gap-x-3 gap-y-1",children:r.map(([i,o])=>s.jsxs("button",{type:"button",onMouseEnter:()=>a?.(i),onMouseLeave:()=>a?.(null),className:`flex items-center gap-1 text-[10px] text-gray-500 transition-opacity duration-150 dark:text-gray-400 ${e!=null&&e!==i?"opacity-30":""}`,children:[s.jsx("span",{className:"inline-block h-2 w-3 rounded-sm",style:{backgroundColor:rs[i]}}),o]},i))})}function mR(e){return e==="unexpected"?v.usage.errorsUnexpected:v.usage.errorsExpected}function hR(e){return e==="unexpected"?"unexpected":"expected"}function Ko({label:e,value:a,alert:r,muted:i}){const o=r?"text-rose-600 dark:text-rose-400":i?"text-gray-500 dark:text-gray-400":"text-gray-900 dark:text-gray-100";return s.jsxs("div",{className:"flex items-baseline gap-1.5",children:[s.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:e}),s.jsx("span",{className:`font-mono text-sm font-semibold tabular-nums ${o}`,children:a})]})}function Wo({children:e,className:a=""}){return s.jsx("th",{className:`py-1.5 pr-2 font-medium ${a}`,children:e})}function pR({errors:e}){const{total:a,unexpected:r,topCode:i,recent:o}=e;return s.jsxs("div",{children:[s.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-6 gap-y-1.5",children:[s.jsx(Ko,{label:v.usage.errorsTotal,value:String(a)}),s.jsx(Ko,{label:v.usage.errorsUnexpected,value:String(r),alert:r>0,muted:r===0}),s.jsx(Ko,{label:v.usage.errorsExpected,value:String(a-r),muted:!0}),i&&s.jsx(Ko,{label:v.usage.errorsTopCode,value:`${i.source} · ${i.code} ×${i.count}`})]}),o.length===0?s.jsx(Lu,{text:v.usage.errorsEmpty}):s.jsx("div",{className:"mt-2.5 max-h-72 overflow-y-auto border-t border-gray-200 dark:border-gray-800",children:s.jsxs("table",{className:"w-full table-fixed text-xs",children:[s.jsx("thead",{className:"sticky top-0 bg-white text-left text-gray-400 dark:bg-gray-900 dark:text-gray-500",children:s.jsxs("tr",{children:[s.jsx(Wo,{className:"w-32",children:v.usage.errorsColTime}),s.jsx(Wo,{className:"w-72",children:v.usage.errorsColCode}),s.jsx(Wo,{className:"w-20",children:v.usage.errorsColKind}),s.jsx(Wo,{children:v.usage.errorsColMessage})]})}),s.jsx("tbody",{children:o.map((c,d)=>{const f=hR(c.kind);return s.jsxs("tr",{className:"border-t border-gray-100 dark:border-gray-800/60",children:[s.jsx("td",{className:"py-1.5 pr-2 font-mono tabular-nums text-gray-400",children:Nn(c.ts)}),s.jsx("td",{className:"py-1.5 pr-2 font-mono text-gray-500 dark:text-gray-400",children:s.jsxs("span",{className:"block truncate",title:`${c.source} · ${c.code}`,children:[c.source," · ",c.code]})}),s.jsx("td",{className:"py-1.5 pr-2",children:s.jsx(mt,{tone:f==="unexpected"?"red":"gray",children:mR(f)})}),s.jsx("td",{className:"py-1.5 text-gray-500 dark:text-gray-400",children:s.jsx("span",{className:"block truncate",title:c.message,children:c.message})})]},`${c.ts}-${d}`)})})]})})]})}function e1(e){const a=r=>r<10?`0${r}`:`${r}`;return`${e.getFullYear()}-${a(e.getMonth()+1)}-${a(e.getDate())}`}function _f({label:e,value:a,muted:r,sup:i}){const o=r?"text-gray-500 dark:text-gray-400":"text-gray-900 dark:text-gray-100";return s.jsxs("div",{className:"flex items-baseline justify-between gap-2",children:[s.jsxs("span",{className:"shrink-0 text-xs text-gray-500 dark:text-gray-400",children:[e,i&&s.jsx("sup",{className:"ml-px",children:"*"})]}),s.jsx("span",{className:`min-w-0 truncate font-mono text-sm font-semibold tabular-nums ${o}`,children:a})]})}function zf({title:e,bucket:a,currency:r}){return s.jsxs("div",{className:"rounded-md border border-gray-200 bg-white p-3 dark:border-gray-800 dark:bg-gray-900",children:[s.jsx("p",{className:"mb-1.5 text-xs font-medium text-gray-500 dark:text-gray-400",children:e}),s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(_f,{label:v.usage.tokens,value:We(a.total)}),s.jsx(_f,{label:v.usage.requests,value:String(a.requests),muted:!0}),s.jsx(_f,{label:v.usage.colCost,value:Pn(a.cost,r),sup:a.hasUncosted})]})]})}function Wi({title:e,extra:a,children:r}){return s.jsxs("div",{className:"rounded-md border border-gray-200 bg-white p-3 dark:border-gray-800 dark:bg-gray-900",children:[s.jsxs("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-x-2 gap-y-1",children:[s.jsx("p",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:e}),a]}),r]})}function gR(){sa(v.usage.title);const{currency:e}=Gr(),{currentProject:a}=Yt(),r=a?.projectId??null,[i]=Mm(),o=i.get("agentId"),[c,d]=k.useState(o??""),[f,h]=k.useState(null);k.useEffect(()=>{d(o??"")},[o]);const[m,g]=k.useState(()=>{const J=new Date;return J.setDate(J.getDate()-29),e1(J)}),[y,b]=k.useState(()=>e1(new Date)),[w,N]=k.useState(null),[A,j]=k.useState(null),[T,I]=k.useState(null),M=k.useCallback(async()=>{if(r){j(null);try{const J=await v1(r,{from:m,to:y,groupBy:"date",...c?{agentId:c}:{},...f?{provider:f.provider,modelId:f.modelId}:{}});N(J)}catch(J){j(J instanceof Ie?J.message:v.common.unknownError)}}},[r,m,y,c,f?.provider,f?.modelId]);if(k.useEffect(()=>{N(null),M()},[M]),!r)return null;const _=w?.models??[],$=f?_.findIndex(J=>J.provider===f.provider&&J.modelId===f.modelId):-1,U=$>=0?String($):"",Y=w?.summary,W=(Y?.today.hasUncosted??!1)||(Y?.last7d.hasUncosted??!1)||(Y?.total.hasUncosted??!1);return s.jsx("div",{className:"h-full overflow-y-auto p-4 md:p-6",children:s.jsxs("div",{className:"mx-auto max-w-5xl space-y-4",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[s.jsx("h1",{className:"text-xl font-semibold",children:v.usage.title}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("div",{className:"w-32",children:s.jsxs(ds,{size:"sm",value:c,onChange:J=>d(J.target.value),children:[s.jsx("option",{value:"",children:v.usage.filterAllAgents}),c&&!(w?.agentIds??[]).includes(c)&&s.jsx("option",{value:c,children:c}),(w?.agentIds??[]).map(J=>s.jsx("option",{value:J,children:J},J))]})}),s.jsx("div",{className:"w-32",children:s.jsxs(ds,{size:"sm",value:U,onChange:J=>{const P=J.target.value;h(P===""?null:_[Number(P)]??null)},children:[s.jsx("option",{value:"",children:v.usage.filterAllModels}),_.map((J,P)=>s.jsx("option",{value:String(P),children:th(J.provider,J.modelId)?.displayName??J.modelId},`${J.provider}:${J.modelId}`))]})}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(qe,{size:"sm",type:"date","aria-label":v.usage.from,value:m,onChange:J=>g(J.target.value)}),s.jsx("span",{className:"shrink-0 text-gray-400","aria-hidden":!0,children:"–"}),s.jsx(qe,{size:"sm",type:"date","aria-label":v.usage.to,value:y,onChange:J=>b(J.target.value)})]})]})]}),w?s.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-3",children:[s.jsx(zf,{title:v.usage.today,bucket:w.summary.today,currency:e}),s.jsx(zf,{title:v.usage.last7d,bucket:w.summary.last7d,currency:e}),s.jsx(zf,{title:v.usage.total,bucket:w.summary.total,currency:e})]}):s.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-3",children:[s.jsx(ft,{className:"h-24"}),s.jsx(ft,{className:"h-24"}),s.jsx(ft,{className:"h-24"})]}),w?s.jsxs("div",{className:"grid grid-cols-1 gap-3 lg:grid-cols-2",children:[s.jsx(Wi,{title:v.usage.chartAgentCalls,children:s.jsx(iR,{data:w.byAgent})}),s.jsx(Wi,{title:v.usage.chartSuccessRate,children:s.jsx(cR,{data:w.success})}),s.jsx(Wi,{title:v.usage.chartTokenTrend,extra:s.jsx(fR,{active:T,onHover:I}),children:s.jsx(dR,{trend:w.trend,legend:T})}),s.jsx(Wi,{title:v.usage.chartCostTrend,children:s.jsx(aR,{points:w.trend,currency:e})})]}):s.jsx(ft,{className:"h-64"}),w&&s.jsx(Wi,{title:v.usage.errors,children:s.jsx(pR,{errors:w.errors})}),W&&s.jsx("p",{className:"text-xs text-gray-400",children:v.usage.uncostedNote}),A&&s.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:A})]})})}function xR({cacheRead:e,cacheWrite:a,output:r,max:i,size:o=44}){const c=e+a+r,d=Math.max(2,Math.round(o*.16)),f=o/2,h=(o-d)/2,m=2*Math.PI*h,g=Math.max(i,c,1),y=i>0?c/i:0,b=y>.95?"text-red-500":y>.8?"text-amber-500":"text-gray-300 dark:text-gray-700",w=[{key:"cacheRead",value:e,color:rs.cacheRead,label:v.usage.colCacheRead},{key:"cacheWrite",value:a,color:rs.cacheWrite,label:v.usage.colCacheWrite},{key:"output",value:r,color:rs.output,label:v.usage.colOutput}],N=`${v.chat.contextUsage} ${We(c)}/${We(i)}`+w.map(j=>` · ${j.label} ${We(j.value)}`).join("");let A=0;return s.jsxs("svg",{width:o,height:o,viewBox:`0 0 ${o} ${o}`,className:`block shrink-0 ${b}`,role:"img","aria-label":N,children:[s.jsx("title",{children:N}),s.jsx("circle",{cx:f,cy:f,r:h,fill:"none",stroke:"currentColor",strokeOpacity:.35,strokeWidth:d}),w.map(j=>{if(j.value<=0)return null;const T=j.value/g*m,I=-(A/g)*m;return A+=j.value,s.jsx("circle",{cx:f,cy:f,r:h,fill:"none",stroke:j.color,strokeWidth:d,strokeDasharray:`${T} ${m}`,strokeDashoffset:I,transform:`rotate(-90 ${f} ${f})`},j.key)})]})}const Wn={thinking:"bg-violet-500 dark:bg-violet-400",text:"bg-sky-500 dark:bg-sky-400",toolgen:"bg-amber-500 dark:bg-amber-400",approvalWait:"bg-rose-400 dark:bg-rose-300",exec:"bg-emerald-500 dark:bg-emerald-400"},uh="sticky left-0 z-10 flex h-4 w-[5.5rem] shrink-0 items-center justify-end bg-white pr-2 dark:bg-gray-950",Cb="truncate font-mono text-[11px]",t1=.25,pm=24,yR=1/pm,Ta=(e,a,r)=>Math.min(r,Math.max(a,e));function vR(e){return e==="thinking"?Wn.thinking:e==="text"?Wn.text:Wn.toolgen}function bR(e){return e==="thinking"?v.traces.kindThinking:e==="text"?v.traces.kindModelReply:v.traces.kindToolGen}function kR(e){return e==="thinking"?"thinking":e==="text"?"text":"toolgen"}function Xi(e){if(e===void 0)return null;const a=Date.parse(e);return Number.isFinite(a)?a:null}function wR(e,a){const r=new Map,i=c=>{let d=r.get(c);return d||(d={segs:[],spans:[]},r.set(c,d)),d};for(const c of e){const d=Xi(c.startTs),f=Xi(c.endTs);d===null||f===null||i(c.taskIndex).segs.push({kind:c.kind,...c.name!==void 0?{name:c.name}:{},ts:c.endTs,startMs:d,endMs:f})}for(const c of a){const d=Xi(c.callTs);d!==null&&i(c.taskIndex).spans.push({name:c.name||c.toolCallId,toolCallId:c.toolCallId,callTs:c.callTs,...c.approvalTs!==void 0?{approvalTsRaw:c.approvalTs}:{},...c.outputTs!==void 0?{outputTsRaw:c.outputTs}:{},callMs:d,approvalMs:Xi(c.approvalTs),outputMs:Xi(c.outputTs),failed:c.stopReason!==void 0&&c.stopReason!=="completed",...c.stopReason!==void 0?{status:c.stopReason}:{},...c.decision!==void 0?{decision:c.decision}:{}})}const o=[];for(const[c,{segs:d,spans:f}]of[...r.entries()].sort((h,m)=>h[0]-m[0])){if(d.length===0&&f.length===0)continue;const h=[...d.map(N=>N.startMs),...f.map(N=>N.callMs)],m=[...d.map(N=>N.endMs),...f.map(N=>N.outputMs??N.approvalMs??N.callMs)],g=Math.min(...h),y=Math.max(...m,...h),b=Math.max(1,y-g);f.sort((N,A)=>N.callMs-A.callMs);const w=[...new Set(f.map(N=>N.name))];o.push({taskIndex:c,segs:d,spans:f,t0:g,total:b,toolNames:w})}return o}function Eb({children:e}){return s.jsx("div",{className:"relative h-4 min-w-0 flex-1 overflow-hidden bg-gray-100 dark:bg-gray-800/60",children:e})}function SR({label:e,children:a}){return s.jsxs("div",{className:"flex items-center",children:[s.jsx("span",{className:`${uh} text-gray-400 dark:text-gray-500`,title:e,children:s.jsx("span",{className:Cb,children:e})}),s.jsx(Eb,{children:a})]})}function jR({total:e}){const a=[0,.25,.5,.75,1];return s.jsxs("div",{className:"flex items-center",children:[s.jsx("span",{className:uh}),s.jsx("div",{className:"relative h-4 min-w-0 flex-1",children:a.map((r,i)=>s.jsx("span",{className:`absolute top-0 font-mono text-[11px] text-gray-400 dark:text-gray-500 ${i===0?"":i===a.length-1?"-translate-x-full":"-translate-x-1/2"}`,style:{left:`${r*100}%`},children:At(r*e)},i))})]})}function NR({segments:e,toolSpans:a,highlight:r,onHighlight:i,onJump:o,hideTaskLabel:c=!1}){const d=k.useMemo(()=>wR(e,a),[e,a]),{firstBarKeyByTs:f,barKeys:h}=k.useMemo(()=>{const B=new Map,C=new Set,G=(re,ue)=>{C.add(ue),B.has(re)||B.set(re,ue)};for(const re of d){re.segs.forEach((ue,ge)=>G(ue.ts,`s-${re.taskIndex}-${ge}`));for(const ue of re.spans)ue.approvalMs!==null&&ue.approvalMs>ue.callMs&&G(ue.approvalTsRaw??ue.callTs,`w-${ue.toolCallId}`),ue.approvalMs===null&&ue.outputMs===null?G(ue.callTs,`p-${ue.toolCallId}`):G(ue.outputTsRaw??ue.callTs,`e-${ue.toolCallId}`)}return{firstBarKeyByTs:B,barKeys:C}},[d]),[m,g]=k.useState(null),[y,b]=k.useState(1),[w,N]=k.useState({left:0,width:1}),A=k.useRef(null),j=k.useRef(null),T=k.useRef(w);T.current=w;const I=k.useRef(y);I.current=y;const M=k.useRef(null),_=k.useRef(null),$=k.useCallback(()=>{const B=A.current;if(!B)return;const C=B.scrollWidth||1;N({left:B.scrollLeft/C,width:Math.min(1,B.clientWidth/C)})},[]);if(k.useLayoutEffect(()=>{const B=A.current;if(B){if(M.current){const C=B.scrollWidth-B.clientWidth;B.scrollLeft=Ta(M.current(B),0,Math.max(0,C)),M.current=null}$()}},[y,d,$]),k.useLayoutEffect(()=>{const B=A.current;if(!B||typeof ResizeObserver>"u")return;const C=new ResizeObserver(()=>$());return C.observe(B),()=>C.disconnect()},[$]),k.useLayoutEffect(()=>()=>_.current?.(),[]),d.length===0)return s.jsx("p",{className:"text-xs text-gray-400",children:v.common.none});const U=r?.ts,Y=r?.key,W=(B,C)=>i?.(C?{ts:C,key:B}:null),J=()=>i?.(null),P=Y??(U!==void 0?f.get(U):void 0),K=P!==void 0&&h.has(P)?P:void 0,D=K!==void 0,O=B=>K===B,te=(B,C)=>m!==null&&!C||D&&!B?"opacity-15":"",F=(B,C,G,re)=>{const ue=Ta((B-G)/re*100,0,100),ge=Ta((C-B)/re*100,0,100-ue);return ue>=100?{left:"100%",width:"0%",marginLeft:"-2px"}:{left:`${ue}%`,width:`${ge}%`}},L=[{key:"thinking",className:Wn.thinking,label:v.traces.kindThinking},{key:"text",className:Wn.text,label:v.traces.kindModelReply},{key:"toolgen",className:Wn.toolgen,label:v.traces.kindToolGen},{key:"approvalWait",className:Wn.approvalWait,label:v.traces.legendApprovalWait},{key:"exec",className:Wn.exec,label:v.traces.legendToolExec}],ae=(B,C)=>{const G=Ta(C,yR,1),re=Ta(1/G,t1,pm),ue=Ta(B,0,1-G);M.current=ge=>ue*ge.scrollWidth,b(re)},ne=B=>{B.preventDefault();const C=j.current,G=A.current;if(!C||!G)return;const re=C.getBoundingClientRect().width||1,ue=B.clientX,ge=G.scrollLeft,we=Math.max(0,G.scrollWidth-G.clientWidth),Ne=Me=>{const Je=(Me.clientX-ue)/re;G.scrollLeft=Ta(ge+Je*G.scrollWidth,0,we),$()},ye=()=>{window.removeEventListener("pointermove",Ne),window.removeEventListener("pointerup",ye),window.removeEventListener("pointercancel",ye),_.current=null};window.addEventListener("pointermove",Ne),window.addEventListener("pointerup",ye),window.addEventListener("pointercancel",ye),_.current=ye},xe=B=>C=>{C.preventDefault(),C.stopPropagation();const G=j.current;if(!G)return;const re=G.getBoundingClientRect(),ue=we=>{const Ne=Ta((we.clientX-re.left)/(re.width||1),0,1),ye=T.current;if(B==="right")ae(ye.left,Ne-ye.left);else{const Me=ye.left+ye.width;ae(Ne,Me-Ne)}},ge=()=>{window.removeEventListener("pointermove",ue),window.removeEventListener("pointerup",ge),window.removeEventListener("pointercancel",ge),_.current=null};window.addEventListener("pointermove",ue),window.addEventListener("pointerup",ge),window.addEventListener("pointercancel",ge),_.current=ge},R=()=>{M.current=()=>0,b(1)},z=B=>{const C=A.current,G=Ta(I.current*B,t1,pm);if(G!==I.current){if(C){const re=C.clientWidth/2,ue=(C.scrollLeft+re)/(C.scrollWidth||1);M.current=ge=>ue*ge.scrollWidth-re}b(G)}};return s.jsxs("div",{className:"space-y-3",children:[s.jsx("div",{ref:A,className:"no-scrollbar overflow-x-auto overflow-y-hidden",children:s.jsx("div",{className:"space-y-4",style:{width:`${y*100}%`},children:d.map(B=>s.jsxs("div",{className:"space-y-1",children:[!c&&s.jsxs("div",{className:"flex items-center gap-2 pl-[5.5rem]",children:[s.jsx("span",{className:"rounded bg-gray-100 px-1.5 py-0.5 text-[11px] font-medium text-gray-500 dark:bg-gray-800 dark:text-gray-400",children:v.traces.task(B.taskIndex+1)}),s.jsx("span",{className:"font-mono text-[11px] text-gray-400",children:At(B.total)})]}),s.jsx(SR,{label:v.traces.laneLLM,children:B.segs.map((C,G)=>{const re=kR(C.kind),ue=m===null||m===re,ge=`s-${B.taskIndex}-${G}`,we=O(ge);return s.jsx("span",{onMouseEnter:()=>W(ge,C.ts),onMouseLeave:J,onClick:()=>o?.(C.ts),title:`${bR(C.kind)}${C.name?` ${C.name}`:""} · ${At(C.endMs-C.startMs)}`,className:`absolute inset-y-0 min-w-[2px] cursor-pointer ${vR(C.kind)} ${te(we,ue)}`,style:F(C.startMs,C.endMs,B.t0,B.total)},G)})}),B.spans.map(C=>{const G=C.approvalMs??C.callMs,re=C.outputMs===null,ue=C.outputMs??B.t0+B.total,ge=C.approvalTsRaw??C.callTs,we=C.outputTsRaw??C.callTs;return s.jsxs("div",{className:"flex items-center",children:[s.jsx("span",{className:`${uh} text-gray-500 dark:text-gray-400`,title:C.name,children:s.jsx("span",{className:Cb,children:C.name})}),s.jsxs(Eb,{children:[C.approvalMs!==null&&C.approvalMs>C.callMs&&s.jsx("span",{onMouseEnter:()=>W(`w-${C.toolCallId}`,ge),onMouseLeave:J,onClick:()=>o?.(ge),title:`${C.name} · ${v.traces.legendApprovalWait}${C.decision?` (${C.decision})`:""} · ${At(C.approvalMs-C.callMs)}`,className:`absolute inset-y-0 min-w-[2px] cursor-pointer ${Wn.approvalWait} ${te(O(`w-${C.toolCallId}`),m===null||m==="approvalWait")}`,style:F(C.callMs,C.approvalMs,B.t0,B.total)}),C.approvalMs===null&&re?(()=>{const Ne=te(O(`p-${C.toolCallId}`),m===null||m==="approvalWait");return s.jsx("span",{onMouseEnter:()=>W(`p-${C.toolCallId}`,C.callTs),onMouseLeave:J,onClick:()=>o?.(C.callTs),title:`${C.name} · ${v.traces.legendApprovalWait} · ${v.traces.inProgress}`,className:`absolute inset-y-0 min-w-[2px] cursor-pointer ${Wn.approvalWait} ${Ne||"animate-pulse"}`,style:F(C.callMs,ue,B.t0,B.total)})})():(()=>{const Ne=te(O(`e-${C.toolCallId}`),m===null||m==="exec"),ye=re&&!Ne;return s.jsx("span",{onMouseEnter:()=>W(`e-${C.toolCallId}`,we),onMouseLeave:J,onClick:()=>o?.(we),title:`${C.name} · ${v.traces.legendToolExec} · ${re?v.traces.inProgress:At(ue-G)}${C.failed?` · ${C.status}`:""}`,className:`absolute inset-y-0 min-w-[2px] cursor-pointer ${Wn.exec} ${C.failed?"ring-1 ring-red-500":""} ${ye?"animate-pulse opacity-70":Ne}`,style:F(G,ue,B.t0,B.total)})})()]})]},C.toolCallId)}),s.jsx(jR,{total:B.total})]},B.taskIndex))})}),s.jsx("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 border-t border-gray-100 pt-2.5 dark:border-gray-800",children:L.map(B=>s.jsxs("button",{type:"button",onMouseEnter:()=>g(B.key),onMouseLeave:()=>g(null),className:`flex items-center gap-1 px-1 font-mono text-[11px] text-gray-500 transition-opacity duration-150 dark:text-gray-400 ${m!==null&&m!==B.key?"opacity-30":""}`,children:[s.jsx("span",{className:`inline-block h-2 w-3 rounded-sm ${B.className}`}),B.label]},B.key))}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"shrink-0 text-[11px] text-gray-400",children:v.traces.zoom}),s.jsx("button",{type:"button","aria-label":v.traces.zoomOut,title:v.traces.zoomOut,onClick:()=>z(1/1.4),className:"flex h-4 w-4 shrink-0 items-center justify-center rounded border border-gray-200 text-gray-500 transition-colors duration-150 hover:bg-gray-100 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-800",children:s.jsx("span",{className:"text-[11px] leading-none",children:"−"})}),s.jsx("div",{ref:j,onDoubleClick:R,title:v.traces.zoomReset,className:"relative h-3 min-w-0 flex-1 rounded bg-gray-100 dark:bg-gray-800",children:s.jsxs("div",{role:"scrollbar","aria-label":v.traces.zoom,onPointerDown:ne,className:"absolute inset-y-0 flex cursor-grab items-center justify-between rounded bg-gray-400/70 active:cursor-grabbing dark:bg-gray-500/70",style:{left:`${w.left*100}%`,width:`${Math.max(w.width*100,3)}%`},children:[s.jsx("span",{onPointerDown:xe("left"),className:"h-full w-1.5 shrink-0 cursor-ew-resize rounded-l bg-gray-500/80 dark:bg-gray-400/80"}),s.jsx("span",{onPointerDown:xe("right"),className:"h-full w-1.5 shrink-0 cursor-ew-resize rounded-r bg-gray-500/80 dark:bg-gray-400/80"})]})}),s.jsx("button",{type:"button","aria-label":v.traces.zoomIn,title:v.traces.zoomIn,onClick:()=>z(1.4),className:"flex h-4 w-4 shrink-0 items-center justify-center rounded border border-gray-200 text-gray-500 transition-colors duration-150 hover:bg-gray-100 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-800",children:s.jsx("span",{className:"text-[11px] leading-none",children:"+"})}),s.jsxs("span",{className:"w-9 shrink-0 text-right font-mono text-[11px] tabular-nums text-gray-400",children:[y.toFixed(2),"×"]})]}),i&&s.jsx("p",{className:"text-[11px] text-gray-400 dark:text-gray-600",children:v.traces.linkHint})]})}function CR(e){return e==="session_meta"?"brand":e==="model_msg"?"gray":"amber"}const ER={text:"M8 10h8M8 14h5M21 12a9 9 0 1 1-4-7.5",thinking:"M9 18h6M10 21h4M12 3a6 6 0 0 0-3 11v2h6v-2a6 6 0 0 0-3-11z",image_url:"M3 5h18v14H3zM3 15l5-5 4 4 3-3 6 6",inline_data:"M3 5h18v14H3zM3 15l5-5 4 4 3-3 6 6",tool_call:"M14.7 6.3a4 4 0 0 0-5 5L4 17v3h3l5.7-5.7a4 4 0 0 0 5-5l-2.5 2.5-2-2 2.5-2.5z",tool_call_output:"M4 6l4 4-4 4M12 18h8",token_usage:"M4 20V10m6 10V4m6 16v-7m4 7H2",request_begin:"M5 12h14M13 6l6 6-6 6",request_end:"M19 12H5M11 6l-6 6 6 6",approval_decision:"M9 12l2 2 4-4M12 3l7 3v6c0 4.5-3 7.5-7 9-4-1.5-7-4.5-7-9V6z",compaction_begin:"M8 3H4v4M16 3h4v4M8 21H4v-4M16 21h4v-4M9 12h6",compaction_end:"M8 3H4v4M16 3h4v4M8 21H4v-4M16 21h4v-4M9 12h6",abort:"M6 6h12v12H6z",subagent:"M12 3v6m0 0l-5 4v8m5-12l5 4v8M4 21h16"},TR="M12 8v5m0 3h.01M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18z";function MR({type:e}){return s.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",className:"shrink-0 text-gray-400 dark:text-gray-500","aria-hidden":!0,children:s.jsx("path",{d:ER[e]??TR})})}function AR(e){const a=e.payload;switch(a.type){case void 0:return"";case"text":return`${String(a.role)}: ${String(a.text??"").slice(0,120)}`;case"thinking":return String(a.thinking??"").slice(0,120);case"image_url":return"[image]";case"inline_data":return`[image] ${String(a.mime_type??"")}`;case"tool_call":return`${String(a.name)} ${String(a.arguments??"").slice(0,100)}`;case"tool_call_output":{const r=String(a.output??"").slice(0,120);return Array.isArray(a.images)&&a.images.length>0?`[image] ${r}`:r}case"token_usage":{const r=a.request,i=a.session;return`request.total=${r?.total??0} session.total=${i?.total??0}`}case"request_end":return`status=${String(a.status)}`;case"approval_decision":return`${String(a.decision)} · ${String(a.tool_call_id)}`;case"compaction_begin":case"compaction_end":return`${String(a.mode)} (${String(a.reason)})${a.status?` · ${String(a.status)}`:""}`;case"abort":return a.reason!=null?String(a.reason):"";case"subagent":return String(a.session_id??"");default:return e.type==="session_meta"?`${String(a.session_id??"")} · ${String(a.model_id??"")}`:""}}function RR(e){const a=e.payload;return a.stop_reason??a.status}const Xo="max-h-72 overflow-auto whitespace-pre-wrap break-words rounded bg-gray-100 px-2.5 py-2 text-xs dark:bg-gray-800/70";function _R({p:e}){const a=e.request??{},r=e.session??{},i=(o,c)=>s.jsxs("tr",{children:[s.jsx("td",{className:"pr-3 text-gray-400",children:o}),s.jsx("td",{className:"pr-3 text-right font-mono",children:We(c.cache_read??0)}),s.jsx("td",{className:"pr-3 text-right font-mono",children:We(c.cache_write??0)}),s.jsx("td",{className:"pr-3 text-right font-mono",children:We(c.output??0)}),s.jsx("td",{className:"text-right font-mono",children:We(c.total??0)})]});return s.jsxs("table",{className:"text-xs",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"text-gray-400",children:[s.jsx("th",{}),s.jsx("th",{className:"pr-3 text-right font-normal",children:"cacheRead"}),s.jsx("th",{className:"pr-3 text-right font-normal",children:"cacheWrite"}),s.jsx("th",{className:"pr-3 text-right font-normal",children:"output"}),s.jsx("th",{className:"text-right font-normal",children:"total"})]})}),s.jsxs("tbody",{children:[i("request",a),i("session",r)]})]})}const n1="cursor-pointer text-xs font-medium text-gray-500 marker:text-gray-400 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-200";function zR({p:e}){const a=[["session_id",String(e.session_id??"")],["model_id",String(e.model_id??"")],["context_window",String(e.model_context_window??"")],["thinking_level",String(e.thinking_level??"")],["agent_state",String(e.agent_state??"")],["workspace",String(e.workspace??"")]],r=String(e.system_prompt??""),i=Array.isArray(e.tools)?e.tools:[];return s.jsxs("div",{className:"space-y-2.5",children:[s.jsx("dl",{className:"grid grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-0.5 text-xs",children:a.map(([o,c])=>s.jsxs(k.Fragment,{children:[s.jsx("dt",{className:"text-gray-400",children:o}),s.jsx("dd",{className:"min-w-0 break-all font-mono text-gray-700 dark:text-gray-300",children:c||"—"})]},o))}),r.trim()&&s.jsxs("details",{children:[s.jsx("summary",{className:n1,children:v.traces.systemPrompt}),s.jsx("div",{className:"md-body mt-1.5 max-h-96 overflow-auto rounded bg-gray-100 px-2.5 py-2 text-sm leading-relaxed text-gray-700 dark:bg-gray-800/70 dark:text-gray-300",children:s.jsx(ys,{remarkPlugins:[vs],children:r})})]}),i.length>0&&s.jsxs("details",{children:[s.jsx("summary",{className:n1,children:v.traces.toolDefs(i.length)}),s.jsx("ul",{className:"mt-1.5 space-y-1",children:i.map((o,c)=>s.jsxs("li",{className:"text-xs",children:[s.jsx("span",{className:"font-mono font-semibold text-gray-700 dark:text-gray-300",children:o.name??"—"}),o.description&&s.jsx("span",{className:"ml-2 text-gray-500 dark:text-gray-400",children:o.description})]},c))})]})]})}function DR({msg:e}){const a=e.payload;if(e.type==="session_meta")return s.jsx(zR,{p:a});switch(a.type){case"text":case"thinking":{const r=String(a.text??a.thinking??"");return r.trim()?s.jsx("div",{className:"md-body text-sm leading-relaxed text-gray-700 dark:text-gray-300",children:s.jsx(ys,{remarkPlugins:[vs],children:r})}):s.jsx("p",{className:"text-xs text-gray-400",children:"—"})}case"image_url":return s.jsx(Hr,{src:String(a.image_url??""),alt:"trace",className:"max-h-48 max-w-full rounded-md"});case"inline_data":return s.jsx(Hr,{src:`data:${String(a.mime_type??"")};base64,${String(a.data??"")}`,alt:"trace",className:"max-h-48 max-w-full rounded-md"});case"tool_call":return s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("p",{className:"font-mono text-xs font-semibold text-gray-700 dark:text-gray-300",children:String(a.name??"")}),s.jsx("pre",{className:Xo,children:String(a.arguments??"")})]});case"tool_call_output":{const r=Array.isArray(a.images)?a.images:[];return r.length===0?s.jsx("pre",{className:Xo,children:String(a.output??"")}):s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("pre",{className:Xo,children:String(a.output??"")}),s.jsx("div",{className:"flex flex-wrap gap-2",children:r.map((i,o)=>s.jsx(Hr,{src:i,alt:"trace",className:"max-h-48 max-w-full rounded-md"},o))})]})}case"token_usage":return s.jsx(_R,{p:a});default:return s.jsx("pre",{className:Xo,children:JSON.stringify(a,null,2)})}}function LR({msg:e,rowKey:a,matched:r,onHighlight:i}){const[o,c]=k.useState(!1),d=e.payload.type??e.type,f=RR(e);return s.jsxs("li",{"data-trace-row":a,children:[s.jsxs("button",{type:"button",onClick:()=>c(h=>!h),onMouseEnter:()=>i?.({ts:e.timestamp,rowKey:a}),onMouseLeave:()=>i?.(null),className:`flex w-full items-center gap-2 px-3 py-1.5 text-left transition-colors duration-150 ${r?"bg-amber-50 dark:bg-amber-950/40":"hover:bg-gray-50 dark:hover:bg-gray-800/50"}`,children:[s.jsx("span",{className:"shrink-0 font-mono text-[11px] text-gray-400",children:t4(e.timestamp)}),s.jsx(MR,{type:d}),s.jsx(mt,{tone:CR(e.type),children:d}),e.origin&&e.origin.length>0&&s.jsx(mt,{tone:"brand",children:"origin"}),s.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-xs text-gray-500 dark:text-gray-400",children:AR(e)})]}),o&&s.jsxs("div",{className:"border-t border-gray-100 bg-gray-50/60 px-3 py-2 dark:border-gray-800 dark:bg-gray-900/40",children:[s.jsx(DR,{msg:e}),f&&s.jsx("div",{className:"mt-1.5 flex justify-end",children:s.jsx(mt,{tone:Hf(f),children:f})})]})]})}const a1=()=>({cacheRead:0,cacheWrite:0,output:0}),OR=2500,r1=(e,a)=>`${e}-${a}`;function Ma({label:e,value:a}){return s.jsxs("div",{className:"flex items-baseline justify-between gap-3 py-0.5",children:[s.jsx("span",{className:"shrink-0 text-[11px] text-gray-400",children:e}),s.jsx("span",{className:"truncate font-mono text-sm font-semibold tabular-nums",children:a})]})}const ch=e=>e.cacheRead+e.cacheWrite,Tb=e=>{const a=ch(e);return a>0?e.cacheRead/a:null},Mb="flex shrink-0 items-center font-mono text-[11px] tabular-nums text-gray-500 dark:text-gray-400";function Qi({icon:e,value:a,label:r}){return s.jsxs("span",{title:r,"aria-label":r,className:`${Mb} gap-1`,children:[s.jsx(ht,{d:e,className:"text-gray-400"}),a]})}function IR({buckets:e}){const a=ch(e),r=`${v.traces.cacheHit} ${We(e.cacheRead)} · ${v.traces.hitRate} ${K1(Tb(e))}`;return s.jsxs("span",{"aria-label":`${v.traces.taskInput} ${We(a)} · ${r}`,className:Mb,children:[s.jsxs("span",{title:v.traces.taskInput,className:"flex items-center gap-1",children:[s.jsx(ht,{d:Et.input,className:"text-gray-400"}),We(a)]}),s.jsxs("span",{title:r,className:"ml-1 flex items-center gap-0.5 text-gray-400",children:[s.jsx("span",{children:"("}),s.jsx(ht,{d:Et.cacheHit}),s.jsx("span",{children:We(e.cacheRead)}),s.jsx("span",{children:")"})]})]})}function UR({projectId:e,agentId:a,sessionId:r,index:i,highlight:o,onHighlight:c}){const{currency:d}=Gr(),[f,h]=k.useState(null),[m,g]=k.useState([]),[y,b]=k.useState(0),[w,N]=k.useState(0),[A,j]=k.useState(null),[T,I]=k.useState(null),[M,_]=k.useState(new Set),[$,U]=k.useState(null),Y=k.useRef(null),W=k.useRef(null);k.useEffect(()=>()=>{W.current&&clearTimeout(W.current)},[]),k.useEffect(()=>{h(null),g([]),I(null),_(new Set),U(null);let z=!1;return Promise.all([Vw(e,a,r,i),Fw(e,a,r,i,0,1e3),ku(e).catch(()=>null)]).then(([B,C,G])=>{z||(h(B),g(C.events),b(C.offset),N(C.total),j(G))}).catch(B=>{z||I(B instanceof Ie?B.message:v.common.unknownError)}),()=>{z=!0}},[e,a,r,i]);const J=k.useMemo(()=>{const z=m.find(C=>C.type==="session_meta"),B=z?z.payload:void 0;if(B?.model_id)return A?.models.find(C=>C.modelId===B.model_id&&(B.provider===void 0||C.provider===B.provider))?.pricing},[m,A]),P=z=>J?(z.cacheRead*J.cacheRead+z.cacheWrite*J.cacheWrite+z.output*J.output)/1e6:null,K=k.useMemo(()=>{const z=m.find(B=>B.type==="session_meta");return db(z?z.payload.model_context_window:void 0)},[m]),{tasks:D,global:O,statsByTask:te,globalLlmMs:F}=k.useMemo(()=>{const z={buckets:a1(),toolCalls:0},B=new Map;if(!f)return{tasks:[],global:z,statsByTask:B,globalLlmMs:0};const C=new Map;for(const ye of f.tasks){const Me=Date.parse(ye.startTs),Je=Date.parse(ye.endTs);Number.isFinite(Me)&&Number.isFinite(Je)&&C.set(ye.taskIndex,{min:Me,max:Je})}const G=new Map,re=ye=>{let Me=G.get(ye);if(!Me){const Je=C.get(ye);Me={taskIndex:ye,segments:[],spans:[],messages:[],toolCalls:0,durationMs:Je?Math.max(0,Je.max-Je.min):0},G.set(ye,Me)}return Me};for(const ye of f.tasks)re(ye.taskIndex);for(const ye of f.modelSegments)re(ye.taskIndex).segments.push(ye);for(const ye of f.toolSpans){const Me=re(ye.taskIndex);Me.spans.push(ye),Me.toolCalls+=1}const ue=ye=>{for(const Me of f.tasks)if(ye>=Me.messageFrom&&ye<=Me.messageTo)return Me.taskIndex;return null};for(let ye=0;ye<m.length;ye++){const Me=m[ye];if(Me.origin&&Me.origin.length>0)continue;const Je=ue(y+ye);Je!==null&&re(Je).messages.push(Me)}z.toolCalls=f.toolSpans.length;const ge=new Map(f.tasks.map(ye=>[ye.taskIndex,ye]));for(const ye of f.tasks)z.buckets.cacheRead+=ye.tokens.cacheRead,z.buckets.cacheWrite+=ye.tokens.cacheWrite,z.buckets.output+=ye.tokens.output;const we=f.tasks.reduce((ye,Me)=>ye+Me.llmMs,0);return{tasks:[...G.values()].sort((ye,Me)=>ye.taskIndex-Me.taskIndex),global:z,statsByTask:ge,globalLlmMs:we}},[f,m,y]);if(T)return s.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:T});if(!f)return s.jsx(ft,{className:"h-40"});const L=f.elapsedMs,ae=z=>_(B=>{const C=new Set(B);return C.has(z)?C.delete(z):C.add(z),C}),ne=z=>{for(const B of D){const C=B.messages.findIndex(G=>G.timestamp===z);if(C>=0)return r1(B.taskIndex,C)}return null},xe=o?.rowKey??(o?.ts!==void 0?ne(o.ts):null),R=z=>{const B=ne(z);B!==null&&(U(B),requestAnimationFrame(()=>{Y.current?.querySelector(`[data-trace-row="${B}"]`)?.scrollIntoView({block:"center",behavior:"smooth"})}),W.current&&clearTimeout(W.current),W.current=setTimeout(()=>U(null),OR))};return s.jsxs("div",{ref:Y,className:"space-y-4",children:[s.jsxs("div",{className:"rounded-md border border-gray-200 p-3 dark:border-gray-800",children:[s.jsx("p",{className:"mb-2 text-xs font-semibold text-gray-500",children:v.traces.globalSummary}),s.jsxs("div",{className:"grid grid-cols-1 gap-x-8 gap-y-4 sm:grid-cols-3",children:[s.jsxs("div",{children:[s.jsx(Ma,{label:v.traces.tasksLabel,value:String(f.tasks.length)}),s.jsx(Ma,{label:v.traces.toolCalls,value:String(O.toolCalls)}),s.jsx(Ma,{label:v.traces.compactions,value:String(f.compactionCount)})]}),s.jsxs("div",{children:[s.jsx(Ma,{label:v.chat.statInput,value:We(ch(O.buckets))}),s.jsx(Ma,{label:v.traces.cacheHit,value:`${We(O.buckets.cacheRead)} · ${K1(Tb(O.buckets))}`}),s.jsx(Ma,{label:v.chat.statOutput,value:We(O.buckets.output)})]}),s.jsxs("div",{children:[s.jsx(Ma,{label:v.chat.statCost,value:Pn(P(O.buckets),d)}),s.jsx(Ma,{label:v.chat.statElapsed,value:At(Math.max(0,L))}),s.jsx(Ma,{label:v.chat.statTps,value:ou(Pf(O.buckets.output,F))})]})]})]}),D.map(z=>{const B=!M.has(z.taskIndex),C=te.get(z.taskIndex),G=C?.context,re=C?.tokens??a1();return s.jsxs("div",{className:"overflow-hidden rounded-md border border-gray-200 dark:border-gray-800",children:[s.jsxs("button",{type:"button",onClick:()=>ae(z.taskIndex),"aria-expanded":B,className:"flex w-full items-center gap-2 bg-gray-50 px-3 py-2 text-left transition-colors duration-150 hover:bg-gray-100 dark:bg-gray-900 dark:hover:bg-gray-800/60",children:[s.jsx(Zt,{open:B,size:13,className:"text-gray-400"}),s.jsx("span",{className:"shrink-0 text-sm font-semibold",children:v.traces.task(z.taskIndex+1)}),C?.compaction===!0&&s.jsx("span",{className:"shrink-0 rounded bg-gray-100 px-1.5 py-0.5 text-[10px] font-medium text-gray-500 dark:bg-gray-800 dark:text-gray-400",children:v.traces.compactionRound}),s.jsx("span",{className:"min-w-0 flex-1"}),s.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-x-3 gap-y-1",children:[s.jsx(Qi,{icon:Et.toolCalls,value:String(z.toolCalls),label:v.traces.toolCalls}),s.jsx(IR,{buckets:re}),s.jsx(Qi,{icon:Et.output,value:We(re.output),label:v.traces.taskOutput}),s.jsx(Qi,{icon:Et.cost,value:Pn(P(re),d),label:`${v.chat.statCost}(${d})`}),s.jsx(Qi,{icon:Et.elapsed,value:At(z.durationMs),label:v.chat.statElapsed}),s.jsx(Qi,{icon:Et.tps,value:ou(Pf(re.output,C?.llmMs??0)),label:v.chat.statTps})]}),G&&s.jsx(xR,{cacheRead:G.cacheRead,cacheWrite:G.cacheWrite,output:G.output,max:K,size:22})]}),B&&s.jsxs("div",{className:"space-y-3 p-3",children:[(z.segments.length>0||z.spans.length>0)&&s.jsxs("div",{className:"rounded-md border border-gray-100 p-2 dark:border-gray-800/60",children:[s.jsx("p",{className:"mb-1.5 text-[11px] font-medium text-gray-500",children:v.traces.timeline}),s.jsx(NR,{segments:z.segments,toolSpans:z.spans,highlight:o,onHighlight:c,onJump:R,hideTaskLabel:!0})]}),s.jsxs("div",{children:[s.jsxs("p",{className:"mb-1.5 text-[11px] font-medium text-gray-500",children:[v.traces.messages,"(",z.messages.length,")"]}),z.messages.length===0?s.jsx("p",{className:"text-xs text-gray-400",children:v.common.none}):s.jsx("ul",{className:"divide-y divide-gray-100 rounded-md border border-gray-200 dark:divide-gray-800/60 dark:border-gray-800",children:z.messages.map((ue,ge)=>{const we=r1(z.taskIndex,ge);return s.jsx(LR,{msg:ue,rowKey:we,matched:we===xe||we===$,onHighlight:Ne=>c(Ne)},ge)})})]})]})]},z.taskIndex)}),m.length<w&&s.jsx("p",{className:"text-xs text-gray-400",children:v.traces.truncatedNote(m.length,w)})]})}function $R(e){const a=new Map;for(const r of e.dates)for(const i of r.sessions){const o=a.get(i.sessionId)??[];for(const c of i.files)o.push({index:c.index,date:r.date,sizeBytes:c.sizeBytes});a.set(i.sessionId,o)}return[...a.entries()].sort((r,i)=>i[0].localeCompare(r[0])).map(([r,i])=>({sessionId:r,files:i.sort((o,c)=>c.index-o.index)}))}function BR({projectId:e,agentId:a,name:r,defaultOpen:i,focusSessionId:o,titleOf:c,selection:d,onSelect:f}){const[h,m]=k.useState(i),[g,y]=k.useState(null),[b,w]=k.useState(null);k.useEffect(()=>{!h||g||Uw(e,a).then(A=>y($R(A))).catch(A=>w(A instanceof Ie?A.message:v.common.unknownError))},[h,g,e,a]);const N=k.useRef(!1);return k.useEffect(()=>{if(N.current||!o||!g)return;N.current=!0;const A=g.find(j=>j.sessionId===o);A&&f({agentId:a,sessionId:A.sessionId,files:A.files})},[g,o,a,f]),s.jsxs("li",{className:"pt-2.5",children:[s.jsx("div",{className:"flex items-center px-1 pb-0.5",children:s.jsxs("button",{type:"button",onClick:()=>m(A=>!A),"aria-label":h?v.nav.collapseGroup:v.nav.expandGroup,className:"flex min-w-0 flex-1 items-center gap-1 rounded px-1 py-0.5 text-left transition-colors duration-150 hover:bg-gray-200/50 dark:hover:bg-gray-800/50",children:[s.jsx(Vr,{id:a,size:18,className:"shrink-0 rounded"}),s.jsx("span",{className:"min-w-0 truncate text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400",children:r}),s.jsx(Zt,{open:h,size:12,className:"text-gray-400"}),s.jsx("span",{className:"min-w-0 flex-1"})]})}),h&&s.jsxs("div",{className:"anim-fade",children:[b&&s.jsx("p",{className:"px-2.5 py-1 text-xs text-red-500",children:b}),!g&&!b&&s.jsx("p",{className:"px-2.5 py-1 text-xs text-gray-400",children:v.common.loading}),g&&g.length===0&&s.jsx("p",{className:"px-2.5 py-1 text-xs text-gray-400 dark:text-gray-600",children:v.traces.empty}),s.jsx("ul",{className:"space-y-0.5",children:g?.map(A=>{const j=d?.agentId===a&&d.sessionId===A.sessionId,T=c(a,A.sessionId);return s.jsx("li",{children:s.jsxs("button",{type:"button",onClick:()=>f({agentId:a,sessionId:A.sessionId,files:A.files}),className:`flex w-full items-center gap-1.5 rounded-md px-2.5 py-1.5 text-left transition-colors duration-150 ${j?"bg-gray-200/70 dark:bg-gray-800":"hover:bg-gray-200/50 dark:hover:bg-gray-800/70"}`,children:[s.jsx(Eu,{text:T??A.sessionId,className:`min-w-0 flex-1 ${T?"text-sm":"font-mono text-xs"} ${j?"font-medium text-gray-900 dark:text-gray-100":"text-gray-700 dark:text-gray-300"}`}),s.jsx("span",{className:"shrink-0 font-mono text-[11px] text-gray-400",children:A.files.length})]})},A.sessionId)})})]})]})}function HR(){sa(v.traces.title);const{currentProject:e,agents:a,agentsLoading:r}=Yt(),{byAgent:i}=Cu(),o=e?.projectId??null,[c]=Mm(),d=c.get("agentId"),f=c.get("sessionId"),[h,m]=k.useState(null),[g,y]=k.useState(null),[b,w]=k.useState(null);k.useEffect(()=>{m(null),y(null)},[o]),k.useEffect(()=>{w(null)},[h,g]);const N=(j,T)=>i.get(j)?.find(I=>I.sessionId===T)?.title;if(!o)return null;const A=h===null?null:h.files.find(j=>j.index===g)??h.files[0]??null;return s.jsxs("div",{className:"flex h-full flex-col md:flex-row",children:[s.jsxs("aside",{className:"max-h-52 shrink-0 overflow-y-auto border-b border-gray-200 bg-gray-50 px-1 py-2 md:max-h-none md:w-72 md:border-b-0 md:border-r dark:border-gray-800 dark:bg-gray-900",children:[s.jsx("p",{className:"px-3 pb-1 text-xs font-bold uppercase tracking-wide text-gray-500",children:v.traces.title}),r?s.jsx(Wr,{rows:4}):s.jsx("ul",{children:a.map(j=>s.jsx(BR,{projectId:o,agentId:j.agentId,name:za(j),defaultOpen:d===null||d===j.agentId,...f!==null&&d===j.agentId?{focusSessionId:f}:{},titleOf:N,selection:h,onSelect:T=>{m(T),y(T.files[0]?.index??null)}},j.agentId))})]}),s.jsx("section",{className:"min-w-0 flex-1 overflow-y-auto p-3 md:p-4",children:h&&A?s.jsxs("div",{className:"mx-auto max-w-4xl space-y-4",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("p",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:N(h.agentId,h.sessionId)??s.jsx("span",{className:"font-mono text-xs font-normal text-gray-500",children:h.sessionId})}),s.jsxs("div",{className:"flex flex-wrap items-center gap-1",children:[s.jsx("span",{className:"mr-1 text-xs text-gray-400",children:v.traces.filesTitle}),h.files.map(j=>s.jsxs("button",{type:"button",onClick:()=>y(j.index),title:`${j.date} · ${qf(j.sizeBytes)}`,className:`rounded-md border px-2 py-0.5 font-mono text-xs transition-colors duration-150 ${j.index===A.index?"border-gray-400 bg-gray-200/70 font-semibold text-gray-900 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100":"border-gray-200 text-gray-500 hover:bg-gray-100 dark:border-gray-800 dark:text-gray-400 dark:hover:bg-gray-800/60"}`,children:["#",String(j.index).padStart(3,"0")]},j.index))]})]}),s.jsxs("p",{className:"truncate font-mono text-xs text-gray-400",children:[h.sessionId," · ",A.date," · ",qf(A.sizeBytes)]}),s.jsx(UR,{projectId:o,agentId:h.agentId,sessionId:h.sessionId,index:A.index,highlight:b,onHighlight:w})]}):s.jsx(fr,{title:v.traces.selectSession})})]})}function Ab(e,a){return e.map(r=>{const i=a==="score"?r.score:a==="cost"?r.cost:r.durationMs;return typeof i=="number"&&Number.isFinite(i)?i:null})}function PR(e){const a=[];let r=[];return e.forEach((i,o)=>{if(i===null){r.length>0&&a.push(r),r=[];return}r.push({index:o,value:i})}),r.length>0&&a.push(r),a}function qR(e){return Math.max(1e-9,...e.filter(a=>a!==null))}function FR(e){const a=new Map;e.forEach((i,o)=>{const c=i.modelId!==void 0&&i.modelId!=="",d=c?`${i.provider??""}\0${i.modelId}`:"";let f=a.get(d);f||(f={key:d,...c&&i.provider!==void 0?{provider:i.provider}:{},...c&&i.modelId!==void 0?{modelId:i.modelId}:{},indices:[]},a.set(d,f)),f.indices.push(o)});const r=[...a.values()];return[...r.filter(i=>i.key!==""),...r.filter(i=>i.key==="")]}function VR(e,a,r){const i=new Set(a.indices);return Ab(e,r).map((o,c)=>i.has(c)?o:null)}function YR({projectId:e,agentId:a,name:r,defaultOpen:i,selection:o,onSelect:c}){const[d,f]=k.useState(i),[h,m]=k.useState(null),[g,y]=k.useState(null);return k.useEffect(()=>{!d||h||nS(e,a).then(b=>m(b.benchmarks)).catch(b=>y(b instanceof Ie?b.message:v.common.unknownError))},[d,h,e,a]),s.jsxs("li",{className:"pt-2.5",children:[s.jsx("div",{className:"flex items-center px-1 pb-0.5",children:s.jsxs("button",{type:"button",onClick:()=>f(b=>!b),"aria-label":d?v.nav.collapseGroup:v.nav.expandGroup,className:"flex min-w-0 flex-1 items-center gap-1 rounded px-1 py-0.5 text-left transition-colors duration-150 hover:bg-gray-200/50 dark:hover:bg-gray-800/50",children:[s.jsx(Vr,{id:a,size:18,className:"shrink-0 rounded"}),s.jsx("span",{className:"min-w-0 truncate text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400",children:r}),s.jsx(Zt,{open:d,size:12,className:"text-gray-400"}),s.jsx("span",{className:"min-w-0 flex-1"})]})}),d&&s.jsxs("div",{className:"anim-fade",children:[g&&s.jsx("p",{className:"px-2.5 py-1 text-xs text-red-500",children:g}),!h&&!g&&s.jsx("p",{className:"px-2.5 py-1 text-xs text-gray-400",children:v.common.loading}),h&&h.length===0&&s.jsx("p",{className:"px-2.5 py-1 text-xs text-gray-400 dark:text-gray-600",children:v.benchmark.emptyAgent}),s.jsx("ul",{className:"space-y-0.5",children:h?.map(b=>{const w=o?.agentId===a&&o.benchmark.id===b.id;return s.jsx("li",{children:s.jsxs("button",{type:"button",onClick:()=>c({agentId:a,benchmark:b}),className:`flex w-full items-center gap-1.5 rounded-md px-2.5 py-1.5 text-left transition-colors duration-150 ${w?"bg-gray-200/70 dark:bg-gray-800":"hover:bg-gray-200/50 dark:hover:bg-gray-800/70"}`,children:[s.jsx(Eu,{text:b.title,className:`min-w-0 flex-1 text-sm ${w?"font-medium text-gray-900 dark:text-gray-100":"text-gray-700 dark:text-gray-300"}`}),s.jsx("span",{className:"shrink-0 font-mono text-[11px] text-gray-400",children:b.caseCount})]})},b.id)})})]})]})}function Qo(e){return e==="score"?v.benchmark.colScore:e==="cost"?v.benchmark.colCost:v.benchmark.colDuration}function l1(e,a){return e==="score"?uu(a):e==="cost"?Pn(a):At(a)}function GR({evaluations:e,series:a,metric:r}){const[i,o]=k.useState(null),[c,d]=sh(),f=Ab(e,r),h=ih(e.length,qR(f),d),m=e.map(y=>Nn(y.time)),g=h.y(0);return s.jsx("div",{ref:c,children:d>0&&s.jsx(oh,{geom:h,fmtY:y=>l1(r,y),dates:m,hover:i,onHover:o,bubble:y=>{const b=e[y],w=f[y]??null;return s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"text-gray-400",children:Nn(b.time)}),s.jsxs("p",{className:"font-mono",children:[w===null?"—":l1(r,w),b.version!==void 0&&s.jsxs("span",{className:"ml-1.5 text-gray-400",children:["v",b.version]})]}),b.modelId&&s.jsx("p",{className:"font-mono text-gray-400",children:b.modelId})]})},children:a.map((y,b)=>{const w=PR(VR(e,y,r));return s.jsx("g",{className:y.modelId?jb(b).text:"text-gray-400 dark:text-gray-500",children:w.map((N,A)=>{const j=N.map((I,M)=>`${M===0?"M":"L"}${h.x(I.index)},${h.y(I.value)}`).join(" "),T=`${j} L${h.x(N[N.length-1].index)},${g} L${h.x(N[0].index)},${g} Z`;return s.jsxs("g",{children:[N.length>1&&s.jsx("path",{d:T,className:"fill-current",stroke:"none",opacity:i!==null?.06:.1}),N.length>1&&s.jsx("path",{d:j,fill:"none",stroke:"currentColor",strokeWidth:2,opacity:i!==null?.35:1}),N.map(I=>s.jsx("circle",{cx:h.x(I.index),cy:h.y(I.value),r:i===I.index?4:2.5,className:"fill-current",opacity:i!==null&&i!==I.index?.25:1},I.index))]},A)})},y.key===""?"unlabeled":y.key)})})})}function KR({evaluations:e}){const[a,r]=k.useState("score"),i=FR(e),o=i.map(f=>f.modelId).filter(f=>f!==void 0),c=new Set(o.filter((f,h)=>o.indexOf(f)!==h)),d=f=>{if(!f.modelId)return v.benchmark.legendUnlabeled;if(!c.has(f.modelId))return f.modelId;const h=f.provider?dr(f.provider)?.label??f.provider:"";return h?`${f.modelId} · ${h}`:f.modelId};return s.jsxs("div",{children:[s.jsxs("div",{className:"mb-1 flex items-center justify-between gap-2",children:[s.jsx("p",{className:"text-xs font-semibold text-gray-500",children:v.benchmark.trendTitle(Qo(a))}),s.jsx("div",{className:"w-44 shrink-0",children:s.jsx(Ur,{options:[{value:"score",label:Qo("score")},{value:"cost",label:Qo("cost")},{value:"duration",label:Qo("duration")}],value:a,onChange:r})})]}),i.length>=2&&s.jsx("div",{className:"mb-1.5 flex flex-wrap items-center gap-x-3 gap-y-1",children:i.map((f,h)=>s.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-gray-500 dark:text-gray-400",title:f.provider?dr(f.provider)?.label??f.provider:void 0,children:[s.jsx("span",{className:`inline-block h-2 w-2 shrink-0 rounded-sm ${f.modelId?jb(h).swatch:"bg-gray-400 dark:bg-gray-500"}`}),s.jsx("span",{className:"font-mono",children:d(f)})]},f.key===""?"unlabeled":f.key))}),s.jsx(GR,{evaluations:e,series:i,metric:a})]})}const Il="px-3 py-2";function WR({agentId:e,evaluation:a}){const[r,i]=k.useState(!1);return s.jsxs(s.Fragment,{children:[s.jsxs("tr",{onClick:()=>i(o=>!o),className:"cursor-pointer border-b border-gray-100 transition-colors duration-150 last:border-b-0 hover:bg-gray-50 dark:border-gray-800/60 dark:hover:bg-gray-800/40",children:[s.jsx("td",{className:Il,children:s.jsxs("span",{className:"flex items-center gap-1.5 text-xs",children:[s.jsx(Zt,{open:r,size:12,className:"text-gray-400"}),Nn(a.time)]})}),s.jsx("td",{className:`${Il} font-mono text-xs text-gray-500 dark:text-gray-400`,children:a.version!==void 0?`v${a.version}`:"—"}),s.jsx("td",{className:`${Il} max-w-40 truncate font-mono text-xs text-gray-500 dark:text-gray-400`,title:a.provider,children:a.modelId??"—"}),s.jsx("td",{className:`${Il} font-mono text-xs font-semibold tabular-nums`,children:uu(a.score)}),s.jsx("td",{className:`${Il} font-mono text-xs tabular-nums text-gray-500 dark:text-gray-400`,children:Pn(a.cost)}),s.jsx("td",{className:`${Il} font-mono text-xs tabular-nums text-gray-500 dark:text-gray-400`,children:a.durationMs!==void 0?At(a.durationMs):"—"})]}),r&&s.jsx("tr",{className:"border-b border-gray-100 last:border-b-0 dark:border-gray-800/60",children:s.jsxs("td",{colSpan:6,className:"bg-gray-50/80 px-3 py-2 dark:bg-gray-950/40",children:[(a.summaryTitle||a.summary)&&s.jsxs("div",{className:"mb-2",children:[a.summaryTitle?s.jsx("p",{className:"text-xs font-semibold text-gray-700 dark:text-gray-200",children:a.summaryTitle}):s.jsx("p",{className:"text-xs font-semibold text-gray-500",children:v.benchmark.summaryLabel}),a.summary&&s.jsx("p",{className:"mt-0.5 whitespace-pre-wrap text-xs text-gray-600 dark:text-gray-300",children:a.summary})]}),s.jsxs("table",{className:"w-full text-left",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"text-xs text-gray-500",children:[s.jsx("th",{className:"px-2 py-1 font-medium",children:v.benchmark.colCase}),s.jsx("th",{className:"px-2 py-1 font-medium",children:v.benchmark.colScore}),s.jsx("th",{className:"px-2 py-1 font-medium",children:v.benchmark.colCost}),s.jsx("th",{className:"px-2 py-1 font-medium",children:v.benchmark.colDuration}),s.jsx("th",{className:"px-2 py-1 font-medium",children:v.benchmark.colSession})]})}),s.jsx("tbody",{children:a.cases.map(o=>s.jsx(XR,{agentId:e,caseScore:o},o.case))})]})]})})]})}function i1({agentId:e,sessionId:a}){return a?s.jsx(Em,{to:`/traces?agentId=${encodeURIComponent(e)}&sessionId=${encodeURIComponent(a)}`,className:"font-mono text-gray-600 underline decoration-gray-300 underline-offset-2 hover:text-gray-900 dark:text-gray-300 dark:decoration-gray-600 dark:hover:text-gray-100",title:a,children:a}):s.jsx("span",{className:"text-gray-400",children:"—"})}function XR({agentId:e,caseScore:a}){const[r,i]=k.useState(!1),o=a.runs??[],c=o.length>0;return s.jsxs(s.Fragment,{children:[s.jsxs("tr",{onClick:c?()=>i(d=>!d):void 0,className:`text-xs ${c?"cursor-pointer transition-colors duration-150 hover:bg-gray-100/70 dark:hover:bg-gray-800/40":""}`,children:[s.jsx("td",{className:"px-2 py-1 font-mono",children:s.jsxs("span",{className:"flex items-center gap-1.5",children:[c&&s.jsx(Zt,{open:r,size:12,className:"text-gray-400"}),a.case]})}),s.jsx("td",{className:"px-2 py-1 font-mono tabular-nums",children:uu(a.score)}),s.jsx("td",{className:"px-2 py-1 font-mono tabular-nums text-gray-500 dark:text-gray-400",children:Pn(a.cost)}),s.jsx("td",{className:"px-2 py-1 font-mono tabular-nums text-gray-500 dark:text-gray-400",children:a.durationMs!==void 0?At(a.durationMs):"—"}),s.jsx("td",{className:"px-2 py-1",children:s.jsx(i1,{agentId:e,...a.sessionId?{sessionId:a.sessionId}:{}})})]}),r&&o.map((d,f)=>s.jsxs("tr",{className:"text-xs text-gray-500 dark:text-gray-400",children:[s.jsxs("td",{className:"py-1 pl-7 pr-2 font-mono",children:[v.benchmark.colRun," #",f+1]}),s.jsx("td",{className:"px-2 py-1 font-mono tabular-nums",children:uu(d.score)}),s.jsx("td",{className:"px-2 py-1 font-mono tabular-nums",children:Pn(d.cost)}),s.jsx("td",{className:"px-2 py-1 font-mono tabular-nums",children:d.durationMs!==void 0?At(d.durationMs):"—"}),s.jsx("td",{className:"px-2 py-1",children:s.jsx(i1,{agentId:e,...d.sessionId?{sessionId:d.sessionId}:{}})})]},f))]})}function QR(){sa(v.benchmark.title);const{currentProject:e,agents:a,agentsLoading:r}=Yt(),i=e?.projectId??null,[o]=Mm(),c=o.get("agentId"),[d,f]=k.useState(null);if(k.useEffect(()=>{f(null)},[i]),!i)return null;const h=d?.benchmark??null,m=h?[...h.evaluations].sort((g,y)=>g.time.localeCompare(y.time)):[];return s.jsxs("div",{className:"flex h-full flex-col md:flex-row",children:[s.jsxs("aside",{className:"max-h-52 shrink-0 overflow-y-auto border-b border-gray-200 bg-gray-50 px-1 py-2 md:max-h-none md:w-72 md:border-b-0 md:border-r dark:border-gray-800 dark:bg-gray-900",children:[s.jsx("p",{className:"px-3 pb-1 text-xs font-bold uppercase tracking-wide text-gray-500",children:v.benchmark.title}),r?s.jsx(Wr,{rows:4}):s.jsx("ul",{children:a.map(g=>s.jsx(YR,{projectId:i,agentId:g.agentId,name:za(g),defaultOpen:c===null||c===g.agentId,selection:d,onSelect:f},g.agentId))})]}),s.jsx("section",{className:"min-w-0 flex-1 overflow-y-auto p-3 md:p-4",children:d&&h?s.jsxs("div",{className:"mx-auto max-w-4xl space-y-4",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-1",children:[s.jsx("h1",{className:"min-w-0 truncate text-lg font-semibold",children:h.title}),s.jsx("span",{className:"text-xs text-gray-500",children:v.benchmark.caseCount(h.caseCount)})]}),h.description&&s.jsx("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:h.description})]}),m.length===0?s.jsx(fr,{title:v.benchmark.noEvaluations}):s.jsxs(s.Fragment,{children:[s.jsx(KR,{evaluations:m}),s.jsxs("div",{children:[s.jsx("p",{className:"mb-1 text-xs font-semibold text-gray-500",children:v.benchmark.evaluations}),s.jsx("div",{className:"overflow-x-auto overflow-y-clip rounded-md border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900",children:s.jsxs("table",{className:"w-full min-w-[600px] text-left text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-gray-200 bg-gray-50/80 text-xs text-gray-500 dark:border-gray-800 dark:bg-gray-900",children:[s.jsx("th",{className:"px-3 py-2.5",children:v.benchmark.colTime}),s.jsx("th",{className:"px-3 py-2.5",children:v.benchmark.colVersion}),s.jsx("th",{className:"px-3 py-2.5",children:v.benchmark.colModel}),s.jsx("th",{className:"px-3 py-2.5",children:v.benchmark.colScore}),s.jsx("th",{className:"px-3 py-2.5",children:v.benchmark.colCost}),s.jsx("th",{className:"px-3 py-2.5",children:v.benchmark.colDuration})]})}),s.jsx("tbody",{children:[...m].reverse().map((g,y)=>s.jsx(WR,{agentId:d.agentId,evaluation:g},y))})]})})]})]})]},`${d.agentId}/${h.id}`):s.jsx(fr,{title:v.benchmark.selectBenchmark})})]})}function ZR(){sa(v.admin.users);const{user:e}=qn(),[a,r]=k.useState(null),[i,o]=k.useState(null),[c,d]=k.useState(!1),[f,h]=k.useState(null),[m,g]=k.useState(null),y=k.useCallback(async()=>{try{r((await kw()).users),o(null)}catch(b){o(b instanceof Ie?b.message:v.common.unknownError)}},[]);return k.useEffect(()=>{e?.isAdmin&&y()},[e?.isAdmin,y]),e&&!e.isAdmin?s.jsx(ss,{to:"/chat",replace:!0}):s.jsxs("div",{className:"h-full overflow-y-auto p-4 md:p-6",children:[s.jsxs("div",{className:"mx-auto max-w-3xl",children:[s.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[s.jsx("h1",{className:"text-xl font-semibold",children:v.admin.users}),s.jsx(pe,{variant:"primary",onClick:()=>d(!0),children:v.admin.createUser})]}),a===null?s.jsx("p",{className:"text-sm text-gray-400",children:v.common.loading}):s.jsx("div",{className:"overflow-x-auto rounded-lg border border-gray-200 dark:border-gray-800",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-gray-100 bg-gray-50 text-left text-xs text-gray-500 dark:border-gray-800 dark:bg-gray-900/60 dark:text-gray-400",children:[s.jsx("th",{className:"whitespace-nowrap px-3 py-2 font-medium",children:v.admin.userId}),s.jsx("th",{className:"whitespace-nowrap px-3 py-2 font-medium",children:v.admin.role}),s.jsx("th",{className:"whitespace-nowrap px-3 py-2 font-medium",children:v.admin.createdAt}),s.jsx("th",{className:"whitespace-nowrap px-3 py-2 text-right font-medium",children:v.admin.actions})]})}),s.jsx("tbody",{className:"divide-y divide-gray-100 dark:divide-gray-800/60",children:a.map(b=>s.jsxs("tr",{children:[s.jsxs("td",{className:"whitespace-nowrap px-3 py-2 font-medium",children:[b.userId,b.passwordIsInitial&&s.jsx("span",{className:"ml-2 align-middle",children:s.jsx(mt,{tone:"gray",children:v.admin.initialPasswordFlag})})]}),s.jsx("td",{className:"whitespace-nowrap px-3 py-2",children:s.jsx(mt,{tone:"gray",children:b.isAdmin?v.admin.roleAdmin:v.admin.roleUser})}),s.jsx("td",{className:"whitespace-nowrap px-3 py-2 text-gray-500 dark:text-gray-400",children:Nn(b.createdAt)}),s.jsxs("td",{className:"whitespace-nowrap px-3 py-1.5 text-right",children:[s.jsx(pe,{size:"sm",variant:"ghost",onClick:()=>h(b),children:v.admin.resetPassword}),!b.isAdmin&&s.jsx(pe,{size:"sm",variant:"ghost",onClick:()=>g(b),children:v.admin.deleteUser})]})]},b.userId))})]})}),i&&s.jsx("p",{className:"mt-2 text-xs text-red-600 dark:text-red-400",children:i})]}),s.jsx(JR,{open:c,onClose:()=>d(!1),onDone:()=>{d(!1),y()}}),s.jsx(e8,{user:f,onClose:()=>h(null)}),s.jsx(t8,{user:m,onClose:()=>g(null),onDone:()=>{g(null),y()}})]})}function JR({open:e,onClose:a,onDone:r}){const[i,o]=k.useState(""),[c,d]=k.useState(""),[f,h]=k.useState(null),[m,g]=k.useState(!1);k.useEffect(()=>{e&&(o(""),d(""),h(null))},[e]);const y=async()=>{const b=i.trim();if(!b||!c){h(v.common.requiredField);return}if(!Iy.test(b)){h(v.auth.usernameHint);return}g(!0),h(null);try{await ww({userId:b,password:c}),r()}catch(w){h(w instanceof Ie?w.message:v.common.unknownError)}finally{g(!1)}};return s.jsx(bt,{open:e,title:v.admin.createUser,onClose:a,footer:s.jsxs(s.Fragment,{children:[s.jsx(pe,{onClick:a,disabled:m,children:v.common.cancel}),s.jsx(pe,{variant:"primary",disabled:m,onClick:()=>{y()},children:v.common.create})]}),children:s.jsxs("div",{className:"space-y-3",children:[s.jsx(qe,{label:v.admin.userId,size:"sm",value:i,onChange:b=>o(b.target.value),hint:v.auth.usernameHint,autoFocus:!0}),s.jsx(qr,{label:v.admin.initialPassword,size:"sm",value:c,onChange:b=>d(b.target.value),autoComplete:"new-password",hint:v.auth.passwordHint}),Iy.test(i.trim())&&s.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:v.admin.defaultProjectNote(`${i.trim()}-default_project`)}),f&&s.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:f})]})})}function e8({user:e,onClose:a}){const[r,i]=k.useState(""),[o,c]=k.useState(null),[d,f]=k.useState(!1);k.useEffect(()=>{e&&(i(""),c(null))},[e]);const h=async()=>{if(e){if(!r){c(v.common.requiredField);return}f(!0),c(null);try{await Sw(e.userId,{password:r}),a()}catch(m){c(m instanceof Ie?m.message:v.common.unknownError)}finally{f(!1)}}};return s.jsx(bt,{open:e!==null,title:e?v.admin.resetPasswordTitle(e.userId):"",onClose:a,footer:s.jsxs(s.Fragment,{children:[s.jsx(pe,{onClick:a,disabled:d,children:v.common.cancel}),s.jsx(pe,{variant:"primary",disabled:d,onClick:()=>{h()},children:v.common.save})]}),children:s.jsxs("div",{className:"space-y-3",children:[s.jsx(qr,{label:v.admin.initialPassword,size:"sm",value:r,onChange:m=>i(m.target.value),autoComplete:"new-password",hint:v.auth.passwordHint,autoFocus:!0}),s.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:v.admin.resetPasswordNote}),o&&s.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:o})]})})}function t8({user:e,onClose:a,onDone:r}){const[i,o]=k.useState(!1),[c,d]=k.useState(null),[f,h]=k.useState(!1);k.useEffect(()=>{e&&(o(!1),d(null))},[e]);const m=async()=>{if(e){h(!0),d(null);try{await jw(e.userId),r()}catch(g){d(g instanceof Ie?g.message:v.common.unknownError)}finally{h(!1)}}};return s.jsx(bt,{open:e!==null,title:e?v.admin.deleteUserTitle(e.userId):"",onClose:a,footer:s.jsxs(s.Fragment,{children:[s.jsx(pe,{onClick:a,disabled:f,children:v.common.cancel}),i?s.jsx(pe,{variant:"danger",disabled:f,onClick:()=>{m()},children:v.common.confirm}):s.jsx(pe,{variant:"danger",onClick:()=>o(!0),children:v.common.delete})]}),children:s.jsxs("div",{className:"space-y-2",children:[s.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:e?v.admin.deleteUserConfirm(e.userId):""}),c&&s.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:c})]})})}function n8(){const{user:e}=qn();return e===void 0?null:e===null?s.jsx(ss,{to:"/login",replace:!0}):s.jsx(Hj,{children:s.jsx(Fj,{children:s.jsx(XA,{})})})}function a8(){const{user:e}=qn();return e?s.jsx(ss,{to:"/chat",replace:!0}):s.jsx(l6,{})}function r8(){return s.jsx(_j,{children:s.jsxs(sj,{children:[s.jsx(un,{path:"/login",element:s.jsx(a8,{})}),s.jsxs(un,{element:s.jsx(n8,{}),children:[s.jsx(un,{index:!0,element:s.jsx(ss,{to:"/chat",replace:!0})}),s.jsx(un,{path:"/chat/:sessionId?",element:s.jsx(UA,{})}),s.jsx(un,{path:"/agents",element:s.jsx(o6,{})}),s.jsx(un,{path:"/agents/:agentId",element:s.jsx(b6,{})}),s.jsx(un,{path:"/skills",element:s.jsx(E6,{})}),s.jsx(un,{path:"/models",element:s.jsx(O6,{})}),s.jsx(un,{path:"/usage",element:s.jsx(gR,{})}),s.jsx(un,{path:"/traces",element:s.jsx(HR,{})}),s.jsx(un,{path:"/benchmark",element:s.jsx(QR,{})}),s.jsx(un,{path:"/admin/users",element:s.jsx(ZR,{})}),s.jsx(un,{path:"*",element:s.jsx(ss,{to:"/chat",replace:!0})})]})]})})}function l8(){return s.jsx(iw,{children:s.jsx(hw,{children:s.jsx(lS,{children:s.jsxs(sw,{children:[s.jsx(r8,{}),s.jsx(R4,{})]})})})})}const Rb=document.getElementById("root");if(!Rb)throw new Error("找不到 #root 挂载点");J2.createRoot(Rb).render(s.jsx(k.StrictMode,{children:s.jsx(l8,{})}));export{vA as _,_4 as a,K4 as b,hy as c,F4 as f,G4 as h,Om as s,I4 as w};
|